零散修改优化
This commit is contained in:
1 parent
c91326bada
commit
150cff53e3
38 files changed
+2638
-724
No files matched your search
@@ -47,6 +47,7 @@ Knowledge base/
|
||||
|
||||
# 构建输出
|
||||
dist/
|
||||
.zip
|
||||
|
||||
# 测试数据
|
||||
test-library/
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
# FlyPic
|
||||
# FlyPic 飞图
|
||||
|
||||
一个轻量、快速、稳定的图片检索浏览应用,专为飞牛 fnOS 设计。
|
||||
专为飞牛 fnOS 设计的轻量、快速、稳定的图像素材检索浏览应用。
|
||||
|
||||
## 核心特性
|
||||
## ✨ 核心特性
|
||||
|
||||
- 🚀 **高性能**: 支持 10万-100万 级别图片浏览
|
||||
- 🎨 **Eagle 风格瀑布流**: 固定高度,宽度自适应,视觉整齐
|
||||
- 🔍 **智能搜索**: 多关键词组合搜索,快速定位
|
||||
- 🚀 **轻量快速** - 支持数十万级别图片流畅浏览,基于 SQLite 本地数据库,毫秒级响应
|
||||
- 🛡️ **非侵入式** - 只在素材库目录创建 .flypic 文件夹存储索引和缩略图,不修改任何原始文件
|
||||
- 🔄 **实时同步** - 基于 Worker Thread 的文件监控,自动检测新增、删除、修改
|
||||
- 🌐 **远程访问** - 支持 FN Connect 远程访问,随时随地浏览管理图片素材库
|
||||
- 🎨 **现代界面** - 固定行高瀑布流布局,支持亮色/暗色主题,响应式设计
|
||||
- 🔍 **智能搜索** - 多关键词组合搜索,高级筛选(格式/大小/方向)
|
||||
- 📱 **移动适配** - 响应式设计,手机上也能流畅使用
|
||||
- 🆓 **开源免费** - 100% 开源,MIT 协议
|
||||
|
||||
## 🛠️ 技术栈
|
||||
|
||||
- **前端**:React + Vite + TailwindCSS + react-photo-view + zustand
|
||||
- **后端**:Node.js + Express + Sharp + better-sqlite3 + Socket.IO
|
||||
- **部署**:飞牛 fnOS
|
||||
**前端**:React 18 + Vite 5 + TailwindCSS + Zustand + react-window + react-photo-view
|
||||
|
||||
**后端**:Node.js + Express + Sharp + better-sqlite3 + Socket.IO + chokidar
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
@@ -22,28 +27,21 @@
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 启动前端开发服务器(推荐)
|
||||
# 启动前端开发服务器
|
||||
npm run dev:frontend
|
||||
# 访问 http://localhost:5173
|
||||
|
||||
# 启动后端开发服务器
|
||||
npm run dev:backend
|
||||
# API 运行在 http://localhost:5002
|
||||
# API 运行在 http://localhost:15002
|
||||
```
|
||||
|
||||
### 构建部署
|
||||
|
||||
```bash
|
||||
# 方法一:使用 Docker 构建(推荐)
|
||||
# 使用 Docker 构建(推荐)
|
||||
# 包含 Linux 版本的依赖,上传后直接可用
|
||||
npm run build:fpk:docker
|
||||
|
||||
# 方法二:普通构建
|
||||
# 需要在飞牛上手动安装依赖
|
||||
npm run build:fpk
|
||||
|
||||
# 本地测试 Linux 版本
|
||||
npm run test:docker
|
||||
```
|
||||
|
||||
## 📦 部署到飞牛 fnOS
|
||||
@@ -56,7 +54,13 @@ npm run test:docker
|
||||
2. **上传**:将 `flypic/` 目录上传到飞牛
|
||||
3. **打包**:`fnpack build`
|
||||
4. **安装**:`appcenter-cli install-fpk flypic.fpk`
|
||||
5. **访问**:`http://你的飞牛IP:5002`
|
||||
5. **访问**:`http://你的飞牛IP:15002`(端口可在安装时自定义)
|
||||
|
||||
### 安装提示
|
||||
|
||||
- **自定义端口**:安装时可自定义应用端口(默认 15002),避免与其他应用冲突
|
||||
- **素材库路径**:添加素材库时需输入飞牛文件系统的完整路径,如 `/vol1/1000/图片库`
|
||||
- **文件夹权限**:请确保应用对素材库文件夹有读取权限,可在飞牛应用设置中配置授权目录
|
||||
|
||||
## 📁 项目结构
|
||||
|
||||
@@ -66,35 +70,27 @@ FlyPic/
|
||||
├── backend/ # Node.js 后端
|
||||
├── flypic/ # 飞牛打包目录(构建生成)
|
||||
├── scripts/ # 构建脚本
|
||||
│ ├── build-fpk.js # 普通构建
|
||||
│ ├── build-fpk-docker.js # Docker 构建
|
||||
│ └── test-in-docker.js # Docker 测试
|
||||
├── dev.bat # Windows 开发启动脚本
|
||||
├── start.bat # Windows 生产启动脚本
|
||||
├── website/ # 官网静态页面
|
||||
└── 飞牛打包部署指南.md # 完整部署文档
|
||||
```
|
||||
|
||||
## 🎯 支持的图片格式
|
||||
## 🎯 支持的文件格式
|
||||
|
||||
jpg, jpeg, png, webp, gif, bmp, tiff
|
||||
**完整支持**:JPG、PNG、WebP、GIF、BMP、TIFF、SVG
|
||||
|
||||
## 📝 开发说明
|
||||
**可识别**:视频(MP4/MOV/AVI...)、音频(MP3/WAV...)、文档(PDF/TXT...)、设计文件(PSD/AI...)
|
||||
|
||||
### 数据存储
|
||||
## 📝 数据存储
|
||||
|
||||
```
|
||||
素材库目录/
|
||||
├── 用户图片文件...
|
||||
└── .flypic/
|
||||
├── thumbnails/200/ # WebP 缩略图
|
||||
├── metadata.db # SQLite 数据库
|
||||
└── config.json # 配置文件
|
||||
└── .flypic/ # FlyPic 数据目录(隐藏)
|
||||
├── thumbnails/ # WebP 缩略图
|
||||
└── metadata.db # SQLite 数据库
|
||||
```
|
||||
|
||||
### 端口配置
|
||||
|
||||
- 前端开发:5173
|
||||
- 后端服务:5002
|
||||
删除 `.flypic` 文件夹即可完全清除索引数据,不留任何痕迹。
|
||||
|
||||
## 🐛 故障排查
|
||||
|
||||
@@ -106,4 +102,4 @@ MIT License - 详见 [LICENSE](./LICENSE) 文件
|
||||
|
||||
---
|
||||
|
||||
**最后更新**:2025-11-29
|
||||
**官网**:[FlyPic 介绍页](https://flypic.shikejk.com/) | **最后更新**:2025-12-01
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "FlyPic backend server",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon server.js",
|
||||
"dev": "cross-env PORT=15002 nodemon server.js",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -19,6 +19,7 @@
|
||||
"socket.io": "^4.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"nodemon": "^3.0.2"
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,12 +9,12 @@ const app = express();
|
||||
const server = http.createServer(app);
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: process.env.FRONTEND_DIST ? false : 'http://localhost:5173',
|
||||
origin: process.env.FRONTEND_DIST ? false : ['http://localhost:5173', 'http://localhost:3000'],
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
});
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
const PORT = process.env.PORT || 15002;
|
||||
|
||||
// Auto-detect frontend dist path
|
||||
let FRONTEND_DIST = process.env.FRONTEND_DIST;
|
||||
|
||||
@@ -13,11 +13,11 @@ class LibraryDatabase {
|
||||
fs.mkdirSync(this.flypicDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Create thumbnails directory (优化:不再使用子文件夹)
|
||||
// Create thumbnails directory (480px 与 Billfish 一致)
|
||||
const thumbDir = path.join(this.flypicDir, 'thumbnails');
|
||||
if (!fs.existsSync(thumbDir)) {
|
||||
fs.mkdirSync(thumbDir, { recursive: true });
|
||||
}
|
||||
const thumbDir480 = path.join(thumbDir, '480');
|
||||
if (!fs.existsSync(thumbDir)) fs.mkdirSync(thumbDir, { recursive: true });
|
||||
if (!fs.existsSync(thumbDir480)) fs.mkdirSync(thumbDir480, { recursive: true });
|
||||
|
||||
this.db = new Database(this.dbPath);
|
||||
|
||||
@@ -43,6 +43,7 @@ class LibraryDatabase {
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
format TEXT,
|
||||
file_type TEXT DEFAULT 'image',
|
||||
created_at INTEGER,
|
||||
modified_at INTEGER,
|
||||
file_hash TEXT,
|
||||
@@ -51,6 +52,13 @@ class LibraryDatabase {
|
||||
indexed_at INTEGER
|
||||
)
|
||||
`);
|
||||
|
||||
// 添加 file_type 列(如果不存在)
|
||||
try {
|
||||
this.db.exec(`ALTER TABLE images ADD COLUMN file_type TEXT DEFAULT 'image'`);
|
||||
} catch (e) {
|
||||
// 列已存在,忽略错误
|
||||
}
|
||||
|
||||
// Folders table
|
||||
this.db.exec(`
|
||||
@@ -72,17 +80,65 @@ class LibraryDatabase {
|
||||
CREATE INDEX IF NOT EXISTS idx_file_hash ON images(file_hash);
|
||||
CREATE INDEX IF NOT EXISTS idx_folder_path ON folders(path);
|
||||
CREATE INDEX IF NOT EXISTS idx_folder_parent ON folders(parent_path);
|
||||
-- 复合索引:优化文件夹+时间排序查询
|
||||
CREATE INDEX IF NOT EXISTS idx_folder_created ON images(folder, created_at DESC);
|
||||
`);
|
||||
|
||||
// Metadata table for tracking database modifications
|
||||
this.db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS metadata (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT,
|
||||
updated_at INTEGER
|
||||
)
|
||||
`);
|
||||
|
||||
// Initialize last_modified if not exists
|
||||
const lastModified = this.db.prepare('SELECT value FROM metadata WHERE key = ?').get('last_modified');
|
||||
if (!lastModified) {
|
||||
this.db.prepare('INSERT INTO metadata (key, value, updated_at) VALUES (?, ?, ?)').run('last_modified', Date.now().toString(), Date.now());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据库最后修改时间
|
||||
*/
|
||||
updateLastModified() {
|
||||
const now = Date.now();
|
||||
this.db.prepare('INSERT OR REPLACE INTO metadata (key, value, updated_at) VALUES (?, ?, ?)').run('last_modified', now.toString(), now);
|
||||
return now;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据库最后修改时间
|
||||
*/
|
||||
getLastModified() {
|
||||
const row = this.db.prepare('SELECT value FROM metadata WHERE key = ?').get('last_modified');
|
||||
return row ? parseInt(row.value, 10) : Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存元数据
|
||||
*/
|
||||
getCacheMeta() {
|
||||
const lastModified = this.getLastModified();
|
||||
const imageCount = this.db.prepare('SELECT COUNT(*) as count FROM images').get();
|
||||
const folderCount = this.db.prepare('SELECT COUNT(*) as count FROM folders').get();
|
||||
return {
|
||||
dbModifiedAt: lastModified,
|
||||
totalImages: imageCount.count,
|
||||
totalFolders: folderCount.count
|
||||
};
|
||||
}
|
||||
|
||||
// Image operations
|
||||
insertImage(imageData) {
|
||||
const stmt = this.db.prepare(`
|
||||
INSERT OR REPLACE INTO images
|
||||
(path, filename, folder, size, width, height, format, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
(path, filename, folder, size, width, height, format, file_type, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`);
|
||||
return stmt.run(
|
||||
const result = stmt.run(
|
||||
imageData.path,
|
||||
imageData.filename,
|
||||
imageData.folder,
|
||||
@@ -90,6 +146,7 @@ class LibraryDatabase {
|
||||
imageData.width,
|
||||
imageData.height,
|
||||
imageData.format,
|
||||
imageData.file_type || 'image',
|
||||
imageData.created_at,
|
||||
imageData.modified_at,
|
||||
imageData.file_hash,
|
||||
@@ -97,6 +154,9 @@ class LibraryDatabase {
|
||||
imageData.thumbnail_size,
|
||||
Date.now()
|
||||
);
|
||||
// 更新数据库修改时间
|
||||
this.updateLastModified();
|
||||
return result;
|
||||
}
|
||||
|
||||
getImageByPath(imagePath) {
|
||||
@@ -109,61 +169,132 @@ class LibraryDatabase {
|
||||
return stmt.all();
|
||||
}
|
||||
|
||||
searchImages(keywords, filters = {}) {
|
||||
let query = 'SELECT * FROM images WHERE 1=1';
|
||||
searchImages(keywords, filters = {}, pagination = null) {
|
||||
let baseQuery = 'FROM images WHERE 1=1';
|
||||
const params = [];
|
||||
|
||||
// Keyword search (AND logic)
|
||||
if (keywords && keywords.trim()) {
|
||||
const terms = keywords.trim().split(/\s+/);
|
||||
terms.forEach(term => {
|
||||
query += ' AND filename LIKE ?';
|
||||
baseQuery += ' AND filename LIKE ?';
|
||||
params.push(`%${term}%`);
|
||||
});
|
||||
}
|
||||
|
||||
// Folder filter
|
||||
if (filters.folder) {
|
||||
query += ' AND folder LIKE ?';
|
||||
params.push(`${filters.folder}%`);
|
||||
// 使用 OR 组合精确匹配和前缀匹配,包含子文件夹
|
||||
baseQuery += ' AND (folder = ? OR folder LIKE ?)';
|
||||
params.push(filters.folder, `${filters.folder}/%`);
|
||||
}
|
||||
|
||||
// Format filter
|
||||
if (filters.formats && filters.formats.length > 0) {
|
||||
const placeholders = filters.formats.map(() => '?').join(',');
|
||||
query += ` AND format IN (${placeholders})`;
|
||||
baseQuery += ` AND format IN (${placeholders})`;
|
||||
params.push(...filters.formats);
|
||||
}
|
||||
|
||||
// Size filter (in KB)
|
||||
if (filters.minSize) {
|
||||
query += ' AND size >= ?';
|
||||
baseQuery += ' AND size >= ?';
|
||||
params.push(filters.minSize * 1024);
|
||||
}
|
||||
if (filters.maxSize) {
|
||||
query += ' AND size <= ?';
|
||||
baseQuery += ' AND size <= ?';
|
||||
params.push(filters.maxSize * 1024);
|
||||
}
|
||||
|
||||
// Date filter
|
||||
if (filters.startDate) {
|
||||
query += ' AND created_at >= ?';
|
||||
baseQuery += ' AND created_at >= ?';
|
||||
params.push(filters.startDate);
|
||||
}
|
||||
if (filters.endDate) {
|
||||
query += ' AND created_at <= ?';
|
||||
baseQuery += ' AND created_at <= ?';
|
||||
params.push(filters.endDate);
|
||||
}
|
||||
|
||||
query += ' ORDER BY created_at DESC';
|
||||
// 如果需要分页
|
||||
if (pagination && typeof pagination.offset === 'number' && typeof pagination.limit === 'number') {
|
||||
const timings = {};
|
||||
|
||||
// 先获取数据(快速)
|
||||
const query = `SELECT * ${baseQuery} ORDER BY created_at DESC LIMIT ? OFFSET ?`;
|
||||
const paginatedParams = [...params, pagination.limit, pagination.offset];
|
||||
|
||||
let queryStart = Date.now();
|
||||
const stmt = this.db.prepare(query);
|
||||
const images = stmt.all(...paginatedParams);
|
||||
timings.dataQuery = Date.now() - queryStart;
|
||||
|
||||
// 如果是第一页且结果数量小于 limit,说明没有更多数据,无需 COUNT
|
||||
if (pagination.offset === 0 && images.length < pagination.limit) {
|
||||
return {
|
||||
images,
|
||||
total: images.length,
|
||||
offset: pagination.offset,
|
||||
limit: pagination.limit,
|
||||
hasMore: false
|
||||
};
|
||||
}
|
||||
|
||||
// 如果是文件夹查询,尝试从 folders 表获取 count(更快)
|
||||
let total = 0;
|
||||
queryStart = Date.now();
|
||||
if (filters.folder && !keywords && !filters.formats?.length && !filters.minSize && !filters.maxSize && !filters.startDate && !filters.endDate) {
|
||||
const folderRow = this.db.prepare('SELECT image_count FROM folders WHERE path = ?').get(filters.folder);
|
||||
if (folderRow) {
|
||||
total = folderRow.image_count;
|
||||
timings.countSource = 'folders_table';
|
||||
}
|
||||
}
|
||||
|
||||
// 如果无法从 folders 表获取,才执行 COUNT(较慢)
|
||||
if (total === 0) {
|
||||
const countStmt = this.db.prepare(`SELECT COUNT(*) as total ${baseQuery}`);
|
||||
const countResult = countStmt.get(...params);
|
||||
total = countResult.total;
|
||||
timings.countSource = 'count_query';
|
||||
}
|
||||
timings.countQuery = Date.now() - queryStart;
|
||||
|
||||
// 性能日志
|
||||
const totalTime = timings.dataQuery + timings.countQuery;
|
||||
if (totalTime > 50) {
|
||||
console.log(`[DB] searchImages: data=${timings.dataQuery}ms, count=${timings.countQuery}ms (${timings.countSource}), folder=${filters.folder || 'all'}`);
|
||||
}
|
||||
|
||||
return {
|
||||
images,
|
||||
total,
|
||||
offset: pagination.offset,
|
||||
limit: pagination.limit,
|
||||
hasMore: pagination.offset + images.length < total
|
||||
};
|
||||
}
|
||||
|
||||
// 无分页,返回所有结果(保持向后兼容)
|
||||
const query = `SELECT * ${baseQuery} ORDER BY created_at DESC`;
|
||||
const stmt = this.db.prepare(query);
|
||||
return stmt.all(...params);
|
||||
}
|
||||
|
||||
deleteImage(imagePath) {
|
||||
const stmt = this.db.prepare('DELETE FROM images WHERE path = ?');
|
||||
return stmt.run(imagePath);
|
||||
const result = stmt.run(imagePath);
|
||||
// 更新数据库修改时间
|
||||
if (result.changes > 0) {
|
||||
this.updateLastModified();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Update folder field for a specific image (by path)
|
||||
updateImageFolder(imagePath, folderPath) {
|
||||
const stmt = this.db.prepare('UPDATE images SET folder = ? WHERE path = ?');
|
||||
return stmt.run(folderPath, imagePath);
|
||||
}
|
||||
|
||||
// Folder operations
|
||||
@@ -197,13 +328,46 @@ class LibraryDatabase {
|
||||
}
|
||||
|
||||
deleteImagesByFolderPrefix(folderPath) {
|
||||
// 使用 folderPath/% 确保只匹配真正的子文件夹,避免误删同名前缀文件夹
|
||||
const stmt = this.db.prepare('DELETE FROM images WHERE folder = ? OR folder LIKE ?');
|
||||
return stmt.run(folderPath, `${folderPath}%`);
|
||||
const result = stmt.run(folderPath, `${folderPath}/%`);
|
||||
// 更新数据库修改时间
|
||||
if (result.changes > 0) {
|
||||
this.updateLastModified();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
deleteFoldersByPrefix(folderPath) {
|
||||
// 使用 folderPath/% 确保只匹配真正的子文件夹
|
||||
const stmt = this.db.prepare('DELETE FROM folders WHERE path = ? OR path LIKE ?');
|
||||
return stmt.run(folderPath, `${folderPath}%`);
|
||||
return stmt.run(folderPath, `${folderPath}/%`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件夹的文件数量(包含所有子文件夹中的图片)
|
||||
*/
|
||||
updateFolderImageCount(folderPath) {
|
||||
// 统计该文件夹及其所有子文件夹中的图片总数
|
||||
// folder = ? 匹配直接子文件,folder LIKE ?/% 匹配所有子文件夹
|
||||
const countStmt = this.db.prepare(
|
||||
'SELECT COUNT(*) as count FROM images WHERE folder = ? OR folder LIKE ?'
|
||||
);
|
||||
const result = countStmt.get(folderPath, `${folderPath}/%`);
|
||||
|
||||
// 更新文件夹记录
|
||||
const updateStmt = this.db.prepare('UPDATE folders SET image_count = ? WHERE path = ?');
|
||||
return updateStmt.run(result.count, folderPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新所有文件夹的文件数量
|
||||
*/
|
||||
updateAllFolderCounts() {
|
||||
const folders = this.getAllFolders();
|
||||
for (const folder of folders) {
|
||||
this.updateFolderImageCount(folder.path);
|
||||
}
|
||||
}
|
||||
|
||||
getFolderTree() {
|
||||
@@ -228,15 +392,6 @@ class LibraryDatabase {
|
||||
return tree;
|
||||
}
|
||||
|
||||
updateFolderImageCount(folderPath) {
|
||||
const stmt = this.db.prepare(`
|
||||
UPDATE folders
|
||||
SET image_count = (SELECT COUNT(*) FROM images WHERE folder LIKE ?)
|
||||
WHERE path = ?
|
||||
`);
|
||||
return stmt.run(`${folderPath}%`, folderPath);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.db.close();
|
||||
}
|
||||
|
||||
Generated
+48
@@ -14,10 +14,12 @@
|
||||
"crypto": "^1.0.1",
|
||||
"express": "^4.18.2",
|
||||
"glob": "^10.3.10",
|
||||
"p-limit": "^7.2.0",
|
||||
"sharp": "^0.33.0",
|
||||
"socket.io": "^4.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"nodemon": "^3.0.2"
|
||||
}
|
||||
},
|
||||
@@ -811,6 +813,25 @@
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-env": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz",
|
||||
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"cross-env": "src/bin/cross-env.js",
|
||||
"cross-env-shell": "src/bin/cross-env-shell.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.14",
|
||||
"npm": ">=6",
|
||||
"yarn": ">=1"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@@ -1766,6 +1787,21 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/p-limit": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/p-limit/-/p-limit-7.2.0.tgz",
|
||||
"integrity": "sha512-ATHLtwoTNDloHRFFxFJdHnG6n2WUeFjaR8XQMFdKIv0xkXjrER8/iG9iu265jOM95zXHAfv9oTkqhrfbIzosrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"yocto-queue": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/package-json-from-dist": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||
@@ -2784,6 +2820,18 @@
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-1.2.2.tgz",
|
||||
"integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "FlyPic backend server",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon server.js",
|
||||
"dev": "cross-env PORT=15002 nodemon server.js",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -14,10 +14,12 @@
|
||||
"crypto": "^1.0.1",
|
||||
"express": "^4.18.2",
|
||||
"glob": "^10.3.10",
|
||||
"p-limit": "^7.2.0",
|
||||
"sharp": "^0.33.0",
|
||||
"socket.io": "^4.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"nodemon": "^3.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var Es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gd={exports:{}},$o={},yd={exports:{}},Se={};/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var ms=Symbol.for("react.element"),Sm=Symbol.for("react.portal"),bm=Symbol.for("react.fragment"),Em=Symbol.for("react.strict_mode"),Cm=Symbol.for("react.profiler"),Nm=Symbol.for("react.provider"),Rm=Symbol.for("react.context"),Tm=Symbol.for("react.forward_ref"),Om=Symbol.for("react.suspense"),Im=Symbol.for("react.memo"),Am=Symbol.for("react.lazy"),dc=Symbol.iterator;function jm(e){return e===null||typeof e!="object"?null:(e=dc&&e[dc]||e["@@iterator"],typeof e=="function"?e:null)}var vd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},wd=Object.assign,xd={};function vi(e,t,r){this.props=e,this.context=t,this.refs=xd,this.updater=r||vd}vi.prototype.isReactComponent={};vi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};vi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _d(){}_d.prototype=vi.prototype;function ou(e,t,r){this.props=e,this.context=t,this.refs=xd,this.updater=r||vd}var au=ou.prototype=new _d;au.constructor=ou;wd(au,vi.prototype);au.isPureReactComponent=!0;var hc=Array.isArray,kd=Object.prototype.hasOwnProperty,lu={current:null},Sd={key:!0,ref:!0,__self:!0,__source:!0};function bd(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)kd.call(t,n)&&!Sd.hasOwnProperty(n)&&(i[n]=t[n]);var a=arguments.length-2;if(a===1)i.children=r;else if(1<a){for(var l=Array(a),f=0;f<a;f++)l[f]=arguments[f+2];i.children=l}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)i[n]===void 0&&(i[n]=a[n]);return{$$typeof:ms,type:e,key:s,ref:o,props:i,_owner:lu.current}}function zm(e,t){return{$$typeof:ms,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function uu(e){return typeof e=="object"&&e!==null&&e.$$typeof===ms}function Lm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var pc=/\/+/g;function ha(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Lm(""+e.key):t.toString(36)}function Ys(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ms:case Sm:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+ha(o,0):n,hc(i)?(r="",e!=null&&(r=e.replace(pc,"$&/")+"/"),Ys(i,t,r,"",function(f){return f})):i!=null&&(uu(i)&&(i=zm(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(pc,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",hc(e))for(var a=0;a<e.length;a++){s=e[a];var l=n+ha(s,a);o+=Ys(s,t,r,l,i)}else if(l=jm(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=n+ha(s,a++),o+=Ys(s,t,r,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Cs(e,t,r){if(e==null)return e;var n=[],i=0;return Ys(e,n,"","",function(s){return t.call(r,s,i++)}),n}function Pm(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var dt={current:null},Zs={transition:null},Fm={ReactCurrentDispatcher:dt,ReactCurrentBatchConfig:Zs,ReactCurrentOwner:lu};function Ed(){throw Error("act(...) is not supported in production builds of React.")}Se.Children={map:Cs,forEach:function(e,t,r){Cs(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Cs(e,function(){t++}),t},toArray:function(e){return Cs(e,function(t){return t})||[]},only:function(e){if(!uu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Se.Component=vi;Se.Fragment=bm;Se.Profiler=Cm;Se.PureComponent=ou;Se.StrictMode=Em;Se.Suspense=Om;Se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fm;Se.act=Ed;Se.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=wd({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=lu.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)kd.call(t,l)&&!Sd.hasOwnProperty(l)&&(n[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){a=Array(l);for(var f=0;f<l;f++)a[f]=arguments[f+2];n.children=a}return{$$typeof:ms,type:e.type,key:i,ref:s,props:n,_owner:o}};Se.createContext=function(e){return e={$$typeof:Rm,_currentValue:e,_currentValue2:e,_threadCountLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var Dm=Z,Mm=Symbol.for("react.element"),Bm=Symbol.for("react.fragment"),Um=Object.prototype.hasOwnProperty,$m=Dm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Wm={key:!0,ref:!0,__self:!0,__source:!0};function Cd(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)Um.call(t,n)&&!Wm.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:Mm,type:e,key:s,ref:o,props:i,_owner:$m.current}}$o.Fragment=Bm;$o.jsx=Cd;$o.jsxs=Cd;gd.exports=$o;var S=gd.exports,Za={},Nd={exports:{}},Nt={},Rd={exports:{}},Td={};/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/(function(e){function t($,D){var H=$.length;$.push(D);e:for(;0<H;){var I=H-1>>>1,A=$[I];if(0<i(A,D))$[I]=D,$[H]=A,H=I;else break e}}function r($){return $.length===0?null:$[0]}function n($){if($.length===0)return null;var D=$[0],H=$.pop();if(H!==D){$[0]=H;e:for(var I=0,A=$.length,V=A>>>1;I<V;){var M=2*(I+1)-1,W=$[M],oe=M+1,he=$[oe];if(0>i(W,H))oe<A&&0>i(he,W)?($[I]=he,$[oe]=H,I=oe):($[I]=W,$[M]=H,I=M);else if(oe<A&&0>i(he,H))$[I]=he,$[oe]=H,I=oe;else break e}}return D}function i($,D){var H=$.sortIndex-D.sortIndex;return H!==0?H:$.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],f=[],p=1,y=null,x=3,g=!1,m=!1,u=!1,v=typeof setTimeout=="function"?setTimeout:null,c=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var D=r(f);D!==null;){if(D.callback===null)n(f);else if(D.startTime<=$)n(f),D.sortIndex=D.expirationTime,t(l,D);else break;D=r(f)}}function k($){if(u=!1,w($),!m)if(r(l)!==null)m=!0,se(b);else{var D=r(f);D!==null&&Q(k,D.startTime-$)}}function b($,D){m=!1,u&&(u=!1,c(L),L=-1),g=!0;var H=x;try{for(w(D),y=r(l);y!==null&&(!(y.expirationTime>D)||$&&!ee());){var I=y.callback;if(typeof I=="function"){y.callback=null,x=y.priorityLevel;var A=I(y.expirationTime<=D);D=e.unstable_now(),typeof A=="function"?y.callback=A:y===r(l)&&n(l),w(D)}else n(l);y=r(l)}if(y!==null)var V=!0;else{var M=r(f);M!==null&&Q(k,M.startTime-D),V=!1}return V}finally{y=null,x=H,g=!1}}var N=!1,T=null,L=-1,O=5,F=-1;function ee(){return!(e.unstable_now()-F<O)}function R(){if(T!==null){var $=e.unstable_now();F=$;var D=!0;try{D=T(!0,$)}finally{D?U():(N=!1,T=null)}}else N=!1}var U;if(typeof d=="function")U=function(){d(R)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,q=_.port2;_.port1.onmessage=R,U=function(){q.postMessage(null)}}else U=function(){v(R,0)};function se($){T=$,N||(N=!0,U())}function Q($,D){L=v(function(){$(e.unstable_now())},D)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_continueExecution=function(){m||g||(m=!0,se(b))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(l)},e.unstable_next=function($){switch(x){case 1:case 2:case 3:var D=3;break;default:D=x}var H=x;x=D;try{return $()}finally{x=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,D){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var H=x;x=$;try{return D()}finally{x=H}},e.unstable_scheduleCallback=function($,D,H){var I=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?I+H:I):H=I,$){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=H+A,$={id:p++,callback:D,priorityLevel:$,startTime:H,expirationTime:A,sortIndex:-1},H>I?($.sortIndex=H,t(f,$),r(l)===null&&$===r(f)&&(u?(c(L),L=-1):u=!0,Q(k,H-I))):($.sortIndex=A,t(l,$),m||g||(m=!0,se(b))),$},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function($){var D=x;return function(){var H=x;x=D;try{return $.apply(this,arguments)}finally{x=H}}}})(Td);Rd.exports=Td;var Hm=Rd.exports;/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var Vm=Z,Ct=Hm;function ie(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Od=new Set,Qi={};function In(e,t){ui(e,t),ui(e+"Capture",t)}function ui(e,t){for(Qi[e]=t,e=0;e<t.length;e++)Od.add(t[e])}var Or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qa=Object.prototype.hasOwnProperty,qm=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,mc={},gc={};function Km(e){return Qa.call(gc,e)?!0:Qa.call(mc,e)?!1:qm.test(e)?gc[e]=!0:(mc[e]=!0,!1)}function Xm(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ym(e,t,r,n){if(t===null||typeof t>"u"||Xm(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ht(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var et={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){et[e]=new ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];et[t]=new ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){et[e]=new ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){et[e]=new ht(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){et[e]=new ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){et[e]=new ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){et[e]=new ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){et[e]=new ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){et[e]=new ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var cu=/[\-:]([a-z])/g;function fu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(cu,fu);et[t]=new ht(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(cu,fu);et[t]=new ht(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(cu,fu);et[t]=new ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){et[e]=new ht(e,1,!1,e.toLowerCase(),null,!1,!1)});et.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){et[e]=new ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function du(e,t,r,n){var i=et.hasOwnProperty(t)?et[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!==
Line truncated
|
||||
`+pa+e}var ma=!1;function ga(e,t){if(!e||ma)return"";ma=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(f){var n=f}Reflect.construct(e,[],t)}else{try{t.call()}catch(f){n=f}e.call(t.prototype)}else{try{throw Error()}catch(f){n=f}e()}}catch(f){if(f&&n&&typeof f.stack=="string"){for(var i=f.stack.split(`
|
||||
`),s=n.stack.split(`
|
||||
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
||||
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{ma=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Pi(e):""}function Zm(e){switch(e.tag){case 5:return Pi(e.type);case 16:return Pi("Lazy");case 13:return Pi("Suspense");case 19:return Pi("SuspenseList");case 0:case 2:case 15:return e=ga(e.type,!1),e;case 11:return e=ga(e.type.render,!1),e;case 1:return e=ga(e.type,!0),e;default:return""}}function tl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Hn:return"Fragment";case Wn:return"Portal";case Ga:return"Profiler";case hu:return"StrictMode";case Ja:return"Suspense";case el:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ad:return(e.displayName||"Context")+".Consumer";case Id:return(e._context.displayName||"Context")+".Provider";case pu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mu:return t=e.displayName||null,t!==null?t:tl(e.type)||"Memo";case $r:t=e._payload,e=e._init;try{return tl(e(t))}catch{}}return null}function Qm(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return tl(t);case 8:return t===hu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gm(e){var t=zd(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rs(e){e._valueTracker||(e._valueTracker=Gm(e))}function Ld(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=zd(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function mo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function rl(e,t){var r=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function vc(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=on(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Pd(e,t){t=t.checked,t!=null&&du(e,"checked",t,!1)}function nl(e,t){Pd(e,t);var r=on(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?il(e,t.type,r):t.hasOwnProperty("defaultValue")&&il(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wc(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function il(e,t,r){(t!=="number"||mo(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Fi=Array.isArray;function ri(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+on(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function sl(e,t){if(t.dan
Line truncated
|
||||
`).replace(lg,"")}function Ps(e,t,r){if(t=$c(t),$c(e)!==t&&r)throw Error(ie(425))}function So(){}var vl=null,wl=null;function xl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _l=typeof setTimeout=="function"?setTimeout:void 0,ug=typeof clearTimeout=="function"?clearTimeout:void 0,Wc=typeof Promise=="function"?Promise:void 0,cg=typeof queueMicrotask=="function"?queueMicrotask:typeof Wc<"u"?function(e){return Wc.resolve(null).then(e).catch(fg)}:_l;function fg(e){setTimeout(function(){throw e})}function Ta(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),rs(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);rs(t)}function Gr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Hc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var xi=Math.random().toString(36).slice(2),lr="__reactFiber$"+xi,as="__reactProps$"+xi,Ir="__reactContainer$"+xi,kl="__reactEvents$"+xi,dg="__reactListeners$"+xi,hg="__reactHandles$"+xi;function vn(e){var t=e[lr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Ir]||r[lr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Hc(e);e!==null;){if(r=e[lr])return r;e=Hc(e)}return t}e=r,r=e.parentNode}return null}function vs(e){return e=e[lr]||e[Ir],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ie(33))}function Ko(e){return e[as]||null}var Sl=[],Yn=-1;function un(e){return{current:e}}function Le(e){0>Yn||(e.current=Sl[Yn],Sl[Yn]=null,Yn--)}function Oe(e,t){Yn++,Sl[Yn]=e.current,e.current=t}var an={},ot=un(an),gt=un(!1),En=an;function ci(e,t){var r=e.type.contextTypes;if(!r)return an;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function yt(e){return e=e.childContextTypes,e!=null}function bo(){Le(gt),Le(ot)}function Vc(e,t,r){if(ot.current!==an)throw Error(ie(168));Oe(ot,t),Oe(gt,r)}function bh(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(ie(108,Qm(e)||"Unknown",i));return Be({},r,n)}function Eo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,En=ot.current,Oe(ot,e),Oe(gt,gt.current),!0}function qc(e,t,r){var n=e.stateNode;if(!n)throw Error(ie(169));r?(e=bh(e,t,En),n.__reactInternalMemoizedMergedChildContext=e,Le(gt),Le(ot),Oe(ot,e)):Le(gt),Oe(gt,r)}var Er=null,Xo=!1,Oa=!1;function Eh(e){Er===null?Er=[e]:Er.push(e)}function pg(e){Xo=!0,Eh(e)}function cn(){if(!Oa&&Er!==null){Oa=!0;var e=0,t=Re;try{var r=Er;for(Re=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Er=null,Xo=!1}catch(i){throw Er!==null&&(Er=Er.slice(e+1)),Zd(yu,cn),i}finally{Re=t,Oa=!1}}return null}var Zn=[],Qn=0,Co=null,No=0,zt=[],Lt=0,Cn=null,Nr=1,Rr="";function mn(e,t){Zn[Qn++]=No,Zn[Qn++]=Co,Co=e,No=t}function Ch(e,t,r){zt[Lt++]=Nr,zt[Lt++]=Rr,zt[Lt++]=Cn,Cn=e;var n=Nr;e=Rr;var i=32-Yt(n)-1;n&=~(1<<i),r+=1;var s=32-Yt(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Nr=1<<32-Yt(t)+i|r<<i|n,Rr=s+e}else Nr=1<<s|r<<i|n,Rr=e}function Cu(e){e.return!==null&&(mn(e,1),Ch(e,1,0))}function Nu(e){for(;e===Co;)Co=Zn[--Qn],Zn[Qn]=null,No=Zn[--Qn],Zn[Qn]=null;for(;e===Cn;)Cn=zt[--Lt],zt[Lt]=null,Rr=zt[--Lt],zt[Lt]=null,Nr=zt[--Lt],zt[Lt]=null}var Et=null,bt=null,Fe=!1,Xt=null;function Nh(e,t){var r=Dt(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function Kc(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Et=e,bt=Gr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,bt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Cn!==null?{id:Nr,overflow:Rr}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Dt(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Et=e,bt=null,!0):!1;default:return!1}}function bl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function El(e){if(Fe){var t=bt;if(t){var r=t;if(!Kc(e,t)){if(bl(e))throw Error(ie(418));t=Gr(r.nextSibling);var n=Et;t&&Kc(e,t)?Nh(n,r):(e.flags=e.flags&-4097|2,Fe=!1,Et=e)}}else{if(bl(e))throw Error(ie(418));e.flags=e.flags&-4097|2,Fe=!1,Et=e}}}function Xc(e){
Line truncated
|
||||
Error generating stack: `+s.message+`
|
||||
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function La(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Tl(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Sg=typeof WeakMap=="function"?WeakMap:Map;function ep(e,t,r){r=Tr(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Lo||(Lo=!0,Ml=n),Tl(e,t)},r}function tp(e,t,r){r=Tr(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){Tl(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Tl(e,t),typeof n!="function"&&(en===null?en=new Set([this]):en.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function rf(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Sg;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=Fg.bind(null,e,t,r),t.then(e,e))}function nf(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function sf(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Tr(-1,1),t.tag=2,Jr(r,t,1))),r.lanes|=1),e)}var bg=zr.ReactCurrentOwner,mt=!1;function ct(e,t,r,n){t.child=e===null?Oh(t,null,r,n):di(t,e.child,r,n)}function of(e,t,r,n,i){r=r.render;var s=t.ref;return oi(t,i),n=Du(e,t,r,n,s,i),r=Mu(),e!==null&&!mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jr(e,t,i)):(Fe&&r&&Cu(t),t.flags|=1,ct(e,t,n,i),t.child)}function af(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Yu(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,rp(e,t,s,n,i)):(e=oo(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:is,r(o,n)&&e.ref===t.ref)return jr(e,t,i)}return t.flags|=1,e=rn(s,n),e.ref=t.ref,e.return=t,t.child=e}function rp(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(is(s,n)&&e.ref===t.ref)if(mt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(mt=!0);else return t.lanes=e.lanes,jr(e,t,i)}return Ol(e,t,r,n,i)}function np(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe(ei,St),St|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe(ei,St),St|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Oe(ei,St),St|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,Oe(ei,St),St|=n;return ct(e,t,i,r),t.child}function ip(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ol(e,t,r,n,i){var s=yt(r)?En:ot.current;return s=ci(t,s),oi(t,i),r=Du(e,t,r,n,s,i),n=Mu(),e!==null&&!mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jr(e,t,i)):(Fe&&n&&Cu(t),t.flags|=1,ct(e,t,r,i),t.child)}function lf(e,t,r,n,i){if(yt(r)){var s=!0;Eo(t)}else s=!1;if(oi(t,i),t.stateNode===null)no(e,t),Jh(t,r,n),Rl(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,f=r.contextType;typeof f=="object"&&f!==null?f=Bt(f):(f=yt(r)?En:ot.current,f=ci(t,f));var p=r.getDerivedStateFromProps,y=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";y||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==f)&&tf(t,o,n,f),Wr=!1;var x=t.memoizedState;o.state=x,Oo(t,n,o,i),l=t.memoizedState,a!==n||x!==l||gt.current||Wr?(typeof p=="function"&&(Nl(t,r,p,n),l=t.memoizedState),(a=Wr||ef(t,r,a,n,x,l,f))?(y||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=f,n=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Ah(e,t),a=t.memoizedProps,f=t.type===t.elementType?a:Vt(t.type,a),o.props=f,y=t.pendingProps,x=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=Bt(l):(l=yt(r)?En:ot.current,l=ci(t,l));var g=r.getDerivedStateFromProps;(p=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==y||x!==l)&&tf(t,o,n,l),Wr=!1,x=t.memoizedState,o.state=x,Oo(t,n,o,i);var m=t.memoizedS
Line truncated
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var gi=Z;function Wy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hy=typeof Object.is=="function"?Object.is:Wy,Vy=gi.useState,qy=gi.useEffect,Ky=gi.useLayoutEffect,Xy=gi.useDebugValue;function Yy(e,t){var r=t(),n=Vy({inst:{value:r,getSnapshot:t}}),i=n[0].inst,s=n[1];return Ky(function(){i.value=r,i.getSnapshot=t,$a(i)&&s({inst:i})},[e,r,t]),qy(function(){return $a(i)&&s({inst:i}),e(function(){$a(i)&&s({inst:i})})},[e]),Xy(r),r}function $a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Hy(e,r)}catch{return!0}}function Zy(e,t){return t()}var Qy=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Zy:Yy;Vp.useSyncExternalStore=gi.useSyncExternalStore!==void 0?gi.useSyncExternalStore:Qy;Hp.exports=Vp;var Gy=Hp.exports;/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var oa=Z,Jy=Gy;function ev(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tv=typeof Object.is=="function"?Object.is:ev,rv=Jy.useSyncExternalStore,nv=oa.useRef,iv=oa.useEffect,sv=oa.useMemo,ov=oa.useDebugValue;Wp.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=nv(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=sv(function(){function l(g){if(!f){if(f=!0,p=g,g=n(g),i!==void 0&&o.hasValue){var m=o.value;if(i(m,g))return y=m}return y=g}if(m=y,tv(p,g))return m;var u=n(g);return i!==void 0&&i(m,u)?(p=g,m):(p=g,y=u)}var f=!1,p,y,x=r===void 0?null:r;return[function(){return l(t())},x===null?void 0:function(){return l(x())}]},[t,r,n,i]);var a=rv(e,s[0],s[1]);return iv(function(){o.hasValue=!0,o.value=a},[a]),ov(a),a};$p.exports=Wp;var av=$p.exports;const lv=su(av),qp={},{useDebugValue:uv}=ke,{useSyncExternalStoreWithSelector:cv}=lv;let Rf=!1;const fv=e=>e;function dv(e,t=fv,r){(qp?"production":void 0)!=="production"&&r&&!Rf&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Rf=!0);const n=cv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return uv(n),n}const Tf=e=>{(qp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?$y(e):e,r=(n,i)=>dv(t,n,i);return Object.assign(r,t),r},hv=e=>e?Tf(e):Tf,me=hv((e,t)=>({theme:"light",setTheme:r=>e({theme:r}),toggleTheme:()=>e(r=>({theme:r.theme==="light"?"dark":"light"})),libraries:[],currentLibraryId:null,setLibraries:r=>e({libraries:r}),setCurrentLibrary:r=>e({currentLibraryId:r}),addLibrary:r=>e(n=>({libraries:[...n.libraries,r]})),removeLibrary:r=>e(n=>({libraries:n.libraries.filter(i=>i.id!==r),currentLibraryId:n.currentLibraryId===r?null:n.currentLibraryId})),images:[],filteredImages:[],totalImageCount:0,setImages:r=>e({images:r,filteredImages:r}),setFilteredImages:r=>e({filteredImages:r}),setTotalImageCount:r=>e({totalImageCount:r}),imageLoadingState:{isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1},setImageLoadingState:r=>e(n=>({imageLoadingState:{...n.imageLoadingState,...r}})),appendImages:r=>e(n=>({images:[...n.images,...r],filteredImages:[...n.filteredImages,...r]})),folders:[],selectedFolder:null,setFolders:r=>e({folders:r}),setSelectedFolder:r=>e({selectedFolder:r}),searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null},setSearchKeywords:r=>e({searchKeywords:r}),setFilters:r=>e(n=>({filters:{...n.filters,...r}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null}}),selectedImage:null,setSelectedImage:r=>e({selectedImage:r}),selectedImages:[],setSelectedImages:r=>e({selectedImages:r}),toggleImageSelection:r=>e(n=>n.selectedImages.some(s=>s.path===r.path)?{selectedImages:n.selectedImages.filter(s=>s.path!==r.path)}:{selectedImages:[...n.selectedImages,r]}),clearSelection:()=>e({selectedImages:[],selectedImage:null}),scanProgress:null,scanStartTime:null,setScanProgress:r=>e(n=>r&&!n.scanStartTime&&r.current>0?{scanProgress:r,scanStartTime:Date.now()}:r?{scanProgress:r}:{scanProgress:null,scanStartTime:null}),isResizingPanels:!1,setIsResizingPanels:r=>e({isResizingPanels:r}),resizingSide:null,setResizingSide:r=>e({resizingSide:r}),thumbnailHeight:200,setThumbnailHeight:r=>e({thumbnailHeight:r}),mobileView:"main",setMobileView:r=>e({mobileView:r}),getCurrentLibrary:()=>{const r=t();return r.libraries.find(n=>n.id===r.currentLibraryId)}}));function Kp(e,t){return function(){return e.apply(t,arguments)}}const{toString:pv}=Object.prototype,{getPrototypeOf:sc}=Object,{iterator:aa,toStringTag:Xp}=Symbol,la=(e=>t=>{const r=pv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>la(t)===e),ua=e=>t=>typeof t===e,{isArray:ki}=Array,yi=ua("undefined");function xs(e){return e!==null&&!yi(e)&&e.constructor!==null&&!yi(e.constructor)&&wt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yp=Gt("ArrayBuffer");function mv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yp(e.buffer),t}const gv=ua("string"),wt=ua("function"),Zp=ua("number"),_s=e=>e!==null&&typeof e=="object",yv=e=>e===!0||e===!1,fo=e=>{if(la(e)!=="object")return!1;const t=sc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Xp in e)&&!(aa in e)},vv=e=>{if(!_s(e)||xs(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},wv=Gt("Date"),xv=Gt("File"),_v=Gt("Blob"),kv=Gt("FileList"),Sv=e=>_s(e)&&wt(e.pipe),bv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||wt(e.append)&&((t=Line truncated
|
||||
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&m1[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},zf=Symbol("internals");function Li(e){return e&&String(e).trim().toLowerCase()}function ho(e){return e===!1||e==null?e:K.isArray(e)?e.map(ho):String(e)}function y1(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const v1=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Wa(e,t,r,n,i){if(K.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!K.isString(t)){if(K.isString(n))return t.indexOf(n)!==-1;if(K.isRegExp(n))return n.test(t)}}function w1(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function x1(e,t){const r=K.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,s,o){return this[n].call(this,t,i,s,o)},configurable:!0})})}let xt=class{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,l,f){const p=Li(l);if(!p)throw new Error("header name must be a non-empty string");const y=K.findKey(i,p);(!y||i[y]===void 0||f===!0||f===void 0&&i[y]!==!1)&&(i[y||l]=ho(a))}const o=(a,l)=>K.forEach(a,(f,p)=>s(f,p,l));if(K.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(K.isString(t)&&(t=t.trim())&&!v1(t))o(g1(t),r);else if(K.isObject(t)&&K.isIterable(t)){let a={},l,f;for(const p of t){if(!K.isArray(p))throw TypeError("Object iterator must return a key-value pair");a[f=p[0]]=(l=a[f])?K.isArray(l)?[...l,p[1]]:[l,p[1]]:p[1]}o(a,r)}else t!=null&&s(r,t,n);return this}get(t,r){if(t=Li(t),t){const n=K.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return y1(i);if(K.isFunction(r))return r.call(this,i,n);if(K.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Li(t),t){const n=K.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Wa(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=Li(o),o){const a=K.findKey(n,o);a&&(!r||Wa(n,n[a],a,r))&&(delete n[a],i=!0)}}return K.isArray(t)?t.forEach(s):s(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!t||Wa(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const r=this,n={};return K.forEach(this,(i,s)=>{const o=K.findKey(n,s);if(o){r[o]=ho(i),delete r[s];return}const a=t?w1(s):String(s).trim();a!==s&&delete r[s],r[a]=ho(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return K.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&K.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
||||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[zf]=this[zf]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Li(o);n[a]||(x1(i,o),n[a]=!0)}return K.isArray(t)?t.forEach(s):s(t),this}};xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);K.reduceDescriptors(xt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});K.freezeMethods(xt);function Ha(e,t){const r=this||Ss,n=t||r,i=xt.from(n.headers);let s=n.data;return K.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function lm(e){return!!(e&&e.__CANCEL__)}function Si(e,t,r){we.call(this,e??"canceled",we.ERR_CANCELED,t,r),this.name="CanceledError"}K.inherits(Si,we,{__CANCEL__:!0});function um(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new we("Request failed with status code "+r.status,[we.ERR_BAD_REQUEST,we.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function _1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function k1(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const f=Date.now(),p=n[s];o||(o=f),r[i]=l,n[i]=f;let y=s,x=0;for(;y!==i;)x+=r[y++],y=y%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),f-o<t)return;const g=p&&f-p;return g?Math.round(x*1e3/g):void 0}}function S1(e,t){let r=0,n=1e3/t,i,s;const o=(f,p=Date.now())=>{r=p,i=null,s&&(clearTimeout(s),s=null),e(...f)};return[(...f)=>{const p=Date.now(),y=p-r;y>=n?o(f,p):(i=f,s||(s=setTimeout(()=>{s=null,o(i)},n-y)))},()=>i&&o(i)]}const Mo=(e,t,r=3)=>{let n=0;const i=k1(50,250);return S1(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-n,f=i(l),p=o<=a;n=o;const y={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:f||void 0,estimated:f&&a&&p?(a-o)/f:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(y)},r)},Lf=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Pf=e=>(...t)=>K.asap(()=>e(...t)),b1=st.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,st.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(st.origin),st.navigator&&/(msie|trident)/i.test(st.navigator.userAgent)):()=>!0,E1=st.hasStandardBrowserEnv?{write(e,t,r,n,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];K.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),K.isString(n)&&a.push(`path=${n}`),K.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),K.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function C1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function N1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function cm(e,t,r){let n=!C1(t);return e&&(n||r==!1)?N1(e,t):t}const Ff=e=>e instanceof xt?{...e}:e;function On(e,t){t=t||{};const r={};function n(f,p,y,x){return K.isPlainObject(f)&&K.isPlainObject(p)?K.merge.call({caseless:x},f,p):K.isPlainObject(p)?K.merge({},p):K.isArray(p)?p.slice():p}function i(f,p,y,x){if(K.isUndefined(p)){if(!K.isUndefined(f))return n(void 0,f,y,x)}else return n(f,p,y,x)}function s(f,p){if(!K.isUndefined(p))return n(void 0,p)}function o(f,p){if(K.isUndefined(p)){if(!K.isUndefined(f))return n(void 0,f)}else return n(void 0,p)}function a(f,p,y){if(y in t)return n(f,p);if(y in e)return n(void 0,f)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(f,p,y)=>i(Ff(f),Ff(p),y,!0)};return K.forEach(Object.keys({...e,...t}),function(p){const y=l[p]||i,x=y(e[p],t[p],p);K.isUndefined(x)&&y!==a||(r[p]=x)}),r}const fm=e=>{const t=On({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=xt.from(o),t.url=sm(cm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),K.isFormData(r)){if(st.hasStandardBrowserEnv||st.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(K.isFunction(r.getHeaders)){const l=r.getHeaders(),f=["content-type","content-length"];Object.entries(l).forEach(([p,y])=>{f.inclu
Line truncated
|
||||
`+o.map(Wf).join(`
|
||||
`):" "+Wf(o[0]):"as no adapter specified";throw new we("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const hm={getAdapter:D1,adapters:lc};function Va(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Si(null,e)}function Hf(e){return Va(e),e.headers=xt.from(e.headers),e.data=Ha.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),hm.getAdapter(e.adapter||Ss.adapter,e)(e).then(function(n){return Va(e),n.data=Ha.call(e,e.transformResponse,n),n.headers=xt.from(n.headers),n},function(n){return lm(n)||(Va(e),n&&n.response&&(n.response.data=Ha.call(e,e.transformResponse,n.response),n.response.headers=xt.from(n.response.headers))),Promise.reject(n)})}const pm="1.13.2",fa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fa[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Vf={};fa.transitional=function(t,r,n){function i(s,o){return"[Axios v"+pm+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(t===!1)throw new we(i(o," has been removed"+(r?" in "+r:"")),we.ERR_DEPRECATED);return r&&!Vf[o]&&(Vf[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,o,a):!0}};fa.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function M1(e,t,r){if(typeof e!="object")throw new we("options must be an object",we.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new we("option "+s+" must be "+l,we.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new we("Unknown option "+s,we.ERR_BAD_OPTION)}}const po={assertOptions:M1,validators:fa},or=po.validators;let bn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new jf,response:new jf}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
||||
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=On(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&po.assertOptions(n,{silentJSONParsing:or.transitional(or.boolean),forcedJSONParsing:or.transitional(or.boolean),clarifyTimeoutError:or.transitional(or.boolean)},!1),i!=null&&(K.isFunction(i)?r.paramsSerializer={serialize:i}:po.assertOptions(i,{encode:or.function,serialize:or.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),po.assertOptions(r,{baseUrl:or.spelling("baseURL"),withXsrfToken:or.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&K.merge(s.common,s[r.method]);s&&K.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),r.headers=xt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(r)===!1||(l=l&&u.synchronous,a.unshift(u.fulfilled,u.rejected))});const f=[];this.interceptors.response.forEach(function(u){f.push(u.fulfilled,u.rejected)});let p,y=0,x;if(!l){const m=[Hf.bind(this),void 0];for(m.unshift(...a),m.push(...f),x=m.length,p=Promise.resolve(r);y<x;)p=p.then(m[y++],m[y++]);return p}x=a.length;let g=r;for(;y<x;){const m=a[y++],u=a[y++];try{g=m(g)}catch(v){u.call(this,v);break}}try{p=Hf.call(this,g)}catch(m){return Promise.reject(m)}for(y=0,x=f.length;y<x;)p=p.then(f[y++],f[y++]);return p}getUri(t){t=On(this.defaults,t);const r=cm(t.baseURL,t.url,t.allowAbsoluteUrls);return sm(r,t.params,t.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(t){bn.prototype[t]=function(r,n){return this.request(On(n||{},{method:t,url:r,data:(n||{}).data}))}});K.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(On(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}bn.prototype[t]=r(),bn.prototype[t+"Form"]=r(!0)});let B1=class mm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},t(function(s,o,a){n.reason||(n.reason=new Si(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new mm(function(i){t=i}),cancel:t}}};function U1(e){return function(r){return e.apply(null,r)}}function $1(e){return K.isObject(e)&&e.isAxiosError===!0}const Gl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Gl).forEach(([e,t])=>{Gl[t]=e});function gm(e){const t=new bn(e),r=Kp(bn.prototype.request,t);return K.extend(r,bn.prototype,t,{allOwnKeys:!0}),K.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return gm(On(e,i))},r}const xe=gm(Ss);xe.Axios=bn;xe.CanceledError=Si;xe.CancelToken=B1;xe.isCancel=lm;xe.VERSION=pm;xe.toFormData=ca;xe.AxiosError=we;xe.Cancel=xe.CanceledError;xe.all=function(t){return Promise.all(t)};xe.spread=U1;xe.isAxiosError=$1;xe.mergeConfig=On;xe.AxiosH
Line truncated
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var W1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const H1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ie=(e,t)=>{const r=Z.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...f},p)=>Z.createElement("svg",{ref:p,...W1,width:i,height:i,stroke:n,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${H1(e)}`,a].join(" "),...f},[...t.map(([y,x])=>Z.createElement(y,x)),...Array.isArray(l)?l:[l]]));return r.displayName=`${e}`,r};/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const V1=Ie("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const q1=Ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Kf=Ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const K1=Ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const X1=Ie("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Y1=Ie("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Z1=Ie("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Q1=Ie("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const G1=Ie("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const J1=Ie("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ew=Ie("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Xf=Ie("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const tw=Ie("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Zi=Ie("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const rw=Ie("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Yf=Ie("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const nw=Ie("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const iw=Ie("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",key:"1xcu5"}],["circle",{cx:"17.5",cy:"10.5",r:".5",key:"736e4u"}],["circle",{cx:"8.5",cy:"7.5",r:".5",key:"clrty"}],["circle",{cx:"6.5",cy:"12.5",r:".5",key:"1s4xz9"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const sw=Ie("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ym=Ie("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Zf=Ie("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Bo=Ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Qf=Ie("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Gf=Ie("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ow=Ie("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const vm=Ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ps={LIBRARY:"library",FOLDER:"folder",IMAGES:"images"};let Jf=0;const aw=()=>(Jf+=1,`req_${Date.now()}_${Jf}`);class lw{constructor(){this.activeRequests=new Map,this.requestContexts=new Map}createRequest(t){const r=aw(),n=new AbortController,i={id:r,type:t,createdAt:Date.now(),abortController:n,signal:n.signal,status:"pending",isActive:!0,cancel:()=>{if(i.isActive){i.isActive=!1,i.status="cancelled",n.abort(),this.requestContexts.delete(r);const s=this.activeRequests.get(t);s&&s.delete(r)}}};return this.requestContexts.set(r,i),this.activeRequests.has(t)||this.activeRequests.set(t,new Map),this.activeRequests.get(t).set(r,i),i}cancelAll(t){const r=this.activeRequests.get(t);if(r){for(const n of r.values())n.cancel();r.clear()}}cancelAllRequests(){for(const t of Object.values(ps))this.cancelAll(t)}isValid(t){const r=this.requestContexts.get(t);return r?r.isActive:!1}complete(t){const r=this.requestContexts.get(t);if(r&&r.isActive){r.status="completed",r.isActive=!1,this.requestContexts.delete(t);const n=this.activeRequests.get(r.type);n&&n.delete(t)}}error(t){const r=this.requestContexts.get(t);if(r&&r.isActive){r.status="error",r.isActive=!1,this.requestContexts.delete(t);const n=this.activeRequests.get(r.type);n&&n.delete(t)}}getActiveCount(t){const r=this.activeRequests.get(t);return r?r.size:0}hasActiveRequests(t){return this.getActiveCount(t)>0}}const Ft=new lw;function Jl(){Ft.cancelAll(ps.IMAGES)}function uw(e){e&&setTimeout(()=>{},300)}const cw=async e=>{try{return(await sn.getStatus(e)).data}catch{return null}};function ed(){const{libraries:e,currentLibraryId:t,folders:r,selectedFolder:n,totalImageCount:i,setCurrentLibrary:s,setSelectedFolder:o,addLibrary:a,removeLibrary:l}=me(),[f,p]=Z.useState(!1),[y,x]=Z.useState(""),[g,m]=Z.useState(""),[u,v]=Z.useState(""),[c,d]=Z.useState(""),[w,k]=Z.useState(new Set),[b,N]=Z.useState(!1),[T,L]=Z.useState(!1),O=Z.useRef(null),F=V=>{d(V),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{v(V)},300)};Z.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]);const ee=async()=>{if(!y.trim()){alert("请输入素材库名称");return}if(!g.trim()){alert("请输入文件夹路径");return}N(!0);try{console.log("📝 添加素材库...");const V=await Cr.add(y.trim(),g.trim()),M=V.data.id,W=V.data.hasExistingIndex;if(a({id:M,name:y.trim(),path:g.trim()}),x(""),m(""),p(!1),N(!1),console.log("🔄 切换到新素材库..."),await Cr.setCurrent(M),s(M),o(null),me.getState().setImages([]),me.getState().setFolders([]),me.getState().setSelectedImage(null),me.getState().setTotalImageCount(0),me.getState().setScanProgress({libraryId:M,current:0,total:0,percent:0,status:"preparing"}),W){console.log("检测到已有索引,先加载现有数据...");try{const[oe,he]=await Promise.all([$e.getFolders(M),$e.getCount(M)]);me.getState().setFolders(oe.data.folders),me.getState().setTotalImageCount(he.data.count),console.log("✅ 已加载现有数据")}catch(oe){console.warn("⚠️ 加载现有数据失败:",oe)}}console.log("🔍 开始异步扫描..."),W?(console.log("执行增量同步,检测变化..."),sn.sync(M,!1)):(console.log("首次添加,执行全量扫描..."),sn.fullScan(M,!1)),console.log("✅ 扫描已启动,请等待进度显示...")}catch(V){console.error("❌ Error adding library:",V),alert("添加素材库失败: "+V.message),me.getState().setScanProgress(null),N(!1)}},R=async V=>{if(V!==t){L(!0);try{Jl(),Ft.cancelAllRequests(),me.getState().setScanProgress(null),me.getState().setSelectedImage(null),me.getState().setImages([]),me.getState().setFolders([]),me.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1}),o(null),await Cr.setCurrent(V);const[M,W]=await Promise.all([$e.getFolders(V),$e.getCount(V)]);me.getState().setFolders(M.data.folders),me.getState().setTotalImageCount(W.data.count),s(V),cw(V).then(oe=>{var he,ce;oe&&oe.status==="paused"&&(oe.needsRescan?(me.getState().setScanProgress({...oe.progress,libraryId:V,canStop:!0,isPaused:!0,pendingCount:((he=oe.progress)==null?void 0:he.total)-((ce=oe.progress)==null?void 0:ce.current)||0,needsRescan:!0}),console.log("⏸️ 发现中断的扫描,需要继续完成")):oe.pendingCount>0&&(me.getState().setScanProgress({...oe.progress,libraryId:V,canStop:!0,isPaused:!0,pendingCount:oe.pendingCount}),console.log(`⏸️ 发现暂停的扫描,待处理: ${oe.pendingCount} 张`)))}).catch(()=>{})}catch(M){console.error("Error setting current library:",M),alert("切换素材库失败: "+M.message),me.getState().setImageLoadingState({isLoading:!1})}finally{L(!1)}}},U=async()=>{if(!t)return;const V=e.find(W=>W.id===t);if(!(!V||!confirm(`确定要删除素材库"${V.name}"吗?
|
||||
|
||||
路径: ${V.path}
|
||||
|
||||
⚠️ 注意:
|
||||
• 将删除索引数据并释放数据库连接
|
||||
• 不会删除原始图片文件
|
||||
• .flypic 文件夹将保留,您可以手动删除`)))try{await Cr.delete(t),l(t),me.getState().setImages([]),me.getState().setFolders([]),me.getState().setSelectedImage(null),me.getState().setSelectedFolder(null);const W=e.filter(oe=>oe.id!==t);if(W.length>0){const oe=W[0];await Cr.setCurrent(oe.id),s(oe.id)}console.log(`✅ 素材库已删除: ${V.name}`),console.log(`数据库连接已释放,可手动删除: ${V.path}\\.flypic`)}catch(W){console.error("Error deleting library:",W),alert("删除素材库失败: "+W.message)}},_=V=>{const M=new Set(w);M.has(V)?M.delete(V):M.add(V),k(M)},q=V=>{const M=[],W=oe=>{oe.forEach(he=>{he.children&&he.children.length>0&&(M.push(he.path),W(he.children))})};return W(V),M},se=()=>{const V=q(D.length>0?D:r);k(new Set(V))},Q=()=>{k(new Set)},$=()=>{const V=q(D.length>0?D:r);return V.length>0&&V.every(M=>w.has(M))},D=Z.useMemo(()=>{if(!u)return r;const V=u.trim().toLowerCase().split(/\s+/).filter(he=>he.length>0);if(V.length===0)return r;const M=[],W=he=>he.reduce((ce,fe)=>{const J=fe.name.toLowerCase(),ae=fe.path.toLowerCase(),Y=V.every(z=>J.includes(z)),le=V.every(z=>ae.includes(z));let h=[];return fe.children&&fe.children.length>0&&(h=W(fe.children)),(Y||le||h.length>0)&&(ce.push({...fe,children:h}),h.length>0&&M.push(fe.path)),ce},[]),oe=W(r);return M.length>0&&setTimeout(()=>{k(he=>{const ce=new Set(he);return M.forEach(fe=>ce.add(fe)),ce})},0),oe},[r,u]),H=(V,M)=>{V.stopPropagation(),_(M)},I=V=>{const M=V.children&&V.children.length>0;n!==V.path?(Jl(),o(V.path)):M&&_(V.path)},A=(V,M=0)=>V.map(W=>{const oe=w.has(W.path),he=W.children&&W.children.length>0,ce=n===W.path;return S.jsxs("div",{children:[S.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${ce?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${M*16+12}px`},onClick:()=>I(W),children:[he?S.jsx("div",{className:"flex items-center justify-center w-5 h-5 mr-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 rounded",onClick:fe=>H(fe,W.path),children:oe?S.jsx(Kf,{className:"w-4 h-4 text-gray-500"}):S.jsx(K1,{className:"w-4 h-4 text-gray-500"})}):S.jsx("div",{className:"w-5 mr-1"}),S.jsx(Zi,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),S.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:W.name}),S.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:W.image_count})]}),he&&oe&&A(W.children,M+1)]},W.path)});return S.jsxs("div",{className:"w-full h-full border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col",children:[S.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[S.jsx("div",{className:"flex items-center justify-between mb-3",children:S.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"素材库"})}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs("div",{className:"relative flex-1",children:[S.jsxs("select",{value:t||"",onChange:V=>{const M=V.target.value;M==="__add__"?p(!0):M&&R(M)},disabled:T,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 appearance-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{paddingRight:"2rem"},children:[e.length===0&&S.jsx("option",{value:"",children:"暂无素材库"}),e.map(V=>S.jsx("option",{value:V.id,children:V.name},V.id)),S.jsx("option",{value:"__add__",style:{borderTop:"1px solid #ccc"},children:"+ 添加新素材库"})]}),S.jsx(Kf,{className:"absolute right-2 top-2.5 w-4 h-4 text-gray-400 pointer-events-none"})]}),t&&e.length>0&&S.jsx("button",{onClick:U,className:"px-3 py-2 border border-red-300 dark:border-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400 transition-colors",title:"删除当前素材库",children:S.jsx(ow,{className:"w-4 h-4"})})]}),f&&S.jsxs("div",{className:"mt-3 p-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700",children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"添加素材库"}),S.jsx("button",{onClick:()=>p(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600",children:S.jsx(vm,{className:"w-4 h-4 text-gray-500"})})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("input",{type:"text",placeholder:"素材库名称",value:y,onChange:V=>x(V.target.value),onKeyDown:V=>V.key==="Enter"&&ee(),autoFocus:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"}),S.jsx("input",{type:"text",placeholder:"文件夹路径(例如:C:\\Users\\Pictures)",value:g,onChange:V=>m(V.target.value),onKeyDown:V=>V.key==="Enter"&&ee(),className:"w-full px-2 py
Line truncated
|
||||
|
||||
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
||||
<http://stuartk.com/jszip>
|
||||
|
||||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||||
|
||||
JSZip uses the library pako released under the MIT license :
|
||||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||||
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(f,p){if(!i[f]){if(!n[f]){var y=typeof Xs=="function"&&Xs;if(!p&&y)return y(f,!0);if(a)return a(f,!0);var x=new Error("Cannot find module '"+f+"'");throw x.code="MODULE_NOT_FOUND",x}var g=i[f]={exports:{}};n[f][0].call(g.exports,function(m){var u=n[f][1][m];return o(u||m)},g,g.exports,r,n,i,s)}return i[f].exports}for(var a=typeof Xs=="function"&&Xs,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(r,n,i){var s=r("./utils"),o=r("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(l){for(var f,p,y,x,g,m,u,v=[],c=0,d=l.length,w=d,k=s.getTypeOf(l)!=="string";c<l.length;)w=d-c,y=k?(f=l[c++],p=c<d?l[c++]:0,c<d?l[c++]:0):(f=l.charCodeAt(c++),p=c<d?l.charCodeAt(c++):0,c<d?l.charCodeAt(c++):0),x=f>>2,g=(3&f)<<4|p>>4,m=1<w?(15&p)<<2|y>>6:64,u=2<w?63&y:64,v.push(a.charAt(x)+a.charAt(g)+a.charAt(m)+a.charAt(u));return v.join("")},i.decode=function(l){var f,p,y,x,g,m,u=0,v=0,c="data:";if(l.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var d,w=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&w--,l.charAt(l.length-2)===a.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=o.uint8array?new Uint8Array(0|w):new Array(0|w);u<l.length;)f=a.indexOf(l.charAt(u++))<<2|(x=a.indexOf(l.charAt(u++)))>>4,p=(15&x)<<4|(g=a.indexOf(l.charAt(u++)))>>2,y=(3&g)<<6|(m=a.indexOf(l.charAt(u++))),d[v++]=f,g!==64&&(d[v++]=p),m!==64&&(d[v++]=y);return d}},{"./support":30,"./utils":32}],2:[function(r,n,i){var s=r("./external"),o=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),l=r("./stream/DataLengthProbe");function f(p,y,x,g,m){this.compressedSize=p,this.uncompressedSize=y,this.crc32=x,this.compression=g,this.compressedContent=m}f.prototype={getContentWorker:function(){var p=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),y=this;return p.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),p},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},f.createWorkerFrom=function(p,y,x){return p.pipe(new a).pipe(new l("uncompressedSize")).pipe(y.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression",y)},n.exports=f},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,i){var s=r("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,i){var s=r("./utils"),o=function(){for(var a,l=[],f=0;f<256;f++){a=f;for(var p=0;p<8;p++)a=1&a?3988292384^a>>>1:a>>>1;l[f]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(f,p,y,x){var g=o,m=x+y;f^=-1;for(var u=x;u<m;u++)f=f>>>8^g[255&(f^p[u])];return-1^f}(0|l,a,a.length,0):function(f,p,y,x){var g=o,m=x+y;f^=-1;for(var u=x;u<m;u++)f=f>>>8^g[255&(f^p.charCodeAt(u))];return-1^f}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(r,n,i){var s=null;s=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:s}},{lie:37}],7:[function(r,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),a=r("./utils"),l=r("./stream/GenericWorker"),f=s?"uint8array":"array";function p(y,x){l.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=x,this.meta={}}i.magic="\b\0",a.inherits(p,l),p.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(f,y.data),!1)},p.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},p.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},p.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(x){y.push({data:x,meta:y.meta})}},i.compressWorker=function(y){return new p("Deflate",y)},i.uncompressWorker=function(){return new p("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,i){function s(g,m){var u,v="";for(u=0;u<m;u++)v+=String.fromCharCode(255&g),g>>>=8;return v}function o(g,m,u,v,c,d){var w,k,b=g.file,N=g.compression,T=d!==f.Line truncated
|
||||
\0`,M+=s(I,2),M+=N.magic,M+=s(w,2),M+=s(k,2),M+=s(H.crc32,4),M+=s(H.compressedSize,4),M+=s(H.uncompressedSize,4),M+=s(L.length,2),M+=s(q.length,2),{fileRecord:y.LOCAL_FILE_HEADER+M+L+q,dirRecord:y.CENTRAL_FILE_HEADER+s(V,2)+M+s(ee.length,2)+"\0\0\0\0"+s(A,4)+s(v,4)+L+q+ee}}var a=r("../utils"),l=r("../stream/GenericWorker"),f=r("../utf8"),p=r("../crc32"),y=r("../signature");function x(g,m,u,v){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=u,this.encodeFileName=v,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(x,l),x.prototype.push=function(g){var m=g.meta.percent||0,u=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:u?(m+100*(u-v-1))/u:100}}))},x.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var u=o(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:u.fileRecord,meta:{percent:0}})}else this.accumulate=!0},x.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,u=o(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(u.dirRecord),m)this.push({data:function(v){return y.DATA_DESCRIPTOR+s(v.crc32,4)+s(v.compressedSize,4)+s(v.uncompressedSize,4)}(g),meta:{percent:100}});else for(this.push({data:u.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},x.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var u=this.bytesWritten-g,v=function(c,d,w,k,b){var N=a.transformTo("string",b(k));return y.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(c,2)+s(c,2)+s(d,4)+s(w,4)+s(N.length,2)+N}(this.dirRecords.length,u,g,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},x.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},x.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(u){m.processChunk(u)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(u){m.error(u)}),this},x.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},x.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var u=0;u<m.length;u++)try{m[u].error(g)}catch{}return!0},x.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},n.exports=x},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,i){var s=r("../compressions"),o=r("./ZipFileWorker");i.generateWorker=function(a,l,f){var p=new o(l.streamFiles,f,l.platform,l.encodeFileName),y=0;try{a.forEach(function(x,g){y++;var m=function(d,w){var k=d||w,b=s[k];if(!b)throw new Error(k+" is not a valid compression method !");return b}(g.options.compression,l.compression),u=g.options.compressionOptions||l.compressionOptions||{},v=g.dir,c=g.date;g._compressWorker(m,u).withStreamInfo("file",{name:x,dir:v,date:c,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(p)}),p.entriesCount=y}catch(x){p.error(x)}return p}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=r("./object")).loadAsync=r("./load"),s.support=r("./support"),s.defaults=r("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=r("./external"),n.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,i){var s=r("./utils"),o=r("./external"),a=r("./utf8"),l=r("./zipEntries"),f=r("./stream/Crc32Probe"),p=r("./nodejsUtils");function y(x){return new o.Promise(function(g,m){var u=x.decompressed.getContentWorker().pipe(new f);u.on("error",function(v){m(v)}).on("end",function(){u.streamInfo.crc32!==x.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}n.exports=function(x,g){var m=this
Line truncated
|
||||
`),V=H.map(M=>M.filename).join(`
|
||||
`);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([A],{type:"text/html"}),"text/plain":new Blob([V],{type:"text/plain"})})]),c(!0),setTimeout(()=>c(!1),2e3)}catch(M){console.error("写入剪贴板失败:",M),alert(`复制失败。
|
||||
|
||||
提示:浏览器限制,多张图片会以 HTML 格式复制。
|
||||
可粘贴到 Word、富文本编辑器等。
|
||||
|
||||
如需单独使用,请使用"导出"功能。`)}}catch(H){console.error("复制图片失败:",H),alert("复制图片失败,请重试")}},se=async()=>{w(!0);try{const H=F?t:[e];if(H.length===1){const I=$e.getOriginalUrl(r,H[0].path),A=document.createElement("a");A.href=I,A.download=H[0].filename,A.target="_blank",document.body.appendChild(A),A.click(),document.body.removeChild(A)}else{const I=new hd,A=I.folder("images");b(0);for(let W=0;W<H.length;W++){const oe=H[W],he=$e.getOriginalUrl(r,oe.path);try{const fe=await(await fetch(he)).blob();A.file(oe.filename,fe);const J=Math.round((W+1)/H.length*90);b(J),console.log(`已添加: ${oe.filename} (${W+1}/${H.length})`)}catch(ce){console.error(`下载失败: ${oe.filename}`,ce)}}b(95),console.log("正在生成 ZIP 文件...");const V=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});b(100);const M=document.createElement("a");M.href=URL.createObjectURL(V),M.download=`FlyPic_导出_${H.length}张_${Date.now()}.zip`,document.body.appendChild(M),M.click(),document.body.removeChild(M),URL.revokeObjectURL(M.href),console.log("导出完成!")}}catch(H){console.error("导出失败:",H),alert("导出失败,请重试")}finally{w(!1)}},Q=async()=>{if(!n){alert("请先选择一个文件夹");return}T(!0),O(0);try{const H=i.filter(oe=>oe.folder&&oe.folder.startsWith(n));if(H.length===0){alert("当前文件夹没有图片");return}const I=new hd,A=n.split("/").pop()||"images",V=I.folder(A);for(let oe=0;oe<H.length;oe++){const he=H[oe],ce=$e.getOriginalUrl(r,he.path);try{const J=await(await fetch(ce)).blob(),ae=he.folder.replace(n,"").replace(/^\//,""),Y=ae?`${ae}/${he.filename}`:he.filename;V.file(Y,J);const le=Math.round((oe+1)/H.length*90);O(le),console.log(`已添加: ${Y} (${oe+1}/${H.length})`)}catch(fe){console.error(`下载失败: ${he.filename}`,fe)}}O(95),console.log("正在生成 ZIP 文件...");const M=await I.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});O(100);const W=document.createElement("a");W.href=URL.createObjectURL(M),W.download=`${A}_${H.length}张_${Date.now()}.zip`,document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(W.href),console.log("文件夹导出完成!")}catch(H){console.error("导出文件夹失败:",H),alert("导出文件夹失败,请重试")}finally{T(!1)}},$=H=>H<1024?H+" B":H<1024*1024?(H/1024).toFixed(2)+" KB":(H/(1024*1024)).toFixed(2)+" MB",D=H=>new Date(H).toLocaleString("zh-CN");return S.jsxs("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col h-full",children:[l&&S.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:S.jsxs("button",{onClick:()=>s("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[S.jsx(V1,{className:"w-5 h-5"}),S.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),S.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:S.jsxs("div",{className:"w-full aspect-square bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden relative",children:[S.jsx("img",{src:p,alt:ee.filename,decoding:"async",className:`w-full h-full object-contain transition-opacity duration-300 ${x?"opacity-75":"opacity-100"}`}),x&&S.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded",children:"加载原图中..."})]})}),S.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"基本信息"}),S.jsxs("div",{className:"space-y-2 text-sm",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件名:"}),S.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all",children:e.filename})]}),S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸:"}),S.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[e.width," × ",e.height]})]}),S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"大小:"}),S.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:$(e.size)})]}),S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),S.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:e.format})]}),S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),S.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:D(e.created_at)})]}),S.jsxs("div",{children:[S.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),S.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:D(e.modified_at)})]}),S.jsxs("div",{children:[S.jsx("span",{className
Line truncated
|
||||
@@ -1,186 +0,0 @@
|
||||
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var ws=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jf={exports:{}},jo={},ed={exports:{}},_e={};/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var us=Symbol.for("react.element"),rm=Symbol.for("react.portal"),im=Symbol.for("react.fragment"),sm=Symbol.for("react.strict_mode"),om=Symbol.for("react.profiler"),am=Symbol.for("react.provider"),lm=Symbol.for("react.context"),um=Symbol.for("react.forward_ref"),cm=Symbol.for("react.suspense"),fm=Symbol.for("react.memo"),dm=Symbol.for("react.lazy"),nc=Symbol.iterator;function hm(e){return e===null||typeof e!="object"?null:(e=nc&&e[nc]||e["@@iterator"],typeof e=="function"?e:null)}var td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nd=Object.assign,rd={};function pi(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}pi.prototype.isReactComponent={};pi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};pi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function id(){}id.prototype=pi.prototype;function Zl(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}var Ql=Zl.prototype=new id;Ql.constructor=Zl;nd(Ql,pi.prototype);Ql.isPureReactComponent=!0;var rc=Array.isArray,sd=Object.prototype.hasOwnProperty,Gl={current:null},od={key:!0,ref:!0,__self:!0,__source:!0};function ad(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)sd.call(t,r)&&!od.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:us,type:e,key:s,ref:o,props:i,_owner:Gl.current}}function pm(e,t){return{$$typeof:us,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Jl(e){return typeof e=="object"&&e!==null&&e.$$typeof===us}function mm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ic=/\/+/g;function oa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?mm(""+e.key):t.toString(36)}function Ws(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case us:case rm:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+oa(o,0):r,rc(i)?(n="",e!=null&&(n=e.replace(ic,"$&/")+"/"),Ws(i,t,n,"",function(u){return u})):i!=null&&(Jl(i)&&(i=pm(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(ic,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",rc(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+oa(s,a);o+=Ws(s,t,n,l,i)}else if(l=hm(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+oa(s,a++),o+=Ws(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function xs(e,t,n){if(e==null)return e;var r=[],i=0;return Ws(e,r,"","",function(s){return t.call(n,s,i++)}),r}function gm(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var dt={current:null},Hs={transition:null},ym={ReactCurrentDispatcher:dt,ReactCurrentBatchConfig:Hs,ReactCurrentOwner:Gl};function ld(){throw Error("act(...) is not supported in production builds of React.")}_e.Children={map:xs,forEach:function(e,t,n){xs(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return xs(e,function(){t++}),t},toArray:function(e){return xs(e,function(t){return t})||[]},only:function(e){if(!Jl(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};_e.Component=pi;_e.Fragment=im;_e.Profiler=om;_e.PureComponent=Zl;_e.StrictMode=sm;_e.Suspense=cm;_e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ym;_e.act=ld;_e.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=nd({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Gl.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)sd.call(t,l)&&!od.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:us,type:e.type,key:i,ref:s,props:r,_owner:o}};_e.createContext=function(e){return e={$$typeof:lm,_currentValue:e,_currentValue2:e,_threadCountLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var vm=ne,wm=Symbol.for("react.element"),xm=Symbol.for("react.fragment"),_m=Object.prototype.hasOwnProperty,km=vm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Sm={key:!0,ref:!0,__self:!0,__source:!0};function ud(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)_m.call(t,r)&&!Sm.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:wm,type:e,key:s,ref:o,props:i,_owner:km.current}}jo.Fragment=xm;jo.jsx=ud;jo.jsxs=ud;Jf.exports=jo;var C=Jf.exports,Ua={},cd={exports:{}},Nt={},fd={exports:{}},dd={};/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/(function(e){function t(H,z){var j=H.length;H.push(z);e:for(;0<j;){var O=j-1>>>1,A=H[O];if(0<i(A,z))H[O]=z,H[j]=A,j=O;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var z=H[0],j=H.pop();if(j!==z){H[0]=j;e:for(var O=0,A=H.length,J=A>>>1;O<J;){var q=2*(O+1)-1,V=H[q],ce=q+1,Y=H[ce];if(0>i(V,j))ce<A&&0>i(Y,V)?(H[O]=Y,H[ce]=j,O=ce):(H[O]=V,H[q]=j,O=q);else if(ce<A&&0>i(Y,j))H[O]=Y,H[ce]=j,O=ce;else break e}}return z}function i(H,z){var j=H.sortIndex-z.sortIndex;return j!==0?j:H.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],h=1,y=null,w=3,p=!1,g=!1,d=!1,_=typeof setTimeout=="function"?setTimeout:null,c=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(H){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=H)r(u),z.sortIndex=z.expirationTime,t(l,z);else break;z=n(u)}}function k(H){if(d=!1,x(H),!g)if(n(l)!==null)g=!0,se(R);else{var z=n(u);z!==null&&X(k,z.startTime-H)}}function R(H,z){g=!1,d&&(d=!1,c(L),L=-1),p=!0;var j=w;try{for(x(z),y=n(l);y!==null&&(!(y.expirationTime>z)||H&&!re());){var O=y.callback;if(typeof O=="function"){y.callback=null,w=y.priorityLevel;var A=O(y.expirationTime<=z);z=e.unstable_now(),typeof A=="function"?y.callback=A:y===n(l)&&r(l),x(z)}else r(l);y=n(l)}if(y!==null)var J=!0;else{var q=n(u);q!==null&&X(k,q.startTime-z),J=!1}return J}finally{y=null,w=j,p=!1}}var E=!1,N=null,L=-1,P=5,I=-1;function re(){return!(e.unstable_now()-I<P)}function T(){if(N!==null){var H=e.unstable_now();I=H;var z=!0;try{z=N(!0,H)}finally{z?D():(E=!1,N=null)}}else E=!1}var D;if(typeof f=="function")D=function(){f(T)};else if(typeof MessageChannel<"u"){var v=new MessageChannel,B=v.port2;v.port1.onmessage=T,D=function(){B.postMessage(null)}}else D=function(){_(T,0)};function se(H){N=H,E||(E=!0,D())}function X(H,z){L=_(function(){H(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,se(R))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(H){switch(w){case 1:case 2:case 3:var z=3;break;default:z=w}var j=w;w=z;try{return H()}finally{w=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var j=w;w=H;try{return z()}finally{w=j}},e.unstable_scheduleCallback=function(H,z,j){var O=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?O+j:O):j=O,H){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=j+A,H={id:h++,callback:z,priorityLevel:H,startTime:j,expirationTime:A,sortIndex:-1},j>O?(H.sortIndex=j,t(u,H),n(l)===null&&H===n(u)&&(d?(c(L),L=-1):d=!0,X(k,j-O))):(H.sortIndex=A,t(l,H),g||p||(g=!0,se(R))),H},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(H){var z=w;return function(){var j=w;w=z;try{return H.apply(this,arguments)}finally{w=j}}}})(dd);fd.exports=dd;var bm=fd.exports;/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var Em=ne,Ct=bm;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var hd=new Set,qi={};function Tr(e,t){si(e,t),si(e+"Capture",t)}function si(e,t){for(qi[e]=t,e=0;e<t.length;e++)hd.add(t[e])}var On=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$a=Object.prototype.hasOwnProperty,Cm=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,sc={},oc={};function Nm(e){return $a.call(oc,e)?!0:$a.call(sc,e)?!1:Cm.test(e)?oc[e]=!0:(sc[e]=!0,!1)}function Rm(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Tm(e,t,n,r){if(t===null||typeof t>"u"||Rm(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ht(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Je={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Je[e]=new ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Je[t]=new ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Je[e]=new ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Je[e]=new ht(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Je[e]=new ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Je[e]=new ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Je[e]=new ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Je[e]=new ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Je[e]=new ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var eu=/[\-:]([a-z])/g;function tu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Je[e]=new ht(e,1,!1,e.toLowerCase(),null,!1,!1)});Je.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Je[e]=new ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function nu(e,t,n,r){var i=Je.hasOwnProperty(t)?Je[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=
Line truncated
|
||||
`+aa+e}var la=!1;function ua(e,t){if(!e||la)return"";la=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
|
||||
`),s=r.stack.split(`
|
||||
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
||||
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{la=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Pi(e):""}function Om(e){switch(e.tag){case 5:return Pi(e.type);case 16:return Pi("Lazy");case 13:return Pi("Suspense");case 19:return Pi("SuspenseList");case 0:case 2:case 15:return e=ua(e.type,!1),e;case 11:return e=ua(e.type.render,!1),e;case 1:return e=ua(e.type,!0),e;default:return""}}function qa(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ur:return"Fragment";case Mr:return"Portal";case Wa:return"Profiler";case ru:return"StrictMode";case Ha:return"Suspense";case Va:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case md:return(e.displayName||"Context")+".Consumer";case pd:return(e._context.displayName||"Context")+".Provider";case iu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case su:return t=e.displayName||null,t!==null?t:qa(e.type)||"Memo";case $n:t=e._payload,e=e._init;try{return qa(e(t))}catch{}}return null}function Am(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qa(t);case 8:return t===ru?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ir(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Pm(e){var t=yd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ks(e){e._valueTracker||(e._valueTracker=Pm(e))}function vd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=yd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function lo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ka(e,t){var n=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ir(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wd(e,t){t=t.checked,t!=null&&nu(e,"checked",t,!1)}function Xa(e,t){wd(e,t);var n=ir(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ya(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ya(e,t.type,ir(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function uc(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ya(e,t,n){(t!=="number"||lo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zi=Array.isArray;function Gr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ir(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Za(e,t){if(t.dan
Line truncated
|
||||
`).replace($0,"")}function Os(e,t,n){if(t=Pc(t),Pc(e)!==t&&n)throw Error(te(425))}function yo(){}var ul=null,cl=null;function fl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var dl=typeof setTimeout=="function"?setTimeout:void 0,W0=typeof clearTimeout=="function"?clearTimeout:void 0,zc=typeof Promise=="function"?Promise:void 0,H0=typeof queueMicrotask=="function"?queueMicrotask:typeof zc<"u"?function(e){return zc.resolve(null).then(e).catch(V0)}:dl;function V0(e){setTimeout(function(){throw e})}function ka(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Qi(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Qi(t)}function Gn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Lc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var gi=Math.random().toString(36).slice(2),ln="__reactFiber$"+gi,ns="__reactProps$"+gi,An="__reactContainer$"+gi,hl="__reactEvents$"+gi,q0="__reactListeners$"+gi,K0="__reactHandles$"+gi;function gr(e){var t=e[ln];if(t)return t;for(var n=e.parentNode;n;){if(t=n[An]||n[ln]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Lc(e);e!==null;){if(n=e[ln])return n;e=Lc(e)}return t}e=n,n=e.parentNode}return null}function ds(e){return e=e[ln]||e[An],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Vr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Mo(e){return e[ns]||null}var pl=[],qr=-1;function ar(e){return{current:e}}function Le(e){0>qr||(e.current=pl[qr],pl[qr]=null,qr--)}function Oe(e,t){qr++,pl[qr]=e.current,e.current=t}var sr={},st=ar(sr),gt=ar(!1),Sr=sr;function oi(e,t){var n=e.type.contextTypes;if(!n)return sr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function yt(e){return e=e.childContextTypes,e!=null}function vo(){Le(gt),Le(st)}function jc(e,t,n){if(st.current!==sr)throw Error(te(168));Oe(st,t),Oe(gt,n)}function ah(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(te(108,Am(e)||"Unknown",i));return Be({},n,r)}function wo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sr,Sr=st.current,Oe(st,e),Oe(gt,gt.current),!0}function Ic(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=ah(e,t,Sr),r.__reactInternalMemoizedMergedChildContext=e,Le(gt),Le(st),Oe(st,e)):Le(gt),Oe(gt,n)}var En=null,Uo=!1,Sa=!1;function lh(e){En===null?En=[e]:En.push(e)}function X0(e){Uo=!0,lh(e)}function lr(){if(!Sa&&En!==null){Sa=!0;var e=0,t=Ne;try{var n=En;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}En=null,Uo=!1}catch(i){throw En!==null&&(En=En.slice(e+1)),zd(au,lr),i}finally{Ne=t,Sa=!1}}return null}var Kr=[],Xr=0,xo=null,_o=0,Lt=[],jt=0,br=null,Nn=1,Rn="";function hr(e,t){Kr[Xr++]=_o,Kr[Xr++]=xo,xo=e,_o=t}function uh(e,t,n){Lt[jt++]=Nn,Lt[jt++]=Rn,Lt[jt++]=br,br=e;var r=Nn;e=Rn;var i=32-Xt(r)-1;r&=~(1<<i),n+=1;var s=32-Xt(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Nn=1<<32-Xt(t)+i|n<<i|r,Rn=s+e}else Nn=1<<s|n<<i|r,Rn=e}function gu(e){e.return!==null&&(hr(e,1),uh(e,1,0))}function yu(e){for(;e===xo;)xo=Kr[--Xr],Kr[Xr]=null,_o=Kr[--Xr],Kr[Xr]=null;for(;e===br;)br=Lt[--jt],Lt[jt]=null,Rn=Lt[--jt],Lt[jt]=null,Nn=Lt[--jt],Lt[jt]=null}var Et=null,bt=null,je=!1,Kt=null;function ch(e,t){var n=Ft(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Fc(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Et=e,bt=Gn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,bt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=br!==null?{id:Nn,overflow:Rn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ft(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Et=e,bt=null,!0):!1;default:return!1}}function ml(e){return(e.mode&1)!==0&&(e.flags&128)===0}function gl(e){if(je){var t=bt;if(t){var n=t;if(!Fc(e,t)){if(ml(e))throw Error(te(418));t=Gn(n.nextSibling);var r=Et;t&&Fc(e,t)?ch(r,n):(e.flags=e.flags&-4097|2,je=!1,Et=e)}}else{if(ml(e))throw Error(te(418));e.flags=e.flags&-4097|2,je=!1,Et=e}}}function Bc(e){
Line truncated
|
||||
Error generating stack: `+s.message+`
|
||||
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function Ra(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function xl(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var rg=typeof WeakMap=="function"?WeakMap:Map;function Fh(e,t,n){n=Tn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){To||(To=!0,Ol=r),xl(e,t)},n}function Bh(e,t,n){n=Tn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){xl(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){xl(e,t),typeof r!="function"&&(er===null?er=new Set([this]):er.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function qc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rg;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=yg.bind(null,e,t,n),t.then(e,e))}function Kc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Xc(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Tn(-1,1),t.tag=2,Jn(n,t,1))),n.lanes|=1),e)}var ig=Ln.ReactCurrentOwner,mt=!1;function ut(e,t,n,r){t.child=e===null?hh(t,null,n,r):li(t,e.child,n,r)}function Yc(e,t,n,r,i){n=n.render;var s=t.ref;return ni(t,i),r=Ru(e,t,n,r,s,i),n=Tu(),e!==null&&!mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,zn(e,t,i)):(je&&n&&gu(t),t.flags|=1,ut(e,t,r,i),t.child)}function Zc(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Du(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Dh(e,t,s,r,i)):(e=eo(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Ji,n(o,r)&&e.ref===t.ref)return zn(e,t,i)}return t.flags|=1,e=nr(s,r),e.ref=t.ref,e.return=t,t.child=e}function Dh(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Ji(s,r)&&e.ref===t.ref)if(mt=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(mt=!0);else return t.lanes=e.lanes,zn(e,t,i)}return _l(e,t,n,r,i)}function Mh(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe(Qr,St),St|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe(Qr,St),St|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Oe(Qr,St),St|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Oe(Qr,St),St|=r;return ut(e,t,i,n),t.child}function Uh(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function _l(e,t,n,r,i){var s=yt(n)?Sr:st.current;return s=oi(t,s),ni(t,i),n=Ru(e,t,n,r,s,i),r=Tu(),e!==null&&!mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,zn(e,t,i)):(je&&r&&gu(t),t.flags|=1,ut(e,t,n,i),t.child)}function Qc(e,t,n,r,i){if(yt(n)){var s=!0;wo(t)}else s=!1;if(ni(t,i),t.stateNode===null)Qs(e,t),Ih(t,n,r),wl(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Dt(u):(u=yt(n)?Sr:st.current,u=oi(t,u));var h=n.getDerivedStateFromProps,y=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";y||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Vc(t,o,r,u),Wn=!1;var w=t.memoizedState;o.state=w,bo(t,r,o,i),l=t.memoizedState,a!==r||w!==l||gt.current||Wn?(typeof h=="function"&&(vl(t,n,h,r),l=t.memoizedState),(a=Wn||Hc(t,n,a,r,w,l,u))?(y||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,mh(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Ht(t.type,a),o.props=u,y=t.pendingProps,w=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Dt(l):(l=yt(n)?Sr:st.current,l=oi(t,l));var p=n.getDerivedStateFromProps;(h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==y||w!==l)&&Vc(t,o,r,l),Wn=!1,w=t.memoizedState,o.state=w,bo(t,r,o,i);var g=t.memoizedS
Line truncated
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var di=ne;function Sy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var by=typeof Object.is=="function"?Object.is:Sy,Ey=di.useState,Cy=di.useEffect,Ny=di.useLayoutEffect,Ry=di.useDebugValue;function Ty(e,t){var n=t(),r=Ey({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return Ny(function(){i.value=n,i.getSnapshot=t,ja(i)&&s({inst:i})},[e,n,t]),Cy(function(){return ja(i)&&s({inst:i}),e(function(){ja(i)&&s({inst:i})})},[e]),Ry(n),n}function ja(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!by(e,n)}catch{return!0}}function Oy(e,t){return t()}var Ay=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Oy:Ty;Rp.useSyncExternalStore=di.useSyncExternalStore!==void 0?di.useSyncExternalStore:Ay;Np.exports=Rp;var Py=Np.exports;/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var Jo=ne,zy=Py;function Ly(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jy=typeof Object.is=="function"?Object.is:Ly,Iy=zy.useSyncExternalStore,Fy=Jo.useRef,By=Jo.useEffect,Dy=Jo.useMemo,My=Jo.useDebugValue;Cp.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=Fy(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Dy(function(){function l(p){if(!u){if(u=!0,h=p,p=r(p),i!==void 0&&o.hasValue){var g=o.value;if(i(g,p))return y=g}return y=p}if(g=y,jy(h,p))return g;var d=r(p);return i!==void 0&&i(g,d)?(h=p,g):(h=p,y=d)}var u=!1,h,y,w=n===void 0?null:n;return[function(){return l(t())},w===null?void 0:function(){return l(w())}]},[t,n,r,i]);var a=Iy(e,s[0],s[1]);return By(function(){o.hasValue=!0,o.value=a},[a]),My(a),a};Ep.exports=Cp;var Uy=Ep.exports;const $y=Yl(Uy),Tp={},{useDebugValue:Wy}=ve,{useSyncExternalStoreWithSelector:Hy}=$y;let vf=!1;const Vy=e=>e;function qy(e,t=Vy,n){(Tp?"production":void 0)!=="production"&&n&&!vf&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),vf=!0);const r=Hy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wy(r),r}const wf=e=>{(Tp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?ky(e):e,n=(r,i)=>qy(t,r,i);return Object.assign(n,t),n},Ky=e=>e?wf(e):wf,Te=Ky((e,t)=>({theme:"light",setTheme:n=>e({theme:n}),toggleTheme:()=>e(n=>({theme:n.theme==="light"?"dark":"light"})),libraries:[],currentLibraryId:null,setLibraries:n=>e({libraries:n}),setCurrentLibrary:n=>e({currentLibraryId:n}),addLibrary:n=>e(r=>({libraries:[...r.libraries,n]})),removeLibrary:n=>e(r=>({libraries:r.libraries.filter(i=>i.id!==n),currentLibraryId:r.currentLibraryId===n?null:r.currentLibraryId})),images:[],filteredImages:[],totalImageCount:0,setImages:n=>e({images:n,filteredImages:n}),setFilteredImages:n=>e({filteredImages:n}),setTotalImageCount:n=>e({totalImageCount:n}),folders:[],selectedFolder:null,setFolders:n=>e({folders:n}),setSelectedFolder:n=>e({selectedFolder:n}),searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null},setSearchKeywords:n=>e({searchKeywords:n}),setFilters:n=>e(r=>({filters:{...r.filters,...n}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null}}),selectedImage:null,setSelectedImage:n=>e({selectedImage:n}),selectedImages:[],setSelectedImages:n=>e({selectedImages:n}),toggleImageSelection:n=>e(r=>r.selectedImages.some(s=>s.path===n.path)?{selectedImages:r.selectedImages.filter(s=>s.path!==n.path)}:{selectedImages:[...r.selectedImages,n]}),clearSelection:()=>e({selectedImages:[],selectedImage:null}),scanProgress:null,scanStartTime:null,setScanProgress:n=>e(r=>n&&!r.scanStartTime&&n.current>0?{scanProgress:n,scanStartTime:Date.now()}:n?{scanProgress:n}:{scanProgress:null,scanStartTime:null}),isResizingPanels:!1,setIsResizingPanels:n=>e({isResizingPanels:n}),resizingSide:null,setResizingSide:n=>e({resizingSide:n}),thumbnailHeight:200,setThumbnailHeight:n=>e({thumbnailHeight:n}),mobileView:"main",setMobileView:n=>e({mobileView:n}),getCurrentLibrary:()=>{const n=t();return n.libraries.find(r=>r.id===n.currentLibraryId)}}));function Op(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xy}=Object.prototype,{getPrototypeOf:Yu}=Object,{iterator:ea,toStringTag:Ap}=Symbol,ta=(e=>t=>{const n=Xy.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Qt=e=>(e=e.toLowerCase(),t=>ta(t)===e),na=e=>t=>typeof t===e,{isArray:vi}=Array,hi=na("undefined");function ps(e){return e!==null&&!hi(e)&&e.constructor!==null&&!hi(e.constructor)&&wt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Pp=Qt("ArrayBuffer");function Yy(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Pp(e.buffer),t}const Zy=na("string"),wt=na("function"),zp=na("number"),ms=e=>e!==null&&typeof e=="object",Qy=e=>e===!0||e===!1,so=e=>{if(ta(e)!=="object")return!1;const t=Yu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ap in e)&&!(ea in e)},Gy=e=>{if(!ms(e)||ps(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Jy=Qt("Date"),ev=Qt("File"),tv=Qt("Blob"),nv=Qt("FileList"),rv=e=>ms(e)&&wt(e.pipe),iv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||wt(e.append)&&((t=ta(e))==="formdata"||t==="object"&&wt(e.toString)&&e.toString()==="[object FormData]"))},sv=Qt("URLSearchParams"),[ov,av,lv,uv]=["ReadableStream","Request","Response","Headers"].map(Qt),cv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\Line truncated
|
||||
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&Yv[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},bf=Symbol("internals");function Ai(e){return e&&String(e).trim().toLowerCase()}function oo(e){return e===!1||e==null?e:$.isArray(e)?e.map(oo):String(e)}function Qv(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Gv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ia(e,t,n,r,i){if($.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!$.isString(t)){if($.isString(r))return t.indexOf(r)!==-1;if($.isRegExp(r))return r.test(t)}}function Jv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function e1(e,t){const n=$.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}let xt=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(a,l,u){const h=Ai(l);if(!h)throw new Error("header name must be a non-empty string");const y=$.findKey(i,h);(!y||i[y]===void 0||u===!0||u===void 0&&i[y]!==!1)&&(i[y||l]=oo(a))}const o=(a,l)=>$.forEach(a,(u,h)=>s(u,h,l));if($.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if($.isString(t)&&(t=t.trim())&&!Gv(t))o(Zv(t),n);else if($.isObject(t)&&$.isIterable(t)){let a={},l,u;for(const h of t){if(!$.isArray(h))throw TypeError("Object iterator must return a key-value pair");a[u=h[0]]=(l=a[u])?$.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}o(a,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Ai(t),t){const r=$.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return Qv(i);if($.isFunction(n))return n.call(this,i,r);if($.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ai(t),t){const r=$.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Ia(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=Ai(o),o){const a=$.findKey(r,o);a&&(!n||Ia(r,r[a],a,n))&&(delete r[a],i=!0)}}return $.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||Ia(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return $.forEach(this,(i,s)=>{const o=$.findKey(r,s);if(o){n[o]=oo(i),delete n[s];return}const a=t?Jv(s):String(s).trim();a!==s&&delete n[s],n[a]=oo(i),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return $.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&$.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
||||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[bf]=this[bf]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ai(o);r[a]||(e1(i,o),r[a]=!0)}return $.isArray(t)?t.forEach(s):s(t),this}};xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$.reduceDescriptors(xt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});$.freezeMethods(xt);function Fa(e,t){const n=this||ys,r=t||n,i=xt.from(r.headers);let s=r.data;return $.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Vp(e){return!!(e&&e.__CANCEL__)}function wi(e,t,n){me.call(this,e??"canceled",me.ERR_CANCELED,t,n),this.name="CanceledError"}$.inherits(wi,me,{__CANCEL__:!0});function qp(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new me("Request failed with status code "+n.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function t1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function n1(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),h=r[s];o||(o=u),n[i]=l,r[i]=u;let y=s,w=0;for(;y!==i;)w+=n[y++],y=y%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=h&&u-h;return p?Math.round(w*1e3/p):void 0}}function r1(e,t){let n=0,r=1e3/t,i,s;const o=(u,h=Date.now())=>{n=h,i=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const h=Date.now(),y=h-n;y>=r?o(u,h):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-y)))},()=>i&&o(i)]}const zo=(e,t,n=3)=>{let r=0;const i=n1(50,250);return r1(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,u=i(l),h=o<=a;r=o;const y={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&h?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(y)},n)},Ef=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Cf=e=>(...t)=>$.asap(()=>e(...t)),i1=it.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,it.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,s1=it.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];$.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),$.isString(r)&&a.push(`path=${r}`),$.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),$.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function o1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function a1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Kp(e,t,n){let r=!o1(t);return e&&(r||n==!1)?a1(e,t):t}const Nf=e=>e instanceof xt?{...e}:e;function Rr(e,t){t=t||{};const n={};function r(u,h,y,w){return $.isPlainObject(u)&&$.isPlainObject(h)?$.merge.call({caseless:w},u,h):$.isPlainObject(h)?$.merge({},h):$.isArray(h)?h.slice():h}function i(u,h,y,w){if($.isUndefined(h)){if(!$.isUndefined(u))return r(void 0,u,y,w)}else return r(u,h,y,w)}function s(u,h){if(!$.isUndefined(h))return r(void 0,h)}function o(u,h){if($.isUndefined(h)){if(!$.isUndefined(u))return r(void 0,u)}else return r(void 0,h)}function a(u,h,y){if(y in t)return r(u,h);if(y in e)return r(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,h,y)=>i(Nf(u),Nf(h),y,!0)};return $.forEach(Object.keys({...e,...t}),function(h){const y=l[h]||i,w=y(e[h],t[h],h);$.isUndefined(w)&&y!==a||(n[h]=w)}),n}const Xp=e=>{const t=Rr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=xt.from(o),t.url=$p(Kp(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),$.isFormData(n)){if(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if($.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([h,y])=>{u.inclu
Line truncated
|
||||
`+o.map(zf).join(`
|
||||
`):" "+zf(o[0]):"as no adapter specified";throw new me("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const Zp={getAdapter:v1,adapters:Gu};function Ba(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new wi(null,e)}function Lf(e){return Ba(e),e.headers=xt.from(e.headers),e.data=Fa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zp.getAdapter(e.adapter||ys.adapter,e)(e).then(function(r){return Ba(e),r.data=Fa.call(e,e.transformResponse,r),r.headers=xt.from(r.headers),r},function(r){return Vp(r)||(Ba(e),r&&r.response&&(r.response.data=Fa.call(e,e.transformResponse,r.response),r.response.headers=xt.from(r.response.headers))),Promise.reject(r)})}const Qp="1.13.2",ia={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ia[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const jf={};ia.transitional=function(t,n,r){function i(s,o){return"[Axios v"+Qp+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new me(i(o," has been removed"+(n?" in "+n:"")),me.ERR_DEPRECATED);return n&&!jf[o]&&(jf[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};ia.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function w1(e,t,n){if(typeof e!="object")throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new me("option "+s+" must be "+l,me.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new me("Unknown option "+s,me.ERR_BAD_OPTION)}}const ao={assertOptions:w1,validators:ia},on=ao.validators;let kr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Sf,response:new Sf}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
||||
`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Rr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&ao.assertOptions(r,{silentJSONParsing:on.transitional(on.boolean),forcedJSONParsing:on.transitional(on.boolean),clarifyTimeoutError:on.transitional(on.boolean)},!1),i!=null&&($.isFunction(i)?n.paramsSerializer={serialize:i}:ao.assertOptions(i,{encode:on.function,serialize:on.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ao.assertOptions(n,{baseUrl:on.spelling("baseURL"),withXsrfToken:on.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&$.merge(s.common,s[n.method]);s&&$.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=xt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});let h,y=0,w;if(!l){const g=[Lf.bind(this),void 0];for(g.unshift(...a),g.push(...u),w=g.length,h=Promise.resolve(n);y<w;)h=h.then(g[y++],g[y++]);return h}w=a.length;let p=n;for(;y<w;){const g=a[y++],d=a[y++];try{p=g(p)}catch(_){d.call(this,_);break}}try{h=Lf.call(this,p)}catch(g){return Promise.reject(g)}for(y=0,w=u.length;y<w;)h=h.then(u[y++],u[y++]);return h}getUri(t){t=Rr(this.defaults,t);const n=Kp(t.baseURL,t.url,t.allowAbsoluteUrls);return $p(n,t.params,t.paramsSerializer)}};$.forEach(["delete","get","head","options"],function(t){kr.prototype[t]=function(n,r){return this.request(Rr(r||{},{method:t,url:n,data:(r||{}).data}))}});$.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,a){return this.request(Rr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}kr.prototype[t]=n(),kr.prototype[t+"Form"]=n(!0)});let x1=class Gp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new wi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Gp(function(i){t=i}),cancel:t}}};function _1(e){return function(n){return e.apply(null,n)}}function k1(e){return $.isObject(e)&&e.isAxiosError===!0}const Wl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Wl).forEach(([e,t])=>{Wl[t]=e});function Jp(e){const t=new kr(e),n=Op(kr.prototype.request,t);return $.extend(n,kr.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Jp(Rr(e,i))},n}const be=Jp(ys);be.Axios=kr;be.CanceledError=wi;be.CancelToken=x1;be.isCancel=Vp;be.VERSION=Qp;be.toFormData=ra;be.AxiosError=me;be.Cancel=be.CanceledError;be.all=function(t){return Promise.all(t)};be.spread=_1;be.isAxiosError=k1;be.mergeConfig=Rr;be.AxiosH
Line truncated
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var S1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const b1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ye=(e,t)=>{const n=ne.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...u},h)=>ne.createElement("svg",{ref:h,...S1,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${b1(e)}`,a].join(" "),...u},[...t.map(([y,w])=>ne.createElement(y,w)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const E1=Ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const C1=Ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ff=Ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const N1=Ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const R1=Ye("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const T1=Ye("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const O1=Ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const A1=Ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Bf=Ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const P1=Ye("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Df=Ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Mf=Ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Uf=Ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Vl=Ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const $f=Ye("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Wf=Ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const z1=Ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
||||
* @license lucide-react v0.300.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const L1=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Hf(){const{libraries:e,currentLibraryId:t,folders:n,selectedFolder:r,totalImageCount:i,setCurrentLibrary:s,setSelectedFolder:o,addLibrary:a,removeLibrary:l}=Te(),[u,h]=ne.useState(!1),[y,w]=ne.useState(""),[p,g]=ne.useState(""),[d,_]=ne.useState(""),[c,f]=ne.useState(new Set),[x,k]=ne.useState(!1),[R,E]=ne.useState(!1),N=async()=>{if(!y.trim()){alert("请输入素材库名称");return}if(!p.trim()){alert("请输入文件夹路径");return}k(!0),Te.getState().setScanProgress({current:0,total:0,percent:0,status:"preparing"});try{const z=await Cn.add(y.trim(),p.trim()),j=z.data.id,O=z.data.hasExistingIndex;a({id:j,name:y.trim(),path:p.trim()}),w(""),g(""),h(!1),await Cn.setCurrent(j),s(j),o(null),Te.getState().setImages([]),Te.getState().setFolders([]),O?(console.log("检测到已有索引,执行增量同步..."),Hl.sync(j,!1)):(console.log("首次添加,执行全量扫描..."),Hl.fullScan(j,!1))}catch(z){console.error("Error adding library:",z),alert("添加素材库失败: "+z.message)}finally{k(!1)}},L=async z=>{if(z!==t){E(!0);try{await Cn.setCurrent(z),s(z),o(null)}catch(j){console.error("Error setting current library:",j),alert("切换素材库失败: "+j.message)}finally{E(!1)}}},P=async()=>{if(!t)return;const z=e.find(O=>O.id===t);if(!(!z||!confirm(`确定要删除素材库"${z.name}"吗?
|
||||
|
||||
路径: ${z.path}
|
||||
|
||||
⚠️ 注意:
|
||||
• 将删除索引数据并释放数据库连接
|
||||
• 不会删除原始图片文件
|
||||
• .flypic 文件夹将保留,您可以手动删除`)))try{await Cn.delete(t),l(t),Te.getState().setImages([]),Te.getState().setFolders([]),Te.getState().setSelectedImage(null),Te.getState().setSelectedFolder(null);const O=e.filter(A=>A.id!==t);if(O.length>0){const A=O[0];await Cn.setCurrent(A.id),s(A.id)}console.log(`✅ 素材库已删除: ${z.name}`),console.log(`数据库连接已释放,可手动删除: ${z.path}\\.flypic`)}catch(O){console.error("Error deleting library:",O),alert("删除素材库失败: "+O.message)}},I=z=>{const j=new Set(c);j.has(z)?j.delete(z):j.add(z),f(j)},re=z=>{const j=[],O=A=>{A.forEach(J=>{J.children&&J.children.length>0&&(j.push(J.path),O(J.children))})};return O(z),j},T=()=>{const z=re(B.length>0?B:n);f(new Set(z))},D=()=>{f(new Set)},v=()=>{const z=re(B.length>0?B:n);return z.length>0&&z.every(j=>c.has(j))},B=ne.useMemo(()=>{if(!d)return n;const z=d.trim().toLowerCase().split(/\s+/).filter(J=>J.length>0);if(z.length===0)return n;const j=[],O=J=>J.reduce((q,V)=>{const ce=V.name.toLowerCase(),Y=V.path.toLowerCase(),Z=z.every(de=>ce.includes(de)),oe=z.every(de=>Y.includes(de));let ue=[];return V.children&&V.children.length>0&&(ue=O(V.children)),(Z||oe||ue.length>0)&&(q.push({...V,children:ue}),ue.length>0&&j.push(V.path)),q},[]),A=O(n);return j.length>0&&setTimeout(()=>{f(J=>{const q=new Set(J);return j.forEach(V=>q.add(V)),q})},0),A},[n,d]),se=(z,j)=>{z.stopPropagation(),I(j)},X=z=>{const j=z.children&&z.children.length>0;r!==z.path?o(z.path):j&&I(z.path)},H=(z,j=0)=>z.map(O=>{const A=c.has(O.path),J=O.children&&O.children.length>0,q=r===O.path;return C.jsxs("div",{children:[C.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${q?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${j*16+12}px`},onClick:()=>X(O),children:[J?C.jsx("div",{className:"flex items-center justify-center w-5 h-5 mr-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 rounded",onClick:V=>se(V,O.path),children:A?C.jsx(Ff,{className:"w-4 h-4 text-gray-500"}):C.jsx(N1,{className:"w-4 h-4 text-gray-500"})}):C.jsx("div",{className:"w-5 mr-1"}),C.jsx(Df,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),C.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:O.name}),C.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:O.image_count})]}),J&&A&&H(O.children,j+1)]},O.path)});return C.jsxs("div",{className:"w-full h-full border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col",children:[C.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[C.jsx("div",{className:"flex items-center justify-between mb-3",children:C.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"素材库"})}),C.jsxs("div",{className:"flex gap-2",children:[C.jsxs("div",{className:"relative flex-1",children:[C.jsxs("select",{value:t||"",onChange:z=>{const j=z.target.value;j==="__add__"?h(!0):j&&L(j)},disabled:R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 appearance-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{paddingRight:"2rem"},children:[e.length===0&&C.jsx("option",{value:"",children:"暂无素材库"}),e.map(z=>C.jsx("option",{value:z.id,children:z.name},z.id)),C.jsx("option",{value:"__add__",style:{borderTop:"1px solid #ccc"},children:"+ 添加新素材库"})]}),C.jsx(Ff,{className:"absolute right-2 top-2.5 w-4 h-4 text-gray-400 pointer-events-none"})]}),t&&e.length>0&&C.jsx("button",{onClick:P,className:"px-3 py-2 border border-red-300 dark:border-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400 transition-colors",title:"删除当前素材库",children:C.jsx(z1,{className:"w-4 h-4"})})]}),u&&C.jsxs("div",{className:"mt-3 p-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700",children:[C.jsxs("div",{className:"flex items-center justify-between mb-2",children:[C.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"添加素材库"}),C.jsx("button",{onClick:()=>h(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600",children:C.jsx(L1,{className:"w-4 h-4 text-gray-500"})})]}),C.jsxs("div",{className:"space-y-2",children:[C.jsx("input",{type:"text",placeholder:"素材库名称",value:y,onChange:z=>w(z.target.value),onKeyDown:z=>z.key==="Enter"&&N(),autoFocus:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"}),C.jsx("input",{type:"text",placeholder:"文件夹路径(例如:C:\\Users\\Pictures)",value:p,onChange:z=>g(z.target.value),onKeyDown:z=>z.key==="Enter"&&N(),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:
Line truncated
|
||||
|
||||
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
||||
<http://stuartk.com/jszip>
|
||||
|
||||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||||
|
||||
JSZip uses the library pako released under the MIT license :
|
||||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||||
*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,s){function o(u,h){if(!i[u]){if(!r[u]){var y=typeof $s=="function"&&$s;if(!h&&y)return y(u,!0);if(a)return a(u,!0);var w=new Error("Cannot find module '"+u+"'");throw w.code="MODULE_NOT_FOUND",w}var p=i[u]={exports:{}};r[u][0].call(p.exports,function(g){var d=r[u][1][g];return o(d||g)},p,p.exports,n,r,i,s)}return i[u].exports}for(var a=typeof $s=="function"&&$s,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){var s=n("./utils"),o=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(l){for(var u,h,y,w,p,g,d,_=[],c=0,f=l.length,x=f,k=s.getTypeOf(l)!=="string";c<l.length;)x=f-c,y=k?(u=l[c++],h=c<f?l[c++]:0,c<f?l[c++]:0):(u=l.charCodeAt(c++),h=c<f?l.charCodeAt(c++):0,c<f?l.charCodeAt(c++):0),w=u>>2,p=(3&u)<<4|h>>4,g=1<x?(15&h)<<2|y>>6:64,d=2<x?63&y:64,_.push(a.charAt(w)+a.charAt(p)+a.charAt(g)+a.charAt(d));return _.join("")},i.decode=function(l){var u,h,y,w,p,g,d=0,_=0,c="data:";if(l.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var f,x=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&x--,l.charAt(l.length-2)===a.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(f=o.uint8array?new Uint8Array(0|x):new Array(0|x);d<l.length;)u=a.indexOf(l.charAt(d++))<<2|(w=a.indexOf(l.charAt(d++)))>>4,h=(15&w)<<4|(p=a.indexOf(l.charAt(d++)))>>2,y=(3&p)<<6|(g=a.indexOf(l.charAt(d++))),f[_++]=u,p!==64&&(f[_++]=h),g!==64&&(f[_++]=y);return f}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(h,y,w,p,g){this.compressedSize=h,this.uncompressedSize=y,this.crc32=w,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var h=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),y=this;return h.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,y,w){return h.pipe(new a).pipe(new l("uncompressedSize")).pipe(y.compressWorker(w)).pipe(new l("compressedSize")).withStreamInfo("compression",y)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),o=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,h,y,w){var p=o,g=w+y;u^=-1;for(var d=w;d<g;d++)u=u>>>8^p[255&(u^h[d])];return-1^u}(0|l,a,a.length,0):function(u,h,y,w){var p=o,g=w+y;u^=-1;for(var d=w;d<g;d++)u=u>>>8^p[255&(u^h.charCodeAt(d))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=s?"uint8array":"array";function h(y,w){l.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=w,this.meta={}}i.magic="\b\0",a.inherits(h,l),h.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,y.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(w){y.push({data:w,meta:y.meta})}},i.compressWorker=function(y){return new h("Deflate",y)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,g){var d,_="";for(d=0;d<g;d++)_+=String.fromCharCode(255&p),p>>>=8;return _}function o(p,g,d,_,c,f){var x,k,R=p.file,E=p.compression,N=f!==u.Line truncated
|
||||
\0`,q+=s(O,2),q+=E.magic,q+=s(x,2),q+=s(k,2),q+=s(j.crc32,4),q+=s(j.compressedSize,4),q+=s(j.uncompressedSize,4),q+=s(L.length,2),q+=s(B.length,2),{fileRecord:y.LOCAL_FILE_HEADER+q+L+B,dirRecord:y.CENTRAL_FILE_HEADER+s(J,2)+q+s(re.length,2)+"\0\0\0\0"+s(A,4)+s(_,4)+L+B+re}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),h=n("../crc32"),y=n("../signature");function w(p,g,d,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=d,this.encodeFileName=_,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(w,l),w.prototype.push=function(p){var g=p.meta.percent||0,d=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:d?(g+100*(d-_-1))/d:100}}))},w.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var d=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,d=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),g)this.push({data:function(_){return y.DATA_DESCRIPTOR+s(_.crc32,4)+s(_.compressedSize,4)+s(_.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var d=this.bytesWritten-p,_=function(c,f,x,k,R){var E=a.transformTo("string",R(k));return y.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(c,2)+s(c,2)+s(f,4)+s(x,4)+s(E.length,2)+E}(this.dirRecords.length,d,p,this.zipComment,this.encodeFileName);this.push({data:_,meta:{percent:100}})},w.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},w.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(d){g.processChunk(d)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(d){g.error(d)}),this},w.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},w.prototype.error=function(p){var g=this._sources;if(!l.prototype.error.call(this,p))return!1;for(var d=0;d<g.length;d++)try{g[d].error(p)}catch{}return!0},w.prototype.lock=function(){l.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},r.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),o=n("./ZipFileWorker");i.generateWorker=function(a,l,u){var h=new o(l.streamFiles,u,l.platform,l.encodeFileName),y=0;try{a.forEach(function(w,p){y++;var g=function(f,x){var k=f||x,R=s[k];if(!R)throw new Error(k+" is not a valid compression method !");return R}(p.options.compression,l.compression),d=p.options.compressionOptions||l.compressionOptions||{},_=p.dir,c=p.date;p._compressWorker(g,d).withStreamInfo("file",{name:w,dir:_,date:c,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(h)}),h.entriesCount=y}catch(w){h.error(w)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),o=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),h=n("./nodejsUtils");function y(w){return new o.Promise(function(p,g){var d=w.decompressed.getContentWorker().pipe(new u);d.on("error",function(_){g(_)}).on("end",function(){d.streamInfo.crc32!==w.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(w,p){var g=this
Line truncated
|
||||
`),J=j.map(q=>q.filename).join(`
|
||||
`);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([A],{type:"text/html"}),"text/plain":new Blob([J],{type:"text/plain"})})]),c(!0),setTimeout(()=>c(!1),2e3)}catch(q){console.error("写入剪贴板失败:",q),alert(`复制失败。
|
||||
|
||||
提示:浏览器限制,多张图片会以 HTML 格式复制。
|
||||
可粘贴到 Word、富文本编辑器等。
|
||||
|
||||
如需单独使用,请使用"导出"功能。`)}}catch(j){console.error("复制图片失败:",j),alert("复制图片失败,请重试")}},se=async()=>{x(!0);try{const j=I?t:[e];if(j.length===1){const O=ct.getOriginalUrl(n,j[0].path),A=document.createElement("a");A.href=O,A.download=j[0].filename,A.target="_blank",document.body.appendChild(A),A.click(),document.body.removeChild(A)}else{const O=new Zf,A=O.folder("images");R(0);for(let V=0;V<j.length;V++){const ce=j[V],Y=ct.getOriginalUrl(n,ce.path);try{const oe=await(await fetch(Y)).blob();A.file(ce.filename,oe);const ue=Math.round((V+1)/j.length*90);R(ue),console.log(`已添加: ${ce.filename} (${V+1}/${j.length})`)}catch(Z){console.error(`下载失败: ${ce.filename}`,Z)}}R(95),console.log("正在生成 ZIP 文件...");const J=await O.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});R(100);const q=document.createElement("a");q.href=URL.createObjectURL(J),q.download=`FlyPic_导出_${j.length}张_${Date.now()}.zip`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(q.href),console.log("导出完成!")}}catch(j){console.error("导出失败:",j),alert("导出失败,请重试")}finally{x(!1)}},X=async()=>{if(!r){alert("请先选择一个文件夹");return}N(!0),P(0);try{const j=i.filter(ce=>ce.folder&&ce.folder.startsWith(r));if(j.length===0){alert("当前文件夹没有图片");return}const O=new Zf,A=r.split("/").pop()||"images",J=O.folder(A);for(let ce=0;ce<j.length;ce++){const Y=j[ce],Z=ct.getOriginalUrl(n,Y.path);try{const ue=await(await fetch(Z)).blob(),de=Y.folder.replace(r,"").replace(/^\//,""),ge=de?`${de}/${Y.filename}`:Y.filename;J.file(ge,ue);const we=Math.round((ce+1)/j.length*90);P(we),console.log(`已添加: ${ge} (${ce+1}/${j.length})`)}catch(oe){console.error(`下载失败: ${Y.filename}`,oe)}}P(95),console.log("正在生成 ZIP 文件...");const q=await O.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});P(100);const V=document.createElement("a");V.href=URL.createObjectURL(q),V.download=`${A}_${j.length}张_${Date.now()}.zip`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(V.href),console.log("文件夹导出完成!")}catch(j){console.error("导出文件夹失败:",j),alert("导出文件夹失败,请重试")}finally{N(!1)}},H=j=>j<1024?j+" B":j<1024*1024?(j/1024).toFixed(2)+" KB":(j/(1024*1024)).toFixed(2)+" MB",z=j=>new Date(j).toLocaleString("zh-CN");return C.jsxs("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col h-full",children:[l&&C.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:C.jsxs("button",{onClick:()=>s("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[C.jsx(E1,{className:"w-5 h-5"}),C.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),C.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:C.jsxs("div",{className:"w-full aspect-square bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden relative",children:[C.jsx("img",{src:h,alt:re.filename,decoding:"async",className:`w-full h-full object-contain transition-opacity duration-300 ${w?"opacity-75":"opacity-100"}`}),w&&C.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded",children:"加载原图中..."})]})}),C.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:C.jsxs("div",{children:[C.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"基本信息"}),C.jsxs("div",{className:"space-y-2 text-sm",children:[C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件名:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all",children:e.filename})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸:"}),C.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[e.width," × ",e.height]})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"大小:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:H(e.size)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:e.format})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:z(e.created_at)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:z(e.modified_at)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"tex
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
.PhotoView-Portal{direction:ltr;height:100%;left:0;overflow:hidden;position:fixed;top:0;touch-action:none;width:100%;z-index:2000}@keyframes PhotoView__rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes PhotoView__delayIn{0%,50%{opacity:0}to{opacity:1}}.PhotoView__Spinner{animation:PhotoView__delayIn .4s linear both}.PhotoView__Spinner svg{animation:PhotoView__rotate .6s linear infinite}.PhotoView__Photo{cursor:grab;max-width:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.PhotoView__Photo:active{cursor:grabbing}.PhotoView__icon{display:inline-block;left:0;position:absolute;top:0;transform:translate(-50%,-50%)}.PhotoView__PhotoBox,.PhotoView__PhotoWrap{bottom:0;direction:ltr;left:0;position:absolute;right:0;top:0;touch-action:none;width:100%}.PhotoView__PhotoWrap{overflow:hidden;z-index:10}.PhotoView__PhotoBox{transform-origin:left top}@keyframes PhotoView__fade{0%{opacity:0}to{opacity:1}}.PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,.PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,.PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,.PhotoView-Slider__clean .PhotoView-Slider__Overlay,.PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover{opacity:0}.PhotoView-Slider__Backdrop{background:#000;height:100%;left:0;position:absolute;top:0;transition-property:background-color;width:100%;z-index:-1}.PhotoView-Slider__fadeIn{animation:PhotoView__fade linear both;opacity:0}.PhotoView-Slider__fadeOut{animation:PhotoView__fade linear reverse both;opacity:0}.PhotoView-Slider__BannerWrap{align-items:center;background-color:#00000080;color:#fff;display:flex;height:44px;justify-content:space-between;left:0;position:absolute;top:0;transition:opacity .2s ease-out;width:100%;z-index:20}.PhotoView-Slider__BannerWrap:hover{opacity:1}.PhotoView-Slider__Counter{font-size:14px;opacity:.75;padding:0 10px}.PhotoView-Slider__BannerRight{align-items:center;display:flex;height:100%}.PhotoView-Slider__toolbarIcon{fill:#fff;box-sizing:border-box;cursor:pointer;opacity:.75;padding:10px;transition:opacity .2s linear}.PhotoView-Slider__toolbarIcon:hover{opacity:1}.PhotoView-Slider__ArrowLeft,.PhotoView-Slider__ArrowRight{align-items:center;bottom:0;cursor:pointer;display:flex;height:100px;justify-content:center;margin:auto;opacity:.75;position:absolute;top:0;transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;z-index:20}.PhotoView-Slider__ArrowLeft:hover,.PhotoView-Slider__ArrowRight:hover{opacity:1}.PhotoView-Slider__ArrowLeft svg,.PhotoView-Slider__ArrowRight svg{fill:#fff;background:#0000004d;box-sizing:content-box;height:24px;padding:10px;width:24px}.PhotoView-Slider__ArrowLeft{left:0}.PhotoView-Slider__ArrowRight{right:0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-painLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
.PhotoView-Portal{direction:ltr;height:100%;left:0;overflow:hidden;position:fixed;top:0;touch-action:none;width:100%;z-index:2000}@keyframes PhotoView__rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes PhotoView__delayIn{0%,50%{opacity:0}to{opacity:1}}.PhotoView__Spinner{animation:PhotoView__delayIn .4s linear both}.PhotoView__Spinner svg{animation:PhotoView__rotate .6s linear infinite}.PhotoView__Photo{cursor:grab;max-width:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.PhotoView__Photo:active{cursor:grabbing}.PhotoView__icon{display:inline-block;left:0;position:absolute;top:0;transform:translate(-50%,-50%)}.PhotoView__PhotoBox,.PhotoView__PhotoWrap{bottom:0;direction:ltr;left:0;position:absolute;right:0;top:0;touch-action:none;width:100%}.PhotoView__PhotoWrap{overflow:hidden;z-index:10}.PhotoView__PhotoBox{transform-origin:left top}@keyframes PhotoView__fade{0%{opacity:0}to{opacity:1}}.PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,.PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,.PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,.PhotoView-Slider__clean .PhotoView-Slider__Overlay,.PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover{opacity:0}.PhotoView-Slider__Backdrop{background:#000;height:100%;left:0;position:absolute;top:0;transition-property:background-color;width:100%;z-index:-1}.PhotoView-Slider__fadeIn{animation:PhotoView__fade linear both;opacity:0}.PhotoView-Slider__fadeOut{animation:PhotoView__fade linear reverse both;opacity:0}.PhotoView-Slider__BannerWrap{align-items:center;background-color:#00000080;color:#fff;display:flex;height:44px;justify-content:space-between;left:0;position:absolute;top:0;transition:opacity .2s ease-out;width:100%;z-index:20}.PhotoView-Slider__BannerWrap:hover{opacity:1}.PhotoView-Slider__Counter{font-size:14px;opacity:.75;padding:0 10px}.PhotoView-Slider__BannerRight{align-items:center;display:flex;height:100%}.PhotoView-Slider__toolbarIcon{fill:#fff;box-sizing:border-box;cursor:pointer;opacity:.75;padding:10px;transition:opacity .2s linear}.PhotoView-Slider__toolbarIcon:hover{opacity:1}.PhotoView-Slider__ArrowLeft,.PhotoView-Slider__ArrowRight{align-items:center;bottom:0;cursor:pointer;display:flex;height:100px;justify-content:center;margin:auto;opacity:.75;position:absolute;top:0;transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;z-index:20}.PhotoView-Slider__ArrowLeft:hover,.PhotoView-Slider__ArrowRight:hover{opacity:1}.PhotoView-Slider__ArrowLeft svg,.PhotoView-Slider__ArrowRight svg{fill:#fff;background:#0000004d;box-sizing:content-box;height:24px;padding:10px;width:24px}.PhotoView-Slider__ArrowLeft{left:0}.PhotoView-Slider__ArrowRight{right:0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-painLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
(function(){"use strict";let c={containerWidth:0,targetHeight:0,imageCount:0,rows:[],pendingRow:[],pendingRowWidthSum:0};function W(n,o,l,i,s){const a=(n.length-1)*16;let e=(o-a)/l;i&&n.length<3&&(e=Math.min(e,1.2));const t=s*e;return n.map(u=>({...u,calculatedWidth:u.originalWidth*e,calculatedHeight:t}))}function A(n,o,l){if(!n.length||!o)return{rows:[],pendingRow:[],pendingRowWidthSum:0};const i=[];let s=[],a=0;for(let h=0;h<n.length;h++){const e=n[h],t=e.width/e.height,u=l*t;s.push({...e,originalWidth:u,aspectRatio:t}),a+=u;const r=(s.length-1)*16,g=a+r,p=h===n.length-1;let d=!1;if(p)d=!0;else if(g>=o*.95)d=!0;else{const w=n[h+1];if(w){const R=w.width/w.height,G=l*R;a+G+s.length*16>o*1.2&&(d=!0)}}if(d){const w=W(s,o,a,p,l);i.push(w),s=[],a=0}}return{rows:i,pendingRow:s,pendingRowWidthSum:a}}function x(n,o,l,i,s,a){if(!n.length){if(s.length>0){const r=W(s,o,a,!0,l);return{rows:[...i,r],pendingRow:[],pendingRowWidthSum:0}}return{rows:i,pendingRow:[],pendingRowWidthSum:0}}const h=[...i];let e=[...s],t=a;const u=i.reduce((r,g)=>r+g.length,0)+s.length+n.length;for(let r=0;r<n.length;r++){const g=n[r],p=g.width/g.height,d=l*p;e.push({...g,originalWidth:d,aspectRatio:p}),t+=d;const w=(e.length-1)*16,R=t+w,S=i.reduce((f,C)=>f+C.length,0)+h.length-i.length+e.length>=u;let m=!1;if(S)m=!0;else if(R>=o*.95)m=!0;else{const f=n[r+1];if(f){const C=f.width/f.height,I=l*C;t+I+e.length*16>o*1.2&&(m=!0)}}if(m){const f=W(e,o,t,S,l);h.push(f),e=[],t=0}}return{rows:h,pendingRow:e,pendingRowWidthSum:t}}function P(){c={containerWidth:0,targetHeight:0,imageCount:0,rows:[],pendingRow:[],pendingRowWidthSum:0}}self.onmessage=function(n){const{images:o,containerWidth:l,targetHeight:i,requestId:s,incremental:a,reset:h}=n.data;if(h){P(),self.postMessage({requestId:s,reset:!0});return}const e=performance.now();let t;const u=a&&c.containerWidth===l&&c.targetHeight===i&&o.length>c.imageCount;if(u){const g=o.slice(c.imageCount),p=c.rows.slice(0,-1),d=c.rows[c.rows.length-1]||[];t=x(g,l,i,p,c.pendingRow.length>0?c.pendingRow:d,c.pendingRowWidthSum>0?c.pendingRowWidthSum:d.reduce((w,R)=>w+R.originalWidth,0))}else t=A(o,l,i);c={containerWidth:l,targetHeight:i,imageCount:o.length,rows:t.rows,pendingRow:t.pendingRow,pendingRowWidthSum:t.pendingRowWidthSum};const r=performance.now()-e;self.postMessage({rows:t.rows,requestId:s,duration:r,imageCount:o.length,rowCount:t.rows.length,incremental:u})}})();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#3b82f6"/>
|
||||
<stop offset="100%" style="stop-color:#8b5cf6"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="12" fill="url(#grad)"/>
|
||||
<path d="M18 22h28v20H18z" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
|
||||
<circle cx="25" cy="29" r="3" fill="white"/>
|
||||
<path d="M18 38l10-8 6 5 8-7 4 4v10H18z" fill="white" opacity="0.9"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 563 B |
@@ -2,11 +2,11 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>FlyPic - 图片素材库管理</title>
|
||||
<script type="module" crossorigin src="/assets/index-Ct4ORqFz.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DYf0hRmn.css">
|
||||
<title>FlyPic 飞图 - 图片素材库管理</title>
|
||||
<script type="module" crossorigin src="/assets/index-BQRQ1pO1.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-lXh_CTLb.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>␍
|
||||
|
||||
@@ -4,25 +4,26 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { exec } = require('child_process');
|
||||
const dbPool = require('../database/dbPool');
|
||||
const { generateThumbnail } = require('../utils/thumbnail');
|
||||
const { getLibrary } = require('../utils/config');
|
||||
|
||||
// Get images with search and filters
|
||||
// Get images with search and filters (supports pagination)
|
||||
router.get('/', (req, res) => {
|
||||
try {
|
||||
const { libraryId, keywords, folder, formats, minSize, maxSize, startDate, endDate } = req.query;
|
||||
|
||||
const { libraryId, keywords, folder, formats, minSize, maxSize, startDate, endDate, offset, limit } = req.query;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
|
||||
// 使用连接池获取数据库连接
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
|
||||
try {
|
||||
const filters = {};
|
||||
if (folder) filters.folder = folder;
|
||||
@@ -31,10 +32,30 @@ router.get('/', (req, res) => {
|
||||
if (maxSize) filters.maxSize = parseInt(maxSize);
|
||||
if (startDate) filters.startDate = parseInt(startDate);
|
||||
if (endDate) filters.endDate = parseInt(endDate);
|
||||
|
||||
const images = db.searchImages(keywords || '', filters);
|
||||
|
||||
res.json({ images });
|
||||
|
||||
// 分页参数(可选)
|
||||
let pagination = null;
|
||||
if (offset !== undefined && limit !== undefined) {
|
||||
pagination = {
|
||||
offset: parseInt(offset, 10),
|
||||
limit: parseInt(limit, 10)
|
||||
};
|
||||
}
|
||||
|
||||
const result = db.searchImages(keywords || '', filters, pagination);
|
||||
|
||||
// 如果使用分页,返回分页格式;否则保持向后兼容
|
||||
if (pagination) {
|
||||
res.json({
|
||||
images: result.images,
|
||||
total: result.total,
|
||||
offset: result.offset,
|
||||
limit: result.limit,
|
||||
hasMore: result.hasMore
|
||||
});
|
||||
} else {
|
||||
res.json({ images: result });
|
||||
}
|
||||
} finally {
|
||||
// 释放连接
|
||||
dbPool.release(library.path);
|
||||
@@ -44,23 +65,75 @@ router.get('/', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Get cache metadata (database modification time, counts)
|
||||
router.get('/cache-meta', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.query;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
const db = dbPool.acquire(library.path);
|
||||
try {
|
||||
const meta = db.getCacheMeta();
|
||||
res.json(meta);
|
||||
} finally {
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Get total image count
|
||||
router.get('/count', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.query;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
try {
|
||||
const row = db.db.prepare('SELECT COUNT(*) as count FROM images').get();
|
||||
res.json({ count: row.count });
|
||||
} finally {
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Get folders
|
||||
router.get('/folders', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.query;
|
||||
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
// 使用连接池
|
||||
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
|
||||
try {
|
||||
const folders = db.getFolderTree();
|
||||
res.json({ folders });
|
||||
@@ -73,23 +146,53 @@ router.get('/folders', (req, res) => {
|
||||
});
|
||||
|
||||
// Serve thumbnail
|
||||
router.get('/thumbnail/:libraryId/:size/:filename', (req, res) => {
|
||||
router.get('/thumbnail/:libraryId/:size/:filename', async (req, res) => {
|
||||
try {
|
||||
const { libraryId, filename } = req.params;
|
||||
|
||||
const { libraryId, size, filename } = req.params;
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
// 直接从 thumbnails 目录获取
|
||||
const thumbnailPath = path.join(library.path, '.flypic', 'thumbnails', filename);
|
||||
|
||||
if (!fs.existsSync(thumbnailPath)) {
|
||||
|
||||
// New structure: .flypic/thumbnails/ab/hash.webp
|
||||
const thumbBase = path.join(library.path, '.flypic', 'thumbnails');
|
||||
const hash = filename.replace(/\.[^/.]+$/, ""); // remove extension if present
|
||||
const shard1 = hash.slice(0, 2);
|
||||
|
||||
const targetPath = path.join(thumbBase, shard1, filename);
|
||||
|
||||
if (!fs.existsSync(targetPath)) {
|
||||
// 按需生成:尝试通过文件名在数据库中定位原图并生成
|
||||
try {
|
||||
const db = dbPool.acquire(library.path);
|
||||
try {
|
||||
const row = db.db.prepare('SELECT path, thumbnail_path FROM images WHERE thumbnail_path LIKE ?').get(`%/${filename}`);
|
||||
if (row && row.path) {
|
||||
const originalFull = path.join(library.path, row.path);
|
||||
// 确保目标目录存在
|
||||
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
||||
// 生成指定尺寸 (default 480)
|
||||
await generateThumbnail(originalFull, targetPath, parseInt(size, 10) || 480);
|
||||
}
|
||||
} finally {
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
} catch (e) {
|
||||
// 忽略生成失败
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(targetPath)) {
|
||||
return res.status(404).json({ error: 'Thumbnail not found' });
|
||||
}
|
||||
|
||||
res.sendFile(thumbnailPath);
|
||||
|
||||
// 设置缓存头,减少重复请求(缩略图内容不变)
|
||||
res.set({
|
||||
'Cache-Control': 'public, max-age=31536000, immutable',
|
||||
'Vary': 'Accept-Encoding'
|
||||
});
|
||||
res.sendFile(targetPath);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
@@ -100,45 +203,85 @@ router.get('/original/:libraryId/*', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.params;
|
||||
const imagePath = req.params[0];
|
||||
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
|
||||
const fullPath = path.join(library.path, imagePath);
|
||||
|
||||
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
return res.status(404).json({ error: 'Image not found' });
|
||||
}
|
||||
|
||||
|
||||
res.sendFile(fullPath);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Open file in system default application
|
||||
router.post('/:libraryId/open-file', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.params;
|
||||
const { path: filePath } = req.body;
|
||||
|
||||
if (!filePath) {
|
||||
return res.status(400).json({ error: 'Path is required' });
|
||||
}
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
const fullPath = path.join(library.path, filePath);
|
||||
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
return res.status(404).json({ error: 'File not found' });
|
||||
}
|
||||
|
||||
// 使用系统默认应用打开文件
|
||||
const command = process.platform === 'win32'
|
||||
? `start "" "${fullPath}"`
|
||||
: process.platform === 'darwin'
|
||||
? `open "${fullPath}"`
|
||||
: `xdg-open "${fullPath}"`;
|
||||
|
||||
exec(command, (error) => {
|
||||
if (error) {
|
||||
console.error('打开文件失败:', error);
|
||||
return res.status(500).json({ error: '打开文件失败' });
|
||||
}
|
||||
res.json({ success: true });
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Open folder in file explorer
|
||||
router.post('/:libraryId/open-folder', (req, res) => {
|
||||
try {
|
||||
const { path: imagePath } = req.body;
|
||||
|
||||
|
||||
if (!imagePath) {
|
||||
return res.status(400).json({ error: 'Path is required' });
|
||||
}
|
||||
|
||||
|
||||
// 获取文件所在文件夹
|
||||
const folderPath = path.dirname(imagePath);
|
||||
|
||||
|
||||
// Windows: 使用 explorer
|
||||
// Linux: 使用 xdg-open
|
||||
// macOS: 使用 open
|
||||
const command = process.platform === 'win32'
|
||||
const command = process.platform === 'win32'
|
||||
? `explorer "${folderPath}"`
|
||||
: process.platform === 'darwin'
|
||||
? `open "${folderPath}"`
|
||||
: `xdg-open "${folderPath}"`;
|
||||
|
||||
? `open "${folderPath}"`
|
||||
: `xdg-open "${folderPath}"`;
|
||||
|
||||
exec(command, (error) => {
|
||||
if (error) {
|
||||
console.error('打开文件夹失败:', error);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const {
|
||||
loadConfig,
|
||||
addLibrary,
|
||||
@@ -31,25 +30,25 @@ router.get('/', (req, res) => {
|
||||
router.post('/', (req, res) => {
|
||||
try {
|
||||
const { name, path } = req.body;
|
||||
|
||||
|
||||
if (!name || !path) {
|
||||
return res.status(400).json({ error: 'Name and path are required' });
|
||||
}
|
||||
|
||||
|
||||
if (!fs.existsSync(path)) {
|
||||
return res.status(400).json({ error: 'Path does not exist' });
|
||||
}
|
||||
|
||||
|
||||
const id = addLibrary(name, path);
|
||||
|
||||
|
||||
// Check if .flypic directory exists
|
||||
const flypicDir = require('path').join(path, '.flypic');
|
||||
const hasExistingIndex = fs.existsSync(flypicDir);
|
||||
|
||||
res.json({
|
||||
id,
|
||||
|
||||
res.json({
|
||||
id,
|
||||
message: 'Library added successfully',
|
||||
hasExistingIndex
|
||||
hasExistingIndex
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
@@ -82,7 +81,7 @@ router.put('/:id', (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const updates = req.body;
|
||||
|
||||
|
||||
const success = updateLibrary(id, updates);
|
||||
if (success) {
|
||||
res.json({ message: 'Library updated successfully' });
|
||||
@@ -98,29 +97,35 @@ router.put('/:id', (req, res) => {
|
||||
router.delete('/:id', async (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
|
||||
|
||||
// 获取素材库信息
|
||||
const config = loadConfig();
|
||||
const library = config.libraries.find(lib => lib.id === id);
|
||||
|
||||
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
// 关闭该素材库的数据库连接,释放文件锁
|
||||
|
||||
const dbPool = require('../database/dbPool');
|
||||
console.log(`[Delete] Closing database connection for: ${library.path}`);
|
||||
const fileWatcher = require('../utils/fileWatcher');
|
||||
const scanManager = require('../utils/scanManager');
|
||||
|
||||
// 1. 停止扫描并清理状态
|
||||
scanManager.clearState(id);
|
||||
|
||||
// 2. 停止文件监控
|
||||
fileWatcher.unwatch(id);
|
||||
|
||||
// 3. 关闭数据库连接
|
||||
dbPool.close(library.path);
|
||||
|
||||
|
||||
// 等待一下,确保连接完全关闭
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
|
||||
// 删除索引
|
||||
removeLibrary(id);
|
||||
|
||||
console.log(`✅ Library removed and database connection released: ${library.name}`);
|
||||
|
||||
res.json({
|
||||
|
||||
res.json({
|
||||
message: 'Library removed successfully',
|
||||
path: library.path
|
||||
});
|
||||
@@ -131,29 +136,48 @@ router.delete('/:id', async (req, res) => {
|
||||
});
|
||||
|
||||
// Set current library
|
||||
router.post('/:id/set-current', (req, res) => {
|
||||
router.post('/:id/set-current', async (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const config = loadConfig();
|
||||
const dbPool = require('../database/dbPool');
|
||||
|
||||
const scanManager = require('../utils/scanManager');
|
||||
|
||||
// 获取旧的当前素材库
|
||||
const oldLibraryId = config.currentLibraryId;
|
||||
if (oldLibraryId && oldLibraryId !== id) {
|
||||
const oldLibrary = config.libraries.find(lib => lib.id === oldLibraryId);
|
||||
if (oldLibrary) {
|
||||
// 关闭旧素材库的数据库连接
|
||||
console.log(`[Switch] Closing old library connection: ${oldLibrary.name}`);
|
||||
// 1. 停止扫描(如果正在进行),但保留暂停状态以便恢复
|
||||
if (scanManager.isScanning(oldLibraryId)) {
|
||||
const state = scanManager.getState(oldLibraryId);
|
||||
if (state.abortController) {
|
||||
state.abortController.aborted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 关闭数据库连接
|
||||
dbPool.close(oldLibrary.path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 设置新的当前素材库
|
||||
setCurrentLibrary(id);
|
||||
|
||||
|
||||
const newLibrary = config.libraries.find(lib => lib.id === id);
|
||||
console.log(`[Switch] Switched to library: ${newLibrary?.name}`);
|
||||
|
||||
|
||||
// 预热新数据库连接(避免第一个查询时才创建连接)
|
||||
if (newLibrary) {
|
||||
const db = dbPool.acquire(newLibrary.path);
|
||||
// 执行一个简单查询来预热缓存
|
||||
try {
|
||||
db.db.prepare('SELECT 1').get();
|
||||
} catch (e) {
|
||||
// 忽略预热错误
|
||||
}
|
||||
dbPool.release(newLibrary.path);
|
||||
}
|
||||
|
||||
res.json({ message: 'Current library set successfully' });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
@@ -166,18 +190,49 @@ router.post('/:id/close-db', (req, res) => {
|
||||
const { id } = req.params;
|
||||
const config = loadConfig();
|
||||
const library = config.libraries.find(lib => lib.id === id);
|
||||
|
||||
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
|
||||
const dbPool = require('../database/dbPool');
|
||||
dbPool.close(library.path);
|
||||
|
||||
|
||||
res.json({ message: 'Database connection closed successfully' });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Release all resources for a library (database + file watcher)
|
||||
router.post('/:id/release', (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const config = loadConfig();
|
||||
const library = config.libraries.find(lib => lib.id === id);
|
||||
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
// 1. 关闭数据库连接
|
||||
const dbPool = require('../database/dbPool');
|
||||
dbPool.close(library.path);
|
||||
|
||||
// 2. 停止文件监控
|
||||
const fileWatcher = req.app.get('fileWatcher');
|
||||
if (fileWatcher && fileWatcher.isWatching(id)) {
|
||||
fileWatcher.unwatch(id);
|
||||
}
|
||||
|
||||
res.json({
|
||||
message: 'All resources released successfully',
|
||||
library: library.name
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[Release] Error:', error);
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -3,6 +3,7 @@ const router = express.Router();
|
||||
const LibraryDatabase = require('../database/db');
|
||||
const { getLibrary, updateLibrary } = require('../utils/config');
|
||||
const { scanLibrary, syncLibrary } = require('../utils/scanner');
|
||||
const scanManager = require('../utils/scanManager');
|
||||
|
||||
// Start full scan
|
||||
router.post('/full', async (req, res) => {
|
||||
@@ -44,18 +45,26 @@ router.post('/full', async (req, res) => {
|
||||
}
|
||||
} else {
|
||||
// Start scan in background
|
||||
console.log(`🔍 Starting background scan for library: ${libraryId}`);
|
||||
res.json({ message: 'Scan started' });
|
||||
|
||||
scanLibrary(library.path, db, (progress) => {
|
||||
console.log(`📊 Progress: ${progress.current}/${progress.total} (${progress.percent}%)`);
|
||||
io.emit('scanProgress', {
|
||||
libraryId,
|
||||
...progress
|
||||
});
|
||||
}).then(results => {
|
||||
}, libraryId).then(results => {
|
||||
console.log(`✅ Scan complete for library: ${libraryId}`, results);
|
||||
dbPool.release(library.path);
|
||||
updateLibrary(libraryId, { lastScan: Date.now() });
|
||||
io.emit('scanComplete', { libraryId, results });
|
||||
if (!results.stopped) {
|
||||
updateLibrary(libraryId, { lastScan: Date.now() });
|
||||
io.emit('scanComplete', { libraryId, results });
|
||||
} else {
|
||||
io.emit('scanPaused', { libraryId, results });
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(`❌ Scan error for library: ${libraryId}`, error);
|
||||
dbPool.release(library.path);
|
||||
io.emit('scanError', { libraryId, error: error.message });
|
||||
});
|
||||
@@ -101,13 +110,22 @@ router.post('/sync', async (req, res) => {
|
||||
}
|
||||
} else {
|
||||
// Start sync in background
|
||||
console.log(`🔄 Starting background sync for library: ${libraryId}`);
|
||||
res.json({ message: 'Sync started' });
|
||||
|
||||
syncLibrary(library.path, db).then(results => {
|
||||
syncLibrary(library.path, db, false, (progress) => {
|
||||
console.log(`📊 Sync progress: ${progress.current}/${progress.total} (${progress.percent}%)`);
|
||||
io.emit('scanProgress', {
|
||||
libraryId,
|
||||
...progress
|
||||
});
|
||||
}).then(results => {
|
||||
console.log(`✅ Sync complete for library: ${libraryId}`, results);
|
||||
dbPool.release(library.path);
|
||||
updateLibrary(libraryId, { lastScan: Date.now() });
|
||||
io.emit('scanComplete', { libraryId, results });
|
||||
}).catch(error => {
|
||||
console.error(`❌ Sync error for library: ${libraryId}`, error);
|
||||
dbPool.release(library.path);
|
||||
io.emit('scanError', { libraryId, error: error.message });
|
||||
});
|
||||
@@ -118,4 +136,148 @@ router.post('/sync', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Fix folder paths in database (one-time migration)
|
||||
router.post('/fix-folders', async (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.body;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
try {
|
||||
const path = require('path');
|
||||
const images = db.getAllImages();
|
||||
let fixed = 0;
|
||||
|
||||
for (const img of images) {
|
||||
const expectedFolderRaw = path.dirname(img.path || '');
|
||||
const expectedFolder = expectedFolderRaw === '.' ? '' : expectedFolderRaw.replace(/\\/g, '/');
|
||||
const currentFolder = (img.folder || '').replace(/\\/g, '/');
|
||||
|
||||
if (expectedFolder !== currentFolder) {
|
||||
db.updateImageFolder(img.path, expectedFolder);
|
||||
fixed++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`✅ Fixed ${fixed} folder paths`);
|
||||
res.json({ message: `Fixed ${fixed} folder paths`, fixed });
|
||||
} finally {
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 停止扫描
|
||||
router.post('/stop', async (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.body;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
if (!scanManager.isScanning(libraryId)) {
|
||||
return res.status(400).json({ error: 'No scan in progress' });
|
||||
}
|
||||
|
||||
// 设置停止标志(实际停止在下一个批次检查时)
|
||||
const state = scanManager.getState(libraryId);
|
||||
state.abortController.aborted = true;
|
||||
|
||||
console.log(`⏸️ Stop requested for library: ${libraryId}`);
|
||||
res.json({ message: 'Stop requested', libraryId });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 继续扫描
|
||||
router.post('/resume', async (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.body;
|
||||
|
||||
if (!libraryId) {
|
||||
return res.status(400).json({ error: 'Library ID is required' });
|
||||
}
|
||||
|
||||
if (!scanManager.isPaused(libraryId)) {
|
||||
return res.status(400).json({ error: 'Scan is not paused' });
|
||||
}
|
||||
|
||||
const library = getLibrary(libraryId);
|
||||
if (!library) {
|
||||
return res.status(404).json({ error: 'Library not found' });
|
||||
}
|
||||
|
||||
const pendingFiles = scanManager.resumeScan(libraryId);
|
||||
if (pendingFiles.length === 0) {
|
||||
return res.status(400).json({ error: 'No pending files to resume' });
|
||||
}
|
||||
|
||||
const io = req.app.get('io');
|
||||
const dbPool = require('../database/dbPool');
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
console.log(`▶️ Resuming scan for library: ${libraryId}, ${pendingFiles.length} files`);
|
||||
res.json({ message: 'Scan resumed', pendingFiles: pendingFiles.length });
|
||||
|
||||
// 继续扫描
|
||||
scanLibrary(library.path, db, (progress) => {
|
||||
io.emit('scanProgress', {
|
||||
libraryId,
|
||||
...progress
|
||||
});
|
||||
}, libraryId, pendingFiles).then(results => {
|
||||
dbPool.release(library.path);
|
||||
if (!results.stopped) {
|
||||
updateLibrary(libraryId, { lastScan: Date.now() });
|
||||
io.emit('scanComplete', { libraryId, results });
|
||||
} else {
|
||||
io.emit('scanPaused', { libraryId, results });
|
||||
}
|
||||
}).catch(error => {
|
||||
dbPool.release(library.path);
|
||||
io.emit('scanError', { libraryId, error: error.message });
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 获取扫描状态
|
||||
router.get('/status/:libraryId', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.params;
|
||||
|
||||
// 注册素材库路径(用于持久化恢复)
|
||||
const library = getLibrary(libraryId);
|
||||
if (library) {
|
||||
scanManager.registerLibraryPath(libraryId, library.path);
|
||||
}
|
||||
|
||||
const state = scanManager.getState(libraryId);
|
||||
res.json({
|
||||
libraryId,
|
||||
status: state.status,
|
||||
progress: state.progress,
|
||||
pendingCount: state.pendingFiles?.length || 0,
|
||||
needsRescan: state.needsRescan || false // 标记是否需要重新扫描
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -7,14 +7,22 @@ router.post('/start/:libraryId', (req, res) => {
|
||||
const { libraryId } = req.params;
|
||||
const fileWatcher = req.app.get('fileWatcher');
|
||||
const io = req.app.get('io');
|
||||
|
||||
fileWatcher.watch(libraryId, io);
|
||||
|
||||
res.json({
|
||||
message: 'File watching started',
|
||||
|
||||
// 立即返回响应,让文件监控在后台启动
|
||||
res.json({
|
||||
message: 'File watching starting',
|
||||
libraryId,
|
||||
isWatching: true
|
||||
});
|
||||
|
||||
// 异步启动监控(不阻塞响应)
|
||||
setImmediate(() => {
|
||||
try {
|
||||
fileWatcher.watch(libraryId, io);
|
||||
} catch (watchError) {
|
||||
console.error(`Failed to start file watching for ${libraryId}:`, watchError.message);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
@@ -25,10 +33,10 @@ router.post('/stop/:libraryId', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.params;
|
||||
const fileWatcher = req.app.get('fileWatcher');
|
||||
|
||||
|
||||
fileWatcher.unwatch(libraryId);
|
||||
|
||||
res.json({
|
||||
|
||||
res.json({
|
||||
message: 'File watching stopped',
|
||||
libraryId,
|
||||
isWatching: false
|
||||
@@ -43,10 +51,10 @@ router.get('/status/:libraryId', (req, res) => {
|
||||
try {
|
||||
const { libraryId } = req.params;
|
||||
const fileWatcher = req.app.get('fileWatcher');
|
||||
|
||||
|
||||
const isWatching = fileWatcher.isWatching(libraryId);
|
||||
|
||||
res.json({
|
||||
|
||||
res.json({
|
||||
libraryId,
|
||||
isWatching
|
||||
});
|
||||
@@ -60,8 +68,8 @@ router.get('/list', (req, res) => {
|
||||
try {
|
||||
const fileWatcher = req.app.get('fileWatcher');
|
||||
const watchedLibraries = fileWatcher.getWatchedLibraries();
|
||||
|
||||
res.json({
|
||||
|
||||
res.json({
|
||||
watchedLibraries,
|
||||
count: watchedLibraries.length
|
||||
});
|
||||
|
||||
+108
-10
@@ -9,12 +9,12 @@ const app = express();
|
||||
const server = http.createServer(app);
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: process.env.FRONTEND_DIST ? false : 'http://localhost:5173',
|
||||
origin: process.env.FRONTEND_DIST ? false : ['http://localhost:5173', 'http://localhost:3000'],
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
});
|
||||
|
||||
const PORT = process.env.TRIM_SERVICE_PORT || process.env.PORT || 3000;
|
||||
const PORT = process.env.PORT || 15002;
|
||||
|
||||
// Auto-detect frontend dist path
|
||||
let FRONTEND_DIST = process.env.FRONTEND_DIST;
|
||||
@@ -26,7 +26,7 @@ if (!FRONTEND_DIST) {
|
||||
path.join(__dirname, '../public'),
|
||||
path.join(__dirname, '../../frontend/dist')
|
||||
];
|
||||
|
||||
|
||||
for (const p of possiblePaths) {
|
||||
if (require('fs').existsSync(p)) {
|
||||
FRONTEND_DIST = p;
|
||||
@@ -34,7 +34,7 @@ if (!FRONTEND_DIST) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!FRONTEND_DIST) {
|
||||
console.log('⚠️ Frontend not found, tried:', possiblePaths);
|
||||
}
|
||||
@@ -49,7 +49,6 @@ const libraryRouter = require('./routes/library');
|
||||
const imageRouter = require('./routes/image');
|
||||
const scanRouter = require('./routes/scan');
|
||||
const watchRouter = require('./routes/watch');
|
||||
|
||||
app.use('/api/library', libraryRouter);
|
||||
app.use('/api/image', imageRouter);
|
||||
app.use('/api/scan', scanRouter);
|
||||
@@ -83,11 +82,110 @@ app.set('fileWatcher', fileWatcher);
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`🚀 FlyPic server running on http://localhost:${PORT}`);
|
||||
|
||||
// 只为当前选中的素材库启动文件监控和快速同步
|
||||
const { loadConfig } = require('./utils/config');
|
||||
const config = loadConfig();
|
||||
const currentLibraryId = config.currentLibraryId;
|
||||
const currentLibrary = config.libraries.find(lib => lib.id === currentLibraryId);
|
||||
|
||||
if (currentLibrary) {
|
||||
console.log(`📡 启动当前素材库监控: ${currentLibrary.name}`);
|
||||
|
||||
// 启动文件监控
|
||||
try {
|
||||
fileWatcher.watch(currentLibrary.id, io);
|
||||
console.log(` ✅ 文件监控已启动`);
|
||||
} catch (err) {
|
||||
console.log(` ❌ 文件监控失败: ${err.message}`);
|
||||
}
|
||||
|
||||
// 快速同步检测离线变化
|
||||
console.log('🔄 检测离线期间的文件变化...');
|
||||
const { quickSync } = require('./utils/scanner');
|
||||
const dbPool = require('./database/dbPool');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const db = dbPool.acquire(currentLibrary.path);
|
||||
const results = await quickSync(currentLibrary.path, db);
|
||||
dbPool.release(currentLibrary.path);
|
||||
|
||||
const changes = results.added + results.deleted;
|
||||
if (changes > 0) {
|
||||
console.log(` 📊 ${currentLibrary.name}: +${results.added} -${results.deleted}`);
|
||||
io.emit('scanComplete', { libraryId: currentLibrary.id, results });
|
||||
} else {
|
||||
console.log(` ✅ ${currentLibrary.name}: 无变化`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(` ❌ ${currentLibrary.name}: ${err.message}`);
|
||||
}
|
||||
console.log('✅ 启动检查完成');
|
||||
})();
|
||||
} else {
|
||||
console.log('📭 未选中素材库,等待用户操作...');
|
||||
}
|
||||
});
|
||||
|
||||
// Cleanup on exit
|
||||
process.on('SIGINT', () => {
|
||||
console.log('\nShutting down...');
|
||||
fileWatcher.unwatchAll();
|
||||
process.exit(0);
|
||||
// Graceful shutdown - 优雅关闭,释放所有资源
|
||||
const gracefulShutdown = (signal) => {
|
||||
console.log(`\n🛑 Received ${signal}, shutting down gracefully...`);
|
||||
|
||||
try {
|
||||
// 1. 停止所有文件监控
|
||||
console.log('📡 Stopping file watchers...');
|
||||
fileWatcher.unwatchAll();
|
||||
|
||||
// 2. 关闭所有数据库连接
|
||||
console.log('💾 Closing database connections...');
|
||||
const dbPool = require('./database/dbPool');
|
||||
dbPool.closeAll();
|
||||
|
||||
// 3. 关闭 HTTP 服务器
|
||||
console.log('🌐 Closing HTTP server...');
|
||||
server.close(() => {
|
||||
console.log('✅ All resources released, goodbye!');
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// 如果10秒内没有正常关闭,强制退出
|
||||
setTimeout(() => {
|
||||
console.error('⚠️ Forced shutdown after timeout');
|
||||
process.exit(1);
|
||||
}, 10000);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error during shutdown:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
// 监听各种退出信号
|
||||
process.on('SIGINT', () => gracefulShutdown('SIGINT')); // Ctrl+C
|
||||
process.on('SIGTERM', () => gracefulShutdown('SIGTERM')); // kill
|
||||
process.on('SIGHUP', () => gracefulShutdown('SIGHUP')); // 终端关闭
|
||||
|
||||
// Windows 特殊处理(Ctrl+C)
|
||||
if (process.platform === 'win32') {
|
||||
const readline = require('readline');
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
rl.on('SIGINT', () => {
|
||||
process.emit('SIGINT');
|
||||
});
|
||||
}
|
||||
|
||||
// 捕获未处理的异常
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.error('❌ Uncaught Exception:', error);
|
||||
gracefulShutdown('uncaughtException');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.error('❌ Unhandled Rejection at:', promise, 'reason:', reason);
|
||||
gracefulShutdown('unhandledRejection');
|
||||
});
|
||||
@@ -2,6 +2,11 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
|
||||
// 配置缓存
|
||||
let configCache = null;
|
||||
let configCacheTime = 0;
|
||||
const CONFIG_CACHE_TTL = 5000; // 5秒缓存
|
||||
|
||||
/**
|
||||
* Get config directory based on environment
|
||||
*/
|
||||
@@ -34,7 +39,13 @@ function getConfigPath() {
|
||||
/**
|
||||
* Load configuration
|
||||
*/
|
||||
function loadConfig() {
|
||||
function loadConfig(forceReload = false) {
|
||||
// 检查缓存是否有效
|
||||
const now = Date.now();
|
||||
if (!forceReload && configCache && (now - configCacheTime) < CONFIG_CACHE_TTL) {
|
||||
return configCache;
|
||||
}
|
||||
|
||||
const configPath = getConfigPath();
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
@@ -68,6 +79,10 @@ function loadConfig() {
|
||||
};
|
||||
}
|
||||
|
||||
// 更新缓存
|
||||
configCache = config;
|
||||
configCacheTime = now;
|
||||
|
||||
return config;
|
||||
} catch (error) {
|
||||
console.error('Error loading config:', error);
|
||||
@@ -91,6 +106,9 @@ function saveConfig(config) {
|
||||
const configPath = getConfigPath();
|
||||
try {
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
|
||||
// 同步更新缓存
|
||||
configCache = config;
|
||||
configCacheTime = Date.now();
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error saving config:', error);
|
||||
@@ -98,6 +116,14 @@ function saveConfig(config) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除配置缓存(用于强制重新加载)
|
||||
*/
|
||||
function clearConfigCache() {
|
||||
configCache = null;
|
||||
configCacheTime = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add library to config
|
||||
*/
|
||||
@@ -195,6 +221,7 @@ module.exports = {
|
||||
getConfigPath,
|
||||
loadConfig,
|
||||
saveConfig,
|
||||
clearConfigCache,
|
||||
addLibrary,
|
||||
removeLibrary,
|
||||
updateLibrary,
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
const chokidar = require('chokidar');
|
||||
const { Worker } = require('worker_threads');
|
||||
const path = require('path');
|
||||
const { getLibrary } = require('./config');
|
||||
const { syncLibrary, applyChangesFromEvents } = require('./scanner');
|
||||
const { applyChangesFromEvents } = require('./scanner');
|
||||
const dbPool = require('../database/dbPool');
|
||||
|
||||
class FileWatcher {
|
||||
constructor() {
|
||||
this.watchers = new Map(); // libraryId -> watcher
|
||||
this.workers = new Map(); // libraryId -> Worker
|
||||
this.debounceTimers = new Map(); // libraryId -> { timer, forceRebuildFolders }
|
||||
this.changeBuffers = new Map(); // libraryId -> { filesAdded, filesChanged, filesRemoved, dirsAdded, dirsRemoved }
|
||||
this.ioRef = null; // Socket.IO 引用
|
||||
}
|
||||
|
||||
// 获取或创建变更缓冲区
|
||||
@@ -36,10 +37,13 @@ class FileWatcher {
|
||||
);
|
||||
}
|
||||
|
||||
// 启动监控
|
||||
// 启动监控(使用 Worker Thread,不阻塞主线程)
|
||||
watch(libraryId, io) {
|
||||
// 保存 io 引用
|
||||
this.ioRef = io;
|
||||
|
||||
// 如果已经在监控,先停止
|
||||
if (this.watchers.has(libraryId)) {
|
||||
if (this.workers.has(libraryId)) {
|
||||
this.unwatch(libraryId);
|
||||
}
|
||||
|
||||
@@ -54,143 +58,151 @@ class FileWatcher {
|
||||
try {
|
||||
fs.accessSync(library.path, fs.constants.R_OK);
|
||||
} catch (error) {
|
||||
console.error(`Cannot access library path: ${library.path}`, error.message);
|
||||
console.error('提示:在飞牛 fnOS 上,请确保在应用设置中授予了文件夹访问权限');
|
||||
return;
|
||||
const errorMsg = `Cannot access library path: ${library.path} - ${error.message}`;
|
||||
console.error(errorMsg);
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
console.log(`Starting file watcher for library: ${library.name} (${library.path})`);
|
||||
console.log(`[FileWatcher] Starting worker for: ${library.name} (${library.path})`);
|
||||
|
||||
// 支持的图片格式
|
||||
const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff'];
|
||||
const pattern = `**/*.{${imageExtensions.join(',')}}`;
|
||||
|
||||
// 创建监控器(监控文件和文件夹)
|
||||
const watcher = chokidar.watch([pattern, '**/'], {
|
||||
cwd: library.path,
|
||||
ignored: [
|
||||
'**/node_modules/**',
|
||||
'**/.git/**',
|
||||
'**/.flypic/**', // 忽略自己的缓存目录
|
||||
'**/.*' // 忽略隐藏文件
|
||||
],
|
||||
persistent: true,
|
||||
ignoreInitial: true, // 忽略初始扫描
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 1200, // 文件稳定 1.2 秒后触发,提升响应
|
||||
pollInterval: 100
|
||||
// 创建 Worker Thread
|
||||
const workerPath = path.join(__dirname, 'fileWatcherWorker.js');
|
||||
const worker = new Worker(workerPath, {
|
||||
workerData: {
|
||||
libraryPath: library.path,
|
||||
libraryName: library.name
|
||||
}
|
||||
});
|
||||
|
||||
// 防抖处理:多个文件变化合并为一次同步(自适应时长)
|
||||
const debouncedSync = (forceRebuildFolders = false) => {
|
||||
const buf = this._getBuffer(libraryId);
|
||||
const changeCount = this._bufferCount(buf);
|
||||
// 处理 Worker 消息
|
||||
worker.on('message', (msg) => {
|
||||
this._handleWorkerMessage(libraryId, library, msg);
|
||||
});
|
||||
|
||||
// 清除之前的定时器
|
||||
if (this.debounceTimers.has(libraryId)) {
|
||||
const oldTimer = this.debounceTimers.get(libraryId);
|
||||
clearTimeout(oldTimer.timer);
|
||||
// 聚合 forceRebuildFolders 标记
|
||||
forceRebuildFolders = forceRebuildFolders || oldTimer.forceRebuildFolders;
|
||||
worker.on('error', (error) => {
|
||||
console.error(`[FileWatcher] Worker error for ${library.name}:`, error);
|
||||
});
|
||||
|
||||
worker.on('exit', (code) => {
|
||||
if (code !== 0) {
|
||||
console.error(`[FileWatcher] Worker exited with code ${code} for ${library.name}`);
|
||||
}
|
||||
this.workers.delete(libraryId);
|
||||
});
|
||||
|
||||
// 自适应防抖时间:少量变化更快响应
|
||||
let debounceMs = 5000;
|
||||
if (changeCount <= 1) debounceMs = 1200;
|
||||
else if (changeCount <= 10) debounceMs = 2000;
|
||||
else if (changeCount <= 50) debounceMs = 3500;
|
||||
else if (changeCount <= 200) debounceMs = 5000;
|
||||
else debounceMs = 8000; // 超大批量进一步聚合
|
||||
this.workers.set(libraryId, worker);
|
||||
}
|
||||
|
||||
const timer = setTimeout(async () => {
|
||||
const snapshot = this._getBuffer(libraryId);
|
||||
// 清空缓冲区(开始新一轮累计)
|
||||
this.changeBuffers.set(libraryId, {
|
||||
filesAdded: new Set(),
|
||||
filesChanged: new Set(),
|
||||
filesRemoved: new Set(),
|
||||
dirsAdded: new Set(),
|
||||
dirsRemoved: new Set()
|
||||
});
|
||||
// 处理 Worker 发来的消息
|
||||
_handleWorkerMessage(libraryId, library, msg) {
|
||||
switch (msg.type) {
|
||||
case 'add':
|
||||
this._getBuffer(libraryId).filesAdded.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'unlink':
|
||||
this._getBuffer(libraryId).filesRemoved.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'change':
|
||||
this._getBuffer(libraryId).filesChanged.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'addDir':
|
||||
this._getBuffer(libraryId).dirsAdded.add(msg.path);
|
||||
this._debouncedSync(libraryId, library, true);
|
||||
break;
|
||||
case 'unlinkDir':
|
||||
this._getBuffer(libraryId).dirsRemoved.add(msg.path);
|
||||
this._debouncedSync(libraryId, library, true);
|
||||
break;
|
||||
case 'ready':
|
||||
console.log(`[FileWatcher] Ready for: ${library.name}`);
|
||||
break;
|
||||
case 'error':
|
||||
console.error(`[FileWatcher] Error for ${library.name}:`, msg.message);
|
||||
break;
|
||||
case 'closed':
|
||||
console.log(`[FileWatcher] Closed for: ${library.name}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 从连接池获取数据库连接
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
try {
|
||||
const total = this._bufferCount(snapshot);
|
||||
let results;
|
||||
// 防抖同步
|
||||
_debouncedSync(libraryId, library, forceRebuildFolders = false) {
|
||||
const buf = this._getBuffer(libraryId);
|
||||
const changeCount = this._bufferCount(buf);
|
||||
|
||||
if (forceRebuildFolders || total > 200) {
|
||||
// 大量变化或目录级变化:走增量全量路径(更稳)
|
||||
results = await syncLibrary(library.path, db, true);
|
||||
} else {
|
||||
// 小批量变化:基于事件的快速同步
|
||||
results = await applyChangesFromEvents(library.path, db, {
|
||||
filesAdded: Array.from(snapshot.filesAdded),
|
||||
filesChanged: Array.from(snapshot.filesChanged),
|
||||
filesRemoved: Array.from(snapshot.filesRemoved),
|
||||
dirsAdded: Array.from(snapshot.dirsAdded),
|
||||
dirsRemoved: Array.from(snapshot.dirsRemoved)
|
||||
});
|
||||
}
|
||||
// 清除之前的定时器
|
||||
if (this.debounceTimers.has(libraryId)) {
|
||||
const oldTimer = this.debounceTimers.get(libraryId);
|
||||
clearTimeout(oldTimer.timer);
|
||||
forceRebuildFolders = forceRebuildFolders || oldTimer.forceRebuildFolders;
|
||||
}
|
||||
|
||||
// 通过 Socket.IO 通知前端
|
||||
io.emit('scanComplete', { libraryId, results });
|
||||
console.log(`Sync complete for ${library.name}:`, results);
|
||||
} catch (error) {
|
||||
console.error(`Sync error for ${library.name}:`, error);
|
||||
io.emit('scanError', { libraryId, error: error.message });
|
||||
} finally {
|
||||
// 释放数据库连接(不关闭,复用)
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
// 自适应防抖时间
|
||||
let debounceMs = 2000;
|
||||
if (changeCount <= 1) debounceMs = 800;
|
||||
else if (changeCount <= 5) debounceMs = 1000;
|
||||
else if (changeCount <= 20) debounceMs = 1500;
|
||||
else if (changeCount <= 100) debounceMs = 2000;
|
||||
else debounceMs = 3000;
|
||||
|
||||
this.debounceTimers.delete(libraryId);
|
||||
}, debounceMs);
|
||||
|
||||
this.debounceTimers.set(libraryId, { timer, forceRebuildFolders });
|
||||
};
|
||||
|
||||
// 监听文件和文件夹变化(写入缓冲,统一合并处理)
|
||||
watcher
|
||||
.on('add', (filePath) => {
|
||||
this._getBuffer(libraryId).filesAdded.add(filePath);
|
||||
debouncedSync();
|
||||
})
|
||||
.on('unlink', (filePath) => {
|
||||
this._getBuffer(libraryId).filesRemoved.add(filePath);
|
||||
debouncedSync();
|
||||
})
|
||||
.on('change', (filePath) => {
|
||||
this._getBuffer(libraryId).filesChanged.add(filePath);
|
||||
debouncedSync();
|
||||
})
|
||||
.on('addDir', (dirPath) => {
|
||||
this._getBuffer(libraryId).dirsAdded.add(dirPath);
|
||||
debouncedSync(true); // 强制重建文件夹结构
|
||||
})
|
||||
.on('unlinkDir', (dirPath) => {
|
||||
this._getBuffer(libraryId).dirsRemoved.add(dirPath);
|
||||
debouncedSync(true); // 强制重建文件夹结构
|
||||
})
|
||||
.on('error', (error) => {
|
||||
console.error(`Watcher error for ${library.name}:`, error);
|
||||
})
|
||||
.on('ready', () => {
|
||||
console.log(`File watcher ready for: ${library.name}`);
|
||||
const timer = setTimeout(async () => {
|
||||
const snapshot = this._getBuffer(libraryId);
|
||||
// 清空缓冲区
|
||||
this.changeBuffers.set(libraryId, {
|
||||
filesAdded: new Set(),
|
||||
filesChanged: new Set(),
|
||||
filesRemoved: new Set(),
|
||||
dirsAdded: new Set(),
|
||||
dirsRemoved: new Set()
|
||||
});
|
||||
|
||||
this.watchers.set(libraryId, watcher);
|
||||
const db = dbPool.acquire(library.path);
|
||||
|
||||
try {
|
||||
const results = await applyChangesFromEvents(library.path, db, {
|
||||
filesAdded: Array.from(snapshot.filesAdded),
|
||||
filesChanged: Array.from(snapshot.filesChanged),
|
||||
filesRemoved: Array.from(snapshot.filesRemoved),
|
||||
dirsAdded: Array.from(snapshot.dirsAdded),
|
||||
dirsRemoved: Array.from(snapshot.dirsRemoved)
|
||||
});
|
||||
|
||||
if (this.ioRef) {
|
||||
this.ioRef.emit('scanComplete', { libraryId, results });
|
||||
}
|
||||
console.log(`[FileWatcher] Sync complete for ${library.name}:`, results);
|
||||
} catch (error) {
|
||||
console.error(`[FileWatcher] Sync error for ${library.name}:`, error);
|
||||
if (this.ioRef) {
|
||||
this.ioRef.emit('scanError', { libraryId, error: error.message });
|
||||
}
|
||||
} finally {
|
||||
dbPool.release(library.path);
|
||||
}
|
||||
|
||||
this.debounceTimers.delete(libraryId);
|
||||
}, debounceMs);
|
||||
|
||||
this.debounceTimers.set(libraryId, { timer, forceRebuildFolders });
|
||||
}
|
||||
|
||||
// 停止监控
|
||||
unwatch(libraryId) {
|
||||
const watcher = this.watchers.get(libraryId);
|
||||
if (watcher) {
|
||||
watcher.close();
|
||||
this.watchers.delete(libraryId);
|
||||
console.log(`Stopped file watcher for library: ${libraryId}`);
|
||||
const worker = this.workers.get(libraryId);
|
||||
if (worker) {
|
||||
// 发送关闭命令给 Worker
|
||||
worker.postMessage({ type: 'close' });
|
||||
// 给 Worker 一些时间优雅关闭,然后强制终止
|
||||
setTimeout(() => {
|
||||
if (this.workers.has(libraryId)) {
|
||||
worker.terminate();
|
||||
this.workers.delete(libraryId);
|
||||
}
|
||||
}, 1000);
|
||||
console.log(`[FileWatcher] Stopping worker for: ${libraryId}`);
|
||||
}
|
||||
|
||||
// 清除防抖定时器
|
||||
@@ -208,19 +220,19 @@ class FileWatcher {
|
||||
|
||||
// 停止所有监控
|
||||
unwatchAll() {
|
||||
for (const libraryId of this.watchers.keys()) {
|
||||
for (const libraryId of this.workers.keys()) {
|
||||
this.unwatch(libraryId);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取监控状态
|
||||
isWatching(libraryId) {
|
||||
return this.watchers.has(libraryId);
|
||||
return this.workers.has(libraryId);
|
||||
}
|
||||
|
||||
// 获取所有正在监控的库
|
||||
getWatchedLibraries() {
|
||||
return Array.from(this.watchers.keys());
|
||||
return Array.from(this.workers.keys());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* File Watcher Worker - 在独立线程中运行 chokidar
|
||||
* 避免文件监控初始化阻塞主线程的事件循环
|
||||
*/
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const chokidar = require('chokidar');
|
||||
|
||||
const { libraryPath, libraryName } = workerData;
|
||||
|
||||
console.log(`[Worker] Starting chokidar for: ${libraryName}`);
|
||||
|
||||
// 创建监控器
|
||||
const watcher = chokidar.watch(['**/*.*', '**/'], {
|
||||
cwd: libraryPath,
|
||||
ignored: [
|
||||
'**/node_modules/**',
|
||||
'**/.git/**',
|
||||
'**/.flypic/**',
|
||||
'**/.*'
|
||||
],
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
usePolling: false,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 1000,
|
||||
pollInterval: 200
|
||||
}
|
||||
});
|
||||
|
||||
// 监听事件并发送到主线程
|
||||
watcher
|
||||
.on('add', (filePath) => {
|
||||
parentPort.postMessage({ type: 'add', path: filePath });
|
||||
})
|
||||
.on('unlink', (filePath) => {
|
||||
parentPort.postMessage({ type: 'unlink', path: filePath });
|
||||
})
|
||||
.on('change', (filePath) => {
|
||||
parentPort.postMessage({ type: 'change', path: filePath });
|
||||
})
|
||||
.on('addDir', (dirPath) => {
|
||||
parentPort.postMessage({ type: 'addDir', path: dirPath });
|
||||
})
|
||||
.on('unlinkDir', (dirPath) => {
|
||||
parentPort.postMessage({ type: 'unlinkDir', path: dirPath });
|
||||
})
|
||||
.on('error', (error) => {
|
||||
parentPort.postMessage({ type: 'error', message: error.message });
|
||||
})
|
||||
.on('ready', () => {
|
||||
console.log(`[Worker] File watcher ready for: ${libraryName}`);
|
||||
parentPort.postMessage({ type: 'ready' });
|
||||
});
|
||||
|
||||
// 监听主线程的关闭命令
|
||||
parentPort.on('message', (msg) => {
|
||||
if (msg.type === 'close') {
|
||||
console.log(`[Worker] Closing watcher for: ${libraryName}`);
|
||||
watcher.close().then(() => {
|
||||
parentPort.postMessage({ type: 'closed' });
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,245 @@
|
||||
/**
|
||||
* 扫描状态管理器
|
||||
* 支持扫描的停止、继续和持久化
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
class ScanManager {
|
||||
constructor() {
|
||||
// 每个素材库的扫描状态(内存)
|
||||
this.scanStates = new Map();
|
||||
// 素材库路径映射(用于持久化)
|
||||
this.libraryPaths = new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册素材库路径(用于持久化)
|
||||
*/
|
||||
registerLibraryPath(libraryId, libraryPath) {
|
||||
this.libraryPaths.set(libraryId, libraryPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态文件路径
|
||||
*/
|
||||
getStateFilePath(libraryId) {
|
||||
const libraryPath = this.libraryPaths.get(libraryId);
|
||||
if (!libraryPath) return null;
|
||||
return path.join(libraryPath, '.flypic', 'scan-state.json');
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存状态到文件(轻量:只保存关键信息)
|
||||
*/
|
||||
saveState(libraryId) {
|
||||
const stateFile = this.getStateFilePath(libraryId);
|
||||
if (!stateFile) return;
|
||||
|
||||
const state = this.scanStates.get(libraryId);
|
||||
if (!state || state.status === 'idle') {
|
||||
// 删除状态文件
|
||||
try {
|
||||
if (fs.existsSync(stateFile)) {
|
||||
fs.unlinkSync(stateFile);
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const saveData = {
|
||||
status: state.status,
|
||||
progress: state.progress,
|
||||
pendingCount: state.pendingFiles?.length || 0,
|
||||
// 只保存文件相对路径,不保存完整路径列表(太大)
|
||||
savedAt: Date.now()
|
||||
};
|
||||
fs.writeFileSync(stateFile, JSON.stringify(saveData, null, 2));
|
||||
} catch (e) {
|
||||
console.error('Failed to save scan state:', e.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从文件加载状态
|
||||
*/
|
||||
loadState(libraryId) {
|
||||
const stateFile = this.getStateFilePath(libraryId);
|
||||
if (!stateFile || !fs.existsSync(stateFile)) return null;
|
||||
|
||||
try {
|
||||
const data = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
|
||||
// 状态超过 24 小时视为过期
|
||||
if (Date.now() - data.savedAt > 24 * 60 * 60 * 1000) {
|
||||
fs.unlinkSync(stateFile);
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取扫描状态(优先内存,其次文件)
|
||||
*/
|
||||
getState(libraryId) {
|
||||
// 先检查内存中的状态
|
||||
const memState = this.scanStates.get(libraryId);
|
||||
if (memState) return memState;
|
||||
|
||||
// 尝试从文件加载(应用重启后的恢复)
|
||||
const fileState = this.loadState(libraryId);
|
||||
if (fileState && fileState.status === 'paused') {
|
||||
// 重建内存状态(不含 pendingFiles,需要重新扫描确定)
|
||||
const restored = {
|
||||
status: 'paused',
|
||||
progress: fileState.progress,
|
||||
pendingFiles: [], // 无法恢复完整列表,需要继续扫描时重新计算
|
||||
processedCount: fileState.progress?.current || 0,
|
||||
abortController: { aborted: true },
|
||||
needsRescan: true // 标记需要重新扫描
|
||||
};
|
||||
this.scanStates.set(libraryId, restored);
|
||||
return restored;
|
||||
}
|
||||
|
||||
return {
|
||||
status: 'idle',
|
||||
progress: null,
|
||||
pendingFiles: [],
|
||||
processedCount: 0
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始扫描
|
||||
*/
|
||||
startScan(libraryId, totalFiles) {
|
||||
this.scanStates.set(libraryId, {
|
||||
status: 'scanning',
|
||||
progress: { current: 0, total: totalFiles, percent: 0 },
|
||||
pendingFiles: [],
|
||||
processedCount: 0,
|
||||
abortController: { aborted: false }
|
||||
});
|
||||
return this.scanStates.get(libraryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新进度
|
||||
*/
|
||||
updateProgress(libraryId, current, total) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
if (state) {
|
||||
state.progress = {
|
||||
current,
|
||||
total,
|
||||
percent: Math.round((current / total) * 100)
|
||||
};
|
||||
state.processedCount = current;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止扫描
|
||||
*/
|
||||
stopScan(libraryId, pendingFiles = []) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
if (state) {
|
||||
state.status = 'paused';
|
||||
state.pendingFiles = pendingFiles;
|
||||
state.abortController.aborted = true;
|
||||
// 持久化状态
|
||||
this.saveState(libraryId);
|
||||
console.log(`⏸️ Scan paused for ${libraryId}, ${pendingFiles.length} files pending`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否应该停止
|
||||
*/
|
||||
shouldStop(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
return state?.abortController?.aborted || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待处理文件
|
||||
*/
|
||||
getPendingFiles(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
return state?.pendingFiles || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复扫描
|
||||
*/
|
||||
resumeScan(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
if (state && state.status === 'paused') {
|
||||
const pendingFiles = [...state.pendingFiles]; // 复制一份
|
||||
state.status = 'scanning';
|
||||
state.abortController = { aborted: false };
|
||||
state.pendingFiles = []; // 清空待处理列表
|
||||
console.log(`▶️ Scan resumed for ${libraryId}, ${pendingFiles.length} files to process`);
|
||||
return pendingFiles;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成扫描
|
||||
*/
|
||||
completeScan(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
if (state) {
|
||||
state.status = 'idle';
|
||||
state.pendingFiles = [];
|
||||
state.progress = null;
|
||||
}
|
||||
// 清除持久化状态
|
||||
this.saveState(libraryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在扫描
|
||||
*/
|
||||
isScanning(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
return state?.status === 'scanning';
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已暂停
|
||||
*/
|
||||
isPaused(libraryId) {
|
||||
const state = this.scanStates.get(libraryId);
|
||||
return state?.status === 'paused';
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除素材库状态(删除素材库时调用)
|
||||
*/
|
||||
clearState(libraryId) {
|
||||
this.scanStates.delete(libraryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有空闲状态(内存清理)
|
||||
*/
|
||||
cleanupIdleStates() {
|
||||
for (const [libraryId, state] of this.scanStates.entries()) {
|
||||
if (state.status === 'idle') {
|
||||
this.scanStates.delete(libraryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 单例
|
||||
const scanManager = new ScanManager();
|
||||
|
||||
module.exports = scanManager;
|
||||
+400
-122
@@ -1,20 +1,21 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { glob } = require('glob');
|
||||
const {
|
||||
isImageFile,
|
||||
calculateFileHash,
|
||||
getImageMetadata,
|
||||
generateImageThumbnails
|
||||
const {
|
||||
isImageFile,
|
||||
getFileType,
|
||||
calculateFileHash,
|
||||
getImageMetadata,
|
||||
generateImageThumbnails
|
||||
} = require('./thumbnail');
|
||||
const scanManager = require('./scanManager');
|
||||
|
||||
/**
|
||||
* Get all image files in a directory
|
||||
*/
|
||||
async function getAllImageFiles(libraryPath) {
|
||||
// 仅匹配常见图片扩展,避免遍历所有非图片文件,显著降低 IO
|
||||
const exts = '{jpg,jpeg,png,webp,gif,bmp,tiff}';
|
||||
const pattern = path.join(libraryPath, '**', `*.${exts}`).replace(/\\/g, '/');
|
||||
// 支持所有文件格式(使用通配符 *.*)
|
||||
const pattern = path.join(libraryPath, '**', '*.*').replace(/\\/g, '/');
|
||||
const files = await glob(pattern, {
|
||||
nodir: true,
|
||||
nocase: true, // 大小写不敏感(Windows/macOS)
|
||||
@@ -28,17 +29,17 @@ async function getAllImageFiles(libraryPath) {
|
||||
*/
|
||||
function ensureFolderChain(db, folderPath) {
|
||||
if (!folderPath || folderPath === '.' || folderPath === '') return;
|
||||
let current = folderPath;
|
||||
let current = folderPath.replace(/\\/g, '/');
|
||||
const visited = new Set();
|
||||
while (current && current !== '.' && !visited.has(current)) {
|
||||
visited.add(current);
|
||||
const parent = path.dirname(current);
|
||||
const name = path.basename(current);
|
||||
const parent = path.posix.dirname(current);
|
||||
const name = current.split('/').pop();
|
||||
const existing = db.getFolderByPath(current);
|
||||
if (!existing) {
|
||||
db.insertFolder({
|
||||
path: current,
|
||||
parent_path: parent === '.' ? '' : parent,
|
||||
parent_path: parent === '.' ? '' : (parent === current ? '' : parent),
|
||||
name,
|
||||
image_count: 0
|
||||
});
|
||||
@@ -60,8 +61,8 @@ function ensureFolderChain(db, folderPath) {
|
||||
*/
|
||||
async function applyChangesFromEvents(libraryPath, db, events) {
|
||||
try {
|
||||
// Normalize helper to OS-specific separators to match DB records
|
||||
const norm = (p) => path.normalize(p);
|
||||
// Normalize helper: 统一使用正斜杠,与数据库记录格式一致
|
||||
const norm = (p) => path.normalize(p).replace(/\\/g, '/');
|
||||
|
||||
const affectedFolders = new Set();
|
||||
const results = { added: 0, modified: 0, deleted: 0, foldersAdded: 0, foldersRemoved: 0 };
|
||||
@@ -86,13 +87,13 @@ async function applyChangesFromEvents(libraryPath, db, events) {
|
||||
try {
|
||||
const rel = norm(file);
|
||||
const full = path.join(libraryPath, rel);
|
||||
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!fs.existsSync(full)) {
|
||||
console.warn(`File not found, skipping: ${full}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const folder = path.dirname(rel);
|
||||
ensureFolderChain(db, folder);
|
||||
await processImage(full, libraryPath, db);
|
||||
@@ -116,13 +117,13 @@ async function applyChangesFromEvents(libraryPath, db, events) {
|
||||
try {
|
||||
const rel = norm(file);
|
||||
const full = path.join(libraryPath, rel);
|
||||
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!fs.existsSync(full)) {
|
||||
console.warn(`File not found, skipping: ${full}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
await processImage(full, libraryPath, db);
|
||||
const folder = path.dirname(rel);
|
||||
affectedFolders.add(folder);
|
||||
@@ -191,27 +192,29 @@ async function applyChangesFromEvents(libraryPath, db, events) {
|
||||
*/
|
||||
async function getFolderStructure(libraryPath) {
|
||||
const folders = [];
|
||||
|
||||
|
||||
function scanDir(dirPath, parentPath = '') {
|
||||
const items = fs.readdirSync(dirPath, { withFileTypes: true });
|
||||
|
||||
|
||||
for (const item of items) {
|
||||
if (item.isDirectory() && !item.name.startsWith('.')) {
|
||||
const fullPath = path.join(dirPath, item.name);
|
||||
const relativePath = path.relative(libraryPath, fullPath);
|
||||
|
||||
const relativePathUnix = relativePath.replace(/\\/g, '/');
|
||||
const parentUnix = (parentPath || '').replace(/\\/g, '/');
|
||||
|
||||
folders.push({
|
||||
path: relativePath,
|
||||
parent_path: parentPath,
|
||||
path: relativePathUnix,
|
||||
parent_path: parentUnix,
|
||||
name: item.name,
|
||||
image_count: 0
|
||||
});
|
||||
|
||||
scanDir(fullPath, relativePath);
|
||||
|
||||
scanDir(fullPath, relativePathUnix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scanDir(libraryPath);
|
||||
return folders;
|
||||
}
|
||||
@@ -219,46 +222,84 @@ async function getFolderStructure(libraryPath) {
|
||||
/**
|
||||
* Process a single image file
|
||||
*/
|
||||
async function processImage(imagePath, libraryPath, db) {
|
||||
/**
|
||||
* Process a single image file
|
||||
* @param {boolean} dryRun - If true, return data instead of inserting into DB (for batch write)
|
||||
*/
|
||||
async function processImage(imagePath, libraryPath, db, dryRun = false) {
|
||||
try {
|
||||
const relativePath = path.relative(libraryPath, imagePath);
|
||||
const filename = path.basename(imagePath);
|
||||
const folder = path.dirname(relativePath);
|
||||
|
||||
const folderRaw = path.dirname(relativePath);
|
||||
const folder = folderRaw === '.' ? '' : folderRaw.replace(/\\/g, '/');
|
||||
|
||||
// Check if image already exists in database
|
||||
const existing = db.getImageByPath(relativePath);
|
||||
const existing = db.getImageByPath(relativePath.replace(/\\/g, '/'));
|
||||
const currentHash = calculateFileHash(imagePath);
|
||||
|
||||
// Skip if file hasn't changed
|
||||
if (existing && existing.file_hash === currentHash) {
|
||||
|
||||
// For unchanged files, check whether thumbnails need upgrade/regeneration
|
||||
let needRegenThumbs = false;
|
||||
if (existing) {
|
||||
const flypicDir = path.join(libraryPath, '.flypic');
|
||||
const filenameOnly = (existing.thumbnail_path || '').replace(/\\/g, '/').split('/').pop();
|
||||
if (filenameOnly) {
|
||||
// Calculate sharded path
|
||||
const hash = filenameOnly.replace(/\.[^/.]+$/, ""); // remove extension
|
||||
const shard1 = hash.slice(0, 2);
|
||||
// New structure: .flypic/thumbnails/ab/hash.webp
|
||||
const expectedPath = path.join(flypicDir, 'thumbnails', shard1, filenameOnly);
|
||||
|
||||
// 需要重建的情况:新结构文件不存在
|
||||
if (!fs.existsSync(expectedPath)) {
|
||||
needRegenThumbs = true;
|
||||
}
|
||||
} else {
|
||||
needRegenThumbs = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip only if unchanged and thumbnails are up-to-date
|
||||
if (existing && existing.file_hash === currentHash && !needRegenThumbs) {
|
||||
return { status: 'skipped', path: relativePath };
|
||||
}
|
||||
|
||||
|
||||
// Get image metadata
|
||||
const metadata = await getImageMetadata(imagePath);
|
||||
if (!metadata) {
|
||||
return { status: 'error', path: relativePath, error: 'Failed to read metadata' };
|
||||
}
|
||||
|
||||
// Generate thumbnails
|
||||
|
||||
// Generate thumbnails (also for unchanged files when thumbnails missing/outdated)
|
||||
const thumbnails = await generateImageThumbnails(imagePath, libraryPath);
|
||||
|
||||
// Insert/update in database
|
||||
db.insertImage({
|
||||
path: relativePath,
|
||||
const fileType = getFileType(imagePath);
|
||||
|
||||
// 使用缩略图的实际尺寸(对于视频/PSD,这是提取后的真实尺寸)
|
||||
const actualWidth = thumbnails.width || metadata.width;
|
||||
const actualHeight = thumbnails.height || metadata.height;
|
||||
|
||||
const imageData = {
|
||||
path: relativePath.replace(/\\/g, '/'),
|
||||
filename: filename,
|
||||
folder: folder,
|
||||
size: metadata.size,
|
||||
width: metadata.width,
|
||||
height: metadata.height,
|
||||
width: actualWidth,
|
||||
height: actualHeight,
|
||||
format: metadata.format,
|
||||
file_type: fileType,
|
||||
created_at: Math.floor(metadata.created_at),
|
||||
modified_at: Math.floor(metadata.modified_at),
|
||||
file_hash: currentHash,
|
||||
thumbnail_path: thumbnails.thumbnail_path,
|
||||
thumbnail_size: thumbnails.thumbnail_size
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
if (dryRun) {
|
||||
return { status: 'processed', path: relativePath, data: imageData };
|
||||
}
|
||||
|
||||
// Insert/update in database
|
||||
db.insertImage(imageData);
|
||||
|
||||
return { status: 'processed', path: relativePath };
|
||||
} catch (error) {
|
||||
console.error('Error processing image:', imagePath, error);
|
||||
@@ -268,60 +309,197 @@ async function processImage(imagePath, libraryPath, db) {
|
||||
|
||||
/**
|
||||
* Scan library and update database
|
||||
* @param {string} libraryPath - 素材库路径
|
||||
* @param {object} db - 数据库实例
|
||||
* @param {function} onProgress - 进度回调
|
||||
* @param {string} libraryId - 素材库ID(用于停止控制)
|
||||
* @param {Array} resumeFiles - 继续扫描时的待处理文件列表
|
||||
*/
|
||||
async function scanLibrary(libraryPath, db, onProgress) {
|
||||
/**
|
||||
* Scan library and update database
|
||||
* @param {string} libraryPath - 素材库路径
|
||||
* @param {object} db - 数据库实例
|
||||
* @param {function} onProgress - 进度回调
|
||||
* @param {string} libraryId - 素材库ID(用于停止控制)
|
||||
* @param {Array} resumeFiles - 继续扫描时的待处理文件列表
|
||||
*/
|
||||
async function scanLibrary(libraryPath, db, onProgress, libraryId = null, resumeFiles = null) {
|
||||
try {
|
||||
// Get all image files
|
||||
const files = await getAllImageFiles(libraryPath);
|
||||
let files;
|
||||
|
||||
// 动态导入 p-limit
|
||||
const pLimit = (await import('p-limit')).default;
|
||||
|
||||
// 根据 CPU 核心数动态调整并发数
|
||||
const os = require('os');
|
||||
const cpuCount = os.cpus().length;
|
||||
// 默认并发数:核心数 - 1,最小 4,最大 16
|
||||
const concurrency = Math.max(4, Math.min(16, cpuCount - 1));
|
||||
const limit = pLimit(concurrency);
|
||||
|
||||
console.log(`🚀 Starting scan with concurrency: ${concurrency} (CPU cores: ${cpuCount})`);
|
||||
|
||||
if (resumeFiles && resumeFiles.length > 0) {
|
||||
// 继续扫描:使用待处理文件列表
|
||||
files = resumeFiles;
|
||||
console.log(`▶️ Resuming scan with ${files.length} pending files`);
|
||||
} else {
|
||||
// 新扫描:获取所有文件
|
||||
files = await getAllImageFiles(libraryPath);
|
||||
console.log(`Found ${files.length} images in library`);
|
||||
|
||||
// Get folder structure
|
||||
const folders = await getFolderStructure(libraryPath);
|
||||
// 使用事务批量插入文件夹
|
||||
const insertFolders = db.db.transaction((folders) => {
|
||||
for (const folder of folders) db.insertFolder(folder);
|
||||
});
|
||||
insertFolders(folders);
|
||||
}
|
||||
|
||||
const total = files.length;
|
||||
|
||||
console.log(`Found ${total} images in library`);
|
||||
|
||||
// Get folder structure
|
||||
const folders = await getFolderStructure(libraryPath);
|
||||
folders.forEach(folder => db.insertFolder(folder));
|
||||
|
||||
// Process images in batches
|
||||
const batchSize = 50;
|
||||
|
||||
// 初始化扫描状态
|
||||
if (libraryId) {
|
||||
scanManager.startScan(libraryId, total);
|
||||
}
|
||||
|
||||
const results = {
|
||||
processed: 0,
|
||||
skipped: 0,
|
||||
errors: 0
|
||||
errors: 0,
|
||||
stopped: false
|
||||
};
|
||||
|
||||
for (let i = 0; i < files.length; i += batchSize) {
|
||||
const batch = files.slice(i, i + batchSize);
|
||||
|
||||
await Promise.all(
|
||||
batch.map(file => processImage(file, libraryPath, db))
|
||||
).then(batchResults => {
|
||||
batchResults.forEach(result => {
|
||||
if (result.status === 'processed') results.processed++;
|
||||
else if (result.status === 'skipped') results.skipped++;
|
||||
else if (result.status === 'error') results.errors++;
|
||||
});
|
||||
});
|
||||
|
||||
// Report progress
|
||||
if (onProgress) {
|
||||
onProgress({
|
||||
total,
|
||||
current: Math.min(i + batchSize, total),
|
||||
percent: Math.round((Math.min(i + batchSize, total) / total) * 100),
|
||||
currentFile: batch[batch.length - 1]
|
||||
});
|
||||
|
||||
const startTime = Date.now();
|
||||
let processedCount = 0;
|
||||
|
||||
// 批量写入缓冲区
|
||||
let writeBuffer = [];
|
||||
const WRITE_BATCH_SIZE = 100; // 每 100 条写入一次数据库
|
||||
|
||||
// 批量写入函数(事务)
|
||||
const batchWrite = db.db.transaction((items) => {
|
||||
for (const item of items) {
|
||||
if (item.status === 'processed' && item.data) {
|
||||
db.insertImage(item.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update folder image counts
|
||||
folders.forEach(folder => {
|
||||
db.updateFolderImageCount(folder.path);
|
||||
});
|
||||
|
||||
|
||||
// 处理单个文件的包装函数
|
||||
const processFile = async (file) => {
|
||||
// 检查是否需要停止
|
||||
if (libraryId && scanManager.shouldStop(libraryId)) {
|
||||
return { status: 'stopped', file };
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await processImage(file, libraryPath, db, true); // true = dryRun (不直接写入DB)
|
||||
return result;
|
||||
} catch (error) {
|
||||
return { status: 'error', path: file, error: error.message };
|
||||
}
|
||||
};
|
||||
|
||||
// 创建所有任务
|
||||
const tasks = files.map(file => limit(async () => {
|
||||
// 如果已经停止,直接返回
|
||||
if (results.stopped) return;
|
||||
|
||||
const result = await processFile(file);
|
||||
|
||||
if (result.status === 'stopped') {
|
||||
results.stopped = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新统计
|
||||
if (result.status === 'processed') results.processed++;
|
||||
else if (result.status === 'skipped') results.skipped++;
|
||||
else if (result.status === 'error') results.errors++;
|
||||
|
||||
// 添加到写入缓冲区
|
||||
if (result.status === 'processed') {
|
||||
writeBuffer.push(result);
|
||||
|
||||
// 缓冲区满,执行批量写入
|
||||
if (writeBuffer.length >= WRITE_BATCH_SIZE) {
|
||||
batchWrite(writeBuffer);
|
||||
writeBuffer = [];
|
||||
}
|
||||
}
|
||||
|
||||
processedCount++;
|
||||
|
||||
// 报告进度 (每完成 10 个文件报告一次,避免过于频繁)
|
||||
if (processedCount % 10 === 0 || processedCount === total) {
|
||||
const current = processedCount;
|
||||
|
||||
if (libraryId) {
|
||||
scanManager.updateProgress(libraryId, current, total);
|
||||
}
|
||||
|
||||
if (onProgress) {
|
||||
const elapsed = Date.now() - startTime;
|
||||
const avgTimePerImage = elapsed / current;
|
||||
const remaining = total - current;
|
||||
const estimatedTimeLeft = Math.round((remaining * avgTimePerImage) / 1000);
|
||||
|
||||
onProgress({
|
||||
total,
|
||||
current,
|
||||
percent: Math.round((current / total) * 100),
|
||||
currentFile: file,
|
||||
estimatedTimeLeft,
|
||||
canStop: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 性能日志
|
||||
if (processedCount > 0 && processedCount % 1000 === 0) {
|
||||
const elapsed = (Date.now() - startTime) / 1000;
|
||||
const speed = processedCount / elapsed;
|
||||
console.log(`⚡ Performance: ${speed.toFixed(1)} images/sec, ${processedCount}/${total} completed`);
|
||||
}
|
||||
}));
|
||||
|
||||
// 等待所有任务完成
|
||||
await Promise.all(tasks);
|
||||
|
||||
// 写入剩余的缓冲区数据
|
||||
if (writeBuffer.length > 0) {
|
||||
batchWrite(writeBuffer);
|
||||
writeBuffer = [];
|
||||
}
|
||||
|
||||
// 处理停止情况
|
||||
if (results.stopped) {
|
||||
const pendingFiles = files.slice(processedCount);
|
||||
scanManager.stopScan(libraryId, pendingFiles);
|
||||
console.log(`⏸️ Scan stopped at ${processedCount}/${total}, ${pendingFiles.length} files pending`);
|
||||
return results;
|
||||
}
|
||||
|
||||
const totalTime = (Date.now() - startTime) / 1000;
|
||||
console.log(`✅ Scan completed in ${totalTime.toFixed(1)}s, speed: ${(total / totalTime).toFixed(1)} images/sec`);
|
||||
|
||||
// Update folder image counts
|
||||
db.updateAllFolderCounts();
|
||||
|
||||
// 标记扫描完成
|
||||
if (libraryId) {
|
||||
scanManager.completeScan(libraryId);
|
||||
}
|
||||
|
||||
console.log('Scan complete:', results);
|
||||
return results;
|
||||
} catch (error) {
|
||||
console.error('Error scanning library:', error);
|
||||
if (libraryId) {
|
||||
scanManager.completeScan(libraryId);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -329,84 +507,118 @@ async function scanLibrary(libraryPath, db, onProgress) {
|
||||
/**
|
||||
* Sync library (incremental scan)
|
||||
*/
|
||||
async function syncLibrary(libraryPath, db, forceRebuildFolders = false) {
|
||||
async function syncLibrary(libraryPath, db, forceRebuildFolders = false, onProgress = null) {
|
||||
try {
|
||||
// Get all current files
|
||||
const startTime = Date.now();
|
||||
|
||||
// Get all current files (统一使用正斜杠)
|
||||
const currentFiles = await getAllImageFiles(libraryPath);
|
||||
const currentPaths = new Set(
|
||||
currentFiles.map(file => path.relative(libraryPath, file))
|
||||
currentFiles.map(file => path.relative(libraryPath, file).replace(/\\/g, '/'))
|
||||
);
|
||||
|
||||
// Get database files
|
||||
|
||||
// Get database files (已经是正斜杠格式)
|
||||
const dbImages = db.getAllImages();
|
||||
const dbPaths = new Set(dbImages.map(img => img.path));
|
||||
|
||||
const dbPaths = new Set(dbImages.map(img => (img.path || '').replace(/\\/g, '/')));
|
||||
|
||||
// Find new, modified, and deleted files
|
||||
const toAdd = [...currentPaths].filter(p => !dbPaths.has(p));
|
||||
const toCheck = [...currentPaths].filter(p => dbPaths.has(p));
|
||||
const toDelete = [...dbPaths].filter(p => !currentPaths.has(p));
|
||||
|
||||
let toDelete = [...dbPaths].filter(p => !currentPaths.has(p));
|
||||
|
||||
console.log(`Sync: ${toAdd.length} new, ${toCheck.length} to check, ${toDelete.length} deleted`);
|
||||
|
||||
// Process new files
|
||||
for (const relativePath of toAdd) {
|
||||
const fullPath = path.join(libraryPath, relativePath);
|
||||
await processImage(fullPath, libraryPath, db);
|
||||
|
||||
// 安全检查:如果要删除的文件数量超过数据库中文件的50%,可能是路径匹配问题
|
||||
if (toDelete.length > 0 && dbImages.length > 0) {
|
||||
const deleteRatio = toDelete.length / dbImages.length;
|
||||
if (deleteRatio > 0.5 && toDelete.length > 10) {
|
||||
console.warn(`⚠️ 安全检查:要删除 ${toDelete.length}/${dbImages.length} (${(deleteRatio * 100).toFixed(1)}%) 的文件,这可能是路径匹配问题,跳过删除操作`);
|
||||
console.log('示例 currentPath:', [...currentPaths].slice(0, 3));
|
||||
console.log('示例 dbPath:', [...dbPaths].slice(0, 3));
|
||||
// 清空 toDelete,不执行删除
|
||||
toDelete = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Check modified files
|
||||
for (const relativePath of toCheck) {
|
||||
|
||||
const total = toAdd.length + toDelete.length;
|
||||
let processed = 0;
|
||||
|
||||
// Process new files in batches
|
||||
const batchSize = 100;
|
||||
for (let i = 0; i < toAdd.length; i += batchSize) {
|
||||
const batch = toAdd.slice(i, i + batchSize);
|
||||
await Promise.all(
|
||||
batch.map(relativePath => {
|
||||
const fullPath = path.join(libraryPath, relativePath);
|
||||
return processImage(fullPath, libraryPath, db);
|
||||
})
|
||||
);
|
||||
|
||||
processed += batch.length;
|
||||
|
||||
// 报告进度
|
||||
if (onProgress && total > 0) {
|
||||
onProgress({
|
||||
total,
|
||||
current: processed,
|
||||
percent: Math.round((processed / total) * 100),
|
||||
currentFile: batch[batch.length - 1]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Check modified files in batches (只检查hash,不重新处理)
|
||||
const modifiedCount = toCheck.filter(relativePath => {
|
||||
const fullPath = path.join(libraryPath, relativePath);
|
||||
const existing = db.getImageByPath(relativePath);
|
||||
const currentHash = calculateFileHash(fullPath);
|
||||
|
||||
if (existing.file_hash !== currentHash) {
|
||||
await processImage(fullPath, libraryPath, db);
|
||||
}
|
||||
}
|
||||
|
||||
return existing.file_hash !== currentHash;
|
||||
}).length;
|
||||
|
||||
console.log(`Found ${modifiedCount} modified files (skipped, hash unchanged)`);
|
||||
|
||||
// Delete removed files
|
||||
for (const relativePath of toDelete) {
|
||||
db.deleteImage(relativePath);
|
||||
// TODO: Clean up thumbnail files
|
||||
}
|
||||
|
||||
|
||||
// Rebuild folder structure if there are changes or forced
|
||||
if (toAdd.length > 0 || toDelete.length > 0 || forceRebuildFolders) {
|
||||
console.log('Rebuilding folder structure...');
|
||||
|
||||
|
||||
// Get current folder structure from file system
|
||||
const currentFolders = await getFolderStructure(libraryPath);
|
||||
|
||||
|
||||
// Get existing folders from database
|
||||
const dbFolders = db.getAllFolders();
|
||||
const dbFolderPaths = new Set(dbFolders.map(f => f.path));
|
||||
|
||||
|
||||
// Find new and deleted folders
|
||||
const currentFolderPaths = new Set(currentFolders.map(f => f.path));
|
||||
const foldersToAdd = currentFolders.filter(f => !dbFolderPaths.has(f.path));
|
||||
const foldersToDelete = dbFolders.filter(f => !currentFolderPaths.has(f.path));
|
||||
|
||||
|
||||
// Add new folders
|
||||
foldersToAdd.forEach(folder => {
|
||||
db.insertFolder(folder);
|
||||
});
|
||||
|
||||
|
||||
// Delete removed folders
|
||||
foldersToDelete.forEach(folder => {
|
||||
db.deleteFolder(folder.path);
|
||||
});
|
||||
|
||||
|
||||
console.log(`Folders: +${foldersToAdd.length}, -${foldersToDelete.length}`);
|
||||
|
||||
|
||||
// Update folder image counts
|
||||
console.log('Updating folder image counts...');
|
||||
const affectedFolders = new Set();
|
||||
|
||||
|
||||
// Collect all affected folders (including parent folders)
|
||||
[...toAdd, ...toDelete].forEach(relativePath => {
|
||||
let folderPath = path.dirname(relativePath);
|
||||
|
||||
|
||||
// Add current folder and all parent folders
|
||||
while (folderPath && folderPath !== '.') {
|
||||
affectedFolders.add(folderPath);
|
||||
@@ -415,18 +627,21 @@ async function syncLibrary(libraryPath, db, forceRebuildFolders = false) {
|
||||
folderPath = parent;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Update counts for all affected folders
|
||||
affectedFolders.forEach(folderPath => {
|
||||
db.updateFolderImageCount(folderPath);
|
||||
});
|
||||
|
||||
|
||||
console.log(`Updated ${affectedFolders.size} folder counts`);
|
||||
}
|
||||
|
||||
|
||||
const totalTime = (Date.now() - startTime) / 1000;
|
||||
console.log(`✅ Sync completed in ${totalTime.toFixed(1)}s`);
|
||||
|
||||
return {
|
||||
added: toAdd.length,
|
||||
modified: toCheck.length,
|
||||
modified: modifiedCount,
|
||||
deleted: toDelete.length
|
||||
};
|
||||
} catch (error) {
|
||||
@@ -435,11 +650,74 @@ async function syncLibrary(libraryPath, db, forceRebuildFolders = false) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick sync - 只检查新增/删除,不检查修改(用于启动时快速检测)
|
||||
*/
|
||||
async function quickSync(libraryPath, db) {
|
||||
const startTime = Date.now();
|
||||
|
||||
// 获取当前文件(统一使用正斜杠)
|
||||
const currentFiles = await getAllImageFiles(libraryPath);
|
||||
const currentPaths = new Set(
|
||||
currentFiles.map(file => path.relative(libraryPath, file).replace(/\\/g, '/'))
|
||||
);
|
||||
|
||||
// 获取数据库文件
|
||||
const dbImages = db.getAllImages();
|
||||
const dbPaths = new Set(dbImages.map(img => (img.path || '').replace(/\\/g, '/')));
|
||||
|
||||
// 只检查新增和删除(不检查修改)
|
||||
const toAdd = [...currentPaths].filter(p => !dbPaths.has(p));
|
||||
let toDelete = [...dbPaths].filter(p => !currentPaths.has(p));
|
||||
|
||||
// 安全检查
|
||||
if (toDelete.length > 0 && dbImages.length > 0) {
|
||||
const deleteRatio = toDelete.length / dbImages.length;
|
||||
if (deleteRatio > 0.5 && toDelete.length > 10) {
|
||||
console.warn(`⚠️ 安全检查:跳过删除 ${toDelete.length} 个文件`);
|
||||
toDelete = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 处理新增文件
|
||||
for (const relativePath of toAdd) {
|
||||
try {
|
||||
const fullPath = path.join(libraryPath, relativePath);
|
||||
// 确保文件夹链存在
|
||||
const folder = path.dirname(relativePath).replace(/\\/g, '/');
|
||||
if (folder && folder !== '.') {
|
||||
ensureFolderChain(db, folder);
|
||||
}
|
||||
await processImage(fullPath, libraryPath, db);
|
||||
} catch (err) {
|
||||
console.error(`Error adding ${relativePath}:`, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除已移除的文件
|
||||
for (const relativePath of toDelete) {
|
||||
db.deleteImage(relativePath);
|
||||
}
|
||||
|
||||
// 如果有变化,更新所有文件夹的图片数量
|
||||
if (toAdd.length > 0 || toDelete.length > 0) {
|
||||
db.updateAllFolderCounts();
|
||||
}
|
||||
|
||||
const elapsed = Date.now() - startTime;
|
||||
if (toAdd.length > 0 || toDelete.length > 0) {
|
||||
console.log(`Quick sync: +${toAdd.length} -${toDelete.length} (${elapsed}ms)`);
|
||||
}
|
||||
|
||||
return { added: toAdd.length, deleted: toDelete.length };
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAllImageFiles,
|
||||
getFolderStructure,
|
||||
processImage,
|
||||
scanLibrary,
|
||||
syncLibrary,
|
||||
quickSync,
|
||||
applyChangesFromEvents
|
||||
};
|
||||
@@ -3,14 +3,78 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const SUPPORTED_FORMATS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif'];
|
||||
// 支持的文件格式(确定可以生成缩略图的)
|
||||
const IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif', 'avif', 'heif', 'heic', 'svg'];
|
||||
|
||||
// 文件类型分类(用于显示和占位图)
|
||||
const FILE_CATEGORIES = {
|
||||
// 图片类
|
||||
image: ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif', 'avif', 'heif', 'heic', 'svg', 'ico', 'raw', 'cr2', 'nef', 'dng'],
|
||||
|
||||
// 视频类
|
||||
video: ['mp4', 'webm', 'mov', 'avi', 'mkv', 'flv', 'm4v', 'wmv', 'mpg', 'mpeg', '3gp', 'ts', 'vob', 'ogv'],
|
||||
|
||||
// 音频类
|
||||
audio: ['mp3', 'wav', 'flac', 'aac', 'm4a', 'ogg', 'wma', 'ape', 'alac', 'opus', 'aiff'],
|
||||
|
||||
// 文档类
|
||||
document: [
|
||||
'pdf', 'txt', 'md', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx',
|
||||
'rtf', 'odt', 'ods', 'odp', 'csv', 'pages', 'numbers', 'key'
|
||||
],
|
||||
|
||||
// 设计类
|
||||
design: ['psd', 'ai', 'sketch', 'xd', 'fig', 'figma', 'indd', 'eps', 'cdr', 'dwg']
|
||||
};
|
||||
|
||||
// 为了兼容旧代码
|
||||
const SUPPORTED_FORMATS = {
|
||||
image: IMAGE_FORMATS,
|
||||
video: FILE_CATEGORIES.video,
|
||||
document: FILE_CATEGORIES.document,
|
||||
special: FILE_CATEGORIES.design
|
||||
};
|
||||
|
||||
// 所有支持的格式(扁平化,兼容所有文件)
|
||||
const ALL_FORMATS = [
|
||||
...FILE_CATEGORIES.image,
|
||||
...FILE_CATEGORIES.video,
|
||||
...FILE_CATEGORIES.audio,
|
||||
...FILE_CATEGORIES.document,
|
||||
...FILE_CATEGORIES.design
|
||||
];
|
||||
|
||||
/**
|
||||
* Check if file is a supported image
|
||||
* 获取文件类型分类
|
||||
*/
|
||||
function getFileType(filename) {
|
||||
const ext = path.extname(filename).toLowerCase().slice(1);
|
||||
|
||||
// 检查所有分类
|
||||
if (FILE_CATEGORIES.image.includes(ext)) return 'image';
|
||||
if (FILE_CATEGORIES.video.includes(ext)) return 'video';
|
||||
if (FILE_CATEGORIES.audio.includes(ext)) return 'audio';
|
||||
if (FILE_CATEGORIES.document.includes(ext)) return 'document';
|
||||
if (FILE_CATEGORIES.design.includes(ext)) return 'design';
|
||||
|
||||
// 未知类型也兼容,归类为 other
|
||||
return 'other';
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查文件是否可以用 Sharp 生成缩略图
|
||||
*/
|
||||
function canGenerateThumbnail(filename) {
|
||||
const ext = path.extname(filename).toLowerCase().slice(1);
|
||||
return IMAGE_FORMATS.includes(ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if file is supported
|
||||
*/
|
||||
function isImageFile(filename) {
|
||||
const ext = path.extname(filename).toLowerCase().slice(1);
|
||||
return SUPPORTED_FORMATS.includes(ext);
|
||||
return ALL_FORMATS.includes(ext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,101 +89,153 @@ function calculateFileHash(filePath) {
|
||||
|
||||
/**
|
||||
* Get thumbnail configuration based on original image size
|
||||
* 分阶段策略:根据原图大小使用不同的缩略图尺寸和质量
|
||||
*
|
||||
* 策略说明:
|
||||
* - 小图(<1MP):保持原尺寸或轻微缩小,高质量
|
||||
* - 中图(1-4MP):缩略图 200px 高,高质量
|
||||
* - 大图(4-12MP):缩略图 250px 高,中高质量
|
||||
* - 超大图(>12MP):缩略图 300px 高,中等质量
|
||||
*/
|
||||
function getThumbnailConfig(originalWidth, originalHeight, targetHeight = 200) {
|
||||
const targetWidth = Math.round((originalWidth / originalHeight) * targetHeight);
|
||||
|
||||
// 优化质量配置:提高质量,减少模糊
|
||||
// WebP 格式建议质量范围:80-95
|
||||
let quality = 90;
|
||||
const originalSize = originalWidth * originalHeight;
|
||||
|
||||
if (originalSize > 10000000) { // >10MP
|
||||
quality = 85; // 提高到 85(之前 70)
|
||||
} else if (originalSize > 5000000) { // 5-10MP
|
||||
quality = 88; // 提高到 88(之前 75)
|
||||
} else if (originalSize > 2000000) { // 2-5MP
|
||||
quality = 90; // 提高到 90(之前 80)
|
||||
const originalPixels = originalWidth * originalHeight;
|
||||
const aspectRatio = originalWidth / originalHeight;
|
||||
|
||||
let finalHeight, finalQuality, targetSize;
|
||||
|
||||
// 分阶段策略 - 提高质量,扩大文件大小
|
||||
if (originalPixels < 1000000) {
|
||||
// 小图 <1MP(如 1000x1000):保持较小尺寸,极高质量
|
||||
finalHeight = Math.min(targetHeight, originalHeight);
|
||||
finalQuality = 95;
|
||||
targetSize = { min: 80 * 1024, max: 240 * 1024 }; // 80-240KB
|
||||
}
|
||||
|
||||
else if (originalPixels < 4000000) {
|
||||
// 中图 1-4MP(如 2000x2000):标准尺寸,极高质量
|
||||
finalHeight = Math.min(targetHeight, originalHeight);
|
||||
finalQuality = 93;
|
||||
targetSize = { min: 120 * 1024, max: 300 * 1024 }; // 120-300KB
|
||||
}
|
||||
else if (originalPixels < 12000000) {
|
||||
// 大图 4-12MP(如 4000x3000):增大尺寸,高质量
|
||||
finalHeight = Math.min(targetHeight, originalHeight);
|
||||
finalQuality = 91;
|
||||
targetSize = { min: 160 * 1024, max: 400 * 1024 }; // 160-400KB
|
||||
}
|
||||
else {
|
||||
// 超大图 >12MP(如 6000x4000):更大尺寸,高质量
|
||||
finalHeight = Math.min(targetHeight, originalHeight);
|
||||
finalQuality = 89;
|
||||
targetSize = { min: 200 * 1024, max: 500 * 1024 }; // 200-500KB
|
||||
}
|
||||
|
||||
const finalWidth = Math.round(aspectRatio * finalHeight);
|
||||
|
||||
// 计算原图大小(MP)
|
||||
const megaPixels = (originalPixels / 1000000).toFixed(1);
|
||||
|
||||
return {
|
||||
width: targetWidth,
|
||||
height: targetHeight,
|
||||
quality: quality,
|
||||
format: 'webp'
|
||||
width: finalWidth,
|
||||
height: finalHeight,
|
||||
quality: finalQuality,
|
||||
targetSize: targetSize,
|
||||
format: 'webp',
|
||||
originalPixels: originalPixels,
|
||||
megaPixels: megaPixels
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate thumbnail for an image with dynamic quality adjustment
|
||||
* Generate thumbnail for an image with high quality settings
|
||||
*
|
||||
* 核心优化点:
|
||||
* 1. 禁用 smartSubsample,保持色彩锐度(关键!)
|
||||
* 2. 使用更强的 unsharp mask 锐化
|
||||
* 3. 固定高质量 Q96,不动态调整
|
||||
* 4. 不修改色彩(饱和度/亮度),保持原图风格
|
||||
*/
|
||||
async function generateThumbnail(inputPath, outputPath, targetHeight = 200) {
|
||||
try {
|
||||
// Get image metadata
|
||||
const metadata = await sharp(inputPath).metadata();
|
||||
// 先读取文件到 Buffer,避免 Sharp 锁定文件句柄
|
||||
const inputBuffer = fs.readFileSync(inputPath);
|
||||
|
||||
// Get image metadata from buffer
|
||||
const metadata = await sharp(inputBuffer).metadata();
|
||||
const config = getThumbnailConfig(metadata.width, metadata.height, targetHeight);
|
||||
|
||||
const TARGET_MIN_SIZE = 50 * 1024; // 50KB (提高下限)
|
||||
const TARGET_MAX_SIZE = 150 * 1024; // 150KB (提高上限)
|
||||
const MAX_ATTEMPTS = 3;
|
||||
|
||||
let quality = config.quality;
|
||||
let attempt = 0;
|
||||
let finalSize = 0;
|
||||
|
||||
// 动态调整质量,直到文件大小在目标范围内
|
||||
while (attempt < MAX_ATTEMPTS) {
|
||||
// Generate thumbnail with current quality
|
||||
await sharp(inputPath)
|
||||
.resize(config.width, config.height, {
|
||||
fit: 'cover',
|
||||
position: 'center',
|
||||
kernel: 'lanczos3' // 使用高质量的缩放算法
|
||||
})
|
||||
.webp({
|
||||
quality: quality,
|
||||
effort: 6, // 提高压缩质量(0-6,6最好但最慢)
|
||||
smartSubsample: true // 智能色度子采样
|
||||
})
|
||||
.toFile(outputPath);
|
||||
|
||||
// Check file size
|
||||
const stats = fs.statSync(outputPath);
|
||||
finalSize = stats.size;
|
||||
|
||||
// 如果在目标范围内,完成
|
||||
if (finalSize >= TARGET_MIN_SIZE && finalSize <= TARGET_MAX_SIZE) {
|
||||
console.log(`✅ Thumbnail generated: ${finalSize} bytes (quality: ${quality})`);
|
||||
break;
|
||||
}
|
||||
|
||||
// 如果太大,降低质量
|
||||
if (finalSize > TARGET_MAX_SIZE) {
|
||||
const ratio = TARGET_MAX_SIZE / finalSize;
|
||||
quality = Math.max(70, Math.round(quality * ratio * 0.9)); // 最低质量提高到 70
|
||||
console.log(`⬇️ File too large (${finalSize} bytes), reducing quality to ${quality}`);
|
||||
}
|
||||
// 如果太小,提高质量
|
||||
else if (finalSize < TARGET_MIN_SIZE) {
|
||||
const ratio = TARGET_MIN_SIZE / finalSize;
|
||||
quality = Math.min(98, Math.round(quality * ratio * 1.1)); // 最高质量提高到 98
|
||||
console.log(`⬆️ File too small (${finalSize} bytes), increasing quality to ${quality}`);
|
||||
}
|
||||
|
||||
attempt++;
|
||||
|
||||
// 最后一次尝试,接受结果
|
||||
if (attempt >= MAX_ATTEMPTS) {
|
||||
console.log(`⚠️ Max attempts reached, final size: ${finalSize} bytes (quality: ${quality})`);
|
||||
break;
|
||||
}
|
||||
const hasAlpha = Boolean(metadata.hasAlpha);
|
||||
|
||||
// 计算缩小比例,用于调整锐化强度
|
||||
const downscaleRatio = metadata.height ? (metadata.height / config.height) : 1;
|
||||
|
||||
// 锐化参数:根据缩小比例动态调整
|
||||
// sharpen(sigma, flat, jagged) - sigma: 高斯模糊半径, flat: 平坦区域锐化, jagged: 边缘锐化
|
||||
let sharpSigma, sharpFlat, sharpJagged;
|
||||
if (downscaleRatio >= 4) {
|
||||
// 大幅缩小(如 4000px → 300px):强锐化
|
||||
sharpSigma = 1.2;
|
||||
sharpFlat = 1.0;
|
||||
sharpJagged = 2.0;
|
||||
} else if (downscaleRatio >= 2) {
|
||||
// 中等缩小:中等锐化
|
||||
sharpSigma = 1.0;
|
||||
sharpFlat = 0.8;
|
||||
sharpJagged = 1.5;
|
||||
} else {
|
||||
// 轻微缩小或不缩小:轻度锐化
|
||||
sharpSigma = 0.8;
|
||||
sharpFlat = 0.5;
|
||||
sharpJagged = 1.0;
|
||||
}
|
||||
|
||||
|
||||
// 固定高质量 92(平衡清晰度和体积)
|
||||
const quality = 92;
|
||||
|
||||
// 生成缩略图(使用 buffer,不锁定原文件)
|
||||
await sharp(inputBuffer)
|
||||
.rotate() // 按EXIF旋转
|
||||
.resize(config.width, config.height, {
|
||||
fit: 'cover',
|
||||
position: 'center',
|
||||
kernel: 'lanczos3', // 最高质量缩放算法
|
||||
withoutEnlargement: true,
|
||||
fastShrinkOnLoad: false // 禁用快速缩小,保持质量
|
||||
})
|
||||
// 锐化:使用完整的 unsharp mask 参数(不修改色彩)
|
||||
.sharpen({
|
||||
sigma: sharpSigma, // 高斯模糊半径
|
||||
m1: sharpFlat, // 平坦区域锐化强度
|
||||
m2: sharpJagged, // 边缘/锯齿区域锐化强度
|
||||
x1: 2, // 平坦区域阈值
|
||||
y2: 10, // 边缘区域阈值上限
|
||||
y3: 20 // 最大锐化限制
|
||||
})
|
||||
.webp({
|
||||
quality: quality,
|
||||
effort: 4, // 降低 effort,减少编码损失
|
||||
smartSubsample: false, // 关键!禁用色度子采样,保持边缘清晰
|
||||
nearLossless: false, // 禁用近无损(会增加体积但不增加清晰度)
|
||||
preset: 'photo',
|
||||
alphaQuality: hasAlpha ? 100 : undefined
|
||||
})
|
||||
.toFile(outputPath);
|
||||
|
||||
// 获取文件大小
|
||||
const stats = fs.statSync(outputPath);
|
||||
const finalSize = stats.size;
|
||||
|
||||
// 可选:输出详细信息(每100张输出一次,避免日志过多)
|
||||
const shouldLog = Math.random() < 0.01; // 1% 概率输出
|
||||
if (shouldLog) {
|
||||
const sizeKB = (finalSize / 1024).toFixed(1);
|
||||
console.log(`📸 Thumbnail: ${config.megaPixels}MP → ${config.width}x${config.height} (${sizeKB}KB, Q${quality}, ratio ${downscaleRatio.toFixed(1)}x)`);
|
||||
}
|
||||
|
||||
return {
|
||||
width: config.width,
|
||||
height: config.height,
|
||||
size: finalSize,
|
||||
quality: quality,
|
||||
originalPixels: config.originalPixels,
|
||||
path: outputPath
|
||||
};
|
||||
} catch (error) {
|
||||
@@ -129,52 +245,398 @@ async function generateThumbnail(inputPath, outputPath, targetHeight = 200) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image metadata
|
||||
* Get file metadata (支持所有文件类型)
|
||||
* 优化:优先使用流式读取,避免加载整个文件到内存
|
||||
*/
|
||||
async function getImageMetadata(imagePath) {
|
||||
try {
|
||||
const metadata = await sharp(imagePath).metadata();
|
||||
const stats = fs.statSync(imagePath);
|
||||
|
||||
const fileType = getFileType(imagePath);
|
||||
|
||||
// 对于图片文件,尝试获取详细元数据
|
||||
if (fileType === 'image') {
|
||||
try {
|
||||
// 优化:直接传入路径,让 sharp 使用流式读取,仅读取头部元数据
|
||||
// 只有在失败时才回退到 Buffer 读取
|
||||
const metadata = await sharp(imagePath).metadata();
|
||||
return {
|
||||
width: metadata.width,
|
||||
height: metadata.height,
|
||||
format: metadata.format,
|
||||
size: stats.size,
|
||||
created_at: stats.birthtimeMs,
|
||||
modified_at: stats.mtimeMs
|
||||
};
|
||||
} catch (sharpError) {
|
||||
// Sharp 无法处理某些图片格式(如 SVG)或路径问题,回退到基础信息
|
||||
// console.warn(`Sharp cannot process ${imagePath}, using basic metadata`);
|
||||
}
|
||||
}
|
||||
|
||||
// 对于非图片文件或 Sharp 失败的情况,返回基础信息
|
||||
const ext = path.extname(imagePath).toLowerCase().slice(1);
|
||||
return {
|
||||
width: metadata.width,
|
||||
height: metadata.height,
|
||||
format: metadata.format,
|
||||
width: 640, // 占位图尺寸
|
||||
height: 480,
|
||||
format: ext,
|
||||
size: stats.size,
|
||||
created_at: stats.birthtimeMs,
|
||||
modified_at: stats.mtimeMs
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error getting image metadata:', error);
|
||||
console.error('Error getting file metadata:', imagePath, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate thumbnail for an image
|
||||
* 优化:直接存储在 thumbnails/ 目录,不再使用子文件夹
|
||||
* Generate thumbnail for a file (image/video/document)
|
||||
* 使用 480px 高度(与 Billfish 一致)
|
||||
*/
|
||||
async function generateImageThumbnails(imagePath, libraryPath) {
|
||||
const flypicDir = path.join(libraryPath, '.flypic');
|
||||
const relativePath = path.relative(libraryPath, imagePath);
|
||||
const hash = crypto.createHash('md5').update(relativePath).digest('hex');
|
||||
|
||||
// 直接存储在 thumbnails 目录,不使用 200 子文件夹
|
||||
const thumbPath = path.join(flypicDir, 'thumbnails', `${hash}.webp`);
|
||||
const thumb = await generateThumbnail(imagePath, thumbPath, 200);
|
||||
|
||||
const fileType = getFileType(imagePath);
|
||||
|
||||
console.log(`📝 Processing file: ${path.basename(imagePath)}, type: ${fileType}`);
|
||||
|
||||
// Sharding: use first 2 chars of hash for subdirectories (e.g. /ab/)
|
||||
const shard1 = hash.slice(0, 2);
|
||||
// 1-level sharding: .flypic/thumbnails/ab/hash.webp
|
||||
const out480 = path.join(flypicDir, 'thumbnails', shard1, `${hash}.webp`);
|
||||
fs.mkdirSync(path.dirname(out480), { recursive: true });
|
||||
|
||||
let thumbnailResult;
|
||||
|
||||
// 根据文件类型生成不同的缩略图
|
||||
const ext = path.extname(imagePath).slice(1).toUpperCase();
|
||||
|
||||
if (fileType === 'image' && canGenerateThumbnail(imagePath)) {
|
||||
// 图片:使用 Sharp 生成真实缩略图
|
||||
thumbnailResult = await generateThumbnail(imagePath, out480, 480);
|
||||
} else if (fileType === 'video') {
|
||||
// 视频:尝试提取封面
|
||||
console.log(`🎬 Extracting video thumbnail for: ${path.basename(imagePath)}`);
|
||||
thumbnailResult = await extractVideoThumbnail(imagePath, out480);
|
||||
|
||||
// 如果提取失败,生成占位图
|
||||
if (!thumbnailResult) {
|
||||
console.log(`🎬 Generating video placeholder for: ${path.basename(imagePath)}`);
|
||||
thumbnailResult = await generatePlaceholderThumbnail(out480, 'video', ext);
|
||||
}
|
||||
} else if (fileType === 'design') {
|
||||
// 设计文件:尝试提取嵌入缩略图(仅 PSD)
|
||||
if (ext.toLowerCase() === 'psd') {
|
||||
console.log(`🎨 Extracting PSD thumbnail for: ${path.basename(imagePath)}`);
|
||||
thumbnailResult = await extractPSDThumbnail(imagePath, out480);
|
||||
}
|
||||
|
||||
// 如果提取失败或不是 PSD,生成占位图
|
||||
if (!thumbnailResult) {
|
||||
console.log(`🎨 Generating design placeholder for: ${path.basename(imagePath)}`);
|
||||
thumbnailResult = await generatePlaceholderThumbnail(out480, 'design', ext);
|
||||
}
|
||||
} else {
|
||||
// 其他类型(音频/文档/未知):生成占位图
|
||||
console.log(`📦 Generating ${fileType} placeholder for: ${path.basename(imagePath)}`);
|
||||
thumbnailResult = await generatePlaceholderThumbnail(out480, fileType, ext);
|
||||
}
|
||||
|
||||
console.log(`✅ Thumbnail generated: ${path.basename(out480)}, ${thumbnailResult.width}x${thumbnailResult.height}, ${(thumbnailResult.size / 1024).toFixed(1)}KB`);
|
||||
|
||||
return {
|
||||
thumbnail_path: path.relative(flypicDir, thumbPath),
|
||||
thumbnail_size: thumb.size
|
||||
thumbnail_path: path.relative(flypicDir, out480),
|
||||
thumbnail_size: thumbnailResult.size,
|
||||
width: thumbnailResult.width,
|
||||
height: thumbnailResult.height,
|
||||
file_type: fileType
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 PSD 文件提取嵌入的缩略图
|
||||
*/
|
||||
async function extractPSDThumbnail(psdPath, outputPath) {
|
||||
try {
|
||||
const buffer = fs.readFileSync(psdPath);
|
||||
|
||||
// PSD 文件格式:
|
||||
// 前 4 字节: "8BPS" (签名)
|
||||
// 偏移 26: Image Resources Section
|
||||
// 查找 Resource ID 1036 (缩略图资源)
|
||||
|
||||
if (buffer.toString('utf8', 0, 4) !== '8BPS') {
|
||||
throw new Error('Not a valid PSD file');
|
||||
}
|
||||
|
||||
// 读取 Image Resources Section 长度
|
||||
const colorModeLength = buffer.readUInt32BE(26);
|
||||
const imageResourcesOffset = 26 + 4 + colorModeLength;
|
||||
const imageResourcesLength = buffer.readUInt32BE(imageResourcesOffset);
|
||||
|
||||
let offset = imageResourcesOffset + 4;
|
||||
const endOffset = offset + imageResourcesLength;
|
||||
|
||||
// 查找缩略图资源 (ID 1033 或 1036)
|
||||
while (offset < endOffset) {
|
||||
const signature = buffer.toString('utf8', offset, offset + 4);
|
||||
if (signature !== '8BIM') break;
|
||||
|
||||
const resourceId = buffer.readUInt16BE(offset + 4);
|
||||
const nameLength = buffer.readUInt8(offset + 6);
|
||||
const namePadding = nameLength % 2 === 0 ? nameLength + 2 : nameLength + 1;
|
||||
const dataSize = buffer.readUInt32BE(offset + 6 + namePadding);
|
||||
const dataPadding = dataSize % 2 === 0 ? dataSize : dataSize + 1;
|
||||
|
||||
// 1033 = 缩略图 (旧格式), 1036 = 缩略图 (新格式)
|
||||
if (resourceId === 1033 || resourceId === 1036) {
|
||||
const dataOffset = offset + 6 + namePadding + 4;
|
||||
|
||||
// 跳过前 28 字节的头部信息
|
||||
const jpegOffset = dataOffset + 28;
|
||||
const jpegData = buffer.slice(jpegOffset, jpegOffset + dataSize - 28);
|
||||
|
||||
// 先获取原始缩略图尺寸
|
||||
const metadata = await sharp(jpegData).metadata();
|
||||
console.log(` 📐 PSD embedded thumbnail: ${metadata.width}x${metadata.height}`);
|
||||
|
||||
// 使用高质量缩放,保持宽高比
|
||||
const aspectRatio = metadata.width / metadata.height;
|
||||
const targetHeight = 480;
|
||||
const targetWidth = Math.round(targetHeight * aspectRatio);
|
||||
|
||||
// 根据原始尺寸调整处理策略
|
||||
let resizeOptions, sharpenOptions, webpQuality;
|
||||
|
||||
if (metadata.width >= 1000 || metadata.height >= 1000) {
|
||||
// 高分辨率缩略图(≥1000px):正常缩放
|
||||
resizeOptions = {
|
||||
fit: 'inside',
|
||||
kernel: 'lanczos3',
|
||||
withoutEnlargement: true
|
||||
};
|
||||
sharpenOptions = { sigma: 0.8, m1: 0.5, m2: 1.0 };
|
||||
webpQuality = 95;
|
||||
} else if (metadata.width >= 500 || metadata.height >= 500) {
|
||||
// 中等分辨率(500-1000px):轻微放大 + 强锐化
|
||||
resizeOptions = {
|
||||
fit: 'inside',
|
||||
kernel: 'lanczos3',
|
||||
withoutEnlargement: false // 允许放大
|
||||
};
|
||||
sharpenOptions = { sigma: 1.2, m1: 1.0, m2: 2.0 }; // 强锐化
|
||||
webpQuality = 96;
|
||||
} else {
|
||||
// 低分辨率(<500px):放大 + 超强锐化
|
||||
resizeOptions = {
|
||||
fit: 'inside',
|
||||
kernel: 'lanczos3',
|
||||
withoutEnlargement: false
|
||||
};
|
||||
sharpenOptions = { sigma: 1.5, m1: 1.2, m2: 2.5 }; // 超强锐化
|
||||
webpQuality = 98; // 最高质量
|
||||
}
|
||||
|
||||
await sharp(jpegData)
|
||||
.resize(targetWidth, targetHeight, resizeOptions)
|
||||
.sharpen(sharpenOptions)
|
||||
.webp({
|
||||
quality: webpQuality,
|
||||
effort: 4,
|
||||
smartSubsample: false
|
||||
})
|
||||
.toFile(outputPath);
|
||||
|
||||
const stats = fs.statSync(outputPath);
|
||||
console.log(` ✅ PSD thumbnail extracted: ${(stats.size / 1024).toFixed(1)}KB`);
|
||||
return {
|
||||
width: targetWidth,
|
||||
height: targetHeight,
|
||||
size: stats.size,
|
||||
path: outputPath
|
||||
};
|
||||
}
|
||||
|
||||
offset += 6 + namePadding + 4 + dataPadding;
|
||||
}
|
||||
|
||||
throw new Error('No thumbnail found in PSD');
|
||||
} catch (error) {
|
||||
console.warn(`Failed to extract PSD thumbnail: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从视频提取封面(使用 ffmpeg 或系统工具)
|
||||
* 注意:这需要系统安装 ffmpeg,如果没有则回退到占位图
|
||||
*/
|
||||
async function extractVideoThumbnail(videoPath, outputPath) {
|
||||
try {
|
||||
const { exec } = require('child_process');
|
||||
const util = require('util');
|
||||
const execPromise = util.promisify(exec);
|
||||
|
||||
// 检查是否有 ffmpeg
|
||||
try {
|
||||
await execPromise('ffmpeg -version', { timeout: 2000 });
|
||||
} catch (e) {
|
||||
console.warn(' ⚠️ ffmpeg not found, skipping video thumbnail extraction');
|
||||
return null;
|
||||
}
|
||||
|
||||
// 使用 ffmpeg 提取第 2 秒的帧(避免黑屏)
|
||||
const tempJpg = outputPath.replace('.webp', '_temp.jpg');
|
||||
const ffmpegCmd = `ffmpeg -i "${videoPath}" -ss 00:00:02 -vframes 1 -q:v 2 "${tempJpg}" -y`;
|
||||
|
||||
await execPromise(ffmpegCmd, { timeout: 10000 });
|
||||
|
||||
// 如果生成了 JPG,转换为 WebP
|
||||
if (fs.existsSync(tempJpg)) {
|
||||
// 先获取实际尺寸
|
||||
const metadata = await sharp(tempJpg).metadata();
|
||||
console.log(` 📐 Video frame: ${metadata.width}x${metadata.height}`);
|
||||
|
||||
// 保持宽高比缩放到 480 高度
|
||||
const aspectRatio = metadata.width / metadata.height;
|
||||
const targetHeight = 480;
|
||||
const targetWidth = Math.round(targetHeight * aspectRatio);
|
||||
|
||||
await sharp(tempJpg)
|
||||
.resize(targetWidth, targetHeight, {
|
||||
fit: 'cover',
|
||||
position: 'center',
|
||||
kernel: 'lanczos3',
|
||||
withoutEnlargement: true
|
||||
})
|
||||
.webp({ quality: 92, smartSubsample: false })
|
||||
.toFile(outputPath);
|
||||
|
||||
fs.unlinkSync(tempJpg); // 删除临时 JPG
|
||||
|
||||
const stats = fs.statSync(outputPath);
|
||||
console.log(` ✅ Video thumbnail extracted: ${targetWidth}x${targetHeight}, ${(stats.size / 1024).toFixed(1)}KB`);
|
||||
return {
|
||||
width: targetWidth,
|
||||
height: targetHeight,
|
||||
size: stats.size,
|
||||
path: outputPath
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.warn(` ⚠️ Failed to extract video thumbnail: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成占位缩略图(用于视频/文档等)
|
||||
*/
|
||||
async function generatePlaceholderThumbnail(outputPath, type, label) {
|
||||
// 使用 Sharp 生成简单的占位图
|
||||
const width = 640;
|
||||
const height = 480;
|
||||
|
||||
// 不同类型的背景色和图标
|
||||
const typeConfig = {
|
||||
image: {
|
||||
color: { r: 99, g: 102, b: 241 }, // 靛蓝色
|
||||
icon: '🖼️',
|
||||
text: '图片'
|
||||
},
|
||||
video: {
|
||||
color: { r: 59, g: 130, b: 246 }, // 蓝色
|
||||
icon: '🎬',
|
||||
text: '视频'
|
||||
},
|
||||
audio: {
|
||||
color: { r: 236, g: 72, b: 153 }, // 粉色
|
||||
icon: '🎵',
|
||||
text: '音频'
|
||||
},
|
||||
document: {
|
||||
color: { r: 16, g: 185, b: 129 }, // 绿色
|
||||
icon: '📄',
|
||||
text: '文档'
|
||||
},
|
||||
design: {
|
||||
color: { r: 168, g: 85, b: 247 }, // 紫色
|
||||
icon: '🎨',
|
||||
text: '设计'
|
||||
},
|
||||
other: {
|
||||
color: { r: 107, g: 114, b: 128 }, // 灰色
|
||||
icon: '📁',
|
||||
text: '其他'
|
||||
}
|
||||
};
|
||||
|
||||
const config = typeConfig[type] || typeConfig.other;
|
||||
|
||||
const color = config.color;
|
||||
|
||||
// 创建渐变背景 + 图标 + 文件扩展名
|
||||
const svg = `
|
||||
<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:rgb(${color.r},${color.g},${color.b});stop-opacity:0.15" />
|
||||
<stop offset="100%" style="stop-color:rgb(${color.r},${color.g},${color.b});stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="${width}" height="${height}" fill="url(#grad)"/>
|
||||
<text x="50%" y="35%" font-family="Arial, sans-serif" font-size="100" fill="rgb(${color.r},${color.g},${color.b})" text-anchor="middle" dominant-baseline="middle" opacity="0.35">
|
||||
${config.icon}
|
||||
</text>
|
||||
<text x="50%" y="55%" font-family="Arial, sans-serif" font-size="48" font-weight="700" fill="rgb(${color.r},${color.g},${color.b})" text-anchor="middle" dominant-baseline="middle" opacity="0.7">
|
||||
.${label.toLowerCase()}
|
||||
</text>
|
||||
<text x="50%" y="68%" font-family="Arial, sans-serif" font-size="24" fill="rgb(${color.r},${color.g},${color.b})" text-anchor="middle" dominant-baseline="middle" opacity="0.5">
|
||||
${config.text}文件
|
||||
</text>
|
||||
<text x="50%" y="78%" font-family="Arial, sans-serif" font-size="18" fill="rgb(${color.r},${color.g},${color.b})" text-anchor="middle" dominant-baseline="middle" opacity="0.4">
|
||||
双击在默认应用中打开
|
||||
</text>
|
||||
</svg>
|
||||
`;
|
||||
|
||||
await sharp(Buffer.from(svg))
|
||||
.resize(640, 480)
|
||||
.webp({ quality: 85 })
|
||||
.toFile(outputPath);
|
||||
|
||||
const stats = fs.statSync(outputPath);
|
||||
return {
|
||||
width: 640,
|
||||
height: 480,
|
||||
size: stats.size,
|
||||
path: outputPath
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件类型对应的图标(Unicode)
|
||||
*/
|
||||
function getIconForType(type) {
|
||||
const icons = {
|
||||
video: '🎬',
|
||||
document: '📄',
|
||||
special: '🎨'
|
||||
};
|
||||
return icons[type] || '📁';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isImageFile,
|
||||
getFileType,
|
||||
calculateFileHash,
|
||||
getThumbnailConfig,
|
||||
generateThumbnail,
|
||||
getImageMetadata,
|
||||
generateImageThumbnails,
|
||||
SUPPORTED_FORMATS
|
||||
SUPPORTED_FORMATS,
|
||||
ALL_FORMATS
|
||||
};
|
||||
@@ -2,10 +2,14 @@
|
||||
".url": {
|
||||
"flypic.Application": {
|
||||
"title": "FlyPic",
|
||||
"icon": "images/icon_{0}.png",
|
||||
"icon": "images/icon-{0}.png",
|
||||
"type": "url",
|
||||
"protocol": "http",
|
||||
"port": "5002"
|
||||
"port": "15002",
|
||||
"allUsers": true,
|
||||
"control": {
|
||||
"portPerm": "editable"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,21 @@ echo "数据共享路径: ${TRIM_DATA_SHARE_PATHS}"
|
||||
echo "应用目录: ${TRIM_APPDEST}"
|
||||
echo "数据目录: ${TRIM_PKGVAR}"
|
||||
echo "临时目录: ${TRIM_PKGTMP}"
|
||||
|
||||
# 获取用户设置的端口(从安装向导)
|
||||
APP_PORT="${wizard_app_port:-15002}"
|
||||
echo "用户设置端口: ${APP_PORT}"
|
||||
|
||||
# 更新 UI 配置中的端口
|
||||
UI_CONFIG="${TRIM_APPDEST}/ui/config"
|
||||
if [ -f "$UI_CONFIG" ]; then
|
||||
sed -i "s/\"port\": \"[0-9]*\"/\"port\": \"${APP_PORT}\"/" "$UI_CONFIG"
|
||||
echo "已更新 UI 配置端口为: ${APP_PORT}"
|
||||
fi
|
||||
|
||||
# 保存端口配置供 main 脚本使用
|
||||
echo "APP_PORT=${APP_PORT}" > "${TRIM_PKGVAR}/port.conf"
|
||||
|
||||
echo "=== 安装初始化完成 ==="
|
||||
|
||||
exit 0
|
||||
+9
-1
@@ -8,8 +8,16 @@ export PATH=/var/apps/nodejs_v22/target/bin:$PATH
|
||||
|
||||
# 数据目录
|
||||
DATA_DIR="${TRIM_DATA_SHARE_PATHS%%:*}"
|
||||
|
||||
# 读取用户配置的端口(默认 5002)
|
||||
PORT_CONF="${TRIM_PKGVAR}/port.conf"
|
||||
if [ -f "$PORT_CONF" ]; then
|
||||
source "$PORT_CONF"
|
||||
fi
|
||||
APP_PORT="${APP_PORT:-15002}"
|
||||
|
||||
# 启动命令
|
||||
CMD="DATA_DIR=${DATA_DIR} PORT=5002 node ${TRIM_APPDEST}/server/server.js"
|
||||
CMD="DATA_DIR=${DATA_DIR} PORT=${APP_PORT} node ${TRIM_APPDEST}/server/server.js"
|
||||
|
||||
log_msg() {
|
||||
local msg="$(date '+%Y-%m-%d %H:%M:%S') - $1"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
appname=flypic
|
||||
version=0.1.0
|
||||
desc=轻量、快速、稳定的图片检索浏览应用
|
||||
desc=飞图 - 专为飞牛 fnOS 设计的轻量、快速、稳定的图像素材检索浏览应用,支持数十万级别图片流畅浏览,非侵入式设计,100% 开源免费
|
||||
arch=x86_64
|
||||
display_name=FlyPic
|
||||
maintainer=ZangXincz
|
||||
@@ -8,5 +8,5 @@ distributor=ZangXincz
|
||||
desktop_uidir=ui
|
||||
desktop_applaunchname=flypic.Application
|
||||
source=thirdparty
|
||||
service_port=5002
|
||||
service_port=15002
|
||||
install_dep_apps=nodejs_v22
|
||||
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"stepTitle": "应用配置",
|
||||
"items": [
|
||||
{
|
||||
"type": "tips",
|
||||
"helpText": "欢迎安装 FlyPic!请配置应用端口。"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"field": "wizard_app_port",
|
||||
"label": "应用端口",
|
||||
"initValue": "15002",
|
||||
"rules": [
|
||||
{
|
||||
"required": true,
|
||||
"message": "请输入端口号"
|
||||
},
|
||||
{
|
||||
"pattern": "^[0-9]+$",
|
||||
"message": "端口号必须是数字"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "tips",
|
||||
"helpText": "默认端口为 15002,如果该端口被占用,请修改为其他可用端口。"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>FlyPic - 图片素材库管理</title>
|
||||
<title>FlyPic 飞图 - 图片素材库管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#3b82f6"/>
|
||||
<stop offset="100%" style="stop-color:#8b5cf6"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="12" fill="url(#grad)"/>
|
||||
<path d="M18 22h28v20H18z" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
|
||||
<circle cx="25" cy="29" r="3" fill="white"/>
|
||||
<path d="M18 38l10-8 6 5 8-7 4 4v10H18z" fill="white" opacity="0.9"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 563 B |
@@ -7,7 +7,7 @@ export default defineConfig({
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_API_URL || 'http://localhost:3000',
|
||||
target: process.env.VITE_API_URL || 'http://localhost:15002',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,10 +110,14 @@ const uiConfig = {
|
||||
".url": {
|
||||
"flypic.Application": {
|
||||
"title": "FlyPic",
|
||||
"icon": "images/icon_{0}.png",
|
||||
"icon": "images/icon-{0}.png",
|
||||
"type": "url",
|
||||
"protocol": "http",
|
||||
"port": "5002"
|
||||
"port": "15002",
|
||||
"allUsers": true,
|
||||
"control": {
|
||||
"portPerm": "editable"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,10 +72,14 @@ const uiConfig = {
|
||||
".url": {
|
||||
"flypic.Application": {
|
||||
"title": "FlyPic",
|
||||
"icon": "images/icon_{0}.png",
|
||||
"icon": "images/icon-{0}.png",
|
||||
"type": "url",
|
||||
"protocol": "http",
|
||||
"port": "5002"
|
||||
"port": "15002",
|
||||
"allUsers": true,
|
||||
"control": {
|
||||
"portPerm": "editable"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+33
-7
@@ -3,8 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>FlyPic - 飞牛NAS图片检索浏览应用</title>
|
||||
<meta name="description" content="FlyPic 是一款专为飞牛 fnOS 设计的轻量、快速、稳定的图片检索浏览应用,支持10万+级别图片浏览,完全由 AI 开发。">
|
||||
<title>FlyPic 飞图 - 飞牛NAS图片检索浏览应用</title>
|
||||
<meta name="description" content="FlyPic 飞图是一款专为飞牛 fnOS 设计的轻量、快速、稳定的图片检索浏览应用,支持数十万级别图片流畅浏览,非侵入式设计,100% 开源免费。">
|
||||
<link rel="icon" type="image/png" href="https://eo.shikejk.com/flypic/icon.png">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
@@ -47,9 +47,9 @@
|
||||
<div class="container">
|
||||
<div class="hero-content">
|
||||
<div class="hero-badge">🤖 完全由 AI 开发 · 专为飞牛 fnOS 设计</div>
|
||||
<h1>轻量、快速、稳定的<br><span class="gradient-text">图像素材检索浏览应用</span></h1>
|
||||
<h1>FlyPic 飞图<br><span class="gradient-text">轻量、快速、稳定的图像素材检索浏览应用</span></h1>
|
||||
<p class="hero-desc">
|
||||
支持 <strong>10万+</strong> 级别图片流畅浏览,轻量快速。<strong>非侵入式设计</strong>,
|
||||
支持 <strong>数十万</strong> 级别图片流畅浏览,轻量快速。<strong>非侵入式设计</strong>,
|
||||
不修改原文件结构。AI开发 <strong>100% 开源免费</strong>。
|
||||
</p>
|
||||
<div class="hero-actions">
|
||||
@@ -61,7 +61,7 @@
|
||||
</div>
|
||||
<div class="hero-stats">
|
||||
<div class="stat">
|
||||
<span class="stat-value">10万+</span>
|
||||
<span class="stat-value">数十万</span>
|
||||
<span class="stat-label">图片支持</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
@@ -72,6 +72,10 @@
|
||||
<span class="stat-value">实时</span>
|
||||
<span class="stat-label">文件监控</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-value">FN Connect</span>
|
||||
<span class="stat-label">远程访问</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-image">
|
||||
@@ -136,7 +140,7 @@
|
||||
<h3>固定行高瀑布流</h3>
|
||||
<p>固定高度、宽度自适应的瀑布流布局,视觉整齐美观。支持缩略图大小调节(150-300px),适应不同浏览需求。</p>
|
||||
<ul class="feature-list">
|
||||
<li>虚拟滚动技术,轻松浏览 10万+ 图片</li>
|
||||
<li>虚拟滚动技术,轻松浏览数十万图片</li>
|
||||
<li>Web Worker 异步计算布局,不阻塞主线程</li>
|
||||
<li>智能分批加载,按需请求数据</li>
|
||||
</ul>
|
||||
@@ -470,6 +474,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 安装提示 -->
|
||||
<div class="install-tips" style="margin-top: 40px; padding: 24px; background: var(--bg-secondary); border-radius: 12px; border: 1px solid var(--border);">
|
||||
<h4 style="margin-bottom: 16px; display: flex; align-items: center; gap: 8px;">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width: 20px; height: 20px;"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>
|
||||
安装提示
|
||||
</h4>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; color: var(--text-secondary);">
|
||||
<li style="display: flex; align-items: flex-start; gap: 8px;">
|
||||
<span style="color: var(--primary);">•</span>
|
||||
<span><strong>自定义端口</strong>:安装时可自定义应用端口(默认 15002),避免与其他应用冲突</span>
|
||||
</li>
|
||||
<li style="display: flex; align-items: flex-start; gap: 8px;">
|
||||
<span style="color: var(--primary);">•</span>
|
||||
<span><strong>素材库路径</strong>:添加素材库时需输入飞牛文件系统的完整路径,如 <code style="background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px;">/vol1/1000/图片库</code></span>
|
||||
</li>
|
||||
<li style="display: flex; align-items: flex-start; gap: 8px;">
|
||||
<span style="color: var(--primary);">•</span>
|
||||
<span><strong>文件夹权限</strong>:请确保应用对素材库文件夹有读取权限,可在飞牛应用设置中配置授权目录</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 使用说明卡片 -->
|
||||
<div class="usage-guide">
|
||||
<div class="section-header" style="margin-bottom: 40px;">
|
||||
@@ -482,7 +508,7 @@
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/><line x1="12" y1="11" x2="12" y2="17"/><line x1="9" y1="14" x2="15" y2="14"/></svg>
|
||||
</div>
|
||||
<h4>添加素材库</h4>
|
||||
<p>点击左侧素材库下拉框,选择"添加新素材库",输入名称和路径</p>
|
||||
<p>点击左侧素材库下拉框,选择"添加新素材库",输入名称和飞牛文件路径(如 /vol1/1000/图片)</p>
|
||||
</div>
|
||||
<div class="usage-card">
|
||||
<div class="usage-icon">
|
||||
|
||||
Reference in new issue
Block a user