diff --git a/.gitignore b/.gitignore index 6d70914..a122b6c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,13 @@ ssh *.njsproj *.sln *.sw? + +# 本机 AI 接入配置(含密钥,勿提交) +public/local-ai.json +.env + +# 数据质量检查的生成报告(每次运行都会变,不入库) +data-quality/reports/ + +__pycache__/ +*.pyc diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..03423ff --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,69 @@ +# 更新日志 + +本项目在 `gitee.com/676015863/unicut` 基础上做了本地化改造,使其可在自托管环境离线使用。 + +--- + +## 2026-10-26 + +### ✨ 新功能 + +**免登录使用** +- 核心功能(编辑、模板、素材、导出、保存)全部免登录,`GUEST_USER` 直接进入 +- 移除登录态拦截,`checkAuth()` 不再阻断编辑器 + +**本机 AI 接入** +- AI 对话主模型 `mimo-v2.6-flash`,走同源 `/newapi/v1` 反代,HTTPS 页面不触发混合内容拦截 +- 视觉模型 `deepseek-v4-flash-vision-exp`,备用 `glm-5.3-flash` / `deepseek-v4-flash` +- AI 生图走 `/omniai`(本机 omniroute),AI 生视频走 `/civideo`(直连 cheaperinference,绕开网关视频白名单) +- 密钥全部留在服务端:nginx 占位符由 `entrypoint.sh` 注入,前端与仓库均不出现明文 + +**AI 一键出片** +- 四步向导:添加图片 + 标题 → AI 识别图片生成口播文案 → 配人声/语速/情绪试听 → 确认生成直接排入时间轴 +- 13 种中文音色(含四川话/粤语/台湾腔等方言),支持单段重合成或一键全部合成 +- 画面效果面板(生成前可调): + - 图片转场 9 选(自动轮换 / 交叉缩放 / 推进穿门 / 水波涟漪 / 左侧擦除 / 立方翻转 / 柔和溶解 / 平滑缩放),转场名取自官方 GL-Transitions 素材库共 28 个 + - 图片动效 4 选(缓慢推近 / 缓慢拉远 / 左右平移 / 静止),基于元素关键帧 `frames` 做几何插值 + - 字幕位置(底部/居中/顶部)、大小(60%–200%)、配色(黄/白/橙 + 描边)、入场动画(放大弹入 / 淡入 / 放大+淡入) +- AI 面板顶部常驻高亮入口卡,切到其他页签也始终可见,点卡片直达向导 + +**离线可用** +- 工程数据双写:IndexedDB + 项目文件夹 `projects/.json`,IndexedDB 查不到时从文件读回 +- 素材上传在无 OPFS 目录句柄时(如以 `http://IP` 打开)回落到 IndexedDB `files` 表,整条「上传 → 加入时间轴 → 导出」链路仍可用 +- 官方素材统一走同源 `/cdn/` 反代,浏览器不再直连 CDN + +### 🐛 修复 + +**账号类接口反复弹窗** +- 现象:每隔数秒弹 `Header parameter [authorization] cannot be empty` +- 根因:`/api/`、`/cgi-bin/` 反代到官方后端,其中 `/user/*`、`/account/*` 必须登录 token;自动保存每 10 秒触发一次,每次都失败 +- 修复:`BasicService._request()` 对账号类接口本地短路返回空成功结果,不发请求;保存与作品列表的本地分支判据由 OPFS 放宽为 IndexedDB(`canUseLocalSave()`) + +**OPFS 判定错误导致卡在引导页** +- 现象:页面停在「选择本地存储文件夹」弹窗,编辑器进不去 +- 根因:`isFSApiSupported()` 使用 `'showDirectoryPicker' in window`,`in` 只要属性名存在于原型链就为真 +- 修复:改为取值判断 `typeof window.showDirectoryPicker === 'function'` + +**模板缩略图全部裂图** +- 现象:模板面板列表能加载,但 26 张缩略图全裂 +- 根因:列表接口返回 `/video/…` 相对路径,同源取被 nginx `try_files` 兜底伪装成 `200 text/html` 的 SPA 首页 +- 修复:前端改写到 `/cdn/` 反代;nginx 增加 `location ~ ^/(video|video_business)/` 兜底直接转发 CDN,即使前端改写丢失也不会再裂图 + +**模板素材已失效** +- 列表首位模板的 mp4 在上游 CDN 已删除(所有前缀均 404),点开必然卡在 loading 50% +- 修复:`DEAD_TEMPLATE_IDS` 黑名单剔除,素材存活已逐个探测(24 好 1 坏) + +**画布卡在 loading 0%** +- 根因:`resourcesHost` 改同源后,SDK 内置 4 张滤镜贴图(overlay / colormap / displacement_map / lightmap)在容器镜像中缺失,加载失败导致后续流程不执行 +- 修复:补齐 4 张贴图资源 + +**封面上传失败导致整次保存失败** +- 修复:`saveApp()` 中封面上传包 try/catch,失败只跳过封面,不影响工程保存 + +### 🎨 调整 + +- 品牌由「云剪」改为 **UniCut** +- 首页删除「收费标准」栏目(含相关样式与死代码) +- 顶部菜单栏移除 GitHub / Gitee 外链 +- 底部栏整体下线(`Footer` 返回 `null`,组件保留以便随时恢复) +- 首页页脚版权、导航、支持链接、联系方式、二维码全部移除 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d39552d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:20-alpine AS builder +WORKDIR /app +ENV NPM_CONFIG_REGISTRY=https://registry.npmmirror.com +ENV NODE_OPTIONS=--max-old-space-size=4096 +COPY package.json yarn.lock ./ +RUN yarn install +COPY . . +RUN yarn build + +FROM nginx:1.27-alpine +RUN apk add --no-cache openssl +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +COPY --from=builder /app/dist /usr/share/nginx/html +EXPOSE 80 443 +ENTRYPOINT ["/entrypoint.sh"] diff --git a/data-quality/scripts/site/00_lint_dist.py b/data-quality/scripts/site/00_lint_dist.py new file mode 100644 index 0000000..b3ea7ef --- /dev/null +++ b/data-quality/scripts/site/00_lint_dist.py @@ -0,0 +1,507 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +00_lint_dist.py — UniCut 站点 dist 产物静态 lint(断网可用检查) + +对构建产物做全量静态扫描,回答三个问题: + 1. 还有哪些外部 URL?(按 host 聚合 + file:line 明细,区分「会真发起请求」与 + 「只是字符串/命名空间/文档」) + 2. 懒加载 chunk 的 import 指向哪里?有没有指向外域的 chunk? + 3. 音视频 / 字体 / SDK 的引用位置与当前取值是什么?本地文件是否齐全? + +用法: + python3 data-quality/scripts/site/00_lint_dist.py [--dist dist] [--out 报告.md] + [--json 报告.json] [--no-fail] + +退出码:外部网络引用(external_refs)为 0 时 0,否则 1(--no-fail 时恒 0)。 +报告里的「不可消除项」= external_ref_allowlist.txt 里登记的、位于第三方压缩产物内部、 +无法在不改动 vendored 代码的前提下删除的字符串,每条都带原因。 +""" +import argparse +import bisect +import json +import os +import re +import sys +import time +from collections import Counter, defaultdict +from urllib.parse import urlparse + +HERE = os.path.dirname(os.path.abspath(__file__)) +REPO = os.path.dirname(os.path.dirname(os.path.dirname(HERE))) +ALLOWLIST = os.path.join(HERE, 'external_ref_allowlist.txt') + +# 二进制扩展名:直接跳过(不解码扫描) +BIN_EXT = { + '.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.bmp', '.avif', '.mp4', '.webm', + '.mov', '.m4v', '.mp3', '.m4a', '.aac', '.wav', '.ogg', '.flac', '.woff', '.woff2', + '.ttf', '.otf', '.eot', '.wasm', '.data', '.bin', '.onnx', '.tflite', '.task', + '.glb', '.gltf', '.zip', '.gz', '.br', '.pak', '.db', '.ico', +} +TEXT_EXT = { + '.html', '.htm', '.js', '.mjs', '.cjs', '.css', '.less', '.json', '.svg', '.txt', + '.md', '.webmanifest', '.map', '.xml', '.ts', '.tsx', '.conf', '.csv', +} +# 少量无扩展名但其实是文本的文件 +TEXT_NAMES = {'LICENSE', 'README', 'Makefile', 'CNAME', '.well-known'} + +# 会真发起网络请求才算「外部依赖」的已知远程域(无 scheme 命中也算) +KNOWN_HOST_RE = None # main() 里编译 + +KNOWN_REMOTE_HOSTS = [ + 'esm.video.h5ds.com', 'esm-debug.video.h5ds.com', # video-core-sdk 远程 CDN 前缀 + 'audio01.h5ds.com', 'qkgzjp.h5ds.com', # 远程音频域 + 'cdn.h5ds.com', 'video.h5ds.com', 'fvideo.h5ds.com', 'videomix.h5ds.com', + 'water.i.h5ds.com', 'lf3-static.bytednsdoc.com', 'byteblacksmith.com', + 'unpkg.com', 'cdn.jsdelivr.net', 'registry.npmmirror.com', 'cdnjs.cloudflare.com', + 'fonts.googleapis.com', 'fonts.gstatic.com', 'map.qq.com', 'apis.map.qq.com', + 'player.bilibili.com', 'player.vimeo.com', 'www.youtube.com', +] + +URL_RE = re.compile(r'https?://[^\s"\'`<>()\[\]{}\\,;]+') +# 字面量里带 scheme 的资源引用(含模板字符串里的完整地址) +ASSET_URL_RE = re.compile( + r'(?类别原因""" + rules = [] + if not os.path.exists(ALLOWLIST): + return rules + for raw in open(ALLOWURLS_FILE if False else ALLOWLIST, encoding='utf-8'): + line = raw.strip() + if not line or line.startswith('#'): + continue + parts = line.split('\t') + if len(parts) < 3: + continue + try: + rules.append((re.compile(parts[0]), parts[1], parts[2])) + except re.error: + print('[warn] allowlist 正则无效:', parts[0], file=sys.stderr) + return rules + + +NAMESPACE_HOSTS = {'www.w3.org', 'purl.org', 'schemas.openxmlformats.org', 'www.opengis.net'} +DOC_EXT = {'.md', '.map', '.txt'} + + +def ext_of(relpath): + return os.path.splitext(relpath)[1].lower() + + +def classify(url, relpath, allow_rules): + """返回 (category, reason)。category ∈ namespace|local|lan|doc|sourcemap|allow|net""" + try: + host = urlparse(url).netloc.lower().split('@')[-1].split(':')[0] + except Exception: + host = '' + ext = os.path.splitext(relpath)[1].lower() + + if host in NAMESPACE_HOSTS: + return 'namespace', 'XML/SVG 命名空间 URI,浏览器不发起请求' + if host in ('localhost', '127.0.0.1', '0.0.0.0', '::1', '[::1]'): + if os.path.splitext(relpath)[1].lower() in DOC_EXT: + return 'doc', '文档里写的本机示例地址,不会发起请求' + return 'local', '本机地址(残留的开发期配置)' + if re.match(r'^(192\.168\.\d+|10\.\d+|172\.(1[6-9]|2\d|3[01])|169\.254)\.\d+$', host): + return 'lan', '内网地址,仍会发起网络请求' + if ext in DOC_EXT: + return 'doc', '文档/Source Map 文件' + if relpath in ('stats.html',) or relpath.endswith('/stats.html'): + return 'sourcemap', 'rollup 可视化报告,不被页面引用' + for rx, cat, reason in allow_rules: + if rx.search(url): + return cat, reason + return 'net', '未登记的外部 URL' + + +class LineIndex: + """O(log n) 行号查询:大体积压缩产物(单行几 MB 的 JS)上避免 O(n^2)。""" + + def __init__(self, text): + self.nl = [m.start() for m in re.finditer('\n', text)] + + def line(self, pos): + return bisect.bisect_right(self.nl, pos) + 1 + + +def line_of(text, pos): + return text.count('\n', 0, pos) + 1 + + +def snippet(text, pos, width=70): + a, b = max(0, pos - width), min(len(text), pos + width) + return text[a:b].replace('\n', '\\n') + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--dist', default=os.path.join(REPO, 'dist')) + ap.add_argument('--out', default=None) + ap.add_argument('--json', dest='json_out', default=None) + ap.add_argument('--no-fail', action='store_true') + ap.add_argument('--max-rows', type=int, default=200) + args = ap.parse_args() + + dist = os.path.abspath(args.dist) + if not os.path.isdir(dist): + print('dist 不存在:', dist, file=sys.stderr) + return 2 + + t0 = time.time() + allow_rules = load_allowlist() + + # 预先收集 dist 内所有文件,避免上万次 os.path.exists 系统调用 + dist_files = set() + for root, dirs, files in os.walk(dist): + for fn in files: + dist_files.add(os.path.relpath(os.path.join(root, fn), dist).replace(os.sep, '/')) + + global KNOWN_HOST_RE + KNOWN_HOST_RE = re.compile(r'(? args.max_rows: + A('') + A('> 其余 %d 行见 JSON 报告。' % (len(ext_refs) - args.max_rows)) + else: + A('无。') + A('') + + A('## 3. 懒加载 chunk import') + A('') + A('共 %d 处动态 import / Worker 创建。' % len(lazy_imports)) + A('') + external_chunks = [x for x in lazy_imports if x['target'].startswith('http')] + if external_chunks: + A('⚠️ 指向外域的 chunk:') + for x in external_chunks[:50]: + A('- `%s:%s` %s → `%s`' % (x['file'], x['line'], x['kind'], x['target'])) + else: + A('全部指向同源相对路径(`/homeAssets/...` 等),无外域 chunk。') + A('') + A('
完整清单(前 200 条)') + A('') + for x in rows(lazy_imports, 200): + A('- `%s:%s` %s → `%s`' % (x['file'], x['line'], x['kind'], x['target'])) + A('') + A('
') + A('') + + A('## 4. 音视频 / 字体 / SDK 引用') + A('') + A('扩展名分布:' + ', '.join('%s×%d' % (k, v) for k, v in ext_counter.most_common())) + A('') + A('### 4.1 指向外域(必须为 0)') + A('') + ext_media = [r for r in media_refs if r['state'] == 'external'] + if ext_media: + for r in rows(ext_media, args.max_rows): + A('- `%s:%s` → `%s`' % (r['file'], r['line'], r['value'])) + else: + A('无。') + A('') + A('### 4.2 本地路径但文件缺失(功能降级 / TODO)') + A('') + if missing_local: + for r in rows(missing_local, args.max_rows): + A('- `%s:%s` → `%s`' % (r['file'], r['line'], r['value'])) + else: + A('无。') + A('') + A('### 4.3 字体 / 音视频 / 关键 SDK 取值抽样') + A('') + A('| file:line | 取值 | 状态 |') + A('| --- | --- | --- |') + for r in rows(media_font_refs, 80): + A('| `%s:%s` | `%s` | %s |' % (r['file'], r['line'], r['value'], r['state'])) + A('') + A('
SDK 相关引用(%d 条)' % len(sdk_refs)) + A('') + for r in rows(sdk_refs, 120): + A('- `%s:%s` → `%s`(%s)' % (r['file'], r['line'], r['value'], r['state'])) + A('') + A('
') + A('') + + A('## 5. assets/manifest.json 远程前缀') + A('') + if manifest_info: + for m in manifest_info: + A('- `%s`:' % m['file']) + if 'error' in m: + A(' - 解析失败:%s' % m['error']) + elif m.get('keys'): + for k, v in m['keys'].items(): + A(' - `%s` = `%s`' % (k, v)) + else: + A(' - 无 remote_prefix / preview_prefix 等远程前缀字段') + else: + A('dist 内没有 `assets/manifest.json`(video-core-sdk 未随包发布远程前缀清单)。') + A('') + + A('## 6. TODO 与不可消除项') + A('') + A('### 6.1 allowlist(vendored 产物内、无法在不改第三方代码的前提下删除的字符串)') + A('') + allow_by_reason = defaultdict(Counter) + for h in url_hits: + if h['cat'] == 'allow': + allow_by_reason[h['reason']][h['host']] += 1 + if allow_by_reason: + for reason, hosts in allow_by_reason.items(): + A('- %s:%s' % (reason, ', '.join('%s×%d' % (k, v) for k, v in hosts.most_common()))) + else: + A('无。') + A('') + A('### 6.2 本地资源缺失 / 功能降级(详见 4.2)') + A('') + if missing_local: + for r in rows(missing_local, 60): + A('- [ ] `%s`(`%s:%s`)' % (r['value'], r['file'], r['line'])) + else: + A('- [x] 无缺失的本地音视频/字体/SDK 资源。') + A('') + A('## 附录:报告文件') + A('') + A('- JSON:`%s`' % os.path.relpath(out_json, REPO)) + A('- 允许清单:`%s`' % os.path.relpath(ALLOWLIST, REPO)) + A('') + + os.makedirs(os.path.dirname(out_md), exist_ok=True) + open(out_md, 'w', encoding='utf-8').write('\n'.join(L)) + json.dump({ + 'dist': dist, + 'external_refs': external_refs, + 'by_category': dict(by_cat), + 'known_host_hits': known_host_hits, + 'url_hits': url_hits, + 'lazy_imports': lazy_imports, + 'media_refs': media_refs, + 'missing_local': missing_local, + 'manifest': manifest_info, + 'files': {'text': text_files, 'binary_skipped': skipped_bin}, + 'report_md': out_md, + }, open(out_json, 'w', encoding='utf-8'), ensure_ascii=False, indent=2) + + print('external_refs = %d' % external_refs) + print('报告:', out_md) + return 0 if (external_refs == 0 or args.no_fail) else 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/data-quality/scripts/site/external_ref_allowlist.txt b/data-quality/scripts/site/external_ref_allowlist.txt new file mode 100644 index 0000000..f414e08 --- /dev/null +++ b/data-quality/scripts/site/external_ref_allowlist.txt @@ -0,0 +1,56 @@ +# UniCut dist 外部 URL 允许清单(external_ref_allowlist.txt) +# +# 每行三列,用 TAB 分隔:正则(对完整 URL 匹配) 类别 原因 +# 类别固定填 allow —— 表示「这是一段字符串/元数据,运行时不会发起网络请求」。 +# 凡是能通过改源码、改 public/ 素引或补本地文件解决的,一律不允许进本清单; +# 清单里的每一条都必须能回答「为什么删不掉」。 +# +# 维护规则: +# 1. 新增一行前先确认:这个 URL 会不会在浏览器里真发起请求?会 → 去改代码/下载资源,别加清单。 +# 2. 第三方(vendored)压缩产物里的许可证、论文、文档链接属于本清单;本项目自有代码里的不算。 +# 3. 本清单只覆盖「不可消除项」;doc/sourcemap/namespace 三类由脚本自动判定,不需要登记。 +# +# 说明:unpkg.com / cdn.jsdelivr.net 不在清单里 —— 它们出现在 vendored ffmpeg/tesseract +# 的默认参数中,已通过改写 public/ 下的文件指向本地路径,lint 必须能发现回归。 + +github\.com allow vendored 依赖(pixi/semi/opencv 等)压缩产物里的项目主页与许可证链接,仅字符串 +gist\.github\.com allow vendored 依赖 README 片段里的示例链接,仅字符串 +raw\.githubusercontent\.com allow vendored 依赖 README 片段里的源码链接,仅字符串 +github\.io allow vendored 依赖文档站链接,仅字符串 +en\.wikipedia\.org allow 算法出处(Perlin noise / 插值曲线等)注释链接,仅字符串 +stackoverflow\.com allow 实现来源注释链接,仅字符串 +www\.apache\.org allow 许可证(Apache-2.0)链接,仅字符串 +www\.ietf\.org allow RFC 链接(base64/URL 编码实现),仅字符串 +tools\.ietf\.org allow RFC 链接,仅字符串 +pubs\.opengroup\.org allow POSIX 规范链接,仅字符串 +developer\.mozilla\.org allow MDN 文档链接,仅字符串 +unicode\.org allow Unicode 规范链接,仅字符串 +www\.khronos\.org allow WebGL/OpenCL 规范链接,仅字符串 +webkit\.org allow WebKit 实现说明链接,仅字符串 +www\.wolframalpha\.com allow 数学公式示例链接,仅字符串 +www\.redblobgames\.com allow 几何算法文章链接,仅字符串 +www\.shadertoy\.com allow GLSL 特效来源链接,仅字符串 +easings\.net allow 缓动函数文档链接,仅字符串 +tympanus\.net allow Codrops 特效文章链接,仅字符串 +pixijs\.com allow pixi.js 官网链接,仅字符串 +mths\.be allow escape-string-regexp 作者站点,仅字符串 +feross\.org allow 各依赖作者/安全说明链接,仅字符串 +www\.mp3dev\.org allow lame.min.js 作者说明链接,仅字符串 +www\.linderdaum\.com allow GLSL 库作者链接,仅字符串 +emscripten\.org allow ffmpeg.wasm(Emscripten)动态链接说明,仅字符串 +vitejs\.dev allow vite 文档链接(vendored README 片段),仅字符串 +xxx\.com allow worker 代码里的占位字符串(正则示例),非真实地址 +opensource\.org allow 许可证链接,仅字符串 +creativecommons\.org allow CC 许可证链接,仅字符串 +byteblacksmith\.com allow GLSL 着色器源码里的注释(rand 函数出处),位于 JS 字符串常量中,浏览器不会发起请求 +bugzil\.la allow Emscripten/MediaPipe wasm 胶水代码里的 Mozilla 缺陷追踪链接,仅字符串 +mrdoob\.com allow Stats.js(性能面板)作者主页链接,仅字符串 +reactjs\.org allow React 生产构建的错误说明链接(invariant 文案里拼接),仅字符串 +prosemirror\.net allow 编辑器依赖的 ProseMirror 文档链接,仅字符串 +gitee\.com allow 依赖作者仓库镜像链接,仅字符串 +bit\.ly allow 依赖文档里的短链接(示例),仅字符串 +tinyurl\.com allow 依赖文档里的短链接(示例),仅字符串 +fb\.me allow 依赖文档里的社交链接,仅字符串 +site\.com allow medianinfo 调试日志里的示例地址(正则占位),非真实服务 +server\.com allow MediaPipe 调试日志里的示例地址(含端口),非真实服务 +onnxruntime\.ai allow onnxruntime 文档链接,仅字符串 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..87590bd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +services: + unicut: + build: . + container_name: unicut + restart: always + ports: + - "3005:443" + - "3006:80" + environment: + - OMNI_KEY=${OMNI_KEY:-} + - CI_KEY=${CI_KEY:-} + volumes: + - certs:/etc/nginx/certs + + # 本机语音合成(edge-tts),给免登录版提供配音能力;源码在 ../unicut-tts + unicut-tts: + build: ../unicut-tts + container_name: unicut-tts + restart: always + volumes: + - ../unicut-tts/audio:/data/audio + +volumes: + certs: diff --git a/docs/免登录改造.md b/docs/免登录改造.md new file mode 100644 index 0000000..937575b --- /dev/null +++ b/docs/免登录改造.md @@ -0,0 +1,177 @@ +# UniCut 免登录改造说明 + +目标:去掉所有需要登录/注册的环节,打开即用,全部数据留在本地浏览器。 + +## 改动清单 + +| 文件 | 改动 | +| --- | --- | +| `src/utils/guest.ts`(新增) | 定义本地访客身份 `GUEST_USER`(id 0、`vip_status: 1`、`guest: true`),全站默认以该身份运行 | +| `src/utils/checkAuth.ts` | `checkAuth()` 恒返回 `false`,路由层不再做登录校验 | +| `src/stores/user.ts` | 用户信息默认即访客;退出/失效后仍保留访客身份,只清空 token | +| `src/components/login/LoginRegister.tsx` | 登录/注册弹窗整体停用,渲染为空;任何 `showLoginModal` 触发都不再出登录界面 | +| `src/layout/index-layout/IndexLayout.tsx` | 去掉“未登录 / 没有访问权限”的整页阻塞 | +| `src/layout/workspace-layout/WorkspaceLayout.tsx` | 工作区不再依赖登录状态 | +| `src/pages/editor/components/header/Header.tsx` | 保存不再要求登录;本地模式下直接写 IndexedDB;右上角不再出现登录入口 | +| `src/pages/editor/components/header/Project.tsx` | 本地模式改用本地保存,不再调服务端 `updateApp` | +| `src/pages/editor/components/sources/my/Sources.tsx` / `List.tsx` | 素材面板始终显示,去掉“您还未登录”提示 | +| `src/pages/editor/components/sources/ai/AiMain.tsx` | 去掉 token 判断,AI 面板直接可用 | +| `src/utils/savePicker.ts`(新增) | 导出兜底:浏览器不支持/未授权文件系统 API 时,改为内存写入 + 自动下载,导出不再静默失败 | +| `src/main.tsx` | 启动时安装上面的导出兜底 | +| `Dockerfile` | 移除旧的 `patches/0001-nologin.js` 打补丁步骤,直接 `yarn build` | + +## AI 能力(本机自建后端) + +官方 AI 全部走 `video.h5ds.com` 并要账号 token,去登录后必然报 +`任务创建失败:Header parameter [authorization] cannot be empty`。现在改为直连本机服务: + +| 功能 | 本机后端 | 说明 | +| --- | --- | --- | +| AI 对话 / agent 模式 | NewAPI `http://192.168.68.19:3099/v1` | OpenAI 兼容,默认 `mimo-v2.6-flash`,失败自动降级 `glm-5.3-flash` → `deepseek-v4-flash`;带图片时改用 `deepseek-v4-flash-vision-exp` | +| AI 图片生成 | 本机图像代理 `http://192.168.68.19:8113/v1` | OpenAI 兼容 `/v1/images/generations`,生成后直接回显并可插入时间轴 | +| AI 视频生成 | cheaperinference `/civideo/` 直连 | OpenAI 兼容 `/v1/videos/generations`,可选 480p/720p、1~5 秒,生成后可插入时间轴 | +| 云合成 / 云导出 | 无 | 已改为提示使用「本地合成」 | +| 语音合成(配音) | `unicut-tts` 容器(edge-tts) | nginx 同源反代 `/localtts/` → `unicut-tts:8000`,字节 voice_type 自动映射到 edge 音色,按 text+voice 哈希缓存 mp3 | +| 语音识别(AI 字幕) | 无 | 本机未接 ASR,给出明确说明;可手写字幕 | + +配置文件:`public/local-ai.json`(已加入 `.gitignore`,含密钥,勿提交),模板见 +`public/local-ai.json.example`。运行时也可在站点根目录放同名文件覆盖,不用重新构建。 + +### 本机 TTS(配音) + +`../unicut-tts/app.py` 是一个独立的 FastAPI 服务(edge-tts),只暴露给 compose 内网;前端经 +`/localtts/` 同源反代调用(相对路径,避免 HTTPS 页面加载 HTTP 音频被浏览器拦)。 + +``` +GET /localtts/health → {"ok":true,"cached":N} +POST /localtts/tts {text, voice} → {"url":"/localtts/audio/.mp3", "voice":"zh-CN-XiaoxiaoNeural"} +``` + +音色映射:前端传字节 `voice_type`(如 `zh_female_xxx_bigtts`),服务按关键词映射到 edge 中文音色, +认不出按性别兜底;合成结果按 `text+voice` 哈希缓存,重复文本不重复合成。 + +## 模板(官方在线 + 本机备用) + +模板面板原本只从官方接口 `/api/v1/templates/page`(`video.h5ds.com`)拉数据,本机模板无处可放。 +现在官方模板通过同源 CDN 反代加载(不直连外域,断网可用): + +1. `nginx.conf` 新增 `location /cdn/` → 反代 `https://cdn.h5ds.com/`; +2. `src/pages/editor/Editor.tsx` 模板分支:官方工程从 `/cdn/` 取,内部素材路径 + `/video/…` 与 `/video_business/…` 统一改写成 `/cdn/…`(避开 `"video/mp4"` 这类 MIME 串); +3. `src/pages/editor/server.ts` + - `getTemplates()`:把官方 `url`/`thumb` 的 `/video*` 路径改成 `/cdn/…`(同源取才不会 404); + - 本机模板仍从 `/templates/index.json` 合并(关键词命中时只给本机模板)。 + +本机备用模板(**默认不列出**,`public/templates/index.json` 现为空数组): +`public/templates/` 下保留 `soft-tpl-01..10.json`(MovieData 工程,纯文字元素,无外部素材依赖)与 +`soft-tpl-01..10.png` 缩略图。官方模板观感更真实(含 lottie 动效与多帧素材),本机模板仅作为 +断网兜底;若要恢复列出,把条目写回 `index.json` 即可。 +生成脚本(可重跑):`/vol1/1000/HD1/APP/hermes/awork/scripts/gen_unicut_templates.py` + +文字元素结构取自 SDK 真实产物(`editor.movie.addElementNoSource`),关键字段: +`textStyle.fill.value.colors[0].color` / `fontSize` / `lineHeight` / `align` / `fontFamily`(=aConfused) / `style.x,y` / `trackIndex` / `startTime` / `duration`。 + +> 注意:模板点击后会**覆盖当前工程**(原生确认弹窗),属于设计行为;先保存再套用。 + +**两个必须注意的坑(已修)**: + +1. TTS 返回的音频地址**必须补成同源绝对地址**。编辑器 `util.reURL()` 会把相对路径拼到 + `config.resourcesHost`(`https://cdn.h5ds.com`)上,`/localtts/audio/x.mp3` 会变成 + `https://cdn.h5ds.com/localtts/audio/x.mp3` 而 404,前端拿到的是 `[object Event]` 报错。 +2. 时间轴为空时 `editor.getGroupElementData()` 返回空数组,「开始朗读」什么都不做; + 已改为没有元素时直接用输入框文案合成并插入 0 秒处。 +3. `startRead` 增加了 `try/catch/finally`,异常时也会清掉 `editor.globalLoading`, + 否则 `tracks-module__spinning` 遮罩会一直盖住面板按钮,表现成「点了没反应」。 + +相关代码:`src/utils/localAi.ts`、`src/pages/editor/components/sources/my/TTS.tsx`(新增/改动)、`src/pages/editor/server.ts`(`openAiChat` / `createAiTask` / +`getAiTaskList` / `seekAiTaskStatus` / `createTTS` / `createCaption` 本地化)、`src/database/localDB.ts`(新增 +`aiTasks` 表,DB 版本 6)、`AIChat.tsx`(图片生成直连本机、视频生成给提示)、`Export.tsx`(云合成提示)。 + +## 数据存储 + +- 首次进入工作区需要选择一个本地文件夹(浏览器 File System Access API 的安全要求,不是登录)。 +- 项目、素材索引存在 IndexedDB(`H5VideoLocalDB`),素材文件存在所选文件夹。 +- **工程数据会同步落一份到所选文件夹** `projects/.json`(`saveProject()` 写入, + `getProject()` / `getAppData()` 在 IndexedDB 缺失时从该文件读回)。 + 这样换浏览器、清站点数据、换设备后,只要把项目文件夹指到同一个目录就能恢复工程; + 也可以直接把 `projects/` 目录打包备份带走。 +- 不上传服务器,也不依赖账号 token。 + +## 构建与发布 + +```bash +cd /vol1/1000/HD1/docker/unicut-src +docker compose build unicut +docker compose up -d --no-build +``` + +访问:https://127.0.0.1:3005/ (HTTP:http://127.0.0.1:3006/) + +## 品牌与站点文案(build21) + +站点原名文案(「云剪|爱趣五视频云剪辑…」与四川爱趣五科技相关信息)已全部替换为 **UniCut**: + +| 文件 | 改动 | +| --- | --- | +| `index.html` | `` → `UniCut`;description/keywords 重写为 UniCut 在线剪辑;`lang` → `zh-CN`;移除百度统计脚本 | +| `src/language/zhCN.ts` | `common_company` → `UniCut`;`home_title` → `UniCut · 创意无限`;`common_copyright` → `UniCut · 本地部署版`(去掉公司名与备案号) | +| `src/pages/home/Home.tsx` | FAQ 与首页文案中的「无界云剪辑」→ `UniCut` | +| `src/pages/aboutus/AboutUs.tsx` | 中英文「关于我们」整段重写为 UniCut 介绍(本地部署、数据存浏览器、免登录) | + +`cdn.h5ds.com` / `video.h5ds.com` 等域名属于 SDK 资源与接口地址,不是文案,保持原样。 + +## 生图 / 生视频:本机 omniroute + cheaperinference + +浏览器侧不留任何密钥,统一走同源反代: + +``` +浏览器 → https://<unicut>/omniai/* → nginx 注入 Authorization → http://192.168.68.19:20139/v1/* +``` + +- `nginx.conf` 新增 `location /omniai/`(`proxy_read_timeout 300s`),密钥写成占位符 `__OMNI_KEY__`; +- `entrypoint.sh` 启动时用环境变量 `$OMNI_KEY` 替换占位符; +- `docker-compose.yml` 通过 `OMNI_KEY=${OMNI_KEY:-}` 注入,真实值放项目根 `.env`(600 权限,已加入 `.gitignore`); +- `public/local-ai.json` 的 `image` / `video` 段改为 `baseUrl: /omniai`,**不再包含任何 key**(此前该文件随站点发布、明文带 key)。 + +- 模型:生图 `cheaperinference/grok-imagine`(1024×1024,实测约 20 秒,返回 base64 JPEG,代码按 `/9j/` 判 MIME)。 +- 生视频走 `/civideo/` 同源反代**直连** `https://api.cheaperinference.com/v1`(`nginx.conf` 的 `location /civideo/`,`proxy_read_timeout 600s`、`client_max_body_size 50m`,占位符 `__CI_KEY__` 由 `entrypoint.sh` 用 `$CI_KEY` 注入,真实值同样只在 `.env`)。前端 + `localGenerateVideo()` 传 `model`+`prompt`+`resolution`+`duration`,实测 480p/720p、1~5 秒可用。 + +> 为什么生视频不走 omniroute:omniroute 的 `/v1/videos/generations` 内置视频渠道白名单(`agnes`、`fal-ai`、`kling`、`minimax`、`qwen-cloud`、`veoai`、`adobe-firefly` 等),**不含 `cheaperinference`**,会返回 `Invalid video model`;生图接口无此白名单,故生图仍经 omniroute(`/omniai/`)。生视频改为直连上游绕开白名单。 + +## 账号类接口:本地短路(build41/42,修「Header parameter [authorization] cannot be empty」反复弹窗) + +### 问题 +`nginx.conf` 把 `/api/` 与 `/cgi-bin/` 反代到官方 `video.h5ds.com`,其中 +**公开目录类接口**(`/api/v1/templates/page`、`/materials/page`、`/common/type-items/page`、`/template/categories/tree`) +不带 token 也返回 200,可正常用;但**账号类接口**(`/api/v1/user/*`、`/account/*`)必须登录 token, +免登录下必返回 `Header parameter [authorization] cannot be empty`。而保存、作品列表、收藏这类调用是 +定时/高频触发的(自动保存每 10 秒一次),于是用户被反复弹窗打断。 + +### 两处根因 +1. **`isFSApiSupported()` 用了 `in` 判定**(`'showDirectoryPicker' in window`)。`in` 只要属性名存在于 + 原型链上就为真,某些环境下该方法被禁用/未实现但属性名仍在原型上,判定结果为 true; + `FolderGuard` 据此认为「支持 OPFS 但还没选文件夹」,于是**一直停在引导弹窗**,编辑器根本进不去。 + 已改为取值判断 `typeof window.showDirectoryPicker === 'function'`。 +2. **本地保存的判据用了 OPFS**(`editor.useLocalStorage = isFSApiSupported()`)。OPFS 只在 https / localhost + 这类**安全上下文**里存在,用 `http://192.168.x.x` 打开时为 false,整条本地链路被判为不可用, + 保存/作品列表随即退回官方远端接口。已新增 `canUseLocalSave()`(判据改为 **IndexedDB**): + 工程数据本来就先写 IndexedDB(`saveProject`),文件落盘只是可选增强(没选文件夹时自动跳过), + 所以只要 IndexedDB 可用本地保存就成立。`Header.tsx` / `my/List.tsx` / `Project.tsx` 的本地分支 + 判据统一放宽为 `editor.useLocalStorage || canUseLocalSave()`。 + +### 兜底 +`BasicService._request()` 对 `/api/v1/user/*`、`/api/v1/account/*` **本地短路**,不发请求, +直接返回一个空成功结果(带可用 `id`,列表字段给空数组),调用方自然走空列表 / 本地生成 id 的分支。 +日志打 `[本地模式] 跳过账号类接口: <url>`,便于排查。 +封面上传(`saveApp` 里的 `uploadBase64`)同样包了 try/catch,失败只跳过封面,不让整次保存失败。 + +### 验收 +- 模拟无 OPFS(`add_init_script` 把 `showDirectoryPicker` 覆盖为 undefined,等价于 `http://IP` 打开): + 编辑器**能正常进入**,`官方后端请求 0 条 / 账号类接口 0 条 / Toast 0 条`, + 且 IndexedDB 里 `projects` 存到了该工程(`{id: 'noopfs_…', name: 'Untitled', hasData: true}`)。 +- 正常(有 OPFS)环境回归:编辑器能进、`useLocalStorage: true`、账号类接口 0 条、Toast 0 条。 + +### 仍需注意 +用 `http://IP` 打开时 **OPFS 不可用**,因此「把素材文件落到本地文件夹」这一层不工作(工程数据仍存 IndexedDB)。 +需要完整本地素材能力请用 **https**:`https://192.168.68.19:3005/`(自签证书,首次需点「继续访问」)或本机 `https://127.0.0.1:3005/`。 diff --git a/docs/功能清单.md b/docs/功能清单.md index 2ab3e5d..cc12e74 100644 --- a/docs/功能清单.md +++ b/docs/功能清单.md @@ -177,6 +177,45 @@ AI 自动分析视频内容,智能选取精彩片段进行剪辑,适合快 ### 5.12 AI 抠图 一键智能主体抠图,与手动抠图工具互补,应对不同复杂度的抠图需求。 +### 5.13 AI 一键出片 +**入口**:左侧「AI 创作」面板最上方常驻一张渐变入口卡(带「推荐」角标),不随页签切换而消失, +点卡片或点「立即生成」直接进向导;页签里「一键出片」排在第一位并带红点标记,下面才是生视频、生图和生成结果。 + +操作上**只给几张图片和一个标题**,向导分四步走完: + +1. **图片与标题** — 上传若干张图片、填一个标题 +2. **生成文案** — 大模型识别图片内容,按段落生成口播文案(可改、可增删段、可指定每段配哪张图) +3. **配置声音** — 13 种中文音色、语速、情绪逐段试听,支持单段重合成或一键全部合成 +4. **确认生成** — 核对后一键排入时间轴:图片 + 字幕 + 配音按段对齐,直接可导出 + +第四步还提供**画面与字幕效果**,生成前就能调好: + +| 项 | 选项 | +| --- | --- | +| 图片转场 | 自动轮换(推荐)/ 交叉缩放 / 推进穿门 / 水波涟漪 / 左侧擦除 / 立方翻转 / 柔和溶解 / 平滑缩放 / 不加转场 | +| 图片动效 | 缓慢推近 / 缓慢拉远 / 左右平移 / 静止 | +| 字幕位置 | 底部 / 居中 / 顶部 | +| 字幕大小 | 60% ~ 200% 滑块 | +| 字幕配色 | 黄字黑边 / 白字黑边 / 橙字白边 | +| 字幕入场 | 无 / 放大弹入 / 淡入 / 放大 + 淡入 | + +实现上这几项都落在工程数据里,可继续手动精修: + +- **转场**写 `data.transitions`(`{id, name, duration, startElementId, transitionName, __a}`), + 转场名取自官方 GL-Transitions 素材库(`/api/v1/materials/page?type=transition`,共 28 个)。 + SDK 的硬性要求是**同轨道且首尾相接**(`startTime + duration === 下一张的 startTime`), + 否则 `removeInvalidTransition()` 会静默删掉它 —— 所以向导在收尾阶段把本次的图片统一压到 + 同一条空闲轨道、配音压到另一条,再按相邻关系压转场。 +- **图片动效**写元素的 `frames` 关键帧(`x/y/width/height` 两帧插值)。运镜时新框始终盖住 + 原框(缩放比 ≥1、位移在 `[(1-k)w, 0]` 内),因此不会在运镜过程中露出画布背景。 +- **字幕放大**吃的是 `textScale` 而不是 `scale`(渲染时 `new TxtTexture(text, style, textScale)` + 并重算 `style.width/height`);位置按画布尺寸写绝对坐标,字幕锚点在中心(`x = width/2`), + 放大后自动重新居中。入场动画同样用 `frames` 关键帧(`textScale` + `alpha`)。 + +验收:`scripts/e2e_quickvideo_fx.py` 会真实跑完四步向导,再读回工程数据断言 +(同轨道、转场条数 = 段数 - 1、`gap = 0`、关键帧/字幕样式逐项比对),并按时间点截帧比对像素, +确认擦除转场是逐帧推进的(右侧先变化、颜色渐变混合、随后左侧推进)。 + --- ## 六、时间轴 diff --git a/docs/断网可用改造.md b/docs/断网可用改造.md new file mode 100644 index 0000000..76fc534 --- /dev/null +++ b/docs/断网可用改造.md @@ -0,0 +1,206 @@ +# UniCut 站点断网可用改造与详情页规范(本页日志) + +目标:构建产物里**没有任何会向外网发起请求的引用**,拔掉网线剪辑功能照常; +同时把站点内容组织改成「详情页优先」,新增文章只加静态文件、不改前端代码。 + +本页只记录本次站点(dist 产物 + public 素引 + 详情页)的改动,不覆盖全站规范。 + +## 改动清单 + +| 文件 | 改动 | +| --- | --- | +| `data-quality/scripts/site/00_lint_dist.py`(新增) | dist 产物全量静态 lint:外部 URL 按 host 聚合 + `file:line`、懒加载 chunk import、音视频/字体/SDK 引用取值与本地缺失、manifest 远程前缀扫描 | +| `data-quality/scripts/site/external_ref_allowlist.txt`(新增) | 不可消除项允许清单,每条带原因(TAB 三列:正则/类别/原因) | +| `scripts/localize-assets.py`(新增) | 下载远程素材到 `public/` 并改写成同源路径,可重复执行;报告写 `data-quality/reports/site/assets-localize.json` | +| `scripts/patch-sdk-offline.mjs`(新增) | 构建期改写 `node_modules/video-core-sdk` 里的 CDN 常量,找不到待替换串直接失败 | +| `scripts/build.sh`(新增) | 建站流程:构建锁 → 素材刷新 → 构建发布 → 产物 lint → curl 健康检查 | +| `package.json` | `build` 脚本前置 `node scripts/patch-sdk-offline.mjs` | +| `nginx.conf` | 新增 `location /newapi/` → 本机 NewAPI(3099)同源反代 | +| `src/config/index.ts` | `resourcesHost` / `EModuleEffectSourcePath` / `host` / `editorHost` 全部改同源相对路径 | +| `src/server/user.service.ts` | `loginFvideo` 不再直连 `fvideo.h5ds.com`,走同源 `/api` | +| `src/pages/editor/Editor.tsx` | 演示工程改读 `/assets/demo/test-app.json`;模板 JSON 改同源取 | +| `src/pages/editor/components/options/components/ai-btns/VideoRemoveBg.tsx` | 在线抠像改开同源说明页 `/offline-notice.html` | +| `src/pages/editor/components/timeline2/toolbar/ai-removebg/AiRemoveBg copy.tsx` | 同上(该文件未被引用,一并清理外链) | +| `src/components/login/loginQrcode/LoginQrcode.tsx` | 二维码占位图改本地 `/assets/images/qrcode-loading.png` | +| `src/pages/editor/components/ai-chat/AIChat.tsx` | 对话头像改 `/assets/ai-chat/` | +| `src/pages/editor/components/options/components/text-style/TextStyle.tsx` | 字体清单优先读本地 `/assets/fontFamily.json`,为空才回退官方接口 | +| `src/utils/localAi.ts`、`public/local-ai.json(.example)` | 对话网关地址改同源 `/newapi/v1` | +| `src/components/header/Header.tsx` | 页头新增「使用教程」入口,指向 `/article/local-deploy-guide` | +| `src/pages/article/*`(新增)、`src/routes.config.ts` | 文章详情页 `/article/:slug` 与路由注册 | +| `public/articles/*`(新增) | 索引 `index.json` + 两篇正文(`local-deploy-guide.md`、`offline-ready.md`) | +| `public/assets/**`(本地化) | `voices/`(121 音色头像+试听)、`fonts/`(思源黑体 + 兜底)、`ai-chat/`、`demo/test-app.json`、`images/404.png`、`images/qrcode-loading.png`、`effectcanvas/`(占位)、`fontFamily.json` | +| `public/offline-notice.html`(新增) | 离线不可用能力的同源说明页 | +| `public/assets/ffmpeg/814.ffmpeg.js` | ffmpeg.wasm 内核默认地址 unpkg → `/assets/ffmpeg/ffmpeg-core.js` | +| `public/assets/images/logo-black.svg` | 去掉内含外链的设计工具注释 | +| `public/assets/ai/tesseract/**`(删除) | 4.7MB 死代码:源码与产物都没有引用,且内含 jsdelivr 默认地址 | +| `index.html` | 删除被注释掉的腾讯地图脚本(连带一个明文 key) | + +## 三类外部依赖的处理 + +### 1. `grep -rEn "https?://dist"` 能搜出的引用 + +- **能改的直接改**:源码里的 `cdn.h5ds.com` / `video.h5ds.com` / `fvideo.h5ds.com` / + `water.i.h5ds.com` / `lf3-static.bytednsdoc.com` 全部改成本地路径或同源反代(见改动清单)。 +- **缺资源就下载**:`scripts/localize-assets.py` 把音色试听/头像、字体、演示工程、占位图 + 下到 `public/` 并改写 JSON 里的地址,共 248 个文件。 +- **下载不了的做本地兜底**:`/assets/effectcanvas/`(官方目录已下线)放占位清单 + + README 说明,TODO 记在本页与 lint 报告里。 +- **删不掉的列进允许清单**:第三方压缩产物里的许可证/论文/文档链接,见 + `external_ref_allowlist.txt`,每条都写了为什么删不掉。 + +### 2. video-core-sdk 的远程 CDN 前缀 + +`video-core-sdk@1.0.70` 把 4 处远程地址写死在压缩产物里,构建期由 +`scripts/patch-sdk-offline.mjs` 改写: + +| 原值 | 新值 | 说明 | +| --- | --- | --- | +| `cdnHost:"https://cdn.h5ds.com"` | `cdnHost:""` | 字体/素材基址改同源根 | +| `img404:"https://cdn.h5ds.com/assets/images/404.png"` | `/assets/images/404.png` | SDK 初始化会 `fetchBlob(img404)`,属于真实请求 | +| `window.EModuleEffectSourcePath=…` 与默认参数 | `/assets/effectcanvas/` | 特效画布模块目录 | +| 注册 ID 报错文案里的 `https://video.h5ds.com` | 去掉域名 | 文案 | + +> 说明:当前版本 SDK 里**没有** `assets/manifest.json`、也没有 `remote_prefix` / +> `preview_prefix` / `esm.video.h5ds.com` / `esm-debug.video.h5ds.com`; +> lint 仍会对这些已知远程域做无 scheme 全文扫描,命中即判失败。 + +### 3. 音频远程域 `audio01.h5ds.com` / `qkgzjp.h5ds.com` + +产物里同样没有出现这两个域(配音走本机 `unicut-tts`,经 `/localtts/` 同源反代)。 +lint 把它们列入已知远程域清单,一旦回归立刻失败。 + +## 详情页与 slug 规范 + +**路由**:`/article/:slug`(`src/pages/article/index.ts`,注册在 `routes.config.ts` 的 +`/article` 分组里,排在 `/article/about` 之后,互不遮挡)。 + +**内容组织**(全部是同源静态文件,断网可读): + +``` +public/articles/ +├── index.json # 索引:[{ id, title, description, date, tags }] +├── <slug>.md # 正文,Markdown,文件名必须等于 slug +└── assets/<slug>/ # 可选配图,正文里写绝对路径 /articles/assets/<slug>/xxx.png +``` + +**slug 规则**: + +1. 只允许小写字母、数字、连字符:`^[a-z0-9]+(?:-[a-z0-9]+)*$`; +2. 长度 ≤ 64 字符,不允许以下划线/中文/大写字母开头结尾,不能有连续连字符; +3. `index.json` 里的 `id` **必须**与文件名(去掉 `.md`)完全一致,详情页靠它取正文; +4. 建议用「主题词-主题词」的 kebab-case(如 `local-deploy-guide`), + 不要把日期塞进 slug(日期放 `date` 字段,改期不用改链接); +5. 新增文章**只加文件 + 索引项**,不改前端代码;删除文章要同时删正文与索引项; +6. slug 一旦发布就不改(链接会被收藏/引用),要换名就新增一篇并保留旧链接的说明。 + +**校验**:详情页组件用同一个正则校验 slug,非法直接显示「链接无效」, +不会发出任何请求;lint 不校验 slug(那是内容规范,不是产物问题)。 + +**页面结构**:`SubHeader`(标题 + 摘要)→ Markdown 正文 → 「更多教程」串联 → `Footer`; +未命中索引显示「没有找到这篇文章」并给回首页入口。 + +## 断网 lint + +```bash +python3 data-quality/scripts/site/00_lint_dist.py --dist dist # 本地构建产物 +bash scripts/build.sh # 构建后自动对容器内产物跑 +``` + +判定:`external_refs = 0`(退出码 0)。分类口径: + +| 分类 | 是否计入 external_refs | 说明 | +| --- | --- | --- | +| `net` | ✅ 计入 | 未登记的外部 URL、已知远程域命中 | +| `lan` | ✅ 计入 | 内网绝对地址(仍会发起请求,应改同源反代) | +| `local` | ✅ 计入 | 残留的 localhost 开发地址 | +| `namespace` | ❌ 不计 | `www.w3.org` 等 XML/SVG 命名空间 URI | +| `doc` / `sourcemap` | ❌ 不计 | `.md` / `.map` / `stats.html` 里的链接 | +| `allow` | ❌ 不计 | 允许清单里登记的不可消除项,逐条带原因 | + +## 构建与发布 + +```bash +bash scripts/build.sh # 推荐:带锁 + lint 门禁 + 健康检查 +# 或手动: +docker compose build unicut && docker compose up -d --no-build unicut +``` + +`scripts/build.sh` 会拿 `/tmp/unicut_build.lock`(等待上限 10 分钟,避免并发构建互相覆盖), +日志写 `/tmp/unicut_build_site.log`,并在最后 `curl -sk` 检查 +`/`、`/article/local-deploy-guide`、`/article/offline-ready`、`/offline-notice.html` 是否 200。 + +## 本次结果(2026-10-26,最后一次构建 11:23) + +**构建**:`bash scripts/build.sh`(拿到 `/tmp/unicut_build.lock` → 素材刷新 → 构建发布 → +导出产物 lint → curl 健康检查),退出码 0,日志 `/tmp/unicut_build_site.log`。 + +**lint**(脚本 `data-quality/scripts/site/00_lint_dist.py`): + +| 指标 | 改造前(原线上产物) | 改造后(本次产物) | +| --- | --- | --- | +| **external_refs(必须为 0)** | **524** | **0** | +| URL 出现总次数(含命名空间/文档/允许清单) | 717 | 197 | +| namespace(w3.org 等) | 18 | 18 | +| doc / sourcemap | 44 | 46 | +| allowlist(不可消除项,逐条带原因) | 117 | 132 | +| lan / local(内网、localhost 残留) | 4 | 0 | +| 音视频/字体/SDK 引用条目 | 1398 | 1308 | +| 其中指向外域 | 0 | **0** | +| 其中本地缺失(TODO) | 161 | 27 | + +- 最终报告:`data-quality/reports/site/20261026-112622-lint-dist.md`(同名 `.json` 为机器可读版) +- 基线报告:改造前对当时容器内产物的扫描,`external_refs = 524` + (其中 484 处来自 `assets/zijieVoices.json` 的字节 CDN 音色地址) + +**健康检查(全部 200)**: +`/`、`/article/local-deploy-guide`、`/article/offline-ready`、`/offline-notice.html`、 +`/articles/index.json`、`/articles/offline-ready.md`、`/assets/images/colormap.png`、 +`/assets/fonts/siYuanHeiTi/font.woff`、`/assets/voices/audio/000-灿灿_Shiny.mp3`、 +`/cdn/assets/images/404.png`(同源反代)、`/localtts/health`; +`/newapi/v1/models` 返回 401(反代已打通,仅缺鉴权头,属正常)。 + +**编辑器启动自检**(浏览器实测 `/editor/test`): +左侧菜单正常渲染 `模板 / AI创作 / 我的 / 字幕 / 图片 / 视频 / 音频 / 文字 / 贴纸 / 滤镜 / 特效 / 转场 / 更多`, +`movieCreateSuccess = true`(侧栏只在该标志为真时挂载),控制台 0 报错,不再出现 `loading 0.0%`。 + +**关键回归(已修)**:把 `config.resourcesHost` / SDK `cdnHost` 从 `https://cdn.h5ds.com` +改成同源后,SDK 启动时用 pixi `Assets.load` 拉的 4 张滤镜贴图 +(`/assets/images/{colormap,displacement_map,lightmap,overlay}.png`)本地不存在, +nginx 把 404 回退成 `index.html` 导致图片解码失败 → +`[Loader.load] Failed ... InvalidStateError` → 卡在 `loading 0.0%`、左侧菜单不渲染。 +4 张图已由 `scripts/localize-assets.py` 下载补齐(外加演示工程的 2 个媒体文件与 +`抖音美好体.otf` 字体,字体需下一次构建生效)。 + +**同源反代补齐**:模板面板/模板工程原本由另一处改动直连 `cdn.h5ds.com`, +已改为 nginx `location /cdn/` 同源反代(`src/pages/editor/server.ts` 的 `CDN` 常量、 +`src/pages/editor/Editor.tsx` 模板分支),浏览器不再直连外域,联网时功能等价。 + +**详情页**: + +- `https://192.168.68.19:3005/article/local-deploy-guide`(本机 `https://127.0.0.1:3005/article/local-deploy-guide`) +- `https://192.168.68.19:3005/article/offline-ready` +- 正文 `public/articles/<slug>.md`、索引 `public/articles/index.json`,页头「使用教程」入口直达 + +## TODO + +- [ ] `public/assets/effectcanvas/`:官方目录已下线,特效画布(EModule)暂不可用; + 拿到真实模块后按原目录结构放进该目录即可,不需要改代码。 +- [ ] `public/assets/fonts/aConfused/`:上游 `aConfused/font.woff` 已 404,当前用思源黑体 + 复制兜底(模板里 `fontFamily=aConfused`);拿到原字体后直接替换文件。 +- [ ] 在线抠像(AI 人像分离)依赖外部服务,离线不可用;要在本机恢复需部署 removebg + 服务并把地址填回 `VideoRemoveBg.tsx` 的 TODO 处。 +- [ ] 官方模板工程(`/editor/template?templateId=…` 分支)取的是同源相对路径, + 离线时该分支无数据;本机模板走 `/templates/index.json`,不受影响。 +- [ ] 页头 GitHub / Gitee 为用户主动点击的导航外链(不参与资源加载),已登记进允许清单; + 如需彻底零外链,可在离线部署版里隐藏这两个入口。 +- [x] `public/assets/fonts/抖音美好体.otf` 已下载(演示工程文字字体,2.0MB), + **需下一次构建**才会进镜像;在那之前 lint 报告 4.2 会一直列出这一条缺失。 +- [ ] `public/assets/huoshan/`:`TTS.tsx` 用 `location.origin + '/assets/huoshan/' + voice` + 播放音色试听,该目录站点上从来没有 → 试听 404(不阻塞启动,属既有问题)。 +- [ ] `src/pages/editor/Custom.tsx`(经 `Sides.tsx` 引入)里有 3 个外部预览素材地址 + (`cdn.jme-aigc.com`、`h5ds-cdn.oss-cn-beijing.aliyuncs.com`、`static-jiemo-dev.wanjiedata.com`), + 当前未进产物(被 tree-shake),一旦被真正引用,lint 会立刻判失败,需先本地化。 +- [ ] 已删除 `public/assets/ai/tesseract/`(4.7MB,源码与产物都无引用,且默认走 jsdelivr); + 如需离线 OCR,重新接入时必须把 worker/core/lang 路径改成同源。 +- [ ] 报告 4.2 里其余「本地缺失」多为第三方默认参数碎片(`/ffmpeg-core.js`、`/font.woff`、 + `/worker/web-demuxer.wasm` 等),调用方都传了本地地址,实际不会请求这些路径。 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..b1b9afa --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -e + +CERT_DIR=/etc/nginx/certs + +# 首次启动生成自签证书(File System Access API 需要 HTTPS 安全上下文) +if [ ! -f "$CERT_DIR/server.crt" ]; then + mkdir -p "$CERT_DIR" + openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \ + -keyout "$CERT_DIR/server.key" \ + -out "$CERT_DIR/server.crt" \ + -subj "/CN=unicut" \ + -addext "subjectAltName=IP:192.168.68.19,IP:127.0.0.1,DNS:localhost" + echo "已生成自签证书" +fi + +# 注入本机 AI 网关密钥(compose environment / .env 提供) +if [ -n "$CI_KEY" ]; then + sed -i "s|__CI_KEY__|$CI_KEY|g" /etc/nginx/conf.d/default.conf +else + echo "警告:未设置 CI_KEY,/civideo 反代将鉴权失败" +fi + +if [ -n "$OMNI_KEY" ]; then + sed -i "s|__OMNI_KEY__|$OMNI_KEY|g" /etc/nginx/conf.d/default.conf +else + echo "警告:未设置 OMNI_KEY,/omniai 反代将鉴权失败" +fi + +exec nginx -g 'daemon off;' diff --git a/index.html b/index.html index fb9097e..104aab3 100644 --- a/index.html +++ b/index.html @@ -1,15 +1,15 @@ <!doctype html> -<html lang="en"> +<html lang="zh-CN"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="description" - content="云剪是在线使用的视频云剪辑软件,可以对视频进行裁剪、拼接、添加滤镜、贴纸、动画效果,支持定制开发" + content="UniCut 是一款在线视频剪辑工具,支持裁剪、拼接、滤镜、贴纸、动画、文字与配音,浏览器打开即可使用" /> <meta name="keywords" - content="云剪,爱趣五视频云剪辑,视频剪辑软件,免费在线视频剪辑软件,视频云剪辑私有化部署,视频云剪辑软件源码授权" + content="UniCut,在线视频剪辑,视频剪辑软件,免费视频剪辑工具,本地部署视频剪辑,视频剪辑工具" /> <meta name="renderer" content="webkit" /> <!-- No Baidu Siteapp--> @@ -20,7 +20,7 @@ <meta http-equiv="Cache-Control" content="no-siteapp" /> <link rel="icon" type="image/svg+xml" href="/src/favicon.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>云剪|爱趣五视频云剪辑|视频剪辑软件|免费在线视频剪辑软件|视频剪辑工具|爱趣五科技有限公司 + UniCut @@ -29,14 +29,4 @@
- - diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..52afde4 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,135 @@ +server { + listen 80; + server_name _; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + http2 on; + server_name _; + + ssl_certificate /etc/nginx/certs/server.crt; + ssl_certificate_key /etc/nginx/certs/server.key; + ssl_protocols TLSv1.2 TLSv1.3; + + root /usr/share/nginx/html; + index index.html; + + gzip on; + gzip_types text/plain text/css application/json application/javascript image/svg+xml; + + # SPA 路由回退 + location / { + try_files $uri $uri/ /index.html; + } + + # 长缓存带 hash 的构建产物 + location /homeAssets/ { + expires 30d; + add_header Cache-Control "public, immutable"; + } + + + + # 生视频:直连 cheaperinference(omniroute 的视频白名单不含该渠道,故绕开) + location /civideo/ { + proxy_pass https://api.cheaperinference.com/v1/; + proxy_ssl_server_name on; + proxy_http_version 1.1; + proxy_set_header Host api.cheaperinference.com; + proxy_set_header Authorization "Bearer __CI_KEY__"; + proxy_set_header Content-Type "application/json"; + proxy_read_timeout 600s; + proxy_send_timeout 600s; + client_max_body_size 50m; + } + + # 本机 AI 网关(omniroute,OpenAI 兼容):生图/生视频走 cheaperinference 渠道 + # 密钥由 entrypoint.sh 在容器启动时注入,浏览器侧不出现 + location /omniai/ { + proxy_pass http://192.168.68.19:20139/v1/; + proxy_http_version 1.1; + proxy_set_header Host 192.168.68.19; + proxy_set_header Authorization "Bearer __OMNI_KEY__"; + proxy_set_header Content-Type "application/json"; + proxy_read_timeout 300s; + proxy_send_timeout 300s; + client_max_body_size 20m; + } + + # 官方素材 CDN(模板工程 JSON、模板缩略图)同源反代: + # 浏览器只请求 https://<站点>/cdn/**,不再直连 cdn.h5ds.com; + # 断网时该目录自然取不到(模板面板本就是联网能力),本机模板 /templates/** 不受影响。 + location /cdn/ { + proxy_pass https://cdn.h5ds.com/; + proxy_ssl_server_name on; + proxy_set_header Host cdn.h5ds.com; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 300s; + client_max_body_size 2048m; + } + + # 兜底:官方素材的同源相对路径(/video/… 与 /video_business/…)直接转发到 CDN。 + # + # 为什么需要它 —— 模板列表接口返回的是相对路径,正常应由前端改写到 /cdn/; + # 一旦改写逻辑丢失或被人改坏,这些路径会落到下面的 try_files 兜底, + # 返回 200 text/html 的 SPA 首页, 拿到 HTML 当然裂图,而且「200 + 裂图」 + # 极难排查(看着不像出错)。在这里直接转发到 CDN,既修好这一类问题, + # 也让返回内容始终保持为真实图片。 + location ~ ^/(video|video_business)/ { + proxy_pass https://cdn.h5ds.com/$uri; + proxy_ssl_server_name on; + proxy_set_header Host cdn.h5ds.com; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 300s; + client_max_body_size 2048m; + } + + # 本机 LLM 网关(NewAPI,OpenAI 兼容 /v1)同源反代: + # 浏览器只请求 https://<站点>/newapi/v1/*,既避免 HTTPS 页面直连 HTTP 被拦(混合内容), + # 也保证站点在只有本机网络时可用。密钥仍留在服务端,前端不出现。 + location /newapi/ { + proxy_pass http://192.168.68.19:3099/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 300s; + proxy_send_timeout 300s; + client_max_body_size 20m; + } + + # 本机语音合成服务(unicut-tts 容器),同源反代,避免 HTTPS 页面加载 HTTP 音频被拦 + location /localtts/ { + proxy_pass http://unicut-tts:8000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 180s; + client_max_body_size 8m; + } + + # UNICUT 在线服务反代(账号/素材/AI 等在线能力), 对应官方 dev server 的代理配置 + location /api/ { + proxy_pass https://video.h5ds.com; + proxy_ssl_server_name on; + proxy_set_header Host video.h5ds.com; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_read_timeout 300s; + client_max_body_size 2048m; + } + + location /cgi-bin/ { + proxy_pass https://video.h5ds.com; + proxy_ssl_server_name on; + proxy_set_header Host video.h5ds.com; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_read_timeout 300s; + client_max_body_size 2048m; + } +} diff --git a/package.json b/package.json index 09aff8c..e80b2e1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "scripts": { "dev": "vite", - "build": "yarn clean && yarn build:worker && vite build", + "build": "yarn clean && node scripts/patch-sdk-offline.mjs && yarn build:worker && vite build", "build:worker": "node worker.config.js", "preview": "vite preview --port 8080", "lint": "eslint src --fix", @@ -106,6 +106,8 @@ "typescript": "^5.1.6", "vite": "^4.4.4", "vite-plugin-imp": "^2.4.0", - "vite-plugin-mkcert": "^1.17.9" + "vite-plugin-mkcert": "^1.17.9", + "terser": "^5.31.0", + "rimraf": "^5.0.5" } -} +} \ No newline at end of file diff --git a/patches/0001-nologin.js b/patches/0001-nologin.js new file mode 100644 index 0000000..975d96b --- /dev/null +++ b/patches/0001-nologin.js @@ -0,0 +1,23 @@ +// 免登录补丁(三处):未登录也能完整使用剪辑工作区 +// 1. checkAuth 恒 false —— 绕过 /workspace 路由的 meta.auth 守卫(上游未登录时静默弹回首页) +// 2. IndexLayout 不再要求 user.info —— 否则未登录进编辑器显示「没有访问权限」 +// 3. 分类列表首屏抢跑服务器 API(未登录返回 code 1002 弹 "authorization cannot be empty")→ 无 token 时走本地 IndexedDB +const fs = require('fs'); +const p = '/usr/share/nginx/html/homeAssets/js/main-d158b1c0.js'; +let s = fs.readFileSync(p, 'utf8'); +const pairs = [ + ['function checkAuth(){const e=matchRoutes(routes,location.pathname);let t=!1;const r=e[e.length-1];return(null==r?void 0:r.route.meta)&&(t=r.route.meta.auth),t}', + 'function checkAuth(){return!1}'], + [':t.info?jsxRuntimeExports.jsxs(FolderGuard,{children:[jsxRuntimeExports.jsx(PageLoading,{}),renderRoutes(e.routes)]}):jsxRuntimeExports.jsx("div",{children:"没有访问权限"})}', + ':jsxRuntimeExports.jsxs(FolderGuard,{children:[jsxRuntimeExports.jsx(PageLoading,{}),renderRoutes(e.routes)]})}'], + ['userService.getCategoryList({type:t,page:1,page_size:100}).then(t=>{const[r,n]=t;if(n)return Toast.error(n);a(r.data),e.catesCallback(r.data)})', + 'Promise.resolve(user$2.token?userService.getCategoryList({type:t,page:1,page_size:100}):getLocalCategoryList(t)).then(t=>{const[r,n]=t;if(n)return Toast.error(n);a(r.data),e.catesCallback(r.data)})'], +]; +let ok = true; +for (const [o, n] of pairs) { + if (!s.includes(o)) { console.error('PATTERN_MISSING:', o.slice(0, 60)); ok = false; continue; } + s = s.split(o).join(n); +} +if (!ok) process.exit(1); +fs.writeFileSync(p, s); +console.log('no-login patch applied (3/3)'); diff --git a/public/articles/index.json b/public/articles/index.json new file mode 100644 index 0000000..9feddd1 --- /dev/null +++ b/public/articles/index.json @@ -0,0 +1,16 @@ +[ + { + "id": "local-deploy-guide", + "title": "UniCut 本机部署指南", + "description": "一条命令把在线剪辑工具装进自己的机器,浏览器打开即用", + "date": "2026-10-26", + "tags": ["部署", "Docker"] + }, + { + "id": "offline-ready", + "title": "断网也能用:UniCut 离线能力说明", + "description": "字体、音色、模板、AI 全部本地化,外网断了也不影响剪辑", + "date": "2026-10-26", + "tags": ["离线", "原理"] + } +] diff --git a/public/articles/local-deploy-guide.md b/public/articles/local-deploy-guide.md new file mode 100644 index 0000000..bdeabe4 --- /dev/null +++ b/public/articles/local-deploy-guide.md @@ -0,0 +1,60 @@ +# UniCut 本机部署指南 + +UniCut 是一个跑在浏览器里的视频剪辑工具。本机部署版把它做成一个 Docker 站点: +装好之后打开网页就能剪辑,工程数据全部存在浏览器本地,不需要注册、不需要登录。 + +## 一、准备 + +- 一台 Linux 机器(内网 NAS、服务器、虚拟机都可以) +- 已安装 Docker 与 Docker Compose +- 一台同网段的电脑,用浏览器访问 + +## 二、部署 + +站点源码在 `docker/unicut-src`,构建与发布只有两条命令: + +```bash +cd docker/unicut-src +docker compose build unicut +docker compose up -d --no-build +``` + +首次启动会自动生成自签证书(浏览器的 File System Access API 要求 HTTPS 安全上下文), +证书保存在 named volume `certs` 里,重建容器不会丢。 + +## 三、访问 + +| 入口 | 地址 | +| --- | --- | +| HTTPS(推荐) | `https://<机器IP>:3005/` | +| HTTP | `http://<机器IP>:3006/` | + +自签证书第一次打开会有告警,点「高级 → 继续访问」即可。 + +## 四、配套服务 + +| 服务 | 容器 | 作用 | +| --- | --- | --- | +| 站点 | `unicut` | nginx:静态产物 + 同源反代 | +| 配音 | `unicut-tts` | edge-tts,经 `/localtts/` 同源反代 | +| 生图 | `omniroute` | 经 `/omniai/` 同源反代,密钥只在服务端 | +| 对话 | NewAPI | 经 `/newapi/` 同源反代 | + +浏览器侧只看到 `https://<站点>/localtts`、`/omniai`、`/newapi` 这些同源路径, +既避免 HTTPS 页面直连 HTTP 被浏览器拦截,也不会把任何密钥暴露给前端。 + +## 五、构建与发布脚本 + +```bash +bash scripts/build.sh +``` + +脚本会:拿构建锁(避免并发构建互相覆盖)→ 构建镜像 → 发布容器 → +导出产物跑断网 lint → curl 检查首页与详情页是否 200。 + +## 六、常见问题 + +- **打不开网页**:确认 3005 端口没有被占用,`docker ps` 里 `unicut` 状态应为 `Up`。 +- **配音没声音**:`curl -k https://127.0.0.1:3005/localtts/health`,确认 `unicut-tts` 容器在跑。 +- **AI 生图失败**:确认 `omniroute` 健康,且项目根目录 `.env` 里配置了 `OMNI_KEY`。 +- **工程数据在哪**:都在浏览器的 IndexedDB 与你选择的本地文件夹里,服务器上没有副本。 diff --git a/public/articles/offline-ready.md b/public/articles/offline-ready.md new file mode 100644 index 0000000..75c525e --- /dev/null +++ b/public/articles/offline-ready.md @@ -0,0 +1,57 @@ +# 断网也能用:UniCut 离线能力说明 + +本机部署版的目标是:**把网线拔掉,剪辑功能照常**。 +这篇文章说明哪些东西被搬到了本地,以及怎么自己检查。 + +## 一、哪些东西本地化了 + +| 类别 | 原来的位置 | 现在的位置 | +| --- | --- | --- | +| 音色试听(121 个音色) | 字节 CDN | `public/assets/voices/`,清单 `assets/zijieVoices.json` | +| 字体(思源黑体等) | CDN `/assets/fonts/` | `public/assets/fonts/`,清单 `assets/fontFamily.json` | +| AI 对话头像 | 字节 CDN | `public/assets/ai-chat/` | +| 编辑器演示工程 | CDN | `public/assets/demo/test-app.json` | +| ffmpeg.wasm 内核 | unpkg 默认值 | `public/assets/ffmpeg/` | +| SDK 里的 CDN 常量 | `cdn.h5ds.com` | 构建期由 `scripts/patch-sdk-offline.mjs` 改写 | +| 生图 / 对话 / 配音 | 外部服务 | nginx 同源反代 `/omniai`、`/newapi`、`/localtts` | + +下载与改写脚本可重复执行: + +```bash +python3 scripts/localize-assets.py +``` + +## 二、怎么检查产物是否干净 + +每次构建后跑一次 lint,它会扫全部产物,统计「会真发起外网请求」的引用: + +```bash +python3 data-quality/scripts/site/00_lint_dist.py --dist dist +``` + +判定标准:`external_refs = 0`。报告里还会列出: + +1. 按 host 聚合的外部 URL 与出现位置(`file:line`); +2. 懒加载 chunk 的 `import()` 指向,确认没有外域 chunk; +3. 音视频 / 字体 / SDK 的引用取值,以及本地文件是否齐全; +4. 不可消除项:第三方压缩产物里的许可证、论文、文档链接(见 + `data-quality/scripts/site/external_ref_allowlist.txt`,每条都写了原因)。 + +## 三、已经明确的例外 + +- **特效画布(EModule)**:官方 CDN 上的 `/assets/effectcanvas/` 目录已经下线(返回站点首页), + 下载不到真实模块。本地只放了占位清单,拿到模块后按原目录结构放进 + `public/assets/effectcanvas/` 即可恢复,不需要改代码。 +- **在线抠像(AI 人像分离)**:依赖外部站点提供服务,离线不可用。点击后会打开本站的说明页 + `/offline-notice.html`,不会再向外域发任何请求。 +- **页头的 GitHub / Gitee 链接**:属于用户主动点击才访问的导航外链,不参与资源加载, + 保留在允许清单里并注明原因。 + +## 四、怎么新增一篇教程 + +1. 写 `public/articles/.md`; +2. 在 `public/articles/index.json` 里登记 `id`(必须等于 slug)、标题、日期; +3. 详情页地址就是 `https://<站点>/article/`,不需要改任何前端代码。 + +slug 规则:小写字母、数字、连字符,形如 `^[a-z0-9]+(?:-[a-z0-9]+)*$`,长度不超过 64。 +完整规范见 `docs/断网可用改造.md` 的「详情页与 slug 规范」。 diff --git a/public/assets/ai-chat/assistant.png b/public/assets/ai-chat/assistant.png new file mode 100644 index 0000000..40d66b5 Binary files /dev/null and b/public/assets/ai-chat/assistant.png differ diff --git a/public/assets/ai-chat/user.png b/public/assets/ai-chat/user.png new file mode 100644 index 0000000..26dba98 Binary files /dev/null and b/public/assets/ai-chat/user.png differ diff --git a/public/assets/ai/tesseract/lang-data/chi_sim.traineddata.gz b/public/assets/ai/tesseract/lang-data/chi_sim.traineddata.gz deleted file mode 100644 index 7defede..0000000 Binary files a/public/assets/ai/tesseract/lang-data/chi_sim.traineddata.gz and /dev/null differ diff --git a/public/assets/ai/tesseract/lang-data/eng.traineddata.gz b/public/assets/ai/tesseract/lang-data/eng.traineddata.gz deleted file mode 100644 index 730a6a5..0000000 Binary files a/public/assets/ai/tesseract/lang-data/eng.traineddata.gz and /dev/null differ diff --git a/public/assets/ai/tesseract/tesseract.min.js b/public/assets/ai/tesseract/tesseract.min.js deleted file mode 100644 index 428fdae..0000000 --- a/public/assets/ai/tesseract/tesseract.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see tesseract.min.js.LICENSE.txt */ -!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Tesseract=r():t.Tesseract=r()}(self,(()=>(()=>{var t={670:t=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}t.exports=function(){return"undefined"!=typeof window&&"object"===r(window.process)&&"renderer"===window.process.type||!("undefined"==typeof process||"object"!==r(process.versions)||!process.versions.electron)||"object"===("undefined"==typeof navigator?"undefined":r(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},760:(t,r,e)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=function(t){"use strict";var r,e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof m?r:m,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:P(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",g={};function m(){}function b(){}function w(){}var x={};l(x,c,(function(){return this}));var L=Object.getPrototypeOf,O=L&&L(L(A([])));O&&O!==e&&o.call(O,c)&&(x=O);var E=w.prototype=m.prototype=Object.create(x);function S(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"===n(s)&&o.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,e){var n=p;return function(o,i){if(n===v)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return G()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=k(a,e);if(c){if(c===g)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=v;var u=h(t,r,e);if("normal"===u.type){if(n=e.done?d:y,u.arg===g)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=d,e.method="throw",e.arg=u.arg)}}}function k(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function _(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function A(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),T(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;T(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},t}("object"===n(t=e.nmd(t))?t.exports:{});try{regeneratorRuntime=o}catch(t){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},793:(t,r,e)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";o=function(){return t};var t={},r=Object.prototype,e=r.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype),c=new P(n||[]);return i(a,"_invoke",{value:O(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var g={};l(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(k([])));b&&b!==r&&e.call(b,c)&&(g=b);var w=d.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,r){function o(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==n(s)&&e.call(s,"__await")?r.resolve(s.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):r.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return o("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return a=a?a.then(n,n):n()}})}function O(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function E(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,E(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function i(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var a=t.apply(r,e);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}var c=e(311),u=function(){var t=a(o().mark((function t(r,e,n){var i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(e,1,n);case 2:return i=t.sent,t.abrupt("return",i.recognize(r).finally(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.terminate();case 2:case"end":return t.stop()}}),t)})))));case 4:case"end":return t.stop()}}),t)})));return function(r,e,n){return t.apply(this,arguments)}}(),f=function(){var t=a(o().mark((function t(r,e){var n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c("osd",0,e);case 2:return n=t.sent,t.abrupt("return",n.detect(r).finally(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.terminate();case 2:case"end":return t.stop()}}),t)})))));case 4:case"end":return t.stop()}}),t)})));return function(r,e){return t.apply(this,arguments)}}();t.exports={recognize:u,detect:f}},847:t=>{t.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}},711:t=>{t.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}},341:t=>{t.exports={workerBlobURL:!0,logger:function(){}}},5:t=>{t.exports={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}},106:(t,r,e)=>{var n=e(313),o=0;t.exports=function(t){var r=t.id,e=t.action,i=t.payload,a=void 0===i?{}:i,c=r;return void 0===c&&(c=n("Job",o),o+=1),{id:c,action:e,payload:a}}},936:function(t,r,e){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=this;function i(){"use strict";i=function(){return t};var t={},r=Object.prototype,e=r.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var i=r&&r.prototype instanceof y?r:y,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:O(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var g={};l(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(k([])));b&&b!==r&&e.call(b,c)&&(g=b);var w=d.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,r){function i(o,a,c,u){var f=h(t[o],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==n(s)&&e.call(s,"__await")?r.resolve(s.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):r.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(f.arg)}var a;o(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){i(t,e,r,n)}))}return a=a?a.then(n,n):n()}})}function O(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function E(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,E(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e1?n-1:0),a=1;a=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function s(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function h(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){s(i,n,o,a,c,"next",t)}function c(t){s(i,n,o,a,c,"throw",t)}a(void 0)}))}}var p=e(187),y=e(549),v=e(106),d=e(185).log,g=e(313),m=e(847),b=e(581),w=b.defaultOptions,x=b.spawnWorker,L=b.terminateWorker,O=b.onMessage,E=b.loadImage,S=b.send,j=0;t.exports=h(i().mark((function t(){var r,e,n,c,f,s,b,P,k,_,T,N,A,G,I,F,R,D,M,C,U,Y,B,z,H,K,W,J,V,Z,Q,q,X,$,tt,rt,et,nt,ot,it,at=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=at.length>0&&void 0!==at[0]?at[0]:"eng",e=at.length>1&&void 0!==at[1]?at[1]:m.LSTM_ONLY,n=at.length>2&&void 0!==at[2]?at[2]:{},c=at.length>3&&void 0!==at[3]?at[3]:{},f=g("Worker",j),s=p(u(u({},w),n)),b=s.logger,P=s.errorHandler,k=l(s,o),_={},T={},N="string"==typeof r?r.split("+"):r,A=e,G=c,I=[m.DEFAULT,m.LSTM_ONLY].includes(e)&&!k.legacyCore,D=new Promise((function(t,r){R=t,F=r})),M=function(t){F(t.message)},(C=x(k)).onerror=M,j+=1,U=function(t,r){_[t]=r},Y=function(t,r){T[t]=r},B=function(t){var r=t.id,e=t.action,n=t.payload;return new Promise((function(t,o){d("[".concat(f,"]: Start ").concat(r,", action=").concat(e));var i="".concat(e,"-").concat(r);U(i,t),Y(i,o),S(C,{workerId:f,jobId:r,action:e,payload:n})}))},z=function(){return console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)")},H=function(t){return B(v({id:t,action:"load",payload:{options:{lstmOnly:I,corePath:k.corePath,logging:k.logging}}}))},K=function(t,r,e){return B(v({id:e,action:"FS",payload:{method:"writeFile",args:[t,r]}}))},W=function(t,r){return B(v({id:r,action:"FS",payload:{method:"readFile",args:[t,{encoding:"utf8"}]}}))},J=function(t,r){return B(v({id:r,action:"FS",payload:{method:"unlink",args:[t]}}))},V=function(t,r,e){return B(v({id:e,action:"FS",payload:{method:t,args:r}}))},Z=function(){return console.warn("`loadLanguage` is depreciated and should be removed from code (workers now come with language pre-loaded)")},Q=function(t,r){return B(v({id:r,action:"loadLanguage",payload:{langs:t,options:{langPath:k.langPath,dataPath:k.dataPath,cachePath:k.cachePath,cacheMethod:k.cacheMethod,gzip:k.gzip,lstmOnly:[m.DEFAULT,m.LSTM_ONLY].includes(A)&&!k.legacyLang}}}))},q=function(){return console.warn("`initialize` is depreciated and should be removed from code (workers now come pre-initialized)")},X=function(t,r,e,n){return B(v({id:n,action:"initialize",payload:{langs:t,oem:r,config:e}}))},$=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",r=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;if(I&&[m.TESSERACT_ONLY,m.TESSERACT_LSTM_COMBINED].includes(r))throw Error("Legacy model requested but code missing.");var o=r||A;A=o;var i=e||G;G=i;var c,u=("string"==typeof t?t.split("+"):t).filter((function(t){return!N.includes(t)}));return N.push.apply(N,function(t){if(Array.isArray(t))return a(t)}(c=u)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,r){if(t){if("string"==typeof t)return a(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u.length>0?Q(u,n).then((function(){return X(t,o,i,n)})):X(t,o,i,n)},tt=function(){return B(v({id:arguments.length>1?arguments[1]:void 0,action:"setParameters",payload:{params:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}))},rt=function(){var t=h(i().mark((function t(r){var e,n,o,a=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2&&void 0!==a[2]?a[2]:{blocks:!0,text:!0,hocr:!0,tsv:!0},o=a.length>3?a[3]:void 0,t.t0=B,t.t1=v,t.t2=o,t.next=8,E(r);case 8:return t.t3=t.sent,t.t4=e,t.t5=n,t.t6={image:t.t3,options:t.t4,output:t.t5},t.t7={id:t.t2,action:"recognize",payload:t.t6},t.t8=(0,t.t1)(t.t7),t.abrupt("return",(0,t.t0)(t.t8));case 15:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Tesseract OCR Result",r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=arguments.length>2?arguments[2]:void 0;return console.log("`getPDF` function is depreciated. `recognize` option `savePDF` should be used instead."),B(v({id:e,action:"getPDF",payload:{title:t,textonly:r}}))},nt=function(){var t=h(i().mark((function t(r,e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!I){t.next=2;break}throw Error("`worker.detect` requires Legacy model, which was not loaded.");case 2:return t.t0=B,t.t1=v,t.t2=e,t.next=7,E(r);case 7:return t.t3=t.sent,t.t4={image:t.t3},t.t5={id:t.t2,action:"detect",payload:t.t4},t.t6=(0,t.t1)(t.t5),t.abrupt("return",(0,t.t0)(t.t6));case 12:case"end":return t.stop()}}),t)})));return function(r,e){return t.apply(this,arguments)}}(),ot=function(){var t=h(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null!==C&&(L(C),C=null),t.abrupt("return",Promise.resolve());case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),O(C,(function(t){var r=t.workerId,e=t.jobId,n=t.status,o=t.action,i=t.data,a="".concat(o,"-").concat(e);if("resolve"===n){d("[".concat(r,"]: Complete ").concat(e));var c=i;"recognize"===o?c=y(i):"getPDF"===o&&(c=Array.from(u(u({},i),{},{length:Object.keys(i).length}))),_[a]({jobId:e,data:c})}else if("reject"===n){if(T[a](i),"load"===o&&F(i),!P)throw Error(i);P(i)}else"progress"===n&&b(u(u({},i),{},{userJobId:e}))})),it={id:f,worker:C,setResolve:U,setReject:Y,load:z,writeText:K,readText:W,removeFile:J,FS:V,loadLanguage:Z,initialize:q,reinitialize:$,setParameters:tt,recognize:rt,getPDF:et,detect:nt,terminate:ot},H().then((function(){return Q(r)})).then((function(){return X(r,e,c)})).then((function(){return R(it)})).catch((function(){})),t.abrupt("return",D);case 40:case"end":return t.stop()}}),t)})))},352:(t,r,e)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t,r,e){return(r=function(t){var r=function(t,r){if("object"!==n(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var o=e.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(r)?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}e(760);var a=e(936),c=e(311),u=e(793),f=e(5),l=e(847),s=e(711),h=e(185).setLogging;t.exports=function(t){for(var r=1;r{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function n(t){for(var r=1;r{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=e(670);t.exports=function(t){var r={};return"undefined"!=typeof WorkerGlobalScope?r.type="webworker":o()?r.type="electron":"object"===("undefined"==typeof document?"undefined":n(document))?r.type="browser":"object"===("undefined"==typeof process?"undefined":n(process))&&(r.type="node"),void 0===t?r:r[t]}},313:t=>{t.exports=function(t,r){return"".concat(t,"-").concat(r,"-").concat(Math.random().toString(16).slice(3,8))}},185:function(t,r){var e=this,n=!1;r.logging=n,r.setLogging=function(t){n=t},r.log=function(){for(var t=arguments.length,r=new Array(t),o=0;o{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t,r,e){return(r=function(t){var r=function(t,r){if("object"!==n(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var o=e.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(r)?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var a="browser"===e(129)("type")?function(t){return new URL(t,window.location.href).href}:function(t){return t};t.exports=function(t){var r=function(t){for(var r=1;r{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t){for(var r=1;r{var n=e(854),o=e(676),i=e(100),a=e(202),c=e(772),u=e(931);t.exports={defaultOptions:n,spawnWorker:o,terminateWorker:i,onMessage:a,send:c,loadImage:u}},931:t=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(){"use strict";e=function(){return t};var t={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype),c=new P(n||[]);return i(a,"_invoke",{value:O(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var g={};l(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(k([])));b&&b!==n&&o.call(b,c)&&(g=b);var w=d.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,e){function n(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):e.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return n("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function E(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,E(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}var i=function(t){return new Promise((function(r,e){var n=new FileReader;n.onload=function(){r(n.result)},n.onerror=function(t){var r=t.target.error.code;e(Error("File could not be read! Code=".concat(r)))},n.readAsArrayBuffer(t)}))},a=function(){var t=o(e().mark((function t(r){var n,c,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r,void 0!==r){t.next=3;break}return t.abrupt("return","undefined");case 3:if("string"!=typeof r){t.next=16;break}if(!/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(r)){t.next=8;break}n=atob(r.split(",")[1]).split("").map((function(t){return t.charCodeAt(0)})),t.next=14;break;case 8:return t.next=10,fetch(r);case 10:return c=t.sent,t.next=13,c.arrayBuffer();case 13:n=t.sent;case 14:t.next=43;break;case 16:if(!("undefined"!=typeof HTMLElement&&r instanceof HTMLElement)){t.next=30;break}if("IMG"!==r.tagName){t.next=21;break}return t.next=20,a(r.src);case 20:n=t.sent;case 21:if("VIDEO"!==r.tagName){t.next=25;break}return t.next=24,a(r.poster);case 24:n=t.sent;case 25:if("CANVAS"!==r.tagName){t.next=28;break}return t.next=28,new Promise((function(t){r.toBlob(function(){var r=o(e().mark((function r(o){return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i(o);case 2:n=r.sent,t();case 4:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}())}));case 28:t.next=43;break;case 30:if(!("undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas)){t.next=39;break}return t.next=33,r.convertToBlob();case 33:return u=t.sent,t.next=36,i(u);case 36:n=t.sent,t.next=43;break;case 39:if(!(r instanceof File||r instanceof Blob)){t.next=43;break}return t.next=42,i(r);case 42:n=t.sent;case 43:return t.abrupt("return",new Uint8Array(n));case 44:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}();t.exports=a},202:t=>{t.exports=function(t,r){t.onmessage=function(t){var e=t.data;r(e)}}},772:t=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(){"use strict";e=function(){return t};var t={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype),c=new P(n||[]);return i(a,"_invoke",{value:O(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var g={};l(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(k([])));b&&b!==n&&o.call(b,c)&&(g=b);var w=d.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,e){function n(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):e.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return n("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function E(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,E(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}t.exports=function(){var t,r=(t=e().mark((function t(r,n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.postMessage(n);case 1:case"end":return t.stop()}}),t)})),function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()},676:t=>{t.exports=function(t){var r,e=t.workerPath,n=t.workerBlobURL;if(Blob&&URL&&n){var o=new Blob(['importScripts("'.concat(e,'");')],{type:"application/javascript"});r=new Worker(URL.createObjectURL(o))}else r=new Worker(e);return r}},100:t=>{t.exports=function(t){t.terminate()}},147:t=>{"use strict";t.exports={i8:"5.1.1"}}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={id:n,loaded:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}return e.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),e(352)})())); -//# sourceMappingURL=tesseract.min.js.map \ No newline at end of file diff --git a/public/assets/ai/tesseract/worker.min.js b/public/assets/ai/tesseract/worker.min.js deleted file mode 100644 index 3682d39..0000000 --- a/public/assets/ai/tesseract/worker.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see worker.min.js.LICENSE.txt */ -(()=>{var t={919:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),a=o[0],s=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),f=0,h=s>0?a-4:a;for(r=0;r>16&255,c[f++]=e>>8&255,c[f++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[f++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,u=n-i;su?u:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,n){for(var i,o,a=[],s=e;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},86:(t,e,r)=>{var n=r(752),i=r(773);t.exports={encode:n,decode:i}},773:(t,e,r)=>{var n=r(33).lW;function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<=0?this.height-1:-this.height;for(r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i>7-s&1];this.data[a+4*s]=0,this.data[a+4*s+1]=u.blue,this.data[a+4*s+2]=u.green,this.data[a+4*s+3]=u.red}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){if(2==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=4};this.data.fill(255);for(var e=0,r=this.bottom_up?this.height-1:0,n=!1;e>4),1&c&&c+1>1&1)&&this.pos++}}else for(c=0;c>4),n=!n}}else{var f=Math.ceil(this.width/2),h=f%4;for(s=this.height-1;s>=0;s--){var l=this.bottom_up?s:this.height-1-s;for(a=0;a>4,d=15&o,y=this.palette[p];if(this.data[e]=0,this.data[e+1]=y.blue,this.data[e+2]=y.green,this.data[e+3]=y.red,2*a+1>=this.width)break;y=this.palette[d],this.data[e+4]=0,this.data[e+4+1]=y.blue,this.data[e+4+2]=y.green,this.data[e+4+3]=y.red}0!=h&&(this.pos+=4-h)}}},i.prototype.bit8=function(){if(1==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=4};this.data.fill(255);for(var e=0,r=this.bottom_up?this.height-1:0;e=0;a--){var f=this.bottom_up?a:this.height-1-a;for(o=0;o=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i>5&e)/e*255|0,u=(o>>10&e)/e*255|0,c=o>>15?255:0,f=n*this.width*4+4*i;this.data[f]=c,this.data[f+1]=a,this.data[f+2]=s,this.data[f+3]=u}this.pos+=t}},i.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],r=0;r<16;r++)this.maskRed>>r&1&&e[0]++,this.maskGreen>>r&1&&e[1]++,this.maskBlue>>r&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var n=this.height-1;n>=0;n--){for(var i=this.bottom_up?n:this.height-1-n,o=0;o>e[1],c=(a&this.maskRed)>>e[2],f=i*this.width*4+4*o;this.data[f]=0,this.data[f+1]=s,this.data[f+2]=u,this.data[f+3]=c}this.pos+=t}},i.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(e=this.bottom_up?t:this.height-1-t,r=0;r{var n=r(33).lW;function i(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}i.prototype.encode=function(){var t=new n(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,r=3*this.width+this.extraBytes,i=0;i0){var s=this.pos+i*r+3*this.width;t.fill(0,s,s+this.extraBytes)}}return t},t.exports=function(t,e){return void 0===e&&(e=100),{data:new i(t).encode(),width:t.width,height:t.height}}},33:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;rh)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return g(t)}return d(t,e,r)}function d(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|m(t,e),n=l(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(tt(t,Uint8Array)){var e=new Uint8Array(t);return b(e.buffer,e.byteOffset,e.byteLength)}return v(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+s(t));if(tt(t,ArrayBuffer)||t&&tt(t.buffer,ArrayBuffer))return b(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(tt(t,SharedArrayBuffer)||t&&tt(t.buffer,SharedArrayBuffer)))return b(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return p.from(n,e,r);var i=function(t){if(p.isBuffer(t)){var e=0|w(t.length),r=l(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||et(t.length)?l(0):v(t):"Buffer"===t.type&&Array.isArray(t.data)?v(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return p.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+s(t))}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function g(t){return y(t),l(t<0?0:0|w(t))}function v(t){for(var e=t.length<0?0:0|w(t.length),r=l(e),n=0;n=h)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h.toString(16)+" bytes");return 0|t}function m(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||tt(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+s(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(i)return n?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function E(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return j(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function A(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),et(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=p.from(e,n)),p.isBuffer(e))return 0===e.length?-1:k(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):k(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function k(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,l=0;li&&(n=i):n=i;var o,a=e.length;for(n>a/2&&(n=a/2),o=0;o>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?u.fromByteArray(t):u.fromByteArray(t.slice(e,r))}function j(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:o>223?3:o>191?2:1;if(i+s<=r){var u=void 0,c=void 0,f=void 0,h=void 0;switch(s){case 1:o<128&&(a=o);break;case 2:128==(192&(u=t[i+1]))&&(h=(31&o)<<6|63&u)>127&&(a=h);break;case 3:u=t[i+1],c=t[i+2],128==(192&u)&&128==(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c)>2047&&(h<55296||h>57343)&&(a=h);break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f)>65535&&h<1114112&&(a=h)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn.length?(p.isBuffer(o)||(o=p.from(o)),o.copy(n,i)):Uint8Array.prototype.set.call(n,o,i);else{if(!p.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},p.byteLength=m,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;er&&(t+=" ... "),""},f&&(p.prototype[f]=p.prototype.inspect),p.prototype.compare=function(t,e,r,n,i){if(tt(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+s(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return O(this,t,e,r);case"ascii":case"latin1":case"binary":return I(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i){H(e,n,i,t,r,7);var o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function G(t,e,r,n,i){H(e,n,i,t,r,7);var o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function z(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,0,r,4),c.write(t,e,r,n,23,4),r+4}function W(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,0,r,8),c.write(t,e,r,n,52,8),r+8}p.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},p.prototype.readUint8=p.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},p.prototype.readBigUInt64LE=nt((function(t){K(t>>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||J(t,this.length-8);var n=e+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,24),i=this[++t]+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+r*Math.pow(2,24);return BigInt(n)+(BigInt(i)<>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||J(t,this.length-8);var n=e*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t],i=this[++t]*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+r;return(BigInt(n)<>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},p.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},p.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},p.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},p.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},p.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},p.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},p.prototype.readBigInt64LE=nt((function(t){K(t>>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||J(t,this.length-8);var n=this[t+4]+this[t+5]*Math.pow(2,8)+this[t+6]*Math.pow(2,16)+(r<<24);return(BigInt(n)<>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||J(t,this.length-8);var n=(e<<24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t];return(BigInt(n)<>>=0,e||N(t,4,this.length),c.read(this,t,!0,23,4)},p.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),c.read(this,t,!1,23,4)},p.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),c.read(this,t,!0,52,8)},p.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),c.read(this,t,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},p.prototype.writeUint8=p.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},p.prototype.writeBigUInt64LE=nt((function(t){return F(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=nt((function(t){return G(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},p.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},p.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},p.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},p.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},p.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},p.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},p.prototype.writeBigInt64LE=nt((function(t){return F(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=nt((function(t){return G(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},p.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},p.prototype.writeDoubleLE=function(t,e,r){return W(this,t,e,!0,r)},p.prototype.writeDoubleBE=function(t,e,r){return W(this,t,e,!1,r)},p.prototype.copy=function(t,e,r,n){if(!p.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o=n+4;r-=3)e="_".concat(t.slice(r-3,r)).concat(e);return"".concat(t.slice(0,r)).concat(e)}function H(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?">= 0".concat(s," and < 2").concat(s," ** ").concat(8*(o+1)).concat(s):">= -(2".concat(s," ** ").concat(8*(o+1)-1).concat(s,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(s):">= ".concat(e).concat(s," and <= ").concat(r).concat(s),new Y.ERR_OUT_OF_RANGE("value",a,t)}!function(t,e,r){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||J(e,t.length-(r+1))}(n,i,o)}function K(t,e){if("number"!=typeof t)throw new Y.ERR_INVALID_ARG_TYPE(e,"number",t)}function J(t,e,r){if(Math.floor(t)!==t)throw K(t,r),new Y.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new Y.ERR_BUFFER_OUT_OF_BOUNDS;throw new Y.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(e),t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?"".concat(t," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return'The "'.concat(t,'" argument must be of type number. Received type ').concat(s(e))}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,r){var n='The value of "'.concat(t,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?i=q(String(r)):"bigint"==typeof r&&(i=String(r),(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(i=q(i)),i+="n"),n+" It must be ".concat(e,". Received ").concat(i)}),RangeError);var X=/[^+/0-9A-Za-z-_]/g;function $(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Q(t){return u.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Z(t,e,r,n){var i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function tt(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function et(t){return t!=t}var rt=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}();function nt(t){return"undefined"==typeof BigInt?it:t}function it(){throw new Error("BigInt not supported")}},226:(t,e)=>{e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,f=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-f)-1,p>>=-f,f+=s;f>0;o=256*o+t[e+h],h+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*y}},670:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}t.exports=function(){return"undefined"!=typeof window&&"object"===e(window.process)&&"renderer"===window.process.type||!("undefined"==typeof process||"object"!==e(process.versions)||!process.versions.electron)||"object"===("undefined"==typeof navigator?"undefined":e(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},975:t=>{t.exports=function(t){if("string"!=typeof t)return!1;var i=t.match(e);if(!i)return!1;var o=i[1];return!!o&&!(!r.test(o)&&!n.test(o))};var e=/^(?:\w+:)?\/\/(\S+)$/,r=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/},760:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var i=function(t){"use strict";var e,r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),s=new j(n||[]);return o(a,"_invoke",{value:I(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var p="suspendedStart",d="suspendedYield",y="executing",g="completed",v={};function b(){}function w(){}function m(){}var E={};f(E,s,(function(){return this}));var x=Object.getPrototypeOf,A=x&&x(x(B([])));A&&A!==r&&i.call(A,s)&&(E=A);var k=m.prototype=b.prototype=Object.create(E);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"===n(h)&&i.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(h).then((function(t){f.value=t,s(f)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function I(t,e,r){var n=p;return function(i,o){if(n===y)throw new Error("Generator is already running");if(n===g){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=S(a,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?g:d,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=g,r.method="throw",r.arg=u.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function U(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function B(t){if(t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),U(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;U(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:B(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}("object"===n(t=r.nmd(t))?t.exports:{});try{regeneratorRuntime=i}catch(t){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},506:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),s=new I(n||[]);return o(a,"_invoke",{value:A(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var p={};function d(){}function y(){}function g(){}var v={};f(v,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(S([])));w&&w!==e&&r.call(w,s)&&(v=w);var m=g.prototype=d.prototype=Object.create(v);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):e.resolve(h).then((function(t){f.value=t,s(f)}),(function(t){return i("throw",t,s,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function A(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var i=l(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function o(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(t){o(a,n,i,s,u,"next",t)}function u(t){o(a,n,i,s,u,"throw",t)}s(void 0)}))}}r.r(e),r.d(e,{bigInt:()=>s,bulkMemory:()=>u,exceptions:()=>c,multiValue:()=>f,mutableGlobals:()=>h,referenceTypes:()=>l,saturatedFloatToInt:()=>p,signExtensions:()=>d,simd:()=>y,tailCall:()=>g,threads:()=>v});var s=function(){return(t=a(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,WebAssembly.instantiate(e);case 3:return t.t0=t.sent.instance.exports.b(BigInt(0)),t.t1=BigInt(0),t.abrupt("return",t.t0===t.t1);case 8:return t.prev=8,t.t2=t.catch(0),t.abrupt("return",!1);case 11:case"end":return t.stop()}}),t,null,[[0,8]])}))),function(e){return t.apply(this,arguments)})(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,126,1,126,3,2,1,0,7,5,1,1,98,0,0,10,6,1,4,0,32,0,11]));var t},u=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),c=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),f=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,0,2,127,127,3,2,1,0,10,8,1,6,0,65,0,65,0,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),h=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),l=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,208,112,26,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),p=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),y=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),g=function(){var t=a(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,6,1,4,0,18,0,11])));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),v=function(){return(t=a(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.abrupt("return",("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)));case 4:return t.prev=4,t.t0=t.catch(0),t.abrupt("return",!1);case 7:case"end":return t.stop()}}),t,null,[[0,4]])}))),function(e){return t.apply(this,arguments)})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var t}},645:function(t,e,r){var n=r(33).lW;(function(){"use strict";function t(t){throw t}var r=void 0,i=!0,o="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function a(e,r){this.index="number"==typeof r?r:0,this.m=0,this.buffer=e instanceof(o?Uint8Array:Array)?e:new(o?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,r=e.length,n=new(o?Uint8Array:Array)(r<<1);if(o)n.set(e);else for(t=0;t>>8&255]<<16|l[t>>>16&255]<<8|l[t>>>24&255])>>32-e:l[t]>>8-e),8>e+a)s=s<>e-n-1&1,8==++a&&(a=0,i[o++]=l[s],s=0,o===i.length&&(i=this.f()));i[o]=s,this.buffer=i,this.m=a,this.index=o},a.prototype.finish=function(){var t,e=this.buffer,r=this.index;return 0s;++s){for(var c=h=s,f=7,h=h>>>1;h;h>>>=1)c<<=1,c|=1&h,--f;u[s]=(c<>>0}var l=u;function p(t,e,r){var n,i="number"==typeof e?e:e=0,o="number"==typeof r?r:t.length;for(n=-1,i=7&o;i--;++e)n=n>>>8^y[255&(n^t[e])];for(i=o>>3;i--;e+=8)n=(n=(n=(n=(n=(n=(n=(n=n>>>8^y[255&(n^t[e])])>>>8^y[255&(n^t[e+1])])>>>8^y[255&(n^t[e+2])])>>>8^y[255&(n^t[e+3])])>>>8^y[255&(n^t[e+4])])>>>8^y[255&(n^t[e+5])])>>>8^y[255&(n^t[e+6])])>>>8^y[255&(n^t[e+7])];return(4294967295^n)>>>0}var d=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],y=o?new Uint32Array(d):d;function g(){}function v(t){this.buffer=new(o?Uint16Array:Array)(2*t),this.length=0}function b(t){var e,r,n,i,a,s,u,c,f,h,l=t.length,p=0,d=Number.POSITIVE_INFINITY;for(c=0;cp&&(p=t[c]),t[c]>=1;for(h=n<<16|c,f=s;fo[n]);)i=o[r],o[r]=o[n],o[n]=i,i=o[r+1],o[r+1]=o[n+1],o[n+1]=i,r=n;return this.length},v.prototype.pop=function(){var t,e,r,n,i,o=this.buffer;for(e=o[0],t=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],i=0;!((n=2*i+2)>=this.length)&&(n+2o[n]&&(n+=2),o[n]>o[i]);)r=o[i],o[i]=o[n],o[n]=r,r=o[i+1],o[i+1]=o[n+1],o[n+1]=r,i=n;return{index:t,value:e,length:this.length}};var m,E=2,x={NONE:0,L:1,t:E,X:3},A=[];for(m=0;288>m;m++)switch(i){case 143>=m:A.push([m+48,8]);break;case 255>=m:A.push([m-144+400,9]);break;case 279>=m:A.push([m-256+0,7]);break;case 287>=m:A.push([m-280+192,8]);break;default:t("invalid literal: "+m)}function k(t,e){this.length=t,this.N=e}w.prototype.h=function(){var e,n,s,u,c=this.input;switch(this.k){case 0:for(s=0,u=c.length;s>>8&255,v[b++]=255&l,v[b++]=l>>>8&255,o)v.set(p,b),b+=p.length,v=v.subarray(0,b);else{for(y=0,g=p.length;yJ)for(;0J?J:138)>J-3&&Q=Q?(rt[$++]=17,rt[$++]=Q-3,nt[17]++):(rt[$++]=18,rt[$++]=Q-11,nt[18]++),J-=Q;else if(rt[$++]=et[H],nt[et[H]]++,3>--J)for(;0J?J:6)>J-3&&QD;D++)q[D]=M[V[D]];for(T=19;4=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var r,n,o=[];for(r=3;258>=r;r++)n=e(r),o[r]=n[2]<<24|n[1]<<16|n[0];return o}(),O=o?new Uint32Array(_):_;function I(e,n){function a(e,r){var n,o,a,s,u=e.N,c=[],f=0;switch(n=O[e.length],c[f++]=65535&n,c[f++]=n>>16&255,c[f++]=n>>24,i){case 1===u:o=[0,u-1,0];break;case 2===u:o=[1,u-2,0];break;case 3===u:o=[2,u-3,0];break;case 4===u:o=[3,u-4,0];break;case 6>=u:o=[4,u-5,1];break;case 8>=u:o=[5,u-7,1];break;case 12>=u:o=[6,u-9,2];break;case 16>=u:o=[7,u-13,2];break;case 24>=u:o=[8,u-17,3];break;case 32>=u:o=[9,u-25,3];break;case 48>=u:o=[10,u-33,4];break;case 64>=u:o=[11,u-49,4];break;case 96>=u:o=[12,u-65,5];break;case 128>=u:o=[13,u-97,5];break;case 192>=u:o=[14,u-129,6];break;case 256>=u:o=[15,u-193,6];break;case 384>=u:o=[16,u-257,7];break;case 512>=u:o=[17,u-385,7];break;case 768>=u:o=[18,u-513,8];break;case 1024>=u:o=[19,u-769,8];break;case 1536>=u:o=[20,u-1025,9];break;case 2048>=u:o=[21,u-1537,9];break;case 3072>=u:o=[22,u-2049,10];break;case 4096>=u:o=[23,u-3073,10];break;case 6144>=u:o=[24,u-4097,11];break;case 8192>=u:o=[25,u-6145,11];break;case 12288>=u:o=[26,u-8193,12];break;case 16384>=u:o=[27,u-12289,12];break;case 24576>=u:o=[28,u-16385,13];break;case 32768>=u:o=[29,u-24577,13];break;default:t("invalid distance")}for(n=o,c[f++]=n[0],c[f++]=n[1],c[f++]=n[2],a=0,s=c.length;a=c;)m[c++]=0;for(c=0;29>=c;)E[c++]=0}for(m[256]=1,s=0,u=n.length;s=u){for(d&&a(d,-1),c=0,f=u-s;co&&e+oc&&(i=n,c=o),258===o)break}return new k(c,e-i)}function L(t,e){var r,n,i,a,s,u=t.length,c=new v(572),f=new(o?Uint8Array:Array)(u);if(!o)for(a=0;a2*f[a-1]+h[a]&&(f[a]=2*f[a-1]+h[a]),p[a]=Array(f[a]),d[a]=Array(f[a]);for(i=0;it[i]?(p[a][s]=u,d[a][s]=e,c+=2):(p[a][s]=t[i],d[a][s]=i,++i);y[a]=0,1===h[a]&&n(a)}return l}(n,n.length,e),a=0,s=r.length;a>>=1;return a}function j(t,e){this.input=t,this.b=this.c=0,this.g={},e&&(e.flags&&(this.g=e.flags),"string"==typeof e.filename&&(this.filename=e.filename),"string"==typeof e.comment&&(this.w=e.comment),e.deflateOptions&&(this.l=e.deflateOptions)),this.l||(this.l={})}j.prototype.h=function(){var t,e,n,i,a,s,u,c,f=new(o?Uint8Array:Array)(32768),h=0,l=this.input,d=this.c,y=this.filename,g=this.w;if(f[h++]=31,f[h++]=139,f[h++]=8,t=0,this.g.fname&&(t|=P),this.g.fcomment&&(t|=R),this.g.fhcrc&&(t|=T),f[h++]=t,e=(Date.now?Date.now():+new Date)/1e3|0,f[h++]=255&e,f[h++]=e>>>8&255,f[h++]=e>>>16&255,f[h++]=e>>>24&255,f[h++]=0,f[h++]=B,this.g.fname!==r){for(u=0,c=y.length;u>>8&255),f[h++]=255&s;f[h++]=0}if(this.g.comment){for(u=0,c=g.length;u>>8&255),f[h++]=255&s;f[h++]=0}return this.g.fhcrc&&(n=65535&p(f,0,h),f[h++]=255&n,f[h++]=n>>>8&255),this.l.outputBuffer=f,this.l.outputIndex=h,f=(a=new w(l,this.l)).h(),h=a.b,o&&(h+8>f.buffer.byteLength?(this.a=new Uint8Array(h+8),this.a.set(new Uint8Array(f.buffer)),f=this.a):f=new Uint8Array(f.buffer)),i=p(l,r,r),f[h++]=255&i,f[h++]=i>>>8&255,f[h++]=i>>>16&255,f[h++]=i>>>24&255,c=l.length,f[h++]=255&c,f[h++]=c>>>8&255,f[h++]=c>>>16&255,f[h++]=c>>>24&255,this.c=d,o&&h>>=1){case 0:var n=this.input,a=this.c,s=this.a,u=this.b,c=n.length,f=r,h=s.length,l=r;switch(this.e=this.j=0,a+1>=c&&t(Error("invalid uncompressed block header: LEN")),f=n[a++]|n[a++]<<8,a+1>=c&&t(Error("invalid uncompressed block header: NLEN")),f===~(n[a++]|n[a++]<<8)&&t(Error("invalid uncompressed block header: length verify")),a+f>n.length&&t(Error("input buffer is broken")),this.q){case N:for(;u+f>s.length;){if(f-=l=h-u,o)s.set(n.subarray(a,a+l),u),u+=l,a+=l;else for(;l--;)s[u++]=n[a++];this.b=u,s=this.f(),u=this.b}break;case M:for(;u+f>s.length;)s=this.f({B:2});break;default:t(Error("invalid inflate mode"))}if(o)s.set(n.subarray(a,a+f),u),u+=f,a+=f;else for(;f--;)s[u++]=n[a++];this.c=a,this.b=u,this.a=s;break;case 1:this.r(tt,rt);break;case 2:var p,d,y,g,v=nt(this,5)+257,w=nt(this,5)+1,m=nt(this,4)+4,E=new(o?Uint8Array:Array)(D.length),x=r,A=r,k=r,_=r,O=r;for(O=0;O=F?8:255>=F?9:279>=F?7:8;var Q,Z,tt=b($),et=new(o?Uint8Array:Array)(30);for(Q=0,Z=et.length;Q=u&&t(Error("input buffer is broken")),i|=a[s++]<>>r,e.e=o-r,e.c=s,n}function it(e,r){for(var n,i,o=e.j,a=e.e,s=e.input,u=e.c,c=s.length,f=r[0],h=r[1];a=c);)o|=s[u++]<>>16)>a&&t(Error("invalid code length: "+i)),e.j=o>>i,e.e=a-i,e.c=u,65535&n}function ot(t){this.input=t,this.c=0,this.G=[],this.R=!1}function at(t){if("string"==typeof t){var e,r,n=t.split("");for(e=0,r=n.length;e>>0;t=n}for(var i,o=1,a=0,s=t.length,u=0;0>>0}function st(e,r){var n,i;this.input=e,this.c=0,!r&&(r={})||(r.index&&(this.c=r.index),r.verify&&(this.V=r.verify)),n=e[this.c++],i=e[this.c++],(15&n)===ut?this.method=ut:t(Error("unsupported compression method")),0!=((n<<8)+i)%31&&t(Error("invalid fcheck flag:"+((n<<8)+i)%31)),32&i&&t(Error("fdict flag is not supported")),this.J=new C(e,{index:this.c,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}C.prototype.r=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,a,s,u=r.length-258;256!==(i=it(this,t));)if(256>i)n>=u&&(this.b=n,r=this.f(),n=this.b),r[n++]=i;else for(s=Y[o=i-257],0=u&&(this.b=n,r=this.f(),n=this.b);s--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},C.prototype.Q=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,a,s,u=r.length;256!==(i=it(this,t));)if(256>i)n>=u&&(u=(r=this.f()).length),r[n++]=i;else for(s=Y[o=i-257],0u&&(u=(r=this.f()).length);s--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},C.prototype.f=function(){var t,e,r=new(o?Uint8Array:Array)(this.b-32768),n=this.b-32768,i=this.a;if(o)r.set(i.subarray(32768,r.length));else for(t=0,e=r.length;tt;++t)i[t]=i[n+t];return this.b=32768,i},C.prototype.S=function(t){var e,r,n,i=this.input.length/this.c+1|0,a=this.input,s=this.a;return t&&("number"==typeof t.B&&(i=t.B),"number"==typeof t.M&&(i+=t.M)),r=2>i?(n=(a.length-this.c)/this.A[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},ot.prototype.i=function(){for(var e=this.input.length;this.c>>0,p(n,r,r)!==y&&t(Error("invalid CRC-32 checksum: 0x"+p(n,r,r).toString(16)+" / 0x"+y.toString(16))),s.Z=u=(v[b++]|v[b++]<<8|v[b++]<<16|v[b++]<<24)>>>0,(4294967295&n.length)!==u&&t(Error("invalid input size: "+(4294967295&n.length)+" / "+u)),this.G.push(s),this.c=b}this.R=i;var w,m,E,x=this.G,A=0,k=0;for(w=0,m=x.length;w>>0!==at(e)&&t(Error("invalid adler-32 checksum")),e};var ut=8;function ct(t,e){this.input=t,this.a=new(o?Uint8Array:Array)(32768),this.k=ft.t;var r,n={};for(r in!e&&(e={})||"number"!=typeof e.compressionType||(this.k=e.compressionType),e)n[r]=e[r];n.outputBuffer=this.a,this.I=new w(this.input,n)}var ft=x;function ht(t,e){var r;return r=new ct(t).h(),e||(e={}),e.H?r:yt(r)}function lt(t,e){var r;return t.subarray=t.slice,r=new st(t).i(),e||(e={}),e.noBuffer?r:yt(r)}function pt(t,e){var r;return t.subarray=t.slice,r=new j(t).h(),e||(e={}),e.H?r:yt(r)}function dt(t,e){var r;return t.subarray=t.slice,r=new ot(t).i(),e||(e={}),e.H?r:yt(r)}function yt(t){var e,r,i=new n(t.length);for(e=0,r=t.length;e>24&255,u[c++]=s>>16&255,u[c++]=s>>8&255,u[c++]=255&s,u},e.deflate=function(t,e,r){process.nextTick((function(){var n,i;try{i=ht(t,r)}catch(t){n=t}e(n,i)}))},e.deflateSync=ht,e.inflate=function(t,e,r){process.nextTick((function(){var n,i;try{i=lt(t,r)}catch(t){n=t}e(n,i)}))},e.inflateSync=lt,e.gzip=function(t,e,r){process.nextTick((function(){var n,i;try{i=pt(t,r)}catch(t){n=t}e(n,i)}))},e.gzipSync=pt,e.gunzip=function(t,e,r){process.nextTick((function(){var n,i;try{i=dt(t,r)}catch(t){n=t}e(n,i)}))},e.gunzipSync=dt}).call(this)},711:t=>{t.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}},862:t=>{t.exports={COLOR:0,GREY:1,BINARY:2}},129:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var i=r(670);t.exports=function(t){var e={};return"undefined"!=typeof WorkerGlobalScope?e.type="webworker":i()?e.type="electron":"object"===("undefined"==typeof document?"undefined":n(document))?e.type="browser":"object"===("undefined"==typeof process?"undefined":n(process))&&(e.type="node"),void 0===t?e:e[t]}},185:function(t,e){var r=this,n=!1;e.logging=n,e.setLogging=function(t){n=t},e.log=function(){for(var t=arguments.length,e=new Array(t),i=0;i{var n=r(160),i=n.set,o=n.get,a=n.del;t.exports={readCache:o,writeCache:i,deleteCache:a,checkCache:function(t){return o(t).then((function(t){return void 0!==t}))}}},485:(t,e,r)=>{function n(){"use strict";n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),s=new I(n||[]);return o(a,"_invoke",{value:A(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var p={};function d(){}function y(){}function g(){}var v={};f(v,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(S([])));w&&w!==e&&r.call(w,s)&&(v=w);var m=g.prototype=d.prototype=Object.create(v);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==i(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(h).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return a=a?a.then(i,i):i()}})}function A(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var i=l(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}var a=r(506).simd,s=r(147).HO._X;t.exports=function(){var t,e=(t=n().mark((function t(e,o,u){var c,f,h,l;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==r.g.TesseractCore){t.next=20;break}if(c="loading tesseract core",u.progress({status:c,progress:0}),"js"!==(f=o||"https://cdn.jsdelivr.net/npm/tesseract.js-core@v".concat(s.substring(1))).slice(-2)){t.next=8;break}h=f,t.next=12;break;case 8:return t.next=10,a();case 10:l=t.sent,h="".concat(f.replace(/\/$/,""),l?e?"/tesseract-core-simd-lstm.wasm.js":"/tesseract-core-simd.wasm.js":e?"/tesseract-core-lstm.wasm.js":"/tesseract-core.wasm.js");case 12:if(r.g.importScripts(h),void 0!==r.g.TesseractCore||void 0===r.g.TesseractCoreWASM||"object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly))){t.next=17;break}r.g.TesseractCore=r.g.TesseractCoreWASM,t.next=19;break;case 17:if(void 0!==r.g.TesseractCore){t.next=19;break}throw Error("Failed to load TesseractCore");case 19:u.progress({status:c,progress:1});case 20:return t.abrupt("return",r.g.TesseractCore);case 21:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(t){o(a,n,i,s,u,"next",t)}function u(t){o(a,n,i,s,u,"throw",t)}s(void 0)}))});return function(t,r,n){return e.apply(this,arguments)}}()},687:(t,e,r)=>{t.exports=r(645).gunzipSync},730:t=>{t.exports={text:!0,blocks:!0,layoutBlocks:!1,hocr:!0,tsv:!0,box:!1,unlv:!1,osd:!1,pdf:!1,imageColor:!1,imageGrey:!1,imageBinary:!1,debug:!1}},688:(t,e,r)=>{var n=r(711);t.exports={tessedit_pageseg_mode:n.SINGLE_BLOCK,tessedit_char_whitelist:"",tessjs_create_hocr:"1",tessjs_create_tsv:"1",tessjs_create_box:"0",tessjs_create_unlv:"0",tessjs_create_osd:"0"}},217:function(t,e,r){var n=this;function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function f(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){f(o,n,i,a,s,"next",t)}function s(t){f(o,n,i,a,s,"throw",t)}a(void 0)}))}}r(760);var l,p,d,y,g=r(975),v=r(333),b=r(129)("type"),w=r(472),m=r(688),E=r(730),x=r(185),A=x.log,k=x.setLogging,_=r(711),O=null,I={},S=m,L=!1,U=function(){var t=h(c().mark((function t(e,r){var n,i,o,a,s,u,f,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.workerId,i=e.jobId,o=e.payload.options,a=o.lstmOnly,s=o.corePath,u=o.logging,k(u),f="initializing tesseract",l){t.next=11;break}return t.next=6,I.getCore(a,s,r);case 6:h=t.sent,r.progress({workerId:n,status:f,progress:0}),h({TesseractProgress:function(t){p.progress({workerId:n,jobId:i,status:"recognizing text",progress:Math.max(0,(t-30)/70)})}}).then((function(t){l=t,r.progress({workerId:n,status:f,progress:1}),r.resolve({loaded:!0})})),t.next=12;break;case 11:r.resolve({loaded:!0});case 12:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),j=function(){var t=h(c().mark((function t(e,r){var n,i,o,a,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.workerId,o=e.payload,a=o.method,s=o.args,A("[".concat(i,"]: FS.").concat(a)),r.resolve((n=l.FS)[a].apply(n,function(t){if(Array.isArray(t))return u(t)}(c=s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()));case 3:case"end":return t.stop()}var c}),t)})));return function(e,r){return t.apply(this,arguments)}}(),B=function(){var t=h(c().mark((function t(e,r){var n,i,o,a,s,u,f,p,v,w,m,E,x,k,_;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.workerId,i=e.payload,o=i.langs,a=i.options,s=a.langPath,u=a.dataPath,f=a.cachePath,p=a.cacheMethod,v=a.gzip,w=void 0===v||v,m=a.lstmOnly,d=o,y={langPath:s,dataPath:u,cachePath:f,cacheMethod:p,gzip:w,lstmOnly:m},E="loading language traineddata",x="string"==typeof o?o.split("+"):o,k=0,_=function(){var t=h(c().mark((function t(e){var i,o,a,h,d,y,v,_,O;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i="string"==typeof e?e:e.code,o=["refresh","none"].includes(p)?function(){return Promise.resolve()}:I.readCache,a=null,h=!1,t.prev=4,t.next=7,o("".concat(f||".","/").concat(i,".traineddata"));case 7:if(void 0===(d=t.sent)){t.next=14;break}A("[".concat(n,"]: Load ").concat(i,".traineddata from cache")),a=d,L=!0,t.next=15;break;case 14:throw Error("Not found in cache");case 15:t.next=45;break;case 17:if(t.prev=17,t.t0=t.catch(4),h=!0,A("[".concat(n,"]: Load ").concat(i,".traineddata from ").concat(s)),"string"!=typeof e){t.next=44;break}if(y=null,v=s||"https://cdn.jsdelivr.net/npm/@tesseract.js-data/".concat(i,m?"/4.0.0_best_int":"/4.0.0"),("node"!==b||g(v)||v.startsWith("moz-extension://")||v.startsWith("chrome-extension://")||v.startsWith("file://"))&&(y=v.replace(/\/$/,"")),null===y){t.next=39;break}return _="".concat(y,"/").concat(i,".traineddata").concat(w?".gz":""),t.next=29,("webworker"===b?fetch:I.fetch)(_);case 29:if((O=t.sent).ok){t.next=32;break}throw Error("Network error while fetching ".concat(_,". Response code: ").concat(O.status));case 32:return t.t1=Uint8Array,t.next=35,O.arrayBuffer();case 35:t.t2=t.sent,a=new t.t1(t.t2),t.next=42;break;case 39:return t.next=41,I.readCache("".concat(v,"/").concat(i,".traineddata").concat(w?".gz":""));case 41:a=t.sent;case 42:t.next=45;break;case 44:a=e.data;case 45:if(k+=.5/x.length,r&&r.progress({workerId:n,status:E,progress:k}),(31===a[0]&&139===a[1]||31===a[1]&&139===a[0])&&(a=I.gunzip(a)),l){if(u)try{l.FS.mkdir(u)}catch(t){r&&r.reject(t.toString())}l.FS.writeFile("".concat(u||".","/").concat(i,".traineddata"),a)}if(!h||!["write","refresh",void 0].includes(p)){t.next=60;break}return t.prev=51,t.next=54,I.writeCache("".concat(f||".","/").concat(i,".traineddata"),a);case 54:t.next=60;break;case 56:t.prev=56,t.t3=t.catch(51),A("[".concat(n,"]: Failed to write ").concat(i,".traineddata to cache due to error:")),A(t.t3.toString());case 60:k+=.5/x.length,100===Math.round(100*k)&&(k=1),r&&r.progress({workerId:n,status:E,progress:k});case 63:case"end":return t.stop()}}),t,null,[[4,17],[51,56]])})));return function(e){return t.apply(this,arguments)}}(),r&&r.progress({workerId:n,status:E,progress:0}),t.prev=8,t.next=11,Promise.all(x.map(_));case 11:r&&r.resolve(o),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(8),r&&r.reject(t.t0.toString());case 17:case"end":return t.stop()}}),t,null,[[8,14]])})));return function(e,r){return t.apply(this,arguments)}}(),T=function(){var t=h(c().mark((function t(e,r){var n,i,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.payload.params,i=["ambigs_debug_level","user_words_suffix","user_patterns_suffix","user_patterns_suffix","load_system_dawg","load_freq_dawg","load_unambig_dawg","load_punc_dawg","load_number_dawg","load_bigram_dawg","tessedit_ocr_engine_mode","tessedit_init_config_only","language_model_ngram_on","language_model_use_sigmoidal_certainty"],(o=Object.keys(n).filter((function(t){return i.includes(t)})).join(", ")).length>0&&console.log("Attempted to set parameters that can only be set during initialization: ".concat(o)),Object.keys(n).filter((function(t){return!t.startsWith("tessjs_")})).forEach((function(t){O.SetVariable(t,n[t])})),S=a(a({},S),n),void 0!==r&&r.resolve(S);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),P=function(){var t=h(c().mark((function t(e,r){var n,o,a,s,u,f,h,p,g,v,b,w,E,x;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.workerId,o=e.payload,a=o.langs,s=o.oem,u=o.config,f="string"==typeof a?a:a.map((function(t){return"string"==typeof t?t:t.data})).join("+"),h="initializing api",t.prev=3,r.progress({workerId:n,status:h,progress:0}),null!==O&&O.End(),u&&"object"===i(u)&&Object.keys(u).length>0?g=JSON.stringify(u).replace(/,/g,"\n").replace(/:/g," ").replace(/["'{}]/g,""):u&&"string"==typeof u&&(g=u),"string"==typeof g&&(p="/config",l.FS.writeFile(p,g)),O=new l.TessBaseAPI,-1!==(v=O.Init(null,f,s,p))){t.next=30;break}if(!["write","refresh",void 0].includes(y.cacheMethod)){t.next=30;break}return b=f.split("+"),w=b.map((function(t){return I.deleteCache("".concat(y.cachePath||".","/").concat(t,".traineddata"))})),t.next=16,Promise.all(w);case 16:if(E=l.FS.readFile("/debugDev.txt",{encoding:"utf8",flags:"a+"}),!L||!/components are not present/.test(E)){t.next=30;break}return A("Data from cache missing requested OEM model. Attempting to refresh cache with new language data."),t.next=21,B({workerId:n,payload:{langs:d,options:y}});case 21:if(-1!==(v=O.Init(null,f,s,p))){t.next=29;break}return A("Language data refresh failed."),x=b.map((function(t){return I.deleteCache("".concat(y.cachePath||".","/").concat(t,".traineddata"))})),t.next=27,Promise.all(x);case 27:t.next=30;break;case 29:A("Language data refresh successful.");case 30:return-1===v&&r.reject("initialization failed"),S=m,t.next=34,T({payload:{params:S}});case 34:r.progress({workerId:n,status:h,progress:1}),r.resolve(),t.next=41;break;case 38:t.prev=38,t.t0=t.catch(3),r.reject(t.t0.toString());case 41:case"end":return t.stop()}}),t,null,[[3,38]])})));return function(e,r){return t.apply(this,arguments)}}(),R=function(t,e){var r=new l.TessPDFRenderer("tesseract-ocr","/",e);return r.BeginDocument(t),r.AddImage(O),r.EndDocument(),l._free(r),l.FS.readFile("/tesseract-ocr.pdf")},C=function(){var t=h(c().mark((function t(e,r){var n,i,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.payload,i=n.title,o=n.textonly,r.resolve(R(i,o));case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),N=function(t){var e=JSON.parse(JSON.stringify(E));"1"===S.tessjs_create_box&&(e.box=!0),"1"===S.tessjs_create_hocr&&(e.hocr=!0),"1"===S.tessjs_create_osd&&(e.osd=!0),"1"===S.tessjs_create_tsv&&(e.tsv=!0),"1"===S.tessjs_create_unlv&&(e.unlv=!0);for(var r=["imageColor","imageGrey","imageBinary","layoutBlocks","debug"],n=0,i=0,o=Object.keys(t);i0)for(f=0,h=Object.keys(a);f0)for(O.SaveParameters(),d=0,y=Object.keys(u);d=.005?w(l,O,o,x=S):(I&&w(l,O,o),x=0)):(x=a.rotateRadians||0,w(l,O,o,x)),"object"===i(L=a.rectangle)&&O.SetRectangle(L.left,L.top,L.width,L.height),E?(s.layoutBlocks&&O.AnalyseLayout(),A("Skipping recognition: all output options requiring recognition are disabled.")):O.Recognize(null),U=a.pdfTitle,j=a.pdfTextOnly,(B=v(l,O,m,{pdfTitle:U,pdfTextOnly:j,skipRecognition:E})).rotateRadians=x,s.debug&&l.FS.unlink("/debugInternal.txt"),Object.keys(u).length>0&&O.RestoreParameters(),r.resolve(B)}catch(t){r.reject(t.toString())}case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),G=function(){var t=h(c().mark((function t(e,r){var n,i,o,a,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.payload.image;try{w(l,O,n),i=new l.OSResults,O.DetectOS(i)?(o=i.best_result,a=o.orientation_id,s=o.script_id,r.resolve({tesseract_script_id:s,script:i.unicharset.get_script_from_script_id(s),script_confidence:o.sconfidence,orientation_degrees:[0,270,180,90][a],orientation_confidence:o.oconfidence})):r.resolve({tesseract_script_id:null,script:null,script_confidence:null,orientation_degrees:null,orientation_confidence:null})}catch(t){r.reject(t.toString())}case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),z=function(){var t=h(c().mark((function t(e,r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{null!==O&&O.End(),r.resolve({terminated:!0})}catch(t){r.reject(t.toString())}case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}();e.dispatchHandlers=function(t,e){var r=function(r,n){var i={jobId:t.jobId,workerId:t.workerId,action:t.action};e(a(a({},i),{},{status:r,data:n}))};r.resolve=r.bind(n,"resolve"),r.reject=r.bind(n,"reject"),r.progress=r.bind(n,"progress"),p=r,{load:U,FS:j,loadLanguage:B,initialize:P,setParameters:T,recognize:F,getPDF:C,detect:G,terminate:z}[t.action](t,r).catch((function(t){return r.reject(t.toString())}))},e.setAdapter=function(t){I=t}},629:t=>{t.exports=function(t){for(var e,r="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(t),o=i.byteLength,a=o%3,s=o-a,u=0;u>18]+n[(258048&e)>>12]+n[(4032&e)>>6]+n[63&e];return 1===a?(e=i[s],r+="".concat(n[(252&e)>>2]+n[(3&e)<<4],"==")):2===a&&(e=i[s]<<8|i[s+1],r+="".concat(n[(64512&e)>>10]+n[(1008&e)>>4]+n[(15&e)<<2],"=")),r}},333:(t,e,r)=>{var n=r(629),i=r(862),o=function(t){var e=t.split("\n");if(" "===e[0].substring(0,2))for(var r=0;r0){var S=O.get_n(),L=O.get_x(),U=O.get_y();I=[];for(var j=0;j{var n=r(33).lW;function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e3&&void 0!==arguments[3]?arguments[3]:0,s=66===r[0]&&77===r[1]||66===r[1]&&77===r[0],c=parseInt(null===(i=r.slice(0,500).join(" ").match(/1 18 0 3 0 0 0 1 0 (\d)/))||void 0===i?void 0:i[1],10)||1;if(s){var f=n.from(Array.from(a(a({},r),{},{length:Object.keys(r).length}))),h=u.decode(f);t.FS.writeFile("/input",u.encode(h).data)}else t.FS.writeFile("/input",r);if(1===e.SetImageFile(c,o))throw Error("Error attempting to read image.")}},160:(t,e,r)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:s())("readonly",(function(e){return i(e.get(t))}))}function c(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:s())("readwrite",(function(r){return r.put(e,t),i(r.transaction)}))}function f(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return t.forEach((function(t){return e.put(t[1],t[0])})),i(e.transaction)}))}function h(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readonly",(function(e){return Promise.all(t.map((function(t){return i(e.get(t))})))}))}function l(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:s())("readwrite",(function(r){return new Promise((function(n,o){r.get(t).onsuccess=function(){try{r.put(e(this.result),t),n(i(r.transaction))}catch(t){o(t)}}}))}))}function p(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return e.delete(t),i(e.transaction)}))}function d(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return t.forEach((function(t){return e.delete(t)})),i(e.transaction)}))}function y(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readwrite",(function(t){return t.clear(),i(t.transaction)}))}function g(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},i(t.transaction)}function v(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readonly",(function(t){if(t.getAllKeys)return i(t.getAllKeys());var e=[];return g(t,(function(t){return e.push(t.key)})).then((function(){return e}))}))}function b(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readonly",(function(t){if(t.getAll)return i(t.getAll());var e=[];return g(t,(function(t){return e.push(t.value)})).then((function(){return e}))}))}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s();return t("readonly",(function(e){if(e.getAll&&e.getAllKeys)return Promise.all([i(e.getAllKeys()),i(e.getAll())]).then((function(t){var e,r,i=(r=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,r)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];return o.map((function(t,e){return[t,a[e]]}))}));var r=[];return t("readonly",(function(t){return g(t,(function(t){return r.push([t.key,t.value])})).then((function(){return r}))}))}))}r.r(e),r.d(e,{clear:()=>y,createStore:()=>o,del:()=>p,delMany:()=>d,entries:()=>w,get:()=>u,getMany:()=>h,keys:()=>v,promisifyRequest:()=>i,set:()=>c,setMany:()=>f,update:()=>l,values:()=>b})},147:t=>{"use strict";t.exports=JSON.parse('{"HO":{"_X":"^5.1.1"}}')}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var i=r(217),o=r(485),a=r(687),s=r(779);r.g.addEventListener("message",(function(t){var e=t.data;i.dispatchHandlers(e,(function(t){return postMessage(t)}))})),i.setAdapter(function(t){for(var r=1;r(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),o=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let s;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!s)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="https://unpkg.com/@ffmpeg/core@0.12.1/dist/umd/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!s,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw o}return s=await self.createFFmpegCore({mainScriptUrlOrBlob:`${i}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),s.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),s.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{s.setTimeout(t),s.exec(...e);const r=s.ret;return s.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(s.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>s.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(s.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(s.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(s.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=s.FS.readdir(e),r=[];for(const a of t){const t=s.FS.stat(`${e}/${a}`),o=s.FS.isDir(t.mode);r.push({name:a,isDir:o})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(s.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t.toString()})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})())); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpegWASM=t():e.FFmpegWASM=t()}(self,(()=>(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),o=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let s;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!s)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="/assets/ffmpeg/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!s,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw o}return s=await self.createFFmpegCore({mainScriptUrlOrBlob:`${i}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),s.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),s.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{s.setTimeout(t),s.exec(...e);const r=s.ret;return s.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(s.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>s.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(s.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(s.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(s.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=s.FS.readdir(e),r=[];for(const a of t){const t=s.FS.stat(`${e}/${a}`),o=s.FS.isDir(t.mode);r.push({name:a,isDir:o})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(s.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t.toString()})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})())); //# sourceMappingURL=814.ffmpeg.js.map \ No newline at end of file diff --git a/public/assets/fontFamily.json b/public/assets/fontFamily.json new file mode 100644 index 0000000..707b040 --- /dev/null +++ b/public/assets/fontFamily.json @@ -0,0 +1,18 @@ +[ + { + "name": "siYuanHeiTi", + "label": "思源黑体", + "urls": { + "url": "/assets/fonts/siYuanHeiTi/font.woff", + "thumb": "/assets/fonts/siYuanHeiTi/thumb.png" + } + }, + { + "name": "aConfused", + "label": "杂体(思源黑体兜底)", + "urls": { + "url": "/assets/fonts/aConfused/font.woff", + "thumb": "/assets/fonts/aConfused/thumb.png" + } + } +] \ No newline at end of file diff --git a/public/assets/fonts/aConfused/font.woff b/public/assets/fonts/aConfused/font.woff new file mode 100644 index 0000000..3bf5bb2 Binary files /dev/null and b/public/assets/fonts/aConfused/font.woff differ diff --git a/public/assets/fonts/aConfused/thumb.png b/public/assets/fonts/aConfused/thumb.png new file mode 100644 index 0000000..9d72e7b Binary files /dev/null and b/public/assets/fonts/aConfused/thumb.png differ diff --git a/public/assets/fonts/siYuanHeiTi/font.woff b/public/assets/fonts/siYuanHeiTi/font.woff new file mode 100644 index 0000000..3bf5bb2 Binary files /dev/null and b/public/assets/fonts/siYuanHeiTi/font.woff differ diff --git a/public/assets/fonts/siYuanHeiTi/thumb.png b/public/assets/fonts/siYuanHeiTi/thumb.png new file mode 100644 index 0000000..9fb2819 Binary files /dev/null and b/public/assets/fonts/siYuanHeiTi/thumb.png differ diff --git a/public/assets/fonts/抖音美好体.otf b/public/assets/fonts/抖音美好体.otf new file mode 100644 index 0000000..d63f58d Binary files /dev/null and b/public/assets/fonts/抖音美好体.otf differ diff --git a/public/assets/images/404.png b/public/assets/images/404.png new file mode 100644 index 0000000..0d419fa Binary files /dev/null and b/public/assets/images/404.png differ diff --git a/public/assets/images/colormap.png b/public/assets/images/colormap.png new file mode 100644 index 0000000..122e07a Binary files /dev/null and b/public/assets/images/colormap.png differ diff --git a/public/assets/images/displacement_map.png b/public/assets/images/displacement_map.png new file mode 100644 index 0000000..efcc949 Binary files /dev/null and b/public/assets/images/displacement_map.png differ diff --git a/public/assets/images/lightmap.png b/public/assets/images/lightmap.png new file mode 100644 index 0000000..7cc8527 Binary files /dev/null and b/public/assets/images/lightmap.png differ diff --git a/public/assets/images/logo-black.svg b/public/assets/images/logo-black.svg index 9ed065a..291d4a7 100644 --- a/public/assets/images/logo-black.svg +++ b/public/assets/images/logo-black.svg @@ -1,6 +1,5 @@ - logo-black Created with Sketch. + + + UniCut · 该功能离线不可用 + + + +
+

该功能需要联网服务,离线部署下不可用

+

+ UniCut 本机部署版已经做到全站断网可用,但下面这个能力依赖外部站点提供服务,断网时无法访问, + 因此这里不再向外域发起任何请求。 +

+
+
可用的替代做法
+
请在编辑器内使用本地抠像 / 本地合成等离线能力。
+
为什么
+
站点的构建产物经过 data-quality/scripts/site/00_lint_dist.py 检查,外部网络引用必须为 0。
+
想恢复该功能
+
在本机部署对应服务后,把地址填回源码里的 TODO 处并重新构建即可。
+
+ 返回上一页 +
+ + + diff --git a/public/templates/index.json b/public/templates/index.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/public/templates/index.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/public/templates/soft-tpl-01.json b/public/templates/soft-tpl-01.json new file mode 100644 index 0000000..53b18ac --- /dev/null +++ b/public/templates/soft-tpl-01.json @@ -0,0 +1 @@ +{"title": "软件教程·片头标题卡", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 5.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t1a", "name": "软件教程标题", "text": "软件教程标题", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 120, "letterSpacing": 0, "lineHeight": 120, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 470}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 470}, "scale": 1, "textScale": 1}, {"id": "t1b", "name": "一句话说清它能替你干什么", "text": "一句话说清它能替你干什么", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 54, "letterSpacing": 0, "lineHeight": 54, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 600}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 600}, "scale": 1, "textScale": 1}, {"id": "t1c", "name": "零基础也能用", "text": "零基础也能用", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffd166", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 40, "letterSpacing": 0, "lineHeight": 40, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 720}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 720}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-01.png b/public/templates/soft-tpl-01.png new file mode 100644 index 0000000..d58796a Binary files /dev/null and b/public/templates/soft-tpl-01.png differ diff --git a/public/templates/soft-tpl-02.json b/public/templates/soft-tpl-02.json new file mode 100644 index 0000000..b2ea48d --- /dev/null +++ b/public/templates/soft-tpl-02.json @@ -0,0 +1 @@ +{"title": "软件教程·痛点开场", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 6.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t2a", "name": "是不是也遇到过这种情况?", "text": "是不是也遇到过这种情况?", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 96, "letterSpacing": 0, "lineHeight": 96, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 420}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 6, "ostyle": {"x": 960, "y": 420}, "scale": 1, "textScale": 1}, {"id": "t2b", "name": "文件一堆,找不到,改完还怕丢", "text": "文件一堆,找不到,改完还怕丢", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffb4ab", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 56, "letterSpacing": 0, "lineHeight": 56, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 6, "ostyle": {"x": 960, "y": 560}, "scale": 1, "textScale": 1}, {"id": "t2c", "name": "下面这个工具,10 分钟解决", "text": "下面这个工具,10 分钟解决", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#4ade80", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 64, "letterSpacing": 0, "lineHeight": 64, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 740}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 6, "ostyle": {"x": 960, "y": 740}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-02.png b/public/templates/soft-tpl-02.png new file mode 100644 index 0000000..542e748 Binary files /dev/null and b/public/templates/soft-tpl-02.png differ diff --git a/public/templates/soft-tpl-03.json b/public/templates/soft-tpl-03.json new file mode 100644 index 0000000..64e2dc3 --- /dev/null +++ b/public/templates/soft-tpl-03.json @@ -0,0 +1 @@ +{"title": "软件教程·三步操作演示", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 12, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t3a", "name": "第 1 步:下载安装", "text": "第 1 步:下载安装", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 110, "letterSpacing": 0, "lineHeight": 110, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 480}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0, "duration": 4, "ostyle": {"x": 960, "y": 480}, "scale": 1, "textScale": 1}, {"id": "t3b", "name": "打开官网,选对应系统版本", "text": "打开官网,选对应系统版本", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 620}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0, "duration": 4, "ostyle": {"x": 960, "y": 620}, "scale": 1, "textScale": 1}, {"id": "t3c", "name": "第 2 步:首次设置", "text": "第 2 步:首次设置", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 110, "letterSpacing": 0, "lineHeight": 110, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 480}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 4, "duration": 4, "ostyle": {"x": 960, "y": 480}, "scale": 1, "textScale": 1}, {"id": "t3d", "name": "只改这三个开关就够了", "text": "只改这三个开关就够了", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 620}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 4, "duration": 4, "ostyle": {"x": 960, "y": 620}, "scale": 1, "textScale": 1}, {"id": "t3e", "name": "第 3 步:做出第一个成果", "text": "第 3 步:做出第一个成果", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 100, "letterSpacing": 0, "lineHeight": 100, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 480}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 8, "duration": 4, "ostyle": {"x": 960, "y": 480}, "scale": 1, "textScale": 1}, {"id": "t3f", "name": "新建 → 保存 → 看到结果", "text": "新建 → 保存 → 看到结果", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#4ade80", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 620}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 8, "duration": 4, "ostyle": {"x": 960, "y": 620}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-03.png b/public/templates/soft-tpl-03.png new file mode 100644 index 0000000..c7f7baa Binary files /dev/null and b/public/templates/soft-tpl-03.png differ diff --git a/public/templates/soft-tpl-04.json b/public/templates/soft-tpl-04.json new file mode 100644 index 0000000..5b78ab8 --- /dev/null +++ b/public/templates/soft-tpl-04.json @@ -0,0 +1 @@ +{"title": "软件教程·功能三宫格", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 9.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t4a", "name": "三个最值得用的功能", "text": "三个最值得用的功能", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 88, "letterSpacing": 0, "lineHeight": 88, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 260}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 260}, "scale": 1, "textScale": 1}, {"id": "t4b", "name": "① 一键批量处理", "text": "① 一键批量处理", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 480, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 480, "y": 560}, "scale": 1, "textScale": 1}, {"id": "t4c", "name": "② 本地保存不上传", "text": "② 本地保存不上传", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 560}, "scale": 1, "textScale": 1}, {"id": "t4d", "name": "③ 免费无广告", "text": "③ 免费无广告", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 1440, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 1440, "y": 560}, "scale": 1, "textScale": 1}, {"id": "t4e", "name": "三步之内就能看到效果", "text": "三步之内就能看到效果", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 46, "letterSpacing": 0, "lineHeight": 46, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 760}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 760}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-04.png b/public/templates/soft-tpl-04.png new file mode 100644 index 0000000..660fcf6 Binary files /dev/null and b/public/templates/soft-tpl-04.png differ diff --git a/public/templates/soft-tpl-05.json b/public/templates/soft-tpl-05.json new file mode 100644 index 0000000..6995f90 --- /dev/null +++ b/public/templates/soft-tpl-05.json @@ -0,0 +1 @@ +{"title": "软件教程·前后对比", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 8.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t5a", "name": "用之前", "text": "用之前", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ff8a80", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 72, "letterSpacing": 0, "lineHeight": 72, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 480, "y": 330}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 8, "ostyle": {"x": 480, "y": 330}, "scale": 1, "textScale": 1}, {"id": "t5b", "name": "手动一个个改,半小时", "text": "手动一个个改,半小时", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 480, "y": 470}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 8, "ostyle": {"x": 480, "y": 470}, "scale": 1, "textScale": 1}, {"id": "t5c", "name": "用之后", "text": "用之后", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#4ade80", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 72, "letterSpacing": 0, "lineHeight": 72, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 1440, "y": 330}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 8, "ostyle": {"x": 1440, "y": 330}, "scale": 1, "textScale": 1}, {"id": "t5d", "name": "一键批处理,30 秒搞定", "text": "一键批处理,30 秒搞定", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 1440, "y": 470}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 8, "ostyle": {"x": 1440, "y": 470}, "scale": 1, "textScale": 1}, {"id": "t5e", "name": "同一个活,时间省 95%", "text": "同一个活,时间省 95%", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffd166", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 58, "letterSpacing": 0, "lineHeight": 58, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 800}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 8, "ostyle": {"x": 960, "y": 800}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-05.png b/public/templates/soft-tpl-05.png new file mode 100644 index 0000000..555af97 Binary files /dev/null and b/public/templates/soft-tpl-05.png differ diff --git a/public/templates/soft-tpl-06.json b/public/templates/soft-tpl-06.json new file mode 100644 index 0000000..75b2e0e --- /dev/null +++ b/public/templates/soft-tpl-06.json @@ -0,0 +1 @@ +{"title": "软件教程·报错排障", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 9.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t6a", "name": "问题:打开就闪退", "text": "问题:打开就闪退", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 96, "letterSpacing": 0, "lineHeight": 96, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 400}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 400}, "scale": 1, "textScale": 1}, {"id": "t6b", "name": "原因:缺运行库 / 路径有中", "text": "原因:缺运行库 / 路径有中文", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 54, "letterSpacing": 0, "lineHeight": 54, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 560}, "scale": 1, "textScale": 1}, {"id": "t6c", "name": "解决:装 VC 运行库 + ", "text": "解决:装 VC 运行库 + 换英文路径", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#4ade80", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 54, "letterSpacing": 0, "lineHeight": 54, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 700}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 9, "ostyle": {"x": 960, "y": 700}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-06.png b/public/templates/soft-tpl-06.png new file mode 100644 index 0000000..416b7b8 Binary files /dev/null and b/public/templates/soft-tpl-06.png differ diff --git a/public/templates/soft-tpl-07.json b/public/templates/soft-tpl-07.json new file mode 100644 index 0000000..d95d270 --- /dev/null +++ b/public/templates/soft-tpl-07.json @@ -0,0 +1 @@ +{"title": "软件教程·参数配置清单", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 10.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t7a", "name": "这 4 个设置一定要改", "text": "这 4 个设置一定要改", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 82, "letterSpacing": 0, "lineHeight": 82, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 240}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 10, "ostyle": {"x": 960, "y": 240}, "scale": 1, "textScale": 1}, {"id": "t7b", "name": "1. 输出目录换到 D 盘", "text": "1. 输出目录换到 D 盘", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 58, "letterSpacing": 0, "lineHeight": 58, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 420}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 10, "ostyle": {"x": 960, "y": 420}, "scale": 1, "textScale": 1}, {"id": "t7c", "name": "2. 关闭开机自启", "text": "2. 关闭开机自启", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 58, "letterSpacing": 0, "lineHeight": 58, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 530}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 10, "ostyle": {"x": 960, "y": 530}, "scale": 1, "textScale": 1}, {"id": "t7d", "name": "3. 缓存上限设 2G", "text": "3. 缓存上限设 2G", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 58, "letterSpacing": 0, "lineHeight": 58, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 640}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 10, "ostyle": {"x": 960, "y": 640}, "scale": 1, "textScale": 1}, {"id": "t7e", "name": "4. 取消自动更新", "text": "4. 取消自动更新", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 58, "letterSpacing": 0, "lineHeight": 58, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 750}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 10, "ostyle": {"x": 960, "y": 750}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-07.png b/public/templates/soft-tpl-07.png new file mode 100644 index 0000000..42ed1bd Binary files /dev/null and b/public/templates/soft-tpl-07.png differ diff --git a/public/templates/soft-tpl-08.json b/public/templates/soft-tpl-08.json new file mode 100644 index 0000000..3a3ef25 --- /dev/null +++ b/public/templates/soft-tpl-08.json @@ -0,0 +1 @@ +{"title": "软件教程·避坑提醒", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 7.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t8a", "name": "这三个坑别踩", "text": "这三个坑别踩", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ff5252", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 100, "letterSpacing": 0, "lineHeight": 100, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 300}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 7, "ostyle": {"x": 960, "y": 300}, "scale": 1, "textScale": 1}, {"id": "t8b", "name": "× 别装到中文路径", "text": "× 别装到中文路径", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 500}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 7, "ostyle": {"x": 960, "y": 500}, "scale": 1, "textScale": 1}, {"id": "t8c", "name": "× 别信收费破解版", "text": "× 别信收费破解版", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 620}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 7, "ostyle": {"x": 960, "y": 620}, "scale": 1, "textScale": 1}, {"id": "t8d", "name": "× 别忘导出备份", "text": "× 别忘导出备份", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 740}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 7, "ostyle": {"x": 960, "y": 740}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-08.png b/public/templates/soft-tpl-08.png new file mode 100644 index 0000000..7c13d0d Binary files /dev/null and b/public/templates/soft-tpl-08.png differ diff --git a/public/templates/soft-tpl-09.json b/public/templates/soft-tpl-09.json new file mode 100644 index 0000000..92cf327 --- /dev/null +++ b/public/templates/soft-tpl-09.json @@ -0,0 +1 @@ +{"title": "软件教程·结尾关注引导", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 5.0, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t9a", "name": "软件名 + 官网地址", "text": "软件名 + 官网地址", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 92, "letterSpacing": 0, "lineHeight": 92, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 440}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 440}, "scale": 1, "textScale": 1}, {"id": "t9b", "name": "链接放在简介,自取不迷路", "text": "链接放在简介,自取不迷路", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 50, "letterSpacing": 0, "lineHeight": 50, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 590}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 590}, "scale": 1, "textScale": 1}, {"id": "t9c", "name": "下期讲:同类工具怎么选", "text": "下期讲:同类工具怎么选", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffd166", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 54, "letterSpacing": 0, "lineHeight": 54, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 740}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0.0, "duration": 5, "ostyle": {"x": 960, "y": 740}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-09.png b/public/templates/soft-tpl-09.png new file mode 100644 index 0000000..0ede1b7 Binary files /dev/null and b/public/templates/soft-tpl-09.png differ diff --git a/public/templates/soft-tpl-10.json b/public/templates/soft-tpl-10.json new file mode 100644 index 0000000..b4ac18e --- /dev/null +++ b/public/templates/soft-tpl-10.json @@ -0,0 +1 @@ +{"title": "软件教程·全流程成片", "createTime": 0, "updateTime": 0, "poster": "", "width": 1920, "height": 1080, "duration": 22, "background": {}, "transitions": [], "cameras": [], "captions": [], "elements": [{"id": "t10a", "name": "软件教程标题", "text": "软件教程标题", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 116, "letterSpacing": 0, "lineHeight": 116, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 470}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0, "duration": 4, "ostyle": {"x": 960, "y": 470}, "scale": 1, "textScale": 1}, {"id": "t10b", "name": "一句话说清它能干什么", "text": "一句话说清它能干什么", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#9fb3c8", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 52, "letterSpacing": 0, "lineHeight": 52, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 620}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 0, "duration": 4, "ostyle": {"x": 960, "y": 620}, "scale": 1, "textScale": 1}, {"id": "t10c", "name": "第 1 步:下载安装", "text": "第 1 步:下载安装", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 104, "letterSpacing": 0, "lineHeight": 104, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 500}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 4, "duration": 5, "ostyle": {"x": 960, "y": 500}, "scale": 1, "textScale": 1}, {"id": "t10d", "name": "第 2 步:首次设置", "text": "第 2 步:首次设置", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 104, "letterSpacing": 0, "lineHeight": 104, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 500}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 9, "duration": 5, "ostyle": {"x": 960, "y": 500}, "scale": 1, "textScale": 1}, {"id": "t10e", "name": "第 3 步:做出成果", "text": "第 3 步:做出成果", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffffff", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 104, "letterSpacing": 0, "lineHeight": 104, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 500}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 14, "duration": 4, "ostyle": {"x": 960, "y": 500}, "scale": 1, "textScale": 1}, {"id": "t10f", "name": "关注我,下期讲同类工具怎么选", "text": "关注我,下期讲同类工具怎么选", "textStyle": {"radius": [0, 0, 0, 0], "type": "newTextStyle", "direction": "horizontal", "fillType": "gradual", "fill": {"type": "linear", "value": {"angle": 1.5707963267948966, "colors": [{"color": "#ffd166", "offset": null}]}}, "padding": [5, 5, 5, 5], "fontSize": 62, "letterSpacing": 0, "lineHeight": 62, "align": "center", "fontFamily": "aConfused", "stroke": {"color": "rgb(0,0,0)", "lineJoin": "round", "lineWidth": 0}}, "style": {"x": 960, "y": 560}, "_dirty": "1", "type": "text", "trackIndex": 3, "startTime": 18, "duration": 4, "ostyle": {"x": 960, "y": 560}, "scale": 1, "textScale": 1}], "resouces": [], "_hideLock": false, "version": "1.1.0"} \ No newline at end of file diff --git a/public/templates/soft-tpl-10.png b/public/templates/soft-tpl-10.png new file mode 100644 index 0000000..cae0f84 Binary files /dev/null and b/public/templates/soft-tpl-10.png differ diff --git a/public/video-mix/u/uploads/9715/20260324/960586355482419200/convert.mp4 b/public/video-mix/u/uploads/9715/20260324/960586355482419200/convert.mp4 new file mode 100644 index 0000000..78edfa3 Binary files /dev/null and b/public/video-mix/u/uploads/9715/20260324/960586355482419200/convert.mp4 differ diff --git a/public/video/uploads/1/20260318/958639279878656000.mp3 b/public/video/uploads/1/20260318/958639279878656000.mp3 new file mode 100644 index 0000000..8f4ca91 Binary files /dev/null and b/public/video/uploads/1/20260318/958639279878656000.mp3 differ diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..6f36edb --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# +# UniCut 站点构建发布脚本(带断网 lint 门禁) +# +# bash scripts/build.sh +# +# 流程:拿构建锁 → 刷新本地素材 → 构建镜像 → 发布容器 → 导出产物跑 lint → curl 健康检查 +# +# 环境变量: +# SKIP_LOCALIZE=1 跳过素材下载(默认会跑 scripts/localize-assets.py,可重复执行、已存在则跳过) +# SKIP_LINT=1 跳过产物 lint(只做构建发布) +# +# 说明:构建锁放在 /tmp/unicut_build.lock,避免多个任务并发 build 互相覆盖镜像与容器; +# 构建日志统一写 /tmp/unicut_build_site.log。 +set -euo pipefail + +SRC=/vol1/1000/HD1/docker/unicut-src +LOCK=/tmp/unicut_build.lock +LOG=/tmp/unicut_build_site.log +SITE=https://127.0.0.1:3005 +WAIT_MAX=${LOCK_WAIT_MAX:-600} + +cd "$SRC" + +# ---------- 1. 构建锁 ---------- +waited=0 +until mkdir "$LOCK" 2>/dev/null; do + if [ "$waited" -ge "$WAIT_MAX" ]; then + echo "[build] 等待构建锁超时($LOCK 已被占用 ${WAIT_MAX}s)" >&2 + exit 1 + fi + echo "[build] 构建锁被占用,${waited}s 后重试…" + sleep 15 + waited=$((waited + 15)) +done +trap 'rmdir "$LOCK" 2>/dev/null || true' EXIT +echo "[build] 拿到构建锁(等待了 ${waited}s)" + +# ---------- 2. 本地素材(可重复执行) ---------- +if [ "${SKIP_LOCALIZE:-0}" != "1" ]; then + echo "[build] 刷新本地素材 scripts/localize-assets.py" + python3 scripts/localize-assets.py || echo "[build] 素材刷新有失败项,继续构建(详见 data-quality/reports/site/assets-localize.json)" +fi + +# ---------- 3. 构建 + 发布 ---------- +echo "[build] docker compose build unicut(日志:$LOG)" +{ + docker compose build unicut + docker compose up -d --no-build unicut +} 2>&1 | tee "$LOG" + +# ---------- 4. 导出产物并跑断网 lint ---------- +if [ "${SKIP_LINT:-0}" != "1" ]; then + DIST=$(mktemp -d /tmp/unicut-dist-XXXXXX) + docker exec unicut tar -C /usr/share/nginx/html -cf - . | tar -C "$DIST" -xf - + echo "[build] 断网 lint:dist 导出到 $DIST" + set +e + python3 data-quality/scripts/site/00_lint_dist.py --dist "$DIST" 2>&1 | tee -a "$LOG" + LINT_RC=${PIPESTATUS[0]} + set -e +else + LINT_RC=0 +fi + +# ---------- 5. 健康检查:首页与详情页必须 200 ---------- +echo "[build] 健康检查 $SITE" +for path in / /article/local-deploy-guide /article/offline-ready /offline-notice.html; do + code=$(curl -sk -o /dev/null -w '%{http_code}' "$SITE$path") + echo "[build] $code $SITE$path" + if [ "$code" != "200" ]; then + echo "[build] ❌ $path 返回 $code" >&2 + exit 1 + fi +done + +if [ "$LINT_RC" -ne 0 ]; then + echo "[build] ❌ 断网 lint 未通过(external_refs != 0),详见上方报告" >&2 + exit "$LINT_RC" +fi +echo "[build] ✅ 构建、发布、lint、健康检查全部通过" diff --git a/scripts/e2e_quickvideo_fx.py b/scripts/e2e_quickvideo_fx.py new file mode 100644 index 0000000..b6a9d69 --- /dev/null +++ b/scripts/e2e_quickvideo_fx.py @@ -0,0 +1,378 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +"""一键出片 端到端:真实跑完向导 4 步,然后断言时间轴里真的有转场/运镜关键帧/字幕效果。 + +依赖:系统 chromium + playwright(与 scripts/e2e_template.py 相同)。 +用法:python3 scripts/e2e_quickvideo_fx.py +""" +import sys, time, json, re +from playwright.sync_api import sync_playwright + +BASE = "https://127.0.0.1:3005" +APPID = "qv_fx_%d" % int(time.time()) +STAMP = time.strftime("%H:%M:%S") + + +def log(msg): + print("[%s] %s" % (STAMP, msg), flush=True) + + +GUARD = """async () => { + try { + const root = await navigator.storage.getDirectory(); + const db = await new Promise((res, rej) => { + const rq = indexedDB.open('H5VideoLocalDB'); + rq.onupgradeneeded = () => rq.result.createObjectStore('folderHandles'); + rq.onsuccess = () => res(rq.result); + rq.onerror = () => rej(rq.error); + }); + const done = await new Promise((res, rej) => { + const tx = db.transaction('folderHandles', 'readwrite'); + const st = tx.objectStore('folderHandles'); + const rec = { id: 'root', handle: root }; + // 应用自己建的 store 用内联键(keyPath='id'),我们脚本建的是外置键,两种都兼容 + if (st.keyPath) st.put(rec); else st.put(rec, 'root'); + tx.oncomplete = () => res(true); + tx.onerror = () => rej(tx.error); + }); + db.close(); + return done; + } catch (e) { return String(e); } +}""" + + +def js_click(page, expr, desc): + ok = page.evaluate("() => { const e = %s; if (e) { e.click(); return true; } return false; }" % expr) + log("点 %s: %s" % (desc, ok)) + return ok + + +def wait_text(page, text, seconds=120, label=""): + """等页面出现某个文案 —— 用它当『到第几步了』的唯一判据,别用会撞车的按钮片段。""" + for _ in range(seconds): + page.wait_for_timeout(1000) + if page.evaluate("() => document.body.innerText.includes(%s)" % json.dumps(text)): + log("到位[%s]: %s" % (label, text)) + return True + log("等待超时[%s]: %s" % (label, text)) + return False + + +def pick(page, shows, option, desc): + """打开 semi Select 并选一项:shows=当前可见文案(定位哪个下拉),option=要选的文案""" + opened = page.evaluate( + "() => { const s=[...document.querySelectorAll('.semi-select')].find(x=>x.innerText.includes('%s'));" + " if(s){s.click();return true;} return false; }" % shows + ) + if not opened: + log("下拉没找到:%s" % desc) + return False + page.wait_for_timeout(600) + ok = page.evaluate( + "() => { const o=[...document.querySelectorAll('.semi-select-option')].find(x=>x.innerText.trim()==='%s');" + " if(o){o.click();return true;} return false; }" % option + ) + log("选 %s -> %s: %s" % (desc, option, ok)) + return ok + + +def make_images(): + from PIL import Image, ImageDraw + out = [] + for i, color in enumerate([(200, 60, 60), (60, 140, 200), (80, 170, 90)], 1): + p = "/tmp/qv_img%d.png" % i + im = Image.new("RGB", (960, 720), color) + d = ImageDraw.Draw(im) + d.text((40, 40), "QV FX TEST %d" % i, fill=(255, 255, 255)) + d.rectangle([20, 20, 940, 700], outline=(255, 255, 255), width=6) + im.save(p) + out.append(p) + return out + + +def main(): + imgs = make_images() + log("测试图片: %s" % imgs) + with sync_playwright() as p: + browser = p.chromium.launch( + executable_path="/usr/bin/chromium", + headless=True, + args=["--no-sandbox", "--disable-gpu", "--disable-dev-shm-usage", "--mute-audio", + "--autoplay-policy=no-user-gesture-required"], + ) + ctx = browser.new_context(ignore_https_errors=True) + page = ctx.new_page() + errors = [] + bad = [] + page.on("pageerror", lambda e: errors.append(str(e))) + page.on("console", lambda m: errors.append("console:" + m.text[:200]) if m.type == "error" else None) + # 把向导自己的收尾日志打出来(里面有统一轨道/转场计数) + page.on("console", lambda m: log("页面日志 %s" % m.text[:220]) if "[qv]" in m.text else None) + page.on("response", lambda r: bad.append("%d %s" % (r.status, r.url[:120])) if r.status >= 400 else None) + + log("打开工程 %s" % APPID) + page.goto("%s/editor/%s" % (BASE, APPID), wait_until="domcontentloaded", timeout=120000) + page.wait_for_timeout(4000) + log("守卫: %s" % page.evaluate(GUARD)) + page.reload(wait_until="domcontentloaded") + # 等编辑器真正起来(侧栏是纯文本,没有 aria-label,只能等文案出现) + page.wait_for_selector('#h5dsCanvas', timeout=90000) + try: + page.wait_for_function("() => document.body.innerText.includes('AI创作')", timeout=90000) + log("侧栏已就绪") + except Exception as e: + log("侧栏等待超时: %s" % e) + page.wait_for_timeout(3000) + + # 打开 AI 面板 -> 一键出片(入口是文本叶子,aria-label 不可用) + js_click(page, """(() => { + const w = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT); + let n; + while (n = w.nextNode()) { + const t = (n.textContent || '').trim(); + if (t === 'AI创作' && n.parentElement) return n.parentElement; + } + return null; + })()""", "AI创作") + page.wait_for_timeout(2500) + js_click(page, "[...document.querySelectorAll('button')].find(x => (x.innerText||'').trim() === '开始一键出片') " + "|| [...document.querySelectorAll('button')].find(x => (x.innerText||'').includes('一键出片'))", + "开始一键出片") + page.wait_for_timeout(3000) + + # 步骤1:上传 3 张图 + 标题 + fi = page.query_selector("div.semi-modal input[type=file]") + if not fi: + fi = page.query_selector("input[type=file][accept='image/*']") + if not fi: + log("ERROR: 找不到向导的图片输入框") + print(json.dumps({"ok": False, "why": "no-file-input", "errors": errors[-5:]}, ensure_ascii=False)) + return 1 + fi.set_input_files(imgs) + page.wait_for_timeout(2500) + page.fill("input[placeholder*='三步搞定']", "测试标题效果验证") + page.wait_for_timeout(500) + + js_click(page, "[...document.querySelectorAll('button')].find(x=>(x.innerText||'').includes('① 识别图片'))", "生成文案") + # 到第 2 步的唯一标志:第 1 步的「下一步:配置声音」按钮出现(最长 180s) + got = wait_text(page, "下一步:配置声音", 180, "第2步") + log("文案生成完成: %s" % got) + if not got: + # 兜底:手动加 3 段 + log("AI 文案没出来,改用手动加段") + for i in range(3): + js_click(page, "[...document.querySelectorAll('button')].find(x=>(x.innerText||'').trim()==='加一段')", "加一段") + page.wait_for_timeout(500) + tas = page.query_selector_all(".semi-modal textarea") + for i, ta in enumerate(tas[:3]): + ta.fill("第%d段测试口播内容" % (i + 1)) + page.wait_for_timeout(500) + + js_click(page, "[...document.querySelectorAll('button')].find(x=>(x.innerText||'').includes('下一步:配置声音'))", "下一步") + page.wait_for_timeout(2000) + + # 步骤3:合成全部配音 + js_click(page, "[...document.querySelectorAll('button')].find(x=>(x.innerText||'').includes('合成全部配音'))", "合成全部配音") + # 合成完会自动跳到第 4 步;只认效果面板的特征文案「图片转场」, + # 不能用「确认生成」——第 3 步的「下一步:确认生成」也含这几个字,会误判。 + done = wait_text(page, "图片转场", 300, "第4步效果面板") + log("配音合成完成(自动进入确认页): %s" % done) + page.wait_for_timeout(1500) + + # 步骤4:设置画面/字幕效果(全部用非默认值,证明控件真的生效) + body_before = page.inner_text(".semi-modal-body") + log("确认页含效果面板: %s" % ("图片转场" in body_before and "字幕效果" in body_before)) + pick(page, "自动轮换", "左侧擦除", "转场") + pick(page, "缓慢推近", "左右平移", "图片动效") + pick(page, "底部", "居中", "字幕位置") + pick(page, "黄字黑边", "白字黑边", "字幕配色") + pick(page, "放大弹入", "放大 + 淡入", "字幕入场") + # 大小滑块:聚焦后按右键 5 次(0.6 -> 1.1) + moved = page.evaluate("""() => { + const h = document.querySelector('.semi-modal .semi-slider-handle'); + if (!h) return 'no-handle'; + h.focus(); return 'focused'; + }""") + if moved == "focused": + for _ in range(5): + page.keyboard.press("ArrowRight") + page.wait_for_timeout(400) + log("字幕大小滑块: %s" % moved) + page.wait_for_timeout(800) + log("确认页摘要: %s" % page.inner_text(".semi-modal .semi-modal-body").split("\n")[0:14]) + + # 生成 + js_click(page, "[...document.querySelectorAll('button')].find(x=>(x.innerText||'').includes('③ 确认生成视频'))", "确认生成视频") + page.wait_for_timeout(12000) + + # 断言:读回工程数据 + res = page.evaluate("""() => { + const ed = window.__editor && window.__editor.movie; + if (!ed) return {err:'no-editor'}; + const d = ed.data || {}; + const els = d.elements || []; + const imgs = els.filter(e => e.type === 'image'); + const trs = d.transitions || []; + const caps = d.captions || []; + // 转场有效性:startElementId 必须存在,且同轨道相邻 + const byId = {}; + els.forEach(e => byId[e.id] = e); + const check = trs.map(t => { + const a = byId[t.startElementId]; + if (!a) return {name: t.name, ok: false, why: 'startElementId 不存在'}; + // 注意:不要用 e !== a 排除自身 —— indexOf(a) 会永远返回 -1,next 就会取错 + const same = els.filter(e => e.trackIndex === a.trackIndex) + .sort((m, n) => m.startTime - n.startTime); + const i = same.indexOf(a); + const next = same[i + 1]; + const gap = next ? Number((a.startTime + a.duration - next.startTime).toFixed(3)) : null; + return { name: t.name, tname: t.transitionName, dur: t.duration, gap, + ok: !!next && Math.abs(gap) < 0.01 }; + }); + return { + imgCount: imgs.length, + sameTrack: imgs.length ? new Set(imgs.map(e => e.trackIndex)).size : 0, + elementsFull: els.map(e => ({ id: e.id, type: e.type, t: e.startTime, d: e.duration, + track: e.trackIndex })), + transitionsFull: trs.map(t => ({ id: t.id, startElementId: t.startElementId, + tname: t.transitionName, dur: t.duration })), + imgs: imgs.map(e => ({ t: e.startTime, d: e.duration, track: e.trackIndex, + frames: (e.frames || []).length, + f0: (e.frames || [])[0] || null, + f1: (e.frames || [])[(e.frames || []).length - 1] || null, + style: { x: e.style && e.style.x, y: e.style && e.style.y, + w: e.style && e.style.width, h: e.style && e.style.height } })), + transitionCount: trs.length, + transitionChecks: check, + captionCount: caps.length, + caption0: caps[0] ? { + x: caps[0].style.x, y: caps[0].style.y, textScale: caps[0].textScale, + fill: caps[0].textStyle && caps[0].textStyle.fill, + stroke: caps[0].textStyle && caps[0].textStyle.stroke && caps[0].textStyle.stroke.color, + frames: (caps[0].frames || []).length, + f0: (caps[0].frames || [])[0] || null, + f1: (caps[0].frames || [])[(caps[0].frames || []).length - 1] || null, + } : null, + canvas: { w: d.width, h: d.height }, + }; + }""") + log("元素明细: " + json.dumps(res.get('elementsFull'), ensure_ascii=False)) + log("转场明细: " + json.dumps(res.get('transitionsFull'), ensure_ascii=False)) + log("工程数据: " + json.dumps(res, ensure_ascii=False)[:2400]) + + # 播一下确认渲染 + play = page.evaluate("""() => { + const m = window.__editor && window.__editor.movie; + if (!m) return 'no-movie'; + try { m.currentTime = 1.5; if (typeof m.play === 'function') m.play(); return 'playing'; } + catch (e) { return 'err:' + e.message; } + }""") + page.wait_for_timeout(4000) + after = page.evaluate("""() => { + const m = window.__editor && window.__editor.movie; + const st = document.querySelector('#h5dsCanvas') && document.querySelector('#h5dsCanvas').innerText || ''; + return { time: m ? m.currentTime : null, loading: /loading\\s+\\d/.test(st) }; + }""") + log("播放: %s -> %s" % (play, json.dumps(after, ensure_ascii=False))) + page.screenshot(path="/tmp/qv_fx.png", full_page=False) + log("截图: /tmp/qv_fx.png") + + # 转场区间内截一帧,确认转场真的在渲染(而不是只有数据) + mid = page.evaluate("""() => { + const st = window.__editor; + const m = st && st.movie; + if (!m) return 'no-movie'; + const trs = (m.data && m.data.transitions) || []; + if (!trs.length) return 'no-transitions'; + const tr = trs[0]; + const el = (m.data.elements || []).find(e => e.id === tr.startElementId); + if (!el) return 'no-start-element'; + const t = el.startTime + el.duration - 0.5; + m.pause(); + if (typeof st.updateMovie === 'function') st.updateMovie(t); else m.currentTime = t; + return 'seek=' + Math.round(t * 100) / 100; + }""") + page.wait_for_timeout(2500) + log("转场区间定位: %s" % mid) + page.screenshot(path="/tmp/qv_fx_transition.png", full_page=False) + log("转场截图: /tmp/qv_fx_transition.png") + + # 转场窗口内多点采样,看是不是渐变过渡(红->蓝中间应出现混合色)而不是硬切 + samples = page.evaluate("""() => { + const m = window.__editor && window.__editor.movie; + const trs = (m && m.data && m.data.transitions) || []; + if (!trs.length) return null; + const el = m.data.elements.find(e => e.id === trs[0].startElementId); + const end = el.startTime + el.duration; + const win = trs[0].duration || 1; + const pts = []; + for (let k = 1; k <= 4; k++) pts.push(Number((end - win + (win * k) / 5).toFixed(2))); + return pts; + }""") + if samples: + log("转场窗口采样点: %s" % samples) + for idx, tt in enumerate(samples): + # 必须先暂停再跳帧;跳帧要用 Store 的 updateMovie(t)(内部是 movie.step), + # 直接赋 movie.currentTime 不会驱动渲染,四个采样点会停在同一帧。 + page.evaluate( + "(t) => { const st = window.__editor;" + " if (st && st.movie && st.movie.pause) st.movie.pause();" + " if (st && st.updateMovie) st.updateMovie(t);" + " else if (st && st.movie) st.movie.currentTime = t; }", + tt, + ) + page.wait_for_timeout(1200) + # 确认跳帧真的生效(currentTime 赋值未必驱动渲染) + cur = page.evaluate("""() => { + const m = window.__editor.movie; + const tc = (document.body.innerText.split('\\n').join(' ').match(/\\d{2}:\\d{2}:\\d{2}/g) || []).slice(0, 3); + return { movieTime: Math.round(m.currentTime * 100) / 100, timecodes: tc }; + }""") + page.locator("#h5dsCanvas").screenshot(path="/tmp/qv_tr_%d.png" % idx) + log("采样 t=%.2f -> %s" % (tt, json.dumps(cur, ensure_ascii=False))) + # 暂停态 step() 可能不渲染转场滤镜,所以再做一次「边播边截帧」的验证 + capinfo = page.evaluate("""() => { + const m = window.__editor.movie; + const trs = (m.data && m.data.transitions) || []; + if (!trs.length) return null; + const el = m.data.elements.find(e => e.id === trs[0].startElementId); + const end = el.startTime + el.duration; + return { start: Number((end - (trs[0].duration || 1) - 0.5).toFixed(2)), boundary: end }; + }""") + if capinfo: + page.evaluate("(t) => { const s=window.__editor; if (s.movie.pause) s.movie.pause(); s.updateMovie(t); }", + capinfo["start"]) + page.wait_for_timeout(900) + page.evaluate("() => window.__editor.movie.play()") + pts = [] + for i in range(18): + page.locator("#h5dsCanvas").screenshot(path="/tmp/qvp_%02d.png" % i) + pts.append(page.evaluate("() => Math.round(window.__editor.movie.currentTime * 100) / 100")) + log("播放采样起点=%.2f 边界=%.2f 时刻表=%s" % (capinfo["start"], capinfo["boundary"], pts)) + + # 保存 + 刷新,确认一键出片的结果不会丢 + saved = page.evaluate("""() => { + const s = window.__editor; + if (typeof s.saveApp === 'function') { s.saveApp(() => {}); return 'saveApp 已调用'; } + return '没有 saveApp'; + }""") + log("手动保存: %s" % saved) + page.wait_for_timeout(8000) + page.reload(wait_until="domcontentloaded") + page.wait_for_selector("#h5dsCanvas", timeout=90000) + page.wait_for_timeout(12000) + after_reload = page.evaluate("""() => { + const d = (window.__editor && window.__editor.movie && window.__editor.movie.data) || {}; + return { els: (d.elements || []).length, caps: (d.captions || []).length, + trans: (d.transitions || []).length }; + }""") + log("刷新后工程数据: %s" % json.dumps(after_reload, ensure_ascii=False)) + + log("JS 错误: %s" % (errors[-4:] if errors else "无")) + log("非2xx请求: %s" % (bad[:8] if bad else "无")) + browser.close() + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/e2e_template.py b/scripts/e2e_template.py new file mode 100644 index 0000000..0b1689a --- /dev/null +++ b/scripts/e2e_template.py @@ -0,0 +1,169 @@ +"""UniCut 内置模板端到端验收:进编辑器 → 模板面板 → 点模板 → 确认 → 等画布出画。 +用系统 chromium(媒体管线正常),实时等待,不依赖虚拟时间。""" +import json, sys, time +from playwright.sync_api import sync_playwright + +BASE = 'https://127.0.0.1:3005' +APPID = 'local_e2e_tpl_001' +steps = [] +def log(s): + steps.append(s) + print(s, flush=True) + +with sync_playwright() as p: + browser = p.chromium.launch( + executable_path='/usr/bin/chromium', + headless=True, + args=['--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage', '--mute-audio', + '--autoplay-policy=no-user-gesture-required'], + ) + ctx = browser.new_context(ignore_https_errors=True, viewport={'width': 1600, 'height': 950}) + page = ctx.new_page() + errors = [] + page.on('pageerror', lambda e: errors.append(str(e)[:200])) + + # 1) 进编辑器(首次会有文件夹守卫) + page.goto(f'{BASE}/editor/{APPID}', wait_until='domcontentloaded', timeout=60000) + page.wait_for_timeout(4000) + + if page.locator('text=选择本地存储文件夹').count() > 0: + log('guard: 出现,注入 OPFS 句柄后刷新') + page.evaluate("""async () => { + const dh = await navigator.storage.getDirectory(); + const db = await new Promise((res, rej) => { + const rq = indexedDB.open('H5VideoLocalDB'); + rq.onsuccess = () => res(rq.result); + rq.onerror = () => rej(rq.error); + }); + await new Promise((res, rej) => { + const tx = db.transaction('folderHandles', 'readwrite'); + const st = tx.objectStore('folderHandles'); + const rec = { id: 'root', handle: dh }; + // 应用自建的 store 用内联键(keyPath='id'),脚本建的是外置键,两种都兼容 + if (st.keyPath) st.put(rec); else st.put(rec, 'root'); + tx.oncomplete = () => res(); + tx.onerror = () => rej(tx.error); + }); + }""") + page.reload(wait_until='domcontentloaded') + page.wait_for_timeout(6000) + still = page.locator('text=选择本地存储文件夹').count() > 0 + log(f'guard: 刷新后仍显示={still}') + + # 2) 打开模板面板(精确匹配叶子节点,避免匹配到容器) + hit = page.evaluate("""() => { + const w = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT); + let n; + while (n = w.nextNode()) { + const t = (n.textContent || '').trim(); + if (t === '模板' && n.parentElement) { + n.parentElement.click(); + return n.parentElement.tagName + '.' + (n.parentElement.className || '').toString().slice(0, 40); + } + } + return null; + }""") + log(f'点击模板入口: {hit}') + page.wait_for_timeout(3000) + body1 = page.inner_text('body').replace('\n', ' ')[:220] + log(f'点击模板后面板文本: {body1}') + try: + page.wait_for_selector('img[src*="/cdn/"]', timeout=30000) + except Exception as e: + allsrc = page.evaluate("() => Array.from(document.images).slice(0,12).map(i => (i.currentSrc||i.src||'').slice(0,90))") + log(f'等待 /cdn/ 图片失败: {type(e).__name__}; 页面图片={json.dumps(allsrc, ensure_ascii=False)}') + raise + cards = page.locator('img[src*="/cdn/"]').count() + log(f'模板卡: {cards} 张(经 /cdn/)') + dead = page.locator('img[src*="932891792672288768"]').count() + log(f'死模板是否还在列表: {dead} (期望 0)') + + # 3) 点第一张卡 + 确认 + page.locator('img[src*="/cdn/"]').first.click() + page.wait_for_timeout(2500) + modal = page.locator('.semi-modal').count() > 0 + log(f'确认弹窗: {modal}') + ok = page.evaluate("""() => { + const els = [...document.querySelectorAll('button, a, span, div')]; + const b = els.find(e => e.children.length <= 1 && (e.innerText || '').trim() === '确定'); + if (b) { b.click(); return b.tagName + '.' + (b.className || '').toString().slice(0, 40); } + return null; + }""") + log(f'点击确定: {ok}') + + # 4) 等 loading 消失 + 时长非 00:00:00 + t0 = time.time() + outcome = 'TIMEOUT' + dur = '' + loading = '' + while time.time() - t0 < 90: + page.wait_for_timeout(2000) + body = page.inner_text('body').replace('\n', ' ') + loading = 'loading' in body + # 时间轴总时长(第二个 00:00:00 形态) + import re + m = re.findall(r'\d{2}:\d{2}:\d{2}', body) + dur = m[-1] if m else '' + if (not loading) and dur and dur != '00:00:00': + outcome = 'RENDERED' + break + log(f'结果: {outcome} loading残留={loading} 时长={dur} 耗时={time.time()-t0:.1f}s') + + # 5) 画布细节 + canvas = page.evaluate("""() => { + const c = document.getElementById('h5dsCanvas'); + const inner = c ? c.innerHTML : ''; + return { + hasStage: !!document.querySelector('#h5dsCanvas canvas') || !!document.querySelector('#h5dsCanvas [class*=pixi]') || inner.indexOf('loading') === -1, + loadingText: (inner.match(/loading \\d+\\.\\d+%/g) || [])[0] || null, + childCount: c ? c.children.length : -1, + videoEls: document.querySelectorAll('video').length, + }; + }""") + log(f'画布: {json.dumps(canvas, ensure_ascii=False)}') + tracks = page.evaluate("() => document.querySelectorAll('[class*=track]').length") + log(f'轨道元素数: {tracks}') + if errors: + log(f'页面JS错误: {errors[:3]}') + page.screenshot(path='/tmp/e2e_template.png', full_page=False) + log('截图: /tmp/e2e_template.png') + + # 6) 播放器状态 + 播放验证 + st0 = page.evaluate("""() => { + const m = window.__editor && window.__editor.movie; + if (!m) return {err:'no-movie'}; + const d = m.data || {}; + return { + movieDuration: m.duration, dataDuration: d.duration, + currentTime: m.currentTime, env: m.env, + elements: (d.elements||[]).length, resouces: (d.resouces||[]).length, + }; + }""") + log(f'播放器状态0: {json.dumps(st0, ensure_ascii=False)}') + + play = page.evaluate("""() => { + try { + const m = window.__editor && window.__editor.movie; + if (m) { m.currentTime = 2; if (typeof m.play === 'function') m.play(); return 'movie.play()'; } + } catch(e) {} + const b = [...document.querySelectorAll('button')].find(x => /播放|play/i.test(x.getAttribute('aria-label')||'') || (x.innerText||'').trim()==='播放'); + if (b) { b.click(); return 'button-play'; } + return 'no-play-ctl'; + }""") + log(f'触发播放: {play}') + page.wait_for_timeout(5000) + st1 = page.evaluate("""() => { + const m = window.__editor && window.__editor.movie; + const vids = Array.from(document.querySelectorAll('video')).slice(0,4).map(v=>({ct:Math.round(v.currentTime*100)/100, rs:v.readyState, paused:v.paused})); + const t = document.body.innerText.replace(/\\s+/g,' '); + const tc = (t.match(/\\d{2}:\\d{2}:\\d{2}/g) || []).slice(0,4); + return {movieTime: m?m.currentTime:null, videos:vids, timecodes:tc}; + }""") + log(f'播放后: {json.dumps(st1, ensure_ascii=False)}') + page.screenshot(path='/tmp/e2e_template_t3.png', full_page=False) + log('截图: /tmp/e2e_template_t3.png') + browser.close() + +print('\n=== 步骤汇总 ===') +for s in steps: + print(' -', s) diff --git a/scripts/localize-assets.py b/scripts/localize-assets.py new file mode 100644 index 0000000..2f6e0f5 --- /dev/null +++ b/scripts/localize-assets.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +把 UniCut 站点依赖的远程素材下载到 public/ 下并改写成同源路径, +让站点在断网环境下依然完整可用(音色试听、AI 头像、字体、404 占位图等)。 + +可重复执行:已存在的文件默认跳过(--force 重新下载)。 +输出:data-quality/reports/site/assets-localize.json +""" +import argparse +import concurrent.futures as cf +import json +import os +import re +import shutil +import subprocess +import sys + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PUBLIC = os.path.join(ROOT, 'public') +REPORT = os.path.join(ROOT, 'data-quality', 'reports', 'site', 'assets-localize.json') + +CDN = 'https://cdn.h5ds.com' +BYTED = 'https://lf3-static.bytednsdoc.com' +DL_ICON = BYTED + '/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png' +ASSISTANT_LOGO = BYTED + '/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/other/logo.png' +SIYUAN_FONT = CDN + '/assets/fonts/siYuanHeiTi/font.woff' +DEMO_APP = CDN + '/video-mix/u/9715/apps/960593364739022848.json' + +jobs = [] # (rel_path, url_or_callable, note) +results = [] + + +def add(rel_path, url, note=''): + jobs.append((rel_path, url, note)) + + +def safe_name(s, maxlen=48): + s = re.sub(r'[^0-9A-Za-z一-鿿._-]+', '_', s or '') + return s[:maxlen] or 'unnamed' + + +def prepare_voices(): + """zijieVoices.json:121 个音色,头像 + 试听音频各一,共 242 个远程文件。""" + src = os.path.join(PUBLIC, 'assets', 'zijieVoices.json') + if not os.path.exists(src): + print('[skip] public/assets/zijieVoices.json 不存在') + return None + data = json.load(open(src, encoding='utf-8')) + changed = 0 + for i, item in enumerate(data): + vt = safe_name(item.get('voice_type') or item.get('name') or str(i)) + for key, sub in (('avatar', 'avatar'), ('audio', 'audio')): + url = item.get(key) + if not isinstance(url, str) or not url.startswith('http'): + continue + ext = os.path.splitext(url.split('?')[0])[1] or ('.png' if key == 'avatar' else '.mp3') + rel = 'assets/voices/%s/%03d-%s%s' % (sub, i, vt, ext) + add(rel, url, 'zijieVoices[%d].%s' % (i, key)) + item[key] = '/' + rel + changed += 1 + if changed: + json.dump(data, open(src, 'w', encoding='utf-8'), ensure_ascii=False, indent=2) + print('[plan] zijieVoices.json:%d 个远程地址改写为本地' % changed) + return changed + + +def prepare_fonts(): + """字体:思源黑体上游可下载;aConfused 上游 404,用思源黑体兜底并登记 TODO。""" + add('assets/fonts/siYuanHeiTi/font.woff', SIYUAN_FONT, 'SDK loadFont 默认字体') + add('assets/fonts/aConfused/font.woff', '__COPY__assets/fonts/siYuanHeiTi/font.woff', + 'TODO 上游 aConfused/font.woff 已 404,先用思源黑体兜底(模板 fontFamily=aConfused)') + # 演示工程 /editor/test 的文字用的是这个字体(相对路径,reURL 后落在同源根) + add('assets/fonts/抖音美好体.otf', + CDN + '/assets/fonts/' + '%E6%8A%96%E9%9F%B3%E7%BE%8E%E5%A5%BD%E4%BD%93.otf', + '演示工程字体(缺失时文字回退系统字体)') + + +def prepare_misc(): + add('assets/ai-chat/user.png', DL_ICON, 'AI 对话用户头像') + add('assets/ai-chat/assistant.png', ASSISTANT_LOGO, 'AI 对话助手头像') + add('assets/images/404.png', CDN + '/assets/images/404.png', 'SDK config.img404') + add('assets/images/qrcode-loading.png', CDN + '/static/images/qrcode-loading.png', '二维码占位图') + add('assets/demo/test-app.json', DEMO_APP, '编辑器 /editor/test 演示工程') + # SDK 启动时用 pixi Assets.load 一次性加载这 4 张滤镜贴图(reURL(相对路径) + cdnHost 拼接)。 + # cdnHost 改成同源后必须本地存在,否则 loader 报 + # “InvalidStateError: The source image could not be decoded”,编辑器卡在 loading 0.0%。 + for _f in ('colormap.png', 'displacement_map.png', 'lightmap.png', 'overlay.png'): + add('assets/images/' + _f, CDN + '/assets/images/' + _f, 'SDK 启动滤镜贴图(缺失会卡 loading)') + # /editor/test 演示工程里引用的两个素材是根相对路径,resourcesHost 改同源后必须本地存在, + # 否则 nginx 回退到 index.html,媒体解码失败会卡在 loading + add('video-mix/u/uploads/9715/20260324/960586355482419200/convert.mp4', + CDN + '/video-mix/u/uploads/9715/20260324/960586355482419200/convert.mp4', '演示工程视频') + add('video/uploads/1/20260318/958639279878656000.mp3', + CDN + '/video/uploads/1/20260318/958639279878656000.mp3', '演示工程音频') + + +def gen_font_family_json(): + """字体下拉改用本地清单,不再依赖官方 materials 接口。""" + out = os.path.join(PUBLIC, 'assets', 'fontFamily.json') + entries = [ + {'name': 'siYuanHeiTi', 'label': '思源黑体'}, + {'name': 'aConfused', 'label': '杂体(思源黑体兜底)'}, + ] + data = [{ + 'name': e['name'], + 'label': e['label'], + 'urls': { + 'url': '/assets/fonts/%s/font.woff' % e['name'], + 'thumb': '/assets/fonts/%s/thumb.png' % e['name'], + }, + } for e in entries] + json.dump(data, open(out, 'w', encoding='utf-8'), ensure_ascii=False, indent=2) + print('[gen] public/assets/fontFamily.json') + + +def gen_font_thumbs(): + """字体缩略图:PIL 画一张简单卡片,离线可用。""" + from PIL import Image, ImageDraw + for name, label in (('siYuanHeiTi', '思源黑体'), ('aConfused', '杂体 Aa')): + d = os.path.join(PUBLIC, 'assets', 'fonts', name) + os.makedirs(d, exist_ok=True) + p = os.path.join(d, 'thumb.png') + if os.path.exists(p): + continue + img = Image.new('RGB', (160, 64), (245, 246, 250)) + dr = ImageDraw.Draw(img) + dr.rectangle([0, 0, 159, 63], outline=(210, 214, 224)) + dr.text((14, 12), 'Aa', fill=(32, 33, 36)) + dr.text((14, 36), label[:6], fill=(96, 99, 108)) + img.save(p) + print('[gen] 字体缩略图 thumb.png x2') + + +def gen_effectcanvas_stub(): + """官方 effectcanvas 远端目录已失效(返回 SPA index.html),本地放占位清单 + TODO 说明。""" + d = os.path.join(PUBLIC, 'assets', 'effectcanvas') + os.makedirs(d, exist_ok=True) + stub = {'version': 'local-stub', 'note': '官方 CDN /assets/effectcanvas/ 已失效,特效画布模块暂不可用', 'modules': []} + json.dump(stub, open(os.path.join(d, 'manifest.json'), 'w', encoding='utf-8'), ensure_ascii=False, indent=2) + open(os.path.join(d, 'README.md'), 'w', encoding='utf-8').write( + '# effectcanvas 本地占位\n\n' + '官方 `https://cdn.h5ds.com/assets/effectcanvas/` 目前返回站点 index.html(目录已下线),' + '无法下载真实模块。\n\n' + '- SDK `window.EModuleEffectSourcePath` 已改指向本目录(`/assets/effectcanvas/`);\n' + '- 这里只放 `manifest.json` 占位,特效画布(EModule)功能在拿到真实模块前不可用(TODO);\n' + '- 若上游恢复,把模块文件按原目录结构放进来即可,无需改代码。\n') + print('[gen] public/assets/effectcanvas/ 占位') + + +def download_one(rel, url): + dest = os.path.join(PUBLIC, rel) + if os.path.exists(dest) and os.path.getsize(dest) > 0: + return (rel, 'exists', 0) + os.makedirs(os.path.dirname(dest), exist_ok=True) + if url.startswith('__COPY__'): + src = os.path.join(PUBLIC, url[len('__COPY__'):]) + if not os.path.exists(src): + return (rel, 'src-missing', 0) + shutil.copyfile(src, dest) + return (rel, 'copy', os.path.getsize(dest)) + for attempt in range(3): + p = subprocess.run(['curl', '-sL', '--max-time', '60', '-o', dest, url], + capture_output=True, text=True) + if p.returncode == 0 and os.path.exists(dest) and os.path.getsize(dest) > 0: + head = open(dest, 'rb').read(200).lower() + if b' %s' % (ok, exists, fail, REPORT)) + return 1 if fail else 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/patch-sdk-offline.mjs b/scripts/patch-sdk-offline.mjs new file mode 100644 index 0000000..95e701e --- /dev/null +++ b/scripts/patch-sdk-offline.mjs @@ -0,0 +1,72 @@ +#!/usr/bin/env node +/** + * patch-sdk-offline.mjs — 把 video-core-sdk 里指向官方 CDN 的常量改成本地路径 + * + * 背景:video-core-sdk@1.0.70 把几个远程地址写死在压缩产物里,站点要做到断网可用 + * 就必须在构建期替换(node_modules 每次构建都是全新的,补丁不会污染源码包): + * 1. config.cdnHost → '' (字体/素材基址改成同源根) + * 2. config.img404 → 本地占位图 (SDK 初始化会 fetchBlob(img404)) + * 3. window.EModuleEffectSourcePath / 默认参数 → 本地特效画布目录 + * 4. 注册ID报错文案里的官方域名 → 去掉 + * + * 幂等:重复执行安全;若上游换了字符串(找不到旧串),会直接退出码 1 报错, + * 提示维护者按新 SDK 版本更新本脚本,而不是悄悄把外域打进产物。 + * 配套检查:data-quality/scripts/site/00_lint_dist.py 会在构建后兜底复核。 + */ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const target = path.join(root, 'node_modules', 'video-core-sdk', 'video-core-sdk.js'); + +if (!fs.existsSync(target)) { + console.log('[patch-sdk-offline] 未找到 %s,跳过(是否还没 yarn install?)', path.relative(root, target)); + process.exit(0); +} + +let code = fs.readFileSync(target, 'utf8'); + +const REPLACEMENTS = [ + // 顺序有讲究:先处理带路径的长串,再处理裸域名 + ['https://cdn.h5ds.com/assets/effectcanvas/', '/assets/effectcanvas/', '特效画布模块目录'], + ['https://cdn.h5ds.com/assets/images/404.png', '/assets/images/404.png', 'SDK img404 占位图'], + ['cdnHost:"https://cdn.h5ds.com"', 'cdnHost:""', '素材/字体基址改为同源'], + ['必须填写注册ID,注册ID可通过https://video.h5ds.com进行申请', '必须填写注册ID(本地部署版无需注册ID)', '注册ID报错文案'], +]; + +const DONE = [ + ['/assets/effectcanvas/', '特效画布模块目录'], + ['/assets/images/404.png', 'SDK img404 占位图'], + ['cdnHost:""', '素材/字体基址改为同源'], + ['必须填写注册ID(本地部署版无需注册ID)', '注册ID报错文案'], +]; + +let changed = 0; +for (const [from, to, why] of REPLACEMENTS) { + if (code.includes(from)) { + code = code.split(from).join(to); + changed++; + console.log('[patch-sdk-offline] 替换 %s → %s(%s)', from.slice(0, 60), to.slice(0, 40), why); + } else if (code.includes(to)) { + console.log('[patch-sdk-offline] 已是补丁后状态,跳过:%s', why); + } else { + console.error( + '[patch-sdk-offline] 未找到待替换串(SDK 版本可能已升级,请核对本脚本):%s', + from.slice(0, 80), + ); + process.exit(1); + } +} + +const LEFT = ['cdn.h5ds.com', 'video.h5ds.com', 'fvideo.h5ds.com', 'water.i.h5ds.com', 'bytednsdoc.com']; +const leftover = LEFT.filter(h => code.includes(h)); +if (leftover.length) { + console.error('[patch-sdk-offline] SDK 里仍残留外部域名:%s', leftover.join(', ')); + process.exit(1); +} + +if (changed) { + fs.writeFileSync(target, code); +} +console.log('[patch-sdk-offline] 完成(本次实际替换 %d 处)', changed); diff --git a/src/components/footer/Footer.tsx b/src/components/footer/Footer.tsx index eab0522..35da862 100644 --- a/src/components/footer/Footer.tsx +++ b/src/components/footer/Footer.tsx @@ -1,77 +1,12 @@ -import { theme } from '@theme'; -import styles from './footer.module.less'; -import { Intl } from '@language/index'; - +/** + * 底部栏:按需求整块下线(内容全部删除)。 + * + * 组件保留但不再渲染任何东西 —— 这样首页、关于我们、协议页、用户页共用的 + *