完善版本发布流程并处理会话失效场景

This commit is contained in:
Christ committed 2026-08-13 20:04:45 +08:00
1 parent 36798dcced
commit 1833020caf
52 files changed
+1129 -265

No files matched your search

+31 -72
View File
@@ -5,10 +5,13 @@ on:
branches: branches:
- main - main
- dev - dev
- codex/desktop-packaging
tags:
- 'v*.*.*'
workflow_dispatch: workflow_dispatch:
workflow_call:
inputs:
app_version:
description: 正式发布版本号(不含 v)
required: true
type: string
permissions: permissions:
contents: read contents: read
@@ -23,22 +26,28 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
outputs: outputs:
app_version: ${{ steps.version.outputs.app_version }} app_version: ${{ steps.version.outputs.app_version }}
build_version: ${{ steps.version.outputs.build_version }}
build_time: ${{ steps.version.outputs.build_time }}
steps: steps:
- name: 解析并校验版本号 - name: 解析并校验版本号
id: version id: version
shell: bash shell: bash
run: | run: |
set -Eeuo pipefail set -Eeuo pipefail
if [[ "$GITHUB_REF" == refs/tags/* ]]; then if [ -n "${{ inputs.app_version }}" ]; then
if [[ ! "$GITHUB_REF_NAME" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then app_version="${{ inputs.app_version }}"
echo "版本标签必须符合 v1.2.3 格式:$GITHUB_REF_NAME" >&2 build_version="$app_version"
exit 1
fi
app_version="${GITHUB_REF_NAME#v}"
else else
app_version="0.0.0-${GITHUB_RUN_NUMBER}" app_version="0.0.${GITHUB_RUN_NUMBER}"
build_version="${GITHUB_REF_NAME}-${GITHUB_SHA::12}"
fi
if [[ ! "$app_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "安装包版本必须符合 1.2.3 格式:$app_version" >&2
exit 1
fi fi
echo "app_version=$app_version" >> "$GITHUB_OUTPUT" echo "app_version=$app_version" >> "$GITHUB_OUTPUT"
echo "build_version=$build_version" >> "$GITHUB_OUTPUT"
echo "build_time=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
linux: linux:
name: Linux 安装包 (${{ matrix.arch }}) name: Linux 安装包 (${{ matrix.arch }})
@@ -46,6 +55,8 @@ jobs:
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
env: env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }} APP_VERSION: ${{ needs.prepare.outputs.app_version }}
BUILD_VERSION: ${{ needs.prepare.outputs.build_version }}
BUILD_TIME: ${{ needs.prepare.outputs.build_time }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -84,7 +95,8 @@ jobs:
run: | run: |
package_dir="dist/ydisks-xianyu-helper-linux-${GOARCH}" package_dir="dist/ydisks-xianyu-helper-linux-${GOARCH}"
mkdir -p "$package_dir" mkdir -p "$package_dir"
go build -trimpath -ldflags='-s -w' -o "$package_dir/xianyu-server" ./cmd/server version_ldflags="-s -w -X xianyu-go/internal/version.Version=$BUILD_VERSION -X xianyu-go/internal/version.Commit=$GITHUB_SHA -X xianyu-go/internal/version.BuildTime=$BUILD_TIME"
go build -trimpath -ldflags="$version_ldflags" -o "$package_dir/xianyu-server" ./cmd/server
go build -trimpath -ldflags='-s -w' -o "$package_dir/browser-install" ./cmd/browser-install go build -trimpath -ldflags='-s -w' -o "$package_dir/browser-install" ./cmd/browser-install
- name: 恢复 Linux Chromium runtime 缓存 - name: 恢复 Linux Chromium runtime 缓存
@@ -175,6 +187,8 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
env: env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }} APP_VERSION: ${{ needs.prepare.outputs.app_version }}
BUILD_VERSION: ${{ needs.prepare.outputs.build_version }}
BUILD_TIME: ${{ needs.prepare.outputs.build_time }}
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v6 uses: actions/checkout@v6
@@ -225,7 +239,8 @@ jobs:
run: | run: |
& packaging/windows/build-resources.ps1 & packaging/windows/build-resources.ps1
New-Item -ItemType Directory -Force -Path dist/windows | Out-Null New-Item -ItemType Directory -Force -Path dist/windows | Out-Null
go build -trimpath -ldflags "-s -w" -o dist/windows/xianyu-server.exe ./cmd/server $versionLdflags = "-s -w -X xianyu-go/internal/version.Version=$env:BUILD_VERSION -X xianyu-go/internal/version.Commit=$env:GITHUB_SHA -X xianyu-go/internal/version.BuildTime=$env:BUILD_TIME"
go build -trimpath -ldflags $versionLdflags -o dist/windows/xianyu-server.exe ./cmd/server
go build -trimpath -ldflags "-s -w" -o dist/windows/browser-install.exe ./cmd/browser-install go build -trimpath -ldflags "-s -w" -o dist/windows/browser-install.exe ./cmd/browser-install
go build -trimpath -ldflags "-s -w -H=windowsgui" -o dist/windows/xianyu-tray.exe ./cmd/tray go build -trimpath -ldflags "-s -w -H=windowsgui" -o dist/windows/xianyu-tray.exe ./cmd/tray
@@ -584,6 +599,8 @@ jobs:
runs-on: macos-14 runs-on: macos-14
env: env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }} APP_VERSION: ${{ needs.prepare.outputs.app_version }}
BUILD_VERSION: ${{ needs.prepare.outputs.build_version }}
BUILD_TIME: ${{ needs.prepare.outputs.build_time }}
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v6 uses: actions/checkout@v6
@@ -610,8 +627,9 @@ jobs:
- name: 编译 macOS 桌面程序 - name: 编译 macOS 桌面程序
run: | run: |
mkdir -p dist/macos/arm64 dist/macos/amd64 mkdir -p dist/macos/arm64 dist/macos/amd64
version_ldflags="-s -w -X xianyu-go/internal/version.Version=$BUILD_VERSION -X xianyu-go/internal/version.Commit=$GITHUB_SHA -X xianyu-go/internal/version.BuildTime=$BUILD_TIME"
for arch in arm64 amd64; do for arch in arm64 amd64; do
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/xianyu-server" ./cmd/server GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags="$version_ldflags" -o "dist/macos/$arch/xianyu-server" ./cmd/server
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/browser-install" ./cmd/browser-install GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/browser-install" ./cmd/browser-install
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/xianyu-tray" ./cmd/tray GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/xianyu-tray" ./cmd/tray
done done
@@ -736,62 +754,3 @@ jobs:
name: ydisks-xianyu-helper-macos-amd64-${{ env.APP_VERSION }} name: ydisks-xianyu-helper-macos-amd64-${{ env.APP_VERSION }}
path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-amd64.pkg path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-amd64.pkg
if-no-files-found: error if-no-files-found: error
release:
name: 发布 GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- prepare
- linux
- windows
- macos
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: 下载全部平台安装包
uses: actions/download-artifact@v8
with:
pattern: ydisks-xianyu-helper-*
path: dist/release
merge-multiple: true
- name: 校验 Release 文件
shell: bash
run: |
set -Eeuo pipefail
test -f "dist/release/ydisks-xianyu-helper-linux-amd64-${{ needs.prepare.outputs.app_version }}.tar.gz"
test -f "dist/release/ydisks-xianyu-helper-linux-arm64-${{ needs.prepare.outputs.app_version }}.tar.gz"
test -f "dist/release/Ydisks-Xianyu-Helper-Setup.exe"
test -f "dist/release/Ydisks-Xianyu-Helper-${{ needs.prepare.outputs.app_version }}-arm64.pkg"
test -f "dist/release/Ydisks-Xianyu-Helper-${{ needs.prepare.outputs.app_version }}-amd64.pkg"
test "$(find dist/release -maxdepth 1 -type f | wc -l)" -eq 5
test -z "$(find dist/release -maxdepth 1 -type f -name '*.zip' -print -quit)"
(
cd dist/release
sha256sum * > SHA256SUMS
)
- name: 创建或更新 GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ needs.prepare.outputs.app_version }}
run: |
set -Eeuo pipefail
mapfile -t release_files < <(find dist/release -maxdepth 1 -type f -print | sort)
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
while IFS= read -r asset_name; do
case "$asset_name" in
Ydisks-Xianyu-Helper-*-binaries.zip)
gh release delete-asset "$GITHUB_REF_NAME" "$asset_name" --yes
;;
esac
done < <(gh release view "$GITHUB_REF_NAME" --json assets --jq '.assets[].name')
gh release upload "$GITHUB_REF_NAME" "${release_files[@]}" --clobber
else
gh release create "$GITHUB_REF_NAME" "${release_files[@]}" \
--verify-tag \
--generate-notes \
--title "Ydisks 闲鱼助手 $RELEASE_VERSION"
fi
+28 -15
View File
@@ -4,10 +4,14 @@ on:
push: push:
branches: branches:
- main - main
- codex/desktop-packaging - dev
tags:
- 'v*.*.*'
workflow_dispatch: workflow_dispatch:
workflow_call:
inputs:
app_version:
description: 正式发布版本号(不含 v)
required: true
type: string
permissions: permissions:
contents: read contents: read
@@ -21,17 +25,26 @@ jobs:
verify: verify:
name: Docker 发布测试门禁 name: Docker 发布测试门禁
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
outputs:
app_version: ${{ steps.version.outputs.app_version }}
build_time: ${{ steps.version.outputs.build_time }}
steps: steps:
- name: 校验版本标签 - name: 准备构建版本
if: startsWith(github.ref, 'refs/tags/') id: version
shell: bash shell: bash
run: | run: |
set -Eeuo pipefail set -Eeuo pipefail
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then if [ -n "${{ inputs.app_version }}" ]; then
echo "版本标签必须符合 v1.2.3 格式:$GITHUB_REF_NAME" >&2 app_version="${{ inputs.app_version }}"
else
app_version="${GITHUB_REF_NAME}-${GITHUB_SHA::12}"
fi
if [ -n "${{ inputs.app_version }}" ] && [[ ! "$app_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "正式版本必须符合 1.2.3 格式:$app_version" >&2
exit 1 exit 1
fi fi
echo "app_version=$app_version" >> "$GITHUB_OUTPUT"
echo "build_time=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v6 uses: actions/checkout@v6
@@ -178,6 +191,10 @@ jobs:
context: . context: .
file: Dockerfile.debian13 file: Dockerfile.debian13
platforms: ${{ matrix.platform }} platforms: ${{ matrix.platform }}
build-args: |
APP_VERSION=${{ needs.verify.outputs.app_version }}
VCS_REF=${{ github.sha }}
BUILD_TIME=${{ needs.verify.outputs.build_time }}
outputs: type=image,name=${{ steps.image.outputs.name }},push-by-digest=true,name-canonical=true,push=true outputs: type=image,name=${{ steps.image.outputs.name }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=ydisks-docker-${{ matrix.arch }} cache-from: type=gha,scope=ydisks-docker-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=ydisks-docker-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=ydisks-docker-${{ matrix.arch }}
@@ -241,10 +258,11 @@ jobs:
name: ydisks-docker-digest-${{ matrix.arch }} name: ydisks-docker-digest-${{ matrix.arch }}
path: dist/digests/* path: dist/digests/*
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 30
publish: publish:
name: 合并多架构镜像 name: 合并多架构镜像
if: inputs.app_version == ''
needs: build needs: build
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
@@ -276,14 +294,9 @@ jobs:
with: with:
images: ${{ steps.image.outputs.name }} images: ${{ steps.image.outputs.name }}
tags: | tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long type=sha,format=long
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=desktop-packaging,enable=${{ github.ref == 'refs/heads/codex/desktop-packaging' }}
type=raw,value=alpha,enable=${{ github.ref == 'refs/heads/codex/desktop-packaging' }}
- name: 创建并推送多架构 manifest - name: 创建并推送多架构 manifest
shell: bash shell: bash
+149
View File
@@ -0,0 +1,149 @@
name: 发布正式版本
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
packages: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
prepare:
name: 校验正式版本
runs-on: ubuntu-24.04
outputs:
app_version: ${{ steps.version.outputs.app_version }}
steps:
- name: 检出完整 Git 历史
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 校验标签、来源与版本顺序
id: version
shell: bash
run: |
set -Eeuo pipefail
if [[ ! "$GITHUB_REF_NAME" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "正式版本标签必须符合 v1.2.3 格式:$GITHUB_REF_NAME" >&2
exit 1
fi
git fetch origin main --no-tags
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
echo "正式版本标签必须指向 main 已包含的提交。" >&2
exit 1
fi
newest_tag="$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)"
if [ "$newest_tag" != "$GITHUB_REF_NAME" ]; then
echo "拒绝用旧版本 $GITHUB_REF_NAME 覆盖 latest;当前最高版本是 $newest_tag。" >&2
exit 1
fi
echo "app_version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
desktop:
name: 构建桌面端安装包
needs: prepare
uses: ./.github/workflows/desktop-cd.yml
with:
app_version: ${{ needs.prepare.outputs.app_version }}
secrets: inherit
docker:
name: 构建 Docker 镜像
needs: prepare
uses: ./.github/workflows/docker-publish.yml
with:
app_version: ${{ needs.prepare.outputs.app_version }}
secrets: inherit
publish:
name: 审批并发布正式版本
needs:
- prepare
- desktop
- docker
runs-on: ubuntu-24.04
environment:
name: production-release
steps:
- name: 下载全部构建产物
uses: actions/download-artifact@v8
with:
pattern: ydisks-*
path: dist/artifacts
merge-multiple: true
- name: 校验桌面产物并生成校验和
shell: bash
env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
run: |
set -Eeuo pipefail
mkdir -p dist/release dist/digests
find dist/artifacts -maxdepth 1 -type f -name '*.tar.gz' -exec cp {} dist/release/ \;
find dist/artifacts -maxdepth 1 -type f -name '*.exe' -exec cp {} dist/release/ \;
find dist/artifacts -maxdepth 1 -type f -name '*.pkg' -exec cp {} dist/release/ \;
find dist/artifacts -maxdepth 1 -type f -regex '.*/[0-9a-f]\{64\}' -exec cp {} dist/digests/ \;
test -f "dist/release/ydisks-xianyu-helper-linux-amd64-$APP_VERSION.tar.gz"
test -f "dist/release/ydisks-xianyu-helper-linux-arm64-$APP_VERSION.tar.gz"
test -f "dist/release/Ydisks-Xianyu-Helper-Setup.exe"
test -f "dist/release/Ydisks-Xianyu-Helper-$APP_VERSION-arm64.pkg"
test -f "dist/release/Ydisks-Xianyu-Helper-$APP_VERSION-amd64.pkg"
test "$(find dist/release -maxdepth 1 -type f | wc -l)" -eq 5
test "$(find dist/digests -maxdepth 1 -type f | wc -l)" -eq 2
(cd dist/release && sha256sum * > SHA256SUMS)
- name: 配置 Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 登录 GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 发布正式 Docker manifest
shell: bash
env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
run: |
set -Eeuo pipefail
image_name="ghcr.io/${GITHUB_REPOSITORY,,}"
minor_version="${APP_VERSION%.*}"
digest_args=()
while IFS= read -r digest_file; do
digest_args+=("$image_name@sha256:$(basename "$digest_file")")
done < <(find dist/digests -maxdepth 1 -type f -print | sort)
docker buildx imagetools create \
--tag "$image_name:$GITHUB_REF_NAME" \
--tag "$image_name:$APP_VERSION" \
--tag "$image_name:$minor_version" \
--tag "$image_name:latest" \
--tag "$image_name:sha-$GITHUB_SHA" \
"${digest_args[@]}"
docker buildx imagetools inspect "$image_name:$GITHUB_REF_NAME"
docker buildx imagetools inspect "$image_name:latest"
- name: 创建或更新 GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
run: |
set -Eeuo pipefail
mapfile -t release_files < <(find dist/release -maxdepth 1 -type f -print | sort)
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" "${release_files[@]}" --clobber
else
gh release create "$GITHUB_REF_NAME" "${release_files[@]}" \
--verify-tag \
--generate-notes \
--title "Ydisks 闲鱼助手 $APP_VERSION"
fi
+6 -1
View File
@@ -10,12 +10,17 @@ RUN npm run build
FROM --platform=$BUILDPLATFORM golang:1.26-trixie AS backend FROM --platform=$BUILDPLATFORM golang:1.26-trixie AS backend
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ARG APP_VERSION=dev
ARG VCS_REF=unknown
ARG BUILD_TIME=unknown
WORKDIR /src WORKDIR /src
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
COPY --from=frontend /src/internal/webui/static ./internal/webui/static COPY --from=frontend /src/internal/webui/static ./internal/webui/static
RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-server ./cmd/server \ RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath \
-ldflags="-s -w -X xianyu-go/internal/version.Version=$APP_VERSION -X xianyu-go/internal/version.Commit=$VCS_REF -X xianyu-go/internal/version.BuildTime=$BUILD_TIME" \
-o /out/xianyu-server ./cmd/server \
&& CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbseed ./cmd/dbseed \ && CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbseed ./cmd/dbseed \
&& CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbverify ./cmd/dbverify && CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbverify ./cmd/dbverify
+12 -12
View File
@@ -208,10 +208,11 @@ Windows 和 macOS 托盘启动时会自动启动后台服务,并显示检查
`/var/log/ydisks-xianyu-helper/server.log`,也可以使用 `/var/log/ydisks-xianyu-helper/server.log`,也可以使用
`journalctl -u ydisks-xianyu-helper.service` 查看。 `journalctl -u ydisks-xianyu-helper.service` 查看。
桌面端安装包由 GitHub Actions 工作流在 `main`、`codex/desktop-packaging` 分支以及 `v1.2.3` 桌面端安装包由 GitHub Actions 工作流在 `dev`、`main` 分支以及 `v1.2.3` 格式的版本标签上构建:
格式的版本标签上构建:Linux 上传 amd64/arm64 tar 包,Windows 上传安装器,macOS 分别上传 Linux 上传 amd64/arm64 tar 包,Windows 上传安装器,macOS 分别上传 arm64 和 amd64 安装包。
arm64 和 amd64 安装包。版本标签构建全部成功后,会自动创建 GitHub Release,上传各平台安装包 分支构建只保留非正式 Actions artifacts;版本标签必须指向 `main` 中的提交,全部桌面端和 Docker
及 `SHA256SUMS`。Windows 构建验证成功后等待 `production-release` Environment 人工审批,审批通过才创建 GitHub Release、
上传各平台安装包及 `SHA256SUMS`,并发布正式 Docker 标签。Windows
和 macOS 安装包使用工作流中配置的固定签名证书签名;未配置对应 GitHub Secrets 时,签名 和 macOS 安装包使用工作流中配置的固定签名证书签名;未配置对应 GitHub Secrets 时,签名
步骤会失败,不会生成可分发的安装包。 步骤会失败,不会生成可分发的安装包。
@@ -411,15 +412,14 @@ ARM64 Linux 拉取 arm64,不需要手动设置 `platform`。
| Git 引用 | 镜像标签 | | Git 引用 | 镜像标签 |
| --- | --- | | --- | --- |
| `main` 分支 | `main`、`latest`、`sha-<完整提交号>` | | `dev` 分支 | `dev`、`sha-<完整提交号>` |
| `codex/desktop-packaging` 分支 | `alpha`、`desktop-packaging`、`sha-<完整提交号>` | | `main` 分支 | `main`、`sha-<完整提交号>` |
| `v1.2.3` 标签 | `v1.2.3`、`1.2.3`、`1.2`、`sha-<完整提交号>` | | `v1.2.3` 标签 | `v1.2.3`、`1.2.3`、`1.2`、`latest`、`sha-<完整提交号>` |
当前 Docker 发布工作流会在 `main` 分支发布 `main` 和 `latest` 正式镜像,并在 `dev` 是日常调试通道,`main` 是稳定候选通道,两者都不会更新 `latest` 或创建 Release。推送
`codex/desktop-packaging` 分支发布 `desktop-packaging` 和 `alpha` 标签用于验收;其他开发分支 `v1.2.3` 格式的 Git 标签会触发统一正式发布流程。所有 Docker 发布都必须先通过 Go/前端测试,
不会自动生成 GHCR 标签。推送 `v1.2.3` 格式的 Git 标签会同时触发版本 Docker 镜像和 GitHub 再对每个原生架构镜像实际启动 Chromium 和服务并通过 `/health` 检查;正式版还必须等全部桌面
Release。所有 Docker 发布都必须先通过 Go/前端测试,再对每个原生架构镜像实际启动 Chromium 安装包构建成功并通过人工审批,之后才生成版本 manifest、更新 `latest` 并创建 GitHub Release。
和服务并通过 `/health` 检查,之后才会生成 `latest`、分支或版本 manifest。
生产环境建议使用明确的版本标签或 SHA 标签,避免上游更新导致未经验证的自动升级。 生产环境建议使用明确的版本标签或 SHA 标签,避免上游更新导致未经验证的自动升级。
+14 -2
View File
@@ -29,6 +29,7 @@ import (
"xianyu-go/internal/notify" "xianyu-go/internal/notify"
"xianyu-go/internal/renewal" "xianyu-go/internal/renewal"
"xianyu-go/internal/server" "xianyu-go/internal/server"
appversion "xianyu-go/internal/version"
) )
type serverOptions struct { type serverOptions struct {
@@ -51,6 +52,7 @@ type serverOptions struct {
adminEmail string adminEmail string
adminPassword string adminPassword string
service bool service bool
showVersion bool
} }
const ( const (
@@ -61,6 +63,10 @@ const (
func main() { func main() {
opts := parseOptions() opts := parseOptions()
if opts.showVersion {
fmt.Printf("Ydisks Xianyu Helper %s (commit %s, built %s)\n", appversion.Version, appversion.ShortCommit(), appversion.BuildTime)
return
}
if opts.workDir != "" { if opts.workDir != "" {
if err := os.Chdir(opts.workDir); err != nil { if err := os.Chdir(opts.workDir); err != nil {
fmt.Fprintf(os.Stderr, "切换工作目录失败: %v\n", err) fmt.Fprintf(os.Stderr, "切换工作目录失败: %v\n", err)
@@ -106,6 +112,7 @@ func parseOptions() serverOptions {
flag.StringVar(&opts.adminEmail, "admin-email", "admin@example.com", "初始化 admin 的邮箱") flag.StringVar(&opts.adminEmail, "admin-email", "admin@example.com", "初始化 admin 的邮箱")
flag.StringVar(&opts.adminPassword, "admin-password", "", "初始化/重置 admin 密码;也可用 XIANYU_ADMIN_PASSWORD 环境变量") flag.StringVar(&opts.adminPassword, "admin-password", "", "初始化/重置 admin 密码;也可用 XIANYU_ADMIN_PASSWORD 环境变量")
flag.BoolVar(&opts.service, "service", false, "以 Windows Service 模式运行") flag.BoolVar(&opts.service, "service", false, "以 Windows Service 模式运行")
flag.BoolVar(&opts.showVersion, "version", false, "显示版本和构建信息后退出")
flag.Parse() flag.Parse()
return opts return opts
} }
@@ -118,6 +125,7 @@ func runServer(parent context.Context, opts serverOptions) error {
if err != nil { if err != nil {
return err return err
} }
packagedPlaywrightRuntime := strings.TrimSpace(opts.playwrightRuntimeRoot) != ""
applyPlaywrightRuntimeRoot(&opts) applyPlaywrightRuntimeRoot(&opts)
if dataDir != "" { if dataDir != "" {
if err := os.MkdirAll(dataDir, 0o700); err != nil { if err := os.MkdirAll(dataDir, 0o700); err != nil {
@@ -126,10 +134,14 @@ func runServer(parent context.Context, opts serverOptions) error {
if opts.dataKeyFile == "" { if opts.dataKeyFile == "" {
opts.dataKeyFile = filepath.Join(dataDir, defaultDataKeyName) opts.dataKeyFile = filepath.Join(dataDir, defaultDataKeyName)
} }
if opts.playwrightDriverDir == "" { // 只有安装包显式提供 runtime root 时,才把 Playwright runtime
// 放进应用数据目录。普通本地开发应沿用 Playwright 的用户缓存;
// 空的应用目录会让 playwright-go 误以为 driver 已配置,随后尝试
// 执行不存在的 <dataDir>/playwright-driver/node。
if packagedPlaywrightRuntime && opts.playwrightDriverDir == "" {
opts.playwrightDriverDir = filepath.Join(dataDir, "playwright-driver") opts.playwrightDriverDir = filepath.Join(dataDir, "playwright-driver")
} }
if opts.playwrightBrowserDir == "" { if packagedPlaywrightRuntime && opts.playwrightBrowserDir == "" {
opts.playwrightBrowserDir = filepath.Join(dataDir, "playwright-browsers") opts.playwrightBrowserDir = filepath.Join(dataDir, "playwright-browsers")
} }
} }
+2
View File
@@ -24,6 +24,8 @@ import (
type healthResponse struct { type healthResponse struct {
Status string `json:"status"` Status string `json:"status"`
Database string `json:"database"` Database string `json:"database"`
Version string `json:"version"`
Commit string `json:"commit"`
} }
var serviceURL = strings.TrimRight(envOr("XIANYU_SERVICE_URL", "http://127.0.0.1:59188"), "/") var serviceURL = strings.TrimRight(envOr("XIANYU_SERVICE_URL", "http://127.0.0.1:59188"), "/")
+10
View File
@@ -96,6 +96,9 @@ distance = track.width - button.width
- 页面加载后随机等待 `0.3–0.8s`,移动鼠标到 `(640, 360)`,滚动 `200–500px`,并保留现有短暂停顿。 - 页面加载后随机等待 `0.3–0.8s`,移动鼠标到 `(640, 360)`,滚动 `200–500px`,并保留现有短暂停顿。
- 页面包含“抱歉,页面访问出现了问题”时,判定验证链接过期。 - 页面包含“抱歉,页面访问出现了问题”时,判定验证链接过期。
- 页面包含 `STATUS_BREAKPOINT` 或“崩溃”时,判定验证页崩溃。 - 页面包含 `STATUS_BREAKPOINT` 或“崩溃”时,判定验证页崩溃。
- 页面准备完成后、首次滑动前必须先判定页面类型:只有同一 frame 内存在可见的滑块按钮和轨道时才进入滑动逻辑。
- 如果没有可见滑块,并且任一 frame 的可见正文直接显示“验证失败”“安全验证未通过”“请求/加载失败”“系统繁忙”“服务/网络/页面异常”“请稍后重试”或对应英文错误提示,则判定为无可验证滑块的直接错误页,立即停止自动验证。
- 直接错误页不得通过点击错误框、reload 或备用引擎强行转成滑块尝试;只有已经实际拖动过滑块后出现的 `.errloading` 才继续按第 5 节恢复。
- 拖动前必须保存所有域上的旧 `x5sec` 值,供严格成功判定使用。 - 拖动前必须保存所有域上的旧 `x5sec` 值,供严格成功判定使用。
### 3.2 距离计算 ### 3.2 距离计算
@@ -199,6 +202,7 @@ Playwright 主引擎
- 获取新验证链接的 provider 不得在主引擎持有同账号持久化 profile 锁时调用,避免同账号锁死。 - 获取新验证链接的 provider 不得在主引擎持有同账号持久化 profile 锁时调用,避免同账号锁死。
- 过期链接最多触发现有的 2 次链接刷新;最终仍过期时直接失败,不把过期 URL 交给备用引擎重放。 - 过期链接最多触发现有的 2 次链接刷新;最终仍过期时直接失败,不把过期 URL 交给备用引擎重放。
- 主引擎判定为“没有可见滑块的直接错误页”时立即失败,不刷新链接,也不进入直接 Chromium/CDP 备用引擎。
- 进入备用引擎前可再获取一次新链接和更新后的 Cookie。 - 进入备用引擎前可再获取一次新链接和更新后的 Cookie。
- `CAPTCHA_REAL_MOUSE=true` 在当前 Go/Docker 实现中只记录物理鼠标不可用,并继续备用逻辑;不得假装已启用物理鼠标。 - `CAPTCHA_REAL_MOUSE=true` 在当前 Go/Docker 实现中只记录物理鼠标不可用,并继续备用逻辑;不得假装已启用物理鼠标。
- `CAPTCHA_DRISSIONPAGE_FALLBACK_ENABLED` 默认为启用。 - `CAPTCHA_DRISSIONPAGE_FALLBACK_ENABLED` 默认为启用。
@@ -242,6 +246,7 @@ Playwright 主引擎
- 最终 `left`、最终 class 或最终 X 偏移。 - 最终 `left`、最终 class 或最终 X 偏移。
- 失败时的按钮 style/class、轨道 class、可见重试选择器和重试文本。 - 失败时的按钮 style/class、轨道 class、可见重试选择器和重试文本。
- 恢复方式是 `click` 还是 `reload`、所用选择器以及是否重新归位。 - 恢复方式是 `click` 还是 `reload`、所用选择器以及是否重新归位。
- 自动滑块最终失败时,错误文本和 `token 风控滑块处理失败` 日志的 `verification_url` 字段必须包含最后实际使用的完整验证地址(包括 query),供用户复制到本机浏览器手动验证。此字段是仅在最终失败时提供的人工接管信息;常规页面/frame 诊断日志仍必须去掉 query 与 fragment。
页面可能被浏览器扩展注入大量无关 DOM。当前仅把下列注入作为诊断信息记录,不允许它们改变滑块定位、距离或成功判定: 页面可能被浏览器扩展注入大量无关 DOM。当前仅把下列注入作为诊断信息记录,不允许它们改变滑块定位、距离或成功判定:
@@ -268,6 +273,7 @@ go vet ./internal/browser ./internal/engine ./internal/account ./internal/server
- 主引擎首次滑动成功。 - 主引擎首次滑动成功。
- 主引擎首次失败并隐藏滑块,点击 `.errloading` 恢复后第二次成功。 - 主引擎首次失败并隐藏滑块,点击 `.errloading` 恢复后第二次成功。
- 直接 Chromium/CDP 备用引擎使用同一恢复流程后成功。 - 直接 Chromium/CDP 备用引擎使用同一恢复流程后成功。
- 没有可见滑块、只显示直接错误提示的真实 Chromium 页面必须被识别,并且不得进入滑动或备用引擎。
- 标准 `300px` 轨道与 `42px` 按钮得到精确 `258px`。 - 标准 `300px` 轨道与 `42px` 按钮得到精确 `258px`。
- 旧 `x5sec` 不得判成功,新 `x5sec` 才能判成功。 - 旧 `x5sec` 不得判成功,新 `x5sec` 才能判成功。
@@ -275,6 +281,10 @@ go vet ./internal/browser ./internal/engine ./internal/account ./internal/server
## 10. 唯一变更流程 ## 10. 唯一变更流程
### 2026-08-13 当前授权变更
用户明确要求改变“未找到滑块时仍执行失败恢复/备用引擎”和“最终失败日志只保留脱敏页面地址”的既有契约。原因是风控页有时只显示平台错误信息而没有可操作滑块,继续 reload、拖动或切换引擎没有验证意义且会增加风控;而真实滑块自动处理失败时,用户需要完整地址在本机浏览器中接管验证。本规范第 3.1、6、8、9 节已同步纳入新的页面分类、编排、日志和集成验证要求。
只有用户在当前任务中明确点名要求修改滑块认证时,才允许触碰冻结范围。获得授权后也必须在同一个变更中: 只有用户在当前任务中明确点名要求修改滑块认证时,才允许触碰冻结范围。获得授权后也必须在同一个变更中:
1. 说明要改变本文哪一条冻结契约及原因。 1. 说明要改变本文哪一条冻结契约及原因。
+9 -1
View File
@@ -50,6 +50,7 @@ const AccountList: React.FC = () => {
const [showQRModal, setShowQRModal] = useState(false); const [showQRModal, setShowQRModal] = useState(false);
const [qrCodeUrl, setQrCodeUrl] = useState<string>(''); const [qrCodeUrl, setQrCodeUrl] = useState<string>('');
const [qrStatus, setQrStatus] = useState<string>('pending'); const [qrStatus, setQrStatus] = useState<string>('pending');
const [qrErrorMessage, setQrErrorMessage] = useState<string>('');
const [verificationScreenshot, setVerificationScreenshot] = useState<string>(''); const [verificationScreenshot, setVerificationScreenshot] = useState<string>('');
const [faceQrUrl, setFaceQrUrl] = useState<string>(''); const [faceQrUrl, setFaceQrUrl] = useState<string>('');
const [qrReauthTarget, setQrReauthTarget] = useState<AccountDetail | null>(null); const [qrReauthTarget, setQrReauthTarget] = useState<AccountDetail | null>(null);
@@ -624,12 +625,16 @@ const AccountList: React.FC = () => {
setQrReauthTarget(targetAccount); setQrReauthTarget(targetAccount);
setShowQRModal(true); setShowQRModal(true);
setQrStatus('loading'); setQrStatus('loading');
setQrErrorMessage('');
setQrCodeUrl(''); setQrCodeUrl('');
setVerificationScreenshot(''); setVerificationScreenshot('');
setFaceQrUrl(''); setFaceQrUrl('');
try { try {
const res = await generateQRLogin({ signal: controller.signal }); const res = await generateQRLogin({ signal: controller.signal });
if (!qrRequestGateRef.current?.isCurrent(requestGeneration)) return; if (!qrRequestGateRef.current?.isCurrent(requestGeneration)) return;
if (!res.success || !res.qr_code_url || !res.session_id) {
throw new Error(res.message || '闲鱼未返回可用的登录二维码');
}
if (res.success && res.qr_code_url && res.session_id) { if (res.success && res.qr_code_url && res.session_id) {
const generatedSessionID = res.session_id; const generatedSessionID = res.session_id;
setQrCodeUrl(res.qr_code_url); setQrCodeUrl(res.qr_code_url);
@@ -674,7 +679,10 @@ const AccountList: React.FC = () => {
} }
} catch (e) { } catch (e) {
if (!qrRequestGateRef.current?.isCurrent(requestGeneration)) return; if (!qrRequestGateRef.current?.isCurrent(requestGeneration)) return;
setQrErrorMessage(e instanceof Error ? e.message : '二维码获取失败,请稍后重试');
setQrStatus('error'); setQrStatus('error');
} finally {
if (qrGenerateAbortRef.current === controller) qrGenerateAbortRef.current = null;
} }
}; };
@@ -1029,7 +1037,7 @@ const AccountList: React.FC = () => {
{qrStatus === 'error' && ( {qrStatus === 'error' && (
<div className="px-5 text-center"> <div className="px-5 text-center">
<span className="block text-red-600 font-bold">二维码获取失败</span> <span className="block text-red-600 font-bold">二维码获取失败</span>
<span className="mt-2 block text-xs leading-5 text-gray-500">请关闭窗口后重新发起扫码登录。</span> <span className="mt-2 block text-xs leading-5 text-gray-500">{qrErrorMessage || '请关闭窗口后重新发起扫码登录。'}</span>
</div> </div>
)} )}
{qrStatus === 'verification' && ( {qrStatus === 'verification' && (
+72 -26
View File
@@ -1,7 +1,7 @@
import React from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Bell, Box, ChevronLeft, ChevronRight, CreditCard, LayoutDashboard, Bell, Box, ChevronLeft, ChevronRight, CreditCard, LayoutDashboard,
LogOut, MessageCircleMore, Settings, ShoppingBag, Users, Zap, GitCommitHorizontal, LogOut, MessageCircleMore, Settings, ShoppingBag, Users, Zap,
} from 'lucide-react'; } from 'lucide-react';
import { YdisksBrandIcon } from './YdisksLogo'; import { YdisksBrandIcon } from './YdisksLogo';
@@ -14,9 +14,30 @@ interface SidebarProps {
onLogout: () => void; onLogout: () => void;
} }
interface BuildInfo {
version: string;
commit: string;
}
const Sidebar: React.FC<SidebarProps> = ({ const Sidebar: React.FC<SidebarProps> = ({
activeTab, isAdmin = false, collapsed, onToggleCollapsed, onNavigate, onLogout, activeTab, isAdmin = false, collapsed, onToggleCollapsed, onNavigate, onLogout,
}) => { }) => {
const [buildInfo, setBuildInfo] = useState<BuildInfo>({ version: 'dev', commit: 'unknown' });
useEffect(() => {
const controller = new AbortController();
fetch('/health', { signal: controller.signal })
.then(response => response.ok ? response.json() : Promise.reject(new Error('health request failed')))
.then(data => setBuildInfo({
version: String(data.version || 'dev'),
commit: String(data.commit || 'unknown'),
}))
.catch(error => {
if (error instanceof DOMException && error.name === 'AbortError') return;
});
return () => controller.abort();
}, []);
const menuItems = [ const menuItems = [
{ id: 'dashboard', icon: LayoutDashboard, label: '仪表盘' }, { id: 'dashboard', icon: LayoutDashboard, label: '仪表盘' },
{ id: 'accounts', icon: Users, label: '账号管理' }, { id: 'accounts', icon: Users, label: '账号管理' },
@@ -28,6 +49,9 @@ const Sidebar: React.FC<SidebarProps> = ({
{ id: 'notifications', icon: Bell, label: '通知设置' }, { id: 'notifications', icon: Bell, label: '通知设置' },
...(isAdmin ? [{ id: 'settings', icon: Settings, label: '系统与AI' }] : []), ...(isAdmin ? [{ id: 'settings', icon: Settings, label: '系统与AI' }] : []),
]; ];
const displayVersion = /^\d+\.\d+\.\d+$/.test(buildInfo.version)
? `v${buildInfo.version}`
: buildInfo.version;
return ( return (
<aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-sidebar backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}> <aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-sidebar backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}>
@@ -41,13 +65,13 @@ const Sidebar: React.FC<SidebarProps> = ({
)} )}
</div> </div>
<nav className={`flex-1 space-y-1.5 overflow-y-auto py-5 ${collapsed ? 'px-2' : 'px-3'}`} aria-label="主导航"> <nav className={`flex-1 space-y-1.5 overflow-y-auto pt-5 ${collapsed ? 'px-2' : 'px-3'}`} aria-label="主导航">
{menuItems.map((item) => { {menuItems.map((item) => {
const Icon = item.icon; const Icon = item.icon;
const active = activeTab === item.id; const active = activeTab === item.id;
return ( return (
<button <React.Fragment key={item.id}>
key={item.id} <button
type="button" type="button"
title={collapsed ? item.label : undefined} title={collapsed ? item.label : undefined}
aria-label={item.label} aria-label={item.label}
@@ -62,32 +86,54 @@ const Sidebar: React.FC<SidebarProps> = ({
<Icon className={`h-[19px] w-[19px] shrink-0 ${active ? 'text-white' : 'text-slate-400 group-hover:text-slate-700'}`} /> <Icon className={`h-[19px] w-[19px] shrink-0 ${active ? 'text-white' : 'text-slate-400 group-hover:text-slate-700'}`} />
{!collapsed && <span className="truncate text-sm font-bold">{item.label}</span>} {!collapsed && <span className="truncate text-sm font-bold">{item.label}</span>}
{active && !collapsed && <span className="ml-auto h-1.5 w-1.5 rounded-full bg-white/90" />} {active && !collapsed && <span className="ml-auto h-1.5 w-1.5 rounded-full bg-white/90" />}
</button> </button>
</React.Fragment>
); );
})} })}
</nav> </nav>
<div className={`space-y-2 border-t border-slate-100 p-2 ${collapsed ? '' : 'p-3'}`}> <div>
<button <div
type="button" title={collapsed ? `版本 ${buildInfo.version} · ${buildInfo.commit}` : undefined}
onClick={onToggleCollapsed} className={`border-y border-slate-100 bg-slate-50/70 py-2.5 ${collapsed ? 'flex justify-center px-1' : 'px-6'}`}
title={collapsed ? '展开侧边栏' : '收起侧边栏'}
aria-label={collapsed ? '展开侧边栏' : '收起侧边栏'}
className={`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-900 ${collapsed ? 'justify-center' : 'gap-3 px-3'}`}
> >
{collapsed ? <ChevronRight className="h-5 w-5" /> : <ChevronLeft className="h-5 w-5" />} {collapsed ? (
{!collapsed && <span className="text-sm font-bold">收起侧边栏</span>} <GitCommitHorizontal className="h-[18px] w-[18px] text-slate-400" aria-label={`版本 ${buildInfo.version}`} />
</button> ) : (
<button <div className="min-w-0">
type="button" <div className="flex items-center gap-2 text-[10px] font-extrabold uppercase tracking-[0.18em] text-slate-400">
onClick={onLogout} <GitCommitHorizontal className="h-3.5 w-3.5" />
title={collapsed ? '退出登录' : undefined} 运行版本
aria-label="退出登录" </div>
className={`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-red-50 hover:text-red-600 ${collapsed ? 'justify-center' : 'gap-3 px-3'}`} <div className="mt-1 flex items-baseline gap-2">
> <span className="truncate font-mono text-xs font-bold text-slate-700">{displayVersion}</span>
<LogOut className="h-5 w-5" /> <span className="truncate font-mono text-[10px] text-slate-400">{buildInfo.commit}</span>
{!collapsed && <span className="text-sm font-bold">退出登录</span>} </div>
</button> </div>
)}
</div>
<div className={`space-y-2 p-2 ${collapsed ? '' : 'p-3'}`}>
<button
type="button"
onClick={onToggleCollapsed}
title={collapsed ? '展开侧边栏' : '收起侧边栏'}
aria-label={collapsed ? '展开侧边栏' : '收起侧边栏'}
className={`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-900 ${collapsed ? 'justify-center' : 'gap-3 px-3'}`}
>
{collapsed ? <ChevronRight className="h-5 w-5" /> : <ChevronLeft className="h-5 w-5" />}
{!collapsed && <span className="text-sm font-bold">收起侧边栏</span>}
</button>
<button
type="button"
onClick={onLogout}
title={collapsed ? '退出登录' : undefined}
aria-label="退出登录"
className={`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-red-50 hover:text-red-600 ${collapsed ? 'justify-center' : 'gap-3 px-3'}`}
>
<LogOut className="h-5 w-5" />
{!collapsed && <span className="text-sm font-bold">退出登录</span>}
</button>
</div>
</div> </div>
</aside> </aside>
); );
+3 -2
View File
@@ -163,8 +163,9 @@ export const getAccountRuntimeStatuses = async (options?: RequestControlOptions)
return get('/cookies/runtime-status', undefined, options); return get('/cookies/runtime-status', undefined, options);
}; };
export const generateQRLogin = async (options?: RequestControlOptions): Promise<{ success: boolean; session_id?: string; qr_code_url?: string }> => { export const generateQRLogin = async (options?: RequestControlOptions): Promise<{ success: boolean; session_id?: string; qr_code_url?: string; message?: string }> => {
return post('/qr-login/generate', undefined, options); // 风控后匿名 token 接口可能超过通用的 30 秒请求窗口;后端总生成窗口为 2 分钟。
return post('/qr-login/generate', undefined, { ...options, timeoutMs: options?.timeoutMs ?? 130_000 });
}; };
export const checkQRLoginStatus = async (sessionId: string, signal?: AbortSignal): Promise<any> => { export const checkQRLoginStatus = async (sessionId: string, signal?: AbortSignal): Promise<any> => {
+9
View File
@@ -159,6 +159,15 @@ func (m *Manager) Sender(cookieID string) (automation.MessageSender, bool) {
return m.GetInstance(cookieID) return m.GetInstance(cookieID)
} }
// RecoverExpiredCredential 把任意上层 MTOP API 检测到的 Session 失效统一
// 转交给账号 Handler 的协议续期流程。调用方必须先释放账号凭证锁。
func (m *Manager) RecoverExpiredCredential(ctx context.Context, cookieID string) bool {
if m == nil || m.handler == nil {
return false
}
return m.handler.OnPasswordLoginRefresh(ctx, cookieID)
}
// RuntimeStatuses 返回所有已启动账号的实时状态快照。 // RuntimeStatuses 返回所有已启动账号的实时状态快照。
func (m *Manager) RuntimeStatuses() map[string]engine.RuntimeStatus { func (m *Manager) RuntimeStatuses() map[string]engine.RuntimeStatus {
m.mu.Lock() m.mu.Lock()
+5 -1
View File
@@ -276,7 +276,11 @@ func (a *Adapter) OnTokenCaptchaVerification(ctx context.Context, cookieID, cook
} }
} }
if err != nil { if err != nil {
a.logger.Warn("token 风控滑块处理失败", "account", cookieID, "err", err) manualURL := browser.TokenCaptchaManualVerificationURL(err)
if strings.TrimSpace(manualURL) == "" {
manualURL = verificationURL
}
a.logger.Warn("token 风控滑块处理失败", "account", cookieID, "err", err, "verification_url", manualURL)
if a.store != nil && a.store.RiskLogs != nil { if a.store != nil && a.store.RiskLogs != nil {
_ = a.store.RiskLogs.Update(ctx, logID, db.RiskControlLog{ _ = a.store.RiskLogs.Update(ctx, logID, db.RiskControlLog{
ProcessingStatus: "failed", ProcessingStatus: "failed",
+82 -5
View File
@@ -2,6 +2,7 @@ package automation
import ( import (
"context" "context"
"crypto/sha256"
"fmt" "fmt"
"strings" "strings"
"time" "time"
@@ -45,14 +46,32 @@ func (c *Center) RunAccountTask(ctx context.Context, accountID, taskType string)
if err != nil { if err != nil {
return AccountTaskSummary{TaskType: taskType}, err return AccountTaskSummary{TaskType: taskType}, err
} }
return c.runConfiguredAccountTask(ctx, settings, taskType)
}
func (c *Center) runConfiguredAccountTask(ctx context.Context, settings db.AccountTaskSettings, taskType string) (AccountTaskSummary, error) {
if blocked, err := c.accountTaskSessionBlocked(ctx, settings.CookieID); err != nil {
return AccountTaskSummary{TaskType: taskType}, err
} else if blocked {
return AccountTaskSummary{TaskType: taskType, Skipped: 1, Message: "Session 已失效,等待续期或重新登录"},
fmt.Errorf("账号 Session 已失效,已停止自动化 API 请求,等待续期或重新登录")
}
var (
summary AccountTaskSummary
err error
)
switch taskType { switch taskType {
case TaskAutoRate: case TaskAutoRate:
return c.runAutoRate(ctx, settings) summary, err = c.runAutoRate(ctx, settings)
case TaskAutoPolish: case TaskAutoPolish:
return c.runAutoPolish(ctx, settings, beijingNow(), true) summary, err = c.runAutoPolish(ctx, settings, beijingNow(), true)
default: default:
return AccountTaskSummary{TaskType: taskType}, fmt.Errorf("不支持的账号任务: %s", taskType) return AccountTaskSummary{TaskType: taskType}, fmt.Errorf("不支持的账号任务: %s", taskType)
} }
if err != nil && mtop.IsSessionExpiredErr(err) {
err = c.recoverAccountTaskSession(ctx, settings.CookieID, err)
}
return summary, err
} }
func (c *Center) scanAccountTasks(ctx context.Context) { func (c *Center) scanAccountTasks(ctx context.Context) {
@@ -70,19 +89,70 @@ func (c *Center) scanAccountTasks(ctx context.Context) {
if err != nil || !allowed { if err != nil || !allowed {
continue continue
} }
if blocked, blockErr := c.accountTaskSessionBlocked(ctx, setting.CookieID); blockErr != nil || blocked {
continue
}
if setting.AutoRateEnabled { if setting.AutoRateEnabled {
if _, err := c.runAutoRate(ctx, setting); err != nil { if _, err := c.runConfiguredAccountTask(ctx, setting, TaskAutoRate); err != nil {
c.logger.Warn("自动评价扫描失败", "account", setting.CookieID, "err", err) c.logger.Warn("自动评价扫描失败", "account", setting.CookieID, "err", err)
} }
} }
if setting.AutoPolishEnabled && polishDue(setting, now) { if setting.AutoPolishEnabled && polishDue(setting, now) {
if _, err := c.runAutoPolish(ctx, setting, now, false); err != nil { if blocked, _ := c.accountTaskSessionBlocked(ctx, setting.CookieID); blocked {
c.logger.Warn("每日擦亮失败", "account", setting.CookieID, "err", err) continue
}
_, taskErr := c.runAutoPolish(ctx, setting, now, false)
if taskErr != nil && mtop.IsSessionExpiredErr(taskErr) {
taskErr = c.recoverAccountTaskSession(ctx, setting.CookieID, taskErr)
}
if taskErr != nil {
c.logger.Warn("每日擦亮失败", "account", setting.CookieID, "err", taskErr)
} }
} }
} }
} }
func (c *Center) recoverAccountTaskSession(ctx context.Context, accountID string, sessionErr error) error {
fingerprint, fingerprintErr := c.accountCredentialFingerprint(ctx, accountID)
if fingerprintErr == nil {
c.sessionExpired.Store(accountID, fingerprint)
}
c.logger.Warn("自动化 API 检测到 Session 过期,停止后续请求并开始即时续期", "account", accountID, "err", sessionErr)
if c.recoverer != nil && c.recoverer.RecoverExpiredCredential(ctx, accountID) {
c.sessionExpired.Delete(accountID)
return fmt.Errorf("%w;Session 续期成功,本次自动化已停止,下一轮将使用新凭证", sessionErr)
}
return fmt.Errorf("%w;已停止该账号自动化 API 请求,等待续期或重新登录", sessionErr)
}
func (c *Center) accountTaskSessionBlocked(ctx context.Context, accountID string) (bool, error) {
blockedFingerprint, ok := c.sessionExpired.Load(accountID)
if !ok {
return false, nil
}
current, err := c.accountCredentialFingerprint(ctx, accountID)
if err != nil {
return true, err
}
if current != blockedFingerprint.(string) {
c.sessionExpired.Delete(accountID)
return false, nil
}
return true, nil
}
func (c *Center) accountCredentialFingerprint(ctx context.Context, accountID string) (string, error) {
detail, err := c.store.Cookies.GetDetails(ctx, accountID)
if err != nil {
return "", err
}
if detail == nil {
return "", db.ErrNotFound
}
sum := sha256.Sum256([]byte(detail.Value + "\x00" + detail.MetadataJSON))
return fmt.Sprintf("%x", sum[:]), nil
}
func (c *Center) runAutoRate(ctx context.Context, settings db.AccountTaskSettings) (AccountTaskSummary, error) { func (c *Center) runAutoRate(ctx context.Context, settings db.AccountTaskSettings) (AccountTaskSummary, error) {
summary := AccountTaskSummary{TaskType: TaskAutoRate} summary := AccountTaskSummary{TaskType: TaskAutoRate}
if c.accountTasks == nil { if c.accountTasks == nil {
@@ -125,6 +195,9 @@ func (c *Center) runAutoRate(ctx context.Context, settings db.AccountTaskSetting
} }
_ = c.store.AccountTasks.FinishRun(ctx, runKey, "failed", 0, 1, message, time.Now().UTC().Add(10*time.Minute).Unix()) _ = c.store.AccountTasks.FinishRun(ctx, runKey, "failed", 0, 1, message, time.Now().UTC().Add(10*time.Minute).Unix())
summary.Failed++ summary.Failed++
if mtop.IsSessionExpiredErr(rateErr) {
return summary, rateErr
}
continue continue
} }
current = c.persistTaskCookies(ctx, settings.CookieID, current, result.UpdatedCookies) current = c.persistTaskCookies(ctx, settings.CookieID, current, result.UpdatedCookies)
@@ -178,6 +251,10 @@ func (c *Center) runAutoPolish(ctx context.Context, settings db.AccountTaskSetti
if result != nil && result.Message != "" { if result != nil && result.Message != "" {
lastError = result.Message lastError = result.Message
} }
if mtop.IsSessionExpiredErr(polishErr) {
_ = c.store.AccountTasks.FinishRun(ctx, runKey, "failed", summary.Success, summary.Failed, lastError, 0)
return summary, polishErr
}
continue continue
} }
current = c.persistTaskCookies(ctx, settings.CookieID, current, result.UpdatedCookies) current = c.persistTaskCookies(ctx, settings.CookieID, current, result.UpdatedCookies)
+75
View File
@@ -3,6 +3,7 @@ package automation
import ( import (
"context" "context"
"errors" "errors"
"strings"
"testing" "testing"
"time" "time"
@@ -15,6 +16,8 @@ type fakeAccountTaskClient struct {
rateCalls int rateCalls int
polishCalls int polishCalls int
pending []mtop.PendingRateOrder pending []mtop.PendingRateOrder
pendingErr error
rateErr error
items []mtop.ItemListItem items []mtop.ItemListItem
fetchItemsErr error fetchItemsErr error
fetchPageSize int fetchPageSize int
@@ -24,11 +27,17 @@ type fakeAccountTaskClient struct {
func (f *fakeAccountTaskClient) FetchPendingRateOrders(context.Context, string, int, int) (*mtop.PendingRateResult, error) { func (f *fakeAccountTaskClient) FetchPendingRateOrders(context.Context, string, int, int) (*mtop.PendingRateResult, error) {
f.pendingCalls++ f.pendingCalls++
if f.pendingErr != nil {
return nil, f.pendingErr
}
return &mtop.PendingRateResult{Orders: f.pending}, nil return &mtop.PendingRateResult{Orders: f.pending}, nil
} }
func (f *fakeAccountTaskClient) RateBuyer(context.Context, string, string, string) (*mtop.AccountTaskResult, error) { func (f *fakeAccountTaskClient) RateBuyer(context.Context, string, string, string) (*mtop.AccountTaskResult, error) {
f.rateCalls++ f.rateCalls++
if f.rateErr != nil {
return nil, f.rateErr
}
return &mtop.AccountTaskResult{Success: true, Message: "ok"}, nil return &mtop.AccountTaskResult{Success: true, Message: "ok"}, nil
} }
@@ -69,6 +78,72 @@ func TestAccountTaskRateIsOrderIdempotent(t *testing.T) {
} }
} }
func TestAccountTaskSessionExpiredRecoversOnceAndBlocksFurtherAPIRequests(t *testing.T) {
store, cleanup := newAutomationTestStore(t)
defer cleanup()
ctx := context.Background()
sessionErr := &mtop.SessionExpiredError{API: "自动评价接口", Ret: []string{"FAIL_SYS_SESSION_EXPIRED::Session过期"}}
client := &fakeAccountTaskClient{pendingErr: sessionErr}
recoverer := &fakeCredentialRecoverer{store: store, fail: true}
center := New(store, testSenderProvider{sender: &testSender{}}, nil)
center.SetAccountTaskClient(client)
center.SetOrderDetailFetcher(recoverer)
if err := store.AccountTasks.Upsert(ctx, db.AccountTaskSettings{CookieID: "cid", AutoRateEnabled: true,
RateContent: "交易愉快", PolishTime: "03:00"}); err != nil {
t.Fatal(err)
}
if _, err := center.RunAccountTask(ctx, "cid", TaskAutoRate); err == nil || !mtop.IsSessionExpiredErr(err) {
t.Fatalf("首次 session 失效应触发续期并返回原始分类错误: %v", err)
}
if client.pendingCalls != 1 || recoverer.calls != 1 {
t.Fatalf("first calls: api=%d recover=%d want 1/1", client.pendingCalls, recoverer.calls)
}
if _, err := center.RunAccountTask(ctx, "cid", TaskAutoRate); err == nil || !strings.Contains(err.Error(), "已停止自动化 API 请求") {
t.Fatalf("未更新凭证时应保持阻断: %v", err)
}
if client.pendingCalls != 1 || recoverer.calls != 1 {
t.Fatalf("blocked run must not call API/recovery again: api=%d recover=%d", client.pendingCalls, recoverer.calls)
}
if err := store.Cookies.UpdateValueExisting(ctx, "cid", "unb=1; _m_h5_tk=fresh_1; renewed=1"); err != nil {
t.Fatal(err)
}
client.pendingErr = nil
if _, err := center.RunAccountTask(ctx, "cid", TaskAutoRate); err != nil {
t.Fatalf("凭证变化后应自动解除阻断: %v", err)
}
if client.pendingCalls != 2 {
t.Fatalf("api calls after credential update=%d want 2", client.pendingCalls)
}
}
func TestAccountTaskStopsRemainingOrdersOnSessionExpired(t *testing.T) {
store, cleanup := newAutomationTestStore(t)
defer cleanup()
ctx := context.Background()
sessionErr := &mtop.SessionExpiredError{API: "评价接口", Ret: []string{"FAIL_SYS_SESSION_EXPIRED::Session过期"}}
client := &fakeAccountTaskClient{
pending: []mtop.PendingRateOrder{{TradeID: "order-1"}, {TradeID: "order-2"}},
rateErr: sessionErr,
}
recoverer := &fakeCredentialRecoverer{store: store, fail: true}
center := New(store, testSenderProvider{sender: &testSender{}}, nil)
center.SetAccountTaskClient(client)
center.SetOrderDetailFetcher(recoverer)
if err := store.AccountTasks.Upsert(ctx, db.AccountTaskSettings{CookieID: "cid", AutoRateEnabled: true,
RateContent: "交易愉快", PolishTime: "03:00"}); err != nil {
t.Fatal(err)
}
if _, err := center.RunAccountTask(ctx, "cid", TaskAutoRate); err == nil {
t.Fatal("session expiry must be returned")
}
if client.rateCalls != 1 || recoverer.calls != 1 {
t.Fatalf("remaining orders must stop immediately: rate=%d recover=%d", client.rateCalls, recoverer.calls)
}
}
func TestAccountTaskPolishRunsOncePerBeijingDay(t *testing.T) { func TestAccountTaskPolishRunsOncePerBeijingDay(t *testing.T) {
store, cleanup := newAutomationTestStore(t) store, cleanup := newAutomationTestStore(t)
defer cleanup() defer cleanup()
+3
View File
@@ -96,6 +96,9 @@ type Center struct {
logger *slog.Logger logger *slog.Logger
cookieSrc func(context.Context, string) (string, error) cookieSrc func(context.Context, string) (string, error)
cardLocks sync.Map cardLocks sync.Map
// sessionExpired 保存检测到 Session 失效时的凭证指纹。在凭证续期或
// 重新登录真正改变之前,账号任务不得再次调用任何 MTOP 业务接口。
sessionExpired sync.Map
} }
// New 构造自动化中心。 // New 构造自动化中心。
+99 -4
View File
@@ -30,6 +30,53 @@ type TokenCaptchaURLProvider func(ctx context.Context, currentCookies string) (u
type tokenCaptchaEngineFunc func(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, provider TokenCaptchaURLProvider) (string, error) type tokenCaptchaEngineFunc func(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, provider TokenCaptchaURLProvider) (string, error)
var errTokenCaptchaURLExpired = errors.New("token 风控验证链接已过期") var errTokenCaptchaURLExpired = errors.New("token 风控验证链接已过期")
var errTokenCaptchaDirectPageError = errors.New("token 风控页面直接显示错误且没有可验证滑块")
// TokenCaptchaFailureError 保留自动验证失败时最后实际使用的完整验证地址,
// 便于用户复制到本机浏览器中手动完成验证。
type TokenCaptchaFailureError struct {
VerificationURL string
Cause error
}
func (e *TokenCaptchaFailureError) Error() string {
if e == nil {
return ""
}
if e.Cause == nil {
if strings.TrimSpace(e.VerificationURL) == "" {
return "token 风控自动验证失败"
}
return fmt.Sprintf("token 风控自动验证失败;手动验证地址: %s", e.VerificationURL)
}
if strings.TrimSpace(e.VerificationURL) == "" {
return e.Cause.Error()
}
return fmt.Sprintf("%v;手动验证地址: %s", e.Cause, e.VerificationURL)
}
func (e *TokenCaptchaFailureError) Unwrap() error {
if e == nil {
return nil
}
return e.Cause
}
// TokenCaptchaManualVerificationURL 从自动验证失败中提取可供用户手动打开的完整地址。
func TokenCaptchaManualVerificationURL(err error) string {
var failure *TokenCaptchaFailureError
if errors.As(err, &failure) {
return failure.VerificationURL
}
return ""
}
func tokenCaptchaFailure(err error, verificationURL string) error {
if err == nil {
return nil
}
return &TokenCaptchaFailureError{VerificationURL: strings.TrimSpace(verificationURL), Cause: err}
}
// TokenCaptchaRecover solves a token-refresh captcha and returns cookies with x5sec merged in. // TokenCaptchaRecover solves a token-refresh captcha and returns cookies with x5sec merged in.
func (m *Manager) TokenCaptchaRecover(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, provider TokenCaptchaURLProvider) (string, error) { func (m *Manager) TokenCaptchaRecover(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, provider TokenCaptchaURLProvider) (string, error) {
@@ -77,8 +124,8 @@ func (m *Manager) TokenCaptchaRecoverWithEngine(ctx context.Context, cookieID, c
primaryURL = freshURL primaryURL = freshURL
} }
// An expired URL cannot be repaired by replaying it through the fallback. // An expired URL cannot be repaired by replaying it through the fallback.
if errors.Is(primaryErr, errTokenCaptchaURLExpired) { if errors.Is(primaryErr, errTokenCaptchaURLExpired) || errors.Is(primaryErr, errTokenCaptchaDirectPageError) {
return "", "", primaryErr return "", "", tokenCaptchaFailure(primaryErr, primaryURL)
} }
if realMouseRequested() { if realMouseRequested() {
@@ -87,7 +134,7 @@ func (m *Manager) TokenCaptchaRecoverWithEngine(ctx context.Context, cookieID, c
m.logger.Error("CAPTCHA_REAL_MOUSE 已开启但物理鼠标引擎不可用,回退备用滑块逻辑", "goos", runtime.GOOS) m.logger.Error("CAPTCHA_REAL_MOUSE 已开启但物理鼠标引擎不可用,回退备用滑块逻辑", "goos", runtime.GOOS)
} }
if !drissionFallbackEnabled() { if !drissionFallbackEnabled() {
return "", "playwright", primaryErr return "", "playwright", tokenCaptchaFailure(primaryErr, primaryURL)
} }
fallbackURL := verificationURL fallbackURL := verificationURL
@@ -121,7 +168,10 @@ func (m *Manager) TokenCaptchaRecoverWithEngine(ctx context.Context, cookieID, c
if fallbackErr == nil { if fallbackErr == nil {
fallbackErr = fmt.Errorf("备用滑块引擎未获取到新的 x5sec Cookie") fallbackErr = fmt.Errorf("备用滑块引擎未获取到新的 x5sec Cookie")
} }
return "", "", fmt.Errorf("Playwright 主引擎失败: %v;备用滑块引擎失败: %w", primaryErr, fallbackErr) return "", "", tokenCaptchaFailure(
fmt.Errorf("Playwright 主引擎失败: %v;备用滑块引擎失败: %w", primaryErr, fallbackErr),
fallbackURL,
)
} }
func (m *Manager) tokenCaptchaPlaywrightRecover(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, _ TokenCaptchaURLProvider) (string, error) { func (m *Manager) tokenCaptchaPlaywrightRecover(ctx context.Context, cookieID, cookieStr, verificationURL string, headless bool, _ TokenCaptchaURLProvider) (string, error) {
@@ -176,6 +226,10 @@ func (m *Manager) tokenCaptchaPlaywrightRecover(ctx context.Context, cookieID, c
if strings.Contains(content, "STATUS_BREAKPOINT") || strings.Contains(content, "崩溃") { if strings.Contains(content, "STATUS_BREAKPOINT") || strings.Contains(content, "崩溃") {
return "", fmt.Errorf("token 风控验证页面崩溃") return "", fmt.Errorf("token 风控验证页面崩溃")
} }
if pageErr := tokenCaptchaDirectPageError(page); pageErr != nil {
m.logger.Warn("token 风控页面没有可验证滑块,停止自动验证", "cookieID", cookieID, "err", pageErr)
return "", pageErr
}
scratch := isScratchCaptcha(content) scratch := isScratchCaptcha(content)
if err := solveSliderStrict(page, scratch, m.logger, previousX5SecValues, browserDeadline); err != nil { if err := solveSliderStrict(page, scratch, m.logger, previousX5SecValues, browserDeadline); err != nil {
@@ -255,6 +309,47 @@ func captchaURLExpired(content string) bool {
return strings.Contains(content, "抱歉,页面访问出现了问题") return strings.Contains(content, "抱歉,页面访问出现了问题")
} }
func tokenCaptchaDirectPageError(page playwright.Page) error {
if page == nil {
return nil
}
if _, _, _, err := findSliderElements(page); err == nil {
return nil
}
frames := append([]playwright.Frame{page.MainFrame()}, page.Frames()...)
for _, frame := range frames {
body, err := frame.QuerySelector("body")
if err != nil || body == nil {
continue
}
text, err := body.InnerText()
if err != nil {
continue
}
if tokenCaptchaDirectErrorText(text) {
return fmt.Errorf("%w: %s", errTokenCaptchaDirectPageError, truncateSliderText(text))
}
}
return nil
}
func tokenCaptchaDirectErrorText(text string) bool {
normalized := strings.ToLower(strings.Join(strings.Fields(text), " "))
if normalized == "" {
return false
}
for _, marker := range []string{
"验证失败", "安全验证未通过", "请求失败", "加载失败", "系统繁忙", "服务异常", "网络异常",
"页面异常", "页面出错", "发生错误", "请稍后重试", "something's wrong", "something went wrong",
"please refresh and try again", "try again later",
} {
if strings.Contains(normalized, marker) {
return true
}
}
return false
}
func waitForFreshX5SecCookie(ctx context.Context, reader browserCookieReader, previousValues map[string]struct{}, timeout, pollInterval time.Duration) (map[string]string, error) { func waitForFreshX5SecCookie(ctx context.Context, reader browserCookieReader, previousValues map[string]struct{}, timeout, pollInterval time.Duration) (map[string]string, error) {
if timeout <= 0 || pollInterval <= 0 { if timeout <= 0 || pollInterval <= 0 {
return nil, fmt.Errorf("等待 x5sec Cookie 的超时和轮询间隔必须大于 0") return nil, fmt.Errorf("等待 x5sec Cookie 的超时和轮询间隔必须大于 0")
@@ -112,6 +112,10 @@ func (m *Manager) tokenCaptchaCDPFallback(ctx context.Context, cookieID, cookieS
if err := sleepUntil(ctx, deadline, secondsDuration(randomFloat(1, 3))); err != nil { if err := sleepUntil(ctx, deadline, secondsDuration(randomFloat(1, 3))); err != nil {
return "", err return "", err
} }
if pageErr := tokenCaptchaDirectPageError(page); pageErr != nil {
m.logger.Warn("备用滑块引擎页面没有可验证滑块,停止自动验证", "cookieID", cookieID, "err", pageErr)
return "", pageErr
}
for attempt := 0; attempt < 3; attempt++ { for attempt := 0; attempt < 3; attempt++ {
if err := contextDeadlineError(ctx, deadline); err != nil { if err := contextDeadlineError(ctx, deadline); err != nil {
@@ -2,6 +2,7 @@ package browser
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@@ -169,6 +170,43 @@ document.addEventListener('click', event => {
} }
} }
func TestTokenCaptchaDirectErrorPageBrowserIntegration(t *testing.T) {
if os.Getenv("RUN_BROWSER_INTEGRATION") != "1" {
t.Skip("set RUN_BROWSER_INTEGRATION=1 to exercise direct-error page classification")
}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_, _ = io.WriteString(w, `<!doctype html><html><head><title>验证码拦截</title></head><body>
<div class="errloading">Oops... something's wrong. Please refresh and try again.(error:6T0DWd)</div>
</body></html>`)
}))
defer server.Close()
m := NewManager(nil)
defer m.Close()
if err := m.init(); err != nil {
t.Fatal(err)
}
browser, err := m.pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{
Headless: playwright.Bool(true),
Args: chromiumLaunchArgs(),
})
if err != nil {
t.Fatal(err)
}
defer func() { _ = browser.Close() }()
page, err := browser.NewPage()
if err != nil {
t.Fatal(err)
}
if _, err := page.Goto(server.URL+"/punish", playwright.PageGotoOptions{WaitUntil: playwright.WaitUntilStateDomcontentloaded}); err != nil {
t.Fatal(err)
}
if err := tokenCaptchaDirectPageError(page); !errors.Is(err, errTokenCaptchaDirectPageError) {
t.Fatalf("无滑块错误页应停止自动验证: %v", err)
}
}
func TestTokenCaptchaCDPFallbackBrowserIntegration(t *testing.T) { func TestTokenCaptchaCDPFallbackBrowserIntegration(t *testing.T) {
if os.Getenv("RUN_BROWSER_INTEGRATION") != "1" { if os.Getenv("RUN_BROWSER_INTEGRATION") != "1" {
t.Skip("set RUN_BROWSER_INTEGRATION=1 to exercise the direct-CDP Chromium fallback") t.Skip("set RUN_BROWSER_INTEGRATION=1 to exercise the direct-CDP Chromium fallback")
@@ -3,6 +3,7 @@ package browser
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"log/slog" "log/slog"
"os" "os"
"path/filepath" "path/filepath"
@@ -77,6 +78,49 @@ func TestTokenCaptchaExpiredURLSkipsFallback(t *testing.T) {
} }
} }
func TestTokenCaptchaDirectErrorPageSkipsFallbackAndKeepsManualURL(t *testing.T) {
fallbackCalls := 0
verificationURL := "https://h5api.m.goofish.com/punish?x5secdata=full-sensitive-value&action=captcha"
m := &Manager{
logger: slog.Default(),
tokenCaptchaPrimaryFn: func(context.Context, string, string, string, bool, TokenCaptchaURLProvider) (string, error) {
return "", fmt.Errorf("%w: Oops... something's wrong", errTokenCaptchaDirectPageError)
},
tokenCaptchaFallbackFn: func(context.Context, string, string, string, bool, TokenCaptchaURLProvider) (string, error) {
fallbackCalls++
return "", errors.New("must not run")
},
}
_, engine, err := m.TokenCaptchaRecoverWithEngine(context.Background(), "cid", "unb=1", verificationURL, true, nil)
if !errors.Is(err, errTokenCaptchaDirectPageError) || engine != "" || fallbackCalls != 0 {
t.Fatalf("engine=%q fallback=%d err=%v", engine, fallbackCalls, err)
}
if got := TokenCaptchaManualVerificationURL(err); got != verificationURL || !strings.Contains(err.Error(), verificationURL) {
t.Fatalf("manual URL=%q err=%v", got, err)
}
}
func TestTokenCaptchaSliderFailureReportsLatestFallbackURL(t *testing.T) {
t.Setenv("CAPTCHA_DRISSIONPAGE_FALLBACK_ENABLED", "true")
freshURL := "https://h5api.m.goofish.com/punish?x5secdata=latest-full-value&action=captcha"
m := &Manager{
logger: slog.Default(),
tokenCaptchaPrimaryFn: func(context.Context, string, string, string, bool, TokenCaptchaURLProvider) (string, error) {
return "", errors.New("slider failed three times")
},
tokenCaptchaFallbackFn: func(context.Context, string, string, string, bool, TokenCaptchaURLProvider) (string, error) {
return "", errors.New("fallback slider failed three times")
},
}
provider := func(context.Context, string) (string, bool, string, error) {
return freshURL, false, "unb=1; _m_h5_tk=fresh", nil
}
_, _, err := m.TokenCaptchaRecoverWithEngine(context.Background(), "cid", "unb=1", "https://old.example/punish", true, provider)
if err == nil || TokenCaptchaManualVerificationURL(err) != freshURL || !strings.Contains(err.Error(), freshURL) {
t.Fatalf("err=%v manual=%q", err, TokenCaptchaManualVerificationURL(err))
}
}
func TestTokenCaptchaExpiredURLRefreshesAfterPrimaryCloses(t *testing.T) { func TestTokenCaptchaExpiredURLRefreshesAfterPrimaryCloses(t *testing.T) {
primaryCalls := 0 primaryCalls := 0
providerCalls := 0 providerCalls := 0
+17
View File
@@ -140,3 +140,20 @@ func TestX5SecValuesCollectsAllDomains(t *testing.T) {
t.Fatal("缺少 two") t.Fatal("缺少 two")
} }
} }
func TestTokenCaptchaDirectErrorTextRequiresAnErrorPrompt(t *testing.T) {
for _, text := range []string{
"验证失败,点击框体重试(error:YzRQd)",
"Oops... something's wrong. Please refresh and try again.(error:6T0DWd)",
"系统繁忙,请稍后重试",
} {
if !tokenCaptchaDirectErrorText(text) {
t.Fatalf("应识别无滑块错误提示 %q", text)
}
}
for _, text := range []string{"请按住滑块,拖动到最右边", "验证码加载中,请稍候", "验证码拦截"} {
if tokenCaptchaDirectErrorText(text) {
t.Fatalf("正常滑块提示不应识别为错误页 %q", text)
}
}
}
+12 -2
View File
@@ -443,9 +443,19 @@ func (a *Account) Run(parent context.Context) error {
return err return err
} }
if mtop.IsSessionExpiredErr(err) { if mtop.IsSessionExpiredErr(err) {
reason := "登录凭证已失效,请重新登录" reason := "登录凭证已失效,正在立即续期"
a.logger.Warn("session 已失效,停止消息登录", "err", err) a.logger.Warn("token API 检测到 Session 过期,停止重试并开始即时续期", "err", err)
a.clearTokenCache(ctx) a.clearTokenCache(ctx)
a.setRuntimeState(RuntimeReconnecting, reason)
a.notifyOffline(ctx, reason+":"+errString(err))
if a.handler != nil && a.handler.OnPasswordLoginRefresh(ctx, a.CookieID) {
a.reloadCookieFromDB(ctx)
a.clearCurrentToken()
a.resetFailures()
a.setRuntimeState(RuntimeConnecting, "Session 续期成功,正在重新连接")
continue
}
reason = "登录凭证已失效,自动续期失败,请重新扫码登录"
a.setRuntimeState(RuntimeAuthExpired, reason) a.setRuntimeState(RuntimeAuthExpired, reason)
a.notifyOffline(ctx, reason+":"+errString(err)) a.notifyOffline(ctx, reason+":"+errString(err))
return err return err
+12
View File
@@ -188,8 +188,17 @@ func (s *Scheduler) executeLoginRenew(ctx context.Context) {
func (s *Scheduler) loginRenewOne(ctx context.Context, batchID string, account db.RenewalAccount) { func (s *Scheduler) loginRenewOne(ctx context.Context, batchID string, account db.RenewalAccount) {
credentialUnlock := s.store.LockAccountCredentials(account.ID) credentialUnlock := s.store.LockAccountCredentials(account.ID)
credentialUpdated := false credentialUpdated := false
sessionExpired := false
defer func() { defer func() {
credentialUnlock() credentialUnlock()
if sessionExpired {
s.logger.Warn("loginuser.get 检测到 Session 过期,开始即时续期", "account", account.ID)
if s.refresher != nil && s.refresher.OnPasswordLoginRefresh(ctx, account.ID) {
s.wakeCredentialBlockedAutomation(ctx, account.ID)
s.restartAfterCredentialUpdate(ctx, account.ID, account.Enabled, "Session 即时续期")
}
return
}
if credentialUpdated { if credentialUpdated {
s.wakeCredentialBlockedAutomation(ctx, account.ID) s.wakeCredentialBlockedAutomation(ctx, account.ID)
s.restartAfterCredentialUpdate(ctx, account.ID, account.Enabled, "登录态续期") s.restartAfterCredentialUpdate(ctx, account.ID, account.Enabled, "登录态续期")
@@ -267,6 +276,9 @@ func (s *Scheduler) loginRenewOne(ctx context.Context, batchID string, account d
if res.Status == mtop.LoginStatusSessionExpired || res.Status == mtop.LoginStatusTokenEmpty { if res.Status == mtop.LoginStatusSessionExpired || res.Status == mtop.LoginStatusTokenEmpty {
s.markSessionExpired(account.ID) s.markSessionExpired(account.ID)
} }
if res.Status == mtop.LoginStatusSessionExpired {
sessionExpired = true
}
} }
func (s *Scheduler) executeAPICookieRenew(ctx context.Context) { func (s *Scheduler) executeAPICookieRenew(ctx context.Context) {
+20
View File
@@ -400,6 +400,26 @@ func TestLoginRenewPreservesValidTokenCache(t *testing.T) {
} }
} }
func TestLoginRenewSessionExpiredStartsImmediateRecovery(t *testing.T) {
store, cleanup := newSchedulerTestStore(t)
defer cleanup()
ctx := context.Background()
account := createSchedulerAccount(t, store, "cid-login-session-expired", "unb=1; _m_h5_tk=old_1")
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(`{"ret":["FAIL_SYS_SESSION_EXPIRED::Session过期"],"data":{}}`))
}))
defer srv.Close()
refresher := &schedulerFakePasswordRefresher{}
s := NewScheduler(store, nil, refresher, nil)
s.mtop = &mtop.ClientImpl{HTTPClient: srv.Client(), LoginUserURL: srv.URL}
s.loginRenewOne(ctx, "batch-login-session-expired", account)
if got := refresher.calls.Load(); got != 1 {
t.Fatalf("session 过期应在登录态检查返回后立即触发一次续期,calls=%d", got)
}
}
func TestLoginRenewPersistsAuthoritativeSessionBeforeParseError(t *testing.T) { func TestLoginRenewPersistsAuthoritativeSessionBeforeParseError(t *testing.T) {
store, cleanup := newSchedulerTestStore(t) store, cleanup := newSchedulerTestStore(t)
defer cleanup() defer cleanup()
+16
View File
@@ -58,6 +58,8 @@ func (s *Server) listChatSessions(w http.ResponseWriter, r *http.Request) {
return return
} }
hasMore, nextCursor = page.HasMore, page.NextCursor hasMore, nextCursor = page.HasMore, page.NextCursor
} else {
s.recoverExpiredMTOPSession(r.Context(), accountID, fetchErr)
} }
} }
} }
@@ -80,6 +82,8 @@ func (s *Server) listChatSessions(w http.ResponseWriter, r *http.Request) {
defer resolveCancel() defer resolveCancel()
jobs := make(chan int) jobs := make(chan int)
var workers sync.WaitGroup var workers sync.WaitGroup
var sessionOnce sync.Once
var sessionErr error
for worker := 0; worker < 8; worker++ { for worker := 0; worker < 8; worker++ {
workers.Add(1) workers.Add(1)
go func() { go func() {
@@ -88,6 +92,13 @@ func (s *Server) listChatSessions(w http.ResponseWriter, r *http.Request) {
infoCtx, cancel := context.WithTimeout(resolveCtx, 3*time.Second) infoCtx, cancel := context.WithTimeout(resolveCtx, 3*time.Second)
info, infoErr := client.FetchChatUserInfo(infoCtx, cookieValue, rows[index].ChatID) info, infoErr := client.FetchChatUserInfo(infoCtx, cookieValue, rows[index].ChatID)
cancel() cancel()
if mtop.IsSessionExpiredErr(infoErr) {
sessionOnce.Do(func() {
sessionErr = infoErr
resolveCancel()
})
continue
}
if infoErr != nil || info == nil { if infoErr != nil || info == nil {
continue continue
} }
@@ -115,6 +126,9 @@ func (s *Server) listChatSessions(w http.ResponseWriter, r *http.Request) {
} }
close(jobs) close(jobs)
workers.Wait() workers.Wait()
if sessionErr != nil {
s.recoverExpiredMTOPSession(r.Context(), accountID, sessionErr)
}
} }
} }
writeJSON(w, http.StatusOK, map[string]any{"sessions": rows, "has_more": hasMore, "next_cursor": nextCursor}) writeJSON(w, http.StatusOK, map[string]any{"sessions": rows, "has_more": hasMore, "next_cursor": nextCursor})
@@ -283,6 +297,8 @@ func (s *Server) resolveSelectedChatIdentity(ctx context.Context, accountID stri
if info.AvatarURL != "" { if info.AvatarURL != "" {
session.BuyerAvatar = info.AvatarURL session.BuyerAvatar = info.AvatarURL
} }
} else if err != nil {
s.recoverExpiredMTOPSession(ctx, accountID, err)
} }
} }
} }
+1
View File
@@ -839,6 +839,7 @@ func (s *Server) refreshAccountProfile(ctx context.Context, d *db.CookieDetail)
s.updateRunningCookie(ctx, d.ID, runtimeCookie) s.updateRunningCookie(ctx, d.ID, runtimeCookie)
} }
if callErr != nil { if callErr != nil {
s.recoverExpiredMTOPSession(ctx, d.ID, callErr)
if s.Logger != nil { if s.Logger != nil {
s.Logger.Warn("刷新账号资料失败", "account", d.ID, "err", callErr) s.Logger.Warn("刷新账号资料失败", "account", d.ID, "err", callErr)
} }
+21 -4
View File
@@ -151,6 +151,7 @@ func (s *Server) publishItem(w http.ResponseWriter, r *http.Request) {
if responseCookieErr != nil { if responseCookieErr != nil {
callErr = errors.Join(callErr, fmt.Errorf("保存发布响应 Cookie: %w", responseCookieErr)) callErr = errors.Join(callErr, fmt.Errorf("保存发布响应 Cookie: %w", responseCookieErr))
} }
s.recoverExpiredMTOPSession(r.Context(), cookieID, callErr)
var perr *mtop.PublishError var perr *mtop.PublishError
if errors.As(callErr, &perr) { if errors.As(callErr, &perr) {
status := http.StatusBadGateway status := http.StatusBadGateway
@@ -382,6 +383,7 @@ func (s *Server) syncItemsFromAccount(w http.ResponseWriter, r *http.Request) {
} else if valueChanged { } else if valueChanged {
s.updateRunningCookie(r.Context(), req.CookieID, value) s.updateRunningCookie(r.Context(), req.CookieID, value)
} }
s.recoverExpiredMTOPSession(r.Context(), req.CookieID, callErr)
writeErr(w, http.StatusBadGateway, callErr.Error()) writeErr(w, http.StatusBadGateway, callErr.Error())
return return
} }
@@ -389,7 +391,7 @@ func (s *Server) syncItemsFromAccount(w http.ResponseWriter, r *http.Request) {
if res.UpdatedCookies != "" { if res.UpdatedCookies != "" {
detailCookies = res.UpdatedCookies detailCookies = res.UpdatedCookies
} }
s.enrichSyncedItemMultiSpec(mtopCtx, client, detailCookies, req.CookieID, res.Items) detailErr := s.enrichSyncedItemMultiSpec(mtopCtx, client, detailCookies, req.CookieID, res.Items)
runtimeCookie := "" runtimeCookie := ""
runtimeCookieChanged := false runtimeCookieChanged := false
value, valueChanged, handled, persistErr := s.persistMTopCookieSessionLocked(r.Context(), latest, cookieSession) value, valueChanged, handled, persistErr := s.persistMTopCookieSessionLocked(r.Context(), latest, cookieSession)
@@ -418,6 +420,11 @@ func (s *Server) syncItemsFromAccount(w http.ResponseWriter, r *http.Request) {
if runtimeCookieChanged { if runtimeCookieChanged {
s.updateRunningCookie(r.Context(), req.CookieID, runtimeCookie) s.updateRunningCookie(r.Context(), req.CookieID, runtimeCookie)
} }
if detailErr != nil {
s.recoverExpiredMTOPSession(r.Context(), req.CookieID, detailErr)
writeErr(w, http.StatusBadGateway, detailErr.Error())
return
}
syncResult, syncErr := s.syncSyncedItems(r.Context(), req.CookieID, res.Items) syncResult, syncErr := s.syncSyncedItems(r.Context(), req.CookieID, res.Items)
if syncErr != nil { if syncErr != nil {
if s.Logger != nil { if s.Logger != nil {
@@ -476,6 +483,7 @@ func (s *Server) syncItemsPageFromAccount(w http.ResponseWriter, r *http.Request
} else if valueChanged { } else if valueChanged {
s.updateRunningCookie(r.Context(), req.CookieID, value) s.updateRunningCookie(r.Context(), req.CookieID, value)
} }
s.recoverExpiredMTOPSession(r.Context(), req.CookieID, callErr)
writeErr(w, http.StatusBadGateway, callErr.Error()) writeErr(w, http.StatusBadGateway, callErr.Error())
return return
} }
@@ -483,7 +491,7 @@ func (s *Server) syncItemsPageFromAccount(w http.ResponseWriter, r *http.Request
if res.UpdatedCookies != "" { if res.UpdatedCookies != "" {
detailCookies = res.UpdatedCookies detailCookies = res.UpdatedCookies
} }
s.enrichSyncedItemMultiSpec(mtopCtx, client, detailCookies, req.CookieID, res.Items) detailErr := s.enrichSyncedItemMultiSpec(mtopCtx, client, detailCookies, req.CookieID, res.Items)
runtimeCookie := "" runtimeCookie := ""
runtimeCookieChanged := false runtimeCookieChanged := false
value, valueChanged, handled, persistErr := s.persistMTopCookieSessionLocked(r.Context(), latest, cookieSession) value, valueChanged, handled, persistErr := s.persistMTopCookieSessionLocked(r.Context(), latest, cookieSession)
@@ -512,6 +520,11 @@ func (s *Server) syncItemsPageFromAccount(w http.ResponseWriter, r *http.Request
if runtimeCookieChanged { if runtimeCookieChanged {
s.updateRunningCookie(r.Context(), req.CookieID, runtimeCookie) s.updateRunningCookie(r.Context(), req.CookieID, runtimeCookie)
} }
if detailErr != nil {
s.recoverExpiredMTOPSession(r.Context(), req.CookieID, detailErr)
writeErr(w, http.StatusBadGateway, detailErr.Error())
return
}
saved := s.saveSyncedItems(r.Context(), req.CookieID, res.Items) saved := s.saveSyncedItems(r.Context(), req.CookieID, res.Items)
writeJSON(w, http.StatusOK, map[string]any{ writeJSON(w, http.StatusOK, map[string]any{
"success": true, "success": true,
@@ -592,10 +605,10 @@ func (s *Server) syncSyncedItems(ctx context.Context, cookieID string, items []m
return s.Store.Items.SyncFromRemote(ctx, cookieID, rows) return s.Store.Items.SyncFromRemote(ctx, cookieID, rows)
} }
func (s *Server) enrichSyncedItemMultiSpec(ctx context.Context, client mtop.Client, cookies, cookieID string, items []mtop.ItemListItem) { func (s *Server) enrichSyncedItemMultiSpec(ctx context.Context, client mtop.Client, cookies, cookieID string, items []mtop.ItemListItem) error {
fetcher, ok := client.(mtop.ItemDetailFetcher) fetcher, ok := client.(mtop.ItemDetailFetcher)
if !ok { if !ok {
return return nil
} }
for index := range items { for index := range items {
if items[index].IsMultiSpec || s.Store.Items.IsMultiSpec(ctx, cookieID, items[index].ID) { if items[index].IsMultiSpec || s.Store.Items.IsMultiSpec(ctx, cookieID, items[index].ID) {
@@ -604,6 +617,9 @@ func (s *Server) enrichSyncedItemMultiSpec(ctx context.Context, client mtop.Clie
} }
isMultiSpec, err := fetcher.DetectItemMultiSpec(ctx, cookies, items[index].ID) isMultiSpec, err := fetcher.DetectItemMultiSpec(ctx, cookies, items[index].ID)
if err != nil { if err != nil {
if mtop.IsSessionExpiredErr(err) {
return err
}
if s.Logger != nil { if s.Logger != nil {
s.Logger.Warn("识别商品多规格状态失败", "cookie_id", cookieID, "item_id", items[index].ID, "err", err) s.Logger.Warn("识别商品多规格状态失败", "cookie_id", cookieID, "item_id", items[index].ID, "err", err)
} }
@@ -611,6 +627,7 @@ func (s *Server) enrichSyncedItemMultiSpec(ctx context.Context, client mtop.Clie
} }
items[index].IsMultiSpec = isMultiSpec items[index].IsMultiSpec = isMultiSpec
} }
return nil
} }
func (s *Server) listItemsByCookie(w http.ResponseWriter, r *http.Request) { func (s *Server) listItemsByCookie(w http.ResponseWriter, r *http.Request) {
@@ -705,11 +705,12 @@ func (s *Server) runItemPublishBatch(ctx context.Context, userID int64, batchID,
if !claimed { if !claimed {
continue continue
} }
if err := s.publishBatchRow(ctx, userID, client, row, workerToken); err != nil { if rowErr := s.publishBatchRow(ctx, userID, client, row, workerToken); rowErr != nil {
sessionExpired := mtop.IsSessionExpiredErr(rowErr)
statusCtx, statusCancel := context.WithTimeout(context.Background(), 5*time.Second) statusCtx, statusCancel := context.WithTimeout(context.Background(), 5*time.Second)
status, _ := s.Store.PublishBatches.BatchStatus(statusCtx, batchID) status, _ := s.Store.PublishBatches.BatchStatus(statusCtx, batchID)
statusCancel() statusCancel()
message, failureKind := publishBatchFailure(err, status) message, failureKind := publishBatchFailure(rowErr, status)
wctx, cancel := publishStatusContext(ctx) wctx, cancel := publishStatusContext(ctx)
marked, markErr := s.Store.PublishBatches.MarkClaimedRowFailed(wctx, row.ID, workerToken, message, failureKind) marked, markErr := s.Store.PublishBatches.MarkClaimedRowFailed(wctx, row.ID, workerToken, message, failureKind)
cancel() cancel()
@@ -719,6 +720,10 @@ func (s *Server) runItemPublishBatch(ctx context.Context, userID int64, batchID,
} }
return return
} }
if sessionExpired {
s.finishInterruptedPublishBatch(ctx, userID, batchID, workerToken)
return
}
} }
wctx, cancel = publishStatusContext(ctx) wctx, cancel = publishStatusContext(ctx)
if err := s.Store.PublishBatches.Recount(wctx, batchID); err != nil && s.Logger != nil { if err := s.Store.PublishBatches.Recount(wctx, batchID); err != nil && s.Logger != nil {
@@ -977,6 +982,7 @@ func (s *Server) publishBatchRow(ctx context.Context, userID int64, client mtop.
s.updateRunningCookie(ctx, row.CookieID, runtimeCookie) s.updateRunningCookie(ctx, row.CookieID, runtimeCookie)
} }
if err != nil { if err != nil {
s.recoverExpiredMTOPSession(ctx, row.CookieID, err)
if ctx.Err() != nil { if ctx.Err() != nil {
return &uncertainRemotePublishError{err: fmt.Errorf("取消时远端发布结果未知: %w", err)} return &uncertainRemotePublishError{err: fmt.Errorf("取消时远端发布结果未知: %w", err)}
} }
+23
View File
@@ -190,6 +190,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
discovered, listUpdated, softDeleted, failed := 0, 0, 0, 0 discovered, listUpdated, softDeleted, failed := 0, 0, 0, 0
results := []map[string]any{} results := []map[string]any{}
newOrderIDs := make(map[string]struct{}) newOrderIDs := make(map[string]struct{})
sessionExpiredAccounts := make(map[string]struct{})
if fetcher, ok := s.mtopClient().(mtop.SoldOrderFetcher); ok { if fetcher, ok := s.mtopClient().(mtop.SoldOrderFetcher); ok {
for cid := range all { for cid := range all {
credentialUnlock := s.Store.LockAccountCredentials(cid) credentialUnlock := s.Store.LockAccountCredentials(cid)
@@ -218,6 +219,10 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
if persistErr == nil && valueChanged { if persistErr == nil && valueChanged {
s.updateRunningCookie(r.Context(), cid, value) s.updateRunningCookie(r.Context(), cid, value)
} }
if mtop.IsSessionExpiredErr(discoveryErr) {
sessionExpiredAccounts[cid] = struct{}{}
s.recoverExpiredMTOPSession(r.Context(), cid, discoveryErr)
}
discovered += accountDiscovered discovered += accountDiscovered
listUpdated += accountUpdated listUpdated += accountUpdated
for orderID := range accountNewIDs { for orderID := range accountNewIDs {
@@ -250,6 +255,9 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
ordersByCookie := map[string][]refreshTarget{} ordersByCookie := map[string][]refreshTarget{}
for cid := range all { for cid := range all {
if _, blocked := sessionExpiredAccounts[cid]; blocked {
continue
}
for offset := 0; ; offset += 500 { for offset := 0; ; offset += 500 {
rows, err := s.Store.Orders.ByCookiePage(r.Context(), cid, 500, offset) rows, err := s.Store.Orders.ByCookiePage(r.Context(), cid, 500, offset)
if err != nil { if err != nil {
@@ -312,6 +320,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
updated, noChange := 0, 0 updated, noChange := 0, 0
for cid, targets := range ordersByCookie { for cid, targets := range ordersByCookie {
accountSessionExpired := false
for _, chunk := range chunkRefreshTargets(targets, refreshOrderChunkSize) { for _, chunk := range chunkRefreshTargets(targets, refreshOrderChunkSize) {
credentialUnlock := s.Store.LockAccountCredentials(cid) credentialUnlock := s.Store.LockAccountCredentials(cid)
latest, latestErr := s.Store.Cookies.GetDetails(r.Context(), cid) latest, latestErr := s.Store.Cookies.GetDetails(r.Context(), cid)
@@ -323,6 +332,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
} }
ctx, cancel := context.WithTimeout(r.Context(), 3*time.Minute) ctx, cancel := context.WithTimeout(r.Context(), 3*time.Minute)
mtopCtx, cookieSession := withMTopCookieSnapshot(ctx, latest) mtopCtx, cookieSession := withMTopCookieSnapshot(ctx, latest)
var sessionErr error
for _, target := range chunk { for _, target := range chunk {
detail, fetchErr := detailFetcher.FetchOrderDetail(mtopCtx, latest.Value, target.OrderID) detail, fetchErr := detailFetcher.FetchOrderDetail(mtopCtx, latest.Value, target.OrderID)
if fetchErr != nil || detail == nil { if fetchErr != nil || detail == nil {
@@ -336,6 +346,10 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
"success": false, "success": false,
"error": message, "error": message,
}) })
if mtop.IsSessionExpiredErr(fetchErr) {
sessionErr = fetchErr
break
}
continue continue
} }
newStatus := db.NormalizeOrderStatus(detail.OrderStatus) newStatus := db.NormalizeOrderStatus(detail.OrderStatus)
@@ -377,6 +391,14 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
} else if valueChanged { } else if valueChanged {
s.updateRunningCookie(r.Context(), cid, value) s.updateRunningCookie(r.Context(), cid, value)
} }
if sessionErr != nil {
s.recoverExpiredMTOPSession(r.Context(), cid, sessionErr)
accountSessionExpired = true
break
}
}
if accountSessionExpired {
continue
} }
} }
writeJSON(w, http.StatusOK, map[string]any{ writeJSON(w, http.StatusOK, map[string]any{
@@ -544,6 +566,7 @@ func (s *Server) refreshSingleOrder(w http.ResponseWriter, r *http.Request) {
s.updateRunningCookie(r.Context(), cookieID, runtimeCookie) s.updateRunningCookie(r.Context(), cookieID, runtimeCookie)
} }
if callErr != nil { if callErr != nil {
s.recoverExpiredMTOPSession(r.Context(), cookieID, callErr)
writeErr(w, http.StatusBadGateway, callErr.Error()) writeErr(w, http.StatusBadGateway, callErr.Error())
return return
} }
+19 -3
View File
@@ -16,6 +16,8 @@ import (
"xianyu-go/internal/xianyu/protocol" "xianyu-go/internal/xianyu/protocol"
) )
const qrLoginGenerateTimeout = 2 * time.Minute
// mountQRLoginReal 扫码登录端点(纯 HTTP,不需要浏览器)。 // mountQRLoginReal 扫码登录端点(纯 HTTP,不需要浏览器)。
func (s *Server) mountQRLoginReal(r chi.Router) { func (s *Server) mountQRLoginReal(r chi.Router) {
r.Post("/qr-login/generate", s.generateQRLogin) r.Post("/qr-login/generate", s.generateQRLogin)
@@ -32,12 +34,26 @@ func (s *Server) generateQRLogin(w http.ResponseWriter, r *http.Request) {
return return
} }
s.cleanupQRLoginSessions() s.cleanupQRLoginSessions()
sessionID, qrCodeURL, err := s.QRLogin.GenerateQRCode(r.Context()) // 风控后的闲鱼匿名 token 接口偶尔会明显变慢。二维码生成需要连续完成
// token、登录参数和二维码请求,不能沿用前端通用接口的短超时。
generateCtx, cancel := context.WithTimeout(r.Context(), qrLoginGenerateTimeout)
defer cancel()
sessionID, qrCodeURL, err := s.QRLogin.GenerateQRCode(generateCtx)
if err != nil { if err != nil {
s.Logger.Error("生成二维码失败", "err", err) message := "生成二维码失败: " + err.Error()
switch {
case errors.Is(err, context.Canceled):
s.Logger.Info("二维码生成请求已取消")
message = "二维码生成请求已取消,请重新获取"
case errors.Is(err, context.DeadlineExceeded):
s.Logger.Error("生成二维码超时", "err", err)
message = "闲鱼二维码接口响应超时,请稍后重新获取"
default:
s.Logger.Error("生成二维码失败", "err", err)
}
writeJSON(w, http.StatusOK, map[string]any{ writeJSON(w, http.StatusOK, map[string]any{
"success": false, "success": false,
"message": "生成二维码失败: " + err.Error(), "message": message,
}) })
return return
} }
+14 -7
View File
@@ -15,14 +15,16 @@ import (
) )
type fakeQRLoginService struct { type fakeQRLoginService struct {
status map[string]any status map[string]any
generateErr error generateErr error
completeCookies string generateDeadline time.Time
completeUNB string completeCookies string
completeErr error completeUNB string
completeErr error
} }
func (f *fakeQRLoginService) GenerateQRCode(context.Context) (string, string, error) { func (f *fakeQRLoginService) GenerateQRCode(ctx context.Context) (string, string, error) {
f.generateDeadline, _ = ctx.Deadline()
if f.generateErr != nil { if f.generateErr != nil {
return "", "", f.generateErr return "", "", f.generateErr
} }
@@ -54,7 +56,8 @@ func (f *fakeQRLoginService) CompleteVerification(context.Context, string) (stri
func TestGenerateQRLogin(t *testing.T) { func TestGenerateQRLogin(t *testing.T) {
srv, _, cleanup := newTestServer(t) srv, _, cleanup := newTestServer(t)
defer cleanup() defer cleanup()
srv.QRLogin = &fakeQRLoginService{} qr := &fakeQRLoginService{}
srv.QRLogin = qr
h := srv.Router() h := srv.Router()
cookie := loginHelper(t, h) cookie := loginHelper(t, h)
@@ -70,6 +73,10 @@ func TestGenerateQRLogin(t *testing.T) {
if res["success"] != true || res["session_id"] == nil || res["session_id"] == "" { if res["success"] != true || res["session_id"] == nil || res["session_id"] == "" {
t.Fatalf("生成二维码响应异常: %+v", res) t.Fatalf("生成二维码响应异常: %+v", res)
} }
remaining := time.Until(qr.generateDeadline)
if remaining < qrLoginGenerateTimeout-time.Second || remaining > qrLoginGenerateTimeout {
t.Fatalf("二维码生成超时窗口=%v want≈%v", remaining, qrLoginGenerateTimeout)
}
} }
func TestQRLoginSessionCannotBeReadByAnotherUser(t *testing.T) { func TestQRLoginSessionCannotBeReadByAnotherUser(t *testing.T) {
+23 -1
View File
@@ -24,6 +24,7 @@ import (
"xianyu-go/internal/chat" "xianyu-go/internal/chat"
"xianyu-go/internal/db" "xianyu-go/internal/db"
"xianyu-go/internal/notify" "xianyu-go/internal/notify"
appversion "xianyu-go/internal/version"
"xianyu-go/internal/webui" "xianyu-go/internal/webui"
"xianyu-go/internal/xianyu/mtop" "xianyu-go/internal/xianyu/mtop"
"xianyu-go/internal/xianyu/qrlogin" "xianyu-go/internal/xianyu/qrlogin"
@@ -128,6 +129,21 @@ func (s *Server) mtopClient() mtop.Client {
return mtop.NewClient() return mtop.NewClient()
} }
// recoverExpiredMTOPSession 是 HTTP/API 入口的统一 Session 失效出口。
// 各调用点必须先保存响应 Cookie 并释放账号凭证锁,再进入续期,避免锁反转。
func (s *Server) recoverExpiredMTOPSession(ctx context.Context, cookieID string, err error) bool {
if !mtop.IsSessionExpiredErr(err) {
return false
}
if s.Logger != nil {
s.Logger.Warn("MTOP API 检测到 Session 过期,停止业务请求并开始即时续期", "account", cookieID, "err", err)
}
if s.Manager == nil {
return false
}
return s.Manager.RecoverExpiredCredential(ctx, cookieID)
}
// Router 构建完整路由树。 // Router 构建完整路由树。
func (s *Server) Router() http.Handler { func (s *Server) Router() http.Handler {
r := chi.NewRouter() r := chi.NewRouter()
@@ -349,7 +365,13 @@ func (s *Server) health(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusServiceUnavailable, map[string]any{"status": "degraded", "database": "unavailable"}) writeJSON(w, http.StatusServiceUnavailable, map[string]any{"status": "degraded", "database": "unavailable"})
return return
} }
writeJSON(w, http.StatusOK, map[string]any{"status": "ok", "database": "ok"}) writeJSON(w, http.StatusOK, map[string]any{
"status": "ok",
"database": "ok",
"version": appversion.Version,
"commit": appversion.ShortCommit(),
"build_time": appversion.BuildTime,
})
} }
// 各分组 mount*Real 方法在 handlers 文件中实现;为避免单文件过大,按业务域分文件。 // 各分组 mount*Real 方法在 handlers 文件中实现;为避免单文件过大,按业务域分文件。
+3
View File
@@ -390,6 +390,9 @@ func TestHealth(t *testing.T) {
if rec.Code != 200 { if rec.Code != 200 {
t.Fatalf("health status=%d", rec.Code) t.Fatalf("health status=%d", rec.Code)
} }
if !strings.Contains(rec.Body.String(), `"version":"dev"`) {
t.Fatalf("health response missing build version: %s", rec.Body.String())
}
} }
func TestHealthReportsUnavailableDatabase(t *testing.T) { func TestHealthReportsUnavailableDatabase(t *testing.T) {
+22
View File
@@ -0,0 +1,22 @@
// Package version exposes build metadata injected by release builds.
package version
import "strings"
var (
Version = "dev"
Commit = "unknown"
BuildTime = "unknown"
)
// ShortCommit returns a compact commit identifier suitable for UI display.
func ShortCommit() string {
commit := strings.TrimSpace(Commit)
if len(commit) > 12 {
return commit[:12]
}
if commit == "" {
return "unknown"
}
return commit
}
+13
View File
@@ -0,0 +1,13 @@
package version
import "testing"
func TestShortCommit(t *testing.T) {
original := Commit
t.Cleanup(func() { Commit = original })
Commit = "0123456789abcdef"
if got := ShortCommit(); got != "0123456789ab" {
t.Fatalf("ShortCommit() = %q", got)
}
}
@@ -1,4 +1,4 @@
import{r as y}from"./react-vendor-C_od1ZSF.js";/** import{r as h}from"./react-vendor-C_od1ZSF.js";/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
@@ -13,32 +13,32 @@ import{r as y}from"./react-vendor-C_od1ZSF.js";/**
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const m=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:h,iconNode:i,...d},p)=>y.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",s),...!h&&!x(d)&&{"aria-hidden":"true"},...d},[...i.map(([r,l])=>y.createElement(r,l)),...Array.isArray(h)?h:[h]]));/** */const m=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:y,iconNode:i,...d},p)=>h.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",s),...!y&&!x(d)&&{"aria-hidden":"true"},...d},[...i.map(([r,l])=>h.createElement(r,l)),...Array.isArray(y)?y:[y]]));/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const e=(t,a)=>{const c=y.forwardRef(({className:o,...s},h)=>y.createElement(m,{ref:h,iconNode:a,className:k(`lucide-${M(n(t))}`,`lucide-${t}`,o),...s}));return c.displayName=n(t),c};/** */const e=(t,a)=>{const c=h.forwardRef(({className:o,...s},y)=>h.createElement(m,{ref:y,iconNode:a,className:k(`lucide-${M(n(t))}`,`lucide-${t}`,o),...s}));return c.displayName=n(t),c};/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],I1=e("activity",g);/** */const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],O1=e("activity",g);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],O1=e("arrow-right",u);/** */const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Z1=e("arrow-right",u);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const $=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Z1=e("bell",$);/** */const $=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],K1=e("bell",$);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],K1=e("bot",N);/** */const N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],G1=e("bot",N);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
@@ -48,47 +48,47 @@ import{r as y}from"./react-vendor-C_od1ZSF.js";/**
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const w=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],G1=e("calendar-clock",w);/** */const w=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],J1=e("calendar-clock",w);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const b=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],J1=e("check-check",b);/** */const z=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],X1=e("check-check",z);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const z=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],X1=e("check",z);/** */const b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Y1=e("check",b);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Y1=e("chevron-down",q);/** */const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e2=e("chevron-down",q);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],e2=e("chevron-left",C);/** */const C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],a2=e("chevron-left",C);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],a2=e("chevron-right",j);/** */const j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],t2=e("chevron-right",j);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],t2=e("circle-alert",A);/** */const A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],c2=e("circle-alert",A);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c2=e("circle-check",H);/** */const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],o2=e("circle-check",H);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],o2=e("circle-dashed",V);/** */const V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],y2=e("circle-dashed",V);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
@@ -98,314 +98,319 @@ import{r as y}from"./react-vendor-C_od1ZSF.js";/**
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const P=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],y2=e("clock",P);/** */const P=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],s2=e("clock",P);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const S=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],s2=e("cloud-upload",S);/** */const S=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],d2=e("cloud-upload",S);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const U=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],d2=e("code",U);/** */const U=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],n2=e("code",U);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const E=[["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"}]],n2=e("copy",E);/** */const E=[["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"}]],k2=e("copy",E);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const B=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],k2=e("credit-card",B);/** */const B=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],i2=e("credit-card",B);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const D=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],i2=e("database",D);/** */const D=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],p2=e("database",D);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const R=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],p2=e("dollar-sign",R);/** */const R=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],r2=e("dollar-sign",R);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const T=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],r2=e("external-link",T);/** */const T=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],l2=e("external-link",T);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const W=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],l2=e("eye-off",W);/** */const W=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],M2=e("eye-off",W);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const F=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],M2=e("eye",F);/** */const F=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_2=e("eye",F);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const I=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],_2=e("file-down",I);/** */const I=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],x2=e("file-down",I);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],x2=e("file-text",O);/** */const O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],v2=e("file-text",O);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const Z=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],v2=e("funnel",Z);/** */const Z=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],m2=e("funnel",Z);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const K=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],m2=e("gift",K);/** */const K=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],g2=e("gift",K);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const Q=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],g2=e("image-plus",Q);/** */const G=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],u2=e("git-commit-horizontal",G);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const G=[["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"}]],u2=e("image",G);/** */const Q=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],$2=e("image-plus",Q);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const J=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],$2=e("key",J);/** */const J=[["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"}]],N2=e("image",J);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const X=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],N2=e("layers",X);/** */const X=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],f2=e("key",X);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const Y=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],f2=e("layout-dashboard",Y);/** */const Y=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],w2=e("layers",Y);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const e1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],w2=e("link-2",e1);/** */const e1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],z2=e("layout-dashboard",e1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const a1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],b2=e("list-plus",a1);/** */const a1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],b2=e("link-2",a1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const t1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],z2=e("loader-circle",t1);/** */const t1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],q2=e("list-plus",t1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const c1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],q2=e("locate-fixed",c1);/** */const c1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],C2=e("loader-circle",c1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const o1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],C2=e("lock-keyhole",o1);/** */const o1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],j2=e("locate-fixed",o1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const h1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],j2=e("lock",h1);/** */const y1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],A2=e("lock-keyhole",y1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const y1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],A2=e("log-out",y1);/** */const h1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],H2=e("lock",h1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const s1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],H2=e("mail",s1);/** */const s1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],V2=e("log-out",s1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const d1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],V2=e("message-circle-more",d1);/** */const d1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],L2=e("mail",d1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const n1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],L2=e("message-circle",n1);/** */const n1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],P2=e("message-circle-more",n1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const k1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],P2=e("message-square-quote",k1);/** */const k1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],S2=e("message-circle",k1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const i1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],S2=e("package-check",i1);/** */const i1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],U2=e("message-square-quote",i1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const p1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],U2=e("package-plus",p1);/** */const p1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],E2=e("package-check",p1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const r1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],E2=e("package",r1);/** */const r1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],B2=e("package-plus",r1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const l1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],B2=e("pen",l1);/** */const l1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],D2=e("package",l1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const M1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],D2=e("play",M1);/** */const M1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],R2=e("pen",M1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const _1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],R2=e("plus",_1);/** */const _1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],T2=e("play",_1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const x1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],T2=e("power",x1);/** */const x1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],W2=e("plus",x1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const v1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],W2=e("qr-code",v1);/** */const v1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],F2=e("power",v1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const m1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],F2=e("refresh-cw",m1);/** */const m1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],I2=e("qr-code",m1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const g1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],I2=e("save",g1);/** */const g1=[["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"}]],O2=e("refresh-cw",g1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const u1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],O2=e("search",u1);/** */const u1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Z2=e("save",u1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const $1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Z2=e("send",$1);/** */const $1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],K2=e("search",$1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const N1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],K2=e("settings",N1);/** */const N1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],G2=e("send",N1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const f1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Q2=e("shield-check",f1);/** */const f1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Q2=e("settings",f1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const w1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],G2=e("shopping-bag",w1);/** */const w1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],J2=e("shield-check",w1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const b1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],J2=e("shopping-cart",b1);/** */const z1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],X2=e("shopping-bag",z1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const z1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],X2=e("sliders-horizontal",z1);/** */const b1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Y2=e("shopping-cart",b1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const q1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],Y2=e("smile",q1);/** */const q1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],e0=e("sliders-horizontal",q1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const C1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],e0=e("sparkles",C1);/** */const C1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],a0=e("smile",C1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const j1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],a0=e("square-pen",j1);/** */const j1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],t0=e("sparkles",j1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const A1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],t0=e("trash-2",A1);/** */const A1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],c0=e("square-pen",A1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const H1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],c0=e("trending-up",H1);/** */const H1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],o0=e("trash-2",H1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const V1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],o0=e("triangle-alert",V1);/** */const V1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],y0=e("trending-up",V1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const L1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],h0=e("truck",L1);/** */const L1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],h0=e("triangle-alert",L1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const P1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],y0=e("upload",P1);/** */const P1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],s0=e("truck",P1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const S1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],s0=e("user-round",S1);/** */const S1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],d0=e("upload",S1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const U1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],d0=e("user",U1);/** */const U1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],n0=e("user-round",U1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const E1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],n0=e("users",E1);/** */const E1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],k0=e("user",E1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const B1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],k0=e("webhook",B1);/** */const B1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],i0=e("users",B1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const D1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],i0=e("wifi-off",D1);/** */const D1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],p0=e("webhook",D1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const R1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],p0=e("wifi",R1);/** */const R1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],r0=e("wifi-off",R1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const T1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],r0=e("x",T1);/** */const T1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],l0=e("wifi",T1);/**
* @license lucide-react v0.562.0 - ISC * @license lucide-react v0.562.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/const W1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],l0=e("zap",W1);export{v2 as $,I1 as A,Q1 as B,k2 as C,p2 as D,r2 as E,h0 as F,O2 as G,a0 as H,y0 as I,X2 as J,$2 as K,f2 as L,V2 as M,n2 as N,x2 as O,E2 as P,W2 as Q,F2 as R,G2 as S,c0 as T,n0 as U,u2 as V,b2 as W,r0 as X,_2 as Y,l0 as Z,d2 as _,Z1 as a,U2 as a0,s2 as a1,c2 as a2,o2 as a3,w2 as a4,O1 as a5,q2 as a6,i2 as a7,Y1 as a8,Q2 as a9,C2 as aa,s0 as ab,h2 as ac,m2 as ad,N2 as ae,Z2 as af,H2 as ag,k0 as ah,p0 as ai,i0 as aj,J1 as ak,Y2 as al,g2 as am,j2 as an,K2 as b,a2 as c,e2 as d,A2 as e,t2 as f,J2 as g,S2 as h,o0 as i,z2 as j,P2 as k,D2 as l,e0 as m,G1 as n,I2 as o,d0 as p,X1 as q,K1 as r,L2 as s,y2 as t,B2 as u,T2 as v,t0 as w,l2 as x,M2 as y,R2 as z}; */const W1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],M0=e("x",W1);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],_0=e("zap",F1);export{n2 as $,O1 as A,Q1 as B,i2 as C,r2 as D,l2 as E,s0 as F,u2 as G,K2 as H,c0 as I,d0 as J,f2 as K,z2 as L,P2 as M,e0 as N,k2 as O,D2 as P,I2 as Q,O2 as R,X2 as S,y0 as T,i0 as U,v2 as V,N2 as W,M0 as X,q2 as Y,_0 as Z,x2 as _,K1 as a,m2 as a0,B2 as a1,d2 as a2,o2 as a3,y2 as a4,b2 as a5,Z1 as a6,j2 as a7,p2 as a8,e2 as a9,J2 as aa,A2 as ab,n0 as ac,h2 as ad,g2 as ae,w2 as af,G2 as ag,L2 as ah,p0 as ai,l0 as aj,r0 as ak,X1 as al,a0 as am,$2 as an,H2 as ao,Q2 as b,t2 as c,a2 as d,V2 as e,c2 as f,Y2 as g,E2 as h,h0 as i,C2 as j,U2 as k,T2 as l,t0 as m,J1 as n,Z2 as o,k0 as p,Y1 as q,G1 as r,S2 as s,s2 as t,R2 as u,F2 as v,o0 as w,M2 as x,_2 as y,W2 as z};
@@ -1 +0,0 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .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(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
@@ -0,0 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .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(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
@@ -1,19 +0,0 @@
import{j as e,r,b as Me,c as xa,d as Fa}from"./react-vendor-C_od1ZSF.js";import{L as Ba,U as ma,M as rs,C as ns,B as pa,S as ua,Z as is,a as jt,b as bs,c as fs,d as ys,e as za,f as at,A as Ls,D as Ua,g as Os,P as ha,h as Tt,E as ga,T as Wa,i as Ja,j as Ee,X as Te,k as Va,l as Qa,m as js,n as ba,o as Ge,Q as Zt,p as xt,q as Qe,r as yt,s as Et,t as Is,R as Be,u as fa,v as Ga,w as Je,K as Ka,x as dt,y as st,z as Ye,F as As,G as Nt,H as _t,I as $t,J as ya,N as Ha,O as Rs,V as Ps,W as Za,Y as Ya,_ as Xa,$ as el,a0 as Yt,a1 as qt,a2 as os,a3 as tl,a4 as sl,a5 as cs,a6 as $s,a7 as al,a8 as ll,a9 as Dt,aa as Es,ab as Vt,ac as ja,ad as rl,ae as nl,af as Kt,ag as _a,ah as il,ai as ol,aj as cl,ak as dl,al as xl,am as ml,an as Ds}from"./icons-vendor-DF3hof7q.js";import{R as Ft,B as pl,X as Ts,Y as Ms,T as Bt,a as ul,C as Xt,A as hl,b as gl,c as bl,P as qs,d as Fs,L as fl}from"./charts-vendor-BxxJOyEX.js";import"./vendor-D-Edl3pr.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))o(x);new MutationObserver(x=>{for(const v of x)if(v.type==="childList")for(const k of v.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&o(k)}).observe(document,{childList:!0,subtree:!0});function l(x){const v={};return x.integrity&&(v.integrity=x.integrity),x.referrerPolicy&&(v.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?v.credentials="include":x.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function o(x){if(x.ep)return;x.ep=!0;const v=l(x);fetch(x.href,v)}})();const yl=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,94.967678 C78.0600632,72.5405324 98.33054,57.0003 121.73,57.0003 Z M86.6602,103.417 C62.9972,103.417 43.7462,122.667 43.7462,146.33 C43.7462,169.992 62.9972,189.244 86.6602,189.244 L105.7645,189.244 L129.869462,148.004782 C129.678439,147.482425 129.5742,146.918336 129.5742,146.33 C129.5742,122.667 110.3232,103.417 86.6602,103.417 Z",fill:"currentColor"})})}),ds=({sizeClass:t="w-12 h-12",logoClassName:s="w-full h-full text-white"})=>e.jsxs("div",{className:"relative z-10 flex items-center justify-center",children:[e.jsx("div",{className:"absolute -inset-1 bg-blue-500/20 rounded-xl blur opacity-25"}),e.jsxs("div",{className:`relative ${t} rounded-xl flex items-center justify-center group-hover:scale-105 transition-transform duration-300`,children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 120 120","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"login-squircle-gradient",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-brand))"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-brand-light))"})]})}),e.jsx("path",{d:"M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25Line truncated
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(bs,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:Ve,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:F,children:"取消"}),e.jsxs("button",{onClick:Lt,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:F,children:[F?e.jsx(Ee,{className:"w-4 h-4 animate-spin"}):e.jsx(Ge,{className:"w-4 h-4"}),F?"保存中...":"保存"]})]})})]})}),document.body)]})},tn=t=>({total:Number((t==null?void 0:t.total)||0),success_count:Number((t==null?void 0:t.success_count)||0),failed_count:Number((t==null?void 0:t.failed_count)||0),results:Array.isArray(t==null?void 0:t.results)?t.results.map(s=>({order_id:String((s==null?void 0:s.order_id)||"unknown"),success:(s==null?void 0:s.success)===!0,message:String((s==null?void 0:s.message)||"")})):[]}),sn=t=>(t==null?void 0:t.results.filter(s=>!s.success))||[],Ys=({status:t})=>{const s={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-brand text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600",unknown:"bg-gray-100 text-gray-500"},l={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中",unknown:"未知"};return e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${s[t]||s.cancelled}`,children:l[t]||t})},an=()=>{const[t,s]=r.useState([]),[l,o]=r.useState([]),[x,v]=r.useState([]),[k,A]=r.useState({}),[b,O]=r.useState("all"),[j,V]=r.useState(""),[Y,pe]=r.useState(""),[ce,w]=r.useState(""),M=r.useRef(0),[de,G]=r.useState(1),[X,U]=r.useState(1),[fe,ge]=r.useState(!1),[L,K]=r.useState(!1),[ae,Z]=r.useState(!1),[me,R]=r.useState(!1),[E,ee]=r.useState(null),[T,se]=r.useState(null),[ke,ye]=r.useState({}),[z,m]=r.useState(!1),[f,W]=r.useState(""),[q,ne]=r.useState(!1),[be,ve]=r.useState(null),[De,Ne]=r.useState(null),[c,S]=r.useState(null),[Q,u]=r.useState(!1),[d,F]=r.useState(null),[I,H]=r.useState(null),P=async()=>{const p=++M.current;ge(!0);try{const $=await Hl(j||void 0,b,de,20,ce);if(p!==M.current)return;s($.data),U($.total_pages)}catch($){console.error("加载订单失败:",$)}finally{p===M.current&&ge(!1)}},Ce=(p,$,ie)=>{if(ie&&ie.trim())return ie;if(k[`${p}:${$}`])return k[`${p}:${$}`];const re=l.find(ze=>{if(ie&&ze.item_title){const He=ie.toLowerCase(),Xe=ze.item_title.toLowerCase();return Xe.includes(He)||He.includes(Xe)}return!1});return re!=null&&re.item_title?re.item_title:"未知商品"},Re=p=>{const $={};p.forEach(ie=>{ie.item_id&&($[`${ie.cookie_id}:${ie.item_id}`]=ie.item_title||ie.item_id)}),A($)};r.useEffect(()=>{const p=window.setTimeout(()=>{G(1),w(Y.trim())},300);return()=>window.clearTimeout(p)},[Y]),r.useEffect(()=>{P()},[j,b,de,ce]),r.useEffect(()=>{Promise.all([Mt(),vt()]).then(([p,$])=>{v(p),o($),Re($)}).catch(p=>{console.error("加载商品列表失败:",p)})},[]);const xe=r.useMemo(()=>new Map(x.map(p=>[p.id,p])),[x]),Pe=p=>{const $=xe.get(p),ie=($==null?void 0:$.remark)||($==null?void 0:$.nickname);return ie?`${ie} · ${p.slice(0,6)}`:`账号 ${p.slice(0,8)}`},le=p=>{const $=xe.get(p);return($==null?void 0:$.remark)||($==null?void 0:$.nickname)||"未命名账号"},g=async()=>{ge(!0);try{const p=await Xl(j||void 0,b);await P(),p!=null&&p.message&&alert(p.message)}catch(p){console.error("同步订单失败:",p),alert((p==null?void 0:p.message)||"同步失败,请重试")}finally{ge(!1)}},y=p=>{W(p),ve(null),m(!0)},D=async p=>{var $;ne(!0),ve(null);try{const ie=await tr([f],p),re=($=ie==null?void 0:ie.results)==null?void 0:$[0];re!=null&&re.success?(ve({success:!0,message:re.message}),P()):ve({success:!1,message:(re==null?void 0:re.message)||"发货失败"})}catch(ie){ve({success:!1,message:(ie==null?void 0:ie.message)||"请求失败"})}finally{ne(!1)}},J=p=>{ee(p),K(!0)},Se=p=>{se({...p}),Z(!0)},$e=async()=>{if(!(!T||!T.order_id))try{const p={};T.status!==void 0&&(p.order_status=T.status),T.buyer_id!==void 0&&(p.buyer_id=T.buyer_id),T.amount!==void 0&&(p.amount=T.amount),T.receiver_name!==void 0&&(p.receiver_name=T.receiver_name),T.receiver_phone! Line truncated
VIP-MONTH-002
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(I=>I.map(H=>`"${String(H).replace(/"/g,'""')}"`).join(",")).join(`
`),u=new Blob(["\uFEFF"+Q],{type:"text/csv;charset=utf-8"}),d=URL.createObjectURL(u),F=document.createElement("a");F.href=d,F.download="卡密组批量导入模板.csv",document.body.appendChild(F),F.click(),F.remove(),URL.revokeObjectURL(d)},ve=async()=>{if(M){fe(!0),X(null);try{const c=await or(M);if(X(c),c.created>0){const S=await Ze();s(S)}}catch(c){X({error:(c==null?void 0:c.message)||"上传失败"})}finally{fe(!1)}}},De=async()=>{if(!(!ge||!K.trim())){fe(!0),me(null);try{const c=await cr(ge,K);me({added:c.added}),ae("");const S=await Ze();s(S)}catch(c){alert("追加失败:"+((c==null?void 0:c.message)||"未知错误"))}finally{fe(!1)}}},Ne=()=>{var c;w("create"),de(null),X(null),L((c=q[0])!=null&&c.id?String(q[0].id):""),ae(""),me(null),pe(!0)};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:Ne,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[e.jsx($t,{className:"w-5 h-5"}),"批量导入"]}),e.jsxs("button",{onClick:()=>v(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[e.jsx(Ye,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),e.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-gray-50 bg-surface-muted p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative sm:w-48",children:[e.jsx(ya,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsxs("select",{"aria-label":"按卡密类型筛选",value:R,onChange:c=>E(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-9 text-sm shadow-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),e.jsx("option",{value:"data",children:"批量卡密"}),e.jsx("option",{value:"text",children:"文本"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"image",children:"图片"})]})]}),e.jsxs("div",{className:"relative w-full sm:max-w-sm",children:[e.jsx(Nt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search","aria-label":"按卡密名称搜索",placeholder:"搜索卡密名称...",value:ee,onChange:c=>T(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-4 text-sm shadow-sm"})]})]}),e.jsxs("div",{className:"whitespace-nowrap px-1 text-xs font-bold text-gray-400",children:["显示 ",ne.length," / ",t.length," 组"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[e.jsx("th",{className:"w-[23%] px-5 py-5",children:"卡密名称"}),e.jsx("th",{className:"w-[8%] px-3 py-5",children:"卡密组ID"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"类型"}),e.jsx("th",{className:"w-[27%] px-5 py-5",children:"内容/库存"}),e.jsx("th",{className:"w-[19%] px-5 py-5",children:"描述"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"状态"}),e.jsx("th",{className:"w-[9%] px-3 py-5 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:ne.map(c=>{let S="";return c.type==="data"&&c.data_content?S=`库存: ${c.data_content.split(`
`).filter(u=>u.trim()).length} 条`:c.type==="text"&&c.text_content?S=c.text_content:c.type==="api"&&c.api_config?S=c.api_config.url:c.type==="image"&&c.image_url&&(S="图片链接"),e.jsxs("tr",{className:"hover:bg-warning-50/50 transition-colors group",children:[e.jsx("td",{className:"px-5 py-5 align-middle",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white",children:e.jsx(se,{type:c.type})}),e.jsx("span",{className:"line-clamp-3 min-w-0 text-[13px] font-bold leading-5 text-gray-900",title:c.name,children:c.name})]})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("button",{onClick:()=>W(c.id),className:"inline-flex max-w-full items-center gap-1 rounded-lg bg-gray-100 px-2 py-1.5 font-mono text-[11px] font-extrabold text-gray-700 transition-colors hover:bg-gray-200",title:"复制卡密组ID,用于批量铺货表格",children:[e.jsx("span",{className:"truncate",children:c.id}),e.jsx(Ha,{className:"h-3 w-3 shrink-0"})]})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("span",{className:`inline-flex rounded-md px-2 py-1 text-[11px] font-bold ${c.type==="text"?"bg-blue-50 text-blue-600":c.type==="data"?"bg-purple-50 text-purple-600":c.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:c.type==="text"?"文本":c.type==="data"?"批量":c.type==="api"?"API":"图片"})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"line-clamp-3 break-all font-mono text-sm leading-5 text-gray-600",title:S,children:S})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"block truncate text-sm text-gray-500",title:c.description||"-",children:c.description||"-"})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("button",{onClick:()=>f(c),className:`w-12 h-8 rounded-full relative transition-colors ${c.enabled?"bg-green-500":"bg-gray-300"}`,children:e.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${c.enabled?"left-5":"left-1"}`})})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx("button",{onClick:()=>ke(c),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-black",title:"编辑",children:e.jsx(_t,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>z(c.id),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500",children:e.jsx(Je,{className:"h-4 w-4"})})]})})]},c.id)})})]})}),ne.length===0&&e.jsxs("div",{className:"py-20 text-center text-gray-400",children:[e.jsx(ha,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:t.length===0?"暂无卡密配置,请点击右上角添加。":"没有符合当前筛选条件的卡密组。"})]})]}),l&&k&&Me.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),e.jsx("button",{onClick:()=>o(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:e.jsx(Te,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:b.name||"",onChange:c=>O({...b,name:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),e.jsxs("select",{value:b.type||"text",onChange:c=>O({...b,type:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"请选择类型"}),e.jsx("option",{value:"text",children:"固定文字"}),e.jsx("option",{value:"data",children:"批量数据"}),(k==null?void 0:k.type)==="api"&&e.jsx("option",{value:"api",children:"API接口(仅保留现有配置)"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),b.type==="api"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),e.jsx("input",{type:"url",value:b.api_url||"",onChange:c=>O({...b,api_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsLine truncated
卡号1:密码1
卡号2:密码2
或者
兑换码1
兑换码2`}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-blue-600",children:b.data_content?b.data_content.split(`
`).filter(c=>c.trim()).length:0})," 条"]})]})]}),b.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:b.image_url||"",onChange:c=>O({...b,image_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),b.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:b.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:c=>{c.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:b.delay_seconds||0,onChange:c=>O({...b,delay_seconds:parseInt(c.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:b.description||"",onChange:c=>O({...b,description:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:()=>O({...b,enabled:!b.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${b.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${b.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>o(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:ye,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(Ge,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),x&&Me.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:()=>v(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(Te,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:j.name,onChange:c=>V({...j,name:c.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>V({...j,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="data"?"bg-brand text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(ns,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:()=>V({...j,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="text"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(Rs,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:()=>V({...j,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="image"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children Line truncated
CODE-789012
...`:"请输入每次发货时发送的固定文字"}),j.type==="data"&&e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-brand",children:j.content.split(`
`).filter(c=>c.trim()).length})," 条"]})]}),j.type==="api"&&e.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),e.jsxs("select",{value:j.api_method,onChange:c=>V({...j,api_method:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"GET",children:"GET"}),e.jsx("option",{value:"POST",children:"POST"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),e.jsx("input",{type:"number",min:"1",max:"60",value:j.api_timeout,onChange:c=>V({...j,api_timeout:parseInt(c.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),e.jsx("textarea",{value:j.api_headers,onChange:c=>V({...j,api_headers:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),e.jsx("textarea",{value:j.api_params,onChange:c=>V({...j,api_params:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),e.jsx("input",{value:j.description,onChange:c=>V({...j,description:c.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),e.jsx("input",{type:"number",value:j.delay_seconds,onChange:c=>V({...j,delay_seconds:parseInt(c.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>v(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:m,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(Ye,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),Y&&Me.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:()=>pe(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(Te,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:()=>w("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ce==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Za,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:()=>w("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ce==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx($t,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),ce==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:be,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm tran Line truncated
VIP-002
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),Z&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",Z.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>pe(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),ce==="create"?e.jsxs("button",{onClick:ve,disabled:!M||U,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[U?e.jsx(Ee,{className:"w-4 h-4 animate-spin"}):e.jsx($t,{className:"w-4 h-4"}),U?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:De,disabled:!ge||!K.trim()||U||q.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[U?e.jsx(Ee,{className:"w-4 h-4 animate-spin"}):e.jsx(Ye,{className:"w-4 h-4"}),U?"处理中...":"追加卡密"]})]})]})}),document.body)]})},nn=t=>t.find(s=>s.status==="running"||s.status==="canceling"),ea="ydisks-amap-js-api",on="c9b68d4ce9a2a97f22a4a439404488ca";let It=null;const cn=()=>on,dn=()=>window.AMap?Promise.resolve(window.AMap):It||(It=new Promise((t,s)=>{const l=document.getElementById(ea),o=l||document.createElement("script"),x=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(k)},v=()=>{window.AMap?(x(),t(window.AMap)):(x(),s(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},k=window.setTimeout(()=>{x(),s(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=v,o.id=ea,o.async=!0,o.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(cn())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,o.onerror=()=>{x(),s(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},l||document.head.appendChild(o)}).catch(t=>{throw It=null,t}),It),Gt=t=>Number.isFinite(t)&&t!==0,xn=t=>{var x,v;const s=Number((x=t.location)==null?void 0:x.lng),l=Number((v=t.location)==null?void 0:v.lat),o={area:String(t.adname||"").trim(),city:String(t.cityname||"").trim(),division_id:String(t.adcode||"").trim(),longitude:s,latitude:l,poi_id:String(t.id||"").trim(),poi_name:String(t.name||"").trim(),province:String(t.pname||"").trim()};return!o.division_id||!o.province||!o.city||!o.poi_id||!o.poi_name||!Gt(s)||!Gt(l)||s<-180||s>180||l<-90||l>90?null:o},mn=async(t,s)=>{if(!Gt(t)||!Gt(s)||t<-180||t>180||s<-90||s>90)throw new Error("经纬度无效");const l=await dn();return new Promise((o,x)=>{new l.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[t,s],1e3,(k,A)=>{var O;if(k!=="complete"){if(k==="no_data"){o([]);return}x(new Error("高德地图附近地址查询失败,请稍后重试"));return}const b=(((O=A==null?void 0:A.poiList)==null?void 0:O.pois)||[]).map(xn).filter(j=>j!==null);o(b)})})},pn=t=>{const s=String(t||"").trim();return s?/^[¥¥]/.test(s)?s:`¥${s}`:"-"},un=({onConfigureDelivery:t})=>{const[s,l]=r.useState([]),[o,x]=r.useState([]),[v,k]=r.useState([]),[A,b]=r.useState(""),[O,j]=r.useState(""),[V,Y]=r.useState(!1),[pe,ce]=r.useState(!1),[w,M]=r.useState(!1),[de,G]=r.useState(!1),[X,U]=r.useState(!1),[fe,ge]=r.useState(!1),[L,K]=r.useState(!1),[ae,Z]=r.useState("upload"),[me,R]=r.useState(null),[E,ee]=r.useState(null),[T,se]=r.useState(""),[ke,ye]=r.useState(!1),[z,m]=r.useState(!1),[f,W]=r.useState([]),[q,ne]=r.useState(null),[be,ve]=r.useState([]),[De,Ne]=r.useState(null),[c,S]=r.useState({catId:"",catName:"",channelCatId:"",tbCatId:""}),[Q,u]=r.useState(null),[d,F]=r.useState(null),[I,H]=r.useState(null),P=r.useRef(!1),[Ce,Re]=r.useState(null),[xe,Pe]=r.useState({}),[le,g]=r.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[y,D]=r.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),[J,Se]=r.useState([]);r.useEffect(()=>{if(!fe||y.images.length===0){Se([]);return}const n=y.images.map((C,i)=>({key:C.name+i,url:URL.createObjectURL(C)}));return Se(n),()=>{n.forEach(C=>URL.revokeObjectURL(C.url))}},[fe,y.images]);const $e=async()=>{const n=await vt();l(n)},Le=async()=>{x(await us())};r.useEffect(()=>{Promise.all([Mt(),vt(),us(),Vs(20)]).then(([n,C,i,N])=>{k(n),l(C),x(i);const a=N.find(h=>["running","canceling"].includes(h.status))||N.find(h=>h.status!=="preview");H(a||null)}).catch(n=>console.error("加载商品配置失败:",n))},[]),r.useEffect(()=>{if(!L||!(d!=null&&d.id)||!["running","canceling"].includes(d.status))return;const n=window.setInterval(async()=>{if(!P.current){P.current=!0;try{const C=await bt(d.id);F(C),H(C),["ru Line truncated
`),N=new Blob(["\uFEFF"+i],{type:"text/csv;charset=utf-8"}),a=URL.createObjectURL(N),h=document.createElement("a");h.href=a,h.download="批量铺货模板.csv",document.body.appendChild(h),h.click(),h.remove(),URL.revokeObjectURL(a)},St=()=>{g(n=>({...n,cookie_id:A||n.cookie_id})),U(!0)},lt=()=>{D(n=>({...n,cookie_id:A||n.cookie_id})),ge(!0)},rt=async n=>{if(!(n?A:y.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");m(!0),navigator.geolocation.getCurrentPosition(async i=>{try{const N=await mn(i.coords.longitude,i.coords.latitude);if(!N.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");n?(ve(N),Ne(N[0])):(W(N),ne(N[0]))}catch(N){alert((N==null?void 0:N.message)||"获取发货地失败")}finally{m(!1)}},i=>{m(!1),alert(i.code===i.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")},{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})},Lt=n=>o.filter(C=>C.cookie_id===n.cookie_id&&C.item_id===n.item_id).length>0?o.filter(C=>C.cookie_id===n.cookie_id&&C.item_id===n.item_id):o.filter(C=>C.cookie_id===n.cookie_id&&!C.item_id),nt=n=>{switch(n){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:return n||"-"}},ut=n=>{switch(n){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"partially_failed":case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}},et=r.useMemo(()=>new Map(v.map(n=>[n.id,n])),[v]),it=r.useMemo(()=>O?s.filter(n=>n.cookie_id===O):s,[O,s]),Ve=n=>{const C=et.get(n),i=(C==null?void 0:C.remark)||(C==null?void 0:C.nickname);return i?`${i} · ${n.slice(0,6)}`:`账号 ${n.slice(0,8)}`},ht=n=>{const C=et.get(n);return(C==null?void 0:C.remark)||(C==null?void 0:C.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),e.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-account-filter",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"商品列表筛选"}),e.jsxs("div",{className:"relative",children:[e.jsx(el,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-account-filter","aria-label":"按账号筛选商品列表",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:O,onChange:n=>j(n.target.value),children:[e.jsx("option",{value:"",children:"全部账号"}),v.map(n=>e.jsx("option",{value:n.id,children:Ve(n.id)},n.id))]})]})]}),e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-sync-account",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"同步商品账号"}),e.jsxs("div",{className:"relative",children:[e.jsx(xt,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-sync-account","aria-label":"选择要同步商品的账号",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:A,onChange:n=>b(n.target.value),children:[e.jsx("option",{value:"",children:"请选择账号"}),v.map(n=>e.jsx("option",{value:n.id,children:Ve(n.id)},n.id))]})]})]}),e.jsxs("button",{onClick:Ae,disabled:V||!A,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[e.jsx(Be,{className:`w-4 h-4 ${V?"animate-spin":""}`}),"同步商品"]}),e.jsxs("button",{onClick:St,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[e.jsx(Ye,{className:"w-4 h-4"}),"添加商品"]}),e.jsxs("button",{onClick:lt,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-500 text-white hover:bg-emerald-600 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[e.jsx(Yt,{className:"w-4 h-4"}),"发布商品"]}),e.jsxs("button",{onClick:()=>void re(),className:"px-5 py-3 rounded-2xl font-bold bg-brand text-white hover:bg-br Line truncated
@@ -0,0 +1,19 @@
import{j as e,r,c as ys,b as qe,d as Ua}from"./react-vendor-C_od1ZSF.js";import{L as Wa,U as ha,M as is,C as os,B as ga,S as ba,Z as cs,a as jt,b as js,G as As,c as _s,d as Ns,e as Ja,f as rt,A as $s,D as Va,g as Ps,P as fa,h as qt,E as ya,T as Qa,i as Ga,j as Pe,X as Me,k as Ka,l as Ha,m as vs,n as ja,o as He,Q as Xt,p as xt,q as Ke,r as yt,s as Tt,t as Rs,R as ze,u as _a,v as Za,w as Qe,K as Ya,x as dt,y as lt,z as et,F as Es,H as Nt,I as _t,J as Dt,N as Na,O as Xa,V as Ds,W as Ts,Y as el,_ as tl,$ as sl,a0 as al,a1 as es,a2 as Bt,a3 as ds,a4 as ll,a5 as rl,a6 as xs,a7 as Ms,a8 as nl,a9 as il,aa as Mt,ab as qs,ac as Gt,ad as va,ae as ol,af as cl,ag as Zt,ah as wa,ai as dl,aj as xl,ak as ml,al as pl,am as ul,an as hl,ao as Fs}from"./icons-vendor-BpMgNNfy.js";import{R as zt,B as gl,X as Bs,Y as zs,T as Ut,a as bl,C as ts,A as fl,b as yl,c as jl,P as Us,d as Ws,L as _l}from"./charts-vendor-BxxJOyEX.js";import"./vendor-D-Edl3pr.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))i(m);new MutationObserver(m=>{for(const _ of m)if(_.type==="childList")for(const N of _.addedNodes)N.tagName==="LINK"&&N.rel==="modulepreload"&&i(N)}).observe(document,{childList:!0,subtree:!0});function l(m){const _={};return m.integrity&&(_.integrity=m.integrity),m.referrerPolicy&&(_.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?_.credentials="include":m.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function i(m){if(m.ep)return;m.ep=!0;const _=l(m);fetch(m.href,_)}})();const Nl=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,94.967678 C78.0600632,72.5405324 98.33054,57.0003 121.73,57.0003 Z M86.6602,103.417 C62.9972,103.417 43.7462,122.667 43.7462,146.33 C43.7462,169.992 62.9972,189.244 86.6602,189.244 L105.7645,189.244 L129.869462,148.004782 C129.678439,147.482425 129.5742,146.918336 129.5742,146.33 C129.5742,122.667 110.3232,103.417 86.6602,103.417 Z",fill:"currentColor"})})}),ms=({sizeClass:t="w-12 h-12",logoClassName:a="w-full h-full text-white"})=>e.jsxs("div",{className:"relative z-10 flex items-center justify-center",children:[e.jsx("div",{className:"absolute -inset-1 bg-blue-500/20 rounded-xl blur opacity-25"}),e.jsxs("div",{className:`relative ${t} rounded-xl flex items-center justify-center group-hover:scale-105 transition-transform duration-300`,children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 120 120","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"login-squircle-gradient",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-brand))"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-brand-light))"})]})}),e.jsx("path",{d:"M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23Line truncated
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(js,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:n,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:Y,children:"取消"}),e.jsxs("button",{onClick:ut,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:Y,children:[Y?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(He,{className:"w-4 h-4"}),Y?"保存中...":"保存"]})]})})]})}),document.body)]})},ln=t=>({total:Number((t==null?void 0:t.total)||0),success_count:Number((t==null?void 0:t.success_count)||0),failed_count:Number((t==null?void 0:t.failed_count)||0),results:Array.isArray(t==null?void 0:t.results)?t.results.map(a=>({order_id:String((a==null?void 0:a.order_id)||"unknown"),success:(a==null?void 0:a.success)===!0,message:String((a==null?void 0:a.message)||"")})):[]}),rn=t=>(t==null?void 0:t.results.filter(a=>!a.success))||[],sa=({status:t})=>{const a={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-brand text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600",unknown:"bg-gray-100 text-gray-500"},l={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中",unknown:"未知"};return e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${a[t]||a.cancelled}`,children:l[t]||t})},nn=()=>{const[t,a]=r.useState([]),[l,i]=r.useState([]),[m,_]=r.useState([]),[N,I]=r.useState({}),[g,C]=r.useState("all"),[j,F]=r.useState(""),[G,me]=r.useState(""),[oe,v]=r.useState(""),q=r.useRef(0),[ce,Q]=r.useState(1),[ee,B]=r.useState(1),[ge,ue]=r.useState(!1),[k,Z]=r.useState(!1),[se,K]=r.useState(!1),[ve,J]=r.useState(!1),[A,E]=r.useState(null),[P,be]=r.useState(null),[Re,ae]=r.useState({}),[T,p]=r.useState(!1),[b,U]=r.useState(""),[M,ne]=r.useState(!1),[he,ye]=r.useState(null),[Ee,ke]=r.useState(null),[x,V]=r.useState(null),[X,c]=r.useState(!1),[d,D]=r.useState(null),[S,Y]=r.useState(null),O=async()=>{const u=++q.current;ue(!0);try{const L=await Xl(j||void 0,g,ce,20,oe);if(u!==q.current)return;a(L.data),B(L.total_pages)}catch(L){console.error("加载订单失败:",L)}finally{u===q.current&&ue(!1)}},de=(u,L,le)=>{if(le&&le.trim())return le;if(N[`${u}:${L}`])return N[`${u}:${L}`];const _e=l.find(Ue=>{if(le&&Ue.item_title){const Fe=le.toLowerCase(),tt=Ue.item_title.toLowerCase();return tt.includes(Fe)||Fe.includes(tt)}return!1});return _e!=null&&_e.item_title?_e.item_title:"未知商品"},Se=u=>{const L={};u.forEach(le=>{le.item_id&&(L[`${le.cookie_id}:${le.item_id}`]=le.item_title||le.item_id)}),I(L)};r.useEffect(()=>{const u=window.setTimeout(()=>{Q(1),v(G.trim())},300);return()=>window.clearTimeout(u)},[G]),r.useEffect(()=>{O()},[j,g,ce,oe]),r.useEffect(()=>{Promise.all([Ft(),vt()]).then(([u,L])=>{_(u),i(L),Se(L)}).catch(u=>{console.error("加载商品列表失败:",u)})},[]);const fe=r.useMemo(()=>new Map(m.map(u=>[u.id,u])),[m]),Oe=u=>{const L=fe.get(u),le=(L==null?void 0:L.remark)||(L==null?void 0:L.nickname);return le?`${le} · ${u.slice(0,6)}`:`账号 ${u.slice(0,8)}`},re=u=>{const L=fe.get(u);return(L==null?void 0:L.remark)||(L==null?void 0:L.nickname)||"未命名账号"},h=async()=>{ue(!0);try{const u=await sr(j||void 0,g);await O(),u!=null&&u.message&&alert(u.message)}catch(u){console.error("同步订单失败:",u),alert((u==null?void 0:u.message)||"同步失败,请重试")}finally{ue(!1)}},f=u=>{U(u),ye(null),p(!0)},R=async u=>{var L;ne(!0),ye(null);try{const le=await lr([b],u),_e=(L=le==null?void 0:le.results)==null?void 0:L[0];_e!=null&&_e.success?(ye({success:!0,message:_e.message}),O()):ye({success:!1,message:(_e==null?void 0:_e.message)||"发货失败"})}catch(le){ye({success:!1,message:(le==null?void 0:le.message)||"请求失败"})}finally{ne(!1)}},z=u=>{E(u),Z(!0)},Ie=u=>{be({...u}),K(!0)},Ae=async()=>{if(!(!P||!P.order_id))try{const u={};P.status!==void 0&&(u.order_status=P.status),P.buyer_id!==void 0&&(u.buyer_id=P.buyer_id),P.amount!==void 0&&(u.amount=P.amount),P.receiver_name!==void 0&&(u.receiver_name=P.receiver_name),P.receiver_phone!== Line truncated
VIP-MONTH-002
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(S=>S.map(Y=>`"${String(Y).replace(/"/g,'""')}"`).join(",")).join(`
`),c=new Blob(["\uFEFF"+X],{type:"text/csv;charset=utf-8"}),d=URL.createObjectURL(c),D=document.createElement("a");D.href=d,D.download="卡密组批量导入模板.csv",document.body.appendChild(D),D.click(),D.remove(),URL.revokeObjectURL(d)},ye=async()=>{if(q){ge(!0),ee(null);try{const x=await xr(q);if(ee(x),x.created>0){const V=await Xe();a(V)}}catch(x){ee({error:(x==null?void 0:x.message)||"上传失败"})}finally{ge(!1)}}},Ee=async()=>{if(!(!ue||!Z.trim())){ge(!0),ve(null);try{const x=await mr(ue,Z);ve({added:x.added}),se("");const V=await Xe();a(V)}catch(x){alert("追加失败:"+((x==null?void 0:x.message)||"未知错误"))}finally{ge(!1)}}},ke=()=>{var x;v("create"),ce(null),ee(null),k((x=M[0])!=null&&x.id?String(M[0].id):""),se(""),ve(null),me(!0)};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:ke,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[e.jsx(Dt,{className:"w-5 h-5"}),"批量导入"]}),e.jsxs("button",{onClick:()=>_(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[e.jsx(et,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),e.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-gray-50 bg-surface-muted p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative sm:w-48",children:[e.jsx(Na,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsxs("select",{"aria-label":"按卡密类型筛选",value:J,onChange:x=>A(x.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-9 text-sm shadow-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),e.jsx("option",{value:"data",children:"批量卡密"}),e.jsx("option",{value:"text",children:"文本"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"image",children:"图片"})]})]}),e.jsxs("div",{className:"relative w-full sm:max-w-sm",children:[e.jsx(Nt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search","aria-label":"按卡密名称搜索",placeholder:"搜索卡密名称...",value:E,onChange:x=>P(x.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-4 text-sm shadow-sm"})]})]}),e.jsxs("div",{className:"whitespace-nowrap px-1 text-xs font-bold text-gray-400",children:["显示 ",ne.length," / ",t.length," 组"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[e.jsx("th",{className:"w-[23%] px-5 py-5",children:"卡密名称"}),e.jsx("th",{className:"w-[8%] px-3 py-5",children:"卡密组ID"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"类型"}),e.jsx("th",{className:"w-[27%] px-5 py-5",children:"内容/库存"}),e.jsx("th",{className:"w-[19%] px-5 py-5",children:"描述"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"状态"}),e.jsx("th",{className:"w-[9%] px-3 py-5 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:ne.map(x=>{let V="";return x.type==="data"&&x.data_content?V=`库存: ${x.data_content.split(`
`).filter(c=>c.trim()).length} 条`:x.type==="text"&&x.text_content?V=x.text_content:x.type==="api"&&x.api_config?V=x.api_config.url:x.type==="image"&&x.image_url&&(V="图片链接"),e.jsxs("tr",{className:"hover:bg-warning-50/50 transition-colors group",children:[e.jsx("td",{className:"px-5 py-5 align-middle",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white",children:e.jsx(be,{type:x.type})}),e.jsx("span",{className:"line-clamp-3 min-w-0 text-[13px] font-bold leading-5 text-gray-900",title:x.name,children:x.name})]})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("button",{onClick:()=>U(x.id),className:"inline-flex max-w-full items-center gap-1 rounded-lg bg-gray-100 px-2 py-1.5 font-mono text-[11px] font-extrabold text-gray-700 transition-colors hover:bg-gray-200",title:"复制卡密组ID,用于批量铺货表格",children:[e.jsx("span",{className:"truncate",children:x.id}),e.jsx(Xa,{className:"h-3 w-3 shrink-0"})]})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("span",{className:`inline-flex rounded-md px-2 py-1 text-[11px] font-bold ${x.type==="text"?"bg-blue-50 text-blue-600":x.type==="data"?"bg-purple-50 text-purple-600":x.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:x.type==="text"?"文本":x.type==="data"?"批量":x.type==="api"?"API":"图片"})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"line-clamp-3 break-all font-mono text-sm leading-5 text-gray-600",title:V,children:V})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"block truncate text-sm text-gray-500",title:x.description||"-",children:x.description||"-"})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("button",{onClick:()=>b(x),className:`w-12 h-8 rounded-full relative transition-colors ${x.enabled?"bg-green-500":"bg-gray-300"}`,children:e.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${x.enabled?"left-5":"left-1"}`})})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx("button",{onClick:()=>Re(x),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-black",title:"编辑",children:e.jsx(_t,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>T(x.id),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500",children:e.jsx(Qe,{className:"h-4 w-4"})})]})})]},x.id)})})]})}),ne.length===0&&e.jsxs("div",{className:"py-20 text-center text-gray-400",children:[e.jsx(fa,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:t.length===0?"暂无卡密配置,请点击右上角添加。":"没有符合当前筛选条件的卡密组。"})]})]}),l&&N&&qe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),e.jsx("button",{onClick:()=>i(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:e.jsx(Me,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:g.name||"",onChange:x=>C({...g,name:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),e.jsxs("select",{value:g.type||"text",onChange:x=>C({...g,type:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"请选择类型"}),e.jsx("option",{value:"text",children:"固定文字"}),e.jsx("option",{value:"data",children:"批量数据"}),(N==null?void 0:N.type)==="api"&&e.jsx("option",{value:"api",children:"API接口(仅保留现有配置)"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),g.type==="api"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),e.jsx("input",{type:"url",value:g.api_url||"",onChange:x=>C({...g,api_url:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsLine truncated
卡号1:密码1
卡号2:密码2
或者
兑换码1
兑换码2`}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-blue-600",children:g.data_content?g.data_content.split(`
`).filter(x=>x.trim()).length:0})," 条"]})]})]}),g.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:g.image_url||"",onChange:x=>C({...g,image_url:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),g.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:g.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:x=>{x.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:g.delay_seconds||0,onChange:x=>C({...g,delay_seconds:parseInt(x.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:g.description||"",onChange:x=>C({...g,description:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:()=>C({...g,enabled:!g.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${g.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${g.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>i(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:ae,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(He,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),m&&qe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:()=>_(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(Me,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:j.name,onChange:x=>F({...j,name:x.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>F({...j,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="data"?"bg-brand text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(os,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:()=>F({...j,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="text"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(Ds,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:()=>F({...j,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${j.type==="image"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children Line truncated
CODE-789012
...`:"请输入每次发货时发送的固定文字"}),j.type==="data"&&e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-brand",children:j.content.split(`
`).filter(x=>x.trim()).length})," 条"]})]}),j.type==="api"&&e.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),e.jsxs("select",{value:j.api_method,onChange:x=>F({...j,api_method:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"GET",children:"GET"}),e.jsx("option",{value:"POST",children:"POST"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),e.jsx("input",{type:"number",min:"1",max:"60",value:j.api_timeout,onChange:x=>F({...j,api_timeout:parseInt(x.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),e.jsx("textarea",{value:j.api_headers,onChange:x=>F({...j,api_headers:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),e.jsx("textarea",{value:j.api_params,onChange:x=>F({...j,api_params:x.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),e.jsx("input",{value:j.description,onChange:x=>F({...j,description:x.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),e.jsx("input",{type:"number",value:j.delay_seconds,onChange:x=>F({...j,delay_seconds:parseInt(x.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>_(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:p,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(et,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),G&&qe.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:()=>me(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(Me,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:()=>v("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${oe==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(el,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:()=>v("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${oe==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Dt,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),oe==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:he,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm tran Line truncated
VIP-002
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),K&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",K.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>me(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),oe==="create"?e.jsxs("button",{onClick:ye,disabled:!q||B,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[B?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(Dt,{className:"w-4 h-4"}),B?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:Ee,disabled:!ue||!Z.trim()||B||M.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[B?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(et,{className:"w-4 h-4"}),B?"处理中...":"追加卡密"]})]})]})}),document.body)]})},dn=t=>t.find(a=>a.status==="running"||a.status==="canceling"),la="ydisks-amap-js-api",xn="c9b68d4ce9a2a97f22a4a439404488ca";let $t=null;const mn=()=>xn,pn=()=>window.AMap?Promise.resolve(window.AMap):$t||($t=new Promise((t,a)=>{const l=document.getElementById(la),i=l||document.createElement("script"),m=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(N)},_=()=>{window.AMap?(m(),t(window.AMap)):(m(),a(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},N=window.setTimeout(()=>{m(),a(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=_,i.id=la,i.async=!0,i.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(mn())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,i.onerror=()=>{m(),a(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},l||document.head.appendChild(i)}).catch(t=>{throw $t=null,t}),$t),Ht=t=>Number.isFinite(t)&&t!==0,un=t=>{var m,_;const a=Number((m=t.location)==null?void 0:m.lng),l=Number((_=t.location)==null?void 0:_.lat),i={area:String(t.adname||"").trim(),city:String(t.cityname||"").trim(),division_id:String(t.adcode||"").trim(),longitude:a,latitude:l,poi_id:String(t.id||"").trim(),poi_name:String(t.name||"").trim(),province:String(t.pname||"").trim()};return!i.division_id||!i.province||!i.city||!i.poi_id||!i.poi_name||!Ht(a)||!Ht(l)||a<-180||a>180||l<-90||l>90?null:i},hn=async(t,a)=>{if(!Ht(t)||!Ht(a)||t<-180||t>180||a<-90||a>90)throw new Error("经纬度无效");const l=await pn();return new Promise((i,m)=>{new l.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[t,a],1e3,(N,I)=>{var C;if(N!=="complete"){if(N==="no_data"){i([]);return}m(new Error("高德地图附近地址查询失败,请稍后重试"));return}const g=(((C=I==null?void 0:I.poiList)==null?void 0:C.pois)||[]).map(un).filter(j=>j!==null);i(g)})})},gn=t=>{const a=String(t||"").trim();return a?/^[¥¥]/.test(a)?a:`¥${a}`:"-"},bn=({onConfigureDelivery:t})=>{const[a,l]=r.useState([]),[i,m]=r.useState([]),[_,N]=r.useState([]),[I,g]=r.useState(""),[C,j]=r.useState(""),[F,G]=r.useState(!1),[me,oe]=r.useState(!1),[v,q]=r.useState(!1),[ce,Q]=r.useState(!1),[ee,B]=r.useState(!1),[ge,ue]=r.useState(!1),[k,Z]=r.useState(!1),[se,K]=r.useState("upload"),[ve,J]=r.useState(null),[A,E]=r.useState(null),[P,be]=r.useState(""),[Re,ae]=r.useState(!1),[T,p]=r.useState(!1),[b,U]=r.useState([]),[M,ne]=r.useState(null),[he,ye]=r.useState([]),[Ee,ke]=r.useState(null),[x,V]=r.useState({catId:"",catName:"",channelCatId:"",tbCatId:""}),[X,c]=r.useState(null),[d,D]=r.useState(null),[S,Y]=r.useState(null),O=r.useRef(!1),[de,Se]=r.useState(null),[fe,Oe]=r.useState({}),[re,h]=r.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[f,R]=r.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),[z,Ie]=r.useState([]);r.useEffect(()=>{if(!ge||f.images.length===0){Ie([]);return}const n=f.images.map((w,H)=>({key:w.name+H,url:URL.createObjectURL(w)}));return Ie(n),()=>{n.forEach(w=>URL.revokeObjectURL(w.url))}},[ge,f.images]);const Ae=async()=>{const n=await vt();l(n)},we=async()=>{m(await gs())};r.useEffect(()=>{Promise.all([Ft(),vt(),gs(),Hs(20)]).then(([n,w,H,Te])=>{N(n),l(w),m(H);const s=Te.find(o=>["running","canceling"].includes(o.status))||Te.find(o=>o.status!=="preview");Y(s||null)}).catch(n=>console.error("加载商品配置失败:",n))},[]),r.useEffect(()=>{if(!k||!(d!=null&&d.id)||!["running","canceling"].includes(d.status))return;const n=window.setInterval(async()=>{if(!O.current){O.current=!0;try{const w=await bt(d.id);D(w),Y(w),[ Line truncated
`),Te=new Blob(["\uFEFF"+H],{type:"text/csv;charset=utf-8"}),s=URL.createObjectURL(Te),o=document.createElement("a");o.href=s,o.download="批量铺货模板.csv",document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(s)},Lt=()=>{h(n=>({...n,cookie_id:I||n.cookie_id})),B(!0)},nt=()=>{R(n=>({...n,cookie_id:I||n.cookie_id})),ue(!0)},it=async n=>{if(!(n?I:f.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");p(!0),navigator.geolocation.getCurrentPosition(async H=>{try{const Te=await hn(H.coords.longitude,H.coords.latitude);if(!Te.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");n?(ye(Te),ke(Te[0])):(U(Te),ne(Te[0]))}catch(Te){alert((Te==null?void 0:Te.message)||"获取发货地失败")}finally{p(!1)}},H=>{p(!1),alert(H.code===H.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")},{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})},Ot=n=>i.filter(w=>w.cookie_id===n.cookie_id&&w.item_id===n.item_id).length>0?i.filter(w=>w.cookie_id===n.cookie_id&&w.item_id===n.item_id):i.filter(w=>w.cookie_id===n.cookie_id&&!w.item_id),pt=n=>{switch(n){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:return n||"-"}},ut=n=>{switch(n){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"partially_failed":case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}},st=r.useMemo(()=>new Map(_.map(n=>[n.id,n])),[_]),ht=r.useMemo(()=>C?a.filter(n=>n.cookie_id===C):a,[C,a]),Ge=n=>{const w=st.get(n),H=(w==null?void 0:w.remark)||(w==null?void 0:w.nickname);return H?`${H} · ${n.slice(0,6)}`:`账号 ${n.slice(0,8)}`},ot=n=>{const w=st.get(n);return(w==null?void 0:w.remark)||(w==null?void 0:w.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),e.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-account-filter",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"商品列表筛选"}),e.jsxs("div",{className:"relative",children:[e.jsx(al,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-account-filter","aria-label":"按账号筛选商品列表",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:C,onChange:n=>j(n.target.value),children:[e.jsx("option",{value:"",children:"全部账号"}),_.map(n=>e.jsx("option",{value:n.id,children:Ge(n.id)},n.id))]})]})]}),e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-sync-account",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"同步商品账号"}),e.jsxs("div",{className:"relative",children:[e.jsx(xt,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-sync-account","aria-label":"选择要同步商品的账号",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:I,onChange:n=>g(n.target.value),children:[e.jsx("option",{value:"",children:"请选择账号"}),_.map(n=>e.jsx("option",{value:n.id,children:Ge(n.id)},n.id))]})]})]}),e.jsxs("button",{onClick:De,disabled:F||!I,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[e.jsx(ze,{className:`w-4 h-4 ${F?"animate-spin":""}`}),"同步商品"]}),e.jsxs("button",{onClick:Lt,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[e.jsx(et,{className:"w-4 h-4"}),"添加商品"]}),e.jsxs("button",{onClick:nt,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-500 text-white hover:bg-emerald-600 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[e.jsx(es,{className:"w-4 h-4"}),"发布商品"]}),e.jsxs("button",{onClick:()=>void _e(),className:"px-5 py-3 rounded-2xl font-bold bg-brand text-white Line truncated
+3 -3
View File
@@ -6,12 +6,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title> <title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" /> <meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
<script type="module" crossorigin src="/static/assets/index-DhAArJzx.js"></script> <script type="module" crossorigin src="/static/assets/index-Nsmvj8uh.js"></script>
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js"> <link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js">
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-DF3hof7q.js"> <link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-BpMgNNfy.js">
<link rel="modulepreload" crossorigin href="/static/assets/vendor-D-Edl3pr.js"> <link rel="modulepreload" crossorigin href="/static/assets/vendor-D-Edl3pr.js">
<link rel="modulepreload" crossorigin href="/static/assets/charts-vendor-BxxJOyEX.js"> <link rel="modulepreload" crossorigin href="/static/assets/charts-vendor-BxxJOyEX.js">
<link rel="stylesheet" crossorigin href="/static/assets/index-BNFvzMjk.css"> <link rel="stylesheet" crossorigin href="/static/assets/index-DVSGe2YH.css">
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
+6
View File
@@ -93,6 +93,9 @@ func (c *ClientImpl) PolishItem(ctx context.Context, cookiesStr, itemID string)
if duplicatePolishError(err) { if duplicatePolishError(err) {
return &AccountTaskResult{Success: true, Message: "商品今天已经擦亮", UpdatedCookies: updated}, nil return &AccountTaskResult{Success: true, Message: "商品今天已经擦亮", UpdatedCookies: updated}, nil
} }
if IsSessionExpiredErr(err) || IsRiskVerificationErr(err) {
return nil, err
}
primaryErr := err primaryErr := err
if strings.TrimSpace(updated) == "" { if strings.TrimSpace(updated) == "" {
updated = cookiesStr updated = cookiesStr
@@ -141,6 +144,9 @@ func (c *ClientImpl) accountTaskRequest(ctx context.Context, cookiesStr, endpoin
if isRiskVerificationRet(decoded.Ret) { if isRiskVerificationRet(decoded.Ret) {
return nil, updated, &RiskVerificationError{Ret: decoded.Ret} return nil, updated, &RiskVerificationError{Ret: decoded.Ret}
} }
if isSessionExpiredRet(decoded.Ret) {
return nil, updated, sessionExpiredError(api, decoded.Ret)
}
if !isTokenExpiredRet(decoded.Ret) { if !isTokenExpiredRet(decoded.Ret) {
return nil, updated, fmt.Errorf("%s 返回失败: %s", api, firstRet(decoded.Ret)) return nil, updated, fmt.Errorf("%s 返回失败: %s", api, firstRet(decoded.Ret))
} }
@@ -101,3 +101,22 @@ func TestPolishItemFallsBackToAlternateAPI(t *testing.T) {
t.Fatalf("calls=%v want=%v", calls, want) t.Fatalf("calls=%v want=%v", calls, want)
} }
} }
func TestPolishItemSessionExpiredDoesNotCallBackupOrTokenAPI(t *testing.T) {
calls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
calls++
_, _ = w.Write([]byte(`{"ret":["FAIL_SYS_SESSION_EXPIRED::Session过期"],"data":{}}`))
}))
defer server.Close()
client := &ClientImpl{
HTTPClient: server.Client(), PolishItemURL: server.URL, PolishItemBackupURL: server.URL, TokenURL: server.URL,
}
_, err := client.PolishItem(context.Background(), "unb=123; _m_h5_tk=token_1", "item-1")
if err == nil || !IsSessionExpiredErr(err) {
t.Fatalf("err=%v want session expired", err)
}
if calls != 1 {
t.Fatalf("session expiry must stop all fallback/retry requests, calls=%d", calls)
}
}
+42 -2
View File
@@ -208,14 +208,48 @@ func isTokenExpiredRet(ret []string) bool {
for _, r := range ret { for _, r := range ret {
if strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") || if strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") ||
strings.Contains(r, "FAIL_SYS_TOKEN_EXPIRED") || strings.Contains(r, "FAIL_SYS_TOKEN_EXPIRED") ||
strings.Contains(r, "FAIL_SYS_TOKEN_EMPTY") || strings.Contains(r, "FAIL_SYS_TOKEN_EMPTY") {
strings.Contains(r, "FAIL_SYS_SESSION_EXPIRED") {
return true return true
} }
} }
return false return false
} }
// SessionExpiredError 表示平台已经明确判定整个登录 Session 失效。
// 它与可通过响应 Set-Cookie 重签的普通 MTOP token 过期不同:调用方必须
// 立刻停止业务 API 重试,转入账号级 Session 续期流程。
type SessionExpiredError struct {
API string
Ret []string
}
func (e *SessionExpiredError) Error() string {
if e == nil {
return ""
}
if e.API == "" {
return fmt.Sprintf("Session 过期: ret=%v", e.Ret)
}
return fmt.Sprintf("%s Session 过期: ret=%v", e.API, e.Ret)
}
func isSessionExpiredRet(ret []string) bool {
for _, value := range ret {
lower := strings.ToLower(value)
if strings.Contains(lower, "fail_sys_session_expired") ||
strings.Contains(lower, "session过期") ||
strings.Contains(lower, "session expired") ||
strings.Contains(lower, "会话过期") {
return true
}
}
return false
}
func sessionExpiredError(api string, ret []string) error {
return &SessionExpiredError{API: api, Ret: append([]string(nil), ret...)}
}
// RiskVerificationError 表示闲鱼服务端要求用户验证(滑块/人脸/风控页)。 // RiskVerificationError 表示闲鱼服务端要求用户验证(滑块/人脸/风控页)。
// 这类错误不能按普通 token 过期快速重试,否则会持续打接口并放大风控。 // 这类错误不能按普通 token 过期快速重试,否则会持续打接口并放大风控。
type RiskVerificationError struct { type RiskVerificationError struct {
@@ -269,9 +303,15 @@ func IsSessionExpiredErr(err error) bool {
if err == nil { if err == nil {
return false return false
} }
var sessionErr *SessionExpiredError
if errors.As(err, &sessionErr) {
return true
}
msg := strings.ToLower(err.Error()) msg := strings.ToLower(err.Error())
return strings.Contains(msg, "fail_sys_session_expired") || return strings.Contains(msg, "fail_sys_session_expired") ||
strings.Contains(msg, "session过期") || strings.Contains(msg, "session过期") ||
strings.Contains(msg, "session expired") ||
strings.Contains(msg, "会话过期") ||
strings.Contains(msg, "登录凭证已失效") strings.Contains(msg, "登录凭证已失效")
} }
+15 -1
View File
@@ -170,7 +170,7 @@ func TestIsTokenExpiredRet(t *testing.T) {
}{ }{
{[]string{"FAIL_SYS_TOKEN_EXOIRED::令牌过期"}, true}, {[]string{"FAIL_SYS_TOKEN_EXOIRED::令牌过期"}, true},
{[]string{"FAIL_SYS_TOKEN_EXPIRED::令牌过期"}, true}, {[]string{"FAIL_SYS_TOKEN_EXPIRED::令牌过期"}, true},
{[]string{"FAIL_SYS_SESSION_EXPIRED::会话过期"}, true}, {[]string{"FAIL_SYS_SESSION_EXPIRED::会话过期"}, false},
{[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, false}, {[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, false},
{[]string{"SUCCESS::调用成功"}, false}, {[]string{"SUCCESS::调用成功"}, false},
{[]string{"FAIL_BIZ_ORDER_STATUS_ERROR::订单状态错误"}, false}, {[]string{"FAIL_BIZ_ORDER_STATUS_ERROR::订单状态错误"}, false},
@@ -184,6 +184,20 @@ func TestIsTokenExpiredRet(t *testing.T) {
} }
} }
func TestSessionExpiredRetIsSeparateFromTokenExpiry(t *testing.T) {
ret := []string{"FAIL_SYS_SESSION_EXPIRED::会话过期"}
if !isSessionExpiredRet(ret) {
t.Fatal("session expiry must be recognized")
}
if isTokenExpiredRet(ret) {
t.Fatal("session expiry must not enter token retry path")
}
err := sessionExpiredError("test API", ret)
if !IsSessionExpiredErr(fmt.Errorf("wrapped: %w", err)) {
t.Fatalf("typed wrapped error not recognized: %v", err)
}
}
func TestIsSessionExpiredErr(t *testing.T) { func TestIsSessionExpiredErr(t *testing.T) {
cases := []struct { cases := []struct {
err error err error
+3
View File
@@ -42,6 +42,9 @@ func (c *ClientImpl) ConsignContext(ctx context.Context, cookiesStr, orderID str
if ok { if ok {
return true, ret, currentCookies, nil return true, ret, currentCookies, nil
} }
if isSessionExpiredRet(ret) {
return false, ret, currentCookies, sessionExpiredError("确认发货接口", ret)
}
if !isTokenExpiredRet(ret) { if !isTokenExpiredRet(ret) {
return false, ret, currentCookies, nil return false, ret, currentCookies, nil
} }
+3
View File
@@ -67,6 +67,9 @@ func (c *ClientImpl) DetectItemMultiSpec(ctx context.Context, cookies, itemID st
if err := json.Unmarshal(raw, &decoded); err != nil { if err := json.Unmarshal(raw, &decoded); err != nil {
return false, fmt.Errorf("解析商品详情响应失败: %w (body=%s)", err, truncate(string(raw), 300)) return false, fmt.Errorf("解析商品详情响应失败: %w (body=%s)", err, truncate(string(raw), 300))
} }
if isSessionExpiredRet(decoded.Ret) {
return false, sessionExpiredError("商品详情接口", decoded.Ret)
}
if !hasMTopSuccess(decoded.Ret) { if !hasMTopSuccess(decoded.Ret) {
return false, fmt.Errorf("商品详情接口返回非成功: ret=%v", decoded.Ret) return false, fmt.Errorf("商品详情接口返回非成功: ret=%v", decoded.Ret)
} }
+3
View File
@@ -36,6 +36,9 @@ func (c *ClientImpl) FetchItemsPage(ctx context.Context, cookiesStr string, page
if res != nil { if res != nil {
return res, nil return res, nil
} }
if isSessionExpiredRet(ret) {
return nil, sessionExpiredError("商品列表接口", ret)
}
if !isTokenExpiredRet(ret) { if !isTokenExpiredRet(ret) {
return nil, fmt.Errorf("商品列表接口返回非成功: ret=%v", ret) return nil, fmt.Errorf("商品列表接口返回非成功: ret=%v", ret)
} }
+3
View File
@@ -45,6 +45,9 @@ func (c *ClientImpl) FetchOrderDetail(ctx context.Context, cookiesStr, orderID s
result.UpdatedCookies = currentCookies result.UpdatedCookies = currentCookies
return result, nil return result, nil
} }
if isSessionExpiredRet(ret) {
return nil, sessionExpiredError("订单详情接口", ret)
}
if !isTokenExpiredRet(ret) { if !isTokenExpiredRet(ret) {
return nil, fmt.Errorf("订单详情接口返回非成功: ret=%v", ret) return nil, fmt.Errorf("订单详情接口返回非成功: ret=%v", ret)
} }
+3
View File
@@ -108,6 +108,9 @@ func (c *ClientImpl) FetchSoldOrdersPage(ctx context.Context, cookies string, pa
if err := json.Unmarshal(raw, &decoded); err != nil { if err := json.Unmarshal(raw, &decoded); err != nil {
return nil, fmt.Errorf("解析订单列表响应失败: %w (body=%s)", err, truncate(string(raw), 300)) return nil, fmt.Errorf("解析订单列表响应失败: %w (body=%s)", err, truncate(string(raw), 300))
} }
if isSessionExpiredRet(decoded.Ret) {
return nil, sessionExpiredError("订单列表接口", decoded.Ret)
}
if !hasMTopSuccess(decoded.Ret) { if !hasMTopSuccess(decoded.Ret) {
return nil, fmt.Errorf("订单列表接口返回非成功: ret=%v", decoded.Ret) return nil, fmt.Errorf("订单列表接口返回非成功: ret=%v", decoded.Ret)
} }
+3
View File
@@ -77,6 +77,9 @@ func (c *ClientImpl) RefreshTokenWithCredentialContext(ctx context.Context, cook
if isRiskVerificationRet(ret) { if isRiskVerificationRet(ret) {
return refreshResultFromContext(ctx, currentCookies, currentSnapshot, currentSnapshotComplete, cookieStateChanged), &RiskVerificationError{Ret: ret, VerificationURL: verificationURL} return refreshResultFromContext(ctx, currentCookies, currentSnapshot, currentSnapshotComplete, cookieStateChanged), &RiskVerificationError{Ret: ret, VerificationURL: verificationURL}
} }
if isSessionExpiredRet(ret) {
return refreshResultFromContext(ctx, currentCookies, currentSnapshot, currentSnapshotComplete, cookieStateChanged), sessionExpiredError("token API", ret)
}
if !isOfficialTokenRetryRet(ret) { if !isOfficialTokenRetryRet(ret) {
return refreshResultFromContext(ctx, currentCookies, currentSnapshot, currentSnapshotComplete, cookieStateChanged), fmt.Errorf("token API 返回非成功: ret=%v (status=%d)", ret, status) return refreshResultFromContext(ctx, currentCookies, currentSnapshot, currentSnapshotComplete, cookieStateChanged), fmt.Errorf("token API 返回非成功: ret=%v (status=%d)", ret, status)
} }
+3
View File
@@ -30,6 +30,9 @@ func (c *ClientImpl) FetchUserProfile(ctx context.Context, cookiesStr string) (*
if res != nil { if res != nil {
return res, nil return res, nil
} }
if isSessionExpiredRet(ret) {
return nil, sessionExpiredError("账号资料接口", ret)
}
if !isTokenExpiredRet(ret) { if !isTokenExpiredRet(ret) {
return nil, fmt.Errorf("账号资料接口返回非成功: ret=%v", ret) return nil, fmt.Errorf("账号资料接口返回非成功: ret=%v", ret)
} }