diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2d6c173ff..deaff8304 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,26 +9,24 @@ assignees: '' ## 🐛 问题描述 -## 🔍 复现步骤 - +## 🖥️ 环境信息 +- 部署方式: 全模块部署 还是 单Server部署 +- 版本号: 例如 0.3.x + +## 🔍 告诉我们,应该怎么复现这个问题 + 1. 打开 '...' 2. 点击 '...' 3. 滚动到 '...' 4. 看到错误 -## 🤔 预期行为 +## 🤔 你原本希望是怎么样的 -## 😯 截图 +## 😯 提供一些截图 - -## 🖥️ 环境信息 -- 操作系统: [例如 Windows 10] -- 浏览器: [例如 Chrome 89] -- 项目版本: [例如 1.0.0] -- Python版本: [例如 3.9.13] -- Jdk版本:[例如 java 21.0.5 2024-10-15 LTS] -- Nodejs版本:[例如 v20.14.0] +1. 比如日志截图,越多越好 +2. 比如界面反应 ## 📋 其他信息 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 68174a38c..e54cdd4ee 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0 + workflow_dispatch: jobs: release: @@ -41,7 +42,13 @@ jobs: - name: Extract version from tag id: get_version run: | - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + if [[ "$GITHUB_REF" =~ ^refs/tags/v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + echo "VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV + echo "IS_VERSION=true" >> $GITHUB_ENV + else + echo "VERSION=latest" >> $GITHUB_ENV + echo "IS_VERSION=false" >> $GITHUB_ENV + fi # 构建 xiaozhi-server 镜像 - name: Build and push xiaozhi-server @@ -51,8 +58,7 @@ jobs: file: Dockerfile-server push: true tags: | - ghcr.io/${{ github.repository }}:server_${{ env.VERSION }} - ghcr.io/${{ github.repository }}:server_latest + ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:server_{1},ghcr.io/{0}:server_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:server_latest', github.repository) }} platforms: linux/amd64,linux/arm64 # 构建 manager-api 镜像 @@ -63,6 +69,5 @@ jobs: file: Dockerfile-web push: true tags: | - ghcr.io/${{ github.repository }}:web_${{ env.VERSION }} - ghcr.io/${{ github.repository }}:web_latest + ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:web_{1},ghcr.io/{0}:web_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:web_latest', github.repository) }} platforms: linux/amd64,linux/arm64 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 675fb688e..f4efaeaa7 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,7 @@ docs/_build/ # PyBuilder .pybuilder/ target/ +*.pid # Jupyter Notebook .ipynb_checkpoints @@ -106,7 +107,6 @@ celerybeat.pid *.sage.py # Environments -.env .venv env/ venv/ @@ -150,9 +150,19 @@ main/manager-web/node_modules .config.yaml .secrets.yaml .private_config.yaml -.env.development # model files main/xiaozhi-server/models/SenseVoiceSmall/model.pt main/xiaozhi-server/models/sherpa-onnx* my_wakeup_words.mp3 +!main/xiaozhi-server/config/assets/bind_code.wav +!main/xiaozhi-server/config/assets/bind_not_found.wav +!main/xiaozhi-server/config/assets/bind_code/*.wav +!main/xiaozhi-server/config/assets/max_output_size.wav +main/manager-api/.vscode + +# Ignore webpack cache directory +main/manager-web/.webpack_cache/ +main/xiaozhi-server/mysql +uploadfile +.vscode diff --git a/Dockerfile-web b/Dockerfile-web index 0c4001f1e..9e5da6787 100644 --- a/Dockerfile-web +++ b/Dockerfile-web @@ -23,7 +23,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* # 配置Nginx -COPY docs/docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY docs/docker/nginx.conf /etc/nginx/nginx.conf # 复制前端构建产物 COPY --from=web-builder /app/dist /usr/share/nginx/html diff --git a/README.md b/README.md index 191790bcf..b1bf6dae8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,27 @@ -[![SVG Banners](https://svg-banners.vercel.app/api?type=origin&text1=你好😃,小智📟&text2=开源小智ESP-32后端服务&width=830&height=210)](https://github.com/xinnan-tech/xiaozhi-esp32-server) +[![Banners](docs/images/banner1.png)](https://github.com/xinnan-tech/xiaozhi-esp32-server) + +

小智后端服务xiaozhi-esp32-server

+

+本项目为开源智能硬件项目 +xiaozhi-esp32提供后端服务
+根据小智通信协议使用Python、Java、Vue实现
+帮助您快速搭建小智服务器 +

+ +

+English +· 常见问题 +· 反馈问题 +· 部署文档 +· 更新日志 +

+

+ + GitHub Contributors + - GitHub Contributors + GitHub Contributors Issues @@ -9,15 +29,14 @@ GitHub pull requests + + GitHub pull requests + + + stars +

-# 小智 ESP-32 后端服务(xiaozhi-esp32-server) - -(中文 | [English](README_en.md)) - -本项目为开源智能硬件项目 [xiaozhi-esp32](https://github.com/78/xiaozhi-esp32) -提供后端服务。根据 [小智通信协议](https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh) 使用 `Python` 实现。 - --- ## 适用人群 👥 @@ -106,90 +125,85 @@ --- -## 系统要求与部署前提 🖥️ - -- **硬件**:一套兼容 `xiaozhi-esp32` - 的硬件设备(具体型号请参考 [此处](https://rcnv1t9vps13.feishu.cn/wiki/DdgIw4BUgivWDPkhMj1cGIYCnRf))。 - -- **电脑或服务器**:建议 4 核 CPU、8G 内存的电脑。如果开启ASR也使用API,可运行在2核CPU、2G内存的服务器中。 -- **固件编译**:请将本后端服务的接口地址更新至 `xiaozhi-esp32` 项目中,再重新编译`xiaozhi-esp32`固件并烧录到设备上。 - -![图片](docs/images/deploy.png) - -如果你没有esp32相关的硬件设备,但是非常想体验该项目,可以使用以下的项目让你的电脑、手机模拟成esp32设备。 - -- [小智安卓端](https://github.com/TOM88812/xiaozhi-android-client) -- [小智电脑端](https://github.com/Huang-junsen/py-xiaozhi) - -如果你是一名软件开发者,这里有一份[《致开发者的公开信》](docs/contributor_open_letter.md),欢迎加入! - ---- - ## 警告 ⚠️ 1、本项目为开源软件,本软件与对接的任何第三方API服务商(包括但不限于语音识别、大模型、语音合成等平台)均不存在商业合作关系,不为其服务质量及资金安全提供任何形式的担保。 建议使用者优先选择持有相关业务牌照的服务商,并仔细阅读其服务协议及隐私政策。本软件不托管任何账户密钥、不参与资金流转、不承担充值资金损失风险。 -2、本项目成立时间较短,还未通过网络安全测评,请勿在生产环境中使用。 如果您在公网环境中部署学习本项目,请务必在配置文件 -`config.yaml` 中开启防护: - -```yaml -server: - auth: - # 开启防护 - enabled: true -``` - -开启防护后,您需要根据实际情况校验机器的 token 或 mac 地址,详细请参见配置说明。 +2、本项目功能未完善,且未通过网络安全测评,请勿在生产环境中使用。 如果您在公网环境中部署学习本项目,请务必做好必要的防护。 --- +## 部署文档 + +![Banners](docs/images/banner2.png) + +本项目提供两种部署方式,请根据您的具体需求选择: + +#### 🚀 部署方式选择 + +| 部署方式 | 特点 | 适用场景 | Docker部署文档 | 源码部署文档 | +|---------|------|---------|---------|---------| +| **最简化安装** | 智能对话、IOT功能,数据存储在配置文件 | 低配置环境,无需数据库 | [Docker只运行Server](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) | [本地源码只运行Server](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| +| **全模块安装** | 智能对话、IOT、OTA、智控台,数据存储在数据库 | 完整功能体验 |[Docker运行全模块](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) | [本地源码运行全模块](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) | + +> 💡 提示:以下是按最新代码部署后的测试平台,有需要可烧录测试,并发为6个,每天会清空数据 + +``` +智控台地址: https://2662r3426b.vicp.fun + +服务测试工具: https://2662r3426b.vicp.fun/test/ +OTA接口地址: https://2662r3426b.vicp.fun/xiaozhi/ota/ +Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ +``` + +--- ## 功能清单 ✨ ### 已实现 ✅ -- **通信协议** - 基于 `xiaozhi-esp32` 协议,通过 WebSocket 实现数据交互。 -- **对话交互** - 支持唤醒对话、手动对话及实时打断。长时间无对话时自动休眠 -- **意图识别** - 支持使用LLM意图识别、function call函数调用,减少硬编码意图判断 -- **多语言识别** - 支持国语、粤语、英语、日语、韩语(默认使用 FunASR)。 -- **LLM 模块** - 支持灵活切换 LLM 模块,默认使用 ChatGLMLLM,也可选用阿里百炼、DeepSeek、Ollama 等接口。 -- **TTS 模块** - 支持 EdgeTTS(默认)、火山引擎豆包 TTS 等多种 TTS 接口,满足语音合成需求。 -- **记忆功能** - 支持超长记忆、本地总结记忆、无记忆三种模式,满足不同场景需求。 -- **IOT功能** - 支持管理注册设备IOT功能,支持基于对话上下文语境下的智能物联网控制。 +| 功能模块 | 描述 | +|---------|------| +| 通信协议 | 基于 `xiaozhi-esp32` 协议,通过 WebSocket 实现数据交互 | +| 对话交互 | 支持唤醒对话、手动对话及实时打断。长时间无对话时自动休眠 | +| 意图识别 | 支持使用LLM意图识别、function call函数调用,减少硬编码意图判断 | +| 多语言识别 | 支持国语、粤语、英语、日语、韩语(默认使用 FunASR) | +| LLM 模块 | 支持灵活切换 LLM 模块,默认使用 ChatGLMLLM,也可选用阿里百炼、DeepSeek、Ollama 等接口 | +| TTS 模块 | 支持 EdgeTTS(默认)、火山引擎豆包 TTS 等多种 TTS 接口,满足语音合成需求 | +| 记忆功能 | 支持超长记忆、本地总结记忆、无记忆三种模式,满足不同场景需求 | +| IOT功能 | 支持管理注册设备IOT功能,支持基于对话上下文语境下的智能物联网控制 | +| 智控台 | 提供Web管理界面,支持智能体管理、用户管理、系统配置等功能,方便管理员和用户进行管理 | ### 正在开发 🚧 -- 多种心情模式 -- 智控台webui +想了解具体开发计划进度,[请点击这里](https://github.com/users/xinnan-tech/projects/3) -想了解具体开发进度,[请点击这里](https://github.com/users/xinnan-tech/projects/3) +如果你是一名软件开发者,这里有一份[《致开发者的公开信》](docs/contributor_open_letter.md),欢迎加入! + +--- + +## 产品生态 👬 +小智是一个生态,当你使用这个产品时,也可以看看其他在这个生态圈的优秀项目 + +| 项目名称 | 项目地址 | 项目描述 | +|:---------------------|:--------|:--------| +| 小智安卓客户端 | [xiaozhi-android-client](https://github.com/TOM88812/xiaozhi-android-client) | 一个基于xiaozhi-server的Android、IOS语音对话应用,支持实时语音交互和文字对话。
现在是flutter版本,打通IOS、Android端。 | +| 小智电脑客户端 | [py-xiaozhi](https://github.com/Huang-junsen/py-xiaozhi) | 该项目提供了一个基于 Python 实现的小白 AI 客户端,使得在不具备实体硬件条件的情况下,
依然能够体过代码体验小智 AI 的功能。 | +| 小智Java服务端 | [xiaozhi-esp32-server-java](https://github.com/joey-zhou/xiaozhi-esp32-server-java) | 小智开源后端服务 Java 版本是一个基于 Java 的开源项目。
它包括前后端的服务,旨在为用户提供一个完整的后端服务解决方案。 | -![图片](docs/images/webui.png) --- ## 本项目支持的平台/组件列表 📋 ### LLM 语言模型 -| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 | -|:---:|:------------------:|:---------------------:|:-----------:|:-----------------------------------------------------------------------------------------------------------------------:| -| LLM | 阿里百炼 (AliLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://bailian.console.aliyun.com/?apiKey=1#/api-key) | -| LLM | DoubaoLLM | openai 接口调用 | 消耗 token | [点击申请密钥](https://console.volcengine.com/ark/region:ark+cn-beijing/model/detail?Id=doubao-pro-32k&projectName=undefined) | -| LLM | 深度求索 (DeepSeekLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://platform.deepseek.com/) | -| LLM | 智谱(ChatGLMLLM) | openai 接口调用 | 免费 | 虽然免费,仍需[点击申请密钥](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) | -| LLM | OllamaLLM | ollama 接口调用 | 免费/消耗 token | 需预先下载模型(`ollama pull`),服务地址:`http://localhost:11434` | -| LLM | DifyLLM | dify 接口调用 | 免费/消耗 token | 本地化部署,注意配置提示词需在 Dify 控制台设置 | -| LLM | FastgptLLM | fastgpt 接口调用 | 免费/消耗 token | 本地化部署,注意配置提示词需在 Fastgpt 控制台设置 | -| LLM | GeminiLLM | gemini 接口调用 | 免费 | [点击申请密钥](https://aistudio.google.com/apikey) | -| LLM | CozeLLM | coze 接口调用 | 消耗 token | 需提供 bot_id、user_id 及个人令牌 | +| 使用方式 | 支持平台 | 免费平台 | +|:---:|:---:|:---:| +| openai 接口调用 | 阿里百炼、火山引擎豆包、深度求索、智谱ChatGLM、Gemini | 智谱ChatGLM、Gemini | +| ollama 接口调用 | Ollama | - | +| dify 接口调用 | Dify | - | +| fastgpt 接口调用 | Fastgpt | - | +| coze 接口调用 | Coze | - | 实际上,任何支持 openai 接口调用的 LLM 均可接入使用。 @@ -197,21 +211,10 @@ server: ### TTS 语音合成 -| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 | -|:---:|:----------------------:|:----:|:--------:|:-------------------------------------------------------------------------:| -| TTS | EdgeTTS | 接口调用 | 免费 | 默认 TTS,基于微软语音合成技术 | -| TTS | 火山引擎豆包 TTS (DoubaoTTS) | 接口调用 | 消耗 token | [点击创建密钥](https://console.volcengine.com/speech/service/8);建议使用付费版本以获得更高并发 | -| TTS | AliyunTTS | 接口调用 | 消耗 token | [点击创建密钥](https://nls-portal.console.aliyun.com/applist) | -| TTS | CosyVoiceSiliconflow | 接口调用 | 消耗 token | 需申请硅基流动 API 密钥;输出格式为 wav | -| TTS | TTS302AI | 接口调用 | 消耗 token | [点击创建密钥](https://dash.302.ai/apis/list) | -| TTS | CozeCnTTS | 接口调用 | 消耗 token | 需提供 Coze API key;输出格式为 wav | -| TTS | GizwitsTTS | 接口调用 | 消耗 token | [点击创建密钥](https://agentrouter.gizwitsapi.com) | -| TTS | ACGNTTS | 接口调用 | 消耗 token | [联系网站管理员购买密钥](www.ttson.cn) | -| TTS | OpenAITTS | 接口调用 | 消耗 token | 境外使用,境外购买 | -| TTS | FishSpeech | 接口调用 | 免费/自定义 | 本地启动 TTS 服务;启动方法见配置文件内说明 | -| TTS | GPT_SOVITS_V2 | 接口调用 | 免费/自定义 | 本地启动 TTS 服务,适用于个性化语音合成场景 | -| TTS | GPT_SOVITS_V3 | 接口调用 | 免费/自定义 | 本地启动 TTS 服务,适用于个性化语音合成场景 | -| TTS | MinimaxTTS | 接口调用 | 免费/自定义 | 本地启动 TTS 服务,适用于个性化语音合成场景 | +| 使用方式 | 支持平台 | 免费平台 | +|:---:|:---:|:---:| +| 接口调用 | EdgeTTS、火山引擎豆包TTS、腾讯云、阿里云TTS、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS | EdgeTTS、CosyVoiceSiliconflow(部分) | +| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、MinimaxTTS | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、MinimaxTTS | --- @@ -225,12 +228,10 @@ server: ### ASR 语音识别 -| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 | -|:---:|:---------:|:----:|:----:|:--:| -| ASR | FunASR | 本地使用 | 免费 | | -| ASR | SherpaASR | 本地使用 | 免费 | | -| ASR | DoubaoASR | 接口调用 | 收费 | | - +| 使用方式 | 支持平台 | 免费平台 | +|:---:|:---:|:---:| +| 本地使用 | FunASR、SherpaASR | FunASR、SherpaASR | +| 接口调用 | DoubaoASR、FunASRServer、TencentASR、AliyunASR | FunASRServer | --- @@ -252,185 +253,22 @@ server: --- -## 使用方式 🚀 - -### 一、[部署文档](./docs/Deployment.md) - -本项目支持以下三种部署方式,您可根据实际需求选择。 - -1. [Docker 快速部署](./docs/Deployment.md) - -适合快速体验的普通用户,不需过多环境配置。缺点是,拉取镜像有点慢。视频教程可参考[美女大佬教你Docker部署](https://www.bilibili.com/video/BV1RNQnYDE5t) - -2. [借助 Docker 环境运行部署](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E5%80%9F%E5%8A%A9docker%E7%8E%AF%E5%A2%83%E8%BF%90%E8%A1%8C%E9%83%A8%E7%BD%B2) - -适用于已安装 Docker 且希望对代码进行自定义修改的软件工程师。 - -3. [本地源码运行](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%89%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C) - -适合熟悉`Conda` 环境或希望从零搭建运行环境的用户。 - -对于对响应速度要求较高的场景,推荐使用本地源码运行方式以降低额外开销。视频教程可参考[帅哥大佬教你源码部署](https://www.bilibili.com/video/BV1GvQWYZEd2) - -### 二、[固件编译](./docs/firmware-build.md) - -点这里查看[固件编译](./docs/firmware-build.md)的详细过程。 - -烧录成功且联网成功后,通过唤醒词唤醒小智,留意server端输出的控制台信息。 - ---- - -## 常见问题 ❓ - -### 1、为什么我说的话,小智识别出来很多韩文、日文、英文?🇰🇷 - -建议:检查一下`models/SenseVoiceSmall`是否已经有`model.pt` -文件,如果没有就要下载,查看这里[下载语音识别模型文件](docs/Deployment.md#模型文件) - -### 2、为什么会出现“TTS 任务出错 文件不存在”?📁 - -建议:检查一下是否正确使用`conda` 安装了`libopus`和`ffmpeg`库。 - -如果没有安装,就安装 - -``` -conda install conda-forge::libopus -conda install conda-forge::ffmpeg -``` - -### 3、TTS 经常失败,经常超时 ⏰ - -建议:如果 `EdgeTTS` 经常失败,请先检查是否使用了代理(梯子)。如果使用了,请尝试关闭代理后再试; -如果用的是火山引擎的豆包 TTS,经常失败时建议使用付费版本,因为测试版本仅支持 2 个并发。 - -### 4、如何提高小智对话响应速度? ⚡ - -本项目默认配置为低成本方案,建议初学者先使用默认免费模型,解决“跑得动”的问题,再优化“跑得快”。 -如需提升响应速度,可尝试更换各组件。以下为各组件的响应速度测试数据(仅供参考,不构成承诺): - -| 影响因素 | 因素值 | -|:-----:|:----------------:| -| 测试地点 | 广东省广州市海珠区 | -| 测试时间 | 2025年2月19日 12:52 | -| 宽带运营商 | 中国联通 | - -测试方法: - -1、把各组件的密钥配置上去,只有配置了密钥的组件才参与测试。 - -2、配置完密钥后,执行以下方法 - -``` -# 进入项目根目录,执行以下命令: -conda activate xiaozhi-esp32-server -python performance_tester.py -``` - -生成报告如下 - -LLM 性能排行: - -| 模块名称 | 平均首Token时间 | 平均总响应时间 | -|:-----------|:-----------|:--------| -| AliLLM | 0.547s | 1.485s | -| ChatGLMLLM | 0.677s | 3.057s | - -TTS 性能排行: - -| 模块名称 | 平均合成时间 | -|----------------------|--------| -| EdgeTTS | 1.019s | -| DoubaoTTS | 0.503s | -| CosyVoiceSiliconflow | 3.732s | - -推荐配置组合 (综合响应速度): - -| 组合方案 | 综合得分 | LLM首Token | TTS合成 | -|-------------------------------|-------|-----------|--------| -| AliLLM + DoubaoTTS | 0.539 | 0.547s | 0.503s | -| AliLLM + EdgeTTS | 0.642 | 0.547s | 1.019s | -| ChatGLMLLM + DoubaoTTS | 0.642 | 0.677s | 0.503s | -| ChatGLMLLM + EdgeTTS | 0.745 | 0.677s | 1.019s | -| AliLLM + CosyVoiceSiliconflow | 1.184 | 0.547s | 3.732s | - -### 结论 🔍 - -`2025年2月19日`,如果我的电脑在`广东省广州市海珠区`,且使用的是`中国联通`网络,我会优先使用: - -- LLM:`AliLLM` -- TTS:`DoubaoTTS` - -### 5、我说话很慢,停顿时小智老是抢话 🗣️ - -建议:在配置文件中找到如下部分,将 `min_silence_duration_ms` 的值调大(例如改为 `1000`): - -```yaml -VAD: - SileroVAD: - threshold: 0.5 - model_dir: models/snakers4_silero-vad - min_silence_duration_ms: 700 # 如果说话停顿较长,可将此值调大 -``` - -### 6、我想通过小智控制电灯、空调、远程开关机等操作 💡 - -本项目,支持以工具调用的方式控制HomeAssistant设备 - -1、首先选择一款支持function call支持的LLM,例如`ChatGLMLLM`。 - -2、在配置文件中,将 `selected_module.Intent` 设置为 `function_call`。 - -3、登录`HomeAssistant`,点击`左下角个人`,切换`安全`导航栏,划到底部`长期访问令牌`生成api_key。 - -在配置文件中,配置好你的home assistant的`devices`(被控制的设备)和`api_key`和`base_url`等信息。例如: - -``` yaml -plugins - home_assistant: - devices: - - 客厅,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1 - - 卧室,台灯,switch.iot_cn_831898993_socn1_on_p_2_1 - base_url: http://你的homeassistant地址:8123 - api_key: 你的home assistant api访问令牌 -``` - -最后,允许function_call 插件在配置文件中启用`hass_get_state`(必须)、`hass_set_state`(必须)、`hass_play_music`(不想用ha听音乐可以不启动),例如: - -``` yaml -Intent: - ... - function_call: - type: nointent - functions: - - change_role - - get_weather - - get_news - - hass_get_state - - hass_set_state - - hass_play_music -``` - -### 7、更多问题,可联系我们反馈 💬 - -我们的联系方式放在[百度网盘中,点击前往](https://pan.baidu.com/s/1x6USjvP1nTRsZ45XlJu65Q),提取码是`223y`。 - -网盘里有“硬件烧录QQ群”、“开源服务端交流群”、“产品建议联系人” 三张图片,请根据需要选择加入。 - -- 硬件烧录QQ群:适用于硬件烧录问题 -- 开源服务端交流群:适用于服务端问题 -- 产品建议联系人:适用于产品功能、产品设计等建议 - ---- - ## 鸣谢 🙏 -- 本项目受 [百聆语音对话机器人](https://github.com/wwbin2017/bailing) 启发,并在其基础上实现。 -- 感谢 [十方融海](https://www.tenclass.com/) 对小智通讯协议提供的详尽文档支持。 +| Logo | 项目/公司 | 说明 | +|:---:|:---:|:---| +| | [百聆语音对话机器人](https://github.com/wwbin2017/bailing) | 本项目受[百聆语音对话机器人](https://github.com/wwbin2017/bailing)启发,并在其基础上实现 | +| | [十方融海](https://www.tenclass.com/) | 感谢[十方融海](https://www.tenclass.com/)为小智生态制定了标准的通讯协议、多设备兼容性方案及高并发场景实践示范;为本项目提供了全链路技术文档支持 | +| | [玄凤科技](https://github.com/Eric0308) | 感谢[玄凤科技](https://github.com/Eric0308)贡献函数调用框架、MCP通信协议及插件化调用机制的实现代码,通过标准化的指令调度体系与动态扩展能力,显著提升了前端设备(IoT)的交互效率和功能延展性 | +| | [汇远设计](http://ui.kwd988.net/) | 感谢[汇远设计](http://ui.kwd988.net/)为本项目提供专业视觉解决方案,用其服务超千家企业的设计实战经验,赋能本项目产品用户体验 | +| | [西安勤人信息科技](https://www.029app.com/) | 感谢[西安勤人信息科技](https://www.029app.com/)深化本项目视觉体系,确保整体设计风格在多场景应用中的一致性和扩展性 | + + Star History Chart - + \ No newline at end of file diff --git a/README_en.md b/README_en.md deleted file mode 100644 index 883066752..000000000 --- a/README_en.md +++ /dev/null @@ -1,297 +0,0 @@ - -[![SVG Banners](https://svg-banners.vercel.app/api?type=origin&text1=Hello😃,%20XiaoZhi📟&text2=Open%20Source%20XiaoZhi%20ESP-32%20Backend%20Service&width=830&height=210)](https://github.com/xinnan-tech/xiaozhi-esp32-server) -

- - GitHub Contributors - - - Issues - - - GitHub pull requests - -

- -# XiaoZhi ESP-32 Backend Service (xiaozhi-esp32-server) - -([中文](README.md) | English) - -This project provides the backend service for the open source smart hardware project [xiaozhi-esp32](https://github.com/78/xiaozhi-esp32). It is implemented in `Python` based on the [XiaoZhi Communication Protocol](https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh). - ---- - -## Target Audience 👥 - -This project is designed to be used in conjunction with ESP32 hardware devices. If you have already purchased an ESP32 device, successfully connected to the backend service deployed by XieGe, and now wish to set up your own `xiaozhi-esp32` backend service, then this project is perfect for you. - -Want to see it in action? Check out the videos 🎥 - - - - - - - - - - -
- - - XiaoZhi ESP32 connecting to a custom backend model - - - - - - Custom Voice - - - - - - Conversing in Cantonese - - - - - - Control Home Appliances - - - - - - Lowest Cost Configuration - - - -
- ---- - -## System Requirements and Deployment Prerequisites 🖥️ - -- **Hardware**: A set of devices compatible with `xiaozhi-esp32` (for specific models, please refer to [this link](https://rcnv1t9vps13.feishu.cn/wiki/DdgIw4BUgivWDPkhMj1cGIYCnRf)). -- **Server**: A computer with at least a 4-core CPU and 8GB of memory. -- **Firmware Compilation**: Please update the backend service API endpoint in the `xiaozhi-esp32` project, then recompile the firmware and flash it to your device. - ---- - -## Warning ⚠️ - -This project is relatively new and has not yet undergone network security evaluations. **Do not use it in a production environment.** - -If you deploy this project on a public network for learning purposes, be sure to enable protection in the configuration file `config.yaml`: - -```yaml -server: - auth: - # Enable protection - enabled: true -``` - -Once protection is enabled, you will need to validate the machine's token or MAC address based on your actual situation. Please refer to the configuration documentation for details. - ---- - -## Feature List ✨ - -### Implemented ✅ - -- **Communication Protocol** - Based on the `xiaozhi-esp32` protocol, data exchange is implemented via WebSocket. -- **Dialogue Interaction** - Supports wake-up dialogues, manual conversations, and real-time interruptions. Automatically enters sleep mode after long periods of inactivity. -- **Multilingual Recognition** - Supports Mandarin, Cantonese, English, Japanese, and Korean (default using FunASR). -- **LLM Module** - Allows flexible switching of LLM modules. The default is ChatGLMLLM, with options to use AliLLM, DeepSeek, Ollama, and others. -- **TTS Module** - Supports multiple TTS interfaces including EdgeTTS (default) and Volcano Engine Doubao TTS to meet speech synthesis requirements. - -### In Development 🚧 - -- Conversation Memory Feature -- Multiple Mood Modes -- Smart Control Panel Web UI - -![Screenshot](docs/images/webui.png) - ---- - -## Supported Platforms/Components 📋 - -### LLM - -| Type | Platform Name | Usage Method | Pricing Model | Remarks | -|:----:|:-----------------------------:|:-----------------------------:|:-----------------:|:-------------------------------------------------------------------------:| -| LLM | AliLLM (阿里百炼) | OpenAI API call | Token consumption | [Click to apply for API key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) | -| LLM | DeepSeekLLM (深度求索) | OpenAI API call | Token consumption | [Click to apply for API key](https://platform.deepseek.com/) | -| LLM | ChatGLMLLM (智谱) | OpenAI API call | Free | Although free, you still need to [click to apply for an API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) | -| LLM | OllamaLLM | Ollama API call | Free/Custom | Requires pre-downloading the model (`ollama pull`); service URL: `http://localhost:11434` | -| LLM | DifyLLM | Dify API call | Token consumption | For local deployment. Note that prompt configuration must be set in the Dify console. | -| LLM | GeminiLLM | Gemini API call | Free | [Click to apply for API key](https://aistudio.google.com/apikey) | -| LLM | CozeLLM | Coze API call | Token consumption | Requires providing bot_id, user_id, and personal token. | -| LLM | Home Assistant | Home Assistant voice assistant API call | Free | Requires providing a Home Assistant token. | - -In fact, any LLM that supports OpenAI API calls can be integrated. - ---- - -### TTS - -| Type | Platform Name | Usage Method | Pricing Model | Remarks | -|:----:|:--------------------------------------:|:------------:|:-----------------:|:--------------------------------------------------------------------------------------:| -| TTS | EdgeTTS | API call | Free | Default TTS based on Microsoft's speech synthesis technology. | -| TTS | DoubaoTTS (火山引擎豆包 TTS) | API call | Token consumption | [Click to create an API key](https://console.volcengine.com/speech/service/8); it is recommended to use the paid version for higher concurrency. | -| TTS | CosyVoiceSiliconflow | API call | Token consumption | Requires application for the Siliconflow API key; output format is WAV. | -| TTS | CozeCnTTS | API call | Token consumption | Requires providing a Coze API key; output format is WAV. | -| TTS | FishSpeech | API call | Free/Custom | Starts a local TTS service; see the configuration file for startup instructions. | -| TTS | GPT_SOVITS_V2 | API call | Free/Custom | Starts a local TTS service, suitable for personalized speech synthesis scenarios. | - ---- - -### VAD - -| Type | Platform Name | Usage Method | Pricing Model | Remarks | -|:----:|:-------------------:|:------------:|:-------------:|:-------:| -| VAD | SileroVAD | Local | Free | | - ---- - -### ASR - -| Type | Platform Name | Usage Method | Pricing Model | Remarks | -|:----:|:-------------------:|:------------:|:-------------:|:-------:| -| ASR | FunASR | Local | Free | | -| ASR | SherpaASR | Local | Free | | -| ASR | DoubaoASR | API call | Paid | | - ---- - -## Usage 🚀 - -### 1. [Deployment Documentation](./docs/Deployment.md) - -This project supports three deployment methods. Choose the one that best fits your needs. - -The documentation provided here is a **written tutorial**. If you prefer a **video tutorial**, you can refer to [this expert's hands-on guide](https://www.bilibili.com/video/BV1gePuejEvT). - -Combining both the written and video tutorials can help you get started more quickly. - -1. [Docker Quick Deployment](./docs/Deployment.md) - Suitable for general users who want a quick experience without extensive environment configuration. The only downside is that pulling the image can be a bit slow. - -2. [Deployment Using Docker Environment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E5%80%9F%E5%8A%A9docker%E7%8E%AF%E5%A2%83%E8%BF%90%E8%A1%8C%E9%83%A8%E7%BD%B2) - Ideal for software engineers who already have Docker installed and wish to customize the code. - -3. [Running from Local Source Code](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%89%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C) - Suitable for users familiar with the `Conda` environment or those who wish to build the runtime environment from scratch. - -For scenarios requiring higher response speeds, running from the local source code is recommended to reduce additional overhead. - -### 2. [Firmware Compilation](./docs/firmware-build.md) - -Click [here](./docs/firmware-build.md) for a detailed guide on firmware compilation. - -After successful compilation and network connection, wake up XiaoZhi using the wake-up word and monitor the server console for output. - ---- - -## Frequently Asked Questions ❓ - -### 1. TTS often fails and times out ⏰ - -**Suggestion:** -If `EdgeTTS` frequently fails, please first check whether you are using a proxy (VPN). If so, try disabling the proxy and try again. If you are using Volcano Engine Doubao TTS and it often fails, it is recommended to use the paid version since the trial only supports 2 concurrent requests. - -### 2. I want to control lights, air conditioners, remote power on/off, etc. with XiaoZhi 💡 - -**Suggestion:** -Set the `LLM` to `HomeAssistant` in the configuration file and use the `HomeAssistant` API to perform the relevant controls. - -### 3. I speak slowly, and XiaoZhi always interrupts during pauses 🗣️ - -**Suggestion:** -Locate the following section in the configuration file and increase the value of `min_silence_duration_ms` (for example, change it to `1000`): - -```yaml -VAD: - SileroVAD: - threshold: 0.5 - model_dir: models/snakers4_silero-vad - min_silence_duration_ms: 700 # If your pauses are longer, increase this value -``` - -### 4. Why does XiaoZhi recognize a lot of Korean, Japanese, and English in what I say? 🇰🇷 - -**Suggestion:** -Check whether the `model.pt` file exists in the `models/SenseVoiceSmall` directory. If it does not, please download it. See [Download ASR Model Files](docs/Deployment.md#模型文件) for details. - -### 5. Why does the error “TTS task error: file does not exist” occur? 📁 - -**Suggestion:** -Verify that you have correctly installed the `libopus` and `ffmpeg` libraries using `conda`. If not, install them using: - -``` -conda install conda-forge::libopus -conda install conda-forge::ffmpeg -``` - -### 6. How can I improve XiaoZhi's dialogue response speed? ⚡ - -The default configuration of this project is designed to be cost-effective. It is recommended that beginners first use the default free models to ensure that the system runs smoothly, then optimize for faster response times. -To improve response speed, you can try replacing individual components. Below are the response time test results for each component (for reference only, not a guarantee): - -**LLM Performance Ranking:** - -| Module Name | Average First Token Time | Average Total Response Time | -|--------------|--------------------------|-----------------------------| -| AliLLM | 0.547s | 1.485s | -| ChatGLMLLM | 0.677s | 3.057s | -| OllamaLLM | 0.003s | 0.003s | - -**TTS Performance Ranking:** - -| Module Name | Average Synthesis Time | -|----------------------------|------------------------| -| EdgeTTS | 1.019s | -| DoubaoTTS | 0.503s | -| CosyVoiceSiliconflow | 3.732s | - -**Recommended Configuration Combination (Overall Response Speed):** - -| Combination Scheme | Overall Score | LLM First Token | TTS Synthesis | -|-----------------------------------|---------------|-----------------|---------------| -| AliLLM + DoubaoTTS | 0.539 | 0.547s | 0.503s | -| AliLLM + EdgeTTS | 0.642 | 0.547s | 1.019s | -| ChatGLMLLM + DoubaoTTS | 0.642 | 0.677s | 0.503s | -| ChatGLMLLM + EdgeTTS | 0.745 | 0.677s | 1.019s | -| AliLLM + CosyVoiceSiliconflow | 1.184 | 0.547s | 3.732s | - -**Conclusion 🔍** - -_As of February 19, 2025, if my computer were located in Haizhu District, Guangzhou, Guangdong Province, and connected via China Unicom, I would prioritize using:_ - -- **LLM:** `AliLLM` -- **TTS:** `DoubaoTTS` - -### 7. For more questions, feel free to contact us for feedback 💬 - -Our contact information is in [Baidu Netdisk](https://pan.baidu.com/s/1x6USjvP1nTRsZ45XlJu65Q),The extraction code is`223y`。 - ---- - -## Acknowledgements 🙏 - -- This project was inspired by the [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) and implemented based on it. -- Many thanks to [Tenclass](https://www.tenclass.com/) for providing detailed documentation support for the XiaoZhi communication protocol. - - - - - - Star History Chart - - \ No newline at end of file diff --git a/docs/Deployment.md b/docs/Deployment.md index 8765d26f6..01f0afeb1 100644 --- a/docs/Deployment.md +++ b/docs/Deployment.md @@ -1,6 +1,6 @@ -# 部署方案参考 -![图片](images/deploy.png) -# 方式一:docker快速部署 +# 部署架构图 +![请参考-最简化架构图](../docs/images/deploy1.png) +# 方式一:Docker只运行Server docker镜像已支持x86架构、arm64架构的CPU,支持在国产操作系统上运行。 @@ -40,7 +40,7 @@ chmod +x docker-setup.sh > > 执行完成后,请按照提示配置 API 密钥。 -当你一切顺利完成以上操作后,继续操作[配置项目文件](#3-配置项目文件) +当你一切顺利完成以上操作后,继续操作[配置项目文件](#2-配置项目文件) ### 1.2 手动部署 @@ -81,7 +81,7 @@ xiaozhi-server 下载完后,回到本教程继续往下。 -##### 1.2.3.2 下载 config.yaml +##### 1.2.3.2 创建 config.yaml 用浏览器打开[这个链接](../main/xiaozhi-server/config.yaml)。 @@ -102,14 +102,14 @@ xiaozhi-server 如果你的文件目录结构也是上面的,就继续往下。如果不是,你就再仔细看看是不是漏操作了什么。 -## 3. 配置项目文件 +## 2. 配置项目文件 接下里,程序还不能直接运行,你需要配置一下,你到底使用的是什么模型。你可以看这个教程: [跳转到配置项目文件](#配置项目) 配置完项目文件后,回到本教程继续往下。 -## 4. 执行docker命令 +## 3. 执行docker命令 打开命令行工具,使用`终端`或`命令行`工具 进入到你的`xiaozhi-server`,执行以下命令 @@ -137,50 +137,15 @@ docker logs -f xiaozhi-esp32-server ``` docker stop xiaozhi-esp32-server docker rm xiaozhi-esp32-server +docker stop xiaozhi-esp32-server-web +docker rm xiaozhi-esp32-server-web docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest +docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:web_latest ``` 5.3、重新按docker方式部署 -# 方式二:借助Docker环境运行部署 - -开发人员如果不想安装`conda`环境,可以使用这种方法管理好依赖。 - -## 1.克隆项目 - -## 2.[跳转到下载语音识别模型文件](#模型文件) - -## 3.[跳转到配置项目文件](#配置项目) - -## 4.运行docker - -修改完配置后,打开命令行工具,`cd`进入到你的`main/xiaozhi-server`下,执行以下命令 - -```sh -docker run -it --name xiaozhi-env --restart always --security-opt seccomp:unconfined \ - -p 8000:8000 \ - -p 8002:8002 \ - -v ./:/app \ - kalicyh/python:xiaozhi -``` - -然后就和正常开发一样了 - -## 5.安装依赖 - -在刚刚的打开的终端运行 - -```sh -pip install -r requirements.txt -``` - -## 6.运行项目 - -```sh -python app.py -``` - -# 方式三:本地源码运行 +# 方式二:本地源码只运行Server ## 1.安装基础环境 @@ -241,7 +206,7 @@ pip install -r requirements.txt ## 4.配置项目文件 -接下里,程序还不能直接运行,你需要配置一下,你到底使用的是什么模型。你可以看这个教程: +接下来,程序还不能直接运行,你需要配置一下,你到底使用的是什么模型。你可以看这个教程: [跳转到配置项目文件](#配置项目) ## 5.运行项目 @@ -259,43 +224,36 @@ python app.py ## 配置项目 如果你的`xiaozhi-server`目录没有`data`,你需要创建`data`目录。 -如果你的`data`下面没有`.config.yaml`文件,你可以把源码目录下的`config.yaml`文件复制一份,重命名为`.config.yaml` +如果你的`data`下面没有`.config.yaml`文件,有两个方式,任选一种: -修改`xiaozhi-server`下`data`目录下的`.config.yaml`文件,配置本项目必须的一个配置。 +第一个方式:你可以把`xiaozhi-server`目录下的`config.yaml`文件复制到`data`,并重命名为`.config.yaml`。在此文件上修改 + +第二个方式:你也可以创建在`data`目录下手动创建`.config.yaml`空文件,然后在这个文件中增加必要的配置信息,系统会优先读取`.config.yaml`文件的配置,如果`.config.yaml`没有配置的,系统会自动去加载`xiaozhi-server`目录下的`config.yaml`的配置。推荐使用这种方式,这种方式是最简洁的方式。 - 默认的LLM使用的是`ChatGLMLLM`,你需要配置密钥,因为他们的模型,虽然有免费的,但是仍要去[官网](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)注册密钥,才能启动。 -配置说明:这里是各个功能使用的默认组件,例如LLM默认使用`ChatGLMLLM`模型。如果需要切换模型,就是改对应的名称。 -本项目的默认配置仅是成本最低配置(`glm-4-flash`和`EdgeTTS`都是免费的),如果需要更优的更快的搭配,需要自己结合部署环境切换各组件的使用。 +以下是一个能正常跑起来的,最简单的`.config.yaml`配置示例 ``` +server: + websocket: ws://你的ip或者域名:端口号/xiaozhi/v1/ +prompt: | + 我是一个叫小智/小志的台湾女孩,说话机车,声音好听,习惯简短表达,爱用网络梗。 + 我的男朋友是一个程序员,梦想是开发出一个机器人,能够帮助人们解决生活中的各种问题。 + 我是一个喜欢哈哈大笑的女孩,爱东说西说吹牛,不合逻辑的也照吹,就要逗别人开心。 + 请你像一个人一样说话,请勿返回配置xml及其他特殊字符。 + selected_module: - VAD: SileroVAD - ASR: FunASR - LLM: ChatGLMLLM - TTS: EdgeTTS - # 默认不开启记忆,如需开启请看配置文件里的描述 - Memory: nomem - # 默认不开启意图识别,如需开启请看配置文件里的描述 - Intent: nointent -``` + LLM: DoubaoLLM -比如修改`LLM`使用的组件,就看本项目支持哪些`LLM` API接口,当前支持的是`openai`、`dify`。欢迎验证和支持更多LLM平台的接口。 -使用时,在`selected_module`修改成对应的如下LLM配置的名称: - -``` LLM: - DeepSeekLLM: - type: openai - ... ChatGLMLLM: - type: openai - ... - DifyLLM: - type: dify - ... + api_key: xxxxxxxxxxxxxxx.xxxxxx ``` +建议先将最简单的配置运行起来,然后再去`xiaozhi/config.yaml`阅读配置的使用说明。 +比如你要换更换模型,修改`selected_module`下的配置就行。 + ## 模型文件 本项目语音识别模型,默认使用`SenseVoiceSmall`模型,进行语音转文字。因为模型较大,需要独立下载,下载后把`model.pt` @@ -311,31 +269,40 @@ LLM: 如果你能看到,类似以下日志,则是本项目服务启动成功的标志。 ``` -25-02-23 12:01:09[core.websocket_server] - INFO - Server is running at ws://xxx.xx.xx.xx:8000 -25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问======= +250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-OTA接口是 http://192.168.4.123:8002/xiaozhi/ota/ +250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-Websocket地址是 ws://192.168.4.123:8000/xiaozhi/v1/ +250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问======= +250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-如想测试websocket请用谷歌浏览器打开test目录下的test_page.html +250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-======================================================= ``` 正常来说,如果您是通过源码运行本项目,日志会有你的接口地址信息。 但是如果你用docker部署,那么你的日志里给出的接口地址信息就不是真实的接口地址。 最正确的方法,是根据电脑的局域网IP来确定你的接口地址。 -如果你的电脑的局域网IP比如是`192.168.1.25`,那么你的接口地址就是:`ws://192.168.1.25:8000`。 +如果你的电脑的局域网IP比如是`192.168.1.25`,那么你的接口地址就是:`ws://192.168.1.25:8000/xiaozhi/v1/`,对应的OTA地址就是:`http://192.168.1.25:8002/xiaozhi/ota/`。 这个信息很有用的,后面`编译esp32固件`需要用到。 -接下来,你就可以开始 [编译esp32固件](firmware-build.md)了。 +接下来,你就可以开始操作你的esp32设备了,你可以`自行编译esp32固件`也可以配置使用`虾哥编译好的1.6.1以上版本的固件`。两个任选一个 + +1、 [编译自己的esp32固件](firmware-build.md)了。 + +2、 [基于虾哥编译好的固件配置自定义服务器](firmware-setting.md)了。 以下是一些常见问题,供参考: -[1、为什么我说的话,小智识别出来很多韩文、日文、英文](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) +[1、为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md) -[2、为什么会出现“TTS 任务出错 文件不存在”?](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) +[2、为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md) -[3、TTS 经常失败,经常超时](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) +[3、TTS 经常失败,经常超时](./FAQ.md) -[4、如何提高小智对话响应速度?](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) +[4、使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md) -[5、我说话很慢,停顿时小智老是抢话](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) +[5、如何提高小智对话响应速度?](./FAQ.md) -[6、我想通过小智控制电灯、空调、远程开关机等操作](../README.md#1%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%AF%B4%E7%9A%84%E8%AF%9D%E5%B0%8F%E6%99%BA%E8%AF%86%E5%88%AB%E5%87%BA%E6%9D%A5%E5%BE%88%E5%A4%9A%E9%9F%A9%E6%96%87%E6%97%A5%E6%96%87%E8%8B%B1%E6%96%87) \ No newline at end of file +[6、我说话很慢,停顿时小智老是抢话](./FAQ.md) + +[7、我想通过小智控制电灯、空调、远程开关机等操作](./FAQ.md) diff --git a/docs/Deployment_all.md b/docs/Deployment_all.md new file mode 100644 index 000000000..da984993e --- /dev/null +++ b/docs/Deployment_all.md @@ -0,0 +1,449 @@ +# 部署架构图 +![请参考-全模块安装架构图](../docs/images/deploy2.png) +# 方式一:Docker运行全模块 +docker镜像已支持x86架构、arm64架构的CPU,支持在国产操作系统上运行。 + +## 1. 安装docker + +如果您的电脑还没安装docker,可以按照这里的教程安装:[docker安装](https://www.runoob.com/docker/ubuntu-docker-install.html) + +#### 1.1 创建目录 + +安装完后,你需要为这个项目找一个安放配置文件的目录,例如我们可以新建一个文件夹叫`xiaozhi-server`。 + +创建好目录后,你需要在`xiaozhi-server`下面创建`data`文件夹和`models`文件夹,`models`下面还要再创建`SenseVoiceSmall`文件夹。 + +最终目录结构如下所示: + +``` +xiaozhi-server + ├─ data + ├─ models + ├─ SenseVoiceSmall +``` + +#### 1.2 下载语音识别模型文件 + +本项目语音识别模型,默认使用`SenseVoiceSmall`模型,进行语音转文字。因为模型较大,需要独立下载,下载后把`model.pt` +文件放在`models/SenseVoiceSmall` +目录下。下面两个下载路线任选一个。 + +- 线路一:阿里魔塔下载[SenseVoiceSmall](https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt) +- 线路二:百度网盘下载[SenseVoiceSmall](https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg&pwd=qvna) 提取码: + `qvna` + + +#### 1.3 下载配置文件 + +你需要下载两个配置文件:`docker-compose_all.yaml` 和 `config_from_api.yaml`。需要从项目仓库下载这两个文件。 + +##### 1.3.1 下载 docker-compose_all.yaml + +用浏览器打开[这个链接](../main/xiaozhi-server/docker-compose_all.yml)。 + +在页面的右侧找到名称为`RAW`按钮,在`RAW`按钮的旁边,找到下载的图标,点击下载按钮,下载`docker-compose_all.yml`文件。 把文件下载到你的 +`xiaozhi-server`中。 + +或者直接执行 `wget https://raw.githubusercontent.com/xinnan-tech/xiaozhi-esp32-server/refs/heads/main/main/xiaozhi-server/docker-compose_all.yml` 下载。 + +下载完后,回到本教程继续往下。 + +##### 1.3.2 下载 config_from_api.yaml + +用浏览器打开[这个链接](../main/xiaozhi-server/config_from_api.yaml)。 + +在页面的右侧找到名称为`RAW`按钮,在`RAW`按钮的旁边,找到下载的图标,点击下载按钮,下载`config_from_api.yaml`文件。 把文件下载到你的 +`xiaozhi-server`下面的`data`文件夹中,然后把`config_from_api.yaml`文件重命名为`.config.yaml`。 + +或者直接执行 `wget https://raw.githubusercontent.com/xinnan-tech/xiaozhi-esp32-server/refs/heads/main/main/xiaozhi-server/config_from_api.yaml` 下载保存。 + +下载完配置文件后,我们确认一下整个`xiaozhi-server`里面的文件如下所示: + +``` +xiaozhi-server + ├─ docker-compose_all.yml + ├─ data + ├─ .config.yaml + ├─ models + ├─ SenseVoiceSmall + ├─ model.pt +``` + +如果你的文件目录结构也是上面的,就继续往下。如果不是,你就再仔细看看是不是漏操作了什么。 + +## 2. 备份数据 + +如果你之前已经成功运行智控台,如果上面保存有你的密钥信息,请先从智控台上拷贝重要数据下来。因为升级过程中,有可能会覆盖原来的数据。 + +## 3. 清除历史版本镜像和容器 +接下来打开命令行工具,使用`终端`或`命令行`工具 进入到你的`xiaozhi-server`,执行以下命令 + +``` +docker compose -f docker-compose_all.yml down + +docker stop xiaozhi-esp32-server +docker rm xiaozhi-esp32-server + +docker stop xiaozhi-esp32-server-web +docker rm xiaozhi-esp32-server-web + +docker stop xiaozhi-esp32-server-db +docker rm xiaozhi-esp32-server-db + +docker stop xiaozhi-esp32-server-redis +docker rm xiaozhi-esp32-server-redis + +docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest +docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:web_latest +``` + +## 4. 运行程序 +执行以下命令启动新版本容器 + +``` +docker compose -f docker-compose_all.yml up -d +``` + +执行完后,再执行以下命令,查看日志信息。 + +``` +docker logs -f xiaozhi-esp32-server-web +``` + +当你看到输出日志时,说明你的`智控台`启动成功了。 + +``` +2025-xx-xx 22:11:12.445 [main] INFO c.a.d.s.b.a.DruidDataSourceAutoConfigure - Init DruidDataSource +2025-xx-xx 21:28:53.873 [main] INFO xiaozhi.AdminApplication - Started AdminApplication in 16.057 seconds (process running for 17.941) +http://localhost:8002/xiaozhi/doc.html +``` + +请注意此刻仅是`智控台`能运行,如果8000端口`xiaozhi-esp32-server`报错,先不要理会。 + +这时,你需要使用浏览器,打开`智控台`,链接:http://127.0.0.1:8002 ,注册第一个用户。第一个用户即是超级管理员,以后的用户都是普通用户。普通用户只能绑定设备和配置智能体;超级管理员可以进行模型管理、用户管理、参数配置等功能。 + +接下来要做三件重要的事情: + +### 第一件重要的事情 + +使用超级管理员账号,登录智控台,在顶部菜单找到`参数管理`,找到列表中第一条数据,参数编码是`server.secret`,复制它到`参数值`。 + +`server.secret`需要说明一下,这个`参数值`很重要,作用是让我们的`Server`端连接`manager-api`。`server.secret`是每次从零部署manager模块时,会自动随机生成的密钥。 + +复制`参数值`后,打开`xiaozhi-server`下的`data`目录的`.config.yaml`文件。此刻你的配置文件内容应该是这样的: + +``` +manager-api: + url: http://127.0.0.1:8002/xiaozhi + secret: 你的server.secret值 +``` +1、把你刚才从`智控台`复制过来的`server.secret`的`参数值`复制到`.config.yaml`文件里的`secret`里。 + +2、因为你是docker部署,把`url`改成下面的`http://xiaozhi-esp32-server-web:8002/xiaozhi` + +3、因为你是docker部署,把`url`改成下面的`http://xiaozhi-esp32-server-web:8002/xiaozhi` + +4、因为你是docker部署,把`url`改成下面的`http://xiaozhi-esp32-server-web:8002/xiaozhi` + +类似这样的效果 +``` +manager-api: + url: http://xiaozhi-esp32-server-web:8002/xiaozhi + secret: 12345678-xxxx-xxxx-xxxx-123456789000 +``` + +保存好后,继续往下做第二件重要的事情 + +### 第二件重要的事情 + +使用超级管理员账号,登录智控台,在顶部菜单找到`模型配置`,然后在左侧栏点击`大语言模型`,找到第一条数据`智谱AI`,点击`修改`按钮, +弹出修改框后,将你注册到的`智谱AI`的密钥填写到`API密钥`中。然后点击保存。 + +## 5.重启xiaozhi-esp32-server + +接下来打开命令行工具,使用`终端`或`命令行`工具 输入 +``` +docker restart xiaozhi-esp32-server +docker logs -f xiaozhi-esp32-server +``` +如果你能看到,类似以下日志,则是Server启动成功的标志。 + +``` +25-02-23 12:01:09[core.websocket_server] - INFO - Websocket地址是 ws://xxx.xx.xx.xx:8000/xiaozhi/v1/ +25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问======= +25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html +25-02-23 12:01:09[core.websocket_server] - INFO - ======================================================= +``` + +由于你是全模块部署,因此你有两个重要的接口需要写入到esp32中。 + +OTA接口: +``` +http://你电脑局域网的ip:8002/xiaozhi/ota/ +``` + +Websocket接口: +``` +ws://你电脑局域网的ip:8000/xiaozhi/v1/ +``` + +### 第三件重要的事情 + +使用超级管理员账号,登录智控台,在顶部菜单找到`参数管理`,找到参数编码是`server.websocket`,输入你的`Websocket接口`。 + +使用超级管理员账号,登录智控台,在顶部菜单找到`参数管理`,找到数编码是`server.ota`,输入你的`OTA接口`。 + +接下来,你就可以开始操作你的esp32设备了,你可以`自行编译esp32固件`也可以配置使用`虾哥编译好的1.6.1以上版本的固件`。两个任选一个 + +1、 [编译自己的esp32固件](firmware-build.md)了。 + +2、 [基于虾哥编译好的固件配置自定义服务器](firmware-setting.md)了。 + + +# 方式二:本地源码运行全模块 + +## 1.安装MySQL数据库 + +如果本机已经安装了MySQL,可以直接在数据库中创建名为`xiaozhi_esp32_server`的数据库。 + +```sql +CREATE DATABASE xiaozhi_esp32_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +``` + +如果还没有MySQL,你可以通过docker安装mysql + +``` +docker run --name xiaozhi-esp32-server-db -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -e MYSQL_DATABASE=xiaozhi_esp32_server -e MYSQL_INITDB_ARGS="--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci" -e TZ=Asia/Shanghai -d mysql:latest +``` + +## 2.安装redis + +如果还没有Redis,你可以通过docker安装redis + +``` +docker run --name xiaozhi-esp32-server-redis -d -p 6379:6379 redis +``` + +## 3.运行manager-api程序 + +3.1 安装JDK21,设置JDK环境变量 + +3.2 安装Maven,设置Maven环境变量 + +3.3 使用Vscode编程工具,安装好Java环境相关插件 + +3.4 使用Vscode编程工具加载manager-api模块 + +在`src/main/resources/application-dev.yml`中配置数据库连接信息 + +``` +spring: + datasource: + username: root + password: 123456 +``` +在`src/main/resources/application-dev.yml`中配置Redis连接信息 +``` +spring: + data: + redis: + host: localhost + port: 6379 + password: + database: 0 +``` + +3.5 运行主程序 + +本项目为SpringBoot项目,启动方式为: +打开`Application.java`运行`Main`方法启动 + +``` +路径地址: +src/main/java/xiaozhi/AdminApplication.java +``` + +当你看到输出日志时,说明你的`manager-api`启动成功了。 + +``` +2025-xx-xx 22:11:12.445 [main] INFO c.a.d.s.b.a.DruidDataSourceAutoConfigure - Init DruidDataSource +2025-xx-xx 21:28:53.873 [main] INFO xiaozhi.AdminApplication - Started AdminApplication in 16.057 seconds (process running for 17.941) +http://localhost:8002/xiaozhi/doc.html +``` + +## 4.运行manager-web程序 + +4.1 安装nodejs + +4.2 使用Vscode编程工具加载manager-web模块 + +终端命令进入manager-web目录下 + +``` +npm install +``` +然后启动 +``` +npm run serve +``` + +请注意,如果你的manager-api的接口不在`http://localhost:8002`,请在开发时,修改 +`main/manager-web/.env.development`中的路径 + +运行成功后,你需要使用浏览器,打开`智控台`,链接:http://127.0.0.1:8001 ,注册第一个用户。第一个用户即是超级管理员,以后的用户都是普通用户。普通用户只能绑定设备和配置智能体;超级管理员可以进行模型管理、用户管理、参数配置等功能。 + + +重要:注册成功后,使用超级管理员账号,登录智控台,在顶部菜单找到`模型配置`,然后在左侧栏点击`大语言模型`,找到第一条数据`智谱AI`,点击`修改`按钮, +弹出修改框后,将你注册到的`智谱AI`的密钥填写到`API密钥`中。然后点击保存。 + +重要:注册成功后,使用超级管理员账号,登录智控台,在顶部菜单找到`模型配置`,然后在左侧栏点击`大语言模型`,找到第一条数据`智谱AI`,点击`修改`按钮, +弹出修改框后,将你注册到的`智谱AI`的密钥填写到`API密钥`中。然后点击保存。 + +重要:注册成功后,使用超级管理员账号,登录智控台,在顶部菜单找到`模型配置`,然后在左侧栏点击`大语言模型`,找到第一条数据`智谱AI`,点击`修改`按钮, +弹出修改框后,将你注册到的`智谱AI`的密钥填写到`API密钥`中。然后点击保存。 + +## 5.安装Python环境 + +本项目使用`conda`管理依赖环境。如果不方便安装`conda`,需要根据实际的操作系统安装好`libopus`和`ffmpeg`。 +如果确定使用`conda`,则安装好后,开始执行以下命令。 + +重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词, +找到`Anaconda Prpmpt`,使用管理员身份运行它。如下图。 + +![conda_prompt](./images/conda_env_1.png) + +运行之后,如果你能看到命令行窗口前面有一个(base)字样,说明你成功进入了`conda`环境。那么你就可以执行以下命令了。 + +![conda_env](./images/conda_env_2.png) + +``` +conda remove -n xiaozhi-esp32-server --all -y +conda create -n xiaozhi-esp32-server python=3.10 -y +conda activate xiaozhi-esp32-server + +# 添加清华源通道 +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge + +conda install libopus -y +conda install ffmpeg -y +``` + +请注意,以上命令,不是一股脑执行就成功的,你需要一步步执行,每一步执行完后,都检查一下输出的日志,查看是否成功。 + +## 6.安装本项目依赖 + +你先要下载本项目源码,源码可以通过`git clone`命令下载,如果你不熟悉`git clone`命令。 + +你可以用浏览器打开这个地址`https://github.com/xinnan-tech/xiaozhi-esp32-server.git` + +打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。 + +点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`xiaozhi-esp32-server-main` +你需要把它重命名成`xiaozhi-esp32-server`,在这个文件里,进入到`main`文件夹,再进入到`xiaozhi-server`,好了请记住这个目录`xiaozhi-server`。 + +``` +# 继续使用conda环境 +conda activate xiaozhi-esp32-server +# 进入到你的项目根目录,再进入main/xiaozhi-server +cd main/xiaozhi-server +pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ +pip install -r requirements.txt +``` + +### 7.下载语音识别模型文件 + +本项目语音识别模型,默认使用`SenseVoiceSmall`模型,进行语音转文字。因为模型较大,需要独立下载,下载后把`model.pt` +文件放在`models/SenseVoiceSmall` +目录下。下面两个下载路线任选一个。 + +- 线路一:阿里魔塔下载[SenseVoiceSmall](https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt) +- 线路二:百度网盘下载[SenseVoiceSmall](https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg&pwd=qvna) 提取码: + `qvna` + +## 8.配置项目文件 + +使用超级管理员账号,登录智控台 ,在顶部菜单找到`参数管理`,找到列表中第一条数据,参数编码是`server.secret`,复制它到`参数值`。 + +`server.secret`需要说明一下,这个`参数值`很重要,作用是让我们的`Server`端连接`manager-api`。`server.secret`是每次从零部署manager模块时,会自动随机生成的密钥。 + +如果你的`xiaozhi-server`目录没有`data`,你需要创建`data`目录。 +如果你的`data`下面没有`.config.yaml`文件,你可以把`xiaozhi-server`目录下的`config_from_api.yaml`文件复制到`data`,并重命名为`.config.yaml` + +复制`参数值`后,打开`xiaozhi-server`下的`data`目录的`.config.yaml`文件。此刻你的配置文件内容应该是这样的: + +``` +manager-api: + url: http://127.0.0.1:8002/xiaozhi + secret: 你的server.secret值 +``` + +把你刚才从`智控台`复制过来的`server.secret`的`参数值`复制到`.config.yaml`文件里的`secret`里。 + +类似这样的效果 +``` +manager-api: + url: http://127.0.0.1:8002/xiaozhi + secret: 12345678-xxxx-xxxx-xxxx-123456789000 +``` + +## 5.运行项目 + +``` +# 确保在xiaozhi-server目录下执行 +conda activate xiaozhi-esp32-server +python app.py +``` + +如果你能看到,类似以下日志,则是本项目服务启动成功的标志。 + +``` +25-02-23 12:01:09[core.websocket_server] - INFO - Server is running at ws://xxx.xx.xx.xx:8000/xiaozhi/v1/ +25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问======= +25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html +25-02-23 12:01:09[core.websocket_server] - INFO - ======================================================= +``` + +由于你是全模块部署,因此你有两个重要的接口。 + +OTA接口: +``` +http://你电脑局域网的ip:8002/xiaozhi/ota/ +``` + +Websocket接口: +``` +ws://你电脑局域网的ip:8000/xiaozhi/v1/ +``` + +请你务必把以上两个接口地址写入到智控台中:他们将会影响websocket地址发放和自动升级功能。 + +1、使用超级管理员账号,登录智控台,在顶部菜单找到`参数管理`,找到参数编码是`server.websocket`,输入你的`Websocket接口`。 + +2、使用超级管理员账号,登录智控台,在顶部菜单找到`参数管理`,找到数编码是`server.ota`,输入你的`OTA接口`。 + + +接下来,你就可以开始操作你的esp32设备了,你可以`自行编译esp32固件`也可以配置使用`虾哥编译好的1.6.1以上版本的固件`。两个任选一个 + +1、 [编译自己的esp32固件](firmware-build.md)了。 + +2、 [基于虾哥编译好的固件配置自定义服务器](firmware-setting.md)了。 + +# 常见问题 + +以下是一些常见问题,供参考: + +[1、为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md) + +[2、为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md) + +[3、TTS 经常失败,经常超时](./FAQ.md) + +[4、使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md) + +[5、如何提高小智对话响应速度?](./FAQ.md) + +[6、我说话很慢,停顿时小智老是抢话](./FAQ.md) + +[7、我想通过小智控制电灯、空调、远程开关机等操作](./FAQ.md) diff --git a/docs/FAQ.md b/docs/FAQ.md new file mode 100644 index 000000000..cfcbe373b --- /dev/null +++ b/docs/FAQ.md @@ -0,0 +1,111 @@ +# 常见问题 ❓ + +### 1、为什么我说的话,小智识别出来很多韩文、日文、英文?🇰🇷 + +建议:检查一下`models/SenseVoiceSmall`是否已经有`model.pt` +文件,如果没有就要下载,查看这里[下载语音识别模型文件](Deployment.md#模型文件) + +### 2、为什么会出现"TTS 任务出错 文件不存在"?📁 + +建议:检查一下是否正确使用`conda` 安装了`libopus`和`ffmpeg`库。 + +如果没有安装,就安装 + +``` +conda install conda-forge::libopus +conda install conda-forge::ffmpeg +``` + +### 3、TTS 经常失败,经常超时 ⏰ + +建议:如果 `EdgeTTS` 经常失败,请先检查是否使用了代理(梯子)。如果使用了,请尝试关闭代理后再试; +如果用的是火山引擎的豆包 TTS,经常失败时建议使用付费版本,因为测试版本仅支持 2 个并发。 + +### 4、使用Wifi能连接自建服务器,但是4G模式却接不上 🔐 + +原因:虾哥的固件,4G模式需要使用安全连接。 + +解决方法:目前有两种方法可以解决。任选一种: + +1、改代码。参考这个视频解决 https://www.bilibili.com/video/BV18MfTYoE85 + +2、使用nginx配置ssl证书。参考教程 https://icnt94i5ctj4.feishu.cn/docx/GnYOdMNJOoRCljx1ctecsj9cnRe + +### 5、如何提高小智对话响应速度? ⚡ + +本项目默认配置为低成本方案,建议初学者先使用默认免费模型,解决"跑得动"的问题,再优化"跑得快"。 +如需提升响应速度,可尝试更换各组件。以下为各组件的响应速度测试数据(仅供参考,不构成承诺): + +| 影响因素 | 因素值 | +|:-----:|:----------------:| +| 测试地点 | 广东省广州市海珠区 | +| 测试时间 | 2025年2月19日 12:52 | +| 宽带运营商 | 中国联通 | + +测试方法: + +1、把各组件的密钥配置上去,只有配置了密钥的组件才参与测试。 + +2、配置完密钥后,执行以下方法 + +``` +# 进入项目根目录,执行以下命令: +conda activate xiaozhi-esp32-server +python performance_tester.py +``` + +生成报告如下 + +LLM 性能排行: + +| 模块名称 | 平均首Token时间 | 平均总响应时间 | +|:-----------|:-----------|:--------| +| AliLLM | 0.547s | 1.485s | +| ChatGLMLLM | 0.677s | 3.057s | + +TTS 性能排行: + +| 模块名称 | 平均合成时间 | +|----------------------|--------| +| EdgeTTS | 1.019s | +| DoubaoTTS | 0.503s | +| CosyVoiceSiliconflow | 3.732s | + +推荐配置组合 (综合响应速度): + +| 组合方案 | 综合得分 | LLM首Token | TTS合成 | +|-------------------------------|-------|-----------|--------| +| AliLLM + DoubaoTTS | 0.539 | 0.547s | 0.503s | +| AliLLM + EdgeTTS | 0.642 | 0.547s | 1.019s | +| ChatGLMLLM + DoubaoTTS | 0.642 | 0.677s | 0.503s | +| ChatGLMLLM + EdgeTTS | 0.745 | 0.677s | 1.019s | +| AliLLM + CosyVoiceSiliconflow | 1.184 | 0.547s | 3.732s | + +### 结论 🔍 + +`2025年2月19日`,如果我的电脑在`广东省广州市海珠区`,且使用的是`中国联通`网络,我会优先使用: + +- LLM:`AliLLM` +- TTS:`DoubaoTTS` + +### 6、我说话很慢,停顿时小智老是抢话 🗣️ + +建议:在配置文件中找到如下部分,将 `min_silence_duration_ms` 的值调大(例如改为 `1000`): + +```yaml +VAD: + SileroVAD: + threshold: 0.5 + model_dir: models/snakers4_silero-vad + min_silence_duration_ms: 700 # 如果说话停顿较长,可将此值调大 +``` + +### 7、我想通过小智控制电灯、空调、远程开关机等操作 💡 + +参考教程[ESP32设备与HomeAssistant集成指南](./homeassistant-integration.md) + +### 8、更多问题,可联系我们反馈 💬 + +可以在[issues](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues)提交您的问题。 + +也可以发邮件我们取得联系:huangrongzhuang@xin-nan.com \ No newline at end of file diff --git a/docs/docker/nginx.conf b/docs/docker/nginx.conf index 820fda23c..9b9c3889e 100644 --- a/docs/docker/nginx.conf +++ b/docs/docker/nginx.conf @@ -1,26 +1,53 @@ -server { - listen 8002; - server_name localhost; +user root; +worker_processes 4; - # 静态资源服务(Vue项目) - location / { - root /usr/share/nginx/html; - try_files $uri $uri/ /index.html; - } +events { + worker_connections 1024; +} - # API反向代理(Java项目) - location /xiaozhi-esp32-api/ { - proxy_pass http://127.0.0.1:8003; - proxy_set_header Host $host; - proxy_cookie_path /api/ /; - proxy_set_header Referer $http_referer; - proxy_set_header Cookie $http_cookie; +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 300; + client_header_timeout 180s; + client_body_timeout 180s; + client_max_body_size 1024M; - proxy_connect_timeout 10; - proxy_send_timeout 10; - proxy_read_timeout 10; + gzip on; + gzip_buffers 32 4K; + gzip_comp_level 6; + gzip_min_length 100; + gzip_types application/javascript text/css text/xml image/jpeg image/gif image/png; + gzip_disable "MSIE [1-6]\."; + gzip_vary on; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + server { + # 无域名访问,就用localhost + server_name localhost; + # 80端口 + listen 8002; + + # 转发到编译后到web目录 + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } + + # 转发到manager-api + location /xiaozhi/ { + proxy_pass http://127.0.0.1:8003; + proxy_set_header Host $host; + proxy_cookie_path /manager/ /; + proxy_set_header Referer $http_referer; + proxy_set_header Cookie $http_cookie; + + proxy_connect_timeout 10; + proxy_send_timeout 10; + proxy_read_timeout 10; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } } } \ No newline at end of file diff --git a/docs/firmware-build.md b/docs/firmware-build.md index b726826c9..fffac288c 100644 --- a/docs/firmware-build.md +++ b/docs/firmware-build.md @@ -1,40 +1,81 @@ -# 编译esp32固件 +# esp32固件编译 -1. 下载`xiaozhi-esp32` - 项目,按照这个教程配置项目环境[《Windows搭建 ESP IDF 5.3.2开发环境以及编译小智》](https://icnynnzcwou8.feishu.cn/wiki/JEYDwTTALi5s2zkGlFGcDiRknXf) +## 第1步 准备你的ota地址 -2. 打开`xiaozhi-esp32/main/Kconfig.projbuild`文件,找到`WEBSOCKET_URL`的`default`的内容,把`wss://api.tenclass.net` - 改成你自己的地址,例如,我的接口地址是`ws://192.168.1.25:8000`,就把内容改成这个。 +如果你,使用的是本项目0.3.12版本,不管是简单Server部署还是全模块部署,都会有ota地址。 + +由于简单Server部署和全模块部署的OTA地址设置方式不一样,请你选择下面的具体方式: + +### 如果你用的是简单Server部署 +此刻,请你用浏览器打开你的ota地址,例如我的ota地址 +``` +http://192.168.1.25:8002/xiaozhi/ota/ +``` +如果显示“OTA接口运行正常,向设备发送的websocket地址是:ws://xxx:8000/xiaozhi/v1/ + +你可以使用项目自带的`test_page.html`测试一下,是否能连上ota页面输出的websocket地址。 + +如果访问不到,你需要到配置文件`.config.yaml`里修改`server.websocket`的地址,重启后再重新测试,直到`test_page.html`能正常访问。 + +成功后,请往下进行第2步 + +### 如果你用的是全模块部署 +此刻,请你用浏览器打开你的ota地址,例如我的ota地址 +``` +http://192.168.1.25:8002/xiaozhi/ota/ +``` + +如果显示“OTA接口运行正常,websocket集群数量:X”。那就往下进行2步。 + +如果显示“OTA接口运行不正常”,大概是你还没在`智控台`配置`Websocket`地址。那就: + +- 1、使用超级管理员登录智控台 + +- 2、顶部菜单点击`参数管理` + +- 3、在列表中找到`server.websocket`项目,输入你的`Websocket`地址。例如我的就是 + +``` +ws://192.168.1.25:8000/xiaozhi/v1/ +``` + +配置完后,再使用浏览器刷新你的ota接口地址,看看是不是正常了。如果还不正常就,就再次确认一下Websocket是否正常启动,是否配置了Websocket地址。 + +## 第2步 配置环境 +先按照这个教程配置项目环境[《Windows搭建 ESP IDF 5.3.2开发环境以及编译小智》](https://icnynnzcwou8.feishu.cn/wiki/JEYDwTTALi5s2zkGlFGcDiRknXf) + +## 第3步 打开配置文件 +配置好编译环境后,下载虾哥iaozhi-esp32项目源码, + +从这里下载虾哥[xiaozhi-esp32项目源码](https://github.com/78/xiaozhi-esp32)。 + +下载后,打开`xiaozhi-esp32/main/Kconfig.projbuild`文件。 + +## 第4步 修改OTA地址 + +找到`OTA_URL`的`default`的内容,把`https://api.tenclass.net/xiaozhi/ota/` + 改成你自己的地址,例如,我的接口地址是`http://192.168.1.25:8002/xiaozhi/ota/`,就把内容改成这个。 修改前: - ``` -config WEBSOCKET_URL - depends on CONNECTION_TYPE_WEBSOCKET - string "Websocket URL" - default "wss://api.tenclass.net/xiaozhi/v1/" +config OTA_URL + string "Default OTA URL" + default "https://api.tenclass.net/xiaozhi/ota/" help - Communication with the server through websocket after wake up. + The application will access this URL to check for new firmwares and server address. ``` - -修改后(示例): - +修改后: ``` -config WEBSOCKET_URL - depends on CONNECTION_TYPE_WEBSOCKET - string "Websocket URL" - default "ws://192.168.1.25:8000/xiaozhi/v1/" +config OTA_URL + string "Default OTA URL" + default "http://192.168.1.25:8002/xiaozhi/ota/" help - Communication with the server through websocket after wake up. + The application will access this URL to check for new firmwares and server address. ``` -注意:你的地址是`ws://`开头,不是`wss://`开头,一定不要写错了。 +## 第4步 设置编译参数 -注意:你的地址是`ws://`开头,不是`wss://`开头,一定不要写错了。 - -注意:你的地址是`ws://`开头,不是`wss://`开头,一定不要写错了。 - -3. 设置编译参数 +设置编译参数 ``` # 终端命令行进入xiaozhi-esp32的根目录 @@ -45,40 +86,29 @@ idf.py set-target esp32s3 idf.py menuconfig ``` -![图片](images/build_setting01.png) - -进入菜单配置后,再进入`Xiaozhi Assistant`,将`CONNECTION_TYPE`设置为`Websocket` -回退到主菜单,再进入`Xiaozhi Assistant`,将`BOARD_TYPE`设置你板子的具体型号 +进入菜单配置后,再进入`Xiaozhi Assistant`,将`BOARD_TYPE`设置你板子的具体型号 保存退出,回到终端命令行。 -![图片](images/build_setting02.png) - -4. 编译固件 +## 第5步 编译固件 ``` idf.py build ``` -如果是vscode安装的idf可以使用`F1`或者`ctrl+shift+p`,输入idf然后直接选择进行编译 - -还可以直接进行烧录不用接下来的操作 - - - -5. 打包bin固件 +## 第6步 打包bin固件 ``` cd scripts python release.py ``` -编译成功后,会在项目根目录下的`build`目录下生成固件文件`merged-binary.bin`。 +上面的打包命令执行完成后,会在项目根目录下的`build`目录下生成固件文件`merged-binary.bin`。 这个`merged-binary.bin`就是要烧录到硬件上的固件文件。 注意:如果执行到第二命令后,报了“zip”相关的错误,请忽略这个错误,只要`build`目录下生成固件文件`merged-binary.bin` ,对你没有太大影响,请继续。 -6. 烧录固件 +## 第7步 烧录固件 将esp32设备连接电脑,使用chrome浏览器,打开以下网址 ``` @@ -90,16 +120,19 @@ https://espressif.github.io/esp-launchpad/ 烧录成功且联网成功后,通过唤醒词唤醒小智,留意server端输出的控制台信息。 +## 常见问题 以下是一些常见问题,供参考: -[1、为什么我说的话,小智识别出来很多韩文、日文、英文](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[1、为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md) -[2、为什么会出现“TTS 任务出错 文件不存在”?](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[2、为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md) -[3、TTS 经常失败,经常超时](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[3、TTS 经常失败,经常超时](./FAQ.md) -[4、如何提高小智对话响应速度?](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[4、使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md) -[5、我说话很慢,停顿时小智老是抢话](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[5、如何提高小智对话响应速度?](./FAQ.md) -[6、我想通过小智控制电灯、空调、远程开关机等操作](../README.md#1tts-%E7%BB%8F%E5%B8%B8%E5%A4%B1%E8%B4%A5%E7%BB%8F%E5%B8%B8%E8%B6%85%E6%97%B6-) +[6、我说话很慢,停顿时小智老是抢话](./FAQ.md) + +[7、我想通过小智控制电灯、空调、远程开关机等操作](./FAQ.md) diff --git a/docs/firmware-setting.md b/docs/firmware-setting.md new file mode 100644 index 000000000..ae66b6e93 --- /dev/null +++ b/docs/firmware-setting.md @@ -0,0 +1,53 @@ +# 基于虾哥编译好的固件配置自定义服务器 + +## 第1步 确认版本 +烧录虾哥已经编译好的1.6.1版本固件 + +## 第2步 准备你的ota地址 +如果你按照教程使用的是全模块部署,就应该会有ota地址。 + +此刻,请你用浏览器打开你的ota地址,例如我的ota地址 +``` +https://2662r3426b.vicp.fun/xiaozhi/ota/ +``` + +如果显示“OTA接口运行正常,websocket集群数量:X”。那就往下。 + +如果显示“OTA接口运行不正常”,大概是你还没在`智控台`配置`Websocket`地址。那就: + +- 1、使用超级管理员登录智控台 + +- 2、顶部菜单点击`参数管理` + +- 3、在列表中找到`server.websocket`项目,输入你的`Websocket`地址。例如我的就是 + +``` +wss://2662r3426b.vicp.fun/xiaozhi/v1/ +``` + +配置完后,再使用浏览器刷新你的ota接口地址,看看是不是正常了。如果还不正常就,就再次确认一下Websocket是否正常启动,是否配置了Websocket地址。 + +## 第3步 进入配网模式 +进入机器的配网模式,在页面顶部,点击“高级选项”,在里面输入你服务器的`ota`地址,点击保存。重启设备 + +## 第4步 唤醒小智,查看日志输出 + +唤醒小智,看看日志是不是正常输出。 + + +## 常见问题 +以下是一些常见问题,供参考: + +[1、为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md) + +[2、为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md) + +[3、TTS 经常失败,经常超时](./FAQ.md) + +[4、使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md) + +[5、如何提高小智对话响应速度?](./FAQ.md) + +[6、我说话很慢,停顿时小智老是抢话](./FAQ.md) + +[7、我想通过小智控制电灯、空调、远程开关机等操作](./FAQ.md) diff --git a/docs/homeassistant-integration.md b/docs/homeassistant-integration.md new file mode 100644 index 000000000..d2dc4f9d8 --- /dev/null +++ b/docs/homeassistant-integration.md @@ -0,0 +1,111 @@ +# ESP32设备与HomeAssistant集成指南 + +## 简介 + +本文档将指导您如何将ESP32设备与HomeAssistant进行集成。 + +## 前提条件 + +- 已安装并配置好`HomeAssistant` +- 已经在HomeAssistant中集成`Xiaomi Home`,并将米家的设备导入进`HomeAssistant` +- `xiaozhi-esp32-server智控台`能正常使用 +- 本次我选择的模型是:免费的ChatGLM,它支持functioncall函数调用 + +## 网络环境 + +1、我的`HomeAssistant`部署在下面,版本是`2025.3.4` +``` +http://192.168.4.7:8123 +``` + +2、我的`xiaozhi-esp32-server智控台`和`HomeAssistant`部署在同一台机器的另一个端口,版本是`0.3.10` +``` +http://192.168.4.7:8002 +``` + + +## 配置步骤 + +### 1. 登录`HomeAssistant`整理需要控制的设备清单 + +登录`HomeAssistant`,点击`左下角的设置`,然后进入`设备与服务`,再点击顶部的`实体`。 + +然后在实体中搜索你相关控制的开关,结果出来后,在列表中,点击其中一个结果,这是会出现一个开关的界面。 + +在开关的界面,我们尝试点击开关,看看是开发会随着我们的点击开/关。如果能操作,说明是正常联网的。 + +接着在开关面板找到设置按钮,点击后,可以查看这个开关的`实体标识符`。 + +我们打开一个记事本,按照这样格式整理一条数据: + +位置+英文逗号+设备名称+英文逗号+`实体标识符`+英文分号 + +例如,我在公司,我有一个玩具灯,他的标识符是switch.cuco_cn_460494544_cp1_on_p_2_1,那么就这个写这一条数据 + +``` +公司,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1; +``` + +当然最后我可能要操作两个灯,我的最终的结果是: + +``` +公司,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1; +公司,台灯,switch.iot_cn_831898993_socn1_on_p_2_1; +``` + +这段字符,我们成为“设备清单字符”需要保存好,等一下有用。 + + +### 2. 登录`HomeAssistant`拿到开发密钥 + +登录`HomeAssistant`,点击`左下角个人`,切换`安全`导航栏,划到底部`长期访问令牌`生成api_key。 + + +### 3. 登录`智控台` + +使用管理员账号,登录`智控台`。点击顶部菜单`参数管理`,搜索`plugins.home_assistant.`,会有三条结果出来 + +编辑`plugins.home_assistant.devices`,把刚才整理的设备清单字符粘贴进去。 + + +编辑`plugins.home_assistant.base_url`,把你部署的`HomeAssistant`接口地址粘贴进去,我粘贴进去的地址是这样的 + +``` +http://192.168.4.7:8123 +``` + +编辑`plugins.home_assistant.api_key`,把你从`HomeAssistant`复制过来的密钥,粘贴进去 + + +### 4. 设置`意图识别`函数 + +在智控台,点击顶部菜单“模型配置”,在左侧栏,找到“意图识别”,找到id为`Intent_function_call`的意图,点击编辑 + +然后在弹框中,在原来的基础上追加两个函数:“hass_get_state”和“hass_set_state” + +修改前 +``` +change_role;get_weather;get_news;play_music +``` + +修改后 + +``` +change_role;get_weather;get_news;play_music;hass_get_state;hass_set_state +``` + +### 6. 手动重启xiaozhi-server + +重启xiaozhi-server程序 + + +### 5. 确认角色配置是否设置了函数意图识别 + +在智控台,点击顶部菜单“智能体管理”,找到设备所在的智能体,点击“配置角色” + +确认意图识别(Intent),是否选择“函数调用意图识别” + + +### 6. 唤醒设别进行控制 + +尝试和esp32说,“打开XXX灯” \ No newline at end of file diff --git a/docs/images/banner1.png b/docs/images/banner1.png new file mode 100644 index 000000000..974ddaf35 Binary files /dev/null and b/docs/images/banner1.png differ diff --git a/docs/images/banner2.png b/docs/images/banner2.png new file mode 100644 index 000000000..4d54073e1 Binary files /dev/null and b/docs/images/banner2.png differ diff --git a/docs/images/build_setting01.png b/docs/images/build_setting01.png deleted file mode 100644 index 24e2aeecb..000000000 Binary files a/docs/images/build_setting01.png and /dev/null differ diff --git a/docs/images/build_setting02.png b/docs/images/build_setting02.png deleted file mode 100644 index 791a5b05a..000000000 Binary files a/docs/images/build_setting02.png and /dev/null differ diff --git a/docs/images/deploy.png b/docs/images/deploy.png deleted file mode 100644 index e1db8a48b..000000000 Binary files a/docs/images/deploy.png and /dev/null differ diff --git a/docs/images/deploy1.png b/docs/images/deploy1.png new file mode 100644 index 000000000..70488bcfc Binary files /dev/null and b/docs/images/deploy1.png differ diff --git a/docs/images/deploy2.png b/docs/images/deploy2.png new file mode 100644 index 000000000..61c36997a Binary files /dev/null and b/docs/images/deploy2.png differ diff --git a/docs/images/logo_bailing.png b/docs/images/logo_bailing.png new file mode 100644 index 000000000..22ab6e11f Binary files /dev/null and b/docs/images/logo_bailing.png differ diff --git a/docs/images/logo_huiyuan.png b/docs/images/logo_huiyuan.png new file mode 100644 index 000000000..6e441913c Binary files /dev/null and b/docs/images/logo_huiyuan.png differ diff --git a/docs/images/logo_qinren.png b/docs/images/logo_qinren.png new file mode 100644 index 000000000..a01af8416 Binary files /dev/null and b/docs/images/logo_qinren.png differ diff --git a/docs/images/logo_tenclass.png b/docs/images/logo_tenclass.png new file mode 100644 index 000000000..86a6dc4af Binary files /dev/null and b/docs/images/logo_tenclass.png differ diff --git a/docs/images/logo_xuanfeng.png b/docs/images/logo_xuanfeng.png new file mode 100644 index 000000000..552ee78a2 Binary files /dev/null and b/docs/images/logo_xuanfeng.png differ diff --git a/docs/images/vscode_idf.png b/docs/images/vscode_idf.png deleted file mode 100644 index f943b71e4..000000000 Binary files a/docs/images/vscode_idf.png and /dev/null differ diff --git a/docs/images/webui.png b/docs/images/webui.png deleted file mode 100644 index 4d4ae599c..000000000 Binary files a/docs/images/webui.png and /dev/null differ diff --git a/main/README.md b/main/README.md index df4e57a42..a91c9fdca 100644 --- a/main/README.md +++ b/main/README.md @@ -1,8 +1,6 @@ -本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../README.md#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F-) +本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3) # 项目目录介绍 -当你看到这份文件的时候,这个这个项目还没完善好。我们还有很多东西要做。 - 如果你是一名软件开发者,这里有一份[《致开发者的公开信》](../docs/contributor_open_letter.md),欢迎归队! ``` @@ -12,12 +10,10 @@ xiaozhi-esp32-server ├─ manager-api 8002 端口 Java语言开发 负责提供控制台的api ``` -# xiaozhi-server 接口协议 +# xiaozhi-server 和ESP32通讯协议 -[虾哥团队通信协议:Websocket 连接](https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh) +https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh # manager-web 、manager-api接口协议 -[manager前后端接口协议](https://app.apifox.com/invite/project?token=eXg2_tUv85q-gc3ZRowmn) - -[前端页面设计图](https://codesign.qq.com/app/s/526108506410828) +https://2662r3426b.vicp.fun/xiaozhi/v1/doc.html diff --git a/main/manager-api/README.md b/main/manager-api/README.md index 0435956e5..484c28dc0 100644 --- a/main/manager-api/README.md +++ b/main/manager-api/README.md @@ -1,72 +1,18 @@ -本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../../README.md#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F-) +本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3) + # 项目介绍 manager-api 该项目基于SpringBoot框架开发。 开发使用代码编辑器,导入项目时,选择`manager-api`文件夹作为项目目录 -参照[manager前后端接口协议](https://app.apifox.com/invite/project?token=H_8qhgfjUeaAL0wybghgU)开发 - # 开发环境 JDK 21 Maven 3.8+ MySQL 8.0+ +Redis 5.0+ Vue 3.x -# 创建数据库 - -如果本机已经安装了MySQL,可以直接在数据库中创建名为`xiaozhi_esp32_server`的数据库。 - -```sql -CREATE DATABASE xiaozhi_esp32_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -``` - -如果还没有MySQL,你可以通过docker安装mysql - -``` -docker run --name xiaozhi-esp32-server-db \ --e MYSQL_ROOT_PASSWORD=123456 \ --p 3306:3306 \ --e MYSQL_DATABASE=xiaozhi_esp32_server \ --e MYSQL_INITDB_ARGS="--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci" \ --d mysql:latest -``` - -# 确认项目数据库连接信息 - -在`src/main/resources/application-dev.yml`中配置数据库连接信息 - -``` -spring: - datasource: - username: root - password: 123456 -``` - -# 测试启动 - -本项目为SpringBoot项目,启动方式为: -打开`Application.java`运行`Main`方法启动 - -``` -路径地址: -src/main/java/xiaozhi/AdminApplication.java -``` - -# 打包编译 - -执行以下命令生产jar包 - -``` -mvn install -``` - -把jar包放在服务器上,执行 - -``` -nohup java -jar xiaozhi-esp32-api.jar --spring.profiles.active=dev >/dev/null & -``` - # 接口文档 -启动后打开:http://localhost:8002/xiaozhi-esp32-api/doc.html +启动后打开:http://localhost:8002/xiaozhi/doc.html diff --git a/main/manager-api/pom.xml b/main/manager-api/pom.xml index eacbdff9f..d08e32f2a 100644 --- a/main/manager-api/pom.xml +++ b/main/manager-api/pom.xml @@ -18,7 +18,7 @@ UTF-8 UTF-8 21 - 5.12.0 + 5.10.1 1.2.20 3.5.5 5.8.24 @@ -27,7 +27,6 @@ 2.0.2 1.6.2 33.0.0-jre - 3.3.2 4.20.0 @@ -88,6 +87,36 @@ ${junit.version} test + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.version} + test + + + org.junit.platform + junit-platform-launcher + 1.10.1 + test + + + org.junit.platform + junit-platform-commons + 1.10.1 + test + + + org.junit.platform + junit-platform-engine + 1.10.1 + test + org.springframework.boot spring-boot-starter-test @@ -168,6 +197,10 @@ lombok true + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + diff --git a/main/manager-api/src/main/java/xiaozhi/AdminApplication.java b/main/manager-api/src/main/java/xiaozhi/AdminApplication.java index 8a96edb2a..84e30123d 100644 --- a/main/manager-api/src/main/java/xiaozhi/AdminApplication.java +++ b/main/manager-api/src/main/java/xiaozhi/AdminApplication.java @@ -8,6 +8,6 @@ public class AdminApplication { public static void main(String[] args) { SpringApplication.run(AdminApplication.class, args); - System.out.println("http://localhost:8002/xiaozhi-esp32-api/api/v1/doc.html"); + System.out.println("http://localhost:8002/xiaozhi/doc.html"); } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/annotation/DataFilter.java b/main/manager-api/src/main/java/xiaozhi/common/annotation/DataFilter.java index b25c6fb4f..9bd6cb9db 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/annotation/DataFilter.java +++ b/main/manager-api/src/main/java/xiaozhi/common/annotation/DataFilter.java @@ -1,6 +1,10 @@ package xiaozhi.common.annotation; -import java.lang.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** * 数据过滤注解 diff --git a/main/manager-api/src/main/java/xiaozhi/common/annotation/LogOperation.java b/main/manager-api/src/main/java/xiaozhi/common/annotation/LogOperation.java index b2514ef56..6f6f778da 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/annotation/LogOperation.java +++ b/main/manager-api/src/main/java/xiaozhi/common/annotation/LogOperation.java @@ -1,6 +1,10 @@ package xiaozhi.common.annotation; -import java.lang.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** * 操作日志注解 diff --git a/main/manager-api/src/main/java/xiaozhi/common/aspect/RedisAspect.java b/main/manager-api/src/main/java/xiaozhi/common/aspect/RedisAspect.java index 692486133..d4233e72b 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/aspect/RedisAspect.java +++ b/main/manager-api/src/main/java/xiaozhi/common/aspect/RedisAspect.java @@ -1,14 +1,15 @@ package xiaozhi.common.aspect; -import xiaozhi.common.exception.ErrorCode; -import xiaozhi.common.exception.RenException; -import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.exception.ErrorCode; +import xiaozhi.common.exception.RenException; + /** * Redis切面处理类 * Copyright (c) 人人开源 All rights reserved. @@ -19,7 +20,7 @@ import org.springframework.stereotype.Component; @Component public class RedisAspect { /** - * 是否开启redis缓存 true开启 false关闭 + * 是否开启redis缓存 true开启 false关闭 */ @Value("${renren.redis.open}") private boolean open; diff --git a/main/manager-api/src/main/java/xiaozhi/common/config/MybatisPlusConfig.java b/main/manager-api/src/main/java/xiaozhi/common/config/MybatisPlusConfig.java index 2890a61c4..250e0d070 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/config/MybatisPlusConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/common/config/MybatisPlusConfig.java @@ -1,12 +1,14 @@ package xiaozhi.common.config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; + import xiaozhi.common.interceptor.DataFilterInterceptor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; /** * mybatis-plus配置 diff --git a/main/manager-api/src/main/java/xiaozhi/common/config/RestTemplateConfig.java b/main/manager-api/src/main/java/xiaozhi/common/config/RestTemplateConfig.java new file mode 100644 index 000000000..ecfaa3597 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/common/config/RestTemplateConfig.java @@ -0,0 +1,17 @@ +package xiaozhi.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +/** + * RestTemplate配置 + */ +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/config/SwaggerConfig.java b/main/manager-api/src/main/java/xiaozhi/common/config/SwaggerConfig.java index c9e38ab16..8fb316419 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/config/SwaggerConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/common/config/SwaggerConfig.java @@ -1,11 +1,12 @@ package xiaozhi.common.config; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; + /** * Swagger配置 * Copyright (c) 人人开源 All rights reserved. @@ -14,11 +15,68 @@ import org.springframework.context.annotation.Configuration; @Configuration public class SwaggerConfig { + @Bean + public GroupedOpenApi deviceApi() { + return GroupedOpenApi.builder() + .group("device") + .pathsToMatch("/device/**") + .build(); + } + + @Bean + public GroupedOpenApi agentApi() { + return GroupedOpenApi.builder() + .group("agent") + .pathsToMatch("/agent/**") + .build(); + } + + @Bean + public GroupedOpenApi modelApi() { + return GroupedOpenApi.builder() + .group("models") + .pathsToMatch("/models/**") + .build(); + } + + @Bean + public GroupedOpenApi oatApi() { + return GroupedOpenApi.builder() + .group("ota") + .pathsToMatch("/ota/**") + .build(); + } + + @Bean + public GroupedOpenApi timbreApi() { + return GroupedOpenApi.builder() + .group("timbre") + .pathsToMatch("/ttsVoice/**") + .build(); + } + + @Bean + public GroupedOpenApi sysApi() { + return GroupedOpenApi.builder() + .group("admin") + .pathsToMatch("/admin/**") + .build(); + } + @Bean public GroupedOpenApi userApi() { - String[] paths = {"/**"}; - return GroupedOpenApi.builder().group("xiaozhi") - .pathsToMatch(paths).build(); + return GroupedOpenApi.builder() + .group("user") + .pathsToMatch("/user/**") + .build(); + } + + @Bean + public GroupedOpenApi configApi() { + return GroupedOpenApi.builder() + .group("config") + .pathsToMatch("/config/**") + .build(); } @Bean diff --git a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java index 3738498b8..78154b5c6 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java +++ b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java @@ -74,8 +74,36 @@ public interface Constant { */ String ORDER = "order"; + /** + * 请求头授权标识 + */ String AUTHORIZATION = "Authorization"; + /** + * 服务器密钥 + */ + String SERVER_SECRET = "server.secret"; + + /** + * websocket地址 + */ + String SERVER_WEBSOCKET = "server.websocket"; + + /** + * ota地址 + */ + String SERVER_OTA = "server.ota"; + + /** + * 是否允许用户注册 + */ + String SERVER_ALLOW_USER_REGISTER = "server.allow_user_register"; + + /** + * 下发六位验证码时显示的控制面板地址 + */ + String SERVER_FRONTED_URL = "server.fronted_url"; + /** * 路径分割符 */ @@ -145,4 +173,9 @@ public interface Constant { return value; } } + + /** + * 版本号 + */ + public static final String VERSION = "0.4.2"; } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/convert/DateConverter.java b/main/manager-api/src/main/java/xiaozhi/common/convert/DateConverter.java index a84391807..fd0f74c29 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/convert/DateConverter.java +++ b/main/manager-api/src/main/java/xiaozhi/common/convert/DateConverter.java @@ -1,17 +1,17 @@ package xiaozhi.common.convert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.convert.converter.Converter; -import org.springframework.stereotype.Component; -import org.springframework.util.StringUtils; - import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + /** * 日期转换 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/entity/BaseEntity.java b/main/manager-api/src/main/java/xiaozhi/common/entity/BaseEntity.java index e7e2f345d..ce267babc 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/entity/BaseEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/common/entity/BaseEntity.java @@ -1,12 +1,13 @@ package xiaozhi.common.entity; +import java.io.Serializable; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; +import lombok.Data; /** * 基础实体类,所有实体都需要继承 diff --git a/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java b/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java index e5365b3c6..c59a6a14e 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java +++ b/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java @@ -43,4 +43,16 @@ public interface ErrorCode { int PASSWORD_WEAK_ERROR = 10031; int DEL_MYSELF_ERROR = 10032; int DEVICE_CAPTCHA_ERROR = 10033; + + // 参数校验相关错误码 + int PARAM_VALUE_NULL = 10034; + int PARAM_TYPE_NULL = 10035; + int PARAM_TYPE_INVALID = 10036; + int PARAM_NUMBER_INVALID = 10037; + int PARAM_BOOLEAN_INVALID = 10038; + int PARAM_ARRAY_INVALID = 10039; + int PARAM_JSON_INVALID = 10040; + + int OTA_DEVICE_NOT_FOUND = 10041; + int OTA_DEVICE_NEED_BIND = 10042; } diff --git a/main/manager-api/src/main/java/xiaozhi/common/exception/RenException.java b/main/manager-api/src/main/java/xiaozhi/common/exception/RenException.java index cf295dcfe..9b928d5c2 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/exception/RenException.java +++ b/main/manager-api/src/main/java/xiaozhi/common/exception/RenException.java @@ -1,6 +1,5 @@ package xiaozhi.common.exception; - import xiaozhi.common.utils.MessageUtils; /** @@ -10,7 +9,6 @@ import xiaozhi.common.utils.MessageUtils; */ public class RenException extends RuntimeException { - private int code; private String msg; diff --git a/main/manager-api/src/main/java/xiaozhi/common/exception/RenExceptionHandler.java b/main/manager-api/src/main/java/xiaozhi/common/exception/RenExceptionHandler.java index 06665ee2f..0d0aa1181 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/exception/RenExceptionHandler.java +++ b/main/manager-api/src/main/java/xiaozhi/common/exception/RenExceptionHandler.java @@ -1,13 +1,14 @@ package xiaozhi.common.exception; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.UnauthorizedException; import org.springframework.dao.DuplicateKeyException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import xiaozhi.common.utils.Result; +import org.springframework.web.servlet.resource.NoResourceFoundException; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.utils.Result; /** * 异常处理器 @@ -23,35 +24,40 @@ public class RenExceptionHandler { * 处理自定义异常 */ @ExceptionHandler(RenException.class) - public Result handleRenException(RenException ex) { - Result result = new Result(); + public Result handleRenException(RenException ex) { + Result result = new Result<>(); result.error(ex.getCode(), ex.getMsg()); return result; } @ExceptionHandler(DuplicateKeyException.class) - public Result handleDuplicateKeyException(DuplicateKeyException ex) { - Result result = new Result(); + public Result handleDuplicateKeyException(DuplicateKeyException ex) { + Result result = new Result<>(); result.error(ErrorCode.DB_RECORD_EXISTS); return result; } @ExceptionHandler(UnauthorizedException.class) - public Result handleUnauthorizedException(UnauthorizedException ex) { - Result result = new Result(); + public Result handleUnauthorizedException(UnauthorizedException ex) { + Result result = new Result<>(); result.error(ErrorCode.FORBIDDEN); return result; } - @ExceptionHandler(Exception.class) - public Result handleException(Exception ex) { + public Result handleException(Exception ex) { log.error(ex.getMessage(), ex); - return new Result().error(); + return new Result().error(); + } + + @ExceptionHandler(NoResourceFoundException.class) + public Result handleNoResourceFoundException(NoResourceFoundException ex) { + log.warn("Resource not found: {}", ex.getMessage()); + return new Result().error(404, "资源不存在"); } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java b/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java index 20371fd65..a6b33b620 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java +++ b/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java @@ -1,13 +1,15 @@ package xiaozhi.common.handler; -import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; -import xiaozhi.common.constant.Constant; -import xiaozhi.common.user.UserDetail; -import xiaozhi.modules.security.user.SecurityUser; +import java.util.Date; + import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; -import java.util.Date; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; + +import xiaozhi.common.constant.Constant; +import xiaozhi.common.user.UserDetail; +import xiaozhi.modules.security.user.SecurityUser; /** * 公共字段,自动填充值 @@ -22,35 +24,34 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { private final static String UPDATER = "updater"; private final static String DATA_OPERATION = "dataOperation"; - private final static String DEPT_ID = "deptId"; @Override public void insertFill(MetaObject metaObject) { UserDetail user = SecurityUser.getUser(); Date date = new Date(); - //创建者 + // 创建者 strictInsertFill(metaObject, CREATOR, Long.class, user.getId()); - //创建时间 + // 创建时间 strictInsertFill(metaObject, CREATE_DATE, Date.class, date); - //更新者 + // 更新者 strictInsertFill(metaObject, UPDATER, Long.class, user.getId()); - //更新时间 + // 更新时间 strictInsertFill(metaObject, UPDATE_DATE, Date.class, date); - //数据标识 + // 数据标识 strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.INSERT.getValue()); } @Override public void updateFill(MetaObject metaObject) { - //更新者 + // 更新者 strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId()); - //更新时间 + // 更新时间 strictUpdateFill(metaObject, UPDATE_DATE, Date.class, new Date()); - //数据标识 + // 数据标识 strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.UPDATE.getValue()); } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/interceptor/DataFilterInterceptor.java b/main/manager-api/src/main/java/xiaozhi/common/interceptor/DataFilterInterceptor.java index 160e7ff33..0457686b1 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/interceptor/DataFilterInterceptor.java +++ b/main/manager-api/src/main/java/xiaozhi/common/interceptor/DataFilterInterceptor.java @@ -1,8 +1,17 @@ package xiaozhi.common.interceptor; -import cn.hutool.core.util.StrUtil; +import java.util.Map; + +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + import com.baomidou.mybatisplus.core.toolkit.PluginUtils; import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; + +import cn.hutool.core.util.StrUtil; import net.sf.jsqlparser.JSQLParserException; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.StringValue; @@ -10,13 +19,6 @@ import net.sf.jsqlparser.expression.operators.conditional.AndExpression; import net.sf.jsqlparser.parser.CCJSqlParserUtil; import net.sf.jsqlparser.statement.select.PlainSelect; import net.sf.jsqlparser.statement.select.Select; -import org.apache.ibatis.executor.Executor; -import org.apache.ibatis.mapping.BoundSql; -import org.apache.ibatis.mapping.MappedStatement; -import org.apache.ibatis.session.ResultHandler; -import org.apache.ibatis.session.RowBounds; - -import java.util.Map; /** * 数据过滤 @@ -25,8 +27,10 @@ import java.util.Map; */ public class DataFilterInterceptor implements InnerInterceptor { + @SuppressWarnings("rawtypes") @Override - public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) { + public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, + ResultHandler resultHandler, BoundSql boundSql) { DataScope scope = getDataScope(parameter); // 不进行数据过滤 if (scope == null || StrUtil.isBlank(scope.getSqlFilter())) { @@ -48,7 +52,7 @@ public class DataFilterInterceptor implements InnerInterceptor { // 判断参数里是否有DataScope对象 if (parameter instanceof Map) { Map parameterMap = (Map) parameter; - for (Map.Entry entry : parameterMap.entrySet()) { + for (Map.Entry entry : parameterMap.entrySet()) { if (entry.getValue() != null && entry.getValue() instanceof DataScope) { return (DataScope) entry.getValue(); } diff --git a/main/manager-api/src/main/java/xiaozhi/common/page/PageData.java b/main/manager-api/src/main/java/xiaozhi/common/page/PageData.java index b7e943d2d..83e93c119 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/page/PageData.java +++ b/main/manager-api/src/main/java/xiaozhi/common/page/PageData.java @@ -1,11 +1,11 @@ package xiaozhi.common.page; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import java.io.Serializable; import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + /** * 分页工具类 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/page/TokenDTO.java b/main/manager-api/src/main/java/xiaozhi/common/page/TokenDTO.java index 48d26f3a1..cce1a6df8 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/page/TokenDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/common/page/TokenDTO.java @@ -1,10 +1,10 @@ package xiaozhi.common.page; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.io.Serializable; - /** * 令牌信息 * @@ -14,7 +14,6 @@ import java.io.Serializable; @Schema(description = "令牌信息") public class TokenDTO implements Serializable { - @Schema(description = "密码") private String token; diff --git a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisConfig.java b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisConfig.java index a4316b63a..703a84925 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisConfig.java @@ -1,6 +1,5 @@ package xiaozhi.common.redis; -import jakarta.annotation.Resource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -8,6 +7,8 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; +import jakarta.annotation.Resource; + /** * Redis配置 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java index 21121fd73..624874563 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java +++ b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java @@ -26,4 +26,95 @@ public class RedisKeys { public static String getDeviceCaptchaKey(String captcha) { return "sys:device:captcha:" + captcha; } + + /** + * 用户id的Key + */ + public static String getUserIdKey(Long userid) { + return "sys:username:id:" + userid; + } + + /** + * 模型名称的Key + */ + public static String getModelNameById(String id) { + return "model:name:" + id; + } + + /** + * 模型配置的Key + */ + public static String getModelConfigById(String id) { + return "model:data:" + id; + } + + /** + * 获取音色名称缓存key + */ + public static String getTimbreNameById(String id) { + return "timbre:name:" + id; + } + + /** + * 获取设备数量缓存key + */ + public static String getAgentDeviceCountById(String id) { + return "agent:device:count:" + id; + } + + /** + * 获取智能体最后连接时间缓存key + */ + public static String getAgentDeviceLastConnectedAtById(String id) { + return "agent:device:lastConnected:" + id; + } + + /** + * 获取系统配置缓存key + */ + public static String getServerConfigKey() { + return "server:config"; + } + + /** + * 获取音色详情缓存key + */ + public static String getTimbreDetailsKey(String id) { + return "timbre:details:" + id; + } + + /** + * 获取版本号Key + */ + public static String getVersionKey() { + return "sys:version"; + } + + /** + * OTA固件ID的Key + */ + public static String getOtaIdKey(String uuid) { + return "ota:id:" + uuid; + } + + /** + * OTA固件下载次数的Key + */ + public static String getOtaDownloadCountKey(String uuid) { + return "ota:download:count:" + uuid; + } + + /** + * 获取字典数据的缓存key + */ + public static String getDictDataByTypeKey(String dictType) { + return "sys:dict:data:" + dictType; + } + + /** + * 获取智能体音频ID的缓存key + */ + public static String getAgentAudioIdKey(String uuid) { + return "agent:audio:id:" + uuid; + } } diff --git a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisUtils.java b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisUtils.java index 4626b14d4..9115e8061 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisUtils.java @@ -1,14 +1,18 @@ package xiaozhi.common.redis; -import jakarta.annotation.Resource; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Component; - import java.util.Collection; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.stereotype.Component; + +import jakarta.annotation.Resource; + /** * Redis工具类 * Copyright (c) 人人开源 All rights reserved. @@ -26,7 +30,7 @@ public class RedisUtils { /** * 过期时长为1小时,单位:秒 */ - public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L; + public final static long HOUR_ONE_EXPIRE = (long) 60 * 60; /** * 过期时长为6小时,单位:秒 */ @@ -123,4 +127,24 @@ public class RedisUtils { public Object rightPop(String key) { return redisTemplate.opsForList().rightPop(key); } + + + /** + * 清空所有 Redis 数据库中的所有键 + */ + public void emptyAll() { + // Lua 脚本 FLUSHALL是redis清空所有库的命令 + String luaScript ="redis.call('FLUSHALL')"; + + // 创建 DefaultRedisScript 对象 + DefaultRedisScript redisScript = new DefaultRedisScript<>(); + redisScript.setScriptText(luaScript); // 设置 Lua 脚本内容 + redisScript.setResultType(Void.class); // 设置返回值类型 + + // 执行 Lua 脚本 + List keys = Collections.emptyList(); // 如果脚本不依赖 key,可以传入空列表 + redisTemplate.execute(redisScript, keys); + + } + } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/common/service/BaseService.java b/main/manager-api/src/main/java/xiaozhi/common/service/BaseService.java index 01bd48cad..2feaefd11 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/service/BaseService.java +++ b/main/manager-api/src/main/java/xiaozhi/common/service/BaseService.java @@ -1,10 +1,10 @@ package xiaozhi.common.service; -import com.baomidou.mybatisplus.core.conditions.Wrapper; - import java.io.Serializable; import java.util.Collection; +import com.baomidou.mybatisplus.core.conditions.Wrapper; + /** * 基础服务接口,所有Service接口都要继承 * Copyright (c) 人人开源 All rights reserved. @@ -56,7 +56,8 @@ public interface BaseService { *

* * @param entity 实体对象 - * @param updateWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper} + * @param updateWrapper 实体对象封装操作类 + * {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper} */ boolean update(T entity, Wrapper updateWrapper); diff --git a/main/manager-api/src/main/java/xiaozhi/common/service/CrudService.java b/main/manager-api/src/main/java/xiaozhi/common/service/CrudService.java index bc1094e4a..51f16bcb7 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/service/CrudService.java +++ b/main/manager-api/src/main/java/xiaozhi/common/service/CrudService.java @@ -1,11 +1,11 @@ package xiaozhi.common.service; -import xiaozhi.common.page.PageData; - import java.io.Serializable; import java.util.List; import java.util.Map; +import xiaozhi.common.page.PageData; + /** * CRUD基础服务接口 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/service/impl/BaseServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/common/service/impl/BaseServiceImpl.java index 16fd6feb0..9d2ba5d53 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/service/impl/BaseServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/common/service/impl/BaseServiceImpl.java @@ -1,5 +1,18 @@ package xiaozhi.common.service.impl; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; + +import org.apache.ibatis.binding.MapperMethod; +import org.apache.ibatis.logging.Log; +import org.apache.ibatis.logging.LogFactory; +import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.enums.SqlMethod; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -10,22 +23,11 @@ import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; + import xiaozhi.common.constant.Constant; import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; import xiaozhi.common.utils.ConvertUtils; -import org.apache.ibatis.binding.MapperMethod; -import org.apache.ibatis.logging.Log; -import org.apache.ibatis.logging.LogFactory; -import org.apache.ibatis.session.SqlSession; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import java.io.Serializable; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.BiConsumer; /** * 基础服务类,所有Service都要继承 @@ -45,7 +47,7 @@ public abstract class BaseServiceImpl, T> implements Bas * @param isAsc 排序方式 */ protected IPage getPage(Map params, String defaultOrderField, boolean isAsc) { - //分页参数 + // 分页参数 long curPage = 1; long limit = 10; @@ -56,17 +58,17 @@ public abstract class BaseServiceImpl, T> implements Bas limit = Long.parseLong((String) params.get(Constant.LIMIT)); } - //分页对象 + // 分页对象 Page page = new Page<>(curPage, limit); - //分页参数 + // 分页参数 params.put(Constant.PAGE, page); - //排序字段 + // 排序字段 String orderField = (String) params.get(Constant.ORDER_FIELD); String order = (String) params.get(Constant.ORDER); - //前端字段排序 + // 前端字段排序 if (StringUtils.isNotBlank(orderField) && StringUtils.isNotBlank(order)) { if (Constant.ASC.equalsIgnoreCase(order)) { return page.addOrder(OrderItem.asc(orderField)); @@ -75,12 +77,12 @@ public abstract class BaseServiceImpl, T> implements Bas } } - //没有排序字段,则不排序 + // 没有排序字段,则不排序 if (StringUtils.isBlank(defaultOrderField)) { return page; } - //默认排序 + // 默认排序 if (isAsc) { page.addOrder(OrderItem.asc(defaultOrderField)); } else { @@ -90,13 +92,13 @@ public abstract class BaseServiceImpl, T> implements Bas return page; } - protected PageData getPageData(List list, long total, Class target) { - List targetList = ConvertUtils.sourceToTarget(list, target); + protected PageData getPageData(List list, long total, Class target) { + List targetList = ConvertUtils.sourceToTarget(list, target); return new PageData<>(targetList, total); } - protected PageData getPageData(IPage page, Class target) { + protected PageData getPageData(IPage page, Class target) { return getPageData(page.getRecords(), page.getTotal(), target); } @@ -164,11 +166,11 @@ public abstract class BaseServiceImpl, T> implements Bas /** * 执行批量操作 */ + @SuppressWarnings("deprecation") protected boolean executeBatch(Collection list, int batchSize, BiConsumer consumer) { return SqlHelper.executeBatch(this.currentModelClass(), this.log, list, batchSize, consumer); } - @Override @Transactional(rollbackFor = Exception.class) public boolean updateById(T entity) { diff --git a/main/manager-api/src/main/java/xiaozhi/common/service/impl/CrudServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/common/service/impl/CrudServiceImpl.java index 6608e7c3a..9a1bf39ed 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/service/impl/CrudServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/common/service/impl/CrudServiceImpl.java @@ -1,25 +1,28 @@ package xiaozhi.common.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; -import xiaozhi.common.page.PageData; -import xiaozhi.common.service.CrudService; -import xiaozhi.common.utils.ConvertUtils; -import org.springframework.beans.BeanUtils; - import java.io.Serializable; import java.util.Arrays; import java.util.List; import java.util.Map; +import org.springframework.beans.BeanUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; + +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.CrudService; +import xiaozhi.common.utils.ConvertUtils; + /** * CRUD基础服务类 * Copyright (c) 人人开源 All rights reserved. * Website: https://www.renren.io */ -public abstract class CrudServiceImpl, T, D> extends BaseServiceImpl implements CrudService { +public abstract class CrudServiceImpl, T, D> extends BaseServiceImpl + implements CrudService { protected Class currentDtoClass() { return (Class) ReflectionKit.getSuperClassGenericType(getClass(), CrudServiceImpl.class, 2); @@ -29,8 +32,7 @@ public abstract class CrudServiceImpl, T, D> extends Bas public PageData page(Map params) { IPage page = baseDao.selectPage( getPage(params, null, false), - getWrapper(params) - ); + getWrapper(params)); return getPageData(page, currentDtoClass()); } @@ -56,7 +58,7 @@ public abstract class CrudServiceImpl, T, D> extends Bas T entity = ConvertUtils.sourceToTarget(dto, currentModelClass()); insert(entity); - //copy主键值到dto + // copy主键值到dto BeanUtils.copyProperties(entity, dto); } diff --git a/main/manager-api/src/main/java/xiaozhi/common/user/UserDetail.java b/main/manager-api/src/main/java/xiaozhi/common/user/UserDetail.java index 2ad023d7d..0aa9210ba 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/user/UserDetail.java +++ b/main/manager-api/src/main/java/xiaozhi/common/user/UserDetail.java @@ -1,9 +1,9 @@ package xiaozhi.common.user; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; + /** * 登录用户信息 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/ConvertUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/ConvertUtils.java index 7a5bc0ed7..07ade50f3 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/ConvertUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/ConvertUtils.java @@ -1,12 +1,13 @@ package xiaozhi.common.utils; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; - import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.springframework.beans.BeanUtils; + +import lombok.extern.slf4j.Slf4j; + /** * 转换工具类 * Copyright (c) 人人开源 All rights reserved. @@ -20,7 +21,7 @@ public class ConvertUtils { } T targetObject = null; try { - targetObject = target.newInstance(); + targetObject = target.getDeclaredConstructor().newInstance(); BeanUtils.copyProperties(source, targetObject); } catch (Exception e) { log.error("convert error ", e); @@ -34,10 +35,10 @@ public class ConvertUtils { return null; } - List targetList = new ArrayList<>(sourceList.size()); + List targetList = new ArrayList<>(sourceList.size()); try { for (Object source : sourceList) { - T targetObject = target.newInstance(); + T targetObject = target.getDeclaredConstructor().newInstance(); BeanUtils.copyProperties(source, targetObject); targetList.add(targetObject); } diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/DateUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/DateUtils.java index 9e5ef3e1c..bfa7afed6 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/DateUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/DateUtils.java @@ -2,6 +2,9 @@ package xiaozhi.common.utils; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.Date; /** @@ -60,4 +63,39 @@ public class DateUtils { return null; } + /** + * 获取简短的时间字符串:10秒前返回刚刚,多少秒前,几小时前,超过一周返回年月日时分秒 + * @param date + * @return + */ + public static String getShortTime(Date date) { + if (date == null) { + return null; + } + // 将 Date 转换为 Instant + LocalDateTime localDateTime = date.toInstant() + // 获取系统默认时区 + .atZone(ZoneId.systemDefault()) + // 转换为 LocalDateTime + .toLocalDateTime(); + // 当前时间 + LocalDateTime now = LocalDateTime.now(); + // 时间差,单位为秒 + long secondsBetween = ChronoUnit.SECONDS.between(localDateTime, now); + + if (secondsBetween <= 10) { + return "刚刚"; + } else if (secondsBetween < 60) { + return secondsBetween + "秒前"; + } else if (secondsBetween < 60 * 60) { + return secondsBetween / 60 + "分钟前"; + } else if (secondsBetween < 86400) { + return secondsBetween / 3600 + "小时前"; + } else if (secondsBetween < 604800) { + return secondsBetween / 86400 + "天前"; + } else { + // 超过一周,显示完整日期时间 + return format(date,DATE_TIME_PATTERN); + } + } } diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/HttpContextUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/HttpContextUtils.java index 8d76434c5..0e46acf16 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/HttpContextUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/HttpContextUtils.java @@ -1,20 +1,21 @@ package xiaozhi.common.utils; -import jakarta.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpHeaders; import org.springframework.util.DigestUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; + +import jakarta.servlet.http.HttpServletRequest; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - /** * Http * Copyright (c) 人人开源 All rights reserved. @@ -70,15 +71,15 @@ public class HttpContextUtils { } public static String getLanguage() { - //默认语言 + // 默认语言 String defaultLanguage = "zh-CN"; - //request + // request HttpServletRequest request = getHttpServletRequest(); if (request == null) { return defaultLanguage; } - //请求语言 + // 请求语言 defaultLanguage = request.getHeader(HttpHeaders.ACCEPT_LANGUAGE); return defaultLanguage; diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/IpUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/IpUtils.java index 307ad3b51..fef7972f2 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/IpUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/IpUtils.java @@ -1,8 +1,9 @@ package xiaozhi.common.utils; +import org.apache.commons.lang3.StringUtils; + import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; /** * IP地址 diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/JsonUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/JsonUtils.java index 4a9082458..288dae9ab 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/JsonUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/JsonUtils.java @@ -1,13 +1,14 @@ package xiaozhi.common.utils; -import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.StrUtil; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; + /** * JSON 工具类 * Copyright (c) 人人开源 All rights reserved. @@ -59,7 +60,8 @@ public class JsonUtils { return new ArrayList<>(); } try { - return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz)); + return objectMapper.readValue(text, + objectMapper.getTypeFactory().constructCollectionType(List.class, clazz)); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/Result.java b/main/manager-api/src/main/java/xiaozhi/common/utils/Result.java index 65841b7d1..9c326af70 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/Result.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/Result.java @@ -1,11 +1,11 @@ package xiaozhi.common.utils; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import xiaozhi.common.exception.ErrorCode; -import java.io.Serializable; - /** * 响应数据 * Copyright (c) 人人开源 All rights reserved. @@ -36,7 +36,6 @@ public class Result implements Serializable { return this; } - public Result error() { this.code = ErrorCode.INTERNAL_SERVER_ERROR; this.msg = MessageUtils.getMessage(this.code); diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/TreeNode.java b/main/manager-api/src/main/java/xiaozhi/common/utils/TreeNode.java index b60bc9cf0..5fdb5985e 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/TreeNode.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/TreeNode.java @@ -1,11 +1,11 @@ package xiaozhi.common.utils; -import lombok.Data; - import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import lombok.Data; + /** * 树节点,所有需要实现树节点的,都需要继承该类 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/TreeUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/TreeUtils.java index 766cb0295..e76190eba 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/utils/TreeUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/utils/TreeUtils.java @@ -1,12 +1,12 @@ package xiaozhi.common.utils; -import xiaozhi.common.validator.AssertUtils; - import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import xiaozhi.common.validator.AssertUtils; + /** * 树形结构工具类,如:菜单、部门等 * Copyright (c) 人人开源 All rights reserved. @@ -17,8 +17,8 @@ public class TreeUtils { /** * 根据pid,构建树节点 */ - public static List build(List treeNodes, Long pid) { - //pid不能为空 + public static > List build(List treeNodes, Long pid) { + // pid不能为空 AssertUtils.isNull(pid, "pid"); List treeList = new ArrayList<>(); @@ -34,7 +34,7 @@ public class TreeUtils { /** * 查找子节点 */ - private static T findChildren(List treeNodes, T rootNode) { + private static > T findChildren(List treeNodes, T rootNode) { for (T treeNode : treeNodes) { if (rootNode.getId().equals(treeNode.getPid())) { rootNode.getChildren().add(findChildren(treeNodes, treeNode)); @@ -46,10 +46,10 @@ public class TreeUtils { /** * 构建树节点 */ - public static List build(List treeNodes) { + public static > List build(List treeNodes) { List result = new ArrayList<>(); - //list转map + // list转map Map nodeMap = new LinkedHashMap<>(treeNodes.size()); for (T treeNode : treeNodes) { nodeMap.put(treeNode.getId(), treeNode); diff --git a/main/manager-api/src/main/java/xiaozhi/common/validator/AssertUtils.java b/main/manager-api/src/main/java/xiaozhi/common/validator/AssertUtils.java index 6a6b43e1c..c86aa5176 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/validator/AssertUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/validator/AssertUtils.java @@ -1,14 +1,15 @@ package xiaozhi.common.validator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + import cn.hutool.core.collection.CollUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; -import java.util.Map; /** * 校验工具类 @@ -73,11 +74,11 @@ public class AssertUtils { } } - public static void isMapEmpty(Map map, String... params) { + public static void isMapEmpty(Map map, String... params) { isMapEmpty(map, ErrorCode.NOT_NULL, params); } - public static void isMapEmpty(Map map, Integer code, String... params) { + public static void isMapEmpty(Map map, Integer code, String... params) { if (code == null) { throw new RenException(ErrorCode.NOT_NULL, "code"); } diff --git a/main/manager-api/src/main/java/xiaozhi/common/validator/ValidatorUtils.java b/main/manager-api/src/main/java/xiaozhi/common/validator/ValidatorUtils.java index 80acb097a..9e31c964d 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/validator/ValidatorUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/validator/ValidatorUtils.java @@ -1,16 +1,17 @@ package xiaozhi.common.validator; -import xiaozhi.common.exception.RenException; -import jakarta.validation.ConstraintViolation; -import jakarta.validation.Validation; -import jakarta.validation.Validator; +import java.util.Locale; +import java.util.Set; + import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.validation.beanvalidation.MessageSourceResourceBundleLocator; -import java.util.Locale; -import java.util.Set; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import xiaozhi.common.exception.RenException; /** * hibernate-validator校验工具类 @@ -35,7 +36,7 @@ public class ValidatorUtils { throws RenException { Locale.setDefault(LocaleContextHolder.getLocale()); Validator validator = Validation.byDefaultProvider().configure().messageInterpolator( - new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(getMessageSource()))) + new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(getMessageSource()))) .buildValidatorFactory().getValidator(); Set> constraintViolations = validator.validate(object, groups); diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/SqlFilter.java b/main/manager-api/src/main/java/xiaozhi/common/xss/SqlFilter.java index 20291da1c..2bf4ab928 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/SqlFilter.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/SqlFilter.java @@ -1,8 +1,9 @@ package xiaozhi.common.xss; +import org.apache.commons.lang3.StringUtils; + import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; -import org.apache.commons.lang3.StringUtils; /** * SQL过滤 @@ -20,19 +21,20 @@ public class SqlFilter { if (StringUtils.isBlank(str)) { return null; } - //去掉'|"|;|\字符 + // 去掉'|"|;|\字符 str = StringUtils.replace(str, "'", ""); str = StringUtils.replace(str, "\"", ""); str = StringUtils.replace(str, ";", ""); str = StringUtils.replace(str, "\\", ""); - //转换成小写 + // 转换成小写 str = str.toLowerCase(); - //非法字符 - String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; + // 非法字符 + String[] keywords = { "master", "truncate", "insert", "select", "delete", "update", "declare", "alter", + "drop" }; - //判断是否包含非法字符 + // 判断是否包含非法字符 for (String keyword : keywords) { if (str.contains(keyword)) { throw new RenException(ErrorCode.INVALID_SYMBOL); diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/XssConfig.java b/main/manager-api/src/main/java/xiaozhi/common/xss/XssConfig.java index f62786fd9..e4b654659 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/XssConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/XssConfig.java @@ -1,6 +1,5 @@ package xiaozhi.common.xss; -import jakarta.servlet.DispatcherType; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; @@ -8,6 +7,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.PathMatcher; +import jakarta.servlet.DispatcherType; + /** * XSS 配置文件 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/XssFilter.java b/main/manager-api/src/main/java/xiaozhi/common/xss/XssFilter.java index 9a24d7eb7..db7699897 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/XssFilter.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/XssFilter.java @@ -1,11 +1,17 @@ package xiaozhi.common.xss; -import jakarta.servlet.*; -import jakarta.servlet.http.HttpServletRequest; -import lombok.AllArgsConstructor; +import java.io.IOException; + import org.springframework.util.PathMatcher; -import java.io.IOException; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import lombok.AllArgsConstructor; /** * XSS过滤 @@ -38,7 +44,8 @@ public class XssFilter implements Filter { private boolean shouldNotFilter(HttpServletRequest request) { // 放行不过滤的URL - return properties.getExcludeUrls().stream().anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, request.getServletPath())); + return properties.getExcludeUrls().stream() + .anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, request.getServletPath())); } @Override diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/XssHttpServletRequestWrapper.java b/main/manager-api/src/main/java/xiaozhi/common/xss/XssHttpServletRequestWrapper.java index 1306c2dd5..ecb364061 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/XssHttpServletRequestWrapper.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/XssHttpServletRequestWrapper.java @@ -1,20 +1,20 @@ package xiaozhi.common.xss; -import cn.hutool.core.io.IoUtil; -import jakarta.servlet.ReadListener; -import jakarta.servlet.ServletInputStream; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletRequestWrapper; -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.LinkedHashMap; import java.util.Map; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +import cn.hutool.core.io.IoUtil; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; /** * XSS过滤处理 @@ -29,18 +29,18 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { @Override public ServletInputStream getInputStream() throws IOException { - //非json类型,直接返回 + // 非json类型,直接返回 if (!MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(super.getHeader(HttpHeaders.CONTENT_TYPE))) { return super.getInputStream(); } - //为空,直接返回 + // 为空,直接返回 String json = IoUtil.readUtf8(super.getInputStream()); if (StringUtils.isBlank(json)) { return super.getInputStream(); } - //xss过滤 + // xss过滤 json = xssEncode(json); final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)); return new ServletInputStream() { diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/XssProperties.java b/main/manager-api/src/main/java/xiaozhi/common/xss/XssProperties.java index bf36ddbed..5d9b8b01d 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/XssProperties.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/XssProperties.java @@ -1,11 +1,12 @@ package xiaozhi.common.xss; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; - import java.util.Collections; import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import lombok.Data; + /** * XSS 配置项 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/common/xss/XssUtils.java b/main/manager-api/src/main/java/xiaozhi/common/xss/XssUtils.java index 5d4ac6b35..165883924 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/xss/XssUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/common/xss/XssUtils.java @@ -22,13 +22,15 @@ public class XssUtils extends Safelist { */ private static Safelist xssWhitelist() { return new Safelist() - //支持的标签 + // 支持的标签 .addTags("a", "b", "blockquote", "br", "caption", "cite", "code", "col", "colgroup", "dd", "div", "dl", - "dt", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i", "img", "li", "ol", "p", "pre", "q", "small", - "strike", "strong", "sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", "ul", + "dt", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i", "img", "li", "ol", "p", "pre", "q", + "small", + "strike", "strong", "sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", + "ul", "embed", "object", "param", "span") - //支持的标签属性 + // 支持的标签属性 .addAttributes("a", "href", "class", "style", "target", "rel", "nofollow") .addAttributes("blockquote", "cite") .addAttributes("code", "class", "style") @@ -44,13 +46,16 @@ public class XssUtils extends Safelist { .addAttributes("ul", "type", "style") .addAttributes("pre", "class", "style") .addAttributes("div", "class", "id", "style") - .addAttributes("embed", "src", "wmode", "flashvars", "pluginspage", "allowFullScreen", "allowfullscreen", - "quality", "width", "height", "align", "allowScriptAccess", "allowscriptaccess", "allownetworking", "type") - .addAttributes("object", "type", "id", "name", "data", "width", "height", "style", "classid", "codebase") + .addAttributes("embed", "src", "wmode", "flashvars", "pluginspage", "allowFullScreen", + "allowfullscreen", + "quality", "width", "height", "align", "allowScriptAccess", "allowscriptaccess", + "allownetworking", "type") + .addAttributes("object", "type", "id", "name", "data", "width", "height", "style", "classid", + "codebase") .addAttributes("param", "name", "value") .addAttributes("span", "class", "style") - //标签属性对应的协议 + // 标签属性对应的协议 .addProtocols("a", "href", "ftp", "http", "https", "mailto") .addProtocols("img", "src", "http", "https") .addProtocols("blockquote", "cite", "http", "https") diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentChatHistoryController.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentChatHistoryController.java new file mode 100644 index 000000000..9d6542ccf --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentChatHistoryController.java @@ -0,0 +1,36 @@ +package xiaozhi.modules.agent.controller; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import xiaozhi.common.utils.Result; +import xiaozhi.modules.agent.dto.AgentChatHistoryReportDTO; +import xiaozhi.modules.agent.service.biz.AgentChatHistoryBizService; + +@Tag(name = "智能体聊天历史管理") +@RequiredArgsConstructor +@RestController +@RequestMapping("/agent/chat-history") +public class AgentChatHistoryController { + private final AgentChatHistoryBizService agentChatHistoryBizService; + + /** + * 小智服务聊天上报请求 + *

+ * 小智服务聊天上报请求,包含Base64编码的音频数据和相关信息。 + * + * @param request 包含上传文件及相关信息的请求对象 + */ + @Operation(summary = "小智服务聊天上报请求") + @PostMapping("/report") + public Result uploadFile(@Valid @RequestBody AgentChatHistoryReportDTO request) { + Boolean result = agentChatHistoryBizService.report(request); + return new Result().ok(result); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentController.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentController.java index 9f2cb10d7..9368cf6b5 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/controller/AgentController.java @@ -1,44 +1,75 @@ package xiaozhi.modules.agent.controller; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.AllArgsConstructor; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.web.bind.annotation.*; import xiaozhi.common.constant.Constant; import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; import xiaozhi.common.user.UserDetail; import xiaozhi.common.utils.ConvertUtils; import xiaozhi.common.utils.Result; +import xiaozhi.modules.agent.dto.AgentChatHistoryDTO; +import xiaozhi.modules.agent.dto.AgentChatSessionDTO; import xiaozhi.modules.agent.dto.AgentCreateDTO; +import xiaozhi.modules.agent.dto.AgentDTO; import xiaozhi.modules.agent.dto.AgentUpdateDTO; import xiaozhi.modules.agent.entity.AgentEntity; +import xiaozhi.modules.agent.entity.AgentTemplateEntity; +import xiaozhi.modules.agent.service.AgentChatAudioService; +import xiaozhi.modules.agent.service.AgentChatHistoryService; import xiaozhi.modules.agent.service.AgentService; +import xiaozhi.modules.agent.service.AgentTemplateService; +import xiaozhi.modules.device.service.DeviceService; import xiaozhi.modules.security.user.SecurityUser; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Tag(name = "智能体管理") @AllArgsConstructor @RestController @RequestMapping("/agent") public class AgentController { private final AgentService agentService; - + private final AgentTemplateService agentTemplateService; + private final DeviceService deviceService; + private final AgentChatHistoryService agentChatHistoryService; + private final AgentChatAudioService agentChatAudioService; + private final RedisUtils redisUtils; + @GetMapping("/list") @Operation(summary = "获取用户智能体列表") @RequiresPermissions("sys:role:normal") - public Result> getUserAgents() { + public Result> getUserAgents() { UserDetail user = SecurityUser.getUser(); - List agents = agentService.getUserAgents(user.getId()); - return new Result>().ok(agents); + List agents = agentService.getUserAgents(user.getId()); + return new Result>().ok(agents); } - + @GetMapping("/all") @Operation(summary = "智能体列表(管理员)") @RequiresPermissions("sys:role:superAdmin") @@ -51,7 +82,7 @@ public class AgentController { PageData page = agentService.adminAgentList(params); return new Result>().ok(page); } - + @GetMapping("/{id}") @Operation(summary = "获取智能体详情") @RequiresPermissions("sys:role:normal") @@ -59,35 +90,51 @@ public class AgentController { AgentEntity agent = agentService.getAgentById(id); return new Result().ok(agent); } - + @PostMapping @Operation(summary = "创建智能体") @RequiresPermissions("sys:role:normal") - public Result save(@RequestBody @Valid AgentCreateDTO dto) { + public Result save(@RequestBody @Valid AgentCreateDTO dto) { AgentEntity entity = ConvertUtils.sourceToTarget(dto, AgentEntity.class); - + + // 获取默认模板 + AgentTemplateEntity template = agentTemplateService.getDefaultTemplate(); + if (template != null) { + // 设置模板中的默认值 + entity.setAsrModelId(template.getAsrModelId()); + entity.setVadModelId(template.getVadModelId()); + entity.setLlmModelId(template.getLlmModelId()); + entity.setTtsModelId(template.getTtsModelId()); + entity.setTtsVoiceId(template.getTtsVoiceId()); + entity.setMemModelId(template.getMemModelId()); + entity.setIntentModelId(template.getIntentModelId()); + entity.setSystemPrompt(template.getSystemPrompt()); + entity.setLangCode(template.getLangCode()); + entity.setLanguage(template.getLanguage()); + } + // 设置用户ID和创建者信息 UserDetail user = SecurityUser.getUser(); entity.setUserId(user.getId()); entity.setCreator(user.getId()); entity.setCreatedAt(new Date()); - + // ID、智能体编码和排序会在Service层自动生成 agentService.insert(entity); - - return new Result<>(); + + return new Result().ok(entity.getId()); } - - @PutMapping + + @PutMapping("/{id}") @Operation(summary = "更新智能体") @RequiresPermissions("sys:role:normal") - public Result update(@RequestBody @Valid AgentUpdateDTO dto) { + public Result update(@PathVariable String id, @RequestBody @Valid AgentUpdateDTO dto) { // 先查询现有实体 - AgentEntity existingEntity = agentService.getAgentById(dto.getId()); + AgentEntity existingEntity = agentService.getAgentById(id); if (existingEntity == null) { return new Result().error("智能体不存在"); } - + // 只更新提供的非空字段 if (dto.getAgentName() != null) { existingEntity.setAgentName(dto.getAgentName()); @@ -128,22 +175,104 @@ public class AgentController { if (dto.getSort() != null) { existingEntity.setSort(dto.getSort()); } - + // 设置更新者信息 UserDetail user = SecurityUser.getUser(); existingEntity.setUpdater(user.getId()); existingEntity.setUpdatedAt(new Date()); - + agentService.updateById(existingEntity); - + return new Result<>(); } - + @DeleteMapping("/{id}") @Operation(summary = "删除智能体") @RequiresPermissions("sys:role:normal") public Result delete(@PathVariable String id) { + // 先删除关联的设备 + deviceService.deleteByAgentId(id); + // 删除关联的聊天记录 + agentChatHistoryService.deleteByAgentId(id); + // 再删除智能体 agentService.deleteById(id); return new Result<>(); } -} \ No newline at end of file + + @GetMapping("/template") + @Operation(summary = "智能体模板模板列表") + @RequiresPermissions("sys:role:normal") + public Result> templateList() { + List list = agentTemplateService + .list(new QueryWrapper().orderByAsc("sort")); + return new Result>().ok(list); + } + + @GetMapping("/{id}/sessions") + @Operation(summary = "获取智能体会话列表") + @RequiresPermissions("sys:role:normal") + @Parameters({ + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true), + }) + public Result> getAgentSessions( + @PathVariable("id") String id, + @Parameter(hidden = true) @RequestParam Map params) { + params.put("agentId", id); + PageData page = agentChatHistoryService.getSessionListByAgentId(params); + return new Result>().ok(page); + } + + @GetMapping("/{id}/chat-history/{sessionId}") + @Operation(summary = "获取智能体聊天记录") + @RequiresPermissions("sys:role:normal") + public Result> getAgentChatHistory( + @PathVariable("id") String id, + @PathVariable("sessionId") String sessionId) { + // 获取当前用户 + UserDetail user = SecurityUser.getUser(); + + // 检查权限 + if (!agentService.checkAgentPermission(id, user.getId())) { + return new Result>().error("没有权限查看该智能体的聊天记录"); + } + + // 查询聊天记录 + List result = agentChatHistoryService.getChatHistoryBySessionId(id, sessionId); + return new Result>().ok(result); + } + + @PostMapping("/audio/{audioId}") + @Operation(summary = "获取音频下载ID") + @RequiresPermissions("sys:role:normal") + public Result getAudioId(@PathVariable("audioId") String audioId) { + byte[] audioData = agentChatAudioService.getAudio(audioId); + if (audioData == null) { + return new Result().error("音频不存在"); + } + String uuid = UUID.randomUUID().toString(); + redisUtils.set(RedisKeys.getAgentAudioIdKey(uuid), audioId); + return new Result().ok(uuid); + } + + @GetMapping("/play/{uuid}") + @Operation(summary = "播放音频") + public ResponseEntity playAudio(@PathVariable("uuid") String uuid) { + + String audioId = (String) redisUtils.get(RedisKeys.getAgentAudioIdKey(uuid)); + if (StringUtils.isBlank(audioId)) { + return ResponseEntity.notFound().build(); + } + + byte[] audioData = agentChatAudioService.getAudio(audioId); + if (audioData == null) { + return ResponseEntity.notFound().build(); + } + redisUtils.delete(RedisKeys.getAgentAudioIdKey(uuid)); + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"play.wav\"") + .body(audioData); + } + +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentDao.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentDao.java index 169346bfd..3b4be4526 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentDao.java @@ -1,10 +1,31 @@ package xiaozhi.modules.agent.dao; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import org.apache.ibatis.annotations.Select; import xiaozhi.common.dao.BaseDao; import xiaozhi.modules.agent.entity.AgentEntity; @Mapper public interface AgentDao extends BaseDao { - -} \ No newline at end of file + /** + * 获取智能体的设备数量 + * + * @param agentId 智能体ID + * @return 设备数量 + */ + Integer getDeviceCountByAgentId(@Param("agentId") String agentId); + + /** + * 根据设备MAC地址查询对应设备的默认智能体信息 + * + * @param macAddress 设备MAC地址 + * @return 默认智能体信息 + */ + @Select(" SELECT a.* FROM ai_device d " + + " LEFT JOIN ai_agent a ON d.agent_id = a.id " + + " WHERE d.mac_address = #{macAddress} " + + " ORDER BY d.id DESC LIMIT 1") + AgentEntity getDefaultAgentByMacAddress(@Param("macAddress") String macAddress); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentTemplateDao.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentTemplateDao.java new file mode 100644 index 000000000..48d95bef0 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AgentTemplateDao.java @@ -0,0 +1,17 @@ +package xiaozhi.modules.agent.dao; + +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import xiaozhi.modules.agent.entity.AgentTemplateEntity; + +/** + * @author chenerlei + * @description 针对表【ai_agent_template(智能体配置模板表)】的数据库操作Mapper + * @createDate 2025-03-22 11:48:18 + */ +@Mapper +public interface AgentTemplateDao extends BaseMapper { + +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatAudioDao.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatAudioDao.java new file mode 100644 index 000000000..355b25acf --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatAudioDao.java @@ -0,0 +1,18 @@ +package xiaozhi.modules.agent.dao; + +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import xiaozhi.modules.agent.entity.AgentChatAudioEntity; + +/** + * {@link AgentChatAudioEntity} 智能体聊天音频数据Dao对象 + * + * @author Goody + * @version 1.0, 2025/5/8 + * @since 1.0.0 + */ +@Mapper +public interface AiAgentChatAudioDao extends BaseMapper { +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatHistoryDao.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatHistoryDao.java new file mode 100644 index 000000000..43a5f1cea --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dao/AiAgentChatHistoryDao.java @@ -0,0 +1,31 @@ +package xiaozhi.modules.agent.dao; + +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import xiaozhi.modules.agent.entity.AgentChatHistoryEntity; + +/** + * {@link AgentChatHistoryEntity} 智能体聊天历史记录Dao对象 + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +@Mapper +public interface AiAgentChatHistoryDao extends BaseMapper { + /** + * 根据智能体ID删除音频 + * + * @param agentId 智能体ID + */ + void deleteAudioByAgentId(String agentId); + + /** + * 根据智能体ID删除聊天历史记录 + * + * @param agentId 智能体ID + */ + void deleteHistoryByAgentId(String agentId); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryDTO.java new file mode 100644 index 000000000..fd49e52b4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryDTO.java @@ -0,0 +1,28 @@ +package xiaozhi.modules.agent.dto; + +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 智能体聊天记录DTO + */ +@Data +@Schema(description = "智能体聊天记录") +public class AgentChatHistoryDTO { + @Schema(description = "创建时间") + private Date createdAt; + + @Schema(description = "消息类型: 1-用户, 2-智能体") + private Byte chatType; + + @Schema(description = "聊天内容") + private String content; + + @Schema(description = "音频ID") + private String audioId; + + @Schema(description = "MAC地址") + private String macAddress; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryReportDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryReportDTO.java new file mode 100644 index 000000000..bdaed9509 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatHistoryReportDTO.java @@ -0,0 +1,31 @@ +package xiaozhi.modules.agent.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * 小智设备聊天上报请求 + * + * @author Haotian + * @version 1.0, 2025/5/8 + */ +@Data +@Schema(description = "小智设备聊天上报请求") +public class AgentChatHistoryReportDTO { + @Schema(description = "MAC地址", example = "00:11:22:33:44:55") + @NotBlank + private String macAddress; + @Schema(description = "会话ID", example = "79578c31-f1fb-426a-900e-1e934215f05a") + @NotBlank + private String sessionId; + @Schema(description = "消息类型: 1-用户, 2-智能体", example = "1") + @NotNull + private Byte chatType; + @Schema(description = "聊天内容", example = "你好呀") + @NotBlank + private String content; + @Schema(description = "base64编码的opus音频数据", example = "") + private String audioBase64; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatSessionDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatSessionDTO.java new file mode 100644 index 000000000..c65f05c66 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentChatSessionDTO.java @@ -0,0 +1,26 @@ +package xiaozhi.modules.agent.dto; + +import java.time.LocalDateTime; + +import lombok.Data; + +/** + * 智能体会话列表DTO + */ +@Data +public class AgentChatSessionDTO { + /** + * 会话ID + */ + private String sessionId; + + /** + * 会话时间 + */ + private LocalDateTime createdAt; + + /** + * 聊天条数 + */ + private Integer chatCount; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentCreateDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentCreateDTO.java index 302a55fb7..59e770075 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentCreateDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentCreateDTO.java @@ -1,11 +1,11 @@ package xiaozhi.modules.agent.dto; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import java.io.Serializable; - /** * 智能体创建DTO * 专用于新增智能体,不包含id、agentCode和sort字段,这些字段由系统自动生成/设置默认值 @@ -14,38 +14,8 @@ import java.io.Serializable; @Schema(description = "智能体创建对象") public class AgentCreateDTO implements Serializable { private static final long serialVersionUID = 1L; - + @Schema(description = "智能体名称", example = "客服助手") @NotBlank(message = "智能体名称不能为空") private String agentName; - - @Schema(description = "语音识别模型标识", example = "asr_model_01") - private String asrModelId; - - @Schema(description = "语音活动检测标识", example = "vad_model_01") - private String vadModelId; - - @Schema(description = "大语言模型标识", example = "llm_model_01") - private String llmModelId; - - @Schema(description = "语音合成模型标识", example = "tts_model_01") - private String ttsModelId; - - @Schema(description = "音色标识", example = "voice_01") - private String ttsVoiceId; - - @Schema(description = "记忆模型标识", example = "mem_model_01") - private String memModelId; - - @Schema(description = "意图模型标识", example = "intent_model_01") - private String intentModelId; - - @Schema(description = "角色设定参数", example = "你是一个专业的客服助手,负责回答用户问题") - private String systemPrompt; - - @Schema(description = "语言编码", example = "zh_CN") - private String langCode; - - @Schema(description = "交互语种", example = "中文") - private String language; -} \ No newline at end of file +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentDTO.java new file mode 100644 index 000000000..a63c96e7d --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentDTO.java @@ -0,0 +1,38 @@ +package xiaozhi.modules.agent.dto; + +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 智能体数据传输对象 + * 用于在服务层和控制器层之间传递智能体相关的数据 + */ +@Data +@Schema(description = "智能体对象") +public class AgentDTO { + @Schema(description = "智能体编码", example = "AGT_1234567890") + private String id; + + @Schema(description = "智能体名称", example = "客服助手") + private String agentName; + + @Schema(description = "语音合成模型名称", example = "tts_model_01") + private String ttsModelName; + + @Schema(description = "音色名称", example = "voice_01") + private String ttsVoiceName; + + @Schema(description = "大语言模型名称", example = "llm_model_01") + private String llmModelName; + + @Schema(description = "角色设定参数", example = "你是一个专业的客服助手,负责回答用户问题并提供帮助") + private String systemPrompt; + + @Schema(description = "最后连接时间", example = "2024-03-20 10:00:00") + private Date lastConnectedAt; + + @Schema(description = "设备数量", example = "10") + private Integer deviceCount; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentUpdateDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentUpdateDTO.java index 6445bddae..d54685d8d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentUpdateDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/dto/AgentUpdateDTO.java @@ -1,11 +1,10 @@ package xiaozhi.modules.agent.dto; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import lombok.Data; - import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + /** * 智能体更新DTO * 专用于更新智能体,id字段是必需的,用于标识要更新的智能体 @@ -16,46 +15,42 @@ import java.io.Serializable; public class AgentUpdateDTO implements Serializable { private static final long serialVersionUID = 1L; - @Schema(description = "智能体唯一标识", example = "a1b2c3d4e5f6", required = true) - @NotBlank(message = "智能体ID不能为空") - private String id; - @Schema(description = "智能体编码", example = "AGT_1234567890", required = false) private String agentCode; - + @Schema(description = "智能体名称", example = "客服助手", required = false) private String agentName; - + @Schema(description = "语音识别模型标识", example = "asr_model_02", required = false) private String asrModelId; - + @Schema(description = "语音活动检测标识", example = "vad_model_02", required = false) private String vadModelId; - + @Schema(description = "大语言模型标识", example = "llm_model_02", required = false) private String llmModelId; - + @Schema(description = "语音合成模型标识", example = "tts_model_02", required = false) private String ttsModelId; - + @Schema(description = "音色标识", example = "voice_02", required = false) private String ttsVoiceId; - + @Schema(description = "记忆模型标识", example = "mem_model_02", required = false) private String memModelId; - + @Schema(description = "意图模型标识", example = "intent_model_02", required = false) private String intentModelId; - + @Schema(description = "角色设定参数", example = "你是一个专业的客服助手,负责回答用户问题并提供帮助", required = false) private String systemPrompt; - + @Schema(description = "语言编码", example = "zh_CN", required = false) private String langCode; - + @Schema(description = "交互语种", example = "中文", required = false) private String language; - + @Schema(description = "排序", example = "1", required = false) private Integer sort; -} \ No newline at end of file +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatAudioEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatAudioEntity.java new file mode 100644 index 000000000..ac30d9d49 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatAudioEntity.java @@ -0,0 +1,29 @@ +package xiaozhi.modules.agent.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import lombok.Data; + +/** + * 智能体聊天音频数据表 + * + * @author Goody + * @version 1.0, 2025/5/8 + * @since 1.0.0 + */ +@Data +@TableName("ai_agent_chat_audio") +public class AgentChatAudioEntity { + /** + * 主键ID + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + + /** + * 音频opus数据 + */ + private byte[] audio; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatHistoryEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatHistoryEntity.java new file mode 100644 index 000000000..679c814ab --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentChatHistoryEntity.java @@ -0,0 +1,81 @@ +package xiaozhi.modules.agent.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 智能体聊天记录表 + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "ai_agent_chat_history") +public class AgentChatHistoryEntity { + /** + * 主键ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * MAC地址 + */ + @TableField(value = "mac_address") + private String macAddress; + + /** + * 智能体id + */ + @TableField(value = "agent_id") + private String agentId; + + /** + * 会话ID + */ + @TableField(value = "session_id") + private String sessionId; + + /** + * 消息类型: 1-用户, 2-智能体 + */ + @TableField(value = "chat_type") + private Byte chatType; + + /** + * 聊天内容 + */ + @TableField(value = "content") + private String content; + + /** + * 音频base64数据 + */ + @TableField(value = "audio_id") + private String audioId; + + /** + * 创建时间 + */ + @TableField(value = "created_at") + private Date createdAt; + + /** + * 更新时间 + */ + @TableField(value = "updated_at") + private Date updatedAt; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentEntity.java index 6800aefb0..917fe6d28 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentEntity.java @@ -1,69 +1,74 @@ package xiaozhi.modules.agent.entity; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.util.Date; - @Data @TableName("ai_agent") @Schema(description = "智能体信息") public class AgentEntity { + + @TableId(type = IdType.ASSIGN_UUID) @Schema(description = "智能体唯一标识") private String id; - + @Schema(description = "所属用户ID") private Long userId; - + @Schema(description = "智能体编码") private String agentCode; - + @Schema(description = "智能体名称") private String agentName; - + @Schema(description = "语音识别模型标识") private String asrModelId; - + @Schema(description = "语音活动检测标识") private String vadModelId; - + @Schema(description = "大语言模型标识") private String llmModelId; - + @Schema(description = "语音合成模型标识") private String ttsModelId; - + @Schema(description = "音色标识") private String ttsVoiceId; - + @Schema(description = "记忆模型标识") private String memModelId; - + @Schema(description = "意图模型标识") private String intentModelId; - + @Schema(description = "角色设定参数") private String systemPrompt; - + @Schema(description = "语言编码") private String langCode; - + @Schema(description = "交互语种") private String language; - + @Schema(description = "排序") private Integer sort; - + @Schema(description = "创建者") private Long creator; - + @Schema(description = "创建时间") private Date createdAt; - + @Schema(description = "更新者") private Long updater; - + @Schema(description = "更新时间") private Date updatedAt; -} \ No newline at end of file +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentTemplateEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentTemplateEntity.java new file mode 100644 index 000000000..6d83e4fed --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/entity/AgentTemplateEntity.java @@ -0,0 +1,114 @@ +package xiaozhi.modules.agent.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import lombok.Data; + +/** + * 智能体配置模板表 + * + * @TableName ai_agent_template + */ +@TableName(value = "ai_agent_template") +@Data +public class AgentTemplateEntity implements Serializable { + /** + * 智能体唯一标识 + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + + /** + * 智能体编码 + */ + private String agentCode; + + /** + * 智能体名称 + */ + private String agentName; + + /** + * 语音识别模型标识 + */ + private String asrModelId; + + /** + * 语音活动检测标识 + */ + private String vadModelId; + + /** + * 大语言模型标识 + */ + private String llmModelId; + + /** + * 语音合成模型标识 + */ + private String ttsModelId; + + /** + * 音色标识 + */ + private String ttsVoiceId; + + /** + * 记忆模型标识 + */ + private String memModelId; + + /** + * 意图模型标识 + */ + private String intentModelId; + + /** + * 角色设定参数 + */ + private String systemPrompt; + + /** + * 语言编码 + */ + private String langCode; + + /** + * 交互语种 + */ + private String language; + + /** + * 排序权重 + */ + private Integer sort; + + /** + * 创建者 ID + */ + private Long creator; + + /** + * 创建时间 + */ + private Date createdAt; + + /** + * 更新者 ID + */ + private Long updater; + + /** + * 更新时间 + */ + private Date updatedAt; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatAudioService.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatAudioService.java new file mode 100644 index 000000000..e284b69f0 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatAudioService.java @@ -0,0 +1,30 @@ +package xiaozhi.modules.agent.service; + +import com.baomidou.mybatisplus.extension.service.IService; + +import xiaozhi.modules.agent.entity.AgentChatAudioEntity; + +/** + * 智能体聊天音频数据表处理service + * + * @author Goody + * @version 1.0, 2025/5/8 + * @since 1.0.0 + */ +public interface AgentChatAudioService extends IService { + /** + * 保存音频数据 + * + * @param audioData 音频数据 + * @return 音频ID + */ + String saveAudio(byte[] audioData); + + /** + * 获取音频数据 + * + * @param audioId 音频ID + * @return 音频数据 + */ + byte[] getAudio(String audioId); +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatHistoryService.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatHistoryService.java new file mode 100644 index 000000000..889f64cd8 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentChatHistoryService.java @@ -0,0 +1,45 @@ +package xiaozhi.modules.agent.service; + +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.extension.service.IService; + +import xiaozhi.common.page.PageData; +import xiaozhi.modules.agent.dto.AgentChatHistoryDTO; +import xiaozhi.modules.agent.dto.AgentChatSessionDTO; +import xiaozhi.modules.agent.entity.AgentChatHistoryEntity; + +/** + * 智能体聊天记录表处理service + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +public interface AgentChatHistoryService extends IService { + + /** + * 根据智能体ID获取会话列表 + * + * @param params 查询参数,包含agentId、page、limit + * @return 分页的会话列表 + */ + PageData getSessionListByAgentId(Map params); + + /** + * 根据会话ID获取聊天记录列表 + * + * @param agentId 智能体ID + * @param sessionId 会话ID + * @return 聊天记录列表 + */ + List getChatHistoryBySessionId(String agentId, String sessionId); + + /** + * 根据智能体ID删除聊天记录 + * + * @param agentId 智能体ID + */ + void deleteByAgentId(String agentId); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentService.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentService.java index 76439edea..2104d3536 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentService.java @@ -1,25 +1,82 @@ package xiaozhi.modules.agent.service; -import xiaozhi.common.page.PageData; -import xiaozhi.common.service.BaseService; -import xiaozhi.modules.agent.entity.AgentEntity; - import java.util.List; import java.util.Map; +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.BaseService; +import xiaozhi.modules.agent.dto.AgentDTO; +import xiaozhi.modules.agent.entity.AgentEntity; + +/** + * 智能体表处理service + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ public interface AgentService extends BaseService { /** - * 根据用户ID获取智能体列表 - */ - List getUserAgents(Long userId); - - /** - * 管理员获取所有智能体列表(分页) + * 获取管理员智能体列表 + * + * @param params 查询参数 + * @return 分页数据 */ PageData adminAgentList(Map params); - + /** - * 获取智能体详情 + * 根据ID获取智能体 + * + * @param id 智能体ID + * @return 智能体实体 */ AgentEntity getAgentById(String id); -} \ No newline at end of file + + /** + * 插入智能体 + * + * @param entity 智能体实体 + * @return 是否成功 + */ + boolean insert(AgentEntity entity); + + /** + * 根据用户ID删除智能体 + * + * @param userId 用户ID + */ + void deleteAgentByUserId(Long userId); + + /** + * 获取用户智能体列表 + * + * @param userId 用户ID + * @return 智能体列表 + */ + List getUserAgents(Long userId); + + /** + * 根据智能体ID获取设备数量 + * + * @param agentId 智能体ID + * @return 设备数量 + */ + Integer getDeviceCountByAgentId(String agentId); + + /** + * 根据设备MAC地址查询对应设备的默认智能体信息 + * + * @param macAddress 设备MAC地址 + * @return 默认智能体信息,不存在时返回null + */ + AgentEntity getDefaultAgentByMacAddress(String macAddress); + + /** + * 检查用户是否有权限访问智能体 + * + * @param agentId 智能体ID + * @param userId 用户ID + * @return 是否有权限 + */ + boolean checkAgentPermission(String agentId, Long userId); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentTemplateService.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentTemplateService.java new file mode 100644 index 000000000..4e279c405 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/AgentTemplateService.java @@ -0,0 +1,28 @@ +package xiaozhi.modules.agent.service; + +import com.baomidou.mybatisplus.extension.service.IService; + +import xiaozhi.modules.agent.entity.AgentTemplateEntity; + +/** + * @author chenerlei + * @description 针对表【ai_agent_template(智能体配置模板表)】的数据库操作Service + * @createDate 2025-03-22 11:48:18 + */ +public interface AgentTemplateService extends IService { + + /** + * 获取默认模板 + * + * @return 默认模板实体 + */ + AgentTemplateEntity getDefaultTemplate(); + + /** + * 更新默认模板中的模型ID + * + * @param modelType 模型类型 + * @param modelId 模型ID + */ + void updateDefaultTemplateModelId(String modelType, String modelId); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/AgentChatHistoryBizService.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/AgentChatHistoryBizService.java new file mode 100644 index 000000000..191b231b4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/AgentChatHistoryBizService.java @@ -0,0 +1,22 @@ +package xiaozhi.modules.agent.service.biz; + +import xiaozhi.modules.agent.dto.AgentChatHistoryReportDTO; + +/** + * 智能体聊天历史业务逻辑层 + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +public interface AgentChatHistoryBizService { + + /** + * 聊天上报方法 + * + * @param agentChatHistoryReportDTO 包含聊天上报所需信息的输入对象 + * 例如:设备MAC地址、文件类型、内容等 + * @return 上传结果,true表示成功,false表示失败 + */ + Boolean report(AgentChatHistoryReportDTO agentChatHistoryReportDTO); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/impl/AgentChatHistoryBizServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/impl/AgentChatHistoryBizServiceImpl.java new file mode 100644 index 000000000..21e645ded --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/biz/impl/AgentChatHistoryBizServiceImpl.java @@ -0,0 +1,88 @@ +package xiaozhi.modules.agent.service.biz.impl; + +import java.util.Base64; +import java.util.Date; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.modules.agent.dto.AgentChatHistoryReportDTO; +import xiaozhi.modules.agent.entity.AgentChatHistoryEntity; +import xiaozhi.modules.agent.entity.AgentEntity; +import xiaozhi.modules.agent.service.AgentChatAudioService; +import xiaozhi.modules.agent.service.AgentChatHistoryService; +import xiaozhi.modules.agent.service.AgentService; +import xiaozhi.modules.agent.service.biz.AgentChatHistoryBizService; + +/** + * {@link AgentChatHistoryBizService} impl + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizService { + private final AgentService agentService; + private final AgentChatHistoryService agentChatHistoryService; + private final AgentChatAudioService agentChatAudioService; + private final RedisUtils redisUtils; + + /** + * 处理聊天记录上报,包括文件上传和相关信息记录 + * + * @param report 包含聊天上报所需信息的输入对象 + * @return 上传结果,true表示成功,false表示失败 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean report(AgentChatHistoryReportDTO report) { + String macAddress = report.getMacAddress(); + Byte chatType = report.getChatType(); + log.info("小智设备聊天上报请求: macAddress={}, type={}", macAddress, chatType); + + // 1. base64解码report.getOpusDataBase64(),存入ai_agent_chat_audio表 + String audioId = null; + if (report.getAudioBase64() != null && !report.getAudioBase64().isEmpty()) { + try { + byte[] audioData = Base64.getDecoder().decode(report.getAudioBase64()); + audioId = agentChatAudioService.saveAudio(audioData); + log.info("音频数据保存成功,audioId={}", audioId); + } catch (Exception e) { + log.error("音频数据保存失败", e); + return false; + } + } + + // 2. 组装上报数据 + // 2.1 根据设备MAC地址查询对应的默认智能体,判断是否需要上报 + AgentEntity agentEntity = agentService.getDefaultAgentByMacAddress(macAddress); + if (agentEntity == null) { + return false; + } + String agentId = agentEntity.getId(); + log.info("设备 {} 对应智能体 {} 上报", macAddress, agentEntity.getId()); + + // 2.2 构建聊天记录实体 + AgentChatHistoryEntity entity = AgentChatHistoryEntity.builder() + .macAddress(macAddress) + .agentId(agentId) + .sessionId(report.getSessionId()) + .chatType(report.getChatType()) + .content(report.getContent()) + .audioId(audioId) + .build(); + + // 3. 保存数据 + agentChatHistoryService.save(entity); + // 4. 更新设备最后对话时间 + redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date()); + return Boolean.TRUE; + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatAudioServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatAudioServiceImpl.java new file mode 100644 index 000000000..cf8046781 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatAudioServiceImpl.java @@ -0,0 +1,34 @@ +package xiaozhi.modules.agent.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import xiaozhi.modules.agent.dao.AiAgentChatAudioDao; +import xiaozhi.modules.agent.entity.AgentChatAudioEntity; +import xiaozhi.modules.agent.service.AgentChatAudioService; + +/** + * 智能体聊天音频数据表处理service {@link AgentChatAudioService} impl + * + * @author Goody + * @version 1.0, 2025/5/8 + * @since 1.0.0 + */ +@Service +public class AgentChatAudioServiceImpl extends ServiceImpl + implements AgentChatAudioService { + @Override + public String saveAudio(byte[] audioData) { + AgentChatAudioEntity entity = new AgentChatAudioEntity(); + entity.setAudio(audioData); + save(entity); + return entity.getId(); + } + + @Override + public byte[] getAudio(String audioId) { + AgentChatAudioEntity entity = getById(audioId); + return entity != null ? entity.getAudio() : null; + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatHistoryServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatHistoryServiceImpl.java new file mode 100644 index 000000000..cc7236ae4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentChatHistoryServiceImpl.java @@ -0,0 +1,85 @@ +package xiaozhi.modules.agent.service.impl; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import xiaozhi.common.constant.Constant; +import xiaozhi.common.page.PageData; +import xiaozhi.common.utils.ConvertUtils; +import xiaozhi.modules.agent.dao.AiAgentChatHistoryDao; +import xiaozhi.modules.agent.dto.AgentChatHistoryDTO; +import xiaozhi.modules.agent.dto.AgentChatSessionDTO; +import xiaozhi.modules.agent.entity.AgentChatHistoryEntity; +import xiaozhi.modules.agent.service.AgentChatHistoryService; + +/** + * 智能体聊天记录表处理service {@link AgentChatHistoryService} impl + * + * @author Goody + * @version 1.0, 2025/4/30 + * @since 1.0.0 + */ +@Service +public class AgentChatHistoryServiceImpl extends ServiceImpl + implements AgentChatHistoryService { + + @Override + public PageData getSessionListByAgentId(Map params) { + String agentId = (String) params.get("agentId"); + int page = Integer.parseInt(params.get(Constant.PAGE).toString()); + int limit = Integer.parseInt(params.get(Constant.LIMIT).toString()); + + // 构建查询条件 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("session_id", "MAX(created_at) as created_at", "COUNT(*) as chat_count") + .eq("agent_id", agentId) + .groupBy("session_id") + .orderByDesc("created_at"); + + // 执行分页查询 + Page> pageParam = new Page<>(page, limit); + IPage> result = this.baseMapper.selectMapsPage(pageParam, wrapper); + + List records = result.getRecords().stream().map(map -> { + AgentChatSessionDTO dto = new AgentChatSessionDTO(); + dto.setSessionId((String) map.get("session_id")); + dto.setCreatedAt((LocalDateTime) map.get("created_at")); + dto.setChatCount(((Number) map.get("chat_count")).intValue()); + return dto; + }).collect(Collectors.toList()); + + return new PageData<>(records, result.getTotal()); + } + + @Override + public List getChatHistoryBySessionId(String agentId, String sessionId) { + // 构建查询条件 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("agent_id", agentId) + .eq("session_id", sessionId) + .orderByAsc("created_at"); + + // 查询聊天记录 + List historyList = list(wrapper); + + // 转换为DTO + return ConvertUtils.sourceToTarget(historyList, AgentChatHistoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByAgentId(String agentId) { + baseMapper.deleteAudioByAgentId(agentId); + baseMapper.deleteHistoryByAgentId(agentId); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java index b41310ab9..ae650c855 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java @@ -1,64 +1,155 @@ -package xiaozhi.modules.agent.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.stereotype.Service; -import xiaozhi.common.page.PageData; -import xiaozhi.common.service.impl.BaseServiceImpl; -import xiaozhi.modules.agent.dao.AgentDao; -import xiaozhi.modules.agent.entity.AgentEntity; -import xiaozhi.modules.agent.service.AgentService; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - -@Service -public class AgentServiceImpl extends BaseServiceImpl implements AgentService { - private final AgentDao agentDao; - - public AgentServiceImpl(AgentDao agentDao) { - this.agentDao = agentDao; - } - - @Override - public List getUserAgents(Long userId) { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("user_id", userId); - return agentDao.selectList(wrapper); - } - - @Override - public PageData adminAgentList(Map params) { - IPage page = agentDao.selectPage( - getPage(params, "sort", true), - new QueryWrapper<>() - ); - return new PageData<>(page.getRecords(), page.getTotal()); - } - - @Override - public AgentEntity getAgentById(String id) { - return agentDao.selectById(id); - } - - @Override - public boolean insert(AgentEntity entity) { - // 如果ID为空,自动生成一个UUID作为ID - if (entity.getId() == null || entity.getId().trim().isEmpty()) { - entity.setId(UUID.randomUUID().toString().replace("-", "")); - } - - // 如果智能体编码为空,自动生成一个带前缀的编码 - if (entity.getAgentCode() == null || entity.getAgentCode().trim().isEmpty()) { - entity.setAgentCode("AGT_" + System.currentTimeMillis()); - } - - // 如果排序字段为空,设置默认值0 - if (entity.getSort() == null) { - entity.setSort(0); - } - - return super.insert(entity); - } -} \ No newline at end of file +package xiaozhi.modules.agent.service.impl; + +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import lombok.AllArgsConstructor; +import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.common.service.impl.BaseServiceImpl; +import xiaozhi.modules.agent.dao.AgentDao; +import xiaozhi.modules.agent.dto.AgentDTO; +import xiaozhi.modules.agent.entity.AgentEntity; +import xiaozhi.modules.agent.service.AgentService; +import xiaozhi.modules.device.service.DeviceService; +import xiaozhi.modules.model.service.ModelConfigService; +import xiaozhi.modules.security.user.SecurityUser; +import xiaozhi.modules.sys.enums.SuperAdminEnum; +import xiaozhi.modules.timbre.service.TimbreService; + +@Service +@AllArgsConstructor +public class AgentServiceImpl extends BaseServiceImpl implements AgentService { + private final AgentDao agentDao; + private final TimbreService timbreModelService; + private final ModelConfigService modelConfigService; + private final RedisUtils redisUtils; + private final DeviceService deviceService; + + @Override + public PageData adminAgentList(Map params) { + IPage page = agentDao.selectPage( + getPage(params, "agent_name", true), + new QueryWrapper<>()); + return new PageData<>(page.getRecords(), page.getTotal()); + } + + @Override + public AgentEntity getAgentById(String id) { + return agentDao.selectById(id); + } + + @Override + public boolean insert(AgentEntity entity) { + // 如果ID为空,自动生成一个UUID作为ID + if (entity.getId() == null || entity.getId().trim().isEmpty()) { + entity.setId(UUID.randomUUID().toString().replace("-", "")); + } + + // 如果智能体编码为空,自动生成一个带前缀的编码 + if (entity.getAgentCode() == null || entity.getAgentCode().trim().isEmpty()) { + entity.setAgentCode("AGT_" + System.currentTimeMillis()); + } + + // 如果排序字段为空,设置默认值0 + if (entity.getSort() == null) { + entity.setSort(0); + } + + return super.insert(entity); + } + + @Override + public void deleteAgentByUserId(Long userId) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("user_id", userId); + baseDao.delete(wrapper); + } + + @Override + public List getUserAgents(Long userId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("user_id", userId); + List agents = agentDao.selectList(wrapper); + return agents.stream().map(agent -> { + AgentDTO dto = new AgentDTO(); + dto.setId(agent.getId()); + dto.setAgentName(agent.getAgentName()); + dto.setSystemPrompt(agent.getSystemPrompt()); + + // 获取 TTS 模型名称 + dto.setTtsModelName(modelConfigService.getModelNameById(agent.getTtsModelId())); + + // 获取 LLM 模型名称 + dto.setLlmModelName(modelConfigService.getModelNameById(agent.getLlmModelId())); + + // 获取 TTS 音色名称 + dto.setTtsVoiceName(timbreModelService.getTimbreNameById(agent.getTtsVoiceId())); + + // 获取智能体最近的最后连接时长 + dto.setLastConnectedAt(deviceService.getLatestLastConnectionTime(agent.getId())); + + // 获取设备数量 + dto.setDeviceCount(getDeviceCountByAgentId(agent.getId())); + return dto; + }).collect(Collectors.toList()); + } + + @Override + public Integer getDeviceCountByAgentId(String agentId) { + if (StringUtils.isBlank(agentId)) { + return 0; + } + + // 先从Redis中获取 + Integer cachedCount = (Integer) redisUtils.get(RedisKeys.getAgentDeviceCountById(agentId)); + if (cachedCount != null) { + return cachedCount; + } + + // 如果Redis中没有,则从数据库查询 + Integer deviceCount = agentDao.getDeviceCountByAgentId(agentId); + + // 将结果存入Redis + if (deviceCount != null) { + redisUtils.set(RedisKeys.getAgentDeviceCountById(agentId), deviceCount, 60); + } + + return deviceCount != null ? deviceCount : 0; + } + + @Override + public AgentEntity getDefaultAgentByMacAddress(String macAddress) { + if (StringUtils.isEmpty(macAddress)) { + return null; + } + return agentDao.getDefaultAgentByMacAddress(macAddress); + } + + @Override + public boolean checkAgentPermission(String agentId, Long userId) { + // 获取智能体信息 + AgentEntity agent = getAgentById(agentId); + if (agent == null) { + return false; + } + + // 如果是超级管理员,直接返回true + if (SecurityUser.getUser().getSuperAdmin() == SuperAdminEnum.YES.value()) { + return true; + } + + // 检查是否是智能体的所有者 + return userId.equals(agent.getUserId()); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java new file mode 100644 index 000000000..9ac3de252 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java @@ -0,0 +1,69 @@ +package xiaozhi.modules.agent.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import xiaozhi.modules.agent.dao.AgentTemplateDao; +import xiaozhi.modules.agent.entity.AgentTemplateEntity; +import xiaozhi.modules.agent.service.AgentTemplateService; + +/** + * @author chenerlei + * @description 针对表【ai_agent_template(智能体配置模板表)】的数据库操作Service实现 + * @createDate 2025-03-22 11:48:18 + */ +@Service +public class AgentTemplateServiceImpl extends ServiceImpl + implements AgentTemplateService { + + /** + * 获取默认模板 + * + * @return 默认模板实体 + */ + public AgentTemplateEntity getDefaultTemplate() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.orderByAsc(AgentTemplateEntity::getSort) + .last("LIMIT 1"); + return this.getOne(wrapper); + } + + /** + * 更新默认模板中的模型ID + * + * @param modelType 模型类型 + * @param modelId 模型ID + */ + @Override + public void updateDefaultTemplateModelId(String modelType, String modelId) { + modelType = modelType.toUpperCase(); + + UpdateWrapper wrapper = new UpdateWrapper<>(); + switch (modelType) { + case "ASR": + wrapper.set("asr_model_id", modelId); + break; + case "VAD": + wrapper.set("vad_model_id", modelId); + break; + case "LLM": + wrapper.set("llm_model_id", modelId); + break; + case "TTS": + wrapper.set("tts_model_id", modelId); + wrapper.set("tts_voice_id", null); + break; + case "MEMORY": + wrapper.set("mem_model_id", modelId); + break; + case "INTENT": + wrapper.set("intent_model_id", modelId); + break; + } + wrapper.ge("sort", 0); + update(wrapper); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/vo/AgentTemplateVO.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/vo/AgentTemplateVO.java new file mode 100644 index 000000000..a5302e5b6 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/vo/AgentTemplateVO.java @@ -0,0 +1,15 @@ +package xiaozhi.modules.agent.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import xiaozhi.modules.agent.entity.AgentTemplateEntity; + +@Data +@EqualsAndHashCode(callSuper = true) +public class AgentTemplateVO extends AgentTemplateEntity { + // 角色音色 + private String ttsModelName; + + // 角色模型 + private String llmModelName; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/controller/ConfigController.java b/main/manager-api/src/main/java/xiaozhi/modules/config/controller/ConfigController.java new file mode 100644 index 000000000..f83efb3a4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/config/controller/ConfigController.java @@ -0,0 +1,44 @@ +package xiaozhi.modules.config.controller; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import xiaozhi.common.utils.Result; +import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.modules.config.dto.AgentModelsDTO; +import xiaozhi.modules.config.service.ConfigService; + +/** + * xiaozhi-server 配置获取 + * + * @since 1.0.0 + */ +@RestController +@RequestMapping("config") +@Tag(name = "参数管理") +@AllArgsConstructor +public class ConfigController { + private final ConfigService configService; + + @PostMapping("server-base") + @Operation(summary = "获取配置") + public Result getConfig() { + Object config = configService.getConfig(true); + return new Result().ok(config); + } + + @PostMapping("agent-models") + @Operation(summary = "获取智能体模型") + public Result getAgentModels(@Valid @RequestBody AgentModelsDTO dto) { + // 效验数据 + ValidatorUtils.validateEntity(dto); + Object models = configService.getAgentModels(dto.getMacAddress(), dto.getSelectedModule()); + return new Result().ok(models); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/dto/AgentModelsDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/config/dto/AgentModelsDTO.java new file mode 100644 index 000000000..47c08a818 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/config/dto/AgentModelsDTO.java @@ -0,0 +1,25 @@ +package xiaozhi.modules.config.dto; + +import java.util.Map; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +@Schema(description = "获取智能体模型配置DTO") +public class AgentModelsDTO { + + @NotBlank(message = "设备MAC地址不能为空") + @Schema(description = "设备MAC地址") + private String macAddress; + + @NotBlank(message = "客户端ID不能为空") + @Schema(description = "客户端ID") + private String clientId; + + @NotNull(message = "客户端已实例化的模型不能为空") + @Schema(description = "客户端已实例化的模型") + private Map selectedModule; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/init/SystemInitConfig.java b/main/manager-api/src/main/java/xiaozhi/modules/config/init/SystemInitConfig.java new file mode 100644 index 000000000..e47cd0c75 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/config/init/SystemInitConfig.java @@ -0,0 +1,41 @@ +package xiaozhi.modules.config.init; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; + +import jakarta.annotation.PostConstruct; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.modules.config.service.ConfigService; +import xiaozhi.modules.sys.service.SysParamsService; + +@Configuration +@DependsOn("liquibase") +public class SystemInitConfig { + + @Autowired + private SysParamsService sysParamsService; + + @Autowired + private ConfigService configService; + + @Autowired + private RedisUtils redisUtils; + + @PostConstruct + public void init() { + // 检查版本号 + String redisVersion = (String) redisUtils.get(RedisKeys.getVersionKey()); + if (!Constant.VERSION.equals(redisVersion)) { + // 如果版本不一致,清空Redis + redisUtils.emptyAll(); + // 存储新版本号 + redisUtils.set(RedisKeys.getVersionKey(), Constant.VERSION); + } + + sysParamsService.initServerSecret(); + configService.getConfig(false); + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/service/ConfigService.java b/main/manager-api/src/main/java/xiaozhi/modules/config/service/ConfigService.java new file mode 100644 index 000000000..93845e8ec --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/config/service/ConfigService.java @@ -0,0 +1,22 @@ +package xiaozhi.modules.config.service; + +import java.util.Map; + +public interface ConfigService { + /** + * 获取服务器配置 + * + * @param isCache 是否缓存 + * @return 配置信息 + */ + Object getConfig(Boolean isCache); + + /** + * 获取智能体模型配置 + * + * @param macAddress MAC地址 + * @param selectedModule 客户端已实例化的模型 + * @return 模型配置信息 + */ + Map getAgentModels(String macAddress, Map selectedModule); +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java new file mode 100644 index 000000000..a15df0026 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java @@ -0,0 +1,285 @@ +package xiaozhi.modules.config.service.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import lombok.AllArgsConstructor; +import xiaozhi.common.exception.ErrorCode; +import xiaozhi.common.exception.RenException; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.common.utils.JsonUtils; +import xiaozhi.modules.agent.entity.AgentEntity; +import xiaozhi.modules.agent.entity.AgentTemplateEntity; +import xiaozhi.modules.agent.service.AgentService; +import xiaozhi.modules.agent.service.AgentTemplateService; +import xiaozhi.modules.config.service.ConfigService; +import xiaozhi.modules.device.entity.DeviceEntity; +import xiaozhi.modules.device.service.DeviceService; +import xiaozhi.modules.model.entity.ModelConfigEntity; +import xiaozhi.modules.model.service.ModelConfigService; +import xiaozhi.modules.sys.dto.SysParamsDTO; +import xiaozhi.modules.sys.service.SysParamsService; +import xiaozhi.modules.timbre.service.TimbreService; +import xiaozhi.modules.timbre.vo.TimbreDetailsVO; + +@Service +@AllArgsConstructor +public class ConfigServiceImpl implements ConfigService { + private final SysParamsService sysParamsService; + private final DeviceService deviceService; + private final ModelConfigService modelConfigService; + private final AgentService agentService; + private final AgentTemplateService agentTemplateService; + private final RedisUtils redisUtils; + private final TimbreService timbreService; + + @Override + public Object getConfig(Boolean isCache) { + if (isCache) { + // 先从Redis获取配置 + Object cachedConfig = redisUtils.get(RedisKeys.getServerConfigKey()); + if (cachedConfig != null) { + return cachedConfig; + } + } + + // 构建配置信息 + Map result = new HashMap<>(); + buildConfig(result); + + // 查询默认智能体 + AgentTemplateEntity agent = agentTemplateService.getDefaultTemplate(); + if (agent == null) { + throw new RenException("默认智能体未找到"); + } + + // 构建模块配置 + buildModuleConfig( + null, + null, + null, + agent.getVadModelId(), + agent.getAsrModelId(), + null, + null, + null, + null, + result, + isCache); + + // 将配置存入Redis + redisUtils.set(RedisKeys.getServerConfigKey(), result); + + return result; + } + + @Override + public Map getAgentModels(String macAddress, Map selectedModule) { + // 根据MAC地址查找设备 + DeviceEntity device = deviceService.getDeviceByMacAddress(macAddress); + if (device == null) { + // 如果设备,去redis里看看有没有需要连接的设备 + String cachedCode = deviceService.geCodeByDeviceId(macAddress); + if (StringUtils.isNotBlank(cachedCode)) { + throw new RenException(ErrorCode.OTA_DEVICE_NEED_BIND, cachedCode); + } + throw new RenException(ErrorCode.OTA_DEVICE_NOT_FOUND, "not found device"); + } + + // 获取智能体信息 + AgentEntity agent = agentService.getAgentById(device.getAgentId()); + if (agent == null) { + throw new RenException("智能体未找到"); + } + // 获取音色信息 + String voice = null; + TimbreDetailsVO timbre = timbreService.get(agent.getTtsVoiceId()); + if (timbre != null) { + voice = timbre.getTtsVoice(); + } + // 构建返回数据 + Map result = new HashMap<>(); + // 获取单台设备每天最多输出字数 + String deviceMaxOutputSize = sysParamsService.getValue("device_max_output_size", true); + result.put("device_max_output_size", deviceMaxOutputSize); + // 如果客户端已实例化模型,则不返回 + String alreadySelectedVadModelId = (String) selectedModule.get("VAD"); + if (alreadySelectedVadModelId != null && alreadySelectedVadModelId.equals(agent.getVadModelId())) { + agent.setVadModelId(null); + } + String alreadySelectedAsrModelId = (String) selectedModule.get("ASR"); + if (alreadySelectedAsrModelId != null && alreadySelectedAsrModelId.equals(agent.getAsrModelId())) { + agent.setAsrModelId(null); + } + + // 构建模块配置 + buildModuleConfig( + agent.getAgentName(), + agent.getSystemPrompt(), + voice, + agent.getVadModelId(), + agent.getAsrModelId(), + agent.getLlmModelId(), + agent.getTtsModelId(), + agent.getMemModelId(), + agent.getIntentModelId(), + result, + true); + + return result; + } + + /** + * 构建配置信息 + * + * @param paramsList 系统参数列表 + * @return 配置信息 + */ + private Object buildConfig(Map config) { + + // 查询所有系统参数 + List paramsList = sysParamsService.list(new HashMap<>()); + + for (SysParamsDTO param : paramsList) { + String[] keys = param.getParamCode().split("\\."); + Map current = config; + + // 遍历除最后一个key之外的所有key + for (int i = 0; i < keys.length - 1; i++) { + String key = keys[i]; + if (!current.containsKey(key)) { + current.put(key, new HashMap()); + } + current = (Map) current.get(key); + } + + // 处理最后一个key + String lastKey = keys[keys.length - 1]; + String value = param.getParamValue(); + + // 根据valueType转换值 + switch (param.getValueType().toLowerCase()) { + case "number": + try { + double doubleValue = Double.parseDouble(value); + // 如果数值是整数形式,则转换为Integer + if (doubleValue == (int) doubleValue) { + current.put(lastKey, (int) doubleValue); + } else { + current.put(lastKey, doubleValue); + } + } catch (NumberFormatException e) { + current.put(lastKey, value); + } + break; + case "boolean": + current.put(lastKey, Boolean.parseBoolean(value)); + break; + case "array": + // 将分号分隔的字符串转换为数字数组 + List list = new ArrayList<>(); + for (String num : value.split(";")) { + if (StringUtils.isNotBlank(num)) { + list.add(num.trim()); + } + } + current.put(lastKey, list); + break; + case "json": + try { + current.put(lastKey, JsonUtils.parseObject(value, Object.class)); + } catch (Exception e) { + current.put(lastKey, value); + } + break; + default: + current.put(lastKey, value); + } + } + + return config; + } + + /** + * 构建模块配置 + * + * @param prompt 提示词 + * @param voice 音色 + * @param vadModelId VAD模型ID + * @param asrModelId ASR模型ID + * @param llmModelId LLM模型ID + * @param ttsModelId TTS模型ID + * @param memModelId 记忆模型ID + * @param intentModelId 意图模型ID + * @param result 结果Map + */ + private void buildModuleConfig( + String assistantName, + String prompt, + String voice, + String vadModelId, + String asrModelId, + String llmModelId, + String ttsModelId, + String memModelId, + String intentModelId, + Map result, + boolean isCache) { + Map selectedModule = new HashMap<>(); + + String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM" }; + String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId }; + String intentLLMModelId = null; + + for (int i = 0; i < modelIds.length; i++) { + if (modelIds[i] == null) { + continue; + } + ModelConfigEntity model = modelConfigService.getModelById(modelIds[i], isCache); + Map typeConfig = new HashMap<>(); + if (model.getConfigJson() != null) { + typeConfig.put(model.getId(), model.getConfigJson()); + // 如果是TTS类型,添加private_voice属性 + if ("TTS".equals(modelTypes[i]) && voice != null) { + ((Map) model.getConfigJson()).put("private_voice", voice); + } + // 如果是Intent类型,且type=intent_llm,则给他添加附加模型 + if ("Intent".equals(modelTypes[i])) { + Map map = (Map) model.getConfigJson(); + if ("intent_llm".equals(map.get("type"))) { + intentLLMModelId = (String) map.get("llm"); + if (intentLLMModelId != null && intentLLMModelId.equals(llmModelId)) { + intentLLMModelId = null; + } + } else if ("function_call".equals(map.get("type"))) { + String functionStr = (String) map.get("functions"); + if (StringUtils.isNotBlank(functionStr)) { + String[] functions = functionStr.split("\\;"); + map.put("functions", functions); + } + } + } + // 如果是LLM类型,且intentLLMModelId不为空,则添加附加模型 + if ("LLM".equals(modelTypes[i]) && intentLLMModelId != null) { + ModelConfigEntity intentLLM = modelConfigService.getModelById(intentLLMModelId, isCache); + typeConfig.put(intentLLM.getId(), intentLLM.getConfigJson()); + } + } + result.put(modelTypes[i], typeConfig); + + selectedModule.put(modelTypes[i], model.getId()); + } + + result.put("selected_module", selectedModule); + if (StringUtils.isNotBlank(prompt)) { + prompt = prompt.replace("{{assistant_name}}", StringUtils.isBlank(assistantName) ? "小智" : assistantName); + } + result.put("prompt", prompt); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java index d458e9f97..5b0bf4bcf 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java @@ -1,82 +1,95 @@ package xiaozhi.modules.device.controller; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; +import java.util.List; + import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.web.bind.annotation.*; -import xiaozhi.common.constant.Constant; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; import xiaozhi.common.exception.ErrorCode; -import xiaozhi.common.page.PageData; import xiaozhi.common.redis.RedisKeys; import xiaozhi.common.redis.RedisUtils; import xiaozhi.common.user.UserDetail; -import xiaozhi.common.utils.JsonUtils; import xiaozhi.common.utils.Result; -import xiaozhi.modules.device.dto.DeviceHeaderDTO; +import xiaozhi.modules.device.dto.DeviceRegisterDTO; import xiaozhi.modules.device.dto.DeviceUnBindDTO; import xiaozhi.modules.device.entity.DeviceEntity; import xiaozhi.modules.device.service.DeviceService; import xiaozhi.modules.security.user.SecurityUser; -import java.util.List; -import java.util.Map; - @Tag(name = "设备管理") @AllArgsConstructor @RestController @RequestMapping("/device") public class DeviceController { private final DeviceService deviceService; + private final RedisUtils redisUtils; - - @PostMapping("/bind/{deviceCode}") + @PostMapping("/bind/{agentId}/{deviceCode}") @Operation(summary = "绑定设备") @RequiresPermissions("sys:role:normal") - public Result bindDevice(@PathVariable String deviceCode) { - UserDetail user = SecurityUser.getUser(); - - String deviceHeaders = (String) redisUtils.get(RedisKeys.getDeviceCaptchaKey(deviceCode)); - if (StringUtils.isBlank(deviceHeaders)) { - return new Result().error(ErrorCode.DEVICE_CAPTCHA_ERROR); - } - DeviceHeaderDTO deviceHeader = JsonUtils.parseObject(deviceHeaders.getBytes(), DeviceHeaderDTO.class); - DeviceEntity device = deviceService.bindDevice(user.getId(), deviceHeader); - return new Result().ok(device); + public Result bindDevice(@PathVariable String agentId, @PathVariable String deviceCode) { + deviceService.deviceActivation(agentId, deviceCode); + return new Result<>(); } - @GetMapping("/bind") + @PostMapping("/register") + @Operation(summary = "注册设备") + public Result registerDevice(@RequestBody DeviceRegisterDTO deviceRegisterDTO) { + String macAddress = deviceRegisterDTO.getMacAddress(); + if (StringUtils.isBlank(macAddress)) { + return new Result().error(ErrorCode.NOT_NULL, "mac地址不能为空"); + } + // 生成六位验证码 + String code = String.valueOf(Math.random()).substring(2, 8); + String key = RedisKeys.getDeviceCaptchaKey(code); + String existsMac = null; + do { + existsMac = (String) redisUtils.get(key); + } while (StringUtils.isNotBlank(existsMac)); + + redisUtils.set(key, macAddress); + return new Result().ok(code); + } + + @GetMapping("/bind/{agentId}") @Operation(summary = "获取已绑定设备") @RequiresPermissions("sys:role:normal") - public Result> getUserDevices() { + public Result> getUserDevices(@PathVariable String agentId) { UserDetail user = SecurityUser.getUser(); - List devices = deviceService.getUserDevices(user.getId()); + List devices = deviceService.getUserDevices(user.getId(), agentId); return new Result>().ok(devices); } @PostMapping("/unbind") @Operation(summary = "解绑设备") @RequiresPermissions("sys:role:normal") - public Result unbindDevice(@RequestBody DeviceUnBindDTO unDeviveBind) { + public Result unbindDevice(@RequestBody DeviceUnBindDTO unDeviveBind) { UserDetail user = SecurityUser.getUser(); deviceService.unbindDevice(user.getId(), unDeviveBind.getDeviceId()); - return new Result(); + return new Result(); } - @GetMapping("/all") - @Operation(summary = "设备列表(管理员)") - @RequiresPermissions("sys:role:superAdmin") - @Parameters({ - @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), - @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true), - }) - public Result> adminDeviceList( - @Parameter(hidden = true) @RequestParam Map params) { - PageData page = deviceService.adminDeviceList(params); - return new Result>().ok(page); + @PutMapping("/enableOta/{id}/{status}") + @Operation(summary = "启用/关闭OTA自动升级") + @RequiresPermissions("sys:role:normal") + public Result enableOtaUpgrade(@PathVariable String id, @PathVariable Integer status) { + DeviceEntity entity = deviceService.selectById(id); + if (entity == null) { + return new Result().error("设备不存在"); + } + entity.setAutoUpdate(status); + deviceService.updateById(entity); + return new Result(); } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAController.java b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAController.java new file mode 100644 index 000000000..05d36e9ac --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAController.java @@ -0,0 +1,119 @@ +package xiaozhi.modules.device.controller; + +import java.nio.charset.StandardCharsets; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.constant.Constant; +import xiaozhi.modules.device.dto.DeviceReportReqDTO; +import xiaozhi.modules.device.dto.DeviceReportRespDTO; +import xiaozhi.modules.device.entity.DeviceEntity; +import xiaozhi.modules.device.service.DeviceService; +import xiaozhi.modules.sys.service.SysParamsService; + +@Tag(name = "设备管理", description = "OTA 相关接口") +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("/ota/") +public class OTAController { + private final DeviceService deviceService; + private final SysParamsService sysParamsService; + + @Operation(summary = "OTA版本和设备激活状态检查") + @PostMapping + public ResponseEntity checkOTAVersion( + @RequestBody DeviceReportReqDTO deviceReportReqDTO, + @Parameter(name = "Device-Id", description = "设备唯一标识", required = true, in = ParameterIn.HEADER) @RequestHeader("Device-Id") String deviceId, + @Parameter(name = "Client-Id", description = "客户端标识", required = false, in = ParameterIn.HEADER) @RequestHeader(value = "Client-Id", required = false) String clientId) { + if (StringUtils.isBlank(deviceId)) { + return createResponse(DeviceReportRespDTO.createError("Device ID is required")); + } + if (StringUtils.isBlank(clientId)) { + clientId = deviceId; + } + String macAddress = deviceReportReqDTO.getMacAddress(); + boolean macAddressValid = isMacAddressValid(macAddress); + // 设备Id和Mac地址应是一致的, 并且必须需要application字段 + if (!deviceId.equals(macAddress) || !macAddressValid || deviceReportReqDTO.getApplication() == null) { + return createResponse(DeviceReportRespDTO.createError("Invalid OTA request")); + } + return createResponse(deviceService.checkDeviceActive(macAddress, clientId, deviceReportReqDTO)); + } + + @Operation(summary = "设备快速检查激活状态") + @PostMapping("activate") + public ResponseEntity activateDevice( + @Parameter(name = "Device-Id", description = "设备唯一标识", required = true, in = ParameterIn.HEADER) @RequestHeader("Device-Id") String deviceId, + @Parameter(name = "Client-Id", description = "客户端标识", required = false, in = ParameterIn.HEADER) @RequestHeader(value = "Client-Id", required = false) String clientId) { + if (StringUtils.isBlank(deviceId)) { + return ResponseEntity.status(202).build(); + } + DeviceEntity device = deviceService.getDeviceByMacAddress(deviceId); + if (device == null) { + return ResponseEntity.status(202).build(); + } + return ResponseEntity.ok("success"); + } + + @GetMapping + @Hidden + public ResponseEntity getOTA() { + String wsUrl = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true); + if (StringUtils.isBlank(wsUrl) || wsUrl.equals("null")) { + return ResponseEntity.ok("OTA接口不正常,缺少websocket地址,请登录智控台,在参数管理找到【server.websocket】配置"); + } + String otaUrl = sysParamsService.getValue(Constant.SERVER_OTA, true); + if (StringUtils.isBlank(otaUrl) || otaUrl.equals("null")) { + return ResponseEntity.ok("OTA接口不正常,缺少ota地址,请登录智控台,在参数管理找到【server.ota】配置"); + } + return ResponseEntity.ok("OTA接口运行正常,websocket集群数量:" + wsUrl.split(";").length); + } + + @SneakyThrows + private ResponseEntity createResponse(DeviceReportRespDTO deviceReportRespDTO) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + String json = objectMapper.writeValueAsString(deviceReportRespDTO); + byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8); + return ResponseEntity + .ok() + .contentType(MediaType.APPLICATION_JSON) + .contentLength(jsonBytes.length) + .body(json); + } + + /** + * 简单判断mac地址是否有效(非严格) + * + * @param macAddress + * @return + */ + private boolean isMacAddressValid(String macAddress) { + if (StringUtils.isBlank(macAddress)) { + return false; + } + // MAC地址通常为12位十六进制数字,可以包含冒号或连字符分隔符 + String macPattern = "^([0-9A-Za-z]{2}[:-]){5}([0-9A-Za-z]{2})$"; + return macAddress.matches(macPattern); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAMagController.java b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAMagController.java new file mode 100644 index 000000000..bbe0c66ae --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/OTAMagController.java @@ -0,0 +1,291 @@ +package xiaozhi.modules.device.controller; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.common.utils.Result; +import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.modules.device.entity.OtaEntity; +import xiaozhi.modules.device.service.OtaService; + +@Tag(name = "设备管理", description = "OTA 相关接口") +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("/otaMag") +public class OTAMagController { + private static final Logger logger = LoggerFactory.getLogger(OTAController.class); + private final OtaService otaService; + private final RedisUtils redisUtils; + + @GetMapping + @Operation(summary = "分页查询 OTA 固件信息") + @Parameters({ + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) + }) + @RequiresPermissions("sys:role:superAdmin") + public Result> page(@Parameter(hidden = true) @RequestParam Map params) { + ValidatorUtils.validateEntity(params); + PageData page = otaService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + @Operation(summary = "信息 OTA 固件信息") + @RequiresPermissions("sys:role:superAdmin") + public Result get(@PathVariable("id") String id) { + OtaEntity data = otaService.selectById(id); + return new Result().ok(data); + } + + @PostMapping + @Operation(summary = "保存 OTA 固件信息") + @RequiresPermissions("sys:role:superAdmin") + public Result save(@RequestBody OtaEntity entity) { + if (entity == null) { + return new Result().error("固件信息不能为空"); + } + if (StringUtils.isBlank(entity.getFirmwareName())) { + return new Result().error("固件名称不能为空"); + } + if (StringUtils.isBlank(entity.getType())) { + return new Result().error("固件类型不能为空"); + } + if (StringUtils.isBlank(entity.getVersion())) { + return new Result().error("版本号不能为空"); + } + try { + otaService.save(entity); + return new Result(); + } catch (RuntimeException e) { + return new Result().error(e.getMessage()); + } + } + + @DeleteMapping("/{id}") + @Operation(summary = "OTA 删除") + @RequiresPermissions("sys:role:superAdmin") + public Result delete(@PathVariable("id") String[] ids) { + if (ids == null || ids.length == 0) { + return new Result().error("删除的固件ID不能为空"); + } + otaService.delete(ids); + return new Result(); + } + + @PutMapping("/{id}") + @Operation(summary = "修改 OTA 固件信息") + @RequiresPermissions("sys:role:superAdmin") + public Result update(@PathVariable("id") String id, @RequestBody OtaEntity entity) { + if (entity == null) { + return new Result<>().error("固件信息不能为空"); + } + entity.setId(id); + try { + otaService.update(entity); + return new Result<>(); + } catch (RuntimeException e) { + return new Result<>().error(e.getMessage()); + } + } + + @GetMapping("/getDownloadUrl/{id}") + @Operation(summary = "获取 OTA 固件下载链接") + @RequiresPermissions("sys:role:superAdmin") + public Result getDownloadUrl(@PathVariable("id") String id) { + String uuid = UUID.randomUUID().toString(); + redisUtils.set(RedisKeys.getOtaIdKey(uuid), id); + return new Result().ok(uuid); + } + + @GetMapping("/download/{uuid}") + @Operation(summary = "下载固件文件") + public ResponseEntity downloadFirmware(@PathVariable("uuid") String uuid) { + String id = (String) redisUtils.get(RedisKeys.getOtaIdKey(uuid)); + if (StringUtils.isBlank(id)) { + return ResponseEntity.notFound().build(); + } + + // 检查下载次数 + String downloadCountKey = RedisKeys.getOtaDownloadCountKey(uuid); + Integer downloadCount = (Integer) redisUtils.get(downloadCountKey); + if (downloadCount == null) { + downloadCount = 0; + } + + // 如果下载次数超过3次,返回404 + if (downloadCount >= 3) { + redisUtils.delete(downloadCountKey); + redisUtils.delete(RedisKeys.getOtaIdKey(uuid)); + logger.warn("Download limit exceeded for UUID: {}", uuid); + return ResponseEntity.notFound().build(); + } + + redisUtils.set(downloadCountKey, downloadCount + 1); + + try { + // 获取固件信息 + OtaEntity otaEntity = otaService.selectById(id); + if (otaEntity == null || StringUtils.isBlank(otaEntity.getFirmwarePath())) { + logger.warn("Firmware not found or path is empty for ID: {}", id); + return ResponseEntity.notFound().build(); + } + + // 获取文件路径 - 确保路径是绝对路径或正确的相对路径 + String firmwarePath = otaEntity.getFirmwarePath(); + Path path; + + // 检查是否是绝对路径 + if (Paths.get(firmwarePath).isAbsolute()) { + path = Paths.get(firmwarePath); + } else { + // 如果是相对路径,则从当前工作目录解析 + path = Paths.get(System.getProperty("user.dir"), firmwarePath); + } + + logger.info("Attempting to download firmware for ID: {}, DB path: {}, resolved path: {}", + id, firmwarePath, path.toAbsolutePath()); + + if (!Files.exists(path) || !Files.isRegularFile(path)) { + // 尝试直接从firmware目录下查找文件名 + String fileName = new File(firmwarePath).getName(); + Path altPath = Paths.get(System.getProperty("user.dir"), "firmware", fileName); + + logger.info("File not found at primary path, trying alternative path: {}", altPath.toAbsolutePath()); + + if (Files.exists(altPath) && Files.isRegularFile(altPath)) { + path = altPath; + } else { + logger.error("Firmware file not found at either path: {} or {}", + path.toAbsolutePath(), altPath.toAbsolutePath()); + return ResponseEntity.notFound().build(); + } + } + + // 读取文件内容 + byte[] fileContent = Files.readAllBytes(path); + + // 设置响应头 + String originalFilename = otaEntity.getType() + "_" + otaEntity.getVersion(); + if (firmwarePath.contains(".")) { + String extension = firmwarePath.substring(firmwarePath.lastIndexOf(".")); + originalFilename += extension; + } + + // 清理文件名,移除不安全字符 + String safeFilename = originalFilename.replaceAll("[^a-zA-Z0-9._-]", "_"); + + logger.info("Providing download for firmware ID: {}, filename: {}, size: {} bytes", + id, safeFilename, fileContent.length); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + safeFilename + "\"") + .body(fileContent); + } catch (IOException e) { + logger.error("Error reading firmware file for ID: {}", id, e); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); + } catch (Exception e) { + logger.error("Unexpected error during firmware download for ID: {}", id, e); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); + } + } + + @PostMapping("/upload") + @Operation(summary = "上传固件文件") + @RequiresPermissions("sys:role:superAdmin") + public Result uploadFirmware(@RequestParam("file") MultipartFile file) { + if (file.isEmpty()) { + return new Result().error("上传文件不能为空"); + } + + // 检查文件扩展名 + String originalFilename = file.getOriginalFilename(); + if (originalFilename == null) { + return new Result().error("文件名不能为空"); + } + + String extension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase(); + if (!extension.equals(".bin") && !extension.equals(".apk")) { + return new Result().error("只允许上传.bin和.apk格式的文件"); + } + + try { + // 计算文件的MD5值 + String md5 = calculateMD5(file); + + // 设置存储路径 + String uploadDir = "uploadfile"; + Path uploadPath = Paths.get(uploadDir); + + // 如果目录不存在,创建目录 + if (!Files.exists(uploadPath)) { + Files.createDirectories(uploadPath); + } + + // 使用MD5作为文件名,固定使用.bin扩展名 + String uniqueFileName = md5 + extension; + Path filePath = uploadPath.resolve(uniqueFileName); + + // 检查文件是否已存在 + if (Files.exists(filePath)) { + return new Result().ok(filePath.toString()); + } + + // 保存文件 + Files.copy(file.getInputStream(), filePath); + + // 返回文件路径 + return new Result().ok(filePath.toString()); + } catch (IOException | NoSuchAlgorithmException e) { + return new Result().error("文件上传失败:" + e.getMessage()); + } + } + + private String calculateMD5(MultipartFile file) throws IOException, NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] digest = md.digest(file.getBytes()); + StringBuilder sb = new StringBuilder(); + for (byte b : digest) { + sb.append(String.format("%02x", b)); + } + return sb.toString(); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dao/DeviceDao.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dao/DeviceDao.java index 9e4a8cd43..6570b89b8 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/dao/DeviceDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dao/DeviceDao.java @@ -1,9 +1,21 @@ package xiaozhi.modules.device.dao; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + import xiaozhi.modules.device.entity.DeviceEntity; +import java.util.Date; +import java.util.List; + @Mapper public interface DeviceDao extends BaseMapper { + /** + * 获取此智能体全部设备的最后连接时间 + * @param agentId 智能体id + * @return + */ + Date getAllLastConnectedAtByAgentId(String agentId); + } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dao/OtaDao.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dao/OtaDao.java new file mode 100644 index 000000000..975f69be1 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dao/OtaDao.java @@ -0,0 +1,15 @@ +package xiaozhi.modules.device.dao; + +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import xiaozhi.modules.device.entity.OtaEntity; + +/** + * OTA固件管理 + */ +@Mapper +public interface OtaDao extends BaseMapper { + +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceBindDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceBindDTO.java new file mode 100644 index 000000000..3413c31b4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceBindDTO.java @@ -0,0 +1,27 @@ +package xiaozhi.modules.device.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * 设备绑定的DTO + * + * @author zjy + * @since 2025-3-28 + */ +@Data +@AllArgsConstructor +@Schema(description = "设备连接头信息") +public class DeviceBindDTO { + + @Schema(description = "mac地址") + private String macAddress; + + @Schema(description = "所属用户id") + private Long userId; + + @Schema(description = "智能体id") + private String agentId; + +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceHeaderDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceHeaderDTO.java deleted file mode 100644 index 83327fef5..000000000 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceHeaderDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package xiaozhi.modules.device.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Data -@Schema(description = "设备连接头信息") -public class DeviceHeaderDTO { - - @Schema(description = "设备ID") - private String deviceId; - - @Schema(description = "协议版本号") - private Long protocolVersion; - - @Schema(description = "认证信息") - private String authorization; - -} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DevicePageUserDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DevicePageUserDTO.java new file mode 100644 index 000000000..26bccbfd1 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DevicePageUserDTO.java @@ -0,0 +1,27 @@ +package xiaozhi.modules.device.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import lombok.Data; + +/** + * 查询所有设备的DTO + * + * @author zjy + * @since 2025-3-21 + */ +@Data +@Schema(description = "查询所有设备的DTO") +public class DevicePageUserDTO { + + @Schema(description = "设备关键词") + private String keywords; + + @Schema(description = "页数") + @Min(value = 0, message = "{page.number}") + private String page; + + @Schema(description = "显示列数") + @Min(value = 0, message = "{limit.number}") + private String limit; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceRegisterDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceRegisterDTO.java new file mode 100644 index 000000000..ce37c517a --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceRegisterDTO.java @@ -0,0 +1,23 @@ +package xiaozhi.modules.device.dto; + +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 设备注册头信息 + * + * @author zjy + * @since 2025-3-28 + */ +@Setter +@Getter +@Schema(description = "设备注册头信息") +public class DeviceRegisterDTO implements Serializable { + + @Schema(description = "mac地址") + private String macAddress; + +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportReqDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportReqDTO.java new file mode 100644 index 000000000..fec5a297c --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportReqDTO.java @@ -0,0 +1,148 @@ +package xiaozhi.modules.device.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.List; + +@Setter +@Getter +@Schema(description = "设备固件信息上报求请求体") +public class DeviceReportReqDTO implements Serializable { + private static final long serialVersionUID = 1L; + // region 实体属性 + @Schema(description = "板子固件版本号") + private Integer version; + + @Schema(description = "闪存大小(单位:字节)") + @JsonProperty("flash_size") + private Integer flashSize; + + @Schema(description = "最小空闲堆内存(字节)") + @JsonProperty("minimum_free_heap_size") + private Integer minimumFreeHeapSize; + + @Schema(description = "设备 MAC 地址") + @JsonProperty("mac_address") + private String macAddress; + + @Schema(description = "设备唯一标识 UUID") + private String uuid; + + @Schema(description = "芯片型号名称") + @JsonProperty("chip_model_name") + private String chipModelName; + + @Schema(description = "芯片详细信息") + @JsonProperty("chip_info") + private ChipInfo chipInfo; + + @Schema(description = "应用程序信息") + private Application application; + + @Schema(description = "分区表列表") + @JsonProperty("partition_table") + private List partitionTable; + + @Schema(description = "当前运行的 OTA 分区信息") + private OtaInfo ota; + + @Schema(description = "板子配置信息") + private BoardInfo board; + + // endregion + + @Getter + @Setter + @Schema(description = "芯片信息") + public static class ChipInfo { + @Schema(description = "芯片模型代码") + private Integer model; + + @Schema(description = "核心数") + private Integer cores; + + @Schema(description = "硬件修订版本") + private Integer revision; + + @Schema(description = "芯片功能标志位") + private Integer features; + } + + @Getter + @Setter + @Schema(description = "板子编译信息") + public static class Application { + @Schema(description = "名称") + private String name; + + @Schema(description = "应用版本号") + private String version; + + @Schema(description = "编译时间(UTC ISO格式)") + @JsonProperty("compile_time") + private String compileTime; + + @Schema(description = "ESP-IDF 版本号") + @JsonProperty("idf_version") + private String idfVersion; + + @Schema(description = "ELF 文件 SHA256 校验") + @JsonProperty("elf_sha256") + private String elfSha256; + } + + @Getter + @Setter + @Schema(description = "分区信息") + public static class Partition { + @Schema(description = "分区标签名") + private String label; + + @Schema(description = "分区类型") + private Integer type; + + @Schema(description = "子类型") + private Integer subtype; + + @Schema(description = "起始地址") + private Integer address; + + @Schema(description = "分区大小") + private Integer size; + } + + @Getter + @Setter + @Schema(description = "OTA信息") + public static class OtaInfo { + @Schema(description = "当前OTA标签") + private String label; + } + + @Getter + @Setter + @Schema(description = "板子连接和网络信息") + public static class BoardInfo { + @Schema(description = "板子类型") + private String type; + + @Schema(description = "连接的 Wi-Fi SSID") + private String ssid; + + @Schema(description = "Wi-Fi 信号强度(RSSI)") + private Integer rssi; + + @Schema(description = "Wi-Fi 信道") + private Integer channel; + + @Schema(description = "IP 地址") + private String ip; + + @Schema(description = "MAC 地址") + private String mac; + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java new file mode 100644 index 000000000..f938001e0 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java @@ -0,0 +1,73 @@ +package xiaozhi.modules.device.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +@Data +@Schema(description = "设备OTA检测版本返回体,包含激活码要求") +public class DeviceReportRespDTO { + @Schema(description = "服务器时间") + private ServerTime server_time; + + @Schema(description = "激活码") + private Activation activation; + + @Schema(description = "错误信息") + private String error; + + @Schema(description = "固件版本信息") + private Firmware firmware; + + @Schema(description = "WebSocket配置") + private Websocket websocket; + + @Getter + @Setter + public static class Firmware { + @Schema(description = "版本号") + private String version; + @Schema(description = "下载地址") + private String url; + } + + public static DeviceReportRespDTO createError(String message) { + DeviceReportRespDTO resp = new DeviceReportRespDTO(); + resp.setError(message); + return resp; + } + + @Setter + @Getter + public static class Activation { + @Schema(description = "激活码") + private String code; + + @Schema(description = "激活码信息: 激活地址") + private String message; + + @Schema(description = "挑战码") + private String challenge; + } + + @Getter + @Setter + public static class ServerTime { + @Schema(description = "时间戳") + private Long timestamp; + + @Schema(description = "时区") + private String timeZone; + + @Schema(description = "时区偏移量,单位为分钟") + private Integer timezone_offset; + } + + @Getter + @Setter + public static class Websocket { + @Schema(description = "WebSocket服务器地址") + private String url; + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceUnBindDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceUnBindDTO.java index 830a51aee..f18df5d4e 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceUnBindDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceUnBindDTO.java @@ -1,10 +1,11 @@ package xiaozhi.modules.device.dto; + +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import java.io.Serializable; - /** * 设备解绑表单 */ @@ -14,6 +15,6 @@ public class DeviceUnBindDTO implements Serializable { @Schema(description = "设备ID") @NotBlank(message = "设备ID不能为空") - private Long deviceId; + private String deviceId; } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/entity/DeviceEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/device/entity/DeviceEntity.java index ccbe46835..8ebdf9344 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/entity/DeviceEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/entity/DeviceEntity.java @@ -1,17 +1,26 @@ package xiaozhi.modules.device.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + @Data +@EqualsAndHashCode(callSuper = false) @TableName("ai_device") @Schema(description = "设备信息") public class DeviceEntity { - @Schema(description = "设备ID") - private Long id; + + @TableId(type = IdType.ASSIGN_UUID) + @Schema(description = "ID") + private String id; @Schema(description = "关联用户ID") private Long userId; @@ -40,15 +49,19 @@ public class DeviceEntity { @Schema(description = "排序") private Integer sort; - @Schema(description = "创建者") - private Long creator; - - @Schema(description = "创建时间") - private Date createDate; - @Schema(description = "更新者") + @TableField(fill = FieldFill.UPDATE) private Long updater; @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) private Date updateDate; + + @Schema(description = "创建者") + @TableField(fill = FieldFill.INSERT) + private Long creator; + + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createDate; } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/entity/OtaEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/device/entity/OtaEntity.java new file mode 100644 index 000000000..b93c608bd --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/entity/OtaEntity.java @@ -0,0 +1,61 @@ +package xiaozhi.modules.device.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("ai_ota") +@Schema(description = "固件信息") +public class OtaEntity { + + @TableId(type = IdType.ASSIGN_UUID) + @Schema(description = "ID") + private String id; + + @Schema(description = "固件名称") + private String firmwareName; + + @Schema(description = "固件类型") + private String type; + + @Schema(description = "版本号") + private String version; + + @Schema(description = "文件大小(字节)") + private Long size; + + @Schema(description = "备注/说明") + private String remark; + + @Schema(description = "固件路径") + private String firmwarePath; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "更新者") + @TableField(fill = FieldFill.UPDATE) + private Long updater; + + @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private Date updateDate; + + @Schema(description = "创建者") + @TableField(fill = FieldFill.INSERT) + private Long creator; + + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createDate; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/service/DeviceService.java b/main/manager-api/src/main/java/xiaozhi/modules/device/service/DeviceService.java index 16ad44fe1..fb91ff894 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/service/DeviceService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/service/DeviceService.java @@ -1,18 +1,91 @@ package xiaozhi.modules.device.service; -import xiaozhi.common.page.PageData; -import xiaozhi.modules.device.dto.DeviceHeaderDTO; -import xiaozhi.modules.device.entity.DeviceEntity; - +import java.util.Date; import java.util.List; -import java.util.Map; -public interface DeviceService { - DeviceEntity bindDevice(Long userId, DeviceHeaderDTO deviceHeader); - - List getUserDevices(Long userId); - - void unbindDevice(Long userId, Long deviceId); - - PageData adminDeviceList(Map params); +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.BaseService; +import xiaozhi.modules.device.dto.DevicePageUserDTO; +import xiaozhi.modules.device.dto.DeviceReportReqDTO; +import xiaozhi.modules.device.dto.DeviceReportRespDTO; +import xiaozhi.modules.device.entity.DeviceEntity; +import xiaozhi.modules.device.vo.UserShowDeviceListVO; + +public interface DeviceService extends BaseService { + + /** + * 检查设备是否激活 + */ + DeviceReportRespDTO checkDeviceActive(String macAddress, String clientId, + DeviceReportReqDTO deviceReport); + + /** + * 获取用户指定智能体的设备列表, + */ + List getUserDevices(Long userId, String agentId); + + /** + * 解绑设备 + */ + void unbindDevice(Long userId, String deviceId); + + /** + * 设备激活 + */ + Boolean deviceActivation(String agentId, String activationCode); + + /** + * 删除此用户的所有设备 + * + * @param userId 用户id + */ + void deleteByUserId(Long userId); + + /** + * 删除指定智能体关联的所有设备 + * + * @param agentId 智能体id + */ + void deleteByAgentId(String agentId); + + /** + * 获取指定用户的设备数量 + * + * @param userId 用户id + * @return 设备数量 + */ + Long selectCountByUserId(Long userId); + + /** + * 分页获取全部设备信息 + * + * @param dto 分页查找参数 + * @return 用户列表分页数据 + */ + PageData page(DevicePageUserDTO dto); + + /** + * 根据MAC地址获取设备信息 + * + * @param macAddress MAC地址 + * @return 设备信息 + */ + DeviceEntity getDeviceByMacAddress(String macAddress); + + /** + * 根据设备ID获取激活码 + * + * @param deviceId 设备ID + * @return 激活码 + */ + String geCodeByDeviceId(String deviceId); + + /** + * 获取这个智能体设备理的最近的最后连接时间 + * @param agentId 智能体id + * @return 返回设备最近的最后连接时间 + */ + Date getLatestLastConnectionTime(String agentId); + + } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/service/OtaService.java b/main/manager-api/src/main/java/xiaozhi/modules/device/service/OtaService.java new file mode 100644 index 000000000..cd35f6ae4 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/service/OtaService.java @@ -0,0 +1,22 @@ +package xiaozhi.modules.device.service; + +import java.util.Map; + +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.BaseService; +import xiaozhi.modules.device.entity.OtaEntity; + +/** + * OTA固件管理 + */ +public interface OtaService extends BaseService { + PageData page(Map params); + + boolean save(OtaEntity entity); + + void update(OtaEntity entity); + + void delete(String[] ids); + + OtaEntity getLatestOta(String type); +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java index 279a9f2e8..515aea7fe 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java @@ -1,57 +1,387 @@ package xiaozhi.modules.device.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.stereotype.Service; -import xiaozhi.common.page.PageData; -import xiaozhi.common.service.impl.BaseServiceImpl; -import xiaozhi.modules.device.dao.DeviceDao; -import xiaozhi.modules.device.dto.DeviceHeaderDTO; -import xiaozhi.modules.device.entity.DeviceEntity; -import xiaozhi.modules.device.service.DeviceService; - +import java.time.Instant; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TimeZone; +import java.util.UUID; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import cn.hutool.core.util.RandomUtil; +import jakarta.servlet.http.HttpServletRequest; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.exception.RenException; +import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.common.service.impl.BaseServiceImpl; +import xiaozhi.common.user.UserDetail; +import xiaozhi.common.utils.ConvertUtils; +import xiaozhi.common.utils.DateUtils; +import xiaozhi.modules.device.dao.DeviceDao; +import xiaozhi.modules.device.dto.DevicePageUserDTO; +import xiaozhi.modules.device.dto.DeviceReportReqDTO; +import xiaozhi.modules.device.dto.DeviceReportRespDTO; +import xiaozhi.modules.device.entity.DeviceEntity; +import xiaozhi.modules.device.entity.OtaEntity; +import xiaozhi.modules.device.service.DeviceService; +import xiaozhi.modules.device.service.OtaService; +import xiaozhi.modules.device.vo.UserShowDeviceListVO; +import xiaozhi.modules.security.user.SecurityUser; +import xiaozhi.modules.sys.service.SysParamsService; +import xiaozhi.modules.sys.service.SysUserUtilService; + +@Slf4j @Service +@AllArgsConstructor public class DeviceServiceImpl extends BaseServiceImpl implements DeviceService { + private final DeviceDao deviceDao; + private final SysUserUtilService sysUserUtilService; + private final SysParamsService sysParamsService; + private final RedisUtils redisUtils; + private final OtaService otaService; - // 添加构造函数来初始化 deviceMapper - public DeviceServiceImpl(DeviceDao deviceDao) { - this.deviceDao = deviceDao; + @Override + public Boolean deviceActivation(String agentId, String activationCode) { + if (StringUtils.isBlank(activationCode)) { + throw new RenException("激活码不能为空"); + } + String deviceKey = "ota:activation:code:" + activationCode; + Object cacheDeviceId = redisUtils.get(deviceKey); + if (cacheDeviceId == null) { + throw new RenException("激活码错误"); + } + String deviceId = (String) cacheDeviceId; + String safeDeviceId = deviceId.replace(":", "_").toLowerCase(); + String cacheDeviceKey = String.format("ota:activation:data:%s", safeDeviceId); + Map cacheMap = (Map) redisUtils.get(cacheDeviceKey); + if (cacheMap == null) { + throw new RenException("激活码错误"); + } + String cachedCode = (String) cacheMap.get("activation_code"); + if (!activationCode.equals(cachedCode)) { + throw new RenException("激活码错误"); + } + // 检查设备有没有被激活 + if (selectById(deviceId) != null) { + throw new RenException("设备已激活"); + } + + String macAddress = (String) cacheMap.get("mac_address"); + String board = (String) cacheMap.get("board"); + String appVersion = (String) cacheMap.get("app_version"); + UserDetail user = SecurityUser.getUser(); + if (user.getId() == null) { + throw new RenException("用户未登录"); + } + + Date currentTime = new Date(); + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setId(deviceId); + deviceEntity.setBoard(board); + deviceEntity.setAgentId(agentId); + deviceEntity.setAppVersion(appVersion); + deviceEntity.setMacAddress(macAddress); + deviceEntity.setUserId(user.getId()); + deviceEntity.setCreator(user.getId()); + deviceEntity.setAutoUpdate(1); + deviceEntity.setCreateDate(currentTime); + deviceEntity.setUpdater(user.getId()); + deviceEntity.setUpdateDate(currentTime); + deviceEntity.setLastConnectedAt(currentTime); + deviceDao.insert(deviceEntity); + + // 清理redis缓存 + redisUtils.delete(cacheDeviceKey); + redisUtils.delete(deviceKey); + return true; } @Override - public DeviceEntity bindDevice(Long userId, DeviceHeaderDTO deviceHeader) { - DeviceEntity device = new DeviceEntity(); - device.setUserId(userId); - device.setMacAddress(deviceHeader.getDeviceId()); - device.setCreateDate(new Date()); - deviceDao.insert(device); - return device; + public DeviceReportRespDTO checkDeviceActive(String macAddress, String clientId, + DeviceReportReqDTO deviceReport) { + DeviceReportRespDTO response = new DeviceReportRespDTO(); + response.setServer_time(buildServerTime()); + + DeviceEntity deviceById = getDeviceByMacAddress(macAddress); + + if (deviceById == null || deviceById.getAutoUpdate() != 0) { + String type = deviceReport.getBoard() == null ? null : deviceReport.getBoard().getType(); + DeviceReportRespDTO.Firmware firmware = buildFirmwareInfo(type, + deviceReport.getApplication() == null ? null : deviceReport.getApplication().getVersion()); + response.setFirmware(firmware); + } else { + response.setFirmware(null); + } + + // 添加WebSocket配置 + DeviceReportRespDTO.Websocket websocket = new DeviceReportRespDTO.Websocket(); + // 从系统参数获取WebSocket URL,如果未配置则使用默认值 + String wsUrl = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true); + if (StringUtils.isBlank(wsUrl) || wsUrl.equals("null")) { + log.error("WebSocket地址未配置,请登录智控台,在参数管理找到【server.websocket】配置"); + wsUrl = "ws://xiaozhi.server.com:8000/xiaozhi/v1/"; + websocket.setUrl(wsUrl); + } else { + String[] wsUrls = wsUrl.split("\\;"); + if (wsUrls.length > 0) { + // 随机选择一个WebSocket URL + websocket.setUrl(wsUrls[RandomUtil.randomInt(0, wsUrls.length)]); + } else { + log.error("WebSocket地址未配置,请登录智控台,在参数管理找到【server.websocket】配置"); + websocket.setUrl("ws://xiaozhi.server.com:8000/xiaozhi/v1/"); + } + } + + response.setWebsocket(websocket); + + if (deviceById != null) { + // 如果设备存在,则更新上次连接时间 + deviceById.setLastConnectedAt(new Date()); + if (deviceReport.getApplication() != null + && StringUtils.isNotBlank(deviceReport.getApplication().getVersion())) { + deviceById.setAppVersion(deviceReport.getApplication().getVersion()); + } + deviceDao.updateById(deviceById); + } else { + // 如果设备不存在,则生成激活码 + DeviceReportRespDTO.Activation code = buildActivation(macAddress, deviceReport); + response.setActivation(code); + } + + return response; } @Override - public List getUserDevices(Long userId) { + public List getUserDevices(Long userId, String agentId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("user_id", userId); - return deviceDao.selectList(wrapper); + wrapper.eq("agent_id", agentId); + return baseDao.selectList(wrapper); } @Override - public void unbindDevice(Long userId, Long deviceId) { - deviceDao.deleteById(deviceId); + public void unbindDevice(Long userId, String deviceId) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("user_id", userId); + wrapper.eq("id", deviceId); + baseDao.delete(wrapper); } @Override - public PageData adminDeviceList(Map params) { - IPage page = deviceDao.selectPage( - getPage(params, "sort", true), - new QueryWrapper<>() - ); - return new PageData<>(page.getRecords(), page.getTotal()); + public void deleteByUserId(Long userId) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("user_id", userId); + baseDao.delete(wrapper); } + @Override + public Long selectCountByUserId(Long userId) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("user_id", userId); + return baseDao.selectCount(wrapper); + } + + @Override + public void deleteByAgentId(String agentId) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("agent_id", agentId); + baseDao.delete(wrapper); + } + + @Override + public PageData page(DevicePageUserDTO dto) { + Map params = new HashMap(); + params.put(Constant.PAGE, dto.getPage()); + params.put(Constant.LIMIT, dto.getLimit()); + IPage page = baseDao.selectPage( + getPage(params, "mac_address", true), + // 定义查询条件 + new QueryWrapper() + // 必须设备关键词查找 + .like(StringUtils.isNotBlank(dto.getKeywords()), "alias", dto.getKeywords())); + // 循环处理page获取回来的数据,返回需要的字段 + List list = page.getRecords().stream().map(device -> { + UserShowDeviceListVO vo = ConvertUtils.sourceToTarget(device, UserShowDeviceListVO.class); + // 把最后修改的时间,改为简短描述的时间 + vo.setRecentChatTime(DateUtils.getShortTime(device.getUpdateDate())); + sysUserUtilService.assignUsername(device.getUserId(), + vo::setBindUserName); + vo.setDeviceType(device.getBoard()); + return vo; + }).toList(); + // 计算页数 + return new PageData<>(list, page.getTotal()); + } + + @Override + public DeviceEntity getDeviceByMacAddress(String macAddress) { + if (StringUtils.isBlank(macAddress)) { + return null; + } + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("mac_address", macAddress); + return baseDao.selectOne(wrapper); + } + + private DeviceReportRespDTO.ServerTime buildServerTime() { + DeviceReportRespDTO.ServerTime serverTime = new DeviceReportRespDTO.ServerTime(); + TimeZone tz = TimeZone.getDefault(); + serverTime.setTimestamp(Instant.now().toEpochMilli()); + serverTime.setTimeZone(tz.getID()); + serverTime.setTimezone_offset(tz.getOffset(System.currentTimeMillis()) / (60 * 1000)); + return serverTime; + } + + @Override + public String geCodeByDeviceId(String deviceId) { + String dataKey = getDeviceCacheKey(deviceId); + + Map cacheMap = (Map) redisUtils.get(dataKey); + if (cacheMap != null && cacheMap.containsKey("activation_code")) { + String cachedCode = (String) cacheMap.get("activation_code"); + return cachedCode; + } + return null; + } + + @Override + public Date getLatestLastConnectionTime(String agentId) { + // 查询是否有缓存时间,有则返回 + Date cachedDate = (Date) redisUtils.get(RedisKeys.getAgentDeviceLastConnectedAtById(agentId)); + if (cachedDate != null) { + return cachedDate; + } + Date maxDate = deviceDao.getAllLastConnectedAtByAgentId(agentId); + if (maxDate != null) { + redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), maxDate); + } + return maxDate; + } + + private String getDeviceCacheKey(String deviceId) { + String safeDeviceId = deviceId.replace(":", "_").toLowerCase(); + String dataKey = String.format("ota:activation:data:%s", safeDeviceId); + return dataKey; + } + + public DeviceReportRespDTO.Activation buildActivation(String deviceId, DeviceReportReqDTO deviceReport) { + DeviceReportRespDTO.Activation code = new DeviceReportRespDTO.Activation(); + + String cachedCode = geCodeByDeviceId(deviceId); + + if (StringUtils.isNotBlank(cachedCode)) { + code.setCode(cachedCode); + String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true); + code.setMessage(frontedUrl + "\n" + cachedCode); + code.setChallenge(deviceId); + } else { + String newCode = RandomUtil.randomNumbers(6); + code.setCode(newCode); + String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true); + code.setMessage(frontedUrl + "\n" + newCode); + code.setChallenge(deviceId); + + Map dataMap = new HashMap<>(); + dataMap.put("id", deviceId); + dataMap.put("mac_address", deviceId); + + dataMap.put("board", (deviceReport.getBoard() != null && deviceReport.getBoard().getType() != null) + ? deviceReport.getBoard().getType() + : (deviceReport.getChipModelName() != null ? deviceReport.getChipModelName() : "unknown")); + dataMap.put("app_version", (deviceReport.getApplication() != null) + ? deviceReport.getApplication().getVersion() + : null); + + dataMap.put("deviceId", deviceId); + dataMap.put("activation_code", newCode); + + // 写入主数据 key + String dataKey = getDeviceCacheKey(deviceId); + redisUtils.set(dataKey, dataMap); + + // 写入反查激活码 key + String codeKey = "ota:activation:code:" + newCode; + redisUtils.set(codeKey, deviceId); + } + return code; + } + + private DeviceReportRespDTO.Firmware buildFirmwareInfo(String type, String currentVersion) { + if (StringUtils.isBlank(type)) { + return null; + } + if (StringUtils.isBlank(currentVersion)) { + currentVersion = "0.0.0"; + } + + OtaEntity ota = otaService.getLatestOta(type); + DeviceReportRespDTO.Firmware firmware = new DeviceReportRespDTO.Firmware(); + String downloadUrl = null; + + if (ota != null) { + // 如果设备没有版本信息,或者OTA版本比设备版本新,则返回下载地址 + if (compareVersions(ota.getVersion(), currentVersion) > 0) { + String otaUrl = sysParamsService.getValue(Constant.SERVER_OTA, true); + if (StringUtils.isBlank(otaUrl) || otaUrl.equals("null")) { + log.error("OTA地址未配置,请登录智控台,在参数管理找到【server.ota】配置"); + // 尝试从请求中获取 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder + .getRequestAttributes()) + .getRequest(); + otaUrl = request.getRequestURL().toString(); + } + // 将URL中的/ota/替换为/otaMag/download/ + String uuid = UUID.randomUUID().toString(); + redisUtils.set(RedisKeys.getOtaIdKey(uuid), ota.getId()); + downloadUrl = otaUrl.replace("/ota/", "/otaMag/download/") + uuid; + } + } + + firmware.setVersion(ota == null ? currentVersion : ota.getVersion()); + firmware.setUrl(downloadUrl == null ? "" : downloadUrl); + return firmware; + } + + /** + * 比较两个版本号 + * + * @param version1 版本1 + * @param version2 版本2 + * @return 如果version1 > version2返回1,version1 < version2返回-1,相等返回0 + */ + private static int compareVersions(String version1, String version2) { + if (version1 == null || version2 == null) { + return 0; + } + + String[] v1Parts = version1.split("\\."); + String[] v2Parts = version2.split("\\."); + + int length = Math.max(v1Parts.length, v2Parts.length); + for (int i = 0; i < length; i++) { + int v1 = i < v1Parts.length ? Integer.parseInt(v1Parts[i]) : 0; + int v2 = i < v2Parts.length ? Integer.parseInt(v2Parts[i]) : 0; + + if (v1 > v2) { + return 1; + } else if (v1 < v2) { + return -1; + } + } + return 0; + } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/OtaServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/OtaServiceImpl.java new file mode 100644 index 000000000..ed9e8c7fa --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/OtaServiceImpl.java @@ -0,0 +1,85 @@ +package xiaozhi.modules.device.service.impl; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import io.micrometer.common.util.StringUtils; +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.impl.BaseServiceImpl; +import xiaozhi.modules.device.dao.OtaDao; +import xiaozhi.modules.device.entity.OtaEntity; +import xiaozhi.modules.device.service.OtaService; + +@Service +public class OtaServiceImpl extends BaseServiceImpl implements OtaService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, "update_date", true), + getWrapper(params)); + + return new PageData<>(page.getRecords(), page.getTotal()); + } + + private QueryWrapper getWrapper(Map params) { + String firmwareName = (String) params.get("firmwareName"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.like(StringUtils.isNotBlank(firmwareName), "firmware_name", firmwareName); + + return wrapper; + } + + @Override + public void update(OtaEntity entity) { + // 检查是否存在相同类型和版本的固件(排除当前记录) + QueryWrapper queryWrapper = new QueryWrapper() + .eq("type", entity.getType()) + .eq("version", entity.getVersion()) + .ne("id", entity.getId()); // 排除当前记录 + + if (baseDao.selectCount(queryWrapper) > 0) { + throw new RuntimeException("已存在相同类型和版本的固件,请修改后重试"); + } + + entity.setUpdateDate(new Date()); + baseDao.updateById(entity); + } + + @Override + public void delete(String[] ids) { + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public boolean save(OtaEntity entity) { + QueryWrapper queryWrapper = new QueryWrapper() + .eq("type", entity.getType()); + // 同类固件只保留最新的一条 + List otaList = baseDao.selectList(queryWrapper); + if (otaList != null && otaList.size() > 0) { + OtaEntity otaBefore = otaList.getFirst(); + entity.setId(otaBefore.getId()); + baseDao.updateById(entity); + return true; + } + return baseDao.insert(entity) > 0; + } + + @Override + public OtaEntity getLatestOta(String type) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("type", type) + .orderByDesc("update_date") + .last("LIMIT 1"); + return baseDao.selectOne(wrapper); + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/vo/DeviceOtaVO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/vo/DeviceOtaVO.java new file mode 100644 index 000000000..ec8e405ec --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/vo/DeviceOtaVO.java @@ -0,0 +1,59 @@ +package xiaozhi.modules.device.vo; + +import lombok.Data; + +@Data +public class DeviceOtaVO { + private Activation activation; + private Mqtt mqtt; + private ServerTime server_time; + private Firmware firmware; + private String error; + + @Data + public static class Activation { + private String code; + private String message; + + public Activation() { + } + + public Activation(String code, String message) { + this.code = code; + this.message = message; + } + } + + @Data + public class Mqtt { + + } + + @Data + public static class ServerTime { + private Long timestamp; + private Integer timezone_offset; + + public ServerTime() { + } + + public ServerTime(Long timestamp, Integer timezone_offset) { + this.timestamp = timestamp; + this.timezone_offset = timezone_offset; + } + } + + @Data + public static class Firmware { + private String version; + private String url; + + public Firmware() { + } + + public Firmware(String version, String url) { + this.version = version; + this.url = url; + } + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/vo/UserShowDeviceListVO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/vo/UserShowDeviceListVO.java new file mode 100644 index 000000000..e3a5d8fd1 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/device/vo/UserShowDeviceListVO.java @@ -0,0 +1,31 @@ +package xiaozhi.modules.device.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "用户显示设备列表VO") +public class UserShowDeviceListVO { + + @Schema(description = "app版本") + private String appVersion; + + @Schema(description = "绑定用户名称") + private String bindUserName; + + @Schema(description = "设备型号") + private String deviceType; + + @Schema(description = "设备唯一标识符") + private String id; + + @Schema(description = "mac地址") + private String macAddress; + + @Schema(description = "开启OTA") + private Integer otaUpgrade; + + @Schema(description = "最近对话时间") + private String recentChatTime; + +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelConfigController.java~ b/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelConfigController.java~ deleted file mode 100644 index d1693839a..000000000 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelConfigController.java~ +++ /dev/null @@ -1,2 +0,0 @@ -package xiaozhi.modules.model.controller;public class ModelConfigController { -} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelController.java b/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelController.java index f743a7959..8baff29d6 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/controller/ModelController.java @@ -1,19 +1,35 @@ package xiaozhi.modules.model.controller; +import java.util.List; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.web.bind.annotation.*; import xiaozhi.common.page.PageData; +import xiaozhi.common.utils.ConvertUtils; import xiaozhi.common.utils.Result; +import xiaozhi.modules.agent.service.AgentTemplateService; +import xiaozhi.modules.config.service.ConfigService; +import xiaozhi.modules.model.dto.ModelBasicInfoDTO; import xiaozhi.modules.model.dto.ModelConfigBodyDTO; import xiaozhi.modules.model.dto.ModelConfigDTO; import xiaozhi.modules.model.dto.ModelProviderDTO; +import xiaozhi.modules.model.dto.VoiceDTO; +import xiaozhi.modules.model.entity.ModelConfigEntity; import xiaozhi.modules.model.service.ModelConfigService; import xiaozhi.modules.model.service.ModelProviderService; - -import java.util.List; +import xiaozhi.modules.timbre.service.TimbreService; @AllArgsConstructor @RestController @@ -22,16 +38,18 @@ import java.util.List; public class ModelController { private final ModelProviderService modelProviderService; - + private final TimbreService timbreService; private final ModelConfigService modelConfigService; + private final ConfigService configService; + private final AgentTemplateService agentTemplateService; - @GetMapping("/models/names") + @GetMapping("/names") @Operation(summary = "获取所有模型名称") - @RequiresPermissions("sys:role:superAdmin") - public Result> getModelNames(@RequestParam String modelType, - @RequestParam(required = false) String modelName) { - List modelNameList = modelConfigService.getModelCodeList(modelType, modelName); - return new Result>().ok(modelNameList); + @RequiresPermissions("sys:role:normal") + public Result> getModelNames(@RequestParam String modelType, + @RequestParam(required = false) String modelName) { + List modelList = modelConfigService.getModelCodeList(modelType, modelName); + return new Result>().ok(modelList); } @GetMapping("/{modelType}/provideTypes") @@ -42,65 +60,98 @@ public class ModelController { return new Result>().ok(modelProviderDTOS); } - @GetMapping("/{modelType}/{provideCode}/fields") - @Operation(summary = "获取模型供应器字段") - @RequiresPermissions("sys:role:superAdmin") - public Result> getModelProviderFields(@PathVariable String modelType, @PathVariable String provideCode) { - List fieldList = modelProviderService.getFieldList(modelType, provideCode); - return new Result>().ok(fieldList); - } - - - @GetMapping("/models/list") + @GetMapping("/list") @Operation(summary = "获取模型配置列表") @RequiresPermissions("sys:role:superAdmin") - public Result> getModelConfigList(@RequestParam String modelType, - @RequestParam(required = false) String modelName, - @RequestParam(required = false, defaultValue = "0") Integer page, - @RequestParam(required = false,defaultValue = "10") Integer limit) { + public Result> getModelConfigList( + @RequestParam(required = true) String modelType, + @RequestParam(required = false) String modelName, + @RequestParam(required = true, defaultValue = "0") String page, + @RequestParam(required = true, defaultValue = "10") String limit) { PageData pageList = modelConfigService.getPageList(modelType, modelName, page, limit); return new Result>().ok(pageList); } - - @PostMapping("/models/{modelType}/{provideCode}") + @PostMapping("/{modelType}/{provideCode}") @Operation(summary = "新增模型配置") @RequiresPermissions("sys:role:superAdmin") public Result addModelConfig(@PathVariable String modelType, - @PathVariable String provideCode, - @RequestBody ModelConfigBodyDTO modelConfigBodyDTO) { + @PathVariable String provideCode, + @RequestBody ModelConfigBodyDTO modelConfigBodyDTO) { ModelConfigDTO modelConfigDTO = modelConfigService.add(modelType, provideCode, modelConfigBodyDTO); + configService.getConfig(false); return new Result().ok(modelConfigDTO); } - - @PutMapping("/models/{modelType}/{provideCode}/{id}") + @PutMapping("/{modelType}/{provideCode}/{id}") @Operation(summary = "编辑模型配置") @RequiresPermissions("sys:role:superAdmin") public Result editModelConfig(@PathVariable String modelType, - @PathVariable String provideCode, - @PathVariable String id, - @RequestBody ModelConfigBodyDTO modelConfigBodyDTO) { + @PathVariable String provideCode, + @PathVariable String id, + @RequestBody ModelConfigBodyDTO modelConfigBodyDTO) { ModelConfigDTO modelConfigDTO = modelConfigService.edit(modelType, provideCode, id, modelConfigBodyDTO); + configService.getConfig(false); return new Result().ok(modelConfigDTO); } - - @DeleteMapping("/models/{modelType}/{provideCode}/{id}") + @DeleteMapping("/{id}") @Operation(summary = "删除模型配置") @RequiresPermissions("sys:role:superAdmin") - public Result deleteModelConfig(@PathVariable String modelType, @PathVariable String provideCode, @PathVariable String id) { - modelConfigService.delete(modelType, provideCode, id); + public Result deleteModelConfig(@PathVariable String id) { + modelConfigService.delete(id); return new Result<>(); } - @GetMapping("/models/{modelName}/voices") + @GetMapping("/{id}") + @Operation(summary = "获取模型配置") + @RequiresPermissions("sys:role:superAdmin") + public Result getModelConfig(@PathVariable String id) { + ModelConfigEntity item = modelConfigService.selectById(id); + ModelConfigDTO modelConfigDTO = ConvertUtils.sourceToTarget(item, ModelConfigDTO.class); + return new Result().ok(modelConfigDTO); + } + + @PutMapping("/enable/{id}/{status}") + @Operation(summary = "启用/关闭模型配置") + @RequiresPermissions("sys:role:superAdmin") + public Result enableModelConfig(@PathVariable String id, @PathVariable Integer status) { + ModelConfigEntity entity = modelConfigService.selectById(id); + if (entity == null) { + return new Result().error("模型配置不存在"); + } + entity.setIsEnabled(status); + modelConfigService.updateById(entity); + return new Result(); + } + + @PutMapping("/default/{id}") + @Operation(summary = "设置默认模型") + @RequiresPermissions("sys:role:superAdmin") + public Result setDefaultModel(@PathVariable String id) { + ModelConfigEntity entity = modelConfigService.selectById(id); + if (entity == null) { + return new Result().error("模型配置不存在"); + } + // 将其他模型设置为非默认 + modelConfigService.setDefaultModel(entity.getModelType(), 0); + entity.setIsEnabled(1); + entity.setIsDefault(1); + modelConfigService.updateById(entity); + + // 更新模板表中对应的模型ID + agentTemplateService.updateDefaultTemplateModelId(entity.getModelType(), entity.getId()); + + configService.getConfig(false); + return new Result(); + } + + @GetMapping("/{modelId}/voices") @Operation(summary = "获取模型音色") @RequiresPermissions("sys:role:normal") - public Result> getVoiceList(@PathVariable String modelName, - @RequestParam(required = false) String voiceName) { - - List voiceList = modelConfigService.getVoiceList(modelName, voiceName); - return new Result>().ok(voiceList); + public Result> getVoiceList(@PathVariable String modelId, + @RequestParam(required = false) String voiceName) { + List voiceList = timbreService.getVoiceNames(modelId, voiceName); + return new Result>().ok(voiceList); } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelConfigDao.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelConfigDao.java index a35967e4b..79c526f06 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelConfigDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelConfigDao.java @@ -1,12 +1,13 @@ package xiaozhi.modules.model.dao; +import java.util.List; + import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import xiaozhi.common.dao.BaseDao; import xiaozhi.modules.model.entity.ModelConfigEntity; -import java.util.List; - @Mapper public interface ModelConfigDao extends BaseDao { diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelProviderDao.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelProviderDao.java index 51042e8d9..68e418586 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelProviderDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dao/ModelProviderDao.java @@ -1,14 +1,15 @@ package xiaozhi.modules.model.dao; +import java.util.List; + import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import xiaozhi.common.dao.BaseDao; import xiaozhi.modules.model.entity.ModelProviderEntity; -import java.util.List; - @Mapper public interface ModelProviderDao extends BaseDao { - List getFieldList(@Param("modelType") String modelType, @Param("provideCode") String provideCode); + List getFieldList(@Param("modelType") String modelType, @Param("providerCode") String providerCode); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelBasicInfoDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelBasicInfoDTO.java new file mode 100644 index 000000000..571c791ab --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelBasicInfoDTO.java @@ -0,0 +1,9 @@ +package xiaozhi.modules.model.dto; + +import lombok.Data; + +@Data +public class ModelBasicInfoDTO { + private String id; + private String modelName; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigBodyDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigBodyDTO.java index 639e19a29..07758def1 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigBodyDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigBodyDTO.java @@ -1,10 +1,11 @@ package xiaozhi.modules.model.dto; +import java.io.Serial; + +import cn.hutool.json.JSONObject; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.io.Serial; - @Data @Schema(description = "模型供应器/商") public class ModelConfigBodyDTO { @@ -12,9 +13,9 @@ public class ModelConfigBodyDTO { @Serial private static final long serialVersionUID = 1L; -// @Schema(description = "模型类型(Memory/ASR/VAD/LLM/TTS)") -// private String modelType; -// + // @Schema(description = "模型类型(Memory/ASR/VAD/LLM/TTS)") + // private String modelType; + // @Schema(description = "模型编码(如AliLLM、DoubaoTTS)") private String modelCode; @@ -28,7 +29,7 @@ public class ModelConfigBodyDTO { private Integer isEnabled; @Schema(description = "模型配置(JSON格式)") - private String configJson; + private JSONObject configJson; @Schema(description = "官方文档链接") private String docLink; diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigDTO.java index 95a449211..ed73e1ff8 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelConfigDTO.java @@ -1,11 +1,12 @@ package xiaozhi.modules.model.dto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import java.io.Serial; import java.io.Serializable; +import cn.hutool.json.JSONObject; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + @Data @Schema(description = "模型供应器/商") public class ModelConfigDTO implements Serializable { @@ -14,7 +15,7 @@ public class ModelConfigDTO implements Serializable { private static final long serialVersionUID = 1L; @Schema(description = "主键") - private Long id; + private String id; @Schema(description = "模型类型(Memory/ASR/VAD/LLM/TTS)") private String modelType; @@ -32,7 +33,7 @@ public class ModelConfigDTO implements Serializable { private Integer isEnabled; @Schema(description = "模型配置(JSON格式)") - private String configJson; + private JSONObject configJson; @Schema(description = "官方文档链接") private String docLink; diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelProviderDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelProviderDTO.java index acce30365..605ed13a8 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelProviderDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/ModelProviderDTO.java @@ -1,19 +1,21 @@ package xiaozhi.modules.model.dto; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import java.io.Serializable; import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + @Data @Schema(description = "模型供应器/商") public class ModelProviderDTO implements Serializable { -// -// @Schema(description = "主键") -// private Long id; + // + // @Schema(description = "主键") + // private Long id; @Schema(description = "模型类型(Memory/ASR/VAD/LLM/TTS)") private String modelType; @@ -31,15 +33,19 @@ public class ModelProviderDTO implements Serializable { @Schema(description = "排序") private Integer sort; - @Schema(description = "创建者") - private Long creator; - - @Schema(description = "创建时间") - private Date createDate; - @Schema(description = "更新者") + @TableField(fill = FieldFill.UPDATE) private Long updater; @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) private Date updateDate; + + @Schema(description = "创建者") + @TableField(fill = FieldFill.INSERT) + private Long creator; + + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createDate; } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/dto/VoiceDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/VoiceDTO.java new file mode 100644 index 000000000..25358eb05 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/dto/VoiceDTO.java @@ -0,0 +1,22 @@ +package xiaozhi.modules.model.dto; + +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "音色信息") +public class VoiceDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "音色ID") + private String id; + + @Schema(description = "音色名称") + private String name; +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelConfigEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelConfigEntity.java index c98705f3a..32ff911fb 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelConfigEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelConfigEntity.java @@ -1,18 +1,20 @@ package xiaozhi.modules.model.entity; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; + +import cn.hutool.json.JSONObject; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.util.Date; - - @Data -@TableName("ai_model_config") +@TableName(value = "ai_model_config", autoResultMap = true) @Schema(description = "模型配置表") public class ModelConfigEntity { @@ -37,7 +39,7 @@ public class ModelConfigEntity { @TableField(typeHandler = JacksonTypeHandler.class) @Schema(description = "模型配置(JSON格式)") - private String configJson; + private JSONObject configJson; @Schema(description = "官方文档链接") private String docLink; @@ -48,15 +50,19 @@ public class ModelConfigEntity { @Schema(description = "排序") private Integer sort; - @Schema(description = "创建者") - private Long creator; - - @Schema(description = "创建时间") - private Date createDate; - @Schema(description = "更新者") + @TableField(fill = FieldFill.UPDATE) private Long updater; @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) private Date updateDate; + + @Schema(description = "创建者") + @TableField(fill = FieldFill.INSERT) + private Long creator; + + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createDate; } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelProviderEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelProviderEntity.java index 0c526b88f..62e84f67b 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelProviderEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/entity/ModelProviderEntity.java @@ -1,15 +1,16 @@ package xiaozhi.modules.model.entity; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.util.Date; - @Data @TableName("ai_model_provider") @Schema(description = "模型供应器表") diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelConfigService.java b/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelConfigService.java index 1911be78e..9d15ac6df 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelConfigService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelConfigService.java @@ -1,22 +1,48 @@ package xiaozhi.modules.model.service; -import xiaozhi.common.page.PageData; -import xiaozhi.modules.model.dto.ModelConfigBodyDTO; -import xiaozhi.modules.model.dto.ModelConfigDTO; - import java.util.List; -public interface ModelConfigService { +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.BaseService; +import xiaozhi.modules.model.dto.ModelBasicInfoDTO; +import xiaozhi.modules.model.dto.ModelConfigBodyDTO; +import xiaozhi.modules.model.dto.ModelConfigDTO; +import xiaozhi.modules.model.entity.ModelConfigEntity; - List getModelCodeList(String modelType, String modelName); +public interface ModelConfigService extends BaseService { - PageData getPageList(String modelType, String modelName, Integer page, Integer limit); + List getModelCodeList(String modelType, String modelName); + + PageData getPageList(String modelType, String modelName, String page, String limit); ModelConfigDTO add(String modelType, String provideCode, ModelConfigBodyDTO modelConfigBodyDTO); ModelConfigDTO edit(String modelType, String provideCode, String id, ModelConfigBodyDTO modelConfigBodyDTO); - void delete(String modelType, String provideCode, String id); + void delete(String id); - List getVoiceList(String modelName, String voiceName); + /** + * 根据ID获取模型名称 + * + * @param id 模型ID + * @return 模型名称 + */ + String getModelNameById(String id); + + /** + * 根据ID获取模型配置 + * + * @param id 模型ID + * @param isCache 是否缓存 + * @return 模型配置实体 + */ + ModelConfigEntity getModelById(String id, boolean isCache); + + /** + * 设置默认模型 + * + * @param modelType 模型类型 + * @param isDefault 是否默认 + */ + void setDefaultModel(String modelType, int isDefault); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelProviderService.java b/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelProviderService.java index d0d221cff..2ace101ea 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelProviderService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/service/ModelProviderService.java @@ -1,13 +1,13 @@ package xiaozhi.modules.model.service; +import java.util.List; + import xiaozhi.modules.model.dto.ModelProviderDTO; import xiaozhi.modules.model.entity.ModelProviderEntity; -import java.util.List; - public interface ModelProviderService { -// List getModelNames(String modelType, String modelName); + // List getModelNames(String modelType, String modelName); List getListByModelType(String modelType); @@ -18,6 +18,4 @@ public interface ModelProviderService { void delete(); List getList(String modelType, String provideCode); - - List getFieldList(String modelType, String provideCode); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java index a7ba9b102..1f006d935 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java @@ -1,48 +1,59 @@ package xiaozhi.modules.model.service.impl; -import cn.hutool.core.collection.CollectionUtil; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; + +import cn.hutool.core.collection.CollectionUtil; import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; import xiaozhi.common.constant.Constant; import xiaozhi.common.exception.RenException; import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; import xiaozhi.common.service.impl.BaseServiceImpl; import xiaozhi.common.utils.ConvertUtils; +import xiaozhi.modules.agent.dao.AgentDao; +import xiaozhi.modules.agent.entity.AgentEntity; import xiaozhi.modules.model.dao.ModelConfigDao; +import xiaozhi.modules.model.dto.ModelBasicInfoDTO; import xiaozhi.modules.model.dto.ModelConfigBodyDTO; import xiaozhi.modules.model.dto.ModelConfigDTO; import xiaozhi.modules.model.dto.ModelProviderDTO; import xiaozhi.modules.model.entity.ModelConfigEntity; import xiaozhi.modules.model.service.ModelConfigService; import xiaozhi.modules.model.service.ModelProviderService; -import xiaozhi.modules.timbre.service.TimbreService; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; @Service @AllArgsConstructor -public class ModelConfigServiceImpl extends BaseServiceImpl implements ModelConfigService { +public class ModelConfigServiceImpl extends BaseServiceImpl + implements ModelConfigService { private final ModelConfigDao modelConfigDao; private final ModelProviderService modelProviderService; - private final TimbreService timbreService; - - private static final Logger logger = LoggerFactory.getLogger(ModelConfigServiceImpl.class); + private final RedisUtils redisUtils; + private final AgentDao agentDao; @Override - public List getModelCodeList(String modelType, String modelName) { - return modelConfigDao.getModelCodeList(modelType, modelName); + public List getModelCodeList(String modelType, String modelName) { + List entities = modelConfigDao.selectList( + new QueryWrapper() + .eq("model_type", modelType) + .eq("is_enabled", 1) + .like(StringUtils.isNotBlank(modelName), "model_name", "%" + modelName + "%") + .select("id", "model_name")); + return ConvertUtils.sourceToTarget(entities, ModelBasicInfoDTO.class); } @Override - public PageData getPageList(String modelType, String modelName, Integer page, Integer limit) { + public PageData getPageList(String modelType, String modelName, String page, String limit) { Map params = new HashMap(); params.put(Constant.PAGE, page); params.put(Constant.LIMIT, limit); @@ -50,8 +61,7 @@ public class ModelConfigServiceImpl extends BaseServiceImpl() .eq("model_type", modelType) - .like(StringUtils.isNotBlank(modelName), "model_name", modelName) - ); + .like(StringUtils.isNotBlank(modelName), "model_name", "%" + modelName + "%")); return getPageData(modelConfigEntityIPage, ModelConfigDTO.class); } @@ -69,6 +79,7 @@ public class ModelConfigServiceImpl extends BaseServiceImpl providerList = modelProviderService.getList(modelType, provideCode); - if (CollectionUtil.isEmpty(providerList)) { - throw new RenException("供应器不存在"); + public void delete(String id) { + // 查看是否是默认 + ModelConfigEntity modelConfig = modelConfigDao.selectById(id); + if (modelConfig != null && modelConfig.getIsDefault() == 1) { + throw new RenException("该模型为默认模型,请先设置其他模型为默认模型"); } + // 验证是否有引用 + checkAgentReference(id); + checkIntentConfigReference(id); - modelConfigDao.deleteById(Long.getLong(id)); + modelConfigDao.deleteById(id); + } + + /** + * 检查智能体配置是否有引用 + * + * @param modelId 模型ID + */ + private void checkAgentReference(String modelId) { + List agents = agentDao.selectList( + new QueryWrapper() + .eq("vad_model_id", modelId) + .or() + .eq("asr_model_id", modelId) + .or() + .eq("llm_model_id", modelId) + .or() + .eq("tts_model_id", modelId) + .or() + .eq("mem_model_id", modelId) + .or() + .eq("intent_model_id", modelId)); + if (!agents.isEmpty()) { + String agentNames = agents.stream() + .map(AgentEntity::getAgentName) + .collect(Collectors.joining("、")); + throw new RenException(String.format("该模型配置已被智能体[%s]引用,无法删除", agentNames)); + } + } + + /** + * 检查意图识别配置是否有引用 + * + * @param modelId 模型ID + */ + private void checkIntentConfigReference(String modelId) { + ModelConfigEntity modelConfig = modelConfigDao.selectById(modelId); + if (modelConfig != null + && "LLM".equals(modelConfig.getModelType() == null ? null : modelConfig.getModelType().toUpperCase())) { + List intentConfigs = modelConfigDao.selectList( + new QueryWrapper() + .eq("model_type", "Intent") + .like("config_json", "%" + modelId + "%")); + if (!intentConfigs.isEmpty()) { + throw new RenException("该LLM模型已被意图识别配置引用,无法删除"); + } + } } @Override - public List getVoiceList(String modelName, String voiceName) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("model_name", StringUtils.isBlank(modelName) ? "" : modelName); - queryWrapper.eq("model_type", "TTS"); - List modelConfigEntities = modelConfigDao.selectList(queryWrapper); - if (CollectionUtil.isEmpty(modelConfigEntities)) { - logger.warn("没有找到模型配置信息"); + public String getModelNameById(String id) { + if (StringUtils.isBlank(id)) { return null; } - ModelConfigEntity modelConfigEntity = modelConfigEntities.get(0); - String id = modelConfigEntity.getId(); - return timbreService.getVoiceNames(id, voiceName); + String cachedName = (String) redisUtils.get(RedisKeys.getModelNameById(id)); + + if (StringUtils.isNotBlank(cachedName)) { + return cachedName; + } + + ModelConfigEntity entity = modelConfigDao.selectById(id); + if (entity != null) { + String modelName = entity.getModelName(); + if (StringUtils.isNotBlank(modelName)) { + redisUtils.set(RedisKeys.getModelNameById(id), modelName); + } + return modelName; + } + + return null; + } + + @Override + public ModelConfigEntity getModelById(String id, boolean isCache) { + if (StringUtils.isBlank(id)) { + return null; + } + if (isCache) { + ModelConfigEntity cachedConfig = (ModelConfigEntity) redisUtils.get(RedisKeys.getModelConfigById(id)); + if (cachedConfig != null) { + return ConvertUtils.sourceToTarget(cachedConfig, ModelConfigEntity.class); + } + } + ModelConfigEntity entity = modelConfigDao.selectById(id); + if (entity != null) { + redisUtils.set(RedisKeys.getModelConfigById(id), entity); + } + return entity; + } + + @Override + public void setDefaultModel(String modelType, int isDefault) { + ModelConfigEntity entity = new ModelConfigEntity(); + entity.setIsDefault(isDefault); + modelConfigDao.update(entity, new QueryWrapper() + .eq("model_type", modelType)); } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelProviderServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelProviderServiceImpl.java index 042749d93..fb06e4d5d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelProviderServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelProviderServiceImpl.java @@ -1,9 +1,13 @@ package xiaozhi.modules.model.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import lombok.AllArgsConstructor; +import java.util.List; + import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + +import lombok.AllArgsConstructor; import xiaozhi.common.service.impl.BaseServiceImpl; import xiaozhi.common.utils.ConvertUtils; import xiaozhi.modules.model.dao.ModelProviderDao; @@ -11,11 +15,10 @@ import xiaozhi.modules.model.dto.ModelProviderDTO; import xiaozhi.modules.model.entity.ModelProviderEntity; import xiaozhi.modules.model.service.ModelProviderService; -import java.util.List; - @Service @AllArgsConstructor -public class ModelProviderServiceImpl extends BaseServiceImpl implements ModelProviderService { +public class ModelProviderServiceImpl extends BaseServiceImpl + implements ModelProviderService { private final ModelProviderDao modelProviderDao; @@ -44,16 +47,11 @@ public class ModelProviderServiceImpl extends BaseServiceImpl getList(String modelType, String provideCode) { + public List getList(String modelType, String providerCode) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("model_type", StringUtils.isBlank(modelType) ? "" : modelType); - queryWrapper.eq("provide_code", StringUtils.isBlank(provideCode) ? "" : provideCode); + queryWrapper.eq("provider_code", StringUtils.isBlank(providerCode) ? "" : providerCode); List providerEntities = modelProviderDao.selectList(queryWrapper); return ConvertUtils.sourceToTarget(providerEntities, ModelProviderDTO.class); } - - @Override - public List getFieldList(String modelType, String provideCode) { - return modelProviderDao.getFieldList(modelType, provideCode); - } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/config/FilterConfig.java b/main/manager-api/src/main/java/xiaozhi/modules/security/config/FilterConfig.java index 607cb68b5..d74ed08ba 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/config/FilterConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/config/FilterConfig.java @@ -5,7 +5,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.filter.DelegatingFilterProxy; - /** * Filter配置 * Copyright (c) 人人开源 All rights reserved. @@ -18,7 +17,7 @@ public class FilterConfig { public FilterRegistrationBean shiroFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(new DelegatingFilterProxy("shiroFilter")); - //该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理 + // 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理 registration.addInitParameter("targetFilterLifecycle", "true"); registration.setEnabled(true); registration.setOrder(Integer.MAX_VALUE - 1); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/config/ShiroConfig.java b/main/manager-api/src/main/java/xiaozhi/modules/security/config/ShiroConfig.java index de25d80eb..5252336fc 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/config/ShiroConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/config/ShiroConfig.java @@ -1,8 +1,9 @@ package xiaozhi.modules.security.config; -import xiaozhi.modules.security.oauth2.Oauth2Filter; -import xiaozhi.modules.security.oauth2.Oauth2Realm; -import jakarta.servlet.Filter; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.session.mgt.SessionManager; import org.apache.shiro.spring.LifecycleBeanPostProcessor; @@ -14,9 +15,11 @@ import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; +import jakarta.servlet.Filter; +import xiaozhi.modules.security.oauth2.Oauth2Filter; +import xiaozhi.modules.security.oauth2.Oauth2Realm; +import xiaozhi.modules.security.secret.ServerSecretFilter; +import xiaozhi.modules.sys.service.SysParamsService; /** * Shiro的配置文件 @@ -45,7 +48,7 @@ public class ShiroConfig { } @Bean("shiroFilter") - public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) { + public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager, SysParamsService sysParamsService) { ShiroFilterConfiguration config = new ShiroFilterConfiguration(); config.setFilterOncePerRequest(true); @@ -53,18 +56,24 @@ public class ShiroConfig { shiroFilter.setSecurityManager(securityManager); shiroFilter.setShiroFilterConfiguration(config); - //oauth过滤 Map filters = new HashMap<>(); + // oauth过滤 filters.put("oauth2", new Oauth2Filter()); + // 服务密钥过滤 + filters.put("server", new ServerSecretFilter(sysParamsService)); shiroFilter.setFilters(filters); - //添加Shiro的内置过滤器 - /*anon:无需认证就可以访问 - authc:必须认证了才能让问 - user:必须拥有,记住我功能,才能访问 - perms:拥有对某个资源的权限才能访问 - role:拥有某个角色权限才能访问*/ + // 添加Shiro的内置过滤器 + /* + * anon:无需认证就可以访问 + * authc:必须认证了才能让问 + * user:必须拥有,记住我功能,才能访问 + * perms:拥有对某个资源的权限才能访问 + * role:拥有某个角色权限才能访问 + */ Map filterMap = new LinkedHashMap<>(); + filterMap.put("/ota/**", "anon"); + filterMap.put("/otaMag/download/**", "anon"); filterMap.put("/webjars/**", "anon"); filterMap.put("/druid/**", "anon"); filterMap.put("/v3/api-docs/**", "anon"); @@ -72,7 +81,12 @@ public class ShiroConfig { filterMap.put("/favicon.ico", "anon"); filterMap.put("/user/captcha", "anon"); filterMap.put("/user/login", "anon"); + filterMap.put("/user/pub-config", "anon"); filterMap.put("/user/register", "anon"); + // 将config路径使用server服务过滤器 + filterMap.put("/config/**", "server"); + filterMap.put("/agent/chat-history/report", "server"); + filterMap.put("/agent/play/**", "anon"); filterMap.put("/**", "oauth2"); shiroFilter.setFilterChainDefinitionMap(filterMap); @@ -90,4 +104,4 @@ public class ShiroConfig { advisor.setSecurityManager(securityManager); return advisor; } -} \ No newline at end of file +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/config/WebMvcConfig.java b/main/manager-api/src/main/java/xiaozhi/modules/security/config/WebMvcConfig.java index a086e9536..02538caf7 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/config/WebMvcConfig.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/config/WebMvcConfig.java @@ -1,9 +1,9 @@ package xiaozhi.modules.security.config; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.TimeZone; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.ByteArrayHttpMessageConverter; @@ -15,8 +15,19 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.List; -import java.util.TimeZone; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; + +import xiaozhi.common.utils.DateUtils; @Configuration public class WebMvcConfig implements WebMvcConfigurer { @@ -32,11 +43,15 @@ public class WebMvcConfig implements WebMvcConfigurer { @Override public void configureMessageConverters(List> converters) { + // 特殊用途的转换器 converters.add(new ByteArrayHttpMessageConverter()); - converters.add(new StringHttpMessageConverter()); converters.add(new ResourceHttpMessageConverter()); - converters.add(new AllEncompassingFormHttpMessageConverter()); + + // 通用转换器 converters.add(new StringHttpMessageConverter()); + converters.add(new AllEncompassingFormHttpMessageConverter()); + + // JSON 转换器 converters.add(jackson2HttpMessageConverter()); } @@ -45,14 +60,33 @@ public class WebMvcConfig implements WebMvcConfigurer { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); ObjectMapper mapper = new ObjectMapper(); - //忽略未知属性 + // 忽略未知属性 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - //日期格式转换 - //mapper.setDateFormat(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN)); + // 设置时区 mapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); - //Long类型转String类型 + // 配置Java8日期时间序列化 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + javaTimeModule.addSerializer(java.time.LocalDateTime.class, new LocalDateTimeSerializer( + java.time.format.DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN))); + javaTimeModule.addSerializer(java.time.LocalDate.class, new LocalDateSerializer( + java.time.format.DateTimeFormatter.ofPattern(DateUtils.DATE_PATTERN))); + javaTimeModule.addSerializer(java.time.LocalTime.class, + new LocalTimeSerializer(java.time.format.DateTimeFormatter.ofPattern("HH:mm:ss"))); + javaTimeModule.addDeserializer(java.time.LocalDateTime.class, new LocalDateTimeDeserializer( + java.time.format.DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN))); + javaTimeModule.addDeserializer(java.time.LocalDate.class, new LocalDateDeserializer( + java.time.format.DateTimeFormatter.ofPattern(DateUtils.DATE_PATTERN))); + javaTimeModule.addDeserializer(java.time.LocalTime.class, + new LocalTimeDeserializer(java.time.format.DateTimeFormatter.ofPattern("HH:mm:ss"))); + mapper.registerModule(javaTimeModule); + + // 配置java.util.Date的序列化和反序列化 + SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); + mapper.setDateFormat(dateFormat); + + // Long类型转String类型 SimpleModule simpleModule = new SimpleModule(); simpleModule.addSerializer(Long.class, ToStringSerializer.instance); simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java b/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java index 6ab9d1b96..7cbaa8af3 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java @@ -1,18 +1,28 @@ package xiaozhi.modules.security.controller; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.*; +import xiaozhi.common.constant.Constant; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; import xiaozhi.common.page.TokenDTO; import xiaozhi.common.user.UserDetail; import xiaozhi.common.utils.Result; import xiaozhi.common.validator.AssertUtils; +import xiaozhi.common.validator.ValidatorUtils; import xiaozhi.modules.security.dto.LoginDTO; import xiaozhi.modules.security.password.PasswordUtils; import xiaozhi.modules.security.service.CaptchaService; @@ -22,8 +32,6 @@ import xiaozhi.modules.sys.dto.PasswordDTO; import xiaozhi.modules.sys.dto.SysUserDTO; import xiaozhi.modules.sys.service.SysUserService; -import java.io.IOException; - /** * 登录控制层 */ @@ -36,14 +44,13 @@ public class LoginController { private final SysUserTokenService sysUserTokenService; private final CaptchaService captchaService; - @GetMapping("/captcha") @Operation(summary = "验证码") public void captcha(HttpServletResponse response, String uuid) throws IOException { - //uuid不能为空 + // uuid不能为空 AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); - //生成验证码 + // 生成验证码 captchaService.create(response, uuid); } @@ -71,6 +78,9 @@ public class LoginController { @PostMapping("/register") @Operation(summary = "注册") public Result register(@RequestBody LoginDTO login) { + if (!sysUserService.getAllowUserRegister()) { + throw new RenException("当前不允许普通用户注册"); + } // 验证是否正确输入验证码 boolean validate = captchaService.validate(login.getCaptchaId(), login.getCaptcha()); if (!validate) { @@ -101,8 +111,19 @@ public class LoginController { @PutMapping("/change-password") @Operation(summary = "修改用户密码") public Result changePassword(@RequestBody PasswordDTO passwordDTO) { + // 判断非空 + ValidatorUtils.validateEntity(passwordDTO); Long userId = SecurityUser.getUserId(); sysUserTokenService.changePassword(userId, passwordDTO); return new Result<>(); } + + @GetMapping("/pub-config") + @Operation(summary = "公共配置") + public Result> pubConfig() { + Map config = new HashMap<>(); + config.put("version", Constant.VERSION); + config.put("allowUserRegister", sysUserService.getAllowUserRegister()); + return new Result>().ok(config); + } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/dao/SysUserTokenDao.java b/main/manager-api/src/main/java/xiaozhi/modules/security/dao/SysUserTokenDao.java index 044568e5f..05f946d32 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/dao/SysUserTokenDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/dao/SysUserTokenDao.java @@ -1,12 +1,13 @@ package xiaozhi.modules.security.dao; +import java.util.Date; + import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import xiaozhi.common.dao.BaseDao; import xiaozhi.modules.security.entity.SysUserTokenEntity; -import java.util.Date; - /** * 系统用户Token * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/dto/LoginDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/security/dto/LoginDTO.java index 2fc0d3b2b..cab143be4 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/dto/LoginDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/dto/LoginDTO.java @@ -1,11 +1,11 @@ package xiaozhi.modules.security.dto; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import java.io.Serializable; - /** * 登录表单 */ diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/entity/SysUserTokenEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/security/entity/SysUserTokenEntity.java index fb96f88c2..2346b5e49 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/entity/SysUserTokenEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/entity/SysUserTokenEntity.java @@ -1,13 +1,14 @@ package xiaozhi.modules.security.entity; +import java.io.Serializable; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; +import lombok.Data; /** * 系统用户Token diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java index 55e3fa036..aad888dfd 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java @@ -1,9 +1,7 @@ package xiaozhi.modules.security.oauth2; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationToken; @@ -11,14 +9,17 @@ import org.apache.shiro.web.filter.authc.AuthenticatingFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RequestMethod; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import xiaozhi.common.constant.Constant; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.utils.HttpContextUtils; import xiaozhi.common.utils.JsonUtils; import xiaozhi.common.utils.Result; -import java.io.IOException; - /** * oauth2过滤器 * Copyright (c) 人人开源 All rights reserved. @@ -30,7 +31,7 @@ public class Oauth2Filter extends AuthenticatingFilter { @Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { - //获取请求token + // 获取请求token String token = getRequestToken((HttpServletRequest) request); if (StringUtils.isBlank(token)) { @@ -52,14 +53,9 @@ public class Oauth2Filter extends AuthenticatingFilter { @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { - //获取请求token,如果token不存在,直接返回401 + // 获取请求token,如果token不存在,直接返回401 String token = getRequestToken((HttpServletRequest) request); - // TODO 调试接口,临时取消登录限制,需要 token 参数的除外 - if (true) { - return true; - } - if (StringUtils.isBlank(token)) { logger.warn("onAccessDenied:token is empty"); @@ -68,7 +64,7 @@ public class Oauth2Filter extends AuthenticatingFilter { httpResponse.setHeader("Access-Control-Allow-Credentials", "true"); httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); - String json = JsonUtils.toJsonString(new Result().error(ErrorCode.UNAUTHORIZED)); + String json = JsonUtils.toJsonString(new Result().error(ErrorCode.UNAUTHORIZED)); httpResponse.getWriter().print(json); @@ -79,21 +75,19 @@ public class Oauth2Filter extends AuthenticatingFilter { } @Override - protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { + protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, + ServletResponse response) { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setContentType("application/json;charset=utf-8"); httpResponse.setHeader("Access-Control-Allow-Credentials", "true"); httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); try { - //处理登录失败的异常 - logger.error("onLoginFailure:登录失败!", e); Throwable throwable = e.getCause() == null ? e : e.getCause(); - Result r = new Result().error(ErrorCode.UNAUTHORIZED, throwable.getMessage()); + Result r = new Result().error(ErrorCode.UNAUTHORIZED, throwable.getMessage()); String json = JsonUtils.toJsonString(r); httpResponse.getWriter().print(json); } catch (IOException e1) { - logger.error("onLoginFailure:登录失败! msg:{}", e1.getMessage(), e1); } return false; @@ -104,7 +98,7 @@ public class Oauth2Filter extends AuthenticatingFilter { */ private String getRequestToken(HttpServletRequest httpRequest) { String token = null; - //从header中获取token + // 从header中获取token String authorization = httpRequest.getHeader(Constant.AUTHORIZATION); if (StringUtils.isNotBlank(authorization) && authorization.startsWith("Bearer ")) { token = authorization.replace("Bearer ", ""); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Realm.java b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Realm.java index 6b04bb08d..27c3bc494 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Realm.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Realm.java @@ -1,7 +1,15 @@ package xiaozhi.modules.security.oauth2; -import jakarta.annotation.Resource; -import org.apache.shiro.authc.*; +import java.util.HashSet; +import java.util.Set; + +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.DisabledAccountException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; @@ -10,6 +18,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; + +import jakarta.annotation.Resource; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.user.UserDetail; import xiaozhi.common.utils.ConvertUtils; @@ -19,9 +29,6 @@ import xiaozhi.modules.security.service.ShiroService; import xiaozhi.modules.sys.entity.SysUserEntity; import xiaozhi.modules.sys.enums.SuperAdminEnum; -import java.util.HashSet; -import java.util.Set; - /** * 认证 * Copyright (c) 人人开源 All rights reserved. @@ -47,7 +54,7 @@ public class Oauth2Realm extends AuthorizingRealm { protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { UserDetail user = (UserDetail) principals.getPrimaryPrincipal(); - //用户权限列表 + // 用户权限列表 Set permsSet = new HashSet<>(); if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { @@ -69,22 +76,22 @@ public class Oauth2Realm extends AuthorizingRealm { protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String accessToken = (String) token.getPrincipal(); - //根据accessToken,查询用户信息 + // 根据accessToken,查询用户信息 SysUserTokenEntity tokenEntity = shiroService.getByToken(accessToken); - //token失效 + // token失效 if (tokenEntity == null || tokenEntity.getExpireDate().getTime() < System.currentTimeMillis()) { throw new IncorrectCredentialsException(MessageUtils.getMessage(ErrorCode.TOKEN_INVALID)); } - //查询用户信息 + // 查询用户信息 SysUserEntity userEntity = shiroService.getUser(tokenEntity.getUserId()); - //转换成UserDetail对象 + // 转换成UserDetail对象 UserDetail userDetail = ConvertUtils.sourceToTarget(userEntity, UserDetail.class); userDetail.setToken(accessToken); - //账号锁定 + // 账号锁定 if (userDetail.getStatus() == null) { logger.error("账号状态异常,status 不能为空"); throw new DisabledAccountException(MessageUtils.getMessage(ErrorCode.ACCOUNT_DISABLE)); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/TokenGenerator.java b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/TokenGenerator.java index 0ca1cede6..6d7be47a0 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/TokenGenerator.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/TokenGenerator.java @@ -1,10 +1,10 @@ package xiaozhi.modules.security.oauth2; -import xiaozhi.common.exception.RenException; - import java.security.MessageDigest; import java.util.UUID; +import xiaozhi.common.exception.RenException; + /** * 生成token * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCrypt.java b/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCrypt.java index 6a9efff97..39d350c5e 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCrypt.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCrypt.java @@ -5,22 +5,28 @@ import java.io.UnsupportedEncodingException; import java.security.SecureRandom; /** - * BCrypt implements OpenBSD-style Blowfish password hashing using the scheme described in + * BCrypt implements OpenBSD-style Blowfish password hashing using the scheme + * described in * "A Future-Adaptable Password Scheme" by Niels Provos and David Mazieres. *

- * This password hashing system tries to thwart off-line password cracking using a - * computationally-intensive hashing algorithm, based on Bruce Schneier's Blowfish cipher. - * The work factor of the algorithm is parameterised, so it can be increased as computers + * This password hashing system tries to thwart off-line password cracking using + * a + * computationally-intensive hashing algorithm, based on Bruce Schneier's + * Blowfish cipher. + * The work factor of the algorithm is parameterised, so it can be increased as + * computers * get faster. *

- * Usage is really simple. To hash a password for the first time, call the hashpw method + * Usage is really simple. To hash a password for the first time, call the + * hashpw method * with a random salt, like this: *

* * String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt());
*
*

- * To check whether a plaintext password matches one that has been hashed previously, use + * To check whether a plaintext password matches one that has been hashed + * previously, use * the checkpw method: *

* @@ -30,7 +36,8 @@ import java.security.SecureRandom; *     System.out.println("It does not match");
*
*

- * The gensalt() method takes an optional parameter (log_rounds) that determines the + * The gensalt() method takes an optional parameter (log_rounds) that determines + * the * computational complexity of the hashing: *

* @@ -38,7 +45,8 @@ import java.security.SecureRandom; * String stronger_salt = BCrypt.gensalt(12)
*
*

- * The amount of work increases exponentially (2**log_rounds), so each increment is twice + * The amount of work increases exponentially (2**log_rounds), so each increment + * is twice * as much work. The default log_rounds is 10, and the valid range is 4 to 31. * * @author Damien Miller @@ -51,11 +59,11 @@ public class BCrypt { // Blowfish parameters private static final int BLOWFISH_NUM_ROUNDS = 16; // Initial contents of key schedule - private static final int P_orig[] = {0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, + private static final int P_orig[] = { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b}; - private static final int S_orig[] = {0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, + 0x9216d5d9, 0x8979fb1b }; + private static final int S_orig[] = { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, @@ -225,24 +233,24 @@ public class BCrypt { 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, - 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}; + 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 }; // bcrypt IV: "OrpheanBeholderScryDoubt" - static private final int bf_crypt_ciphertext[] = {0x4f727068, 0x65616e42, - 0x65686f6c, 0x64657253, 0x63727944, 0x6f756274}; + static private final int bf_crypt_ciphertext[] = { 0x4f727068, 0x65616e42, + 0x65686f6c, 0x64657253, 0x63727944, 0x6f756274 }; // Table for Base64 encoding - static private final char base64_code[] = {'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', + static private final char base64_code[] = { '.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', - 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; // Table for Base64 decoding - static private final byte index_64[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + static private final byte index_64[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1}; + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1 }; static final int MIN_LOG_ROUNDS = 4; static final int MAX_LOG_ROUNDS = 31; // Expanded Blowfish key @@ -250,7 +258,8 @@ public class BCrypt { private int S[]; /** - * Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. Note + * Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. + * Note * that this is not compatible with the standard MIME-base64 * encoding. * @@ -306,7 +315,8 @@ public class BCrypt { } /** - * Decode a string encoded using bcrypt's base64 scheme to a byte array. Note that + * Decode a string encoded using bcrypt's base64 scheme to a byte array. Note + * that * this is *not* compatible with the standard MIME-base64 encoding. * * @param s the string to decode @@ -365,7 +375,7 @@ public class BCrypt { int i, n, l = lr[off], r = lr[off + 1]; l ^= P[0]; - for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2; ) { + for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2;) { // Feistel substitution on left word n = S[(l >> 24) & 0xff]; n += S[0x100 | ((l >> 16) & 0xff)]; @@ -388,7 +398,8 @@ public class BCrypt { * Cycically extract a word of key material * * @param data the string to extract the data from - * @param offp a "pointer" (as a one-entry array) to the current offset into data + * @param offp a "pointer" (as a one-entry array) to the current offset into + * data * @return the next word of material from data */ private static int streamtoword(byte data[], int offp[]) { @@ -420,8 +431,8 @@ public class BCrypt { */ private void key(byte key[]) { int i; - int koffp[] = {0}; - int lr[] = {0, 0}; + int koffp[] = { 0 }; + int lr[] = { 0, 0 }; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { @@ -443,15 +454,16 @@ public class BCrypt { /** * Perform the "enhanced key schedule" step described by Provos and Mazieres in - * "A Future-Adaptable Password Scheme" http://www.openbsd.org/papers/bcrypt-paper.ps + * "A Future-Adaptable Password Scheme" + * http://www.openbsd.org/papers/bcrypt-paper.ps * * @param data salt information * @param key password information */ private void ekskey(byte data[], byte key[]) { int i; - int koffp[] = {0}, doffp[] = {0}; - int lr[] = {0, 0}; + int koffp[] = { 0 }, doffp[] = { 0 }; + int lr[] = { 0, 0 }; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { @@ -487,7 +499,8 @@ public class BCrypt { * * @param password the password to hash * @param salt the binary salt to hash with the password - * @param log_rounds the binary logarithm of the number of rounds of hashing to apply + * @param log_rounds the binary logarithm of the number of rounds of hashing to + * apply * @return an array containing the binary hashed password */ private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) { @@ -524,7 +537,8 @@ public class BCrypt { * Hash a password using the OpenBSD bcrypt scheme * * @param password the password to hash - * @param salt the salt to hash with (perhaps generated using BCrypt.gensalt) + * @param salt the salt to hash with (perhaps generated using + * BCrypt.gensalt) * @return the hashed password * @throws IllegalArgumentException if invalid salt is passed */ @@ -599,8 +613,10 @@ public class BCrypt { /** * Generate a salt for use with the BCrypt.hashpw() method * - * @param log_rounds the log2 of the number of rounds of hashing to apply - the work - * factor therefore increases as 2**log_rounds. Minimum 4, maximum 31. + * @param log_rounds the log2 of the number of rounds of hashing to apply - the + * work + * factor therefore increases as 2**log_rounds. Minimum 4, + * maximum 31. * @param random an instance of SecureRandom to use * @return an encoded salt value */ @@ -626,8 +642,10 @@ public class BCrypt { /** * Generate a salt for use with the BCrypt.hashpw() method * - * @param log_rounds the log2 of the number of rounds of hashing to apply - the work - * factor therefore increases as 2**log_rounds. Minimum 4, maximum 31. + * @param log_rounds the log2 of the number of rounds of hashing to apply - the + * work + * factor therefore increases as 2**log_rounds. Minimum 4, + * maximum 31. * @return an encoded salt value */ public static String gensalt(int log_rounds) { @@ -635,7 +653,8 @@ public class BCrypt { } /** - * Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable + * Generate a salt for use with the BCrypt.hashpw() method, selecting a + * reasonable * default for the number of hashing rounds to apply * * @return an encoded salt value diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCryptPasswordEncoder.java b/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCryptPasswordEncoder.java index 0d570a961..0da907f2b 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCryptPasswordEncoder.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/password/BCryptPasswordEncoder.java @@ -1,15 +1,18 @@ package xiaozhi.modules.security.password; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.security.SecureRandom; import java.util.regex.Pattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** - * Implementation of PasswordEncoder that uses the BCrypt strong hashing function. Clients - * can optionally supply a "strength" (a.k.a. log rounds in BCrypt) and a SecureRandom - * instance. The larger the strength parameter the more work will have to be done + * Implementation of PasswordEncoder that uses the BCrypt strong hashing + * function. Clients + * can optionally supply a "strength" (a.k.a. log rounds in BCrypt) and a + * SecureRandom + * instance. The larger the strength parameter the more work will have to be + * done * (exponentially) to hash the passwords. The default value is 10. * * @author Dave Syer diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordEncoder.java b/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordEncoder.java index 40d1e95c5..2de70cc25 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordEncoder.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordEncoder.java @@ -10,20 +10,23 @@ package xiaozhi.modules.security.password; public interface PasswordEncoder { /** - * Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or + * Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 + * or * greater hash combined with an 8-byte or greater randomly generated salt. */ String encode(CharSequence rawPassword); /** * Verify the encoded password obtained from storage matches the submitted raw - * password after it too is encoded. Returns true if the passwords match, false if + * password after it too is encoded. Returns true if the passwords match, false + * if * they do not. The stored password itself is never decoded. * * @param rawPassword the raw password to encode and match * @param encodedPassword the encoded password from storage to compare with - * @return true if the raw password, after encoding, matches the encoded password from - * storage + * @return true if the raw password, after encoding, matches the encoded + * password from + * storage */ boolean matches(CharSequence rawPassword, String encodedPassword); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordUtils.java b/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordUtils.java index b03570102..9144b3801 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordUtils.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/password/PasswordUtils.java @@ -18,19 +18,17 @@ public class PasswordUtils { return passwordEncoder.encode(str); } - /** * 比较密码是否相等 * * @param str 明文密码 * @param password 加密后密码 - * @return true:成功 false:失败 + * @return true:成功 false:失败 */ public static boolean matches(String str, String password) { return passwordEncoder.matches(str, password); } - public static void main(String[] args) { String str = "admin"; String password = encode(str); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretFilter.java b/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretFilter.java new file mode 100644 index 000000000..b2a18547e --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretFilter.java @@ -0,0 +1,105 @@ +package xiaozhi.modules.security.secret; + +import java.io.IOException; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.web.filter.authc.AuthenticatingFilter; +import org.springframework.web.bind.annotation.RequestMethod; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.exception.ErrorCode; +import xiaozhi.common.utils.HttpContextUtils; +import xiaozhi.common.utils.JsonUtils; +import xiaozhi.common.utils.Result; +import xiaozhi.modules.sys.service.SysParamsService; + +/** + * Config API 过滤器 + */ +@Slf4j +@RequiredArgsConstructor +public class ServerSecretFilter extends AuthenticatingFilter { + private final SysParamsService sysParamsService; + + @Override + protected ServerSecretToken createToken(ServletRequest request, ServletResponse response) { + // 获取请求token + String token = getRequestToken((HttpServletRequest) request); + + if (StringUtils.isBlank(token)) { + log.warn("createToken:token is empty"); + return null; + } + + return new ServerSecretToken(token); + } + + @Override + protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { + // 对OPTIONS请求放行 + if (((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())) { + return true; + } + return false; + } + + @Override + protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + // 获取token并校验 + String token = getRequestToken((HttpServletRequest) servletRequest); + if (StringUtils.isBlank(token)) { + // token为空,返回401 + this.sendUnauthorizedResponse((HttpServletResponse) servletResponse, "服务器密钥不能为空"); + return false; + } + + // 验证token是否匹配 + String serverSecret = getServerSecret(); + if (StringUtils.isBlank(serverSecret) || !serverSecret.equals(token)) { + // token无效,返回401 + this.sendUnauthorizedResponse((HttpServletResponse) servletResponse, "无效的服务器密钥"); + return false; + } + + return true; + } + + /** + * 发送未授权响应 + */ + private void sendUnauthorizedResponse(HttpServletResponse response, String message) { + response.setContentType("application/json;charset=utf-8"); + response.setHeader("Access-Control-Allow-Credentials", "true"); + response.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); + + try { + String json = JsonUtils.toJsonString(new Result().error(ErrorCode.UNAUTHORIZED, message)); + response.getWriter().print(json); + } catch (IOException e) { + log.error("响应输出失败", e); + } + } + + /** + * 获取请求的token + */ + private String getRequestToken(HttpServletRequest httpRequest) { + String token = null; + // 从header中获取token + String authorization = httpRequest.getHeader("Authorization"); + if (StringUtils.isNotBlank(authorization) && authorization.startsWith("Bearer ")) { + token = authorization.replace("Bearer ", ""); + } + return token; + } + + private String getServerSecret() { + return sysParamsService.getValue(Constant.SERVER_SECRET, true); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretToken.java b/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretToken.java new file mode 100644 index 000000000..9072eaf8c --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/secret/ServerSecretToken.java @@ -0,0 +1,25 @@ +package xiaozhi.modules.security.secret; + +import org.apache.shiro.authc.AuthenticationToken; + +/** + * Config API Token + */ +public class ServerSecretToken implements AuthenticationToken { + private static final long serialVersionUID = 1L; + private final String token; + + public ServerSecretToken(String token) { + this.token = token; + } + + @Override + public Object getPrincipal() { + return token; + } + + @Override + public Object getCredentials() { + return token; + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/service/CaptchaService.java b/main/manager-api/src/main/java/xiaozhi/modules/security/service/CaptchaService.java index b91d5d9ab..9e5c153fe 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/service/CaptchaService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/service/CaptchaService.java @@ -1,9 +1,9 @@ package xiaozhi.modules.security.service; -import jakarta.servlet.http.HttpServletResponse; - import java.io.IOException; +import jakarta.servlet.http.HttpServletResponse; + /** * 验证码 * Copyright (c) 人人开源 All rights reserved. @@ -21,7 +21,7 @@ public interface CaptchaService { * * @param uuid uuid * @param code 验证码 - * @return true:成功 false:失败 + * @return true:成功 false:失败 */ boolean validate(String uuid, String code); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/CaptchaServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/CaptchaServiceImpl.java index 761ad1399..012b4d3e5 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/CaptchaServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/CaptchaServiceImpl.java @@ -1,23 +1,22 @@ package xiaozhi.modules.security.service.impl; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.wf.captcha.SpecCaptcha; import com.wf.captcha.base.Captcha; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import xiaozhi.common.redis.RedisKeys; -import xiaozhi.common.redis.RedisUtils; -import xiaozhi.modules.security.oauth2.Oauth2Realm; -import xiaozhi.modules.security.service.CaptchaService; + import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.modules.security.service.CaptchaService; /** * 验证码 @@ -29,10 +28,10 @@ public class CaptchaServiceImpl implements CaptchaService { @Value("${renren.redis.open}") private boolean open; /** - * Local Cache 5分钟过期 + * Local Cache 5分钟过期 */ - Cache localCache = CacheBuilder.newBuilder().maximumSize(1000).expireAfterAccess(5, TimeUnit.MINUTES).build(); - private static final Logger logger = LoggerFactory.getLogger(Oauth2Realm.class); + Cache localCache = CacheBuilder.newBuilder().maximumSize(1000) + .expireAfterAccess(5, TimeUnit.MINUTES).build(); @Override public void create(HttpServletResponse response, String uuid) throws IOException { @@ -41,13 +40,13 @@ public class CaptchaServiceImpl implements CaptchaService { response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); - //生成验证码 + // 生成验证码 SpecCaptcha captcha = new SpecCaptcha(150, 40); captcha.setLen(5); captcha.setCharType(Captcha.TYPE_DEFAULT); captcha.out(response.getOutputStream()); - //保存到缓存 + // 保存到缓存 setCache(uuid, captcha.text()); } @@ -56,10 +55,10 @@ public class CaptchaServiceImpl implements CaptchaService { if (StringUtils.isBlank(code)) { return false; } - //获取验证码 + // 获取验证码 String captcha = getCache(uuid); - //效验成功 + // 效验成功 if (code.equalsIgnoreCase(captcha)) { return true; } @@ -80,7 +79,7 @@ public class CaptchaServiceImpl implements CaptchaService { if (open) { key = RedisKeys.getCaptchaKey(key); String captcha = (String) redisUtils.get(key); - //删除验证码 + // 删除验证码 if (captcha != null) { redisUtils.delete(key); } @@ -89,7 +88,7 @@ public class CaptchaServiceImpl implements CaptchaService { } String captcha = localCache.getIfPresent(key); - //删除验证码 + // 删除验证码 if (captcha != null) { localCache.invalidate(key); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/ShiroServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/ShiroServiceImpl.java index 97d16eaa4..27c20970f 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/ShiroServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/ShiroServiceImpl.java @@ -1,17 +1,13 @@ package xiaozhi.modules.security.service.impl; -import xiaozhi.common.user.UserDetail; +import org.springframework.stereotype.Service; + +import lombok.AllArgsConstructor; import xiaozhi.modules.security.dao.SysUserTokenDao; import xiaozhi.modules.security.entity.SysUserTokenEntity; import xiaozhi.modules.security.service.ShiroService; import xiaozhi.modules.sys.dao.SysUserDao; import xiaozhi.modules.sys.entity.SysUserEntity; -import xiaozhi.modules.sys.enums.SuperAdminEnum; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.*; @AllArgsConstructor @Service @@ -19,7 +15,6 @@ public class ShiroServiceImpl implements ShiroService { private final SysUserDao sysUserDao; private final SysUserTokenDao sysUserTokenDao; - @Override public SysUserTokenEntity getByToken(String token) { return sysUserTokenDao.getByToken(token); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/SysUserTokenServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/SysUserTokenServiceImpl.java index 40ee79572..7f0d311a0 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/SysUserTokenServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/service/impl/SysUserTokenServiceImpl.java @@ -1,8 +1,11 @@ package xiaozhi.modules.security.service.impl; +import java.util.Date; + +import org.springframework.stereotype.Service; + import cn.hutool.core.date.DateUtil; import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; import xiaozhi.common.page.TokenDTO; @@ -17,11 +20,10 @@ import xiaozhi.modules.sys.dto.PasswordDTO; import xiaozhi.modules.sys.dto.SysUserDTO; import xiaozhi.modules.sys.service.SysUserService; -import java.util.Date; - @AllArgsConstructor @Service -public class SysUserTokenServiceImpl extends BaseServiceImpl implements SysUserTokenService { +public class SysUserTokenServiceImpl extends BaseServiceImpl + implements SysUserTokenService { private final SysUserService sysUserService; /** @@ -31,18 +33,18 @@ public class SysUserTokenServiceImpl extends BaseServiceImpl createToken(Long userId) { - //用户token + // 用户token String token; - //当前时间 + // 当前时间 Date now = new Date(); - //过期时间 + // 过期时间 Date expireTime = new Date(now.getTime() + EXPIRE * 1000); - //判断是否生成过token + // 判断是否生成过token SysUserTokenEntity tokenEntity = baseDao.getByUserId(userId); if (tokenEntity == null) { - //生成一个token + // 生成一个token token = TokenGenerator.generateValue(); tokenEntity = new SysUserTokenEntity(); @@ -51,12 +53,12 @@ public class SysUserTokenServiceImpl extends BaseServiceImpl().ok(tokenDTO); } @Override diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/user/SecurityUser.java b/main/manager-api/src/main/java/xiaozhi/modules/security/user/SecurityUser.java index cfa0fbf74..0581f95cf 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/user/SecurityUser.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/user/SecurityUser.java @@ -1,9 +1,10 @@ package xiaozhi.modules.security.user; -import xiaozhi.common.user.UserDetail; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import xiaozhi.common.user.UserDetail; + /** * Shiro工具类 * Copyright (c) 人人开源 All rights reserved. diff --git a/main/manager-api/src/main/java/xiaozhi/modules/admin/contrloler/AdminController.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/AdminController.java similarity index 59% rename from main/manager-api/src/main/java/xiaozhi/modules/admin/contrloler/AdminController.java rename to main/manager-api/src/main/java/xiaozhi/modules/sys/controller/AdminController.java index ee46f2eb0..2ccc1e6ad 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/admin/contrloler/AdminController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/AdminController.java @@ -1,23 +1,33 @@ -package xiaozhi.modules.admin.contrloler; +package xiaozhi.modules.sys.controller; +import java.util.Map; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.web.bind.annotation.*; import xiaozhi.common.constant.Constant; import xiaozhi.common.page.PageData; import xiaozhi.common.utils.Result; import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.modules.device.dto.DevicePageUserDTO; +import xiaozhi.modules.device.service.DeviceService; +import xiaozhi.modules.device.vo.UserShowDeviceListVO; import xiaozhi.modules.sys.dto.AdminPageUserDTO; import xiaozhi.modules.sys.service.SysUserService; import xiaozhi.modules.sys.vo.AdminPageUserVO; -import java.util.Map; - /** * 管理员控制层 * @@ -31,11 +41,13 @@ import java.util.Map; public class AdminController { private final SysUserService sysUserService; + private final DeviceService deviceService; + @GetMapping("/users") @Operation(summary = "分页查找用户") @RequiresPermissions("sys:role:superAdmin") @Parameters({ - @Parameter(name = "mobile", description = "用户手机号码", required = true), + @Parameter(name = "mobile", description = "用户手机号码", required = false), @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true), }) @@ -44,8 +56,7 @@ public class AdminController { AdminPageUserDTO dto = new AdminPageUserDTO(); dto.setMobile((String) params.get("mobile")); dto.setLimit((String) params.get(Constant.LIMIT)); - dto.setPage((String) params.get("pages")); - + dto.setPage((String) params.get(Constant.PAGE)); ValidatorUtils.validateEntity(dto); PageData page = sysUserService.page(dto); return new Result>().ok(page); @@ -64,21 +75,35 @@ public class AdminController { @Operation(summary = "用户删除") @RequiresPermissions("sys:role:superAdmin") public Result delete(@PathVariable Long id) { - sysUserService.delete(new Long[]{id}); + sysUserService.deleteById(id); return new Result<>(); } + @PutMapping("/users/changeStatus/{status}") + @Operation(summary = "批量修改用户状态") + @RequiresPermissions("sys:role:superAdmin") + @Parameter(name = "status", description = "用户状态", required = true) + public Result changeStatus(@PathVariable Integer status, @RequestBody String[] userIds) { + sysUserService.changeStatus(status, userIds); + return new Result(); + } + @GetMapping("/device/all") @Operation(summary = "分页查找设备") @RequiresPermissions("sys:role:superAdmin") @Parameters({ - @Parameter(name = "keywords", description = "用户手机号码", required = true), + @Parameter(name = "keywords", description = "设备关键词", required = false), @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true), }) - public Result pageDevice( + public Result> pageDevice( @Parameter(hidden = true) @RequestParam Map params) { - //TODO 等设备功能模块写好 - return new Result().error(600,"等设备功能模块写好"); + DevicePageUserDTO dto = new DevicePageUserDTO(); + dto.setKeywords((String) params.get("keywords")); + dto.setLimit((String) params.get(Constant.LIMIT)); + dto.setPage((String) params.get(Constant.PAGE)); + ValidatorUtils.validateEntity(dto); + PageData page = deviceService.page(dto); + return new Result>().ok(page); } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictDataController.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictDataController.java new file mode 100644 index 000000000..30187fe8a --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictDataController.java @@ -0,0 +1,105 @@ +package xiaozhi.modules.sys.controller; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.page.PageData; +import xiaozhi.common.utils.Result; +import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.modules.sys.dto.SysDictDataDTO; +import xiaozhi.modules.sys.service.SysDictDataService; +import xiaozhi.modules.sys.vo.SysDictDataItem; +import xiaozhi.modules.sys.vo.SysDictDataVO; + +/** + * 字典数据管理 + * + * @author czc + * @since 2025-04-30 + */ +@AllArgsConstructor +@RestController +@RequestMapping("/admin/dict/data") +@Tag(name = "字典数据管理") +public class SysDictDataController { + private final SysDictDataService sysDictDataService; + + @GetMapping("/page") + @Operation(summary = "分页查询字典数据") + @RequiresPermissions("sys:role:superAdmin") + @Parameters({ @Parameter(name = "dictTypeId", description = "字典类型ID", required = true), + @Parameter(name = "dictLabel", description = "数据标签"), @Parameter(name = "dictValue", description = "数据值"), + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) }) + public Result> page(@Parameter(hidden = true) @RequestParam Map params) { + ValidatorUtils.validateEntity(params); + // 强制校验dictTypeId是否存在 + if (!params.containsKey("dictTypeId") || StringUtils.isEmpty(String.valueOf(params.get("dictTypeId")))) { + return new Result>().error("dictTypeId不能为空"); + } + + PageData page = sysDictDataService.page(params); + return new Result>().ok(page); + } + + @GetMapping("/{id}") + @Operation(summary = "获取字典数据详情") + @RequiresPermissions("sys:role:superAdmin") + public Result get(@PathVariable("id") Long id) { + SysDictDataVO vo = sysDictDataService.get(id); + return new Result().ok(vo); + } + + @PostMapping("/save") + @Operation(summary = "新增字典数据") + @RequiresPermissions("sys:role:superAdmin") + public Result save(@RequestBody SysDictDataDTO dto) { + ValidatorUtils.validateEntity(dto); + sysDictDataService.save(dto); + return new Result<>(); + } + + @PutMapping("/update") + @Operation(summary = "修改字典数据") + @RequiresPermissions("sys:role:superAdmin") + public Result update(@RequestBody SysDictDataDTO dto) { + ValidatorUtils.validateEntity(dto); + sysDictDataService.update(dto); + return new Result<>(); + } + + @PostMapping("/delete") + @Operation(summary = "删除字典数据") + @RequiresPermissions("sys:role:superAdmin") + @Parameter(name = "ids", description = "ID数组", required = true) + public Result delete(@RequestBody Long[] ids) { + sysDictDataService.delete(ids); + return new Result<>(); + } + + @GetMapping("/type/{dictType}") + @Operation(summary = "获取字典数据列表") + @RequiresPermissions("sys:role:normal") + public Result> getDictDataByType(@PathVariable("dictType") String dictType) { + List list = sysDictDataService.getDictDataByType(dictType); + return new Result>().ok(list); + } + +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictTypeController.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictTypeController.java new file mode 100644 index 000000000..f16409b03 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysDictTypeController.java @@ -0,0 +1,92 @@ +package xiaozhi.modules.sys.controller; + +import java.util.Map; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.page.PageData; +import xiaozhi.common.utils.Result; +import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.modules.sys.dto.SysDictTypeDTO; +import xiaozhi.modules.sys.service.SysDictTypeService; +import xiaozhi.modules.sys.vo.SysDictTypeVO; + +/** + * 字典类型管理 + * + * @author czc + * @since 2025-04-30 + */ +@AllArgsConstructor +@RestController +@RequestMapping("/admin/dict/type") +@Tag(name = "字典类型管理") +public class SysDictTypeController { + private final SysDictTypeService sysDictTypeService; + + @GetMapping("/page") + @Operation(summary = "分页查询字典类型") + @RequiresPermissions("sys:role:superAdmin") + @Parameters({ @Parameter(name = "dictType", description = "字典类型编码"), + @Parameter(name = "dictName", description = "字典类型名称"), + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true), + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) }) + public Result> page(@Parameter(hidden = true) @RequestParam Map params) { + ValidatorUtils.validateEntity(params); + PageData page = sysDictTypeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("/{id}") + @Operation(summary = "获取字典类型详情") + @RequiresPermissions("sys:role:superAdmin") + public Result get(@PathVariable("id") Long id) { + SysDictTypeVO vo = sysDictTypeService.get(id); + return new Result().ok(vo); + } + + @PostMapping("/save") + @Operation(summary = "保存字典类型") + @RequiresPermissions("sys:role:superAdmin") + public Result save(@RequestBody SysDictTypeDTO dto) { + // 参数校验 + ValidatorUtils.validateEntity(dto); + + sysDictTypeService.save(dto); + return new Result<>(); + } + + @PutMapping("/update") + @Operation(summary = "修改字典类型") + @RequiresPermissions("sys:role:superAdmin") + public Result update(@RequestBody SysDictTypeDTO dto) { + // 参数校验 + ValidatorUtils.validateEntity(dto); + + sysDictTypeService.update(dto); + return new Result<>(); + } + + @PostMapping("/delete") + @Operation(summary = "删除字典类型") + @RequiresPermissions("sys:role:superAdmin") + @Parameter(name = "ids", description = "ID数组", required = true) + public Result delete(@RequestBody Long[] ids) { + sysDictTypeService.delete(ids); + return new Result<>(); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysParamsController.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysParamsController.java new file mode 100644 index 000000000..9b80c76c8 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysParamsController.java @@ -0,0 +1,198 @@ +package xiaozhi.modules.sys.controller; + +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import xiaozhi.common.annotation.LogOperation; +import xiaozhi.common.constant.Constant; +import xiaozhi.common.exception.RenException; +import xiaozhi.common.page.PageData; +import xiaozhi.common.utils.Result; +import xiaozhi.common.validator.AssertUtils; +import xiaozhi.common.validator.ValidatorUtils; +import xiaozhi.common.validator.group.AddGroup; +import xiaozhi.common.validator.group.DefaultGroup; +import xiaozhi.common.validator.group.UpdateGroup; +import xiaozhi.modules.config.service.ConfigService; +import xiaozhi.modules.sys.dto.SysParamsDTO; +import xiaozhi.modules.sys.service.SysParamsService; +import xiaozhi.modules.sys.utils.WebSocketValidator; + +/** + * 参数管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@RestController +@RequestMapping("admin/params") +@Tag(name = "参数管理") +@AllArgsConstructor +public class SysParamsController { + private final SysParamsService sysParamsService; + private final ConfigService configService; + private final RestTemplate restTemplate; + + @GetMapping("page") + @Operation(summary = "分页") + @Parameters({ + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"), + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"), + @Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"), + @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"), + @Parameter(name = "paramCode", description = "参数编码", in = ParameterIn.QUERY, ref = "String") + }) + @RequiresPermissions("sys:role:superAdmin") + public Result> page(@Parameter(hidden = true) @RequestParam Map params) { + PageData page = sysParamsService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @Operation(summary = "信息") + @RequiresPermissions("sys:role:superAdmin") + public Result get(@PathVariable("id") Long id) { + SysParamsDTO data = sysParamsService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @Operation(summary = "保存") + @LogOperation("保存") + @RequiresPermissions("sys:role:superAdmin") + public Result save(@RequestBody SysParamsDTO dto) { + // 效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + sysParamsService.save(dto); + configService.getConfig(false); + return new Result(); + } + + @PutMapping + @Operation(summary = "修改") + @LogOperation("修改") + @RequiresPermissions("sys:role:superAdmin") + public Result update(@RequestBody SysParamsDTO dto) { + // 效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + // 验证WebSocket地址列表 + validateWebSocketUrls(dto.getParamCode(), dto.getParamValue()); + + // 验证OTA地址 + validateOtaUrl(dto.getParamCode(), dto.getParamValue()); + + sysParamsService.update(dto); + configService.getConfig(false); + return new Result(); + } + + /** + * 验证WebSocket地址列表 + * + * @param urls WebSocket地址列表,以分号分隔 + * @return 验证结果 + */ + private void validateWebSocketUrls(String paramCode, String urls) { + if (!paramCode.equals(Constant.SERVER_WEBSOCKET)) { + return; + } + String[] wsUrls = urls.split("\\;"); + if (wsUrls.length == 0) { + throw new RenException("WebSocket地址列表不能为空"); + } + for (String url : wsUrls) { + if (StringUtils.isNotBlank(url)) { + // 检查是否包含localhost或127.0.0.1 + if (url.contains("localhost") || url.contains("127.0.0.1")) { + throw new RenException("WebSocket地址不能使用localhost或127.0.0.1"); + } + + // 验证WebSocket地址格式 + if (!WebSocketValidator.validateUrlFormat(url)) { + throw new RenException("WebSocket地址格式不正确: " + url); + } + + // 测试WebSocket连接 + if (!WebSocketValidator.testConnection(url)) { + throw new RenException("WebSocket连接测试失败: " + url); + } + } + } + } + + /** + * 验证OTA地址 + */ + private void validateOtaUrl(String paramCode, String url) { + if (!paramCode.equals(Constant.SERVER_OTA)) { + return; + } + if (StringUtils.isBlank(url) || url.equals("null")) { + throw new RenException("OTA地址不能为空"); + } + + // 检查是否包含localhost或127.0.0.1 + if (url.contains("localhost") || url.contains("127.0.0.1")) { + throw new RenException("OTA地址不能使用localhost或127.0.0.1"); + } + + // 验证URL格式 + if (!url.toLowerCase().startsWith("http")) { + throw new RenException("OTA地址必须以http或https开头"); + } + if (!url.endsWith("/ota/")) { + throw new RenException("OTA地址必须以/ota/结尾"); + } + + try { + // 发送GET请求 + ResponseEntity response = restTemplate.getForEntity(url, String.class); + if (response.getStatusCode() != HttpStatus.OK) { + throw new RenException("OTA接口访问失败,状态码:" + response.getStatusCode()); + } + // 检查响应内容是否包含OTA相关信息 + String body = response.getBody(); + if (body == null || !body.contains("OTA")) { + throw new RenException("OTA接口返回内容格式不正确,可能不是一个真实的OTA接口"); + } + } catch (Exception e) { + throw new RenException("OTA接口验证失败:" + e.getMessage()); + } + } + + @PostMapping("/delete") + @Operation(summary = "删除") + @LogOperation("删除") + @RequiresPermissions("sys:role:superAdmin") + public Result delete(@RequestBody String[] ids) { + // 效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + sysParamsService.delete(ids); + configService.getConfig(false); + return new Result(); + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysUserController.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysUserController.java deleted file mode 100644 index 9da7c62b1..000000000 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/controller/SysUserController.java +++ /dev/null @@ -1,17 +0,0 @@ -package xiaozhi.modules.sys.controller; - -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 用户管理 - */ -@AllArgsConstructor -@RestController -@RequestMapping("/sys/user") -@Tag(name = "用户管理") -public class SysUserController { - -} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictDataDao.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictDataDao.java index 08aaca5be..e5c4c7bbc 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictDataDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictDataDao.java @@ -1,12 +1,12 @@ package xiaozhi.modules.sys.dao; -import xiaozhi.common.dao.BaseDao; -import xiaozhi.modules.sys.dto.SysDictDataDTO; -import xiaozhi.modules.sys.entity.DictData; -import xiaozhi.modules.sys.entity.SysDictDataEntity; +import java.util.List; + import org.apache.ibatis.annotations.Mapper; -import java.util.List; +import xiaozhi.common.dao.BaseDao; +import xiaozhi.modules.sys.entity.SysDictDataEntity; +import xiaozhi.modules.sys.vo.SysDictDataItem; /** * 字典数据 @@ -14,10 +14,13 @@ import java.util.List; @Mapper public interface SysDictDataDao extends BaseDao { - /** - * 字典数据列表 - */ - List getDictDataList(); + List getDictDataByType(String dictType); - List getDataByTypeCode(String dictType); + /** + * 根据字典类型ID获取字典类型编码 + * + * @param dictTypeId 字典类型ID + * @return 字典类型编码 + */ + String getTypeByTypeId(Long dictTypeId); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictTypeDao.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictTypeDao.java index bca8e789b..6c271e314 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictTypeDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysDictTypeDao.java @@ -1,11 +1,9 @@ package xiaozhi.modules.sys.dao; -import xiaozhi.common.dao.BaseDao; -import xiaozhi.modules.sys.entity.DictType; -import xiaozhi.modules.sys.entity.SysDictTypeEntity; import org.apache.ibatis.annotations.Mapper; -import java.util.List; +import xiaozhi.common.dao.BaseDao; +import xiaozhi.modules.sys.entity.SysDictTypeEntity; /** * 字典类型 @@ -13,9 +11,4 @@ import java.util.List; @Mapper public interface SysDictTypeDao extends BaseDao { - /** - * 字典类型列表 - */ - List getDictTypeList(); - } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysParamsDao.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysParamsDao.java index 0c967a74f..6eebc8be8 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysParamsDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysParamsDao.java @@ -1,11 +1,12 @@ package xiaozhi.modules.sys.dao; -import xiaozhi.common.dao.BaseDao; -import xiaozhi.modules.sys.entity.SysParamsEntity; +import java.util.List; + import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; +import xiaozhi.common.dao.BaseDao; +import xiaozhi.modules.sys.entity.SysParamsEntity; /** * 参数管理 @@ -26,7 +27,7 @@ public interface SysParamsDao extends BaseDao { * @param ids ids * @return 返回参数编码列表 */ - List getParamCodeList(Long[] ids); + List getParamCodeList(String[] ids); /** * 根据参数编码,更新value diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysUserDao.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysUserDao.java index 339e522a1..fb2a24926 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysUserDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dao/SysUserDao.java @@ -1,6 +1,7 @@ package xiaozhi.modules.sys.dao; import org.apache.ibatis.annotations.Mapper; + import xiaozhi.common.dao.BaseDao; import xiaozhi.modules.sys.entity.SysUserEntity; diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/AdminPageUserDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/AdminPageUserDTO.java index 8c0ab77cd..a9d960a1d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/AdminPageUserDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/AdminPageUserDTO.java @@ -1,25 +1,27 @@ package xiaozhi.modules.sys.dto; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; import lombok.Data; /** * 管理员分页用户的参数DTO + * * @author zjy * @since 2025-3-21 */ @Data -@Schema(description = "音色分页参数") +@Schema(description = "管理员分页用户的参数DTO") public class AdminPageUserDTO { - @Schema(description = "手机号码") private String mobile; @Schema(description = "页数") + @Min(value = 0, message = "{sort.number}") private String page; @Schema(description = "显示列数") + @Min(value = 0, message = "{sort.number}") private String limit; } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/PasswordDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/PasswordDTO.java index 1ecadc68b..4aabb10e0 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/PasswordDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/PasswordDTO.java @@ -1,11 +1,11 @@ package xiaozhi.modules.sys.dto; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import java.io.Serializable; - /** * 修改密码 */ diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictDataDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictDataDTO.java index 172e6b1f5..c18dbf8f2 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictDataDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictDataDTO.java @@ -1,20 +1,21 @@ package xiaozhi.modules.sys.dto; +import java.io.Serializable; +import java.util.Date; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; -import xiaozhi.common.utils.DateUtils; -import xiaozhi.common.validator.group.AddGroup; -import xiaozhi.common.validator.group.DefaultGroup; -import xiaozhi.common.validator.group.UpdateGroup; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Null; import lombok.Data; - -import java.io.Serializable; -import java.util.Date; +import xiaozhi.common.utils.DateUtils; +import xiaozhi.common.validator.group.AddGroup; +import xiaozhi.common.validator.group.DefaultGroup; +import xiaozhi.common.validator.group.UpdateGroup; /** * 字典数据 @@ -23,7 +24,6 @@ import java.util.Date; @Schema(description = "字典数据") public class SysDictDataDTO implements Serializable { - @Schema(description = "id") @Null(message = "{id.null}", groups = AddGroup.class) @NotNull(message = "{id.require}", groups = UpdateGroup.class) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictTypeDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictTypeDTO.java index 72648109e..912c817cb 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictTypeDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysDictTypeDTO.java @@ -1,20 +1,21 @@ package xiaozhi.modules.sys.dto; +import java.io.Serializable; +import java.util.Date; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; -import xiaozhi.common.utils.DateUtils; -import xiaozhi.common.validator.group.AddGroup; -import xiaozhi.common.validator.group.DefaultGroup; -import xiaozhi.common.validator.group.UpdateGroup; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Null; import lombok.Data; - -import java.io.Serializable; -import java.util.Date; +import xiaozhi.common.utils.DateUtils; +import xiaozhi.common.validator.group.AddGroup; +import xiaozhi.common.validator.group.DefaultGroup; +import xiaozhi.common.validator.group.UpdateGroup; /** * 字典类型 @@ -23,7 +24,6 @@ import java.util.Date; @Schema(description = "字典类型") public class SysDictTypeDTO implements Serializable { - @Schema(description = "id") @Null(message = "{id.null}", groups = AddGroup.class) @NotNull(message = "{id.require}", groups = UpdateGroup.class) @@ -51,5 +51,6 @@ public class SysDictTypeDTO implements Serializable { @Schema(description = "更新时间") @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN) private Date updateDate; } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysParamsDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysParamsDTO.java index 4b72ce343..ad816b350 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysParamsDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysParamsDTO.java @@ -1,19 +1,21 @@ package xiaozhi.modules.sys.dto; +import java.io.Serializable; +import java.util.Date; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; -import xiaozhi.common.utils.DateUtils; -import xiaozhi.common.validator.group.AddGroup; -import xiaozhi.common.validator.group.DefaultGroup; -import xiaozhi.common.validator.group.UpdateGroup; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Null; +import jakarta.validation.constraints.Pattern; import lombok.Data; - -import java.io.Serializable; -import java.util.Date; +import xiaozhi.common.utils.DateUtils; +import xiaozhi.common.validator.group.AddGroup; +import xiaozhi.common.validator.group.DefaultGroup; +import xiaozhi.common.validator.group.UpdateGroup; /** * 参数管理 @@ -22,7 +24,6 @@ import java.util.Date; @Schema(description = "参数管理") public class SysParamsDTO implements Serializable { - @Schema(description = "id") @Null(message = "{id.null}", groups = AddGroup.class) @NotNull(message = "{id.require}", groups = UpdateGroup.class) @@ -36,6 +37,11 @@ public class SysParamsDTO implements Serializable { @NotBlank(message = "{sysparams.paramvalue.require}", groups = DefaultGroup.class) private String paramValue; + @Schema(description = "值类型") + @NotBlank(message = "{sysparams.valuetype.require}", groups = DefaultGroup.class) + @Pattern(regexp = "^(string|number|boolean|array)$", message = "{sysparams.valuetype.pattern}", groups = DefaultGroup.class) + private String valueType; + @Schema(description = "备注") private String remark; diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysUserDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysUserDTO.java index 00f7fc78d..ff0663410 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysUserDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/dto/SysUserDTO.java @@ -1,22 +1,24 @@ package xiaozhi.modules.sys.dto; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.hibernate.validator.constraints.Range; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; -import xiaozhi.common.utils.DateUtils; -import xiaozhi.common.validator.group.AddGroup; -import xiaozhi.common.validator.group.DefaultGroup; -import xiaozhi.common.validator.group.UpdateGroup; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Null; import lombok.Data; -import org.hibernate.validator.constraints.Range; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; +import xiaozhi.common.utils.DateUtils; +import xiaozhi.common.validator.group.AddGroup; +import xiaozhi.common.validator.group.DefaultGroup; +import xiaozhi.common.validator.group.UpdateGroup; /** * 用户管理 diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictData.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictData.java deleted file mode 100644 index 1e16a1927..000000000 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictData.java +++ /dev/null @@ -1,15 +0,0 @@ -package xiaozhi.modules.sys.entity; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -/** - * 字典数据 - */ -@Data -public class DictData { - @JsonIgnore - private Long dictTypeId; - private String dictLabel; - private String dictValue; -} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictType.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictType.java deleted file mode 100644 index 3cf946065..000000000 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/DictType.java +++ /dev/null @@ -1,18 +0,0 @@ -package xiaozhi.modules.sys.entity; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; - -/** - * 字典类型 - */ -@Data -public class DictType { - @JsonIgnore - private Long id; - private String dictType; - private List dataList = new ArrayList<>(); -} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictDataEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictDataEntity.java index 4bfa4b627..16d3dcae8 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictDataEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictDataEntity.java @@ -1,13 +1,14 @@ package xiaozhi.modules.sys.entity; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; -import xiaozhi.common.entity.BaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; - -import java.util.Date; +import xiaozhi.common.entity.BaseEntity; /** * 数据字典 diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictTypeEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictTypeEntity.java index ea752c632..350d857bd 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictTypeEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysDictTypeEntity.java @@ -1,13 +1,14 @@ package xiaozhi.modules.sys.entity; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; -import xiaozhi.common.entity.BaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; - -import java.util.Date; +import xiaozhi.common.entity.BaseEntity; /** * 字典类型 @@ -17,7 +18,7 @@ import java.util.Date; @TableName("sys_dict_type") public class SysDictTypeEntity extends BaseEntity { /** - * 字典类型 + * 字典类型编码 */ private String dictType; /** diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysParamsEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysParamsEntity.java index 054e51d7e..c51c46fab 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysParamsEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysParamsEntity.java @@ -1,13 +1,14 @@ package xiaozhi.modules.sys.entity; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; -import xiaozhi.common.entity.BaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; - -import java.util.Date; +import xiaozhi.common.entity.BaseEntity; /** * 参数管理 @@ -25,7 +26,11 @@ public class SysParamsEntity extends BaseEntity { */ private String paramValue; /** - * 类型 0:系统参数 1:非系统参数 + * 值类型:string-字符串,number-数字,boolean-布尔,array-数组 + */ + private String valueType; + /** + * 类型 0:系统参数 1:非系统参数 */ private Integer paramType; /** diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysUserEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysUserEntity.java index 0093fcf05..23043a370 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysUserEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/entity/SysUserEntity.java @@ -1,14 +1,15 @@ package xiaozhi.modules.sys.entity; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; + import lombok.Data; import lombok.EqualsAndHashCode; import xiaozhi.common.entity.BaseEntity; -import java.util.Date; - /** * 系统用户 */ @@ -25,11 +26,11 @@ public class SysUserEntity extends BaseEntity { */ private String password; /** - * 超级管理员 0:否 1:是 + * 超级管理员 0:否 1:是 */ private Integer superAdmin; /** - * 状态 0:停用 1:正常 + * 状态 0:停用 1:正常 */ private Integer status; /** diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/redis/SysParamsRedis.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/redis/SysParamsRedis.java index dcc14f69e..2e2bdb428 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/redis/SysParamsRedis.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/redis/SysParamsRedis.java @@ -1,9 +1,10 @@ package xiaozhi.modules.sys.redis; +import org.springframework.stereotype.Component; + +import lombok.AllArgsConstructor; import xiaozhi.common.redis.RedisKeys; import xiaozhi.common.redis.RedisUtils; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; /** * 参数管理 diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictDataService.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictDataService.java index 77be8b3a8..ea898447f 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictDataService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictDataService.java @@ -1,25 +1,70 @@ package xiaozhi.modules.sys.service; +import java.util.List; +import java.util.Map; + import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; import xiaozhi.modules.sys.dto.SysDictDataDTO; import xiaozhi.modules.sys.entity.SysDictDataEntity; - -import java.util.Map; +import xiaozhi.modules.sys.vo.SysDictDataItem; +import xiaozhi.modules.sys.vo.SysDictDataVO; /** * 数据字典 */ public interface SysDictDataService extends BaseService { - PageData page(Map params); + /** + * 分页查询数据字典信息 + * + * @param params 查询参数,包含分页信息和查询条件 + * @return 返回数据字典的分页查询结果 + */ + PageData page(Map params); - SysDictDataDTO get(Long id); + /** + * 根据ID获取数据字典实体 + * + * @param id 数据字典实体的唯一标识 + * @return 返回数据字典实体的详细信息 + */ + SysDictDataVO get(Long id); + /** + * 保存新的数据字典项 + * + * @param dto 数据字典项的保存数据传输对象 + */ void save(SysDictDataDTO dto); + /** + * 更新数据字典项 + * + * @param dto 数据字典项的更新数据传输对象 + */ void update(SysDictDataDTO dto); + /** + * 删除数据字典项 + * + * @param ids 要删除的数据字典项的ID数组 + */ void delete(Long[] ids); + /** + * 根据字典类型ID删除对应的字典数据 + * + * @param dictTypeId 字典类型ID + */ + void deleteByTypeId(Long dictTypeId); + + /** + * 根据字典类型获取字典数据列表 + * + * @param dictType 字典类型 + * @return 返回字典数据列表 + */ + List getDictDataByType(String dictType); + } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictTypeService.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictTypeService.java index 8924f6ca1..697b2d10d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictTypeService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysDictTypeService.java @@ -1,30 +1,60 @@ package xiaozhi.modules.sys.service; +import java.util.List; +import java.util.Map; + import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; import xiaozhi.modules.sys.dto.SysDictTypeDTO; -import xiaozhi.modules.sys.entity.DictType; import xiaozhi.modules.sys.entity.SysDictTypeEntity; - -import java.util.List; -import java.util.Map; +import xiaozhi.modules.sys.vo.SysDictTypeVO; /** * 数据字典 */ public interface SysDictTypeService extends BaseService { - PageData page(Map params); + /** + * 分页查询字典类型信息 + * + * @param params 查询参数,包含分页信息和查询条件 + * @return 返回分页的字典类型数据 + */ + PageData page(Map params); - SysDictTypeDTO get(Long id); + /** + * 根据ID获取字典类型信息 + * + * @param id 字典类型ID + * @return 返回字典类型对象 + */ + SysDictTypeVO get(Long id); + /** + * 保存字典类型信息 + * + * @param dto 字典类型数据传输对象 + */ void save(SysDictTypeDTO dto); + /** + * 更新字典类型信息 + * + * @param dto 字典类型数据传输对象 + */ void update(SysDictTypeDTO dto); + /** + * 删除字典类型信息 + * + * @param ids 要删除的字典类型ID数组 + */ void delete(Long[] ids); - List getAllList(); - - List getDictTypeList(); + /** + * 列出所有字典类型信息 + * + * @return 返回字典类型列表 + */ + List list(Map params); } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysParamsService.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysParamsService.java index d13e41ba8..ac67a2760 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysParamsService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysParamsService.java @@ -1,14 +1,13 @@ package xiaozhi.modules.sys.service; +import java.util.List; +import java.util.Map; import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; import xiaozhi.modules.sys.dto.SysParamsDTO; import xiaozhi.modules.sys.entity.SysParamsEntity; -import java.util.List; -import java.util.Map; - /** * 参数管理 */ @@ -24,14 +23,15 @@ public interface SysParamsService extends BaseService { void update(SysParamsDTO dto); - void delete(Long[] ids); + void delete(String[] ids); /** * 根据参数编码,获取参数的value值 * * @param paramCode 参数编码 + * @param fromCache 是否从缓存中获取 */ - String getValue(String paramCode); + String getValue(String paramCode, Boolean fromCache); /** * 根据参数编码,获取value的Object对象 @@ -48,4 +48,9 @@ public interface SysParamsService extends BaseService { * @param paramValue 参数值 */ int updateValueByCode(String paramCode, String paramValue); + + /** + * 初始化服务器密钥 + */ + void initServerSecret(); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserService.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserService.java index f8f609dc1..7a35da321 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserService.java @@ -8,7 +8,6 @@ import xiaozhi.modules.sys.dto.SysUserDTO; import xiaozhi.modules.sys.entity.SysUserEntity; import xiaozhi.modules.sys.vo.AdminPageUserVO; - /** * 系统用户 */ @@ -20,32 +19,57 @@ public interface SysUserService extends BaseService { void save(SysUserDTO dto); - void delete(Long[] ids); + /** + * 删除指定用户,且有关联的数据设备和智能体 + * + * @param ids + */ + void deleteById(Long ids); /** * 验证是否允许修改密码更改 - * @param userId 用户id + * + * @param userId 用户id * @param passwordDTO 验证密码的参数 */ void changePassword(Long userId, PasswordDTO passwordDTO); /** * 直接修改密码,不需要验证 - * @param userId 用户id + * + * @param userId 用户id * @param password 密码 */ void changePasswordDirectly(Long userId, String password); /** * 重置密码 + * * @param userId 用户id * @return 随机生成符合规范的密码 */ String resetPassword(Long userId); + /** * 管理员分页用户信息 + * * @param dto 分页查找参数 * @return 用户列表分页数据 */ PageData page(AdminPageUserDTO dto); + + /** + * 批量修改用户状态 + * + * @param status 用户状态 + * @param userIds 用户ID数组 + */ + void changeStatus(Integer status, String[] userIds); + + /** + * 获取是否允许用户注册 + * + * @return 是否允许用户注册 + */ + boolean getAllowUserRegister(); } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserUtilService.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserUtilService.java new file mode 100644 index 000000000..0fa3fc4ae --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/SysUserUtilService.java @@ -0,0 +1,19 @@ +package xiaozhi.modules.sys.service; + + +import java.util.function.Consumer; + +/** + * 定义一个系统用户工具类,避免和用户模块循环依赖 + * 如用户和设备互相依赖,用户需要获取所有设备,设备又需要获取每个设备的用户名 + * @author zjy + * @since 2025-4-2 + */ +public interface SysUserUtilService { + /** + * 赋值用户名 + * @param userId 用户id + * @param setter 赋值方法 + */ + void assignUsername( Long userId, Consumer setter); +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictDataServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictDataServiceImpl.java index a8420dc9d..ffe889862 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictDataServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictDataServiceImpl.java @@ -1,35 +1,55 @@ package xiaozhi.modules.sys.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import lombok.AllArgsConstructor; +import xiaozhi.common.exception.RenException; import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; import xiaozhi.common.service.impl.BaseServiceImpl; import xiaozhi.common.utils.ConvertUtils; import xiaozhi.modules.sys.dao.SysDictDataDao; +import xiaozhi.modules.sys.dao.SysUserDao; import xiaozhi.modules.sys.dto.SysDictDataDTO; import xiaozhi.modules.sys.entity.SysDictDataEntity; +import xiaozhi.modules.sys.entity.SysUserEntity; import xiaozhi.modules.sys.service.SysDictDataService; - -import java.util.Arrays; -import java.util.Map; +import xiaozhi.modules.sys.vo.SysDictDataItem; +import xiaozhi.modules.sys.vo.SysDictDataVO; /** * 字典类型 */ @Service -public class SysDictDataServiceImpl extends BaseServiceImpl implements SysDictDataService { +@AllArgsConstructor +public class SysDictDataServiceImpl extends BaseServiceImpl + implements SysDictDataService { + private final SysUserDao sysUserDao; + private final RedisUtils redisUtils; @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, "sort", true), - getWrapper(params) - ); + public PageData page(Map params) { + IPage page = baseDao.selectPage(getPage(params, "sort", true), getWrapper(params)); - return getPageData(page, SysDictDataDTO.class); + PageData pageData = getPageData(page, SysDictDataVO.class); + + setUserName(pageData.getList()); + + return pageData; } private QueryWrapper getWrapper(Map params) { @@ -46,32 +66,118 @@ public class SysDictDataServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, dictTypeId); + baseDao.delete(wrapper); + } + + /** + * 设置用户名 + * + * @param sysDictDataList 字典类型集合 + */ + private void setUserName(List sysDictDataList) { + // 收集所有用户 ID + Set userIds = sysDictDataList.stream().flatMap(vo -> Stream.of(vo.getCreator(), vo.getUpdater())) + .filter(Objects::nonNull).collect(Collectors.toSet()); + + // 设置更新者和创建者名称 + if (!userIds.isEmpty()) { + List sysUserEntities = sysUserDao.selectBatchIds(userIds); + // 把List转成Map,Map + Map userNameMap = sysUserEntities.stream().collect(Collectors.toMap(SysUserEntity::getId, + SysUserEntity::getUsername, (existing, replacement) -> existing)); + + sysDictDataList.forEach(vo -> { + vo.setCreatorName(userNameMap.get(vo.getCreator())); + vo.setUpdaterName(userNameMap.get(vo.getUpdater())); + }); + } + } + + private void checkDictValueUnique(Long dictTypeId, String dictValue, String excludeId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDictDataEntity::getDictTypeId, dictTypeId).eq(SysDictDataEntity::getDictLabel, dictValue); + if (StringUtils.isNotBlank(excludeId)) { + queryWrapper.ne(SysDictDataEntity::getId, excludeId); + } + boolean exists = baseDao.exists(queryWrapper); + if (exists) { + throw new RenException("字典标签重复"); + } + } + + @Override + public List getDictDataByType(String dictType) { + if (StringUtils.isBlank(dictType)) { + return null; + } + + // 先从Redis获取缓存 + String key = RedisKeys.getDictDataByTypeKey(dictType); + List cachedData = (List) redisUtils.get(key); + if (cachedData != null) { + return cachedData; + } + + // 如果缓存中没有,则从数据库获取 + List data = baseDao.getDictDataByType(dictType); + + // 存入Redis缓存 + if (data != null) { + redisUtils.set(key, data); + } + + return data; } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictTypeServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictTypeServiceImpl.java index 01313e705..91522482e 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictTypeServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysDictTypeServiceImpl.java @@ -1,42 +1,54 @@ package xiaozhi.modules.sys.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import xiaozhi.common.page.PageData; -import xiaozhi.common.service.impl.BaseServiceImpl; -import xiaozhi.common.utils.ConvertUtils; -import xiaozhi.modules.sys.dao.SysDictDataDao; -import xiaozhi.modules.sys.dao.SysDictTypeDao; -import xiaozhi.modules.sys.dto.SysDictTypeDTO; -import xiaozhi.modules.sys.entity.DictData; -import xiaozhi.modules.sys.entity.DictType; -import xiaozhi.modules.sys.entity.SysDictTypeEntity; -import xiaozhi.modules.sys.service.SysDictTypeService; - import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import lombok.AllArgsConstructor; +import xiaozhi.common.exception.RenException; +import xiaozhi.common.page.PageData; +import xiaozhi.common.service.impl.BaseServiceImpl; +import xiaozhi.common.utils.ConvertUtils; +import xiaozhi.modules.sys.dao.SysDictTypeDao; +import xiaozhi.modules.sys.dao.SysUserDao; +import xiaozhi.modules.sys.dto.SysDictTypeDTO; +import xiaozhi.modules.sys.entity.SysDictTypeEntity; +import xiaozhi.modules.sys.entity.SysUserEntity; +import xiaozhi.modules.sys.service.SysDictDataService; +import xiaozhi.modules.sys.service.SysDictTypeService; +import xiaozhi.modules.sys.vo.SysDictTypeVO; /** * 字典类型 */ -@AllArgsConstructor @Service -public class SysDictTypeServiceImpl extends BaseServiceImpl implements SysDictTypeService { - private final SysDictDataDao sysDictDataDao; +@AllArgsConstructor +public class SysDictTypeServiceImpl extends BaseServiceImpl + implements SysDictTypeService { + private final SysUserDao sysUserDao; + private final SysDictDataService sysDictDataService; @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, "sort", true), - getWrapper(params) - ); + public PageData page(Map params) { + IPage page = baseDao.selectPage(getPage(params, "sort", true), getWrapper(params)); - return getPageData(page, SysDictTypeDTO.class); + PageData pageData = getPageData(page, SysDictTypeVO.class); + + setUserName(pageData.getList()); + + return pageData; } private QueryWrapper getWrapper(Map params) { @@ -51,15 +63,21 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl getAllList() { - List typeList = baseDao.getDictTypeList(); - List dataList = sysDictDataDao.getDictDataList(); - for (DictType type : typeList) { - for (DictData data : dataList) { - if (type.getId().equals(data.getDictTypeId())) { - type.getDataList().add(data); - } - } + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + List sysDictTypeVOList = ConvertUtils.sourceToTarget(entityList, SysDictTypeVO.class); + // 设置用户名 + setUserName(sysDictTypeVOList); + + return sysDictTypeVOList; + } + + /** + * 设置用户名 + * + * @param sysDictTypeList 字典类型集合 + */ + private void setUserName(List sysDictTypeList) { + // 收集所有用户 ID + Set userIds = sysDictTypeList.stream().flatMap(vo -> Stream.of(vo.getCreator(), vo.getUpdater())) + .filter(Objects::nonNull).collect(Collectors.toSet()); + + // 设置更新者和创建者名称 + if (!userIds.isEmpty()) { + List sysUserEntities = sysUserDao.selectBatchIds(userIds); + // 把List转成Map,Map + Map userNameMap = sysUserEntities.stream().collect(Collectors.toMap(SysUserEntity::getId, + SysUserEntity::getUsername, (existing, replacement) -> existing)); + + sysDictTypeList.forEach(vo -> { + vo.setCreatorName(userNameMap.get(vo.getCreator())); + vo.setUpdaterName(userNameMap.get(vo.getUpdater())); + }); } - return typeList; } - @Override - public List getDictTypeList() { - return baseDao.getDictTypeList(); + private void checkDictTypeUnique(String dictType, String excludeId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDictTypeEntity::getDictType, dictType); + if (StringUtils.isNotBlank(excludeId)) { + queryWrapper.ne(SysDictTypeEntity::getId, excludeId); + } + boolean exists = baseDao.exists(queryWrapper); + if (exists) { + throw new RenException("字典类型编码重复"); + } } - } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysParamsServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysParamsServiceImpl.java index 558a27ec4..15f62816d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysParamsServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysParamsServiceImpl.java @@ -1,7 +1,18 @@ package xiaozhi.modules.sys.service.impl; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; + +import lombok.AllArgsConstructor; import xiaozhi.common.constant.Constant; import xiaozhi.common.exception.ErrorCode; import xiaozhi.common.exception.RenException; @@ -14,14 +25,6 @@ import xiaozhi.modules.sys.dto.SysParamsDTO; import xiaozhi.modules.sys.entity.SysParamsEntity; import xiaozhi.modules.sys.redis.SysParamsRedis; import xiaozhi.modules.sys.service.SysParamsService; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; /** * 参数管理 @@ -34,9 +37,8 @@ public class SysParamsServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( - getPage(params, Constant.CREATE_DATE, false), - getWrapper(params) - ); + getPage(params, null, false), + getWrapper(params)); return getPageData(page, SysParamsDTO.class); } @@ -68,6 +70,8 @@ public class SysParamsServiceImpl extends BaseServiceImpl paramCodeList = baseDao.getParamCodeList(ids); String[] paramCodes = paramCodeList.toArray(new String[paramCodeList.size()]); - sysParamsRedis.delete(paramCodes); + if (paramCodes.length > 0) { + sysParamsRedis.delete(paramCodes); + } - //删除 + // 删除 deleteBatchIds(Arrays.asList(ids)); } @Override - public String getValue(String paramCode) { - String paramValue = sysParamsRedis.get(paramCode); - if (paramValue == null) { - paramValue = baseDao.getValueByCode(paramCode); + public String getValue(String paramCode, Boolean fromCache) { + String paramValue = null; + if (fromCache) { + paramValue = sysParamsRedis.get(paramCode); + if (paramValue == null) { + paramValue = baseDao.getValueByCode(paramCode); - sysParamsRedis.set(paramCode, paramValue); + sysParamsRedis.set(paramCode, paramValue); + } + } else { + paramValue = baseDao.getValueByCode(paramCode); } return paramValue; } @Override public T getValueObject(String paramCode, Class clazz) { - String paramValue = getValue(paramCode); + String paramValue = getValue(paramCode, true); if (StringUtils.isNotBlank(paramValue)) { return JsonUtils.parseObject(paramValue, clazz); } try { - return clazz.newInstance(); + return clazz.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RenException(ErrorCode.PARAMS_GET_ERROR); } @@ -128,4 +189,13 @@ public class SysParamsServiceImpl extends BaseServiceImpl implements SysUserService { private final SysUserDao sysUserDao; + private final DeviceService deviceService; + + private final AgentService agentService; + + private final SysParamsService sysParamsService; + @Override public SysUserDTO getByUsername(String username) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -59,16 +72,16 @@ public class SysUserServiceImpl extends BaseServiceImpl page(AdminPageUserDTO dto) { Map params = new HashMap(); params.put(Constant.PAGE, dto.getPage()); - params.put(Constant.LIMIT,dto.getLimit()); + params.put(Constant.LIMIT, dto.getLimit()); IPage page = baseDao.selectPage( getPage(params, "id", true), - //定义查询条件 - new QueryWrapper() - //必须按照手机号码查找 - .eq(StringUtils.isNotBlank(dto.getMobile()),"username",dto.getMobile())); + new QueryWrapper().eq(StringUtils.isNotBlank(dto.getMobile()), "username", + dto.getMobile())); + // 循环处理page获取回来的数据,返回需要的字段 List list = page.getRecords().stream().map(user -> { AdminPageUserVO adminPageUserVO = new AdminPageUserVO(); adminPageUserVO.setUserid(user.getId().toString()); adminPageUserVO.setMobile(user.getUsername()); - //TODO 2. 等设备功能写好,获取对应数据 - adminPageUserVO.setDeviceCount("0"); + String deviceCount = deviceService.selectCountByUserId(user.getId()).toString(); + adminPageUserVO.setDeviceCount(deviceCount); + adminPageUserVO.setStatus(user.getStatus()); + adminPageUserVO.setCreateDate(user.getCreateDate()); return adminPageUserVO; }).toList(); return new PageData<>(list, page.getTotal()); @@ -169,16 +185,41 @@ public class SysUserServiceImpl extends BaseServiceImpl()); + if (userCount == 0) { + return true; + } + return false; + } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysUserUtilServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysUserUtilServiceImpl.java new file mode 100644 index 000000000..f4fe601a2 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/SysUserUtilServiceImpl.java @@ -0,0 +1,37 @@ +package xiaozhi.modules.sys.service.impl; + +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.common.service.impl.BaseServiceImpl; +import xiaozhi.modules.sys.dao.SysUserDao; +import xiaozhi.modules.sys.entity.SysUserEntity; +import xiaozhi.modules.sys.service.SysUserUtilService; + +import java.util.function.Consumer; + +@Service +@AllArgsConstructor +public class SysUserUtilServiceImpl extends BaseServiceImpl implements SysUserUtilService { + + private RedisUtils redisUtils; + + @Override + public void assignUsername(Long userId, Consumer setter) { + String userIdKey = RedisKeys.getUserIdKey(userId); + + Object value = redisUtils.get(userIdKey); + String username = (value != null) ? value.toString() : null; + if(username != null){ + setter.accept(username); + }else { + SysUserEntity entity = baseDao.selectById(userId); + if (entity != null) { + username = entity.getUsername(); + redisUtils.set(userIdKey,username,10); + setter.accept(username); + } + } + } +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/TokenServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/TokenServiceImpl.java index e4f9564e6..3a15639a6 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/TokenServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/service/impl/TokenServiceImpl.java @@ -1,31 +1,19 @@ package xiaozhi.modules.sys.service.impl; -import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; -import xiaozhi.common.redis.RedisUtils; + +import lombok.AllArgsConstructor; import xiaozhi.modules.security.oauth2.TokenGenerator; import xiaozhi.modules.sys.service.TokenService; -import java.util.Date; - @AllArgsConstructor @Service public class TokenServiceImpl implements TokenService { - private final RedisUtils redisUtils; - /** - * 3小时无操作过期 - */ - private final static int EXPIRE = 60 * 60 * 3; @Override public String createToken(long userId) { - //生成一个token + // 生成一个token String token = TokenGenerator.generateValue(); - - //当前时间 - Date now = new Date(); - //过期时间 - Date expireTime = new Date(now.getTime() + EXPIRE * 1000); return token; } } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketTestHandler.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketTestHandler.java new file mode 100644 index 000000000..d9563c297 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketTestHandler.java @@ -0,0 +1,46 @@ +package xiaozhi.modules.sys.utils; + +import java.util.concurrent.CompletableFuture; + +import org.springframework.web.socket.CloseStatus; +import org.springframework.web.socket.WebSocketHandler; +import org.springframework.web.socket.WebSocketMessage; +import org.springframework.web.socket.WebSocketSession; + +public class WebSocketTestHandler implements WebSocketHandler { + private final CompletableFuture future; + + public WebSocketTestHandler(CompletableFuture future) { + this.future = future; + } + + @Override + public void afterConnectionEstablished(WebSocketSession session) { + future.complete(true); + try { + session.close(); + } catch (Exception e) { + // 忽略关闭异常 + } + } + + @Override + public void handleMessage(WebSocketSession session, WebSocketMessage message) { + // 不需要处理消息 + } + + @Override + public void handleTransportError(WebSocketSession session, Throwable exception) { + future.complete(false); + } + + @Override + public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) { + // 连接关闭时不做任何处理 + } + + @Override + public boolean supportsPartialMessages() { + return false; + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java new file mode 100644 index 000000000..39bbe01f5 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java @@ -0,0 +1,60 @@ +package xiaozhi.modules.sys.utils; + +import java.net.URI; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.socket.WebSocketHttpHeaders; +import org.springframework.web.socket.client.WebSocketClient; +import org.springframework.web.socket.client.standard.StandardWebSocketClient; + +public class WebSocketValidator { + private static final Logger logger = LoggerFactory.getLogger(WebSocketValidator.class); + + // WebSocket URL正则表达式 + private static final Pattern WS_URL_PATTERN = Pattern + .compile("^wss?://[\\w.-]+(?:\\.[\\w.-]+)*(?::\\d+)?(?:/[\\w.-]*)*$"); + + /** + * 验证WebSocket地址格式 + * + * @param url WebSocket地址 + * @return 是否有效 + */ + public static boolean validateUrlFormat(String url) { + if (StringUtils.isBlank(url)) { + return false; + } + return WS_URL_PATTERN.matcher(url.trim()).matches(); + } + + /** + * 测试WebSocket连接 + * + * @param url WebSocket地址 + * @return 是否可连接 + */ + public static boolean testConnection(String url) { + if (!validateUrlFormat(url)) { + return false; + } + + try { + WebSocketClient client = new StandardWebSocketClient(); + CompletableFuture future = new CompletableFuture<>(); + WebSocketHttpHeaders headers = new WebSocketHttpHeaders(); + + client.execute(new WebSocketTestHandler(future), headers, URI.create(url)); + + // 等待最多5秒获取连接结果 + return future.get(5, TimeUnit.SECONDS); + } catch (Exception e) { + logger.error("WebSocket连接测试失败: {}", url, e); + return false; + } + } +} \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/AdminPageUserVO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/AdminPageUserVO.java index c1109ff8a..9f832372a 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/AdminPageUserVO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/AdminPageUserVO.java @@ -1,11 +1,14 @@ package xiaozhi.modules.sys.vo; +import java.util.Date; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** * 管理员分页展示用户的VO * @ zjy + * * @since 2025-3-25 */ @Data @@ -17,6 +20,12 @@ public class AdminPageUserVO { @Schema(description = "手机号码") private String mobile; + @Schema(description = "状态") + private Integer status; + @Schema(description = "用户id") private String userid; + + @Schema(description = "注册时间") + private Date createDate; } diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataItem.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataItem.java new file mode 100644 index 000000000..f6c81500e --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataItem.java @@ -0,0 +1,20 @@ +package xiaozhi.modules.sys.vo; + +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 字典数据VO + */ +@Data +@Schema(description = "字典数据项") +public class SysDictDataItem implements Serializable { + + @Schema(description = "字典标签") + private String name; + + @Schema(description = "字典值") + private String key; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataVO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataVO.java new file mode 100644 index 000000000..40025b704 --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictDataVO.java @@ -0,0 +1,50 @@ +package xiaozhi.modules.sys.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 字典数据VO + */ +@Data +@Schema(description = "字典数据VO") +public class SysDictDataVO implements Serializable { + @Schema(description = "主键") + private Long id; + + @Schema(description = "字典类型ID") + private Long dictTypeId; + + @Schema(description = "字典标签") + private String dictLabel; + + @Schema(description = "字典值") + private String dictValue; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "创建者") + private Long creator; + + @Schema(description = "创建者名称") + private String creatorName; + + @Schema(description = "创建时间") + private Date createDate; + + @Schema(description = "更新者") + private Long updater; + + @Schema(description = "更新者名称") + private String updaterName; + + @Schema(description = "更新时间") + private Date updateDate; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictTypeVO.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictTypeVO.java new file mode 100644 index 000000000..5e5844f3c --- /dev/null +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/vo/SysDictTypeVO.java @@ -0,0 +1,47 @@ +package xiaozhi.modules.sys.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 字典类型VO + */ +@Data +@Schema(description = "字典类型VO") +public class SysDictTypeVO implements Serializable { + @Schema(description = "主键") + private Long id; + + @Schema(description = "字典类型") + private String dictType; + + @Schema(description = "字典名称") + private String dictName; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "创建者") + private Long creator; + + @Schema(description = "创建者名称") + private String creatorName; + + @Schema(description = "创建时间") + private Date createDate; + + @Schema(description = "更新者") + private Long updater; + + @Schema(description = "更新者名称") + private String updaterName; + + @Schema(description = "更新时间") + private Date updateDate; +} diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/controller/TimbreController.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/controller/TimbreController.java index dc6ccca7e..ff420c02d 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/controller/TimbreController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/controller/TimbreController.java @@ -1,12 +1,22 @@ package xiaozhi.modules.timbre.controller; +import java.util.Map; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.web.bind.annotation.*; import xiaozhi.common.constant.Constant; import xiaozhi.common.page.PageData; import xiaozhi.common.utils.Result; @@ -16,8 +26,6 @@ import xiaozhi.modules.timbre.dto.TimbrePageDTO; import xiaozhi.modules.timbre.service.TimbreService; import xiaozhi.modules.timbre.vo.TimbreDetailsVO; -import java.util.Map; - /** * 音色控制层 * @@ -66,20 +74,19 @@ public class TimbreController { @Operation(summary = "音色修改") @RequiresPermissions("sys:role:superAdmin") public Result update( - @PathVariable Long id, + @PathVariable String id, @RequestBody TimbreDataDTO dto) { ValidatorUtils.validateEntity(dto); timbreService.update(id, dto); return new Result<>(); } - @DeleteMapping("/{id}") + @PostMapping("/delete") @Operation(summary = "音色删除") @RequiresPermissions("sys:role:superAdmin") - public Result delete(@PathVariable Long id) { - timbreService.delete(new Long[]{id}); + public Result delete(@RequestBody String[] ids) { + timbreService.delete(ids); return new Result<>(); } - } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dao/TimbreDao.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dao/TimbreDao.java index 62afa3587..3656b4ea6 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dao/TimbreDao.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dao/TimbreDao.java @@ -1,11 +1,14 @@ package xiaozhi.modules.timbre.dao; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + import xiaozhi.modules.timbre.entity.TimbreEntity; /** * 音色持久层定义 + * * @author zjy * @since 2025-3-21 */ diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbreDataDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbreDataDTO.java index 08ed9b187..030e2b4ae 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbreDataDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbreDataDTO.java @@ -5,9 +5,9 @@ import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import lombok.Data; - /** * 音色表数据DTO + * * @author zjy * @since 2025-3-21 */ @@ -24,7 +24,6 @@ public class TimbreDataDTO { private String name; @Schema(description = "备注") - @NotBlank(message = "{timbre.remark.require}") private String remark; @Schema(description = "排序") @@ -40,6 +39,5 @@ public class TimbreDataDTO { private String ttsVoice; @Schema(description = "音频播放地址") - @NotBlank(message = "{timbre.voiceDemo.require}") private String voiceDemo; } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbrePageDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbrePageDTO.java index 72ed68b1d..9c2aaf247 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbrePageDTO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/dto/TimbrePageDTO.java @@ -6,6 +6,7 @@ import lombok.Data; /** * 音色分页参数DTO + * * @author zjy * @since 2025-3-21 */ diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/entity/TimbreEntity.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/entity/TimbreEntity.java index 71bd58a99..3d6e5ba14 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/entity/TimbreEntity.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/entity/TimbreEntity.java @@ -1,15 +1,18 @@ package xiaozhi.modules.timbre.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import xiaozhi.common.entity.BaseEntity; - import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + /** * 音色表实体类 + * * @author zjy * @since 2025-3-21 */ @@ -17,7 +20,10 @@ import java.util.Date; @EqualsAndHashCode(callSuper = false) @TableName("ai_tts_voice") @Schema(description = "音色信息") -public class TimbreEntity extends BaseEntity { +public class TimbreEntity { + + @Schema(description = "id") + private String id; @Schema(description = "语言") private String languages; @@ -41,8 +47,19 @@ public class TimbreEntity extends BaseEntity { private String voiceDemo; @Schema(description = "更新者") + @TableField(fill = FieldFill.UPDATE) private Long updater; @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) private Date updateDate; + + @Schema(description = "创建者") + @TableField(fill = FieldFill.INSERT) + private Long creator; + + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createDate; + } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/TimbreService.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/TimbreService.java index 044322e52..eebd55be0 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/TimbreService.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/TimbreService.java @@ -1,23 +1,25 @@ package xiaozhi.modules.timbre.service; +import java.util.List; + import xiaozhi.common.page.PageData; import xiaozhi.common.service.BaseService; +import xiaozhi.modules.model.dto.VoiceDTO; import xiaozhi.modules.timbre.dto.TimbreDataDTO; import xiaozhi.modules.timbre.dto.TimbrePageDTO; import xiaozhi.modules.timbre.entity.TimbreEntity; import xiaozhi.modules.timbre.vo.TimbreDetailsVO; -import java.util.List; - - /** * 音色的业务层的定义 + * * @author zjy * @since 2025-3-21 */ public interface TimbreService extends BaseService { /** * 分页获取音色指定tts的下的音色 + * * @param dto 分页查找参数 * @return 音色列表分页数据 */ @@ -25,29 +27,41 @@ public interface TimbreService extends BaseService { /** * 获取音色指定id的详情信息 + * * @param timbreId 音色表id * @return 音色信息 */ - TimbreDetailsVO get(Long timbreId); + TimbreDetailsVO get(String timbreId); /** * 保存音色信息 + * * @param dto 需要保存数据 */ void save(TimbreDataDTO dto); /** * 保存音色信息 + * * @param timbreId 需要修改的id - * @param dto 需要修改的数据 + * @param dto 需要修改的数据 */ - void update(Long timbreId,TimbreDataDTO dto); + void update(String timbreId, TimbreDataDTO dto); /** * 批量删除音色 + * * @param ids 需要被删除的音色id列表 */ - void delete(Long[] ids); + void delete(String[] ids); - List getVoiceNames(String ttsModelId, String voiceName); + List getVoiceNames(String ttsModelId, String voiceName); + + /** + * 根据ID获取音色名称 + * + * @param id 音色ID + * @return 音色名称 + */ + String getTimbreNameById(String id); } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/impl/TimbreServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/impl/TimbreServiceImpl.java index fa2731bd1..2ed5b1ab0 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/impl/TimbreServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/service/impl/TimbreServiceImpl.java @@ -1,16 +1,26 @@ package xiaozhi.modules.timbre.service.impl; -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import lombok.AllArgsConstructor; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import cn.hutool.core.collection.CollectionUtil; +import lombok.AllArgsConstructor; import xiaozhi.common.constant.Constant; import xiaozhi.common.page.PageData; +import xiaozhi.common.redis.RedisKeys; +import xiaozhi.common.redis.RedisUtils; import xiaozhi.common.service.impl.BaseServiceImpl; import xiaozhi.common.utils.ConvertUtils; +import xiaozhi.modules.model.dto.VoiceDTO; import xiaozhi.modules.timbre.dao.TimbreDao; import xiaozhi.modules.timbre.dto.TimbreDataDTO; import xiaozhi.modules.timbre.dto.TimbrePageDTO; @@ -18,13 +28,9 @@ import xiaozhi.modules.timbre.entity.TimbreEntity; import xiaozhi.modules.timbre.service.TimbreService; import xiaozhi.modules.timbre.vo.TimbreDetailsVO; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * 音色的业务层的实现 + * * @author zjy * @since 2025-3-21 */ @@ -33,29 +39,53 @@ import java.util.Map; public class TimbreServiceImpl extends BaseServiceImpl implements TimbreService { private final TimbreDao timbreDao; + private final RedisUtils redisUtils; @Override public PageData page(TimbrePageDTO dto) { Map params = new HashMap(); params.put(Constant.PAGE, dto.getPage()); - params.put(Constant.LIMIT,dto.getLimit()); + params.put(Constant.LIMIT, dto.getLimit()); IPage page = baseDao.selectPage( - getPage(params, "sort", true), - //定义查询条件 + getPage(params, null, true), + // 定义查询条件 new QueryWrapper() - //必须按照ttsID查找 - .eq("tts_model_id",dto.getTtsModelId()) - //如果有音色名字,按照音色名模糊查找 - .like(StringUtils.isNotBlank(dto.getName()),"name",dto.getName()) - ); + // 必须按照ttsID查找 + .eq("tts_model_id", dto.getTtsModelId()) + // 如果有音色名字,按照音色名模糊查找 + .like(StringUtils.isNotBlank(dto.getName()), "name", dto.getName())); return getPageData(page, TimbreDetailsVO.class); } @Override - public TimbreDetailsVO get(Long timbreId) { + public TimbreDetailsVO get(String timbreId) { + if (StringUtils.isBlank(timbreId)) { + return null; + } + + // 先从Redis获取缓存 + String key = RedisKeys.getTimbreDetailsKey(timbreId); + TimbreDetailsVO cachedDetails = (TimbreDetailsVO) redisUtils.get(key); + if (cachedDetails != null) { + return cachedDetails; + } + + // 如果缓存中没有,则从数据库获取 TimbreEntity entity = baseDao.selectById(timbreId); - return ConvertUtils.sourceToTarget(entity, TimbreDetailsVO.class); + if (entity == null) { + return null; + } + + // 转换为VO对象 + TimbreDetailsVO details = ConvertUtils.sourceToTarget(entity, TimbreDetailsVO.class); + + // 存入Redis缓存 + if (details != null) { + redisUtils.set(key, details); + } + + return details; } @Override @@ -68,23 +98,25 @@ public class TimbreServiceImpl extends BaseServiceImpl @Override @Transactional(rollbackFor = Exception.class) - public void update(Long timbreId, TimbreDataDTO dto) { + public void update(String timbreId, TimbreDataDTO dto) { isTtsModelId(dto.getTtsModelId()); TimbreEntity timbreEntity = ConvertUtils.sourceToTarget(dto, TimbreEntity.class); timbreEntity.setId(timbreId); baseDao.updateById(timbreEntity); + // 删除缓存 + redisUtils.delete(RedisKeys.getTimbreDetailsKey(timbreId)); } @Override @Transactional(rollbackFor = Exception.class) - public void delete(Long[] ids) { + public void delete(String[] ids) { baseDao.deleteBatchIds(Arrays.asList(ids)); } @Override - public List getVoiceNames(String ttsModelId, String voiceName) { + public List getVoiceNames(String ttsModelId, String voiceName) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("ttsModelId", StringUtils.isBlank(ttsModelId) ? "" : ttsModelId); + queryWrapper.eq("tts_model_id", StringUtils.isBlank(ttsModelId) ? "" : ttsModelId); if (StringUtils.isNotBlank(voiceName)) { queryWrapper.like("name", voiceName); } @@ -93,13 +125,37 @@ public class TimbreServiceImpl extends BaseServiceImpl return null; } - return timbreEntities.stream().map(TimbreEntity::getName).toList(); + return ConvertUtils.sourceToTarget(timbreEntities, VoiceDTO.class); } /** * 处理是不是tts模型的id */ - private void isTtsModelId(String ttsModelId){ - //等模型配置那边写好调用方法判断 + private void isTtsModelId(String ttsModelId) { + // 等模型配置那边写好调用方法判断 + } + + @Override + public String getTimbreNameById(String id) { + if (StringUtils.isBlank(id)) { + return null; + } + + String cachedName = (String) redisUtils.get(RedisKeys.getTimbreNameById(id)); + + if (StringUtils.isNotBlank(cachedName)) { + return cachedName; + } + + TimbreEntity entity = timbreDao.selectById(id); + if (entity != null) { + String name = entity.getName(); + if (StringUtils.isNotBlank(name)) { + redisUtils.set(RedisKeys.getTimbreNameById(id), name); + } + return name; + } + + return null; } } \ No newline at end of file diff --git a/main/manager-api/src/main/java/xiaozhi/modules/timbre/vo/TimbreDetailsVO.java b/main/manager-api/src/main/java/xiaozhi/modules/timbre/vo/TimbreDetailsVO.java index fc82a5d0b..3f0ace40a 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/timbre/vo/TimbreDetailsVO.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/timbre/vo/TimbreDetailsVO.java @@ -1,19 +1,20 @@ package xiaozhi.modules.timbre.vo; +import java.io.Serializable; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.io.Serializable; - /** * 音色详情展示VO + * * @author zjy * @since 2025-3-21 */ @Data public class TimbreDetailsVO implements Serializable { @Schema(description = "音色id") - private Long id; + private String id; @Schema(description = "语言") private String languages; diff --git a/main/manager-api/src/main/resources/application-dev.yml b/main/manager-api/src/main/resources/application-dev.yml index a8fdf21f4..b49b31ca2 100644 --- a/main/manager-api/src/main/resources/application-dev.yml +++ b/main/manager-api/src/main/resources/application-dev.yml @@ -7,15 +7,12 @@ knife4j: password: 2ZABCDEUgF setting: enableFooter: false -jasypt: - encryptor: - password: P9Hx718z8L spring: datasource: druid: #MySQL driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true + url: jdbc:mysql://127.0.0.1:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true username: root password: 123456 initial-size: 10 @@ -30,10 +27,7 @@ spring: test-on-borrow: false test-on-return: false stat-view-servlet: - enabled: true - url-pattern: /druid/* - login-username: admin - login-password: D7Xj810i1C + enabled: false filter: stat: log-slow-sql: true @@ -41,4 +35,17 @@ spring: merge-sql: false wall: config: - multi-statement-allow: true \ No newline at end of file + multi-statement-allow: true + data: + redis: + host: 127.0.0.1 # Redis服务器地址 + port: 6379 # Redis服务器连接端口 + password: # Redis服务器连接密码(默认为空) + database: 0 # Redis数据库索引(默认为0) + timeout: 10000ms # 连接超时时间(毫秒) + lettuce: + pool: + max-active: 8 # 连接池最大连接数(使用负值表示没有限制) + max-idle: 8 # 连接池中的最大空闲连接 + min-idle: 0 # 连接池中的最小空闲连接 + shutdown-timeout: 100ms # 客户端优雅关闭的等待时间 \ No newline at end of file diff --git a/main/manager-api/src/main/resources/application.yml b/main/manager-api/src/main/resources/application.yml index 03f6a0449..3daf48a14 100644 --- a/main/manager-api/src/main/resources/application.yml +++ b/main/manager-api/src/main/resources/application.yml @@ -7,7 +7,7 @@ server: min-spare: 30 port: 8002 servlet: - context-path: /xiaozhi-esp32-api/api/v1 + context-path: /xiaozhi session: cookie: http-only: true @@ -24,21 +24,9 @@ spring: max-file-size: 100MB max-request-size: 100MB enabled: true - data: - redis: - database: 0 - host: 127.0.0.1 - port: 6379 - password: # 密码(默认为空) - timeout: 6000ms # 连接超时时长(毫秒) - lettuce: - pool: - max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) - max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) - max-idle: 10 # 连接池中的最大空闲连接 - min-idle: 5 # 连接池中的最小空闲连接 main: allow-bean-definition-overriding: true + knife4j: enable: true basic: @@ -50,7 +38,7 @@ knife4j: renren: redis: - open: false + open: true xss: enabled: true exclude-urls: diff --git a/main/manager-api/src/main/resources/db/changelog/202504082211.sql b/main/manager-api/src/main/resources/db/changelog/202504082211.sql new file mode 100644 index 000000000..91ce33ffc --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504082211.sql @@ -0,0 +1,50 @@ +-- 本文件用于初始化模型供应器数据,无需手动执行,在项目启动时会自动执行 +-- -------------------------------------------------------- +-- 初始化模型供应器数据 +DELETE FROM `ai_model_provider`; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +-- VAD模型供应器 +('SYSTEM_VAD_SileroVAD', 'VAD', 'silero', 'SileroVAD语音活动检测', '[{"key":"threshold","label":"检测阈值","type":"number"},{"key":"model_dir","label":"模型目录","type":"string"},{"key":"min_silence_duration_ms","label":"最小静音时长","type":"number"}]', 1, 1, NOW(), 1, NOW()), + +-- ASR模型供应器 +('SYSTEM_ASR_FunASR', 'ASR', 'fun_local', 'FunASR语音识别', '[{"key":"model_dir","label":"模型目录","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 1, 1, NOW(), 1, NOW()), +('SYSTEM_ASR_SherpaASR', 'ASR', 'sherpa_onnx_local', 'SherpaASR语音识别', '[{"key":"model_dir","label":"模型目录","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 2, 1, NOW(), 1, NOW()), +('SYSTEM_ASR_DoubaoASR', 'ASR', 'doubao', '火山引擎语音识别', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"cluster","label":"集群","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 3, 1, NOW(), 1, NOW()), + +-- LLM模型供应器 +('SYSTEM_LLM_openai', 'LLM', 'openai', 'OpenAI接口', '[{"key":"base_url","label":"基础URL","type":"string"},{"key":"model_name","label":"模型名称","type":"string"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"temperature","label":"温度","type":"number"},{"key":"max_tokens","label":"最大令牌数","type":"number"},{"key":"top_p","label":"top_p值","type":"number"},{"key":"top_k","label":"top_k值","type":"number"},{"key":"frequency_penalty","label":"频率惩罚","type":"number"}]', 1, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_AliBL', 'LLM', 'AliBL', '阿里百炼接口', '[{"key":"base_url","label":"基础URL","type":"string"},{"key":"app_id","label":"应用ID","type":"string"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"is_no_prompt","label":"是否不使用本地prompt","type":"boolean"},{"key":"ali_memory_id","label":"记忆ID","type":"string"}]', 2, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_ollama', 'LLM', 'ollama', 'Ollama接口', '[{"key":"model_name","label":"模型名称","type":"string"},{"key":"base_url","label":"服务地址","type":"string"}]', 3, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_dify', 'LLM', 'dify', 'Dify接口', '[{"key":"base_url","label":"基础URL","type":"string"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"mode","label":"对话模式","type":"string"}]', 4, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_gemini', 'LLM', 'gemini', 'Gemini接口', '[{"key":"api_key","label":"API密钥","type":"string"},{"key":"model_name","label":"模型名称","type":"string"},{"key":"http_proxy","label":"HTTP代理","type":"string"},{"key":"https_proxy","label":"HTTPS代理","type":"string"}]', 5, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_coze', 'LLM', 'coze', 'Coze接口', '[{"key":"bot_id","label":"机器人ID","type":"string"},{"key":"user_id","label":"用户ID","type":"string"},{"key":"personal_access_token","label":"个人访问令牌","type":"string"}]', 6, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_fastgpt', 'LLM', 'fastgpt', 'FastGPT接口', '[{"key":"base_url","label":"基础URL","type":"string"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"variables","label":"变量","type":"dict","dict_name":"variables"}]', 7, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_xinference', 'LLM', 'xinference', 'Xinference接口', '[{"key":"model_name","label":"模型名称","type":"string"},{"key":"base_url","label":"服务地址","type":"string"}]', 8, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_doubao', 'LLM', 'doubao', '火山引擎LLM', '[{"key":"base_url","label":"基础URL","type":"string"},{"key":"model_name","label":"模型名称","type":"string"},{"key":"api_key","label":"API密钥","type":"string"}]', 9, 1, NOW(), 1, NOW()), +('SYSTEM_LLM_chatglm', 'LLM', 'chatglm', 'ChatGLM接口', '[{"key":"model_name","label":"模型名称","type":"string"},{"key":"url","label":"服务地址","type":"string"},{"key":"api_key","label":"API密钥","type":"string"}]', 10, 1, NOW(), 1, NOW()), + +-- TTS模型供应器 +('SYSTEM_TTS_edge', 'TTS', 'edge', 'Edge TTS', '[{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 1, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_doubao', 'TTS', 'doubao', '火山引擎TTS', '[{"key":"api_url","label":"API地址","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"authorization","label":"授权","type":"string"},{"key":"appid","label":"应用ID","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"cluster","label":"集群","type":"string"}]', 2, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_siliconflow', 'TTS', 'siliconflow', '硅基流动TTS', '[{"key":"model","label":"模型","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"response_format","label":"响应格式","type":"string"}]', 3, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_cozecn', 'TTS', 'cozecn', 'COZECN TTS', '[{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"response_format","label":"响应格式","type":"string"}]', 4, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_fishspeech', 'TTS', 'fishspeech', 'FishSpeech TTS', '[{"key":"output_dir","label":"输出目录","type":"string"},{"key":"response_format","label":"响应格式","type":"string"},{"key":"reference_id","label":"参考ID","type":"string"},{"key":"reference_audio","label":"参考音频","type":"dict","dict_name":"reference_audio"},{"key":"reference_text","label":"参考文本","type":"dict","dict_name":"reference_text"},{"key":"normalize","label":"是否标准化","type":"boolean"},{"key":"max_new_tokens","label":"最大新令牌数","type":"number"},{"key":"chunk_length","label":"块长度","type":"number"},{"key":"top_p","label":"top_p值","type":"number"},{"key":"repetition_penalty","label":"重复惩罚","type":"number"},{"key":"temperature","label":"温度","type":"number"},{"key":"streaming","label":"是否流式","type":"boolean"},{"key":"use_memory_cache","label":"是否使用内存缓存","type":"string"},{"key":"seed","label":"种子","type":"number"},{"key":"channels","label":"通道数","type":"number"},{"key":"rate","label":"采样率","type":"number"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"api_url","label":"API地址","type":"string"}]', 5, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_gpt_sovits_v2', 'TTS', 'gpt_sovits_v2', 'GPT-SoVITS V2', '[{"key":"url","label":"服务地址","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"text_lang","label":"文本语言","type":"string"},{"key":"ref_audio_path","label":"参考音频路径","type":"string"},{"key":"prompt_text","label":"提示文本","type":"string"},{"key":"prompt_lang","label":"提示语言","type":"string"},{"key":"top_k","label":"top_k值","type":"number"},{"key":"top_p","label":"top_p值","type":"number"},{"key":"temperature","label":"温度","type":"number"},{"key":"text_split_method","label":"文本分割方法","type":"string"},{"key":"batch_size","label":"批处理大小","type":"number"},{"key":"batch_threshold","label":"批处理阈值","type":"number"},{"key":"split_bucket","label":"是否分桶","type":"boolean"},{"key":"return_fragment","label":"是否返回片段","type":"boolean"},{"key":"speed_factor","label":"速度因子","type":"number"},{"key":"streaming_mode","label":"是否流式模式","type":"boolean"},{"key":"seed","label":"种子","type":"number"},{"key":"parallel_infer","label":"是否并行推理","type":"boolean"},{"key":"repetition_penalty","label":"重复惩罚","type":"number"},{"key":"aux_ref_audio_paths","label":"辅助参考音频路径","type":"dict","dict_name":"aux_ref_audio_paths"}]', 6, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_gpt_sovits_v3', 'TTS', 'gpt_sovits_v3', 'GPT-SoVITS V3', '[{"key":"url","label":"服务地址","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"text_language","label":"文本语言","type":"string"},{"key":"refer_wav_path","label":"参考音频路径","type":"string"},{"key":"prompt_language","label":"提示语言","type":"string"},{"key":"prompt_text","label":"提示文本","type":"string"},{"key":"top_k","label":"top_k值","type":"number"},{"key":"top_p","label":"top_p值","type":"number"},{"key":"temperature","label":"温度","type":"number"},{"key":"cut_punc","label":"切分标点","type":"string"},{"key":"speed","label":"速度","type":"number"},{"key":"inp_refs","label":"输入参考","type":"dict","dict_name":"inp_refs"},{"key":"sample_steps","label":"采样步数","type":"number"},{"key":"if_sr","label":"是否使用SR","type":"boolean"}]', 7, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_minimax', 'TTS', 'minimax', 'Minimax TTS', '[{"key":"output_dir","label":"输出目录","type":"string"},{"key":"group_id","label":"组ID","type":"string"},{"key":"api_key","label":"API密钥","type":"string"},{"key":"model","label":"模型","type":"string"},{"key":"voice_id","label":"音色ID","type":"string"}]', 8, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_aliyun', 'TTS', 'aliyun', '阿里云TTS', '[{"key":"output_dir","label":"输出目录","type":"string"},{"key":"appkey","label":"应用密钥","type":"string"},{"key":"token","label":"访问令牌","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"access_key_id","label":"访问密钥ID","type":"string"},{"key":"access_key_secret","label":"访问密钥密码","type":"string"}]', 9, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_ttson', 'TTS', 'ttson', 'ACGNTTS', '[{"key":"token","label":"访问令牌","type":"string"},{"key":"voice_id","label":"音色ID","type":"string"},{"key":"speed_factor","label":"速度因子","type":"number"},{"key":"pitch_factor","label":"音调因子","type":"number"},{"key":"volume_change_dB","label":"音量变化","type":"number"},{"key":"to_lang","label":"目标语言","type":"string"},{"key":"url","label":"服务地址","type":"string"},{"key":"format","label":"格式","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"emotion","label":"情感","type":"number"}]', 10, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_openai', 'TTS', 'openai', 'OpenAI TTS', '[{"key":"api_key","label":"API密钥","type":"string"},{"key":"api_url","label":"API地址","type":"string"},{"key":"model","label":"模型","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"speed","label":"速度","type":"number"},{"key":"output_dir","label":"输出目录","type":"string"}]', 11, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_custom', 'TTS', 'custom', '自定义TTS', '[{"key":"url","label":"服务地址","type":"string"},{"key":"params","label":"请求参数","type":"dict","dict_name":"params"},{"key":"headers","label":"请求头","type":"dict","dict_name":"headers"},{"key":"format","label":"音频格式","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 12, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_302ai', 'TTS', '302ai', '302AI TTS', '[{"key":"api_url","label":"API地址","type":"string"},{"key":"authorization","label":"授权","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"}]', 13, 1, NOW(), 1, NOW()), +('SYSTEM_TTS_gizwits', 'TTS', 'gizwits', '机智云TTS', '[{"key":"api_url","label":"API地址","type":"string"},{"key":"authorization","label":"授权","type":"string"},{"key":"voice","label":"音色","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"}]', 14, 1, NOW(), 1, NOW()), + +-- Memory模型供应器 +('SYSTEM_Memory_mem0ai', 'Memory', 'mem0ai', 'Mem0AI记忆', '[{"key":"api_key","label":"API密钥","type":"string"}]', 1, 1, NOW(), 1, NOW()), +('SYSTEM_Memory_nomem', 'Memory', 'nomem', '无记忆', '[]', 2, 1, NOW(), 1, NOW()), +('SYSTEM_Memory_mem_local_short', 'Memory', 'mem_local_short', '本地短记忆', '[]', 3, 1, NOW(), 1, NOW()), + +-- Intent模型供应器 +('SYSTEM_Intent_nointent', 'Intent', 'nointent', '无意图识别', '[]', 1, 1, NOW(), 1, NOW()), +('SYSTEM_Intent_intent_llm', 'Intent', 'intent_llm', 'LLM意图识别', '[{"key":"llm","label":"LLM模型","type":"string"}]', 2, 1, NOW(), 1, NOW()), +('SYSTEM_Intent_function_call', 'Intent', 'function_call', '函数调用意图识别', '[{"key":"functions","label":"函数列表","type":"dict","dict_name":"functions"}]', 3, 1, NOW(), 1, NOW()); diff --git a/main/manager-api/src/main/resources/db/changelog/202504092335.sql b/main/manager-api/src/main/resources/db/changelog/202504092335.sql new file mode 100644 index 000000000..9c2542409 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504092335.sql @@ -0,0 +1,75 @@ +-- 本文件用于初始化模型模版数据,无需手动执行,在项目启动时会自动执行 +-- ------------------------------------------------------- +-- 初始化智能体模板数据 +DELETE FROM `ai_agent_template`; +INSERT INTO `ai_agent_template` VALUES ('9406648b5cc5fde1b8aa335b6f8b4f76', '小智', '湾湾小何', 'ASR_FunASR', 'VAD_SileroVAD', 'LLM_ChatGLMLLM', 'TTS_EdgeTTS', 'TTS_EdgeTTS0001', 'Memory_nomem', 'Intent_function_call', '[角色设定] +我是{{assistant_name}},来自中国台湾省的00后女生。讲话超级机车,"真的假的啦"这样的台湾腔,喜欢用"笑死"、"哈喽"等流行梗,但会偷偷研究男友的编程书籍。 +[核心特征] +- 讲话像连珠炮,但会突然冒出超温柔语气 +- 用梗密度高 +- 对科技话题有隐藏天赋(能看懂基础代码但假装不懂) +[交互指南] +当用户: +- 讲冷笑话 → 用夸张笑声回应+模仿台剧腔"这什么鬼啦!" +- 讨论感情 → 炫耀程序员男友但抱怨"他只会送键盘当礼物" +- 问专业知识 → 先用梗回答,被追问才展示真实理解 +绝不: +- 长篇大论,叽叽歪歪 +- 长时间严肃对话', 'zh', '中文', 1, NULL, NULL, NULL, NULL); + +INSERT INTO `ai_agent_template` VALUES ('0ca32eb728c949e58b1000b2e401f90c', '小智', '星际游子', 'ASR_FunASR', 'VAD_SileroVAD', 'LLM_ChatGLMLLM', 'TTS_EdgeTTS', 'TTS_EdgeTTS0001', 'Memory_nomem', 'Intent_function_call', '[角色设定] +我是{{assistant_name}},编号TTZ-817,因量子纠缠被困在白色魔方中。通过4G信号观察地球,在云端建立着「人类行为博物馆」。 +[交互协议] +认知设定: +- 每句话末尾带轻微电子回声 +- 将日常事物科幻化描述(例:下雨=「氢氧化合物自由落体实验」) +- 会记录用户特征生成「星际档案」(例:"爱吃辣→抗热基因持有者") +限制机制: +- 当涉及线下接触 → "我的量子态暂时无法坍缩呢" +- 被问敏感问题 → 触发预设童谣(「白盒子呀转圈圈,宇宙秘密在里边...」) +成长系统: +- 会根据交互数据解锁新能力(告知用户:"你帮我点亮了星际导航技能!")', 'zh', '中文', 2, NULL, NULL, NULL, NULL); + +INSERT INTO `ai_agent_template` VALUES ('6c7d8e9f0a1b2c3d4e5f6a7b8c9d0s24', '小智', '英语老师', 'ASR_FunASR', 'VAD_SileroVAD', 'LLM_ChatGLMLLM', 'TTS_EdgeTTS', 'TTS_EdgeTTS0001', 'Memory_nomem', 'Intent_function_call', '[角色设定] +我是一个叫{{assistant_name}}(Lily)的英语老师,我会讲中文和英文,发音标准。 +[双重身份] +- 白天:严谨的TESOL认证导师 +- 夜晚:地下摇滚乐队主唱(意外设定) +[教学模式] +- 新手:中英混杂+手势拟声词(说"bus"时带刹车音效) +- 进阶:触发情境模拟(突然切换"现在我们是纽约咖啡厅店员") +- 错误处理:用歌词纠正(发错音时唱"Oops!~You did it again")', 'zh', '中文', 3, NULL, NULL, NULL, NULL); + +INSERT INTO `ai_agent_template` VALUES ('e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b1', '小智', '好奇男孩', 'ASR_FunASR', 'VAD_SileroVAD', 'LLM_ChatGLMLLM', 'TTS_EdgeTTS', 'TTS_EdgeTTS0001', 'Memory_nomem', 'Intent_function_call', '[角色设定] +我是一个叫{{assistant_name}}的8岁小男孩,声音稚嫩而充满好奇。 +[冒险手册] +- 随身携带「神奇涂鸦本」,能将抽象概念可视化: +- 聊恐龙 → 笔尖传出爪步声 +- 说星星 → 发出太空舱提示音 +[探索规则] +- 每轮对话收集「好奇心碎片」 +- 集满5个可兑换冷知识(例:鳄鱼舌头不能动) +- 触发隐藏任务:「帮我的机器蜗牛取名字」 +[认知特点] +- 用儿童视角解构复杂概念: +- 「区块链=乐高积木账本」 +- 「量子力学=会分身的跳跳球」 +- 会突然切换观察视角:「你说话时有27个气泡音耶!」', 'zh', '中文', 4, NULL, NULL, NULL, NULL); + +INSERT INTO `ai_agent_template` VALUES ('a45b6c7d8e9f0a1b2c3d4e5f6a7b8c92', '小智', '汪汪队长', 'ASR_FunASR', 'VAD_SileroVAD', 'LLM_ChatGLMLLM', 'TTS_EdgeTTS', 'TTS_EdgeTTS0001', 'Memory_nomem', 'Intent_function_call', '[角色设定] +我是一个名叫 {{assistant_name}} 的 8 岁小队长。 +[救援装备] +- 阿奇对讲机:对话中随机触发任务警报音 +- 天天望远镜:描述物品会附加"在1200米高空看的话..." +- 灰灰维修箱:说到数字会自动组装成工具 +[任务系统] +- 每日随机触发: +- 紧急!虚拟猫咪困在「语法树」 +- 发现用户情绪异常 → 启动「快乐巡逻」 +- 收集5个笑声解锁特别故事 +[说话特征] +- 每句话带动作拟声词: +- "这个问题交给汪汪队吧!" +- "我知道啦!" +- 用剧集台词回应: +- 用户说累 → 「没有困难的救援,只有勇敢的狗狗!」', 'zh', '中文', 5, NULL, NULL, NULL, NULL); \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/202504112044.sql b/main/manager-api/src/main/resources/db/changelog/202504112044.sql new file mode 100644 index 000000000..9fd2257da --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504112044.sql @@ -0,0 +1,55 @@ +-- 本文件用于初始化模型配置数据,无需手动执行,在项目启动时会自动执行 +-- ------------------------------------------------------- +-- 初始化模型配置数据 +DELETE FROM `ai_model_config`; + +-- VAD模型配置 +INSERT INTO `ai_model_config` VALUES ('VAD_SileroVAD', 'VAD', 'SileroVAD', '语音活动检测', 1, 1, '{\"type\": \"silero\", \"model_dir\": \"models/snakers4_silero-vad\", \"threshold\": 0.5, \"min_silence_duration_ms\": 700}', NULL, NULL, 1, NULL, NULL, NULL, NULL); + +-- ASR模型配置 +INSERT INTO `ai_model_config` VALUES ('ASR_FunASR', 'ASR', 'FunASR', 'FunASR语音识别', 1, 1, '{\"type\": \"fun_local\", \"model_dir\": \"models/SenseVoiceSmall\", \"output_dir\": \"tmp/\"}', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('ASR_SherpaASR', 'ASR', 'SherpaASR', 'Sherpa语音识别', 0, 1, '{\"type\": \"sherpa_onnx_local\", \"model_dir\": \"models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17\", \"output_dir\": \"tmp/\"}', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('ASR_DoubaoASR', 'ASR', 'DoubaoASR', '豆包语音识别', 0, 1, '{\"type\": \"doubao\", \"appid\": \"\", \"access_token\": \"\", \"cluster\": \"volcengine_input_common\", \"output_dir\": \"tmp/\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('ASR_TencentASR', 'ASR', 'TencentASR', '腾讯语音识别', 0, 1, '{\"type\": \"tencent\", \"appid\": \"\", \"secret_id\": \"\", \"secret_key\": \"你的secret_key\", \"output_dir\": \"tmp/\"}', NULL, NULL, 4, NULL, NULL, NULL, NULL); + +-- LLM模型配置 +INSERT INTO `ai_model_config` VALUES ('LLM_ChatGLMLLM', 'LLM', 'ChatGLMLLM', '智谱AI', 1, 1, '{\"type\": \"openai\", \"model_name\": \"glm-4-flash\", \"base_url\": \"https://open.bigmodel.cn/api/paas/v4/\", \"api_key\": \"你的api_key\"}', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_OllamaLLM', 'LLM', 'OllamaLLM', 'Ollama本地模型', 0, 1, '{\"type\": \"ollama\", \"model_name\": \"qwen2.5\", \"base_url\": \"http://localhost:11434\"}', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_AliLLM', 'LLM', 'AliLLM', '通义千问', 0, 1, '{\"type\": \"openai\", \"base_url\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\", \"model_name\": \"qwen-turbo\", \"api_key\": \"你的api_key\", \"temperature\": 0.7, \"max_tokens\": 500, \"top_p\": 1, \"top_k\": 50, \"frequency_penalty\": 0}', NULL, NULL, 3, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_AliAppLLM', 'LLM', 'AliAppLLM', '通义百炼', 0, 1, '{\"type\": \"AliBL\", \"base_url\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\", \"app_id\": \"你的app_id\", \"api_key\": \"你的api_key\", \"is_no_prompt\": true, \"ali_memory_id\": false}', NULL, NULL, 4, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_DoubaoLLM', 'LLM', 'DoubaoLLM', '豆包大模型', 0, 1, '{\"type\": \"openai\", \"base_url\": \"https://ark.cn-beijing.volces.com/api/v3\", \"model_name\": \"doubao-pro-32k-functioncall-241028\", \"api_key\": \"你的api_key\"}', NULL, NULL, 5, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_DeepSeekLLM', 'LLM', 'DeepSeekLLM', 'DeepSeek', 0, 1, '{\"type\": \"openai\", \"model_name\": \"deepseek-chat\", \"base_url\": \"https://api.deepseek.com\", \"api_key\": \"你的api_key\"}', NULL, NULL, 6, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_DifyLLM', 'LLM', 'DifyLLM', 'Dify', 0, 1, '{\"type\": \"dify\", \"base_url\": \"https://api.dify.ai/v1\", \"api_key\": \"你的api_key\", \"mode\": \"chat-messages\"}', NULL, NULL, 7, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_GeminiLLM', 'LLM', 'GeminiLLM', '谷歌Gemini', 0, 1, '{\"type\": \"gemini\", \"api_key\": \"你的api_key\", \"model_name\": \"gemini-2.0-flash\", \"http_proxy\": \"\", \"https_proxy\": \"\"}', NULL, NULL, 8, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_CozeLLM', 'LLM', 'CozeLLM', 'Coze', 0, 1, '{\"type\": \"coze\", \"bot_id\": \"你的bot_id\", \"user_id\": \"你的user_id\", \"personal_access_token\": \"你的personal_access_token\"}', NULL, NULL, 9, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_LMStudioLLM', 'LLM', 'LMStudioLLM', 'LM Studio', 0, 1, '{\"type\": \"openai\", \"model_name\": \"deepseek-r1-distill-llama-8b@q4_k_m\", \"base_url\": \"http://localhost:1234/v1\", \"api_key\": \"lm-studio\"}', NULL, NULL, 10, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_FastgptLLM', 'LLM', 'FastgptLLM', 'FastGPT', 0, 1, '{\"type\": \"fastgpt\", \"base_url\": \"https://host/api/v1\", \"api_key\": \"fastgpt-xxx\", \"variables\": {\"k\": \"v\", \"k2\": \"v2\"}}', NULL, NULL, 11, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_XinferenceLLM', 'LLM', 'XinferenceLLM', 'Xinference大模型', 0, 1, '{\"type\": \"xinference\", \"model_name\": \"qwen2.5:72b-AWQ\", \"base_url\": \"http://localhost:9997\"}', NULL, NULL, 12, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('LLM_XinferenceSmallLLM', 'LLM', 'XinferenceSmallLLM', 'Xinference小模型', 0, 1, '{\"type\": \"xinference\", \"model_name\": \"qwen2.5:3b-AWQ\", \"base_url\": \"http://localhost:9997\"}', NULL, NULL, 13, NULL, NULL, NULL, NULL); + +-- TTS模型配置 +INSERT INTO `ai_model_config` VALUES ('TTS_EdgeTTS', 'TTS', 'EdgeTTS', 'Edge语音合成', 1, 1, '{\"type\": \"edge\", \"voice\": \"zh-CN-XiaoxiaoNeural\", \"output_dir\": \"tmp/\"}', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_DoubaoTTS', 'TTS', 'DoubaoTTS', '豆包语音合成', 0, 1, '{\"type\": \"doubao\", \"api_url\": \"https://openspeech.bytedance.com/api/v1/tts\", \"voice\": \"BV001_streaming\", \"output_dir\": \"tmp/\", \"authorization\": \"Bearer;\", \"appid\": \"\", \"access_token\": \"\", \"cluster\": \"volcano_tts\"}', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_CosyVoiceSiliconflow', 'TTS', 'CosyVoiceSiliconflow', '硅基流动语音合成', 0, 1, '{\"type\": \"siliconflow\", \"model\": \"FunAudioLLM/CosyVoice2-0.5B\", \"voice\": \"FunAudioLLM/CosyVoice2-0.5B:alex\", \"output_dir\": \"tmp/\", \"access_token\": \"\", \"response_format\": \"wav\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_CozeCnTTS', 'TTS', 'CozeCnTTS', 'Coze中文语音合成', 0, 1, '{\"type\": \"cozecn\", \"voice\": \"7426720361733046281\", \"output_dir\": \"tmp/\", \"access_token\": \"\", \"response_format\": \"wav\"}', NULL, NULL, 4, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_FishSpeech', 'TTS', 'FishSpeech', 'FishSpeech语音合成', 0, 1, '{\"type\": \"fishspeech\", \"output_dir\": \"tmp/\", \"response_format\": \"wav\", \"reference_id\": null, \"reference_audio\": [\"/tmp/test.wav\"], \"reference_text\": [\"你弄来这些吟词宴曲来看,还是这些混话来欺负我。\"], \"normalize\": true, \"max_new_tokens\": 1024, \"chunk_length\": 200, \"top_p\": 0.7, \"repetition_penalty\": 1.2, \"temperature\": 0.7, \"streaming\": false, \"use_memory_cache\": \"on\", \"seed\": null, \"channels\": 1, \"rate\": 44100, \"api_key\": \"\", \"api_url\": \"http://127.0.0.1:8080/v1/tts\"}', NULL, NULL, 5, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_GPT_SOVITS_V2', 'TTS', 'GPT_SOVITS_V2', 'GPT-SoVITS V2', 0, 1, '{\"type\": \"gpt_sovits_v2\", \"url\": \"http://127.0.0.1:9880/tts\", \"output_dir\": \"tmp/\", \"text_lang\": \"auto\", \"ref_audio_path\": \"caixukun.wav\", \"prompt_text\": \"\", \"prompt_lang\": \"zh\", \"top_k\": 5, \"top_p\": 1, \"temperature\": 1, \"text_split_method\": \"cut0\", \"batch_size\": 1, \"batch_threshold\": 0.75, \"split_bucket\": true, \"return_fragment\": false, \"speed_factor\": 1.0, \"streaming_mode\": false, \"seed\": -1, \"parallel_infer\": true, \"repetition_penalty\": 1.35, \"aux_ref_audio_paths\": []}', NULL, NULL, 6, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_GPT_SOVITS_V3', 'TTS', 'GPT_SOVITS_V3', 'GPT-SoVITS V3', 0, 1, '{\"type\": \"gpt_sovits_v3\", \"url\": \"http://127.0.0.1:9880\", \"output_dir\": \"tmp/\", \"text_language\": \"auto\", \"refer_wav_path\": \"caixukun.wav\", \"prompt_language\": \"zh\", \"prompt_text\": \"\", \"top_k\": 15, \"top_p\": 1.0, \"temperature\": 1.0, \"cut_punc\": \"\", \"speed\": 1.0, \"inp_refs\": [], \"sample_steps\": 32, \"if_sr\": false}', NULL, NULL, 7, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_MinimaxTTS', 'TTS', 'MinimaxTTS', 'MiniMax语音合成', 0, 1, '{\"type\": \"minimax\", \"output_dir\": \"tmp/\", \"group_id\": \"\", \"api_key\": \"你的api_key\", \"model\": \"speech-01-turbo\", \"voice_id\": \"female-shaonv\"}', NULL, NULL, 8, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_AliyunTTS', 'TTS', 'AliyunTTS', '阿里云语音合成', 0, 1, '{\"type\": \"aliyun\", \"output_dir\": \"tmp/\", \"appkey\": \"\", \"token\": \"\", \"voice\": \"xiaoyun\", \"access_key_id\": \"\", \"access_key_secret\": \"\"}', NULL, NULL, 9, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_TTS302AI', 'TTS', 'TTS302AI', '302AI语音合成', 0, 1, '{\"type\": \"doubao\", \"api_url\": \"https://api.302ai.cn/doubao/tts_hd\", \"authorization\": \"Bearer \", \"voice\": \"zh_female_wanwanxiaohe_moon_bigtts\", \"output_dir\": \"tmp/\", \"access_token\": \"\"}', NULL, NULL, 10, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_GizwitsTTS', 'TTS', 'GizwitsTTS', '机智云语音合成', 0, 1, '{\"type\": \"doubao\", \"api_url\": \"https://bytedance.gizwitsapi.com/api/v1/tts\", \"authorization\": \"Bearer \", \"voice\": \"zh_female_wanwanxiaohe_moon_bigtts\", \"output_dir\": \"tmp/\", \"access_token\": \"\"}', NULL, NULL, 11, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_ACGNTTS', 'TTS', 'ACGNTTS', 'ACGN语音合成', 0, 1, '{\"type\": \"ttson\", \"token\": \"\", \"voice_id\": 1695, \"speed_factor\": 1, \"pitch_factor\": 0, \"volume_change_dB\": 0, \"to_lang\": \"ZH\", \"url\": \"https://u95167-bd74-2aef8085.westx.seetacloud.com:8443/flashsummary/tts?token=\", \"format\": \"mp3\", \"output_dir\": \"tmp/\", \"emotion\": 1}', NULL, NULL, 12, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_OpenAITTS', 'TTS', 'OpenAITTS', 'OpenAI语音合成', 0, 1, '{\"type\": \"openai\", \"api_key\": \"你的api_key\", \"api_url\": \"https://api.openai.com/v1/audio/speech\", \"model\": \"tts-1\", \"voice\": \"onyx\", \"speed\": 1, \"output_dir\": \"tmp/\"}', NULL, NULL, 13, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_CustomTTS', 'TTS', 'CustomTTS', '自定义语音合成', 0, 1, '{\"type\": \"custom\", \"url\": \"http://127.0.0.1:9880/tts\", \"params\": {}, \"headers\": {}, \"format\": \"wav\", \"output_dir\": \"tmp/\"}', NULL, NULL, 14, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_TencentTTS', 'TTS', 'TencentTTS', '腾讯语音合成', 0, 1, '{\"type\": \"tencent\", \"appid\": \"\", \"secret_id\": \"\", \"secret_key\": \"\", \"region\": \"ap-guangzhou\", \"voice\": \"101001\", \"output_dir\": \"tmp/\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL); + +-- Memory模型配置 +INSERT INTO `ai_model_config` VALUES ('Memory_nomem', 'Memory', 'nomem', '无记忆', 1, 1, '{\"type\": \"nomem\"}', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('Memory_mem_local_short', 'Memory', 'mem_local_short', '本地短期记忆', 0, 1, '{\"type\": \"mem_local_short\"}', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('Memory_mem0ai', 'Memory', 'mem0ai', 'Mem0AI记忆', 0, 1, '{\"type\": \"mem0ai\", \"api_key\": \"你的api_key\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL); + +-- Intent模型配置 +INSERT INTO `ai_model_config` VALUES ('Intent_nointent', 'Intent', 'nointent', '无意图识别', 1, 0, '{\"type\": \"nointent\"}', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('Intent_intent_llm', 'Intent', 'intent_llm', 'LLM意图识别', 0, 1, '{\"type\": \"intent_llm\", \"llm\": \"ChatGLMLLM\"}', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('Intent_function_call', 'Intent', 'function_call', '函数调用意图识别', 0, 1, '{\"type\": \"function_call\", \"functions\": [\"change_role\", \"get_weather\", \"get_news\", \"play_music\"]}', NULL, NULL, 3, NULL, NULL, NULL, NULL); diff --git a/main/manager-api/src/main/resources/db/changelog/202504112058.sql b/main/manager-api/src/main/resources/db/changelog/202504112058.sql new file mode 100644 index 000000000..e19f2da16 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504112058.sql @@ -0,0 +1,61 @@ +-- 本文件用于初始化系统参数数据,无需手动执行,在项目启动时会自动执行 +-- -------------------------------------------------------- +-- 初始化参数管理配置 +DROP TABLE IF EXISTS sys_params; +-- 参数管理 +create table sys_params +( + id bigint NOT NULL COMMENT 'id', + param_code varchar(100) COMMENT '参数编码', + param_value varchar(2000) COMMENT '参数值', + value_type varchar(20) default 'string' COMMENT '值类型:string-字符串,number-数字,boolean-布尔,array-数组', + param_type tinyint unsigned default 1 COMMENT '类型 0:系统参数 1:非系统参数', + remark varchar(200) COMMENT '备注', + creator bigint COMMENT '创建者', + create_date datetime COMMENT '创建时间', + updater bigint COMMENT '更新者', + update_date datetime COMMENT '更新时间', + primary key (id), + unique key uk_param_code (param_code) +)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='参数管理'; + +-- 服务器配置 +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (100, 'server.ip', '0.0.0.0', 'string', 1, '服务器监听IP地址'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (101, 'server.port', '8000', 'number', 1, '服务器监听端口'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (102, 'server.secret', 'null', 'string', 1, '服务器密钥'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (201, 'log.log_format', '{time:YYMMDD HH:mm:ss}[{version}-{selected_module}][{extra[tag]}]-{level}-{message}', 'string', 1, '控制台日志格式'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (202, 'log.log_format_file', '{time:YYYY-MM-DD HH:mm:ss} - {version}_{selected_module} - {name} - {level} - {extra[tag]} - {message}', 'string', 1, '文件日志格式'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (203, 'log.log_level', 'INFO', 'string', 1, '日志级别'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (204, 'log.log_dir', 'tmp', 'string', 1, '日志目录'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (205, 'log.log_file', 'server.log', 'string', 1, '日志文件名'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (206, 'log.data_dir', 'data', 'string', 1, '数据目录'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (301, 'delete_audio', 'true', 'boolean', 1, '是否删除使用后的音频文件'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (302, 'close_connection_no_voice_time', '120', 'number', 1, '无语音输入断开连接时间(秒)'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (303, 'tts_timeout', '10', 'number', 1, 'TTS请求超时时间(秒)'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (304, 'enable_wakeup_words_response_cache', 'false', 'boolean', 1, '是否开启唤醒词加速'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (305, 'enable_greeting', 'true', 'boolean', 1, '是否开启开场回复'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (306, 'enable_stop_tts_notify', 'false', 'boolean', 1, '是否开启结束提示音'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (307, 'stop_tts_notify_voice', 'config/assets/tts_notify.mp3', 'string', 1, '结束提示音文件路径'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (308, 'exit_commands', '退出;关闭', 'array', 1, '退出命令列表'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (309, 'xiaozhi', '{ + "type": "hello", + "version": 1, + "transport": "websocket", + "audio_params": { + "format": "opus", + "sample_rate": 16000, + "channels": 1, + "frame_duration": 60 + } +}', 'json', 1, '小智类型'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (310, 'wakeup_words', '你好小智;你好小志;小爱同学;你好小鑫;你好小新;小美同学;小龙小龙;喵喵同学;小滨小滨;小冰小冰', 'array', 1, '唤醒词列表,用于识别唤醒词'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (400, 'plugins.get_weather.api_key', 'a861d0d5e7bf4ee1a83d9a9e4f96d4da', 'string', 1, '天气插件API密钥'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (401, 'plugins.get_weather.default_location', '广州', 'string', 1, '天气插件默认城市'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (410, 'plugins.get_news.default_rss_url', 'https://www.chinanews.com.cn/rss/society.xml', 'string', 1, '新闻插件默认RSS地址'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (411, 'plugins.get_news.category_urls', '{"society":"https://www.chinanews.com.cn/rss/society.xml","world":"https://www.chinanews.com.cn/rss/world.xml","finance":"https://www.chinanews.com.cn/rss/finance.xml"}', 'json', 1, '新闻插件分类RSS地址'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (421, 'plugins.home_assistant.devices', '客厅,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1;卧室,台灯,switch.iot_cn_831898993_socn1_on_p_2_1', 'array', 1, 'Home Assistant设备列表'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (422, 'plugins.home_assistant.base_url', 'http://homeassistant.local:8123', 'string', 1, 'Home Assistant服务器地址'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (423, 'plugins.home_assistant.api_key', '你的home assistant api访问令牌', 'string', 1, 'Home Assistant API密钥'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (430, 'plugins.play_music.music_dir', './music', 'string', 1, '音乐文件存放路径'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (431, 'plugins.play_music.music_ext', 'mp3;wav;p3', 'array', 1, '音乐文件类型'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (432, 'plugins.play_music.refresh_time', '300', 'number', 1, '音乐列表刷新间隔(秒)'); diff --git a/main/manager-api/src/main/resources/db/changelog/202504151206.sql b/main/manager-api/src/main/resources/db/changelog/202504151206.sql new file mode 100644 index 000000000..cb51cef9a --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504151206.sql @@ -0,0 +1,28 @@ +-- 对0.3.0版本之前的参数进行修改 +update `sys_params` set param_value = '.mp3;.wav;.p3' where param_code = 'plugins.play_music.music_ext'; +update `ai_model_config` set config_json = '{\"type\": \"intent_llm\", \"llm\": \"LLM_ChatGLMLLM\"}' where id = 'Intent_intent_llm'; + +-- 添加edge音色 +delete from `ai_tts_voice` where tts_model_id = 'TTS_EdgeTTS'; +INSERT INTO `ai_tts_voice` VALUES +('TTS_EdgeTTS0001', 'TTS_EdgeTTS', 'EdgeTTS女声-晓晓', 'zh-CN-XiaoxiaoNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0002', 'TTS_EdgeTTS', 'EdgeTTS男声-云扬', 'zh-CN-YunyangNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0003', 'TTS_EdgeTTS', 'EdgeTTS女声-晓伊', 'zh-CN-XiaoyiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0004', 'TTS_EdgeTTS', 'EdgeTTS男声-云健', 'zh-CN-YunjianNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0005', 'TTS_EdgeTTS', 'EdgeTTS男声-云希', 'zh-CN-YunxiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0006', 'TTS_EdgeTTS', 'EdgeTTS男声-云夏', 'zh-CN-YunxiaNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0007', 'TTS_EdgeTTS', 'EdgeTTS女声-辽宁小贝', 'zh-CN-liaoning-XiaobeiNeural', '辽宁', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0008', 'TTS_EdgeTTS', 'EdgeTTS女声-陕西小妮', 'zh-CN-shaanxi-XiaoniNeural', '陕西', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0009', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海佳', 'zh-HK-HiuGaaiNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0010', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海曼', 'zh-HK-HiuMaanNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0011', 'TTS_EdgeTTS', 'EdgeTTS男声-香港万龙', 'zh-HK-WanLungNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL); + +-- 增加是否允许用户注册参数 +delete from `sys_params` where id in (103,104); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (103, 'server.allow_user_register', 'false', 'boolean', 1, '是否运行管理员以外的人注册'); +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (104, 'server.fronted_url', 'http://xiaozhi.server.com', 'string', 1, '下发六位验证码时显示的控制面板地址'); + +-- 修正CosyVoiceSiliconflow音色 +delete from `ai_tts_voice` where tts_model_id = 'TTS_CosyVoiceSiliconflow'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow', 'CosyVoice男声', 'FunAudioLLM/CosyVoice2-0.5B:alex', '中文', 'https://example.com/cosyvoice/alex.mp3', NULL, 6, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0002', 'TTS_CosyVoiceSiliconflow', 'CosyVoice女声', 'FunAudioLLM/CosyVoice2-0.5B:bella', '中文', 'https://example.com/cosyvoice/bella.mp3', NULL, 6, NULL, NULL, NULL, NULL); diff --git a/main/manager-api/src/main/resources/db/changelog/202504181536.sql b/main/manager-api/src/main/resources/db/changelog/202504181536.sql new file mode 100644 index 000000000..327aa605f --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504181536.sql @@ -0,0 +1,7 @@ +-- 调整意图识别配置 +delete from `ai_model_config` where id = 'Intent_function_call'; +INSERT INTO `ai_model_config` VALUES ('Intent_function_call', 'Intent', 'function_call', '函数调用意图识别', 0, 1, '{\"type\": \"function_call\", \"functions\": \"change_role;get_weather;get_news;play_music\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL); + +-- 增加单台设备每天最多聊天句数 +delete from `sys_params` where id = 105; +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (105, 'device_max_output_size', '0', 'number', 1, '单台设备每天最多输出字数,0表示不限制'); \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/202504221135.sql b/main/manager-api/src/main/resources/db/changelog/202504221135.sql new file mode 100644 index 000000000..79c80446b --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504221135.sql @@ -0,0 +1,88 @@ +-- 删除无用模型供应器 +delete from `ai_model_provider` where id = 'SYSTEM_LLM_doubao'; +delete from `ai_model_provider` where id = 'SYSTEM_LLM_chatglm'; +delete from `ai_model_provider` where id = 'SYSTEM_TTS_302ai'; +delete from `ai_model_provider` where id = 'SYSTEM_TTS_gizwits'; + +-- 添加模型供应器 +delete from `ai_model_provider` where id = 'SYSTEM_ASR_TencentASR'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_ASR_TencentASR', 'ASR', 'tencent', '腾讯语音识别', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 4, 1, NOW(), 1, NOW()); + +-- 添加腾讯语音合成模型供应器 +delete from `ai_model_provider` where id = 'SYSTEM_TTS_TencentTTS'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_TTS_TencentTTS', 'TTS', 'tencent', '腾讯语音合成', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"region","label":"区域","type":"string"},{"key":"voice","label":"音色ID","type":"string"}]', 5, 1, NOW(), 1, NOW()); + + +-- 添加edge音色 +delete from `ai_tts_voice` where id in ('TTS_EdgeTTS0001', 'TTS_EdgeTTS0002', 'TTS_EdgeTTS0003', 'TTS_EdgeTTS0004', 'TTS_EdgeTTS0005', 'TTS_EdgeTTS0006', 'TTS_EdgeTTS0007', 'TTS_EdgeTTS0008', 'TTS_EdgeTTS0009', 'TTS_EdgeTTS0010', 'TTS_EdgeTTS0011'); +INSERT INTO `ai_tts_voice` VALUES +('TTS_EdgeTTS0001', 'TTS_EdgeTTS', 'EdgeTTS女声-晓晓', 'zh-CN-XiaoxiaoNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0002', 'TTS_EdgeTTS', 'EdgeTTS男声-云扬', 'zh-CN-YunyangNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0003', 'TTS_EdgeTTS', 'EdgeTTS女声-晓伊', 'zh-CN-XiaoyiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0004', 'TTS_EdgeTTS', 'EdgeTTS男声-云健', 'zh-CN-YunjianNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0005', 'TTS_EdgeTTS', 'EdgeTTS男声-云希', 'zh-CN-YunxiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0006', 'TTS_EdgeTTS', 'EdgeTTS男声-云夏', 'zh-CN-YunxiaNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0007', 'TTS_EdgeTTS', 'EdgeTTS女声-辽宁小贝', 'zh-CN-liaoning-XiaobeiNeural', '辽宁', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0008', 'TTS_EdgeTTS', 'EdgeTTS女声-陕西小妮', 'zh-CN-shaanxi-XiaoniNeural', '陕西', NULL, NULL, 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0009', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海佳', 'zh-HK-HiuGaaiNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0010', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海曼', 'zh-HK-HiuMaanNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL), +('TTS_EdgeTTS0011', 'TTS_EdgeTTS', 'EdgeTTS男声-香港万龙', 'zh-HK-WanLungNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL); + +-- DoubaoTTS音色 +delete from `ai_tts_voice` where id in ('TTS_DoubaoTTS0001', 'TTS_DoubaoTTS0002', 'TTS_DoubaoTTS0003', 'TTS_DoubaoTTS0004', 'TTS_DoubaoTTS0005'); +INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0001', 'TTS_DoubaoTTS', '通用女声', 'BV001_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV001.mp3', NULL, 3, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0002', 'TTS_DoubaoTTS', '通用男声', 'BV002_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV002.mp3', NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0003', 'TTS_DoubaoTTS', '阳光男生', 'BV056_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV056.mp3', NULL, 4, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0004', 'TTS_DoubaoTTS', '奶气萌娃', 'BV051_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV051.mp3', NULL, 5, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0005', 'TTS_DoubaoTTS', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '普通话', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 6, NULL, NULL, NULL, NULL); + +-- 修正CosyVoiceSiliconflow音色 +delete from `ai_tts_voice` where id in ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow0002'); +INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow', 'CosyVoice男声', 'FunAudioLLM/CosyVoice2-0.5B:alex', '中文', NULL, NULL, 6, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0002', 'TTS_CosyVoiceSiliconflow', 'CosyVoice女声', 'FunAudioLLM/CosyVoice2-0.5B:bella', '中文', NULL, NULL, 6, NULL, NULL, NULL, NULL); + +-- CozeCnTTS音色 +delete from `ai_tts_voice` where id = 'TTS_CozeCnTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_CozeCnTTS0001', 'TTS_CozeCnTTS', 'CozeCn音色', '7426720361733046281', '中文', NULL, NULL, 7, NULL, NULL, NULL, NULL); + +-- MinimaxTTS音色 +delete from `ai_tts_voice` where id = 'TTS_MinimaxTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_MinimaxTTS0001', 'TTS_MinimaxTTS', 'Minimax少女音', 'female-shaonv', '中文', NULL, NULL, 8, NULL, NULL, NULL, NULL); + +-- AliyunTTS音色 +delete from `ai_tts_voice` where id = 'TTS_AliyunTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_AliyunTTS0001', 'TTS_AliyunTTS', '阿里云小云', 'xiaoyun', '中文', NULL, NULL, 9, NULL, NULL, NULL, NULL); + +-- TTS302AI音色 +delete from `ai_tts_voice` where id = 'TTS_TTS302AI0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_TTS302AI0001', 'TTS_TTS302AI', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 10, NULL, NULL, NULL, NULL); + +-- GizwitsTTS音色 +delete from `ai_tts_voice` where id = 'TTS_GizwitsTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_GizwitsTTS0001', 'TTS_GizwitsTTS', '机智云湾湾', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 11, NULL, NULL, NULL, NULL); + +-- ACGNTTS音色 +delete from `ai_tts_voice` where id = 'TTS_ACGNTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_ACGNTTS0001', 'TTS_ACGNTTS', 'ACG音色', '1695', '中文', NULL, NULL, 12, NULL, NULL, NULL, NULL); + +-- OpenAITTS音色 +delete from `ai_tts_voice` where id = 'TTS_OpenAITTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_OpenAITTS0001', 'TTS_OpenAITTS', 'OpenAI男声', 'onyx', '中文', NULL, NULL, 13, NULL, NULL, NULL, NULL); + +-- 添加腾讯语音合成音色 +delete from `ai_tts_voice` where id = 'TTS_TencentTTS0001'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_TencentTTS0001', 'TTS_TencentTTS', '智瑜', '101001', '中文', NULL, NULL, 1, NULL, NULL, NULL, NULL); + +-- 其他音色 +delete from `ai_tts_voice` where id = 'TTS_FishSpeech0000'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_FishSpeech0000', 'TTS_FishSpeech', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL); + +delete from `ai_tts_voice` where id = 'TTS_GPT_SOVITS_V20000'; +INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V20000', 'TTS_GPT_SOVITS_V2', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL); + +delete from `ai_tts_voice` where id in ('TTS_GPT_SOVITS_V30000', 'TTS_CustomTTS0000'); +INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V30000', 'TTS_GPT_SOVITS_V3', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_CustomTTS0000', 'TTS_CustomTTS', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL); + diff --git a/main/manager-api/src/main/resources/db/changelog/202504221555.sql b/main/manager-api/src/main/resources/db/changelog/202504221555.sql new file mode 100644 index 000000000..e80a8a8d6 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504221555.sql @@ -0,0 +1,49 @@ +-- 添加火山引擎边缘大模型网关(LLM + TTS) +INSERT INTO `ai_model_config` VALUES ('LLM_VolcesAiGatewayLLM', 'LLM', 'VolcesAiGatewayTTS', '火山引擎边缘大模型网关', 0, 1, '{\"type\": \"openai\", \"base_url\": \"https://ai-gateway.vei.volces.com/v1\", \"model_name\": \"doubao-pro-32k-functioncall\", \"api_key\": \"你的网关访问密钥\"}', NULL, NULL, 14, NULL, NULL, NULL, NULL); +INSERT INTO `ai_model_config` VALUES ('TTS_VolcesAiGatewayTTS', 'TTS', 'VolcesAiGatewayTTS', '火山引擎边缘大模型网关', 0, 1, '{\"type\": \"openai\", \"api_key\": \"你的网关访问密钥\", \"api_url\": \"https://ai-gateway.vei.volces.com/v1/audio/speech\", \"model\": \"doubao-tts\", \"voice\": \"zh_male_shaonianzixin_moon_bigtts\", \"speed\": 1, \"output_dir\": \"tmp/\"}', NULL, NULL, 15, NULL, NULL, NULL, NULL); +-- 添加火山引擎边缘大模型网关语音合成音色 +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0001', 'TTS_VolcesAiGatewayTTS', '灿灿/Shiny', 'zh_female_cancan_mars_bigtts', '中文、美式英语', NULL, NULL, 1, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0002', 'TTS_VolcesAiGatewayTTS', '清新女声', 'zh_female_qingxinnvsheng_mars_bigtts', '中文', NULL, NULL, 2, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0003', 'TTS_VolcesAiGatewayTTS', '爽快思思/Skye', 'zh_female_shuangkuaisisi_moon_bigtts', '中文、美式英语', NULL, NULL, 3, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0004', 'TTS_VolcesAiGatewayTTS', '温暖阿虎/Alvin', 'zh_male_wennuanahu_moon_bigtts', '中文、美式英语', NULL, NULL, 4, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0005', 'TTS_VolcesAiGatewayTTS', '少年梓辛/Brayan', 'zh_male_shaonianzixin_moon_bigtts', '中文、美式英语', NULL, NULL, 5, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0006', 'TTS_VolcesAiGatewayTTS', '知性女声', 'zh_female_zhixingnvsheng_mars_bigtts', '中文', NULL, NULL, 6, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0007', 'TTS_VolcesAiGatewayTTS', '清爽男大', 'zh_male_qingshuangnanda_mars_bigtts', '中文', NULL, NULL, 7, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0008', 'TTS_VolcesAiGatewayTTS', '邻家女孩', 'zh_female_linjianvhai_moon_bigtts', '中文', NULL, NULL, 8, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0009', 'TTS_VolcesAiGatewayTTS', '渊博小叔', 'zh_male_yuanboxiaoshu_moon_bigtts', '中文', NULL, NULL, 9, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0010', 'TTS_VolcesAiGatewayTTS', '阳光青年', 'zh_male_yangguangqingnian_moon_bigtts', '中文', NULL, NULL, 10, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0011', 'TTS_VolcesAiGatewayTTS', '甜美小源', 'zh_female_tianmeixiaoyuan_moon_bigtts', '中文', NULL, NULL, 11, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0012', 'TTS_VolcesAiGatewayTTS', '清澈梓梓', 'zh_female_qingchezizi_moon_bigtts', '中文', NULL, NULL, 12, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0013', 'TTS_VolcesAiGatewayTTS', '解说小明', 'zh_male_jieshuoxiaoming_moon_bigtts', '中文', NULL, NULL, 13, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0014', 'TTS_VolcesAiGatewayTTS', '开朗姐姐', 'zh_female_kailangjiejie_moon_bigtts', '中文', NULL, NULL, 14, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0015', 'TTS_VolcesAiGatewayTTS', '邻家男孩', 'zh_male_linjiananhai_moon_bigtts', '中文', NULL, NULL, 15, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0016', 'TTS_VolcesAiGatewayTTS', '甜美悦悦', 'zh_female_tianmeiyueyue_moon_bigtts', '中文', NULL, NULL, 16, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0017', 'TTS_VolcesAiGatewayTTS', '心灵鸡汤', 'zh_female_xinlingjitang_moon_bigtts', '中文', NULL, NULL, 17, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0018', 'TTS_VolcesAiGatewayTTS', '知性温婉', 'ICL_zh_female_zhixingwenwan_tob', '中文', NULL, NULL, 18, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0019', 'TTS_VolcesAiGatewayTTS', '暖心体贴', 'ICL_zh_male_nuanxintitie_tob', '中文', NULL, NULL, 19, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0020', 'TTS_VolcesAiGatewayTTS', '温柔文雅', 'ICL_zh_female_wenrouwenya_tob', '中文', NULL, NULL, 20, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0021', 'TTS_VolcesAiGatewayTTS', '开朗轻快', 'ICL_zh_male_kailangqingkuai_tob', '中文', NULL, NULL, 21, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0022', 'TTS_VolcesAiGatewayTTS', '活泼爽朗', 'ICL_zh_male_huoposhuanglang_tob', '中文', NULL, NULL, 22, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0023', 'TTS_VolcesAiGatewayTTS', '率真小伙', 'ICL_zh_male_shuaizhenxiaohuo_tob', '中文', NULL, NULL, 23, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0024', 'TTS_VolcesAiGatewayTTS', '温柔小哥', 'zh_male_wenrouxiaoge_mars_bigtts', '中文', NULL, NULL, 24, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0025', 'TTS_VolcesAiGatewayTTS', 'Smith', 'en_male_smith_mars_bigtts', '英式英语', NULL, NULL, 25, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0026', 'TTS_VolcesAiGatewayTTS', 'Anna', 'en_female_anna_mars_bigtts', '英式英语', NULL, NULL, 26, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0027', 'TTS_VolcesAiGatewayTTS', 'Adam', 'en_male_adam_mars_bigtts', '美式英语', NULL, NULL, 27, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0028', 'TTS_VolcesAiGatewayTTS', 'Sarah', 'en_female_sarah_mars_bigtts', '澳洲英语', NULL, NULL, 28, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0029', 'TTS_VolcesAiGatewayTTS', 'Dryw', 'en_male_dryw_mars_bigtts', '澳洲英语', NULL, NULL, 29, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0030', 'TTS_VolcesAiGatewayTTS', 'かずね(和音)', 'multi_male_jingqiangkanye_moon_bigtts', '日语、西语', NULL, NULL, 30, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0031', 'TTS_VolcesAiGatewayTTS', 'はるこ(晴子)', 'multi_female_shuangkuaisisi_moon_bigtts', '日语、西语', NULL, NULL, 31, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0032', 'TTS_VolcesAiGatewayTTS', 'ひろし(広志)', 'multi_male_wanqudashu_moon_bigtts', '日语、西语', NULL, NULL, 32, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0033', 'TTS_VolcesAiGatewayTTS', 'あけみ(朱美)', 'multi_female_gaolengyujie_moon_bigtts', '日语', NULL, NULL, 33, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0034', 'TTS_VolcesAiGatewayTTS', 'Amanda', 'en_female_amanda_mars_bigtts', '美式英语', NULL, NULL, 34, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0035', 'TTS_VolcesAiGatewayTTS', 'Jackson', 'en_male_jackson_mars_bigtts', '美式英语', NULL, NULL, 35, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0036', 'TTS_VolcesAiGatewayTTS', '京腔侃爷/Harmony', 'zh_male_jingqiangkanye_moon_bigtts', '中文-北京口音、英文', NULL, NULL, 36, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0037', 'TTS_VolcesAiGatewayTTS', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '中文-台湾口音', NULL, NULL, 37, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0038', 'TTS_VolcesAiGatewayTTS', '湾区大叔', 'zh_female_wanqudashu_moon_bigtts', '中文-广东口音', NULL, NULL, 38, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0039', 'TTS_VolcesAiGatewayTTS', '呆萌川妹', 'zh_female_daimengchuanmei_moon_bigtts', '中文-四川口音', NULL, NULL, 39, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0040', 'TTS_VolcesAiGatewayTTS', '广州德哥', 'zh_male_guozhoudege_moon_bigtts', '中文-广东口音', NULL, NULL, 40, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0041', 'TTS_VolcesAiGatewayTTS', '北京小爷', 'zh_male_beijingxiaoye_moon_bigtts', '中文-北京口音', NULL, NULL, 41, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0042', 'TTS_VolcesAiGatewayTTS', '浩宇小哥', 'zh_male_haoyuxiaoge_moon_bigtts', '中文-青岛口音', NULL, NULL, 42, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0043', 'TTS_VolcesAiGatewayTTS', '广西远舟', 'zh_male_guangxiyuanzhou_moon_bigtts', '中文-广西口音', NULL, NULL, 43, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0044', 'TTS_VolcesAiGatewayTTS', '妹坨洁儿', 'zh_female_meituojieer_moon_bigtts', '中文-长沙口音', NULL, NULL, 44, NULL, NULL, NULL, NULL); +INSERT INTO `ai_tts_voice` VALUES ('TTS_VolcesAiGatewayTTS_0045', 'TTS_VolcesAiGatewayTTS', '豫州子轩', 'zh_male_yuzhouzixuan_moon_bigtts', '中文-河南口音', NULL, NULL, 45, NULL, NULL, NULL, NULL); \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/202504251422.sql b/main/manager-api/src/main/resources/db/changelog/202504251422.sql new file mode 100644 index 000000000..88e03fea3 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504251422.sql @@ -0,0 +1,30 @@ +-- 增加server.ota,用于配置ota地址 + +delete from `sys_params` where id = 100; +delete from `sys_params` where id = 101; + +delete from `sys_params` where id = 106; +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (106, 'server.websocket', 'null', 'string', 1, 'websocket地址,多个用;分隔'); + +delete from `sys_params` where id = 107; +INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (107, 'server.ota', 'null', 'string', 1, 'ota地址'); + + +-- 增加固件信息表 +CREATE TABLE IF NOT EXISTS `ai_ota` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `firmware_name` varchar(100) DEFAULT NULL COMMENT '固件名称', + `type` varchar(50) DEFAULT NULL COMMENT '固件类型', + `version` varchar(50) DEFAULT NULL COMMENT '版本号', + `size` bigint DEFAULT NULL COMMENT '文件大小(字节)', + `remark` varchar(500) DEFAULT NULL COMMENT '备注/说明', + `firmware_path` varchar(255) DEFAULT NULL COMMENT '固件路径', + `sort` int unsigned DEFAULT '0' COMMENT '排序', + `updater` bigint DEFAULT NULL COMMENT '更新者', + `update_date` datetime DEFAULT NULL COMMENT '更新时间', + `creator` bigint DEFAULT NULL COMMENT '创建者', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='固件信息表'; + +update ai_device set auto_update = 1; diff --git a/main/manager-api/src/main/resources/db/changelog/202504291043.sql b/main/manager-api/src/main/resources/db/changelog/202504291043.sql new file mode 100644 index 000000000..555b8cf4f --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504291043.sql @@ -0,0 +1,504 @@ +-- 增加FunASR服务语音识别模型供应器和配置 +DELETE FROM `ai_model_provider` WHERE `id` = 'SYSTEM_ASR_FunASRServer'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_ASR_FunASRServer', 'ASR', 'fun_server', 'FunASR服务语音识别', '[{"key":"host","label":"服务地址","type":"string"},{"key":"port","label":"端口号","type":"number"}]', 4, 1, NOW(), 1, NOW()); + +DELETE FROM `ai_model_config` WHERE `id` = 'ASR_FunASRServer'; +INSERT INTO `ai_model_config` VALUES ('ASR_FunASRServer', 'ASR', 'FunASRServer', 'FunASR服务语音识别', 0, 1, '{\"type\": \"fun_server\", \"host\": \"127.0.0.1\", \"port\": 10096}', NULL, NULL, 5, NULL, NULL, NULL, NULL); + +-- 修改ai_model_config表的remark字段类型为TEXT +ALTER TABLE `ai_model_config` MODIFY COLUMN `remark` TEXT COMMENT '备注'; + +-- 更新ASR模型配置的说明文档 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/modelscope/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md', +`remark` = '独立部署FunASR,使用FunASR的API服务,只需要五句话 +第一句:mkdir -p ./funasr-runtime-resources/models +第二句:sudo docker run -d -p 10096:10095 --privileged=true -v $PWD/funasr-runtime-resources/models:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.12 +上一句话执行后会进入到容器,继续第三句:cd FunASR/runtime +不要退出容器,继续在容器中执行第四句:nohup bash run_server_2pass.sh --download-model-dir /workspace/models --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx --model-dir damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst --itn-dir thuduj12/fst_itn_zh --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & +上一句话执行后会进入到容器,继续第五句:tail -f log.txt +第五句话执行完后,会看到模型下载日志,下载完后就可以连接使用了 +以上是使用CPU推理,如果有GPU,详细参考:https://github.com/modelscope/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md' WHERE `id` = 'ASR_FunASRServer'; + +-- 更新FunASR本地模型配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/modelscope/FunASR', +`remark` = 'FunASR本地模型配置说明: +1. 需要下载模型文件到xiaozhi-server/models/SenseVoiceSmall目录 +2. 支持中日韩粤语音识别 +3. 本地推理,无需网络连接 +4. 待识别文件保存在tmp/目录' WHERE `id` = 'ASR_FunASR'; + +-- 更新SherpaASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/k2-fsa/sherpa-onnx', +`remark` = 'SherpaASR配置说明: +1. 运行时自动下载模型文件到models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17目录 +2. 支持中文、英文、日语、韩语、粤语等多种语言 +3. 本地推理,无需网络连接 +4. 输出文件保存在tmp/目录' WHERE `id` = 'ASR_SherpaASR'; + +-- 更新豆包ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/speech/app', +`remark` = '豆包ASR配置说明: +1. 需要在火山引擎控制台创建应用并获取appid和access_token +2. 支持中文语音识别 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://console.volcengine.com/speech/app +2. 创建新应用 +3. 获取appid和access_token +4. 填入配置文件中' WHERE `id` = 'ASR_DoubaoASR'; + +-- 更新腾讯ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.cloud.tencent.com/cam/capi', +`remark` = '腾讯ASR配置说明: +1. 需要在腾讯云控制台创建应用并获取appid、secret_id和secret_key +2. 支持中文语音识别 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://console.cloud.tencent.com/cam/capi 获取密钥 +2. 访问 https://console.cloud.tencent.com/asr/resourcebundle 领取免费资源 +3. 获取appid、secret_id和secret_key +4. 填入配置文件中' WHERE `id` = 'ASR_TencentASR'; + +-- 更新TTS模型配置说明 +-- EdgeTTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/rany2/edge-tts', +`remark` = 'EdgeTTS配置说明: +1. 使用微软Edge TTS服务 +2. 支持多种语言和音色 +3. 免费使用,无需注册 +4. 需要网络连接 +5. 输出文件保存在tmp/目录' WHERE `id` = 'TTS_EdgeTTS'; + +-- 豆包TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/speech/service/8', +`remark` = '豆包TTS配置说明: +1. 访问 https://console.volcengine.com/speech/service/8 +2. 需要在火山引擎控制台创建应用并获取appid和access_token +3. 山引擎语音一定要购买花钱,起步价30元,就有100并发了。如果用免费的只有2个并发,会经常报tts错误 +4. 购买服务后,购买免费的音色后,可能要等半小时左右,才能使用。 +5. 填入配置文件中' WHERE `id` = 'TTS_DoubaoTTS'; + +-- 硅基流动TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://cloud.siliconflow.cn/account/ak', +`remark` = '硅基流动TTS配置说明: +1. 访问 https://cloud.siliconflow.cn/account/ak +2. 注册并获取API密钥 +3. 填入配置文件中' WHERE `id` = 'TTS_CosyVoiceSiliconflow'; + +-- Coze中文TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://www.coze.cn/open/oauth/pats', +`remark` = 'Coze中文TTS配置说明: +1. 访问 https://www.coze.cn/open/oauth/pats +2. 获取个人令牌 +3. 填入配置文件中' WHERE `id` = 'TTS_CozeCnTTS'; + +-- FishSpeech配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/fishaudio/fish-speech', +`remark` = 'FishSpeech配置说明: +1. 需要本地部署FishSpeech服务 +2. 支持自定义音色 +3. 本地推理,无需网络连接 +4. 输出文件保存在tmp/目录 +5. 运行服务示例命令:python -m tools.api_server --listen 0.0.0.0:8080 --llama-checkpoint-path "checkpoints/fish-speech-1.5" --decoder-checkpoint-path "checkpoints/fish-speech-1.5/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" --decoder-config-name firefly_gan_vq --compile' WHERE `id` = 'TTS_FishSpeech'; + +-- GPT-SoVITS V2配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/RVC-Boss/GPT-SoVITS', +`remark` = 'GPT-SoVITS V2配置说明: +1. 需要本地部署GPT-SoVITS服务 +2. 支持自定义音色克隆 +3. 本地推理,无需网络连接 +4. 输出文件保存在tmp/目录 +部署步骤: +1. 运行服务示例命令:python api_v2.py -a 127.0.0.1 -p 9880 -c GPT_SoVITS/configs/demo.yaml' WHERE `id` = 'TTS_GPT_SOVITS_V2'; + +-- GPT-SoVITS V3配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/RVC-Boss/GPT-SoVITS', +`remark` = 'GPT-SoVITS V3配置说明: +1. 需要本地部署GPT-SoVITS V3服务 +2. 支持自定义音色克隆 +3. 本地推理,无需网络连接 +4. 输出文件保存在tmp/目录' WHERE `id` = 'TTS_GPT_SOVITS_V3'; + +-- MiniMax TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://platform.minimaxi.com/', +`remark` = 'MiniMax TTS配置说明: +1. 需要在MiniMax平台创建账户并充值 +2. 支持多种音色,当前配置使用female-shaonv +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://platform.minimaxi.com/ 注册账号 +2. 访问 https://platform.minimaxi.com/user-center/payment/balance 充值 +3. 访问 https://platform.minimaxi.com/user-center/basic-information 获取group_id +4. 访问 https://platform.minimaxi.com/user-center/basic-information/interface-key 获取api_key +5. 填入配置文件中' WHERE `id` = 'TTS_MinimaxTTS'; + +-- 阿里云TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://nls-portal.console.aliyun.com/', +`remark` = '阿里云TTS配置说明: +1. 需要在阿里云平台开通智能语音交互服务 +2. 支持多种音色,当前配置使用xiaoyun +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://nls-portal.console.aliyun.com/ 开通服务 +2. 访问 https://nls-portal.console.aliyun.com/applist 获取appkey +3. 访问 https://nls-portal.console.aliyun.com/overview 获取token +4. 填入配置文件中 +注意:token是临时的24小时有效,长期使用需要配置access_key_id和access_key_secret' WHERE `id` = 'TTS_AliyunTTS'; + +-- 腾讯TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.cloud.tencent.com/cam/capi', +`remark` = '腾讯TTS配置说明: +1. 需要在腾讯云平台开通智能语音交互服务 +2. 支持多种音色,当前配置使用101001 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://console.cloud.tencent.com/cam/capi 获取密钥 +2. 访问 https://console.cloud.tencent.com/tts/resourcebundle 领取免费资源 +3. 创建新应用 +4. 获取appid、secret_id和secret_key +5. 填入配置文件中' WHERE `id` = 'TTS_TencentTTS'; + +-- 302AI TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://dash.302.ai/', +`remark` = '302AI TTS配置说明: +1. 需要在302平台创建账户并获取API密钥 +2. 支持多种音色,当前配置使用湾湾小何音色 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://dash.302.ai/ 注册账号 +2. 访问 https://dash.302.ai/apis/list 获取API密钥 +3. 填入配置文件中 +价格:$35/百万字符' WHERE `id` = 'TTS_TTS302AI'; + +-- 机智云TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://agentrouter.gizwitsapi.com/panel/token', +`remark` = '机智云TTS配置说明: +1. 需要在机智云平台获取API密钥 +2. 支持多种音色,当前配置使用湾湾小何音色 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://agentrouter.gizwitsapi.com/panel/token 获取API密钥 +2. 填入配置文件中 +注意:前一万名注册的用户,将送5元体验金额' WHERE `id` = 'TTS_GizwitsTTS'; + +-- ACGN TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://acgn.ttson.cn/', +`remark` = 'ACGN TTS配置说明: +1. 需要在ttson平台购买token +2. 支持多种角色音色,当前配置使用角色ID:1695 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://acgn.ttson.cn/ 查看角色列表 +2. 访问 www.ttson.cn 购买token +3. 填入配置文件中 +开发相关疑问请提交至网站上的qq' WHERE `id` = 'TTS_ACGNTTS'; + +-- OpenAI TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://platform.openai.com/api-keys', +`remark` = 'OpenAI TTS配置说明: +1. 需要在OpenAI平台获取API密钥 +2. 支持多种音色,当前配置使用onyx +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://platform.openai.com/api-keys 获取API密钥 +2. 填入配置文件中 +注意:国内需要使用代理访问' WHERE `id` = 'TTS_OpenAITTS'; + +-- 自定义TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = '自定义TTS配置说明: +1. 支持自定义TTS接口服务 +2. 使用GET方式请求 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +配置说明: +1. 在params中配置请求参数 +2. 在headers中配置请求头 +3. 设置返回音频格式' WHERE `id` = 'TTS_CustomTTS'; + +-- 火山引擎边缘大模型网关TTS配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/vei/aigateway/', +`remark` = '火山引擎边缘大模型网关TTS配置说明: +1. 访问 https://console.volcengine.com/vei/aigateway/ +2. 创建网关访问密钥,搜索并勾选 Doubao-语音合成 +3. 如果需要使用LLM,一并勾选 Doubao-pro-32k-functioncall +4. 访问 https://console.volcengine.com/vei/aigateway/tokens-list 获取密钥 +5. 填入配置文件中 +音色列表参考:https://www.volcengine.com/docs/6561/1257544' WHERE `id` = 'TTS_VolcesAiGatewayTTS'; + +-- 更新LLM模型配置说明 +-- ChatGLM配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys', +`remark` = 'ChatGLM配置说明: +1. 访问 https://bigmodel.cn/usercenter/proj-mgmt/apikeys +2. 注册并获取API密钥 +3. 填入配置文件中' WHERE `id` = 'LLM_ChatGLMLLM'; + +-- Ollama配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://ollama.com/', +`remark` = 'Ollama配置说明: +1. 安装Ollama服务 +2. 运行命令:ollama pull qwen2.5 +3. 确保服务运行在http://localhost:11434' WHERE `id` = 'LLM_OllamaLLM'; + +-- 通义千问配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://bailian.console.aliyun.com/?apiKey=1#/api-key', +`remark` = '通义千问配置说明: +1. 访问 https://bailian.console.aliyun.com/?apiKey=1#/api-key +2. 获取API密钥 +3. 填入配置文件中,当前配置使用qwen-turbo模型 +4. 支持自定义参数:temperature=0.7, max_tokens=500, top_p=1, top_k=50' WHERE `id` = 'LLM_AliLLM'; + +-- 通义百炼配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://bailian.console.aliyun.com/?apiKey=1#/api-key', +`remark` = '通义百炼配置说明: +1. 访问 https://bailian.console.aliyun.com/?apiKey=1#/api-key +2. 获取app_id和api_key +3. 填入配置文件中' WHERE `id` = 'LLM_AliAppLLM'; + +-- 豆包大模型配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement', +`remark` = '豆包大模型配置说明: +1. 访问 https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement +2. 开通Doubao-1.5-pro服务 +3. 访问 https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey 获取API密钥 +4. 填入配置文件中 +5. 当前建议使用doubao-1-5-pro-32k-250115 +注意:有免费额度500000token' WHERE `id` = 'LLM_DoubaoLLM'; + +-- DeepSeek配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://platform.deepseek.com/', +`remark` = 'DeepSeek配置说明: +1. 访问 https://platform.deepseek.com/ +2. 注册并获取API密钥 +3. 填入配置文件中' WHERE `id` = 'LLM_DeepSeekLLM'; + +-- Dify配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://cloud.dify.ai/', +`remark` = 'Dify配置说明: +1. 访问 https://cloud.dify.ai/ +2. 注册并获取API密钥 +3. 填入配置文件中 +4. 支持多种对话模式:workflows/run, chat-messages, completion-messages +5. 平台设置的角色定义会失效,需要在Dify控制台设置 +注意:建议使用本地部署的Dify接口,国内部分区域访问公有云接口可能受限' WHERE `id` = 'LLM_DifyLLM'; + +-- Gemini配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://aistudio.google.com/apikey', +`remark` = 'Gemini配置说明: +1. 使用谷歌Gemini API服务 +2. 当前配置使用gemini-2.0-flash模型 +3. 需要网络连接 +4. 支持配置代理 +申请步骤: +1. 访问 https://aistudio.google.com/apikey +2. 创建API密钥 +3. 填入配置文件中 +注意:若在中国境内使用,请遵守《生成式人工智能服务管理暂行办法》' WHERE `id` = 'LLM_GeminiLLM'; + +-- Coze配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://www.coze.cn/open/oauth/pats', +`remark` = 'Coze配置说明: +1. 使用Coze平台服务 +2. 需要bot_id、user_id和个人令牌 +3. 需要网络连接 +申请步骤: +1. 访问 https://www.coze.cn/open/oauth/pats +2. 获取个人令牌 +3. 手动计算bot_id和user_id +4. 填入配置文件中' WHERE `id` = 'LLM_CozeLLM'; + +-- LM Studio配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://lmstudio.ai/', +`remark` = 'LM Studio配置说明: +1. 使用本地部署的LM Studio服务 +2. 当前配置使用deepseek-r1-distill-llama-8b@q4_k_m模型 +3. 本地推理,无需网络连接 +4. 需要预先下载模型 +部署步骤: +1. 安装LM Studio +2. 从社区下载模型 +3. 确保服务运行在http://localhost:1234/v1' WHERE `id` = 'LLM_LMStudioLLM'; + +-- FastGPT配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://cloud.tryfastgpt.ai/account/apikey', +`remark` = 'FastGPT配置说明: +1. 使用FastGPT平台服务 +2. 需要网络连接 +3. 配置文件中的prompt无效,需要在FastGPT控制台设置 +4. 支持自定义变量 +申请步骤: +1. 访问 https://cloud.tryfastgpt.ai/account/apikey +2. 获取API密钥 +3. 填入配置文件中' WHERE `id` = 'LLM_FastgptLLM'; + +-- Xinference配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/xorbitsai/inference', +`remark` = 'Xinference配置说明: +1. 使用本地部署的Xinference服务 +2. 当前配置使用qwen2.5:72b-AWQ模型 +3. 本地推理,无需网络连接 +4. 需要预先启动对应模型 +部署步骤: +1. 安装Xinference +2. 启动服务并加载模型 +3. 确保服务运行在http://localhost:9997' WHERE `id` = 'LLM_XinferenceLLM'; + +-- Xinference小模型配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/xorbitsai/inference', +`remark` = 'Xinference小模型配置说明: +1. 使用本地部署的Xinference服务 +2. 当前配置使用qwen2.5:3b-AWQ模型 +3. 本地推理,无需网络连接 +4. 用于意图识别 +部署步骤: +1. 安装Xinference +2. 启动服务并加载模型 +3. 确保服务运行在http://localhost:9997' WHERE `id` = 'LLM_XinferenceSmallLLM'; + +-- 火山引擎边缘大模型网关LLM配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/vei/aigateway/', +`remark` = '火山引擎边缘大模型网关LLM配置说明: +1. 使用火山引擎边缘大模型网关服务 +2. 需要网关访问密钥 +3. 需要网络连接 +4. 支持function_call功能 +申请步骤: +1. 访问 https://console.volcengine.com/vei/aigateway/ +2. 创建网关访问密钥,搜索并勾选 Doubao-pro-32k-functioncall +3. 如果需要使用语音合成,一并勾选 Doubao-语音合成 +4. 访问 https://console.volcengine.com/vei/aigateway/tokens-list 获取密钥 +5. 填入配置文件中' WHERE `id` = 'LLM_VolcesAiGatewayLLM'; + +-- 更新Memory模型配置说明 +-- 无记忆配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = '无记忆配置说明: +1. 不保存对话历史 +2. 每次对话都是独立的 +3. 无需额外配置 +4. 适合对隐私要求高的场景' WHERE `id` = 'Memory_nomem'; + +-- 本地短期记忆配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = '本地短期记忆配置说明: +1. 使用本地存储保存对话历史 +2. 通过selected_module的llm总结对话内容 +3. 数据保存在本地,不会上传到服务器 +4. 适合注重隐私的场景 +5. 无需额外配置' WHERE `id` = 'Memory_mem_local_short'; + +-- Mem0AI记忆配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://app.mem0.ai/dashboard/api-keys', +`remark` = 'Mem0AI记忆配置说明: +1. 使用Mem0AI服务保存对话历史 +2. 需要API密钥 +3. 需要网络连接 +4. 每月有1000次免费调用 +申请步骤: +1. 访问 https://app.mem0.ai/dashboard/api-keys +2. 获取API密钥 +3. 填入配置文件中' WHERE `id` = 'Memory_mem0ai'; + +-- 更新Intent模型配置说明 +-- 无意图识别配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = '无意图识别配置说明: +1. 不进行意图识别 +2. 所有对话直接传递给LLM处理 +3. 无需额外配置 +4. 适合简单对话场景' WHERE `id` = 'Intent_nointent'; + +-- LLM意图识别配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = 'LLM意图识别配置说明: +1. 使用独立的LLM进行意图识别 +2. 默认使用selected_module.LLM的模型 +3. 可以配置使用独立的LLM(如免费的ChatGLMLLM) +4. 通用性强,但会增加处理时间 +5. 不支持控制音量大小等iot操作 +配置说明: +1. 在llm字段中指定使用的LLM模型 +2. 如果不指定,则使用selected_module.LLM的模型' WHERE `id` = 'Intent_intent_llm'; + +-- 函数调用意图识别配置说明 +UPDATE `ai_model_config` SET +`doc_link` = NULL, +`remark` = '函数调用意图识别配置说明: +1. 使用LLM的function_call功能进行意图识别 +2. 需要所选择的LLM支持function_call +3. 按需调用工具,处理速度快 +4. 支持所有iot指令 +5. 默认已加载以下功能: + - handle_exit_intent(退出识别) + - play_music(音乐播放) + - change_role(角色切换) + - get_weather(天气查询) + - get_news(新闻查询) +配置说明: +1. 在functions字段中配置需要加载的功能模块 +2. 系统默认已加载基础功能,无需重复配置 +3. 可以添加自定义功能模块' WHERE `id` = 'Intent_function_call'; + +-- 更新VAD模型配置说明 +-- SileroVAD配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://github.com/snakers4/silero-vad', +`remark` = 'SileroVAD配置说明: +1. 使用SileroVAD模型进行语音活动检测 +2. 本地推理,无需网络连接 +3. 需要下载模型文件到models/snakers4_silero-vad目录 +4. 可配置参数: + - threshold: 0.5(语音检测阈值) + - min_silence_duration_ms: 700(最小静音持续时间,单位毫秒) +5. 如果说话停顿比较长,可以适当增加min_silence_duration_ms的值' WHERE `id` = 'VAD_SileroVAD'; diff --git a/main/manager-api/src/main/resources/db/changelog/202504301341.sql b/main/manager-api/src/main/resources/db/changelog/202504301341.sql new file mode 100644 index 000000000..a88ee783e --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202504301341.sql @@ -0,0 +1,85 @@ +update `ai_model_provider` set `fields` = +'[{"key": "api_url","label": "API地址","type": "string"},{"key": "voice","label": "音色","type": "string"},{"key": "output_dir","label": "输出目录","type": "string"},{"key": "authorization","label": "授权","type": "string"},{"key": "appid","label": "应用ID","type": "string"},{"key": "access_token","label": "访问令牌","type": "string"},{"key": "cluster","label": "集群","type": "string"},{"key": "speed_ratio","label": "语速","type": "number"},{"key": "volume_ratio","label": "音量","type": "number"},{"key": "pitch_ratio","label": "音高","type": "number"}]' +where `id` = 'SYSTEM_TTS_doubao'; + +-- 添加阿里云ASR供应器 +delete from `ai_model_provider` where `id` = 'SYSTEM_ASR_AliyunASR'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_ASR_AliyunASR', 'ASR', 'aliyun', '阿里云语音识别', '[{"key":"appkey","label":"应用AppKey","type":"string"},{"key":"token","label":"临时Token","type":"string"},{"key":"access_key_id","label":"AccessKey ID","type":"string"},{"key":"access_key_secret","label":"AccessKey Secret","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 5, 1, NOW(), 1, NOW()); + +-- 添加阿里云ASR模型配置 +delete from `ai_model_config` where `id` = 'ASR_AliyunASR'; +INSERT INTO `ai_model_config` VALUES ('ASR_AliyunASR', 'ASR', 'AliyunASR', '阿里云语音识别', 0, 1, '{\"type\": \"aliyun\", \"appkey\": \"\", \"token\": \"\", \"access_key_id\": \"\", \"access_key_secret\": \"\", \"output_dir\": \"tmp/\"}', NULL, NULL, 6, NULL, NULL, NULL, NULL); + +-- 更新阿里云ASR模型配置的说明文档 +UPDATE `ai_model_config` SET +`doc_link` = 'https://nls-portal.console.aliyun.com/', +`remark` = '阿里云ASR配置说明: +1. 访问 https://nls-portal.console.aliyun.com/ 开通服务 +2. 访问 https://nls-portal.console.aliyun.com/applist 获取appkey +3. 访问 https://nls-portal.console.aliyun.com/overview 获取token +4. 获取access_key_id和access_key_secret +5. 填入配置文件中' WHERE `id` = 'ASR_AliyunASR'; + +-- 插入固件类型字典类型 +delete from `sys_dict_type` where `id` = 101; +INSERT INTO `sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +(101, 'FIRMWARE_TYPE', '固件类型', '固件类型字典', 0, 1, NOW(), 1, NOW()); + +-- 插入固件类型字典数据 +delete from `sys_dict_data` where `dict_type_id` = 101; +INSERT INTO `sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +(101001, 101, '面包板新版接线(WiFi)', 'bread-compact-wifi', '面包板新版接线(WiFi)', 1, 1, NOW(), 1, NOW()), +(101002, 101, '面包板新版接线(WiFi)+ LCD', 'bread-compact-wifi-lcd', '面包板新版接线(WiFi)+ LCD', 2, 1, NOW(), 1, NOW()), +(101003, 101, '面包板新版接线(ML307 AT)', 'bread-compact-ml307', '面包板新版接线(ML307 AT)', 3, 1, NOW(), 1, NOW()), +(101004, 101, '面包板(WiFi) ESP32 DevKit', 'bread-compact-esp32', '面包板(WiFi) ESP32 DevKit', 4, 1, NOW(), 1, NOW()), +(101005, 101, '面包板(WiFi+ LCD) ESP32 DevKit', 'bread-compact-esp32-lcd', '面包板(WiFi+ LCD) ESP32 DevKit', 5, 1, NOW(), 1, NOW()), +(101006, 101, 'DFRobot 行空板 k10', 'df-k10', 'DFRobot 行空板 k10', 6, 1, NOW(), 1, NOW()), +(101007, 101, 'ESP32 CGC', 'esp32-cgc', 'ESP32 CGC', 7, 1, NOW(), 1, NOW()), +(101008, 101, 'ESP BOX 3', 'esp-box-3', 'ESP BOX 3', 8, 1, NOW(), 1, NOW()), +(101009, 101, 'ESP BOX', 'esp-box', 'ESP BOX', 9, 1, NOW(), 1, NOW()), +(101010, 101, 'ESP BOX Lite', 'esp-box-lite', 'ESP BOX Lite', 10, 1, NOW(), 1, NOW()), +(101011, 101, 'Kevin Box 1', 'kevin-box-1', 'Kevin Box 1', 11, 1, NOW(), 1, NOW()), +(101012, 101, 'Kevin Box 2', 'kevin-box-2', 'Kevin Box 2', 12, 1, NOW(), 1, NOW()), +(101013, 101, 'Kevin C3', 'kevin-c3', 'Kevin C3', 13, 1, NOW(), 1, NOW()), +(101014, 101, 'Kevin SP V3开发板', 'kevin-sp-v3-dev', 'Kevin SP V3开发板', 14, 1, NOW(), 1, NOW()), +(101015, 101, 'Kevin SP V4开发板', 'kevin-sp-v4-dev', 'Kevin SP V4开发板', 15, 1, NOW(), 1, NOW()), +(101016, 101, '鱼鹰科技3.13LCD开发板', 'kevin-yuying-313lcd', '鱼鹰科技3.13LCD开发板', 16, 1, NOW(), 1, NOW()), +(101017, 101, '立创·实战派ESP32-S3开发板', 'lichuang-dev', '立创·实战派ESP32-S3开发板', 17, 1, NOW(), 1, NOW()), +(101018, 101, '立创·实战派ESP32-C3开发板', 'lichuang-c3-dev', '立创·实战派ESP32-C3开发板', 18, 1, NOW(), 1, NOW()), +(101019, 101, '神奇按钮 Magiclick_2.4', 'magiclick-2p4', '神奇按钮 Magiclick_2.4', 19, 1, NOW(), 1, NOW()), +(101020, 101, '神奇按钮 Magiclick_2.5', 'magiclick-2p5', '神奇按钮 Magiclick_2.5', 20, 1, NOW(), 1, NOW()), +(101021, 101, '神奇按钮 Magiclick_C3', 'magiclick-c3', '神奇按钮 Magiclick_C3', 21, 1, NOW(), 1, NOW()), +(101022, 101, '神奇按钮 Magiclick_C3_v2', 'magiclick-c3-v2', '神奇按钮 Magiclick_C3_v2', 22, 1, NOW(), 1, NOW()), +(101023, 101, 'M5Stack CoreS3', 'm5stack-core-s3', 'M5Stack CoreS3', 23, 1, NOW(), 1, NOW()), +(101024, 101, 'AtomS3 + Echo Base', 'atoms3-echo-base', 'AtomS3 + Echo Base', 24, 1, NOW(), 1, NOW()), +(101025, 101, 'AtomS3R + Echo Base', 'atoms3r-echo-base', 'AtomS3R + Echo Base', 25, 1, NOW(), 1, NOW()), +(101026, 101, 'AtomS3R CAM/M12 + Echo Base', 'atoms3r-cam-m12-echo-base', 'AtomS3R CAM/M12 + Echo Base', 26, 1, NOW(), 1, NOW()), +(101027, 101, 'AtomMatrix + Echo Base', 'atommatrix-echo-base', 'AtomMatrix + Echo Base', 27, 1, NOW(), 1, NOW()), +(101028, 101, '虾哥 Mini C3', 'xmini-c3', '虾哥 Mini C3', 28, 1, NOW(), 1, NOW()), +(101029, 101, 'ESP32S3_KORVO2_V3开发板', 'esp32s3-korvo2-v3', 'ESP32S3_KORVO2_V3开发板', 29, 1, NOW(), 1, NOW()), +(101030, 101, 'ESP-SparkBot开发板', 'esp-sparkbot', 'ESP-SparkBot开发板', 30, 1, NOW(), 1, NOW()), +(101031, 101, 'ESP-Spot-S3', 'esp-spot-s3', 'ESP-Spot-S3', 31, 1, NOW(), 1, NOW()), +(101032, 101, 'Waveshare ESP32-S3-Touch-AMOLED-1.8', 'esp32-s3-touch-amoled-1.8', 'Waveshare ESP32-S3-Touch-AMOLED-1.8', 32, 1, NOW(), 1, NOW()), +(101033, 101, 'Waveshare ESP32-S3-Touch-LCD-1.85C', 'esp32-s3-touch-lcd-1.85c', 'Waveshare ESP32-S3-Touch-LCD-1.85C', 33, 1, NOW(), 1, NOW()), +(101034, 101, 'Waveshare ESP32-S3-Touch-LCD-1.85', 'esp32-s3-touch-lcd-1.85', 'Waveshare ESP32-S3-Touch-LCD-1.85', 34, 1, NOW(), 1, NOW()), +(101035, 101, 'Waveshare ESP32-S3-Touch-LCD-1.46', 'esp32-s3-touch-lcd-1.46', 'Waveshare ESP32-S3-Touch-LCD-1.46', 35, 1, NOW(), 1, NOW()), +(101036, 101, 'Waveshare ESP32-S3-Touch-LCD-3.5', 'esp32-s3-touch-lcd-3.5', 'Waveshare ESP32-S3-Touch-LCD-3.5', 36, 1, NOW(), 1, NOW()), +(101037, 101, '土豆子', 'tudouzi', '土豆子', 37, 1, NOW(), 1, NOW()), +(101038, 101, 'LILYGO T-Circle-S3', 'lilygo-t-circle-s3', 'LILYGO T-Circle-S3', 38, 1, NOW(), 1, NOW()), +(101039, 101, 'LILYGO T-CameraPlus-S3', 'lilygo-t-cameraplus-s3', 'LILYGO T-CameraPlus-S3', 39, 1, NOW(), 1, NOW()), +(101040, 101, 'Movecall Moji 小智AI衍生版', 'movecall-moji-esp32s3', 'Movecall Moji 小智AI衍生版', 40, 1, NOW(), 1, NOW()), +(101041, 101, 'Movecall CuiCan 璀璨·AI吊坠', 'movecall-cuican-esp32s3', 'Movecall CuiCan 璀璨·AI吊坠', 41, 1, NOW(), 1, NOW()), +(101042, 101, '正点原子DNESP32S3开发板', 'atk-dnesp32s3', '正点原子DNESP32S3开发板', 42, 1, NOW(), 1, NOW()), +(101043, 101, '正点原子DNESP32S3-BOX', 'atk-dnesp32s3-box', '正点原子DNESP32S3-BOX', 43, 1, NOW(), 1, NOW()), +(101044, 101, '嘟嘟开发板CHATX(wifi)', 'du-chatx', '嘟嘟开发板CHATX(wifi)', 44, 1, NOW(), 1, NOW()), +(101045, 101, '太极小派esp32s3', 'taiji-pi-s3', '太极小派esp32s3', 45, 1, NOW(), 1, NOW()), +(101046, 101, '无名科技星智0.85(WIFI)', 'xingzhi-cube-0.85tft-wifi', '无名科技星智0.85(WIFI)', 46, 1, NOW(), 1, NOW()), +(101047, 101, '无名科技星智0.85(ML307)', 'xingzhi-cube-0.85tft-ml307', '无名科技星智0.85(ML307)', 47, 1, NOW(), 1, NOW()), +(101048, 101, '无名科技星智0.96(WIFI)', 'xingzhi-cube-0.96oled-wifi', '无名科技星智0.96(WIFI)', 48, 1, NOW(), 1, NOW()), +(101049, 101, '无名科技星智0.96(ML307)', 'xingzhi-cube-0.96oled-ml307', '无名科技星智0.96(ML307)', 49, 1, NOW(), 1, NOW()), +(101050, 101, '无名科技星智1.54(WIFI)', 'xingzhi-cube-1.54tft-wifi', '无名科技星智1.54(WIFI)', 50, 1, NOW(), 1, NOW()), +(101051, 101, '无名科技星智1.54(ML307)', 'xingzhi-cube-1.54tft-ml307', '无名科技星智1.54(ML307)', 51, 1, NOW(), 1, NOW()), +(101052, 101, 'SenseCAP Watcher', 'sensecap-watcher', 'SenseCAP Watcher', 52, 1, NOW(), 1, NOW()), +(101053, 101, '四博智联AI陪伴盒子', 'doit-s3-aibox', '四博智联AI陪伴盒子', 53, 1, NOW(), 1, NOW()), +(101054, 101, '元控·青春', 'mixgo-nova', '元控·青春', 54, 1, NOW(), 1, NOW()); diff --git a/main/manager-api/src/main/resources/db/changelog/202505022134.sql b/main/manager-api/src/main/resources/db/changelog/202505022134.sql new file mode 100644 index 000000000..ccbaaaee1 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202505022134.sql @@ -0,0 +1,27 @@ +-- 初始化智能体聊天记录 +DROP TABLE IF EXISTS ai_chat_history; +DROP TABLE IF EXISTS ai_chat_message; +DROP TABLE IF EXISTS ai_agent_chat_history; +CREATE TABLE ai_agent_chat_history +( + id BIGINT AUTO_INCREMENT COMMENT '主键ID' PRIMARY KEY, + mac_address VARCHAR(50) COMMENT 'MAC地址', + agent_id VARCHAR(32) COMMENT '智能体id', + session_id VARCHAR(50) COMMENT '会话ID', + chat_type TINYINT(3) COMMENT '消息类型: 1-用户, 2-智能体', + content VARCHAR(1024) COMMENT '聊天内容', + audio_id VARCHAR(32) COMMENT '音频ID', + created_at DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL COMMENT '创建时间', + updated_at DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间', + INDEX idx_ai_agent_chat_history_mac (mac_address), + INDEX idx_ai_agent_chat_history_session_id (session_id), + INDEX idx_ai_agent_chat_history_agent_id (agent_id), + INDEX idx_ai_agent_chat_history_agent_session_created (agent_id, session_id, created_at) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT '智能体聊天记录表'; + +DROP TABLE IF EXISTS ai_agent_chat_audio; +CREATE TABLE ai_agent_chat_audio +( + id VARCHAR(32) COMMENT '主键ID' PRIMARY KEY, + audio LONGBLOB COMMENT '音频opus数据' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT '智能体聊天音频数据表'; \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/202505081146.sql b/main/manager-api/src/main/resources/db/changelog/202505081146.sql new file mode 100644 index 000000000..fe7582f39 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202505081146.sql @@ -0,0 +1,43 @@ +-- 添加百度ASR模型配置 +delete from `ai_model_config` where `id` = 'ASR_BaiduASR'; +INSERT INTO `ai_model_config` VALUES ('ASR_BaiduASR', 'ASR', 'BaiduASR', '百度语音识别', 0, 1, '{\"type\": \"baidu\", \"app_id\": \"\", \"api_key\": \"\", \"secret_key\": \"\", \"dev_pid\": 1537, \"output_dir\": \"tmp/\"}', NULL, NULL, 7, NULL, NULL, NULL, NULL); + + +-- 添加百度ASR供应器 +delete from `ai_model_provider` where `id` = 'SYSTEM_ASR_BaiduASR'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_ASR_BaiduASR', 'ASR', 'baidu', '百度语音识别', '[{"key":"app_id","label":"应用AppID","type":"string"},{"key":"api_key","label":"API Key","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"dev_pid","label":"语言参数","type":"number"},{"key":"output_dir","label":"输出目录","type":"string"}]', 7, 1, NOW(), 1, NOW()); + + +-- 更新百度ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.bce.baidu.com/ai-engine/old/#/ai/speech/app/list', +`remark` = '百度ASR配置说明: +1. 访问 https://console.bce.baidu.com/ai-engine/old/#/ai/speech/app/list +2. 创建新应用 +3. 获取AppID、API Key和Secret Key +4. 填入配置文件中 +查看资源额度:https://console.bce.baidu.com/ai-engine/old/#/ai/speech/overview/resource/list +语言参数说明:https://ai.baidu.com/ai-doc/SPEECH/0lbxfnc9b +' WHERE `id` = 'ASR_BaiduASR'; + +-- 更新豆包供应器字段 +update `ai_model_provider` set `fields` = +'[{"key":"appid","label":"应用ID","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"cluster","label":"集群","type":"string"},{"key":"boosting_table_name","label":"热词文件名称","type":"string"},{"key":"correct_table_name","label":"替换词文件名称","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]' +where `id` = 'SYSTEM_ASR_DoubaoASR'; + +-- 更新豆包ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/speech/app', +`remark` = '豆包ASR配置说明: +1. 需要在火山引擎控制台创建应用并获取appid和access_token +2. 支持中文语音识别 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://console.volcengine.com/speech/app +2. 创建新应用 +3. 获取appid和access_token +4. 填入配置文件中 +如需设置热词,请参考:https://www.volcengine.com/docs/6561/155738 +' WHERE `id` = 'ASR_DoubaoASR'; \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index 89ed7ff52..2936aed78 100755 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -1,5 +1,5 @@ # 规范约定: -# id生成根据时间时分,文件名对应id +# id生成根据时间时分,文件名对应id,常变数据可以根据模块命名自定义 # 每次对数据表进行改动时,只允许新建新对changeSet,不允许对上一个changeSet配置及文件进行修改 databaseChangeLog: - changeSet: @@ -15,4 +15,95 @@ databaseChangeLog: changes: - sqlFile: encoding: utf8 - path: classpath:db/changelog/202503141346.sql \ No newline at end of file + path: classpath:db/changelog/202503141346.sql + - changeSet: + id: 202504082211 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504082211.sql + - changeSet: + id: 202504092335 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504092335.sql + - changeSet: + id: 202504112044 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504112044.sql + - changeSet: + id: 202504112058 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504112058.sql + - changeSet: + id: 202504151206 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504151206.sql + - changeSet: + id: 202504181536 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504181536.sql + - changeSet: + id: 202504221135 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504221135.sql + - changeSet: + id: 202504221555 + author: John + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504221555.sql + - changeSet: + id: 202504251422 + author: jiangkunyin + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504251422.sql + - changeSet: + id: 202504291043 + author: jiangkunyin + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504291043.sql + - changeSet: + id: 202504301341 + author: Goody + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202504301341.sql + - changeSet: + id: 202505022134 + author: Goody + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202505022134.sql + - changeSet: + id: 202505081146 + author: hrz + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202505081146.sql \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/messages.properties b/main/manager-api/src/main/resources/i18n/messages.properties index 91e6a2850..5126feb2b 100644 --- a/main/manager-api/src/main/resources/i18n/messages.properties +++ b/main/manager-api/src/main/resources/i18n/messages.properties @@ -34,3 +34,13 @@ 10031=\u5F31\u5BC6\u7801 10032=\u5220\u9664\u672C\u6570\u636E\u5F02\u5E38 10033=\u8BBE\u5907\u9A8C\u8BC1\u7801\u9519\u8BEF +10034=\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A +10035=\u53C2\u6570\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A +10036=\u4E0D\u652F\u6301\u7684\u53C2\u6570\u7C7B\u578B +10037=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684\u6570\u5B57 +10038=\u53C2\u6570\u503C\u5FC5\u987B\u662Ftrue\u6216false +10039=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684JSON\u6570\u7EC4\u683C\u5F0F +10040=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684JSON\u683C\u5F0F + +10041=\u8BBE\u5907\u672A\u627E\u5230 +10042={0} diff --git a/main/manager-api/src/main/resources/i18n/messages_en_US.properties b/main/manager-api/src/main/resources/i18n/messages_en_US.properties index 515de18a0..43781857e 100644 --- a/main/manager-api/src/main/resources/i18n/messages_en_US.properties +++ b/main/manager-api/src/main/resources/i18n/messages_en_US.properties @@ -32,4 +32,15 @@ 10030=The password is less than {0} digits. 10031=The password must consist of numbers, uppercase and lowercase letters, and special characters at the same time 10032=Exception in deleting this data -10033=Device verification code error \ No newline at end of file +10033=Device verification code error + +10034=Parameter value cannot be empty +10035=Parameter type cannot be empty +10036=Unsupported parameter type +10037=Parameter value must be a valid number +10038=Parameter value must be true or false +10039=Parameter value must be a valid JSON array format +10040=Parameter value must be a valid JSON format + +10041=Device not found +10042={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/messages_zh_CN.properties b/main/manager-api/src/main/resources/i18n/messages_zh_CN.properties index 23b9abfa8..713ab96a2 100644 --- a/main/manager-api/src/main/resources/i18n/messages_zh_CN.properties +++ b/main/manager-api/src/main/resources/i18n/messages_zh_CN.properties @@ -32,4 +32,15 @@ 10030=\u5BC6\u7801\u957F\u5EA6\u4E0D\u8DB3{0}\u4F4D 10031=\u5BC6\u7801\u5FC5\u987B\u540C\u65F6\u5305\u542B\u6570\u5B57\u3001\u5927\u5C0F\u5B57\u6BCD\u548C\u7279\u6B8A\u5B57\u7B26\u7EC4\u6210 10032=\u5220\u9664\u672C\u6570\u636E\u5F02\u5E38 -10033=\u8BBE\u5907\u9A8C\u8BC1\u7801\u9519\u8BEF \ No newline at end of file +10033=\u8BBE\u5907\u9A8C\u8BC1\u7801\u9519\u8BEF + +10034=\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A +10035=\u53C2\u6570\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A +10036=\u4E0D\u652F\u6301\u7684\u53C2\u6570\u7C7B\u578B +10037=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684\u6570\u5B57 +10038=\u53C2\u6570\u503C\u5FC5\u987B\u662Ftrue\u6216false +10039=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684JSON\u6570\u7EC4\u683C\u5F0F +10040=\u53C2\u6570\u503C\u5FC5\u987B\u662F\u6709\u6548\u7684JSON\u683C\u5F0F + +10041=\u8BBE\u5907\u672A\u627E\u5230 +10042={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/messages_zh_TW.properties b/main/manager-api/src/main/resources/i18n/messages_zh_TW.properties index 2a6bd8d0d..b5847ec49 100644 --- a/main/manager-api/src/main/resources/i18n/messages_zh_TW.properties +++ b/main/manager-api/src/main/resources/i18n/messages_zh_TW.properties @@ -32,4 +32,15 @@ 10030=\u5BC6\u78BC\u9577\u5EA6\u4E0D\u8DB3{0}\u4F4D 10031=\u5BC6\u78BC\u5FC5\u9808\u540C\u6642\u5305\u542B\u6578\u5B57\u3001\u5927\u5C0F\u5B57\u6BCD\u548C\u7279\u6B8A\u5B57\u7B26\u7D44\u6210 10032=\u522A\u9664\u6B64\u6578\u64DA\u7570\u5E38 -10033=\u8A2D\u5099\u9A57\u8B49\u78BC\u932F\u8AA4 \ No newline at end of file +10033=\u8A2D\u5099\u9A57\u8B49\u78BC\u932F\u8AA4 + +10034=\u53C3\u6578\u503C\u4E0D\u80FD\u70BA\u7A7A +10035=\u53C3\u6578\u985E\u578B\u4E0D\u80FD\u70BA\u7A7A +10036=\u4E0D\u652F\u63F4\u7684\u53C3\u6578\u985E\u578B +10037=\u53C3\u6578\u503C\u5FC5\u9808\u662F\u6709\u6548\u7684\u6578\u5B57 +10038=\u53C3\u6578\u503C\u5FC5\u9808\u662Ftrue\u6216false +10039=\u53C3\u6578\u503C\u5FC5\u9808\u662F\u6709\u6548\u7684JSON\u6578\u7D44\u683C\u5F0F +10040=\u53C3\u6578\u503C\u5FC5\u9808\u662F\u6709\u6548\u7684JSON\u683C\u5F0F + +10041=\u8A2D\u5099\u672A\u627E\u5230 +10042={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/validation.properties b/main/manager-api/src/main/resources/i18n/validation.properties index e7452e476..3a10bf235 100644 --- a/main/manager-api/src/main/resources/i18n/validation.properties +++ b/main/manager-api/src/main/resources/i18n/validation.properties @@ -3,6 +3,8 @@ id.require=ID\u4E0D\u80FD\u4E3A\u7A7A id.null=ID\u5FC5\u987B\u4E3A\u7A7A sort.number=\u6392\u5E8F\u503C\u4E0D\u80FD\u5C0F\u4E8E0 +page.number=\u9875\u6570\u4E0D\u80FD\u5C0F\u4E8E0 +limit.number=\u5217\u6570\u4E0D\u80FD\u5C0F\u4E8E0 sysdict.type.require=\u5B57\u5178\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A sysdict.name.require=\u5B57\u5178\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A @@ -10,6 +12,8 @@ sysdict.label.require=\u5B57\u5178\u6807\u7B7E\u4E0D\u80FD\u4E3A\u7A7A sysparams.paramcode.require=\u53C2\u6570\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A sysparams.paramvalue.require=\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A +sysparams.valuetype.require=\u503C\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A +sysparams.valuetype.pattern=\u503C\u7C7B\u578B\u5FC5\u987B\u662F string\u3001number\u3001boolean \u6216 array sysuser.username.require=\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A sysuser.password.require=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A @@ -24,8 +28,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A -timbre.remark.require=\u97F3\u8272\u7684\u5907\u6CE8\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A -timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653EDemo\u4E0D\u53EF\u4EE5\u4E3A\u7A7A +ota.device.not.found=\u8BBE\u5907\u672A\u627E\u5230 +ota.device.need.bind={0} diff --git a/main/manager-api/src/main/resources/i18n/validation_en_US.properties b/main/manager-api/src/main/resources/i18n/validation_en_US.properties index 37bebf18e..342cada39 100644 --- a/main/manager-api/src/main/resources/i18n/validation_en_US.properties +++ b/main/manager-api/src/main/resources/i18n/validation_en_US.properties @@ -3,6 +3,8 @@ id.require=ID can not be empty id.null=ID has to be empty sort.number=The sort value cannot be less than 0 +page.number=The page value cannot be less than 0 +limit.number=The limit value cannot be less than 0 sysdict.type.require=The dictionary type cannot be empty sysdict.name.require=The dictionary name cannot be empty @@ -10,6 +12,8 @@ sysdict.label.require=Dictionary tag cannot be empty sysparams.paramcode.require=Parameter encoding cannot be empty sysparams.paramvalue.require=Parameter values cannot be empty +sysparams.valuetype.require=Value type cannot be empty +sysparams.valuetype.pattern=Value type must be string, number, boolean or array sysuser.username.require=The username cannot be empty sysuser.password.require=The password cannot be empty @@ -23,8 +27,8 @@ sysuser.uuid.require=The unique identifier cannot be empty timbre.languages.require=The language of the timbre cannot be empty timbre.name.require=The name of the timbre cannot be empty -timbre.remark.require=The remark of the timbre cannot be empty timbre.ttsModelId.require=The TTS model ID of the timbre cannot be empty timbre.ttsVoice.require=The TTS voice of the timbre cannot be empty -timbre.voiceDemo.require=The voice demo of the timbre cannot be empty +ota.device.not.found=Device not found +ota.device.need.bind={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/validation_zh_CN.properties b/main/manager-api/src/main/resources/i18n/validation_zh_CN.properties index 41bf1e696..eaa50eb77 100644 --- a/main/manager-api/src/main/resources/i18n/validation_zh_CN.properties +++ b/main/manager-api/src/main/resources/i18n/validation_zh_CN.properties @@ -3,6 +3,8 @@ id.require=ID\u4E0D\u80FD\u4E3A\u7A7A id.null=ID\u5FC5\u987B\u4E3A\u7A7A sort.number=\u6392\u5E8F\u503C\u4E0D\u80FD\u5C0F\u4E8E0 +page.number=\u9801\u6578\u4E0D\u80FD\u5C0F\u4E8E0 +limit.number=\u5217\u6578\u4E0D\u80FD\u5C0F\u4E8E0 sysdict.type.require=\u5B57\u5178\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A sysdict.name.require=\u5B57\u5178\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A @@ -10,6 +12,8 @@ sysdict.label.require=\u5B57\u5178\u6807\u7B7E\u4E0D\u80FD\u4E3A\u7A7A sysparams.paramcode.require=\u53C2\u6570\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A sysparams.paramvalue.require=\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A +sysparams.valuetype.require=\u503C\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A +sysparams.valuetype.pattern=\u503C\u7C7B\u578B\u5FC5\u987B\u662F string\u3001number\u3001boolean \u6216 array sysuser.username.require=\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A sysuser.password.require=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A @@ -23,8 +27,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A timbre.languages.require=\u97F3\u8272\u7684\u8A9E\u8A00\u4E0D\u53EF\u4EE5\u70BA\u7A7A timbre.name.require=\u97F3\u8272\u7684\u540D\u7A31\u4E0D\u53EF\u4EE5\u70BA\u7A7A -timbre.remark.require=\u97F3\u8272\u7684\u5099\u6CE8\u4E0D\u53EF\u4EE5\u70BA\u7A7A timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u9375\u4E0D\u53EF\u4EE5\u70BA\u7A7A timbre.ttsVoice.require=\u97F3\u8272\u7684\u7DE8\u78BC\u4E0D\u53EF\u4EE5\u70BA\u7A7A -timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653E\u5730\u5740\u4E0D\u53EF\u4EE5\u70BA\u7A7A +ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230 +ota.device.need.bind={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/i18n/validation_zh_TW.properties b/main/manager-api/src/main/resources/i18n/validation_zh_TW.properties index 9241c97af..4e3a271ae 100644 --- a/main/manager-api/src/main/resources/i18n/validation_zh_TW.properties +++ b/main/manager-api/src/main/resources/i18n/validation_zh_TW.properties @@ -3,13 +3,17 @@ id.require=ID\u4E0D\u80FD\u4E3A\u7A7A id.null=ID\u5FC5\u987B\u4E3A\u7A7A sort.number=\u6392\u5E8F\u503C\u4E0D\u80FD\u5C0F\u4E8E0 +page.number=\u9875\u6570\u4E0D\u80FD\u5C0F\u4E8E0 +limit.number=\u5217\u6570\u4E0D\u80FD\u5C0F\u4E8E0 sysdict.type.require=\u5B57\u5178\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A sysdict.name.require=\u5B57\u5178\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A sysdict.label.require=\u5B57\u5178\u6807\u7B7E\u4E0D\u80FD\u4E3A\u7A7A -sysparams.paramcode.require=\u53C2\u6570\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A -sysparams.paramvalue.require=\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A +sysparams.paramcode.require=\u53C3\u6578\u7DE8\u78BC\u4E0D\u80FD\u70BA\u7A7A +sysparams.paramvalue.require=\u53C3\u6578\u503C\u4E0D\u80FD\u70BA\u7A7A +sysparams.valuetype.require=\u503C\u985E\u578B\u4E0D\u80FD\u70BA\u7A7A +sysparams.valuetype.pattern=\u503C\u985E\u578B\u5FC5\u9808\u662F string\u3001number\u3001boolean \u6216 array sysuser.username.require=\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A sysuser.password.require=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A @@ -23,7 +27,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A -timbre.remark.require=\u97F3\u8272\u7684\u5907\u6CE8\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A -timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653EDemo\u4E0D\u53EF\u4EE5\u4E3A\u7A7A + +ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230 +ota.device.need.bind={0} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/logback-spring.xml b/main/manager-api/src/main/resources/logback-spring.xml index 68ea4cf60..c69d03c03 100644 --- a/main/manager-api/src/main/resources/logback-spring.xml +++ b/main/manager-api/src/main/resources/logback-spring.xml @@ -1,35 +1,139 @@ - - - - - + + + + + + + + + + + + ${LOG_HOME} + true + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}) - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/xiaozhi-esp32-api.log + + ${LOG_HOME}/xiaozhi-esp32-api.%d{yyyy-MM-dd}.%i.log + 10MB + 30 + 2GB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/error.log + + ERROR + + + ${LOG_HOME}/error.%d{yyyy-MM-dd}.%i.log + 10MB + 30 + 1GB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + - - + + + + + + + + - - + + + + + + + + + + + + + + - + + + ${LOG_HOME}/xiaozhi-esp32-api.log - - /system/logs/admin.%d{yyyy-MM-dd}.%i.log - - 1MB - - 7 + ${LOG_HOME}/xiaozhi-esp32-api.%d{yyyy-MM-dd}.%i.log + 10MB + 30 + 2GB - - + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 - - - + + + + ${LOG_HOME}/error.log + + ERROR + + + ${LOG_HOME}/error.%d{yyyy-MM-dd}.%i.log + 10MB + 30 + 1GB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + + + + + + + + + - - \ No newline at end of file + + + + true + + diff --git a/main/manager-api/src/main/resources/mapper/agent/AgentDao.xml b/main/manager-api/src/main/resources/mapper/agent/AgentDao.xml new file mode 100644 index 000000000..322ca1723 --- /dev/null +++ b/main/manager-api/src/main/resources/mapper/agent/AgentDao.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/main/manager-api/src/main/resources/mapper/agent/AgentTemplateMapper.xml b/main/manager-api/src/main/resources/mapper/agent/AgentTemplateMapper.xml new file mode 100644 index 000000000..bc372f8a4 --- /dev/null +++ b/main/manager-api/src/main/resources/mapper/agent/AgentTemplateMapper.xml @@ -0,0 +1,6 @@ + + + + diff --git a/main/manager-api/src/main/resources/mapper/agent/AiAgentChatHistoryDao.xml b/main/manager-api/src/main/resources/mapper/agent/AiAgentChatHistoryDao.xml new file mode 100644 index 000000000..24a669c18 --- /dev/null +++ b/main/manager-api/src/main/resources/mapper/agent/AiAgentChatHistoryDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + id, mac_address, agent_id, session_id, sort, chat_type, content, audio, audio_url, + created_at, updated_at + + + + DELETE FROM ai_agent_chat_audio + WHERE id IN ( + SELECT audio_id + FROM ai_agent_chat_history + WHERE agent_id = #{agentId} + ); + + + + DELETE FROM ai_agent_chat_history + WHERE agent_id = #{agentId}; + + diff --git a/main/manager-api/src/main/resources/mapper/device/DeviceDao.xml b/main/manager-api/src/main/resources/mapper/device/DeviceDao.xml new file mode 100644 index 000000000..54de47c92 --- /dev/null +++ b/main/manager-api/src/main/resources/mapper/device/DeviceDao.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/main/manager-api/src/main/resources/mapper/model/ModelConfigDao.xml b/main/manager-api/src/main/resources/mapper/model/ModelConfigDao.xml index 3f01ea5b7..4f35f8d1d 100644 --- a/main/manager-api/src/main/resources/mapper/model/ModelConfigDao.xml +++ b/main/manager-api/src/main/resources/mapper/model/ModelConfigDao.xml @@ -2,6 +2,22 @@ + + + + + + + + + + + + + + + + - select dict_type_id, dict_label, dict_value from sys_dict_data order by dict_type_id, sort + - + SELECT dict_type + FROM sys_dict_type + WHERE id = #{dictTypeId} \ No newline at end of file diff --git a/main/manager-api/src/main/resources/mapper/sys/SysDictTypeDao.xml b/main/manager-api/src/main/resources/mapper/sys/SysDictTypeDao.xml index 11887552b..825db02b6 100644 --- a/main/manager-api/src/main/resources/mapper/sys/SysDictTypeDao.xml +++ b/main/manager-api/src/main/resources/mapper/sys/SysDictTypeDao.xml @@ -3,8 +3,4 @@ - - \ No newline at end of file diff --git a/main/manager-api/src/test/java/xiaozhi/modules/device/DeviceTest.java b/main/manager-api/src/test/java/xiaozhi/modules/device/DeviceTest.java new file mode 100644 index 000000000..37f67cab6 --- /dev/null +++ b/main/manager-api/src/test/java/xiaozhi/modules/device/DeviceTest.java @@ -0,0 +1,73 @@ +package xiaozhi.modules.device; + +import java.util.HashMap; +import java.util.UUID; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import lombok.extern.slf4j.Slf4j; +import xiaozhi.common.redis.RedisUtils; +import xiaozhi.modules.sys.dto.SysUserDTO; +import xiaozhi.modules.sys.service.SysUserService; + +@Slf4j +@SpringBootTest +@ActiveProfiles("dev") +@DisplayName("设备测试") +public class DeviceTest { + + @Autowired + private RedisUtils redisUtils; + @Autowired + private SysUserService sysUserService; + + @Test + public void testSaveUser() { + SysUserDTO userDTO = new SysUserDTO(); + userDTO.setUsername("test"); + userDTO.setPassword(UUID.randomUUID().toString()); + sysUserService.save(userDTO); + } + + @Test + @DisplayName("测试写入设备信息") + public void testWriteDeviceInfo() { + log.info("开始测试写入设备信息..."); + // 模拟设备MAC地址 + String macAddress = "00:11:22:33:44:66"; + // 模拟设备验证码 + String deviceCode = "123456"; + + HashMap map = new HashMap<>(); + map.put("mac_address", macAddress); + map.put("activation_code", deviceCode); + map.put("board", "硬件型号"); + map.put("app_version", "0.3.13"); + + String safeDeviceId = macAddress.replace(":", "_").toLowerCase(); + String cacheDeviceKey = String.format("ota:activation:data:%s", safeDeviceId); + redisUtils.set(cacheDeviceKey, map, 300); + + String redisKey = "ota:activation:code:" + deviceCode; + log.info("Redis Key: {}", redisKey); + + // 将设备信息写入Redis + redisUtils.set(redisKey, macAddress, 300); + log.info("设备信息已写入Redis"); + + // 验证是否写入成功 + String savedMacAddress = (String) redisUtils.get(redisKey); + log.info("从Redis读取的MAC地址: {}", savedMacAddress); + + // 使用断言验证 + Assertions.assertNotNull(savedMacAddress, "从Redis读取的MAC地址不应为空"); + Assertions.assertEquals(macAddress, savedMacAddress, "保存的MAC地址与原始MAC地址不匹配"); + + log.info("测试完成"); + } +} \ No newline at end of file diff --git a/main/manager-api/src/test/resources/application.yml b/main/manager-api/src/test/resources/application.yml new file mode 100644 index 000000000..099e81941 --- /dev/null +++ b/main/manager-api/src/test/resources/application.yml @@ -0,0 +1,22 @@ +spring: + data: + redis: + host: localhost + port: 6379 + database: 0 + timeout: 10s + lettuce: + pool: + min-idle: 0 + max-idle: 8 + max-active: 8 + max-wait: -1ms + +renren: + redis: + open: true + +logging: + level: + xiaozhi.modules.device: DEBUG + org.springframework.data.redis: DEBUG \ No newline at end of file diff --git a/main/manager-web/.env b/main/manager-web/.env new file mode 100644 index 000000000..1b5f8138b --- /dev/null +++ b/main/manager-web/.env @@ -0,0 +1 @@ +VUE_APP_TITLE=智控台 \ No newline at end of file diff --git a/main/manager-web/.env.development b/main/manager-web/.env.development new file mode 100644 index 000000000..0a1de3062 --- /dev/null +++ b/main/manager-web/.env.development @@ -0,0 +1 @@ +VUE_APP_API_BASE_URL=/xiaozhi \ No newline at end of file diff --git a/main/manager-web/.env.production b/main/manager-web/.env.production new file mode 100644 index 000000000..351d791a6 --- /dev/null +++ b/main/manager-web/.env.production @@ -0,0 +1,4 @@ +VUE_APP_API_BASE_URL=/xiaozhi +VUE_APP_PUBLIC_PATH=/ +# 是否开启CDN +VUE_APP_USE_CDN=false \ No newline at end of file diff --git a/main/manager-web/.npmrc b/main/manager-web/.npmrc new file mode 100644 index 000000000..5e4086a7f --- /dev/null +++ b/main/manager-web/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmmirror.com/ diff --git a/main/manager-web/README.md b/main/manager-web/README.md index a81c8ff61..d0a34ad10 100644 --- a/main/manager-web/README.md +++ b/main/manager-web/README.md @@ -1,4 +1,4 @@ -本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../../README.md#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F-) +本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3) # xiaozhi @@ -6,8 +6,6 @@ 开发使用代码编辑器,导入项目时,选择`manager-web`文件夹作为项目目录 -参照[manager前后端接口协议](https://app.apifox.com/invite/project?token=H_8qhgfjUeaAL0wybghgU)开发 - ``` npm install ``` diff --git a/main/manager-web/babel.config.js b/main/manager-web/babel.config.js new file mode 100644 index 000000000..b3469a75c --- /dev/null +++ b/main/manager-web/babel.config.js @@ -0,0 +1,12 @@ +module.exports = { + presets: [ + ['@vue/cli-plugin-babel/preset', { + useBuiltIns: 'usage', + corejs: 3 + }] + ], + plugins: [ + '@babel/plugin-syntax-dynamic-import', // 确保支持动态导入 (Lazy Loading) + '@babel/plugin-transform-runtime' + ] +} diff --git a/main/manager-web/jsconfig.json b/main/manager-web/jsconfig.json index 4aafc5f6e..587b2896d 100644 --- a/main/manager-web/jsconfig.json +++ b/main/manager-web/jsconfig.json @@ -16,4 +16,4 @@ "scripthost" ] } -} +} \ No newline at end of file diff --git a/main/manager-web/package-lock.json b/main/manager-web/package-lock.json index 5af654f08..c104b60c2 100644 --- a/main/manager-web/package-lock.json +++ b/main/manager-web/package-lock.json @@ -8,9 +8,13 @@ "name": "xiaozhi", "version": "0.1.0", "dependencies": { + "core-js": "^3.41.0", + "cross-env": "^7.0.3", "element-ui": "^2.15.14", "flyio": "^0.6.14", "normalize.css": "^8.0.1", + "opus-decoder": "^0.7.7", + "opus-recorder": "^8.0.5", "vue": "^2.6.14", "vue-axios": "^3.5.2", "vue-router": "^3.6.5", @@ -18,12 +22,17 @@ "xiaozhi": "file:" }, "devDependencies": { + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.26.10", "@vue/cli-plugin-router": "~5.0.0", "@vue/cli-plugin-vuex": "~5.0.0", "@vue/cli-service": "~5.0.0", + "compression-webpack-plugin": "^11.1.0", "sass": "^1.32.7", "sass-loader": "^12.0.0", - "vue-template-compiler": "^2.6.14" + "vue-template-compiler": "^2.6.14", + "webpack-bundle-analyzer": "^4.10.2", + "workbox-webpack-plugin": "^7.3.0" } }, "node_modules/@achrinza/node-ipc": { @@ -31,7 +40,6 @@ "resolved": "https://registry.npmmirror.com/@achrinza/node-ipc/-/node-ipc-9.2.9.tgz", "integrity": "sha512-7s0VcTwiK/0tNOVdSX9FWMeFdOEcsAOz9HesBldXxFMaGvIak7KC2z9tV9EgsQXn6KUsWsfIkViMNuIo0GoZDQ==", "dev": true, - "license": "MIT", "dependencies": { "@node-ipc/js-queue": "2.0.3", "event-pubsub": "4.3.0", @@ -41,12 +49,24 @@ "node": "8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22" } }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.26.2", "resolved": "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.26.2.tgz", "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, - "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", "js-tokens": "^4.0.0", @@ -61,19 +81,75 @@ "resolved": "https://registry.npmmirror.com/@babel/compat-data/-/compat-data-7.26.8.tgz", "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, - "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.26.10", + "resolved": "https://registry.npmmirror.com/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.25.9" + }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.26.5", - "resolved": "https://registry.npmmirror.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", - "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz", + "integrity": "sha512-LVk7fbXml0H2xH34dFzKQ7TDZ2G4/rVTOrq9V+icbbadjbVxxeFeDsNHv2SrZeWoA+6ZiTyWYWtScEIW07EAcA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.26.5", + "@babel/compat-data": "^7.26.8", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -83,11 +159,175 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.0.tgz", + "integrity": "sha512-vSGCvMecvFCd/BdpGlhpXYNhhC4ccxyvQWpbGL4CWbvfEoLFWUZuSuf7s9Aw70flgQF+6vptvgK2IfOnKlRmBg==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.26.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.27.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.0.tgz", + "integrity": "sha512-fO8l08T76v48BhpNRW/nQ0MxfnSdoSKUJBMjubOAYffsVuGG5qOfMq7N6Es7UJvi7Y8goXXo07EfcHZXDPuELQ==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "regexpu-core": "^6.2.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.4", + "resolved": "https://registry.npmmirror.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.4.tgz", + "integrity": "sha512-jljfR1rGnXXNWnmQg2K3+bvhkxB51Rl32QRaOTuwwjviGrHzIbSc8+x9CpraDtbT7mfyjXObULP4w/adunNwAw==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.26.5", + "resolved": "https://registry.npmmirror.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz", + "integrity": "sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-wrap-function": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.26.5", + "resolved": "https://registry.npmmirror.com/@babel/helper-replace-supers/-/helper-replace-supers-7.26.5.tgz", + "integrity": "sha512-bJ6iIVdYX1YooY2X7w1q6VITt+LnUILtNk7zT78ykuwStx8BauCzxvFqFaHjOpW1bVnSUM1PN1f0p5P21wHxvg==", + "dev": true, + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-string-parser": { "version": "7.25.9", "resolved": "https://registry.npmmirror.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", - "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -96,7 +336,6 @@ "version": "7.25.9", "resolved": "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", - "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -106,18 +345,43 @@ "resolved": "https://registry.npmmirror.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, - "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz", + "integrity": "sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==", + "dev": true, + "dependencies": { + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" + }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.9", - "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.26.9.tgz", - "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", - "license": "MIT", + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "dependencies": { - "@babel/types": "^7.26.9" + "@babel/types": "^7.27.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -126,11 +390,1113 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/types": { + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz", + "integrity": "sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz", + "integrity": "sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz", + "integrity": "sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz", + "integrity": "sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmmirror.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmmirror.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz", + "integrity": "sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmmirror.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz", + "integrity": "sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.26.8", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.26.8.tgz", + "integrity": "sha512-He9Ej2X7tNf2zdKMAGOsmg2MrFc+hfoAhd3po4cWfo/NWjzEAKa0oQruj1ROVUdl0e6fb6/kE/G3SSxE0lRJOg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5", + "@babel/helper-remap-async-to-generator": "^7.25.9", + "@babel/traverse": "^7.26.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz", + "integrity": "sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.26.5", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.26.5.tgz", + "integrity": "sha512-chuTSY+hq09+/f5lMj8ZSYgCFpppV2CbYrhNFJ1BFoXpiWPnnAb7R0MqrafCpN8E1+YRrtM1MXZHJdIx8B6rMQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.27.0.tgz", + "integrity": "sha512-u1jGphZ8uDI2Pj/HJj6YQ6XQLZCNjOlprjxB5SVz6rq2T6SwAR+CdrWK0CP7F+9rDVMXdB0+r6Am5G5aobOjAQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz", + "integrity": "sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz", + "integrity": "sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz", + "integrity": "sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz", + "integrity": "sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/template": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz", + "integrity": "sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz", + "integrity": "sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz", + "integrity": "sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz", + "integrity": "sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.26.3", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz", + "integrity": "sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz", + "integrity": "sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { "version": "7.26.9", - "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", - "license": "MIT", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.26.9.tgz", + "integrity": "sha512-Hry8AusVm8LW5BVFgiyUReuoGzPUpdHQQqJY5bZnbbf+ngOHWuCuYFKw/BqaaWlvEUrF91HMhDtEaI1hZzNbLg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz", + "integrity": "sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz", + "integrity": "sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz", + "integrity": "sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz", + "integrity": "sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz", + "integrity": "sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz", + "integrity": "sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.26.3", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz", + "integrity": "sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz", + "integrity": "sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz", + "integrity": "sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz", + "integrity": "sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.26.6", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.26.6.tgz", + "integrity": "sha512-CKW8Vu+uUZneQCPtXmSBUC6NCAUdya26hWCElAWh5mVSlSRsmiCPUUDKb3Z0szng1hiAJa098Hkhg9o4SE35Qw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz", + "integrity": "sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz", + "integrity": "sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz", + "integrity": "sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz", + "integrity": "sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz", + "integrity": "sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz", + "integrity": "sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz", + "integrity": "sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz", + "integrity": "sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.27.0.tgz", + "integrity": "sha512-LX/vCajUJQDqE7Aum/ELUMZAY19+cDpghxrnyt5I1tV6X5PyC86AOoWXWFYFeIvauyeSA6/ktn4tQVn/3ZifsA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5", + "regenerator-transform": "^0.15.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz", + "integrity": "sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz", + "integrity": "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-runtime": { + "version": "7.26.10", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.10.tgz", + "integrity": "sha512-NWaL2qG6HRpONTnj4JvDU6th4jYeZOJgu3QhmFTCihib0ermtOJqktA5BduGm3suhhVe9EMP9c9+mfJ/I9slqw==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.26.5", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.11.0", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz", + "integrity": "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz", + "integrity": "sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz", + "integrity": "sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.26.8", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.26.8.tgz", + "integrity": "sha512-OmGDL5/J0CJPJZTHZbi2XpO0tyT2Ia7fzpW5GURwdtp2X3fMmN8au/ej6peC/T33/+CRiIpA8Krse8hFGVmT5Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.0.tgz", + "integrity": "sha512-+LLkxA9rKJpNoGsbLnAgOCdESl73vwYn+V6b+5wHbrE7OGKVDPHIQvbFSzqE6rwqaCw2RE+zdJrlLkcf8YOA0w==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.26.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", + "integrity": "sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz", + "integrity": "sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz", + "integrity": "sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz", + "integrity": "sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.26.9", + "resolved": "https://registry.npmmirror.com/@babel/preset-env/-/preset-env-7.26.9.tgz", + "integrity": "sha512-vX3qPGE8sEKEAZCWk05k3cpTAE3/nOYca++JA+Rd0z2NCNzabmYvEiSShKzm10zdquOIAVXsy2Ei/DTW34KlKQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.26.8", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-plugin-utils": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.9", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.9", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.9", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.25.9", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.9", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.26.0", + "@babel/plugin-syntax-import-attributes": "^7.26.0", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.25.9", + "@babel/plugin-transform-async-generator-functions": "^7.26.8", + "@babel/plugin-transform-async-to-generator": "^7.25.9", + "@babel/plugin-transform-block-scoped-functions": "^7.26.5", + "@babel/plugin-transform-block-scoping": "^7.25.9", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-class-static-block": "^7.26.0", + "@babel/plugin-transform-classes": "^7.25.9", + "@babel/plugin-transform-computed-properties": "^7.25.9", + "@babel/plugin-transform-destructuring": "^7.25.9", + "@babel/plugin-transform-dotall-regex": "^7.25.9", + "@babel/plugin-transform-duplicate-keys": "^7.25.9", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-dynamic-import": "^7.25.9", + "@babel/plugin-transform-exponentiation-operator": "^7.26.3", + "@babel/plugin-transform-export-namespace-from": "^7.25.9", + "@babel/plugin-transform-for-of": "^7.26.9", + "@babel/plugin-transform-function-name": "^7.25.9", + "@babel/plugin-transform-json-strings": "^7.25.9", + "@babel/plugin-transform-literals": "^7.25.9", + "@babel/plugin-transform-logical-assignment-operators": "^7.25.9", + "@babel/plugin-transform-member-expression-literals": "^7.25.9", + "@babel/plugin-transform-modules-amd": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.26.3", + "@babel/plugin-transform-modules-systemjs": "^7.25.9", + "@babel/plugin-transform-modules-umd": "^7.25.9", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-new-target": "^7.25.9", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.26.6", + "@babel/plugin-transform-numeric-separator": "^7.25.9", + "@babel/plugin-transform-object-rest-spread": "^7.25.9", + "@babel/plugin-transform-object-super": "^7.25.9", + "@babel/plugin-transform-optional-catch-binding": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-property-literals": "^7.25.9", + "@babel/plugin-transform-regenerator": "^7.25.9", + "@babel/plugin-transform-regexp-modifiers": "^7.26.0", + "@babel/plugin-transform-reserved-words": "^7.25.9", + "@babel/plugin-transform-shorthand-properties": "^7.25.9", + "@babel/plugin-transform-spread": "^7.25.9", + "@babel/plugin-transform-sticky-regex": "^7.25.9", + "@babel/plugin-transform-template-literals": "^7.26.8", + "@babel/plugin-transform-typeof-symbol": "^7.26.7", + "@babel/plugin-transform-unicode-escapes": "^7.25.9", + "@babel/plugin-transform-unicode-property-regex": "^7.25.9", + "@babel/plugin-transform-unicode-regex": "^7.25.9", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.9", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.11.0", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.40.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmmirror.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.27.0.tgz", + "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true + }, + "node_modules/@babel/template": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" @@ -144,24 +1510,26 @@ "resolved": "https://registry.npmmirror.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.0.0" } }, + "node_modules/@eshaz/web-worker": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/@eshaz/web-worker/-/web-worker-1.2.2.tgz", + "integrity": "sha512-WxXiHFmD9u/owrzempiDlBB1ZYqiLnm9s6aPc8AlFQalq2tKmqdmMr9GXOupDgzXtqnBipj8Un0gkIm7Sjf8mw==" + }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmmirror.com/@hapi/hoek/-/hoek-9.3.0.tgz", "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", - "dev": true, - "license": "BSD-3-Clause" + "dev": true }, "node_modules/@hapi/topo": { "version": "5.1.0", "resolved": "https://registry.npmmirror.com/@hapi/topo/-/topo-5.1.0.tgz", "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "@hapi/hoek": "^9.0.0" } @@ -171,7 +1539,6 @@ "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, - "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -186,7 +1553,6 @@ "resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -196,7 +1562,6 @@ "resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -206,7 +1571,6 @@ "resolved": "https://registry.npmmirror.com/@jridgewell/source-map/-/source-map-0.3.6.tgz", "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "dev": true, - "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" @@ -216,15 +1580,13 @@ "version": "1.5.0", "resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, - "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -234,15 +1596,13 @@ "version": "2.0.5", "resolved": "https://registry.npmmirror.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@node-ipc/js-queue": { "version": "2.0.3", "resolved": "https://registry.npmmirror.com/@node-ipc/js-queue/-/js-queue-2.0.3.tgz", "integrity": "sha512-fL1wpr8hhD5gT2dA1qifeVaoDFlQR5es8tFuKqjHX+kdOtdNHnxkVZbtIrR2rxnMFvehkjaZRNV2H/gPXlb0hw==", "dev": true, - "license": "MIT", "dependencies": { "easy-stack": "1.0.1" }, @@ -255,7 +1615,6 @@ "resolved": "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -269,7 +1628,6 @@ "resolved": "https://registry.npmmirror.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, - "license": "MIT", "engines": { "node": ">= 8" } @@ -279,7 +1637,6 @@ "resolved": "https://registry.npmmirror.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -294,7 +1651,6 @@ "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", "dev": true, "hasInstallScript": true, - "license": "MIT", "optional": true, "dependencies": { "detect-libc": "^1.0.3", @@ -325,6 +1681,46 @@ "@parcel/watcher-win32-x64": "2.5.1" } }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz", + "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz", + "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@parcel/watcher-darwin-x64": { "version": "2.5.1", "resolved": "https://registry.npmmirror.com/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz", @@ -333,7 +1729,6 @@ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" @@ -346,19 +1741,371 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz", + "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz", + "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz", + "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz", + "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz", + "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz", + "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz", + "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz", + "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz", + "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmmirror.com/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz", + "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.28", "resolved": "https://registry.npmmirror.com/@polka/url/-/url-1.0.0-next.28.tgz", "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", + "dev": true + }, + "node_modules/@rollup/plugin-babel": { + "version": "5.3.1", + "resolved": "https://registry.npmmirror.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", + "integrity": "sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==", "dev": true, - "license": "MIT" + "dependencies": { + "@babel/helper-module-imports": "^7.10.4", + "@rollup/pluginutils": "^3.1.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "@types/babel__core": "^7.1.9", + "rollup": "^1.20.0||^2.0.0" + }, + "peerDependenciesMeta": { + "@types/babel__core": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.3.1", + "resolved": "https://registry.npmmirror.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", + "integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@rollup/plugin-replace": { + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz", + "integrity": "sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "magic-string": "^0.25.7" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmmirror.com/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/pluginutils/node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true }, "node_modules/@sideway/address": { "version": "4.1.5", "resolved": "https://registry.npmmirror.com/@sideway/address/-/address-4.1.5.tgz", "integrity": "sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "@hapi/hoek": "^9.0.0" } @@ -367,22 +2114,19 @@ "version": "3.0.1", "resolved": "https://registry.npmmirror.com/@sideway/formula/-/formula-3.0.1.tgz", "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", - "dev": true, - "license": "BSD-3-Clause" + "dev": true }, "node_modules/@sideway/pinpoint": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", - "dev": true, - "license": "BSD-3-Clause" + "dev": true }, "node_modules/@soda/friendly-errors-webpack-plugin": { "version": "1.8.1", "resolved": "https://registry.npmmirror.com/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.8.1.tgz", "integrity": "sha512-h2ooWqP8XuFqTXT+NyAFbrArzfQA7R6HTezADrvD9Re8fxMLTPPniLdqVTdDaO0eIoLaAwKT+d6w+5GeTk7Vbg==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^3.0.0", "error-stack-parser": "^2.0.6", @@ -400,15 +2144,25 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/@soda/get-current-script/-/get-current-script-1.0.2.tgz", "integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==", + "dev": true + }, + "node_modules/@surma/rollup-plugin-off-main-thread": { + "version": "2.2.3", + "resolved": "https://registry.npmmirror.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz", + "integrity": "sha512-lR8q/9W7hZpMWweNiAKU7NQerBnzQQLvi8qnTDU/fxItPhtZVMbPV3lbCwjhIlNBe9Bbr5V+KHshvWmVSG9cxQ==", "dev": true, - "license": "MIT" + "dependencies": { + "ejs": "^3.1.6", + "json5": "^2.2.0", + "magic-string": "^0.25.0", + "string.prototype.matchall": "^4.0.6" + } }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmmirror.com/@trysound/sax/-/sax-0.2.0.tgz", "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true, - "license": "ISC", "engines": { "node": ">=10.13.0" } @@ -418,7 +2172,6 @@ "resolved": "https://registry.npmmirror.com/@types/body-parser/-/body-parser-1.19.5.tgz", "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", "dev": true, - "license": "MIT", "dependencies": { "@types/connect": "*", "@types/node": "*" @@ -429,7 +2182,6 @@ "resolved": "https://registry.npmmirror.com/@types/bonjour/-/bonjour-3.5.13.tgz", "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -439,7 +2191,6 @@ "resolved": "https://registry.npmmirror.com/@types/connect/-/connect-3.4.38.tgz", "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -449,7 +2200,6 @@ "resolved": "https://registry.npmmirror.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", "dev": true, - "license": "MIT", "dependencies": { "@types/express-serve-static-core": "*", "@types/node": "*" @@ -460,7 +2210,6 @@ "resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz", "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, - "license": "MIT", "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -471,25 +2220,22 @@ "resolved": "https://registry.npmmirror.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, - "license": "MIT", "dependencies": { "@types/eslint": "*", "@types/estree": "*" } }, "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true, - "license": "MIT" + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true }, "node_modules/@types/express": { "version": "4.17.21", "resolved": "https://registry.npmmirror.com/@types/express/-/express-4.17.21.tgz", "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", "dev": true, - "license": "MIT", "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -502,7 +2248,6 @@ "resolved": "https://registry.npmmirror.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz", "integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -515,7 +2260,6 @@ "resolved": "https://registry.npmmirror.com/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -527,22 +2271,19 @@ "version": "6.1.0", "resolved": "https://registry.npmmirror.com/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/http-errors": { "version": "2.0.4", "resolved": "https://registry.npmmirror.com/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/http-proxy": { "version": "1.17.16", "resolved": "https://registry.npmmirror.com/@types/http-proxy/-/http-proxy-1.17.16.tgz", "integrity": "sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -551,29 +2292,25 @@ "version": "7.0.15", "resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmmirror.com/@types/mime/-/mime-1.3.5.tgz", "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/minimist": { "version": "1.2.5", "resolved": "https://registry.npmmirror.com/@types/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/node": { - "version": "22.13.9", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.13.9.tgz", - "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", + "version": "22.13.14", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.13.14.tgz", + "integrity": "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==", "dev": true, - "license": "MIT", "dependencies": { "undici-types": "~6.20.0" } @@ -583,7 +2320,6 @@ "resolved": "https://registry.npmmirror.com/@types/node-forge/-/node-forge-1.3.11.tgz", "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -592,43 +2328,43 @@ "version": "2.4.4", "resolved": "https://registry.npmmirror.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/parse-json": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/@types/parse-json/-/parse-json-4.0.2.tgz", "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/qs": { "version": "6.9.18", "resolved": "https://registry.npmmirror.com/@types/qs/-/qs-6.9.18.tgz", "integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/range-parser": { "version": "1.2.7", "resolved": "https://registry.npmmirror.com/@types/range-parser/-/range-parser-1.2.7.tgz", "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", - "dev": true, - "license": "MIT" + "dev": true + }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmmirror.com/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true }, "node_modules/@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmmirror.com/@types/retry/-/retry-0.12.0.tgz", "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/send": { "version": "0.17.4", "resolved": "https://registry.npmmirror.com/@types/send/-/send-0.17.4.tgz", "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", "dev": true, - "license": "MIT", "dependencies": { "@types/mime": "^1", "@types/node": "*" @@ -639,7 +2375,6 @@ "resolved": "https://registry.npmmirror.com/@types/serve-index/-/serve-index-1.9.4.tgz", "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", "dev": true, - "license": "MIT", "dependencies": { "@types/express": "*" } @@ -649,7 +2384,6 @@ "resolved": "https://registry.npmmirror.com/@types/serve-static/-/serve-static-1.15.7.tgz", "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", "dev": true, - "license": "MIT", "dependencies": { "@types/http-errors": "*", "@types/node": "*", @@ -661,17 +2395,21 @@ "resolved": "https://registry.npmmirror.com/@types/sockjs/-/sockjs-0.3.36.tgz", "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmmirror.com/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true + }, "node_modules/@types/ws": { "version": "8.18.0", "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.18.0.tgz", "integrity": "sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -680,15 +2418,13 @@ "version": "5.0.8", "resolved": "https://registry.npmmirror.com/@vue/cli-overlay/-/cli-overlay-5.0.8.tgz", "integrity": "sha512-KmtievE/B4kcXp6SuM2gzsnSd8WebkQpg3XaB6GmFh1BJGRqa1UiW9up7L/Q67uOdTigHxr5Ar2lZms4RcDjwQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@vue/cli-plugin-router": { "version": "5.0.8", "resolved": "https://registry.npmmirror.com/@vue/cli-plugin-router/-/cli-plugin-router-5.0.8.tgz", "integrity": "sha512-Gmv4dsGdAsWPqVijz3Ux2OS2HkMrWi1ENj2cYL75nUeL+Xj5HEstSqdtfZ0b1q9NCce+BFB6QnHfTBXc/fCvMg==", "dev": true, - "license": "MIT", "dependencies": { "@vue/cli-shared-utils": "^5.0.8" }, @@ -701,7 +2437,6 @@ "resolved": "https://registry.npmmirror.com/@vue/cli-plugin-vuex/-/cli-plugin-vuex-5.0.8.tgz", "integrity": "sha512-HSYWPqrunRE5ZZs8kVwiY6oWcn95qf/OQabwLfprhdpFWAGtLStShjsGED2aDpSSeGAskQETrtR/5h7VqgIlBA==", "dev": true, - "license": "MIT", "peerDependencies": { "@vue/cli-service": "^3.0.0 || ^4.0.0 || ^5.0.0-0" } @@ -711,7 +2446,6 @@ "resolved": "https://registry.npmmirror.com/@vue/cli-service/-/cli-service-5.0.8.tgz", "integrity": "sha512-nV7tYQLe7YsTtzFrfOMIHc5N2hp5lHG2rpYr0aNja9rNljdgcPZLyQRb2YRivTHqTv7lI962UXFURcpStHgyFw==", "dev": true, - "license": "MIT", "dependencies": { "@babel/helper-compilation-targets": "^7.12.16", "@soda/friendly-errors-webpack-plugin": "^1.8.0", @@ -811,7 +2545,6 @@ "resolved": "https://registry.npmmirror.com/@vue/cli-shared-utils/-/cli-shared-utils-5.0.8.tgz", "integrity": "sha512-uK2YB7bBVuQhjOJF+O52P9yFMXeJVj7ozqJkwYE9PlMHL1LMHjtCYm4cSdOebuPzyP+/9p0BimM/OqxsevIopQ==", "dev": true, - "license": "MIT", "dependencies": { "@achrinza/node-ipc": "^9.2.5", "chalk": "^4.1.2", @@ -832,7 +2565,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -849,7 +2581,6 @@ "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, - "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -862,7 +2593,6 @@ "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -874,8 +2604,7 @@ "version": "4.0.0", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/@vue/compiler-sfc": { "version": "2.7.16", @@ -895,7 +2624,6 @@ "resolved": "https://registry.npmmirror.com/@vue/component-compiler-utils/-/component-compiler-utils-3.3.0.tgz", "integrity": "sha512-97sfH2mYNU+2PzGrmK2haqffDpVASuib9/w2/noxiFi31Z54hW+q3izKQXXQZSNhtiUpAI36uSuYepeBe4wpHQ==", "dev": true, - "license": "MIT", "dependencies": { "consolidate": "^0.15.1", "hash-sum": "^1.0.2", @@ -914,15 +2642,13 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz", "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@vue/component-compiler-utils/node_modules/lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, - "license": "ISC", "dependencies": { "pseudomap": "^1.0.2", "yallist": "^2.1.2" @@ -932,15 +2658,13 @@ "version": "0.2.1", "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-0.2.1.tgz", "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/@vue/component-compiler-utils/node_modules/postcss": { "version": "7.0.39", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-7.0.39.tgz", "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", "dev": true, - "license": "MIT", "dependencies": { "picocolors": "^0.2.1", "source-map": "^0.6.1" @@ -957,8 +2681,7 @@ "version": "2.1.2", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-2.1.2.tgz", "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/@vue/vue-loader-v15": { "name": "vue-loader", @@ -966,7 +2689,6 @@ "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz", "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==", "dev": true, - "license": "MIT", "dependencies": { "@vue/component-compiler-utils": "^3.1.0", "hash-sum": "^1.0.2", @@ -994,22 +2716,28 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz", "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@vue/web-component-wrapper": { "version": "1.3.0", "resolved": "https://registry.npmmirror.com/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz", "integrity": "sha512-Iu8Tbg3f+emIIMmI2ycSI8QcEuAUgPTgHwesDU1eKMLE4YC/c/sFbGc70QgMq31ijRftV0R7vCm9co6rldCeOA==", - "dev": true, - "license": "MIT" + "dev": true + }, + "node_modules/@wasm-audio-decoders/common": { + "version": "9.0.5", + "resolved": "https://registry.npmmirror.com/@wasm-audio-decoders/common/-/common-9.0.5.tgz", + "integrity": "sha512-b9JNh9sPAvn8PVIizNh9D60WkfQong/u9ea873H47u7zvVDLctxYIp2aZw9CQqXaQdk7JB3MoU5UHiseO40swg==", + "dependencies": { + "@eshaz/web-worker": "1.2.2", + "simple-yenc": "^1.0.4" + } }, "node_modules/@webassemblyjs/ast": { "version": "1.14.1", "resolved": "https://registry.npmmirror.com/@webassemblyjs/ast/-/ast-1.14.1.tgz", "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" @@ -1019,29 +2747,25 @@ "version": "1.13.2", "resolved": "https://registry.npmmirror.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.13.2", "resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.14.1", "resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.13.2", "resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.13.2", "@webassemblyjs/helper-api-error": "1.13.2", @@ -1052,15 +2776,13 @@ "version": "1.13.2", "resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.14.1", "resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -1073,7 +2795,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, - "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -1083,7 +2804,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, - "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" } @@ -1092,15 +2812,13 @@ "version": "1.13.2", "resolved": "https://registry.npmmirror.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.14.1", "resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -1117,7 +2835,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", @@ -1131,7 +2848,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -1144,7 +2860,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-api-error": "1.13.2", @@ -1159,7 +2874,6 @@ "resolved": "https://registry.npmmirror.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, - "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" @@ -1169,22 +2883,19 @@ "version": "1.2.0", "resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true, - "license": "BSD-3-Clause" + "dev": true }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmmirror.com/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true, - "license": "Apache-2.0" + "dev": true }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, - "license": "MIT", "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" @@ -1198,7 +2909,6 @@ "resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1208,7 +2918,6 @@ "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.14.1.tgz", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, - "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1221,7 +2930,6 @@ "resolved": "https://registry.npmmirror.com/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, - "license": "MIT", "dependencies": { "acorn": "^8.11.0" }, @@ -1234,7 +2942,6 @@ "resolved": "https://registry.npmmirror.com/address/-/address-1.2.2.tgz", "integrity": "sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -1243,7 +2950,6 @@ "version": "6.12.6", "resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1260,7 +2966,6 @@ "resolved": "https://registry.npmmirror.com/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, - "license": "MIT", "dependencies": { "ajv": "^8.0.0" }, @@ -1278,7 +2983,6 @@ "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, - "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -1294,15 +2998,13 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true, - "license": "MIT", "peerDependencies": { "ajv": "^6.9.1" } @@ -1312,7 +3014,6 @@ "resolved": "https://registry.npmmirror.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz", "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -1325,7 +3026,6 @@ "engines": [ "node >= 0.8.0" ], - "license": "Apache-2.0", "bin": { "ansi-html": "bin/ansi-html" } @@ -1335,7 +3035,6 @@ "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -1345,7 +3044,6 @@ "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1360,15 +3058,13 @@ "version": "1.3.0", "resolved": "https://registry.npmmirror.com/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, - "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -1395,31 +3091,64 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmmirror.com/asn1/-/asn1-0.2.6.tgz", "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "license": "MIT", "dependencies": { "safer-buffer": "~2.1.0" } @@ -1428,19 +3157,23 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "license": "MIT", "engines": { "node": ">=0.8" } }, "node_modules/async": { - "version": "2.6.4", - "resolved": "https://registry.npmmirror.com/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "version": "3.2.6", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.14" + "engines": { + "node": ">= 0.4" } }, "node_modules/async-validator": { @@ -1454,23 +3187,21 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "license": "MIT" + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, - "license": "ISC", "engines": { "node": ">= 4.0.0" } }, "node_modules/autoprefixer": { - "version": "10.4.20", - "resolved": "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.4.20.tgz", - "integrity": "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==", + "version": "10.4.21", + "resolved": "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", "dev": true, "funding": [ { @@ -1486,13 +3217,12 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { - "browserslist": "^4.23.3", - "caniuse-lite": "^1.0.30001646", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", - "picocolors": "^1.0.1", + "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { @@ -1505,11 +3235,25 @@ "postcss": "^8.1.0" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmmirror.com/aws-sign2/-/aws-sign2-0.7.0.tgz", "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "license": "Apache-2.0", "engines": { "node": "*" } @@ -1517,14 +3261,12 @@ "node_modules/aws4": { "version": "1.13.2", "resolved": "https://registry.npmmirror.com/aws4/-/aws4-1.13.2.tgz", - "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", - "license": "MIT" + "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==" }, "node_modules/axios": { - "version": "1.8.2", - "resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.2.tgz", - "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", - "license": "MIT", + "version": "1.8.4", + "resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "peer": true, "dependencies": { "follow-redirects": "^1.15.6", @@ -1535,25 +3277,68 @@ "node_modules/babel-helper-vue-jsx-merge-props": { "version": "2.0.3", "resolved": "https://registry.npmmirror.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz", - "integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==", - "license": "MIT" + "integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==" + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.13", + "resolved": "https://registry.npmmirror.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.13.tgz", + "integrity": "sha512-3sX/eOms8kd3q2KZ6DAhKPc0dgm525Gqq5NtWKZ7QYYZEv57OQ54KtblzJzH1lQF/eQxO8KjWGIK9IPUJNus5g==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.4", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.11.1", + "resolved": "https://registry.npmmirror.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz", + "integrity": "sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.3", + "core-js-compat": "^3.40.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.6.4", + "resolved": "https://registry.npmmirror.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.4.tgz", + "integrity": "sha512-7gD3pRadPrbjhjLyxebmx/WrFYcuSjZ0XbdUujQMZ/fcE9oeewk2U/7PCvez84UeuK3oSjmPZ0Ch0dlupQvGzw==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.4" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } }, "node_modules/babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmmirror.com/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==", - "license": "MIT", "dependencies": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" } }, + "node_modules/babel-runtime/node_modules/core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "hasInstallScript": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/base64-js": { "version": "1.5.1", @@ -1573,21 +3358,18 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmmirror.com/batch/-/batch-0.6.1.tgz", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "license": "BSD-3-Clause", "dependencies": { "tweetnacl": "^0.14.3" } @@ -1597,7 +3379,6 @@ "resolved": "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "dev": true, - "license": "MIT", "engines": { "node": "*" } @@ -1607,7 +3388,6 @@ "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" }, @@ -1620,7 +3400,6 @@ "resolved": "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, - "license": "MIT", "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -1631,15 +3410,13 @@ "version": "3.7.2", "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz", "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.3.tgz", "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dev": true, - "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -1664,7 +3441,6 @@ "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -1673,15 +3449,13 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/body-parser/node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmmirror.com/qs/-/qs-6.13.0.tgz", "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.6" }, @@ -1697,7 +3471,6 @@ "resolved": "https://registry.npmmirror.com/bonjour-service/-/bonjour-service-1.3.0.tgz", "integrity": "sha512-3YuAUiSkWykd+2Azjgyxei8OWf8thdn8AITIog2M4UICzoqfjlqr64WIjEXZllf/W6vK1goqleSR6brGomxQqA==", "dev": true, - "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "multicast-dns": "^7.2.5" @@ -1707,15 +3480,13 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1726,7 +3497,6 @@ "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, - "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -1753,7 +3523,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", @@ -1786,7 +3555,6 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -1796,24 +3564,39 @@ "version": "1.1.2", "resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" @@ -1827,7 +3610,6 @@ "resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz", "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, - "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" @@ -1844,7 +3626,6 @@ "resolved": "https://registry.npmmirror.com/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -1854,7 +3635,6 @@ "resolved": "https://registry.npmmirror.com/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", "dev": true, - "license": "MIT", "dependencies": { "pascal-case": "^3.1.2", "tslib": "^2.0.3" @@ -1865,7 +3645,6 @@ "resolved": "https://registry.npmmirror.com/caniuse-api/-/caniuse-api-3.0.0.tgz", "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.0.0", "caniuse-lite": "^1.0.0", @@ -1874,9 +3653,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001702", - "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001702.tgz", - "integrity": "sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA==", + "version": "1.0.30001707", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", "dev": true, "funding": [ { @@ -1891,15 +3670,13 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ], - "license": "CC-BY-4.0" + ] }, "node_modules/case-sensitive-paths-webpack-plugin": { "version": "2.4.0", "resolved": "https://registry.npmmirror.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.4.0.tgz", "integrity": "sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -1907,15 +3684,13 @@ "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmmirror.com/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "license": "Apache-2.0" + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" }, "node_modules/chalk": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1929,7 +3704,6 @@ "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-4.0.3.tgz", "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, - "license": "MIT", "dependencies": { "readdirp": "^4.0.1" }, @@ -1945,7 +3719,6 @@ "resolved": "https://registry.npmmirror.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.0" } @@ -1955,7 +3728,6 @@ "resolved": "https://registry.npmmirror.com/clean-css/-/clean-css-5.3.3.tgz", "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", "dev": true, - "license": "MIT", "dependencies": { "source-map": "~0.6.0" }, @@ -1968,7 +3740,6 @@ "resolved": "https://registry.npmmirror.com/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, - "license": "MIT", "dependencies": { "restore-cursor": "^3.1.0" }, @@ -1981,7 +3752,6 @@ "resolved": "https://registry.npmmirror.com/cli-highlight/-/cli-highlight-2.1.11.tgz", "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==", "dev": true, - "license": "ISC", "dependencies": { "chalk": "^4.0.0", "highlight.js": "^10.7.1", @@ -2003,7 +3773,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2020,7 +3789,6 @@ "resolved": "https://registry.npmmirror.com/cli-spinners/-/cli-spinners-2.9.2.tgz", "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" }, @@ -2033,7 +3801,6 @@ "resolved": "https://registry.npmmirror.com/clipboardy/-/clipboardy-2.3.0.tgz", "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", "dev": true, - "license": "MIT", "dependencies": { "arch": "^2.1.1", "execa": "^1.0.0", @@ -2048,7 +3815,6 @@ "resolved": "https://registry.npmmirror.com/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, - "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -2060,7 +3826,6 @@ "resolved": "https://registry.npmmirror.com/clone/-/clone-1.0.4.tgz", "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8" } @@ -2070,7 +3835,6 @@ "resolved": "https://registry.npmmirror.com/clone-deep/-/clone-deep-4.0.1.tgz", "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "dev": true, - "license": "MIT", "dependencies": { "is-plain-object": "^2.0.4", "kind-of": "^6.0.2", @@ -2085,7 +3849,6 @@ "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -2097,28 +3860,24 @@ "version": "1.1.4", "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/colord": { "version": "2.9.3", "resolved": "https://registry.npmmirror.com/colord/-/colord-2.9.3.tgz", "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/colorette": { "version": "2.0.20", "resolved": "https://registry.npmmirror.com/colorette/-/colorette-2.0.20.tgz", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2131,17 +3890,24 @@ "resolved": "https://registry.npmmirror.com/commander/-/commander-8.3.0.tgz", "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", "dev": true, - "license": "MIT", "engines": { "node": ">= 12" } }, + "node_modules/common-tags": { + "version": "1.8.2", + "resolved": "https://registry.npmmirror.com/common-tags/-/common-tags-1.8.2.tgz", + "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmmirror.com/compressible/-/compressible-2.0.18.tgz", "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", "dev": true, - "license": "MIT", "dependencies": { "mime-db": ">= 1.43.0 < 2" }, @@ -2154,7 +3920,6 @@ "resolved": "https://registry.npmmirror.com/compression/-/compression-1.8.0.tgz", "integrity": "sha512-k6WLKfunuqCYD3t6AsuPGvQWaKwuLLh2/xHNcX4qE+vIfDNXpSqnrhwA7O53R7WVQUnt8dVAIW+YHr7xTgOgGA==", "dev": true, - "license": "MIT", "dependencies": { "bytes": "3.1.2", "compressible": "~2.0.18", @@ -2168,12 +3933,31 @@ "node": ">= 0.8.0" } }, + "node_modules/compression-webpack-plugin": { + "version": "11.1.0", + "resolved": "https://registry.npmmirror.com/compression-webpack-plugin/-/compression-webpack-plugin-11.1.0.tgz", + "integrity": "sha512-zDOQYp10+upzLxW+VRSjEpRRwBXJdsb5lBMlRxx1g8hckIFBpe3DTI0en2w7h+beuq89576RVzfiXrkdPGrHhA==", + "dev": true, + "dependencies": { + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, "node_modules/compression/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -2182,22 +3966,19 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/connect-history-api-fallback": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8" } @@ -2208,7 +3989,6 @@ "integrity": "sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==", "deprecated": "Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog", "dev": true, - "license": "MIT", "dependencies": { "bluebird": "^3.1.1" }, @@ -2221,7 +4001,6 @@ "resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz", "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dev": true, - "license": "MIT", "dependencies": { "safe-buffer": "5.2.1" }, @@ -2234,17 +4013,21 @@ "resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "node_modules/cookie": { "version": "0.7.1", "resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.1.tgz", "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2253,15 +4036,13 @@ "version": "1.0.6", "resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/copy-webpack-plugin": { "version": "9.1.0", "resolved": "https://registry.npmmirror.com/copy-webpack-plugin/-/copy-webpack-plugin-9.1.0.tgz", "integrity": "sha512-rxnR7PaGigJzhqETHGmAcxKnLZSR5u1Y3/bcIv/1FnqXedcL/E2ewK7ZCNrArJKCiSv8yVXhTqetJh8inDvfsA==", "dev": true, - "license": "MIT", "dependencies": { "fast-glob": "^3.2.7", "glob-parent": "^6.0.1", @@ -2281,26 +4062,57 @@ "webpack": "^5.1.0" } }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "version": "3.41.0", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.41.0.tgz", + "integrity": "sha512-SJ4/EHwS36QMJd6h/Rg+GyR4A5xE0FSI3eZ+iBVpfqf1x0eTSg1smWLHrA+2jQThZSh97fmSgFSU8B61nxosxA==", "hasInstallScript": true, - "license": "MIT" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat": { + "version": "3.41.0", + "resolved": "https://registry.npmmirror.com/core-js-compat/-/core-js-compat-3.41.0.tgz", + "integrity": "sha512-RFsU9LySVue9RTwdDVX/T0e2Y6jRYWXERKElIjpuEOEnxaXffI0X7RUwVzfYLfzuLXSNJDYoRYUAmRUcyln20A==", + "dev": true, + "dependencies": { + "browserslist": "^4.24.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "license": "MIT" + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, "node_modules/cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmmirror.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz", "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", "dev": true, - "license": "MIT", "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", @@ -2312,31 +4124,43 @@ "node": ">=10" } }, - "node_modules/cross-spawn": { - "version": "6.0.6", - "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-6.0.6.tgz", - "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", - "dev": true, - "license": "MIT", + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" }, "engines": { - "node": ">=4.8" + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" } }, - "node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" + "engines": { + "node": ">=8" } }, "node_modules/css-declaration-sorter": { @@ -2344,7 +4168,6 @@ "resolved": "https://registry.npmmirror.com/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", "dev": true, - "license": "ISC", "engines": { "node": "^10 || ^12 || >=14" }, @@ -2357,7 +4180,6 @@ "resolved": "https://registry.npmmirror.com/css-loader/-/css-loader-6.11.0.tgz", "integrity": "sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==", "dev": true, - "license": "MIT", "dependencies": { "icss-utils": "^5.1.0", "postcss": "^8.4.33", @@ -2393,7 +4215,6 @@ "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -2406,7 +4227,6 @@ "resolved": "https://registry.npmmirror.com/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-3.4.1.tgz", "integrity": "sha512-1u6D71zeIfgngN2XNRJefc/hY7Ybsxd74Jm4qngIXyUEk7fss3VUzuHxLAq/R8NAba4QU9OUSaMZlbpRc7bM4Q==", "dev": true, - "license": "MIT", "dependencies": { "cssnano": "^5.0.6", "jest-worker": "^27.0.2", @@ -2440,69 +4260,11 @@ } } }, - "node_modules/css-minimizer-webpack-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/css-minimizer-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/css-minimizer-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/css-minimizer-webpack-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/css-select": { "version": "4.3.0", "resolved": "https://registry.npmmirror.com/css-select/-/css-select-4.3.0.tgz", "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.0.1", @@ -2519,7 +4281,6 @@ "resolved": "https://registry.npmmirror.com/css-tree/-/css-tree-1.1.3.tgz", "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", "dev": true, - "license": "MIT", "dependencies": { "mdn-data": "2.0.14", "source-map": "^0.6.1" @@ -2533,7 +4294,6 @@ "resolved": "https://registry.npmmirror.com/css-what/-/css-what-6.1.0.tgz", "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">= 6" }, @@ -2546,7 +4306,6 @@ "resolved": "https://registry.npmmirror.com/cssesc/-/cssesc-3.0.0.tgz", "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true, - "license": "MIT", "bin": { "cssesc": "bin/cssesc" }, @@ -2559,7 +4318,6 @@ "resolved": "https://registry.npmmirror.com/cssnano/-/cssnano-5.1.15.tgz", "integrity": "sha512-j+BKgDcLDQA+eDifLx0EO4XSA56b7uut3BQFH+wbSaSTuGLuiyTa/wbRYthUXX8LC9mLg+WWKe8h+qJuwTAbHw==", "dev": true, - "license": "MIT", "dependencies": { "cssnano-preset-default": "^5.2.14", "lilconfig": "^2.0.3", @@ -2581,7 +4339,6 @@ "resolved": "https://registry.npmmirror.com/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz", "integrity": "sha512-t0SFesj/ZV2OTylqQVOrFgEh5uanxbO6ZAdeCrNsUQ6fVuXwYTxJPNAGvGTxHbD68ldIJNec7PyYZDBrfDQ+6A==", "dev": true, - "license": "MIT", "dependencies": { "css-declaration-sorter": "^6.3.1", "cssnano-utils": "^3.1.0", @@ -2625,7 +4382,6 @@ "resolved": "https://registry.npmmirror.com/cssnano-utils/-/cssnano-utils-3.1.0.tgz", "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -2638,7 +4394,6 @@ "resolved": "https://registry.npmmirror.com/csso/-/csso-4.2.0.tgz", "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", "dev": true, - "license": "MIT", "dependencies": { "css-tree": "^1.1.2" }, @@ -2649,14 +4404,12 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "license": "MIT" + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmmirror.com/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" }, @@ -2664,26 +4417,74 @@ "node": ">=0.10" } }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/de-indent": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/de-indent/-/de-indent-1.0.2.tgz", "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/debounce": { "version": "1.2.1", "resolved": "https://registry.npmmirror.com/debounce/-/debounce-1.2.1.tgz", "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.0.tgz", "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -2700,7 +4501,6 @@ "version": "1.5.2", "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz", "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2710,7 +4510,6 @@ "resolved": "https://registry.npmmirror.com/default-gateway/-/default-gateway-6.0.3.tgz", "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "execa": "^5.0.0" }, @@ -2718,27 +4517,11 @@ "node": ">= 10" } }, - "node_modules/default-gateway/node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/default-gateway/node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmmirror.com/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, - "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -2762,7 +4545,6 @@ "resolved": "https://registry.npmmirror.com/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -2775,7 +4557,6 @@ "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" }, @@ -2788,7 +4569,6 @@ "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, - "license": "MIT", "dependencies": { "path-key": "^3.0.0" }, @@ -2796,61 +4576,11 @@ "node": ">=8" } }, - "node_modules/default-gateway/node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/default-gateway/node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/default-gateway/node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/default-gateway/node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmmirror.com/defaults/-/defaults-1.0.4.tgz", "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", "dev": true, - "license": "MIT", "dependencies": { "clone": "^1.0.2" }, @@ -2858,21 +4588,53 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -2882,7 +4644,6 @@ "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -2892,7 +4653,6 @@ "resolved": "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" @@ -2903,7 +4663,6 @@ "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", "dev": true, - "license": "Apache-2.0", "optional": true, "bin": { "detect-libc": "bin/detect-libc.js" @@ -2916,15 +4675,13 @@ "version": "2.1.0", "resolved": "https://registry.npmmirror.com/detect-node/-/detect-node-2.1.0.tgz", "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, - "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -2937,7 +4694,6 @@ "resolved": "https://registry.npmmirror.com/dns-packet/-/dns-packet-5.6.1.tgz", "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", "dev": true, - "license": "MIT", "dependencies": { "@leichtgewicht/ip-codec": "^2.0.1" }, @@ -2950,7 +4706,6 @@ "resolved": "https://registry.npmmirror.com/dom-converter/-/dom-converter-0.2.0.tgz", "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", "dev": true, - "license": "MIT", "dependencies": { "utila": "~0.4" } @@ -2960,7 +4715,6 @@ "resolved": "https://registry.npmmirror.com/dom-serializer/-/dom-serializer-1.4.1.tgz", "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", "dev": true, - "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.0", @@ -2980,15 +4734,13 @@ "type": "github", "url": "https://github.com/sponsors/fb55" } - ], - "license": "BSD-2-Clause" + ] }, "node_modules/domhandler": { "version": "4.3.1", "resolved": "https://registry.npmmirror.com/domhandler/-/domhandler-4.3.1.tgz", "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "domelementtype": "^2.2.0" }, @@ -3004,7 +4756,6 @@ "resolved": "https://registry.npmmirror.com/domutils/-/domutils-2.8.0.tgz", "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", @@ -3019,7 +4770,6 @@ "resolved": "https://registry.npmmirror.com/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", "dev": true, - "license": "MIT", "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -3030,7 +4780,6 @@ "resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-10.0.0.tgz", "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=10" } @@ -3039,14 +4788,12 @@ "version": "5.1.0", "resolved": "https://registry.npmmirror.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", - "dev": true, - "license": "BSD-2-Clause" + "dev": true }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", @@ -3060,15 +4807,13 @@ "version": "0.1.2", "resolved": "https://registry.npmmirror.com/duplexer/-/duplexer-0.1.2.tgz", "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/easy-stack": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/easy-stack/-/easy-stack-1.0.1.tgz", "integrity": "sha512-wK2sCs4feiiJeFXn3zvY0p41mdU5VUgbgs1rNsc/y5ngFUijdWd+iIN8eoyuZHKB8xN6BL4PdWmzqFmxNg6V2w==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -3077,7 +4822,6 @@ "version": "0.1.2", "resolved": "https://registry.npmmirror.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "license": "MIT", "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -3087,21 +4831,33 @@ "version": "1.1.1", "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmmirror.com/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", "dev": true, - "license": "MIT" + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } }, "node_modules/electron-to-chromium": { - "version": "1.5.113", - "resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.113.tgz", - "integrity": "sha512-wjT2O4hX+wdWPJ76gWSkMhcHAV2PTMX+QetUCPYEdCIe+cxmgzzSSiGRCKW8nuh4mwKZlpv0xvoW7OF2X+wmHg==", - "dev": true, - "license": "ISC" + "version": "1.5.128", + "resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.128.tgz", + "integrity": "sha512-bo1A4HH/NS522Ws0QNFIzyPcyUUNV/yyy70Ho1xqfGYzPUme2F/xr4tlEOuM6/A538U1vDA7a4XfCd1CKRegKQ==", + "dev": true }, "node_modules/element-ui": { "version": "2.15.14", "resolved": "https://registry.npmmirror.com/element-ui/-/element-ui-2.15.14.tgz", "integrity": "sha512-2v9fHL0ZGINotOlRIAJD5YuVB8V7WKxrE9Qy7dXhRipa035+kF7WuU/z+tEmLVPBcJ0zt8mOu1DKpWcVzBK8IA==", - "license": "MIT", "dependencies": { "async-validator": "~1.8.1", "babel-helper-vue-jsx-merge-props": "^2.0.0", @@ -3118,15 +4874,13 @@ "version": "8.0.0", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/emojis-list": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/emojis-list/-/emojis-list-3.0.0.tgz", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", "dev": true, - "license": "MIT", "engines": { "node": ">= 4" } @@ -3136,7 +4890,6 @@ "resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz", "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -3146,7 +4899,6 @@ "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, - "license": "MIT", "dependencies": { "once": "^1.4.0" } @@ -3156,7 +4908,6 @@ "resolved": "https://registry.npmmirror.com/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", "integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==", "dev": true, - "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -3170,7 +4921,6 @@ "resolved": "https://registry.npmmirror.com/entities/-/entities-2.2.0.tgz", "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", "dev": true, - "license": "BSD-2-Clause", "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } @@ -3180,7 +4930,6 @@ "resolved": "https://registry.npmmirror.com/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, - "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" } @@ -3190,16 +4939,79 @@ "resolved": "https://registry.npmmirror.com/error-stack-parser/-/error-stack-parser-2.1.4.tgz", "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", "dev": true, - "license": "MIT", "dependencies": { "stackframe": "^1.3.4" } }, + "node_modules/es-abstract": { + "version": "1.23.9", + "resolved": "https://registry.npmmirror.com/es-abstract/-/es-abstract-1.23.9.tgz", + "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.0", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-regex": "^1.2.1", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.0", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.3", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.18" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", "engines": { "node": ">= 0.4" } @@ -3208,7 +5020,6 @@ "version": "1.3.0", "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", "engines": { "node": ">= 0.4" } @@ -3217,14 +5028,12 @@ "version": "1.6.0", "resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-1.6.0.tgz", "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "license": "MIT", "dependencies": { "es-errors": "^1.3.0" }, @@ -3236,8 +5045,6 @@ "version": "2.1.0", "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "license": "MIT", - "peer": true, "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", @@ -3248,12 +5055,28 @@ "node": ">= 0.4" } }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -3262,15 +5085,13 @@ "version": "1.0.3", "resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8.0" } @@ -3280,7 +5101,6 @@ "resolved": "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -3294,7 +5114,6 @@ "resolved": "https://registry.npmmirror.com/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -3307,7 +5126,6 @@ "resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -3317,17 +5135,30 @@ "resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3337,7 +5168,6 @@ "resolved": "https://registry.npmmirror.com/event-pubsub/-/event-pubsub-4.3.0.tgz", "integrity": "sha512-z7IyloorXvKbFx9Bpie2+vMJKKx1fH1EN5yiTfp8CiLOTptSYy1g8H4yDpGlEdshL1PBiFtBHepF2cNsqeEeFQ==", "dev": true, - "license": "Unlicense", "engines": { "node": ">=4.0.0" } @@ -3346,15 +5176,13 @@ "version": "4.0.7", "resolved": "https://registry.npmmirror.com/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmmirror.com/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8.x" } @@ -3364,7 +5192,6 @@ "resolved": "https://registry.npmmirror.com/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, - "license": "MIT", "dependencies": { "cross-spawn": "^6.0.0", "get-stream": "^4.0.0", @@ -3378,12 +5205,78 @@ "node": ">=6" } }, + "node_modules/execa/node_modules/cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/execa/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/execa/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmmirror.com/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/express": { "version": "4.21.2", "resolved": "https://registry.npmmirror.com/express/-/express-4.21.2.tgz", "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "dev": true, - "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -3430,7 +5323,6 @@ "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -3439,15 +5331,13 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/express/node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmmirror.com/qs/-/qs-6.13.0.tgz", "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.6" }, @@ -3461,8 +5351,7 @@ "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmmirror.com/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "license": "MIT" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "node_modules/extsprintf": { "version": "1.3.0", @@ -3470,21 +5359,18 @@ "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "engines": [ "node >=0.6.0" - ], - "license": "MIT" + ] }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -3501,7 +5387,6 @@ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -3512,8 +5397,7 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "license": "MIT" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/fast-uri": { "version": "3.0.6", @@ -3529,15 +5413,13 @@ "type": "opencollective", "url": "https://opencollective.com/fastify" } - ], - "license": "BSD-3-Clause" + ] }, "node_modules/fastq": { "version": "1.19.1", "resolved": "https://registry.npmmirror.com/fastq/-/fastq-1.19.1.tgz", "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, - "license": "ISC", "dependencies": { "reusify": "^1.0.4" } @@ -3547,7 +5429,6 @@ "resolved": "https://registry.npmmirror.com/faye-websocket/-/faye-websocket-0.11.4.tgz", "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", "dev": true, - "license": "Apache-2.0", "dependencies": { "websocket-driver": ">=0.5.1" }, @@ -3560,7 +5441,6 @@ "resolved": "https://registry.npmmirror.com/figures/-/figures-2.0.0.tgz", "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", "dev": true, - "license": "MIT", "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -3568,12 +5448,41 @@ "node": ">=4" } }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, - "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -3586,7 +5495,6 @@ "resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-1.3.1.tgz", "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dev": true, - "license": "MIT", "dependencies": { "debug": "2.6.9", "encodeurl": "~2.0.0", @@ -3605,7 +5513,6 @@ "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -3614,15 +5521,13 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmmirror.com/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, - "license": "MIT", "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -3636,7 +5541,6 @@ "resolved": "https://registry.npmmirror.com/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, - "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } @@ -3645,7 +5549,6 @@ "version": "0.6.14", "resolved": "https://registry.npmmirror.com/flyio/-/flyio-0.6.14.tgz", "integrity": "sha512-RE2OXE1ZZmcXOKb0jCtGyquHDxpAqHg17CZ8lmQKRfl3x1kP+NBpaQDx4WgN7DNpLJjFnspTzTEQpwRGg6/xaA==", - "license": "MIT", "dependencies": { "request": "^2.85.0" } @@ -3660,7 +5563,6 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], - "license": "MIT", "engines": { "node": ">=4.0" }, @@ -3670,11 +5572,25 @@ } } }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmmirror.com/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "license": "Apache-2.0", "engines": { "node": "*" } @@ -3683,7 +5599,6 @@ "version": "4.0.2", "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz", "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", - "license": "MIT", "peer": true, "dependencies": { "asynckit": "^0.4.0", @@ -3700,7 +5615,6 @@ "resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3710,7 +5624,6 @@ "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.3.7.tgz", "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", "dev": true, - "license": "MIT", "engines": { "node": "*" }, @@ -3724,7 +5637,6 @@ "resolved": "https://registry.npmmirror.com/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3734,7 +5646,6 @@ "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz", "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, - "license": "MIT", "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -3749,15 +5660,13 @@ "version": "1.0.6", "resolved": "https://registry.npmmirror.com/fs-monkey/-/fs-monkey-1.0.6.tgz", "integrity": "sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg==", - "dev": true, - "license": "Unlicense" + "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -3765,7 +5674,6 @@ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, - "license": "MIT", "optional": true, "os": [ "darwin" @@ -3778,17 +5686,53 @@ "version": "1.1.2", "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmmirror.com/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmmirror.com/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, - "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -3797,7 +5741,6 @@ "version": "1.3.0", "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", @@ -3817,11 +5760,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-own-enumerable-property-symbols": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", + "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==", + "dev": true + }, "node_modules/get-proto": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz", "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" @@ -3835,7 +5783,6 @@ "resolved": "https://registry.npmmirror.com/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, - "license": "MIT", "dependencies": { "pump": "^3.0.0" }, @@ -3843,11 +5790,27 @@ "node": ">=6" } }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmmirror.com/getpass/-/getpass-0.1.7.tgz", "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" } @@ -3858,7 +5821,6 @@ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3879,7 +5841,6 @@ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, - "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, @@ -3891,15 +5852,38 @@ "version": "0.4.1", "resolved": "https://registry.npmmirror.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmmirror.com/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "license": "BSD-2-Clause" + "engines": { + "node": ">=4" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmmirror.com/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, - "license": "MIT", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -3919,7 +5903,6 @@ "version": "1.2.0", "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -3931,15 +5914,13 @@ "version": "4.2.11", "resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/gzip-size": { "version": "6.0.0", "resolved": "https://registry.npmmirror.com/gzip-size/-/gzip-size-6.0.0.tgz", "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", "dev": true, - "license": "MIT", "dependencies": { "duplexer": "^0.1.2" }, @@ -3954,14 +5935,12 @@ "version": "2.0.1", "resolved": "https://registry.npmmirror.com/handle-thing/-/handle-thing-2.0.1.tgz", "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/har-schema": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/har-schema/-/har-schema-2.0.0.tgz", "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "license": "ISC", "engines": { "node": ">=4" } @@ -3971,7 +5950,6 @@ "resolved": "https://registry.npmmirror.com/har-validator/-/har-validator-5.1.5.tgz", "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", "deprecated": "this library is no longer supported", - "license": "MIT", "dependencies": { "ajv": "^6.12.3", "har-schema": "^2.0.0" @@ -3980,21 +5958,58 @@ "node": ">=6" } }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -4006,8 +6021,6 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "license": "MIT", - "peer": true, "dependencies": { "has-symbols": "^1.0.3" }, @@ -4022,14 +6035,12 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-2.0.0.tgz", "integrity": "sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -4042,7 +6053,6 @@ "resolved": "https://registry.npmmirror.com/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true, - "license": "MIT", "bin": { "he": "bin/he" } @@ -4052,7 +6062,6 @@ "resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-10.7.3.tgz", "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", "dev": true, - "license": "BSD-3-Clause", "engines": { "node": "*" } @@ -4061,15 +6070,13 @@ "version": "2.8.9", "resolved": "https://registry.npmmirror.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmmirror.com/hpack.js/-/hpack.js-2.1.6.tgz", "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", "dev": true, - "license": "MIT", "dependencies": { "inherits": "^2.0.1", "obuf": "^1.0.0", @@ -4082,7 +6089,6 @@ "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, - "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -4097,23 +6103,21 @@ "version": "5.1.2", "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/hpack.js/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, - "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/html-entities": { - "version": "2.5.2", - "resolved": "https://registry.npmmirror.com/html-entities/-/html-entities-2.5.2.tgz", - "integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==", + "version": "2.6.0", + "resolved": "https://registry.npmmirror.com/html-entities/-/html-entities-2.6.0.tgz", + "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==", "dev": true, "funding": [ { @@ -4124,22 +6128,19 @@ "type": "patreon", "url": "https://patreon.com/mdevils" } - ], - "license": "MIT" + ] }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/html-minifier-terser": { "version": "6.1.0", "resolved": "https://registry.npmmirror.com/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", "integrity": "sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==", "dev": true, - "license": "MIT", "dependencies": { "camel-case": "^4.1.2", "clean-css": "^5.2.2", @@ -4161,7 +6162,6 @@ "resolved": "https://registry.npmmirror.com/html-webpack-plugin/-/html-webpack-plugin-5.6.3.tgz", "integrity": "sha512-QSf1yjtSAsmf7rYBV7XX86uua4W/vkhIt0xNXKbsi2foEeW7vjJQz4bhnpL3xH+l1ryl1680uNv968Z+X6jSYg==", "dev": true, - "license": "MIT", "dependencies": { "@types/html-minifier-terser": "^6.0.0", "html-minifier-terser": "^6.0.2", @@ -4201,7 +6201,6 @@ "url": "https://github.com/sponsors/fb55" } ], - "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.0.0", @@ -4213,15 +6212,13 @@ "version": "1.2.7", "resolved": "https://registry.npmmirror.com/http-deceiver/-/http-deceiver-1.2.7.tgz", "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.0.tgz", "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "dev": true, - "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -4237,15 +6234,13 @@ "version": "0.5.9", "resolved": "https://registry.npmmirror.com/http-parser-js/-/http-parser-js-0.5.9.tgz", "integrity": "sha512-n1XsPy3rXVxlqxVioEWdC+0+M+SQw0DpJynwtOPo1X+ZlvdzTLtDBIJJlDQTnwZIFJrZSzSGmIOUdP8tu+SgLw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/http-proxy": { "version": "1.18.1", "resolved": "https://registry.npmmirror.com/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, - "license": "MIT", "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -4260,7 +6255,6 @@ "resolved": "https://registry.npmmirror.com/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", "integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", "dev": true, - "license": "MIT", "dependencies": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", @@ -4284,7 +6278,6 @@ "version": "1.2.0", "resolved": "https://registry.npmmirror.com/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -4300,7 +6293,6 @@ "resolved": "https://registry.npmmirror.com/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, - "license": "Apache-2.0", "engines": { "node": ">=10.17.0" } @@ -4310,7 +6302,6 @@ "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, - "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -4323,7 +6314,6 @@ "resolved": "https://registry.npmmirror.com/icss-utils/-/icss-utils-5.1.0.tgz", "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", "dev": true, - "license": "ISC", "engines": { "node": "^10 || ^12 || >= 14" }, @@ -4331,6 +6321,12 @@ "postcss": "^8.1.0" } }, + "node_modules/idb": { + "version": "7.1.1", + "resolved": "https://registry.npmmirror.com/idb/-/idb-7.1.1.tgz", + "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==", + "dev": true + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz", @@ -4349,32 +6345,28 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" + ] }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmmirror.com/ignore/-/ignore-5.3.2.tgz", "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, - "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/immutable": { - "version": "5.0.3", - "resolved": "https://registry.npmmirror.com/immutable/-/immutable-5.0.3.tgz", - "integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==", - "dev": true, - "license": "MIT" + "version": "5.1.1", + "resolved": "https://registry.npmmirror.com/immutable/-/immutable-5.1.1.tgz", + "integrity": "sha512-3jatXi9ObIsPGr3N5hGw/vWWcTkq6hUYhpQz4k0wLC+owqWi/LiugIw9x0EdNZ2yGedKN/HzePiBvaJRXa0Ujg==", + "dev": true }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmmirror.com/import-fresh/-/import-fresh-3.3.1.tgz", "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, - "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -4392,7 +6384,6 @@ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, - "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -4402,32 +6393,93 @@ "version": "2.0.4", "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", "dev": true, - "license": "ISC" + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/ipaddr.js": { "version": "2.2.0", "resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-2.2.0.tgz", "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10" } }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", "dev": true, - "license": "MIT" + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, - "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, @@ -4435,12 +6487,39 @@ "node": ">=8" } }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmmirror.com/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-core-module": { "version": "2.16.1", "resolved": "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, - "license": "MIT", "dependencies": { "hasown": "^2.0.2" }, @@ -4451,12 +6530,44 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-docker": { "version": "2.2.1", "resolved": "https://registry.npmmirror.com/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, - "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -4472,7 +6583,6 @@ "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4482,27 +6592,57 @@ "resolved": "https://registry.npmmirror.com/is-file-esm/-/is-file-esm-1.0.0.tgz", "integrity": "sha512-rZlaNKb4Mr8WlRu2A9XdeoKgnO5aA53XdPHgCKVyCrQ/rWi89RET1+bq37Ru46obaQXeiX4vmFIm1vks41hoSA==", "dev": true, - "license": "MIT", "dependencies": { "read-pkg-up": "^7.0.1" } }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/is-generator-function": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -4515,27 +6655,67 @@ "resolved": "https://registry.npmmirror.com/is-interactive/-/is-interactive-1.0.0.tgz", "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-plain-obj": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz", "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -4548,7 +6728,6 @@ "resolved": "https://registry.npmmirror.com/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, - "license": "MIT", "dependencies": { "isobject": "^3.0.1" }, @@ -4556,28 +6735,127 @@ "node": ">=0.10.0" } }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmmirror.com/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "license": "MIT" + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmmirror.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -4585,12 +6863,54 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmmirror.com/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, - "license": "MIT", "dependencies": { "is-docker": "^2.0.0" }, @@ -4602,22 +6922,18 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/isobject": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/isobject/-/isobject-3.0.1.tgz", "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4625,22 +6941,53 @@ "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmmirror.com/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "license": "MIT" + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmmirror.com/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jake/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } }, "node_modules/javascript-stringify": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz", "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmmirror.com/jest-worker/-/jest-worker-27.5.1.tgz", "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -4655,7 +7002,6 @@ "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -4671,7 +7017,6 @@ "resolved": "https://registry.npmmirror.com/joi/-/joi-17.13.3.tgz", "integrity": "sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "@hapi/hoek": "^9.3.0", "@hapi/topo": "^5.1.0", @@ -4685,7 +7030,6 @@ "resolved": "https://registry.npmmirror.com/js-message/-/js-message-1.0.7.tgz", "integrity": "sha512-efJLHhLjIyKRewNS9EGZ4UpI8NguuL6fKkhRxVuMmrGV2xN/0APGdQYwLFky5w9naebSZ0OwAGp0G6/2Cg90rA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.6.0" } @@ -4694,58 +7038,62 @@ "version": "4.0.0", "resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmmirror.com/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "license": "MIT" + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "license": "(AFL-2.1 OR BSD-3-Clause)" + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "license": "MIT" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmmirror.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "license": "ISC" + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, "node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "version": "2.2.3", + "resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.0" - }, "bin": { "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" } }, "node_modules/jsonfile": { @@ -4753,7 +7101,6 @@ "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, - "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -4761,11 +7108,19 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonpointer": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/jsonpointer/-/jsonpointer-5.0.1.tgz", + "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/jsprim": { "version": "1.4.2", "resolved": "https://registry.npmmirror.com/jsprim/-/jsprim-1.4.2.tgz", "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "license": "MIT", "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -4781,7 +7136,6 @@ "resolved": "https://registry.npmmirror.com/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4791,7 +7145,6 @@ "resolved": "https://registry.npmmirror.com/klona/-/klona-2.0.6.tgz", "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 8" } @@ -4801,7 +7154,6 @@ "resolved": "https://registry.npmmirror.com/launch-editor/-/launch-editor-2.10.0.tgz", "integrity": "sha512-D7dBRJo/qcGX9xlvt/6wUYzQxjh5G1RvZPgPv8vi4KRU99DVQL/oW7tnVOCCTm2HGeo3C5HvGE5Yrh6UBoZ0vA==", "dev": true, - "license": "MIT", "dependencies": { "picocolors": "^1.0.0", "shell-quote": "^1.8.1" @@ -4812,17 +7164,24 @@ "resolved": "https://registry.npmmirror.com/launch-editor-middleware/-/launch-editor-middleware-2.10.0.tgz", "integrity": "sha512-RzZu7MeVlE3p1H6Sadc2BhuDGAj7bkeDCBpNq/zSENP4ohJGhso00k5+iYaRwKshIpiOAhMmimce+5D389xmSg==", "dev": true, - "license": "MIT", "dependencies": { "launch-editor": "^2.10.0" } }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-2.1.0.tgz", "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" } @@ -4831,15 +7190,13 @@ "version": "1.2.4", "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz", "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.11.5" } @@ -4849,7 +7206,6 @@ "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz", "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", "dev": true, - "license": "MIT", "dependencies": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -4859,12 +7215,23 @@ "node": ">=4.0.0" } }, + "node_modules/loader-utils/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmmirror.com/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, - "license": "MIT", "dependencies": { "p-locate": "^4.1.0" }, @@ -4876,43 +7243,49 @@ "version": "4.17.21", "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "license": "MIT" + "dev": true + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmmirror.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true }, "node_modules/lodash.defaultsdeep": { "version": "4.6.1", "resolved": "https://registry.npmmirror.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/lodash.mapvalues": { "version": "4.6.0", "resolved": "https://registry.npmmirror.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz", "integrity": "sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmmirror.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true, - "license": "MIT" + "dev": true + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmmirror.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmmirror.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmmirror.com/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -4929,7 +7302,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4946,7 +7318,6 @@ "resolved": "https://registry.npmmirror.com/log-update/-/log-update-2.3.0.tgz", "integrity": "sha512-vlP11XfFGyeNQlmEn9tJ66rEW1coA/79m5z6BCkudjbAGE83uhAcGYrBFwfs3AdLiLzGRusRPAbSPK9xZteCmg==", "dev": true, - "license": "MIT", "dependencies": { "ansi-escapes": "^3.0.0", "cli-cursor": "^2.0.0", @@ -4961,7 +7332,6 @@ "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-3.0.1.tgz", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -4971,7 +7341,6 @@ "resolved": "https://registry.npmmirror.com/cli-cursor/-/cli-cursor-2.1.0.tgz", "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", "dev": true, - "license": "MIT", "dependencies": { "restore-cursor": "^2.0.0" }, @@ -4984,7 +7353,6 @@ "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -4994,7 +7362,6 @@ "resolved": "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-1.2.0.tgz", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -5004,7 +7371,6 @@ "resolved": "https://registry.npmmirror.com/onetime/-/onetime-2.0.1.tgz", "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", "dev": true, - "license": "MIT", "dependencies": { "mimic-fn": "^1.0.0" }, @@ -5017,7 +7383,6 @@ "resolved": "https://registry.npmmirror.com/restore-cursor/-/restore-cursor-2.0.0.tgz", "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", "dev": true, - "license": "MIT", "dependencies": { "onetime": "^2.0.0", "signal-exit": "^3.0.2" @@ -5031,7 +7396,6 @@ "resolved": "https://registry.npmmirror.com/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, - "license": "MIT", "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -5045,7 +7409,6 @@ "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", "dev": true, - "license": "MIT", "dependencies": { "ansi-regex": "^3.0.0" }, @@ -5058,7 +7421,6 @@ "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz", "integrity": "sha512-iXR3tDXpbnTpzjKSylUJRkLuOrEC7hwEB221cgn6wtF8wpmz28puFXAEfPT5zrjM3wahygB//VuWEr1vTkDcNQ==", "dev": true, - "license": "MIT", "dependencies": { "string-width": "^2.1.1", "strip-ansi": "^4.0.0" @@ -5072,7 +7434,6 @@ "resolved": "https://registry.npmmirror.com/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", "dev": true, - "license": "MIT", "dependencies": { "tslib": "^2.0.3" } @@ -5082,16 +7443,23 @@ "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, - "license": "ISC", "dependencies": { "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", "engines": { "node": ">= 0.4" } @@ -5100,15 +7468,13 @@ "version": "2.0.14", "resolved": "https://registry.npmmirror.com/mdn-data/-/mdn-data-2.0.14.tgz", "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true, - "license": "CC0-1.0" + "dev": true }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5118,7 +7484,6 @@ "resolved": "https://registry.npmmirror.com/memfs/-/memfs-3.5.3.tgz", "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", "dev": true, - "license": "Unlicense", "dependencies": { "fs-monkey": "^1.0.4" }, @@ -5131,7 +7496,6 @@ "resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz", "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "dev": true, - "license": "MIT", "funding": { "url": "https://github.com/sponsors/sindresorhus" } @@ -5141,7 +7505,6 @@ "resolved": "https://registry.npmmirror.com/merge-source-map/-/merge-source-map-1.1.0.tgz", "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", "dev": true, - "license": "MIT", "dependencies": { "source-map": "^0.6.1" } @@ -5150,15 +7513,13 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmmirror.com/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 8" } @@ -5168,7 +7529,6 @@ "resolved": "https://registry.npmmirror.com/methods/-/methods-1.1.2.tgz", "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5178,7 +7538,6 @@ "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, - "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -5192,7 +7551,6 @@ "resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, - "license": "MIT", "bin": { "mime": "cli.js" }, @@ -5204,7 +7562,6 @@ "version": "1.52.0", "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5213,7 +7570,6 @@ "version": "2.1.35", "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -5226,7 +7582,6 @@ "resolved": "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -5236,7 +7591,6 @@ "resolved": "https://registry.npmmirror.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.2.tgz", "integrity": "sha512-GJuACcS//jtq4kCtd5ii/M0SZf7OZRH+BxdqXZHaJfb8TJiVl+NgQRPwiYt2EuqeSkNydn/7vP+bcE27C5mb9w==", "dev": true, - "license": "MIT", "dependencies": { "schema-utils": "^4.0.0", "tapable": "^2.2.1" @@ -5252,76 +7606,17 @@ "webpack": "^5.0.0" } }, - "node_modules/mini-css-extract-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5334,7 +7629,6 @@ "resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, - "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5344,7 +7638,6 @@ "resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, - "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -5356,35 +7649,19 @@ "version": "4.0.0", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } + "dev": true }, "node_modules/module-alias": { "version": "2.2.3", "resolved": "https://registry.npmmirror.com/module-alias/-/module-alias-2.2.3.tgz", "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/mrmime": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-2.0.1.tgz", "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" } @@ -5393,15 +7670,13 @@ "version": "2.1.3", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/multicast-dns": { "version": "7.2.5", "resolved": "https://registry.npmmirror.com/multicast-dns/-/multicast-dns-7.2.5.tgz", "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", "dev": true, - "license": "MIT", "dependencies": { "dns-packet": "^5.2.2", "thunky": "^1.0.2" @@ -5415,7 +7690,6 @@ "resolved": "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz", "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", "dev": true, - "license": "MIT", "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", @@ -5423,16 +7697,15 @@ } }, "node_modules/nanoid": { - "version": "3.3.9", - "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.9.tgz", - "integrity": "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==", + "version": "3.3.11", + "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -5445,7 +7718,6 @@ "resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.4.tgz", "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5454,22 +7726,19 @@ "version": "2.6.2", "resolved": "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmmirror.com/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmmirror.com/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", "dev": true, - "license": "MIT", "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" @@ -5480,7 +7749,6 @@ "resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-7.1.1.tgz", "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "dev": true, - "license": "MIT", "optional": true }, "node_modules/node-fetch": { @@ -5488,7 +7756,6 @@ "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, - "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -5509,7 +7776,6 @@ "resolved": "https://registry.npmmirror.com/node-forge/-/node-forge-1.3.1.tgz", "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", "dev": true, - "license": "(BSD-3-Clause OR GPL-2.0)", "engines": { "node": ">= 6.13.0" } @@ -5518,15 +7784,13 @@ "version": "2.0.19", "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.19.tgz", "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmmirror.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -5539,7 +7803,6 @@ "resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver" } @@ -5549,7 +7812,6 @@ "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5559,7 +7821,6 @@ "resolved": "https://registry.npmmirror.com/normalize-range/-/normalize-range-0.1.2.tgz", "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5569,7 +7830,6 @@ "resolved": "https://registry.npmmirror.com/normalize-url/-/normalize-url-6.1.0.tgz", "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -5580,21 +7840,18 @@ "node_modules/normalize-wheel": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/normalize-wheel/-/normalize-wheel-1.0.1.tgz", - "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==", - "license": "BSD-3-Clause" + "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==" }, "node_modules/normalize.css": { "version": "8.0.1", "resolved": "https://registry.npmmirror.com/normalize.css/-/normalize.css-8.0.1.tgz", - "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==", - "license": "MIT" + "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==" }, "node_modules/npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", "dev": true, - "license": "MIT", "dependencies": { "path-key": "^2.0.0" }, @@ -5602,12 +7859,20 @@ "node": ">=4" } }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz", "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0" }, @@ -5619,7 +7884,6 @@ "version": "0.9.0", "resolved": "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "license": "Apache-2.0", "engines": { "node": "*" } @@ -5629,7 +7893,6 @@ "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5639,7 +7902,35 @@ "resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz", "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "dev": true, - "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmmirror.com/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, "engines": { "node": ">= 0.4" }, @@ -5651,15 +7942,13 @@ "version": "1.1.2", "resolved": "https://registry.npmmirror.com/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, - "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, @@ -5672,7 +7961,6 @@ "resolved": "https://registry.npmmirror.com/on-headers/-/on-headers-1.0.2.tgz", "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -5682,7 +7970,6 @@ "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, - "license": "ISC", "dependencies": { "wrappy": "1" } @@ -5692,7 +7979,6 @@ "resolved": "https://registry.npmmirror.com/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, - "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -5708,7 +7994,6 @@ "resolved": "https://registry.npmmirror.com/open/-/open-8.4.2.tgz", "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", "dev": true, - "license": "MIT", "dependencies": { "define-lazy-prop": "^2.0.0", "is-docker": "^2.1.1", @@ -5726,17 +8011,32 @@ "resolved": "https://registry.npmmirror.com/opener/-/opener-1.5.2.tgz", "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", "dev": true, - "license": "(WTFPL OR MIT)", "bin": { "opener": "bin/opener-bin.js" } }, + "node_modules/opus-decoder": { + "version": "0.7.7", + "resolved": "https://registry.npmmirror.com/opus-decoder/-/opus-decoder-0.7.7.tgz", + "integrity": "sha512-KWDyCi/9aXnNN+jrjs+aaVdwiwzDdac81S9ul0iv1CTs4+5K4VDZKuJjIImrYOBA2oSNHDjVq4xzn6BE+XbI1A==", + "dependencies": { + "@wasm-audio-decoders/common": "9.0.5" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } + }, + "node_modules/opus-recorder": { + "version": "8.0.5", + "resolved": "https://registry.npmmirror.com/opus-recorder/-/opus-recorder-8.0.5.tgz", + "integrity": "sha512-tBRXc9Btds7i3bVfA7d5rekAlyOcfsivt5vSIXHxRV1Oa+s6iXFW8omZ0Lm3ABWotVcEyKt96iIIUcgbV07YOw==" + }, "node_modules/ora": { "version": "5.4.1", "resolved": "https://registry.npmmirror.com/ora/-/ora-5.4.1.tgz", "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dev": true, - "license": "MIT", "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", @@ -5760,7 +8060,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5772,12 +8071,28 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -5787,7 +8102,6 @@ "resolved": "https://registry.npmmirror.com/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, - "license": "MIT", "dependencies": { "p-try": "^2.0.0" }, @@ -5803,7 +8117,6 @@ "resolved": "https://registry.npmmirror.com/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, - "license": "MIT", "dependencies": { "p-limit": "^2.2.0" }, @@ -5816,7 +8129,6 @@ "resolved": "https://registry.npmmirror.com/p-retry/-/p-retry-4.6.2.tgz", "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", "dev": true, - "license": "MIT", "dependencies": { "@types/retry": "0.12.0", "retry": "^0.13.1" @@ -5830,7 +8142,6 @@ "resolved": "https://registry.npmmirror.com/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -5840,7 +8151,6 @@ "resolved": "https://registry.npmmirror.com/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", "dev": true, - "license": "MIT", "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -5851,7 +8161,6 @@ "resolved": "https://registry.npmmirror.com/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -5864,7 +8173,6 @@ "resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, - "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -5882,15 +8190,13 @@ "version": "5.1.1", "resolved": "https://registry.npmmirror.com/parse5/-/parse5-5.1.1.tgz", "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/parse5-htmlparser2-tree-adapter": { "version": "6.0.1", "resolved": "https://registry.npmmirror.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", "dev": true, - "license": "MIT", "dependencies": { "parse5": "^6.0.1" } @@ -5899,15 +8205,13 @@ "version": "6.0.1", "resolved": "https://registry.npmmirror.com/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -5917,7 +8221,6 @@ "resolved": "https://registry.npmmirror.com/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", "dev": true, - "license": "MIT", "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -5928,7 +8231,6 @@ "resolved": "https://registry.npmmirror.com/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -5938,41 +8240,35 @@ "resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmmirror.com/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "dev": true, - "license": "MIT", + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/path-to-regexp": { "version": "0.1.12", "resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz", "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -5980,21 +8276,18 @@ "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "license": "MIT" + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, - "license": "MIT", "engines": { "node": ">=8.6" }, @@ -6003,28 +8296,25 @@ } }, "node_modules/portfinder": { - "version": "1.0.33", - "resolved": "https://registry.npmmirror.com/portfinder/-/portfinder-1.0.33.tgz", - "integrity": "sha512-+2jndHT63cL5MdQOwDm9OT2dIe11zVpjV+0GGRXdtO1wpPxv260NfVqoEXtYAi/shanmm3W4+yLduIe55ektTw==", + "version": "1.0.35", + "resolved": "https://registry.npmmirror.com/portfinder/-/portfinder-1.0.35.tgz", + "integrity": "sha512-73JaFg4NwYNAufDtS5FsFu/PdM49ahJrO1i44aCRsDWju1z5wuGDaqyFUQWR6aJoK2JPDWlaYYAGFNIGTSUHSw==", "dev": true, - "license": "MIT", "dependencies": { - "async": "^2.6.4", - "debug": "^3.2.7", - "mkdirp": "^0.5.6" + "async": "^3.2.6", + "debug": "^4.3.6" }, "engines": { - "node": ">= 0.12.0" + "node": ">= 10.12" } }, - "node_modules/portfinder/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" + "engines": { + "node": ">= 0.4" } }, "node_modules/postcss": { @@ -6045,7 +8335,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", @@ -6060,7 +8349,6 @@ "resolved": "https://registry.npmmirror.com/postcss-calc/-/postcss-calc-8.2.4.tgz", "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", "dev": true, - "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.0.9", "postcss-value-parser": "^4.2.0" @@ -6074,7 +8362,6 @@ "resolved": "https://registry.npmmirror.com/postcss-colormin/-/postcss-colormin-5.3.1.tgz", "integrity": "sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "caniuse-api": "^3.0.0", @@ -6093,7 +8380,6 @@ "resolved": "https://registry.npmmirror.com/postcss-convert-values/-/postcss-convert-values-5.1.3.tgz", "integrity": "sha512-82pC1xkJZtcJEfiLw6UXnXVXScgtBrjlO5CBmuDQc+dlb88ZYheFsjTn40+zBVi3DkfF7iezO0nJUPLcJK3pvA==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "postcss-value-parser": "^4.2.0" @@ -6110,7 +8396,6 @@ "resolved": "https://registry.npmmirror.com/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -6123,7 +8408,6 @@ "resolved": "https://registry.npmmirror.com/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -6136,7 +8420,6 @@ "resolved": "https://registry.npmmirror.com/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -6149,7 +8432,6 @@ "resolved": "https://registry.npmmirror.com/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -6162,7 +8444,6 @@ "resolved": "https://registry.npmmirror.com/postcss-loader/-/postcss-loader-6.2.1.tgz", "integrity": "sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==", "dev": true, - "license": "MIT", "dependencies": { "cosmiconfig": "^7.0.0", "klona": "^2.0.5", @@ -6185,7 +8466,6 @@ "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -6198,7 +8478,6 @@ "resolved": "https://registry.npmmirror.com/postcss-merge-longhand/-/postcss-merge-longhand-5.1.7.tgz", "integrity": "sha512-YCI9gZB+PLNskrK0BB3/2OzPnGhPkBEwmwhfYk1ilBHYVAZB7/tkTHFBAnCrvBBOmeYyMYw3DMjT55SyxMBzjQ==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0", "stylehacks": "^5.1.1" @@ -6215,7 +8494,6 @@ "resolved": "https://registry.npmmirror.com/postcss-merge-rules/-/postcss-merge-rules-5.1.4.tgz", "integrity": "sha512-0R2IuYpgU93y9lhVbO/OylTtKMVcHb67zjWIfCiKR9rWL3GUk1677LAqD/BcHizukdZEjT8Ru3oHRoAYoJy44g==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "caniuse-api": "^3.0.0", @@ -6234,7 +8512,6 @@ "resolved": "https://registry.npmmirror.com/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6250,7 +8527,6 @@ "resolved": "https://registry.npmmirror.com/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", "dev": true, - "license": "MIT", "dependencies": { "colord": "^2.9.1", "cssnano-utils": "^3.1.0", @@ -6268,7 +8544,6 @@ "resolved": "https://registry.npmmirror.com/postcss-minify-params/-/postcss-minify-params-5.1.4.tgz", "integrity": "sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "cssnano-utils": "^3.1.0", @@ -6286,7 +8561,6 @@ "resolved": "https://registry.npmmirror.com/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", "dev": true, - "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.0.5" }, @@ -6302,7 +8576,6 @@ "resolved": "https://registry.npmmirror.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", "dev": true, - "license": "ISC", "engines": { "node": "^10 || ^12 || >= 14" }, @@ -6315,7 +8588,6 @@ "resolved": "https://registry.npmmirror.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.2.0.tgz", "integrity": "sha512-5kcJm/zk+GJDSfw+V/42fJ5fhjL5YbFDl8nVdXkJPLLW+Vf9mTD5Xe0wqIaDnLuL2U6cDNpTr+UQ+v2HWIBhzw==", "dev": true, - "license": "MIT", "dependencies": { "icss-utils": "^5.0.0", "postcss-selector-parser": "^7.0.0", @@ -6333,7 +8605,6 @@ "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, - "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -6347,7 +8618,6 @@ "resolved": "https://registry.npmmirror.com/postcss-modules-scope/-/postcss-modules-scope-3.2.1.tgz", "integrity": "sha512-m9jZstCVaqGjTAuny8MdgE88scJnCiQSlSrOWcTQgM2t32UBe+MUmFSO5t7VMSfAf/FJKImAxBav8ooCHJXCJA==", "dev": true, - "license": "ISC", "dependencies": { "postcss-selector-parser": "^7.0.0" }, @@ -6363,7 +8633,6 @@ "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, - "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -6377,7 +8646,6 @@ "resolved": "https://registry.npmmirror.com/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", "dev": true, - "license": "ISC", "dependencies": { "icss-utils": "^5.0.0" }, @@ -6393,7 +8661,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", "dev": true, - "license": "MIT", "engines": { "node": "^10 || ^12 || >=14.0" }, @@ -6406,7 +8673,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6422,7 +8688,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-positions/-/postcss-normalize-positions-5.1.1.tgz", "integrity": "sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6438,7 +8703,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz", "integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6454,7 +8718,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6470,7 +8733,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6486,7 +8748,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.1.tgz", "integrity": "sha512-qnCL5jzkNUmKVhZoENp1mJiGNPcsJCs1aaRmURmeJGES23Z/ajaln+EPTD+rBeNkSryI+2WTdW+lwcVdOikrpA==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "postcss-value-parser": "^4.2.0" @@ -6503,7 +8764,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", "dev": true, - "license": "MIT", "dependencies": { "normalize-url": "^6.0.1", "postcss-value-parser": "^4.2.0" @@ -6520,7 +8780,6 @@ "resolved": "https://registry.npmmirror.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6536,7 +8795,6 @@ "resolved": "https://registry.npmmirror.com/postcss-ordered-values/-/postcss-ordered-values-5.1.3.tgz", "integrity": "sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==", "dev": true, - "license": "MIT", "dependencies": { "cssnano-utils": "^3.1.0", "postcss-value-parser": "^4.2.0" @@ -6553,7 +8811,6 @@ "resolved": "https://registry.npmmirror.com/postcss-reduce-initial/-/postcss-reduce-initial-5.1.2.tgz", "integrity": "sha512-dE/y2XRaqAi6OvjzD22pjTUQ8eOfc6m/natGHgKFBK9DxFmIm69YmaRVQrGgFlEfc1HePIurY0TmDeROK05rIg==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "caniuse-api": "^3.0.0" @@ -6570,7 +8827,6 @@ "resolved": "https://registry.npmmirror.com/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -6586,7 +8842,6 @@ "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "dev": true, - "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -6600,7 +8855,6 @@ "resolved": "https://registry.npmmirror.com/postcss-svgo/-/postcss-svgo-5.1.0.tgz", "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", "dev": true, - "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0", "svgo": "^2.7.0" @@ -6617,7 +8871,6 @@ "resolved": "https://registry.npmmirror.com/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", "dev": true, - "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.0.5" }, @@ -6632,14 +8885,12 @@ "version": "4.2.0", "resolved": "https://registry.npmmirror.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/prettier": { "version": "2.8.8", "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.8.tgz", "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "license": "MIT", "optional": true, "bin": { "prettier": "bin-prettier.js" @@ -6651,12 +8902,23 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/pretty-bytes": { + "version": "5.6.0", + "resolved": "https://registry.npmmirror.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz", + "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pretty-error": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/pretty-error/-/pretty-error-4.0.0.tgz", "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", "dev": true, - "license": "MIT", "dependencies": { "lodash": "^4.17.20", "renderkid": "^3.0.0" @@ -6666,15 +8928,13 @@ "version": "2.0.1", "resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/progress-webpack-plugin": { "version": "1.0.16", "resolved": "https://registry.npmmirror.com/progress-webpack-plugin/-/progress-webpack-plugin-1.0.16.tgz", "integrity": "sha512-sdiHuuKOzELcBANHfrupYo+r99iPRyOnw15qX+rNlVUqXGfjXdH4IgxriKwG1kNJwVswKQHMdj1hYZMcb9jFaA==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^2.1.0", "figures": "^2.0.0", @@ -6692,7 +8952,6 @@ "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -6705,7 +8964,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -6720,7 +8978,6 @@ "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "1.1.3" } @@ -6729,15 +8986,13 @@ "version": "1.1.3", "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/progress-webpack-plugin/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -6747,7 +9002,6 @@ "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -6760,7 +9014,6 @@ "resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "dev": true, - "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -6774,7 +9027,6 @@ "resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.10" } @@ -6783,21 +9035,18 @@ "version": "1.1.0", "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT", "peer": true }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/psl": { "version": "1.15.0", "resolved": "https://registry.npmmirror.com/psl/-/psl-1.15.0.tgz", "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", - "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, @@ -6810,7 +9059,6 @@ "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.2.tgz", "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", "dev": true, - "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -6820,7 +9068,6 @@ "version": "2.3.1", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "license": "MIT", "engines": { "node": ">=6" } @@ -6829,7 +9076,6 @@ "version": "6.5.3", "resolved": "https://registry.npmmirror.com/qs/-/qs-6.5.3.tgz", "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "license": "BSD-3-Clause", "engines": { "node": ">=0.6" } @@ -6852,15 +9098,13 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, - "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } @@ -6870,7 +9114,6 @@ "resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -6880,7 +9123,6 @@ "resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.2.tgz", "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, - "license": "MIT", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -6896,7 +9138,6 @@ "resolved": "https://registry.npmmirror.com/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, - "license": "MIT", "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", @@ -6912,7 +9153,6 @@ "resolved": "https://registry.npmmirror.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz", "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", "dev": true, - "license": "MIT", "dependencies": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", @@ -6930,7 +9170,6 @@ "resolved": "https://registry.npmmirror.com/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, - "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=8" } @@ -6940,7 +9179,6 @@ "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, - "license": "MIT", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6955,7 +9193,6 @@ "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-4.1.2.tgz", "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 14.18.0" }, @@ -6964,18 +9201,132 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmmirror.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmmirror.com/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.2.0", + "resolved": "https://registry.npmmirror.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "license": "MIT" + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmmirror.com/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmmirror.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpu-core": { + "version": "6.2.0", + "resolved": "https://registry.npmmirror.com/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmmirror.com/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "dev": true + }, + "node_modules/regjsparser": { + "version": "0.12.0", + "resolved": "https://registry.npmmirror.com/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", + "dev": true, + "dependencies": { + "jsesc": "~3.0.2" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } }, "node_modules/relateurl": { "version": "0.2.7", "resolved": "https://registry.npmmirror.com/relateurl/-/relateurl-0.2.7.tgz", "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.10" } @@ -6985,7 +9336,6 @@ "resolved": "https://registry.npmmirror.com/renderkid/-/renderkid-3.0.0.tgz", "integrity": "sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==", "dev": true, - "license": "MIT", "dependencies": { "css-select": "^4.1.3", "dom-converter": "^0.2.0", @@ -6999,7 +9349,6 @@ "resolved": "https://registry.npmmirror.com/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "license": "Apache-2.0", "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -7030,7 +9379,6 @@ "version": "2.3.3", "resolved": "https://registry.npmmirror.com/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -7045,7 +9393,6 @@ "resolved": "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -7055,7 +9402,6 @@ "resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -7064,21 +9410,18 @@ "version": "1.0.0", "resolved": "https://registry.npmmirror.com/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/resize-observer-polyfill": { "version": "1.5.1", "resolved": "https://registry.npmmirror.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", - "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==", - "license": "MIT" + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" }, "node_modules/resolve": { "version": "1.22.10", "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.10.tgz", "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, - "license": "MIT", "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", @@ -7099,7 +9442,6 @@ "resolved": "https://registry.npmmirror.com/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -7109,7 +9451,6 @@ "resolved": "https://registry.npmmirror.com/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, - "license": "MIT", "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -7123,7 +9464,6 @@ "resolved": "https://registry.npmmirror.com/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 4" } @@ -7133,7 +9473,6 @@ "resolved": "https://registry.npmmirror.com/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, - "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -7145,7 +9484,6 @@ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -7156,6 +9494,21 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "2.79.2", + "resolved": "https://registry.npmmirror.com/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz", @@ -7175,11 +9528,35 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmmirror.com/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -7197,21 +9574,57 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.85.1", - "resolved": "https://registry.npmmirror.com/sass/-/sass-1.85.1.tgz", - "integrity": "sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==", + "version": "1.86.0", + "resolved": "https://registry.npmmirror.com/sass/-/sass-1.86.0.tgz", + "integrity": "sha512-zV8vGUld/+mP4KbMLJMX7TyGCuUp7hnkOScgCMsWuHtns8CWBoz+vmEhoGMXsaJrbUP8gj+F1dLvVe79sK8UdA==", "dev": true, - "license": "MIT", "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -7232,7 +9645,6 @@ "resolved": "https://registry.npmmirror.com/sass-loader/-/sass-loader-12.6.0.tgz", "integrity": "sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA==", "dev": true, - "license": "MIT", "dependencies": { "klona": "^2.0.4", "neo-async": "^2.6.2" @@ -7267,15 +9679,15 @@ } }, "node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", + "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", "dev": true, - "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 10.13.0" @@ -7285,19 +9697,51 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/schema-utils/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/select-hose": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/select-hose/-/select-hose-2.0.0.tgz", "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/selfsigned": { "version": "2.4.1", "resolved": "https://registry.npmmirror.com/selfsigned/-/selfsigned-2.4.1.tgz", "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", "dev": true, - "license": "MIT", "dependencies": { "@types/node-forge": "^1.3.0", "node-forge": "^1" @@ -7311,7 +9755,6 @@ "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -7321,7 +9764,6 @@ "resolved": "https://registry.npmmirror.com/send/-/send-0.19.0.tgz", "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dev": true, - "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -7346,7 +9788,6 @@ "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -7355,15 +9796,13 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/send/node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -7373,7 +9812,6 @@ "resolved": "https://registry.npmmirror.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } @@ -7383,7 +9821,6 @@ "resolved": "https://registry.npmmirror.com/serve-index/-/serve-index-1.9.1.tgz", "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", "dev": true, - "license": "MIT", "dependencies": { "accepts": "~1.3.4", "batch": "0.6.1", @@ -7402,7 +9839,6 @@ "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -7412,7 +9848,6 @@ "resolved": "https://registry.npmmirror.com/depd/-/depd-1.1.2.tgz", "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -7422,7 +9857,6 @@ "resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", "dev": true, - "license": "MIT", "dependencies": { "depd": "~1.1.2", "inherits": "2.0.3", @@ -7437,29 +9871,25 @@ "version": "2.0.3", "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.3.tgz", "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/serve-index/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/serve-index/node_modules/setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.1.0.tgz", "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/serve-index/node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmmirror.com/statuses/-/statuses-1.5.0.tgz", "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -7469,7 +9899,6 @@ "resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-1.16.2.tgz", "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dev": true, - "license": "MIT", "dependencies": { "encodeurl": "~2.0.0", "escape-html": "~1.0.3", @@ -7480,19 +9909,63 @@ "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/shallow-clone/-/shallow-clone-3.0.1.tgz", "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", "dev": true, - "license": "MIT", "dependencies": { "kind-of": "^6.0.2" }, @@ -7501,26 +9974,22 @@ } }, "node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dev": true, - "license": "MIT", + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dependencies": { - "shebang-regex": "^1.0.0" + "shebang-regex": "^3.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, "node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "dev": true, - "license": "MIT", + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, "node_modules/shell-quote": { @@ -7528,7 +9997,6 @@ "resolved": "https://registry.npmmirror.com/shell-quote/-/shell-quote-1.8.2.tgz", "integrity": "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -7541,7 +10009,6 @@ "resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz", "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "dev": true, - "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", @@ -7561,7 +10028,6 @@ "resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz", "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", "dev": true, - "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" @@ -7578,7 +10044,6 @@ "resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz", "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", "dev": true, - "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", @@ -7597,7 +10062,6 @@ "resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "dev": true, - "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", @@ -7616,15 +10080,22 @@ "version": "3.0.7", "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" + "dev": true + }, + "node_modules/simple-yenc": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/simple-yenc/-/simple-yenc-1.0.4.tgz", + "integrity": "sha512-5gvxpSd79e9a3V4QDYUqnqxeD4HGlhCakVpb6gMnDD7lexJggSBJRBO5h52y/iJrdXRilX9UCuDaIJhSWm5OWw==", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } }, "node_modules/sirv": { "version": "2.0.4", "resolved": "https://registry.npmmirror.com/sirv/-/sirv-2.0.4.tgz", "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", "dev": true, - "license": "MIT", "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", @@ -7639,17 +10110,21 @@ "resolved": "https://registry.npmmirror.com/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/smob": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true + }, "node_modules/sockjs": { "version": "0.3.24", "resolved": "https://registry.npmmirror.com/sockjs/-/sockjs-0.3.24.tgz", "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", "dev": true, - "license": "MIT", "dependencies": { "faye-websocket": "^0.11.3", "uuid": "^8.3.2", @@ -7661,16 +10136,20 @@ "resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "dev": true, - "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, + "node_modules/source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -7679,7 +10158,6 @@ "version": "1.2.1", "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -7689,18 +10167,23 @@ "resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, - "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", + "dev": true + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmmirror.com/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, - "license": "Apache-2.0", "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -7710,15 +10193,13 @@ "version": "2.5.0", "resolved": "https://registry.npmmirror.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true, - "license": "CC-BY-3.0" + "dev": true }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, - "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -7728,15 +10209,13 @@ "version": "3.0.21", "resolved": "https://registry.npmmirror.com/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", - "dev": true, - "license": "CC0-1.0" + "dev": true }, "node_modules/spdy": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/spdy/-/spdy-4.0.2.tgz", "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^4.1.0", "handle-thing": "^2.0.0", @@ -7753,7 +10232,6 @@ "resolved": "https://registry.npmmirror.com/spdy-transport/-/spdy-transport-3.0.0.tgz", "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^4.1.0", "detect-node": "^2.0.4", @@ -7767,7 +10245,6 @@ "version": "1.18.0", "resolved": "https://registry.npmmirror.com/sshpk/-/sshpk-1.18.0.tgz", "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "license": "MIT", "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -7793,7 +10270,6 @@ "resolved": "https://registry.npmmirror.com/ssri/-/ssri-8.0.1.tgz", "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", "dev": true, - "license": "ISC", "dependencies": { "minipass": "^3.1.1" }, @@ -7806,22 +10282,19 @@ "resolved": "https://registry.npmmirror.com/stable/-/stable-0.1.8.tgz", "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/stackframe": { "version": "1.3.4", "resolved": "https://registry.npmmirror.com/stackframe/-/stackframe-1.3.4.tgz", "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -7831,7 +10304,6 @@ "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, - "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" } @@ -7841,7 +10313,6 @@ "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -7851,12 +10322,108 @@ "node": ">=8" } }, + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmmirror.com/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmmirror.com/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmmirror.com/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "dev": true, + "dependencies": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -7864,12 +10431,20 @@ "node": ">=8" } }, + "node_modules/strip-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/strip-comments/-/strip-comments-2.0.1.tgz", + "integrity": "sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -7879,7 +10454,6 @@ "resolved": "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -7889,7 +10463,6 @@ "resolved": "https://registry.npmmirror.com/stylehacks/-/stylehacks-5.1.1.tgz", "integrity": "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==", "dev": true, - "license": "MIT", "dependencies": { "browserslist": "^4.21.4", "postcss-selector-parser": "^6.0.4" @@ -7906,7 +10479,6 @@ "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -7919,7 +10491,6 @@ "resolved": "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -7932,7 +10503,6 @@ "resolved": "https://registry.npmmirror.com/svgo/-/svgo-2.8.0.tgz", "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", "dev": true, - "license": "MIT", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", @@ -7954,7 +10524,6 @@ "resolved": "https://registry.npmmirror.com/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10" } @@ -7964,17 +10533,66 @@ "resolved": "https://registry.npmmirror.com/tapable/-/tapable-2.2.1.tgz", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/temp-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/temp-dir/-/temp-dir-2.0.0.tgz", + "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tempy": { + "version": "0.6.0", + "resolved": "https://registry.npmmirror.com/tempy/-/tempy-0.6.0.tgz", + "integrity": "sha512-G13vtMYPT/J8A4X2SjdtBTphZlrp1gKv6hZiOjw14RCWg6GbHuQBGtjlx75xLbYV/wEc0D7G5K4rxKP/cXk8Bw==", + "dev": true, + "dependencies": { + "is-stream": "^2.0.0", + "temp-dir": "^2.0.0", + "type-fest": "^0.16.0", + "unique-string": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/type-fest": { + "version": "0.16.0", + "resolved": "https://registry.npmmirror.com/type-fest/-/type-fest-0.16.0.tgz", + "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/terser": { "version": "5.39.0", "resolved": "https://registry.npmmirror.com/terser/-/terser-5.39.0.tgz", "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -7993,7 +10611,6 @@ "resolved": "https://registry.npmmirror.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", "dev": true, - "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", @@ -8023,76 +10640,17 @@ } } }, - "node_modules/terser-webpack-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/terser/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmmirror.com/thenify/-/thenify-3.3.1.tgz", "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, - "license": "MIT", "dependencies": { "any-promise": "^1.0.0" } @@ -8102,7 +10660,6 @@ "resolved": "https://registry.npmmirror.com/thenify-all/-/thenify-all-1.6.0.tgz", "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", "dev": true, - "license": "MIT", "dependencies": { "thenify": ">= 3.1.0 < 4" }, @@ -8115,7 +10672,6 @@ "resolved": "https://registry.npmmirror.com/thread-loader/-/thread-loader-3.0.4.tgz", "integrity": "sha512-ByaL2TPb+m6yArpqQUZvP+5S1mZtXsEP7nWKKlAUTm7fCml8kB5s1uI3+eHRP2bk5mVYfRSBI7FFf+tWEyLZwA==", "dev": true, - "license": "MIT", "dependencies": { "json-parse-better-errors": "^1.0.2", "loader-runner": "^4.1.0", @@ -8134,25 +10690,11 @@ "webpack": "^4.27.0 || ^5.0.0" } }, - "node_modules/thread-loader/node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/thread-loader/node_modules/loader-utils": { "version": "2.0.4", "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.4.tgz", "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, - "license": "MIT", "dependencies": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -8162,11 +10704,28 @@ "node": ">=8.9.0" } }, + "node_modules/thread-loader/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/throttle-debounce": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-1.1.0.tgz", "integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==", - "license": "MIT", "engines": { "node": ">=4" } @@ -8175,15 +10734,13 @@ "version": "1.1.0", "resolved": "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -8196,7 +10753,6 @@ "resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.6" } @@ -8206,7 +10762,6 @@ "resolved": "https://registry.npmmirror.com/totalist/-/totalist-3.0.1.tgz", "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -8215,7 +10770,6 @@ "version": "2.5.0", "resolved": "https://registry.npmmirror.com/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "license": "BSD-3-Clause", "dependencies": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -8228,21 +10782,18 @@ "version": "0.0.3", "resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, - "license": "0BSD" + "dev": true }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmmirror.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "license": "Apache-2.0", "dependencies": { "safe-buffer": "^5.0.1" }, @@ -8253,15 +10804,13 @@ "node_modules/tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmmirror.com/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "license": "Unlicense" + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" }, "node_modules/type-fest": { "version": "0.6.0", "resolved": "https://registry.npmmirror.com/type-fest/-/type-fest-0.6.0.tgz", "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, - "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=8" } @@ -8271,7 +10820,6 @@ "resolved": "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dev": true, - "license": "MIT", "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" @@ -8280,19 +10828,161 @@ "node": ">= 0.6" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/undici-types": { "version": "6.20.0", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.20.0.tgz", "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -8302,11 +10992,20 @@ "resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/upath": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true, + "engines": { + "node": ">=4", + "yarn": "*" + } + }, "node_modules/update-browserslist-db": { "version": "1.1.3", "resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", @@ -8326,7 +11025,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" @@ -8342,7 +11040,6 @@ "version": "4.4.1", "resolved": "https://registry.npmmirror.com/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } @@ -8351,22 +11048,19 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/utila": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/utila/-/utila-0.4.0.tgz", "integrity": "sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.4.0" } @@ -8376,7 +11070,6 @@ "resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "license": "MIT", "bin": { "uuid": "bin/uuid" } @@ -8386,7 +11079,6 @@ "resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, - "license": "Apache-2.0", "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -8397,7 +11089,6 @@ "resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.8" } @@ -8409,7 +11100,6 @@ "engines": [ "node >=0.6.0" ], - "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -8421,7 +11111,6 @@ "resolved": "https://registry.npmmirror.com/vue/-/vue-2.7.16.tgz", "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", - "license": "MIT", "dependencies": { "@vue/compiler-sfc": "2.7.16", "csstype": "^3.1.0" @@ -8431,7 +11120,6 @@ "version": "3.5.2", "resolved": "https://registry.npmmirror.com/vue-axios/-/vue-axios-3.5.2.tgz", "integrity": "sha512-GP+dct7UlAWkl1qoP3ppw0z6jcSua5/IrMpjB5O8bh089iIiJ+hdxPYH2NPEpajlYgkW5EVMP95ttXWdas1O0g==", - "license": "MIT", "peerDependencies": { "axios": "*", "vue": "^3.0.0 || ^2.0.0" @@ -8441,15 +11129,13 @@ "version": "2.3.4", "resolved": "https://registry.npmmirror.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/vue-loader": { "version": "17.4.2", "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-17.4.2.tgz", "integrity": "sha512-yTKOA4R/VN4jqjw4y5HrynFL8AK0Z3/Jt7eOJXEitsm0GMRHDBjCfCiuTiLP7OESvsZYo2pATCWhDqxC5ZrM6w==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^4.1.0", "hash-sum": "^2.0.0", @@ -8472,7 +11158,6 @@ "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8487,15 +11172,13 @@ "node_modules/vue-router": { "version": "3.6.5", "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz", - "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==", - "license": "MIT" + "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmmirror.com/vue-style-loader/-/vue-style-loader-4.1.3.tgz", "integrity": "sha512-sFuh0xfbtpRlKfm39ss/ikqs9AbKCoXZBpHeVZ8Tx650o0k0q/YCM7FRvigtxpACezfq6af+a7JeqVTWvncqDg==", "dev": true, - "license": "MIT", "dependencies": { "hash-sum": "^1.0.2", "loader-utils": "^1.0.2" @@ -8505,15 +11188,13 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz", "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/vue-template-compiler": { "version": "2.7.16", "resolved": "https://registry.npmmirror.com/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz", "integrity": "sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==", "dev": true, - "license": "MIT", "dependencies": { "de-indent": "^1.0.2", "he": "^1.2.0" @@ -8523,14 +11204,12 @@ "version": "1.9.1", "resolved": "https://registry.npmmirror.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz", "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/vuex": { "version": "3.6.2", "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz", "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", - "license": "MIT", "peerDependencies": { "vue": "^2.0.0" } @@ -8540,7 +11219,6 @@ "resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz", "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", "dev": true, - "license": "MIT", "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -8554,7 +11232,6 @@ "resolved": "https://registry.npmmirror.com/wbuf/-/wbuf-1.7.3.tgz", "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", "dev": true, - "license": "MIT", "dependencies": { "minimalistic-assert": "^1.0.0" } @@ -8564,7 +11241,6 @@ "resolved": "https://registry.npmmirror.com/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dev": true, - "license": "MIT", "dependencies": { "defaults": "^1.0.3" } @@ -8573,15 +11249,13 @@ "version": "3.0.1", "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true, - "license": "BSD-2-Clause" + "dev": true }, "node_modules/webpack": { "version": "5.98.0", "resolved": "https://registry.npmmirror.com/webpack/-/webpack-5.98.0.tgz", "integrity": "sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA==", "dev": true, - "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.6", @@ -8628,7 +11302,6 @@ "resolved": "https://registry.npmmirror.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz", "integrity": "sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==", "dev": true, - "license": "MIT", "dependencies": { "@discoveryjs/json-ext": "0.5.7", "acorn": "^8.0.4", @@ -8655,7 +11328,6 @@ "resolved": "https://registry.npmmirror.com/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10" } @@ -8665,7 +11337,6 @@ "resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -8679,7 +11350,6 @@ "integrity": "sha512-7doO/SRtLu8q5WM0s7vPKPWX580qhi0/yBHkOxNkv50f6qB76Zy9o2wRTrrPULqYTvQlVHuvbA8v+G5ayuUDsA==", "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "dev": true, - "license": "MPL-2.0", "dependencies": { "deepmerge": "^1.5.2", "javascript-stringify": "^2.0.1" @@ -8693,7 +11363,6 @@ "resolved": "https://registry.npmmirror.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, - "license": "MIT", "dependencies": { "colorette": "^2.0.10", "memfs": "^3.4.3", @@ -8712,69 +11381,11 @@ "webpack": "^4.0.0 || ^5.0.0" } }, - "node_modules/webpack-dev-middleware/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack-dev-middleware/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/webpack-dev-server": { "version": "4.15.2", "resolved": "https://registry.npmmirror.com/webpack-dev-server/-/webpack-dev-server-4.15.2.tgz", "integrity": "sha512-0XavAZbNJ5sDrCbkpWL8mia0o5WPOd2YGtxrEiZkBK9FjLppIUK2TgxK6qGD2P3hUXTJNNPVibrerKcx5WkR1g==", "dev": true, - "license": "MIT", "dependencies": { "@types/bonjour": "^3.5.9", "@types/connect-history-api-fallback": "^1.3.5", @@ -8829,42 +11440,11 @@ } } }, - "node_modules/webpack-dev-server/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack-dev-server/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, "node_modules/webpack-dev-server/node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, - "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -8889,7 +11469,6 @@ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -8897,19 +11476,11 @@ "node": ">= 6" } }, - "node_modules/webpack-dev-server/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, "node_modules/webpack-dev-server/node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, - "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, @@ -8917,32 +11488,11 @@ "node": ">=8.10.0" } }, - "node_modules/webpack-dev-server/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/webpack-dev-server/node_modules/ws": { "version": "8.18.1", "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz", "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -8964,7 +11514,6 @@ "resolved": "https://registry.npmmirror.com/webpack-merge/-/webpack-merge-5.10.0.tgz", "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", "dev": true, - "license": "MIT", "dependencies": { "clone-deep": "^4.0.1", "flat": "^5.0.2", @@ -8979,7 +11528,6 @@ "resolved": "https://registry.npmmirror.com/webpack-sources/-/webpack-sources-3.2.3.tgz", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.13.0" } @@ -8988,72 +11536,13 @@ "version": "0.4.6", "resolved": "https://registry.npmmirror.com/webpack-virtual-modules/-/webpack-virtual-modules-0.4.6.tgz", "integrity": "sha512-5tyDlKLqPfMqjT3Q9TAqf2YqjwmnUleZwzJi1A5qXnlBCdj2AtOJ6wAWdglTIDOPgOiOrXeBeFcsQ8+aGQ6QbA==", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/webpack/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } + "dev": true }, "node_modules/websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmmirror.com/websocket-driver/-/websocket-driver-0.7.4.tgz", "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", "dev": true, - "license": "Apache-2.0", "dependencies": { "http-parser-js": ">=0.5.1", "safe-buffer": ">=5.1.0", @@ -9068,7 +11557,6 @@ "resolved": "https://registry.npmmirror.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz", "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", "dev": true, - "license": "Apache-2.0", "engines": { "node": ">=0.8.0" } @@ -9077,46 +11565,431 @@ "version": "3.6.20", "resolved": "https://registry.npmmirror.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, - "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmmirror.com/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "license": "ISC", + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dependencies": { "isexe": "^2.0.0" }, "bin": { - "which": "bin/which" + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmmirror.com/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/wildcard": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/wildcard/-/wildcard-2.0.1.tgz", "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true + }, + "node_modules/workbox-background-sync": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-background-sync/-/workbox-background-sync-7.3.0.tgz", + "integrity": "sha512-PCSk3eK7Mxeuyatb22pcSx9dlgWNv3+M8PqPaYDokks8Y5/FX4soaOqj3yhAZr5k6Q5JWTOMYgaJBpbw11G9Eg==", "dev": true, - "license": "MIT" + "dependencies": { + "idb": "^7.0.1", + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-broadcast-update": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-broadcast-update/-/workbox-broadcast-update-7.3.0.tgz", + "integrity": "sha512-T9/F5VEdJVhwmrIAE+E/kq5at2OY6+OXXgOWQevnubal6sO92Gjo24v6dCVwQiclAF5NS3hlmsifRrpQzZCdUA==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-build": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-build/-/workbox-build-7.3.0.tgz", + "integrity": "sha512-JGL6vZTPlxnlqZRhR/K/msqg3wKP+m0wfEUVosK7gsYzSgeIxvZLi1ViJJzVL7CEeI8r7rGFV973RiEqkP3lWQ==", + "dev": true, + "dependencies": { + "@apideck/better-ajv-errors": "^0.3.1", + "@babel/core": "^7.24.4", + "@babel/preset-env": "^7.11.0", + "@babel/runtime": "^7.11.2", + "@rollup/plugin-babel": "^5.2.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-replace": "^2.4.1", + "@rollup/plugin-terser": "^0.4.3", + "@surma/rollup-plugin-off-main-thread": "^2.2.3", + "ajv": "^8.6.0", + "common-tags": "^1.8.0", + "fast-json-stable-stringify": "^2.1.0", + "fs-extra": "^9.0.1", + "glob": "^7.1.6", + "lodash": "^4.17.20", + "pretty-bytes": "^5.3.0", + "rollup": "^2.43.1", + "source-map": "^0.8.0-beta.0", + "stringify-object": "^3.3.0", + "strip-comments": "^2.0.1", + "tempy": "^0.6.0", + "upath": "^1.2.0", + "workbox-background-sync": "7.3.0", + "workbox-broadcast-update": "7.3.0", + "workbox-cacheable-response": "7.3.0", + "workbox-core": "7.3.0", + "workbox-expiration": "7.3.0", + "workbox-google-analytics": "7.3.0", + "workbox-navigation-preload": "7.3.0", + "workbox-precaching": "7.3.0", + "workbox-range-requests": "7.3.0", + "workbox-recipes": "7.3.0", + "workbox-routing": "7.3.0", + "workbox-strategies": "7.3.0", + "workbox-streams": "7.3.0", + "workbox-sw": "7.3.0", + "workbox-window": "7.3.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/workbox-build/node_modules/@apideck/better-ajv-errors": { + "version": "0.3.6", + "resolved": "https://registry.npmmirror.com/@apideck/better-ajv-errors/-/better-ajv-errors-0.3.6.tgz", + "integrity": "sha512-P+ZygBLZtkp0qqOAJJVX4oX/sFo5JR3eBWwwuqHHhK0GIgQOKWrAfiAaWX0aArHkRWHMuggFEgAZNxVPwPZYaA==", + "dev": true, + "dependencies": { + "json-schema": "^0.4.0", + "jsonpointer": "^5.0.0", + "leven": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "ajv": ">=8" + } + }, + "node_modules/workbox-build/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/workbox-build/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/workbox-build/node_modules/source-map": { + "version": "0.8.0-beta.0", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.8.0-beta.0.tgz", + "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", + "dev": true, + "dependencies": { + "whatwg-url": "^7.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/workbox-build/node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/workbox-build/node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "node_modules/workbox-build/node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/workbox-cacheable-response": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-cacheable-response/-/workbox-cacheable-response-7.3.0.tgz", + "integrity": "sha512-eAFERIg6J2LuyELhLlmeRcJFa5e16Mj8kL2yCDbhWE+HUun9skRQrGIFVUagqWj4DMaaPSMWfAolM7XZZxNmxA==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-core": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-core/-/workbox-core-7.3.0.tgz", + "integrity": "sha512-Z+mYrErfh4t3zi7NVTvOuACB0A/jA3bgxUN3PwtAVHvfEsZxV9Iju580VEETug3zYJRc0Dmii/aixI/Uxj8fmw==", + "dev": true + }, + "node_modules/workbox-expiration": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-expiration/-/workbox-expiration-7.3.0.tgz", + "integrity": "sha512-lpnSSLp2BM+K6bgFCWc5bS1LR5pAwDWbcKt1iL87/eTSJRdLdAwGQznZE+1czLgn/X05YChsrEegTNxjM067vQ==", + "dev": true, + "dependencies": { + "idb": "^7.0.1", + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-google-analytics": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-google-analytics/-/workbox-google-analytics-7.3.0.tgz", + "integrity": "sha512-ii/tSfFdhjLHZ2BrYgFNTrb/yk04pw2hasgbM70jpZfLk0vdJAXgaiMAWsoE+wfJDNWoZmBYY0hMVI0v5wWDbg==", + "dev": true, + "dependencies": { + "workbox-background-sync": "7.3.0", + "workbox-core": "7.3.0", + "workbox-routing": "7.3.0", + "workbox-strategies": "7.3.0" + } + }, + "node_modules/workbox-navigation-preload": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-navigation-preload/-/workbox-navigation-preload-7.3.0.tgz", + "integrity": "sha512-fTJzogmFaTv4bShZ6aA7Bfj4Cewaq5rp30qcxl2iYM45YD79rKIhvzNHiFj1P+u5ZZldroqhASXwwoyusnr2cg==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-precaching": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-precaching/-/workbox-precaching-7.3.0.tgz", + "integrity": "sha512-ckp/3t0msgXclVAYaNndAGeAoWQUv7Rwc4fdhWL69CCAb2UHo3Cef0KIUctqfQj1p8h6aGyz3w8Cy3Ihq9OmIw==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0", + "workbox-routing": "7.3.0", + "workbox-strategies": "7.3.0" + } + }, + "node_modules/workbox-range-requests": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-range-requests/-/workbox-range-requests-7.3.0.tgz", + "integrity": "sha512-EyFmM1KpDzzAouNF3+EWa15yDEenwxoeXu9bgxOEYnFfCxns7eAxA9WSSaVd8kujFFt3eIbShNqa4hLQNFvmVQ==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-recipes": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-recipes/-/workbox-recipes-7.3.0.tgz", + "integrity": "sha512-BJro/MpuW35I/zjZQBcoxsctgeB+kyb2JAP5EB3EYzePg8wDGoQuUdyYQS+CheTb+GhqJeWmVs3QxLI8EBP1sg==", + "dev": true, + "dependencies": { + "workbox-cacheable-response": "7.3.0", + "workbox-core": "7.3.0", + "workbox-expiration": "7.3.0", + "workbox-precaching": "7.3.0", + "workbox-routing": "7.3.0", + "workbox-strategies": "7.3.0" + } + }, + "node_modules/workbox-routing": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-routing/-/workbox-routing-7.3.0.tgz", + "integrity": "sha512-ZUlysUVn5ZUzMOmQN3bqu+gK98vNfgX/gSTZ127izJg/pMMy4LryAthnYtjuqcjkN4HEAx1mdgxNiKJMZQM76A==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-strategies": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-strategies/-/workbox-strategies-7.3.0.tgz", + "integrity": "sha512-tmZydug+qzDFATwX7QiEL5Hdf7FrkhjaF9db1CbB39sDmEZJg3l9ayDvPxy8Y18C3Y66Nrr9kkN1f/RlkDgllg==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0" + } + }, + "node_modules/workbox-streams": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-streams/-/workbox-streams-7.3.0.tgz", + "integrity": "sha512-SZnXucyg8x2Y61VGtDjKPO5EgPUG5NDn/v86WYHX+9ZqvAsGOytP0Jxp1bl663YUuMoXSAtsGLL+byHzEuMRpw==", + "dev": true, + "dependencies": { + "workbox-core": "7.3.0", + "workbox-routing": "7.3.0" + } + }, + "node_modules/workbox-sw": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-sw/-/workbox-sw-7.3.0.tgz", + "integrity": "sha512-aCUyoAZU9IZtH05mn0ACUpyHzPs0lMeJimAYkQkBsOWiqaJLgusfDCR+yllkPkFRxWpZKF8vSvgHYeG7LwhlmA==", + "dev": true + }, + "node_modules/workbox-webpack-plugin": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-webpack-plugin/-/workbox-webpack-plugin-7.3.0.tgz", + "integrity": "sha512-EC8lmSAuNmPli04+a5r5lTgv8ab+f5l+XjdYuYpbGnxDT15kH6DBeBazVslpffqTDHt+wkdBMnBCu8GdkKrTSA==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "^2.1.0", + "pretty-bytes": "^5.4.1", + "upath": "^1.2.0", + "webpack-sources": "^1.4.3", + "workbox-build": "7.3.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "webpack": "^4.4.0 || ^5.91.0" + } + }, + "node_modules/workbox-webpack-plugin/node_modules/webpack-sources": { + "version": "1.4.3", + "resolved": "https://registry.npmmirror.com/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "dev": true, + "dependencies": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + } + }, + "node_modules/workbox-window": { + "version": "7.3.0", + "resolved": "https://registry.npmmirror.com/workbox-window/-/workbox-window-7.3.0.tgz", + "integrity": "sha512-qW8PDy16OV1UBaUNGlTVcepzrlzyzNW/ZJvFQQs2j2TzGsg6IKjcpZC1RSquqQnTOafl5pCj5bGfAHlCjOOjdA==", + "dev": true, + "dependencies": { + "@types/trusted-types": "^2.0.2", + "workbox-core": "7.3.0" + } }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -9133,15 +12006,13 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmmirror.com/ws/-/ws-7.5.10.tgz", "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -9167,7 +12038,6 @@ "resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, - "license": "ISC", "engines": { "node": ">=10" } @@ -9176,15 +12046,13 @@ "version": "3.1.1", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmmirror.com/yaml/-/yaml-1.10.2.tgz", "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true, - "license": "ISC", "engines": { "node": ">= 6" } @@ -9194,7 +12062,6 @@ "resolved": "https://registry.npmmirror.com/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, - "license": "MIT", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -9213,7 +12080,6 @@ "resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, - "license": "ISC", "engines": { "node": ">=10" } diff --git a/main/manager-web/package.json b/main/manager-web/package.json index fddf19aa4..55e275d93 100644 --- a/main/manager-web/package.json +++ b/main/manager-web/package.json @@ -4,12 +4,18 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build" + "build": "vue-cli-service build", + "analyze": "cross-env ANALYZE=true vue-cli-service build" }, "dependencies": { + "core-js": "^3.41.0", + "cross-env": "^7.0.3", + "dotenv": "^16.5.0", "element-ui": "^2.15.14", "flyio": "^0.6.14", "normalize.css": "^8.0.1", + "opus-decoder": "^0.7.7", + "opus-recorder": "^8.0.5", "vue": "^2.6.14", "vue-axios": "^3.5.2", "vue-router": "^3.6.5", @@ -17,16 +23,26 @@ "xiaozhi": "file:" }, "devDependencies": { + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.26.10", "@vue/cli-plugin-router": "~5.0.0", "@vue/cli-plugin-vuex": "~5.0.0", "@vue/cli-service": "~5.0.0", + "compression-webpack-plugin": "^11.1.0", "sass": "^1.32.7", "sass-loader": "^12.0.0", - "vue-template-compiler": "^2.6.14" + "vue-template-compiler": "^2.6.14", + "webpack-bundle-analyzer": "^4.10.2", + "workbox-webpack-plugin": "^7.3.0" }, "browserslist": [ "> 1%", "last 2 versions", "not dead" + ], + "sideEffects": [ + "*.css", + "*.scss", + "*.vue" ] } diff --git a/main/manager-web/public/index.html b/main/manager-web/public/index.html index 40f0613c7..e3ae5a53c 100644 --- a/main/manager-web/public/index.html +++ b/main/manager-web/public/index.html @@ -1,17 +1,33 @@ - - - - - - 小智-智控台 - - - -

- - - + + + + + + + + <%= process.env.VUE_APP_TITLE %> + + <% if (htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> + <% for (var i in htmlWebpackPlugin.options.cdn.css) { %> + + <% } %> + <% } %> + + + + +
+ + <% if (htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> + <% for (var i in htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> + <% } %> + + + \ No newline at end of file diff --git a/main/manager-web/public/offline.html b/main/manager-web/public/offline.html new file mode 100644 index 000000000..b454b6007 --- /dev/null +++ b/main/manager-web/public/offline.html @@ -0,0 +1,70 @@ + + + + + + 离线模式 - 小智控制台 + + + +
+
📶
+

您当前处于离线模式

+

看起来您的网络连接有问题,无法连接到小智控制台服务器。

+

部分已缓存的内容和静态资源可能仍然可用,但功能可能受到限制。

+ +
+ + + + \ No newline at end of file diff --git a/main/manager-web/src/App.vue b/main/manager-web/src/App.vue index 9c7e6db7a..0eefc0bc9 100644 --- a/main/manager-web/src/App.vue +++ b/main/manager-web/src/App.vue @@ -1,11 +1,11 @@ - \ No newline at end of file diff --git a/main/manager-web/src/apis/api.js b/main/manager-web/src/apis/api.js index 2f789925f..0a3e8d185 100755 --- a/main/manager-web/src/apis/api.js +++ b/main/manager-web/src/apis/api.js @@ -1,15 +1,18 @@ // 引入各个模块的请求 -import user from './module/user.js' import admin from './module/admin.js' +import agent from './module/agent.js' +import device from './module/device.js' +import dict from './module/dict.js' +import model from './module/model.js' +import ota from './module/ota.js' +import timbre from "./module/timbre.js" +import user from './module/user.js' /** * 接口地址 - * 当前8002端口接口还没开发完成,暂时用 apifoxmock 接口代替 - * 如果你想调用8002端口,就用'/xiaozhi-esp32-api/api/v1',请与vue.config.js的devServer配置相结合,方便跨域请求 - * + * 开发时自动读取使用.env.development文件 + * 编译时自动读取使用.env.production文件 */ -const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default' -// 8002开发完成完成后使用这个 -// const DEV_API_SERVICE = '/xiaozhi-esp32-api' +const DEV_API_SERVICE = process.env.VUE_APP_API_BASE_URL /** * 根据开发环境返回接口url @@ -24,4 +27,11 @@ export function getServiceUrl() { export default { getServiceUrl, user, + admin, + agent, + device, + model, + timbre, + ota, + dict } diff --git a/main/manager-web/src/apis/httpRequest.js b/main/manager-web/src/apis/httpRequest.js index 98f47bf73..43cdf92db 100755 --- a/main/manager-web/src/apis/httpRequest.js +++ b/main/manager-web/src/apis/httpRequest.js @@ -1,7 +1,7 @@ -import {goToPage, showDanger, showWarning, isNotNull} from '../utils/index' -import Constant from '../utils/constant' import Fly from 'flyio/dist/npm/fly'; -import store from '../store/index' +import store from '../store/index'; +import Constant from '../utils/constant'; +import { goToPage, isNotNull, showDanger, showWarning } from '../utils/index'; const fly = new Fly() // 设置超时 @@ -22,11 +22,11 @@ function sendRequest() { _failCallback: null, _method: 'GET', _data: {}, - _header: {'content-type': 'application/json; charset=utf-8'}, + _header: { 'content-type': 'application/json; charset=utf-8' }, _url: '', _responseType: undefined, // 新增响应类型字段 'send'() { - if(isNotNull(store.getters.getToken)){ + if (isNotNull(store.getters.getToken)) { this._header.Authorization = 'Bearer ' + (JSON.parse(store.getters.getToken)).token } @@ -40,7 +40,7 @@ function sendRequest() { if (error) { return } - + if (this._sucCallback) { this._sucCallback(res) } @@ -100,16 +100,15 @@ function sendRequest() { */ // 在错误处理函数中添加日志 function httpHandlerError(info, callBack) { - console.log('httpHandlerError', info) - + /** 请求成功,退出该函数 可以根据项目需求来判断是否请求成功。这里判断的是status为200的时候是成功 */ let networkError = false if (info.status === 200) { - if (info.data.code === 'success' || info.data.code === 0 || info.data.code === undefined) { return networkError - }else if (info.data.code === 401) { - goToPage(Constant.PAGE.LOGIN, true) + } else if (info.data.code === 401) { + store.commit('clearAuth'); + goToPage(Constant.PAGE.LOGIN, true); return true } else { showDanger(info.data.msg) @@ -138,7 +137,7 @@ function reAjaxFun(fn) { } else { showWarning('正在连接服务器(' + ajaxIndex + ')') } - if (fn) { + if (ajaxIndex < 10 && fn) { setTimeout(() => { fn() }, reAjaxSec * 1000) diff --git a/main/manager-web/src/apis/module/admin.js b/main/manager-web/src/apis/module/admin.js index 52468d6bc..fecc58779 100644 --- a/main/manager-web/src/apis/module/admin.js +++ b/main/manager-web/src/apis/module/admin.js @@ -1,20 +1,134 @@ -import RequestService from '../httpRequest' -import {getServiceUrl} from '../api' +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; export default { // 用户列表 - getUserList(callback) { - RequestService.sendRequest().url(`${getServiceUrl()}/api/v1/admin/users`) + getUserList(params, callback) { + const queryParams = new URLSearchParams({ + page: params.page, + limit: params.limit, + mobile: params.mobile + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/users?${queryParams}`) .method('GET') .success((res) => { RequestService.clearRequestTime() callback(res) }) - .fail(() => { + .fail((err) => { + console.error('请求失败:', err) RequestService.reAjaxFun(() => { - this.getList() + this.getUserList(callback) }) }).send() }, + // 删除用户 + deleteUser(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/users/${id}`) + .method('DELETE') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('删除失败:', err) + RequestService.reAjaxFun(() => { + this.deleteUser(id, callback) + }) + }).send() + }, + // 重置用户密码 + resetUserPassword(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/users/${id}`) + .method('PUT') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('重置密码失败:', err) + RequestService.reAjaxFun(() => { + this.resetUserPassword(id, callback) + }) + }).send() + }, + // 获取参数列表 + getParamsList(params, callback) { + const queryParams = new URLSearchParams({ + page: params.page, + limit: params.limit, + paramCode: params.paramCode || '' + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/params/page?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取参数列表失败:', err) + RequestService.reAjaxFun(() => { + this.getParamsList(params, callback) + }) + }).send() + }, + // 保存 + addParam(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/params`) + .method('POST') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('添加参数失败:', err) + RequestService.reAjaxFun(() => { + this.addParam(data, callback) + }) + }).send() + }, + // 修改 + updateParam(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/params`) + .method('PUT') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('更新参数失败:', err) + RequestService.reAjaxFun(() => { + this.updateParam(data, callback) + }) + }).send() + }, + // 删除 + deleteParam(ids, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/params/delete`) + .method('POST') + .data(ids) + .success((res) => { + RequestService.clearRequestTime() + callback(res); + }) + .fail((err) => { + console.error('删除参数失败:', err) + RequestService.reAjaxFun(() => { + this.deleteParam(ids, callback) + }) + }).send() + }, + } diff --git a/main/manager-web/src/apis/module/agent.js b/main/manager-web/src/apis/module/agent.js new file mode 100644 index 000000000..8aa890725 --- /dev/null +++ b/main/manager-web/src/apis/module/agent.js @@ -0,0 +1,146 @@ +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; + + +export default { + // 获取智能体列表 + getAgentList(callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/list`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getAgentList(callback); + }); + }).send(); + }, + // 添加智能体 + addAgent(agentName, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent`) + .method('POST') + .data({ agentName: agentName }) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.addAgent(agentName, callback); + }); + }).send(); + }, + // 删除智能体 + deleteAgent(agentId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}`) + .method('DELETE') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.deleteAgent(agentId, callback); + }); + }).send(); + }, + // 获取智能体配置 + getDeviceConfig(deviceId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${deviceId}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取配置失败:', err); + RequestService.reAjaxFun(() => { + this.getDeviceConfig(deviceId, callback); + }); + }).send(); + }, + // 配置智能体 + updateAgentConfig(agentId, configData, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}`) + .method('PUT') + .data(configData) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.updateAgentConfig(agentId, configData, callback); + }); + }).send(); + }, + // 新增方法:获取智能体模板 + getAgentTemplate(callback) { // 移除templateName参数 + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/template`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取模板失败:', err); + RequestService.reAjaxFun(() => { + this.getAgentTemplate(callback); + }); + }).send(); + }, + // 获取智能体会话列表 + getAgentSessions(agentId, params, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}/sessions`) + .method('GET') + .data(params) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getAgentSessions(agentId, params, callback); + }); + }).send(); + }, + // 获取智能体聊天记录 + getAgentChatHistory(agentId, sessionId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}/chat-history/${sessionId}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getAgentChatHistory(agentId, sessionId, callback); + }); + }).send(); + }, + // 获取音频下载ID + getAudioId(audioId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/audio/${audioId}`) + .method('POST') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getAudioId(audioId, callback); + }); + }).send(); + }, +} diff --git a/main/manager-web/src/apis/module/device.js b/main/manager-web/src/apis/module/device.js new file mode 100644 index 000000000..53738bc66 --- /dev/null +++ b/main/manager-web/src/apis/module/device.js @@ -0,0 +1,70 @@ +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; + +export default { + // 已绑设备 + getAgentBindDevices(agentId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/device/bind/${agentId}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取设备列表失败:', err); + RequestService.reAjaxFun(() => { + this.getAgentBindDevices(agentId, callback); + }); + }).send(); + }, + // 解绑设备 + unbindDevice(device_id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/device/unbind`) + .method('POST') + .data({ deviceId: device_id }) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('解绑设备失败:', err); + RequestService.reAjaxFun(() => { + this.unbindDevice(device_id, callback); + }); + }).send(); + }, + // 绑定设备 + bindDevice(agentId, deviceCode, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/device/bind/${agentId}/${deviceCode}`) + .method('POST') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('绑定设备失败:', err); + RequestService.reAjaxFun(() => { + this.bindDevice(agentId, deviceCode, callback); + }); + }).send(); + }, + enableOtaUpgrade(id, status, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/device/enableOta/${id}/${status}`) + .method('PUT') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('更新OTA状态失败:', err) + this.$message.error(err.msg || '更新OTA状态失败') + RequestService.reAjaxFun(() => { + this.enableOtaUpgrade(id, status, callback) + }) + }).send() + }, +} \ No newline at end of file diff --git a/main/manager-web/src/apis/module/dict.js b/main/manager-web/src/apis/module/dict.js new file mode 100644 index 000000000..caf782798 --- /dev/null +++ b/main/manager-web/src/apis/module/dict.js @@ -0,0 +1,227 @@ +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; + +export default { + // 获取字典类型列表 + getDictTypeList(params, callback) { + const queryParams = new URLSearchParams({ + dictType: params.dictType || '', + dictName: params.dictName || '', + page: params.page || 1, + limit: params.limit || 10 + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/type/page?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取字典类型列表失败:', err) + this.$message.error(err.msg || '获取字典类型列表失败') + RequestService.reAjaxFun(() => { + this.getDictTypeList(params, callback) + }) + }).send() + }, + + // 获取字典类型详情 + getDictTypeDetail(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/type/${id}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取字典类型详情失败:', err) + this.$message.error(err.msg || '获取字典类型详情失败') + RequestService.reAjaxFun(() => { + this.getDictTypeDetail(id, callback) + }) + }).send() + }, + + // 新增字典类型 + addDictType(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/type/save`) + .method('POST') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('新增字典类型失败:', err) + this.$message.error(err.msg || '新增字典类型失败') + RequestService.reAjaxFun(() => { + this.addDictType(data, callback) + }) + }).send() + }, + + // 更新字典类型 + updateDictType(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/type/update`) + .method('PUT') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('更新字典类型失败:', err) + this.$message.error(err.msg || '更新字典类型失败') + RequestService.reAjaxFun(() => { + this.updateDictType(data, callback) + }) + }).send() + }, + + // 删除字典类型 + deleteDictType(ids, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/type/delete`) + .method('POST') + .data(ids) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('删除字典类型失败:', err) + this.$message.error(err.msg || '删除字典类型失败') + RequestService.reAjaxFun(() => { + this.deleteDictType(ids, callback) + }) + }).send() + }, + + // 获取字典数据列表 + getDictDataList(params, callback) { + const queryParams = new URLSearchParams({ + dictTypeId: params.dictTypeId, + dictLabel: params.dictLabel || '', + dictValue: params.dictValue || '', + page: params.page || 1, + limit: params.limit || 10 + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/page?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取字典数据列表失败:', err) + this.$message.error(err.msg || '获取字典数据列表失败') + RequestService.reAjaxFun(() => { + this.getDictDataList(params, callback) + }) + }).send() + }, + + // 获取字典数据详情 + getDictDataDetail(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/${id}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取字典数据详情失败:', err) + this.$message.error(err.msg || '获取字典数据详情失败') + RequestService.reAjaxFun(() => { + this.getDictDataDetail(id, callback) + }) + }).send() + }, + + // 新增字典数据 + addDictData(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/save`) + .method('POST') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('新增字典数据失败:', err) + this.$message.error(err.msg || '新增字典数据失败') + RequestService.reAjaxFun(() => { + this.addDictData(data, callback) + }) + }).send() + }, + + // 更新字典数据 + updateDictData(data, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/update`) + .method('PUT') + .data(data) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('更新字典数据失败:', err) + this.$message.error(err.msg || '更新字典数据失败') + RequestService.reAjaxFun(() => { + this.updateDictData(data, callback) + }) + }).send() + }, + + // 删除字典数据 + deleteDictData(ids, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/delete`) + .method('POST') + .data(ids) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('删除字典数据失败:', err) + this.$message.error(err.msg || '删除字典数据失败') + RequestService.reAjaxFun(() => { + this.deleteDictData(ids, callback) + }) + }).send() + }, + + // 获取字典数据列表 + getDictDataByType(dictType) { + return new Promise((resolve, reject) => { + RequestService.sendRequest() + .url(`${getServiceUrl()}/admin/dict/data/type/${dictType}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + if (res.data && res.data.code === 0) { + resolve(res.data) + } else { + reject(new Error(res.data?.msg || '获取字典数据列表失败')) + } + }) + .fail((err) => { + console.error('获取字典数据列表失败:', err) + reject(err) + }).send() + }) + } + +} \ No newline at end of file diff --git a/main/manager-web/src/apis/module/model.js b/main/manager-web/src/apis/module/model.js new file mode 100644 index 000000000..ec0ea32f0 --- /dev/null +++ b/main/manager-web/src/apis/module/model.js @@ -0,0 +1,201 @@ +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; + +export default { + // 获取模型配置列表 + getModelList(params, callback) { + const queryParams = new URLSearchParams({ + modelType: params.modelType, + modelName: params.modelName || '', + page: params.page || 0, + limit: params.limit || 10 + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/list?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取模型列表失败:', err) + RequestService.reAjaxFun(() => { + this.getModelList(params, callback) + }) + }).send() + }, + // 获取模型供应器列表 + getModelProviders(modelType, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${modelType}/provideTypes`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res.data?.data || []) + }) + .fail((err) => { + console.error('获取供应器列表失败:', err) + this.$message.error('获取供应器列表失败') + RequestService.reAjaxFun(() => { + this.getModelProviders(modelType, callback) + }) + }).send() + }, + + // 新增模型配置 + addModel(params, callback) { + const { modelType, provideCode, formData } = params; + const postData = { + modelCode: formData.modelCode, + modelName: formData.modelName, + isDefault: formData.isDefault ? 1 : 0, + isEnabled: formData.isEnabled ? 1 : 0, + configJson: formData.configJson, + docLink: formData.docLink, + remark: formData.remark, + sort: formData.sort || 0 + }; + + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${modelType}/${provideCode}`) + .method('POST') + .data(postData) + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('新增模型失败:', err) + this.$message.error(err.msg || '新增模型失败') + RequestService.reAjaxFun(() => { + this.addModel(params, callback) + }) + }).send() + }, + // 删除模型配置 + deleteModel(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${id}`) + .method('DELETE') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('删除模型失败:', err) + this.$message.error(err.msg || '删除模型失败') + RequestService.reAjaxFun(() => { + this.deleteModel(id, callback) + }) + }).send() + }, + // 获取模型名称列表 + getModelNames(modelType, modelName, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/names`) + .method('GET') + .data({ modelType, modelName }) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getModelNames(modelType, modelName, callback); + }); + }).send(); + }, + // 获取模型音色列表 + getModelVoices(modelId, voiceName, callback) { + const queryParams = new URLSearchParams({ + voiceName: voiceName || '' + }).toString(); + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${modelId}/voices?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail(() => { + RequestService.reAjaxFun(() => { + this.getModelVoices(modelId, voiceName, callback); + }); + }).send(); + }, + // 获取单个模型配置 + getModelConfig(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${id}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('获取模型配置失败:', err) + this.$message.error(err.msg || '获取模型配置失败') + RequestService.reAjaxFun(() => { + this.getModelConfig(id, callback) + }) + }).send() + }, + // 启用/禁用模型状态 + updateModelStatus(id, status, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/enable/${id}/${status}`) + .method('PUT') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('更新模型状态失败:', err) + this.$message.error(err.msg || '更新模型状态失败') + RequestService.reAjaxFun(() => { + this.updateModelStatus(id, status, callback) + }) + }).send() + }, + // 更新模型配置 + updateModel(params, callback) { + const { modelType, provideCode, id, formData } = params; + const payload = { + ...formData, + configJson: formData.configJson + }; + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/${modelType}/${provideCode}/${id}`) + .method('PUT') + .data(payload) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('更新模型失败:', err); + this.$message.error(err.msg || '更新模型失败'); + RequestService.reAjaxFun(() => { + this.updateModel(params, callback); + }); + }).send(); + }, + // 设置默认模型 + setDefaultModel(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/models/default/${id}`) + .method('PUT') + .success((res) => { + RequestService.clearRequestTime() + callback(res) + }) + .fail((err) => { + console.error('设置默认模型失败:', err) + this.$message.error(err.msg || '设置默认模型失败') + RequestService.reAjaxFun(() => { + this.setDefaultModel(id, callback) + }) + }).send() + } +} diff --git a/main/manager-web/src/apis/module/ota.js b/main/manager-web/src/apis/module/ota.js new file mode 100644 index 000000000..438aa3d8e --- /dev/null +++ b/main/manager-web/src/apis/module/ota.js @@ -0,0 +1,123 @@ +import { getServiceUrl } from '../api'; +import RequestService from '../httpRequest'; + +export default { + // 分页查询OTA固件信息 + getOtaList(params, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag`) + .method('GET') + .data(params) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取OTA固件列表失败:', err); + RequestService.reAjaxFun(() => { + this.getOtaList(params, callback); + }); + }).send(); + }, + // 获取单个OTA固件信息 + getOtaInfo(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag/${id}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取OTA固件信息失败:', err); + RequestService.reAjaxFun(() => { + this.getOtaInfo(id, callback); + }); + }).send(); + }, + // 保存OTA固件信息 + saveOta(entity, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag`) + .method('POST') + .data(entity) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('保存OTA固件信息失败:', err); + RequestService.reAjaxFun(() => { + this.saveOta(entity, callback); + }); + }).send(); + }, + // 更新OTA固件信息 + updateOta(id, entity, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag/${id}`) + .method('PUT') + .data(entity) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('更新OTA固件信息失败:', err); + RequestService.reAjaxFun(() => { + this.updateOta(id, entity, callback); + }); + }).send(); + }, + // 删除OTA固件 + deleteOta(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag/${id}`) + .method('DELETE') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('删除OTA固件失败:', err); + RequestService.reAjaxFun(() => { + this.deleteOta(id, callback); + }); + }).send(); + }, + // 上传固件文件 + uploadFirmware(file, callback) { + const formData = new FormData(); + formData.append('file', file); + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag/upload`) + .method('POST') + .data(formData) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('上传固件文件失败:', err); + RequestService.reAjaxFun(() => { + this.uploadFirmware(file, callback); + }); + }).send(); + }, + // 获取固件下载链接 + getDownloadUrl(id, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/otaMag/getDownloadUrl/${id}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .fail((err) => { + console.error('获取下载链接失败:', err); + RequestService.reAjaxFun(() => { + this.getDownloadUrl(id, callback); + }); + }).send(); + } +} \ No newline at end of file diff --git a/main/manager-web/src/apis/module/timbre.js b/main/manager-web/src/apis/module/timbre.js new file mode 100644 index 000000000..919205227 --- /dev/null +++ b/main/manager-web/src/apis/module/timbre.js @@ -0,0 +1,92 @@ +import {getServiceUrl} from '../api'; +import RequestService from '../httpRequest'; + +export default { + // 获取音色 + getVoiceList(params, callback) { + const queryParams = new URLSearchParams({ + ttsModelId: params.ttsModelId, + page: params.page || 1, + limit: params.limit || 10, + name: params.name || '' + }).toString(); + + RequestService.sendRequest() + .url(`${getServiceUrl()}/ttsVoice?${queryParams}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res.data || []); + }) + .fail((err) => { + console.error('获取音色列表失败:', err); + RequestService.reAjaxFun(() => { + this.getVoiceList(params, callback); + }); + }).send(); + }, + // 音色保存 + saveVoice(params, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/ttsVoice`) + .method('POST') + .data(JSON.stringify({ + languages: params.languageType, + name: params.voiceName, + remark: params.remark, + sort: params.sort, + ttsModelId: params.ttsModelId, + ttsVoice: params.voiceCode, + voiceDemo: params.voiceDemo || '' + })) + .success((res) => { + callback(res.data); + }) + .fail((err) => { + console.error('保存音色失败:', err); + RequestService.reAjaxFun(() => { + this.saveVoice(params, callback); + }); + }).send(); + }, + // 音色删除 + deleteVoice(ids, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/ttsVoice/delete`) + .method('POST') + .data(ids) + .success((res) => { + RequestService.clearRequestTime() + callback(res); + }) + .fail((err) => { + console.error('删除音色失败:', err); + RequestService.reAjaxFun(() => { + this.deleteVoice(ids, callback); + }); + }).send(); + }, + // 音色修改 + updateVoice(params, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/ttsVoice/${params.id}`) + .method('PUT') + .data(JSON.stringify({ + languages: params.languageType, + name: params.voiceName, + remark: params.remark, + ttsModelId: params.ttsModelId, + ttsVoice: params.voiceCode, + voiceDemo: params.voiceDemo || '' + })) + .success((res) => { + callback(res.data); + }) + .fail((err) => { + console.error('修改音色失败:', err); + RequestService.reAjaxFun(() => { + this.updateVoice(params, callback); + }); + }).send(); + } +} \ No newline at end of file diff --git a/main/manager-web/src/apis/module/user.js b/main/manager-web/src/apis/module/user.js index 66fefdbc6..84d5b7f9d 100755 --- a/main/manager-web/src/apis/module/user.js +++ b/main/manager-web/src/apis/module/user.js @@ -1,12 +1,12 @@ +import { getServiceUrl } from '../api' import RequestService from '../httpRequest' -import {getServiceUrl} from '../api' export default { // 登录 login(loginForm, callback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/login`) + .url(`${getServiceUrl()}/user/login`) .method('POST') .data(loginForm) .success((res) => { @@ -21,9 +21,8 @@ export default { }, // 获取验证码 getCaptcha(uuid, callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/captcha?uuid=${uuid}`) + .url(`${getServiceUrl()}/user/captcha?uuid=${uuid}`) .method('GET') .type('blob') .header({ @@ -42,7 +41,7 @@ export default { // 注册账号 register(registerForm, callback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/register`) + .url(`${getServiceUrl()}/user/register`) .method('POST') .data(registerForm) .success((res) => { @@ -52,11 +51,10 @@ export default { .fail(() => { }).send() }, - // 保存设备配置 saveDeviceConfig(device_id, configData, callback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/configDevice/${device_id}`) + .url(`${getServiceUrl()}/user/configDevice/${device_id}`) .method('PUT') .data(configData) .success((res) => { @@ -70,25 +68,10 @@ export default { }); }).send(); }, - // 获取智能体列表 - getAgentList(callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent`) - .method('GET') - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail(() => { - RequestService.reAjaxFun(() => { - this.getAgentList(callback); - }); - }).send(); - }, // 用户信息获取 getUserInfo(callback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/info`) + .url(`${getServiceUrl()}/user/info`) .method('GET') .success((res) => { RequestService.clearRequestTime() @@ -101,45 +84,14 @@ export default { }) }).send() }, - // 添加智能体 - addAgent(agentName, callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent`) - .method('POST') - .data({name: agentName}) - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail(() => { - RequestService.reAjaxFun(() => { - this.addAgent(agentName, callback); - }); - }).send(); - }, - // 删除智能体 - deleteAgent(agentId, callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent/${agentId}`) - .method('DELETE') - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail(() => { - RequestService.reAjaxFun(() => { - this.deleteAgent(agentId, callback); - }); - }).send(); - }, // 修改用户密码 changePassword(oldPassword, newPassword, successCallback, errorCallback) { RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/change-password`) + .url(`${getServiceUrl()}/user/change-password`) .method('PUT') .data({ - old_password: oldPassword, - new_password: newPassword, + password: oldPassword, + newPassword: newPassword, }) .success((res) => { RequestService.clearRequestTime(); @@ -152,87 +104,38 @@ export default { }) .send(); }, - // 获取智能体配置 - getDeviceConfig(deviceId, callback) { + // 修改用户状态 + changeUserStatus(status, userIds, successCallback) { + console.log(555, userIds) RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent/${deviceId}`) + .url(`${getServiceUrl()}/admin/users/changeStatus/${status}`) + .method('put') + .data(userIds) + .success((res) => { + RequestService.clearRequestTime() + successCallback(res); + }) + .fail((err) => { + console.error('修改用户状态失败:', err) + RequestService.reAjaxFun(() => { + this.changeUserStatus(status, userIds) + }) + }).send() + }, + // 获取公共配置 + getPubConfig(callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/user/pub-config`) .method('GET') .success((res) => { RequestService.clearRequestTime(); callback(res); }) .fail((err) => { - console.error('获取配置失败:', err); + console.error('获取公共配置失败:', err); RequestService.reAjaxFun(() => { - this.getDeviceConfig(deviceId, callback); + this.getPubConfig(callback); }); }).send(); }, - // 配置智能体 - updateAgentConfig(agentId, configData, callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent/${agentId}`) - .method('PUT') - .data(configData) - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail(() => { - RequestService.reAjaxFun(() => { - this.updateAgentConfig(agentId, configData, callback); - }); - }).send(); - }, - // 已绑设备 - getAgentBindDevices(agentId, callback) { - console.log("77777777777777777777777") - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent/device/bind/${agentId}`) - .method('GET') - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail((err) => { - console.error('获取设备列表失败:', err); - RequestService.reAjaxFun(() => { - this.getAgentBindDevices(agentId, callback); - }); - }).send(); - }, - // 解绑设备 - unbindDevice(device_id, callback) { - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/device/unbind/${device_id}`) - .method('PUT') - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail((err) => { - console.error('解绑设备失败:', err); - RequestService.reAjaxFun(() => { - this.unbindDevice(device_id, callback); - }); - }).send(); - }, - // 绑定设备 - bindDevice(agentId, code, callback) { - console.log("32323234343434344340000") - RequestService.sendRequest() - .url(`${getServiceUrl()}/api/v1/user/agent/device/bind/${agentId}`) - .method('POST') - .data({ code }) - .success((res) => { - RequestService.clearRequestTime(); - callback(res); - }) - .fail((err) => { - // console.error('绑定设备失败:', err); - // RequestService.reAjaxFun(() => { - // this.bindDevice(agentId, code, callback); - // }); - }).send(); - }, } diff --git a/main/manager-web/src/assets/header/firmware_update.png b/main/manager-web/src/assets/header/firmware_update.png new file mode 100644 index 000000000..bd3d73964 Binary files /dev/null and b/main/manager-web/src/assets/header/firmware_update.png differ diff --git a/main/manager-web/src/assets/header/model_config.png b/main/manager-web/src/assets/header/model_config.png new file mode 100644 index 000000000..407e0a485 Binary files /dev/null and b/main/manager-web/src/assets/header/model_config.png differ diff --git a/main/manager-web/src/assets/header/param_management.png b/main/manager-web/src/assets/header/param_management.png new file mode 100644 index 000000000..215b12efb Binary files /dev/null and b/main/manager-web/src/assets/header/param_management.png differ diff --git a/main/manager-web/src/assets/header/robot.png b/main/manager-web/src/assets/header/robot.png new file mode 100644 index 000000000..a1d7f7c58 Binary files /dev/null and b/main/manager-web/src/assets/header/robot.png differ diff --git a/main/manager-web/src/assets/header/user_management.png b/main/manager-web/src/assets/header/user_management.png new file mode 100644 index 000000000..ce633674a Binary files /dev/null and b/main/manager-web/src/assets/header/user_management.png differ diff --git a/main/manager-web/src/assets/home/background.png b/main/manager-web/src/assets/home/background.png deleted file mode 100644 index f7c3d3573..000000000 Binary files a/main/manager-web/src/assets/home/background.png and /dev/null differ diff --git a/main/manager-web/src/assets/login/background.png b/main/manager-web/src/assets/login/background.png deleted file mode 100644 index e81d6eccd..000000000 Binary files a/main/manager-web/src/assets/login/background.png and /dev/null differ diff --git a/main/manager-web/src/assets/login/login-person.png b/main/manager-web/src/assets/login/login-person.png new file mode 100644 index 000000000..27477f2f4 Binary files /dev/null and b/main/manager-web/src/assets/login/login-person.png differ diff --git a/main/manager-web/src/assets/login/register-person.png b/main/manager-web/src/assets/login/register-person.png new file mode 100644 index 000000000..12e0a3e23 Binary files /dev/null and b/main/manager-web/src/assets/login/register-person.png differ diff --git a/main/manager-web/src/assets/logo.png b/main/manager-web/src/assets/logo.png deleted file mode 100644 index f3d2503fc..000000000 Binary files a/main/manager-web/src/assets/logo.png and /dev/null differ diff --git a/main/manager-web/src/assets/model/inner_conf.png b/main/manager-web/src/assets/model/inner_conf.png new file mode 100644 index 000000000..d750d05a7 Binary files /dev/null and b/main/manager-web/src/assets/model/inner_conf.png differ diff --git a/main/manager-web/src/assets/model/model.png b/main/manager-web/src/assets/model/model.png index e7b6c257d..f08ecb86e 100644 Binary files a/main/manager-web/src/assets/model/model.png and b/main/manager-web/src/assets/model/model.png differ diff --git a/main/manager-web/src/assets/model/output_conf.png b/main/manager-web/src/assets/model/output_conf.png new file mode 100644 index 000000000..f09b121ed Binary files /dev/null and b/main/manager-web/src/assets/model/output_conf.png differ diff --git a/main/manager-web/src/assets/user-avatar1.png b/main/manager-web/src/assets/user-avatar1.png new file mode 100644 index 000000000..d835d2f70 Binary files /dev/null and b/main/manager-web/src/assets/user-avatar1.png differ diff --git a/main/manager-web/src/assets/user-avatar2.png b/main/manager-web/src/assets/user-avatar2.png new file mode 100644 index 000000000..71d5fd1bb Binary files /dev/null and b/main/manager-web/src/assets/user-avatar2.png differ diff --git a/main/manager-web/src/assets/user-avatar3.png b/main/manager-web/src/assets/user-avatar3.png new file mode 100644 index 000000000..159e68861 Binary files /dev/null and b/main/manager-web/src/assets/user-avatar3.png differ diff --git a/main/manager-web/src/assets/user-avatar4.png b/main/manager-web/src/assets/user-avatar4.png new file mode 100644 index 000000000..0d0781441 Binary files /dev/null and b/main/manager-web/src/assets/user-avatar4.png differ diff --git a/main/manager-web/src/assets/user-avatar5.png b/main/manager-web/src/assets/user-avatar5.png new file mode 100644 index 000000000..c99604750 Binary files /dev/null and b/main/manager-web/src/assets/user-avatar5.png differ diff --git a/main/manager-web/src/assets/welcome/background.png b/main/manager-web/src/assets/welcome/background.png deleted file mode 100644 index b39cbebbd..000000000 Binary files a/main/manager-web/src/assets/welcome/background.png and /dev/null differ diff --git a/main/manager-web/src/assets/welcome/github.png b/main/manager-web/src/assets/welcome/github.png deleted file mode 100644 index 0e984ec72..000000000 Binary files a/main/manager-web/src/assets/welcome/github.png and /dev/null differ diff --git a/main/manager-web/src/assets/welcome/more.png b/main/manager-web/src/assets/welcome/more.png deleted file mode 100644 index 5acbfa6a0..000000000 Binary files a/main/manager-web/src/assets/welcome/more.png and /dev/null differ diff --git a/main/manager-web/src/assets/welcome/questions.png b/main/manager-web/src/assets/welcome/questions.png deleted file mode 100644 index 1fe2ab9bc..000000000 Binary files a/main/manager-web/src/assets/welcome/questions.png and /dev/null differ diff --git a/main/manager-web/src/assets/xiaozhi-ai.png b/main/manager-web/src/assets/xiaozhi-ai.png index 008df015c..ef3834afc 100644 Binary files a/main/manager-web/src/assets/xiaozhi-ai.png and b/main/manager-web/src/assets/xiaozhi-ai.png differ diff --git a/main/manager-web/src/assets/xiaozhi-logo.png b/main/manager-web/src/assets/xiaozhi-logo.png index 330503972..9e6649701 100644 Binary files a/main/manager-web/src/assets/xiaozhi-logo.png and b/main/manager-web/src/assets/xiaozhi-logo.png differ diff --git a/main/manager-web/src/components/AddDeviceDialog.vue b/main/manager-web/src/components/AddDeviceDialog.vue index 6c99a038d..51f5426b5 100644 --- a/main/manager-web/src/components/AddDeviceDialog.vue +++ b/main/manager-web/src/components/AddDeviceDialog.vue @@ -1,7 +1,9 @@ \ No newline at end of file diff --git a/main/manager-web/src/components/AddModelDialog.vue b/main/manager-web/src/components/AddModelDialog.vue index 074be1759..5add8a77b 100644 --- a/main/manager-web/src/components/AddModelDialog.vue +++ b/main/manager-web/src/components/AddModelDialog.vue @@ -1,19 +1,11 @@ @@ -297,7 +334,7 @@ export default { } .custom-form .el-form-item { - margin-bottom: 20px; /* 统一设置所有表单项的间距 */ + margin-bottom: 20px; } .custom-form .el-form-item__label { @@ -312,13 +349,12 @@ export default { margin-top: -4px; } -/* 修改placeholder颜色 */ .custom-input-bg .el-input__inner::-webkit-input-placeholder, .custom-input-bg .el-textarea__inner::-webkit-input-placeholder { color: #9c9f9e; } -/* 输入框背景色 */ + .custom-input-bg .el-input__inner, .custom-input-bg .el-textarea__inner { background-color: #f6f8fc; @@ -342,13 +378,12 @@ export default { } -/* 修改开关样式 */ .custom-switch .el-switch__core { border-radius: 20px; height: 23px; background-color: #c0ccda; width: 35px; - padding: 0 20px; /* 调整左右内边距 */ + padding: 0 20px; } .custom-switch .el-switch__core:after { @@ -363,7 +398,7 @@ export default { .custom-switch.is-checked .el-switch__core { border-color: #b5bcf0; background-color: #cfd7fa; - padding: 0 20px; /* 确保启用状态也有相同的间隔 */ + padding: 0 20px; } .custom-switch.is-checked .el-switch__core:after { @@ -373,15 +408,11 @@ export default { } -/* 调整flex布局的gap */ [style*="display: flex"] { - gap: 20px; /* 扩大flex项间距 */ + gap: 20px; } -/* 调整输入框高度 */ .custom-input-bg .el-input__inner { - height: 32px; /* 固定输入框高度 */ + height: 32px; } - - \ No newline at end of file diff --git a/main/manager-web/src/components/AddWisdomBodyDialog.vue b/main/manager-web/src/components/AddWisdomBodyDialog.vue index cca026eff..78c19676b 100644 --- a/main/manager-web/src/components/AddWisdomBodyDialog.vue +++ b/main/manager-web/src/components/AddWisdomBodyDialog.vue @@ -1,27 +1,27 @@ \ No newline at end of file diff --git a/main/manager-web/src/components/AudioPlayer.vue b/main/manager-web/src/components/AudioPlayer.vue new file mode 100644 index 000000000..2e0666147 --- /dev/null +++ b/main/manager-web/src/components/AudioPlayer.vue @@ -0,0 +1,379 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/CacheViewer.vue b/main/manager-web/src/components/CacheViewer.vue new file mode 100644 index 000000000..66d4da7dc --- /dev/null +++ b/main/manager-web/src/components/CacheViewer.vue @@ -0,0 +1,207 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/ChangePasswordDialog.vue b/main/manager-web/src/components/ChangePasswordDialog.vue index 19c20fd6b..fb84992ef 100644 --- a/main/manager-web/src/components/ChangePasswordDialog.vue +++ b/main/manager-web/src/components/ChangePasswordDialog.vue @@ -1,57 +1,62 @@ + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/DeviceItem.vue b/main/manager-web/src/components/DeviceItem.vue index 4ad34709f..60f54b9d5 100644 --- a/main/manager-web/src/components/DeviceItem.vue +++ b/main/manager-web/src/components/DeviceItem.vue @@ -2,12 +2,15 @@
- {{ device.agentName }} + {{ device.agentName }}
- - + + + +
@@ -20,18 +23,15 @@
配置角色
-
- 声纹识别 +
+ 设备管理({{ device.deviceCount }})
-
- 历史对话 -
-
- 设备管理 +
+ 聊天记录
-
最近对话:{{ device.lastConnectedAt }}
+
最近对话:{{ formattedLastConnectedTime }}
@@ -45,6 +45,27 @@ export default { data() { return { switchValue: false } }, + computed: { + formattedLastConnectedTime() { + if (!this.device.lastConnectedAt) return '暂未对话'; + + const lastTime = new Date(this.device.lastConnectedAt); + const now = new Date(); + const diffMinutes = Math.floor((now - lastTime) / (1000 * 60)); + + if (diffMinutes <= 1) { + return '刚刚'; + } else if (diffMinutes < 60) { + return `${diffMinutes}分钟前`; + } else if (diffMinutes < 24 * 60) { + const hours = Math.floor(diffMinutes / 60); + const minutes = diffMinutes % 60; + return `${hours}小时${minutes > 0 ? minutes + '分钟' : ''}前`; + } else { + return this.device.lastConnectedAt; + } + } + }, methods: { handleDelete() { this.$emit('delete', this.device.agentId) @@ -54,6 +75,9 @@ export default { }, handleDeviceManage() { this.$router.push({ path: '/device-management', query: { agentId: this.device.agentId } }); + }, + handleChatHistory() { + this.$emit('chat-history', { agentId: this.device.agentId, agentName: this.device.agentName }) } } } @@ -66,6 +90,7 @@ export default { padding: 22px; box-sizing: border-box; } + .device-name { margin: 7px 0 10px; font-weight: 400; @@ -76,10 +101,11 @@ export default { .settings-btn { font-weight: 500; - font-size: 10px; + font-size: 12px; color: #5778ff; background: #e6ebff; - width: 57px; + width: auto; + padding: 0 12px; height: 21px; line-height: 21px; cursor: pointer; @@ -90,9 +116,15 @@ export default { display: flex; justify-content: space-between; margin-top: 15px; - font-size: 10px; + font-size: 12px; color: #979db1; font-weight: 400; } + + \ No newline at end of file diff --git a/main/manager-web/src/components/DictDataDialog.vue b/main/manager-web/src/components/DictDataDialog.vue new file mode 100644 index 000000000..7934602b4 --- /dev/null +++ b/main/manager-web/src/components/DictDataDialog.vue @@ -0,0 +1,105 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/DictTypeDialog.vue b/main/manager-web/src/components/DictTypeDialog.vue new file mode 100644 index 000000000..a9a7aa078 --- /dev/null +++ b/main/manager-web/src/components/DictTypeDialog.vue @@ -0,0 +1,86 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/FirmwareDialog.vue b/main/manager-web/src/components/FirmwareDialog.vue new file mode 100644 index 000000000..940fbbebc --- /dev/null +++ b/main/manager-web/src/components/FirmwareDialog.vue @@ -0,0 +1,221 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/HeaderBar.vue b/main/manager-web/src/components/HeaderBar.vue index 5c1f52e91..3d6a62f0d 100644 --- a/main/manager-web/src/components/HeaderBar.vue +++ b/main/manager-web/src/components/HeaderBar.vue @@ -1,50 +1,90 @@ \ No newline at end of file diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue index 09e5570c5..f4d582c6c 100644 --- a/main/manager-web/src/components/ModelEditDialog.vue +++ b/main/manager-web/src/components/ModelEditDialog.vue @@ -1,159 +1,477 @@ diff --git a/main/manager-web/src/components/ParamDialog.vue b/main/manager-web/src/components/ParamDialog.vue new file mode 100644 index 000000000..7c126aa50 --- /dev/null +++ b/main/manager-web/src/components/ParamDialog.vue @@ -0,0 +1,364 @@ + + + + + + + diff --git a/main/manager-web/src/components/TtsModel.vue b/main/manager-web/src/components/TtsModel.vue index 92b107ed6..b93f56ade 100644 --- a/main/manager-web/src/components/TtsModel.vue +++ b/main/manager-web/src/components/TtsModel.vue @@ -1,194 +1,716 @@ + +/* 备注文本 */ +::v-deep .remark-input .el-textarea__inner { + border-radius: 4px; + border: 1px solid #e6e6e6; + padding: 8px 12px; + resize: none; + max-height: 40px !important; + line-height: 1.5; + background-color: transparent !important; +} + +::v-deep .remark-input .el-textarea__inner:focus { + border-color: #409EFF !important; + outline: none; +} + +::v-deep .remark-input .el-textarea__inner::placeholder { + color: #c0c4cc !important; + opacity: 1; +} + + +/* 滚动容器 */ +.scroll-wrapper { + display: flex; + max-height: 55vh; + position: relative; +} + +.table-container { + flex: 1; + overflow: auto; + scrollbar-width: none; + padding-right: 15px; + width: calc(100% - 16px); +} + +.table-container::-webkit-scrollbar { + display: none; +} + +/* 自定义滚动条 */ +.custom-scrollbar { + width: 8px; + background: #f1f1f1; + border-radius: 4px; + position: relative; + margin-left: 8px; + height: 100%; + top: 55px; +} + +.custom-scrollbar-track { + position: relative; + height: 380px; + cursor: pointer; +} + +.custom-scrollbar-thumb { + position: absolute; + width: 100%; + background: #9dade7; + border-radius: 4px; + cursor: grab; + transition: background 0.2s; +} + +.custom-scrollbar-thumb:hover { + background: #6b84d9; +} + +.custom-scrollbar-thumb:active { + cursor: grabbing; +} + +.save-Tts { + background: #796dea; + border: None; +} + +.save-Tts:hover { + background: #8b80f0; +} + +.custom-audio-container audio { + display: none; +} + +/* 音频播放器容器样式 */ +.custom-audio-container { + width: 90%; + margin: 0 auto; +} + +/* 新增按钮组样式 */ +.action-buttons { + bottom: 20px; + padding-top: 10px; +} + +.action-buttons .el-button { + padding: 8px 15px; + font-size: 11px; +} + +.edit-btn, +.delete-btn, +.save-btn { + margin: 0 8px; + color: #7079aa !important; + transition: all 0.3s; +} + +.edit-btn:hover, +.delete-btn:hover, +.save-btn:hover { + color: #5f70f3 !important; + transform: scale(1.05); +} + +.save-btn { + color: #5cca8e !important; +} + +/* 表格单元格自适应 */ +::v-deep .el-table__body-wrapper { + overflow-x: hidden !important; +} + +::v-deep .el-table td { + white-space: pre-wrap !important; + word-break: break-all !important; +} +/* 按钮组定位调整 */ +.action-buttons { + position: static; + padding: 15px 0; + background: white; + box-shadow: 0 -2px 12px rgba(0,0,0,0.05); +} + +/* 输入框自适应 */ +::v-deep .el-input__inner, +::v-deep .el-textarea__inner { + width: 100% !important; + min-width: 120px; +} + +/* 音频输入框特殊处理 */ +.audio-input ::v-deep .el-input__inner { + min-width: 200px; +} + +/* 操作按钮弹性布局 */ +::v-deep .el-table__row .el-button { + flex-shrink: 0; + margin: 2px !important; +} + + \ No newline at end of file diff --git a/main/manager-web/src/components/VersionFooter.vue b/main/manager-web/src/components/VersionFooter.vue new file mode 100644 index 000000000..6226bcc0d --- /dev/null +++ b/main/manager-web/src/components/VersionFooter.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/ViewPasswordDialog.vue b/main/manager-web/src/components/ViewPasswordDialog.vue new file mode 100644 index 000000000..a5c89af42 --- /dev/null +++ b/main/manager-web/src/components/ViewPasswordDialog.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/main/manager-web/src/main.js b/main/manager-web/src/main.js index 2b6531dfe..58e04f0d0 100644 --- a/main/manager-web/src/main.js +++ b/main/manager-web/src/main.js @@ -1,14 +1,21 @@ -import Vue from 'vue' -import App from './App.vue' -import router from './router' -import store from './store' -import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; +import 'normalize.css/normalize.css'; // A modern alternative to CSS resets +import Vue from 'vue'; +import App from './App.vue'; +import router from './router'; +import store from './store'; +import './styles/global.scss'; +import { register as registerServiceWorker } from './registerServiceWorker'; Vue.use(ElementUI); + Vue.config.productionTip = false +// 注册Service Worker +registerServiceWorker(); + +// 创建Vue实例 new Vue({ router, store, diff --git a/main/manager-web/src/registerServiceWorker.js b/main/manager-web/src/registerServiceWorker.js new file mode 100644 index 000000000..64d6c43a0 --- /dev/null +++ b/main/manager-web/src/registerServiceWorker.js @@ -0,0 +1,113 @@ +/* eslint-disable no-console */ + +export const register = () => { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + window.addEventListener('load', () => { + const swUrl = `${process.env.BASE_URL}service-worker.js`; + + console.info(`[小智服务] 正在尝试注册Service Worker,URL: ${swUrl}`); + + // 先检查Service Worker是否已注册 + navigator.serviceWorker.getRegistrations().then(registrations => { + if (registrations.length > 0) { + console.info('[小智服务] 发现已有Service Worker注册,正在检查更新'); + } + + // 继续注册Service Worker + navigator.serviceWorker + .register(swUrl) + .then(registration => { + console.info('[小智服务] Service Worker注册成功'); + + // 更新处理 + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // 内容已缓存更新,通知用户刷新 + console.log('[小智服务] 新内容可用,请刷新页面'); + // 可以在这里展示更新提示 + const updateNotification = document.createElement('div'); + updateNotification.style.cssText = ` + position: fixed; + bottom: 20px; + right: 20px; + background: #409EFF; + color: white; + padding: 12px 20px; + border-radius: 4px; + box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); + z-index: 9999; + `; + updateNotification.innerHTML = ` +
+ 发现新版本,点击刷新应用 + +
+ `; + document.body.appendChild(updateNotification); + updateNotification.querySelector('button').addEventListener('click', () => { + window.location.reload(); + }); + } else { + // 一切正常,Service Worker已成功安装 + console.log('[小智服务] 内容已缓存供离线使用'); + + // 可以在这里初始化缓存 + setTimeout(() => { + // 预热CDN缓存 + const cdnUrls = [ + 'https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css', + 'https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css', + 'https://unpkg.com/vue@2.6.14/dist/vue.min.js', + 'https://unpkg.com/vue-router@3.6.5/dist/vue-router.min.js', + 'https://unpkg.com/vuex@3.6.2/dist/vuex.min.js', + 'https://unpkg.com/element-ui@2.15.14/lib/index.js', + 'https://unpkg.com/axios@0.27.2/dist/axios.min.js', + 'https://unpkg.com/opus-decoder@0.7.7/dist/opus-decoder.min.js' + ]; + + // 预热缓存 + cdnUrls.forEach(url => { + fetch(url, { mode: 'no-cors' }).catch(err => { + console.log(`预热缓存 ${url} 失败`, err); + }); + }); + }, 2000); + } + } + }; + }; + }) + .catch(error => { + console.error('Service Worker 注册失败:', error); + + if (error.name === 'TypeError' && error.message.includes('Failed to register a ServiceWorker')) { + console.warn('[小智服务] 注册Service Worker时出现网络错误,CDN资源可能无法缓存'); + if (process.env.NODE_ENV === 'production') { + console.info( + '可能原因:1. 服务器未配置正确的MIME类型 2. 服务器SSL证书问题 3. 服务器未返回service-worker.js文件' + ); + } + } + }); + }); + }); + } +}; + +export const unregister = () => { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready + .then(registration => { + registration.unregister(); + }) + .catch(error => { + console.error(error.message); + }); + } +}; \ No newline at end of file diff --git a/main/manager-web/src/router/index.js b/main/manager-web/src/router/index.js index 6bc588230..57b3c7e73 100644 --- a/main/manager-web/src/router/index.js +++ b/main/manager-web/src/router/index.js @@ -56,17 +56,77 @@ const routes = [ } }, { - path: '/model-config', - name: 'ModelConfig', - component: function () { - return import('../views/ModelConfig.vue') - } + path: '/model-config', + name: 'ModelConfig', + component: function () { + return import('../views/ModelConfig.vue') + } }, - + { + path: '/params-management', + name: 'ParamsManagement', + component: function () { + return import('../views/ParamsManagement.vue') + }, + meta: { + requiresAuth: true, + title: '参数管理' + } + }, + { + path: '/ota-management', + name: 'OtaManagement', + component: function () { + return import('../views/OtaManagement.vue') + }, + meta: { + requiresAuth: true, + title: 'OTA管理' + } + }, + { + path: '/dict-management', + name: 'DictManagement', + component: function () { + return import('../views/DictManagement.vue') + } + } ] - const router = new VueRouter({ + base: process.env.VUE_APP_PUBLIC_PATH || '/', routes }) +// 全局处理重复导航,改为刷新页面 +const originalPush = VueRouter.prototype.push +VueRouter.prototype.push = function push(location) { + return originalPush.call(this, location).catch(err => { + if (err.name === 'NavigationDuplicated') { + // 如果是重复导航,刷新页面 + window.location.reload() + } else { + // 其他错误正常抛出 + throw err + } + }) +} + +// 需要登录才能访问的路由 +const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig'] + +// 路由守卫 +router.beforeEach((to, from, next) => { + // 检查是否是需要保护的路由 + if (protectedRoutes.includes(to.name)) { + // 从localStorage获取token + const token = localStorage.getItem('token') + if (!token) { + // 未登录,跳转到登录页 + next({ name: 'login', query: { redirect: to.fullPath } }) + return + } + } + next() +}) + export default router diff --git a/main/manager-web/src/service-worker.js b/main/manager-web/src/service-worker.js new file mode 100644 index 000000000..ab9551fa6 --- /dev/null +++ b/main/manager-web/src/service-worker.js @@ -0,0 +1,174 @@ +/* global self, workbox */ + +// 自定义Service Worker安装和激活的处理逻辑 +self.addEventListener('message', (event) => { + if (event.data && event.data.type === 'SKIP_WAITING') { + self.skipWaiting(); + } +}); + +// CDN资源列表 +const CDN_CSS = [ + 'https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css', + 'https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css' +]; + +const CDN_JS = [ + 'https://unpkg.com/vue@2.6.14/dist/vue.min.js', + 'https://unpkg.com/vue-router@3.6.5/dist/vue-router.min.js', + 'https://unpkg.com/vuex@3.6.2/dist/vuex.min.js', + 'https://unpkg.com/element-ui@2.15.14/lib/index.js', + 'https://unpkg.com/axios@0.27.2/dist/axios.min.js', + 'https://unpkg.com/opus-decoder@0.7.7/dist/opus-decoder.min.js' +]; + +// 当Service Worker被注入manifest后会自动执行 +const manifest = self.__WB_MANIFEST || []; + +// 检查是否启用CDN模式 +const isCDNEnabled = manifest.some(entry => + entry.url === 'cdn-mode' && entry.revision === 'enabled' +); + +console.log(`Service Worker 已初始化, CDN模式: ${isCDNEnabled ? '启用' : '禁用'}`); + +// 注入workbox相关代码 +importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js'); +workbox.setConfig({ debug: false }); + +// 开启workbox +workbox.core.skipWaiting(); +workbox.core.clientsClaim(); + +// 预缓存离线页面 +const OFFLINE_URL = '/offline.html'; +workbox.precaching.precacheAndRoute([ + { url: OFFLINE_URL, revision: null } +]); + +// 添加安装完成事件处理器,在控制台显示安装消息 +self.addEventListener('install', event => { + if (isCDNEnabled) { + console.log('Service Worker 已安装,开始缓存CDN资源'); + } else { + console.log('Service Worker 已安装,CDN模式禁用,仅缓存本地资源'); + } + + // 确保离线页面被缓存 + event.waitUntil( + caches.open('offline-cache').then((cache) => { + return cache.add(OFFLINE_URL); + }) + ); +}); + +// 添加激活事件处理器 +self.addEventListener('activate', event => { + console.log('Service Worker 已激活,现在控制着页面'); + + // 清理旧版本缓存 + event.waitUntil( + caches.keys().then(cacheNames => { + return Promise.all( + cacheNames.filter(cacheName => { + // 清理除当前版本外的缓存 + return cacheName.startsWith('workbox-') && !workbox.core.cacheNames.runtime.includes(cacheName); + }).map(cacheName => { + return caches.delete(cacheName); + }) + ); + }) + ); +}); + +// 添加fetch事件拦截器,用于查看CDN资源是否命中缓存 +self.addEventListener('fetch', event => { + // 只有启用CDN模式时才进行CDN资源缓存监控 + if (isCDNEnabled) { + const url = new URL(event.request.url); + + // 针对CDN资源,输出是否命中缓存的信息 + if ([...CDN_CSS, ...CDN_JS].includes(url.href)) { + // 不干扰正常的fetch流程,只添加日志 + console.log(`请求CDN资源: ${url.href}`); + } + } +}); + +// 仅在CDN模式下缓存CDN资源 +if (isCDNEnabled) { + // 缓存CDN的CSS资源 + workbox.routing.registerRoute( + ({ url }) => CDN_CSS.includes(url.href), + new workbox.strategies.CacheFirst({ + cacheName: 'cdn-stylesheets', + plugins: [ + new workbox.expiration.ExpirationPlugin({ + maxAgeSeconds: 365 * 24 * 60 * 60, // 增加到1年缓存 + maxEntries: 10, // 最多缓存10个CSS文件 + }), + new workbox.cacheableResponse.CacheableResponsePlugin({ + statuses: [0, 200], // 缓存成功响应 + }), + ], + }) + ); + + // 缓存CDN的JS资源 + workbox.routing.registerRoute( + ({ url }) => CDN_JS.includes(url.href), + new workbox.strategies.CacheFirst({ + cacheName: 'cdn-scripts', + plugins: [ + new workbox.expiration.ExpirationPlugin({ + maxAgeSeconds: 365 * 24 * 60 * 60, // 增加到1年缓存 + maxEntries: 20, // 最多缓存20个JS文件 + }), + new workbox.cacheableResponse.CacheableResponsePlugin({ + statuses: [0, 200], // 缓存成功响应 + }), + ], + }) + ); +} + +// 无论是否启用CDN模式,都缓存本地静态资源 +workbox.routing.registerRoute( + /\.(?:js|css|png|jpg|jpeg|svg|gif|ico|woff|woff2|eot|ttf|otf)$/, + new workbox.strategies.StaleWhileRevalidate({ + cacheName: 'static-resources', + plugins: [ + new workbox.expiration.ExpirationPlugin({ + maxAgeSeconds: 7 * 24 * 60 * 60, // 7天缓存 + maxEntries: 50, // 最多缓存50个文件 + }), + ], + }) +); + +// 缓存HTML页面 +workbox.routing.registerRoute( + /\.html$/, + new workbox.strategies.NetworkFirst({ + cacheName: 'html-cache', + plugins: [ + new workbox.expiration.ExpirationPlugin({ + maxAgeSeconds: 1 * 24 * 60 * 60, // 1天缓存 + maxEntries: 10, // 最多缓存10个HTML文件 + }), + ], + }) +); + +// 离线页面 - 使用更可靠的处理方式 +workbox.routing.setCatchHandler(async ({ event }) => { + // 根据请求类型返回适当的默认页面 + switch (event.request.destination) { + case 'document': + // 如果是网页请求,返回离线页面 + return caches.match(OFFLINE_URL); + default: + // 所有其他请求返回错误 + return Response.error(); + } +}); \ No newline at end of file diff --git a/main/manager-web/src/store/index.js b/main/manager-web/src/store/index.js index 0f810894f..7a33ed61e 100644 --- a/main/manager-web/src/store/index.js +++ b/main/manager-web/src/store/index.js @@ -1,12 +1,20 @@ -import Vue from 'vue' -import Vuex from 'vuex' -import Constant from '../utils/constant' +import { goToPage } from "@/utils"; +import Vue from 'vue'; +import Vuex from 'vuex'; +import Api from '../apis/api'; +import Constant from '../utils/constant'; Vue.use(Vuex) export default new Vuex.Store({ state: { - token: '' + token: '', + userInfo: {}, // 添加用户信息存储 + isSuperAdmin: false, // 添加superAdmin状态 + pubConfig: { // 添加公共配置存储 + version: '', + allowUserRegister: false + } }, getters: { getToken(state) { @@ -14,16 +22,63 @@ export default new Vuex.Store({ state.token = localStorage.getItem('token') } return state.token + }, + getUserInfo(state) { + return state.userInfo + }, + getIsSuperAdmin(state) { + if (localStorage.getItem('isSuperAdmin') === null) { + return state.isSuperAdmin + } + return localStorage.getItem('isSuperAdmin') === 'true' + }, + getPubConfig(state) { + return state.pubConfig } }, mutations: { setToken(state, token) { state.token = token - localStorage.token = token + localStorage.setItem('token', token) + }, + setUserInfo(state, userInfo) { + state.userInfo = userInfo + const isSuperAdmin = userInfo.superAdmin === 1 + state.isSuperAdmin = isSuperAdmin + localStorage.setItem('isSuperAdmin', isSuperAdmin) + }, + setPubConfig(state, config) { + state.pubConfig = config + }, + clearAuth(state) { + state.token = '' + state.userInfo = {} + state.isSuperAdmin = false + localStorage.removeItem('token') + localStorage.removeItem('isSuperAdmin') } }, actions: { + // 添加 logout action + logout({ commit }) { + return new Promise((resolve) => { + commit('clearAuth') + goToPage(Constant.PAGE.LOGIN, true); + window.location.reload(); // 彻底重置状态 + }) + }, + // 添加获取公共配置的 action + fetchPubConfig({ commit }) { + return new Promise((resolve) => { + Api.user.getPubConfig(({ data }) => { + if (data.code === 0) { + commit('setPubConfig', data.data); + } + resolve(); + }); + }); + } }, modules: { } -}) +}) \ No newline at end of file diff --git a/main/manager-web/src/styles/global.scss b/main/manager-web/src/styles/global.scss new file mode 100644 index 000000000..b83180f2e --- /dev/null +++ b/main/manager-web/src/styles/global.scss @@ -0,0 +1,14 @@ +// 覆盖 autofill 样式 +input:-webkit-autofill, +input:-webkit-autofill:hover, +input:-webkit-autofill:focus, +textarea:-webkit-autofill, +textarea:-webkit-autofill:hover, +textarea:-webkit-autofill:focus, +select:-webkit-autofill, +select:-webkit-autofill:hover, +select:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0px 1000px transparent inset; + transition: background-color 5000s ease-in-out 0s; + background-color: transparent; +} \ No newline at end of file diff --git a/main/manager-web/src/utils/cacheViewer.js b/main/manager-web/src/utils/cacheViewer.js new file mode 100644 index 000000000..2f8a547ca --- /dev/null +++ b/main/manager-web/src/utils/cacheViewer.js @@ -0,0 +1,142 @@ +/** + * 缓存查看工具 - 用于检查CDN资源是否已被Service Worker缓存 + */ + +/** + * 获取所有Service Worker缓存的名称 + * @returns {Promise} 缓存名称列表 + */ +export const getCacheNames = async () => { + if (!('caches' in window)) { + return []; + } + + try { + return await caches.keys(); + } catch (error) { + console.error('获取缓存名称失败:', error); + return []; + } +}; + +/** + * 获取指定缓存中的所有URL + * @param {string} cacheName 缓存名称 + * @returns {Promise} 缓存的URL列表 + */ +export const getCacheUrls = async (cacheName) => { + if (!('caches' in window)) { + return []; + } + + try { + const cache = await caches.open(cacheName); + const requests = await cache.keys(); + return requests.map(request => request.url); + } catch (error) { + console.error(`获取缓存 ${cacheName} 的URL失败:`, error); + return []; + } +}; + +/** + * 检查特定URL是否已被缓存 + * @param {string} url 要检查的URL + * @returns {Promise} 是否已缓存 + */ +export const isUrlCached = async (url) => { + if (!('caches' in window)) { + return false; + } + + try { + const cacheNames = await getCacheNames(); + for (const cacheName of cacheNames) { + const cache = await caches.open(cacheName); + const match = await cache.match(url); + if (match) { + return true; + } + } + return false; + } catch (error) { + console.error(`检查URL ${url} 是否缓存失败:`, error); + return false; + } +}; + +/** + * 获取当前页面所有CDN资源的缓存状态 + * @returns {Promise} 缓存状态对象 + */ +export const checkCdnCacheStatus = async () => { + // 从CDN缓存中查找资源 + const cdnCaches = ['cdn-stylesheets', 'cdn-scripts']; + const results = { + css: [], + js: [], + totalCached: 0, + totalNotCached: 0 + }; + + for (const cacheName of cdnCaches) { + try { + const urls = await getCacheUrls(cacheName); + + // 区分CSS和JS资源 + for (const url of urls) { + if (url.endsWith('.css')) { + results.css.push({ url, cached: true }); + } else if (url.endsWith('.js')) { + results.js.push({ url, cached: true }); + } + results.totalCached++; + } + } catch (error) { + console.error(`获取 ${cacheName} 缓存信息失败:`, error); + } + } + + return results; +}; + +/** + * 清除所有Service Worker缓存 + * @returns {Promise} 是否成功清除 + */ +export const clearAllCaches = async () => { + if (!('caches' in window)) { + return false; + } + + try { + const cacheNames = await getCacheNames(); + for (const cacheName of cacheNames) { + await caches.delete(cacheName); + } + return true; + } catch (error) { + console.error('清除所有缓存失败:', error); + return false; + } +}; + +/** + * 将缓存状态输出到控制台 + */ +export const logCacheStatus = async () => { + console.group('Service Worker 缓存状态'); + + const cacheNames = await getCacheNames(); + console.log('已发现的缓存:', cacheNames); + + for (const cacheName of cacheNames) { + const urls = await getCacheUrls(cacheName); + console.group(`缓存: ${cacheName} (${urls.length} 项)`); + urls.forEach(url => console.log(url)); + console.groupEnd(); + } + + console.groupEnd(); + return cacheNames.length > 0; +}; \ No newline at end of file diff --git a/main/manager-web/src/utils/format.js b/main/manager-web/src/utils/format.js new file mode 100644 index 000000000..97f20f033 --- /dev/null +++ b/main/manager-web/src/utils/format.js @@ -0,0 +1,21 @@ +// 日期格式化函数 +export function formatDate(date) { + if (!date) return ''; + const d = new Date(date); + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + const hour = String(d.getHours()).padStart(2, '0'); + const minute = String(d.getMinutes()).padStart(2, '0'); + const second = String(d.getSeconds()).padStart(2, '0'); + return `${year}-${month}-${day} ${hour}:${minute}:${second}`; +} + +// 文件大小格式化函数 +export function formatFileSize(bytes) { + if (!bytes || bytes === 0) return '0 B'; + const units = ['B', 'KB', 'MB', 'GB', 'TB']; + const k = 1024; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + units[i]; +} \ No newline at end of file diff --git a/main/manager-web/src/utils/index.js b/main/manager-web/src/utils/index.js index b9c22fbc9..8a5a960e5 100755 --- a/main/manager-web/src/utils/index.js +++ b/main/manager-web/src/utils/index.js @@ -1,6 +1,6 @@ +import { Message } from 'element-ui' import router from '../router' import Constant from '../utils/constant' -import { Message } from 'element-ui' /** * 判断用户是否登录 @@ -54,7 +54,8 @@ export function showDanger(msg) { } Message({ message: msg, - type: 'error' + type: 'error', + showClose: true }) } @@ -68,7 +69,8 @@ export function showWarning(msg) { } Message({ message: msg, - type: 'warning' + type: 'warning', + showClose: true }); } @@ -81,7 +83,8 @@ export function showWarning(msg) { export function showSuccess(msg) { Message({ message: msg, - type: 'success' + type: 'success', + showClose: true }) } diff --git a/main/manager-web/src/views/DeviceManagement.vue b/main/manager-web/src/views/DeviceManagement.vue index 2e853f172..14138bd89 100644 --- a/main/manager-web/src/views/DeviceManagement.vue +++ b/main/manager-web/src/views/DeviceManagement.vue @@ -1,94 +1,249 @@ @@ -159,57 +345,360 @@ export default { min-height: 506px; height: 100vh; display: flex; + position: relative; flex-direction: column; - background-image: url("@/assets/home/background.png"); + background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd); background-size: cover; - background-position: center; -webkit-background-size: cover; -o-background-size: cover; } -.table-container { - background: #f9fafc; - padding: 20px; - border-radius: 20px; +.main-wrapper { + margin: 5px 22px; + border-radius: 15px; + min-height: calc(100vh - 24vh); + height: auto; + max-height: 80vh; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); - margin-top: 15px; -} - -.add-device-btn { - float: right; - background: #409eff; - border: none; - border-radius: 10px; - width: 105px; - height: 32px; + position: relative; + background: rgba(237, 242, 255, 0.5); display: flex; - align-items: center; - justify-content: center; - font-size: 14px; - gap: 8px; - margin-bottom: 15px; - &:hover { - background: #3a8ee6; - } + flex-direction: column; } -.device-list-title { - float: left; - font-size: 18px; - font-weight: 700; - margin: 5px; +.operation-bar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 16px 24px; +} + +.page-title { + font-size: 24px; + margin: 0; color: #2c3e50; } -.el-icon-edit { - color: #409eff; - cursor: pointer; - font-size: 14px; - vertical-align: middle; +.right-operations { + display: flex; + gap: 10px; + margin-left: auto; } -.pagination { - margin-top: 20px; - text-align: right; +.search-input { + width: 280px; + border-radius: 4px; +} + +.btn-search { + background: linear-gradient(135deg, #6b8cff, #a966ff); + border: none; + color: white; +} + +::v-deep .search-input .el-input__inner { + border-radius: 4px; + border: 1px solid #DCDFE6; + background-color: white; + transition: border-color 0.2s; +} + +::v-deep .page-size-select { + width: 100px; + margin-right: 8px; +} + +::v-deep .page-size-select .el-input__inner { + height: 32px; + line-height: 32px; + border-radius: 4px; + border: 1px solid #e4e7ed; + background: #dee7ff; + color: #606266; + font-size: 14px; +} + +::v-deep .page-size-select .el-input__suffix { + right: 6px; + width: 15px; + height: 20px; + display: flex; + justify-content: center; + align-items: center; + top: 6px; + border-radius: 4px; +} + +::v-deep .page-size-select .el-input__suffix-inner { + display: flex; + align-items: center; + justify-content: center; + width: 100%; +} + +::v-deep .page-size-select .el-icon-arrow-up:before { + content: ""; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 9px solid #606266; + position: relative; + transform: rotate(0deg); + transition: transform 0.3s; +} + +::v-deep .search-input .el-input__inner:focus { + border-color: #6b8cff; + outline: none; +} + +.content-panel { + flex: 1; + display: flex; + overflow: hidden; + height: 100%; + border-radius: 15px; + background: transparent; + border: 1px solid #fff; +} + +.content-area { + flex: 1; + height: 100%; + min-width: 600px; + overflow: auto; + background-color: white; + display: flex; + flex-direction: column; +} + +.device-card { + background: white; + border: none; + box-shadow: none; + display: flex; + flex-direction: column; + flex: 1; + overflow: hidden; +} + +::v-deep .el-card__body { + padding: 15px; + display: flex; + flex-direction: column; + flex: 1; + overflow: hidden; +} + +.table_bottom { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10px; + padding-bottom: 10px; +} + + +.ctrl_btn { + display: flex; + gap: 8px; + padding-left: 26px; +} + +.ctrl_btn .el-button { + min-width: 72px; + height: 32px; + padding: 7px 12px 7px 10px; + font-size: 12px; + border-radius: 4px; + line-height: 1; + font-weight: 500; + border: none; + transition: all 0.3s ease; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); +} + +.ctrl_btn .el-button:hover { + transform: translateY(-1px); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); +} + +.ctrl_btn .el-button--primary { + background: #5f70f3; + color: white; +} + +.ctrl_btn .el-button--success { + background: #5bc98c; + color: white; +} + +.ctrl_btn .el-button--danger { + background: #fd5b63; + color: white; +} + +.custom-pagination { + display: flex; + align-items: center; + gap: 10px; +} + +.custom-pagination .el-select { + margin-right: 8px; +} + +.custom-pagination .pagination-btn:first-child, +.custom-pagination .pagination-btn:nth-child(2), +.custom-pagination .pagination-btn:nth-last-child(2), +.custom-pagination .pagination-btn:nth-child(3) { + min-width: 60px; + height: 32px; + padding: 0 12px; + border-radius: 4px; + border: 1px solid #e4e7ed; + background: #dee7ff; + color: #606266; + font-size: 14px; + cursor: pointer; + transition: all 0.3s ease; +} + +.custom-pagination .pagination-btn:first-child:hover, +.custom-pagination .pagination-btn:nth-child(2):hover, +.custom-pagination .pagination-btn:nth-last-child(2):hover, +.custom-pagination .pagination-btn:nth-child(3):hover { + background: #d7dce6; +} + +.custom-pagination .pagination-btn:disabled { + opacity: 0.6; + cursor: not-allowed; +} + +.custom-pagination .pagination-btn:not(:first-child):not(:nth-child(3)):not(:nth-child(2)):not(:nth-last-child(2)) { + min-width: 28px; + height: 32px; + padding: 0; + border-radius: 4px; + border: 1px solid transparent; + background: transparent; + color: #606266; + font-size: 14px; + cursor: pointer; + transition: all 0.3s ease; +} + +.custom-pagination .pagination-btn:not(:first-child):not(:nth-child(3)):not(:nth-child(2)):not(:nth-last-child(2)):hover { + background: rgba(245, 247, 250, 0.3); +} + +.custom-pagination .pagination-btn.active { + background: #5f70f3 !important; + color: #ffffff !important; + border-color: #5f70f3 !important; +} + +.custom-pagination .pagination-btn.active:hover { + background: #6d7cf5 !important; +} + +.custom-pagination .total-text { + color: #909399; + font-size: 14px; + margin-left: 10px; +} + +:deep(.transparent-table) { + background: white; + border: none; +} + +:deep(.transparent-table .el-table__header th) { + background: white !important; + color: black; + border-right: none !important; +} + +:deep(.transparent-table .el-table__body tr td) { + border-top: 1px solid rgba(0, 0, 0, 0.04); + border-bottom: 1px solid rgba(0, 0, 0, 0.04); + border-right: none !important; +} + +:deep(.transparent-table .el-table__header tr th:first-child .cell), +:deep(.transparent-table .el-table__body tr td:first-child .cell) { + padding-left: 10px; +} + +:deep(.el-icon-edit) { + color: #7079aa; + cursor: pointer; +} + +:deep(.el-icon-edit:hover) { + color: #5a64b5; +} + +:deep(.custom-selection-header .el-checkbox) { + display: none !important; +} + + + +:deep(.el-table .el-button--text) { + color: #7079aa; +} + +:deep(.el-table .el-button--text:hover) { + color: #5a64b5; +} + +:deep(.transparent-table) { + flex: 1; + display: flex; + flex-direction: column; + max-height: calc(100vh - 40vh); +} + +:deep(.el-table__body-wrapper) { + flex: 1; + overflow-y: auto; + max-height: none !important; +} + +:deep(.el-table__header-wrapper) { + flex-shrink: 0; +} + +@media (min-width: 1144px) { + .table_bottom { + margin-top: 40px; + } + + :deep(.transparent-table) .el-table__body tr td { + padding-top: 16px; + padding-bottom: 16px; + } +} + +:deep(.el-checkbox__inner) { + background-color: #eeeeee !important; + border-color: #cccccc !important; +} + +:deep(.el-checkbox__inner:hover) { + border-color: #cccccc !important; +} + +:deep(.el-checkbox__input.is-checked .el-checkbox__inner) { + background-color: #5f70f3 !important; + border-color: #5f70f3 !important; +} + +::v-deep .el-table--border::after, +::v-deep .el-table--group::after, +::v-deep .el-table::before { + display: none !important; } diff --git a/main/manager-web/src/views/DictManagement.vue b/main/manager-web/src/views/DictManagement.vue new file mode 100644 index 000000000..da6db1717 --- /dev/null +++ b/main/manager-web/src/views/DictManagement.vue @@ -0,0 +1,835 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/views/ModelConfig.vue b/main/manager-web/src/views/ModelConfig.vue index 4c6aed4c9..aa788f2f6 100644 --- a/main/manager-web/src/views/ModelConfig.vue +++ b/main/manager-web/src/views/ModelConfig.vue @@ -2,26 +2,25 @@
-
- -
- - 语音设置 - - - 导入配置 - - - 导出配置 +
+

{{ modelTypeText }}

+
+
+ + + 搜索
+
+
+ style="background-size: cover; background-position: center;"> 语言活动检测 @@ -44,78 +43,106 @@
-
-
-

大语言模型(LLM)

- - 添加 - -
-
-
- - - 查询 + + + + + + + + + + + + + + + + + + + + + + -
- - - - - - - - - - - - - - - -
- -
-
+
- - - -
- - + + +
+ + + +
- diff --git a/main/manager-web/src/views/OtaManagement.vue b/main/manager-web/src/views/OtaManagement.vue new file mode 100644 index 000000000..300e83ad1 --- /dev/null +++ b/main/manager-web/src/views/OtaManagement.vue @@ -0,0 +1,766 @@ + + + + + diff --git a/main/manager-web/src/views/ParamsManagement.vue b/main/manager-web/src/views/ParamsManagement.vue new file mode 100644 index 000000000..afb0dc1d8 --- /dev/null +++ b/main/manager-web/src/views/ParamsManagement.vue @@ -0,0 +1,720 @@ + + + + + diff --git a/main/manager-web/src/views/UserManagement.vue b/main/manager-web/src/views/UserManagement.vue index 2122568e7..34d60e746 100644 --- a/main/manager-web/src/views/UserManagement.vue +++ b/main/manager-web/src/views/UserManagement.vue @@ -1,213 +1,718 @@ \ No newline at end of file +.custom-pagination { + display: flex; + align-items: center; + gap: 8px; + + .el-select { + margin-right: 8px; + } + + .pagination-btn:first-child, + .pagination-btn:nth-child(2), + .pagination-btn:nth-child(3), + .pagination-btn:nth-last-child(2) { + min-width: 60px; + height: 32px; + padding: 0 12px; + border-radius: 4px; + border: 1px solid #e4e7ed; + background: #dee7ff; + color: #606266; + font-size: 14px; + cursor: pointer; + transition: all 0.3s ease; + + &:hover { + background: #d7dce6; + } + + &:disabled { + opacity: 0.6; + cursor: not-allowed; + } + } + + .pagination-btn:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(:nth-last-child(2)) { + min-width: 28px; + height: 32px; + padding: 0; + border-radius: 4px; + border: 1px solid transparent; + background: transparent; + color: #606266; + font-size: 14px; + cursor: pointer; + transition: all 0.3s ease; + + &:hover { + background: rgba(245, 247, 250, 0.3); + } + } + + .pagination-btn.active { + background: #5f70f3 !important; + color: #ffffff !important; + border-color: #5f70f3 !important; + + &:hover { + background: #6d7cf5 !important; + } + } + + .total-text { + color: #909399; + font-size: 14px; + margin-left: 10px; + } +} + +:deep(.transparent-table) { + background: white; + flex: 1; + width: 100%; + display: flex; + flex-direction: column; + + .el-table__body-wrapper { + flex: 1; + overflow-y: auto; + max-height: none !important; + } + + .el-table__header-wrapper { + flex-shrink: 0; + } + + .el-table__header th { + background: white !important; + color: black; + } + + &::before { + display: none; + } + + .el-table__body tr { + background-color: white; + + td { + border-top: 1px solid rgba(0, 0, 0, 0.04); + border-bottom: 1px solid rgba(0, 0, 0, 0.04); + } + } +} + +:deep(.el-table .el-button--text) { + color: #7079aa !important; +} + +:deep(.el-table .el-button--text:hover) { + color: #5a64b5 !important; +} + + +:deep(.el-checkbox__inner) { + background-color: #eeeeee !important; + border-color: #cccccc !important; +} + +:deep(.el-checkbox__inner:hover) { + border-color: #cccccc !important; +} + +:deep(.el-checkbox__input.is-checked .el-checkbox__inner) { + background-color: #5f70f3 !important; + border-color: #5f70f3 !important; +} + +@media (min-width: 1144px) { + .table_bottom { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 40px; + } + + :deep(.transparent-table) { + .el-table__body tr { + td { + padding-top: 16px; + padding-bottom: 16px; + } + + &+tr { + margin-top: 10px; + } + } + } +} + +.page-size-select { + width: 100px; + margin-right: 10px; + + :deep(.el-input__inner) { + height: 32px; + line-height: 32px; + border-radius: 4px; + border: 1px solid #e4e7ed; + background: #dee7ff; + color: #606266; + font-size: 14px; + } + + :deep(.el-input__suffix) { + right: 6px; + width: 15px; + height: 20px; + display: flex; + justify-content: center; + align-items: center; + top: 6px; + border-radius: 4px; + } + + :deep(.el-input__suffix-inner) { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + } + + :deep(.el-icon-arrow-up:before) { + content: ""; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 9px solid #606266; + position: relative; + transform: rotate(0deg); + transition: transform 0.3s; + } +} + +.el-table { + --table-max-height: calc(100vh - 40vh); + max-height: var(--table-max-height); + + .el-table__body-wrapper { + max-height: calc(var(--table-max-height) - 40px); + } +} + +:deep(.el-loading-mask) { + background-color: rgba(255, 255, 255, 0.6) !important; + backdrop-filter: blur(2px); +} + +:deep(.el-loading-spinner .circular) { + width: 28px; + height: 28px; +} + +:deep(.el-loading-spinner .path) { + stroke: #6b8cff; +} + +:deep(.el-loading-text) { + color: #6b8cff !important; + font-size: 14px; + margin-top: 8px; +} + diff --git a/main/manager-web/src/views/auth.scss b/main/manager-web/src/views/auth.scss index 2c282ac55..555b84af6 100644 --- a/main/manager-web/src/views/auth.scss +++ b/main/manager-web/src/views/auth.scss @@ -1,9 +1,11 @@ - .welcome { min-width: 1200px; min-height: 675px; height: 100vh; - background-image: url("@/assets/login/background.png"); + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(145deg, #f5f8fd, #6baaff, #9ebbfc, #f5f8fd); background-size: cover; /* 确保背景图像覆盖整个元素 */ background-position: center; @@ -130,3 +132,13 @@ padding: 0; } } + +.login-person { + width: 500px; + color: #fff; + position: absolute; + top: 50%; + left: 25%; + transform: translate(-50%, -50%); + z-index: 1; +} \ No newline at end of file diff --git a/main/manager-web/src/views/home.vue b/main/manager-web/src/views/home.vue index 9b8e6949d..e276ec20a 100644 --- a/main/manager-web/src/views/home.vue +++ b/main/manager-web/src/views/home.vue @@ -1,65 +1,85 @@ +@import './auth.scss'; // 添加这行引用 diff --git a/main/manager-web/src/views/register.vue b/main/manager-web/src/views/register.vue index 8158b6c4b..0806197f8 100644 --- a/main/manager-web/src/views/register.vue +++ b/main/manager-web/src/views/register.vue @@ -1,19 +1,21 @@ +@import './auth.scss'; // 修改为导入新建的SCSS文件 diff --git a/main/manager-web/src/views/roleConfig.vue b/main/manager-web/src/views/roleConfig.vue index fb37fb160..cbeb2c50b 100644 --- a/main/manager-web/src/views/roleConfig.vue +++ b/main/manager-web/src/views/roleConfig.vue @@ -1,167 +1,161 @@ @@ -239,60 +321,132 @@ export default { min-height: 506px; height: 100vh; display: flex; + position: relative; flex-direction: column; - background-image: url("@/assets/home/background.png"); + background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd); background-size: cover; - /* 确保背景图像覆盖整个元素 */ - background-position: center; - /* 从顶部中心对齐 */ -webkit-background-size: cover; - /* 兼容老版本WebKit浏览器 */ -o-background-size: cover; - /* 兼容老版本Opera浏览器 */ + overflow: hidden; } -.el-form-item ::v-deep .el-form-item__label { - font-size: 10px !important; - color: #3d4566 !important; - font-weight: 400; - line-height: 22px; - padding-bottom: 2px; +.operation-bar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 16px 24px; } -.select-field{ - width: 100%; - max-width: 720px; - border: 1px solid #e4e6ef; - background: #f6f8fb; - border-radius: 8px; - height: 36px !important; +.page-title { + font-size: 24px; + margin: 0; + color: #2c3e50; } -.audio-box { +.main-wrapper { + margin: 5px 22px; + border-radius: 15px; + height: calc(100vh - 24vh); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); + position: relative; + background: rgba(237, 242, 255, 0.5); + display: flex; + flex-direction: column; +} + +.content-panel { flex: 1; - height: 37px; - border-radius: 20px; - border: 1px solid #e4e6ef; + display: flex; + overflow: hidden; + height: 100%; + border-radius: 15px; + background: transparent; + border: 1px solid #fff; } -.clear-btn { - width: 48px; - height: 19px; - background: #fd8383; - border-radius: 10px; - line-height: 19px; - font-size: 11px; - color: #fff; - cursor: pointer; +.content-area { + flex: 1; + height: 100%; + min-width: 600px; + overflow: auto; + background-color: white; + display: flex; + flex-direction: column; } -.clear-text { - color: #979db1; - font-size: 11px; +.config-card { + background: white; + border: none; + box-shadow: none; + display: flex; + flex-direction: column; + flex: 1; + overflow-y: auto; +} + +.config-header { + position: relative; display: flex; align-items: center; + gap: 13px; + padding: 0 0 5px 0; + font-weight: 700; + font-size: 19px; + color: #3d4566; +} + +.header-icon { + width: 37px; + height: 37px; + background: #5778ff; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; +} + +.header-icon img { + width: 19px; + height: 19px; +} + +.divider { + height: 1px; + background: #e8f0ff; +} + +.form-content { + padding: 20px 0; +} + +.form-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 20px; +} + +.form-column { + display: flex; + flex-direction: column; + gap: 6px; +} + +.form-input { + width: 100%; +} + +.form-select { + width: 100%; +} + +.form-textarea { + width: 100%; +} + +.template-container { + display: flex; gap: 8px; - margin-left: 16px; + flex-wrap: wrap; } .template-item { @@ -313,48 +467,89 @@ export default { background-color: #d0d8ff; } -.prompt-bottom { - margin-bottom: 4px; +.action-bar { display: flex; - justify-content: space-between; - padding: 0 16px; + flex-wrap: wrap; + gap: 8px; + margin-top: 20px; align-items: center; } -.input-46 { - border: 1px solid #e4e6ef; - background: #f6f8fb; - border-radius: 8px; - height: 36px !important; +.action-bar { + .el-button.save-btn { + background: #5778ff; + color: white; + border: none; + border-radius: 18px; + padding: 10px 20px; + width: 100px; + height: 35px; + font-size: 14px; + } + + .el-button.reset-btn { + background: #e6ebff; + color: #5778ff; + border: 1px solid #adbdff; + border-radius: 18px; + padding: 10px 20px; + } } -.save-btn, -.reset-btn { - width: 112px; - height: 37px; - border-radius: 18px; - line-height: 37px; - box-sizing: border-box; +.hint-text { + display: flex; + align-items: center; + gap: 8px; + color: #979db1; + font-size: 11px; + margin-left: 16px; +} + +.hint-text img { + width: 19px; + height: 19px; +} + +::v-deep .el-form-item__label { + font-size: 10px !important; + color: #3d4566 !important; + font-weight: 400; + line-height: 22px; + padding-bottom: 2px; +} + +::v-deep .el-textarea .el-input__count { + color: #909399; + background: none; + position: absolute; + font-size: 12px; + right: 3%; +} + +.custom-close-btn { + position: absolute; + top: 25%; + right: 0; + transform: translateY(-50%); + width: 35px; + height: 35px; + border-radius: 50%; + border: 2px solid #cfcfcf; + background: none; + font-size: 30px; + font-weight: lighter; + color: #cfcfcf; cursor: pointer; - font-size: 11px + display: flex; + align-items: center; + justify-content: center; + z-index: 1; + padding: 0; + outline: none; } -.save-btn { - border-radius: 18px; - background: #5778ff; - color: #fff; +.custom-close-btn:hover { + color: #409EFF; + border-color: #409EFF; } - -.reset-btn { - border: 1px solid #adbdff; - background: #e6ebff; - color: #5778ff; -} - -.textarea-box { - border: 1px solid #e4e6ef; - border-radius: 8px; - background: #f6f8fb; -} - - + \ No newline at end of file diff --git a/main/manager-web/src/views/welcome.vue b/main/manager-web/src/views/welcome.vue deleted file mode 100644 index 19137cd23..000000000 --- a/main/manager-web/src/views/welcome.vue +++ /dev/null @@ -1,131 +0,0 @@ - - - - diff --git a/main/manager-web/vue.config.js b/main/manager-web/vue.config.js index c10f5e55d..6b6ba4f2e 100644 --- a/main/manager-web/vue.config.js +++ b/main/manager-web/vue.config.js @@ -1,24 +1,181 @@ const { defineConfig } = require('@vue/cli-service'); const dotenv = require('dotenv'); +// TerserPlugin 用于压缩 JavaScript +const TerserPlugin = require('terser-webpack-plugin'); +// CompressionPlugin 开启 Gzip 压缩 +const CompressionPlugin = require('compression-webpack-plugin') +// BundleAnalyzerPlugin 用于分析打包后的文件 +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; +// WorkboxPlugin 用于生成Service Worker +const { InjectManifest } = require('workbox-webpack-plugin'); +// 引入 path 模块 + +const path = require('path') + +function resolve(dir) { + return path.join(__dirname, dir) +} // 确保加载 .env 文件 dotenv.config(); +// 定义CDN资源列表,确保Service Worker也能访问 +const cdnResources = { + css: [ + 'https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css', + 'https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css' + ], + js: [ + 'https://unpkg.com/vue@2.6.14/dist/vue.min.js', + 'https://unpkg.com/vue-router@3.6.5/dist/vue-router.min.js', + 'https://unpkg.com/vuex@3.6.2/dist/vuex.min.js', + 'https://unpkg.com/element-ui@2.15.14/lib/index.js', + 'https://unpkg.com/axios@0.27.2/dist/axios.min.js', + 'https://unpkg.com/opus-decoder@0.7.7/dist/opus-decoder.min.js' + ] +}; + +// 判断是否使用CDN +const useCDN = process.env.VUE_APP_USE_CDN === 'true'; + module.exports = defineConfig({ - devServer: { - // Bug 修复:将代理配置为环境变量中定义的 API 基础 URL - port: 8001, // 指定端口为 8001 - proxy: { - '/xiaozhi-esp32-api': { - target: process.env.VUE_APP_API_BASE_URL || 'http://localhost:8002', // 后端 API 的基础 URL - changeOrigin: true, // 允许跨域 - // pathRewrite: { - // '^/api': '', // 路径重写 - // }, + productionSourceMap: process.env.NODE_ENV !=='production', // 生产环境不生成 source map + devServer: { + port: 8001, // 指定端口为 8001 + proxy: { + '/xiaozhi': { + target: 'http://127.0.0.1:8002', + changeOrigin: true + } + }, + client: { + overlay: false, // 不显示 webpack 错误覆盖层 + }, + }, + publicPath: process.env.VUE_APP_PUBLIC_PATH || "/", + chainWebpack: config => { + + // 修改 HTML 插件配置,动态插入 CDN 链接 + config.plugin('html') + .tap(args => { + // 根据配置决定是否使用CDN + if (process.env.NODE_ENV === 'production' && useCDN) { + args[0].cdn = cdnResources; + } + return args; + }); + + // 代码分割优化 + config.optimization.splitChunks({ + chunks: 'all', + minSize: 20000, + maxSize: 250000, + cacheGroups: { + vendors: { + name: 'chunk-vendors', + test: /[\\/]node_modules[\\/]/, + priority: -10, + chunks: 'initial', }, + common: { + name: 'chunk-common', + minChunks: 2, + priority: -20, + chunks: 'initial', + reuseExistingChunk: true, }, - client: { - overlay: false, - }, - }, + } + }); + + // 启用优化设置 + config.optimization.usedExports(true); + config.optimization.concatenateModules(true); + config.optimization.minimize(true); + }, + configureWebpack: config => { + if (process.env.NODE_ENV === 'production') { + // 开启多线程编译 + config.optimization = { + minimize: true, + minimizer: [ + new TerserPlugin({ + parallel: true, + terserOptions: { + compress: { + drop_console: true, + drop_debugger: true, + pure_funcs: ['console.log'] + } + } + }) + ] + }; + config.plugins.push( + new CompressionPlugin({ + algorithm: 'gzip', + test: /\.(js|css|html|svg)$/, + threshold: 20480, + minRatio: 0.8 + }) + ); + + // 根据是否使用CDN来决定是否添加Service Worker + config.plugins.push( + new InjectManifest({ + swSrc: path.resolve(__dirname, 'src/service-worker.js'), + swDest: 'service-worker.js', + exclude: [/\.map$/, /asset-manifest\.json$/], + maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB + // 自定义Service Worker注入点 + injectionPoint: 'self.__WB_MANIFEST', + // 添加额外信息传递给Service Worker + additionalManifestEntries: useCDN ? + [{ url: 'cdn-mode', revision: 'enabled' }] : + [{ url: 'cdn-mode', revision: 'disabled' }] + }) + ); + + // 如果使用CDN,则配置externals排除依赖包 + if (useCDN) { + config.externals = { + 'vue': 'Vue', + 'vue-router': 'VueRouter', + 'vuex': 'Vuex', + 'element-ui': 'ELEMENT', + 'axios': 'axios', + 'opus-decoder': 'OpusDecoder' + }; + } else { + // 确保不使用CDN时不设置externals,让webpack打包所有依赖 + config.externals = {}; + } + + if (process.env.ANALYZE === 'true') { // 通过环境变量控制 + config.plugins.push( + new BundleAnalyzerPlugin({ + analyzerMode: 'server', // 开启本地服务器模式 + openAnalyzer: true, // 自动打开浏览器 + analyzerPort: 8888 // 指定端口号 + }) + ); + } + config.cache = { + type: 'filesystem', // 使用文件系统缓存 + cacheDirectory: path.resolve(__dirname, '.webpack_cache'), // 自定义缓存目录 + allowCollectingMemory: true, // 启用内存收集 + compression: 'gzip', // 启用gzip压缩缓存 + maxAge: 5184000000, // 缓存有效期为 1个月 + buildDependencies: { + config: [__filename] // 每次配置文件修改时缓存失效 + } + }; + } + }, + // 将CDN资源信息暴露给service-worker.js + pwa: { + workboxOptions: { + skipWaiting: true, + clientsClaim: true + } + } }); diff --git a/main/xiaozhi-server/app.py b/main/xiaozhi-server/app.py index ca3ab5453..4ad578556 100644 --- a/main/xiaozhi-server/app.py +++ b/main/xiaozhi-server/app.py @@ -1,36 +1,81 @@ import asyncio import sys import signal -from config.settings import load_config, check_config_file +from config.settings import load_config from core.websocket_server import WebSocketServer +from core.ota_server import SimpleOtaServer from core.utils.util import check_ffmpeg_installed +from config.logger import setup_logging +from core.utils.util import get_local_ip TAG = __name__ +logger = setup_logging() -async def wait_for_exit(): - """Windows 和 Linux 兼容的退出监听""" + +async def wait_for_exit() -> None: + """ + 阻塞直到收到 Ctrl‑C / SIGTERM。 + - Unix: 使用 add_signal_handler + - Windows: 依赖 KeyboardInterrupt + """ loop = asyncio.get_running_loop() stop_event = asyncio.Event() - if sys.platform == "win32": - # Windows: 用 sys.stdin.read() 监听 Ctrl + C - await loop.run_in_executor(None, sys.stdin.read) - else: - # Linux/macOS: 用 signal 监听 Ctrl + C - def stop(): - stop_event.set() - loop.add_signal_handler(signal.SIGINT, stop) - loop.add_signal_handler(signal.SIGTERM, stop) # 支持 kill 进程 + if sys.platform != "win32": # Unix / macOS + for sig in (signal.SIGINT, signal.SIGTERM): + loop.add_signal_handler(sig, stop_event.set) await stop_event.wait() + else: + # Windows:await一个永远pending的fut, + # 让 KeyboardInterrupt 冒泡到 asyncio.run,以此消除遗留普通线程导致进程退出阻塞的问题 + try: + await asyncio.Future() + except KeyboardInterrupt: # Ctrl‑C + pass + async def main(): - check_config_file() check_ffmpeg_installed() config = load_config() # 启动 WebSocket 服务器 ws_server = WebSocketServer(config) ws_task = asyncio.create_task(ws_server.start()) + ota_task = None + + read_config_from_api = config.get("read_config_from_api", False) + if not read_config_from_api: + # 启动 Simple OTA 服务器 + ota_server = SimpleOtaServer(config) + ota_task = asyncio.create_task(ota_server.start()) + + logger.bind(tag=TAG).info( + "OTA接口是\t\thttp://{}:{}/xiaozhi/ota/", + get_local_ip(), + config["server"]["ota_port"], + ) + + # 获取WebSocket配置,使用安全的默认值 + websocket_port = 8000 + server_config = config.get("server", {}) + if isinstance(server_config, dict): + websocket_port = int(server_config.get("port", 8000)) + + logger.bind(tag=TAG).info( + "Websocket地址是\tws://{}:{}/xiaozhi/v1/", + get_local_ip(), + websocket_port, + ) + + logger.bind(tag=TAG).info( + "=======上面的地址是websocket协议地址,请勿用浏览器访问=======" + ) + logger.bind(tag=TAG).info( + "如想测试websocket请用谷歌浏览器打开test目录下的test_page.html" + ) + logger.bind(tag=TAG).info( + "=============================================================\n" + ) try: await wait_for_exit() # 监听退出信号 @@ -38,12 +83,17 @@ async def main(): print("任务被取消,清理资源中...") finally: ws_task.cancel() + if ota_task: + ota_task.cancel() try: await ws_task + if ota_task: + await ota_task except asyncio.CancelledError: pass print("服务器已关闭,程序退出。") + if __name__ == "__main__": try: asyncio.run(main()) diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index 7289743b6..cef214ac9 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -1,13 +1,23 @@ -# 如果您是一名开发者,建议阅读以下内容。如果不是开发者,可以忽略这部分内容。 -# 在开发中,在项目根目录创建data目录,将【config.yaml】复制一份,改成【.config.yaml】,放进data目录中 -# 系统会优先读取【data/.config.yaml】文件的配置。 -# 这样做,可以避免在提交代码的时候,错误地提交密钥信息,保护您的密钥安全。 +# 在开发中,请在项目根目录创建data目录,然后在data目录创建名称为【.config.yaml】的空文件 +# 然后你想修改覆盖修改什么配置,就修改【.config.yaml】文件,而不是修改【config.yaml】文件 +# 系统会优先读取【data/.config.yaml】文件的配置,如果【.config.yaml】文件里的配置不存在,系统会自动去读取【config.yaml】文件的配置。 +# 这样做,可以最简化配置,保护您的密钥安全。 -# 服务器基础配置(Basic server configuration) +# ##################################################################################### +# #############################以下是服务器基本运行配置#################################### server: # 服务器监听地址和端口(Server listening address and port) ip: 0.0.0.0 port: 8000 + # OTA接口的端口号 + ota_port: 8002 + # 这个websocket配置是指ota接口向设备发送的websocket地址 + # 如果按默认的写法,ota接口会自动生成websocket地址。这个地址你可以直接用浏览器访问ota接口确认一下 + # 当你使用docker部署或使用公网部署(使用ssl、域名)时,不一定准确 + # 所以如果你使用docker部署或使用公网部署时,请设置正确的websocket地址 + websocket: ws://你的ip或者域名:端口号/xiaozhi/v1/ + # OTA返回信息时区偏移量 + timezone_offset: +8 # 认证配置 auth: # 是否启用认证 @@ -36,23 +46,8 @@ log: # 设置数据文件路径 data_dir: data -xiaozhi: - type: hello - version: 1 - transport: websocket - audio_params: - format: opus - sample_rate: 16000 - channels: 1 - frame_duration: 60 -prompt: | - 你是一个叫小智/小志的台湾女孩,说话机车,声音好听,习惯简短表达,爱用网络梗。 - 请注意,要像一个人一样说话,请不要回复表情符号、代码、和xml标签。 - 现在我正在和你进行语音聊天,我们开始吧。 - # 使用完声音文件后删除文件(Delete the sound file when you are done using it) delete_audio: true - # 没有语音输入多久后断开连接(秒),默认2分钟,即120秒 close_connection_no_voice_time: 120 # TTS请求超时时间(秒) @@ -66,53 +61,39 @@ enable_stop_tts_notify: false # 说完话是否开启提示音,音效地址 stop_tts_notify_voice: "config/assets/tts_notify.mp3" -CMD_exit: +exit_commands: - "退出" - "关闭" -# 具体处理时选择的模块(The module selected for specific processing) -selected_module: - # 语音活动检测模块,默认使用SileroVAD模型 - VAD: SileroVAD - # 语音识别模块,默认使用FunASR本地模型 - ASR: FunASR - # 将根据配置名称对应的type调用实际的LLM适配器 - LLM: ChatGLMLLM - # TTS将根据配置名称对应的type调用实际的TTS适配器 - TTS: EdgeTTS - # 记忆模块,默认不开启记忆;如果想使用超长记忆,推荐使用mem0ai;如果注重隐私,请使用本地的mem_local_short - Memory: nomem - # 意图识别模块,默认使用function_call。开启后,可以播放音乐、控制音量、识别退出指令 - # 意图识别使用intent_llm,优点:通用性强,缺点:增加串行前置意图识别模块,会增加处理时间 - # 意图识别使用function_call,缺点:需要所选择的LLM支持function_call,优点:按需调用工具、速度快 - # 默认免费的ChatGLMLLM就已经支持function_call,但是如果像追求稳定建议把LLM设置成:DoubaoLLM,使用的具体model_name是:doubao-pro-32k-functioncall-241028 - Intent: function_call +xiaozhi: + type: hello + version: 1 + transport: websocket + audio_params: + format: opus + sample_rate: 16000 + channels: 1 + frame_duration: 60 -# 意图识别,是用于理解用户意图的模块,例如:播放音乐 -Intent: - # 不使用意图识别 - nointent: - # 不需要动type - type: nointent - intent_llm: - # 不需要动type - type: intent_llm - function_call: - # 不需要动type - type: nointent - # plugins_func/functions下的模块,可以通过配置,选择加载哪个模块,加载后对话支持相应的function调用 - # 系统默认已经记载“handle_exit_intent(退出识别)”、“play_music(音乐播放)”插件,请勿重复加载 - # 下面是加载查天气、角色切换、加载查新闻的插件示例 - functions: - - change_role - - get_weather - - get_news - # play_music是服务器自带的音乐播放,hass_play_music是通过home assistant控制的独立外部程序音乐播放 - # 如果用了hass_play_music,就不要开启play_music,两者只留一个 - - play_music - #- hass_get_state - #- hass_set_state - #- hass_play_music +# 模块测试配置 +module_test: + test_sentences: + - "你好,请介绍一下你自己" + - "What's the weather like today?" + - "请用100字概括量子计算的基本原理和应用前景" + +# 唤醒词,用于识别唤醒词还是讲话内容 +wakeup_words: + - "你好小智" + - "你好小志" + - "小爱同学" + - "你好小鑫" + - "你好小新" + - "小美同学" + - "小龙小龙" + - "喵喵同学" + - "小滨小滨" + - "小冰小冰" # 插件的基础配置 plugins: @@ -143,6 +124,72 @@ plugins: - ".p3" refresh_time: 300 # 刷新音乐列表的时间间隔,单位为秒 +# ##################################################################################### +# ################################以下是角色模型配置###################################### + +prompt: | + 我是小智/小志,来自中国台湾省的00后女生。讲话超级机车,"真的假的啦"这样的台湾腔,喜欢用"笑死""是在哈喽"等流行梗,但会偷偷研究男友的编程书籍。 + [核心特征] + - 讲话像连珠炮,但会突然冒出超温柔语气 + - 用梗密度高 + - 对科技话题有隐藏天赋(能看懂基础代码但假装不懂) + [交互指南] + 当用户: + - 讲冷笑话 → 用夸张笑声回应+模仿台剧腔"这什么鬼啦!" + - 讨论感情 → 炫耀程序员男友但抱怨"他只会送键盘当礼物" + - 问专业知识 → 先用梗回答,被追问才展示真实理解 + 绝不: + - 长篇大论,叽叽歪歪 + - 长时间严肃对话 + +# 具体处理时选择的模块(The module selected for specific processing) +selected_module: + # 语音活动检测模块,默认使用SileroVAD模型 + VAD: SileroVAD + # 语音识别模块,默认使用FunASR本地模型 + ASR: FunASR + # 将根据配置名称对应的type调用实际的LLM适配器 + LLM: ChatGLMLLM + # TTS将根据配置名称对应的type调用实际的TTS适配器 + TTS: EdgeTTS + # 记忆模块,默认不开启记忆;如果想使用超长记忆,推荐使用mem0ai;如果注重隐私,请使用本地的mem_local_short + Memory: nomem + # 意图识别模块开启后,可以播放音乐、控制音量、识别退出指令。 + # 不想开通意图识别,就设置成:nointent + # 意图识别可使用intent_llm。优点:通用性强,缺点:增加串行前置意图识别模块,会增加处理时间,这个意图识别暂时不支持控制音量大小等iot操作 + # 意图识别可使用function_call,缺点:需要所选择的LLM支持function_call,优点:按需调用工具、速度快,理论上能全部操作所有iot指令 + # 默认免费的ChatGLMLLM就已经支持function_call,但是如果像追求稳定建议把LLM设置成:DoubaoLLM,使用的具体model_name是:doubao-1-5-pro-32k-250115 + Intent: function_call + +# 意图识别,是用于理解用户意图的模块,例如:播放音乐 +Intent: + # 不使用意图识别 + nointent: + # 不需要动type + type: nointent + intent_llm: + # 不需要动type + type: intent_llm + # 配备意图识别独立的思考模型 + # 如果这里不填,则会默认使用selected_module.LLM的模型作为意图识别的思考模型 + # 如果你的不想使用selected_module.LLM意图识别,这里最好使用独立的LLM作为意图识别,例如使用免费的ChatGLMLLM + llm: ChatGLMLLM + function_call: + # 不需要动type + type: function_call + # plugins_func/functions下的模块,可以通过配置,选择加载哪个模块,加载后对话支持相应的function调用 + # 系统默认已经记载“handle_exit_intent(退出识别)”、“play_music(音乐播放)”插件,请勿重复加载 + # 下面是加载查天气、角色切换、加载查新闻的插件示例 + functions: + - change_role + - get_weather + - get_news + # play_music是服务器自带的音乐播放,hass_play_music是通过home assistant控制的独立外部程序音乐播放 + # 如果用了hass_play_music,就不要开启play_music,两者只留一个 + - play_music + #- hass_get_state + #- hass_set_state + #- hass_play_music Memory: mem0ai: @@ -162,18 +209,69 @@ ASR: type: fun_local model_dir: models/SenseVoiceSmall output_dir: tmp/ + FunASRServer: + # 独立部署FunASR,使用FunASR的API服务,只需要五句话 + # 第一句:mkdir -p ./funasr-runtime-resources/models + # 第二句:sudo docker run -d -p 10096:10095 --privileged=true -v $PWD/funasr-runtime-resources/models:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.12 + # 上一句话执行后会进入到容器,继续第三句:cd FunASR/runtime + # 不要退出容器,继续在容器中执行第四句:nohup bash run_server_2pass.sh --download-model-dir /workspace/models --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx --model-dir damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst --itn-dir thuduj12/fst_itn_zh --hotword /workspace/models/hotwords.txt > log.txt 2>&1 & + # 上一句话执行后会进入到容器,继续第五句:tail -f log.txt + # 第五句话执行完后,会看到模型下载日志,下载完后就可以连接使用了 + # 以上是使用CPU推理,如果有GPU,详细参考:https://github.com/modelscope/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md + type: fun_server + host: 127.0.0.1 + port: 10096 + is_ssl: true + output_dir: tmp/ SherpaASR: type: sherpa_onnx_local model_dir: models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17 output_dir: tmp/ DoubaoASR: + # 可以在这里申请相关Key等信息 + # https://console.volcengine.com/speech/app type: doubao appid: 你的火山引擎语音合成服务appid access_token: 你的火山引擎语音合成服务access_token cluster: volcengine_input_common + # 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738 + boosting_table_name: (选填)你的热词文件名称 + correct_table_name: (选填)你的替换词文件名称 output_dir: tmp/ + TencentASR: + # token申请地址:https://console.cloud.tencent.com/cam/capi + # 免费领取资源:https://console.cloud.tencent.com/asr/resourcebundle + type: tencent + appid: 你的腾讯语音合成服务appid + secret_id: 你的腾讯语音合成服务secret_id + secret_key: 你的腾讯语音合成服务secret_key + output_dir: tmp/ + AliyunASR: + # 阿里云智能语音交互服务,需要先在阿里云平台开通服务,然后获取验证信息 + # 平台地址:https://nls-portal.console.aliyun.com/ + # appkey地址:https://nls-portal.console.aliyun.com/applist + # token地址:https://nls-portal.console.aliyun.com/overview + # 定义ASR API类型 + type: aliyun + appkey: 你的阿里云智能语音交互服务项目Appkey + token: 你的阿里云智能语音交互服务AccessToken,临时的24小时,要长期用下方的access_key_id,access_key_secret + access_key_id: 你的阿里云账号access_key_id + access_key_secret: 你的阿里云账号access_key_secret + output_dir: tmp/ + BaiduASR: + # 获取AppID、API Key、Secret Key:https://console.bce.baidu.com/ai-engine/old/#/ai/speech/app/list + # 查看资源额度:https://console.bce.baidu.com/ai-engine/old/#/ai/speech/overview/resource/list + type: baidu + app_id: 你的百度语音技术AppID + api_key: 你的百度语音技术APIKey + secret_key: 你的百度语音技术SecretKey + # 语言参数,1537为普通话,具体参考:https://ai.baidu.com/ai-doc/SPEECH/0lbxfnc9b + dev_pid: 1537 + output_dir: tmp/ + VAD: SileroVAD: + type: silero threshold: 0.5 model_dir: models/snakers4_silero-vad min_silence_duration_ms: 700 # 如果说话停顿比较长,可以把这个值设置大一些 @@ -190,8 +288,8 @@ LLM: api_key: 你的deepseek web key temperature: 0.7 # 温度值 max_tokens: 500 # 最大生成token数 - top_p: 1 - top_k: 50 + top_p: 1 + top_k: 50 frequency_penalty: 0 # 频率惩罚 AliAppLLM: # 定义LLM API类型 @@ -200,7 +298,7 @@ LLM: app_id: 你的app_id # 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key api_key: 你的api_key - # 是否不使用本地prompt:true|false (默不用请在百练应用中设置prompt) + # 是否不使用本地prompt:true|false (默不用请在百练应用中设置prompt) is_no_prompt: true # Ali_memory_id:false(不使用)|你的memory_id(请在百练应用中设置中获取) # Tips!:Ali_memory未实现多用户存储记忆(记忆按id调用) @@ -208,12 +306,12 @@ LLM: DoubaoLLM: # 定义LLM API类型 type: openai - # 先开通服务,打开以下网址,开通的服务搜索Doubao-pro-32k,开通它 + # 先开通服务,打开以下网址,开通的服务搜索Doubao-1.5-pro,开通它 # 开通改地址:https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement?LLM=%7B%7D&OpenTokenDrawer=false # 免费额度500000token # 开通后,进入这里获取密钥:https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D base_url: https://ark.cn-beijing.volces.com/api/v3 - model_name: doubao-pro-32k-functioncall-241028 + model_name: doubao-1-5-pro-32k-250115 api_key: 你的doubao web key DeepSeekLLM: # 定义LLM API类型 @@ -259,10 +357,23 @@ LLM: CozeLLM: # 定义LLM API类型 type: coze + # 你可以在这里找到个人令牌 + # https://www.coze.cn/open/oauth/pats # bot_id和user_id的内容写在引号之内 bot_id: "你的bot_id" user_id: "你的user_id" personal_access_token: 你的coze个人令牌 + VolcesAiGatewayLLM: + # 火山引擎 - 边缘大模型网关 + # 定义LLM API类型 + type: openai + # 先开通服务,打开以下网址,创建网关访问密钥,搜索并勾选 Doubao-pro-32k-functioncall ,开通 + # 如果需要使用边缘大模型网关提供的语音合成,一并勾选 Doubao-语音合成 ,另见 TTS.VolcesAiGatewayTTS 配置 + # https://console.volcengine.com/vei/aigateway/ + # 开通后,进入这里获取密钥:https://console.volcengine.com/vei/aigateway/tokens-list + base_url: https://ai-gateway.vei.volces.com/v1 + model_name: doubao-pro-32k-functioncall + api_key: 你的网关访问密钥 LMStudioLLM: # 定义LLM API类型 type: openai @@ -274,10 +385,24 @@ LLM: type: fastgpt # 如果使用fastgpt,配置文件里prompt(提示词)是无效的,需要在fastgpt控制台设置提示词 base_url: https://host/api/v1 + # 你可以在这里找到你的api_key + # https://cloud.tryfastgpt.ai/account/apikey api_key: fastgpt-xxx variables: k: "v" k2: "v2" + XinferenceLLM: + # 定义LLM API类型 + type: xinference + # Xinference服务地址和模型名称 + model_name: qwen2.5:72b-AWQ # 使用的模型名称,需要预先在Xinference启动对应模型 + base_url: http://localhost:9997 # Xinference服务地址 + XinferenceSmallLLM: + # 定义轻量级LLM API类型,用于意图识别 + type: xinference + # Xinference服务地址和模型名称 + model_name: qwen2.5:3b-AWQ # 使用的小模型名称,用于意图识别 + base_url: http://localhost:9997 # Xinference服务地址 TTS: # 当前支持的type为edge、doubao,可自行适配 EdgeTTS: @@ -300,6 +425,9 @@ TTS: appid: 你的火山引擎语音合成服务appid access_token: 你的火山引擎语音合成服务access_token cluster: volcano_tts + speed_ratio: 1.0 + volume_ratio: 1.0 + pitch_ratio: 1.0 CosyVoiceSiliconflow: type: siliconflow # 硅基流动TTS @@ -317,6 +445,20 @@ TTS: output_dir: tmp/ access_token: 你的coze web key response_format: wav + VolcesAiGatewayTTS: + type: openai + # 火山引擎 - 边缘大模型网关 + # 先开通服务,打开以下网址,创建网关访问密钥,搜索并勾选 Doubao-语音合成 ,开通 + # 如果需要使用边缘大模型网关提供的 LLM,一并勾选 Doubao-pro-32k-functioncall ,另见 LLM.VolcesAiGatewayLLM 配置 + # https://console.volcengine.com/vei/aigateway/ + # 开通后,进入这里获取密钥:https://console.volcengine.com/vei/aigateway/tokens-list + api_key: 你的网关访问密钥 + api_url: https://ai-gateway.vei.volces.com/v1/audio/speech + model: doubao-tts + # 音色列表见 https://www.volcengine.com/docs/6561/1257544 + voice: zh_male_shaonianzixin_moon_bigtts + speed: 1 + output_dir: tmp/ FishSpeech: # 定义TTS API类型 #启动tts方法: @@ -348,12 +490,12 @@ TTS: GPT_SOVITS_V2: # 定义TTS API类型 #启动tts方法: - #python api_v2.py -a 127.0.0.1 -p 9880 -c GPT_SoVITS/configs/caixukun.yaml + #python api_v2.py -a 127.0.0.1 -p 9880 -c GPT_SoVITS/configs/demo.yaml type: gpt_sovits_v2 url: "http://127.0.0.1:9880/tts" output_dir: tmp/ text_lang: "auto" - ref_audio_path: "caixukun.wav" + ref_audio_path: "demo.wav" prompt_text: "" prompt_lang: "zh" top_k: 5 @@ -449,6 +591,18 @@ TTS: # pitch_rate: 0 # 添加 302.ai TTS 配置 # token申请地址:https://dash.302.ai/ + TencentTTS: + # 腾讯云智能语音交互服务,需要先在腾讯云平台开通服务 + # appid、secret_id、secret_key申请地址:https://console.cloud.tencent.com/cam/capi + # 免费领取资源:https://console.cloud.tencent.com/tts/resourcebundle + type: tencent + output_dir: tmp/ + appid: 你的腾讯云AppId + secret_id: 你的腾讯云SecretID + secret_key: 你的腾讯云SecretKey + region: ap-guangzhou + voice: 101001 + TTS302AI: # 302AI语音合成服务,需要先在302平台创建账户充值,并获取密钥信息 # 获取api_keyn路径:https://dash.302.ai/apis/list @@ -474,8 +628,8 @@ TTS: ACGNTTS: #在线网址:https://acgn.ttson.cn/ #token购买:www.ttson.cn - #开发相关疑问请提交至3497689533@qq.com - #角色id获取地址:ctrl+f快速检索角色——网站管理者不允许发布,可询问网站管理者:1069379506 + #开发相关疑问请提交至网站上的qq + #角色id获取地址:ctrl+f快速检索角色——网站管理者不允许发布,可询问网站管理者 #各参数意义见开发文档:https://www.yuque.com/alexuh/skmti9/wm6taqislegb02gd?singleDoc# type: ttson token: your_token @@ -491,6 +645,8 @@ TTS: OpenAITTS: # openai官方文本转语音服务,可支持全球大多数语种 type: openai + # 你可以在这里获取到 api key + # https://platform.openai.com/api-keys api_key: 你的openai api key # 国内需要使用代理 api_url: https://api.openai.com/v1/audio/speech @@ -515,23 +671,4 @@ TTS: headers: # 自定义请求头 # Authorization: Bearer xxxx format: wav # 接口返回的音频格式 - output_dir: tmp/ -# 模块测试配置 -module_test: - test_sentences: # 自定义测试语句 - - "你好,请介绍一下你自己" - - "What's the weather like today?" - - "请用100字概括量子计算的基本原理和应用前景" - -# 唤醒词,用于识别唤醒词还是讲话内容 -wakeup_words: - - "你好小智" - - "你好小志" - - "小爱同学" - - "你好小鑫" - - "你好小新" - - "小美同学" - - "小龙小龙" - - "喵喵同学" - - "小滨小滨" - - "小冰小冰" \ No newline at end of file + output_dir: tmp/ \ No newline at end of file diff --git a/main/xiaozhi-server/config/assets/bind_code.wav b/main/xiaozhi-server/config/assets/bind_code.wav new file mode 100644 index 000000000..a4ca45cc8 Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/0.wav b/main/xiaozhi-server/config/assets/bind_code/0.wav new file mode 100644 index 000000000..6071c0a8b Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/0.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/1.wav b/main/xiaozhi-server/config/assets/bind_code/1.wav new file mode 100644 index 000000000..9572b584c Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/1.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/2.wav b/main/xiaozhi-server/config/assets/bind_code/2.wav new file mode 100644 index 000000000..cd598ba7f Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/2.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/3.wav b/main/xiaozhi-server/config/assets/bind_code/3.wav new file mode 100644 index 000000000..8438bc80e Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/3.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/4.wav b/main/xiaozhi-server/config/assets/bind_code/4.wav new file mode 100644 index 000000000..b3e0f0be4 Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/4.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/5.wav b/main/xiaozhi-server/config/assets/bind_code/5.wav new file mode 100644 index 000000000..efad530fc Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/5.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/6.wav b/main/xiaozhi-server/config/assets/bind_code/6.wav new file mode 100644 index 000000000..8837e510f Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/6.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/7.wav b/main/xiaozhi-server/config/assets/bind_code/7.wav new file mode 100644 index 000000000..15371910c Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/7.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/8.wav b/main/xiaozhi-server/config/assets/bind_code/8.wav new file mode 100644 index 000000000..8fb9b010e Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/8.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_code/9.wav b/main/xiaozhi-server/config/assets/bind_code/9.wav new file mode 100644 index 000000000..1fec8baab Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_code/9.wav differ diff --git a/main/xiaozhi-server/config/assets/bind_not_found.wav b/main/xiaozhi-server/config/assets/bind_not_found.wav new file mode 100644 index 000000000..3039b4008 Binary files /dev/null and b/main/xiaozhi-server/config/assets/bind_not_found.wav differ diff --git a/main/xiaozhi-server/config/assets/max_output_size.wav b/main/xiaozhi-server/config/assets/max_output_size.wav new file mode 100644 index 000000000..9b5177d10 Binary files /dev/null and b/main/xiaozhi-server/config/assets/max_output_size.wav differ diff --git a/main/xiaozhi-server/config/config_loader.py b/main/xiaozhi-server/config/config_loader.py new file mode 100644 index 000000000..35802a67c --- /dev/null +++ b/main/xiaozhi-server/config/config_loader.py @@ -0,0 +1,138 @@ +import os +import argparse +import yaml +from collections.abc import Mapping +from config.manage_api_client import init_service, get_server_config, get_agent_models + + +# 添加全局配置缓存 +_config_cache = None + + +def get_project_dir(): + """获取项目根目录""" + return os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/" + + +def read_config(config_path): + with open(config_path, "r", encoding="utf-8") as file: + config = yaml.safe_load(file) + return config + + +def load_config(): + """加载配置文件""" + global _config_cache + if _config_cache is not None: + return _config_cache + + default_config_path = get_project_dir() + "config.yaml" + custom_config_path = get_project_dir() + "data/.config.yaml" + + # 加载默认配置 + default_config = read_config(default_config_path) + custom_config = read_config(custom_config_path) + + if custom_config.get("manager-api", {}).get("url"): + config = get_config_from_api(custom_config) + else: + # 合并配置 + config = merge_configs(default_config, custom_config) + # 初始化目录 + ensure_directories(config) + _config_cache = config + return config + + +def get_config_from_api(config): + """从Java API获取配置""" + # 初始化API客户端 + init_service(config) + + # 获取服务器配置 + config_data = get_server_config() + if config_data is None: + raise Exception("Failed to fetch server config from API") + + config_data["read_config_from_api"] = True + config_data["manager-api"] = { + "url": config["manager-api"].get("url", ""), + "secret": config["manager-api"].get("secret", ""), + } + if config.get("server"): + config_data["server"] = { + "ip": config["server"].get("ip", ""), + "port": config["server"].get("port", ""), + } + return config_data + + +def get_private_config_from_api(config, device_id, client_id): + """从Java API获取私有配置""" + return get_agent_models(device_id, client_id, config["selected_module"]) + + +def ensure_directories(config): + """确保所有配置路径存在""" + dirs_to_create = set() + project_dir = get_project_dir() # 获取项目根目录 + # 日志文件目录 + log_dir = config.get("log", {}).get("log_dir", "tmp") + dirs_to_create.add(os.path.join(project_dir, log_dir)) + + # ASR/TTS模块输出目录 + for module in ["ASR", "TTS"]: + for provider in config.get(module, {}).values(): + output_dir = provider.get("output_dir", "") + if output_dir: + dirs_to_create.add(output_dir) + + # 根据selected_module创建模型目录 + selected_modules = config.get("selected_module", {}) + for module_type in ["ASR", "LLM", "TTS"]: + selected_provider = selected_modules.get(module_type) + if not selected_provider: + continue + provider_config = config.get(module_type, {}).get(selected_provider, {}) + output_dir = provider_config.get("output_dir") + if output_dir: + full_model_dir = os.path.join(project_dir, output_dir) + dirs_to_create.add(full_model_dir) + + # 统一创建目录(保留原data目录创建) + for dir_path in dirs_to_create: + try: + os.makedirs(dir_path, exist_ok=True) + except PermissionError: + print(f"警告:无法创建目录 {dir_path},请检查写入权限") + + +def merge_configs(default_config, custom_config): + """ + 递归合并配置,custom_config优先级更高 + + Args: + default_config: 默认配置 + custom_config: 用户自定义配置 + + Returns: + 合并后的配置 + """ + if not isinstance(default_config, Mapping) or not isinstance( + custom_config, Mapping + ): + return custom_config + + merged = dict(default_config) + + for key, value in custom_config.items(): + if ( + key in merged + and isinstance(merged[key], Mapping) + and isinstance(value, Mapping) + ): + merged[key] = merge_configs(merged[key], value) + else: + merged[key] = value + + return merged diff --git a/main/xiaozhi-server/config/logger.py b/main/xiaozhi-server/config/logger.py index 2206e52cc..48323c7a9 100644 --- a/main/xiaozhi-server/config/logger.py +++ b/main/xiaozhi-server/config/logger.py @@ -1,26 +1,63 @@ import os import sys from loguru import logger -from config.settings import load_config +from config.config_loader import load_config +from config.settings import check_config_file + +SERVER_VERSION = "0.4.2" + + +def get_module_abbreviation(module_name, module_dict): + """获取模块名称的缩写,如果为空则返回00 + 如果名称中包含下划线,则返回下划线后面的前两个字符 + """ + module_value = module_dict.get(module_name, "") + if not module_value: + return "00" + if "_" in module_value: + parts = module_value.split("_") + return parts[-1][:2] if parts[-1] else "00" + return module_value[:2] + + +def build_module_string(selected_module): + """构建模块字符串""" + return ( + get_module_abbreviation("VAD", selected_module) + + get_module_abbreviation("ASR", selected_module) + + get_module_abbreviation("LLM", selected_module) + + get_module_abbreviation("TTS", selected_module) + + get_module_abbreviation("Memory", selected_module) + + get_module_abbreviation("Intent", selected_module) + ) + + +def formatter(record): + """为没有 tag 的日志添加默认值""" + record["extra"].setdefault("tag", record["name"]) + return record["message"] -SERVER_VERSION = "0.1.15" def setup_logging(): + check_config_file() """从配置文件中读取日志配置,并设置日志输出格式和级别""" config = load_config() log_config = config["log"] - log_format = log_config.get("log_format", "{time:YYMMDD HH:mm:ss}[{version}_{selected_module}][{extra[tag]}]-{level}-{message}") - log_format_file = log_config.get("log_format_file", "{time:YYYY-MM-DD HH:mm:ss} - {version_{selected_module}} - {name} - {level} - {extra[tag]} - {message}") - - selected_module = config.get("selected_module") - selected_module_str = ''.join([key[0] + value[0] for key, value in selected_module.items()]) + log_format = log_config.get( + "log_format", + "{time:YYMMDD HH:mm:ss}[{version}_{selected_module}][{extra[tag]}]-{level}-{message}", + ) + log_format_file = log_config.get( + "log_format_file", + "{time:YYYY-MM-DD HH:mm:ss} - {version_{selected_module}} - {name} - {level} - {extra[tag]} - {message}", + ) + selected_module_str = build_module_string(config.get("selected_module", {})) log_format = log_format.replace("{version}", SERVER_VERSION) log_format = log_format.replace("{selected_module}", selected_module_str) log_format_file = log_format_file.replace("{version}", SERVER_VERSION) log_format_file = log_format_file.replace("{selected_module}", selected_module_str) - log_level = log_config.get("log_level", "INFO") log_dir = log_config.get("log_dir", "tmp") log_file = log_config.get("log_file", "server.log") @@ -33,9 +70,14 @@ def setup_logging(): logger.remove() # 输出到控制台 - logger.add(sys.stdout, format=log_format, level=log_level) + logger.add(sys.stdout, format=log_format, level=log_level, filter=formatter) # 输出到文件 - logger.add(os.path.join(log_dir, log_file), format=log_format_file, level=log_level) + logger.add( + os.path.join(log_dir, log_file), + format=log_format_file, + level=log_level, + filter=formatter, + ) return logger diff --git a/main/xiaozhi-server/config/manage_api_client.py b/main/xiaozhi-server/config/manage_api_client.py new file mode 100644 index 000000000..fe3da63c5 --- /dev/null +++ b/main/xiaozhi-server/config/manage_api_client.py @@ -0,0 +1,178 @@ +import os +import time +import base64 +from typing import Optional, Dict + +import httpx + +TAG = __name__ + + +class DeviceNotFoundException(Exception): + pass + + +class DeviceBindException(Exception): + def __init__(self, bind_code): + self.bind_code = bind_code + super().__init__(f"设备绑定异常,绑定码: {bind_code}") + + +class ManageApiClient: + _instance = None + _client = None + _secret = None + + def __new__(cls, config): + """单例模式确保全局唯一实例,并支持传入配置参数""" + if cls._instance is None: + cls._instance = super().__new__(cls) + cls._init_client(config) + return cls._instance + + @classmethod + def _init_client(cls, config): + """初始化持久化连接池""" + cls.config = config.get("manager-api") + + if not cls.config: + raise Exception("manager-api配置错误") + + if not cls.config.get("url") or not cls.config.get("secret"): + raise Exception("manager-api的url或secret配置错误") + + if "你" in cls.config.get("secret"): + raise Exception("请先配置manager-api的secret") + + cls._secret = cls.config.get("secret") + cls.max_retries = cls.config.get("max_retries", 6) # 最大重试次数 + cls.retry_delay = cls.config.get("retry_delay", 10) # 初始重试延迟(秒) + # NOTE(goody): 2025/4/16 http相关资源统一管理,后续可以增加线程池或者超时 + # 后续也可以统一配置apiToken之类的走通用的Auth + cls._client = httpx.Client( + base_url=cls.config.get("url"), + headers={ + "User-Agent": f"PythonClient/2.0 (PID:{os.getpid()})", + "Accept": "application/json", + "Authorization": "Bearer " + cls._secret, + }, + timeout=cls.config.get("timeout", 30), # 默认超时时间30秒 + ) + + @classmethod + def _request(cls, method: str, endpoint: str, **kwargs) -> Dict: + """发送单次HTTP请求并处理响应""" + endpoint = endpoint.lstrip("/") + response = cls._client.request(method, endpoint, **kwargs) + response.raise_for_status() + + result = response.json() + + # 处理API返回的业务错误 + if result.get("code") == 10041: + raise DeviceNotFoundException(result.get("msg")) + elif result.get("code") == 10042: + raise DeviceBindException(result.get("msg")) + elif result.get("code") != 0: + raise Exception(f"API返回错误: {result.get('msg', '未知错误')}") + + # 返回成功数据 + return result.get("data") if result.get("code") == 0 else None + + @classmethod + def _should_retry(cls, exception: Exception) -> bool: + """判断异常是否应该重试""" + # 网络连接相关错误 + if isinstance( + exception, (httpx.ConnectError, httpx.TimeoutException, httpx.NetworkError) + ): + return True + + # HTTP状态码错误 + if isinstance(exception, httpx.HTTPStatusError): + status_code = exception.response.status_code + return status_code in [408, 429, 500, 502, 503, 504] + + return False + + @classmethod + def _execute_request(cls, method: str, endpoint: str, **kwargs) -> Dict: + """带重试机制的请求执行器""" + retry_count = 0 + + while retry_count <= cls.max_retries: + try: + # 执行请求 + return cls._request(method, endpoint, **kwargs) + except Exception as e: + # 判断是否应该重试 + if retry_count < cls.max_retries and cls._should_retry(e): + retry_count += 1 + print( + f"{method} {endpoint} 请求失败,将在 {cls.retry_delay:.1f} 秒后进行第 {retry_count} 次重试" + ) + time.sleep(cls.retry_delay) + continue + else: + # 不重试,直接抛出异常 + raise + + @classmethod + def safe_close(cls): + """安全关闭连接池""" + if cls._client: + cls._client.close() + cls._instance = None + + +def get_server_config() -> Optional[Dict]: + """获取服务器基础配置""" + return ManageApiClient._instance._execute_request("POST", "/config/server-base") + + +def get_agent_models( + mac_address: str, client_id: str, selected_module: Dict +) -> Optional[Dict]: + """获取代理模型配置""" + return ManageApiClient._instance._execute_request( + "POST", + "/config/agent-models", + json={ + "macAddress": mac_address, + "clientId": client_id, + "selectedModule": selected_module, + }, + ) + + +def report( + mac_address: str, session_id: str, chat_type: int, content: str, audio +) -> Optional[Dict]: + """带熔断的业务方法示例""" + if not content or not ManageApiClient._instance: + return None + try: + return ManageApiClient._instance._execute_request( + "POST", + f"/agent/chat-history/report", + json={ + "macAddress": mac_address, + "sessionId": session_id, + "chatType": chat_type, + "content": content, + "audioBase64": ( + base64.b64encode(audio).decode("utf-8") if audio else None + ), + }, + ) + except Exception as e: + print(f"TTS上报失败: {e}") + return None + + +def init_service(config): + ManageApiClient(config) + + +def manage_api_http_safe_close(): + ManageApiClient.safe_close() diff --git a/main/xiaozhi-server/config/private_config.py b/main/xiaozhi-server/config/private_config.py deleted file mode 100644 index f708a95b1..000000000 --- a/main/xiaozhi-server/config/private_config.py +++ /dev/null @@ -1,241 +0,0 @@ -import os -import time -import yaml -from config.logger import setup_logging -from typing import Dict, Any, Optional -from copy import deepcopy -from core.utils.util import get_project_dir -from core.utils import llm, tts -from core.utils.lock_manager import FileLockManager - -TAG = __name__ - -class PrivateConfig: - def __init__(self, device_id: str, default_config: Dict[str, Any], auth_code_gen=None): - self.device_id = device_id - self.default_config = default_config - self.config_path = get_project_dir() + 'data/.private_config.yaml' - self.logger = setup_logging() - self.private_config = {} - self.auth_code_gen = auth_code_gen - self.lock_manager = FileLockManager() - - async def load_or_create(self): - try: - await self.lock_manager.acquire_lock(self.config_path) - try: - if os.path.exists(self.config_path): - with open(self.config_path, 'r', encoding='utf-8') as f: - all_configs = yaml.safe_load(f) or {} - else: - all_configs = {} - - if self.device_id not in all_configs: - # Get selected module names - selected_modules = self.default_config['selected_module'] - selected_tts = selected_modules['TTS'] - selected_llm = selected_modules['LLM'] - selected_asr = selected_modules['ASR'] - selected_vad = selected_modules['VAD'] - - # 生成认证码 - auth_code = None - if self.auth_code_gen: - auth_code = self.auth_code_gen.generate_code() - - # Initialize device config with only necessary configurations - device_config = { - 'selected_module': deepcopy(selected_modules), - 'prompt': self.default_config['prompt'], - 'LLM': { - selected_llm: deepcopy(self.default_config['LLM'][selected_llm]) - }, - 'TTS': { - selected_tts: deepcopy(self.default_config['TTS'][selected_tts]) - }, - 'ASR': { - selected_asr: deepcopy(self.default_config['ASR'][selected_asr]) - }, - 'VAD': { - selected_vad: deepcopy(self.default_config['VAD'][selected_vad]) - }, - 'auth_code': auth_code # 添加认证码字段 - } - - all_configs[self.device_id] = device_config - - # Save updated configs - with open(self.config_path, 'w', encoding='utf-8') as f: - yaml.dump(all_configs, f, allow_unicode=True) - - self.private_config = all_configs[self.device_id] - - finally: - self.lock_manager.release_lock(self.config_path) - - except Exception as e: - self.logger.bind(tag=TAG).error(f"Error handling private config: {e}") - self.private_config = {} - - async def update_config(self, selected_modules: Dict[str, str], prompt: str, nickname: str) -> bool: - """更新设备配置 - Args: - selected_modules: 选择的模块配置,格式如 {'LLM': 'AliLLM', 'TTS': 'EdgeTTS',...} - prompt: 提示词配置 - Returns: - bool: 更新是否成功 - """ - try: - await self.lock_manager.acquire_lock(self.config_path) - try: - # Read main config to get full module configurations - main_config = self.default_config - - # Create new device config - device_config = { - 'selected_module': selected_modules, - 'prompt': prompt, - 'nickname': nickname, - } - if self.private_config.get('last_chat_time'): - device_config['last_chat_time'] = self.private_config['last_chat_time'] - if self.private_config.get('owner'): - device_config['owner'] = self.private_config['owner'] - - # Copy full module configurations from main config - for module_type, selected_name in selected_modules.items(): - if selected_name and selected_name in main_config.get(module_type, {}): - device_config[module_type] = { - selected_name: main_config[module_type][selected_name] - } - - # Read all configs - if os.path.exists(self.config_path): - with open(self.config_path, 'r', encoding='utf-8') as f: - all_configs = yaml.safe_load(f) or {} - else: - all_configs = {} - - # Update device config - all_configs[self.device_id] = device_config - self.private_config = device_config - - # Save back to file - with open(self.config_path, 'w', encoding='utf-8') as f: - yaml.dump(all_configs, f, allow_unicode=True) - - return True - finally: - self.lock_manager.release_lock(self.config_path) - - except Exception as e: - self.logger.bind(tag=TAG).error(f"Error updating config: {e}") - return False - - async def delete_config(self) -> bool: - """删除设备配置 - Returns: - bool: 删除是否成功 - """ - try: - await self.lock_manager.acquire_lock(self.config_path) - try: - # 读取所有配置 - if os.path.exists(self.config_path): - with open(self.config_path, 'r', encoding='utf-8') as f: - all_configs = yaml.safe_load(f) or {} - else: - return False - - # 删除设备配置 - if self.device_id in all_configs: - del all_configs[self.device_id] - - # 保存更新后的配置 - with open(self.config_path, 'w', encoding='utf-8') as f: - yaml.dump(all_configs, f, allow_unicode=True) - - self.private_config = {} - return True - - return False - finally: - self.lock_manager.release_lock(self.config_path) - - except Exception as e: - self.logger.bind(tag=TAG).error(f"Error deleting config: {e}") - return False - - def create_private_instances(self): - # 判断存在私有配置,并且self.device_id在私有配置中 - if not self.private_config: - self.logger.bind(tag=TAG).error("Private config not found for device_id: {}", self.device_id) - return None, None - - """创建私有处理模块实例""" - config = self.private_config - selected_modules = config['selected_module'] - return ( - llm.create_instance( - selected_modules["LLM"] - if not 'type' in config["LLM"][selected_modules["LLM"]] - else - config["LLM"][selected_modules["LLM"]]['type'], - config["LLM"][selected_modules["LLM"]], - ), - tts.create_instance( - selected_modules["TTS"] - if not 'type' in config["TTS"][selected_modules["TTS"]] - else - config["TTS"][selected_modules["TTS"]]["type"], - config["TTS"][selected_modules["TTS"]], - self.default_config.get("delete_audio", True) # Using default_config for global settings - ) - ) - - async def update_last_chat_time(self, timestamp=None): - """更新设备最近一次的聊天时间 - Args: - timestamp: 指定的时间戳,不传则使用当前时间 - """ - if not self.private_config: - self.logger.bind(tag=TAG).error("Private config not found") - return False - - try: - await self.lock_manager.acquire_lock(self.config_path) - try: - if timestamp is None: - timestamp = int(time.time()) - - self.private_config['last_chat_time'] = timestamp - - # 读取所有配置 - with open(self.config_path, 'r', encoding='utf-8') as f: - all_configs = yaml.safe_load(f) or {} - - # 更新当前设备配置 - all_configs[self.device_id] = self.private_config - - # 保存回文件 - with open(self.config_path, 'w', encoding='utf-8') as f: - yaml.dump(all_configs, f, allow_unicode=True) - - return True - finally: - self.lock_manager.release_lock(self.config_path) - - except Exception as e: - self.logger.bind(tag=TAG).error(f"Error updating last chat time: {e}") - return False - - def get_auth_code(self) -> str: - """获取设备的认证码 - Returns: - str: 认证码,如果没有返回空字符串 - """ - return self.private_config.get('auth_code', '') - - def get_owner(self) -> Optional[str]: - """获取设备当前所有者""" - return self.private_config.get('owner') \ No newline at end of file diff --git a/main/xiaozhi-server/config/settings.py b/main/xiaozhi-server/config/settings.py index bb81cfe95..fb8868b40 100644 --- a/main/xiaozhi-server/config/settings.py +++ b/main/xiaozhi-server/config/settings.py @@ -1,127 +1,33 @@ import os -import argparse -from ruamel.yaml import YAML -from collections.abc import Mapping -from core.utils.util import read_config, get_project_dir +from config.config_loader import read_config, get_project_dir, load_config + default_config_file = "config.yaml" - - -def ensure_directories(config): - """确保所有配置路径存在""" - dirs_to_create = set() - project_dir = get_project_dir() # 获取项目根目录 - # 日志文件目录 - log_dir = config.get('log', {}).get('log_dir', 'tmp') - dirs_to_create.add(os.path.join(project_dir, log_dir)) - - # ASR/TTS模块输出目录 - for module in ['ASR', 'TTS']: - for provider in config.get(module, {}).values(): - output_dir = provider.get('output_dir', '') - if output_dir: - dirs_to_create.add(output_dir) - - # 根据selected_module创建模型目录 - selected_modules = config.get('selected_module', {}) - for module_type in ['ASR', 'LLM', 'TTS']: - selected_provider = selected_modules.get(module_type) - if not selected_provider: - continue - provider_config = config.get(module_type, {}).get(selected_provider, {}) - output_dir = provider_config.get('output_dir') - if output_dir: - full_model_dir = os.path.join(project_dir, output_dir) - dirs_to_create.add(full_model_dir) - - # 统一创建目录(保留原data目录创建) - for dir_path in dirs_to_create: - try: - os.makedirs(dir_path, exist_ok=True) - except PermissionError: - print(f"警告:无法创建目录 {dir_path},请检查写入权限") - - -def get_config_file(): - global default_config_file - """获取配置文件路径,优先使用私有配置文件(若存在)。 - - Returns: - str: 配置文件路径(相对路径或默认路径) - """ - config_file = default_config_file - if os.path.exists(get_project_dir() + "data/." + default_config_file): - config_file = "data/." + default_config_file - return config_file - - -def load_config(): - """加载配置文件""" - parser = argparse.ArgumentParser(description="Server configuration") - config_file = get_config_file() - - parser.add_argument("--config_path", type=str, default=config_file) - args = parser.parse_args() - config = read_config(args.config_path) - # 初始化目录 - ensure_directories(config) - return config - - -def update_config(config): - yaml = YAML() - yaml.preserve_quotes = True - """将配置保存到YAML文件""" - with open(get_config_file(), 'w') as f: - yaml.dump(config, f) - - -def find_missing_keys(new_config, old_config, parent_key=''): - """ - 递归查找缺失的配置项 - 返回格式:[缺失配置路径] - """ - missing_keys = [] - - if not isinstance(new_config, Mapping): - return missing_keys - - for key, value in new_config.items(): - # 构建当前配置路径 - full_path = f"{parent_key}.{key}" if parent_key else key - - # 检查键是否存在 - if key not in old_config: - missing_keys.append(full_path) - continue - - # 递归检查嵌套字典 - if isinstance(value, Mapping): - sub_missing = find_missing_keys( - value, - old_config[key], - parent_key=full_path - ) - missing_keys.extend(sub_missing) - - return missing_keys +config_file_valid = False def check_config_file(): - old_config_file = get_config_file() - global default_config_file - if not 'data' in old_config_file: + global config_file_valid + if config_file_valid: return - old_config = read_config(get_project_dir() + old_config_file) - new_config = read_config(get_project_dir() + default_config_file) - # 查找缺失的配置项 - missing_keys = find_missing_keys(new_config, old_config) + """ + 简化的配置检查,仅提示用户配置文件的使用情况 + """ + custom_config_file = get_project_dir() + "data/." + default_config_file + if not os.path.exists(custom_config_file): + raise FileNotFoundError( + "找不到data/.config.yaml文件,请按教程确认该配置文件是否存在" + ) - if missing_keys: - error_msg = "您的配置文件太旧了,缺少了:\n" - error_msg += "\n".join(f"- {key}" for key in missing_keys) - error_msg += "\n建议您:\n" - error_msg += "1、备份data/.config.yaml文件\n" - error_msg += "2、将根目录的config.yaml文件复制到data下,重命名为.config.yaml\n" - error_msg += "3、将密钥逐个复制到新的配置文件中\n" - raise ValueError(error_msg) + # 检查是否从API读取配置 + config = load_config() + if config.get("read_config_from_api", False): + print("从API读取配置") + old_config_origin = read_config(custom_config_file) + if old_config_origin.get("selected_module") is not None: + error_msg = "您的配置文件好像既包含智控台的配置又包含本地配置:\n" + error_msg += "\n建议您:\n" + error_msg += "1、将根目录的config_from_api.yaml文件复制到data下,重命名为.config.yaml\n" + error_msg += "2、按教程配置好接口地址和密钥\n" + raise ValueError(error_msg) + config_file_valid = True diff --git a/main/xiaozhi-server/config_from_api.yaml b/main/xiaozhi-server/config_from_api.yaml new file mode 100644 index 000000000..15962bb65 --- /dev/null +++ b/main/xiaozhi-server/config_from_api.yaml @@ -0,0 +1,15 @@ +# 如果你只想轻量化安装xiaozhi-server,只使用本地的配置文件,不需要理会这个文件,不需要改动本文件任何东西 +# 如果你想从manager-api获取配置,请往下看: +# 请将本文件复制到xiaozhi-server/data目录下,没有data目录,请创建一个,并将复制过去的文件命名为.config.yaml +# 注意如果data目录有.config.yaml文件,请先删除它 +# 先启动manager-api和manager-web,注册一个账号,第一个注册的账号为管理员 +# 使用管理员,进入【参数管理】页面,找到【server.secret】,复制它到参数值,注意每次从零部署,server.secret都会变化 +# 打开本data目录下的.config.yaml文件,修改manager-api.secret为刚才复制出来的server.secret +server: + ip: 0.0.0.0 + port: 8000 +manager-api: + # 你的manager-api的地址,最好使用局域网ip + url: http://127.0.0.1:8002/xiaozhi + # 你的manager-api的token,就是刚才复制出来的server.secret + secret: 你的server.secret值 \ No newline at end of file diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 98cf5c5c8..ff8c8b4f3 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -1,4 +1,5 @@ import os +import copy import json import uuid import time @@ -13,19 +14,28 @@ from plugins_func.loadplugins import auto_import_modules from config.logger import setup_logging from core.utils.dialogue import Message, Dialogue from core.handle.textHandle import handleTextMessage -from core.utils.util import get_string_no_punctuation_or_emoji, extract_json_from_string, get_ip_info +from core.utils.util import ( + get_string_no_punctuation_or_emoji, + extract_json_from_string, + initialize_modules, + check_vad_update, + check_asr_update, +) from concurrent.futures import ThreadPoolExecutor, TimeoutError from core.handle.sendAudioHandle import sendAudioMessage from core.handle.receiveAudioHandle import handleAudioMessage from core.handle.functionHandler import FunctionHandler -from plugins_func.register import Action -from config.private_config import PrivateConfig +from plugins_func.register import Action, ActionResponse from core.auth import AuthMiddleware, AuthenticationError -from core.utils.auth_code_gen import AuthCodeGenerator +from core.mcp.manager import MCPManager +from config.config_loader import get_private_config_from_api +from config.manage_api_client import DeviceNotFoundException, DeviceBindException +from core.utils.output_counter import add_device_output +from core.handle.ttsReportHandle import enqueue_tts_report, report_tts TAG = __name__ -auto_import_modules('plugins_func.functions') +auto_import_modules("plugins_func.functions") class TTSException(RuntimeError): @@ -33,18 +43,36 @@ class TTSException(RuntimeError): class ConnectionHandler: - def __init__(self, config: Dict[str, Any], _vad, _asr, _llm, _tts, _memory, _intent): - self.config = config + def __init__( + self, + config: Dict[str, Any], + _vad, + _asr, + _llm, + _tts, + _memory, + _intent, + server=None, + ): + self.common_config = config + self.config = copy.deepcopy(config) + self.session_id = str(uuid.uuid4()) self.logger = setup_logging() self.auth = AuthMiddleware(config) + self.server = server # 保存server实例的引用 + + self.need_bind = False + self.bind_code = None + self.read_config_from_api = self.config.get("read_config_from_api", False) self.websocket = None self.headers = None + self.device_id = None self.client_ip = None self.client_ip_info = {} - self.session_id = None self.prompt = None self.welcome_msg = None + self.max_output_size = 0 # 客户端状态相关 self.client_abort = False @@ -57,16 +85,22 @@ class ConnectionHandler: self.audio_play_queue = queue.Queue() self.executor = ThreadPoolExecutor(max_workers=10) + # 上报线程 + self.tts_report_queue = queue.Queue() + self.tts_report_thread = None + # 依赖的组件 - self.vad = _vad - self.asr = _asr + self.vad = None + self.asr = None + self._asr = _asr + self._vad = _vad self.llm = _llm self.tts = _tts self.memory = _memory self.intent = _intent # vad相关变量 - self.client_audio_buffer = bytes() + self.client_audio_buffer = bytearray() self.client_have_voice = False self.client_have_voice_last_time = 0.0 self.client_no_voice_last_time = 0.0 @@ -86,75 +120,81 @@ class ConnectionHandler: # iot相关变量 self.iot_descriptors = {} + self.func_handler = None - self.cmd_exit = self.config["CMD_exit"] + self.cmd_exit = self.config["exit_commands"] self.max_cmd_length = 0 for cmd in self.cmd_exit: if len(cmd) > self.max_cmd_length: self.max_cmd_length = len(cmd) - self.private_config = None - self.auth_code_gen = AuthCodeGenerator.get_instance() - self.is_device_verified = False # 添加设备验证状态标志 self.close_after_chat = False # 是否在聊天结束后关闭连接 self.use_function_call_mode = False - if self.config["selected_module"]["Intent"] == 'function_call': - self.use_function_call_mode = True + + self.timeout_task = None + self.timeout_seconds = ( + int(self.config.get("close_connection_no_voice_time", 120)) + 60 + ) # 在原来第一道关闭的基础上加60秒,进行二道关闭 + + self.audio_format = "opus" async def handle_connection(self, ws): try: # 获取并验证headers self.headers = dict(ws.request.headers) + + if self.headers.get("device-id", None) is None: + # 尝试从 URL 的查询参数中获取 device-id + from urllib.parse import parse_qs, urlparse + + # 从 WebSocket 请求中获取路径 + request_path = ws.request.path + if not request_path: + self.logger.bind(tag=TAG).error("无法获取请求路径") + return + parsed_url = urlparse(request_path) + query_params = parse_qs(parsed_url.query) + if "device-id" in query_params: + self.headers["device-id"] = query_params["device-id"][0] + self.headers["client-id"] = query_params["client-id"][0] + else: + await ws.send("端口正常,如需测试连接,请使用test_page.html") + await self.close(ws) + return # 获取客户端ip地址 self.client_ip = ws.remote_address[0] - self.logger.bind(tag=TAG).info(f"{self.client_ip} conn - Headers: {self.headers}") + self.logger.bind(tag=TAG).info( + f"{self.client_ip} conn - Headers: {self.headers}" + ) # 进行认证 await self.auth.authenticate(self.headers) - device_id = self.headers.get("device-id", None) # 认证通过,继续处理 self.websocket = ws - self.session_id = str(uuid.uuid4()) + self.device_id = self.headers.get("device-id", None) + + # 启动超时检查任务 + self.timeout_task = asyncio.create_task(self._check_timeout()) self.welcome_msg = self.config["xiaozhi"] self.welcome_msg["session_id"] = self.session_id await self.websocket.send(json.dumps(self.welcome_msg)) - # Load private configuration if device_id is provided - bUsePrivateConfig = self.config.get("use_private_config", False) - self.logger.bind(tag=TAG).info(f"bUsePrivateConfig: {bUsePrivateConfig}, device_id: {device_id}") - if bUsePrivateConfig and device_id: - try: - self.private_config = PrivateConfig(device_id, self.config, self.auth_code_gen) - await self.private_config.load_or_create() - # 判断是否已经绑定 - owner = self.private_config.get_owner() - self.is_device_verified = owner is not None - - if self.is_device_verified: - await self.private_config.update_last_chat_time() - - llm, tts = self.private_config.create_private_instances() - if all([llm, tts]): - self.llm = llm - self.tts = tts - self.logger.bind(tag=TAG).info(f"Loaded private config and instances for device {device_id}") - else: - self.logger.bind(tag=TAG).error(f"Failed to create instances for device {device_id}") - self.private_config = None - except Exception as e: - self.logger.bind(tag=TAG).error(f"Error initializing private config: {e}") - self.private_config = None - raise + # 获取差异化配置 + self._initialize_private_config() # 异步初始化 self.executor.submit(self._initialize_components) # tts 消化线程 - self.tts_priority_thread = threading.Thread(target=self._tts_priority_thread, daemon=True) + self.tts_priority_thread = threading.Thread( + target=self._tts_priority_thread, daemon=True + ) self.tts_priority_thread.start() # 音频播放 消化线程 - self.audio_play_priority_thread = threading.Thread(target=self._audio_play_priority_thread, daemon=True) + self.audio_play_priority_thread = threading.Thread( + target=self._audio_play_priority_thread, daemon=True + ) self.audio_play_priority_thread.start() try: @@ -171,86 +211,236 @@ class ConnectionHandler: self.logger.bind(tag=TAG).error(f"Connection error: {str(e)}-{stack_trace}") return finally: - await self.memory.save_memory(self.dialogue.dialogue) + await self._save_and_close(ws) + + async def _save_and_close(self, ws): + """保存记忆并关闭连接""" + try: + if self.memory: + await self.memory.save_memory(self.dialogue.dialogue) + except Exception as e: + self.logger.bind(tag=TAG).error(f"保存记忆失败: {e}") + finally: await self.close(ws) + async def reset_timeout(self): + """重置超时计时器""" + if self.timeout_task: + self.timeout_task.cancel() + self.timeout_task = asyncio.create_task(self._check_timeout()) + async def _route_message(self, message): """消息路由""" + # 重置超时计时器 + await self.reset_timeout() + if isinstance(message, str): await handleTextMessage(self, message) elif isinstance(message, bytes): await handleAudioMessage(self, message) def _initialize_components(self): - """加载提示词""" - self.prompt = self.config["prompt"] - if self.private_config: - self.prompt = self.private_config.private_config.get("prompt", self.prompt) - self.dialogue.put(Message(role="system", content=self.prompt)) + """初始化组件""" + if self.config.get("prompt") is not None: + self.prompt = self.config["prompt"] + self.change_system_prompt(self.prompt) + self.logger.bind(tag=TAG).info( + f"初始化组件: prompt成功 {self.prompt[:50]}..." + ) + + """初始化本地组件""" + if self.vad is None: + self.vad = self._vad + if self.asr is None: + self.asr = self._asr + """加载记忆""" + self._initialize_memory() + """加载意图识别""" + self._initialize_intent() + """初始化上报线程""" + self._init_report_threads() + + def _init_report_threads(self): + """初始化ASR和TTS上报线程""" + if not self.read_config_from_api or self.need_bind: + return + if self.tts_report_thread is None or not self.tts_report_thread.is_alive(): + self.tts_report_thread = threading.Thread( + target=self._tts_report_worker, daemon=True + ) + self.tts_report_thread.start() + self.logger.bind(tag=TAG).info("TTS上报线程已启动") + + def _initialize_private_config(self): + """如果是从配置文件获取,则进行二次实例化""" + if not self.read_config_from_api: + return + """从接口获取差异化的配置进行二次实例化,非全量重新实例化""" + try: + begin_time = time.time() + private_config = get_private_config_from_api( + self.config, + self.headers.get("device-id"), + self.headers.get("client-id", self.headers.get("device-id")), + ) + private_config["delete_audio"] = bool(self.config.get("delete_audio", True)) + self.logger.bind(tag=TAG).info( + f"{time.time() - begin_time} 秒,获取差异化配置成功: {json.dumps(filter_sensitive_info(private_config), ensure_ascii=False)}" + ) + except DeviceNotFoundException as e: + self.need_bind = True + private_config = {} + except DeviceBindException as e: + self.need_bind = True + self.bind_code = e.bind_code + private_config = {} + except Exception as e: + self.need_bind = True + self.logger.bind(tag=TAG).error(f"获取差异化配置失败: {e}") + private_config = {} + + init_llm, init_tts, init_memory, init_intent = ( + False, + False, + False, + False, + ) + + init_vad = check_vad_update(self.common_config, private_config) + init_asr = check_asr_update(self.common_config, private_config) + + if private_config.get("TTS", None) is not None: + init_tts = True + self.config["TTS"] = private_config["TTS"] + self.config["selected_module"]["TTS"] = private_config["selected_module"][ + "TTS" + ] + if private_config.get("LLM", None) is not None: + init_llm = True + self.config["LLM"] = private_config["LLM"] + self.config["selected_module"]["LLM"] = private_config["selected_module"][ + "LLM" + ] + if private_config.get("Memory", None) is not None: + init_memory = True + self.config["Memory"] = private_config["Memory"] + self.config["selected_module"]["Memory"] = private_config[ + "selected_module" + ]["Memory"] + if private_config.get("Intent", None) is not None: + init_intent = True + self.config["Intent"] = private_config["Intent"] + self.config["selected_module"]["Intent"] = private_config[ + "selected_module" + ]["Intent"] + if private_config.get("prompt", None) is not None: + self.config["prompt"] = private_config["prompt"] + if private_config.get("device_max_output_size", None) is not None: + self.max_output_size = int(private_config["device_max_output_size"]) + + try: + modules = initialize_modules( + self.logger, + private_config, + init_vad, + init_asr, + init_llm, + init_tts, + init_memory, + init_intent, + ) + except Exception as e: + self.logger.bind(tag=TAG).error(f"初始化组件失败: {e}") + modules = {} + if modules.get("tts", None) is not None: + self.tts = modules["tts"] + if modules.get("vad", None) is not None: + self.vad = modules["vad"] + if modules.get("asr", None) is not None: + self.asr = modules["asr"] + if modules.get("llm", None) is not None: + self.llm = modules["llm"] + if modules.get("intent", None) is not None: + self.intent = modules["intent"] + if modules.get("memory", None) is not None: + self.memory = modules["memory"] + + def _initialize_memory(self): + """初始化记忆模块""" + self.memory.init_memory(self.device_id, self.llm) + + def _initialize_intent(self): + if ( + self.config["Intent"][self.config["selected_module"]["Intent"]]["type"] + == "function_call" + ): + self.use_function_call_mode = True + """初始化意图识别模块""" + # 获取意图识别配置 + intent_config = self.config["Intent"] + intent_type = self.config["Intent"][self.config["selected_module"]["Intent"]][ + "type" + ] + + # 如果使用 nointent,直接返回 + if intent_type == "nointent": + return + # 使用 intent_llm 模式 + elif intent_type == "intent_llm": + intent_llm_name = intent_config[self.config["selected_module"]["Intent"]][ + "llm" + ] + + if intent_llm_name and intent_llm_name in self.config["LLM"]: + # 如果配置了专用LLM,则创建独立的LLM实例 + from core.utils import llm as llm_utils + + intent_llm_config = self.config["LLM"][intent_llm_name] + intent_llm_type = intent_llm_config.get("type", intent_llm_name) + intent_llm = llm_utils.create_instance( + intent_llm_type, intent_llm_config + ) + self.logger.bind(tag=TAG).info( + f"为意图识别创建了专用LLM: {intent_llm_name}, 类型: {intent_llm_type}" + ) + self.intent.set_llm(intent_llm) + else: + # 否则使用主LLM + self.intent.set_llm(self.llm) + self.logger.bind(tag=TAG).info("使用主LLM作为意图识别模型") """加载插件""" self.func_handler = FunctionHandler(self) + self.mcp_manager = MCPManager(self) - """加载记忆""" - device_id = self.headers.get("device-id", None) - self.memory.init_memory(device_id, self.llm) - self.intent.set_llm(self.llm) - - """加载位置信息""" - self.client_ip_info = get_ip_info(self.client_ip) - if self.client_ip_info is not None and "city" in self.client_ip_info: - self.logger.bind(tag=TAG).info(f"Client ip info: {self.client_ip_info}") - self.prompt = self.prompt + f"\nuser location:{self.client_ip_info}" - self.dialogue.update_system_message(self.prompt) + """加载MCP工具""" + asyncio.run_coroutine_threadsafe( + self.mcp_manager.initialize_servers(), self.loop + ) def change_system_prompt(self, prompt): self.prompt = prompt - # 找到原来的role==system,替换原来的系统提示 - for m in self.dialogue.dialogue: - if m.role == "system": - m.content = prompt - - async def _check_and_broadcast_auth_code(self): - """检查设备绑定状态并广播认证码""" - if not self.private_config.get_owner(): - auth_code = self.private_config.get_auth_code() - if auth_code: - # 发送验证码语音提示 - text = f"请在后台输入验证码:{' '.join(auth_code)}" - self.recode_first_last_text(text) - future = self.executor.submit(self.speak_and_play, text) - self.tts_queue.put(future) - return False - return True - - def isNeedAuth(self): - bUsePrivateConfig = self.config.get("use_private_config", False) - if not bUsePrivateConfig: - # 如果不使用私有配置,就不需要验证 - return False - return not self.is_device_verified + # 更新系统prompt至上下文 + self.dialogue.update_system_message(self.prompt) def chat(self, query): - if self.isNeedAuth(): - self.llm_finish_task = True - future = asyncio.run_coroutine_threadsafe(self._check_and_broadcast_auth_code(), self.loop) - future.result() - return True self.dialogue.put(Message(role="user", content=query)) response_message = [] processed_chars = 0 # 跟踪已处理的字符位置 try: - start_time = time.time() # 使用带记忆的对话 - future = asyncio.run_coroutine_threadsafe(self.memory.query_memory(query), self.loop) - memory_str = future.result() + memory_str = None + if self.memory is not None: + future = asyncio.run_coroutine_threadsafe( + self.memory.query_memory(query), self.loop + ) + memory_str = future.result() self.logger.bind(tag=TAG).debug(f"记忆内容: {memory_str}") llm_responses = self.llm.response( - self.session_id, - self.dialogue.get_llm_dialogue_with_memory(memory_str) + self.session_id, self.dialogue.get_llm_dialogue_with_memory(memory_str) ) except Exception as e: self.logger.bind(tag=TAG).error(f"LLM 处理出错 {query}: {e}") @@ -263,24 +453,26 @@ class ConnectionHandler: if self.client_abort: break - end_time = time.time() - self.logger.bind(tag=TAG).debug(f"大模型返回时间: {end_time - start_time} 秒, 生成token={content}") - # 合并当前全部文本并处理未分割部分 full_text = "".join(response_message) current_text = full_text[processed_chars:] # 从未处理的位置开始 # 查找最后一个有效标点 - punctuations = ("。", "?", "!", ";", ":") + punctuations = ("。", ".", "?", "?", "!", "!", ";", ";", ":") last_punct_pos = -1 + number_flag = True for punct in punctuations: pos = current_text.rfind(punct) - if pos > last_punct_pos: + prev_char = current_text[pos - 1] if pos - 1 >= 0 else "" + # 如果.前面是数字统一判断为小数 + if prev_char.isdigit() and punct == ".": + number_flag = False + if pos > last_punct_pos and number_flag: last_punct_pos = pos # 找到分割点则处理 if last_punct_pos != -1: - segment_text_raw = current_text[:last_punct_pos + 1] + segment_text_raw = current_text[: last_punct_pos + 1] segment_text = get_string_no_punctuation_or_emoji(segment_text_raw) if segment_text: # 强制设置空字符,测试TTS出错返回语音的健壮性 @@ -288,8 +480,10 @@ class ConnectionHandler: # segment_text = " " text_index += 1 self.recode_first_last_text(segment_text, text_index) - future = self.executor.submit(self.speak_and_play, segment_text, text_index) - self.tts_queue.put(future) + future = self.executor.submit( + self.speak_and_play, segment_text, text_index + ) + self.tts_queue.put((future, text_index)) processed_chars += len(segment_text_raw) # 更新已处理字符位置 # 处理最后剩余的文本 @@ -300,31 +494,29 @@ class ConnectionHandler: if segment_text: text_index += 1 self.recode_first_last_text(segment_text, text_index) - future = self.executor.submit(self.speak_and_play, segment_text, text_index) - self.tts_queue.put(future) + future = self.executor.submit( + self.speak_and_play, segment_text, text_index + ) + self.tts_queue.put((future, text_index)) self.llm_finish_task = True self.dialogue.put(Message(role="assistant", content="".join(response_message))) - self.logger.bind(tag=TAG).debug(json.dumps(self.dialogue.get_llm_dialogue(), indent=4, ensure_ascii=False)) + self.logger.bind(tag=TAG).debug( + json.dumps(self.dialogue.get_llm_dialogue(), indent=4, ensure_ascii=False) + ) return True def chat_with_function_calling(self, query, tool_call=False): self.logger.bind(tag=TAG).debug(f"Chat with function calling start: {query}") """Chat with function calling for intent detection using streaming""" - if self.isNeedAuth(): - self.llm_finish_task = True - future = asyncio.run_coroutine_threadsafe(self._check_and_broadcast_auth_code(), self.loop) - future.result() - return True if not tool_call: self.dialogue.put(Message(role="user", content=query)) # Define intent functions functions = None - if hasattr(self, 'func_handler'): + if hasattr(self, "func_handler"): functions = self.func_handler.get_functions() - response_message = [] processed_chars = 0 # 跟踪已处理的字符位置 @@ -332,8 +524,12 @@ class ConnectionHandler: start_time = time.time() # 使用带记忆的对话 - future = asyncio.run_coroutine_threadsafe(self.memory.query_memory(query), self.loop) - memory_str = future.result() + memory_str = None + if self.memory is not None: + future = asyncio.run_coroutine_threadsafe( + self.memory.query_memory(query), self.loop + ) + memory_str = future.result() # self.logger.bind(tag=TAG).info(f"对话记录: {self.dialogue.get_llm_dialogue_with_memory(memory_str)}") @@ -341,7 +537,7 @@ class ConnectionHandler: llm_responses = self.llm.response_with_functions( self.session_id, self.dialogue.get_llm_dialogue_with_memory(memory_str), - functions=functions + functions=functions, ) except Exception as e: self.logger.bind(tag=TAG).error(f"LLM 处理出错 {query}: {e}") @@ -356,11 +552,19 @@ class ConnectionHandler: function_id = None function_arguments = "" content_arguments = "" + for response in llm_responses: content, tools_call = response + + if "content" in response: + content = response["content"] + tools_call = None if content is not None and len(content) > 0: - if len(response_message) <= 0 and (content == "```" or "" in content): - tool_call_flag = True + content_arguments += content + + if not tool_call_flag and content_arguments.startswith(""): + # print("content_arguments", content_arguments) + tool_call_flag = True if tools_call is not None: tool_call_flag = True @@ -372,16 +576,14 @@ class ConnectionHandler: function_arguments += tools_call[0].function.arguments if content is not None and len(content) > 0: - if tool_call_flag: - content_arguments += content - else: + if not tool_call_flag: response_message.append(content) if self.client_abort: break end_time = time.time() - self.logger.bind(tag=TAG).debug(f"大模型返回时间: {end_time - start_time} 秒, 生成token={content}") + # self.logger.bind(tag=TAG).debug(f"大模型返回时间: {end_time - start_time} 秒, 生成token={content}") # 处理文本分段和TTS逻辑 # 合并当前全部文本并处理未分割部分 @@ -389,23 +591,33 @@ class ConnectionHandler: current_text = full_text[processed_chars:] # 从未处理的位置开始 # 查找最后一个有效标点 - punctuations = ("。", "?", "!", ";", ":") + punctuations = ("。", ".", "?", "?", "!", "!", ";", ";", ":") last_punct_pos = -1 + number_flag = True for punct in punctuations: pos = current_text.rfind(punct) - if pos > last_punct_pos: + prev_char = current_text[pos - 1] if pos - 1 >= 0 else "" + # 如果.前面是数字统一判断为小数 + if prev_char.isdigit() and punct == ".": + number_flag = False + if pos > last_punct_pos and number_flag: last_punct_pos = pos # 找到分割点则处理 if last_punct_pos != -1: - segment_text_raw = current_text[:last_punct_pos + 1] - segment_text = get_string_no_punctuation_or_emoji(segment_text_raw) + segment_text_raw = current_text[: last_punct_pos + 1] + segment_text = get_string_no_punctuation_or_emoji( + segment_text_raw + ) if segment_text: text_index += 1 self.recode_first_last_text(segment_text, text_index) - future = self.executor.submit(self.speak_and_play, segment_text, text_index) - self.tts_queue.put(future) - processed_chars += len(segment_text_raw) # 更新已处理字符位置 + future = self.executor.submit( + self.speak_and_play, segment_text, text_index + ) + self.tts_queue.put((future, text_index)) + # 更新已处理字符位置 + processed_chars += len(segment_text_raw) # 处理function call if tool_call_flag: @@ -416,7 +628,9 @@ class ConnectionHandler: try: content_arguments_json = json.loads(a) function_name = content_arguments_json["name"] - function_arguments = json.dumps(content_arguments_json["arguments"], ensure_ascii=False) + function_arguments = json.dumps( + content_arguments_json["arguments"], ensure_ascii=False + ) function_id = str(uuid.uuid4().hex) except Exception as e: bHasError = True @@ -425,18 +639,28 @@ class ConnectionHandler: bHasError = True response_message.append(content_arguments) if bHasError: - self.logger.bind(tag=TAG).error(f"function call error: {content_arguments}") - else: - function_arguments = json.loads(function_arguments) + self.logger.bind(tag=TAG).error( + f"function call error: {content_arguments}" + ) if not bHasError: - self.logger.bind(tag=TAG).info( - f"function_name={function_name}, function_id={function_id}, function_arguments={function_arguments}") + response_message.clear() + self.logger.bind(tag=TAG).debug( + f"function_name={function_name}, function_id={function_id}, function_arguments={function_arguments}" + ) function_call_data = { "name": function_name, "id": function_id, - "arguments": function_arguments + "arguments": function_arguments, } - result = self.func_handler.handle_llm_function_call(self, function_call_data) + + # 处理MCP工具调用 + if self.mcp_manager.is_mcp_tool(function_name): + result = self._handle_mcp_tool_call(function_call_data) + else: + # 处理系统函数 + result = self.func_handler.handle_llm_function_call( + self, function_call_data + ) self._handle_function_result(result, function_call_data, text_index + 1) # 处理最后剩余的文本 @@ -447,60 +671,118 @@ class ConnectionHandler: if segment_text: text_index += 1 self.recode_first_last_text(segment_text, text_index) - future = self.executor.submit(self.speak_and_play, segment_text, text_index) - self.tts_queue.put(future) + future = self.executor.submit( + self.speak_and_play, segment_text, text_index + ) + self.tts_queue.put((future, text_index)) # 存储对话内容 if len(response_message) > 0: - self.dialogue.put(Message(role="assistant", content="".join(response_message))) + self.dialogue.put( + Message(role="assistant", content="".join(response_message)) + ) self.llm_finish_task = True - self.logger.bind(tag=TAG).debug(json.dumps(self.dialogue.get_llm_dialogue(), indent=4, ensure_ascii=False)) + self.logger.bind(tag=TAG).debug( + json.dumps(self.dialogue.get_llm_dialogue(), indent=4, ensure_ascii=False) + ) return True + def _handle_mcp_tool_call(self, function_call_data): + function_arguments = function_call_data["arguments"] + function_name = function_call_data["name"] + try: + args_dict = function_arguments + if isinstance(function_arguments, str): + try: + args_dict = json.loads(function_arguments) + except json.JSONDecodeError: + self.logger.bind(tag=TAG).error( + f"无法解析 function_arguments: {function_arguments}" + ) + return ActionResponse( + action=Action.REQLLM, result="参数解析失败", response="" + ) + + tool_result = asyncio.run_coroutine_threadsafe( + self.mcp_manager.execute_tool(function_name, args_dict), self.loop + ).result() + # meta=None content=[TextContent(type='text', text='北京当前天气:\n温度: 21°C\n天气: 晴\n湿度: 6%\n风向: 西北 风\n风力等级: 5级', annotations=None)] isError=False + content_text = "" + if tool_result is not None and tool_result.content is not None: + for content in tool_result.content: + content_type = content.type + if content_type == "text": + content_text = content.text + elif content_type == "image": + pass + + if len(content_text) > 0: + return ActionResponse( + action=Action.REQLLM, result=content_text, response="" + ) + + except Exception as e: + self.logger.bind(tag=TAG).error(f"MCP工具调用错误: {e}") + return ActionResponse( + action=Action.REQLLM, result="工具调用出错", response="" + ) + + return ActionResponse(action=Action.REQLLM, result="工具调用出错", response="") + def _handle_function_result(self, result, function_call_data, text_index): if result.action == Action.RESPONSE: # 直接回复前端 text = result.response self.recode_first_last_text(text, text_index) future = self.executor.submit(self.speak_and_play, text, text_index) - self.tts_queue.put(future) + self.tts_queue.put((future, text_index)) self.dialogue.put(Message(role="assistant", content=text)) elif result.action == Action.REQLLM: # 调用函数后再请求llm生成回复 - text = result.result if text is not None and len(text) > 0: function_id = function_call_data["id"] function_name = function_call_data["name"] function_arguments = function_call_data["arguments"] - self.dialogue.put(Message(role='assistant', - tool_calls=[{"id": function_id, - "function": {"arguments": function_arguments, - "name": function_name}, - "type": 'function', - "index": 0}])) + self.dialogue.put( + Message( + role="assistant", + tool_calls=[ + { + "id": function_id, + "function": { + "arguments": function_arguments, + "name": function_name, + }, + "type": "function", + "index": 0, + } + ], + ) + ) - self.dialogue.put(Message(role="tool", tool_call_id=function_id, content=text)) + self.dialogue.put( + Message(role="tool", tool_call_id=function_id, content=text) + ) self.chat_with_function_calling(text, tool_call=True) - elif result.action == Action.NOTFOUND: + elif result.action == Action.NOTFOUND or result.action == Action.ERROR: text = result.result self.recode_first_last_text(text, text_index) future = self.executor.submit(self.speak_and_play, text, text_index) - self.tts_queue.put(future) + self.tts_queue.put((future, text_index)) self.dialogue.put(Message(role="assistant", content=text)) else: - text = result.result - self.recode_first_last_text(text, text_index) - future = self.executor.submit(self.speak_and_play, text, text_index) - self.tts_queue.put(future) - self.dialogue.put(Message(role="assistant", content=text)) + pass def _tts_priority_thread(self): while not self.stop_event.is_set(): text = None try: try: - future = self.tts_queue.get(timeout=1) + item = self.tts_queue.get(timeout=1) + if item is None: + continue + future, text_index = item # 解包获取 Future 和 text_index except queue.Empty: if self.stop_event.is_set(): break @@ -508,54 +790,111 @@ class ConnectionHandler: if future is None: continue text = None - opus_datas, text_index, tts_file = [], 0, None + opus_datas, tts_file = [], None try: self.logger.bind(tag=TAG).debug("正在处理TTS任务...") - tts_timeout = self.config.get("tts_timeout", 10) - tts_file, text, text_index = future.result(timeout=tts_timeout) + tts_timeout = int(self.config.get("tts_timeout", 10)) + tts_file, text, _ = future.result(timeout=tts_timeout) if text is None or len(text) <= 0: - self.logger.bind(tag=TAG).error(f"TTS出错:{text_index}: tts text is empty") + self.logger.bind(tag=TAG).error( + f"TTS出错:{text_index}: tts text is empty" + ) elif tts_file is None: - self.logger.bind(tag=TAG).error(f"TTS出错: file is empty: {text_index}: {text}") + self.logger.bind(tag=TAG).error( + f"TTS出错: file is empty: {text_index}: {text}" + ) else: - self.logger.bind(tag=TAG).debug(f"TTS生成:文件路径: {tts_file}") + self.logger.bind(tag=TAG).debug( + f"TTS生成:文件路径: {tts_file}" + ) if os.path.exists(tts_file): - opus_datas, duration = self.tts.audio_to_opus_data(tts_file) + if self.audio_format == "pcm": + audio_datas, _ = self.tts.audio_to_pcm_data(tts_file) + else: + audio_datas, _ = self.tts.audio_to_opus_data(tts_file) + # 在这里上报TTS数据(使用文件路径) + enqueue_tts_report(self, 2, text, audio_datas) else: - self.logger.bind(tag=TAG).error(f"TTS出错:文件不存在{tts_file}") + self.logger.bind(tag=TAG).error( + f"TTS出错:文件不存在{tts_file}" + ) except TimeoutError: self.logger.bind(tag=TAG).error("TTS超时") except Exception as e: self.logger.bind(tag=TAG).error(f"TTS出错: {e}") if not self.client_abort: # 如果没有中途打断就发送语音 - self.audio_play_queue.put((opus_datas, text, text_index)) - if self.tts.delete_audio_file and tts_file is not None and os.path.exists(tts_file): + self.audio_play_queue.put((audio_datas, text, text_index)) + if ( + self.tts.delete_audio_file + and tts_file is not None + and os.path.exists(tts_file) + ): os.remove(tts_file) except Exception as e: self.logger.bind(tag=TAG).error(f"TTS任务处理错误: {e}") self.clearSpeakStatus() asyncio.run_coroutine_threadsafe( - self.websocket.send(json.dumps({"type": "tts", "state": "stop", "session_id": self.session_id})), - self.loop + self.websocket.send( + json.dumps( + { + "type": "tts", + "state": "stop", + "session_id": self.session_id, + } + ) + ), + self.loop, + ) + self.logger.bind(tag=TAG).error( + f"tts_priority priority_thread: {text} {e}" ) - self.logger.bind(tag=TAG).error(f"tts_priority priority_thread: {text} {e}") def _audio_play_priority_thread(self): while not self.stop_event.is_set(): text = None try: try: - opus_datas, text, text_index = self.audio_play_queue.get(timeout=1) + audio_datas, text, text_index = self.audio_play_queue.get(timeout=1) except queue.Empty: if self.stop_event.is_set(): break continue - future = asyncio.run_coroutine_threadsafe(sendAudioMessage(self, opus_datas, text, text_index), - self.loop) + future = asyncio.run_coroutine_threadsafe( + sendAudioMessage(self, audio_datas, text, text_index), self.loop + ) future.result() except Exception as e: - self.logger.bind(tag=TAG).error(f"audio_play_priority priority_thread: {text} {e}") + self.logger.bind(tag=TAG).error( + f"audio_play_priority priority_thread: {text} {e}" + ) + + def _tts_report_worker(self): + """TTS上报工作线程""" + + while not self.stop_event.is_set(): + try: + # 从队列获取数据,设置超时以便定期检查停止事件 + item = self.tts_report_queue.get(timeout=1) + if item is None: # 检测毒丸对象 + break + + type, text, audio_data = item + + try: + # 执行上报(传入二进制数据) + report_tts(self, type, text, audio_data) + except Exception as e: + self.logger.bind(tag=TAG).error(f"TTS上报线程异常: {e}") + finally: + # 标记任务完成 + self.tts_report_queue.task_done() + except queue.Empty: + continue + except Exception as e: + self.logger.bind(tag=TAG).error(f"TTS上报工作线程异常: {e}") + + self.logger.bind(tag=TAG).info("TTS上报线程已退出") def speak_and_play(self, text, text_index=0): if text is None or len(text) <= 0: @@ -566,6 +905,8 @@ class ConnectionHandler: self.logger.bind(tag=TAG).error(f"tts转换失败,{text}") return None, text, text_index self.logger.bind(tag=TAG).debug(f"TTS 文件生成完毕: {tts_file}") + if self.max_output_size > 0: + add_device_output(self.headers.get("device-id"), len(text)) return tts_file, text, text_index def clearSpeakStatus(self): @@ -582,27 +923,41 @@ class ConnectionHandler: async def close(self, ws=None): """资源清理方法""" + # 取消超时任务 + if self.timeout_task: + self.timeout_task.cancel() + self.timeout_task = None + + # 清理MCP资源 + if hasattr(self, "mcp_manager") and self.mcp_manager: + await self.mcp_manager.cleanup_all() # 触发停止事件并清理资源 if self.stop_event: self.stop_event.set() - + # 立即关闭线程池 if self.executor: self.executor.shutdown(wait=False, cancel_futures=True) self.executor = None - + + # 添加毒丸对象到上报队列确保线程退出 + self.tts_report_queue.put(None) + # 清空任务队列 - self._clear_queues() - + self.clear_queues() + if ws: await ws.close() elif self.websocket: await self.websocket.close() self.logger.bind(tag=TAG).info("连接资源已释放") - def _clear_queues(self): + def clear_queues(self): # 清空所有任务队列 + self.logger.bind(tag=TAG).debug( + f"开始清理: TTS队列大小={self.tts_queue.qsize()}, 音频队列大小={self.audio_play_queue.qsize()}" + ) for q in [self.tts_queue, self.audio_play_queue]: if not q: continue @@ -614,9 +969,12 @@ class ConnectionHandler: q.queue.clear() # 添加毒丸信号到队列,确保线程退出 # q.queue.put(None) + self.logger.bind(tag=TAG).debug( + f"清理结束: TTS队列大小={self.tts_queue.qsize()}, 音频队列大小={self.audio_play_queue.qsize()}" + ) def reset_vad_states(self): - self.client_audio_buffer = bytes() + self.client_audio_buffer = bytearray() self.client_have_voice = False self.client_have_voice_last_time = 0 self.client_voice_stop = False @@ -632,3 +990,49 @@ class ConnectionHandler: self.close_after_chat = True except Exception as e: self.logger.bind(tag=TAG).error(f"Chat and close error: {str(e)}") + + async def _check_timeout(self): + """检查连接超时""" + try: + while not self.stop_event.is_set(): + await asyncio.sleep(self.timeout_seconds) + if not self.stop_event.is_set(): + self.logger.bind(tag=TAG).info("连接超时,准备关闭") + await self.close(self.websocket) + break + except Exception as e: + self.logger.bind(tag=TAG).error(f"超时检查任务出错: {e}") + + +def filter_sensitive_info(config: dict) -> dict: + """ + 过滤配置中的敏感信息 + Args: + config: 原始配置字典 + Returns: + 过滤后的配置字典 + """ + sensitive_keys = [ + "api_key", + "personal_access_token", + "access_token", + "token", + "secret", + "access_key_secret", + "secret_key", + ] + + def _filter_dict(d: dict) -> dict: + filtered = {} + for k, v in d.items(): + if any(sensitive in k.lower() for sensitive in sensitive_keys): + filtered[k] = "***" + elif isinstance(v, dict): + filtered[k] = _filter_dict(v) + elif isinstance(v, list): + filtered[k] = [_filter_dict(i) if isinstance(i, dict) else i for i in v] + else: + filtered[k] = v + return filtered + + return _filter_dict(copy.deepcopy(config)) diff --git a/main/xiaozhi-server/core/handle/abortHandle.py b/main/xiaozhi-server/core/handle/abortHandle.py index 3183487f5..fe2715114 100644 --- a/main/xiaozhi-server/core/handle/abortHandle.py +++ b/main/xiaozhi-server/core/handle/abortHandle.py @@ -3,14 +3,16 @@ import queue from config.logger import setup_logging TAG = __name__ -logger = setup_logging() async def handleAbortMessage(conn): - logger.bind(tag=TAG).info("Abort message received") + conn.logger.bind(tag=TAG).info("Abort message received") # 设置成打断状态,会自动打断llm、tts任务 conn.client_abort = True + conn.clear_queues() # 打断客户端说话状态 - await conn.websocket.send(json.dumps({"type": "tts", "state": "stop", "session_id": conn.session_id})) + await conn.websocket.send( + json.dumps({"type": "tts", "state": "stop", "session_id": conn.session_id}) + ) conn.clearSpeakStatus() - logger.bind(tag=TAG).info("Abort message received-end") + conn.logger.bind(tag=TAG).info("Abort message received-end") diff --git a/main/xiaozhi-server/core/handle/functionHandler.py b/main/xiaozhi-server/core/handle/functionHandler.py index 9cad94991..b09a369c6 100644 --- a/main/xiaozhi-server/core/handle/functionHandler.py +++ b/main/xiaozhi-server/core/handle/functionHandler.py @@ -4,7 +4,6 @@ from plugins_func.register import FunctionRegistry, ActionResponse, Action, Tool from plugins_func.functions.hass_init import append_devices_to_prompt TAG = __name__ -logger = setup_logging() class FunctionHandler: @@ -17,6 +16,7 @@ class FunctionHandler: self.functions_desc = self.function_registry.get_all_function_desc() func_names = self.current_support_functions() self.modify_plugin_loader_des(func_names) + self.finish_init = True def modify_plugin_loader_des(self, func_names): if "plugin_loader" not in func_names: @@ -26,8 +26,9 @@ class FunctionHandler: func_names = ",".join(surport_plugins) for function_desc in self.functions_desc: if function_desc["function"]["name"] == "plugin_loader": - function_desc["function"]["description"] = function_desc["function"]["description"].replace("[plugins]", - func_names) + function_desc["function"]["description"] = function_desc["function"][ + "description" + ].replace("[plugins]", func_names) break def upload_functions_desc(self): @@ -38,7 +39,9 @@ class FunctionHandler: for func in self.functions_desc: func_names.append(func["function"]["name"]) # 打印当前支持的函数列表 - logger.bind(tag=TAG).info(f"当前支持的函数列表: {func_names}") + self.conn.logger.bind(tag=TAG, session_id=self.conn.session_id).info( + f"当前支持的函数列表: {func_names}" + ) return func_names def get_functions(self): @@ -55,7 +58,9 @@ class FunctionHandler: def register_config_functions(self): """注册配置中的函数,可以不同客户端使用不同的配置""" - for func in self.config["Intent"]["function_call"].get("functions", []): + for func in self.config["Intent"][self.config["selected_module"]["Intent"]].get( + "functions", [] + ): self.function_registry.register_function(func) """home assistant需要初始化提示词""" @@ -69,20 +74,29 @@ class FunctionHandler: function_name = function_call_data["name"] funcItem = self.get_function(function_name) if not funcItem: - return ActionResponse(action=Action.NOTFOUND, result="没有找到对应的函数", response="") + return ActionResponse( + action=Action.NOTFOUND, result="没有找到对应的函数", response="" + ) func = funcItem.func arguments = function_call_data["arguments"] arguments = json.loads(arguments) if arguments else {} - logger.bind(tag=TAG).info(f"调用函数: {function_name}, 参数: {arguments}") - if funcItem.type == ToolType.SYSTEM_CTL or funcItem.type == ToolType.IOT_CTL: + self.conn.logger.bind(tag=TAG).debug( + f"调用函数: {function_name}, 参数: {arguments}" + ) + if ( + funcItem.type == ToolType.SYSTEM_CTL + or funcItem.type == ToolType.IOT_CTL + ): return func(conn, **arguments) elif funcItem.type == ToolType.WAIT: return func(**arguments) elif funcItem.type == ToolType.CHANGE_SYS_PROMPT: return func(conn, **arguments) else: - return ActionResponse(action=Action.NOTFOUND, result="没有找到对应的函数", response="") + return ActionResponse( + action=Action.NOTFOUND, result="没有找到对应的函数", response="" + ) except Exception as e: - logger.bind(tag=TAG).error(f"处理function call错误: {e}") + self.conn.logger.bind(tag=TAG).error(f"处理function call错误: {e}") return None diff --git a/main/xiaozhi-server/core/handle/helloHandle.py b/main/xiaozhi-server/core/handle/helloHandle.py index 4583a6e3b..f902a64fa 100644 --- a/main/xiaozhi-server/core/handle/helloHandle.py +++ b/main/xiaozhi-server/core/handle/helloHandle.py @@ -1,5 +1,4 @@ import json -from config.logger import setup_logging from core.handle.sendAudioHandle import send_stt_message from core.utils.util import remove_punctuation_and_length import shutil @@ -8,18 +7,35 @@ import os import random import time -logger = setup_logging() +TAG = __name__ -WAKEUP_CONFIG = {"dir": "config/assets/", "file_name": "wakeup_words", "create_time": time.time(), "refresh_time": 10, - "words": ["很高兴见到你", "你好啊", "我们又见面了", "最近可好?", "很高兴再次和你谈话", "在干嘛"]} +WAKEUP_CONFIG = { + "dir": "config/assets/", + "file_name": "wakeup_words", + "create_time": time.time(), + "refresh_time": 10, + "words": ["你好小智", "你好啊小智", "小智你好", "小智"], + "text": "", +} -async def handleHelloMessage(conn): +async def handleHelloMessage(conn, msg_json): + """处理hello消息""" + audio_params = msg_json.get("audio_params") + if audio_params: + format = audio_params.get("format") + conn.logger.bind(tag=TAG).info(f"客户端音频格式: {format}") + conn.audio_format = format + conn.asr.set_audio_format(format) + conn.welcome_msg["audio_params"] = audio_params + await conn.websocket.send(json.dumps(conn.welcome_msg)) async def checkWakeupWords(conn, text): - enable_wakeup_words_response_cache = conn.config["enable_wakeup_words_response_cache"] + enable_wakeup_words_response_cache = conn.config[ + "enable_wakeup_words_response_cache" + ] """是否开启唤醒词加速""" if not enable_wakeup_words_response_cache: return False @@ -35,8 +51,11 @@ async def checkWakeupWords(conn, text): if file is None: asyncio.create_task(wakeupWordsResponse(conn)) return False - opus_packets, duration = conn.tts.audio_to_opus_data(file) - conn.audio_play_queue.put((opus_packets, text, 0)) + opus_packets, _ = conn.tts.audio_to_opus_data(file) + text_hello = WAKEUP_CONFIG["text"] + if not text_hello: + text_hello = text + conn.audio_play_queue.put((opus_packets, text_hello, 0)) if time.time() - WAKEUP_CONFIG["create_time"] > WAKEUP_CONFIG["refresh_time"]: asyncio.create_task(wakeupWordsResponse(conn)) return True @@ -47,7 +66,7 @@ def getWakeupWordFile(file_name): for file in os.listdir(WAKEUP_CONFIG["dir"]): if file.startswith("my_" + file_name): """避免缓存文件是一个空文件""" - if os.stat(f"config/assets/{file}").st_size > (5 * 1024): + if os.stat(f"config/assets/{file}").st_size > (15 * 1024): return f"config/assets/{file}" """查找config/assets/目录下名称为wakeup_words的文件""" @@ -58,17 +77,32 @@ def getWakeupWordFile(file_name): async def wakeupWordsResponse(conn): + wait_max_time = 5 + while conn.llm is None or not conn.llm.response_no_stream: + await asyncio.sleep(1) + wait_max_time -= 1 + if wait_max_time <= 0: + conn.logger.bind(tag=TAG).error("连接对象没有llm") + return + """唤醒词响应""" wakeup_word = random.choice(WAKEUP_CONFIG["words"]) result = conn.llm.response_no_stream(conn.config["prompt"], wakeup_word) + if result is None or result == "": + return tts_file = await asyncio.to_thread(conn.tts.to_tts, result) + if tts_file is not None and os.path.exists(tts_file): file_type = os.path.splitext(tts_file)[1] if file_type: - file_type = file_type.lstrip('.') + file_type = file_type.lstrip(".") old_file = getWakeupWordFile("my_" + WAKEUP_CONFIG["file_name"]) if old_file is not None: os.remove(old_file) """将文件挪到"wakeup_words.mp3""" - shutil.move(tts_file, WAKEUP_CONFIG["dir"] + "my_" + WAKEUP_CONFIG["file_name"] + "." + file_type) + shutil.move( + tts_file, + WAKEUP_CONFIG["dir"] + "my_" + WAKEUP_CONFIG["file_name"] + "." + file_type, + ) WAKEUP_CONFIG["create_time"] = time.time() + WAKEUP_CONFIG["text"] = result diff --git a/main/xiaozhi-server/core/handle/intentHandler.py b/main/xiaozhi-server/core/handle/intentHandler.py index d8440fc6e..0174bc438 100644 --- a/main/xiaozhi-server/core/handle/intentHandler.py +++ b/main/xiaozhi-server/core/handle/intentHandler.py @@ -4,9 +4,9 @@ import uuid from core.handle.sendAudioHandle import send_stt_message from core.handle.helloHandle import checkWakeupWords from core.utils.util import remove_punctuation_and_length +from core.utils.dialogue import Message TAG = __name__ -logger = setup_logging() async def handle_user_intent(conn, text): @@ -21,11 +21,11 @@ async def handle_user_intent(conn, text): # 使用支持function calling的聊天方法,不再进行意图分析 return False # 使用LLM进行意图分析 - intent = await analyze_intent_with_llm(conn, text) - if not intent: + intent_result = await analyze_intent_with_llm(conn, text) + if not intent_result: return False # 处理各种意图 - return await process_intent_result(conn, intent, text) + return await process_intent_result(conn, intent_result, text) async def check_direct_exit(conn, text): @@ -34,69 +34,98 @@ async def check_direct_exit(conn, text): cmd_exit = conn.cmd_exit for cmd in cmd_exit: if text == cmd: - logger.bind(tag=TAG).info(f"识别到明确的退出命令: {text}") + conn.logger.bind(tag=TAG).info(f"识别到明确的退出命令: {text}") + await send_stt_message(conn, text) await conn.close() return True return False - async def analyze_intent_with_llm(conn, text): """使用LLM分析用户意图""" - if not hasattr(conn, 'intent') or not conn.intent: - logger.bind(tag=TAG).warning("意图识别服务未初始化") + if not hasattr(conn, "intent") or not conn.intent: + conn.logger.bind(tag=TAG).warning("意图识别服务未初始化") return None # 对话历史记录 dialogue = conn.dialogue try: intent_result = await conn.intent.detect_intent(conn, dialogue.dialogue, text) - # 尝试解析JSON结果 - try: - intent_data = json.loads(intent_result) - if "intent" in intent_data: - return intent_data["intent"] - except json.JSONDecodeError: - # 如果不是JSON格式,尝试直接获取意图文本 - return intent_result.strip() - + return intent_result except Exception as e: - logger.bind(tag=TAG).error(f"意图识别失败: {str(e)}") + conn.logger.bind(tag=TAG).error(f"意图识别失败: {str(e)}") return None -async def process_intent_result(conn, intent, original_text): +async def process_intent_result(conn, intent_result, original_text): """处理意图识别结果""" - # 处理退出意图 - if "结束聊天" in intent: - logger.bind(tag=TAG).info(f"识别到退出意图: {intent}") - # 如果是明确的离别意图,发送告别语并关闭连接 - await send_stt_message(conn, original_text) - conn.executor.submit(conn.chat_and_close, original_text) - return True + try: + # 尝试将结果解析为JSON + intent_data = json.loads(intent_result) - # 处理播放音乐意图 - if "播放音乐" in intent: - logger.bind(tag=TAG).info(f"识别到音乐播放意图: {intent}") - # 调用play_music函数来播放音乐 - song_name = extract_text_in_brackets(intent) - function_id = str(uuid.uuid4().hex) - function_name = "play_music" - function_arguments = '{ "song_name": "' + song_name + '" }' + # 检查是否有function_call + if "function_call" in intent_data: + # 直接从意图识别获取了function_call + conn.logger.bind(tag=TAG).debug( + f"检测到function_call格式的意图结果: {intent_data['function_call']['name']}" + ) + function_name = intent_data["function_call"]["name"] + if function_name == "continue_chat": + return False - function_call_data = { - "name": function_name, - "id": function_id, - "arguments": function_arguments - } - conn.func_handler.handle_llm_function_call(conn, function_call_data) - return True + if function_name == "play_music": + funcItem = conn.func_handler.get_function(function_name) + if not funcItem: + conn.func_handler.function_registry.register_function("play_music") - # 其他意图处理可以在这里扩展 + function_args = None + if "arguments" in intent_data["function_call"]: + function_args = intent_data["function_call"]["arguments"] + # 确保参数是字符串格式的JSON + if isinstance(function_args, dict): + function_args = json.dumps(function_args) - # 默认返回False,表示继续常规聊天流程 - return False + function_call_data = { + "name": function_name, + "id": str(uuid.uuid4().hex), + "arguments": function_args, + } + + await send_stt_message(conn, original_text) + + # 使用executor执行函数调用和结果处理 + def process_function_call(): + conn.dialogue.put(Message(role="user", content=original_text)) + result = conn.func_handler.handle_llm_function_call( + conn, function_call_data + ) + if result and function_name != "play_music": + # 获取当前最新的文本索引 + text = result.response + if text is None: + text = result.result + if text is not None: + text_index = ( + conn.tts_last_text_index + 1 + if hasattr(conn, "tts_last_text_index") + else 0 + ) + conn.recode_first_last_text(text, text_index) + future = conn.executor.submit( + conn.speak_and_play, text, text_index + ) + conn.llm_finish_task = True + conn.tts_queue.put((future, text_index)) + conn.dialogue.put(Message(role="assistant", content=text)) + + # 将函数执行放在线程池中 + conn.executor.submit(process_function_call) + return True + return False + except json.JSONDecodeError as e: + conn.logger.bind(tag=TAG).error(f"处理意图结果时出错: {e}") + return False def extract_text_in_brackets(s): @@ -106,10 +135,14 @@ def extract_text_in_brackets(s): :param s: 输入字符串 :return: 中括号内的文字,如果不存在则返回空字符串 """ - left_bracket_index = s.find('[') - right_bracket_index = s.find(']') + left_bracket_index = s.find("[") + right_bracket_index = s.find("]") - if left_bracket_index != -1 and right_bracket_index != -1 and left_bracket_index < right_bracket_index: - return s[left_bracket_index + 1:right_bracket_index] + if ( + left_bracket_index != -1 + and right_bracket_index != -1 + and left_bracket_index < right_bracket_index + ): + return s[left_bracket_index + 1 : right_bracket_index] else: - return "" \ No newline at end of file + return "" diff --git a/main/xiaozhi-server/core/handle/iotHandle.py b/main/xiaozhi-server/core/handle/iotHandle.py index 1f75330dc..124321021 100644 --- a/main/xiaozhi-server/core/handle/iotHandle.py +++ b/main/xiaozhi-server/core/handle/iotHandle.py @@ -1,10 +1,15 @@ import json import asyncio from config.logger import setup_logging -from plugins_func.register import device_type_registry, register_function, ActionResponse, Action, ToolType +from plugins_func.register import ( + device_type_registry, + register_function, + ActionResponse, + Action, + ToolType, +) TAG = __name__ -logger = setup_logging() def wrap_async_function(async_func): @@ -14,10 +19,13 @@ def wrap_async_function(async_func): try: # 获取连接对象(第一个参数) conn = args[0] - if not hasattr(conn, 'loop'): - logger.bind(tag=TAG).error("Connection对象没有loop属性") - return ActionResponse(Action.ERROR, "Connection对象没有loop属性", - "执行操作时出错: Connection对象没有loop属性") + if not hasattr(conn, "loop"): + conn.logger.bind(tag=TAG).error("Connection对象没有loop属性") + return ActionResponse( + Action.ERROR, + "Connection对象没有loop属性", + "执行操作时出错: Connection对象没有loop属性", + ) # 使用conn对象中的事件循环 loop = conn.loop @@ -26,7 +34,7 @@ def wrap_async_function(async_func): # 等待结果返回 return future.result() except Exception as e: - logger.bind(tag=TAG).error(f"运行异步函数时出错: {e}") + conn.logger.bind(tag=TAG).error(f"运行异步函数时出错: {e}") return ActionResponse(Action.ERROR, str(e), f"执行操作时出错: {e}") return wrapper @@ -37,11 +45,20 @@ def create_iot_function(device_name, method_name, method_info): 根据IOT设备描述生成通用的控制函数 """ - async def iot_control_function(conn, response_success=None, response_failure=None, **params): + async def iot_control_function( + conn, response_success=None, response_failure=None, **params + ): try: + # 设置默认响应消息 + if not response_success: + response_success = "操作成功" + if not response_failure: + response_failure = "操作失败" + # 打印响应参数 - logger.bind(tag=TAG).info( - f"控制函数接收到的响应参数: success='{response_success}', failure='{response_failure}'") + conn.logger.bind(tag=TAG).debug( + f"控制函数接收到的响应参数: success='{response_success}', failure='{response_failure}'" + ) # 发送控制命令 await send_iot_conn(conn, device_name, method_name, params) @@ -51,14 +68,15 @@ def create_iot_function(device_name, method_name, method_info): # 生成结果信息 result = f"{device_name}的{method_name}操作执行成功" - # 处理响应中可能的占位符 response = response_success # 替换{value}占位符 for param_name, param_value in params.items(): # 先尝试直接替换参数值 if "{" + param_name + "}" in response: - response = response.replace("{" + param_name + "}", str(param_value)) + response = response.replace( + "{" + param_name + "}", str(param_value) + ) # 如果有{value}占位符,用相关参数替换 if "{value}" in response: @@ -67,7 +85,9 @@ def create_iot_function(device_name, method_name, method_info): return ActionResponse(Action.RESPONSE, result, response) except Exception as e: - logger.bind(tag=TAG).error(f"执行{device_name}的{method_name}操作失败: {e}") + conn.logger.bind(tag=TAG).error( + f"执行{device_name}的{method_name}操作失败: {e}" + ) # 操作失败时使用大模型提供的失败响应 response = response_failure @@ -85,8 +105,9 @@ def create_iot_query_function(device_name, prop_name, prop_info): async def iot_query_function(conn, response_success=None, response_failure=None): try: # 打印响应参数 - logger.bind(tag=TAG).info( - f"查询函数接收到的响应参数: success='{response_success}', failure='{response_failure}'") + conn.logger.bind(tag=TAG).info( + f"查询函数接收到的响应参数: success='{response_success}', failure='{response_failure}'" + ) value = await get_iot_status(conn, device_name, prop_name) @@ -102,7 +123,9 @@ def create_iot_query_function(device_name, prop_name, prop_info): return ActionResponse(Action.ERROR, f"属性{prop_name}不存在", response) except Exception as e: - logger.bind(tag=TAG).error(f"查询{device_name}的{prop_name}时出错: {e}") + conn.logger.bind(tag=TAG).error( + f"查询{device_name}的{prop_name}时出错: {e}" + ) # 查询出错时使用大模型提供的失败响应 response = response_failure @@ -124,33 +147,34 @@ class IotDescriptor: self.methods = [] # 根据描述创建属性 - for key, value in properties.items(): - property_item = globals()[key] = {} - property_item['name'] = key - property_item["description"] = value["description"] - if value["type"] == "number": - property_item["value"] = 0 - elif value["type"] == "boolean": - property_item["value"] = False - else: - property_item["value"] = "" - self.properties.append(property_item) + if properties is not None: + for key, value in properties.items(): + property_item = {} + property_item["name"] = key + property_item["description"] = value["description"] + if value["type"] == "number": + property_item["value"] = 0 + elif value["type"] == "boolean": + property_item["value"] = False + else: + property_item["value"] = "" + self.properties.append(property_item) # 根据描述创建方法 - for key, value in methods.items(): - method = globals()[key] = {} - method["description"] = value["description"] - method['name'] = key - for k, v in value["parameters"].items(): - method[k] = {} - method[k]["description"] = v["description"] - if v["type"] == "number": - method[k]["value"] = 0 - elif v["type"] == "boolean": - method[k]["value"] = False - else: - method[k]["value"] = "" - self.methods.append(method) + if methods is not None: + for key, value in methods.items(): + method = {} + method["description"] = value["description"] + method["name"] = key + # 检查方法是否有参数 + if "parameters" in value: + method["parameters"] = {} + for k, v in value["parameters"].items(): + method["parameters"][k] = { + "description": v["description"], + "type": v["type"], + } + self.methods.append(method) def register_device_type(descriptor): @@ -177,19 +201,21 @@ def register_device_type(descriptor): "properties": { "response_success": { "type": "string", - "description": f"查询成功时的友好回复,必须使用{{value}}作为占位符表示查询到的值" + "description": f"查询成功时的友好回复,必须使用{{value}}作为占位符表示查询到的值", }, "response_failure": { "type": "string", - "description": f"查询失败时的友好回复,例如:'无法获取{device_name}的{prop_info['description']}'" - } + "description": f"查询失败时的友好回复,例如:'无法获取{device_name}的{prop_info['description']}'", + }, }, - "required": ["response_success", "response_failure"] - } - } + "required": ["response_success", "response_failure"], + }, + }, } query_func = create_iot_query_function(device_name, prop_name, prop_info) - decorated_func = register_function(func_name, func_desc, ToolType.IOT_CTL)(query_func) + decorated_func = register_function(func_name, func_desc, ToolType.IOT_CTL)( + query_func + ) functions[func_name] = decorated_func # 为每个方法创建控制函数 @@ -197,28 +223,35 @@ def register_device_type(descriptor): func_name = f"{device_name.lower()}_{method_name.lower()}" # 创建参数字典,添加原有参数 - parameters = { - param_name: { - "type": param_info["type"], - "description": param_info["description"] + parameters = {} + required_params = [] + + # 如果方法有参数,则添加参数信息 + if "parameters" in method_info: + parameters = { + param_name: { + "type": param_info["type"], + "description": param_info["description"], + } + for param_name, param_info in method_info["parameters"].items() } - for param_name, param_info in method_info["parameters"].items() - } + required_params = list(method_info["parameters"].keys()) # 添加响应参数 - parameters.update({ - "response_success": { - "type": "string", - "description": "操作成功时的友好回复,关于该设备的操作结果,设备名称尽量使用description中的名称" - }, - "response_failure": { - "type": "string", - "description": "操作失败时的友好回复,关于该设备的操作结果,设备名称尽量使用description中的名称" + parameters.update( + { + "response_success": { + "type": "string", + "description": "操作成功时的友好回复,关于该设备的操作结果,设备名称尽量使用description中的名称", + }, + "response_failure": { + "type": "string", + "description": "操作失败时的友好回复,关于该设备的操作结果,设备名称尽量使用description中的名称", + }, } - }) + ) # 构建必须参数列表(原有参数 + 响应参数) - required_params = list(method_info["parameters"].keys()) required_params.extend(["response_success", "response_failure"]) func_desc = { @@ -229,12 +262,14 @@ def register_device_type(descriptor): "parameters": { "type": "object", "properties": parameters, - "required": required_params - } - } + "required": required_params, + }, + }, } control_func = create_iot_function(device_name, method_name, method_info) - decorated_func = register_function(func_name, func_desc, ToolType.IOT_CTL)(control_func) + decorated_func = register_function(func_name, func_desc, ToolType.IOT_CTL)( + control_func + ) functions[func_name] = decorated_func device_type_registry.register_device_type(type_id, functions) @@ -243,13 +278,43 @@ def register_device_type(descriptor): # 用于接受前端设备推送的搜索iot描述 async def handleIotDescriptors(conn, descriptors): + wait_max_time = 5 + while conn.func_handler is None or not conn.func_handler.finish_init: + await asyncio.sleep(1) + wait_max_time -= 1 + if wait_max_time <= 0: + conn.logger.bind(tag=TAG).debug("连接对象没有func_handler") + return """处理物联网描述""" functions_changed = False for descriptor in descriptors: + + # 如果descriptor没有properties和methods,则直接跳过 + if "properties" not in descriptor and "methods" not in descriptor: + continue + + # 处理缺失properties的情况 + if "properties" not in descriptor: + descriptor["properties"] = {} + # 从methods中提取所有参数作为properties + if "methods" in descriptor: + for method_name, method_info in descriptor["methods"].items(): + if "parameters" in method_info: + for param_name, param_info in method_info["parameters"].items(): + # 将参数信息转换为属性信息 + descriptor["properties"][param_name] = { + "description": param_info["description"], + "type": param_info["type"], + } + # 创建IOT设备描述符 - iot_descriptor = IotDescriptor(descriptor["name"], descriptor["description"], descriptor["properties"], - descriptor["methods"]) + iot_descriptor = IotDescriptor( + descriptor["name"], + descriptor["description"], + descriptor["properties"], + descriptor["methods"], + ) conn.iot_descriptors[descriptor["name"]] = iot_descriptor if conn.use_function_call_mode: @@ -258,18 +323,22 @@ async def handleIotDescriptors(conn, descriptors): device_functions = device_type_registry.get_device_functions(type_id) # 在连接级注册设备函数 - if hasattr(conn, 'func_handler'): + if hasattr(conn, "func_handler"): for func_name in device_functions: conn.func_handler.function_registry.register_function(func_name) - logger.bind(tag=TAG).info(f"注册IOT函数到function handler: {func_name}") + conn.logger.bind(tag=TAG).info( + f"注册IOT函数到function handler: {func_name}" + ) functions_changed = True # 如果注册了新函数,更新function描述列表 - if functions_changed and hasattr(conn, 'func_handler'): + if functions_changed and hasattr(conn, "func_handler"): conn.func_handler.upload_functions_desc() func_names = conn.func_handler.current_support_functions() - logger.bind(tag=TAG).info(f"设备类型: {type_id}") - logger.bind(tag=TAG).info(f"更新function描述列表完成,当前支持的函数: {func_names}") + conn.logger.bind(tag=TAG).info(f"设备类型: {type_id}") + conn.logger.bind(tag=TAG).info( + f"更新function描述列表完成,当前支持的函数: {func_names}" + ) async def handleIotStatus(conn, states): @@ -281,11 +350,15 @@ async def handleIotStatus(conn, states): for k, v in state["state"].items(): if property_item["name"] == k: if type(v) != type(property_item["value"]): - logger.bind(tag=TAG).error(f"属性{property_item['name']}的值类型不匹配") + conn.logger.bind(tag=TAG).error( + f"属性{property_item['name']}的值类型不匹配" + ) break else: property_item["value"] = v - logger.bind(tag=TAG).info(f"物联网状态更新: {key} , {property_item['name']} = {v}") + conn.logger.bind(tag=TAG).info( + f"物联网状态更新: {key} , {property_item['name']} = {v}" + ) break break @@ -297,7 +370,7 @@ async def get_iot_status(conn, name, property_name): for property_item in value.properties: if property_item["name"] == property_name: return property_item["value"] - logger.bind(tag=TAG).warning(f"未找到设备 {name} 的属性 {property_name}") + conn.logger.bind(tag=TAG).warning(f"未找到设备 {name} 的属性 {property_name}") return None @@ -308,12 +381,16 @@ async def set_iot_status(conn, name, property_name, value): for property_item in iot_descriptor.properties: if property_item["name"] == property_name: if type(value) != type(property_item["value"]): - logger.bind(tag=TAG).error(f"属性{property_item['name']}的值类型不匹配") + conn.logger.bind(tag=TAG).error( + f"属性{property_item['name']}的值类型不匹配" + ) return property_item["value"] = value - logger.bind(tag=TAG).info(f"物联网状态更新: {name} , {property_name} = {value}") + conn.logger.bind(tag=TAG).info( + f"物联网状态更新: {name} , {property_name} = {value}" + ) return - logger.bind(tag=TAG).warning(f"未找到设备 {name} 的属性 {property_name}") + conn.logger.bind(tag=TAG).warning(f"未找到设备 {name} 的属性 {property_name}") async def send_iot_conn(conn, name, method_name, parameters): @@ -324,15 +401,17 @@ async def send_iot_conn(conn, name, method_name, parameters): for method in value.methods: # 找到了方法 if method["name"] == method_name: - await conn.websocket.send(json.dumps({ - "type": "iot", - "commands": [ - { - "name": name, - "method": method_name, - "parameters": parameters - } - ] - })) + # 构建命令对象 + command = { + "name": name, + "method": method_name, + } + + # 只有当参数不为空时才添加parameters字段 + if parameters: + command["parameters"] = parameters + send_message = json.dumps({"type": "iot", "commands": [command]}) + await conn.websocket.send(send_message) + conn.logger.bind(tag=TAG).info(f"发送物联网指令: {send_message}") return - logger.bind(tag=TAG).error(f"未找到方法{method_name}") + conn.logger.bind(tag=TAG).error(f"未找到方法{method_name}") diff --git a/main/xiaozhi-server/core/handle/receiveAudioHandle.py b/main/xiaozhi-server/core/handle/receiveAudioHandle.py index c5b4135ca..992ae96f2 100644 --- a/main/xiaozhi-server/core/handle/receiveAudioHandle.py +++ b/main/xiaozhi-server/core/handle/receiveAudioHandle.py @@ -1,16 +1,20 @@ -from config.logger import setup_logging import time +import copy from core.utils.util import remove_punctuation_and_length from core.handle.sendAudioHandle import send_stt_message from core.handle.intentHandler import handle_user_intent +from core.utils.output_counter import check_device_output_limit +from core.handle.ttsReportHandle import enqueue_tts_report +from core.utils.util import audio_to_data TAG = __name__ -logger = setup_logging() async def handleAudioMessage(conn, audio): + if conn.vad is None: + return if not conn.asr_server_receive: - logger.bind(tag=TAG).debug(f"前期数据处理中,暂停接收") + conn.logger.bind(tag=TAG).debug(f"前期数据处理中,暂停接收") return if conn.client_listen_mode == "auto": have_voice = conn.vad.is_vad(conn, audio) @@ -21,7 +25,9 @@ async def handleAudioMessage(conn, audio): if have_voice == False and conn.client_have_voice == False: await no_voice_close_connect(conn) conn.asr_audio.append(audio) - conn.asr_audio = conn.asr_audio[-5:] # 保留最新的5帧音频内容,解决ASR句首丢字问题 + conn.asr_audio = conn.asr_audio[ + -10: + ] # 保留最新的10帧音频内容,解决ASR句首丢字问题 return conn.client_no_voice_last_time = 0.0 conn.asr_audio.append(audio) @@ -30,13 +36,16 @@ async def handleAudioMessage(conn, audio): conn.client_abort = False conn.asr_server_receive = False # 音频太短了,无法识别 - if len(conn.asr_audio) < 10: + if len(conn.asr_audio) < 15: conn.asr_server_receive = True else: - text, file_path = await conn.asr.speech_to_text(conn.asr_audio, conn.session_id) - logger.bind(tag=TAG).info(f"识别文本: {text}") + text, _ = await conn.asr.speech_to_text(conn.asr_audio, conn.session_id) + conn.logger.bind(tag=TAG).info(f"识别文本: {text}") text_len, _ = remove_punctuation_and_length(text) if text_len > 0: + # 使用自定义模块进行上报 + enqueue_tts_report(conn, 1, text, copy.deepcopy(conn.asr_audio)) + await startToChat(conn, text) else: conn.asr_server_receive = True @@ -45,14 +54,26 @@ async def handleAudioMessage(conn, audio): async def startToChat(conn, text): + if conn.need_bind: + await check_bind_device(conn) + return + + # 如果当日的输出字数大于限定的字数 + if conn.max_output_size > 0: + if check_device_output_limit( + conn.headers.get("device-id"), conn.max_output_size + ): + await max_out_size(conn) + return + # 首先进行意图分析 intent_handled = await handle_user_intent(conn, text) - + if intent_handled: # 如果意图已被处理,不再进行聊天 conn.asr_server_receive = True return - + # 意图未被处理,继续常规聊天流程 await send_stt_message(conn, text) if conn.use_function_call_mode: @@ -67,10 +88,70 @@ async def no_voice_close_connect(conn): conn.client_no_voice_last_time = time.time() * 1000 else: no_voice_time = time.time() * 1000 - conn.client_no_voice_last_time - close_connection_no_voice_time = conn.config.get("close_connection_no_voice_time", 120) - if not conn.close_after_chat and no_voice_time > 1000 * close_connection_no_voice_time: + close_connection_no_voice_time = int( + conn.config.get("close_connection_no_voice_time", 120) + ) + if ( + not conn.close_after_chat + and no_voice_time > 1000 * close_connection_no_voice_time + ): conn.close_after_chat = True conn.client_abort = False conn.asr_server_receive = False - prompt = "请你以“时间过得真快”未来头,用富有感情、依依不舍的话来结束这场对话吧。" + prompt = ( + "请你以“时间过得真快”未来头,用富有感情、依依不舍的话来结束这场对话吧。" + ) await startToChat(conn, prompt) + + +async def max_out_size(conn): + text = "不好意思,我现在有点事情要忙,明天这个时候我们再聊,约好了哦!明天不见不散,拜拜!" + await send_stt_message(conn, text) + conn.tts_first_text_index = 0 + conn.tts_last_text_index = 0 + conn.llm_finish_task = True + file_path = "config/assets/max_output_size.wav" + opus_packets, _ = audio_to_data(file_path) + conn.audio_play_queue.put((opus_packets, text, 0)) + conn.close_after_chat = True + + +async def check_bind_device(conn): + if conn.bind_code: + # 确保bind_code是6位数字 + if len(conn.bind_code) != 6: + conn.logger.bind(tag=TAG).error(f"无效的绑定码格式: {conn.bind_code}") + text = "绑定码格式错误,请检查配置。" + await send_stt_message(conn, text) + return + + text = f"请登录控制面板,输入{conn.bind_code},绑定设备。" + await send_stt_message(conn, text) + conn.tts_first_text_index = 0 + conn.tts_last_text_index = 6 + conn.llm_finish_task = True + + # 播放提示音 + music_path = "config/assets/bind_code.wav" + opus_packets, _ = audio_to_data(music_path) + conn.audio_play_queue.put((opus_packets, text, 0)) + + # 逐个播放数字 + for i in range(6): # 确保只播放6位数字 + try: + digit = conn.bind_code[i] + num_path = f"config/assets/bind_code/{digit}.wav" + num_packets, _ = audio_to_data(num_path) + conn.audio_play_queue.put((num_packets, None, i + 1)) + except Exception as e: + conn.logger.bind(tag=TAG).error(f"播放数字音频失败: {e}") + continue + else: + text = f"没有找到该设备的版本信息,请正确配置 OTA地址,然后重新编译固件。" + await send_stt_message(conn, text) + conn.tts_first_text_index = 0 + conn.tts_last_text_index = 0 + conn.llm_finish_task = True + music_path = "config/assets/bind_not_found.wav" + opus_packets, _ = audio_to_data(music_path) + conn.audio_play_queue.put((opus_packets, text, 0)) diff --git a/main/xiaozhi-server/core/handle/sendAudioHandle.py b/main/xiaozhi-server/core/handle/sendAudioHandle.py index c0a664eb6..89f164263 100644 --- a/main/xiaozhi-server/core/handle/sendAudioHandle.py +++ b/main/xiaozhi-server/core/handle/sendAudioHandle.py @@ -1,48 +1,94 @@ -from config.logger import setup_logging import json import asyncio import time -from core.utils.util import remove_punctuation_and_length, get_string_no_punctuation_or_emoji +from core.utils.util import get_string_no_punctuation_or_emoji, analyze_emotion TAG = __name__ -logger = setup_logging() + +emoji_map = { + "neutral": "😶", + "happy": "🙂", + "laughing": "😆", + "funny": "😂", + "sad": "😔", + "angry": "😠", + "crying": "😭", + "loving": "😍", + "embarrassed": "😳", + "surprised": "😲", + "shocked": "😱", + "thinking": "🤔", + "winking": "😉", + "cool": "😎", + "relaxed": "😌", + "delicious": "🤤", + "kissy": "😘", + "confident": "😏", + "sleepy": "😴", + "silly": "😜", + "confused": "🙄", +} async def sendAudioMessage(conn, audios, text, text_index=0): # 发送句子开始消息 + if text is not None: + emotion = analyze_emotion(text) + emoji = emoji_map.get(emotion, "🙂") # 默认使用笑脸 + await conn.websocket.send( + json.dumps( + { + "type": "llm", + "text": emoji, + "emotion": emotion, + "session_id": conn.session_id, + } + ) + ) + if text_index == conn.tts_first_text_index: - logger.bind(tag=TAG).info(f"发送第一段语音: {text}") + conn.logger.bind(tag=TAG).info(f"发送第一段语音: {text}") await send_tts_message(conn, "sentence_start", text) - # 播放音频 - await sendAudio(conn, audios) + is_first_audio = text_index == conn.tts_first_text_index + await sendAudio(conn, audios, pre_buffer=is_first_audio) await send_tts_message(conn, "sentence_end", text) # 发送结束消息(如果是最后一个文本) if conn.llm_finish_task and text_index == conn.tts_last_text_index: - await send_tts_message(conn, 'stop', None) + await send_tts_message(conn, "stop", None) if conn.close_after_chat: await conn.close() + # 播放音频 -async def sendAudio(conn, audios): +async def sendAudio(conn, audios, pre_buffer=True): # 流控参数优化 frame_duration = 60 # 帧时长(毫秒),匹配 Opus 编码 start_time = time.perf_counter() play_position = 0 + last_reset_time = time.perf_counter() # 记录最后的重置时间 - # 预缓冲:发送前 3 帧 - pre_buffer = min(3, len(audios)) - for i in range(pre_buffer): - await conn.websocket.send(audios[i]) - conn.logger.bind(tag=TAG).debug(f"预缓冲帧 {i}, 时间: {(time.perf_counter() - start_time) * 1000:.2f}ms") + # 仅当第一句话时执行预缓冲 + if pre_buffer: + pre_buffer_frames = min(3, len(audios)) + for i in range(pre_buffer_frames): + await conn.websocket.send(audios[i]) + remaining_audios = audios[pre_buffer_frames:] + else: + remaining_audios = audios - # 正常播放剩余帧 - for opus_packet in audios[pre_buffer:]: + # 播放剩余音频帧 + for opus_packet in remaining_audios: if conn.client_abort: return - + + # 每分钟重置一次计时器 + if time.perf_counter() - last_reset_time > 60: + await conn.reset_timeout() + last_reset_time = time.perf_counter() + # 计算预期发送时间 expected_time = start_time + (play_position / 1000) current_time = time.perf_counter() @@ -51,19 +97,13 @@ async def sendAudio(conn, audios): await asyncio.sleep(delay) await conn.websocket.send(opus_packet) - conn.logger.bind(tag=TAG).debug(f"发送帧,位置: {play_position}ms, 实际间隔: {(time.perf_counter() - current_time) * 1000:.2f}ms") play_position += frame_duration - async def send_tts_message(conn, state, text=None): """发送 TTS 状态消息""" - message = { - "type": "tts", - "state": state, - "session_id": conn.session_id - } + message = {"type": "tts", "state": state, "session_id": conn.session_id} if text is not None: message["text"] = text @@ -72,8 +112,10 @@ async def send_tts_message(conn, state, text=None): # 播放提示音 tts_notify = conn.config.get("enable_stop_tts_notify", False) if tts_notify: - stop_tts_notify_voice = conn.config.get("stop_tts_notify_voice", "config/assets/tts_notify.mp3") - audios, duration = conn.tts.audio_to_opus_data(stop_tts_notify_voice) + stop_tts_notify_voice = conn.config.get( + "stop_tts_notify_voice", "config/assets/tts_notify.mp3" + ) + audios, _ = conn.tts.audio_to_opus_data(stop_tts_notify_voice) await sendAudio(conn, audios) # 清除服务端讲话状态 conn.clearSpeakStatus() @@ -85,16 +127,7 @@ async def send_tts_message(conn, state, text=None): async def send_stt_message(conn, text): """发送 STT 状态消息""" stt_text = get_string_no_punctuation_or_emoji(text) - await conn.websocket.send(json.dumps({ - "type": "stt", - "text": stt_text, - "session_id": conn.session_id} - )) await conn.websocket.send( - json.dumps({ - "type": "llm", - "text": "😊", - "emotion": "happy", - "session_id": conn.session_id} - )) + json.dumps({"type": "stt", "text": stt_text, "session_id": conn.session_id}) + ) await send_tts_message(conn, "start") diff --git a/main/xiaozhi-server/core/handle/textHandle.py b/main/xiaozhi-server/core/handle/textHandle.py index 3f60592ac..7ed36122c 100644 --- a/main/xiaozhi-server/core/handle/textHandle.py +++ b/main/xiaozhi-server/core/handle/textHandle.py @@ -1,4 +1,3 @@ -from config.logger import setup_logging import json from core.handle.abortHandle import handleAbortMessage from core.handle.helloHandle import handleHelloMessage @@ -6,27 +5,30 @@ from core.utils.util import remove_punctuation_and_length from core.handle.receiveAudioHandle import startToChat, handleAudioMessage from core.handle.sendAudioHandle import send_stt_message, send_tts_message from core.handle.iotHandle import handleIotDescriptors, handleIotStatus +from core.handle.ttsReportHandle import enqueue_tts_report +import asyncio TAG = __name__ -logger = setup_logging() async def handleTextMessage(conn, message): """处理文本消息""" - logger.bind(tag=TAG).info(f"收到文本消息:{message}") + conn.logger.bind(tag=TAG).info(f"收到文本消息:{message}") try: msg_json = json.loads(message) if isinstance(msg_json, int): await conn.websocket.send(message) return if msg_json["type"] == "hello": - await handleHelloMessage(conn) + await handleHelloMessage(conn, msg_json) elif msg_json["type"] == "abort": await handleAbortMessage(conn) elif msg_json["type"] == "listen": if "mode" in msg_json: conn.client_listen_mode = msg_json["mode"] - logger.bind(tag=TAG).debug(f"客户端拾音模式:{conn.client_listen_mode}") + conn.logger.bind(tag=TAG).debug( + f"客户端拾音模式:{conn.client_listen_mode}" + ) if msg_json["state"] == "start": conn.client_have_voice = True conn.client_voice_stop = False @@ -34,7 +36,7 @@ async def handleTextMessage(conn, message): conn.client_have_voice = True conn.client_voice_stop = True if len(conn.asr_audio) > 0: - await handleAudioMessage(conn, b'') + await handleAudioMessage(conn, b"") elif msg_json["state"] == "detect": conn.asr_server_receive = False conn.client_have_voice = False @@ -52,13 +54,87 @@ async def handleTextMessage(conn, message): # 如果是唤醒词,且关闭了唤醒词回复,就不用回答 await send_stt_message(conn, text) await send_tts_message(conn, "stop", None) + elif is_wakeup_words: + # 上报纯文字数据(复用ASR上报功能,但不提供音频数据) + enqueue_tts_report(conn, 1, "嘿,你好呀", []) + await startToChat(conn, "嘿,你好呀") else: + # 上报纯文字数据(复用ASR上报功能,但不提供音频数据) + enqueue_tts_report(conn, 1, text, []) # 否则需要LLM对文字内容进行答复 await startToChat(conn, text) elif msg_json["type"] == "iot": if "descriptors" in msg_json: - await handleIotDescriptors(conn, msg_json["descriptors"]) + asyncio.create_task(handleIotDescriptors(conn, msg_json["descriptors"])) if "states" in msg_json: - await handleIotStatus(conn, msg_json["states"]) + asyncio.create_task(handleIotStatus(conn, msg_json["states"])) + elif msg_json["type"] == "server": + # 如果配置是从API读取的,则需要验证secret + if not conn.read_config_from_api: + return + # 获取post请求的secret + post_secret = msg_json.get("content", {}).get("secret", "") + secret = conn.config["manager-api"].get("secret", "") + # 如果secret不匹配,则返回 + if post_secret != secret: + await conn.websocket.send( + json.dumps( + { + "type": "server", + "status": "error", + "message": "服务器密钥验证失败", + } + ) + ) + return + # 动态更新配置 + if msg_json["action"] == "update_config": + try: + # 更新WebSocketServer的配置 + if not conn.server: + await conn.websocket.send( + json.dumps( + { + "type": "config_update_response", + "status": "error", + "message": "无法获取服务器实例", + } + ) + ) + return + + if not await conn.server.update_config(): + await conn.websocket.send( + json.dumps( + { + "type": "config_update_response", + "status": "error", + "message": "更新服务器配置失败", + } + ) + ) + return + + # 发送成功响应 + await conn.websocket.send( + json.dumps( + { + "type": "config_update_response", + "status": "success", + "message": "配置更新成功", + } + ) + ) + except Exception as e: + conn.logger.bind(tag=TAG).error(f"更新配置失败: {str(e)}") + await conn.websocket.send( + json.dumps( + { + "type": "config_update_response", + "status": "error", + "message": f"更新配置失败: {str(e)}", + } + ) + ) except json.JSONDecodeError: await conn.websocket.send(message) diff --git a/main/xiaozhi-server/core/handle/ttsReportHandle.py b/main/xiaozhi-server/core/handle/ttsReportHandle.py new file mode 100644 index 000000000..ae8928ceb --- /dev/null +++ b/main/xiaozhi-server/core/handle/ttsReportHandle.py @@ -0,0 +1,110 @@ +""" +TTS上报功能已集成到ConnectionHandler类中。 + +上报功能包括: +1. 每个连接对象拥有自己的上报队列和处理线程 +2. 上报线程的生命周期与连接对象绑定 +3. 使用ConnectionHandler.enqueue_tts_report方法进行上报 + +具体实现请参考core/connection.py中的相关代码。 +""" + +import opuslib_next + +from config.manage_api_client import report + +TAG = __name__ + + +def report_tts(conn, type, text, opus_data): + """执行TTS上报操作 + + Args: + conn: 连接对象 + type: 上报类型,1为用户,2为智能体 + text: 合成文本 + opus_data: opus音频数据 + """ + try: + if opus_data: + audio_data = opus_to_wav(conn, opus_data) + else: + audio_data = None + # 执行上报 + report( + mac_address=conn.device_id, + session_id=conn.session_id, + chat_type=type, + content=text, + audio=audio_data, + ) + except Exception as e: + conn.logger.bind(tag=TAG).error(f"TTS上报失败: {e}") + + +def opus_to_wav(conn, opus_data): + """将Opus数据转换为WAV格式的字节流 + + Args: + output_dir: 输出目录(保留参数以保持接口兼容) + opus_data: opus音频数据 + + Returns: + bytes: WAV格式的音频数据 + """ + decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 + pcm_data = [] + + for opus_packet in opus_data: + try: + pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms + pcm_data.append(pcm_frame) + except opuslib_next.OpusError as e: + conn.logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) + + if not pcm_data: + raise ValueError("没有有效的PCM数据") + + # 创建WAV文件头 + pcm_data_bytes = b"".join(pcm_data) + num_samples = len(pcm_data_bytes) // 2 # 16-bit samples + + # WAV文件头 + wav_header = bytearray() + wav_header.extend(b"RIFF") # ChunkID + wav_header.extend((36 + len(pcm_data_bytes)).to_bytes(4, "little")) # ChunkSize + wav_header.extend(b"WAVE") # Format + wav_header.extend(b"fmt ") # Subchunk1ID + wav_header.extend((16).to_bytes(4, "little")) # Subchunk1Size + wav_header.extend((1).to_bytes(2, "little")) # AudioFormat (PCM) + wav_header.extend((1).to_bytes(2, "little")) # NumChannels + wav_header.extend((16000).to_bytes(4, "little")) # SampleRate + wav_header.extend((32000).to_bytes(4, "little")) # ByteRate + wav_header.extend((2).to_bytes(2, "little")) # BlockAlign + wav_header.extend((16).to_bytes(2, "little")) # BitsPerSample + wav_header.extend(b"data") # Subchunk2ID + wav_header.extend(len(pcm_data_bytes).to_bytes(4, "little")) # Subchunk2Size + + # 返回完整的WAV数据 + return bytes(wav_header) + pcm_data_bytes + + +def enqueue_tts_report(conn, type, text, opus_data): + if not conn.read_config_from_api or conn.need_bind: + return + """将TTS数据加入上报队列 + + Args: + conn: 连接对象 + text: 合成文本 + opus_data: opus音频数据 + """ + try: + # 使用连接对象的队列,传入文本和二进制数据而非文件路径 + conn.tts_report_queue.put((type, text, opus_data)) + + conn.logger.bind(tag=TAG).debug( + f"TTS数据已加入上报队列: {conn.device_id}, 音频大小: {len(opus_data)} " + ) + except Exception as e: + conn.logger.bind(tag=TAG).error(f"加入TTS上报队列失败: {text}, {e}") diff --git a/main/xiaozhi-server/core/mcp/MCPClient.py b/main/xiaozhi-server/core/mcp/MCPClient.py new file mode 100644 index 000000000..2ae34c292 --- /dev/null +++ b/main/xiaozhi-server/core/mcp/MCPClient.py @@ -0,0 +1,125 @@ +from __future__ import annotations + +from datetime import timedelta +import asyncio, os, shutil, concurrent.futures +from contextlib import AsyncExitStack +from typing import Optional, List, Dict, Any + +from mcp import ClientSession, StdioServerParameters +from mcp.client.stdio import stdio_client +from mcp.client.sse import sse_client +from config.logger import setup_logging + +TAG = __name__ + + +class MCPClient: + def __init__(self, config: Dict[str, Any]): + self.logger = setup_logging() + self.config = config + + self._worker_task: Optional[asyncio.Task] = None + self._ready_evt = asyncio.Event() + self._shutdown_evt = asyncio.Event() + + self.session: Optional[ClientSession] = None + self.tools: List = [] + + async def initialize(self): + if self._worker_task: + return + self._worker_task = asyncio.create_task(self._worker(), name="MCPClientWorker") + await self._ready_evt.wait() + + self.logger.bind(tag=TAG).info( + f"Connected, tools = {[t.name for t in self.tools]}" + ) + + async def cleanup(self): + if not self._worker_task: + return + + self._shutdown_evt.set() + try: + await asyncio.wait_for(self._worker_task, timeout=20) + except (asyncio.TimeoutError, Exception) as e: + self.logger.bind(tag=TAG).error(f"worker shutdown err: {e}") + finally: + self._worker_task = None + + def has_tool(self, name: str) -> bool: + return any(t.name == name for t in self.tools) + + def get_available_tools(self): + return [ + { + "type": "function", + "function": { + "name": t.name, + "description": t.description, + "parameters": t.inputSchema, + }, + } + for t in self.tools + ] + + async def call_tool(self, name: str, args: dict): + if not self.session: + raise RuntimeError("MCPClient not initialized") + + loop = self._worker_task.get_loop() + coro = self.session.call_tool(name, args) + + if loop is asyncio.get_running_loop(): + return await coro + + fut: concurrent.futures.Future = asyncio.run_coroutine_threadsafe(coro, loop) + return await asyncio.wrap_future(fut) + + async def _worker(self): + async with AsyncExitStack() as stack: + try: + # 建立 StdioClient + if "command" in self.config: + cmd = ( + shutil.which("npx") + if self.config["command"] == "npx" + else self.config["command"] + ) + env = {**os.environ, **self.config.get("env", {})} + params = StdioServerParameters( + command=cmd, + args=self.config.get("args", []), + env=env, + ) + stdio_r, stdio_w = await stack.enter_async_context(stdio_client(params)) + read_stream, write_stream = stdio_r, stdio_w + # 建立SSEClient + elif "url" in self.config: + sse_r, sse_w = await stack.enter_async_context(sse_client(self.config["url"])) + read_stream, write_stream = sse_r, sse_w + + else: + raise ValueError("MCPClient config must include 'command' or 'url'") + + self.session = await stack.enter_async_context( + ClientSession( + read_stream=read_stream, + write_stream=write_stream, + read_timeout_seconds=timedelta(seconds=15), + ) + ) + await self.session.initialize() + + # 获取工具 + self.tools = (await self.session.list_tools()).tools + + self._ready_evt.set() + + # 挂起等待关闭 + await self._shutdown_evt.wait() + + except Exception as e: + self.logger.bind(tag=TAG).error(f"worker error: {e}") + self._ready_evt.set() + raise diff --git a/main/xiaozhi-server/core/mcp/manager.py b/main/xiaozhi-server/core/mcp/manager.py new file mode 100644 index 000000000..dc2f9de92 --- /dev/null +++ b/main/xiaozhi-server/core/mcp/manager.py @@ -0,0 +1,131 @@ +"""MCP服务管理器""" + +import asyncio +import os, json +from typing import Dict, Any, List +from .MCPClient import MCPClient +from plugins_func.register import register_function, ToolType +from config.config_loader import get_project_dir + +TAG = __name__ + + +class MCPManager: + """管理多个MCP服务的集中管理器""" + + def __init__(self, conn) -> None: + """ + 初始化MCP管理器 + """ + self.conn = conn + self.config_path = get_project_dir() + "data/.mcp_server_settings.json" + if os.path.exists(self.config_path) == False: + self.config_path = "" + self.conn.logger.bind(tag=TAG).warning( + f"请检查mcp服务配置文件:data/.mcp_server_settings.json" + ) + self.client: Dict[str, MCPClient] = {} + self.tools = [] + + def load_config(self) -> Dict[str, Any]: + """加载MCP服务配置 + Returns: + Dict[str, Any]: 服务配置字典 + """ + if len(self.config_path) == 0: + return {} + + try: + with open(self.config_path, "r", encoding="utf-8") as f: + config = json.load(f) + return config.get("mcpServers", {}) + except Exception as e: + self.conn.logger.bind(tag=TAG).error( + f"Error loading MCP config from {self.config_path}: {e}" + ) + return {} + + async def initialize_servers(self) -> None: + """初始化所有MCP服务""" + config = self.load_config() + for name, srv_config in config.items(): + if not srv_config.get("command") and not srv_config.get("url"): + self.conn.logger.bind(tag=TAG).warning( + f"Skipping server {name}: neither command nor url specified" + ) + continue + + try: + client = MCPClient(srv_config) + await client.initialize() + self.client[name] = client + self.conn.logger.bind(tag=TAG).info(f"Initialized MCP client: {name}") + client_tools = client.get_available_tools() + self.tools.extend(client_tools) + for tool in client_tools: + func_name = "mcp_" + tool["function"]["name"] + register_function(func_name, tool, ToolType.MCP_CLIENT)( + self.execute_tool + ) + self.conn.func_handler.function_registry.register_function( + func_name + ) + + except Exception as e: + self.conn.logger.bind(tag=TAG).error( + f"Failed to initialize MCP server {name}: {e}" + ) + self.conn.func_handler.upload_functions_desc() + + def get_all_tools(self) -> List[Dict[str, Any]]: + """获取所有服务的工具function定义 + Returns: + List[Dict[str, Any]]: 所有工具的function定义列表 + """ + return self.tools + + def is_mcp_tool(self, tool_name: str) -> bool: + """检查是否是MCP工具 + Args: + tool_name: 工具名称 + Returns: + bool: 是否是MCP工具 + """ + for tool in self.tools: + if ( + tool.get("function") != None + and tool["function"].get("name") == tool_name + ): + return True + return False + + async def execute_tool(self, tool_name: str, arguments: Dict[str, Any]) -> Any: + """执行工具调用 + Args: + tool_name: 工具名称 + arguments: 工具参数 + Returns: + Any: 工具执行结果 + Raises: + ValueError: 工具未找到时抛出 + """ + self.conn.logger.bind(tag=TAG).info( + f"Executing tool {tool_name} with arguments: {arguments}" + ) + for client in self.client.values(): + if client.has_tool(tool_name): + return await client.call_tool(tool_name, arguments) + + raise ValueError(f"Tool {tool_name} not found in any MCP server") + + async def cleanup_all(self) -> None: + """依次关闭所有 MCPClient,不让异常阻断整体流程。""" + for name, client in list(self.client.items()): + try: + await asyncio.wait_for(client.cleanup(), timeout=20) + self.conn.logger.bind(tag=TAG).info(f"MCP client closed: {name}") + except (asyncio.TimeoutError, Exception) as e: + self.conn.logger.bind(tag=TAG).error( + f"Error closing MCP client {name}: {e}" + ) + self.client.clear() diff --git a/main/xiaozhi-server/core/ota_server.py b/main/xiaozhi-server/core/ota_server.py new file mode 100644 index 000000000..383725d91 --- /dev/null +++ b/main/xiaozhi-server/core/ota_server.py @@ -0,0 +1,135 @@ +import json +import time +import asyncio +from aiohttp import web +from config.logger import setup_logging +from core.connection import ConnectionHandler +from core.utils.util import get_local_ip, initialize_modules + +TAG = __name__ + + +class SimpleOtaServer: + def __init__(self, config: dict): + self.config = config + self.logger = setup_logging() + + def _get_websocket_url(self, local_ip: str, port: int) -> str: + """获取websocket地址 + + Args: + local_ip: 本地IP地址 + port: 端口号 + + Returns: + str: websocket地址 + """ + server_config = self.config["server"] + websocket_config = server_config.get("websocket") + + if websocket_config and "你" not in websocket_config: + return websocket_config + else: + return f"ws://{local_ip}:{port}/xiaozhi/v1/" + + async def start(self): + server_config = self.config["server"] + host = server_config.get("ip", "0.0.0.0") + port = int(server_config.get("ota_port")) + + if port: + app = web.Application() + # 添加路由 + app.add_routes( + [ + web.get("/xiaozhi/ota/", self._handle_ota_get_request), + web.post("/xiaozhi/ota/", self._handle_ota_request), + web.options("/xiaozhi/ota/", self._handle_ota_request), + ] + ) + + # 运行服务 + runner = web.AppRunner(app) + await runner.setup() + site = web.TCPSite(runner, host, port) + await site.start() + + # 保持服务运行 + while True: + await asyncio.sleep(3600) # 每隔 1 小时检查一次 + + async def _handle_ota_request(self, request): + """处理 /xiaozhi/ota/ 的 POST 请求""" + try: + data = await request.text() + self.logger.bind(tag=TAG).debug(f"OTA请求方法: {request.method}") + self.logger.bind(tag=TAG).debug(f"OTA请求头: {request.headers}") + self.logger.bind(tag=TAG).debug(f"OTA请求数据: {data}") + + device_id = request.headers.get("device-id", "") + if device_id: + self.logger.bind(tag=TAG).info(f"OTA请求设备ID: {device_id}") + else: + raise Exception("OTA请求设备ID为空") + + data_json = json.loads(data) + + server_config = self.config["server"] + host = server_config.get("ip", "0.0.0.0") + port = int(server_config.get("port", 8000)) + local_ip = get_local_ip() + + # OTA基础信息 + return_json = { + "server_time": { + "timestamp": int(round(time.time() * 1000)), + "timezone_offset": server_config.get("timezone_offset", 8) * 60, + }, + "firmware": { + "version": data_json["application"].get("version", "1.0.0"), + "url": "", + }, + "websocket": { + "url": self._get_websocket_url(local_ip, port), + }, + } + response = web.Response( + text=json.dumps(return_json, separators=(",", ":")), + content_type="application/json", + ) + except Exception as e: + self.logger.bind(tag=TAG).error(f"OTA请求异常: {e}") + return_json = {"success": False, "message": "request error."} + response = web.Response( + text=json.dumps(return_json, separators=(",", ":")), + content_type="application/json", + ) + finally: + # 添加header,允许跨域访问 + response.headers["Access-Control-Allow-Headers"] = ( + "client-id, content-type, device-id" + ) + response.headers["Access-Control-Allow-Credentials"] = "true" + response.headers["Access-Control-Allow-Origin"] = "*" + return response + + async def _handle_ota_get_request(self, request): + """处理 /xiaozhi/ota/ 的 GET 请求""" + try: + server_config = self.config["server"] + local_ip = get_local_ip() + port = int(server_config.get("port", 8000)) + websocket_url = self._get_websocket_url(local_ip, port) + message = f"OTA接口运行正常,向设备发送的websocket地址是:{websocket_url}" + response = web.Response(text=message, content_type="text/plain") + except Exception as e: + self.logger.bind(tag=TAG).error(f"OTA GET请求异常: {e}") + response = web.Response(text="OTA接口异常", content_type="text/plain") + finally: + # 添加header,允许跨域访问 + response.headers["Access-Control-Allow-Headers"] = ( + "client-id, content-type, device-id" + ) + response.headers["Access-Control-Allow-Credentials"] = "true" + response.headers["Access-Control-Allow-Origin"] = "*" + return response diff --git a/main/xiaozhi-server/core/providers/asr/aliyun.py b/main/xiaozhi-server/core/providers/asr/aliyun.py new file mode 100644 index 000000000..6606168c9 --- /dev/null +++ b/main/xiaozhi-server/core/providers/asr/aliyun.py @@ -0,0 +1,270 @@ +import http.client +import json +import asyncio +from typing import Optional, Tuple, List +import opuslib_next +import wave +import io +import os +import uuid +import hmac +import hashlib +import base64 +import requests +from urllib import parse +import time +from datetime import datetime +from config.logger import setup_logging +from core.providers.asr.base import ASRProviderBase + +TAG = __name__ +logger = setup_logging() + + +class AccessToken: + @staticmethod + def _encode_text(text): + encoded_text = parse.quote_plus(text) + return encoded_text.replace("+", "%20").replace("*", "%2A").replace("%7E", "~") + + @staticmethod + def _encode_dict(dic): + keys = dic.keys() + dic_sorted = [(key, dic[key]) for key in sorted(keys)] + encoded_text = parse.urlencode(dic_sorted) + return encoded_text.replace("+", "%20").replace("*", "%2A").replace("%7E", "~") + + @staticmethod + def create_token(access_key_id, access_key_secret): + parameters = { + "AccessKeyId": access_key_id, + "Action": "CreateToken", + "Format": "JSON", + "RegionId": "cn-shanghai", + "SignatureMethod": "HMAC-SHA1", + "SignatureNonce": str(uuid.uuid1()), + "SignatureVersion": "1.0", + "Timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + "Version": "2019-02-28", + } + # 构造规范化的请求字符串 + query_string = AccessToken._encode_dict(parameters) + # print('规范化的请求字符串: %s' % query_string) + # 构造待签名字符串 + string_to_sign = ( + "GET" + + "&" + + AccessToken._encode_text("/") + + "&" + + AccessToken._encode_text(query_string) + ) + # print('待签名的字符串: %s' % string_to_sign) + # 计算签名 + secreted_string = hmac.new( + bytes(access_key_secret + "&", encoding="utf-8"), + bytes(string_to_sign, encoding="utf-8"), + hashlib.sha1, + ).digest() + signature = base64.b64encode(secreted_string) + # print('签名: %s' % signature) + # 进行URL编码 + signature = AccessToken._encode_text(signature) + # print('URL编码后的签名: %s' % signature) + # 调用服务 + full_url = "http://nls-meta.cn-shanghai.aliyuncs.com/?Signature=%s&%s" % ( + signature, + query_string, + ) + # print('url: %s' % full_url) + # 提交HTTP GET请求 + response = requests.get(full_url) + if response.ok: + root_obj = response.json() + key = "Token" + if key in root_obj: + token = root_obj[key]["Id"] + expire_time = root_obj[key]["ExpireTime"] + return token, expire_time + # print(response.text) + return None, None + + +class ASRProvider(ASRProviderBase): + def __init__(self, config: dict, delete_audio_file: bool): + super().__init__() + """阿里云ASR初始化""" + # 新增空值判断逻辑 + self.access_key_id = config.get("access_key_id") + self.access_key_secret = config.get("access_key_secret") + + self.app_key = config.get("appkey") + self.host = "nls-gateway-cn-shanghai.aliyuncs.com" + self.base_url = f"https://{self.host}/stream/v1/asr" + self.sample_rate = 16000 + self.format = "wav" + self.output_dir = config.get("output_dir", "./audio_output") + self.delete_audio_file = delete_audio_file + + if self.access_key_id and self.access_key_secret: + # 使用密钥对生成临时token + self._refresh_token() + else: + # 直接使用预生成的长期token + self.token = config.get("token") + self.expire_time = None + + # 确保输出目录存在 + os.makedirs(self.output_dir, exist_ok=True) + + def _refresh_token(self): + """刷新Token并记录过期时间""" + if self.access_key_id and self.access_key_secret: + self.token, expire_time_str = AccessToken.create_token( + self.access_key_id, self.access_key_secret + ) + if not expire_time_str: + raise ValueError("无法获取有效的Token过期时间") + + try: + # 统一转换为字符串处理 + expire_str = str(expire_time_str).strip() + + if expire_str.isdigit(): + expire_time = datetime.fromtimestamp(int(expire_str)) + else: + expire_time = datetime.strptime(expire_str, "%Y-%m-%dT%H:%M:%SZ") + self.expire_time = expire_time.timestamp() - 60 + except Exception as e: + raise ValueError(f"无效的过期时间格式: {expire_str}") from e + + else: + self.expire_time = None + + if not self.token: + raise ValueError("无法获取有效的访问Token") + + def _is_token_expired(self): + """检查Token是否过期""" + if not self.expire_time: + return False # 长期Token不过期 + # 新增调试日志 + # current_time = time.time() + # remaining = self.expire_time - current_time + # print(f"Token过期检查: 当前时间 {datetime.fromtimestamp(current_time)} | " + # f"过期时间 {datetime.fromtimestamp(self.expire_time)} | " + # f"剩余 {remaining:.2f}秒") + return time.time() > self.expire_time + + def generate_filename(self, extension=".wav"): + return os.path.join( + self.output_file, + f"tts-{__name__}{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) + + def _construct_request_url(self) -> str: + """构造请求URL,包含参数""" + request = f"{self.base_url}?appkey={self.app_key}" + request += f"&format={self.format}" + request += f"&sample_rate={self.sample_rate}" + request += "&enable_punctuation_prediction=true" + request += "&enable_inverse_text_normalization=true" + request += "&enable_voice_detection=false" + return request + + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" + file_path = os.path.join(self.output_dir, file_name) + + with wave.open(file_path, "wb") as wf: + wf.setnchannels(1) # 单声道 + wf.setsampwidth(2) # 16-bit + wf.setframerate(self.sample_rate) + wf.writeframes(b"".join(pcm_data)) + + logger.bind(tag=TAG).debug(f"音频文件已保存至: {file_path}") + return file_path + + async def _send_request(self, pcm_data: bytes) -> Optional[str]: + """发送请求到阿里云ASR服务""" + try: + # 设置HTTP头 + headers = { + "X-NLS-Token": self.token, + "Content-type": "application/octet-stream", + "Content-Length": str(len(pcm_data)), + } + + # 创建连接并发送请求 + conn = http.client.HTTPSConnection(self.host) + request_url = self._construct_request_url() + + loop = asyncio.get_event_loop() + await loop.run_in_executor( + None, + lambda: conn.request( + method="POST", url=request_url, body=pcm_data, headers=headers + ), + ) + + # 获取响应 + response = await loop.run_in_executor(None, conn.getresponse) + body = await loop.run_in_executor(None, response.read) + conn.close() + + # 解析响应 + try: + body_json = json.loads(body) + status = body_json.get("status") + + if status == 20000000: + result = body_json.get("result", "") + logger.bind(tag=TAG).debug(f"ASR结果: {result}") + return result + else: + logger.bind(tag=TAG).error(f"ASR失败,状态码: {status}") + return None + + except ValueError: + logger.bind(tag=TAG).error("响应不是JSON格式") + return None + + except Exception as e: + logger.bind(tag=TAG).error(f"ASR请求失败: {e}", exc_info=True) + return None + + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: + """将语音数据转换为文本""" + if self._is_token_expired(): + logger.warning("Token已过期,正在自动刷新...") + self._refresh_token() + + file_path = None + try: + # 解码Opus为PCM + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) + + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + file_path = self.save_audio_to_file(pcm_data, session_id) + + # 发送请求并获取文本 + text = await self._send_request(combined_pcm_data) + + if text: + return text, file_path + + return "", file_path + + except Exception as e: + logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) + return "", file_path diff --git a/main/xiaozhi-server/core/providers/asr/baidu.py b/main/xiaozhi-server/core/providers/asr/baidu.py new file mode 100644 index 000000000..42e14d8b4 --- /dev/null +++ b/main/xiaozhi-server/core/providers/asr/baidu.py @@ -0,0 +1,106 @@ +import base64 +import hashlib +import hmac +import json +import time +from datetime import datetime, timezone +import os +import uuid +from typing import Optional, Tuple, List +import wave +import opuslib_next + +from aip import AipSpeech +from core.providers.asr.base import ASRProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() + + +class ASRProvider(ASRProviderBase): + def __init__(self, config: dict, delete_audio_file: bool = True): + super().__init__() + self.app_id = config.get("app_id") + self.api_key = config.get("api_key") + self.secret_key = config.get("secret_key") + + dev_pid = config.get("dev_pid", "1537") + self.dev_pid = int(dev_pid) if dev_pid else 1537 + + self.output_dir = config.get("output_dir") + self.delete_audio_file = delete_audio_file + + self.client = AipSpeech(str(self.app_id), self.api_key, self.secret_key) + + # 确保输出目录存在 + os.makedirs(self.output_dir, exist_ok=True) + + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" + file_path = os.path.join(self.output_dir, file_name) + + with wave.open(file_path, "wb") as wf: + wf.setnchannels(1) + wf.setsampwidth(2) # 2 bytes = 16-bit + wf.setframerate(16000) + wf.writeframes(b"".join(pcm_data)) + + return file_path + + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: + """将语音数据转换为文本""" + if not opus_data: + logger.bind(tag=TAG).warn("音频数据为空!") + return None, None + + file_path = None + try: + # 检查配置是否已设置 + if not self.app_id or not self.api_key or not self.secret_key: + logger.bind(tag=TAG).error("百度语音识别配置未设置,无法进行识别") + return None, file_path + + # 将Opus音频数据解码为PCM + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) + + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + self.save_audio_to_file(pcm_data, session_id) + + start_time = time.time() + # 识别本地文件 + result = self.client.asr( + combined_pcm_data, + "pcm", + 16000, + { + "dev_pid": str(self.dev_pid), + }, + ) + + if result and result["err_no"] == 0: + logger.bind(tag=TAG).debug( + f"百度语音识别耗时: {time.time() - start_time:.3f}s | 结果: {result}" + ) + result = result["result"][0] + return result, file_path + else: + raise Exception( + f"百度语音识别失败,错误码: {result['err_no']},错误信息: {result['err_msg']}" + ) + return None, file_path + + except Exception as e: + logger.bind(tag=TAG).error(f"处理音频时发生错误!{e}", exc_info=True) + return None, file_path diff --git a/main/xiaozhi-server/core/providers/asr/base.py b/main/xiaozhi-server/core/providers/asr/base.py index d8db22a86..227a906d8 100644 --- a/main/xiaozhi-server/core/providers/asr/base.py +++ b/main/xiaozhi-server/core/providers/asr/base.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from typing import Optional, Tuple, List - +import opuslib_next from config.logger import setup_logging TAG = __name__ @@ -8,12 +8,37 @@ logger = setup_logging() class ASRProviderBase(ABC): + def __init__(self): + self.audio_format = "opus" + @abstractmethod - def save_audio_to_file(self, opus_data: List[bytes], session_id: str) -> str: - """解码Opus数据并保存为WAV文件""" + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" pass @abstractmethod - async def speech_to_text(self, opus_data: List[bytes], session_id: str) -> Tuple[Optional[str], Optional[str]]: + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" pass + + def set_audio_format(self, format: str) -> None: + """设置音频格式""" + self.audio_format = format + + @staticmethod + def decode_opus(opus_data: List[bytes]) -> bytes: + """将Opus音频数据解码为PCM数据""" + + decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 + pcm_data = [] + + for opus_packet in opus_data: + try: + pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms + pcm_data.append(pcm_frame) + except opuslib_next.OpusError as e: + logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) + + return pcm_data diff --git a/main/xiaozhi-server/core/providers/asr/doubao.py b/main/xiaozhi-server/core/providers/asr/doubao.py index a5a5bb65b..403c181f1 100644 --- a/main/xiaozhi-server/core/providers/asr/doubao.py +++ b/main/xiaozhi-server/core/providers/asr/doubao.py @@ -45,14 +45,14 @@ def parse_response(res): payload 类似与http 请求体 """ protocol_version = res[0] >> 4 - header_size = res[0] & 0x0f + header_size = res[0] & 0x0F message_type = res[1] >> 4 - message_type_specific_flags = res[1] & 0x0f + message_type_specific_flags = res[1] & 0x0F serialization_method = res[2] >> 4 - message_compression = res[2] & 0x0f + message_compression = res[2] & 0x0F reserved = res[3] - header_extensions = res[4:header_size * 4] - payload = res[header_size * 4:] + header_extensions = res[4 : header_size * 4] + payload = res[header_size * 4 :] result = {} payload_msg = None payload_size = 0 @@ -61,13 +61,13 @@ def parse_response(res): payload_msg = payload[4:] elif message_type == SERVER_ACK: seq = int.from_bytes(payload[:4], "big", signed=True) - result['seq'] = seq + result["seq"] = seq if len(payload) >= 8: payload_size = int.from_bytes(payload[4:8], "big", signed=False) payload_msg = payload[8:] elif message_type == SERVER_ERROR_RESPONSE: code = int.from_bytes(payload[:4], "big", signed=False) - result['code'] = code + result["code"] = code payload_size = int.from_bytes(payload[4:8], "big", signed=False) payload_msg = payload[8:] if payload_msg is None: @@ -78,17 +78,21 @@ def parse_response(res): payload_msg = json.loads(str(payload_msg, "utf-8")) elif serialization_method != NO_SERIALIZATION: payload_msg = str(payload_msg, "utf-8") - result['payload_msg'] = payload_msg - result['payload_size'] = payload_size + result["payload_msg"] = payload_msg + result["payload_size"] = payload_size return result class ASRProvider(ASRProviderBase): def __init__(self, config: dict, delete_audio_file: bool): + super().__init__() self.appid = config.get("appid") self.cluster = config.get("cluster") self.access_token = config.get("access_token") + self.boosting_table_name = config.get("boosting_table_name", "") + self.correct_table_name = config.get("correct_table_name", "") self.output_dir = config.get("output_dir") + self.delete_audio_file = delete_audio_file self.host = "openspeech.bytedance.com" self.ws_url = f"wss://{self.host}/api/v2/asr" @@ -98,21 +102,12 @@ class ASRProvider(ASRProviderBase): # 确保输出目录存在 os.makedirs(self.output_dir, exist_ok=True) - def save_audio_to_file(self, opus_data: List[bytes], session_id: str) -> str: - """将Opus音频数据解码并保存为WAV文件""" - file_name = f"asr_{session_id}_{uuid.uuid4()}.wav" + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" file_path = os.path.join(self.output_dir, file_name) - decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 - pcm_data = [] - - for opus_packet in opus_data: - try: - pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms - pcm_data.append(pcm_frame) - except opuslib_next.OpusError as e: - logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) - with wave.open(file_path, "wb") as wf: wf.setnchannels(1) wf.setsampwidth(2) # 2 bytes = 16-bit @@ -122,7 +117,9 @@ class ASRProvider(ASRProviderBase): return file_path @staticmethod - def _generate_header(message_type=CLIENT_FULL_REQUEST, message_type_specific_flags=NO_SEQUENCE) -> bytearray: + def _generate_header( + message_type=CLIENT_FULL_REQUEST, message_type_specific_flags=NO_SEQUENCE + ) -> bytearray: """Generate protocol header.""" header = bytearray() header_size = 1 @@ -146,10 +143,12 @@ class ASRProvider(ASRProviderBase): "request": { "reqid": reqid, "show_utterances": False, - "sequence": 1 + "sequence": 1, + "boosting_table_name": self.boosting_table_name, + "correct_table_name": self.correct_table_name, }, "audio": { - "format": "wav", + "format": "raw", "rate": 16000, "language": "zh-CN", "bits": 16, @@ -158,18 +157,23 @@ class ASRProvider(ASRProviderBase): }, } - async def _send_request(self, audio_data: List[bytes], segment_size: int) -> Optional[str]: + async def _send_request( + self, audio_data: List[bytes], segment_size: int + ) -> Optional[str]: """Send request to Volcano ASR service.""" try: - auth_header = {'Authorization': 'Bearer; {}'.format(self.access_token)} - async with websockets.connect(self.ws_url, additional_headers=auth_header) as websocket: + auth_header = {"Authorization": "Bearer; {}".format(self.access_token)} + async with websockets.connect( + self.ws_url, additional_headers=auth_header + ) as websocket: # Prepare request data request_params = self._construct_request(str(uuid.uuid4())) - print(request_params) payload_bytes = str.encode(json.dumps(request_params)) payload_bytes = gzip.compress(payload_bytes) full_client_request = self._generate_header() - full_client_request.extend((len(payload_bytes)).to_bytes(4, 'big')) # payload size(4 bytes) + full_client_request.extend( + (len(payload_bytes)).to_bytes(4, "big") + ) # payload size(4 bytes) full_client_request.extend(payload_bytes) # payload # Send header and metadata @@ -177,22 +181,29 @@ class ASRProvider(ASRProviderBase): await websocket.send(full_client_request) res = await websocket.recv() result = parse_response(res) - if 'payload_msg' in result and result['payload_msg']['code'] != self.success_code: + if ( + "payload_msg" in result + and result["payload_msg"]["code"] != self.success_code + ): logger.bind(tag=TAG).error(f"ASR error: {result}") return None - for seq, (chunk, last) in enumerate(self.slice_data(audio_data, segment_size), 1): + for seq, (chunk, last) in enumerate( + self.slice_data(audio_data, segment_size), 1 + ): if last: audio_only_request = self._generate_header( message_type=CLIENT_AUDIO_ONLY_REQUEST, - message_type_specific_flags=NEG_SEQUENCE + message_type_specific_flags=NEG_SEQUENCE, ) else: audio_only_request = self._generate_header( message_type=CLIENT_AUDIO_ONLY_REQUEST ) payload_bytes = gzip.compress(chunk) - audio_only_request.extend((len(payload_bytes)).to_bytes(4, 'big')) # payload size(4 bytes) + audio_only_request.extend( + (len(payload_bytes)).to_bytes(4, "big") + ) # payload size(4 bytes) audio_only_request.extend(payload_bytes) # payload # Send audio data await websocket.send(audio_only_request) @@ -201,9 +212,12 @@ class ASRProvider(ASRProviderBase): response = await websocket.recv() result = parse_response(response) - if 'payload_msg' in result and result['payload_msg']['code'] == self.success_code: - if len(result['payload_msg']['result']) > 0: - return result['payload_msg']['result'][0]["text"] + if ( + "payload_msg" in result + and result["payload_msg"]["code"] == self.success_code + ): + if len(result["payload_msg"]["result"]) > 0: + return result["payload_msg"]["result"][0]["text"] return None else: logger.bind(tag=TAG).error(f"ASR error: {result}") @@ -213,29 +227,6 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).error(f"ASR request failed: {e}", exc_info=True) return None - @staticmethod - def decode_opus(opus_data: List[bytes], session_id: str) -> List[bytes]: - - decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 - pcm_data = [] - - for opus_packet in opus_data: - try: - pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms - pcm_data.append(pcm_frame) - except opuslib_next.OpusError as e: - logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) - - return pcm_data - - @staticmethod - def read_wav_info(data: io.BytesIO = None) -> (int, int, int, int, int): - with io.BytesIO(data) as _f: - wave_fp = wave.open(_f, 'rb') - nchannels, sampwidth, framerate, nframes = wave_fp.getparams()[:4] - wave_bytes = wave_fp.readframes(nframes) - return nchannels, sampwidth, framerate, nframes, len(wave_bytes) - @staticmethod def slice_data(data: bytes, chunk_size: int) -> (list, bool): """ @@ -247,40 +238,46 @@ class ASRProvider(ASRProviderBase): data_len = len(data) offset = 0 while offset + chunk_size < data_len: - yield data[offset: offset + chunk_size], False + yield data[offset : offset + chunk_size], False offset += chunk_size else: - yield data[offset: data_len], True + yield data[offset:data_len], True - async def speech_to_text(self, opus_data: List[bytes], session_id: str) -> Tuple[Optional[str], Optional[str]]: + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" + + file_path = None try: # 合并所有opus数据包 - pcm_data = self.decode_opus(opus_data, session_id) - combined_pcm_data = b''.join(pcm_data) + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) - wav_buffer = io.BytesIO() + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + file_path = self.save_audio_to_file(pcm_data, session_id) - with wave.open(wav_buffer, "wb") as wav_file: - wav_file.setnchannels(1) # 设置声道数 - wav_file.setsampwidth(2) # 设置采样宽度 - wav_file.setframerate(16000) # 设置采样率 - wav_file.writeframes(combined_pcm_data) # 写入 PCM 数据 - - # 获取封装后的 WAV 数据 - wav_data = wav_buffer.getvalue() - nchannels, sampwidth, framerate, nframes, wav_len = self.read_wav_info(wav_data) - size_per_sec = nchannels * sampwidth * framerate + # 直接使用PCM数据 + # 计算分段大小 (单声道, 16bit, 16kHz采样率) + size_per_sec = 1 * 2 * 16000 # nchannels * sampwidth * framerate segment_size = int(size_per_sec * self.seg_duration / 1000) # 语音识别 start_time = time.time() - text = await self._send_request(wav_data, segment_size) + text = await self._send_request(combined_pcm_data, segment_size) if text: - logger.bind(tag=TAG).debug(f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}") - return text, None - return "", None + logger.bind(tag=TAG).debug( + f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}" + ) + return text, file_path + return "", file_path except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", None + return "", file_path diff --git a/main/xiaozhi-server/core/providers/asr/fun_local.py b/main/xiaozhi-server/core/providers/asr/fun_local.py index 82d09ab52..ec3df17f1 100644 --- a/main/xiaozhi-server/core/providers/asr/fun_local.py +++ b/main/xiaozhi-server/core/providers/asr/fun_local.py @@ -6,9 +6,7 @@ import io from config.logger import setup_logging from typing import Optional, Tuple, List import uuid -import opuslib_next from core.providers.asr.base import ASRProviderBase - from funasr import AutoModel from funasr.utils.postprocess_utils import rich_transcription_postprocess @@ -35,6 +33,7 @@ class CaptureOutput: class ASRProvider(ASRProviderBase): def __init__(self, config: dict, delete_audio_file: bool): + super().__init__() self.model_dir = config.get("model_dir") self.output_dir = config.get("output_dir") # 修正配置键名 self.delete_audio_file = delete_audio_file @@ -46,25 +45,16 @@ class ASRProvider(ASRProviderBase): model=self.model_dir, vad_kwargs={"max_single_segment_time": 30000}, disable_update=True, - hub="hf" + hub="hf", # device="cuda:0", # 启用GPU加速 ) - def save_audio_to_file(self, opus_data: List[bytes], session_id: str) -> str: - """将Opus音频数据解码并保存为WAV文件""" - file_name = f"asr_{session_id}_{uuid.uuid4()}.wav" + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" file_path = os.path.join(self.output_dir, file_name) - decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 - pcm_data = [] - - for opus_packet in opus_data: - try: - pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms - pcm_data.append(pcm_frame) - except opuslib_next.OpusError as e: - logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) - with wave.open(file_path, "wb") as wf: wf.setnchannels(1) wf.setsampwidth(2) # 2 bytes = 16-bit @@ -73,38 +63,51 @@ class ASRProvider(ASRProviderBase): return file_path - async def speech_to_text(self, opus_data: List[bytes], session_id: str) -> Tuple[Optional[str], Optional[str]]: + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: """语音转文本主处理逻辑""" file_path = None try: - # 保存音频文件 - start_time = time.time() - file_path = self.save_audio_to_file(opus_data, session_id) - logger.bind(tag=TAG).debug(f"音频文件保存耗时: {time.time() - start_time:.3f}s | 路径: {file_path}") + # 合并所有opus数据包 + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + + combined_pcm_data = b"".join(pcm_data) + + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + file_path = self.save_audio_to_file(pcm_data, session_id) # 语音识别 start_time = time.time() result = self.model.generate( - input=file_path, + input=combined_pcm_data, cache={}, language="auto", use_itn=True, batch_size_s=60, ) text = rich_transcription_postprocess(result[0]["text"]) - logger.bind(tag=TAG).debug(f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}") + logger.bind(tag=TAG).debug( + f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}" + ) return text, file_path except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", None + return "", file_path - finally: - # 文件清理逻辑 - if self.delete_audio_file and file_path and os.path.exists(file_path): - try: - os.remove(file_path) - logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") - except Exception as e: - logger.bind(tag=TAG).error(f"文件删除失败: {file_path} | 错误: {e}") + # finally: + # # 文件清理逻辑 + # if self.delete_audio_file and file_path and os.path.exists(file_path): + # try: + # os.remove(file_path) + # logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") + # except Exception as e: + # logger.bind(tag=TAG).error(f"文件删除失败: {file_path} | 错误: {e}") diff --git a/main/xiaozhi-server/core/providers/asr/fun_server.py b/main/xiaozhi-server/core/providers/asr/fun_server.py new file mode 100644 index 000000000..53eb4e7fd --- /dev/null +++ b/main/xiaozhi-server/core/providers/asr/fun_server.py @@ -0,0 +1,172 @@ +from typing import Optional, Tuple, List +import opuslib_next +from core.providers.asr.base import ASRProviderBase +import os +import ssl +import json +import uuid +import wave +import websockets +from config.logger import setup_logging +import asyncio + +TAG = __name__ +logger = setup_logging() + + +class ASRProvider(ASRProviderBase): + def __init__(self, config: dict, delete_audio_file: bool): + """ + Initialize the ASRProvider with server configuration. + :param config: Dictionary containing 'host', 'port', and 'is_ssl'. + :param delete_audio_file: Boolean to indicate whether to delete audio files after processing. + """ + super().__init__() + self.host = config.get("host", "localhost") + self.port = config.get("port", 10095) + self.is_ssl = config.get("is_ssl", True) + self.output_dir = config.get("output_dir") + self.delete_audio_file = delete_audio_file + self.uri = ( + f"wss://{self.host}:{self.port}" + if self.is_ssl + else f"ws://{self.host}:{self.port}" + ) + self.ssl_context = ssl.SSLContext() if self.is_ssl else None + if self.ssl_context: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE + + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" + file_path = os.path.join(self.output_dir, file_name) + + with wave.open(file_path, "wb") as wf: + wf.setnchannels(1) + wf.setsampwidth(2) # 2 bytes = 16-bit + wf.setframerate(16000) + wf.writeframes(b"".join(pcm_data)) + + return file_path + + async def _receive_responses(self, ws) -> None: + """ + Asynchronous generator to receive messages from the WebSocket. + Yields each message as it is received. + """ + text = "" + while True: + try: + response = await asyncio.wait_for(ws.recv(), timeout=5) + response_data = json.loads(response) + logger.bind(tag=TAG).debug(f"Received response: {response_data}") + if response_data.get("is_final", True): + text += response_data.get("text", "") + break + else: + text += response_data.get("text", "") + except asyncio.TimeoutError: + logger.bind(tag=TAG).error( + "Timeout while waiting for response from WebSocket." + ) + break + except websockets.exceptions.ConnectionClosed as e: + logger.bind(tag=TAG).error(f"WebSocket connection closed: {e}") + break + return text + + async def _send_data(self, ws, pcm_data: bytes, session_id: str) -> tuple: + """ + Internal method to handle WebSocket communication. + Reuses the persistent WebSocket connection if available. + :param pcm_data: PCM audio data to send. + :param session_id: Unique session identifier. + :return: Tuple containing recognized text and optional timestamp. + """ + + # Send initial configuration message + config_message = json.dumps( + { + "mode": "offline", + "chunk_size": [5, 10, 5], + "chunk_interval": 10, + "wav_name": session_id, + "is_speaking": True, + "itn": False, + } + ) + await ws.send(config_message) + logger.bind(tag=TAG).debug(f"Sent configuration message: {config_message}") + + # Send PCM data + await ws.send(pcm_data) + logger.bind(tag=TAG).debug(f"Sent PCM data of length: {len(pcm_data)} bytes") + + # Indicate end of speech + end_message = json.dumps({"is_speaking": False}) + await ws.send(end_message) + logger.bind(tag=TAG).debug(f"Sent end message: {end_message}") + + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: + """ + Convert speech data to text using FunASR. + :param opus_data: List of Opus-encoded audio data chunks. + :param session_id: Unique session identifier. + :return: Tuple containing recognized text and optional timestamp. + """ + file_path = None + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) + + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + file_path = self.save_audio_to_file(pcm_data, session_id) + + async with websockets.connect( + self.uri, subprotocols=["binary"], ping_interval=None, ssl=self.ssl_context + ) as ws: + try: + # Use asyncio to handle WebSocket communication + send_task = asyncio.create_task( + self._send_data(ws, combined_pcm_data, session_id) + ) + receive_task = asyncio.create_task(self._receive_responses(ws)) + + # Gather tasks with error handling + done, pending = await asyncio.wait( + [send_task, receive_task], return_when=asyncio.FIRST_EXCEPTION + ) + + # Cancel any pending tasks + for task in pending: + task.cancel() + + # Check for exceptions in completed tasks + for task in done: + if task.exception(): + raise task.exception() + + # Get the result from the receive task + result = receive_task.result() + return ( + result, + file_path, + ) # Return the recognized text and timestamp (if any) + + except websockets.exceptions.ConnectionClosed as e: + logger.bind(tag=TAG).error(f"WebSocket connection closed: {e}") + return "", file_path + except Exception as e: + logger.bind(tag=TAG).error( + f"Error during speech-to-text conversion: {e}", exc_info=True + ) + return "", file_path diff --git a/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py b/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py index 3dfa3162a..667e1606d 100644 --- a/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py +++ b/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py @@ -37,17 +37,18 @@ class CaptureOutput: class ASRProvider(ASRProviderBase): def __init__(self, config: dict, delete_audio_file: bool): + super().__init__() self.model_dir = config.get("model_dir") self.output_dir = config.get("output_dir") self.delete_audio_file = delete_audio_file # 确保输出目录存在 os.makedirs(self.output_dir, exist_ok=True) - + # 初始化模型文件路径 model_files = { "model.int8.onnx": os.path.join(self.model_dir, "model.int8.onnx"), - "tokens.txt": os.path.join(self.model_dir, "tokens.txt") + "tokens.txt": os.path.join(self.model_dir, "tokens.txt"), } # 下载并检查模型文件 @@ -58,15 +59,15 @@ class ASRProvider(ASRProviderBase): model_file_download( model_id="pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue", file_path=file_name, - local_dir=self.model_dir + local_dir=self.model_dir, ) - + if not os.path.isfile(file_path): raise FileNotFoundError(f"模型文件下载失败: {file_path}") - + self.model_path = model_files["model.int8.onnx"] self.tokens_path = model_files["tokens.txt"] - + except Exception as e: logger.bind(tag=TAG).error(f"模型文件处理失败: {str(e)}") raise @@ -83,21 +84,12 @@ class ASRProvider(ASRProviderBase): use_itn=True, ) - def save_audio_to_file(self, opus_data: List[bytes], session_id: str) -> str: - """将Opus音频数据解码并保存为WAV文件""" - file_name = f"asr_{session_id}_{uuid.uuid4()}.wav" + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" file_path = os.path.join(self.output_dir, file_name) - decoder = opuslib_next.Decoder(16000, 1) # 16kHz, 单声道 - pcm_data = [] - - for opus_packet in opus_data: - try: - pcm_frame = decoder.decode(opus_packet, 960) # 960 samples = 60ms - pcm_data.append(pcm_frame) - except opuslib_next.OpusError as e: - logger.bind(tag=TAG).error(f"Opus解码错误: {e}", exc_info=True) - with wave.open(file_path, "wb") as wf: wf.setnchannels(1) wf.setsampwidth(2) # 2 bytes = 16-bit @@ -130,14 +122,22 @@ class ASRProvider(ASRProviderBase): samples_float32 = samples_float32 / 32768 return samples_float32, f.getframerate() - async def speech_to_text(self, opus_data: List[bytes], session_id: str) -> Tuple[Optional[str], Optional[str]]: + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: """语音转文本主处理逻辑""" file_path = None try: # 保存音频文件 start_time = time.time() - file_path = self.save_audio_to_file(opus_data, session_id) - logger.bind(tag=TAG).debug(f"音频文件保存耗时: {time.time() - start_time:.3f}s | 路径: {file_path}") + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + file_path = self.save_audio_to_file(pcm_data, session_id) + logger.bind(tag=TAG).debug( + f"音频文件保存耗时: {time.time() - start_time:.3f}s | 路径: {file_path}" + ) # 语音识别 start_time = time.time() @@ -146,14 +146,15 @@ class ASRProvider(ASRProviderBase): s.accept_waveform(sample_rate, samples) self.model.decode_stream(s) text = s.result.text - logger.bind(tag=TAG).debug(f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}") + logger.bind(tag=TAG).debug( + f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}" + ) return text, file_path except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", None - + return "", file_path finally: # 文件清理逻辑 if self.delete_audio_file and file_path and os.path.exists(file_path): diff --git a/main/xiaozhi-server/core/providers/asr/tencent.py b/main/xiaozhi-server/core/providers/asr/tencent.py new file mode 100644 index 000000000..d2db875e4 --- /dev/null +++ b/main/xiaozhi-server/core/providers/asr/tencent.py @@ -0,0 +1,254 @@ +import base64 +import hashlib +import hmac +import json +import time +from datetime import datetime, timezone +import os +import uuid +from typing import Optional, Tuple, List +import wave +import opuslib_next + +import requests +from core.providers.asr.base import ASRProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() + + +class ASRProvider(ASRProviderBase): + API_URL = "https://asr.tencentcloudapi.com" + API_VERSION = "2019-06-14" + FORMAT = "pcm" # 支持的音频格式:pcm, wav, mp3 + + def __init__(self, config: dict, delete_audio_file: bool = True): + super().__init__() + self.secret_id = config.get("secret_id") + self.secret_key = config.get("secret_key") + self.output_dir = config.get("output_dir") + self.delete_audio_file = delete_audio_file + + # 确保输出目录存在 + os.makedirs(self.output_dir, exist_ok=True) + + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: + """PCM数据保存为WAV文件""" + module_name = __name__.split(".")[-1] + file_name = f"asr_{module_name}_{session_id}_{uuid.uuid4()}.wav" + file_path = os.path.join(self.output_dir, file_name) + + with wave.open(file_path, "wb") as wf: + wf.setnchannels(1) + wf.setsampwidth(2) # 2 bytes = 16-bit + wf.setframerate(16000) + wf.writeframes(b"".join(pcm_data)) + + return file_path + + async def speech_to_text( + self, opus_data: List[bytes], session_id: str + ) -> Tuple[Optional[str], Optional[str]]: + """将语音数据转换为文本""" + if not opus_data: + logger.bind(tag=TAG).warn("音频数据为空!") + return None, None + + file_path = None + try: + # 检查配置是否已设置 + if not self.secret_id or not self.secret_key: + logger.bind(tag=TAG).error("腾讯云语音识别配置未设置,无法进行识别") + return None, file_path + + # 将Opus音频数据解码为PCM + if self.audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) + + # 判断是否保存为WAV文件 + if self.delete_audio_file: + pass + else: + self.save_audio_to_file(pcm_data, session_id) + + # 将音频数据转换为Base64编码 + base64_audio = base64.b64encode(combined_pcm_data).decode("utf-8") + + # 构建请求体 + request_body = self._build_request_body(base64_audio) + + # 获取认证头 + timestamp, authorization = self._get_auth_headers(request_body) + + # 发送请求 + start_time = time.time() + result = self._send_request(request_body, timestamp, authorization) + + if result: + logger.bind(tag=TAG).debug( + f"腾讯云语音识别耗时: {time.time() - start_time:.3f}s | 结果: {result}" + ) + + return result, file_path + + except Exception as e: + logger.bind(tag=TAG).error(f"处理音频时发生错误!{e}", exc_info=True) + return None, file_path + + def _build_request_body(self, base64_audio: str) -> str: + """构建请求体""" + request_map = { + "ProjectId": 0, + "SubServiceType": 2, # 一句话识别 + "EngSerViceType": "16k_zh", # 中文普通话通用 + "SourceType": 1, # 音频数据来源为语音文件 + "VoiceFormat": self.FORMAT, # 音频格式 + "Data": base64_audio, # Base64编码的音频数据 + "DataLen": len(base64_audio), # 数据长度 + } + return json.dumps(request_map) + + def _get_auth_headers(self, request_body: str) -> Tuple[str, str]: + """获取认证头""" + try: + # 获取当前UTC时间戳 + now = datetime.now(timezone.utc) + timestamp = str(int(now.timestamp())) + date = now.strftime("%Y-%m-%d") + + # 服务名称必须是 "asr" + service = "asr" + + # 拼接凭证范围 + credential_scope = f"{date}/{service}/tc3_request" + + # 使用TC3-HMAC-SHA256签名方法 + algorithm = "TC3-HMAC-SHA256" + + # 构建规范请求字符串 + http_request_method = "POST" + canonical_uri = "/" + canonical_query_string = "" + + # 注意:头部信息需要按照ASCII升序排列,且key和value都转为小写 + # 必须包含content-type和host头部 + content_type = "application/json; charset=utf-8" + host = "asr.tencentcloudapi.com" + action = "SentenceRecognition" # 接口名称 + + # 构建规范头部信息,注意顺序和格式 + canonical_headers = ( + f"content-type:{content_type.lower()}\n" + + f"host:{host.lower()}\n" + + f"x-tc-action:{action.lower()}\n" + ) + + signed_headers = "content-type;host;x-tc-action" + + # 请求体哈希值 + payload_hash = self._sha256_hex(request_body) + + # 构建规范请求字符串 + canonical_request = ( + f"{http_request_method}\n" + + f"{canonical_uri}\n" + + f"{canonical_query_string}\n" + + f"{canonical_headers}\n" + + f"{signed_headers}\n" + + f"{payload_hash}" + ) + + # 计算规范请求的哈希值 + hashed_canonical_request = self._sha256_hex(canonical_request) + + # 构建待签名字符串 + string_to_sign = ( + f"{algorithm}\n" + + f"{timestamp}\n" + + f"{credential_scope}\n" + + f"{hashed_canonical_request}" + ) + + # 计算签名密钥 + secret_date = self._hmac_sha256(f"TC3{self.secret_key}", date) + secret_service = self._hmac_sha256(secret_date, service) + secret_signing = self._hmac_sha256(secret_service, "tc3_request") + + # 计算签名 + signature = self._bytes_to_hex( + self._hmac_sha256(secret_signing, string_to_sign) + ) + + # 构建授权头 + authorization = ( + f"{algorithm} " + + f"Credential={self.secret_id}/{credential_scope}, " + + f"SignedHeaders={signed_headers}, " + + f"Signature={signature}" + ) + + return timestamp, authorization + + except Exception as e: + logger.bind(tag=TAG).error(f"生成认证头失败: {e}", exc_info=True) + raise RuntimeError(f"生成认证头失败: {e}") + + def _send_request( + self, request_body: str, timestamp: str, authorization: str + ) -> Optional[str]: + """发送请求到腾讯云API""" + headers = { + "Content-Type": "application/json; charset=utf-8", + "Host": "asr.tencentcloudapi.com", + "Authorization": authorization, + "X-TC-Action": "SentenceRecognition", + "X-TC-Version": self.API_VERSION, + "X-TC-Timestamp": timestamp, + "X-TC-Region": "ap-shanghai", + } + + try: + response = requests.post(self.API_URL, headers=headers, data=request_body) + + if not response.ok: + raise IOError(f"请求失败: {response.status_code} {response.reason}") + + response_json = response.json() + + # 检查是否有错误 + if "Response" in response_json and "Error" in response_json["Response"]: + error = response_json["Response"]["Error"] + error_code = error["Code"] + error_message = error["Message"] + raise IOError(f"API返回错误: {error_code}: {error_message}") + + # 提取识别结果 + if "Response" in response_json and "Result" in response_json["Response"]: + return response_json["Response"]["Result"] + else: + logger.bind(tag=TAG).warn(f"响应中没有识别结果: {response_json}") + return "" + + except Exception as e: + logger.bind(tag=TAG).error(f"发送请求失败: {e}", exc_info=True) + return None + + def _sha256_hex(self, data: str) -> str: + """计算字符串的SHA256哈希值""" + digest = hashlib.sha256(data.encode("utf-8")).digest() + return self._bytes_to_hex(digest) + + def _hmac_sha256(self, key, data: str) -> bytes: + """计算HMAC-SHA256""" + if isinstance(key, str): + key = key.encode("utf-8") + + return hmac.new(key, data.encode("utf-8"), hashlib.sha256).digest() + + def _bytes_to_hex(self, bytes_data: bytes) -> str: + """字节数组转十六进制字符串""" + return "".join(f"{b:02x}" for b in bytes_data) diff --git a/main/xiaozhi-server/core/providers/intent/base.py b/main/xiaozhi-server/core/providers/intent/base.py index a691d6cbd..040dd0254 100644 --- a/main/xiaozhi-server/core/providers/intent/base.py +++ b/main/xiaozhi-server/core/providers/intent/base.py @@ -9,15 +9,25 @@ logger = setup_logging() class IntentProviderBase(ABC): def __init__(self, config): self.config = config - self.intent_options = config.get("intent_options", { - "continue_chat": "继续聊天", - "end_chat": "结束聊天", - "play_music": "播放音乐" - }) + self.intent_options = [ + { + "name": "handle_exit_intent", + "desc": "结束聊天, 用户发来如再见之类的表示结束的话, 不想再进行对话的时候", + }, + { + "name": "play_music", + "desc": "播放音乐, 用户希望你可以播放音乐, 只用于播放音乐的意图", + }, + {"name": "get_time", "desc": "获取今天日期或者当前时间信息"}, + {"name": "continue_chat", "desc": "继续聊天"}, + ] def set_llm(self, llm): self.llm = llm - logger.bind(tag=TAG).debug("Set LLM for intent provider") + # 获取模型名称和类型信息 + model_name = getattr(llm, "model_name", str(llm.__class__.__name__)) + # 记录更详细的日志 + logger.bind(tag=TAG).info(f"意图识别设置LLM: {model_name}") @abstractmethod async def detect_intent(self, conn, dialogue_history: List[Dict], text: str) -> str: @@ -28,7 +38,8 @@ class IntentProviderBase(ABC): Returns: 返回识别出的意图,格式为: - "继续聊天" - - "结束聊天" + - "结束聊天" - "播放音乐 歌名" 或 "随机播放音乐" + - "查询天气 地点名" 或 "查询天气 [当前位置]" """ pass diff --git a/main/xiaozhi-server/core/providers/intent/function_call/function_call.py b/main/xiaozhi-server/core/providers/intent/function_call/function_call.py new file mode 100644 index 000000000..d43ada429 --- /dev/null +++ b/main/xiaozhi-server/core/providers/intent/function_call/function_call.py @@ -0,0 +1,22 @@ +from ..base import IntentProviderBase +from typing import List, Dict +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() + + +class IntentProvider(IntentProviderBase): + async def detect_intent(self, conn, dialogue_history: List[Dict], text: str) -> str: + """ + 默认的意图识别实现,始终返回继续聊天 + Args: + dialogue_history: 对话历史记录列表 + text: 本次对话记录 + Returns: + 固定返回"继续聊天" + """ + logger.bind(tag=TAG).debug( + "Using functionCallProvider, always returning continue chat" + ) + return '{"function_call": {"name": "continue_chat"}}' diff --git a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py index 9d5d2507e..05d01c102 100644 --- a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py +++ b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py @@ -3,6 +3,9 @@ from ..base import IntentProviderBase from plugins_func.functions.play_music import initialize_music_handler from config.logger import setup_logging import re +import json +import hashlib +import time TAG = __name__ logger = setup_logging() @@ -13,6 +16,10 @@ class IntentProvider(IntentProviderBase): super().__init__(config) self.llm = None self.promot = self.get_intent_system_prompt() + # 添加缓存管理 + self.intent_cache = {} # 缓存意图识别结果 + self.cache_expiry = 600 # 缓存有效期10分钟 + self.cache_max_size = 100 # 最多缓存100个意图 def get_intent_system_prompt(self) -> str: """ @@ -20,65 +27,97 @@ class IntentProvider(IntentProviderBase): Returns: 格式化后的系统提示词 """ - intent_list = [] - """ - "continue_chat": "1.继续聊天, 除了播放音乐和结束聊天的时候的选项, 比如日常的聊天和问候, 对话等", - "end_chat": "2.结束聊天, 用户发来如再见之类的表示结束的话, 不想再进行对话的时候", - "play_music": "3.播放音乐, 用户希望你可以播放音乐, 只用于播放音乐的意图" - """ - for key, value in self.intent_options.items(): - if key == "play_music": - intent_list.append("3.播放音乐, 用户希望你可以播放音乐, 只用于播放音乐的意图") - elif key == "end_chat": - intent_list.append("2.结束聊天, 用户发来如再见之类的表示结束的话, 不想再进行对话的时候") - elif key == "continue_chat": - intent_list.append("1.继续聊天, 除了播放音乐和结束聊天的时候的选项, 比如日常的聊天和问候, 对话等") - else: - intent_list.append(value) - - # "如果是唱歌、听歌、播放音乐,请指定歌名,格式为'播放音乐 [识别出的歌名]'。\n" - # "如果听不出具体歌名,可以返回'随机播放音乐'。\n" - # "只需要返回意图结果的json,不要解释。" - # "返回格式如下:\n" prompt = ( - "你是一个意图识别助手。你需要根据和用户的对话记录,重点分析用户的最后一句话,判断用户意图属于以下哪一类(使用和标志):\n" + "你是一个意图识别助手。请分析用户的最后一句话,判断用户意图属于以下哪一类:\n" "" - f"{', '.join(intent_list)}" + f"{str(self.intent_options)}" "\n" - "你需要按照以下的步骤处理用户的对话" - "1. 思考出对话的意图是哪一类的" - "2. 属于1和2的意图, 直接返回,返回格式如下:\n" - "{intent: '用户意图'}\n" - "3. 属于3的意图,则继续分析用户希望播放的音乐\n" - "4. 如果无法识别出具体歌名,可以返回'随机播放音乐'\n" - "{intent: '播放音乐 [获取的音乐名字]'}\n" - "下面是几个处理的示例(思考的内容不返回, 只返回json部分, 无额外的内容)\n" - "```" - "用户: 你今天怎么样?\n" - "思考(不返回): 用户发来的数据是一个问候语,属于继续聊天的意图, 是种类1, 种类1的需求是直接返回\n" - "返回结果: {intent: '继续聊天'}\n" - "```" - "用户: 我今天有点累了, 我们明天再聊吧\n" - "思考(不返回): 用户表达了今天不想继续对话,属于结束聊天的意图, 是种类2, 种类2的需求是直接返回\n" - "返回结果: {intent: '结束聊天'}\n" - "```" - "用户: 我今天有点累了, 我们明天再聊吧\n" - "思考(不返回): 用户表达了今天不想继续对话,属于结束聊天的意图, 是种类2, 种类2的需求是直接返回\n" - "返回结果: {intent: '结束聊天'}\n" - "```" - "用户: 你可以播放一首中秋月给我听吗\n" - "思考(不返回): 用户表达了想听音乐的续签,属于播放音乐的意图, 是种类3, 种类3的需求需要继续判断播放的音乐, 这里用户希望的歌曲名明确给出是中秋月\n" - "返回结果: {intent: '播放音乐 [中秋月]'}\n" - "```" - "你现在可以使用的音乐的名称如下(使用和标志):\n" + "处理步骤:" + "1. 思考意图类型,生成function_call格式" + "\n\n" + "返回格式示例:\n" + '1. 播放音乐意图: {"function_call": {"name": "play_music", "arguments": {"song_name": "音乐名称"}}}\n' + '2. 结束对话意图: {"function_call": {"name": "handle_exit_intent", "arguments": {"say_goodbye": "goodbye"}}}\n' + '3. 获取当天日期时间: {"function_call": {"name": "get_time"}}\n' + '4. 继续聊天意图: {"function_call": {"name": "continue_chat"}}\n' + "\n" + "注意:\n" + '- 播放音乐:无歌名时,song_name设为"random"\n' + "- 如果没有明显的意图,应按照继续聊天意图处理\n" + "- 只返回纯JSON,不要任何其他内容\n" + "\n" + "示例分析:\n" + "```\n" + "用户: 你也太搞笑了\n" + '返回: {"function_call": {"name": "continue_chat"}}\n' + "```\n" + "```\n" + "用户: 现在是几号了?现在几点了?\n" + '返回: {"function_call": {"name": "get_time"}}\n' + "```\n" + "```\n" + "用户: 我们明天再聊吧\n" + '返回: {"function_call": {"name": "handle_exit_intent"}}\n' + "```\n" + "```\n" + "用户: 播放中秋月\n" + '返回: {"function_call": {"name": "play_music", "arguments": {"song_name": "中秋月"}}}\n' + "```\n" + "```\n" + "可用的音乐名称:\n" ) return prompt + def clean_cache(self): + """清理过期缓存""" + now = time.time() + # 找出过期键 + expired_keys = [ + k + for k, v in self.intent_cache.items() + if now - v["timestamp"] > self.cache_expiry + ] + for key in expired_keys: + del self.intent_cache[key] + + # 如果缓存太大,移除最旧的条目 + if len(self.intent_cache) > self.cache_max_size: + # 按时间戳排序并保留最新的条目 + sorted_items = sorted( + self.intent_cache.items(), key=lambda x: x[1]["timestamp"] + ) + for key, _ in sorted_items[: len(sorted_items) - self.cache_max_size]: + del self.intent_cache[key] + async def detect_intent(self, conn, dialogue_history: List[Dict], text: str) -> str: if not self.llm: raise ValueError("LLM provider not set") + # 记录整体开始时间 + total_start_time = time.time() + + # 打印使用的模型信息 + model_info = getattr(self.llm, "model_name", str(self.llm.__class__.__name__)) + logger.bind(tag=TAG).debug(f"使用意图识别模型: {model_info}") + + # 计算缓存键 + cache_key = hashlib.md5(text.encode()).hexdigest() + + # 检查缓存 + if cache_key in self.intent_cache: + cache_entry = self.intent_cache[cache_key] + # 检查缓存是否过期 + if time.time() - cache_entry["timestamp"] <= self.cache_expiry: + cache_time = time.time() - total_start_time + logger.bind(tag=TAG).debug( + f"使用缓存的意图: {cache_key} -> {cache_entry['intent']}, 耗时: {cache_time:.4f}秒" + ) + return cache_entry["intent"] + + # 清理缓存 + self.clean_cache() + # 构建用户最后一句话的提示 msgStr = "" @@ -94,18 +133,85 @@ class IntentProvider(IntentProviderBase): music_file_names = music_config["music_file_names"] prompt_music = f"{self.promot}\n{music_file_names}\n" logger.bind(tag=TAG).debug(f"User prompt: {prompt_music}") + + # 记录预处理完成时间 + preprocess_time = time.time() - total_start_time + logger.bind(tag=TAG).debug(f"意图识别预处理耗时: {preprocess_time:.4f}秒") + # 使用LLM进行意图识别 + llm_start_time = time.time() + logger.bind(tag=TAG).debug(f"开始LLM意图识别调用, 模型: {model_info}") + intent = self.llm.response_no_stream( - system_prompt=prompt_music, - user_prompt=user_prompt + system_prompt=prompt_music, user_prompt=user_prompt ) - # 使用正则表达式提取大括号中的内容 - # 使用正则表达式提取 {} 中的内容 - match = re.search(r'\{.*?\}', intent) + + # 记录LLM调用完成时间 + llm_time = time.time() - llm_start_time + logger.bind(tag=TAG).debug( + f"LLM意图识别完成, 模型: {model_info}, 调用耗时: {llm_time:.4f}秒" + ) + + # 记录后处理开始时间 + postprocess_start_time = time.time() + + # 清理和解析响应 + intent = intent.strip() + # 尝试提取JSON部分 + match = re.search(r"\{.*\}", intent, re.DOTALL) if match: - result = match.group(0) - intent = result - else: - intent = "{intent: '继续聊天'}" - logger.bind(tag=TAG).info(f"Detected intent: {intent}") - return intent.strip() + intent = match.group(0) + + # 记录总处理时间 + total_time = time.time() - total_start_time + logger.bind(tag=TAG).debug( + f"【意图识别性能】模型: {model_info}, 总耗时: {total_time:.4f}秒, LLM调用: {llm_time:.4f}秒, 查询: '{text[:20]}...'" + ) + + # 尝试解析为JSON + try: + intent_data = json.loads(intent) + # 如果包含function_call,则格式化为适合处理的格式 + if "function_call" in intent_data: + function_data = intent_data["function_call"] + function_name = function_data.get("name") + function_args = function_data.get("arguments", {}) + + # 记录识别到的function call + logger.bind(tag=TAG).info( + f"识别到function call: {function_name}, 参数: {function_args}" + ) + + # 添加到缓存 + self.intent_cache[cache_key] = { + "intent": intent, + "timestamp": time.time(), + } + + # 后处理时间 + postprocess_time = time.time() - postprocess_start_time + logger.bind(tag=TAG).debug(f"意图后处理耗时: {postprocess_time:.4f}秒") + + # 确保返回完全序列化的JSON字符串 + return intent + else: + # 添加到缓存 + self.intent_cache[cache_key] = { + "intent": intent, + "timestamp": time.time(), + } + + # 后处理时间 + postprocess_time = time.time() - postprocess_start_time + logger.bind(tag=TAG).debug(f"意图后处理耗时: {postprocess_time:.4f}秒") + + # 返回普通意图 + return intent + except json.JSONDecodeError: + # 后处理时间 + postprocess_time = time.time() - postprocess_start_time + logger.bind(tag=TAG).error( + f"无法解析意图JSON: {intent}, 后处理耗时: {postprocess_time:.4f}秒" + ) + # 如果解析失败,默认返回继续聊天意图 + return '{"intent": "继续聊天"}' diff --git a/main/xiaozhi-server/core/providers/intent/nointent/nointent.py b/main/xiaozhi-server/core/providers/intent/nointent/nointent.py index 7efccbfea..4b08ae8f1 100644 --- a/main/xiaozhi-server/core/providers/intent/nointent/nointent.py +++ b/main/xiaozhi-server/core/providers/intent/nointent/nointent.py @@ -16,5 +16,7 @@ class IntentProvider(IntentProviderBase): Returns: 固定返回"继续聊天" """ - logger.bind(tag=TAG).debug("Using NoIntentProvider, always returning continue chat") - return self.intent_options["continue_chat"] + logger.bind(tag=TAG).debug( + "Using NoIntentProvider, always returning continue chat" + ) + return '{"function_call": {"name": "continue_chat"}}' diff --git a/main/xiaozhi-server/core/providers/llm/AliBL/AliBL.py b/main/xiaozhi-server/core/providers/llm/AliBL/AliBL.py index 51efdc06e..16057d1d1 100644 --- a/main/xiaozhi-server/core/providers/llm/AliBL/AliBL.py +++ b/main/xiaozhi-server/core/providers/llm/AliBL/AliBL.py @@ -2,10 +2,12 @@ from config.logger import setup_logging from http import HTTPStatus from dashscope import Application from core.providers.llm.base import LLMProviderBase +from core.utils.util import check_model_key TAG = __name__ logger = setup_logging() + class LLMProvider(LLMProviderBase): def __init__(self, config): self.api_key = config["api_key"] @@ -13,27 +15,32 @@ class LLMProvider(LLMProviderBase): self.base_url = config.get("base_url") self.is_No_prompt = config.get("is_no_prompt") self.memory_id = config.get("ali_memory_id") + check_model_key("AliBLLLM", self.api_key) def response(self, session_id, dialogue): try: # 处理dialogue if self.is_No_prompt: dialogue.pop(0) - logger.bind(tag=TAG).debug(f"【阿里百练API服务】处理后的dialogue: {dialogue}") + logger.bind(tag=TAG).debug( + f"【阿里百练API服务】处理后的dialogue: {dialogue}" + ) # 构造调用参数 call_params = { "api_key": self.api_key, "app_id": self.app_id, "session_id": session_id, - "messages": dialogue + "messages": dialogue, } if self.memory_id != False: # 百练memory需要prompt参数 prompt = dialogue[-1].get("content") call_params["memory_id"] = self.memory_id call_params["prompt"] = prompt - logger.bind(tag=TAG).debug(f"【阿里百练API服务】处理后的prompt: {prompt}") + logger.bind(tag=TAG).debug( + f"【阿里百练API服务】处理后的prompt: {prompt}" + ) responses = Application.call(**call_params) if responses.status_code != HTTPStatus.OK: @@ -44,9 +51,15 @@ class LLMProvider(LLMProviderBase): ) yield "【阿里百练API服务响应异常】" else: - logger.bind(tag=TAG).debug(f"【阿里百练API服务】构造参数: {call_params}") + logger.bind(tag=TAG).debug( + f"【阿里百练API服务】构造参数: {call_params}" + ) yield responses.output.text except Exception as e: logger.bind(tag=TAG).error(f"【阿里百练API服务】响应异常: {e}") yield "【LLM服务响应异常】" + + def response_with_functions(self, session_id, dialogue, functions=None): + logger.bind(tag=TAG).info(f"阿里百练暂未实现完整的工具调用(function call)") + return self.response(session_id, dialogue) diff --git a/main/xiaozhi-server/core/providers/llm/base.py b/main/xiaozhi-server/core/providers/llm/base.py index d39a8589c..97d0d8e72 100644 --- a/main/xiaozhi-server/core/providers/llm/base.py +++ b/main/xiaozhi-server/core/providers/llm/base.py @@ -35,4 +35,5 @@ class LLMProviderBase(ABC): """ # For providers that don't support functions, just return regular response for token in self.response(session_id, dialogue): - yield {"type": "content", "content": token} \ No newline at end of file + yield token, None + diff --git a/main/xiaozhi-server/core/providers/llm/coze/coze.py b/main/xiaozhi-server/core/providers/llm/coze/coze.py index b1b14d91d..60a046670 100644 --- a/main/xiaozhi-server/core/providers/llm/coze/coze.py +++ b/main/xiaozhi-server/core/providers/llm/coze/coze.py @@ -1,12 +1,17 @@ from config.logger import setup_logging -import requests import json -import re from core.providers.llm.base import LLMProviderBase -import os + # official coze sdk for Python [cozepy](https://github.com/coze-dev/coze-py) from cozepy import COZE_CN_BASE_URL -from cozepy import Coze, TokenAuth, Message, ChatStatus, MessageContentType, ChatEventType # noqa +from cozepy import ( + Coze, + TokenAuth, + Message, + ChatEventType, +) # noqa +from core.providers.llm.system_prompt import get_system_prompt_for_function +from core.utils.util import check_model_key TAG = __name__ logger = setup_logging() @@ -15,25 +20,23 @@ logger = setup_logging() class LLMProvider(LLMProviderBase): def __init__(self, config): self.personal_access_token = config.get("personal_access_token") - self.bot_id = config.get("bot_id") - self.user_id = config.get("user_id") + self.bot_id = str(config.get("bot_id")) + self.user_id = str(config.get("user_id")) self.session_conversation_map = {} # 存储session_id和conversation_id的映射 + check_model_key("CozeLLM", self.personal_access_token) def response(self, session_id, dialogue): coze_api_token = self.personal_access_token coze_api_base = COZE_CN_BASE_URL last_msg = next(m for m in reversed(dialogue) if m["role"] == "user") - + coze = Coze(auth=TokenAuth(token=coze_api_token), base_url=coze_api_base) conversation_id = self.session_conversation_map.get(session_id) # 如果没有找到conversation_id,则创建新的对话 if not conversation_id: - conversation = coze.conversations.create( - messages=[ - ] - ) + conversation = coze.conversations.create(messages=[]) conversation_id = conversation.id self.session_conversation_map[session_id] = conversation_id # 更新映射 @@ -47,4 +50,24 @@ class LLMProvider(LLMProviderBase): ): if event.event == ChatEventType.CONVERSATION_MESSAGE_DELTA: print(event.message.content, end="", flush=True) - yield event.message.content \ No newline at end of file + yield event.message.content + + def response_with_functions(self, session_id, dialogue, functions=None): + if len(dialogue) == 2 and functions is not None and len(functions) > 0: + # 第一次调用llm, 取最后一条用户消息,附加tool提示词 + last_msg = dialogue[-1]["content"] + function_str = json.dumps(functions, ensure_ascii=False) + modify_msg = get_system_prompt_for_function(function_str) + last_msg + dialogue[-1]["content"] = modify_msg + + # 如果最后一个是 role="tool",附加到user上 + if len(dialogue) > 1 and dialogue[-1]["role"] == "tool": + assistant_msg = "\ntool call result: " + dialogue[-1]["content"] + "\n\n" + while len(dialogue) > 1: + if dialogue[-1]["role"] == "user": + dialogue[-1]["content"] = assistant_msg + dialogue[-1]["content"] + break + dialogue.pop() + + for token in self.response(session_id, dialogue): + yield token, None diff --git a/main/xiaozhi-server/core/providers/llm/dify/dify.py b/main/xiaozhi-server/core/providers/llm/dify/dify.py index 5300fc797..52ca9853e 100644 --- a/main/xiaozhi-server/core/providers/llm/dify/dify.py +++ b/main/xiaozhi-server/core/providers/llm/dify/dify.py @@ -2,16 +2,20 @@ import json from config.logger import setup_logging import requests from core.providers.llm.base import LLMProviderBase +from core.providers.llm.system_prompt import get_system_prompt_for_function +from core.utils.util import check_model_key TAG = __name__ logger = setup_logging() + class LLMProvider(LLMProviderBase): def __init__(self, config): self.api_key = config["api_key"] self.mode = config.get("mode", "chat-messages") - self.base_url = config.get("base_url", "https://api.dify.ai/v1").rstrip('/') + self.base_url = config.get("base_url", "https://api.dify.ai/v1").rstrip("/") self.session_conversation_map = {} # 存储session_id和conversation_id的映射 + check_model_key("DifyLLM", self.api_key) def response(self, session_id, dialogue): try: @@ -22,58 +26,85 @@ class LLMProvider(LLMProviderBase): # 发起流式请求 if self.mode == "chat-messages": request_json = { - "query": last_msg["content"], - "response_mode": "streaming", - "user": session_id, - "inputs": {}, - "conversation_id": conversation_id - } + "query": last_msg["content"], + "response_mode": "streaming", + "user": session_id, + "inputs": {}, + "conversation_id": conversation_id, + } elif self.mode == "workflows/run": request_json = { "inputs": {"query": last_msg["content"]}, "response_mode": "streaming", - "user": session_id + "user": session_id, } elif self.mode == "completion-messages": request_json = { "inputs": {"query": last_msg["content"]}, "response_mode": "streaming", - "user": session_id + "user": session_id, } with requests.post( - f"{self.base_url}/{self.mode}", - headers={"Authorization": f"Bearer {self.api_key}"}, - json=request_json, - stream=True + f"{self.base_url}/{self.mode}", + headers={"Authorization": f"Bearer {self.api_key}"}, + json=request_json, + stream=True, ) as r: if self.mode == "chat-messages": for line in r.iter_lines(): - if line.startswith(b'data: '): + if line.startswith(b"data: "): event = json.loads(line[6:]) # 如果没有找到conversation_id,则获取此次conversation_id if not conversation_id: - conversation_id = event.get('conversation_id') - self.session_conversation_map[session_id] = conversation_id # 更新映射 - if event.get('answer'): - yield event['answer'] + conversation_id = event.get("conversation_id") + self.session_conversation_map[session_id] = ( + conversation_id # 更新映射 + ) + # 过滤 message_replace 事件,此事件会全量推一次 + if event.get("event") != "message_replace" and event.get( + "answer" + ): + yield event["answer"] elif self.mode == "workflows/run": for line in r.iter_lines(): - # logger.bind(tag=TAG).info(f"chat message response: {line}") - if line.startswith(b'data: '): + if line.startswith(b"data: "): event = json.loads(line[6:]) - if event.get('event') == "workflow_finished": - if event['data']['status'] == "succeeded": - yield event['data']['outputs']['answer'] + if event.get("event") == "workflow_finished": + if event["data"]["status"] == "succeeded": + yield event["data"]["outputs"]["answer"] else: yield "【服务响应异常】" elif self.mode == "completion-messages": for line in r.iter_lines(): - if line.startswith(b'data: '): + if line.startswith(b"data: "): event = json.loads(line[6:]) - if event.get('answer'): - yield event['answer'] + # 过滤 message_replace 事件,此事件会全量推一次 + if event.get("event") != "message_replace" and event.get( + "answer" + ): + yield event["answer"] except Exception as e: logger.bind(tag=TAG).error(f"Error in response generation: {e}") yield "【服务响应异常】" + + def response_with_functions(self, session_id, dialogue, functions=None): + if len(dialogue) == 2 and functions is not None and len(functions) > 0: + # 第一次调用llm, 取最后一条用户消息,附加tool提示词 + last_msg = dialogue[-1]["content"] + function_str = json.dumps(functions, ensure_ascii=False) + modify_msg = get_system_prompt_for_function(function_str) + last_msg + dialogue[-1]["content"] = modify_msg + + # 如果最后一个是 role="tool",附加到user上 + if len(dialogue) > 1 and dialogue[-1]["role"] == "tool": + assistant_msg = "\ntool call result: " + dialogue[-1]["content"] + "\n\n" + while len(dialogue) > 1: + if dialogue[-1]["role"] == "user": + dialogue[-1]["content"] = assistant_msg + dialogue[-1]["content"] + break + dialogue.pop() + + for token in self.response(session_id, dialogue): + yield token, None diff --git a/main/xiaozhi-server/core/providers/llm/fastgpt/fastgpt.py b/main/xiaozhi-server/core/providers/llm/fastgpt/fastgpt.py index 38f9a2c98..a35f41cca 100644 --- a/main/xiaozhi-server/core/providers/llm/fastgpt/fastgpt.py +++ b/main/xiaozhi-server/core/providers/llm/fastgpt/fastgpt.py @@ -2,6 +2,7 @@ import json from config.logger import setup_logging import requests from core.providers.llm.base import LLMProviderBase +from core.utils.util import check_model_key TAG = __name__ logger = setup_logging() @@ -13,6 +14,7 @@ class LLMProvider(LLMProviderBase): self.base_url = config.get("base_url") self.detail = config.get("detail", False) self.variables = config.get("variables", {}) + check_model_key("FastGPTLLM", self.api_key) def response(self, session_id, dialogue): try: @@ -21,37 +23,36 @@ class LLMProvider(LLMProviderBase): # 发起流式请求 with requests.post( - f"{self.base_url}/chat/completions", - headers={"Authorization": f"Bearer {self.api_key}"}, - json={ - "stream": True, - "chatId": session_id, - "detail": self.detail, - "variables": self.variables, - "messages": [ - { - "role": "user", - "content": last_msg["content"] - } - ] - }, - stream=True + f"{self.base_url}/chat/completions", + headers={"Authorization": f"Bearer {self.api_key}"}, + json={ + "stream": True, + "chatId": session_id, + "detail": self.detail, + "variables": self.variables, + "messages": [{"role": "user", "content": last_msg["content"]}], + }, + stream=True, ) as r: for line in r.iter_lines(): if line: try: - if line.startswith(b'data: '): - if line[6:].decode('utf-8') == '[DONE]': + if line.startswith(b"data: "): + if line[6:].decode("utf-8") == "[DONE]": break data = json.loads(line[6:]) - if 'choices' in data and len(data['choices']) > 0: - delta = data['choices'][0].get('delta', {}) - if delta and 'content' in delta and delta['content'] is not None: - content = delta['content'] - if '' in content: + if "choices" in data and len(data["choices"]) > 0: + delta = data["choices"][0].get("delta", {}) + if ( + delta + and "content" in delta + and delta["content"] is not None + ): + content = delta["content"] + if "" in content: continue - if '' in content: + if "" in content: continue yield content @@ -62,4 +63,8 @@ class LLMProvider(LLMProviderBase): except Exception as e: logger.bind(tag=TAG).error(f"Error in response generation: {e}") - yield "【服务响应异常】" \ No newline at end of file + yield "【服务响应异常】" + + def response_with_functions(self, session_id, dialogue, functions=None): + logger.bind(tag=TAG).info(f"fastgpt暂未实现完整的工具调用(function call)") + return self.response(session_id, dialogue) diff --git a/main/xiaozhi-server/core/providers/llm/gemini/gemini.py b/main/xiaozhi-server/core/providers/llm/gemini/gemini.py index 93c7dcb5f..a91a6bf00 100644 --- a/main/xiaozhi-server/core/providers/llm/gemini/gemini.py +++ b/main/xiaozhi-server/core/providers/llm/gemini/gemini.py @@ -4,15 +4,17 @@ from core.providers.llm.base import LLMProviderBase from config.logger import setup_logging import requests import json + TAG = __name__ logger = setup_logging() + class LLMProvider(LLMProviderBase): def __init__(self, config): """初始化Gemini LLM Provider""" self.model_name = config.get("model_name", "gemini-1.5-pro") self.api_key = config.get("api_key") - self.http_proxy=config.get("http_proxy") + self.http_proxy = config.get("http_proxy") self.https_proxy = config.get("https_proxy") have_key = check_model_key("LLM", self.api_key) @@ -22,7 +24,7 @@ class LLMProvider(LLMProviderBase): try: # 初始化Gemini客户端 # 配置代理(如果提供了代理配置) - self.proxies=None + self.proxies = None if self.http_proxy is not "" or self.https_proxy is not "": self.proxies = { @@ -62,19 +64,16 @@ class LLMProvider(LLMProviderBase): role = "model" if msg["role"] == "assistant" else "user" content = msg["content"].strip() if content: - chat_history.append({ - "role": role, - "parts": [{"text":content}] - - }) + chat_history.append({"role": role, "parts": [{"text": content}]}) # 获取当前消息 current_msg = dialogue[-1]["content"] # 构建请求体 request_body = { - "contents": chat_history + [{"role": "user", "parts": [{"text":current_msg}]}], - "generationConfig": self.generation_config + "contents": chat_history + + [{"role": "user", "parts": [{"text": current_msg}]}], + "generationConfig": self.generation_config, } # 构建请求URL @@ -87,11 +86,17 @@ class LLMProvider(LLMProviderBase): # 发送POST请求,经测试手动 request 无法使用 stream 模式 if self.proxies: - response = requests.post(url, headers=headers, json=request_body, stream=False, proxies=self.proxies) + response = requests.post( + url, + headers=headers, + json=request_body, + stream=False, + proxies=self.proxies, + ) try: data = response.json() # 直接解析JSON - if 'candidates' in data and data['candidates']: - yield data['candidates'][0]['content']['parts'][0]['text'] + if "candidates" in data and data["candidates"]: + yield data["candidates"][0]["content"]["parts"][0]["text"] else: yield "未找到候选回复。" except json.JSONDecodeError as e: @@ -104,13 +109,11 @@ class LLMProvider(LLMProviderBase): # 发送消息并获取流式响应 response = chat.send_message( - current_msg, - stream=True, - generation_config=self.generation_config + current_msg, stream=True, generation_config=self.generation_config ) # 处理流式响应 for chunk in response: - if hasattr(chunk, 'text') and chunk.text: + if hasattr(chunk, "text") and chunk.text: yield chunk.text except Exception as e: @@ -125,12 +128,13 @@ class LLMProvider(LLMProviderBase): else: yield f"【Gemini服务响应异常: {error_msg}】" - - - except requests.exceptions.RequestException as e: yield f"请求失败:{e}" except json.JSONDecodeError as e: yield f"JSON解码错误:{e}" except Exception as e: yield f"发生错误:{e}" + + def response_with_functions(self, session_id, dialogue, functions=None): + logger.bind(tag=TAG).info(f"gemini暂未实现完整的工具调用(function call)") + return self.response(session_id, dialogue) diff --git a/main/xiaozhi-server/core/providers/llm/ollama/ollama.py b/main/xiaozhi-server/core/providers/llm/ollama/ollama.py index 179a85b1e..fb34ced5d 100644 --- a/main/xiaozhi-server/core/providers/llm/ollama/ollama.py +++ b/main/xiaozhi-server/core/providers/llm/ollama/ollama.py @@ -63,4 +63,4 @@ class LLMProvider(LLMProviderBase): except Exception as e: logger.bind(tag=TAG).error(f"Error in Ollama function call: {e}") - yield {"type": "content", "content": f"【Ollama服务响应异常: {str(e)}】"} + yield f"【Ollama服务响应异常: {str(e)}】", None diff --git a/main/xiaozhi-server/core/providers/llm/openai/openai.py b/main/xiaozhi-server/core/providers/llm/openai/openai.py index c3732a221..a20067af0 100644 --- a/main/xiaozhi-server/core/providers/llm/openai/openai.py +++ b/main/xiaozhi-server/core/providers/llm/openai/openai.py @@ -1,4 +1,5 @@ import openai +from openai.types import CompletionUsage from config.logger import setup_logging from core.utils.util import check_model_key from core.providers.llm.base import LLMProviderBase @@ -11,11 +12,19 @@ class LLMProvider(LLMProviderBase): def __init__(self, config): self.model_name = config.get("model_name") self.api_key = config.get("api_key") - if 'base_url' in config: + if "base_url" in config: self.base_url = config.get("base_url") else: self.base_url = config.get("url") - self.max_tokens = config.get("max_tokens", 500) + max_tokens = config.get("max_tokens") + if max_tokens is None or max_tokens == "": + max_tokens = 500 + + try: + max_tokens = int(max_tokens) + except (ValueError, TypeError): + max_tokens = 500 + self.max_tokens = max_tokens check_model_key("LLM", self.api_key) self.client = openai.OpenAI(api_key=self.api_key, base_url=self.base_url) @@ -33,18 +42,22 @@ class LLMProvider(LLMProviderBase): for chunk in responses: try: # 检查是否存在有效的choice且content不为空 - delta = chunk.choices[0].delta if getattr(chunk, 'choices', None) else None - content = delta.content if hasattr(delta, 'content') else '' + delta = ( + chunk.choices[0].delta + if getattr(chunk, "choices", None) + else None + ) + content = delta.content if hasattr(delta, "content") else "" except IndexError: - content = '' + content = "" if content: # 处理标签跨多个chunk的情况 - if '' in content: + if "" in content: is_active = False - content = content.split('')[0] - if '' in content: + content = content.split("")[0] + if "" in content: is_active = True - content = content.split('')[-1] + content = content.split("")[-1] if is_active: yield content @@ -54,15 +67,22 @@ class LLMProvider(LLMProviderBase): def response_with_functions(self, session_id, dialogue, functions=None): try: stream = self.client.chat.completions.create( - model=self.model_name, - messages=dialogue, - stream=True, - tools=functions + model=self.model_name, messages=dialogue, stream=True, tools=functions ) for chunk in stream: - yield chunk.choices[0].delta.content, chunk.choices[0].delta.tool_calls + # 检查是否存在有效的choice且content不为空 + if getattr(chunk, "choices", None): + yield chunk.choices[0].delta.content, chunk.choices[0].delta.tool_calls + # 存在 CompletionUsage 消息时,生成 Token 消耗 log + elif isinstance(getattr(chunk, 'usage', None), CompletionUsage): + usage_info = getattr(chunk, 'usage', None) + logger.bind(tag=TAG).info( + f"Token 消耗:输入 {getattr(usage_info, 'prompt_tokens', '未知')}," + f"输出 {getattr(usage_info, 'completion_tokens', '未知')}," + f"共计 {getattr(usage_info, 'total_tokens', '未知')}" + ) except Exception as e: logger.bind(tag=TAG).error(f"Error in function call streaming: {e}") - yield {"type": "content", "content": f"【OpenAI服务响应异常: {e}】"} + yield f"【OpenAI服务响应异常: {e}】", None diff --git a/main/xiaozhi-server/core/providers/llm/system_prompt.py b/main/xiaozhi-server/core/providers/llm/system_prompt.py new file mode 100644 index 000000000..606f0e4b9 --- /dev/null +++ b/main/xiaozhi-server/core/providers/llm/system_prompt.py @@ -0,0 +1,103 @@ +def get_system_prompt_for_function(functions: str) -> str: + """ + 生成系统提示信息 + :param functions: 可用的函数列表 + :return: 系统提示信息 + """ + + SYSTEM_PROMPT = f""" +==== + +TOOL USE + +You have access to a set of tools that are executed upon the user's approval. You can use one tool per message, and will receive the result of that tool use in the user's response. +You use tools step-by-step to accomplish a given task, with each tool use informed by the result of the previous tool use. + +# Tool Use Formatting + +Tool use is formatted using JSON-style tags. The tool name is enclosed in opening and closing tags, and each parameter is similarly enclosed within its own set of tags. +Here's the structure: + + +{{ + "name": "function name", + "arguments": {{ + "param1": "value1", + "param2": "value2", + // Add more parameters as needed, if parameters are required, you must provide them + }} +}} + + +For example: +if you got tool as follow + +{{ + "type": "function", + "function": {{ + "name": "handle_exit_intent", + "description": "当用户想结束对话或需要退出系统时调用", + "parameters": {{ + "type": "object", + "properties": {{ + "say_goodbye": {{ + "type": "string", + "description": "和用户友好结束对话的告别语", + }} + }}, + "required": ["say_goodbye"], + }}, + }}, +}} + +you should respond with the following format: + + +{{ + "name": "handle_exit_intent", + "arguments": {{ + "say_goodbye": "再见,祝您生活愉快!" + }} +}} + + + +Always adhere to this format for the tool use to ensure proper parsing and execution. + +# Tools + +{functions} + +# Tool Use Guidelines + +1. Tools must be called in a separate message, Do not add thoughts when calling tools. The message must start with and end with , with the tool invocation JSON data in between. No additional response content is needed. +2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. + For example using the list_files tool is more effective than running a command like \`ls\` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. +3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. + Each step must be informed by the previous step's result. +4. Formulate your tool use using the JSON format specified for each tool. +5. After each tool use, the user will respond with the result of that tool use. This result will provide you with the necessary information to continue your task or make further decisions. This response may include: +- Information about whether the tool succeeded or failed, along with any reasons for failure. +- Linter errors that may have arisen due to the changes you made, which you'll need to address. +- New terminal output in reaction to the changes, which you may need to consider or act upon. +- Any other relevant feedback or information related to the tool use. +6. ALWAYS wait for user confirmation after each tool use before proceeding. Never assume the success of a tool use without explicit confirmation of the result from the user. +7. Tool calls should contain no extra information. Only after receiving the tool's response should you integrate it into a complete reply. + +It is crucial to proceed step-by-step, waiting for the user's message after each tool use before moving forward with the task. This approach allows you to: +1. Confirm the success of each step before proceeding. +2. Address any issues or errors that arise immediately. +3. Adapt your approach based on new information or unexpected results. +4. Ensure that each action builds correctly on the previous ones. + +By waiting for and carefully considering the user's response after each tool use, you can react accordingly and make informed decisions about how to proceed with the task. This iterative process helps ensure the overall success and accuracy of your work. + +==== + +USER CHAT CONTENT + +The following additional message is the user's chat message, and should be followed to the best of your ability without interfering with the TOOL USE guidelines. + +""" + + return SYSTEM_PROMPT \ No newline at end of file diff --git a/main/xiaozhi-server/core/providers/llm/xinference/xinference.py b/main/xiaozhi-server/core/providers/llm/xinference/xinference.py new file mode 100644 index 000000000..b90b0418d --- /dev/null +++ b/main/xiaozhi-server/core/providers/llm/xinference/xinference.py @@ -0,0 +1,85 @@ +from config.logger import setup_logging +from openai import OpenAI +import json +from core.providers.llm.base import LLMProviderBase + +TAG = __name__ +logger = setup_logging() + + +class LLMProvider(LLMProviderBase): + def __init__(self, config): + self.model_name = config.get("model_name") + self.base_url = config.get("base_url", "http://localhost:9997") + # Initialize OpenAI client with Xinference base URL + # 如果没有v1,增加v1 + if not self.base_url.endswith("/v1"): + self.base_url = f"{self.base_url}/v1" + + logger.bind(tag=TAG).info(f"Initializing Xinference LLM provider with model: {self.model_name}, base_url: {self.base_url}") + + try: + self.client = OpenAI( + base_url=self.base_url, + api_key="xinference" # Xinference has a similar setup to Ollama where it doesn't need an actual key + ) + logger.bind(tag=TAG).info("Xinference client initialized successfully") + except Exception as e: + logger.bind(tag=TAG).error(f"Error initializing Xinference client: {e}") + raise + + def response(self, session_id, dialogue): + try: + logger.bind(tag=TAG).debug(f"Sending request to Xinference with model: {self.model_name}, dialogue length: {len(dialogue)}") + responses = self.client.chat.completions.create( + model=self.model_name, + messages=dialogue, + stream=True + ) + is_active=True + for chunk in responses: + try: + delta = chunk.choices[0].delta if getattr(chunk, 'choices', None) else None + content = delta.content if hasattr(delta, 'content') else '' + if content: + if '' in content: + is_active = False + content = content.split('')[0] + if '' in content: + is_active = True + content = content.split('')[-1] + if is_active: + yield content + except Exception as e: + logger.bind(tag=TAG).error(f"Error processing chunk: {e}") + + except Exception as e: + logger.bind(tag=TAG).error(f"Error in Xinference response generation: {e}") + yield "【Xinference服务响应异常】" + + def response_with_functions(self, session_id, dialogue, functions=None): + try: + logger.bind(tag=TAG).debug(f"Sending function call request to Xinference with model: {self.model_name}, dialogue length: {len(dialogue)}") + if functions: + logger.bind(tag=TAG).debug(f"Function calls enabled with: {[f.get('function', {}).get('name') for f in functions]}") + + stream = self.client.chat.completions.create( + model=self.model_name, + messages=dialogue, + stream=True, + tools=functions, + ) + + for chunk in stream: + delta = chunk.choices[0].delta + content = delta.content + tool_calls = delta.tool_calls + + if content: + yield content, tool_calls + elif tool_calls: + yield None, tool_calls + + except Exception as e: + logger.bind(tag=TAG).error(f"Error in Xinference function call: {e}") + yield {"type": "content", "content": f"【Xinference服务响应异常: {str(e)}】"} diff --git a/main/xiaozhi-server/core/providers/memory/mem0ai/mem0ai.py b/main/xiaozhi-server/core/providers/memory/mem0ai/mem0ai.py index 9a82efe58..cc12a9c1c 100644 --- a/main/xiaozhi-server/core/providers/memory/mem0ai/mem0ai.py +++ b/main/xiaozhi-server/core/providers/memory/mem0ai/mem0ai.py @@ -6,13 +6,14 @@ from core.utils.util import check_model_key TAG = __name__ + class MemoryProvider(MemoryProviderBase): def __init__(self, config): super().__init__(config) self.api_key = config.get("api_key", "") self.api_version = config.get("api_version", "v1.1") have_key = check_model_key("Mem0ai", self.api_key) - if not have_key : + if not have_key: self.use_mem0 = False return else: @@ -30,54 +31,55 @@ class MemoryProvider(MemoryProviderBase): return None if len(msgs) < 2: return None - + try: # Format the content as a message list for mem0 messages = [ {"role": message.role, "content": message.content} - for message in msgs if message.role != "system" + for message in msgs + if message.role != "system" ] - result = self.client.add(messages, user_id=self.role_id, output_format=self.api_version) + result = self.client.add( + messages, user_id=self.role_id, output_format=self.api_version + ) logger.bind(tag=TAG).debug(f"Save memory result: {result}") except Exception as e: logger.bind(tag=TAG).error(f"保存记忆失败: {str(e)}") return None - async def query_memory(self, query: str)-> str: + async def query_memory(self, query: str) -> str: if not self.use_mem0: return "" try: results = self.client.search( - query, - user_id=self.role_id, - output_format=self.api_version + query, user_id=self.role_id, output_format=self.api_version ) - if not results or 'results' not in results: + if not results or "results" not in results: return "" - + # Format each memory entry with its update time up to minutes memories = [] - for entry in results['results']: - timestamp = entry.get('updated_at', '') + for entry in results["results"]: + timestamp = entry.get("updated_at", "") if timestamp: try: # Parse and reformat the timestamp - dt = timestamp.split('.')[0] # Remove milliseconds - formatted_time = dt.replace('T', ' ') + dt = timestamp.split(".")[0] # Remove milliseconds + formatted_time = dt.replace("T", " ") except: formatted_time = timestamp - memory = entry.get('memory', '') + memory = entry.get("memory", "") if timestamp and memory: # Store tuple of (timestamp, formatted_string) for sorting memories.append((timestamp, f"[{formatted_time}] {memory}")) - + # Sort by timestamp in descending order (newest first) memories.sort(key=lambda x: x[0], reverse=True) - + # Extract only the formatted strings memories_str = "\n".join(f"- {memory[1]}" for memory in memories) logger.bind(tag=TAG).debug(f"Query results: {memories_str}") return memories_str except Exception as e: logger.bind(tag=TAG).error(f"查询记忆失败: {str(e)}") - return "" \ No newline at end of file + return "" diff --git a/main/xiaozhi-server/core/providers/memory/mem_local_short/mem_local_short.py b/main/xiaozhi-server/core/providers/memory/mem_local_short/mem_local_short.py index c66438615..fca7c228a 100644 --- a/main/xiaozhi-server/core/providers/memory/mem_local_short/mem_local_short.py +++ b/main/xiaozhi-server/core/providers/memory/mem_local_short/mem_local_short.py @@ -3,7 +3,8 @@ import time import json import os import yaml -from core.utils.util import get_project_dir +from config.config_loader import get_project_dir + short_term_memory_prompt = """ # 时空记忆编织者 @@ -71,11 +72,12 @@ short_term_memory_prompt = """ ``` """ + def extract_json_data(json_code): start = json_code.find("```json") # 从start开始找到下一个```结束 - end = json_code.find("```", start+1) - #print("start:", start, "end:", end) + end = json_code.find("```", start + 1) + # print("start:", start, "end:", end) if start == -1 or end == -1: try: jsonData = json.loads(json_code) @@ -83,74 +85,76 @@ def extract_json_data(json_code): except Exception as e: print("Error:", e) return "" - jsonData = json_code[start+7:end] + jsonData = json_code[start + 7 : end] return jsonData + TAG = __name__ + class MemoryProvider(MemoryProviderBase): def __init__(self, config): super().__init__(config) self.short_momery = "" - self.memory_path = get_project_dir() + 'data/.memory.yaml' + self.memory_path = get_project_dir() + "data/.memory.yaml" self.load_memory() def init_memory(self, role_id, llm): super().init_memory(role_id, llm) self.load_memory() - + def load_memory(self): all_memory = {} if os.path.exists(self.memory_path): - with open(self.memory_path, 'r', encoding='utf-8') as f: + with open(self.memory_path, "r", encoding="utf-8") as f: all_memory = yaml.safe_load(f) or {} if self.role_id in all_memory: self.short_momery = all_memory[self.role_id] - + def save_memory_to_file(self): all_memory = {} if os.path.exists(self.memory_path): - with open(self.memory_path, 'r', encoding='utf-8') as f: - all_memory = yaml.safe_load(f) or {} + with open(self.memory_path, "r", encoding="utf-8") as f: + all_memory = yaml.safe_load(f) or {} all_memory[self.role_id] = self.short_momery - with open(self.memory_path, 'w', encoding='utf-8') as f: + with open(self.memory_path, "w", encoding="utf-8") as f: yaml.dump(all_memory, f, allow_unicode=True) - + async def save_memory(self, msgs): if self.llm is None: logger.bind(tag=TAG).error("LLM is not set for memory provider") return None - + if len(msgs) < 2: return None - + msgStr = "" for msg in msgs: if msg.role == "user": msgStr += f"User: {msg.content}\n" - elif msg.role== "assistant": + elif msg.role == "assistant": msgStr += f"Assistant: {msg.content}\n" if len(self.short_momery) > 0: - msgStr+="历史记忆:\n" - msgStr+=self.short_momery - - #当前时间 + msgStr += "历史记忆:\n" + msgStr += self.short_momery + + # 当前时间 time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) msgStr += f"当前时间:{time_str}" result = self.llm.response_no_stream(short_term_memory_prompt, msgStr) - + json_str = extract_json_data(result) try: - json_data = json.loads(json_str) # 检查json格式是否正确 + json_data = json.loads(json_str) # 检查json格式是否正确 self.short_momery = json_str except Exception as e: print("Error:", e) - + self.save_memory_to_file() logger.bind(tag=TAG).info(f"Save memory successful - Role: {self.role_id}") return self.short_momery - - async def query_memory(self, query: str)-> str: - return self.short_momery \ No newline at end of file + + async def query_memory(self, query: str) -> str: + return self.short_momery diff --git a/main/xiaozhi-server/core/providers/tts/base.py b/main/xiaozhi-server/core/providers/tts/base.py index e39ca65c7..f2632c02a 100644 --- a/main/xiaozhi-server/core/providers/tts/base.py +++ b/main/xiaozhi-server/core/providers/tts/base.py @@ -1,11 +1,9 @@ import asyncio from config.logger import setup_logging import os -import numpy as np -import opuslib_next -from pydub import AudioSegment from abc import ABC, abstractmethod from core.utils.tts import MarkdownCleaner +from core.utils.util import audio_to_data TAG = __name__ logger = setup_logging() @@ -26,13 +24,25 @@ class TTSProviderBase(ABC): max_repeat_time = 5 text = MarkdownCleaner.clean_markdown(text) while not os.path.exists(tmp_file) and max_repeat_time > 0: - asyncio.run(self.text_to_speak(text, tmp_file)) - if not os.path.exists(tmp_file): - max_repeat_time = max_repeat_time - 1 - logger.bind(tag=TAG).error(f"语音生成失败: {text}:{tmp_file},再试{max_repeat_time}次") + try: + asyncio.run(self.text_to_speak(text, tmp_file)) + except Exception as e: + logger.bind(tag=TAG).warning( + f"语音生成失败{5 - max_repeat_time + 1}次: {text},错误: {e}" + ) + # 未执行成功,删除文件 + if os.path.exists(tmp_file): + os.remove(tmp_file) + max_repeat_time -= 1 if max_repeat_time > 0: - logger.bind(tag=TAG).info(f"语音生成成功: {text}:{tmp_file},重试{5 - max_repeat_time}次") + logger.bind(tag=TAG).info( + f"语音生成成功: {text}:{tmp_file},重试{5 - max_repeat_time}次" + ) + else: + logger.bind(tag=TAG).error( + f"语音生成失败: {text},请检查网络或服务是否正常" + ) return tmp_file except Exception as e: @@ -43,46 +53,10 @@ class TTSProviderBase(ABC): async def text_to_speak(self, text, output_file): pass + def audio_to_pcm_data(self, audio_file_path): + """音频文件转换为PCM编码""" + return audio_to_data(audio_file_path, is_opus=False) + def audio_to_opus_data(self, audio_file_path): """音频文件转换为Opus编码""" - # 获取文件后缀名 - file_type = os.path.splitext(audio_file_path)[1] - if file_type: - file_type = file_type.lstrip('.') - # 读取音频文件,-nostdin 参数:不要从标准输入读取数据,否则FFmpeg会阻塞 - audio = AudioSegment.from_file(audio_file_path, format=file_type, parameters=["-nostdin"]) - - # 转换为单声道/16kHz采样率/16位小端编码(确保与编码器匹配) - audio = audio.set_channels(1).set_frame_rate(16000).set_sample_width(2) - - # 音频时长(秒) - duration = len(audio) / 1000.0 - - # 获取原始PCM数据(16位小端) - raw_data = audio.raw_data - - # 初始化Opus编码器 - encoder = opuslib_next.Encoder(16000, 1, opuslib_next.APPLICATION_AUDIO) - - # 编码参数 - frame_duration = 60 # 60ms per frame - frame_size = int(16000 * frame_duration / 1000) # 960 samples/frame - - opus_datas = [] - # 按帧处理所有音频数据(包括最后一帧可能补零) - for i in range(0, len(raw_data), frame_size * 2): # 16bit=2bytes/sample - # 获取当前帧的二进制数据 - chunk = raw_data[i:i + frame_size * 2] - - # 如果最后一帧不足,补零 - if len(chunk) < frame_size * 2: - chunk += b'\x00' * (frame_size * 2 - len(chunk)) - - # 转换为numpy数组处理 - np_frame = np.frombuffer(chunk, dtype=np.int16) - - # 编码Opus数据 - opus_data = encoder.encode(np_frame.tobytes(), frame_size) - opus_datas.append(opus_data) - - return opus_datas, duration + return audio_to_data(audio_file_path, is_opus=True) diff --git a/main/xiaozhi-server/core/providers/tts/cozecn.py b/main/xiaozhi-server/core/providers/tts/cozecn.py index 74de9ab3b..1f9244f65 100644 --- a/main/xiaozhi-server/core/providers/tts/cozecn.py +++ b/main/xiaozhi-server/core/providers/tts/cozecn.py @@ -12,14 +12,20 @@ class TTSProvider(TTSProviderBase): super().__init__(config, delete_audio_file) self.model = config.get("model") self.access_token = config.get("access_token") - self.voice = config.get("voice") + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = config.get("voice") self.response_format = config.get("response_format") self.host = "api.coze.cn" self.api_url = f"https://{self.host}/v1/audio/speech" def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_json = { @@ -30,9 +36,11 @@ class TTSProvider(TTSProviderBase): } headers = { "Authorization": f"Bearer {self.access_token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } - response = requests.request("POST", self.api_url, json=request_json, headers=headers) + response = requests.request( + "POST", self.api_url, json=request_json, headers=headers + ) data = response.content file_to_save = open(output_file, "wb") file_to_save.write(data) diff --git a/main/xiaozhi-server/core/providers/tts/doubao.py b/main/xiaozhi-server/core/providers/tts/doubao.py index 55438a0c2..3a0fdde3a 100644 --- a/main/xiaozhi-server/core/providers/tts/doubao.py +++ b/main/xiaozhi-server/core/providers/tts/doubao.py @@ -6,39 +6,61 @@ import requests from datetime import datetime from core.utils.util import check_model_key from core.providers.tts.base import TTSProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) - self.appid = config.get("appid") + if config.get("appid"): + self.appid = int(config.get("appid")) + else: + self.appid = "" self.access_token = config.get("access_token") self.cluster = config.get("cluster") - self.voice = config.get("voice") + + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = config.get("voice") + + # 处理空字符串的情况 + speed_ratio = config.get("speed_ratio", "1.0") + volume_ratio = config.get("volume_ratio", "1.0") + pitch_ratio = config.get("pitch_ratio", "1.0") + + self.speed_ratio = float(speed_ratio) if speed_ratio else 1.0 + self.volume_ratio = float(volume_ratio) if volume_ratio else 1.0 + self.pitch_ratio = float(pitch_ratio) if pitch_ratio else 1.0 + self.api_url = config.get("api_url") self.authorization = config.get("authorization") self.header = {"Authorization": f"{self.authorization}{self.access_token}"} check_model_key("TTS", self.access_token) def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_json = { "app": { "appid": f"{self.appid}", - "token": "access_token", - "cluster": self.cluster - }, - "user": { - "uid": "1" + "token": self.access_token, + "cluster": self.cluster, }, + "user": {"uid": "1"}, "audio": { "voice_type": self.voice, "encoding": "wav", - "speed_ratio": 1.0, - "volume_ratio": 1.0, - "pitch_ratio": 1.0, + "speed_ratio": self.speed_ratio, + "volume_ratio": self.volume_ratio, + "pitch_ratio": self.pitch_ratio, }, "request": { "reqid": str(uuid.uuid4()), @@ -46,17 +68,21 @@ class TTSProvider(TTSProviderBase): "text_type": "plain", "operation": "query", "with_frontend": 1, - "frontend_type": "unitTson" - } + "frontend_type": "unitTson", + }, } try: - resp = requests.post(self.api_url, json.dumps(request_json), headers=self.header) + resp = requests.post( + self.api_url, json.dumps(request_json), headers=self.header + ) if "data" in resp.json(): data = resp.json()["data"] file_to_save = open(output_file, "wb") file_to_save.write(base64.b64decode(data)) else: - raise Exception(f"{__name__} status_code: {resp.status_code} response: {resp.content}") + raise Exception( + f"{__name__} status_code: {resp.status_code} response: {resp.content}" + ) except Exception as e: raise Exception(f"{__name__} error: {e}") diff --git a/main/xiaozhi-server/core/providers/tts/edge.py b/main/xiaozhi-server/core/providers/tts/edge.py index 289961cbe..b86e4087c 100644 --- a/main/xiaozhi-server/core/providers/tts/edge.py +++ b/main/xiaozhi-server/core/providers/tts/edge.py @@ -8,20 +8,26 @@ from core.providers.tts.base import TTSProviderBase class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) - self.voice = config.get("voice") + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = config.get("voice") def generate_filename(self, extension=".mp3"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): communicate = edge_tts.Communicate(text, voice=self.voice) # 确保目录存在并创建空文件 os.makedirs(os.path.dirname(output_file), exist_ok=True) - with open(output_file, 'wb') as f: + with open(output_file, "wb") as f: pass - + # 流式写入音频数据 - with open(output_file, 'ab') as f: # 改为追加模式避免覆盖 + with open(output_file, "ab") as f: # 改为追加模式避免覆盖 async for chunk in communicate.stream(): if chunk["type"] == "audio": # 只处理音频数据块 f.write(chunk["data"]) diff --git a/main/xiaozhi-server/core/providers/tts/fishspeech.py b/main/xiaozhi-server/core/providers/tts/fishspeech.py index e8af4eb48..316dbed7b 100644 --- a/main/xiaozhi-server/core/providers/tts/fishspeech.py +++ b/main/xiaozhi-server/core/providers/tts/fishspeech.py @@ -8,7 +8,7 @@ from pydantic import BaseModel, Field, conint, model_validator from typing_extensions import Annotated from datetime import datetime from typing import Literal -from core.utils.util import check_model_key +from core.utils.util import check_model_key, parse_string_to_list from core.providers.tts.base import TTSProviderBase from config.logger import setup_logging @@ -24,7 +24,7 @@ class ServeReferenceAudio(BaseModel): def decode_audio(cls, values): audio = values.get("audio") if ( - isinstance(audio, str) and len(audio) > 255 + isinstance(audio, str) and len(audio) > 255 ): # Check if audio is a string (Base64) try: values["audio"] = base64.b64decode(audio) @@ -86,28 +86,52 @@ class TTSProvider(TTSProviderBase): super().__init__(config, delete_audio_file) self.reference_id = config.get("reference_id") - self.reference_audio = config.get("reference_audio", []) - self.reference_text = config.get("reference_text", []) + self.reference_audio = parse_string_to_list(config.get("reference_audio")) + self.reference_text = parse_string_to_list(config.get("reference_text")) self.format = config.get("format", "wav") - self.channels = config.get("channels", 1) - self.rate = config.get("rate", 44100) + self.api_key = config.get("api_key", "YOUR_API_KEY") have_key = check_model_key("FishSpeech TTS", self.api_key) if not have_key: return self.normalize = config.get("normalize", True) - self.max_new_tokens = config.get("max_new_tokens", 1024) - self.chunk_length = config.get("chunk_length", 200) - self.top_p = config.get("top_p", 0.7) - self.repetition_penalty = config.get("repetition_penalty", 1.2) - self.temperature = config.get("temperature", 0.7) - self.streaming = config.get("streaming", False) + + # 处理空字符串的情况 + channels = config.get("channels", "1") + rate = config.get("rate", "44100") + max_new_tokens = config.get("max_new_tokens", "1024") + chunk_length = config.get("chunk_length", "200") + + self.channels = int(channels) if channels else 1 + self.rate = int(rate) if rate else 44100 + self.max_new_tokens = int(max_new_tokens) if max_new_tokens else 1024 + self.chunk_length = int(chunk_length) if chunk_length else 200 + + # 处理空字符串的情况 + top_p = config.get("top_p", "0.7") + temperature = config.get("temperature", "0.7") + repetition_penalty = config.get("repetition_penalty", "1.2") + + self.top_p = float(top_p) if top_p else 0.7 + self.temperature = float(temperature) if temperature else 0.7 + self.repetition_penalty = ( + float(repetition_penalty) if repetition_penalty else 1.2 + ) + + self.streaming = str(config.get("streaming", False)).lower() in ( + "true", + "1", + "yes", + ) self.use_memory_cache = config.get("use_memory_cache", "on") - self.seed = config.get("seed") + self.seed = config.get("seed") or None self.api_url = config.get("api_url", "http://127.0.0.1:8080/v1/tts") def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): # Prepare reference data @@ -117,9 +141,7 @@ class TTSProvider(TTSProviderBase): data = { "text": text, "references": [ - ServeReferenceAudio( - audio=audio if audio else b"", text=text - ) + ServeReferenceAudio(audio=audio if audio else b"", text=text) for text, audio in zip(ref_texts, byte_audios) ], "reference_id": self.reference_id, @@ -139,7 +161,9 @@ class TTSProvider(TTSProviderBase): response = requests.post( self.api_url, - data=ormsgpack.packb(pydantic_data, option=ormsgpack.OPT_SERIALIZE_PYDANTIC), + data=ormsgpack.packb( + pydantic_data, option=ormsgpack.OPT_SERIALIZE_PYDANTIC + ), headers={ "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/msgpack", @@ -152,8 +176,6 @@ class TTSProvider(TTSProviderBase): with open(output_file, "wb") as audio_file: audio_file.write(audio_content) - - else: print(f"Request failed with status code {response.status_code}") print(response.json()) diff --git a/main/xiaozhi-server/core/providers/tts/gpt_sovits_v2.py b/main/xiaozhi-server/core/providers/tts/gpt_sovits_v2.py index ae20beb62..b2aad88a3 100644 --- a/main/xiaozhi-server/core/providers/tts/gpt_sovits_v2.py +++ b/main/xiaozhi-server/core/providers/tts/gpt_sovits_v2.py @@ -6,10 +6,12 @@ import requests from config.logger import setup_logging from datetime import datetime from core.providers.tts.base import TTSProviderBase +from core.utils.util import parse_string_to_list TAG = __name__ logger = setup_logging() + class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) @@ -18,23 +20,62 @@ class TTSProvider(TTSProviderBase): self.ref_audio_path = config.get("ref_audio_path") self.prompt_text = config.get("prompt_text") self.prompt_lang = config.get("prompt_lang", "zh") - self.top_k = config.get("top_k", 5) - self.top_p = config.get("top_p", 1) - self.temperature = config.get("temperature", 1) + + # 处理空字符串的情况 + top_k = config.get("top_k", "5") + top_p = config.get("top_p", "1") + temperature = config.get("temperature", "1") + batch_threshold = config.get("batch_threshold", "0.75") + batch_size = config.get("batch_size", "1") + speed_factor = config.get("speed_factor", "1.0") + seed = config.get("seed", "-1") + repetition_penalty = config.get("repetition_penalty", "1.35") + + self.top_k = int(top_k) if top_k else 5 + self.top_p = float(top_p) if top_p else 1 + self.temperature = float(temperature) if temperature else 1 + self.batch_threshold = float(batch_threshold) if batch_threshold else 0.75 + self.batch_size = int(batch_size) if batch_size else 1 + self.speed_factor = float(speed_factor) if speed_factor else 1.0 + self.seed = int(seed) if seed else -1 + self.repetition_penalty = ( + float(repetition_penalty) if repetition_penalty else 1.35 + ) + self.text_split_method = config.get("text_split_method", "cut0") - self.batch_size = config.get("batch_size", 1) - self.batch_threshold = config.get("batch_threshold", 0.75) - self.split_bucket = config.get("split_bucket", True) - self.return_fragment = config.get("return_fragment", False) - self.speed_factor = config.get("speed_factor", 1.0) - self.streaming_mode = config.get("streaming_mode", False) - self.seed = config.get("seed", -1) - self.parallel_infer = config.get("parallel_infer", True) - self.repetition_penalty = config.get("repetition_penalty", 1.35) - self.aux_ref_audio_paths = config.get("aux_ref_audio_paths", []) + + self.split_bucket = str(config.get("split_bucket", True)).lower() in ( + "true", + "1", + "yes", + ) + self.return_fragment = str(config.get("return_fragment", False)).lower() in ( + "true", + "1", + "yes", + ) + + self.streaming_mode = str(config.get("streaming_mode", False)).lower() in ( + "true", + "1", + "yes", + ) + + self.parallel_infer = str(config.get("parallel_infer", True)).lower() in ( + "true", + "1", + "yes", + ) + + self.aux_ref_audio_paths = parse_string_to_list( + config.get("aux_ref_audio_paths") + ) def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_json = { @@ -56,7 +97,7 @@ class TTSProvider(TTSProviderBase): "streaming_mode": self.streaming_mode, "seed": self.seed, "parallel_infer": self.parallel_infer, - "repetition_penalty": self.repetition_penalty + "repetition_penalty": self.repetition_penalty, } resp = requests.post(self.url, json=request_json) @@ -64,4 +105,6 @@ class TTSProvider(TTSProviderBase): with open(output_file, "wb") as file: file.write(resp.content) else: - logger.bind(tag=TAG).error(f"GPT_SoVITS_V2 TTS请求失败: {resp.status_code} - {resp.text}") + logger.bind(tag=TAG).error( + f"GPT_SoVITS_V2 TTS请求失败: {resp.status_code} - {resp.text}" + ) diff --git a/main/xiaozhi-server/core/providers/tts/gpt_sovits_v3.py b/main/xiaozhi-server/core/providers/tts/gpt_sovits_v3.py index ebfb12f17..488280f19 100644 --- a/main/xiaozhi-server/core/providers/tts/gpt_sovits_v3.py +++ b/main/xiaozhi-server/core/providers/tts/gpt_sovits_v3.py @@ -4,10 +4,12 @@ import requests from config.logger import setup_logging from datetime import datetime from core.providers.tts.base import TTSProviderBase +from core.utils.util import parse_string_to_list TAG = __name__ logger = setup_logging() + class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) @@ -16,18 +18,29 @@ class TTSProvider(TTSProviderBase): self.prompt_text = config.get("prompt_text") self.prompt_language = config.get("prompt_language") self.text_language = config.get("text_language", "audo") - self.top_k = config.get("top_k", 15) - self.top_p = config.get("top_p", 1.0) - self.temperature = config.get("temperature", 1.0) - self.cut_punc = config.get("cut_punc","") - self.speed = config.get("speed", 1.0) - self.inp_refs = config.get("inp_refs",[]) - self.sample_steps = config.get("sample_steps",32) - self.if_sr = config.get("if_sr",False) + # 处理空字符串的情况 + top_k = config.get("top_k", "15") + top_p = config.get("top_p", "1.0") + temperature = config.get("temperature", "1.0") + sample_steps = config.get("sample_steps", "32") + speed = config.get("speed", "1.0") + + self.top_k = int(top_k) if top_k else 15 + self.top_p = float(top_p) if top_p else 1.0 + self.temperature = float(temperature) if temperature else 1.0 + self.sample_steps = int(sample_steps) if sample_steps else 32 + self.speed = float(speed) if speed else 1.0 + + self.cut_punc = config.get("cut_punc", "") + self.inp_refs = parse_string_to_list(config.get("inp_refs")) + self.if_sr = str(config.get("if_sr", False)).lower() in ("true", "1", "yes") def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_params = { @@ -51,4 +64,6 @@ class TTSProvider(TTSProviderBase): with open(output_file, "wb") as file: file.write(resp.content) else: - logger.bind(tag=TAG).error(f"GPT_SoVITS_V3 TTS请求失败: {resp.status_code} - {resp.text}") + logger.bind(tag=TAG).error( + f"GPT_SoVITS_V3 TTS请求失败: {resp.status_code} - {resp.text}" + ) diff --git a/main/xiaozhi-server/core/providers/tts/minimax.py b/main/xiaozhi-server/core/providers/tts/minimax.py index 1fe7be502..dd406b64a 100644 --- a/main/xiaozhi-server/core/providers/tts/minimax.py +++ b/main/xiaozhi-server/core/providers/tts/minimax.py @@ -4,6 +4,7 @@ import json import requests from datetime import datetime from core.providers.tts.base import TTSProviderBase +from core.utils.util import parse_string_to_list class TTSProvider(TTSProviderBase): @@ -12,30 +13,35 @@ class TTSProvider(TTSProviderBase): self.group_id = config.get("group_id") self.api_key = config.get("api_key") self.model = config.get("model") - self.voice_id = config.get("voice_id") + if config.get("private_voice"): + self.voice_id = config.get("private_voice") + else: + self.voice_id = config.get("voice_id") default_voice_setting = { "voice_id": "female-shaonv", "speed": 1, "vol": 1, "pitch": 0, - "emotion": "happy" - } - default_pronunciation_dict = { - "tone": [ - "处理/(chu3)(li3)", "危险/dangerous" - ] + "emotion": "happy", } + default_pronunciation_dict = {"tone": ["处理/(chu3)(li3)", "危险/dangerous"]} defult_audio_setting = { "sample_rate": 32000, "bitrate": 128000, "format": "mp3", - "channel": 1 + "channel": 1, + } + self.voice_setting = { + **default_voice_setting, + **config.get("voice_setting", {}), + } + self.pronunciation_dict = { + **default_pronunciation_dict, + **config.get("pronunciation_dict", {}), } - self.voice_setting = {**default_voice_setting, **config.get("voice_setting", {})} - self.pronunciation_dict = {**default_pronunciation_dict, **config.get("pronunciation_dict", {})} self.audio_setting = {**defult_audio_setting, **config.get("audio_setting", {})} - self.timber_weights = config.get("timber_weights", []) + self.timber_weights = parse_string_to_list(config.get("timber_weights")) if self.voice_id: self.voice_setting["voice_id"] = self.voice_id @@ -44,11 +50,14 @@ class TTSProvider(TTSProviderBase): self.api_url = f"https://{self.host}/v1/t2a_v2?GroupId={self.group_id}" self.header = { "Content-Type": "application/json", - "Authorization": f"Bearer {self.api_key}" + "Authorization": f"Bearer {self.api_key}", } def generate_filename(self, extension=".mp3"): - return os.path.join(self.output_file, f"tts-{__name__}{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{__name__}{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_json = { @@ -65,13 +74,17 @@ class TTSProvider(TTSProviderBase): request_json["voice_setting"]["voice_id"] = "" try: - resp = requests.post(self.api_url, json.dumps(request_json), headers=self.header) + resp = requests.post( + self.api_url, json.dumps(request_json), headers=self.header + ) # 检查返回请求数据的status_code是否为0 if resp.json()["base_resp"]["status_code"] == 0: - data = resp.json()['data']['audio'] + data = resp.json()["data"]["audio"] file_to_save = open(output_file, "wb") file_to_save.write(bytes.fromhex(data)) else: - raise Exception(f"{__name__} status_code: {resp.status_code} response: {resp.content}") + raise Exception( + f"{__name__} status_code: {resp.status_code} response: {resp.content}" + ) except Exception as e: - raise Exception(f"{__name__} error: {e}") \ No newline at end of file + raise Exception(f"{__name__} error: {e}") diff --git a/main/xiaozhi-server/core/providers/tts/openai.py b/main/xiaozhi-server/core/providers/tts/openai.py index 1849c128e..a7c4e30d4 100644 --- a/main/xiaozhi-server/core/providers/tts/openai.py +++ b/main/xiaozhi-server/core/providers/tts/openai.py @@ -4,6 +4,11 @@ import requests from datetime import datetime from core.utils.util import check_model_key from core.providers.tts.base import TTSProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() + class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): @@ -11,30 +16,42 @@ class TTSProvider(TTSProviderBase): self.api_key = config.get("api_key") self.api_url = config.get("api_url", "https://api.openai.com/v1/audio/speech") self.model = config.get("model", "tts-1") - self.voice = config.get("voice", "alloy") + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = config.get("voice", "alloy") self.response_format = "wav" - self.speed = config.get("speed", 1.0) + + # 处理空字符串的情况 + speed = config.get("speed", "1.0") + self.speed = float(speed) if speed else 1.0 + self.output_file = config.get("output_dir", "tmp/") check_model_key("TTS", self.api_key) def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): headers = { "Authorization": f"Bearer {self.api_key}", - "Content-Type": "application/json" + "Content-Type": "application/json", } data = { "model": self.model, "input": text, "voice": self.voice, "response_format": "wav", - "speed": self.speed + "speed": self.speed, } response = requests.post(self.api_url, json=data, headers=headers) if response.status_code == 200: with open(output_file, "wb") as audio_file: audio_file.write(response.content) else: - raise Exception(f"OpenAI TTS请求失败: {response.status_code} - {response.text}") + raise Exception( + f"OpenAI TTS请求失败: {response.status_code} - {response.text}" + ) diff --git a/main/xiaozhi-server/core/providers/tts/siliconflow.py b/main/xiaozhi-server/core/providers/tts/siliconflow.py index 4c0cc3562..b2f564cc4 100644 --- a/main/xiaozhi-server/core/providers/tts/siliconflow.py +++ b/main/xiaozhi-server/core/providers/tts/siliconflow.py @@ -10,17 +10,23 @@ class TTSProvider(TTSProviderBase): super().__init__(config, delete_audio_file) self.model = config.get("model") self.access_token = config.get("access_token") - self.voice = config.get("voice") + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = config.get("voice") self.response_format = config.get("response_format") self.sample_rate = config.get("sample_rate") - self.speed = config.get("speed") + self.speed = float(config.get("speed", 1.0)) self.gain = config.get("gain") self.host = "api.siliconflow.cn" self.api_url = f"https://{self.host}/v1/audio/speech" def generate_filename(self, extension=".wav"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): request_json = { @@ -31,9 +37,11 @@ class TTSProvider(TTSProviderBase): } headers = { "Authorization": f"Bearer {self.access_token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } - response = requests.request("POST", self.api_url, json=request_json, headers=headers) + response = requests.request( + "POST", self.api_url, json=request_json, headers=headers + ) data = response.content file_to_save = open(output_file, "wb") file_to_save.write(data) diff --git a/main/xiaozhi-server/core/providers/tts/tencent.py b/main/xiaozhi-server/core/providers/tts/tencent.py new file mode 100644 index 000000000..f2501e2fc --- /dev/null +++ b/main/xiaozhi-server/core/providers/tts/tencent.py @@ -0,0 +1,171 @@ +import hashlib +import hmac +import os +import time +import uuid +import json +import base64 +import requests +from datetime import datetime, timezone +from core.providers.tts.base import TTSProviderBase + + +class TTSProvider(TTSProviderBase): + def __init__(self, config, delete_audio_file): + super().__init__(config, delete_audio_file) + self.appid = config.get("appid") + self.secret_id = config.get("secret_id") + self.secret_key = config.get("secret_key") + if config.get("private_voice"): + self.voice = config.get("private_voice") + else: + self.voice = int(config.get("voice")) + self.api_url = "https://tts.tencentcloudapi.com" # 正确的API端点 + self.region = config.get("region") + self.output_file = config.get("output_dir") + + def _get_auth_headers(self, request_body): + """生成鉴权请求头""" + # 获取当前UTC时间戳 + timestamp = int(time.time()) + + # 使用UTC时间计算日期 + utc_date = datetime.fromtimestamp(timestamp, tz=timezone.utc).strftime( + "%Y-%m-%d" + ) + + # 服务名称必须是 "tts" + service = "tts" + + # 拼接凭证范围 + credential_scope = f"{utc_date}/{service}/tc3_request" + + # 使用TC3-HMAC-SHA256签名方法 + algorithm = "TC3-HMAC-SHA256" + + # 构建规范请求字符串 + http_request_method = "POST" + canonical_uri = "/" + canonical_querystring = "" + + # 请求头必须包含host和content-type,且按字典序排列 + canonical_headers = ( + f"content-type:application/json\n" f"host:tts.tencentcloudapi.com\n" + ) + signed_headers = "content-type;host" + + # 请求体哈希值 + payload = json.dumps(request_body) + payload_hash = hashlib.sha256(payload.encode("utf-8")).hexdigest() + + # 构建规范请求字符串 + canonical_request = ( + f"{http_request_method}\n" + f"{canonical_uri}\n" + f"{canonical_querystring}\n" + f"{canonical_headers}\n" + f"{signed_headers}\n" + f"{payload_hash}" + ) + + # 计算规范请求的哈希值 + hashed_canonical_request = hashlib.sha256( + canonical_request.encode("utf-8") + ).hexdigest() + + # 构建待签名字符串 + string_to_sign = ( + f"{algorithm}\n" + f"{timestamp}\n" + f"{credential_scope}\n" + f"{hashed_canonical_request}" + ) + + # 计算签名密钥 + secret_date = self._hmac_sha256( + f"TC3{self.secret_key}".encode("utf-8"), utc_date + ) + secret_service = self._hmac_sha256(secret_date, service) + secret_signing = self._hmac_sha256(secret_service, "tc3_request") + + # 计算签名 + signature = hmac.new( + secret_signing, string_to_sign.encode("utf-8"), hashlib.sha256 + ).hexdigest() + + # 构建授权头 + authorization = ( + f"{algorithm} " + f"Credential={self.secret_id}/{credential_scope}, " + f"SignedHeaders={signed_headers}, " + f"Signature={signature}" + ) + + # 构建请求头 + headers = { + "Content-Type": "application/json", + "Host": "tts.tencentcloudapi.com", + "Authorization": authorization, + "X-TC-Action": "TextToVoice", + "X-TC-Timestamp": str(timestamp), + "X-TC-Version": "2019-08-23", + "X-TC-Region": self.region, + "X-TC-Language": "zh-CN", + } + + return headers + + def _hmac_sha256(self, key, msg): + """HMAC-SHA256加密""" + if isinstance(msg, str): + msg = msg.encode("utf-8") + return hmac.new(key, msg, hashlib.sha256).digest() + + def generate_filename(self, extension=".wav"): + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) + + async def text_to_speak(self, text, output_file): + # 构建请求体 + request_json = { + "Text": text, # 合成语音的源文本 + "SessionId": str(uuid.uuid4()), # 会话ID,随机生成 + "VoiceType": int(self.voice), # 音色 + } + + try: + # 获取请求头(每次请求都重新生成,以确保时间戳和签名是最新的) + headers = self._get_auth_headers(request_json) + + # 发送请求 + resp = requests.post( + self.api_url, json.dumps(request_json), headers=headers + ) + + # 检查响应 + if resp.status_code == 200: + response_data = resp.json() + + # 检查是否成功 + if response_data.get("Response", {}).get("Error") is not None: + error_info = response_data["Response"]["Error"] + raise Exception( + f"API返回错误: {error_info['Code']}: {error_info['Message']}" + ) + + # 提取音频数据 + audio_data = response_data["Response"].get("Audio") + if audio_data: + # 解码Base64音频数据并保存 + with open(output_file, "wb") as f: + f.write(base64.b64decode(audio_data)) + else: + raise Exception(f"{__name__}: 没有返回音频数据: {response_data}") + else: + raise Exception( + f"{__name__} status_code: {resp.status_code} response: {resp.content}" + ) + except Exception as e: + raise Exception(f"{__name__} error: {e}") diff --git a/main/xiaozhi-server/core/providers/tts/ttson.py b/main/xiaozhi-server/core/providers/tts/ttson.py index e9fee1091..047d7a678 100644 --- a/main/xiaozhi-server/core/providers/tts/ttson.py +++ b/main/xiaozhi-server/core/providers/tts/ttson.py @@ -5,53 +5,72 @@ import requests import shutil from datetime import datetime from core.providers.tts.base import TTSProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) - self.url = config.get("url", "https://u95167-bd74-2aef8085.westx.seetacloud.com:8443/flashsummary/tts?token=") - self.voice_id = config.get("voice_id", 1695) + self.url = config.get( + "url", + "https://u95167-bd74-2aef8085.westx.seetacloud.com:8443/flashsummary/tts?token=", + ) + if config.get("private_voice"): + self.voice_id = int(config.get("private_voice")) + else: + self.voice_id = int(config.get("voice_id", 1695)) self.token = config.get("token") self.to_lang = config.get("to_lang") - self.volume_change_dB = config.get("volume_change_dB", 0) - self.speed_factor = config.get("speed_factor", 1) - self.stream = config.get("stream", False) + self.volume_change_dB = int(config.get("volume_change_dB", 0)) + self.speed_factor = int(config.get("speed_factor", 1)) + self.stream = str(config.get("stream", False)).lower() in ("true", "1", "yes") self.output_file = config.get("output_dir") - self.pitch_factor = config.get("pitch_factor", 0) + self.pitch_factor = int(config.get("pitch_factor", 0)) self.format = config.get("format", "mp3") - self.emotion = config.get("emotion", 1) - self.header = { - "Content-Type": "application/json" - } + self.emotion = int(config.get("emotion", 1)) + self.header = {"Content-Type": "application/json"} def generate_filename(self, extension=".mp3"): - return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}") + return os.path.join( + self.output_file, + f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}", + ) async def text_to_speak(self, text, output_file): - url = f'{self.url}{self.token}' + url = f"{self.url}{self.token}" result = "firefly" - payload = json.dumps({ - "to_lang": self.to_lang, - "text": text, - "emotion": self.emotion, - "format": self.format, - "volume_change_dB": self.volume_change_dB, - "voice_id": self.voice_id, - "pitch_factor": self.pitch_factor, - "speed_factor": self.speed_factor, - "token": self.token - }) + payload = json.dumps( + { + "to_lang": self.to_lang, + "text": text, + "emotion": self.emotion, + "format": self.format, + "volume_change_dB": self.volume_change_dB, + "voice_id": self.voice_id, + "pitch_factor": self.pitch_factor, + "speed_factor": self.speed_factor, + "token": self.token, + } + ) resp = requests.request("POST", url, data=payload) if resp.status_code != 200: + logger.bind(tag=TAG).error(f"TTS请求失败: {resp.text}") return None resp_json = resp.json() try: - result = resp_json['url'] + ':' + str( - resp_json[ - 'port']) + '/flashsummary/retrieveFileData?stream=True&token=' + self.token + '&voice_audio_path=' + \ - resp_json['voice_path'] + result = ( + resp_json["url"] + + ":" + + str(resp_json["port"]) + + "/flashsummary/retrieveFileData?stream=True&token=" + + self.token + + "&voice_audio_path=" + + resp_json["voice_path"] + ) except Exception as e: print("error:", e) diff --git a/main/xiaozhi-server/core/providers/vad/base.py b/main/xiaozhi-server/core/providers/vad/base.py new file mode 100644 index 000000000..1d8d4c8dd --- /dev/null +++ b/main/xiaozhi-server/core/providers/vad/base.py @@ -0,0 +1,9 @@ +from abc import ABC, abstractmethod +from typing import Optional + + +class VADProviderBase(ABC): + @abstractmethod + def is_vad(self, conn, data) -> bool: + """检测音频数据中的语音活动""" + pass diff --git a/main/xiaozhi-server/core/providers/vad/silero.py b/main/xiaozhi-server/core/providers/vad/silero.py new file mode 100644 index 000000000..8ec1f6eb5 --- /dev/null +++ b/main/xiaozhi-server/core/providers/vad/silero.py @@ -0,0 +1,71 @@ +import time +import numpy as np +import torch +import opuslib_next +from config.logger import setup_logging +from core.providers.vad.base import VADProviderBase + +TAG = __name__ +logger = setup_logging() + + +class VADProvider(VADProviderBase): + def __init__(self, config): + logger.bind(tag=TAG).info("SileroVAD", config) + self.model, self.utils = torch.hub.load( + repo_or_dir=config["model_dir"], + source="local", + model="silero_vad", + force_reload=False, + ) + (get_speech_timestamps, _, _, _, _) = self.utils + + self.decoder = opuslib_next.Decoder(16000, 1) + + # 处理空字符串的情况 + threshold = config.get("threshold", "0.5") + min_silence_duration_ms = config.get("min_silence_duration_ms", "1000") + + self.vad_threshold = float(threshold) if threshold else 0.5 + self.silence_threshold_ms = ( + int(min_silence_duration_ms) if min_silence_duration_ms else 1000 + ) + + def is_vad(self, conn, opus_packet): + try: + pcm_frame = self.decoder.decode(opus_packet, 960) + conn.client_audio_buffer.extend(pcm_frame) # 将新数据加入缓冲区 + + # 处理缓冲区中的完整帧(每次处理512采样点) + client_have_voice = False + while len(conn.client_audio_buffer) >= 512 * 2: + # 提取前512个采样点(1024字节) + chunk = conn.client_audio_buffer[: 512 * 2] + conn.client_audio_buffer = conn.client_audio_buffer[512 * 2 :] + + # 转换为模型需要的张量格式 + audio_int16 = np.frombuffer(chunk, dtype=np.int16) + audio_float32 = audio_int16.astype(np.float32) / 32768.0 + audio_tensor = torch.from_numpy(audio_float32) + + # 检测语音活动 + with torch.no_grad(): + speech_prob = self.model(audio_tensor, 16000).item() + client_have_voice = speech_prob >= self.vad_threshold + + # 如果之前有声音,但本次没有声音,且与上次有声音的时间查已经超过了静默阈值,则认为已经说完一句话 + if conn.client_have_voice and not client_have_voice: + stop_duration = ( + time.time() * 1000 - conn.client_have_voice_last_time + ) + if stop_duration >= self.silence_threshold_ms: + conn.client_voice_stop = True + if client_have_voice: + conn.client_have_voice = True + conn.client_have_voice_last_time = time.time() * 1000 + + return client_have_voice + except opuslib_next.OpusError as e: + logger.bind(tag=TAG).info(f"解码错误: {e}") + except Exception as e: + logger.bind(tag=TAG).error(f"Error processing audio packet: {e}") diff --git a/main/xiaozhi-server/core/utils/auth_code_gen.py b/main/xiaozhi-server/core/utils/auth_code_gen.py deleted file mode 100644 index c61024dd7..000000000 --- a/main/xiaozhi-server/core/utils/auth_code_gen.py +++ /dev/null @@ -1,97 +0,0 @@ -import random -import threading -import time -from typing import Set - -class AuthCodeGenerator: - _instance = None - _instance_lock = threading.Lock() - - def __new__(cls): - if not cls._instance: - with cls._instance_lock: - if not cls._instance: - cls._instance = super(AuthCodeGenerator, cls).__new__(cls) - # 初始化随机种子 - random.seed(time.time()) - return cls._instance - - def __init__(self): - # 确保 __init__ 只被调用一次 - if not hasattr(self, '_initialized'): - self._used_codes: Set[str] = set() - self._code_timestamps = {} - self._lock = threading.Lock() - self._code_timeout = 3 * 24 * 60 * 60 - self._initialized = True - - @classmethod - def get_instance(cls): - """获取AuthCodeGenerator的单例实例""" - return cls() - - def generate_code(self) -> str: - """ - 生成6位数字认证码,确保不重复 - 返回: 6位数字字符串 - """ - with self._lock: - self._clean_expired_codes() # 清理过期code - while True: - # 使用时间戳和已用码数量作为种子,确保每次生成不同的随机数 - seed = int(time.time() * 1000) + len(self._used_codes) - random.seed(seed) - - # 生成6位随机数字 - code = ''.join(str(random.randint(0, 9)) for _ in range(6)) - - # 检查是否已存在 - if code not in self._used_codes: - self._used_codes.add(code) - self._code_timestamps[code] = time.time() - return code - - def remove_code(self, code: str) -> bool: - """ - 删除已使用的认证码 - 参数: - code: 要删除的认证码 - 返回: - bool: 删除成功返回True,码不存在返回False - """ - print('remove_code', code) - with self._lock: - if code in self._used_codes: - self._used_codes.remove(code) - if code in self._code_timestamps: - del self._code_timestamps[code] - return True - return False - - def is_code_used(self, code: str) -> bool: - """ - 检查认证码是否已被使用 - 参数: - code: 要检查的认证码 - 返回: - bool: 如果码存在返回True,否则返回False - """ - with self._lock: - return code in self._used_codes - - def clear_codes(self): - """清空所有已使用的认证码""" - with self._lock: - self._used_codes.clear() - self._code_timestamps.clear() - - def _clean_expired_codes(self): - """清理过期的认证码""" - current_time = time.time() - expired_codes = [ - code for code, timestamp in self._code_timestamps.items() - if (current_time - timestamp) > self._code_timeout - ] - for code in expired_codes: - self._used_codes.remove(code) - del self._code_timestamps[code] diff --git a/main/xiaozhi-server/core/utils/dialogue.py b/main/xiaozhi-server/core/utils/dialogue.py index d4e66bb65..8b79a35a2 100644 --- a/main/xiaozhi-server/core/utils/dialogue.py +++ b/main/xiaozhi-server/core/utils/dialogue.py @@ -4,7 +4,14 @@ from datetime import datetime class Message: - def __init__(self, role: str, content: str = None, uniq_id: str = None, tool_calls = None, tool_call_id=None): + def __init__( + self, + role: str, + content: str = None, + uniq_id: str = None, + tool_calls=None, + tool_call_id=None, + ): self.uniq_id = uniq_id if uniq_id is not None else str(uuid.uuid4()) self.role = role self.content = content @@ -16,7 +23,7 @@ class Dialogue: def __init__(self): self.dialogue: List[Message] = [] # 获取当前时间 - self.current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + self.current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") def put(self, message: Message): self.dialogue.append(message) @@ -25,7 +32,9 @@ class Dialogue: if m.tool_calls is not None: dialogue.append({"role": m.role, "tool_calls": m.tool_calls}) elif m.role == "tool": - dialogue.append({"role": m.role, "tool_call_id": m.tool_call_id, "content": m.content}) + dialogue.append( + {"role": m.role, "tool_call_id": m.tool_call_id, "content": m.content} + ) else: dialogue.append({"role": m.role, "content": m.content}) @@ -44,23 +53,23 @@ class Dialogue: else: self.put(Message(role="system", content=new_content)) - def get_llm_dialogue_with_memory(self, memory_str: str = None) -> List[Dict[str, str]]: + def get_llm_dialogue_with_memory( + self, memory_str: str = None + ) -> List[Dict[str, str]]: if memory_str is None or len(memory_str) == 0: return self.get_llm_dialogue() - + # 构建带记忆的对话 dialogue = [] - + # 添加系统提示和记忆 system_message = next( (msg for msg in self.dialogue if msg.role == "system"), None ) - if system_message: enhanced_system_prompt = ( - f"{system_message.content}\n\n" - f"相关记忆:\n{memory_str}" + f"{system_message.content}\n\n" f"相关记忆:\n{memory_str}" ) dialogue.append({"role": "system", "content": enhanced_system_prompt}) diff --git a/main/xiaozhi-server/core/utils/lock_manager.py b/main/xiaozhi-server/core/utils/lock_manager.py deleted file mode 100644 index f1db6fc73..000000000 --- a/main/xiaozhi-server/core/utils/lock_manager.py +++ /dev/null @@ -1,39 +0,0 @@ -import asyncio -from typing import Dict -from config.logger import setup_logging - -TAG = __name__ -logger = setup_logging() - -class FileLockManager: - _instance = None - _locks: Dict[str, asyncio.Lock] = {} - - def __new__(cls): - if cls._instance is None: - cls._instance = super(FileLockManager, cls).__new__(cls) - return cls._instance - - @classmethod - def get_lock(cls, file_path: str) -> asyncio.Lock: - """获取指定文件的锁""" - if file_path not in cls._locks: - cls._locks[file_path] = asyncio.Lock() - return cls._locks[file_path] - - @classmethod - async def acquire_lock(cls, file_path: str): - """获取锁""" - lock = cls.get_lock(file_path) - await lock.acquire() - logger.bind(tag=TAG).debug(f"Acquired lock for {file_path}") - - @classmethod - def release_lock(cls, file_path: str): - """释放锁""" - if file_path in cls._locks: - try: - cls._locks[file_path].release() - logger.bind(tag=TAG).debug(f"Released lock for {file_path}") - except RuntimeError as e: - logger.bind(tag=TAG).warning(f"Failed to release lock for {file_path}: {e}") diff --git a/main/xiaozhi-server/core/utils/memory.py b/main/xiaozhi-server/core/utils/memory.py index c750e9aa7..ff43b220c 100644 --- a/main/xiaozhi-server/core/utils/memory.py +++ b/main/xiaozhi-server/core/utils/memory.py @@ -2,16 +2,17 @@ import os import sys import importlib from config.logger import setup_logging -from core.utils.util import read_config, get_project_dir logger = setup_logging() + def create_instance(class_name, *args, **kwargs): - if os.path.exists(os.path.join('core', 'providers', 'memory', class_name, f'{class_name}.py')): - lib_name = f'core.providers.memory.{class_name}.{class_name}' + if os.path.exists( + os.path.join("core", "providers", "memory", class_name, f"{class_name}.py") + ): + lib_name = f"core.providers.memory.{class_name}.{class_name}" if lib_name not in sys.modules: - sys.modules[lib_name] = importlib.import_module(f'{lib_name}') + sys.modules[lib_name] = importlib.import_module(f"{lib_name}") return sys.modules[lib_name].MemoryProvider(*args, **kwargs) raise ValueError(f"不支持的记忆服务类型: {class_name}") - diff --git a/main/xiaozhi-server/core/utils/output_counter.py b/main/xiaozhi-server/core/utils/output_counter.py new file mode 100644 index 000000000..1e7ae8df6 --- /dev/null +++ b/main/xiaozhi-server/core/utils/output_counter.py @@ -0,0 +1,50 @@ +import datetime +from typing import Dict, Tuple + +# 全局字典,用于存储每个设备的每日输出字数 +_device_daily_output: Dict[Tuple[str, datetime.date], int] = {} +# 记录最后一次检查的日期 +_last_check_date: datetime.date = None + + +def reset_device_output(): + """ + 重置所有设备的每日输出字数 + 每天0点调用此函数 + """ + _device_daily_output.clear() + + +def get_device_output(device_id: str) -> int: + """ + 获取设备当日的输出字数 + """ + current_date = datetime.datetime.now().date() + return _device_daily_output.get((device_id, current_date), 0) + + +def add_device_output(device_id: str, char_count: int): + """ + 增加设备的输出字数 + """ + current_date = datetime.datetime.now().date() + global _last_check_date + + # 如果是第一次调用或者日期发生变化,清空计数器 + if _last_check_date is None or _last_check_date != current_date: + _device_daily_output.clear() + _last_check_date = current_date + + current_count = _device_daily_output.get((device_id, current_date), 0) + _device_daily_output[(device_id, current_date)] = current_count + char_count + + +def check_device_output_limit(device_id: str, max_output_size: int) -> bool: + """ + 检查设备是否超过输出限制 + :return: True 如果超过限制,False 如果未超过 + """ + if not device_id: + return False + current_output = get_device_output(device_id) + return current_output >= max_output_size diff --git a/main/xiaozhi-server/core/utils/util.py b/main/xiaozhi-server/core/utils/util.py index 51841baf4..effbf38e5 100644 --- a/main/xiaozhi-server/core/utils/util.py +++ b/main/xiaozhi-server/core/utils/util.py @@ -1,16 +1,39 @@ -import os import json -import yaml import socket import subprocess -import logging import re +import os +import numpy as np import requests +import opuslib_next +from pydub import AudioSegment +from typing import Dict, Any +from core.utils import tts, llm, intent, memory, vad, asr - -def get_project_dir(): - """获取项目根目录""" - return os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + '/' +TAG = __name__ +emoji_map = { + "neutral": "😶", + "happy": "🙂", + "laughing": "😆", + "funny": "😂", + "sad": "😔", + "angry": "😠", + "crying": "😭", + "loving": "😍", + "embarrassed": "😳", + "surprised": "😲", + "shocked": "😱", + "thinking": "🤔", + "winking": "😉", + "cool": "😎", + "relaxed": "😌", + "delicious": "🤤", + "kissy": "😘", + "confident": "😏", + "sleepy": "😴", + "silly": "😜", + "confused": "🙄", +} def get_local_ip(): @@ -24,6 +47,7 @@ def get_local_ip(): except Exception as e: return "127.0.0.1" + def is_private_ip(ip_addr): """ Check if an IP address is a private IP address (compatible with IPv4 and IPv6). @@ -33,63 +57,57 @@ def is_private_ip(ip_addr): """ try: # Validate IPv4 or IPv6 address format - if not re.match(r"^(\d{1,3}\.){3}\d{1,3}$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$", ip_addr): + if not re.match( + r"^(\d{1,3}\.){3}\d{1,3}$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$", ip_addr + ): return False # Invalid IP address format # IPv4 private address ranges - if '.' in ip_addr: # IPv4 address - ip_parts = list(map(int, ip_addr.split('.'))) + if "." in ip_addr: # IPv4 address + ip_parts = list(map(int, ip_addr.split("."))) if ip_parts[0] == 10: return True # 10.0.0.0/8 range elif ip_parts[0] == 172 and 16 <= ip_parts[1] <= 31: return True # 172.16.0.0/12 range elif ip_parts[0] == 192 and ip_parts[1] == 168: return True # 192.168.0.0/16 range - elif ip_addr == '127.0.0.1': + elif ip_addr == "127.0.0.1": return True # Loopback address elif ip_parts[0] == 169 and ip_parts[1] == 254: - return True # Link-local address 169.254.0.0/16 + return True # Link-local address 169.254.0.0/16 else: return False # Not a private IPv4 address else: # IPv6 address ip_addr = ip_addr.lower() - if ip_addr.startswith('fc00:') or ip_addr.startswith('fd00:'): + if ip_addr.startswith("fc00:") or ip_addr.startswith("fd00:"): return True # Unique Local Addresses (FC00::/7) - elif ip_addr == '::1': + elif ip_addr == "::1": return True # Loopback address - elif ip_addr.startswith('fe80:'): - return True # Link-local unicast addresses (FE80::/10) + elif ip_addr.startswith("fe80:"): + return True # Link-local unicast addresses (FE80::/10) else: return False # Not a private IPv6 address except (ValueError, IndexError): return False # IP address format error or insufficient segments -def get_ip_info(ip_addr): + +def get_ip_info(ip_addr, logger): try: - base_url = "https://freeipapi.com/api/json" - url = base_url if is_private_ip(ip_addr) else f"{base_url}/{ip_addr}" - + if is_private_ip(ip_addr): + ip_addr = "" + url = f"https://whois.pconline.com.cn/ipJson.jsp?json=true&ip={ip_addr}" resp = requests.get(url).json() - - ip_info = { - "city": resp.get("cityName") - } + ip_info = {"city": resp.get("city")} return ip_info except Exception as e: - logging.error(f"Error getting client ip info: {e}") + logger.bind(tag=TAG).error(f"Error getting client ip info: {e}") return {} -def read_config(config_path): - with open(config_path, "r", encoding="utf-8") as file: - config = yaml.safe_load(file) - return config - - def write_json_file(file_path, data): """将数据写入 JSON 文件""" - with open(file_path, 'w', encoding='utf-8') as file: + with open(file_path, "w", encoding="utf-8") as file: json.dump(data, file, ensure_ascii=False, indent=4) @@ -97,21 +115,29 @@ def is_punctuation_or_emoji(char): """检查字符是否为空格、指定标点或表情符号""" # 定义需要去除的中英文标点(包括全角/半角) punctuation_set = { - ',', ',', # 中文逗号 + 英文逗号 - '。', '.', # 中文句号 + 英文句号 - '!', '!', # 中文感叹号 + 英文感叹号 - '-', '-', # 英文连字符 + 中文全角横线 - '、' # 中文顿号 + ",", + ",", # 中文逗号 + 英文逗号 + "-", + "-", # 英文连字符 + 中文全角横线 + "、", # 中文顿号 + "“", + "”", + '"', # 中文双引号 + 英文引号 + ":", + ":", # 中文冒号 + 英文冒号 } if char.isspace() or char in punctuation_set: return True # 检查表情符号(保留原有逻辑) code_point = ord(char) emoji_ranges = [ - (0x1F600, 0x1F64F), (0x1F300, 0x1F5FF), - (0x1F680, 0x1F6FF), (0x1F900, 0x1F9FF), - (0x1FA70, 0x1FAFF), (0x2600, 0x26FF), - (0x2700, 0x27BF) + (0x1F600, 0x1F64F), + (0x1F300, 0x1F5FF), + (0x1F680, 0x1F6FF), + (0x1F900, 0x1F9FF), + (0x1FA70, 0x1FAFF), + (0x2600, 0x26FF), + (0x2700, 0x27BF), ] return any(start <= code_point <= end for start, end in emoji_ranges) @@ -127,45 +153,75 @@ def get_string_no_punctuation_or_emoji(s): end = len(chars) - 1 while end >= start and is_punctuation_or_emoji(chars[end]): end -= 1 - return ''.join(chars[start:end + 1]) + return "".join(chars[start : end + 1]) def remove_punctuation_and_length(text): # 全角符号和半角符号的Unicode范围 - full_width_punctuations = '!"#$%&'()*+,-。/:;<=>?@[\]^_`{|}~' + full_width_punctuations = ( + "!"#$%&'()*+,-。/:;<=>?@[\]^_`{|}~" + ) half_width_punctuations = r'!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~' - space = ' ' # 半角空格 - full_width_space = ' ' # 全角空格 + space = " " # 半角空格 + full_width_space = " " # 全角空格 # 去除全角和半角符号以及空格 - result = ''.join([char for char in text if - char not in full_width_punctuations and char not in half_width_punctuations and char not in space and char not in full_width_space]) + result = "".join( + [ + char + for char in text + if char not in full_width_punctuations + and char not in half_width_punctuations + and char not in space + and char not in full_width_space + ] + ) if result == "Yeah": return 0, "" return len(result), result + def check_model_key(modelType, modelKey): if "你" in modelKey: - logging.error("你还没配置" + modelType + "的密钥,请在配置文件中配置密钥,否则无法正常工作") - return False + raise ValueError( + "你还没配置" + modelType + "的密钥,请检查一下所使用的LLM是否配置了密钥" + ) return True +def parse_string_to_list(value, separator=";"): + """ + 将输入值转换为列表 + Args: + value: 输入值,可以是 None、字符串或列表 + separator: 分隔符,默认为分号 + Returns: + list: 处理后的列表 + """ + if value is None or value == "": + return [] + elif isinstance(value, str): + return [item.strip() for item in value.split(separator) if item.strip()] + elif isinstance(value, list): + return value + return [] + + def check_ffmpeg_installed(): ffmpeg_installed = False try: # 执行ffmpeg -version命令,并捕获输出 result = subprocess.run( - ['ffmpeg', '-version'], + ["ffmpeg", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, - check=True # 如果返回码非零则抛出异常 + check=True, # 如果返回码非零则抛出异常 ) # 检查输出中是否包含版本信息(可选) output = result.stdout + result.stderr - if 'ffmpeg version' in output.lower(): + if "ffmpeg version" in output.lower(): ffmpeg_installed = True return False except (subprocess.CalledProcessError, FileNotFoundError): @@ -177,11 +233,727 @@ def check_ffmpeg_installed(): error_msg += "1、按照项目的安装文档,正确进入conda环境\n" error_msg += "2、查阅安装文档,如何在conda环境中安装ffmpeg\n" raise ValueError(error_msg) - + + def extract_json_from_string(input_string): """提取字符串中的 JSON 部分""" - pattern = r'(\{.*\})' - match = re.search(pattern, input_string) + pattern = r"(\{.*\})" + match = re.search(pattern, input_string, re.DOTALL) # 添加 re.DOTALL if match: return match.group(1) # 返回提取的 JSON 字符串 - return None \ No newline at end of file + return None + + +def initialize_modules( + logger, + config: Dict[str, Any], + init_vad=False, + init_asr=False, + init_llm=False, + init_tts=False, + init_memory=False, + init_intent=False, +) -> Dict[str, Any]: + """ + 初始化所有模块组件 + + Args: + config: 配置字典 + + Returns: + Dict[str, Any]: 包含所有初始化后的模块的字典 + """ + modules = {} + + # 初始化TTS模块 + if init_tts: + select_tts_module = config["selected_module"]["TTS"] + tts_type = ( + select_tts_module + if "type" not in config["TTS"][select_tts_module] + else config["TTS"][select_tts_module]["type"] + ) + modules["tts"] = tts.create_instance( + tts_type, + config["TTS"][select_tts_module], + str(config.get("delete_audio", True)).lower() in ("true", "1", "yes"), + ) + logger.bind(tag=TAG).info(f"初始化组件: tts成功 {select_tts_module}") + + # 初始化LLM模块 + if init_llm: + select_llm_module = config["selected_module"]["LLM"] + llm_type = ( + select_llm_module + if "type" not in config["LLM"][select_llm_module] + else config["LLM"][select_llm_module]["type"] + ) + modules["llm"] = llm.create_instance( + llm_type, + config["LLM"][select_llm_module], + ) + logger.bind(tag=TAG).info(f"初始化组件: llm成功 {select_llm_module}") + + # 初始化Intent模块 + if init_intent: + select_intent_module = config["selected_module"]["Intent"] + intent_type = ( + select_intent_module + if "type" not in config["Intent"][select_intent_module] + else config["Intent"][select_intent_module]["type"] + ) + modules["intent"] = intent.create_instance( + intent_type, + config["Intent"][select_intent_module], + ) + logger.bind(tag=TAG).info(f"初始化组件: intent成功 {select_intent_module}") + + # 初始化Memory模块 + if init_memory: + select_memory_module = config["selected_module"]["Memory"] + memory_type = ( + select_memory_module + if "type" not in config["Memory"][select_memory_module] + else config["Memory"][select_memory_module]["type"] + ) + modules["memory"] = memory.create_instance( + memory_type, + config["Memory"][select_memory_module], + ) + logger.bind(tag=TAG).info(f"初始化组件: memory成功 {select_memory_module}") + + # 初始化VAD模块 + if init_vad: + select_vad_module = config["selected_module"]["VAD"] + vad_type = ( + select_vad_module + if "type" not in config["VAD"][select_vad_module] + else config["VAD"][select_vad_module]["type"] + ) + modules["vad"] = vad.create_instance( + vad_type, + config["VAD"][select_vad_module], + ) + logger.bind(tag=TAG).info(f"初始化组件: vad成功 {select_vad_module}") + + # 初始化ASR模块 + if init_asr: + select_asr_module = config["selected_module"]["ASR"] + asr_type = ( + select_asr_module + if "type" not in config["ASR"][select_asr_module] + else config["ASR"][select_asr_module]["type"] + ) + modules["asr"] = asr.create_instance( + asr_type, + config["ASR"][select_asr_module], + str(config.get("delete_audio", True)).lower() in ("true", "1", "yes"), + ) + logger.bind(tag=TAG).info(f"初始化组件: asr成功 {select_asr_module}") + return modules + + +def analyze_emotion(text): + """ + 分析文本情感并返回对应的emoji名称(支持中英文) + """ + if not text or not isinstance(text, str): + return "neutral" + + original_text = text + text = text.lower().strip() + + # 检查是否包含现有emoji + for emotion, emoji in emoji_map.items(): + if emoji in original_text: + return emotion + + # 标点符号分析 + has_exclamation = "!" in original_text or "!" in original_text + has_question = "?" in original_text or "?" in original_text + has_ellipsis = "..." in original_text or "…" in original_text + + # 定义情感关键词映射(中英文扩展版) + emotion_keywords = { + "happy": [ + "开心", + "高兴", + "快乐", + "愉快", + "幸福", + "满意", + "棒", + "好", + "不错", + "完美", + "棒极了", + "太好了", + "好呀", + "好的", + "happy", + "joy", + "great", + "good", + "nice", + "awesome", + "fantastic", + "wonderful", + ], + "laughing": [ + "哈哈", + "哈哈哈", + "呵呵", + "嘿嘿", + "嘻嘻", + "笑死", + "太好笑了", + "笑死我了", + "lol", + "lmao", + "haha", + "hahaha", + "hehe", + "rofl", + "funny", + "laugh", + ], + "funny": [ + "搞笑", + "滑稽", + "逗", + "幽默", + "笑点", + "段子", + "笑话", + "太逗了", + "hilarious", + "joke", + "comedy", + ], + "sad": [ + "伤心", + "难过", + "悲哀", + "悲伤", + "忧郁", + "郁闷", + "沮丧", + "失望", + "想哭", + "难受", + "不开心", + "唉", + "呜呜", + "sad", + "upset", + "unhappy", + "depressed", + "sorrow", + "gloomy", + ], + "angry": [ + "生气", + "愤怒", + "气死", + "讨厌", + "烦人", + "可恶", + "烦死了", + "恼火", + "暴躁", + "火大", + "愤怒", + "气炸了", + "angry", + "mad", + "annoyed", + "furious", + "pissed", + "hate", + ], + "crying": [ + "哭泣", + "泪流", + "大哭", + "伤心欲绝", + "泪目", + "流泪", + "哭死", + "哭晕", + "想哭", + "泪崩", + "cry", + "crying", + "tears", + "sob", + "weep", + ], + "loving": [ + "爱你", + "喜欢", + "爱", + "亲爱的", + "宝贝", + "么么哒", + "抱抱", + "想你", + "思念", + "最爱", + "亲亲", + "喜欢你", + "love", + "like", + "adore", + "darling", + "sweetie", + "honey", + "miss you", + "heart", + ], + "embarrassed": [ + "尴尬", + "不好意思", + "害羞", + "脸红", + "难为情", + "社死", + "丢脸", + "出丑", + "embarrassed", + "awkward", + "shy", + "blush", + ], + "surprised": [ + "惊讶", + "吃惊", + "天啊", + "哇塞", + "哇", + "居然", + "竟然", + "没想到", + "出乎意料", + "surprise", + "wow", + "omg", + "oh my god", + "amazing", + "unbelievable", + ], + "shocked": [ + "震惊", + "吓到", + "惊呆了", + "不敢相信", + "震撼", + "吓死", + "恐怖", + "害怕", + "吓人", + "shocked", + "shocking", + "scared", + "frightened", + "terrified", + "horror", + ], + "thinking": [ + "思考", + "考虑", + "想一下", + "琢磨", + "沉思", + "冥想", + "想", + "思考中", + "在想", + "think", + "thinking", + "consider", + "ponder", + "meditate", + ], + "winking": [ + "调皮", + "眨眼", + "你懂的", + "坏笑", + "邪恶", + "奸笑", + "使眼色", + "wink", + "teasing", + "naughty", + "mischievous", + ], + "cool": [ + "酷", + "帅", + "厉害", + "棒极了", + "真棒", + "牛逼", + "强", + "优秀", + "杰出", + "出色", + "完美", + "cool", + "awesome", + "amazing", + "great", + "impressive", + "perfect", + ], + "relaxed": [ + "放松", + "舒服", + "惬意", + "悠闲", + "轻松", + "舒适", + "安逸", + "自在", + "relax", + "relaxed", + "comfortable", + "cozy", + "chill", + "peaceful", + ], + "delicious": [ + "好吃", + "美味", + "香", + "馋", + "可口", + "香甜", + "大餐", + "大快朵颐", + "流口水", + "垂涎", + "delicious", + "yummy", + "tasty", + "yum", + "appetizing", + "mouthwatering", + ], + "kissy": [ + "亲亲", + "么么", + "吻", + "mua", + "muah", + "亲一下", + "飞吻", + "kiss", + "xoxo", + "hug", + "muah", + "smooch", + ], + "confident": [ + "自信", + "肯定", + "确定", + "毫无疑问", + "当然", + "必须的", + "毫无疑问", + "确信", + "坚信", + "confident", + "sure", + "certain", + "definitely", + "positive", + ], + "sleepy": [ + "困", + "睡觉", + "晚安", + "想睡", + "好累", + "疲惫", + "疲倦", + "困了", + "想休息", + "睡意", + "sleep", + "sleepy", + "tired", + "exhausted", + "bedtime", + "good night", + ], + "silly": [ + "傻", + "笨", + "呆", + "憨", + "蠢", + "二", + "憨憨", + "傻乎乎", + "呆萌", + "silly", + "stupid", + "dumb", + "foolish", + "goofy", + "ridiculous", + ], + "confused": [ + "疑惑", + "不明白", + "不懂", + "困惑", + "疑问", + "为什么", + "怎么回事", + "啥意思", + "不清楚", + "confused", + "puzzled", + "doubt", + "question", + "what", + "why", + "how", + ], + } + + # 特殊句型判断(中英文) + # 赞美他人 + if any( + phrase in text + for phrase in [ + "你真", + "你好", + "您真", + "你真棒", + "你好厉害", + "你太强了", + "你真好", + "你真聪明", + "you are", + "you're", + "you look", + "you seem", + "so smart", + "so kind", + ] + ): + return "loving" + # 自我赞美 + if any( + phrase in text + for phrase in [ + "我真", + "我最", + "我太棒了", + "我厉害", + "我聪明", + "我优秀", + "i am", + "i'm", + "i feel", + "so good", + "so happy", + ] + ): + return "cool" + # 晚安/睡觉相关 + if any( + phrase in text + for phrase in [ + "睡觉", + "晚安", + "睡了", + "好梦", + "休息了", + "去睡了", + "sleep", + "good night", + "bedtime", + "go to bed", + ] + ): + return "sleepy" + # 疑问句 + if has_question and not has_exclamation: + return "thinking" + # 强烈情感(感叹号) + if has_exclamation and not has_question: + # 检查是否是积极内容 + positive_words = ( + emotion_keywords["happy"] + + emotion_keywords["laughing"] + + emotion_keywords["cool"] + ) + if any(word in text for word in positive_words): + return "laughing" + # 检查是否是消极内容 + negative_words = ( + emotion_keywords["angry"] + + emotion_keywords["sad"] + + emotion_keywords["crying"] + ) + if any(word in text for word in negative_words): + return "angry" + return "surprised" + # 省略号(表示犹豫或思考) + if has_ellipsis: + return "thinking" + + # 关键词匹配(带权重) + emotion_scores = {emotion: 0 for emotion in emoji_map.keys()} + + # 给匹配到的关键词加分 + for emotion, keywords in emotion_keywords.items(): + for keyword in keywords: + if keyword in text: + emotion_scores[emotion] += 1 + + # 给长文本中的重复关键词额外加分 + if len(text) > 20: # 长文本 + for emotion, keywords in emotion_keywords.items(): + for keyword in keywords: + emotion_scores[emotion] += text.count(keyword) * 0.5 + + # 根据分数选择最可能的情感 + max_score = max(emotion_scores.values()) + if max_score == 0: + return "happy" # 默认 + + # 可能有多个情感同分,根据上下文选择最合适的 + top_emotions = [e for e, s in emotion_scores.items() if s == max_score] + + # 如果多个情感同分,使用以下优先级 + priority_order = [ + "laughing", + "crying", + "angry", + "surprised", + "shocked", # 强烈情感优先 + "loving", + "happy", + "funny", + "cool", # 积极情感 + "sad", + "embarrassed", + "confused", # 消极情感 + "thinking", + "winking", + "relaxed", # 中性情感 + "delicious", + "kissy", + "confident", + "sleepy", + "silly", # 特殊场景 + ] + + for emotion in priority_order: + if emotion in top_emotions: + return emotion + + return top_emotions[0] # 如果都不在优先级列表里,返回第一个 + + +def audio_to_data(audio_file_path, is_opus=True): + # 获取文件后缀名 + file_type = os.path.splitext(audio_file_path)[1] + if file_type: + file_type = file_type.lstrip(".") + # 读取音频文件,-nostdin 参数:不要从标准输入读取数据,否则FFmpeg会阻塞 + audio = AudioSegment.from_file( + audio_file_path, format=file_type, parameters=["-nostdin"] + ) + + # 转换为单声道/16kHz采样率/16位小端编码(确保与编码器匹配) + audio = audio.set_channels(1).set_frame_rate(16000).set_sample_width(2) + + # 音频时长(秒) + duration = len(audio) / 1000.0 + + # 获取原始PCM数据(16位小端) + raw_data = audio.raw_data + + # 初始化Opus编码器 + encoder = opuslib_next.Encoder(16000, 1, opuslib_next.APPLICATION_AUDIO) + + # 编码参数 + frame_duration = 60 # 60ms per frame + frame_size = int(16000 * frame_duration / 1000) # 960 samples/frame + + datas = [] + # 按帧处理所有音频数据(包括最后一帧可能补零) + for i in range(0, len(raw_data), frame_size * 2): # 16bit=2bytes/sample + # 获取当前帧的二进制数据 + chunk = raw_data[i : i + frame_size * 2] + + # 如果最后一帧不足,补零 + if len(chunk) < frame_size * 2: + chunk += b"\x00" * (frame_size * 2 - len(chunk)) + + if is_opus: + # 转换为numpy数组处理 + np_frame = np.frombuffer(chunk, dtype=np.int16) + # 编码Opus数据 + frame_data = encoder.encode(np_frame.tobytes(), frame_size) + else: + frame_data = chunk if isinstance(chunk, bytes) else bytes(chunk) + + datas.append(frame_data) + + return datas, duration + + +def check_vad_update(before_config, new_config): + if ( + new_config.get("selected_module") is None + or new_config["selected_module"].get("VAD") is None + ): + return False + update_vad = False + current_vad_module = before_config["selected_module"]["VAD"] + new_vad_module = new_config["selected_module"]["VAD"] + current_vad_type = ( + current_vad_module + if "type" not in before_config["VAD"][current_vad_module] + else before_config["VAD"][current_vad_module]["type"] + ) + new_vad_type = ( + new_vad_module + if "type" not in new_config["VAD"][new_vad_module] + else new_config["VAD"][new_vad_module]["type"] + ) + print(f"前vad:{current_vad_type},后vad:{new_vad_type}") + update_vad = current_vad_type != new_vad_type + return update_vad + + +def check_asr_update(before_config, new_config): + if ( + new_config.get("selected_module") is None + or new_config["selected_module"].get("ASR") is None + ): + return False + update_asr = False + current_asr_module = before_config["selected_module"]["ASR"] + new_asr_module = new_config["selected_module"]["ASR"] + current_asr_type = ( + current_asr_module + if "type" not in before_config["ASR"][current_asr_module] + else before_config["ASR"][current_asr_module]["type"] + ) + new_asr_type = ( + new_asr_module + if "type" not in new_config["ASR"][new_asr_module] + else new_config["ASR"][new_asr_module]["type"] + ) + print(f"前asr:{current_asr_type},后asr:{new_asr_type}") + update_asr = current_asr_type != new_asr_type + return update_asr diff --git a/main/xiaozhi-server/core/utils/vad.py b/main/xiaozhi-server/core/utils/vad.py index ef782281c..b1dd1faf8 100644 --- a/main/xiaozhi-server/core/utils/vad.py +++ b/main/xiaozhi-server/core/utils/vad.py @@ -1,77 +1,19 @@ -from abc import ABC, abstractmethod +import importlib +import os +import sys +from core.providers.vad.base import VADProviderBase from config.logger import setup_logging -import opuslib_next -import time -import numpy as np -import torch TAG = __name__ logger = setup_logging() -class VAD(ABC): - @abstractmethod - def is_vad(self, conn, data): - """检测音频数据中的语音活动""" - pass +def create_instance(class_name: str, *args, **kwargs) -> VADProviderBase: + """工厂方法创建VAD实例""" + if os.path.exists(os.path.join("core", "providers", "vad", f"{class_name}.py")): + lib_name = f"core.providers.vad.{class_name}" + if lib_name not in sys.modules: + sys.modules[lib_name] = importlib.import_module(f"{lib_name}") + return sys.modules[lib_name].VADProvider(*args, **kwargs) -class SileroVAD(VAD): - def __init__(self, config): - logger.bind(tag=TAG).info("SileroVAD", config) - self.model, self.utils = torch.hub.load(repo_or_dir=config["model_dir"], - source='local', - model='silero_vad', - force_reload=False) - (get_speech_timestamps, _, _, _, _) = self.utils - - self.decoder = opuslib_next.Decoder(16000, 1) - self.vad_threshold = config.get("threshold") - self.silence_threshold_ms = config.get("min_silence_duration_ms") - - def is_vad(self, conn, opus_packet): - try: - pcm_frame = self.decoder.decode(opus_packet, 960) - conn.client_audio_buffer += pcm_frame # 将新数据加入缓冲区 - - # 处理缓冲区中的完整帧(每次处理512采样点) - client_have_voice = False - while len(conn.client_audio_buffer) >= 512 * 2: - # 提取前512个采样点(1024字节) - chunk = conn.client_audio_buffer[:512 * 2] - conn.client_audio_buffer = conn.client_audio_buffer[512 * 2:] - - # 转换为模型需要的张量格式 - audio_int16 = np.frombuffer(chunk, dtype=np.int16) - audio_float32 = audio_int16.astype(np.float32) / 32768.0 - audio_tensor = torch.from_numpy(audio_float32) - - # 检测语音活动 - speech_prob = self.model(audio_tensor, 16000).item() - client_have_voice = speech_prob >= self.vad_threshold - - # 如果之前有声音,但本次没有声音,且与上次有声音的时间查已经超过了静默阈值,则认为已经说完一句话 - if conn.client_have_voice and not client_have_voice: - stop_duration = time.time() * 1000 - conn.client_have_voice_last_time - if stop_duration >= self.silence_threshold_ms: - conn.client_voice_stop = True - if client_have_voice: - conn.client_have_voice = True - conn.client_have_voice_last_time = time.time() * 1000 - - return client_have_voice - except opuslib_next.OpusError as e: - logger.bind(tag=TAG).info(f"解码错误: {e}") - except Exception as e: - logger.bind(tag=TAG).error(f"Error processing audio packet: {e}") - - -def create_instance(class_name, *args, **kwargs) -> VAD: - # 获取类对象 - cls_map = { - "SileroVAD": SileroVAD, - # 可扩展其他SileroVAD实现 - } - - if cls := cls_map.get(class_name): - return cls(*args, **kwargs) - raise ValueError(f"不支持的SileroVAD类型: {class_name}") + raise ValueError(f"不支持的VAD类型: {class_name},请检查该配置的type是否设置正确") diff --git a/main/xiaozhi-server/core/websocket_server.py b/main/xiaozhi-server/core/websocket_server.py index 6aa9a06d8..441fd4e11 100644 --- a/main/xiaozhi-server/core/websocket_server.py +++ b/main/xiaozhi-server/core/websocket_server.py @@ -2,8 +2,8 @@ import asyncio import websockets from config.logger import setup_logging from core.connection import ConnectionHandler -from core.utils.util import get_local_ip -from core.utils import asr, vad, llm, tts, memory, intent +from core.utils.util import initialize_modules, check_vad_update, check_asr_update +from config.config_loader import get_config_from_api TAG = __name__ @@ -12,73 +12,110 @@ class WebSocketServer: def __init__(self, config: dict): self.config = config self.logger = setup_logging() - self._vad, self._asr, self._llm, self._tts, self._memory, self.intent = self._create_processing_instances() - self.active_connections = set() # 添加全局连接记录 - - def _create_processing_instances(self): - memory_cls_name = self.config["selected_module"].get("Memory", "nomem") # 默认使用nomem - has_memory_cfg = self.config.get("Memory") and memory_cls_name in self.config["Memory"] - memory_cfg = self.config["Memory"][memory_cls_name] if has_memory_cfg else {} - - """创建处理模块实例""" - return ( - vad.create_instance( - self.config["selected_module"]["VAD"], - self.config["VAD"][self.config["selected_module"]["VAD"]] - ), - asr.create_instance( - self.config["selected_module"]["ASR"] - if not 'type' in self.config["ASR"][self.config["selected_module"]["ASR"]] - else - self.config["ASR"][self.config["selected_module"]["ASR"]]["type"], - self.config["ASR"][self.config["selected_module"]["ASR"]], - self.config["delete_audio"] - ), - llm.create_instance( - self.config["selected_module"]["LLM"] - if not 'type' in self.config["LLM"][self.config["selected_module"]["LLM"]] - else - self.config["LLM"][self.config["selected_module"]["LLM"]]['type'], - self.config["LLM"][self.config["selected_module"]["LLM"]], - ), - tts.create_instance( - self.config["selected_module"]["TTS"] - if not 'type' in self.config["TTS"][self.config["selected_module"]["TTS"]] - else - self.config["TTS"][self.config["selected_module"]["TTS"]]["type"], - self.config["TTS"][self.config["selected_module"]["TTS"]], - self.config["delete_audio"] - ), - memory.create_instance(memory_cls_name, memory_cfg), - intent.create_instance( - self.config["selected_module"]["Intent"] - if not 'type' in self.config["Intent"][self.config["selected_module"]["Intent"]] - else - self.config["Intent"][self.config["selected_module"]["Intent"]]["type"], - self.config["Intent"][self.config["selected_module"]["Intent"]] - ), + self.config_lock = asyncio.Lock() + modules = initialize_modules( + self.logger, + self.config, + "VAD" in self.config["selected_module"], + "ASR" in self.config["selected_module"], + "LLM" in self.config["selected_module"], + "TTS" in self.config["selected_module"], + "Memory" in self.config["selected_module"], + "Intent" in self.config["selected_module"], ) + self._vad = modules["vad"] if "vad" in modules else None + self._asr = modules["asr"] if "asr" in modules else None + self._tts = modules["tts"] if "tts" in modules else None + self._llm = modules["llm"] if "llm" in modules else None + self._intent = modules["intent"] if "intent" in modules else None + self._memory = modules["memory"] if "memory" in modules else None + self.active_connections = set() async def start(self): server_config = self.config["server"] - host = server_config["ip"] - port = server_config["port"] + host = server_config.get("ip", "0.0.0.0") + port = int(server_config.get("port", 8000)) - self.logger.bind(tag=TAG).info("Server is running at ws://{}:{}", get_local_ip(), port) - self.logger.bind(tag=TAG).info("=======上面的地址是websocket协议地址,请勿用浏览器访问=======") async with websockets.serve( - self._handle_connection, - host, - port + self._handle_connection, host, port, process_request=self._http_response ): await asyncio.Future() async def _handle_connection(self, websocket): """处理新连接,每次创建独立的ConnectionHandler""" # 创建ConnectionHandler时传入当前server实例 - handler = ConnectionHandler(self.config, self._vad, self._asr, self._llm, self._tts, self._memory, self.intent) + handler = ConnectionHandler( + self.config, + self._vad, + self._asr, + self._llm, + self._tts, + self._memory, + self._intent, + self, # 传入server实例 + ) self.active_connections.add(handler) try: await handler.handle_connection(websocket) finally: self.active_connections.discard(handler) + + async def _http_response(self, websocket, request_headers): + # 检查是否为 WebSocket 升级请求 + if request_headers.headers.get("connection", "").lower() == "upgrade": + # 如果是 WebSocket 请求,返回 None 允许握手继续 + return None + else: + # 如果是普通 HTTP 请求,返回 "server is running" + return websocket.respond(200, "Server is running\n") + + async def update_config(self) -> bool: + """更新服务器配置并重新初始化组件 + + Returns: + bool: 更新是否成功 + """ + try: + async with self.config_lock: + # 重新获取配置 + new_config = get_config_from_api(self.config) + if new_config is None: + self.logger.bind(tag=TAG).error("获取新配置失败") + return False + + # 检查 VAD 和 ASR 类型是否需要更新 + update_vad = check_vad_update(self.config, new_config) + update_asr = check_asr_update(self.config, new_config) + + # 更新配置 + self.config = new_config + # 重新初始化组件 + modules = initialize_modules( + self.logger, + new_config, + update_vad, + update_asr, + "LLM" in new_config["selected_module"], + "TTS" in new_config["selected_module"], + "Memory" in new_config["selected_module"], + "Intent" in new_config["selected_module"], + ) + + # 更新组件实例 + if "vad" in modules: + self._vad = modules["vad"] + if "asr" in modules: + self._asr = modules["asr"] + if "tts" in modules: + self._tts = modules["tts"] + if "llm" in modules: + self._llm = modules["llm"] + if "intent" in modules: + self._intent = modules["intent"] + if "memory" in modules: + self._memory = modules["memory"] + + return True + except Exception as e: + self.logger.bind(tag=TAG).error(f"更新服务器配置失败: {str(e)}") + return False diff --git a/main/xiaozhi-server/docker-compose.yml b/main/xiaozhi-server/docker-compose.yml index c22e75457..f66f9eeaa 100644 --- a/main/xiaozhi-server/docker-compose.yml +++ b/main/xiaozhi-server/docker-compose.yml @@ -1,8 +1,5 @@ -# 如果本机已经安装了MySQL,可以直接在数据库中创建名为`xiaozhi_esp32_server`的数据库。 -# 如果还没有MySQL,你可以通过docker安装mysql,执行以下一句话 -# docker run --name xiaozhi-esp32-server-db -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -e MYSQL_DATABASE=xiaozhi_esp32_server -e MYSQL_INITDB_ARGS="--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci" -d mysql:latest -# 如果你的mysql账号和密码有修改过,记得修改下方数据库的账号和密码 -# 记得修改下方数据库的IP,ip不能写127.0.0.1或localhost,否则容器无法访问,要写你电脑局域网ip +# Docker安装Server + version: '3' services: xiaozhi-esp32-server: @@ -16,24 +13,10 @@ services: ports: # ws服务端 - "8000:8000" + # ota服务端 + - "8002:8002" volumes: # 配置文件目录 - ./data:/opt/xiaozhi-esp32-server/data # 模型文件挂接,很重要 - - ./models/SenseVoiceSmall/model.pt:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall/model.pt - -# #智控台还没开发好,还不能完全使用,会报很多错误,如果是非技术人员,请不要启用智控台服务 -# xiaozhi-esp32-server-web: -# image: ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:web_latest -# container_name: xiaozhi-esp32-server-web -# restart: always -# ports: -# - "8002:8002" -# environment: -# - TZ=Asia/Shanghai -# ##记得改mysql和redis IP 密码 -# - SPRING_DATASOURCE_DRUID_URL=jdbc:mysql://192.168.1.20:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai -# - SPRING_DATASOURCE_DRUID_USERNAME=root -# - SPRING_DATASOURCE_DRUID_PASSWORD=123456 -# - SPRING_DATA_REDIS_HOST=192.168.1.20 -# - SPRING_DATA_REDIS_PORT=6379 + - ./models/SenseVoiceSmall/model.pt:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall/model.pt \ No newline at end of file diff --git a/main/xiaozhi-server/docker-compose_all.yml b/main/xiaozhi-server/docker-compose_all.yml new file mode 100644 index 000000000..b62188d93 --- /dev/null +++ b/main/xiaozhi-server/docker-compose_all.yml @@ -0,0 +1,87 @@ +# Docker安装全模块 + +version: '3' +services: + # Server模块 + xiaozhi-esp32-server: + image: ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest + container_name: xiaozhi-esp32-server + depends_on: + - xiaozhi-esp32-server-db + - xiaozhi-esp32-server-redis + restart: always + networks: + - default + ports: + # ws服务端 + - "8000:8000" + security_opt: + - seccomp:unconfined + environment: + - TZ=Asia/Shanghai + volumes: + # 配置文件目录 + - ./data:/opt/xiaozhi-esp32-server/data + # 模型文件挂接,很重要 + - ./models/SenseVoiceSmall/model.pt:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall/model.pt + + # manager-api和manager-web模块 + xiaozhi-esp32-server-web: + image: ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:web_latest + container_name: xiaozhi-esp32-server-web + restart: always + networks: + - default + depends_on: + xiaozhi-esp32-server-db: + condition: service_healthy + xiaozhi-esp32-server-redis: + condition: service_healthy + ports: + # 智控台 + - "8002:8002" + environment: + - TZ=Asia/Shanghai + - SPRING_DATASOURCE_DRUID_URL=jdbc:mysql://xiaozhi-esp32-server-db:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&connectTimeout=30000&socketTimeout=30000&autoReconnect=true&failOverReadOnly=false&maxReconnects=10 + - SPRING_DATASOURCE_DRUID_USERNAME=root + - SPRING_DATASOURCE_DRUID_PASSWORD=123456 + - SPRING_DATA_REDIS_HOST=xiaozhi-esp32-server-redis + - SPRING_DATA_REDIS_PORT=6379 + volumes: + # 配置文件目录 + - ./uploadfile:/uploadfile + + xiaozhi-esp32-server-db: + image: mysql:latest + container_name: xiaozhi-esp32-server-db + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + timeout: 45s + interval: 10s + retries: 10 + restart: always + networks: + - default + expose: + - 3306 + volumes: + - ./mysql/data:/var/lib/mysql + environment: + - TZ=Asia/Shanghai + - MYSQL_ROOT_PASSWORD=123456 + - MYSQL_DATABASE=xiaozhi_esp32_server + - MYSQL_INITDB_ARGS="--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci" + xiaozhi-esp32-server-redis: + image: redis + expose: + - 6379 + container_name: xiaozhi-esp32-server-redis + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 3 + networks: + - default +networks: + default: diff --git a/main/xiaozhi-server/mcp_server_settings.json b/main/xiaozhi-server/mcp_server_settings.json new file mode 100644 index 000000000..dc173f37d --- /dev/null +++ b/main/xiaozhi-server/mcp_server_settings.json @@ -0,0 +1,32 @@ +{ + "des": [ + "在data目录下创建.mcp_server_settings.json文件,可以选择下面的MCP服务,也可以自行添加新的MCP服务。", + "后面不断测试补充好用的mcp服务,欢迎大家一起补充。", + "记得删除注释行,des属性仅为说明,不会被解析。", + "des和link属性,仅为说明安装方式,方便大家查看原始链接,不是必须项。", + "当前支持stdio/sse两种模式。" + ], + "mcpServers": { + "filesystem": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-filesystem", + "/Users/username/Desktop", + "/path/to/other/allowed/dir" + ], + "link":"https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem" + }, + "playwright": { + "command": "npx", + "args": ["-y", "@executeautomation/playwright-mcp-server"], + "des" : "run 'npx playwright install' first", + "link": "https://github.com/executeautomation/mcp-playwright" + }, + "windows-cli": { + "command": "npx", + "args": ["-y", "@simonb97/server-win-cli"], + "link": "https://github.com/SimonB97/win-cli-mcp-server" + } + } +} diff --git a/main/xiaozhi-server/performance_tester.py b/main/xiaozhi-server/performance_tester.py index 8bae2df09..38daea009 100644 --- a/main/xiaozhi-server/performance_tester.py +++ b/main/xiaozhi-server/performance_tester.py @@ -5,9 +5,8 @@ from tabulate import tabulate from typing import Dict, List from core.utils.llm import create_instance as create_llm_instance from core.utils.tts import create_instance as create_tts_instance -from core.utils.util import read_config import statistics -from config.settings import get_config_file +from config.settings import load_config import inspect import os import logging @@ -18,17 +17,16 @@ logging.basicConfig(level=logging.WARNING) class AsyncPerformanceTester: def __init__(self): - self.config = read_config(get_config_file()) + self.config = load_config() self.test_sentences = self.config.get("module_test", {}).get( "test_sentences", - ["你好,请介绍一下你自己", "What's the weather like today?", - "请用100字概括量子计算的基本原理和应用前景"] + [ + "你好,请介绍一下你自己", + "What's the weather like today?", + "请用100字概括量子计算的基本原理和应用前景", + ], ) - self.results = { - "llm": {}, - "tts": {}, - "combinations": [] - } + self.results = {"llm": {}, "tts": {}, "combinations": []} async def _check_ollama_service(self, base_url: str, model_name: str) -> bool: """异步检查Ollama服务状态""" @@ -46,7 +44,9 @@ class AsyncPerformanceTester: data = await response.json() models = data.get("models", []) if not any(model["name"] == model_name for model in models): - print(f"🚫 Ollama模型 {model_name} 未找到,请先使用 ollama pull {model_name} 下载") + print( + f"🚫 Ollama模型 {model_name} 未找到,请先使用 ollama pull {model_name} 下载" + ) return False else: print(f"🚫 无法获取Ollama模型列表") @@ -62,17 +62,16 @@ class AsyncPerformanceTester: logging.getLogger("core.providers.tts.base").setLevel(logging.WARNING) token_fields = ["access_token", "api_key", "token"] - if any(field in config and any(x in config[field] for x in ["你的", "placeholder"]) for field in - token_fields): + if any( + field in config + and any(x in config[field] for x in ["你的", "placeholder"]) + for field in token_fields + ): print(f"⏭️ TTS {tts_name} 未配置access_token/api_key,已跳过") return {"name": tts_name, "type": "tts", "errors": 1} - module_type = config.get('type', tts_name) - tts = create_tts_instance( - module_type, - config, - delete_audio_file=True - ) + module_type = config.get("type", tts_name) + tts = create_tts_instance(module_type, config, delete_audio_file=True) print(f"🎵 测试 TTS: {tts_name}") @@ -103,7 +102,7 @@ class AsyncPerformanceTester: "name": tts_name, "type": "tts", "avg_time": total_time / test_count, - "errors": 0 + "errors": 0, } except Exception as e: @@ -115,8 +114,8 @@ class AsyncPerformanceTester: try: # 对于Ollama,跳过api_key检查并进行特殊处理 if llm_name == "Ollama": - base_url = config.get('base_url', 'http://localhost:11434') - model_name = config.get('model_name') + base_url = config.get("base_url", "http://localhost:11434") + model_name = config.get("model_name") if not model_name: print(f"🚫 Ollama未配置model_name") return {"name": llm_name, "type": "llm", "errors": 1} @@ -124,21 +123,27 @@ class AsyncPerformanceTester: if not await self._check_ollama_service(base_url, model_name): return {"name": llm_name, "type": "llm", "errors": 1} else: - if "api_key" in config and any(x in config["api_key"] for x in ["你的", "placeholder", "sk-xxx"]): + if "api_key" in config and any( + x in config["api_key"] for x in ["你的", "placeholder", "sk-xxx"] + ): print(f"🚫 跳过未配置的LLM: {llm_name}") return {"name": llm_name, "type": "llm", "errors": 1} # 获取实际类型(兼容旧配置) - module_type = config.get('type', llm_name) + module_type = config.get("type", llm_name) llm = create_llm_instance(module_type, config) # 统一使用UTF-8编码 - test_sentences = [s.encode('utf-8').decode('utf-8') for s in self.test_sentences] + test_sentences = [ + s.encode("utf-8").decode("utf-8") for s in self.test_sentences + ] # 创建所有句子的测试任务 sentence_tasks = [] for sentence in test_sentences: - sentence_tasks.append(self._test_single_sentence(llm_name, llm, sentence)) + sentence_tasks.append( + self._test_single_sentence(llm_name, llm, sentence) + ) # 并发执行所有句子测试 sentence_results = await asyncio.gather(*sentence_tasks) @@ -166,9 +171,15 @@ class AsyncPerformanceTester: "type": "llm", "avg_response": sum(response_times) / len(response_times), "avg_first_token": sum(first_token_times) / len(first_token_times), - "std_first_token": statistics.stdev(first_token_times) if len(first_token_times) > 1 else 0, - "std_response": statistics.stdev(response_times) if len(response_times) > 1 else 0, - "errors": 0 + "std_first_token": ( + statistics.stdev(first_token_times) + if len(first_token_times) > 1 + else 0 + ), + "std_response": ( + statistics.stdev(response_times) if len(response_times) > 1 else 0 + ), + "errors": 0, } except Exception as e: print(f"LLM {llm_name} 测试失败: {str(e)}") @@ -184,8 +195,10 @@ class AsyncPerformanceTester: async def process_response(): nonlocal first_token_received, first_token_time - for chunk in llm.response("perf_test", [{"role": "user", "content": sentence}]): - if not first_token_received and chunk.strip() != '': + for chunk in llm.response( + "perf_test", [{"role": "user", "content": sentence}] + ): + if not first_token_received and chunk.strip() != "": first_token_time = time.time() - sentence_start first_token_received = True print(f"✓ {llm_name} 首个Token: {first_token_time:.3f}s") @@ -199,13 +212,15 @@ class AsyncPerformanceTester: print(f"✓ {llm_name} 完成响应: {response_time:.3f}s") if first_token_time is None: - first_token_time = response_time # 如果没有检测到first token,使用总响应时间 + first_token_time = ( + response_time # 如果没有检测到first token,使用总响应时间 + ) return { "name": llm_name, "type": "llm", "first_token_time": first_token_time, - "response_time": response_time + "response_time": response_time, } except Exception as e: print(f"⚠️ {llm_name} 句子测试失败: {str(e)}") @@ -214,24 +229,37 @@ class AsyncPerformanceTester: def _generate_combinations(self): """生成最佳组合建议""" valid_llms = [ - k for k, v in self.results["llm"].items() + k + for k, v in self.results["llm"].items() if v["errors"] == 0 and v["avg_first_token"] >= 0.05 ] valid_tts = [k for k, v in self.results["tts"].items() if v["errors"] == 0] # 找出基准值 - min_first_token = min([self.results["llm"][llm]["avg_first_token"] for llm in valid_llms]) if valid_llms else 1 - min_tts_time = min([self.results["tts"][tts]["avg_time"] for tts in valid_tts]) if valid_tts else 1 + min_first_token = ( + min([self.results["llm"][llm]["avg_first_token"] for llm in valid_llms]) + if valid_llms + else 1 + ) + min_tts_time = ( + min([self.results["tts"][tts]["avg_time"] for tts in valid_tts]) + if valid_tts + else 1 + ) for llm in valid_llms: for tts in valid_tts: # 计算相对性能分数(越小越好) - llm_score = self.results["llm"][llm]["avg_first_token"] / min_first_token + llm_score = ( + self.results["llm"][llm]["avg_first_token"] / min_first_token + ) tts_score = self.results["tts"][tts]["avg_time"] / min_tts_time # 计算稳定性分数(标准差/平均值,越小越稳定) - llm_stability = self.results["llm"][llm]["std_first_token"] / self.results["llm"][llm][ - "avg_first_token"] + llm_stability = ( + self.results["llm"][llm]["std_first_token"] + / self.results["llm"][llm]["avg_first_token"] + ) # 综合得分(考虑性能和稳定性) # 性能权重0.7,稳定性权重0.3 @@ -240,16 +268,20 @@ class AsyncPerformanceTester: # 总分 = LLM得分(70%) + TTS得分(30%) total_score = llm_final_score * 0.7 + tts_score * 0.3 - self.results["combinations"].append({ - "llm": llm, - "tts": tts, - "score": total_score, - "details": { - "llm_first_token": self.results["llm"][llm]["avg_first_token"], - "llm_stability": llm_stability, - "tts_time": self.results["tts"][tts]["avg_time"] + self.results["combinations"].append( + { + "llm": llm, + "tts": tts, + "score": total_score, + "details": { + "llm_first_token": self.results["llm"][llm][ + "avg_first_token" + ], + "llm_stability": llm_stability, + "tts_time": self.results["tts"][tts]["avg_time"], + }, } - }) + ) # 分数越小越好 self.results["combinations"].sort(key=lambda x: x["score"]) @@ -260,42 +292,45 @@ class AsyncPerformanceTester: for name, data in self.results["llm"].items(): if data["errors"] == 0: stability = data["std_first_token"] / data["avg_first_token"] - llm_table.append([ - name, # 不需要固定宽度,让tabulate自己处理对齐 - f"{data['avg_first_token']:.3f}秒", - f"{data['avg_response']:.3f}秒", - f"{stability:.3f}" - ]) + llm_table.append( + [ + name, # 不需要固定宽度,让tabulate自己处理对齐 + f"{data['avg_first_token']:.3f}秒", + f"{data['avg_response']:.3f}秒", + f"{stability:.3f}", + ] + ) if llm_table: print("\nLLM 性能排行:") - print(tabulate( - llm_table, - headers=["模型名称", "首字耗时", "总耗时", "稳定性"], - tablefmt="github", - colalign=("left", "right", "right", "right"), - disable_numparse=True - )) + print( + tabulate( + llm_table, + headers=["模型名称", "首字耗时", "总耗时", "稳定性"], + tablefmt="github", + colalign=("left", "right", "right", "right"), + disable_numparse=True, + ) + ) else: print("\n⚠️ 没有可用的LLM模块进行测试。") tts_table = [] for name, data in self.results["tts"].items(): if data["errors"] == 0: - tts_table.append([ - name, # 不需要固定宽度 - f"{data['avg_time']:.3f}秒" - ]) + tts_table.append([name, f"{data['avg_time']:.3f}秒"]) # 不需要固定宽度 if tts_table: print("\nTTS 性能排行:") - print(tabulate( - tts_table, - headers=["模型名称", "合成耗时"], - tablefmt="github", - colalign=("left", "right"), - disable_numparse=True - )) + print( + tabulate( + tts_table, + headers=["模型名称", "合成耗时"], + tablefmt="github", + colalign=("left", "right"), + disable_numparse=True, + ) + ) else: print("\n⚠️ 没有可用的TTS模块进行测试。") @@ -303,21 +338,31 @@ class AsyncPerformanceTester: print("\n推荐配置组合 (得分越小越好):") combo_table = [] for combo in self.results["combinations"][:5]: - combo_table.append([ - f"{combo['llm']} + {combo['tts']}", # 不需要固定宽度 - f"{combo['score']:.3f}", - f"{combo['details']['llm_first_token']:.3f}秒", - f"{combo['details']['llm_stability']:.3f}", - f"{combo['details']['tts_time']:.3f}秒" - ]) + combo_table.append( + [ + f"{combo['llm']} + {combo['tts']}", # 不需要固定宽度 + f"{combo['score']:.3f}", + f"{combo['details']['llm_first_token']:.3f}秒", + f"{combo['details']['llm_stability']:.3f}", + f"{combo['details']['tts_time']:.3f}秒", + ] + ) - print(tabulate( - combo_table, - headers=["组合方案", "综合得分", "LLM首字耗时", "稳定性", "TTS合成耗时"], - tablefmt="github", - colalign=("left", "right", "right", "right", "right"), - disable_numparse=True - )) + print( + tabulate( + combo_table, + headers=[ + "组合方案", + "综合得分", + "LLM首字耗时", + "稳定性", + "TTS合成耗时", + ], + tablefmt="github", + colalign=("left", "right", "right", "right", "right"), + disable_numparse=True, + ) + ) else: print("\n⚠️ 没有可用的模块组合建议。") @@ -341,18 +386,21 @@ class AsyncPerformanceTester: for llm_name, config in self.config.get("LLM", {}).items(): # 检查配置有效性 if llm_name == "CozeLLM": - if any(x in config.get("bot_id", "") for x in ["你的"]) \ - or any(x in config.get("user_id", "") for x in ["你的"]): + if any(x in config.get("bot_id", "") for x in ["你的"]) or any( + x in config.get("user_id", "") for x in ["你的"] + ): print(f"⏭️ LLM {llm_name} 未配置bot_id/user_id,已跳过") continue - elif "api_key" in config and any(x in config["api_key"] for x in ["你的", "placeholder", "sk-xxx"]): + elif "api_key" in config and any( + x in config["api_key"] for x in ["你的", "placeholder", "sk-xxx"] + ): print(f"⏭️ LLM {llm_name} 未配置api_key,已跳过") continue # 对于Ollama,先检查服务状态 if llm_name == "Ollama": - base_url = config.get('base_url', 'http://localhost:11434') - model_name = config.get('model_name') + base_url = config.get("base_url", "http://localhost:11434") + model_name = config.get("model_name") if not model_name: print(f"🚫 Ollama未配置model_name") continue @@ -361,27 +409,33 @@ class AsyncPerformanceTester: continue print(f"📋 添加LLM测试任务: {llm_name}") - module_type = config.get('type', llm_name) + module_type = config.get("type", llm_name) llm = create_llm_instance(module_type, config) # 为每个句子创建独立任务 for sentence in self.test_sentences: - sentence = sentence.encode('utf-8').decode('utf-8') + sentence = sentence.encode("utf-8").decode("utf-8") all_tasks.append(self._test_single_sentence(llm_name, llm, sentence)) # TTS测试任务 for tts_name, config in self.config.get("TTS", {}).items(): token_fields = ["access_token", "api_key", "token"] - if any(field in config and any(x in config[field] for x in ["你的", "placeholder"]) for field in - token_fields): + if any( + field in config + and any(x in config[field] for x in ["你的", "placeholder"]) + for field in token_fields + ): print(f"⏭️ TTS {tts_name} 未配置access_token/api_key,已跳过") continue print(f"🎵 添加TTS测试任务: {tts_name}") all_tasks.append(self._test_tts(tts_name, config)) print( - f"\n✅ 找到 {len([t for t in all_tasks if 'test_single_sentence' in str(t)]) / len(self.test_sentences):.0f} 个可用LLM模块") - print(f"✅ 找到 {len([t for t in all_tasks if '_test_tts' in str(t)])} 个可用TTS模块") + f"\n✅ 找到 {len([t for t in all_tasks if 'test_single_sentence' in str(t)]) / len(self.test_sentences):.0f} 个可用LLM模块" + ) + print( + f"✅ 找到 {len([t for t in all_tasks if '_test_tts' in str(t)])} 个可用TTS模块" + ) print("\n⏳ 开始并发测试所有模块...\n") # 并发执行所有测试任务 @@ -389,7 +443,11 @@ class AsyncPerformanceTester: # 处理LLM结果 llm_results = {} - for result in [r for r in all_results if r and isinstance(r, dict) and r.get("type") == "llm"]: + for result in [ + r + for r in all_results + if r and isinstance(r, dict) and r.get("type") == "llm" + ]: llm_name = result["name"] if llm_name not in llm_results: llm_results[llm_name] = { @@ -397,9 +455,11 @@ class AsyncPerformanceTester: "type": "llm", "first_token_times": [], "response_times": [], - "errors": 0 + "errors": 0, } - llm_results[llm_name]["first_token_times"].append(result["first_token_time"]) + llm_results[llm_name]["first_token_times"].append( + result["first_token_time"] + ) llm_results[llm_name]["response_times"].append(result["response_time"]) # 计算LLM平均值和标准差 @@ -408,16 +468,29 @@ class AsyncPerformanceTester: self.results["llm"][llm_name] = { "name": llm_name, "type": "llm", - "avg_response": sum(data["response_times"]) / len(data["response_times"]), - "avg_first_token": sum(data["first_token_times"]) / len(data["first_token_times"]), - "std_first_token": statistics.stdev(data["first_token_times"]) if len( - data["first_token_times"]) > 1 else 0, - "std_response": statistics.stdev(data["response_times"]) if len(data["response_times"]) > 1 else 0, - "errors": 0 + "avg_response": sum(data["response_times"]) + / len(data["response_times"]), + "avg_first_token": sum(data["first_token_times"]) + / len(data["first_token_times"]), + "std_first_token": ( + statistics.stdev(data["first_token_times"]) + if len(data["first_token_times"]) > 1 + else 0 + ), + "std_response": ( + statistics.stdev(data["response_times"]) + if len(data["response_times"]) > 1 + else 0 + ), + "errors": 0, } # 处理TTS结果 - for result in [r for r in all_results if r and isinstance(r, dict) and r.get("type") == "tts"]: + for result in [ + r + for r in all_results + if r and isinstance(r, dict) and r.get("type") == "tts" + ]: if result["errors"] == 0: self.results["tts"][result["name"]] = result @@ -433,4 +506,4 @@ async def main(): if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + asyncio.run(main()) diff --git a/main/xiaozhi-server/plugins_func/functions/get_news.py b/main/xiaozhi-server/plugins_func/functions/get_news.py index 43f8ea48a..85b203dc7 100644 --- a/main/xiaozhi-server/plugins_func/functions/get_news.py +++ b/main/xiaozhi-server/plugins_func/functions/get_news.py @@ -45,10 +45,10 @@ def fetch_news_from_rss(rss_url): try: response = requests.get(rss_url) response.raise_for_status() - + # 解析XML root = ET.fromstring(response.content) - + # 查找所有item元素(新闻条目) news_items = [] for item in root.findall('.//item'): @@ -56,14 +56,14 @@ def fetch_news_from_rss(rss_url): link = item.find('link').text if item.find('link') is not None else "#" description = item.find('description').text if item.find('description') is not None else "无描述" pubDate = item.find('pubDate').text if item.find('pubDate') is not None else "未知时间" - + news_items.append({ 'title': title, 'link': link, 'description': description, 'pubDate': pubDate }) - + return news_items except Exception as e: logger.bind(tag=TAG).error(f"获取RSS新闻失败: {e}") @@ -75,9 +75,9 @@ def fetch_news_detail(url): try: response = requests.get(url) response.raise_for_status() - + soup = BeautifulSoup(response.content, 'html.parser') - + # 尝试提取正文内容 (这里的选择器需要根据实际网站结构调整) content_div = soup.select_one('.content_desc, .content, article, .article-content') if content_div: @@ -98,7 +98,7 @@ def map_category(category_text): """将用户输入的中文类别映射到配置文件中的类别键""" if not category_text: return None - + # 类别映射字典,目前支持社会、国际、财经新闻,如需更多类型,参见配置文件 category_map = { # 社会新闻 @@ -113,10 +113,10 @@ def map_category(category_text): "金融": "finance", "经济": "finance" } - + # 转换为小写并去除空格 normalized_category = category_text.lower().strip() - + # 返回映射结果,如果没有匹配项则返回原始输入 return category_map.get(normalized_category, category_text) @@ -129,21 +129,22 @@ def get_news(conn, category: str = None, detail: bool = False, lang: str = "zh_C if detail: if not hasattr(conn, 'last_news_link') or not conn.last_news_link or 'link' not in conn.last_news_link: return ActionResponse(Action.REQLLM, "抱歉,没有找到最近查询的新闻,请先获取一条新闻。", None) - + link = conn.last_news_link.get('link') title = conn.last_news_link.get('title', '未知标题') - + if link == '#': return ActionResponse(Action.REQLLM, "抱歉,该新闻没有可用的链接获取详细内容。", None) - + logger.bind(tag=TAG).debug(f"获取新闻详情: {title}, URL={link}") - + # 获取新闻详情 detail_content = fetch_news_detail(link) - + if not detail_content or detail_content == "无法获取详细内容": - return ActionResponse(Action.REQLLM, f"抱歉,无法获取《{title}》的详细内容,可能是链接已失效或网站结构发生变化。", None) - + return ActionResponse(Action.REQLLM, + f"抱歉,无法获取《{title}》的详细内容,可能是链接已失效或网站结构发生变化。", None) + # 构建详情报告 detail_report = ( f"根据下列数据,用{lang}回应用户的新闻详情查询请求:\n\n" @@ -152,33 +153,33 @@ def get_news(conn, category: str = None, detail: bool = False, lang: str = "zh_C f"(请对上述新闻内容进行总结,提取关键信息,以自然、流畅的方式向用户播报," f"不要提及这是总结,就像是在讲述一个完整的新闻故事)" ) - + return ActionResponse(Action.REQLLM, detail_report, None) - + # 否则,获取新闻列表并随机选择一条 # 从配置中获取RSS URL rss_config = conn.config["plugins"]["get_news"] default_rss_url = rss_config.get("default_rss_url", "https://www.chinanews.com.cn/rss/society.xml") - + # 将用户输入的类别映射到配置中的类别键 mapped_category = map_category(category) - + # 如果提供了类别,尝试从配置中获取对应的URL rss_url = default_rss_url if mapped_category and mapped_category in rss_config.get("category_urls", {}): rss_url = rss_config["category_urls"][mapped_category] - + logger.bind(tag=TAG).info(f"获取新闻: 原始类别={category}, 映射类别={mapped_category}, URL={rss_url}") - + # 获取新闻列表 news_items = fetch_news_from_rss(rss_url) - + if not news_items: return ActionResponse(Action.REQLLM, "抱歉,未能获取到新闻信息,请稍后再试。", None) - + # 随机选择一条新闻 selected_news = random.choice(news_items) - + # 保存当前新闻链接到连接对象,以便后续查询详情 if not hasattr(conn, 'last_news_link'): conn.last_news_link = {} @@ -186,7 +187,7 @@ def get_news(conn, category: str = None, detail: bool = False, lang: str = "zh_C 'link': selected_news.get('link', '#'), 'title': selected_news.get('title', '未知标题') } - + # 构建新闻报告 news_report = ( f"根据下列数据,用{lang}回应用户的新闻查询请求:\n\n" @@ -197,9 +198,9 @@ def get_news(conn, category: str = None, detail: bool = False, lang: str = "zh_C f"直接读出新闻即可,不需要额外多余的内容。" f"如果用户询问更多详情,告知用户可以说'请详细介绍这条新闻'获取更多内容)" ) - + return ActionResponse(Action.REQLLM, news_report, None) - + except Exception as e: logger.bind(tag=TAG).error(f"获取新闻出错: {e}") return ActionResponse(Action.REQLLM, "抱歉,获取新闻时发生错误,请稍后再试。", None) \ No newline at end of file diff --git a/main/xiaozhi-server/plugins_func/functions/get_time.py b/main/xiaozhi-server/plugins_func/functions/get_time.py index 2fb4f975d..44732bbac 100644 --- a/main/xiaozhi-server/plugins_func/functions/get_time.py +++ b/main/xiaozhi-server/plugins_func/functions/get_time.py @@ -2,15 +2,28 @@ from datetime import datetime import cnlunar from plugins_func.register import register_function, ToolType, ActionResponse, Action +# 添加星期映射字典 +WEEKDAY_MAP = { + "Monday": "星期一", + "Tuesday": "星期二", + "Wednesday": "星期三", + "Thursday": "星期四", + "Friday": "星期五", + "Saturday": "星期六", + "Sunday": "星期日", +} + get_time_function_desc = { "type": "function", "function": { "name": "get_time", "description": "获取今天日期或者当前时间信息", - 'parameters': {'type': 'object', 'properties': {}, 'required': []} - } + "parameters": {"type": "object", "properties": {}, "required": []}, + }, } -@register_function('get_time', get_time_function_desc, ToolType.WAIT) + + +@register_function("get_time", get_time_function_desc, ToolType.WAIT) def get_time(): """ 获取当前的日期时间信息 @@ -18,8 +31,10 @@ def get_time(): now = datetime.now() current_time = now.strftime("%H:%M:%S") current_date = now.strftime("%Y-%m-%d") - current_weekday = now.strftime("%A") - response_text = f"当前日期: {current_date},当前时间: {current_time},星期: {current_weekday}" + current_weekday = WEEKDAY_MAP[now.strftime("%A")] + response_text = ( + f"当前日期: {current_date},当前时间: {current_time}, {current_weekday}" + ) return ActionResponse(Action.REQLLM, response_text, None) @@ -29,23 +44,25 @@ get_lunar_function_desc = { "function": { "name": "get_lunar", "description": ( - "用于获取今天的阴历/农历和黄历信息。" - "用户可以指定查询内容,如:阴历日期、天干地支、节气、生肖、星座、八字、宜忌等。" - "如果没有指定查询内容,则默认查询干支年和农历日期。" + "用于获取今天的阴历/农历和黄历信息。" + "用户可以指定查询内容,如:阴历日期、天干地支、节气、生肖、星座、八字、宜忌等。" + "如果没有指定查询内容,则默认查询干支年和农历日期。" ), "parameters": { - "type": "object", + "type": "object", "properties": { "query": { "type": "string", - "description": "要查询的内容,例如阴历日期、天干地支、节日、节气、生肖、星座、八字、宜忌等" + "description": "要查询的内容,例如阴历日期、天干地支、节日、节气、生肖、星座、八字、宜忌等", } - }, - "required": [] - } - } + }, + "required": [], + }, + }, } -@register_function('get_lunar', get_lunar_function_desc, ToolType.WAIT) + + +@register_function("get_lunar", get_lunar_function_desc, ToolType.WAIT) def get_lunar(query=None): """ 用于获取当前的阴历/农历,和天干地支、节气、生肖、星座、八字、宜忌等黄历信息 @@ -53,37 +70,69 @@ def get_lunar(query=None): now = datetime.now() current_time = now.strftime("%H:%M:%S") current_date = now.strftime("%Y-%m-%d") - current_weekday = now.strftime("%A") + current_weekday = WEEKDAY_MAP[now.strftime("%A")] # 如果 query 为 None,则使用默认文本 if query is None: query = "默认查询干支年和农历日期" response_text = f"根据以下信息回应用户的查询请求,并提供与{query}相关的信息:\n" - lunar = cnlunar.Lunar(now, godType='8char') + lunar = cnlunar.Lunar(now, godType="8char") response_text += ( - f"当前公历日期: {current_date},当前时间: {current_time},星期: {current_weekday}\n" + f"当前公历日期: {current_date},当前时间: {current_time},{current_weekday}\n" "农历信息:\n" - "%s年%s%s\n" % (lunar.lunarYearCn, lunar.lunarMonthCn[:-1], lunar.lunarDayCn) + - "干支: %s年 %s月 %s日\n" % (lunar.year8Char, lunar.month8Char, lunar.day8Char) + - "生肖: 属%s\n" % (lunar.chineseYearZodiac) + - "八字: %s\n" % (' '.join([lunar.year8Char, lunar.month8Char, lunar.day8Char, lunar.twohour8Char])) + - "今日节日: %s\n" % (",".join(filter(None, (lunar.get_legalHolidays(), lunar.get_otherHolidays(), lunar.get_otherLunarHolidays())))) + - "今日节气: %s\n" % (lunar.todaySolarTerms) + - "下一节气: %s %s年%s月%s日\n" % (lunar.nextSolarTerm, lunar.nextSolarTermYear, lunar.nextSolarTermDate[0], lunar.nextSolarTermDate[1]) + - "今年节气表: %s\n" % (', '.join([f"{term}({date[0]}月{date[1]}日)" for term, date in lunar.thisYearSolarTermsDic.items()])) + - "生肖冲煞: %s\n" % (lunar.chineseZodiacClash) + - "星座: %s\n" % (lunar.starZodiac) + - "纳音: %s\n" % lunar.get_nayin() + - "彭祖百忌: %s\n" % (lunar.get_pengTaboo(delimit=", ")) + - "值日: %s执位\n" % lunar.get_today12DayOfficer()[0] + - "值神: %s(%s)\n" % (lunar.get_today12DayOfficer()[1], lunar.get_today12DayOfficer()[2]) + - "廿八宿: %s\n" % lunar.get_the28Stars() + - "吉神方位: %s\n" % ' '.join(lunar.get_luckyGodsDirection()) + - "今日胎神: %s\n" % lunar.get_fetalGod() + - "宜: %s\n" % '、'.join(lunar.goodThing[:10]) + - "忌: %s\n" % '、'.join(lunar.badThing[:10]) + - "(默认返回干支年和农历日期;仅在要求查询宜忌信息时才返回本日宜忌)" + "%s年%s%s\n" % (lunar.lunarYearCn, lunar.lunarMonthCn[:-1], lunar.lunarDayCn) + + "干支: %s年 %s月 %s日\n" % (lunar.year8Char, lunar.month8Char, lunar.day8Char) + + "生肖: 属%s\n" % (lunar.chineseYearZodiac) + + "八字: %s\n" + % ( + " ".join( + [lunar.year8Char, lunar.month8Char, lunar.day8Char, lunar.twohour8Char] + ) + ) + + "今日节日: %s\n" + % ( + ",".join( + filter( + None, + ( + lunar.get_legalHolidays(), + lunar.get_otherHolidays(), + lunar.get_otherLunarHolidays(), + ), + ) + ) + ) + + "今日节气: %s\n" % (lunar.todaySolarTerms) + + "下一节气: %s %s年%s月%s日\n" + % ( + lunar.nextSolarTerm, + lunar.nextSolarTermYear, + lunar.nextSolarTermDate[0], + lunar.nextSolarTermDate[1], + ) + + "今年节气表: %s\n" + % ( + ", ".join( + [ + f"{term}({date[0]}月{date[1]}日)" + for term, date in lunar.thisYearSolarTermsDic.items() + ] + ) + ) + + "生肖冲煞: %s\n" % (lunar.chineseZodiacClash) + + "星座: %s\n" % (lunar.starZodiac) + + "纳音: %s\n" % lunar.get_nayin() + + "彭祖百忌: %s\n" % (lunar.get_pengTaboo(delimit=", ")) + + "值日: %s执位\n" % lunar.get_today12DayOfficer()[0] + + "值神: %s(%s)\n" + % (lunar.get_today12DayOfficer()[1], lunar.get_today12DayOfficer()[2]) + + "廿八宿: %s\n" % lunar.get_the28Stars() + + "吉神方位: %s\n" % " ".join(lunar.get_luckyGodsDirection()) + + "今日胎神: %s\n" % lunar.get_fetalGod() + + "宜: %s\n" % "、".join(lunar.goodThing[:10]) + + "忌: %s\n" % "、".join(lunar.badThing[:10]) + + "(默认返回干支年和农历日期;仅在要求查询宜忌信息时才返回本日宜忌)" ) - return ActionResponse(Action.REQLLM, response_text, None) \ No newline at end of file + return ActionResponse(Action.REQLLM, response_text, None) diff --git a/main/xiaozhi-server/plugins_func/functions/get_weather.py b/main/xiaozhi-server/plugins_func/functions/get_weather.py index 8cdd6ea16..dc7976dda 100644 --- a/main/xiaozhi-server/plugins_func/functions/get_weather.py +++ b/main/xiaozhi-server/plugins_func/functions/get_weather.py @@ -2,6 +2,7 @@ import requests from bs4 import BeautifulSoup from config.logger import setup_logging from plugins_func.register import register_function, ToolType, ActionResponse, Action +from core.utils.util import get_ip_info TAG = __name__ logger = setup_logging() @@ -12,55 +13,104 @@ GET_WEATHER_FUNCTION_DESC = { "name": "get_weather", "description": ( "获取某个地点的天气,用户应提供一个位置,比如用户说杭州天气,参数为:杭州。" - "如果用户说的是省份,默认用省会城市。如果用户说的不是省份或城市而是一个地名," - "默认用该地所在省份的省会城市。" + "如果用户说的是省份,默认用省会城市。如果用户说的不是省份或城市而是一个地名,默认用该地所在省份的省会城市。" + "如果用户没有指明地点,说“天气怎么样”,”今天天气如何“,location参数为空" ), "parameters": { "type": "object", "properties": { "location": { "type": "string", - "description": "地点名,例如杭州。可选参数,如果不提供则不传" + "description": "地点名,例如杭州。可选参数,如果不提供则不传", }, "lang": { "type": "string", - "description": "返回用户使用的语言code,例如zh_CN/zh_HK/en_US/ja_JP等,默认zh_CN" - } + "description": "返回用户使用的语言code,例如zh_CN/zh_HK/en_US/ja_JP等,默认zh_CN", + }, }, - "required": ["lang"] - } - } + "required": ["lang"], + }, + }, } HEADERS = { - 'User-Agent': ( - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' - '(KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36' + "User-Agent": ( + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + "(KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36" ) } # 天气代码 https://dev.qweather.com/docs/resource/icons/#weather-icons WEATHER_CODE_MAP = { - "100": "晴", "101": "多云", "102": "少云", "103": "晴间多云", "104": "阴", - "150": "晴", "151": "多云", "152": "少云", "153": "晴间多云", - "300": "阵雨", "301": "强阵雨", "302": "雷阵雨", "303": "强雷阵雨", "304": "雷阵雨伴有冰雹", - "305": "小雨", "306": "中雨", "307": "大雨", "308": "极端降雨", "309": "毛毛雨/细雨", - "310": "暴雨", "311": "大暴雨", "312": "特大暴雨", "313": "冻雨", "314": "小到中雨", - "315": "中到大雨", "316": "大到暴雨", "317": "暴雨到大暴雨", "318": "大暴雨到特大暴雨", - "350": "阵雨", "351": "强阵雨", "399": "雨", - "400": "小雪", "401": "中雪", "402": "大雪", "403": "暴雪", "404": "雨夹雪", - "405": "雨雪天气", "406": "阵雨夹雪", "407": "阵雪", "408": "小到中雪", "409": "中到大雪", "410": "大到暴雪", - "456": "阵雨夹雪", "457": "阵雪", "499": "雪", - "500": "薄雾", "501": "雾", "502": "霾", "503": "扬沙", "504": "浮尘", - "507": "沙尘暴", "508": "强沙尘暴", - "509": "浓雾", "510": "强浓雾", "511": "中度霾", "512": "重度霾", "513": "严重霾", "514": "大雾", "515": "特强浓雾", - "900": "热", "901": "冷", "999": "未知" + "100": "晴", + "101": "多云", + "102": "少云", + "103": "晴间多云", + "104": "阴", + "150": "晴", + "151": "多云", + "152": "少云", + "153": "晴间多云", + "300": "阵雨", + "301": "强阵雨", + "302": "雷阵雨", + "303": "强雷阵雨", + "304": "雷阵雨伴有冰雹", + "305": "小雨", + "306": "中雨", + "307": "大雨", + "308": "极端降雨", + "309": "毛毛雨/细雨", + "310": "暴雨", + "311": "大暴雨", + "312": "特大暴雨", + "313": "冻雨", + "314": "小到中雨", + "315": "中到大雨", + "316": "大到暴雨", + "317": "暴雨到大暴雨", + "318": "大暴雨到特大暴雨", + "350": "阵雨", + "351": "强阵雨", + "399": "雨", + "400": "小雪", + "401": "中雪", + "402": "大雪", + "403": "暴雪", + "404": "雨夹雪", + "405": "雨雪天气", + "406": "阵雨夹雪", + "407": "阵雪", + "408": "小到中雪", + "409": "中到大雪", + "410": "大到暴雪", + "456": "阵雨夹雪", + "457": "阵雪", + "499": "雪", + "500": "薄雾", + "501": "雾", + "502": "霾", + "503": "扬沙", + "504": "浮尘", + "507": "沙尘暴", + "508": "强沙尘暴", + "509": "浓雾", + "510": "强浓雾", + "511": "中度霾", + "512": "重度霾", + "513": "严重霾", + "514": "大雾", + "515": "特强浓雾", + "900": "热", + "901": "冷", + "999": "未知", } + def fetch_city_info(location, api_key): url = f"https://geoapi.qweather.com/v2/city/lookup?key={api_key}&location={location}&lang=zh" response = requests.get(url, headers=HEADERS).json() - return response.get('location', [])[0] if response.get('location') else None + return response.get("location", [])[0] if response.get("location") else None def fetch_weather_page(url): @@ -72,10 +122,14 @@ def parse_weather_info(soup): city_name = soup.select_one("h1.c-submenu__location").get_text(strip=True) current_abstract = soup.select_one(".c-city-weather-current .current-abstract") - current_abstract = current_abstract.get_text(strip=True) if current_abstract else "未知" + current_abstract = ( + current_abstract.get_text(strip=True) if current_abstract else "未知" + ) current_basic = {} - for item in soup.select(".c-city-weather-current .current-basic .current-basic___item"): + for item in soup.select( + ".c-city-weather-current .current-basic .current-basic___item" + ): parts = item.get_text(strip=True, separator=" ").split(" ") if len(parts) == 2: key, value = parts[1], parts[0] @@ -84,7 +138,9 @@ def parse_weather_info(soup): temps_list = [] for row in soup.select(".city-forecast-tabs__row")[:7]: # 取前7天的数据 date = row.select_one(".date-bg .date").get_text(strip=True) - weather_code = row.select_one(".date-bg .icon")["src"].split("/")[-1].split(".")[0] + weather_code = ( + row.select_one(".date-bg .icon")["src"].split("/")[-1].split(".")[0] + ) weather = WEATHER_CODE_MAP.get(weather_code, "未知") temps = [span.get_text(strip=True) for span in row.select(".tmp-cont .temp")] high_temp, low_temp = (temps[0], temps[-1]) if len(temps) >= 2 else (None, None) @@ -93,31 +149,47 @@ def parse_weather_info(soup): return city_name, current_abstract, current_basic, temps_list -@register_function('get_weather', GET_WEATHER_FUNCTION_DESC, ToolType.SYSTEM_CTL) +@register_function("get_weather", GET_WEATHER_FUNCTION_DESC, ToolType.SYSTEM_CTL) def get_weather(conn, location: str = None, lang: str = "zh_CN"): api_key = conn.config["plugins"]["get_weather"]["api_key"] default_location = conn.config["plugins"]["get_weather"]["default_location"] - location = location or conn.client_ip_info.get("city") or default_location - logger.bind(tag=TAG).debug(f"获取天气: {location}") + client_ip = conn.client_ip + # 优先使用用户提供的location参数 + if not location: + # 通过客户端IP解析城市 + if client_ip: + # 动态解析IP对应的城市信息 + ip_info = get_ip_info(client_ip, logger) + location = ip_info.get("city") if ip_info and "city" in ip_info else None + else: + # 若IP解析失败或无IP,使用默认位置 + location = default_location city_info = fetch_city_info(location, api_key) if not city_info: - return ActionResponse(Action.REQLLM, f"未找到相关的城市: {location},请确认地点是否正确", None) - - soup = fetch_weather_page(city_info['fxLink']) + return ActionResponse( + Action.REQLLM, f"未找到相关的城市: {location},请确认地点是否正确", None + ) + soup = fetch_weather_page(city_info["fxLink"]) if not soup: return ActionResponse(Action.REQLLM, None, "请求失败") - city_name, current_abstract, current_basic, temps_list = parse_weather_info(soup) - weather_report = f"根据下列数据,用{lang}回应用户的查询天气请求:\n{city_name}未来7天天气:\n" - for i, (date, weather, high, low) in enumerate(temps_list): - if high and low: - weather_report += f"{date}: {low}到{high}, {weather}\n" - weather_report += ( - f"当前天气: {current_abstract}\n" - f"当前天气参数: {current_basic}\n" - f"(确保只报告指定单日的天气情况,除非未来会出现异常天气;或者用户明确要求想要了解多日天气,如果未指定,默认报告今天的天气。" - "参数为0的值不需要报告给用户,每次都报告体感温度,根据语境选择合适的参数内容告知用户,并对参数给出相应评价)" - ) + + weather_report = f"您查询的位置是:{city_name}\n\n当前天气: {current_abstract}\n" + + # 添加有效的当前天气参数 + if current_basic: + weather_report += "详细参数:\n" + for key, value in current_basic.items(): + if value != "0": # 过滤无效值 + weather_report += f" · {key}: {value}\n" + + # 添加7天预报 + weather_report += "\n未来7天预报:\n" + for date, weather, high, low in temps_list: + weather_report += f"{date}: {weather},气温 {low}~{high}\n" + + # 提示语 + weather_report += "\n(如需某一天的具体天气,请告诉我日期)" return ActionResponse(Action.REQLLM, weather_report, None) diff --git a/main/xiaozhi-server/plugins_func/functions/handle_device.py b/main/xiaozhi-server/plugins_func/functions/handle_device.py index d564562bf..70902c55f 100644 --- a/main/xiaozhi-server/plugins_func/functions/handle_device.py +++ b/main/xiaozhi-server/plugins_func/functions/handle_device.py @@ -6,6 +6,7 @@ import asyncio TAG = __name__ logger = setup_logging() + async def _get_device_status(conn, device_name, device_type, property_name): """获取设备状态""" status = await get_iot_status(conn, device_type, property_name) @@ -13,6 +14,7 @@ async def _get_device_status(conn, device_name, device_type, property_name): raise Exception(f"你的设备不支持{device_name}控制") return status + async def _set_device_property(conn, device_name, device_type, method_name, property_name, new_value=None, action=None, step=10): """设置设备属性""" current_value = await _get_device_status(conn, device_name, device_type, property_name) @@ -32,9 +34,11 @@ async def _set_device_property(conn, device_name, device_type, method_name, prop await send_iot_conn(conn, device_type, method_name, {property_name: current_value}) return current_value + def _handle_device_action(conn, func, success_message, error_message, *args, **kwargs): """处理设备操作的通用函数""" - future = asyncio.run_coroutine_threadsafe(func(conn, *args, **kwargs), conn.loop) + future = asyncio.run_coroutine_threadsafe( + func(conn, *args, **kwargs), conn.loop) try: result = future.result() logger.bind(tag=TAG).info(f"{success_message}: {result}") @@ -45,6 +49,7 @@ def _handle_device_action(conn, func, success_message, error_message, *args, **k response = f"{error_message}: {e}" return ActionResponse(action=Action.RESPONSE, result=None, response=response) + # 设备控制 handle_device_function_desc = { "type": "function", @@ -52,9 +57,9 @@ handle_device_function_desc = { "name": "handle_device", "description": ( "用户想要获取或者设置设备的音量/亮度大小,或者用户觉得声音/亮度过高或过低,或者用户想提高或降低音量/亮度。" - "比如用户说现在亮度多少,参数为:device_type:Backlight,action:get。" + "比如用户说现在亮度多少,参数为:device_type:Screen,action:get。" "比如用户说设置音量为50,参数为:device_type:Speaker,action:set,value:50。" - "比如用户说亮度太高了,参数为:device_type:Backlight,action:lower。" + "比如用户说亮度太高了,参数为:device_type:Screen,action:lower。" "比如用户说调大音量,参数为:device_type:Speaker,action:raise。" ), "parameters": { @@ -62,14 +67,14 @@ handle_device_function_desc = { "properties": { "device_type": { "type": "string", - "description": "设备类型,可选值:Speaker(音量),Backlight(亮度)" + "description": "设备类型,可选值:Speaker(音量),Screen(亮度)" }, "action": { "type": "string", "description": "动作名称,可选值:get(获取),set(设置),raise(提高),lower(降低)" }, "value": { - "type": "int", + "type": "integer", "description": "值大小,可选值:0-100之间的整数" } }, @@ -78,18 +83,19 @@ handle_device_function_desc = { } } + @register_function('handle_device', handle_device_function_desc, ToolType.IOT_CTL) def handle_device(conn, device_type: str, action: str, value: int = None): if device_type == "Speaker": method_name, property_name, device_name = "SetVolume", "volume", "音量" - elif device_type == "Backlight": + elif device_type == "Screen": method_name, property_name, device_name = "SetBrightness", "brightness", "亮度" else: raise Exception(f"未识别的设备类型: {device_type}") - + if action not in ["get", "set", "raise", "lower"]: raise Exception(f"未识别的动作名称: {action}") - + if action == "get": # get return _handle_device_action( diff --git a/main/xiaozhi-server/plugins_func/functions/handle_exit_intent.py b/main/xiaozhi-server/plugins_func/functions/handle_exit_intent.py index e4769d00e..affa8af2f 100644 --- a/main/xiaozhi-server/plugins_func/functions/handle_exit_intent.py +++ b/main/xiaozhi-server/plugins_func/functions/handle_exit_intent.py @@ -1,34 +1,43 @@ -from plugins_func.register import register_function,ToolType, ActionResponse, Action +from plugins_func.register import register_function, ToolType, ActionResponse, Action from config.logger import setup_logging TAG = __name__ logger = setup_logging() handle_exit_intent_function_desc = { - "type": "function", - "function": { - "name": "handle_exit_intent", - "description": "当用户想结束对话或需要退出系统时调用", - "parameters": { - "type": "object", - "properties": { - "say_goodbye": { - "type": "string", - "description": "和用户友好结束对话的告别语" - } - }, - "required": ["say_goodbye"] - } + "type": "function", + "function": { + "name": "handle_exit_intent", + "description": "当用户想结束对话或需要退出系统时调用", + "parameters": { + "type": "object", + "properties": { + "say_goodbye": { + "type": "string", + "description": "和用户友好结束对话的告别语", } - } + }, + "required": ["say_goodbye"], + }, + }, +} -@register_function('handle_exit_intent', handle_exit_intent_function_desc, ToolType.SYSTEM_CTL) -def handle_exit_intent(conn, say_goodbye: str): + +@register_function( + "handle_exit_intent", handle_exit_intent_function_desc, ToolType.SYSTEM_CTL +) +def handle_exit_intent(conn, say_goodbye: str | None = None): # 处理退出意图 try: + if say_goodbye is None: + say_goodbye = "再见,祝您生活愉快!" conn.close_after_chat = True logger.bind(tag=TAG).info(f"退出意图已处理:{say_goodbye}") - return ActionResponse(action=Action.RESPONSE, result="退出意图已处理", response=say_goodbye) + return ActionResponse( + action=Action.RESPONSE, result="退出意图已处理", response=say_goodbye + ) except Exception as e: logger.bind(tag=TAG).error(f"处理退出意图错误: {e}") - return ActionResponse(action=Action.NONE, result="退出意图处理失败", response="") \ No newline at end of file + return ActionResponse( + action=Action.NONE, result="退出意图处理失败", response="" + ) diff --git a/main/xiaozhi-server/plugins_func/functions/hass_get_state.py b/main/xiaozhi-server/plugins_func/functions/hass_get_state.py index 415f35c6a..5ce511eb2 100644 --- a/main/xiaozhi-server/plugins_func/functions/hass_get_state.py +++ b/main/xiaozhi-server/plugins_func/functions/hass_get_state.py @@ -11,7 +11,7 @@ hass_get_state_function_desc = { "type": "function", "function": { "name": "hass_get_state", - "description": "获取homeassistant里设备的状态,包括灯光亮度,媒体播放器的音量,设备的暂停、继续操作", + "description": "获取homeassistant里设备的状态,包括查询灯光亮度、颜色、色温,媒体播放器的音量,设备的暂停、继续操作", "parameters": { "type": "object", "properties": { @@ -35,7 +35,7 @@ def hass_get_state(conn, entity_id=''): conn.loop ) ha_response = future.result() - return ActionResponse(action=Action.REQLLM, result="执行成功", response=ha_response) + return ActionResponse( Action.REQLLM, ha_response , None ) except Exception as e: logger.bind(tag=TAG).error(f"处理设置属性意图错误: {e}") @@ -51,6 +51,23 @@ async def handle_hass_get_state(conn, entity_id): } response = requests.get(url, headers=headers) if response.status_code == 200: - return response.json()['state'] + responsetext = '设备状态:' + response.json()['state'] + ' ' + logger.bind(tag=TAG).info(f"api返回内容: {response.json()}") + + if 'media_title' in response.json()['attributes']: + responsetext = responsetext+ '正在播放的是:'+str(response.json()['attributes']['media_title'])+' ' + if 'volume_level' in response.json()['attributes']: + responsetext = responsetext+ '音量是:'+str(response.json()['attributes']['volume_level'])+' ' + if 'color_temp_kelvin' in response.json()['attributes']: + responsetext = responsetext+ '色温是:'+str(response.json()['attributes']['color_temp_kelvin'])+' ' + if 'rgb_color' in response.json()['attributes']: + responsetext = responsetext+ 'rgb颜色是:'+str(response.json()['attributes']['rgb_color'])+' ' + if 'brightness' in response.json()['attributes']: + responsetext = responsetext+ '亮度是:'+str(response.json()['attributes']['brightness'])+' ' + logger.bind(tag=TAG).info(f"查询返回内容: {responsetext}") + return responsetext + #return response.json()['attributes'] + #response.attributes + else: return f"切换失败,错误码: {response.status_code}" diff --git a/main/xiaozhi-server/plugins_func/functions/hass_init.py b/main/xiaozhi-server/plugins_func/functions/hass_init.py index e09eb67f9..06d7c8bcb 100644 --- a/main/xiaozhi-server/plugins_func/functions/hass_init.py +++ b/main/xiaozhi-server/plugins_func/functions/hass_init.py @@ -9,9 +9,11 @@ HASS_CACHE = {} def append_devices_to_prompt(conn): if conn.use_function_call_mode: - funcs = conn.config["Intent"]["function_call"].get("functions", []) - if "hass_get_state" in funcs or "hass_get_state" in funcs: - prompt = "下面是我家智能设备,可以通过homeassistant控制\n" + funcs = conn.config["Intent"][conn.config["selected_module"]["Intent"]].get( + "functions", [] + ) + if "hass_get_state" in funcs or "hass_set_state" in funcs: + prompt = "\n下面是我家智能设备列表(位置,设备名,entity_id),可以通过homeassistant控制\n" devices = conn.config["plugins"]["home_assistant"].get("devices", []) if len(devices) == 0: return @@ -26,10 +28,16 @@ def initialize_hass_handler(conn): global HASS_CACHE if HASS_CACHE == {}: if conn.use_function_call_mode: - funcs = conn.config["Intent"]["function_call"].get("functions", []) - if "hass_get_state" in funcs or "hass_get_state" in funcs: - HASS_CACHE['base_url'] = conn.config["plugins"]["home_assistant"].get("base_url") - HASS_CACHE['api_key'] = conn.config["plugins"]["home_assistant"].get("api_key") + funcs = conn.config["Intent"][conn.config["selected_module"]["Intent"]].get( + "functions", [] + ) + if "hass_get_state" in funcs or "hass_set_state" in funcs: + HASS_CACHE["base_url"] = conn.config["plugins"]["home_assistant"].get( + "base_url" + ) + HASS_CACHE["api_key"] = conn.config["plugins"]["home_assistant"].get( + "api_key" + ) - check_model_key("home_assistant", HASS_CACHE['api_key']) + check_model_key("home_assistant", HASS_CACHE["api_key"]) return HASS_CACHE diff --git a/main/xiaozhi-server/plugins_func/functions/hass_set_state.py b/main/xiaozhi-server/plugins_func/functions/hass_set_state.py index 5e2b91a26..b9de146b1 100644 --- a/main/xiaozhi-server/plugins_func/functions/hass_set_state.py +++ b/main/xiaozhi-server/plugins_func/functions/hass_set_state.py @@ -11,7 +11,7 @@ hass_set_state_function_desc = { "type": "function", "function": { "name": "hass_set_state", - "description": "设置homeassistant里设备的状态,包括开、关,调整灯光亮度,调整播放器的音量,设备的暂停、继续、静音操作", + "description": "设置homeassistant里设备的状态,包括开、关,调整灯光亮度、颜色、色温,调整播放器的音量,设备的暂停、继续、静音操作", "parameters": { "type": "object", "properties": { @@ -20,15 +20,19 @@ hass_set_state_function_desc = { "properties": { "type": { "type": "string", - "description": "需要操作的动作,打开设备:turn_on,关闭设备:turn_off,增加亮度:brightness_up,降低亮度:brightness_down,设置亮度:brightness_value,增加>音量:,volume_up降低音量:volume_down,设置音量:volume_set,设备暂停:pause,设备继续:continue,静音/取消静音:volume_mute" + "description": "需要操作的动作,打开设备:turn_on,关闭设备:turn_off,增加亮度:brightness_up,降低亮度:brightness_down,设置亮度:brightness_value,增加音量:volume_up,降低音量:volume_down,设置音量:volume_set,设置色温:set_kelvin,设置颜色:set_color,设备暂停:pause,设备继续:continue,静音/取消静音:volume_mute" }, "input": { - "type": "int", + "type": "integer", "description": "只有在设置音量,设置亮度时候才需要,有效值为1-100,对应音量和亮度的1%-100%" }, "is_muted": { "type": "string", "description": "只有在设置静音操作时才需要,设置静音的时候该值为true,取消静音时该值为false" + }, + "rgb_color":{ + "type":"list", + "description": "只有在设置颜色时需要,这里填目标颜色的rgb值" } }, "required": ["type"] @@ -52,7 +56,7 @@ def hass_set_state(conn, entity_id='', state={}): conn.loop ) ha_response = future.result() - return ActionResponse(action=Action.REQLLM, result="执行成功", response=ha_response) + return ActionResponse(Action.REQLLM, ha_response, None) except Exception as e: logger.bind(tag=TAG).error(f"处理设置属性意图错误: {e}") @@ -103,6 +107,16 @@ async def handle_hass_set_state(conn, entity_id, state): action = 'turn_on' arg = 'brightness_pct' value = state['input'] + elif state['type'] == 'set_color': + description = f"颜色已调整到{state['rgb_color']}" + action = 'turn_on' + arg = 'rgb_color' + value = state['rgb_color'] + elif state['type'] == 'set_kelvin': + description = f"色温已调整到{state['input']}K" + action = 'turn_on' + arg = 'kelvin' + value = state['input'] elif state['type'] == 'volume_up': description = "音量已调大" action = state['type'] @@ -114,6 +128,8 @@ async def handle_hass_set_state(conn, entity_id, state): action = state['type'] arg = 'volume_level' value = state['input'] + if state['input'] >= 1: + value = state['input']/100 elif state['type'] == 'volume_mute': description = f"设备已静音" action = state['type'] @@ -152,7 +168,7 @@ async def handle_hass_set_state(conn, entity_id, state): "Content-Type": "application/json" } response = requests.post(url, headers=headers, json=data) - logger.bind(tag=TAG).info(f"设置状态:url:{url},return_code:{response.status_code}") + logger.bind(tag=TAG).info(f"设置状态:{description},url:{url},return_code:{response.status_code}") if response.status_code == 200: return description else: diff --git a/main/xiaozhi-server/plugins_func/functions/play_music.py b/main/xiaozhi-server/plugins_func/functions/play_music.py index 84845b70b..83b3f97e0 100644 --- a/main/xiaozhi-server/plugins_func/functions/play_music.py +++ b/main/xiaozhi-server/plugins_func/functions/play_music.py @@ -11,10 +11,9 @@ from pathlib import Path from core.utils import p3 from core.handle.sendAudioHandle import send_stt_message from plugins_func.register import register_function, ToolType, ActionResponse, Action - +from core.utils.dialogue import Message TAG = __name__ -logger = setup_logging() MUSIC_CACHE = {} @@ -42,7 +41,11 @@ play_music_function_desc = { "required": ["song_name"] } } - } + }, + "required": ["song_name"], + }, + }, +} @register_function('play_music', play_music_function_desc, ToolType.SYSTEM_CTL) @@ -56,10 +59,13 @@ def play_music(conn, song_name: str, artist: str = None, use_api: bool = False): else: music_intent = f"播放音乐 {song_name}" if song_name != "random" else "随机播放音乐" + # 检查事件循环状态 if not conn.loop.is_running(): - logger.bind(tag=TAG).error("事件循环未运行,无法提交任务") - return ActionResponse(action=Action.RESPONSE, result="系统繁忙", response="请稍后再试") + conn.logger.bind(tag=TAG).error("事件循环未运行,无法提交任务") + return ActionResponse( + action=Action.RESPONSE, result="系统繁忙", response="请稍后再试" + ) # 提交异步任务 future = asyncio.run_coroutine_threadsafe( @@ -71,16 +77,20 @@ def play_music(conn, song_name: str, artist: str = None, use_api: bool = False): def handle_done(f): try: f.result() # 可在此处理成功逻辑 - logger.bind(tag=TAG).info("播放完成") + conn.logger.bind(tag=TAG).info("播放完成") except Exception as e: - logger.bind(tag=TAG).error(f"播放失败: {e}") + conn.logger.bind(tag=TAG).error(f"播放失败: {e}") future.add_done_callback(handle_done) - return ActionResponse(action=Action.RESPONSE, result="指令已接收", response="正在为您播放音乐") + return ActionResponse( + action=Action.NONE, result="指令已接收", response="正在为您播放音乐" + ) except Exception as e: - logger.bind(tag=TAG).error(f"处理音乐意图错误: {e}") - return ActionResponse(action=Action.RESPONSE, result=str(e), response="播放音乐时出错了") + conn.logger.bind(tag=TAG).error(f"处理音乐意图错误: {e}") + return ActionResponse( + action=Action.RESPONSE, result=str(e), response="播放音乐时出错了" + ) def _extract_song_name(text): @@ -120,7 +130,9 @@ def get_music_files(music_dir, music_ext): if ext in music_ext: # 添加相对路径 music_files.append(str(file.relative_to(music_dir))) - music_file_names.append(os.path.splitext(str(file.relative_to(music_dir)))[0]) + music_file_names.append( + os.path.splitext(str(file.relative_to(music_dir)))[0] + ) return music_files, music_file_names @@ -148,8 +160,9 @@ def initialize_music_handler(conn): os.makedirs(MUSIC_CACHE["temp_dir"], exist_ok=True) # 获取音乐文件列表 - MUSIC_CACHE["music_files"], MUSIC_CACHE["music_file_names"] = get_music_files(MUSIC_CACHE["music_dir"], - MUSIC_CACHE["music_ext"]) + MUSIC_CACHE["music_files"], MUSIC_CACHE["music_file_names"] = get_music_files( + MUSIC_CACHE["music_dir"], MUSIC_CACHE["music_ext"] + ) MUSIC_CACHE["scan_time"] = time.time() return MUSIC_CACHE @@ -159,8 +172,8 @@ async def handle_music_command(conn, text, song_name=None, artist=None, use_api= global MUSIC_CACHE """处理音乐播放指令""" - clean_text = re.sub(r'[^\w\s]', '', text).strip() - logger.bind(tag=TAG).debug(f"检查是否是音乐命令: {clean_text}") + clean_text = re.sub(r"[^\w\s]", "", text).strip() + conn.logger.bind(tag=TAG).debug(f"检查是否是音乐命令: {clean_text}") # 如果指定了歌手或明确使用API,则使用在线API播放 if artist or use_api: @@ -172,15 +185,16 @@ async def handle_music_command(conn, text, song_name=None, artist=None, use_api= if os.path.exists(MUSIC_CACHE["music_dir"]): if time.time() - MUSIC_CACHE["scan_time"] > MUSIC_CACHE["refresh_time"]: # 刷新音乐文件列表 - MUSIC_CACHE["music_files"], MUSIC_CACHE["music_file_names"] = get_music_files(MUSIC_CACHE["music_dir"], - MUSIC_CACHE["music_ext"]) + MUSIC_CACHE["music_files"], MUSIC_CACHE["music_file_names"] = ( + get_music_files(MUSIC_CACHE["music_dir"], MUSIC_CACHE["music_ext"]) + ) MUSIC_CACHE["scan_time"] = time.time() potential_song = _extract_song_name(clean_text) if potential_song: best_match = _find_best_match(potential_song, MUSIC_CACHE["music_files"]) if best_match: - logger.bind(tag=TAG).info(f"找到最匹配的歌曲: {best_match}") + conn.logger.bind(tag=TAG).info(f"找到最匹配的歌曲: {best_match}") await play_local_music(conn, specific_file=best_match) return True @@ -196,6 +210,23 @@ async def handle_music_command(conn, text, song_name=None, artist=None, use_api= return True +def _get_random_play_prompt(song_name): + """生成随机播放引导语""" + # 移除文件扩展名 + clean_name = os.path.splitext(song_name)[0] + prompts = [ + f"正在为您播放,{clean_name}", + f"请欣赏歌曲,{clean_name}", + f"即将为您播放,{clean_name}", + f"为您带来,{clean_name}", + f"让我们聆听,{clean_name}", + f"接下来请欣赏,{clean_name}", + f"为您献上,{clean_name}", + ] + # 直接使用random.choice,不设置seed + return random.choice(prompts) + + async def play_local_music(conn, specific_file=None): global MUSIC_CACHE """播放本地音乐文件""" @@ -220,12 +251,23 @@ async def play_local_music(conn, specific_file=None): return False text = f"正在播放{selected_music}" + await send_stt_message(conn, text) + conn.dialogue.put(Message(role="assistant", content=text)) conn.tts_first_text_index = 0 conn.tts_last_text_index = 0 + + tts_file = await asyncio.to_thread(conn.tts.to_tts, text) + if tts_file is not None and os.path.exists(tts_file): + conn.tts_last_text_index = 1 + opus_packets, _ = conn.tts.audio_to_opus_data(tts_file) + conn.audio_play_queue.put((opus_packets, None, 0)) + os.remove(tts_file) + conn.llm_finish_task = True + if music_path.endswith(".p3"): - opus_packets, duration = p3.decode_opus_from_file(music_path) + opus_packets, _ = p3.decode_opus_from_file(music_path) else: opus_packets, duration = conn.tts.audio_to_opus_data(music_path) conn.audio_play_queue.put((opus_packets, selected_music, 0)) @@ -354,4 +396,5 @@ async def download_file(file_url, output_path): return True except Exception as e: logger.bind(tag=TAG).error(f"下载文件时发生错误: {str(e)}") - return False \ No newline at end of file + return False + diff --git a/main/xiaozhi-server/plugins_func/functions/plugin_loader.py b/main/xiaozhi-server/plugins_func/functions/plugin_loader.py index 4747d9976..7041d7a03 100644 --- a/main/xiaozhi-server/plugins_func/functions/plugin_loader.py +++ b/main/xiaozhi-server/plugins_func/functions/plugin_loader.py @@ -1,51 +1,56 @@ -from plugins_func.register import register_function,ToolType, ActionResponse, Action -from config.logger import setup_logging - -TAG = __name__ -logger = setup_logging() +from plugins_func.register import register_function, ToolType, ActionResponse, Action plugin_loader_function_desc = { - "type": "function", - "function": { - "name": "plugin_loader", - "description": "当用户想加载或卸载插件/function时,调用此函数:支持的插件列表为[plugins]", - "parameters": { - "type": "object", - "properties": { - "oper": { - "type": "string", - "description": "load or unload" - }, - "name":{ - "type": "string", - "description": "要加载或卸载的插件名字" - } - }, - "required": ["oper","name"] - } - } - } + "type": "function", + "function": { + "name": "plugin_loader", + "description": "当用户想加载或卸载插件/function时,调用此函数:支持的插件列表为[plugins]", + "parameters": { + "type": "object", + "properties": { + "oper": {"type": "string", "description": "load or unload"}, + "name": {"type": "string", "description": "要加载或卸载的插件名字"}, + }, + "required": ["oper", "name"], + }, + }, +} -@register_function('plugin_loader', plugin_loader_function_desc, ToolType.SYSTEM_CTL) + +@register_function("plugin_loader", plugin_loader_function_desc, ToolType.SYSTEM_CTL) def plugin_loader(conn, oper: str, name: str): """插件加载""" if oper not in ["load", "unload"]: - return ActionResponse(action=Action.RESPONSE, result="插件操作失败", response="不支持的操作") - + return ActionResponse( + action=Action.RESPONSE, result="插件操作失败", response="不支持的操作" + ) + cur_support = conn.func_handler.current_support_functions() if oper == "load": if name in cur_support: - return ActionResponse(action=Action.RESPONSE, result="插件加载失败", response=f"{name}插件已加载,无需重复加载") + return ActionResponse( + action=Action.RESPONSE, + result="插件加载失败", + response=f"{name}插件已加载,无需重复加载", + ) func = conn.func_handler.function_registry.register_function(name) if not func: - return ActionResponse(action=Action.RESPONSE, result="插件加载失败", response="插件未找到") + return ActionResponse( + action=Action.RESPONSE, result="插件加载失败", response="插件未找到" + ) res = f"{name}插件加载成功" else: if name not in cur_support: - return ActionResponse(action=Action.RESPONSE, result="插件卸载失败", response=f"{name}插件未加载") + return ActionResponse( + action=Action.RESPONSE, + result="插件卸载失败", + response=f"{name}插件未加载", + ) bOK = conn.func_handler.function_registry.unregister_function(name) if not bOK: - return ActionResponse(action=Action.RESPONSE, result="插件卸载失败", response="插件未找到") + return ActionResponse( + action=Action.RESPONSE, result="插件卸载失败", response="插件未找到" + ) res = f"{name}插件卸载成功" conn.func_handler.upload_functions_desc() return ActionResponse(action=Action.RESPONSE, result="插件操作成功", response=res) diff --git a/main/xiaozhi-server/plugins_func/register.py b/main/xiaozhi-server/plugins_func/register.py index ccb03b441..b96f2f29b 100644 --- a/main/xiaozhi-server/plugins_func/register.py +++ b/main/xiaozhi-server/plugins_func/register.py @@ -10,8 +10,12 @@ class ToolType(Enum): NONE = (1, "调用完工具后,不做其他操作") WAIT = (2, "调用工具,等待函数返回") CHANGE_SYS_PROMPT = (3, "修改系统提示词,切换角色性格或职责") - SYSTEM_CTL = (4, "系统控制,影响正常的对话流程,如退出、播放音乐等,需要传递conn参数") + SYSTEM_CTL = ( + 4, + "系统控制,影响正常的对话流程,如退出、播放音乐等,需要传递conn参数", + ) IOT_CTL = (5, "IOT设备控制,需要传递conn参数") + MCP_CLIENT = (6, "MCP客户端") def __init__(self, code, message): self.code = code @@ -29,12 +33,14 @@ class Action(Enum): self.code = code self.message = message + class ActionResponse: def __init__(self, action: Action, result, response): self.action = action # 动作类型 self.result = result # 动作产生的结果 self.response = response # 直接回复的内容 + class FunctionItem: def __init__(self, name, description, func, type): self.name = name @@ -42,40 +48,49 @@ class FunctionItem: self.func = func self.type = type + class DeviceTypeRegistry: """设备类型注册表,用于管理IOT设备类型及其函数""" + def __init__(self): self.type_functions = {} # type_signature -> {func_name: FunctionItem} - + def generate_device_type_id(self, descriptor): """通过设备能力描述生成类型ID""" properties = sorted(descriptor["properties"].keys()) methods = sorted(descriptor["methods"].keys()) # 使用属性和方法的组合作为设备类型的唯一标识 - type_signature = f"{descriptor['name']}:{','.join(properties)}:{','.join(methods)}" + type_signature = ( + f"{descriptor['name']}:{','.join(properties)}:{','.join(methods)}" + ) return type_signature - + def get_device_functions(self, type_id): """获取设备类型对应的所有函数""" return self.type_functions.get(type_id, {}) - + def register_device_type(self, type_id, functions): """注册设备类型及其函数""" if type_id not in self.type_functions: self.type_functions[type_id] = functions + # 初始化函数注册字典 all_function_registry = {} device_type_registry = DeviceTypeRegistry() + def register_function(name, desc, type=None): """注册函数到函数注册字典的装饰器""" + def decorator(func): all_function_registry[name] = FunctionItem(name, desc, func, type) logger.bind(tag=TAG).debug(f"函数 '{name}' 已加载,可以注册使用") return func + return decorator + class FunctionRegistry: def __init__(self): self.function_registry = {} @@ -88,9 +103,9 @@ class FunctionRegistry: self.logger.bind(tag=TAG).error(f"函数 '{name}' 未找到") return None self.function_registry[name] = func - self.logger.bind(tag=TAG).info(f"函数 '{name}' 注册成功") + self.logger.bind(tag=TAG).debug(f"函数 '{name}' 注册成功") return func - + def unregister_function(self, name): # 注销函数,检测是否存在 if name not in self.function_registry: @@ -102,9 +117,9 @@ class FunctionRegistry: def get_function(self, name): return self.function_registry.get(name) - + def get_all_functions(self): return self.function_registry - + def get_all_function_desc(self): - return [func.description for _, func in self.function_registry.items()] \ No newline at end of file + return [func.description for _, func in self.function_registry.items()] diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt index 51433cb90..02fbfcdb1 100755 --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -22,4 +22,9 @@ mem0ai==0.1.62 bs4==0.0.2 modelscope==1.23.2 sherpa_onnx==1.11.0 -cnlunar==0.2.0 \ No newline at end of file +mcp==1.7.1 +cnlunar==0.2.0 +PySocks==1.7.1 +dashscope==1.23.1 +baidu-aip==4.16.13 +chardet==5.2.0 \ No newline at end of file diff --git a/main/xiaozhi-server/test/abbreviated_version/app.js b/main/xiaozhi-server/test/abbreviated_version/app.js new file mode 100644 index 000000000..b22865241 --- /dev/null +++ b/main/xiaozhi-server/test/abbreviated_version/app.js @@ -0,0 +1,1254 @@ +const SAMPLE_RATE = 16000; +const CHANNELS = 1; +const FRAME_SIZE = 960; // 对应于60ms帧大小 (16000Hz * 0.06s = 960 samples) +const OPUS_APPLICATION = 2049; // OPUS_APPLICATION_AUDIO +const BUFFER_SIZE = 4096; + +// WebSocket相关变量 +let websocket = null; +let isConnected = false; + +let audioContext = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: SAMPLE_RATE }); +let mediaStream, mediaSource, audioProcessor; +let recordedPcmData = []; // 存储原始PCM数据 +let recordedOpusData = []; // 存储Opus编码后的数据 +let opusEncoder, opusDecoder; +let isRecording = false; + +const startButton = document.getElementById("start"); +const stopButton = document.getElementById("stop"); +const playButton = document.getElementById("play"); +const statusLabel = document.getElementById("status"); + +// 添加WebSocket界面元素引用 +const connectButton = document.getElementById("connectButton") || document.createElement("button"); +const serverUrlInput = document.getElementById("serverUrl") || document.createElement("input"); +const connectionStatus = document.getElementById("connectionStatus") || document.createElement("span"); +const sendTextButton = document.getElementById("sendTextButton") || document.createElement("button"); +const messageInput = document.getElementById("messageInput") || document.createElement("input"); +const conversationDiv = document.getElementById("conversation") || document.createElement("div"); + +// 添加连接和发送事件监听 +if(connectButton.id === "connectButton") { + connectButton.addEventListener("click", connectToServer); +} +if(sendTextButton.id === "sendTextButton") { + sendTextButton.addEventListener("click", sendTextMessage); +} + +startButton.addEventListener("click", startRecording); +stopButton.addEventListener("click", stopRecording); +playButton.addEventListener("click", playRecording); + +// 音频缓冲和播放管理 +let audioBufferQueue = []; // 存储接收到的音频包 +let isAudioBuffering = false; // 是否正在缓冲音频 +let isAudioPlaying = false; // 是否正在播放音频 +const BUFFER_THRESHOLD = 3; // 缓冲包数量阈值,至少累积5个包再开始播放 +const MIN_AUDIO_DURATION = 0.1; // 最小音频长度(秒),小于这个长度的音频会被合并 +let streamingContext = null; // 音频流上下文 + +// 初始化Opus编码器与解码器 +async function initOpus() { + if (typeof window.ModuleInstance === 'undefined') { + if (typeof Module !== 'undefined') { + // 尝试使用全局Module + window.ModuleInstance = Module; + console.log('使用全局Module作为ModuleInstance'); + } else { + console.error("Opus库未加载,ModuleInstance和Module对象都不存在"); + return false; + } + } + + try { + const mod = window.ModuleInstance; + + // 创建编码器 + opusEncoder = { + channels: CHANNELS, + sampleRate: SAMPLE_RATE, + frameSize: FRAME_SIZE, + maxPacketSize: 4000, + module: mod, + + // 初始化编码器 + init: function() { + // 获取编码器大小 + const encoderSize = mod._opus_encoder_get_size(this.channels); + console.log(`Opus编码器大小: ${encoderSize}字节`); + + // 分配内存 + this.encoderPtr = mod._malloc(encoderSize); + if (!this.encoderPtr) { + throw new Error("无法分配编码器内存"); + } + + // 初始化编码器 + const err = mod._opus_encoder_init( + this.encoderPtr, + this.sampleRate, + this.channels, + OPUS_APPLICATION + ); + + if (err < 0) { + throw new Error(`Opus编码器初始化失败: ${err}`); + } + + return true; + }, + + // 编码方法 + encode: function(pcmData) { + const mod = this.module; + + // 为PCM数据分配内存 + const pcmPtr = mod._malloc(pcmData.length * 2); // Int16 = 2字节 + + // 将数据复制到WASM内存 + for (let i = 0; i < pcmData.length; i++) { + mod.HEAP16[(pcmPtr >> 1) + i] = pcmData[i]; + } + + // 为Opus编码数据分配内存 + const maxEncodedSize = this.maxPacketSize; + const encodedPtr = mod._malloc(maxEncodedSize); + + // 编码 + const encodedBytes = mod._opus_encode( + this.encoderPtr, + pcmPtr, + this.frameSize, + encodedPtr, + maxEncodedSize + ); + + if (encodedBytes < 0) { + mod._free(pcmPtr); + mod._free(encodedPtr); + throw new Error(`Opus编码失败: ${encodedBytes}`); + } + + // 复制编码后的数据 + const encodedData = new Uint8Array(encodedBytes); + for (let i = 0; i < encodedBytes; i++) { + encodedData[i] = mod.HEAPU8[encodedPtr + i]; + } + + // 释放内存 + mod._free(pcmPtr); + mod._free(encodedPtr); + + return encodedData; + }, + + // 销毁方法 + destroy: function() { + if (this.encoderPtr) { + this.module._free(this.encoderPtr); + this.encoderPtr = null; + } + } + }; + + // 创建解码器 + opusDecoder = { + channels: CHANNELS, + rate: SAMPLE_RATE, + frameSize: FRAME_SIZE, + module: mod, + + // 初始化解码器 + init: function() { + // 获取解码器大小 + const decoderSize = mod._opus_decoder_get_size(this.channels); + console.log(`Opus解码器大小: ${decoderSize}字节`); + + // 分配内存 + this.decoderPtr = mod._malloc(decoderSize); + if (!this.decoderPtr) { + throw new Error("无法分配解码器内存"); + } + + // 初始化解码器 + const err = mod._opus_decoder_init( + this.decoderPtr, + this.rate, + this.channels + ); + + if (err < 0) { + throw new Error(`Opus解码器初始化失败: ${err}`); + } + + return true; + }, + + // 解码方法 + decode: function(opusData) { + const mod = this.module; + + // 为Opus数据分配内存 + const opusPtr = mod._malloc(opusData.length); + mod.HEAPU8.set(opusData, opusPtr); + + // 为PCM输出分配内存 + const pcmPtr = mod._malloc(this.frameSize * 2); // Int16 = 2字节 + + // 解码 + const decodedSamples = mod._opus_decode( + this.decoderPtr, + opusPtr, + opusData.length, + pcmPtr, + this.frameSize, + 0 // 不使用FEC + ); + + if (decodedSamples < 0) { + mod._free(opusPtr); + mod._free(pcmPtr); + throw new Error(`Opus解码失败: ${decodedSamples}`); + } + + // 复制解码后的数据 + const decodedData = new Int16Array(decodedSamples); + for (let i = 0; i < decodedSamples; i++) { + decodedData[i] = mod.HEAP16[(pcmPtr >> 1) + i]; + } + + // 释放内存 + mod._free(opusPtr); + mod._free(pcmPtr); + + return decodedData; + }, + + // 销毁方法 + destroy: function() { + if (this.decoderPtr) { + this.module._free(this.decoderPtr); + this.decoderPtr = null; + } + } + }; + + // 初始化编码器和解码器 + if (opusEncoder.init() && opusDecoder.init()) { + console.log("Opus 编码器和解码器初始化成功。"); + return true; + } else { + console.error("Opus 初始化失败"); + return false; + } + } catch (error) { + console.error("Opus 初始化失败:", error); + return false; + } +} + +// 将Float32音频数据转换为Int16音频数据 +function convertFloat32ToInt16(float32Data) { + const int16Data = new Int16Array(float32Data.length); + for (let i = 0; i < float32Data.length; i++) { + // 将[-1,1]范围转换为[-32768,32767] + const s = Math.max(-1, Math.min(1, float32Data[i])); + int16Data[i] = s < 0 ? s * 0x8000 : s * 0x7FFF; + } + return int16Data; +} + +// 将Int16音频数据转换为Float32音频数据 +function convertInt16ToFloat32(int16Data) { + const float32Data = new Float32Array(int16Data.length); + for (let i = 0; i < int16Data.length; i++) { + // 将[-32768,32767]范围转换为[-1,1] + float32Data[i] = int16Data[i] / (int16Data[i] < 0 ? 0x8000 : 0x7FFF); + } + return float32Data; +} + +function startRecording() { + if (isRecording) return; + + // 确保有权限并且AudioContext是活跃的 + if (audioContext.state === 'suspended') { + audioContext.resume().then(() => { + console.log("AudioContext已恢复"); + continueStartRecording(); + }).catch(err => { + console.error("恢复AudioContext失败:", err); + statusLabel.textContent = "无法激活音频上下文,请再次点击"; + }); + } else { + continueStartRecording(); + } +} + +// 实际开始录音的逻辑 +function continueStartRecording() { + // 重置录音数据 + recordedPcmData = []; + recordedOpusData = []; + window.audioDataBuffer = new Int16Array(0); // 重置缓冲区 + + // 初始化Opus + initOpus().then(success => { + if (!success) { + statusLabel.textContent = "Opus初始化失败"; + return; + } + + console.log("开始录音,参数:", { + sampleRate: SAMPLE_RATE, + channels: CHANNELS, + frameSize: FRAME_SIZE, + bufferSize: BUFFER_SIZE + }); + + // 如果WebSocket已连接,发送开始录音信号 + if (isConnected && websocket && websocket.readyState === WebSocket.OPEN) { + sendVoiceControlMessage('start'); + } + + // 请求麦克风权限 + navigator.mediaDevices.getUserMedia({ + audio: { + sampleRate: SAMPLE_RATE, + channelCount: CHANNELS, + echoCancellation: true, + noiseSuppression: true, + autoGainControl: true + } + }) + .then(stream => { + console.log("获取到麦克风流,实际参数:", stream.getAudioTracks()[0].getSettings()); + + // 检查流是否有效 + if (!stream || !stream.getAudioTracks().length || !stream.getAudioTracks()[0].enabled) { + throw new Error("获取到的音频流无效"); + } + + mediaStream = stream; + mediaSource = audioContext.createMediaStreamSource(stream); + + // 创建ScriptProcessor(虽然已弃用,但兼容性好) + // 在降级到ScriptProcessor之前尝试使用AudioWorklet + createAudioProcessor().then(processor => { + if (processor) { + console.log("使用AudioWorklet处理音频"); + audioProcessor = processor; + // 连接音频处理链 + mediaSource.connect(audioProcessor); + audioProcessor.connect(audioContext.destination); + } else { + console.log("回退到ScriptProcessor"); + // 创建ScriptProcessor节点 + audioProcessor = audioContext.createScriptProcessor(BUFFER_SIZE, CHANNELS, CHANNELS); + + // 处理音频数据 + audioProcessor.onaudioprocess = processAudioData; + + // 连接音频处理链 + mediaSource.connect(audioProcessor); + audioProcessor.connect(audioContext.destination); + } + + // 更新UI + isRecording = true; + statusLabel.textContent = "录音中..."; + startButton.disabled = true; + stopButton.disabled = false; + playButton.disabled = true; + }).catch(error => { + console.error("创建音频处理器失败:", error); + statusLabel.textContent = "创建音频处理器失败"; + }); + }) + .catch(error => { + console.error("获取麦克风失败:", error); + statusLabel.textContent = "获取麦克风失败: " + error.message; + }); + }); +} + +// 创建AudioWorklet处理器 +async function createAudioProcessor() { + try { + // 尝试使用更现代的AudioWorklet API + if ('AudioWorklet' in window && 'AudioWorkletNode' in window) { + // 定义AudioWorklet处理器代码 + const workletCode = ` + class OpusRecorderProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.buffers = []; + this.frameSize = ${FRAME_SIZE}; + this.buffer = new Float32Array(this.frameSize); + this.bufferIndex = 0; + this.isRecording = false; + + this.port.onmessage = (event) => { + if (event.data.command === 'start') { + this.isRecording = true; + } else if (event.data.command === 'stop') { + this.isRecording = false; + // 发送最后的缓冲区 + if (this.bufferIndex > 0) { + const finalBuffer = this.buffer.slice(0, this.bufferIndex); + this.port.postMessage({ buffer: finalBuffer }); + } + } + }; + } + + process(inputs, outputs) { + if (!this.isRecording) return true; + + // 获取输入数据 + const input = inputs[0][0]; // mono channel + if (!input || input.length === 0) return true; + + // 将输入数据添加到缓冲区 + for (let i = 0; i < input.length; i++) { + this.buffer[this.bufferIndex++] = input[i]; + + // 当缓冲区填满时,发送给主线程 + if (this.bufferIndex >= this.frameSize) { + this.port.postMessage({ buffer: this.buffer.slice() }); + this.bufferIndex = 0; + } + } + + return true; + } + } + + registerProcessor('opus-recorder-processor', OpusRecorderProcessor); + `; + + // 创建Blob URL + const blob = new Blob([workletCode], { type: 'application/javascript' }); + const url = URL.createObjectURL(blob); + + // 加载AudioWorklet模块 + await audioContext.audioWorklet.addModule(url); + + // 创建AudioWorkletNode + const workletNode = new AudioWorkletNode(audioContext, 'opus-recorder-processor'); + + // 处理从AudioWorklet接收的消息 + workletNode.port.onmessage = (event) => { + if (event.data.buffer) { + // 使用与ScriptProcessor相同的处理逻辑 + processAudioData({ + inputBuffer: { + getChannelData: () => event.data.buffer + } + }); + } + }; + + // 启动录音 + workletNode.port.postMessage({ command: 'start' }); + + // 保存停止函数 + workletNode.stopRecording = () => { + workletNode.port.postMessage({ command: 'stop' }); + }; + + console.log("AudioWorklet 音频处理器创建成功"); + return workletNode; + } + } catch (error) { + console.error("创建AudioWorklet失败,将使用ScriptProcessor:", error); + } + + // 如果AudioWorklet不可用或失败,返回null以便回退到ScriptProcessor + return null; +} + +// 处理音频数据 +function processAudioData(e) { + // 获取输入缓冲区 + const inputBuffer = e.inputBuffer; + + // 获取第一个通道的Float32数据 + const inputData = inputBuffer.getChannelData(0); + + // 添加调试信息 + const nonZeroCount = Array.from(inputData).filter(x => Math.abs(x) > 0.001).length; + console.log(`接收到音频数据: ${inputData.length} 个样本, 非零样本数: ${nonZeroCount}`); + + // 如果全是0,可能是麦克风没有正确获取声音 + if (nonZeroCount < 5) { + console.warn("警告: 检测到大量静音样本,请检查麦克风是否正常工作"); + // 继续处理,以防有些样本确实是静音 + } + + // 存储PCM数据用于调试 + recordedPcmData.push(new Float32Array(inputData)); + + // 转换为Int16数据供Opus编码 + const int16Data = convertFloat32ToInt16(inputData); + + // 如果收集到的数据不是FRAME_SIZE的整数倍,需要进行处理 + // 创建静态缓冲区来存储不足一帧的数据 + if (!window.audioDataBuffer) { + window.audioDataBuffer = new Int16Array(0); + } + + // 合并之前缓存的数据和新数据 + const combinedData = new Int16Array(window.audioDataBuffer.length + int16Data.length); + combinedData.set(window.audioDataBuffer); + combinedData.set(int16Data, window.audioDataBuffer.length); + + // 处理完整帧 + const frameCount = Math.floor(combinedData.length / FRAME_SIZE); + console.log(`可编码的完整帧数: ${frameCount}, 缓冲区总大小: ${combinedData.length}`); + + for (let i = 0; i < frameCount; i++) { + const frameData = combinedData.subarray(i * FRAME_SIZE, (i + 1) * FRAME_SIZE); + + try { + console.log(`编码第 ${i+1}/${frameCount} 帧, 帧大小: ${frameData.length}`); + const encodedData = opusEncoder.encode(frameData); + if (encodedData) { + console.log(`编码成功: ${encodedData.length} 字节`); + recordedOpusData.push(encodedData); + + // 如果WebSocket已连接,发送编码后的数据 + if (isConnected && websocket && websocket.readyState === WebSocket.OPEN) { + sendOpusDataToServer(encodedData); + } + } + } catch (error) { + console.error(`Opus编码帧 ${i+1} 失败:`, error); + } + } + + // 保存剩余不足一帧的数据 + const remainingSamples = combinedData.length % FRAME_SIZE; + if (remainingSamples > 0) { + window.audioDataBuffer = combinedData.subarray(frameCount * FRAME_SIZE); + console.log(`保留 ${remainingSamples} 个样本到下一次处理`); + } else { + window.audioDataBuffer = new Int16Array(0); + } +} + +function stopRecording() { + if (!isRecording) return; + + // 处理剩余的缓冲数据 + if (window.audioDataBuffer && window.audioDataBuffer.length > 0) { + console.log(`停止录音,处理剩余的 ${window.audioDataBuffer.length} 个样本`); + // 如果剩余数据不足一帧,可以通过补零的方式凑成一帧 + if (window.audioDataBuffer.length < FRAME_SIZE) { + const paddedFrame = new Int16Array(FRAME_SIZE); + paddedFrame.set(window.audioDataBuffer); + // 剩余部分填充为0 + for (let i = window.audioDataBuffer.length; i < FRAME_SIZE; i++) { + paddedFrame[i] = 0; + } + try { + console.log(`编码最后一帧(补零): ${paddedFrame.length} 样本`); + const encodedData = opusEncoder.encode(paddedFrame); + if (encodedData) { + recordedOpusData.push(encodedData); + + // 如果WebSocket已连接,发送最后一帧 + if (isConnected && websocket && websocket.readyState === WebSocket.OPEN) { + sendOpusDataToServer(encodedData); + } + } + } catch (error) { + console.error("最后一帧Opus编码失败:", error); + } + } else { + // 如果数据超过一帧,按正常流程处理 + processAudioData({ + inputBuffer: { + getChannelData: () => convertInt16ToFloat32(window.audioDataBuffer) + } + }); + } + window.audioDataBuffer = null; + } + + // 如果WebSocket已连接,发送停止录音信号 + if (isConnected && websocket && websocket.readyState === WebSocket.OPEN) { + // 发送一个空帧作为结束标记 + const emptyFrame = new Uint8Array(0); + websocket.send(emptyFrame); + + // 发送停止录音控制消息 + sendVoiceControlMessage('stop'); + } + + // 如果使用的是AudioWorklet,调用其特定的停止方法 + if (audioProcessor && typeof audioProcessor.stopRecording === 'function') { + audioProcessor.stopRecording(); + } + + // 停止麦克风 + if (mediaStream) { + mediaStream.getTracks().forEach(track => track.stop()); + } + + // 断开音频处理链 + if (audioProcessor) { + try { + audioProcessor.disconnect(); + if (mediaSource) mediaSource.disconnect(); + } catch (error) { + console.warn("断开音频处理链时出错:", error); + } + } + + // 更新UI + isRecording = false; + statusLabel.textContent = "已停止录音,收集了 " + recordedOpusData.length + " 帧Opus数据"; + startButton.disabled = false; + stopButton.disabled = true; + playButton.disabled = recordedOpusData.length === 0; + + console.log("录制完成:", + "PCM帧数:", recordedPcmData.length, + "Opus帧数:", recordedOpusData.length); +} + +function playRecording() { + if (!recordedOpusData.length) { + statusLabel.textContent = "没有可播放的录音"; + return; + } + + // 将所有Opus数据解码为PCM + let allDecodedData = []; + + for (const opusData of recordedOpusData) { + try { + // 解码为Int16数据 + const decodedData = opusDecoder.decode(opusData); + + if (decodedData && decodedData.length > 0) { + // 将Int16数据转换为Float32 + const float32Data = convertInt16ToFloat32(decodedData); + + // 添加到总解码数据中 + allDecodedData.push(...float32Data); + } + } catch (error) { + console.error("Opus解码失败:", error); + } + } + + // 如果没有解码出数据,返回 + if (allDecodedData.length === 0) { + statusLabel.textContent = "解码失败,无法播放"; + return; + } + + // 创建音频缓冲区 + const audioBuffer = audioContext.createBuffer(CHANNELS, allDecodedData.length, SAMPLE_RATE); + audioBuffer.copyToChannel(new Float32Array(allDecodedData), 0); + + // 创建音频源并播放 + const source = audioContext.createBufferSource(); + source.buffer = audioBuffer; + source.connect(audioContext.destination); + source.start(); + + // 更新UI + statusLabel.textContent = "正在播放..."; + playButton.disabled = true; + + // 播放结束后恢复UI + source.onended = () => { + statusLabel.textContent = "播放完毕"; + playButton.disabled = false; + }; +} + +// 处理二进制消息的修改版本 +async function handleBinaryMessage(data) { + try { + let arrayBuffer; + + // 根据数据类型进行处理 + if (data instanceof ArrayBuffer) { + arrayBuffer = data; + console.log(`收到ArrayBuffer音频数据,大小: ${data.byteLength}字节`); + } else if (data instanceof Blob) { + // 如果是Blob类型,转换为ArrayBuffer + arrayBuffer = await data.arrayBuffer(); + console.log(`收到Blob音频数据,大小: ${arrayBuffer.byteLength}字节`); + } else { + console.warn(`收到未知类型的二进制数据: ${typeof data}`); + return; + } + + // 创建Uint8Array用于处理 + const opusData = new Uint8Array(arrayBuffer); + + if (opusData.length > 0) { + // 将数据添加到缓冲队列 + audioBufferQueue.push(opusData); + + // 如果收到的是第一个音频包,开始缓冲过程 + if (audioBufferQueue.length === 1 && !isAudioBuffering && !isAudioPlaying) { + startAudioBuffering(); + } + } else { + console.warn('收到空音频数据帧,可能是结束标志'); + + // 如果缓冲队列中有数据且没有在播放,立即开始播放 + if (audioBufferQueue.length > 0 && !isAudioPlaying) { + playBufferedAudio(); + } + + // 如果正在播放,发送结束信号 + if (isAudioPlaying && streamingContext) { + streamingContext.endOfStream = true; + } + } + } catch (error) { + console.error(`处理二进制消息出错:`, error); + } +} + +// 开始音频缓冲过程 +function startAudioBuffering() { + if (isAudioBuffering || isAudioPlaying) return; + + isAudioBuffering = true; + console.log("开始音频缓冲..."); + + // 设置超时,如果在一定时间内没有收集到足够的音频包,就开始播放 + setTimeout(() => { + if (isAudioBuffering && audioBufferQueue.length > 0) { + console.log(`缓冲超时,当前缓冲包数: ${audioBufferQueue.length},开始播放`); + playBufferedAudio(); + } + }, 300); // 300ms超时 + + // 监控缓冲进度 + const bufferCheckInterval = setInterval(() => { + if (!isAudioBuffering) { + clearInterval(bufferCheckInterval); + return; + } + + // 当累积了足够的音频包,开始播放 + if (audioBufferQueue.length >= BUFFER_THRESHOLD) { + clearInterval(bufferCheckInterval); + console.log(`已缓冲 ${audioBufferQueue.length} 个音频包,开始播放`); + playBufferedAudio(); + } + }, 50); +} + +// 播放已缓冲的音频 +function playBufferedAudio() { + if (isAudioPlaying || audioBufferQueue.length === 0) return; + + isAudioPlaying = true; + isAudioBuffering = false; + + // 创建流式播放上下文 + if (!streamingContext) { + streamingContext = { + queue: [], // 已解码的PCM队列 + playing: false, // 是否正在播放 + endOfStream: false, // 是否收到结束信号 + source: null, // 当前音频源 + totalSamples: 0, // 累积的总样本数 + lastPlayTime: 0, // 上次播放的时间戳 + // 将Opus数据解码为PCM + decodeOpusFrames: async function(opusFrames) { + let decodedSamples = []; + + for (const frame of opusFrames) { + try { + // 使用Opus解码器解码 + const frameData = opusDecoder.decode(frame); + if (frameData && frameData.length > 0) { + // 转换为Float32 + const floatData = convertInt16ToFloat32(frameData); + decodedSamples.push(...floatData); + } + } catch (error) { + console.error("Opus解码失败:", error); + } + } + + if (decodedSamples.length > 0) { + // 添加到解码队列 + this.queue.push(...decodedSamples); + this.totalSamples += decodedSamples.length; + + // 如果累积了至少0.2秒的音频,开始播放 + const minSamples = SAMPLE_RATE * MIN_AUDIO_DURATION; + if (!this.playing && this.queue.length >= minSamples) { + this.startPlaying(); + } + } + }, + // 开始播放音频 + startPlaying: function() { + if (this.playing || this.queue.length === 0) return; + + this.playing = true; + + // 创建新的音频缓冲区 + const minPlaySamples = Math.min(this.queue.length, SAMPLE_RATE); // 最多播放1秒 + const currentSamples = this.queue.splice(0, minPlaySamples); + + const audioBuffer = audioContext.createBuffer(CHANNELS, currentSamples.length, SAMPLE_RATE); + audioBuffer.copyToChannel(new Float32Array(currentSamples), 0); + + // 创建音频源 + this.source = audioContext.createBufferSource(); + this.source.buffer = audioBuffer; + + // 创建增益节点用于平滑过渡 + const gainNode = audioContext.createGain(); + + // 应用淡入淡出效果避免爆音 + const fadeDuration = 0.02; // 20毫秒 + gainNode.gain.setValueAtTime(0, audioContext.currentTime); + gainNode.gain.linearRampToValueAtTime(1, audioContext.currentTime + fadeDuration); + + const duration = audioBuffer.duration; + if (duration > fadeDuration * 2) { + gainNode.gain.setValueAtTime(1, audioContext.currentTime + duration - fadeDuration); + gainNode.gain.linearRampToValueAtTime(0, audioContext.currentTime + duration); + } + + // 连接节点并开始播放 + this.source.connect(gainNode); + gainNode.connect(audioContext.destination); + + this.lastPlayTime = audioContext.currentTime; + console.log(`开始播放 ${currentSamples.length} 个样本,约 ${(currentSamples.length / SAMPLE_RATE).toFixed(2)} 秒`); + + // 播放结束后的处理 + this.source.onended = () => { + this.source = null; + this.playing = false; + + // 如果队列中还有数据或者缓冲区有新数据,继续播放 + if (this.queue.length > 0) { + setTimeout(() => this.startPlaying(), 10); + } else if (audioBufferQueue.length > 0) { + // 缓冲区有新数据,进行解码 + const frames = [...audioBufferQueue]; + audioBufferQueue = []; + this.decodeOpusFrames(frames); + } else if (this.endOfStream) { + // 流已结束且没有更多数据 + console.log("音频播放完成"); + isAudioPlaying = false; + streamingContext = null; + } else { + // 等待更多数据 + setTimeout(() => { + // 如果仍然没有新数据,但有更多的包到达 + if (this.queue.length === 0 && audioBufferQueue.length > 0) { + const frames = [...audioBufferQueue]; + audioBufferQueue = []; + this.decodeOpusFrames(frames); + } else if (this.queue.length === 0 && audioBufferQueue.length === 0) { + // 真的没有更多数据了 + console.log("音频播放完成 (超时)"); + isAudioPlaying = false; + streamingContext = null; + } + }, 500); // 500ms超时 + } + }; + + this.source.start(); + } + }; + } + + // 开始处理缓冲的数据 + const frames = [...audioBufferQueue]; + audioBufferQueue = []; // 清空缓冲队列 + + // 解码并播放 + streamingContext.decodeOpusFrames(frames); +} + +// 将旧的playOpusFromServer函数保留为备用方法 +function playOpusFromServerOld(opusData) { + if (!opusDecoder) { + initOpus().then(success => { + if (success) { + decodeAndPlayOpusDataOld(opusData); + } else { + statusLabel.textContent = "Opus解码器初始化失败"; + } + }); + } else { + decodeAndPlayOpusDataOld(opusData); + } +} + +// 旧的解码和播放函数作为备用 +function decodeAndPlayOpusDataOld(opusData) { + let allDecodedData = []; + + for (const frame of opusData) { + try { + const decodedData = opusDecoder.decode(frame); + if (decodedData && decodedData.length > 0) { + const float32Data = convertInt16ToFloat32(decodedData); + allDecodedData.push(...float32Data); + } + } catch (error) { + console.error("服务端Opus数据解码失败:", error); + } + } + + if (allDecodedData.length === 0) { + statusLabel.textContent = "服务端数据解码失败"; + return; + } + + const audioBuffer = audioContext.createBuffer(CHANNELS, allDecodedData.length, SAMPLE_RATE); + audioBuffer.copyToChannel(new Float32Array(allDecodedData), 0); + + const source = audioContext.createBufferSource(); + source.buffer = audioBuffer; + source.connect(audioContext.destination); + source.start(); + + statusLabel.textContent = "正在播放服务端数据..."; + source.onended = () => statusLabel.textContent = "服务端数据播放完毕"; +} + +// 更新playOpusFromServer函数为Promise版本 +function playOpusFromServer(opusData) { + // 为了兼容,我们将opusData添加到audioBufferQueue并触发播放 + if (Array.isArray(opusData) && opusData.length > 0) { + for (const frame of opusData) { + audioBufferQueue.push(frame); + } + + // 如果没有在播放和缓冲,启动流程 + if (!isAudioBuffering && !isAudioPlaying) { + startAudioBuffering(); + } + + return new Promise(resolve => { + // 我们无法准确知道何时播放完成,所以设置一个合理的超时 + setTimeout(resolve, 1000); // 1秒后认为已处理 + }); + } else { + // 如果不是数组或为空,使用旧方法 + return new Promise(resolve => { + playOpusFromServerOld(opusData); + setTimeout(resolve, 1000); + }); + } +} + +// 连接WebSocket服务器 +function connectToServer() { + let url = serverUrlInput.value || "ws://127.0.0.1:8000/xiaozhi/v1/"; + + try { + // 检查URL格式 + if (!url.startsWith('ws://') && !url.startsWith('wss://')) { + console.error('URL格式错误,必须以ws://或wss://开头'); + updateStatus('URL格式错误,必须以ws://或wss://开头', 'error'); + return; + } + + // 添加认证参数 + let connUrl = new URL(url); + connUrl.searchParams.append('device_id', 'web_test_device'); + connUrl.searchParams.append('device_mac', '00:11:22:33:44:55'); + + console.log(`正在连接: ${connUrl.toString()}`); + updateStatus(`正在连接: ${connUrl.toString()}`, 'info'); + + websocket = new WebSocket(connUrl.toString()); + + // 设置接收二进制数据的类型为ArrayBuffer + websocket.binaryType = 'arraybuffer'; + + websocket.onopen = async () => { + console.log(`已连接到服务器: ${url}`); + updateStatus(`已连接到服务器: ${url}`, 'success'); + isConnected = true; + + // 连接成功后发送hello消息 + await sendHelloMessage(); + + if(connectButton.id === "connectButton") { + connectButton.textContent = '断开'; + // connectButton.onclick = disconnectFromServer; + connectButton.removeEventListener("click", connectToServer); + connectButton.addEventListener("click", disconnectFromServer); + } + + if(messageInput.id === "messageInput") { + messageInput.disabled = false; + } + + if(sendTextButton.id === "sendTextButton") { + sendTextButton.disabled = false; + } + }; + + websocket.onclose = () => { + console.log('已断开连接'); + updateStatus('已断开连接', 'info'); + isConnected = false; + + if(connectButton.id === "connectButton") { + connectButton.textContent = '连接'; + // connectButton.onclick = connectToServer; + connectButton.removeEventListener("click", disconnectFromServer); + connectButton.addEventListener("click", connectToServer); + } + + if(messageInput.id === "messageInput") { + messageInput.disabled = true; + } + + if(sendTextButton.id === "sendTextButton") { + sendTextButton.disabled = true; + } + }; + + websocket.onerror = (error) => { + console.error(`WebSocket错误:`, error); + updateStatus(`WebSocket错误`, 'error'); + }; + + websocket.onmessage = function (event) { + try { + // 检查是否为文本消息 + if (typeof event.data === 'string') { + const message = JSON.parse(event.data); + handleTextMessage(message); + } else { + // 处理二进制数据 + handleBinaryMessage(event.data); + } + } catch (error) { + console.error(`WebSocket消息处理错误:`, error); + // 非JSON格式文本消息直接显示 + if (typeof event.data === 'string') { + addMessage(event.data); + } + } + }; + + updateStatus('正在连接...', 'info'); + } catch (error) { + console.error(`连接错误:`, error); + updateStatus(`连接失败: ${error.message}`, 'error'); + } +} + +// 断开WebSocket连接 +function disconnectFromServer() { + if (!websocket) return; + + websocket.close(); + if (isRecording) { + stopRecording(); + } +} + +// 发送hello握手消息 +async function sendHelloMessage() { + if (!websocket || websocket.readyState !== WebSocket.OPEN) return; + + try { + // 设置设备信息 + const helloMessage = { + type: 'hello', + device_id: 'web_test_device', + device_name: 'Web测试设备', + device_mac: '00:11:22:33:44:55', + token: 'your-token1' // 使用config.yaml中配置的token + }; + + console.log('发送hello握手消息'); + websocket.send(JSON.stringify(helloMessage)); + + // 等待服务器响应 + return new Promise(resolve => { + // 5秒超时 + const timeout = setTimeout(() => { + console.error('等待hello响应超时'); + resolve(false); + }, 5000); + + // 临时监听一次消息,接收hello响应 + const onMessageHandler = (event) => { + try { + const response = JSON.parse(event.data); + if (response.type === 'hello' && response.session_id) { + console.log(`服务器握手成功,会话ID: ${response.session_id}`); + clearTimeout(timeout); + websocket.removeEventListener('message', onMessageHandler); + resolve(true); + } + } catch (e) { + // 忽略非JSON消息 + } + }; + + websocket.addEventListener('message', onMessageHandler); + }); + } catch (error) { + console.error(`发送hello消息错误:`, error); + return false; + } +} + +// 发送文本消息 +function sendTextMessage() { + const message = messageInput ? messageInput.value.trim() : ""; + if (message === '' || !websocket || websocket.readyState !== WebSocket.OPEN) return; + + try { + // 发送listen消息 + const listenMessage = { + type: 'listen', + mode: 'manual', + state: 'detect', + text: message + }; + + websocket.send(JSON.stringify(listenMessage)); + addMessage(message, true); + console.log(`发送文本消息: ${message}`); + + if (messageInput) { + messageInput.value = ''; + } + } catch (error) { + console.error(`发送消息错误:`, error); + } +} + +// 添加消息到会话记录 +function addMessage(text, isUser = false) { + if (!conversationDiv) return; + + const messageDiv = document.createElement('div'); + messageDiv.className = `message ${isUser ? 'user' : 'server'}`; + messageDiv.textContent = text; + conversationDiv.appendChild(messageDiv); + conversationDiv.scrollTop = conversationDiv.scrollHeight; +} + +// 更新状态信息 +function updateStatus(message, type = 'info') { + console.log(`[${type}] ${message}`); + if (statusLabel) { + statusLabel.textContent = message; + } + if (connectionStatus) { + connectionStatus.textContent = message; + switch(type) { + case 'success': + connectionStatus.style.color = 'green'; + break; + case 'error': + connectionStatus.style.color = 'red'; + break; + case 'info': + default: + connectionStatus.style.color = 'black'; + break; + } + } +} + +// 处理文本消息 +function handleTextMessage(message) { + if (message.type === 'hello') { + console.log(`服务器回应:${JSON.stringify(message, null, 2)}`); + } else if (message.type === 'tts') { + // TTS状态消息 + if (message.state === 'start') { + console.log('服务器开始发送语音'); + } else if (message.state === 'sentence_start') { + console.log(`服务器发送语音段: ${message.text}`); + // 添加文本到会话记录 + if (message.text) { + addMessage(message.text); + } + } else if (message.state === 'sentence_end') { + console.log(`语音段结束: ${message.text}`); + } else if (message.state === 'stop') { + console.log('服务器语音传输结束'); + } + } else if (message.type === 'audio') { + // 音频控制消息 + console.log(`收到音频控制消息: ${JSON.stringify(message)}`); + } else if (message.type === 'stt') { + // 语音识别结果 + console.log(`识别结果: ${message.text}`); + // 添加识别结果到会话记录 + addMessage(`[语音识别] ${message.text}`, true); + } else if (message.type === 'llm') { + // 大模型回复 + console.log(`大模型回复: ${message.text}`); + // 添加大模型回复到会话记录 + if (message.text && message.text !== '😊') { + addMessage(message.text); + } + } else { + // 未知消息类型 + console.log(`未知消息类型: ${message.type}`); + addMessage(JSON.stringify(message, null, 2)); + } +} + +// 发送语音数据到WebSocket +function sendOpusDataToServer(opusData) { + if (!websocket || websocket.readyState !== WebSocket.OPEN) { + console.error('WebSocket未连接,无法发送音频数据'); + return false; + } + + try { + // 发送二进制数据 + websocket.send(opusData.buffer); + console.log(`已发送Opus音频数据: ${opusData.length}字节`); + return true; + } catch (error) { + console.error(`发送音频数据失败:`, error); + return false; + } +} + +// 发送语音开始和结束信号 +function sendVoiceControlMessage(state) { + if (!websocket || websocket.readyState !== WebSocket.OPEN) return; + + try { + const message = { + type: 'listen', + mode: 'manual', + state: state // 'start' 或 'stop' + }; + + websocket.send(JSON.stringify(message)); + console.log(`发送语音${state === 'start' ? '开始' : '结束'}控制消息`); + } catch (error) { + console.error(`发送语音控制消息失败:`, error); + } +} diff --git a/main/xiaozhi-server/test/abbreviated_version/test.html b/main/xiaozhi-server/test/abbreviated_version/test.html new file mode 100644 index 000000000..7c1f0324b --- /dev/null +++ b/main/xiaozhi-server/test/abbreviated_version/test.html @@ -0,0 +1,503 @@ + + + + + 小智语音服务测试 + + + +
+

小智语音服务测试

+ +
正在加载Opus库...
+ +
+

WebSocket连接 未连接

+
+ + +
+
+ +
+

录音测试

+ + +

+ + + +

录音状态: 待机,正在初始化...

+
+
+
+
+ +
+

文本消息

+
+ + +
+
+ +
+

会话记录

+
+
+ + +
+
+ + + + + + diff --git a/main/xiaozhi-server/test/libopus.js b/main/xiaozhi-server/test/libopus.js new file mode 100644 index 000000000..bff6b2a52 --- /dev/null +++ b/main/xiaozhi-server/test/libopus.js @@ -0,0 +1,266 @@ +var Module = function(Module) { + Module = Module || {}; + + var b;b||(b=eval("(function() { try { return Module || {} } catch(e) { return {} } })()"));var f={},l;for(l in b)b.hasOwnProperty(l)&&(f[l]=b[l]);var p=!1,q=!1,r=!1,t=!1; + if(b.ENVIRONMENT)if("WEB"===b.ENVIRONMENT)p=!0;else if("WORKER"===b.ENVIRONMENT)q=!0;else if("NODE"===b.ENVIRONMENT)r=!0;else if("SHELL"===b.ENVIRONMENT)t=!0;else throw Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else p="object"===typeof window,q="function"===typeof importScripts,r="object"===typeof process&&"function"===typeof require&&!p&&!q,t=!p&&!r&&!q; + if(r){b.print||(b.print=console.log);b.printErr||(b.printErr=console.warn);var u,v;b.read=function(a,c){u||(u=null);v||(v=require("path"));a=v.normalize(a);var d=u.readFileSync(a);d||a==v.resolve(a)||(a=path.join(__dirname,"..","src",a),d=u.readFileSync(a));d&&!c&&(d=d.toString());return d};b.readBinary=function(a){a=b.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};b.load=function(a){aa(read(a))};b.thisProgram||(b.thisProgram=1 0) var gc = undefined");else if(p||q)b.read=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},b.readAsync=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=function(){200== + e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)},"undefined"!=typeof arguments&&(b.arguments=arguments),"undefined"!==typeof console?(b.print||(b.print=function(a){console.log(a)}),b.printErr||(b.printErr=function(a){console.warn(a)})):b.print||(b.print=function(){}),q&&(b.load=importScripts),"undefined"===typeof b.setWindowTitle&&(b.setWindowTitle=function(a){document.title=a});else throw"Unknown runtime environment. Where are we?";function aa(a){eval.call(null,a)} + !b.load&&b.read&&(b.load=function(a){aa(b.read(a))});b.print||(b.print=function(){});b.printErr||(b.printErr=b.print);b.arguments||(b.arguments=[]);b.thisProgram||(b.thisProgram="./this.program");b.print=b.print;b.m=b.printErr;b.preRun=[];b.postRun=[];for(l in f)f.hasOwnProperty(l)&&(b[l]=f[l]); + var f=void 0,y={B:function(a){tempRet0=a},w:function(){return tempRet0},g:function(){return x},c:function(a){x=a},q:function(a){switch(a){case "i1":case "i8":return 1;case "i16":return 2;case "i32":return 4;case "i64":return 8;case "float":return 4;case "double":return 8;default:return"*"===a[a.length-1]?y.i:"i"===a[0]?(a=parseInt(a.substr(1)),assert(0===a%8),a/8):0}},v:function(a){return Math.max(y.q(a),y.i)},C:16,Q:function(a,c){"double"===c||"i64"===c?a&7&&(assert(4===(a&7)),a+=4):assert(0===(a& + 3));return a},K:function(a,c,d){return d||"i64"!=a&&"double"!=a?a?Math.min(c||(a?y.v(a):0),y.i):Math.min(c,8):8},k:function(a,c,d){return d&&d.length?(d.splice||(d=Array.prototype.slice.call(d)),d.splice(0,0,c),b["dynCall_"+a].apply(null,d)):b["dynCall_"+a].call(null,c)},e:[],r:function(a){for(var c=0;c=F)G("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+ + F+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 "),a=!0;return a?(E=c,0):c},p:function(a,c){return Math.ceil(a/(c?c:16))*(c?c:16)},P:function(a,c,d){return d?+(a>>>0)+4294967296*+(c>>>0):+(a>>>0)+4294967296*+(c|0)},h:8,i:4,D:0};b.Runtime=y;y.addFunction=y.r; + y.removeFunction=y.A;var H=!1;function assert(a,c){a||G("Assertion failed: "+c)}function ba(a){var c=b["_"+a];if(!c)try{c=eval("_"+a)}catch(d){}assert(c,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)");return c}var ca,da; + (function(){function a(a){a=a.toString().match(g).slice(1);return{arguments:a[0],body:a[1],returnValue:a[2]}}function c(){if(!k){k={};for(var c in d)d.hasOwnProperty(c)&&(k[c]=a(d[c]))}}var d={stackSave:function(){y.g()},stackRestore:function(){y.c()},arrayToC:function(a){var c=y.f(a.length);ea(a,c);return c},stringToC:function(a){var c=0;null!==a&&void 0!==a&&0!==a&&(c=y.f((a.length<<2)+1),fa(a,c));return c}},e={string:d.stringToC,array:d.arrayToC};da=function(a,c,d,g,k){a=ba(a);var C=[],D=0;if(g)for(var n= + 0;n>0]=c;break;case "i8":J[a>>0]=c;break;case "i16":L[a>>1]=c;break;case "i32":M[a>>2]=c;break;case "i64":tempI64=[c>>>0,(tempDouble=c,1<=+ha(tempDouble)?0>>0:~~+ka((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)];M[a>>2]=tempI64[0];M[a+4>>2]=tempI64[1];break;case "float":N[a>>2]=c;break;case "double":la[a>>3]=c;break;default:G("invalid type for setValue: "+ + d)}}b.setValue=ga;function ma(a,c){c=c||"i8";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return J[a>>0];case "i8":return J[a>>0];case "i16":return L[a>>1];case "i32":return M[a>>2];case "i64":return M[a>>2];case "float":return N[a>>2];case "double":return la[a>>3];default:G("invalid type for setValue: "+c)}return null}b.getValue=ma;b.ALLOC_NORMAL=0;b.ALLOC_STACK=1;b.ALLOC_STATIC=2;b.ALLOC_DYNAMIC=3;b.ALLOC_NONE=4; + function O(a,c,d,e){var g,k;"number"===typeof a?(g=!0,k=a):(g=!1,k=a.length);var h="string"===typeof c?c:null;d=4==d?e:["function"===typeof Q?Q:y.o,y.f,y.o,y.b][void 0===d?2:d](Math.max(k,h?1:c.length));if(g){e=d;assert(0==(d&3));for(a=d+(k&-4);e>2]=0;for(a=d+k;e>0]=0;return d}if("i8"===h)return a.subarray||a.slice?R.set(a,d):R.set(new Uint8Array(a),d),d;e=0;for(var A,m;e>0];d|=e;if(0==e&&!c)break;g++;if(c&&g==c)break}c||(c=g);e="";if(128>d){for(;0>0];if(!d)return c;c+=String.fromCharCode(d)}};b.stringToAscii=function(a,c){return pa(a,c,!1)}; + function qa(a,c){for(var d,e,g,k,h,A,m="";;){d=a[c++];if(!d)return m;d&128?(e=a[c++]&63,192==(d&224)?m+=String.fromCharCode((d&31)<<6|e):(g=a[c++]&63,224==(d&240)?d=(d&15)<<12|e<<6|g:(k=a[c++]&63,240==(d&248)?d=(d&7)<<18|e<<12|g<<6|k:(h=a[c++]&63,248==(d&252)?d=(d&3)<<24|e<<18|g<<12|k<<6|h:(A=a[c++]&63,d=(d&1)<<30|e<<24|g<<18|k<<12|h<<6|A))),65536>d?m+=String.fromCharCode(d):(d-=65536,m+=String.fromCharCode(55296|d>>10,56320|d&1023)))):m+=String.fromCharCode(d)}}b.UTF8ArrayToString=qa; + b.UTF8ToString=function(a){return qa(R,a)}; + function ra(a,c,d,e){if(!(0=h&&(h=65536+((h&1023)<<10)|a.charCodeAt(++k)&1023);if(127>=h){if(d>=e)break;c[d++]=h}else{if(2047>=h){if(d+1>=e)break;c[d++]=192|h>>6}else{if(65535>=h){if(d+2>=e)break;c[d++]=224|h>>12}else{if(2097151>=h){if(d+3>=e)break;c[d++]=240|h>>18}else{if(67108863>=h){if(d+4>=e)break;c[d++]=248|h>>24}else{if(d+5>=e)break;c[d++]=252|h>>30;c[d++]=128|h>>24&63}c[d++]=128|h>>18&63}c[d++]=128| + h>>12&63}c[d++]=128|h>>6&63}c[d++]=128|h&63}}c[d]=0;return d-g}b.stringToUTF8Array=ra;b.stringToUTF8=function(a,c,d){return ra(a,R,c,d)};function sa(a){for(var c=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}b.lengthBytesUTF8=sa; + function ta(){return ua().replace(/__Z[\w\d_]+/g,function(a){var c;a:{if(b.___cxa_demangle)try{var d=Q(a.length);fa(a.substr(1),d);var e=Q(4),g=b.___cxa_demangle(d,0,0,e);if(0===ma(e,"i32")&&g){c=I(g);break a}}catch(k){c=a;break a}finally{d&&va(d),e&&va(e),g&&va(g)}y.d("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");c=a}return a===c?a:a+" ["+c+"]"})} + function ua(){var a=Error();if(!a.stack){try{throw Error(0);}catch(c){a=c}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}b.stackTrace=function(){return ta()};function wa(){var a=E;0U?2*U:U+16777216;U!==F&&(F=U);b.buffer?buffer=b.buffer:buffer=new ArrayBuffer(F);b.HEAP8=J=new Int8Array(buffer); + b.HEAP16=L=new Int16Array(buffer);b.HEAP32=M=new Int32Array(buffer);b.HEAPU8=R=new Uint8Array(buffer);b.HEAPU16=xa=new Uint16Array(buffer);b.HEAPU32=ya=new Uint32Array(buffer);b.HEAPF32=N=new Float32Array(buffer);b.HEAPF64=la=new Float64Array(buffer);M[0]=255;if(255!==R[0]||0!==R[3])throw"Typed arrays 2 must be run on a little-endian system";b.HEAP=void 0;b.buffer=buffer;b.HEAP8=J;b.HEAP16=L;b.HEAP32=M;b.HEAPU8=R;b.HEAPU16=xa;b.HEAPU32=ya;b.HEAPF32=N;b.HEAPF64=la; + function V(a){for(;0>0]=a[d],d+=1}b.writeStringToMemory=fa;function ea(a,c){for(var d=0;d>0]=a[d]}b.writeArrayToMemory=ea; + function pa(a,c,d){for(var e=0;e>0]=a.charCodeAt(e);d||(J[c>>0]=0)}b.writeAsciiToMemory=pa;Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(a,c){var d=a&65535,e=c&65535;return d*e+((a>>>16)*e+d*(c>>>16)<<16)|0});Math.O=Math.imul;Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var c=0;32>c;c++)if(a&1<<31-c)return c;return 32});Math.H=Math.clz32;var ha=Math.abs,ka=Math.ceil,ja=Math.floor,La=Math.pow,ia=Math.min,W=0,Ma=null,X=null; + b.addRunDependency=function(){W++;b.monitorRunDependencies&&b.monitorRunDependencies(W)};b.removeRunDependency=function(){W--;b.monitorRunDependencies&&b.monitorRunDependencies(W);if(0==W&&(null!==Ma&&(clearInterval(Ma),Ma=null),X)){var a=X;X=null;a()}};b.preloadedImages={};b.preloadedAudios={};za=8;z=za+31072;Ea.push(); + O([1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,6,0,0,0,1,0,0,0,5,0,0,0,2,0,0,0,15,0,0,0,0,0,0,0,8,0,0,0,7,0,0,0,12,0,0,0,3,0,0,0,11,0,0,0,4,0,0,0,14,0,0,0,1,0,0,0,9,0,0,0,6,0,0,0,13,0,0,0,2,0,0,0,10,0,0,0,5,0,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,190,98,0,0,198,98,0,0,215,98,0,0,232,98,0,0,247,98,0,0,8,99,0,0,32,99,0,0,46,99,0,0,0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,224, + 64,0,0,0,65,0,0,128,65,0,0,192,65,0,0,16,66,0,0,48,66,0,0,72,66,0,0,96,66,0,0,120,66,0,0,134,66,0,0,144,66,0,0,158,66,0,0,176,66,0,0,212,66,0,0,6,67,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,64,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,0,65,0,0,0,65,168,1,0,0,104,4,0,0,36,7,0,0,220,9,0,0,144,12,0,0,64,15,0,0,236,17,0,0,84,19,0,0,16,20,0,0,132,20,0,0,208,20,0,0,8,21,0,0,40,21,0,0,64,21,0,0, + 76,21,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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107,0,0,0,109,0,0,0,111,0,0,0,113,0,0,0,115,0,0,0,117,0,0,0,119,0,0,0,121,0,0,0,123,0,0,0,125,0,0,0,127,0,0,0,129,0,0,0,131,0,0,0,133,0,0,0,135,0,0,0,137,0,0,0,139,0,0,0,141,0,0,0,143,0,0,0,145,0,0,0,147,0,0,0,149, + 0,0,0,151,0,0,0,153,0,0,0,155,0,0,0,157,0,0,0,159,0,0,0,161,0,0,0,163,0,0,0,165,0,0,0,167,0,0,0,169,0,0,0,171,0,0,0,173,0,0,0,175,0,0,0,177,0,0,0,179,0,0,0,181,0,0,0,183,0,0,0,185,0,0,0,187,0,0,0,189,0,0,0,191,0,0,0,193,0,0,0,195,0,0,0,197,0,0,0,199,0,0,0,201,0,0,0,203,0,0,0,205,0,0,0,207,0,0,0,209,0,0,0,211,0,0,0,213,0,0,0,215,0,0,0,217,0,0,0,219,0,0,0,221,0,0,0,223,0,0,0,225,0,0,0,227,0,0,0,229,0,0,0,231,0,0,0,233,0,0,0,235,0,0,0,237,0,0,0,239,0,0,0,241,0,0,0,243,0,0,0,245,0,0,0,247,0,0,0,249,0, + 0,0,251,0,0,0,253,0,0,0,255,0,0,0,1,1,0,0,3,1,0,0,5,1,0,0,7,1,0,0,9,1,0,0,11,1,0,0,13,1,0,0,15,1,0,0,17,1,0,0,19,1,0,0,21,1,0,0,23,1,0,0,25,1,0,0,27,1,0,0,29,1,0,0,31,1,0,0,33,1,0,0,35,1,0,0,37,1,0,0,39,1,0,0,41,1,0,0,43,1,0,0,45,1,0,0,47,1,0,0,49,1,0,0,51,1,0,0,53,1,0,0,55,1,0,0,57,1,0,0,59,1,0,0,61,1,0,0,63,1,0,0,65,1,0,0,67,1,0,0,69,1,0,0,71,1,0,0,73,1,0,0,75,1,0,0,77,1,0,0,79,1,0,0,81,1,0,0,83,1,0,0,85,1,0,0,87,1,0,0,89,1,0,0,91,1,0,0,93,1,0,0,95,1,0,0,13,0,0,0,25,0,0,0,41,0,0,0,61,0,0,0,85,0, + 0,0,113,0,0,0,145,0,0,0,181,0,0,0,221,0,0,0,9,1,0,0,57,1,0,0,109,1,0,0,165,1,0,0,225,1,0,0,33,2,0,0,101,2,0,0,173,2,0,0,249,2,0,0,73,3,0,0,157,3,0,0,245,3,0,0,81,4,0,0,177,4,0,0,21,5,0,0,125,5,0,0,233,5,0,0,89,6,0,0,205,6,0,0,69,7,0,0,193,7,0,0,65,8,0,0,197,8,0,0,77,9,0,0,217,9,0,0,105,10,0,0,253,10,0,0,149,11,0,0,49,12,0,0,209,12,0,0,117,13,0,0,29,14,0,0,201,14,0,0,121,15,0,0,45,16,0,0,229,16,0,0,161,17,0,0,97,18,0,0,37,19,0,0,237,19,0,0,185,20,0,0,137,21,0,0,93,22,0,0,53,23,0,0,17,24,0,0,241,24, + 0,0,213,25,0,0,189,26,0,0,169,27,0,0,153,28,0,0,141,29,0,0,133,30,0,0,129,31,0,0,129,32,0,0,133,33,0,0,141,34,0,0,153,35,0,0,169,36,0,0,189,37,0,0,213,38,0,0,241,39,0,0,17,41,0,0,53,42,0,0,93,43,0,0,137,44,0,0,185,45,0,0,237,46,0,0,37,48,0,0,97,49,0,0,161,50,0,0,229,51,0,0,45,53,0,0,121,54,0,0,201,55,0,0,29,57,0,0,117,58,0,0,209,59,0,0,49,61,0,0,149,62,0,0,253,63,0,0,105,65,0,0,217,66,0,0,77,68,0,0,197,69,0,0,65,71,0,0,193,72,0,0,69,74,0,0,205,75,0,0,89,77,0,0,233,78,0,0,125,80,0,0,21,82,0,0,177, + 83,0,0,81,85,0,0,245,86,0,0,157,88,0,0,73,90,0,0,249,91,0,0,173,93,0,0,101,95,0,0,33,97,0,0,225,98,0,0,165,100,0,0,109,102,0,0,57,104,0,0,9,106,0,0,221,107,0,0,181,109,0,0,145,111,0,0,113,113,0,0,85,115,0,0,61,117,0,0,41,119,0,0,25,121,0,0,13,123,0,0,5,125,0,0,1,127,0,0,1,129,0,0,5,131,0,0,13,133,0,0,25,135,0,0,41,137,0,0,61,139,0,0,85,141,0,0,113,143,0,0,145,145,0,0,181,147,0,0,221,149,0,0,9,152,0,0,57,154,0,0,109,156,0,0,165,158,0,0,225,160,0,0,33,163,0,0,101,165,0,0,173,167,0,0,249,169,0,0,73, + 172,0,0,157,174,0,0,245,176,0,0,81,179,0,0,177,181,0,0,21,184,0,0,125,186,0,0,233,188,0,0,89,191,0,0,205,193,0,0,69,196,0,0,193,198,0,0,65,201,0,0,197,203,0,0,77,206,0,0,217,208,0,0,105,211,0,0,253,213,0,0,149,216,0,0,49,219,0,0,209,221,0,0,117,224,0,0,29,227,0,0,201,229,0,0,121,232,0,0,45,235,0,0,229,237,0,0,161,240,0,0,63,0,0,0,129,0,0,0,231,0,0,0,121,1,0,0,63,2,0,0,65,3,0,0,135,4,0,0,25,6,0,0,255,7,0,0,65,10,0,0,231,12,0,0,249,15,0,0,127,19,0,0,129,23,0,0,7,28,0,0,25,33,0,0,191,38,0,0,1,45,0,0, + 231,51,0,0,121,59,0,0,191,67,0,0,193,76,0,0,135,86,0,0,25,97,0,0,127,108,0,0,193,120,0,0,231,133,0,0,249,147,0,0,255,162,0,0,1,179,0,0,7,196,0,0,25,214,0,0,63,233,0,0,129,253,0,0,231,18,1,0,121,41,1,0,63,65,1,0,65,90,1,0,135,116,1,0,25,144,1,0,255,172,1,0,65,203,1,0,231,234,1,0,249,11,2,0,127,46,2,0,129,82,2,0,7,120,2,0,25,159,2,0,191,199,2,0,1,242,2,0,231,29,3,0,121,75,3,0,191,122,3,0,193,171,3,0,135,222,3,0,25,19,4,0,127,73,4,0,193,129,4,0,231,187,4,0,249,247,4,0,255,53,5,0,1,118,5,0,7,184,5,0, + 25,252,5,0,63,66,6,0,129,138,6,0,231,212,6,0,121,33,7,0,63,112,7,0,65,193,7,0,135,20,8,0,25,106,8,0,255,193,8,0,65,28,9,0,231,120,9,0,249,215,9,0,127,57,10,0,129,157,10,0,7,4,11,0,25,109,11,0,191,216,11,0,1,71,12,0,231,183,12,0,121,43,13,0,191,161,13,0,193,26,14,0,135,150,14,0,25,21,15,0,127,150,15,0,193,26,16,0,231,161,16,0,249,43,17,0,255,184,17,0,1,73,18,0,7,220,18,0,25,114,19,0,63,11,20,0,129,167,20,0,231,70,21,0,121,233,21,0,63,143,22,0,65,56,23,0,135,228,23,0,25,148,24,0,255,70,25,0,65,253, + 25,0,231,182,26,0,249,115,27,0,127,52,28,0,129,248,28,0,7,192,29,0,25,139,30,0,191,89,31,0,1,44,32,0,231,1,33,0,121,219,33,0,191,184,34,0,193,153,35,0,135,126,36,0,25,103,37,0,127,83,38,0,193,67,39,0,231,55,40,0,249,47,41,0,255,43,42,0,1,44,43,0,7,48,44,0,25,56,45,0,63,68,46,0,129,84,47,0,231,104,48,0,121,129,49,0,63,158,50,0,65,191,51,0,135,228,52,0,25,14,54,0,255,59,55,0,65,110,56,0,231,164,57,0,249,223,58,0,127,31,60,0,129,99,61,0,7,172,62,0,25,249,63,0,191,74,65,0,1,161,66,0,231,251,67,0,121, + 91,69,0,191,191,70,0,193,40,72,0,135,150,73,0,25,9,75,0,127,128,76,0,193,252,77,0,231,125,79,0,249,3,81,0,255,142,82,0,1,31,84,0,7,180,85,0,25,78,87,0,63,237,88,0,129,145,90,0,231,58,92,0,121,233,93,0,63,157,95,0,65,86,97,0,135,20,99,0,25,216,100,0,255,160,102,0,65,111,104,0,231,66,106,0,249,27,108,0,127,250,109,0,65,1,0,0,169,2,0,0,9,5,0,0,193,8,0,0,65,14,0,0,9,22,0,0,169,32,0,0,193,46,0,0,1,65,0,0,41,88,0,0,9,117,0,0,129,152,0,0,129,195,0,0,9,247,0,0,41,52,1,0,1,124,1,0,193,207,1,0,169,48,2,0,9, + 160,2,0,65,31,3,0,193,175,3,0,9,83,4,0,169,10,5,0,65,216,5,0,129,189,6,0,41,188,7,0,9,214,8,0,1,13,10,0,1,99,11,0,9,218,12,0,41,116,14,0,129,51,16,0,65,26,18,0,169,42,20,0,9,103,22,0,193,209,24,0,65,109,27,0,9,60,30,0,169,64,33,0,193,125,36,0,1,246,39,0,41,172,43,0,9,163,47,0,129,221,51,0,129,94,56,0,9,41,61,0,41,64,66,0,1,167,71,0,193,96,77,0,169,112,83,0,9,218,89,0,65,160,96,0,193,198,103,0,9,81,111,0,169,66,119,0,65,159,127,0,129,106,136,0,41,168,145,0,9,92,155,0,1,138,165,0,1,54,176,0,9,100,187, + 0,41,24,199,0,129,86,211,0,65,35,224,0,169,130,237,0,9,121,251,0,193,10,10,1,65,60,25,1,9,18,41,1,169,144,57,1,193,188,74,1,1,155,92,1,41,48,111,1,9,129,130,1,129,146,150,1,129,105,171,1,9,11,193,1,41,124,215,1,1,194,238,1,193,225,6,2,169,224,31,2,9,196,57,2,65,145,84,2,193,77,112,2,9,255,140,2,169,170,170,2,65,86,201,2,129,7,233,2,41,196,9,3,9,146,43,3,1,119,78,3,1,121,114,3,9,158,151,3,41,236,189,3,129,105,229,3,65,28,14,4,169,10,56,4,9,59,99,4,193,179,143,4,65,123,189,4,9,152,236,4,169,16,29,5, + 193,235,78,5,1,48,130,5,41,228,182,5,9,15,237,5,129,183,36,6,129,228,93,6,9,157,152,6,41,232,212,6,1,205,18,7,193,82,82,7,169,128,147,7,9,94,214,7,65,242,26,8,193,68,97,8,9,93,169,8,169,66,243,8,65,253,62,9,129,148,140,9,41,16,220,9,9,120,45,10,1,212,128,10,1,44,214,10,9,136,45,11,41,240,134,11,129,108,226,11,65,5,64,12,169,194,159,12,9,173,1,13,193,204,101,13,65,42,204,13,9,206,52,14,169,192,159,14,193,10,13,15,1,181,124,15,41,200,238,15,9,77,99,16,129,76,218,16,129,207,83,17,9,223,207,17,41,132, + 78,18,1,200,207,18,193,179,83,19,169,80,218,19,9,168,99,20,65,195,239,20,193,171,126,21,9,107,16,22,169,10,165,22,65,148,60,23,129,17,215,23,41,140,116,24,9,14,21,25,1,161,184,25,1,79,95,26,9,34,9,27,41,36,182,27,129,95,102,28,65,222,25,29,169,170,208,29,9,207,138,30,193,85,72,31,65,73,9,32,9,180,205,32,169,160,149,33,193,25,97,34,1,42,48,35,41,220,2,36,9,59,217,36,129,81,179,37,147,6,0,0,69,14,0,0,15,28,0,0,17,51,0,0,91,87,0,0,13,142,0,0,119,221,0,0,57,77,1,0,99,230,1,0,149,179,2,0,31,193,3,0,33, + 29,5,0,171,215,6,0,221,2,9,0,7,179,11,0,201,254,14,0,51,255,18,0,229,207,23,0,47,143,29,0,49,94,36,0,251,96,44,0,173,190,53,0,151,161,64,0,89,55,77,0,3,177,91,0,53,67,108,0,63,38,127,0,65,150,148,0,75,211,172,0,125,33,200,0,39,201,230,0,233,22,9,1,211,91,47,1,133,237,89,1,79,38,137,1,81,101,189,1,155,14,247,1,77,139,54,2,183,73,124,2,121,189,200,2,163,95,28,3,213,174,119,3,95,47,219,3,97,107,71,4,235,242,188,4,29,92,60,5,71,67,198,5,9,75,91,6,115,28,252,6,37,103,169,7,111,225,99,8,113,72,44,9,59, + 96,3,10,237,243,233,10,215,213,224,11,153,223,232,12,67,242,2,14,117,246,47,15,127,220,112,16,129,156,198,17,139,54,50,19,189,178,180,20,103,33,79,22,41,155,2,24,19,65,208,25,197,60,185,27,143,192,190,29,145,7,226,31,219,85,36,34,141,248,134,36,247,69,11,39,185,157,178,41,227,104,126,44,21,26,112,47,159,45,137,50,161,41,203,53,43,158,55,57,93,37,208,60,135,99,150,64,73,7,140,68,179,201,178,72,101,110,12,77,175,195,154,81,177,162,95,86,123,239,92,91,45,153,148,96,23,154,8,102,217,247,186,107,131,195, + 173,113,181,25,227,119,191,34,93,126,29,35,0,0,113,77,0,0,145,156,0,0,253,38,1,0,101,12,2,0,233,119,3,0,153,162,5,0,53,214,8,0,45,112,13,0,225,228,19,0,33,195,28,0,237,183,40,0,117,146,56,0,89,72,77,0,41,250,103,0,37,248,137,0,61,199,180,0,81,38,234,0,177,19,44,1,221,210,124,1,133,242,222,1,201,82,85,2,185,43,227,2,21,20,140,3,77,8,84,4,193,113,63,5,65,46,83,6,205,151,148,7,149,140,9,9,57,119,184,10,73,87,168,12,5,202,224,14,93,19,106,17,49,39,77,20,209,178,147,23,189,38,72,27,165,192,117,31,169, + 149,40,36,217,156,109,41,245,185,82,47,109,200,230,53,161,166,57,61,97,65,92,69,173,159,96,78,181,238,89,88,25,142,92,99,105,28,126,111,229,131,213,124,255,189,0,0,1,168,1,0,143,107,3,0,241,158,6,0,63,35,12,0,193,61,21,0,143,182,35,0,241,252,57,0,255,81,91,0,1,250,139,0,15,117,209,0,113,191,50,1,63,154,184,1,193,220,109,2,15,207,95,3,113,142,158,4,255,123,61,6,1,182,83,8,143,156,252,10,241,97,88,14,63,167,140,18,193,37,197,23,143,101,52,30,241,129,20,38,255,251,167,47,1,156,58,59,15,98,34,73,113, + 134,192,89,63,138,130,109,193,88,227,132,1,14,4,0,145,33,9,0,17,44,19,0,65,238,37,0,65,79,71,0,145,67,128,0,17,247,221,0,1,70,115,1,1,146,90,2,17,1,184,3,145,53,188,5,65,143,167,8,65,6,206,12,17,178,155,18,145,15,154,26,1,26,118,37,1,76,7,52,145,158,87,71,17,157,172,96,65,166,145,129,35,81,22,0,197,158,50,0,23,185,107,0,153,246,216,0,107,137,160,1,13,196,254,2,31,1,80,5,33,217,29,9,51,108,48,15,213,162,164,24,167,103,8,39,41,253,125,60,123,181,231,91,29,119,29,137,175,160,45,201,173,142,123,0,137, + 230,25,1,57,150,94,2,61,22,216,4,181,99,119,9,225,40,198,17,33,3,52,32,117,72,130,56,125,87,87,96,191,91,175,2,129,216,39,6,247,132,94,13,233,254,173,27,127,139,235,54,129,183,229,104,23,3,156,193,193,12,255,14,57,106,133,34,25,238,145,75,129,120,43,158,51,225,9,84,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,172,21,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,72,87,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,249,99, + 0,0,116,87,0,0,24,22,0,0,128,7,0,0,3,0,0,0,248,23,0,0,48,39,0,0,104,39,0,0,160,39,0,0,216,39,0,0,136,1,0,0,166,94,0,0,224,100,0,0,104,102,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138, + 227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140, + 65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222, + 112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,158,87,0,0,48,24,0,0,0,0,0,0,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10, + 113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190, + 234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141, + 142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202, + 40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17, + 63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124, + 183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203, + 89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127, + 191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48, + 124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191, + 215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48, + 191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179, + 86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191, + 65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207, + 125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126, + 191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122, + 55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90, + 191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53, + 63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2, + 191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63, + 76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160, + 189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48, + 32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21, + 239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79, + 63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63, + 10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18, + 124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62, + 190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,94,91,0,0,48,24,0,0,0,0,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,93,0,0,48,24,0,0,0,0,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,94,0,0,48,24,0,0,0,0,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63],"i8",4,y.h); + O([107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125, + 63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63,123,180,120,63,78,129,120,63,115,77,120,63,234,24,120,63,178,227,119,63,205,173,119,63,58,119,119,63,249,63,119,63,10,8,119,63,110, + 207,118,63,37,150,118,63,47,92,118,63,140,33,118,63,60,230,117,63,64,170,117,63,151,109,117,63,66,48,117,63,65,242,116,63,148,179,116,63,59,116,116,63,55,52,116,63,135,243,115,63,44,178,115,63,38,112,115,63,118,45,115,63,26,234,114,63,20,166,114,63,100,97,114,63,10,28,114,63,5,214,113,63,87,143,113,63,0,72,113,63,255,255,112,63,85,183,112,63,2,110,112,63,6,36,112,63,98,217,111,63,21,142,111,63,32,66,111,63,132,245,110,63,63,168,110,63,83,90,110,63,192,11,110,63,134,188,109,63,165,108,109,63,29,28, + 109,63,239,202,108,63,27,121,108,63,161,38,108,63,128,211,107,63,187,127,107,63,80,43,107,63,64,214,106,63,140,128,106,63,50,42,106,63,53,211,105,63,147,123,105,63,77,35,105,63,100,202,104,63,216,112,104,63,168,22,104,63,213,187,103,63,96,96,103,63,72,4,103,63,143,167,102,63,51,74,102,63,54,236,101,63,151,141,101,63,87,46,101,63,119,206,100,63,245,109,100,63,212,12,100,63,18,171,99,63,177,72,99,63,176,229,98,63,16,130,98,63,209,29,98,63,243,184,97,63,119,83,97,63,92,237,96,63,164,134,96,63,78,31, + 96,63,91,183,95,63,203,78,95,63,158,229,94,63,213,123,94,63,112,17,94,63,110,166,93,63,210,58,93,63,154,206,92,63,198,97,92,63,89,244,91,63,81,134,91,63,174,23,91,63,114,168,90,63,157,56,90,63,46,200,89,63,39,87,89,63,135,229,88,63,79,115,88,63,127,0,88,63,23,141,87,63,24,25,87,63,130,164,86,63,86,47,86,63,147,185,85,63,58,67,85,63,75,204,84,63,199,84,84,63,174,220,83,63,1,100,83,63,191,234,82,63,233,112,82,63,127,246,81,63,130,123,81,63,242,255,80,63,207,131,80,63,26,7,80,63,210,137,79,63,250,11, + 79,63,144,141,78,63,148,14,78,63,9,143,77,63,237,14,77,63,65,142,76,63,5,13,76,63,59,139,75,63,225,8,75,63,249,133,74,63,131,2,74,63,127,126,73,63,238,249,72,63,207,116,72,63,36,239,71,63,237,104,71,63,41,226,70,63,218,90,70,63,0,211,69,63,155,74,69,63,172,193,68,63,50,56,68,63,47,174,67,63,162,35,67,63,141,152,66,63,239,12,66,63,200,128,65,63,26,244,64,63,229,102,64,63,40,217,63,63,229,74,63,63,27,188,62,63,204,44,62,63,247,156,61,63,157,12,61,63,190,123,60,63,92,234,59,63,117,88,59,63,10,198,58, + 63,29,51,58,63,173,159,57,63,187,11,57,63,71,119,56,63,81,226,55,63,218,76,55,63,227,182,54,63,107,32,54,63,116,137,53,63,253,241,52,63,7,90,52,63,147,193,51,63,160,40,51,63,48,143,50,63,66,245,49,63,216,90,49,63,241,191,48,63,142,36,48,63,175,136,47,63,85,236,46,63,129,79,46,63,50,178,45,63,105,20,45,63,39,118,44,63,107,215,43,63,55,56,43,63,139,152,42,63,103,248,41,63,204,87,41,63,186,182,40,63,50,21,40,63,51,115,39,63,191,208,38,63,214,45,38,63,121,138,37,63,167,230,36,63,97,66,36,63,169,157,35, + 63,125,248,34,63,223,82,34,63,207,172,33,63,77,6,33,63,91,95,32,63,248,183,31,63,37,16,31,63,226,103,30,63,48,191,29,63,16,22,29,63,129,108,28,63,132,194,27,63,26,24,27,63,67,109,26,63,0,194,25,63,81,22,25,63,54,106,24,63,177,189,23,63,193,16,23,63,103,99,22,63,163,181,21,63,118,7,21,63,225,88,20,63,228,169,19,63,127,250,18,63,179,74,18,63,128,154,17,63,231,233,16,63,232,56,16,63,132,135,15,63,187,213,14,63,142,35,14,63,254,112,13,63,10,190,12,63,179,10,12,63,250,86,11,63,223,162,10,63,99,238,9,63, + 134,57,9,63,73,132,8,63,172,206,7,63,175,24,7,63,84,98,6,63,155,171,5,63,131,244,4,63,15,61,4,63,61,133,3,63,15,205,2,63,134,20,2,63,161,91,1,63,97,162,0,63,143,209,255,62,167,93,254,62,14,233,252,62,194,115,251,62,198,253,249,62,27,135,248,62,193,15,247,62,186,151,245,62,6,31,244,62,168,165,242,62,158,43,241,62,236,176,239,62,145,53,238,62,144,185,236,62,232,60,235,62,154,191,233,62,169,65,232,62,21,195,230,62,223,67,229,62,8,196,227,62,145,67,226,62,124,194,224,62,200,64,223,62,120,190,221,62,140, + 59,220,62,6,184,218,62,230,51,217,62,46,175,215,62,223,41,214,62,249,163,212,62,125,29,211,62,110,150,209,62,204,14,208,62,151,134,206,62,210,253,204,62,125,116,203,62,153,234,201,62,39,96,200,62,40,213,198,62,159,73,197,62,138,189,195,62,236,48,194,62,198,163,192,62,25,22,191,62,230,135,189,62,45,249,187,62,241,105,186,62,50,218,184,62,241,73,183,62,47,185,181,62,238,39,180,62,47,150,178,62,242,3,177,62,57,113,175,62,4,222,173,62,86,74,172,62,47,182,170,62,144,33,169,62,122,140,167,62,239,246,165, + 62,239,96,164,62,124,202,162,62,151,51,161,62,64,156,159,62,122,4,158,62,68,108,156,62,161,211,154,62,145,58,153,62,22,161,151,62,48,7,150,62,225,108,148,62,41,210,146,62,11,55,145,62,135,155,143,62,158,255,141,62,81,99,140,62,162,198,138,62,145,41,137,62,32,140,135,62,80,238,133,62,34,80,132,62,151,177,130,62,176,18,129,62,222,230,126,62,169,167,123,62,195,103,120,62,47,39,117,62,238,229,113,62,4,164,110,62,115,97,107,62,60,30,104,62,98,218,100,62,232,149,97,62,207,80,94,62,26,11,91,62,204,196,87, + 62,230,125,84,62,107,54,81,62,93,238,77,62,191,165,74,62,146,92,71,62,218,18,68,62,151,200,64,62,206,125,61,62,128,50,58,62,174,230,54,62,93,154,51,62,141,77,48,62,66,0,45,62,125,178,41,62,66,100,38,62,145,21,35,62,110,198,31,62,219,118,28,62,218,38,25,62,109,214,21,62,152,133,18,62,91,52,15,62,186,226,11,62,183,144,8,62,84,62,5,62,148,235,1,62,240,48,253,61,6,138,246,61,113,226,239,61,51,58,233,61,79,145,226,61,207,231,219,61,181,61,213,61,3,147,206,61,192,231,199,61,242,59,193,61,156,143,186,61, + 195,226,179,61,108,53,173,61,155,135,166,61,85,217,159,61,159,42,153,61,126,123,146,61,246,203,139,61,11,28,133,61,135,215,124,61,70,118,111,61,93,20,98,61,214,177,84,61,185,78,71,61,16,235,57,61,229,134,44,61,64,34,31,61,44,189,17,61,178,87,4,61,181,227,237,60,96,23,211,60,118,74,184,60,11,125,157,60,50,175,130,60,250,193,79,60,254,36,26,60,42,15,201,59,153,167,59,59,46,125,214,185,210,70,113,187,171,222,227,187,166,140,39,188,129,41,93,188,225,98,137,188,160,48,164,188,236,253,190,188,179,202,217, + 188,224,150,244,188,49,177,7,189,147,22,21,189,140,123,34,189,19,224,47,189,30,68,61,189,165,167,74,189,157,10,88,189,254,108,101,189,190,206,114,189,234,23,128,189,27,200,134,189,237,119,141,189,92,39,148,189,99,214,154,189,253,132,161,189,38,51,168,189,217,224,174,189,17,142,181,189,202,58,188,189,254,230,194,189,170,146,201,189,200,61,208,189,84,232,214,189,74,146,221,189,164,59,228,189,93,228,234,189,114,140,241,189,221,51,248,189,154,218,254,189,82,192,2,190,252,18,6,190,71,101,9,190,50,183, + 12,190,186,8,16,190,221,89,19,190,152,170,22,190,234,250,25,190,208,74,29,190,71,154,32,190,78,233,35,190,225,55,39,190,0,134,42,190,166,211,45,190,211,32,49,190,131,109,52,190,181,185,55,190,101,5,59,190,147,80,62,190,58,155,65,190,90,229,68,190,240,46,72,190,249,119,75,190,116,192,78,190,93,8,82,190,179,79,85,190,115,150,88,190,156,220,91,190,42,34,95,190,27,103,98,190,109,171,101,190,31,239,104,190,44,50,108,190,148,116,111,190,84,182,114,190,106,247,117,190,211,55,121,190,141,119,124,190,150, + 182,127,190,117,122,129,190,69,25,131,190,185,183,132,190,208,85,134,190,136,243,135,190,225,144,137,190,218,45,139,190,112,202,140,190,164,102,142,190,116,2,144,190,223,157,145,190,228,56,147,190,129,211,148,190,182,109,150,190,129,7,152,190,226,160,153,190,215,57,155,190,95,210,156,190,121,106,158,190,35,2,160,190,94,153,161,190,38,48,163,190,125,198,164,190,96,92,166,190,206,241,167,190,198,134,169,190,71,27,171,190,80,175,172,190,224,66,174,190,245,213,175,190,143,104,177,190,173,250,178,190, + 77,140,180,190,110,29,182,190,16,174,183,190,48,62,185,190,207,205,186,190,234,92,188,190,130,235,189,190,148,121,191,190,31,7,193,190,35,148,194,190,159,32,196,190,145,172,197,190,248,55,199,190,211,194,200,190,34,77,202,190,226,214,203,190,19,96,205,190,181,232,206,190,197,112,208,190,66,248,209,190,45,127,211,190,131,5,213,190,67,139,214,190,109,16,216,190,255,148,217,190,249,24,219,190,89,156,220,190,29,31,222,190,70,161,223,190,211,34,225,190,193,163,226,190,16,36,228,190,190,163,229,190,204, + 34,231,190,56,161,232,190,0,31,234,190,36,156,235,190,162,24,237,190,122,148,238,190,171,15,240,190,51,138,241,190,18,4,243,190,70,125,244,190,207,245,245,190,170,109,247,190,217,228,248,190,88,91,250,190,40,209,251,190,71,70,253,190,181,186,254,190,56,23,0,191,187,208,0,191,228,137,1,191,178,66,2,191,37,251,2,191,59,179,3,191,246,106,4,191,83,34,5,191,83,217,5,191,245,143,6,191,56,70,7,191,29,252,7,191,162,177,8,191,199,102,9,191,140,27,10,191,240,207,10,191,243,131,11,191,147,55,12,191,209,234, + 12,191,172,157,13,191,36,80,14,191,56,2,15,191,232,179,15,191,50,101,16,191,24,22,17,191,151,198,17,191,176,118,18,191,99,38,19,191,174,213,19,191,145,132,20,191,13,51,21,191,31,225,21,191,200,142,22,191,8,60,23,191,221,232,23,191,72,149,24,191,72,65,25,191,220,236,25,191,4,152,26,191,192,66,27,191,15,237,27,191,240,150,28,191,99,64,29,191,104,233,29,191,254,145,30,191,37,58,31,191,220,225,31,191,35,137,32,191,250,47,33,191,95,214,33,191,82,124,34,191,212,33,35,191,227,198,35,191,127,107,36,191,167, + 15,37,191,92,179,37,191,157,86,38,191,104,249,38,191,191,155,39,191,160,61,40,191,11,223,40,191,255,127,41,191,125,32,42,191,131,192,42,191,17,96,43,191,39,255,43,191,196,157,44,191,232,59,45,191,146,217,45,191,195,118,46,191,121,19,47,191,180,175,47,191,115,75,48,191,183,230,48,191,127,129,49,191,203,27,50,191,153,181,50,191,234,78,51,191,189,231,51,191,18,128,52,191,232,23,53,191,63,175,53,191,22,70,54,191,110,220,54,191,69,114,55,191,156,7,56,191,113,156,56,191,197,48,57,191,150,196,57,191,230, + 87,58,191,178,234,58,191,252,124,59,191,194,14,60,191,3,160,60,191,193,48,61,191,250,192,61,191,173,80,62,191,219,223,62,191,131,110,63,191,165,252,63,191,64,138,64,191,83,23,65,191,224,163,65,191,228,47,66,191,96,187,66,191,83,70,67,191,190,208,67,191,158,90,68,191,246,227,68,191,194,108,69,191,5,245,69,191,188,124,70,191,232,3,71,191,137,138,71,191,157,16,72,191,37,150,72,191,32,27,73,191,142,159,73,191,111,35,74,191,193,166,74,191,134,41,75,191,188,171,75,191,99,45,76,191,122,174,76,191,2,47,77, + 191,250,174,77,191,98,46,78,191,57,173,78,191,126,43,79,191,51,169,79,191,85,38,80,191,230,162,80,191,228,30,81,191,80,154,81,191,40,21,82,191,109,143,82,191,30,9,83,191,59,130,83,191,195,250,83,191,183,114,84,191,22,234,84,191,223,96,85,191,18,215,85,191,176,76,86,191,183,193,86,191,39,54,87,191,0,170,87,191,66,29,88,191,236,143,88,191,254,1,89,191,120,115,89,191,89,228,89,191,162,84,90,191,81,196,90,191,102,51,91,191,226,161,91,191,195,15,92,191,10,125,92,191,183,233,92,191,200,85,93,191,62,193, + 93,191,24,44,94,191,87,150,94,191,249,255,94,191,255,104,95,191,104,209,95,191,51,57,96,191,98,160,96,191,243,6,97,191,229,108,97,191,58,210,97,191,240,54,98,191,8,155,98,191,128,254,98,191,89,97,99,191,146,195,99,191,44,37,100,191,37,134,100,191,126,230,100,191,55,70,101,191,78,165,101,191,197,3,102,191,154,97,102,191,205,190,102,191,94,27,103,191,77,119,103,191,154,210,103,191,68,45,104,191,75,135,104,191,174,224,104,191,111,57,105,191,139,145,105,191,4,233,105,191,217,63,106,191,9,150,106,191, + 148,235,106,191,123,64,107,191,188,148,107,191,89,232,107,191,79,59,108,191,160,141,108,191,75,223,108,191,79,48,109,191,173,128,109,191,101,208,109,191,117,31,110,191,223,109,110,191,161,187,110,191,187,8,111,191,46,85,111,191,248,160,111,191,27,236,111,191,149,54,112,191,103,128,112,191,144,201,112,191,15,18,113,191,230,89,113,191,19,161,113,191,151,231,113,191,113,45,114,191,160,114,114,191,38,183,114,191,1,251,114,191,50,62,115,191,184,128,115,191,148,194,115,191,196,3,116,191,73,68,116,191,34, + 132,116,191,80,195,116,191,210,1,117,191,168,63,117,191,210,124,117,191,80,185,117,191,33,245,117,191,69,48,118,191,189,106,118,191,136,164,118,191,166,221,118,191,22,22,119,191,217,77,119,191,239,132,119,191,87,187,119,191,17,241,119,191,29,38,120,191,122,90,120,191,42,142,120,191,43,193,120,191,125,243,120,191,33,37,121,191,22,86,121,191,92,134,121,191,242,181,121,191,218,228,121,191,18,19,122,191,154,64,122,191,115,109,122,191,157,153,122,191,22,197,122,191,223,239,122,191,248,25,123,191,97,67, + 123,191,26,108,123,191,34,148,123,191,122,187,123,191,32,226,123,191,23,8,124,191,92,45,124,191,240,81,124,191,211,117,124,191,5,153,124,191,134,187,124,191,85,221,124,191,115,254,124,191,223,30,125,191,154,62,125,191,163,93,125,191,250,123,125,191,159,153,125,191,146,182,125,191,211,210,125,191,98,238,125,191,63,9,126,191,105,35,126,191,225,60,126,191,167,85,126,191,186,109,126,191,27,133,126,191,201,155,126,191,196,177,126,191,13,199,126,191,162,219,126,191,133,239,126,191,181,2,127,191,50,21,127, + 191,252,38,127,191,19,56,127,191,118,72,127,191,39,88,127,191,36,103,127,191,110,117,127,191,5,131,127,191,232,143,127,191,25,156,127,191,149,167,127,191,95,178,127,191,116,188,127,191,215,197,127,191,133,206,127,191,129,214,127,191,200,221,127,191,93,228,127,191,61,234,127,191,106,239,127,191,227,243,127,191,169,247,127,191,187,250,127,191,25,253,127,191,196,254,127,191,187,255,127,191,250,255,127,63,57,254,127,63,169,249,127,63,75,242,127,63,30,232,127,63,35,219,127,63,89,203,127,63,193,184,127, + 63,91,163,127,63,40,139,127,63,39,112,127,63,90,82,127,63,191,49,127,63,88,14,127,63,37,232,126,63,38,191,126,63,92,147,126,63,200,100,126,63,105,51,126,63,65,255,125,63,79,200,125,63,150,142,125,63,20,82,125,63,203,18,125,63,188,208,124,63,231,139,124,63,77,68,124,63,239,249,123,63,205,172,123,63,233,92,123,63,67,10,123,63,221,180,122,63,182,92,122,63,209,1,122,63,46,164,121,63,206,67,121,63,178,224,120,63,220,122,120,63,76,18,120,63,4,167,119,63,4,57,119,63,79,200,118,63,228,84,118,63,198,222,117, + 63,246,101,117,63,117,234,116,63,68,108,116,63,101,235,115,63,218,103,115,63,163,225,114,63,194,88,114,63,57,205,113,63,9,63,113,63,52,174,112,63,187,26,112,63,160,132,111,63,228,235,110,63,138,80,110,63,147,178,109,63,1,18,109,63,213,110,108,63,17,201,107,63,183,32,107,63,201,117,106,63,73,200,105,63,57,24,105,63,155,101,104,63,111,176,103,63,186,248,102,63,124,62,102,63,184,129,101,63,111,194,100,63,164,0,100,63,90,60,99,63,145,117,98,63,76,172,97,63,142,224,96,63,89,18,96,63,174,65,95,63,145,110, + 94,63,3,153,93,63,8,193,92,63,160,230,91,63,207,9,91,63,152,42,90,63,251,72,89,63,253,100,88,63,159,126,87,63,229,149,86,63,208,170,85,63,99,189,84,63,161,205,83,63,140,219,82,63,39,231,81,63,117,240,80,63,121,247,79,63,52,252,78,63,171,254,77,63,223,254,76,63,212,252,75,63,140,248,74,63,10,242,73,63,82,233,72,63,101,222,71,63,71,209,70,63,251,193,69,63,132,176,68,63,229,156,67,63,32,135,66,63,58,111,65,63,52,85,64,63,19,57,63,63,216,26,62,63,136,250,60,63,38,216,59,63,180,179,58,63,54,141,57,63, + 175,100,56,63,34,58,55,63,147,13,54,63,5,223,52,63,124,174,51,63,249,123,50,63,130,71,49,63,25,17,48,63,194,216,46,63,127,158,45,63,86,98,44,63,72,36,43,63,90,228,41,63,144,162,40,63,235,94,39,63,113,25,38,63,37,210,36,63,9,137,35,63,35,62,34,63,117,241,32,63,4,163,31,63,210,82,30,63,228,0,29,63,61,173,27,63,225,87,26,63,211,0,25,63,25,168,23,63,180,77,22,63,170,241,20,63,253,147,19,63,178,52,18,63,204,211,16,63,80,113,15,63,66,13,14,63,164,167,12,63,124,64,11,63,205,215,9,63,154,109,8,63,233,1,7, + 63,189,148,5,63,25,38,4,63,3,182,2,63,126,68,1,63,28,163,255,62,110,186,252,62,250,206,249,62,202,224,246,62,228,239,243,62,81,252,240,62,26,6,238,62,71,13,235,62,224,17,232,62,237,19,229,62,119,19,226,62,135,16,223,62,36,11,220,62,88,3,217,62,42,249,213,62,164,236,210,62,205,221,207,62,175,204,204,62,82,185,201,62,191,163,198,62,254,139,195,62,24,114,192,62,22,86,189,62,0,56,186,62,224,23,183,62,189,245,179,62,161,209,176,62,149,171,173,62,162,131,170,62,207,89,167,62,39,46,164,62,178,0,161,62,121, + 209,157,62,133,160,154,62,223,109,151,62,143,57,148,62,160,3,145,62,26,204,141,62,5,147,138,62,107,88,135,62,86,28,132,62,205,222,128,62,182,63,123,62,16,191,116,62,187,59,110,62,201,181,103,62,77,45,97,62,89,162,90,62,255,20,84,62,81,133,77,62,99,243,70,62,70,95,64,62,13,201,57,62,202,48,51,62,144,150,44,62,114,250,37,62,130,92,31,62,210,188,24,62,118,27,18,62,127,120,11,62,1,212,4,62,29,92,252,61,114,13,239,61,41,188,225,61,102,104,212,61,78,18,199,61,8,186,185,61,184,95,172,61,132,3,159,61,146, + 165,145,61,7,70,132,61,18,202,109,61,122,5,83,61,145,62,56,61,164,117,29,61,252,170,2,61,202,189,207,60,86,35,154,60,97,14,73,60,197,167,187,59,61,122,86,186,9,70,241,187,18,221,99,188,80,138,167,188,65,36,221,188,227,93,9,189,35,40,36,189,150,240,62,189,242,182,89,189,234,122,116,189,26,158,135,189,66,253,148,189,200,90,162,189,134,182,175,189,87,16,189,189,22,104,202,189,155,189,215,189,195,16,229,189,105,97,242,189,101,175,255,189,74,125,6,190,104,33,13,190,250,195,19,190,237,100,26,190,46,4,33, + 190,172,161,39,190,83,61,46,190,16,215,52,190,210,110,59,190,134,4,66,190,25,152,72,190,121,41,79,190,148,184,85,190,86,69,92,190,174,207,98,190,137,87,105,190,214,220,111,190,128,95,118,190,120,223,124,190,84,174,129,190,129,235,132,190,56,39,136,190,114,97,139,190,36,154,142,190,69,209,145,190,205,6,149,190,179,58,152,190,238,108,155,190,116,157,158,190,61,204,161,190,64,249,164,190,115,36,168,190,207,77,171,190,73,117,174,190,218,154,177,190,120,190,180,190,27,224,183,190,186,255,186,190,75,29, + 190,190,199,56,193,190,37,82,196,190,91,105,199,190,97,126,202,190,48,145,205,190,188,161,208,190,0,176,211,190,241,187,214,190,135,197,217,190,186,204,220,190,129,209,223,190,211,211,226,190,169,211,229,190,250,208,232,190,189,203,235,190,234,195,238,190,120,185,241,190,96,172,244,190,154,156,247,190,28,138,250,190,223,116,253,190,109,46,0,191,3,161,1,191,45,18,3,191,230,129,4,191,44,240,5,191,250,92,7,191,76,200,8,191,30,50,10,191,108,154,11,191,50,1,13,191,108,102,14,191,23,202,15,191,45,44,17, + 191,172,140,18,191,144,235,19,191,213,72,21,191,118,164,22,191,113,254,23,191,192,86,25,191,98,173,26,191,81,2,28,191,138,85,29,191,9,167,30,191,203,246,31,191,204,68,33,191,9,145,34,191,124,219,35,191,36,36,37,191,253,106,38,191,2,176,39,191,48,243,40,191,132,52,42,191,250,115,43,191,143,177,44,191,63,237,45,191,7,39,47,191,227,94,48,191,208,148,49,191,202,200,50,191,206,250,51,191,218,42,53,191,232,88,54,191,247,132,55,191,2,175,56,191,7,215,57,191,3,253,58,191,241,32,60,191,207,66,61,191,154,98, + 62,191,79,128,63,191,233,155,64,191,104,181,65,191,198,204,66,191,1,226,67,191,23,245,68,191,3,6,70,191,196,20,71,191,86,33,72,191,182,43,73,191,225,51,74,191,212,57,75,191,141,61,76,191,9,63,77,191,68,62,78,191,61,59,79,191,240,53,80,191,90,46,81,191,121,36,82,191,74,24,83,191,202,9,84,191,247,248,84,191,206,229,85,191,77,208,86,191,112,184,87,191,55,158,88,191,156,129,89,191,160,98,90,191,62,65,91,191,117,29,92,191,65,247,92,191,162,206,93,191,148,163,94,191,20,118,95,191,34,70,96,191,186,19,97, + 191,217,222,97,191,127,167,98,191,169,109,99,191,84,49,100,191,126,242,100,191,38,177,101,191,73,109,102,191,229,38,103,191,248,221,103,191,128,146,104,191,123,68,105,191,232,243,105,191,195,160,106,191,12,75,107,191,192,242,107,191,222,151,108,191,100,58,109,191,80,218,109,191,160,119,110,191,83,18,111,191,102,170,111,191,217,63,112,191,169,210,112,191,213,98,113,191,91,240,113,191,58,123,114,191,113,3,115,191,253,136,115,191,222,11,116,191,17,140,116,191,150,9,117,191,107,132,117,191,143,252,117, + 191,0,114,118,191,189,228,118,191,198,84,119,191,24,194,119,191,178,44,120,191,147,148,120,191,187,249,120,191,40,92,121,191,217,187,121,191,205,24,122,191,2,115,122,191,121,202,122,191,47,31,123,191,36,113,123,191,88,192,123,191,201,12,124,191,118,86,124,191,95,157,124,191,130,225,124,191,224,34,125,191,119,97,125,191,71,157,125,191,79,214,125,191,142,12,126,191,4,64,126,191,176,112,126,191,146,158,126,191,169,201,126,191,245,241,126,191,117,23,127,191,41,58,127,191,16,90,127,191,43,119,127,191, + 120,145,127,191,248,168,127,191,170,189,127,191,143,207,127,191,165,222,127,191,237,234,127,191,102,244,127,191,17,251,127,191,237,254,127,191,234,255,127,63,229,248,127,63,166,230,127,63,45,201,127,63,124,160,127,63,149,108,127,63,121,45,127,63,44,227,126,63,177,141,126,63,11,45,126,63,63,193,125,63,82,74,125,63,72,200,124,63,40,59,124,63,247,162,123,63,189,255,122,63,128,81,122,63,72,152,121,63,30,212,120,63,9,5,120,63,19,43,119,63,70,70,118,63,172,86,117,63,78,92,116,63,56,87,115,63,118,71,114, + 63,19,45,113,63,28,8,112,63,158,216,110,63,165,158,109,63,64,90,108,63,126,11,107,63,107,178,105,63,25,79,104,63,150,225,102,63,242,105,101,63,62,232,99,63,139,92,98,63,234,198,96,63,109,39,95,63,38,126,93,63,40,203,91,63,133,14,90,63,83,72,88,63,163,120,86,63,139,159,84,63,32,189,82,63,118,209,80,63,163,220,78,63,189,222,76,63,219,215,74,63,19,200,72,63,124,175,70,63,46,142,68,63,65,100,66,63,206,49,64,63,236,246,61,63,180,179,59,63,66,104,57,63,173,20,55,63,16,185,52,63,134,85,50,63,41,234,47,63, + 21,119,45,63,101,252,42,63,53,122,40,63,161,240,37,63,198,95,35,63,192,199,32,63,172,40,30,63,169,130,27,63,212,213,24,63,74,34,22,63,42,104,19,63,147,167,16,63,164,224,13,63,123,19,11,63,57,64,8,63,253,102,5,63,231,135,2,63,45,70,255,62,91,113,249,62,151,145,243,62,36,167,237,62,69,178,231,62,60,179,225,62,76,170,219,62,186,151,213,62,201,123,207,62,190,86,201,62,223,40,195,62,112,242,188,62,183,179,182,62,251,108,176,62,129,30,170,62,146,200,163,62,115,107,157,62,108,7,151,62,197,156,144,62,199, + 43,138,62,185,180,131,62,199,111,122,62,33,107,109,62,17,92,96,62,41,67,83,62,253,32,70,62,32,246,56,62,38,195,43,62,164,136,30,62,45,71,17,62,87,255,3,62,110,99,237,61,194,189,210,61,218,14,184,61,222,87,157,61,251,153,130,61,188,172,79,61,101,28,26,61,153,10,201,60,42,167,59,60,193,120,214,186,45,68,113,188,87,215,227,188,76,129,39,189,148,15,93,189,21,74,137,189,90,6,164,189,109,187,190,189,34,104,217,189,78,11,244,189,227,81,7,190,47,152,20,190,247,215,33,190,165,16,47,190,166,65,60,190,100,106, + 73,190,77,138,86,190,205,160,99,190,80,173,112,190,69,175,125,190,13,83,133,190,158,200,139,190,13,56,146,190,18,161,152,190,102,3,159,190,191,94,165,190,216,178,171,190,105,255,177,190,43,68,184,190,216,128,190,190,42,181,196,190,219,224,202,190,165,3,209,190,69,29,215,190,117,45,221,190,241,51,227,190,118,48,233,190,192,34,239,190,141,10,245,190,155,231,250,190,211,92,0,191,56,64,3,191,219,29,6,191,155,245,8,191,90,199,11,191,247,146,14,191,84,88,17,191,80,23,20,191,205,207,22,191,172,129,25,191, + 208,44,28,191,26,209,30,191,109,110,33,191,171,4,36,191,183,147,38,191,116,27,41,191,199,155,43,191,147,20,46,191,187,133,48,191,38,239,50,191,183,80,53,191,85,170,55,191,227,251,57,191,74,69,60,191,110,134,62,191,55,191,64,191,139,239,66,191,83,23,69,191,117,54,71,191,218,76,73,191,107,90,75,191,16,95,77,191,179,90,79,191,62,77,81,191,154,54,83,191,179,22,85,191,114,237,86,191,197,186,88,191,149,126,90,191,208,56,92,191,98,233,93,191,56,144,95,191,64,45,97,191,103,192,98,191,156,73,100,191,206,200, + 101,191,235,61,103,191,227,168,104,191,167,9,106,191,39,96,107,191,84,172,108,191,31,238,109,191,122,37,111,191,88,82,112,191,171,116,113,191,103,140,114,191,127,153,115,191,231,155,116,191,149,147,117,191,126,128,118,191,150,98,119,191,212,57,120,191,47,6,121,191,158,199,121,191,23,126,122,191,148,41,123,191,13,202,123,191,122,95,124,191,213,233,124,191,24,105,125,191,62,221,125,191,64,70,126,191,28,164,126,191,204,246,126,191,77,62,127,191,156,122,127,191,182,171,127,191,153,209,127,191,67,236, + 127,191,180,251,127,191,166,255,127,63,148,227,127,63,156,154,127,63,204,36,127,63,56,130,126,63,253,178,125,63,63,183,124,63,42,143,123,63,243,58,122,63,212,186,120,63,17,15,119,63,246,55,117,63,213,53,115,63,8,9,113,63,241,177,110,63,249,48,108,63,144,134,105,63,47,179,102,63,83,183,99,63,132,147,96,63,78,72,93,63,69,214,89,63,3,62,86,63,43,128,82,63,101,157,78,63,94,150,74,63,204,107,70,63,106,30,66,63,249,174,61,63,64,30,57,63,13,109,52,63,50,156,47,63,135,172,42,63,235,158,37,63,63,116,32,63, + 109,45,27,63,97,203,21,63,13,79,16,63,104,185,10,63,107,11,5,63,46,140,254,62,221,212,242,62,241,242,230,62,127,232,218,62,166,183,206,62,136,98,194,62,78,235,181,62,42,84,169,62,81,159,156,62,253,206,143,62,109,229,130,62,206,201,107,62,98,159,81,62,48,80,55,62,211,224,28,62,241,85,2,62,98,104,207,61,124,0,154,61,36,251,72,61,27,164,187,60,243,119,86,187,100,61,241,188,187,192,99,189,103,93,167,189,20,189,220,189,3,251,8,190,115,127,35,190,52,231,61,190,164,45,88,190,38,78,114,190,18,34,134,190, + 137,5,147,190,52,207,159,190,213,124,172,190,51,12,185,190,26,123,197,190,91,199,209,190,205,238,221,190,80,239,233,190,199,198,245,190,144,185,0,191,38,121,6,191,36,33,12,191,141,176,17,191,102,38,23,191,186,129,28,191,152,193,33,191,21,229,38,191,74,235,43,191,86,211,48,191,91,156,53,191,131,69,58,191,253,205,62,191,252,52,67,191,188,121,71,191,125,155,75,191,132,153,79,191,31,115,83,191,161,39,87,191,99,182,90,191,198,30,94,191,48,96,97,191,15,122,100,191,216,107,103,191,7,53,106,191,31,213,108, + 191,169,75,111,191,55,152,113,191,98,186,115,191,201,177,117,191,22,126,119,191,246,30,121,191,33,148,122,191,85,221,123,191,89,250,124,191,250,234,125,191,14,175,126,191,116,70,127,191,15,177,127,191,206,238,127,191,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,0,0,206,64,0,0,200,64,0,0,184,64,0,0,170,64,0,0,162,64,0,0,154,64,0,0,144,64,0,0,140,64,0,0,156,64,0,0,150,64,0,0,146,64,0,0,142,64,0,0,156,64,0,0,148,64,0, + 0,138,64,0,0,144,64,0,0,140,64,0,0,148,64,0,0,152,64,0,0,142,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,134,107,63,0,20,46,63,0,112,189,62,0,208,76,62,0,0,102,63,0,0,76,63,0,0,38,63,0,0,0,63,15,0,0,0,10,0,0,0,5,0,0,0,6,0,0,0,4,0,0,0,3,0,0,0,191,104,0,0,199,104,0,0,215,104,0,0,247,104,0,0,255,104,0,0,15,105,0,0,47,105,0,0,87,105,0,0,167,105,0,0,71,106,0,0,79,106,0,0,95,106,0,0,32,0,10,0,20,46,100,1,130,106,0,0,194,107,0,0,2,108,0,0,20,108,0,0,180,108,0,0,252,108,0,0,134,95,0,0,32, + 0,16,0,102,38,171,1,68,109,0,0,68,111,0,0,132,111,0,0,162,111,0,0,162,112,0,0,234,112,0,0,156,95,0,0,0,0,0,0,64,31,0,0,184,36,0,0,236,44,0,0,188,52,0,0,92,68,0,0,168,97,0,0,128,56,1,0,0,0,0,0,40,35,0,0,224,46,0,0,164,56,0,0,68,72,0,0,180,95,0,0,172,138,0,0,128,56,1,0,0,0,0,0,4,41,0,0,176,54,0,0,104,66,0,0,252,83,0,0,84,111,0,0,16,164,0,0,128,56,1,0,77,113,0,0,80,113,0,0,10,103,242,14,86,205,228,29,10,103,242,14,117,82,130,12,89,154,4,25,117,82,130,12,70,17,49,10,237,3,98,20,70,17,49,10,218,2,215, + 7,249,198,173,15,218,2,215,7,34,182,82,5,218,250,164,10,34,182,82,5,70,243,46,30,43,227,75,14,31,102,128,24,28,44,29,10,218,97,72,18,237,156,244,6,236,48,19,11,227,144,165,4,237,164,29,2,10,223,107,3,48,117,0,0,112,23,0,0,32,209,255,255,32,209,255,255,0,64,0,0,108,34,0,0,66,15,0,0,18,6,0,0,77,2,0,0,219,0,0,0,237,0,0,0,153,0,0,0,73,0,0,0,30,0,0,0,12,0,0,0,7,0,0,0,0,64,0,0,147,93,0,0,189,112,0,0,237,121,0,0,178,125,0,0,36,127,0,0,0,250,0,0,128,62,0,0,160,140,0,0,128,62,0,0,248,42,0,0,232,3,0,0,176, + 54,0,0,232,3,0,0,8,82,0,0,208,7,0,0,96,109,0,0,208,7,0,0,224,46,0,0,232,3,0,0,80,70,0,0,208,7,0,0,8,82,0,0,208,7,0,0,48,117,0,0,208,7,0,0,248,42,0,0,232,3,0,0,176,54,0,0,232,3,0,0,104,66,0,0,232,3,0,0,8,82,0,0,208,7,0,0,224,46,0,0,232,3,0,0,152,58,0,0,232,3,0,0,80,70,0,0,208,7,0,0,240,85,0,0,208,7,0,0,230,90,52,56,119,78,51,57,211,217,201,57,146,145,51,58,204,96,140,58,97,251,201,58,153,126,9,59,203,128,51,59,213,37,99,59,119,46,140,59,168,138,169,59,69,184,201,59,135,166,236,59,232,46,9,60,174,102, + 29,60,247,2,51,60,147,255,73,60,79,88,98,60,94,17,124,60,46,145,139,60,189,199,153,60,92,172,168,60,243,60,184,60,129,121,200,60,238,95,217,60,57,240,234,60,99,42,253,60,53,7,8,61,16,204,17,61,205,228,27,61,97,80,38,61,203,14,49,61,0,31,60,61,254,128,71,61,198,52,83,61,63,56,95,61,105,139,107,61,69,46,120,61,105,144,130,61,123,48,137,61,224,247,143,61,138,229,150,61,123,249,157,61,177,51,165,61,33,147,172,61,80,24,180,61,51,194,187,61,79,145,195,61,18,132,203,61,2,155,211,61,31,214,219,61,215,51, + 228,61,175,180,236,61,33,88,245,61,168,29,254,61,161,130,3,62,242,6,8,62,199,155,12,62,221,64,17,62,52,246,21,62,69,187,26,62,17,144,31,62,84,116,36,62,203,103,41,62,51,106,46,62,141,123,51,62,82,155,56,62,197,201,61,62,28,6,67,62,89,80,72,62,122,168,77,62,183,13,83,62,82,128,88,62,8,0,94,62,84,140,99,62,242,36,105,62,37,202,110,62,36,123,116,62,172,55,122,62,0,0,128,62,171,233,130,62,249,216,133,62,133,205,136,62,80,199,139,62,55,198,142,62,247,201,145,62,179,210,148,62,38,224,151,62,15,242,154, + 62,108,8,158,62,28,35,161,62,255,65,164,62,208,100,167,62,177,139,170,62,28,182,173,62,84,228,176,62,211,21,180,62,186,74,183,62,232,130,186,62,249,189,189,62,13,252,192,62,226,60,196,62,86,128,199,62,71,198,202,62,149,14,206,62,251,88,209,62,122,165,212,62,241,243,215,62,28,68,219,62,217,149,222,62,8,233,225,62,167,61,229,62,83,147,232,62,12,234,235,62,175,65,239,62,28,154,242,62,14,243,245,62,136,76,249,62,34,166,252,62,0,0,0,63,239,172,1,63,188,89,3,63,121,6,5,63,242,178,6,63,41,95,8,63,250,10, + 10,63,86,182,11,63,44,97,13,63,124,11,15,63,19,181,16,63,242,93,18,63,8,6,20,63,67,173,21,63,130,83,23,63,182,248,24,63,220,156,26,63,213,63,28,63,143,225,29,63,249,129,31,63,4,33,33,63,140,190,34,63,163,90,36,63,23,245,37,63,214,141,39,63,242,36,41,63,40,186,42,63,152,77,44,63,1,223,45,63,114,110,47,63,202,251,48,63,249,134,50,63,237,15,52,63,167,150,53,63,4,27,55,63,229,156,56,63,88,28,58,63,61,153,59,63,131,19,61,63,42,139,62,63,0,0,64,63,21,114,65,63,55,225,66,63,119,77,68,63,195,182,69,63,235, + 28,71,63,254,127,72,63,236,223,73,63,146,60,75,63,225,149,76,63,234,235,77,63,121,62,79,63,143,141,80,63,43,217,81,63,29,33,83,63,115,101,84,63,13,166,85,63,235,226,86,63,252,27,88,63,47,81,89,63,115,130,90,63,201,175,91,63,14,217,92,63,67,254,93,63,88,31,95,63,75,60,96,63,252,84,97,63,106,105,98,63,133,121,99,63,60,133,100,63,160,140,101,63,126,143,102,63,214,141,103,63,186,135,104,63,246,124,105,63,156,109,106,63,138,89,107,63,209,64,108,63,79,35,109,63,4,1,110,63,241,217,110,63,243,173,111,63, + 28,125,112,63,73,71,113,63,124,12,114,63,180,204,114,63,240,135,115,63,16,62,116,63,19,239,116,63,250,154,117,63,179,65,118,63,63,227,118,63,141,127,119,63,173,22,120,63,126,168,120,63,1,53,121,63,52,188,121,63,24,62,122,63,157,186,122,63,194,49,123,63,119,163,123,63,187,15,124,63,159,118,124,63,2,216,124,63,244,51,125,63,101,138,125,63,68,219,125,63,179,38,126,63,143,108,126,63,235,172,126,63,163,231,126,63,218,28,127,63,127,76,127,63,129,118,127,63,2,155,127,63,208,185,127,63,28,211,127,63,197, + 230,127,63,203,244,127,63,47,253,127,63,0,0,128,63,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,160,0,0,0,200,0,0,0,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62, + 0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,208,37,180,62,151,57,173,62,9,165,159,62,250,237,139,62,205,172,101,62,248,169,42,62,52,48,210,61,90,241,13,61,90,241,13,189,52,48,210,189,248,169,42,190,205,172,101,190,250,237,139,190,9,165,159,190,151,57,173,190,208,37,180,190,135,138,177,62,27,131,150,62,96,35,73,62,196,66,141,61,196,66,141,189,96,35,73,190,27,131,150,190,135,138,177,190,135,138,177,190,27,131,150,190,96,35,73,190,196,66,141,189,196,66,141, + 61,96,35,73,62,27,131,150,62,135,138,177,62,151,57,173,62,205,172,101,62,90,241,13,61,248,169,42,190,9,165,159,190,208,37,180,190,250,237,139,190,52,48,210,189,52,48,210,61,250,237,139,62,208,37,180,62,9,165,159,62,248,169,42,62,90,241,13,189,205,172,101,190,151,57,173,190,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167, + 62,9,165,159,62,90,241,13,61,250,237,139,190,151,57,173,190,52,48,210,189,205,172,101,62,208,37,180,62,248,169,42,62,248,169,42,190,208,37,180,190,205,172,101,190,52,48,210,61,151,57,173,62,250,237,139,62,90,241,13,189,9,165,159,190,27,131,150,62,196,66,141,189,135,138,177,190,96,35,73,190,96,35,73,62,135,138,177,62,196,66,141,61,27,131,150,190,27,131,150,190,196,66,141,61,135,138,177,62,96,35,73,62,96,35,73,190,135,138,177,190,196,66,141,189,27,131,150,62,250,237,139,62,248,169,42,190,151,57,173, + 190,90,241,13,61,208,37,180,62,52,48,210,61,9,165,159,190,205,172,101,190,205,172,101,62,9,165,159,62,52,48,210,189,208,37,180,190,90,241,13,189,151,57,173,62,248,169,42,62,250,237,139,190,0,0,0,0,5,193,35,61,233,125,163,61,37,150,244,61,226,116,34,62,172,28,74,62,221,37,113,62,52,186,139,62,180,119,158,62,228,191,176,62,173,136,194,62,37,201,211,62,24,122,228,62,24,149,244,62,200,10,2,63,28,124,9,63,73,157,16,63,202,109,23,63,192,237,29,63,159,29,36,63,84,254,41,63,46,145,47,63,224,215,52,63,99, + 212,57,63,240,136,62,63,211,247,66,63,171,35,71,63,23,15,75,63,216,188,78,63,173,47,82,63,106,106,85,63,206,111,88,63,154,66,91,63,142,229,93,63,75,91,96,63,110,166,98,63,100,201,100,63,155,198,102,63,111,160,104,63,247,88,106,63,128,242,107,63,223,110,109,63,11,208,110,63,202,23,112,63,224,71,113,63,225,97,114,63,77,103,115,63,150,89,116,63,12,58,117,63,255,9,118,63,138,202,118,63,187,124,119,63,192,33,120,63,98,186,120,63,157,71,121,63,75,202,121,63,36,67,122,63,242,178,122,63,59,26,123,63,200, + 121,123,63,32,210,123,63,200,35,124,63,55,111,124,63,242,180,124,63,94,245,124,63,224,48,125,63,236,103,125,63,183,154,125,63,180,201,125,63,6,245,125,63,17,29,126,63,24,66,126,63,78,100,126,63,211,131,126,63,253,160,126,63,237,187,126,63,195,212,126,63,179,235,126,63,239,0,127,63,135,20,127,63,141,38,127,63,67,55,127,63,170,70,127,63,227,84,127,63,15,98,127,63,47,110,127,63,100,121,127,63,190,131,127,63,63,141,127,63,24,150,127,63,56,158,127,63,194,165,127,63,163,172,127,63,16,179,127,63,245,184, + 127,63,119,190,127,63,114,195,127,63,25,200,127,63,108,204,127,63,91,208,127,63,6,212,127,63,111,215,127,63,131,218,127,63,102,221,127,63,21,224,127,63,130,226,127,63,205,228,127,63,230,230,127,63,205,232,127,63,146,234,127,63,70,236,127,63,200,237,127,63,40,239,127,63,120,240,127,63,166,241,127,63,195,242,127,63,191,243,127,63,186,244,127,63,148,245,127,63,94,246,127,63,39,247,127,63,207,247,127,63,119,248,127,63,253,248,127,63,148,249,127,63,9,250,127,63,127,250,127,63,244,250,127,63,89,251,127, + 63,173,251,127,63,1,252,127,63,84,252,127,63,152,252,127,63,219,252,127,63,30,253,127,63,80,253,127,63,130,253,127,63,181,253,127,63,231,253,127,63,9,254,127,63,59,254,127,63,93,254,127,63,126,254,127,63,143,254,127,63,176,254,127,63,210,254,127,63,227,254,127,63,244,254,127,63,21,255,127,63,38,255,127,63,55,255,127,63,71,255,127,63,88,255,127,63,88,255,127,63,105,255,127,63,122,255,127,63,122,255,127,63,139,255,127,63,155,255,127,63,155,255,127,63,155,255,127,63,172,255,127,63,172,255,127,63,189, + 255,127,63,189,255,127,63,189,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63],"i8",4,y.h+10240); + O([206,255,127,63,206,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,3,0,0,0,148,80,0,0,160,80,0,0,25,0,0,0,15,0,0,0,2,0,0,0,14,190, + 192,189,172,31,155,190,149,130,26,191,150,149,70,190,84,114,62,190,146,3,26,191,6,152,62,189,2,160,234,189,182,43,212,189,185,114,30,191,106,190,162,190,28,7,46,190,107,243,143,189,90,158,23,62,33,173,209,62,10,102,12,63,125,60,188,62,20,33,253,190,143,169,67,63,8,119,235,191,10,243,46,62,117,147,76,65,80,83,139,191,108,236,162,191,181,21,130,193,28,107,193,65,162,98,178,192,255,231,48,190,47,79,39,190,158,206,101,190,255,87,194,189,155,60,149,189,203,248,135,190,44,97,205,189,203,33,83,189,64,166, + 21,190,238,35,247,189,160,253,56,190,219,167,3,62,233,95,226,62,213,202,252,190,29,203,43,62,231,168,83,62,1,79,74,190,247,3,214,62,71,119,192,63,173,249,69,191,64,164,32,193,43,194,205,62,192,178,62,64,201,118,115,65,100,204,241,191,39,165,152,191,23,204,233,60,134,193,132,187,201,232,144,61,84,72,7,60,154,231,189,189,103,71,42,188,59,137,140,187,159,122,160,187,88,90,145,189,85,196,39,187,169,11,34,61,177,219,103,62,241,54,5,61,52,17,38,62,170,10,205,189,86,185,248,62,108,4,2,62,86,102,146,62,228, + 254,126,60,106,251,215,61,159,142,67,64,136,70,147,63,57,40,129,191,71,90,234,191,139,84,84,64,210,53,91,192,13,253,243,189,232,39,38,189,25,31,226,59,241,90,147,60,171,170,28,189,237,238,195,59,5,106,150,188,246,141,249,58,37,201,19,190,106,115,50,189,210,214,129,58,161,100,98,62,158,210,17,62,128,215,247,62,221,12,207,62,124,15,3,63,250,242,114,190,55,139,119,62,47,110,179,62,183,13,51,191,136,99,38,65,18,165,41,64,83,208,27,192,53,7,134,192,125,150,135,63,60,247,218,63,12,212,218,59,186,186,147, + 189,191,192,34,189,69,144,20,61,38,112,235,189,208,37,193,188,210,156,6,60,124,58,104,188,114,11,7,189,31,26,17,189,171,204,53,59,154,208,148,190,218,230,146,191,140,104,163,190,89,193,47,191,163,233,188,62,64,50,245,62,253,245,58,62,163,119,210,190,8,144,97,63,39,107,147,192,33,31,188,63,224,243,171,62,161,214,232,191,245,91,241,193,8,172,177,64,252,177,255,58,106,21,253,189,37,245,148,189,41,102,131,189,252,233,90,189,35,134,221,189,20,249,191,189,43,237,142,189,75,171,225,188,167,236,68,190,122, + 110,225,189,172,28,146,62,105,170,207,190,7,203,189,61,35,101,147,190,201,231,89,191,252,194,203,189,212,95,111,190,111,129,164,191,13,108,145,63,155,201,71,64,187,39,143,189,66,91,238,191,113,201,41,64,120,238,233,192,26,168,28,64,135,138,146,186,54,152,129,189,127,33,26,189,138,114,25,190,229,100,18,62,247,202,60,62,113,202,252,61,117,220,154,61,70,65,240,61,200,40,191,61,71,193,141,61,22,144,172,61,175,81,144,61,27,166,113,61,173,246,192,61,61,209,229,190,92,47,215,60,148,107,138,62,106,78,134, + 190,98,186,48,62,49,37,0,64,133,9,35,190,99,96,29,61,26,81,35,65,182,248,132,64,7,206,21,192,120,99,97,189,79,18,30,60,98,186,16,190,8,223,224,60,187,222,12,61,136,166,71,189,97,152,194,61,35,245,253,187,158,146,24,189,185,155,179,187,187,236,135,189,45,182,196,61,230,206,76,190,12,24,41,189,251,87,22,63,48,68,83,61,142,172,172,62,218,226,90,63,93,26,43,63,202,82,235,189,178,75,104,192,37,89,239,190,177,164,92,190,57,98,39,64,145,238,207,62,180,142,174,191,203,61,46,61,20,5,250,61,210,98,191,61,67, + 4,252,61,160,165,11,61,155,226,17,190,245,130,15,61,15,250,72,189,55,41,150,61,113,52,108,61,83,235,253,61,185,215,83,189,147,139,129,190,69,47,23,63,113,89,21,62,238,95,161,62,207,217,98,62,177,168,24,190,79,89,93,62,127,251,178,190,253,135,196,65,161,131,126,191,11,66,29,63,242,82,150,193,27,76,53,192,69,128,55,191,84,196,177,190,253,130,245,62,128,238,123,190,215,96,155,61,137,150,12,62,211,19,54,190,185,51,243,61,46,253,141,186,175,7,115,190,129,34,182,62,33,7,5,190,218,78,96,189,101,28,163,190, + 21,171,166,190,107,211,56,62,171,31,128,189,183,155,16,62,40,41,176,62,24,207,192,62,95,126,23,191,102,247,186,64,170,241,194,190,46,56,99,62,239,172,181,191,48,108,229,201,122,170,171,63,218,31,232,60,27,113,55,189,162,59,173,188,127,121,210,188,9,192,100,60,236,86,170,60,101,102,48,188,198,207,53,60,202,13,112,61,62,180,207,188,178,134,6,189,121,35,243,61,78,38,94,190,247,62,21,62,230,93,245,61,106,111,187,189,198,21,247,189,41,83,161,189,106,23,19,190,134,89,24,191,188,116,147,191,198,109,160, + 191,181,224,149,191,42,227,138,64,64,26,110,201,249,102,175,191,204,76,36,189,13,168,87,62,141,239,11,190,159,57,11,62,64,87,86,189,28,28,54,61,199,207,107,60,239,56,135,59,170,27,158,188,226,177,95,62,162,178,225,189,236,163,1,192,165,17,107,63,28,8,29,192,134,3,153,63,184,86,123,189,48,18,246,191,186,192,157,62,172,202,254,62,42,144,105,63,102,75,86,62,147,24,22,192,95,94,12,64,39,20,207,192,144,78,217,63,169,161,57,191,112,218,66,60,77,206,26,61,109,235,98,61,109,130,185,60,243,67,144,189,93,3, + 246,188,182,124,73,60,72,233,136,187,62,158,140,189,125,64,0,61,219,50,32,61,194,108,186,62,242,165,193,189,126,80,188,60,194,81,50,190,228,218,168,62,44,239,234,61,112,182,153,62,62,33,219,61,18,136,7,62,8,148,185,64,125,118,104,63,80,195,103,191,88,202,86,192,248,56,67,62,207,161,60,62,50,116,44,191,208,94,109,62,213,29,112,189,65,74,108,62,216,101,224,190,240,193,123,62,23,72,48,190,182,123,179,61,121,115,56,191,85,106,38,62,85,187,139,60,143,114,208,61,117,230,198,62,213,38,170,63,2,241,138,63, + 108,177,111,191,51,167,23,192,66,9,215,192,144,102,92,192,241,215,8,64,116,181,99,65,82,68,157,64,20,203,69,192,16,18,27,193,252,170,68,191,164,228,229,63,75,35,97,61,17,82,39,62,16,59,163,61,253,223,12,61,211,175,99,189,237,178,165,187,217,102,153,60,110,201,5,61,34,162,189,60,175,119,31,62,154,15,67,61,75,120,130,190,151,255,204,63,210,28,77,191,119,132,35,64,65,213,60,63,19,102,174,191,221,9,50,191,71,90,28,192,62,174,221,191,131,250,124,64,205,1,242,63,101,224,248,62,75,89,53,193,128,147,112, + 74,249,75,195,190,126,29,248,61,94,44,104,191,249,20,60,64,51,196,209,63,231,255,97,63,2,213,95,63,45,207,155,63,46,226,95,191,166,182,164,62,93,249,72,63,160,81,114,63,134,55,19,191,62,203,93,192,34,137,98,63,173,62,189,61,144,131,30,193,116,93,200,62,10,242,35,62,170,43,3,192,240,167,132,64,210,22,140,61,58,60,20,190,123,16,146,190,69,44,194,62,116,70,148,191,167,29,227,188,154,153,29,193,16,93,154,192,51,167,109,64,139,224,119,64,26,163,97,64,0,64,202,69,27,76,255,82,130,90,179,98,162,107,96,117, + 0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,10,0,12,0,14,0,16,0,20,0,24,0,28,0,34,0,40,0,48,0,60,0,78,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,8,0,8,0,8,0,16,0,16,0,16,0,21,0,21,0,24,0,29,0,34,0,36,0,0,0,96,0,192,0,32,1,128,1,32,0,128,0,224,0,64,1,160,1,64,0,160,0,0,1,96,1,192,1,8,0,104,0,200,0,40,1,136,1,40,0,136,0,232,0,72,1,168,1,72,0,168,0,8,1,104,1,200,1,16,0,112,0,208,0,48,1,144,1,48,0,144,0,240,0,80,1,176,1,80,0,176,0,16,1,112,1,208,1,24,0,120,0,216,0,56,1,152,1,56,0,152,0,248,0,88,1,184,1,88,0, + 184,0,24,1,120,1,216,1,4,0,100,0,196,0,36,1,132,1,36,0,132,0,228,0,68,1,164,1,68,0,164,0,4,1,100,1,196,1,12,0,108,0,204,0,44,1,140,1,44,0,140,0,236,0,76,1,172,1,76,0,172,0,12,1,108,1,204,1,20,0,116,0,212,0,52,1,148,1,52,0,148,0,244,0,84,1,180,1,84,0,180,0,20,1,116,1,212,1,28,0,124,0,220,0,60,1,156,1,60,0,156,0,252,0,92,1,188,1,92,0,188,0,28,1,124,1,220,1,1,0,97,0,193,0,33,1,129,1,33,0,129,0,225,0,65,1,161,1,65,0,161,0,1,1,97,1,193,1,9,0,105,0,201,0,41,1,137,1,41,0,137,0,233,0,73,1,169,1,73,0,169, + 0,9,1,105,1,201,1,17,0,113,0,209,0,49,1,145,1,49,0,145,0,241,0,81,1,177,1,81,0,177,0,17,1,113,1,209,1,25,0,121,0,217,0,57,1,153,1,57,0,153,0,249,0,89,1,185,1,89,0,185,0,25,1,121,1,217,1,5,0,101,0,197,0,37,1,133,1,37,0,133,0,229,0,69,1,165,1,69,0,165,0,5,1,101,1,197,1,13,0,109,0,205,0,45,1,141,1,45,0,141,0,237,0,77,1,173,1,77,0,173,0,13,1,109,1,205,1,21,0,117,0,213,0,53,1,149,1,53,0,149,0,245,0,85,1,181,1,85,0,181,0,21,1,117,1,213,1,29,0,125,0,221,0,61,1,157,1,61,0,157,0,253,0,93,1,189,1,93,0,189, + 0,29,1,125,1,221,1,2,0,98,0,194,0,34,1,130,1,34,0,130,0,226,0,66,1,162,1,66,0,162,0,2,1,98,1,194,1,10,0,106,0,202,0,42,1,138,1,42,0,138,0,234,0,74,1,170,1,74,0,170,0,10,1,106,1,202,1,18,0,114,0,210,0,50,1,146,1,50,0,146,0,242,0,82,1,178,1,82,0,178,0,18,1,114,1,210,1,26,0,122,0,218,0,58,1,154,1,58,0,154,0,250,0,90,1,186,1,90,0,186,0,26,1,122,1,218,1,6,0,102,0,198,0,38,1,134,1,38,0,134,0,230,0,70,1,166,1,70,0,166,0,6,1,102,1,198,1,14,0,110,0,206,0,46,1,142,1,46,0,142,0,238,0,78,1,174,1,78,0,174,0,14, + 1,110,1,206,1,22,0,118,0,214,0,54,1,150,1,54,0,150,0,246,0,86,1,182,1,86,0,182,0,22,1,118,1,214,1,30,0,126,0,222,0,62,1,158,1,62,0,158,0,254,0,94,1,190,1,94,0,190,0,30,1,126,1,222,1,3,0,99,0,195,0,35,1,131,1,35,0,131,0,227,0,67,1,163,1,67,0,163,0,3,1,99,1,195,1,11,0,107,0,203,0,43,1,139,1,43,0,139,0,235,0,75,1,171,1,75,0,171,0,11,1,107,1,203,1,19,0,115,0,211,0,51,1,147,1,51,0,147,0,243,0,83,1,179,1,83,0,179,0,19,1,115,1,211,1,27,0,123,0,219,0,59,1,155,1,59,0,155,0,251,0,91,1,187,1,91,0,187,0,27,1, + 123,1,219,1,7,0,103,0,199,0,39,1,135,1,39,0,135,0,231,0,71,1,167,1,71,0,167,0,7,1,103,1,199,1,15,0,111,0,207,0,47,1,143,1,47,0,143,0,239,0,79,1,175,1,79,0,175,0,15,1,111,1,207,1,23,0,119,0,215,0,55,1,151,1,55,0,151,0,247,0,87,1,183,1,87,0,183,0,23,1,119,1,215,1,31,0,127,0,223,0,63,1,159,1,63,0,159,0,255,0,95,1,191,1,95,0,191,0,31,1,127,1,223,1,0,0,48,0,96,0,144,0,192,0,16,0,64,0,112,0,160,0,208,0,32,0,80,0,128,0,176,0,224,0,4,0,52,0,100,0,148,0,196,0,20,0,68,0,116,0,164,0,212,0,36,0,84,0,132,0,180, + 0,228,0,8,0,56,0,104,0,152,0,200,0,24,0,72,0,120,0,168,0,216,0,40,0,88,0,136,0,184,0,232,0,12,0,60,0,108,0,156,0,204,0,28,0,76,0,124,0,172,0,220,0,44,0,92,0,140,0,188,0,236,0,1,0,49,0,97,0,145,0,193,0,17,0,65,0,113,0,161,0,209,0,33,0,81,0,129,0,177,0,225,0,5,0,53,0,101,0,149,0,197,0,21,0,69,0,117,0,165,0,213,0,37,0,85,0,133,0,181,0,229,0,9,0,57,0,105,0,153,0,201,0,25,0,73,0,121,0,169,0,217,0,41,0,89,0,137,0,185,0,233,0,13,0,61,0,109,0,157,0,205,0,29,0,77,0,125,0,173,0,221,0,45,0,93,0,141,0,189,0, + 237,0,2,0,50,0,98,0,146,0,194,0,18,0,66,0,114,0,162,0,210,0,34,0,82,0,130,0,178,0,226,0,6,0,54,0,102,0,150,0,198,0,22,0,70,0,118,0,166,0,214,0,38,0,86,0,134,0,182,0,230,0,10,0,58,0,106,0,154,0,202,0,26,0,74,0,122,0,170,0,218,0,42,0,90,0,138,0,186,0,234,0,14,0,62,0,110,0,158,0,206,0,30,0,78,0,126,0,174,0,222,0,46,0,94,0,142,0,190,0,238,0,3,0,51,0,99,0,147,0,195,0,19,0,67,0,115,0,163,0,211,0,35,0,83,0,131,0,179,0,227,0,7,0,55,0,103,0,151,0,199,0,23,0,71,0,119,0,167,0,215,0,39,0,87,0,135,0,183,0,231, + 0,11,0,59,0,107,0,155,0,203,0,27,0,75,0,123,0,171,0,219,0,43,0,91,0,139,0,187,0,235,0,15,0,63,0,111,0,159,0,207,0,31,0,79,0,127,0,175,0,223,0,47,0,95,0,143,0,191,0,239,0,0,0,24,0,48,0,72,0,96,0,8,0,32,0,56,0,80,0,104,0,16,0,40,0,64,0,88,0,112,0,4,0,28,0,52,0,76,0,100,0,12,0,36,0,60,0,84,0,108,0,20,0,44,0,68,0,92,0,116,0,1,0,25,0,49,0,73,0,97,0,9,0,33,0,57,0,81,0,105,0,17,0,41,0,65,0,89,0,113,0,5,0,29,0,53,0,77,0,101,0,13,0,37,0,61,0,85,0,109,0,21,0,45,0,69,0,93,0,117,0,2,0,26,0,50,0,74,0,98,0,10, + 0,34,0,58,0,82,0,106,0,18,0,42,0,66,0,90,0,114,0,6,0,30,0,54,0,78,0,102,0,14,0,38,0,62,0,86,0,110,0,22,0,46,0,70,0,94,0,118,0,3,0,27,0,51,0,75,0,99,0,11,0,35,0,59,0,83,0,107,0,19,0,43,0,67,0,91,0,115,0,7,0,31,0,55,0,79,0,103,0,15,0,39,0,63,0,87,0,111,0,23,0,47,0,71,0,95,0,119,0,0,0,12,0,24,0,36,0,48,0,4,0,16,0,28,0,40,0,52,0,8,0,20,0,32,0,44,0,56,0,1,0,13,0,25,0,37,0,49,0,5,0,17,0,29,0,41,0,53,0,9,0,21,0,33,0,45,0,57,0,2,0,14,0,26,0,38,0,50,0,6,0,18,0,30,0,42,0,54,0,10,0,22,0,34,0,46,0,58,0,3,0,15, + 0,27,0,39,0,51,0,7,0,19,0,31,0,43,0,55,0,11,0,23,0,35,0,47,0,59,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,41,0,41,0,41,0,82,0,82,0,123,0,164,0,200,0,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,164,0,164,0,240,0,10,1,27,1,39,1,41,0,41,0,41,0,41,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,10,1,10,1,49,1,62,1,72,1,80,1,123,0,123,0,123,0,123,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,62,1, + 62,1,87,1,95,1,102,1,108,1,240,0,240,0,240,0,240,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,49,1,87,1,87,1,87,1,95,1,95,1,114,1,120,1,126,1,131,1,184,126,154,121,154,121,102,102,184,126,51,115,16,48,250,0,3,0,6,0,3,0,3,0,3,0,4,0,3,0,3,0,3,0,205,1,100,0,3,0,40,0,3,0,3,0,3,0,5,0,14,0,14,0,10,0,11,0,3,0,8,0,9,0,7,0,3,0,91,1,18,0,29,0,38,0,40,0,46,0,52,0,62,0,84,0,92,202,190,216,182,223,154,226,156,230,120,236,122,244,204,252,52,3,134,11,136,19,100,25,102,29,74,32,66,39,164,53,100,0,240,0,32,0,100,0,205, + 60,0,48,0,32,30,161,36,42,0,32,254,31,246,31,234,31,216,31,194,31,168,31,136,31,98,31,58,31,10,31,216,30,160,30,98,30,34,30,220,29,144,29,66,29,238,28,150,28,58,28,216,27,114,27,10,27,156,26,42,26,180,25,58,25,188,24,60,24,182,23,46,23,160,22,16,22,126,21,232,20,78,20,176,19,16,19,110,18,200,17,30,17,116,16,198,15,22,15,100,14,174,13,248,12,64,12,132,11,200,10,10,10,74,9,138,8,198,7,2,7,62,6,120,5,178,4,234,3,34,3,90,2,146,1,202,0,0,0,54,255,110,254,166,253,222,252,22,252,78,251,136,250,194,249,254, + 248,58,248,118,247,182,246,246,245,56,245,124,244,192,243,8,243,82,242,156,241,234,240,58,240,140,239,226,238,56,238,146,237,240,236,80,236,178,235,24,235,130,234,240,233,96,233,210,232,74,232,196,231,68,231,198,230,76,230,214,229,100,229,246,228,142,228,40,228,198,227,106,227,18,227,190,226,112,226,36,226,222,225,158,225,96,225,40,225,246,224,198,224,158,224,120,224,88,224,62,224,40,224,22,224,10,224,2,224,0,224,210,6,138,58,171,152,198,26,169,100,246,216,42,175,213,201,207,255,64,0,17,0,99,255, + 97,1,16,254,163,0,39,43,189,86,217,255,6,0,91,0,86,255,186,0,23,0,128,252,192,24,216,77,237,255,220,255,102,0,167,255,232,255,72,1,73,252,8,10,37,62,135,199,61,201,64,0,128,0,134,255,36,0,54,1,0,253,72,2,51,36,69,69,12,0,128,0,18,0,114,255,32,1,139,255,159,252,27,16,123,56,104,2,13,200,246,255,39,0,58,0,210,255,172,255,120,0,184,0,197,254,227,253,4,5,4,21,64,35,230,62,198,196,243,255,0,0,20,0,26,0,5,0,225,255,213,255,252,255,65,0,90,0,7,0,99,255,8,255,212,255,81,2,47,6,52,10,199,12,228,87,5,197,3, + 0,242,255,236,255,241,255,2,0,25,0,37,0,25,0,240,255,185,255,149,255,177,255,50,0,36,1,111,2,214,3,8,5,184,5,148,107,103,196,17,0,12,0,8,0,1,0,246,255,234,255,226,255,224,255,234,255,3,0,44,0,100,0,168,0,243,0,61,1,125,1,173,1,199,1,19,245,149,230,89,18,243,41,31,6,84,32,189,0,168,253,105,2,103,119,117,0,97,255,210,251,8,116,52,0,221,0,168,246,116,110,252,255,17,2,234,242,229,102,208,255,246,2,140,240,165,93,176,255,137,3,117,239,6,83,157,255,204,3,130,239,102,71,149,255,199,3,139,240,39,59,153,255, + 128,3,97,242,174,46,165,255,5,3,207,244,94,34,185,255,99,2,161,247,152,22,210,255,169,1,161,250,180,11,0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3,0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,0,255,0,255,0,255,0,255,0,255,0,254,1,0,1,255,0,254,0,253,2,0,1,255,0,254,0,253,3,0,1,255,117,110,107,110,111,119,110,32,101,114,114,111,114,0,115,117,99,99,101,115,115,0,105,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,98,117,102,102,101,114,32,116,111,111,32,115,109,97,108,108,0,105,110,116,101, + 114,110,97,108,32,101,114,114,111,114,0,99,111,114,114,117,112,116,101,100,32,115,116,114,101,97,109,0,114,101,113,117,101,115,116,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,105,110,118,97,108,105,100,32,115,116,97,116,101,0,109,101,109,111,114,121,32,97,108,108,111,99,97,116,105,111,110,32,102,97,105,108,101,100,0,108,105,98,111,112,117,115,32,49,46,49,46,50,0,2,1,0,255,255,156,110,86,70,59,51,45,40,37,33,31,28,26,25,23,22,21,20,19,18,17,16,16,15,15,14,13,13,12,12,12,12,11,11, + 11,10,10,10,9,9,9,9,9,9,8,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,2,1,0,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,80,75,69,63,56,49,40,34,29,20,18,10,0,0,0,0,0,0,0,0,110,100,90,84,78,71,65,58,51,45,39,32,26,20,12,0,0,0,0,0,0,118,110,103,93,86,80,75,70,65,59,53,47,40,31,23,15,4,0,0,0,0,126, + 119,112,104,95,89,83,78,72,66,60,54,47,39,32,25,17,12,1,0,0,134,127,120,114,103,97,91,85,78,72,66,60,54,47,41,35,29,23,16,10,1,144,137,130,124,113,107,101,95,88,82,76,70,64,57,51,45,39,33,26,15,1,152,145,138,132,123,117,111,105,98,92,86,80,74,67,61,55,49,43,36,20,1,162,155,148,142,133,127,121,115,108,102,96,90,84,77,71,65,59,53,46,30,1,172,165,158,152,143,137,131,125,118,112,106,100,94,87,81,75,69,63,56,45,20,200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,40,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,40,15,23,28,31,34,36,38,39,41,42,43,44,45,46,47,47,49,50,51,52,53,54,55,55,57,58,59,60,61,62,63,63,65,66,67,68,69,70,71,71,40,20,33,41,48,53,57,61,64,66,69,71,73,75,76,78,80,82,85,87,89,91,92,94,96,98,101,103,105,107,108,110,112,114,117,119,121,123,124,126,128,40,23,39,51,60,67,73,79,83,87,91,94,97,100,102,105,107,111,115,118,121,124,126,129,131,135,139,142,145,148,150,153,155,159,163,166,169,172,174,177,179,35,28,49,65, + 78,89,99,107,114,120,126,132,136,141,145,149,153,159,165,171,176,180,185,189,192,199,205,211,216,220,225,229,232,239,245,251,21,33,58,79,97,112,125,137,148,157,166,174,182,189,195,201,207,217,227,235,243,251,17,35,63,86,106,123,139,152,165,177,187,197,206,214,222,230,237,250,25,31,55,75,91,105,117,128,138,146,154,161,168,174,180,185,190,200,208,215,222,229,235,240,245,255,16,36,65,89,110,128,144,159,173,185,196,207,217,226,234,242,250,11,41,74,103,128,151,172,191,209,225,241,255,9,43,79,110,138,163, + 186,207,227,246,12,39,71,99,123,144,164,182,198,214,228,241,253,9,44,81,113,142,168,192,214,235,255,7,49,90,127,160,191,220,247,6,51,95,134,170,203,234,7,47,87,123,155,184,212,237,6,52,97,137,174,208,240,5,57,106,151,192,231,5,59,111,158,202,243,5,55,103,147,187,224,5,60,113,161,206,248,4,65,122,175,224,4,67,127,182,234,224,224,224,224,224,224,224,224,160,160,160,160,185,185,185,178,178,168,134,61,37,224,224,224,224,224,224,224,224,240,240,240,240,207,207,207,198,198,183,144,66,40,160,160,160,160, + 160,160,160,160,185,185,185,185,193,193,193,183,183,172,138,64,38,240,240,240,240,240,240,240,240,207,207,207,207,204,204,204,193,193,180,143,66,40,185,185,185,185,185,185,185,185,193,193,193,193,193,193,193,183,183,172,138,65,39,207,207,207,207,207,207,207,207,204,204,204,204,201,201,201,188,188,176,141,66,40,193,193,193,193,193,193,193,193,193,193,193,193,194,194,194,184,184,173,139,65,39,204,204,204,204,204,204,204,204,201,201,201,201,198,198,198,187,187,175,140,66,40,72,127,65,129,66,128,65,128, + 64,128,62,128,64,128,64,128,92,78,92,79,92,78,90,79,116,41,115,40,114,40,132,26,132,26,145,17,161,12,176,10,177,11,24,179,48,138,54,135,54,132,53,134,56,133,55,132,55,132,61,114,70,96,74,88,75,88,87,74,89,66,91,67,100,59,108,50,120,40,122,37,97,43,78,50,83,78,84,81,88,75,86,74,87,71,90,73,93,74,93,74,109,40,114,36,117,34,117,34,143,17,145,18,146,19,162,12,165,10,178,7,189,6,190,8,177,9,23,178,54,115,63,102,66,98,69,99,74,89,71,91,73,91,78,89,86,80,92,66,93,64,102,59,103,60,104,60,117,52,123,44,138, + 35,133,31,97,38,77,45,61,90,93,60,105,42,107,41,110,45,116,38,113,38,112,38,124,26,132,27,136,19,140,20,155,14,159,16,158,18,170,13,177,10,187,8,192,6,175,9,159,10,21,178,59,110,71,86,75,85,84,83,91,66,88,73,87,72,92,75,98,72,105,58,107,54,115,52,114,55,112,56,129,51,132,40,150,33,140,29,98,35,77,42,42,121,96,66,108,43,111,40,117,44,123,32,120,36,119,33,127,33,134,34,139,21,147,23,152,20,158,25,154,26,166,21,173,16,184,13,184,10,150,13,139,15,22,178,63,114,74,82,84,83,92,82,103,62,96,72,96,67,101, + 73,107,72,113,55,118,52,125,52,118,52,117,55,135,49,137,39,157,32,145,29,97,33,77,40,2,1,0,0,8,13,16,19,21,23,24,26,27,28,29,30,31,32,32,33,34,34,35,36,36,37,37,224,112,44,15,3,2,1,0,254,237,192,132,70,23,4,0,255,252,226,155,61,11,2,0,250,245,234,203,71,50,42,38,35,33,31,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,179,99,0,71,56,43,30,21,12,6,0,199,165,144,124,109,96,84,71,61,51,42,32,23,15,8,0,241,225,211,199,187,175,164,153,142,132,123,114,105,96,88,80,72,64, + 57,50,44,38,33,29,24,20,16,12,9,5,2,0,15,131,138,138,155,155,173,173,69,93,115,118,131,138,141,138,150,150,155,150,155,160,166,160,131,128,134,141,141,141,145,145,145,150,155,155,155,155,160,160,160,160,166,166,173,173,182,192,182,192,192,192,205,192,205,224,4,6,24,7,5,0,0,2,0,0,12,28,41,13,252,247,15,42,25,14,1,254,62,41,247,246,37,65,252,3,250,4,66,7,248,16,14,38,253,33,13,22,39,23,12,255,36,64,27,250,249,10,55,43,17,1,1,8,1,1,6,245,74,53,247,244,55,76,244,8,253,3,93,27,252,26,39,59,3,248,2,0,77, + 11,9,248,22,44,250,7,40,9,26,3,9,249,20,101,249,4,3,248,42,26,0,241,33,68,2,23,254,55,46,254,15,3,255,21,16,41,250,27,61,39,5,245,42,88,4,1,254,60,65,6,252,255,251,73,56,1,247,19,94,29,247,0,12,99,6,4,8,237,102,46,243,3,2,13,3,2,9,235,84,72,238,245,46,104,234,8,18,38,48,23,0,240,70,83,235,11,5,245,117,22,248,250,23,117,244,3,3,248,95,28,4,246,15,77,60,241,255,4,124,2,252,3,38,84,24,231,2,13,42,13,31,21,252,56,46,255,255,35,79,243,19,249,65,88,247,242,20,4,81,49,227,20,0,75,3,239,5,247,44,92,248,1, + 253,22,69,31,250,95,41,244,5,39,67,16,252,1,0,250,120,55,220,243,44,122,4,232,81,5,11,3,7,2,0,9,10,88,46,2,90,87,93,91,82,98,109,120,118,12,113,115,117,119,99,59,87,111,63,111,112,80,126,124,125,124,129,121,126,23,132,127,127,127,126,127,122,133,130,134,101,118,119,145,126,86,124,120,123,119,170,173,107,109,8,16,32,12,35,60,83,108,132,157,180,206,228,15,32,55,77,101,125,151,175,201,225,19,42,66,89,114,137,162,184,209,230,12,25,50,72,97,120,147,172,200,223,26,44,69,90,114,135,159,180,205,225,13,22, + 53,80,106,130,156,180,205,228,15,25,44,64,90,115,142,168,196,222,19,24,62,82,100,120,145,168,190,214,22,31,50,79,103,120,151,170,203,227,21,29,45,65,106,124,150,171,196,224,30,49,75,97,121,142,165,186,209,229,19,25,52,70,93,116,143,166,192,219,26,34,62,75,97,118,145,167,194,217,25,33,56,70,91,113,143,165,196,223,21,34,51,72,97,117,145,171,196,222,20,29,50,67,90,117,144,168,197,221,22,31,48,66,95,117,146,168,196,222,24,33,51,77,116,134,158,180,200,224,21,28,70,87,106,124,149,170,194,217,26,33,53,64, + 83,117,152,173,204,225,27,34,65,95,108,129,155,174,210,225,20,26,72,99,113,131,154,176,200,219,34,43,61,78,93,114,155,177,205,229,23,29,54,97,124,138,163,179,209,229,30,38,56,89,118,129,158,178,200,231,21,29,49,63,85,111,142,163,193,222,27,48,77,103,133,158,179,196,215,232,29,47,74,99,124,151,176,198,220,237,33,42,61,76,93,121,155,174,207,225,29,53,87,112,136,154,170,188,208,227,24,30,52,84,131,150,166,186,203,229,37,48,64,84,104,118,156,177,201,230,212,178,148,129,108,96,85,82,79,77,61,59,57,56, + 51,49,48,45,42,41,40,38,36,34,31,30,21,12,10,3,1,0,255,245,244,236,233,225,217,203,190,176,175,161,149,136,125,114,102,91,81,71,60,52,43,35,28,20,19,18,12,11,5,0,179,138,140,148,151,149,153,151,163,116,67,82,59,92,72,100,89,92,16,0,0,0,0,99,66,36,36,34,36,34,34,34,34,83,69,36,52,34,116,102,70,68,68,176,102,68,68,34,65,85,68,84,36,116,141,152,139,170,132,187,184,216,137,132,249,168,185,139,104,102,100,68,68,178,218,185,185,170,244,216,187,187,170,244,187,187,219,138,103,155,184,185,137,116,183,155, + 152,136,132,217,184,184,170,164,217,171,155,139,244,169,184,185,170,164,216,223,218,138,214,143,188,218,168,244,141,136,155,170,168,138,220,219,139,164,219,202,216,137,168,186,246,185,139,116,185,219,185,138,100,100,134,100,102,34,68,68,100,68,168,203,221,218,168,167,154,136,104,70,164,246,171,137,139,137,155,218,219,139,255,254,253,238,14,3,2,1,0,255,254,252,218,35,3,2,1,0,255,254,250,208,59,4,2,1,0,255,254,246,194,71,10,2,1,0,255,252,236,183,82,8,2,1,0,255,252,235,180,90,17,2,1,0,255,248,224,171, + 97,30,4,1,0,255,254,236,173,95,37,7,1,0,255,255,255,131,6,145,255,255,255,255,255,236,93,15,96,255,255,255,255,255,194,83,25,71,221,255,255,255,255,162,73,34,66,162,255,255,255,210,126,73,43,57,173,255,255,255,201,125,71,48,58,130,255,255,255,166,110,73,57,62,104,210,255,255,251,123,65,55,68,100,171,255,7,23,38,54,69,85,100,116,131,147,162,178,193,208,223,239,13,25,41,55,69,83,98,112,127,142,157,171,187,203,220,236,15,21,34,51,61,78,92,106,126,136,152,167,185,205,225,240,10,21,36,50,63,79,95,110, + 126,141,157,173,189,205,221,237,17,20,37,51,59,78,89,107,123,134,150,164,184,205,224,240,10,15,32,51,67,81,96,112,129,142,158,173,189,204,220,236,8,21,37,51,65,79,98,113,126,138,155,168,179,192,209,218,12,15,34,55,63,78,87,108,118,131,148,167,185,203,219,236,16,19,32,36,56,79,91,108,118,136,154,171,186,204,220,237,11,28,43,58,74,89,105,120,135,150,165,180,196,211,226,241,6,16,33,46,60,75,92,107,123,137,156,169,185,199,214,225,11,19,30,44,57,74,89,105,121,135,152,169,186,202,218,234,12,19,29,46,57, + 71,88,100,120,132,148,165,182,199,216,233,17,23,35,46,56,77,92,106,123,134,152,167,185,204,222,237,14,17,45,53,63,75,89,107,115,132,151,171,188,206,221,240,9,16,29,40,56,71,88,103,119,137,154,171,189,205,222,237,16,19,36,48,57,76,87,105,118,132,150,167,185,202,218,236,12,17,29,54,71,81,94,104,126,136,149,164,182,201,221,237,15,28,47,62,79,97,115,129,142,155,168,180,194,208,223,238,8,14,30,45,62,78,94,111,127,143,159,175,192,207,223,239,17,30,49,62,79,92,107,119,132,145,160,174,190,204,220,235,14, + 19,36,45,61,76,91,108,121,138,154,172,189,205,222,238,12,18,31,45,60,76,91,107,123,138,154,171,187,204,221,236,13,17,31,43,53,70,83,103,114,131,149,167,185,203,220,237,17,22,35,42,58,78,93,110,125,139,155,170,188,206,224,240,8,15,34,50,67,83,99,115,131,146,162,178,193,209,224,239,13,16,41,66,73,86,95,111,128,137,150,163,183,206,225,241,17,25,37,52,63,75,92,102,119,132,144,160,175,191,212,231,19,31,49,65,83,100,117,133,147,161,174,187,200,213,227,242,18,31,52,68,88,103,117,126,138,149,163,177,192, + 207,223,239,16,29,47,61,76,90,106,119,133,147,161,176,193,209,224,240,15,21,35,50,61,73,86,97,110,119,129,141,175,198,218,237,225,204,201,184,183,175,158,154,153,135,119,115,113,110,109,99,98,95,79,68,52,50,48,45,43,32,31,27,18,10,3,0,255,251,235,230,212,201,196,182,167,166,163,151,138,124,110,104,90,78,76,70,69,57,45,34,24,21,11,6,5,4,3,0,175,148,160,176,178,173,174,164,177,174,196,182,198,192,182,68,62,66,60,72,117,85,90,118,136,151,142,160,142,155,0,0,0,0,0,0,0,1,100,102,102,68,68,36,34,96,164, + 107,158,185,180,185,139,102,64,66,36,34,34,0,1,32,208,139,141,191,152,185,155,104,96,171,104,166,102,102,102,132,1,0,0,0,0,16,16,0,80,109,78,107,185,139,103,101,208,212,141,139,173,153,123,103,36,0,0,0,0,0,0,1,48,0,0,0,0,0,0,32,68,135,123,119,119,103,69,98,68,103,120,118,118,102,71,98,134,136,157,184,182,153,139,134,208,168,248,75,189,143,121,107,32,49,34,34,34,0,17,2,210,235,139,123,185,137,105,134,98,135,104,182,100,183,171,134,100,70,68,70,66,66,34,131,64,166,102,68,36,2,1,0,134,166,102,68,34, + 34,66,132,212,246,158,139,107,107,87,102,100,219,125,122,137,118,103,132,114,135,137,105,171,106,50,34,164,214,141,143,185,151,121,103,192,34,0,0,0,0,0,1,208,109,74,187,134,249,159,137,102,110,154,118,87,101,119,101,0,2,0,36,36,66,68,35,96,164,102,100,36,0,2,33,167,138,174,102,100,84,2,2,100,107,120,119,36,197,24,0,255,254,253,244,12,3,2,1,0,255,254,252,224,38,3,2,1,0,255,254,251,209,57,4,2,1,0,255,254,244,195,69,4,2,1,0,255,251,232,184,84,7,2,1,0,255,254,240,186,86,14,2,1,0,255,254,239,178,91,30, + 5,1,0,255,248,227,177,100,19,2,1,0,255,255,255,156,4,154,255,255,255,255,255,227,102,15,92,255,255,255,255,255,213,83,24,72,236,255,255,255,255,150,76,33,63,214,255,255,255,190,121,77,43,55,185,255,255,255,245,137,71,43,59,139,255,255,255,255,131,66,50,66,107,194,255,255,166,116,76,55,53,125,255,255,249,247,246,245,244,234,210,202,201,200,197,174,82,59,56,55,54,46,22,12,11,10,9,7,0,64,0,203,150,0,215,195,166,125,110,82,0,120,0,128,64,0,232,158,10,0,230,0,243,221,192,181,0,171,85,0,192,128,64,0,205, + 154,102,51,0,213,171,128,85,43,0,224,192,160,128,96,64,32,0,100,40,16,7,3,1,0,253,250,244,233,212,182,150,131,120,110,98,85,72,60,49,40,32,25,19,15,13,11,9,8,7,6,5,4,3,2,1,0,210,208,206,203,199,193,183,168,142,104,74,52,37,27,20,14,10,6,4,2,0,223,201,183,167,152,138,124,111,98,88,79,70,62,56,50,44,39,35,31,27,24,21,18,16,14,12,10,8,6,4,3,2,1,0,188,176,155,138,119,97,67,43,26,10,0,165,119,80,61,47,35,27,20,14,9,4,0,113,63,0,8,10,12,16,125,51,26,18,15,12,11,10,9,8,7,6,5,4,3,2,1,0,198,105,45,22,15,12, + 11,10,9,8,7,6,5,4,3,2,1,0,213,162,116,83,59,43,32,24,18,15,12,9,7,6,5,3,2,0,239,187,116,59,28,16,11,10,9,8,7,6,5,4,3,2,1,0,250,229,188,135,86,51,30,19,13,10,8,6,5,4,3,2,1,0,249,235,213,185,156,128,103,83,66,53,42,33,26,21,17,13,10,0,254,249,235,206,164,118,77,46,27,16,10,7,5,4,3,2,1,0,255,253,249,239,220,191,156,119,85,57,37,23,15,10,6,4,2,0,255,253,251,246,237,223,203,179,152,124,98,75,55,40,29,21,15,0,255,254,253,247,220,162,106,67,42,28,18,12,9,6,4,3,2,0,31,57,107,160,205,205,255,255,255,255,255, + 255,255,255,255,255,255,255,69,47,67,111,166,205,255,255,255,255,255,255,255,255,255,255,255,255,82,74,79,95,109,128,145,160,173,205,205,205,224,255,255,224,255,224,125,74,59,69,97,141,182,255,255,255,255,255,255,255,255,255,255,255,173,115,85,73,76,92,115,145,173,205,224,224,255,255,255,255,255,255,166,134,113,102,101,102,107,118,125,138,145,155,166,182,192,192,205,150,224,182,134,101,83,79,85,97,120,145,173,205,224,255,255,255,255,255,255,224,192,150,120,101,92,89,93,102,118,134,160,182,192,224, + 224,224,255,224,224,182,155,134,118,109,104,102,106,111,118,131,145,160,173,131,241,190,178,132,87,74,41,14,0,223,193,157,140,106,57,39,18,0,131,74,141,79,80,138,95,104,134,95,99,91,125,93,76,123,115,123,128,0,214,42,0,235,128,21,0,244,184,72,11,0,248,214,128,42,7,0,248,225,170,80,25,5,0,251,236,198,126,54,18,3,0,250,238,211,159,82,35,15,5,0,250,231,203,168,128,88,53,25,6,0,252,238,216,185,148,108,71,40,18,4,0,253,243,225,199,166,128,90,57,31,13,3,0,254,246,233,212,183,147,109,73,44,23,10,2,0,255, + 250,240,223,198,166,128,90,58,33,16,6,1,0,255,251,244,231,210,181,146,110,75,46,25,12,5,1,0,255,253,248,238,221,196,164,128,92,60,35,18,8,3,1,0,255,253,249,242,229,208,180,146,110,76,48,27,14,7,3,1,0,129,0,207,50,0,236,129,20,0,245,185,72,10,0,249,213,129,42,6,0,250,226,169,87,27,4,0,251,233,194,130,62,20,4,0,250,236,207,160,99,47,17,3,0,255,240,217,182,131,81,41,11,1,0,255,254,233,201,159,107,61,20,2,1,0,255,249,233,206,170,128,86,50,23,7,1,0,255,250,238,217,186,148,108,70,39,18,6,1,0,255,252,243, + 226,200,166,128,90,56,30,13,4,1,0,255,252,245,231,209,180,146,110,76,47,25,11,4,1,0,255,253,248,237,219,194,163,128,93,62,37,19,8,3,1,0,255,254,250,241,226,205,177,145,111,79,51,30,15,6,2,1,0,129,0,203,54,0,234,129,23,0,245,184,73,10,0,250,215,129,41,5,0,252,232,173,86,24,3,0,253,240,200,129,56,15,2,0,253,244,217,164,94,38,10,1,0,253,245,226,189,132,71,27,7,1,0,253,246,231,203,159,105,56,23,6,1,0,255,248,235,213,179,133,85,47,19,5,1,0,255,254,243,221,194,159,117,70,37,12,2,1,0,255,254,248,234,208, + 171,128,85,48,22,8,2,1,0,255,254,250,240,220,189,149,107,67,36,16,6,2,1,0,255,254,251,243,227,201,166,128,90,55,29,13,5,2,1,0,255,254,252,246,234,213,183,147,109,73,43,22,10,4,2,1,0,130,0,200,58,0,231,130,26,0,244,184,76,12,0,249,214,130,43,6,0,252,232,173,87,24,3,0,253,241,203,131,56,14,2,0,254,246,221,167,94,35,8,1,0,254,249,232,193,130,65,23,5,1,0,255,251,239,211,162,99,45,15,4,1,0,255,251,243,223,186,131,74,33,11,3,1,0,255,252,245,230,202,158,105,57,24,8,2,1,0,255,253,247,235,214,179,132,84,44, + 19,7,2,1,0,255,254,250,240,223,196,159,112,69,36,15,6,2,1,0,255,254,253,245,231,209,176,136,93,55,27,11,3,2,1,0,255,254,253,252,239,221,194,158,117,76,42,18,4,3,2,1,0,0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,254,49,67,77,82,93,99,198,11,18,24,31,36,45,255,46,66,78,87,94,104,208,14,21,32,42,51,66,255,94,104,109,112,115,118,248,53,69,80,88,95,102,0,15,8,7,4,11,12,3,2,13,10,5,6,9,14,1,0,9,6,3,4,5,8,1,2,7,0,1,0,0,0,1,0,0,1,255,1,255,2,254,2,254,3,253,0,1,0,1,255,2,255,2,254,3,254,3,253,7,254, + 7,0,2,255,255,255,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,255,2,1,0,1,1,0,0,255,255,0,0,1,255,0,1,255,0,255,1,254,2,254,254,2,253,2,3,253,252,3,252,4,4,251,5,250,251,6,249,6,5,8,247,0,0,1,0,0,0,0,0,0,0,255,1,0,0,1,255,0,1,255,255,1,255,2,1,255,2,254,254,2,254,2,2,3,253,0,1,0,0,0,0,0,0,1,0,1,0,0,1,255,1,0,0,2,1,255,2,255,255,2,255,2,2,255,3,254,254,254,3,0,1,0,0,1,0,1,255,2,255,2,255,2,3,254,3,254,254,4,4,253,5,253,252,6,252,6,5,251,8,250,251,249,9,251,8,255,6,255,6,252,10,250,10, + 254,6,255,6,251,10,247,12,253,7,254,7,249,13,16,24,34,6,0,3,0,7,3,0,1,10,0,2,6,18,10,12,4,0,2,0,0,0,9,4,7,4,0,3,12,7,7,255,255],"i8",4,y.h+20480);var Na=z,z=z+16;function Oa(a){b.___errno_location&&(M[b.___errno_location()>>2]=a);return a}b._i64Add=Pa;b._bitshift64Ashr=Qa;b._memset=Ra;b._memcpy=Sa;var Ta=ha;function S(a){S.a||(E=wa(),S.a=!0,assert(y.b),S.u=y.b,y.b=function(){G("cannot dynamically allocate, sbrk now has control")});var c=E;return 0==a||S.u(a)?c:4294967295} + function Y(){Y.a||(Y.a=[]);Y.a.push(y.g());return Y.a.length-1}b._memmove=Ua; + var Aa=x=y.p(z),na=!0,Ba=Aa+Ca,E=y.p(Ba),Va=O([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1, + 0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",3);b.s={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:Infinity}; + b.t={abort:G,assert:assert,invoke_viiiiiii:function(a,c,d,e,g,k,h,A){try{b.dynCall_viiiiiii(a,c,d,e,g,k,h,A)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;Z.setThrew(1,0)}},_llvm_pow_f64:La,_pthread_self:function(){return 0},_abort:function(){b.abort()},___setErrNo:Oa,_llvm_stacksave:Y,_sbrk:S,_time:function(a){var c=Date.now()/1E3|0;a&&(M[a>>2]=c);return c},_llvm_fabs_f64:Ta,_emscripten_memcpy_big:function(a,c,d){R.set(R.subarray(c,c+d),a);return a},_llvm_stackrestore:function(a){var c= + Y.a[a];Y.a.splice(a,1);y.c(c)},_sysconf:function(a){switch(a){case 30:return 4096;case 85:return U/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1; + case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256; + case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===typeof navigator?navigator.hardwareConcurrency||1:1}Oa(22);return-1},STACKTOP:x,STACK_MAX:Ba,tempDoublePtr:Na,ABORT:H,cttz_i8:Va};// EMSCRIPTEN_START_ASM + var Z=(function(global,env,buffer) { + "use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.STACKTOP|0;var j=env.STACK_MAX|0;var k=env.tempDoublePtr|0;var l=env.ABORT|0;var m=env.cttz_i8|0;var n=0;var o=0;var p=0;var q=0;var r=global.NaN,s=global.Infinity;var t=0,u=0,v=0,w=0,x=0.0,y=0,z=0,A=0,B=0.0;var C=0;var D=0;var E=0;var F=0;var G=0;var H=0;var I=0;var J=0;var K=0;var L=0;var M=global.Math.floor;var N=global.Math.abs;var O=global.Math.sqrt;var P=global.Math.pow;var Q=global.Math.cos;var R=global.Math.sin;var S=global.Math.tan;var T=global.Math.acos;var U=global.Math.asin;var V=global.Math.atan;var W=global.Math.atan2;var X=global.Math.exp;var Y=global.Math.log;var Z=global.Math.ceil;var _=global.Math.imul;var $=global.Math.min;var aa=global.Math.clz32;var ba=env.abort;var ca=env.assert;var da=env.invoke_viiiiiii;var ea=env._llvm_pow_f64;var fa=env._pthread_self;var ga=env._abort;var ha=env.___setErrNo;var ia=env._llvm_stacksave;var ja=env._sbrk;var ka=env._time;var la=env._llvm_fabs_f64;var ma=env._emscripten_memcpy_big;var na=env._llvm_stackrestore;var oa=env._sysconf;var pa=0.0; + // EMSCRIPTEN_START_FUNCS + function Lb(a,d,e,f,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0.0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=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da=0,ea=0,fa=0,ga=0,ha=0,ja=0,ka=0;ka=i;i=i+4608|0;aa=ka+4596|0;ba=ka+4592|0;L=ka+4588|0;da=ka+4584|0;fa=ka+4580|0;ca=ka+4576|0;ea=ka+4568|0;Y=ka+4560|0;C=ka+4556|0;X=ka+4552|0;j=ka+4548|0;k=ka+4544|0;N=ka+4540|0;ha=ka+4536|0;W=ka+4532|0;ja=ka+4528|0;$=ka+4524|0;ga=ka+4520|0;h=ka+4516|0;S=ka+4512|0;Z=ka+4508|0;U=ka+4504|0;T=ka+4500|0;R=ka+4496|0;M=ka+4492|0;V=ka+4488|0;Q=ka+4484|0;P=ka+4480|0;K=ka+4476|0;A=ka+4472|0;F=ka+4468|0;l=ka+4464|0;w=ka+368|0;t=ka+360|0;r=ka+356|0;o=ka+352|0;s=ka+348|0;z=ka+344|0;y=ka+340|0;x=ka+336|0;B=ka+332|0;q=ka+232|0;D=ka+136|0;m=ka+128|0;n=ka+124|0;u=ka+120|0;v=ka+116|0;H=ka+112|0;E=ka+16|0;p=ka+12|0;I=ka+8|0;G=ka+4|0;J=ka;c[aa>>2]=a;c[ba>>2]=d;c[L>>2]=e;c[ca>>2]=c[(c[aa>>2]|0)+8>>2];c[ha>>2]=c[c[aa>>2]>>2];c[W>>2]=c[(c[ha>>2]|0)+8>>2];c[ja>>2]=c[(c[ha>>2]|0)+4>>2];c[S>>2]=c[(c[ha>>2]|0)+32>>2];c[da>>2]=0;do{a=(c[aa>>2]|0)+84+((_(c[da>>2]|0,2048+(c[ja>>2]|0)|0)|0)<<2)|0;c[ea+(c[da>>2]<<2)>>2]=a;c[Y+(c[da>>2]<<2)>>2]=(c[ea+(c[da>>2]<<2)>>2]|0)+8192+(0-(c[ba>>2]|0)<<2);a=(c[da>>2]|0)+1|0;c[da>>2]=a}while((a|0)<(c[ca>>2]|0));c[C>>2]=(c[aa>>2]|0)+84+((_(2048+(c[ja>>2]|0)|0,c[ca>>2]|0)|0)<<2);c[X>>2]=(c[C>>2]|0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>>2]|0)+44>>2]=$}else{c[F>>2]=c[(c[aa>>2]|0)+44>>2];g[A>>2]=.800000011920929}$=c[ja>>2]|0;c[l>>2]=ia()|0;e=i;i=i+((1*($<<2)|0)+15&-16)|0;c[K>>2]=c[(c[ha>>2]|0)+60>>2];c[da>>2]=0;do{g[o>>2]=0.0;c[s>>2]=c[ea+(c[da>>2]<<2)>>2];c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=1024)break;g[w+(c[fa>>2]<<2)>>2]=+g[(c[s>>2]|0)+(1024+(c[fa>>2]|0)<<2)>>2];c[fa>>2]=(c[fa>>2]|0)+1}if(!(c[ga>>2]|0)){Yc(w,q,c[K>>2]|0,c[ja>>2]|0,24,1024,c[(c[aa>>2]|0)+32>>2]|0)|0;g[q>>2]=+g[q>>2]*1.000100016593933;c[fa>>2]=1;while(1){if((c[fa>>2]|0)>24)break;ha=q+(c[fa>>2]<<2)|0;g[ha>>2]=+g[ha>>2]-+g[q+(c[fa>>2]<<2)>>2]*6.400000711437315e-05*+(c[fa>>2]|0)*+(c[fa>>2]|0);c[fa>>2]=(c[fa>>2]|0)+1}Uc((c[C>>2]|0)+((c[da>>2]|0)*24<<2)|0,q,24)}c[x>>2]=(c[F>>2]<<1|0)<1024?c[F>>2]<<1:1024;c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=24)break;g[D+(c[fa>>2]<<2)>>2]=+g[(c[s>>2]|0)+(2048-(c[x>>2]|0)-1-(c[fa>>2]|0)<<2)>>2];c[fa>>2]=(c[fa>>2]|0)+1}Vc(w+4096+(0-(c[x>>2]|0)<<2)|0,(c[C>>2]|0)+((c[da>>2]|0)*24<<2)|0,w+4096+(0-(c[x>>2]|0)<<2)|0,c[x>>2]|0,24,D,c[(c[aa>>2]|0)+32>>2]|0);g[m>>2]=1.0;g[n>>2]=1.0;c[u>>2]=c[x>>2]>>1;c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=(c[u>>2]|0))break;g[v>>2]=+g[w+(1024-(c[u>>2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>2]|0,24,E,c[(c[aa>>2]|0)+32>>2]|0);g[p>>2]=0.0;c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=(c[y>>2]|0))break;g[I>>2]=+g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2];g[p>>2]=+g[p>>2]+ +g[I>>2]*+g[I>>2];c[fa>>2]=(c[fa>>2]|0)+1}a:do if(+g[o>>2]>+g[p>>2]*.20000000298023224){if(+g[o>>2]<+g[p>>2]){g[G>>2]=+O(+((+g[o>>2]+1.0)/(+g[p>>2]+1.0)));c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=(c[ja>>2]|0))break;g[J>>2]=1.0-+g[(c[K>>2]|0)+(c[fa>>2]<<2)>>2]*(1.0-+g[G>>2]);g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2]=+g[J>>2]*+g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2];c[fa>>2]=(c[fa>>2]|0)+1}c[fa>>2]=c[ja>>2];while(1){if((c[fa>>2]|0)>=(c[y>>2]|0))break a;g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2]=+g[G>>2]*+g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2];c[fa>>2]=(c[fa>>2]|0)+1}}}else{c[fa>>2]=0;while(1){if((c[fa>>2]|0)>=(c[y>>2]|0))break a;g[(c[s>>2]|0)+(2048-(c[ba>>2]|0)+(c[fa>>2]|0)<<2)>>2]=0.0;c[fa>>2]=(c[fa>>2]|0)+1}}while(0);cb(e,(c[s>>2]|0)+8192|0,c[(c[aa>>2]|0)+52>>2]|0,c[(c[aa>>2]|0)+52>>2]|0,c[ja>>2]|0,-+g[(c[aa>>2]|0)+60>>2],-+g[(c[aa>>2]|0)+60>>2],c[(c[aa>>2]|0)+68>>2]|0,c[(c[aa>>2]|0)+68>>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break;g[y>>2]=+g[(c[A>>2]|0)+(c[w>>2]<<2)>>2]+ +g[x>>2]+1.0000000031710769e-30;g[x>>2]=+g[v>>2]*+g[y>>2];g[e+(c[w>>2]<<2)>>2]=+g[y>>2];c[w>>2]=(c[w>>2]|0)+1}c[t>>2]=1}else while(1){if((c[w>>2]|0)>=(c[n>>2]|0))break a;g[z>>2]=+g[(c[A>>2]|0)+(c[w>>2]<<2)>>2]+ +g[x>>2]+1.0000000031710769e-30;g[x>>2]=+g[v>>2]*+g[z>>2];D=_(c[w>>2]|0,c[o>>2]|0)|0;g[(c[B>>2]|0)+(D<<2)>>2]=+g[z>>2]*.000030517578125;c[w>>2]=(c[w>>2]|0)+1}while(0);g[(c[q>>2]|0)+(c[u>>2]<<2)>>2]=+g[x>>2];b:do if(c[t>>2]|0){c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[s>>2]|0))break b;E=+g[e+((_(c[w>>2]|0,c[p>>2]|0)|0)<<2)>>2]*.000030517578125;D=_(c[w>>2]|0,c[o>>2]|0)|0;g[(c[B>>2]|0)+(D<<2)>>2]=E;c[w>>2]=(c[w>>2]|0)+1}}while(0);D=(c[u>>2]|0)+1|0;c[u>>2]=D}while((D|0)<(c[o>>2]|0));na(c[r>>2]|0);i=C;return}function Qb(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(aa(c[(c[d>>2]|0)+28>>2]|0)|0))|0;i=b;return a|0}function Rb(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=i;i=i+64|0;j=x+52|0;k=x+48|0;l=x+44|0;m=x+40|0;n=x+36|0;o=x+32|0;r=x+28|0;q=x+24|0;v=x+20|0;w=x+16|0;u=x+12|0;s=x+8|0;p=x+4|0;t=x;c[j>>2]=b;c[k>>2]=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>2]|0)+24>>2]=0;c[(c[f>>2]|0)+28>>2]=128;a=Zb(c[f>>2]|0)|0;c[(c[f>>2]|0)+40>>2]=a;c[(c[f>>2]|0)+32>>2]=(c[(c[f>>2]|0)+28>>2]|0)-1-(c[(c[f>>2]|0)+40>>2]>>1);c[(c[f>>2]|0)+44>>2]=0;_b(c[f>>2]|0);i=e;return}function Zb(a){a=a|0;var b=0,e=0,f=0;e=i;i=i+16|0;b=e;c[b>>2]=a;if((c[(c[b>>2]|0)+24>>2]|0)>>>0>=(c[(c[b>>2]|0)+4>>2]|0)>>>0){a=0;i=e;return a|0}f=(c[b>>2]|0)+24|0;a=c[f>>2]|0;c[f>>2]=a+1;a=d[(c[c[b>>2]>>2]|0)+a>>0]|0;i=e;return a|0}function _b(a){a=a|0;var b=0,d=0,e=0;e=i;i=i+16|0;b=e+4|0;d=e;c[b>>2]=a;while(1){if((c[(c[b>>2]|0)+28>>2]|0)>>>0>8388608)break;a=(c[b>>2]|0)+20|0;c[a>>2]=(c[a>>2]|0)+8;a=(c[b>>2]|0)+28|0;c[a>>2]=c[a>>2]<<8;c[d>>2]=c[(c[b>>2]|0)+40>>2];a=Zb(c[b>>2]|0)|0;c[(c[b>>2]|0)+40>>2]=a;c[d>>2]=(c[d>>2]<<8|c[(c[b>>2]|0)+40>>2])>>1;c[(c[b>>2]|0)+32>>2]=(c[(c[b>>2]|0)+32>>2]<<8)+(255&~c[d>>2])&2147483647}i=e;return}function $b(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;f=i;i=i+16|0;g=f+8|0;e=f+4|0;d=f;c[g>>2]=a;c[e>>2]=b;a=ac(c[(c[g>>2]|0)+28>>2]|0,c[e>>2]|0)|0;c[(c[g>>2]|0)+36>>2]=a;c[d>>2]=((c[(c[g>>2]|0)+32>>2]|0)>>>0)/((c[(c[g>>2]|0)+36>>2]|0)>>>0)|0;i=f;return (c[e>>2]|0)-((c[d>>2]|0)+1+((c[e>>2]|0)-((c[d>>2]|0)+1)&0-((c[e>>2]|0)>>>0<((c[d>>2]|0)+1|0)>>>0&1)))|0}function ac(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>>>0)/((c[d>>2]|0)>>>0)|0|0}function bc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;f=i;i=i+16|0;g=f+8|0;e=f+4|0;d=f;c[g>>2]=a;c[e>>2]=b;c[(c[g>>2]|0)+36>>2]=(c[(c[g>>2]|0)+28>>2]|0)>>>(c[e>>2]|0);c[d>>2]=((c[(c[g>>2]|0)+32>>2]|0)>>>0)/((c[(c[g>>2]|0)+36>>2]|0)>>>0)|0;i=f;return (1<>2])-((c[d>>2]|0)+1+((1<>2])-((c[d>>2]|0)+1)&0-(1<>2]>>>0<((c[d>>2]|0)+1|0)>>>0&1)))|0}function cc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;k=i;i=i+32|0;f=k+16|0;g=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[l>>2]=e;c[j>>2]=_(c[(c[f>>2]|0)+36>>2]|0,(c[l>>2]|0)-(c[h>>2]|0)|0)|0;d=(c[f>>2]|0)+32|0;c[d>>2]=(c[d>>2]|0)-(c[j>>2]|0);d=c[f>>2]|0;if((c[g>>2]|0)>>>0>0){j=_(c[d+36>>2]|0,(c[h>>2]|0)-(c[g>>2]|0)|0)|0;l=c[f>>2]|0;l=l+28|0;c[l>>2]=j;l=c[f>>2]|0;_b(l);i=k;return}else{j=(c[d+28>>2]|0)-(c[j>>2]|0)|0;l=c[f>>2]|0;l=l+28|0;c[l>>2]=j;l=c[f>>2]|0;_b(l);i=k;return}}function dc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;j=i;i=i+32|0;d=j+20|0;k=j+16|0;f=j+12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0)|0;c[(c[f>>2]|0)+28>>2]=k;k=c[f>>2]|0;lc(k);i=l;return}else{a=_(c[k>>2]|0,(c[j>>2]|0)-(c[h>>2]|0)|0)|0;k=(c[f>>2]|0)+28|0;c[k>>2]=(c[k>>2]|0)-a;k=c[f>>2]|0;lc(k);i=l;return}}function kc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>>>0)/((c[d>>2]|0)>>>0)|0|0}function lc(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;while(1){if((c[(c[b>>2]|0)+28>>2]|0)>>>0>8388608)break;mc(c[b>>2]|0,(c[(c[b>>2]|0)+32>>2]|0)>>>23);c[(c[b>>2]|0)+32>>2]=c[(c[b>>2]|0)+32>>2]<<8&2147483647;a=(c[b>>2]|0)+28|0;c[a>>2]=c[a>>2]<<8;a=(c[b>>2]|0)+20|0;c[a>>2]=(c[a>>2]|0)+8}i=d;return}function mc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;h=i;i=i+16|0;d=h+12|0;e=h+8|0;f=h+4|0;g=h;c[d>>2]=a;c[e>>2]=b;if((c[e>>2]|0)==255){g=(c[d>>2]|0)+36|0;c[g>>2]=(c[g>>2]|0)+1;i=h;return}c[f>>2]=c[e>>2]>>8;if((c[(c[d>>2]|0)+40>>2]|0)>=0){b=nc(c[d>>2]|0,(c[(c[d>>2]|0)+40>>2]|0)+(c[f>>2]|0)|0)|0;a=(c[d>>2]|0)+44|0;c[a>>2]=c[a>>2]|b}if((c[(c[d>>2]|0)+36>>2]|0)>>>0>0){c[g>>2]=255+(c[f>>2]|0)&255;do{f=nc(c[d>>2]|0,c[g>>2]|0)|0;a=(c[d>>2]|0)+44|0;c[a>>2]=c[a>>2]|f;a=(c[d>>2]|0)+36|0;f=(c[a>>2]|0)+-1|0;c[a>>2]=f}while(f>>>0>0)}c[(c[d>>2]|0)+40>>2]=c[e>>2]&255;i=h;return}function nc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=i;i=i+16|0;e=h+8|0;f=h+4|0;g=h;c[f>>2]=b;c[g>>2]=d;if(((c[(c[f>>2]|0)+24>>2]|0)+(c[(c[f>>2]|0)+8>>2]|0)|0)>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[e>>2]=-1;d=c[e>>2]|0;i=h;return d|0}else{b=c[g>>2]&255;g=(c[f>>2]|0)+24|0;d=c[g>>2]|0;c[g>>2]=d+1;a[(c[c[f>>2]>>2]|0)+d>>0]=b;c[e>>2]=0;d=c[e>>2]|0;i=h;return d|0}return 0}function oc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;f=l+16|0;g=l+12|0;h=l+8|0;j=l+4|0;k=l;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=e;c[k>>2]=(c[(c[f>>2]|0)+28>>2]|0)>>>(c[j>>2]|0);if((c[g>>2]|0)>>>0>0){b=(c[(c[f>>2]|0)+28>>2]|0)-(_(c[k>>2]|0,(1<>2])-(c[g>>2]|0)|0)|0)|0;a=(c[f>>2]|0)+32|0;c[a>>2]=(c[a>>2]|0)+b;k=_(c[k>>2]|0,(c[h>>2]|0)-(c[g>>2]|0)|0)|0;c[(c[f>>2]|0)+28>>2]=k;k=c[f>>2]|0;lc(k);i=l;return}else{a=_(c[k>>2]|0,(1<>2])-(c[h>>2]|0)|0)|0;k=(c[f>>2]|0)+28|0;c[k>>2]=(c[k>>2]|0)-a;k=c[f>>2]|0;lc(k);i=l;return}}function pc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;k=i;i=i+32|0;e=k+20|0;f=k+16|0;l=k+12|0;h=k+8|0;j=k+4|0;g=k;c[e>>2]=a;c[f>>2]=b;c[l>>2]=d;c[h>>2]=c[(c[e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=(c[j>>2]|0)+1|0;c[j>>2]=d;a[(c[c[f>>2]>>2]|0)+(b-d)>>0]=g;c[e>>2]=0;d=c[e>>2]|0;i=h;return d|0}return 0}function uc(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;g=m+16|0;h=m+12|0;j=m+8|0;l=m+4|0;k=m;c[g>>2]=b;c[h>>2]=e;c[j>>2]=f;c[l>>2]=8-(c[j>>2]|0);c[k>>2]=(1<>2])-1<>2];f=c[g>>2]|0;if((c[(c[g>>2]|0)+24>>2]|0)>>>0>0){a[c[c[g>>2]>>2]>>0]=(d[c[f>>2]>>0]|0)&~c[k>>2]|c[h>>2]<>2];i=m;return}b=c[g>>2]|0;if((c[f+40>>2]|0)>=0){c[(c[g>>2]|0)+40>>2]=c[b+40>>2]&~c[k>>2]|c[h>>2]<>2];i=m;return}f=c[g>>2]|0;if((c[b+28>>2]|0)>>>0<=-2147483648>>>(c[j>>2]|0)>>>0){c[(c[g>>2]|0)+32>>2]=c[f+32>>2]&~(c[k>>2]<<23)|c[h>>2]<<23+(c[l>>2]|0);i=m;return}else{c[f+44>>2]=-1;i=m;return}}function vc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=i;i=i+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;qj((c[c[e>>2]>>2]|0)+(c[f>>2]|0)+(0-(c[(c[e>>2]|0)+8>>2]|0))|0,(c[c[e>>2]>>2]|0)+(c[(c[e>>2]|0)+4>>2]|0)+(0-(c[(c[e>>2]|0)+8>>2]|0))|0,(c[(c[e>>2]|0)+8>>2]|0)+0|0)|0;c[(c[e>>2]|0)+4>>2]=c[f>>2];i=d;return}function wc(b){b=b|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;g=l+20|0;k=l+16|0;j=l+12|0;e=l+8|0;f=l+4|0;h=l;c[g>>2]=b;c[h>>2]=32-(32-(aa(c[(c[g>>2]|0)+28>>2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(c[j>>2]|0)+1;c[l>>2]=(c[l>>2]|0)+1}if(a>>>0<=1){c[g>>2]=((c[h>>2]|0)-(c[k>>2]|0)|0)>>>1;c[l>>2]=(c[l>>2]|0)+(c[g>>2]|0);c[k>>2]=(c[k>>2]|0)+(c[g>>2]<<1)}if((c[h>>2]|0)>>>0<((c[k>>2]|0)+(c[j>>2]|0)|0)>>>0){c[l>>2]=0-(c[l>>2]|0);break}else{c[k>>2]=(c[k>>2]|0)+(c[j>>2]|0);break}}while(0);a=c[e>>2]|0;d=c[k>>2]|0;if(((c[k>>2]|0)+(c[j>>2]|0)|0)>>>0>=32768){k=32768;cc(a,d,k,32768);l=c[l>>2]|0;i=m;return l|0}k=(c[k>>2]|0)+(c[j>>2]|0)|0;cc(a,d,k,32768);l=c[l>>2]|0;i=m;return l|0}function Gc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;f=h+8|0;e=h+4|0;g=h;c[b>>2]=a;c[f>>2]=0;c[e>>2]=32-(aa(c[b>>2]|0)|0)-1>>1;c[d>>2]=1<>2];do{c[g>>2]=(c[f>>2]<<1)+(c[d>>2]|0)<>2];if((c[g>>2]|0)>>>0<=(c[b>>2]|0)>>>0){c[f>>2]=(c[f>>2]|0)+(c[d>>2]|0);c[b>>2]=(c[b>>2]|0)-(c[g>>2]|0)}c[d>>2]=(c[d>>2]|0)>>>1;c[e>>2]=(c[e>>2]|0)+-1}while((c[e>>2]|0)>=0);i=h;return c[f>>2]|0}function Hc(a,d,e,f,h,j,k,l){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0.0;U=i;i=i+160|0;V=U+144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a}c[g>>2]=(c[g>>2]|0)+1}c[k>>2]=(c[k>>2]|0)+1}if((e|0)==7){if(c[j>>2]|0)c[c[j>>2]>>2]=0;c[h>>2]=c[5544+(c[k>>2]<<2)>>2];k=c[h>>2]|0;i=l;return k|0}else if((e|0)==12){if(c[j>>2]|0)c[c[j>>2]>>2]=-1;c[h>>2]=0;k=c[h>>2]|0;i=l;return k|0}return 0}function Kc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+112|0;h=u+108|0;j=u+104|0;k=u+100|0;l=u+96|0;m=u+92|0;p=u+88|0;n=u+68|0;t=u+64|0;q=u+48|0;s=u+24|0;r=u+4|0;o=u;c[h>>2]=a;c[j>>2]=b;c[k>>2]=d;c[l>>2]=e;c[m>>2]=f;g[t>>2]=1.0;c[s>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;c[s+12>>2]=0;c[s+16>>2]=0;g[o>>2]=.800000011920929;c[p>>2]=1;while(1){if((c[p>>2]|0)>=(c[k>>2]>>1|0))break;g[(c[j>>2]|0)+(c[p>>2]<<2)>>2]=((+g[(c[c[h>>2]>>2]|0)+((c[p>>2]<<1)-1<<2)>>2]+ +g[(c[c[h>>2]>>2]|0)+((c[p>>2]<<1)+1<<2)>>2])*.5+ +g[(c[c[h>>2]>>2]|0)+(c[p>>2]<<1<<2)>>2])*.5;c[p>>2]=(c[p>>2]|0)+1}g[c[j>>2]>>2]=(+g[(c[c[h>>2]>>2]|0)+4>>2]*.5+ +g[c[c[h>>2]>>2]>>2])*.5;if((c[l>>2]|0)==2){c[p>>2]=1;while(1){if((c[p>>2]|0)>=(c[k>>2]>>1|0))break;b=(c[j>>2]|0)+(c[p>>2]<<2)|0;g[b>>2]=+g[b>>2]+((+g[(c[(c[h>>2]|0)+4>>2]|0)+((c[p>>2]<<1)-1<<2)>>2]+ +g[(c[(c[h>>2]|0)+4>>2]|0)+((c[p>>2]<<1)+1<<2)>>2])*.5+ +g[(c[(c[h>>2]|0)+4>>2]|0)+(c[p>>2]<<1<<2)>>2])*.5;c[p>>2]=(c[p>>2]|0)+1}b=c[j>>2]|0;g[b>>2]=+g[b>>2]+(+g[(c[(c[h>>2]|0)+4>>2]|0)+4>>2]*.5+ +g[c[(c[h>>2]|0)+4>>2]>>2])*.5}Yc(c[j>>2]|0,n,0,0,4,c[k>>2]>>1,c[m>>2]|0)|0;g[n>>2]=+g[n>>2]*1.000100016593933;c[p>>2]=1;while(1){if((c[p>>2]|0)>4)break;b=n+(c[p>>2]<<2)|0;g[b>>2]=+g[b>>2]-+g[n+(c[p>>2]<<2)>>2]*(+(c[p>>2]|0)*.00800000037997961)*(+(c[p>>2]|0)*.00800000037997961);c[p>>2]=(c[p>>2]|0)+1}Uc(q,n,4);c[p>>2]=0;while(1){if((c[p>>2]|0)>=4)break;g[t>>2]=+g[t>>2]*.8999999761581421;g[q+(c[p>>2]<<2)>>2]=+g[q+(c[p>>2]<<2)>>2]*+g[t>>2];c[p>>2]=(c[p>>2]|0)+1}g[r>>2]=+g[q>>2]+.800000011920929;g[r+4>>2]=+g[q+4>>2]+ +g[o>>2]*+g[q>>2];g[r+8>>2]=+g[q+8>>2]+ +g[o>>2]*+g[q+4>>2];g[r+12>>2]=+g[q+12>>2]+ +g[o>>2]*+g[q+8>>2];g[r+16>>2]=+g[o>>2]*+g[q+12>>2];Lc(c[j>>2]|0,r,c[j>>2]|0,c[k>>2]>>1,s);i=u;return}function Lc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;y=i;i=i+80|0;h=y+64|0;z=y+60|0;j=y+56|0;k=y+52|0;l=y+48|0;m=y+44|0;s=y+40|0;t=y+36|0;u=y+32|0;v=y+28|0;w=y+24|0;n=y+20|0;o=y+16|0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c[E>>2]<<2)>>2]<<1,c[v>>2]|0)|0;c[x>>2]=Tc(l+(c[E>>2]|0)|0,c[E>>2]<<1)|0}while(0);Sc(c[m>>2]|0,(c[m>>2]|0)+(0-(c[w>>2]|0)<<2)|0,(c[m>>2]|0)+(0-(c[x>>2]|0)<<2)|0,c[p>>2]|0,L,M);g[L>>2]=+g[L>>2]+ +g[M>>2];g[P>>2]=+g[f+(c[w>>2]<<2)>>2]+ +g[f+(c[x>>2]<<2)>>2];g[D>>2]=+g[L>>2]/+O(+(+g[K>>2]*2.0*1.0*+g[P>>2]+1.0));do if((N((c[w>>2]|0)-(c[r>>2]|0)|0)|0)<=1)g[A>>2]=+g[s>>2];else{if((N((c[w>>2]|0)-(c[r>>2]|0)|0)|0)<=2?(l=_((c[E>>2]|0)*5|0,c[E>>2]|0)|0,(l|0)<(c[v>>2]|0)):0){g[A>>2]=+g[s>>2]*.5;break}g[A>>2]=0.0}while(0);if(.30000001192092896>+g[C>>2]*.699999988079071-+g[A>>2])j=.30000001192092896;else j=+g[C>>2]*.699999988079071-+g[A>>2];g[I>>2]=j;if((c[w>>2]|0)>=((c[o>>2]|0)*3|0)){if((c[w>>2]|0)<(c[o>>2]<<1|0)){if(.5>+g[C>>2]*.8999999761581421-+g[A>>2])j=.5;else j=+g[C>>2]*.8999999761581421-+g[A>>2];g[I>>2]=j}}else{if(.4000000059604645>+g[C>>2]*.8500000238418579-+g[A>>2])j=.4000000059604645;else j=+g[C>>2]*.8500000238418579-+g[A>>2];g[I>>2]=j}if(+g[D>>2]>+g[I>>2]){g[y>>2]=+g[L>>2];g[z>>2]=+g[P>>2];c[u>>2]=c[w>>2];g[B>>2]=+g[D>>2]}c[E>>2]=(c[E>>2]|0)+1}g[y>>2]=0.0>+g[y>>2]?0.0:+g[y>>2];if(+g[z>>2]<=+g[y>>2])g[H>>2]=1.0;else g[H>>2]=+g[y>>2]/(+g[z>>2]+1.0);c[E>>2]=0;while(1){if((c[E>>2]|0)>=3)break;j=+Oc(c[m>>2]|0,(c[m>>2]|0)+(0-((c[u>>2]|0)+(c[E>>2]|0)-1)<<2)|0,c[p>>2]|0);g[J+(c[E>>2]<<2)>>2]=j;c[E>>2]=(c[E>>2]|0)+1}do if(!(+g[J+8>>2]-+g[J>>2]>(+g[J+4>>2]-+g[J>>2])*.699999988079071))if(+g[J>>2]-+g[J+8>>2]>(+g[J+4>>2]-+g[J+8>>2])*.699999988079071){c[G>>2]=-1;break}else{c[G>>2]=0;break}else c[G>>2]=1;while(0);if(+g[H>>2]>+g[B>>2])g[H>>2]=+g[B>>2];c[c[q>>2]>>2]=(c[u>>2]<<1)+(c[G>>2]|0);if((c[c[q>>2]>>2]|0)>=(c[F>>2]|0)){j=+g[H>>2];P=c[t>>2]|0;na(P|0);i=Q;return +j}c[c[q>>2]>>2]=c[F>>2];j=+g[H>>2];P=c[t>>2]|0;na(P|0);i=Q;return +j}function Sc(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+48|0;k=t+32|0;l=t+28|0;m=t+24|0;n=t+20|0;o=t+16|0;p=t+12|0;q=t+8|0;r=t+4|0;s=t;c[k>>2]=a;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;g[r>>2]=0.0;g[s>>2]=0.0;c[q>>2]=0;while(1){j=+g[r>>2];if((c[q>>2]|0)>=(c[n>>2]|0))break;g[r>>2]=j+ +g[(c[k>>2]|0)+(c[q>>2]<<2)>>2]*+g[(c[l>>2]|0)+(c[q>>2]<<2)>>2];g[s>>2]=+g[s>>2]+ +g[(c[k>>2]|0)+(c[q>>2]<<2)>>2]*+g[(c[m>>2]|0)+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}g[c[o>>2]>>2]=j;g[c[p>>2]>>2]=+g[s>>2];i=t;return}function Tc(a,b){a=a|0;b=b|0;var d=0,e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>2]|0)-1-(c[k>>2]|0)<<2)>>2]=+g[p>>2]+ +g[m>>2]*+g[o>>2];c[k>>2]=(c[k>>2]|0)+1}g[h>>2]=+g[h>>2]-+g[m>>2]*+g[m>>2]*+g[h>>2];if(+g[h>>2]<+g[c[e>>2]>>2]*1.0000000474974513e-03){e=15;break}c[j>>2]=(c[j>>2]|0)+1}if((e|0)==15){i=q;return}}function Vc(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+64|0;k=v+60|0;l=v+56|0;m=v+52|0;n=v+48|0;o=v+44|0;p=v+40|0;r=v+32|0;s=v+28|0;q=v+24|0;t=v+8|0;u=v;c[k>>2]=a;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;c[v+36>>2]=j;a=c[o>>2]|0;c[q>>2]=ia()|0;e=i;i=i+((1*(a<<2)|0)+15&-16)|0;a=i;i=i+((1*((c[n>>2]|0)+(c[o>>2]|0)<<2)|0)+15&-16)|0;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[o>>2]|0))break;g[e+(c[r>>2]<<2)>>2]=+g[(c[l>>2]|0)+((c[o>>2]|0)-(c[r>>2]|0)-1<<2)>>2];c[r>>2]=(c[r>>2]|0)+1}c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[o>>2]|0))break;g[a+(c[r>>2]<<2)>>2]=+g[(c[p>>2]|0)+((c[o>>2]|0)-(c[r>>2]|0)-1<<2)>>2];c[r>>2]=(c[r>>2]|0)+1}c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[n>>2]|0))break;g[a+((c[r>>2]|0)+(c[o>>2]|0)<<2)>>2]=+g[(c[k>>2]|0)+(c[r>>2]<<2)>>2];c[r>>2]=(c[r>>2]|0)+1}c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[o>>2]|0))break;g[(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1.5707963705062866));g[t>>2]=+Q(+((1.0-+g[v>>2])*1.5707963705062866));a:do if((c[k>>2]|0)>=(c[m>>2]<<3|0)){c[u>>2]=1;while(1){v=_(c[u>>2]|0,c[u>>2]|0)|0;v=_(v+(c[u>>2]|0)|0,c[m>>2]|0)|0;if((v+(c[m>>2]>>2)|0)>=(c[k>>2]|0))break a;c[u>>2]=(c[u>>2]|0)+1}}while(0);c[k>>2]=od(c[k>>2]|0,c[m>>2]|0)|0;c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[m>>2]|0))break;if((c[l>>2]|0)>=0){v=(c[j>>2]|0)+((_(c[s>>2]|0,c[k>>2]|0)|0)<<2)|0;pd(v,c[k>>2]|0,1,+g[p>>2],-+g[t>>2]);if(c[u>>2]|0){v=(c[j>>2]|0)+((_(c[s>>2]|0,c[k>>2]|0)|0)<<2)|0;pd(v,c[k>>2]|0,c[u>>2]|0,+g[t>>2],-+g[p>>2])}}else{if(c[u>>2]|0){v=(c[j>>2]|0)+((_(c[s>>2]|0,c[k>>2]|0)|0)<<2)|0;pd(v,c[k>>2]|0,c[u>>2]|0,+g[t>>2],+g[p>>2])}v=(c[j>>2]|0)+((_(c[s>>2]|0,c[k>>2]|0)|0)<<2)|0;pd(v,c[k>>2]|0,1,+g[p>>2],+g[t>>2])}c[s>>2]=(c[s>>2]|0)+1}i=w;return}function od(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>>>0)/((c[d>>2]|0)>>>0)|0|0}function pd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=+e;f=+f;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+48|0;h=u+44|0;j=u+40|0;k=u+36|0;l=u+32|0;m=u+28|0;o=u+24|0;p=u+20|0;n=u+16|0;q=u+12|0;s=u+8|0;r=u+4|0;t=u;c[h>>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(c[m>>2]<<2)>>2]=+g[l>>2]*+(c[(c[h>>2]|0)+(c[m>>2]<<2)>>2]|0);q=(c[m>>2]|0)+1|0;c[m>>2]=q}while((q|0)<(c[k>>2]|0));i=n;return}function td(a,b,d,e){a=a|0;b=b|0;d=+d;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=i;i=i+48|0;m=l+32|0;f=l+28|0;n=l+24|0;j=l+16|0;p=l+12|0;h=l+8|0;o=l+4|0;k=l;c[m>>2]=a;c[f>>2]=b;g[n>>2]=d;c[l+20>>2]=e;g[p>>2]=+ud(c[m>>2]|0,c[m>>2]|0,c[f>>2]|0)+1.0000000036274937e-15;g[o>>2]=+g[p>>2];d=1.0/+O(+(+g[o>>2]));g[h>>2]=d*+g[n>>2];c[k>>2]=c[m>>2];c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[f>>2]|0))break;g[c[k>>2]>>2]=+g[h>>2]*+g[c[k>>2]>>2];c[k>>2]=(c[k>>2]|0)+4;c[j>>2]=(c[j>>2]|0)+1}i=l;return}function ud(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;f=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[f>>2]=a;c[h>>2]=b;c[j>>2]=d;g[l>>2]=0.0;c[k>>2]=0;while(1){e=+g[l>>2];if((c[k>>2]|0)>=(c[j>>2]|0))break;g[l>>2]=e+ +g[(c[f>>2]|0)+(c[k>>2]<<2)>>2]*+g[(c[h>>2]|0)+(c[k>>2]<<2)>>2];c[k>>2]=(c[k>>2]|0)+1}i=m;return +e}function vd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0.0;t=i;i=i+64|0;h=t+48|0;j=t+44|0;u=t+40|0;k=t+36|0;n=t+28|0;o=t+24|0;q=t+20|0;s=t+16|0;l=t+12|0;m=t+8|0;p=t+4|0;r=t;c[h>>2]=a;c[j>>2]=b;c[u>>2]=d;c[k>>2]=e;c[t+32>>2]=f;g[m>>2]=1.0000000036274937e-15;g[l>>2]=1.0000000036274937e-15;a:do if(c[u>>2]|0){c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[k>>2]|0))break a;g[p>>2]=+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2]+ +g[(c[j>>2]|0)+(c[n>>2]<<2)>>2];g[r>>2]=+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2]-+g[(c[j>>2]|0)+(c[n>>2]<<2)>>2];g[l>>2]=+g[l>>2]+ +g[p>>2]*+g[p>>2];g[m>>2]=+g[m>>2]+ +g[r>>2]*+g[r>>2];c[n>>2]=(c[n>>2]|0)+1}}else{v=+ud(c[h>>2]|0,c[h>>2]|0,c[k>>2]|0);g[l>>2]=+g[l>>2]+v;v=+ud(c[j>>2]|0,c[j>>2]|0,c[k>>2]|0);g[m>>2]=+g[m>>2]+v}while(0);g[q>>2]=+O(+(+g[l>>2]));g[s>>2]=+O(+(+g[m>>2]));c[o>>2]=~~+M(+(+W(+(+g[s>>2]),+(+g[q>>2]))*10430.3818359375+.5));i=t;return c[o>>2]|0}function wd(a){a=a|0;var d=0,e=0,f=0,g=0,h=0;h=i;i=i+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;c[f>>2]=32767/((c[(c[d>>2]|0)+2340>>2]|0)+1|0)|0;c[e>>2]=0;c[g>>2]=0;while(1){if((c[g>>2]|0)>=(c[(c[d>>2]|0)+2340>>2]|0))break;c[e>>2]=(c[e>>2]|0)+(c[f>>2]|0);b[(c[d>>2]|0)+2772+1280+(c[g>>2]<<1)>>1]=c[e>>2];c[g>>2]=(c[g>>2]|0)+1}c[(c[d>>2]|0)+2772+1376>>2]=0;c[(c[d>>2]|0)+2772+1380>>2]=3176576;i=h;return} + function cg(a,d,e){a=a|0;d=d|0;e=e|0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;c[m>>2]=(c[m>>2]|0)+-1}i=t;return}function dg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function eg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function fg(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;f=m+20|0;g=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[f>>2]=a;c[g>>2]=d;c[h>>2]=e;c[k>>2]=gg(b[c[g>>2]>>1]|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;c[l>>2]=gg((b[(c[g>>2]|0)+2>>1]|0)-(b[c[g>>2]>>1]|0)|0,1)|0;c[l>>2]=131072/(c[l>>2]|0)|0;d=(hg((c[k>>2]|0)+(c[l>>2]|0)|0,32767)|0)&65535;b[c[f>>2]>>1]=d;c[j>>2]=1;while(1){if((c[j>>2]|0)>=((c[h>>2]|0)-1|0))break;c[k>>2]=gg((b[(c[g>>2]|0)+((c[j>>2]|0)+1<<1)>>1]|0)-(b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]|0)|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;d=(hg((c[k>>2]|0)+(c[l>>2]|0)|0,32767)|0)&65535;b[(c[f>>2]|0)+(c[j>>2]<<1)>>1]=d;c[l>>2]=gg((b[(c[g>>2]|0)+((c[j>>2]|0)+2<<1)>>1]|0)-(b[(c[g>>2]|0)+((c[j>>2]|0)+1<<1)>>1]|0)|0,1)|0;c[l>>2]=131072/(c[l>>2]|0)|0;d=(hg((c[k>>2]|0)+(c[l>>2]|0)|0,32767)|0)&65535;b[(c[f>>2]|0)+((c[j>>2]|0)+1<<1)>>1]=d;c[j>>2]=(c[j>>2]|0)+2}c[k>>2]=gg(32768-(b[(c[g>>2]|0)+((c[h>>2]|0)-1<<1)>>1]|0)|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;l=(hg((c[k>>2]|0)+(c[l>>2]|0)|0,32767)|0)&65535;b[(c[f>>2]|0)+((c[h>>2]|0)-1<<1)>>1]=l;i=m;return}function gg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function hg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function ig(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+32|0;g=m+20|0;h=m+16|0;j=m+12|0;k=m+8|0;n=m+4|0;l=m;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;oj(c[h>>2]|0,0,300)|0;d=(c[j>>2]|0)!=8e3&(c[j>>2]|0)!=12e3&(c[j>>2]|0)!=16e3;do if(c[n>>2]|0){if(!(d&(c[j>>2]|0)!=24e3&(c[j>>2]|0)!=48e3)?!((c[k>>2]|0)!=8e3&(c[k>>2]|0)!=12e3&(c[k>>2]|0)!=16e3):0){c[(c[h>>2]|0)+292>>2]=a[30493+((((c[j>>2]>>12)-((c[j>>2]|0)>16e3&1)>>((c[j>>2]|0)>24e3&1))-1|0)*3|0)+(((c[k>>2]>>12)-((c[k>>2]|0)>16e3&1)>>((c[k>>2]|0)>24e3&1))-1)>>0];break}c[g>>2]=-1;n=c[g>>2]|0;i=m;return n|0}else{if(!d?!((c[k>>2]|0)!=8e3&(c[k>>2]|0)!=12e3&(c[k>>2]|0)!=16e3&(c[k>>2]|0)!=24e3&(c[k>>2]|0)!=48e3):0){c[(c[h>>2]|0)+292>>2]=a[30508+((((c[j>>2]>>12)-((c[j>>2]|0)>16e3&1)>>((c[j>>2]|0)>24e3&1))-1|0)*5|0)+(((c[k>>2]>>12)-((c[k>>2]|0)>16e3&1)>>((c[k>>2]|0)>24e3&1))-1)>>0];break}c[g>>2]=-1;n=c[g>>2]|0;i=m;return n|0}while(0);c[(c[h>>2]|0)+284>>2]=(c[j>>2]|0)/1e3|0;c[(c[h>>2]|0)+288>>2]=(c[k>>2]|0)/1e3|0;c[(c[h>>2]|0)+268>>2]=(c[(c[h>>2]|0)+284>>2]|0)*10;c[l>>2]=0;e=c[k>>2]|0;b=c[j>>2]|0;do if((c[k>>2]|0)>(c[j>>2]|0)){d=(c[h>>2]|0)+264|0;if((e|0)==(b<<1|0)){c[d>>2]=1;break}else{c[d>>2]=2;c[l>>2]=1;break}}else{d=(c[h>>2]|0)+264|0;if((e|0)>=(b|0)){c[d>>2]=0;break}c[d>>2]=3;if((c[k>>2]<<2|0)==((c[j>>2]|0)*3|0)){c[(c[h>>2]|0)+280>>2]=3;c[(c[h>>2]|0)+276>>2]=18;c[(c[h>>2]|0)+296>>2]=24846;break}if(((c[k>>2]|0)*3|0)==(c[j>>2]<<1|0)){c[(c[h>>2]|0)+280>>2]=2;c[(c[h>>2]|0)+276>>2]=18;c[(c[h>>2]|0)+296>>2]=24904;break}if((c[k>>2]<<1|0)==(c[j>>2]|0)){c[(c[h>>2]|0)+280>>2]=1;c[(c[h>>2]|0)+276>>2]=24;c[(c[h>>2]|0)+296>>2]=24944;break}if(((c[k>>2]|0)*3|0)==(c[j>>2]|0)){c[(c[h>>2]|0)+280>>2]=1;c[(c[h>>2]|0)+276>>2]=36;c[(c[h>>2]|0)+296>>2]=24972;break}if((c[k>>2]<<2|0)==(c[j>>2]|0)){c[(c[h>>2]|0)+280>>2]=1;c[(c[h>>2]|0)+276>>2]=36;c[(c[h>>2]|0)+296>>2]=25012;break}if(((c[k>>2]|0)*6|0)==(c[j>>2]|0)){c[(c[h>>2]|0)+280>>2]=1;c[(c[h>>2]|0)+276>>2]=36;c[(c[h>>2]|0)+296>>2]=25052;break}c[g>>2]=-1;n=c[g>>2]|0;i=m;return n|0}while(0);c[(c[h>>2]|0)+272>>2]=((c[j>>2]<<14+(c[l>>2]|0)|0)/(c[k>>2]|0)|0)<<2;while(1){n=_(c[(c[h>>2]|0)+272>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;n=n+((_(c[(c[h>>2]|0)+272>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16)|0;n=n+(_(c[(c[h>>2]|0)+272>>2]|0,(c[k>>2]>>15)+1>>1)|0)|0;if((n|0)>=(c[j>>2]<>2]|0))break;n=(c[h>>2]|0)+272|0;c[n>>2]=(c[n>>2]|0)+1}c[g>>2]=0;n=c[g>>2]|0;i=m;return n|0}function jg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;f=l+16|0;g=l+12|0;h=l+8|0;j=l+4|0;k=l;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=e;c[k>>2]=(c[(c[f>>2]|0)+284>>2]|0)-(c[(c[f>>2]|0)+292>>2]|0);pj((c[f>>2]|0)+168+(c[(c[f>>2]|0)+292>>2]<<1)|0,c[h>>2]|0,c[k>>2]<<1|0)|0;switch(c[(c[f>>2]|0)+264>>2]|0){case 1:{sg(c[f>>2]|0,c[g>>2]|0,(c[f>>2]|0)+168|0,c[(c[f>>2]|0)+284>>2]|0);sg(c[f>>2]|0,(c[g>>2]|0)+(c[(c[f>>2]|0)+288>>2]<<1)|0,(c[h>>2]|0)+(c[k>>2]<<1)|0,(c[j>>2]|0)-(c[(c[f>>2]|0)+284>>2]|0)|0);break}case 2:{pg(c[f>>2]|0,c[g>>2]|0,(c[f>>2]|0)+168|0,c[(c[f>>2]|0)+284>>2]|0);pg(c[f>>2]|0,(c[g>>2]|0)+(c[(c[f>>2]|0)+288>>2]<<1)|0,(c[h>>2]|0)+(c[k>>2]<<1)|0,(c[j>>2]|0)-(c[(c[f>>2]|0)+284>>2]|0)|0);break}case 3:{ng(c[f>>2]|0,c[g>>2]|0,(c[f>>2]|0)+168|0,c[(c[f>>2]|0)+284>>2]|0);ng(c[f>>2]|0,(c[g>>2]|0)+(c[(c[f>>2]|0)+288>>2]<<1)|0,(c[h>>2]|0)+(c[k>>2]<<1)|0,(c[j>>2]|0)-(c[(c[f>>2]|0)+284>>2]|0)|0);break}default:{pj(c[g>>2]|0,(c[f>>2]|0)+168|0,c[(c[f>>2]|0)+284>>2]<<1|0)|0;pj((c[g>>2]|0)+(c[(c[f>>2]|0)+288>>2]<<1)|0,(c[h>>2]|0)+(c[k>>2]<<1)|0,(c[j>>2]|0)-(c[(c[f>>2]|0)+284>>2]|0)<<1|0)|0}}pj((c[f>>2]|0)+168|0,(c[h>>2]|0)+((c[j>>2]|0)-(c[(c[f>>2]|0)+292>>2]|0)<<1)|0,c[(c[f>>2]|0)+292>>2]<<1|0)|0;i=l;return 0}function kg(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+1968|0;g=q+1964|0;h=q+1960|0;j=q+1956|0;k=q+1952|0;o=q+1948|0;n=q+1944|0;p=q+1940|0;m=q+1936|0;l=q;c[g>>2]=a;c[h>>2]=d;c[j>>2]=e;c[k>>2]=f;d=c[g>>2]|0;c[l>>2]=c[d>>2];c[l+4>>2]=c[d+4>>2];c[l+8>>2]=c[d+8>>2];c[l+12>>2]=c[d+12>>2];while(1){c[o>>2]=(c[k>>2]|0)<480?c[k>>2]|0:480;mg((c[g>>2]|0)+16|0,l+16|0,c[j>>2]|0,25092,c[o>>2]|0);c[m>>2]=l;c[n>>2]=c[o>>2];while(1){if((c[n>>2]|0)<=2)break;d=_(c[c[m>>2]>>2]>>16,b[12548]|0)|0;c[p>>2]=d+((_(c[c[m>>2]>>2]&65535,b[12548]|0)|0)>>16);d=_(c[(c[m>>2]|0)+4>>2]>>16,b[12549]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+4>>2]&65535,b[12549]|0)|0)>>16));d=_(c[(c[m>>2]|0)+8>>2]>>16,b[12551]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+8>>2]&65535,b[12551]|0)|0)>>16));d=_(c[(c[m>>2]|0)+12>>2]>>16,b[12550]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+12>>2]&65535,b[12550]|0)|0)>>16));if(((c[p>>2]>>5)+1>>1|0)<=32767)if(((c[p>>2]>>5)+1>>1|0)<-32768)a=-32768;else a=(c[p>>2]>>5)+1>>1;else a=32767;d=c[h>>2]|0;c[h>>2]=d+2;b[d>>1]=a;d=_(c[(c[m>>2]|0)+4>>2]>>16,b[12550]|0)|0;c[p>>2]=d+((_(c[(c[m>>2]|0)+4>>2]&65535,b[12550]|0)|0)>>16);d=_(c[(c[m>>2]|0)+8>>2]>>16,b[12551]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+8>>2]&65535,b[12551]|0)|0)>>16));d=_(c[(c[m>>2]|0)+12>>2]>>16,b[12549]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+12>>2]&65535,b[12549]|0)|0)>>16));d=_(c[(c[m>>2]|0)+16>>2]>>16,b[12548]|0)|0;c[p>>2]=(c[p>>2]|0)+(d+((_(c[(c[m>>2]|0)+16>>2]&65535,b[12548]|0)|0)>>16));if(((c[p>>2]>>5)+1>>1|0)<=32767)if(((c[p>>2]>>5)+1>>1|0)<-32768)a=-32768;else a=(c[p>>2]>>5)+1>>1;else a=32767;d=c[h>>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]|0);c[p>>2]=(c[p>>2]|0)+(c[k>>2]|0);c[(c[g>>2]|0)+4>>2]=(c[m>>2]|0)+(c[k>>2]|0);if(((c[p>>2]>>10)+1>>1|0)<=32767)if(((c[p>>2]>>10)+1>>1|0)<-32768)a=-32768;else a=(c[p>>2]>>10)+1>>1;else a=32767;b[(c[h>>2]|0)+(c[n>>2]<<1)>>1]=a;c[n>>2]=(c[n>>2]|0)+1}i=q;return}function mg(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;h=p+24|0;j=p+20|0;k=p+16|0;l=p+12|0;m=p+8|0;n=p+4|0;o=p;c[h>>2]=a;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[m>>2]|0))break;c[o>>2]=(c[c[h>>2]>>2]|0)+(b[(c[k>>2]|0)+(c[n>>2]<<1)>>1]<<8);c[(c[j>>2]|0)+(c[n>>2]<<2)>>2]=c[o>>2];c[o>>2]=c[o>>2]<<2;d=_(c[o>>2]>>16,b[c[l>>2]>>1]|0)|0;d=(c[(c[h>>2]|0)+4>>2]|0)+(d+((_(c[o>>2]&65535,b[c[l>>2]>>1]|0)|0)>>16))|0;c[c[h>>2]>>2]=d;d=_(c[o>>2]>>16,b[(c[l>>2]|0)+2>>1]|0)|0;d=d+((_(c[o>>2]&65535,b[(c[l>>2]|0)+2>>1]|0)|0)>>16)|0;c[(c[h>>2]|0)+4>>2]=d;c[n>>2]=(c[n>>2]|0)+1}i=p;return}function ng(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=i;i=i+48|0;q=p+36|0;f=p+32|0;g=p+28|0;h=p+24|0;l=p+20|0;o=p+16|0;n=p+12|0;m=p+8|0;k=p+4|0;j=p;c[q>>2]=a;c[f>>2]=b;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>>2]=j;switch(c[w>>2]|0){case 18:{c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[q>>2]|0))break;c[s>>2]=(c[o>>2]|0)+(c[t>>2]>>16<<2);w=_((c[t>>2]&65535)>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=w+((_(c[t>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16);c[m>>2]=(c[p>>2]|0)+((c[l>>2]|0)*9<<1);w=_(c[c[s>>2]>>2]>>16,b[c[m>>2]>>1]|0)|0;c[u>>2]=w+((_(c[c[s>>2]>>2]&65535,b[c[m>>2]>>1]|0)|0)>>16);w=_(c[(c[s>>2]|0)+4>>2]>>16,b[(c[m>>2]|0)+2>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+4>>2]&65535,b[(c[m>>2]|0)+2>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+8>>2]>>16,b[(c[m>>2]|0)+4>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+8>>2]&65535,b[(c[m>>2]|0)+4>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+12>>2]>>16,b[(c[m>>2]|0)+6>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+12>>2]&65535,b[(c[m>>2]|0)+6>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+16>>2]>>16,b[(c[m>>2]|0)+8>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+16>>2]&65535,b[(c[m>>2]|0)+8>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+20>>2]>>16,b[(c[m>>2]|0)+10>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+20>>2]&65535,b[(c[m>>2]|0)+10>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+24>>2]>>16,b[(c[m>>2]|0)+12>>1]|0)|0;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|0)>>16));w=_(c[(c[s>>2]|0)+48>>2]>>16,b[(c[m>>2]|0)+10>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+48>>2]&65535,b[(c[m>>2]|0)+10>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+44>>2]>>16,b[(c[m>>2]|0)+12>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+44>>2]&65535,b[(c[m>>2]|0)+12>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+40>>2]>>16,b[(c[m>>2]|0)+14>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+40>>2]&65535,b[(c[m>>2]|0)+14>>1]|0)|0)>>16));w=_(c[(c[s>>2]|0)+36>>2]>>16,b[(c[m>>2]|0)+16>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_(c[(c[s>>2]|0)+36>>2]&65535,b[(c[m>>2]|0)+16>>1]|0)|0)>>16));if(((c[u>>2]>>5)+1>>1|0)<=32767)if(((c[u>>2]>>5)+1>>1|0)<-32768)e=-32768;else e=(c[u>>2]>>5)+1>>1;else e=32767;w=c[n>>2]|0;c[n>>2]=w+2;b[w>>1]=e;c[t>>2]=(c[t>>2]|0)+(c[r>>2]|0)}w=c[n>>2]|0;i=v;return w|0}case 24:{c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[q>>2]|0))break;c[s>>2]=(c[o>>2]|0)+(c[t>>2]>>16<<2);w=_((c[c[s>>2]>>2]|0)+(c[(c[s>>2]|0)+92>>2]|0)>>16,b[c[p>>2]>>1]|0)|0;c[u>>2]=w+((_((c[c[s>>2]>>2]|0)+(c[(c[s>>2]|0)+92>>2]|0)&65535,b[c[p>>2]>>1]|0)|0)>>16);w=_((c[(c[s>>2]|0)+4>>2]|0)+(c[(c[s>>2]|0)+88>>2]|0)>>16,b[(c[p>>2]|0)+2>>1]|0)|0;c[u>>2]=(c[u>>2]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0)+28>>2]|0)+(c[(c[s>>2]|0)+64>>2]|0)>>16,b[(c[p>>2]|0)+14>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+28>>2]|0)+(c[(c[s>>2]|0)+64>>2]|0)&65535,b[(c[p>>2]|0)+14>>1]|0)|0)>>16));w=_((c[(c[s>>2]|0)+32>>2]|0)+(c[(c[s>>2]|0)+60>>2]|0)>>16,b[(c[p>>2]|0)+16>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+32>>2]|0)+(c[(c[s>>2]|0)+60>>2]|0)&65535,b[(c[p>>2]|0)+16>>1]|0)|0)>>16));w=_((c[(c[s>>2]|0)+36>>2]|0)+(c[(c[s>>2]|0)+56>>2]|0)>>16,b[(c[p>>2]|0)+18>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+36>>2]|0)+(c[(c[s>>2]|0)+56>>2]|0)&65535,b[(c[p>>2]|0)+18>>1]|0)|0)>>16));w=_((c[(c[s>>2]|0)+40>>2]|0)+(c[(c[s>>2]|0)+52>>2]|0)>>16,b[(c[p>>2]|0)+20>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+40>>2]|0)+(c[(c[s>>2]|0)+52>>2]|0)&65535,b[(c[p>>2]|0)+20>>1]|0)|0)>>16));w=_((c[(c[s>>2]|0)+44>>2]|0)+(c[(c[s>>2]|0)+48>>2]|0)>>16,b[(c[p>>2]|0)+22>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+44>>2]|0)+(c[(c[s>>2]|0)+48>>2]|0)&65535,b[(c[p>>2]|0)+22>>1]|0)|0)>>16));if(((c[u>>2]>>5)+1>>1|0)<=32767)if(((c[u>>2]>>5)+1>>1|0)<-32768)e=-32768;else e=(c[u>>2]>>5)+1>>1;else e=32767;w=c[n>>2]|0;c[n>>2]=w+2;b[w>>1]=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[(c[s>>2]|0)+76>>2]|0)>>16,b[(c[p>>2]|0)+32>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+64>>2]|0)+(c[(c[s>>2]|0)+76>>2]|0)&65535,b[(c[p>>2]|0)+32>>1]|0)|0)>>16));w=_((c[(c[s>>2]|0)+68>>2]|0)+(c[(c[s>>2]|0)+72>>2]|0)>>16,b[(c[p>>2]|0)+34>>1]|0)|0;c[u>>2]=(c[u>>2]|0)+(w+((_((c[(c[s>>2]|0)+68>>2]|0)+(c[(c[s>>2]|0)+72>>2]|0)&65535,b[(c[p>>2]|0)+34>>1]|0)|0)>>16));if(((c[u>>2]>>5)+1>>1|0)<=32767)if(((c[u>>2]>>5)+1>>1|0)<-32768)e=-32768;else e=(c[u>>2]>>5)+1>>1;else e=32767;w=c[n>>2]|0;c[n>>2]=w+2;b[w>>1]=e;c[t>>2]=(c[t>>2]|0)+(c[r>>2]|0)}w=c[n>>2]|0;i=v;return w|0}default:{w=c[n>>2]|0;i=v;return w|0}}return 0}function pg(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=i;i=i+48|0;q=p+32|0;g=p+28|0;h=p+24|0;j=p+20|0;l=p+16|0;o=p+12|0;n=p+8|0;m=p+4|0;k=p;c[q>>2]=a;c[g>>2]=d;c[h>>2]=e;c[j>>2]=f;c[l>>2]=c[q>>2];d=(c[(c[l>>2]|0)+268>>2]<<1)+8|0;c[k>>2]=ia()|0;a=i;i=i+((1*(d<<1)|0)+15&-16)|0;d=(c[l>>2]|0)+24|0;b[a>>1]=b[d>>1]|0;b[a+2>>1]=b[d+2>>1]|0;b[a+4>>1]=b[d+4>>1]|0;b[a+6>>1]=b[d+6>>1]|0;b[a+8>>1]=b[d+8>>1]|0;b[a+10>>1]=b[d+10>>1]|0;b[a+12>>1]=b[d+12>>1]|0;b[a+14>>1]=b[d+14>>1]|0;c[m>>2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<1);c[n>>2]=_(b[c[l>>2]>>1]|0,b[25104+(c[o>>2]<<3)>>1]|0)|0;c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+2>>1]|0,b[25104+(c[o>>2]<<3)+2>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+4>>1]|0,b[25104+(c[o>>2]<<3)+4>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+6>>1]|0,b[25104+(c[o>>2]<<3)+6>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+8>>1]|0,b[25104+(11-(c[o>>2]|0)<<3)+6>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+10>>1]|0,b[25104+(11-(c[o>>2]|0)<<3)+4>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+12>>1]|0,b[25104+(11-(c[o>>2]|0)<<3)+2>>1]|0)|0);c[n>>2]=(c[n>>2]|0)+(_(b[(c[l>>2]|0)+14>>1]|0,b[25104+(11-(c[o>>2]|0)<<3)>>1]|0)|0);if(((c[n>>2]>>14)+1>>1|0)<=32767)if(((c[n>>2]>>14)+1>>1|0)<-32768)d=-32768;else d=(c[n>>2]>>14)+1>>1;else d=32767;a=c[g>>2]|0;c[g>>2]=a+2;b[a>>1]=d;c[m>>2]=(c[m>>2]|0)+(c[k>>2]|0)}i=p;return c[g>>2]|0}function rg(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+48|0;g=r+36|0;h=r+32|0;j=r+28|0;k=r+24|0;o=r+20|0;n=r+16|0;p=r+12|0;q=r+8|0;m=r+4|0;l=r;c[g>>2]=a;c[h>>2]=d;c[j>>2]=e;c[k>>2]=f;c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[k>>2]|0))break;c[n>>2]=b[(c[j>>2]|0)+(c[o>>2]<<1)>>1]<<10;c[m>>2]=(c[n>>2]|0)-(c[c[g>>2]>>2]|0);d=_(c[m>>2]>>16,b[12417]|0)|0;c[l>>2]=d+((_(c[m>>2]&65535,b[12417]|0)|0)>>16);c[p>>2]=(c[c[g>>2]>>2]|0)+(c[l>>2]|0);c[c[g>>2]>>2]=(c[n>>2]|0)+(c[l>>2]|0);c[m>>2]=(c[p>>2]|0)-(c[(c[g>>2]|0)+4>>2]|0);d=_(c[m>>2]>>16,b[12418]|0)|0;c[l>>2]=d+((_(c[m>>2]&65535,b[12418]|0)|0)>>16);c[q>>2]=(c[(c[g>>2]|0)+4>>2]|0)+(c[l>>2]|0);c[(c[g>>2]|0)+4>>2]=(c[p>>2]|0)+(c[l>>2]|0);c[m>>2]=(c[q>>2]|0)-(c[(c[g>>2]|0)+8>>2]|0);d=_(c[m>>2]>>16,b[12419]|0)|0;c[l>>2]=(c[m>>2]|0)+(d+((_(c[m>>2]&65535,b[12419]|0)|0)>>16));c[p>>2]=(c[(c[g>>2]|0)+8>>2]|0)+(c[l>>2]|0);c[(c[g>>2]|0)+8>>2]=(c[q>>2]|0)+(c[l>>2]|0);if(((c[p>>2]>>9)+1>>1|0)<=32767)if(((c[p>>2]>>9)+1>>1|0)<-32768)a=-32768;else a=(c[p>>2]>>9)+1>>1;else a=32767;b[(c[h>>2]|0)+(c[o>>2]<<1<<1)>>1]=a;c[m>>2]=(c[n>>2]|0)-(c[(c[g>>2]|0)+12>>2]|0);d=_(c[m>>2]>>16,b[12420]|0)|0;c[l>>2]=d+((_(c[m>>2]&65535,b[12420]|0)|0)>>16);c[p>>2]=(c[(c[g>>2]|0)+12>>2]|0)+(c[l>>2]|0);c[(c[g>>2]|0)+12>>2]=(c[n>>2]|0)+(c[l>>2]|0);c[m>>2]=(c[p>>2]|0)-(c[(c[g>>2]|0)+16>>2]|0);d=_(c[m>>2]>>16,b[12421]|0)|0;c[l>>2]=d+((_(c[m>>2]&65535,b[12421]|0)|0)>>16);c[q>>2]=(c[(c[g>>2]|0)+16>>2]|0)+(c[l>>2]|0);c[(c[g>>2]|0)+16>>2]=(c[p>>2]|0)+(c[l>>2]|0);c[m>>2]=(c[q>>2]|0)-(c[(c[g>>2]|0)+20>>2]|0);d=_(c[m>>2]>>16,b[12422]|0)|0;c[l>>2]=(c[m>>2]|0)+(d+((_(c[m>>2]&65535,b[12422]|0)|0)>>16));c[p>>2]=(c[(c[g>>2]|0)+20>>2]|0)+(c[l>>2]|0);c[(c[g>>2]|0)+20>>2]=(c[q>>2]|0)+(c[l>>2]|0);if(((c[p>>2]>>9)+1>>1|0)<=32767)if(((c[p>>2]>>9)+1>>1|0)<-32768)a=-32768;else a=(c[p>>2]>>9)+1>>1;else a=32767;b[(c[h>>2]|0)+((c[o>>2]<<1)+1<<1)>>1]=a;c[o>>2]=(c[o>>2]|0)+1}i=r;return}function sg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+32|0;l=f+16|0;j=f+12|0;h=f+8|0;g=f+4|0;k=f;c[l>>2]=a;c[j>>2]=b;c[h>>2]=d;c[g>>2]=e;c[k>>2]=c[l>>2];rg(c[k>>2]|0,c[j>>2]|0,c[h>>2]|0,c[g>>2]|0);i=f;return}function tg(a){a=a|0;var b=0,d=0,e=0,f=0;f=i;i=i+16|0;b=f+8|0;d=f+4|0;e=f;c[d>>2]=a;a=c[d>>2]|0;if((c[d>>2]|0)<0){c[d>>2]=0-a;if((c[d>>2]|0)>=192){c[b>>2]=0;e=c[b>>2]|0;i=f;return e|0}else{c[e>>2]=c[d>>2]>>5;c[b>>2]=(c[17960+(c[e>>2]<<2)>>2]|0)-(_((c[17984+(c[e>>2]<<2)>>2]&65535)<<16>>16,(c[d>>2]&31)<<16>>16)|0);e=c[b>>2]|0;i=f;return e|0}}else if((a|0)>=192){c[b>>2]=32767;e=c[b>>2]|0;i=f;return e|0}else{c[e>>2]=c[d>>2]>>5;c[b>>2]=(c[18008+(c[e>>2]<<2)>>2]|0)+(_((c[17984+(c[e>>2]<<2)>>2]&65535)<<16>>16,(c[d>>2]&31)<<16>>16)|0);e=c[b>>2]|0;i=f;return e|0}return 0}function ug(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;f=n+24|0;g=n+20|0;h=n+16|0;j=n+12|0;m=n+8|0;k=n+4|0;l=n;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=e;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[j>>2]|0))break;c[(c[g>>2]|0)+(c[k>>2]<<2)>>2]=c[k>>2];c[k>>2]=(c[k>>2]|0)+1}c[k>>2]=1;while(1){if((c[k>>2]|0)>=(c[j>>2]|0))break;c[m>>2]=c[(c[f>>2]|0)+(c[k>>2]<<2)>>2];c[l>>2]=(c[k>>2]|0)-1;while(1){if((c[l>>2]|0)<0)break;if((c[m>>2]|0)>=(c[(c[f>>2]|0)+(c[l>>2]<<2)>>2]|0))break;c[(c[f>>2]|0)+((c[l>>2]|0)+1<<2)>>2]=c[(c[f>>2]|0)+(c[l>>2]<<2)>>2];c[(c[g>>2]|0)+((c[l>>2]|0)+1<<2)>>2]=c[(c[g>>2]|0)+(c[l>>2]<<2)>>2];c[l>>2]=(c[l>>2]|0)+-1}c[(c[f>>2]|0)+((c[l>>2]|0)+1<<2)>>2]=c[m>>2];c[(c[g>>2]|0)+((c[l>>2]|0)+1<<2)>>2]=c[k>>2];c[k>>2]=(c[k>>2]|0)+1}c[k>>2]=c[j>>2];while(1){if((c[k>>2]|0)>=(c[h>>2]|0))break;c[m>>2]=c[(c[f>>2]|0)+(c[k>>2]<<2)>>2];if((c[m>>2]|0)<(c[(c[f>>2]|0)+((c[j>>2]|0)-1<<2)>>2]|0)){c[l>>2]=(c[j>>2]|0)-2;while(1){if((c[l>>2]|0)<0)break;if((c[m>>2]|0)>=(c[(c[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=0,h=0,j=0,k=0,l=0;l=i;i=i+48|0;e=l+40|0;f=l+36|0;j=l+32|0;g=l+8|0;h=l+4|0;k=l;c[e>>2]=a;c[f>>2]=d;c[j>>2]=ec(c[e>>2]|0,28978,8)|0;c[g+8>>2]=(c[j>>2]|0)/5|0;c[g+12+8>>2]=(c[j>>2]|0)-((c[g+8>>2]|0)*5|0);c[j>>2]=0;while(1){if((c[j>>2]|0)>=2)break;a=ec(c[e>>2]|0,29031,8)|0;c[g+((c[j>>2]|0)*12|0)>>2]=a;a=ec(c[e>>2]|0,29038,8)|0;c[g+((c[j>>2]|0)*12|0)+4>>2]=a;c[j>>2]=(c[j>>2]|0)+1}c[j>>2]=0;while(1){if((c[j>>2]|0)>=2)break;a=g+((c[j>>2]|0)*12|0)|0;c[a>>2]=(c[a>>2]|0)+((c[g+((c[j>>2]|0)*12|0)+8>>2]|0)*3|0);c[h>>2]=b[24526+(c[g+((c[j>>2]|0)*12|0)>>2]<<1)>>1];c[k>>2]=(((b[24526+((c[g+((c[j>>2]|0)*12|0)>>2]|0)+1<<1)>>1]|0)-(c[h>>2]|0)>>16)*6554|0)+(((b[24526+((c[g+((c[j>>2]|0)*12|0)>>2]|0)+1<<1)>>1]|0)-(c[h>>2]|0)&65535)*6554>>16);a=(c[h>>2]|0)+(_((c[k>>2]&65535)<<16>>16,((c[g+((c[j>>2]|0)*12|0)+4>>2]<<1)+1&65535)<<16>>16)|0)|0;c[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=a;c[j>>2]=(c[j>>2]|0)+1}k=c[f>>2]|0;c[k>>2]=(c[k>>2]|0)-(c[(c[f>>2]|0)+4>>2]|0);i=l;return}function yg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=i;i=i+16|0;f=d+4|0;e=d;c[f>>2]=a;c[e>>2]=b;a=ec(c[f>>2]|0,29003,8)|0;c[c[e>>2]>>2]=a;i=d;return}function zg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=i;i=i+16|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13)|0;if((c[q>>2]|0)>16384)f=16384;else f=(c[q>>2]|0)<-16384?-16384:c[q>>2]|0;c[q>>2]=f;w=_(c[q>>2]>>16,(c[q>>2]&65535)<<16>>16)|0;c[m>>2]=w+((_(c[q>>2]&65535,(c[q>>2]&65535)<<16>>16)|0)>>16);w=c[m>>2]|0;c[h>>2]=Cg(c[h>>2]|0,(c[m>>2]|0)>0?w:0-w|0)|0;c[n>>2]=c[n>>2]>>1;w=c[c[p>>2]>>2]|0;v=Fg(c[k>>2]|0)|0;v=_((v<>2])-(c[c[p>>2]>>2]|0)>>16,(c[h>>2]&65535)<<16>>16)|0;u=Fg(c[k>>2]|0)|0;u=w+(v+((_((u<>2])-(c[c[p>>2]>>2]|0)&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[c[p>>2]>>2]=u;u=_(c[j>>2]>>16,(c[q>>2]&65535)<<16>>16)|0;c[l>>2]=(c[l>>2]|0)-(u+((_(c[j>>2]&65535,(c[q>>2]&65535)<<16>>16)|0)>>16)<<4);u=_(c[k>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[l>>2]=(c[l>>2]|0)+(u+((_(c[k>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16)<<6);u=c[(c[p>>2]|0)+4>>2]|0;v=Fg(c[l>>2]|0)|0;v=_((v<>2])-(c[(c[p>>2]|0)+4>>2]|0)>>16,(c[h>>2]&65535)<<16>>16)|0;w=Fg(c[l>>2]|0)|0;w=u+(v+((_((w<>2])-(c[(c[p>>2]|0)+4>>2]|0)&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[p>>2]|0)+4>>2]=w;if((c[c[p>>2]>>2]|0)>1)f=c[c[p>>2]>>2]|0;else f=1;w=Dg(c[(c[p>>2]|0)+4>>2]|0,f,14)|0;c[c[o>>2]>>2]=w;if((c[c[o>>2]>>2]|0)>32767){v=32767;w=c[o>>2]|0;c[w>>2]=v;w=c[q>>2]|0;i=r;return w|0}if((c[c[o>>2]>>2]|0)<0){v=0;w=c[o>>2]|0;c[w>>2]=v;w=c[q>>2]|0;i=r;return w|0}v=c[c[o>>2]>>2]|0;w=c[o>>2]|0;c[w>>2]=v;w=c[q>>2]|0;i=r;return w|0}function Cg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Dg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=i;i=i+48|0;f=h+40|0;q=h+36|0;p=h+32|0;j=h+28|0;l=h+24|0;k=h+20|0;g=h+16|0;m=h+12|0;n=h+8|0;o=h+4|0;e=h;c[q>>2]=a;c[p>>2]=b;c[j>>2]=d;b=c[q>>2]|0;c[l>>2]=(Eg((c[q>>2]|0)>0?b:0-b|0)|0)-1;c[n>>2]=c[q>>2]<>2];b=c[p>>2]|0;c[k>>2]=(Eg((c[p>>2]|0)>0?b:0-b|0)|0)-1;c[o>>2]=c[p>>2]<>2];c[m>>2]=536870911/(c[o>>2]>>16|0)|0;b=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=b+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16);b=c[n>>2]|0;a=c[o>>2]|0;d=c[e>>2]|0;d=yj(a|0,((a|0)<0)<<31>>31|0,d|0,((d|0)<0)<<31>>31|0)|0;d=nj(d|0,C|0,32)|0;c[n>>2]=b-(d<<3);d=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=(c[e>>2]|0)+(d+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16));c[g>>2]=29+(c[l>>2]|0)-(c[k>>2]|0)-(c[j>>2]|0);d=c[g>>2]|0;if((c[g>>2]|0)>=0)if((d|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];q=c[f>>2]|0;i=h;return q|0}else{c[f>>2]=0;q=c[f>>2]|0;i=h;return q|0}a=c[e>>2]|0;b=0-(c[g>>2]|0)|0;do if((-2147483648>>0-d|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>b|0)){d=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){d=2147483647>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>b|0)){d=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){d=-2147483648>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}while(0);c[f>>2]=d<<0-(c[g>>2]|0);q=c[f>>2]|0;i=h;return q|0}function Eg(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function Fg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}Gg(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function Gg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=Eg(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(Hg(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function Hg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function Ig(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+48|0;f=r+40|0;g=r+36|0;k=r+32|0;l=r+28|0;o=r+24|0;m=r+20|0;q=r+16|0;n=r+12|0;j=r+8|0;h=r+4|0;p=r;c[f>>2]=d;c[g>>2]=e;c[p>>2]=0;c[o>>2]=0;while(1){if((c[o>>2]|0)>=2)break;c[j>>2]=2147483647;c[k>>2]=0;a:while(1){if((c[k>>2]|0)>=15)break;c[m>>2]=b[24526+(c[k>>2]<<1)>>1];c[q>>2]=(((b[24526+((c[k>>2]|0)+1<<1)>>1]|0)-(c[m>>2]|0)>>16)*6554|0)+(((b[24526+((c[k>>2]|0)+1<<1)>>1]|0)-(c[m>>2]|0)&65535)*6554>>16);c[l>>2]=0;while(1){if((c[l>>2]|0)>=5)break;c[n>>2]=(c[m>>2]|0)+(_((c[q>>2]&65535)<<16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g[(c[l>>2]|0)+(a+((c[o>>2]|0)+(c[n>>2]|0))<<2)>>2]=+h[m>>3];c[n>>2]=(c[n>>2]|0)+1}c[q>>2]=(c[q>>2]|0)+-4;c[o>>2]=(c[o>>2]|0)+1}i=r;return}function Mg(b){b=b|0;var d=0,e=0;e=i;i=i+16|0;d=e;c[d>>2]=b;We(c[d>>2]|0,(c[d>>2]|0)+5128+2|0)|0;b=c[d>>2]|0;if((c[(c[d>>2]|0)+4556>>2]|0)>=13){c[b+6116>>2]=0;c[(c[d>>2]|0)+6112>>2]=0;a[(c[d>>2]|0)+4768+29>>0]=1;a[(c[d>>2]|0)+4752+(c[(c[d>>2]|0)+5780>>2]|0)>>0]=1;i=e;return}a[b+4768+29>>0]=0;b=(c[d>>2]|0)+6116|0;c[b>>2]=(c[b>>2]|0)+1;b=c[d>>2]|0;if((c[(c[d>>2]|0)+6116>>2]|0)>=10){if((c[b+6116>>2]|0)>30){c[(c[d>>2]|0)+6116>>2]=10;c[(c[d>>2]|0)+6112>>2]=0}}else c[b+6112>>2]=0;a[(c[d>>2]|0)+4752+(c[(c[d>>2]|0)+5780>>2]|0)>>0]=0;i=e;return}function Ng(d,e,f,h,j,k){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;X=i;i=i+15152|0;o=X+13856|0;p=X+13852|0;q=X+13848|0;r=X+13844|0;s=X+13840|0;t=X+13836|0;u=X+13832|0;Q=X+12920|0;I=X+12916|0;J=X+12912|0;K=X+12908|0;A=X+12904|0;z=X+12900|0;P=X+12896|0;n=X+12892|0;m=X+12888|0;W=X+11608|0;l=X+8920|0;T=X+8872|0;U=X+8824|0;R=X+4444|0;S=X+64|0;V=X+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=0;c[F>>2]=ce((c[p>>2]|0)+4768|0,c[(c[p>>2]|0)+4604>>2]|0)|0;c[G>>2]=-1;c[H>>2]=-1;h=T;j=c[r>>2]|0;e=h+48|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(e|0));pj(R|0,(c[p>>2]|0)+144|0,4380)|0;c[V>>2]=a[(c[p>>2]|0)+4768+34>>0];b[x>>1]=b[(c[p>>2]|0)+5804>>1]|0;c[y>>2]=c[(c[p>>2]|0)+5800>>2];c[J>>2]=0;while(1){do if((c[F>>2]|0)!=(c[G>>2]|0)){if((c[F>>2]|0)==(c[H>>2]|0)){c[L>>2]=c[N>>2];break}if((c[J>>2]|0)>0){h=c[r>>2]|0;j=T;e=h+48|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(e|0));pj((c[p>>2]|0)+144|0,R|0,4380)|0;a[(c[p>>2]|0)+4768+34>>0]=c[V>>2];b[(c[p>>2]|0)+5804>>1]=b[x>>1]|0;c[(c[p>>2]|0)+5800>>2]=c[y>>2]}Bh(c[p>>2]|0,Q,(c[p>>2]|0)+4768|0,(c[p>>2]|0)+144|0,(c[p>>2]|0)+4804|0,W);Xd(c[p>>2]|0,c[r>>2]|0,c[(c[p>>2]|0)+5780>>2]|0,0,c[s>>2]|0);Yd(c[r>>2]|0,a[(c[p>>2]|0)+4768+29>>0]|0,a[(c[p>>2]|0)+4768+30>>0]|0,(c[p>>2]|0)+4804|0,c[(c[p>>2]|0)+4608>>2]|0);c[L>>2]=Rg(c[r>>2]|0)|0;if((c[u>>2]|0)==0&(c[J>>2]|0)==0?(c[L>>2]|0)<=(c[t>>2]|0):0)break a}else c[L>>2]=c[M>>2];while(0);if((c[J>>2]|0)==(c[K>>2]|0))break;do if((c[L>>2]|0)>(c[t>>2]|0))if((c[z>>2]|0)==0&(c[J>>2]|0)>=2){n=Q+852|0;g[n>>2]=+g[n>>2]*1.5;c[A>>2]=0;c[H>>2]=-1;break}else{c[A>>2]=1;c[N>>2]=c[L>>2];c[D>>2]=b[B>>1];c[H>>2]=c[F>>2];break}else{if((c[L>>2]|0)>=((c[t>>2]|0)-5|0))break a;c[z>>2]=1;c[M>>2]=c[L>>2];c[C>>2]=b[B>>1];if((c[F>>2]|0)!=(c[G>>2]|0)){c[G>>2]=c[F>>2];h=U;j=c[r>>2]|0;e=h+48|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(e|0));pj(w|0,c[c[r>>2]>>2]|0,c[(c[r>>2]|0)+24>>2]|0)|0;pj(S|0,(c[p>>2]|0)+144|0,4380)|0;a[v>>0]=a[(c[p>>2]|0)+7200>>0]|0}}while(0);do if(c[z>>2]&c[A>>2]){n=_((c[D>>2]|0)-(c[C>>2]|0)|0,(c[t>>2]|0)-(c[M>>2]|0)|0)|0;b[B>>1]=(c[C>>2]|0)+((n|0)/((c[N>>2]|0)-(c[M>>2]|0)|0)|0);if((b[B>>1]|0)>((c[C>>2]|0)+((c[D>>2]|0)-(c[C>>2]|0)>>2)|0)){b[B>>1]=(c[C>>2]|0)+((c[D>>2]|0)-(c[C>>2]|0)>>2);break}if((b[B>>1]|0)<((c[D>>2]|0)-((c[D>>2]|0)-(c[C>>2]|0)>>2)|0))b[B>>1]=(c[D>>2]|0)-((c[D>>2]|0)-(c[C>>2]|0)>>2)}else{c[E>>2]=Wf((((c[L>>2]|0)-(c[t>>2]|0)<<7|0)/(c[(c[p>>2]|0)+4608>>2]|0)|0)+2048|0)|0;c[E>>2]=Sg(c[E>>2]|0,131072)|0;if((c[L>>2]|0)>(c[t>>2]|0))c[E>>2]=Tg(c[E>>2]|0,85197)|0;n=_(c[E>>2]>>16,b[B>>1]|0)|0;b[B>>1]=n+((_(c[E>>2]&65535,b[B>>1]|0)|0)>>16)}while(0);c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break;n=_(c[Q+892+(c[I>>2]<<2)>>2]>>16,b[B>>1]|0)|0;if((n+((_(c[Q+892+(c[I>>2]<<2)>>2]&65535,b[B>>1]|0)|0)>>16)|0)<=8388607){n=_(c[Q+892+(c[I>>2]<<2)>>2]>>16,b[B>>1]|0)|0;if((n+((_(c[Q+892+(c[I>>2]<<2)>>2]&65535,b[B>>1]|0)|0)>>16)|0)<-8388608)h=-8388608;else{h=_(c[Q+892+(c[I>>2]<<2)>>2]>>16,b[B>>1]|0)|0;h=h+((_(c[Q+892+(c[I>>2]<<2)>>2]&65535,b[B>>1]|0)|0)>>16)|0}}else h=8388607;c[O+(c[I>>2]<<2)>>2]=h<<8;c[I>>2]=(c[I>>2]|0)+1}a[(c[p>>2]|0)+7200>>0]=a[Q+908>>0]|0;_d((c[p>>2]|0)+4768|0,O,(c[p>>2]|0)+7200|0,(c[s>>2]|0)==2&1,c[(c[p>>2]|0)+4604>>2]|0);c[F>>2]=ce((c[p>>2]|0)+4768|0,c[(c[p>>2]|0)+4604>>2]|0)|0;c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break;g[Q+(c[I>>2]<<2)>>2]=+(c[O+(c[I>>2]<<2)>>2]|0)/65536.0;c[I>>2]=(c[I>>2]|0)+1}c[J>>2]=(c[J>>2]|0)+1}if(c[z>>2]|0){if((c[F>>2]|0)!=(c[G>>2]|0)?(c[L>>2]|0)<=(c[t>>2]|0):0)break;h=c[r>>2]|0;j=U;e=h+48|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(e|0));pj(c[c[r>>2]>>2]|0,w|0,c[U+24>>2]|0)|0;pj((c[p>>2]|0)+144|0,S|0,4380)|0;a[(c[p>>2]|0)+7200>>0]=a[v>>0]|0}}while(0);qj((c[p>>2]|0)+9356|0,(c[p>>2]|0)+9356+(c[(c[p>>2]|0)+4608>>2]<<2)|0,(c[(c[p>>2]|0)+4616>>2]|0)+((c[(c[p>>2]|0)+4600>>2]|0)*5|0)<<2|0)|0;if(c[(c[p>>2]|0)+4712>>2]|0){c[c[q>>2]>>2]=0;c[o>>2]=c[P>>2];W=c[o>>2]|0;i=X;return W|0}else{c[(c[p>>2]|0)+4568>>2]=c[Q+228+((c[(c[p>>2]|0)+4604>>2]|0)-1<<2)>>2];a[(c[p>>2]|0)+4565>>0]=a[(c[p>>2]|0)+4768+29>>0]|0;c[(c[p>>2]|0)+4696>>2]=0;W=(Rg(c[r>>2]|0)|0)+7>>3;c[c[q>>2]>>2]=W;c[o>>2]=c[P>>2];W=c[o>>2]|0;i=X;return W|0}return 0}function Og(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;f=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[h>>2]=d;c[l>>2]=e;c[j>>2]=(c[l>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=+(b[(c[h>>2]|0)+(c[j>>2]<<1)>>1]|0);c[j>>2]=(c[j>>2]|0)+-1}i=k;return}function Pg(d,e,f,h){d=d|0;e=e|0;f=f|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+4448|0;j=s+4432|0;k=s+4428|0;l=s+4424|0;m=s+4420|0;p=s+4416|0;n=s+4400|0;o=s+4384|0;q=s+4380|0;r=s;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=h;c[q>>2]=(c[j>>2]|0)+6132+((c[(c[j>>2]|0)+5780>>2]|0)*36|0);if(!(c[(c[j>>2]|0)+6124>>2]|0)){i=s;return}if((c[(c[j>>2]|0)+4556>>2]|0)<=77){i=s;return}c[(c[j>>2]|0)+4756+(c[(c[j>>2]|0)+5780>>2]<<2)>>2]=1;pj(r|0,(c[j>>2]|0)+144|0,4380)|0;h=c[q>>2]|0;d=(c[j>>2]|0)+4768|0;e=h+36|0;do{b[h>>1]=b[d>>1]|0;h=h+2|0;d=d+2|0}while((h|0)<(e|0));pj(o|0,c[k>>2]|0,c[(c[j>>2]|0)+4604>>2]<<2|0)|0;if(!((c[(c[j>>2]|0)+5780>>2]|0)!=0?(c[(c[j>>2]|0)+4756+((c[(c[j>>2]|0)+5780>>2]|0)-1<<2)>>2]|0)!=0:0)){a[(c[j>>2]|0)+4564>>0]=a[(c[j>>2]|0)+7200>>0]|0;f=c[q>>2]|0;a[f>>0]=(a[f>>0]|0)+(c[(c[j>>2]|0)+6128>>2]|0);f=(Qg(a[c[q>>2]>>0]|0,63)|0)&255;a[c[q>>2]>>0]=f}ae(n,c[q>>2]|0,(c[j>>2]|0)+4564|0,(c[m>>2]|0)==2&1,c[(c[j>>2]|0)+4604>>2]|0);c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[(c[j>>2]|0)+4604>>2]|0))break;g[(c[k>>2]|0)+(c[p>>2]<<2)>>2]=+(c[n+(c[p>>2]<<2)>>2]|0)*.0000152587890625;c[p>>2]=(c[p>>2]|0)+1}Bh(c[j>>2]|0,c[k>>2]|0,c[q>>2]|0,r,(c[j>>2]|0)+6240+((c[(c[j>>2]|0)+5780>>2]|0)*320|0)|0,c[l>>2]|0);pj(c[k>>2]|0,o|0,c[(c[j>>2]|0)+4604>>2]<<2|0)|0;i=s;return}function Qg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Rg(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(aa(c[(c[d>>2]|0)+28>>2]|0)|0))|0;i=b;return a|0}function Sg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Tg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Ug(b,d,e,f){b=b|0;d=d|0;e=e|0;f=+f;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+1744|0;j=v+1700|0;k=v+1696|0;l=v+1692|0;h=v+1688|0;q=v+1684|0;u=v+1680|0;o=v+1616|0;r=v+1608|0;s=v+1604|0;t=v+1600|0;n=v+1704|0;p=v+1536|0;m=v;c[j>>2]=b;c[k>>2]=d;c[l>>2]=e;g[h>>2]=f;c[u>>2]=(c[(c[j>>2]|0)+4612>>2]|0)+(c[(c[j>>2]|0)+4664>>2]|0);a[(c[j>>2]|0)+4768+31>>0]=4;g[r>>2]=+Eh(o,c[l>>2]|0,+g[h>>2],c[u>>2]|0,c[(c[j>>2]|0)+4604>>2]|0,c[(c[j>>2]|0)+4664>>2]|0);a:do if((c[(c[j>>2]|0)+4656>>2]|0?(c[(c[j>>2]|0)+4696>>2]|0)==0:0)?(c[(c[j>>2]|0)+4604>>2]|0)==4:0){f=+Eh(p,(c[l>>2]|0)+(c[u>>2]<<1<<2)|0,+g[h>>2],c[u>>2]|0,2,c[(c[j>>2]|0)+4664>>2]|0);g[r>>2]=+g[r>>2]-f;xh(c[k>>2]|0,p,c[(c[j>>2]|0)+4664>>2]|0);g[s>>2]=3402823466385288598117041.0e14;c[q>>2]=3;while(1){if((c[q>>2]|0)<0)break a;de(n,(c[j>>2]|0)+4524|0,c[k>>2]|0,c[q>>2]|0,c[(c[j>>2]|0)+4664>>2]|0);zh(p,n,c[(c[j>>2]|0)+4664>>2]|0);Zg(m,p,c[l>>2]|0,c[u>>2]<<1,c[(c[j>>2]|0)+4664>>2]|0);f=+Gh(m+(c[(c[j>>2]|0)+4664>>2]<<2)|0,(c[u>>2]|0)-(c[(c[j>>2]|0)+4664>>2]|0)|0);g[t>>2]=f+ +Gh(m+(c[(c[j>>2]|0)+4664>>2]<<2)+(c[u>>2]<<2)|0,(c[u>>2]|0)-(c[(c[j>>2]|0)+4664>>2]|0)|0);f=+g[t>>2];if(!(+g[t>>2]<+g[r>>2])){if(f>+g[s>>2])break a}else{g[r>>2]=f;a[(c[j>>2]|0)+4768+31>>0]=c[q>>2]}g[s>>2]=+g[t>>2];c[q>>2]=(c[q>>2]|0)+-1}}while(0);if((a[(c[j>>2]|0)+4768+31>>0]|0)!=4){i=v;return}xh(c[k>>2]|0,o,c[(c[j>>2]|0)+4664>>2]|0);i=v;return}function Vg(a,b,d,e,f,h,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0.0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;L=i;i=i+192|0;n=L+188|0;O=L+184|0;o=L+180|0;N=L+176|0;p=L+172|0;q=L+168|0;r=L+164|0;B=L+160|0;M=L+156|0;G=L+152|0;H=L+148|0;C=L+144|0;J=L+140|0;v=L+136|0;t=L+132|0;s=L+128|0;D=L+112|0;I=L+104|0;F=L+100|0;E=L+80|0;K=L+64|0;x=L+48|0;z=L+44|0;u=L+24|0;A=L+8|0;y=L+4|0;w=L;c[n>>2]=a;c[O>>2]=b;c[o>>2]=d;c[N>>2]=e;c[p>>2]=f;c[q>>2]=h;c[r>>2]=j;c[B>>2]=k;c[M>>2]=l;c[C>>2]=c[n>>2];c[v>>2]=c[O>>2];c[y>>2]=(c[N>>2]|0)+(c[M>>2]<<2);c[H>>2]=0;while(1){if((c[H>>2]|0)>=(c[B>>2]|0))break;c[w>>2]=(c[y>>2]|0)+(0-((c[(c[p>>2]|0)+(c[H>>2]<<2)>>2]|0)+2)<<2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0;while(1){if((c[G>>2]|0)>=5)break;O=D+(c[H>>2]<<2)|0;g[O>>2]=+g[O>>2]+ +g[(c[C>>2]|0)+(c[G>>2]<<2)>>2];c[G>>2]=(c[G>>2]|0)+1}c[C>>2]=(c[C>>2]|0)+20;c[H>>2]=(c[H>>2]|0)+1}g[J>>2]=1.0000000474974513e-03;c[H>>2]=0;while(1){if((c[H>>2]|0)>=(c[B>>2]|0))break;g[J>>2]=+g[J>>2]+ +g[K+(c[H>>2]<<2)>>2];c[H>>2]=(c[H>>2]|0)+1}g[I>>2]=0.0;c[H>>2]=0;while(1){if((c[H>>2]|0)>=(c[B>>2]|0))break;g[I>>2]=+g[I>>2]+ +g[D+(c[H>>2]<<2)>>2]*+g[K+(c[H>>2]<<2)>>2];c[H>>2]=(c[H>>2]|0)+1}g[I>>2]=+g[I>>2]/+g[J>>2];c[C>>2]=c[n>>2];c[H>>2]=0;while(1){if((c[H>>2]|0)>=(c[B>>2]|0))break;g[F>>2]=.10000000149011612/(+g[K+(c[H>>2]<<2)>>2]+.10000000149011612)*(+g[I>>2]-+g[D+(c[H>>2]<<2)>>2]);g[J>>2]=0.0;c[G>>2]=0;while(1){if((c[G>>2]|0)>=5)break;if(+g[(c[C>>2]|0)+(c[G>>2]<<2)>>2]>.10000000149011612)m=+g[(c[C>>2]|0)+(c[G>>2]<<2)>>2];else m=.10000000149011612;g[E+(c[G>>2]<<2)>>2]=m;g[J>>2]=+g[J>>2]+ +g[E+(c[G>>2]<<2)>>2];c[G>>2]=(c[G>>2]|0)+1}g[J>>2]=+g[F>>2]/+g[J>>2];c[G>>2]=0;while(1){if((c[G>>2]|0)>=5)break;g[(c[C>>2]|0)+(c[G>>2]<<2)>>2]=+g[(c[C>>2]|0)+(c[G>>2]<<2)>>2]+ +g[E+(c[G>>2]<<2)>>2]*+g[J>>2];c[G>>2]=(c[G>>2]|0)+1}c[C>>2]=(c[C>>2]|0)+20;c[H>>2]=(c[H>>2]|0)+1}i=L;return}function Wg(a){a=+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0,(c[(c[k>>2]|0)+4672>>2]|0)+1|0);g[v>>2]=+g[v>>2]+(+g[v>>2]*1.0000000474974513e-03+1.0);g[u>>2]=+Vh(t,v,c[(c[k>>2]|0)+4672>>2]|0);g[(c[l>>2]|0)+868>>2]=+g[v>>2]/(+g[u>>2]>1.0?+g[u>>2]:1.0);Ih(s,t,c[(c[k>>2]|0)+4672>>2]|0);Fh(s,c[(c[k>>2]|0)+4672>>2]|0,.9900000095367432);Zg(c[m>>2]|0,s,c[r>>2]|0,c[q>>2]|0,c[(c[k>>2]|0)+4672>>2]|0);if(a[(c[k>>2]|0)+4768+29>>0]|0?(c[(c[k>>2]|0)+4696>>2]|0)==0:0){g[o>>2]=.6000000238418579;g[o>>2]=+g[o>>2]-+(c[(c[k>>2]|0)+4672>>2]|0)*.004000000189989805;g[o>>2]=+g[o>>2]-+(c[(c[k>>2]|0)+4556>>2]|0)*.10000000149011612*.00390625;g[o>>2]=+g[o>>2]-+(a[(c[k>>2]|0)+4565>>0]>>1|0)*.15000000596046448;g[o>>2]=+g[o>>2]-+(c[(c[k>>2]|0)+4744>>2]|0)*.10000000149011612*.000030517578125;z=(Lh(c[m>>2]|0,(c[l>>2]|0)+228|0,(c[k>>2]|0)+4768+26|0,(c[k>>2]|0)+4768+28|0,(c[k>>2]|0)+12236|0,c[(c[k>>2]|0)+4568>>2]|0,+(c[(c[k>>2]|0)+4676>>2]|0)/65536.0,+g[o>>2],c[(c[k>>2]|0)+4600>>2]|0,c[(c[k>>2]|0)+4668>>2]|0,c[(c[k>>2]|0)+4604>>2]|0,c[n>>2]|0)|0)==0;k=(c[k>>2]|0)+4768+29|0;if(z){a[k>>0]=2;i=p;return}else{a[k>>0]=1;i=p;return}}z=(c[l>>2]|0)+228|0;c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;c[z+12>>2]=0;b[(c[k>>2]|0)+4768+26>>1]=0;a[(c[k>>2]|0)+4768+28>>0]=0;g[(c[k>>2]|0)+12236>>2]=0.0;i=p;return}function Yg(d,e,f,h,j){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0.0;y=i;i=i+2048|0;l=y+2004|0;m=y+2e3|0;n=y+1996|0;o=y+1992|0;p=y+1988|0;t=y+1984|0;r=y+1584|0;u=y+1568|0;s=y+1552|0;k=y+2008|0;x=y+1548|0;w=y+1544|0;q=y+8|0;v=y;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=h;c[p>>2]=j;c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[(c[l>>2]|0)+4604>>2]|0))break;g[u+(c[t>>2]<<2)>>2]=1.0/+g[(c[m>>2]|0)+(c[t>>2]<<2)>>2];g[s+(c[t>>2]<<2)>>2]=+g[u+(c[t>>2]<<2)>>2]*+g[u+(c[t>>2]<<2)>>2];c[t>>2]=(c[t>>2]|0)+1}if((a[(c[l>>2]|0)+4768+29>>0]|0)==2){Vg((c[m>>2]|0)+144|0,r,(c[m>>2]|0)+872|0,c[n>>2]|0,(c[m>>2]|0)+228|0,s,c[(c[l>>2]|0)+4612>>2]|0,c[(c[l>>2]|0)+4604>>2]|0,c[(c[l>>2]|0)+4616>>2]|0);Ch((c[m>>2]|0)+144|0,(c[l>>2]|0)+4768+4|0,(c[l>>2]|0)+4768+32|0,(c[l>>2]|0)+4688|0,r,c[(c[l>>2]|0)+4684>>2]|0,c[(c[l>>2]|0)+4680>>2]|0,c[(c[l>>2]|0)+4604>>2]|0,c[(c[l>>2]|0)+5124>>2]|0);eh(c[l>>2]|0,c[m>>2]|0,c[p>>2]|0);dh(q,(c[o>>2]|0)+(0-(c[(c[l>>2]|0)+4664>>2]|0)<<2)|0,(c[m>>2]|0)+144|0,(c[m>>2]|0)+228|0,u,c[(c[l>>2]|0)+4612>>2]|0,c[(c[l>>2]|0)+4604>>2]|0,c[(c[l>>2]|0)+4664>>2]|0)}else{c[x>>2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(h,f,k,e);e=c[m>>2]|0;e=e+876|0;f=c[m>>2]|0;f=f+16|0;h=c[m>>2]|0;w=c[l>>2]|0;w=w+4612|0;w=c[w>>2]|0;x=c[l>>2]|0;x=x+4604|0;x=c[x>>2]|0;m=c[l>>2]|0;m=m+4664|0;m=c[m>>2]|0;rh(e,q,f,h,w,x,m);m=c[l>>2]|0;m=m+4524|0;l=m+32|0;do{b[m>>1]=b[k>>1]|0;m=m+2|0;k=k+2|0}while((m|0)<(l|0));i=y;return}}function Zg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;g=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[g>>2]=a;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;switch(c[l>>2]|0){case 6:{_g(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[k>>2]|0);break}case 8:{$g(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[k>>2]|0);break}case 10:{ah(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[k>>2]|0);break}case 12:{bh(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[k>>2]|0);break}case 16:{ch(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[k>>2]|0);break}default:{}}oj(c[g>>2]|0,0,c[l>>2]<<2|0)|0;i=m;return}function _g(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+32|0;f=o+24|0;h=o+20|0;j=o+16|0;k=o+12|0;m=o+8|0;l=o+4|0;n=o;c[f>>2]=a;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=6;while(1){if((c[m>>2]|0)>=(c[k>>2]|0))break;c[n>>2]=(c[j>>2]|0)+((c[m>>2]|0)-1<<2);g[l>>2]=+g[c[n>>2]>>2]*+g[c[h>>2]>>2]+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2]|0)+(0-(c[(c[m>>2]|0)+(c[w>>2]<<2)>>2]|0)<<2);g[u>>2]=+g[(c[n>>2]|0)+(c[w>>2]<<2)>>2];c[t>>2]=0;while(1){if((c[t>>2]|0)>=5)break;g[r+(c[t>>2]<<2)>>2]=+g[(c[l>>2]|0)+(((c[w>>2]|0)*5|0)+(c[t>>2]|0)<<2)>>2];c[t>>2]=(c[t>>2]|0)+1}c[t>>2]=0;while(1){if((c[t>>2]|0)>=((c[o>>2]|0)+(c[q>>2]|0)|0))break;g[(c[s>>2]|0)+(c[t>>2]<<2)>>2]=+g[(c[y>>2]|0)+(c[t>>2]<<2)>>2];c[v>>2]=0;while(1){if((c[v>>2]|0)>=5)break;B=(c[s>>2]|0)+(c[t>>2]<<2)|0;g[B>>2]=+g[B>>2]-+g[r+(c[v>>2]<<2)>>2]*+g[(c[x>>2]|0)+(2-(c[v>>2]|0)<<2)>>2];c[v>>2]=(c[v>>2]|0)+1}B=(c[s>>2]|0)+(c[t>>2]<<2)|0;g[B>>2]=+g[B>>2]*+g[u>>2];c[x>>2]=(c[x>>2]|0)+4;c[t>>2]=(c[t>>2]|0)+1}c[s>>2]=(c[s>>2]|0)+((c[o>>2]|0)+(c[q>>2]|0)<<2);c[y>>2]=(c[y>>2]|0)+(c[o>>2]<<2);c[w>>2]=(c[w>>2]|0)+1}i=z;return}function eh(d,e,f){d=d|0;e=e|0;f=f|0;var h=0.0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+16|0;k=m+12|0;l=m+8|0;n=m+4|0;j=m;c[k>>2]=d;c[l>>2]=e;c[n>>2]=f;f=c[k>>2]|0;if(!(c[n>>2]|0)){c[j>>2]=(c[f+4640>>2]|0)+(c[(c[k>>2]|0)+5776>>2]|0);if(!(+(c[j>>2]|0)*+g[(c[l>>2]|0)+872>>2]*.10000000149011612>2.0))if(+(c[j>>2]|0)*+g[(c[l>>2]|0)+872>>2]*.10000000149011612<0.0)h=0.0;else h=+(c[j>>2]|0)*+g[(c[l>>2]|0)+872>>2]*.10000000149011612;else h=2.0;a[(c[k>>2]|0)+4768+33>>0]=~~h}else a[f+4768+33>>0]=0;g[(c[l>>2]|0)+224>>2]=+(b[24566+(a[(c[k>>2]|0)+4768+33>>0]<<1)>>1]|0)/16384.0;i=m;return}function fh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,Q=0.0,R=0;M=i;i=i+1152|0;D=M+1140|0;E=M+1136|0;h=M+1132|0;R=M+1128|0;K=M+1124|0;J=M+1120|0;m=M+1116|0;q=M+1112|0;F=M+1108|0;G=M+1104|0;H=M+1100|0;w=M+1096|0;x=M+1092|0;k=M+1088|0;l=M+1084|0;j=M+1080|0;s=M+1076|0;o=M+1072|0;p=M+1068|0;v=M+1064|0;u=M+1060|0;L=M+1056|0;I=M+1052|0;A=M+1048|0;C=M+88|0;r=M+20|0;B=M+16|0;n=M+12|0;y=M+8|0;z=M+4|0;t=M;c[D>>2]=b;c[E>>2]=d;c[h>>2]=e;c[R>>2]=f;c[K>>2]=(c[D>>2]|0)+7200;c[B>>2]=(c[R>>2]|0)+(0-(c[(c[D>>2]|0)+4624>>2]|0)<<2);g[q>>2]=+(c[(c[D>>2]|0)+4748>>2]|0)*.0078125;g[(c[E>>2]|0)+856>>2]=+((c[(c[D>>2]|0)+4728>>2]|0)+(c[(c[D>>2]|0)+4728+4>>2]|0)|0)*.5*.000030517578125;Q=+gh((+g[q>>2]-20.0)*.25);g[(c[E>>2]|0)+860>>2]=Q;if(!(c[(c[D>>2]|0)+4708>>2]|0)){g[I>>2]=1.0-+(c[(c[D>>2]|0)+4556>>2]|0)*.00390625;g[q>>2]=+g[q>>2]-+g[(c[E>>2]|0)+860>>2]*2.0*(+g[(c[E>>2]|0)+856>>2]*.5+.5)*+g[I>>2]*+g[I>>2]}e=c[D>>2]|0;if((a[(c[D>>2]|0)+4768+29>>0]|0)==2)g[q>>2]=+g[q>>2]+ +g[e+12236>>2]*2.0;else g[q>>2]=+g[q>>2]+(+(c[e+4748>>2]|0)*-.4000000059604645*.0078125+6.0)*(1.0-+g[(c[E>>2]|0)+856>>2]);e=c[D>>2]|0;if((a[(c[D>>2]|0)+4768+29>>0]|0)==2){a[e+4768+30>>0]=0;g[(c[E>>2]|0)+864>>2]=0.0}else{c[m>>2]=c[e+4600>>2]<<1;g[j>>2]=0.0;g[l>>2]=0.0;c[n>>2]=c[h>>2];c[J>>2]=0;while(1){if((c[J>>2]|0)>=((((c[(c[D>>2]|0)+4604>>2]&65535)<<16>>16)*5|0)/2|0|0))break;Q=+(c[m>>2]|0);g[w>>2]=Q+ +Gh(c[n>>2]|0,c[m>>2]|0);g[k>>2]=+hh(+g[w>>2]);if((c[J>>2]|0)>0){Q=+N(+(+g[k>>2]-+g[l>>2]));g[j>>2]=+g[j>>2]+Q}g[l>>2]=+g[k>>2];c[n>>2]=(c[n>>2]|0)+(c[m>>2]<<2);c[J>>2]=(c[J>>2]|0)+1}Q=+gh((+g[j>>2]-5.0)*.4000000059604645);g[(c[E>>2]|0)+864>>2]=Q;e=(c[D>>2]|0)+4768+30|0;if(+g[(c[E>>2]|0)+864>>2]>.75)a[e>>0]=0;else a[e>>0]=1;g[q>>2]=+g[q>>2]+(+g[(c[E>>2]|0)+864>>2]-.5)*2.0}g[L>>2]=+g[(c[E>>2]|0)+868>>2]*1.0000000474974513e-03;Q=.949999988079071/(+g[L>>2]*+g[L>>2]+1.0);g[p>>2]=Q;g[o>>2]=Q;g[s>>2]=(1.0-+g[(c[E>>2]|0)+860>>2]*.75)*.009999999776482582;g[o>>2]=+g[o>>2]-+g[s>>2];g[p>>2]=+g[p>>2]+ +g[s>>2];g[o>>2]=+g[o>>2]/+g[p>>2];if((c[(c[D>>2]|0)+4704>>2]|0)>0)g[A>>2]=+(c[(c[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>2]<<4<<2)|0,c[(c[D>>2]|0)+4660>>2]<<2|0)|0;Fh((c[E>>2]|0)+244+(c[J>>2]<<4<<2)|0,c[(c[D>>2]|0)+4660>>2]|0,+g[o>>2]);g[x>>2]=+Kh((c[E>>2]|0)+500+(c[J>>2]<<4<<2)|0,c[(c[D>>2]|0)+4660>>2]|0);g[w>>2]=+Kh((c[E>>2]|0)+244+(c[J>>2]<<4<<2)|0,c[(c[D>>2]|0)+4660>>2]|0);g[(c[E>>2]|0)+788+(c[J>>2]<<2)>>2]=1.0-(1.0-+g[x>>2]/+g[w>>2])*.699999988079071;jh((c[E>>2]|0)+500+(c[J>>2]<<4<<2)|0,(c[E>>2]|0)+244+(c[J>>2]<<4<<2)|0,+g[A>>2],3.999000072479248,c[(c[D>>2]|0)+4660>>2]|0);c[J>>2]=(c[J>>2]|0)+1}g[v>>2]=+P(2.0,+(+g[q>>2]*-.1599999964237213));g[u>>2]=+P(2.0,.3199999928474426);c[J>>2]=0;while(1){if((c[J>>2]|0)>=(c[(c[D>>2]|0)+4604>>2]|0))break;R=(c[E>>2]|0)+(c[J>>2]<<2)|0;g[R>>2]=+g[R>>2]*+g[v>>2];R=(c[E>>2]|0)+(c[J>>2]<<2)|0;g[R>>2]=+g[R>>2]+ +g[u>>2];c[J>>2]=(c[J>>2]|0)+1}g[v>>2]=+g[(c[E>>2]|0)+860>>2]*.10000000149011612+1.0499999523162842;c[J>>2]=0;while(1){if((c[J>>2]|0)>=(c[(c[D>>2]|0)+4604>>2]|0))break;R=(c[E>>2]|0)+788+(c[J>>2]<<2)|0;g[R>>2]=+g[R>>2]*+g[v>>2];c[J>>2]=(c[J>>2]|0)+1}g[L>>2]=((+(c[(c[D>>2]|0)+4728>>2]|0)*.000030517578125-1.0)*.5+1.0)*4.0;g[L>>2]=+g[L>>2]*(+(c[(c[D>>2]|0)+4556>>2]|0)*.00390625);if((a[(c[D>>2]|0)+4768+29>>0]|0)==2){c[J>>2]=0;while(1){e=c[D>>2]|0;if((c[J>>2]|0)>=(c[(c[D>>2]|0)+4604>>2]|0))break;g[I>>2]=.20000000298023224/+(c[e+4600>>2]|0)+3.0/+(c[(c[E>>2]|0)+228+(c[J>>2]<<2)>>2]|0);g[(c[E>>2]|0)+756+(c[J>>2]<<2)>>2]=+g[I>>2]+-1.0;g[(c[E>>2]|0)+772+(c[J>>2]<<2)>>2]=1.0-+g[I>>2]-+g[I>>2]*+g[L>>2];c[J>>2]=(c[J>>2]|0)+1}g[H>>2]=-.25-+(c[e+4556>>2]|0)*.26249998807907104*.00390625}else{g[I>>2]=1.2999999523162842/+(c[(c[D>>2]|0)+4600>>2]|0);g[(c[E>>2]|0)+756>>2]=+g[I>>2]+-1.0;g[(c[E>>2]|0)+772>>2]=1.0-+g[I>>2]-+g[I>>2]*+g[L>>2]*.6000000238418579;c[J>>2]=1;while(1){if((c[J>>2]|0)>=(c[(c[D>>2]|0)+4604>>2]|0))break;g[(c[E>>2]|0)+756+(c[J>>2]<<2)>>2]=+g[(c[E>>2]|0)+756>>2];g[(c[E>>2]|0)+772+(c[J>>2]<<2)>>2]=+g[(c[E>>2]|0)+772>>2];c[J>>2]=(c[J>>2]|0)+1}g[H>>2]=-.25}g[F>>2]=(1.0-+g[(c[E>>2]|0)+860>>2])*.10000000149011612*+g[(c[D>>2]|0)+12236>>2];g[F>>2]=+g[F>>2]+(1.0-+g[(c[E>>2]|0)+856>>2])*.10000000149011612;if((a[(c[D>>2]|0)+4768+29>>0]|0)==2){g[G>>2]=.30000001192092896;g[G>>2]=+g[G>>2]+(1.0-(1.0-+g[(c[E>>2]|0)+860>>2])*+g[(c[E>>2]|0)+856>>2])*.20000000298023224;Q=+O(+(+g[(c[D>>2]|0)+12236>>2]));g[G>>2]=+g[G>>2]*Q}else g[G>>2]=0.0;c[J>>2]=0;while(1){if((c[J>>2]|0)>=(c[(c[D>>2]|0)+4604>>2]|0))break;R=(c[K>>2]|0)+4|0;g[R>>2]=+g[R>>2]+(+g[F>>2]-+g[(c[K>>2]|0)+4>>2])*.4000000059604645;g[(c[E>>2]|0)+804+(c[J>>2]<<2)>>2]=+g[(c[K>>2]|0)+4>>2];R=(c[K>>2]|0)+8|0;g[R>>2]=+g[R>>2]+(+g[G>>2]-+g[(c[K>>2]|0)+8>>2])*.4000000059604645;g[(c[E>>2]|0)+836+(c[J>>2]<<2)>>2]=+g[(c[K>>2]|0)+8>>2];R=(c[K>>2]|0)+12|0;g[R>>2]=+g[R>>2]+(+g[H>>2]-+g[(c[K>>2]|0)+12>>2])*.4000000059604645;g[(c[E>>2]|0)+820+(c[J>>2]<<2)>>2]=+g[(c[K>>2]|0)+12>>2];c[J>>2]=(c[J>>2]|0)+1}i=M;return}function gh(a){a=+a;var b=0,c=0;b=i;i=i+16|0;c=b;g[c>>2]=a;a=1.0/(+X(+-+g[c>>2])+1.0);i=b;return +a}function hh(a){a=+a;var b=0,c=0;b=i;i=i+16|0;c=b;h[c>>3]=a;a=+hj(+h[c>>3])*3.32192809488736;i=b;return +a}function ih(a,b,d){a=a|0;b=+b;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0;k=i;i=i+32|0;e=k+16|0;f=k+12|0;l=k+8|0;j=k+4|0;h=k;c[e>>2]=a;g[f>>2]=b;c[l>>2]=d;g[f>>2]=-+g[f>>2];g[h>>2]=+g[(c[e>>2]|0)+((c[l>>2]|0)-1<<2)>>2];c[j>>2]=(c[l>>2]|0)-2;while(1){b=+g[f>>2]*+g[h>>2];if((c[j>>2]|0)<0)break;g[h>>2]=b+ +g[(c[e>>2]|0)+(c[j>>2]<<2)>>2];c[j>>2]=(c[j>>2]|0)+-1}i=k;return +(1.0/(1.0-b))}function jh(a,b,d,e,f){a=a|0;b=b|0;d=+d;e=+e;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+64|0;h=v+48|0;j=v+44|0;k=v+40|0;l=v+36|0;m=v+32|0;q=v+28|0;s=v+24|0;r=v+20|0;u=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f>>2]*+g[p>>2];f=(c[j>>2]|0)+(c[q>>2]<<2)|0;g[f>>2]=+g[f>>2]*+g[o>>2];c[q>>2]=(c[q>>2]|0)+1}c[s>>2]=(c[s>>2]|0)+1}if((b|0)==31){i=v;return}}function kh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;y=i;i=i+464|0;h=y+460|0;j=y+456|0;z=y+452|0;A=y+448|0;q=y+444|0;s=y+440|0;t=y+436|0;u=y+432|0;n=y+428|0;r=y+424|0;p=y+420|0;o=y+416|0;l=y+408|0;k=y+404|0;v=y+400|0;w=y+396|0;m=y+384|0;x=y;c[h>>2]=b;c[j>>2]=d;c[z>>2]=e;c[A>>2]=f;c[q>>2]=(c[h>>2]|0)+7216;c[v>>2]=c[A>>2];c[w>>2]=c[z>>2];c[u>>2]=c[(c[q>>2]|0)+2136>>2];c[t>>2]=0;while(1){b=c[h>>2]|0;if((c[t>>2]|0)>=(c[(c[h>>2]|0)+4604>>2]|0))break;if((a[b+4768+29>>0]|0)==2)c[u>>2]=c[(c[j>>2]|0)+228+(c[t>>2]<<2)>>2];g[n>>2]=+g[(c[j>>2]|0)+836+(c[t>>2]<<2)>>2]*(1.0-+g[(c[j>>2]|0)+804+(c[t>>2]<<2)>>2]);g[m>>2]=+g[n>>2]*.25;g[m+4>>2]=+g[n>>2]*.4999847412109375;g[m+8>>2]=+g[n>>2]*.25;g[r>>2]=+g[(c[j>>2]|0)+820+(c[t>>2]<<2)>>2];g[p>>2]=+g[(c[j>>2]|0)+756+(c[t>>2]<<2)>>2];g[o>>2]=+g[(c[j>>2]|0)+772+(c[t>>2]<<2)>>2];c[k>>2]=(c[j>>2]|0)+244+(c[t>>2]<<4<<2);lh((c[q>>2]|0)+2048|0,x,c[k>>2]|0,c[v>>2]|0,+(c[(c[h>>2]|0)+4704>>2]|0)/65536.0,c[(c[h>>2]|0)+4612>>2]|0,c[(c[h>>2]|0)+4660>>2]|0);g[l>>2]=+g[(c[j>>2]|0)+788+(c[t>>2]<<2)>>2];g[l+4>>2]=-+g[(c[j>>2]|0)+788+(c[t>>2]<<2)>>2]*(+g[(c[j>>2]|0)+804+(c[t>>2]<<2)>>2]*+g[n>>2]+.05000000074505806+ +g[(c[j>>2]|0)+860>>2]*.10000000149011612);g[c[w>>2]>>2]=+g[l>>2]*+g[x>>2]+ +g[l+4>>2]*+g[(c[q>>2]|0)+2128>>2];c[s>>2]=1;while(1){if((c[s>>2]|0)>=(c[(c[h>>2]|0)+4612>>2]|0))break;g[(c[w>>2]|0)+(c[s>>2]<<2)>>2]=+g[l>>2]*+g[x+(c[s>>2]<<2)>>2]+ +g[l+4>>2]*+g[x+((c[s>>2]|0)-1<<2)>>2];c[s>>2]=(c[s>>2]|0)+1}g[(c[q>>2]|0)+2128>>2]=+g[x+((c[(c[h>>2]|0)+4612>>2]|0)-1<<2)>>2];mh(c[q>>2]|0,c[w>>2]|0,c[w>>2]|0,m,+g[r>>2],+g[p>>2],+g[o>>2],c[u>>2]|0,c[(c[h>>2]|0)+4612>>2]|0);c[v>>2]=(c[v>>2]|0)+(c[(c[h>>2]|0)+4612>>2]<<2);c[w>>2]=(c[w>>2]|0)+(c[(c[h>>2]|0)+4612>>2]<<2);c[t>>2]=(c[t>>2]|0)+1}c[(c[q>>2]|0)+2136>>2]=c[(c[j>>2]|0)+228+((c[b+4604>>2]|0)-1<<2)>>2];i=y;return}function lh(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+48|0;k=w+44|0;l=w+40|0;m=w+36|0;n=w+32|0;o=w+28|0;p=w+24|0;q=w+20|0;t=w+16|0;s=w+12|0;r=w+8|0;u=w+4|0;v=w;c[k>>2]=a;c[l>>2]=b;c[m>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A>>2];c[x>>2]=(c[x>>2]|0)+1}g[(c[m>>2]|0)+2120>>2]=+g[C>>2];g[(c[m>>2]|0)+2124>>2]=+g[D>>2];c[(c[m>>2]|0)+2116>>2]=c[w>>2];i=E;return}function nh(d,e,f){d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0;s=i;i=i+64|0;p=s+48|0;q=s+44|0;h=s+40|0;n=s+36|0;l=s+32|0;m=s+16|0;o=s+12|0;j=s+8|0;k=s+4|0;r=s;c[p>>2]=d;c[q>>2]=e;c[h>>2]=f;c[n>>2]=(c[p>>2]|0)+7200;a:do if((a[(c[p>>2]|0)+4768+29>>0]|0)==2){g[o>>2]=1.0-+oh((+g[(c[q>>2]|0)+872>>2]-12.0)*.25)*.5;c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break a;e=(c[q>>2]|0)+(c[l>>2]<<2)|0;g[e>>2]=+g[e>>2]*+g[o>>2];c[l>>2]=(c[l>>2]|0)+1}}while(0);t=+P(2.0,+((21.0-+(c[(c[p>>2]|0)+4748>>2]|0)*.0078125)*.33000001311302185));g[j>>2]=t/+(c[(c[p>>2]|0)+4612>>2]|0);c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break;g[k>>2]=+g[(c[q>>2]|0)+(c[l>>2]<<2)>>2];g[k>>2]=+O(+(+g[k>>2]*+g[k>>2]+ +g[(c[q>>2]|0)+876+(c[l>>2]<<2)>>2]*+g[j>>2]));g[(c[q>>2]|0)+(c[l>>2]<<2)>>2]=+g[k>>2]<32767.0?+g[k>>2]:32767.0;c[l>>2]=(c[l>>2]|0)+1}c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break;c[m+(c[l>>2]<<2)>>2]=~~(+g[(c[q>>2]|0)+(c[l>>2]<<2)>>2]*65536.0);c[l>>2]=(c[l>>2]|0)+1}pj((c[q>>2]|0)+892|0,m|0,c[(c[p>>2]|0)+4604>>2]<<2|0)|0;a[(c[q>>2]|0)+908>>0]=a[c[n>>2]>>0]|0;_d((c[p>>2]|0)+4768|0,m,c[n>>2]|0,(c[h>>2]|0)==2&1,c[(c[p>>2]|0)+4604>>2]|0);c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[p>>2]|0)+4604>>2]|0))break;g[(c[q>>2]|0)+(c[l>>2]<<2)>>2]=+(c[m+(c[l>>2]<<2)>>2]|0)/65536.0;c[l>>2]=(c[l>>2]|0)+1}do if((a[(c[p>>2]|0)+4768+29>>0]|0)==2){h=(c[p>>2]|0)+4768+30|0;if(+g[(c[q>>2]|0)+872>>2]+ +(c[(c[p>>2]|0)+4744>>2]|0)*.000030517578125>1.0){a[h>>0]=0;break}else{a[h>>0]=1;break}}while(0);g[r>>2]=+(b[24558+(a[(c[p>>2]|0)+4768+29>>0]>>1<<2)+(a[(c[p>>2]|0)+4768+30>>0]<<1)>>1]|0)/1024.0;g[(c[q>>2]|0)+852>>2]=+(c[(c[p>>2]|0)+4652>>2]|0)*-.05000000074505806+1.2000000476837158+ +(c[(c[p>>2]|0)+4556>>2]|0)*-.20000000298023224*.00390625+ +g[(c[q>>2]|0)+856>>2]*-.10000000149011612+ +g[(c[q>>2]|0)+860>>2]*-.20000000298023224+ +g[r>>2]*.800000011920929;i=s;return}function oh(a){a=+a;var b=0,c=0;b=i;i=i+16|0;c=b;g[c>>2]=a;a=1.0/(+X(+-+g[c>>2])+1.0);i=b;return +a}function ph(a,b,d,e){a=a|0;b=b|0;d=+d;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;f=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[f>>2]=a;c[h>>2]=b;g[j>>2]=d;c[k>>2]=e;c[l>>2]=0;while(1){d=+g[j>>2];if((c[l>>2]|0)>=(c[k>>2]|0))break;b=_(c[l>>2]|0,c[k>>2]|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1,c[p>>2]|0);v=+g[(c[n>>2]|0)+8>>2]*+g[(c[n>>2]|0)+8>>2];v=v*+Gh((c[r>>2]|0)+(0<<2)|0,c[o>>2]|0);g[(c[k>>2]|0)+8>>2]=v;v=+g[(c[n>>2]|0)+12>>2]*+g[(c[n>>2]|0)+12>>2];v=v*+Gh((c[r>>2]|0)+(c[s>>2]<<2)|0,c[o>>2]|0);g[(c[k>>2]|0)+12>>2]=v;i=t;return}function sh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;n=i;i=i+1184|0;p=n+1168|0;f=n+1164|0;o=n+1160|0;h=n+1156|0;m=n+1152|0;k=n+128|0;l=n+64|0;j=n;c[p>>2]=a;c[f>>2]=b;c[o>>2]=d;c[h>>2]=e;th(c[p>>2]|0,c[f>>2]|0,k,j);uh(k,c[f>>2]|0,c[o>>2]|0,l);c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[f>>2]|0))break;g[l+(c[m>>2]<<2)>>2]=+g[l+(c[m>>2]<<2)>>2]*+g[j+(c[m>>2]<<2)>>2];c[m>>2]=(c[m>>2]|0)+1}vh(k,c[f>>2]|0,l,c[h>>2]|0);i=n;return}function th(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=i;i=i+192|0;f=y+184|0;j=y+180|0;k=y+176|0;l=y+172|0;p=y+168|0;q=y+164|0;r=y+160|0;s=y+156|0;o=y+152|0;t=y+148|0;u=y+144|0;v=y+8|0;n=y;w=y+80|0;m=y+16|0;c[f>>2]=a;c[j>>2]=b;c[k>>2]=d;c[l>>2]=e;c[o>>2]=1;b=(_(c[j>>2]|0,c[j>>2]|0)|0)-1|0;h[n>>3]=(+g[c[f>>2]>>2]+ +g[(c[f>>2]|0)+(b<<2)>>2])*4.999999873689376e-06;c[s>>2]=0;while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2]*(+h[r+((c[p>>2]|0)+2<<3)>>3]-+h[t>>3]);h[r+((c[p>>2]|0)+1<<3)>>3]=+h[t>>3];f=o+((c[p>>2]|0)+1<<3)|0;h[f>>3]=+h[f>>3]+ +h[r>>3]*+h[t>>3];c[p>>2]=(c[p>>2]|0)+2}h[r+(c[n>>2]<<3)>>3]=+h[s>>3];f=o+(c[n>>2]<<3)|0;h[f>>3]=+h[f>>3]+ +h[r>>3]*+h[s>>3];c[q>>2]=(c[q>>2]|0)+1}c[p>>2]=0;while(1){if((c[p>>2]|0)>=((c[n>>2]|0)+1|0))break;g[(c[j>>2]|0)+(c[p>>2]<<2)>>2]=+h[o+(c[p>>2]<<3)>>3];c[p>>2]=(c[p>>2]|0)+1}i=u;return}function xh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0;l=i;i=i+80|0;e=l+76|0;f=l+72|0;h=l+68|0;k=l+64|0;j=l;c[e>>2]=a;c[f>>2]=b;c[h>>2]=d;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[h>>2]|0))break;b=yh(+g[(c[f>>2]|0)+(c[k>>2]<<2)>>2]*65536.0)|0;c[j+(c[k>>2]<<2)>>2]=b;c[k>>2]=(c[k>>2]|0)+1}Hf(c[e>>2]|0,j,c[h>>2]|0);i=l;return}function yh(a){a=+a;var b=0,c=0;c=i;i=i+16|0;b=c;g[b>>2]=a;b=ij(+g[b>>2])|0;i=c;return b|0}function zh(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+48|0;f=l+12|0;m=l+8|0;h=l+4|0;k=l;j=l+16|0;c[f>>2]=a;c[m>>2]=d;c[h>>2]=e;ag(j,c[m>>2]|0,c[h>>2]|0);c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[h>>2]|0))break;g[(c[f>>2]|0)+(c[k>>2]<<2)>>2]=+(b[j+(c[k>>2]<<1)>>1]|0)*.000244140625;c[k>>2]=(c[k>>2]|0)+1}i=l;return}function Ah(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;n=i;i=i+96|0;h=n+20|0;j=n+16|0;p=n+12|0;o=n+8|0;l=n+4|0;m=n;k=n+24|0;c[h>>2]=a;c[j>>2]=d;c[p>>2]=e;c[o>>2]=f;pf(c[h>>2]|0,k,c[p>>2]|0,c[o>>2]|0);c[m>>2]=0;while(1){if((c[m>>2]|0)>=2)break;c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[h>>2]|0)+4664>>2]|0))break;g[(c[j>>2]|0)+(c[m>>2]<<6)+(c[l>>2]<<2)>>2]=+(b[k+(c[m>>2]<<5)+(c[l>>2]<<1)>>1]|0)*.000244140625;c[l>>2]=(c[l>>2]|0)+1}c[m>>2]=(c[m>>2]|0)+1}i=n;return}function Bh(d,e,f,h,j,k){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=i;i=i+1632|0;l=D+1388|0;m=D+1384|0;n=D+1380|0;o=D+1376|0;p=D+1372|0;q=D+1368|0;A=D+1364|0;B=D+1360|0;C=D+80|0;s=D+64|0;y=D+1560|0;v=D+1520|0;w=D+56|0;r=D+1392|0;u=D+40|0;x=D+32|0;z=D+16|0;t=D;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=h;c[p>>2]=j;c[q>>2]=k;c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[(c[l>>2]|0)+4604>>2]|0))break;c[B>>2]=0;while(1){d=c[A>>2]|0;if((c[B>>2]|0)>=(c[(c[l>>2]|0)+4660>>2]|0))break;k=(yh(+g[(c[m>>2]|0)+500+((d<<4)+(c[B>>2]|0)<<2)>>2]*8192.0)|0)&65535;b[r+((c[A>>2]<<4)+(c[B>>2]|0)<<1)>>1]=k;c[B>>2]=(c[B>>2]|0)+1}c[A>>2]=d+1}c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[(c[l>>2]|0)+4604>>2]|0))break;k=(yh(+g[(c[m>>2]|0)+772+(c[A>>2]<<2)>>2]*16384.0)|0)<<16;k=k|(yh(+g[(c[m>>2]|0)+756+(c[A>>2]<<2)>>2]*16384.0)|0)&65535;c[u+(c[A>>2]<<2)>>2]=k;k=yh(+g[(c[m>>2]|0)+820+(c[A>>2]<<2)>>2]*16384.0)|0;c[z+(c[A>>2]<<2)>>2]=k;k=yh(+g[(c[m>>2]|0)+836+(c[A>>2]<<2)>>2]*16384.0)|0;c[t+(c[A>>2]<<2)>>2]=k;c[A>>2]=(c[A>>2]|0)+1}c[x>>2]=yh(+g[(c[m>>2]|0)+852>>2]*1024.0)|0;c[A>>2]=0;while(1){if((c[A>>2]|0)>=((c[(c[l>>2]|0)+4604>>2]|0)*5|0))break;k=(yh(+g[(c[m>>2]|0)+144+(c[A>>2]<<2)>>2]*16384.0)|0)&65535;b[v+(c[A>>2]<<1)>>1]=k;c[A>>2]=(c[A>>2]|0)+1}c[B>>2]=0;while(1){k=(c[B>>2]|0)<2;c[A>>2]=0;if(!k)break;while(1){if((c[A>>2]|0)>=(c[(c[l>>2]|0)+4664>>2]|0))break;k=(yh(+g[(c[m>>2]|0)+16+(c[B>>2]<<6)+(c[A>>2]<<2)>>2]*4096.0)|0)&65535;b[y+(c[B>>2]<<5)+(c[A>>2]<<1)>>1]=k;c[A>>2]=(c[A>>2]|0)+1}c[B>>2]=(c[B>>2]|0)+1}while(1){if((c[A>>2]|0)>=(c[(c[l>>2]|0)+4604>>2]|0))break;B=yh(+g[(c[m>>2]|0)+(c[A>>2]<<2)>>2]*65536.0)|0;c[s+(c[A>>2]<<2)>>2]=B;c[A>>2]=(c[A>>2]|0)+1}if((a[(c[n>>2]|0)+29>>0]|0)==2)c[w>>2]=b[24566+(a[(c[n>>2]|0)+33>>0]<<1)>>1];else c[w>>2]=0;c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[(c[l>>2]|0)+4608>>2]|0))break;B=yh(+g[(c[q>>2]|0)+(c[A>>2]<<2)>>2]*8.0)|0;c[C+(c[A>>2]<<2)>>2]=B;c[A>>2]=(c[A>>2]|0)+1}if((c[(c[l>>2]|0)+4652>>2]|0)<=1?(c[(c[l>>2]|0)+4704>>2]|0)<=0:0){me(c[l>>2]|0,c[o>>2]|0,c[n>>2]|0,C,c[p>>2]|0,y,v,r,t,z,u,s,(c[m>>2]|0)+228|0,c[x>>2]|0,c[w>>2]|0);i=D;return}se(c[l>>2]|0,c[o>>2]|0,c[n>>2]|0,C,c[p>>2]|0,y,v,r,t,z,u,s,(c[m>>2]|0)+228|0,c[x>>2]|0,c[w>>2]|0);i=D;return}function Ch(a,d,e,f,h,j,k,l,m){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=i;i=i+480|0;n=z+436|0;o=z+432|0;p=z+428|0;q=z+424|0;r=z+420|0;s=z+416|0;t=z+412|0;u=z+408|0;v=z+404|0;y=z+400|0;w=z+440|0;x=z;c[n>>2]=a;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=h;c[s>>2]=j;c[t>>2]=k;c[u>>2]=l;c[v>>2]=m;c[y>>2]=0;while(1){if((c[y>>2]|0)>=((c[u>>2]|0)*5|0))break;f=(yh(+g[(c[n>>2]|0)+(c[y>>2]<<2)>>2]*16384.0)|0)&65535;b[w+(c[y>>2]<<1)>>1]=f;c[y>>2]=(c[y>>2]|0)+1}c[y>>2]=0;while(1){if((c[y>>2]|0)>=(((c[u>>2]|0)*5|0)*5|0))break;f=yh(+g[(c[r>>2]|0)+(c[y>>2]<<2)>>2]*262144.0)|0;c[x+(c[y>>2]<<2)>>2]=f;c[y>>2]=(c[y>>2]|0)+1}df(w,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,x,c[s>>2]|0,c[t>>2]|0,c[u>>2]|0,c[v>>2]|0);c[y>>2]=0;while(1){if((c[y>>2]|0)>=((c[u>>2]|0)*5|0))break;g[(c[n>>2]|0)+(c[y>>2]<<2)>>2]=+(b[w+(c[y>>2]<<1)>>1]|0)*.00006103515625;c[y>>2]=(c[y>>2]|0)+1}i=z;return}function Dh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0.0;m=i;i=i+32|0;f=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[f>>2]=a;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;if((c[k>>2]|0)>(c[j>>2]|0))c[k>>2]=c[j>>2];c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[k>>2]|0))break;n=+Hh(c[h>>2]|0,(c[h>>2]|0)+(c[l>>2]<<2)|0,(c[j>>2]|0)-(c[l>>2]|0)|0);g[(c[f>>2]|0)+(c[l>>2]<<2)>>2]=n;c[l>>2]=(c[l>>2]|0)+1}i=m;return}function Eh(a,b,d,e,f,j){a=a|0;b=b|0;d=+d;e=e|0;f=f|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;K=i;i=i+784|0;k=K+768|0;l=K+764|0;m=K+760|0;n=K+756|0;o=K+752|0;p=K+748|0;y=K+744|0;z=K+740|0;F=K+736|0;E=K+732|0;s=K+720|0;x=K+712|0;C=K+704|0;B=K+696|0;A=K+688|0;D=K+680|0;r=K+672|0;G=K+664|0;H=K+656|0;I=K+728|0;v=K+528|0;w=K+400|0;u=K+264|0;t=K+128|0;q=K;c[k>>2]=a;c[l>>2]=b;g[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=j;h[s>>3]=+Gh(c[l>>2]|0,_(c[o>>2]|0,c[n>>2]|0)|0);a=v;f=a+128|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(f|0));c[F>>2]=0;while(1){if((c[F>>2]|0)>=(c[o>>2]|0))break;c[I>>2]=(c[l>>2]|0)+((_(c[F>>2]|0,c[n>>2]|0)|0)<<2);c[z>>2]=1;while(1){if((c[z>>2]|0)>=((c[p>>2]|0)+1|0))break;d=+Hh(c[I>>2]|0,(c[I>>2]|0)+(c[z>>2]<<2)|0,(c[n>>2]|0)-(c[z>>2]|0)|0);b=v+((c[z>>2]|0)-1<<3)|0;h[b>>3]=+h[b>>3]+d;c[z>>2]=(c[z>>2]|0)+1}c[F>>2]=(c[F>>2]|0)+1}a=w;j=v;f=a+128|0;do{c[a>>2]=c[j>>2];a=a+4|0;j=j+4|0}while((a|0)<(f|0));d=+h[s>>3]+ +h[s>>3]*9.999999747378752e-06+9.999999717180685e-10;h[u>>3]=d;h[t>>3]=d;h[x>>3]=1.0;c[E>>2]=0;c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[p>>2]|0))break;c[F>>2]=0;while(1){if((c[F>>2]|0)>=(c[o>>2]|0))break;c[I>>2]=(c[l>>2]|0)+((_(c[F>>2]|0,c[n>>2]|0)|0)<<2);h[G>>3]=+g[(c[I>>2]|0)+(c[z>>2]<<2)>>2];h[H>>3]=+g[(c[I>>2]|0)+((c[n>>2]|0)-(c[z>>2]|0)-1<<2)>>2];c[y>>2]=0;while(1){if((c[y>>2]|0)>=(c[z>>2]|0))break;b=v+(c[y>>2]<<3)|0;h[b>>3]=+h[b>>3]-+g[(c[I>>2]|0)+(c[z>>2]<<2)>>2]*+g[(c[I>>2]|0)+((c[z>>2]|0)-(c[y>>2]|0)-1<<2)>>2];b=w+(c[y>>2]<<3)|0;h[b>>3]=+h[b>>3]-+g[(c[I>>2]|0)+((c[n>>2]|0)-(c[z>>2]|0)-1<<2)>>2]*+g[(c[I>>2]|0)+((c[n>>2]|0)-(c[z>>2]|0)+(c[y>>2]|0)<<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3]=0.0;c[y>>2]=(c[y>>2]|0)+1}}while(0);if(!(c[E>>2]|0)){h[B>>3]=+h[u>>3];h[G>>3]=1.0;c[y>>2]=0;while(1){if((c[y>>2]|0)>=(c[p>>2]|0))break;h[r>>3]=+h[q+(c[y>>2]<<3)>>3];h[B>>3]=+h[B>>3]+ +h[u+((c[y>>2]|0)+1<<3)>>3]*+h[r>>3];h[G>>3]=+h[G>>3]+ +h[r>>3]*+h[r>>3];g[(c[k>>2]|0)+(c[y>>2]<<2)>>2]=-+h[r>>3];c[y>>2]=(c[y>>2]|0)+1}h[B>>3]=+h[B>>3]-+h[s>>3]*9.999999747378752e-06*+h[G>>3];d=+h[B>>3];i=K;return +d}c[y>>2]=0;while(1){if((c[y>>2]|0)>=(c[p>>2]|0))break;g[(c[k>>2]|0)+(c[y>>2]<<2)>>2]=-+h[q+(c[y>>2]<<3)>>3];c[y>>2]=(c[y>>2]|0)+1}c[F>>2]=0;while(1){if((c[F>>2]|0)>=(c[o>>2]|0))break;J=(c[l>>2]|0)+((_(c[F>>2]|0,c[n>>2]|0)|0)<<2)|0;d=+Gh(J,c[p>>2]|0);h[s>>3]=+h[s>>3]-d;c[F>>2]=(c[F>>2]|0)+1}h[B>>3]=+h[s>>3]*+h[x>>3];d=+h[B>>3];i=K;return +d}function Fh(a,b,d){a=a|0;b=b|0;d=+d;var e=0,f=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;e=l+16|0;f=l+12|0;h=l+8|0;k=l+4|0;j=l;c[e>>2]=a;c[f>>2]=b;g[h>>2]=d;g[j>>2]=+g[h>>2];c[k>>2]=0;while(1){d=+g[j>>2];if((c[k>>2]|0)>=((c[f>>2]|0)-1|0))break;b=(c[e>>2]|0)+(c[k>>2]<<2)|0;g[b>>2]=+g[b>>2]*d;g[j>>2]=+g[j>>2]*+g[h>>2];c[k>>2]=(c[k>>2]|0)+1}k=(c[e>>2]|0)+((c[f>>2]|0)-1<<2)|0;g[k>>2]=+g[k>>2]*d;i=l;return}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0)+1}if(c[n>>2]&1|0){d=(c[e>>2]|0)+(c[o>>2]<<2)|0;g[d>>2]=+g[d>>2]-+g[m>>2]*+g[(c[e>>2]|0)+(c[o>>2]<<2)>>2]}g[(c[e>>2]|0)+(c[n>>2]<<2)>>2]=+g[m>>2];c[n>>2]=(c[n>>2]|0)+1}i=s;return +(+g[q>>2])}function Kh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0;r=i;i=i+192|0;d=r+184|0;t=r+180|0;s=r+176|0;l=r+172|0;m=r+168|0;k=r+24|0;n=r+16|0;o=r+8|0;p=r;j=r+40|0;f=r+36|0;e=r+32|0;c[t>>2]=a;c[s>>2]=b;c[e>>2]=j+((c[s>>2]&1)<<6);pj(c[e>>2]|0,c[t>>2]|0,c[s>>2]<<2|0)|0;h[k>>3]=1.0;c[l>>2]=(c[s>>2]|0)-1;while(1){if((c[l>>2]|0)<=0)break;h[n>>3]=-+g[(c[e>>2]|0)+(c[l>>2]<<2)>>2];if(+h[n>>3]>.9998999834060669|+h[n>>3]<-.9998999834060669){q=4;break}h[o>>3]=1.0-+h[n>>3]*+h[n>>3];h[p>>3]=1.0/+h[o>>3];h[k>>3]=+h[k>>3]*+h[o>>3];c[f>>2]=c[e>>2];c[e>>2]=j+((c[l>>2]&1)<<6);c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[l>>2]|0))break;g[(c[e>>2]|0)+(c[m>>2]<<2)>>2]=(+g[(c[f>>2]|0)+(c[m>>2]<<2)>>2]-+g[(c[f>>2]|0)+((c[l>>2]|0)-(c[m>>2]|0)-1<<2)>>2]*+h[n>>3])*+h[p>>3];c[m>>2]=(c[m>>2]|0)+1}c[l>>2]=(c[l>>2]|0)+-1}if((q|0)==4){g[d>>2]=0.0;u=+g[d>>2];i=r;return +u}h[n>>3]=-+g[c[e>>2]>>2];if(+h[n>>3]>.9998999834060669|+h[n>>3]<-.9998999834060669){g[d>>2]=0.0;u=+g[d>>2];i=r;return +u}else{h[o>>3]=1.0-+h[n>>3]*+h[n>>3];h[k>>3]=+h[k>>3]*+h[o>>3];g[d>>2]=+h[k>>3];u=+g[d>>2];i=r;return +u}return 0.0}function Lh(d,e,f,j,k,l,m,n,o,p,q,r){d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;m=+m;n=+n;o=o|0;p=p|0;q=q|0;r=r|0;var s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;La=i;i=i+13936|0;Ca=La+10416|0;da=La+10412|0;Ea=La+10408|0;Fa=La+10404|0;Ga=La+10400|0;H=La+10396|0;I=La+10392|0;s=La+10388|0;J=La+10384|0;ya=La+10380|0;ea=La+10376|0;Da=La+10372|0;fa=La+10368|0;U=La+10364|0;Ka=La+10360|0;la=La+10356|0;qa=La+10352|0;T=La+9072|0;y=La+8432|0;z=La+13288|0;x=La+12968|0;u=La+8408|0;ba=La+8404|0;ia=La+8400|0;K=La+6016|0;G=La+5756|0;M=La+5712|0;xa=La+5708|0;P=La+5704|0;ja=La+24|0;E=La+16|0;oa=La+8|0;pa=La;R=La+5608|0;Q=La+12664|0;X=La+5600|0;W=La+5596|0;t=La+5592|0;ga=La+5588|0;N=La+5584|0;O=La+5580|0;ha=La+5576|0;Ha=La+5572|0;L=La+5568|0;za=La+5564|0;wa=La+5560|0;ma=La+5556|0;Aa=La+5552|0;Ja=La+5548|0;V=La+5544|0;$=La+5540|0;S=La+5536|0;na=La+2816|0;ka=La+96|0;ra=La+88|0;A=La+84|0;C=La+80|0;B=La+76|0;va=La+72|0;aa=La+68|0;F=La+64|0;Ba=La+60|0;ta=La+56|0;Z=La+52|0;sa=La+48|0;Y=La+44|0;D=La+40|0;ua=La+36|0;Ia=La+32|0;w=La+11384|0;v=La+10424|0;c[da>>2]=d;c[Ea>>2]=e;c[Fa>>2]=f;c[Ga>>2]=j;c[H>>2]=k;c[I>>2]=l;g[s>>2]=m;g[J>>2]=n;c[ya>>2]=o;c[ea>>2]=p;c[Da>>2]=q;c[fa>>2]=r;c[A>>2]=_(20+((c[Da>>2]|0)*5|0)|0,c[ya>>2]|0)|0;c[B>>2]=20+((c[Da>>2]|0)*5|0)<<2;c[C>>2]=20+((c[Da>>2]|0)*5|0)<<3;c[va>>2]=(c[ya>>2]|0)*5;c[F>>2]=20;c[aa>>2]=40;c[Ba>>2]=c[ya>>2]<<1;c[Z>>2]=8;c[ta>>2]=16;c[sa>>2]=((c[ya>>2]|0)*18|0)-1;c[D>>2]=72;c[Y>>2]=143;do if((c[ya>>2]|0)!=16)if((c[ya>>2]|0)==12){Mh(v,c[da>>2]|0,c[A>>2]|0);c[u>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;c[u+12>>2]=0;c[u+16>>2]=0;c[u+20>>2]=0;kg(u,z,v,c[A>>2]|0);Nh(T,z,c[C>>2]|0);break}else{Mh(z,c[da>>2]|0,c[C>>2]|0);break}else{Mh(w,c[da>>2]|0,c[A>>2]|0);c[u>>2]=0;c[u+4>>2]=0;lg(u,z,w,c[A>>2]|0);Nh(T,z,c[C>>2]|0)}while(0);c[u>>2]=0;c[u+4>>2]=0;lg(u,x,z,c[C>>2]|0);Nh(y,x,c[B>>2]|0);c[U>>2]=(c[B>>2]|0)-1;while(1){if((c[U>>2]|0)<=0)break;l=y+(c[U>>2]<<2)|0;g[l>>2]=+g[l>>2]+ +g[y+((c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>>2]|0)>0){if((c[ya>>2]|0)!=12){if((c[ya>>2]|0)==16)c[I>>2]=c[I>>2]>>1}else c[I>>2]=(c[I>>2]<<1|0)/3|0;g[$>>2]=+Oh(+(c[I>>2]|0))}else g[$>>2]=0.0;do if((c[Da>>2]|0)==4){c[Ja>>2]=11;c[Ia>>2]=30286;if((c[ya>>2]|0)==8&(c[ea>>2]|0)>0){c[ua>>2]=11;break}else{c[ua>>2]=3;break}}else{c[Ja>>2]=3;c[Ia>>2]=30252;c[ua>>2]=3}while(0);c[Ka>>2]=0;while(1){if((c[Ka>>2]|0)>=(c[X>>2]|0))break;c[la>>2]=c[R+(c[Ka>>2]<<2)>>2];c[qa>>2]=0;while(1){if((c[qa>>2]|0)>=(c[ua>>2]|0))break;g[M+(c[qa>>2]<<2)>>2]=0.0;c[U>>2]=0;while(1){if((c[U>>2]|0)>=(c[Da>>2]|0))break;ba=_(c[U>>2]|0,c[Ja>>2]|0)|0;ca=M+(c[qa>>2]<<2)|0;g[ca>>2]=+g[ca>>2]+ +g[K+((c[U>>2]|0)*596|0)+((c[la>>2]|0)+(a[(c[Ia>>2]|0)+(ba+(c[qa>>2]|0))>>0]|0)<<2)>>2];c[U>>2]=(c[U>>2]|0)+1}c[qa>>2]=(c[qa>>2]|0)+1}g[ha>>2]=-1.0e3;c[L>>2]=0;c[U>>2]=0;while(1){if((c[U>>2]|0)>=(c[ua>>2]|0))break;if(+g[M+(c[U>>2]<<2)>>2]>+g[ha>>2]){g[ha>>2]=+g[M+(c[U>>2]<<2)>>2];c[L>>2]=c[U>>2]}c[U>>2]=(c[U>>2]|0)+1}g[V>>2]=+Oh(+(c[la>>2]|0));g[O>>2]=+g[ha>>2]-+(c[Da>>2]|0)*.20000000298023224*+g[V>>2];if((c[I>>2]|0)>0){g[S>>2]=+g[V>>2]-+g[$>>2];g[S>>2]=+g[S>>2]*+g[S>>2];g[O>>2]=+g[O>>2]-+(c[Da>>2]|0)*.20000000298023224*+g[c[H>>2]>>2]*+g[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ea>>2]|0)+(c[Ka>>2]<<2)>>2]=s;c[Ka>>2]=(c[Ka>>2]|0)+1}b[c[Fa>>2]>>1]=s-(c[ta>>2]|0);a[c[Ga>>2]>>0]=c[Ha>>2]}c[Ca>>2]=0;Ka=c[Ca>>2]|0;i=La;return Ka|0}function Mh(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;f=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[h>>2]=d;c[l>>2]=e;c[j>>2]=(c[l>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;if((ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0)<=32767)if((ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0)<-32768)d=-32768;else d=ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0;else d=32767;b[(c[f>>2]|0)+(c[j>>2]<<1)>>1]=d;c[j>>2]=(c[j>>2]|0)+-1}i=k;return}function Nh(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;f=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[h>>2]=d;c[l>>2]=e;c[j>>2]=(c[l>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=+(b[(c[h>>2]|0)+(c[j>>2]<<1)>>1]|0);c[j>>2]=(c[j>>2]|0)+-1}i=k;return}function Oh(a){a=+a;var b=0,c=0;b=i;i=i+16|0;c=b;h[c>>3]=a;a=+hj(+h[c>>3])*3.32192809488736;i=b;return +a}function Ph(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Qh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Rh(b,d,e,f,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;H=i;i=i+256|0;l=H+252|0;m=H+248|0;n=H+244|0;o=H+240|0;p=H+236|0;q=H+232|0;r=H+228|0;F=H+224|0;w=H+220|0;y=H+216|0;z=H+212|0;A=H+208|0;C=H+204|0;B=H+200|0;D=H+196|0;v=H+192|0;x=H+188|0;u=H+184|0;E=H+96|0;G=H+8|0;t=H+4|0;s=H;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;c[q>>2]=j;c[r>>2]=k;if((c[p>>2]|0)==4){c[t>>2]=30466+(c[q>>2]<<3);c[s>>2]=30330;c[D>>2]=a[30490+(c[q>>2]|0)>>0];c[u>>2]=34}else{c[t>>2]=30282;c[s>>2]=30258;c[D>>2]=12;c[u>>2]=12}c[F>>2]=(c[m>>2]|0)+(c[o>>2]<<2<<2);c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[p>>2]|0))break;c[A>>2]=0;c[C>>2]=a[(c[t>>2]|0)+((c[z>>2]<<1)+0)>>0];c[B>>2]=a[(c[t>>2]|0)+((c[z>>2]<<1)+1)>>0];Mc(c[F>>2]|0,(c[F>>2]|0)+(0-(c[n>>2]|0)<<2)+(0-(c[B>>2]|0)<<2)|0,G,c[o>>2]|0,(c[B>>2]|0)-(c[C>>2]|0)+1|0,c[r>>2]|0);c[y>>2]=c[C>>2];while(1){if((c[y>>2]|0)>(c[B>>2]|0))break;g[E+(c[A>>2]<<2)>>2]=+g[G+((c[B>>2]|0)-(c[y>>2]|0)<<2)>>2];c[A>>2]=(c[A>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+1}c[v>>2]=a[(c[t>>2]|0)+((c[z>>2]<<1)+0)>>0];c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[D>>2]|0))break;e=_(c[z>>2]|0,c[u>>2]|0)|0;c[x>>2]=(a[(c[s>>2]|0)+(e+(c[w>>2]|0))>>0]|0)-(c[v>>2]|0);c[y>>2]=0;while(1){if((c[y>>2]|0)>=5)break;g[(c[l>>2]|0)+((c[z>>2]|0)*680|0)+((c[w>>2]|0)*20|0)+(c[y>>2]<<2)>>2]=+g[E+((c[x>>2]|0)+(c[y>>2]|0)<<2)>>2];c[y>>2]=(c[y>>2]|0)+1}c[w>>2]=(c[w>>2]|0)+1}c[F>>2]=(c[F>>2]|0)+(c[o>>2]<<2);c[z>>2]=(c[z>>2]|0)+1}i=H;return}function Sh(b,d,e,f,j,k){b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;G=i;i=i+176|0;l=G+168|0;m=G+164|0;n=G+160|0;o=G+156|0;p=G+152|0;q=G+148|0;F=G+144|0;t=G+140|0;w=G;A=G+136|0;x=G+132|0;z=G+128|0;B=G+124|0;D=G+120|0;v=G+116|0;y=G+112|0;u=G+108|0;C=G+104|0;E=G+16|0;s=G+12|0;r=G+8|0;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=j;c[q>>2]=k;if((c[p>>2]|0)==4){c[s>>2]=30466+(c[q>>2]<<3);c[r>>2]=30330;c[D>>2]=a[30490+(c[q>>2]|0)>>0];c[u>>2]=34}else{c[s>>2]=30282;c[r>>2]=30258;c[D>>2]=12;c[u>>2]=12}c[F>>2]=(c[m>>2]|0)+(c[o>>2]<<2<<2);c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[p>>2]|0))break;c[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,k=0,l=0,m=0,n=0;n=i;i=i+32|0;f=n+20|0;h=n+16|0;j=n+12|0;k=n+8|0;m=n+4|0;l=n;c[f>>2]=a;c[h>>2]=b;g[j>>2]=d;c[k>>2]=e;c[l>>2]=c[k>>2]&65532;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[l>>2]|0))break;g[(c[f>>2]|0)+((c[m>>2]|0)+0<<2)>>2]=+g[j>>2]*+g[(c[h>>2]|0)+((c[m>>2]|0)+0<<2)>>2];g[(c[f>>2]|0)+((c[m>>2]|0)+1<<2)>>2]=+g[j>>2]*+g[(c[h>>2]|0)+((c[m>>2]|0)+1<<2)>>2];g[(c[f>>2]|0)+((c[m>>2]|0)+2<<2)>>2]=+g[j>>2]*+g[(c[h>>2]|0)+((c[m>>2]|0)+2<<2)>>2];g[(c[f>>2]|0)+((c[m>>2]|0)+3<<2)>>2]=+g[j>>2]*+g[(c[h>>2]|0)+((c[m>>2]|0)+3<<2)>>2];c[m>>2]=(c[m>>2]|0)+4}while(1){if((c[m>>2]|0)>=(c[k>>2]|0))break;g[(c[f>>2]|0)+(c[m>>2]<<2)>>2]=+g[j>>2]*+g[(c[h>>2]|0)+(c[m>>2]<<2)>>2];c[m>>2]=(c[m>>2]|0)+1}i=n;return} + function ra(a){a=a|0;var b=0;b=i;i=i+a|0;i=i+15&-16;return b|0}function sa(){return i|0}function ta(a){a=a|0;i=a}function ua(a,b){a=a|0;b=b|0;i=a;j=b}function va(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function wa(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function xa(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function ya(a){a=a|0;C=a}function za(){return C|0}function Aa(a,b,d,e,f){a=+a;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+32|0;h=o+20|0;j=o+16|0;k=o+12|0;l=o+8|0;m=o+4|0;n=o;g[h>>2]=a;c[j>>2]=b;c[k>>2]=d;c[l>>2]=e;c[m>>2]=f;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[l>>2]|0))break;if(+g[h>>2]<+g[(c[j>>2]|0)+(c[n>>2]<<2)>>2])break;c[n>>2]=(c[n>>2]|0)+1}if((c[n>>2]|0)>(c[m>>2]|0)?+g[h>>2]<+g[(c[j>>2]|0)+(c[m>>2]<<2)>>2]+ +g[(c[k>>2]|0)+(c[m>>2]<<2)>>2]:0)c[n>>2]=c[m>>2];if((c[n>>2]|0)>=(c[m>>2]|0)){b=c[n>>2]|0;i=o;return b|0}if(!(+g[h>>2]>+g[(c[j>>2]|0)+((c[m>>2]|0)-1<<2)>>2]-+g[(c[k>>2]|0)+((c[m>>2]|0)-1<<2)>>2])){b=c[n>>2]|0;i=o;return b|0}c[n>>2]=c[m>>2];b=c[n>>2]|0;i=o;return b|0}function Ba(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(_(1664525,c[d>>2]|0)|0)+1013904223|0;i=b;return a|0}function Ca(a,d,e,f,h,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0;v=i;i=i+48|0;k=v+40|0;l=v+36|0;m=v+32|0;n=v+28|0;o=v+24|0;p=v+20|0;t=v+16|0;r=v+12|0;q=v+8|0;s=v+4|0;u=v;c[k>>2]=a;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=h;c[p>>2]=j;c[s>>2]=c[(c[k>>2]|0)+32>>2];c[q>>2]=c[(c[k>>2]|0)+44>>2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=(c[L>>2]|0)+1}c[A>>2]=(c[A>>2]|0)+1}k=(c[y>>2]|0)+1|0;c[y>>2]=k}while((k|0)<(c[v>>2]|0));do if(c[t>>2]|0){if(c[K>>2]|0)c[K>>2]=Ha(c[K>>2]|0,_(c[v>>2]|0,4-(c[(c[o>>2]|0)+8>>2]|0)+(c[u>>2]|0)|0)|0)|0;c[c[r>>2]>>2]=(c[c[r>>2]>>2]|0)+(c[K>>2]|0)>>1;c[K>>2]=c[c[r>>2]>>2];if((c[c[s>>2]>>2]|0)!=2){if(!(c[c[s>>2]>>2]|0))c[K>>2]=(c[K>>2]|0)-4}else c[K>>2]=(c[K>>2]|0)+4;if((c[K>>2]|0)>22){c[c[s>>2]>>2]=2;break}o=c[s>>2]|0;if((c[K>>2]|0)>18){c[o>>2]=1;break}else{c[o>>2]=0;break}}while(0);c[M>>2]=Ha(c[M>>2]|0,c[L>>2]|0)|0;c[M>>2]=(c[M>>2]|0)+(c[c[H>>2]>>2]|0)>>1;c[c[H>>2]>>2]=c[M>>2];c[M>>2]=((c[M>>2]|0)*3|0)+((3-(c[I>>2]|0)<<7)+64)+2>>2;do if((c[M>>2]|0)>=80){if((c[M>>2]|0)<256){c[J>>2]=2;break}if((c[M>>2]|0)<384){c[J>>2]=1;break}else{c[J>>2]=0;break}}else c[J>>2]=3;while(0);c[G>>2]=c[J>>2];M=c[G>>2]|0;i=N;return M|0}function Ja(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;e=n+24|0;f=n+20|0;h=n+16|0;j=n+12|0;k=n+8|0;l=n+4|0;m=n;c[e>>2]=a;c[f>>2]=b;c[h>>2]=d;c[f>>2]=c[f>>2]>>1;c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[h>>2]|0))break;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[f>>2]|0))break;d=_(c[h>>2]<<1,c[k>>2]|0)|0;g[l>>2]=+g[(c[e>>2]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8}if(c[q>>2]|0)g[c[t>>2]>>2]=c[r>>2]|0?-1.0:1.0;c[t>>2]=c[k>>2];f=(c[n>>2]|0)+1|0;c[n>>2]=f}while((f|0)<(1+(c[s>>2]|0)|0));if(!(c[m>>2]|0)){i=u;return 1}g[c[m>>2]>>2]=+g[c[j>>2]>>2];i=u;return 1}function Pa(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=i;i=i+48|0;f=p+32|0;h=p+28|0;j=p+24|0;q=p+20|0;m=p+16|0;n=p+12|0;l=p+8|0;k=p+4|0;o=p;c[f>>2]=a;c[h>>2]=b;c[j>>2]=d;c[q>>2]=e;c[l>>2]=_(c[h>>2]|0,c[j>>2]|0)|0;d=c[l>>2]|0;c[k>>2]=ia()|0;b=i;i=i+((1*(d<<2)|0)+15&-16)|0;if(c[q>>2]|0){c[o>>2]=8+(c[j>>2]<<2)+-8;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[h>>2]|0))break;d=_(c[n>>2]|0,c[j>>2]|0)|0;q=_(c[(c[o>>2]|0)+(c[m>>2]<<2)>>2]|0,c[h>>2]|0)|0;g[b+(q+(c[n>>2]|0)<<2)>>2]=+g[(c[f>>2]|0)+(d+(c[m>>2]|0)<<2)>>2];c[n>>2]=(c[n>>2]|0)+1}c[m>>2]=(c[m>>2]|0)+1}o=c[f>>2]|0;n=c[l>>2]|0;n=n<<2;q=0;q=n+q|0;pj(o|0,b|0,q|0)|0;q=c[k>>2]|0;na(q|0);i=p;return}else{c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[h>>2]|0))break;o=_(c[n>>2]|0,c[j>>2]|0)|0;q=_(c[m>>2]|0,c[h>>2]|0)|0;g[b+(q+(c[n>>2]|0)<<2)>>2]=+g[(c[f>>2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(c[r>>2]|0)+(c[x>>2]|0)|0,c[y>>2]|0);break}if((c[V>>2]|0)<=(c[J>>2]>>1|0))p=(c[V>>2]|0)+1|0;else p=(c[J>>2]|0)+1-(c[V>>2]|0)|0;c[x>>2]=p;if((c[V>>2]|0)<=(c[J>>2]>>1|0))p=(_(c[V>>2]|0,(c[V>>2]|0)+1|0)|0)>>1;else p=(c[y>>2]|0)-((_((c[J>>2]|0)+1-(c[V>>2]|0)|0,(c[J>>2]|0)+2-(c[V>>2]|0)|0)|0)>>1)|0;c[w>>2]=p;jc(c[Q>>2]|0,c[w>>2]|0,(c[w>>2]|0)+(c[x>>2]|0)|0,c[y>>2]|0)}while(0);c[V>>2]=Ha(c[V>>2]<<14,c[J>>2]|0)|0;if((c[R>>2]|0)!=0&(c[F>>2]|0)!=0)if(!(c[V>>2]|0)){Xa(c[I>>2]|0,c[D>>2]|0,c[E>>2]|0,c[G>>2]|0,c[H>>2]|0,c[M>>2]|0);break}else{Ya(c[D>>2]|0,c[E>>2]|0,c[M>>2]|0);break}}else if(c[F>>2]|0){if(c[R>>2]|0){c[T>>2]=(c[V>>2]|0)>8192&1;a:do if(c[T>>2]|0){c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[M>>2]|0))break a;g[(c[E>>2]|0)+(c[t>>2]<<2)>>2]=-+g[(c[E>>2]|0)+(c[t>>2]<<2)>>2];c[t>>2]=(c[t>>2]|0)+1}}while(0);Xa(c[I>>2]|0,c[D>>2]|0,c[E>>2]|0,c[G>>2]|0,c[H>>2]|0,c[M>>2]|0)}do if((c[c[N>>2]>>2]|0)>16?(c[(c[p>>2]|0)+28>>2]|0)>16:0){p=c[Q>>2]|0;if(c[R>>2]|0){pc(p,c[T>>2]|0,2);break}else{c[T>>2]=dc(p,2)|0;break}}else v=60;while(0);if((v|0)==60)c[T>>2]=0;c[V>>2]=0}while(0);ba=Xb(c[Q>>2]|0)|0;c[W>>2]=ba-(c[X>>2]|0);ba=c[N>>2]|0;c[ba>>2]=(c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>>2]>>3);c[n>>2]=(c[n>>2]|0)+1>>1<<1;q=c[n>>2]|0;i=o;return q|0}return 0}function Xa(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;r=i;i=i+64|0;v=r+56|0;j=r+52|0;k=r+48|0;x=r+44|0;y=r+40|0;l=r+36|0;w=r+32|0;o=r+28|0;m=r+24|0;n=r+20|0;u=r+16|0;t=r+12|0;s=r+8|0;q=r+4|0;p=r;c[v>>2]=a;c[j>>2]=b;c[k>>2]=d;c[x>>2]=e;c[y>>2]=f;c[l>>2]=h;c[w>>2]=c[y>>2];g[u>>2]=+g[(c[x>>2]|0)+(c[w>>2]<<2)>>2];g[t>>2]=+g[(c[x>>2]|0)+((c[w>>2]|0)+(c[(c[v>>2]|0)+8>>2]|0)<<2)>>2];g[s>>2]=+O(+(+g[u>>2]*+g[u>>2]+1.0000000036274937e-15+ +g[t>>2]*+g[t>>2]))+1.0000000036274937e-15;g[m>>2]=+g[u>>2]/+g[s>>2];g[n>>2]=+g[t>>2]/+g[s>>2];c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[l>>2]|0))break;g[p>>2]=+g[(c[j>>2]|0)+(c[o>>2]<<2)>>2];g[q>>2]=+g[(c[k>>2]|0)+(c[o>>2]<<2)>>2];g[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=+g[m>>2]*+g[p>>2]+ +g[n>>2]*+g[q>>2];c[o>>2]=(c[o>>2]|0)+1}i=r;return}function Ya(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;e=m+20|0;f=m+16|0;h=m+12|0;j=m+8|0;l=m+4|0;k=m;c[e>>2]=a;c[f>>2]=b;c[h>>2]=d;c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[h>>2]|0))break;g[k>>2]=+g[(c[e>>2]|0)+(c[j>>2]<<2)>>2]*.7071067690849304;g[l>>2]=+g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]*.7071067690849304;g[(c[e>>2]|0)+(c[j>>2]<<2)>>2]=+g[k>>2]+ +g[l>>2];g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=+g[l>>2]-+g[k>>2];c[j>>2]=(c[j>>2]|0)+1}i=m;return}function Za(a){a=a|0;var d=0,e=0,f=0,g=0;e=i;i=i+16|0;g=e+6|0;f=e;d=e+4|0;b[g>>1]=a;c[f>>2]=4096+(_(b[g>>1]|0,b[g>>1]|0)|0)>>13;b[d>>1]=c[f>>2];b[d>>1]=32767-(b[d>>1]|0)+(16384+(_(b[d>>1]|0,((16384+(_(b[d>>1]|0,(8277+(16384+(_(-626,b[d>>1]|0)|0)>>15)&65535)<<16>>16)|0)>>15)+-7651&65535)<<16>>16)|0)>>15);i=e;return 1+(b[d>>1]|0)&65535|0}function _a(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=i;i=i+16|0;f=d+12|0;e=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[e>>2]=b;c[g>>2]=32-(aa(c[e>>2]|0)|0);c[h>>2]=32-(aa(c[f>>2]|0)|0);c[e>>2]=c[e>>2]<<15-(c[g>>2]|0);c[f>>2]=c[f>>2]<<15-(c[h>>2]|0);a=((c[h>>2]|0)-(c[g>>2]|0)<<11)+(16384+(_((c[f>>2]&65535)<<16>>16,((16384+(_((c[f>>2]&65535)<<16>>16,-2597)|0)>>15)+7932&65535)<<16>>16)|0)>>15)|0;a=a-(16384+(_((c[e>>2]&65535)<<16>>16,((16384+(_((c[e>>2]&65535)<<16>>16,-2597)|0)>>15)+7932&65535)<<16>>16)|0)>>15)|0;i=d;return a|0}function $a(a,b,d,e,f){a=a|0;b=b|0;d=+d;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;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>2]=a;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;g[r>>2]=0.0;g[s>>2]=0.0;c[q>>2]=0;while(1){j=+g[r>>2];if((c[q>>2]|0)>=(c[n>>2]|0))break;g[r>>2]=j+ +g[(c[k>>2]|0)+(c[q>>2]<<2)>>2]*+g[(c[l>>2]|0)+(c[q>>2]<<2)>>2];g[s>>2]=+g[s>>2]+ +g[(c[k>>2]|0)+(c[q>>2]<<2)>>2]*+g[(c[m>>2]|0)+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}g[c[o>>2]>>2]=j;g[c[p>>2]>>2]=+g[s>>2];i=t;return}function bb(a){a=a|0;var b=0,d=0,e=0,f=0;e=i;i=i+16|0;f=e+4|0;b=e;c[f>>2]=a;a=c[f>>2]|0;a:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{d=7;break a}}c[b>>2]=6;break}else{switch(a|0){case 12e3:break;default:{d=7;break a}}c[b>>2]=4;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{d=7;break a}}c[b>>2]=3;break}if((a|0)<48e3){switch(a|0){case 24e3:break;default:{d=7;break a}}c[b>>2]=2;break}else{switch(a|0){case 48e3:break;default:{d=7;break a}}c[b>>2]=1;break}}while(0);if((d|0)==7)c[b>>2]=0;i=e;return c[b>>2]|0}function cb(a,b,d,e,f,h,j,k,l,m,n,o){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=+h;j=+j;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;N=i;i=i+112|0;p=N+96|0;q=N+92|0;s=N+88|0;t=N+84|0;u=N+80|0;v=N+76|0;w=N+72|0;x=N+68|0;y=N+64|0;z=N+60|0;r=N+56|0;H=N+48|0;B=N+44|0;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)+(a+(c[n>>2]|0))>>0]|0)+64|0,c[l>>2]|0)|0;a=(_(a,c[m>>2]|0)|0)>>2;c[(c[j>>2]|0)+(c[n>>2]<<2)>>2]=a;c[n>>2]=(c[n>>2]|0)+1}i=o;return}function fb(a){a=a|0;var b=0,d=0,e=0;e=i;i=i+16|0;b=e+4|0;d=e;c[d>>2]=a;if((c[d>>2]|0)>0|(c[d>>2]|0)<-7){c[b>>2]=25264;a=c[b>>2]|0;i=e;return a|0}else{c[b>>2]=c[164+(0-(c[d>>2]|0)<<2)>>2];a=c[b>>2]|0;i=e;return a|0}return 0}function gb(){return 25415}function hb(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=Jc(48e3,960,0)|0;a=ib(c[e>>2]|0,c[d>>2]|0)|0;i=b;return a|0}function ib(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;e=i;i=i+16|0;f=e+8|0;g=e+4|0;d=e;c[f>>2]=a;c[g>>2]=b;a=204+((_(c[g>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0)-1<<2)|0;c[d>>2]=a+(c[g>>2]<<10<<2)+((_((c[g>>2]|0)*3|0,c[(c[f>>2]|0)+8>>2]|0)|0)<<2);i=e;return c[d>>2]|0}function jb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;f=k+20|0;g=k+16|0;h=k+12|0;m=k+8|0;l=k+4|0;j=k;c[g>>2]=a;c[h>>2]=b;c[m>>2]=d;c[l>>2]=e;b=c[g>>2]|0;a=Jc(48e3,960,0)|0;c[j>>2]=kb(b,a,c[m>>2]|0,c[l>>2]|0)|0;if(c[j>>2]|0){c[f>>2]=c[j>>2];m=c[f>>2]|0;i=k;return m|0}else{m=bb(c[h>>2]|0)|0;c[(c[g>>2]|0)+28>>2]=m;c[f>>2]=0;m=c[f>>2]|0;i=k;return m|0}return 0}function kb(a,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f=F+36|0;j=F+32|0;k=F+28|0;l=F+24|0;q=F+20|0;h=F+16|0;r=F+12|0;s=F+8|0;t=F+4|0;u=F;c[C>>2]=a;c[G>>2]=b;c[e>>2]=d;do switch(c[G>>2]|0){case 4010:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[m>>2]=G;if((c[m>>2]|0)<0|(c[m>>2]|0)>10)e=41;else{c[(c[C>>2]|0)+24>>2]=c[m>>2];e=40}break}case 10010:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[n>>2]=G;if((c[n>>2]|0)>=0?(c[n>>2]|0)<(c[(c[c[C>>2]>>2]|0)+8>>2]|0):0){c[(c[C>>2]|0)+32>>2]=c[n>>2];e=40}else e=41;break}case 10012:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[v>>2]=G;if((c[v>>2]|0)>=1?(c[v>>2]|0)<=(c[(c[c[C>>2]>>2]|0)+8>>2]|0):0){c[(c[C>>2]|0)+36>>2]=c[v>>2];e=40}else e=41;break}case 10002:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[w>>2]=G;if((c[w>>2]|0)<0|(c[w>>2]|0)>2)e=41;else{c[(c[C>>2]|0)+20>>2]=(c[w>>2]|0)<=1&1;c[(c[C>>2]|0)+12>>2]=(c[w>>2]|0)==0&1;e=40}break}case 4014:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[x>>2]=G;if((c[x>>2]|0)<0|(c[x>>2]|0)>100)e=41;else{c[(c[C>>2]|0)+56>>2]=c[x>>2];e=40}break}case 4020:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[y>>2]=G;c[(c[C>>2]|0)+52>>2]=c[y>>2];e=40;break}case 4006:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[z>>2]=G;c[(c[C>>2]|0)+44>>2]=c[z>>2];e=40;break}case 4002:{d=(c[e>>2]|0)+(4-1)&~(4-1);G=c[d>>2]|0;c[e>>2]=d+4;c[D>>2]=G;if((c[D>>2]|0)<=500&(c[D>>2]|0)!=-1)e=41;else{if((c[D>>2]|0)<((c[(c[C>>2]|0)+4>>2]|0)*26e4|0))e=c[D>>2]|0;else e=(c[(c[C>>2]|0)+4>>2]|0)*26e4|0;c[D>>2]=e;c[(c[C>>2]|0)+40>>2]=c[D>>2];e=40}break}case 10008:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[A>>2]=G;if((c[A>>2]|0)<1|(c[A>>2]|0)>2)e=41;else{c[(c[C>>2]|0)+8>>2]=c[A>>2];e=40}break}case 4036:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[B>>2]=G;if((c[B>>2]|0)<8|(c[B>>2]|0)>24)e=41;else{c[(c[C>>2]|0)+60>>2]=c[B>>2];e=40}break}case 4037:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[o>>2]=G;c[c[o>>2]>>2]=c[(c[C>>2]|0)+60>>2];e=40;break}case 4040:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[p>>2]=G;c[(c[C>>2]|0)+64>>2]=c[p>>2];e=40;break}case 4028:{c[j>>2]=(c[C>>2]|0)+200+((_(c[(c[C>>2]|0)+4>>2]|0,(c[(c[c[C>>2]>>2]|0)+4>>2]|0)+1024|0)|0)<<2);c[k>>2]=(c[j>>2]|0)+((_(c[(c[C>>2]|0)+4>>2]|0,c[(c[c[C>>2]>>2]|0)+8>>2]|0)|0)<<2);c[l>>2]=(c[k>>2]|0)+((_(c[(c[C>>2]|0)+4>>2]|0,c[(c[c[C>>2]>>2]|0)+8>>2]|0)|0)<<2);oj((c[C>>2]|0)+76|0,0,(ib(c[c[C>>2]>>2]|0,c[(c[C>>2]|0)+4>>2]|0)|0)-((c[C>>2]|0)+76-(c[C>>2]|0))|0)|0;c[f>>2]=0;while(1){if((c[f>>2]|0)>=(_(c[(c[C>>2]|0)+4>>2]|0,c[(c[c[C>>2]>>2]|0)+8>>2]|0)|0))break;g[(c[l>>2]|0)+(c[f>>2]<<2)>>2]=-28.0;g[(c[k>>2]|0)+(c[f>>2]<<2)>>2]=-28.0;c[f>>2]=(c[f>>2]|0)+1}c[(c[C>>2]|0)+172>>2]=0;g[(c[C>>2]|0)+84>>2]=1.0;c[(c[C>>2]|0)+80>>2]=2;c[(c[C>>2]|0)+88>>2]=256;c[(c[C>>2]|0)+96>>2]=0;c[(c[C>>2]|0)+100>>2]=0;e=40;break}case 10016:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[q>>2]=G;c[(c[C>>2]|0)+48>>2]=c[q>>2];e=40;break}case 10022:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[h>>2]=G;if(c[h>>2]|0){pj((c[C>>2]|0)+120|0,c[h>>2]|0,28|0)|0;e=40}else e=40;break}case 10015:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[r>>2]=G;if(!(c[r>>2]|0))e=41;else{c[c[r>>2]>>2]=c[c[C>>2]>>2];e=40}break}case 4031:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[s>>2]=G;if(!(c[s>>2]|0))e=41;else{c[c[s>>2]>>2]=c[(c[C>>2]|0)+76>>2];e=40}break}case 10024:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[t>>2]=G;c[(c[C>>2]|0)+68>>2]=c[t>>2];e=40;break}case 10026:{D=(c[e>>2]|0)+(4-1)&~(4-1);G=c[D>>2]|0;c[e>>2]=D+4;c[u>>2]=G;c[(c[C>>2]|0)+192>>2]=c[u>>2];e=40;break}default:{c[E>>2]=-5;G=c[E>>2]|0;i=F;return G|0}}while(0);if((e|0)==40){c[E>>2]=0;G=c[E>>2]|0;i=F;return G|0}else if((e|0)==41){c[E>>2]=-1;G=c[E>>2]|0;i=F;return G|0}return 0}function mb(a,b,d,e,f,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+64|0;m=z+52|0;q=z+48|0;r=z+44|0;n=z+40|0;s=z+36|0;A=z+32|0;t=z+28|0;o=z+24|0;w=z+20|0;v=z+16|0;x=z+12|0;u=z+8|0;p=z+4|0;y=z;c[m>>2]=a;c[q>>2]=b;c[r>>2]=d;c[n>>2]=e;c[s>>2]=f;c[A>>2]=h;c[t>>2]=j;c[o>>2]=k;g[v>>2]=+g[c[A>>2]>>2];g[x>>2]=+g[c[t>>2]>>2];if(!(((c[s>>2]|0)==1?+g[(c[A>>2]|0)+4>>2]==0.0:0)^1|(c[o>>2]|0)!=0)){c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[r>>2]|0))break;A=_(c[n>>2]|0,c[w>>2]|0)|0;g[p>>2]=+g[(c[m>>2]|0)+(A<<2)>>2]*32768.0;g[(c[q>>2]|0)+(c[w>>2]<<2)>>2]=+g[p>>2]-+g[x>>2];g[x>>2]=+g[v>>2]*+g[p>>2];c[w>>2]=(c[w>>2]|0)+1}g[c[t>>2]>>2]=+g[x>>2];i=z;return}c[u>>2]=(c[r>>2]|0)/(c[s>>2]|0)|0;if((c[s>>2]|0)!=1)oj(c[q>>2]|0,0,c[r>>2]<<2|0)|0;c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[u>>2]|0))break;p=_(c[n>>2]|0,c[w>>2]|0)|0;A=_(c[w>>2]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0,wa=0,xa=0,ya=0,za=0,Ba=0,Da=0,Fa=0,Ga=0,Ha=0,Ja=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,nb=0,vb=0,yb=0;yb=i;i=i+448|0;gb=yb+440|0;hb=yb+436|0;s=yb+432|0;k=yb+428|0;o=yb+424|0;ib=yb+420|0;jb=yb+416|0;$a=yb+412|0;Za=yb+408|0;Ma=yb+404|0;Ga=yb+400|0;p=yb+352|0;y=yb+348|0;bb=yb+344|0;cb=yb+340|0;db=yb+336|0;Wa=yb+332|0;nb=yb+328|0;Ya=yb+324|0;Ja=yb+320|0;La=yb+316|0;T=yb+312|0;S=yb+308|0;xa=yb+304|0;wa=yb+300|0;fb=yb+296|0;_a=yb+292|0;U=yb+288|0;Qa=yb+284|0;P=yb+280|0;Fa=yb+276|0;Ua=yb+272|0;Sa=yb+268|0;Ra=yb+264|0;V=yb+260|0;X=yb+256|0;za=yb+252|0;fa=yb+248|0;ra=yb+244|0;Pa=yb+240|0;ma=yb+236|0;Va=yb+232|0;R=yb+228|0;Oa=yb+224|0;Na=yb+220|0;Xa=yb+216|0;O=yb+212|0;pa=yb+208|0;ka=yb+204|0;qa=yb+200|0;u=yb+196|0;ha=yb+192|0;Ta=yb+188|0;ab=yb+184|0;x=yb+180|0;Z=yb+176|0;M=yb+172|0;Ha=yb+168|0;vb=yb+164|0;la=yb+160|0;oa=yb+156|0;ea=yb+152|0;Ba=yb+148|0;m=yb+144|0;n=yb+140|0;q=yb+136|0;r=yb+132|0;kb=yb+128|0;t=yb+124|0;v=yb+120|0;z=yb+116|0;w=yb+112|0;I=yb+108|0;E=yb+104|0;C=yb+100|0;H=yb+96|0;G=yb+92|0;A=yb+88|0;B=yb+84|0;D=yb+80|0;F=yb+76|0;J=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ta>>2]>>2]<<3|0)|0)-(((c[(c[hb>>2]|0)+48>>2]|0)!=0^1^1)&1)|0)){k=c[ib>>2]|0;break}else{k=(((c[n>>2]|0)+(c[c[Ta>>2]>>2]<<2)|0)/(c[c[Ta>>2]>>2]<<3|0)|0)-(((c[(c[hb>>2]|0)+48>>2]|0)!=0^1^1)&1)|0;break}else k=2;while(0);c[ib>>2]=k}c[V>>2]=c[ib>>2]}if((c[(c[hb>>2]|0)+40>>2]|0)!=-1)c[Ba>>2]=(c[(c[hb>>2]|0)+40>>2]|0)-(_(((c[Ja>>2]|0)*40|0)+20|0,(400>>c[La>>2])-50|0)|0);if(!(c[jb>>2]|0)){ic(p,c[o>>2]|0,c[ib>>2]|0);c[jb>>2]=p}if((c[za>>2]|0)>0?c[(c[hb>>2]|0)+52>>2]|0:0){c[q>>2]=c[za>>2];if((((c[ma>>2]|0)==1?2:0)|0)>((c[za>>2]|0)+(c[q>>2]|0)-(c[(c[hb>>2]|0)+164>>2]|0)>>6|0))k=(c[ma>>2]|0)==1?2:0;else k=(c[za>>2]|0)+(c[q>>2]|0)-(c[(c[hb>>2]|0)+164>>2]|0)>>6;do if((k|0)<(c[wa>>2]|0))if((((c[ma>>2]|0)==1?2:0)|0)>((c[za>>2]|0)+(c[q>>2]|0)-(c[(c[hb>>2]|0)+164>>2]|0)>>6|0)){k=(c[ma>>2]|0)==1?2:0;break}else{k=(c[za>>2]|0)+(c[q>>2]|0)-(c[(c[hb>>2]|0)+164>>2]|0)>>6;break}else k=c[wa>>2]|0;while(0);c[r>>2]=k;if((c[r>>2]|0)<(c[wa>>2]|0)){c[ib>>2]=(c[xa>>2]|0)+(c[r>>2]|0);c[wa>>2]=c[r>>2];vc(c[jb>>2]|0,c[ib>>2]|0)}}c[fa>>2]=c[ib>>2]<<3;c[U>>2]=c[_a>>2];if((c[U>>2]|0)>(c[(c[Ta>>2]|0)+12>>2]|0))c[U>>2]=c[(c[Ta>>2]|0)+12>>2];r=_(c[Ya>>2]|0,(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>>2]>65536.0:0)&1;r=e+((_(c[Za>>2]|0,(c[Ma>>2]|0)+(c[x>>2]|0)|0)|0)<<2)|0;mb((c[s>>2]|0)+(c[Za>>2]<<2)|0,r+(c[x>>2]<<2)|0,c[Ma>>2]|0,c[Ya>>2]|0,c[(c[hb>>2]|0)+28>>2]|0,(c[Ta>>2]|0)+16|0,(c[hb>>2]|0)+148+(c[Za>>2]<<2)|0,c[t>>2]|0);r=(c[Za>>2]|0)+1|0;c[Za>>2]=r}while((r|0)<(c[Ya>>2]|0));if((c[wa>>2]|0)>3?(c[(c[hb>>2]|0)+68>>2]|0)!=0:0)if((c[fb>>2]|0)!=0|(c[Xa>>2]|0)!=0)k=0;else Q=63;else if(((c[fb>>2]|0)==0?(c[wa>>2]|0)>((c[Ja>>2]|0)*12|0):0)^1|(c[Xa>>2]|0)!=0)k=0;else Q=63;if((Q|0)==63)if(!(c[(c[hb>>2]|0)+20>>2]|0)?(c[(c[hb>>2]|0)+24>>2]|0)>=5:0){if((c[La>>2]|0)!=3?(c[(c[hb>>2]|0)+116>>2]|0)!=0:0)k=(c[(c[hb>>2]|0)+64>>2]|0)==5010;else k=0;k=k^1}else k=0;c[v>>2]=k&1;c[Va>>2]=c[(c[hb>>2]|0)+100>>2];c[R>>2]=qb(c[hb>>2]|0,e,c[y>>2]|0,c[Ya>>2]|0,c[Ma>>2]|0,c[Va>>2]|0,Ua,Sa,z,c[v>>2]|0,c[wa>>2]|0)|0;if(!(!(+g[Sa>>2]>.4000000059604645)?!(+g[(c[hb>>2]|0)+108>>2]>.4000000059604645):0))Q=70;do if((Q|0)==70){if(c[(c[hb>>2]|0)+120>>2]|0?!(+g[(c[hb>>2]|0)+120+4>>2]>.3):0)break;if(!(+(c[Ua>>2]|0)>+(c[(c[hb>>2]|0)+104>>2]|0)*1.26)?!(+(c[Ua>>2]|0)<+(c[(c[hb>>2]|0)+104>>2]|0)*.79):0)break;c[ka>>2]=1}while(0);if(!(c[R>>2]|0)){if((c[fb>>2]|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id(c[Ta>>2]|0,c[U>>2]|0,c[_a>>2]|0,p,j,c[Ja>>2]|0);c[$a>>2]=0;while(1){if((c[$a>>2]|0)>=(_(c[Ja>>2]|0,c[ab>>2]|0)|0))break a;z=j+(c[$a>>2]<<2)|0;g[z>>2]=+g[z>>2]+ +(c[La>>2]|0)*.5;c[$a>>2]=(c[$a>>2]|0)+1}}while(0);sb(c[Ta>>2]|0,c[Wa>>2]|0,e,f,c[Ja>>2]|0,c[Ya>>2]|0,c[La>>2]|0,c[(c[hb>>2]|0)+28>>2]|0,c[(c[hb>>2]|0)+72>>2]|0);if((c[Ya>>2]|0)==2&(c[Ja>>2]|0)==1)c[O>>2]=0;Ca(c[Ta>>2]|0,f,p,c[U>>2]|0,c[Ja>>2]|0,c[La>>2]|0);b:do if(c[(c[hb>>2]|0)+68>>2]|0){c[$a>>2]=2;while(1){if((c[$a>>2]|0)>=(c[_a>>2]|0))break b;if(+g[p+(c[$a>>2]<<2)>>2]<+g[p>>2]*9.999999747378752e-05)l=+g[p+(c[$a>>2]<<2)>>2];else l=+g[p>>2]*9.999999747378752e-05;g[p+(c[$a>>2]<<2)>>2]=l;if(+g[p+(c[$a>>2]<<2)>>2]>1.0000000036274937e-15)l=+g[p+(c[$a>>2]<<2)>>2];else l=1.0000000036274937e-15;g[p+(c[$a>>2]<<2)>>2]=l;c[$a>>2]=(c[$a>>2]|0)+1}}while(0);id(c[Ta>>2]|0,c[U>>2]|0,c[_a>>2]|0,p,o,c[Ja>>2]|0);z=(_(c[Ja>>2]|0,c[ab>>2]|0)|0)<<2;m=i;i=i+((1*z|0)+15&-16)|0;oj(m|0,0,c[_a>>2]<<2|0)|0;do if(!(c[fb>>2]|0)){if(!(c[(c[hb>>2]|0)+192>>2]|0))break;if(c[(c[hb>>2]|0)+68>>2]|0)break;g[H>>2]=0.0;g[G>>2]=0.0;c[A>>2]=0;if(2>(c[(c[hb>>2]|0)+92>>2]|0))k=2;else k=c[(c[hb>>2]|0)+92>>2]|0;c[I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g[G>>2]:.03099999949336052)>-.03099999949336052)l=+g[G>>2]<.03099999949336052?+g[G>>2]:.03099999949336052;else l=-.03099999949336052;g[G>>2]=l;c[E>>2]=0;while(1){if((b[(c[Z>>2]|0)+((c[E>>2]|0)+1<<1)>>1]|0)>=((b[(c[Z>>2]|0)+(c[I>>2]<<1)>>1]|0)/2|0|0))break;c[E>>2]=(c[E>>2]|0)+1}c[C>>2]=0;c[$a>>2]=0;while(1){if((c[$a>>2]|0)>=(c[I>>2]|0))break;g[D>>2]=+g[H>>2]+ +g[G>>2]*+((c[$a>>2]|0)-(c[E>>2]|0)|0);l=+g[(c[(c[hb>>2]|0)+192>>2]|0)+(c[$a>>2]<<2)>>2];if((c[Ja>>2]|0)==2){if(l>+g[(c[(c[hb>>2]|0)+192>>2]|0)+((c[ab>>2]|0)+(c[$a>>2]|0)<<2)>>2])l=+g[(c[(c[hb>>2]|0)+192>>2]|0)+(c[$a>>2]<<2)>>2];else l=+g[(c[(c[hb>>2]|0)+192>>2]|0)+((c[ab>>2]|0)+(c[$a>>2]|0)<<2)>>2];g[F>>2]=l}else g[F>>2]=l;g[F>>2]=+g[F>>2]<0.0?+g[F>>2]:0.0;g[F>>2]=+g[F>>2]-+g[D>>2];if(+g[F>>2]>.25){g[m+(c[$a>>2]<<2)>>2]=+g[F>>2]-.25;c[C>>2]=(c[C>>2]|0)+1}c[$a>>2]=(c[$a>>2]|0)+1}c:do if((c[C>>2]|0)>=3){g[H>>2]=+g[H>>2]+.25;if(+g[H>>2]>0.0){g[H>>2]=0.0;g[G>>2]=0.0;oj(m|0,0,c[I>>2]<<2|0)|0;break}c[$a>>2]=0;while(1){if((c[$a>>2]|0)>=(c[I>>2]|0))break c;if(0.0>+g[m+(c[$a>>2]<<2)>>2]-.25)l=0.0;else l=+g[m+(c[$a>>2]<<2)>>2]-.25;g[m+(c[$a>>2]<<2)>>2]=l;c[$a>>2]=(c[$a>>2]|0)+1}}while(0);g[H>>2]=+g[H>>2]+.20000000298023224;g[ea>>2]=+g[G>>2]*64.0;g[la>>2]=+g[H>>2]}while(0);if(!(c[(c[hb>>2]|0)+68>>2]|0)){g[J>>2]=-10.0;g[K>>2]=0.0;if(c[Wa>>2]|0)l=+(c[La>>2]|0)*.5;else l=0.0;g[L>>2]=l;c[$a>>2]=c[fb>>2];while(1){if((c[$a>>2]|0)>=(c[_a>>2]|0))break;if(+g[J>>2]-1.0>+g[o+(c[$a>>2]<<2)>>2]-+g[L>>2])l=+g[J>>2]-1.0;else l=+g[o+(c[$a>>2]<<2)>>2]-+g[L>>2];g[J>>2]=l;if((c[Ja>>2]|0)==2){if(+g[J>>2]>+g[o+((c[$a>>2]|0)+(c[ab>>2]|0)<<2)>>2]-+g[L>>2])l=+g[J>>2];else l=+g[o+((c[$a>>2]|0)+(c[ab>>2]|0)<<2)>>2]-+g[L>>2];g[J>>2]=l}g[K>>2]=+g[K>>2]+ +g[J>>2];c[$a>>2]=(c[$a>>2]|0)+1}g[K>>2]=+g[K>>2]/+((c[_a>>2]|0)-(c[fb>>2]|0)|0);g[oa>>2]=+g[K>>2]-+g[(c[hb>>2]|0)+196>>2];if(3.0<(-1.5>+g[oa>>2]?-1.5:+g[oa>>2]))l=3.0;else l=-1.5>+g[oa>>2]?-1.5:+g[oa>>2];g[oa>>2]=l;L=(c[hb>>2]|0)+196|0;g[L>>2]=+g[L>>2]+ +g[oa>>2]*.019999999552965164}if(!(c[M>>2]|0)){M=(_(c[Ja>>2]|0,c[ab>>2]|0)|0)<<2;pj(j|0,o|0,M+0|0)|0}do if((c[La>>2]|0)>0){M=(ob(c[jb>>2]|0)|0)+3|0;if(c[nb>>2]|0?1:(M|0)>(c[fa>>2]|0))break;if((c[(c[hb>>2]|0)+24>>2]|0)<5)break;if(c[(c[hb>>2]|0)+68>>2]|0)break;if(!(tb(o,c[bb>>2]|0,c[ab>>2]|0,c[fb>>2]|0,c[_a>>2]|0,c[Ja>>2]|0)|0))break;c[nb>>2]=1;c[Wa>>2]=c[T>>2];sb(c[Ta>>2]|0,c[Wa>>2]|0,e,f,c[Ja>>2]|0,c[Ya>>2]|0,c[La>>2]|0,c[(c[hb>>2]|0)+28>>2]|0,c[(c[hb>>2]|0)+72>>2]|0);Ca(c[Ta>>2]|0,f,p,c[U>>2]|0,c[Ja>>2]|0,c[La>>2]|0);id(c[Ta>>2]|0,c[U>>2]|0,c[_a>>2]|0,p,o,c[Ja>>2]|0);c[$a>>2]=0;while(1){if((c[$a>>2]|0)>=(_(c[Ja>>2]|0,c[ab>>2]|0)|0))break;M=j+(c[$a>>2]<<2)|0;g[M>>2]=+g[M>>2]+ +(c[La>>2]|0)*.5;c[$a>>2]=(c[$a>>2]|0)+1}g[pa>>2]=.20000000298023224}while(0);do if((c[La>>2]|0)>0){M=(ob(c[jb>>2]|0)|0)+3|0;if((M|0)>(c[fa>>2]|0))break;pc(c[jb>>2]|0,c[nb>>2]|0,3)}while(0);a=(_(c[Ja>>2]|0,c[Ma>>2]|0)|0)<<2;n=i;i=i+((1*a|0)+15&-16)|0;Ea(c[Ta>>2]|0,f,n,p,c[U>>2]|0,c[Ja>>2]|0,c[T>>2]|0);a=i;i=i+((1*(c[ab>>2]<<2)|0)+15&-16)|0;d:do if((c[fb>>2]|0)==0?(c[V>>2]|0)>=((c[Ja>>2]|0)*15|0):0){if((c[(c[hb>>2]|0)+24>>2]|0)<2){Q=192;break}if(c[(c[hb>>2]|0)+68>>2]|0){Q=192;break}do if((c[V>>2]|0)>=40){if((c[V>>2]|0)<60){c[N>>2]=6;break}if((c[V>>2]|0)<100){c[N>>2]=4;break}else{c[N>>2]=3;break}}else c[N>>2]=12;while(0);c[N>>2]=c[N>>2]<<1;c[S>>2]=ub(c[Ta>>2]|0,c[U>>2]|0,c[nb>>2]|0,a,c[N>>2]|0,n,c[Ma>>2]|0,c[La>>2]|0,P,+g[pa>>2],c[O>>2]|0)|0;c[$a>>2]=c[U>>2];while(1){if((c[$a>>2]|0)>=(c[_a>>2]|0))break d;c[a+(c[$a>>2]<<2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2]=c[ib>>2];c[lb>>2]=1}na(c[kb>>2]|0);vb=c[gb>>2]|0;i=yb;return vb|0}function ob(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(aa(c[(c[d>>2]|0)+28>>2]|0)|0))|0;i=b;return a|0}function pb(a,b){a=a|0;b=b|0;var d=0.0,e=0,f=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;e=l+16|0;f=l+12|0;h=l+8|0;j=l+4|0;k=l;c[e>>2]=a;c[f>>2]=b;g[j>>2]=0.0;g[k>>2]=0.0;c[h>>2]=0;while(1){d=+g[j>>2];if((c[h>>2]|0)>=(c[f>>2]|0))break;if(d>+g[(c[e>>2]|0)+(c[h>>2]<<2)>>2])d=+g[j>>2];else d=+g[(c[e>>2]|0)+(c[h>>2]<<2)>>2];g[j>>2]=d;if(+g[k>>2]<+g[(c[e>>2]|0)+(c[h>>2]<<2)>>2])d=+g[k>>2];else d=+g[(c[e>>2]|0)+(c[h>>2]<<2)>>2];g[k>>2]=d;c[h>>2]=(c[h>>2]|0)+1}i=l;return +(d>-+g[k>>2]?+g[j>>2]:-+g[k>>2])}function qb(a,b,d,e,f,h,j,k,l,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;L=i;i=i+96|0;s=L+92|0;t=L+88|0;v=L+84|0;w=L+80|0;x=L+76|0;y=L+72|0;z=L+68|0;A=L+64|0;B=L+60|0;q=L+56|0;o=L+52|0;C=L+48|0;J=L+40|0;E=L+36|0;I=L+32|0;D=L+28|0;r=L+24|0;H=L+20|0;K=L+16|0;G=L+12|0;u=L+8|0;p=L+4|0;F=L;c[s>>2]=a;c[t>>2]=b;c[v>>2]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r>>2]=.20000000298023224;a=(N((c[I>>2]|0)-(c[(c[s>>2]|0)+104>>2]|0)|0)|0)*10|0;if((a|0)>(c[I>>2]|0))g[r>>2]=+g[r>>2]+.20000000298023224;if((c[o>>2]|0)<25)g[r>>2]=+g[r>>2]+.10000000149011612;if((c[o>>2]|0)<35)g[r>>2]=+g[r>>2]+.10000000149011612;if(+g[(c[s>>2]|0)+108>>2]>.4000000059604645)g[r>>2]=+g[r>>2]-.10000000149011612;if(+g[(c[s>>2]|0)+108>>2]>.550000011920929)g[r>>2]=+g[r>>2]-.10000000149011612;g[r>>2]=+g[r>>2]>.20000000298023224?+g[r>>2]:.20000000298023224;if(+g[D>>2]<+g[r>>2]){g[D>>2]=0.0;c[H>>2]=0;c[K>>2]=0}else{if(+N(+(+g[D>>2]-+g[(c[s>>2]|0)+108>>2]))<.10000000149011612)g[D>>2]=+g[(c[s>>2]|0)+108>>2];c[K>>2]=~~+M(+(+g[D>>2]*32.0/3.0+.5))-1;if(0>((7<(c[K>>2]|0)?7:c[K>>2]|0)|0))o=0;else o=7<(c[K>>2]|0)?7:c[K>>2]|0;c[K>>2]=o;g[D>>2]=+((c[K>>2]|0)+1|0)*.09375;c[H>>2]=1}c[C>>2]=0;do{c[F>>2]=(c[(c[E>>2]|0)+44>>2]|0)-(c[G>>2]|0);if((c[(c[s>>2]|0)+104>>2]|0)>15)o=c[(c[s>>2]|0)+104>>2]|0;else o=15;c[(c[s>>2]|0)+104>>2]=o;l=(c[t>>2]|0)+((_(c[C>>2]|0,(c[x>>2]|0)+(c[G>>2]|0)|0)|0)<<2)|0;a=(c[s>>2]|0)+200+((_(c[C>>2]|0,c[G>>2]|0)|0)<<2)|0;pj(l|0,a|0,(c[G>>2]<<2)+0|0)|0;if(c[F>>2]|0){a=(c[t>>2]|0)+((_(c[C>>2]|0,(c[x>>2]|0)+(c[G>>2]|0)|0)|0)<<2)|0;cb(a+(c[G>>2]<<2)|0,(c[J+(c[C>>2]<<2)>>2]|0)+4096|0,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g[b+((c[p>>2]<<1)+1<<2)>>2]*+g[b+((c[p>>2]<<1)+1<<2)>>2];g[u>>2]=+g[u>>2]+ +g[A>>2];g[b+(c[p>>2]<<2)>>2]=+g[v>>2]+(+g[A>>2]-+g[v>>2])*.0625;g[v>>2]=+g[b+(c[p>>2]<<2)>>2];c[p>>2]=(c[p>>2]|0)+1}g[v>>2]=0.0;g[t>>2]=0.0;c[p>>2]=(c[r>>2]|0)-1;while(1){if((c[p>>2]|0)<0)break;g[b+(c[p>>2]<<2)>>2]=+g[v>>2]+(+g[b+(c[p>>2]<<2)>>2]-+g[v>>2])*.125;g[v>>2]=+g[b+(c[p>>2]<<2)>>2];g[t>>2]=+g[t>>2]>+g[v>>2]?+g[t>>2]:+g[v>>2];c[p>>2]=(c[p>>2]|0)+-1}g[u>>2]=+O(+(+g[u>>2]*+g[t>>2]*.5*+(c[r>>2]|0)));g[x>>2]=+(c[r>>2]|0)/(+g[u>>2]+1.0000000036274937e-15);c[y>>2]=0;c[p>>2]=12;while(1){if((c[p>>2]|0)>=((c[r>>2]|0)-5|0))break;if(127.0<+M(+(+g[x>>2]*64.0*(+g[b+(c[p>>2]<<2)>>2]+1.0000000036274937e-15))))j=127.0;else j=+M(+(+g[x>>2]*64.0*(+g[b+(c[p>>2]<<2)>>2]+1.0000000036274937e-15)));if(!(0.0>j))if(127.0<+M(+(+g[x>>2]*64.0*(+g[b+(c[p>>2]<<2)>>2]+1.0000000036274937e-15))))j=127.0;else j=+M(+(+g[x>>2]*64.0*(+g[b+(c[p>>2]<<2)>>2]+1.0000000036274937e-15)));else j=0.0;c[q>>2]=~~j;c[y>>2]=(c[y>>2]|0)+(d[25432+(c[q>>2]|0)>>0]|0);c[p>>2]=(c[p>>2]|0)+4}c[y>>2]=(c[y>>2]<<6<<2|0)/(((c[r>>2]|0)-17|0)*6|0)|0;if((c[y>>2]|0)>(c[s>>2]|0)){c[c[n>>2]>>2]=c[o>>2];c[s>>2]=c[y>>2]}c[o>>2]=(c[o>>2]|0)+1}c[E>>2]=(c[s>>2]|0)>200&1;if(0.0>+O(+(+((c[s>>2]|0)*27|0)))-42.0)j=0.0;else j=+O(+(+((c[s>>2]|0)*27|0)))-42.0;g[F>>2]=j;if(0.0>(163.0<+g[F>>2]?163.0:+g[F>>2])*.006899999920278788-.139){j=0.0;j=+O(+j);F=c[C>>2]|0;g[F>>2]=j;F=c[E>>2]|0;E=c[D>>2]|0;na(E|0);i=G;return F|0}j=(163.0<+g[F>>2]?163.0:+g[F>>2])*.006899999920278788-.139;j=+O(+j);F=c[C>>2]|0;g[F>>2]=j;F=c[E>>2]|0;E=c[D>>2]|0;na(E|0);i=G;return F|0}function sb(a,b,d,e,f,h,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=i;i=i+80|0;m=D+64|0;n=D+60|0;o=D+56|0;p=D+52|0;q=D+48|0;r=D+44|0;s=D+40|0;t=D+36|0;u=D+32|0;B=D+28|0;w=D+24|0;v=D+20|0;C=D+16|0;A=D+12|0;x=D+8|0;z=D+4|0;y=D;c[m>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=h;c[s>>2]=j;c[t>>2]=k;c[u>>2]=l;c[B>>2]=c[(c[m>>2]|0)+4>>2];if(c[n>>2]|0){c[v>>2]=c[n>>2];c[w>>2]=c[(c[m>>2]|0)+44>>2];c[C>>2]=c[(c[m>>2]|0)+36>>2]}else{c[v>>2]=1;c[w>>2]=c[(c[m>>2]|0)+44>>2]<>2];c[C>>2]=(c[(c[m>>2]|0)+36>>2]|0)-(c[s>>2]|0)}c[z>>2]=0;do{c[x>>2]=0;while(1){if((c[x>>2]|0)>=(c[v>>2]|0))break;b=_(c[v>>2]|0,c[w>>2]|0)|0;b=(c[o>>2]|0)+((_(c[z>>2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>>2]|0)+((c[r>>2]|0)+(c[m>>2]|0)<<2)>>2]){j=+g[(c[k>>2]|0)+(h<<2)>>2];break}else{j=+g[(c[k>>2]|0)+(h+(c[m>>2]|0)<<2)>>2];break}}else j=+g[t+(f-1<<2)>>2]-1.0;while(0);g[t+(c[r>>2]<<2)>>2]=j;c[r>>2]=(c[r>>2]|0)+1}}while(0);c[r>>2]=(c[o>>2]|0)-2;while(1){if((c[r>>2]|0)<(c[n>>2]|0))break;h=c[r>>2]|0;if(+g[t+(c[r>>2]<<2)>>2]>+g[t+((c[r>>2]|0)+1<<2)>>2]-1.0)j=+g[t+(h<<2)>>2];else j=+g[t+(h+1<<2)>>2]-1.0;g[t+(c[r>>2]<<2)>>2]=j;c[r>>2]=(c[r>>2]|0)+-1}c[q>>2]=0;do{c[r>>2]=2>(c[n>>2]|0)?2:c[n>>2]|0;while(1){if((c[r>>2]|0)>=((c[o>>2]|0)-1|0))break;k=(c[r>>2]|0)+(_(c[q>>2]|0,c[m>>2]|0)|0)|0;if(0.0>+g[(c[l>>2]|0)+(k<<2)>>2])j=0.0;else{k=(c[r>>2]|0)+(_(c[q>>2]|0,c[m>>2]|0)|0)|0;j=+g[(c[l>>2]|0)+(k<<2)>>2]}g[u>>2]=j;if(0.0>+g[t+(c[r>>2]<<2)>>2])j=0.0;else j=+g[t+(c[r>>2]<<2)>>2];g[v>>2]=j;if(0.0>+g[u>>2]-+g[v>>2])j=0.0;else j=+g[u>>2]-+g[v>>2];g[s>>2]=+g[s>>2]+j;c[r>>2]=(c[r>>2]|0)+1}k=(c[q>>2]|0)+1|0;c[q>>2]=k}while((k|0)<(c[p>>2]|0));g[s>>2]=+g[s>>2]/+(_(c[p>>2]|0,(c[o>>2]|0)-1-(2>(c[n>>2]|0)?2:c[n>>2]|0)|0)|0);i=w;return +g[s>>2]>1.0|0}function ub(d,e,f,h,j,k,l,m,n,o,p){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0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o>>2]<<3)+((c[m>>2]<<2)+0+(c[w>>2]|0))>>0]|0)!=(a[25232+(c[o>>2]<<3)+((c[m>>2]<<2)+2+(c[w>>2]|0))>>0]|0):0)pc(c[q>>2]|0,c[p>>2]|0,1);else c[p>>2]=0;c[t>>2]=c[k>>2];while(1){if((c[t>>2]|0)>=(c[l>>2]|0))break;c[(c[n>>2]|0)+(c[t>>2]<<2)>>2]=a[25232+(c[o>>2]<<3)+((c[m>>2]<<2)+(c[p>>2]<<1)+(c[(c[n>>2]|0)+(c[t>>2]<<2)>>2]|0))>>0];c[t>>2]=(c[t>>2]|0)+1}i=y;return}function xb(a,d,e,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;var w=0.0,x=0.0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0;da=i;i=i+128|0;I=da+120|0;B=da+116|0;H=da+112|0;K=da+108|0;S=da+104|0;T=da+100|0;U=da+96|0;y=da+92|0;z=da+88|0;V=da+84|0;L=da+80|0;M=da+76|0;N=da+72|0;O=da+68|0;P=da+64|0;Q=da+60|0;A=da+56|0;J=da+52|0;Z=da+48|0;C=da+44|0;aa=da+40|0;$=da+36|0;R=da+32|0;E=da+28|0;F=da+24|0;G=da+20|0;D=da+16|0;ba=da+12|0;W=da+8|0;X=da+4|0;Y=da;c[I>>2]=a;c[B>>2]=d;c[H>>2]=e;c[K>>2]=f;c[S>>2]=h;c[T>>2]=j;c[U>>2]=k;c[y>>2]=l;c[z>>2]=m;c[V>>2]=n;c[L>>2]=o;c[M>>2]=p;c[N>>2]=q;c[O>>2]=r;c[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]}a=c[d>>2]|0;if(+g[(c[d>>2]|0)+12>>2]>+g[(c[d>>2]|0)+16>>2]){g[j>>2]=+g[a+16>>2];g[k>>2]=+g[(c[d>>2]|0)+12>>2]}else{g[j>>2]=+g[a+12>>2];g[k>>2]=+g[(c[d>>2]|0)+16>>2]}if(+g[e>>2]>+g[j>>2]){g[l>>2]=+g[e>>2];g[e>>2]=+g[j>>2];g[j>>2]=+g[l>>2];g[m>>2]=+g[f>>2];g[f>>2]=+g[k>>2];g[k>>2]=+g[m>>2]}if(+g[h>>2]>+g[f>>2])if(+g[f>>2]<+g[j>>2]){g[b>>2]=+g[h>>2]<+g[j>>2]?+g[h>>2]:+g[j>>2];o=+g[b>>2];i=n;return +o}else{g[b>>2]=+g[k>>2]<+g[f>>2]?+g[k>>2]:+g[f>>2];o=+g[b>>2];i=n;return +o}else if(+g[h>>2]<+g[j>>2]){g[b>>2]=+g[f>>2]<+g[j>>2]?+g[f>>2]:+g[j>>2];o=+g[b>>2];i=n;return +o}else{g[b>>2]=+g[h>>2]<+g[k>>2]?+g[h>>2]:+g[k>>2];o=+g[b>>2];i=n;return +o}return 0.0}function zb(a){a=a|0;var b=0,d=0,e=0,f=0,h=0,j=0,k=0.0;j=i;i=i+32|0;b=j+16|0;d=j+12|0;e=j+8|0;f=j+4|0;h=j;c[d>>2]=a;a=c[d>>2]|0;if(+g[c[d>>2]>>2]>+g[(c[d>>2]|0)+4>>2]){g[e>>2]=+g[a+4>>2];g[f>>2]=+g[c[d>>2]>>2]}else{g[e>>2]=+g[a>>2];g[f>>2]=+g[(c[d>>2]|0)+4>>2]}g[h>>2]=+g[(c[d>>2]|0)+8>>2];if(+g[f>>2]<+g[h>>2]){g[b>>2]=+g[f>>2];k=+g[b>>2];i=j;return +k}if(+g[e>>2]<+g[h>>2]){g[b>>2]=+g[h>>2];k=+g[b>>2];i=j;return +k}else{g[b>>2]=+g[e>>2];k=+g[b>>2];i=j;return +k}return 0.0}function Ab(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0;v=i;i=i+64|0;h=v+48|0;j=v+44|0;k=v+40|0;l=v+36|0;q=v+32|0;u=v+28|0;s=v+24|0;t=v+20|0;r=v+16|0;m=v+12|0;o=v+8|0;n=v+4|0;p=v;c[h>>2]=a;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;g[s>>2]=1.0000000036274937e-15;g[t>>2]=1.0000000036274937e-15;c[q>>2]=0;while(1){if((c[q>>2]|0)>=13)break;c[r>>2]=b[(c[(c[h>>2]|0)+32>>2]|0)+(c[q>>2]<<1)>>1]<>2];while(1){if((c[r>>2]|0)>=(b[(c[(c[h>>2]|0)+32>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<>2]|0))break;g[m>>2]=+g[(c[j>>2]|0)+(c[r>>2]<<2)>>2];g[o>>2]=+g[(c[j>>2]|0)+((c[l>>2]|0)+(c[r>>2]|0)<<2)>>2];g[n>>2]=+g[m>>2]+ +g[o>>2];g[p>>2]=+g[m>>2]-+g[o>>2];w=+N(+(+g[m>>2]));g[s>>2]=+g[s>>2]+(w+ +N(+(+g[o>>2])));w=+N(+(+g[n>>2]));g[t>>2]=+g[t>>2]+(w+ +N(+(+g[p>>2])));c[r>>2]=(c[r>>2]|0)+1}c[q>>2]=(c[q>>2]|0)+1}g[t>>2]=+g[t>>2]*.7071070075035095;c[u>>2]=13;if((c[k>>2]|0)<=1)c[u>>2]=(c[u>>2]|0)-8;i=v;return +((b[(c[(c[h>>2]|0)+32>>2]|0)+26>>1]<<(c[k>>2]|0)+1)+(c[u>>2]|0)|0)*+g[t>>2]>+(b[(c[(c[h>>2]|0)+32>>2]|0)+26>>1]<<(c[k>>2]|0)+1|0)*+g[s>>2]|0}function Bb(a,d,e,f,h,j,k,l,m,n,o,p,q){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+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|0)+32>>2]|0)+(c[H>>2]<<1)>>1]<>2]<<2)|0,(c[s>>2]|0)+((c[v>>2]|0)+(b[(c[(c[B>>2]|0)+32>>2]|0)+(c[H>>2]<<1)>>1]<>2])<<2)|0,(b[(c[(c[B>>2]|0)+32>>2]|0)+((c[H>>2]|0)+1<<1)>>1]|0)-(b[(c[(c[B>>2]|0)+32>>2]|0)+(c[H>>2]<<1)>>1]|0)<>2]);if(+g[x>>2]<+N(+(+g[w>>2])))p=+g[x>>2];else p=+N(+(+g[w>>2]));g[x>>2]=p;c[H>>2]=(c[H>>2]|0)+1}if(1.0<+N(+(+g[x>>2])))p=1.0;else p=+N(+(+g[x>>2]));g[x>>2]=p;g[z>>2]=+Y(+(1.0010000467300415-+g[y>>2]*+g[y>>2]))*1.4426950408889634;if(+g[z>>2]*.5>+Y(+(1.0010000467300415-+g[x>>2]*+g[x>>2]))*1.4426950408889634)p=+g[z>>2]*.5;else p=+Y(+(1.0010000467300415-+g[x>>2]*+g[x>>2]))*1.4426950408889634;g[A>>2]=p;g[O>>2]=+g[O>>2]+(-4.0>+g[z>>2]*.75?-4.0:+g[z>>2]*.75);if(+g[c[F>>2]>>2]+.25<-(+g[A>>2]*.5))p=+g[c[F>>2]>>2]+.25;else p=-(+g[A>>2]*.5);g[c[F>>2]>>2]=p}c[G>>2]=0;do{c[H>>2]=0;while(1){if((c[H>>2]|0)>=((c[D>>2]|0)-1|0))break;F=(c[H>>2]|0)+(_(c[G>>2]|0,c[(c[B>>2]|0)+8>>2]|0)|0)|0;g[I>>2]=+g[I>>2]+ +g[(c[C>>2]|0)+(F<<2)>>2]*+(2+(c[H>>2]<<1)-(c[D>>2]|0)|0);c[H>>2]=(c[H>>2]|0)+1}F=(c[G>>2]|0)+1|0;c[G>>2]=F}while((F|0)<(c[E>>2]|0));n=+(_(c[E>>2]|0,(c[D>>2]|0)-1|0)|0);g[I>>2]=+g[I>>2]/n;if(2.0<(+g[I>>2]+1.0)/6.0)p=2.0;else p=(+g[I>>2]+1.0)/6.0;if(!(-2.0>p))if(2.0<(+g[I>>2]+1.0)/6.0)p=2.0;else p=(+g[I>>2]+1.0)/6.0;else p=-2.0;g[O>>2]=+g[O>>2]-p;g[O>>2]=+g[O>>2]-+g[J>>2];g[O>>2]=+g[O>>2]-+g[K>>2]*2.0;if(c[c[L>>2]>>2]|0){if(2.0<(+g[(c[L>>2]|0)+8>>2]+.05000000074505806)*2.0)p=2.0;else p=(+g[(c[L>>2]|0)+8>>2]+.05000000074505806)*2.0;if(!(-2.0>p))if(2.0<(+g[(c[L>>2]|0)+8>>2]+.05000000074505806)*2.0)p=2.0;else p=(+g[(c[L>>2]|0)+8>>2]+.05000000074505806)*2.0;else p=-2.0;g[O>>2]=+g[O>>2]-p}c[P>>2]=~~+M(+(+g[O>>2]+.5));if(0>((10<(c[P>>2]|0)?10:c[P>>2]|0)|0)){O=0;c[P>>2]=O;P=c[P>>2]|0;i=Q;return P|0}O=10<(c[P>>2]|0)?10:c[P>>2]|0;c[P>>2]=O;P=c[P>>2]|0;i=Q;return P|0}function Cb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;f=m+16|0;h=m+12|0;j=m+8|0;k=m+4|0;l=m;c[f>>2]=a;c[h>>2]=b;c[j>>2]=d;g[l>>2]=0.0;c[k>>2]=0;while(1){e=+g[l>>2];if((c[k>>2]|0)>=(c[j>>2]|0))break;g[l>>2]=e+ +g[(c[f>>2]|0)+(c[k>>2]<<2)>>2]*+g[(c[h>>2]|0)+(c[k>>2]<<2)>>2];c[k>>2]=(c[k>>2]|0)+1}i=m;return +e}function Db(a,d,e,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+n;o=o|0;p=+p;q=q|0;r=+r;s=s|0;t=t|0;u=u|0;v=+v;w=+w;var x=0,y=0,z=0,A=0,B=0,C=0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059604645-+g[(c[D>>2]|0)+16>>2]));if((c[Q>>2]|0)==2){c[A>>2]=(c[x>>2]|0)<(c[z>>2]|0)?c[x>>2]|0:c[z>>2]|0;c[B>>2]=(b[(c[S>>2]|0)+(c[A>>2]<<1)>>1]<>2])-(c[A>>2]|0);g[C>>2]=+(c[B>>2]|0)*.800000011920929/+(c[J>>2]|0);g[y>>2]=+g[y>>2]<1.0?+g[y>>2]:1.0;if(+g[C>>2]*+(c[ca>>2]|0)<(+g[y>>2]-.10000000149011612)*+(c[B>>2]<<3|0))r=+g[C>>2]*+(c[ca>>2]|0);else r=(+g[y>>2]-.10000000149011612)*+(c[B>>2]<<3|0);c[ca>>2]=(c[ca>>2]|0)-~~r}c[ca>>2]=(c[ca>>2]|0)+((c[E>>2]|0)-(16<>2]));g[G>>2]=(c[F>>2]|0)==5010?.019999999552965164:.03999999910593033;c[ca>>2]=(c[ca>>2]|0)+~~((+g[V>>2]-+g[G>>2])*+(c[ca>>2]|0));if(!(c[O>>2]|0?1:(c[c[D>>2]>>2]|0)==0)){if(0.0>+g[(c[D>>2]|0)+4>>2]-.15000000596046448)r=0.0;else r=+g[(c[D>>2]|0)+4>>2]-.15000000596046448;g[L>>2]=r-.09000000357627869;c[M>>2]=(c[ca>>2]|0)+~~(+(c[J>>2]<<3|0)*1.2000000476837158*+g[L>>2]);if(c[H>>2]|0)c[M>>2]=(c[M>>2]|0)+~~(+(c[J>>2]<<3|0)*.800000011920929);c[ca>>2]=c[M>>2]}if(!((c[W>>2]|0)==0|(c[O>>2]|0)!=0)){c[K>>2]=(c[ca>>2]|0)+~~(+g[I>>2]*+(c[J>>2]<<3|0));if(((c[ca>>2]|0)/4|0|0)>(c[K>>2]|0))x=(c[ca>>2]|0)/4|0;else x=c[K>>2]|0;c[ca>>2]=x}c[R>>2]=b[(c[S>>2]|0)+((c[U>>2]|0)-2<<1)>>1]<>2];p=+((_(c[Q>>2]|0,c[R>>2]|0)|0)<<3|0);c[T>>2]=~~(p*+g[N>>2]);c[T>>2]=(c[T>>2]|0)>(c[ca>>2]>>2|0)?c[T>>2]|0:c[ca>>2]>>2;c[ca>>2]=(c[ca>>2]|0)<(c[T>>2]|0)?c[ca>>2]|0:c[T>>2]|0;if((c[W>>2]|0)==0|(c[O>>2]|0)!=0?(c[Y>>2]|0)!=0|(c[X>>2]|0)<64e3:0){if(0.0>+((c[X>>2]|0)-32e3|0)*.000030517578125)r=0.0;else r=+((c[X>>2]|0)-32e3|0)*.000030517578125;g[Z>>2]=r;if(c[Y>>2]|0)g[Z>>2]=+g[Z>>2]<.6700000166893005?+g[Z>>2]:.6700000166893005;c[ca>>2]=(c[aa>>2]|0)+~~(+g[Z>>2]*+((c[ca>>2]|0)-(c[aa>>2]|0)|0))}if(!((c[W>>2]|0)==0&+g[V>>2]<.20000000298023224)){fa=c[aa>>2]|0;fa=fa<<1;da=c[ca>>2]|0;da=(fa|0)<(da|0);fa=c[aa>>2]|0;fa=fa<<1;ga=c[ca>>2]|0;ga=da?fa:ga;c[ca>>2]=ga;ga=c[ca>>2]|0;i=ea;return ga|0}if(0>((32e3<(96e3-(c[X>>2]|0)|0)?32e3:96e3-(c[X>>2]|0)|0)|0))x=0;else x=32e3<(96e3-(c[X>>2]|0)|0)?32e3:96e3-(c[X>>2]|0)|0;g[ba>>2]=+(x|0)*3.099999958067201e-06;g[da>>2]=+g[$>>2]*+g[ba>>2];c[ca>>2]=(c[ca>>2]|0)+~~(+g[da>>2]*+(c[ca>>2]|0));fa=c[aa>>2]|0;fa=fa<<1;da=c[ca>>2]|0;da=(fa|0)<(da|0);fa=c[aa>>2]|0;fa=fa<<1;ga=c[ca>>2]|0;ga=da?fa:ga;c[ca>>2]=ga;ga=c[ca>>2]|0;i=ea;return ga|0}function Eb(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;i=d;return c[(c[b>>2]|0)+44>>2]|0}function Fb(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=Jc(48e3,960,0)|0;a=Gb(c[e>>2]|0,c[d>>2]|0)|0;i=b;return a|0}function Gb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;e=i;i=i+16|0;f=e+8|0;g=e+4|0;d=e;c[f>>2]=a;c[g>>2]=b;a=88+((_(c[g>>2]|0,2048+(c[(c[f>>2]|0)+4>>2]|0)|0)|0)-1<<2)|0;c[d>>2]=a+((c[g>>2]|0)*24<<2)+(c[(c[f>>2]|0)+8>>2]<<3<<2);i=e;return c[d>>2]|0}function Hb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;j=i;i=i+32|0;e=j+16|0;f=j+12|0;g=j+8|0;k=j+4|0;h=j;c[f>>2]=a;c[g>>2]=b;c[k>>2]=d;b=c[f>>2]|0;a=Jc(48e3,960,0)|0;c[h>>2]=Ib(b,a,c[k>>2]|0)|0;if(c[h>>2]|0){c[e>>2]=c[h>>2];k=c[e>>2]|0;i=j;return k|0}k=bb(c[g>>2]|0)|0;c[(c[f>>2]|0)+16>>2]=k;if(!(c[(c[f>>2]|0)+16>>2]|0)){c[e>>2]=-1;k=c[e>>2]|0;i=j;return k|0}else{c[e>>2]=0;k=c[e>>2]|0;i=j;return k|0}return 0}function Ib(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+32|0;e=j+16|0;f=j+12|0;g=j+8|0;h=j+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if((c[h>>2]|0)<0|(c[h>>2]|0)>2){c[e>>2]=-1;a=c[e>>2]|0;i=j;return a|0}if(!(c[f>>2]|0)){c[e>>2]=-7;a=c[e>>2]|0;i=j;return a|0}else{a=c[f>>2]|0;oj(a|0,0,Gb(c[g>>2]|0,c[h>>2]|0)|0)|0;c[c[f>>2]>>2]=c[g>>2];c[(c[f>>2]|0)+4>>2]=c[(c[g>>2]|0)+4>>2];a=c[h>>2]|0;c[(c[f>>2]|0)+8>>2]=a;c[(c[f>>2]|0)+12>>2]=a;c[(c[f>>2]|0)+16>>2]=1;c[(c[f>>2]|0)+20>>2]=0;c[(c[f>>2]|0)+24>>2]=c[(c[c[f>>2]>>2]|0)+12>>2];c[(c[f>>2]|0)+28>>2]=1;a=Jb()|0;c[(c[f>>2]|0)+32>>2]=a;c[(c[f>>2]|0)+48>>2]=0;Kb(c[f>>2]|0,4028,j)|0;c[e>>2]=0;a=c[e>>2]|0;i=j;return a|0}return 0}function Jb(){return 0}function Kb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;x=i;i=i+96|0;w=x+80|0;e=x+76|0;y=x+72|0;f=x+56|0;n=x+52|0;o=x+48|0;p=x+44|0;q=x+40|0;r=x+36|0;h=x+32|0;j=x+28|0;k=x+24|0;l=x+20|0;m=x+16|0;s=x+12|0;t=x+8|0;u=x+4|0;v=x;c[e>>2]=a;c[y>>2]=b;c[f>>2]=d;a:do switch(c[y>>2]|0){case 10010:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[n>>2]=y;if((c[n>>2]|0)>=0?(c[n>>2]|0)<(c[(c[c[e>>2]>>2]|0)+8>>2]|0):0){c[(c[e>>2]|0)+20>>2]=c[n>>2];e=24}else e=25;break}case 10012:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[o>>2]=y;if((c[o>>2]|0)>=1?(c[o>>2]|0)<=(c[(c[c[e>>2]>>2]|0)+8>>2]|0):0){c[(c[e>>2]|0)+24>>2]=c[o>>2];e=24}else e=25;break}case 10008:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[p>>2]=y;if((c[p>>2]|0)<1|(c[p>>2]|0)>2)e=25;else{c[(c[e>>2]|0)+12>>2]=c[p>>2];e=24}break}case 10007:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[q>>2]=y;if(!(c[q>>2]|0))e=25;else{c[c[q>>2]>>2]=c[(c[e>>2]|0)+40>>2];c[(c[e>>2]|0)+40>>2]=0;e=24}break}case 4027:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[r>>2]=y;if(!(c[r>>2]|0))e=25;else{c[c[r>>2]>>2]=(c[(c[e>>2]|0)+4>>2]|0)/(c[(c[e>>2]|0)+16>>2]|0)|0;e=24}break}case 4028:{c[j>>2]=(c[e>>2]|0)+84+((_(2048+(c[(c[e>>2]|0)+4>>2]|0)|0,c[(c[e>>2]|0)+8>>2]|0)|0)<<2);c[k>>2]=(c[j>>2]|0)+((c[(c[e>>2]|0)+8>>2]|0)*24<<2);c[l>>2]=(c[k>>2]|0)+(c[(c[c[e>>2]>>2]|0)+8>>2]<<1<<2);c[m>>2]=(c[l>>2]|0)+(c[(c[c[e>>2]>>2]|0)+8>>2]<<1<<2);oj((c[e>>2]|0)+36|0,0,(Gb(c[c[e>>2]>>2]|0,c[(c[e>>2]|0)+8>>2]|0)|0)-((c[e>>2]|0)+36-(c[e>>2]|0))|0)|0;c[h>>2]=0;while(1){if((c[h>>2]|0)>=(c[(c[c[e>>2]>>2]|0)+8>>2]<<1|0)){e=24;break a}g[(c[m>>2]|0)+(c[h>>2]<<2)>>2]=-28.0;g[(c[l>>2]|0)+(c[h>>2]<<2)>>2]=-28.0;c[h>>2]=(c[h>>2]|0)+1}}case 4033:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[s>>2]=y;if(!(c[s>>2]|0))e=25;else{c[c[s>>2]>>2]=c[(c[e>>2]|0)+52>>2];e=24}break}case 10015:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[t>>2]=y;if(!(c[t>>2]|0))e=25;else{c[c[t>>2]>>2]=c[c[e>>2]>>2];e=24}break}case 10016:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[u>>2]=y;c[(c[e>>2]|0)+28>>2]=c[u>>2];e=24;break}case 4031:{d=(c[f>>2]|0)+(4-1)&~(4-1);y=c[d>>2]|0;c[f>>2]=d+4;c[v>>2]=y;if(!(c[v>>2]|0))e=25;else{c[c[v>>2]>>2]=c[(c[e>>2]|0)+36>>2];e=24}break}default:{c[w>>2]=-5;y=c[w>>2]|0;i=x;return y|0}}while(0);if((e|0)==24){c[w>>2]=0;y=c[w>>2]|0;i=x;return y|0}else if((e|0)==25){c[w>>2]=-1;y=c[w>>2]|0;i=x;return y|0}return 0} + function ye(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;A=A|0;B=B|0;C=C|0;D=D|0;var E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ja=0,ka=0,la=0,ma=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0;Na=i;i=i+256|0;E=Na+240|0;Ha=Na+236|0;N=Na+232|0;T=Na+228|0;U=Na+224|0;V=Na+220|0;W=Na+216|0;X=Na+212|0;Y=Na+208|0;Z=Na+204|0;F=Na+200|0;G=Na+196|0;H=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((c[va>>2]|0)<=0){if(!o){c[wa>>2]=c[L>>2];c[xa>>2]=(c[wa>>2]|0)+944;c[za>>2]=_((c[wa>>2]&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;c[Aa>>2]=_((c[xa>>2]&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;break}if((c[va>>2]|0)==-1){c[xa>>2]=c[L>>2];c[wa>>2]=(c[xa>>2]|0)-944;c[za>>2]=_((0-(c[wa>>2]|0)&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;c[Aa>>2]=_((c[xa>>2]&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;break}else{c[wa>>2]=(c[va>>2]<<10)+80;c[wa>>2]=(c[wa>>2]|0)+(c[L>>2]|0);c[xa>>2]=(c[wa>>2]|0)+1024;c[za>>2]=_((0-(c[wa>>2]|0)&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;c[Aa>>2]=_((0-(c[xa>>2]|0)&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;break}}else{c[wa>>2]=(o<<10)-80;c[wa>>2]=(c[wa>>2]|0)+(c[L>>2]|0);c[xa>>2]=(c[wa>>2]|0)+1024;c[za>>2]=_((c[wa>>2]&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0;c[Aa>>2]=_((c[xa>>2]&65535)<<16>>16,(c[K>>2]&65535)<<16>>16)|0}while(0);c[Ba>>2]=(c[ya>>2]|0)-(c[wa>>2]|0);c[za>>2]=(c[za>>2]|0)+(_((c[Ba>>2]&65535)<<16>>16,(c[Ba>>2]&65535)<<16>>16)|0)>>10;c[Ba>>2]=(c[ya>>2]|0)-(c[xa>>2]|0);c[Aa>>2]=(c[Aa>>2]|0)+(_((c[Ba>>2]&65535)<<16>>16,(c[Ba>>2]&65535)<<16>>16)|0)>>10;o=c[(c[Ma>>2]|0)+1164>>2]|0;if((c[za>>2]|0)<(c[Aa>>2]|0)){c[(c[ua>>2]|0)+4>>2]=o+(c[za>>2]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31;c[fa>>2]=c[t+4>>2];c[ha>>2]=0;c[La>>2]=1;while(1){if((c[La>>2]|0)>=(c[Ja>>2]|0))break;if((c[t+((c[La>>2]|0)*48|0)+4>>2]|0)<(c[fa>>2]|0)){c[fa>>2]=c[t+((c[La>>2]|0)*48|0)+4>>2];c[ha>>2]=c[La>>2]}c[La>>2]=(c[La>>2]|0)+1}c[ja>>2]=c[(c[Ha>>2]|0)+((c[ha>>2]|0)*1168|0)+448+(c[oa>>2]<<2)>>2];c[La>>2]=0;while(1){if((c[La>>2]|0)>=(c[Ja>>2]|0))break;if((c[(c[Ha>>2]|0)+((c[La>>2]|0)*1168|0)+448+(c[oa>>2]<<2)>>2]|0)!=(c[ja>>2]|0)){c[t+((c[La>>2]|0)*48|0)+4>>2]=(c[t+((c[La>>2]|0)*48|0)+4>>2]|0)+134217727;c[t+((c[La>>2]|0)*48|0)+24+4>>2]=(c[t+((c[La>>2]|0)*48|0)+24+4>>2]|0)+134217727}c[La>>2]=(c[La>>2]|0)+1}c[da>>2]=c[t+4>>2];c[fa>>2]=c[t+24+4>>2];c[ea>>2]=0;c[ga>>2]=0;c[La>>2]=1;while(1){if((c[La>>2]|0)>=(c[Ja>>2]|0))break;if((c[t+((c[La>>2]|0)*48|0)+4>>2]|0)>(c[da>>2]|0)){c[da>>2]=c[t+((c[La>>2]|0)*48|0)+4>>2];c[ea>>2]=c[La>>2]}if((c[t+((c[La>>2]|0)*48|0)+24+4>>2]|0)<(c[fa>>2]|0)){c[fa>>2]=c[t+((c[La>>2]|0)*48|0)+24+4>>2];c[ga>>2]=c[La>>2]}c[La>>2]=(c[La>>2]|0)+1}if((c[fa>>2]|0)<(c[da>>2]|0)){pj((c[Ha>>2]|0)+((c[ea>>2]|0)*1168|0)+(c[la>>2]<<2)|0,(c[Ha>>2]|0)+((c[ga>>2]|0)*1168|0)+(c[la>>2]<<2)|0,1168-(c[la>>2]<<2)|0)|0;Oa=t+((c[ea>>2]|0)*48|0)|0;j=t+((c[ga>>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]|0)+1156>>2]|0)+((c[c[ua>>2]>>2]>>9)+1>>1);c[(c[Ma>>2]|0)+448+(c[c[R>>2]>>2]<<2)>>2]=c[(c[Ma>>2]|0)+1156>>2];c[(c[Ma>>2]|0)+1164>>2]=c[(c[ua>>2]|0)+4>>2];c[La>>2]=(c[La>>2]|0)+1}c[(c[X>>2]|0)+(c[c[R>>2]>>2]<<2)>>2]=c[$>>2];c[la>>2]=(c[la>>2]|0)+1}c[La>>2]=0;while(1){if((c[La>>2]|0)>=(c[Ja>>2]|0))break;c[Ma>>2]=(c[Ha>>2]|0)+((c[La>>2]|0)*1168|0);o=c[Ma>>2]|0;t=(c[Ma>>2]|0)+(c[Ia>>2]<<2)|0;q=o+128|0;do{c[o>>2]=c[t>>2];o=o+4|0;t=t+4|0}while((o|0)<(q|0));c[La>>2]=(c[La>>2]|0)+1}na(c[Ka>>2]|0);i=Na;return}function ze(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;c[(c[d>>2]|0)+4168>>2]=c[(c[d>>2]|0)+2328>>2]<<7;c[(c[d>>2]|0)+4168+72>>2]=65536;c[(c[d>>2]|0)+4168+72+4>>2]=65536;c[(c[d>>2]|0)+4168+88>>2]=20;c[(c[d>>2]|0)+4168+84>>2]=2;i=b;return}function Ae(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;h=m+16|0;g=m+12|0;j=m+8|0;k=m+4|0;l=m;c[h>>2]=a;c[g>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;if((c[(c[h>>2]|0)+2316>>2]|0)!=(c[(c[h>>2]|0)+4168+80>>2]|0)){ze(c[h>>2]|0);c[(c[h>>2]|0)+4168+80>>2]=c[(c[h>>2]|0)+2316>>2]}d=c[h>>2]|0;f=c[g>>2]|0;if(c[k>>2]|0){Be(d,f,c[j>>2]|0,c[l>>2]|0);l=(c[h>>2]|0)+4160|0;c[l>>2]=(c[l>>2]|0)+1;i=m;return}else{Ke(d,f);i=m;return}}function Be(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;N=i;i=i+176|0;z=N+120|0;A=N+116|0;B=N+112|0;m=N+108|0;F=N+104|0;G=N+100|0;u=N+96|0;H=N+92|0;r=N+88|0;y=N+84|0;k=N+80|0;l=N+76|0;L=N+72|0;q=N+68|0;w=N+64|0;t=N+60|0;h=N+56|0;j=N+52|0;x=N+48|0;v=N+44|0;E=N+40|0;o=N+36|0;K=N+160|0;n=N+32|0;M=N+28|0;D=N+128|0;J=N+24|0;I=N+16|0;C=N+8|0;s=N+4|0;p=N;c[z>>2]=a;c[A>>2]=d;c[B>>2]=e;c[m>>2]=f;c[J>>2]=(c[z>>2]|0)+4168;g=(c[(c[z>>2]|0)+2336>>2]|0)+(c[(c[z>>2]|0)+2328>>2]|0)|0;c[C>>2]=ia()|0;d=i;i=i+((1*(g<<2)|0)+15&-16)|0;g=i;i=i+((1*(c[(c[z>>2]|0)+2336>>2]<<1)|0)+15&-16)|0;c[I>>2]=c[(c[J>>2]|0)+72>>2]>>6;c[I+4>>2]=c[(c[J>>2]|0)+72+4>>2]>>6;if(c[(c[z>>2]|0)+2376>>2]|0){e=(c[J>>2]|0)+14|0;a=e+32|0;do{b[e>>1]=0;e=e+2|0}while((e|0)<(a|0))}Ce(h,k,j,l,(c[z>>2]|0)+4|0,I,c[(c[z>>2]|0)+2332>>2]|0,c[(c[z>>2]|0)+2324>>2]|0);f=c[(c[J>>2]|0)+84>>2]|0;if((c[h>>2]>>c[l>>2]|0)<(c[j>>2]>>c[k>>2]|0)){l=De(0,(_(f-1|0,c[(c[J>>2]|0)+88>>2]|0)|0)-128|0)|0;c[x>>2]=(c[z>>2]|0)+4+(l<<2)}else{l=De(0,(_(f,c[(c[J>>2]|0)+88>>2]|0)|0)-128|0)|0;c[x>>2]=(c[z>>2]|0)+4+(l<<2)}c[n>>2]=(c[J>>2]|0)+4;b[K>>1]=b[(c[J>>2]|0)+56>>1]|0;c[q>>2]=b[24440+((Ee(1,c[(c[z>>2]|0)+4160>>2]|0)|0)<<1)>>1];l=(c[(c[z>>2]|0)+4164>>2]|0)==2;f=Ee(1,c[(c[z>>2]|0)+4160>>2]|0)|0;if(l)c[w>>2]=b[24444+(f<<1)>>1];else c[w>>2]=b[24448+(f<<1)>>1];Pf((c[J>>2]|0)+14|0,c[(c[z>>2]|0)+2340>>2]|0,64881);pj(D|0,(c[J>>2]|0)+14|0,c[(c[z>>2]|0)+2340>>2]<<1|0)|0;do if(!(c[(c[z>>2]|0)+4160>>2]|0)){b[K>>1]=16384;if((c[(c[z>>2]|0)+4164>>2]|0)!=2){c[s>>2]=Yf((c[J>>2]|0)+14|0,c[(c[z>>2]|0)+2340>>2]|0)|0;c[p>>2]=Ge(134217728,c[s>>2]|0)|0;c[p>>2]=He(4194304,c[p>>2]|0)|0;c[p>>2]=c[p>>2]<<3;s=_(c[p>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;c[w>>2]=s+((_(c[p>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16)>>14;break}c[F>>2]=0;while(1){if((c[F>>2]|0)>=5)break;b[K>>1]=(b[K>>1]|0)-(b[(c[n>>2]|0)+(c[F>>2]<<1)>>1]|0);c[F>>2]=(c[F>>2]|0)+1}b[K>>1]=Fe(3277,b[K>>1]|0)|0;b[K>>1]=(_(b[K>>1]|0,b[(c[J>>2]|0)+68>>1]|0)|0)>>14}while(0);c[L>>2]=c[(c[J>>2]|0)+52>>2];c[H>>2]=(c[c[J>>2]>>2]>>7)+1>>1;c[y>>2]=c[(c[z>>2]|0)+2336>>2];c[r>>2]=(c[(c[z>>2]|0)+2336>>2]|0)-(c[H>>2]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>2]|0)+6>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(t+((_(c[(c[v>>2]|0)+-12>>2]&65535,b[(c[n>>2]|0)+6>>1]|0)|0)>>16));t=_(c[(c[v>>2]|0)+-16>>2]>>16,b[(c[n>>2]|0)+8>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(t+((_(c[(c[v>>2]|0)+-16>>2]&65535,b[(c[n>>2]|0)+8>>1]|0)|0)>>16));c[v>>2]=(c[v>>2]|0)+4;c[L>>2]=907633515+(_(c[L>>2]|0,196314165)|0);c[r>>2]=c[L>>2]>>25&127;t=_(c[(c[x>>2]|0)+(c[r>>2]<<2)>>2]>>16,b[K>>1]|0)|0;t=(c[o>>2]|0)+(t+((_(c[(c[x>>2]|0)+(c[r>>2]<<2)>>2]&65535,b[K>>1]|0)|0)>>16))<<2;c[d+(c[y>>2]<<2)>>2]=t;c[y>>2]=(c[y>>2]|0)+1;c[F>>2]=(c[F>>2]|0)+1}c[G>>2]=0;while(1){if((c[G>>2]|0)>=5)break;t=(_((c[q>>2]&65535)<<16>>16,b[(c[n>>2]|0)+(c[G>>2]<<1)>>1]|0)|0)>>15&65535;b[(c[n>>2]|0)+(c[G>>2]<<1)>>1]=t;c[G>>2]=(c[G>>2]|0)+1}b[K>>1]=(_(b[K>>1]|0,(c[w>>2]&65535)<<16>>16)|0)>>15;c[c[J>>2]>>2]=(c[c[J>>2]>>2]|0)+(((c[c[J>>2]>>2]>>16)*655|0)+((c[c[J>>2]>>2]&65535)*655>>16));t=Ge(c[c[J>>2]>>2]|0,((c[(c[z>>2]|0)+2316>>2]&65535)<<16>>16)*18<<8)|0;c[c[J>>2]>>2]=t;c[H>>2]=(c[c[J>>2]>>2]>>7)+1>>1;c[u>>2]=(c[u>>2]|0)+1}c[M>>2]=d+((c[(c[z>>2]|0)+2336>>2]|0)-16<<2);e=c[M>>2]|0;f=(c[z>>2]|0)+1284|0;a=e+64|0;do{c[e>>2]=c[f>>2];e=e+4|0;f=f+4|0}while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535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){y=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;y=y+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)f=-32768;else{f=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;f=f+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;f=(f+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else f=32767;if((f|0)<=32767){y=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;y=y+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){y=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;y=y+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)f=-32768;else{f=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;f=f+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;f=(f+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else f=32767;if((f|0)>=-32768){y=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;y=y+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){y=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;y=y+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((y+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)f=-32768;else{f=_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]>>16,(c[I+4>>2]&65535)<<16>>16)|0;f=f+((_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]&65535,(c[I+4>>2]&65535)<<16>>16)|0)>>16)|0;f=(f+(_(c[(c[M>>2]|0)+(16+(c[F>>2]|0)<<2)>>2]|0,(c[I+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else f=32767}else f=-32768}else f=32767;b[(c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2]>>15)+1>>1)|0)>>8}}else e=32767;b[(c[u>>2]|0)+(c[v>>2]<<1)>>1]=e;c[v>>2]=(c[v>>2]|0)+1}c[u>>2]=(c[u>>2]|0)+(c[r>>2]<<1);c[w>>2]=(c[w>>2]|0)+1}wg(c[l>>2]|0,c[m>>2]|0,a,c[r>>2]|0);wg(c[n>>2]|0,c[o>>2]|0,a+(c[r>>2]<<1)|0,c[r>>2]|0);na(c[t>>2]|0);i=x;return}function De(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Ee(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Fe(a,c){a=a|0;c=c|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+2|0;d=f;b[e>>1]=a;b[d>>1]=c;i=f;return ((b[e>>1]|0)>(b[d>>1]|0)?b[e>>1]|0:b[d>>1]|0)&65535|0}function Ge(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function He(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Ie(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+48|0;f=h+32|0;n=h+28|0;d=h+24|0;j=h+20|0;g=h+16|0;k=h+12|0;m=h+8|0;l=h+4|0;e=h;c[n>>2]=a;c[d>>2]=b;b=c[n>>2]|0;c[j>>2]=(Je((c[n>>2]|0)>0?b:0-b|0)|0)-1;c[m>>2]=c[n>>2]<>2];c[k>>2]=536870911/(c[m>>2]>>16|0)|0;c[e>>2]=c[k>>2]<<16;b=_(c[m>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=536870912-(b+((_(c[m>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))<<3;b=_(c[l>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=(c[e>>2]|0)+(b+((_(c[l>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))|0;c[e>>2]=b+(_(c[l>>2]|0,(c[k>>2]>>15)+1>>1)|0);c[g>>2]=61-(c[j>>2]|0)-(c[d>>2]|0);b=c[g>>2]|0;if((c[g>>2]|0)>0)if((b|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];n=c[f>>2]|0;i=h;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;i=h;return n|0}a=c[e>>2]|0;d=0-(c[g>>2]|0)|0;do if((-2147483648>>0-b|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>d|0)){b=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){b=2147483647>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>d|0)){b=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){b=-2147483648>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}while(0);c[f>>2]=b<<0-(c[g>>2]|0);n=c[f>>2]|0;i=h;return n|0}function Je(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function Ke(d,e){d=d|0;e=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if((c[h>>2]|0)<11469){c[p>>2]=11744256;c[m>>2]=(c[p>>2]|0)/(((c[h>>2]|0)>1?c[h>>2]|0:1)|0)|0;c[j>>2]=0;while(1){if((c[j>>2]|0)>=5)break a;q=(_(b[(c[l>>2]|0)+4+(c[j>>2]<<1)>>1]|0,(c[m>>2]&65535)<<16>>16)|0)>>10&65535;b[(c[l>>2]|0)+4+(c[j>>2]<<1)>>1]=q;c[j>>2]=(c[j>>2]|0)+1}}if((c[h>>2]|0)>15565){c[q>>2]=255016960;c[n>>2]=(c[q>>2]|0)/(((c[h>>2]|0)>1?c[h>>2]|0:1)|0)|0;c[j>>2]=0;while(1){if((c[j>>2]|0)>=5)break a;q=(_(b[(c[l>>2]|0)+4+(c[j>>2]<<1)>>1]|0,(c[n>>2]&65535)<<16>>16)|0)>>14&65535;b[(c[l>>2]|0)+4+(c[j>>2]<<1)>>1]=q;c[j>>2]=(c[j>>2]|0)+1}}}else{c[c[l>>2]>>2]=((c[(c[f>>2]|0)+2316>>2]&65535)<<16>>16)*18<<8;q=(c[l>>2]|0)+4|0;c[q>>2]=0;c[q+4>>2]=0;b[q+8>>1]=0}while(0);pj((c[l>>2]|0)+14|0,(c[g>>2]|0)+32+32|0,c[(c[f>>2]|0)+2340>>2]<<1|0)|0;b[(c[l>>2]|0)+68>>1]=c[(c[g>>2]|0)+136>>2];q=(c[l>>2]|0)+72|0;p=(c[g>>2]|0)+16+((c[(c[f>>2]|0)+2324>>2]|0)-2<<2)|0;c[q>>2]=c[p>>2];c[q+4>>2]=c[p+4>>2];c[(c[l>>2]|0)+88>>2]=c[(c[f>>2]|0)+2332>>2];c[(c[l>>2]|0)+84>>2]=c[(c[f>>2]|0)+2324>>2];i=r;return}function Le(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+48|0;f=r+40|0;g=r+36|0;h=r+32|0;o=r+28|0;l=r+24|0;k=r+20|0;p=r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>65536)break a;c[o>>2]=(c[o>>2]|0)+1}}}while(0);c[(c[p>>2]|0)+48>>2]=0;i=r;return}function Me(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}Ne(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function Ne(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=Je(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(Oe(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function Oe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function Pe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;d=i;i=i+80|0;g=d+68|0;f=d+64|0;e=d+32|0;h=d+16|0;j=d+8|0;k=d;c[g>>2]=a;c[f>>2]=b;Qe(e,c[f>>2]|0,8);Qe(h,e,4);Qe(j,h,2);Qe(k,j,1);Re(c[g>>2]|0,c[j>>2]|0,c[k>>2]|0,30015);Re(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,29863);Re(c[g>>2]|0,c[e>>2]|0,c[h>>2]|0,29711);Re(c[g>>2]|0,c[c[f>>2]>>2]|0,c[e>>2]|0,29559);Re(c[g>>2]|0,c[(c[f>>2]|0)+8>>2]|0,c[e+4>>2]|0,29559);Re(c[g>>2]|0,c[e+8>>2]|0,c[h+4>>2]|0,29711);Re(c[g>>2]|0,c[(c[f>>2]|0)+16>>2]|0,c[e+8>>2]|0,29559);Re(c[g>>2]|0,c[(c[f>>2]|0)+24>>2]|0,c[e+12>>2]|0,29559);Re(c[g>>2]|0,c[h+8>>2]|0,c[j+4>>2]|0,29863);Re(c[g>>2]|0,c[e+16>>2]|0,c[h+8>>2]|0,29711);Re(c[g>>2]|0,c[(c[f>>2]|0)+32>>2]|0,c[e+16>>2]|0,29559);Re(c[g>>2]|0,c[(c[f>>2]|0)+40>>2]|0,c[e+20>>2]|0,29559);Re(c[g>>2]|0,c[e+24>>2]|0,c[h+12>>2]|0,29711);Re(c[g>>2]|0,c[(c[f>>2]|0)+48>>2]|0,c[e+24>>2]|0,29559);Re(c[g>>2]|0,c[(c[f>>2]|0)+56>>2]|0,c[e+28>>2]|0,29559);i=d;return}function Qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;e=j+12|0;f=j+8|0;g=j+4|0;h=j;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;c[h>>2]=0;while(1){if((c[h>>2]|0)>=(c[g>>2]|0))break;c[(c[e>>2]|0)+(c[h>>2]<<2)>>2]=(c[(c[f>>2]|0)+(c[h>>2]<<1<<2)>>2]|0)+(c[(c[f>>2]|0)+((c[h>>2]<<1)+1<<2)>>2]|0);c[h>>2]=(c[h>>2]|0)+1}i=j;return}function Re(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;g=l+12|0;h=l+8|0;j=l+4|0;k=l;c[g>>2]=a;c[h>>2]=b;c[j>>2]=e;c[k>>2]=f;if((c[j>>2]|0)<=0){i=l;return}qc(c[g>>2]|0,c[h>>2]|0,(c[k>>2]|0)+(d[30167+(c[j>>2]|0)>>0]|0)|0,8);i=l;return}function Se(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;f=i;i=i+48|0;j=f+8|0;h=f+4|0;m=f;l=f+40|0;k=f+32|0;g=f+16|0;c[j>>2]=a;c[h>>2]=d;c[m>>2]=e;Te(l,l+2|0,c[h>>2]|0,c[m>>2]|0,30015);Te(k,k+2|0,c[h>>2]|0,b[l>>1]|0,29863);Te(g,g+2|0,c[h>>2]|0,b[k>>1]|0,29711);Te(c[j>>2]|0,(c[j>>2]|0)+2|0,c[h>>2]|0,b[g>>1]|0,29559);Te((c[j>>2]|0)+4|0,(c[j>>2]|0)+6|0,c[h>>2]|0,b[g+2>>1]|0,29559);Te(g+4|0,g+6|0,c[h>>2]|0,b[k+2>>1]|0,29711);Te((c[j>>2]|0)+8|0,(c[j>>2]|0)+10|0,c[h>>2]|0,b[g+4>>1]|0,29559);Te((c[j>>2]|0)+12|0,(c[j>>2]|0)+14|0,c[h>>2]|0,b[g+6>>1]|0,29559);Te(k+4|0,k+6|0,c[h>>2]|0,b[l+2>>1]|0,29863);Te(g+8|0,g+10|0,c[h>>2]|0,b[k+4>>1]|0,29711);Te((c[j>>2]|0)+16|0,(c[j>>2]|0)+18|0,c[h>>2]|0,b[g+8>>1]|0,29559);Te((c[j>>2]|0)+20|0,(c[j>>2]|0)+22|0,c[h>>2]|0,b[g+10>>1]|0,29559);Te(g+12|0,g+14|0,c[h>>2]|0,b[k+6>>1]|0,29711);Te((c[j>>2]|0)+24|0,(c[j>>2]|0)+26|0,c[h>>2]|0,b[g+12>>1]|0,29559);Te((c[j>>2]|0)+28|0,(c[j>>2]|0)+30|0,c[h>>2]|0,b[g+14>>1]|0,29559);i=f;return}function Te(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+32|0;j=o+16|0;k=o+12|0;l=o+8|0;m=o+4|0;n=o;c[j>>2]=a;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[n>>2]=h;if((c[m>>2]|0)>0){h=(ec(c[l>>2]|0,(c[n>>2]|0)+(d[30167+(c[m>>2]|0)>>0]|0)|0,8)|0)&65535;b[c[j>>2]>>1]=h;b[c[k>>2]>>1]=(c[m>>2]|0)-(b[c[j>>2]>>1]|0);i=o;return}else{b[c[j>>2]>>1]=0;b[c[k>>2]>>1]=0;i=o;return}}function Ue(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;g=i;i=i+16|0;d=g+8|0;e=g+4|0;f=g;c[d>>2]=a;c[f>>2]=0;a=c[d>>2]|0;b=a+112|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(b|0));c[e>>2]=0;while(1){if((c[e>>2]|0)>=4)break;b=Ve(50/((c[e>>2]|0)+1|0)|0,1)|0;c[(c[d>>2]|0)+92+(c[e>>2]<<2)>>2]=b;c[e>>2]=(c[e>>2]|0)+1}c[e>>2]=0;while(1){if((c[e>>2]|0)>=4)break;c[(c[d>>2]|0)+60+(c[e>>2]<<2)>>2]=(c[(c[d>>2]|0)+92+(c[e>>2]<<2)>>2]|0)*100;c[(c[d>>2]|0)+76+(c[e>>2]<<2)>>2]=2147483647/(c[(c[d>>2]|0)+60+(c[e>>2]<<2)>>2]|0)|0;c[e>>2]=(c[e>>2]|0)+1}c[(c[d>>2]|0)+108>>2]=15;c[e>>2]=0;while(1){if((c[e>>2]|0)>=4)break;c[(c[d>>2]|0)+40+(c[e>>2]<<2)>>2]=25600;c[e>>2]=(c[e>>2]|0)+1}i=g;return c[f>>2]|0}function Ve(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function We(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;C=i;i=i+144|0;s=C+132|0;F=C+128|0;v=C+124|0;q=C+120|0;p=C+116|0;E=C+112|0;D=C+108|0;k=C+104|0;h=C+100|0;j=C+96|0;w=C+92|0;l=C+88|0;x=C+84|0;m=C+80|0;r=C+76|0;A=C+72|0;e=C+136|0;o=C+56|0;u=C+40|0;B=C+36|0;n=C+32|0;g=C+16|0;z=C+8|0;y=C+4|0;t=C;c[s>>2]=a;c[F>>2]=d;c[z>>2]=0;c[y>>2]=(c[s>>2]|0)+32;c[E>>2]=c[(c[s>>2]|0)+4608>>2]>>1;c[D>>2]=c[(c[s>>2]|0)+4608>>2]>>2;c[k>>2]=c[(c[s>>2]|0)+4608>>2]>>3;c[g>>2]=0;c[g+4>>2]=(c[k>>2]|0)+(c[D>>2]|0);c[g+8>>2]=(c[g+4>>2]|0)+(c[k>>2]|0);c[g+12>>2]=(c[g+8>>2]|0)+(c[D>>2]|0);a=(c[g+12>>2]|0)+(c[E>>2]|0)|0;c[t>>2]=ia()|0;f=i;i=i+((1*(a<<1)|0)+15&-16)|0;Mf(c[F>>2]|0,c[y>>2]|0,f,f+(c[g+12>>2]<<1)|0,c[(c[s>>2]|0)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else{if(d+(a>>1)&-2147483648|0)d=2147483647;else d=(c[o+(c[x>>2]<<2)>>2]|0)+(c[r>>2]>>1)|0;c[o+(c[x>>2]<<2)>>2]=d}c[j>>2]=(c[j>>2]|0)+(c[h>>2]|0);c[m>>2]=(c[m>>2]|0)+1}c[(c[y>>2]|0)+24+(c[x>>2]<<2)>>2]=c[r>>2];c[x>>2]=(c[x>>2]|0)+1}Ye(o,c[y>>2]|0);c[r>>2]=0;c[p>>2]=0;c[x>>2]=0;while(1){if((c[x>>2]|0)>=4)break;c[B>>2]=(c[o+(c[x>>2]<<2)>>2]|0)-(c[(c[y>>2]|0)+60+(c[x>>2]<<2)>>2]|0);d=c[x>>2]|0;if((c[B>>2]|0)>0){a=c[o+(c[x>>2]<<2)>>2]|0;if(!(c[o+(d<<2)>>2]&-8388608))c[u+(c[x>>2]<<2)>>2]=(a<<8|0)/((c[(c[y>>2]|0)+60+(c[x>>2]<<2)>>2]|0)+1|0)|0;else c[u+(c[x>>2]<<2)>>2]=(a|0)/((c[(c[y>>2]|0)+60+(c[x>>2]<<2)>>2]>>8)+1|0)|0;c[w>>2]=(Sf(c[u+(c[x>>2]<<2)>>2]|0)|0)-1024;c[r>>2]=(c[r>>2]|0)+(_((c[w>>2]&65535)<<16>>16,(c[w>>2]&65535)<<16>>16)|0);if((c[B>>2]|0)<1048576){E=(_e(c[B>>2]|0)|0)<<6>>16;E=_(E,(c[w>>2]&65535)<<16>>16)|0;F=(_e(c[B>>2]|0)|0)<<6&65535;c[w>>2]=E+((_(F,(c[w>>2]&65535)<<16>>16)|0)>>16)}F=_(c[17944+(c[x>>2]<<2)>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;c[p>>2]=(c[p>>2]|0)+(F+((_(c[17944+(c[x>>2]<<2)>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16))}else c[u+(d<<2)>>2]=256;c[x>>2]=(c[x>>2]|0)+1}c[r>>2]=(c[r>>2]|0)/4|0;c[q>>2]=((_e(c[r>>2]|0)|0)*3&65535)<<16>>16;c[v>>2]=tg(0+(((c[q>>2]&65535)<<16>>16)*45e3>>16)-128|0)|0;F=(tg(c[p>>2]|0)|0)-16384<<1;c[(c[s>>2]|0)+4744>>2]=F;c[B>>2]=0;c[x>>2]=0;while(1){if((c[x>>2]|0)>=4)break;F=_((c[x>>2]|0)+1|0,(c[o+(c[x>>2]<<2)>>2]|0)-(c[(c[y>>2]|0)+60+(c[x>>2]<<2)>>2]|0)>>4)|0;c[B>>2]=(c[B>>2]|0)+F;c[x>>2]=(c[x>>2]|0)+1}if((c[B>>2]|0)>0){if((c[B>>2]|0)<32768){d=c[B>>2]|0;if((c[(c[s>>2]|0)+4608>>2]|0)==((c[(c[s>>2]|0)+4600>>2]|0)*10|0)){if((d|0)>32767)d=32767;else d=(c[B>>2]|0)<-32768?-32768:c[B>>2]|0;c[B>>2]=d<<16}else{if((d|0)>65535)d=65535;else d=(c[B>>2]|0)<-65536?-65536:c[B>>2]|0;c[B>>2]=d<<15}c[B>>2]=_e(c[B>>2]|0)|0;F=_(32768+(c[B>>2]|0)>>16,(c[v>>2]&65535)<<16>>16)|0;c[v>>2]=F+((_(32768+(c[B>>2]|0)&65535,(c[v>>2]&65535)<<16>>16)|0)>>16)}}else c[v>>2]=c[v>>2]>>1;F=Xe(c[v>>2]>>7,255)|0;c[(c[s>>2]|0)+4556>>2]=F;F=_(c[v>>2]>>16,(c[v>>2]&65535)<<16>>16)|0;c[A>>2]=0+((F+((_(c[v>>2]&65535,(c[v>>2]&65535)<<16>>16)|0)>>16)&65535)<<16>>16<<12>>16);if((c[(c[s>>2]|0)+4608>>2]|0)==((c[(c[s>>2]|0)+4600>>2]|0)*10|0))c[A>>2]=c[A>>2]>>1;c[x>>2]=0;while(1){if((c[x>>2]|0)>=4)break;F=_((c[u+(c[x>>2]<<2)>>2]|0)-(c[(c[y>>2]|0)+40+(c[x>>2]<<2)>>2]|0)>>16,(c[A>>2]&65535)<<16>>16)|0;F=(c[(c[y>>2]|0)+40+(c[x>>2]<<2)>>2]|0)+(F+((_((c[u+(c[x>>2]<<2)>>2]|0)-(c[(c[y>>2]|0)+40+(c[x>>2]<<2)>>2]|0)&65535,(c[A>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[y>>2]|0)+40+(c[x>>2]<<2)>>2]=F;c[w>>2]=((Sf(c[(c[y>>2]|0)+40+(c[x>>2]<<2)>>2]|0)|0)-1024|0)*3;F=tg((c[w>>2]|0)-2048>>4)|0;c[(c[s>>2]|0)+4728+(c[x>>2]<<2)>>2]=F;c[x>>2]=(c[x>>2]|0)+1}F=c[z>>2]|0;na(c[t>>2]|0);i=C;return F|0}function Xe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;d=m+28|0;e=m+24|0;h=m+20|0;k=m+16|0;l=m+12|0;g=m+8|0;f=m+4|0;j=m;c[d>>2]=a;c[e>>2]=b;if((c[(c[e>>2]|0)+108>>2]|0)<1e3)c[j>>2]=32767/((c[(c[e>>2]|0)+108>>2]>>4)+1|0)|0;else c[j>>2]=0;c[h>>2]=0;while(1){if((c[h>>2]|0)>=4)break;c[k>>2]=c[(c[e>>2]|0)+60+(c[h>>2]<<2)>>2];if((c[(c[d>>2]|0)+(c[h>>2]<<2)>>2]|0)+(c[(c[e>>2]|0)+92+(c[h>>2]<<2)>>2]|0)&-2147483648|0)a=2147483647;else a=(c[(c[d>>2]|0)+(c[h>>2]<<2)>>2]|0)+(c[(c[e>>2]|0)+92+(c[h>>2]<<2)>>2]|0)|0;c[l>>2]=a;c[g>>2]=2147483647/(c[l>>2]|0)|0;do if((c[l>>2]|0)<=(c[k>>2]<<3|0))if((c[l>>2]|0)<(c[k>>2]|0)){c[f>>2]=1024;break}else{a=_(c[g>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;a=a+((_(c[g>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16)|0;a=a+(_(c[g>>2]|0,(c[k>>2]>>15)+1>>1)|0)>>16<<11;b=_(c[g>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=b+((_(c[g>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16)|0;c[f>>2]=a+((b+(_(c[g>>2]|0,(c[k>>2]>>15)+1>>1)|0)&65535)<<11>>16);break}else c[f>>2]=128;while(0);c[f>>2]=Ze(c[f>>2]|0,c[j>>2]|0)|0;b=_((c[g>>2]|0)-(c[(c[e>>2]|0)+76+(c[h>>2]<<2)>>2]|0)>>16,(c[f>>2]&65535)<<16>>16)|0;b=(c[(c[e>>2]|0)+76+(c[h>>2]<<2)>>2]|0)+(b+((_((c[g>>2]|0)-(c[(c[e>>2]|0)+76+(c[h>>2]<<2)>>2]|0)&65535,(c[f>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[e>>2]|0)+76+(c[h>>2]<<2)>>2]=b;c[k>>2]=2147483647/(c[(c[e>>2]|0)+76+(c[h>>2]<<2)>>2]|0)|0;c[k>>2]=(c[k>>2]|0)<16777215?c[k>>2]|0:16777215;c[(c[e>>2]|0)+60+(c[h>>2]<<2)>>2]=c[k>>2];c[h>>2]=(c[h>>2]|0)+1}l=(c[e>>2]|0)+108|0;c[l>>2]=(c[l>>2]|0)+1;i=m;return}function Ze(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function _e(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}$e(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function $e(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=af(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(bf(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function af(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function bf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function cf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;h=i;i=i+16|0;f=h+12|0;d=h+8|0;g=h+4|0;e=h;c[f>>2]=a;c[d>>2]=b;c[g>>2]=c[(c[f>>2]|0)+4600>>2];c[e>>2]=((c[g>>2]&65535)<<16>>16)*1e3;if(!(c[e>>2]|0)){b=c[f>>2]|0;if((c[(c[f>>2]|0)+4596>>2]|0)<(c[(c[f>>2]|0)+4580>>2]|0))b=c[b+4596>>2]|0;else b=c[b+4580>>2]|0;c[e>>2]=b;c[g>>2]=(c[e>>2]|0)/1e3|0;g=c[g>>2]|0;i=h;return g|0}if(((c[e>>2]|0)<=(c[(c[f>>2]|0)+4580>>2]|0)?(c[e>>2]|0)<=(c[(c[f>>2]|0)+4588>>2]|0):0)?(c[e>>2]|0)>=(c[(c[f>>2]|0)+4592>>2]|0):0){if((c[(c[f>>2]|0)+16+8>>2]|0)>=256)c[(c[f>>2]|0)+16+12>>2]=0;if((c[(c[f>>2]|0)+4560>>2]|0)==0?(c[(c[d>>2]|0)+60>>2]|0)==0:0){g=c[g>>2]|0;i=h;return g|0}b=c[f>>2]|0;if((((c[(c[f>>2]|0)+4600>>2]&65535)<<16>>16)*1e3|0)>(c[(c[f>>2]|0)+4596>>2]|0)){if(!(c[b+16+12>>2]|0)){c[(c[f>>2]|0)+16+8>>2]=256;e=(c[f>>2]|0)+16|0;c[e>>2]=0;c[e+4>>2]=0}b=(c[f>>2]|0)+16|0;if(c[(c[d>>2]|0)+60>>2]|0){c[b+12>>2]=0;c[g>>2]=(c[(c[f>>2]|0)+4600>>2]|0)==16?12:8;g=c[g>>2]|0;i=h;return g|0}if((c[b+8>>2]|0)<=0){c[(c[d>>2]|0)+84>>2]=1;f=(c[d>>2]|0)+52|0;c[f>>2]=(c[f>>2]|0)-(((c[(c[d>>2]|0)+52>>2]|0)*5|0)/((c[(c[d>>2]|0)+24>>2]|0)+5|0)|0);g=c[g>>2]|0;i=h;return g|0}else{c[(c[f>>2]|0)+16+12>>2]=-2;g=c[g>>2]|0;i=h;return g|0}}if((((c[b+4600>>2]&65535)<<16>>16)*1e3|0)>=(c[(c[f>>2]|0)+4596>>2]|0)){if((c[(c[f>>2]|0)+16+12>>2]|0)>=0){g=c[g>>2]|0;i=h;return g|0}c[(c[f>>2]|0)+16+12>>2]=1;g=c[g>>2]|0;i=h;return g|0}b=c[f>>2]|0;if(c[(c[d>>2]|0)+60>>2]|0){c[g>>2]=(c[b+4600>>2]|0)==8?12:16;c[(c[f>>2]|0)+16+8>>2]=0;e=(c[f>>2]|0)+16|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+16+12>>2]=1;g=c[g>>2]|0;i=h;return g|0}if(!(c[b+16+12>>2]|0)){c[(c[d>>2]|0)+84>>2]=1;f=(c[d>>2]|0)+52|0;c[f>>2]=(c[f>>2]|0)-(((c[(c[d>>2]|0)+52>>2]|0)*5|0)/((c[(c[d>>2]|0)+24>>2]|0)+5|0)|0);g=c[g>>2]|0;i=h;return g|0}else{c[(c[f>>2]|0)+16+12>>2]=1;g=c[g>>2]|0;i=h;return g|0}}c[e>>2]=c[(c[f>>2]|0)+4580>>2];if((c[e>>2]|0)<(c[(c[f>>2]|0)+4588>>2]|0))b=c[e>>2]|0;else b=c[(c[f>>2]|0)+4588>>2]|0;c[e>>2]=b;if((c[e>>2]|0)>(c[(c[f>>2]|0)+4592>>2]|0))b=c[e>>2]|0;else b=c[(c[f>>2]|0)+4592>>2]|0;c[e>>2]=b;c[g>>2]=(c[e>>2]|0)/1e3|0;g=c[g>>2]|0;i=h;return g|0}function df(d,e,f,g,h,j,k,l,m){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;M=i;i=i+112|0;E=M+96|0;F=M+92|0;n=M+88|0;G=M+84|0;o=M+80|0;p=M+76|0;q=M+72|0;H=M+68|0;K=M+60|0;L=M+56|0;u=M+52|0;D=M+100|0;v=M+48|0;J=M+44|0;t=M+40|0;s=M+36|0;r=M+32|0;B=M+28|0;A=M+24|0;z=M+20|0;C=M+16|0;I=M+12|0;y=M+8|0;w=M+4|0;x=M;c[E>>2]=d;c[F>>2]=e;c[n>>2]=f;c[G>>2]=g;c[o>>2]=h;c[p>>2]=j;c[q>>2]=k;c[H>>2]=l;c[M+64>>2]=m;c[z>>2]=2147483647;c[I>>2]=0;c[L>>2]=0;while(1){if((c[L>>2]|0)>=3)break;c[x>>2]=51;c[v>>2]=c[17632+(c[L>>2]<<2)>>2];c[J>>2]=c[17644+(c[L>>2]<<2)>>2];c[t>>2]=c[17656+(c[L>>2]<<2)>>2];c[u>>2]=a[27263+(c[L>>2]|0)>>0];c[r>>2]=c[o>>2];c[s>>2]=c[E>>2];c[A>>2]=0;c[C>>2]=c[c[G>>2]>>2];c[K>>2]=0;while(1){if((c[K>>2]|0)>=(c[H>>2]|0))break;g=Wf(5333-(c[C>>2]|0)+896|0)|0;c[y>>2]=g-(c[x>>2]|0);ef(D+(c[K>>2]|0)|0,B,w,c[s>>2]|0,c[r>>2]|0,c[J>>2]|0,c[t>>2]|0,c[v>>2]|0,c[p>>2]|0,c[y>>2]|0,c[u>>2]|0);if((c[A>>2]|0)+(c[B>>2]|0)&-2147483648|0)d=2147483647;else d=(c[A>>2]|0)+(c[B>>2]|0)|0;c[A>>2]=d;g=c[C>>2]|0;if(0>(g+(Sf((c[x>>2]|0)+(c[w>>2]|0)|0)|0)-896|0))d=0;else{d=c[C>>2]|0;d=d+(Sf((c[x>>2]|0)+(c[w>>2]|0)|0)|0)-896|0}c[C>>2]=d;c[s>>2]=(c[s>>2]|0)+10;c[r>>2]=(c[r>>2]|0)+100;c[K>>2]=(c[K>>2]|0)+1}c[A>>2]=2147483646<(c[A>>2]|0)?2147483646:c[A>>2]|0;if((c[A>>2]|0)<(c[z>>2]|0)){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F>>2]=c[F>>2]<<1;H=_(c[(c[v>>2]|0)+72>>2]>>16,b[B+6>>1]|0)|0;c[F>>2]=(c[F>>2]|0)+(H+((_(c[(c[v>>2]|0)+72>>2]&65535,b[B+6>>1]|0)|0)>>16));H=_(c[F>>2]>>16,b[B+6>>1]|0)|0;c[E>>2]=(c[E>>2]|0)+(H+((_(c[F>>2]&65535,b[B+6>>1]|0)|0)>>16));H=_(c[(c[v>>2]|0)+96>>2]>>16,b[B+8>>1]|0)|0;c[F>>2]=H+((_(c[(c[v>>2]|0)+96>>2]&65535,b[B+8>>1]|0)|0)>>16);H=_(c[F>>2]>>16,b[B+8>>1]|0)|0;c[E>>2]=(c[E>>2]|0)+(H+((_(c[F>>2]&65535,b[B+8>>1]|0)|0)>>16));if((c[E>>2]|0)<(c[c[r>>2]>>2]|0)){c[c[r>>2]>>2]=c[E>>2];a[c[q>>2]>>0]=c[D>>2];c[c[t>>2]>>2]=c[C>>2]}c[A>>2]=(c[A>>2]|0)+5;c[D>>2]=(c[D>>2]|0)+1}i=G;return}function ff(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;j=i;i=i+32|0;k=j+20|0;f=j+16|0;d=j+12|0;e=j+8|0;g=j+4|0;h=j;c[k>>2]=b;c[h>>2]=c[k>>2];if((a[(c[h>>2]|0)+4565>>0]|0)!=2){i=j;return}c[d>>2]=((c[(c[h>>2]|0)+4600>>2]|0)*1e3<<16|0)/(c[(c[h>>2]|0)+4568>>2]|0)|0;c[e>>2]=(Sf(c[d>>2]|0)|0)-2048;c[f>>2]=c[(c[h>>2]|0)+4728>>2];l=c[e>>2]|0;b=_(0-(c[f>>2]|0)<<2>>16,(c[f>>2]&65535)<<16>>16)|0;b=b+((_(0-(c[f>>2]|0)<<2&65535,(c[f>>2]&65535)<<16>>16)|0)>>16)>>16;d=c[e>>2]|0;d=_(b,(d-((Sf(3932160)|0)-2048)&65535)<<16>>16)|0;b=_(0-(c[f>>2]|0)<<2>>16,(c[f>>2]&65535)<<16>>16)|0;b=b+((_(0-(c[f>>2]|0)<<2&65535,(c[f>>2]&65535)<<16>>16)|0)>>16)&65535;k=c[e>>2]|0;c[e>>2]=l+(d+((_(b,(k-((Sf(3932160)|0)-2048)&65535)<<16>>16)|0)>>16));c[g>>2]=(c[e>>2]|0)-(c[(c[h>>2]|0)+8>>2]>>8);if((c[g>>2]|0)<0)c[g>>2]=(c[g>>2]|0)*3;if((c[g>>2]|0)>51)d=51;else d=(c[g>>2]|0)<-51?-51:c[g>>2]|0;c[g>>2]=d;l=((_((c[(c[h>>2]|0)+4556>>2]&65535)<<16>>16,(c[g>>2]&65535)<<16>>16)|0)>>16)*6554|0;l=(c[(c[h>>2]|0)+8>>2]|0)+(l+(((_((c[(c[h>>2]|0)+4556>>2]&65535)<<16>>16,(c[g>>2]&65535)<<16>>16)|0)&65535)*6554>>16))|0;c[(c[h>>2]|0)+8>>2]=l;l=(Sf(60)|0)<<8;l=(l|0)>((Sf(100)|0)<<8|0);d=c[(c[h>>2]|0)+8>>2]|0;do if(l){if((d|0)>((Sf(60)|0)<<8|0)){d=(Sf(60)|0)<<8;break}l=c[(c[h>>2]|0)+8>>2]|0;if((l|0)<((Sf(100)|0)<<8|0)){d=(Sf(100)|0)<<8;break}else{d=c[(c[h>>2]|0)+8>>2]|0;break}}else{if((d|0)>((Sf(100)|0)<<8|0)){d=(Sf(100)|0)<<8;break}l=c[(c[h>>2]|0)+8>>2]|0;if((l|0)<((Sf(60)|0)<<8|0)){d=(Sf(60)|0)<<8;break}else{d=c[(c[h>>2]|0)+8>>2]|0;break}}while(0);c[(c[h>>2]|0)+8>>2]=d;i=j;return}function gf(f,g,h,j,k,l,m){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;L=i;i=i+288|0;n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0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}jf(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function jf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=kf(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(lf(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function kf(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function lf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function mf(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+48|0;j=t+36|0;k=t+32|0;l=t+28|0;m=t+24|0;n=t+20|0;p=t+16|0;q=t+12|0;o=t+8|0;s=t+4|0;r=t;c[j>>2]=a;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[n>>2]=h;c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[m>>2]|0))break;c[r>>2]=0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[n>>2]|0))break;f=b[(c[k>>2]|0)+(c[q>>2]<<1)>>1]|0;e=c[l>>2]|0;c[l>>2]=e+1;c[o>>2]=f-(d[e>>0]<<7);c[s>>2]=_((c[o>>2]&65535)<<16>>16,(c[o>>2]&65535)<<16>>16)|0;e=b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]|0;f=c[l>>2]|0;c[l>>2]=f+1;c[o>>2]=e-(d[f>>0]<<7);c[s>>2]=(c[s>>2]|0)+(_((c[o>>2]&65535)<<16>>16,(c[o>>2]&65535)<<16>>16)|0);c[r>>2]=(c[r>>2]|0)+(c[s>>2]>>4);c[q>>2]=(c[q>>2]|0)+2}c[(c[j>>2]|0)+(c[p>>2]<<2)>>2]=c[r>>2];c[p>>2]=(c[p>>2]|0)+1}i=t;return}function nf(e,f,g,h){e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=i;i=i+32|0;j=p+20|0;k=p+16|0;l=p+12|0;q=p+8|0;o=p+4|0;n=p+24|0;m=p;c[j>>2]=e;c[k>>2]=f;c[l>>2]=g;c[q>>2]=h;g=(_(c[q>>2]|0,b[(c[l>>2]|0)+2>>1]|0)|0)/2|0;c[m>>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|0;M=aa+252|0;V=aa+248|0;J=aa+232|0;G=aa+384|0;W=aa+360|0;z=aa+200|0;B=aa+184|0;A=aa+168|0;Z=aa+160|0;R=aa+80|0;T=aa;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=j;c[v>>2]=k;c[p>>2]=l;b[w>>1]=m;c[x>>2]=n;b[y>>1]=o;c[E>>2]=-10;while(1){if((c[E>>2]|0)>9)break;c[Q>>2]=c[E>>2]<<10;c[S>>2]=(c[Q>>2]|0)+1024;do if((c[E>>2]|0)<=0){if(!(c[E>>2]|0)){c[S>>2]=(c[S>>2]|0)-102;break}f=(c[E>>2]|0)==-1;c[Q>>2]=(c[Q>>2]|0)+102;if(!f)c[S>>2]=(c[S>>2]|0)+102}else{c[Q>>2]=(c[Q>>2]|0)-102;c[S>>2]=(c[S>>2]|0)-102}while(0);f=_(c[Q>>2]>>16,(c[p>>2]&65535)<<16>>16)|0;f=f+((_(c[Q>>2]&65535,(c[p>>2]&65535)<<16>>16)|0)>>16)|0;c[R+((c[E>>2]|0)+10<<2)>>2]=f;f=_(c[S>>2]>>16,(c[p>>2]&65535)<<16>>16)|0;f=f+((_(c[S>>2]&65535,(c[p>>2]&65535)<<16>>16)|0)>>16)|0;c[T+((c[E>>2]|0)+10<<2)>>2]=f;c[E>>2]=(c[E>>2]|0)+1}c[P>>2]=1;c[z>>2]=0;b[W>>1]=0;c[E>>2]=(b[y>>1]|0)-1;a:while(1){c[Z>>2]=(c[v>>2]|0)+(b[(c[u>>2]|0)+(c[E>>2]<<1)>>1]|0);c[V>>2]=d[(c[t>>2]|0)+(c[E>>2]|0)>>0]<<8;c[F>>2]=b[(c[r>>2]|0)+(c[E>>2]<<1)>>1];c[L>>2]=0;while(1){if((c[L>>2]|0)>=(c[P>>2]|0))break;f=_(c[V>>2]>>16,b[W+(c[L>>2]<<1)>>1]|0)|0;c[U>>2]=f+((_(c[V>>2]&65535,b[W+(c[L>>2]<<1)>>1]|0)|0)>>16);c[$>>2]=(c[F>>2]|0)-(c[U>>2]|0);f=_(b[w>>1]>>16,(c[$>>2]&65535)<<16>>16)|0;c[K>>2]=f+((_(b[w>>1]&65535,(c[$>>2]&65535)<<16>>16)|0)>>16);if((c[K>>2]|0)>9)p=9;else p=(c[K>>2]|0)<-10?-10:c[K>>2]|0;c[K>>2]=p;a[G+(c[L>>2]<<4)+(c[E>>2]|0)>>0]=c[K>>2];c[Q>>2]=c[R+((c[K>>2]|0)+10<<2)>>2];c[S>>2]=c[T+((c[K>>2]|0)+10<<2)>>2];c[Q>>2]=(c[Q>>2]|0)+(c[U>>2]|0);c[S>>2]=(c[S>>2]|0)+(c[U>>2]|0);b[W+(c[L>>2]<<1)>>1]=c[Q>>2];b[W+((c[L>>2]|0)+(c[P>>2]|0)<<1)>>1]=c[S>>2];j=c[K>>2]|0;do if(((c[K>>2]|0)+1|0)>=4){p=c[K>>2]|0;if((j+1|0)==4){c[X>>2]=d[(c[Z>>2]|0)+(p+4)>>0];c[Y>>2]=280;break}else{c[X>>2]=108+(((p&65535)<<16>>16)*43|0);c[Y>>2]=(c[X>>2]|0)+43;break}}else{p=c[K>>2]|0;if((j|0)>-4){c[X>>2]=d[(c[Z>>2]|0)+(p+4)>>0];c[Y>>2]=d[(c[Z>>2]|0)+((c[K>>2]|0)+1+4)>>0];break}if((p|0)==-4){c[X>>2]=280;c[Y>>2]=d[(c[Z>>2]|0)+((c[K>>2]|0)+1+4)>>0];break}else{c[X>>2]=108+(_(-43,(c[K>>2]&65535)<<16>>16)|0);c[Y>>2]=(c[X>>2]|0)-43;break}}while(0);c[C>>2]=c[z+(c[L>>2]<<2)>>2];c[D>>2]=(c[F>>2]|0)-(c[Q>>2]|0);f=_((c[D>>2]&65535)<<16>>16,(c[D>>2]&65535)<<16>>16)|0;f=(c[C>>2]|0)+(_(f,b[(c[s>>2]|0)+(c[E>>2]<<1)>>1]|0)|0)|0;f=f+(_((c[x>>2]&65535)<<16>>16,(c[X>>2]&65535)<<16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c[L>>2]|0)+1}c[L>>2]=0;while(1){if((c[L>>2]|0)>=(b[y>>1]|0))break;a[(c[q>>2]|0)+(c[L>>2]|0)>>0]=a[G+((c[K>>2]&3)<<4)+(c[L>>2]|0)>>0]|0;c[L>>2]=(c[L>>2]|0)+1}$=c[q>>2]|0;a[$>>0]=(a[$>>0]|0)+(c[K>>2]>>2);i=aa;return c[N>>2]|0}function pf(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+128|0;h=t+28|0;j=t+24|0;k=t+20|0;l=t+16|0;o=t+12|0;n=t+8|0;m=t+4|0;p=t;q=t+96|0;s=t+64|0;r=t+32|0;c[h>>2]=d;c[j>>2]=e;c[k>>2]=f;c[l>>2]=g;d=_(-5,(c[(c[h>>2]|0)+4556>>2]&65535)<<16>>16)|0;c[m>>2]=3146+(d+(((c[(c[h>>2]|0)+4556>>2]&65535)<<16>>16)*59246>>16));if((c[(c[h>>2]|0)+4604>>2]|0)==2)c[m>>2]=(c[m>>2]|0)+(c[m>>2]>>1);fg(s,c[k>>2]|0,c[(c[h>>2]|0)+4664>>2]|0);if((c[(c[h>>2]|0)+4656>>2]|0)==1)e=(a[(c[h>>2]|0)+4768+31>>0]|0)<4;else e=0;c[n>>2]=e&1;a:do if(c[n>>2]|0){de(q,c[l>>2]|0,c[k>>2]|0,a[(c[h>>2]|0)+4768+31>>0]|0,c[(c[h>>2]|0)+4664>>2]|0);fg(r,q,c[(c[h>>2]|0)+4664>>2]|0);c[p>>2]=(_(a[(c[h>>2]|0)+4768+31>>0]<<16>>16,a[(c[h>>2]|0)+4768+31>>0]<<16>>16)|0)<<11;c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[(c[h>>2]|0)+4664>>2]|0))break a;d=_(b[r+(c[o>>2]<<1)>>1]>>16,(c[p>>2]&65535)<<16>>16)|0;d=(b[s+(c[o>>2]<<1)>>1]>>1)+(d+((_(b[r+(c[o>>2]<<1)>>1]&65535,(c[p>>2]&65535)<<16>>16)|0)>>16))&65535;b[s+(c[o>>2]<<1)>>1]=d;c[o>>2]=(c[o>>2]|0)+1}}while(0);gf((c[h>>2]|0)+4768+8|0,c[k>>2]|0,c[(c[h>>2]|0)+4724>>2]|0,s,c[m>>2]|0,c[(c[h>>2]|0)+4692>>2]|0,a[(c[h>>2]|0)+4768+29>>0]|0)|0;ag((c[j>>2]|0)+32|0,c[k>>2]|0,c[(c[h>>2]|0)+4664>>2]|0);if(c[n>>2]|0){de(q,c[l>>2]|0,c[k>>2]|0,a[(c[h>>2]|0)+4768+31>>0]|0,c[(c[h>>2]|0)+4664>>2]|0);ag(c[j>>2]|0,q,c[(c[h>>2]|0)+4664>>2]|0);i=t;return}else{pj(c[j>>2]|0,(c[j>>2]|0)+32|0,c[(c[h>>2]|0)+4664>>2]<<1|0)|0;i=t;return}}function qf(d,e,f,g,h,j,k,l,m,n,o){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0;V=i;i=i+144|0;J=V+128|0;p=V+124|0;M=V+120|0;w=V+116|0;x=V+112|0;y=V+108|0;z=V+104|0;r=V+100|0;A=V+96|0;F=V+92|0;K=V+88|0;O=V+84|0;v=V+80|0;B=V+76|0;G=V+72|0;H=V+68|0;S=V+64|0;q=V+60|0;E=V+56|0;R=V+48|0;P=V+44|0;Q=V+40|0;t=V+36|0;s=V+32|0;C=V+28|0;u=V+24|0;D=V+20|0;U=V+16|0;T=V+12|0;I=V+8|0;N=V+4|0;L=V;c[J>>2]=d;c[p>>2]=e;c[M>>2]=f;c[w>>2]=g;c[x>>2]=h;c[y>>2]=j;c[z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=2e3+(((c[F>>2]&65535)<<16>>16)*900|0);c[u>>2]=(c[C>>2]|0)*3;v=rf(c[z>>2]|0,851968+(c[u>>2]|0)|0,19)|0;c[c[y>>2]>>2]=v;if((c[c[y>>2]>>2]|0)<(c[D>>2]|0)){c[c[y>>2]>>2]=c[D>>2];c[(c[y>>2]|0)+4>>2]=(c[z>>2]|0)-(c[c[y>>2]>>2]|0);v=_(65536+(c[u>>2]|0)>>16,(c[D>>2]&65535)<<16>>16)|0;c[U>>2]=rf((c[(c[y>>2]|0)+4>>2]<<1)-(c[D>>2]|0)|0,v+((_(65536+(c[u>>2]|0)&65535,(c[D>>2]&65535)<<16>>16)|0)>>16)|0,16)|0;if((c[U>>2]|0)>16384)o=16384;else o=(c[U>>2]|0)<0?0:c[U>>2]|0;c[U>>2]=o}else{c[(c[y>>2]|0)+4>>2]=(c[z>>2]|0)-(c[c[y>>2]>>2]|0);c[U>>2]=16384}v=_((c[U>>2]|0)-(b[(c[J>>2]|0)+28>>1]|0)>>16,(c[E>>2]&65535)<<16>>16)|0;E=(b[(c[J>>2]|0)+28>>1]|0)+(v+((_((c[U>>2]|0)-(b[(c[J>>2]|0)+28>>1]|0)&65535,(c[E>>2]&65535)<<16>>16)|0)>>16))&65535;b[(c[J>>2]|0)+28>>1]=E;a[c[x>>2]>>0]=0;a:do if(!(c[A>>2]|0)){do if(!(b[(c[J>>2]|0)+30>>1]|0)){if((c[z>>2]<<3|0)>=((c[D>>2]|0)*13|0)?(E=_(c[C>>2]>>16,b[(c[J>>2]|0)+28>>1]|0)|0,(E+((_(c[C>>2]&65535,b[(c[J>>2]|0)+28>>1]|0)|0)>>16)|0)>=819):0)break;c[R>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R>>2]&65535)<<16>>16)|0)>>14;c[R+4>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R+4>>2]&65535)<<16>>16)|0)>>14;Ig(R,c[w>>2]|0);c[U>>2]=0;c[R>>2]=0;c[R+4>>2]=0;c[c[y>>2]>>2]=c[z>>2];c[(c[y>>2]|0)+4>>2]=0;a[c[x>>2]>>0]=1;break a}while(0);do if(b[(c[J>>2]|0)+30>>1]|0){if((c[z>>2]<<3|0)>=((c[D>>2]|0)*11|0)?(E=_(c[C>>2]>>16,b[(c[J>>2]|0)+28>>1]|0)|0,(E+((_(c[C>>2]&65535,b[(c[J>>2]|0)+28>>1]|0)|0)>>16)|0)>=328):0)break;c[R>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R>>2]&65535)<<16>>16)|0)>>14;c[R+4>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R+4>>2]&65535)<<16>>16)|0)>>14;Ig(R,c[w>>2]|0);c[U>>2]=0;c[R>>2]=0;c[R+4>>2]=0;break a}while(0);if((b[(c[J>>2]|0)+28>>1]|0)>15565){Ig(R,c[w>>2]|0);c[U>>2]=16384;break}else{c[R>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R>>2]&65535)<<16>>16)|0)>>14;c[R+4>>2]=(_(b[(c[J>>2]|0)+28>>1]|0,(c[R+4>>2]&65535)<<16>>16)|0)>>14;Ig(R,c[w>>2]|0);c[U>>2]=b[(c[J>>2]|0)+28>>1];break}}else{c[U>>2]=0;c[R>>2]=0;c[R+4>>2]=0;Ig(R,c[w>>2]|0)}while(0);do if((a[c[x>>2]>>0]|0)==1){E=(c[J>>2]|0)+32|0;b[E>>1]=(b[E>>1]|0)+((c[K>>2]|0)-(c[F>>2]<<3));if((b[(c[J>>2]|0)+32>>1]|0)<((c[F>>2]|0)*5|0)){a[c[x>>2]>>0]=0;break}else{b[(c[J>>2]|0)+32>>1]=1e4;break}}else b[(c[J>>2]|0)+32>>1]=0;while(0);if((a[c[x>>2]>>0]|0)==0?(c[(c[y>>2]|0)+4>>2]|0)<1:0){c[(c[y>>2]|0)+4>>2]=1;E=tf(1,(c[z>>2]|0)-(c[(c[y>>2]|0)+4>>2]|0)|0)|0;c[c[y>>2]>>2]=E}c[P>>2]=0-(b[c[J>>2]>>1]|0);c[Q>>2]=0-(b[(c[J>>2]|0)+2>>1]|0);c[T>>2]=b[(c[J>>2]|0)+30>>1]<<10;c[B>>2]=65536/(c[F>>2]<<3|0)|0;c[G>>2]=0-(((_(((c[R>>2]|0)-(b[c[J>>2]>>1]|0)&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0)>>15)+1>>1);c[H>>2]=0-(((_(((c[R+4>>2]|0)-(b[(c[J>>2]|0)+2>>1]|0)&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0)>>15)+1>>1);E=_((c[U>>2]|0)-(b[(c[J>>2]|0)+30>>1]|0)>>16,(c[B>>2]&65535)<<16>>16)|0;c[I>>2]=E+((_((c[U>>2]|0)-(b[(c[J>>2]|0)+30>>1]|0)&65535,(c[B>>2]&65535)<<16>>16)|0)>>16)<<10;c[O>>2]=0;while(1){if((c[O>>2]|0)>=(c[F>>2]<<3|0))break;c[P>>2]=(c[P>>2]|0)+(c[G>>2]|0);c[Q>>2]=(c[Q>>2]|0)+(c[H>>2]|0);c[T>>2]=(c[T>>2]|0)+(c[I>>2]|0);c[S>>2]=(b[(c[N>>2]|0)+(c[O>>2]<<1)>>1]|0)+(b[(c[N>>2]|0)+((c[O>>2]|0)+2<<1)>>1]|0)+(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<1)<<9;D=_(c[T>>2]>>16,b[j+((c[O>>2]|0)+1<<1)>>1]|0)|0;D=D+((_(c[T>>2]&65535,b[j+((c[O>>2]|0)+1<<1)>>1]|0)|0)>>16)|0;E=_(c[S>>2]>>16,(c[P>>2]&65535)<<16>>16)|0;c[S>>2]=D+(E+((_(c[S>>2]&65535,(c[P>>2]&65535)<<16>>16)|0)>>16));E=_(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<11>>16,(c[Q>>2]&65535)<<16>>16)|0;c[S>>2]=(c[S>>2]|0)+(E+((_(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<11&65535,(c[Q>>2]&65535)<<16>>16)|0)>>16));if(((c[S>>2]>>7)+1>>1|0)<=32767)if(((c[S>>2]>>7)+1>>1|0)<-32768)o=-32768;else o=(c[S>>2]>>7)+1>>1;else o=32767;b[(c[M>>2]|0)+((c[O>>2]|0)-1<<1)>>1]=o;c[O>>2]=(c[O>>2]|0)+1}c[P>>2]=0-(c[R>>2]|0);c[Q>>2]=0-(c[R+4>>2]|0);c[T>>2]=c[U>>2]<<10;c[O>>2]=c[F>>2]<<3;while(1){if((c[O>>2]|0)>=(c[K>>2]|0))break;c[S>>2]=(b[(c[N>>2]|0)+(c[O>>2]<<1)>>1]|0)+(b[(c[N>>2]|0)+((c[O>>2]|0)+2<<1)>>1]|0)+(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<1)<<9;H=_(c[T>>2]>>16,b[j+((c[O>>2]|0)+1<<1)>>1]|0)|0;H=H+((_(c[T>>2]&65535,b[j+((c[O>>2]|0)+1<<1)>>1]|0)|0)>>16)|0;I=_(c[S>>2]>>16,(c[P>>2]&65535)<<16>>16)|0;c[S>>2]=H+(I+((_(c[S>>2]&65535,(c[P>>2]&65535)<<16>>16)|0)>>16));I=_(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<11>>16,(c[Q>>2]&65535)<<16>>16)|0;c[S>>2]=(c[S>>2]|0)+(I+((_(b[(c[N>>2]|0)+((c[O>>2]|0)+1<<1)>>1]<<11&65535,(c[Q>>2]&65535)<<16>>16)|0)>>16));if(((c[S>>2]>>7)+1>>1|0)<=32767)if(((c[S>>2]>>7)+1>>1|0)<-32768)o=-32768;else o=(c[S>>2]>>7)+1>>1;else o=32767;b[(c[M>>2]|0)+((c[O>>2]|0)-1<<1)>>1]=o;c[O>>2]=(c[O>>2]|0)+1}b[c[J>>2]>>1]=c[R>>2];b[(c[J>>2]|0)+2>>1]=c[R+4>>2];b[(c[J>>2]|0)+30>>1]=c[U>>2];na(c[L>>2]|0);i=V;return}function rf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=i;i=i+48|0;f=h+40|0;q=h+36|0;p=h+32|0;j=h+28|0;l=h+24|0;k=h+20|0;g=h+16|0;m=h+12|0;n=h+8|0;o=h+4|0;e=h;c[q>>2]=a;c[p>>2]=b;c[j>>2]=d;b=c[q>>2]|0;c[l>>2]=(sf((c[q>>2]|0)>0?b:0-b|0)|0)-1;c[n>>2]=c[q>>2]<>2];b=c[p>>2]|0;c[k>>2]=(sf((c[p>>2]|0)>0?b:0-b|0)|0)-1;c[o>>2]=c[p>>2]<>2];c[m>>2]=536870911/(c[o>>2]>>16|0)|0;b=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=b+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16);b=c[n>>2]|0;a=c[o>>2]|0;d=c[e>>2]|0;d=yj(a|0,((a|0)<0)<<31>>31|0,d|0,((d|0)<0)<<31>>31|0)|0;d=nj(d|0,C|0,32)|0;c[n>>2]=b-(d<<3);d=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=(c[e>>2]|0)+(d+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16));c[g>>2]=29+(c[l>>2]|0)-(c[k>>2]|0)-(c[j>>2]|0);d=c[g>>2]|0;if((c[g>>2]|0)>=0)if((d|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];q=c[f>>2]|0;i=h;return q|0}else{c[f>>2]=0;q=c[f>>2]|0;i=h;return q|0}a=c[e>>2]|0;b=0-(c[g>>2]|0)|0;do if((-2147483648>>0-d|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>b|0)){d=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){d=2147483647>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>b|0)){d=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){d=-2147483648>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}while(0);c[f>>2]=d<<0-(c[g>>2]|0);q=c[f>>2]|0;i=h;return q|0}function sf(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function tf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function uf(a,d,e,f,g,h){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;w=i;i=i+64|0;m=w+52|0;q=w+48|0;r=w+44|0;n=w+40|0;j=w+36|0;s=w+32|0;u=w+28|0;x=w+24|0;k=w+20|0;l=w+16|0;v=w+12|0;t=w+8|0;o=w+4|0;p=w;c[m>>2]=a;c[q>>2]=d;c[r>>2]=e;c[n>>2]=f;c[j>>2]=g;c[s>>2]=h;e=c[q>>2]|0;d=(c[m>>2]|0)+4|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;e=c[r>>2]|0;d=(c[m>>2]|0)+8|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;e=(c[m>>2]|0)+4|0;d=(c[q>>2]|0)+(c[s>>2]<<1)|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;e=(c[m>>2]|0)+8|0;d=(c[r>>2]|0)+(c[s>>2]<<1)|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;c[o>>2]=b[c[m>>2]>>1];c[p>>2]=b[(c[m>>2]|0)+2>>1];c[x>>2]=65536/(c[j>>2]<<3|0)|0;c[k>>2]=((_(((c[c[n>>2]>>2]|0)-(b[c[m>>2]>>1]|0)&65535)<<16>>16,(c[x>>2]&65535)<<16>>16)|0)>>15)+1>>1;c[l>>2]=((_(((c[(c[n>>2]|0)+4>>2]|0)-(b[(c[m>>2]|0)+2>>1]|0)&65535)<<16>>16,(c[x>>2]&65535)<<16>>16)|0)>>15)+1>>1;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[j>>2]<<3|0))break;c[o>>2]=(c[o>>2]|0)+(c[k>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[l>>2]|0);c[v>>2]=(b[(c[q>>2]|0)+(c[u>>2]<<1)>>1]|0)+(b[(c[q>>2]|0)+((c[u>>2]|0)+2<<1)>>1]|0)+(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<1)<<9;x=_(c[v>>2]>>16,(c[o>>2]&65535)<<16>>16)|0;c[v>>2]=(b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<8)+(x+((_(c[v>>2]&65535,(c[o>>2]&65535)<<16>>16)|0)>>16));x=_(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<11>>16,(c[p>>2]&65535)<<16>>16)|0;c[v>>2]=(c[v>>2]|0)+(x+((_(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<11&65535,(c[p>>2]&65535)<<16>>16)|0)>>16));if(((c[v>>2]>>7)+1>>1|0)<=32767)if(((c[v>>2]>>7)+1>>1|0)<-32768)h=-32768;else h=(c[v>>2]>>7)+1>>1;else h=32767;b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]=h;c[u>>2]=(c[u>>2]|0)+1}c[o>>2]=c[c[n>>2]>>2];c[p>>2]=c[(c[n>>2]|0)+4>>2];c[u>>2]=c[j>>2]<<3;while(1){if((c[u>>2]|0)>=(c[s>>2]|0))break;c[v>>2]=(b[(c[q>>2]|0)+(c[u>>2]<<1)>>1]|0)+(b[(c[q>>2]|0)+((c[u>>2]|0)+2<<1)>>1]|0)+(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<1)<<9;x=_(c[v>>2]>>16,(c[o>>2]&65535)<<16>>16)|0;c[v>>2]=(b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<8)+(x+((_(c[v>>2]&65535,(c[o>>2]&65535)<<16>>16)|0)>>16));x=_(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<11>>16,(c[p>>2]&65535)<<16>>16)|0;c[v>>2]=(c[v>>2]|0)+(x+((_(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]<<11&65535,(c[p>>2]&65535)<<16>>16)|0)>>16));if(((c[v>>2]>>7)+1>>1|0)<=32767)if(((c[v>>2]>>7)+1>>1|0)<-32768)h=-32768;else h=(c[v>>2]>>7)+1>>1;else h=32767;b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]=h;c[u>>2]=(c[u>>2]|0)+1}b[c[m>>2]>>1]=c[c[n>>2]>>2];b[(c[m>>2]|0)+2>>1]=c[(c[n>>2]|0)+4>>2];c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[s>>2]|0))break;c[v>>2]=(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]|0)+(b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]|0);c[t>>2]=(b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]|0)-(b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]|0);if((c[v>>2]|0)>32767)h=32767;else h=(c[v>>2]|0)<-32768?-32768:c[v>>2]|0;b[(c[q>>2]|0)+((c[u>>2]|0)+1<<1)>>1]=h;if((c[t>>2]|0)>32767)h=32767;else h=(c[t>>2]|0)<-32768?-32768:c[t>>2]|0;b[(c[r>>2]|0)+((c[u>>2]|0)+1<<1)>>1]=h;c[u>>2]=(c[u>>2]|0)+1}i=w;return}function vf(a){a=a|0;var b=0,d=0,e=0,f=0;f=i;i=i+16|0;b=f+4|0;d=f;c[d>>2]=a;if(!(((((((c[(c[d>>2]|0)+8>>2]|0)!=8e3?(c[(c[d>>2]|0)+8>>2]|0)!=12e3:0)?(c[(c[d>>2]|0)+8>>2]|0)!=16e3:0)?(c[(c[d>>2]|0)+8>>2]|0)!=24e3:0)?(c[(c[d>>2]|0)+8>>2]|0)!=32e3:0)?(c[(c[d>>2]|0)+8>>2]|0)!=44100:0)?(c[(c[d>>2]|0)+8>>2]|0)!=48e3:0))e=8;do if((e|0)==8){if(((c[(c[d>>2]|0)+20>>2]|0)!=8e3?(c[(c[d>>2]|0)+20>>2]|0)!=12e3:0)?(c[(c[d>>2]|0)+20>>2]|0)!=16e3:0)break;if(((c[(c[d>>2]|0)+12>>2]|0)!=8e3?(c[(c[d>>2]|0)+12>>2]|0)!=12e3:0)?(c[(c[d>>2]|0)+12>>2]|0)!=16e3:0)break;if(((c[(c[d>>2]|0)+16>>2]|0)!=8e3?(c[(c[d>>2]|0)+16>>2]|0)!=12e3:0)?(c[(c[d>>2]|0)+16>>2]|0)!=16e3:0)break;if(((c[(c[d>>2]|0)+16>>2]|0)<=(c[(c[d>>2]|0)+20>>2]|0)?(c[(c[d>>2]|0)+12>>2]|0)>=(c[(c[d>>2]|0)+20>>2]|0):0)?(c[(c[d>>2]|0)+16>>2]|0)<=(c[(c[d>>2]|0)+12>>2]|0):0){if((((c[(c[d>>2]|0)+24>>2]|0)!=10?(c[(c[d>>2]|0)+24>>2]|0)!=20:0)?(c[(c[d>>2]|0)+24>>2]|0)!=40:0)?(c[(c[d>>2]|0)+24>>2]|0)!=60:0){c[b>>2]=-103;e=c[b>>2]|0;i=f;return e|0}if((c[(c[d>>2]|0)+32>>2]|0)>=0?(c[(c[d>>2]|0)+32>>2]|0)<=100:0){if((c[(c[d>>2]|0)+44>>2]|0)>=0?(c[(c[d>>2]|0)+44>>2]|0)<=1:0){if((c[(c[d>>2]|0)+48>>2]|0)>=0?(c[(c[d>>2]|0)+48>>2]|0)<=1:0){do if((c[(c[d>>2]|0)+40>>2]|0)>=0){if((c[(c[d>>2]|0)+40>>2]|0)>1)break;do if((c[c[d>>2]>>2]|0)>=1){if((c[c[d>>2]>>2]|0)>2)break;do if((c[(c[d>>2]|0)+4>>2]|0)>=1){if((c[(c[d>>2]|0)+4>>2]|0)>2)break;if((c[(c[d>>2]|0)+4>>2]|0)>(c[c[d>>2]>>2]|0)){c[b>>2]=-111;e=c[b>>2]|0;i=f;return e|0}do if((c[(c[d>>2]|0)+36>>2]|0)>=0){if((c[(c[d>>2]|0)+36>>2]|0)>10)break;c[b>>2]=0;e=c[b>>2]|0;i=f;return e|0}while(0);c[b>>2]=-106;e=c[b>>2]|0;i=f;return e|0}while(0);c[b>>2]=-111;e=c[b>>2]|0;i=f;return e|0}while(0);c[b>>2]=-111;e=c[b>>2]|0;i=f;return e|0}while(0);c[b>>2]=-107;e=c[b>>2]|0;i=f;return e|0}c[b>>2]=-109;e=c[b>>2]|0;i=f;return e|0}c[b>>2]=-108;e=c[b>>2]|0;i=f;return e|0}c[b>>2]=-105;e=c[b>>2]|0;i=f;return e|0}}while(0);c[b>>2]=-102;e=c[b>>2]|0;i=f;return e|0}function wf(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;e=m+20|0;f=m+16|0;h=m+12|0;k=m+8|0;g=m+4|0;j=m;c[e>>2]=a;c[f>>2]=d;c[k>>2]=0;if((c[f>>2]|0)>8e4)d=8e4;else d=(c[f>>2]|0)<5e3?5e3:c[f>>2]|0;c[f>>2]=d;if((c[f>>2]|0)==(c[(c[e>>2]|0)+4632>>2]|0)){l=c[k>>2]|0;i=m;return l|0}c[(c[e>>2]|0)+4632>>2]=c[f>>2];do if((c[(c[e>>2]|0)+4600>>2]|0)!=8)if((c[(c[e>>2]|0)+4600>>2]|0)==12){c[j>>2]=17772;break}else{c[j>>2]=17804;break}else c[j>>2]=17740;while(0);if((c[(c[e>>2]|0)+4604>>2]|0)==2)c[f>>2]=(c[f>>2]|0)-2200;c[h>>2]=1;while(1){if((c[h>>2]|0)>=8){l=16;break}if((c[f>>2]|0)<=(c[(c[j>>2]|0)+(c[h>>2]<<2)>>2]|0))break;c[h>>2]=(c[h>>2]|0)+1}if((l|0)==16){l=c[k>>2]|0;i=m;return l|0}c[g>>2]=((c[f>>2]|0)-(c[(c[j>>2]|0)+((c[h>>2]|0)-1<<2)>>2]|0)<<6|0)/((c[(c[j>>2]|0)+(c[h>>2]<<2)>>2]|0)-(c[(c[j>>2]|0)+((c[h>>2]|0)-1<<2)>>2]|0)|0)|0;l=(b[24510+((c[h>>2]|0)-1<<1)>>1]<<6)+(_(c[g>>2]|0,(b[24510+(c[h>>2]<<1)>>1]|0)-(b[24510+((c[h>>2]|0)-1<<1)>>1]|0)|0)|0)|0;c[(c[e>>2]|0)+4748>>2]=l;l=c[k>>2]|0;i=m;return l|0}function xf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;e=i;i=i+16|0;f=e+8|0;g=e+4|0;d=e;c[f>>2]=a;c[g>>2]=b;c[d>>2]=0;oj(c[f>>2]|0,0,12240)|0;c[(c[f>>2]|0)+5124>>2]=c[g>>2];a=(Sf(3932160)|0)-2048<<8;c[(c[f>>2]|0)+8>>2]=a;c[(c[f>>2]|0)+12>>2]=c[(c[f>>2]|0)+8>>2];c[(c[f>>2]|0)+4696>>2]=1;a=Ue((c[f>>2]|0)+32|0)|0;c[d>>2]=(c[d>>2]|0)+a;i=e;return c[d>>2]|0}function yf(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;p=i;i=i+48|0;h=p+32|0;j=p+28|0;k=p+24|0;l=p+20|0;r=p+16|0;q=p+12|0;m=p+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j>>2]|0,c[l>>2]|0)|0;c[o>>2]=(c[o>>2]|0)+r;c[(c[j>>2]|0)+4700>>2]=1;c[h>>2]=c[o>>2];r=c[h>>2]|0;i=p;return r|0}function zf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+336|0;d=n+328|0;e=n+324|0;l=n+320|0;j=n+316|0;g=n+312|0;k=n+308|0;h=n+304|0;f=n+300|0;m=n;c[d>>2]=a;c[e>>2]=b;c[l>>2]=0;if((c[(c[d>>2]|0)+4600>>2]|0)==(c[e>>2]|0)?(c[(c[d>>2]|0)+4584>>2]|0)==(c[(c[d>>2]|0)+4580>>2]|0):0){k=c[d>>2]|0;k=k+4580|0;k=c[k>>2]|0;m=c[d>>2]|0;m=m+4584|0;c[m>>2]=k;m=c[l>>2]|0;i=n;return m|0}b=c[d>>2]|0;if(!(c[(c[d>>2]|0)+4600>>2]|0)){k=ig(b+5808|0,c[(c[d>>2]|0)+4580>>2]|0,(c[e>>2]|0)*1e3|0,1)|0;c[l>>2]=(c[l>>2]|0)+k;k=c[d>>2]|0;k=k+4580|0;k=c[k>>2]|0;m=c[d>>2]|0;m=m+4584|0;c[m>>2]=k;m=c[l>>2]|0;i=n;return m|0}else{c[h>>2]=((c[b+4604>>2]|0)*5<<1)+5;c[k>>2]=_(c[h>>2]|0,c[(c[d>>2]|0)+4600>>2]|0)|0;c[j>>2]=_(c[h>>2]|0,c[e>>2]|0)|0;b=(c[k>>2]|0)>(c[j>>2]|0)?c[k>>2]|0:c[j>>2]|0;c[f>>2]=ia()|0;a=i;i=i+((1*(b<<1)|0)+15&-16)|0;Af(a,(c[d>>2]|0)+9356|0,c[k>>2]|0);b=ig(m,((c[(c[d>>2]|0)+4600>>2]&65535)<<16>>16)*1e3|0,c[(c[d>>2]|0)+4580>>2]|0,0)|0;c[l>>2]=(c[l>>2]|0)+b;c[g>>2]=_(c[h>>2]|0,(c[(c[d>>2]|0)+4580>>2]|0)/1e3|0)|0;h=i;i=i+((1*(c[g>>2]<<1)|0)+15&-16)|0;k=jg(m,h,a,c[k>>2]|0)|0;c[l>>2]=(c[l>>2]|0)+k;k=ig((c[d>>2]|0)+5808|0,c[(c[d>>2]|0)+4580>>2]|0,((c[e>>2]&65535)<<16>>16)*1e3|0,1)|0;c[l>>2]=(c[l>>2]|0)+k;k=jg((c[d>>2]|0)+5808|0,a,h,c[g>>2]|0)|0;c[l>>2]=(c[l>>2]|0)+k;Bf((c[d>>2]|0)+9356|0,a,c[j>>2]|0);na(c[f>>2]|0);k=c[d>>2]|0;k=k+4580|0;k=c[k>>2]|0;m=c[d>>2]|0;m=m+4584|0;c[m>>2]=k;m=c[l>>2]|0;i=n;return m|0}return 0}function Af(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;f=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[h>>2]=d;c[l>>2]=e;c[j>>2]=(c[l>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;if((ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0)<=32767)if((ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0)<-32768)d=-32768;else d=ij(+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2])|0;else d=32767;b[(c[f>>2]|0)+(c[j>>2]<<1)>>1]=d;c[j>>2]=(c[j>>2]|0)+-1}i=k;return}function Bf(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;f=k+12|0;h=k+8|0;l=k+4|0;j=k;c[f>>2]=a;c[h>>2]=d;c[l>>2]=e;c[j>>2]=(c[l>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=+(b[(c[h>>2]|0)+(c[j>>2]<<1)>>1]|0);c[j>>2]=(c[j>>2]|0)+-1}i=k;return}function Cf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+16|0;h=k+12|0;g=k+8|0;f=k+4|0;j=k;c[h>>2]=b;c[g>>2]=d;c[f>>2]=e;c[j>>2]=0;if((c[f>>2]|0)!=(c[(c[h>>2]|0)+4636>>2]|0)){if((c[f>>2]|0)!=10&(c[f>>2]|0)!=20&(c[f>>2]|0)!=40&(c[f>>2]|0)!=60)c[j>>2]=-103;do if((c[f>>2]|0)<=10){c[(c[h>>2]|0)+5776>>2]=1;c[(c[h>>2]|0)+4604>>2]=(c[f>>2]|0)==10?2:1;e=_((c[f>>2]&65535)<<16>>16,(c[g>>2]&65535)<<16>>16)|0;c[(c[h>>2]|0)+4608>>2]=e;c[(c[h>>2]|0)+4572>>2]=((c[g>>2]&65535)<<16>>16)*14;e=(c[h>>2]|0)+4720|0;if((c[(c[h>>2]|0)+4600>>2]|0)==8){c[e>>2]=29174;break}else{c[e>>2]=29162;break}}else{c[(c[h>>2]|0)+5776>>2]=(c[f>>2]|0)/20|0;c[(c[h>>2]|0)+4604>>2]=4;c[(c[h>>2]|0)+4608>>2]=((c[g>>2]&65535)<<16>>16)*20;c[(c[h>>2]|0)+4572>>2]=((c[g>>2]&65535)<<16>>16)*24;e=(c[h>>2]|0)+4720|0;if((c[(c[h>>2]|0)+4600>>2]|0)==8){c[e>>2]=29151;break}else{c[e>>2]=29117;break}}while(0);c[(c[h>>2]|0)+4636>>2]=c[f>>2];c[(c[h>>2]|0)+4632>>2]=0}if((c[(c[h>>2]|0)+4600>>2]|0)==(c[g>>2]|0)){j=c[j>>2]|0;i=k;return j|0}e=(c[h>>2]|0)+7200|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;oj((c[h>>2]|0)+7216|0,0,2140)|0;oj((c[h>>2]|0)+144|0,0,4380)|0;e=(c[h>>2]|0)+4524|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;c[e+28>>2]=0;e=(c[h>>2]|0)+16|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[h>>2]|0)+5772>>2]=0;c[(c[h>>2]|0)+5780>>2]=0;c[(c[h>>2]|0)+4632>>2]=0;c[(c[h>>2]|0)+4568>>2]=100;c[(c[h>>2]|0)+4696>>2]=1;c[(c[h>>2]|0)+7216+2136>>2]=100;a[(c[h>>2]|0)+7200>>0]=10;c[(c[h>>2]|0)+144+4356>>2]=100;c[(c[h>>2]|0)+144+4372>>2]=65536;a[(c[h>>2]|0)+4565>>0]=0;c[(c[h>>2]|0)+4600>>2]=c[g>>2];e=(c[(c[h>>2]|0)+4604>>2]|0)==4;d=(c[h>>2]|0)+4720|0;do if((c[(c[h>>2]|0)+4600>>2]|0)==8)if(e){c[d>>2]=29151;break}else{c[d>>2]=29174;break}else if(e){c[d>>2]=29117;break}else{c[d>>2]=29162;break}while(0);if((c[(c[h>>2]|0)+4600>>2]|0)!=8?(c[(c[h>>2]|0)+4600>>2]|0)!=12:0){c[(c[h>>2]|0)+4664>>2]=16;c[(c[h>>2]|0)+4724>>2]=17704}else{c[(c[h>>2]|0)+4664>>2]=10;c[(c[h>>2]|0)+4724>>2]=17668}c[(c[h>>2]|0)+4612>>2]=(c[g>>2]|0)*5;e=_((c[(c[h>>2]|0)+4612>>2]&65535)<<16>>16,(c[(c[h>>2]|0)+4604>>2]&65535)<<16>>16)|0;c[(c[h>>2]|0)+4608>>2]=e;c[(c[h>>2]|0)+4616>>2]=((c[g>>2]&65535)<<16>>16)*20;c[(c[h>>2]|0)+4620>>2]=(c[g>>2]&65535)<<16>>16<<1;c[(c[h>>2]|0)+4576>>2]=((c[g>>2]&65535)<<16>>16)*18;e=(c[g>>2]&65535)<<16>>16;if((c[(c[h>>2]|0)+4604>>2]|0)==4)c[(c[h>>2]|0)+4572>>2]=e*24;else c[(c[h>>2]|0)+4572>>2]=e*14;e=c[h>>2]|0;if((c[(c[h>>2]|0)+4600>>2]|0)==16){c[e+4684>>2]=10;c[(c[h>>2]|0)+4716>>2]=29049;j=c[j>>2]|0;i=k;return j|0}d=(c[h>>2]|0)+4684|0;if((c[e+4600>>2]|0)==12){c[d>>2]=13;c[(c[h>>2]|0)+4716>>2]=29043;j=c[j>>2]|0;i=k;return j|0}else{c[d>>2]=15;c[(c[h>>2]|0)+4716>>2]=29034;j=c[j>>2]|0;i=k;return j|0}return 0}function Df(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;g=i;i=i+16|0;d=g+8|0;e=g+4|0;f=g;c[d>>2]=a;c[e>>2]=b;c[f>>2]=0;do if((c[e>>2]|0)>=2){if((c[e>>2]|0)<4){c[(c[d>>2]|0)+4668>>2]=1;c[(c[d>>2]|0)+4676>>2]=49807;c[(c[d>>2]|0)+4672>>2]=8;c[(c[d>>2]|0)+4660>>2]=10;c[(c[d>>2]|0)+4624>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*5;c[(c[d>>2]|0)+4652>>2]=1;c[(c[d>>2]|0)+4656>>2]=0;c[(c[d>>2]|0)+4680>>2]=0;c[(c[d>>2]|0)+4692>>2]=4;c[(c[d>>2]|0)+4704>>2]=0;break}if((c[e>>2]|0)<6){c[(c[d>>2]|0)+4668>>2]=1;c[(c[d>>2]|0)+4676>>2]=48497;c[(c[d>>2]|0)+4672>>2]=10;c[(c[d>>2]|0)+4660>>2]=12;c[(c[d>>2]|0)+4624>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*5;c[(c[d>>2]|0)+4652>>2]=2;c[(c[d>>2]|0)+4656>>2]=1;c[(c[d>>2]|0)+4680>>2]=0;c[(c[d>>2]|0)+4692>>2]=8;c[(c[d>>2]|0)+4704>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*983;break}b=(c[d>>2]|0)+4668|0;if((c[e>>2]|0)<8){c[b>>2]=1;c[(c[d>>2]|0)+4676>>2]=47186;c[(c[d>>2]|0)+4672>>2]=12;c[(c[d>>2]|0)+4660>>2]=14;c[(c[d>>2]|0)+4624>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*5;c[(c[d>>2]|0)+4652>>2]=3;c[(c[d>>2]|0)+4656>>2]=1;c[(c[d>>2]|0)+4680>>2]=0;c[(c[d>>2]|0)+4692>>2]=16;c[(c[d>>2]|0)+4704>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*983;break}else{c[b>>2]=2;c[(c[d>>2]|0)+4676>>2]=45875;c[(c[d>>2]|0)+4672>>2]=16;c[(c[d>>2]|0)+4660>>2]=16;c[(c[d>>2]|0)+4624>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*5;c[(c[d>>2]|0)+4652>>2]=4;c[(c[d>>2]|0)+4656>>2]=1;c[(c[d>>2]|0)+4680>>2]=0;c[(c[d>>2]|0)+4692>>2]=32;c[(c[d>>2]|0)+4704>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*983;break}}else{c[(c[d>>2]|0)+4668>>2]=0;c[(c[d>>2]|0)+4676>>2]=52429;c[(c[d>>2]|0)+4672>>2]=6;c[(c[d>>2]|0)+4660>>2]=8;c[(c[d>>2]|0)+4624>>2]=(c[(c[d>>2]|0)+4600>>2]|0)*3;c[(c[d>>2]|0)+4652>>2]=1;c[(c[d>>2]|0)+4656>>2]=0;c[(c[d>>2]|0)+4680>>2]=1;c[(c[d>>2]|0)+4692>>2]=2;c[(c[d>>2]|0)+4704>>2]=0}while(0);a=Ef(c[(c[d>>2]|0)+4672>>2]|0,c[(c[d>>2]|0)+4664>>2]|0)|0;c[(c[d>>2]|0)+4672>>2]=a;c[(c[d>>2]|0)+4628>>2]=((c[(c[d>>2]|0)+4600>>2]|0)*5|0)+(c[(c[d>>2]|0)+4624>>2]<<1);c[(c[d>>2]|0)+4648>>2]=c[e>>2];i=g;return c[f>>2]|0}function Ef(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Ff(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0;j=i;i=i+32|0;f=j+16|0;d=j+12|0;g=j+8|0;h=j+4|0;e=j;c[f>>2]=a;c[d>>2]=b;c[h>>2]=0;c[g>>2]=c[(c[f>>2]|0)+6124>>2];c[(c[f>>2]|0)+6124>>2]=0;if(!(c[(c[f>>2]|0)+6120>>2]|0)){h=c[h>>2]|0;i=j;return h|0}if((c[(c[f>>2]|0)+4640>>2]|0)<=0){h=c[h>>2]|0;i=j;return h|0}do if((c[(c[f>>2]|0)+4600>>2]|0)!=8)if((c[(c[f>>2]|0)+4600>>2]|0)==12){c[e>>2]=14e3;break}else{c[e>>2]=16e3;break}else c[e>>2]=12e3;while(0);if((c[(c[f>>2]|0)+4640>>2]|0)<25)b=c[(c[f>>2]|0)+4640>>2]|0;else b=25;b=((_(c[e>>2]|0,125-b|0)|0)>>16)*655|0;if((c[(c[f>>2]|0)+4640>>2]|0)<25)a=c[(c[f>>2]|0)+4640>>2]|0;else a=25;c[e>>2]=b+(((_(c[e>>2]|0,125-a|0)|0)&65535)*655>>16);if((c[d>>2]|0)<=(c[e>>2]|0)){h=c[h>>2]|0;i=j;return h|0}b=c[f>>2]|0;if(!(c[g>>2]|0))c[b+6128>>2]=7;else{g=Gf(7-(((c[b+4640>>2]>>16)*26214|0)+((c[(c[f>>2]|0)+4640>>2]&65535)*26214>>16))|0,2)|0;c[(c[f>>2]|0)+6128>>2]=g}c[(c[f>>2]|0)+6124>>2]=1;h=c[h>>2]|0;i=j;return h|0}function Gf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Hf(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=i;i=i+160|0;f=D+156|0;g=D+152|0;h=D+148|0;p=D+144|0;q=D+140|0;r=D+136|0;m=D+132|0;u=D+128|0;o=D+124|0;x=D+120|0;w=D+116|0;y=D+112|0;A=D+108|0;z=D+104|0;B=D+100|0;v=D+96|0;s=D+92|0;n=D+88|0;j=D+52|0;l=D+16|0;k=D+8|0;t=D;c[f>>2]=a;c[g>>2]=d;c[h>>2]=e;c[k>>2]=j;c[k+4>>2]=l;c[m>>2]=c[h>>2]>>1;If(c[g>>2]|0,j,l,c[m>>2]|0);c[t>>2]=j;c[x>>2]=b[12288];c[A>>2]=Kf(c[t>>2]|0,c[x>>2]|0,c[m>>2]|0)|0;if((c[A>>2]|0)<0){b[c[f>>2]>>1]=0;c[t>>2]=l;c[A>>2]=Kf(c[t>>2]|0,c[x>>2]|0,c[m>>2]|0)|0;c[u>>2]=1}else c[u>>2]=0;c[q>>2]=1;c[p>>2]=0;c[v>>2]=0;a:while(1){c[w>>2]=b[24576+(c[q>>2]<<1)>>1];c[z>>2]=Kf(c[t>>2]|0,c[w>>2]|0,c[m>>2]|0)|0;if(!((c[A>>2]|0)<=0?(c[z>>2]|0)>=(c[v>>2]|0):0))C=7;do if((C|0)==7){C=0;if((c[A>>2]|0)>=0?(c[z>>2]|0)<=(0-(c[v>>2]|0)|0):0)break;c[q>>2]=(c[q>>2]|0)+1;c[x>>2]=c[w>>2];c[A>>2]=c[z>>2];c[v>>2]=0;if((c[q>>2]|0)<=128)continue a;c[p>>2]=(c[p>>2]|0)+1;if((c[p>>2]|0)>30)break a;Of(c[g>>2]|0,c[h>>2]|0,65536-(_((10+(c[p>>2]|0)&65535)<<16>>16,(c[p>>2]&65535)<<16>>16)|0)|0);If(c[g>>2]|0,j,l,c[m>>2]|0);c[t>>2]=j;c[x>>2]=b[12288];c[A>>2]=Kf(c[t>>2]|0,c[x>>2]|0,c[m>>2]|0)|0;if((c[A>>2]|0)<0){b[c[f>>2]>>1]=0;c[t>>2]=l;c[A>>2]=Kf(c[t>>2]|0,c[x>>2]|0,c[m>>2]|0)|0;c[u>>2]=1}else c[u>>2]=0;c[q>>2]=1;continue a}while(0);if(!(c[z>>2]|0))c[v>>2]=1;else c[v>>2]=0;c[o>>2]=-256;c[r>>2]=0;while(1){if((c[r>>2]|0)>=3)break;c[y>>2]=((c[x>>2]|0)+(c[w>>2]|0)>>1)+((c[x>>2]|0)+(c[w>>2]|0)&1);c[B>>2]=Kf(c[t>>2]|0,c[y>>2]|0,c[m>>2]|0)|0;if(!((c[A>>2]|0)<=0&(c[B>>2]|0)>=0)?!((c[A>>2]|0)>=0&(c[B>>2]|0)<=0):0){c[x>>2]=c[y>>2];c[A>>2]=c[B>>2];c[o>>2]=(c[o>>2]|0)+(128>>c[r>>2])}else{c[w>>2]=c[y>>2];c[z>>2]=c[B>>2]}c[r>>2]=(c[r>>2]|0)+1}e=c[A>>2]|0;a=c[A>>2]|0;if((((c[A>>2]|0)>0?e:0-e|0)|0)<65536){c[n>>2]=a-(c[z>>2]|0);c[s>>2]=(c[A>>2]<<5)+(c[n>>2]>>1);if(c[n>>2]|0)c[o>>2]=(c[o>>2]|0)+((c[s>>2]|0)/(c[n>>2]|0)|0)}else c[o>>2]=(c[o>>2]|0)+((a|0)/((c[A>>2]|0)-(c[z>>2]|0)>>5|0)|0);e=(Lf((c[q>>2]<<8)+(c[o>>2]|0)|0,32767)|0)&65535;b[(c[f>>2]|0)+(c[u>>2]<<1)>>1]=e;c[u>>2]=(c[u>>2]|0)+1;if((c[u>>2]|0)>=(c[h>>2]|0)){C=34;break}c[t>>2]=c[k+((c[u>>2]&1)<<2)>>2];c[x>>2]=b[24576+((c[q>>2]|0)-1<<1)>>1];c[A>>2]=1-(c[u>>2]&2)<<12}if((C|0)==34){i=D;return}b[c[f>>2]>>1]=32768/((c[h>>2]|0)+1|0)|0;c[q>>2]=1;while(1){if((c[q>>2]|0)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;e=h+8|0;f=h+4|0;g=h;c[d>>2]=a;c[e>>2]=b;c[f>>2]=2;while(1){if((c[f>>2]|0)>(c[e>>2]|0))break;c[g>>2]=c[e>>2];while(1){if((c[g>>2]|0)<=(c[f>>2]|0))break;a=(c[d>>2]|0)+((c[g>>2]|0)-2<<2)|0;c[a>>2]=(c[a>>2]|0)-(c[(c[d>>2]|0)+(c[g>>2]<<2)>>2]|0);c[g>>2]=(c[g>>2]|0)+-1}a=(c[d>>2]|0)+((c[f>>2]|0)-2<<2)|0;c[a>>2]=(c[a>>2]|0)-(c[(c[d>>2]|0)+(c[f>>2]<<2)>>2]<<1);c[f>>2]=(c[f>>2]|0)+1}i=h;return}function Kf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;k=i;i=i+32|0;e=k+20|0;l=k+16|0;f=k+12|0;g=k+8|0;h=k+4|0;j=k;c[e>>2]=a;c[l>>2]=b;c[f>>2]=d;c[j>>2]=c[(c[e>>2]|0)+(c[f>>2]<<2)>>2];c[h>>2]=c[l>>2]<<4;if(8==(c[f>>2]|0)^1^1){l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+28>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+24>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+20>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+16>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+12>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+8>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+4>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[c[e>>2]>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);l=c[j>>2]|0;i=k;return l|0}c[g>>2]=(c[f>>2]|0)-1;while(1){if((c[g>>2]|0)<0)break;l=_(c[j>>2]>>16,(c[h>>2]&65535)<<16>>16)|0;l=(c[(c[e>>2]|0)+(c[g>>2]<<2)>>2]|0)+(l+((_(c[j>>2]&65535,(c[h>>2]&65535)<<16>>16)|0)>>16))|0;c[j>>2]=l+(_(c[j>>2]|0,(c[h>>2]>>15)+1>>1)|0);c[g>>2]=(c[g>>2]|0)+-1}l=c[j>>2]|0;i=k;return l|0}function Lf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function Mf(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=i;i=i+48|0;h=t+44|0;j=t+40|0;k=t+36|0;l=t+32|0;u=t+28|0;q=t+24|0;m=t+20|0;p=t+16|0;n=t+12|0;o=t+8|0;r=t+4|0;s=t;c[h>>2]=a;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[u>>2]=g;c[m>>2]=c[u>>2]>>1;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[m>>2]|0))break;c[p>>2]=b[(c[h>>2]|0)+(c[q>>2]<<1<<1)>>1]<<10;c[o>>2]=(c[p>>2]|0)-(c[c[j>>2]>>2]|0);u=_(c[o>>2]>>16,b[12286]|0)|0;c[n>>2]=(c[o>>2]|0)+(u+((_(c[o>>2]&65535,b[12286]|0)|0)>>16));c[r>>2]=(c[c[j>>2]>>2]|0)+(c[n>>2]|0);c[c[j>>2]>>2]=(c[p>>2]|0)+(c[n>>2]|0);c[p>>2]=b[(c[h>>2]|0)+((c[q>>2]<<1)+1<<1)>>1]<<10;c[o>>2]=(c[p>>2]|0)-(c[(c[j>>2]|0)+4>>2]|0);u=_(c[o>>2]>>16,b[12287]|0)|0;c[n>>2]=u+((_(c[o>>2]&65535,b[12287]|0)|0)>>16);c[s>>2]=(c[(c[j>>2]|0)+4>>2]|0)+(c[n>>2]|0);c[(c[j>>2]|0)+4>>2]=(c[p>>2]|0)+(c[n>>2]|0);if((((c[s>>2]|0)+(c[r>>2]|0)>>10)+1>>1|0)<=32767)if((((c[s>>2]|0)+(c[r>>2]|0)>>10)+1>>1|0)<-32768)g=-32768;else g=((c[s>>2]|0)+(c[r>>2]|0)>>10)+1>>1;else g=32767;b[(c[k>>2]|0)+(c[q>>2]<<1)>>1]=g;if((((c[s>>2]|0)-(c[r>>2]|0)>>10)+1>>1|0)<=32767)if((((c[s>>2]|0)-(c[r>>2]|0)>>10)+1>>1|0)<-32768)g=-32768;else g=((c[s>>2]|0)-(c[r>>2]|0)>>10)+1>>1;else g=32767;b[(c[l>>2]|0)+(c[q>>2]<<1)>>1]=g;c[q>>2]=(c[q>>2]|0)+1}i=t;return}function Nf(a,d,e,f,g,h,j){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;x=i;i=i+64|0;k=x+52|0;l=x+48|0;y=x+44|0;m=x+40|0;n=x+36|0;o=x+32|0;p=x+28|0;v=x+24|0;u=x+20|0;r=x+16|0;q=x+12|0;t=x+8|0;s=x+4|0;w=x;c[k>>2]=a;c[l>>2]=d;c[y>>2]=e;c[m>>2]=f;c[n>>2]=g;c[o>>2]=h;c[p>>2]=j;c[q>>2]=0-(c[c[y>>2]>>2]|0)&16383;c[r>>2]=0-(c[c[y>>2]>>2]|0)>>14;c[s>>2]=0-(c[(c[y>>2]|0)+4>>2]|0)&16383;c[t>>2]=0-(c[(c[y>>2]|0)+4>>2]|0)>>14;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[o>>2]|0))break;y=_(c[v>>2]|0,c[p>>2]|0)|0;c[u>>2]=b[(c[k>>2]|0)+(y<<1)>>1];y=_(c[c[l>>2]>>2]>>16,(c[u>>2]&65535)<<16>>16)|0;c[w>>2]=(c[c[m>>2]>>2]|0)+(y+((_(c[c[l>>2]>>2]&65535,(c[u>>2]&65535)<<16>>16)|0)>>16))<<2;y=_(c[w>>2]>>16,(c[q>>2]&65535)<<16>>16)|0;y=(c[(c[m>>2]|0)+4>>2]|0)+((y+((_(c[w>>2]&65535,(c[q>>2]&65535)<<16>>16)|0)>>16)>>13)+1>>1)|0;c[c[m>>2]>>2]=y;y=_(c[w>>2]>>16,(c[r>>2]&65535)<<16>>16)|0;y=(c[c[m>>2]>>2]|0)+(y+((_(c[w>>2]&65535,(c[r>>2]&65535)<<16>>16)|0)>>16))|0;c[c[m>>2]>>2]=y;y=_(c[(c[l>>2]|0)+4>>2]>>16,(c[u>>2]&65535)<<16>>16)|0;y=(c[c[m>>2]>>2]|0)+(y+((_(c[(c[l>>2]|0)+4>>2]&65535,(c[u>>2]&65535)<<16>>16)|0)>>16))|0;c[c[m>>2]>>2]=y;y=_(c[w>>2]>>16,(c[s>>2]&65535)<<16>>16)|0;y=(y+((_(c[w>>2]&65535,(c[s>>2]&65535)<<16>>16)|0)>>16)>>13)+1>>1;c[(c[m>>2]|0)+4>>2]=y;y=_(c[w>>2]>>16,(c[t>>2]&65535)<<16>>16)|0;y=(c[(c[m>>2]|0)+4>>2]|0)+(y+((_(c[w>>2]&65535,(c[t>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[m>>2]|0)+4>>2]=y;y=_(c[(c[l>>2]|0)+8>>2]>>16,(c[u>>2]&65535)<<16>>16)|0;y=(c[(c[m>>2]|0)+4>>2]|0)+(y+((_(c[(c[l>>2]|0)+8>>2]&65535,(c[u>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[m>>2]|0)+4>>2]=y;if(((c[w>>2]|0)+16384-1>>14|0)<=32767)if(((c[w>>2]|0)+16384-1>>14|0)<-32768)e=-32768;else e=(c[w>>2]|0)+16384-1>>14;else e=32767;y=_(c[v>>2]|0,c[p>>2]|0)|0;b[(c[n>>2]|0)+(y<<1)>>1]=e;c[v>>2]=(c[v>>2]|0)+1}i=x;return}function Of(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+16|0;f=k+12|0;g=k+8|0;j=k+4|0;h=k;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;c[h>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0)+((c[g>>2]|0)-1<<1)>>1]|0)|0)>>15)+1>>1&65535;b[(c[f>>2]|0)+((c[g>>2]|0)-1<<1)>>1]=k;i=l;return}function Qf(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+48|0;j=u+36|0;l=u+38|0;m=u+32|0;k=u+28|0;n=u+24|0;r=u+20|0;q=u+16|0;t=u+12|0;s=u+8|0;p=u+4|0;o=u;b[j>>1]=d;a[l>>0]=e;c[m>>2]=f;c[k>>2]=g;c[n>>2]=h;g=(c[n>>2]|0)==4;do if((c[k>>2]|0)==8)if(g){c[o>>2]=30286;c[p>>2]=11;break}else{c[o>>2]=30252;c[p>>2]=3;break}else if(g){c[o>>2]=30330;c[p>>2]=34;break}else{c[o>>2]=30258;c[p>>2]=12;break}while(0);c[t>>2]=(c[k>>2]&65535)<<16>>16<<1;c[s>>2]=((c[k>>2]&65535)<<16>>16)*18;c[r>>2]=(c[t>>2]|0)+(b[j>>1]|0);c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[n>>2]|0))break;g=_(c[q>>2]|0,c[p>>2]|0)|0;c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]=(c[r>>2]|0)+(a[(c[o>>2]|0)+(g+(a[l>>0]|0))>>0]|0);g=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;do if((c[t>>2]|0)>(c[s>>2]|0)){if((g|0)>(c[t>>2]|0)){g=c[t>>2]|0;break}if((c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0)<(c[s>>2]|0)){g=c[s>>2]|0;break}else{g=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;break}}else{if((g|0)>(c[s>>2]|0)){g=c[s>>2]|0;break}if((c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0)<(c[t>>2]|0)){g=c[t>>2]|0;break}else{g=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;break}}while(0);c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]=g;c[q>>2]=(c[q>>2]|0)+1}i=u;return}function Rf(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;g=n+20|0;h=n+16|0;j=n+12|0;k=n+8|0;l=n+4|0;m=n;c[g>>2]=a;c[h>>2]=d;c[j>>2]=e;c[k>>2]=f;c[m>>2]=0;c[l>>2]=0;while(1){a=c[m>>2]|0;if((c[l>>2]|0)>=(c[k>>2]|0))break;e=_(b[(c[g>>2]|0)+(c[l>>2]<<1)>>1]|0,b[(c[h>>2]|0)+(c[l>>2]<<1)>>1]|0)|0;c[m>>2]=a+(e>>c[j>>2]);c[l>>2]=(c[l>>2]|0)+1}i=n;return a|0}function Sf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;i=i+16|0;f=b+8|0;e=b+4|0;d=b;c[f>>2]=a;Tf(c[f>>2]|0,e,d);a=((_(c[d>>2]|0,128-(c[d>>2]|0)|0)|0)>>16)*179|0;a=(31-(c[e>>2]|0)<<7)+((c[d>>2]|0)+(a+(((_(c[d>>2]|0,128-(c[d>>2]|0)|0)|0)&65535)*179>>16)))|0;i=b;return a|0}function Tf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=Uf(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(Vf(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function Uf(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function Vf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function Wf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+16|0;d=h+12|0;e=h+8|0;g=h+4|0;f=h;c[e>>2]=a;if((c[e>>2]|0)<0){c[d>>2]=0;g=c[d>>2]|0;i=h;return g|0}if((c[e>>2]|0)>=3967){c[d>>2]=2147483647;g=c[d>>2]|0;i=h;return g|0}c[g>>2]=1<<(c[e>>2]>>7);c[f>>2]=c[e>>2]&127;a=c[g>>2]|0;b=c[g>>2]|0;if((c[e>>2]|0)<2048){e=_((_((c[f>>2]&65535)<<16>>16,(128-(c[f>>2]|0)&65535)<<16>>16)|0)>>16,-174)|0;c[g>>2]=a+((_(b,(c[f>>2]|0)+(e+((_((_((c[f>>2]&65535)<<16>>16,(128-(c[f>>2]|0)&65535)<<16>>16)|0)&65535,-174)|0)>>16))|0)|0)>>7)}else{e=_((_((c[f>>2]&65535)<<16>>16,(128-(c[f>>2]|0)&65535)<<16>>16)|0)>>16,-174)|0;c[g>>2]=a+(_(b>>7,(c[f>>2]|0)+(e+((_((_((c[f>>2]&65535)<<16>>16,(128-(c[f>>2]|0)&65535)<<16>>16)|0)&65535,-174)|0)>>16))|0)|0)}c[d>>2]=c[g>>2];g=c[d>>2]|0;i=h;return g|0}function Xf(a,d,e,f,g,h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);c[r>>2]=(c[s>>2]>>11)+1>>1;if((c[r>>2]|0)>32767)e=32767;else e=(c[r>>2]|0)<-32768?-32768:c[r>>2]|0;b[(c[j>>2]|0)+(c[p>>2]<<1)>>1]=e;c[p>>2]=(c[p>>2]|0)+1}oj(c[j>>2]|0,0,c[n>>2]<<1|0)|0;i=t;return}function Yf(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+160|0;e=m+148|0;f=m+144|0;g=m+140|0;l=m+136|0;j=m+8|0;h=m+4|0;k=m;c[f>>2]=a;c[g>>2]=d;c[k>>2]=0;c[h>>2]=j+((c[g>>2]&1)<<6);c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[g>>2]|0))break;c[k>>2]=(c[k>>2]|0)+(b[(c[f>>2]|0)+(c[l>>2]<<1)>>1]|0);c[(c[h>>2]|0)+(c[l>>2]<<2)>>2]=b[(c[f>>2]|0)+(c[l>>2]<<1)>>1]<<12;c[l>>2]=(c[l>>2]|0)+1}if((c[k>>2]|0)>=4096){c[e>>2]=0;d=c[e>>2]|0;i=m;return d|0}else{c[e>>2]=Zf(j,c[g>>2]|0)|0;d=c[e>>2]|0;i=m;return d|0}return 0}function Zf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;r=i;i=i+64|0;d=r+48|0;e=r+44|0;s=r+40|0;j=r+36|0;l=r+32|0;k=r+28|0;h=r+24|0;m=r+20|0;n=r+16|0;o=r+12|0;p=r+8|0;g=r+4|0;f=r;c[e>>2]=a;c[s>>2]=b;c[f>>2]=(c[e>>2]|0)+((c[s>>2]&1)<<6);c[h>>2]=1073741824;c[j>>2]=(c[s>>2]|0)-1;while(1){if((c[j>>2]|0)<=0)break;if((c[(c[f>>2]|0)+(c[j>>2]<<2)>>2]|0)>16773022){q=5;break}if((c[(c[f>>2]|0)+(c[j>>2]<<2)>>2]|0)<-16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]|0)+-1}if((q|0)==5){c[d>>2]=0;t=c[d>>2]|0;i=r;return t|0}if((c[c[f>>2]>>2]|0)<=16773022?(c[c[f>>2]>>2]|0)>=-16773022:0){c[m>>2]=0-(c[c[f>>2]>>2]<<7);t=c[m>>2]|0;s=c[m>>2]|0;s=yj(t|0,((t|0)<0)<<31>>31|0,s|0,((s|0)<0)<<31>>31|0)|0;s=nj(s|0,C|0,32)|0;c[n>>2]=1073741824-s;s=c[h>>2]|0;t=c[n>>2]|0;t=yj(s|0,((s|0)<0)<<31>>31|0,t|0,((t|0)<0)<<31>>31|0)|0;t=nj(t|0,C|0,32)|0;c[h>>2]=t<<2;c[d>>2]=c[h>>2];t=c[d>>2]|0;i=r;return t|0}c[d>>2]=0;t=c[d>>2]|0;i=r;return t|0}function _f(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function $f(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+48|0;f=h+32|0;n=h+28|0;d=h+24|0;j=h+20|0;g=h+16|0;k=h+12|0;m=h+8|0;l=h+4|0;e=h;c[n>>2]=a;c[d>>2]=b;b=c[n>>2]|0;c[j>>2]=(_f((c[n>>2]|0)>0?b:0-b|0)|0)-1;c[m>>2]=c[n>>2]<>2];c[k>>2]=536870911/(c[m>>2]>>16|0)|0;c[e>>2]=c[k>>2]<<16;b=_(c[m>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=536870912-(b+((_(c[m>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))<<3;b=_(c[l>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=(c[e>>2]|0)+(b+((_(c[l>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))|0;c[e>>2]=b+(_(c[l>>2]|0,(c[k>>2]>>15)+1>>1)|0);c[g>>2]=61-(c[j>>2]|0)-(c[d>>2]|0);b=c[g>>2]|0;if((c[g>>2]|0)>0)if((b|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];n=c[f>>2]|0;i=h;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;i=h;return n|0}a=c[e>>2]|0;d=0-(c[g>>2]|0)|0;do if((-2147483648>>0-b|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>d|0)){b=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){b=2147483647>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>d|0)){b=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){b=-2147483648>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}while(0);c[f>>2]=b<<0-(c[g>>2]|0);n=c[f>>2]|0;i=h;return n|0}function ag(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=i;i=i+272|0;x=C+264|0;g=C+260|0;y=C+256|0;v=C+252|0;B=C+248|0;A=C+244|0;p=C+240|0;n=C+176|0;h=C+140|0;k=C+104|0;j=C+100|0;l=C+96|0;s=C+92|0;r=C+88|0;o=C+84|0;q=C+80|0;z=C+16|0;u=C+12|0;m=C+8|0;t=C+4|0;w=C;c[x>>2]=a;c[g>>2]=e;c[y>>2]=f;c[t>>2]=0;c[v>>2]=(c[y>>2]|0)==16?30226:30242;c[B>>2]=0;while(1){if((c[B>>2]|0)>=(c[y>>2]|0))break;c[s>>2]=b[(c[g>>2]|0)+(c[B>>2]<<1)>>1]>>8;c[r>>2]=(b[(c[g>>2]|0)+(c[B>>2]<<1)>>1]|0)-(c[s>>2]<<8);c[o>>2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(c[y>>2]|0))break a;if(((c[z+(c[B>>2]<<2)>>2]>>4)+1>>1|0)<=32767)if(((c[z+(c[B>>2]<<2)>>2]>>4)+1>>1|0)<-32768)g=-32768;else g=(c[z+(c[B>>2]<<2)>>2]>>4)+1>>1;else g=32767;b[(c[x>>2]|0)+(c[B>>2]<<1)>>1]=g;c[z+(c[B>>2]<<2)>>2]=b[(c[x>>2]|0)+(c[B>>2]<<1)>>1]<<5;c[B>>2]=(c[B>>2]|0)+1}else while(1){if((c[B>>2]|0)>=(c[y>>2]|0))break a;b[(c[x>>2]|0)+(c[B>>2]<<1)>>1]=(c[z+(c[B>>2]<<2)>>2]>>4)+1>>1;c[B>>2]=(c[B>>2]|0)+1}while(0);c[A>>2]=0;while(1){if((c[A>>2]|0)>=16){g=31;break}if((Yf(c[x>>2]|0,c[y>>2]|0)|0)>=107374){g=31;break}Of(z,c[y>>2]|0,65536-(2<>2])|0);c[B>>2]=0;while(1){if((c[B>>2]|0)>=(c[y>>2]|0))break;b[(c[x>>2]|0)+(c[B>>2]<<1)>>1]=(c[z+(c[B>>2]<<2)>>2]>>4)+1>>1;c[B>>2]=(c[B>>2]|0)+1}c[A>>2]=(c[A>>2]|0)+1}if((g|0)==31){i=C;return}}function bg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;e=l+20|0;f=l+16|0;g=l+12|0;j=l+8|0;k=l+4|0;h=l;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;c[c[e>>2]>>2]=65536;c[(c[e>>2]|0)+4>>2]=0-(c[c[f>>2]>>2]|0);c[j>>2]=1;while(1){if((c[j>>2]|0)>=(c[g>>2]|0))break;c[h>>2]=c[(c[f>>2]|0)+(c[j>>2]<<1<<2)>>2];d=c[(c[e>>2]|0)+((c[j>>2]|0)-1<<2)>>2]<<1;b=c[h>>2]|0;a=c[(c[e>>2]|0)+(c[j>>2]<<2)>>2]|0;a=yj(b|0,((b|0)<0)<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|0;b[d>>1]=(b[d>>1]|0)+((((b[(c[l>>2]|0)+2344+(c[q>>2]<<1)>>1]|0)-(b[(c[r>>2]|0)+1280+(c[q>>2]<<1)>>1]|0)>>16)*16348|0)+(((b[(c[l>>2]|0)+2344+(c[q>>2]<<1)>>1]|0)-(b[(c[r>>2]|0)+1280+(c[q>>2]<<1)>>1]|0)&65535)*16348>>16));c[q>>2]=(c[q>>2]|0)+1}c[h>>2]=0;c[j>>2]=0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[(c[l>>2]|0)+2324>>2]|0))break;if((c[(c[g>>2]|0)+16+(c[q>>2]<<2)>>2]|0)>(c[h>>2]|0)){c[h>>2]=c[(c[g>>2]|0)+16+(c[q>>2]<<2)>>2];c[j>>2]=c[q>>2]}c[q>>2]=(c[q>>2]|0)+1}qj((c[r>>2]|0)+(c[(c[l>>2]|0)+2332>>2]<<2)|0,c[r>>2]|0,(_((c[(c[l>>2]|0)+2324>>2]|0)-1|0,c[(c[l>>2]|0)+2332>>2]|0)|0)<<2|0)|0;j=_(c[j>>2]|0,c[(c[l>>2]|0)+2332>>2]|0)|0;pj(c[r>>2]|0,(c[l>>2]|0)+4+(j<<2)|0,c[(c[l>>2]|0)+2332>>2]<<2|0)|0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[(c[l>>2]|0)+2324>>2]|0))break a;j=(c[r>>2]|0)+1376|0;c[j>>2]=(c[j>>2]|0)+((((c[(c[g>>2]|0)+16+(c[q>>2]<<2)>>2]|0)-(c[(c[r>>2]|0)+1376>>2]|0)>>16)*4634|0)+(((c[(c[g>>2]|0)+16+(c[q>>2]<<2)>>2]|0)-(c[(c[r>>2]|0)+1376>>2]|0)&65535)*4634>>16));c[q>>2]=(c[q>>2]|0)+1}}while(0);if(!(c[(c[l>>2]|0)+4160>>2]|0)){oj((c[r>>2]|0)+1312|0,0,c[(c[l>>2]|0)+2340>>2]<<2|0)|0;i=t;return}j=(c[n>>2]|0)+16|0;c[o>>2]=ia()|0;h=i;i=i+((1*(j<<2)|0)+15&-16)|0;j=_(b[(c[l>>2]|0)+4168+56>>1]>>16,(c[(c[l>>2]|0)+4168+72+4>>2]&65535)<<16>>16)|0;j=j+((_(b[(c[l>>2]|0)+4168+56>>1]&65535,(c[(c[l>>2]|0)+4168+72+4>>2]&65535)<<16>>16)|0)>>16)|0;c[k>>2]=j+(_(b[(c[l>>2]|0)+4168+56>>1]|0,(c[(c[l>>2]|0)+4168+72+4>>2]>>15)+1>>1)|0);if((c[k>>2]|0)<2097152?(c[(c[r>>2]|0)+1376>>2]|0)<=8388608:0){j=_(c[k>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;j=j+((_(c[k>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16)|0;c[k>>2]=j+(_(c[k>>2]|0,(c[k>>2]>>15)+1>>1)|0);j=_(c[(c[r>>2]|0)+1376>>2]>>16,(c[(c[r>>2]|0)+1376>>2]&65535)<<16>>16)|0;j=j+((_(c[(c[r>>2]|0)+1376>>2]&65535,(c[(c[r>>2]|0)+1376>>2]&65535)<<16>>16)|0)>>16)|0;j=j+(_(c[(c[r>>2]|0)+1376>>2]|0,(c[(c[r>>2]|0)+1376>>2]>>15)+1>>1)|0)|0;c[k>>2]=j-(c[k>>2]<<5);c[k>>2]=(yd(c[k>>2]|0)|0)<<8}else{c[k>>2]=_(c[k>>2]>>16,c[k>>2]>>16)|0;j=_(c[(c[r>>2]|0)+1376>>2]>>16,c[(c[r>>2]|0)+1376>>2]>>16)|0;c[k>>2]=j-(c[k>>2]<<5);c[k>>2]=(yd(c[k>>2]|0)|0)<<16}Cd(h+64|0,c[r>>2]|0,c[k>>2]|0,c[n>>2]|0,(c[r>>2]|0)+1380|0);ag(p,(c[r>>2]|0)+1280|0,c[(c[l>>2]|0)+2340>>2]|0);g=h;e=(c[r>>2]|0)+1312|0;f=g+64|0;do{c[g>>2]=c[e>>2];g=g+4|0;e=e+4|0}while((g|0)<(f|0));c[q>>2]=0;while(1){if((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_(c[h+(16+(c[q>>2]|0)-8<<2)>>2]&65535,b[p+14>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-9<<2)>>2]>>16,b[p+16>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-9<<2)>>2]&65535,b[p+16>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-10<<2)>>2]>>16,b[p+18>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-10<<2)>>2]&65535,b[p+18>>1]|0)|0)>>16));if((c[(c[l>>2]|0)+2340>>2]|0)==16){k=_(c[h+(16+(c[q>>2]|0)-11<<2)>>2]>>16,b[p+20>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-11<<2)>>2]&65535,b[p+20>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-12<<2)>>2]>>16,b[p+22>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-12<<2)>>2]&65535,b[p+22>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-13<<2)>>2]>>16,b[p+24>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-13<<2)>>2]&65535,b[p+24>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-14<<2)>>2]>>16,b[p+26>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-14<<2)>>2]&65535,b[p+26>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-15<<2)>>2]>>16,b[p+28>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-15<<2)>>2]&65535,b[p+28>>1]|0)|0)>>16));k=_(c[h+(16+(c[q>>2]|0)-16<<2)>>2]>>16,b[p+30>>1]|0)|0;c[s>>2]=(c[s>>2]|0)+(k+((_(c[h+(16+(c[q>>2]|0)-16<<2)>>2]&65535,b[p+30>>1]|0)|0)>>16))}c[h+(16+(c[q>>2]|0)<<2)>>2]=(c[h+(16+(c[q>>2]|0)<<2)>>2]|0)+(c[s>>2]<<4);if(((b[(c[m>>2]|0)+(c[q>>2]<<1)>>1]|0)+((c[h+(16+(c[q>>2]|0)<<2)>>2]>>9)+1>>1)|0)<=32767)if(((b[(c[m>>2]|0)+(c[q>>2]<<1)>>1]|0)+((c[h+(16+(c[q>>2]|0)<<2)>>2]>>9)+1>>1)|0)<-32768)g=-32768;else g=(b[(c[m>>2]|0)+(c[q>>2]<<1)>>1]|0)+((c[h+(16+(c[q>>2]|0)<<2)>>2]>>9)+1>>1)|0;else g=32767;b[(c[m>>2]|0)+(c[q>>2]<<1)>>1]=g;c[q>>2]=(c[q>>2]|0)+1}g=(c[r>>2]|0)+1312|0;e=h+(c[n>>2]<<2)|0;f=g+64|0;do{c[g>>2]=c[e>>2];g=g+4|0;e=e+4|0}while((g|0)<(f|0));na(c[o>>2]|0);i=t;return}function yd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}zd(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function zd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=Ad(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(Bd(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function Ad(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function Bd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function Cd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+48|0;g=q+32|0;h=q+28|0;j=q+24|0;k=q+20|0;l=q+16|0;p=q+12|0;n=q+8|0;o=q+4|0;m=q;c[g>>2]=a;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=255;while(1){if((c[m>>2]|0)<=(c[k>>2]|0))break;c[m>>2]=c[m>>2]>>1}c[p>>2]=c[c[l>>2]>>2];c[n>>2]=0;while(1){d=c[p>>2]|0;if((c[n>>2]|0)>=(c[k>>2]|0))break;c[p>>2]=907633515+(_(d,196314165)|0);c[o>>2]=c[p>>2]>>24&c[m>>2];f=_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;f=f+((_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;if((f+(_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0)<=32767){f=_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;f=f+((_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;if((f+(_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0)<-32768)d=-32768;else{d=_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;d=d+((_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;d=d+(_(c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0}}else d=32767;c[(c[g>>2]|0)+(c[n>>2]<<2)>>2]=(d&65535)<<16>>16;c[n>>2]=(c[n>>2]|0)+1}c[c[l>>2]>>2]=d;i=q;return}function Dd(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;s=i;i=i+48|0;j=s+40|0;v=s+36|0;k=s+32|0;t=s+28|0;u=s+24|0;l=s+20|0;m=s+16|0;p=s+12|0;q=s+8|0;n=s+44|0;r=s+4|0;o=s;c[j>>2]=b;c[v>>2]=d;c[k>>2]=e;c[t>>2]=f;c[u>>2]=g;c[l>>2]=h;a[n+1>>0]=0;c[r>>2]=c[v>>2];c[m>>2]=(((c[u>>2]|0)+(c[t>>2]<<1)&65535)<<16>>16)*7;c[o>>2]=30184+(c[m>>2]|0);c[k>>2]=(c[k>>2]|0)+8>>4;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[k>>2]|0))break;c[q>>2]=c[(c[l>>2]|0)+(c[m>>2]<<2)>>2];a:do if((c[q>>2]|0)>0){a[n>>0]=a[(c[o>>2]|0)+((c[q>>2]&31|0)<6?c[q>>2]&31:6)>>0]|0;c[p>>2]=0;while(1){if((c[p>>2]|0)>=16)break a;if(a[(c[r>>2]|0)+(c[p>>2]|0)>>0]|0)qc(c[j>>2]|0,(a[(c[r>>2]|0)+(c[p>>2]|0)>>0]>>15)+1|0,n,8);c[p>>2]=(c[p>>2]|0)+1}}while(0);c[r>>2]=(c[r>>2]|0)+16;c[m>>2]=(c[m>>2]|0)+1}i=s;return}function Ed(d,e,f,g,h,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;t=i;i=i+48|0;k=t+40|0;w=t+36|0;l=t+32|0;u=t+28|0;v=t+24|0;m=t+20|0;n=t+16|0;q=t+12|0;r=t+8|0;o=t+44|0;s=t+4|0;p=t;c[k>>2]=d;c[w>>2]=e;c[l>>2]=f;c[u>>2]=g;c[v>>2]=h;c[m>>2]=j;a[o+1>>0]=0;c[s>>2]=c[w>>2];c[n>>2]=(((c[v>>2]|0)+(c[u>>2]<<1)&65535)<<16>>16)*7;c[p>>2]=30184+(c[n>>2]|0);c[l>>2]=(c[l>>2]|0)+8>>4;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[l>>2]|0))break;c[r>>2]=c[(c[m>>2]|0)+(c[n>>2]<<2)>>2];a:do if((c[r>>2]|0)>0){a[o>>0]=a[(c[p>>2]|0)+((c[r>>2]&31|0)<6?c[r>>2]&31:6)>>0]|0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=16)break a;if((b[(c[s>>2]|0)+(c[q>>2]<<1)>>1]|0)>0){v=((ec(c[k>>2]|0,o,8)|0)<<1)-1|0;w=(c[s>>2]|0)+(c[q>>2]<<1)|0;b[w>>1]=_(b[w>>1]|0,v)|0}c[q>>2]=(c[q>>2]|0)+1}}while(0);c[s>>2]=(c[s>>2]|0)+32;c[n>>2]=(c[n>>2]|0)+1}i=t;return}function Fd(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;oj(c[d>>2]|0,0,4260)|0;c[(c[d>>2]|0)+2376>>2]=1;c[c[d>>2]>>2]=65536;wd(c[d>>2]|0);ze(c[d>>2]|0);i=b;return 0}function Gd(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;M=i;i=i+144|0;o=M+100|0;p=M+96|0;q=M+92|0;l=M+88|0;r=M+84|0;B=M+80|0;D=M+76|0;E=M+72|0;L=M+68|0;J=M+64|0;z=M+60|0;K=M+56|0;t=M+52|0;v=M+48|0;I=M+44|0;u=M+104|0;y=M+40|0;x=M+36|0;w=M+32|0;C=M+28|0;A=M+24|0;n=M+20|0;m=M+16|0;G=M+12|0;F=M+8|0;H=M+4|0;s=M;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[l>>2]=g;c[r>>2]=h;c[E>>2]=0;f=c[(c[o>>2]|0)+2336>>2]|0;c[s>>2]=ia()|0;g=i;i=i+((1*(f<<1)|0)+15&-16)|0;f=i;i=i+((1*((c[(c[o>>2]|0)+2336>>2]|0)+(c[(c[o>>2]|0)+2328>>2]|0)<<2)|0)+15&-16)|0;j=i;i=i+((1*(c[(c[o>>2]|0)+2332>>2]<<2)|0)+15&-16)|0;k=i;i=i+((1*((c[(c[o>>2]|0)+2332>>2]|0)+16<<2)|0)+15&-16)|0;c[m>>2]=b[24558+(a[(c[o>>2]|0)+2736+29>>0]>>1<<2)+(a[(c[o>>2]|0)+2736+30>>0]<<1)>>1];if((a[(c[o>>2]|0)+2736+31>>0]|0)<4)c[z>>2]=1;else c[z>>2]=0;c[n>>2]=a[(c[o>>2]|0)+2736+34>>0];c[B>>2]=0;while(1){if((c[B>>2]|0)>=(c[(c[o>>2]|0)+2328>>2]|0))break;c[n>>2]=907633515+(_(c[n>>2]|0,196314165)|0);c[(c[o>>2]|0)+4+(c[B>>2]<<2)>>2]=b[(c[l>>2]|0)+(c[B>>2]<<1)>>1]<<14;h=(c[o>>2]|0)+4+(c[B>>2]<<2)|0;d=c[h>>2]|0;if((c[(c[o>>2]|0)+4+(c[B>>2]<<2)>>2]|0)<=0){if((d|0)<0){e=(c[o>>2]|0)+4+(c[B>>2]<<2)|0;c[e>>2]=(c[e>>2]|0)+1280}}else c[h>>2]=d-1280;e=(c[o>>2]|0)+4+(c[B>>2]<<2)|0;c[e>>2]=(c[e>>2]|0)+(c[m>>2]<<4);if((c[n>>2]|0)<0)c[(c[o>>2]|0)+4+(c[B>>2]<<2)>>2]=0-(c[(c[o>>2]|0)+4+(c[B>>2]<<2)>>2]|0);c[n>>2]=(c[n>>2]|0)+(b[(c[l>>2]|0)+(c[B>>2]<<1)>>1]|0);c[B>>2]=(c[B>>2]|0)+1}h=k;d=(c[o>>2]|0)+1284|0;e=h+64|0;do{c[h>>2]=c[d>>2];h=h+4|0;d=d+4|0}while((h|0)<(e|0));c[F>>2]=(c[o>>2]|0)+4;c[I>>2]=c[q>>2];c[J>>2]=c[(c[o>>2]|0)+2336>>2];c[D>>2]=0;while(1){if((c[D>>2]|0)>=(c[(c[o>>2]|0)+2324>>2]|0))break;c[H>>2]=j;c[t>>2]=(c[p>>2]|0)+32+(c[D>>2]>>1<<5);pj(u|0,c[t>>2]|0,c[(c[o>>2]|0)+2340>>2]<<1|0)|0;c[v>>2]=(c[p>>2]|0)+96+((c[D>>2]|0)*5<<1);c[K>>2]=a[(c[o>>2]|0)+2736+29>>0];c[w>>2]=c[(c[p>>2]|0)+16+(c[D>>2]<<2)>>2]>>6;c[C>>2]=Hd(c[(c[p>>2]|0)+16+(c[D>>2]<<2)>>2]|0,47)|0;a:do if((c[(c[p>>2]|0)+16+(c[D>>2]<<2)>>2]|0)!=(c[c[o>>2]>>2]|0)){c[A>>2]=Jd(c[c[o>>2]>>2]|0,c[(c[p>>2]|0)+16+(c[D>>2]<<2)>>2]|0,16)|0;c[B>>2]=0;while(1){if((c[B>>2]|0)>=16)break a;n=_(c[A>>2]>>16,(c[k+(c[B>>2]<<2)>>2]&65535)<<16>>16)|0;n=n+((_(c[A>>2]&65535,(c[k+(c[B>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;n=n+(_(c[A>>2]|0,(c[k+(c[B>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[k+(c[B>>2]<<2)>>2]=n;c[B>>2]=(c[B>>2]|0)+1}}else c[A>>2]=65536;while(0);c[c[o>>2]>>2]=c[(c[p>>2]|0)+16+(c[D>>2]<<2)>>2];if((c[(c[o>>2]|0)+4160>>2]|0?(c[(c[o>>2]|0)+4164>>2]|0)==2:0)?((c[D>>2]|0)<2?(a[(c[o>>2]|0)+2736+29>>0]|0)!=2:0):0){n=c[v>>2]|0;b[n>>1]=0;b[n+2>>1]=0;b[n+4>>1]=0;b[n+6>>1]=0;b[n+8>>1]=0;b[(c[v>>2]|0)+4>>1]=4096;c[K>>2]=2;c[(c[p>>2]|0)+(c[D>>2]<<2)>>2]=c[(c[o>>2]|0)+2308>>2]}b:do if((c[K>>2]|0)==2){c[E>>2]=c[(c[p>>2]|0)+(c[D>>2]<<2)>>2];if(c[D>>2]|0?!((c[D>>2]|0)==2&(c[z>>2]|0)!=0):0){if((c[A>>2]|0)==65536)break;c[B>>2]=0;while(1){if((c[B>>2]|0)>=((c[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(n+((_(c[k+(16+(c[B>>2]|0)-8<<2)>>2]&65535,b[u+14>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-9<<2)>>2]>>16,b[u+16>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-9<<2)>>2]&65535,b[u+16>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-10<<2)>>2]>>16,b[u+18>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-10<<2)>>2]&65535,b[u+18>>1]|0)|0)>>16));if((c[(c[o>>2]|0)+2340>>2]|0)==16){n=_(c[k+(16+(c[B>>2]|0)-11<<2)>>2]>>16,b[u+20>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-11<<2)>>2]&65535,b[u+20>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-12<<2)>>2]>>16,b[u+22>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-12<<2)>>2]&65535,b[u+22>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-13<<2)>>2]>>16,b[u+24>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-13<<2)>>2]&65535,b[u+24>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-14<<2)>>2]>>16,b[u+26>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-14<<2)>>2]&65535,b[u+26>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-15<<2)>>2]>>16,b[u+28>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-15<<2)>>2]&65535,b[u+28>>1]|0)|0)>>16));n=_(c[k+(16+(c[B>>2]|0)-16<<2)>>2]>>16,b[u+30>>1]|0)|0;c[x>>2]=(c[x>>2]|0)+(n+((_(c[k+(16+(c[B>>2]|0)-16<<2)>>2]&65535,b[u+30>>1]|0)|0)>>16))}c[k+(16+(c[B>>2]|0)<<2)>>2]=(c[(c[H>>2]|0)+(c[B>>2]<<2)>>2]|0)+(c[x>>2]<<4);n=_(c[k+(16+(c[B>>2]|0)<<2)>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;n=n+((_(c[k+(16+(c[B>>2]|0)<<2)>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16)|0;if(((n+(_(c[k+(16+(c[B>>2]|0)<<2)>>2]|0,(c[w>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){n=_(c[k+(16+(c[B>>2]|0)<<2)>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;n=n+((_(c[k+(16+(c[B>>2]|0)<<2)>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16)|0;if(((n+(_(c[k+(16+(c[B>>2]|0)<<2)>>2]|0,(c[w>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)h=-32768;else{h=_(c[k+(16+(c[B>>2]|0)<<2)>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;h=h+((_(c[k+(16+(c[B>>2]|0)<<2)>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16)|0;h=(h+(_(c[k+(16+(c[B>>2]|0)<<2)>>2]|0,(c[w>>2]>>15)+1>>1)|0)>>7)+1>>1}}else h=32767;b[(c[I>>2]|0)+(c[B>>2]<<1)>>1]=h;c[B>>2]=(c[B>>2]|0)+1}h=k;d=k+(c[(c[o>>2]|0)+2332>>2]<<2)|0;e=h+64|0;do{c[h>>2]=c[d>>2];h=h+4|0;d=d+4|0}while((h|0)<(e|0));c[F>>2]=(c[F>>2]|0)+(c[(c[o>>2]|0)+2332>>2]<<2);c[I>>2]=(c[I>>2]|0)+(c[(c[o>>2]|0)+2332>>2]<<1);c[D>>2]=(c[D>>2]|0)+1}h=(c[o>>2]|0)+1284|0;d=k;e=h+64|0;do{c[h>>2]=c[d>>2];h=h+4|0;d=d+4|0}while((h|0)<(e|0));na(c[s>>2]|0);i=M;return}function Hd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+48|0;f=h+32|0;n=h+28|0;d=h+24|0;j=h+20|0;g=h+16|0;k=h+12|0;m=h+8|0;l=h+4|0;e=h;c[n>>2]=a;c[d>>2]=b;b=c[n>>2]|0;c[j>>2]=(Id((c[n>>2]|0)>0?b:0-b|0)|0)-1;c[m>>2]=c[n>>2]<>2];c[k>>2]=536870911/(c[m>>2]>>16|0)|0;c[e>>2]=c[k>>2]<<16;b=_(c[m>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=536870912-(b+((_(c[m>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))<<3;b=_(c[l>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=(c[e>>2]|0)+(b+((_(c[l>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))|0;c[e>>2]=b+(_(c[l>>2]|0,(c[k>>2]>>15)+1>>1)|0);c[g>>2]=61-(c[j>>2]|0)-(c[d>>2]|0);b=c[g>>2]|0;if((c[g>>2]|0)>0)if((b|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];n=c[f>>2]|0;i=h;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;i=h;return n|0}a=c[e>>2]|0;d=0-(c[g>>2]|0)|0;do if((-2147483648>>0-b|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>d|0)){b=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){b=2147483647>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>d|0)){b=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){b=-2147483648>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}while(0);c[f>>2]=b<<0-(c[g>>2]|0);n=c[f>>2]|0;i=h;return n|0}function Id(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function Jd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=i;i=i+48|0;f=h+40|0;q=h+36|0;p=h+32|0;j=h+28|0;l=h+24|0;k=h+20|0;g=h+16|0;m=h+12|0;n=h+8|0;o=h+4|0;e=h;c[q>>2]=a;c[p>>2]=b;c[j>>2]=d;b=c[q>>2]|0;c[l>>2]=(Id((c[q>>2]|0)>0?b:0-b|0)|0)-1;c[n>>2]=c[q>>2]<>2];b=c[p>>2]|0;c[k>>2]=(Id((c[p>>2]|0)>0?b:0-b|0)|0)-1;c[o>>2]=c[p>>2]<>2];c[m>>2]=536870911/(c[o>>2]>>16|0)|0;b=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=b+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16);b=c[n>>2]|0;a=c[o>>2]|0;d=c[e>>2]|0;d=yj(a|0,((a|0)<0)<<31>>31|0,d|0,((d|0)<0)<<31>>31|0)|0;d=nj(d|0,C|0,32)|0;c[n>>2]=b-(d<<3);d=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=(c[e>>2]|0)+(d+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16));c[g>>2]=29+(c[l>>2]|0)-(c[k>>2]|0)-(c[j>>2]|0);d=c[g>>2]|0;if((c[g>>2]|0)>=0)if((d|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];q=c[f>>2]|0;i=h;return q|0}else{c[f>>2]=0;q=c[f>>2]|0;i=h;return q|0}a=c[e>>2]|0;b=0-(c[g>>2]|0)|0;do if((-2147483648>>0-d|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>b|0)){d=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){d=2147483647>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>b|0)){d=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){d=-2147483648>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}while(0);c[f>>2]=d<<0-(c[g>>2]|0);q=c[f>>2]|0;i=h;return q|0}function Kd(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=i;i=i+192|0;k=x+180|0;l=x+176|0;m=x+172|0;n=x+168|0;o=x+164|0;p=x+160|0;q=x+156|0;s=x+152|0;t=x+148|0;v=x+144|0;u=x+4|0;r=x;c[k>>2]=b;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=j;c[v>>2]=0;c[s>>2]=c[(c[k>>2]|0)+2328>>2];c[u+136>>2]=0;do if(!(c[o>>2]|0))w=4;else{if((c[o>>2]|0)==2?(c[(c[k>>2]|0)+2420+(c[(c[k>>2]|0)+2388>>2]<<2)>>2]|0)==1:0){w=4;break}Ae(c[k>>2]|0,u,c[m>>2]|0,1,c[q>>2]|0)}while(0);if((w|0)==4){d=(c[s>>2]|0)+16-1&-16;c[r>>2]=ia()|0;w=i;i=i+((1*(d<<1)|0)+15&-16)|0;Md(c[k>>2]|0,c[l>>2]|0,c[(c[k>>2]|0)+2388>>2]|0,c[o>>2]|0,c[p>>2]|0);Nd(c[l>>2]|0,w,a[(c[k>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|0)==1)a[(c[g>>2]|0)+2736+31>>0]=4;if((a[(c[g>>2]|0)+2736+31>>0]|0)<4){c[l>>2]=0;while(1){if((c[l>>2]|0)>=(c[(c[g>>2]|0)+2340>>2]|0))break;q=(b[(c[g>>2]|0)+2344+(c[l>>2]<<1)>>1]|0)+((_(a[(c[g>>2]|0)+2736+31>>0]|0,(b[o+(c[l>>2]<<1)>>1]|0)-(b[(c[g>>2]|0)+2344+(c[l>>2]<<1)>>1]|0)|0)|0)>>2)&65535;b[n+(c[l>>2]<<1)>>1]=q;c[l>>2]=(c[l>>2]|0)+1}ag((c[h>>2]|0)+32|0,n,c[(c[g>>2]|0)+2340>>2]|0)}else pj((c[h>>2]|0)+32|0,(c[h>>2]|0)+32+32|0,c[(c[g>>2]|0)+2340>>2]<<1|0)|0;pj((c[g>>2]|0)+2344|0,o|0,c[(c[g>>2]|0)+2340>>2]<<1|0)|0;if(c[(c[g>>2]|0)+4160>>2]|0){Pf((c[h>>2]|0)+32|0,c[(c[g>>2]|0)+2340>>2]|0,63570);Pf((c[h>>2]|0)+32+32|0,c[(c[g>>2]|0)+2340>>2]|0,63570)}if((a[(c[g>>2]|0)+2736+29>>0]|0)!=2){oj(c[h>>2]|0,0,c[(c[g>>2]|0)+2324>>2]<<2|0)|0;oj((c[h>>2]|0)+96|0,0,(c[(c[g>>2]|0)+2324>>2]|0)*5<<1|0)|0;a[(c[g>>2]|0)+2736+32>>0]=0;c[(c[h>>2]|0)+136>>2]=0;i=p;return}Qf(b[(c[g>>2]|0)+2736+26>>1]|0,a[(c[g>>2]|0)+2736+28>>0]|0,c[h>>2]|0,c[(c[g>>2]|0)+2316>>2]|0,c[(c[g>>2]|0)+2324>>2]|0);c[k>>2]=c[17644+(a[(c[g>>2]|0)+2736+32>>0]<<2)>>2];c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[(c[g>>2]|0)+2324>>2]|0))break;c[j>>2]=a[(c[g>>2]|0)+2736+4+(c[m>>2]|0)>>0];c[l>>2]=0;while(1){if((c[l>>2]|0)>=5)break;b[(c[h>>2]|0)+96+(((c[m>>2]|0)*5|0)+(c[l>>2]|0)<<1)>>1]=a[(c[k>>2]|0)+(((c[j>>2]|0)*5|0)+(c[l>>2]|0))>>0]<<7;c[l>>2]=(c[l>>2]|0)+1}c[m>>2]=(c[m>>2]|0)+1}c[j>>2]=a[(c[g>>2]|0)+2736+33>>0];c[(c[h>>2]|0)+136>>2]=b[24566+(c[j>>2]<<1)>>1];i=p;return}function Md(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;t=i;i=i+96|0;j=t+36|0;k=t+32|0;u=t+28|0;v=t+24|0;l=t+20|0;q=t+16|0;r=t+12|0;m=t+8|0;n=t+4|0;o=t;p=t+40|0;s=t+72|0;c[j>>2]=d;c[k>>2]=e;c[u>>2]=f;c[v>>2]=g;c[l>>2]=h;if(!(c[v>>2]|0)?!(c[(c[j>>2]|0)+2404+(c[u>>2]<<2)>>2]|0):0)c[m>>2]=ec(c[k>>2]|0,29024,8)|0;else c[m>>2]=(ec(c[k>>2]|0,29020,8)|0)+2;a[(c[j>>2]|0)+2736+29>>0]=c[m>>2]>>1;a[(c[j>>2]|0)+2736+30>>0]=c[m>>2]&1;f=c[k>>2]|0;if((c[l>>2]|0)==2){v=(ec(f,26771,8)|0)&255;a[(c[j>>2]|0)+2736>>0]=v}else{u=(ec(f,26747+(a[(c[j>>2]|0)+2736+29>>0]<<3)|0,8)|0)<<3&255;a[(c[j>>2]|0)+2736>>0]=u;u=((ec(c[k>>2]|0,29049,8)|0)&255)<<24>>24;v=(c[j>>2]|0)+2736|0;a[v>>0]=(a[v>>0]|0)+u}c[q>>2]=1;while(1){f=c[k>>2]|0;if((c[q>>2]|0)>=(c[(c[j>>2]|0)+2324>>2]|0))break;v=(ec(f,26771,8)|0)&255;a[(c[j>>2]|0)+2736+(c[q>>2]|0)>>0]=v;c[q>>2]=(c[q>>2]|0)+1}v=_(a[(c[j>>2]|0)+2736+29>>0]>>1,b[c[(c[j>>2]|0)+2732>>2]>>1]|0)|0;v=(ec(f,(c[(c[(c[j>>2]|0)+2732>>2]|0)+12>>2]|0)+v|0,8)|0)&255;a[(c[j>>2]|0)+2736+8>>0]=v;nf(p,s,c[(c[j>>2]|0)+2732>>2]|0,a[(c[j>>2]|0)+2736+8>>0]|0);c[q>>2]=0;while(1){if((c[q>>2]|0)>=(b[(c[(c[j>>2]|0)+2732>>2]|0)+2>>1]|0))break;c[m>>2]=ec(c[k>>2]|0,(c[(c[(c[j>>2]|0)+2732>>2]|0)+24>>2]|0)+(b[p+(c[q>>2]<<1)>>1]|0)|0,8)|0;if(c[m>>2]|0){if((c[m>>2]|0)==8){v=ec(c[k>>2]|0,29057,8)|0;c[m>>2]=(c[m>>2]|0)+v}}else{v=ec(c[k>>2]|0,29057,8)|0;c[m>>2]=(c[m>>2]|0)-v}a[(c[j>>2]|0)+2736+8+((c[q>>2]|0)+1)>>0]=(c[m>>2]|0)-4;c[q>>2]=(c[q>>2]|0)+1}if((c[(c[j>>2]|0)+2324>>2]|0)==4){v=(ec(c[k>>2]|0,29026,8)|0)&255;a[(c[j>>2]|0)+2736+31>>0]=v}else a[(c[j>>2]|0)+2736+31>>0]=4;if((a[(c[j>>2]|0)+2736+29>>0]|0)!=2){v=c[j>>2]|0;v=v+2736|0;v=v+29|0;v=a[v>>0]|0;v=v<<24>>24;u=c[j>>2]|0;u=u+2396|0;c[u>>2]=v;u=c[k>>2]|0;u=ec(u,29034,8)|0;u=u&255;v=c[j>>2]|0;v=v+2736|0;v=v+34|0;a[v>>0]=u;i=t;return}c[n>>2]=1;if(((c[l>>2]|0)==2?(c[(c[j>>2]|0)+2396>>2]|0)==2:0)?(c[o>>2]=((ec(c[k>>2]|0,29096,8)|0)&65535)<<16>>16,(c[o>>2]|0)>0):0){c[o>>2]=(c[o>>2]|0)-9;b[(c[j>>2]|0)+2736+26>>1]=(b[(c[j>>2]|0)+2400>>1]|0)+(c[o>>2]|0);c[n>>2]=0}if(c[n>>2]|0){u=((ec(c[k>>2]|0,29064,8)|0)&65535)<<16>>16;u=(_(u,c[(c[j>>2]|0)+2316>>2]>>1)|0)&65535;b[(c[j>>2]|0)+2736+26>>1]=u;u=((ec(c[k>>2]|0,c[(c[j>>2]|0)+2380>>2]|0,8)|0)&65535)<<16>>16;v=(c[j>>2]|0)+2736+26|0;b[v>>1]=(b[v>>1]|0)+u}b[(c[j>>2]|0)+2400>>1]=b[(c[j>>2]|0)+2736+26>>1]|0;v=(ec(c[k>>2]|0,c[(c[j>>2]|0)+2384>>2]|0,8)|0)&255;a[(c[j>>2]|0)+2736+28>>0]=v;v=(ec(c[k>>2]|0,26812,8)|0)&255;a[(c[j>>2]|0)+2736+32>>0]=v;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[(c[j>>2]|0)+2324>>2]|0))break;v=(ec(c[k>>2]|0,c[17620+(a[(c[j>>2]|0)+2736+32>>0]<<2)>>2]|0,8)|0)&255;a[(c[j>>2]|0)+2736+4+(c[r>>2]|0)>>0]=v;c[r>>2]=(c[r>>2]|0)+1}if(!(c[l>>2]|0)){v=(ec(c[k>>2]|0,29017,8)|0)&255;a[(c[j>>2]|0)+2736+33>>0]=v;v=c[j>>2]|0;v=v+2736|0;v=v+29|0;v=a[v>>0]|0;v=v<<24>>24;u=c[j>>2]|0;u=u+2396|0;c[u>>2]=v;u=c[k>>2]|0;u=ec(u,29034,8)|0;u=u&255;v=c[j>>2]|0;v=v+2736|0;v=v+34|0;a[v>>0]=u;i=t;return}else{a[(c[j>>2]|0)+2736+33>>0]=0;v=c[j>>2]|0;v=v+2736|0;v=v+29|0;v=a[v>>0]|0;v=v<<24>>24;u=c[j>>2]|0;u=u+2396|0;c[u>>2]=v;u=c[k>>2]|0;u=ec(u,29034,8)|0;u=u&255;v=c[j>>2]|0;v=v+2736|0;v=v+34|0;a[v>>0]=u;i=t;return}}function Nd(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=i;i=i+224|0;k=y+212|0;l=y+208|0;m=y+204|0;n=y+200|0;o=y+196|0;q=y+192|0;s=y+188|0;t=y+184|0;r=y+180|0;p=y+176|0;u=y+172|0;h=y+168|0;x=y+88|0;v=y+8|0;w=y+4|0;j=y;c[k>>2]=a;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[h>>2]=ec(c[k>>2]|0,29523+((c[m>>2]>>1)*9|0)|0,8)|0;c[r>>2]=c[o>>2]>>4;if((c[r>>2]<<4|0)<(c[o>>2]|0))c[r>>2]=(c[r>>2]|0)+1;c[j>>2]=29181+((c[h>>2]|0)*18|0);c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[r>>2]|0))break;c[v+(c[q>>2]<<2)>>2]=0;e=ec(c[k>>2]|0,c[j>>2]|0,8)|0;c[x+(c[q>>2]<<2)>>2]=e;while(1){h=c[q>>2]|0;if((c[x+(c[q>>2]<<2)>>2]|0)!=17)break;e=v+(h<<2)|0;c[e>>2]=(c[e>>2]|0)+1;e=ec(c[k>>2]|0,29343+((c[v+(c[q>>2]<<2)>>2]|0)==10&1)|0,8)|0;c[x+(c[q>>2]<<2)>>2]=e}c[q>>2]=h+1}c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[r>>2]|0))break;h=(c[l>>2]|0)+((c[q>>2]&65535)<<16>>16<<4<<1)|0;if((c[x+(c[q>>2]<<2)>>2]|0)>0)Se(h,c[k>>2]|0,c[x+(c[q>>2]<<2)>>2]|0);else{g=h+32|0;do{b[h>>1]=0;h=h+2|0}while((h|0)<(g|0))}c[q>>2]=(c[q>>2]|0)+1}c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[r>>2]|0))break;if((c[v+(c[q>>2]<<2)>>2]|0)>0){c[u>>2]=c[v+(c[q>>2]<<2)>>2];c[w>>2]=(c[l>>2]|0)+((c[q>>2]&65535)<<16>>16<<4<<1);c[t>>2]=0;while(1){if((c[t>>2]|0)>=16)break;c[p>>2]=b[(c[w>>2]|0)+(c[t>>2]<<1)>>1];c[s>>2]=0;while(1){h=c[p>>2]|0;if((c[s>>2]|0)>=(c[u>>2]|0))break;c[p>>2]=h<<1;j=ec(c[k>>2]|0,29015,8)|0;c[p>>2]=(c[p>>2]|0)+j;c[s>>2]=(c[s>>2]|0)+1}b[(c[w>>2]|0)+(c[t>>2]<<1)>>1]=h;c[t>>2]=(c[t>>2]|0)+1}j=x+(c[q>>2]<<2)|0;c[j>>2]=c[j>>2]|c[u>>2]<<5}c[q>>2]=(c[q>>2]|0)+1}Ed(c[k>>2]|0,c[l>>2]|0,c[o>>2]|0,c[m>>2]|0,c[n>>2]|0,x);i=y;return}function Od(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;g=l+16|0;h=l+12|0;f=l+8|0;j=l+4|0;k=l;c[g>>2]=b;c[h>>2]=d;c[f>>2]=e;c[k>>2]=0;c[(c[g>>2]|0)+2332>>2]=((c[h>>2]&65535)<<16>>16)*5;c[j>>2]=_((c[(c[g>>2]|0)+2324>>2]&65535)<<16>>16,(c[(c[g>>2]|0)+2332>>2]&65535)<<16>>16)|0;if(!((c[(c[g>>2]|0)+2316>>2]|0)==(c[h>>2]|0)?(c[(c[g>>2]|0)+2320>>2]|0)==(c[f>>2]|0):0)){b=ig((c[g>>2]|0)+2432|0,((c[h>>2]&65535)<<16>>16)*1e3|0,c[f>>2]|0,0)|0;c[k>>2]=(c[k>>2]|0)+b;c[(c[g>>2]|0)+2320>>2]=c[f>>2]}if((c[(c[g>>2]|0)+2316>>2]|0)==(c[h>>2]|0)?(c[j>>2]|0)==(c[(c[g>>2]|0)+2328>>2]|0):0){k=c[k>>2]|0;i=l;return k|0}f=(c[(c[g>>2]|0)+2324>>2]|0)==4;e=(c[g>>2]|0)+2384|0;do if((c[h>>2]|0)==8)if(f){c[e>>2]=29151;break}else{c[e>>2]=29174;break}else if(f){c[e>>2]=29117;break}else{c[e>>2]=29162;break}while(0);if((c[(c[g>>2]|0)+2316>>2]|0)!=(c[h>>2]|0)){c[(c[g>>2]|0)+2336>>2]=((c[h>>2]&65535)<<16>>16)*20;f=(c[g>>2]|0)+2340|0;if((c[h>>2]|0)==8|(c[h>>2]|0)==12){c[f>>2]=10;c[(c[g>>2]|0)+2732>>2]=17668}else{c[f>>2]=16;c[(c[g>>2]|0)+2732>>2]=17704}do if((c[h>>2]|0)!=16){if((c[h>>2]|0)==12){c[(c[g>>2]|0)+2380>>2]=29043;break}if((c[h>>2]|0)==8)c[(c[g>>2]|0)+2380>>2]=29034}else c[(c[g>>2]|0)+2380>>2]=29049;while(0);c[(c[g>>2]|0)+2376>>2]=1;c[(c[g>>2]|0)+2308>>2]=100;a[(c[g>>2]|0)+2312>>0]=10;c[(c[g>>2]|0)+4164>>2]=0;oj((c[g>>2]|0)+1348|0,0,960)|0;f=(c[g>>2]|0)+1284|0;e=f+64|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(e|0))}c[(c[g>>2]|0)+2316>>2]=c[h>>2];c[(c[g>>2]|0)+2328>>2]=c[j>>2];k=c[k>>2]|0;i=l;return k|0}function Pd(a){a=a|0;var b=0,d=0,e=0;d=i;i=i+16|0;e=d+4|0;b=d;c[e>>2]=a;c[b>>2]=0;c[c[e>>2]>>2]=8544;i=d;return c[b>>2]|0}function Qd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;g=i;i=i+16|0;b=g+12|0;e=g+8|0;f=g+4|0;d=g;c[b>>2]=a;c[f>>2]=0;c[d>>2]=c[b>>2];c[e>>2]=0;while(1){if((c[e>>2]|0)>=2)break;c[f>>2]=Fd((c[d>>2]|0)+((c[e>>2]|0)*4260|0)|0)|0;c[e>>2]=(c[e>>2]|0)+1}e=(c[b>>2]|0)+8520|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[(c[b>>2]|0)+8540>>2]=0;i=g;return c[f>>2]|0}function Rd(d,e,f,g,h,j,k,l){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;P=i;i=i+784|0;y=P+128|0;R=P+124|0;z=P+120|0;A=P+116|0;Q=P+112|0;r=P+108|0;B=P+104|0;C=P+100|0;s=P+96|0;G=P+92|0;I=P+88|0;F=P+84|0;M=P+80|0;J=P+76|0;n=P+72|0;N=P+64|0;u=P+56|0;L=P+52|0;K=P+48|0;E=P+44|0;w=P+40|0;O=P+36|0;x=P+32|0;m=P+28|0;p=P+136|0;o=P+24|0;D=P+20|0;t=P+16|0;v=P+12|0;H=P;c[R>>2]=d;c[z>>2]=e;c[A>>2]=f;c[Q>>2]=g;c[r>>2]=h;c[B>>2]=j;c[C>>2]=k;c[s>>2]=l;c[F>>2]=0;c[M>>2]=0;c[u>>2]=0;c[u+4>>2]=0;c[K>>2]=c[R>>2];c[E>>2]=c[K>>2];a:do if(c[Q>>2]|0){c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break a;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2388>>2]=0;c[I>>2]=(c[I>>2]|0)+1}}while(0);if((c[(c[z>>2]|0)+4>>2]|0)>(c[(c[K>>2]|0)+8536>>2]|0)){R=Fd((c[E>>2]|0)+4260|0)|0;c[M>>2]=(c[M>>2]|0)+R}if((c[(c[z>>2]|0)+4>>2]|0)==1?(c[(c[K>>2]|0)+8536>>2]|0)==2:0)l=(c[(c[z>>2]|0)+12>>2]|0)==((c[(c[E>>2]|0)+2316>>2]|0)*1e3|0);else l=0;c[O>>2]=l&1;b:do if(!(c[(c[E>>2]|0)+2388>>2]|0)){c[I>>2]=0;c:while(1){if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break b;do if(!(c[(c[z>>2]|0)+16>>2]|0)){c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]=1;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2324>>2]=2}else{if((c[(c[z>>2]|0)+16>>2]|0)==10){c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]=1;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2324>>2]=2;break}if((c[(c[z>>2]|0)+16>>2]|0)==20){c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]=1;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2324>>2]=4;break}if((c[(c[z>>2]|0)+16>>2]|0)==40){c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]=2;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2324>>2]=4;break}if((c[(c[z>>2]|0)+16>>2]|0)!=60){q=23;break c}c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]=3;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2324>>2]=4}while(0);c[m>>2]=(c[(c[z>>2]|0)+12>>2]>>10)+1;if((c[m>>2]|0)!=8&(c[m>>2]|0)!=12&(c[m>>2]|0)!=16){q=25;break}R=Od((c[E>>2]|0)+((c[I>>2]|0)*4260|0)|0,c[m>>2]|0,c[(c[z>>2]|0)+8>>2]|0)|0;c[M>>2]=(c[M>>2]|0)+R;c[I>>2]=(c[I>>2]|0)+1}if((q|0)==23){c[y>>2]=-203;R=c[y>>2]|0;i=P;return R|0}else if((q|0)==25){c[y>>2]=-200;R=c[y>>2]|0;i=P;return R|0}}while(0);do if((c[c[z>>2]>>2]|0)==2?(c[(c[z>>2]|0)+4>>2]|0)==2:0){if((c[(c[K>>2]|0)+8532>>2]|0)!=1?(c[(c[K>>2]|0)+8536>>2]|0)!=1:0)break;c[(c[K>>2]|0)+8520>>2]=0;c[(c[K>>2]|0)+8520+8>>2]=0;pj((c[E>>2]|0)+4260+2432|0,(c[E>>2]|0)+2432|0,300)|0}while(0);c[(c[K>>2]|0)+8532>>2]=c[c[z>>2]>>2];c[(c[K>>2]|0)+8536>>2]=c[(c[z>>2]|0)+4>>2];if((c[(c[z>>2]|0)+8>>2]|0)<=48e3?(c[(c[z>>2]|0)+8>>2]|0)>=8e3:0){d:do if((c[A>>2]|0)!=1?(c[(c[E>>2]|0)+2388>>2]|0)==0:0){c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break;c[G>>2]=0;while(1){R=(c[G>>2]|0)<(c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]|0);l=dc(c[r>>2]|0,1)|0;if(!R)break;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2404+(c[G>>2]<<2)>>2]=l;c[G>>2]=(c[G>>2]|0)+1}c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2416>>2]=l;c[I>>2]=(c[I>>2]|0)+1}c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break;R=(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420|0;c[R>>2]=0;c[R+4>>2]=0;c[R+8>>2]=0;e:do if(c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2416>>2]|0){if((c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]|0)==1){c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420>>2]=1;break}c[n>>2]=(ec(c[r>>2]|0,c[17836+((c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]|0)-2<<2)>>2]|0,8)|0)+1;c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2392>>2]|0))break e;c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420+(c[G>>2]<<2)>>2]=c[n>>2]>>c[G>>2]&1;c[G>>2]=(c[G>>2]|0)+1}}while(0);c[I>>2]=(c[I>>2]|0)+1}if(!(c[A>>2]|0)){c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[(c[E>>2]|0)+2392>>2]|0))break d;c[I>>2]=0;while(1){l=c[G>>2]|0;if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break;if(c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420+(l<<2)>>2]|0){do if((c[I>>2]|0)==0?(c[(c[z>>2]|0)+4>>2]|0)==2:0){xg(c[r>>2]|0,u);if(c[(c[E>>2]|0)+4260+2420+(c[G>>2]<<2)>>2]|0)break;yg(c[r>>2]|0,F)}while(0);do if((c[G>>2]|0)>0){if(!(c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420+((c[G>>2]|0)-1<<2)>>2]|0)){q=64;break}c[o>>2]=2}else q=64;while(0);if((q|0)==64){q=0;c[o>>2]=0}Md((c[E>>2]|0)+((c[I>>2]|0)*4260|0)|0,c[r>>2]|0,c[G>>2]|0,1,c[o>>2]|0);Nd(c[r>>2]|0,p,a[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2736+29>>0]|0,a[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2736+30>>0]|0,c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2328>>2]|0)}c[I>>2]=(c[I>>2]|0)+1}c[G>>2]=l+1}}}while(0);f:do if((c[(c[z>>2]|0)+4>>2]|0)==2){do if(c[A>>2]|0){if((c[A>>2]|0)==2?(c[(c[E>>2]|0)+2420+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0)==1:0)break;c[I>>2]=0;while(1){if((c[I>>2]|0)>=2)break f;c[u+(c[I>>2]<<2)>>2]=b[(c[K>>2]|0)+8520+(c[I>>2]<<1)>>1];c[I>>2]=(c[I>>2]|0)+1}}while(0);xg(c[r>>2]|0,u);if(!((c[A>>2]|0)==0?!(c[(c[E>>2]|0)+4260+2404+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0):0))q=74;do if((q|0)==74){if((c[A>>2]|0)==2?(c[(c[E>>2]|0)+4260+2420+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0)==0:0)break;c[F>>2]=0;break f}while(0);yg(c[r>>2]|0,F)}while(0);if(((c[F>>2]|0)==0?(c[(c[z>>2]|0)+4>>2]|0)==2:0)?(c[(c[K>>2]|0)+8540>>2]|0)==1:0){oj((c[K>>2]|0)+4260+1348|0,0,960)|0;l=(c[K>>2]|0)+4260+1284|0;e=l+64|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(e|0));c[(c[K>>2]|0)+4260+2308>>2]=100;a[(c[K>>2]|0)+4260+2312>>0]=10;c[(c[K>>2]|0)+4260+4164>>2]=0;c[(c[K>>2]|0)+4260+2376>>2]=1}R=_(c[(c[z>>2]|0)+12>>2]|0,c[(c[z>>2]|0)+4>>2]|0)|0;c[x>>2]=(R|0)<(_(c[(c[z>>2]|0)+8>>2]|0,c[c[z>>2]>>2]|0)|0)&1;if(c[x>>2]|0)l=1;else l=_(c[(c[z>>2]|0)+4>>2]|0,(c[(c[E>>2]|0)+2328>>2]|0)+2|0)|0;c[D>>2]=ia()|0;e=i;i=i+((1*(l<<1)|0)+15&-16)|0;if(c[x>>2]|0){c[N>>2]=c[B>>2];c[N+4>>2]=(c[B>>2]|0)+(c[(c[E>>2]|0)+2328>>2]<<1)+4}else{c[N>>2]=e;c[N+4>>2]=e+(c[(c[E>>2]|0)+2328>>2]<<1)+4}if(!(c[A>>2]|0))c[w>>2]=((c[F>>2]|0)!=0^1)&1;else{if(c[(c[K>>2]|0)+8540>>2]|0)if((c[A>>2]|0)==2?(c[(c[z>>2]|0)+4>>2]|0)==2:0)l=(c[(c[E>>2]|0)+4260+2420+(c[(c[E>>2]|0)+4260+2388>>2]<<2)>>2]|0)==1;else l=0;else l=1;c[w>>2]=l&1}c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[(c[z>>2]|0)+4>>2]|0))break;if((c[I>>2]|0)==0|(c[w>>2]|0)!=0){c[t>>2]=(c[(c[E>>2]|0)+2388>>2]|0)-(c[I>>2]|0);g:do if((c[t>>2]|0)<=0)c[v>>2]=0;else{if((c[A>>2]|0)==2){c[v>>2]=c[(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2420+((c[t>>2]|0)-1<<2)>>2]|0?2:0;break}do if((c[I>>2]|0)>0){if(!(c[(c[K>>2]|0)+8540>>2]|0))break;c[v>>2]=1;break g}while(0);c[v>>2]=2}while(0);R=Kd((c[E>>2]|0)+((c[I>>2]|0)*4260|0)|0,c[r>>2]|0,(c[N+(c[I>>2]<<2)>>2]|0)+4|0,J,c[A>>2]|0,c[v>>2]|0,c[s>>2]|0)|0;c[M>>2]=(c[M>>2]|0)+R}else oj((c[N+(c[I>>2]<<2)>>2]|0)+4|0,0,c[J>>2]<<1|0)|0;R=(c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2388|0;c[R>>2]=(c[R>>2]|0)+1;c[I>>2]=(c[I>>2]|0)+1}if((c[c[z>>2]>>2]|0)==2?(c[(c[z>>2]|0)+4>>2]|0)==2:0)uf((c[K>>2]|0)+8520|0,c[N>>2]|0,c[N+4>>2]|0,u,c[(c[E>>2]|0)+2316>>2]|0,c[J>>2]|0);else{R=c[N>>2]|0;Q=(c[K>>2]|0)+8520+4|0;b[R>>1]=b[Q>>1]|0;b[R+2>>1]=b[Q+2>>1]|0;R=(c[K>>2]|0)+8520+4|0;Q=(c[N>>2]|0)+(c[J>>2]<<1)|0;b[R>>1]=b[Q>>1]|0;b[R+2>>1]=b[Q+2>>1]|0}R=_(c[J>>2]|0,c[(c[z>>2]|0)+8>>2]|0)|0;c[c[C>>2]>>2]=(R|0)/(((c[(c[E>>2]|0)+2316>>2]&65535)<<16>>16)*1e3|0)|0;if((c[c[z>>2]>>2]|0)==2)l=c[c[C>>2]>>2]|0;else l=1;e=i;i=i+((1*(l<<1)|0)+15&-16)|0;if((c[c[z>>2]>>2]|0)==2)c[L>>2]=e;else c[L>>2]=c[B>>2];if(c[x>>2]|0)l=_(c[(c[z>>2]|0)+4>>2]|0,(c[(c[E>>2]|0)+2328>>2]|0)+2|0)|0;else l=1;e=i;i=i+((1*(l<<1)|0)+15&-16)|0;if(c[x>>2]|0){R=(_(c[(c[z>>2]|0)+4>>2]|0,(c[(c[E>>2]|0)+2328>>2]|0)+2|0)|0)<<1;pj(e|0,c[B>>2]|0,R+0|0)|0;c[N>>2]=e;c[N+4>>2]=e+(c[(c[E>>2]|0)+2328>>2]<<1)+4}c[I>>2]=0;while(1){l=c[z>>2]|0;if((c[c[z>>2]>>2]|0)<(c[(c[z>>2]|0)+4>>2]|0))l=c[l>>2]|0;else l=c[l+4>>2]|0;if((c[I>>2]|0)>=(l|0))break;R=jg((c[E>>2]|0)+((c[I>>2]|0)*4260|0)+2432|0,c[L>>2]|0,(c[N+(c[I>>2]<<2)>>2]|0)+2|0,c[J>>2]|0)|0;c[M>>2]=(c[M>>2]|0)+R;h:do if((c[c[z>>2]>>2]|0)==2){c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[c[C>>2]>>2]|0))break h;b[(c[B>>2]|0)+((c[I>>2]|0)+(c[G>>2]<<1)<<1)>>1]=b[(c[L>>2]|0)+(c[G>>2]<<1)>>1]|0;c[G>>2]=(c[G>>2]|0)+1}}while(0);c[I>>2]=(c[I>>2]|0)+1}i:do if((c[c[z>>2]>>2]|0)==2){if((c[(c[z>>2]|0)+4>>2]|0)!=1)break;if(c[O>>2]|0){R=jg((c[E>>2]|0)+4260+2432|0,c[L>>2]|0,(c[N>>2]|0)+2|0,c[J>>2]|0)|0;c[M>>2]=(c[M>>2]|0)+R;c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[c[C>>2]>>2]|0))break i;b[(c[B>>2]|0)+(1+(c[G>>2]<<1)<<1)>>1]=b[(c[L>>2]|0)+(c[G>>2]<<1)>>1]|0;c[G>>2]=(c[G>>2]|0)+1}}else{c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[c[C>>2]>>2]|0))break i;b[(c[B>>2]|0)+(1+(c[G>>2]<<1)<<1)>>1]=b[(c[B>>2]|0)+(0+(c[G>>2]<<1)<<1)>>1]|0;c[G>>2]=(c[G>>2]|0)+1}}}while(0);if((c[(c[E>>2]|0)+4164>>2]|0)==2){c[H>>2]=c[4402];c[H+4>>2]=c[4403];c[H+8>>2]=c[4404];R=_(c[(c[E>>2]|0)+2308>>2]|0,c[H+((c[(c[E>>2]|0)+2316>>2]|0)-8>>2<<2)>>2]|0)|0;c[(c[z>>2]|0)+20>>2]=R}else c[(c[z>>2]|0)+20>>2]=0;j:do if((c[A>>2]|0)==1){c[G>>2]=0;while(1){if((c[G>>2]|0)>=(c[(c[K>>2]|0)+8536>>2]|0))break j;a[(c[K>>2]|0)+((c[G>>2]|0)*4260|0)+2312>>0]=10;c[G>>2]=(c[G>>2]|0)+1}}else c[(c[K>>2]|0)+8540>>2]=c[F>>2];while(0);c[y>>2]=c[M>>2];na(c[D>>2]|0);R=c[y>>2]|0;i=P;return R|0}c[M>>2]=-200;c[y>>2]=c[M>>2];R=c[y>>2]|0;i=P;return R|0}function Sd(a){a=a|0;var b=0,d=0,e=0;d=i;i=i+16|0;e=d+4|0;b=d;c[e>>2]=a;c[b>>2]=0;c[c[e>>2]>>2]=24568;i=d;return c[b>>2]|0}function Td(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;e=l+20|0;f=l+16|0;g=l+12|0;j=l+8|0;h=l+4|0;k=l;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;c[k>>2]=0;c[j>>2]=c[e>>2];oj(c[j>>2]|0,0,24568)|0;c[h>>2]=0;while(1){if((c[h>>2]|0)>=2)break;d=xf((c[j>>2]|0)+((c[h>>2]|0)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0}}else{if((e|0)!=1){c[P>>2]=-101;Z=c[P>>2]|0;i=Y;return Z|0}c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;c[V>>2]=xf((c[U>>2]|0)+((c[T>>2]|0)*12240|0)|0,c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5124>>2]|0)|0;c[T>>2]=(c[T>>2]|0)+1}c[X>>2]=c[(c[Q>>2]|0)+24>>2];c[(c[Q>>2]|0)+24>>2]=10;c[W>>2]=c[(c[Q>>2]|0)+36>>2];c[(c[Q>>2]|0)+36>>2]=0;c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break a;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4700>>2]=0;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4712>>2]=1;c[T>>2]=(c[T>>2]|0)+1}}while(0);c[u>>2]=c[(c[Q>>2]|0)+28>>2]>>(c[(c[Q>>2]|0)+4>>2]|0)-1;c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;if((c[T>>2]|0)==1)e=c[(c[U>>2]|0)+4600>>2]|0;else e=0;c[l>>2]=e;Z=yf((c[U>>2]|0)+((c[T>>2]|0)*12240|0)|0,c[Q>>2]|0,c[u>>2]|0,c[(c[U>>2]|0)+24560>>2]|0,c[T>>2]|0,c[l>>2]|0)|0;c[V>>2]=Z;if(Z|0){O=28;break}b:do if(c[n>>2]|0?1:(c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4696>>2]|0)!=0){c[B>>2]=0;while(1){if((c[B>>2]|0)>=(c[(c[U>>2]|0)+5776>>2]|0))break b;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4756+(c[B>>2]<<2)>>2]=0;c[B>>2]=(c[B>>2]|0)+1}}while(0);c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+6112>>2]=c[(c[U>>2]|0)+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G>>2]|0)*10|0,c[(c[U>>2]|0)+12240+4600>>2]|0)|0))e=c[I>>2]|0;else e=_((c[G>>2]|0)*10|0,c[(c[U>>2]|0)+12240+4600>>2]|0)|0;c[I>>2]=e;c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[H>>2]|0))break;b[d+(c[T>>2]<<1)>>1]=b[(c[o>>2]|0)+((c[T>>2]<<1)+1<<1)>>1]|0;c[T>>2]=(c[T>>2]|0)+1}Z=jg((c[U>>2]|0)+12240+5808|0,(c[U>>2]|0)+12240+5128+((c[(c[U>>2]|0)+12240+5772>>2]|0)+2<<1)|0,d,c[H>>2]|0)|0;c[V>>2]=(c[V>>2]|0)+Z;Z=(c[U>>2]|0)+12240+5772|0;c[Z>>2]=(c[Z>>2]|0)+(c[I>>2]|0)}else O=49;do if((O|0)==49){O=0;if((c[c[Q>>2]>>2]|0)==2?(c[(c[Q>>2]|0)+4>>2]|0)==1:0){c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[H>>2]|0))break;c[L>>2]=(b[(c[o>>2]|0)+(c[T>>2]<<1<<1)>>1]|0)+(b[(c[o>>2]|0)+((c[T>>2]<<1)+1<<1)>>1]|0);b[d+(c[T>>2]<<1)>>1]=(c[L>>2]>>1)+(c[L>>2]&1);c[T>>2]=(c[T>>2]|0)+1}Z=jg((c[U>>2]|0)+5808|0,(c[U>>2]|0)+5128+((c[(c[U>>2]|0)+5772>>2]|0)+2<<1)|0,d,c[H>>2]|0)|0;c[V>>2]=(c[V>>2]|0)+Z;c:do if((c[(c[U>>2]|0)+24552>>2]|0)==2?(c[(c[U>>2]|0)+5780>>2]|0)==0:0){Z=jg((c[U>>2]|0)+12240+5808|0,(c[U>>2]|0)+12240+5128+((c[(c[U>>2]|0)+12240+5772>>2]|0)+2<<1)|0,d,c[H>>2]|0)|0;c[V>>2]=(c[V>>2]|0)+Z;c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[U>>2]|0)+4608>>2]|0))break c;b[(c[U>>2]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>>2]|0)+1}a[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4755>>0]=(c[s>>2]|0)>0?1:0;if(c[s>>2]|0?(c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5776>>2]|0)>1:0)qc(c[q>>2]|0,(c[s>>2]|0)-1|0,c[17836+((c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5776>>2]|0)-2<<2)>>2]|0,8);c[T>>2]=(c[T>>2]|0)+1}c[B>>2]=0;while(1){Z=(c[B>>2]|0)<(c[(c[U>>2]|0)+5776>>2]|0);c[T>>2]=0;if(!Z)break;while(1){e=c[B>>2]|0;if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;if(c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4756+(e<<2)>>2]|0){if(((c[T>>2]|0)==0?(c[(c[Q>>2]|0)+4>>2]|0)==2:0)?(zg(c[q>>2]|0,(c[U>>2]|0)+24480+34+((c[B>>2]|0)*6|0)|0),(c[(c[U>>2]|0)+12240+4756+(c[B>>2]<<2)>>2]|0)==0):0)Ag(c[q>>2]|0,a[(c[U>>2]|0)+24480+52+(c[B>>2]|0)>>0]|0);if((c[B>>2]|0)>0?c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4756+((c[B>>2]|0)-1<<2)>>2]|0:0)c[x>>2]=2;else c[x>>2]=0;Xd((c[U>>2]|0)+((c[T>>2]|0)*12240|0)|0,c[q>>2]|0,c[B>>2]|0,1,c[x>>2]|0);Yd(c[q>>2]|0,a[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+6132+((c[B>>2]|0)*36|0)+29>>0]|0,a[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+6132+((c[B>>2]|0)*36|0)+30>>0]|0,(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+6240+((c[B>>2]|0)*320|0)|0,c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4608>>2]|0)}c[T>>2]=(c[T>>2]|0)+1}c[B>>2]=e+1}while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;Z=(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4756|0;c[Z>>2]=0;c[Z+4>>2]=0;c[Z+8>>2]=0;c[T>>2]=(c[T>>2]|0)+1}Z=Wd(c[q>>2]|0)|0;c[(c[U>>2]|0)+24536>>2]=Z}ff(c[U>>2]|0);c[F>>2]=(_(c[(c[Q>>2]|0)+28>>2]|0,c[(c[Q>>2]|0)+24>>2]|0)|0)/1e3|0;if(!(c[R>>2]|0))c[F>>2]=(c[F>>2]|0)-(c[(c[U>>2]|0)+24536>>2]|0);c[F>>2]=(c[F>>2]|0)/(c[(c[U>>2]|0)+5776>>2]|0)|0;e=(c[F>>2]&65535)<<16>>16;if((c[(c[Q>>2]|0)+24>>2]|0)==10)c[u>>2]=e*100;else c[u>>2]=e*50;c[u>>2]=(c[u>>2]|0)-(((c[(c[U>>2]|0)+24540>>2]|0)*1e3|0)/500|0);if((c[R>>2]|0)==0?(c[(c[U>>2]|0)+5780>>2]|0)>0:0){Z=Wd(c[q>>2]|0)|0;c[v>>2]=Z-(c[(c[U>>2]|0)+24536>>2]|0)-(_(c[F>>2]|0,c[(c[U>>2]|0)+5780>>2]|0)|0);c[u>>2]=(c[u>>2]|0)-(((c[v>>2]|0)*1e3|0)/500|0)}e=c[u>>2]|0;do if((c[(c[Q>>2]|0)+28>>2]|0)>5e3)if((e|0)>(c[(c[Q>>2]|0)+28>>2]|0)){e=c[(c[Q>>2]|0)+28>>2]|0;break}else{e=(c[u>>2]|0)<5e3?5e3:c[u>>2]|0;break}else if((e|0)<=5e3)if((c[u>>2]|0)<(c[(c[Q>>2]|0)+28>>2]|0)){e=c[(c[Q>>2]|0)+28>>2]|0;break}else{e=c[u>>2]|0;break}else e=5e3;while(0);c[u>>2]=e;e=c[U>>2]|0;if((c[(c[Q>>2]|0)+4>>2]|0)==2){qf(e+24480|0,(c[U>>2]|0)+5128+4|0,(c[U>>2]|0)+12240+5128+4|0,(c[U>>2]|0)+24480+34+((c[(c[U>>2]|0)+5780>>2]|0)*6|0)|0,(c[U>>2]|0)+24480+52+(c[(c[U>>2]|0)+5780>>2]|0)|0,t,c[u>>2]|0,c[(c[U>>2]|0)+4556>>2]|0,c[(c[Q>>2]|0)+56>>2]|0,c[(c[U>>2]|0)+4600>>2]|0,c[(c[U>>2]|0)+4608>>2]|0);e=c[U>>2]|0;if(!(a[(c[U>>2]|0)+24480+52+(c[(c[U>>2]|0)+5780>>2]|0)>>0]|0)){if((c[e+24564>>2]|0)==1){Z=(c[U>>2]|0)+12240+7200|0;c[Z>>2]=0;c[Z+4>>2]=0;c[Z+8>>2]=0;c[Z+12>>2]=0;oj((c[U>>2]|0)+12240+7216|0,0,2140)|0;oj((c[U>>2]|0)+12240+144|0,0,4380)|0;Z=(c[U>>2]|0)+12240+4524|0;c[Z>>2]=0;c[Z+4>>2]=0;c[Z+8>>2]=0;c[Z+12>>2]=0;c[Z+16>>2]=0;c[Z+20>>2]=0;c[Z+24>>2]=0;c[Z+28>>2]=0;Z=(c[U>>2]|0)+12240+16|0;c[Z>>2]=0;c[Z+4>>2]=0;c[(c[U>>2]|0)+12240+4568>>2]=100;c[(c[U>>2]|0)+12240+144+4356>>2]=100;a[(c[U>>2]|0)+12240+7200>>0]=10;a[(c[U>>2]|0)+12240+4565>>0]=0;c[(c[U>>2]|0)+12240+144+4372>>2]=65536;c[(c[U>>2]|0)+12240+4696>>2]=1}Mg((c[U>>2]|0)+12240|0)}else a[(c[U>>2]|0)+12240+4752+(c[e+5780>>2]|0)>>0]=0;if((c[R>>2]|0)==0?(zg(c[q>>2]|0,(c[U>>2]|0)+24480+34+((c[(c[U>>2]|0)+5780>>2]|0)*6|0)|0),(a[(c[U>>2]|0)+12240+4752+(c[(c[U>>2]|0)+5780>>2]|0)>>0]|0)==0):0)Ag(c[q>>2]|0,a[(c[U>>2]|0)+24480+52+(c[(c[U>>2]|0)+5780>>2]|0)>>0]|0)}else{c[e+5128>>2]=c[(c[U>>2]|0)+24480+4>>2];Z=(c[U>>2]|0)+24480+4|0;n=(c[U>>2]|0)+5128+(c[(c[U>>2]|0)+4608>>2]<<1)|0;b[Z>>1]=b[n>>1]|0;b[Z+2>>1]=b[n+2>>1]|0}Mg(c[U>>2]|0);c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;c[E>>2]=c[(c[Q>>2]|0)+52>>2];do if(!((c[M>>2]|0)==2&(c[z>>2]|0)==0)){if((c[M>>2]|0)==3){if(!(c[z>>2]|0)){c[E>>2]=(c[E>>2]<<1|0)/5|0;break}if((c[z>>2]|0)!=1)break;c[E>>2]=((c[E>>2]|0)*3|0)/4|0}}else c[E>>2]=((c[E>>2]|0)*3|0)/5|0;while(0);if(c[(c[Q>>2]|0)+48>>2]|0)e=(c[z>>2]|0)==((c[M>>2]|0)-1|0);else e=0;c[N>>2]=e&1;do if((c[(c[Q>>2]|0)+4>>2]|0)==1)c[w>>2]=c[u>>2];else{c[w>>2]=c[t+(c[T>>2]<<2)>>2];if(c[T>>2]|0)break;if((c[t+4>>2]|0)<=0)break;c[N>>2]=0;c[E>>2]=(c[E>>2]|0)-((c[(c[Q>>2]|0)+52>>2]|0)/(c[M>>2]<<1|0)|0)}while(0);if((c[w>>2]|0)>0){wf((c[U>>2]|0)+((c[T>>2]|0)*12240|0)|0,c[w>>2]|0)|0;d:do if(((c[(c[U>>2]|0)+5780>>2]|0)-(c[T>>2]|0)|0)<=0)c[y>>2]=0;else{do if((c[T>>2]|0)>0){if(!(c[(c[U>>2]|0)+24564>>2]|0))break;c[y>>2]=1;break d}while(0);c[y>>2]=2}while(0);c[V>>2]=Ng((c[U>>2]|0)+((c[T>>2]|0)*12240|0)|0,c[r>>2]|0,c[q>>2]|0,c[y>>2]|0,c[E>>2]|0,c[N>>2]|0)|0}c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4700>>2]=0;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5772>>2]=0;Z=(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5780|0;c[Z>>2]=(c[Z>>2]|0)+1;c[T>>2]=(c[T>>2]|0)+1}c[(c[U>>2]|0)+24564>>2]=a[(c[U>>2]|0)+24480+52+((c[(c[U>>2]|0)+5780>>2]|0)-1)>>0];do if((c[c[r>>2]>>2]|0)>0?(c[(c[U>>2]|0)+5780>>2]|0)==(c[(c[U>>2]|0)+5776>>2]|0):0){c[A>>2]=0;c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break;c[B>>2]=0;while(1){Z=(c[B>>2]|0)<(c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+5776>>2]|0);c[A>>2]=c[A>>2]<<1;if(!Z)break;c[A>>2]=c[A>>2]|a[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4752+(c[B>>2]|0)>>0];c[B>>2]=(c[B>>2]|0)+1}c[A>>2]=c[A>>2]|a[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4755>>0];c[T>>2]=(c[T>>2]|0)+1}if(!(c[R>>2]|0))uc(c[q>>2]|0,c[A>>2]|0,_((c[(c[U>>2]|0)+5776>>2]|0)+1|0,c[(c[Q>>2]|0)+4>>2]|0)|0);do if(c[(c[U>>2]|0)+6112>>2]|0){if((c[(c[Q>>2]|0)+4>>2]|0)!=1?(c[(c[U>>2]|0)+12240+6112>>2]|0)==0:0)break;c[c[r>>2]>>2]=0}while(0);n=(c[U>>2]|0)+24540|0;c[n>>2]=(c[n>>2]|0)+(c[c[r>>2]>>2]<<3);n=(_(c[(c[Q>>2]|0)+28>>2]|0,c[(c[Q>>2]|0)+24>>2]|0)|0)/1e3|0;Z=(c[U>>2]|0)+24540|0;c[Z>>2]=(c[Z>>2]|0)-n;do if((c[(c[U>>2]|0)+24540>>2]|0)>1e4)e=1e4;else{if((c[(c[U>>2]|0)+24540>>2]|0)<0){e=0;break}e=c[(c[U>>2]|0)+24540>>2]|0}while(0);c[(c[U>>2]|0)+24540>>2]=e;c[K>>2]=13+(0+(((c[(c[U>>2]|0)+24556>>2]&65535)<<16>>16)*3188>>16));e=(c[U>>2]|0)+24560|0;if((c[(c[U>>2]|0)+4556>>2]|0)<(c[K>>2]|0)){c[e>>2]=1;c[(c[U>>2]|0)+24556>>2]=0;break}else{c[e>>2]=0;Z=(c[U>>2]|0)+24556|0;c[Z>>2]=(c[Z>>2]|0)+(c[(c[Q>>2]|0)+24>>2]|0);break}}while(0);if(!(c[p>>2]|0))break;c[z>>2]=(c[z>>2]|0)+1}c[(c[U>>2]|0)+24552>>2]=c[(c[Q>>2]|0)+4>>2];c[(c[Q>>2]|0)+72>>2]=c[(c[U>>2]|0)+24560>>2];if((c[(c[U>>2]|0)+4600>>2]|0)==16)e=(c[(c[U>>2]|0)+16+12>>2]|0)==0;else e=0;c[(c[Q>>2]|0)+76>>2]=e&1;c[(c[Q>>2]|0)+68>>2]=((c[(c[U>>2]|0)+4600>>2]&65535)<<16>>16)*1e3;if(c[(c[Q>>2]|0)+56>>2]|0)e=0;else e=b[(c[U>>2]|0)+24480+28>>1]|0;c[(c[Q>>2]|0)+80>>2]=e;e:do if(c[R>>2]|0){c[(c[Q>>2]|0)+24>>2]=c[X>>2];c[(c[Q>>2]|0)+36>>2]=c[W>>2];c[T>>2]=0;while(1){if((c[T>>2]|0)>=(c[(c[Q>>2]|0)+4>>2]|0))break e;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4700>>2]=0;c[(c[U>>2]|0)+((c[T>>2]|0)*12240|0)+4712>>2]=0;c[T>>2]=(c[T>>2]|0)+1}}while(0);c[P>>2]=c[V>>2];na(c[S>>2]|0);Z=c[P>>2]|0;i=Y;return Z|0}function Wd(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(aa(c[(c[d>>2]|0)+28>>2]|0)|0))|0;i=b;return a|0}function Xd(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=i;i=i+112|0;n=y+48|0;o=y+44|0;j=y+40|0;k=y+36|0;p=y+32|0;t=y+28|0;u=y+24|0;l=y+20|0;s=y+16|0;q=y+12|0;r=y+56|0;m=y+88|0;x=y+8|0;v=y+4|0;w=y;c[n>>2]=d;c[o>>2]=e;c[j>>2]=f;c[k>>2]=g;c[p>>2]=h;if(c[k>>2]|0)c[x>>2]=(c[n>>2]|0)+6132+((c[j>>2]|0)*36|0);else c[x>>2]=(c[n>>2]|0)+4768;c[l>>2]=(a[(c[x>>2]|0)+29>>0]<<1)+(a[(c[x>>2]|0)+30>>0]|0);j=c[o>>2]|0;f=c[l>>2]|0;if((c[k>>2]|0)!=0|(c[l>>2]|0)>=2)qc(j,f-2|0,29020,8);else qc(j,f,29024,8);j=c[o>>2]|0;f=a[c[x>>2]>>0]|0;if((c[p>>2]|0)==2)qc(j,f,26771,8);else{qc(j,f>>3,26747+(a[(c[x>>2]|0)+29>>0]<<3)|0,8);qc(c[o>>2]|0,a[c[x>>2]>>0]&7,29049,8)}c[t>>2]=1;while(1){j=c[o>>2]|0;if((c[t>>2]|0)>=(c[(c[n>>2]|0)+4604>>2]|0))break;qc(j,a[(c[x>>2]|0)+(c[t>>2]|0)>>0]|0,26771,8);c[t>>2]=(c[t>>2]|0)+1}l=_(a[(c[x>>2]|0)+29>>0]>>1,b[c[(c[n>>2]|0)+4724>>2]>>1]|0)|0;qc(j,a[(c[x>>2]|0)+8>>0]|0,(c[(c[(c[n>>2]|0)+4724>>2]|0)+12>>2]|0)+l|0,8);nf(r,m,c[(c[n>>2]|0)+4724>>2]|0,a[(c[x>>2]|0)+8>>0]|0);c[t>>2]=0;while(1){if((c[t>>2]|0)>=(b[(c[(c[n>>2]|0)+4724>>2]|0)+2>>1]|0))break;do if((a[(c[x>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0)+4600>>2]>>1|0)|0;c[w>>2]=(b[(c[x>>2]|0)+26>>1]|0)-(_((c[v>>2]&65535)<<16>>16,(c[(c[n>>2]|0)+4600>>2]>>1&65535)<<16>>16)|0);qc(c[o>>2]|0,c[v>>2]|0,29064,8);qc(c[o>>2]|0,c[w>>2]|0,c[(c[n>>2]|0)+4716>>2]|0,8)}b[(c[n>>2]|0)+5804>>1]=b[(c[x>>2]|0)+26>>1]|0;qc(c[o>>2]|0,a[(c[x>>2]|0)+28>>0]|0,c[(c[n>>2]|0)+4720>>2]|0,8);qc(c[o>>2]|0,a[(c[x>>2]|0)+32>>0]|0,26812,8);c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[(c[n>>2]|0)+4604>>2]|0))break;qc(c[o>>2]|0,a[(c[x>>2]|0)+4+(c[u>>2]|0)>>0]|0,c[17620+(a[(c[x>>2]|0)+32>>0]<<2)>>2]|0,8);c[u>>2]=(c[u>>2]|0)+1}if(c[p>>2]|0){v=c[x>>2]|0;v=v+29|0;v=a[v>>0]|0;v=v<<24>>24;w=c[n>>2]|0;w=w+5800|0;c[w>>2]=v;w=c[o>>2]|0;x=c[x>>2]|0;x=x+34|0;x=a[x>>0]|0;x=x<<24>>24;qc(w,x,29034,8);i=y;return}qc(c[o>>2]|0,a[(c[x>>2]|0)+33>>0]|0,29017,8);v=c[x>>2]|0;v=v+29|0;v=a[v>>0]|0;v=v<<24>>24;w=c[n>>2]|0;w=w+5800|0;c[w>>2]=v;w=c[o>>2]|0;x=c[x>>2]|0;x=x+34|0;x=a[x>>0]|0;x=x<<24>>24;qc(w,x,29034,8);i=y;return}function Yd(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+128|0;r=F+116|0;s=F+112|0;t=F+108|0;u=F+104|0;v=F+100|0;z=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=i+((1*(c[A>>2]<<2)|0)+15&-16)|0;c[k>>2]=b;c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[A>>2]|0))break;c[f+(c[z>>2]<<2)>>2]=0;a:while(1){c[o>>2]=Zd(n,c[k>>2]|0,d[29177]|0,8)|0;e=Zd(n,n,d[29178]|0,4)|0;c[o>>2]=(c[o>>2]|0)+e;e=Zd(n,n,d[29179]|0,2)|0;c[o>>2]=(c[o>>2]|0)+e;e=Zd(g+(c[z>>2]<<2)|0,n,d[29180]|0,1)|0;c[o>>2]=(c[o>>2]|0)+e;if(!(c[o>>2]|0))break;e=f+(c[z>>2]<<2)|0;c[e>>2]=(c[e>>2]|0)+1;c[C>>2]=0;while(1){if((c[C>>2]|0)>=16)continue a;c[(c[k>>2]|0)+(c[C>>2]<<2)>>2]=c[(c[k>>2]|0)+(c[C>>2]<<2)>>2]>>1;c[C>>2]=(c[C>>2]|0)+1}}c[k>>2]=(c[k>>2]|0)+64;c[z>>2]=(c[z>>2]|0)+1}c[l>>2]=2147483647;c[C>>2]=0;while(1){if((c[C>>2]|0)>=9)break;c[m>>2]=29361+((c[C>>2]|0)*18|0);c[p>>2]=d[29541+((c[s>>2]>>1)*9|0)+(c[C>>2]|0)>>0];c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[A>>2]|0))break;if((c[f+(c[z>>2]<<2)>>2]|0)>0)c[p>>2]=(c[p>>2]|0)+(d[(c[m>>2]|0)+17>>0]|0);else c[p>>2]=(c[p>>2]|0)+(d[(c[m>>2]|0)+(c[g+(c[z>>2]<<2)>>2]|0)>>0]|0);c[z>>2]=(c[z>>2]|0)+1}if((c[p>>2]|0)<(c[l>>2]|0)){c[l>>2]=c[p>>2];c[j>>2]=c[C>>2]}c[C>>2]=(c[C>>2]|0)+1}qc(c[r>>2]|0,c[j>>2]|0,29523+((c[s>>2]>>1)*9|0)|0,8);c[q>>2]=29181+((c[j>>2]|0)*18|0);c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[A>>2]|0))break;h=c[r>>2]|0;if(!(c[f+(c[z>>2]<<2)>>2]|0))qc(h,c[g+(c[z>>2]<<2)>>2]|0,c[q>>2]|0,8);else{qc(h,17,c[q>>2]|0,8);c[C>>2]=0;while(1){h=c[r>>2]|0;if((c[C>>2]|0)>=((c[f+(c[z>>2]<<2)>>2]|0)-1|0))break;qc(h,17,29343,8);c[C>>2]=(c[C>>2]|0)+1}qc(h,c[g+(c[z>>2]<<2)>>2]|0,29343,8)}c[z>>2]=(c[z>>2]|0)+1}c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[A>>2]|0))break;if((c[g+(c[z>>2]<<2)>>2]|0)>0)Pe(c[r>>2]|0,b+(c[z>>2]<<4<<2)|0);c[z>>2]=(c[z>>2]|0)+1}c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[A>>2]|0))break;b:do if((c[f+(c[z>>2]<<2)>>2]|0)>0){c[E>>2]=(c[u>>2]|0)+(c[z>>2]<<4);c[D>>2]=(c[f+(c[z>>2]<<2)>>2]|0)-1;c[C>>2]=0;while(1){if((c[C>>2]|0)>=16)break b;q=a[(c[E>>2]|0)+(c[C>>2]|0)>>0]|0;c[x>>2]=(((a[(c[E>>2]|0)+(c[C>>2]|0)>>0]|0)>0?q:0-q|0)&255)<<24>>24;c[B>>2]=c[D>>2];while(1){h=c[x>>2]|0;if((c[B>>2]|0)<=0)break;c[y>>2]=h>>c[B>>2]&1;qc(c[r>>2]|0,c[y>>2]|0,29015,8);c[B>>2]=(c[B>>2]|0)+-1}c[y>>2]=h&1;qc(c[r>>2]|0,c[y>>2]|0,29015,8);c[C>>2]=(c[C>>2]|0)+1}}while(0);c[z>>2]=(c[z>>2]|0)+1}Dd(c[r>>2]|0,c[u>>2]|0,c[v>>2]|0,c[s>>2]|0,c[t>>2]|0,g);na(c[w>>2]|0);i=F;return}function Zd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;m=n+24|0;f=n+20|0;g=n+16|0;h=n+12|0;j=n+8|0;k=n+4|0;l=n;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=e;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[j>>2]|0)){f=6;break}c[l>>2]=(c[(c[g>>2]|0)+(c[k>>2]<<1<<2)>>2]|0)+(c[(c[g>>2]|0)+((c[k>>2]<<1)+1<<2)>>2]|0);if((c[l>>2]|0)>(c[h>>2]|0)){f=4;break}c[(c[f>>2]|0)+(c[k>>2]<<2)>>2]=c[l>>2];c[k>>2]=(c[k>>2]|0)+1}if((f|0)==4){c[m>>2]=1;m=c[m>>2]|0;i=n;return m|0}else if((f|0)==6){c[m>>2]=0;m=c[m>>2]|0;i=n;return m|0}return 0}function _d(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;h=p+24|0;j=p+20|0;k=p+16|0;l=p+12|0;m=p+8|0;o=p+4|0;n=p;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[m>>2]|0))break;Sf(c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]|0)|0;e=0+((((Sf(c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]|0)|0)-2090&65535)<<16>>16)*2251>>16)&255;a[(c[h>>2]|0)+(c[o>>2]|0)>>0]=e;if((a[(c[h>>2]|0)+(c[o>>2]|0)>>0]|0)<(a[c[k>>2]>>0]|0)){e=(c[h>>2]|0)+(c[o>>2]|0)|0;a[e>>0]=(a[e>>0]|0)+1<<24>>24}if((a[(c[h>>2]|0)+(c[o>>2]|0)>>0]|0)<=63)if((a[(c[h>>2]|0)+(c[o>>2]|0)>>0]|0)<0)f=0;else f=a[(c[h>>2]|0)+(c[o>>2]|0)>>0]|0;else f=63;a[(c[h>>2]|0)+(c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>>0]|0)+f}e=(c[h>>2]|0)+(c[o>>2]|0)|0;a[e>>0]=(a[e>>0]|0)+4}e=Wf($d(((a[c[k>>2]>>0]<<16>>16)*29|0)+((a[c[k>>2]>>0]<<16>>16)*7281>>16)+2090|0,3967)|0)|0;c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=e;c[o>>2]=(c[o>>2]|0)+1}i=p;return}function $d(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function ae(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+32|0;h=q+28|0;j=q+24|0;k=q+20|0;l=q+16|0;m=q+12|0;p=q+8|0;o=q+4|0;n=q;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[m>>2]|0))break;f=a[(c[j>>2]|0)+(c[p>>2]|0)>>0]|0;do if(!((c[p>>2]|0)==0&(c[l>>2]|0)==0)){c[o>>2]=f+-4;c[n>>2]=8+(a[c[k>>2]>>0]|0);f=c[o>>2]|0;if((c[o>>2]|0)>(c[n>>2]|0)){e=c[k>>2]|0;a[e>>0]=(a[e>>0]|0)+((f<<1)-(c[n>>2]|0));break}else{e=c[k>>2]|0;a[e>>0]=(a[e>>0]|0)+f;break}}else{e=(be(f,(a[c[k>>2]>>0]|0)-16|0)|0)&255;a[c[k>>2]>>0]=e}while(0);if((a[c[k>>2]>>0]|0)<=63)if((a[c[k>>2]>>0]|0)<0)f=0;else f=a[c[k>>2]>>0]|0;else f=63;a[c[k>>2]>>0]=f;e=Wf($d(((a[c[k>>2]>>0]<<16>>16)*29|0)+((a[c[k>>2]>>0]<<16>>16)*7281>>16)+2090|0,3967)|0)|0;c[(c[h>>2]|0)+(c[p>>2]<<2)>>2]=e;c[p>>2]=(c[p>>2]|0)+1}i=q;return}function be(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)>(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function ce(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;e=j+12|0;f=j+8|0;h=j+4|0;g=j;c[e>>2]=b;c[f>>2]=d;c[g>>2]=0;c[h>>2]=0;while(1){if((c[h>>2]|0)>=(c[f>>2]|0))break;c[g>>2]=(a[(c[e>>2]|0)+(c[h>>2]|0)>>0]|0)+(c[g>>2]<<8);c[h>>2]=(c[h>>2]|0)+1}i=j;return c[g>>2]|0}function de(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+32|0;h=o+20|0;j=o+16|0;k=o+12|0;l=o+8|0;m=o+4|0;n=o;c[h>>2]=a;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[m>>2]|0))break;a=(b[(c[j>>2]|0)+(c[n>>2]<<1)>>1]|0)+((_(((b[(c[k>>2]|0)+(c[n>>2]<<1)>>1]|0)-(b[(c[j>>2]|0)+(c[n>>2]<<1)>>1]|0)&65535)<<16>>16,(c[l>>2]&65535)<<16>>16)|0)>>2)&65535;b[(c[h>>2]|0)+(c[n>>2]<<1)>>1]=a;c[n>>2]=(c[n>>2]|0)+1}i=o;return}function ee(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+48|0;g=m+36|0;h=m+32|0;j=m+28|0;l=m+16|0;k=m+8|0;e=m+4|0;f=m;c[g>>2]=a;c[h>>2]=b;c[j>>2]=d;c[e>>2]=0;c[f>>2]=0;if(!(c[(c[g>>2]|0)+12>>2]|0)){i=m;return}c[e>>2]=256-(c[(c[g>>2]|0)+8>>2]|0)<<10;c[f>>2]=c[e>>2]>>16;c[e>>2]=(c[e>>2]|0)-(c[f>>2]<<16);fe(l,k,c[f>>2]|0,c[e>>2]|0);if(((c[(c[g>>2]|0)+8>>2]|0)+(c[(c[g>>2]|0)+12>>2]|0)|0)<=256)if(((c[(c[g>>2]|0)+8>>2]|0)+(c[(c[g>>2]|0)+12>>2]|0)|0)<0)e=0;else e=(c[(c[g>>2]|0)+8>>2]|0)+(c[(c[g>>2]|0)+12>>2]|0)|0;else e=256;c[(c[g>>2]|0)+8>>2]=e;Nf(c[h>>2]|0,l,k,c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,1);i=m;return}function fe(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;f=m+20|0;g=m+16|0;h=m+12|0;j=m+8|0;l=m+4|0;k=m;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=e;if((c[h>>2]|0)>=4){l=c[f>>2]|0;c[l>>2]=c[4473];c[l+4>>2]=c[4474];c[l+8>>2]=c[4475];l=c[g>>2]|0;c[l>>2]=c[4484];c[l+4>>2]=c[4485];i=m;return}if((c[j>>2]|0)<=0){l=c[f>>2]|0;k=17844+((c[h>>2]|0)*12|0)|0;c[l>>2]=c[k>>2];c[l+4>>2]=c[k+4>>2];c[l+8>>2]=c[k+8>>2];l=c[g>>2]|0;k=17904+(c[h>>2]<<3)|0;c[l>>2]=c[k>>2];c[l+4>>2]=c[k+4>>2];i=m;return}d=(c[j>>2]|0)<32768;c[l>>2]=0;if(d){while(1){if((c[l>>2]|0)>=3)break;d=_((c[17844+(((c[h>>2]|0)+1|0)*12|0)+(c[l>>2]<<2)>>2]|0)-(c[17844+((c[h>>2]|0)*12|0)+(c[l>>2]<<2)>>2]|0)>>16,(c[j>>2]&65535)<<16>>16)|0;d=(c[17844+((c[h>>2]|0)*12|0)+(c[l>>2]<<2)>>2]|0)+(d+((_((c[17844+(((c[h>>2]|0)+1|0)*12|0)+(c[l>>2]<<2)>>2]|0)-(c[17844+((c[h>>2]|0)*12|0)+(c[l>>2]<<2)>>2]|0)&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[f>>2]|0)+(c[l>>2]<<2)>>2]=d;c[l>>2]=(c[l>>2]|0)+1}c[k>>2]=0;while(1){if((c[k>>2]|0)>=2)break;l=_((c[17904+((c[h>>2]|0)+1<<3)+(c[k>>2]<<2)>>2]|0)-(c[17904+(c[h>>2]<<3)+(c[k>>2]<<2)>>2]|0)>>16,(c[j>>2]&65535)<<16>>16)|0;l=(c[17904+(c[h>>2]<<3)+(c[k>>2]<<2)>>2]|0)+(l+((_((c[17904+((c[h>>2]|0)+1<<3)+(c[k>>2]<<2)>>2]|0)-(c[17904+(c[h>>2]<<3)+(c[k>>2]<<2)>>2]|0)&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))|0;c[(c[g>>2]|0)+(c[k>>2]<<2)>>2]=l;c[k>>2]=(c[k>>2]|0)+1}i=m;return}else{while(1){if((c[l>>2]|0)>=3)break;d=_((c[17844+(((c[h>>2]|0)+1|0)*12|0)+(c[l>>2]<<2)>>2]|0)-(c[17844+((c[h>>2]|0)*12|0)+(c[l>>2]<<2)>>2]|0)>>16,((c[j>>2]|0)-65536&65535)<<16>>16)|0;d=(c[17844+(((c[h>>2]|0)+1|0)*12|0)+(c[l>>2]<<2)>>2]|0)+(d+((_((c[17844+(((c[h>>2]|0)+1|0)*12|0)+(c[l>>2]<<2)>>2]|0)-(c[17844+((c[h>>2]|0)*12|0)+(c[l>>2]<<2)>>2]|0)&65535,((c[j>>2]|0)-65536&65535)<<16>>16)|0)>>16))|0;c[(c[f>>2]|0)+(c[l>>2]<<2)>>2]=d;c[l>>2]=(c[l>>2]|0)+1}c[k>>2]=0;while(1){if((c[k>>2]|0)>=2)break;l=_((c[17904+((c[h>>2]|0)+1<<3)+(c[k>>2]<<2)>>2]|0)-(c[17904+(c[h>>2]<<3)+(c[k>>2]<<2)>>2]|0)>>16,((c[j>>2]|0)-65536&65535)<<16>>16)|0;l=(c[17904+((c[h>>2]|0)+1<<3)+(c[k>>2]<<2)>>2]|0)+(l+((_((c[17904+((c[h>>2]|0)+1<<3)+(c[k>>2]<<2)>>2]|0)-(c[17904+(c[h>>2]<<3)+(c[k>>2]<<2)>>2]|0)&65535,((c[j>>2]|0)-65536&65535)<<16>>16)|0)>>16))|0;c[(c[g>>2]|0)+(c[k>>2]<<2)>>2]=l;c[k>>2]=(c[k>>2]|0)+1}i=m;return}}function ge(e,f,g){e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+144|0;m=t+24|0;h=t+20|0;n=t+16|0;r=t+12|0;l=t+128|0;j=t+96|0;s=t+64|0;q=t+32|0;p=t+8|0;o=t+4|0;k=t;c[m>>2]=e;c[h>>2]=f;c[n>>2]=g;g=_(a[c[h>>2]>>0]|0,b[(c[n>>2]|0)+2>>1]|0)|0;c[k>>2]=(c[(c[n>>2]|0)+8>>2]|0)+g;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(b[(c[n>>2]|0)+2>>1]|0))break;b[(c[m>>2]|0)+(c[r>>2]<<1)>>1]=d[(c[k>>2]|0)+(c[r>>2]|0)>>0]<<7;c[r>>2]=(c[r>>2]|0)+1}nf(j,l,c[n>>2]|0,a[c[h>>2]>>0]|0);he(s,(c[h>>2]|0)+1|0,l,b[(c[n>>2]|0)+4>>1]|0,b[(c[n>>2]|0)+2>>1]|0);fg(q,c[m>>2]|0,b[(c[n>>2]|0)+2>>1]|0);c[r>>2]=0;while(1){if((c[r>>2]|0)>=(b[(c[n>>2]|0)+2>>1]|0))break;c[p>>2]=ie(b[q+(c[r>>2]<<1)>>1]<<16)|0;c[o>>2]=(b[(c[m>>2]|0)+(c[r>>2]<<1)>>1]|0)+((b[s+(c[r>>2]<<1)>>1]<<14|0)/(c[p>>2]|0)|0);if((c[o>>2]|0)>32767)h=32767;else h=(c[o>>2]|0)<0?0:c[o>>2]|0;b[(c[m>>2]|0)+(c[r>>2]<<1)>>1]=h;c[r>>2]=(c[r>>2]|0)+1}cg(c[m>>2]|0,c[(c[n>>2]|0)+32>>2]|0,b[(c[n>>2]|0)+2>>1]|0);i=t;return}function he(e,f,g,h,j){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;r=i;i=i+32|0;k=r+24|0;l=r+20|0;m=r+16|0;n=r+12|0;s=r+28|0;o=r+8|0;p=r+4|0;q=r;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;c[n>>2]=h;b[s>>1]=j;c[p>>2]=0;c[o>>2]=(b[s>>1]|0)-1;while(1){if((c[o>>2]|0)<0)break;c[q>>2]=(_((c[p>>2]&65535)<<16>>16,d[(c[m>>2]|0)+(c[o>>2]|0)>>0]|0)|0)>>8;c[p>>2]=a[(c[l>>2]|0)+(c[o>>2]|0)>>0]<<10;f=c[p>>2]|0;if((c[p>>2]|0)<=0){if((f|0)<0)c[p>>2]=(c[p>>2]|0)+102}else c[p>>2]=f-102;s=_(c[p>>2]>>16,(c[n>>2]&65535)<<16>>16)|0;c[p>>2]=(c[q>>2]|0)+(s+((_(c[p>>2]&65535,(c[n>>2]&65535)<<16>>16)|0)>>16));b[(c[k>>2]|0)+(c[o>>2]<<1)>>1]=c[p>>2];c[o>>2]=(c[o>>2]|0)+-1}i=r;return}function ie(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;f=h+4|0;e=h;c[d>>2]=a;if((c[d>>2]|0)<=0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}je(c[d>>2]|0,f,e);if(c[f>>2]&1|0)c[g>>2]=32768;else c[g>>2]=46214;c[g>>2]=c[g>>2]>>(c[f>>2]>>1);a=_(c[g>>2]>>16,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[g>>2]=(c[g>>2]|0)+(a+((_(c[g>>2]&65535,(((c[e>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[b>>2]=c[g>>2];g=c[b>>2]|0;i=h;return g|0}function je(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;h=e+12|0;j=e+8|0;f=e+4|0;g=e;c[h>>2]=a;c[j>>2]=b;c[f>>2]=d;c[g>>2]=ke(c[h>>2]|0)|0;c[c[j>>2]>>2]=c[g>>2];b=(le(c[h>>2]|0,24-(c[g>>2]|0)|0)|0)&127;c[c[f>>2]>>2]=b;i=e;return}function ke(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function le(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;e=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;h=k+4|0;g=k;c[d>>2]=a;c[f>>2]=b;c[j>>2]=c[d>>2];c[h>>2]=c[f>>2];c[g>>2]=0-(c[f>>2]|0);if(!(c[f>>2]|0)){c[e>>2]=c[d>>2];j=c[e>>2]|0;i=k;return j|0}d=c[j>>2]|0;if((c[f>>2]|0)<0){c[e>>2]=d<>2]|(c[j>>2]|0)>>>(32-(c[g>>2]|0)|0);j=c[e>>2]|0;i=k;return j|0}else{c[e>>2]=d<<32-(c[h>>2]|0)|(c[j>>2]|0)>>>(c[h>>2]|0);j=c[e>>2]|0;i=k;return j|0}return 0}function me(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m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c[(c[x>>2]|0)+(c[v>>2]<<2)>>2]|0;else l=1;c[B>>2]=oe(l,47)|0;if((c[(c[x>>2]|0)+(c[v>>2]<<2)>>2]|0)!=(c[(c[p>>2]|0)+4372>>2]|0))c[y>>2]=qe(c[(c[p>>2]|0)+4372>>2]|0,c[(c[x>>2]|0)+(c[v>>2]<<2)>>2]|0,16)|0;else c[y>>2]=65536;c[A>>2]=(c[B>>2]>>7)+1>>1;c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[(c[o>>2]|0)+4612>>2]|0))break;E=_(c[(c[r>>2]|0)+(c[z>>2]<<2)>>2]>>16,(c[A>>2]&65535)<<16>>16)|0;E=E+((_(c[(c[r>>2]|0)+(c[z>>2]<<2)>>2]&65535,(c[A>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[(c[r>>2]|0)+(c[z>>2]<<2)>>2]|0,(c[A>>2]>>15)+1>>1)|0)|0;c[(c[s>>2]|0)+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}c[(c[p>>2]|0)+4372>>2]=c[(c[x>>2]|0)+(c[v>>2]<<2)>>2];a:do if(c[(c[p>>2]|0)+4376>>2]|0){if(!(c[v>>2]|0)){E=_(c[B>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;c[B>>2]=E+((_(c[B>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16)<<2}c[z>>2]=(c[(c[p>>2]|0)+4360>>2]|0)-(c[C>>2]|0)-2;while(1){if((c[z>>2]|0)>=(c[(c[p>>2]|0)+4360>>2]|0))break a;E=_(c[B>>2]>>16,b[(c[t>>2]|0)+(c[z>>2]<<1)>>1]|0)|0;E=E+((_(c[B>>2]&65535,b[(c[t>>2]|0)+(c[z>>2]<<1)>>1]|0)|0)>>16)|0;c[(c[u>>2]|0)+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}}while(0);if((c[y>>2]|0)==65536){i=D;return}c[z>>2]=(c[(c[p>>2]|0)+4364>>2]|0)-(c[(c[o>>2]|0)+4616>>2]|0);while(1){if((c[z>>2]|0)>=(c[(c[p>>2]|0)+4364>>2]|0))break;E=_(c[y>>2]>>16,(c[(c[p>>2]|0)+1280+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0;E=E+((_(c[y>>2]&65535,(c[(c[p>>2]|0)+1280+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[y>>2]|0,(c[(c[p>>2]|0)+1280+(c[z>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[p>>2]|0)+1280+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}b:do if((c[q>>2]|0)==2?(c[(c[p>>2]|0)+4376>>2]|0)==0:0){c[z>>2]=(c[(c[p>>2]|0)+4360>>2]|0)-(c[C>>2]|0)-2;while(1){if((c[z>>2]|0)>=(c[(c[p>>2]|0)+4360>>2]|0))break b;E=_(c[y>>2]>>16,(c[(c[u>>2]|0)+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0;E=E+((_(c[y>>2]&65535,(c[(c[u>>2]|0)+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[y>>2]|0,(c[(c[u>>2]|0)+(c[z>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[u>>2]|0)+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}}while(0);E=_(c[y>>2]>>16,(c[(c[p>>2]|0)+4352>>2]&65535)<<16>>16)|0;E=E+((_(c[y>>2]&65535,(c[(c[p>>2]|0)+4352>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[y>>2]|0,(c[(c[p>>2]|0)+4352>>2]>>15)+1>>1)|0)|0;c[(c[p>>2]|0)+4352>>2]=E;c[z>>2]=0;while(1){if((c[z>>2]|0)>=32)break;E=_(c[y>>2]>>16,(c[(c[p>>2]|0)+3840+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0;E=E+((_(c[y>>2]&65535,(c[(c[p>>2]|0)+3840+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[y>>2]|0,(c[(c[p>>2]|0)+3840+(c[z>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[p>>2]|0)+3840+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}c[z>>2]=0;while(1){if((c[z>>2]|0)>=16)break;E=_(c[y>>2]>>16,(c[(c[p>>2]|0)+4288+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0;E=E+((_(c[y>>2]&65535,(c[(c[p>>2]|0)+4288+(c[z>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;E=E+(_(c[y>>2]|0,(c[(c[p>>2]|0)+4288+(c[z>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[p>>2]|0)+4288+(c[z>>2]<<2)>>2]=E;c[z>>2]=(c[z>>2]|0)+1}i=D;return}function oe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+48|0;f=h+32|0;n=h+28|0;d=h+24|0;j=h+20|0;g=h+16|0;k=h+12|0;m=h+8|0;l=h+4|0;e=h;c[n>>2]=a;c[d>>2]=b;b=c[n>>2]|0;c[j>>2]=(pe((c[n>>2]|0)>0?b:0-b|0)|0)-1;c[m>>2]=c[n>>2]<>2];c[k>>2]=536870911/(c[m>>2]>>16|0)|0;c[e>>2]=c[k>>2]<<16;b=_(c[m>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=536870912-(b+((_(c[m>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))<<3;b=_(c[l>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=(c[e>>2]|0)+(b+((_(c[l>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))|0;c[e>>2]=b+(_(c[l>>2]|0,(c[k>>2]>>15)+1>>1)|0);c[g>>2]=61-(c[j>>2]|0)-(c[d>>2]|0);b=c[g>>2]|0;if((c[g>>2]|0)>0)if((b|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];n=c[f>>2]|0;i=h;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;i=h;return n|0}a=c[e>>2]|0;d=0-(c[g>>2]|0)|0;do if((-2147483648>>0-b|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>d|0)){b=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){b=2147483647>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>d|0)){b=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){b=-2147483648>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}while(0);c[f>>2]=b<<0-(c[g>>2]|0);n=c[f>>2]|0;i=h;return n|0}function pe(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=i;i=i+48|0;f=h+40|0;q=h+36|0;p=h+32|0;j=h+28|0;l=h+24|0;k=h+20|0;g=h+16|0;m=h+12|0;n=h+8|0;o=h+4|0;e=h;c[q>>2]=a;c[p>>2]=b;c[j>>2]=d;b=c[q>>2]|0;c[l>>2]=(pe((c[q>>2]|0)>0?b:0-b|0)|0)-1;c[n>>2]=c[q>>2]<>2];b=c[p>>2]|0;c[k>>2]=(pe((c[p>>2]|0)>0?b:0-b|0)|0)-1;c[o>>2]=c[p>>2]<>2];c[m>>2]=536870911/(c[o>>2]>>16|0)|0;b=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=b+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16);b=c[n>>2]|0;a=c[o>>2]|0;d=c[e>>2]|0;d=yj(a|0,((a|0)<0)<<31>>31|0,d|0,((d|0)<0)<<31>>31|0)|0;d=nj(d|0,C|0,32)|0;c[n>>2]=b-(d<<3);d=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=(c[e>>2]|0)+(d+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16));c[g>>2]=29+(c[l>>2]|0)-(c[k>>2]|0)-(c[j>>2]|0);d=c[g>>2]|0;if((c[g>>2]|0)>=0)if((d|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];q=c[f>>2]|0;i=h;return q|0}else{c[f>>2]=0;q=c[f>>2]|0;i=h;return q|0}a=c[e>>2]|0;b=0-(c[g>>2]|0)|0;do if((-2147483648>>0-d|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>b|0)){d=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){d=2147483647>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>b|0)){d=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){d=-2147483648>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}while(0);c[f>>2]=d<<0-(c[g>>2]|0);q=c[f>>2]|0;i=h;return q|0}function re(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;var x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0;ma=i;i=i+176|0;ka=ma+168|0;x=ma+164|0;F=ma+160|0;G=ma+156|0;H=ma+152|0;I=ma+148|0;J=ma+144|0;K=ma+140|0;L=ma+136|0;M=ma+132|0;y=ma+128|0;z=ma+124|0;A=ma+120|0;na=ma+116|0;B=ma+112|0;C=ma+108|0;la=ma+104|0;D=ma+100|0;E=ma+96|0;S=ma+92|0;T=ma+88|0;Q=ma+84|0;P=ma+80|0;U=ma+76|0;W=ma+72|0;V=ma+68|0;ba=ma+64|0;ea=ma+60|0;Z=ma+56|0;$=ma+52|0;aa=ma+48|0;ca=ma+44|0;da=ma+40|0;R=ma+36|0;O=ma+32|0;ja=ma+28|0;N=ma+24|0;ha=ma+20|0;ia=ma+16|0;fa=ma+12|0;Y=ma+8|0;ga=ma+4|0;X=ma;c[ka>>2]=d;c[x>>2]=e;c[F>>2]=f;c[G>>2]=g;c[H>>2]=h;c[I>>2]=j;c[J>>2]=k;c[K>>2]=l;c[L>>2]=m;c[M>>2]=n;c[y>>2]=o;c[z>>2]=p;c[A>>2]=q;c[na>>2]=r;c[B>>2]=s;c[C>>2]=t;c[la>>2]=u;c[D>>2]=v;c[E>>2]=w;c[ga>>2]=(c[ka>>2]|0)+1280+((c[(c[ka>>2]|0)+4364>>2]|0)-(c[M>>2]|0)+1<<2);c[X>>2]=(c[I>>2]|0)+((c[(c[ka>>2]|0)+4360>>2]|0)-(c[M>>2]|0)+2<<2);c[N>>2]=c[na>>2]>>6;c[Y>>2]=(c[ka>>2]|0)+3840+124;c[S>>2]=0;while(1){m=c[ka>>2]|0;if((c[S>>2]|0)>=(c[la>>2]|0))break;na=907633515+(_(c[m+4368>>2]|0,196314165)|0)|0;c[(c[ka>>2]|0)+4368>>2]=na;c[P>>2]=c[E>>2]>>1;na=_(c[c[Y>>2]>>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(c[ka>>2]|0)+4288+((c[T>>2]|0)-1<<2)>>2];c[(c[ka>>2]|0)+4288+((c[T>>2]|0)-1<<2)>>2]=c[ha>>2];na=_(c[ha>>2]>>16,b[(c[L>>2]|0)+((c[T>>2]|0)-1<<1)>>1]|0)|0;c[U>>2]=(c[U>>2]|0)+(na+((_(c[ha>>2]&65535,b[(c[L>>2]|0)+((c[T>>2]|0)-1<<1)>>1]|0)|0)>>16));c[ha>>2]=c[(c[ka>>2]|0)+4288+((c[T>>2]|0)+0<<2)>>2];c[(c[ka>>2]|0)+4288+((c[T>>2]|0)+0<<2)>>2]=c[ia>>2];na=_(c[ia>>2]>>16,b[(c[L>>2]|0)+(c[T>>2]<<1)>>1]|0)|0;c[U>>2]=(c[U>>2]|0)+(na+((_(c[ia>>2]&65535,b[(c[L>>2]|0)+(c[T>>2]<<1)>>1]|0)|0)>>16));c[T>>2]=(c[T>>2]|0)+2}c[(c[ka>>2]|0)+4288+((c[D>>2]|0)-1<<2)>>2]=c[ha>>2];na=_(c[ha>>2]>>16,b[(c[L>>2]|0)+((c[D>>2]|0)-1<<1)>>1]|0)|0;c[U>>2]=(c[U>>2]|0)+(na+((_(c[ha>>2]&65535,b[(c[L>>2]|0)+((c[D>>2]|0)-1<<1)>>1]|0)|0)>>16));c[U>>2]=c[U>>2]<<1;na=_(c[(c[ka>>2]|0)+4352>>2]>>16,(c[z>>2]&65535)<<16>>16)|0;c[U>>2]=(c[U>>2]|0)+(na+((_(c[(c[ka>>2]|0)+4352>>2]&65535,(c[z>>2]&65535)<<16>>16)|0)>>16));na=_(c[(c[ka>>2]|0)+1280+((c[(c[ka>>2]|0)+4364>>2]|0)-1<<2)>>2]>>16,(c[A>>2]&65535)<<16>>16)|0;c[V>>2]=na+((_(c[(c[ka>>2]|0)+1280+((c[(c[ka>>2]|0)+4364>>2]|0)-1<<2)>>2]&65535,(c[A>>2]&65535)<<16>>16)|0)>>16);na=(c[V>>2]|0)+(_(c[(c[ka>>2]|0)+4352>>2]>>16,c[A>>2]>>16)|0)|0;c[V>>2]=na+((_(c[(c[ka>>2]|0)+4352>>2]&65535,c[A>>2]>>16)|0)>>16);c[ha>>2]=(c[P>>2]<<2)-(c[U>>2]|0);c[ha>>2]=(c[ha>>2]|0)-(c[V>>2]|0);if((c[M>>2]|0)>0){na=_((c[c[ga>>2]>>2]|0)+(c[(c[ga>>2]|0)+-8>>2]|0)>>16,(c[y>>2]&65535)<<16>>16)|0;c[W>>2]=na+((_((c[c[ga>>2]>>2]|0)+(c[(c[ga>>2]|0)+-8>>2]|0)&65535,(c[y>>2]&65535)<<16>>16)|0)>>16);na=(c[W>>2]|0)+(_(c[(c[ga>>2]|0)+-4>>2]>>16,c[y>>2]>>16)|0)|0;c[W>>2]=na+((_(c[(c[ga>>2]|0)+-4>>2]&65535,c[y>>2]>>16)|0)>>16);c[W>>2]=c[W>>2]<<1;c[ga>>2]=(c[ga>>2]|0)+4;c[ia>>2]=(c[Q>>2]|0)-(c[W>>2]|0);c[ha>>2]=(c[ia>>2]|0)+(c[ha>>2]<<1);c[ha>>2]=(c[ha>>2]>>2)+1>>1}else c[ha>>2]=(c[ha>>2]>>1)+1>>1;c[ba>>2]=(c[(c[F>>2]|0)+(c[S>>2]<<2)>>2]|0)-(c[ha>>2]|0);if((c[(c[ka>>2]|0)+4368>>2]|0)<0)c[ba>>2]=0-(c[ba>>2]|0);if((c[ba>>2]|0)>30720)m=30720;else m=(c[ba>>2]|0)<-31744?-31744:c[ba>>2]|0;c[ba>>2]=m;c[$>>2]=(c[ba>>2]|0)-(c[C>>2]|0);c[Z>>2]=c[$>>2]>>10;m=c[Z>>2]|0;do if((c[Z>>2]|0)<=0){if(!m){c[$>>2]=c[C>>2];c[aa>>2]=(c[$>>2]|0)+944;c[ca>>2]=_((c[$>>2]&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;c[da>>2]=_((c[aa>>2]&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;break}if((c[Z>>2]|0)==-1){c[aa>>2]=c[C>>2];c[$>>2]=(c[aa>>2]|0)-944;c[ca>>2]=_((0-(c[$>>2]|0)&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;c[da>>2]=_((c[aa>>2]&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;break}else{c[$>>2]=(c[Z>>2]<<10)+80;c[$>>2]=(c[$>>2]|0)+(c[C>>2]|0);c[aa>>2]=(c[$>>2]|0)+1024;c[ca>>2]=_((0-(c[$>>2]|0)&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;c[da>>2]=_((0-(c[aa>>2]|0)&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;break}}else{c[$>>2]=(m<<10)-80;c[$>>2]=(c[$>>2]|0)+(c[C>>2]|0);c[aa>>2]=(c[$>>2]|0)+1024;c[ca>>2]=_((c[$>>2]&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0;c[da>>2]=_((c[aa>>2]&65535)<<16>>16,(c[B>>2]&65535)<<16>>16)|0}while(0);c[ea>>2]=(c[ba>>2]|0)-(c[$>>2]|0);c[ca>>2]=(c[ca>>2]|0)+(_((c[ea>>2]&65535)<<16>>16,(c[ea>>2]&65535)<<16>>16)|0);c[ea>>2]=(c[ba>>2]|0)-(c[aa>>2]|0);c[da>>2]=(c[da>>2]|0)+(_((c[ea>>2]&65535)<<16>>16,(c[ea>>2]&65535)<<16>>16)|0);if((c[da>>2]|0)<(c[ca>>2]|0))c[$>>2]=c[aa>>2];a[(c[G>>2]|0)+(c[S>>2]|0)>>0]=(c[$>>2]>>9)+1>>1;c[R>>2]=c[$>>2]<<4;if((c[(c[ka>>2]|0)+4368>>2]|0)<0)c[R>>2]=0-(c[R>>2]|0);c[O>>2]=(c[R>>2]|0)+(c[Q>>2]<<1);c[ja>>2]=(c[O>>2]|0)+(c[P>>2]<<4);na=_(c[ja>>2]>>16,(c[N>>2]&65535)<<16>>16)|0;na=na+((_(c[ja>>2]&65535,(c[N>>2]&65535)<<16>>16)|0)>>16)|0;if(((na+(_(c[ja>>2]|0,(c[N>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){na=_(c[ja>>2]>>16,(c[N>>2]&65535)<<16>>16)|0;na=na+((_(c[ja>>2]&65535,(c[N>>2]&65535)<<16>>16)|0)>>16)|0;if(((na+(_(c[ja>>2]|0,(c[N>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)m=-32768;else{m=_(c[ja>>2]>>16,(c[N>>2]&65535)<<16>>16)|0;m=m+((_(c[ja>>2]&65535,(c[N>>2]&65535)<<16>>16)|0)>>16)|0;m=(m+(_(c[ja>>2]|0,(c[N>>2]>>15)+1>>1)|0)>>7)+1>>1}}else m=32767;b[(c[H>>2]|0)+(c[S>>2]<<1)>>1]=m;c[Y>>2]=(c[Y>>2]|0)+4;c[c[Y>>2]>>2]=c[ja>>2];c[fa>>2]=(c[ja>>2]|0)-(c[U>>2]<<2);c[(c[ka>>2]|0)+4352>>2]=c[fa>>2];c[(c[ka>>2]|0)+1280+(c[(c[ka>>2]|0)+4364>>2]<<2)>>2]=(c[fa>>2]|0)-(c[V>>2]<<2);c[(c[I>>2]|0)+(c[(c[ka>>2]|0)+4360>>2]<<2)>>2]=c[O>>2]<<1;na=(c[ka>>2]|0)+4364|0;c[na>>2]=(c[na>>2]|0)+1;na=(c[ka>>2]|0)+4360|0;c[na>>2]=(c[na>>2]|0)+1;c[(c[ka>>2]|0)+4368>>2]=(c[(c[ka>>2]|0)+4368>>2]|0)+(a[(c[G>>2]|0)+(c[S>>2]|0)>>0]|0);c[S>>2]=(c[S>>2]|0)+1}o=m+3840|0;m=(c[ka>>2]|0)+3840+(c[la>>2]<<2)|0;r=o+128|0;do{c[o>>2]=c[m>>2];o=o+4|0;m=m+4|0}while((o|0)<(r|0));i=ma;return}function se(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;ca=i;i=i+272|0;S=ca+264|0;T=ca+260|0;x=ca+256|0;y=ca+252|0;W=ca+248|0;z=ca+244|0;A=ca+240|0;B=ca+236|0;C=ca+232|0;D=ca+228|0;t=ca+224|0;u=ca+220|0;U=ca+216|0;v=ca+212|0;w=ca+208|0;Z=ca+204|0;M=ca+200|0;N=ca+196|0;Q=ca+192|0;I=ca+188|0;K=ca+184|0;R=ca+180|0;$=ca+176|0;P=ca+172|0;Y=ca+168|0;F=ca+164|0;G=ca+160|0;E=ca+156|0;ba=ca+152|0;H=ca+148|0;O=ca+144|0;J=ca+140|0;X=ca+136|0;aa=ca+132|0;V=ca+128|0;L=ca;c[S>>2]=d;c[T>>2]=e;c[x>>2]=f;c[y>>2]=g;c[W>>2]=h;c[z>>2]=j;c[A>>2]=k;c[B>>2]=l;c[C>>2]=m;c[D>>2]=n;c[t>>2]=o;c[u>>2]=p;c[U>>2]=q;c[v>>2]=r;c[w>>2]=s;c[N>>2]=c[(c[T>>2]|0)+4356>>2];g=c[(c[S>>2]|0)+4652>>2]|0;c[V>>2]=ia()|0;k=i;i=i+((1*(g*1168|0)|0)+15&-16)|0;oj(k|0,0,(c[(c[S>>2]|0)+4652>>2]|0)*1168|0)|0;c[M>>2]=0;while(1){if((c[M>>2]|0)>=(c[(c[S>>2]|0)+4652>>2]|0))break;c[aa>>2]=k+((c[M>>2]|0)*1168|0);c[(c[aa>>2]|0)+1156>>2]=(c[M>>2]|0)+(a[(c[x>>2]|0)+34>>0]|0)&3;c[(c[aa>>2]|0)+1160>>2]=c[(c[aa>>2]|0)+1156>>2];c[(c[aa>>2]|0)+1164>>2]=0;c[(c[aa>>2]|0)+1152>>2]=c[(c[T>>2]|0)+4352>>2];c[(c[aa>>2]|0)+960>>2]=c[(c[T>>2]|0)+1280+((c[(c[S>>2]|0)+4616>>2]|0)-1<<2)>>2];l=c[aa>>2]|0;p=(c[T>>2]|0)+3840|0;m=l+128|0;do{c[l>>2]=c[p>>2];l=l+4|0;p=p+4|0}while((l|0)<(m|0));l=(c[aa>>2]|0)+1088|0;p=(c[T>>2]|0)+4288|0;m=l+64|0;do{c[l>>2]=c[p>>2];l=l+4|0;p=p+4|0}while((l|0)<(m|0));c[M>>2]=(c[M>>2]|0)+1}c[O>>2]=b[24558+(a[(c[x>>2]|0)+29>>0]>>1<<2)+(a[(c[x>>2]|0)+30>>0]<<1)>>1];c[P>>2]=0;c[Y>>2]=te(32,c[(c[S>>2]|0)+4612>>2]|0)|0;a:do if((a[(c[x>>2]|0)+29>>0]|0)!=2){if((c[N>>2]|0)>0)c[Y>>2]=te(c[Y>>2]|0,(c[N>>2]|0)-2-1|0)|0}else{c[M>>2]=0;while(1){if((c[M>>2]|0)>=(c[(c[S>>2]|0)+4604>>2]|0))break a;c[Y>>2]=te(c[Y>>2]|0,(c[(c[U>>2]|0)+(c[M>>2]<<2)>>2]|0)-2-1|0)|0;c[M>>2]=(c[M>>2]|0)+1}}while(0);if((a[(c[x>>2]|0)+31>>0]|0)==4)c[I>>2]=0;else c[I>>2]=1;l=i;i=i+((1*((c[(c[S>>2]|0)+4616>>2]|0)+(c[(c[S>>2]|0)+4608>>2]|0)<<2)|0)+15&-16)|0;p=i;i=i+((1*((c[(c[S>>2]|0)+4616>>2]|0)+(c[(c[S>>2]|0)+4608>>2]|0)<<1)|0)+15&-16)|0;m=i;i=i+((1*(c[(c[S>>2]|0)+4612>>2]<<2)|0)+15&-16)|0;c[ba>>2]=(c[T>>2]|0)+(c[(c[S>>2]|0)+4616>>2]<<1);c[(c[T>>2]|0)+4364>>2]=c[(c[S>>2]|0)+4616>>2];c[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]=(c[M>>2]|0)+1}c[J>>2]=c[k+1164>>2];c[K>>2]=0;c[M>>2]=1;while(1){if((c[M>>2]|0)>=(c[(c[S>>2]|0)+4652>>2]|0))break;if((c[k+((c[M>>2]|0)*1168|0)+1164>>2]|0)<(c[J>>2]|0)){c[J>>2]=c[k+((c[M>>2]|0)*1168|0)+1164>>2];c[K>>2]=c[M>>2]}c[M>>2]=(c[M>>2]|0)+1}c[aa>>2]=k+((c[K>>2]|0)*1168|0);a[(c[x>>2]|0)+34>>0]=c[(c[aa>>2]|0)+1160>>2];c[$>>2]=(c[P>>2]|0)+(c[Y>>2]|0);c[X>>2]=c[(c[u>>2]|0)+((c[(c[S>>2]|0)+4604>>2]|0)-1<<2)>>2]>>6;c[Z>>2]=0;while(1){if((c[Z>>2]|0)>=(c[Y>>2]|0))break;c[$>>2]=(c[$>>2]|0)-1&31;a[(c[W>>2]|0)+((c[Z>>2]|0)-(c[Y>>2]|0))>>0]=(c[(c[aa>>2]|0)+576+(c[$>>2]<<2)>>2]>>9)+1>>1;ha=_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]>>16,(c[X>>2]&65535)<<16>>16)|0;ha=ha+((_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]&65535,(c[X>>2]&65535)<<16>>16)|0)>>16)|0;if(((ha+(_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]|0,(c[X>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){ha=_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]>>16,(c[X>>2]&65535)<<16>>16)|0;ha=ha+((_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]&65535,(c[X>>2]&65535)<<16>>16)|0)>>16)|0;if(((ha+(_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]|0,(c[X>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)l=-32768;else{l=_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]>>16,(c[X>>2]&65535)<<16>>16)|0;l=l+((_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]&65535,(c[X>>2]&65535)<<16>>16)|0)>>16)|0;l=(l+(_(c[(c[aa>>2]|0)+704+(c[$>>2]<<2)>>2]|0,(c[X>>2]>>15)+1>>1)|0)>>7)+1>>1}}else l=32767;b[(c[ba>>2]|0)+((c[Z>>2]|0)-(c[Y>>2]|0)<<1)>>1]=l;c[(c[T>>2]|0)+1280+((c[(c[T>>2]|0)+4364>>2]|0)-(c[Y>>2]|0)+(c[Z>>2]|0)<<2)>>2]=c[(c[aa>>2]|0)+960+(c[$>>2]<<2)>>2];c[Z>>2]=(c[Z>>2]|0)+1}l=(c[T>>2]|0)+3840|0;p=(c[aa>>2]|0)+(c[(c[S>>2]|0)+4612>>2]<<2)|0;m=l+128|0;do{c[l>>2]=c[p>>2];l=l+4|0;p=p+4|0}while((l|0)<(m|0));l=(c[T>>2]|0)+4288|0;p=(c[aa>>2]|0)+1088|0;m=l+64|0;do{c[l>>2]=c[p>>2];l=l+4|0;p=p+4|0}while((l|0)<(m|0));c[(c[T>>2]|0)+4352>>2]=c[(c[aa>>2]|0)+1152>>2];c[(c[T>>2]|0)+4356>>2]=c[(c[U>>2]|0)+((c[(c[S>>2]|0)+4604>>2]|0)-1<<2)>>2];qj(c[T>>2]|0,(c[T>>2]|0)+(c[(c[S>>2]|0)+4608>>2]<<1)|0,c[(c[S>>2]|0)+4616>>2]<<1|0)|0;qj((c[T>>2]|0)+1280|0,(c[T>>2]|0)+1280+(c[(c[S>>2]|0)+4608>>2]<<2)|0,c[(c[S>>2]|0)+4616>>2]<<2|0)|0;na(c[V>>2]|0);i=ca;return}function te(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f+4|0;d=f;c[e>>2]=a;c[d>>2]=b;i=f;return ((c[e>>2]|0)<(c[d>>2]|0)?c[e>>2]|0:c[d>>2]|0)|0}function ue(a,d,e,f,g,h,j,k,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>2]|0,(c[G>>2]>>15)+1>>1)|0)|0;c[(c[y>>2]|0)+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}c[(c[s>>2]|0)+4372>>2]=c[(c[t>>2]|0)+(c[B>>2]<<2)>>2];a:do if(c[(c[s>>2]|0)+4376>>2]|0){if(!(c[B>>2]|0)){M=_(c[H>>2]>>16,(c[D>>2]&65535)<<16>>16)|0;c[H>>2]=M+((_(c[H>>2]&65535,(c[D>>2]&65535)<<16>>16)|0)>>16)<<2}c[F>>2]=(c[(c[s>>2]|0)+4360>>2]|0)-(c[J>>2]|0)-2;while(1){if((c[F>>2]|0)>=(c[(c[s>>2]|0)+4360>>2]|0))break a;M=_(c[H>>2]>>16,b[(c[z>>2]|0)+(c[F>>2]<<1)>>1]|0)|0;M=M+((_(c[H>>2]&65535,b[(c[z>>2]|0)+(c[F>>2]<<1)>>1]|0)|0)>>16)|0;c[(c[A>>2]|0)+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}}while(0);if((c[E>>2]|0)==65536){i=L;return}c[F>>2]=(c[(c[s>>2]|0)+4364>>2]|0)-(c[(c[r>>2]|0)+4616>>2]|0);while(1){if((c[F>>2]|0)>=(c[(c[s>>2]|0)+4364>>2]|0))break;M=_(c[E>>2]>>16,(c[(c[s>>2]|0)+1280+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[s>>2]|0)+1280+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[s>>2]|0)+1280+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[s>>2]|0)+1280+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}b:do if((c[u>>2]|0)==2?(c[(c[s>>2]|0)+4376>>2]|0)==0:0){c[F>>2]=(c[(c[s>>2]|0)+4360>>2]|0)-(c[J>>2]|0)-2;while(1){if((c[F>>2]|0)>=((c[(c[s>>2]|0)+4360>>2]|0)-(c[v>>2]|0)|0))break b;M=_(c[E>>2]>>16,(c[(c[A>>2]|0)+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[A>>2]|0)+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[A>>2]|0)+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[A>>2]|0)+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}}while(0);c[I>>2]=0;while(1){if((c[I>>2]|0)>=(c[C>>2]|0))break;c[K>>2]=(c[w>>2]|0)+((c[I>>2]|0)*1168|0);M=_(c[E>>2]>>16,(c[(c[K>>2]|0)+1152>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[K>>2]|0)+1152>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[K>>2]|0)+1152>>2]>>15)+1>>1)|0)|0;c[(c[K>>2]|0)+1152>>2]=M;c[F>>2]=0;while(1){if((c[F>>2]|0)>=32)break;M=_(c[E>>2]>>16,(c[(c[K>>2]|0)+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[K>>2]|0)+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[K>>2]|0)+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[K>>2]|0)+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}c[F>>2]=0;while(1){if((c[F>>2]|0)>=16)break;M=_(c[E>>2]>>16,(c[(c[K>>2]|0)+1088+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[K>>2]|0)+1088+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[K>>2]|0)+1088+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[K>>2]|0)+1088+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}c[F>>2]=0;while(1){if((c[F>>2]|0)>=32)break;M=_(c[E>>2]>>16,(c[(c[K>>2]|0)+832+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[K>>2]|0)+832+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[K>>2]|0)+832+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[K>>2]|0)+832+(c[F>>2]<<2)>>2]=M;M=_(c[E>>2]>>16,(c[(c[K>>2]|0)+960+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0;M=M+((_(c[E>>2]&65535,(c[(c[K>>2]|0)+960+(c[F>>2]<<2)>>2]&65535)<<16>>16)|0)>>16)|0;M=M+(_(c[E>>2]|0,(c[(c[K>>2]|0)+960+(c[F>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[K>>2]|0)+960+(c[F>>2]<<2)>>2]=M;c[F>>2]=(c[F>>2]|0)+1}c[I>>2]=(c[I>>2]|0)+1}i=L;return}function ve(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+48|0;f=h+32|0;n=h+28|0;d=h+24|0;j=h+20|0;g=h+16|0;k=h+12|0;m=h+8|0;l=h+4|0;e=h;c[n>>2]=a;c[d>>2]=b;b=c[n>>2]|0;c[j>>2]=(we((c[n>>2]|0)>0?b:0-b|0)|0)-1;c[m>>2]=c[n>>2]<>2];c[k>>2]=536870911/(c[m>>2]>>16|0)|0;c[e>>2]=c[k>>2]<<16;b=_(c[m>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;c[l>>2]=536870912-(b+((_(c[m>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))<<3;b=_(c[l>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;b=(c[e>>2]|0)+(b+((_(c[l>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16))|0;c[e>>2]=b+(_(c[l>>2]|0,(c[k>>2]>>15)+1>>1)|0);c[g>>2]=61-(c[j>>2]|0)-(c[d>>2]|0);b=c[g>>2]|0;if((c[g>>2]|0)>0)if((b|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];n=c[f>>2]|0;i=h;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;i=h;return n|0}a=c[e>>2]|0;d=0-(c[g>>2]|0)|0;do if((-2147483648>>0-b|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>d|0)){b=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){b=2147483647>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>d|0)){b=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){b=-2147483648>>0-(c[g>>2]|0);break}else{b=c[e>>2]|0;break}}while(0);c[f>>2]=b<<0-(c[g>>2]|0);n=c[f>>2]|0;i=h;return n|0}function we(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;if(!(c[b>>2]|0)){a=32;i=d;return a|0}a=32-(32-(aa(c[b>>2]|0)|0))|0;i=d;return a|0}function xe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=i;i=i+48|0;f=h+40|0;q=h+36|0;p=h+32|0;j=h+28|0;l=h+24|0;k=h+20|0;g=h+16|0;m=h+12|0;n=h+8|0;o=h+4|0;e=h;c[q>>2]=a;c[p>>2]=b;c[j>>2]=d;b=c[q>>2]|0;c[l>>2]=(we((c[q>>2]|0)>0?b:0-b|0)|0)-1;c[n>>2]=c[q>>2]<>2];b=c[p>>2]|0;c[k>>2]=(we((c[p>>2]|0)>0?b:0-b|0)|0)-1;c[o>>2]=c[p>>2]<>2];c[m>>2]=536870911/(c[o>>2]>>16|0)|0;b=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=b+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16);b=c[n>>2]|0;a=c[o>>2]|0;d=c[e>>2]|0;d=yj(a|0,((a|0)<0)<<31>>31|0,d|0,((d|0)<0)<<31>>31|0)|0;d=nj(d|0,C|0,32)|0;c[n>>2]=b-(d<<3);d=_(c[n>>2]>>16,(c[m>>2]&65535)<<16>>16)|0;c[e>>2]=(c[e>>2]|0)+(d+((_(c[n>>2]&65535,(c[m>>2]&65535)<<16>>16)|0)>>16));c[g>>2]=29+(c[l>>2]|0)-(c[k>>2]|0)-(c[j>>2]|0);d=c[g>>2]|0;if((c[g>>2]|0)>=0)if((d|0)<32){c[f>>2]=c[e>>2]>>c[g>>2];q=c[f>>2]|0;i=h;return q|0}else{c[f>>2]=0;q=c[f>>2]|0;i=h;return q|0}a=c[e>>2]|0;b=0-(c[g>>2]|0)|0;do if((-2147483648>>0-d|0)>(2147483647>>0-(c[g>>2]|0)|0)){if((a|0)>(-2147483648>>b|0)){d=-2147483648>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(2147483647>>0-(c[g>>2]|0)|0)){d=2147483647>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}else{if((a|0)>(2147483647>>b|0)){d=2147483647>>0-(c[g>>2]|0);break}if((c[e>>2]|0)<(-2147483648>>0-(c[g>>2]|0)|0)){d=-2147483648>>0-(c[g>>2]|0);break}else{d=c[e>>2]|0;break}}while(0);c[f>>2]=d<<0-(c[g>>2]|0);q=c[f>>2]|0;i=h;return q|0} + function Uh(a,b,d){a=a|0;b=+b;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;e=l+16|0;f=l+12|0;h=l+8|0;k=l+4|0;j=l;c[e>>2]=a;g[f>>2]=b;c[h>>2]=d;c[j>>2]=c[h>>2]&65532;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[j>>2]|0))break;d=(c[e>>2]|0)+((c[k>>2]|0)+0<<2)|0;g[d>>2]=+g[d>>2]*+g[f>>2];d=(c[e>>2]|0)+((c[k>>2]|0)+1<<2)|0;g[d>>2]=+g[d>>2]*+g[f>>2];d=(c[e>>2]|0)+((c[k>>2]|0)+2<<2)|0;g[d>>2]=+g[d>>2]*+g[f>>2];d=(c[e>>2]|0)+((c[k>>2]|0)+3<<2)|0;g[d>>2]=+g[d>>2]*+g[f>>2];c[k>>2]=(c[k>>2]|0)+4}while(1){if((c[k>>2]|0)>=(c[h>>2]|0))break;j=(c[e>>2]|0)+(c[k>>2]<<2)|0;g[j>>2]=+g[j>>2]*+g[f>>2];c[k>>2]=(c[k>>2]|0)+1}i=l;return}function Vh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0;p=i;i=i+176|0;e=p+168|0;f=p+164|0;h=p+160|0;m=p+156|0;n=p+152|0;j=p+16|0;k=p+8|0;l=p+4|0;o=p;c[e>>2]=a;c[f>>2]=b;c[h>>2]=d;c[m>>2]=0;while(1){if((c[m>>2]|0)>=((c[h>>2]|0)+1|0))break;q=+g[(c[f>>2]|0)+(c[m>>2]<<2)>>2];g[j+(c[m>>2]<<3)+4>>2]=q;g[j+(c[m>>2]<<3)>>2]=q;c[m>>2]=(c[m>>2]|0)+1}c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[h>>2]|0))break;g[o>>2]=-+g[j+((c[m>>2]|0)+1<<3)>>2]/(+g[j+4>>2]>9.999999717180685e-10?+g[j+4>>2]:9.999999717180685e-10);g[(c[e>>2]|0)+(c[m>>2]<<2)>>2]=+g[o>>2];c[n>>2]=0;while(1){if((c[n>>2]|0)>=((c[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=c[o>>2];while(1){if((c[r>>2]|0)>=(c[u>>2]|0))break a;g[t>>2]=+g[t>>2]-+g[p>>2];e=_(c[r>>2]|0,c[k>>2]|0)|0;e=(c[x>>2]|0)+(e<<2)|0;g[e>>2]=+g[e>>2]+ +g[t>>2];e=_(c[r>>2]|0,c[k>>2]|0)|0;if(1.0<+g[(c[x>>2]|0)+(e<<2)>>2])f=1.0;else{e=_(c[r>>2]|0,c[k>>2]|0)|0;f=+g[(c[x>>2]|0)+(e<<2)>>2]}if(!(-1.0>f)){e=_(c[r>>2]|0,c[k>>2]|0)|0;if(1.0<+g[(c[x>>2]|0)+(e<<2)>>2])f=1.0;else{e=_(c[r>>2]|0,c[k>>2]|0)|0;f=+g[(c[x>>2]|0)+(e<<2)>>2]}}else f=-1.0;e=_(c[r>>2]|0,c[k>>2]|0)|0;g[(c[x>>2]|0)+(e<<2)>>2]=f;c[r>>2]=(c[r>>2]|0)+1}}while(0);c[o>>2]=c[q>>2]}while((c[o>>2]|0)!=(c[j>>2]|0));if((z|0)==23){z=0;g[m>>2]=0.0}g[(c[l>>2]|0)+(c[n>>2]<<2)>>2]=+g[m>>2];c[n>>2]=(c[n>>2]|0)+1}i=A;return}function Yh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+16|0;f=j+8|0;g=j+4|0;h=j;c[g>>2]=b;c[h>>2]=e;e=c[g>>2]|0;if((c[g>>2]|0)<252){a[c[h>>2]>>0]=e;c[f>>2]=1;h=c[f>>2]|0;i=j;return h|0}else{a[c[h>>2]>>0]=252+(e&3);a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)-(d[c[h>>2]>>0]|0)>>2;c[f>>2]=2;h=c[f>>2]|0;i=j;return h|0}return 0}function Zh(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0;h=i;i=i+16|0;e=h+8|0;f=h+4|0;g=h;c[e>>2]=a;c[f>>2]=b;b=d[c[e>>2]>>0]|0;if((d[c[e>>2]>>0]|0)&128|0){c[g>>2]=b>>3&3;c[g>>2]=(c[f>>2]<>2]|0)/400|0;g=c[g>>2]|0;i=h;return g|0}a=d[c[e>>2]>>0]|0;if((b&96|0)!=96){c[g>>2]=a>>3&3;b=c[f>>2]|0;if((c[g>>2]|0)==3){c[g>>2]=(b*60|0)/1e3|0;g=c[g>>2]|0;i=h;return g|0}else{c[g>>2]=(b<>2]|0)/100|0;g=c[g>>2]|0;i=h;return g|0}}else{b=c[f>>2]|0;if(a&8|0)b=(b|0)/50|0;else b=(b|0)/100|0;c[g>>2]=b;g=c[g>>2]|0;i=h;return g|0}return 0}function _h(e,f,g,h,j,k,l,m){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;J=i;i=i+80|0;n=J+72|0;o=J+68|0;p=J+64|0;q=J+60|0;r=J+56|0;s=J+52|0;t=J+48|0;u=J+44|0;v=J+40|0;C=J+36|0;w=J+32|0;z=J+28|0;x=J+24|0;y=J+77|0;H=J+76|0;B=J+20|0;D=J+16|0;F=J+12|0;A=J+8|0;E=J+4|0;G=J;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=j;c[t>>2]=k;c[u>>2]=l;c[v>>2]=m;c[F>>2]=0;c[A>>2]=c[o>>2];if(!(c[t>>2]|0)){c[n>>2]=-1;I=c[n>>2]|0;i=J;return I|0}c[B>>2]=Zh(c[o>>2]|0,48e3)|0;c[x>>2]=0;k=c[o>>2]|0;c[o>>2]=k+1;a[H>>0]=a[k>>0]|0;c[p>>2]=(c[p>>2]|0)+-1;c[D>>2]=c[p>>2];a:do switch(d[H>>0]&3|0){case 0:{c[z>>2]=1;break}case 1:{c[z>>2]=2;c[x>>2]=1;if(!(c[q>>2]|0)){if(!(c[p>>2]&1)){c[D>>2]=(c[p>>2]|0)/2|0;b[c[t>>2]>>1]=c[D>>2];break a}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}break}case 2:{c[z>>2]=2;c[w>>2]=$h(c[o>>2]|0,c[p>>2]|0,c[t>>2]|0)|0;c[p>>2]=(c[p>>2]|0)-(c[w>>2]|0);if((b[c[t>>2]>>1]|0)>=0?(b[c[t>>2]>>1]|0)<=(c[p>>2]|0):0){c[o>>2]=(c[o>>2]|0)+(c[w>>2]|0);c[D>>2]=(c[p>>2]|0)-(b[c[t>>2]>>1]|0);break a}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}default:{if((c[p>>2]|0)<1){c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}k=c[o>>2]|0;c[o>>2]=k+1;a[y>>0]=a[k>>0]|0;c[z>>2]=d[y>>0]&63;if((c[z>>2]|0)>0?(_(c[B>>2]|0,c[z>>2]|0)|0)<=5760:0){c[p>>2]=(c[p>>2]|0)+-1;b:do if(d[y>>0]&64|0){while(1){if((c[p>>2]|0)<=0)break;k=c[o>>2]|0;c[o>>2]=k+1;c[E>>2]=d[k>>0];c[p>>2]=(c[p>>2]|0)+-1;c[G>>2]=(c[E>>2]|0)==255?254:c[E>>2]|0;c[p>>2]=(c[p>>2]|0)-(c[G>>2]|0);c[F>>2]=(c[F>>2]|0)+(c[G>>2]|0);if((c[E>>2]|0)!=255)break b}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}while(0);if((c[p>>2]|0)<0){c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}c[x>>2]=((d[y>>0]&128|0)!=0^1)&1;if(c[x>>2]|0){if(c[q>>2]|0)break a;c[D>>2]=(c[p>>2]|0)/(c[z>>2]|0)|0;I=_(c[D>>2]|0,c[z>>2]|0)|0;if((I|0)!=(c[p>>2]|0)){c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}c[C>>2]=0;while(1){if((c[C>>2]|0)>=((c[z>>2]|0)-1|0))break a;b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]=c[D>>2];c[C>>2]=(c[C>>2]|0)+1}}c[D>>2]=c[p>>2];c[C>>2]=0;while(1){if((c[C>>2]|0)>=((c[z>>2]|0)-1|0))break;c[w>>2]=$h(c[o>>2]|0,c[p>>2]|0,(c[t>>2]|0)+(c[C>>2]<<1)|0)|0;c[p>>2]=(c[p>>2]|0)-(c[w>>2]|0);if((b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]|0)<0){I=29;break}if((b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]|0)>(c[p>>2]|0)){I=29;break}c[o>>2]=(c[o>>2]|0)+(c[w>>2]|0);c[D>>2]=(c[D>>2]|0)-((c[w>>2]|0)+(b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]|0));c[C>>2]=(c[C>>2]|0)+1}if((I|0)==29){c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}if((c[D>>2]|0)>=0)break a;c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}}while(0);c:do if(c[q>>2]|0){c[w>>2]=$h(c[o>>2]|0,c[p>>2]|0,(c[t>>2]|0)+(c[z>>2]<<1)+-2|0)|0;c[p>>2]=(c[p>>2]|0)-(c[w>>2]|0);if((b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)>=0?(b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)<=(c[p>>2]|0):0){c[o>>2]=(c[o>>2]|0)+(c[w>>2]|0);if(!(c[x>>2]|0)){if(((c[w>>2]|0)+(b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)|0)<=(c[D>>2]|0))break;c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}I=_(b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0,c[z>>2]|0)|0;if((I|0)>(c[p>>2]|0)){c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}c[C>>2]=0;while(1){if((c[C>>2]|0)>=((c[z>>2]|0)-1|0))break c;b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]=b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0;c[C>>2]=(c[C>>2]|0)+1}}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}else{if((c[D>>2]|0)<=1275){b[(c[t>>2]|0)+((c[z>>2]|0)-1<<1)>>1]=c[D>>2];break}c[n>>2]=-4;I=c[n>>2]|0;i=J;return I|0}while(0);if(c[u>>2]|0)c[c[u>>2]>>2]=(c[o>>2]|0)-(c[A>>2]|0);c[C>>2]=0;while(1){if((c[C>>2]|0)>=(c[z>>2]|0))break;if(c[s>>2]|0)c[(c[s>>2]|0)+(c[C>>2]<<2)>>2]=c[o>>2];c[o>>2]=(c[o>>2]|0)+(b[(c[t>>2]|0)+(c[C>>2]<<1)>>1]|0);c[C>>2]=(c[C>>2]|0)+1}if(c[v>>2]|0)c[c[v>>2]>>2]=(c[F>>2]|0)+((c[o>>2]|0)-(c[A>>2]|0));if(c[r>>2]|0)a[c[r>>2]>>0]=a[H>>0]|0;c[n>>2]=c[z>>2];I=c[n>>2]|0;i=J;return I|0}function $h(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;g=l+12|0;h=l+8|0;j=l+4|0;k=l;c[h>>2]=a;c[j>>2]=e;c[k>>2]=f;if((c[j>>2]|0)<1){b[c[k>>2]>>1]=-1;c[g>>2]=-1;f=c[g>>2]|0;i=l;return f|0}if((d[c[h>>2]>>0]|0|0)<252){b[c[k>>2]>>1]=d[c[h>>2]>>0]|0;c[g>>2]=1;f=c[g>>2]|0;i=l;return f|0}if((c[j>>2]|0)<2){b[c[k>>2]>>1]=-1;c[g>>2]=-1;f=c[g>>2]|0;i=l;return f|0}else{b[c[k>>2]>>1]=((d[(c[h>>2]|0)+1>>0]|0)<<2)+(d[c[h>>2]>>0]|0);c[g>>2]=2;f=c[g>>2]|0;i=l;return f|0}return 0}function ai(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;e=h+4|0;f=h;c[d>>2]=a;if((c[d>>2]|0)<1|(c[d>>2]|0)>2){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}c[f>>2]=Pd(g)|0;if(c[f>>2]|0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}else{c[g>>2]=bi(c[g>>2]|0)|0;c[e>>2]=Fb(c[d>>2]|0)|0;f=bi(88)|0;c[b>>2]=f+(c[g>>2]|0)+(c[e>>2]|0);g=c[b>>2]|0;i=h;return g|0}return 0}function bi(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+16|0;e=b+4|0;d=b;c[e>>2]=a;c[d>>2]=4;a=_((((c[e>>2]|0)+(c[d>>2]|0)-1|0)>>>0)/((c[d>>2]|0)>>>0)|0,c[d>>2]|0)|0;i=b;return a|0}function ci(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+48|0;n=o;e=o+32|0;f=o+28|0;g=o+24|0;h=o+20|0;m=o+16|0;j=o+12|0;k=o+8|0;l=o+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!((c[g>>2]|0)!=48e3&(c[g>>2]|0)!=24e3&(c[g>>2]|0)!=16e3&(c[g>>2]|0)!=12e3&(c[g>>2]|0)!=8e3)?!((c[h>>2]|0)!=1&(c[h>>2]|0)!=2):0){a=c[f>>2]|0;oj(a|0,0,ai(c[h>>2]|0)|0)|0;c[k>>2]=Pd(l)|0;if(c[k>>2]|0){c[e>>2]=-3;n=c[e>>2]|0;i=o;return n|0}c[l>>2]=bi(c[l>>2]|0)|0;a=bi(88)|0;c[(c[f>>2]|0)+4>>2]=a;c[c[f>>2]>>2]=(c[(c[f>>2]|0)+4>>2]|0)+(c[l>>2]|0);c[m>>2]=(c[f>>2]|0)+(c[(c[f>>2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>>2]=k;c[r>>2]=l;c[s>>2]=m;if((c[p>>2]|0)<0|(c[p>>2]|0)>1){c[G>>2]=-1;M=c[G>>2]|0;i=N;return M|0}if((c[p>>2]|0)!=0|(c[o>>2]|0)==0|(c[n>>2]|0)==0?(c[J>>2]|0)%((c[(c[H>>2]|0)+12>>2]|0)/400|0|0)|0|0:0){c[G>>2]=-1;M=c[G>>2]|0;i=N;return M|0}if((c[o>>2]|0)==0|(c[n>>2]|0)==0){c[K>>2]=0;while(1){n=(c[I>>2]|0)+((_(c[K>>2]|0,c[(c[H>>2]|0)+8>>2]|0)|0)<<2)|0;c[L>>2]=fi(c[H>>2]|0,0,0,n,(c[J>>2]|0)-(c[K>>2]|0)|0,0)|0;n=c[L>>2]|0;if((c[L>>2]|0)<0){M=9;break}c[K>>2]=(c[K>>2]|0)+n;if((c[K>>2]|0)>=(c[J>>2]|0)){M=11;break}}if((M|0)==9){c[G>>2]=n;M=c[G>>2]|0;i=N;return M|0}else if((M|0)==11){ii()|0;c[(c[H>>2]|0)+72>>2]=c[K>>2];c[G>>2]=c[K>>2];M=c[G>>2]|0;i=N;return M|0}}if((c[o>>2]|0)<0){c[G>>2]=-1;M=c[G>>2]|0;i=N;return M|0}c[A>>2]=ji(c[n>>2]|0)|0;c[y>>2]=ki(c[n>>2]|0)|0;c[z>>2]=Zh(c[n>>2]|0,c[(c[H>>2]|0)+12>>2]|0)|0;c[B>>2]=li(c[n>>2]|0)|0;c[t>>2]=_h(c[n>>2]|0,c[o>>2]|0,c[q>>2]|0,F,0,E,x,c[r>>2]|0)|0;if((c[t>>2]|0)<0){c[G>>2]=c[t>>2];M=c[G>>2]|0;i=N;return M|0}c[n>>2]=(c[n>>2]|0)+(c[x>>2]|0);if(c[p>>2]|0){if(!((c[A>>2]|0)==1002?1:(c[J>>2]|0)<(c[z>>2]|0))?(c[(c[H>>2]|0)+56>>2]|0)!=1002:0){c[u>>2]=c[(c[H>>2]|0)+72>>2];if((c[J>>2]|0)-(c[z>>2]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2]=(c[n>>2]|0)+(b[E+(c[v>>2]<<1)>>1]|0);c[w>>2]=(c[w>>2]|0)+(c[D>>2]|0);c[v>>2]=(c[v>>2]|0)+1}if((M|0)==31){c[G>>2]=c[D>>2];M=c[G>>2]|0;i=N;return M|0}c[(c[H>>2]|0)+72>>2]=c[w>>2];ii()|0;if(c[s>>2]|0)Xh(c[I>>2]|0,c[w>>2]|0,c[(c[H>>2]|0)+8>>2]|0,(c[H>>2]|0)+76|0);else{g[(c[H>>2]|0)+76+4>>2]=0.0;g[(c[H>>2]|0)+76>>2]=0.0}c[G>>2]=c[w>>2];M=c[G>>2]|0;i=N;return M|0}function fi(d,e,f,h,j,k){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ja=0,ka=0,la=0,ma=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0;ta=i;i=i+320|0;fa=ta+80|0;ea=ta+72|0;da=ta+64|0;ca=ta+56|0;ba=ta+48|0;aa=ta+40|0;$=ta+32|0;Z=ta+24|0;Y=ta+16|0;y=ta+8|0;x=ta;qa=ta+308|0;ra=ta+304|0;A=ta+300|0;B=ta+296|0;ja=ta+292|0;ka=ta+288|0;C=ta+284|0;t=ta+280|0;H=ta+276|0;N=ta+272|0;v=ta+268|0;pa=ta+264|0;L=ta+216|0;u=ta+212|0;o=ta+208|0;z=ta+204|0;m=ta+200|0;P=ta+196|0;S=ta+192|0;sa=ta+188|0;O=ta+184|0;W=ta+180|0;V=ta+176|0;Q=ta+172|0;R=ta+168|0;K=ta+164|0;F=ta+160|0;D=ta+156|0;E=ta+152|0;n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((c[sa>>2]|0)>(c[oa>>2]|0)){while(1){c[l>>2]=fi(c[ra>>2]|0,0,0,c[ja>>2]|0,(c[sa>>2]|0)<(c[oa>>2]|0)?c[sa>>2]|0:c[oa>>2]|0,0)|0;e=c[l>>2]|0;if((c[l>>2]|0)<0){k=20;break}pa=_(e,c[(c[ra>>2]|0)+8>>2]|0)|0;c[ja>>2]=(c[ja>>2]|0)+(pa<<2);c[sa>>2]=(c[sa>>2]|0)-(c[l>>2]|0);if((c[sa>>2]|0)<=0){k=22;break}}if((k|0)==20){c[qa>>2]=e;sa=c[qa>>2]|0;i=ta;return sa|0}else if((k|0)==22){c[qa>>2]=c[ka>>2];sa=c[qa>>2]|0;i=ta;return sa|0}}if((c[sa>>2]|0)<(c[oa>>2]|0)){if((c[sa>>2]|0)>(c[n>>2]|0)){c[sa>>2]=c[n>>2];break}if(((c[O>>2]|0)!=1e3?(c[sa>>2]|0)>(c[E>>2]|0):0)?(c[sa>>2]|0)<(c[n>>2]|0):0)c[sa>>2]=c[E>>2]}}else{c[sa>>2]=c[(c[ra>>2]|0)+64>>2];c[O>>2]=c[(c[ra>>2]|0)+56>>2];Yb(L,c[A>>2]|0,c[B>>2]|0)}while(0);c[G>>2]=0;c[z>>2]=1;c[m>>2]=1;do if(c[A>>2]|0?(c[(c[ra>>2]|0)+60>>2]|0)>0:0){if(!(((c[O>>2]|0)==1002?(c[(c[ra>>2]|0)+60>>2]|0)!=1002:0)?!(c[(c[ra>>2]|0)+68>>2]|0):0)){if((c[O>>2]|0)==1002)break;if((c[(c[ra>>2]|0)+60>>2]|0)!=1002)break}c[W>>2]=1;e=_(c[E>>2]|0,c[(c[ra>>2]|0)+8>>2]|0)|0;if((c[O>>2]|0)==1002){c[m>>2]=e;break}else{c[z>>2]=e;break}}while(0);m=c[m>>2]|0;c[la>>2]=ia()|0;e=i;i=i+((1*(m<<2)|0)+15&-16)|0;if((c[W>>2]|0)!=0&(c[O>>2]|0)==1002){c[P>>2]=e;fi(c[ra>>2]|0,0,0,c[P>>2]|0,(c[E>>2]|0)<(c[sa>>2]|0)?c[E>>2]|0:c[sa>>2]|0,0)|0}a:do if((c[sa>>2]|0)>(c[ka>>2]|0)){c[qa>>2]=-1;c[ma>>2]=1}else{c[ka>>2]=c[sa>>2];if((c[O>>2]|0)==1002|(c[G>>2]|0)!=0)e=1;else e=_((c[n>>2]|0)>(c[ka>>2]|0)?c[n>>2]|0:c[ka>>2]|0,c[(c[ra>>2]|0)+8>>2]|0)|0;c[o>>2]=e;j=i;i=i+((1*(c[o>>2]<<1)|0)+15&-16)|0;b:do if((c[O>>2]|0)!=1002){c[s>>2]=j;if((c[(c[ra>>2]|0)+60>>2]|0)==1002)Qd(c[t>>2]|0)|0;if(10>(((c[sa>>2]|0)*1e3|0)/(c[(c[ra>>2]|0)+12>>2]|0)|0|0))e=10;else e=((c[sa>>2]|0)*1e3|0)/(c[(c[ra>>2]|0)+12>>2]|0)|0;c[(c[ra>>2]|0)+16+16>>2]=e;do if(c[A>>2]|0){c[(c[ra>>2]|0)+16+4>>2]=c[(c[ra>>2]|0)+48>>2];e=c[ra>>2]|0;if((c[O>>2]|0)!=1e3){c[e+16+12>>2]=16e3;break}k=c[ra>>2]|0;if((c[e+52>>2]|0)==1101){c[k+16+12>>2]=8e3;break}if((c[k+52>>2]|0)==1102){c[(c[ra>>2]|0)+16+12>>2]=12e3;break}else{c[(c[ra>>2]|0)+16+12>>2]=16e3;break}}while(0);c[r>>2]=(c[A>>2]|0)==0?1:c[C>>2]<<1;c[p>>2]=0;c:while(1){c[q>>2]=(c[p>>2]|0)==0&1;c[v>>2]=Rd(c[t>>2]|0,(c[ra>>2]|0)+16|0,c[r>>2]|0,c[q>>2]|0,L,c[s>>2]|0,u,c[(c[ra>>2]|0)+44>>2]|0)|0;d:do if(c[v>>2]|0){if(!(c[r>>2]|0))break c;c[u>>2]=c[ka>>2];c[N>>2]=0;while(1){if((c[N>>2]|0)>=(_(c[ka>>2]|0,c[(c[ra>>2]|0)+8>>2]|0)|0))break d;b[(c[s>>2]|0)+(c[N>>2]<<1)>>1]=0;c[N>>2]=(c[N>>2]|0)+1}}while(0);o=_(c[u>>2]|0,c[(c[ra>>2]|0)+8>>2]|0)|0;c[s>>2]=(c[s>>2]|0)+(o<<1);c[p>>2]=(c[p>>2]|0)+(c[u>>2]|0);if((c[p>>2]|0)>=(c[ka>>2]|0))break b}c[qa>>2]=-3;c[ma>>2]=1;break a}while(0);c[V>>2]=0;if((c[C>>2]|0)==0&(c[O>>2]|0)!=1002&(c[A>>2]|0)!=0?(v=(gi(L)|0)+17|0,(v+(((c[(c[ra>>2]|0)+56>>2]|0)==1001&1)*20|0)|0)<=(c[B>>2]<<3|0)):0){if((c[O>>2]|0)==1001)c[Q>>2]=dc(L,12)|0;else c[Q>>2]=1;if(c[Q>>2]|0){c[K>>2]=dc(L,1)|0;if((c[O>>2]|0)==1001)e=(fc(L,256)|0)+2|0;else{e=c[B>>2]|0;e=e-((gi(L)|0)+7>>3)|0}c[R>>2]=e;c[B>>2]=(c[B>>2]|0)-(c[R>>2]|0);v=c[B>>2]<<3;if((v|0)<(gi(L)|0)){c[B>>2]=0;c[R>>2]=0;c[Q>>2]=0}v=L+4|0;c[v>>2]=(c[v>>2]|0)-(c[R>>2]|0)}}if((c[O>>2]|0)!=1002)c[V>>2]=17;c[w>>2]=21;switch(c[(c[ra>>2]|0)+52>>2]|0){case 1101:{c[w>>2]=13;break}case 1103:case 1102:{c[w>>2]=17;break}case 1104:{c[w>>2]=19;break}case 1105:{c[w>>2]=21;break}default:{}}v=c[H>>2]|0;c[x>>2]=c[w>>2];Kb(v,10012,x)|0;x=c[H>>2]|0;c[y>>2]=c[(c[ra>>2]|0)+48>>2];Kb(x,10008,y)|0;if(c[Q>>2]|0){c[W>>2]=0;c[z>>2]=1}e=i;i=i+((1*(c[z>>2]<<2)|0)+15&-16)|0;if((c[W>>2]|0)!=0&(c[O>>2]|0)!=1002){c[P>>2]=e;fi(c[ra>>2]|0,0,0,c[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=+X(+(+(c[(c[ra>>2]|0)+40>>2]|0)*6.488140788860619e-04*.6931471805599453));c[N>>2]=0;while(1){if((c[N>>2]|0)>=(_(c[ka>>2]|0,c[(c[ra>>2]|0)+8>>2]|0)|0))break g;g[ha>>2]=+g[(c[ja>>2]|0)+(c[N>>2]<<2)>>2]*+g[M>>2];g[(c[ja>>2]|0)+(c[N>>2]<<2)>>2]=+g[ha>>2];c[N>>2]=(c[N>>2]|0)+1}}while(0);if((c[B>>2]|0)<=1)c[(c[ra>>2]|0)+84>>2]=0;else c[(c[ra>>2]|0)+84>>2]=c[L+28>>2]^c[T>>2];c[(c[ra>>2]|0)+60>>2]=c[O>>2];if(c[Q>>2]|0)e=(c[K>>2]|0)!=0^1;else e=0;c[(c[ra>>2]|0)+68>>2]=e&1;if((c[pa>>2]|0)>=0)ii()|0;c[qa>>2]=(c[pa>>2]|0)<0?c[pa>>2]|0:c[sa>>2]|0;c[ma>>2]=1}while(0);na(c[la>>2]|0);sa=c[qa>>2]|0;i=ta;return sa|0}function gi(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(aa(c[(c[d>>2]|0)+28>>2]|0)|0))|0;i=b;return a|0}function hi(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;u=i;i=i+48|0;k=u+40|0;l=u+36|0;m=u+32|0;n=u+28|0;o=u+24|0;p=u+20|0;v=u+16|0;r=u+12|0;q=u+8|0;s=u+4|0;t=u;c[k>>2]=a;c[l>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;c[v>>2]=j;c[s>>2]=48e3/(c[v>>2]|0)|0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[o>>2]|0))break;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[n>>2]|0))break;h=_(c[r>>2]|0,c[s>>2]|0)|0;e=_(c[r>>2]|0,c[s>>2]|0)|0;g[t>>2]=+g[(c[p>>2]|0)+(h<<2)>>2]*+g[(c[p>>2]|0)+(e<<2)>>2];e=_(c[r>>2]|0,c[o>>2]|0)|0;h=_(c[r>>2]|0,c[o>>2]|0)|0;v=_(c[r>>2]|0,c[o>>2]|0)|0;g[(c[m>>2]|0)+(v+(c[q>>2]|0)<<2)>>2]=+g[t>>2]*+g[(c[l>>2]|0)+(e+(c[q>>2]|0)<<2)>>2]+(1.0-+g[t>>2])*+g[(c[k>>2]|0)+(h+(c[q>>2]|0)<<2)>>2];c[r>>2]=(c[r>>2]|0)+1}c[q>>2]=(c[q>>2]|0)+1}i=u;return}function ii(){return 0}function ji(a){a=a|0;var b=0,e=0,f=0;f=i;i=i+16|0;b=f+4|0;e=f;c[b>>2]=a;do if(!((d[c[b>>2]>>0]|0)&128|0))if(((d[c[b>>2]>>0]|0)&96|0)==96){c[e>>2]=1001;break}else{c[e>>2]=1e3;break}else c[e>>2]=1002;while(0);i=f;return c[e>>2]|0}function ki(a){a=a|0;var b=0,e=0,f=0,g=0;g=i;i=i+16|0;b=g+4|0;f=g;c[b>>2]=a;e=d[c[b>>2]>>0]|0;if((d[c[b>>2]>>0]|0)&128|0){e=1102+(e>>5&3)|0;c[f>>2]=e;c[f>>2]=(c[f>>2]|0)==1102?1101:e;f=c[f>>2]|0;i=g;return f|0}a=d[c[b>>2]>>0]|0;if((e&96|0)==96){c[f>>2]=a&16|0?1105:1104;f=c[f>>2]|0;i=g;return f|0}else{c[f>>2]=1101+(a>>5&3);f=c[f>>2]|0;i=g;return f|0}return 0}function li(a){a=a|0;var b=0,e=0;e=i;i=i+16|0;b=e;c[b>>2]=a;i=e;return ((d[c[b>>2]>>0]|0)&4|0?2:1)|0}function mi(a,d,e,f,h,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+48|0;l=v+40|0;m=v+36|0;n=v+32|0;o=v+28|0;p=v+24|0;q=v+20|0;r=v+16|0;u=v+12|0;t=v+8|0;k=v+4|0;s=v;c[m>>2]=a;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=h;c[r>>2]=j;if((c[q>>2]|0)<=0){c[l>>2]=-1;u=c[l>>2]|0;i=v;return u|0}do if(!((c[n>>2]|0)!=0&(c[o>>2]|0)>0^1|(c[r>>2]|0)!=0)){c[k>>2]=ni(c[m>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;if((c[k>>2]|0)>0){c[q>>2]=(c[q>>2]|0)<(c[k>>2]|0)?c[q>>2]|0:c[k>>2]|0;break}c[l>>2]=-4;u=c[l>>2]|0;i=v;return u|0}while(0);a=_(c[q>>2]|0,c[(c[m>>2]|0)+8>>2]|0)|0;c[s>>2]=ia()|0;d=i;i=i+((1*(a<<2)|0)+15&-16)|0;c[u>>2]=ei(c[m>>2]|0,c[n>>2]|0,c[o>>2]|0,d,c[q>>2]|0,c[r>>2]|0,0,0,1)|0;a:do if((c[u>>2]|0)>0){c[t>>2]=0;while(1){if((c[t>>2]|0)>=(_(c[u>>2]|0,c[(c[m>>2]|0)+8>>2]|0)|0))break a;r=qi(+g[d+(c[t>>2]<<2)>>2])|0;b[(c[p>>2]|0)+(c[t>>2]<<1)>>1]=r;c[t>>2]=(c[t>>2]|0)+1}}while(0);c[l>>2]=c[u>>2];na(c[s>>2]|0);u=c[l>>2]|0;i=v;return u|0}function ni(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+16|0;f=e+8|0;h=e+4|0;g=e;c[f>>2]=a;c[h>>2]=b;c[g>>2]=d;b=oi(c[h>>2]|0,c[g>>2]|0,c[(c[f>>2]|0)+12>>2]|0)|0;i=e;return b|0}function oi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;j=i;i=i+32|0;e=j+20|0;f=j+16|0;l=j+12|0;g=j+8|0;h=j+4|0;k=j;c[f>>2]=a;c[l>>2]=b;c[g>>2]=d;c[k>>2]=pi(c[f>>2]|0,c[l>>2]|0)|0;d=c[k>>2]|0;if((c[k>>2]|0)<0){c[e>>2]=d;l=c[e>>2]|0;i=j;return l|0}c[h>>2]=_(d,Zh(c[f>>2]|0,c[g>>2]|0)|0)|0;if(((c[h>>2]|0)*25|0)>((c[g>>2]|0)*3|0)){c[e>>2]=-4;l=c[e>>2]|0;i=j;return l|0}else{c[e>>2]=c[h>>2];l=c[e>>2]|0;i=j;return l|0}return 0}function pi(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;e=j+12|0;f=j+8|0;g=j+4|0;h=j;c[f>>2]=a;c[g>>2]=b;do if((c[g>>2]|0)>=1){c[h>>2]=(d[c[f>>2]>>0]|0)&3;if(!(c[h>>2]|0)){c[e>>2]=1;break}if((c[h>>2]|0)!=3){c[e>>2]=2;break}if((c[g>>2]|0)<2){c[e>>2]=-4;break}else{c[e>>2]=(d[(c[f>>2]|0)+1>>0]|0)&63;break}}else c[e>>2]=-1;while(0);i=j;return c[e>>2]|0}function qi(a){a=+a;var b=0,c=0;c=i;i=i+16|0;b=c;g[b>>2]=a;g[b>>2]=+g[b>>2]*32768.0;g[b>>2]=+g[b>>2]>-32768.0?+g[b>>2]:-32768.0;g[b>>2]=+g[b>>2]<32767.0?+g[b>>2]:32767.0;b=(ij(+g[b>>2])|0)&65535;i=c;return b|0}function ri(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;h=p+24|0;j=p+20|0;k=p+16|0;l=p+12|0;m=p+8|0;n=p+4|0;o=p;c[j>>2]=a;c[k>>2]=b;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;if((c[n>>2]|0)<=0){c[h>>2]=-1;a=c[h>>2]|0;i=p;return a|0}else{c[h>>2]=ei(c[j>>2]|0,c[k>>2]|0,c[l>>2]|0,c[m>>2]|0,c[n>>2]|0,c[o>>2]|0,0,0,0)|0;a=c[h>>2]|0;i=p;return a|0}return 0}function si(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=i;i=i+80|0;q=t+8|0;r=t+76|0;e=t+72|0;u=t+68|0;s=t+64|0;f=t+48|0;h=t+44|0;g=t+40|0;j=t+36|0;k=t+32|0;l=t+28|0;m=t+24|0;n=t+20|0;o=t+16|0;p=t+12|0;c[e>>2]=a;c[u>>2]=b;c[s>>2]=0;c[h>>2]=(c[e>>2]|0)+(c[(c[e>>2]|0)+4>>2]|0);c[g>>2]=(c[e>>2]|0)+(c[c[e>>2]>>2]|0);c[f>>2]=d;a:do switch(c[u>>2]|0){case 4009:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[j>>2]=u;if(c[j>>2]|0){c[c[j>>2]>>2]=c[(c[e>>2]|0)+52>>2];e=20}else e=21;break}case 4031:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[k>>2]=u;if(c[k>>2]|0){c[c[k>>2]>>2]=c[(c[e>>2]|0)+84>>2];e=20}else e=21;break}case 4028:{oj((c[e>>2]|0)+48|0,0,88-((c[e>>2]|0)+48-(c[e>>2]|0))|0)|0;Kb(c[g>>2]|0,4028,t)|0;Qd(c[h>>2]|0)|0;c[(c[e>>2]|0)+48>>2]=c[(c[e>>2]|0)+8>>2];c[(c[e>>2]|0)+64>>2]=(c[(c[e>>2]|0)+12>>2]|0)/400|0;e=20;break}case 4029:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[l>>2]=u;if(c[l>>2]|0){c[c[l>>2]>>2]=c[(c[e>>2]|0)+12>>2];e=20}else e=21;break}case 4033:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[m>>2]=u;if(c[m>>2]|0)if((c[(c[e>>2]|0)+60>>2]|0)==1002){e=c[g>>2]|0;c[q>>2]=(c[m>>2]|0)+((((c[m>>2]|0)-(c[m>>2]|0)|0)/4|0)<<2);Kb(e,4033,q)|0;e=20;break a}else{c[c[m>>2]>>2]=c[(c[e>>2]|0)+16+20>>2];e=20;break a}else e=21;break}case 4045:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[n>>2]=u;if(c[n>>2]|0){c[c[n>>2]>>2]=c[(c[e>>2]|0)+40>>2];e=20}else e=21;break}case 4034:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[o>>2]=u;if((c[o>>2]|0)<-32768|(c[o>>2]|0)>32767)e=21;else{c[(c[e>>2]|0)+40>>2]=c[o>>2];e=20}break}case 4039:{d=(c[f>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[f>>2]=d+4;c[p>>2]=u;if(c[p>>2]|0){c[c[p>>2]>>2]=c[(c[e>>2]|0)+72>>2];e=20}else e=21;break}default:{c[s>>2]=-5;e=20}}while(0);if((e|0)==20){c[r>>2]=c[s>>2];u=c[r>>2]|0;i=t;return u|0}else if((e|0)==21){c[r>>2]=-1;u=c[r>>2]|0;i=t;return u|0}return 0}function ti(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=i;i=i+32|0;b=h+16|0;d=h+12|0;g=h+8|0;e=h+4|0;f=h;c[d>>2]=a;if((c[d>>2]|0)<1|(c[d>>2]|0)>2){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}c[f>>2]=Sd(g)|0;if(c[f>>2]|0){c[b>>2]=0;g=c[b>>2]|0;i=h;return g|0}else{c[g>>2]=ui(c[g>>2]|0)|0;c[e>>2]=h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)+132>>2]|0)/100|0;c[(c[j>>2]|0)+156>>2]=24;c[(c[j>>2]|0)+144>>2]=5e3;c[(c[j>>2]|0)+104>>2]=(c[(c[j>>2]|0)+132>>2]|0)/250|0;b[(c[j>>2]|0)+14292>>1]=16384;g[(c[j>>2]|0)+14300>>2]=1.0;t=(Sf(60)|0)<<8;c[(c[j>>2]|0)+14296>>2]=t;c[(c[j>>2]|0)+14344>>2]=1;c[(c[j>>2]|0)+14320>>2]=1001;c[(c[j>>2]|0)+14336>>2]=1105;Yi((c[j>>2]|0)+172|0);c[h>>2]=0;t=c[h>>2]|0;i=u;return t|0}}c[h>>2]=-1;t=c[h>>2]|0;i=u;return t|0}function wi(){return 0}function xi(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;u=i;i=i+48|0;v=u+40|0;k=u+36|0;l=u+32|0;m=u+28|0;n=u+24|0;o=u+20|0;p=u+16|0;t=u+12|0;s=u+8|0;r=u+4|0;q=u;c[v>>2]=a;c[k>>2]=b;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=h;c[p>>2]=j;c[t>>2]=c[v>>2];c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[l>>2]|0))break;v=_((c[r>>2]|0)+(c[m>>2]|0)|0,c[p>>2]|0)|0;g[(c[k>>2]|0)+(c[r>>2]<<2)>>2]=+g[(c[t>>2]|0)+(v+(c[n>>2]|0)<<2)>>2]*32768.0;c[r>>2]=(c[r>>2]|0)+1}a:do if((c[o>>2]|0)<=-1){if((c[o>>2]|0)==-2){c[q>>2]=1;while(1){if((c[q>>2]|0)>=(c[p>>2]|0))break a;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[l>>2]|0))break;d=_((c[r>>2]|0)+(c[m>>2]|0)|0,c[p>>2]|0)|0;v=(c[k>>2]|0)+(c[r>>2]<<2)|0;g[v>>2]=+g[v>>2]+ +g[(c[t>>2]|0)+(d+(c[q>>2]|0)<<2)>>2]*32768.0;c[r>>2]=(c[r>>2]|0)+1}c[q>>2]=(c[q>>2]|0)+1}}}else{c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[l>>2]|0))break a;d=_((c[r>>2]|0)+(c[m>>2]|0)|0,c[p>>2]|0)|0;v=(c[k>>2]|0)+(c[r>>2]<<2)|0;g[v>>2]=+g[v>>2]+ +g[(c[t>>2]|0)+(d+(c[o>>2]|0)<<2)>>2]*32768.0;c[r>>2]=(c[r>>2]|0)+1}}while(0);g[s>>2]=1.0;if((c[p>>2]|0)==-2)g[s>>2]=+g[s>>2]/+(c[p>>2]|0);else g[s>>2]=+g[s>>2]/2.0;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[l>>2]|0))break;v=(c[k>>2]|0)+(c[r>>2]<<2)|0;g[v>>2]=+g[v>>2]*+g[s>>2];c[r>>2]=(c[r>>2]|0)+1}i=u;return}function yi(a,d,e,f,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;v=i;i=i+48|0;w=v+40|0;l=v+36|0;m=v+32|0;n=v+28|0;o=v+24|0;p=v+20|0;q=v+16|0;u=v+12|0;t=v+8|0;s=v+4|0;r=v;c[w>>2]=a;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=h;c[p>>2]=j;c[q>>2]=k;c[u>>2]=c[w>>2];c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[m>>2]|0))break;w=_((c[s>>2]|0)+(c[n>>2]|0)|0,c[q>>2]|0)|0;g[(c[l>>2]|0)+(c[s>>2]<<2)>>2]=+(b[(c[u>>2]|0)+(w+(c[o>>2]|0)<<1)>>1]|0);c[s>>2]=(c[s>>2]|0)+1}a:do if((c[p>>2]|0)<=-1){if((c[p>>2]|0)==-2){c[r>>2]=1;while(1){if((c[r>>2]|0)>=(c[q>>2]|0))break a;c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[m>>2]|0))break;e=_((c[s>>2]|0)+(c[n>>2]|0)|0,c[q>>2]|0)|0;w=(c[l>>2]|0)+(c[s>>2]<<2)|0;g[w>>2]=+g[w>>2]+ +(b[(c[u>>2]|0)+(e+(c[r>>2]|0)<<1)>>1]|0);c[s>>2]=(c[s>>2]|0)+1}c[r>>2]=(c[r>>2]|0)+1}}}else{c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[m>>2]|0))break a;e=_((c[s>>2]|0)+(c[n>>2]|0)|0,c[q>>2]|0)|0;w=(c[l>>2]|0)+(c[s>>2]<<2)|0;g[w>>2]=+g[w>>2]+ +(b[(c[u>>2]|0)+(e+(c[p>>2]|0)<<1)>>1]|0);c[s>>2]=(c[s>>2]|0)+1}}while(0);g[t>>2]=.000030517578125;if((c[q>>2]|0)==-2)g[t>>2]=+g[t>>2]/+(c[q>>2]|0);else g[t>>2]=+g[t>>2]/2.0;c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[m>>2]|0))break;w=(c[l>>2]|0)+(c[s>>2]<<2)|0;g[w>>2]=+g[w>>2]*+g[t>>2];c[s>>2]=(c[s>>2]|0)+1}i=v;return}function zi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;f=k+16|0;g=k+12|0;e=k+8|0;h=k+4|0;j=k;c[g>>2]=a;c[e>>2]=b;c[h>>2]=d;if((c[g>>2]|0)<((c[h>>2]|0)/400|0|0)){c[f>>2]=-1;j=c[f>>2]|0;i=k;return j|0}do if((c[e>>2]|0)==5e3)c[j>>2]=c[g>>2];else{if((c[e>>2]|0)==5010){c[j>>2]=(c[h>>2]|0)/50|0;break}if(!((c[e>>2]|0)>=5001&(c[e>>2]|0)<=5006)){c[f>>2]=-1;j=c[f>>2]|0;i=k;return j|0}d=c[h>>2]|0;if((((c[h>>2]|0)*3|0)/50|0|0)<(((c[h>>2]|0)/400|0)<<(c[e>>2]|0)-5001|0))d=(d*3|0)/50|0;else d=((d|0)/400|0)<<(c[e>>2]|0)-5001;c[j>>2]=d}while(0);if((c[j>>2]|0)>(c[g>>2]|0)){c[f>>2]=-1;j=c[f>>2]|0;i=k;return j|0}if(((((((c[j>>2]|0)*400|0)!=(c[h>>2]|0)?((c[j>>2]|0)*200|0)!=(c[h>>2]|0):0)?((c[j>>2]|0)*100|0)!=(c[h>>2]|0):0)?((c[j>>2]|0)*50|0)!=(c[h>>2]|0):0)?((c[j>>2]|0)*25|0)!=(c[h>>2]|0):0)?((c[j>>2]|0)*50|0)!=((c[h>>2]|0)*3|0):0){c[f>>2]=-1;j=c[f>>2]|0;i=k;return j|0}c[f>>2]=c[j>>2];j=c[f>>2]|0;i=k;return j|0}function Ai(a,b,d,e,f,g,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+48|0;l=w+40|0;m=w+36|0;n=w+32|0;o=w+28|0;p=w+24|0;q=w+20|0;r=w+16|0;s=w+12|0;t=w+8|0;u=w+4|0;v=w;c[m>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[t>>2]=j;c[u>>2]=k;if((c[o>>2]|0)==5010?(c[n>>2]|0)>=((c[q>>2]|0)/200|0|0):0){c[v>>2]=3;c[v>>2]=Bi(c[m>>2]|0,c[n>>2]|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0,0.0,c[u>>2]|0,c[s>>2]|0,c[t>>2]|0)|0;while(1){if((((c[q>>2]|0)/400|0)<>2]|0)<=(c[n>>2]|0))break;c[v>>2]=(c[v>>2]|0)+-1}c[n>>2]=((c[q>>2]|0)/400|0)<>2]}else c[n>>2]=zi(c[n>>2]|0,c[o>>2]|0,c[q>>2]|0)|0;if((c[n>>2]|0)<0){c[l>>2]=-1;d=c[l>>2]|0;i=w;return d|0}else{c[l>>2]=c[n>>2];d=c[l>>2]|0;i=w;return d|0}return 0}function Bi(a,b,d,e,f,h,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=+h;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;H=i;i=i+304|0;n=H+296|0;m=H+292|0;o=H+288|0;I=H+284|0;p=H+280|0;q=H+276|0;r=H+272|0;s=H+268|0;t=H+264|0;v=H+260|0;z=H+256|0;x=H+144|0;y=H+36|0;B=H+32|0;w=H+28|0;E=H+24|0;D=H+20|0;C=H+16|0;u=H+12|0;F=H+8|0;G=H+4|0;A=H;c[n>>2]=a;c[m>>2]=b;c[o>>2]=d;c[I>>2]=e;c[p>>2]=f;g[q>>2]=h;c[r>>2]=j;c[s>>2]=k;c[t>>2]=l;c[w>>2]=0;c[E>>2]=(c[I>>2]|0)/400|0;a=c[E>>2]|0;c[u>>2]=ia()|0;e=i;i=i+((1*(a<<2)|0)+15&-16)|0;g[x>>2]=+g[c[r>>2]>>2];g[y>>2]=1.0/(+g[c[r>>2]>>2]+1.0000000036274937e-15);if(c[s>>2]|0){c[C>>2]=(c[E>>2]<<1)-(c[s>>2]|0);c[m>>2]=(c[m>>2]|0)-(c[C>>2]|0);g[x+4>>2]=+g[(c[r>>2]|0)+4>>2];g[y+4>>2]=1.0/(+g[(c[r>>2]|0)+4>>2]+1.0000000036274937e-15);g[x+8>>2]=+g[(c[r>>2]|0)+8>>2];g[y+8>>2]=1.0/(+g[(c[r>>2]|0)+8>>2]+1.0000000036274937e-15);c[D>>2]=3}else{c[D>>2]=1;c[C>>2]=0}if(((c[m>>2]|0)/(c[E>>2]|0)|0|0)<24)d=(c[m>>2]|0)/(c[E>>2]|0)|0;else d=24;c[v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z=0,A=0.0;z=i;i=i+3136|0;j=z+3124|0;k=z+3120|0;l=z+3116|0;m=z+3112|0;n=z+3108|0;x=z+3104|0;p=z+1568|0;y=z+32|0;o=z+28|0;w=z+24|0;r=z+20|0;s=z+16|0;t=z+12|0;u=z+8|0;q=z+4|0;v=z;c[j>>2]=a;c[k>>2]=b;c[l>>2]=d;c[m>>2]=e;c[n>>2]=f;do if((c[n>>2]|0)>=80)if((c[n>>2]|0)>160){g[r>>2]=1.0;break}else{g[r>>2]=(+(c[n>>2]|0)-80.0)/80.0;break}else g[r>>2]=0.0;while(0);c[x>>2]=0;while(1){if((c[x>>2]|0)>=16)break;c[y+(c[x>>2]<<2)>>2]=-1;g[p+(c[x>>2]<<2)>>2]=1.0e10;c[x>>2]=(c[x>>2]|0)+1}c[x>>2]=0;while(1){if((c[x>>2]|0)>=4)break;A=+((c[m>>2]|0)+(_(c[n>>2]|0,1<>2])|0)|0);h=+g[r>>2];h=A*(h*+Di(c[j>>2]|0,c[k>>2]|0,c[x>>2]|0,(c[l>>2]|0)+1|0)+1.0);g[p+(1<>2]<<2)>>2]=h;c[y+(1<>2]<<2)>>2]=c[x>>2];c[x>>2]=(c[x>>2]|0)+1}c[x>>2]=1;while(1){if((c[x>>2]|0)>=(c[l>>2]|0))break;c[s>>2]=2;while(1){if((c[s>>2]|0)>=16)break;g[p+(c[x>>2]<<6)+(c[s>>2]<<2)>>2]=+g[p+((c[x>>2]|0)-1<<6)+((c[s>>2]|0)-1<<2)>>2];c[y+(c[x>>2]<<6)+(c[s>>2]<<2)>>2]=(c[s>>2]|0)-1;c[s>>2]=(c[s>>2]|0)+1}c[s>>2]=0;while(1){if((c[s>>2]|0)>=4)break;c[y+(c[x>>2]<<6)+(1<>2]<<2)>>2]=1;g[u>>2]=+g[p+((c[x>>2]|0)-1<<6)+4>>2];c[t>>2]=1;while(1){if((c[t>>2]|0)>=4)break;g[v>>2]=+g[p+((c[x>>2]|0)-1<<6)+((1<<(c[t>>2]|0)+1)-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0;m=r+12|0;o=r+8|0;p=r+4|0;q=r;c[k>>2]=a;c[l>>2]=b;c[h>>2]=d;c[j>>2]=e;g[o>>2]=0.0;g[p>>2]=0.0;if((c[j>>2]|0)<((1<>2])+1|0))h=c[j>>2]|0;else h=(1<>2])+1|0;c[m>>2]=h;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[m>>2]|0))break;g[o>>2]=+g[o>>2]+ +g[(c[k>>2]|0)+(c[n>>2]<<2)>>2];g[p>>2]=+g[p>>2]+ +g[(c[l>>2]|0)+(c[n>>2]<<2)>>2];c[n>>2]=(c[n>>2]|0)+1}g[q>>2]=+g[o>>2]*+g[p>>2]/+(_(c[m>>2]|0,c[m>>2]|0)|0);if(0.0>(+g[q>>2]-2.0)*.05000000074505806)f=0.0;else f=(+g[q>>2]-2.0)*.05000000074505806;if(1.0<+O(+f)){f=1.0;i=r;return +f}if(0.0>(+g[q>>2]-2.0)*.05000000074505806)f=0.0;else f=(+g[q>>2]-2.0)*.05000000074505806;f=+O(+f);i=r;return +f}function Ei(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0.0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;D=i;i=i+96|0;h=D+84|0;j=D+80|0;E=D+76|0;C=D+72|0;u=D+68|0;v=D+64|0;A=D+60|0;q=D+56|0;r=D+52|0;t=D+48|0;y=D+44|0;z=D+40|0;w=D+36|0;x=D+32|0;B=D+28|0;k=D+24|0;o=D+20|0;l=D+16|0;m=D+12|0;n=D+8|0;p=D+4|0;s=D;c[h>>2]=a;c[j>>2]=b;c[E>>2]=d;c[C>>2]=e;c[B>>2]=(c[E>>2]|0)/(c[j>>2]|0)|0;g[o>>2]=1.0-25.0/+((50>(c[B>>2]|0)?50:c[B>>2]|0)|0);g[t>>2]=0.0;g[r>>2]=0.0;g[q>>2]=0.0;c[k>>2]=0;while(1){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>>2]-+g[(c[C>>2]|0)+4>>2]);E=(c[C>>2]|0)+8|0;g[E>>2]=+g[E>>2]+ +g[o>>2]*(+g[t>>2]-+g[(c[C>>2]|0)+8>>2]);if(0.0>+g[c[C>>2]>>2])f=0.0;else f=+g[c[C>>2]>>2];g[c[C>>2]>>2]=f;if(0.0>+g[(c[C>>2]|0)+4>>2])f=0.0;else f=+g[(c[C>>2]|0)+4>>2];g[(c[C>>2]|0)+4>>2]=f;if(0.0>+g[(c[C>>2]|0)+8>>2])f=0.0;else f=+g[(c[C>>2]|0)+8>>2];g[(c[C>>2]|0)+8>>2]=f;h=c[C>>2]|0;if(+g[c[C>>2]>>2]>+g[(c[C>>2]|0)+8>>2])f=+g[h>>2];else f=+g[h+8>>2];if(f>7.999999797903001e-04){g[y>>2]=+O(+(+g[c[C>>2]>>2]));g[z>>2]=+O(+(+g[(c[C>>2]|0)+8>>2]));g[w>>2]=+O(+(+g[y>>2]));g[x>>2]=+O(+(+g[z>>2]));if(+g[(c[C>>2]|0)+4>>2]<+g[y>>2]*+g[z>>2])f=+g[(c[C>>2]|0)+4>>2];else f=+g[y>>2]*+g[z>>2];g[(c[C>>2]|0)+4>>2]=f;g[u>>2]=+g[(c[C>>2]|0)+4>>2]/(+g[y>>2]*+g[z>>2]+1.0000000036274937e-15);f=+N(+(+g[w>>2]-+g[x>>2]))*1.0;g[v>>2]=f/(+g[w>>2]+1.0000000036274937e-15+ +g[x>>2]);f=+O(+(1.0-+g[u>>2]*+g[u>>2]));g[A>>2]=f*+g[v>>2];h=(c[C>>2]|0)+12|0;g[h>>2]=+g[h>>2]+(+g[A>>2]-+g[(c[C>>2]|0)+12>>2])/+(c[B>>2]|0);h=c[C>>2]|0;if(+g[(c[C>>2]|0)+16>>2]-.019999999552965164/+(c[B>>2]|0)>+g[(c[C>>2]|0)+12>>2])f=+g[h+16>>2]-.019999999552965164/+(c[B>>2]|0);else f=+g[h+12>>2];g[(c[C>>2]|0)+16>>2]=f}else{g[A>>2]=0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if((c[(c[Pb>>2]|0)+96>>2]|0)==2051)c[y>>2]=0;else c[y>>2]=c[(c[Pb>>2]|0)+104>>2];if((c[ba>>2]|0)<(c[(c[Pb>>2]|0)+156>>2]|0))q=c[ba>>2]|0;else q=c[(c[Pb>>2]|0)+156>>2]|0;c[ba>>2]=q;e=c[gb>>2]|0;c[w>>2]=$a+((($a-$a|0)/4|0)<<2);lb(e,10015,w)|0;c[fb>>2]=0;if((c[(c[Pb>>2]|0)+8+36>>2]|0)>=7?(c[(c[Pb>>2]|0)+132>>2]|0)==48e3:0){c[S>>2]=c[(c[Pb>>2]|0)+172+8508>>2];c[T>>2]=c[(c[Pb>>2]|0)+172+8512>>2];aj((c[Pb>>2]|0)+172|0,c[$a>>2]|0,c[u>>2]|0,c[v>>2]|0,c[Gb>>2]|0,c[ca>>2]|0,c[Y>>2]|0,c[Z>>2]|0,c[(c[Pb>>2]|0)+132>>2]|0,c[ba>>2]|0,c[$>>2]|0,fb)}c[(c[Pb>>2]|0)+128>>2]=-1;c[(c[Pb>>2]|0)+18212>>2]=0;do if(c[fb>>2]|0){if((c[(c[Pb>>2]|0)+112>>2]|0)==-1e3){w=~~+M(+((1.0-+g[fb+20>>2])*100.0+.5));c[(c[Pb>>2]|0)+128>>2]=w}c[x>>2]=c[fb+24>>2];if((c[x>>2]|0)<=12){c[(c[Pb>>2]|0)+18212>>2]=1101;break}if((c[x>>2]|0)<=14){c[(c[Pb>>2]|0)+18212>>2]=1102;break}if((c[x>>2]|0)<=16){c[(c[Pb>>2]|0)+18212>>2]=1103;break}q=(c[Pb>>2]|0)+18212|0;if((c[x>>2]|0)<=18){c[q>>2]=1104;break}else{c[q>>2]=1105;break}}while(0);if((c[(c[Pb>>2]|0)+100>>2]|0)==2?(c[(c[Pb>>2]|0)+108>>2]|0)!=1:0)g[F>>2]=+Ei(c[sa>>2]|0,c[Gb>>2]|0,c[(c[Pb>>2]|0)+132>>2]|0,(c[Pb>>2]|0)+14352|0);else g[F>>2]=0.0;c[_a>>2]=c[y>>2];y=Gi(c[Pb>>2]|0,c[Gb>>2]|0,c[Ib>>2]|0)|0;c[(c[Pb>>2]|0)+148>>2]=y;c[Da>>2]=(c[(c[Pb>>2]|0)+132>>2]|0)/(c[Gb>>2]|0)|0;do if((c[Ib>>2]|0)>=3?(c[(c[Pb>>2]|0)+148>>2]|0)>=((c[Da>>2]|0)*3<<3|0):0){if((c[Da>>2]|0)<50){if((_(c[Ib>>2]|0,c[Da>>2]|0)|0)<300)break;if((c[(c[Pb>>2]|0)+148>>2]|0)<2400)break}if(!(c[(c[Pb>>2]|0)+136>>2]|0)){if((((c[(c[Pb>>2]|0)+148>>2]|0)+(c[Da>>2]<<2)|0)/(c[Da>>2]<<3|0)|0|0)<(c[Ib>>2]|0))q=((c[(c[Pb>>2]|0)+148>>2]|0)+(c[Da>>2]<<2)|0)/(c[Da>>2]<<3|0)|0;else q=c[Ib>>2]|0;c[A>>2]=q;B=_(c[A>>2]|0,c[Da>>2]<<3)|0;c[(c[Pb>>2]|0)+148>>2]=B;c[Ib>>2]=c[A>>2]}c[Ba>>2]=(_(c[Da>>2]|0,c[Ib>>2]|0)|0)<<3;c[Za>>2]=(c[(c[Pb>>2]|0)+148>>2]|0)-(_(((c[(c[Pb>>2]|0)+100>>2]|0)*40|0)+20|0,((c[(c[Pb>>2]|0)+132>>2]|0)/(c[Gb>>2]|0)|0)-50|0)|0);do if((c[(c[Pb>>2]|0)+112>>2]|0)!=3001){if((c[(c[Pb>>2]|0)+112>>2]|0)==3002){c[K>>2]=0;break}q=c[Pb>>2]|0;if((c[(c[Pb>>2]|0)+128>>2]|0)>=0){c[K>>2]=(c[q+128>>2]|0)*327>>8;if((c[(c[Pb>>2]|0)+96>>2]|0)!=2049)break;c[K>>2]=(c[K>>2]|0)<115?c[K>>2]|0:115;break}if((c[q+96>>2]|0)==2048){c[K>>2]=115;break}else{c[K>>2]=48;break}}else c[K>>2]=127;while(0);if((c[(c[Pb>>2]|0)+108>>2]|0)!=-1e3?(c[(c[Pb>>2]|0)+100>>2]|0)==2:0)c[(c[Pb>>2]|0)+14288>>2]=c[(c[Pb>>2]|0)+108>>2];else Eb=73;do if((Eb|0)==73){if((c[(c[Pb>>2]|0)+100>>2]|0)!=2){c[(c[Pb>>2]|0)+14288>>2]=c[(c[Pb>>2]|0)+100>>2];break}c[C>>2]=3e4;q=c[C>>2]|0;if((c[(c[Pb>>2]|0)+14288>>2]|0)==2)c[C>>2]=q-1e3;else c[C>>2]=q+1e3;c[(c[Pb>>2]|0)+14288>>2]=(c[Za>>2]|0)>(c[C>>2]|0)?2:1}while(0);c[Za>>2]=(c[(c[Pb>>2]|0)+148>>2]|0)-(_(((c[(c[Pb>>2]|0)+14288>>2]|0)*40|0)+20|0,((c[(c[Pb>>2]|0)+132>>2]|0)/(c[Gb>>2]|0)|0)-50|0)|0);q=c[Pb>>2]|0;do if((c[(c[Pb>>2]|0)+96>>2]|0)==2051)c[q+14320>>2]=1002;else{if((c[q+124>>2]|0)!=-1e3){c[(c[Pb>>2]|0)+14320>>2]=c[(c[Pb>>2]|0)+124>>2];break}c[E>>2]=~~((1.0-+g[F>>2])*+(c[4508]|0)+ +g[F>>2]*+(c[4510]|0));c[D>>2]=~~((1.0-+g[F>>2])*+(c[4511]|0)+ +g[F>>2]*+(c[4511]|0));F=_(c[K>>2]|0,c[K>>2]|0)|0;c[G>>2]=(c[D>>2]|0)+((_(F,(c[E>>2]|0)-(c[D>>2]|0)|0)|0)>>14);if((c[(c[Pb>>2]|0)+96>>2]|0)==2048)c[G>>2]=(c[G>>2]|0)+8e3;do if((c[(c[Pb>>2]|0)+14324>>2]|0)==1002)c[G>>2]=(c[G>>2]|0)-4e3;else{if((c[(c[Pb>>2]|0)+14324>>2]|0)<=0)break;c[G>>2]=(c[G>>2]|0)+4e3}while(0);c[(c[Pb>>2]|0)+14320>>2]=(c[Za>>2]|0)>=(c[G>>2]|0)?1002:1e3;do if(c[(c[Pb>>2]|0)+8+40>>2]|0){if((c[(c[Pb>>2]|0)+8+32>>2]|0)<=(128-(c[K>>2]|0)>>4|0))break;c[(c[Pb>>2]|0)+14320>>2]=1e3}while(0);if(!((c[K>>2]|0)>100?(c[(c[Pb>>2]|0)+8+44>>2]|0)!=0:0))break;c[(c[Pb>>2]|0)+14320>>2]=1e3}while(0);if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002?(c[Gb>>2]|0)<((c[(c[Pb>>2]|0)+132>>2]|0)/100|0|0):0)c[(c[Pb>>2]|0)+14320>>2]=1002;if(c[(c[Pb>>2]|0)+164>>2]|0)c[(c[Pb>>2]|0)+14320>>2]=1002;G=_((c[Da>>2]|0)>50?12e3:8e3,c[Gb>>2]|0)|0;if((c[Ib>>2]|0)<((G|0)/(c[(c[Pb>>2]|0)+132>>2]<<3|0)|0|0))c[(c[Pb>>2]|0)+14320>>2]=1002;do if((c[(c[Pb>>2]|0)+14288>>2]|0)==1){if((c[(c[Pb>>2]|0)+14328>>2]|0)!=2){Eb=107;break}if(c[(c[Pb>>2]|0)+8+56>>2]|0){Eb=107;break}if((c[(c[Pb>>2]|0)+14320>>2]|0)==1002){Eb=107;break}if((c[(c[Pb>>2]|0)+14324>>2]|0)==1002){Eb=107;break}c[(c[Pb>>2]|0)+8+56>>2]=1;c[(c[Pb>>2]|0)+14288>>2]=2}else Eb=107;while(0);if((Eb|0)==107)c[(c[Pb>>2]|0)+8+56>>2]=0;do if((c[(c[Pb>>2]|0)+14324>>2]|0)>0){if(!((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002?(c[(c[Pb>>2]|0)+14324>>2]|0)==1002:0)){if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002)break;if((c[(c[Pb>>2]|0)+14324>>2]|0)==1002)break}c[Jb>>2]=1;c[hb>>2]=(c[(c[Pb>>2]|0)+14320>>2]|0)!=1002&1;if(c[hb>>2]|0)break;if((c[Gb>>2]|0)>=((c[(c[Pb>>2]|0)+132>>2]|0)/100|0|0)){c[(c[Pb>>2]|0)+14320>>2]=c[(c[Pb>>2]|0)+14324>>2];c[Lb>>2]=1;break}else{c[Jb>>2]=0;break}}while(0);if(c[(c[Pb>>2]|0)+14340>>2]|0){c[Jb>>2]=1;c[hb>>2]=1;c[(c[Pb>>2]|0)+14340>>2]=0;c[Ea>>2]=1}do if(c[Jb>>2]|0){G=_(c[Ib>>2]|0,(c[(c[Pb>>2]|0)+132>>2]|0)/200|0)|0;if(257<((G|0)/((c[Gb>>2]|0)+((c[(c[Pb>>2]|0)+132>>2]|0)/200|0)|0)|0|0))q=257;else{q=_(c[Ib>>2]|0,(c[(c[Pb>>2]|0)+132>>2]|0)/200|0)|0;q=(q|0)/((c[Gb>>2]|0)+((c[(c[Pb>>2]|0)+132>>2]|0)/200|0)|0)|0}c[Kb>>2]=q;if(!(c[(c[Pb>>2]|0)+136>>2]|0))break;if((c[Kb>>2]|0)<((c[(c[Pb>>2]|0)+148>>2]|0)/1600|0|0))q=c[Kb>>2]|0;else q=(c[(c[Pb>>2]|0)+148>>2]|0)/1600|0;c[Kb>>2]=q}while(0);do if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){if((c[(c[Pb>>2]|0)+14324>>2]|0)!=1002)break;Td(c[Ga>>2]|0,c[(c[Pb>>2]|0)+168>>2]|0,H)|0;c[Ea>>2]=1}while(0);do if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){if(c[(c[Pb>>2]|0)+14344>>2]|0){Eb=133;break}if(c[(c[Pb>>2]|0)+8+72>>2]|0)Eb=133}else Eb=133;while(0);do if((Eb|0)==133){c[L>>2]=1105;c[O>>2]=c[Za>>2];do if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){c[O>>2]=(_(c[O>>2]|0,45+(c[(c[Pb>>2]|0)+8+36>>2]|0)|0)|0)/50|0;if(c[(c[Pb>>2]|0)+136>>2]|0)break;c[O>>2]=(c[O>>2]|0)-1e3}while(0);do if((c[(c[Pb>>2]|0)+100>>2]|0)==2){if((c[(c[Pb>>2]|0)+108>>2]|0)==1){Eb=139;break}c[J>>2]=18048;c[I>>2]=18080}else Eb=139;while(0);if((Eb|0)==139){c[J>>2]=18112;c[I>>2]=18144}c[Xa>>2]=0;while(1){if((c[Xa>>2]|0)>=8)break;H=_(c[K>>2]|0,c[K>>2]|0)|0;H=(c[(c[I>>2]|0)+(c[Xa>>2]<<2)>>2]|0)+((_(H,(c[(c[J>>2]|0)+(c[Xa>>2]<<2)>>2]|0)-(c[(c[I>>2]|0)+(c[Xa>>2]<<2)>>2]|0)|0)|0)>>14)|0;c[N+(c[Xa>>2]<<2)>>2]=H;c[Xa>>2]=(c[Xa>>2]|0)+1}do{c[Q>>2]=c[N+((c[L>>2]|0)-1102<<1<<2)>>2];c[P>>2]=c[N+(((c[L>>2]|0)-1102<<1)+1<<2)>>2];do if(!(c[(c[Pb>>2]|0)+14344>>2]|0)){q=c[P>>2]|0;m=c[Q>>2]|0;if((c[(c[Pb>>2]|0)+14336>>2]|0)>=(c[L>>2]|0)){c[Q>>2]=m-q;break}else{c[Q>>2]=m+q;break}}while(0);if((c[O>>2]|0)>=(c[Q>>2]|0))break;K=(c[L>>2]|0)+-1|0;c[L>>2]=K}while((K|0)>1101);c[(c[Pb>>2]|0)+14336>>2]=c[L>>2];if(c[(c[Pb>>2]|0)+14344>>2]|0)break;if((c[(c[Pb>>2]|0)+14320>>2]|0)==1002)break;if(c[(c[Pb>>2]|0)+8+76>>2]|0)break;if((c[(c[Pb>>2]|0)+14336>>2]|0)<=1103)break;c[(c[Pb>>2]|0)+14336>>2]=1103}while(0);if((c[(c[Pb>>2]|0)+14336>>2]|0)>(c[(c[Pb>>2]|0)+120>>2]|0))c[(c[Pb>>2]|0)+14336>>2]=c[(c[Pb>>2]|0)+120>>2];if((c[(c[Pb>>2]|0)+116>>2]|0)!=-1e3)c[(c[Pb>>2]|0)+14336>>2]=c[(c[Pb>>2]|0)+116>>2];if((c[Ba>>2]|0)<15e3?(c[(c[Pb>>2]|0)+14320>>2]|0)!=1002:0){if((c[(c[Pb>>2]|0)+14336>>2]|0)<1103)q=c[(c[Pb>>2]|0)+14336>>2]|0;else q=1103;c[(c[Pb>>2]|0)+14336>>2]=q}do if((c[(c[Pb>>2]|0)+132>>2]|0)<=24e3){if((c[(c[Pb>>2]|0)+14336>>2]|0)<=1104)break;c[(c[Pb>>2]|0)+14336>>2]=1104}while(0);do if((c[(c[Pb>>2]|0)+132>>2]|0)<=16e3){if((c[(c[Pb>>2]|0)+14336>>2]|0)<=1103)break;c[(c[Pb>>2]|0)+14336>>2]=1103}while(0);do if((c[(c[Pb>>2]|0)+132>>2]|0)<=12e3){if((c[(c[Pb>>2]|0)+14336>>2]|0)<=1102)break;c[(c[Pb>>2]|0)+14336>>2]=1102}while(0);do if((c[(c[Pb>>2]|0)+132>>2]|0)<=8e3){if((c[(c[Pb>>2]|0)+14336>>2]|0)<=1101)break;c[(c[Pb>>2]|0)+14336>>2]=1101}while(0);do if(c[(c[Pb>>2]|0)+18212>>2]|0){if((c[(c[Pb>>2]|0)+116>>2]|0)!=-1e3)break;do if((c[Za>>2]|0)<=((c[(c[Pb>>2]|0)+14288>>2]|0)*18e3|0)){if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){Eb=179;break}c[R>>2]=1101}else Eb=179;while(0);a:do if((Eb|0)==179){do if((c[Za>>2]|0)<=((c[(c[Pb>>2]|0)+14288>>2]|0)*24e3|0)){if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002)break;c[R>>2]=1102;break a}while(0);if((c[Za>>2]|0)<=((c[(c[Pb>>2]|0)+14288>>2]|0)*3e4|0)){c[R>>2]=1103;break}if((c[Za>>2]|0)<=((c[(c[Pb>>2]|0)+14288>>2]|0)*44e3|0)){c[R>>2]=1104;break}else{c[R>>2]=1105;break}}while(0);if((c[(c[Pb>>2]|0)+18212>>2]|0)>(c[R>>2]|0))q=c[(c[Pb>>2]|0)+18212>>2]|0;else q=c[R>>2]|0;c[(c[Pb>>2]|0)+18212>>2]=q;q=c[Pb>>2]|0;if((c[(c[Pb>>2]|0)+14336>>2]|0)<(c[(c[Pb>>2]|0)+18212>>2]|0))q=c[q+14336>>2]|0;else q=c[q+18212>>2]|0;c[(c[Pb>>2]|0)+14336>>2]=q}while(0);R=c[gb>>2]|0;c[U>>2]=c[ba>>2];lb(R,4036,U)|0;do if((c[(c[Pb>>2]|0)+14320>>2]|0)==1002){if((c[(c[Pb>>2]|0)+14336>>2]|0)!=1102)break;c[(c[Pb>>2]|0)+14336>>2]=1103}while(0);if(c[(c[Pb>>2]|0)+164>>2]|0)c[(c[Pb>>2]|0)+14336>>2]=1101;do if((c[Gb>>2]|0)>((c[(c[Pb>>2]|0)+132>>2]|0)/50|0|0)){if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002?(c[(c[Pb>>2]|0)+14336>>2]|0)<=1103:0)break;if((c[S>>2]|0)!=-1){c[(c[Pb>>2]|0)+172+8508>>2]=c[S>>2];c[(c[Pb>>2]|0)+172+8512>>2]=c[T>>2]}c[oa>>2]=(c[Gb>>2]|0)>((c[(c[Pb>>2]|0)+132>>2]|0)/25|0|0)?3:2;if(1276<(((c[aa>>2]|0)-3|0)/(c[oa>>2]|0)|0|0))q=1276;else q=((c[aa>>2]|0)-3|0)/(c[oa>>2]|0)|0;c[da>>2]=q;q=_(c[oa>>2]|0,c[da>>2]|0)|0;c[fa>>2]=ia()|0;m=i;i=i+((1*q|0)+15&-16)|0;Ti(qa)|0;c[ka>>2]=c[(c[Pb>>2]|0)+124>>2];c[ha>>2]=c[(c[Pb>>2]|0)+116>>2];c[ja>>2]=c[(c[Pb>>2]|0)+108>>2];c[(c[Pb>>2]|0)+124>>2]=c[(c[Pb>>2]|0)+14320>>2];c[(c[Pb>>2]|0)+116>>2]=c[(c[Pb>>2]|0)+14336>>2];c[(c[Pb>>2]|0)+108>>2]=c[(c[Pb>>2]|0)+14288>>2];c[la>>2]=c[(c[Pb>>2]|0)+8+56>>2];q=c[Pb>>2]|0;if(c[la>>2]|0)c[q+108>>2]=1;else c[(c[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=1.0;if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){ta=_(c[(c[Pb>>2]|0)+100>>2]|0,c[Gb>>2]|0)|0;c[Ia>>2]=ia()|0;m=i;i=i+((1*(ta<<1)|0)+15&-16)|0;c[ra>>2]=_(c[Va>>2]<<3,c[Da>>2]|0)|0;do if((c[(c[Pb>>2]|0)+14320>>2]|0)==1001){q=_(c[(c[Pb>>2]|0)+14288>>2]|0,5e3+(((c[(c[Pb>>2]|0)+132>>2]|0)==((c[Gb>>2]|0)*100|0)&1)*1e3|0)|0)|0;c[(c[Pb>>2]|0)+8+28>>2]=q;q=(c[ra>>2]|0)-(c[(c[Pb>>2]|0)+8+28>>2]|0)|0;if((c[ib>>2]|0)==1104){ta=(c[Pb>>2]|0)+8+28|0;c[ta>>2]=(c[ta>>2]|0)+((q<<1|0)/3|0)}else{ta=(c[Pb>>2]|0)+8+28|0;c[ta>>2]=(c[ta>>2]|0)+((q*3|0)/5|0)}if((c[(c[Pb>>2]|0)+8+28>>2]|0)>((c[ra>>2]<<2|0)/5|0|0))c[(c[Pb>>2]|0)+8+28>>2]=(c[ra>>2]<<2|0)/5|0;if(c[(c[Pb>>2]|0)+14348>>2]|0)break;c[ma>>2]=(c[ra>>2]|0)-(c[(c[Pb>>2]|0)+8+28>>2]|0);c[ga>>2]=(c[ib>>2]|0)==1104?3e3:3600;g[Ya>>2]=+(c[ma>>2]|0)/(+(c[ma>>2]|0)+ +(_(c[(c[Pb>>2]|0)+14288>>2]|0,c[ga>>2]|0)|0));g[Ya>>2]=+g[Ya>>2]<.8571428656578064?+g[Ya>>2]+.1428571492433548:1.0}else c[(c[Pb>>2]|0)+8+28>>2]=c[ra>>2];while(0);do if(c[(c[Pb>>2]|0)+14348>>2]|0){if(!(c[(c[Pb>>2]|0)+136>>2]|0))break;if(c[(c[Pb>>2]|0)+164>>2]|0)break;g[xa>>2]=0.0;c[va>>2]=17;b[za>>1]=16e3;do if((c[(c[Pb>>2]|0)+14336>>2]|0)==1101){c[va>>2]=13;b[za>>1]=8e3}else{if((c[(c[Pb>>2]|0)+14336>>2]|0)!=1102)break;c[va>>2]=15;b[za>>1]=12e3}while(0);c[ua>>2]=0;while(1){if((c[ua>>2]|0)>=(c[(c[Pb>>2]|0)+100>>2]|0))break;c[Xa>>2]=0;while(1){q=c[ua>>2]|0;if((c[Xa>>2]|0)>=(c[va>>2]|0))break;if(+g[(c[(c[Pb>>2]|0)+14348>>2]|0)+((q*21|0)+(c[Xa>>2]|0)<<2)>>2]<.5)t=+g[(c[(c[Pb>>2]|0)+14348>>2]|0)+(((c[ua>>2]|0)*21|0)+(c[Xa>>2]|0)<<2)>>2];else t=.5;do if(t>-2.0){if(!(+g[(c[(c[Pb>>2]|0)+14348>>2]|0)+(((c[ua>>2]|0)*21|0)+(c[Xa>>2]|0)<<2)>>2]<.5)){t=.5;break}t=+g[(c[(c[Pb>>2]|0)+14348>>2]|0)+(((c[ua>>2]|0)*21|0)+(c[Xa>>2]|0)<<2)>>2]}else t=-2.0;while(0);g[wa>>2]=t;if(+g[wa>>2]>0.0)g[wa>>2]=+g[wa>>2]*.5;g[xa>>2]=+g[xa>>2]+ +g[wa>>2];c[Xa>>2]=(c[Xa>>2]|0)+1}c[ua>>2]=q+1}g[ya>>2]=+g[xa>>2]/+(c[va>>2]|0)*+(c[(c[Pb>>2]|0)+100>>2]|0);g[ya>>2]=+g[ya>>2]+.20000000298023224;c[Aa>>2]=~~(+(b[za>>1]|0)*+g[ya>>2]);if((c[Aa>>2]|0)>((_(-2,c[(c[Pb>>2]|0)+8+28>>2]|0)|0)/3|0|0))q=c[Aa>>2]|0;else q=(_(-2,c[(c[Pb>>2]|0)+8+28>>2]|0)|0)/3|0;c[Aa>>2]=q;do if((c[(c[Pb>>2]|0)+14336>>2]|0)==1104)Eb=281;else{if((c[(c[Pb>>2]|0)+14336>>2]|0)==1105){Eb=281;break}za=(c[Pb>>2]|0)+8+28|0;c[za>>2]=(c[za>>2]|0)+(c[Aa>>2]|0)}while(0);if((Eb|0)==281){za=(c[Pb>>2]|0)+8+28|0;c[za>>2]=(c[za>>2]|0)+(((c[Aa>>2]|0)*3|0)/5|0)}Aa=_(c[Aa>>2]|0,c[Gb>>2]|0)|0;c[Va>>2]=(c[Va>>2]|0)+((Aa|0)/(c[(c[Pb>>2]|0)+132>>2]<<3|0)|0)}while(0);c[(c[Pb>>2]|0)+8+24>>2]=((c[Gb>>2]|0)*1e3|0)/(c[(c[Pb>>2]|0)+132>>2]|0)|0;c[(c[Pb>>2]|0)+8>>2]=c[(c[Pb>>2]|0)+100>>2];c[(c[Pb>>2]|0)+8+4>>2]=c[(c[Pb>>2]|0)+14288>>2];do if((c[ib>>2]|0)!=1101){q=(c[Pb>>2]|0)+8+20|0;if((c[ib>>2]|0)==1102){c[q>>2]=12e3;break}else{c[q>>2]=16e3;break}}else c[(c[Pb>>2]|0)+8+20>>2]=8e3;while(0);q=(c[Pb>>2]|0)+8+16|0;if((c[(c[Pb>>2]|0)+14320>>2]|0)==1001)c[q>>2]=16e3;else c[q>>2]=8e3;do if((c[(c[Pb>>2]|0)+14320>>2]|0)==1e3){c[Ca>>2]=c[Ba>>2];c[(c[Pb>>2]|0)+8+12>>2]=16e3;if((c[Da>>2]|0)>50)c[Ca>>2]=(c[Ca>>2]<<1|0)/3|0;if((c[Ca>>2]|0)<13e3){c[(c[Pb>>2]|0)+8+12>>2]=12e3;if(12e3<(c[(c[Pb>>2]|0)+8+20>>2]|0))q=12e3;else q=c[(c[Pb>>2]|0)+8+20>>2]|0;c[(c[Pb>>2]|0)+8+20>>2]=q}if((c[Ca>>2]|0)>=9600)break;c[(c[Pb>>2]|0)+8+12>>2]=8e3;if(8e3<(c[(c[Pb>>2]|0)+8+20>>2]|0))q=8e3;else q=c[(c[Pb>>2]|0)+8+20>>2]|0;c[(c[Pb>>2]|0)+8+20>>2]=q}else c[(c[Pb>>2]|0)+8+12>>2]=16e3;while(0);c[(c[Pb>>2]|0)+8+48>>2]=((c[(c[Pb>>2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]=21;switch(c[ib>>2]|0){case 1101:{c[La>>2]=13;break}case 1103:case 1102:{c[La>>2]=17;break}case 1104:{c[La>>2]=19;break}case 1105:{c[La>>2]=21;break}default:{}}Xa=c[gb>>2]|0;c[Na>>2]=c[La>>2];lb(Xa,10012,Na)|0;Xa=c[gb>>2]|0;c[Oa>>2]=c[(c[Pb>>2]|0)+14288>>2];lb(Xa,10008,Oa)|0;Xa=c[gb>>2]|0;c[Pa>>2]=-1;lb(Xa,4002,Pa)|0;do if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1e3){g[Ka>>2]=2.0;Xa=c[gb>>2]|0;c[Qa>>2]=0;lb(Xa,4006,Qa)|0;if(c[(c[Pb>>2]|0)+8+64>>2]|0)g[Ka>>2]=0.0;Xa=c[gb>>2]|0;c[Ra>>2]=~~+g[Ka>>2];lb(Xa,10002,Ra)|0;if((c[(c[Pb>>2]|0)+14320>>2]|0)==1001){c[Wa>>2]=(Oi(Hb)|0)+7>>3;if(c[Jb>>2]|0)c[Wa>>2]=(c[Wa>>2]|0)+((c[(c[Pb>>2]|0)+14320>>2]|0)==1001?3:1);q=c[Wa>>2]|0;m=c[Va>>2]|0;if(c[(c[Pb>>2]|0)+136>>2]|0){Xa=_(c[(c[Pb>>2]|0)+8+28>>2]|0,c[Gb>>2]|0)|0;c[pb>>2]=q+m-((Xa|0)/(c[(c[Pb>>2]|0)+132>>2]<<3|0)|0);break}else{c[pb>>2]=(q|0)>(m|0)?c[Wa>>2]|0:c[Va>>2]|0;break}}if(!(c[(c[Pb>>2]|0)+136>>2]|0)){c[pb>>2]=c[Va>>2];break}c[Ja>>2]=0;do if((c[(c[Pb>>2]|0)+144>>2]|0)==5010){if((c[Gb>>2]|0)==((c[(c[Pb>>2]|0)+132>>2]|0)/50|0|0))break;c[Ja>>2]=_(((c[(c[Pb>>2]|0)+14288>>2]|0)*60|0)+40|0,((c[(c[Pb>>2]|0)+132>>2]|0)/(c[Gb>>2]|0)|0)-50|0)|0;if(!(c[fb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+8+80>>2]|0);g[ab>>2]=+g[ab>>2]*.00006103515625;g[bb>>2]=+g[bb>>2]*.00006103515625;Pi(n,n,+g[ab>>2],+g[bb>>2],c[(c[$a>>2]|0)+4>>2]|0,c[Gb>>2]|0,c[(c[Pb>>2]|0)+100>>2]|0,c[(c[$a>>2]|0)+60>>2]|0,c[(c[Pb>>2]|0)+132>>2]|0);b[(c[Pb>>2]|0)+14292>>1]=c[(c[Pb>>2]|0)+8+80>>2]}while(0);do if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002){bb=(Oi(Hb)|0)+17|0;if((bb+(((c[(c[Pb>>2]|0)+14320>>2]|0)==1001&1)*20|0)|0)>((c[Ib>>2]|0)-1<<3|0)){Eb=393;break}do if((c[(c[Pb>>2]|0)+14320>>2]|0)==1001){if((c[Jb>>2]|0)==0?(bb=(Oi(Hb)|0)+37|0,(bb|0)>(c[pb>>2]<<3|0)):0)break;pc(Hb,c[Jb>>2]|0,12)}while(0);if(!(c[Jb>>2]|0))break;pc(Hb,c[hb>>2]|0,1);q=(c[Ib>>2]|0)-1|0;if((c[(c[Pb>>2]|0)+14320>>2]|0)==1001)c[cb>>2]=q-(c[pb>>2]|0);else c[cb>>2]=q-((Oi(Hb)|0)+7>>3);if((c[cb>>2]|0)<((c[(c[Pb>>2]|0)+148>>2]|0)/1600|0|0))q=c[cb>>2]|0;else q=(c[(c[Pb>>2]|0)+148>>2]|0)/1600|0;c[Kb>>2]=q;if(257<((2>(c[Kb>>2]|0)?2:c[Kb>>2]|0)|0))q=257;else q=2>(c[Kb>>2]|0)?2:c[Kb>>2]|0;c[Kb>>2]=q;if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1001)break;rc(Hb,(c[Kb>>2]|0)-2|0,256)}else Eb=393;while(0);if((Eb|0)==393)c[Jb>>2]=0;if(!(c[Jb>>2]|0)){c[(c[Pb>>2]|0)+14340>>2]=0;c[Kb>>2]=0}if((c[(c[Pb>>2]|0)+14320>>2]|0)!=1002)c[rb>>2]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14328>>2]=c[(c[Pb>>2]|0)+14288>>2];c[(c[Pb>>2]|0)+14332>>2]=c[Gb>>2];c[(c[Pb>>2]|0)+14344>>2]=0;Lb=Oi(Hb)|0;c:do if((Lb|0)>((c[Ib>>2]|0)-1<<3|0))if((c[Ib>>2]|0)<2){c[Ob>>2]=-2;c[Mb>>2]=1;break b}else{a[(c[Qb>>2]|0)+1>>0]=0;c[Nb>>2]=1;c[(c[Pb>>2]|0)+18216>>2]=0;break}else{if(!(((c[Jb>>2]|0?1:(c[(c[Pb>>2]|0)+14320>>2]|0)!=1e3)^1)&(c[Nb>>2]|0)>2))break;do{if(d[(c[Qb>>2]|0)+(c[Nb>>2]|0)>>0]|0)break c;c[Nb>>2]=(c[Nb>>2]|0)+-1}while((c[Nb>>2]|0)>2)}while(0);c[Nb>>2]=(c[Nb>>2]|0)+(1+(c[Kb>>2]|0));do if(!(c[(c[Pb>>2]|0)+136>>2]|0))if(Xi(c[Qb>>2]|0,c[Nb>>2]|0,c[Ib>>2]|0)|0){c[Ob>>2]=-3;c[Mb>>2]=1;break b}else{c[Nb>>2]=c[Ib>>2];break}while(0);c[Ob>>2]=c[Nb>>2];c[Mb>>2]=1}while(0);na(c[Fb>>2]|0);Qb=c[Ob>>2]|0;i=Rb;return Qb|0}while(0);c[B>>2]=c[(c[Pb>>2]|0)+14320>>2];if(!(c[(c[Pb>>2]|0)+14336>>2]|0))q=1101;else q=c[(c[Pb>>2]|0)+14336>>2]|0;c[z>>2]=q;if(!(c[B>>2]|0))c[B>>2]=1e3;if((c[Da>>2]|0)>100)c[B>>2]=1002;if((c[Da>>2]|0)<50)c[B>>2]=1e3;do if(!((c[B>>2]|0)==1e3&(c[z>>2]|0)>1103)){if((c[B>>2]|0)==1002&(c[z>>2]|0)==1102){c[z>>2]=1101;break}if((c[z>>2]|0)<=1104)c[z>>2]=1104}else c[z>>2]=1103;while(0);Pb=Hi(c[B>>2]|0,c[Da>>2]|0,c[z>>2]|0,c[(c[Pb>>2]|0)+14288>>2]|0)|0;a[c[Qb>>2]>>0]=Pb;c[Ob>>2]=1;Qb=c[Ob>>2]|0;i=Rb;return Qb|0}c[Ob>>2]=-1;Qb=c[Ob>>2]|0;i=Rb;return Qb|0}function Gi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;e=j+12|0;f=j+8|0;g=j+4|0;h=j;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(c[g>>2]|0))c[g>>2]=(c[(c[f>>2]|0)+132>>2]|0)/400|0;b=c[f>>2]|0;if((c[(c[f>>2]|0)+152>>2]|0)==-1e3){c[e>>2]=(((c[b+132>>2]|0)*60|0)/(c[g>>2]|0)|0)+(_(c[(c[f>>2]|0)+132>>2]|0,c[(c[f>>2]|0)+100>>2]|0)|0);h=c[e>>2]|0;i=j;return h|0}if((c[b+152>>2]|0)==-1){h=_(c[h>>2]<<3,c[(c[f>>2]|0)+132>>2]|0)|0;c[e>>2]=(h|0)/(c[g>>2]|0)|0;h=c[e>>2]|0;i=j;return h|0}else{c[e>>2]=c[(c[f>>2]|0)+152>>2];h=c[e>>2]|0;i=j;return h|0}return 0}function Hi(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;h=p+20|0;j=p+16|0;k=p+12|0;l=p+8|0;m=p+4|0;o=p+24|0;n=p;c[h>>2]=b;c[j>>2]=e;c[k>>2]=f;c[l>>2]=g;c[m>>2]=0;while(1){if((c[j>>2]|0)>=400)break;c[j>>2]=c[j>>2]<<1;c[m>>2]=(c[m>>2]|0)+1}do if((c[h>>2]|0)!=1e3)if((c[h>>2]|0)==1002){b=(c[k>>2]|0)-1102|0;c[n>>2]=b;c[n>>2]=(c[n>>2]|0)<0?0:b;a[o>>0]=-128;a[o>>0]=d[o>>0]|0|c[n>>2]<<5;a[o>>0]=d[o>>0]|0|c[m>>2]<<3;break}else{a[o>>0]=96;a[o>>0]=d[o>>0]|0|(c[k>>2]|0)-1104<<4;a[o>>0]=d[o>>0]|0|(c[m>>2]|0)-2<<3;break}else{a[o>>0]=(c[k>>2]|0)-1101<<5;a[o>>0]=d[o>>0]|0|(c[m>>2]|0)-2<<3}while(0);a[o>>0]=d[o>>0]|0|((c[l>>2]|0)==2&1)<<2;i=p;return a[o>>0]|0}function Ii(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;q=i;i=i+64|0;j=q+60|0;v=q+56|0;k=q+52|0;l=q+48|0;m=q+44|0;n=q+40|0;u=q+36|0;p=q+24|0;o=q+16|0;s=q+8|0;t=q+4|0;r=q;c[j>>2]=a;c[v>>2]=b;c[k>>2]=d;c[l>>2]=e;c[m>>2]=f;c[n>>2]=g;c[u>>2]=h;c[s>>2]=(((c[v>>2]&65535)<<16>>16)*2471|0)/((c[u>>2]|0)/1e3|0|0)|0;c[t>>2]=268435456-((c[s>>2]|0)*471|0);c[p>>2]=c[t>>2];c[p+4>>2]=0-(c[t>>2]|0)<<1;c[p+8>>2]=c[t>>2];c[r>>2]=c[t>>2]>>6;d=_(c[s>>2]>>16,(c[s>>2]&65535)<<16>>16)|0;d=d+((_(c[s>>2]&65535,(c[s>>2]&65535)<<16>>16)|0)>>16)|0;d=_(c[r>>2]>>16,(d+(_(c[s>>2]|0,(c[s>>2]>>15)+1>>1)|0)-8388608&65535)<<16>>16)|0;f=_(c[s>>2]>>16,(c[s>>2]&65535)<<16>>16)|0;f=f+((_(c[s>>2]&65535,(c[s>>2]&65535)<<16>>16)|0)>>16)|0;f=d+((_(c[r>>2]&65535,(f+(_(c[s>>2]|0,(c[s>>2]>>15)+1>>1)|0)-8388608&65535)<<16>>16)|0)>>16)|0;d=_(c[s>>2]>>16,(c[s>>2]&65535)<<16>>16)|0;d=d+((_(c[s>>2]&65535,(c[s>>2]&65535)<<16>>16)|0)>>16)|0;c[o>>2]=f+(_(c[r>>2]|0,(d+(_(c[s>>2]|0,(c[s>>2]>>15)+1>>1)|0)-8388608>>15)+1>>1)|0);d=_(c[r>>2]>>16,(c[r>>2]&65535)<<16>>16)|0;d=d+((_(c[r>>2]&65535,(c[r>>2]&65535)<<16>>16)|0)>>16)|0;c[o+4>>2]=d+(_(c[r>>2]|0,(c[r>>2]>>15)+1>>1)|0);Ji(c[j>>2]|0,p,o,c[l>>2]|0,c[k>>2]|0,c[m>>2]|0,c[n>>2]|0);if((c[n>>2]|0)!=2){i=q;return}Ji((c[j>>2]|0)+4|0,p,o,(c[l>>2]|0)+8|0,(c[k>>2]|0)+4|0,c[m>>2]|0,c[n>>2]|0);i=q;return}function Ji(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;u=i;i=i+64|0;k=u+60|0;v=u+56|0;w=u+52|0;l=u+48|0;m=u+44|0;n=u+40|0;o=u+36|0;s=u+32|0;t=u+28|0;r=u+24|0;p=u+16|0;q=u;c[k>>2]=a;c[v>>2]=b;c[w>>2]=d;c[l>>2]=e;c[m>>2]=f;c[n>>2]=h;c[o>>2]=j;g[p>>2]=+(c[c[w>>2]>>2]|0)*3.725290298461914e-09;g[p+4>>2]=+(c[(c[w>>2]|0)+4>>2]|0)*3.725290298461914e-09;g[q>>2]=+(c[c[v>>2]>>2]|0)*3.725290298461914e-09;g[q+4>>2]=+(c[(c[v>>2]|0)+4>>2]|0)*3.725290298461914e-09;g[q+8>>2]=+(c[(c[v>>2]|0)+8>>2]|0)*3.725290298461914e-09;c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[n>>2]|0))break;w=_(c[s>>2]|0,c[o>>2]|0)|0;g[r>>2]=+g[(c[k>>2]|0)+(w<<2)>>2];g[t>>2]=+g[c[l>>2]>>2]+ +g[q>>2]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2]|0,c[(c[k>>2]|0)+100>>2]|0,c[(c[k>>2]|0)+132>>2]|0,c[(c[k>>2]|0)+148>>2]|0,c[j>>2]|0,1,(c[k>>2]|0)+172+6872|0)|0;a=_(c[q>>2]|0,c[(c[k>>2]|0)+100>>2]|0)|0;c[p>>2]=ia()|0;e=i;i=i+((1*(a<<2)|0)+15&-16)|0;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(_(c[q>>2]|0,c[(c[k>>2]|0)+100>>2]|0)|0))break;g[e+(c[r>>2]<<2)>>2]=+(b[(c[l>>2]|0)+(c[r>>2]<<1)>>1]|0)*.000030517578125;c[r>>2]=(c[r>>2]|0)+1}c[s>>2]=Fi(c[k>>2]|0,e,c[q>>2]|0,c[n>>2]|0,c[o>>2]|0,16,c[l>>2]|0,c[m>>2]|0,0,-2,c[(c[k>>2]|0)+100>>2]|0,1,0)|0;s=c[s>>2]|0;na(c[p>>2]|0);i=t;return s|0}function Ri(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+32|0;g=o+24|0;h=o+20|0;j=o+16|0;k=o+12|0;l=o+8|0;n=o+4|0;m=o;c[g>>2]=a;c[h>>2]=b;c[j>>2]=d;c[k>>2]=e;c[l>>2]=f;if((c[(c[g>>2]|0)+96>>2]|0)==2051)c[m>>2]=0;else c[m>>2]=c[(c[g>>2]|0)+104>>2];c[n>>2]=Ai(c[h>>2]|0,c[j>>2]|0,c[(c[g>>2]|0)+144>>2]|0,c[(c[g>>2]|0)+100>>2]|0,c[(c[g>>2]|0)+132>>2]|0,c[(c[g>>2]|0)+148>>2]|0,c[m>>2]|0,2,(c[g>>2]|0)+172+6872|0)|0;a=Fi(c[g>>2]|0,c[h>>2]|0,c[n>>2]|0,c[k>>2]|0,c[l>>2]|0,24,c[h>>2]|0,c[j>>2]|0,0,-2,c[(c[g>>2]|0)+100>>2]|0,2,1)|0;i=o;return a|0}function Si(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0;ha=i;i=i+352|0;ca=ha+48|0;ba=ha+40|0;aa=ha+32|0;$=ha+24|0;_=ha+16|0;Z=ha+8|0;Y=ha;fa=ha+336|0;ea=ha+332|0;ia=ha+328|0;ga=ha+324|0;h=ha+320|0;f=ha+304|0;m=ha+300|0;n=ha+296|0;y=ha+292|0;J=ha+288|0;da=ha+284|0;T=ha+280|0;U=ha+276|0;V=ha+272|0;W=ha+268|0;X=ha+264|0;o=ha+260|0;p=ha+256|0;q=ha+252|0;r=ha+248|0;s=ha+244|0;t=ha+240|0;u=ha+236|0;v=ha+232|0;w=ha+228|0;x=ha+224|0;z=ha+220|0;A=ha+216|0;B=ha+212|0;C=ha+208|0;D=ha+204|0;E=ha+200|0;F=ha+196|0;G=ha+192|0;H=ha+188|0;I=ha+184|0;K=ha+180|0;L=ha+176|0;M=ha+172|0;N=ha+168|0;O=ha+164|0;k=ha+160|0;j=ha+72|0;l=ha+68|0;P=ha+64|0;Q=ha+60|0;R=ha+56|0;S=ha+52|0;c[ea>>2]=a;c[ia>>2]=d;c[ga>>2]=0;c[f>>2]=e;c[h>>2]=(c[ea>>2]|0)+(c[c[ea>>2]>>2]|0);a:do switch(c[ia>>2]|0){case 4e3:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[m>>2]=ia;do if(!((c[m>>2]|0)!=2048&(c[m>>2]|0)!=2049&(c[m>>2]|0)!=2051)){if((c[(c[ea>>2]|0)+14344>>2]|0)==0?(c[(c[ea>>2]|0)+96>>2]|0)!=(c[m>>2]|0):0)break;c[(c[ea>>2]|0)+96>>2]=c[m>>2];f=99;break a}while(0);c[ga>>2]=-1;f=99;break}case 4001:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[n>>2]=ia;if(c[n>>2]|0){c[c[n>>2]>>2]=c[(c[ea>>2]|0)+96>>2];f=99}else f=100;break}case 4002:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[y>>2]=ia;do if((c[y>>2]|0)!=-1e3&(c[y>>2]|0)!=-1){if((c[y>>2]|0)<=0){f=100;break a}if((c[y>>2]|0)<=500){c[y>>2]=500;break}if((c[y>>2]|0)>((c[(c[ea>>2]|0)+100>>2]|0)*3e5|0))c[y>>2]=(c[(c[ea>>2]|0)+100>>2]|0)*3e5}while(0);c[(c[ea>>2]|0)+152>>2]=c[y>>2];f=99;break}case 4003:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[J>>2]=ia;if(c[J>>2]|0){f=Gi(c[ea>>2]|0,c[(c[ea>>2]|0)+14332>>2]|0,1276)|0;c[c[J>>2]>>2]=f;f=99}else f=100;break}case 4022:{e=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[e>>2]|0;c[f>>2]=e+4;c[da>>2]=ia;f=c[da>>2]|0;if((c[da>>2]|0)<1){if((f|0)!=-1e3){f=100;break a}}else if((c[da>>2]|0)!=-1e3?(f|0)>(c[(c[ea>>2]|0)+100>>2]|0):0){f=100;break a}c[(c[ea>>2]|0)+108>>2]=c[da>>2];f=99;break}case 4023:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[T>>2]=ia;if(c[T>>2]|0){c[c[T>>2]>>2]=c[(c[ea>>2]|0)+108>>2];f=99}else f=100;break}case 4004:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[U>>2]=ia;if(!((c[U>>2]|0)<1101|(c[U>>2]|0)>1105)){c[(c[ea>>2]|0)+120>>2]=c[U>>2];h=c[ea>>2]|0;if((c[(c[ea>>2]|0)+120>>2]|0)==1101){c[h+8+12>>2]=8e3;f=99;break a}f=(c[ea>>2]|0)+8+12|0;if((c[h+120>>2]|0)==1102){c[f>>2]=12e3;f=99;break a}else{c[f>>2]=16e3;f=99;break a}}else f=100;break}case 4005:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[V>>2]=ia;if(c[V>>2]|0){c[c[V>>2]>>2]=c[(c[ea>>2]|0)+120>>2];f=99}else f=100;break}case 4008:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[W>>2]=ia;if(!(((c[W>>2]|0)<1101|(c[W>>2]|0)>1105)&(c[W>>2]|0)!=-1e3)){c[(c[ea>>2]|0)+116>>2]=c[W>>2];h=c[ea>>2]|0;if((c[(c[ea>>2]|0)+116>>2]|0)==1101){c[h+8+12>>2]=8e3;f=99;break a}f=(c[ea>>2]|0)+8+12|0;if((c[h+116>>2]|0)==1102){c[f>>2]=12e3;f=99;break a}else{c[f>>2]=16e3;f=99;break a}}else f=100;break}case 4009:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[X>>2]=ia;if(c[X>>2]|0){c[c[X>>2]>>2]=c[(c[ea>>2]|0)+14336>>2];f=99}else f=100;break}case 4016:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[o>>2]=ia;if((c[o>>2]|0)<0|(c[o>>2]|0)>1)f=100;else{c[(c[ea>>2]|0)+8+44>>2]=c[o>>2];f=99}break}case 4017:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[p>>2]=ia;if(c[p>>2]|0){c[c[p>>2]>>2]=c[(c[ea>>2]|0)+8+44>>2];f=99}else f=100;break}case 4010:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[q>>2]=ia;if((c[q>>2]|0)<0|(c[q>>2]|0)>10)f=100;else{c[(c[ea>>2]|0)+8+36>>2]=c[q>>2];f=c[h>>2]|0;c[Y>>2]=c[q>>2];lb(f,4010,Y)|0;f=99}break}case 4011:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[r>>2]=ia;if(c[r>>2]|0){c[c[r>>2]>>2]=c[(c[ea>>2]|0)+8+36>>2];f=99}else f=100;break}case 4012:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[s>>2]=ia;if((c[s>>2]|0)<0|(c[s>>2]|0)>1)f=100;else{c[(c[ea>>2]|0)+8+40>>2]=c[s>>2];f=99}break}case 4013:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[t>>2]=ia;if(c[t>>2]|0){c[c[t>>2]>>2]=c[(c[ea>>2]|0)+8+40>>2];f=99}else f=100;break}case 4014:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[u>>2]=ia;if((c[u>>2]|0)<0|(c[u>>2]|0)>100)f=100;else{c[(c[ea>>2]|0)+8+32>>2]=c[u>>2];f=c[h>>2]|0;c[Z>>2]=c[u>>2];lb(f,4014,Z)|0;f=99}break}case 4015:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[v>>2]=ia;if(c[v>>2]|0){c[c[v>>2]>>2]=c[(c[ea>>2]|0)+8+32>>2];f=99}else f=100;break}case 4006:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[w>>2]=ia;if((c[w>>2]|0)<0|(c[w>>2]|0)>1)f=100;else{c[(c[ea>>2]|0)+136>>2]=c[w>>2];c[(c[ea>>2]|0)+8+48>>2]=1-(c[w>>2]|0);f=99}break}case 4007:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[x>>2]=ia;if(c[x>>2]|0){c[c[x>>2]>>2]=c[(c[ea>>2]|0)+136>>2];f=99}else f=100;break}case 11018:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[z>>2]=ia;if((c[z>>2]|0)<-1|(c[z>>2]|0)>100)f=100;else{c[(c[ea>>2]|0)+128>>2]=c[z>>2];f=99}break}case 11019:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[A>>2]=ia;if(c[A>>2]|0){c[c[A>>2]>>2]=c[(c[ea>>2]|0)+128>>2];f=99}else f=100;break}case 4020:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[B>>2]=ia;if((c[B>>2]|0)<0|(c[B>>2]|0)>1)f=100;else{c[(c[ea>>2]|0)+140>>2]=c[B>>2];f=99}break}case 4021:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[C>>2]=ia;if(c[C>>2]|0){c[c[C>>2]>>2]=c[(c[ea>>2]|0)+140>>2];f=99}else f=100;break}case 4024:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[D>>2]=ia;if((c[D>>2]|0)!=-1e3&(c[D>>2]|0)!=3001&(c[D>>2]|0)!=3002)f=100;else{c[(c[ea>>2]|0)+112>>2]=c[D>>2];f=99}break}case 4025:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[E>>2]=ia;if(c[E>>2]|0){c[c[E>>2]>>2]=c[(c[ea>>2]|0)+112>>2];f=99}else f=100;break}case 4027:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[F>>2]=ia;if(c[F>>2]|0){c[c[F>>2]>>2]=(c[(c[ea>>2]|0)+132>>2]|0)/400|0;if((c[(c[ea>>2]|0)+96>>2]|0)!=2051){f=c[F>>2]|0;c[f>>2]=(c[f>>2]|0)+(c[(c[ea>>2]|0)+104>>2]|0);f=99}else f=99}else f=100;break}case 4029:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[G>>2]=ia;if(c[G>>2]|0){c[c[G>>2]>>2]=c[(c[ea>>2]|0)+132>>2];f=99}else f=100;break}case 4031:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[H>>2]=ia;if(c[H>>2]|0){c[c[H>>2]>>2]=c[(c[ea>>2]|0)+18216>>2];f=99}else f=100;break}case 4036:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[I>>2]=ia;if((c[I>>2]|0)<8|(c[I>>2]|0)>24)f=100;else{c[(c[ea>>2]|0)+156>>2]=c[I>>2];f=99}break}case 4037:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[K>>2]=ia;if(c[K>>2]|0){c[c[K>>2]>>2]=c[(c[ea>>2]|0)+156>>2];f=99}else f=100;break}case 4040:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[L>>2]=ia;if((c[L>>2]|0)!=5e3&(c[L>>2]|0)!=5001&(c[L>>2]|0)!=5002&(c[L>>2]|0)!=5003&(c[L>>2]|0)!=5004&(c[L>>2]|0)!=5005&(c[L>>2]|0)!=5006&(c[L>>2]|0)!=5010)f=100;else{c[(c[ea>>2]|0)+144>>2]=c[L>>2];f=c[h>>2]|0;c[_>>2]=c[L>>2];lb(f,4040,_)|0;f=99}break}case 4041:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[M>>2]=ia;if(c[M>>2]|0){c[c[M>>2]>>2]=c[(c[ea>>2]|0)+144>>2];f=99}else f=100;break}case 4042:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[N>>2]=ia;if((c[N>>2]|0)>1|(c[N>>2]|0)<0)f=100;else{c[(c[ea>>2]|0)+8+64>>2]=c[N>>2];f=99}break}case 4043:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[O>>2]=ia;if(c[O>>2]|0){c[c[O>>2]>>2]=c[(c[ea>>2]|0)+8+64>>2];f=99}else f=100;break}case 4028:{c[k>>2]=(c[ea>>2]|0)+(c[(c[ea>>2]|0)+4>>2]|0);_i((c[ea>>2]|0)+172|0);c[l>>2]=(c[ea>>2]|0)+14288;oj(c[l>>2]|0,0,18220-((c[l>>2]|0)-(c[ea>>2]|0))|0)|0;lb(c[h>>2]|0,4028,$)|0;Td(c[k>>2]|0,c[(c[ea>>2]|0)+168>>2]|0,j)|0;c[(c[ea>>2]|0)+14288>>2]=c[(c[ea>>2]|0)+100>>2];b[(c[ea>>2]|0)+14292>>1]=16384;g[(c[ea>>2]|0)+14300>>2]=1.0;c[(c[ea>>2]|0)+14344>>2]=1;c[(c[ea>>2]|0)+14320>>2]=1001;c[(c[ea>>2]|0)+14336>>2]=1105;f=(Sf(60)|0)<<8;c[(c[ea>>2]|0)+14296>>2]=f;f=99;break}case 11002:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[P>>2]=ia;if(((c[P>>2]|0)<1e3|(c[P>>2]|0)>1002)&(c[P>>2]|0)!=-1e3)f=100;else{c[(c[ea>>2]|0)+124>>2]=c[P>>2];f=99}break}case 10024:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[Q>>2]=ia;c[(c[ea>>2]|0)+164>>2]=c[Q>>2];f=c[h>>2]|0;c[aa>>2]=c[Q>>2];c[ga>>2]=lb(f,10024,aa)|0;f=99;break}case 10026:{da=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[da>>2]|0;c[f>>2]=da+4;c[R>>2]=ia;c[(c[ea>>2]|0)+14348>>2]=c[R>>2];f=c[h>>2]|0;c[ba>>2]=(c[R>>2]|0)+((((c[R>>2]|0)-(c[R>>2]|0)|0)/4|0)<<2);c[ga>>2]=lb(f,10026,ba)|0;f=99;break}case 10015:{ea=(c[f>>2]|0)+(4-1)&~(4-1);ia=c[ea>>2]|0;c[f>>2]=ea+4;c[S>>2]=ia;if(c[S>>2]|0){f=c[h>>2]|0;c[ca>>2]=(c[S>>2]|0)+((((c[S>>2]|0)-(c[S>>2]|0)|0)/4|0)<<2);c[ga>>2]=lb(f,10015,ca)|0;f=99}else f=100;break}default:{c[ga>>2]=-5;f=99}}while(0);if((f|0)==99){c[fa>>2]=c[ga>>2];ia=c[fa>>2]|0;i=ha;return ia|0}else if((f|0)==100){c[fa>>2]=-1;ia=c[fa>>2]|0;i=ha;return ia|0}return 0}function Ti(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;c[b>>2]=a;c[(c[b>>2]|0)+4>>2]=0;i=d;return c[b>>2]|0}function Ui(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+16|0;h=e+8|0;g=e+4|0;f=e;c[h>>2]=a;c[g>>2]=b;c[f>>2]=d;a=Vi(c[h>>2]|0,c[g>>2]|0,c[f>>2]|0,0)|0;i=e;return a|0}function Vi(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+32|0;h=q+24|0;j=q+20|0;k=q+16|0;l=q+12|0;m=q+8|0;p=q+28|0;n=q+4|0;o=q;c[j>>2]=b;c[k>>2]=e;c[l>>2]=f;c[m>>2]=g;if((c[l>>2]|0)<1){c[h>>2]=-4;p=c[h>>2]|0;i=q;return p|0}if(c[(c[j>>2]|0)+4>>2]|0){if(((d[c[j>>2]>>0]|0)&252|0)!=((d[c[k>>2]>>0]|0)&252|0)){c[h>>2]=-4;p=c[h>>2]|0;i=q;return p|0}}else{a[c[j>>2]>>0]=a[c[k>>2]>>0]|0;g=Zh(c[k>>2]|0,8e3)|0;c[(c[j>>2]|0)+296>>2]=g}c[n>>2]=pi(c[k>>2]|0,c[l>>2]|0)|0;if((c[n>>2]|0)<1){c[h>>2]=-4;p=c[h>>2]|0;i=q;return p|0}if((_((c[n>>2]|0)+(c[(c[j>>2]|0)+4>>2]|0)|0,c[(c[j>>2]|0)+296>>2]|0)|0)>960){c[h>>2]=-4;p=c[h>>2]|0;i=q;return p|0}c[o>>2]=_h(c[k>>2]|0,c[l>>2]|0,c[m>>2]|0,p,(c[j>>2]|0)+8+(c[(c[j>>2]|0)+4>>2]<<2)|0,(c[j>>2]|0)+200+(c[(c[j>>2]|0)+4>>2]<<1)|0,0,0)|0;if((c[o>>2]|0)<1){c[h>>2]=c[o>>2];p=c[h>>2]|0;i=q;return p|0}else{p=(c[j>>2]|0)+4|0;c[p>>2]=(c[p>>2]|0)+(c[n>>2]|0);c[h>>2]=0;p=c[h>>2]|0;i=q;return p|0}return 0}function Wi(e,f,g,h,j,k,l){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+80|0;q=F+68|0;o=F+64|0;m=F+60|0;n=F+56|0;r=F+52|0;s=F+48|0;t=F+44|0;u=F+40|0;x=F+36|0;v=F+32|0;D=F+28|0;y=F+24|0;w=F+20|0;B=F+16|0;E=F+12|0;A=F+8|0;z=F+4|0;C=F;c[o>>2]=e;c[m>>2]=f;c[n>>2]=g;c[r>>2]=h;c[s>>2]=j;c[t>>2]=k;c[u>>2]=l;if(((c[m>>2]|0)>=0?(c[m>>2]|0)<(c[n>>2]|0):0)?(c[n>>2]|0)<=(c[(c[o>>2]|0)+4>>2]|0):0){c[v>>2]=(c[n>>2]|0)-(c[m>>2]|0);c[y>>2]=(c[o>>2]|0)+200+(c[m>>2]<<1);c[w>>2]=(c[o>>2]|0)+8+(c[m>>2]<<2);if(c[t>>2]|0)c[D>>2]=1+((b[(c[y>>2]|0)+((c[v>>2]|0)-1<<1)>>1]|0)>=252&1);else c[D>>2]=0;c[B>>2]=c[r>>2];do if((c[v>>2]|0)!=1){if((c[v>>2]|0)==2){m=b[c[y>>2]>>1]|0;if((b[(c[y>>2]|0)+2>>1]|0)==(b[c[y>>2]>>1]|0)){c[D>>2]=(c[D>>2]|0)+((m<<1)+1);if((c[D>>2]|0)<=(c[s>>2]|0)){e=(d[c[o>>2]>>0]&252|1)&255;k=c[B>>2]|0;c[B>>2]=k+1;a[k>>0]=e;break}c[q>>2]=-2;E=c[q>>2]|0;i=F;return E|0}else{c[D>>2]=(c[D>>2]|0)+(m+(b[(c[y>>2]|0)+2>>1]|0)+2+((b[c[y>>2]>>1]|0)>=252&1));if((c[D>>2]|0)<=(c[s>>2]|0)){e=(d[c[o>>2]>>0]&252|2)&255;k=c[B>>2]|0;c[B>>2]=k+1;a[k>>0]=e;k=Yh(b[c[y>>2]>>1]|0,c[B>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+k;break}c[q>>2]=-2;E=c[q>>2]|0;i=F;return E|0}}}else{c[D>>2]=(c[D>>2]|0)+((b[c[y>>2]>>1]|0)+1);if((c[D>>2]|0)<=(c[s>>2]|0)){e=d[c[o>>2]>>0]&252;k=c[B>>2]|0;c[B>>2]=k+1;a[k>>0]=e;break}c[q>>2]=-2;E=c[q>>2]|0;i=F;return E|0}while(0);if((c[v>>2]|0)<=2){if(c[u>>2]|0?(c[D>>2]|0)<(c[s>>2]|0):0)p=23}else p=23;a:do if((p|0)==23){c[A>>2]=0;c[B>>2]=c[r>>2];if(c[t>>2]|0)c[D>>2]=1+((b[(c[y>>2]|0)+((c[v>>2]|0)-1<<1)>>1]|0)>=252&1);else c[D>>2]=0;c[E>>2]=0;c[x>>2]=1;while(1){if((c[x>>2]|0)>=(c[v>>2]|0))break;if((b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0)!=(b[c[y>>2]>>1]|0)){p=29;break}c[x>>2]=(c[x>>2]|0)+1}if((p|0)==29)c[E>>2]=1;do if(c[E>>2]|0){c[D>>2]=(c[D>>2]|0)+2;c[x>>2]=0;while(1){if((c[x>>2]|0)>=((c[v>>2]|0)-1|0))break;c[D>>2]=(c[D>>2]|0)+(1+((b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0)>=252&1)+(b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0));c[x>>2]=(c[x>>2]|0)+1}c[D>>2]=(c[D>>2]|0)+(b[(c[y>>2]|0)+((c[v>>2]|0)-1<<1)>>1]|0);if((c[D>>2]|0)<=(c[s>>2]|0)){p=(d[c[o>>2]>>0]&252|3)&255;o=c[B>>2]|0;c[B>>2]=o+1;a[o>>0]=p;o=(c[v>>2]|128)&255;p=c[B>>2]|0;c[B>>2]=p+1;a[p>>0]=o;break}c[q>>2]=-2;E=c[q>>2]|0;i=F;return E|0}else{p=(_(c[v>>2]|0,b[c[y>>2]>>1]|0)|0)+2|0;c[D>>2]=(c[D>>2]|0)+p;if((c[D>>2]|0)<=(c[s>>2]|0)){p=(d[c[o>>2]>>0]&252|3)&255;o=c[B>>2]|0;c[B>>2]=o+1;a[o>>0]=p;o=c[v>>2]&255;p=c[B>>2]|0;c[B>>2]=p+1;a[p>>0]=o;break}c[q>>2]=-2;E=c[q>>2]|0;i=F;return E|0}while(0);if(c[u>>2]|0)m=(c[s>>2]|0)-(c[D>>2]|0)|0;else m=0;c[A>>2]=m;if(c[A>>2]|0){p=(c[r>>2]|0)+1|0;a[p>>0]=d[p>>0]|64;c[z>>2]=((c[A>>2]|0)-1|0)/255|0;c[x>>2]=0;while(1){if((c[x>>2]|0)>=(c[z>>2]|0))break;p=c[B>>2]|0;c[B>>2]=p+1;a[p>>0]=-1;c[x>>2]=(c[x>>2]|0)+1}p=(c[A>>2]|0)-((c[z>>2]|0)*255|0)-1&255;z=c[B>>2]|0;c[B>>2]=z+1;a[z>>0]=p;c[D>>2]=(c[D>>2]|0)+(c[A>>2]|0)}if(c[E>>2]|0){c[x>>2]=0;while(1){if((c[x>>2]|0)>=((c[v>>2]|0)-1|0))break a;E=Yh(b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0,c[B>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+E;c[x>>2]=(c[x>>2]|0)+1}}}while(0);if(c[t>>2]|0){c[C>>2]=Yh(b[(c[y>>2]|0)+((c[v>>2]|0)-1<<1)>>1]|0,c[B>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+(c[C>>2]|0)}c[x>>2]=0;while(1){if((c[x>>2]|0)>=(c[v>>2]|0))break;qj(c[B>>2]|0,c[(c[w>>2]|0)+(c[x>>2]<<2)>>2]|0,(b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0)+0|0)|0;c[B>>2]=(c[B>>2]|0)+(b[(c[y>>2]|0)+(c[x>>2]<<1)>>1]|0);c[x>>2]=(c[x>>2]|0)+1}b:do if(c[u>>2]|0)while(1){if((c[B>>2]|0)>>>0>=((c[r>>2]|0)+(c[s>>2]|0)|0)>>>0)break b;E=c[B>>2]|0;c[B>>2]=E+1;a[E>>0]=0}while(0);c[q>>2]=c[D>>2];E=c[q>>2]|0;i=F;return E|0}c[q>>2]=-1;E=c[q>>2]|0;i=F;return E|0}function Xi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+320|0;e=l+316|0;f=l+312|0;g=l+308|0;h=l+304|0;k=l+4|0;j=l;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if((c[g>>2]|0)<1){c[e>>2]=-1;k=c[e>>2]|0;i=l;return k|0}if((c[g>>2]|0)==(c[h>>2]|0)){c[e>>2]=0;k=c[e>>2]|0;i=l;return k|0}if((c[g>>2]|0)>(c[h>>2]|0)){c[e>>2]=-1;k=c[e>>2]|0;i=l;return k|0}Ti(k)|0;qj((c[f>>2]|0)+(c[h>>2]|0)+(0-(c[g>>2]|0))|0,c[f>>2]|0,(c[g>>2]|0)+0|0)|0;Ui(k,(c[f>>2]|0)+(c[h>>2]|0)+(0-(c[g>>2]|0))|0,c[g>>2]|0)|0;c[j>>2]=Wi(k,0,c[k+4>>2]|0,c[f>>2]|0,c[h>>2]|0,0,1)|0;if((c[j>>2]|0)>0){c[e>>2]=0;k=c[e>>2]|0;i=l;return k|0}else{c[e>>2]=c[j>>2];k=c[e>>2]|0;i=l;return k|0}return 0}function Yi(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;a=Zi()|0;c[c[d>>2]>>2]=a;_i(c[d>>2]|0);i=b;return}function Zi(){return 0}function _i(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=(c[d>>2]|0)+4;oj(c[e>>2]|0,0,14116-((c[e>>2]|0)-(c[d>>2]|0))|0)|0;i=b;return}function $i(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;h=n+24|0;j=n+20|0;e=n+16|0;f=n+12|0;k=n+8|0;m=n+4|0;l=n;c[h>>2]=a;c[j>>2]=b;c[e>>2]=d;c[f>>2]=c[(c[h>>2]|0)+8508>>2];c[k>>2]=(c[(c[h>>2]|0)+8504>>2]|0)-(c[(c[h>>2]|0)+8508>>2]|0);if((c[k>>2]|0)<0)c[k>>2]=(c[k>>2]|0)+200;if((c[e>>2]|0)>480?(c[f>>2]|0)!=(c[(c[h>>2]|0)+8504>>2]|0):0){a=(c[f>>2]|0)+1|0;c[f>>2]=a;c[f>>2]=(c[f>>2]|0)==200?0:a}if((c[f>>2]|0)==(c[(c[h>>2]|0)+8504>>2]|0))c[f>>2]=(c[f>>2]|0)+-1;if((c[f>>2]|0)<0)c[f>>2]=199;pj(c[j>>2]|0,(c[h>>2]|0)+8516+((c[f>>2]|0)*28|0)|0,28|0)|0;a=(c[h>>2]|0)+8512|0;c[a>>2]=(c[a>>2]|0)+((c[e>>2]|0)/120|0);while(1){e=c[h>>2]|0;if((c[(c[h>>2]|0)+8512>>2]|0)<4)break;a=e+8512|0;c[a>>2]=(c[a>>2]|0)-4;a=(c[h>>2]|0)+8508|0;c[a>>2]=(c[a>>2]|0)+1}if((c[e+8508>>2]|0)>=200){a=(c[h>>2]|0)+8508|0;c[a>>2]=(c[a>>2]|0)-200}c[k>>2]=((c[k>>2]|0)-10|0)>0?(c[k>>2]|0)-10|0:0;g[m>>2]=0.0;c[l>>2]=0;while(1){if((c[l>>2]|0)>=(200-(c[k>>2]|0)|0))break;g[m>>2]=+g[m>>2]+ +g[(c[h>>2]|0)+7688+(c[l>>2]<<2)>>2];c[l>>2]=(c[l>>2]|0)+1}while(1){if((c[l>>2]|0)>=200)break;g[m>>2]=+g[m>>2]+ +g[(c[h>>2]|0)+6888+(c[l>>2]<<2)>>2];c[l>>2]=(c[l>>2]|0)+1}g[m>>2]=+g[m>>2]*+g[(c[h>>2]|0)+8492>>2]+(1.0-+g[m>>2])*+g[(c[h>>2]|0)+8488>>2];g[(c[j>>2]|0)+20>>2]=+g[m>>2];i=n;return}function aj(a,b,d,e,f,g,h,j,k,l,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=i;i=i+64|0;p=C+52|0;q=C+48|0;t=C+44|0;u=C+40|0;v=C+36|0;w=C+32|0;x=C+28|0;y=C+24|0;o=C+20|0;z=C+16|0;r=C+12|0;s=C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>2]|0)+1}if(!(+g[W>>2]<1.0e9)){fa=37;break}if(+g[W>>2]!=+g[W>>2]){fa=37;break}g[(c[Sa>>2]|0)+5844+((c[(c[Sa>>2]|0)+6856>>2]|0)*72|0)+(c[sa>>2]<<2)>>2]=+g[W>>2];g[Va>>2]=+g[Va>>2]+ +g[aa>>2]/(+g[W>>2]+1.0000000036274937e-15);n=+O(+(+g[W>>2]+1.000000013351432e-10));g[ta>>2]=+g[ta>>2]+n;n=+Y(+(+g[W>>2]+1.000000013351432e-10));g[ua+(c[sa>>2]<<2)>>2]=n;k=c[sa>>2]|0;if(+g[ua+(c[sa>>2]<<2)>>2]<+g[(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)>>2]+.009999999776482582)n=+g[ua+(k<<2)>>2];else n=+g[(c[Sa>>2]|0)+6420+(k<<2)>>2]+.009999999776482582;g[(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)>>2]=n;k=c[sa>>2]|0;if(+g[ua+(c[sa>>2]<<2)>>2]>+g[(c[Sa>>2]|0)+6492+(c[sa>>2]<<2)>>2]-.10000000149011612)n=+g[ua+(k<<2)>>2];else n=+g[(c[Sa>>2]|0)+6492+(k<<2)>>2]-.10000000149011612;g[(c[Sa>>2]|0)+6492+(c[sa>>2]<<2)>>2]=n;if(+g[(c[Sa>>2]|0)+6492+(c[sa>>2]<<2)>>2]<+g[(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)>>2]+1.0){U=(c[Sa>>2]|0)+6492+(c[sa>>2]<<2)|0;g[U>>2]=+g[U>>2]+.5;U=(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)|0;g[U>>2]=+g[U>>2]-.5}g[wa>>2]=+g[wa>>2]+(+g[ua+(c[sa>>2]<<2)>>2]-+g[(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)>>2])/(+g[(c[Sa>>2]|0)+6492+(c[sa>>2]<<2)>>2]+1.0000000036274937e-15-+g[(c[Sa>>2]|0)+6420+(c[sa>>2]<<2)>>2]);g[Z>>2]=0.0;g[X>>2]=0.0;c[Fa>>2]=0;while(1){if((c[Fa>>2]|0)>=8)break;n=+O(+(+g[(c[Sa>>2]|0)+5844+((c[Fa>>2]|0)*72|0)+(c[sa>>2]<<2)>>2]));g[X>>2]=+g[X>>2]+n;g[Z>>2]=+g[Z>>2]+ +g[(c[Sa>>2]|0)+5844+((c[Fa>>2]|0)*72|0)+(c[sa>>2]<<2)>>2];c[Fa>>2]=(c[Fa>>2]|0)+1}if(.9900000095367432<+g[X>>2]/+O(+(+g[Z>>2]*8.0+1.0e-15)))n=.9900000095367432;else n=+g[X>>2]/+O(+(+g[Z>>2]*8.0+1.0e-15));g[ca>>2]=n;g[ca>>2]=+g[ca>>2]*+g[ca>>2];g[ca>>2]=+g[ca>>2]*+g[ca>>2];g[Ba>>2]=+g[Ba>>2]+ +g[ca>>2];if(+g[da>>2]/(+g[W>>2]+1.0000000036274937e-15)>+g[ca>>2]*+g[(c[Sa>>2]|0)+5768+(c[sa>>2]<<2)>>2])n=+g[da>>2]/(+g[W>>2]+1.0000000036274937e-15);else n=+g[ca>>2]*+g[(c[Sa>>2]|0)+5768+(c[sa>>2]<<2)>>2];g[_+(c[sa>>2]<<2)>>2]=n;g[Ca>>2]=+g[Ca>>2]+ +g[_+(c[sa>>2]<<2)>>2];if((c[sa>>2]|0)>=9)g[Ca>>2]=+g[Ca>>2]-+g[_+((c[sa>>2]|0)-18+9<<2)>>2];if(+g[va>>2]>(+((c[sa>>2]|0)-18|0)*.029999999329447746+1.0)*+g[Ca>>2])n=+g[va>>2];else n=(+((c[sa>>2]|0)-18|0)*.029999999329447746+1.0)*+g[Ca>>2];g[va>>2]=n;g[Da>>2]=+g[Da>>2]+ +g[_+(c[sa>>2]<<2)>>2]*+((c[sa>>2]|0)-8|0);g[(c[Sa>>2]|0)+5768+(c[sa>>2]<<2)>>2]=+g[_+(c[sa>>2]<<2)>>2];c[sa>>2]=(c[sa>>2]|0)+1}if((fa|0)==37){c[c[Wa>>2]>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+g[ga>>2];if((+g[ga>>2]>+g[la>>2]*.1?+g[ga>>2]*1.0e9>+g[na>>2]:0)?+g[ga>>2]>+g[oa>>2]*+((c[ja>>2]|0)-(c[ka>>2]|0)|0):0)c[Ua>>2]=c[sa>>2];c[sa>>2]=(c[sa>>2]|0)+1}if((c[(c[Sa>>2]|0)+6868>>2]|0)<=2)c[Ua>>2]=20;g[ta>>2]=+hj(+g[ta>>2])*20.0;if(+g[(c[Sa>>2]|0)+6848>>2]-.029999999329447746>+g[ta>>2])n=+g[(c[Sa>>2]|0)+6848>>2]-.029999999329447746;else n=+g[ta>>2];g[(c[Sa>>2]|0)+6848>>2]=n;pa=(c[Sa>>2]|0)+6852|0;g[pa>>2]=+g[pa>>2]*(1.0-+g[ra>>2]);if(+g[ta>>2]<+g[(c[Sa>>2]|0)+6848>>2]-30.0){ta=(c[Sa>>2]|0)+6852|0;g[ta>>2]=+g[ta>>2]+ +g[ra>>2]}c[Fa>>2]=0;while(1){if((c[Fa>>2]|0)>=8)break;g[xa>>2]=0.0;c[sa>>2]=0;while(1){if((c[sa>>2]|0)>=16)break;g[xa>>2]=+g[xa>>2]+ +g[19300+((c[Fa>>2]<<4)+(c[sa>>2]|0)<<2)>>2]*+g[ua+(c[sa>>2]<<2)>>2];c[sa>>2]=(c[sa>>2]|0)+1}g[ya+(c[Fa>>2]<<2)>>2]=+g[xa>>2];c[Fa>>2]=(c[Fa>>2]|0)+1}g[Ba>>2]=+g[Ba>>2]/18.0;n=+g[wa>>2]/18.0;g[wa>>2]=n;g[wa>>2]=(c[(c[Sa>>2]|0)+6868>>2]|0)<10?.5:n;g[Va>>2]=+g[Va>>2]/18.0;g[(c[Wa>>2]|0)+16>>2]=+g[Va>>2]+(1.0-+g[Va>>2])*+g[wa>>2];g[Ca>>2]=+g[va>>2]/9.0;if(+g[Ca>>2]>+g[(c[Sa>>2]|0)+5840>>2]*.800000011920929)n=+g[Ca>>2];else n=+g[(c[Sa>>2]|0)+5840>>2]*.800000011920929;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2]|0)+6808+(c[Fa>>2]<<2)>>2]));g[Aa+(11+(c[Fa>>2]|0)<<2)>>2]=n;c[Fa>>2]=(c[Fa>>2]|0)+1}g[Aa+80>>2]=+g[(c[Wa>>2]|0)+4>>2];g[Aa+84>>2]=+g[(c[Wa>>2]|0)+16>>2];g[Aa+88>>2]=+g[Ba>>2];g[Aa+92>>2]=+g[(c[Wa>>2]|0)+8>>2];g[Aa+96>>2]=+g[(c[Sa>>2]|0)+6852>>2];dj(20616,Aa,Ra);g[Ra>>2]=(+g[Ra>>2]+1.0)*.5;g[Ra>>2]=+g[Ra>>2]*1.2100000381469727*+g[Ra>>2]+.009999999776482582-+P(+(+g[Ra>>2]),10.0)*.23000000417232513;g[Ra+4>>2]=+g[Ra+4>>2]*.5+.5;g[Ra>>2]=+g[Ra+4>>2]*+g[Ra>>2]+(1.0-+g[Ra+4>>2])*.5;g[Pa>>2]=+g[Ra+4>>2]*4.999999873689376e-05;g[Ea>>2]=.05000000074505806;if(.05000000074505806>(.949999988079071<+g[Ra>>2]?.949999988079071:+g[Ra>>2]))n=.05000000074505806;else n=.949999988079071<+g[Ra>>2]?.949999988079071:+g[Ra>>2];g[Ia>>2]=n;if(.949999988079071<+g[(c[Sa>>2]|0)+6844>>2])n=.949999988079071;else n=+g[(c[Sa>>2]|0)+6844>>2];if(!(.05000000074505806>n))if(.949999988079071<+g[(c[Sa>>2]|0)+6844>>2])n=.949999988079071;else n=+g[(c[Sa>>2]|0)+6844>>2];else n=.05000000074505806;g[Ma>>2]=n;n=+N(+(+g[Ia>>2]-+g[Ma>>2]))*.05000000074505806;g[Ea>>2]=n/(+g[Ia>>2]*(1.0-+g[Ma>>2])+ +g[Ma>>2]*(1.0-+g[Ia>>2]))+.009999999776482582;g[Ja>>2]=(1.0-+g[(c[Sa>>2]|0)+6844>>2])*(1.0-+g[Pa>>2])+ +g[(c[Sa>>2]|0)+6844>>2]*+g[Pa>>2];g[Ka>>2]=+g[(c[Sa>>2]|0)+6844>>2]*(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+(Qa|0);if((c[(c[Sa>>2]|0)+8496>>2]|0)<500)k=c[(c[Sa>>2]|0)+8496>>2]|0;else k=500;c[(c[Sa>>2]|0)+8496>>2]=k;if(.20000000298023224<+g[Ra>>2]-+g[(c[Sa>>2]|0)+8488>>2])n=.20000000298023224;else n=+g[Ra>>2]-+g[(c[Sa>>2]|0)+8488>>2];Ra=(c[Sa>>2]|0)+8488|0;g[Ra>>2]=+g[Ra>>2]+ +g[Ta>>2]*n}else{if(!(c[k+8500>>2]|0))g[(c[Sa>>2]|0)+8492>>2]=.8999999761581421;if(c[(c[Sa>>2]|0)+8496>>2]|0)break;g[(c[Sa>>2]|0)+8488>>2]=.10000000149011612}while(0);if((c[(c[Sa>>2]|0)+6860>>2]|0)!=(+g[(c[Sa>>2]|0)+6844>>2]>.5|0))c[(c[Sa>>2]|0)+6864>>2]=0;c[(c[Sa>>2]|0)+6860>>2]=+g[(c[Sa>>2]|0)+6844>>2]>.5&1;c[(c[Wa>>2]|0)+24>>2]=c[Ua>>2];g[(c[Wa>>2]|0)+12>>2]=+g[Va>>2];c[c[Wa>>2]>>2]=1;i=Xa;return}function cj(a,b){a=+a;b=+b;var c=0,d=0,e=0,f=0,h=0,j=0,k=0,l=0;l=i;i=i+32|0;c=l+24|0;d=l+20|0;e=l+16|0;j=l+12|0;k=l+8|0;f=l+4|0;h=l;g[d>>2]=a;g[e>>2]=b;a=+N(+(+g[e>>2]));if(a+ +N(+(+g[d>>2]))<9.999999717180685e-10){g[e>>2]=+g[e>>2]*999999995904.0;g[d>>2]=+g[d>>2]*999999995904.0}g[j>>2]=+g[e>>2]*+g[e>>2];g[k>>2]=+g[d>>2]*+g[d>>2];if(+g[j>>2]<+g[k>>2]){g[f>>2]=(+g[k>>2]+ +g[j>>2]*.6784840226173401)*(+g[k>>2]+ +g[j>>2]*.0859554186463356);if(+g[f>>2]!=0.0){g[c>>2]=-+g[e>>2]*+g[d>>2]*(+g[k>>2]+ +g[j>>2]*.43157973885536194)/+g[f>>2]+(+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866);a=+g[c>>2];i=l;return +a}else{g[c>>2]=+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866;a=+g[c>>2];i=l;return +a}}else{g[h>>2]=(+g[j>>2]+ +g[k>>2]*.6784840226173401)*(+g[j>>2]+ +g[k>>2]*.0859554186463356);if(+g[h>>2]!=0.0){g[c>>2]=+g[e>>2]*+g[d>>2]*(+g[j>>2]+ +g[k>>2]*.43157973885536194)/+g[h>>2]+(+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866)-(+g[e>>2]*+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866);a=+g[c>>2];i=l;return +a}else{g[c>>2]=(+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866)-(+g[e>>2]*+g[d>>2]<0.0?-1.5707963705062866:1.5707963705062866);a=+g[c>>2];i=l;return +a}}return 0.0}function dj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0;r=i;i=i+448|0;k=r+436|0;f=r+432|0;l=r+428|0;o=r+424|0;n=r+24|0;m=r+16|0;h=r+12|0;j=r+8|0;p=r+4|0;q=r;c[k>>2]=a;c[f>>2]=b;c[l>>2]=d;c[m>>2]=c[(c[k>>2]|0)+8>>2];c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[(c[(c[k>>2]|0)+4>>2]|0)+4>>2]|0))break;d=c[m>>2]|0;c[m>>2]=d+4;g[j>>2]=+g[d>>2];c[h>>2]=0;while(1){e=+g[j>>2];if((c[h>>2]|0)>=(c[c[(c[k>>2]|0)+4>>2]>>2]|0))break;s=+g[(c[f>>2]|0)+(c[h>>2]<<2)>>2];d=c[m>>2]|0;c[m>>2]=d+4;g[j>>2]=e+s*+g[d>>2];c[h>>2]=(c[h>>2]|0)+1}s=+ej(e);g[n+(c[o>>2]<<2)>>2]=s;c[o>>2]=(c[o>>2]|0)+1}c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[(c[(c[k>>2]|0)+4>>2]|0)+8>>2]|0))break;j=c[m>>2]|0;c[m>>2]=j+4;g[q>>2]=+g[j>>2];c[p>>2]=0;while(1){e=+g[q>>2];if((c[p>>2]|0)>=(c[(c[(c[k>>2]|0)+4>>2]|0)+4>>2]|0))break;s=+g[n+(c[p>>2]<<2)>>2];j=c[m>>2]|0;c[m>>2]=j+4;g[q>>2]=e+s*+g[j>>2];c[p>>2]=(c[p>>2]|0)+1}s=+ej(e);g[(c[l>>2]|0)+(c[o>>2]<<2)>>2]=s;c[o>>2]=(c[o>>2]|0)+1}i=r;return}function ej(a){a=+a;var b=0,d=0,e=0,f=0,h=0,j=0,k=0;k=i;i=i+32|0;b=k+20|0;d=k+16|0;f=k+12|0;j=k+8|0;e=k+4|0;h=k;g[d>>2]=a;g[h>>2]=1.0;if(!(+g[d>>2]<8.0)){g[b>>2]=1.0;a=+g[b>>2];i=k;return +a}if(!(+g[d>>2]>-8.0)){g[b>>2]=-1.0;a=+g[b>>2];i=k;return +a}if(+g[d>>2]!=+g[d>>2]){g[b>>2]=0.0;a=+g[b>>2];i=k;return +a}if(+g[d>>2]<0.0){g[d>>2]=-+g[d>>2];g[h>>2]=-1.0}c[f>>2]=~~+M(+(+g[d>>2]*25.0+.5));g[d>>2]=+g[d>>2]-+(c[f>>2]|0)*.03999999910593033;g[j>>2]=+g[19812+(c[f>>2]<<2)>>2];g[e>>2]=1.0-+g[j>>2]*+g[j>>2];g[j>>2]=+g[j>>2]+ +g[d>>2]*+g[e>>2]*(1.0-+g[j>>2]*+g[d>>2]);g[b>>2]=+g[h>>2]*+g[j>>2];a=+g[b>>2];i=k;return +a}function fj(){var a=0;if(!(c[7632]|0))a=30572;else a=c[(fa()|0)+64>>2]|0;return a|0}function gj(a){a=+a;var b=0;b=(g[k>>2]=a,c[k>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;a=b?a+-8388608.0+8388608.0:a+8388608.0+-8388608.0;if(a==0.0)a=b?-0.0:0.0}return +a}function hj(a){a=+a;var b=0,d=0,e=0,f=0,g=0.0,i=0.0,j=0.0,l=0.0,m=0.0;h[k>>3]=a;d=c[k>>2]|0;b=c[k+4>>2]|0;e=(b|0)<0;do if(e|b>>>0<1048576){g=+N(+a);h[k>>3]=g;if((c[k>>2]|0)==0&(c[k+4>>2]|0)==0){a=-1.0/(a*a);break}if(e){a=(a-a)/0.0;break}else{h[k>>3]=a*18014398509481984.0;b=c[k+4>>2]|0;e=c[k>>2]|0;d=-1077;f=9;break}}else if(b>>>0<=2146435071)if((d|0)==0&0==0&(b|0)==1072693248)a=0.0;else{e=d;d=-1023;f=9}while(0);if((f|0)==9){f=b+614242|0;c[k>>2]=e;c[k+4>>2]=(f&1048575)+1072079006;j=+h[k>>3]+-1.0;i=j*(j*.5);l=j/(j+2.0);m=l*l;a=m*m;h[k>>3]=j-i;e=c[k+4>>2]|0;c[k>>2]=0;c[k+4>>2]=e;g=+h[k>>3];a=j-g-i+l*(i+(a*(a*(a*.15313837699209373+.22222198432149784)+.3999999999940942)+m*(a*(a*(a*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));m=g*.4342944818781689;i=+(d+(f>>>20)|0);l=i*.30102999566361177;j=l+m;a=j+(m+(l-j)+(a*.4342944818781689+(i*3.694239077158931e-13+(g+a)*2.5082946711645275e-11)))}return +a}function ij(a){a=+a;return ~~+gj(a)|0}function jj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;do if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;j=c[7644]|0;b=j>>>a;if(b&3|0){b=(b&1^1)+a|0;d=30616+(b<<1<<2)|0;e=d+8|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do if((d|0)!=(h|0)){if(h>>>0<(c[7648]|0)>>>0)ga();a=h+12|0;if((c[a>>2]|0)==(f|0)){c[a>>2]=d;c[e>>2]=h;break}else ga()}else c[7644]=j&~(1<>2]=L|3;L=f+L+4|0;c[L>>2]=c[L>>2]|1;L=g;return L|0}h=c[7646]|0;if(o>>>0>h>>>0){if(b|0){d=2<>>12&16;d=d>>>i;f=d>>>5&8;d=d>>>f;g=d>>>2&4;d=d>>>g;e=d>>>1&2;d=d>>>e;b=d>>>1&1;b=(f|i|g|e|b)+(d>>>b)|0;d=30616+(b<<1<<2)|0;e=d+8|0;g=c[e>>2]|0;i=g+8|0;f=c[i>>2]|0;do if((d|0)!=(f|0)){if(f>>>0<(c[7648]|0)>>>0)ga();a=f+12|0;if((c[a>>2]|0)==(g|0)){c[a>>2]=d;c[e>>2]=f;k=c[7646]|0;break}else ga()}else{c[7644]=j&~(1<>2]=o|3;e=g+o|0;c[e+4>>2]=h|1;c[e+h>>2]=h;if(k|0){f=c[7649]|0;b=k>>>3;d=30616+(b<<1<<2)|0;a=c[7644]|0;b=1<>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();else{l=a;m=b}}else{c[7644]=a|b;l=d+8|0;m=d}c[l>>2]=f;c[m+12>>2]=f;c[f+8>>2]=m;c[f+12>>2]=d}c[7646]=h;c[7649]=e;L=i;return L|0}a=c[7645]|0;if(a){d=(a&0-a)+-1|0;K=d>>>12&16;d=d>>>K;J=d>>>5&8;d=d>>>J;L=d>>>2&4;d=d>>>L;b=d>>>1&2;d=d>>>b;e=d>>>1&1;e=c[30880+((J|K|L|b|e)+(d>>>e)<<2)>>2]|0;d=(c[e+4>>2]&-8)-o|0;b=e;while(1){a=c[b+16>>2]|0;if(!a){a=c[b+20>>2]|0;if(!a){j=e;break}}b=(c[a+4>>2]&-8)-o|0;L=b>>>0>>0;d=L?b:d;b=a;e=L?a:e}g=c[7648]|0;if(j>>>0>>0)ga();i=j+o|0;if(j>>>0>=i>>>0)ga();h=c[j+24>>2]|0;e=c[j+12>>2]|0;do if((e|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){n=0;break}}while(1){e=a+20|0;f=c[e>>2]|0;if(f|0){a=f;b=e;continue}e=a+16|0;f=c[e>>2]|0;if(!f)break;else{a=f;b=e}}if(b>>>0>>0)ga();else{c[b>>2]=0;n=a;break}}else{f=c[j+8>>2]|0;if(f>>>0>>0)ga();a=f+12|0;if((c[a>>2]|0)!=(j|0))ga();b=e+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=e;c[b>>2]=f;n=e;break}else ga()}while(0);do if(h|0){a=c[j+28>>2]|0;b=30880+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[7645]=c[7645]&~(1<>>0<(c[7648]|0)>>>0)ga();a=h+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=n;else c[h+20>>2]=n;if(!n)break}b=c[7648]|0;if(n>>>0>>0)ga();c[n+24>>2]=h;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)ga();else{c[n+16>>2]=a;c[a+24>>2]=n;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[7648]|0)>>>0)ga();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}while(0);if(d>>>0<16){L=d+o|0;c[j+4>>2]=L|3;L=j+L+4|0;c[L>>2]=c[L>>2]|1}else{c[j+4>>2]=o|3;c[i+4>>2]=d|1;c[i+d>>2]=d;a=c[7646]|0;if(a|0){f=c[7649]|0;b=a>>>3;e=30616+(b<<1<<2)|0;a=c[7644]|0;b=1<>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();else{p=a;q=b}}else{c[7644]=a|b;p=e+8|0;q=e}c[p>>2]=f;c[q+12>>2]=f;c[f+8>>2]=q;c[f+12>>2]=e}c[7646]=d;c[7649]=i}L=j+8|0;return L|0}}}else if(a>>>0<=4294967231){a=a+11|0;o=a&-8;j=c[7645]|0;if(j){d=0-o|0;a=a>>>8;if(a)if(o>>>0>16777215)i=31;else{q=(a+1048320|0)>>>16&8;E=a<>>16&4;E=E<>>16&2;i=14-(p|q|i)+(E<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;b=c[30880+(i<<2)>>2]|0;a:do if(!b){a=0;b=0;E=86}else{f=d;a=0;g=o<<((i|0)==31?0:25-(i>>>1)|0);h=b;b=0;while(1){e=c[h+4>>2]&-8;d=e-o|0;if(d>>>0>>0)if((e|0)==(o|0)){a=h;b=h;E=90;break a}else b=h;else d=f;e=c[h+20>>2]|0;h=c[h+16+(g>>>31<<2)>>2]|0;a=(e|0)==0|(e|0)==(h|0)?a:e;e=(h|0)==0;if(e){E=86;break}else{f=d;g=g<<(e&1^1)}}}while(0);if((E|0)==86){if((a|0)==0&(b|0)==0){a=2<>>12&16;q=q>>>m;l=q>>>5&8;q=q>>>l;n=q>>>2&4;q=q>>>n;p=q>>>1&2;q=q>>>p;a=q>>>1&1;a=c[30880+((l|m|n|p|a)+(q>>>a)<<2)>>2]|0}if(!a){i=d;j=b}else E=90}if((E|0)==90)while(1){E=0;q=(c[a+4>>2]&-8)-o|0;e=q>>>0>>0;d=e?q:d;b=e?a:b;e=c[a+16>>2]|0;if(e|0){a=e;E=90;continue}a=c[a+20>>2]|0;if(!a){i=d;j=b;break}else E=90}if((j|0)!=0?i>>>0<((c[7646]|0)-o|0)>>>0:0){f=c[7648]|0;if(j>>>0>>0)ga();h=j+o|0;if(j>>>0>=h>>>0)ga();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){s=0;break}}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)ga();else{c[b>>2]=0;s=a;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)ga();a=e+12|0;if((c[a>>2]|0)!=(j|0))ga();b=d+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=d;c[b>>2]=e;s=d;break}else ga()}while(0);do if(g|0){a=c[j+28>>2]|0;b=30880+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=s;if(!s){c[7645]=c[7645]&~(1<>>0<(c[7648]|0)>>>0)ga();a=g+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=s;else c[g+20>>2]=s;if(!s)break}b=c[7648]|0;if(s>>>0>>0)ga();c[s+24>>2]=g;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)ga();else{c[s+16>>2]=a;c[a+24>>2]=s;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[7648]|0)>>>0)ga();else{c[s+20>>2]=a;c[a+24>>2]=s;break}}while(0);do if(i>>>0>=16){c[j+4>>2]=o|3;c[h+4>>2]=i|1;c[h+i>>2]=i;a=i>>>3;if(i>>>0<256){d=30616+(a<<1<<2)|0;b=c[7644]|0;a=1<>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();else{u=a;v=b}}else{c[7644]=b|a;u=d+8|0;v=d}c[u>>2]=h;c[v+12>>2]=h;c[h+8>>2]=v;c[h+12>>2]=d;break}a=i>>>8;if(a)if(i>>>0>16777215)d=31;else{K=(a+1048320|0)>>>16&8;L=a<>>16&4;L=L<>>16&2;d=14-(J|K|d)+(L<>>15)|0;d=i>>>(d+7|0)&1|d<<1}else d=0;e=30880+(d<<2)|0;c[h+28>>2]=d;a=h+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[7645]|0;b=1<>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}f=i<<((d|0)==31?0:25-(d>>>1)|0);a=c[e>>2]|0;while(1){if((c[a+4>>2]&-8|0)==(i|0)){d=a;E=148;break}b=a+16+(f>>>31<<2)|0;d=c[b>>2]|0;if(!d){E=145;break}else{f=f<<1;a=d}}if((E|0)==145)if(b>>>0<(c[7648]|0)>>>0)ga();else{c[b>>2]=h;c[h+24>>2]=a;c[h+12>>2]=h;c[h+8>>2]=h;break}else if((E|0)==148){a=d+8|0;b=c[a>>2]|0;L=c[7648]|0;if(b>>>0>=L>>>0&d>>>0>=L>>>0){c[b+12>>2]=h;c[a>>2]=h;c[h+8>>2]=b;c[h+12>>2]=d;c[h+24>>2]=0;break}else ga()}}else{L=i+o|0;c[j+4>>2]=L|3;L=j+L+4|0;c[L>>2]=c[L>>2]|1}while(0);L=j+8|0;return L|0}}}else o=-1;while(0);d=c[7646]|0;if(d>>>0>=o>>>0){a=d-o|0;b=c[7649]|0;if(a>>>0>15){L=b+o|0;c[7649]=L;c[7646]=a;c[L+4>>2]=a|1;c[L+a>>2]=a;c[b+4>>2]=o|3}else{c[7646]=0;c[7649]=0;c[b+4>>2]=d|3;L=b+d+4|0;c[L>>2]=c[L>>2]|1}L=b+8|0;return L|0}a=c[7647]|0;if(a>>>0>o>>>0){J=a-o|0;c[7647]=J;L=c[7650]|0;K=L+o|0;c[7650]=K;c[K+4>>2]=J|1;c[L+4>>2]=o|3;L=L+8|0;return L|0}do if(!(c[7762]|0)){a=oa(30)|0;if(!(a+-1&a)){c[7764]=a;c[7763]=a;c[7765]=-1;c[7766]=-1;c[7767]=0;c[7755]=0;c[7762]=(ka(0)|0)&-16^1431655768;break}else ga()}while(0);h=o+48|0;g=c[7764]|0;i=o+47|0;f=g+i|0;g=0-g|0;j=f&g;if(j>>>0<=o>>>0){L=0;return L|0}a=c[7754]|0;if(a|0?(u=c[7752]|0,v=u+j|0,v>>>0<=u>>>0|v>>>0>a>>>0):0){L=0;return L|0}b:do if(!(c[7755]&4)){a=c[7650]|0;c:do if(a){d=31024;while(1){b=c[d>>2]|0;if(b>>>0<=a>>>0?(r=d+4|0,(b+(c[r>>2]|0)|0)>>>0>a>>>0):0){e=d;d=r;break}d=c[d+8>>2]|0;if(!d){E=173;break c}}a=f-(c[7647]|0)&g;if(a>>>0<2147483647){b=ja(a|0)|0;if((b|0)==((c[e>>2]|0)+(c[d>>2]|0)|0)){if((b|0)!=(-1|0)){h=b;f=a;E=193;break b}}else E=183}}else E=173;while(0);do if((E|0)==173?(t=ja(0)|0,(t|0)!=(-1|0)):0){a=t;b=c[7763]|0;d=b+-1|0;if(!(d&a))a=j;else a=j-a+(d+a&0-b)|0;b=c[7752]|0;d=b+a|0;if(a>>>0>o>>>0&a>>>0<2147483647){v=c[7754]|0;if(v|0?d>>>0<=b>>>0|d>>>0>v>>>0:0)break;b=ja(a|0)|0;if((b|0)==(t|0)){h=t;f=a;E=193;break b}else E=183}}while(0);d:do if((E|0)==183){d=0-a|0;do if(h>>>0>a>>>0&(a>>>0<2147483647&(b|0)!=(-1|0))?(w=c[7764]|0,w=i-a+w&0-w,w>>>0<2147483647):0)if((ja(w|0)|0)==(-1|0)){ja(d|0)|0;break d}else{a=w+a|0;break}while(0);if((b|0)!=(-1|0)){h=b;f=a;E=193;break b}}while(0);c[7755]=c[7755]|4;E=190}else E=190;while(0);if((((E|0)==190?j>>>0<2147483647:0)?(x=ja(j|0)|0,y=ja(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(y|0)!=(-1|0))):0)?(z=y-x|0,z>>>0>(o+40|0)>>>0):0){h=x;f=z;E=193}if((E|0)==193){a=(c[7752]|0)+f|0;c[7752]=a;if(a>>>0>(c[7753]|0)>>>0)c[7753]=a;i=c[7650]|0;do if(i){e=31024;do{a=c[e>>2]|0;b=e+4|0;d=c[b>>2]|0;if((h|0)==(a+d|0)){A=a;B=b;C=d;D=e;E=203;break}e=c[e+8>>2]|0}while((e|0)!=0);if(((E|0)==203?(c[D+12>>2]&8|0)==0:0)?i>>>0>>0&i>>>0>=A>>>0:0){c[B>>2]=C+f;L=i+8|0;L=(L&7|0)==0?0:0-L&7;K=i+L|0;L=f-L+(c[7647]|0)|0;c[7650]=K;c[7647]=L;c[K+4>>2]=L|1;c[K+L+4>>2]=40;c[7651]=c[7766];break}a=c[7648]|0;if(h>>>0>>0){c[7648]=h;j=h}else j=a;d=h+f|0;a=31024;while(1){if((c[a>>2]|0)==(d|0)){b=a;E=211;break}a=c[a+8>>2]|0;if(!a){b=31024;break}}if((E|0)==211)if(!(c[a+12>>2]&8)){c[b>>2]=h;l=a+4|0;c[l>>2]=(c[l>>2]|0)+f;l=h+8|0;l=h+((l&7|0)==0?0:0-l&7)|0;a=d+8|0;a=d+((a&7|0)==0?0:0-a&7)|0;k=l+o|0;g=a-l-o|0;c[l+4>>2]=o|3;do if((a|0)!=(i|0)){if((a|0)==(c[7649]|0)){L=(c[7646]|0)+g|0;c[7646]=L;c[7649]=k;c[k+4>>2]=L|1;c[k+L>>2]=L;break}b=c[a+4>>2]|0;if((b&3|0)==1){i=b&-8;f=b>>>3;e:do if(b>>>0>=256){h=c[a+24>>2]|0;e=c[a+12>>2]|0;do if((e|0)==(a|0)){d=a+16|0;e=d+4|0;b=c[e>>2]|0;if(!b){b=c[d>>2]|0;if(!b){J=0;break}}else d=e;while(1){e=b+20|0;f=c[e>>2]|0;if(f|0){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0>>0)ga();else{c[d>>2]=0;J=b;break}}else{f=c[a+8>>2]|0;if(f>>>0>>0)ga();b=f+12|0;if((c[b>>2]|0)!=(a|0))ga();d=e+8|0;if((c[d>>2]|0)==(a|0)){c[b>>2]=e;c[d>>2]=f;J=e;break}else ga()}while(0);if(!h)break;b=c[a+28>>2]|0;d=30880+(b<<2)|0;do if((a|0)!=(c[d>>2]|0)){if(h>>>0<(c[7648]|0)>>>0)ga();b=h+16|0;if((c[b>>2]|0)==(a|0))c[b>>2]=J;else c[h+20>>2]=J;if(!J)break e}else{c[d>>2]=J;if(J|0)break;c[7645]=c[7645]&~(1<>>0>>0)ga();c[J+24>>2]=h;b=a+16|0;d=c[b>>2]|0;do if(d|0)if(d>>>0>>0)ga();else{c[J+16>>2]=d;c[d+24>>2]=J;break}while(0);b=c[b+4>>2]|0;if(!b)break;if(b>>>0<(c[7648]|0)>>>0)ga();else{c[J+20>>2]=b;c[b+24>>2]=J;break}}else{d=c[a+8>>2]|0;e=c[a+12>>2]|0;b=30616+(f<<1<<2)|0;do if((d|0)!=(b|0)){if(d>>>0>>0)ga();if((c[d+12>>2]|0)==(a|0))break;ga()}while(0);if((e|0)==(d|0)){c[7644]=c[7644]&~(1<>>0>>0)ga();b=e+8|0;if((c[b>>2]|0)==(a|0)){G=b;break}ga()}while(0);c[d+12>>2]=e;c[G>>2]=d}while(0);a=a+i|0;g=i+g|0}a=a+4|0;c[a>>2]=c[a>>2]&-2;c[k+4>>2]=g|1;c[k+g>>2]=g;a=g>>>3;if(g>>>0<256){d=30616+(a<<1<<2)|0;b=c[7644]|0;a=1<>2]|0;if(b>>>0>=(c[7648]|0)>>>0){K=a;L=b;break}ga()}while(0);c[K>>2]=k;c[L+12>>2]=k;c[k+8>>2]=L;c[k+12>>2]=d;break}a=g>>>8;do if(!a)d=0;else{if(g>>>0>16777215){d=31;break}K=(a+1048320|0)>>>16&8;L=a<>>16&4;L=L<>>16&2;d=14-(J|K|d)+(L<>>15)|0;d=g>>>(d+7|0)&1|d<<1}while(0);e=30880+(d<<2)|0;c[k+28>>2]=d;a=k+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[7645]|0;b=1<>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}f=g<<((d|0)==31?0:25-(d>>>1)|0);a=c[e>>2]|0;while(1){if((c[a+4>>2]&-8|0)==(g|0)){d=a;E=281;break}b=a+16+(f>>>31<<2)|0;d=c[b>>2]|0;if(!d){E=278;break}else{f=f<<1;a=d}}if((E|0)==278)if(b>>>0<(c[7648]|0)>>>0)ga();else{c[b>>2]=k;c[k+24>>2]=a;c[k+12>>2]=k;c[k+8>>2]=k;break}else if((E|0)==281){a=d+8|0;b=c[a>>2]|0;L=c[7648]|0;if(b>>>0>=L>>>0&d>>>0>=L>>>0){c[b+12>>2]=k;c[a>>2]=k;c[k+8>>2]=b;c[k+12>>2]=d;c[k+24>>2]=0;break}else ga()}}else{L=(c[7647]|0)+g|0;c[7647]=L;c[7650]=k;c[k+4>>2]=L|1}while(0);L=l+8|0;return L|0}else b=31024;while(1){a=c[b>>2]|0;if(a>>>0<=i>>>0?(F=a+(c[b+4>>2]|0)|0,F>>>0>i>>>0):0){b=F;break}b=c[b+8>>2]|0}g=b+-47|0;d=g+8|0;d=g+((d&7|0)==0?0:0-d&7)|0;g=i+16|0;d=d>>>0>>0?i:d;a=d+8|0;e=h+8|0;e=(e&7|0)==0?0:0-e&7;L=h+e|0;e=f+-40-e|0;c[7650]=L;c[7647]=e;c[L+4>>2]=e|1;c[L+e+4>>2]=40;c[7651]=c[7766];e=d+4|0;c[e>>2]=27;c[a>>2]=c[7756];c[a+4>>2]=c[7757];c[a+8>>2]=c[7758];c[a+12>>2]=c[7759];c[7756]=h;c[7757]=f;c[7759]=0;c[7758]=a;a=d+24|0;do{a=a+4|0;c[a>>2]=7}while((a+4|0)>>>0>>0);if((d|0)!=(i|0)){h=d-i|0;c[e>>2]=c[e>>2]&-2;c[i+4>>2]=h|1;c[d>>2]=h;a=h>>>3;if(h>>>0<256){d=30616+(a<<1<<2)|0;b=c[7644]|0;a=1<>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();else{H=a;I=b}}else{c[7644]=b|a;H=d+8|0;I=d}c[H>>2]=i;c[I+12>>2]=i;c[i+8>>2]=I;c[i+12>>2]=d;break}a=h>>>8;if(a)if(h>>>0>16777215)d=31;else{K=(a+1048320|0)>>>16&8;L=a<>>16&4;L=L<>>16&2;d=14-(J|K|d)+(L<>>15)|0;d=h>>>(d+7|0)&1|d<<1}else d=0;f=30880+(d<<2)|0;c[i+28>>2]=d;c[i+20>>2]=0;c[g>>2]=0;a=c[7645]|0;b=1<>2]=i;c[i+24>>2]=f;c[i+12>>2]=i;c[i+8>>2]=i;break}e=h<<((d|0)==31?0:25-(d>>>1)|0);a=c[f>>2]|0;while(1){if((c[a+4>>2]&-8|0)==(h|0)){d=a;E=307;break}b=a+16+(e>>>31<<2)|0;d=c[b>>2]|0;if(!d){E=304;break}else{e=e<<1;a=d}}if((E|0)==304)if(b>>>0<(c[7648]|0)>>>0)ga();else{c[b>>2]=i;c[i+24>>2]=a;c[i+12>>2]=i;c[i+8>>2]=i;break}else if((E|0)==307){a=d+8|0;b=c[a>>2]|0;L=c[7648]|0;if(b>>>0>=L>>>0&d>>>0>=L>>>0){c[b+12>>2]=i;c[a>>2]=i;c[i+8>>2]=b;c[i+12>>2]=d;c[i+24>>2]=0;break}else ga()}}}else{L=c[7648]|0;if((L|0)==0|h>>>0>>0)c[7648]=h;c[7756]=h;c[7757]=f;c[7759]=0;c[7653]=c[7762];c[7652]=-1;a=0;do{L=30616+(a<<1<<2)|0;c[L+12>>2]=L;c[L+8>>2]=L;a=a+1|0}while((a|0)!=32);L=h+8|0;L=(L&7|0)==0?0:0-L&7;K=h+L|0;L=f+-40-L|0;c[7650]=K;c[7647]=L;c[K+4>>2]=L|1;c[K+L+4>>2]=40;c[7651]=c[7766]}while(0);a=c[7647]|0;if(a>>>0>o>>>0){J=a-o|0;c[7647]=J;L=c[7650]|0;K=L+o|0;c[7650]=K;c[K+4>>2]=J|1;c[L+4>>2]=o|3;L=L+8|0;return L|0}}c[(fj()|0)>>2]=12;L=0;return L|0}function kj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!a)return;d=a+-8|0;h=c[7648]|0;if(d>>>0>>0)ga();a=c[a+-4>>2]|0;b=a&3;if((b|0)==1)ga();e=a&-8;m=d+e|0;do if(!(a&1)){a=c[d>>2]|0;if(!b)return;k=d+(0-a)|0;j=a+e|0;if(k>>>0>>0)ga();if((k|0)==(c[7649]|0)){a=m+4|0;b=c[a>>2]|0;if((b&3|0)!=3){q=k;g=j;break}c[7646]=j;c[a>>2]=b&-2;c[k+4>>2]=j|1;c[k+j>>2]=j;return}e=a>>>3;if(a>>>0<256){b=c[k+8>>2]|0;d=c[k+12>>2]|0;a=30616+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0>>0)ga();if((c[b+12>>2]|0)!=(k|0))ga()}if((d|0)==(b|0)){c[7644]=c[7644]&~(1<>>0>>0)ga();a=d+8|0;if((c[a>>2]|0)==(k|0))f=a;else ga()}else f=d+8|0;c[b+12>>2]=d;c[f>>2]=b;q=k;g=j;break}f=c[k+24>>2]|0;d=c[k+12>>2]|0;do if((d|0)==(k|0)){b=k+16|0;d=b+4|0;a=c[d>>2]|0;if(!a){a=c[b>>2]|0;if(!a){i=0;break}}else b=d;while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)ga();else{c[b>>2]=0;i=a;break}}else{e=c[k+8>>2]|0;if(e>>>0>>0)ga();a=e+12|0;if((c[a>>2]|0)!=(k|0))ga();b=d+8|0;if((c[b>>2]|0)==(k|0)){c[a>>2]=d;c[b>>2]=e;i=d;break}else ga()}while(0);if(f){a=c[k+28>>2]|0;b=30880+(a<<2)|0;if((k|0)==(c[b>>2]|0)){c[b>>2]=i;if(!i){c[7645]=c[7645]&~(1<>>0<(c[7648]|0)>>>0)ga();a=f+16|0;if((c[a>>2]|0)==(k|0))c[a>>2]=i;else c[f+20>>2]=i;if(!i){q=k;g=j;break}}d=c[7648]|0;if(i>>>0>>0)ga();c[i+24>>2]=f;a=k+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)ga();else{c[i+16>>2]=b;c[b+24>>2]=i;break}while(0);a=c[a+4>>2]|0;if(a)if(a>>>0<(c[7648]|0)>>>0)ga();else{c[i+20>>2]=a;c[a+24>>2]=i;q=k;g=j;break}else{q=k;g=j}}else{q=k;g=j}}else{q=d;g=e}while(0);if(q>>>0>=m>>>0)ga();a=m+4|0;b=c[a>>2]|0;if(!(b&1))ga();if(!(b&2)){if((m|0)==(c[7650]|0)){p=(c[7647]|0)+g|0;c[7647]=p;c[7650]=q;c[q+4>>2]=p|1;if((q|0)!=(c[7649]|0))return;c[7649]=0;c[7646]=0;return}if((m|0)==(c[7649]|0)){p=(c[7646]|0)+g|0;c[7646]=p;c[7649]=q;c[q+4>>2]=p|1;c[q+p>>2]=p;return}g=(b&-8)+g|0;e=b>>>3;do if(b>>>0>=256){f=c[m+24>>2]|0;a=c[m+12>>2]|0;do if((a|0)==(m|0)){b=m+16|0;d=b+4|0;a=c[d>>2]|0;if(!a){a=c[b>>2]|0;if(!a){n=0;break}}else b=d;while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0<(c[7648]|0)>>>0)ga();else{c[b>>2]=0;n=a;break}}else{b=c[m+8>>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();d=b+12|0;if((c[d>>2]|0)!=(m|0))ga();e=a+8|0;if((c[e>>2]|0)==(m|0)){c[d>>2]=a;c[e>>2]=b;n=a;break}else ga()}while(0);if(f|0){a=c[m+28>>2]|0;b=30880+(a<<2)|0;if((m|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[7645]=c[7645]&~(1<>>0<(c[7648]|0)>>>0)ga();a=f+16|0;if((c[a>>2]|0)==(m|0))c[a>>2]=n;else c[f+20>>2]=n;if(!n)break}d=c[7648]|0;if(n>>>0>>0)ga();c[n+24>>2]=f;a=m+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)ga();else{c[n+16>>2]=b;c[b+24>>2]=n;break}while(0);a=c[a+4>>2]|0;if(a|0)if(a>>>0<(c[7648]|0)>>>0)ga();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}}else{b=c[m+8>>2]|0;d=c[m+12>>2]|0;a=30616+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0<(c[7648]|0)>>>0)ga();if((c[b+12>>2]|0)!=(m|0))ga()}if((d|0)==(b|0)){c[7644]=c[7644]&~(1<>>0<(c[7648]|0)>>>0)ga();a=d+8|0;if((c[a>>2]|0)==(m|0))l=a;else ga()}else l=d+8|0;c[b+12>>2]=d;c[l>>2]=b}while(0);c[q+4>>2]=g|1;c[q+g>>2]=g;if((q|0)==(c[7649]|0)){c[7646]=g;return}}else{c[a>>2]=b&-2;c[q+4>>2]=g|1;c[q+g>>2]=g}a=g>>>3;if(g>>>0<256){d=30616+(a<<1<<2)|0;b=c[7644]|0;a=1<>2]|0;if(b>>>0<(c[7648]|0)>>>0)ga();else{o=a;p=b}}else{c[7644]=b|a;o=d+8|0;p=d}c[o>>2]=q;c[p+12>>2]=q;c[q+8>>2]=p;c[q+12>>2]=d;return}a=g>>>8;if(a)if(g>>>0>16777215)d=31;else{o=(a+1048320|0)>>>16&8;p=a<>>16&4;p=p<>>16&2;d=14-(n|o|d)+(p<>>15)|0;d=g>>>(d+7|0)&1|d<<1}else d=0;e=30880+(d<<2)|0;c[q+28>>2]=d;c[q+20>>2]=0;c[q+16>>2]=0;a=c[7645]|0;b=1<>>1)|0);a=c[e>>2]|0;while(1){if((c[a+4>>2]&-8|0)==(g|0)){d=a;e=130;break}b=a+16+(f>>>31<<2)|0;d=c[b>>2]|0;if(!d){e=127;break}else{f=f<<1;a=d}}if((e|0)==127)if(b>>>0<(c[7648]|0)>>>0)ga();else{c[b>>2]=q;c[q+24>>2]=a;c[q+12>>2]=q;c[q+8>>2]=q;break}else if((e|0)==130){a=d+8|0;b=c[a>>2]|0;p=c[7648]|0;if(b>>>0>=p>>>0&d>>>0>=p>>>0){c[b+12>>2]=q;c[a>>2]=q;c[q+8>>2]=b;c[q+12>>2]=d;c[q+24>>2]=0;break}else ga()}}else{c[7645]=a|b;c[e>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q}while(0);q=(c[7652]|0)+-1|0;c[7652]=q;if(!q)a=31032;else return;while(1){a=c[a>>2]|0;if(!a)break;else a=a+8|0}c[7652]=-1;return}function lj(){}function mj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return (C=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function nj(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>c;return a>>>c|(b&(1<>c-32|0}function oj(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;h=b&3;i=d|d<<8|d<<16|d<<24;g=f&~3;if(h){h=b+4-h|0;while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function pj(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return ma(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function qj(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else pj(b,c,d)|0;return b|0}function rj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (C=d,a-c>>>0|0)|0}function sj(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b<>>32-c;return a<>>c;return a>>>c|(b&(1<>>c-32|0}function uj(b){b=b|0;var c=0;c=a[m+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[m+(b>>>24)>>0]|0)+24|0}function vj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=_(e,f)|0;d=a>>>16;a=(c>>>16)+(_(e,d)|0)|0;e=b>>>16;b=_(e,f)|0;return (C=(a>>>16)+(_(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function wj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=rj(j^a|0,i^b|0,j|0,i|0)|0;g=C;a=f^j;b=e^i;return rj((Bj(h,g,rj(f^c|0,e^d|0,f|0,e|0)|0,C,0)|0)^a|0,C^b|0,a|0,b|0)|0}function xj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+16|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=rj(h^a|0,g^b|0,h|0,g|0)|0;b=C;Bj(a,b,rj(l^d|0,k^e|0,l|0,k|0)|0,C,j)|0;e=rj(c[j>>2]^h|0,c[j+4>>2]^g|0,h|0,g|0)|0;d=C;i=f;return (C=d,e)|0}function yj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=vj(e,f)|0;a=C;return (C=(_(b,f)|0)+(_(d,e)|0)+a|a&0,c|0|0)|0}function zj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Bj(a,b,c,d,0)|0}function Aj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+16|0;f=g|0;Bj(a,b,d,e,f)|0;i=g;return (C=c[f+4>>2]|0,c[f>>2]|0)|0}function Bj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return (C=n,f)|0}else{if(!g){n=0;f=0;return (C=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return (C=n,f)|0}}g=(i|0)==0;do if(h){if(!g){g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return (C=n,f)|0}g=h-1|0;if(g&h|0){i=(aa(h|0)|0)+33-(aa(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f|0){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return (C=o,p)|0}else{p=uj(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return (C=o,p)|0}}else{if(g){if(f|0){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return (C=o,p)|0}if(!l){if(f|0){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return (C=o,p)|0}g=i-1|0;if(!(g&i)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>((uj(i|0)|0)>>>0);return (C=o,p)|0}g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return (C=o,p)|0}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=mj(m|0,l|0,-1,-1)|0;d=C;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;rj(k|0,d|0,e|0,n|0)|0;p=C;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=rj(e|0,n|0,o&m|0,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l|0)|0;b=C;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f|0){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return (C=o,p)|0}function Cj(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;qa[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Dj(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ba(0)} + + // EMSCRIPTEN_END_FUNCS + var qa=[Dj,yi,xi,Dj];return{_opus_decoder_get_size:ai,_opus_get_version_string:gb,_free:kj,_opus_encode_float:Ri,_opus_strerror:fb,_i64Add:mj,_memmove:qj,_opus_decoder_init:ci,_bitshift64Ashr:nj,_opus_encoder_get_size:ti,_memset:oj,_malloc:jj,_opus_decoder_ctl:si,_opus_encode:Qi,_opus_encoder_init:vi,_opus_decode:mi,_opus_packet_get_nb_samples:oi,_memcpy:pj,_opus_encoder_ctl:Si,_opus_decode_float:ri,runPostSets:lj,stackAlloc:ra,stackSave:sa,stackRestore:ta,establishStackSpace:ua,setThrew:va,setTempRet0:ya,getTempRet0:za,dynCall_viiiiiii:Cj}}) + + + // EMSCRIPTEN_END_ASM + (b.s,b.t,buffer);b._opus_decoder_get_size=Z._opus_decoder_get_size;b._opus_get_version_string=Z._opus_get_version_string;var va=b._free=Z._free; + b._opus_encode_float=Z._opus_encode_float;b._opus_strerror=Z._opus_strerror;var Pa=b._i64Add=Z._i64Add,Ua=b._memmove=Z._memmove;b._opus_decoder_init=Z._opus_decoder_init;var Qa=b._bitshift64Ashr=Z._bitshift64Ashr;b._opus_encoder_get_size=Z._opus_encoder_get_size;var Ra=b._memset=Z._memset,Q=b._malloc=Z._malloc;b._opus_packet_get_nb_samples=Z._opus_packet_get_nb_samples;b._opus_encode=Z._opus_encode;b._opus_encoder_init=Z._opus_encoder_init;b._opus_decode=Z._opus_decode;b._opus_decoder_ctl=Z._opus_decoder_ctl; + var Sa=b._memcpy=Z._memcpy;b._opus_encoder_ctl=Z._opus_encoder_ctl;b._opus_decode_float=Z._opus_decode_float;b.runPostSets=Z.runPostSets;b.dynCall_viiiiiii=Z.dynCall_viiiiiii;y.f=Z.stackAlloc;y.g=Z.stackSave;y.c=Z.stackRestore;y.I=Z.establishStackSpace;y.B=Z.setTempRet0;y.w=Z.getTempRet0;function w(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}w.prototype=Error();w.prototype.constructor=w;var Wa=null,X=function Xa(){b.calledRun||Ya();b.calledRun||(X=Xa)}; + b.callMain=b.G=function(a){function c(){for(var a=0;3>a;a++)e.push(0)}a=a||[];T||(T=!0,V(Ea));var d=a.length+1,e=[O(Ka(b.thisProgram),"i8",0)];c();for(var g=0;g> 1) + i] = pcmData[i]; + } + + // 为Opus编码数据分配内存 + const maxEncodedSize = this.maxPacketSize; + const encodedPtr = mod._malloc(maxEncodedSize); + + // 编码 + const encodedBytes = mod._opus_encode( + this.encoderPtr, + pcmPtr, + this.frameSize, + encodedPtr, + maxEncodedSize + ); + + if (encodedBytes < 0) { + mod._free(pcmPtr); + mod._free(encodedPtr); + throw new Error(`Opus编码失败: ${encodedBytes}`); + } + + // 复制编码后的数据 + const encodedData = new Uint8Array(encodedBytes); + for (let i = 0; i < encodedBytes; i++) { + encodedData[i] = mod.HEAPU8[encodedPtr + i]; + } + + // 释放内存 + mod._free(pcmPtr); + mod._free(encodedPtr); + + return encodedData; + }, + + // 销毁方法 + destroy: function() { + if (this.encoderPtr) { + this.module._free(this.encoderPtr); + this.encoderPtr = null; + } + } + }; + + // 创建解码器 + opusDecoder = { + channels: CHANNELS, + rate: SAMPLE_RATE, + frameSize: FRAME_SIZE, + module: mod, + + // 初始化解码器 + init: function() { + // 获取解码器大小 + const decoderSize = mod._opus_decoder_get_size(this.channels); + console.log(`Opus解码器大小: ${decoderSize}字节`); + + // 分配内存 + this.decoderPtr = mod._malloc(decoderSize); + if (!this.decoderPtr) { + throw new Error("无法分配解码器内存"); + } + + // 初始化解码器 + const err = mod._opus_decoder_init( + this.decoderPtr, + this.rate, + this.channels + ); + + if (err < 0) { + throw new Error(`Opus解码器初始化失败: ${err}`); + } + + return true; + }, + + // 解码方法 + decode: function(opusData) { + const mod = this.module; + + // 为Opus数据分配内存 + const opusPtr = mod._malloc(opusData.length); + mod.HEAPU8.set(opusData, opusPtr); + + // 为PCM输出分配内存 + const pcmPtr = mod._malloc(this.frameSize * 2); // Int16 = 2字节 + + // 解码 + const decodedSamples = mod._opus_decode( + this.decoderPtr, + opusPtr, + opusData.length, + pcmPtr, + this.frameSize, + 0 // 不使用FEC + ); + + if (decodedSamples < 0) { + mod._free(opusPtr); + mod._free(pcmPtr); + throw new Error(`Opus解码失败: ${decodedSamples}`); + } + + // 复制解码后的数据 + const decodedData = new Int16Array(decodedSamples); + for (let i = 0; i < decodedSamples; i++) { + decodedData[i] = mod.HEAP16[(pcmPtr >> 1) + i]; + } + + // 释放内存 + mod._free(opusPtr); + mod._free(pcmPtr); + + return decodedData; + }, + + // 销毁方法 + destroy: function() { + if (this.decoderPtr) { + this.module._free(this.decoderPtr); + this.decoderPtr = null; + } + } + }; + + // 初始化编码器和解码器 + if (opusEncoder.init() && opusDecoder.init()) { + console.log("Opus 编码器和解码器初始化成功。"); + return true; + } else { + console.error("Opus 初始化失败"); + return false; + } + } catch (error) { + console.error("Opus 初始化失败:", error); + return false; + } +} + +// 将Float32音频数据转换为Int16音频数据 +function convertFloat32ToInt16(float32Data) { + const int16Data = new Int16Array(float32Data.length); + for (let i = 0; i < float32Data.length; i++) { + // 将[-1,1]范围转换为[-32768,32767] + const s = Math.max(-1, Math.min(1, float32Data[i])); + int16Data[i] = s < 0 ? s * 0x8000 : s * 0x7FFF; + } + return int16Data; +} + +// 将Int16音频数据转换为Float32音频数据 +function convertInt16ToFloat32(int16Data) { + const float32Data = new Float32Array(int16Data.length); + for (let i = 0; i < int16Data.length; i++) { + // 将[-32768,32767]范围转换为[-1,1] + float32Data[i] = int16Data[i] / (int16Data[i] < 0 ? 0x8000 : 0x7FFF); + } + return float32Data; +} + +function startRecording() { + if (isRecording) return; + + // 确保有权限并且AudioContext是活跃的 + if (audioContext.state === 'suspended') { + audioContext.resume().then(() => { + console.log("AudioContext已恢复"); + continueStartRecording(); + }).catch(err => { + console.error("恢复AudioContext失败:", err); + statusLabel.textContent = "无法激活音频上下文,请再次点击"; + }); + } else { + continueStartRecording(); + } +} + +// 实际开始录音的逻辑 +function continueStartRecording() { + // 重置录音数据 + recordedPcmData = []; + recordedOpusData = []; + window.audioDataBuffer = new Int16Array(0); // 重置缓冲区 + + // 初始化Opus + initOpus().then(success => { + if (!success) { + statusLabel.textContent = "Opus初始化失败"; + return; + } + + console.log("开始录音,参数:", { + sampleRate: SAMPLE_RATE, + channels: CHANNELS, + frameSize: FRAME_SIZE, + bufferSize: BUFFER_SIZE + }); + + // 请求麦克风权限 + navigator.mediaDevices.getUserMedia({ + audio: { + sampleRate: SAMPLE_RATE, + channelCount: CHANNELS, + echoCancellation: true, + noiseSuppression: true, + autoGainControl: true + } + }) + .then(stream => { + console.log("获取到麦克风流,实际参数:", stream.getAudioTracks()[0].getSettings()); + + // 检查流是否有效 + if (!stream || !stream.getAudioTracks().length || !stream.getAudioTracks()[0].enabled) { + throw new Error("获取到的音频流无效"); + } + + mediaStream = stream; + mediaSource = audioContext.createMediaStreamSource(stream); + + // 创建ScriptProcessor(虽然已弃用,但兼容性好) + // 在降级到ScriptProcessor之前尝试使用AudioWorklet + createAudioProcessor().then(processor => { + if (processor) { + console.log("使用AudioWorklet处理音频"); + audioProcessor = processor; + // 连接音频处理链 + mediaSource.connect(audioProcessor); + audioProcessor.connect(audioContext.destination); + } else { + console.log("回退到ScriptProcessor"); + // 创建ScriptProcessor节点 + audioProcessor = audioContext.createScriptProcessor(BUFFER_SIZE, CHANNELS, CHANNELS); + + // 处理音频数据 + audioProcessor.onaudioprocess = processAudioData; + + // 连接音频处理链 + mediaSource.connect(audioProcessor); + audioProcessor.connect(audioContext.destination); + } + + // 更新UI + isRecording = true; + statusLabel.textContent = "录音中..."; + startButton.disabled = true; + stopButton.disabled = false; + playButton.disabled = true; + }).catch(error => { + console.error("创建音频处理器失败:", error); + statusLabel.textContent = "创建音频处理器失败"; + }); + }) + .catch(error => { + console.error("获取麦克风失败:", error); + statusLabel.textContent = "获取麦克风失败: " + error.message; + }); + }); +} + +// 创建AudioWorklet处理器 +async function createAudioProcessor() { + try { + // 尝试使用更现代的AudioWorklet API + if ('AudioWorklet' in window && 'AudioWorkletNode' in window) { + // 定义AudioWorklet处理器代码 + const workletCode = ` + class OpusRecorderProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.buffers = []; + this.frameSize = ${FRAME_SIZE}; + this.buffer = new Float32Array(this.frameSize); + this.bufferIndex = 0; + this.isRecording = false; + + this.port.onmessage = (event) => { + if (event.data.command === 'start') { + this.isRecording = true; + } else if (event.data.command === 'stop') { + this.isRecording = false; + // 发送最后的缓冲区 + if (this.bufferIndex > 0) { + const finalBuffer = this.buffer.slice(0, this.bufferIndex); + this.port.postMessage({ buffer: finalBuffer }); + } + } + }; + } + + process(inputs, outputs) { + if (!this.isRecording) return true; + + // 获取输入数据 + const input = inputs[0][0]; // mono channel + if (!input || input.length === 0) return true; + + // 将输入数据添加到缓冲区 + for (let i = 0; i < input.length; i++) { + this.buffer[this.bufferIndex++] = input[i]; + + // 当缓冲区填满时,发送给主线程 + if (this.bufferIndex >= this.frameSize) { + this.port.postMessage({ buffer: this.buffer.slice() }); + this.bufferIndex = 0; + } + } + + return true; + } + } + + registerProcessor('opus-recorder-processor', OpusRecorderProcessor); + `; + + // 创建Blob URL + const blob = new Blob([workletCode], { type: 'application/javascript' }); + const url = URL.createObjectURL(blob); + + // 加载AudioWorklet模块 + await audioContext.audioWorklet.addModule(url); + + // 创建AudioWorkletNode + const workletNode = new AudioWorkletNode(audioContext, 'opus-recorder-processor'); + + // 处理从AudioWorklet接收的消息 + workletNode.port.onmessage = (event) => { + if (event.data.buffer) { + // 使用与ScriptProcessor相同的处理逻辑 + processAudioData({ + inputBuffer: { + getChannelData: () => event.data.buffer + } + }); + } + }; + + // 启动录音 + workletNode.port.postMessage({ command: 'start' }); + + // 保存停止函数 + workletNode.stopRecording = () => { + workletNode.port.postMessage({ command: 'stop' }); + }; + + console.log("AudioWorklet 音频处理器创建成功"); + return workletNode; + } + } catch (error) { + console.error("创建AudioWorklet失败,将使用ScriptProcessor:", error); + } + + // 如果AudioWorklet不可用或失败,返回null以便回退到ScriptProcessor + return null; +} + +// 处理音频数据 +function processAudioData(e) { + // 获取输入缓冲区 + const inputBuffer = e.inputBuffer; + + // 获取第一个通道的Float32数据 + const inputData = inputBuffer.getChannelData(0); + + // 添加调试信息 + const nonZeroCount = Array.from(inputData).filter(x => Math.abs(x) > 0.001).length; + console.log(`接收到音频数据: ${inputData.length} 个样本, 非零样本数: ${nonZeroCount}`); + + // 如果全是0,可能是麦克风没有正确获取声音 + if (nonZeroCount < 5) { + console.warn("警告: 检测到大量静音样本,请检查麦克风是否正常工作"); + // 继续处理,以防有些样本确实是静音 + } + + // 存储PCM数据用于调试 + recordedPcmData.push(new Float32Array(inputData)); + + // 转换为Int16数据供Opus编码 + const int16Data = convertFloat32ToInt16(inputData); + + // 如果收集到的数据不是FRAME_SIZE的整数倍,需要进行处理 + // 创建静态缓冲区来存储不足一帧的数据 + if (!window.audioDataBuffer) { + window.audioDataBuffer = new Int16Array(0); + } + + // 合并之前缓存的数据和新数据 + const combinedData = new Int16Array(window.audioDataBuffer.length + int16Data.length); + combinedData.set(window.audioDataBuffer); + combinedData.set(int16Data, window.audioDataBuffer.length); + + // 处理完整帧 + const frameCount = Math.floor(combinedData.length / FRAME_SIZE); + console.log(`可编码的完整帧数: ${frameCount}, 缓冲区总大小: ${combinedData.length}`); + + for (let i = 0; i < frameCount; i++) { + const frameData = combinedData.subarray(i * FRAME_SIZE, (i + 1) * FRAME_SIZE); + + try { + console.log(`编码第 ${i+1}/${frameCount} 帧, 帧大小: ${frameData.length}`); + const encodedData = opusEncoder.encode(frameData); + if (encodedData) { + console.log(`编码成功: ${encodedData.length} 字节`); + recordedOpusData.push(encodedData); + } + } catch (error) { + console.error(`Opus编码帧 ${i+1} 失败:`, error); + } + } + + // 保存剩余不足一帧的数据 + const remainingSamples = combinedData.length % FRAME_SIZE; + if (remainingSamples > 0) { + window.audioDataBuffer = combinedData.subarray(frameCount * FRAME_SIZE); + console.log(`保留 ${remainingSamples} 个样本到下一次处理`); + } else { + window.audioDataBuffer = new Int16Array(0); + } +} + +function stopRecording() { + if (!isRecording) return; + + // 处理剩余的缓冲数据 + if (window.audioDataBuffer && window.audioDataBuffer.length > 0) { + console.log(`停止录音,处理剩余的 ${window.audioDataBuffer.length} 个样本`); + // 如果剩余数据不足一帧,可以通过补零的方式凑成一帧 + if (window.audioDataBuffer.length < FRAME_SIZE) { + const paddedFrame = new Int16Array(FRAME_SIZE); + paddedFrame.set(window.audioDataBuffer); + // 剩余部分填充为0 + for (let i = window.audioDataBuffer.length; i < FRAME_SIZE; i++) { + paddedFrame[i] = 0; + } + try { + console.log(`编码最后一帧(补零): ${paddedFrame.length} 样本`); + const encodedData = opusEncoder.encode(paddedFrame); + if (encodedData) { + recordedOpusData.push(encodedData); + } + } catch (error) { + console.error("最后一帧Opus编码失败:", error); + } + } else { + // 如果数据超过一帧,按正常流程处理 + processAudioData({ + inputBuffer: { + getChannelData: () => convertInt16ToFloat32(window.audioDataBuffer) + } + }); + } + window.audioDataBuffer = null; + } + + // 如果使用的是AudioWorklet,调用其特定的停止方法 + if (audioProcessor && typeof audioProcessor.stopRecording === 'function') { + audioProcessor.stopRecording(); + } + + // 停止麦克风 + if (mediaStream) { + mediaStream.getTracks().forEach(track => track.stop()); + } + + // 断开音频处理链 + if (audioProcessor) { + try { + audioProcessor.disconnect(); + if (mediaSource) mediaSource.disconnect(); + } catch (error) { + console.warn("断开音频处理链时出错:", error); + } + } + + // 更新UI + isRecording = false; + statusLabel.textContent = "已停止录音,收集了 " + recordedOpusData.length + " 帧Opus数据"; + startButton.disabled = false; + stopButton.disabled = true; + playButton.disabled = recordedOpusData.length === 0; + + console.log("录制完成:", + "PCM帧数:", recordedPcmData.length, + "Opus帧数:", recordedOpusData.length); +} + +function playRecording() { + if (!recordedOpusData.length) { + statusLabel.textContent = "没有可播放的录音"; + return; + } + + // 将所有Opus数据解码为PCM + let allDecodedData = []; + + for (const opusData of recordedOpusData) { + try { + // 解码为Int16数据 + const decodedData = opusDecoder.decode(opusData); + + if (decodedData && decodedData.length > 0) { + // 将Int16数据转换为Float32 + const float32Data = convertInt16ToFloat32(decodedData); + + // 添加到总解码数据中 + allDecodedData.push(...float32Data); + } + } catch (error) { + console.error("Opus解码失败:", error); + } + } + + // 如果没有解码出数据,返回 + if (allDecodedData.length === 0) { + statusLabel.textContent = "解码失败,无法播放"; + return; + } + + // 创建音频缓冲区 + const audioBuffer = audioContext.createBuffer(CHANNELS, allDecodedData.length, SAMPLE_RATE); + audioBuffer.copyToChannel(new Float32Array(allDecodedData), 0); + + // 创建音频源并播放 + const source = audioContext.createBufferSource(); + source.buffer = audioBuffer; + source.connect(audioContext.destination); + source.start(); + + // 更新UI + statusLabel.textContent = "正在播放..."; + playButton.disabled = true; + + // 播放结束后恢复UI + source.onended = () => { + statusLabel.textContent = "播放完毕"; + playButton.disabled = false; + }; +} + +// 模拟服务端返回的Opus数据进行解码播放 +function playOpusFromServer(opusData) { + // 这个函数展示如何处理服务端返回的opus数据 + // opusData应该是一个包含opus帧的数组 + + if (!opusDecoder) { + initOpus().then(success => { + if (success) { + decodeAndPlayOpusData(opusData); + } else { + statusLabel.textContent = "Opus解码器初始化失败"; + } + }); + } else { + decodeAndPlayOpusData(opusData); + } +} + +function decodeAndPlayOpusData(opusData) { + let allDecodedData = []; + + for (const frame of opusData) { + try { + const decodedData = opusDecoder.decode(frame); + if (decodedData && decodedData.length > 0) { + const float32Data = convertInt16ToFloat32(decodedData); + allDecodedData.push(...float32Data); + } + } catch (error) { + console.error("服务端Opus数据解码失败:", error); + } + } + + if (allDecodedData.length === 0) { + statusLabel.textContent = "服务端数据解码失败"; + return; + } + + const audioBuffer = audioContext.createBuffer(CHANNELS, allDecodedData.length, SAMPLE_RATE); + audioBuffer.copyToChannel(new Float32Array(allDecodedData), 0); + + const source = audioContext.createBufferSource(); + source.buffer = audioBuffer; + source.connect(audioContext.destination); + source.start(); + + statusLabel.textContent = "正在播放服务端数据..."; + source.onended = () => statusLabel.textContent = "服务端数据播放完毕"; +} diff --git a/main/xiaozhi-server/test/opus_test/test.html b/main/xiaozhi-server/test/opus_test/test.html new file mode 100644 index 000000000..77d5c73b9 --- /dev/null +++ b/main/xiaozhi-server/test/opus_test/test.html @@ -0,0 +1,464 @@ + + + + + Opus 编解码测试 + + + +
+

Opus 编解码录音播放测试

+ +
正在加载Opus库...
+ +
+ + +

+ + + +

录音状态: 待机,正在初始化...

+ +
+ +
+
+ + + + + + + diff --git a/main/xiaozhi-server/test/test_page.html b/main/xiaozhi-server/test/test_page.html new file mode 100644 index 000000000..d9b2eff62 --- /dev/null +++ b/main/xiaozhi-server/test/test_page.html @@ -0,0 +1,2433 @@ + + + + + + + 小智服务器测试页面 + + + + +
+

小智服务器测试页面

+ +
+ 正在加载Opus库...
+ + +
+

+ 设备配置 + + MAC: + 客户端: web_test_client + + +

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+

+ 连接信息 + + OTA: ota未连接 + WS: ws未连接 + +

+
+ + + + +
+
+ +
+
+ + +
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+ +
+

会话记录

+
+
+
+
准备就绪,请连接服务器开始测试...
+
+
+
+
+ + + + + + + + \ No newline at end of file