From 0b176ea3a0e50716bc0797be22588a048aebe469 Mon Sep 17 00:00:00 2001 From: coulsontl <149155411+coulsontl@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:30:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=EF=BC=9AModelScope?= =?UTF-8?q?=EF=BC=88=E9=AD=94=E6=90=AD=EF=BC=89=E6=B8=A0=E9=81=93=20?= =?UTF-8?q?=E2=80=94=E2=80=94=20=E4=B8=A4=E4=B8=AA=E7=AB=99=E7=82=B9?= =?UTF-8?q?=E5=90=84=E4=B8=80=E5=AE=B6=20provider=EF=BC=88`modelscope`=20?= =?UTF-8?q?=E5=9B=BD=E5=86=85=E7=89=88=20/=20`modelscope-intl`=20=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E7=89=88=EF=BC=89=EF=BC=8C=E6=97=A0=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20OpenAI=20=E5=85=BC=E5=AE=B9=E8=BD=AC=E5=8F=91=E3=80=82?= =?UTF-8?q?=E4=B8=80=E6=9E=9A=20`ms-`=20=E4=BB=A4=E7=89=8C=E4=B8=A4?= =?UTF-8?q?=E7=94=A8=EF=BC=9ABearer=20=E8=B0=83=E6=8E=A8=E7=90=86=E3=80=81?= =?UTF-8?q?Cookie=20=E5=80=BC=E8=AF=BB=E7=BD=91=E9=A1=B5=E7=AB=99=EF=BC=88?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=20/=20=E9=AD=94=E7=B2=92=20/=20=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=EF=BC=89=EF=BC=8C=E6=89=80=E4=BB=A5=E5=8F=AA=E6=9C=89?= =?UTF-8?q?**=E4=B8=80=E4=B8=AA**=E5=87=AD=E8=AF=81=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9B=E4=BB=A4=E7=89=8C=E4=B8=8D=E9=80=8F=E6=98=8E=EF=BC=88?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=20JWT=EF=BC=89=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E6=97=B6=E5=87=BA=E7=BD=91=E6=8E=A2=E6=B4=BB?= =?UTF-8?q?=E6=8D=A2=E4=B8=8A=E6=B8=B8=E7=A8=B3=E5=AE=9A=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=EF=BC=88`HavanaId`=EF=BC=89=E5=81=9A=E8=B4=A6=E5=8F=B7=20id?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E5=90=8C=E4=B8=80=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=8D=A2=E4=B8=80=E6=AC=A1=E4=BB=A4=E7=89=8C=E5=B0=B1=E5=8F=98?= =?UTF-8?q?=E6=88=90=E4=B8=A4=E6=9D=A1=E8=AE=B0=E5=BD=95=E3=80=82=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E7=AB=99=E7=82=B9=E6=98=AF**=E4=B8=A4=E5=A5=97?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BD=93=E7=B3=BB**=EF=BC=88=E5=9B=BD?= =?UTF-8?q?=E5=86=85=E4=BB=A4=E7=89=8C=E6=89=93=E5=9B=BD=E9=99=85=E7=AB=99?= =?UTF-8?q?=E7=BD=91=E9=A1=B5=E6=8E=A5=E5=8F=A3=E5=BE=97=20`401=20access?= =?UTF-8?q?=20forbidden`=EF=BC=89=EF=BC=8C=E6=89=80=E4=BB=A5=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA=E5=81=9A=E6=88=90=20provider=20=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=80=8C=E4=B8=8D=E6=98=AF=E8=B4=A6=E5=8F=B7=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=9B=E6=8B=86=E5=AE=B6=E8=BF=98=E9=A1=BA?= =?UTF-8?q?=E5=B8=A6=E8=A7=A3=E5=86=B3=E3=80=8C=E4=B8=A4=E7=AB=99=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=9B=AE=E5=BD=95=E4=BA=92=E7=9B=B8=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E3=80=8D=EF=BC=88=E5=90=84=2036=20=E6=9D=A1=E3=80=81=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E4=B8=8D=E5=90=8C=EF=BC=8C=E7=BC=93=E5=AD=98=E4=B8=8E?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=8E=92=E6=9C=9F=E5=90=84=E5=8D=A0=E4=B8=80?= =?UTF-8?q?=E6=A0=BC=EF=BC=89=202.=20=E6=96=B0=E5=A2=9E=EF=BC=9AModelScope?= =?UTF-8?q?=20=E6=AF=8F=E6=97=A5=E7=AD=BE=E5=88=B0=20=E2=80=94=E2=80=94=20?= =?UTF-8?q?=E4=B8=8A=E6=B8=B8**=E6=B2=A1=E6=9C=89=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E6=8E=A5=E5=8F=A3**=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=88`GET=20{=E7=BD=91=E9=A1=B5=E7=AB=99}/api/v1/u?= =?UTF-8?q?sers/login/info`=EF=BC=89=E6=9C=AC=E8=BA=AB=E5=B0=B1=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E5=BD=93=E6=97=A5=E9=AD=94=E7=B2=92=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=EF=BC=88=E5=B9=82=E7=AD=89=EF=BC=89=EF=BC=8C=E7=BA=B3=E5=85=A5?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=AD=BE=E5=88=B0=E6=A1=86=E6=9E=B6=EF=BC=88?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E7=AB=99=E7=82=B9=E5=90=84=E6=89=93=E5=90=84?= =?UTF-8?q?=E7=9A=84=E7=BD=91=E9=A1=B5=E7=AB=99=EF=BC=89=E3=80=82=E9=93=BE?= =?UTF-8?q?=E8=B7=AF=E4=BE=9D=E6=8D=AE=E6=98=AF=20CPA=20=E7=9A=84=20`model?= =?UTF-8?q?scope-ratelimit`=20=E6=8F=92=E4=BB=B6=E6=BA=90=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=9C=AC=E5=AE=9E=E7=8E=B0=E7=85=A7=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E6=9D=A1=E9=93=BE=E8=B7=AF=E3=80=81=E6=8A=8A=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E6=97=B6=E6=9C=BA=E4=BA=A4=E7=BB=99=E6=9C=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=203.=20=E6=96=B0=E5=A2=9E=EF=BC=9AModelScope?= =?UTF-8?q?=20=E4=BD=99=E9=A2=9D=E8=AF=BB=E6=95=B0=20=E2=80=94=E2=80=94=20?= =?UTF-8?q?=E9=AD=94=E7=B2=92=E9=92=B1=E5=8C=85=EF=BC=88=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=20/=20=E5=86=BB=E7=BB=93=20/=20=E6=80=BB=E8=AE=A1=EF=BC=89?= =?UTF-8?q?=E4=B8=8E=E4=BB=8A=E6=97=A5=E5=B7=B2=E7=94=A8=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=95=B0=EF=BC=9B=E5=90=8E=E8=80=85=E6=98=AF=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E8=AF=BB=E6=95=B0=EF=BC=8C=E5=8F=96=E4=B8=8D=E5=88=B0=E6=97=B6?= =?UTF-8?q?=E5=8F=AA=E9=99=8D=E7=BA=A7=E4=B8=8D=E6=8A=8A=E6=95=B4=E6=9D=A1?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=98=E5=A4=B1=E8=B4=A5=204.=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=EF=BC=9AModelScope=20=E9=94=99=E8=AF=AF=E5=88=86?= =?UTF-8?q?=E7=B1=BB=20=E2=80=94=E2=80=94=20=E4=B8=8A=E6=B8=B8=E6=8A=8A?= =?UTF-8?q?=E3=80=8C=E8=B4=A6=E5=8F=B7=E6=9D=A1=E4=BB=B6=E4=B8=8D=E6=BB=A1?= =?UTF-8?q?=E8=B6=B3=E3=80=8D=E4=B8=8E=E3=80=8C=E9=80=9F=E7=8E=87=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=92=9E=E4=B8=8A=E3=80=8D=E9=83=BD=E7=94=A8=20429/40?= =?UTF-8?q?3=20=E8=A1=A8=E8=BE=BE=E3=80=81=E5=8F=AA=E8=83=BD=E9=9D=A0?= =?UTF-8?q?=E6=96=87=E6=A1=88=E5=8C=BA=E5=88=86=E8=80=8C=E5=A4=84=E7=BD=AE?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=B8=8D=E5=90=8C=EF=BC=9A=E9=AD=94=E7=B2=92?= =?UTF-8?q?=E8=80=97=E5=B0=BD=EF=BC=88429=20`insufficient=20balance`?= =?UTF-8?q?=EF=BC=89=E4=B8=8E=E6=9C=AA=E9=AA=8C=E8=AF=81=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=EF=BC=88403=20+=20=E7=89=B9=E5=BE=81=E4=B8=B2=EF=BC=89?= =?UTF-8?q?=E5=86=B7=E5=8D=B4=E5=88=B0**=E4=B8=8B=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8C=97=E4=BA=AC=E9=9B=B6=E7=82=B9**=EF=BC=88=E5=85=85?= =?UTF-8?q?=E5=80=BC=20/=20=E5=AE=8C=E6=88=90=E9=AA=8C=E8=AF=81=E5=90=8E?= =?UTF-8?q?=E6=AC=A1=E6=97=A5=E8=87=AA=E5=8A=A8=E5=9B=9E=E6=9D=A5=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E4=BD=99=20429=20=E6=89=8D=E6=98=AF=E5=88=86?= =?UTF-8?q?=E9=92=9F=E7=BA=A7=E9=80=9F=E7=8E=87=E7=AA=97=E5=8F=A3=EF=BC=9B?= =?UTF-8?q?=E8=A3=B8=20401/403=20=E4=BB=8D=E5=BD=92=E4=BB=A4=E7=89=8C?= =?UTF-8?q?=E5=A4=B1=E6=95=88=EF=BC=88=E6=9C=AC=E5=AE=B6=E6=97=A0=E7=BB=AD?= =?UTF-8?q?=E6=9C=9F=EF=BC=8C=E5=A6=82=E5=AE=9E=E6=8A=A5=E3=80=8C=E8=AF=B7?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=B2=98=E8=B4=B4=E3=80=8D=EF=BC=89=E3=80=82?= =?UTF-8?q?=E5=88=A4=E6=8D=AE=E6=9D=A5=E8=87=AA=20CPA=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=20`apply.go`=20=E7=9A=84=E7=BA=BF=E4=B8=8A=E5=AE=9E=E6=B5=8B?= =?UTF-8?q?=E5=8F=A3=E5=BE=84=205.=20=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=B5=81?= =?UTF-8?q?=E5=BC=8F=E8=AF=B7=E6=B1=82=E6=B3=A8=E5=85=A5=20`stream=5Foptio?= =?UTF-8?q?ns.include=5Fusage`=20=E2=80=94=E2=80=94=20=E4=B8=8A=E6=B8=B8?= =?UTF-8?q?=E7=9A=84=E6=B5=81=E5=BC=8F=E5=93=8D=E5=BA=94=E6=98=AF**?= =?UTF-8?q?=E9=9D=9E=E6=A0=87=E5=87=86=E5=BD=A2=E6=80=81**=EF=BC=88?= =?UTF-8?q?=E6=AF=8F=E4=B8=AA=20chunk=20=E9=83=BD=E5=B8=A6=20`usage`=20?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E4=B8=94**=E5=80=BC=E5=85=A8=E9=9B=B6**?= =?UTF-8?q?=EF=BC=89=EF=BC=8C=E7=9C=9F=E5=80=BC=E5=8F=AA=E5=9C=A8=E6=9C=AB?= =?UTF-8?q?=E5=B0=BE=E9=82=A3=E4=B8=AA=20`choices:=20[]`=20=E7=9A=84=20usa?= =?UTF-8?q?ge-only=20=E5=9D=97=E9=87=8C=EF=BC=8C=E8=80=8C**=E9=82=A3?= =?UTF-8?q?=E4=B8=80=E5=9D=97=E5=8F=AA=E5=9C=A8=E8=AF=B7=E6=B1=82=E6=98=BE?= =?UTF-8?q?=E5=BC=8F=E5=B8=A6=E4=B8=8A=E8=BF=99=E4=B8=AA=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E6=97=B6=E6=89=8D=E5=8F=91**=E3=80=82=E4=B8=8D=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E6=97=B6=EF=BC=9A=E6=9C=AC=E7=BD=91=E5=85=B3=E6=81=92?= =?UTF-8?q?=E4=BB=A5=E6=B5=81=E5=BC=8F=E8=AF=B7=E6=B1=82=E4=B8=8A=E6=B8=B8?= =?UTF-8?q?=E3=80=81=E9=9D=9E=E6=B5=81=E5=BC=8F=E7=94=B1=E8=81=9A=E5=90=88?= =?UTF-8?q?=E5=99=A8=E6=8A=98=E6=88=90=E5=AE=8C=E6=95=B4=E5=93=8D=E5=BA=94?= =?UTF-8?q?=EF=BC=8C=E8=81=9A=E5=90=88=E5=88=B0=E7=9A=84=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=20usage=20=E5=B0=B1=E6=98=AF=E9=82=A3?= =?UTF-8?q?=E4=B8=B2=E5=85=A8=E9=9B=B6=20=E2=87=92=20**=E9=9D=9E=E6=B5=81?= =?UTF-8?q?=E5=BC=8F=E8=AF=B7=E6=B1=82=E7=9A=84=20usage=20=E6=81=92?= =?UTF-8?q?=E4=B8=BA=200**=EF=BC=88=E5=86=85=E5=AE=B9=E5=AE=8C=E5=85=A8?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=EF=BC=8C=E6=95=85=E9=9A=9C=E5=8F=AA=E5=9C=A8?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=B8=8A=E5=8F=AF=E8=A7=81=E3=80=81=E6=9E=81?= =?UTF-8?q?=E9=9A=BE=E6=8E=92=E6=9F=A5=EF=BC=89=E3=80=82=E4=B8=8E=20CodeAr?= =?UTF-8?q?ts=20=E7=9A=84=E6=97=A2=E6=9C=89=E5=A4=84=E7=BD=AE=E4=B8=80?= =?UTF-8?q?=E8=87=B4=EF=BC=9A=E6=80=BB=E6=98=AF=E8=AF=B7=E6=B1=82=20usage?= =?UTF-8?q?=206.=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=85=A8=E9=83=A8=E5=80=99?= =?UTF-8?q?=E9=80=89=E8=B4=A6=E5=8F=B7=E5=9D=87=E9=99=90=E9=A2=9D=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=94=99=E8=AF=AF=E6=96=87=E6=A1=88=E5=B8=A6=E4=B8=8A?= =?UTF-8?q?**=E6=9C=80=E6=97=A9=E7=9A=84=E6=81=A2=E5=A4=8D=E6=97=B6?= =?UTF-8?q?=E5=88=BB**=EF=BC=88`=EF=BC=88=E6=89=80=E6=9C=89=E5=80=99?= =?UTF-8?q?=E9=80=89=E8=B4=A6=E5=8F=B7=E5=AF=B9=E6=A8=A1=E5=9E=8B=20X=20?= =?UTF-8?q?=E5=9D=87=E5=B7=B2=E9=99=90=E9=A2=9D=E6=88=96=E7=A6=81=E7=94=A8?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E6=97=A9=202026/10/17=2000:00:00=20=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=EF=BC=89`=EF=BC=89=E2=80=94=E2=80=94=20=E6=AD=A4?= =?UTF-8?q?=E5=89=8D=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=8F=AA=E8=83=BD=E7=AB=8B?= =?UTF-8?q?=E5=88=BB=E9=87=8D=E8=AF=95=E3=80=81=E5=86=8D=E6=92=9E=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E5=90=8C=E6=A0=B7=E7=9A=84=E5=A2=99=EF=BC=8C=E5=B8=A6?= =?UTF-8?q?=E4=B8=8A=E4=B9=8B=E5=90=8E=E6=89=8D=E8=83=BD=E5=81=9A=E5=90=88?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E9=80=80=E9=81=BF=E7=AD=89=E5=BE=85=E3=80=82?= =?UTF-8?q?=E5=8F=96=E6=9C=80=E6=97=A9=E8=80=8C=E4=B8=8D=E6=98=AF=E6=9C=80?= =?UTF-8?q?=E6=99=9A=EF=BC=88=E8=B4=A6=E5=8F=B7=E6=98=AF=E9=80=90=E4=B8=AA?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E7=9A=84=EF=BC=8C=E5=8F=96=E6=9C=80=E6=99=9A?= =?UTF-8?q?=E4=BC=9A=E8=AE=A9=E5=AE=83=E5=A4=9A=E7=9D=A1=E4=B8=80=E6=AE=B5?= =?UTF-8?q?=E6=9C=AC=E4=B8=8D=E5=BF=85=E7=9D=A1=E7=9A=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=89=EF=BC=9B=E5=8F=AA=E6=94=B9=E6=96=87=E6=A1=88=E3=80=81?= =?UTF-8?q?=E4=B8=8D=E5=8A=A8=E9=80=89=E8=B7=AF=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=97=B6=E9=80=90=E5=AD=97=E9=80=80?= =?UTF-8?q?=E5=9B=9E=E5=8E=9F=E5=8F=A5=207.=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E7=BB=99=20OrcaTerm=20=E7=9A=84=206=20=E6=9D=A1=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=96=87=E6=A1=88=E8=A1=A5=E4=B8=8A=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E8=AF=91=E6=96=87=EF=BC=88=E4=B8=8A=E6=B8=B8=20v3.0.7=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=99=E4=BA=9B=E6=96=87=E6=A1=88=E4=BD=86?= =?UTF-8?q?=E6=B2=A1=E8=B7=91=20i18n=20=E6=89=AB=E6=8F=8F=EF=BC=8C`scan.mj?= =?UTF-8?q?s`=20=E6=97=B6=E8=A2=AB=E6=89=AB=E5=87=BA=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 +- README.zh-Hant.md | 18 +- .../i18n/i18n-src/en/add-account.json | 14 + desktop-tauri/i18n/i18n-src/en/checkin.json | 2 + .../i18n/i18n-src/ja/add-account.json | 14 + desktop-tauri/i18n/i18n-src/ja/checkin.json | 2 + .../i18n/i18n-src/ko/add-account.json | 14 + desktop-tauri/i18n/i18n-src/ko/checkin.json | 2 + .../i18n/i18n-src/pt-BR/add-account.json | 14 + .../i18n/i18n-src/pt-BR/checkin.json | 2 + .../i18n/i18n-src/zh-Hant/add-account.json | 14 + .../i18n/i18n-src/zh-Hant/checkin.json | 2 + .../server/src/server/api/accounts.rs | 30 ++ .../src/server/core/account_store/mod.rs | 15 + .../core/account_store/modelscope_accounts.rs | 259 +++++++++++ .../server/core/account_store/store_view.rs | 6 + .../server/src/server/core/auto_checkin.rs | 23 +- .../server/src/server/core/billing/checkin.rs | 16 + .../src/server/core/providers/adapter.rs | 13 + .../src/server/core/providers/catalog.rs | 11 + .../server/core/providers/catalog_cache.rs | 10 + .../server/src/server/core/providers/mod.rs | 42 ++ .../core/providers/modelscope/balance.rs | 156 +++++++ .../core/providers/modelscope/checkin.rs | 114 +++++ .../core/providers/modelscope/client.rs | 223 +++++++++ .../core/providers/modelscope/credentials.rs | 148 ++++++ .../core/providers/modelscope/errors.rs | 147 ++++++ .../server/core/providers/modelscope/mod.rs | 439 ++++++++++++++++++ .../core/providers/modelscope/models.rs | 222 +++++++++ .../server/core/providers/modelscope/probe.rs | 165 +++++++ .../core/providers/modelscope/region.rs | 179 +++++++ .../src/server/core/upstream/provider_loop.rs | 25 +- .../server/src/server/core/upstream/rotate.rs | 137 ++++++ .../ui-islands/src/islands/accounts-domain.ts | 14 + .../src/islands/add-account-configs.ts | 63 +++ .../src/islands/add-provider-pick.tsx | 5 + .../ui-islands/src/islands/checkin-page.tsx | 4 + .../ui/assets/providers/modelscope.png | Bin 0 -> 10280 bytes desktop-tauri/ui/i18n/en/add-account.js | 2 +- desktop-tauri/ui/i18n/en/checkin.js | 2 +- desktop-tauri/ui/i18n/ja/add-account.js | 2 +- desktop-tauri/ui/i18n/ja/checkin.js | 2 +- desktop-tauri/ui/i18n/ko/add-account.js | 2 +- desktop-tauri/ui/i18n/ko/checkin.js | 2 +- desktop-tauri/ui/i18n/pt-BR/add-account.js | 2 +- desktop-tauri/ui/i18n/pt-BR/checkin.js | 2 +- desktop-tauri/ui/i18n/zh-Hant/add-account.js | 2 +- desktop-tauri/ui/i18n/zh-Hant/checkin.js | 2 +- desktop-tauri/ui/islands/ui.js | 24 +- 49 files changed, 2587 insertions(+), 39 deletions(-) create mode 100644 desktop-tauri/src-tauri/server/src/server/core/account_store/modelscope_accounts.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/balance.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/checkin.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/client.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/credentials.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/errors.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/mod.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/models.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/probe.rs create mode 100644 desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/region.rs create mode 100644 desktop-tauri/ui/assets/providers/modelscope.png diff --git a/README.md b/README.md index 2041c17b..7499eb04 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ | Command Code | ✓ | ✗ 静态 API Key | ✓ 远程 + 静态兜底 | — | — | — | | Antigravity(Google,Gemini) | ✓ | ✓ | ✓ 远程 + 静态兜底 | — | — | — | | OfficeAce(华为云果办 / OfficeClaw) | ✓ | ✓ 控制面自动续期 | ✓ 仅远程 | ✓ 积分余额 | ✓ 每日奖励(签到 + 新人礼) | — | +| ModelScope(魔搭,国内版 / 国际版) | ✓ | ✗ 令牌长期有效 | ✓ 仅远程 | ✓ 魔粒余额 | ✓ 每日魔粒(调登录接口即触发) | — | | 自定义提供商 | ✓ Chat 透传 / Responses / Anthropic | — | ✓ 手动登记 + 服务端拉取 | — | — | — | `/v1/chat/completions`、`/v1/responses`、`/v1/messages`(含 `count_tokens`)与 `/v1/models` 对所有平台一视同仁;模型映射、全局优先级队列、429 降级、出网代理、出站指纹脱敏与请求报表同样全平台通用。 @@ -296,11 +297,16 @@ agent2api/ │ │ │ │ │ │ project(loadCodeAssist → onboardUser 发现)/ credentials / │ │ │ │ │ │ endpoints(三环境基址与头集合)/ login / │ │ │ │ │ │ models(fetchAvailableModels + 内置兜底 + 上游真名映射)/ adapter -│ │ │ │ │ └─ officeace/ OfficeAce(华为云果办 / OfficeClaw):oauth(PKCE + P-256 DPoP 自助登录)/ -│ │ │ │ │ signer(SDK-HMAC 与 V11-HMAC 两套签名 + 向量夹具)/ credentials(网关 Basic 与控制面临时 AK/SK 两层)/ -│ │ │ │ │ chat(无状态 OpenAI 兼容转发)/ models(远程目录 + 每模型倍率)/ -│ │ │ │ │ probe(模型可用性探测,打不通的默认隐藏)/ subscription(订阅 / 额度 / 奖励)/ -│ │ │ │ │ onboarding / checkin / balance +│ │ │ │ │ ├─ officeace/ OfficeAce(华为云果办 / OfficeClaw):oauth(PKCE + P-256 DPoP 自助登录)/ +│ │ │ │ │ │ signer(SDK-HMAC 与 V11-HMAC 两套签名 + 向量夹具)/ credentials(网关 Basic 与控制面临时 AK/SK 两层)/ +│ │ │ │ │ │ chat(无状态 OpenAI 兼容转发)/ models(远程目录 + 每模型倍率)/ +│ │ │ │ │ │ probe(模型可用性探测,打不通的默认隐藏)/ subscription(订阅 / 额度 / 奖励)/ +│ │ │ │ │ │ onboarding / checkin / balance +│ │ │ │ │ └─ modelscope/ ModelScope(魔搭,国内版 / 国际版):region(两套域名与两条 provider 身份)/ +│ │ │ │ │ credentials(一枚 ms- 令牌两用:Bearer 调推理、cookie 值读网页站)/ +│ │ │ │ │ client(两条出站链路 + 两种响应信封)/ models(远程目录,两地各一格缓存)/ +│ │ │ │ │ probe(添加时探活换身份)/ checkin(调登录信息接口即触发当日魔粒)/ +│ │ │ │ │ balance(魔粒钱包 + 今日已用)/ errors(魔粒耗尽与未验证邮箱的判据) │ │ │ │ ├─ protocol/ 协议转换层(各家 wire ↔ 标准 chat SSE 的请求/响应翻译: │ │ │ │ │ Anthropic Messages / Responses / NDJSON(Command Code)/ │ │ │ │ │ Gemini 信封(Antigravity),以及工具 plan 与历史修复) @@ -371,7 +377,7 @@ npm run build:icon # 生成图标源图(改图标设计后执行,再 ### 仅供学习与交流 -本项目是一个用于学习 HTTP 反向代理、SSE 流式透传、多上游协议适配与桌面端打包(Tauri)等技术主题的实践项目,**仅供个人学习与研究使用**。它不是官方产品,与腾讯公司及 WorkBuddy / CodeBuddy、美团及 CatPaw、商汤及小浣熊、智谱及 AutoClaw / autoglm、阿里巴巴及 Qoder / Accio、华为云及 CodeArts / OfficeAce、字节跳动及 Trae、科大讯飞及 Loomy、百度文库及 KukuAI、长亭科技及 MonkeyCode、Command Code、Google 及 Antigravity 均无任何关联,未获得其授权、认可或赞助。 +本项目是一个用于学习 HTTP 反向代理、SSE 流式透传、多上游协议适配与桌面端打包(Tauri)等技术主题的实践项目,**仅供个人学习与研究使用**。它不是官方产品,与腾讯公司及 WorkBuddy / CodeBuddy、美团及 CatPaw、商汤及小浣熊、智谱及 AutoClaw / autoglm、阿里巴巴及 Qoder / Accio、华为云及 CodeArts / OfficeAce、字节跳动及 Trae、科大讯飞及 Loomy、百度文库及 KukuAI、长亭科技及 MonkeyCode、Command Code、Google 及 Antigravity、阿里巴巴及 ModelScope(魔搭)均无任何关联,未获得其授权、认可或赞助。 ### 关于反向代理行为 diff --git a/README.zh-Hant.md b/README.zh-Hant.md index a34aad0f..ba90824f 100644 --- a/README.zh-Hant.md +++ b/README.zh-Hant.md @@ -55,6 +55,7 @@ | Command Code | ✓ | ✗ 靜態 API Key | ✓ 遠端 + 靜態備援 | — | — | — | | Antigravity(Google,Gemini) | ✓ | ✓ | ✓ 遠端 + 靜態備援 | — | — | — | | OfficeAce(華為雲果辦 / OfficeClaw) | ✓ | ✓ 控制面自動續期 | ✓ 僅遠端 | ✓ 積分餘額 | ✓ 每日獎勵(簽到 + 新人禮) | — | +| ModelScope(魔搭,國內版 / 國際版) | ✓ | ✗ 權杖長期有效 | ✓ 僅遠端 | ✓ 魔粒餘額 | ✓ 每日魔粒(呼叫登入介面即觸發) | — | | 自訂供應商 | ✓ Chat 透傳 / Responses / Anthropic | — | ✓ 手動登記 + 伺服器端拉取 | — | — | — | `/v1/chat/completions`、`/v1/responses`、`/v1/messages`(含 `count_tokens`)與 `/v1/models` 對所有平台一視同仁;模型對應、全域優先順序佇列、429 降級、出口代理、出站指紋脫敏與請求報表同樣對全平台通用。 @@ -296,11 +297,16 @@ agent2api/ │ │ │ │ │ │ project(loadCodeAssist → onboardUser 探索)/ credentials / │ │ │ │ │ │ endpoints(三環境基址與標頭集合)/ login / │ │ │ │ │ │ models(fetchAvailableModels + 內建備援 + 上游真名對應)/ adapter -│ │ │ │ │ └─ officeace/ OfficeAce(華為雲果辦 / OfficeClaw):oauth(PKCE + P-256 DPoP 自助登入)/ -│ │ │ │ │ signer(SDK-HMAC 與 V11-HMAC 兩套簽章 + 向量 fixtures)/ credentials(閘道器 Basic 與控制面臨時 AK/SK 兩層)/ -│ │ │ │ │ chat(無狀態 OpenAI 相容轉發)/ models(遠端目錄 + 每模型倍率)/ -│ │ │ │ │ probe(模型可用性探測,打不通的預設隱藏)/ subscription(訂閱 / 額度 / 獎勵)/ -│ │ │ │ │ onboarding / checkin / balance +│ │ │ │ │ ├─ officeace/ OfficeAce(華為雲果辦 / OfficeClaw):oauth(PKCE + P-256 DPoP 自助登入)/ +│ │ │ │ │ │ signer(SDK-HMAC 與 V11-HMAC 兩套簽章 + 向量 fixtures)/ credentials(閘道器 Basic 與控制面臨時 AK/SK 兩層)/ +│ │ │ │ │ │ chat(無狀態 OpenAI 相容轉發)/ models(遠端目錄 + 每模型倍率)/ +│ │ │ │ │ │ probe(模型可用性探測,打不通的預設隱藏)/ subscription(訂閱 / 額度 / 獎勵)/ +│ │ │ │ │ │ onboarding / checkin / balance +│ │ │ │ │ └─ modelscope/ ModelScope(魔搭,國內版 / 國際版):region(兩套網域與兩條 provider 身分)/ +│ │ │ │ │ credentials(一枚 ms- 權杖兩用:Bearer 呼叫推理、cookie 值讀網頁站)/ +│ │ │ │ │ client(兩條出站鏈路 + 兩種回應信封)/ models(遠端目錄,兩地各一格快取)/ +│ │ │ │ │ probe(新增時探活換身分)/ checkin(呼叫登入資訊介面即觸發當日魔粒)/ +│ │ │ │ │ balance(魔粒錢包 + 今日已用)/ errors(魔粒耗盡與未驗證信箱的判據) │ │ │ │ ├─ protocol/ 協定轉換層(各家 wire ↔ 標準 chat SSE 的請求/回應翻譯: │ │ │ │ │ Anthropic Messages / Responses / NDJSON(Command Code)/ │ │ │ │ │ Gemini 信封(Antigravity),以及工具 plan 與歷史修復) @@ -371,7 +377,7 @@ npm run build:icon # 產生圖示來源圖(改圖示設計後執行, ### 僅供學習與交流 -本專案是一個用於學習 HTTP 反向代理、SSE 串流透傳、多上游協定適配與桌面端打包(Tauri)等技術主題的實踐專案,**僅供個人學習與研究使用**。它不是官方產品,與騰訊公司及 WorkBuddy / CodeBuddy、美團及 CatPaw、商湯及小浣熊、智譜及 AutoClaw / autoglm、阿里巴巴及 Qoder / Accio、華為雲及 CodeArts / OfficeAce、字節跳動及 Trae、科大訊飛及 Loomy、百度文庫及 KukuAI、長亭科技及 MonkeyCode、Command Code、Google 及 Antigravity 均無任何關聯,未獲得其授權、認可或贊助。 +本專案是一個用於學習 HTTP 反向代理、SSE 串流透傳、多上游協定適配與桌面端打包(Tauri)等技術主題的實踐專案,**僅供個人學習與研究使用**。它不是官方產品,與騰訊公司及 WorkBuddy / CodeBuddy、美團及 CatPaw、商湯及小浣熊、智譜及 AutoClaw / autoglm、阿里巴巴及 Qoder / Accio、華為雲及 CodeArts / OfficeAce、字節跳動及 Trae、科大訊飛及 Loomy、百度文庫及 KukuAI、長亭科技及 MonkeyCode、Command Code、Google 及 Antigravity、阿里巴巴及 ModelScope(魔搭)均無任何關聯,未獲得其授權、認可或贊助。 ### 關於反向代理行為 diff --git a/desktop-tauri/i18n/i18n-src/en/add-account.json b/desktop-tauri/i18n/i18n-src/en/add-account.json index b2e66ea6..2e61e545 100644 --- a/desktop-tauri/i18n/i18n-src/en/add-account.json +++ b/desktop-tauri/i18n/i18n-src/en/add-account.json @@ -17,6 +17,9 @@ "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw's X-Passport-Token (login-state Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (three dot-separated segments)", "Command Code": "Command Code", + "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "JWT (three dot-separated segments; you can also paste the whole Bearer line or the data.bin content)", + "ModelScope 国内版": "ModelScope China edition", + "ModelScope 国际版": "ModelScope International edition", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode International edition", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM managed endpoint; apply for the Key at integrate.api.nvidia.com", @@ -24,6 +27,7 @@ "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken is Accio's login credential (a long opaque token, not a JWT); refreshToken is optional and enables automatic renewal on expiry. Enter the credential of the {label} account — {siteNote} (the easiest way to get it: just use \"Web login\" above; no need to hunt for the token manually.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken is Trae's Cloud-IDE-JWT (three dot-separated segments), and refreshToken enables automatic renewal on expiry (this provider rotates refreshToken on every use: once exchanged, the old one is void, so do not refresh the same account from two programs at once).
When pasting manually, fill in machineId / deviceId as well: upstream ties them to the device public key uploaded at sign-in to identify the device, and swapping in a new pair from nowhere triggers the 2xxxx family of device-binding rejections.
Without these three, the proper route is \"Web login\" above; for container / remote deployments, paste the callback URL from the address bar as prompted.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "The value of monkeycode_ai_session (you can also paste the whole Cookie)", + "ms- 开头的 API 令牌": "API token starting with ms-", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken is optional and enables automatic renewal on expiry; both can be obtained from the Raccoon client login-state file.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken is optional and enables automatic renewal; both can be obtained from the client login-state file. The same Cline account works in both pools; here it is grouped under {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token supports the enc: prefix (decrypted automatically on Windows). Without a refreshToken, automatic renewal is not possible.", @@ -96,6 +100,7 @@ "可选,留空使用账号昵称或邮箱": "Optional; defaults to the account nickname or email", "可选,留空则用 key 尾号": "Optional; defaults to the key suffix", "可选,留空则用 userId": "Optional; defaults to userId", + "可选,留空则用上游账号昵称": "Optional; if left blank, the upstream account's nickname is used", "可选,留空则用上游返回的账号名或账号 id": "Optional; defaults to the account name or account id returned by upstream", "可选,留空则用凭证里的账号名": "Optional; defaults to the account name in the credential", "可选,留空则用文件里的昵称": "Optional; leave empty to use the nickname from the file", @@ -103,6 +108,7 @@ "可选,留空则用脱敏手机号": "Optional; defaults to the masked phone number", "可选,留空则用脱敏手机号或 userId": "Optional; defaults to the masked phone number or userId", "可选,留空则用账号 uk": "Optional; defaults to the account uk", + "可选,留空则用账号昵称或 userId": "Optional; defaults to the account nickname or userId", "可选,留空则用邮箱或令牌尾号": "Optional; defaults to the email or token suffix", "可选,留空用「OfficeAce 果办」": "Optional; defaults to “OfficeAce”", "可选,留空自动生成": "Optional; generated automatically if blank", @@ -278,12 +284,16 @@ "等待登录完成…": "Waiting for sign-in…", "等待网页登录…": "Waiting for web login…", "粘贴 API Key": "Paste API Key", + "粘贴 API 令牌": "Paste API token", "粘贴 Accio 的 accessToken": "Paste the Accio accessToken", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Paste Antigravity's Google refresh token (starts with 1//; pasting the whole line containing refresh_token= also works).
This is a manual entry besides web login (for example, exported from the official IDE you are already signed in to). The refresh token does not expire, and the gateway renews the access token automatically when it expires; if the token is lost, you can only go through Google authorization again, so keep it safe.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Paste the Command Code API Key (starts with user_; get it from the official CLI's ~/.commandcode/auth.json or the web studio). Pasting the whole line / with quotes / with the Bearer prefix all work; the gateway strips it down to the bare key itself. The key does not expire and there is no renewal API, so if it stops working just get a new one. When adding, the gateway runs a lightweight liveness check; a failure does not affect adding.", "粘贴 Cookie": "Paste Cookie", "粘贴 Google refresh token": "Paste Google refresh token", + "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "Paste a ModelScope API token (starting with ms-, obtained from the \"Access Tokens\" page on {site}).
{siteNote}
This token serves two purposes: the gateway uses it both to call inference and to read the account identity, Magicube balance, and daily check-in. The token is long-lived with no renewal API; if it stops working, just obtain a new one and paste it again.", + "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "Paste OrcaTerm's OAuth accessToken (a JWT with three dot-separated segments; obtain it from the desktop client's data.bin or the Web version's ot_session cookie). You may also paste the whole line containing Bearer / ot_session=; the gateway strips it down to the bare token. After adding, the gateway renews it automatically (upstream provides a renewal endpoint), so you need not chase the 2-hour expiry manually.", "粘贴 Qoder 个人访问令牌(pt-…)": "Paste the Qoder personal access token (pt-…)", + "粘贴 accessToken": "Paste accessToken", "粘贴 access_token(一长串 JWT)": "Paste access_token (a long JWT)", "粘贴 session cookie": "Paste session cookie", "粘贴 token / refreshToken": "Paste token / refreshToken", @@ -326,12 +336,14 @@ "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Reads ~/.cline/data/settings/providers.json; requires being signed in to the Cline client", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Reads ~/.meituan-catpaw/auth.json; requires being signed in to the CatPaw client", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Reads the local KukuAI client login state (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requires being signed in to the KukuAI client", + "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "Read this machine's OrcaTerm client login state (%APPDATA%\\com.orcaterm-desktop.app\\data.bin); you must already be signed in to the OrcaTerm client", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Reads the local client's current login state (plaintext Cookie, no decryption needed). The Cookies file is exclusively locked while the client runs, so close the KukuAI client before importing.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, click \"Refresh token\" to sync.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, just re-import.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). Users who sign in to the client with Zai / Google should use this one.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). This one is grouped under {label}.", + "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "Read the OAuth token currently signed in on this machine's client (plain-text JSON, no decryption needed). After importing, the gateway renews it automatically, so you need not follow the client's 2-hour expiry to swap tokens manually.", "账号信息": "Account info", "账号信息不完整,请刷新后重试": "Account info is incomplete; refresh and try again", "账号已添加,但请留意:{warning}": "Account added, but note: {warning}", @@ -343,7 +355,9 @@ "这一家当前不支持网页登录,请改用填写凭证": "This provider does not support web login right now; use Enter credentials instead", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "This account has no campaigns that can be claimed automatically right now (only the daily login gift points are claimed automatically)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "This quota goes through the Start Plan channel: if forwarding reports that the Coding Plan has expired, ", + "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "This is for the China site (modelscope.cn) account: paste the China site's token. The international site (modelscope.ai) is another provider with its own account; tokens are not interchangeable between the two.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the China site (monkeycode-ai.com) account: paste the China site's session. The international site (monkeycode-ai.net) is another provider with its own account; credentials are not interchangeable between the two.", + "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "This is for the international site (modelscope.ai) account: paste the international site's token. The China site (modelscope.cn) is another provider with its own account; tokens are not interchangeable between the two.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the international site (monkeycode-ai.net) account: paste the international site's session. The China site (monkeycode-ai.com) is another provider with its own account; credentials are not interchangeable between the two.", "选择凭证文件导入": "Import from credential file", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Select the official client's session credential file (workbuddy-desktop.info / workbuddy-desktop-ai.info) or an account JSON exported by wb2api (nested or flat); you can also read it directly from the official client on this machine.", diff --git a/desktop-tauri/i18n/i18n-src/en/checkin.json b/desktop-tauri/i18n/i18n-src/en/checkin.json index b79bda2e..c4146288 100644 --- a/desktop-tauri/i18n/i18n-src/en/checkin.json +++ b/desktop-tauri/i18n/i18n-src/en/checkin.json @@ -34,6 +34,7 @@ "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below; its and ZCode's daily/plan benefits are claimed under \"Activity rewards\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below, and its daily welfare is right above under \"Daily check-in\"; ZCode plan claims are under \"Activity rewards\".", "与国内版同一套任务接口 · 站点不同": "Same task API as the China edition · different site", + "与国内版同一套链路 · 站点不同、令牌不通用": "Same flow as the China edition · different site, tokens not interchangeable", "今天已领 {n} 份": "Claimed {n} today", "今天未领": "Not claimed today", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Claimed today (Beijing time {day}) · {n} items confirmed received · can claim again tomorrow", @@ -128,6 +129,7 @@ "新手福利": "Starter rewards", "新手福利有 {n} 项领取失败,可重试": "{n} starter reward(s) failed to claim — you can retry", "无": "None", + "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "No dedicated check-in API · hits the login-info endpoint once a day per account (which grants the daily Magicubes)", "无独立签到接口 · 每天替账号打一次首次登录积分": "No dedicated check-in API · awards first-login points once a day per account", "无账号": "No accounts", "暂不可领": "Not claimable yet", diff --git a/desktop-tauri/i18n/i18n-src/ja/add-account.json b/desktop-tauri/i18n/i18n-src/ja/add-account.json index c9b8df1a..47d097dd 100644 --- a/desktop-tauri/i18n/i18n-src/ja/add-account.json +++ b/desktop-tauri/i18n/i18n-src/ja/add-account.json @@ -17,6 +17,9 @@ "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw の X-Passport-Token(ログイン状態 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT(3 段のドット区切り)", "Command Code": "Command Code", + "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "", + "ModelScope 国内版": "ModelScope 中国版", + "ModelScope 国际版": "ModelScope 国際版", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 国際版", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM のマネージドエンドポイント。Key は integrate.api.nvidia.com で申請します", @@ -24,6 +27,7 @@ "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken は Accio のログイン認証情報です(長い不透明な token 文字列で、JWT ではありません);refreshToken は任意で、入力すると期限切れ時に自動更新できます。{label}アカウントの認証情報を入力してください —— {siteNote}(最も簡単な方法:上の「ウェブログイン」を使えば token を手動で探す必要はありません。)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken は Trae の Cloud-IDE-JWT(3 段のドット区切り)です。refreshToken は期限切れ時の自動更新に使用します(本家の refreshToken は 1 回ごとに交換され、一度更新すると古いものは無効になります。そのため 2 つのプログラムで同じアカウントを同時に更新しないでください)。
手動で貼り付ける場合は machineId / deviceId も一緒に入力してください:アップストリームはこれらをログイン時にアップロードされたデバイス公開鍵と紐付けてデバイスを判定するため、根拠なく別のペアにすると 2xxxx 系のデバイスバインディング拒否に当たります。
この 3 つがない場合の正道は上の「ウェブログイン」を使うことです;コンテナ / リモートデプロイ形態では案内に従ってアドレスバーのコールバックアドレスを貼り付けてください。", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session の値(Cookie 全体をそのまま貼り付けても可)", + "ms- 开头的 API 令牌": "ms- で始まる API トークン", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken は任意で、入力すると期限切れ時に自動更新できます;どちらも小浣熊クライアントのログイン状態ファイルから取得できます。", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken は任意で、入力すると自動更新できます;どちらもクライアントのログイン状態ファイルから取得できます。同じ Cline アカウントはどちらのプールでも使え、ここでは {label} に分類されます。", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token は enc: プレフィックスに対応しています(Windows では自動復号)。refreshToken を入力しないと自動更新できません。", @@ -96,6 +100,7 @@ "可选,留空使用账号昵称或邮箱": "任意、空欄の場合はアカウントのニックネームまたはメールアドレスを使用", "可选,留空则用 key 尾号": "任意、空欄の場合は key の末尾を使用", "可选,留空则用 userId": "任意、空欄の場合は userId を使用", + "可选,留空则用上游账号昵称": "任意。空欄の場合は上流アカウントのニックネームを使用", "可选,留空则用上游返回的账号名或账号 id": "任意、空欄の場合はアップストリームが返したアカウント名またはアカウント id を使用", "可选,留空则用凭证里的账号名": "任意、空欄の場合は認証情報のアカウント名を使用", "可选,留空则用文件里的昵称": "任意。空欄の場合はファイル内のニックネームを使用", @@ -103,6 +108,7 @@ "可选,留空则用脱敏手机号": "任意、空欄の場合はマスク済み電話番号を使用", "可选,留空则用脱敏手机号或 userId": "任意、空欄の場合はマスク済み電話番号または userId を使用", "可选,留空则用账号 uk": "任意、空欄の場合はアカウントの uk を使用", + "可选,留空则用账号昵称或 userId": "", "可选,留空则用邮箱或令牌尾号": "任意、空欄の場合はメールアドレスまたはトークンの末尾を使用", "可选,留空用「OfficeAce 果办」": "任意、空欄の場合は「OfficeAce」を使用", "可选,留空自动生成": "任意、空欄の場合は自動生成", @@ -278,12 +284,16 @@ "等待登录完成…": "ログインの完了を待っています…", "等待网页登录…": "ウェブログインを待っています…", "粘贴 API Key": "API Key を貼り付け", + "粘贴 API 令牌": "API トークンを貼り付け", "粘贴 Accio 的 accessToken": "Accio の accessToken を貼り付け", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity の Google refresh token を貼り付け(1// で始まる;refresh_token= を含む行全体をそのまま貼り付けても可)。
これはウェブログイン以外の手動入り口です(例:ログイン済みの公式 IDE からエクスポート)。refresh token は期限切れにならず、access token の期限切れはゲートウェイが自動で更新します;トークンを紛失すると Google の認可をやり直すしかないため、大切に保管してください。", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code の API Key を貼り付け(user_ で始まる;公式 CLI の ~/.commandcode/auth.json またはウェブの studio から取得)。行全体 / 引用符付き / Bearer プレフィックス付きのまま貼り付けても構いません。ゲートウェイが自動で裸の key に剥がします。key は期限切れにならず、更新用 API もありません。無効になったら取得し直してください;追加時にゲートウェイが軽量な死活確認を 1 回行いますが、失敗しても追加には影響しません。", "粘贴 Cookie": "Cookie を貼り付け", "粘贴 Google refresh token": "Google refresh token を貼り付け", + "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "ModelScope の API トークン(ms- で始まる。{site} の「アクセストークン」ページで取得)を貼り付けてください。
{siteNote}
このトークンは二役です。ゲートウェイは推論の呼び出しにも、アカウント身元・魔粒残高・毎日チェックインの読み取りにもこれを使います。トークンは長期有効で更新 API はありません。使えなくなったら再取得して貼り直すだけです。", + "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder の個人アクセストークン(pt-…)を貼り付け", + "粘贴 accessToken": "", "粘贴 access_token(一长串 JWT)": "access_token(長い JWT)を貼り付け", "粘贴 session cookie": "session cookie を貼り付け", "粘贴 token / refreshToken": "token / refreshToken を貼り付け", @@ -326,12 +336,14 @@ "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json を読み込みます。Cline クライアントでログイン済みである必要があります", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json を読み込みます。CatPaw クライアントでログイン済みである必要があります", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "本機の KukuAI クライアントのログイン状態を読み込みます(%APPDATA%\\baidugenflowpro\\Network\\Cookies)。KukuAI クライアントでログイン済みである必要があります", + "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "本機クライアントの現在のログイン状態を読み込みます(平文 Cookie、復号不要)。クライアントの実行中は Cookies ファイルが排他占有されるため、インポート前に KukuAI クライアントを終了してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら「Token を更新」をクリックして同期してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら再インポートしてください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。Zai / Google でクライアントにログインしているユーザーはこちらを使ってください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。これは {label} に分類されます。", + "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "", "账号信息": "アカウント情報", "账号信息不完整,请刷新后重试": "アカウント情報が不完全です。更新してから再試行してください", "账号已添加,但请留意:{warning}": "アカウントを追加しましたが、ご注意ください:{warning}", @@ -343,7 +355,9 @@ "这一家当前不支持网页登录,请改用填写凭证": "このプロバイダーは現在ウェブログインに対応していません。認証情報の入力に切り替えてください", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "このアカウントには現在自動で受け取れるイベントがありません(自動で受け取るのは毎日ログインで付与されるポイントのみです)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "このクォータは「イベントプラン」の経路を使用します:転送時にコーディングプランの期限切れが表示された場合は、", + "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "ここには中国サイト(modelscope.cn)のアカウントを入力します。中国サイトのトークンを貼り付けてください。国際サイト(modelscope.ai)は別の provider・別のアカウントで、両者のトークンに互換性はありません。", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには中国サイト(monkeycode-ai.com)のアカウントを入力します:中国サイトの session を貼り付けてください。国際サイト(monkeycode-ai.net)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", + "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "ここには国際サイト(modelscope.ai)のアカウントを入力します。国際サイトのトークンを貼り付けてください。中国サイト(modelscope.cn)は別の provider・別のアカウントで、両者のトークンに互換性はありません。", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには国際サイト(monkeycode-ai.net)のアカウントを入力します:国際サイトの session を貼り付けてください。中国サイト(monkeycode-ai.com)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", "选择凭证文件导入": "認証情報ファイルからインポート", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "公式クライアントのログイン状態の認証情報ファイル(workbuddy-desktop.info / workbuddy-desktop-ai.info)または wb2api がエクスポートしたアカウント JSON(ネスト / フラット形式どちらも可)を選択してください。このマシンの公式クライアントから直接読み取ることもできます。", diff --git a/desktop-tauri/i18n/i18n-src/ja/checkin.json b/desktop-tauri/i18n/i18n-src/ja/checkin.json index 7d6bec5c..37889727 100644 --- a/desktop-tauri/i18n/i18n-src/ja/checkin.json +++ b/desktop-tauri/i18n/i18n-src/ja/checkin.json @@ -34,6 +34,7 @@ "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」に、CodeArts と ZCode の日次/プラン特典の受け取りは「アクティビティ特典」にあります。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」、CodeArts のデイリー特典はすぐ上の「デイリーチェックイン」にあります。ZCode のプラン受け取りは「アクティビティ特典」です。", "与国内版同一套任务接口 · 站点不同": "中国版と同じタスク API · サイトが異なる", + "与国内版同一套链路 · 站点不同、令牌不通用": "中国版と同じフロー · サイトが異なり、トークンに互換性なし", "今天已领 {n} 份": "本日 {n} 件受け取り済み", "今天未领": "本日は未受取", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "本日(北京時間 {day})受け取り済み · 公式に {n} 件の到着を確認 · 明日また受け取れます", @@ -128,6 +129,7 @@ "新手福利": "初心者ボーナス", "新手福利有 {n} 项领取失败,可重试": "初心者ボーナスで {n} 件の受け取りに失敗しました。再試行できます", "无": "なし", + "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "専用のチェックイン API なし · 1 日 1 回アカウントの代わりにログイン情報エンドポイントを叩く(それが当日の魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "専用のチェックイン API なし · 毎日アカウントの初回ログイン積分を 1 回付与", "无账号": "アカウントなし", "暂不可领": "受け取り不可", diff --git a/desktop-tauri/i18n/i18n-src/ko/add-account.json b/desktop-tauri/i18n/i18n-src/ko/add-account.json index 67f75f9e..53fd5856 100644 --- a/desktop-tauri/i18n/i18n-src/ko/add-account.json +++ b/desktop-tauri/i18n/i18n-src/ko/add-account.json @@ -17,6 +17,9 @@ "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw의 X-Passport-Token (로그인 상태 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (3단 점 구분)", "Command Code": "Command Code", + "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "", + "ModelScope 国内版": "ModelScope 중국판", + "ModelScope 国际版": "ModelScope 인터내셔널판", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 국제판", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM 관리형 엔드포인트, Key는 integrate.api.nvidia.com에서 신청합니다", @@ -24,6 +27,7 @@ "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken은 Accio의 로그인 자격 증명입니다 (길고 불투명한 token 문자열이며 JWT가 아닙니다); refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다. {label} 계정의 자격 증명을 입력하세요 — {siteNote} (가장 쉽게 얻는 방법: 위의 「웹 로그인」을 바로 사용하세요. token을 직접 찾을 필요가 없습니다.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken은 Trae의 Cloud-IDE-JWT이며(3단 점 구분), refreshToken은 만료 시 자동 갱신에 사용됩니다 (이 제공자는 refreshToken이 교환할 때마다 바뀝니다: 한 번 교환하면 이전 것은 무효가 되므로 두 프로그램에서 같은 계정을 동시에 갱신하지 마세요).
수동으로 붙여넣을 때는 machineId / deviceId도 함께 입력하세요: 업스트림은 이를 로그인 시 업로드한 기기 공개 키와 묶어 기기를 판별하므로, 갑자기 새로운 값을 넣으면 2xxxx 계열 기기 바인딩 거부가 발생합니다.
이 세 가지가 없을 때의 올바른 방법은 위의 「웹 로그인」이며, 컨테이너 / 원격 배포 환경에서는 안내에 따라 주소 표시줄의 콜백 주소를 붙여넣으면 됩니다.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session의 값 (전체 Cookie를 붙여넣어도 됨)", + "ms- 开头的 API 令牌": "ms- 로 시작하는 API 토큰", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다; 둘 다 小浣熊 클라이언트 로그인 상태 파일에서 얻을 수 있습니다.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken은 선택이며, 입력하면 자동 갱신됩니다; 둘 다 클라이언트 로그인 상태 파일에서 얻을 수 있습니다. 같은 Cline 계정은 두 풀 모두에서 사용할 수 있으며, 여기서는 {label}로 분류됩니다.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token은 enc: 접두사를 지원합니다 (Windows에서는 자동 복호화). refreshToken을 입력하지 않으면 자동 갱신할 수 없습니다.", @@ -96,6 +100,7 @@ "可选,留空使用账号昵称或邮箱": "선택, 비워 두면 계정 닉네임 또는 이메일 사용", "可选,留空则用 key 尾号": "선택, 비워 두면 key 끝자리 사용", "可选,留空则用 userId": "선택, 비워 두면 userId 사용", + "可选,留空则用上游账号昵称": "선택 사항. 비워 두면 업스트림 계정 닉네임을 사용합니다", "可选,留空则用上游返回的账号名或账号 id": "선택, 비워 두면 업스트림이 반환한 계정 이름 또는 계정 id 사용", "可选,留空则用凭证里的账号名": "선택, 비워 두면 자격 증명의 계정 이름 사용", "可选,留空则用文件里的昵称": "선택 사항, 비워 두면 파일의 닉네임 사용", @@ -103,6 +108,7 @@ "可选,留空则用脱敏手机号": "선택, 비워 두면 마스킹된 휴대폰 번호 사용", "可选,留空则用脱敏手机号或 userId": "선택, 비워 두면 마스킹된 휴대폰 번호 또는 userId 사용", "可选,留空则用账号 uk": "선택, 비워 두면 계정 uk 사용", + "可选,留空则用账号昵称或 userId": "", "可选,留空则用邮箱或令牌尾号": "선택, 비워 두면 이메일 또는 토큰 끝자리 사용", "可选,留空用「OfficeAce 果办」": "선택, 비워 두면 「OfficeAce」 사용", "可选,留空自动生成": "선택, 비워 두면 자동 생성", @@ -278,12 +284,16 @@ "等待登录完成…": "로그인 완료 대기 중…", "等待网页登录…": "웹 로그인 대기 중…", "粘贴 API Key": "API Key 붙여넣기", + "粘贴 API 令牌": "API 토큰 붙여넣기", "粘贴 Accio 的 accessToken": "Accio의 accessToken 붙여넣기", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity의 Google refresh token을 붙여넣으세요 (1//로 시작; refresh_token=이 포함된 줄 전체를 붙여넣어도 됨).
웹 로그인 외의 수동 입구입니다(예: 로그인된 공식 IDE에서 내보내기). refresh token은 만료되지 않으며, access token 만료 시 게이트웨이가 자동으로 갱신합니다; 토큰을 잃어버리면 Google 인가를 다시 받아야 하므로 잘 보관하세요.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code의 API Key를 붙여넣으세요 (user_로 시작; 공식 CLI의 ~/.commandcode/auth.json 또는 웹 studio에서 획득). 줄 전체 / 따옴표 포함 / Bearer 접두사 포함 그대로 붙여넣어도 됩니다. 게이트웨이가 알아서 순수한 key만 추출합니다. key는 만료되지 않고 갱신 인터페이스도 없으므로, 무효가 되면 다시 받으면 됩니다; 추가 시 게이트웨이가 가벼운 활성 확인을 한 번 수행하며, 실패해도 추가에는 영향을 주지 않습니다.", "粘贴 Cookie": "Cookie 붙여넣기", "粘贴 Google refresh token": "Google refresh token 붙여넣기", + "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "ModelScope API 토큰(ms- 로 시작, {site} 의 \"액세스 토큰\" 페이지에서 발급)을 붙여넣으세요.
{siteNote}
이 토큰은 이중 용도입니다. 게이트웨이가 추론 호출에도, 계정 신원·마립(Magicube) 잔액·매일 체크인 조회에도 사용합니다. 토큰은 장기 유효하며 갱신 API 가 없습니다. 사용할 수 없게 되면 다시 발급받아 붙여넣으면 됩니다.", + "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder 개인 액세스 토큰(pt-…) 붙여넣기", + "粘贴 accessToken": "", "粘贴 access_token(一长串 JWT)": "access_token 붙여넣기 (긴 JWT)", "粘贴 session cookie": "session cookie 붙여넣기", "粘贴 token / refreshToken": "token / refreshToken 붙여넣기", @@ -326,12 +336,14 @@ "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json을 읽습니다. Cline 클라이언트에 로그인되어 있어야 합니다", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json을 읽습니다. CatPaw 클라이언트에 로그인되어 있어야 합니다", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "이 컴퓨터의 KukuAI 클라이언트 로그인 상태를 읽습니다 (%APPDATA%\\baidugenflowpro\\Network\\Cookies). KukuAI 클라이언트에 로그인되어 있어야 합니다", + "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 읽습니다 (평문 Cookie, 복호화 불필요). 클라이언트 실행 중에는 Cookies 파일이 독점 점유되므로, 가져오기 전에 KukuAI 클라이언트를 먼저 종료하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 「Token 갱신」을 눌러 동기화하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 다시 가져오면 됩니다.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). Zai / Google로 클라이언트에 로그인하는 사용자는 이 항목을 사용하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 이 항목은 {label}로 분류됩니다.", + "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "", "账号信息": "계정 정보", "账号信息不完整,请刷新后重试": "계정 정보가 불완전합니다. 새로 고친 후 다시 시도하세요", "账号已添加,但请留意:{warning}": "계정은 추가되었지만 확인해 주세요: {warning}", @@ -343,7 +355,9 @@ "这一家当前不支持网页登录,请改用填写凭证": "이 제공자는 현재 웹 로그인을 지원하지 않습니다. 대신 자격 증명 입력을 사용하세요", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "이 계정에는 현재 자동으로 수령할 수 있는 이벤트가 없습니다 (매일 로그인 보너스 포인트만 자동 수령합니다)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "이 할당량은 「이벤트 플랜」 채널을 사용합니다: 포워딩 시 코딩 플랜이 만료되었다는 안내가 나오면, ", + "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "여기에는 중국 사이트(modelscope.cn) 계정을 입력합니다. 중국 사이트의 토큰을 붙여넣으세요. 인터내셔널 사이트(modelscope.ai)는 다른 provider·다른 계정이며, 양쪽 토큰은 호환되지 않습니다.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 중국 사이트(monkeycode-ai.com)의 계정을 입력합니다: 중국 사이트의 session을 붙여넣으세요. 국제 사이트(monkeycode-ai.net)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", + "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "여기에는 인터내셔널 사이트(modelscope.ai) 계정을 입력합니다. 인터내셔널 사이트의 토큰을 붙여넣으세요. 중국 사이트(modelscope.cn)는 다른 provider·다른 계정이며, 양쪽 토큰은 호환되지 않습니다.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 국제 사이트(monkeycode-ai.net)의 계정을 입력합니다: 국제 사이트의 session을 붙여넣으세요. 중국 사이트(monkeycode-ai.com)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", "选择凭证文件导入": "자격 증명 파일에서 가져오기", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "공식 클라이언트의 로그인 자격 증명 파일(workbuddy-desktop.info / workbuddy-desktop-ai.info) 또는 wb2api에서 내보낸 계정 JSON(중첩/평면 형식 모두 가능)을 선택하세요. 이 컴퓨터의 공식 클라이언트에서 직접 읽을 수도 있습니다.", diff --git a/desktop-tauri/i18n/i18n-src/ko/checkin.json b/desktop-tauri/i18n/i18n-src/ko/checkin.json index f3b4816d..14b794dc 100644 --- a/desktop-tauri/i18n/i18n-src/ko/checkin.json +++ b/desktop-tauri/i18n/i18n-src/ko/checkin.json @@ -34,6 +34,7 @@ "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에 있으며, CodeArts와 ZCode의 일일/플랜 혜택 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에, CodeArts의 일일 혜택은 바로 위 \"일일 출석\"에 있습니다. ZCode의 플랜 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "与国内版同一套任务接口 · 站点不同": "중국판과 동일한 작업 인터페이스 · 사이트만 다름", + "与国内版同一套链路 · 站点不同、令牌不通用": "중국판과 동일한 흐름 · 사이트가 다르고 토큰은 호환되지 않음", "今天已领 {n} 份": "오늘 {n}건 받음", "今天未领": "오늘 미수령", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "오늘(베이징 시간 {day}) 수령 완료 · 공식 확인 반영 {n}건 · 내일 다시 수령 가능", @@ -128,6 +129,7 @@ "新手福利": "입문 혜택", "新手福利有 {n} 项领取失败,可重试": "입문 혜택 {n}건의 수령에 실패했습니다. 재시도할 수 있습니다", "无": "없음", + "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "전용 체크인 API 없음 · 하루에 한 번 계정 대신 로그인 정보 엔드포인트를 호출(그것이 당일 마립)", "无独立签到接口 · 每天替账号打一次首次登录积分": "독립 출석 인터페이스 없음 · 매일 계정당 최초 로그인 포인트를 한 번 적립", "无账号": "계정 없음", "暂不可领": "지금은 수령 불가", diff --git a/desktop-tauri/i18n/i18n-src/pt-BR/add-account.json b/desktop-tauri/i18n/i18n-src/pt-BR/add-account.json index 6d73d2da..53b414e9 100644 --- a/desktop-tauri/i18n/i18n-src/pt-BR/add-account.json +++ b/desktop-tauri/i18n/i18n-src/pt-BR/add-account.json @@ -17,6 +17,9 @@ "CatPaw 的 X-Passport-Token(登录态 Cookie)": "X-Passport-Token do CatPaw (Cookie da sessão de login)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (três segmentos separados por ponto)", "Command Code": "Command Code", + "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "", + "ModelScope 国内版": "ModelScope edição China", + "ModelScope 国际版": "ModelScope edição internacional", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode edição internacional", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "Endpoint gerenciado do NVIDIA NIM; solicite a Key em integrate.api.nvidia.com", @@ -24,6 +27,7 @@ "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken é a credencial de login do Accio (um token opaco bem longo, não é JWT); refreshToken é opcional e, se preenchido, permite renovação automática ao expirar. Preencha a credencial da conta {label} — {siteNote} (a forma mais fácil de obter: use o \"Login web\" acima; não é preciso procurar o token manualmente.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken é o Cloud-IDE-JWT do Trae (três segmentos separados por ponto) e o refreshToken serve para renovação automática ao expirar (este provedor troca o refreshToken a cada uso: assim que é trocado, o antigo é invalidado, então não atualize a mesma conta em dois programas ao mesmo tempo).
Ao colar manualmente, preencha também machineId / deviceId: o upstream os vincula à chave pública do dispositivo enviada no login para identificar o dispositivo, e inventar um novo par dispara a família de rejeições de vínculo de dispositivo 2xxxx.
Sem esses três itens, o caminho correto é o \"Login web\" acima; em contêiner / implantação remota, basta colar o endereço de callback da barra de endereços conforme as instruções.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "O valor de monkeycode_ai_session (também pode colar o Cookie inteiro)", + "ms- 开头的 API 令牌": "Token de API começando com ms-", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken é opcional e, se preenchido, permite renovação automática ao expirar; ambos podem ser obtidos do arquivo de sessão de login do cliente Raccoon.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken é opcional e, se preenchido, permite renovação automática; ambos podem ser obtidos do arquivo de sessão de login do cliente. A mesma conta Cline funciona nos dois pools; aqui ela entra em {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "O token aceita o prefixo enc: (descriptografado automaticamente no Windows). Sem preencher o refreshToken, não é possível renovar automaticamente.", @@ -96,6 +100,7 @@ "可选,留空使用账号昵称或邮箱": "Opcional; se vazio, usa o apelido ou o e-mail da conta", "可选,留空则用 key 尾号": "Opcional; se vazio, usa o final da key", "可选,留空则用 userId": "Opcional; se vazio, usa o userId", + "可选,留空则用上游账号昵称": "Opcional; se deixado em branco, o apelido da conta upstream é usado", "可选,留空则用上游返回的账号名或账号 id": "Opcional; se vazio, usa o nome ou o id da conta retornados pelo upstream", "可选,留空则用凭证里的账号名": "Opcional; se vazio, usa o nome da conta na credencial", "可选,留空则用文件里的昵称": "Opcional; deixe vazio para usar o apelido do arquivo", @@ -103,6 +108,7 @@ "可选,留空则用脱敏手机号": "Opcional; se vazio, usa o celular mascarado", "可选,留空则用脱敏手机号或 userId": "Opcional; se vazio, usa o celular mascarado ou o userId", "可选,留空则用账号 uk": "Opcional; se vazio, usa o uk da conta", + "可选,留空则用账号昵称或 userId": "", "可选,留空则用邮箱或令牌尾号": "Opcional; se vazio, usa o e-mail ou o final do token", "可选,留空用「OfficeAce 果办」": "Opcional; se vazio, usa “OfficeAce”", "可选,留空自动生成": "Opcional; se vazio, gerado automaticamente", @@ -278,12 +284,16 @@ "等待登录完成…": "Aguardando a conclusão do login…", "等待网页登录…": "Aguardando o login web…", "粘贴 API Key": "Colar API Key", + "粘贴 API 令牌": "Colar token de API", "粘贴 Accio 的 accessToken": "Colar o accessToken do Accio", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Cole o Google refresh token do Antigravity (começa com 1//; também pode colar a linha inteira que contém refresh_token=).
Esta é uma entrada manual além do login web (por exemplo, exportada do IDE oficial em que você já está conectado). O refresh token não expira, e o gateway renova o access token automaticamente ao expirar; se o token for perdido, só resta refazer a autorização do Google, então guarde-o bem.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Cole a API Key do Command Code (começa com user_; obtenha no ~/.commandcode/auth.json do CLI oficial ou no studio web). Colar a linha inteira / com aspas / com o prefixo Bearer funciona; o gateway extrai a key pura sozinho. A key não expira e não há API de renovação, então basta obter uma nova se ela deixar de funcionar. Ao adicionar, o gateway faz uma verificação leve de atividade; uma falha não impede a adição.", "粘贴 Cookie": "Colar Cookie", "粘贴 Google refresh token": "Colar Google refresh token", + "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "Cole um token de API do ModelScope (começando com ms-, obtido na página \"Tokens de acesso\" em {site}).
{siteNote}
Este token tem dupla finalidade: o gateway o usa tanto para chamar a inferência quanto para ler a identidade da conta, o saldo de Magicubes e o check-in diário. O token é de longa duração e não há API de renovação; se parar de funcionar, basta obter um novo e colar de novo.", + "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "", "粘贴 Qoder 个人访问令牌(pt-…)": "Colar o token de acesso pessoal do Qoder (pt-…)", + "粘贴 accessToken": "", "粘贴 access_token(一长串 JWT)": "Colar o access_token (um JWT longo)", "粘贴 session cookie": "Colar session cookie", "粘贴 token / refreshToken": "Colar token / refreshToken", @@ -326,12 +336,14 @@ "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Lê ~/.cline/data/settings/providers.json; requer login no cliente Cline", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Lê ~/.meituan-catpaw/auth.json; requer login no cliente CatPaw", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Lê a sessão de login do cliente KukuAI desta máquina (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requer login no cliente KukuAI", + "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Lê a sessão de login atual do cliente desta máquina (Cookie em texto claro, sem descriptografia). Com o cliente em execução, o arquivo Cookies fica em uso exclusivo; feche o cliente KukuAI antes de importar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, clique em \"Atualizar Token\" para sincronizar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, basta importar de novo.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Usuários que entram no cliente com Zai / Google devem usar esta opção.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Esta opção fica em {label}.", + "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "", "账号信息": "Informações da conta", "账号信息不完整,请刷新后重试": "Informações da conta incompletas; atualize e tente novamente", "账号已添加,但请留意:{warning}": "Conta adicionada, mas atenção: {warning}", @@ -343,7 +355,9 @@ "这一家当前不支持网页登录,请改用填写凭证": "Este provedor não suporta login web no momento; use \"Preencher credenciais\"", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "Esta conta não tem campanhas com resgate automático no momento (apenas os pontos de brinde do login diário são resgatados automaticamente)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "Esta cota passa pelo canal \"Start Plan\": se o encaminhamento avisar que o Coding Plan expirou, ", + "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "Aqui é a conta do site da China (modelscope.cn): cole o token do site da China. O site internacional (modelscope.ai) é outro provider com outra conta; os tokens não são intercambiáveis entre os dois.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site da China (monkeycode-ai.com): cole a sessão do site da China. O site internacional (monkeycode-ai.net) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", + "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "Aqui é a conta do site internacional (modelscope.ai): cole o token do site internacional. O site da China (modelscope.cn) é outro provider com outra conta; os tokens não são intercambiáveis entre os dois.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site internacional (monkeycode-ai.net): cole a sessão do site internacional. O site da China (monkeycode-ai.com) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", "选择凭证文件导入": "Importar de arquivo de credenciais", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Selecione o arquivo de credenciais de sessão do cliente oficial (workbuddy-desktop.info / workbuddy-desktop-ai.info) ou um JSON de conta exportado pelo wb2api (formato aninhado ou plano); também é possível ler diretamente do cliente oficial nesta máquina.", diff --git a/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json b/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json index f956993e..7a2c5b9e 100644 --- a/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json +++ b/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json @@ -34,6 +34,7 @@ "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo; o resgate diário/de planos dele e do ZCode fica em \"Benefícios de atividade\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo, e o benefício diário dele fica logo acima em \"Check-in diário\"; o resgate de planos do ZCode fica em \"Benefícios de atividade\".", "与国内版同一套任务接口 · 站点不同": "Mesma interface de tarefas da edição da China · site diferente", + "与国内版同一套链路 · 站点不同、令牌不通用": "Mesmo fluxo da edição China · site diferente, tokens não intercambiáveis", "今天已领 {n} 份": "{n} resgatado(s) hoje", "今天未领": "Não resgatado hoje", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Resgatado hoje (horário de Pequim, {day}) · {n} itens confirmados oficialmente · amanhã é possível resgatar novamente", @@ -128,6 +129,7 @@ "新手福利": "Benefícios iniciais", "新手福利有 {n} 项领取失败,可重试": "{n} item(ns) dos benefícios iniciais falharam no resgate — é possível tentar novamente", "无": "Nenhum", + "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "Sem API de check-in dedicada · acessa o endpoint de informações de login uma vez por dia por conta (o que concede os Magicubes diários)", "无独立签到接口 · 每天替账号打一次首次登录积分": "Sem interface de check-in própria · credita uma vez por dia os pontos de primeiro login da conta", "无账号": "Sem contas", "暂不可领": "Indisponível", diff --git a/desktop-tauri/i18n/i18n-src/zh-Hant/add-account.json b/desktop-tauri/i18n/i18n-src/zh-Hant/add-account.json index 2851ccb2..82344839 100644 --- a/desktop-tauri/i18n/i18n-src/zh-Hant/add-account.json +++ b/desktop-tauri/i18n/i18n-src/zh-Hant/add-account.json @@ -17,6 +17,9 @@ "CatPaw 的 X-Passport-Token(登录态 Cookie)": "", "Cloud-IDE-JWT(三段点分)": "", "Command Code": "", + "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "", + "ModelScope 国内版": "", + "ModelScope 国际版": "", "MonkeyCode": "", "MonkeyCode 国际版": "", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "", @@ -24,6 +27,7 @@ "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "", + "ms- 开头的 API 令牌": "", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "", @@ -96,6 +100,7 @@ "可选,留空使用账号昵称或邮箱": "", "可选,留空则用 key 尾号": "", "可选,留空则用 userId": "", + "可选,留空则用上游账号昵称": "", "可选,留空则用上游返回的账号名或账号 id": "", "可选,留空则用凭证里的账号名": "", "可选,留空则用文件里的昵称": "", @@ -103,6 +108,7 @@ "可选,留空则用脱敏手机号": "", "可选,留空则用脱敏手机号或 userId": "", "可选,留空则用账号 uk": "", + "可选,留空则用账号昵称或 userId": "", "可选,留空则用邮箱或令牌尾号": "", "可选,留空用「OfficeAce 果办」": "", "可选,留空自动生成": "", @@ -278,12 +284,16 @@ "等待登录完成…": "", "等待网页登录…": "", "粘贴 API Key": "", + "粘贴 API 令牌": "", "粘贴 Accio 的 accessToken": "", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "", "粘贴 Cookie": "", "粘贴 Google refresh token": "", + "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "", + "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "", "粘贴 Qoder 个人访问令牌(pt-…)": "", + "粘贴 accessToken": "", "粘贴 access_token(一长串 JWT)": "", "粘贴 session cookie": "", "粘贴 token / refreshToken": "", @@ -326,12 +336,14 @@ "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "", + "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "", + "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "", "账号信息": "", "账号信息不完整,请刷新后重试": "", "账号已添加,但请留意:{warning}": "", @@ -343,7 +355,9 @@ "这一家当前不支持网页登录,请改用填写凭证": "", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "", + "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "", + "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "", "选择凭证文件导入": "", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "", diff --git a/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json b/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json index 111c6d9a..da455647 100644 --- a/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json +++ b/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json @@ -34,6 +34,7 @@ "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "", "与国内版同一套任务接口 · 站点不同": "", + "与国内版同一套链路 · 站点不同、令牌不通用": "", "今天已领 {n} 份": "", "今天未领": "", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "", @@ -127,6 +128,7 @@ "新手福利": "", "新手福利有 {n} 项领取失败,可重试": "", "无": "", + "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "", "无独立签到接口 · 每天替账号打一次首次登录积分": "", "无账号": "", "暂不可领": "", diff --git a/desktop-tauri/src-tauri/server/src/server/api/accounts.rs b/desktop-tauri/src-tauri/server/src/server/api/accounts.rs index 4cb3fec8..ab8f44e2 100644 --- a/desktop-tauri/src-tauri/server/src/server/api/accounts.rs +++ b/desktop-tauri/src-tauri/server/src/server/api/accounts.rs @@ -874,6 +874,36 @@ pub async fn add_account(state: &ServerState, body: &Bytes) -> Response { if import_desktop { "desktop" } else { "manual" }, ) } + // ModelScope(魔搭)的两个站点:粘贴 `ms-` 令牌 + **先探活换身份**。 + // + // 为什么本家要出网(不是「粘贴即落盘」):那枚令牌是不透明的, + // 解不出身份 —— 不出网就只能拿令牌尾号当账号 id,同一个账号换一次令牌 + // 就会变成两条记录。所以照 Qoder / OfficeAce 的既有分工:**网络在锁外** + // (这里 await 一次探活),把结果作为参数交给同步的落账号入口 + // (`add_modelscope_account` 只在锁内做读-改-写)。 + // + // 探活顺带触发当日签到(见 `modelscope::probe` 的模块头)—— + // 添加账号的人当天就把魔粒拿到手,这是上游的接口语义决定的, + // 不是这里额外做了一件事。 + // + // 地区由 kind 反查(provider 身份是权威,payload 里没有地区字段)。 + Some(kind @ (crate::server::core::providers::ProviderKind::Modelscope + | crate::server::core::providers::ProviderKind::ModelscopeIntl)) => { + let region = crate::server::core::providers::modelscope::Region::from_kind(kind) + .unwrap_or(crate::server::core::providers::modelscope::Region::Cn); + let token = crate::server::core::providers::modelscope::credentials::token_from_payload(&payload); + if token.is_empty() { + Err(AccountStoreError::new( + "缺少令牌(accessToken / apiKey / token / session)", + 400, + )) + } else { + match crate::server::core::providers::modelscope::probe::identify(region, &token).await { + Ok(identity) => store.add_modelscope_account(region, &payload, &identity, import_name), + Err(error) => Err(AccountStoreError::new(error.message, error.status_code)), + } + } + } // WorkBuddy 系的两家(国内版 / 国际版):同一套凭证形态与落账号路径, // 差别只有归属 —— provider id 自己就是归属(拆家后不再从 payload 里的 // `edition` 反推:那是账号的属性,而落哪一家是身份问题)。 diff --git a/desktop-tauri/src-tauri/server/src/server/core/account_store/mod.rs b/desktop-tauri/src-tauri/server/src/server/core/account_store/mod.rs index 297002af..8b9f13dc 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/account_store/mod.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/account_store/mod.rs @@ -109,6 +109,7 @@ pub mod commandcode_accounts; pub mod custom_accounts; pub mod kuku_accounts; pub mod loomy_accounts; +pub mod modelscope_accounts; pub mod monkeycode_accounts; pub mod officeace_accounts; pub mod orcaterm_accounts; @@ -210,6 +211,20 @@ pub(crate) fn is_monkeycode_family(provider_id: &str) -> bool { provider_id == MONKEYCODE_PROVIDER_ID || provider_id == MONKEYCODE_INTL_PROVIDER_ID } +/// 这个 provider 是不是 **ModelScope 系**(两个站点之一)。 +/// +/// 与 [`is_autoclaw_family`] / [`is_monkeycode_family`] 同一形态、同一理由: +/// 账号层有几处判断只关心「是不是 ModelScope」(公开形态、令牌长度校验), +/// 不关心哪个站点 —— 那些分支走本函数,于是加站点或改名时只改这里一处, +/// 而不是散在各文件里的 `id == "modelscope"`(那种写法对国际版恒为假, +/// 是个不会报错的静默失配)。 +/// +/// 判据从 `Region` 互查推导(同 [`is_accio_family`] / [`is_zcode_family`]), +/// **不要**用 `starts_with("modelscope-")` —— 国际版的 id 也以它开头。 +pub(crate) fn is_modelscope_family(provider_id: &str) -> bool { + crate::server::core::providers::modelscope::Region::from_provider_id(provider_id).is_some() +} + /// Command Code provider id(账号存储内部多处要用;**从注册表推导**)。 /// 账号形态见 `commandcode_accounts.rs`(单一 provider、没有地区之分)。 pub(crate) const COMMANDCODE_PROVIDER_ID: &str = crate::server::core::providers::kind_id( diff --git a/desktop-tauri/src-tauri/server/src/server/core/account_store/modelscope_accounts.rs b/desktop-tauri/src-tauri/server/src/server/core/account_store/modelscope_accounts.rs new file mode 100644 index 00000000..70558daf --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/account_store/modelscope_accounts.rs @@ -0,0 +1,259 @@ +//! ModelScope(魔搭)账号:粘贴 `ms-` 令牌落账号、公开形态。 +//! +//! ── 账号字段 ──────────────────────────────────────────────── +//! ```text +//! 本项目记录:{ id, provider:"modelscope"|"modelscope-intl", name, userId(=HavanaId), +//! accessToken(=ms-令牌), tokenTail, source, priority, enabled, +//! addedAt, updatedAt } +//! 上游身份响应:{ HavanaId, Name, NickName, Email }(见 providers/providerscope/probe.rs) +//! ``` +//! `accessToken` 落盘存的就是那枚 `ms-` 令牌 —— 键名与别家统一 +//! (`has_token()` / `access_token()` 一族认这个键)。 +//! +//! ── 为什么添加要走一次探活(本文件只落盘、不出网)──────────────── +//! 令牌不透明(不是 JWT,解不出身份),所以身份由 `probe::identify` 出网换来、 +//! **作为参数**传进来(qoder 的 `add_qoder_account` 同一分工:网络在锁外、 +//! 本文件只在锁内做读-改-写)。这样持锁期间绝不发请求这条纪律不被破坏。 +//! +//! 记录 id = `{地区前缀}{HavanaId}`:**同一账号在两地的 id 天然不相交**, +//! 于是「两地各加一个账号」可以并存(理由见 `modelscope::region` 的 +//! `account_id_prefix`)。 +//! +//! ── 与别家添加路径的关系 ──────────────────────────────────── +//! **只有一条来源**:粘贴令牌(`api::accounts::add_account` 的 modelscope 分支)。 +//! 没有网页登录、没有桌面端导入 —— 魔搭没有桌面客户端(见 `providers/modelscope` +//! 的模块头)。 +//! +//! 本文件全是「读-改-写」文件操作,**没有任何网络请求**(持锁不做网络)。 +//! 绝不 unwrap/expect(release 是 panic=abort)。 + +use serde_json::{Map, Value}; + +use crate::server::core::account_store::priority::next_free_priority; +use crate::server::core::account_store::sql; +use crate::server::core::account_store::state::{mark_name_custom, StoredAccount}; +use crate::server::core::account_store::{AccountStore, AccountStoreError}; +use crate::server::core::providers::modelscope::probe::Identity; +use crate::server::core::providers::modelscope::Region; +use crate::server::logging; + +/// 备注名长度上限(与别家同一口径) +const MAX_NAME_LENGTH: usize = 100; + +/// 身份字段(`HavanaId`)长度上限 +const MAX_IDENTITY_LENGTH: usize = 256; + +/// 令牌长度上限(超过这个长度的输入一定是粘错了东西) +const MAX_TOKEN_LENGTH: usize = 8192; + +/// 截断到 `max` 个**字符**(不是字节;备注名可能有中文) +fn truncate_chars(value: &str, max: usize) -> String { + if value.chars().count() <= max { + return value.to_string(); + } + value.chars().take(max).collect() +} + +/// 从 payload 里取第一个非空字符串(候选键覆盖本项目落盘名与粘贴形态) +fn pick(payload: &Value, keys: &[&str]) -> String { + for key in keys { + let value = payload + .get(*key) + .and_then(Value::as_str) + .map(str::trim) + .unwrap_or(""); + if !value.is_empty() { + return value.to_string(); + } + } + String::new() +} + +impl AccountStore { + /// 取一条 ModelScope 账号记录(公开形态的原始 JSON)。 + /// + /// `region` 决定查哪一家(`modelscope` / `modelscope-intl` 是两家 provider, + /// 各自的账号集合独立)。 + /// + /// `account_id` 非空 → 按 id 直查(不属于本家返回 None); + /// 为空 → 本家**启用中**账号里优先级最靠前的一条(与 + /// `autoclaw_account_record` 的语义一致:转发默认用队首账号)。 + pub fn modelscope_account_record(&self, region: Region, account_id: &str) -> Option { + let provider_id = region.provider_id(); + let guard = self.guard(); + if !account_id.is_empty() { + let record = self.record_by_id(&guard, account_id)?; + return (record.provider() == provider_id).then(|| record.to_value()); + } + let mut candidates: Vec = self + .records_for_provider(&guard, provider_id) + .into_iter() + .filter(StoredAccount::enabled) + .collect(); + candidates.sort_by_key(StoredAccount::order_key); + candidates.into_iter().next().map(|item| item.to_value()) + } + + /// 添加/更新一个 ModelScope 账号(唯一落账号入口)。 + /// + /// payload:`accessToken` / `apiKey` / `token` / `session` 任一给出令牌(必填); + /// `userId` 可选(给了会被 `identity` 覆盖 —— 身份以上游探活结果为准, + /// 那是本家唯一的可信来源)。 + /// + /// `identity` 由调用方在**锁外**探活得到(见模块头)。令牌缺失 / 超长、 + /// 或身份缺失时报 400(拿不到身份的添加必须失败,理由见 `probe.rs`)。 + /// + /// 撞 id(本机已有同 id 记录)时:同 provider 就地更新(保留优先级与启用状态、 + /// 沿用用户改过的备注名),撞到**别的 provider** 时报错 —— 绝不覆写他人记录 + /// (与另外几家同一策略)。 + pub fn add_modelscope_account( + &self, + region: Region, + payload: &Value, + identity: &Identity, + name: Option<&str>, + ) -> Result { + let provider_id = region.provider_id(); + let token = pick(payload, &["accessToken", "apiKey", "token", "session"]); + if token.is_empty() { + return Err(AccountStoreError::new( + "缺少令牌(accessToken / apiKey / token / session)", + 400, + )); + } + if token.chars().count() > MAX_TOKEN_LENGTH { + return Err(AccountStoreError::new("令牌过长", 400)); + } + if !identity.has_user_id() { + return Err(AccountStoreError::new( + "未能从上游读到账号身份(HavanaId),无法生成稳定的账号标识", + 400, + )); + } + let user_id = truncate_chars(identity.user_id.trim(), MAX_IDENTITY_LENGTH); + let id = format!("{}{user_id}", region.account_id_prefix()); + + let guard = self.guard(); + let existing = self.record_by_id(&guard, &id); + if let Some(existing) = existing.as_ref() { + let existing_provider = existing.provider(); + if existing_provider != provider_id { + return Err(AccountStoreError::new( + format!( + "账号 id「{id}」已被{existing_provider}账号占用,无法添加同一身份的\ + ModelScope {}账号(请先处理那个账号)", + region.label() + ), + 400, + )); + } + } + // 备注名兜底:显式传入 → 既有记录里的备注名 → 上游昵称 → HavanaId + let explicit_name = name + .map(str::trim) + .filter(|value| !value.is_empty()) + .map(|value| truncate_chars(value, MAX_NAME_LENGTH)); + let record_name = explicit_name + .or_else(|| { + existing + .as_ref() + .map(StoredAccount::name) + .filter(|value| !value.is_empty()) + }) + .unwrap_or_else(|| { + let display = truncate_chars(identity.display_name.trim(), MAX_NAME_LENGTH); + if !display.is_empty() { + display + } else { + format!("ModelScope {}", user_id) + } + }); + let priority = match existing.as_ref() { + Some(record) => record.priority(), + None => { + // 优先级全局唯一(各家共用一条队列),取全库已用号段 + let used = self.with_conn(&guard, |conn| sql::priorities_all(conn))?; + next_free_priority(&used) + } + }; + let now = logging::now_ms(); + + let mut record = Map::new(); + record.insert("id".to_string(), Value::String(id.clone())); + record.insert( + "provider".to_string(), + Value::String(provider_id.to_string()), + ); + record.insert("name".to_string(), Value::String(record_name.clone())); + // 备注名标记:用户显式传了名或既有记录已打标时置位(见 `state::mark_name_custom` + // 的说明)—— 本家走自己的保存路径(不经过 `store_crud::upsert_account` + // 的统一打标),漏了会让添加时填的备注名在将来被上游昵称顶掉。 + mark_name_custom( + &mut record, + name.is_some_and(|value| !value.trim().is_empty()), + existing.as_ref(), + ); + record.insert("userId".to_string(), Value::String(user_id)); + record.insert("accessToken".to_string(), Value::String(token.clone())); + record.insert( + "tokenTail".to_string(), + Value::String( + crate::server::core::providers::modelscope::credentials::token_tail(&token), + ), + ); + record.insert("source".to_string(), Value::String("manual".to_string())); + record.insert("priority".to_string(), Value::from(priority)); + record.insert( + "enabled".to_string(), + Value::Bool( + existing + .as_ref() + .map(StoredAccount::enabled) + .unwrap_or(true), + ), + ); + record.insert( + "addedAt".to_string(), + Value::from( + existing + .as_ref() + .map(StoredAccount::added_at) + .filter(|value| *value != 0) + .unwrap_or(now), + ), + ); + record.insert("updatedAt".to_string(), Value::from(now)); + // 未知字段全量保留(用户手工加过的字段不能因为一次「更新账号」丢掉) + let mut merged = record; + if let Some(existing) = existing.as_ref() { + for (key, value) in existing.fields() { + merged.entry(key.clone()).or_insert_with(|| value.clone()); + } + } + let saved = StoredAccount::from_map(merged); + // 单行落地:`put` = DELETE + INSERT(与别家一致) + self.with_conn(&guard, |conn| sql::put(conn, &saved))?; + logging::log( + "[Accounts]", + &format!( + "✅ ModelScope {}账号已保存: {record_name}(优先级 {priority})", + region.label() + ), + ); + Ok(self.public_account(&saved)) + } + + /// ModelScope 账号的**公开形态**(进 HTTP 响应):去掉令牌本体,只留尾 4 位。 + /// + /// 没有 `edition` 字段:地区由 provider id 直接表达(两家 provider、两个分组), + /// 不需要再往记录上挂一个冗余标签 —— 那正是拆家前那套做法的残留。 + pub fn to_modelscope_public_account(&self, record: &StoredAccount) -> Value { + let mut value = record.to_value(); + if let Some(object) = value.as_object_mut() { + object.remove("accessToken"); + object.insert("available".to_string(), Value::Bool(record.enabled())); + object.insert("hasToken".to_string(), Value::Bool(true)); + } + value + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/account_store/store_view.rs b/desktop-tauri/src-tauri/server/src/server/core/account_store/store_view.rs index 3c349ab4..40369d90 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/account_store/store_view.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/account_store/store_view.rs @@ -361,6 +361,12 @@ impl AccountStore { // tokenTail / tokenExpireAt(续期是否在工作可被肉眼校验,见 // `orcaterm_accounts.rs`) self.to_orcaterm_public_account(record) + } else if super::is_modelscope_family(&record.provider()) { + // ModelScope(魔搭)的两个站点(`modelscope` / `modelscope-intl`)共用 + // 这一份公开形态:账号字段两地完全一致,差别只在域名(那是转发与凭证 + // 层的事,公开形态不体现)。去掉令牌本体,只留尾 4 位与「有没有令牌」 + // (见 `modelscope_accounts.rs`)。 + self.to_modelscope_public_account(record) } else if record .provider() .starts_with(crate::server::core::custom_providers::ID_PREFIX) diff --git a/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs b/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs index a319b9ad..324f71b5 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs @@ -121,11 +121,16 @@ pub fn default_time() -> String { /// 受闸(`checkin_for` 传 manual=false),用户在面板上点不受闸; /// ② 「暂无可领取活动 / 等待重试」是**中性未领取**(不落当日台账,定时链 /// 稍后重试),不是失败 —— `claim_pending` 认这两个文案。 +/// - **ModelScope 国内版 / 国际版**:**没有独立签到接口** —— 调一次登录信息 +/// 接口(`GET /api/v1/users/login/info`)**本身就触发当日魔粒签到**(幂等), +/// 见 `providers::modelscope::checkin`。两个站点各打各的网页站,令牌不通用 +/// (打错得 401)。链路依据是 CPA 的 `modelscope-ratelimit` 插件源码, +/// 2026-10 实测复核。 /// /// 这是「有签到或每日活跃任务」的清单,不是「有积分概念」的清单:CatPaw 有积分 /// 查询但没有签到,因此不在此列 —— 它的账号在批量签到里被算作 `skipped`。 /// 加一家之前先确认它的签到链路真的存在(一个点了必然报错的复选框比没有更糟)。 -pub const CHECKIN_PROVIDERS: [&str; 12] = [ +pub const CHECKIN_PROVIDERS: [&str; 14] = [ "workbuddy", "workbuddy-intl", "raccoon", @@ -140,6 +145,12 @@ pub const CHECKIN_PROVIDERS: [&str; 12] = [ // 追加在**末尾**:这个数组的顺序就是界面复选框与签到中心分组行的顺序, // 插在中间会让所有存量用户的清单顺序变一下(没有功能影响,但没必要动)。 "codearts", + // ModelScope(魔搭)两个站点:签到就是调一次登录信息接口 + // (`GET {网页站}/api/v1/users/login/info`,调用即触发当日魔粒,幂等), + // 链路 2026-10-16 实测存在,见 `providers::modelscope::checkin` 的模块头。 + // 两个站点各打各的网页站,令牌不通用(打错得 401)。 + "modelscope", + "modelscope-intl", ]; /// 缺省的签到提供商集合(全选) @@ -157,12 +168,18 @@ pub fn default_providers() -> Vec { /// 会让这一家的勾选框再也取消不掉(读完就补回来,界面上表现为「取消勾选没反应」)。 /// 所以补齐只做一次,靠配置里的版本号记账;版本一旦写上去,用户之后再取消勾选 /// 就真的生效了。执行点见 `checkin_schedules::extend_providers_once`。 -pub const PROVIDERS_VERSION: i64 = 2; +pub const PROVIDERS_VERSION: i64 = 3; /// 「哪一版加入的家」——条目清单的版本低于它 = 这家还没被提供过 ⇒ 补进去。 /// 版本 1 = 多条目改造上线时的形态(9 家;`qoder-intl` 由 `normalize_providers` /// 的存量兼容规则跟着 `qoder` 带上,不在这里重复登记)。 -const PROVIDERS_ADDED_IN: [(&str, i64); 2] = [("officeace", 2), ("codearts", 2)]; +/// 版本 3 = ModelScope 的两个站点。 +const PROVIDERS_ADDED_IN: [(&str, i64); 4] = [ + ("officeace", 2), + ("codearts", 2), + ("modelscope", 3), + ("modelscope-intl", 3), +]; /// 版本 `version` 之后才加入清单的家(按注册顺序)。空数组 = 这一版没有新家, /// 或配置比代码还新(装过更新的版本又退回来)——两种情况都只记账、不动清单。 diff --git a/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs b/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs index 1df72c67..a152a2dc 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs @@ -372,6 +372,22 @@ pub async fn checkin_for( .map(welfare_claim_of); claim_result(id, name, &display, true, claim) } + // ModelScope(魔搭)的两个站点:签到 = 调一次登录信息接口 + // (`GET {网页站}/api/v1/users/login/info`,**调用即触发当日魔粒**, + // 幂等;见 `providers::modelscope::checkin` 的模块头)。 + // 两个站点各打各的网页站、令牌不通用 —— 地区由 provider id 反查 + // (账号集合按 provider 隔离,同一 id 不可能同时属于两家)。 + "modelscope" | "modelscope-intl" => { + let region = + crate::server::core::providers::modelscope::Region::from_provider_id(provider_id) + .unwrap_or(crate::server::core::providers::modelscope::Region::Cn); + let claim = crate::server::core::providers::modelscope::checkin::claim_daily_checkin( + region, store, &id, + ) + .await + .map_err(|error| error.message); + claim_result(id, name, &display, true, claim) + } // 兜底只服务默认那家(WorkBuddy 国内版)——**不是**「剩下所有家」。 // 这里曾经是无所不包的 `_`:一个 provider 只要没在上面列出,就会拿自己的 // 令牌去打腾讯的签到接口,稳定报错且看不出原因(Qoder 接入前正是这个处境)。 diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/adapter.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/adapter.rs index 4e8026d5..7d582b96 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/providers/adapter.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/adapter.rs @@ -1152,6 +1152,13 @@ pub fn adapter_for(kind: ProviderKind) -> &'static dyn ProviderAdapter { // 余额全部已接通(建会话 → assistant SSE,`is_stateful` 为 true, // 见 `orcaterm/mod.rs` 与 `orcaterm/adapter.rs` 的模块头) ProviderKind::OrcaTerm => &super::orcaterm::ORCATERM_ADAPTER, + // ModelScope 的两个站点是两个 provider、两个实例(同一份实现的按地区 + // 参数化,见 `modelscope::region` 与 `modelscope::mod` 的模块头): + // 国内站打 `api-inference.modelscope.cn` / `modelscope.cn`, + // 国际站打 `.ai` 两个域 —— 打错了会拿到 401(实测), + // 所以这里 kind → region 必须逐字对应。 + ProviderKind::Modelscope => &super::modelscope::MODELSCOPE_ADAPTER, + ProviderKind::ModelscopeIntl => &super::modelscope::MODELSCOPE_INTL_ADAPTER, } } @@ -1251,6 +1258,12 @@ pub fn implemented_kinds() -> Vec { // 远程模型目录(静态清单,`supports_model_refresh()` 为 false)—— // 进本列表只代表「已实现」(与 Zcode 同一口径:刷新循环对它是空操作)。 ProviderKind::OrcaTerm, + // ModelScope 的两个站点各算一家:与国内版各自一份模型清单(各打各的 + // 推理域)、各自的缓存槽与刷新排期 —— 两家都必须在列表里,否则国际版的 + // 目录刷新永远不会被调度(症状是「国际版账号加了、模型列表一直是空的」, + // 与 WorkBuddy 国际版那条同一理由)。 + ProviderKind::Modelscope, + ProviderKind::ModelscopeIntl, ] } diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/catalog.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/catalog.rs index debeb056..c7ce77b2 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/providers/catalog.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/catalog.rs @@ -190,6 +190,17 @@ pub(crate) fn refresh_meta(kind: ProviderKind) -> (bool, i64) { // `orcaterm::models` 的模块头):永远不是远程来源,也没有刷新时刻。 // 与 ZCode 同一口径:如实回 `(false, 0)`,界面的「来源」列显示成内置清单。 ProviderKind::OrcaTerm => (false, 0), + // ModelScope 的两个站点各有一份独立清单(缓存按地区分格,见 + // `modelscope::models` 的模块头):这里如实各查**自己那一格**。 + // 上游**没有**内置兜底清单,所以「有内容」就等于「远程拉到过」。 + ProviderKind::Modelscope | ProviderKind::ModelscopeIntl => { + let region = super::modelscope::Region::from_kind(kind) + .unwrap_or(super::modelscope::Region::Cn); + ( + super::modelscope::models::remote_refreshed(region), + super::modelscope::models::last_refreshed_at(region), + ) + } } } diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/catalog_cache.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/catalog_cache.rs index 9179ef3a..da0cb4b5 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/providers/catalog_cache.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/catalog_cache.rs @@ -106,6 +106,14 @@ pub const SCOPE_ANTIGRAVITY: &str = "antigravity"; /// OfficeAce(华为云果办 / OfficeClaw)的模型目录缓存槽 pub const SCOPE_OFFICEACE: &str = "officeace"; +/// ModelScope(魔搭)**国内站**的模型目录缓存槽 +/// (`GET {推理域}/models`,OpenAI 格式目录) +pub const SCOPE_MODELSCOPE_CN: &str = "modelscopeCn"; +/// ModelScope **国际站**(两个站点各一份清单 —— 实测两地各 36 条且内容不同, +/// 缓存必须分开,否则先刷的那一站会把另一站的清单覆盖掉, +/// 见 `providers::modelscope::region` 的模块头) +pub const SCOPE_MODELSCOPE_INTL: &str = "modelscopeIntl"; + /// 全部 scope(事实来源:`cached_scopes` 按它遍历;新增一家时加在这里)。 pub const ALL_SCOPES: &[&str] = &[ SCOPE_WORKBUDDY, @@ -126,6 +134,8 @@ pub const ALL_SCOPES: &[&str] = &[ SCOPE_MONKEYCODE_INTL, SCOPE_COMMANDCODE, SCOPE_ANTIGRAVITY, + SCOPE_MODELSCOPE_CN, + SCOPE_MODELSCOPE_INTL, ]; /// 一份清单缓存 diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/mod.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/mod.rs index 03f7b3db..599aae28 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/providers/mod.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/mod.rs @@ -136,6 +136,11 @@ pub mod loomy; /// 含工具自动批准与提问自动应答)全部已接通;`is_stateful` 为 true, /// 见 `monkeycode/mod.rs` 的模块头。 pub mod monkeycode; +/// ModelScope(魔搭)的两个站点。适配实现在 `modelscope/`: +/// 账号管理(粘贴 `ms-` 令牌 + 探活取身份)+ **无状态 OpenAI 兼容转发** + +/// 每日签到 + 魔粒余额;无续期、无桌面端导入。**一套实现、两个 provider** +/// (`modelscope` / `modelscope-intl`,两站账号体系分开,见 `modelscope/region.rs`)。 +pub mod modelscope; pub mod officeace; /// OrcaTerm(腾讯云遨驰终端桌面客户端)。适配实现在 `orcaterm/`: /// 账号管理(**粘贴 accessToken** / 导入桌面端 `data.bin` 登录态)+ @@ -469,6 +474,29 @@ pub enum ProviderKind { /// 会话转发(建会话 → assistant SSE)+ 余额(月度 AI 配额); /// `is_stateful` 为 true(请求内会话),见 `orcaterm/mod.rs` 的模块头。 OrcaTerm, + /// ModelScope(魔搭)**国内站**(`modelscope`)。适配实现在 `modelscope/`: + /// 账号管理(粘贴 `ms-` 令牌 + 探活取身份)、无状态 OpenAI 兼容转发、 + /// 每日签到与魔粒余额。 + /// + /// ── 与 [`ProviderKind::ModelscopeIntl`] 是同一套协议的两个站点 ──── + /// 与 AutoClaw / ZCode / MonkeyCode 同一思路:魔搭的**两个站点各有独立的 + /// 账号体系**(国内令牌打国际站网页接口得 `401 access forbidden`,实测), + /// 所以地区必须是 provider 身份而不是账号上的字段。 + /// 拆成两个 provider 还解决一个具体故障:模型目录只有一份的话, + /// 两个站(各自 36 条、内容不同)会互相覆盖。 + /// + /// 实现是**一套**:`modelscope::ModelScopeAdapter` 持有一个 `modelscope::Region`, + /// 两个静态实例(`MODELSCOPE_ADAPTER` / `MODELSCOPE_INTL_ADAPTER`)由 + /// `adapter_for` 按 kind 给出。地区 → provider 的互查在 `modelscope::Region` + /// (`kind` / `provider_id` / `from_provider_id`),别处不要再写 + /// `"modelscope-intl"` 这类字面量。 + /// + /// provider id 都是新名字(本家是全新接入,没有需要保住的存量 id)。 + Modelscope, + /// ModelScope(魔搭)**国际站**(`modelscope-intl`,站点 `www.modelscope.ai`)。 + /// 与 [`ProviderKind::Modelscope`] 同一套协议、不同站点(网页站与推理域都不同, + /// 见 `modelscope::region`)。 + ModelscopeIntl, } /// 一个提供商的静态元数据。 @@ -565,6 +593,16 @@ pub const PROVIDERS: &[ProviderMeta] = &[ // 它的模型名(glm-5.3 / kimi-k3 / deepseek-v4-* 等)与 codearts / catpaw / // zcode 大面积同名,同样靠末位让同名模型优先归已有各家。 ProviderMeta { id: "orcaterm", label: "OrcaTerm" }, + // ModelScope(魔搭)的两个站点**相邻**排列(与 AutoClaw / Qoder / ZCode / + // MonkeyCode 同一理由:同一条产品线的两个版本,中间隔着别家会让「找国际版」 + // 变成一次扫描)。顺序也决定模型目录合并时同名模型先归谁家 —— + // 国内版在前(用户直觉里「魔搭就是国内那个站」)。 + // + // 两个地区**都带版本后缀**(与 WorkBuddy 同款):它们是两家独立的提供商 + // (账号体系、模型目录都分开),名字是用户区分它们的唯一线索 —— + // 只给国际版加后缀会让「ModelScope」读起来像「两地通吃的那一家」。 + ProviderMeta { id: "modelscope", label: "ModelScope 国内版" }, + ProviderMeta { id: "modelscope-intl", label: "ModelScope 国际版" }, ]; /// provider id 在注册表里的下标(未知 id → None)。 @@ -649,6 +687,8 @@ pub fn kind_from_id(id: &str) -> Option { "antigravity" => Some(ProviderKind::Antigravity), "officeace" => Some(ProviderKind::OfficeAce), "orcaterm" => Some(ProviderKind::OrcaTerm), + "modelscope" => Some(ProviderKind::Modelscope), + "modelscope-intl" => Some(ProviderKind::ModelscopeIntl), // 走到这里 = 上面的注册表判定已放行、这个 match 却没有对应分支: // 只可能是有人给 `PROVIDERS` 加了条目忘了加这里。开发期喊出来; // release 返回 None(见上:宁可为「未知」,不可误认成别家)。 @@ -691,6 +731,8 @@ pub const fn kind_id(kind: ProviderKind) -> &'static str { ProviderKind::Antigravity => "antigravity", ProviderKind::OfficeAce => "officeace", ProviderKind::OrcaTerm => "orcaterm", + ProviderKind::Modelscope => "modelscope", + ProviderKind::ModelscopeIntl => "modelscope-intl", } } diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/balance.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/balance.rs new file mode 100644 index 00000000..4db955a2 --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/balance.rs @@ -0,0 +1,156 @@ +//! ModelScope 余额 / 用量查询:魔粒钱包 + 今日已用调用数(2026-10-16 实测)。 +//! +//! ── 两个接口(都在**网页站**,cookie 鉴权)─────────────────────── +//! ```text +//! GET {网页站}/openapi/v1/magicubes/balance +//! → {"success":true,"data":{"total_balance":108,"available_balance":106,"frozen_amount":2}} +//! +//! GET {网页站}/api/v1/inference/rate-limit +//! → {"Code":200,"Success":true,"Data":{"currentUsagePerDay":72}, …} +//! ``` +//! 第一个是**主读数**(魔粒钱包,单位的「魔粒」);第二个是「今天已经用掉多少次 +//! 调用」——它决定今天还能不能继续打上游,是限流链路要看的数。 +//! +//! ── 为什么第二个接口失败只降级、不整条失败 ──────────────────── +//! 主问题是「我还有多少魔粒」,`rate-limit` 是附加读数。让一个附加接口的抖动 +//! 把余额整条变成红色失败,用户会以为钱包也读不到了 —— 所以它失败只记 verbose 日志、 +//! 少给那一行,`raw` 里如实标出没取到。 +//! +//! ── 量纲:三行明细里只有前两行是「魔粒」──────────────────────── +//! `currentUsagePerDay` 的单位是**调用次数**,不是魔粒。它不进 `wallets` +//! (那是钱包明细,同一量纲),而是进 `credits[]`(逐份读数,名字自带量纲说明), +//! 与 `loomy::balance` 把「永久 / 每日赠送」并列的处置同形。名字里写明「次」 +//! 是为了不让界面把它读成「今天用掉了 72 魔粒」。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use serde_json::{json, Value}; + +use crate::server::core::account_store::AccountStore; +use crate::server::errors::GatewayError; +use crate::server::logging; + +use super::client; +use super::credentials; +use super::region::Region; + +/// 魔粒钱包路径(相对网页站) +pub const BALANCE_PATH: &str = "/openapi/v1/magicubes/balance"; + +/// 今日用量路径(相对网页站) +pub const RATE_LIMIT_PATH: &str = "/api/v1/inference/rate-limit"; + +/// 从一份 JSON 里取一个数字(字段缺失 / 非法时给 None)。 +/// +/// 上游有把数字序列化成字符串的形态,两种都认(与 `loomy::balance` 同名函数同款)。 +fn pick_number(data: &Value, key: &str) -> Option { + let value = data.get(key)?; + if let Some(number) = value.as_f64() { + return Some(number); + } + value + .as_str() + .and_then(|text| text.trim().parse::().ok()) +} + +/// 查询某 ModelScope 账号的魔粒余额与今日用量。 +pub async fn query_usage( + region: Region, + store: &AccountStore, + account_id: &str, +) -> Result { + let record = store.modelscope_account_record(region, account_id); + if !account_id.is_empty() && record.is_none() { + return Err(GatewayError::with_status( + 404, + format!( + "ModelScope {}账号 {account_id} 不存在(请重新添加)", + region.label() + ), + )); + } + let credentials = credentials::from_record(region, record.as_ref())?; + + // ── 主读数:魔粒钱包 ──────────────────────────────────── + let balance_payload = + client::site_get(region, BALANCE_PATH, &credentials.token, "魔粒余额查询").await?; + if !client::succeeded(&balance_payload) { + let message = client::message_of(&balance_payload); + return Err(GatewayError::with_status( + 502, + if message.trim().is_empty() { + format!("魔粒余额查询失败(上游 Code={})", client::code_of(&balance_payload)) + } else { + format!("魔粒余额查询失败:{message}") + }, + )); + } + let wallet = client::data_of(&balance_payload); + let available = pick_number(&wallet, "available_balance").unwrap_or(0.0); + let total = pick_number(&wallet, "total_balance"); + let frozen = pick_number(&wallet, "frozen_amount").unwrap_or(0.0); + + // ── 附加读数:今日已用调用数(失败只降级,见模块头)────────── + // 原始报文一并留下(`raw.rateLimit`):没取到给 `Value::Null` —— 排障时 + // 一眼能分辨「上游给了 0」与「这次根本没问到」,缺键则分辨不出。 + let (used_today, rate_limit_raw) = match client::site_get( + region, + RATE_LIMIT_PATH, + &credentials.token, + "今日用量查询", + ) + .await + { + Ok(payload) if client::succeeded(&payload) => ( + pick_number(&client::data_of(&payload), "currentUsagePerDay"), + payload, + ), + Ok(payload) => (None, payload), + Err(error) => { + logging::verbose( + "[Usage]", + &format!("ModelScope 今日用量未取到(余额照常返回):{}", error.message), + ); + (None, Value::Null) + } + }; + + let mut wallets = vec![json!({ + "type": "magicubes", + "displayName": "魔粒余额", + "balance": available, + })]; + if let Some(total) = total { + if let Some(object) = wallets.first_mut().and_then(Value::as_object_mut) { + object.insert("total".to_string(), Value::from(total)); + } + } + if let Some(object) = wallets.first_mut().and_then(Value::as_object_mut) { + object.insert("frozen".to_string(), Value::from(frozen)); + } + + let mut credits = vec![ + json!({ "name": "可用魔粒", "remain": available }), + json!({ "name": "冻结魔粒", "remain": frozen }), + ]; + // 今日已用的量纲是「次」(见模块头)—— 名字里写明,别让界面读成魔粒 + if let Some(used) = used_today { + credits.push(json!({ "name": "今日已用(次)", "remain": used, "daily": true })); + } + + let mut document = json!({ + "available": available, + "unit": "魔粒", + "wallets": wallets, + "raw": { + "balance": balance_payload, + // 没取到时为 null(如实标出,而不是缺键),见上面的取值处 + "rateLimit": rate_limit_raw, + }, + }); + if let Some(object) = document.as_object_mut() { + object.insert("credits".to_string(), Value::Array(credits)); + } + Ok(document) +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/checkin.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/checkin.rs new file mode 100644 index 00000000..222b60d5 --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/checkin.rs @@ -0,0 +1,114 @@ +//! ModelScope 每日签到:**读一次登录信息就完成**(2026-10-16 实测 + 插件源码对照)。 +//! +//! ── 上游是什么 ────────────────────────────────────────────── +//! 魔搭**没有独立的签到接口**(官方网页的「每日签到」按钮背后就是这条): +//! +//! ```text +//! GET {网页站}/api/v1/users/login/info Cookie: m_session_id= +//! → {"Code":200,"Success":true,"Data":{"Name":"…","NickName":"…", +//! "HavanaId":"…","Email":"…"}, …} +//! ``` +//! +//! **调用这个端点本身就触发当日的魔粒签到**(激活当日魔粒额度), +//! 返回体里给的是账号身份,而不是「签到成功」这四个字 —— +//! 这是本家签到与别家最大的不同,也是「看起来只是读了个用户信息」的原因。 +//! +//! ── 依据来自哪里(不是猜的)───────────────────────────────── +//! CPA 的 `modelscope-ratelimit` 插件(v2.4.10,`cmd/plugin/main.go` 的午夜签到段) +//! 就是按这个口径做的:遍历账号 → 调 `/api/v1/users/login/info` → +//! 把这次调用登记成当日签到(`store.RecordCheckIn(aid, now)`)。 +//! 本实现照同一条链路,只是把触发时机交给本项目的自动签到框架。 +//! +//! ── 幂等 ──────────────────────────────────────────────────── +//! 一天内调多次是安全的(插件同样每天只调一次,但没有「今天已签过」的拒绝返回)。 +//! 因此「今天已经触发过」**不算失败** —— 如实报成功并说明是重复调用, +//! 与 Loomy 的 `first-login` 同一口径。 +//! +//! ── 两个地区打各自的站 ────────────────────────────────────── +//! `region` 决定站点。打错了会拿到 `401 access forbidden`(实测:国内站的令牌打 +//! 国际站就是这个响应),这里把它如实翻成「令牌不属于该站点」而不是笼统的失败 —— +//! 那正是用户把两地账号加混时最需要看到的一句话。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use serde_json::{json, Value}; + +use crate::server::core::account_store::AccountStore; +use crate::server::errors::GatewayError; +use crate::server::logging; + +use super::client; +use super::credentials; +use super::region::Region; + +/// 登录信息路径(相对网页站)。**它就是签到**,见模块头。 +pub const LOGIN_INFO_PATH: &str = "/api/v1/users/login/info"; + +/// ModelScope 账号的每日签到(自动签到框架的 claim)。 +/// +/// 返回 `{success, msg}` —— 与 WorkBuddy / 小浣熊 / AutoClaw / Qoder / Loomy +/// 的 claim 同一形状(`billing::checkin` 的汇总只认这两个字段)。 +pub async fn claim_daily_checkin( + region: Region, + store: &AccountStore, + account_id: &str, +) -> Result { + let record = store.modelscope_account_record(region, account_id); + if !account_id.is_empty() && record.is_none() { + return Err(GatewayError::with_status( + 404, + format!( + "ModelScope {}账号 {account_id} 不存在(请重新添加)", + region.label() + ), + )); + } + let credentials = credentials::from_record(region, record.as_ref())?; + + let payload = match client::site_get( + region, + LOGIN_INFO_PATH, + &credentials.token, + "每日签到", + ) + .await + { + Ok(payload) => payload, + // 401 原样透出(调用方按「刷新后重试」的既有处置走;本家没有续期, + // 最终会如实报「请重新粘贴令牌」) + Err(error) => return Err(error), + }; + + if !client::succeeded(&payload) { + let message = client::message_of(&payload); + let message = if message.trim().is_empty() { + format!("每日签到失败(上游 Code={})", client::code_of(&payload)) + } else { + format!("每日签到失败:{message}") + }; + logging::log("[Checkin]", &format!("⚠️ ModelScope {message}")); + return Ok(json!({ "success": false, "msg": message })); + } + + // 成功时上游给的是账号身份(不是「签到成功」)—— 把显示名播报出来, + // 用户一眼能确认「这条记录签的是哪个账号」(多账号场景下这是有用的信息) + let data = client::data_of(&payload); + let display = data + .get("NickName") + .or_else(|| data.get("Name")) + .or_else(|| data.get("nickname")) + .or_else(|| data.get("name")) + .and_then(Value::as_str) + .map(str::trim) + .filter(|value| !value.is_empty()) + .unwrap_or("") + .to_string(); + let msg = if display.is_empty() { + format!("魔搭{}每日签到已触发", region.label()) + } else { + format!("魔搭{}每日签到已触发({display})", region.label()) + }; + logging::log("[Checkin]", &format!("✅ {msg}")); + Ok(json!({ "success": true, "msg": msg })) +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/client.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/client.rs new file mode 100644 index 00000000..5fb0b473 --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/client.rs @@ -0,0 +1,223 @@ +//! ModelScope 两种出站请求的薄封装:网页站(cookie 鉴权)与推理域(Bearer)。 +//! +//! ── 为什么收在一处 ────────────────────────────────────────── +//! 四处消费者(`checkin` / `balance` / `models` / 账号添加时的探活)共用同一套 +//! 超时、错误翻译与「响应信封 → 人话」口径;各写一份会让「哪个码算令牌失效」 +//! 这类判据分叉。 +//! +//! ── 上游的**两种信封**(实测 2026-10-16,都出现在同一家的不同接口上)── +//! 这是本文件最需要注意的一处:魔搭自己的接口没统一大小写。 +//! +//! ```text +//! /api/v1/users/login/info {"Code":200,"Success":true,"Data":{…},"Message":"success"} +//! /api/v1/inference/rate-limit {"Code":200,"Success":true,"Data":{…}} +//! /openapi/v1/magicubes/balance {"success":true,"data":{…}} ← 全小写 +//! ``` +//! +//! 因此取值一律**两种写法都认**([`succeeded`] / [`data_of`] / [`message_of`]), +//! 不要只按一种写死 —— 那会让某一条链路把成功读成失败(或反之)。 +//! +//! ── 令牌失效的判据 ────────────────────────────────────────── +//! 网页站对无效令牌给的是 **HTTP 401 + `{"Code":10019901001,"Message":"access +//! forbidden"}`**(实测:拿国内站的 key 打国际站网页接口就是这个响应)。 +//! 也有接口用 HTTP 200 + `Success:false` 表达失败 —— 两条路都要认: +//! HTTP 401/403 → [`GatewayError`] 401,业务位为假 → 502 并把上游文案带出来。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use serde_json::Value; + +use crate::server::core::auth_http::send_raw; +use crate::server::errors::GatewayError; + +use super::region::Region; + +/// 网页站接口的超时(余额 / 签到都是小请求,20 秒足够;别用 egress 默认的 600 秒 +/// SSE 超时,那会让一个挂住的查询把前端转圈转到天荒地老) +const REQUEST_TIMEOUT_MS: u64 = 20_000; + +/// 响应信封的**成功位**(大写 `Success` 与小写 `success` 都认,见模块头)。 +/// +/// 两种都没有时看 `Code`(缺失则视为成功 —— HTTP 已经 2xx 了,没有反证就照实报成功)。 +pub fn succeeded(payload: &Value) -> bool { + if let Some(flag) = payload.get("Success").and_then(Value::as_bool) { + return flag; + } + if let Some(flag) = payload.get("success").and_then(Value::as_bool) { + return flag; + } + match payload.get("Code").and_then(Value::as_i64) { + Some(code) => code == 200, + None => true, + } +} + +/// 响应信封里的**业务数据**(`Data` / `data` 两层都认)。 +pub fn data_of(payload: &Value) -> Value { + payload + .get("Data") + .or_else(|| payload.get("data")) + .cloned() + .unwrap_or(Value::Null) +} + +/// 响应信封里的**上游文案**(`Message` / `message` / `msg` 三种都认)。 +pub fn message_of(payload: &Value) -> String { + payload + .get("Message") + .or_else(|| payload.get("message")) + .or_else(|| payload.get("msg")) + .and_then(Value::as_str) + .map(str::trim) + .unwrap_or("") + .to_string() +} + +/// 响应信封里的业务码(`Code` / `code`;都没有时给 0)。 +pub fn code_of(payload: &Value) -> i64 { + payload + .get("Code") + .or_else(|| payload.get("code")) + .and_then(Value::as_i64) + .unwrap_or(0) +} + +/// 拼一个网页站 URL(`region` 决定站点,见 `region.rs`)。 +pub fn site_url(region: Region, path: &str) -> String { + format!("{}{path}", region.site_base_url()) +} + +/// 向**网页站**发一次带会话 cookie 的 GET。 +/// +/// 鉴权是 `Cookie: m_session_id=<令牌>`(实测口径,与插件 `msclient.go` 的 +/// `req.Header.Set("Cookie", "m_session_id="+sessionID)` 一致)。 +/// +/// 返回上游响应体;HTTP 层失败翻译成网关错误。**业务位不在本函数里判** —— +/// 调用方各自知道「这次调用的成功长什么样」(签到只看 HTTP,余额看业务位)。 +pub async fn site_get( + region: Region, + path: &str, + token: &str, + what: &str, +) -> Result { + if token.trim().is_empty() { + return Err(GatewayError::with_status( + 401, + "ModelScope 账号缺少令牌,无法查询", + )); + } + let url = site_url(region, path); + let headers = vec![("Cookie".to_string(), format!("m_session_id={token}"))]; + let response = send_raw("GET", &url, None, &headers, None, Some(REQUEST_TIMEOUT_MS)) + .await + .map_err(|error| { + if error.is_timeout() { + GatewayError::with_status(504, format!("{what}超时,请稍后重试")) + } else { + GatewayError::with_status(502, format!("{what}失败:{error}")) + } + })?; + if !response.ok { + if response.status == 401 || response.status == 403 { + return Err(GatewayError::with_status( + 401, + format!( + "{what}:ModelScope 令牌已失效或不属于该站点({}),请重新粘贴(HTTP {})", + region.site_base_url(), + response.status + ), + )); + } + return Err(GatewayError::with_status( + response.status as i32, + format!("{what}返回 HTTP {}", response.status), + )); + } + Ok(response.payload.unwrap_or(Value::Null)) +} + +/// 向**推理域**发一次带 Bearer 的 GET(目前只有模型目录用)。 +/// +/// 与 [`site_get`] 是**两个域**:网页站挂了会连签到一起失败,而推理域挂了只影响 +/// 模型目录 —— 分开成两个函数,才不会让排障时误判成同一处故障。 +pub async fn inference_get( + region: Region, + path: &str, + token: &str, + what: &str, +) -> Result { + if token.trim().is_empty() { + return Err(GatewayError::with_status( + 401, + "ModelScope 账号缺少令牌,无法查询", + )); + } + let url = format!("{}{path}", region.inference_base_url()); + let headers = vec![( + "Authorization".to_string(), + format!("Bearer {token}"), + )]; + let response = send_raw("GET", &url, None, &headers, None, Some(REQUEST_TIMEOUT_MS)) + .await + .map_err(|error| { + if error.is_timeout() { + GatewayError::with_status(504, format!("{what}超时,请稍后重试")) + } else { + GatewayError::with_status(502, format!("{what}失败:{error}")) + } + })?; + if !response.ok { + if response.status == 401 || response.status == 403 { + return Err(GatewayError::with_status( + 401, + format!("{what}:ModelScope 令牌已失效,请重新粘贴(HTTP {})", response.status), + )); + } + return Err(GatewayError::with_status( + response.status as i32, + format!("{what}返回 HTTP {}", response.status), + )); + } + Ok(response.payload.unwrap_or(Value::Null)) +} + +#[cfg(test)] +mod tests { + use super::{code_of, data_of, message_of, succeeded}; + use serde_json::json; + + /// 大写信封(login/info、rate-limit 的实测形态) + #[test] + fn the_uppercase_envelope_is_read() { + let payload = json!({"Code": 200, "Success": true, "Data": {"a": 1}, "Message": "success"}); + assert!(succeeded(&payload)); + assert_eq!(code_of(&payload), 200); + assert_eq!(data_of(&payload), json!({"a": 1})); + assert_eq!(message_of(&payload), "success"); + } + + /// 小写信封(magicubes/balance 的实测形态)—— 只认大写会让余额查询整条挂掉 + #[test] + fn the_lowercase_envelope_is_read() { + let payload = json!({"success": true, "data": {"total_balance": 108}}); + assert!(succeeded(&payload)); + assert_eq!(data_of(&payload), json!({"total_balance": 108})); + } + + /// 显式的失败位必须被认出来(否则签到会把上游的拒绝记成成功) + #[test] + fn an_explicit_failure_flag_is_not_a_success() { + assert!(!succeeded(&json!({"Success": false, "Message": "access forbidden"}))); + assert!(!succeeded(&json!({"success": false}))); + // 上游实测的错误码(`access forbidden`)—— 超过 i32 范围,用 i64 字面量 + assert!(!succeeded(&json!({"Code": 10019901001i64, "Success": false}))); + } + + /// `Code` 是唯一线索时(没有布尔位)按 200 判 + #[test] + fn the_code_is_the_last_resort() { + assert!(succeeded(&json!({"Code": 200}))); + assert!(!succeeded(&json!({"Code": 500}))); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/credentials.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/credentials.rs new file mode 100644 index 00000000..85d81c03 --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/credentials.rs @@ -0,0 +1,148 @@ +//! ModelScope 凭证:**只有一条来源** —— 账号记录里的 `ms-` 令牌。 +//! +//! ── 为什么只要一个字段(实测依据,见 `region.rs` 的模块头)──────── +//! 同一个 `ms-...` 令牌既作 `Authorization: Bearer` 调推理,又作 +//! `Cookie: m_session_id=` 调网页站接口 —— 两条链路 2026-10-16 实测都是 200。 +//! 所以本模块比 CodeArts / OfficeAce 那两家(网关凭据 + 控制面临时凭据两层) +//! 薄得多:取一个令牌、判一次非空,就完了。 +//! +//! ── 没有续期(与 Loomy 同一处境)───────────────────────────── +//! 魔搭的 `ms-` 令牌是**长期有效**的(插件源码注释:「session 就是 api key 本身…… +//! 永不过期」;实测也没有任何 refresh / renew 接口)。因此: +//! - `supports_refresh()` 为 false —— 维护任务不问本家; +//! - 令牌失效(上游 401 / 业务码拒绝)只能重新去魔搭控制台复制一个; +//! - 没有「过期时刻」这个概念,账号页不显示有效期(前端 +//! `PROVIDER_FEATURES` 的 `expiry` 给空串)。 +//! +//! ── 备份字段 ──────────────────────────────────────────────── +//! `accessToken` 是本项目落盘名(`has_token()` / `access_token()` 一族认它); +//! 粘贴形态另外兼容 `apiKey` / `token` / `session` —— 用户从别处复制过来的 +//! JSON 里字段名并不统一,宽容读取比报错更实用。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use serde_json::Value; + +use crate::server::errors::GatewayError; + +use super::region::Region; + +/// 一次转发 / 查询用的凭证快照。 +#[derive(Clone, Debug)] +pub struct ModelScopeCredentials { + /// 地区(决定打哪个推理域、哪个网页站) + pub region: Region, + /// 账号记录 id + pub id: String, + /// `ms-` 令牌(**两用**:Bearer 调推理、cookie 值调网页站) + pub token: String, + /// 魔搭侧用户 id(`HavanaId`;身份标识,也是账号 id 的种子) + pub user_id: String, + /// 展示名(记录的备注名) + pub name: String, +} + +impl ModelScopeCredentials { + /// 推理基址(`build_chat_request` 与目录刷新用;见 `Region::inference_base_url`) + pub fn inference_base_url(&self) -> &'static str { + self.region.inference_base_url() + } +} + +/// 从一条取值链里挑第一个非空字符串(记录可能被手工编辑过,宽容读取) +fn pick<'a>(record: &'a Value, keys: &[&str]) -> String { + for key in keys { + let value = record + .get(*key) + .and_then(Value::as_str) + .map(str::trim) + .unwrap_or(""); + if !value.is_empty() { + return value.to_string(); + } + } + String::new() +} + +/// 从**上传的 payload**里取令牌(添加路径专用:先取出来去探活,再交给落账号入口)。 +/// +/// 与 [`from_record`] 的取值链**逐字相同**(同一组候选键)—— 两处口径分叉的话, +/// 「能探活成功却落不进账号」或反之都会变成难查的静默问题。 +pub fn token_from_payload(payload: &Value) -> String { + pick(payload, &["accessToken", "apiKey", "token", "session"]) +} + +/// 从账号记录解析凭证(**唯一入口**;`record` 为 None 时报「没有可用账号」)。 +pub fn from_record( + region: Region, + record: Option<&Value>, +) -> Result { + let Some(record) = record else { + return Err(GatewayError::with_status( + 401, + format!( + "没有可用的 ModelScope {}账号:请在账号页粘贴 `ms-` 开头的令牌添加", + region.label() + ), + )); + }; + let token = pick(record, &["accessToken", "apiKey", "token", "session"]); + if token.is_empty() { + return Err(GatewayError::with_status( + 401, + "ModelScope 账号缺少令牌,请重新粘贴", + )); + } + Ok(ModelScopeCredentials { + region, + id: pick(record, &["id"]), + token, + user_id: pick(record, &["userId", "havanaId", "user_id"]), + name: pick(record, &["name"]), + }) +} + +/// 令牌尾 4 字符(公开形态与默认备注名用;与别家同一口径)。 +/// +/// 按 `char` 取而不按字节切:`ms-` 后面的内容是上游生成的 ASCII,但**粘贴形态** +/// 的输入框不做格式校验,一个带汉字的误粘贴就能让按字节回切落在多字节字符中间 +/// (release 是 `panic=abort`,一次 panic 带走整个进程)。 +pub fn token_tail(token: &str) -> String { + let chars: Vec = token.chars().collect(); + let start = chars.len().saturating_sub(4); + chars[start..].iter().collect() +} + +#[cfg(test)] +mod tests { + use super::{from_record, token_tail}; + use crate::server::core::providers::modelscope::region::Region; + use serde_json::json; + + #[test] + fn a_record_without_a_token_is_rejected() { + let record = json!({ "id": "modelscope-1", "name": "x" }); + assert!(from_record(Region::Cn, Some(&record)).is_err()); + assert!(from_record(Region::Cn, None).is_err()); + } + + /// 粘贴形态的字段名都认(`accessToken` 是本项目落盘名,其余是手工粘贴的常见写法) + #[test] + fn pasted_field_names_are_all_accepted() { + for key in ["accessToken", "apiKey", "token", "session"] { + let record = json!({ key: "ms-abc123" }); + let credentials = from_record(Region::Cn, Some(&record)) + .unwrap_or_else(|_| panic!("字段 {key} 应当被接受")); + assert_eq!(credentials.token, "ms-abc123"); + } + } + + #[test] + fn token_tail_survives_multibyte_input() { + assert_eq!(token_tail("ms-abcdefgh"), "efgh"); + // 多字节内容不得 panic(按字符取) + assert_eq!(token_tail("令牌令牌令牌"), "令牌令牌"); + assert_eq!(token_tail("ab"), "ab"); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/errors.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/errors.rs new file mode 100644 index 00000000..11325980 --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/errors.rs @@ -0,0 +1,147 @@ +//! ModelScope 的**账号级失败判据**:三类不该被当成「速率窗口」的拒绝。 +//! +//! ── 为什么要单独一个文件 ──────────────────────────────────── +//! 魔搭把「账号条件不满足」和「速率窗口撞上」都用 429 / 403 表达,**只能靠文案 +//! 区分** —— 而两者的正确处置完全不同:前者在充值 / 完成验证之前**一直**不可用 +//! (按天数冷却),后者等一会儿就好(分钟级冷却)。 +//! +//! 判据来源:CPA 的 `modelscope-ratelimit` 插件(源码 +//! `D:\GitHub\modelscope-ratelimit`,`internal/ratelimit/apply.go` 的 +//! `IsInsufficientBalance` / `IsUnverifiedAccount`,两处都是线上实测得来), +//! 本文件照同一套文案子串做匹配。 +//! +//! ── 三类是什么(附上游真实报文)────────────────────────────── +//! ```text +//! ① 魔粒耗尽 429 {"error":{"message":"insufficient balance","request_id":"…"}} +//! 账号的魔粒用完了。充魔粒之前这把令牌确实不可用 —— 插件按「当日禁用」处理, +//! 跨过午夜再试一次(充了值就恢复)。 +//! ② 未验证邮箱 403 正文含 "email verification" / "verified accounts" / "/my/settings/account" +//! 账号没完成邮箱验证,魔粒推理接口直接拒绝服务,充魔粒也救不回来 —— +//! 唯一出路是去账号设置页完成验证。 +//! ``` +//! +//! ── 本网关怎么用这两条 ────────────────────────────────────── +//! 两类都 → `QuotaLimited` 且 `reset_at` 给**下一个北京零点**(`mark_account_limited` +//! 会据此把账号冷却到那个时刻,跨天自动解冻)。 +//! +//! ── 插件里还有一条,本网关**有意不照搬**(说明理由,免得将来被当成遗漏)── +//! 插件把 `503 + "model_not_ready"`(上游 vLLM 还在加载权重)当作**整家不可用**摘掉。 +//! 本网关**不做**:那件事与账号无关(本家每把令牌都会被同样拒绝),罚账号是错的 —— +//! 而 agent2api 也没有「按 provider 摘家」的接口,照搬只能退化成「随便找个账号记一笔 +//! 限额」。这里的默认处置是 `Fatal`(不罚账号,如实回给客户端、由客户端重试), +//! 那正是这条失败应有的语义。代价是编排层换号前会各撞一次,但 `model_not_ready` +//! 是**短暂**状态(权重加载完就好),撞几次的代价远小于把一个好账号记成限额。 +//! +//! ⚠️ **判据一律大小写不敏感的子串匹配,且只在「这次请求已经失败」的分支上调用** —— +//! 子串匹配本身不区分「上游报的错」与「模型自己生成的内容」,正常响应里若出现这些 +//! 字样会被误判(插件源码在 `IsInputContentInspectionFailed` 上方写了同一条警告)。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +/// 一整天(毫秒) +const DAY_MS: i64 = 24 * 60 * 60 * 1000; + +/// 北京时间的固定偏移(UTC+8)。 +/// +/// 用**固定偏移**而不是机器时区:网关可能跑在 UTC 容器里(`.3` 上的部署就是), +/// 而魔搭的一整套「当日」口径(签到、魔粒发放、日额度)都是按北京时间算的 —— +/// 「明天零点」必须是北京的那个。与 `codearts::welfare` 的同名常量同一处置。 +const DAY_ZONE_OFFSET_SECONDS: i32 = 8 * 3600; + +/// 一次失败是否意味着**账号魔粒耗尽**(429 + `insufficient balance`)。 +/// +/// 只看文案不看状态码也可以,但两样都看更稳(插件源码的 `IsInsufficientBalance` +/// 同样要求 429)—— 别的 4xx 里出现这串字的场合不存在,多一道闸门不损失什么。 +pub fn is_insufficient_balance(status: u16, message: &str) -> bool { + status == 429 && contains_ci(message, "insufficient balance") +} + +/// 一次失败是否意味着**账号未完成邮箱验证**(403 + 三选一的特征串)。 +/// +/// **必须同时看状态码与文案**(插件源码的注释写明了理由):403 还有别的权限语义, +/// 只看状态码会把无关失败误判成「账号未验证」,而那会让用户去查一个不存在的问题。 +pub fn is_unverified_account(status: u16, message: &str) -> bool { + if status != 403 { + return false; + } + ["email verification", "verified accounts", "/my/settings/account"] + .iter() + .any(|marker| contains_ci(message, marker)) +} + +/// 大小写不敏感的子串匹配(空值一律 false) +fn contains_ci(haystack: &str, needle: &str) -> bool { + if needle.is_empty() { + return false; + } + haystack.to_ascii_lowercase().contains(&needle.to_ascii_lowercase()) +} + +/// `now_ms` 之后最近的**北京时间零点**(毫秒时间戳,纯函数)。 +/// +/// 给「魔粒耗尽 / 账号未验证 ⇒ 冷却到明天」用:这两种状态在充值 / 完成验证之前 +/// 一直不可用,而魔搭的日口径是北京零点 —— 跨过那个点再试一次,既不会在当天 +/// 反复白撞,也不会把账号永久钉死(用户当天处理完之后,次日自动回来)。 +/// +/// 边界:恰好落在零点上时给**次日**零点(刚过零点,下一个重置点是一整天之后)。 +/// 用 `div_euclid` 而不是 `/`:负数时刻(1970 前)在 Rust 里默认向零取整会算错整天边界。 +pub fn next_day_boundary_ms(now_ms: i64) -> i64 { + let shifted = now_ms + i64::from(DAY_ZONE_OFFSET_SECONDS) * 1000; + let start_of_today = shifted.div_euclid(DAY_MS) * DAY_MS; + start_of_today + DAY_MS - i64::from(DAY_ZONE_OFFSET_SECONDS) * 1000 +} + +#[cfg(test)] +mod tests { + use super::{is_insufficient_balance, is_unverified_account, next_day_boundary_ms}; + + /// 上游真实报文里的文案(插件测试夹具逐字同款) + #[test] + fn the_measured_insufficient_balance_body_is_recognised() { + assert!(is_insufficient_balance(429, "insufficient balance")); + // 大小写与前后缀都不影响 + assert!(is_insufficient_balance(429, "Insufficient Balance")); + assert!(is_insufficient_balance( + 429, + "{\"error\":{\"message\":\"insufficient balance\",\"request_id\":\"x\"}}" + )); + // 必须是 429:别的状态码配这串字不是「魔粒耗尽」的语义 + assert!(!is_insufficient_balance(400, "insufficient balance")); + assert!(!is_insufficient_balance(429, "rate limit exceeded")); + } + + /// 403 的两种语义必须分开 —— 把「未验证邮箱」当成「令牌失效」会让用户 + /// 白白去重新粘贴一个本来就好好的令牌 + #[test] + fn the_unverified_account_markers_are_recognised() { + assert!(is_unverified_account( + 403, + "please complete email verification before using inference" + )); + assert!(is_unverified_account(403, "only verified accounts can call this API")); + assert!(is_unverified_account(403, "visit https://modelscope.cn/my/settings/account")); + // 裸 403(没有任何特征串)不是这一条 + assert!(!is_unverified_account(403, "access forbidden")); + assert!(!is_unverified_account(401, "email verification")); + } + + /// 北京零点:与 codearts 的同名函数同一口径(那里有自己的测试守着) + #[test] + fn the_day_boundary_is_the_coming_beijing_midnight() { + // 2026-10-16 12:00 北京 = 04:00 UTC → 时间戳 1792123200000 + let noon_cst = 1792123200000i64; + let boundary = next_day_boundary_ms(noon_cst); + // 距北京零点还有 12 小时 + assert_eq!(boundary - noon_cst, 12 * 60 * 60 * 1000); + // 再问一次已经落在零点上的时刻:给次日零点(不是同一刻) + assert_eq!(next_day_boundary_ms(boundary), boundary + 24 * 60 * 60 * 1000); + } + + /// 空串不得命中任何一条(`contains_ci` 的 needle 非空,但上游可能给出空 message) + #[test] + fn an_empty_message_matches_nothing() { + assert!(!is_insufficient_balance(429, "")); + assert!(!is_unverified_account(403, "")); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/mod.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/mod.rs new file mode 100644 index 00000000..b1260cff --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/mod.rs @@ -0,0 +1,439 @@ +//! ModelScope(魔搭)适配器:**无状态 OpenAI 兼容转发 + 每日签到 + 魔粒余额**。 +//! +//! ── 上游长什么样(2026-10-16 实测;接口清单来自 CPA 的 `modelscope-ratelimit` +//! 插件源码,逐条 curl 复核)─────────────────────────────── +//! ```text +//! 推理 POST {推理域}/chat/completions Authorization: Bearer +//! 目录 GET {推理域}/models 同上 +//! 签到 GET {网页站}/api/v1/users/login/info Cookie: m_session_id=<令牌> +//! 魔粒余额 GET {网页站}/openapi/v1/magicubes/balance 同上 +//! 今日用量 GET {网页站}/api/v1/inference/rate-limit 同上 +//! ``` +//! 两个域(推理 / 网页站)各一套地址,两地(国内 / 国际)各一套账号 —— +//! 全部收在 [`region`] 里,别处不要再写域名。 +//! +//! 本家**无状态**(一次 HTTP 请求 = 一次回答,标准 OpenAI 协议),与 Loomy / +//! AutoClaw / OfficeAce 同构:`supports_chat` / `is_stateful` 走默认值, +//! 转发链只需 `build_chat_request`。 +//! +//! ── 三个实测事实决定了本家的形状 ───────────────────────────── +//! 1. **一个 `ms-` 令牌两用**(Bearer 调推理、cookie 值调网页站)⇒ 只要一个 +//! 凭证字段(见 `credentials.rs`); +//! 2. **两个站点的账号体系是分开的**(国内令牌打 `www.modelscope.ai` 得 +//! `401 access forbidden`)⇒ 地区必须是 provider 身份而不是账号上的字段 +//! (见 `region.rs`); +//! 3. **模型清单是账号相关的**(实测 36 条,不是全站几千个)⇒ 不编静态兜底 +//! 表(见 `models.rs`)。 +//! +//! ── 与别家的取舍(都写在各自模块头,这里给索引)────────────── +//! 1. **没有续期**(`supports_refresh = false`):`ms-` 令牌长期有效、上游没有 +//! refresh 接口,失效只能重新粘贴 —— 见 `credentials.rs`; +//! 2. **没有环境变量覆盖**:两个域名是官方硬编码的稳定值,加一层没人会用的 +//! 分支只是过度设计(KISS)—— 见 `region.rs`; +//! 3. **没有静态兜底模型清单**:编一份会让用户看到自己其实调不通的模型 —— +//! 见 `models.rs`。 +//! +//! ── 思考等级 ──────────────────────────────────────────────── +//! 上游是标准 OpenAI 兼容,`/v1/models` 不给能力位(实测只有 id),因此 +//! **不做** `reasoning_patch`:按 id 猜思考位会在两个方向上一起猜错 +//! (把非思考模型当思考模型、反之亦然)。要绑定的用户走模型规则层显式指定。 +//! +//! ── 子模块分工 ────────────────────────────────────────────── +//! ```text +//! region.rs 地区(两套域名 + 两条 provider 身份) +//! credentials.rs 账号记录 → 凭证快照(只有一个令牌字段) +//! client.rs 网页站(cookie)/ 推理域(Bearer)两条出站链路 + 两种响应信封 +//! models.rs GET {推理域}/models(10 分钟缓存 + 落盘缓存,两个地区两格) +//! probe.rs 添加账号时的令牌探活(换身份 + 顺带触发当日签到) +//! checkin.rs 每日签到(调登录信息接口即触发,幂等) +//! balance.rs 魔粒钱包 + 今日已用调用数 +//! ``` +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本目录零 unwrap/expect/panic。 + +pub mod balance; +pub mod checkin; +pub mod client; +pub mod credentials; +pub mod errors; +pub mod models; +pub mod probe; +pub mod region; + +use axum::http::HeaderMap; +use serde_json::Value; + +use crate::server::core::account_store::AccountStore; +use crate::server::core::providers::adapter::{ + ChatRequestPlan, ModelRefreshOutcome, ProviderAdapter, UpstreamErrorClass, +}; +use crate::server::core::providers::{content_block, ProviderKind}; +use crate::server::errors::GatewayError; +use crate::server::logging; + +pub use region::Region; + +/// 适配器实例:**按地区参数化**(一份实现、两个静态实例)。 +/// +/// 与 AutoClaw / ZCode / MonkeyCode 同一形态:地区不是账号字段而是 provider 身份, +/// 因此 `adapter_for` 按 kind 给出两个实例之一 —— 这样「这条账号打哪个站」 +/// 由身份保证,不需要在每一处转发/查询里再读一次账号上的地区。 +/// +/// **无状态**:它不持有任何数据 —— 凭证在账号存储、目录在 `models.rs` 的 +/// 进程级句柄(按 `region` 分格)。 +pub struct ModelScopeAdapter { + region: Region, +} + +/// 国内站适配器(`adapter_for(ProviderKind::Modelscope)` 返回它) +pub static MODELSCOPE_ADAPTER: ModelScopeAdapter = ModelScopeAdapter { region: Region::Cn }; + +/// 国际站适配器(`adapter_for(ProviderKind::ModelscopeIntl)` 返回它) +pub static MODELSCOPE_INTL_ADAPTER: ModelScopeAdapter = ModelScopeAdapter { region: Region::Intl }; + +/// 出站请求体:原样透传 + 把 `stream_options.include_usage` 置真。 +/// +/// 实测依据见 `build_chat_request` 的说明:不置真时魔搭的流式响应**永远不给 +/// 真值 usage**(每个 chunk 都带全零),网关的记账与客户端的 token 显示会一起归零。 +/// +/// 非对象 body(畸形请求)原样返回,不在这一层报错 —— 让上游去拒绝它。 +fn request_body(body: &Value) -> Value { + let mut payload = body.clone(); + let Some(object) = payload.as_object_mut() else { + return payload; + }; + // 保留客户端已设的其余 `stream_options` 键,只把 include_usage 置真 + let mut options = object + .get("stream_options") + .and_then(Value::as_object) + .cloned() + .unwrap_or_default(); + options.insert("include_usage".to_string(), Value::Bool(true)); + object.insert("stream_options".to_string(), Value::Object(options)); + payload +} + +impl ProviderAdapter for ModelScopeAdapter { + fn kind(&self) -> ProviderKind { + self.region.kind() + } + + /// 模型清单来自远程目录(`models.rs` 的进程缓存 + 落盘缓存,两个地区各一格) + fn list_models(&self) -> Vec { + models::list(self.region) + } + + /// 构造 `POST {推理域}/chat/completions`(标准 OpenAI 协议,body 原样透传 + /// **外加一个 `stream_options.include_usage`**,理由见下)。 + /// + /// ── 为什么必须注入 `include_usage`(2026-10-16 实测,一个会静默毁账的坑)── + /// 魔搭的流式响应是**非标准形态**:**每一个 chunk 都带一个 `usage` 对象**, + /// 而且**值全是 0**(标准 OpenAI 是除最后一块外都为 `null`)。真值只在末尾那个 + /// `choices: []` 的 usage-only 块里 —— **而且那一块只在请求显式带上 + /// `stream_options.include_usage: true` 时才发**。实测对照(同一模型同一提问): + /// + /// ```text + /// 不带 include_usage:最后一帧是 {"choices":[{"finish_reason":"stop"}], + /// "usage":{0,0,0}} ← 真值根本没出现 + /// 带 include_usage:{"choices":[], "usage":{62,32,94}} ← 真值在这一块 + /// ``` + /// + /// 后果链:本网关**恒以流式请求上游**(`upstream::payload` 的既有口径), + /// 客户端要非流式时再由聚合器把流折成完整响应(`aggregate.rs` 模块头)。 + /// 不注入这个开关时,聚合器读到的最后一个 usage 就是那串全零 —— + /// 于是**非流式请求的 usage 恒为 0**,请求日志、报表与前端 token 显示一起归零, + /// 而内容完全正常(这个故障只在统计上可见,排查时极难联想到「上游少发了一帧」)。 + /// 流式请求受影响较小(真值帧本来就没下发,客户端同样看到全零)。 + /// + /// 与 CodeArts(`codearts/chat.rs`)的处置一致:**总是请求 usage**。 + /// + /// ── 为什么**不**改别的(模型与流式意向都原样透传)──────────────── + /// 魔搭的 `/v1/models` 里混着非对话模型(生图、基座,见 `models.rs`), + /// 但「哪些模型支持什么」本网关没有任何可信依据去猜(按 id 猜会猜错), + /// 让上游自己判 —— 它给的 400 会被 `classify_error` 如实透出(不是 `Fatal`, + /// 会换账号)。模型 id 也原样发(`组织/模型名`,没有路由前缀那套)。 + /// + /// 客户端已经自己写了 `stream_options` 时**保留它的其余键**、只把 + /// `include_usage` 置真:那两个字段本就是标准 OpenAI 的同一个对象, + /// 覆盖整个对象会把用户显式设过的东西悄悄丢掉。 + fn build_chat_request( + &self, + account: &Value, + body: &Value, + _client_headers: &HeaderMap, + ) -> Result { + let token = account + .get("auth") + .and_then(|auth| auth.get("accessToken")) + .and_then(Value::as_str) + .unwrap_or("") + .trim() + .to_string(); + if token.is_empty() { + return Err(GatewayError::with_status( + 401, + "ModelScope 账号缺少令牌,无法转发(请重新粘贴 `ms-` 令牌)", + )); + } + let headers: Vec<(String, String)> = vec![ + // send_raw 会自动补 Content-Type;这里只加鉴权与 Accept + ("Authorization".to_string(), format!("Bearer {token}")), + ("Accept".to_string(), "text/event-stream".to_string()), + ]; + Ok(ChatRequestPlan::chat( + format!("{}/chat/completions", self.region.inference_base_url()), + headers, + request_body(body), + )) + } + + /// 上游错误分类。**顺序要紧**:两条「账号级」判据必须在裸 401/403 与裸 429 之前, + /// 否则它们会被归成「令牌失效」或「速率窗口」,各自的正确处置就都丢了。 + /// + /// 1. **魔粒耗尽**(429 + `insufficient balance`)→ `QuotaLimited` + + /// 冷却到下一个北京零点。它不是速率窗口:充值之前这把令牌**一直**不可用, + /// 按分钟冷却只会在当天反复白撞; + /// 2. **未验证邮箱**(403 + 特征串)→ 同样冷却到次日。⚠️ 漏了这条的后果最糟: + /// 403 会被当成「令牌失效」,界面提示用户去**重新粘贴一个本来就好好的令牌**, + /// 而真正要做的是去账号设置页完成邮箱验证 —— 一个把人引向错误方向的提示; + /// 3. **裸 401 / 403** → `TokenExpired`(本家无续期,刷新链会走到「重新粘贴」提示); + /// 4. **其余 429** → `QuotaLimited`,上游不给结构化恢复时间(`reset_at: None`, + /// 由 `mark_rate_limited` 给 10 分钟兜底); + /// 5. 其余 → 内容拦截分类(审核文案不罚账号)或原样透传。 + /// + /// 前两条的判据依据(上游真实报文)见 `errors.rs` 的模块头。 + fn classify_error(&self, status: u16, error_body: &Value) -> UpstreamErrorClass { + let raw = error_body + .get("message") + .or_else(|| error_body.get("Message")) + .and_then(Value::as_str) + .map(str::trim) + .filter(|text| !text.is_empty()) + .unwrap_or("上游错误"); + let upstream_code = error_body + .get("code") + .or_else(|| error_body.get("Code")) + .and_then(Value::as_i64); + let message = format!("上游返回 {status}: {raw}"); + let label = self.region.label(); + + if errors::is_insufficient_balance(status, raw) { + return UpstreamErrorClass::QuotaLimited { + reset_at: Some(errors::next_day_boundary_ms(logging::now_ms())), + message: format!( + "ModelScope {label}账号的魔粒已耗尽(上游:{raw}),将在下一个自然日\ + (北京时间 0 点)自动恢复;给账号充值后立即恢复" + ), + upstream_code, + status, + }; + } + if errors::is_unverified_account(status, raw) { + return UpstreamErrorClass::QuotaLimited { + reset_at: Some(errors::next_day_boundary_ms(logging::now_ms())), + message: format!( + "ModelScope {label}账号未完成邮箱验证,魔粒推理接口拒绝服务\ + (上游:{raw})——请到魔搭账号设置页完成邮箱验证,验证后次日自动恢复" + ), + upstream_code, + status, + }; + } + if status == 401 || status == 403 { + return UpstreamErrorClass::TokenExpired { message }; + } + if status == 429 { + return UpstreamErrorClass::QuotaLimited { + reset_at: None, + message, + upstream_code, + status, + }; + } + content_block::classify_or_fatal(status, error_body, message, upstream_code) + } + + /// 取可用令牌。本家**没有续期**:这里只做「记录里有没有令牌」的检查, + /// 服务端拒了就是 401,编排层会把它归成 `TokenExpired` 并在刷新失败后 + /// 如实报给客户端(「请重新粘贴令牌」)。 + fn ensure_access_token<'a>( + &'a self, + store: &'a AccountStore, + account_id: &'a str, + ) -> std::pin::Pin> + Send + 'a>> + { + let region = self.region; + Box::pin(async move { + let record = store.modelscope_account_record(region, account_id); + if !account_id.is_empty() && record.is_none() { + return Err(GatewayError::with_status( + 401, + format!( + "ModelScope {}账号 {account_id} 不存在(请重新添加)", + region.label() + ), + )); + } + let credentials = credentials::from_record(region, record.as_ref())?; + Ok(credentials.token) + }) + } + + /// 没有续期手段(上游没有 refresh 接口)——维护任务不问本家 + fn supports_refresh(&self) -> bool { + false + } + + /// 有远程目录(`GET {推理域}/models`,见 `models.rs`) + fn supports_model_refresh(&self) -> bool { + true + } + + /// 刷模型目录:用指定账号(空串 = 本家库里第一个可用账号)的令牌。 + /// + /// 「一个账号都没有」不是失败 —— 那是「用户还没添加账号」的正常状态, + /// 返回 `unchanged()`(与 Loomy / AutoClaw 在无登录态时的处置一致: + /// 脚本 / CI 不该看到一个红色失败)。 + fn refresh_models<'a>( + &'a self, + store: &'a AccountStore, + account_id: &'a str, + force: bool, + ) -> std::pin::Pin + Send + 'a>> { + let region = self.region; + Box::pin(async move { + let record = store.modelscope_account_record(region, account_id); + if record.is_none() { + if account_id.is_empty() { + crate::server::logging::verbose( + "[Models]", + &format!("ModelScope {}模型目录刷新跳过:尚未添加账号", region.label()), + ); + return ModelRefreshOutcome::unchanged(); + } + return ModelRefreshOutcome::failed("指定的账号不存在或不可用,请重新选择"); + } + let credentials = match credentials::from_record(region, record.as_ref()) { + Ok(credentials) => credentials, + Err(error) => return ModelRefreshOutcome::failed(error.message), + }; + models::refresh(region, &credentials.token, force).await + }) + } + + /// 有余额概念(魔粒钱包) + fn supports_usage(&self) -> bool { + true + } + + /// 查魔粒余额与今日已用调用数(见 `balance.rs`)。 + /// 401 由调用方走统一的「刷新后重试」链路 —— 本家刷新必失败,最终如实报重贴令牌。 + fn query_usage<'a>( + &'a self, + store: &'a AccountStore, + account_id: &'a str, + ) -> std::pin::Pin> + Send + 'a>> + { + let region = self.region; + Box::pin(async move { balance::query_usage(region, store, account_id).await }) + } +} + +#[cfg(test)] +mod tests { + use super::request_body; + use serde_json::json; + + /// 这是整个渠道最关键的一处注入:漏了它,非流式请求的 usage 恒为 0 + /// (实测依据见 `build_chat_request` 的说明) + #[test] + fn include_usage_is_injected() { + let body = json!({"model": "Qwen/Qwen3.8-Flash-Next", "stream": true}); + let out = request_body(&body); + assert_eq!( + out.pointer("/stream_options/include_usage").and_then(|v| v.as_bool()), + Some(true) + ); + // 其余字段原样保留 + assert_eq!(out.get("model").and_then(|v| v.as_str()), Some("Qwen/Qwen3.8-Flash-Next")); + assert_eq!(out.get("stream").and_then(|v| v.as_bool()), Some(true)); + // 调用方传进来的 body 不被就地改动(`build_chat_request` 拿的是借用) + assert!(body.get("stream_options").is_none()); + } + + /// 客户端自己写过 `stream_options` 时,只补 include_usage、不覆盖整个对象 + #[test] + fn other_stream_option_keys_survive() { + let out = request_body(&json!({"stream_options": {"custom_flag": 1}})); + assert_eq!(out.pointer("/stream_options/custom_flag").and_then(|v| v.as_i64()), Some(1)); + assert_eq!( + out.pointer("/stream_options/include_usage").and_then(|v| v.as_bool()), + Some(true) + ); + } + + /// 畸形 body(非对象)原样返回 —— 让上游去拒绝它,不在这一层报错 + #[test] + fn a_non_object_body_is_passed_through() { + assert_eq!(request_body(&json!(null)), json!(null)); + assert_eq!(request_body(&json!([1, 2])), json!([1, 2])); + } + + /// 错误分类的分支顺序:两条「账号级」判据必须先于裸 401/403 与裸 429 命中 + /// —— 顺序反了它们就会被归成「令牌失效」或「速率窗口」,各自的正确处置都丢。 + #[test] + fn classify_error_splits_account_level_failures_from_rate_windows() { + use crate::server::core::providers::adapter::{ProviderAdapter, UpstreamErrorClass}; + + let adapter = &super::MODELSCOPE_ADAPTER; + + // ① 魔粒耗尽(上游真实报文)→ 限流 + 冷却到明天(reset_at 必须给出来) + match adapter.classify_error(429, &json!({"message": "insufficient balance"})) { + UpstreamErrorClass::QuotaLimited { reset_at, status, .. } => { + assert_eq!(status, 429); + let reset_at = reset_at.expect("魔粒耗尽的冷却必须给到次日零点,不能是 None"); + assert!(reset_at > crate::server::logging::now_ms(), "冷却时刻必须在未来"); + } + other => panic!("魔粒耗尽应当归成限流,实际是 {other:?}"), + } + + // ② 未验证邮箱(上游真实文案的一段)→ 同样是次日冷却,**不是**「令牌失效」 + let unverified = json!({ + "message": "For account security, please complete your profile via email \ + verification. ModelScope Magicubes is only available to verified \ + accounts. Please refer to https://modelscope.cn/my/settings/account" + }); + match adapter.classify_error(403, &unverified) { + UpstreamErrorClass::QuotaLimited { reset_at, .. } => { + assert!(reset_at.is_some(), "未验证邮箱也要冷却到次日"); + } + other => panic!("未验证邮箱应当归成限流而不是令牌失效,实际是 {other:?}"), + } + + // ③ 裸 403(没有特征串)→ 令牌失效 + assert!(matches!( + adapter.classify_error(403, &json!({"message": "access forbidden"})), + UpstreamErrorClass::TokenExpired { .. } + )); + // 裸 401 同理 + assert!(matches!( + adapter.classify_error(401, &json!({"message": "unauthorized"})), + UpstreamErrorClass::TokenExpired { .. } + )); + + // ④ 普通 429(速率窗口)→ 限流且**不**给 reset_at(交给存储层 10 分钟兜底) + match adapter.classify_error(429, &json!({"message": "rate limit exceeded"})) { + UpstreamErrorClass::QuotaLimited { reset_at, .. } => { + assert!(reset_at.is_none(), "速率窗口不该被冷却到明天"); + } + other => panic!("速率窗口应当归成限流,实际是 {other:?}"), + } + + // ⑤ 「insufficient balance」配非 429 状态码时**不**走魔粒耗尽那条 + assert!(matches!( + adapter.classify_error(400, &json!({"message": "insufficient balance"})), + UpstreamErrorClass::Fatal { .. } | UpstreamErrorClass::ContentBlocked { .. } + )); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/models.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/models.rs new file mode 100644 index 00000000..c77ae80c --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/models.rs @@ -0,0 +1,222 @@ +//! ModelScope 模型目录:`GET {推理域}/models`(标准 OpenAI 形态)+ 持久化缓存。 +//! +//! ── 上游形态(2026-10-16 真实账号实测)────────────────────── +//! ```text +//! GET https://api-inference.modelscope.cn/v1/models Authorization: Bearer +//! → {"object":"list","data":[{"id":"Qwen/Qwen3.8-Flash-Next", +//! "object":"","owned_by":"system","created":1789…}, …]} +//! ``` +//! **只有 `id`**:没有 `name`、没有 `capabilities`、没有上下文长度 —— +//! 与 Loomy / MonkeyCode 那种带能力位的目录不同,这里能如实给出的只有 id 本身。 +//! +//! ── 清单是**账号相关**的(这是不做静态兜底表的理由)──────────── +//! 实测同一个令牌拉到的是 **36 条**,而不是魔搭全站的几千个模型 —— +//! 它给的是「这个账号在 API-Inference 上能调的模型」。 +//! 换句话说清单随账号变(免费额度、实名状态、地区都可能影响它), +//! 因此**编一份静态兜底表是有害的**:用户会看到一批自己其实调不通的模型, +//! 而目录的用途正是回答「我能用什么」。拉不到就如实报失败、保留旧清单 +//! —— 与 `loomy::models` 同一取舍。 +//! +//! ── 清单里混着非对话模型(照实列出,不筛)──────────────────── +//! 实测 36 条里含生图(`Qwen/Qwen-Image-Edit`)、基座(`PaddlePaddle/ERNIE-4.5-*-PT`) +//! 等并非 chat 用途的条目。上游给的就是它的清单,这里**不按 id 猜用途去过滤** —— +//! 猜错会把能用的模型藏起来(用户报「xxx 明明能用却不在列表里」比多几条调不通的 +//! 更难查)。真调不通时,`classify_error` 会把上游的 400 如实透出。 +//! +//! ── 两个地区两套缓存(拆成两个 provider 的核心收益之一)──────── +//! 缓存槽按 scope 分开(`catalog_cache::SCOPE_MODELSCOPE_CN` / `_INTL`), +//! 两个站的清单互不覆盖 —— 这正是当初把地区拆成两家 provider 要解决的问题 +//! (见 `region.rs` 的模块头)。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use std::sync::{Mutex, OnceLock}; + +use serde_json::{json, Value}; + +use crate::server::core::providers::adapter::ModelRefreshOutcome; +use crate::server::core::providers::catalog_cache; + +use super::client; +use super::region::Region; + +/// 模型列表路径(相对推理域) +pub const MODELS_PATH: &str = "/models"; + +/// 自动路径的缓存 TTL(与各家同档) +const TTL_MS: i64 = 10 * 60 * 1000; + +/// 进程内缓存(首次访问时从落盘缓存读回) +struct CatalogState { + models: Vec, + fetched_at: i64, +} + +/// 两个地区各一个槽(`OnceLock` 初始化,避免在 `static` 里做分配) +static STATE_CN: OnceLock>> = OnceLock::new(); +static STATE_INTL: OnceLock>> = OnceLock::new(); + +/// 本地区对应的落盘缓存 scope +fn scope_of(region: Region) -> &'static str { + match region { + Region::Cn => catalog_cache::SCOPE_MODELSCOPE_CN, + Region::Intl => catalog_cache::SCOPE_MODELSCOPE_INTL, + } +} + +/// 取本地区的状态句柄(毒锁按「上一个持有者 panic 过、数据可能半更新」处理: +/// 本项目的取值是「继续用」,因为这份缓存是可重建的展示数据,不值得让进程挂掉) +fn state(region: Region) -> &'static Mutex> { + match region { + Region::Cn => STATE_CN.get_or_init(|| Mutex::new(None)), + Region::Intl => STATE_INTL.get_or_init(|| Mutex::new(None)), + } +} + +/// 在锁内执行一段取值,并在首次访问时把落盘缓存装回内存 +fn with_state(region: Region, f: impl FnOnce(&mut Option) -> R) -> R { + let mutex = state(region); + let mut guard = mutex.lock().unwrap_or_else(|poisoned| poisoned.into_inner()); + if guard.is_none() { + if let Some(cached) = catalog_cache::load(scope_of(region)) { + *guard = Some(CatalogState { + models: cached.models, + fetched_at: cached.fetched_at, + }); + } + } + f(&mut guard) +} + +/// 把一个 OpenAI 目录条目映射成聚合层认的形态 +/// (键名对照 `core/models/shape.rs::list_item`:`id` / `name` / 能力位)。 +/// +/// 上游只给 `id`(实测),所以 `name` 就用 id 本身:魔搭的 id 是 +/// `组织/模型名`(`Qwen/Qwen3.8-Flash-Next`),它本身就是可读的展示名, +/// 拆掉组织段反而会让同名模型(不同组织的同名条目)在界面上无法区分。 +/// +/// 工具位按 OpenAI 兼容网关的既有能力给 true(照 `autoclaw::models` 的处置: +/// 缺失时保守回落)。**思考位不给** —— 上游没有能力位、按 id 猜会猜错 +/// (实测同一个模型既可能走 `reasoning_content` 也可能直接答), +/// 交给模型规则层由用户显式绑定更诚实。 +fn map_entry(row: &Value) -> Option { + let id = row + .get("id") + .and_then(Value::as_str) + .map(str::trim) + .filter(|value| !value.is_empty())?; + Some(json!({ + "id": id, + "name": id, + "supportsToolCall": true, + })) +} + +/// 解析 `/models` 响应(OpenAI `{data:[...]}` 或裸数组) +pub fn parse_models(payload: &Value) -> Vec { + let rows = payload + .get("data") + .and_then(Value::as_array) + .or_else(|| payload.as_array()) + .cloned() + .unwrap_or_default(); + rows.iter().filter_map(map_entry).collect() +} + +/// 本地区当前的模型清单(内存 → 落盘缓存;都没有时为空,由刷新路径填) +pub fn list(region: Region) -> Vec { + with_state(region, |slot| { + slot.as_ref().map(|state| state.models.clone()).unwrap_or_default() + }) +} + +/// 最近一次成功刷新的时刻(毫秒;没刷过为 0)—— 界面「更新日期」列读它 +pub fn last_refreshed_at(region: Region) -> i64 { + with_state(region, |slot| slot.as_ref().map(|state| state.fetched_at).unwrap_or(0)) +} + +/// 这份清单是否来自**远程拉取**(`catalog::refresh_meta` 的「来源」列判据)。 +/// 本家没有内置兜底清单:有内容就等于远程拉到过。 +pub fn remote_refreshed(region: Region) -> bool { + with_state(region, |slot| { + slot.as_ref().map(|state| !state.models.is_empty()).unwrap_or(false) + }) +} + +/// 拉一次模型目录并落地(内存 + 持久化缓存)。 +/// +/// `force = false`(自动路径)时 10 分钟 TTL 内早退为 `unchanged()`; +/// `force = true`(用户手动刷新)真打上游。 +pub async fn refresh(region: Region, token: &str, force: bool) -> ModelRefreshOutcome { + let now = crate::server::logging::now_ms(); + if !force { + let fresh = with_state(region, |slot| { + slot.as_ref() + .map(|state| !state.models.is_empty() && now - state.fetched_at < TTL_MS) + .unwrap_or(false) + }); + if fresh { + return ModelRefreshOutcome::unchanged(); + } + } + let payload = match client::inference_get(region, MODELS_PATH, token, "模型目录查询").await { + Ok(payload) => payload, + Err(error) => return ModelRefreshOutcome::failed(error.message), + }; + let models = parse_models(&payload); + if models.is_empty() { + return ModelRefreshOutcome::failed("ModelScope 模型目录为空或格式不认识(保留现有清单)"); + } + let count = models.len(); + with_state(region, |slot| { + *slot = Some(CatalogState { + models: models.clone(), + fetched_at: now, + }); + }); + catalog_cache::save(scope_of(region), &models, now); + ModelRefreshOutcome::refreshed(count) +} + +#[cfg(test)] +mod tests { + use super::{map_entry, parse_models}; + use serde_json::json; + + /// 上游的实测形态(只有 id)必须能过 + #[test] + fn the_measured_entry_shape_is_mapped() { + let item = map_entry(&json!({ + "id": "Qwen/Qwen3.8-Flash-Next", + "object": "", + "owned_by": "system", + "created": 1789 + })) + .unwrap_or_else(|| panic!("实测条目应当被映射")); + assert_eq!(item.get("id").and_then(|v| v.as_str()), Some("Qwen/Qwen3.8-Flash-Next")); + // 展示名保留组织段(同名不同组织的条目靠它区分) + assert_eq!(item.get("name").and_then(|v| v.as_str()), Some("Qwen/Qwen3.8-Flash-Next")); + assert_eq!(item.get("supportsToolCall").and_then(|v| v.as_bool()), Some(true)); + // 不给思考位:上游没有这个信息,按 id 猜会猜错 + assert!(item.get("supportsReasoning").is_none()); + } + + #[test] + fn entries_without_an_id_are_dropped() { + assert!(map_entry(&json!({"object": "model"})).is_none()); + assert!(map_entry(&json!({"id": " "})).is_none()); + assert!(map_entry(&json!({"id": 42})).is_none()); + } + + /// `{data:[…]}` 与裸数组两种形态都认(OpenAI 兼容实现的常见分歧) + #[test] + fn both_envelope_shapes_are_parsed() { + let wrapped = json!({"object": "list", "data": [{"id": "a"}, {"id": "b"}]}); + let bare = json!([{"id": "a"}, {"id": "b"}]); + assert_eq!(parse_models(&wrapped).len(), 2); + assert_eq!(parse_models(&bare).len(), 2); + assert!(parse_models(&json!({"data": []})).is_empty()); + assert!(parse_models(&json!(null)).is_empty()); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/probe.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/probe.rs new file mode 100644 index 00000000..fa8ed13e --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/probe.rs @@ -0,0 +1,165 @@ +//! 添加账号时的令牌探活:**一次调用拿两样东西** —— 令牌是否可用、账号是谁。 +//! +//! ── 为什么添加要出网(与本仓库多数家的「粘贴即落盘」不同)──────── +//! 魔搭的令牌**不携带任何可解析的身份**(它是一串不透明的 `ms-…`,不是 JWT)。 +//! 不出网的话只能拿令牌尾号当账号 id —— 同一个账号换一次令牌就会变成**两条记录**, +//! 用户看到「我明明只有一个魔搭账号,怎么越加越多」。 +//! 因此这里照 Qoder / OfficeAce 的既有处置:添加前先交换一次身份,用上游给的 +//! 稳定 id(`HavanaId`)做记录 id。 +//! +//! 顺带的两个好处: +//! 1. 令牌无效 / **不属于该站点**(国内令牌打国际站会 401 `access forbidden`) +//! 在添加的那一刻就说清楚,而不是等第一次转发才失败; +//! 2. 这次调用**同时触发当日签到**(见 `checkin.rs` 的模块头)—— +//! 添加账号的人当天就把魔粒拿到手。 +//! +//! ── 代价要说清 ────────────────────────────────────────────── +//! 探活失败(网络抖动、上游维护)会导致**添加不成功**。这是刻意的:本家 +//! 没有第二种「先落盘、以后再验证」的路径,半个账号(有记录、身份是猜的) +//! 比一条明确的失败更难收拾。错误文案会把上游原话带出来,用户知道该重试。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use serde_json::Value; + +use crate::server::errors::GatewayError; + +use super::checkin::LOGIN_INFO_PATH; +use super::client; +use super::region::Region; + +/// 上游给的账号身份(添加账号时用来生成 id 与默认备注名)。 +#[derive(Clone, Debug)] +pub struct Identity { + /// 稳定身份(`HavanaId`);拿不到时为空串 + pub user_id: String, + /// 展示名(`NickName` → `Name`);拿不到时为空串 + pub display_name: String, +} + +impl Identity { + /// 有没有拿到稳定身份(拿不到时 `add_modelscope_account` 会拒绝这条添加) + pub fn has_user_id(&self) -> bool { + !self.user_id.trim().is_empty() + } +} + +/// 从登录信息响应里读出身份。 +/// +/// 大写(`HavanaId` / `NickName` / `Name`)与小写变体都认 —— 上游自己没统一 +/// 大小写(见 `client.rs` 的模块头),多认一种写法不会出错,少认一种会让 +/// 「加上但身份为空」变成一个难查的静默问题。 +pub fn parse_identity(payload: &Value) -> Identity { + let data = client::data_of(payload); + let pick = |keys: &[&str]| -> String { + for key in keys { + let value = data + .get(*key) + .and_then(Value::as_str) + .map(str::trim) + .unwrap_or(""); + if !value.is_empty() { + return value.to_string(); + } + } + String::new() + }; + // `HavanaId` 实测是**字符串**(`"2220378210908"`),但数字形态也容忍 + let user_id = { + let from_str = pick(&["HavanaId", "havanaId", "havana_id", "userId", "user_id"]); + if !from_str.is_empty() { + from_str + } else { + data.get("HavanaId") + .and_then(Value::as_i64) + .map(|value| value.to_string()) + .unwrap_or_default() + } + }; + Identity { + user_id, + display_name: pick(&["NickName", "FirstName", "Name", "nickname", "name"]), + } +} + +/// 用令牌探一次身份(同时也是当日签到,见模块头)。 +pub async fn identify(region: Region, token: &str) -> Result { + let payload = client::site_get(region, LOGIN_INFO_PATH, token, "令牌校验").await?; + if !client::succeeded(&payload) { + let message = client::message_of(&payload); + return Err(GatewayError::with_status( + 400, + if message.trim().is_empty() { + format!("ModelScope 令牌校验失败(上游 Code={})", client::code_of(&payload)) + } else { + format!("ModelScope 令牌校验失败:{message}") + }, + )); + } + let identity = parse_identity(&payload); + if !identity.has_user_id() { + // 读不到身份时不放行:拿令牌尾号当 id 会让同一账号越加越多(见模块头), + // 宁可让用户看到一条明确的失败 + return Err(GatewayError::with_status( + 400, + format!( + "ModelScope 令牌校验通过但读不到账号身份(HavanaId)——可能上游改了响应形态,\ + 请把这次响应反馈给开发者;{}站点的令牌才有效", + region.label() + ), + )); + } + Ok(identity) +} + +#[cfg(test)] +mod tests { + use super::parse_identity; + use serde_json::json; + + /// 实测形态(2026-10-16 国内站) + #[test] + fn the_measured_shape_is_parsed() { + let payload = json!({ + "Code": 200, + "Success": true, + "Data": { + "Avatar": "https://img.alicdn.com/…", + "Email": "someone@example.com", + "HavanaId": "2220378210908", + "Name": "taotao0918", + "NickName": "taotao0918", + "is_real_name": true + } + }); + let identity = parse_identity(&payload); + assert_eq!(identity.user_id, "2220378210908"); + // 昵称优先于登录名 + assert_eq!(identity.display_name, "taotao0918"); + assert!(identity.has_user_id()); + } + + /// `HavanaId` 是数字形态时也要读出来 + #[test] + fn a_numeric_havana_id_is_accepted() { + let payload = json!({"Data": {"HavanaId": 2220378210908i64, "Name": "x"}}); + assert_eq!(parse_identity(&payload).user_id, "2220378210908"); + } + + /// 只有登录名、没有昵称时回落到登录名 + #[test] + fn the_login_name_is_the_fallback_display_name() { + let payload = json!({"Data": {"HavanaId": "1", "Name": "fallback"}}); + assert_eq!(parse_identity(&payload).display_name, "fallback"); + } + + /// 什么都没有时是「无身份」——调用方据此拒绝添加 + #[test] + fn a_payload_without_identity_reports_none() { + let payload = json!({"Code": 200, "Success": true, "Data": {}}); + let identity = parse_identity(&payload); + assert!(!identity.has_user_id()); + assert!(identity.display_name.is_empty()); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/region.rs b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/region.rs new file mode 100644 index 00000000..7e08307d --- /dev/null +++ b/desktop-tauri/src-tauri/server/src/server/core/providers/modelscope/region.rs @@ -0,0 +1,179 @@ +//! ModelScope(魔搭)的**地区**(国内站 / 国际站):两套域名与两条 provider 身份。 +//! +//! ── 上游长什么样(2026-10-16 实测,来源:CPA 的 modelscope-ratelimit 插件 +//! 源码 `D:\GitHub\modelscope-ratelimit` + 真实账号 curl 验证)────── +//! 魔搭是**两个站点各一套账号体系**,同一份协议、不同的域: +//! +//! ```text +//! 推理(OpenAI 兼容) 网页站(身份 / 魔粒 / 签到) +//! 国内 https://api-inference.modelscope.cn/v1 https://modelscope.cn +//! 国际 https://api-inference.modelscope.ai/v1 https://www.modelscope.ai +//! ``` +//! +//! ── 一处**实测确认**的关键事实:一个 `ms-` key 两用 ──────────── +//! 同一个 `ms-...` 令牌既作 `Authorization: Bearer` 调推理,又作 +//! `Cookie: m_session_id=` 调网页站的身份 / 魔粒接口 —— 两条链路都实测 200。 +//! 插件源码的注释也这么写(「session 就是 api key 本身……永不过期」)。 +//! 因此本家**只有一个凭证字段**,不需要像 CodeArts / OfficeAce 那样分两层。 +//! +//! ── 另一处实测确认:**两个站点的账号体系是分开的** ────────────── +//! 用国内站的 key 打 `https://www.modelscope.ai/api/v1/users/login/info` +//! 得到 `401 {"Code":10019901001,"Message":"access forbidden"}`;反过来同理。 +//! 而**推理端点两地都能用同一个 key 打通**(模型网关的 key 是账号级的、不分站)。 +//! 所以「地区」在本家不是可有可无的标签:**签到与魔粒必须打对站点**, +//! 打错了拿到的是一个必然失败的结果。 +//! +//! ── 为什么是两个 provider 而不是「一家的一个选项」(与 AutoClaw / ZCode 同一思路)── +//! 地区做成「账号上的一个字段」的后果与本仓库已修过数次的那类缺陷相同: +//! 地区成了**账号的属性**,界面上混在一起、账号记录也无法按站隔离; +//! 更要紧的是模型目录只有一份(单槽缓存 + 单条刷新排期),两个站的清单会互相覆盖。 +//! 拆成两个 provider 后各家有独立的账号、清单、启停与映射, +//! 界面上各占一个分组、在添加弹窗里相邻。 +//! +//! ── provider id 的取值 ────────────────────────────────────── +//! 本家是**全新接入**(没有任何存量账号),所以两个 id 都是新名字、 +//! 不需要像 AutoClaw 那样为存量数据保留裸 id: +//! `modelscope`(国内)与 `modelscope-intl`(国际)。 +//! +//! ── 为什么没有环境变量覆盖(与本仓库其余几家不同)────────────── +//! 别家做覆盖是历史原因(域名的多来源、代理调试、客户端内置值可被官方换掉)。 +//! 魔搭这两个域名是**硬编码在官方 SDK / 客户端里的**、2026-10 实测稳定, +//! 为它们加一层 `MODELSCOPE_*_BASE_URL` 只是多一条没人会用的分支(KISS)。 +//! 真要换域名时,改本文件的两处常量比找环境变量更直接。 +//! +//! ── 硬约束 ────────────────────────────────────────────────── +//! release 是 `panic=abort`:本文件零 unwrap/expect/panic。 + +use crate::server::core::providers::{kind_id, ProviderKind}; + +/// ModelScope 的地区。 +/// +/// 顺序 = 注册表顺序(国内版在前):`ALL` 的遍历顺序决定模型目录合并时同名模型 +/// 先归谁家、以及界面上两家的先后。**国内版在前**(用户直觉里「魔搭就是国内那个站」, +/// 与 MonkeyCode / ZCode 同一处置)。 +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)] +pub enum Region { + /// 国内站(`modelscope.cn`;provider id `modelscope`) + #[default] + Cn, + /// 国际站(`www.modelscope.ai`;provider id `modelscope-intl`) + Intl, +} + +impl Region { + /// 两个地区(注册表顺序:国内版在前) + pub const ALL: [Region; 2] = [Region::Cn, Region::Intl]; + + /// 本地区对应哪个 provider kind(地区 → 身份的**唯一**映射) + pub fn kind(self) -> ProviderKind { + match self { + Self::Cn => ProviderKind::Modelscope, + Self::Intl => ProviderKind::ModelscopeIntl, + } + } + + /// 本地区的 provider id(`"modelscope"` / `"modelscope-intl"`) + pub fn provider_id(self) -> &'static str { + kind_id(self.kind()) + } + + /// provider id → 地区(本家之外的 id 返回 None) + pub fn from_provider_id(provider_id: &str) -> Option { + Self::ALL + .into_iter() + .find(|region| region.provider_id() == provider_id) + } + + /// 这个 kind 是不是本家(两家都算)—— 判据只在这里写一份 + pub fn from_kind(kind: ProviderKind) -> Option { + Self::ALL.into_iter().find(|region| region.kind() == kind) + } + + /// 展示名(界面上跟在 `ModelScope` 后面的那一段) + pub fn label(self) -> &'static str { + match self { + Self::Cn => "国内版", + Self::Intl => "国际版", + } + } + + /// 推理基址(**含** `api-inference` 主机与尾部的 `/v1`)。 + /// + /// `build_chat_request` 在它后面拼 `/chat/completions`, + /// `models.rs` 在它后面拼 `/models` —— 两处都不要再写域名。 + pub fn inference_base_url(self) -> &'static str { + match self { + Self::Cn => "https://api-inference.modelscope.cn/v1", + Self::Intl => "https://api-inference.modelscope.ai/v1", + } + } + + /// 网页站基址(身份 / 魔粒余额 / 今日用量 / 签到都在这个域下,**不带尾部斜杠**)。 + /// + /// 国际站用 `www.` 前缀(实测 `modelscope.ai` 的接口挂在 `www` 主机上, + /// 与插件源码的 `siteBaseFromURL` 同款判定)。 + pub fn site_base_url(self) -> &'static str { + match self { + Self::Cn => "https://modelscope.cn", + Self::Intl => "https://www.modelscope.ai", + } + } + + /// 本地区账号记录 id 的**前缀**(id 生成用)。 + /// + /// 两地带前缀的理由与 AutoClaw 国际版那一节相同:两站的身份 id 空间互不相通, + /// 但**同一个人在两地的 `HavanaId` 完全可能相同**(各自注册,服务端 id 生成 + /// 规则同形就会撞)。撞了的话存储层现有的跨 provider 撞 id 保护会直接报错拒绝, + /// 「两地账号并存」就变得不可能 —— 而并存正是本功能的意义之一。 + /// + /// 本家没有存量账号,所以国内版**不必**保持裸 id,两家都带前缀(Cline 同款)。 + pub fn account_id_prefix(self) -> &'static str { + match self { + Self::Cn => "modelscope-", + Self::Intl => "modelscope-intl-", + } + } +} + +#[cfg(test)] +mod tests { + use super::Region; + + /// 两条身份必须与注册表里的 id 逐字对上 —— 对不上的话 `adapter_for` 会返回 + /// 错误的适配器实例(转发打到另一个站点),而这是编译期看不出来的。 + #[test] + fn region_ids_match_the_expected_literals() { + assert_eq!(Region::Cn.provider_id(), "modelscope"); + assert_eq!(Region::Intl.provider_id(), "modelscope-intl"); + } + + /// 互查是双射:id → region → id 必须回到原值 + #[test] + fn region_lookup_round_trips() { + for region in Region::ALL { + assert_eq!(Region::from_provider_id(region.provider_id()), Some(region)); + assert_eq!(Region::from_kind(region.kind()), Some(region)); + } + assert_eq!(Region::from_provider_id("loomy"), None); + } + + /// 两个站点的域名必须**不同** —— 写重了会让两地账号实际打到同一个站, + /// 是「看起来支持两地区、实际只有一家」的静默失效。 + #[test] + fn the_two_regions_do_not_share_a_host() { + assert_ne!(Region::Cn.inference_base_url(), Region::Intl.inference_base_url()); + assert_ne!(Region::Cn.site_base_url(), Region::Intl.site_base_url()); + } + + /// 账号 id 前缀必须**不同** —— 相同的话同一身份在两地的记录会生成同一个 id, + /// 第二个添加的账号会撞上存储层的跨 provider 保护而加不进来。 + /// + /// 注意这里**不**断言「互不为前缀」:`modelscope-intl-` 本就以 `modelscope-` + /// 开头(Cline 的两个池同款)。判「是不是 ModelScope 系」一律走 + /// `Region::from_provider_id`,绝不要用 `starts_with` 前缀判据 —— 那会把国际版 + /// 误算进国内版。 + #[test] + fn account_id_prefixes_are_distinct() { + assert_ne!(Region::Cn.account_id_prefix(), Region::Intl.account_id_prefix()); + } +} \ No newline at end of file diff --git a/desktop-tauri/src-tauri/server/src/server/core/upstream/provider_loop.rs b/desktop-tauri/src-tauri/server/src/server/core/upstream/provider_loop.rs index af45a920..6c8fe4a8 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/upstream/provider_loop.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/upstream/provider_loop.rs @@ -95,7 +95,8 @@ use super::request::{read_upstream_error, send_chat_request, TransportRequest}; use super::usage::LogPhase; use super::{ account_display, account_label, cancellation, connections::ConnectionGuard, describe_proxy, - refusal, reset_hint, rotate, ForwardOutcome, InFlightGuard, RouteTarget, UpstreamService, + format_reset_text, refusal, reset_hint, rotate, ForwardOutcome, InFlightGuard, RouteTarget, + UpstreamService, MAX_ROUTE_ATTEMPTS, }; @@ -1374,8 +1375,28 @@ async fn attempt_queue( continue 'accounts; } None => { + // 所有候选都在冷却 / 禁用里 —— 把**最早的恢复时刻** + // 带进文案:客户端(Claude Code / Codex 等会读这条 + // 文案的)才能做合法的退避等待,而不是立刻重试再撞 + // 一次同样的墙。取不到(缓存里没有未来时刻)时退回 + // 原句,逐字与改造前相同。 + let earliest_reset = rotate::earliest_limit_reset_at( + service, + provider_ids, + &cooldown_keys, + ); + let wait_hint = if earliest_reset > 0 { + let text = format_reset_text(earliest_reset as f64); + if text.is_empty() { + String::new() + } else { + format!(",最早 {text} 恢复") + } + } else { + String::new() + }; let message = format!( - "{}(所有候选账号对模型 {model} 均已限额或禁用)", + "{}(所有候选账号对模型 {model} 均已限额或禁用{wait_hint})", failure.error.message ); rotate::report_limit_event( diff --git a/desktop-tauri/src-tauri/server/src/server/core/upstream/rotate.rs b/desktop-tauri/src-tauri/server/src/server/core/upstream/rotate.rs index f0dc5695..f3d59ae5 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/upstream/rotate.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/upstream/rotate.rs @@ -479,6 +479,61 @@ pub(super) fn account_limit_reset_at(service: &UpstreamService, account_id: &str .unwrap_or(0) } +/// 候选中**最早**的限额恢复时间戳(毫秒;一个都没有时 0)。 +/// +/// ── 用途:把「还要等多久」告诉客户端 ──────────────────────── +/// 所有候选账号都被限流时,编排层给客户端的错误文案里带上这个时刻 +/// (`provider_loop` 的「均已限额或禁用」分支)。不带的话客户端只能立刻 +/// 重试、再撞一次同样的墙;带上之后(Claude Code / Codex 这类客户端会读 +/// 文案里的时间)才能做**合法的退避等待**。 +/// +/// ── 为什么取**最早**的而不是最晚的 ───────────────────────── +/// 「最早」= 第一个可能恢复、值得再试的时刻。取最晚会让客户端多睡一段 +/// 本不必睡的时间(账号是逐个恢复的,不是同时)。 +/// +/// ── 为什么读记录而不读内存 ────────────────────────────────── +/// 与 `account_limit_reset_at` 同源(都从账号记录现读):限额是**落盘事实** +/// (重启后仍在),内存里那份不进这里 —— 两处口径一致才不会出现「日志说 +/// 10 分钟后恢复、实际记录里是明天零点」的分歧。 +/// +/// `providers` 是本次请求的候选家;冷却键按 [`routing::CooldownKeys`] 解析 +/// (与写入侧同一个键)。**启用中的账号全都算**,包括本轮已经撞过的那几个 —— +/// 它们刚被标记,恢复时刻正是客户端最该等的那个。 +/// +/// `accounts_in_providers` 只按 provider 过滤、**不过滤禁用账号**(那是选路 +/// 层的事),所以这里自己剔一遍:一个被禁用的账号即便留着未过期的冷却记录也 +/// 不算候选,报它的恢复时刻会把用户引向一个系统根本不会去的账号。 +pub(super) fn earliest_limit_reset_at( + service: &UpstreamService, + providers: &[&str], + keys: &routing::CooldownKeys<'_>, +) -> i64 { + let now = logging::now_ms(); + let accounts: Vec = accounts_in_providers(service, providers, None) + .into_iter() + .filter(|account| !matches!(account.get("enabled"), Some(Value::Bool(false)))) + .collect(); + earliest_limit_reset_at_in(&accounts, keys, now) +} + +/// [`earliest_limit_reset_at`] 的纯函数内核(账号清单与「现在」都由调用方给, +/// 便于单测直接覆盖排序语义)。 +/// +/// 过期的冷却不必再筛:`rate_limit_reset_at` 只回**未来**时刻或 0 +/// (见那里的说明),所以这里直接对非零值取最小。 +fn earliest_limit_reset_at_in( + accounts: &[Value], + keys: &routing::CooldownKeys<'_>, + now: i64, +) -> i64 { + accounts + .iter() + .map(|account| routing::rate_limit_reset_at(account, keys, now)) + .filter(|reset| *reset > 0) + .min() + .unwrap_or(0) +} + /// 全部账号达到并发上限时的**挤占**挑选:余量(`limit - count`)最大者优先。 /// /// ── 排序口径(任务约定,改动前先读)────────────────────────── @@ -721,3 +776,85 @@ pub(super) fn report_limit_event( })), ); } + +#[cfg(test)] +mod tests { + use super::earliest_limit_reset_at_in; + use crate::server::core::routing::CooldownKeys; + use serde_json::json; + + /// 造一条带限额冷却的账号记录(形状与 `mark_rate_limited` 落盘的一致) + fn limited(id: &str, provider: &str, model: &str, reset_at: i64) -> serde_json::Value { + json!({ + "id": id, + "provider": provider, + "enabled": true, + "rateLimits": { model: { "status": 429, "resetAt": reset_at } }, + }) + } + + fn unlimited(id: &str, provider: &str) -> serde_json::Value { + json!({ "id": id, "provider": provider, "enabled": true }) + } + + /// 取**最早**的恢复时刻(不是最晚):客户端该睡到第一个可能恢复的点 + #[test] + fn the_earliest_reset_wins() { + let keys = CooldownKeys::new("Qwen/Qwen3.8-Flash-Next"); + let now = 1_000_000i64; + let accounts = vec![ + limited("a", "modelscope", "Qwen/Qwen3.8-Flash-Next", now + 600_000), + limited("b", "modelscope", "Qwen/Qwen3.8-Flash-Next", now + 60_000), + limited("c", "modelscope", "Qwen/Qwen3.8-Flash-Next", now + 300_000), + ]; + assert_eq!(earliest_limit_reset_at_in(&accounts, &keys, now), now + 60_000); + } + + /// 没有处在冷却期的账号 → 0(调用方据此退回原句,不拼「最早…恢复」) + #[test] + fn no_future_reset_reports_zero() { + let keys = CooldownKeys::new("m"); + let now = 1_000_000i64; + assert_eq!(earliest_limit_reset_at_in(&[], &keys, now), 0); + assert_eq!( + earliest_limit_reset_at_in(&[unlimited("a", "modelscope")], &keys, now), + 0 + ); + } + + /// **已过期**的冷却不算数(记录还在但时刻已过 = 未限额,与 + /// `rate_limit_reset_at` 的口径一致)——算进去会让文案报一个过去的时刻 + #[test] + fn an_expired_cooldown_is_not_counted() { + let keys = CooldownKeys::new("m"); + let now = 1_000_000i64; + let accounts = vec![ + limited("a", "modelscope", "m", now - 1), + limited("b", "modelscope", "m", now), + ]; + assert_eq!(earliest_limit_reset_at_in(&accounts, &keys, now), 0); + } + + /// 冷却**按模型**分键:别的模型的冷却不该影响本模型的「还要等多久」 + #[test] + fn another_models_cooldown_is_ignored() { + let keys = CooldownKeys::new("m"); + let now = 1_000_000i64; + let accounts = vec![limited("a", "modelscope", "other-model", now + 600_000)]; + assert_eq!(earliest_limit_reset_at_in(&accounts, &keys, now), 0); + } + + /// 多账号时取全体最早(这条覆盖的是「取 min 而不是取第一个」) + #[test] + fn the_minimum_spans_all_accounts() { + let keys = CooldownKeys::new("m"); + let now = 1_000_000i64; + let accounts = vec![ + limited("a", "modelscope", "m", now + 900_000), + unlimited("b", "modelscope"), + limited("c", "modelscope", "m", now + 120_000), + limited("d", "modelscope-intl", "m", now + 500_000), + ]; + assert_eq!(earliest_limit_reset_at_in(&accounts, &keys, now), now + 120_000); + } +} diff --git a/desktop-tauri/ui-islands/src/islands/accounts-domain.ts b/desktop-tauri/ui-islands/src/islands/accounts-domain.ts index a5c713da..057ef080 100644 --- a/desktop-tauri/ui-islands/src/islands/accounts-domain.ts +++ b/desktop-tauri/ui-islands/src/islands/accounts-domain.ts @@ -234,6 +234,20 @@ const PROVIDER_FEATURES: Record = { // `expiry: ''` —— refresh token 不过期、access token 自动续期,这一列对它没有可显示的事实 // (与 kuku 同一处置:界面不渲染「有效期」)。 antigravity: { usage: true, edition: false, identifier: 'userId', expiry: '' }, + // ModelScope(魔搭)的两个站点(`modelscope` / `modelscope-intl`):两条同一份 + // —— 账号字段、余额形态、签到链路两地完全一致,差别只在域名(那是转发与 + // 凭证层的事,这里不体现)。 + // `usage: true` —— 额度是魔粒钱包(`available_balance`),外加「今日已用调用数」 + // 一行,见后端 providers::modelscope::balance;`creditDetail: true` 让余额格 + // 挂出「积分明细」(可用 / 冻结 / 今日已用三行)。 + // `edition: false` —— 地区由 provider id 直接表达(两家 provider、两个分组), + // 不需要再渲染一个地区列。 + // `identifier: 'userId'` —— 身份键存的是上游的 HavanaId + // (见 account_store::modelscope_accounts 模块头)。 + // `expiry: ''` —— 令牌不过期、也没有过期时刻可算,这一列对它没有可显示的事实 + // (与 kuku / antigravity 同一处置:界面不渲染「有效期」)。 + modelscope: { usage: true, creditDetail: true, edition: false, identifier: 'userId', expiry: '' }, + 'modelscope-intl': { usage: true, creditDetail: true, edition: false, identifier: 'userId', expiry: '' }, } /** diff --git a/desktop-tauri/ui-islands/src/islands/add-account-configs.ts b/desktop-tauri/ui-islands/src/islands/add-account-configs.ts index be3caa83..ac773e3c 100644 --- a/desktop-tauri/ui-islands/src/islands/add-account-configs.ts +++ b/desktop-tauri/ui-islands/src/islands/add-account-configs.ts @@ -756,6 +756,64 @@ const ORCATERM: ProviderConfig = { ], } +/** + * ModelScope(魔搭)的两个站点:一家一个 provider,粘贴 `ms-` 令牌。 + * + * ── 一枚令牌两用(这是本家最省事的地方)────────────────────── + * 同一个 `ms-` 令牌既作 `Authorization: Bearer` 调推理,又作 + * `Cookie: m_session_id=<令牌>` 读账号身份 / 魔粒余额 / 每日签到(实测确认)。 + * 所以凭据只有一个字段,用户从魔搭的「访问令牌」页复制一次就够。 + * + * ── 两个站点是两套独立账号 ───────────────────────────────── + * 国内站(modelscope.cn)与国际站(modelscope.ai)账号体系分开:令牌打错站点 + * 会得到 401,所以两家各一张卡、各填各的令牌。 + * + * ── 没有续期、没有桌面端导入 ─────────────────────────────── + * 令牌长期有效(上游没有 refresh 接口),失效只能重新获取;魔搭没有桌面客户端 + * (与 Loomy / MonkeyCode 同一处境),因此不渲染「导入桌面端登录态」。 + * + * ── 添加时的一次探活(会拦下添加)────────────────────────── + * 令牌不透明、解不出身份,所以网关添加前必须打一次上游换回账号身份 —— + * 令牌无效 / 站点点错会在添加的那一刻就说清楚,而不是等第一次转发才失败。 + */ +function modelscopeForm(spec: { + provider: string + label: string + site: string + siteNote: string +}): ProviderConfig { + const { provider, label, site, siteNote } = spec + return { + provider, + label, + // 没有桌面客户端,也就没有可导入的登录态文件(理由见上方注释) + desktop: false, + manualTitle: t('粘贴 API 令牌'), + // 整段是一个 t() 键:扫描器只认字符串字面量(拼接串提不到键),所以不拆行 + manualNoteHtml: t('粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
{siteNote}
这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。', { site, siteNote }), + fields: [ + // 字段名不包 t()(各语言相同,与别家同一处置) + { key: 'accessToken', label: 'accessToken', rows: 3, placeholder: t('ms- 开头的 API 令牌') }, + { key: 'name', label: t('备注名'), optional: true, placeholder: t('可选,留空则用上游账号昵称') }, + ], + } +} + +const MODELSCOPE = modelscopeForm({ + provider: 'modelscope', + label: t('ModelScope 国内版'), + site: 'modelscope.cn', + siteNote: t('这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。'), +}) + +const MODELSCOPE_INTL = modelscopeForm({ + provider: 'modelscope-intl', + label: t('ModelScope 国际版'), + site: 'modelscope.ai', + siteNote: t('这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。'), +}) + + /** 内置家的表单块,顺序与旧 ADD_FORMS 一致(只影响 DOM 里的块顺序,不影响界面) */ export const BUILTIN_CONFIGS: ProviderConfig[] = [ RACCOON, @@ -800,6 +858,11 @@ export const BUILTIN_CONFIGS: ProviderConfig[] = [ // OrcaTerm(腾讯云遨驰终端桌面客户端):粘贴 accessToken / 导入桌面端登录态, // 排在末尾(与后端注册表 PROVIDERS 的排列一致,2026-10 接入) ORCATERM, + // ModelScope(魔搭)的两个站点相邻(与 AutoClaw / Qoder / MonkeyCode 同一拆法): + // 国内版在前 —— 与后端注册表 PROVIDERS 的追加顺序一致(2026-10 接入) + MODELSCOPE, + MODELSCOPE_INTL, + ] /** WorkBuddy 的块 id(结构特殊,单独一个组件) */ diff --git a/desktop-tauri/ui-islands/src/islands/add-provider-pick.tsx b/desktop-tauri/ui-islands/src/islands/add-provider-pick.tsx index e069b2f5..8ab73215 100644 --- a/desktop-tauri/ui-islands/src/islands/add-provider-pick.tsx +++ b/desktop-tauri/ui-islands/src/islands/add-provider-pick.tsx @@ -99,6 +99,11 @@ export const PROVIDER_ICONS: Record = { // (`cloudcache.tencent-cloud.com/qcloud/orcaterm/pwa/icon/orcaterm_192x192.png`, // 与客户端 / 官网显示的应用图标为同一形象) orcaterm: 'assets/providers/orcaterm.png', + // ModelScope(魔搭):取自官网 favicon(`https://modelscope.cn/favicon.ico`, + // 内含 128×128 的一帧,归一成 256×256 入库 —— 与站点标签页上显示的是同一形象; + // 国内 / 国际版共用这一张,同 AutoClaw / MonkeyCode 的形态) + modelscope: 'assets/providers/modelscope.png', + 'modelscope-intl': 'assets/providers/modelscope.png', } /** diff --git a/desktop-tauri/ui-islands/src/islands/checkin-page.tsx b/desktop-tauri/ui-islands/src/islands/checkin-page.tsx index b2801b40..e512fa0e 100644 --- a/desktop-tauri/ui-islands/src/islands/checkin-page.tsx +++ b/desktop-tauri/ui-islands/src/islands/checkin-page.tsx @@ -57,6 +57,10 @@ const PROVIDER_DESC: Record = { // 它执行的是 ops 活动交付(三个接口),一句话说明里点出这一点,用户才不会 // 拿它跟别家「一次请求」的签到比快慢。 codearts: t('每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置'), + // ModelScope(魔搭)的两个站点:签到就是调一次登录信息接口(调用即触发 + // 当日魔粒),没有独立的签到按钮 —— 说明里点出这一点,用户才不会以为漏了什么。 + modelscope: t('无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)'), + 'modelscope-intl': t('与国内版同一套链路 · 站点不同、令牌不通用'), } /** 页内标签页的档位(值与 checkin-state 的 CheckinTab 一致) */ diff --git a/desktop-tauri/ui/assets/providers/modelscope.png b/desktop-tauri/ui/assets/providers/modelscope.png new file mode 100644 index 0000000000000000000000000000000000000000..308b1cf1d3f54ea18c7bfda81539ba92fb4a317b GIT binary patch literal 10280 zcmd6N^;;ZGw`~stgG++jKnMvW1PktilLVIp8*FeVxVr?G;O@Z_+}(n^Tae)He)4|z z%{kANKj8k-)m_!KYwvniKdbky^+jG*5*vdI0{{T*cT!@C008=P3j)v}e;Uot-wXkO z?(m(Mu(DIie(G%80%vr9uUg0jy!y@jxPw)X(eF~`O~T)-zx|C$>xXNJ8|F`F%(M$> zRbqo}Jphmob>dGHX;%M7zWnN9X(nnsG-NNK;Kzruasm+v#XLa~1#|9>yvLqH1~bpN zu!#6wA!v)x17CA+*6!=wX@y0jv-;cIucvdj@0(=r)Rd{p!i$(|TRy=znHM)dSy(;y zTkm`bYz9PrXNGz>*ez=0@AA?_WVG>L3gdc3hGwF|96}>#^;IOG@1I}%IH+JO3$w%8 z0^vooo&jh-z1oMFCjPu5)ja~H&iNE^9n}e?`FFHe_N+6E(Bh}8d@-DKhQlFk{`t3q zhTVJtPy6!&-Vohs$-fIEmtLRFR@V|7f4OmgUp8L0-*b7oGk)L_!n%tzw>2lCP+!)5 zz>)FqGUGFqYRt#KY`@qSFHf^@I%H`R{^JUX3*hG#>WcYQ{mrwx#pVbo@JvmCitLYH z{WwUp5FhSm23h^*yC@6C{aa%5OtEt==-D*-WvyBt&$a(d)yEP5L|*Q%S*0J!H3Vji z{JbUF$dJJh-Tm+A{D0k7<2@=-{S&JK!ybgncxFC((N{68=CS2;WVh_oW6r-}t^1biLR-u@ zsY5~1UjI&UTdy?Rw(txQ9koG%3*j|s~iimxq6+i&%;0mpH&vM>Up@W-o%Ntmt6lHDM`|shi_sd;UVX#kWS|AuDrX%dH z&o1%?XzKN{Hlu76QU3ofzQ@^wfE?G>t+|tbMyYnoIOoR>Yps?e1fPL8>5*ec)BN8j z(vQ7rZ3o8pZ7G3gv;V|sad5cYz2vomw}ijV{pQb>z72o^v#c&dEteGi#9?jDu9Ypv z+fF`9=}gd&o^=Fd~JZfXAo zn?7*Ne{**Oh+aUH8^DvcGj{g>f{m83fa5-T_Y_w^TjB9CkI*?eVCQ(H@erlU6@2#+ zvVXj5R7eDI*z>kN%>H*d=P}g|ZS#%VSjC7(SkLD3`t~bwVx;20zZ*W|@u>HkM2s{w zH=oRUy7{5tk0ljxUhwFWmyCc1znc7BG)QVA)g2Ae9V{gUU+in)JR^x&`V`8SW|Gc# zv=?syQ0tK8N@>(H%9nh+hqJvM#lz~5ny)j`W*8oY=qN#G)NX&ALPZb15AGfoP`Nh7 zwfx}w{zK2^zTQim9N5$37pM_(EWAfPrlRK{yi%{P3`chf?^+{*+g0ubfP(BU z_?qHHK6X1*Z4!h}qja(c{IGz~0gdd=FB8|ip$E156SKyHW+tS2Q#EM2}EHMi{s#kU0i6m?LN!70KS&)dS9;cCycX2Rj}Re z4bBtIpuZUcT1PTlmm{4r@9556osD6j8u7$IwBW5hMcna;q&#b%GMhqkY&8<=?uP8z?);73iD ziKPiXalTPq-!CY^jY)IuKy15$Z>}#ay!+V!%RR^K^4@su5Vv#JUG%NTc&yUi1?s2Z!icy2IkPIwp{hdJ2ov-Wz8Cqdn5L9aL4!{KnDuF6SnM;8PWy$>2`SHuB|h98X=t*sFQt%~7$Fo9B} zLR4!HEiwcy_-M!9y?T{@zK{{%HIrvf_*?*? z?qttmpqaJ|)@=HP)tbgQ@`4;7DQ(9Fv4nbKHgxX7UpsXZGpk=dc9--5#bZu@DEz*B zVGp!YZ=c|JT^^>J;F-P8$R1Fo310c_ecXD9D~5x+(2vO|g+eIIfa3C&E(^uR3HPw$G0+>% z>X62Kql^gEzHoWWyF70x#%3VlTKt`74-!*sIKeAknRub*y~Y0v3JxO`v--;-4Y^PGYt7#DbU}i35gu+sZxro> z+$GYx1@%02&xgzI53L#7+q-~1>>Jd-q*?ikYey2Xg$)&%J(;uuZRM$XW2b$+^*lFi zyp3{^M7*&dr((Ugv0%Y7vMUxA_M{etiMcbI z&rSL(O3b;$hsTP^lZtUTt}EH#m&RZ`hU%BX;_UVU_n{K78m0IGF0gKP^n7I&xmqo$ zv71_9BN2;1gUO@k8f@{9d4X&4s3^Tfx+0ly&MOo4ZMJT@dKxx|zZWuTj(2Xj&fiHBy1aO>!Cl64`?>S&N!XTrEPcb~CH5O!l00#v z!?ZnOw@y~O2ipbr>X}-HC=KKdueFLlj2sIhDiy-`Pj5KGA|*(HAWGOyZxEE$Zal1iJscYogM%{2JEs&m(_eNws|f0ap-Rz0#N+%a zHSi2}l|-D34{a8TjKwv3%fVs-{LeZ-AK?Wvjg?X)juGY4OxA30&&t zJ&r@A=cgX+^0uDeRgHATnadXO>OOZZeGRu!Jeyzv4wvSB%-xrXm1@`c7c8}@TG0_a z5f*nj*IYmU;L0=(Q?YTtupGc3Bv09$MHFFS3d^6aOzMr36uS#XKDb;fug9Za%w{~x z)I7dX24|d;*k822h%%cNFV(DhYbjy%{X@+U(O2~RR;276QnSJ%XCY-JIg~@F24;kf z`ver*Jjh;1cmYJFv=I^g4wKt60+&7HY?v!d6l4~cg2dNn&ApSmvKOXhlCV5f7Fwqf z?x{gJG0R25Sx0Qs_snD;SvrZ*_zAABCC$)AJ_IUit;y+yv>LaS6mze4r0;=EX=|zN zkIdoBZYNX01tK4wMDNhc@e3&*bw7XI{c|WgyUymr`h!(5F_0ZLt>|^*a-T=YAwKWL zne%==mj$RrC6S=GyvAn`cs%HIk@>w}RL2jn(`=nf_0r+(Jx!XD(H}U5z=>j$ZjPluq z1-Om`ch|9H*4#-lkI3^!2~lBR$>;93Q)$`z ziE?Vh8FiRAG*Yj1lB1=xoMxNd8544+(&eY}b~STx0Puqv3Kd z%Wiwcs42C=@Yg%QVQ4_bHTZJCuis>=oIIore%3&d4vS-O10% zwPz&dN;KvXW+1vK8_pN*EX-C8|8}BmKZ%zv7oK$Fij)+3Y=cv>+oPgtAuMNX zyJ+dxrZ3k*m#82sfrnxb$DTCI>1y$mqJ}Xi3mlfVbx|O+{m6HmK7>)XG}Bh|v#fWW z1pF*o7h=phXNo$uVQueeYk4FkY2@%!U3Gl%f0uyC;tY{Ql<^OHxUqXi{n>9?6<z-W$#`l5>nfQ!5HL3w30F zTeJ)EQ8IVuqPw2a!)kk2Xm`_@FsYCA#yHeXsJ7mTPSWG$V+X?eC$?Jd>(ookBXK*7 z^eHa_I!thgRQB3E#F@fy--=C>6DlbR1Wwo0QhTTy$6{xkBDcsnzVIQ}rU+vuA{4%_>l2e%Z&@qt^ zVz7nQ#?)ZbC;GrP8Vqw3`pe#Lf__`}yssE>IE!K!sdjJz{vFUSGG8!=cR3Y93_y3m z1W^MMtt39_2V)529^Ami1RTd;g_oQoXz+P$x)UXs=mueh}+a&eHVd=EPrDFhEj{V=j@!>M?tFL5Z^)M&AxbjE|zM~bl1 zs864K-3voj(II}qXWgD8DvwHty%e-AqBT^7I$=~|1#bYYWl%pTpX*WJTeQ(*z9^M6 z2?V^wDJzIuFZClyY#R!!PiLMcMkjr!=JDeFVl8lG-eZLh8~$9{x+r5WbZjYyPBmC; zsU%>lWNh4>QeDj;R4gaJL8sn?bh^~;LNHWubcp#UYl40t0UK)?vqpem&qRu_66HfX z%W*)|HH%8-8ap5n#&at;YAfOUSn(Kmn3^)C`huF@oX!ZxYV}&FNE5k)Gscre z{A0!nRJjKr#CR&(YpI`;eEAfzFHhte>xFTE{!W%1^NG|mo4iYK*}+kC@1Vv`qVlxF>A{#9Q@w;pG`W{-iS9J`uPoSp@mLPfABA%Ak6twn6?5F*YVRCuCZwSfIxUj|PC%q-`>?{;IC&}D zH`K`*kNtj?OLltX1@~y?pz#8W$)gXO@vzv#HCGf{zDUR#T|+tyL?%H}M?G-A;J||i zm*c(gaKkO+A;gR#9u|k*RYY4#Mx+ebjsfLLDL3bIu2#67rK@7Kan^h;3>K6UYSW!w zTz3st#hEzpM?ILpTdm{f-dqM6$3s3f*2ZU1M(lHd-+0&+WgI#La9$9+9;iPO9TjP3 zmCwvzxr=`!bUsR*w5Cdh4v@av_ts4b*G7TD@H`WITv)hqULSh10osoW>jy@Y?ga)^ zA>Hp-#6)t%P3adf#neV^A*<{$WZ~fvDvJ;Z_V7i`^2}}9y$MZ30R)Jp?CD7Fo%1t7 zwl@hfb0IB89;QE|S#GM@bh)oj3utr*mw`|xGcH|P)s zON+oI0GCc~kT=>*zIZ>WR^n6-XRfs;dTu?v83f9pS?!MMGcm{2CmX8k6_3ZkU`mQ2 ze^goDs_OreH{~oXZk^7y$%9FA_T`v0P#~G~;v%0jg61ANI_?d6y#NkN`a+&2WQ?DmkWL{HXni$Z9opV$p?pPd1fme7n)%b6cS zrBnv?x1}+dLfe9Jh$Pt}vnNhOw`=`%Atn%NYm*~?)}e>5sK2qi>h->jNPMPHlV6^R zak_NY@0dgpHKA;2W?^?J6Ar^PK&Pi^1K9ip-V zsY#4tl%Vj{eb7Mtf*BSqtjDrFB9OcyUllLS7DMS;a`1B7FdXz&m zMw7KsOOOj!X$`%fKFEF@a(kX6{4U@6X}E#e>G6DRJj-)syut4DS3cv-GPP^@WSf>* z))lG`ymvJm4F;yCW#=Xv-5UA)$)tRR8>C*=$CCWayJRDg_9(0#&Xohw)<{$tlQKr= zvRcUvT1v-?*_V2;#)Yo$Y;Hz4rmhs7hU#9;yB!@F(e21`bF4UFg%5}d^K3UiRQn5A zlWEb&FsErnAno8$?*Gv>`?(1S~zeTp* zWw<-82}%tp>>GI_pUBOrg6-zHhYNf1zvC0qXqkyUEnJUi@R+Zys7Z{}jplgF$%ZMPF}14!Uh`&wVYq zZ`hn{Xvvf@;0BLI3L3}LjqI-+#o zgjOHaW`1SUGM!VsD)YR9>C$%}653DaUmQCP4nprM)Y6q0nQ48hC8nNe?J0-eXG9>5 z5VyF$@wv43XhsCemZW4=Z$&ixN<)Ciwexr4SrQZ=8B<%nZ}?&uyxAg)MpOfC_MI$b z9AfRS+HFi>4~YYsvvXMb!QD@dc#)EvyYK8s6XmrK$33?5WmR;XS=4R!TWlX}x@xNk)i@linB@_6aOZ6{AnbGd=3ty7acqQD`C48W#CoKoXJ1b8@|Rd^{aTz7 z7C_*V@g38I-Z++=V_M8F$>=pYgpp&AC`a*wXw_Z22&?~kT=LM4um}d3GmgA$pb36T zXJR-&5T2R2MVOe{Ij1UZuvF34D3SkI$xC%0i7kSWT0dtisWzD5Nvvf0x~%m!G8{tS zKy8r$6>f5RxyCE)4fJ(`yn%i zxwV(vG^HZPTIu+$PQCuUX?Qo)1eAk4uh{SnUCOsm7nIYvPOS+F30KnmUj0y{(9O^= zC0B*?`jSDq__HxngY&WanwoOcv%ZT=Kg5NTVatQ9j&$qfDp7eO-SEz65E3%X?`6de81wCR7Cf3B_@V1w7q<>>`5NjD6FH=2Pix{4#~c zz6Ub~@3Du7IJK=1bK!uDZFvn{`DP<_8F$qy2p&F~$2WO~K6H!Kvw=b!GbF-^I&SRQ z40{pb9)B1Ai_3!nj!aTJ3mzVmS>5sl?oud)m)Q2N#cgPEO-ew$`C z=-tXMvO^Lz>+IQZEhhu`oKZwcfM9579$IpevxF;Pe@)F7c6xV|Dr2puC|c)-i+}2q zV6~$HdrP^2RAAZbK(6LMSs}-2$#jslVY^Z9j{QzWtJ(V1aC`-)Q%k3a^D9AL6AwmI3gQ5g{dH~6GOTiErZ8$< z9pQoDQoiDra9s%2i_b<0IIX!)PV4adZYb@#kRi@Mo_B59^(K{=?2@{(aaBfD=xcoW zZOh(Q9Z4b@@bTAS#(G7?F;C?%-b9cw);_urU zBqI>zIdYM<^5Pk~f1M;rfDS#&wnxe@c2ZM0^D?k+-fX&k0$Y_q(l38DfF*8A$GWs& zNpZJMQ?$uRZT*3mCf(Bj+q=75IxqV|t>R_dZ6$UFE7|a2Rc}qi;_(y;N!HpKsAqz} zR0=Z?r<_wisUO^WY@??NRW)4;FxB^1Rh7vevVL3{qd}QWe^6S#T%MVb`c0NUg<@qGAs$`wg zAL&W!o>ZbeX|(J5U4GZmGXK@+<+#FV?Dn_kre$V(shMIOVjYhgs8OD73@3{<)g7!R z9k|n2JY3?W+2lR;8Kc?7I-$d|Ar}J@58w7(F$1~)&HXN!c3!IMkau*BVac#OB4v7g zQi;sPdb5g>Z}Yp0?cSqWRYxSlG*Pd}`rfqFwc1Me2e77ehx z`k93|rtspD-&t(v;jjS4Ikk*VoIlI2!tIYGtXKG@C(6DrOl|O*vzNAVKMU|4ZeJ1d zH1EeurNyFq2wX2r#)hFXrhi#OMeNKx5KOamCA{IS{K=w_oMc0XmhTrJi(3%h{K%h` zpSjDar>kJK(3GQGKZP3BN0c|xE#N=ys}!ceFBANJ&lZLE({$r-m#5+{;=ZcEQ7ic& z(sHvhG{L8F8dt8nT~%J0jmH656WjF9@kOIVE*2}w;}^;mtry+d$+_hqf&jIW%ghG%jiuD*GZR_Wo~F{fym%5Z^%3!I-0P%8C< z?PvJu2Do*Gnh%SWhE32~YNfkbUC`zD9g{Fr6%SX<7TR)AmB1`cy}x_{$u`bIyxQyL zJ1<#{cub1L#_jx1?*(I%njQ79TK9My+v=>}94PtuZ?`*q(NQ~izZ)N(snItm_k^=! z`+>_AE3_Is+=Yx{4-Y8KCqV$K#AK-3R}I;j#?sU+i(a;+ceg=m18L;Z1P2gWDq;iz zNyBI>!F|ge8Ixd&LP!YL3vcz$>2fdAm}9PDEpgq3?cdxzf3}uMXMU5x_bY!@Y)BUk z0_iW|yJ6WmBc}$7{__lV0ca}{V63~>IZ^I%2#|t#hN{GWpB+brPGkNh@J6(rRkki< zc4k=9X;oqC#un=xKdZMnHjMF?)TfJNWb@~B;!dU9pm!Ki;m3m6h@wN-*|uJMy8rPwY=%3gZEq;_#n+1y6B zLSw$XoR#sTD^A1B>E$?t(~HN^q$9bwJ8^PZg=p5NaMo;;Ms=0+tnmkh(}duhkS{cw z#c=Cnj|Y!3}W)5MYU_?_dfZ<(jVX91q9r zb1=HTE&wwJBGHft_qV?Fx$MRyO9Qb4J>n>?7h?L4!ykpHx+PLTQil6n2~d!50ge=L5}m>gx|JvnQP`q3n0-0XyXv^}yzX z?)Jvy{&h*=;hoz`0?ZOZjf_j)gq1b-3blf)c8vAvJb8+7T0h@5qm+#-&v56R z?#N$9oJT`pX#-zz<=F3Bhly{0sbTg*WCbGVziOY1*=vItJ`$C`!x1{zEk<*R%gostl}R!-}OpywxL4cb<(SbF14sj0UmrE%}rbeCV)( zyw0L@;gf$tBz`oY(t>M_P*U;SAv{_@6Y$f^6F=XpQAFir4}wpC<*PL4uePAKxxV{F zH}u~_2Jf1jgv``38mYgP2O1rA^0r2+xPB~JnZxxlV(vHmAzlbE8&(N`KXY3VJnS4Z zYx5a78FRyKP<23Y@T-SserS0RcLi9Gr3osC3Wo?O_?J-$5*W zRk@Ru9rl9mv?nKZCB25`B#jYvXto5^$Biz}POjqLH)BhG9!GKXS;bKZNVp1_W^d@?IV{Mf<=?+p2vwchfiOyf-sIZQ9C})Oxxn;q|#> z)T9Tz*CvXvt?q{Gj>p|7x6+2{wMl9N1Wvr!W*Z3d`sH>#!RbLI1}}H}qy{G^6FB%a z_~YCVujd3Q2NPif0gT0AA5)DY#M4m9)xRiL8HtvapamdTtvlr4GeUb)T3nb;ZtCvm ziIb z^8~i!YBj-lnC3$-R(QDPz*p?Qa)|Q=zsprv2I`T>t5A)?pZwpzba+P9CcO*!Z%ATc|Is*gko>unk^e90%s&|a z2dw`Y5&Z}D)p*H0lpe>>;M1& literal 0 HcmV?d00001 diff --git a/desktop-tauri/ui/i18n/en/add-account.js b/desktop-tauri/ui/i18n/en/add-account.js index 0786f09b..2b273236 100644 --- a/desktop-tauri/ui/i18n/en/add-account.js +++ b/desktop-tauri/ui/i18n/en/add-account.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:en/add-account —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · Models: {head}{rest}", " 等 {n} 个": " ({n} total)", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "Google refresh token starting with 1// (you can also paste the whole refresh_token=… line)", "11 位大陆手机号": "11-digit mainland China mobile number", "1~64 个字符,账号列表里按它分组显示": "1-64 characters; accounts are grouped by it in the account list", "6 位数字": "6 digits", "
  • 没有可自动领的活动
  • ": "
  • No campaigns can be claimed automatically
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    What you receive is plan gift points, which do not add to the welfare model token pool; ", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "The Anthropic-compatible endpoint is https://api.deepseek.com/anthropic (fill it in when you switch the protocol to anthropic)", "Anthropic 协议填根地址,不要带 /v1": "For the Anthropic protocol, use the root URL without /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw China edition", "AutoClaw 国际版": "AutoClaw International edition", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS is required; paste the **full Cookie** (a Cookie editor can export it in one click) — the **PTOKEN must be kept**, as the gateway uses it to exchange for a KukuAI business session token from Baidu; without it, model refresh reports \"Not signed in\". A full Cookie header, a JSON array exported by a Cookie editor, or a {BDUSS, STOKEN} object are all supported. KukuAI has no refresh mechanism, so once the login state expires, just paste it again.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (or the JSON exported by a Cookie editor)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw's X-Passport-Token (login-state Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (three dot-separated segments)", "Command Code": "Command Code", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode International edition", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM managed endpoint; apply for the Key at integrate.api.nvidia.com", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken is Accio's login credential (a long opaque token, not a JWT); refreshToken is optional and enables automatic renewal on expiry. Enter the credential of the {label} account — {siteNote} (the easiest way to get it: just use \"Web login\" above; no need to hunt for the token manually.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken is Trae's Cloud-IDE-JWT (three dot-separated segments), and refreshToken enables automatic renewal on expiry (this provider rotates refreshToken on every use: once exchanged, the old one is void, so do not refresh the same account from two programs at once).
    When pasting manually, fill in machineId / deviceId as well: upstream ties them to the device public key uploaded at sign-in to identify the device, and swapping in a new pair from nowhere triggers the 2xxxx family of device-binding rejections.
    Without these three, the proper route is \"Web login\" above; for container / remote deployments, paste the callback URL from the address bar as prompted.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "The value of monkeycode_ai_session (you can also paste the whole Cookie)", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken is optional and enables automatic renewal on expiry; both can be obtained from the Raccoon client login-state file.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken is optional and enables automatic renewal; both can be obtained from the client login-state file. The same Cline account works in both pools; here it is grouped under {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token supports the enc: prefix (decrypted automatically on Windows). Without a refreshToken, automatic renewal is not possible.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token is the login-state Cookie; CatPaw has no refresh mechanism, so sign in again in the client after it expires.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "API Key starting with user_ (you can also paste the whole Authorization: Bearer … line)", "{label} 网页登录的打开方式": "How to open {label} web login", "{label} 账号地区": "{label} account region", "{label} 账号的添加方式": "How to add a {label} account", "{name} 不是合法 JSON:{reason}": "{name} is not valid JSON: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name} requires a JSON object (like {sample})", "{n} 个账号": "{n} accounts", "{n} 个账号,点击添加": "{n} accounts, click to add", "{seconds}s 后重发": "Resend in {seconds}s", "✅ {label}账号已添加": "✅ {label} account added", "✅ {label}账号已添加{name}": "✅ {label} account added{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ Imported {n} providers from cc-switch", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ Created custom provider \"{name}\" and added an account", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ Deleted custom provider \"{name}\"{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ Signed in; {edition} account added to the list", "✅ 领取成功:{planId}{period}": "✅ Claim successful: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " One provider can hold multiple keys, rotated by priority.", "「{name}」的账号添加功能还在开发中,敬请期待。": "Adding accounts for \"{name}\" is still in development — stay tuned.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "One Key works across many vendors; use the full \"vendor/model\" name (e.g. deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "Leave blank when the upstream needs no authentication, and check the option below (blank without the checkbox counts as no credential configured)", "上游信息": "Upstream info", "不可领({status})": "Not claimable ({status})", "不支持导入": "Import not supported", "不是有效的凭证文件:内容要是一个 JSON 对象": "Not a valid credential file: the content must be a JSON object", "不是有效的凭证文件:需要包含 accessToken 与 uid": "Not a valid credential file: accessToken and uid are required", "不是自定义提供商": "Not a custom provider", "不需要 Key:转发与拉取模型都不发送鉴权头": "No Key needed: neither forwarding nor model fetching sends auth headers", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "Both editions' accounts can be saved at once, each with its own model catalog (the China and International editions are two providers that can be enabled and mapped separately).", "中国版": "China edition", "今天没有需要领的活动(都已到账)": "No campaigns to claim today (all already credited)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "Tried {attempts} times today (Beijing time {day}); {left} attempts left{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "Grab three items from another machine (or from the OfficeAce desktop app's models.json) and paste them here: the model gateway base URL (baseUrl, shaped like https://modelgw-…/v2) plus modelAppKey / modelAppSecret. These three are enough to forward requests (the gateway credential never expires); the control-plane temporary credentials (accessKeyId and so on) are optional — leaving them blank disables balance queries and auto-renewal but does not affect forwarding.", "从本机导入桌面端登录态": "Import desktop login state from this machine", "任务镜像 id": "Task image id", "使用 Google 账号登录": "Sign in with Google", "使用 Zai 账号登录": "Sign in with Zai", "使用个人访问令牌(PAT)": "Use a personal access token (PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "Free models need no Key (\"This upstream needs no authentication\" is checked by default, and the gateway uses anonymous credentials automatically); for paid models, enter your Zen API Key. The free tier only accepts the official client form, so \"Emulate the official OpenCode client\" is on by default", "内嵌窗口": "Embedded window", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "Opens in the embedded window; closing it cancels the wait (if a Google account is rejected, switch to the system browser)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "Opens in the embedded window; added to the list when done; closing it cancels the wait", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "The embedded window uses a fresh environment, so multiple accounts do not affect each other; closing it cancels the wait", "内嵌窗口(推荐)": "Embedded window (recommended)", "准备验证…": "Preparing verification…", "凭据 JSON": "Credential JSON", "凭证文件在哪?": "Where is the credential file?", "创建并添加账号": "Create and add account", "创建这个提供商,并同时建立它的第一个账号。": "Create this provider and its first account in one step.", "删除功能不可用(脚本未就绪)": "Delete is unavailable (script not ready)", "删除失败:{reason}": "Delete failed: {reason}", "删除此提供商": "Delete this provider", "及 {n} 个账号": " and {n} accounts", "发送中…": "Sending…", "发送失败:{message}": "Send failed: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "Send unconfirmed: the sign-in window has opened; complete the sign-in manually in that window", "取消失败:{message}": "Cancel failed: {message}", "取消等待": "Cancel sign-in", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "Only the Embedded window can restore third-party options: we cannot modify the sign-in page in the system browser", "可选": "Optional", "可选(cloudaicompanionProject):留空由网关自动发现": "Optional (cloudaicompanionProject); if blank, the gateway discovers it automatically", "可选,展示用": "Optional; for display", "可选,没有则无法自动续期": "Optional; without it, automatic renewal is not possible", "可选,留空使用凭据里的 user_name": "Optional; defaults to the user_name in the credential", "可选,留空使用账号姓名、邮箱或令牌指纹": "Optional; defaults to the account name, email, or token fingerprint", "可选,留空使用账号昵称或邮箱": "Optional; defaults to the account nickname or email", "可选,留空则用 key 尾号": "Optional; defaults to the key suffix", "可选,留空则用 userId": "Optional; defaults to userId", "可选,留空则用上游返回的账号名或账号 id": "Optional; defaults to the account name or account id returned by upstream", "可选,留空则用凭证里的账号名": "Optional; defaults to the account name in the credential", "可选,留空则用文件里的昵称": "Optional; leave empty to use the nickname from the file", "可选,留空则用登录名或 uid": "Optional; defaults to the login name or uid", "可选,留空则用脱敏手机号": "Optional; defaults to the masked phone number", "可选,留空则用脱敏手机号或 userId": "Optional; defaults to the masked phone number or userId", "可选,留空则用账号 uk": "Optional; defaults to the account uk", "可选,留空则用邮箱或令牌尾号": "Optional; defaults to the email or token suffix", "可选,留空用「OfficeAce 果办」": "Optional; defaults to “OfficeAce”", "可选,留空自动生成": "Optional; generated automatically if blank", "可选,留空自动用昵称": "Optional; defaults to the nickname", "可选,续期时带上": "Optional; sent when renewing", "可选,讯飞侧 userid": "Optional; the userid on the iFlytek side", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "Optional; required to start a conversation. If blank, the gateway discovers it automatically from this account's existing tasks; if it cannot find one, fill it in manually later.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "Optional; the account email, used for display and to recognize the identity (the same account is recognized even after switching to a new token)", "可选;UUID 形态,与凭据同生共死": "Optional; UUID form, lives and dies with the credential", "可选;填了才能到期自动续期": "Optional; required for automatic renewal on expiry", "可选;用于去重与展示名(留空时网关会问一次上游)": "Optional; used for deduplication and the display name (when blank, the gateway asks upstream once)", "可选;用于生成账号 id 与展示名": "Optional; used to generate the account id and display name", "可选;纯数字串(上游只收 8–24 位数字)": "Optional; digits only (upstream accepts only 8–24 digits)", "可领取": "Claimable", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "They can be mixed under one provider: Key accounts and no-auth accounts each follow their own rules", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "Switch the protocol to anthropic on the same address to use its Claude-compatible endpoint. Forwarding requires an OpenCode Go API Key (subscription-based; fetching the model catalog needs no Key, but requests get a 401 \"Missing API key\" from upstream)", "响应为空": "Empty response", "国内版": "China edition", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "The China edition and **the International edition are two separate sets of accounts and plans**; credentials and claimed plans do not carry over between them.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "The China edition's sign-in page has no Google / GitHub options (it uses WeChat / phone / email sign-in)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "The China edition's sign-in site is www.accio-ai.com, a different site from the International edition's.", "国内版(WorkBuddy)": "China edition (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "China site: https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "China site (minimaxi.com); the OpenAI-compatible address is https://api.minimaxi.com/v1", "国际版": "International edition", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "The International edition z.ai Coding plan; the OpenAI-compatible address is https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "The International and China editions are **two separate sets of accounts** (two sites of the same account system); credentials do not carry over.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "The International and China editions have separate account systems; enter the International edition's credentials. Without a refreshToken, automatic renewal is not possible.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "The International edition's sign-in page shows only email sign-in by default; checking this restores the Google / GitHub / X options", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "The International edition's inference site is api.z.ai, a different site from the China edition's; plans are separate as well.", "国际版(WorkBuddy AI)": "International edition (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "International site Coding plan; the OpenAI-compatible address is https://api.minimax.io/v1", "在 cc-switch 里找到": "Found", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "Complete the official sign-in in the embedded window; the account is added to the list automatically on success.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "Generate a PAT in the Qoder account settings → Integrations for {label} (do not use a Google / GitHub token). Accounts and credentials do not carry over between the two regions.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "In the window that opens, sign in to the KukuAI main site with your Baidu account (SMS code or QR scan both work); the account is added to the list automatically on success. The gateway exchanges it with Baidu for a KukuAI business session token (requires the KukuAI client installed on this machine).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "Sign in with your Google account in the window that opens (Antigravity's authorization page); the account is added to the list automatically once authorization completes.", "在浏览器中打开登录页": "Open the sign-in page in your browser", "地区": "Region", "填写凭证": "Enter credentials", "填写凭证添加": "Enter credentials to add", "备注名": "Label", "套餐": "Plan", "如:智谱 GLM": "e.g. Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "Added to the account list automatically after sign-in; the nickname comes from upstream.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "Official client credential directory: Windows — C:\\Users\\\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth; macOS — ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "Officially confirmed as credited", "导入": "Import", "导入中…": "Importing…", "导入凭证文件": "Import credential file", "导入失败": "Import failed", "导入失败:{reason}": "Import failed: {reason}", "导入所选": "Import selected", "导入所选({n})": "Import selected ({n})", "导入桌面端登录态": "Import desktop login state", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "The embedded window will open; the account is added to the list automatically once authorization completes. Closing the window cancels the wait. The authorization page may end with a message that it cannot open the zcode:// link — that is normal; the result has already been recorded server-side", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "The embedded window will open; the account is added to the list automatically once authorization completes. On a remote panel you can paste the callback URL. Closing the window cancels the wait. The link is valid for 5 minutes; if it times out or is not clicked, it is voided (you can start again)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "The embedded window will open; the account is added to the list automatically after sign-in. Closing the window cancels the wait", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "The authorization page will open in your system default browser (reusing the Trae account already signed in there); on the same machine the account is added automatically when done. For Docker / remote panels, paste the callback URL from the address bar as prompted.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "The authorization page will open in your system default browser (reusing the ZCode account already signed in there); the account is added to the list automatically once authorization completes. A final message that the zcode:// link cannot be opened is normal", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "The authorization page will open in your system default browser (reusing the Huawei Cloud account already signed in there); when the browser and the gateway are not on the same machine, paste the final callback URL back into the panel as described above", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "The sign-in page will open in your system default browser (reusing the Accio account already signed in there); the account is added to the list automatically after sign-in, and closing the popup cancels the wait", "小米 MiMo Token Plan 套餐(新加坡站)": "Xiaomi MiMo Token Plan (Singapore site)", "已到账": "Credited", "已取消登录等待": "Pending sign-in canceled", "已取消领取": "Claim canceled", "已取消验证码": "Verification canceled", "已填写手机号,正在发送验证码…": "Phone number entered; sending the code…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "Marked as needing no authentication: the account is routed normally, and no auth headers are sent outbound", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "Imported {ok}, failed {fail} (failed items are marked in the list)", "已建过 · {n} 个账号,点击继续添加": "Already created · {n} accounts, click to add more", "已建过,点击继续添加账号": "Already created, click to add another account", "已打开官方登录页,请在窗口中完成登录…": "Official sign-in page opened; complete sign-in in the window…", "已点发送,等待短信…": "Sent; waiting for the SMS…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "Sign-in page opened in your system default browser; complete sign-in in the browser…", "已领取,等官方确认": "Claimed, awaiting official confirmation", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "This app version does not support AutoClaw web login; update the app", "当前没有可领取的套餐(活动尚未开始)": "No plans are available to claim right now (the event has not started yet)", "当前环境不支持领取(桥接方法缺失)": "Claiming is not supported in this environment (bridge method missing)", "必填,CatPaw 账号标识": "Required; CatPaw account identifier", "恢复 Google / GitHub 入口": "Restore Google / GitHub options", "手机号": "Phone number", "手机验证码登录": "SMS code login", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Open the official authorization page for Trae SOLO (trae.cn) and sign in with your Trae account: once authorized, the official page redirects back to a temporary port on this machine; a same-machine deployment receives it automatically, while Docker / remote panels should copy the callback URL from the address bar as prompted.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Open the official sign-in page for Accio {label} ({site}) and sign in with your Accio account: on success the official page redirects back to this machine; a same-machine setup completes automatically, while Docker / remote panels just paste the callback URL as prompted (the authorization code is passed to the gateway only on this machine, and no plaintext token is shown in the UI).", "打开 Accio {label}登录页": "Open the Accio {label} sign-in page", "打开 Antigravity 网页登录": "Open Antigravity web login", "打开 CatPaw 网页登录": "Open CatPaw web login", "打开 Cline 授权页": "Open Cline authorization page", "打开 CodeArts 授权页": "Open CodeArts authorization page", "打开 Qoder 网页登录": "Open Qoder web login", "打开 Trae 授权页": "Open Trae authorization page", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "Open the official authorization page for ZCode {label} and sign in with your account. The authorization result is recorded by the ZCode server; the gateway fetches the credential in the background and adds the account to the list.", "打开 ZCode {label}授权页": "Open the ZCode {label} authorization page", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Open the official Huawei Cloud CodeArts authorization page to sign in: once done, the official page brings the browser back to the gateway's own /oauth/callback, and the gateway exchanges the one-time authorization code for temporary credentials and adds the account to the list.
    When the gateway runs on another machine, the web UI prompts you to paste the final callback URL from the address bar back into the panel.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Open the Huawei Cloud authorization page and sign in: once finished, the gateway automatically polls the cloud for the authorization code and adds the account to the list (no OfficeAce desktop app required, and no need to paste a callback URL back manually).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "Open the official authorization page and complete the device-code authorization; you will be signing in to a {label} ({site}) account.", "打开授权页": "Open the authorization page", "打开授权页完成确认,账号自动加入 {label}{note}": "Open the authorization page and confirm; the account is added to {label} automatically{note}", "打开方式": "Open with", "打开网页登录": "Open web login", "探测失败:{message}": "Probe failed: {message}", "接入一个兼容上游": "Connect a compatible upstream", "提交中…": "Submitting…", "搜索提供商": "Search providers", "搜索提供商…": "Search providers…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "Paste the whole credential JSON written to disk by the official plugin / CLIProxyAPI (like {\"codearts_provider_credential\":{…}}; a flattened form also works).
    Required: access_key_id, secret_access_key, security_token.For automatic renewal you must paste refresh_token and oauth_context as well — temporary credentials expire in about an hour, and without that half they cannot be renewed; you would have to sign in again.", "文件是{edition}凭证,已按该版本导入": "The file contains {edition} credentials and has been imported as that edition", "新建自定义提供商": "New custom provider", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "Plaintext JWT, or the enc: encrypted value in auth.json (decrypted automatically)", "明文 JWT(国际版账号的 access token)": "Plaintext JWT (the access token of an International edition account)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu's bigmodel.cn Coding plan; get the Key at open.bigmodel.cn/usercenter/apikeys", "未知错误": "Unknown error", "未能获取授权地址,请重试": "Could not get the authorization URL; try again", "未能读取 cc-switch 数据": "Could not read cc-switch data", "未领取成功": "Claim unsuccessful", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "Check this for upstreams like local Ollama or the OpenCode Zen free tier; otherwise the account cannot be used", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "This provider has two credentials that **do not replace each other**; fill in the one(s) for the features you need, at least one: the Coding Plan API Key is used for forwarding inference (hits {site}) and for querying the window limits (the remaining percentage of each N-hour / weekly window); the jwt is used for claiming plans and querying balance (hits the billing gateway at zcode.z.ai; officially called a Coding Plan JWT, a three-segment dot-separated string). Either one can query balance, but they read different things: the jwt reads the balance buckets and the plan expiry, while the API Key reads the window limits; and claiming only accepts the jwt, forwarding only accepts the API Key. Please enter the credentials for the {label} account — {plan} (the easiest way: just use \"Web login\" above — it exchanges this API Key for you and gets both credentials at once.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "The local Ollama OpenAI-compatible endpoint; no API Key needed (\"This upstream needs no authentication\" is checked by default, and no auth headers are sent at all)", "本次未确认到账": "Not confirmed as credited this time", "条可导入": "are importable", "条配置,其中": "configs in cc-switch, of which", "桌面运行时不可用(Tauri 未初始化)": "Desktop runtime unavailable (Tauri not initialized)", "模型网关基址": "Model gateway base URL", "正在打开百度登录页…": "Opening the Baidu sign-in page…", "正在扫描本机 cc-switch…": "Scanning cc-switch on this machine…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "Waiting for {name} sign-in to finish; you can start a new sign-in only after it completes or is canceled", "每周": "Weekly", "每日": "Daily", "每月": "Monthly", "没有则无法自动续期": "Without it, automatic renewal is not possible", "没有匹配「{keyword}」的提供商": "No providers match \"{keyword}\"", "添加 {name} 账号": "Add {name} account", "添加中…": "Adding…", "添加到 ": "Add to ", "添加失败:{reason}": "Add failed: {reason}", "添加小浣熊账号": "Add Raccoon account", "添加方式": "Add method", "添加账号": "Add account", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding plan; the general inference endpoint is https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "Click to add an account", "点开即预填,填 Key 接入": "Opens prefilled; enter your Key to connect", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "After clicking the button, first pass a slider verification (the vendor's risk control), then the sign-in page opens and the account is added automatically once you sign in.
    This is the only official sign-in method for the International edition; if you are already signed in to the client, \"Import desktop login state\" is faster.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "Sign in with the phone number bound to your AutoClaw account: click \"Get code\", then enter the SMS code below and sign in. The code is submitted from this machine directly to the official API; no token is shown in the UI.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "Sign in with your CatPaw account (Meituan Passport); the account is added to the list automatically on success.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Sign in with the phone number bound to your Loomy account: click \"Get code\" and enter it. This is the easiest way in for this provider.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "Used for forwarding; two dot-separated segments like apiKey.secret (if left blank, this account cannot forward)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "Used for claiming plans and querying balance; if left blank, this account cannot claim or check balance", "用户 ID": "User ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "Sign in with your bound phone number: click \"Get code\" and enter it. This is the only official sign-in method for the China edition.", "留空则用提供商名称": "Leave blank to use the provider name", "登录 / 添加 {name} 账号": "Sign in / add {name} account", "登录 session(一长串)": "Login session (a long string)", "登录中…": "Signing in…", "登录失败:{message}": "Sign-in failed: {message}", "登录已结束": "Sign-in has ended", "登录并添加": "Sign in and add", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "Login-state file path: ~/.box-agent/config/auth.json (Windows: C:\\Users\\\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "Delete custom provider \"{name}\"? This will also delete {count} accounts under it; deletion cannot be undone.", "等待 Accio {label}登录完成…": "Waiting for Accio {label} sign-in…", "等待 CatPaw 登录完成…": "Waiting for CatPaw sign-in…", "等待 Cline 授权确认…": "Waiting for Cline authorization confirmation…", "等待 CodeArts 登录完成…": "Waiting for CodeArts sign-in…", "等待 Google 授权完成…": "Waiting for Google authorization…", "等待 KukuAI 登录完成…": "Waiting for KukuAI sign-in…", "等待 OfficeAce 登录完成…": "Waiting for OfficeAce sign-in…", "等待 Qoder 授权完成…": "Waiting for Qoder authorization…", "等待 Trae 授权完成…": "Waiting for Trae authorization…", "等待 ZCode {label}授权完成…": "Waiting for ZCode {label} authorization…", "等待小浣熊登录完成…": "Waiting for Raccoon sign-in…", "等待登录完成…": "Waiting for sign-in…", "等待网页登录…": "Waiting for web login…", "粘贴 API Key": "Paste API Key", "粘贴 Accio 的 accessToken": "Paste the Accio accessToken", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Paste Antigravity's Google refresh token (starts with 1//; pasting the whole line containing refresh_token= also works).
    This is a manual entry besides web login (for example, exported from the official IDE you are already signed in to). The refresh token does not expire, and the gateway renews the access token automatically when it expires; if the token is lost, you can only go through Google authorization again, so keep it safe.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Paste the Command Code API Key (starts with user_; get it from the official CLI's ~/.commandcode/auth.json or the web studio). Pasting the whole line / with quotes / with the Bearer prefix all work; the gateway strips it down to the bare key itself. The key does not expire and there is no renewal API, so if it stops working just get a new one. When adding, the gateway runs a lightweight liveness check; a failure does not affect adding.", "粘贴 Cookie": "Paste Cookie", "粘贴 Google refresh token": "Paste Google refresh token", "粘贴 Qoder 个人访问令牌(pt-…)": "Paste the Qoder personal access token (pt-…)", "粘贴 access_token(一长串 JWT)": "Paste access_token (a long JWT)", "粘贴 session cookie": "Paste session cookie", "粘贴 token / refreshToken": "Paste token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "Paste a token starting with workos:… (the prefix is added automatically if missing)", "粘贴登录凭据": "Paste login credentials", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "What you paste is the login session (which is also the model gateway token). Loomy has no renewal API; the session is valid for about 14 days, so just sign in again after it expires.", "粘贴网关凭据": "Paste gateway credentials", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "Paste the value of the web session cookie monkeycode_ai_session (copying the whole Cookie in the browser and pasting it directly also works; the gateway extracts the value itself).
    {siteNote}
    MonkeyCode has no renewal API: the session is valid for about 30 days (a hard limit); once it expires, sign in to the web page again and paste it one more time.", "系统浏览器": "System browser", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "The system browser can reuse an existing login state (recommended for the International edition); the embedded window is cleaner.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Cline account); added to the list when done", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "Opens in the system browser (reuses the Google account already signed in); added to the list when done", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Zai / Google account); added to the list when done", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Meituan account); added to the list when done", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "Opens in the system browser (reuses a signed-in account); added to the list when done", "系统默认浏览器": "System default browser", "编码套餐 API Key": "Coding Plan API Key", "网关 Secret": "Gateway secret", "网页登录": "Web login", "网页登录的打开方式": "How to open web login", "网页登录(Zai / Google)": "Web login (Zai / Google)", "自定义": "Custom", "获取风控配置失败,将直接尝试领取:{message}": "Failed to get the risk-control config; trying to claim directly: {message}", "获取验证码": "Get code", "该上游无需鉴权(不发送鉴权头)": "This upstream needs no authentication (no auth headers are sent)", "该提供商": "This provider", "该提供商账号添加功能即将上线": "Account adding for this provider is coming soon", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "This custom provider no longer exists (it may have been deleted); refresh and try again", "请先选择一个自定义提供商": "Select a custom provider first", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "Complete the verification in the slider popup (a risk-control step required by the vendor)", "请填写 11 位大陆手机号": "Enter an 11-digit mainland China phone number", "请填写 6 位数字验证码": "Enter the 6-digit code", "请填写 Base URL": "Enter the Base URL", "请填写 {label}": "Enter {label}", "请填写名称": "Enter a name", "请完成验证…": "Complete the verification…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "Reads and decrypts %APPDATA%/AutoClaw/auth.json; Windows only", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Reads ~/.cline/data/settings/providers.json; requires being signed in to the Cline client", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Reads ~/.meituan-catpaw/auth.json; requires being signed in to the CatPaw client", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Reads the local KukuAI client login state (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requires being signed in to the KukuAI client", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Reads the local client's current login state (plaintext Cookie, no decryption needed). The Cookies file is exclusively locked while the client runs, so close the KukuAI client before importing.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, click \"Refresh token\" to sync.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, just re-import.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). Users who sign in to the client with Zai / Google should use this one.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). This one is grouped under {label}.", "账号信息": "Account info", "账号信息不完整,请刷新后重试": "Account info is incomplete; refresh and try again", "账号已添加,但请留意:{warning}": "Account added, but note: {warning}", "账号版本": "Account edition", "账号类型": "Account type", "账号:{name}
    ": "Account: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Routes through Inference Providers; create the Key at hf.co/settings/tokens", "还没有账号": "No accounts yet", "这一家当前不支持网页登录,请改用填写凭证": "This provider does not support web login right now; use Enter credentials instead", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "This account has no campaigns that can be claimed automatically right now (only the daily login gift points are claimed automatically)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "This quota goes through the Start Plan channel: if forwarding reports that the Coding Plan has expired, ", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the China site (monkeycode-ai.com) account: paste the China site's session. The international site (monkeycode-ai.net) is another provider with its own account; credentials are not interchangeable between the two.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the international site (monkeycode-ai.net) account: paste the international site's session. The China site (monkeycode-ai.com) is another provider with its own account; credentials are not interchangeable between the two.", "选择凭证文件导入": "Import from credential file", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Select the official client's session credential file (workbuddy-desktop.info / workbuddy-desktop-ai.info) or an account JSON exported by wb2api (nested or flat); you can also read it directly from the official client on this machine.", "选择提供商": "Select provider", "选择的文件不是合法 JSON": "The selected file is not valid JSON", "选择要添加账号的提供商": "Select the provider to add an account for", "重新扫描": "Rescan", "鉴权": "Authentication", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan (International site)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding plan (China site)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding plan (International site)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio model service (International site, OpenAI-compatible mode)", "需要图形验证码:登录窗口已弹出,请填写后继续": "Captcha required: the sign-in window has opened; fill it in to continue", "预置 API": "Preset API", "领取 CodeArts 每日福利": "Claim CodeArts daily welfare", "领取失败:{message}": "Claim failed: {message}", "领取并让官方确认": "Claim and await confirmation", "风控验证配置不完整,请稍后重试": "Risk-control verification config is incomplete; try again later", "验证码": "Verification code", "验证码已发送。收到后填入下方并点「登录并添加」": "Code sent. Enter it below and click \"Sign in and add\"", "验证码已发送,请查看手机短信": "Code sent; check your SMS", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "Code sent; check your SMS. Enter it below and click \"Sign in and add\" to finish signing in", "验证码已发送,请查看短信": "Code sent; check your messages", "验证码校验失败,请重试": "Code verification failed; try again", "验证码校验超时,请重试": "Code verification timed out; try again", "验证码组件不可用,请重试": "Verification component unavailable; try again", "验证码组件初始化超时,请重试": "Verification component initialization timed out; try again", "验证码组件加载失败,请检查网络后重试": "Verification component failed to load; check your network and try again", "验证码组件加载异常,请重试": "Verification component encountered a loading error; try again", "验证码组件加载超时,请检查网络后重试": "Verification component timed out while loading; check your network and try again", "验证码组件未加载,请重启应用后重试": "Verification component not loaded; restart the app and try again", "(免费额度池,模型名带 cline-free/ 前缀)。": " (free quota pool; model names carry the cline-free/ prefix).", "(其中 {n} 把恢复为不限制)": " ({n} of which are now unrestricted)", "(必填)": " (Required)", "(有效期 {window})": "(valid {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (subscription pool; model names carry the cline-pass/ prefix and the account needs the matching subscription).", ",下一次最快 {minutes} 分钟后": ", earliest next attempt in {minutes} min", ",并从 {n} 把 Key 的可用提供商里移除": ", and removed it from the allowed providers of {n} keys" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · Models: {head}{rest}", " 等 {n} 个": " ({n} total)", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "Google refresh token starting with 1// (you can also paste the whole refresh_token=… line)", "11 位大陆手机号": "11-digit mainland China mobile number", "1~64 个字符,账号列表里按它分组显示": "1-64 characters; accounts are grouped by it in the account list", "6 位数字": "6 digits", "

  • 没有可自动领的活动
  • ": "
  • No campaigns can be claimed automatically
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    What you receive is plan gift points, which do not add to the welfare model token pool; ", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "The Anthropic-compatible endpoint is https://api.deepseek.com/anthropic (fill it in when you switch the protocol to anthropic)", "Anthropic 协议填根地址,不要带 /v1": "For the Anthropic protocol, use the root URL without /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw China edition", "AutoClaw 国际版": "AutoClaw International edition", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS is required; paste the **full Cookie** (a Cookie editor can export it in one click) — the **PTOKEN must be kept**, as the gateway uses it to exchange for a KukuAI business session token from Baidu; without it, model refresh reports \"Not signed in\". A full Cookie header, a JSON array exported by a Cookie editor, or a {BDUSS, STOKEN} object are all supported. KukuAI has no refresh mechanism, so once the login state expires, just paste it again.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (or the JSON exported by a Cookie editor)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw's X-Passport-Token (login-state Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (three dot-separated segments)", "Command Code": "Command Code", "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "JWT (three dot-separated segments; you can also paste the whole Bearer line or the data.bin content)", "ModelScope 国内版": "ModelScope China edition", "ModelScope 国际版": "ModelScope International edition", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode International edition", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM managed endpoint; apply for the Key at integrate.api.nvidia.com", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken is Accio's login credential (a long opaque token, not a JWT); refreshToken is optional and enables automatic renewal on expiry. Enter the credential of the {label} account — {siteNote} (the easiest way to get it: just use \"Web login\" above; no need to hunt for the token manually.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken is Trae's Cloud-IDE-JWT (three dot-separated segments), and refreshToken enables automatic renewal on expiry (this provider rotates refreshToken on every use: once exchanged, the old one is void, so do not refresh the same account from two programs at once).
    When pasting manually, fill in machineId / deviceId as well: upstream ties them to the device public key uploaded at sign-in to identify the device, and swapping in a new pair from nowhere triggers the 2xxxx family of device-binding rejections.
    Without these three, the proper route is \"Web login\" above; for container / remote deployments, paste the callback URL from the address bar as prompted.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "The value of monkeycode_ai_session (you can also paste the whole Cookie)", "ms- 开头的 API 令牌": "API token starting with ms-", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken is optional and enables automatic renewal on expiry; both can be obtained from the Raccoon client login-state file.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken is optional and enables automatic renewal; both can be obtained from the client login-state file. The same Cline account works in both pools; here it is grouped under {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token supports the enc: prefix (decrypted automatically on Windows). Without a refreshToken, automatic renewal is not possible.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token is the login-state Cookie; CatPaw has no refresh mechanism, so sign in again in the client after it expires.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "API Key starting with user_ (you can also paste the whole Authorization: Bearer … line)", "{label} 网页登录的打开方式": "How to open {label} web login", "{label} 账号地区": "{label} account region", "{label} 账号的添加方式": "How to add a {label} account", "{name} 不是合法 JSON:{reason}": "{name} is not valid JSON: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name} requires a JSON object (like {sample})", "{n} 个账号": "{n} accounts", "{n} 个账号,点击添加": "{n} accounts, click to add", "{seconds}s 后重发": "Resend in {seconds}s", "✅ {label}账号已添加": "✅ {label} account added", "✅ {label}账号已添加{name}": "✅ {label} account added{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ Imported {n} providers from cc-switch", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ Created custom provider \"{name}\" and added an account", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ Deleted custom provider \"{name}\"{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ Signed in; {edition} account added to the list", "✅ 领取成功:{planId}{period}": "✅ Claim successful: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " One provider can hold multiple keys, rotated by priority.", "「{name}」的账号添加功能还在开发中,敬请期待。": "Adding accounts for \"{name}\" is still in development — stay tuned.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "One Key works across many vendors; use the full \"vendor/model\" name (e.g. deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "Leave blank when the upstream needs no authentication, and check the option below (blank without the checkbox counts as no credential configured)", "上游信息": "Upstream info", "不可领({status})": "Not claimable ({status})", "不支持导入": "Import not supported", "不是有效的凭证文件:内容要是一个 JSON 对象": "Not a valid credential file: the content must be a JSON object", "不是有效的凭证文件:需要包含 accessToken 与 uid": "Not a valid credential file: accessToken and uid are required", "不是自定义提供商": "Not a custom provider", "不需要 Key:转发与拉取模型都不发送鉴权头": "No Key needed: neither forwarding nor model fetching sends auth headers", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "Both editions' accounts can be saved at once, each with its own model catalog (the China and International editions are two providers that can be enabled and mapped separately).", "中国版": "China edition", "今天没有需要领的活动(都已到账)": "No campaigns to claim today (all already credited)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "Tried {attempts} times today (Beijing time {day}); {left} attempts left{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "Grab three items from another machine (or from the OfficeAce desktop app's models.json) and paste them here: the model gateway base URL (baseUrl, shaped like https://modelgw-…/v2) plus modelAppKey / modelAppSecret. These three are enough to forward requests (the gateway credential never expires); the control-plane temporary credentials (accessKeyId and so on) are optional — leaving them blank disables balance queries and auto-renewal but does not affect forwarding.", "从本机导入桌面端登录态": "Import desktop login state from this machine", "任务镜像 id": "Task image id", "使用 Google 账号登录": "Sign in with Google", "使用 Zai 账号登录": "Sign in with Zai", "使用个人访问令牌(PAT)": "Use a personal access token (PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "Free models need no Key (\"This upstream needs no authentication\" is checked by default, and the gateway uses anonymous credentials automatically); for paid models, enter your Zen API Key. The free tier only accepts the official client form, so \"Emulate the official OpenCode client\" is on by default", "内嵌窗口": "Embedded window", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "Opens in the embedded window; closing it cancels the wait (if a Google account is rejected, switch to the system browser)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "Opens in the embedded window; added to the list when done; closing it cancels the wait", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "The embedded window uses a fresh environment, so multiple accounts do not affect each other; closing it cancels the wait", "内嵌窗口(推荐)": "Embedded window (recommended)", "准备验证…": "Preparing verification…", "凭据 JSON": "Credential JSON", "凭证文件在哪?": "Where is the credential file?", "创建并添加账号": "Create and add account", "创建这个提供商,并同时建立它的第一个账号。": "Create this provider and its first account in one step.", "删除功能不可用(脚本未就绪)": "Delete is unavailable (script not ready)", "删除失败:{reason}": "Delete failed: {reason}", "删除此提供商": "Delete this provider", "及 {n} 个账号": " and {n} accounts", "发送中…": "Sending…", "发送失败:{message}": "Send failed: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "Send unconfirmed: the sign-in window has opened; complete the sign-in manually in that window", "取消失败:{message}": "Cancel failed: {message}", "取消等待": "Cancel sign-in", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "Only the Embedded window can restore third-party options: we cannot modify the sign-in page in the system browser", "可选": "Optional", "可选(cloudaicompanionProject):留空由网关自动发现": "Optional (cloudaicompanionProject); if blank, the gateway discovers it automatically", "可选,展示用": "Optional; for display", "可选,没有则无法自动续期": "Optional; without it, automatic renewal is not possible", "可选,留空使用凭据里的 user_name": "Optional; defaults to the user_name in the credential", "可选,留空使用账号姓名、邮箱或令牌指纹": "Optional; defaults to the account name, email, or token fingerprint", "可选,留空使用账号昵称或邮箱": "Optional; defaults to the account nickname or email", "可选,留空则用 key 尾号": "Optional; defaults to the key suffix", "可选,留空则用 userId": "Optional; defaults to userId", "可选,留空则用上游账号昵称": "Optional; if left blank, the upstream account's nickname is used", "可选,留空则用上游返回的账号名或账号 id": "Optional; defaults to the account name or account id returned by upstream", "可选,留空则用凭证里的账号名": "Optional; defaults to the account name in the credential", "可选,留空则用文件里的昵称": "Optional; leave empty to use the nickname from the file", "可选,留空则用登录名或 uid": "Optional; defaults to the login name or uid", "可选,留空则用脱敏手机号": "Optional; defaults to the masked phone number", "可选,留空则用脱敏手机号或 userId": "Optional; defaults to the masked phone number or userId", "可选,留空则用账号 uk": "Optional; defaults to the account uk", "可选,留空则用账号昵称或 userId": "Optional; defaults to the account nickname or userId", "可选,留空则用邮箱或令牌尾号": "Optional; defaults to the email or token suffix", "可选,留空用「OfficeAce 果办」": "Optional; defaults to “OfficeAce”", "可选,留空自动生成": "Optional; generated automatically if blank", "可选,留空自动用昵称": "Optional; defaults to the nickname", "可选,续期时带上": "Optional; sent when renewing", "可选,讯飞侧 userid": "Optional; the userid on the iFlytek side", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "Optional; required to start a conversation. If blank, the gateway discovers it automatically from this account's existing tasks; if it cannot find one, fill it in manually later.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "Optional; the account email, used for display and to recognize the identity (the same account is recognized even after switching to a new token)", "可选;UUID 形态,与凭据同生共死": "Optional; UUID form, lives and dies with the credential", "可选;填了才能到期自动续期": "Optional; required for automatic renewal on expiry", "可选;用于去重与展示名(留空时网关会问一次上游)": "Optional; used for deduplication and the display name (when blank, the gateway asks upstream once)", "可选;用于生成账号 id 与展示名": "Optional; used to generate the account id and display name", "可选;纯数字串(上游只收 8–24 位数字)": "Optional; digits only (upstream accepts only 8–24 digits)", "可领取": "Claimable", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "They can be mixed under one provider: Key accounts and no-auth accounts each follow their own rules", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "Switch the protocol to anthropic on the same address to use its Claude-compatible endpoint. Forwarding requires an OpenCode Go API Key (subscription-based; fetching the model catalog needs no Key, but requests get a 401 \"Missing API key\" from upstream)", "响应为空": "Empty response", "国内版": "China edition", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "The China edition and **the International edition are two separate sets of accounts and plans**; credentials and claimed plans do not carry over between them.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "The China edition's sign-in page has no Google / GitHub options (it uses WeChat / phone / email sign-in)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "The China edition's sign-in site is www.accio-ai.com, a different site from the International edition's.", "国内版(WorkBuddy)": "China edition (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "China site: https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "China site (minimaxi.com); the OpenAI-compatible address is https://api.minimaxi.com/v1", "国际版": "International edition", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "The International edition z.ai Coding plan; the OpenAI-compatible address is https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "The International and China editions are **two separate sets of accounts** (two sites of the same account system); credentials do not carry over.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "The International and China editions have separate account systems; enter the International edition's credentials. Without a refreshToken, automatic renewal is not possible.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "The International edition's sign-in page shows only email sign-in by default; checking this restores the Google / GitHub / X options", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "The International edition's inference site is api.z.ai, a different site from the China edition's; plans are separate as well.", "国际版(WorkBuddy AI)": "International edition (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "International site Coding plan; the OpenAI-compatible address is https://api.minimax.io/v1", "在 cc-switch 里找到": "Found", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "Complete the official sign-in in the embedded window; the account is added to the list automatically on success.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "Generate a PAT in the Qoder account settings → Integrations for {label} (do not use a Google / GitHub token). Accounts and credentials do not carry over between the two regions.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "In the window that opens, sign in to the KukuAI main site with your Baidu account (SMS code or QR scan both work); the account is added to the list automatically on success. The gateway exchanges it with Baidu for a KukuAI business session token (requires the KukuAI client installed on this machine).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "Sign in with your Google account in the window that opens (Antigravity's authorization page); the account is added to the list automatically once authorization completes.", "在浏览器中打开登录页": "Open the sign-in page in your browser", "地区": "Region", "填写凭证": "Enter credentials", "填写凭证添加": "Enter credentials to add", "备注名": "Label", "套餐": "Plan", "如:智谱 GLM": "e.g. Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "Added to the account list automatically after sign-in; the nickname comes from upstream.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "Official client credential directory: Windows — C:\\Users\\\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth; macOS — ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "Officially confirmed as credited", "导入": "Import", "导入中…": "Importing…", "导入凭证文件": "Import credential file", "导入失败": "Import failed", "导入失败:{reason}": "Import failed: {reason}", "导入所选": "Import selected", "导入所选({n})": "Import selected ({n})", "导入桌面端登录态": "Import desktop login state", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "The embedded window will open; the account is added to the list automatically once authorization completes. Closing the window cancels the wait. The authorization page may end with a message that it cannot open the zcode:// link — that is normal; the result has already been recorded server-side", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "The embedded window will open; the account is added to the list automatically once authorization completes. On a remote panel you can paste the callback URL. Closing the window cancels the wait. The link is valid for 5 minutes; if it times out or is not clicked, it is voided (you can start again)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "The embedded window will open; the account is added to the list automatically after sign-in. Closing the window cancels the wait", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "The authorization page will open in your system default browser (reusing the Trae account already signed in there); on the same machine the account is added automatically when done. For Docker / remote panels, paste the callback URL from the address bar as prompted.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "The authorization page will open in your system default browser (reusing the ZCode account already signed in there); the account is added to the list automatically once authorization completes. A final message that the zcode:// link cannot be opened is normal", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "The authorization page will open in your system default browser (reusing the Huawei Cloud account already signed in there); when the browser and the gateway are not on the same machine, paste the final callback URL back into the panel as described above", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "The sign-in page will open in your system default browser (reusing the Accio account already signed in there); the account is added to the list automatically after sign-in, and closing the popup cancels the wait", "小米 MiMo Token Plan 套餐(新加坡站)": "Xiaomi MiMo Token Plan (Singapore site)", "已到账": "Credited", "已取消登录等待": "Pending sign-in canceled", "已取消领取": "Claim canceled", "已取消验证码": "Verification canceled", "已填写手机号,正在发送验证码…": "Phone number entered; sending the code…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "Marked as needing no authentication: the account is routed normally, and no auth headers are sent outbound", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "Imported {ok}, failed {fail} (failed items are marked in the list)", "已建过 · {n} 个账号,点击继续添加": "Already created · {n} accounts, click to add more", "已建过,点击继续添加账号": "Already created, click to add another account", "已打开官方登录页,请在窗口中完成登录…": "Official sign-in page opened; complete sign-in in the window…", "已点发送,等待短信…": "Sent; waiting for the SMS…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "Sign-in page opened in your system default browser; complete sign-in in the browser…", "已领取,等官方确认": "Claimed, awaiting official confirmation", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "This app version does not support AutoClaw web login; update the app", "当前没有可领取的套餐(活动尚未开始)": "No plans are available to claim right now (the event has not started yet)", "当前环境不支持领取(桥接方法缺失)": "Claiming is not supported in this environment (bridge method missing)", "必填,CatPaw 账号标识": "Required; CatPaw account identifier", "恢复 Google / GitHub 入口": "Restore Google / GitHub options", "手机号": "Phone number", "手机验证码登录": "SMS code login", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Open the official authorization page for Trae SOLO (trae.cn) and sign in with your Trae account: once authorized, the official page redirects back to a temporary port on this machine; a same-machine deployment receives it automatically, while Docker / remote panels should copy the callback URL from the address bar as prompted.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Open the official sign-in page for Accio {label} ({site}) and sign in with your Accio account: on success the official page redirects back to this machine; a same-machine setup completes automatically, while Docker / remote panels just paste the callback URL as prompted (the authorization code is passed to the gateway only on this machine, and no plaintext token is shown in the UI).", "打开 Accio {label}登录页": "Open the Accio {label} sign-in page", "打开 Antigravity 网页登录": "Open Antigravity web login", "打开 CatPaw 网页登录": "Open CatPaw web login", "打开 Cline 授权页": "Open Cline authorization page", "打开 CodeArts 授权页": "Open CodeArts authorization page", "打开 Qoder 网页登录": "Open Qoder web login", "打开 Trae 授权页": "Open Trae authorization page", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "Open the official authorization page for ZCode {label} and sign in with your account. The authorization result is recorded by the ZCode server; the gateway fetches the credential in the background and adds the account to the list.", "打开 ZCode {label}授权页": "Open the ZCode {label} authorization page", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Open the official Huawei Cloud CodeArts authorization page to sign in: once done, the official page brings the browser back to the gateway's own /oauth/callback, and the gateway exchanges the one-time authorization code for temporary credentials and adds the account to the list.
    When the gateway runs on another machine, the web UI prompts you to paste the final callback URL from the address bar back into the panel.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Open the Huawei Cloud authorization page and sign in: once finished, the gateway automatically polls the cloud for the authorization code and adds the account to the list (no OfficeAce desktop app required, and no need to paste a callback URL back manually).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "Open the official authorization page and complete the device-code authorization; you will be signing in to a {label} ({site}) account.", "打开授权页": "Open the authorization page", "打开授权页完成确认,账号自动加入 {label}{note}": "Open the authorization page and confirm; the account is added to {label} automatically{note}", "打开方式": "Open with", "打开网页登录": "Open web login", "探测失败:{message}": "Probe failed: {message}", "接入一个兼容上游": "Connect a compatible upstream", "提交中…": "Submitting…", "搜索提供商": "Search providers", "搜索提供商…": "Search providers…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "Paste the whole credential JSON written to disk by the official plugin / CLIProxyAPI (like {\"codearts_provider_credential\":{…}}; a flattened form also works).
    Required: access_key_id, secret_access_key, security_token.For automatic renewal you must paste refresh_token and oauth_context as well — temporary credentials expire in about an hour, and without that half they cannot be renewed; you would have to sign in again.", "文件是{edition}凭证,已按该版本导入": "The file contains {edition} credentials and has been imported as that edition", "新建自定义提供商": "New custom provider", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "Plaintext JWT, or the enc: encrypted value in auth.json (decrypted automatically)", "明文 JWT(国际版账号的 access token)": "Plaintext JWT (the access token of an International edition account)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu's bigmodel.cn Coding plan; get the Key at open.bigmodel.cn/usercenter/apikeys", "未知错误": "Unknown error", "未能获取授权地址,请重试": "Could not get the authorization URL; try again", "未能读取 cc-switch 数据": "Could not read cc-switch data", "未领取成功": "Claim unsuccessful", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "Check this for upstreams like local Ollama or the OpenCode Zen free tier; otherwise the account cannot be used", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "This provider has two credentials that **do not replace each other**; fill in the one(s) for the features you need, at least one: the Coding Plan API Key is used for forwarding inference (hits {site}) and for querying the window limits (the remaining percentage of each N-hour / weekly window); the jwt is used for claiming plans and querying balance (hits the billing gateway at zcode.z.ai; officially called a Coding Plan JWT, a three-segment dot-separated string). Either one can query balance, but they read different things: the jwt reads the balance buckets and the plan expiry, while the API Key reads the window limits; and claiming only accepts the jwt, forwarding only accepts the API Key. Please enter the credentials for the {label} account — {plan} (the easiest way: just use \"Web login\" above — it exchanges this API Key for you and gets both credentials at once.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "The local Ollama OpenAI-compatible endpoint; no API Key needed (\"This upstream needs no authentication\" is checked by default, and no auth headers are sent at all)", "本次未确认到账": "Not confirmed as credited this time", "条可导入": "are importable", "条配置,其中": "configs in cc-switch, of which", "桌面运行时不可用(Tauri 未初始化)": "Desktop runtime unavailable (Tauri not initialized)", "模型网关基址": "Model gateway base URL", "正在打开百度登录页…": "Opening the Baidu sign-in page…", "正在扫描本机 cc-switch…": "Scanning cc-switch on this machine…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "Waiting for {name} sign-in to finish; you can start a new sign-in only after it completes or is canceled", "每周": "Weekly", "每日": "Daily", "每月": "Monthly", "没有则无法自动续期": "Without it, automatic renewal is not possible", "没有匹配「{keyword}」的提供商": "No providers match \"{keyword}\"", "添加 {name} 账号": "Add {name} account", "添加中…": "Adding…", "添加到 ": "Add to ", "添加失败:{reason}": "Add failed: {reason}", "添加小浣熊账号": "Add Raccoon account", "添加方式": "Add method", "添加账号": "Add account", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding plan; the general inference endpoint is https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "Click to add an account", "点开即预填,填 Key 接入": "Opens prefilled; enter your Key to connect", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "After clicking the button, first pass a slider verification (the vendor's risk control), then the sign-in page opens and the account is added automatically once you sign in.
    This is the only official sign-in method for the International edition; if you are already signed in to the client, \"Import desktop login state\" is faster.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "Sign in with the phone number bound to your AutoClaw account: click \"Get code\", then enter the SMS code below and sign in. The code is submitted from this machine directly to the official API; no token is shown in the UI.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "Sign in with your CatPaw account (Meituan Passport); the account is added to the list automatically on success.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Sign in with the phone number bound to your Loomy account: click \"Get code\" and enter it. This is the easiest way in for this provider.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "Used for forwarding; two dot-separated segments like apiKey.secret (if left blank, this account cannot forward)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "Used for claiming plans and querying balance; if left blank, this account cannot claim or check balance", "用户 ID": "User ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "Sign in with your bound phone number: click \"Get code\" and enter it. This is the only official sign-in method for the China edition.", "留空则用提供商名称": "Leave blank to use the provider name", "登录 / 添加 {name} 账号": "Sign in / add {name} account", "登录 session(一长串)": "Login session (a long string)", "登录中…": "Signing in…", "登录失败:{message}": "Sign-in failed: {message}", "登录已结束": "Sign-in has ended", "登录并添加": "Sign in and add", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "Login-state file path: ~/.box-agent/config/auth.json (Windows: C:\\Users\\\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "Delete custom provider \"{name}\"? This will also delete {count} accounts under it; deletion cannot be undone.", "等待 Accio {label}登录完成…": "Waiting for Accio {label} sign-in…", "等待 CatPaw 登录完成…": "Waiting for CatPaw sign-in…", "等待 Cline 授权确认…": "Waiting for Cline authorization confirmation…", "等待 CodeArts 登录完成…": "Waiting for CodeArts sign-in…", "等待 Google 授权完成…": "Waiting for Google authorization…", "等待 KukuAI 登录完成…": "Waiting for KukuAI sign-in…", "等待 OfficeAce 登录完成…": "Waiting for OfficeAce sign-in…", "等待 Qoder 授权完成…": "Waiting for Qoder authorization…", "等待 Trae 授权完成…": "Waiting for Trae authorization…", "等待 ZCode {label}授权完成…": "Waiting for ZCode {label} authorization…", "等待小浣熊登录完成…": "Waiting for Raccoon sign-in…", "等待登录完成…": "Waiting for sign-in…", "等待网页登录…": "Waiting for web login…", "粘贴 API Key": "Paste API Key", "粘贴 API 令牌": "Paste API token", "粘贴 Accio 的 accessToken": "Paste the Accio accessToken", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Paste Antigravity's Google refresh token (starts with 1//; pasting the whole line containing refresh_token= also works).
    This is a manual entry besides web login (for example, exported from the official IDE you are already signed in to). The refresh token does not expire, and the gateway renews the access token automatically when it expires; if the token is lost, you can only go through Google authorization again, so keep it safe.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Paste the Command Code API Key (starts with user_; get it from the official CLI's ~/.commandcode/auth.json or the web studio). Pasting the whole line / with quotes / with the Bearer prefix all work; the gateway strips it down to the bare key itself. The key does not expire and there is no renewal API, so if it stops working just get a new one. When adding, the gateway runs a lightweight liveness check; a failure does not affect adding.", "粘贴 Cookie": "Paste Cookie", "粘贴 Google refresh token": "Paste Google refresh token", "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "Paste a ModelScope API token (starting with ms-, obtained from the \"Access Tokens\" page on {site}).
    {siteNote}
    This token serves two purposes: the gateway uses it both to call inference and to read the account identity, Magicube balance, and daily check-in. The token is long-lived with no renewal API; if it stops working, just obtain a new one and paste it again.", "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "Paste OrcaTerm's OAuth accessToken (a JWT with three dot-separated segments; obtain it from the desktop client's data.bin or the Web version's ot_session cookie). You may also paste the whole line containing Bearer / ot_session=; the gateway strips it down to the bare token. After adding, the gateway renews it automatically (upstream provides a renewal endpoint), so you need not chase the 2-hour expiry manually.", "粘贴 Qoder 个人访问令牌(pt-…)": "Paste the Qoder personal access token (pt-…)", "粘贴 accessToken": "Paste accessToken", "粘贴 access_token(一长串 JWT)": "Paste access_token (a long JWT)", "粘贴 session cookie": "Paste session cookie", "粘贴 token / refreshToken": "Paste token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "Paste a token starting with workos:… (the prefix is added automatically if missing)", "粘贴登录凭据": "Paste login credentials", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "What you paste is the login session (which is also the model gateway token). Loomy has no renewal API; the session is valid for about 14 days, so just sign in again after it expires.", "粘贴网关凭据": "Paste gateway credentials", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "Paste the value of the web session cookie monkeycode_ai_session (copying the whole Cookie in the browser and pasting it directly also works; the gateway extracts the value itself).
    {siteNote}
    MonkeyCode has no renewal API: the session is valid for about 30 days (a hard limit); once it expires, sign in to the web page again and paste it one more time.", "系统浏览器": "System browser", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "The system browser can reuse an existing login state (recommended for the International edition); the embedded window is cleaner.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Cline account); added to the list when done", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "Opens in the system browser (reuses the Google account already signed in); added to the list when done", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Zai / Google account); added to the list when done", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "Opens in the system browser (reuses the signed-in Meituan account); added to the list when done", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "Opens in the system browser (reuses a signed-in account); added to the list when done", "系统默认浏览器": "System default browser", "编码套餐 API Key": "Coding Plan API Key", "网关 Secret": "Gateway secret", "网页登录": "Web login", "网页登录的打开方式": "How to open web login", "网页登录(Zai / Google)": "Web login (Zai / Google)", "自定义": "Custom", "获取风控配置失败,将直接尝试领取:{message}": "Failed to get the risk-control config; trying to claim directly: {message}", "获取验证码": "Get code", "该上游无需鉴权(不发送鉴权头)": "This upstream needs no authentication (no auth headers are sent)", "该提供商": "This provider", "该提供商账号添加功能即将上线": "Account adding for this provider is coming soon", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "This custom provider no longer exists (it may have been deleted); refresh and try again", "请先选择一个自定义提供商": "Select a custom provider first", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "Complete the verification in the slider popup (a risk-control step required by the vendor)", "请填写 11 位大陆手机号": "Enter an 11-digit mainland China phone number", "请填写 6 位数字验证码": "Enter the 6-digit code", "请填写 Base URL": "Enter the Base URL", "请填写 {label}": "Enter {label}", "请填写名称": "Enter a name", "请完成验证…": "Complete the verification…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "Reads and decrypts %APPDATA%/AutoClaw/auth.json; Windows only", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Reads ~/.cline/data/settings/providers.json; requires being signed in to the Cline client", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Reads ~/.meituan-catpaw/auth.json; requires being signed in to the CatPaw client", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Reads the local KukuAI client login state (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requires being signed in to the KukuAI client", "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "Read this machine's OrcaTerm client login state (%APPDATA%\\com.orcaterm-desktop.app\\data.bin); you must already be signed in to the OrcaTerm client", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Reads the local client's current login state (plaintext Cookie, no decryption needed). The Cookies file is exclusively locked while the client runs, so close the KukuAI client before importing.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, click \"Refresh token\" to sync.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). After signing in again in the client, just re-import.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). Users who sign in to the client with Zai / Google should use this one.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Reads the local client's current login state live each time (deleting this record does not affect the client's login state). This one is grouped under {label}.", "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "Read the OAuth token currently signed in on this machine's client (plain-text JSON, no decryption needed). After importing, the gateway renews it automatically, so you need not follow the client's 2-hour expiry to swap tokens manually.", "账号信息": "Account info", "账号信息不完整,请刷新后重试": "Account info is incomplete; refresh and try again", "账号已添加,但请留意:{warning}": "Account added, but note: {warning}", "账号版本": "Account edition", "账号类型": "Account type", "账号:{name}
    ": "Account: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Routes through Inference Providers; create the Key at hf.co/settings/tokens", "还没有账号": "No accounts yet", "这一家当前不支持网页登录,请改用填写凭证": "This provider does not support web login right now; use Enter credentials instead", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "This account has no campaigns that can be claimed automatically right now (only the daily login gift points are claimed automatically)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "This quota goes through the Start Plan channel: if forwarding reports that the Coding Plan has expired, ", "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "This is for the China site (modelscope.cn) account: paste the China site's token. The international site (modelscope.ai) is another provider with its own account; tokens are not interchangeable between the two.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the China site (monkeycode-ai.com) account: paste the China site's session. The international site (monkeycode-ai.net) is another provider with its own account; credentials are not interchangeable between the two.", "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "This is for the international site (modelscope.ai) account: paste the international site's token. The China site (modelscope.cn) is another provider with its own account; tokens are not interchangeable between the two.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "This is for the international site (monkeycode-ai.net) account: paste the international site's session. The China site (monkeycode-ai.com) is another provider with its own account; credentials are not interchangeable between the two.", "选择凭证文件导入": "Import from credential file", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Select the official client's session credential file (workbuddy-desktop.info / workbuddy-desktop-ai.info) or an account JSON exported by wb2api (nested or flat); you can also read it directly from the official client on this machine.", "选择提供商": "Select provider", "选择的文件不是合法 JSON": "The selected file is not valid JSON", "选择要添加账号的提供商": "Select the provider to add an account for", "重新扫描": "Rescan", "鉴权": "Authentication", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan (International site)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding plan (China site)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding plan (International site)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio model service (International site, OpenAI-compatible mode)", "需要图形验证码:登录窗口已弹出,请填写后继续": "Captcha required: the sign-in window has opened; fill it in to continue", "预置 API": "Preset API", "领取 CodeArts 每日福利": "Claim CodeArts daily welfare", "领取失败:{message}": "Claim failed: {message}", "领取并让官方确认": "Claim and await confirmation", "风控验证配置不完整,请稍后重试": "Risk-control verification config is incomplete; try again later", "验证码": "Verification code", "验证码已发送。收到后填入下方并点「登录并添加」": "Code sent. Enter it below and click \"Sign in and add\"", "验证码已发送,请查看手机短信": "Code sent; check your SMS", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "Code sent; check your SMS. Enter it below and click \"Sign in and add\" to finish signing in", "验证码已发送,请查看短信": "Code sent; check your messages", "验证码校验失败,请重试": "Code verification failed; try again", "验证码校验超时,请重试": "Code verification timed out; try again", "验证码组件不可用,请重试": "Verification component unavailable; try again", "验证码组件初始化超时,请重试": "Verification component initialization timed out; try again", "验证码组件加载失败,请检查网络后重试": "Verification component failed to load; check your network and try again", "验证码组件加载异常,请重试": "Verification component encountered a loading error; try again", "验证码组件加载超时,请检查网络后重试": "Verification component timed out while loading; check your network and try again", "验证码组件未加载,请重启应用后重试": "Verification component not loaded; restart the app and try again", "(免费额度池,模型名带 cline-free/ 前缀)。": " (free quota pool; model names carry the cline-free/ prefix).", "(其中 {n} 把恢复为不限制)": " ({n} of which are now unrestricted)", "(必填)": " (Required)", "(有效期 {window})": "(valid {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (subscription pool; model names carry the cline-pass/ prefix and the account needs the matching subscription).", ",下一次最快 {minutes} 分钟后": ", earliest next attempt in {minutes} min", ",并从 {n} 把 Key 的可用提供商里移除": ", and removed it from the allowed providers of {n} keys" }); diff --git a/desktop-tauri/ui/i18n/en/checkin.js b/desktop-tauri/ui/i18n/en/checkin.js index c42e3822..59ace287 100644 --- a/desktop-tauri/ui/i18n/en/checkin.js +++ b/desktop-tauri/ui/i18n/en/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:en/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO checkin_credits claims · reset at midnight (calendar day)", "UMID 组件安装失败:{error}": "UMID component installation failed: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Query the task tree, then light up / claim in one click · includes the school-season event and cat travel · click a row for details", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy International keep-alive models, tried in order", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Free models for WorkBuddy International daily activity · one global setting, unrelated to schedules", "{date}(每天 {time})": "{date} (daily at {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} to complete", "{n} 项待领": "{n} to claim", "{total} 账号 · {done} 已签": "{done} of {total} checked in", "{total} 项任务 · {pending} 项可完成": "{total} tasks · {pending} to complete", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID component installed — the next check-in can claim International points", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Scheduled check-in enabled", "✅ 开学季任务执行完成": "✅ School-season tasks completed", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Growth tasks completed: credits +{credit}, energy +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Starter rewards claimed, {n} points earned in total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in complete: {succeeded}/{total} accounts claimed successfully{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; submit empty to restore the default ({defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; clearing the list and saving restores the default chain (current default: {defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「免费领积分」的每日任务 · 逐个领取": "\"Free points\" daily tasks · claimed one by one", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "One-time rewards · queried and claimed automatically after check-in; once claimed they are recorded locally and no longer queried upstream · click a row to expand the task list", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Claims all of the day’s rewards in one action (daily check-in + newcomer gift) · idempotency guaranteed by the upstream", "一键安装组件": "Install component", "一键完成": "Complete all", "一键领取({n})": "Claim all ({n})", "上次执行:{line}": "Last run: {line}", "上次签到时间": "Last check-in", "上次领取 {time} · 领取需通过滑块验证码": "Last claimed {time} · claim requires passing a slider CAPTCHA", "下次 {date}": "Next {date}", "下次 {date} · 点此管理条目": "Next {date} · click to manage schedules", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below; its and ZCode's daily/plan benefits are claimed under \"Activity rewards\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below, and its daily welfare is right above under \"Daily check-in\"; ZCode plan claims are under \"Activity rewards\".", "与国内版同一套任务接口 · 站点不同": "Same task API as the China edition · different site", "今天已领 {n} 份": "Claimed {n} today", "今天未领": "Not claimed today", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Claimed today (Beijing time {day}) · {n} items confirmed received · can claim again tomorrow", "今日已执行": "Ran today", "今日已派出": "Sent out today", "今日已领取": "Claimed today", "今日签到": "Today", "今日签到进度": "Today's check-in progress", "从清单里移除": "Remove from the list", "保活": "Keep-alive", "保活 {n}": "{n} kept alive", "保活+领取": "Keep-alive + claim", "保活中…": "Keeping alive…", "保活模型链": "Keep-alive model chain", "全选": "Select all", "全部 {n} 家": "All {n} providers", "全部完成": "All done", "全部查询": "Query all", "全部结果": "All outcomes", "全部账号均可签到": "All accounts can check in", "全部领取": "All claimed", "关着:所有条目都不执行": "Off: no schedule runs", "删除失败:{error}": "Delete failed: {error}", "删除定时条目": "Delete schedule", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; CodeArts claims that day's campaign welfare (claim → confirm → read back to verify; automatic runs are limited to 6 write attempts per day with a 10-minute gap); OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点时逐个签到,已勾 {n} / {total} 家": "Checked {n} of {total} — each is checked in at the scheduled time", "北京时间 · 错过时点开机后会自动补签": "Beijing time · missed runs are made up automatically after startup", "去领取": "Claim now", "另有 {n} 个账号不参与每日签到": "{n} more accounts are not part of daily check-in", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Claim rewards of completed tasks only (idempotent; repeated clicks will not double-credit)", "可完成": "Can complete", "可派出": "Can send out", "可选 · 缺省显示时刻": "Optional · defaults to the time", "可领奖": "Can claim", "后端未返回定时签到数据": "Backend returned no schedule data", "后端未返回签到中心数据": "The backend did not return check-in center data", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "International check-in requires the UMID component to generate a device risk-control identity (not detected on this machine).", "在途": "Traveling", "填入缺省链": "Fill in default chain", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Pick a time and the providers, then click Save; the name is optional (the time is shown when empty)", "失败 {n}": "{n} failed", "套餐明细": "Plan details", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Install the Qoder client or qodercli to enable it (no need to restart the gateway).", "安装中…": "Installing…", "官方客户端的每日签到任务": "Official client's daily check-in task", "定时签到": "Scheduled check-in", "定时签到已关闭": "Scheduled check-in disabled", "尚未查询": "Not queried yet", "尚未查询任务状态": "Task status not queried yet", "巡检一次": "Run one round", "已保存:{label}": "Saved: {label}", "已保存:保活模型链": "Saved: Keep-alive model chain", "已保存:定时条目": "Saved: schedule", "已删除定时条目": "Schedule deleted", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Activity reported (streak lit up), but the campaign is not active (nothing to claim this time)", "已抽 {n} 次": "Drew {n} times", "已有结果 {checked} / 共 {total} 个账号": "Results for {checked} / {total} accounts", "已签": "Checked in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Claimed {claimed}/{total} · {earned} points earned", "已领养": "Adopted", "已领取": "Claimed", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Claim \"Daily 100 Credits\" with a device risk-control identity · requires the UMID component", "开学季执行失败:{error}": "School-season run failed: {error}", "开学季执行完成:{message}": "School-season run completed: {message}", "开学季活动": "School-season event", "开着:启用的条目按各自时刻执行": "On: enabled schedules run at their own times", "待签": "Not checked in", "待领新手福利": "Starter rewards to claim", "总开关": "Master switch", "总开关已关闭 · 在「定时签到」页打开": "Master switch is off · enable it on the \"Scheduled check-in\" tab", "成功 {n}": "{n} succeeded", "成长任务": "Growth tasks", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Growth tasks finished ({done} succeeded, {failed} failed): credits +{credit}, energy +{energy}", "成长任务执行失败:{error}": "Growth task run failed: {error}", "执行失败:{error}": "Run failed: {error}", "执行并抽奖": "Run & draw", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Run school-season tasks and spend all draw chances (share / chat / expert events)", "把缺省链填进清单,再点「保存」生效": "Puts the default chain into the list; click Save to apply", "抽奖机会 {n} 次": "{n} draw chances", "按住拖动调整顺序": "Press and drag to reorder", "按住拖动,调整这个模型在链里的顺序": "Press and drag to change this model's position in the chain", "按序逐个尝试,共 {n} 个": "{n} models, tried in order", "按结果筛选": "Filter by outcome", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detect + claim + keep-alive · same combo as scheduled check-in", "探测活动并领取日活奖励 · 不做保活": "Detect the campaign and claim the daily-activity reward · no keep-alive", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Accept + light up + claim (only tasks with verified recipes)", "搜账号 / 收益 / 错误 / 触发原因": "Search account / gain / error / trigger reason", "收起新建": "Close new entry", "新建定时条目": "New scheduled entry", "新手福利": "Starter rewards", "新手福利有 {n} 项领取失败,可重试": "{n} starter reward(s) failed to claim — you can retry", "无": "None", "无独立签到接口 · 每天替账号打一次首次登录积分": "No dedicated check-in API · awards first-login points once a day per account", "无账号": "No accounts", "暂不可领": "Not claimable yet", "暂不支持": "Not supported yet", "暂无启用的条目 · 点此添加": "No enabled schedules · click to add one", "有未保存的改动": "Unsaved changes", "未勾选提供商": "No provider selected", "未开启": "Off", "未解锁": "Locked", "未领养(领养需先完成当日对话量)": "Not adopted (adoption requires the daily chat quota first)", "未领取": "Not claimed", "本地台账里今天还没领过;活动期内每天发一份新套餐": "No claim recorded locally for today yet; a new plan is issued every day during the event", "本地台账里今天(北京时间)领过的套餐:{plans}": "Plans claimed today (Beijing time) according to the local record: {plans}", "条启用": "enabled", "查询于 {time}": "Queried at {time}", "查询任务": "Query tasks", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Query the task tree, then light up / claim in one click (includes school-season and cat travel)", "查询失败:{error}": "Query failed: {error}", "桌面端每日积分链路": "Desktop daily points flow", "正在读取定时签到数据…": "Loading schedule data…", "正在读取签到数据…": "Loading check-in data…", "每天 {time}": "Daily at {time}", "每天 {time} · {scope}": "Daily {time} · {scope}", "每天时刻": "Daily time", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "One row per account per check-in run · outcomes and gains as recorded by the backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Daily activity tasks · a web-app conversation lights up the daily activity, only claims add points · the two can run separately", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Daily welfare · claim → confirm → read back to verify · resets on the Beijing calendar day", "每日签到": "Daily check-in", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Each schedule has its own time and scope · same-day dedup per entry · missed runs are made up after startup", "每账号一条明细 · 点此查看「签到记录」": "One row per account · open \"Check-in records\"", "没有可领套餐的账号(ZCode 未添加)。": "No accounts with claimable plans (ZCode not added).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "No accounts with claimable rewards (CodeArts / ZCode not added).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "No accounts support growth tasks (WorkBuddy CN required).", "没有支持新手福利的账号": "No accounts support starter rewards", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "No accounts support starter rewards — currently Loomy, Raccoon and CodeArts.", "没有符合筛选条件的签到记录": "No check-in records match the current filters", "没有需要执行的任务": "Nothing to run", "活动福利": "Event rewards", "活动(campaign)领取 · 每天 10:00 刷新": "Campaign claims · refreshed daily at 10:00", "活跃上报与保活均未成功,且活动未开启": "Both the activity report and keep-alive failed, and the campaign is not active", "活跃上报完成,但保活未成功且活动未开启": "Activity reported, but keep-alive failed and the campaign is not active", "活跃上报完成,但活动未开启": "Activity reported, but the campaign is not active", "活跃上报成功": "Activity reported", "活跃保活失败": "Keep-alive failed", "活跃保活完成": "Keep-alive complete", "活跃保活完成,但活动未开启": "Keep-alive complete, but the campaign is not active", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive complete, but the activity report failed and the campaign is not active", "添加条目": "Add schedule", "添加模型": "Add model", "清单为空 —— 保存后恢复缺省链": "The list is empty — saving restores the default chain", "清单里已经有「{name}」": "The list already contains \"{name}\"", "清空失败:{error}": "Clear failed: {error}", "清空签到记录": "Clear check-in records", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Click \"Plan details\" to see which plans you got and when they take effect; you can claim again every day during the event", "点击行展开账号明细 · 单账号签到不受范围限制": "Click a row to expand account details · single-account check-in is not limited by scope", "独立链路 · 只提供手动入口 · 不进自动签到": "Separate flow · manual entry only · not part of auto check-in", "猫猫旅行": "Cat travel", "猫猫旅行失败:{error}": "Cat travel failed: {error}", "猫猫旅行失败:{message}": "Cat travel failed: {message}", "猫猫旅行:{message}": "Cat travel: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Keep the account active with free models and a web-app conversation · no rewards claimed", "确定删除「{name}」?删除后到点不再执行。": "Delete \"{name}\"? It will no longer run at its scheduled time.", "确定清空全部签到记录?清空后无法恢复。": "Clear ALL check-in records? This cannot be undone.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Clear the filtered check-in records? This cannot be undone.", "移除 {name}": "Remove {name}", "立即全部签到": "Check in all now", "签到": "Check in", "签到中…": "Checking in…", "签到中心分区": "Check-in center sections", "签到失败:{error}": "Check-in failed: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in complete: {succeeded}/{total} succeeded{active}, {failed} failed", "签到成功": "Check-in succeeded", "签到提供商": "Check-in providers", "签到范围": "Check-in scope", "签到触发时刻": "Check-in trigger time", "签到记录": "Check-in records", "签到记录时间范围": "Check-in records time range", "签到记录表": "Check-in records table", "累计签到记录": "Total check-in records", "结算于 {time}": "Settled at {time}", "能量 {n}": "Energy {n}", "腾讯每日签到接口 · 仅国内版": "Tencent daily check-in API · China edition only", "至少勾一家才能保存(不勾等于这条条目不签到)": "Select at least one provider to save (an empty scope means this entry checks in nothing)", "读取定时签到数据失败:{error}": "Failed to load schedule data: {error}", "读取签到数据失败:{error}": "Failed to load check-in data: {error}", "读取签到记录失败:{error}": "Failed to load check-in records: {error}", "跳过 {n}": "{n} skipped", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Campaign delivery (claim → confirm → read back to verify) · these are plan bonus points", "还没执行过": "Never run yet", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "No schedules yet — click \"Add schedule\" to create one, or check in manually on the \"Check-in center\" tab.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "No check-in records yet — details appear here after a manual check-in or a scheduled run.", "连登 {n} 天": "{n}-day streak", "部分": "Partial", "重签": "Check in again", "重试": "Retry", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Limited-time trial plan · claim requires a slider CAPTCHA · view and claim one by one", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Limited-time trial plan (start-plan), one per day during the campaign · claim requires a slider CAPTCHA", "需真实操作": "Requires real action", "非活动期": "Event inactive", "项": "items", "领取": "Claim", "领取中": "Claiming", "领取中…": "Claiming…", "领取失败": "Claim failed", "领取失败:{error}": "Claim failed: {error}", "(共 {n} 个账号)": " ({n} accounts total)", "(能量 / 连登读数本次未取到)": "(Energy / streak readings unavailable this time)", ",日活保活 {n} 个": ", {n} kept alive" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO checkin_credits claims · reset at midnight (calendar day)", "UMID 组件安装失败:{error}": "UMID component installation failed: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Query the task tree, then light up / claim in one click · includes the school-season event and cat travel · click a row for details", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy International keep-alive models, tried in order", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Free models for WorkBuddy International daily activity · one global setting, unrelated to schedules", "{date}(每天 {time})": "{date} (daily at {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} to complete", "{n} 项待领": "{n} to claim", "{total} 账号 · {done} 已签": "{done} of {total} checked in", "{total} 项任务 · {pending} 项可完成": "{total} tasks · {pending} to complete", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID component installed — the next check-in can claim International points", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Scheduled check-in enabled", "✅ 开学季任务执行完成": "✅ School-season tasks completed", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Growth tasks completed: credits +{credit}, energy +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Starter rewards claimed, {n} points earned in total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in complete: {succeeded}/{total} accounts claimed successfully{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; submit empty to restore the default ({defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; clearing the list and saving restores the default chain (current default: {defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「免费领积分」的每日任务 · 逐个领取": "\"Free points\" daily tasks · claimed one by one", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "One-time rewards · queried and claimed automatically after check-in; once claimed they are recorded locally and no longer queried upstream · click a row to expand the task list", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Claims all of the day’s rewards in one action (daily check-in + newcomer gift) · idempotency guaranteed by the upstream", "一键安装组件": "Install component", "一键完成": "Complete all", "一键领取({n})": "Claim all ({n})", "上次执行:{line}": "Last run: {line}", "上次签到时间": "Last check-in", "上次领取 {time} · 领取需通过滑块验证码": "Last claimed {time} · claim requires passing a slider CAPTCHA", "下次 {date}": "Next {date}", "下次 {date} · 点此管理条目": "Next {date} · click to manage schedules", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below; its and ZCode's daily/plan benefits are claimed under \"Activity rewards\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below, and its daily welfare is right above under \"Daily check-in\"; ZCode plan claims are under \"Activity rewards\".", "与国内版同一套任务接口 · 站点不同": "Same task API as the China edition · different site", "与国内版同一套链路 · 站点不同、令牌不通用": "Same flow as the China edition · different site, tokens not interchangeable", "今天已领 {n} 份": "Claimed {n} today", "今天未领": "Not claimed today", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Claimed today (Beijing time {day}) · {n} items confirmed received · can claim again tomorrow", "今日已执行": "Ran today", "今日已派出": "Sent out today", "今日已领取": "Claimed today", "今日签到": "Today", "今日签到进度": "Today's check-in progress", "从清单里移除": "Remove from the list", "保活": "Keep-alive", "保活 {n}": "{n} kept alive", "保活+领取": "Keep-alive + claim", "保活中…": "Keeping alive…", "保活模型链": "Keep-alive model chain", "全选": "Select all", "全部 {n} 家": "All {n} providers", "全部完成": "All done", "全部查询": "Query all", "全部结果": "All outcomes", "全部账号均可签到": "All accounts can check in", "全部领取": "All claimed", "关着:所有条目都不执行": "Off: no schedule runs", "删除失败:{error}": "Delete failed: {error}", "删除定时条目": "Delete schedule", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; CodeArts claims that day's campaign welfare (claim → confirm → read back to verify; automatic runs are limited to 6 write attempts per day with a 10-minute gap); OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点时逐个签到,已勾 {n} / {total} 家": "Checked {n} of {total} — each is checked in at the scheduled time", "北京时间 · 错过时点开机后会自动补签": "Beijing time · missed runs are made up automatically after startup", "去领取": "Claim now", "另有 {n} 个账号不参与每日签到": "{n} more accounts are not part of daily check-in", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Claim rewards of completed tasks only (idempotent; repeated clicks will not double-credit)", "可完成": "Can complete", "可派出": "Can send out", "可选 · 缺省显示时刻": "Optional · defaults to the time", "可领奖": "Can claim", "后端未返回定时签到数据": "Backend returned no schedule data", "后端未返回签到中心数据": "The backend did not return check-in center data", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "International check-in requires the UMID component to generate a device risk-control identity (not detected on this machine).", "在途": "Traveling", "填入缺省链": "Fill in default chain", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Pick a time and the providers, then click Save; the name is optional (the time is shown when empty)", "失败 {n}": "{n} failed", "套餐明细": "Plan details", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Install the Qoder client or qodercli to enable it (no need to restart the gateway).", "安装中…": "Installing…", "官方客户端的每日签到任务": "Official client's daily check-in task", "定时签到": "Scheduled check-in", "定时签到已关闭": "Scheduled check-in disabled", "尚未查询": "Not queried yet", "尚未查询任务状态": "Task status not queried yet", "巡检一次": "Run one round", "已保存:{label}": "Saved: {label}", "已保存:保活模型链": "Saved: Keep-alive model chain", "已保存:定时条目": "Saved: schedule", "已删除定时条目": "Schedule deleted", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Activity reported (streak lit up), but the campaign is not active (nothing to claim this time)", "已抽 {n} 次": "Drew {n} times", "已有结果 {checked} / 共 {total} 个账号": "Results for {checked} / {total} accounts", "已签": "Checked in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Claimed {claimed}/{total} · {earned} points earned", "已领养": "Adopted", "已领取": "Claimed", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Claim \"Daily 100 Credits\" with a device risk-control identity · requires the UMID component", "开学季执行失败:{error}": "School-season run failed: {error}", "开学季执行完成:{message}": "School-season run completed: {message}", "开学季活动": "School-season event", "开着:启用的条目按各自时刻执行": "On: enabled schedules run at their own times", "待签": "Not checked in", "待领新手福利": "Starter rewards to claim", "总开关": "Master switch", "总开关已关闭 · 在「定时签到」页打开": "Master switch is off · enable it on the \"Scheduled check-in\" tab", "成功 {n}": "{n} succeeded", "成长任务": "Growth tasks", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Growth tasks finished ({done} succeeded, {failed} failed): credits +{credit}, energy +{energy}", "成长任务执行失败:{error}": "Growth task run failed: {error}", "执行失败:{error}": "Run failed: {error}", "执行并抽奖": "Run & draw", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Run school-season tasks and spend all draw chances (share / chat / expert events)", "把缺省链填进清单,再点「保存」生效": "Puts the default chain into the list; click Save to apply", "抽奖机会 {n} 次": "{n} draw chances", "按住拖动调整顺序": "Press and drag to reorder", "按住拖动,调整这个模型在链里的顺序": "Press and drag to change this model's position in the chain", "按序逐个尝试,共 {n} 个": "{n} models, tried in order", "按结果筛选": "Filter by outcome", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detect + claim + keep-alive · same combo as scheduled check-in", "探测活动并领取日活奖励 · 不做保活": "Detect the campaign and claim the daily-activity reward · no keep-alive", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Accept + light up + claim (only tasks with verified recipes)", "搜账号 / 收益 / 错误 / 触发原因": "Search account / gain / error / trigger reason", "收起新建": "Close new entry", "新建定时条目": "New scheduled entry", "新手福利": "Starter rewards", "新手福利有 {n} 项领取失败,可重试": "{n} starter reward(s) failed to claim — you can retry", "无": "None", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "No dedicated check-in API · hits the login-info endpoint once a day per account (which grants the daily Magicubes)", "无独立签到接口 · 每天替账号打一次首次登录积分": "No dedicated check-in API · awards first-login points once a day per account", "无账号": "No accounts", "暂不可领": "Not claimable yet", "暂不支持": "Not supported yet", "暂无启用的条目 · 点此添加": "No enabled schedules · click to add one", "有未保存的改动": "Unsaved changes", "未勾选提供商": "No provider selected", "未开启": "Off", "未解锁": "Locked", "未领养(领养需先完成当日对话量)": "Not adopted (adoption requires the daily chat quota first)", "未领取": "Not claimed", "本地台账里今天还没领过;活动期内每天发一份新套餐": "No claim recorded locally for today yet; a new plan is issued every day during the event", "本地台账里今天(北京时间)领过的套餐:{plans}": "Plans claimed today (Beijing time) according to the local record: {plans}", "条启用": "enabled", "查询于 {time}": "Queried at {time}", "查询任务": "Query tasks", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Query the task tree, then light up / claim in one click (includes school-season and cat travel)", "查询失败:{error}": "Query failed: {error}", "桌面端每日积分链路": "Desktop daily points flow", "正在读取定时签到数据…": "Loading schedule data…", "正在读取签到数据…": "Loading check-in data…", "每天 {time}": "Daily at {time}", "每天 {time} · {scope}": "Daily {time} · {scope}", "每天时刻": "Daily time", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "One row per account per check-in run · outcomes and gains as recorded by the backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Daily activity tasks · a web-app conversation lights up the daily activity, only claims add points · the two can run separately", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Daily welfare · claim → confirm → read back to verify · resets on the Beijing calendar day", "每日签到": "Daily check-in", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Each schedule has its own time and scope · same-day dedup per entry · missed runs are made up after startup", "每账号一条明细 · 点此查看「签到记录」": "One row per account · open \"Check-in records\"", "没有可领套餐的账号(ZCode 未添加)。": "No accounts with claimable plans (ZCode not added).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "No accounts with claimable rewards (CodeArts / ZCode not added).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "No accounts support growth tasks (WorkBuddy CN required).", "没有支持新手福利的账号": "No accounts support starter rewards", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "No accounts support starter rewards — currently Loomy, Raccoon and CodeArts.", "没有符合筛选条件的签到记录": "No check-in records match the current filters", "没有需要执行的任务": "Nothing to run", "活动福利": "Event rewards", "活动(campaign)领取 · 每天 10:00 刷新": "Campaign claims · refreshed daily at 10:00", "活跃上报与保活均未成功,且活动未开启": "Both the activity report and keep-alive failed, and the campaign is not active", "活跃上报完成,但保活未成功且活动未开启": "Activity reported, but keep-alive failed and the campaign is not active", "活跃上报完成,但活动未开启": "Activity reported, but the campaign is not active", "活跃上报成功": "Activity reported", "活跃保活失败": "Keep-alive failed", "活跃保活完成": "Keep-alive complete", "活跃保活完成,但活动未开启": "Keep-alive complete, but the campaign is not active", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive complete, but the activity report failed and the campaign is not active", "添加条目": "Add schedule", "添加模型": "Add model", "清单为空 —— 保存后恢复缺省链": "The list is empty — saving restores the default chain", "清单里已经有「{name}」": "The list already contains \"{name}\"", "清空失败:{error}": "Clear failed: {error}", "清空签到记录": "Clear check-in records", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Click \"Plan details\" to see which plans you got and when they take effect; you can claim again every day during the event", "点击行展开账号明细 · 单账号签到不受范围限制": "Click a row to expand account details · single-account check-in is not limited by scope", "独立链路 · 只提供手动入口 · 不进自动签到": "Separate flow · manual entry only · not part of auto check-in", "猫猫旅行": "Cat travel", "猫猫旅行失败:{error}": "Cat travel failed: {error}", "猫猫旅行失败:{message}": "Cat travel failed: {message}", "猫猫旅行:{message}": "Cat travel: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Keep the account active with free models and a web-app conversation · no rewards claimed", "确定删除「{name}」?删除后到点不再执行。": "Delete \"{name}\"? It will no longer run at its scheduled time.", "确定清空全部签到记录?清空后无法恢复。": "Clear ALL check-in records? This cannot be undone.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Clear the filtered check-in records? This cannot be undone.", "移除 {name}": "Remove {name}", "立即全部签到": "Check in all now", "签到": "Check in", "签到中…": "Checking in…", "签到中心分区": "Check-in center sections", "签到失败:{error}": "Check-in failed: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in complete: {succeeded}/{total} succeeded{active}, {failed} failed", "签到成功": "Check-in succeeded", "签到提供商": "Check-in providers", "签到范围": "Check-in scope", "签到触发时刻": "Check-in trigger time", "签到记录": "Check-in records", "签到记录时间范围": "Check-in records time range", "签到记录表": "Check-in records table", "累计签到记录": "Total check-in records", "结算于 {time}": "Settled at {time}", "能量 {n}": "Energy {n}", "腾讯每日签到接口 · 仅国内版": "Tencent daily check-in API · China edition only", "至少勾一家才能保存(不勾等于这条条目不签到)": "Select at least one provider to save (an empty scope means this entry checks in nothing)", "读取定时签到数据失败:{error}": "Failed to load schedule data: {error}", "读取签到数据失败:{error}": "Failed to load check-in data: {error}", "读取签到记录失败:{error}": "Failed to load check-in records: {error}", "跳过 {n}": "{n} skipped", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Campaign delivery (claim → confirm → read back to verify) · these are plan bonus points", "还没执行过": "Never run yet", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "No schedules yet — click \"Add schedule\" to create one, or check in manually on the \"Check-in center\" tab.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "No check-in records yet — details appear here after a manual check-in or a scheduled run.", "连登 {n} 天": "{n}-day streak", "部分": "Partial", "重签": "Check in again", "重试": "Retry", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Limited-time trial plan · claim requires a slider CAPTCHA · view and claim one by one", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Limited-time trial plan (start-plan), one per day during the campaign · claim requires a slider CAPTCHA", "需真实操作": "Requires real action", "非活动期": "Event inactive", "项": "items", "领取": "Claim", "领取中": "Claiming", "领取中…": "Claiming…", "领取失败": "Claim failed", "领取失败:{error}": "Claim failed: {error}", "(共 {n} 个账号)": " ({n} accounts total)", "(能量 / 连登读数本次未取到)": "(Energy / streak readings unavailable this time)", ",日活保活 {n} 个": ", {n} kept alive" }); diff --git a/desktop-tauri/ui/i18n/ja/add-account.js b/desktop-tauri/ui/i18n/ja/add-account.js index de6fb9ac..993d2dff 100644 --- a/desktop-tauri/ui/i18n/ja/add-account.js +++ b/desktop-tauri/ui/i18n/ja/add-account.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ja/add-account —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · モデル {head}{rest}", " 等 {n} 个": " など {n} 個", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1// で始まる Google refresh token(refresh_token=… の行をそのまま貼り付けても可)", "11 位大陆手机号": "11 桁の中国本土の携帯番号", "1~64 个字符,账号列表里按它分组显示": "1~64 文字、アカウント一覧ではこれでグループ表示されます", "6 位数字": "6 桁の数字", "

  • 没有可自动领的活动
  • ": "
  • 自動で受け取れるイベントはありません
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    受け取るのはプラン特典ポイントで、特典モデルの token プールは増えません;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 互換エンドポイントは https://api.deepseek.com/anthropic です(プロトコルを anthropic に切り替えるときにこれを入力)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic プロトコルではルートアドレスを入力し、/v1 は付けないでください", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 中国版", "AutoClaw 国际版": "AutoClaw 国際版", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS は必須です;**完全な Cookie** を貼り付けてください(Cookie エディターのワンクリック書き出しで構いません)—— このうち **PTOKEN は必ず残してください**。ゲートウェイはこれを使って Baidu から KukuAI の業務セッショントークンを発行してもらうため、欠けるとモデル更新時に「未ログイン」と表示されます。Cookie ヘッダー全体、Cookie エディターが書き出した JSON 配列、または {BDUSS, STOKEN} オブジェクトに対応しています。KukuAI には更新の仕組みがないため、ログイン状態の期限が切れたら貼り直せば済みます。", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=…(または Cookie エディターが書き出した JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw の X-Passport-Token(ログイン状態 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT(3 段のドット区切り)", "Command Code": "Command Code", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 国際版", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM のマネージドエンドポイント。Key は integrate.api.nvidia.com で申請します", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken は Accio のログイン認証情報です(長い不透明な token 文字列で、JWT ではありません);refreshToken は任意で、入力すると期限切れ時に自動更新できます。{label}アカウントの認証情報を入力してください —— {siteNote}(最も簡単な方法:上の「ウェブログイン」を使えば token を手動で探す必要はありません。)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken は Trae の Cloud-IDE-JWT(3 段のドット区切り)です。refreshToken は期限切れ時の自動更新に使用します(本家の refreshToken は 1 回ごとに交換され、一度更新すると古いものは無効になります。そのため 2 つのプログラムで同じアカウントを同時に更新しないでください)。
    手動で貼り付ける場合は machineId / deviceId も一緒に入力してください:アップストリームはこれらをログイン時にアップロードされたデバイス公開鍵と紐付けてデバイスを判定するため、根拠なく別のペアにすると 2xxxx 系のデバイスバインディング拒否に当たります。
    この 3 つがない場合の正道は上の「ウェブログイン」を使うことです;コンテナ / リモートデプロイ形態では案内に従ってアドレスバーのコールバックアドレスを貼り付けてください。", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session の値(Cookie 全体をそのまま貼り付けても可)", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken は任意で、入力すると期限切れ時に自動更新できます;どちらも小浣熊クライアントのログイン状態ファイルから取得できます。", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken は任意で、入力すると自動更新できます;どちらもクライアントのログイン状態ファイルから取得できます。同じ Cline アカウントはどちらのプールでも使え、ここでは {label} に分類されます。", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token は enc: プレフィックスに対応しています(Windows では自動復号)。refreshToken を入力しないと自動更新できません。", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token はログイン状態 Cookie です;CatPaw には更新の仕組みがないため、期限切れ後はクライアントで再ログインが必要です。", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_ で始まる API Key(Authorization: Bearer … の行をそのまま貼り付けても可)", "{label} 网页登录的打开方式": "{label} のウェブログインの開き方", "{label} 账号地区": "{label} アカウントの地域", "{label} 账号的添加方式": "{label} アカウントの追加方法", "{name} 不是合法 JSON:{reason}": "{name} は有効な JSON ではありません:{reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name} には JSON オブジェクトを貼り付けてください(例:{sample})", "{n} 个账号": "{n} 個のアカウント", "{n} 个账号,点击添加": "{n} 個のアカウント、クリックして追加", "{seconds}s 后重发": "{seconds} 秒後に再送", "✅ {label}账号已添加": "✅ {label} アカウントを追加しました", "✅ {label}账号已添加{name}": "✅ {label} アカウントを追加しました{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ cc-switch から {n} 個のプロバイダーをインポートしました", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ カスタムプロバイダー「{name}」を作成し、アカウントを追加しました", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ カスタムプロバイダー「{name}」を削除しました{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ ログインに成功し、{edition}アカウントをリストに追加しました", "✅ 领取成功:{planId}{period}": "✅ 受け取りに成功しました:{planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 同じプロバイダーに複数の key を置くことができ、優先度に従ってローテーションされます。", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」のアカウント追加機能は開発中です。ご期待ください。", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "1 つの Key で複数のプロバイダーのモデルを利用できます。モデル名は「ベンダー/モデル」の完全名を指定します(例:deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "アップストリームが認証不要の場合は空欄にし、下の項目にチェックを入れてください(空欄かつ未チェックでは認証情報未設定として扱われます)", "上游信息": "アップストリーム情報", "不可领({status})": "受け取り不可({status})", "不支持导入": "インポートに対応していません", "不是有效的凭证文件:内容要是一个 JSON 对象": "有効な認証情報ファイルではありません:内容は JSON オブジェクトである必要があります", "不是有效的凭证文件:需要包含 accessToken 与 uid": "有効な認証情報ファイルではありません:accessToken と uid が必要です", "不是自定义提供商": "カスタムプロバイダーではありません", "不需要 Key:转发与拉取模型都不发送鉴权头": "Key は不要:転送とモデル取得のいずれも認証ヘッダーを送信しません", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "両版のアカウントは同時に保存でき、それぞれ独自のモデルカタログを持ちます(中国版と国際版は別々のプロバイダーで、個別に有効化とマッピングができます)。", "中国版": "中国版", "今天没有需要领的活动(都已到账)": "本日受け取る必要のあるイベントはありません(すべて付与済み)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "本日(北京時間 {day})は {attempts} 回試行済み、あと {left} 回試せます{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "別のマシン(または OfficeAce デスクトップ版の models.json)から次の 3 項目を取り出して貼り付けてください:モデルゲートウェイのベース URL(baseUrl、https://modelgw-…/v2 の形式)と modelAppKey / modelAppSecret。この 3 項目だけで転送できます(ゲートウェイ認証情報は無期限)。コントロールプレーンの一時認証情報(accessKeyId など)は任意で、空欄の場合は残高照会と自動更新が使えませんが、転送には影響しません。", "从本机导入桌面端登录态": "本機からデスクトップ版のログイン状態をインポート", "任务镜像 id": "タスクイメージ id", "使用 Google 账号登录": "Google アカウントでログイン", "使用 Zai 账号登录": "Zai アカウントでログイン", "使用个人访问令牌(PAT)": "個人アクセストークン(PAT)を使用", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "無料モデルでは Key の入力は不要です(既定で「このアップストリームは認証不要」がチェックされ、ゲートウェイは自動的に匿名認証情報を使用します);有料モデルでは Zen の API Key を入力します。無料枠のアップストリームは公式クライアントの形態しか受け付けないため、「OpenCode 公式クライアントの偽装」が既定で有効になっています", "内嵌窗口": "内蔵ウィンドウ", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "内蔵ウィンドウで開きます;ウィンドウを閉じると待機をキャンセルします(Google アカウントが拒否された場合はシステムブラウザをお使いください)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "内蔵ウィンドウで開きます;完了後は自動でリストに追加され、ウィンドウを閉じると待機をキャンセルします", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "内蔵ウィンドウは新しい環境を使うため、複数のアカウントが互いに影響しません;ウィンドウを閉じると待機をキャンセルします", "内嵌窗口(推荐)": "内蔵ウィンドウ(推奨)", "准备验证…": "認証を準備中…", "凭据 JSON": "認証情報 JSON", "凭证文件在哪?": "認証情報ファイルの場所は?", "创建并添加账号": "作成してアカウントを追加", "创建这个提供商,并同时建立它的第一个账号。": "このプロバイダーを作成し、同時にその最初のアカウントを作成します。", "删除功能不可用(脚本未就绪)": "削除機能は利用できません(スクリプト未準備)", "删除失败:{reason}": "削除に失敗しました:{reason}", "删除此提供商": "このプロバイダーを削除", "及 {n} 个账号": "、および {n} 個のアカウント", "发送中…": "送信中…", "发送失败:{message}": "送信に失敗しました:{message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "送信は未確認です:ログインウィンドウが開きました。表示されたウィンドウで手動でログインを完了してください", "取消失败:{message}": "キャンセルに失敗しました:{message}", "取消等待": "待機をキャンセル", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "「内蔵ウィンドウ」でのみサードパーティの入り口を復元できます:システムブラウザではログインページを変更できないためです", "可选": "任意", "可选(cloudaicompanionProject):留空由网关自动发现": "任意(cloudaicompanionProject):空欄の場合はゲートウェイが自動検出します", "可选,展示用": "任意、表示用", "可选,没有则无法自动续期": "任意、ないと自動更新できません", "可选,留空使用凭据里的 user_name": "任意、空欄の場合は認証情報の user_name を使用", "可选,留空使用账号姓名、邮箱或令牌指纹": "任意、空欄の場合はアカウントの氏名、メールアドレス、またはトークンフィンガープリントを使用", "可选,留空使用账号昵称或邮箱": "任意、空欄の場合はアカウントのニックネームまたはメールアドレスを使用", "可选,留空则用 key 尾号": "任意、空欄の場合は key の末尾を使用", "可选,留空则用 userId": "任意、空欄の場合は userId を使用", "可选,留空则用上游返回的账号名或账号 id": "任意、空欄の場合はアップストリームが返したアカウント名またはアカウント id を使用", "可选,留空则用凭证里的账号名": "任意、空欄の場合は認証情報のアカウント名を使用", "可选,留空则用文件里的昵称": "任意。空欄の場合はファイル内のニックネームを使用", "可选,留空则用登录名或 uid": "任意、空欄の場合はログイン名または uid を使用", "可选,留空则用脱敏手机号": "任意、空欄の場合はマスク済み電話番号を使用", "可选,留空则用脱敏手机号或 userId": "任意、空欄の場合はマスク済み電話番号または userId を使用", "可选,留空则用账号 uk": "任意、空欄の場合はアカウントの uk を使用", "可选,留空则用邮箱或令牌尾号": "任意、空欄の場合はメールアドレスまたはトークンの末尾を使用", "可选,留空用「OfficeAce 果办」": "任意、空欄の場合は「OfficeAce」を使用", "可选,留空自动生成": "任意、空欄の場合は自動生成", "可选,留空自动用昵称": "任意、空欄の場合はニックネームを自動使用", "可选,续期时带上": "任意、更新時に一緒に送信されます", "可选,讯飞侧 userid": "任意、iFlytek 側の userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "任意;会話の開始に必須です。空欄の場合はゲートウェイがこのアカウントの既存タスクから自動検出します。見つからない場合は後で手動で補ってください。", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "任意;アカウントのメールアドレスで、表示と身元識別に使用します(新しいトークンに替えても同じアカウントとして認識されます)", "可选;UUID 形态,与凭据同生共死": "任意;UUID 形式で、認証情報と一体で管理されます", "可选;填了才能到期自动续期": "任意;入力すると期限切れ時に自動更新できます", "可选;用于去重与展示名(留空时网关会问一次上游)": "任意;重複排除と表示名に使用します(空欄の場合、ゲートウェイがアップストリームに一度問い合わせます)", "可选;用于生成账号 id 与展示名": "任意;アカウント id と表示名の生成に使用します", "可选;纯数字串(上游只收 8–24 位数字)": "任意;数字のみの文字列(アップストリームは 8–24 桁の数字のみ受け付けます)", "可领取": "受け取り可能", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "同じプロバイダーに混在させられます:Key のあるアカウントと認証不要のアカウントは、それぞれの規則に従います", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "同じアドレスでプロトコルを anthropic に変えると、その Claude 互換エンドポイントを使用します。転送には OpenCode Go の API Key が必須です(サブスクリプション制;モデルカタログの取得に Key は不要ですが、リクエストを送るとアップストリームが 401「Missing API key」を返します)", "响应为空": "応答が空です", "国内版": "中国版", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "中国版と**国際版は 2 組の独立したアカウントとプラン**で、認証情報と受け取ったプランはどちらも共用できません。", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "中国版のログインページには Google / GitHub の入り口がありません(WeChat / 電話番号 / メールアドレスでログインします)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "中国版のログインサイトは www.accio-ai.com で、国際版とは別のサイトです。", "国内版(WorkBuddy)": "中国版(WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "中国版サイトは https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "中国版サイト(minimaxi.com);OpenAI 互換アドレスは https://api.minimaxi.com/v1", "国际版": "国際版", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "国際版 z.ai の Coding プラン;OpenAI 互換アドレスは https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "国際版と中国版は**2 組の独立したアカウント**です(同じアカウント体系の 2 つのサイト)。認証情報は共用できません。", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "国際版と中国版はアカウント体系が独立しています。国際版の認証情報を入力してください。refreshToken を入力しないと自動更新できません。", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "国際版のログインページは既定でメールアドレスログインのみ表示されます。チェックすると Google / GitHub / X の入り口が復元されます", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "国際版の推論サイトは api.z.ai で、中国版とは別のサイトです;プランもそれぞれ独立しています。", "国际版(WorkBuddy AI)": "国際版(WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "国際版サイトの Coding プラン;OpenAI 互換アドレスは https://api.minimax.io/v1", "在 cc-switch 里找到": "cc-switch で", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "内蔵ウィンドウで公式ログインを完了してください。成功すると自動でアカウント一覧に追加されます。", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "{label} の Qoder アカウント設定 → Integrations で PAT を生成してください(Google / GitHub のトークンは入力しないでください)。2 つの地域のアカウントと認証情報は共用できません。", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "開いたウィンドウで Baidu アカウントを使って KukuAI 本体サイトにログインしてください(SMS 認証コード / QR コードのいずれも可)。ログインに成功すると自動でアカウント一覧に追加されます。ゲートウェイは Baidu から KukuAI の業務セッショントークンを発行してもらいます(本機に KukuAI クライアントがインストールされている必要があります)。", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "開いたウィンドウで Google アカウントにログインしてください(Antigravity の認可ページ)。認可が完了すると自動でアカウントリストに追加されます。", "在浏览器中打开登录页": "ブラウザでログインページを開く", "地区": "地域", "填写凭证": "認証情報を入力", "填写凭证添加": "認証情報を入力して追加", "备注名": "ラベル名", "套餐": "プラン", "如:智谱 GLM": "例:Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "ログイン完了後は自動でアカウント一覧に追加されます。ニックネームはアップストリームから取得します。", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "公式クライアントの認証情報ディレクトリ:Windows は C:\\Users\\<ユーザー名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth、macOS は ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "公式が付与を確認済み", "导入": "インポート", "导入中…": "インポート中…", "导入凭证文件": "認証情報ファイルのインポート", "导入失败": "インポートに失敗しました", "导入失败:{reason}": "インポートに失敗しました:{reason}", "导入所选": "選択項目をインポート", "导入所选({n})": "選択項目をインポート({n})", "导入桌面端登录态": "デスクトップ版のログイン状態をインポート", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "内蔵ウィンドウを開きます;認可が完了すると自動でアカウント一覧に追加されます。ウィンドウを閉じると待機をキャンセルします。認可ページの最後に zcode:// リンクを開けない旨の表示が出ることがありますが、これは正常です —— 結果はサーバー側で記録済みです", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "内蔵ウィンドウを開きます;認可が完了すると自動でアカウント一覧に追加されます。リモートパネルではコールバックアドレスを貼り付けられます。ウィンドウを閉じると待機をキャンセルします。リンクの有効期限は 5 分で、タイムアウトまたは未クリックの場合は無効になります(再発行できます)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "内蔵ウィンドウを開きます;ログイン完了後は自動でアカウント一覧に追加されます。ウィンドウを閉じると待機をキャンセルします", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの Trae アカウントが再利用されます);同一マシンでは完了後に自動追加され、Docker / リモートパネルでは案内に従ってアドレスバーのコールバックアドレスを貼り付けてください。", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの ZCode アカウントが再利用されます);認可完了後は自動でアカウント一覧に追加されます。ページの最後に zcode:// リンクを開けない旨の表示が出ることがありますが、正常な動作です", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの Huawei Cloud アカウントが再利用されます);ブラウザとゲートウェイが別のマシンにある場合は、上の説明に従って最終的なコールバックアドレスをパネルに貼り付けてください", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "システムの既定ブラウザでログインページを開きます(ブラウザでログイン済みの Accio アカウントが再利用されます);ログイン完了後は自動でアカウント一覧に追加され、ポップアップを閉じると待機をキャンセルします", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan プラン(シンガポールサイト)", "已到账": "付与済み", "已取消登录等待": "ログイン待ちをキャンセルしました", "已取消领取": "受け取りをキャンセルしました", "已取消验证码": "認証をキャンセルしました", "已填写手机号,正在发送验证码…": "電話番号を入力しました。認証コードを送信中…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "認証不要を宣言済み:アカウントは通常どおりルーティングされ、送信時に認証ヘッダーは一切付きません", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "{ok} 個をインポートしました。失敗 {fail} 個(失敗した項目にはリスト内でマークが付いています)", "已建过 · {n} 个账号,点击继续添加": "作成済み · {n} 個のアカウント、クリックして追加", "已建过,点击继续添加账号": "作成済み、クリックしてアカウントを追加", "已打开官方登录页,请在窗口中完成登录…": "公式ログインページを開きました。ウィンドウでログインを完了してください…", "已点发送,等待短信…": "送信しました。SMS を待っています…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "システムの既定ブラウザでログインページを開きました。ブラウザでログインを完了してください…", "已领取,等官方确认": "受け取り済み、公式の確認待ち", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "現在のシェルバージョンは AutoClaw のウェブログインに対応していません。アプリを更新してください", "当前没有可领取的套餐(活动尚未开始)": "現在受け取り可能なプランはありません(イベントはまだ開始されていません)", "当前环境不支持领取(桥接方法缺失)": "現在の環境では受け取りに対応していません(ブリッジメソッドがありません)", "必填,CatPaw 账号标识": "必須、CatPaw アカウントの識別子", "恢复 Google / GitHub 入口": "Google / GitHub の入り口を復元", "手机号": "電話番号", "手机验证码登录": "SMS 認証コードログイン", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Trae SOLO の公式認可ページ(trae.cn)を開き、あなたの Trae アカウントでログインしてください:認可が完了すると公式ページから本機の一時ポートにリダイレクトされます;同一マシンでのデプロイでは自動受信し、Docker / リモートパネルでは案内に従ってアドレスバーのコールバックアドレスをコピーしてください。", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Accio {label}の公式ログインページ({site})を開き、あなたの Accio アカウントでログインしてください:ログインに成功すると公式ページから本機にリダイレクトされます;同一マシンでは自動完了し、Docker / リモートパネルでは案内に従ってコールバックアドレスを貼り付けてください(認可コードは本機からゲートウェイに渡されるだけで、画面に平文 token は表示されません)。", "打开 Accio {label}登录页": "Accio {label} のログインページを開く", "打开 Antigravity 网页登录": "Antigravity のウェブログインを開く", "打开 CatPaw 网页登录": "CatPaw のウェブログインを開く", "打开 Cline 授权页": "Cline の認可ページを開く", "打开 CodeArts 授权页": "CodeArts の認可ページを開く", "打开 Qoder 网页登录": "Qoder のウェブログインを開く", "打开 Trae 授权页": "Trae の認可ページを開く", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "ZCode {label}の公式認可ページを開き、あなたのアカウントでログインしてください。認可結果は ZCode サーバー側で記録され、ゲートウェイがバックグラウンドで自動的に認証情報を取得してアカウント一覧に追加します。", "打开 ZCode {label}授权页": "ZCode {label} の認可ページを開く", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Huawei Cloud CodeArts の公式認可ページを開いてログインします:ログイン完了後、公式ページからブラウザがゲートウェイ自身の /oauth/callback に戻され、ゲートウェイはワンタイム認可コードで一時認証情報を取得し、アカウント一覧に追加します。
    ゲートウェイが別のマシンで動作している場合は、ウェブ画面でアドレスバーの最終的なコールバックアドレスをそのままパネルに貼り付けるよう案内されます。", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Huawei Cloud の認可ページを開いてログインしてください:完了すると、ゲートウェイがクラウドをポーリングして認可コードを取得し、アカウント一覧に追加します(OfficeAce デスクトップ版は不要で、コールバック URL を手動で貼り戻す必要もありません)。", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "公式認可ページを開いてデバイスコード認可を完了します。ログインするのは {label}({site})のアカウントです。", "打开授权页": "認可ページを開く", "打开授权页完成确认,账号自动加入 {label}{note}": "認可ページを開いて確認を完了すると、アカウントが自動で {label} に追加されます{note}", "打开方式": "開き方", "打开网页登录": "ウェブログインを開く", "探测失败:{message}": "検出に失敗しました:{message}", "接入一个兼容上游": "互換アップストリームを接続", "提交中…": "送信中…", "搜索提供商": "プロバイダーを検索", "搜索提供商…": "プロバイダーを検索…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "公式プラグイン / CLIProxyAPI が保存した認証情報 JSON をまるごと貼り付けてください({\"codearts_provider_credential\":{…}} の形。フラットなものでも可)。
    必須:access_key_id、secret_access_key、security_token。自動更新を効かせるには refresh_token と oauth_context も一緒に貼り付ける必要があります —— 一時認証情報は約 1 時間で期限切れになり、この半分が欠けると更新できず、再ログインするしかありません。", "文件是{edition}凭证,已按该版本导入": "ファイルは{edition}の認証情報のため、そのバージョンでインポートしました", "新建自定义提供商": "カスタムプロバイダーを新規作成", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "平文 JWT または auth.json 内の enc: 暗号化値(自動復号)", "明文 JWT(国际版账号的 access token)": "平文 JWT(国際版アカウントの access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu bigmodel.cn の Coding プラン。Key は open.bigmodel.cn/usercenter/apikeys で取得します", "未知错误": "不明なエラー", "未能获取授权地址,请重试": "認可アドレスを取得できませんでした。再試行してください", "未能读取 cc-switch 数据": "cc-switch のデータを読み取れませんでした", "未领取成功": "受け取りに失敗しました", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "ローカル Ollama、OpenCode Zen の無料枠などのアップストリームではチェックを入れてください。入れないとアカウントを使用できません", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "本家には**互いに代替できない** 2 つの認証情報があり、使いたい機能に応じて入力してください。少なくともどちらか一方は必須です:コーディングプラン API Key は推論の転送用({site} を叩きます)とウィンドウクォータの照会用(N 時間ごと / 週ごとの残り割合);jwt はプランの受け取りと残高照会用(zcode.z.ai の billing ゲートウェイを叩きます。公式名称は Coding Plan JWT で、3 段のドット区切り文字列です)。残高はどちらでも照会できますが、読み取れる内容が異なります:jwt は残高バケットとプランの有効期限、API Key はウィンドウクォータを読み取ります;受け取りは jwt のみ、転送は API Key のみです。{label}アカウントの認証情報を入力してください —— {plan}(最も簡単な方法:上の「ウェブログイン」を使うこと —— この API Key を代わりに交換してくれ、2 つの認証情報をまとめて取得できます。)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "本機の Ollama の OpenAI 互換エンドポイント。API Key は不要です(既定で「このアップストリームは認証不要」がチェック済みで、認証ヘッダーは一切送信されません)", "本次未确认到账": "今回は付与が確認できませんでした", "条可导入": "件がインポート可能", "条配置,其中": "件の設定、うち", "桌面运行时不可用(Tauri 未初始化)": "デスクトップランタイムが利用できません(Tauri が未初期化)", "模型网关基址": "モデルゲートウェイのベース URL", "正在打开百度登录页…": "Baidu のログインページを開いています…", "正在扫描本机 cc-switch…": "本機の cc-switch をスキャンしています…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "{name} のログイン完了を待っています;完了またはキャンセルしないと新しいログインを開始できません", "每周": "毎週", "每日": "毎日", "每月": "毎月", "没有则无法自动续期": "ないと自動更新できません", "没有匹配「{keyword}」的提供商": "「{keyword}」に一致するプロバイダーはありません", "添加 {name} 账号": "{name} アカウントを追加", "添加中…": "追加中…", "添加到 ": "追加先 ", "添加失败:{reason}": "追加に失敗しました:{reason}", "添加小浣熊账号": "小浣熊アカウントを追加", "添加方式": "追加方法", "添加账号": "アカウントを追加", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding プラン;汎用推論エンドポイントは https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "クリックしてアカウントを追加", "点开即预填,填 Key 接入": "開くと自動入力済み、Key を入力して接続", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "ボタンを押すとまずスライダー認証(公式の不正対策)を 1 回行い、その後ログインページが開きます。ログイン完了で自動的にアカウントが追加されます。
    これが国際版公式の唯一のログイン方式です。すでにクライアントでログイン済みの場合は、「デスクトップ版のログイン状態をインポート」を使う方が速いです。", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "AutoClaw アカウントに紐付けられた電話番号でログインします:「コードを取得」をクリックし、SMS を受け取ったら下の欄に入力してログインしてください。認証コードは本機から直接公式 API に送信され、画面に token は表示されません。", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "CatPaw アカウントでログインを完了します(Meituan passport)。成功すると自動でアカウント一覧に追加されます。", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Loomy アカウントに紐付けられた電話番号でログインします:「コードを取得」をクリックして入力するだけです。本家で最も手軽な入り口です。", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "転送用。apiKey.secret の 2 段ドット区切り形式です(未入力の場合、このアカウントは転送できません)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "プランの受け取りと残高照会用。未入力の場合、このアカウントは受け取りと残高照会ができません", "用户 ID": "ユーザー ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "紐付けられた電話番号でログインします:「コードを取得」をクリックして入力するだけです。これが中国版公式の唯一のログイン方式です。", "留空则用提供商名称": "空欄の場合はプロバイダー名を使用", "登录 / 添加 {name} 账号": "ログイン / {name} アカウントを追加", "登录 session(一长串)": "ログイン session(長い文字列)", "登录中…": "ログイン中…", "登录失败:{message}": "ログインに失敗しました:{message}", "登录已结束": "ログインは終了しました", "登录并添加": "ログインして追加", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "ログイン状態ファイルのパス:~/.box-agent/config/auth.json(Windows:C:\\Users\\<ユーザー名>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "カスタムプロバイダー「{name}」を削除しますか?このプロバイダー配下の {count} 個のアカウントも同時に削除され、削除後は元に戻せません。", "等待 Accio {label}登录完成…": "Accio {label} のログイン完了を待っています…", "等待 CatPaw 登录完成…": "CatPaw のログイン完了を待っています…", "等待 Cline 授权确认…": "Cline の認可確認を待っています…", "等待 CodeArts 登录完成…": "CodeArts のログイン完了を待っています…", "等待 Google 授权完成…": "Google の認可完了を待っています…", "等待 KukuAI 登录完成…": "KukuAI のログイン完了を待っています…", "等待 OfficeAce 登录完成…": "OfficeAce のログイン完了を待っています…", "等待 Qoder 授权完成…": "Qoder の認可完了を待っています…", "等待 Trae 授权完成…": "Trae の認可完了を待っています…", "等待 ZCode {label}授权完成…": "ZCode {label} の認可完了を待っています…", "等待小浣熊登录完成…": "小浣熊のログイン完了を待っています…", "等待登录完成…": "ログインの完了を待っています…", "等待网页登录…": "ウェブログインを待っています…", "粘贴 API Key": "API Key を貼り付け", "粘贴 Accio 的 accessToken": "Accio の accessToken を貼り付け", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity の Google refresh token を貼り付け(1// で始まる;refresh_token= を含む行全体をそのまま貼り付けても可)。
    これはウェブログイン以外の手動入り口です(例:ログイン済みの公式 IDE からエクスポート)。refresh token は期限切れにならず、access token の期限切れはゲートウェイが自動で更新します;トークンを紛失すると Google の認可をやり直すしかないため、大切に保管してください。", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code の API Key を貼り付け(user_ で始まる;公式 CLI の ~/.commandcode/auth.json またはウェブの studio から取得)。行全体 / 引用符付き / Bearer プレフィックス付きのまま貼り付けても構いません。ゲートウェイが自動で裸の key に剥がします。key は期限切れにならず、更新用 API もありません。無効になったら取得し直してください;追加時にゲートウェイが軽量な死活確認を 1 回行いますが、失敗しても追加には影響しません。", "粘贴 Cookie": "Cookie を貼り付け", "粘贴 Google refresh token": "Google refresh token を貼り付け", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder の個人アクセストークン(pt-…)を貼り付け", "粘贴 access_token(一长串 JWT)": "access_token(長い JWT)を貼り付け", "粘贴 session cookie": "session cookie を貼り付け", "粘贴 token / refreshToken": "token / refreshToken を貼り付け", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "workos:… で始まるトークンを貼り付け(プレフィックスがなくても自動で補われます)", "粘贴登录凭据": "ログイン認証情報を貼り付け", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "貼り付けるのはログイン session です(同時にモデルゲートウェイの token でもあります)。Loomy には更新用 API がなく、session の有効期間は約 14 日です。期限切れ後は再ログインしてください。", "粘贴网关凭据": "ゲートウェイ認証情報を貼り付け", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "ウェブのログイン状態 cookie monkeycode_ai_session の値を貼り付け(ブラウザーで Cookie 全体をコピーしてそのまま貼り付けても可。ゲートウェイが値を自動で取り出します)。
    {siteNote}
    MonkeyCode には更新用 API がありません:session の有効期間は約 30 日(ハードリミット)で、期限切れ後はウェブに再ログインして貼り付け直せば済みます。", "系统浏览器": "システムブラウザ", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "システムブラウザは既存のログイン状態を再利用できます(国際版で推奨);内蔵ウィンドウの方がクリーンです。", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Cline アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "システムブラウザで開きます(ログイン済みの Google アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Zai / Google アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Meituan アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みアカウントを再利用);完了後は自動でリストに追加されます", "系统默认浏览器": "システムの既定ブラウザ", "编码套餐 API Key": "コーディングプラン API Key", "网关 Secret": "ゲートウェイシークレット", "网页登录": "ウェブログイン", "网页登录的打开方式": "ウェブログインの開き方", "网页登录(Zai / Google)": "ウェブログイン(Zai / Google)", "自定义": "カスタム", "获取风控配置失败,将直接尝试领取:{message}": "不正対策設定の取得に失敗しました。そのまま受け取りを試みます:{message}", "获取验证码": "コードを取得", "该上游无需鉴权(不发送鉴权头)": "このアップストリームは認証不要(認証ヘッダーを送信しません)", "该提供商": "このプロバイダー", "该提供商账号添加功能即将上线": "このプロバイダーのアカウント追加機能は近日公開予定です", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "このカスタムプロバイダーは存在しません(削除された可能性があります)。更新してから再試行してください", "请先选择一个自定义提供商": "先にカスタムプロバイダーを選択してください", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "表示されたスライダーで認証を完了してください(公式が求める不正対策ステップ)", "请填写 11 位大陆手机号": "11 桁の中国本土の携帯番号を入力してください", "请填写 6 位数字验证码": "6 桁の認証コードを入力してください", "请填写 Base URL": "Base URL を入力してください", "请填写 {label}": "{label} を入力してください", "请填写名称": "名前を入力してください", "请完成验证…": "認証を完了してください…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "%APPDATA%/AutoClaw/auth.json を読み込んで復号します。Windows のみ", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json を読み込みます。Cline クライアントでログイン済みである必要があります", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json を読み込みます。CatPaw クライアントでログイン済みである必要があります", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "本機の KukuAI クライアントのログイン状態を読み込みます(%APPDATA%\\baidugenflowpro\\Network\\Cookies)。KukuAI クライアントでログイン済みである必要があります", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "本機クライアントの現在のログイン状態を読み込みます(平文 Cookie、復号不要)。クライアントの実行中は Cookies ファイルが排他占有されるため、インポート前に KukuAI クライアントを終了してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら「Token を更新」をクリックして同期してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら再インポートしてください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。Zai / Google でクライアントにログインしているユーザーはこちらを使ってください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。これは {label} に分類されます。", "账号信息": "アカウント情報", "账号信息不完整,请刷新后重试": "アカウント情報が不完全です。更新してから再試行してください", "账号已添加,但请留意:{warning}": "アカウントを追加しましたが、ご注意ください:{warning}", "账号版本": "アカウントバージョン", "账号类型": "アカウント種別", "账号:{name}
    ": "アカウント:{name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Inference Providers ルートを使用します。Key は hf.co/settings/tokens で作成します", "还没有账号": "アカウントはまだありません", "这一家当前不支持网页登录,请改用填写凭证": "このプロバイダーは現在ウェブログインに対応していません。認証情報の入力に切り替えてください", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "このアカウントには現在自動で受け取れるイベントがありません(自動で受け取るのは毎日ログインで付与されるポイントのみです)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "このクォータは「イベントプラン」の経路を使用します:転送時にコーディングプランの期限切れが表示された場合は、", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには中国サイト(monkeycode-ai.com)のアカウントを入力します:中国サイトの session を貼り付けてください。国際サイト(monkeycode-ai.net)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには国際サイト(monkeycode-ai.net)のアカウントを入力します:国際サイトの session を貼り付けてください。中国サイト(monkeycode-ai.com)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", "选择凭证文件导入": "認証情報ファイルからインポート", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "公式クライアントのログイン状態の認証情報ファイル(workbuddy-desktop.info / workbuddy-desktop-ai.info)または wb2api がエクスポートしたアカウント JSON(ネスト / フラット形式どちらも可)を選択してください。このマシンの公式クライアントから直接読み取ることもできます。", "选择提供商": "プロバイダーを選択", "选择的文件不是合法 JSON": "選択したファイルは有効な JSON ではありません", "选择要添加账号的提供商": "アカウントを追加するプロバイダーを選択", "重新扫描": "再スキャン", "鉴权": "認証", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan プラン(国際版サイト)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding プラン(中国版サイト)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding プラン(国際版サイト)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio モデルサービス(国際版サイト、OpenAI 互換モード)", "需要图形验证码:登录窗口已弹出,请填写后继续": "画像認証が必要です:ログインウィンドウが開きました。入力して続行してください", "预置 API": "プリセット API", "领取 CodeArts 每日福利": "CodeArts の毎日特典を受け取る", "领取失败:{message}": "受け取りに失敗しました:{message}", "领取并让官方确认": "受け取って公式の確認を待つ", "风控验证配置不完整,请稍后重试": "不正対策認証の設定が不完全です。しばらくしてから再試行してください", "验证码": "認証コード", "验证码已发送。收到后填入下方并点「登录并添加」": "認証コードを送信しました。受け取ったら下の欄に入力し、「ログインして追加」をクリックしてください", "验证码已发送,请查看手机短信": "認証コードを送信しました。携帯の SMS をご確認ください", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "認証コードを送信しました。携帯の SMS をご確認ください。下の欄に入力して「ログインして追加」をクリックすると、ログインが完了します", "验证码已发送,请查看短信": "認証コードを送信しました。SMS をご確認ください", "验证码校验失败,请重试": "認証コードの検証に失敗しました。再試行してください", "验证码校验超时,请重试": "認証コードの検証がタイムアウトしました。再試行してください", "验证码组件不可用,请重试": "認証コンポーネントが利用できません。再試行してください", "验证码组件初始化超时,请重试": "認証コンポーネントの初期化がタイムアウトしました。再試行してください", "验证码组件加载失败,请检查网络后重试": "認証コンポーネントの読み込みに失敗しました。ネットワークを確認して再試行してください", "验证码组件加载异常,请重试": "認証コンポーネントの読み込みでエラーが発生しました。再試行してください", "验证码组件加载超时,请检查网络后重试": "認証コンポーネントの読み込みがタイムアウトしました。ネットワークを確認して再試行してください", "验证码组件未加载,请重启应用后重试": "認証コンポーネントが読み込まれていません。アプリを再起動してから再試行してください", "(免费额度池,模型名带 cline-free/ 前缀)。": "(無料枠プール、モデル名に cline-free/ プレフィックスが付きます)。", "(其中 {n} 把恢复为不限制)": "(うち {n} 個は無制限に戻ります)", "(必填)": "(必須)", "(有效期 {window})": "(有効期間 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": "(サブスクプール、モデル名に cline-pass/ プレフィックスが付きます。アカウントに対応するサブスクリプションが必要です)。", ",下一次最快 {minutes} 分钟后": "、次回は最短 {minutes} 分後", ",并从 {n} 把 Key 的可用提供商里移除": "、Key {n} 個を利用可能なプロバイダーからも除外しました" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · モデル {head}{rest}", " 等 {n} 个": " など {n} 個", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1// で始まる Google refresh token(refresh_token=… の行をそのまま貼り付けても可)", "11 位大陆手机号": "11 桁の中国本土の携帯番号", "1~64 个字符,账号列表里按它分组显示": "1~64 文字、アカウント一覧ではこれでグループ表示されます", "6 位数字": "6 桁の数字", "

  • 没有可自动领的活动
  • ": "
  • 自動で受け取れるイベントはありません
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    受け取るのはプラン特典ポイントで、特典モデルの token プールは増えません;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 互換エンドポイントは https://api.deepseek.com/anthropic です(プロトコルを anthropic に切り替えるときにこれを入力)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic プロトコルではルートアドレスを入力し、/v1 は付けないでください", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 中国版", "AutoClaw 国际版": "AutoClaw 国際版", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS は必須です;**完全な Cookie** を貼り付けてください(Cookie エディターのワンクリック書き出しで構いません)—— このうち **PTOKEN は必ず残してください**。ゲートウェイはこれを使って Baidu から KukuAI の業務セッショントークンを発行してもらうため、欠けるとモデル更新時に「未ログイン」と表示されます。Cookie ヘッダー全体、Cookie エディターが書き出した JSON 配列、または {BDUSS, STOKEN} オブジェクトに対応しています。KukuAI には更新の仕組みがないため、ログイン状態の期限が切れたら貼り直せば済みます。", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=…(または Cookie エディターが書き出した JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw の X-Passport-Token(ログイン状態 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT(3 段のドット区切り)", "Command Code": "Command Code", "ModelScope 国内版": "ModelScope 中国版", "ModelScope 国际版": "ModelScope 国際版", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 国際版", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM のマネージドエンドポイント。Key は integrate.api.nvidia.com で申請します", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken は Accio のログイン認証情報です(長い不透明な token 文字列で、JWT ではありません);refreshToken は任意で、入力すると期限切れ時に自動更新できます。{label}アカウントの認証情報を入力してください —— {siteNote}(最も簡単な方法:上の「ウェブログイン」を使えば token を手動で探す必要はありません。)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken は Trae の Cloud-IDE-JWT(3 段のドット区切り)です。refreshToken は期限切れ時の自動更新に使用します(本家の refreshToken は 1 回ごとに交換され、一度更新すると古いものは無効になります。そのため 2 つのプログラムで同じアカウントを同時に更新しないでください)。
    手動で貼り付ける場合は machineId / deviceId も一緒に入力してください:アップストリームはこれらをログイン時にアップロードされたデバイス公開鍵と紐付けてデバイスを判定するため、根拠なく別のペアにすると 2xxxx 系のデバイスバインディング拒否に当たります。
    この 3 つがない場合の正道は上の「ウェブログイン」を使うことです;コンテナ / リモートデプロイ形態では案内に従ってアドレスバーのコールバックアドレスを貼り付けてください。", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session の値(Cookie 全体をそのまま貼り付けても可)", "ms- 开头的 API 令牌": "ms- で始まる API トークン", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken は任意で、入力すると期限切れ時に自動更新できます;どちらも小浣熊クライアントのログイン状態ファイルから取得できます。", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken は任意で、入力すると自動更新できます;どちらもクライアントのログイン状態ファイルから取得できます。同じ Cline アカウントはどちらのプールでも使え、ここでは {label} に分類されます。", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token は enc: プレフィックスに対応しています(Windows では自動復号)。refreshToken を入力しないと自動更新できません。", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token はログイン状態 Cookie です;CatPaw には更新の仕組みがないため、期限切れ後はクライアントで再ログインが必要です。", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_ で始まる API Key(Authorization: Bearer … の行をそのまま貼り付けても可)", "{label} 网页登录的打开方式": "{label} のウェブログインの開き方", "{label} 账号地区": "{label} アカウントの地域", "{label} 账号的添加方式": "{label} アカウントの追加方法", "{name} 不是合法 JSON:{reason}": "{name} は有効な JSON ではありません:{reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name} には JSON オブジェクトを貼り付けてください(例:{sample})", "{n} 个账号": "{n} 個のアカウント", "{n} 个账号,点击添加": "{n} 個のアカウント、クリックして追加", "{seconds}s 后重发": "{seconds} 秒後に再送", "✅ {label}账号已添加": "✅ {label} アカウントを追加しました", "✅ {label}账号已添加{name}": "✅ {label} アカウントを追加しました{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ cc-switch から {n} 個のプロバイダーをインポートしました", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ カスタムプロバイダー「{name}」を作成し、アカウントを追加しました", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ カスタムプロバイダー「{name}」を削除しました{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ ログインに成功し、{edition}アカウントをリストに追加しました", "✅ 领取成功:{planId}{period}": "✅ 受け取りに成功しました:{planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 同じプロバイダーに複数の key を置くことができ、優先度に従ってローテーションされます。", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」のアカウント追加機能は開発中です。ご期待ください。", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "1 つの Key で複数のプロバイダーのモデルを利用できます。モデル名は「ベンダー/モデル」の完全名を指定します(例:deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "アップストリームが認証不要の場合は空欄にし、下の項目にチェックを入れてください(空欄かつ未チェックでは認証情報未設定として扱われます)", "上游信息": "アップストリーム情報", "不可领({status})": "受け取り不可({status})", "不支持导入": "インポートに対応していません", "不是有效的凭证文件:内容要是一个 JSON 对象": "有効な認証情報ファイルではありません:内容は JSON オブジェクトである必要があります", "不是有效的凭证文件:需要包含 accessToken 与 uid": "有効な認証情報ファイルではありません:accessToken と uid が必要です", "不是自定义提供商": "カスタムプロバイダーではありません", "不需要 Key:转发与拉取模型都不发送鉴权头": "Key は不要:転送とモデル取得のいずれも認証ヘッダーを送信しません", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "両版のアカウントは同時に保存でき、それぞれ独自のモデルカタログを持ちます(中国版と国際版は別々のプロバイダーで、個別に有効化とマッピングができます)。", "中国版": "中国版", "今天没有需要领的活动(都已到账)": "本日受け取る必要のあるイベントはありません(すべて付与済み)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "本日(北京時間 {day})は {attempts} 回試行済み、あと {left} 回試せます{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "別のマシン(または OfficeAce デスクトップ版の models.json)から次の 3 項目を取り出して貼り付けてください:モデルゲートウェイのベース URL(baseUrl、https://modelgw-…/v2 の形式)と modelAppKey / modelAppSecret。この 3 項目だけで転送できます(ゲートウェイ認証情報は無期限)。コントロールプレーンの一時認証情報(accessKeyId など)は任意で、空欄の場合は残高照会と自動更新が使えませんが、転送には影響しません。", "从本机导入桌面端登录态": "本機からデスクトップ版のログイン状態をインポート", "任务镜像 id": "タスクイメージ id", "使用 Google 账号登录": "Google アカウントでログイン", "使用 Zai 账号登录": "Zai アカウントでログイン", "使用个人访问令牌(PAT)": "個人アクセストークン(PAT)を使用", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "無料モデルでは Key の入力は不要です(既定で「このアップストリームは認証不要」がチェックされ、ゲートウェイは自動的に匿名認証情報を使用します);有料モデルでは Zen の API Key を入力します。無料枠のアップストリームは公式クライアントの形態しか受け付けないため、「OpenCode 公式クライアントの偽装」が既定で有効になっています", "内嵌窗口": "内蔵ウィンドウ", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "内蔵ウィンドウで開きます;ウィンドウを閉じると待機をキャンセルします(Google アカウントが拒否された場合はシステムブラウザをお使いください)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "内蔵ウィンドウで開きます;完了後は自動でリストに追加され、ウィンドウを閉じると待機をキャンセルします", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "内蔵ウィンドウは新しい環境を使うため、複数のアカウントが互いに影響しません;ウィンドウを閉じると待機をキャンセルします", "内嵌窗口(推荐)": "内蔵ウィンドウ(推奨)", "准备验证…": "認証を準備中…", "凭据 JSON": "認証情報 JSON", "凭证文件在哪?": "認証情報ファイルの場所は?", "创建并添加账号": "作成してアカウントを追加", "创建这个提供商,并同时建立它的第一个账号。": "このプロバイダーを作成し、同時にその最初のアカウントを作成します。", "删除功能不可用(脚本未就绪)": "削除機能は利用できません(スクリプト未準備)", "删除失败:{reason}": "削除に失敗しました:{reason}", "删除此提供商": "このプロバイダーを削除", "及 {n} 个账号": "、および {n} 個のアカウント", "发送中…": "送信中…", "发送失败:{message}": "送信に失敗しました:{message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "送信は未確認です:ログインウィンドウが開きました。表示されたウィンドウで手動でログインを完了してください", "取消失败:{message}": "キャンセルに失敗しました:{message}", "取消等待": "待機をキャンセル", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "「内蔵ウィンドウ」でのみサードパーティの入り口を復元できます:システムブラウザではログインページを変更できないためです", "可选": "任意", "可选(cloudaicompanionProject):留空由网关自动发现": "任意(cloudaicompanionProject):空欄の場合はゲートウェイが自動検出します", "可选,展示用": "任意、表示用", "可选,没有则无法自动续期": "任意、ないと自動更新できません", "可选,留空使用凭据里的 user_name": "任意、空欄の場合は認証情報の user_name を使用", "可选,留空使用账号姓名、邮箱或令牌指纹": "任意、空欄の場合はアカウントの氏名、メールアドレス、またはトークンフィンガープリントを使用", "可选,留空使用账号昵称或邮箱": "任意、空欄の場合はアカウントのニックネームまたはメールアドレスを使用", "可选,留空则用 key 尾号": "任意、空欄の場合は key の末尾を使用", "可选,留空则用 userId": "任意、空欄の場合は userId を使用", "可选,留空则用上游账号昵称": "任意。空欄の場合は上流アカウントのニックネームを使用", "可选,留空则用上游返回的账号名或账号 id": "任意、空欄の場合はアップストリームが返したアカウント名またはアカウント id を使用", "可选,留空则用凭证里的账号名": "任意、空欄の場合は認証情報のアカウント名を使用", "可选,留空则用文件里的昵称": "任意。空欄の場合はファイル内のニックネームを使用", "可选,留空则用登录名或 uid": "任意、空欄の場合はログイン名または uid を使用", "可选,留空则用脱敏手机号": "任意、空欄の場合はマスク済み電話番号を使用", "可选,留空则用脱敏手机号或 userId": "任意、空欄の場合はマスク済み電話番号または userId を使用", "可选,留空则用账号 uk": "任意、空欄の場合はアカウントの uk を使用", "可选,留空则用邮箱或令牌尾号": "任意、空欄の場合はメールアドレスまたはトークンの末尾を使用", "可选,留空用「OfficeAce 果办」": "任意、空欄の場合は「OfficeAce」を使用", "可选,留空自动生成": "任意、空欄の場合は自動生成", "可选,留空自动用昵称": "任意、空欄の場合はニックネームを自動使用", "可选,续期时带上": "任意、更新時に一緒に送信されます", "可选,讯飞侧 userid": "任意、iFlytek 側の userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "任意;会話の開始に必須です。空欄の場合はゲートウェイがこのアカウントの既存タスクから自動検出します。見つからない場合は後で手動で補ってください。", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "任意;アカウントのメールアドレスで、表示と身元識別に使用します(新しいトークンに替えても同じアカウントとして認識されます)", "可选;UUID 形态,与凭据同生共死": "任意;UUID 形式で、認証情報と一体で管理されます", "可选;填了才能到期自动续期": "任意;入力すると期限切れ時に自動更新できます", "可选;用于去重与展示名(留空时网关会问一次上游)": "任意;重複排除と表示名に使用します(空欄の場合、ゲートウェイがアップストリームに一度問い合わせます)", "可选;用于生成账号 id 与展示名": "任意;アカウント id と表示名の生成に使用します", "可选;纯数字串(上游只收 8–24 位数字)": "任意;数字のみの文字列(アップストリームは 8–24 桁の数字のみ受け付けます)", "可领取": "受け取り可能", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "同じプロバイダーに混在させられます:Key のあるアカウントと認証不要のアカウントは、それぞれの規則に従います", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "同じアドレスでプロトコルを anthropic に変えると、その Claude 互換エンドポイントを使用します。転送には OpenCode Go の API Key が必須です(サブスクリプション制;モデルカタログの取得に Key は不要ですが、リクエストを送るとアップストリームが 401「Missing API key」を返します)", "响应为空": "応答が空です", "国内版": "中国版", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "中国版と**国際版は 2 組の独立したアカウントとプラン**で、認証情報と受け取ったプランはどちらも共用できません。", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "中国版のログインページには Google / GitHub の入り口がありません(WeChat / 電話番号 / メールアドレスでログインします)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "中国版のログインサイトは www.accio-ai.com で、国際版とは別のサイトです。", "国内版(WorkBuddy)": "中国版(WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "中国版サイトは https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "中国版サイト(minimaxi.com);OpenAI 互換アドレスは https://api.minimaxi.com/v1", "国际版": "国際版", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "国際版 z.ai の Coding プラン;OpenAI 互換アドレスは https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "国際版と中国版は**2 組の独立したアカウント**です(同じアカウント体系の 2 つのサイト)。認証情報は共用できません。", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "国際版と中国版はアカウント体系が独立しています。国際版の認証情報を入力してください。refreshToken を入力しないと自動更新できません。", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "国際版のログインページは既定でメールアドレスログインのみ表示されます。チェックすると Google / GitHub / X の入り口が復元されます", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "国際版の推論サイトは api.z.ai で、中国版とは別のサイトです;プランもそれぞれ独立しています。", "国际版(WorkBuddy AI)": "国際版(WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "国際版サイトの Coding プラン;OpenAI 互換アドレスは https://api.minimax.io/v1", "在 cc-switch 里找到": "cc-switch で", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "内蔵ウィンドウで公式ログインを完了してください。成功すると自動でアカウント一覧に追加されます。", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "{label} の Qoder アカウント設定 → Integrations で PAT を生成してください(Google / GitHub のトークンは入力しないでください)。2 つの地域のアカウントと認証情報は共用できません。", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "開いたウィンドウで Baidu アカウントを使って KukuAI 本体サイトにログインしてください(SMS 認証コード / QR コードのいずれも可)。ログインに成功すると自動でアカウント一覧に追加されます。ゲートウェイは Baidu から KukuAI の業務セッショントークンを発行してもらいます(本機に KukuAI クライアントがインストールされている必要があります)。", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "開いたウィンドウで Google アカウントにログインしてください(Antigravity の認可ページ)。認可が完了すると自動でアカウントリストに追加されます。", "在浏览器中打开登录页": "ブラウザでログインページを開く", "地区": "地域", "填写凭证": "認証情報を入力", "填写凭证添加": "認証情報を入力して追加", "备注名": "ラベル名", "套餐": "プラン", "如:智谱 GLM": "例:Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "ログイン完了後は自動でアカウント一覧に追加されます。ニックネームはアップストリームから取得します。", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "公式クライアントの認証情報ディレクトリ:Windows は C:\\Users\\<ユーザー名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth、macOS は ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "公式が付与を確認済み", "导入": "インポート", "导入中…": "インポート中…", "导入凭证文件": "認証情報ファイルのインポート", "导入失败": "インポートに失敗しました", "导入失败:{reason}": "インポートに失敗しました:{reason}", "导入所选": "選択項目をインポート", "导入所选({n})": "選択項目をインポート({n})", "导入桌面端登录态": "デスクトップ版のログイン状態をインポート", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "内蔵ウィンドウを開きます;認可が完了すると自動でアカウント一覧に追加されます。ウィンドウを閉じると待機をキャンセルします。認可ページの最後に zcode:// リンクを開けない旨の表示が出ることがありますが、これは正常です —— 結果はサーバー側で記録済みです", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "内蔵ウィンドウを開きます;認可が完了すると自動でアカウント一覧に追加されます。リモートパネルではコールバックアドレスを貼り付けられます。ウィンドウを閉じると待機をキャンセルします。リンクの有効期限は 5 分で、タイムアウトまたは未クリックの場合は無効になります(再発行できます)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "内蔵ウィンドウを開きます;ログイン完了後は自動でアカウント一覧に追加されます。ウィンドウを閉じると待機をキャンセルします", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの Trae アカウントが再利用されます);同一マシンでは完了後に自動追加され、Docker / リモートパネルでは案内に従ってアドレスバーのコールバックアドレスを貼り付けてください。", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの ZCode アカウントが再利用されます);認可完了後は自動でアカウント一覧に追加されます。ページの最後に zcode:// リンクを開けない旨の表示が出ることがありますが、正常な動作です", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "システムの既定ブラウザで認可ページを開きます(ブラウザでログイン済みの Huawei Cloud アカウントが再利用されます);ブラウザとゲートウェイが別のマシンにある場合は、上の説明に従って最終的なコールバックアドレスをパネルに貼り付けてください", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "システムの既定ブラウザでログインページを開きます(ブラウザでログイン済みの Accio アカウントが再利用されます);ログイン完了後は自動でアカウント一覧に追加され、ポップアップを閉じると待機をキャンセルします", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan プラン(シンガポールサイト)", "已到账": "付与済み", "已取消登录等待": "ログイン待ちをキャンセルしました", "已取消领取": "受け取りをキャンセルしました", "已取消验证码": "認証をキャンセルしました", "已填写手机号,正在发送验证码…": "電話番号を入力しました。認証コードを送信中…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "認証不要を宣言済み:アカウントは通常どおりルーティングされ、送信時に認証ヘッダーは一切付きません", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "{ok} 個をインポートしました。失敗 {fail} 個(失敗した項目にはリスト内でマークが付いています)", "已建过 · {n} 个账号,点击继续添加": "作成済み · {n} 個のアカウント、クリックして追加", "已建过,点击继续添加账号": "作成済み、クリックしてアカウントを追加", "已打开官方登录页,请在窗口中完成登录…": "公式ログインページを開きました。ウィンドウでログインを完了してください…", "已点发送,等待短信…": "送信しました。SMS を待っています…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "システムの既定ブラウザでログインページを開きました。ブラウザでログインを完了してください…", "已领取,等官方确认": "受け取り済み、公式の確認待ち", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "現在のシェルバージョンは AutoClaw のウェブログインに対応していません。アプリを更新してください", "当前没有可领取的套餐(活动尚未开始)": "現在受け取り可能なプランはありません(イベントはまだ開始されていません)", "当前环境不支持领取(桥接方法缺失)": "現在の環境では受け取りに対応していません(ブリッジメソッドがありません)", "必填,CatPaw 账号标识": "必須、CatPaw アカウントの識別子", "恢复 Google / GitHub 入口": "Google / GitHub の入り口を復元", "手机号": "電話番号", "手机验证码登录": "SMS 認証コードログイン", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Trae SOLO の公式認可ページ(trae.cn)を開き、あなたの Trae アカウントでログインしてください:認可が完了すると公式ページから本機の一時ポートにリダイレクトされます;同一マシンでのデプロイでは自動受信し、Docker / リモートパネルでは案内に従ってアドレスバーのコールバックアドレスをコピーしてください。", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Accio {label}の公式ログインページ({site})を開き、あなたの Accio アカウントでログインしてください:ログインに成功すると公式ページから本機にリダイレクトされます;同一マシンでは自動完了し、Docker / リモートパネルでは案内に従ってコールバックアドレスを貼り付けてください(認可コードは本機からゲートウェイに渡されるだけで、画面に平文 token は表示されません)。", "打开 Accio {label}登录页": "Accio {label} のログインページを開く", "打开 Antigravity 网页登录": "Antigravity のウェブログインを開く", "打开 CatPaw 网页登录": "CatPaw のウェブログインを開く", "打开 Cline 授权页": "Cline の認可ページを開く", "打开 CodeArts 授权页": "CodeArts の認可ページを開く", "打开 Qoder 网页登录": "Qoder のウェブログインを開く", "打开 Trae 授权页": "Trae の認可ページを開く", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "ZCode {label}の公式認可ページを開き、あなたのアカウントでログインしてください。認可結果は ZCode サーバー側で記録され、ゲートウェイがバックグラウンドで自動的に認証情報を取得してアカウント一覧に追加します。", "打开 ZCode {label}授权页": "ZCode {label} の認可ページを開く", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Huawei Cloud CodeArts の公式認可ページを開いてログインします:ログイン完了後、公式ページからブラウザがゲートウェイ自身の /oauth/callback に戻され、ゲートウェイはワンタイム認可コードで一時認証情報を取得し、アカウント一覧に追加します。
    ゲートウェイが別のマシンで動作している場合は、ウェブ画面でアドレスバーの最終的なコールバックアドレスをそのままパネルに貼り付けるよう案内されます。", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Huawei Cloud の認可ページを開いてログインしてください:完了すると、ゲートウェイがクラウドをポーリングして認可コードを取得し、アカウント一覧に追加します(OfficeAce デスクトップ版は不要で、コールバック URL を手動で貼り戻す必要もありません)。", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "公式認可ページを開いてデバイスコード認可を完了します。ログインするのは {label}({site})のアカウントです。", "打开授权页": "認可ページを開く", "打开授权页完成确认,账号自动加入 {label}{note}": "認可ページを開いて確認を完了すると、アカウントが自動で {label} に追加されます{note}", "打开方式": "開き方", "打开网页登录": "ウェブログインを開く", "探测失败:{message}": "検出に失敗しました:{message}", "接入一个兼容上游": "互換アップストリームを接続", "提交中…": "送信中…", "搜索提供商": "プロバイダーを検索", "搜索提供商…": "プロバイダーを検索…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "公式プラグイン / CLIProxyAPI が保存した認証情報 JSON をまるごと貼り付けてください({\"codearts_provider_credential\":{…}} の形。フラットなものでも可)。
    必須:access_key_id、secret_access_key、security_token。自動更新を効かせるには refresh_token と oauth_context も一緒に貼り付ける必要があります —— 一時認証情報は約 1 時間で期限切れになり、この半分が欠けると更新できず、再ログインするしかありません。", "文件是{edition}凭证,已按该版本导入": "ファイルは{edition}の認証情報のため、そのバージョンでインポートしました", "新建自定义提供商": "カスタムプロバイダーを新規作成", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "平文 JWT または auth.json 内の enc: 暗号化値(自動復号)", "明文 JWT(国际版账号的 access token)": "平文 JWT(国際版アカウントの access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu bigmodel.cn の Coding プラン。Key は open.bigmodel.cn/usercenter/apikeys で取得します", "未知错误": "不明なエラー", "未能获取授权地址,请重试": "認可アドレスを取得できませんでした。再試行してください", "未能读取 cc-switch 数据": "cc-switch のデータを読み取れませんでした", "未领取成功": "受け取りに失敗しました", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "ローカル Ollama、OpenCode Zen の無料枠などのアップストリームではチェックを入れてください。入れないとアカウントを使用できません", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "本家には**互いに代替できない** 2 つの認証情報があり、使いたい機能に応じて入力してください。少なくともどちらか一方は必須です:コーディングプラン API Key は推論の転送用({site} を叩きます)とウィンドウクォータの照会用(N 時間ごと / 週ごとの残り割合);jwt はプランの受け取りと残高照会用(zcode.z.ai の billing ゲートウェイを叩きます。公式名称は Coding Plan JWT で、3 段のドット区切り文字列です)。残高はどちらでも照会できますが、読み取れる内容が異なります:jwt は残高バケットとプランの有効期限、API Key はウィンドウクォータを読み取ります;受け取りは jwt のみ、転送は API Key のみです。{label}アカウントの認証情報を入力してください —— {plan}(最も簡単な方法:上の「ウェブログイン」を使うこと —— この API Key を代わりに交換してくれ、2 つの認証情報をまとめて取得できます。)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "本機の Ollama の OpenAI 互換エンドポイント。API Key は不要です(既定で「このアップストリームは認証不要」がチェック済みで、認証ヘッダーは一切送信されません)", "本次未确认到账": "今回は付与が確認できませんでした", "条可导入": "件がインポート可能", "条配置,其中": "件の設定、うち", "桌面运行时不可用(Tauri 未初始化)": "デスクトップランタイムが利用できません(Tauri が未初期化)", "模型网关基址": "モデルゲートウェイのベース URL", "正在打开百度登录页…": "Baidu のログインページを開いています…", "正在扫描本机 cc-switch…": "本機の cc-switch をスキャンしています…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "{name} のログイン完了を待っています;完了またはキャンセルしないと新しいログインを開始できません", "每周": "毎週", "每日": "毎日", "每月": "毎月", "没有则无法自动续期": "ないと自動更新できません", "没有匹配「{keyword}」的提供商": "「{keyword}」に一致するプロバイダーはありません", "添加 {name} 账号": "{name} アカウントを追加", "添加中…": "追加中…", "添加到 ": "追加先 ", "添加失败:{reason}": "追加に失敗しました:{reason}", "添加小浣熊账号": "小浣熊アカウントを追加", "添加方式": "追加方法", "添加账号": "アカウントを追加", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding プラン;汎用推論エンドポイントは https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "クリックしてアカウントを追加", "点开即预填,填 Key 接入": "開くと自動入力済み、Key を入力して接続", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "ボタンを押すとまずスライダー認証(公式の不正対策)を 1 回行い、その後ログインページが開きます。ログイン完了で自動的にアカウントが追加されます。
    これが国際版公式の唯一のログイン方式です。すでにクライアントでログイン済みの場合は、「デスクトップ版のログイン状態をインポート」を使う方が速いです。", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "AutoClaw アカウントに紐付けられた電話番号でログインします:「コードを取得」をクリックし、SMS を受け取ったら下の欄に入力してログインしてください。認証コードは本機から直接公式 API に送信され、画面に token は表示されません。", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "CatPaw アカウントでログインを完了します(Meituan passport)。成功すると自動でアカウント一覧に追加されます。", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Loomy アカウントに紐付けられた電話番号でログインします:「コードを取得」をクリックして入力するだけです。本家で最も手軽な入り口です。", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "転送用。apiKey.secret の 2 段ドット区切り形式です(未入力の場合、このアカウントは転送できません)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "プランの受け取りと残高照会用。未入力の場合、このアカウントは受け取りと残高照会ができません", "用户 ID": "ユーザー ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "紐付けられた電話番号でログインします:「コードを取得」をクリックして入力するだけです。これが中国版公式の唯一のログイン方式です。", "留空则用提供商名称": "空欄の場合はプロバイダー名を使用", "登录 / 添加 {name} 账号": "ログイン / {name} アカウントを追加", "登录 session(一长串)": "ログイン session(長い文字列)", "登录中…": "ログイン中…", "登录失败:{message}": "ログインに失敗しました:{message}", "登录已结束": "ログインは終了しました", "登录并添加": "ログインして追加", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "ログイン状態ファイルのパス:~/.box-agent/config/auth.json(Windows:C:\\Users\\<ユーザー名>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "カスタムプロバイダー「{name}」を削除しますか?このプロバイダー配下の {count} 個のアカウントも同時に削除され、削除後は元に戻せません。", "等待 Accio {label}登录完成…": "Accio {label} のログイン完了を待っています…", "等待 CatPaw 登录完成…": "CatPaw のログイン完了を待っています…", "等待 Cline 授权确认…": "Cline の認可確認を待っています…", "等待 CodeArts 登录完成…": "CodeArts のログイン完了を待っています…", "等待 Google 授权完成…": "Google の認可完了を待っています…", "等待 KukuAI 登录完成…": "KukuAI のログイン完了を待っています…", "等待 OfficeAce 登录完成…": "OfficeAce のログイン完了を待っています…", "等待 Qoder 授权完成…": "Qoder の認可完了を待っています…", "等待 Trae 授权完成…": "Trae の認可完了を待っています…", "等待 ZCode {label}授权完成…": "ZCode {label} の認可完了を待っています…", "等待小浣熊登录完成…": "小浣熊のログイン完了を待っています…", "等待登录完成…": "ログインの完了を待っています…", "等待网页登录…": "ウェブログインを待っています…", "粘贴 API Key": "API Key を貼り付け", "粘贴 API 令牌": "API トークンを貼り付け", "粘贴 Accio 的 accessToken": "Accio の accessToken を貼り付け", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity の Google refresh token を貼り付け(1// で始まる;refresh_token= を含む行全体をそのまま貼り付けても可)。
    これはウェブログイン以外の手動入り口です(例:ログイン済みの公式 IDE からエクスポート)。refresh token は期限切れにならず、access token の期限切れはゲートウェイが自動で更新します;トークンを紛失すると Google の認可をやり直すしかないため、大切に保管してください。", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code の API Key を貼り付け(user_ で始まる;公式 CLI の ~/.commandcode/auth.json またはウェブの studio から取得)。行全体 / 引用符付き / Bearer プレフィックス付きのまま貼り付けても構いません。ゲートウェイが自動で裸の key に剥がします。key は期限切れにならず、更新用 API もありません。無効になったら取得し直してください;追加時にゲートウェイが軽量な死活確認を 1 回行いますが、失敗しても追加には影響しません。", "粘贴 Cookie": "Cookie を貼り付け", "粘贴 Google refresh token": "Google refresh token を貼り付け", "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "ModelScope の API トークン(ms- で始まる。{site} の「アクセストークン」ページで取得)を貼り付けてください。
    {siteNote}
    このトークンは二役です。ゲートウェイは推論の呼び出しにも、アカウント身元・魔粒残高・毎日チェックインの読み取りにもこれを使います。トークンは長期有効で更新 API はありません。使えなくなったら再取得して貼り直すだけです。", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder の個人アクセストークン(pt-…)を貼り付け", "粘贴 access_token(一长串 JWT)": "access_token(長い JWT)を貼り付け", "粘贴 session cookie": "session cookie を貼り付け", "粘贴 token / refreshToken": "token / refreshToken を貼り付け", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "workos:… で始まるトークンを貼り付け(プレフィックスがなくても自動で補われます)", "粘贴登录凭据": "ログイン認証情報を貼り付け", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "貼り付けるのはログイン session です(同時にモデルゲートウェイの token でもあります)。Loomy には更新用 API がなく、session の有効期間は約 14 日です。期限切れ後は再ログインしてください。", "粘贴网关凭据": "ゲートウェイ認証情報を貼り付け", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "ウェブのログイン状態 cookie monkeycode_ai_session の値を貼り付け(ブラウザーで Cookie 全体をコピーしてそのまま貼り付けても可。ゲートウェイが値を自動で取り出します)。
    {siteNote}
    MonkeyCode には更新用 API がありません:session の有効期間は約 30 日(ハードリミット)で、期限切れ後はウェブに再ログインして貼り付け直せば済みます。", "系统浏览器": "システムブラウザ", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "システムブラウザは既存のログイン状態を再利用できます(国際版で推奨);内蔵ウィンドウの方がクリーンです。", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Cline アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "システムブラウザで開きます(ログイン済みの Google アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Zai / Google アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みの Meituan アカウントを再利用);完了後は自動でリストに追加されます", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "システムブラウザで開く(ログイン済みアカウントを再利用);完了後は自動でリストに追加されます", "系统默认浏览器": "システムの既定ブラウザ", "编码套餐 API Key": "コーディングプラン API Key", "网关 Secret": "ゲートウェイシークレット", "网页登录": "ウェブログイン", "网页登录的打开方式": "ウェブログインの開き方", "网页登录(Zai / Google)": "ウェブログイン(Zai / Google)", "自定义": "カスタム", "获取风控配置失败,将直接尝试领取:{message}": "不正対策設定の取得に失敗しました。そのまま受け取りを試みます:{message}", "获取验证码": "コードを取得", "该上游无需鉴权(不发送鉴权头)": "このアップストリームは認証不要(認証ヘッダーを送信しません)", "该提供商": "このプロバイダー", "该提供商账号添加功能即将上线": "このプロバイダーのアカウント追加機能は近日公開予定です", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "このカスタムプロバイダーは存在しません(削除された可能性があります)。更新してから再試行してください", "请先选择一个自定义提供商": "先にカスタムプロバイダーを選択してください", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "表示されたスライダーで認証を完了してください(公式が求める不正対策ステップ)", "请填写 11 位大陆手机号": "11 桁の中国本土の携帯番号を入力してください", "请填写 6 位数字验证码": "6 桁の認証コードを入力してください", "请填写 Base URL": "Base URL を入力してください", "请填写 {label}": "{label} を入力してください", "请填写名称": "名前を入力してください", "请完成验证…": "認証を完了してください…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "%APPDATA%/AutoClaw/auth.json を読み込んで復号します。Windows のみ", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json を読み込みます。Cline クライアントでログイン済みである必要があります", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json を読み込みます。CatPaw クライアントでログイン済みである必要があります", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "本機の KukuAI クライアントのログイン状態を読み込みます(%APPDATA%\\baidugenflowpro\\Network\\Cookies)。KukuAI クライアントでログイン済みである必要があります", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "本機クライアントの現在のログイン状態を読み込みます(平文 Cookie、復号不要)。クライアントの実行中は Cookies ファイルが排他占有されるため、インポート前に KukuAI クライアントを終了してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら「Token を更新」をクリックして同期してください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。クライアントで再ログインしたら再インポートしてください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。Zai / Google でクライアントにログインしているユーザーはこちらを使ってください。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "本機クライアントの現在のログイン状態を読み込みます。毎回リアルタイムで読み取ります(この記録を削除してもクライアントのログイン状態には影響しません)。これは {label} に分類されます。", "账号信息": "アカウント情報", "账号信息不完整,请刷新后重试": "アカウント情報が不完全です。更新してから再試行してください", "账号已添加,但请留意:{warning}": "アカウントを追加しましたが、ご注意ください:{warning}", "账号版本": "アカウントバージョン", "账号类型": "アカウント種別", "账号:{name}
    ": "アカウント:{name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Inference Providers ルートを使用します。Key は hf.co/settings/tokens で作成します", "还没有账号": "アカウントはまだありません", "这一家当前不支持网页登录,请改用填写凭证": "このプロバイダーは現在ウェブログインに対応していません。認証情報の入力に切り替えてください", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "このアカウントには現在自動で受け取れるイベントがありません(自動で受け取るのは毎日ログインで付与されるポイントのみです)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "このクォータは「イベントプラン」の経路を使用します:転送時にコーディングプランの期限切れが表示された場合は、", "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "ここには中国サイト(modelscope.cn)のアカウントを入力します。中国サイトのトークンを貼り付けてください。国際サイト(modelscope.ai)は別の provider・別のアカウントで、両者のトークンに互換性はありません。", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには中国サイト(monkeycode-ai.com)のアカウントを入力します:中国サイトの session を貼り付けてください。国際サイト(monkeycode-ai.net)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "ここには国際サイト(modelscope.ai)のアカウントを入力します。国際サイトのトークンを貼り付けてください。中国サイト(modelscope.cn)は別の provider・別のアカウントで、両者のトークンに互換性はありません。", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "ここには国際サイト(monkeycode-ai.net)のアカウントを入力します:国際サイトの session を貼り付けてください。中国サイト(monkeycode-ai.com)は別のプロバイダーで、アカウントも別です。両者の認証情報は共用できません。", "选择凭证文件导入": "認証情報ファイルからインポート", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "公式クライアントのログイン状態の認証情報ファイル(workbuddy-desktop.info / workbuddy-desktop-ai.info)または wb2api がエクスポートしたアカウント JSON(ネスト / フラット形式どちらも可)を選択してください。このマシンの公式クライアントから直接読み取ることもできます。", "选择提供商": "プロバイダーを選択", "选择的文件不是合法 JSON": "選択したファイルは有効な JSON ではありません", "选择要添加账号的提供商": "アカウントを追加するプロバイダーを選択", "重新扫描": "再スキャン", "鉴权": "認証", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan プラン(国際版サイト)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding プラン(中国版サイト)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding プラン(国際版サイト)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio モデルサービス(国際版サイト、OpenAI 互換モード)", "需要图形验证码:登录窗口已弹出,请填写后继续": "画像認証が必要です:ログインウィンドウが開きました。入力して続行してください", "预置 API": "プリセット API", "领取 CodeArts 每日福利": "CodeArts の毎日特典を受け取る", "领取失败:{message}": "受け取りに失敗しました:{message}", "领取并让官方确认": "受け取って公式の確認を待つ", "风控验证配置不完整,请稍后重试": "不正対策認証の設定が不完全です。しばらくしてから再試行してください", "验证码": "認証コード", "验证码已发送。收到后填入下方并点「登录并添加」": "認証コードを送信しました。受け取ったら下の欄に入力し、「ログインして追加」をクリックしてください", "验证码已发送,请查看手机短信": "認証コードを送信しました。携帯の SMS をご確認ください", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "認証コードを送信しました。携帯の SMS をご確認ください。下の欄に入力して「ログインして追加」をクリックすると、ログインが完了します", "验证码已发送,请查看短信": "認証コードを送信しました。SMS をご確認ください", "验证码校验失败,请重试": "認証コードの検証に失敗しました。再試行してください", "验证码校验超时,请重试": "認証コードの検証がタイムアウトしました。再試行してください", "验证码组件不可用,请重试": "認証コンポーネントが利用できません。再試行してください", "验证码组件初始化超时,请重试": "認証コンポーネントの初期化がタイムアウトしました。再試行してください", "验证码组件加载失败,请检查网络后重试": "認証コンポーネントの読み込みに失敗しました。ネットワークを確認して再試行してください", "验证码组件加载异常,请重试": "認証コンポーネントの読み込みでエラーが発生しました。再試行してください", "验证码组件加载超时,请检查网络后重试": "認証コンポーネントの読み込みがタイムアウトしました。ネットワークを確認して再試行してください", "验证码组件未加载,请重启应用后重试": "認証コンポーネントが読み込まれていません。アプリを再起動してから再試行してください", "(免费额度池,模型名带 cline-free/ 前缀)。": "(無料枠プール、モデル名に cline-free/ プレフィックスが付きます)。", "(其中 {n} 把恢复为不限制)": "(うち {n} 個は無制限に戻ります)", "(必填)": "(必須)", "(有效期 {window})": "(有効期間 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": "(サブスクプール、モデル名に cline-pass/ プレフィックスが付きます。アカウントに対応するサブスクリプションが必要です)。", ",下一次最快 {minutes} 分钟后": "、次回は最短 {minutes} 分後", ",并从 {n} 把 Key 的可用提供商里移除": "、Key {n} 個を利用可能なプロバイダーからも除外しました" }); diff --git a/desktop-tauri/ui/i18n/ja/checkin.js b/desktop-tauri/ui/i18n/ja/checkin.js index 52ca1d0d..a35a1fc8 100644 --- a/desktop-tauri/ui/i18n/ja/checkin.js +++ b/desktop-tauri/ui/i18n/ja/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ja/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO の checkin_credits 受け取り · 自然日 0 時に更新", "UMID 组件安装失败:{error}": "UMID コンポーネントのインストールに失敗しました:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 中国版 · タスクツリーを照会してワンクリックで点灯/受け取り · 新学期イベントとねこ旅行を含む · 行をクリックで詳細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 国際版のキープアライブ用モデル(順番にフォールバック)", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy国際版のデイリーアクティビティ用の無料モデル · 全体で1つの設定、スケジュールとは無関係", "{date}(每天 {time})": "{date}(毎日 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "完了可能 {n} 件", "{n} 项待领": "{n} 件受け取り待ち", "{total} 账号 · {done} 已签": "{total} アカウント · {done} チェックイン済み", "{total} 项任务 · {pending} 项可完成": "タスク {total} 件 · 完了可能 {pending} 件", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID コンポーネントをインストールしました。次回のチェックインで国際版の積分を受け取れます", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定期チェックインを有効にしました", "✅ 开学季任务执行完成": "✅ 新学期タスクの実行が完了しました", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長タスク完了:クレジット +{credit} エネルギー +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 初心者ボーナスの受け取りが完了しました。累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ チェックイン完了:{succeeded}/{total} 件のアカウントが受け取りに成功{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。空で送信すると既定({defaults})に戻します。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。リストを空にして保存すると既定のチェーン(現在の既定:{defaults})に戻ります。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「免费领积分」的每日任务 · 逐个领取": "「無料積分受け取り」のデイリータスク · 1 つずつ受け取る", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一度きりの特典 · チェックイン後に自動で照会して受け取り、受け取り済みは本機に記録し以降はアップストリームに問い合わせません · 行をクリックしてタスク一覧を展開", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "その日の報酬を一度にまとめて受け取ります(毎日チェックイン+新規特典) · 冪等性はアップストリームが保証", "一键安装组件": "ワンクリックでインストール", "一键完成": "一括完了", "一键领取({n})": "一括受け取り({n})", "上次执行:{line}": "前回実行:{line}", "上次签到时间": "前回のチェックイン時刻", "上次领取 {time} · 领取需通过滑块验证码": "前回の受け取り {time} · 受け取りにはスライダー認証が必要", "下次 {date}": "次回 {date}", "下次 {date} · 点此管理条目": "次回 {date} · クリックしてスケジュールを管理", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」に、CodeArts と ZCode の日次/プラン特典の受け取りは「アクティビティ特典」にあります。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」、CodeArts のデイリー特典はすぐ上の「デイリーチェックイン」にあります。ZCode のプラン受け取りは「アクティビティ特典」です。", "与国内版同一套任务接口 · 站点不同": "中国版と同じタスク API · サイトが異なる", "今天已领 {n} 份": "本日 {n} 件受け取り済み", "今天未领": "本日は未受取", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "本日(北京時間 {day})受け取り済み · 公式に {n} 件の到着を確認 · 明日また受け取れます", "今日已执行": "本日実行済み", "今日已派出": "本日は出発済み", "今日已领取": "本日受け取り済み", "今日签到": "本日のチェックイン", "今日签到进度": "本日のチェックイン進捗", "从清单里移除": "リストから削除", "保活": "キープアライブ", "保活 {n}": "キープアライブ {n}", "保活+领取": "キープアライブ+受け取り", "保活中…": "キープアライブ中…", "保活模型链": "キープアライブモデルチェーン", "全选": "すべて選択", "全部 {n} 家": "全 {n} 社", "全部完成": "すべて完了", "全部查询": "一括クエリ", "全部结果": "すべての結果", "全部账号均可签到": "すべてのアカウントがチェックイン可能", "全部领取": "すべて受け取り済み", "关着:所有条目都不执行": "オフ:どのスケジュールも実行されません", "删除失败:{error}": "削除に失敗しました:{error}", "删除定时条目": "スケジュールを削除", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;CodeArts はその日の運営特典を受け取ります(受け取り → 確認 → 読み戻し検証。自動実行は 1 日 6 回・間隔 10 分の書き込み制限を受けます);OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点时逐个签到,已勾 {n} / {total} 家": "定刻に 1 社ずつチェックインします。選択 {n} / {total} 社", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 起動時に自動で補完します", "去领取": "受け取りへ", "另有 {n} 个账号不参与每日签到": "ほかにデイリーチェックインの対象外のアカウントが {n} 件", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "完了済みタスクの報酬のみ受け取り(冪等・連打しても二重加算されません)", "可完成": "完了可能", "可派出": "出発可能", "可选 · 缺省显示时刻": "任意 · 未指定では時刻を表示", "可领奖": "受け取り可能", "后端未返回定时签到数据": "バックエンドがスケジュールデータを返しませんでした", "后端未返回签到中心数据": "バックエンドがチェックインセンターのデータを返しませんでした", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "国際版のチェックインには、UMID コンポーネントで生成するデバイスリスク制御 ID が必要です(本機では検出されませんでした)。", "在途": "旅行中", "填入缺省链": "既定のチェーンを入力", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "時刻と範囲を決めて「保存」を押してください。名前は空欄でも構いません(空欄なら時刻を表示)", "失败 {n}": "失敗 {n}", "套餐明细": "プラン明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder クライアントまたは qodercli をインストールすれば利用できます(ゲートウェイの再起動は不要)。", "安装中…": "インストール中…", "官方客户端的每日签到任务": "公式クライアントのデイリーチェックインタスク", "定时签到": "定期チェックイン", "定时签到已关闭": "定期チェックインを無効にしました", "尚未查询": "未照会", "尚未查询任务状态": "タスク状態は未クエリ", "巡检一次": "1 回実行", "已保存:{label}": "保存しました:{label}", "已保存:保活模型链": "保存しました:キープアライブモデルチェーン", "已保存:定时条目": "保存しました:スケジュール", "已删除定时条目": "スケジュールを削除しました", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "アクティビティを報告しました(連続ログイン達成)が、キャンペーンは未実施です(今回の報酬はなし)", "已抽 {n} 次": "{n} 回抽選しました", "已有结果 {checked} / 共 {total} 个账号": "結果あり {checked} / 全 {total} アカウント", "已签": "チェックイン済み", "已领 {claimed}/{total} · 累计 {earned} 积分": "受け取り済み {claimed}/{total} · 累計 {earned} 積分", "已领养": "飼い主になりました", "已领取": "受け取り済み", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "デバイスリスク制御 ID を付けて「毎日 100 Credits」を受け取り · UMID コンポーネントが必要", "开学季执行失败:{error}": "新学期の実行に失敗:{error}", "开学季执行完成:{message}": "新学期の実行が完了:{message}", "开学季活动": "新学期イベント", "开着:启用的条目按各自时刻执行": "オン:有効なスケジュールがそれぞれの時刻に実行されます", "待签": "未チェックイン", "待领新手福利": "受け取り待ちの初心者ボーナス", "总开关": "マスタースイッチ", "总开关已关闭 · 在「定时签到」页打开": "マスタースイッチがオフです · 「定期チェックイン」タブで有効化してください", "成功 {n}": "成功 {n}", "成长任务": "成長タスク", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長タスク完了(成功 {done} 件・失敗 {failed} 件):クレジット +{credit} エネルギー +{energy}", "成长任务执行失败:{error}": "成長タスクの実行に失敗:{error}", "执行失败:{error}": "実行に失敗しました:{error}", "执行并抽奖": "実行して抽選", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "新学期タスクを実行し、抽選回数を使い切る(シェア/会話/エキスパートイベント)", "把缺省链填进清单,再点「保存」生效": "既定のチェーンを一覧に入れます。「保存」で反映されます", "抽奖机会 {n} 次": "抽選チャンス {n} 回", "按住拖动调整顺序": "押したままドラッグで並べ替え", "按住拖动,调整这个模型在链里的顺序": "押したままドラッグして、チェーン内でのこのモデルの順序を変更します", "按序逐个尝试,共 {n} 个": "順番に試行、計 {n} 件", "按结果筛选": "結果で絞り込み", "探测 + 领取 + 保活 · 与定时签到同一套组合": "検出 + 受け取り + キープアライブ · 定期チェックインと同じ組み合わせ", "探测活动并领取日活奖励 · 不做保活": "イベントを検出して日活報酬を受け取り · キープアライブは行わない", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "受注+点灯+受け取り(実測で検証済みのタスクのみ処理)", "搜账号 / 收益 / 错误 / 触发原因": "アカウント / 収益 / エラー / トリガー理由を検索", "收起新建": "新規入力を閉じる", "新建定时条目": "新しい定時エントリ", "新手福利": "初心者ボーナス", "新手福利有 {n} 项领取失败,可重试": "初心者ボーナスで {n} 件の受け取りに失敗しました。再試行できます", "无": "なし", "无独立签到接口 · 每天替账号打一次首次登录积分": "専用のチェックイン API なし · 毎日アカウントの初回ログイン積分を 1 回付与", "无账号": "アカウントなし", "暂不可领": "受け取り不可", "暂不支持": "未対応", "暂无启用的条目 · 点此添加": "有効なスケジュールがありません · クリックして追加", "有未保存的改动": "未保存の変更があります", "未勾选提供商": "プロバイダー未選択", "未开启": "未有効", "未解锁": "未解禁", "未领养(领养需先完成当日对话量)": "未飼育(飼育には当日の会話量の達成が先に必要)", "未领取": "未受け取り", "本地台账里今天还没领过;活动期内每天发一份新套餐": "ローカルの記録では本日まだ受け取っていません。キャンペーン期間中は毎日新しいプランが 1 件配布されます", "本地台账里今天(北京时间)领过的套餐:{plans}": "ローカル記録で本日(北京時間)受け取ったプラン:{plans}", "条启用": "件有効", "查询于 {time}": "{time} にクエリ", "查询任务": "タスクをクエリ", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "タスクツリーを照会してワンクリックで点灯/受け取り(新学期・ねこ旅行を含む)", "查询失败:{error}": "クエリに失敗しました:{error}", "桌面端每日积分链路": "デスクトップ版のデイリー積分経路", "正在读取定时签到数据…": "定期チェックインデータを読み込み中…", "正在读取签到数据…": "チェックインデータを読み込み中…", "每天 {time}": "毎日 {time}", "每天 {time} · {scope}": "毎日 {time} · {scope}", "每天时刻": "毎日の時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "チェックイン1回ごとに · アカウントごとに1行 · 結果と収益はバックエンドの記録が正", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "毎日のアクティブタスク · Webチャネルの会話で日活を達成、ポイントは受け取りで加算 · 両方は別々に実行可能", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "デイリー特典 · 受け取り → 確認 → 読み戻し検証 · 北京時間の自然日でリセット", "每日签到": "デイリーチェックイン", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "スケジュールごとに時刻と範囲 · 当日はそれぞれ重複排除 · 起動時に自動補完", "每账号一条明细 · 点此查看「签到记录」": "アカウントごとに1行 · 「チェックイン記録」を開く", "没有可领套餐的账号(ZCode 未添加)。": "受け取れるプランのあるアカウントがありません(ZCode 未追加)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "受け取れる特典のあるアカウントがありません(CodeArts / ZCode が未追加)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "成長タスクに対応するアカウントがありません(WorkBuddy 中国版が必要)。", "没有支持新手福利的账号": "初心者ボーナスに対応するアカウントがありません", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "初心者ボーナスに対応するアカウントがありません —— 現在は Loomy、小浣熊、CodeArts の 3 社です。", "没有符合筛选条件的签到记录": "絞り込み条件に一致するチェックイン記録がありません", "没有需要执行的任务": "実行するタスクはありません", "活动福利": "イベント特典", "活动(campaign)领取 · 每天 10:00 刷新": "イベント(campaign)の受け取り · 毎日 10:00 に更新", "活跃上报与保活均未成功,且活动未开启": "アクティビティの報告とキープアライブの両方に失敗し、キャンペーンも未実施です", "活跃上报完成,但保活未成功且活动未开启": "アクティビティの報告は完了しましたが、キープアライブに失敗し、キャンペーンも未実施です", "活跃上报完成,但活动未开启": "アクティビティを報告しましたが、キャンペーンは未実施です", "活跃上报成功": "アクティビティの報告に成功しました", "活跃保活失败": "アクティブのキープアライブに失敗しました", "活跃保活完成": "アクティブのキープアライブが完了しました", "活跃保活完成,但活动未开启": "アクティブのキープアライブは完了しましたが、イベントが有効ではありません", "活跃保活完成,但活跃上报失败且活动未开启": "キープアライブは完了しましたが、アクティビティの報告に失敗し、キャンペーンも未実施です", "添加条目": "スケジュールを追加", "添加模型": "モデルを追加", "清单为空 —— 保存后恢复缺省链": "リストが空です — 保存すると既定のチェーンに戻ります", "清单里已经有「{name}」": "リストに「{name}」はすでにあります", "清空失败:{error}": "クリアに失敗しました:{error}", "清空签到记录": "チェックイン記録をクリア", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "「プラン明細」で受け取ったプランと有効になる時期を確認できます。キャンペーン期間中は毎日また受け取れます", "点击行展开账号明细 · 单账号签到不受范围限制": "行をクリックしてアカウントの詳細を展開 · 単一アカウントのチェックインは範囲の制限を受けません", "独立链路 · 只提供手动入口 · 不进自动签到": "独立した経路 · 手動入口のみ · 自動チェックインには含まれない", "猫猫旅行": "ねこ旅行", "猫猫旅行失败:{error}": "ねこ旅行に失敗:{error}", "猫猫旅行失败:{message}": "ねこ旅行に失敗:{message}", "猫猫旅行:{message}": "ねこ旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "無料モデルとWebチャネルの会話でアカウントのアクティブ状態を維持 · 報酬は受け取らない", "确定删除「{name}」?删除后到点不再执行。": "「{name}」を削除しますか?削除後は予定時刻に実行されません。", "确定清空全部签到记录?清空后无法恢复。": "すべてのチェックイン記録をクリアしますか?クリア後は復元できません。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "現在の絞り込みに一致するチェックイン記録をクリアしますか?クリア後は復元できません。", "移除 {name}": "{name} を削除", "立即全部签到": "今すぐ一括チェックイン", "签到": "チェックイン", "签到中…": "チェックイン中…", "签到中心分区": "チェックインセンターのセクション", "签到失败:{error}": "チェックインに失敗しました:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "チェックイン完了:{succeeded}/{total} 成功{active}、{failed} 件失敗", "签到成功": "チェックインに成功しました", "签到提供商": "チェックインプロバイダー", "签到范围": "チェックイン範囲", "签到触发时刻": "チェックイン実行時刻", "签到记录": "チェックイン記録", "签到记录时间范围": "チェックイン記録の時間範囲", "签到记录表": "チェックイン記録テーブル", "累计签到记录": "累計チェックイン記録", "结算于 {time}": "{time} に確定", "能量 {n}": "エネルギー {n}", "腾讯每日签到接口 · 仅国内版": "Tencent のデイリーチェックイン API · 中国版のみ", "至少勾一家才能保存(不勾等于这条条目不签到)": "保存するには 1 社以上選択してください(未選択=このエントリは何もチェックインしません)", "读取定时签到数据失败:{error}": "定期チェックインデータの読み込みに失敗しました:{error}", "读取签到数据失败:{error}": "チェックインデータの読み込みに失敗しました:{error}", "读取签到记录失败:{error}": "チェックイン記録の読み込みに失敗しました:{error}", "跳过 {n}": "スキップ {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運営イベントの受け渡し(受け取り → 確認 → 読み戻しで検証)· 受け取るのはプラン特典積分", "还没执行过": "まだ実行されていません", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "スケジュールがまだありません —— 「スケジュールを追加」で作成するか、「チェックインセンター」で手動チェックインしてください。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "チェックイン記録はまだありません —— 手動チェックインまたは定期実行の後に、明細がここに表示されます。", "连登 {n} 天": "連続ログイン {n} 日", "部分": "一部", "重签": "再チェックイン", "重试": "再試行", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "期間限定お試しプラン · 受け取りにはスライダー認証が必要 · 1 件ずつ確認して受け取り", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "期間限定体験プラン(start-plan)。開催期間中は毎日 1 件 · 受け取りにはスライダー認証が必要", "需真实操作": "実際の操作が必要", "非活动期": "イベント期間外", "项": "件", "领取": "受け取る", "领取中": "受け取り中", "领取中…": "受け取り中…", "领取失败": "受け取りに失敗", "领取失败:{error}": "受け取りに失敗しました:{error}", "(共 {n} 个账号)": "(全 {n} アカウント)", "(能量 / 连登读数本次未取到)": "(エネルギー/連続ログインの数値は今回取得できませんでした)", ",日活保活 {n} 个": "、日活キープアライブ {n} 件" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO の checkin_credits 受け取り · 自然日 0 時に更新", "UMID 组件安装失败:{error}": "UMID コンポーネントのインストールに失敗しました:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 中国版 · タスクツリーを照会してワンクリックで点灯/受け取り · 新学期イベントとねこ旅行を含む · 行をクリックで詳細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 国際版のキープアライブ用モデル(順番にフォールバック)", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy国際版のデイリーアクティビティ用の無料モデル · 全体で1つの設定、スケジュールとは無関係", "{date}(每天 {time})": "{date}(毎日 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "完了可能 {n} 件", "{n} 项待领": "{n} 件受け取り待ち", "{total} 账号 · {done} 已签": "{total} アカウント · {done} チェックイン済み", "{total} 项任务 · {pending} 项可完成": "タスク {total} 件 · 完了可能 {pending} 件", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID コンポーネントをインストールしました。次回のチェックインで国際版の積分を受け取れます", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定期チェックインを有効にしました", "✅ 开学季任务执行完成": "✅ 新学期タスクの実行が完了しました", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長タスク完了:クレジット +{credit} エネルギー +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 初心者ボーナスの受け取りが完了しました。累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ チェックイン完了:{succeeded}/{total} 件のアカウントが受け取りに成功{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。空で送信すると既定({defaults})に戻します。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。リストを空にして保存すると既定のチェーン(現在の既定:{defaults})に戻ります。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「免费领积分」的每日任务 · 逐个领取": "「無料積分受け取り」のデイリータスク · 1 つずつ受け取る", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一度きりの特典 · チェックイン後に自動で照会して受け取り、受け取り済みは本機に記録し以降はアップストリームに問い合わせません · 行をクリックしてタスク一覧を展開", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "その日の報酬を一度にまとめて受け取ります(毎日チェックイン+新規特典) · 冪等性はアップストリームが保証", "一键安装组件": "ワンクリックでインストール", "一键完成": "一括完了", "一键领取({n})": "一括受け取り({n})", "上次执行:{line}": "前回実行:{line}", "上次签到时间": "前回のチェックイン時刻", "上次领取 {time} · 领取需通过滑块验证码": "前回の受け取り {time} · 受け取りにはスライダー認証が必要", "下次 {date}": "次回 {date}", "下次 {date} · 点此管理条目": "次回 {date} · クリックしてスケジュールを管理", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」に、CodeArts と ZCode の日次/プラン特典の受け取りは「アクティビティ特典」にあります。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」、CodeArts のデイリー特典はすぐ上の「デイリーチェックイン」にあります。ZCode のプラン受け取りは「アクティビティ特典」です。", "与国内版同一套任务接口 · 站点不同": "中国版と同じタスク API · サイトが異なる", "与国内版同一套链路 · 站点不同、令牌不通用": "中国版と同じフロー · サイトが異なり、トークンに互換性なし", "今天已领 {n} 份": "本日 {n} 件受け取り済み", "今天未领": "本日は未受取", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "本日(北京時間 {day})受け取り済み · 公式に {n} 件の到着を確認 · 明日また受け取れます", "今日已执行": "本日実行済み", "今日已派出": "本日は出発済み", "今日已领取": "本日受け取り済み", "今日签到": "本日のチェックイン", "今日签到进度": "本日のチェックイン進捗", "从清单里移除": "リストから削除", "保活": "キープアライブ", "保活 {n}": "キープアライブ {n}", "保活+领取": "キープアライブ+受け取り", "保活中…": "キープアライブ中…", "保活模型链": "キープアライブモデルチェーン", "全选": "すべて選択", "全部 {n} 家": "全 {n} 社", "全部完成": "すべて完了", "全部查询": "一括クエリ", "全部结果": "すべての結果", "全部账号均可签到": "すべてのアカウントがチェックイン可能", "全部领取": "すべて受け取り済み", "关着:所有条目都不执行": "オフ:どのスケジュールも実行されません", "删除失败:{error}": "削除に失敗しました:{error}", "删除定时条目": "スケジュールを削除", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;CodeArts はその日の運営特典を受け取ります(受け取り → 確認 → 読み戻し検証。自動実行は 1 日 6 回・間隔 10 分の書き込み制限を受けます);OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点时逐个签到,已勾 {n} / {total} 家": "定刻に 1 社ずつチェックインします。選択 {n} / {total} 社", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 起動時に自動で補完します", "去领取": "受け取りへ", "另有 {n} 个账号不参与每日签到": "ほかにデイリーチェックインの対象外のアカウントが {n} 件", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "完了済みタスクの報酬のみ受け取り(冪等・連打しても二重加算されません)", "可完成": "完了可能", "可派出": "出発可能", "可选 · 缺省显示时刻": "任意 · 未指定では時刻を表示", "可领奖": "受け取り可能", "后端未返回定时签到数据": "バックエンドがスケジュールデータを返しませんでした", "后端未返回签到中心数据": "バックエンドがチェックインセンターのデータを返しませんでした", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "国際版のチェックインには、UMID コンポーネントで生成するデバイスリスク制御 ID が必要です(本機では検出されませんでした)。", "在途": "旅行中", "填入缺省链": "既定のチェーンを入力", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "時刻と範囲を決めて「保存」を押してください。名前は空欄でも構いません(空欄なら時刻を表示)", "失败 {n}": "失敗 {n}", "套餐明细": "プラン明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder クライアントまたは qodercli をインストールすれば利用できます(ゲートウェイの再起動は不要)。", "安装中…": "インストール中…", "官方客户端的每日签到任务": "公式クライアントのデイリーチェックインタスク", "定时签到": "定期チェックイン", "定时签到已关闭": "定期チェックインを無効にしました", "尚未查询": "未照会", "尚未查询任务状态": "タスク状態は未クエリ", "巡检一次": "1 回実行", "已保存:{label}": "保存しました:{label}", "已保存:保活模型链": "保存しました:キープアライブモデルチェーン", "已保存:定时条目": "保存しました:スケジュール", "已删除定时条目": "スケジュールを削除しました", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "アクティビティを報告しました(連続ログイン達成)が、キャンペーンは未実施です(今回の報酬はなし)", "已抽 {n} 次": "{n} 回抽選しました", "已有结果 {checked} / 共 {total} 个账号": "結果あり {checked} / 全 {total} アカウント", "已签": "チェックイン済み", "已领 {claimed}/{total} · 累计 {earned} 积分": "受け取り済み {claimed}/{total} · 累計 {earned} 積分", "已领养": "飼い主になりました", "已领取": "受け取り済み", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "デバイスリスク制御 ID を付けて「毎日 100 Credits」を受け取り · UMID コンポーネントが必要", "开学季执行失败:{error}": "新学期の実行に失敗:{error}", "开学季执行完成:{message}": "新学期の実行が完了:{message}", "开学季活动": "新学期イベント", "开着:启用的条目按各自时刻执行": "オン:有効なスケジュールがそれぞれの時刻に実行されます", "待签": "未チェックイン", "待领新手福利": "受け取り待ちの初心者ボーナス", "总开关": "マスタースイッチ", "总开关已关闭 · 在「定时签到」页打开": "マスタースイッチがオフです · 「定期チェックイン」タブで有効化してください", "成功 {n}": "成功 {n}", "成长任务": "成長タスク", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長タスク完了(成功 {done} 件・失敗 {failed} 件):クレジット +{credit} エネルギー +{energy}", "成长任务执行失败:{error}": "成長タスクの実行に失敗:{error}", "执行失败:{error}": "実行に失敗しました:{error}", "执行并抽奖": "実行して抽選", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "新学期タスクを実行し、抽選回数を使い切る(シェア/会話/エキスパートイベント)", "把缺省链填进清单,再点「保存」生效": "既定のチェーンを一覧に入れます。「保存」で反映されます", "抽奖机会 {n} 次": "抽選チャンス {n} 回", "按住拖动调整顺序": "押したままドラッグで並べ替え", "按住拖动,调整这个模型在链里的顺序": "押したままドラッグして、チェーン内でのこのモデルの順序を変更します", "按序逐个尝试,共 {n} 个": "順番に試行、計 {n} 件", "按结果筛选": "結果で絞り込み", "探测 + 领取 + 保活 · 与定时签到同一套组合": "検出 + 受け取り + キープアライブ · 定期チェックインと同じ組み合わせ", "探测活动并领取日活奖励 · 不做保活": "イベントを検出して日活報酬を受け取り · キープアライブは行わない", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "受注+点灯+受け取り(実測で検証済みのタスクのみ処理)", "搜账号 / 收益 / 错误 / 触发原因": "アカウント / 収益 / エラー / トリガー理由を検索", "收起新建": "新規入力を閉じる", "新建定时条目": "新しい定時エントリ", "新手福利": "初心者ボーナス", "新手福利有 {n} 项领取失败,可重试": "初心者ボーナスで {n} 件の受け取りに失敗しました。再試行できます", "无": "なし", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "専用のチェックイン API なし · 1 日 1 回アカウントの代わりにログイン情報エンドポイントを叩く(それが当日の魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "専用のチェックイン API なし · 毎日アカウントの初回ログイン積分を 1 回付与", "无账号": "アカウントなし", "暂不可领": "受け取り不可", "暂不支持": "未対応", "暂无启用的条目 · 点此添加": "有効なスケジュールがありません · クリックして追加", "有未保存的改动": "未保存の変更があります", "未勾选提供商": "プロバイダー未選択", "未开启": "未有効", "未解锁": "未解禁", "未领养(领养需先完成当日对话量)": "未飼育(飼育には当日の会話量の達成が先に必要)", "未领取": "未受け取り", "本地台账里今天还没领过;活动期内每天发一份新套餐": "ローカルの記録では本日まだ受け取っていません。キャンペーン期間中は毎日新しいプランが 1 件配布されます", "本地台账里今天(北京时间)领过的套餐:{plans}": "ローカル記録で本日(北京時間)受け取ったプラン:{plans}", "条启用": "件有効", "查询于 {time}": "{time} にクエリ", "查询任务": "タスクをクエリ", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "タスクツリーを照会してワンクリックで点灯/受け取り(新学期・ねこ旅行を含む)", "查询失败:{error}": "クエリに失敗しました:{error}", "桌面端每日积分链路": "デスクトップ版のデイリー積分経路", "正在读取定时签到数据…": "定期チェックインデータを読み込み中…", "正在读取签到数据…": "チェックインデータを読み込み中…", "每天 {time}": "毎日 {time}", "每天 {time} · {scope}": "毎日 {time} · {scope}", "每天时刻": "毎日の時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "チェックイン1回ごとに · アカウントごとに1行 · 結果と収益はバックエンドの記録が正", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "毎日のアクティブタスク · Webチャネルの会話で日活を達成、ポイントは受け取りで加算 · 両方は別々に実行可能", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "デイリー特典 · 受け取り → 確認 → 読み戻し検証 · 北京時間の自然日でリセット", "每日签到": "デイリーチェックイン", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "スケジュールごとに時刻と範囲 · 当日はそれぞれ重複排除 · 起動時に自動補完", "每账号一条明细 · 点此查看「签到记录」": "アカウントごとに1行 · 「チェックイン記録」を開く", "没有可领套餐的账号(ZCode 未添加)。": "受け取れるプランのあるアカウントがありません(ZCode 未追加)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "受け取れる特典のあるアカウントがありません(CodeArts / ZCode が未追加)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "成長タスクに対応するアカウントがありません(WorkBuddy 中国版が必要)。", "没有支持新手福利的账号": "初心者ボーナスに対応するアカウントがありません", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "初心者ボーナスに対応するアカウントがありません —— 現在は Loomy、小浣熊、CodeArts の 3 社です。", "没有符合筛选条件的签到记录": "絞り込み条件に一致するチェックイン記録がありません", "没有需要执行的任务": "実行するタスクはありません", "活动福利": "イベント特典", "活动(campaign)领取 · 每天 10:00 刷新": "イベント(campaign)の受け取り · 毎日 10:00 に更新", "活跃上报与保活均未成功,且活动未开启": "アクティビティの報告とキープアライブの両方に失敗し、キャンペーンも未実施です", "活跃上报完成,但保活未成功且活动未开启": "アクティビティの報告は完了しましたが、キープアライブに失敗し、キャンペーンも未実施です", "活跃上报完成,但活动未开启": "アクティビティを報告しましたが、キャンペーンは未実施です", "活跃上报成功": "アクティビティの報告に成功しました", "活跃保活失败": "アクティブのキープアライブに失敗しました", "活跃保活完成": "アクティブのキープアライブが完了しました", "活跃保活完成,但活动未开启": "アクティブのキープアライブは完了しましたが、イベントが有効ではありません", "活跃保活完成,但活跃上报失败且活动未开启": "キープアライブは完了しましたが、アクティビティの報告に失敗し、キャンペーンも未実施です", "添加条目": "スケジュールを追加", "添加模型": "モデルを追加", "清单为空 —— 保存后恢复缺省链": "リストが空です — 保存すると既定のチェーンに戻ります", "清单里已经有「{name}」": "リストに「{name}」はすでにあります", "清空失败:{error}": "クリアに失敗しました:{error}", "清空签到记录": "チェックイン記録をクリア", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "「プラン明細」で受け取ったプランと有効になる時期を確認できます。キャンペーン期間中は毎日また受け取れます", "点击行展开账号明细 · 单账号签到不受范围限制": "行をクリックしてアカウントの詳細を展開 · 単一アカウントのチェックインは範囲の制限を受けません", "独立链路 · 只提供手动入口 · 不进自动签到": "独立した経路 · 手動入口のみ · 自動チェックインには含まれない", "猫猫旅行": "ねこ旅行", "猫猫旅行失败:{error}": "ねこ旅行に失敗:{error}", "猫猫旅行失败:{message}": "ねこ旅行に失敗:{message}", "猫猫旅行:{message}": "ねこ旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "無料モデルとWebチャネルの会話でアカウントのアクティブ状態を維持 · 報酬は受け取らない", "确定删除「{name}」?删除后到点不再执行。": "「{name}」を削除しますか?削除後は予定時刻に実行されません。", "确定清空全部签到记录?清空后无法恢复。": "すべてのチェックイン記録をクリアしますか?クリア後は復元できません。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "現在の絞り込みに一致するチェックイン記録をクリアしますか?クリア後は復元できません。", "移除 {name}": "{name} を削除", "立即全部签到": "今すぐ一括チェックイン", "签到": "チェックイン", "签到中…": "チェックイン中…", "签到中心分区": "チェックインセンターのセクション", "签到失败:{error}": "チェックインに失敗しました:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "チェックイン完了:{succeeded}/{total} 成功{active}、{failed} 件失敗", "签到成功": "チェックインに成功しました", "签到提供商": "チェックインプロバイダー", "签到范围": "チェックイン範囲", "签到触发时刻": "チェックイン実行時刻", "签到记录": "チェックイン記録", "签到记录时间范围": "チェックイン記録の時間範囲", "签到记录表": "チェックイン記録テーブル", "累计签到记录": "累計チェックイン記録", "结算于 {time}": "{time} に確定", "能量 {n}": "エネルギー {n}", "腾讯每日签到接口 · 仅国内版": "Tencent のデイリーチェックイン API · 中国版のみ", "至少勾一家才能保存(不勾等于这条条目不签到)": "保存するには 1 社以上選択してください(未選択=このエントリは何もチェックインしません)", "读取定时签到数据失败:{error}": "定期チェックインデータの読み込みに失敗しました:{error}", "读取签到数据失败:{error}": "チェックインデータの読み込みに失敗しました:{error}", "读取签到记录失败:{error}": "チェックイン記録の読み込みに失敗しました:{error}", "跳过 {n}": "スキップ {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運営イベントの受け渡し(受け取り → 確認 → 読み戻しで検証)· 受け取るのはプラン特典積分", "还没执行过": "まだ実行されていません", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "スケジュールがまだありません —— 「スケジュールを追加」で作成するか、「チェックインセンター」で手動チェックインしてください。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "チェックイン記録はまだありません —— 手動チェックインまたは定期実行の後に、明細がここに表示されます。", "连登 {n} 天": "連続ログイン {n} 日", "部分": "一部", "重签": "再チェックイン", "重试": "再試行", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "期間限定お試しプラン · 受け取りにはスライダー認証が必要 · 1 件ずつ確認して受け取り", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "期間限定体験プラン(start-plan)。開催期間中は毎日 1 件 · 受け取りにはスライダー認証が必要", "需真实操作": "実際の操作が必要", "非活动期": "イベント期間外", "项": "件", "领取": "受け取る", "领取中": "受け取り中", "领取中…": "受け取り中…", "领取失败": "受け取りに失敗", "领取失败:{error}": "受け取りに失敗しました:{error}", "(共 {n} 个账号)": "(全 {n} アカウント)", "(能量 / 连登读数本次未取到)": "(エネルギー/連続ログインの数値は今回取得できませんでした)", ",日活保活 {n} 个": "、日活キープアライブ {n} 件" }); diff --git a/desktop-tauri/ui/i18n/ko/add-account.js b/desktop-tauri/ui/i18n/ko/add-account.js index 2b0d6170..e1eae103 100644 --- a/desktop-tauri/ui/i18n/ko/add-account.js +++ b/desktop-tauri/ui/i18n/ko/add-account.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ko/add-account —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · 모델 {head}{rest}", " 等 {n} 个": " 등 {n}개", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1//로 시작하는 Google refresh token (refresh_token=… 줄 전체를 붙여넣어도 됨)", "11 位大陆手机号": "11자리 중국 본토 휴대폰 번호", "1~64 个字符,账号列表里按它分组显示": "1~64자, 계정 목록에서 이 값을 기준으로 그룹화되어 표시됩니다", "6 位数字": "6자리 숫자", "

  • 没有可自动领的活动
  • ": "
  • 자동으로 수령할 수 있는 이벤트가 없습니다
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    수령하는 것은 플랜 증정 포인트이며, 혜택 모델의 token 풀은 늘지 않습니다;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 호환 엔드포인트는 https://api.deepseek.com/anthropic입니다 (프로토콜을 anthropic으로 바꿀 때 입력합니다)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic 프로토콜은 루트 주소를 입력하고 /v1은 붙이지 마세요", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 중국판", "AutoClaw 国际版": "AutoClaw 국제판", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS는 필수입니다; **전체 Cookie**를 붙여넣으세요 (Cookie 편집기에서 원클릭 내보내기 가능) — 이 중 **PTOKEN은 반드시 남겨 두세요**. 게이트웨이가 이것을 사용해 Baidu에서 KukuAI 비즈니스 세션 토큰을 교환 발급받으며, 없으면 모델 갱신 시 「미로그인」 오류가 발생합니다. 전체 Cookie 헤더, Cookie 편집기에서 내보낸 JSON 배열, 또는 {BDUSS, STOKEN} 객체를 지원합니다. KukuAI에는 갱신 메커니즘이 없으므로 로그인 상태가 만료되면 다시 붙여넣으면 됩니다.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (또는 Cookie 편집기에서 내보낸 JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw의 X-Passport-Token (로그인 상태 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (3단 점 구분)", "Command Code": "Command Code", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 국제판", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM 관리형 엔드포인트, Key는 integrate.api.nvidia.com에서 신청합니다", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken은 Accio의 로그인 자격 증명입니다 (길고 불투명한 token 문자열이며 JWT가 아닙니다); refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다. {label} 계정의 자격 증명을 입력하세요 — {siteNote} (가장 쉽게 얻는 방법: 위의 「웹 로그인」을 바로 사용하세요. token을 직접 찾을 필요가 없습니다.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken은 Trae의 Cloud-IDE-JWT이며(3단 점 구분), refreshToken은 만료 시 자동 갱신에 사용됩니다 (이 제공자는 refreshToken이 교환할 때마다 바뀝니다: 한 번 교환하면 이전 것은 무효가 되므로 두 프로그램에서 같은 계정을 동시에 갱신하지 마세요).
    수동으로 붙여넣을 때는 machineId / deviceId도 함께 입력하세요: 업스트림은 이를 로그인 시 업로드한 기기 공개 키와 묶어 기기를 판별하므로, 갑자기 새로운 값을 넣으면 2xxxx 계열 기기 바인딩 거부가 발생합니다.
    이 세 가지가 없을 때의 올바른 방법은 위의 「웹 로그인」이며, 컨테이너 / 원격 배포 환경에서는 안내에 따라 주소 표시줄의 콜백 주소를 붙여넣으면 됩니다.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session의 값 (전체 Cookie를 붙여넣어도 됨)", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다; 둘 다 小浣熊 클라이언트 로그인 상태 파일에서 얻을 수 있습니다.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken은 선택이며, 입력하면 자동 갱신됩니다; 둘 다 클라이언트 로그인 상태 파일에서 얻을 수 있습니다. 같은 Cline 계정은 두 풀 모두에서 사용할 수 있으며, 여기서는 {label}로 분류됩니다.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token은 enc: 접두사를 지원합니다 (Windows에서는 자동 복호화). refreshToken을 입력하지 않으면 자동 갱신할 수 없습니다.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token은 로그인 상태 Cookie입니다; CatPaw에는 갱신 메커니즘이 없어 만료 후 클라이언트에서 다시 로그인해야 합니다.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_로 시작하는 API Key (Authorization: Bearer … 줄 전체를 붙여넣어도 됨)", "{label} 网页登录的打开方式": "{label} 웹 로그인을 여는 방식", "{label} 账号地区": "{label} 계정 지역", "{label} 账号的添加方式": "{label} 계정 추가 방식", "{name} 不是合法 JSON:{reason}": "{name}은(는) 올바른 JSON이 아닙니다: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}에는 JSON 객체를 붙여넣어야 합니다 (예: {sample})", "{n} 个账号": "계정 {n}개", "{n} 个账号,点击添加": "계정 {n}개, 클릭하여 추가", "{seconds}s 后重发": "{seconds}초 후 재발송", "✅ {label}账号已添加": "✅ {label} 계정을 추가했습니다", "✅ {label}账号已添加{name}": "✅ {label} 계정을 추가했습니다{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ cc-switch에서 제공자 {n}개를 가져왔습니다", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ 커스텀 제공자 「{name}」을(를) 만들고 계정을 추가했습니다", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ 커스텀 제공자 「{name}」을(를) 삭제했습니다{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ 로그인 성공, {edition} 계정을 목록에 추가했습니다", "✅ 领取成功:{planId}{period}": "✅ 수령 성공: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 같은 제공자에 key를 여러 개 둘 수 있으며, 우선순위에 따라 로테이션됩니다.", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」의 계정 추가 기능은 아직 개발 중입니다. 기대해 주세요.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "하나의 Key로 여러 제공자의 모델을 사용할 수 있으며, 모델 이름은 「벤더/모델」 전체 이름을 씁니다 (예: deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "업스트림이 인증을 요구하지 않으면 비워 두고 아래 항목을 체크하세요 (비워 두고 체크하지 않으면 자격 증명 미설정으로 간주됩니다)", "上游信息": "업스트림 정보", "不可领({status})": "수령 불가 ({status})", "不支持导入": "가져오기 미지원", "不是有效的凭证文件:内容要是一个 JSON 对象": "유효한 자격 증명 파일이 아닙니다. 내용은 JSON 객체여야 합니다", "不是有效的凭证文件:需要包含 accessToken 与 uid": "유효한 자격 증명 파일이 아닙니다. accessToken과 uid가 필요합니다", "不是自定义提供商": "커스텀 제공자가 아닙니다", "不需要 Key:转发与拉取模型都不发送鉴权头": "Key 불필요: 포워딩과 모델 조회 모두 인증 헤더를 보내지 않습니다", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "두 판의 계정을 동시에 저장할 수 있으며 각각 별도의 모델 목록을 가집니다 (중국판과 국제판은 서로 다른 두 제공자로, 각각 활성화하고 매핑할 수 있습니다).", "中国版": "중국판", "今天没有需要领的活动(都已到账)": "오늘 수령할 이벤트가 없습니다 (모두 적립됨)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "오늘(베이징 시간 {day}) {attempts}회 시도했고, {left}회 더 시도할 수 있습니다{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "다른 컴퓨터(또는 OfficeAce 데스크톱 앱의 models.json)에서 다음 세 항목을 가져와 붙여넣으세요: 모델 게이트웨이 기본 주소(baseUrl, https://modelgw-…/v2 형태)와 modelAppKey / modelAppSecret. 이 세 항목만 있으면 전달할 수 있습니다(게이트웨이 자격 증명은 만료되지 않음). 제어 영역 임시 자격 증명(accessKeyId 등)은 선택이며, 비워 두면 잔액 조회와 자동 갱신을 쓸 수 없지만 전달에는 영향이 없습니다.", "从本机导入桌面端登录态": "이 컴퓨터에서 데스크톱 로그인 상태 가져오기", "任务镜像 id": "작업 이미지 id", "使用 Google 账号登录": "Google 계정으로 로그인", "使用 Zai 账号登录": "Zai 계정으로 로그인", "使用个人访问令牌(PAT)": "개인 액세스 토큰(PAT) 사용", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "무료 모델은 Key를 입력하지 않아도 됩니다 (기본적으로 「이 업스트림은 인증이 필요하지 않음」이 체크되어 있고, 게이트웨이가 자동으로 익명 자격 증명을 사용합니다); 유료 모델은 Zen의 API Key를 입력하세요. 무료 등급 업스트림은 공식 클라이언트 형태만 허용하므로 「OpenCode 공식 클라이언트로 위장」이 기본으로 켜져 있습니다", "内嵌窗口": "내장 창", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "내장 창으로 엽니다; 창을 닫으면 대기가 취소됩니다 (Google 계정이 거부되면 시스템 브라우저를 사용하세요)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "내장 창으로 엽니다; 완료하면 자동으로 목록에 추가되고, 창을 닫으면 대기가 취소됩니다", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "내장 창은 새 환경을 사용하므로 여러 계정이 서로 영향을 주지 않습니다; 창을 닫으면 대기가 취소됩니다", "内嵌窗口(推荐)": "내장 창(권장)", "准备验证…": "인증 준비 중…", "凭据 JSON": "자격 증명 JSON", "凭证文件在哪?": "자격 증명 파일 위치는?", "创建并添加账号": "생성하고 계정 추가", "创建这个提供商,并同时建立它的第一个账号。": "이 제공자를 만들고 동시에 첫 계정을 생성합니다.", "删除功能不可用(脚本未就绪)": "삭제 기능을 사용할 수 없습니다 (스크립트가 준비되지 않음)", "删除失败:{reason}": "삭제 실패: {reason}", "删除此提供商": "이 제공자 삭제", "及 {n} 个账号": " 및 계정 {n}개", "发送中…": "전송 중…", "发送失败:{message}": "전송 실패: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "전송 미확인: 로그인 창이 열렸습니다. 열린 창에서 직접 로그인을 완료하세요", "取消失败:{message}": "취소 실패: {message}", "取消等待": "대기 취소", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "「내장 창」에서만 제3자 로그인 항목을 복원할 수 있습니다: 시스템 브라우저에서는 로그인 페이지를 수정할 수 없습니다", "可选": "선택", "可选(cloudaicompanionProject):留空由网关自动发现": "선택 (cloudaicompanionProject): 비워 두면 게이트웨이가 자동으로 찾습니다", "可选,展示用": "선택, 표시용", "可选,没有则无法自动续期": "선택, 없으면 자동 갱신 불가", "可选,留空使用凭据里的 user_name": "선택, 비워 두면 자격 증명의 user_name 사용", "可选,留空使用账号姓名、邮箱或令牌指纹": "선택, 비워 두면 계정 이름, 이메일 또는 토큰 지문 사용", "可选,留空使用账号昵称或邮箱": "선택, 비워 두면 계정 닉네임 또는 이메일 사용", "可选,留空则用 key 尾号": "선택, 비워 두면 key 끝자리 사용", "可选,留空则用 userId": "선택, 비워 두면 userId 사용", "可选,留空则用上游返回的账号名或账号 id": "선택, 비워 두면 업스트림이 반환한 계정 이름 또는 계정 id 사용", "可选,留空则用凭证里的账号名": "선택, 비워 두면 자격 증명의 계정 이름 사용", "可选,留空则用文件里的昵称": "선택 사항, 비워 두면 파일의 닉네임 사용", "可选,留空则用登录名或 uid": "선택, 비워 두면 로그인 이름 또는 uid 사용", "可选,留空则用脱敏手机号": "선택, 비워 두면 마스킹된 휴대폰 번호 사용", "可选,留空则用脱敏手机号或 userId": "선택, 비워 두면 마스킹된 휴대폰 번호 또는 userId 사용", "可选,留空则用账号 uk": "선택, 비워 두면 계정 uk 사용", "可选,留空则用邮箱或令牌尾号": "선택, 비워 두면 이메일 또는 토큰 끝자리 사용", "可选,留空用「OfficeAce 果办」": "선택, 비워 두면 「OfficeAce」 사용", "可选,留空自动生成": "선택, 비워 두면 자동 생성", "可选,留空自动用昵称": "선택, 비워 두면 닉네임 자동 사용", "可选,续期时带上": "선택, 갱신 시 함께 전송", "可选,讯飞侧 userid": "선택, iFlytek 측 userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "선택; 대화 시작에 필요합니다. 비워 두면 게이트웨이가 이 계정의 기존 작업에서 자동으로 찾습니다. 찾지 못하면 나중에 직접 입력하면 됩니다.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "선택; 계정 이메일로, 표시와 신원 식별에 사용됩니다 (새 토큰으로 바꿔도 같은 계정으로 인식됩니다)", "可选;UUID 形态,与凭据同生共死": "선택; UUID 형식이며 자격 증명과 함께 생성되고 함께 사라집니다", "可选;填了才能到期自动续期": "선택; 입력해야 만료 시 자동 갱신할 수 있습니다", "可选;用于去重与展示名(留空时网关会问一次上游)": "선택; 중복 제거와 표시 이름에 사용됩니다 (비워 두면 게이트웨이가 업스트림에 한 번 물어봅니다)", "可选;用于生成账号 id 与展示名": "선택; 계정 id와 표시 이름 생성에 사용됩니다", "可选;纯数字串(上游只收 8–24 位数字)": "선택; 숫자만 입력 (업스트림은 8–24자리 숫자만 허용)", "可领取": "수령 가능", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "같은 제공자에 섞어 둘 수 있습니다: Key가 있는 계정과 인증이 필요 없는 계정은 각자의 규칙을 따릅니다", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "같은 주소에서 anthropic 프로토콜로 바꾸면 해당 Claude 호환 엔드포인트를 사용합니다. 포워딩에는 OpenCode Go의 API Key가 반드시 필요합니다 (구독제; 모델 목록 조회에는 Key가 필요 없지만, 요청을 보내면 업스트림이 401 「Missing API key」를 반환합니다)", "响应为空": "응답이 비어 있습니다", "国内版": "중국판", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "중국판과 **국제판은 서로 독립된 두 세트의 계정과 플랜**입니다. 자격 증명과 수령한 플랜은 서로 호환되지 않습니다.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "중국판 로그인 페이지에는 Google / GitHub 항목이 없습니다 (WeChat / 휴대폰 번호 / 이메일로 로그인합니다)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "중국판의 로그인 사이트는 www.accio-ai.com이며, 국제판과 같은 사이트가 아닙니다.", "国内版(WorkBuddy)": "중국판 (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "중국 사이트는 https://api.siliconflow.cn/v1입니다", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "중국 사이트 (minimaxi.com); OpenAI 호환 주소는 https://api.minimaxi.com/v1입니다", "国际版": "국제판", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "국제판 z.ai의 Coding 플랜; OpenAI 호환 주소는 https://api.z.ai/api/coding/paas/v4입니다", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "국제판과 중국판은 **서로 독립된 두 세트의 계정**입니다 (같은 계정 체계의 두 사이트). 자격 증명은 호환되지 않습니다.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "국제판과 중국판은 계정 체계가 독립적입니다. 국제판의 자격 증명을 입력하세요. refreshToken을 입력하지 않으면 자동 갱신할 수 없습니다.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "국제판 로그인 페이지는 기본적으로 이메일 로그인만 표시하며, 체크하면 Google / GitHub / X 항목이 복원됩니다", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "국제판의 추론 사이트는 api.z.ai이며 중국판과 다른 사이트입니다; 플랜도 각각 독립적입니다.", "国际版(WorkBuddy AI)": "국제판 (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "국제 사이트 Coding 플랜; OpenAI 호환 주소는 https://api.minimax.io/v1입니다", "在 cc-switch 里找到": "cc-switch에서 찾은", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "내장 창에서 공식 로그인을 완료하면 성공 시 자동으로 계정 목록에 추가됩니다.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "{label}의 Qoder 계정 설정 → Integrations에서 PAT를 생성하세요 (Google / GitHub 토큰을 입력하지 마세요). 두 지역의 계정과 자격 증명은 호환되지 않습니다.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "열린 창에서 Baidu 계정으로 KukuAI 메인 사이트에 로그인하세요 (SMS 인증 코드 / QR 스캔 모두 가능). 로그인에 성공하면 자동으로 계정 목록에 추가됩니다. 게이트웨이는 Baidu에서 KukuAI 비즈니스 세션 토큰을 교환 발급받습니다 (이 컴퓨터에 KukuAI 클라이언트가 설치되어 있어야 합니다).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "열린 창에서 Google 계정으로 로그인하세요(Antigravity의 인가 페이지). 인가가 완료되면 자동으로 계정 목록에 추가됩니다.", "在浏览器中打开登录页": "브라우저에서 로그인 페이지 열기", "地区": "지역", "填写凭证": "자격 증명 입력", "填写凭证添加": "자격 증명 입력 후 추가", "备注名": "라벨명", "套餐": "플랜", "如:智谱 GLM": "예: Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "로그인을 완료하면 자동으로 계정 목록에 추가되며, 닉네임은 업스트림에서 가져옵니다.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "공식 클라이언트 자격 증명 디렉터리: Windows는 C:\\Users\\<사용자명>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth, macOS는 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "공식 적립 확인 완료", "导入": "가져오기", "导入中…": "가져오는 중…", "导入凭证文件": "자격 증명 파일 가져오기", "导入失败": "가져오기 실패", "导入失败:{reason}": "가져오기 실패: {reason}", "导入所选": "선택 항목 가져오기", "导入所选({n})": "선택 항목 가져오기({n})", "导入桌面端登录态": "데스크톱 로그인 상태 가져오기", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "내장 창이 열립니다; 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 창을 닫으면 대기가 취소됩니다. 인가 페이지 마지막에 zcode:// 링크를 열 수 없다는 안내가 나올 수 있는데, 정상입니다 — 결과는 이미 서버 측에 기록되었습니다", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "내장 창이 열립니다; 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 원격 패널에서는 콜백 주소를 붙여넣을 수 있습니다. 창을 닫으면 대기가 취소됩니다. 링크는 5분간 유효하며, 시간이 초과되거나 클릭하지 않으면 무효가 됩니다 (다시 시작할 수 있습니다)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "내장 창이 열립니다; 로그인이 완료되면 자동으로 계정 목록에 추가됩니다. 창을 닫으면 대기가 취소됩니다", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 Trae 계정을 재사용합니다); 같은 컴퓨터에서는 완료 시 자동으로 추가되며, Docker / 원격 패널에서는 안내에 따라 주소 표시줄의 콜백 주소를 붙여넣으세요.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 ZCode 계정을 재사용합니다); 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 페이지 마지막에 zcode:// 링크를 열 수 없다는 안내가 나올 수 있는데 정상입니다", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 Huawei Cloud 계정을 재사용합니다); 브라우저와 게이트웨이가 같은 컴퓨터에 있지 않다면 위 설명대로 최종 콜백 주소를 패널에 다시 붙여넣으세요", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "시스템 기본 브라우저로 로그인 페이지를 엽니다 (브라우저에 로그인된 Accio 계정을 재사용합니다); 로그인을 완료하면 자동으로 계정 목록에 추가되며, 팝업을 닫으면 대기가 취소됩니다", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan 플랜 (싱가포르 사이트)", "已到账": "적립 완료", "已取消登录等待": "로그인 대기를 취소했습니다", "已取消领取": "수령을 취소했습니다", "已取消验证码": "인증 코드를 취소했습니다", "已填写手机号,正在发送验证码…": "휴대폰 번호 입력 완료, 인증 코드 전송 중…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "인증 필요 없음으로 선언됨: 계정이 정상적으로 라우팅되며, 외부로 나갈 때 인증 헤더를 전혀 보내지 않습니다", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "가져오기 성공 {ok}개, 실패 {fail}개 (실패 항목은 목록에 표시해 두었습니다)", "已建过 · {n} 个账号,点击继续添加": "이미 생성됨 · 계정 {n}개, 클릭하여 추가", "已建过,点击继续添加账号": "이미 생성됨, 클릭하여 계정 추가", "已打开官方登录页,请在窗口中完成登录…": "공식 로그인 페이지를 열었습니다. 창에서 로그인을 완료하세요…", "已点发送,等待短信…": "전송을 눌렀습니다. SMS 대기 중…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "시스템 기본 브라우저로 로그인 페이지를 열었습니다. 브라우저에서 로그인을 완료하세요…", "已领取,等官方确认": "수령 완료, 공식 확인 대기 중", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "현재 앱 버전에서는 AutoClaw 웹 로그인을 지원하지 않습니다. 앱을 업데이트하세요", "当前没有可领取的套餐(活动尚未开始)": "현재 수령 가능한 플랜이 없습니다 (이벤트가 아직 시작되지 않았습니다)", "当前环境不支持领取(桥接方法缺失)": "현재 환경에서는 수령을 지원하지 않습니다 (브리지 메서드 없음)", "必填,CatPaw 账号标识": "필수, CatPaw 계정 식별자", "恢复 Google / GitHub 入口": "Google / GitHub 항목 복원", "手机号": "휴대폰 번호", "手机验证码登录": "SMS 인증 코드 로그인", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Trae SOLO의 공식 인가 페이지(trae.cn)를 열고 Trae 계정으로 로그인하세요: 인가가 완료되면 공식 페이지가 이 컴퓨터의 임시 포트로 되돌아옵니다; 같은 컴퓨터 배포에서는 자동으로 수신하며, Docker / 원격 패널에서는 안내에 따라 주소 표시줄의 콜백 주소를 복사하세요.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Accio {label}의 공식 로그인 페이지({site})를 열고 Accio 계정으로 로그인하세요: 로그인에 성공하면 공식 페이지가 이 컴퓨터로 되돌아옵니다; 같은 컴퓨터에서는 자동으로 완료되며, Docker / 원격 패널에서는 안내에 따라 콜백 주소를 붙여넣으면 됩니다 (인가 코드는 이 컴퓨터에서만 게이트웨이에 전달되며, 화면에 평문 token이 표시되지 않습니다).", "打开 Accio {label}登录页": "Accio {label} 로그인 페이지 열기", "打开 Antigravity 网页登录": "Antigravity 웹 로그인 열기", "打开 CatPaw 网页登录": "CatPaw 웹 로그인 열기", "打开 Cline 授权页": "Cline 인가 페이지 열기", "打开 CodeArts 授权页": "CodeArts 인가 페이지 열기", "打开 Qoder 网页登录": "Qoder 웹 로그인 열기", "打开 Trae 授权页": "Trae 인가 페이지 열기", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "ZCode {label}의 공식 인가 페이지를 열고 계정으로 로그인하세요. 인가 결과는 ZCode 서버에 기록되며, 게이트웨이가 백그라운드에서 자격 증명을 자동으로 가져와 계정 목록에 추가합니다.", "打开 ZCode {label}授权页": "ZCode {label} 인가 페이지 열기", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Huawei Cloud CodeArts의 공식 인가 페이지를 열어 로그인하세요: 로그인이 완료되면 공식 페이지가 브라우저를 게이트웨이 자체의 /oauth/callback으로 되돌립니다. 게이트웨이는 일회성 인가 코드를 임시 자격 증명으로 교환하고 계정 목록에 추가합니다.
    게이트웨이가 다른 컴퓨터에서 실행 중이면 웹 UI에서 주소 표시줄의 최종 콜백 주소를 패널에 그대로 붙여넣으라는 안내가 표시됩니다.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Huawei Cloud 인가 페이지를 열고 로그인하세요: 완료되면 게이트웨이가 클라우드를 폴링해 인가 코드를 가져와 계정 목록에 추가합니다 (OfficeAce 데스크톱 앱이 필요 없고, 콜백 URL을 수동으로 다시 붙여넣을 필요도 없습니다).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "공식 인가 페이지를 열어 기기 코드 인가를 완료하세요. 로그인되는 계정은 {label} ({site}) 계정입니다.", "打开授权页": "인가 페이지 열기", "打开授权页完成确认,账号自动加入 {label}{note}": "인가 페이지를 열어 확인을 완료하면 계정이 {label}에 자동으로 추가됩니다{note}", "打开方式": "여는 방식", "打开网页登录": "웹 로그인 열기", "探测失败:{message}": "탐지 실패: {message}", "接入一个兼容上游": "호환 업스트림 연결", "提交中…": "제출 중…", "搜索提供商": "제공자 검색", "搜索提供商…": "제공자 검색…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "공식 플러그인 / CLIProxyAPI가 디스크에 기록한 자격 증명 JSON을 통째로 붙여넣으세요 (형식: {\"codearts_provider_credential\":{…}}, 평탄화된 형태도 가능).
    필수: access_key_id, secret_access_key, security_token.자동 갱신을 원하면 refresh_token과 oauth_context도 함께 붙여넣어야 합니다 — 임시 자격 증명은 약 1시간 후 만료되며, 이 부분이 없으면 갱신할 수 없어 다시 로그인해야 합니다.", "文件是{edition}凭证,已按该版本导入": "파일은 {edition} 자격 증명이며 해당 버전으로 가져왔습니다", "新建自定义提供商": "커스텀 제공자 새로 만들기", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "평문 JWT 또는 auth.json의 enc: 암호화 값 (자동 복호화)", "明文 JWT(国际版账号的 access token)": "평문 JWT (국제판 계정의 access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu bigmodel.cn의 Coding 플랜, Key는 open.bigmodel.cn/usercenter/apikeys에서 발급합니다", "未知错误": "알 수 없는 오류", "未能获取授权地址,请重试": "인가 주소를 가져오지 못했습니다. 다시 시도하세요", "未能读取 cc-switch 数据": "cc-switch 데이터를 읽지 못했습니다", "未领取成功": "수령하지 못했습니다", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "로컬 Ollama, OpenCode Zen 무료 등급 같은 업스트림에는 체크해야 하며, 그렇지 않으면 계정을 사용할 수 없습니다", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "이 제공자에는 **서로 대체할 수 없는** 자격 증명이 두 개 있습니다. 사용할 기능에 따라 입력하고 최소 하나는 입력하세요: 코딩 플랜 API Key는 추론 포워딩({site} 호출)과 윈도우 할당량 조회(N시간마다 / 주간 잔여 비율)에 사용하고, jwt는 플랜 수령과 잔액 조회에 사용합니다(zcode.z.ai의 billing 게이트웨이 호출, 공식 명칭 Coding Plan JWT, 3단 점 구분 문자열). 잔액은 둘 다 조회할 수 있지만 읽어 오는 내용이 다릅니다: jwt는 잔액 버킷과 플랜 만료를, API Key는 윈도우 할당량을 읽습니다. 수령은 jwt만, 포워딩은 API Key만 인정합니다. {label} 계정의 자격 증명을 입력하세요 — {plan} (가장 쉽게 얻는 방법: 위의 「웹 로그인」을 바로 사용하세요 — 이 API Key를 대신 교환해 두 자격 증명을 함께 받아 줍니다.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "이 컴퓨터의 Ollama OpenAI 호환 엔드포인트, API Key 불필요 (기본적으로 「이 업스트림은 인증이 필요하지 않음」이 체크되어 있고, 인증 헤더를 전혀 보내지 않습니다)", "本次未确认到账": "이번에는 적립이 확인되지 않았습니다", "条可导入": "건을 가져올 수 있습니다", "条配置,其中": "건의 설정 중", "桌面运行时不可用(Tauri 未初始化)": "데스크톱 런타임을 사용할 수 없습니다 (Tauri 미초기화)", "模型网关基址": "모델 게이트웨이 기본 주소", "正在打开百度登录页…": "Baidu 로그인 페이지를 여는 중…", "正在扫描本机 cc-switch…": "이 컴퓨터의 cc-switch를 스캔하는 중…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "{name} 로그인 완료를 기다리는 중입니다; 완료하거나 취소한 후에 새로운 로그인을 시작할 수 있습니다", "每周": "매주", "每日": "매일", "每月": "매월", "没有则无法自动续期": "없으면 자동 갱신할 수 없습니다", "没有匹配「{keyword}」的提供商": "「{keyword}」와 일치하는 제공자가 없습니다", "添加 {name} 账号": "{name} 계정 추가", "添加中…": "추가 중…", "添加到 ": "추가 대상: ", "添加失败:{reason}": "추가 실패: {reason}", "添加小浣熊账号": "小浣熊 계정 추가", "添加方式": "추가 방식", "添加账号": "계정 추가", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding 플랜; 범용 추론 엔드포인트는 https://ark.cn-beijing.volces.com/api/v3입니다", "点击添加账号": "클릭하여 계정 추가", "点开即预填,填 Key 接入": "열면 값이 미리 채워져 있으며, Key를 입력하면 연결됩니다", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "버튼을 누르면 먼저 슬라이더 인증을 한 번 통과하고(공식 리스크 관리), 이어서 로그인 페이지가 열리며 로그인이 완료되면 계정이 자동으로 추가됩니다.
    이것이 국제판의 공식 유일한 로그인 방식입니다; 이미 클라이언트에 로그인한 적이 있다면 「데스크톱 로그인 상태 가져오기」가 더 빠릅니다.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "AutoClaw 계정에 연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭하고 SMS를 받은 뒤 아래에 입력하여 로그인하세요. 인증 코드는 이 컴퓨터에서 공식 API로 직접 제출되며, 화면에 token이 표시되지 않습니다.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "CatPaw 계정으로 로그인합니다 (Meituan passport), 성공하면 자동으로 계정 목록에 추가됩니다.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Loomy 계정에 연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭한 뒤 입력하면 됩니다. 이 제공자에서 가장 간편한 방법입니다.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "포워딩에 사용합니다; apiKey.secret 형태의 2단 점 구분 (입력하지 않으면 이 계정은 포워딩할 수 없습니다)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "플랜 수령과 잔액 조회에 사용합니다; 입력하지 않으면 이 계정은 수령과 잔액 조회를 할 수 없습니다", "用户 ID": "사용자 ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭한 뒤 입력하면 됩니다. 이것이 중국판의 공식 유일한 로그인 방식입니다.", "留空则用提供商名称": "비워 두면 제공자 이름 사용", "登录 / 添加 {name} 账号": "로그인 / {name} 계정 추가", "登录 session(一长串)": "로그인 session (긴 문자열)", "登录中…": "로그인 중…", "登录失败:{message}": "로그인 실패: {message}", "登录已结束": "로그인이 종료되었습니다", "登录并添加": "로그인 후 추가", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "로그인 상태 파일 경로: ~/.box-agent/config/auth.json (Windows: C:\\Users\\<사용자 이름>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "커스텀 제공자 「{name}」을(를) 삭제할까요? 이 제공자 아래의 계정 {count}개도 함께 삭제되며, 삭제 후에는 복구할 수 없습니다.", "等待 Accio {label}登录完成…": "Accio {label} 로그인 대기 중…", "等待 CatPaw 登录完成…": "CatPaw 로그인 대기 중…", "等待 Cline 授权确认…": "Cline 인가 확인 대기 중…", "等待 CodeArts 登录完成…": "CodeArts 로그인 대기 중…", "等待 Google 授权完成…": "Google 인가 대기 중…", "等待 KukuAI 登录完成…": "KukuAI 로그인 대기 중…", "等待 OfficeAce 登录完成…": "OfficeAce 로그인 대기 중…", "等待 Qoder 授权完成…": "Qoder 인가 대기 중…", "等待 Trae 授权完成…": "Trae 인가 대기 중…", "等待 ZCode {label}授权完成…": "ZCode {label} 인가 대기 중…", "等待小浣熊登录完成…": "小浣熊 로그인 대기 중…", "等待登录完成…": "로그인 완료 대기 중…", "等待网页登录…": "웹 로그인 대기 중…", "粘贴 API Key": "API Key 붙여넣기", "粘贴 Accio 的 accessToken": "Accio의 accessToken 붙여넣기", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity의 Google refresh token을 붙여넣으세요 (1//로 시작; refresh_token=이 포함된 줄 전체를 붙여넣어도 됨).
    웹 로그인 외의 수동 입구입니다(예: 로그인된 공식 IDE에서 내보내기). refresh token은 만료되지 않으며, access token 만료 시 게이트웨이가 자동으로 갱신합니다; 토큰을 잃어버리면 Google 인가를 다시 받아야 하므로 잘 보관하세요.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code의 API Key를 붙여넣으세요 (user_로 시작; 공식 CLI의 ~/.commandcode/auth.json 또는 웹 studio에서 획득). 줄 전체 / 따옴표 포함 / Bearer 접두사 포함 그대로 붙여넣어도 됩니다. 게이트웨이가 알아서 순수한 key만 추출합니다. key는 만료되지 않고 갱신 인터페이스도 없으므로, 무효가 되면 다시 받으면 됩니다; 추가 시 게이트웨이가 가벼운 활성 확인을 한 번 수행하며, 실패해도 추가에는 영향을 주지 않습니다.", "粘贴 Cookie": "Cookie 붙여넣기", "粘贴 Google refresh token": "Google refresh token 붙여넣기", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder 개인 액세스 토큰(pt-…) 붙여넣기", "粘贴 access_token(一长串 JWT)": "access_token 붙여넣기 (긴 JWT)", "粘贴 session cookie": "session cookie 붙여넣기", "粘贴 token / refreshToken": "token / refreshToken 붙여넣기", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "workos:…로 시작하는 토큰 붙여넣기 (접두사가 없어도 자동으로 붙습니다)", "粘贴登录凭据": "로그인 자격 증명 붙여넣기", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "붙여넣는 것은 로그인 session입니다 (동시에 모델 게이트웨이의 token입니다). Loomy에는 갱신 인터페이스가 없으며 session 유효 기간은 약 14일이므로, 만료되면 다시 로그인하면 됩니다.", "粘贴网关凭据": "게이트웨이 자격 증명 붙여넣기", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "웹 로그인 상태 cookie monkeycode_ai_session의 값을 붙여넣으세요 (브라우저에서 전체 Cookie를 복사해 그대로 붙여넣어도 됩니다. 게이트웨이가 값을 알아서 추출합니다).
    {siteNote}
    MonkeyCode에는 갱신 인터페이스가 없습니다: session 유효 기간은 약 30일(하드 제한)이며, 만료되면 웹에 다시 로그인해 한 번 더 붙여넣으면 됩니다.", "系统浏览器": "시스템 브라우저", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "시스템 브라우저는 기존 로그인 상태를 재사용할 수 있습니다 (국제판 권장); 내장 창이 더 깔끔합니다.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Cline 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "시스템 브라우저로 엽니다(로그인된 Google 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Zai / Google 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Meituan 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统默认浏览器": "시스템 기본 브라우저", "编码套餐 API Key": "코딩 플랜 API Key", "网关 Secret": "게이트웨이 시크릿", "网页登录": "웹 로그인", "网页登录的打开方式": "웹 로그인을 여는 방식", "网页登录(Zai / Google)": "웹 로그인 (Zai / Google)", "自定义": "커스텀", "获取风控配置失败,将直接尝试领取:{message}": "리스크 관리 구성을 가져오지 못했습니다. 바로 수령을 시도합니다: {message}", "获取验证码": "코드 받기", "该上游无需鉴权(不发送鉴权头)": "이 업스트림은 인증이 필요하지 않음 (인증 헤더를 보내지 않음)", "该提供商": "이 제공자", "该提供商账号添加功能即将上线": "이 제공자의 계정 추가 기능이 곧 출시됩니다", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "이 커스텀 제공자가 더 이상 존재하지 않습니다(삭제되었을 수 있습니다). 새로 고친 후 다시 시도하세요", "请先选择一个自定义提供商": "먼저 커스텀 제공자를 선택하세요", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "표시된 슬라이더에서 인증을 완료하세요 (공식에서 요구하는 리스크 관리 단계)", "请填写 11 位大陆手机号": "11자리 중국 본토 휴대폰 번호를 입력하세요", "请填写 6 位数字验证码": "6자리 숫자 인증 코드를 입력하세요", "请填写 Base URL": "Base URL을 입력하세요", "请填写 {label}": "{label}을(를) 입력하세요", "请填写名称": "이름을 입력하세요", "请完成验证…": "인증을 완료하세요…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "%APPDATA%/AutoClaw/auth.json을 읽어 복호화합니다. Windows 전용", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json을 읽습니다. Cline 클라이언트에 로그인되어 있어야 합니다", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json을 읽습니다. CatPaw 클라이언트에 로그인되어 있어야 합니다", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "이 컴퓨터의 KukuAI 클라이언트 로그인 상태를 읽습니다 (%APPDATA%\\baidugenflowpro\\Network\\Cookies). KukuAI 클라이언트에 로그인되어 있어야 합니다", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 읽습니다 (평문 Cookie, 복호화 불필요). 클라이언트 실행 중에는 Cookies 파일이 독점 점유되므로, 가져오기 전에 KukuAI 클라이언트를 먼저 종료하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 「Token 갱신」을 눌러 동기화하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 다시 가져오면 됩니다.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). Zai / Google로 클라이언트에 로그인하는 사용자는 이 항목을 사용하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 이 항목은 {label}로 분류됩니다.", "账号信息": "계정 정보", "账号信息不完整,请刷新后重试": "계정 정보가 불완전합니다. 새로 고친 후 다시 시도하세요", "账号已添加,但请留意:{warning}": "계정은 추가되었지만 확인해 주세요: {warning}", "账号版本": "계정 버전", "账号类型": "계정 유형", "账号:{name}
    ": "계정: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Inference Providers 라우팅을 사용하며, Key는 hf.co/settings/tokens에서 만듭니다", "还没有账号": "아직 계정이 없습니다", "这一家当前不支持网页登录,请改用填写凭证": "이 제공자는 현재 웹 로그인을 지원하지 않습니다. 대신 자격 증명 입력을 사용하세요", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "이 계정에는 현재 자동으로 수령할 수 있는 이벤트가 없습니다 (매일 로그인 보너스 포인트만 자동 수령합니다)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "이 할당량은 「이벤트 플랜」 채널을 사용합니다: 포워딩 시 코딩 플랜이 만료되었다는 안내가 나오면, ", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 중국 사이트(monkeycode-ai.com)의 계정을 입력합니다: 중국 사이트의 session을 붙여넣으세요. 국제 사이트(monkeycode-ai.net)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 국제 사이트(monkeycode-ai.net)의 계정을 입력합니다: 국제 사이트의 session을 붙여넣으세요. 중국 사이트(monkeycode-ai.com)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", "选择凭证文件导入": "자격 증명 파일에서 가져오기", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "공식 클라이언트의 로그인 자격 증명 파일(workbuddy-desktop.info / workbuddy-desktop-ai.info) 또는 wb2api에서 내보낸 계정 JSON(중첩/평면 형식 모두 가능)을 선택하세요. 이 컴퓨터의 공식 클라이언트에서 직접 읽을 수도 있습니다.", "选择提供商": "제공자 선택", "选择的文件不是合法 JSON": "선택한 파일이 유효한 JSON이 아닙니다", "选择要添加账号的提供商": "계정을 추가할 제공자 선택", "重新扫描": "다시 스캔", "鉴权": "인증", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan (국제 사이트)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding 플랜 (중국 사이트)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding 플랜 (국제 사이트)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio 모델 서비스 (국제 사이트, OpenAI 호환 모드)", "需要图形验证码:登录窗口已弹出,请填写后继续": "그래픽 캡차가 필요합니다: 로그인 창이 열렸으니 입력한 후 계속하세요", "预置 API": "프리셋 API", "领取 CodeArts 每日福利": "CodeArts 일일 혜택 수령", "领取失败:{message}": "수령 실패: {message}", "领取并让官方确认": "수령하고 공식 확인 받기", "风控验证配置不完整,请稍后重试": "리스크 관리 인증 구성이 불완전합니다. 잠시 후 다시 시도하세요", "验证码": "인증 코드", "验证码已发送。收到后填入下方并点「登录并添加」": "인증 코드를 전송했습니다. 받은 후 아래에 입력하고 「로그인 후 추가」를 클릭하세요", "验证码已发送,请查看手机短信": "인증 코드를 전송했습니다. 휴대폰 SMS를 확인하세요", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "인증 코드를 전송했습니다. 휴대폰 SMS를 확인하세요. 아래에 입력하고 「로그인 후 추가」를 클릭하면 로그인이 완료됩니다", "验证码已发送,请查看短信": "인증 코드를 전송했습니다. 문자 메시지를 확인하세요", "验证码校验失败,请重试": "인증 코드 확인에 실패했습니다. 다시 시도하세요", "验证码校验超时,请重试": "인증 코드 확인 시간이 초과되었습니다. 다시 시도하세요", "验证码组件不可用,请重试": "캡차 컴포넌트를 사용할 수 없습니다. 다시 시도하세요", "验证码组件初始化超时,请重试": "캡차 컴포넌트 초기화 시간이 초과되었습니다. 다시 시도하세요", "验证码组件加载失败,请检查网络后重试": "캡차 컴포넌트 로드에 실패했습니다. 네트워크를 확인한 후 다시 시도하세요", "验证码组件加载异常,请重试": "캡차 컴포넌트 로드 중 오류가 발생했습니다. 다시 시도하세요", "验证码组件加载超时,请检查网络后重试": "캡차 컴포넌트 로드 시간이 초과되었습니다. 네트워크를 확인한 후 다시 시도하세요", "验证码组件未加载,请重启应用后重试": "캡차 컴포넌트가 로드되지 않았습니다. 앱을 다시 시작한 후 다시 시도하세요", "(免费额度池,模型名带 cline-free/ 前缀)。": " (무료 할당량 풀, 모델 이름에 cline-free/ 접두사 포함).", "(其中 {n} 把恢复为不限制)": " (이 중 {n}개는 제한 없음으로 복원)", "(必填)": " (필수)", "(有效期 {window})": "(유효 기간 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (구독 풀, 모델 이름에 cline-pass/ 접두사 포함, 계정에 해당 구독이 있어야 합니다).", ",下一次最快 {minutes} 分钟后": ", 다음 시도는 최소 {minutes}분 후", ",并从 {n} 把 Key 的可用提供商里移除": ", Key {n}개의 사용 가능한 제공자 목록에서 이 제공자를 제거했습니다" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · 모델 {head}{rest}", " 等 {n} 个": " 등 {n}개", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1//로 시작하는 Google refresh token (refresh_token=… 줄 전체를 붙여넣어도 됨)", "11 位大陆手机号": "11자리 중국 본토 휴대폰 번호", "1~64 个字符,账号列表里按它分组显示": "1~64자, 계정 목록에서 이 값을 기준으로 그룹화되어 표시됩니다", "6 位数字": "6자리 숫자", "

  • 没有可自动领的活动
  • ": "
  • 자동으로 수령할 수 있는 이벤트가 없습니다
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    수령하는 것은 플랜 증정 포인트이며, 혜택 모델의 token 풀은 늘지 않습니다;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 호환 엔드포인트는 https://api.deepseek.com/anthropic입니다 (프로토콜을 anthropic으로 바꿀 때 입력합니다)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic 프로토콜은 루트 주소를 입력하고 /v1은 붙이지 마세요", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 중국판", "AutoClaw 国际版": "AutoClaw 국제판", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS는 필수입니다; **전체 Cookie**를 붙여넣으세요 (Cookie 편집기에서 원클릭 내보내기 가능) — 이 중 **PTOKEN은 반드시 남겨 두세요**. 게이트웨이가 이것을 사용해 Baidu에서 KukuAI 비즈니스 세션 토큰을 교환 발급받으며, 없으면 모델 갱신 시 「미로그인」 오류가 발생합니다. 전체 Cookie 헤더, Cookie 편집기에서 내보낸 JSON 배열, 또는 {BDUSS, STOKEN} 객체를 지원합니다. KukuAI에는 갱신 메커니즘이 없으므로 로그인 상태가 만료되면 다시 붙여넣으면 됩니다.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (또는 Cookie 편집기에서 내보낸 JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw의 X-Passport-Token (로그인 상태 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (3단 점 구분)", "Command Code": "Command Code", "ModelScope 国内版": "ModelScope 중국판", "ModelScope 国际版": "ModelScope 인터내셔널판", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 국제판", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM 관리형 엔드포인트, Key는 integrate.api.nvidia.com에서 신청합니다", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken은 Accio의 로그인 자격 증명입니다 (길고 불투명한 token 문자열이며 JWT가 아닙니다); refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다. {label} 계정의 자격 증명을 입력하세요 — {siteNote} (가장 쉽게 얻는 방법: 위의 「웹 로그인」을 바로 사용하세요. token을 직접 찾을 필요가 없습니다.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken은 Trae의 Cloud-IDE-JWT이며(3단 점 구분), refreshToken은 만료 시 자동 갱신에 사용됩니다 (이 제공자는 refreshToken이 교환할 때마다 바뀝니다: 한 번 교환하면 이전 것은 무효가 되므로 두 프로그램에서 같은 계정을 동시에 갱신하지 마세요).
    수동으로 붙여넣을 때는 machineId / deviceId도 함께 입력하세요: 업스트림은 이를 로그인 시 업로드한 기기 공개 키와 묶어 기기를 판별하므로, 갑자기 새로운 값을 넣으면 2xxxx 계열 기기 바인딩 거부가 발생합니다.
    이 세 가지가 없을 때의 올바른 방법은 위의 「웹 로그인」이며, 컨테이너 / 원격 배포 환경에서는 안내에 따라 주소 표시줄의 콜백 주소를 붙여넣으면 됩니다.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session의 값 (전체 Cookie를 붙여넣어도 됨)", "ms- 开头的 API 令牌": "ms- 로 시작하는 API 토큰", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken은 선택이며, 입력하면 만료 시 자동 갱신됩니다; 둘 다 小浣熊 클라이언트 로그인 상태 파일에서 얻을 수 있습니다.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken은 선택이며, 입력하면 자동 갱신됩니다; 둘 다 클라이언트 로그인 상태 파일에서 얻을 수 있습니다. 같은 Cline 계정은 두 풀 모두에서 사용할 수 있으며, 여기서는 {label}로 분류됩니다.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token은 enc: 접두사를 지원합니다 (Windows에서는 자동 복호화). refreshToken을 입력하지 않으면 자동 갱신할 수 없습니다.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token은 로그인 상태 Cookie입니다; CatPaw에는 갱신 메커니즘이 없어 만료 후 클라이언트에서 다시 로그인해야 합니다.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_로 시작하는 API Key (Authorization: Bearer … 줄 전체를 붙여넣어도 됨)", "{label} 网页登录的打开方式": "{label} 웹 로그인을 여는 방식", "{label} 账号地区": "{label} 계정 지역", "{label} 账号的添加方式": "{label} 계정 추가 방식", "{name} 不是合法 JSON:{reason}": "{name}은(는) 올바른 JSON이 아닙니다: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}에는 JSON 객체를 붙여넣어야 합니다 (예: {sample})", "{n} 个账号": "계정 {n}개", "{n} 个账号,点击添加": "계정 {n}개, 클릭하여 추가", "{seconds}s 后重发": "{seconds}초 후 재발송", "✅ {label}账号已添加": "✅ {label} 계정을 추가했습니다", "✅ {label}账号已添加{name}": "✅ {label} 계정을 추가했습니다{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ cc-switch에서 제공자 {n}개를 가져왔습니다", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ 커스텀 제공자 「{name}」을(를) 만들고 계정을 추가했습니다", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ 커스텀 제공자 「{name}」을(를) 삭제했습니다{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ 로그인 성공, {edition} 계정을 목록에 추가했습니다", "✅ 领取成功:{planId}{period}": "✅ 수령 성공: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 같은 제공자에 key를 여러 개 둘 수 있으며, 우선순위에 따라 로테이션됩니다.", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」의 계정 추가 기능은 아직 개발 중입니다. 기대해 주세요.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "하나의 Key로 여러 제공자의 모델을 사용할 수 있으며, 모델 이름은 「벤더/모델」 전체 이름을 씁니다 (예: deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "업스트림이 인증을 요구하지 않으면 비워 두고 아래 항목을 체크하세요 (비워 두고 체크하지 않으면 자격 증명 미설정으로 간주됩니다)", "上游信息": "업스트림 정보", "不可领({status})": "수령 불가 ({status})", "不支持导入": "가져오기 미지원", "不是有效的凭证文件:内容要是一个 JSON 对象": "유효한 자격 증명 파일이 아닙니다. 내용은 JSON 객체여야 합니다", "不是有效的凭证文件:需要包含 accessToken 与 uid": "유효한 자격 증명 파일이 아닙니다. accessToken과 uid가 필요합니다", "不是自定义提供商": "커스텀 제공자가 아닙니다", "不需要 Key:转发与拉取模型都不发送鉴权头": "Key 불필요: 포워딩과 모델 조회 모두 인증 헤더를 보내지 않습니다", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "두 판의 계정을 동시에 저장할 수 있으며 각각 별도의 모델 목록을 가집니다 (중국판과 국제판은 서로 다른 두 제공자로, 각각 활성화하고 매핑할 수 있습니다).", "中国版": "중국판", "今天没有需要领的活动(都已到账)": "오늘 수령할 이벤트가 없습니다 (모두 적립됨)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "오늘(베이징 시간 {day}) {attempts}회 시도했고, {left}회 더 시도할 수 있습니다{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "다른 컴퓨터(또는 OfficeAce 데스크톱 앱의 models.json)에서 다음 세 항목을 가져와 붙여넣으세요: 모델 게이트웨이 기본 주소(baseUrl, https://modelgw-…/v2 형태)와 modelAppKey / modelAppSecret. 이 세 항목만 있으면 전달할 수 있습니다(게이트웨이 자격 증명은 만료되지 않음). 제어 영역 임시 자격 증명(accessKeyId 등)은 선택이며, 비워 두면 잔액 조회와 자동 갱신을 쓸 수 없지만 전달에는 영향이 없습니다.", "从本机导入桌面端登录态": "이 컴퓨터에서 데스크톱 로그인 상태 가져오기", "任务镜像 id": "작업 이미지 id", "使用 Google 账号登录": "Google 계정으로 로그인", "使用 Zai 账号登录": "Zai 계정으로 로그인", "使用个人访问令牌(PAT)": "개인 액세스 토큰(PAT) 사용", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "무료 모델은 Key를 입력하지 않아도 됩니다 (기본적으로 「이 업스트림은 인증이 필요하지 않음」이 체크되어 있고, 게이트웨이가 자동으로 익명 자격 증명을 사용합니다); 유료 모델은 Zen의 API Key를 입력하세요. 무료 등급 업스트림은 공식 클라이언트 형태만 허용하므로 「OpenCode 공식 클라이언트로 위장」이 기본으로 켜져 있습니다", "内嵌窗口": "내장 창", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "내장 창으로 엽니다; 창을 닫으면 대기가 취소됩니다 (Google 계정이 거부되면 시스템 브라우저를 사용하세요)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "내장 창으로 엽니다; 완료하면 자동으로 목록에 추가되고, 창을 닫으면 대기가 취소됩니다", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "내장 창은 새 환경을 사용하므로 여러 계정이 서로 영향을 주지 않습니다; 창을 닫으면 대기가 취소됩니다", "内嵌窗口(推荐)": "내장 창(권장)", "准备验证…": "인증 준비 중…", "凭据 JSON": "자격 증명 JSON", "凭证文件在哪?": "자격 증명 파일 위치는?", "创建并添加账号": "생성하고 계정 추가", "创建这个提供商,并同时建立它的第一个账号。": "이 제공자를 만들고 동시에 첫 계정을 생성합니다.", "删除功能不可用(脚本未就绪)": "삭제 기능을 사용할 수 없습니다 (스크립트가 준비되지 않음)", "删除失败:{reason}": "삭제 실패: {reason}", "删除此提供商": "이 제공자 삭제", "及 {n} 个账号": " 및 계정 {n}개", "发送中…": "전송 중…", "发送失败:{message}": "전송 실패: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "전송 미확인: 로그인 창이 열렸습니다. 열린 창에서 직접 로그인을 완료하세요", "取消失败:{message}": "취소 실패: {message}", "取消等待": "대기 취소", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "「내장 창」에서만 제3자 로그인 항목을 복원할 수 있습니다: 시스템 브라우저에서는 로그인 페이지를 수정할 수 없습니다", "可选": "선택", "可选(cloudaicompanionProject):留空由网关自动发现": "선택 (cloudaicompanionProject): 비워 두면 게이트웨이가 자동으로 찾습니다", "可选,展示用": "선택, 표시용", "可选,没有则无法自动续期": "선택, 없으면 자동 갱신 불가", "可选,留空使用凭据里的 user_name": "선택, 비워 두면 자격 증명의 user_name 사용", "可选,留空使用账号姓名、邮箱或令牌指纹": "선택, 비워 두면 계정 이름, 이메일 또는 토큰 지문 사용", "可选,留空使用账号昵称或邮箱": "선택, 비워 두면 계정 닉네임 또는 이메일 사용", "可选,留空则用 key 尾号": "선택, 비워 두면 key 끝자리 사용", "可选,留空则用 userId": "선택, 비워 두면 userId 사용", "可选,留空则用上游账号昵称": "선택 사항. 비워 두면 업스트림 계정 닉네임을 사용합니다", "可选,留空则用上游返回的账号名或账号 id": "선택, 비워 두면 업스트림이 반환한 계정 이름 또는 계정 id 사용", "可选,留空则用凭证里的账号名": "선택, 비워 두면 자격 증명의 계정 이름 사용", "可选,留空则用文件里的昵称": "선택 사항, 비워 두면 파일의 닉네임 사용", "可选,留空则用登录名或 uid": "선택, 비워 두면 로그인 이름 또는 uid 사용", "可选,留空则用脱敏手机号": "선택, 비워 두면 마스킹된 휴대폰 번호 사용", "可选,留空则用脱敏手机号或 userId": "선택, 비워 두면 마스킹된 휴대폰 번호 또는 userId 사용", "可选,留空则用账号 uk": "선택, 비워 두면 계정 uk 사용", "可选,留空则用邮箱或令牌尾号": "선택, 비워 두면 이메일 또는 토큰 끝자리 사용", "可选,留空用「OfficeAce 果办」": "선택, 비워 두면 「OfficeAce」 사용", "可选,留空自动生成": "선택, 비워 두면 자동 생성", "可选,留空自动用昵称": "선택, 비워 두면 닉네임 자동 사용", "可选,续期时带上": "선택, 갱신 시 함께 전송", "可选,讯飞侧 userid": "선택, iFlytek 측 userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "선택; 대화 시작에 필요합니다. 비워 두면 게이트웨이가 이 계정의 기존 작업에서 자동으로 찾습니다. 찾지 못하면 나중에 직접 입력하면 됩니다.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "선택; 계정 이메일로, 표시와 신원 식별에 사용됩니다 (새 토큰으로 바꿔도 같은 계정으로 인식됩니다)", "可选;UUID 形态,与凭据同生共死": "선택; UUID 형식이며 자격 증명과 함께 생성되고 함께 사라집니다", "可选;填了才能到期自动续期": "선택; 입력해야 만료 시 자동 갱신할 수 있습니다", "可选;用于去重与展示名(留空时网关会问一次上游)": "선택; 중복 제거와 표시 이름에 사용됩니다 (비워 두면 게이트웨이가 업스트림에 한 번 물어봅니다)", "可选;用于生成账号 id 与展示名": "선택; 계정 id와 표시 이름 생성에 사용됩니다", "可选;纯数字串(上游只收 8–24 位数字)": "선택; 숫자만 입력 (업스트림은 8–24자리 숫자만 허용)", "可领取": "수령 가능", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "같은 제공자에 섞어 둘 수 있습니다: Key가 있는 계정과 인증이 필요 없는 계정은 각자의 규칙을 따릅니다", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "같은 주소에서 anthropic 프로토콜로 바꾸면 해당 Claude 호환 엔드포인트를 사용합니다. 포워딩에는 OpenCode Go의 API Key가 반드시 필요합니다 (구독제; 모델 목록 조회에는 Key가 필요 없지만, 요청을 보내면 업스트림이 401 「Missing API key」를 반환합니다)", "响应为空": "응답이 비어 있습니다", "国内版": "중국판", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "중국판과 **국제판은 서로 독립된 두 세트의 계정과 플랜**입니다. 자격 증명과 수령한 플랜은 서로 호환되지 않습니다.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "중국판 로그인 페이지에는 Google / GitHub 항목이 없습니다 (WeChat / 휴대폰 번호 / 이메일로 로그인합니다)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "중국판의 로그인 사이트는 www.accio-ai.com이며, 국제판과 같은 사이트가 아닙니다.", "国内版(WorkBuddy)": "중국판 (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "중국 사이트는 https://api.siliconflow.cn/v1입니다", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "중국 사이트 (minimaxi.com); OpenAI 호환 주소는 https://api.minimaxi.com/v1입니다", "国际版": "국제판", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "국제판 z.ai의 Coding 플랜; OpenAI 호환 주소는 https://api.z.ai/api/coding/paas/v4입니다", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "국제판과 중국판은 **서로 독립된 두 세트의 계정**입니다 (같은 계정 체계의 두 사이트). 자격 증명은 호환되지 않습니다.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "국제판과 중국판은 계정 체계가 독립적입니다. 국제판의 자격 증명을 입력하세요. refreshToken을 입력하지 않으면 자동 갱신할 수 없습니다.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "국제판 로그인 페이지는 기본적으로 이메일 로그인만 표시하며, 체크하면 Google / GitHub / X 항목이 복원됩니다", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "국제판의 추론 사이트는 api.z.ai이며 중국판과 다른 사이트입니다; 플랜도 각각 독립적입니다.", "国际版(WorkBuddy AI)": "국제판 (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "국제 사이트 Coding 플랜; OpenAI 호환 주소는 https://api.minimax.io/v1입니다", "在 cc-switch 里找到": "cc-switch에서 찾은", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "내장 창에서 공식 로그인을 완료하면 성공 시 자동으로 계정 목록에 추가됩니다.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "{label}의 Qoder 계정 설정 → Integrations에서 PAT를 생성하세요 (Google / GitHub 토큰을 입력하지 마세요). 두 지역의 계정과 자격 증명은 호환되지 않습니다.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "열린 창에서 Baidu 계정으로 KukuAI 메인 사이트에 로그인하세요 (SMS 인증 코드 / QR 스캔 모두 가능). 로그인에 성공하면 자동으로 계정 목록에 추가됩니다. 게이트웨이는 Baidu에서 KukuAI 비즈니스 세션 토큰을 교환 발급받습니다 (이 컴퓨터에 KukuAI 클라이언트가 설치되어 있어야 합니다).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "열린 창에서 Google 계정으로 로그인하세요(Antigravity의 인가 페이지). 인가가 완료되면 자동으로 계정 목록에 추가됩니다.", "在浏览器中打开登录页": "브라우저에서 로그인 페이지 열기", "地区": "지역", "填写凭证": "자격 증명 입력", "填写凭证添加": "자격 증명 입력 후 추가", "备注名": "라벨명", "套餐": "플랜", "如:智谱 GLM": "예: Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "로그인을 완료하면 자동으로 계정 목록에 추가되며, 닉네임은 업스트림에서 가져옵니다.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "공식 클라이언트 자격 증명 디렉터리: Windows는 C:\\Users\\<사용자명>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth, macOS는 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "공식 적립 확인 완료", "导入": "가져오기", "导入中…": "가져오는 중…", "导入凭证文件": "자격 증명 파일 가져오기", "导入失败": "가져오기 실패", "导入失败:{reason}": "가져오기 실패: {reason}", "导入所选": "선택 항목 가져오기", "导入所选({n})": "선택 항목 가져오기({n})", "导入桌面端登录态": "데스크톱 로그인 상태 가져오기", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "내장 창이 열립니다; 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 창을 닫으면 대기가 취소됩니다. 인가 페이지 마지막에 zcode:// 링크를 열 수 없다는 안내가 나올 수 있는데, 정상입니다 — 결과는 이미 서버 측에 기록되었습니다", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "내장 창이 열립니다; 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 원격 패널에서는 콜백 주소를 붙여넣을 수 있습니다. 창을 닫으면 대기가 취소됩니다. 링크는 5분간 유효하며, 시간이 초과되거나 클릭하지 않으면 무효가 됩니다 (다시 시작할 수 있습니다)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "내장 창이 열립니다; 로그인이 완료되면 자동으로 계정 목록에 추가됩니다. 창을 닫으면 대기가 취소됩니다", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 Trae 계정을 재사용합니다); 같은 컴퓨터에서는 완료 시 자동으로 추가되며, Docker / 원격 패널에서는 안내에 따라 주소 표시줄의 콜백 주소를 붙여넣으세요.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 ZCode 계정을 재사용합니다); 인가가 완료되면 자동으로 계정 목록에 추가됩니다. 페이지 마지막에 zcode:// 링크를 열 수 없다는 안내가 나올 수 있는데 정상입니다", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "시스템 기본 브라우저로 인가 페이지를 엽니다 (브라우저에 로그인된 Huawei Cloud 계정을 재사용합니다); 브라우저와 게이트웨이가 같은 컴퓨터에 있지 않다면 위 설명대로 최종 콜백 주소를 패널에 다시 붙여넣으세요", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "시스템 기본 브라우저로 로그인 페이지를 엽니다 (브라우저에 로그인된 Accio 계정을 재사용합니다); 로그인을 완료하면 자동으로 계정 목록에 추가되며, 팝업을 닫으면 대기가 취소됩니다", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan 플랜 (싱가포르 사이트)", "已到账": "적립 완료", "已取消登录等待": "로그인 대기를 취소했습니다", "已取消领取": "수령을 취소했습니다", "已取消验证码": "인증 코드를 취소했습니다", "已填写手机号,正在发送验证码…": "휴대폰 번호 입력 완료, 인증 코드 전송 중…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "인증 필요 없음으로 선언됨: 계정이 정상적으로 라우팅되며, 외부로 나갈 때 인증 헤더를 전혀 보내지 않습니다", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "가져오기 성공 {ok}개, 실패 {fail}개 (실패 항목은 목록에 표시해 두었습니다)", "已建过 · {n} 个账号,点击继续添加": "이미 생성됨 · 계정 {n}개, 클릭하여 추가", "已建过,点击继续添加账号": "이미 생성됨, 클릭하여 계정 추가", "已打开官方登录页,请在窗口中完成登录…": "공식 로그인 페이지를 열었습니다. 창에서 로그인을 완료하세요…", "已点发送,等待短信…": "전송을 눌렀습니다. SMS 대기 중…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "시스템 기본 브라우저로 로그인 페이지를 열었습니다. 브라우저에서 로그인을 완료하세요…", "已领取,等官方确认": "수령 완료, 공식 확인 대기 중", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "현재 앱 버전에서는 AutoClaw 웹 로그인을 지원하지 않습니다. 앱을 업데이트하세요", "当前没有可领取的套餐(活动尚未开始)": "현재 수령 가능한 플랜이 없습니다 (이벤트가 아직 시작되지 않았습니다)", "当前环境不支持领取(桥接方法缺失)": "현재 환경에서는 수령을 지원하지 않습니다 (브리지 메서드 없음)", "必填,CatPaw 账号标识": "필수, CatPaw 계정 식별자", "恢复 Google / GitHub 入口": "Google / GitHub 항목 복원", "手机号": "휴대폰 번호", "手机验证码登录": "SMS 인증 코드 로그인", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Trae SOLO의 공식 인가 페이지(trae.cn)를 열고 Trae 계정으로 로그인하세요: 인가가 완료되면 공식 페이지가 이 컴퓨터의 임시 포트로 되돌아옵니다; 같은 컴퓨터 배포에서는 자동으로 수신하며, Docker / 원격 패널에서는 안내에 따라 주소 표시줄의 콜백 주소를 복사하세요.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Accio {label}의 공식 로그인 페이지({site})를 열고 Accio 계정으로 로그인하세요: 로그인에 성공하면 공식 페이지가 이 컴퓨터로 되돌아옵니다; 같은 컴퓨터에서는 자동으로 완료되며, Docker / 원격 패널에서는 안내에 따라 콜백 주소를 붙여넣으면 됩니다 (인가 코드는 이 컴퓨터에서만 게이트웨이에 전달되며, 화면에 평문 token이 표시되지 않습니다).", "打开 Accio {label}登录页": "Accio {label} 로그인 페이지 열기", "打开 Antigravity 网页登录": "Antigravity 웹 로그인 열기", "打开 CatPaw 网页登录": "CatPaw 웹 로그인 열기", "打开 Cline 授权页": "Cline 인가 페이지 열기", "打开 CodeArts 授权页": "CodeArts 인가 페이지 열기", "打开 Qoder 网页登录": "Qoder 웹 로그인 열기", "打开 Trae 授权页": "Trae 인가 페이지 열기", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "ZCode {label}의 공식 인가 페이지를 열고 계정으로 로그인하세요. 인가 결과는 ZCode 서버에 기록되며, 게이트웨이가 백그라운드에서 자격 증명을 자동으로 가져와 계정 목록에 추가합니다.", "打开 ZCode {label}授权页": "ZCode {label} 인가 페이지 열기", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Huawei Cloud CodeArts의 공식 인가 페이지를 열어 로그인하세요: 로그인이 완료되면 공식 페이지가 브라우저를 게이트웨이 자체의 /oauth/callback으로 되돌립니다. 게이트웨이는 일회성 인가 코드를 임시 자격 증명으로 교환하고 계정 목록에 추가합니다.
    게이트웨이가 다른 컴퓨터에서 실행 중이면 웹 UI에서 주소 표시줄의 최종 콜백 주소를 패널에 그대로 붙여넣으라는 안내가 표시됩니다.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Huawei Cloud 인가 페이지를 열고 로그인하세요: 완료되면 게이트웨이가 클라우드를 폴링해 인가 코드를 가져와 계정 목록에 추가합니다 (OfficeAce 데스크톱 앱이 필요 없고, 콜백 URL을 수동으로 다시 붙여넣을 필요도 없습니다).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "공식 인가 페이지를 열어 기기 코드 인가를 완료하세요. 로그인되는 계정은 {label} ({site}) 계정입니다.", "打开授权页": "인가 페이지 열기", "打开授权页完成确认,账号自动加入 {label}{note}": "인가 페이지를 열어 확인을 완료하면 계정이 {label}에 자동으로 추가됩니다{note}", "打开方式": "여는 방식", "打开网页登录": "웹 로그인 열기", "探测失败:{message}": "탐지 실패: {message}", "接入一个兼容上游": "호환 업스트림 연결", "提交中…": "제출 중…", "搜索提供商": "제공자 검색", "搜索提供商…": "제공자 검색…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "공식 플러그인 / CLIProxyAPI가 디스크에 기록한 자격 증명 JSON을 통째로 붙여넣으세요 (형식: {\"codearts_provider_credential\":{…}}, 평탄화된 형태도 가능).
    필수: access_key_id, secret_access_key, security_token.자동 갱신을 원하면 refresh_token과 oauth_context도 함께 붙여넣어야 합니다 — 임시 자격 증명은 약 1시간 후 만료되며, 이 부분이 없으면 갱신할 수 없어 다시 로그인해야 합니다.", "文件是{edition}凭证,已按该版本导入": "파일은 {edition} 자격 증명이며 해당 버전으로 가져왔습니다", "新建自定义提供商": "커스텀 제공자 새로 만들기", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "평문 JWT 또는 auth.json의 enc: 암호화 값 (자동 복호화)", "明文 JWT(国际版账号的 access token)": "평문 JWT (국제판 계정의 access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Zhipu bigmodel.cn의 Coding 플랜, Key는 open.bigmodel.cn/usercenter/apikeys에서 발급합니다", "未知错误": "알 수 없는 오류", "未能获取授权地址,请重试": "인가 주소를 가져오지 못했습니다. 다시 시도하세요", "未能读取 cc-switch 数据": "cc-switch 데이터를 읽지 못했습니다", "未领取成功": "수령하지 못했습니다", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "로컬 Ollama, OpenCode Zen 무료 등급 같은 업스트림에는 체크해야 하며, 그렇지 않으면 계정을 사용할 수 없습니다", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "이 제공자에는 **서로 대체할 수 없는** 자격 증명이 두 개 있습니다. 사용할 기능에 따라 입력하고 최소 하나는 입력하세요: 코딩 플랜 API Key는 추론 포워딩({site} 호출)과 윈도우 할당량 조회(N시간마다 / 주간 잔여 비율)에 사용하고, jwt는 플랜 수령과 잔액 조회에 사용합니다(zcode.z.ai의 billing 게이트웨이 호출, 공식 명칭 Coding Plan JWT, 3단 점 구분 문자열). 잔액은 둘 다 조회할 수 있지만 읽어 오는 내용이 다릅니다: jwt는 잔액 버킷과 플랜 만료를, API Key는 윈도우 할당량을 읽습니다. 수령은 jwt만, 포워딩은 API Key만 인정합니다. {label} 계정의 자격 증명을 입력하세요 — {plan} (가장 쉽게 얻는 방법: 위의 「웹 로그인」을 바로 사용하세요 — 이 API Key를 대신 교환해 두 자격 증명을 함께 받아 줍니다.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "이 컴퓨터의 Ollama OpenAI 호환 엔드포인트, API Key 불필요 (기본적으로 「이 업스트림은 인증이 필요하지 않음」이 체크되어 있고, 인증 헤더를 전혀 보내지 않습니다)", "本次未确认到账": "이번에는 적립이 확인되지 않았습니다", "条可导入": "건을 가져올 수 있습니다", "条配置,其中": "건의 설정 중", "桌面运行时不可用(Tauri 未初始化)": "데스크톱 런타임을 사용할 수 없습니다 (Tauri 미초기화)", "模型网关基址": "모델 게이트웨이 기본 주소", "正在打开百度登录页…": "Baidu 로그인 페이지를 여는 중…", "正在扫描本机 cc-switch…": "이 컴퓨터의 cc-switch를 스캔하는 중…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "{name} 로그인 완료를 기다리는 중입니다; 완료하거나 취소한 후에 새로운 로그인을 시작할 수 있습니다", "每周": "매주", "每日": "매일", "每月": "매월", "没有则无法自动续期": "없으면 자동 갱신할 수 없습니다", "没有匹配「{keyword}」的提供商": "「{keyword}」와 일치하는 제공자가 없습니다", "添加 {name} 账号": "{name} 계정 추가", "添加中…": "추가 중…", "添加到 ": "추가 대상: ", "添加失败:{reason}": "추가 실패: {reason}", "添加小浣熊账号": "小浣熊 계정 추가", "添加方式": "추가 방식", "添加账号": "계정 추가", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Volcano Engine Coding 플랜; 범용 추론 엔드포인트는 https://ark.cn-beijing.volces.com/api/v3입니다", "点击添加账号": "클릭하여 계정 추가", "点开即预填,填 Key 接入": "열면 값이 미리 채워져 있으며, Key를 입력하면 연결됩니다", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "버튼을 누르면 먼저 슬라이더 인증을 한 번 통과하고(공식 리스크 관리), 이어서 로그인 페이지가 열리며 로그인이 완료되면 계정이 자동으로 추가됩니다.
    이것이 국제판의 공식 유일한 로그인 방식입니다; 이미 클라이언트에 로그인한 적이 있다면 「데스크톱 로그인 상태 가져오기」가 더 빠릅니다.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "AutoClaw 계정에 연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭하고 SMS를 받은 뒤 아래에 입력하여 로그인하세요. 인증 코드는 이 컴퓨터에서 공식 API로 직접 제출되며, 화면에 token이 표시되지 않습니다.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "CatPaw 계정으로 로그인합니다 (Meituan passport), 성공하면 자동으로 계정 목록에 추가됩니다.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Loomy 계정에 연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭한 뒤 입력하면 됩니다. 이 제공자에서 가장 간편한 방법입니다.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "포워딩에 사용합니다; apiKey.secret 형태의 2단 점 구분 (입력하지 않으면 이 계정은 포워딩할 수 없습니다)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "플랜 수령과 잔액 조회에 사용합니다; 입력하지 않으면 이 계정은 수령과 잔액 조회를 할 수 없습니다", "用户 ID": "사용자 ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "연결된 휴대폰 번호로 로그인합니다: 「코드 받기」를 클릭한 뒤 입력하면 됩니다. 이것이 중국판의 공식 유일한 로그인 방식입니다.", "留空则用提供商名称": "비워 두면 제공자 이름 사용", "登录 / 添加 {name} 账号": "로그인 / {name} 계정 추가", "登录 session(一长串)": "로그인 session (긴 문자열)", "登录中…": "로그인 중…", "登录失败:{message}": "로그인 실패: {message}", "登录已结束": "로그인이 종료되었습니다", "登录并添加": "로그인 후 추가", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "로그인 상태 파일 경로: ~/.box-agent/config/auth.json (Windows: C:\\Users\\<사용자 이름>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "커스텀 제공자 「{name}」을(를) 삭제할까요? 이 제공자 아래의 계정 {count}개도 함께 삭제되며, 삭제 후에는 복구할 수 없습니다.", "等待 Accio {label}登录完成…": "Accio {label} 로그인 대기 중…", "等待 CatPaw 登录完成…": "CatPaw 로그인 대기 중…", "等待 Cline 授权确认…": "Cline 인가 확인 대기 중…", "等待 CodeArts 登录完成…": "CodeArts 로그인 대기 중…", "等待 Google 授权完成…": "Google 인가 대기 중…", "等待 KukuAI 登录完成…": "KukuAI 로그인 대기 중…", "等待 OfficeAce 登录完成…": "OfficeAce 로그인 대기 중…", "等待 Qoder 授权完成…": "Qoder 인가 대기 중…", "等待 Trae 授权完成…": "Trae 인가 대기 중…", "等待 ZCode {label}授权完成…": "ZCode {label} 인가 대기 중…", "等待小浣熊登录完成…": "小浣熊 로그인 대기 중…", "等待登录完成…": "로그인 완료 대기 중…", "等待网页登录…": "웹 로그인 대기 중…", "粘贴 API Key": "API Key 붙여넣기", "粘贴 API 令牌": "API 토큰 붙여넣기", "粘贴 Accio 的 accessToken": "Accio의 accessToken 붙여넣기", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Antigravity의 Google refresh token을 붙여넣으세요 (1//로 시작; refresh_token=이 포함된 줄 전체를 붙여넣어도 됨).
    웹 로그인 외의 수동 입구입니다(예: 로그인된 공식 IDE에서 내보내기). refresh token은 만료되지 않으며, access token 만료 시 게이트웨이가 자동으로 갱신합니다; 토큰을 잃어버리면 Google 인가를 다시 받아야 하므로 잘 보관하세요.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Command Code의 API Key를 붙여넣으세요 (user_로 시작; 공식 CLI의 ~/.commandcode/auth.json 또는 웹 studio에서 획득). 줄 전체 / 따옴표 포함 / Bearer 접두사 포함 그대로 붙여넣어도 됩니다. 게이트웨이가 알아서 순수한 key만 추출합니다. key는 만료되지 않고 갱신 인터페이스도 없으므로, 무효가 되면 다시 받으면 됩니다; 추가 시 게이트웨이가 가벼운 활성 확인을 한 번 수행하며, 실패해도 추가에는 영향을 주지 않습니다.", "粘贴 Cookie": "Cookie 붙여넣기", "粘贴 Google refresh token": "Google refresh token 붙여넣기", "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "ModelScope API 토큰(ms- 로 시작, {site} 의 \"액세스 토큰\" 페이지에서 발급)을 붙여넣으세요.
    {siteNote}
    이 토큰은 이중 용도입니다. 게이트웨이가 추론 호출에도, 계정 신원·마립(Magicube) 잔액·매일 체크인 조회에도 사용합니다. 토큰은 장기 유효하며 갱신 API 가 없습니다. 사용할 수 없게 되면 다시 발급받아 붙여넣으면 됩니다.", "粘贴 Qoder 个人访问令牌(pt-…)": "Qoder 개인 액세스 토큰(pt-…) 붙여넣기", "粘贴 access_token(一长串 JWT)": "access_token 붙여넣기 (긴 JWT)", "粘贴 session cookie": "session cookie 붙여넣기", "粘贴 token / refreshToken": "token / refreshToken 붙여넣기", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "workos:…로 시작하는 토큰 붙여넣기 (접두사가 없어도 자동으로 붙습니다)", "粘贴登录凭据": "로그인 자격 증명 붙여넣기", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "붙여넣는 것은 로그인 session입니다 (동시에 모델 게이트웨이의 token입니다). Loomy에는 갱신 인터페이스가 없으며 session 유효 기간은 약 14일이므로, 만료되면 다시 로그인하면 됩니다.", "粘贴网关凭据": "게이트웨이 자격 증명 붙여넣기", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "웹 로그인 상태 cookie monkeycode_ai_session의 값을 붙여넣으세요 (브라우저에서 전체 Cookie를 복사해 그대로 붙여넣어도 됩니다. 게이트웨이가 값을 알아서 추출합니다).
    {siteNote}
    MonkeyCode에는 갱신 인터페이스가 없습니다: session 유효 기간은 약 30일(하드 제한)이며, 만료되면 웹에 다시 로그인해 한 번 더 붙여넣으면 됩니다.", "系统浏览器": "시스템 브라우저", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "시스템 브라우저는 기존 로그인 상태를 재사용할 수 있습니다 (국제판 권장); 내장 창이 더 깔끔합니다.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Cline 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "시스템 브라우저로 엽니다(로그인된 Google 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Zai / Google 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 Meituan 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "시스템 브라우저로 엽니다 (로그인된 계정 재사용); 완료하면 자동으로 목록에 추가됩니다", "系统默认浏览器": "시스템 기본 브라우저", "编码套餐 API Key": "코딩 플랜 API Key", "网关 Secret": "게이트웨이 시크릿", "网页登录": "웹 로그인", "网页登录的打开方式": "웹 로그인을 여는 방식", "网页登录(Zai / Google)": "웹 로그인 (Zai / Google)", "自定义": "커스텀", "获取风控配置失败,将直接尝试领取:{message}": "리스크 관리 구성을 가져오지 못했습니다. 바로 수령을 시도합니다: {message}", "获取验证码": "코드 받기", "该上游无需鉴权(不发送鉴权头)": "이 업스트림은 인증이 필요하지 않음 (인증 헤더를 보내지 않음)", "该提供商": "이 제공자", "该提供商账号添加功能即将上线": "이 제공자의 계정 추가 기능이 곧 출시됩니다", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "이 커스텀 제공자가 더 이상 존재하지 않습니다(삭제되었을 수 있습니다). 새로 고친 후 다시 시도하세요", "请先选择一个自定义提供商": "먼저 커스텀 제공자를 선택하세요", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "표시된 슬라이더에서 인증을 완료하세요 (공식에서 요구하는 리스크 관리 단계)", "请填写 11 位大陆手机号": "11자리 중국 본토 휴대폰 번호를 입력하세요", "请填写 6 位数字验证码": "6자리 숫자 인증 코드를 입력하세요", "请填写 Base URL": "Base URL을 입력하세요", "请填写 {label}": "{label}을(를) 입력하세요", "请填写名称": "이름을 입력하세요", "请完成验证…": "인증을 완료하세요…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "%APPDATA%/AutoClaw/auth.json을 읽어 복호화합니다. Windows 전용", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "~/.cline/data/settings/providers.json을 읽습니다. Cline 클라이언트에 로그인되어 있어야 합니다", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "~/.meituan-catpaw/auth.json을 읽습니다. CatPaw 클라이언트에 로그인되어 있어야 합니다", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "이 컴퓨터의 KukuAI 클라이언트 로그인 상태를 읽습니다 (%APPDATA%\\baidugenflowpro\\Network\\Cookies). KukuAI 클라이언트에 로그인되어 있어야 합니다", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 읽습니다 (평문 Cookie, 복호화 불필요). 클라이언트 실행 중에는 Cookies 파일이 독점 점유되므로, 가져오기 전에 KukuAI 클라이언트를 먼저 종료하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 「Token 갱신」을 눌러 동기화하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 클라이언트에서 다시 로그인한 후 다시 가져오면 됩니다.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). Zai / Google로 클라이언트에 로그인하는 사용자는 이 항목을 사용하세요.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "이 컴퓨터 클라이언트의 현재 로그인 상태를 매번 실시간으로 읽습니다 (이 기록을 삭제해도 클라이언트 로그인 상태에는 영향을 주지 않습니다). 이 항목은 {label}로 분류됩니다.", "账号信息": "계정 정보", "账号信息不完整,请刷新后重试": "계정 정보가 불완전합니다. 새로 고친 후 다시 시도하세요", "账号已添加,但请留意:{warning}": "계정은 추가되었지만 확인해 주세요: {warning}", "账号版本": "계정 버전", "账号类型": "계정 유형", "账号:{name}
    ": "계정: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Inference Providers 라우팅을 사용하며, Key는 hf.co/settings/tokens에서 만듭니다", "还没有账号": "아직 계정이 없습니다", "这一家当前不支持网页登录,请改用填写凭证": "이 제공자는 현재 웹 로그인을 지원하지 않습니다. 대신 자격 증명 입력을 사용하세요", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "이 계정에는 현재 자동으로 수령할 수 있는 이벤트가 없습니다 (매일 로그인 보너스 포인트만 자동 수령합니다)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "이 할당량은 「이벤트 플랜」 채널을 사용합니다: 포워딩 시 코딩 플랜이 만료되었다는 안내가 나오면, ", "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "여기에는 중국 사이트(modelscope.cn) 계정을 입력합니다. 중국 사이트의 토큰을 붙여넣으세요. 인터내셔널 사이트(modelscope.ai)는 다른 provider·다른 계정이며, 양쪽 토큰은 호환되지 않습니다.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 중국 사이트(monkeycode-ai.com)의 계정을 입력합니다: 중국 사이트의 session을 붙여넣으세요. 국제 사이트(monkeycode-ai.net)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "여기에는 인터내셔널 사이트(modelscope.ai) 계정을 입력합니다. 인터내셔널 사이트의 토큰을 붙여넣으세요. 중국 사이트(modelscope.cn)는 다른 provider·다른 계정이며, 양쪽 토큰은 호환되지 않습니다.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "여기에는 국제 사이트(monkeycode-ai.net)의 계정을 입력합니다: 국제 사이트의 session을 붙여넣으세요. 중국 사이트(monkeycode-ai.com)는 다른 제공자이며 별도의 계정입니다. 양쪽 자격 증명은 호환되지 않습니다.", "选择凭证文件导入": "자격 증명 파일에서 가져오기", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "공식 클라이언트의 로그인 자격 증명 파일(workbuddy-desktop.info / workbuddy-desktop-ai.info) 또는 wb2api에서 내보낸 계정 JSON(중첩/평면 형식 모두 가능)을 선택하세요. 이 컴퓨터의 공식 클라이언트에서 직접 읽을 수도 있습니다.", "选择提供商": "제공자 선택", "选择的文件不是合法 JSON": "선택한 파일이 유효한 JSON이 아닙니다", "选择要添加账号的提供商": "계정을 추가할 제공자 선택", "重新扫描": "다시 스캔", "鉴权": "인증", "阿里云 Token Plan 套餐(国际站)": "Alibaba Cloud Token Plan (국제 사이트)", "阿里云百炼 Coding 套餐(国内站)": "Alibaba Cloud Model Studio Coding 플랜 (중국 사이트)", "阿里云百炼 Coding 套餐(国际站)": "Alibaba Cloud Model Studio Coding 플랜 (국제 사이트)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Alibaba Cloud Model Studio 모델 서비스 (국제 사이트, OpenAI 호환 모드)", "需要图形验证码:登录窗口已弹出,请填写后继续": "그래픽 캡차가 필요합니다: 로그인 창이 열렸으니 입력한 후 계속하세요", "预置 API": "프리셋 API", "领取 CodeArts 每日福利": "CodeArts 일일 혜택 수령", "领取失败:{message}": "수령 실패: {message}", "领取并让官方确认": "수령하고 공식 확인 받기", "风控验证配置不完整,请稍后重试": "리스크 관리 인증 구성이 불완전합니다. 잠시 후 다시 시도하세요", "验证码": "인증 코드", "验证码已发送。收到后填入下方并点「登录并添加」": "인증 코드를 전송했습니다. 받은 후 아래에 입력하고 「로그인 후 추가」를 클릭하세요", "验证码已发送,请查看手机短信": "인증 코드를 전송했습니다. 휴대폰 SMS를 확인하세요", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "인증 코드를 전송했습니다. 휴대폰 SMS를 확인하세요. 아래에 입력하고 「로그인 후 추가」를 클릭하면 로그인이 완료됩니다", "验证码已发送,请查看短信": "인증 코드를 전송했습니다. 문자 메시지를 확인하세요", "验证码校验失败,请重试": "인증 코드 확인에 실패했습니다. 다시 시도하세요", "验证码校验超时,请重试": "인증 코드 확인 시간이 초과되었습니다. 다시 시도하세요", "验证码组件不可用,请重试": "캡차 컴포넌트를 사용할 수 없습니다. 다시 시도하세요", "验证码组件初始化超时,请重试": "캡차 컴포넌트 초기화 시간이 초과되었습니다. 다시 시도하세요", "验证码组件加载失败,请检查网络后重试": "캡차 컴포넌트 로드에 실패했습니다. 네트워크를 확인한 후 다시 시도하세요", "验证码组件加载异常,请重试": "캡차 컴포넌트 로드 중 오류가 발생했습니다. 다시 시도하세요", "验证码组件加载超时,请检查网络后重试": "캡차 컴포넌트 로드 시간이 초과되었습니다. 네트워크를 확인한 후 다시 시도하세요", "验证码组件未加载,请重启应用后重试": "캡차 컴포넌트가 로드되지 않았습니다. 앱을 다시 시작한 후 다시 시도하세요", "(免费额度池,模型名带 cline-free/ 前缀)。": " (무료 할당량 풀, 모델 이름에 cline-free/ 접두사 포함).", "(其中 {n} 把恢复为不限制)": " (이 중 {n}개는 제한 없음으로 복원)", "(必填)": " (필수)", "(有效期 {window})": "(유효 기간 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (구독 풀, 모델 이름에 cline-pass/ 접두사 포함, 계정에 해당 구독이 있어야 합니다).", ",下一次最快 {minutes} 分钟后": ", 다음 시도는 최소 {minutes}분 후", ",并从 {n} 把 Key 的可用提供商里移除": ", Key {n}개의 사용 가능한 제공자 목록에서 이 제공자를 제거했습니다" }); diff --git a/desktop-tauri/ui/i18n/ko/checkin.js b/desktop-tauri/ui/i18n/ko/checkin.js index 61b3482f..150d4da1 100644 --- a/desktop-tauri/ui/i18n/ko/checkin.js +++ b/desktop-tauri/ui/i18n/ko/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ko/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO의 checkin_credits 수령 · 자연일 0시 기준 새로고침", "UMID 组件安装失败:{error}": "UMID 컴포넌트 설치 실패: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 중국판 · 작업 트리를 조회한 뒤 한 번에 점등/수령 · 개학 시즌 이벤트와 고양이 여행 포함 · 행을 클릭하면 상세", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 국제판 키핑 모델, 순서대로 폴백", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 국제판 일일 활동용 무료 모델 · 전역 단일 설정, 항목과 무관", "{date}(每天 {time})": "{date} (매일 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n}개 완료 가능", "{n} 项待领": "수령 대기 {n}건", "{total} 账号 · {done} 已签": "계정 {total}개 · 출석 완료 {done}개", "{total} 项任务 · {pending} 项可完成": "작업 {total}개 · 완료 가능 {pending}개", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 컴포넌트를 설치했습니다. 다음 출석부터 국제판 포인트를 수령할 수 있습니다", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 예약 출석이 켜졌습니다", "✅ 开学季任务执行完成": "✅ 개학 시즌 작업 실행 완료", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 성장 과제 완료: 크레딧 +{credit} 에너지 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 입문 혜택 수령 완료, 누적 {n} 포인트", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 출석 완료: {succeeded}/{total}개 계정 수령 성공{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 비운 채로 제출하면 기본값({defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 목록을 비우고 저장하면 기본 체인(현재 기본값: {defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「免费领积分」的每日任务 · 逐个领取": "「무료 포인트 받기」 일일 작업 · 하나씩 수령", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "일회성 혜택 · 출석 후 자동으로 조회하고 수령하며, 수령을 마치면 로컬에 기록해 업스트림을 더 조회하지 않음 · 행을 클릭해 작업 목록 펼치기", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "그날의 보상을 한 번에 일괄 수령합니다(매일 출석 + 신규 혜택) · 멱등성은 업스트림이 보장", "一键安装组件": "컴포넌트 한 번에 설치", "一键完成": "한 번에 완료", "一键领取({n})": "전체 수령({n})", "上次执行:{line}": "마지막 실행: {line}", "上次签到时间": "최근 출석 시간", "上次领取 {time} · 领取需通过滑块验证码": "최근 수령 {time} · 수령 시 슬라이더 캡차 필요", "下次 {date}": "다음 {date}", "下次 {date} · 点此管理条目": "다음 {date} · 클릭하여 항목 관리", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에 있으며, CodeArts와 ZCode의 일일/플랜 혜택 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에, CodeArts의 일일 혜택은 바로 위 \"일일 출석\"에 있습니다. ZCode의 플랜 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "与国内版同一套任务接口 · 站点不同": "중국판과 동일한 작업 인터페이스 · 사이트만 다름", "今天已领 {n} 份": "오늘 {n}건 받음", "今天未领": "오늘 미수령", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "오늘(베이징 시간 {day}) 수령 완료 · 공식 확인 반영 {n}건 · 내일 다시 수령 가능", "今日已执行": "오늘 실행됨", "今日已派出": "오늘 이미 출발", "今日已领取": "오늘 수령 완료", "今日签到": "오늘 출석", "今日签到进度": "오늘 출석 진행률", "从清单里移除": "목록에서 제거", "保活": "키핑", "保活 {n}": "키핑 {n}", "保活+领取": "키핑+수령", "保活中…": "키핑 중…", "保活模型链": "키핑 모델 체인", "全选": "전체 선택", "全部 {n} 家": "전체 {n}곳", "全部完成": "모두 완료", "全部查询": "전체 조회", "全部结果": "모든 결과", "全部账号均可签到": "모든 계정이 출석할 수 있습니다", "全部领取": "전체 수령 완료", "关着:所有条目都不执行": "꺼짐: 어떤 항목도 실행되지 않습니다", "删除失败:{error}": "삭제 실패: {error}", "删除定时条目": "예약 항목 삭제", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; CodeArts는 당일 운영 혜택을 수령합니다(수령 → 확인 → 재조회 검증, 자동 실행은 하루 6회 / 간격 10분의 쓰기 요청 제한이 적용됩니다); OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点时逐个签到,已勾 {n} / {total} 家": "정해진 시각에 하나씩 출석합니다. 선택 {n} / {total}개", "北京时间 · 错过时点开机后会自动补签": "베이징 시간 · 시간을 놓쳐도 시작 후 자동으로 보완됩니다", "去领取": "수령하러 가기", "另有 {n} 个账号不参与每日签到": "그 외 {n}개 계정은 매일 출석 체크에 참여하지 않습니다", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "완료된 작업의 보상만 수령(멱등, 반복 클릭해도 중복 적립되지 않음)", "可完成": "완료 가능", "可派出": "출발 가능", "可选 · 缺省显示时刻": "선택 · 기본값은 시간 표시", "可领奖": "수령 가능", "后端未返回定时签到数据": "백엔드가 예약 데이터를 반환하지 않았습니다", "后端未返回签到中心数据": "백엔드가 출석 체크 센터 데이터를 반환하지 않았습니다", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "국제판 출석에는 기기 리스크 관리 신원을 생성할 UMID 컴포넌트가 필요합니다 (이 기기에서 감지되지 않음).", "在途": "여행 중", "填入缺省链": "기본 체인 채우기", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "시각과 출석 범위를 정한 뒤 「저장」을 누르세요. 이름은 비워도 됩니다(비우면 시각이 표시됩니다)", "失败 {n}": "실패 {n}", "套餐明细": "플랜 상세", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder 클라이언트 또는 qodercli를 설치하면 됩니다 (게이트웨이 재시작 불필요).", "安装中…": "설치 중…", "官方客户端的每日签到任务": "공식 클라이언트의 매일 출석 작업", "定时签到": "예약 출석", "定时签到已关闭": "예약 출석이 꺼졌습니다", "尚未查询": "아직 조회하지 않음", "尚未查询任务状态": "작업 상태를 아직 조회하지 않았습니다", "巡检一次": "한 번 점검", "已保存:{label}": "저장됨: {label}", "已保存:保活模型链": "저장됨: 키핑 모델 체인", "已保存:定时条目": "저장됨: 예약 항목", "已删除定时条目": "예약 항목이 삭제되었습니다", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "활동 보고 완료(연속 출석 점등), but 캠페인이 진행 중이 아닙니다(이번에 받을 보상 없음)", "已抽 {n} 次": "{n}회 추첨함", "已有结果 {checked} / 共 {total} 个账号": "결과 있음 {checked} / 전체 {total}개 계정", "已签": "출석 완료", "已领 {claimed}/{total} · 累计 {earned} 积分": "수령 {claimed}/{total} · 누적 {earned} 포인트", "已领养": "입양 완료", "已领取": "수령 완료", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "기기 리스크 관리 신원을 갖춰 「매일 100 Credits」 수령 · UMID 컴포넌트 필요", "开学季执行失败:{error}": "개학 시즌 실행 실패: {error}", "开学季执行完成:{message}": "개학 시즌 실행 완료: {message}", "开学季活动": "개학 시즌 이벤트", "开着:启用的条目按各自时刻执行": "켜짐: 활성화된 항목이 각자의 시간에 실행됩니다", "待签": "출석 대기", "待领新手福利": "수령 대기 입문 혜택", "总开关": "메인 스위치", "总开关已关闭 · 在「定时签到」页打开": "메인 스위치가 꺼져 있습니다 · \"예약 출석\" 탭에서 켜세요", "成功 {n}": "성공 {n}", "成长任务": "성장 과제", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "성장 과제 완료(성공 {done}개, 실패 {failed}개): 크레딧 +{credit} 에너지 +{energy}", "成长任务执行失败:{error}": "성장 과제 실행 실패: {error}", "执行失败:{error}": "실행 실패: {error}", "执行并抽奖": "실행 및 추첨", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "개학 시즌 작업을 실행하고 추첨 기회를 모두 사용(공유/대화/전문가 이벤트)", "把缺省链填进清单,再点「保存」生效": "기본 체인을 목록에 채웁니다. 「저장」을 눌러야 반영됩니다", "抽奖机会 {n} 次": "추첨 기회 {n}회", "按住拖动调整顺序": "길게 눌러 드래그해 순서 변경", "按住拖动,调整这个模型在链里的顺序": "길게 눌러 드래그해 체인에서 이 모델의 순서를 조정합니다", "按序逐个尝试,共 {n} 个": "순서대로 시도, 총 {n}개", "按结果筛选": "결과로 필터", "探测 + 领取 + 保活 · 与定时签到同一套组合": "탐지 + 수령 + 키핑 · 예약 출석과 동일한 조합", "探测活动并领取日活奖励 · 不做保活": "이벤트를 탐지해 일일 활성 보상을 수령 · 키핑은 하지 않음", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "수락 + 점등 + 수령(실측으로 검증된 작업만 처리)", "搜账号 / 收益 / 错误 / 触发原因": "계정 / 수익 / 오류 / 트리거 사유 검색", "收起新建": "새 항목 닫기", "新建定时条目": "새 예약 항목", "新手福利": "입문 혜택", "新手福利有 {n} 项领取失败,可重试": "입문 혜택 {n}건의 수령에 실패했습니다. 재시도할 수 있습니다", "无": "없음", "无独立签到接口 · 每天替账号打一次首次登录积分": "독립 출석 인터페이스 없음 · 매일 계정당 최초 로그인 포인트를 한 번 적립", "无账号": "계정 없음", "暂不可领": "지금은 수령 불가", "暂不支持": "아직 미지원", "暂无启用的条目 · 点此添加": "활성화된 항목이 없습니다 · 클릭하여 추가", "有未保存的改动": "저장되지 않은 변경 사항이 있습니다", "未勾选提供商": "공급자 미선택", "未开启": "꺼짐", "未解锁": "잠김", "未领养(领养需先完成当日对话量)": "미입양(입양하려면 먼저 당일 대화량을 채워야 함)", "未领取": "미수령", "本地台账里今天还没领过;活动期内每天发一份新套餐": "로컬 기록상 오늘은 아직 받지 않았습니다. 이벤트 기간에는 매일 새 플랜이 한 건씩 지급됩니다", "本地台账里今天(北京时间)领过的套餐:{plans}": "로컬 기록상 오늘(베이징 시간) 받은 플랜: {plans}", "条启用": "개 활성화", "查询于 {time}": "조회 시각 {time}", "查询任务": "작업 조회", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "작업 트리를 조회하고 한 번에 점등/수령(개학 시즌과 고양이 여행 포함)", "查询失败:{error}": "조회 실패: {error}", "桌面端每日积分链路": "데스크톱 앱 일일 포인트 경로", "正在读取定时签到数据…": "예약 출석 데이터를 읽는 중…", "正在读取签到数据…": "출석 데이터를 읽는 중…", "每天 {time}": "매일 {time}", "每天 {time} · {scope}": "매일 {time} · {scope}", "每天时刻": "매일 시각", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "출석 실행마다 · 계정별 한 행 · 결과와 수익은 백엔드 기록 기준", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "매일 활성 작업 · 웹 채널 세션으로 일일 활성 달성, 포인트는 수령 시 적립 · 두 가지는 따로 실행 가능", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "일일 혜택 · 수령 → 확인 → 재조회 검증 · 베이징 시간 자연일 기준 초기화", "每日签到": "매일 출석 체크", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "항목별 시간과 범위 · 항목별 당일 중복 제거 · 시작 시 자동 보완", "每账号一条明细 · 点此查看「签到记录」": "계정별 한 행 · \"출석 기록\" 열기", "没有可领套餐的账号(ZCode 未添加)。": "수령할 플랜이 있는 계정이 없습니다 (ZCode 미추가).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "혜택을 수령할 수 있는 계정이 없습니다 (CodeArts / ZCode 미추가).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "성장 과제를 지원하는 계정이 없습니다(WorkBuddy 중국판 필요).", "没有支持新手福利的账号": "입문 혜택을 지원하는 계정이 없습니다", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "입문 혜택을 지원하는 계정이 없습니다 — 현재 Loomy, 小浣熊, CodeArts 세 곳입니다.", "没有符合筛选条件的签到记录": "필터 조건에 맞는 출석 기록이 없습니다", "没有需要执行的任务": "실행할 작업이 없습니다", "活动福利": "이벤트 혜택", "活动(campaign)领取 · 每天 10:00 刷新": "캠페인(campaign) 수령 · 매일 10:00 새로고침", "活跃上报与保活均未成功,且活动未开启": "활동 보고와 keep-alive 모두 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但保活未成功且活动未开启": "활동 보고는 완료되었지만 keep-alive에 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但活动未开启": "활동 보고 완료, but 캠페인이 진행 중이 아닙니다", "活跃上报成功": "활동 보고 성공", "活跃保活失败": "활성 키핑 실패", "活跃保活完成": "활성 키핑 완료", "活跃保活完成,但活动未开启": "활성 키핑 완료, 다만 이벤트는 열리지 않았습니다", "活跃保活完成,但活跃上报失败且活动未开启": "keep-alive는 완료되었지만 활동 보고에 실패했고 캠페인도 진행 중이 아닙니다", "添加条目": "항목 추가", "添加模型": "모델 추가", "清单为空 —— 保存后恢复缺省链": "목록이 비어 있습니다 — 저장하면 기본 체인으로 복원됩니다", "清单里已经有「{name}」": "목록에 \"{name}\"이(가) 이미 있습니다", "清空失败:{error}": "비우기 실패: {error}", "清空签到记录": "출석 기록 비우기", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "\"플랜 상세\"에서 어떤 플랜을 받았고 언제 적용되는지 확인하세요. 이벤트 기간에는 매일 다시 받을 수 있습니다", "点击行展开账号明细 · 单账号签到不受范围限制": "행을 클릭해 계정 상세 펼치기 · 개별 계정 출석은 범위 제한을 받지 않습니다", "独立链路 · 只提供手动入口 · 不进自动签到": "독립 경로 · 수동 진입점만 제공 · 자동 출석에는 포함되지 않음", "猫猫旅行": "고양이 여행", "猫猫旅行失败:{error}": "고양이 여행 실패: {error}", "猫猫旅行失败:{message}": "고양이 여행 실패: {message}", "猫猫旅行:{message}": "고양이 여행: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "무료 모델과 웹 채널 세션으로 계정 활성 유지 · 보상은 수령하지 않음", "确定删除「{name}」?删除后到点不再执行。": "\"{name}\"을(를) 삭제할까요? 삭제 후 예약 시간에 실행되지 않습니다.", "确定清空全部签到记录?清空后无法恢复。": "모든 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "현재 필터된 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "移除 {name}": "{name} 제거", "立即全部签到": "지금 전체 출석", "签到": "출석", "签到中…": "출석 중…", "签到中心分区": "출석 센터 구역", "签到失败:{error}": "출석 실패: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "출석 완료: {succeeded}/{total} 성공{active}, {failed}개 실패", "签到成功": "출석 성공", "签到提供商": "출석 제공자", "签到范围": "출석 범위", "签到触发时刻": "출석 실행 시각", "签到记录": "출석 기록", "签到记录时间范围": "출석 기록 시간 범위", "签到记录表": "출석 기록 표", "累计签到记录": "누적 출석 기록", "结算于 {time}": "결산 시각 {time}", "能量 {n}": "에너지 {n}", "腾讯每日签到接口 · 仅国内版": "텐센트 매일 출석 인터페이스 · 중국판 전용", "至少勾一家才能保存(不勾等于这条条目不签到)": "저장하려면 최소 한 곳을 선택하세요(선택하지 않으면 이 항목은 아무것도 출석하지 않습니다)", "读取定时签到数据失败:{error}": "예약 출석 데이터 로드 실패: {error}", "读取签到数据失败:{error}": "출석 데이터 읽기 실패: {error}", "读取签到记录失败:{error}": "출석 기록 로드 실패: {error}", "跳过 {n}": "건너뜀 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "운영 이벤트 전달 (수령 → 확인 → 재조회 검증) · 플랜 증정 포인트를 수령합니다", "还没执行过": "아직 실행된 적 없음", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "예약 항목이 아직 없습니다 — \"항목 추가\"로 만들거나 \"출석 센터\"에서 수동으로 출석하세요.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "출석 기록이 아직 없습니다 — 수동 출석 또는 예약 실행 후 여기에 상세 내역이 표시됩니다.", "连登 {n} 天": "연속 로그인 {n}일", "部分": "일부", "重签": "재출석", "重试": "다시 시도", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "기간 한정 체험 플랜 · 수령 시 슬라이더 인증 필요 · 항목별로 확인하고 수령", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "기간 한정 체험 플랜(start-plan), 이벤트 기간 내 매일 1회 · 수령 시 슬라이더 캡차 필요", "需真实操作": "실제 조작 필요", "非活动期": "이벤트 기간 아님", "项": "건", "领取": "수령", "领取中": "수령 중", "领取中…": "수령 중…", "领取失败": "수령 실패", "领取失败:{error}": "수령 실패: {error}", "(共 {n} 个账号)": "(전체 {n}개 계정)", "(能量 / 连登读数本次未取到)": "(에너지/연속 로그인 수치는 이번에 가져오지 못했습니다)", ",日活保活 {n} 个": ", 일일 활성 키핑 {n}개" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO의 checkin_credits 수령 · 자연일 0시 기준 새로고침", "UMID 组件安装失败:{error}": "UMID 컴포넌트 설치 실패: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 중국판 · 작업 트리를 조회한 뒤 한 번에 점등/수령 · 개학 시즌 이벤트와 고양이 여행 포함 · 행을 클릭하면 상세", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 국제판 키핑 모델, 순서대로 폴백", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 국제판 일일 활동용 무료 모델 · 전역 단일 설정, 항목과 무관", "{date}(每天 {time})": "{date} (매일 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n}개 완료 가능", "{n} 项待领": "수령 대기 {n}건", "{total} 账号 · {done} 已签": "계정 {total}개 · 출석 완료 {done}개", "{total} 项任务 · {pending} 项可完成": "작업 {total}개 · 완료 가능 {pending}개", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 컴포넌트를 설치했습니다. 다음 출석부터 국제판 포인트를 수령할 수 있습니다", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 예약 출석이 켜졌습니다", "✅ 开学季任务执行完成": "✅ 개학 시즌 작업 실행 완료", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 성장 과제 완료: 크레딧 +{credit} 에너지 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 입문 혜택 수령 완료, 누적 {n} 포인트", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 출석 완료: {succeeded}/{total}개 계정 수령 성공{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 비운 채로 제출하면 기본값({defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 목록을 비우고 저장하면 기본 체인(현재 기본값: {defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「免费领积分」的每日任务 · 逐个领取": "「무료 포인트 받기」 일일 작업 · 하나씩 수령", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "일회성 혜택 · 출석 후 자동으로 조회하고 수령하며, 수령을 마치면 로컬에 기록해 업스트림을 더 조회하지 않음 · 행을 클릭해 작업 목록 펼치기", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "그날의 보상을 한 번에 일괄 수령합니다(매일 출석 + 신규 혜택) · 멱등성은 업스트림이 보장", "一键安装组件": "컴포넌트 한 번에 설치", "一键完成": "한 번에 완료", "一键领取({n})": "전체 수령({n})", "上次执行:{line}": "마지막 실행: {line}", "上次签到时间": "최근 출석 시간", "上次领取 {time} · 领取需通过滑块验证码": "최근 수령 {time} · 수령 시 슬라이더 캡차 필요", "下次 {date}": "다음 {date}", "下次 {date} · 点此管理条目": "다음 {date} · 클릭하여 항목 관리", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에 있으며, CodeArts와 ZCode의 일일/플랜 혜택 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에, CodeArts의 일일 혜택은 바로 위 \"일일 출석\"에 있습니다. ZCode의 플랜 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "与国内版同一套任务接口 · 站点不同": "중국판과 동일한 작업 인터페이스 · 사이트만 다름", "与国内版同一套链路 · 站点不同、令牌不通用": "중국판과 동일한 흐름 · 사이트가 다르고 토큰은 호환되지 않음", "今天已领 {n} 份": "오늘 {n}건 받음", "今天未领": "오늘 미수령", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "오늘(베이징 시간 {day}) 수령 완료 · 공식 확인 반영 {n}건 · 내일 다시 수령 가능", "今日已执行": "오늘 실행됨", "今日已派出": "오늘 이미 출발", "今日已领取": "오늘 수령 완료", "今日签到": "오늘 출석", "今日签到进度": "오늘 출석 진행률", "从清单里移除": "목록에서 제거", "保活": "키핑", "保活 {n}": "키핑 {n}", "保活+领取": "키핑+수령", "保活中…": "키핑 중…", "保活模型链": "키핑 모델 체인", "全选": "전체 선택", "全部 {n} 家": "전체 {n}곳", "全部完成": "모두 완료", "全部查询": "전체 조회", "全部结果": "모든 결과", "全部账号均可签到": "모든 계정이 출석할 수 있습니다", "全部领取": "전체 수령 완료", "关着:所有条目都不执行": "꺼짐: 어떤 항목도 실행되지 않습니다", "删除失败:{error}": "삭제 실패: {error}", "删除定时条目": "예약 항목 삭제", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; CodeArts는 당일 운영 혜택을 수령합니다(수령 → 확인 → 재조회 검증, 자동 실행은 하루 6회 / 간격 10분의 쓰기 요청 제한이 적용됩니다); OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点时逐个签到,已勾 {n} / {total} 家": "정해진 시각에 하나씩 출석합니다. 선택 {n} / {total}개", "北京时间 · 错过时点开机后会自动补签": "베이징 시간 · 시간을 놓쳐도 시작 후 자동으로 보완됩니다", "去领取": "수령하러 가기", "另有 {n} 个账号不参与每日签到": "그 외 {n}개 계정은 매일 출석 체크에 참여하지 않습니다", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "완료된 작업의 보상만 수령(멱등, 반복 클릭해도 중복 적립되지 않음)", "可完成": "완료 가능", "可派出": "출발 가능", "可选 · 缺省显示时刻": "선택 · 기본값은 시간 표시", "可领奖": "수령 가능", "后端未返回定时签到数据": "백엔드가 예약 데이터를 반환하지 않았습니다", "后端未返回签到中心数据": "백엔드가 출석 체크 센터 데이터를 반환하지 않았습니다", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "국제판 출석에는 기기 리스크 관리 신원을 생성할 UMID 컴포넌트가 필요합니다 (이 기기에서 감지되지 않음).", "在途": "여행 중", "填入缺省链": "기본 체인 채우기", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "시각과 출석 범위를 정한 뒤 「저장」을 누르세요. 이름은 비워도 됩니다(비우면 시각이 표시됩니다)", "失败 {n}": "실패 {n}", "套餐明细": "플랜 상세", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder 클라이언트 또는 qodercli를 설치하면 됩니다 (게이트웨이 재시작 불필요).", "安装中…": "설치 중…", "官方客户端的每日签到任务": "공식 클라이언트의 매일 출석 작업", "定时签到": "예약 출석", "定时签到已关闭": "예약 출석이 꺼졌습니다", "尚未查询": "아직 조회하지 않음", "尚未查询任务状态": "작업 상태를 아직 조회하지 않았습니다", "巡检一次": "한 번 점검", "已保存:{label}": "저장됨: {label}", "已保存:保活模型链": "저장됨: 키핑 모델 체인", "已保存:定时条目": "저장됨: 예약 항목", "已删除定时条目": "예약 항목이 삭제되었습니다", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "활동 보고 완료(연속 출석 점등), but 캠페인이 진행 중이 아닙니다(이번에 받을 보상 없음)", "已抽 {n} 次": "{n}회 추첨함", "已有结果 {checked} / 共 {total} 个账号": "결과 있음 {checked} / 전체 {total}개 계정", "已签": "출석 완료", "已领 {claimed}/{total} · 累计 {earned} 积分": "수령 {claimed}/{total} · 누적 {earned} 포인트", "已领养": "입양 완료", "已领取": "수령 완료", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "기기 리스크 관리 신원을 갖춰 「매일 100 Credits」 수령 · UMID 컴포넌트 필요", "开学季执行失败:{error}": "개학 시즌 실행 실패: {error}", "开学季执行完成:{message}": "개학 시즌 실행 완료: {message}", "开学季活动": "개학 시즌 이벤트", "开着:启用的条目按各自时刻执行": "켜짐: 활성화된 항목이 각자의 시간에 실행됩니다", "待签": "출석 대기", "待领新手福利": "수령 대기 입문 혜택", "总开关": "메인 스위치", "总开关已关闭 · 在「定时签到」页打开": "메인 스위치가 꺼져 있습니다 · \"예약 출석\" 탭에서 켜세요", "成功 {n}": "성공 {n}", "成长任务": "성장 과제", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "성장 과제 완료(성공 {done}개, 실패 {failed}개): 크레딧 +{credit} 에너지 +{energy}", "成长任务执行失败:{error}": "성장 과제 실행 실패: {error}", "执行失败:{error}": "실행 실패: {error}", "执行并抽奖": "실행 및 추첨", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "개학 시즌 작업을 실행하고 추첨 기회를 모두 사용(공유/대화/전문가 이벤트)", "把缺省链填进清单,再点「保存」生效": "기본 체인을 목록에 채웁니다. 「저장」을 눌러야 반영됩니다", "抽奖机会 {n} 次": "추첨 기회 {n}회", "按住拖动调整顺序": "길게 눌러 드래그해 순서 변경", "按住拖动,调整这个模型在链里的顺序": "길게 눌러 드래그해 체인에서 이 모델의 순서를 조정합니다", "按序逐个尝试,共 {n} 个": "순서대로 시도, 총 {n}개", "按结果筛选": "결과로 필터", "探测 + 领取 + 保活 · 与定时签到同一套组合": "탐지 + 수령 + 키핑 · 예약 출석과 동일한 조합", "探测活动并领取日活奖励 · 不做保活": "이벤트를 탐지해 일일 활성 보상을 수령 · 키핑은 하지 않음", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "수락 + 점등 + 수령(실측으로 검증된 작업만 처리)", "搜账号 / 收益 / 错误 / 触发原因": "계정 / 수익 / 오류 / 트리거 사유 검색", "收起新建": "새 항목 닫기", "新建定时条目": "새 예약 항목", "新手福利": "입문 혜택", "新手福利有 {n} 项领取失败,可重试": "입문 혜택 {n}건의 수령에 실패했습니다. 재시도할 수 있습니다", "无": "없음", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "전용 체크인 API 없음 · 하루에 한 번 계정 대신 로그인 정보 엔드포인트를 호출(그것이 당일 마립)", "无独立签到接口 · 每天替账号打一次首次登录积分": "독립 출석 인터페이스 없음 · 매일 계정당 최초 로그인 포인트를 한 번 적립", "无账号": "계정 없음", "暂不可领": "지금은 수령 불가", "暂不支持": "아직 미지원", "暂无启用的条目 · 点此添加": "활성화된 항목이 없습니다 · 클릭하여 추가", "有未保存的改动": "저장되지 않은 변경 사항이 있습니다", "未勾选提供商": "공급자 미선택", "未开启": "꺼짐", "未解锁": "잠김", "未领养(领养需先完成当日对话量)": "미입양(입양하려면 먼저 당일 대화량을 채워야 함)", "未领取": "미수령", "本地台账里今天还没领过;活动期内每天发一份新套餐": "로컬 기록상 오늘은 아직 받지 않았습니다. 이벤트 기간에는 매일 새 플랜이 한 건씩 지급됩니다", "本地台账里今天(北京时间)领过的套餐:{plans}": "로컬 기록상 오늘(베이징 시간) 받은 플랜: {plans}", "条启用": "개 활성화", "查询于 {time}": "조회 시각 {time}", "查询任务": "작업 조회", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "작업 트리를 조회하고 한 번에 점등/수령(개학 시즌과 고양이 여행 포함)", "查询失败:{error}": "조회 실패: {error}", "桌面端每日积分链路": "데스크톱 앱 일일 포인트 경로", "正在读取定时签到数据…": "예약 출석 데이터를 읽는 중…", "正在读取签到数据…": "출석 데이터를 읽는 중…", "每天 {time}": "매일 {time}", "每天 {time} · {scope}": "매일 {time} · {scope}", "每天时刻": "매일 시각", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "출석 실행마다 · 계정별 한 행 · 결과와 수익은 백엔드 기록 기준", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "매일 활성 작업 · 웹 채널 세션으로 일일 활성 달성, 포인트는 수령 시 적립 · 두 가지는 따로 실행 가능", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "일일 혜택 · 수령 → 확인 → 재조회 검증 · 베이징 시간 자연일 기준 초기화", "每日签到": "매일 출석 체크", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "항목별 시간과 범위 · 항목별 당일 중복 제거 · 시작 시 자동 보완", "每账号一条明细 · 点此查看「签到记录」": "계정별 한 행 · \"출석 기록\" 열기", "没有可领套餐的账号(ZCode 未添加)。": "수령할 플랜이 있는 계정이 없습니다 (ZCode 미추가).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "혜택을 수령할 수 있는 계정이 없습니다 (CodeArts / ZCode 미추가).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "성장 과제를 지원하는 계정이 없습니다(WorkBuddy 중국판 필요).", "没有支持新手福利的账号": "입문 혜택을 지원하는 계정이 없습니다", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "입문 혜택을 지원하는 계정이 없습니다 — 현재 Loomy, 小浣熊, CodeArts 세 곳입니다.", "没有符合筛选条件的签到记录": "필터 조건에 맞는 출석 기록이 없습니다", "没有需要执行的任务": "실행할 작업이 없습니다", "活动福利": "이벤트 혜택", "活动(campaign)领取 · 每天 10:00 刷新": "캠페인(campaign) 수령 · 매일 10:00 새로고침", "活跃上报与保活均未成功,且活动未开启": "활동 보고와 keep-alive 모두 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但保活未成功且活动未开启": "활동 보고는 완료되었지만 keep-alive에 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但活动未开启": "활동 보고 완료, but 캠페인이 진행 중이 아닙니다", "活跃上报成功": "활동 보고 성공", "活跃保活失败": "활성 키핑 실패", "活跃保活完成": "활성 키핑 완료", "活跃保活完成,但活动未开启": "활성 키핑 완료, 다만 이벤트는 열리지 않았습니다", "活跃保活完成,但活跃上报失败且活动未开启": "keep-alive는 완료되었지만 활동 보고에 실패했고 캠페인도 진행 중이 아닙니다", "添加条目": "항목 추가", "添加模型": "모델 추가", "清单为空 —— 保存后恢复缺省链": "목록이 비어 있습니다 — 저장하면 기본 체인으로 복원됩니다", "清单里已经有「{name}」": "목록에 \"{name}\"이(가) 이미 있습니다", "清空失败:{error}": "비우기 실패: {error}", "清空签到记录": "출석 기록 비우기", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "\"플랜 상세\"에서 어떤 플랜을 받았고 언제 적용되는지 확인하세요. 이벤트 기간에는 매일 다시 받을 수 있습니다", "点击行展开账号明细 · 单账号签到不受范围限制": "행을 클릭해 계정 상세 펼치기 · 개별 계정 출석은 범위 제한을 받지 않습니다", "独立链路 · 只提供手动入口 · 不进自动签到": "독립 경로 · 수동 진입점만 제공 · 자동 출석에는 포함되지 않음", "猫猫旅行": "고양이 여행", "猫猫旅行失败:{error}": "고양이 여행 실패: {error}", "猫猫旅行失败:{message}": "고양이 여행 실패: {message}", "猫猫旅行:{message}": "고양이 여행: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "무료 모델과 웹 채널 세션으로 계정 활성 유지 · 보상은 수령하지 않음", "确定删除「{name}」?删除后到点不再执行。": "\"{name}\"을(를) 삭제할까요? 삭제 후 예약 시간에 실행되지 않습니다.", "确定清空全部签到记录?清空后无法恢复。": "모든 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "현재 필터된 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "移除 {name}": "{name} 제거", "立即全部签到": "지금 전체 출석", "签到": "출석", "签到中…": "출석 중…", "签到中心分区": "출석 센터 구역", "签到失败:{error}": "출석 실패: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "출석 완료: {succeeded}/{total} 성공{active}, {failed}개 실패", "签到成功": "출석 성공", "签到提供商": "출석 제공자", "签到范围": "출석 범위", "签到触发时刻": "출석 실행 시각", "签到记录": "출석 기록", "签到记录时间范围": "출석 기록 시간 범위", "签到记录表": "출석 기록 표", "累计签到记录": "누적 출석 기록", "结算于 {time}": "결산 시각 {time}", "能量 {n}": "에너지 {n}", "腾讯每日签到接口 · 仅国内版": "텐센트 매일 출석 인터페이스 · 중국판 전용", "至少勾一家才能保存(不勾等于这条条目不签到)": "저장하려면 최소 한 곳을 선택하세요(선택하지 않으면 이 항목은 아무것도 출석하지 않습니다)", "读取定时签到数据失败:{error}": "예약 출석 데이터 로드 실패: {error}", "读取签到数据失败:{error}": "출석 데이터 읽기 실패: {error}", "读取签到记录失败:{error}": "출석 기록 로드 실패: {error}", "跳过 {n}": "건너뜀 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "운영 이벤트 전달 (수령 → 확인 → 재조회 검증) · 플랜 증정 포인트를 수령합니다", "还没执行过": "아직 실행된 적 없음", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "예약 항목이 아직 없습니다 — \"항목 추가\"로 만들거나 \"출석 센터\"에서 수동으로 출석하세요.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "출석 기록이 아직 없습니다 — 수동 출석 또는 예약 실행 후 여기에 상세 내역이 표시됩니다.", "连登 {n} 天": "연속 로그인 {n}일", "部分": "일부", "重签": "재출석", "重试": "다시 시도", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "기간 한정 체험 플랜 · 수령 시 슬라이더 인증 필요 · 항목별로 확인하고 수령", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "기간 한정 체험 플랜(start-plan), 이벤트 기간 내 매일 1회 · 수령 시 슬라이더 캡차 필요", "需真实操作": "실제 조작 필요", "非活动期": "이벤트 기간 아님", "项": "건", "领取": "수령", "领取中": "수령 중", "领取中…": "수령 중…", "领取失败": "수령 실패", "领取失败:{error}": "수령 실패: {error}", "(共 {n} 个账号)": "(전체 {n}개 계정)", "(能量 / 连登读数本次未取到)": "(에너지/연속 로그인 수치는 이번에 가져오지 못했습니다)", ",日活保活 {n} 个": ", 일일 활성 키핑 {n}개" }); diff --git a/desktop-tauri/ui/i18n/pt-BR/add-account.js b/desktop-tauri/ui/i18n/pt-BR/add-account.js index 364a0211..f91408e2 100644 --- a/desktop-tauri/ui/i18n/pt-BR/add-account.js +++ b/desktop-tauri/ui/i18n/pt-BR/add-account.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:pt-BR/add-account —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · Modelos: {head}{rest}", " 等 {n} 个": " ({n} no total)", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "Google refresh token começando com 1// (também pode colar a linha refresh_token=… inteira)", "11 位大陆手机号": "Celular da China continental (11 dígitos)", "1~64 个字符,账号列表里按它分组显示": "1 a 64 caracteres; na lista de contas, as contas são agrupadas por ele", "6 位数字": "6 dígitos", "

  • 没有可自动领的活动
  • ": "
  • Nenhuma campanha pode ser resgatada automaticamente
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    O que você recebe são pontos de brinde do plano, que não aumentam o pool de tokens dos modelos de benefício; ", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "O endpoint compatível com Anthropic é https://api.deepseek.com/anthropic (preencha-o ao trocar o protocolo para anthropic)", "Anthropic 协议填根地址,不要带 /v1": "No protocolo Anthropic, preencha o endereço raiz, sem /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw edição da China", "AutoClaw 国际版": "AutoClaw edição internacional", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS é obrigatório; cole o **Cookie completo** (um editor de Cookie exporta com um clique) — o **PTOKEN deve ser mantido**, pois o gateway o usa para trocar com o Baidu por um token de sessão de negócio do KukuAI; sem ele, a atualização de modelos reporta \"não conectado\". São aceitos o cabeçalho Cookie inteiro, um array JSON exportado por um editor de Cookie, ou um objeto {BDUSS, STOKEN}. O KukuAI não tem mecanismo de atualização; quando a sessão de login expirar, basta colar de novo.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (ou o JSON exportado por um editor de Cookie)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "X-Passport-Token do CatPaw (Cookie da sessão de login)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (três segmentos separados por ponto)", "Command Code": "Command Code", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode edição internacional", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "Endpoint gerenciado do NVIDIA NIM; solicite a Key em integrate.api.nvidia.com", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken é a credencial de login do Accio (um token opaco bem longo, não é JWT); refreshToken é opcional e, se preenchido, permite renovação automática ao expirar. Preencha a credencial da conta {label} — {siteNote} (a forma mais fácil de obter: use o \"Login web\" acima; não é preciso procurar o token manualmente.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken é o Cloud-IDE-JWT do Trae (três segmentos separados por ponto) e o refreshToken serve para renovação automática ao expirar (este provedor troca o refreshToken a cada uso: assim que é trocado, o antigo é invalidado, então não atualize a mesma conta em dois programas ao mesmo tempo).
    Ao colar manualmente, preencha também machineId / deviceId: o upstream os vincula à chave pública do dispositivo enviada no login para identificar o dispositivo, e inventar um novo par dispara a família de rejeições de vínculo de dispositivo 2xxxx.
    Sem esses três itens, o caminho correto é o \"Login web\" acima; em contêiner / implantação remota, basta colar o endereço de callback da barra de endereços conforme as instruções.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "O valor de monkeycode_ai_session (também pode colar o Cookie inteiro)", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken é opcional e, se preenchido, permite renovação automática ao expirar; ambos podem ser obtidos do arquivo de sessão de login do cliente Raccoon.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken é opcional e, se preenchido, permite renovação automática; ambos podem ser obtidos do arquivo de sessão de login do cliente. A mesma conta Cline funciona nos dois pools; aqui ela entra em {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "O token aceita o prefixo enc: (descriptografado automaticamente no Windows). Sem preencher o refreshToken, não é possível renovar automaticamente.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "O token é o Cookie da sessão de login; o CatPaw não tem mecanismo de atualização, então faça login novamente no cliente após expirar.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "API Key começando com user_ (também pode colar a linha Authorization: Bearer … inteira)", "{label} 网页登录的打开方式": "Como abrir o login web de {label}", "{label} 账号地区": "Região da conta {label}", "{label} 账号的添加方式": "Como adicionar uma conta {label}", "{name} 不是合法 JSON:{reason}": "{name} não é um JSON válido: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}: cole um objeto JSON (no formato {sample})", "{n} 个账号": "{n} contas", "{n} 个账号,点击添加": "{n} contas, clique para adicionar", "{seconds}s 后重发": "Reenviar em {seconds}s", "✅ {label}账号已添加": "✅ Conta {label} adicionada", "✅ {label}账号已添加{name}": "✅ Conta {label} adicionada{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ {n} provedores importados do cc-switch", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ Provedor personalizado \"{name}\" criado e conta adicionada", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ Provedor personalizado \"{name}\" excluído{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ Login concluído; conta {edition} adicionada à lista", "✅ 领取成功:{planId}{period}": "✅ Resgate concluído: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " Um mesmo provedor pode ter várias keys, rotacionadas por prioridade.", "「{name}」的账号添加功能还在开发中,敬请期待。": "A adição de contas para \"{name}\" ainda está em desenvolvimento; aguarde novidades.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "Uma única Key serve para vários fornecedores; use o nome completo \"fornecedor/modelo\" (ex.: deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "Deixe em branco quando o upstream não exigir autenticação e marque a opção abaixo (em branco e sem marcar é tratado como credencial não configurada)", "上游信息": "Informações do upstream", "不可领({status})": "Não resgatável ({status})", "不支持导入": "Importação não suportada", "不是有效的凭证文件:内容要是一个 JSON 对象": "Não é um arquivo de credenciais válido: o conteúdo deve ser um objeto JSON", "不是有效的凭证文件:需要包含 accessToken 与 uid": "Não é um arquivo de credenciais válido: accessToken e uid são obrigatórios", "不是自定义提供商": "Não é um provedor personalizado", "不需要 Key:转发与拉取模型都不发送鉴权头": "Não precisa de Key: nem o encaminhamento nem a busca de modelos enviam cabeçalhos de autenticação", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "As contas das duas edições podem ser salvas ao mesmo tempo, cada uma com sua própria lista de modelos (as edições da China e internacional são dois provedores, que podem ser ativados e mapeados separadamente).", "中国版": "Edição da China", "今天没有需要领的活动(都已到账)": "Hoje não há campanhas para resgatar (todas já creditadas)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "Hoje (horário de Pequim, {day}) você já tentou {attempts} vezes; restam {left} tentativas{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "Pegue três itens de outra máquina (ou do models.json do aplicativo de desktop do OfficeAce) e cole aqui: o endereço base do gateway de modelos (baseUrl, no formato https://modelgw-…/v2) e modelAppKey / modelAppSecret. Esses três já bastam para encaminhar requisições (a credencial do gateway não expira); as credenciais temporárias do plano de controle (accessKeyId etc.) são opcionais — se ficarem em branco, a consulta de saldo e a renovação automática ficam indisponíveis, mas o encaminhamento não é afetado.", "从本机导入桌面端登录态": "Importar sessão de login do desktop desta máquina", "任务镜像 id": "id da imagem da tarefa", "使用 Google 账号登录": "Entrar com conta Google", "使用 Zai 账号登录": "Entrar com conta Zai", "使用个人访问令牌(PAT)": "Usar token de acesso pessoal (PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "Modelos gratuitos não precisam de Key (a opção \"Este upstream não exige autenticação\" já vem marcada e o gateway usa credenciais anônimas automaticamente); para modelos pagos, preencha a API Key do Zen. O nível gratuito do upstream só aceita o formato do cliente oficial, e a opção \"Simular o cliente oficial do OpenCode\" já vem ativada", "内嵌窗口": "Janela embutida", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "Abre na janela embutida; fechar a janela cancela a espera (se a conta Google for recusada, use o navegador do sistema)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "Abre na janela embutida; ao concluir, entra automaticamente na lista; fechar a janela cancela a espera", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "A janela embutida usa um ambiente totalmente novo, então várias contas não interferem entre si; fechar a janela cancela a espera", "内嵌窗口(推荐)": "Janela embutida (recomendado)", "准备验证…": "Preparando a verificação…", "凭据 JSON": "JSON da credencial", "凭证文件在哪?": "Onde fica o arquivo de credenciais?", "创建并添加账号": "Criar e adicionar conta", "创建这个提供商,并同时建立它的第一个账号。": "Crie este provedor e, ao mesmo tempo, sua primeira conta.", "删除功能不可用(脚本未就绪)": "Exclusão indisponível (script não está pronto)", "删除失败:{reason}": "Falha ao excluir: {reason}", "删除此提供商": "Excluir este provedor", "及 {n} 个账号": " e {n} contas", "发送中…": "Enviando…", "发送失败:{message}": "Falha ao enviar: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "Envio não confirmado: a janela de login foi aberta; conclua o login manualmente nessa janela", "取消失败:{message}": "Falha ao cancelar: {message}", "取消等待": "Cancelar espera", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "Somente a \"Janela embutida\" pode restaurar os acessos de terceiros: no navegador do sistema não podemos alterar a página de login", "可选": "Opcional", "可选(cloudaicompanionProject):留空由网关自动发现": "Opcional (cloudaicompanionProject); se vazio, o gateway descobre automaticamente", "可选,展示用": "Opcional, para exibição", "可选,没有则无法自动续期": "Opcional; sem ele, não é possível renovar automaticamente", "可选,留空使用凭据里的 user_name": "Opcional; se vazio, usa o user_name da credencial", "可选,留空使用账号姓名、邮箱或令牌指纹": "Opcional; se vazio, usa o nome, o e-mail ou a impressão digital do token", "可选,留空使用账号昵称或邮箱": "Opcional; se vazio, usa o apelido ou o e-mail da conta", "可选,留空则用 key 尾号": "Opcional; se vazio, usa o final da key", "可选,留空则用 userId": "Opcional; se vazio, usa o userId", "可选,留空则用上游返回的账号名或账号 id": "Opcional; se vazio, usa o nome ou o id da conta retornados pelo upstream", "可选,留空则用凭证里的账号名": "Opcional; se vazio, usa o nome da conta na credencial", "可选,留空则用文件里的昵称": "Opcional; deixe vazio para usar o apelido do arquivo", "可选,留空则用登录名或 uid": "Opcional; se vazio, usa o nome de login ou o uid", "可选,留空则用脱敏手机号": "Opcional; se vazio, usa o celular mascarado", "可选,留空则用脱敏手机号或 userId": "Opcional; se vazio, usa o celular mascarado ou o userId", "可选,留空则用账号 uk": "Opcional; se vazio, usa o uk da conta", "可选,留空则用邮箱或令牌尾号": "Opcional; se vazio, usa o e-mail ou o final do token", "可选,留空用「OfficeAce 果办」": "Opcional; se vazio, usa “OfficeAce”", "可选,留空自动生成": "Opcional; se vazio, gerado automaticamente", "可选,留空自动用昵称": "Opcional; se vazio, usa o apelido", "可选,续期时带上": "Opcional; enviado na renovação", "可选,讯飞侧 userid": "Opcional; userid do lado iFlytek", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "Opcional; necessário para iniciar uma conversa. Se vazio, o gateway descobre automaticamente nas tarefas existentes da conta; se não encontrar, preencha manualmente depois.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "Opcional; e-mail da conta, usado para exibição e identificação (a mesma conta é reconhecida mesmo ao trocar por um token novo)", "可选;UUID 形态,与凭据同生共死": "Opcional; formato UUID, vive e morre com a credencial", "可选;填了才能到期自动续期": "Opcional; preencha para renovar automaticamente ao expirar", "可选;用于去重与展示名(留空时网关会问一次上游)": "Opcional; usado para deduplicação e nome de exibição (se vazio, o gateway consulta o upstream uma vez)", "可选;用于生成账号 id 与展示名": "Opcional; usado para gerar o id e o nome de exibição da conta", "可选;纯数字串(上游只收 8–24 位数字)": "Opcional; apenas dígitos (o upstream aceita somente 8–24 dígitos)", "可领取": "Resgatável", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "No mesmo provedor, podem ser misturados: contas com Key e contas sem autenticação seguem cada uma suas próprias regras", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "No mesmo endereço, troque o protocolo para anthropic e ele usará o endpoint compatível com Claude. Para encaminhar, é obrigatório preencher a API Key do OpenCode Go (por assinatura; obter a lista de modelos não exige Key, mas as requisições recebem 401 \"Missing API key\" do upstream)", "响应为空": "Resposta vazia", "国内版": "Edição da China", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "A edição da China e **a edição internacional são dois conjuntos independentes de contas e planos**; as credenciais e os planos resgatados não são compartilhados.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "A página de login da edição da China não tem acessos Google / GitHub (o login é por WeChat / celular / e-mail)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "O site de login da edição da China é www.accio-ai.com, diferente do site da edição internacional.", "国内版(WorkBuddy)": "Edição da China (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "O site da China é https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "Site da China (minimaxi.com); o endereço compatível com OpenAI é https://api.minimaxi.com/v1", "国际版": "Edição internacional", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "Plano Coding do z.ai da edição internacional; o endereço compatível com OpenAI é https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "As edições internacional e da China são **dois conjuntos independentes de contas** (dois sites do mesmo sistema de contas); as credenciais não são compartilhadas.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "As edições internacional e da China têm sistemas de contas independentes; preencha a credencial da edição internacional. Sem preencher o refreshToken, não é possível renovar automaticamente.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "A página de login da edição internacional mostra por padrão apenas o login por e-mail; marcar a opção restaura os acessos Google / GitHub / X", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "O site de inferência da edição internacional é api.z.ai, diferente do site da edição da China; os planos também são independentes.", "国际版(WorkBuddy AI)": "Edição internacional (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "Plano Coding do site internacional; o endereço compatível com OpenAI é https://api.minimax.io/v1", "在 cc-switch 里找到": "Encontradas", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "Conclua o login oficial na janela embutida; em caso de sucesso, a conta entra automaticamente na lista de contas.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "Gere um PAT nas configurações da conta Qoder do {label} → Integrations (não use um token do Google / GitHub). Contas e credenciais não são compartilhadas entre as duas regiões.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "Na janela aberta, entre no site principal do KukuAI com sua conta Baidu (código SMS ou QR code, tanto faz); após o login, a conta entra automaticamente na lista. O gateway troca com o Baidu um token de sessão de negócio do KukuAI (requer o cliente KukuAI instalado nesta máquina).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "Faça login com sua conta Google na janela que abrir (página de autorização do Antigravity); a conta é adicionada à lista automaticamente quando a autorização for concluída.", "在浏览器中打开登录页": "Abrir a página de login no navegador", "地区": "Região", "填写凭证": "Preencher credenciais", "填写凭证添加": "Preencher credenciais para adicionar", "备注名": "Rótulo", "套餐": "Plano", "如:智谱 GLM": "ex.: Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "Após concluir o login, a conta entra automaticamente na lista; o apelido vem do upstream.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "Diretório de credenciais do cliente oficial: Windows — C:\\Users\\\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth; macOS — ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "Crédito confirmado oficialmente", "导入": "Importar", "导入中…": "Importando…", "导入凭证文件": "Importar arquivo de credenciais", "导入失败": "Falha na importação", "导入失败:{reason}": "Falha na importação: {reason}", "导入所选": "Importar selecionados", "导入所选({n})": "Importar selecionados ({n})", "导入桌面端登录态": "Importar sessão de login do desktop", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "A janela embutida será aberta; após a autorização, a conta entra automaticamente na lista de contas. Fechar a janela cancela a espera. No final, a página de autorização pode avisar que não conseguiu abrir o link zcode:// — isso é normal; o resultado já foi registrado no servidor", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "A janela embutida será aberta; após a autorização, a conta entra automaticamente na lista de contas. No painel remoto, é possível colar o endereço de callback. Fechar a janela cancela a espera. O link é válido por 5 minutos; se expirar ou não for clicado, ele é invalidado (você pode iniciar de novo)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "A janela embutida será aberta; após o login, a conta entra automaticamente na lista. Fechar a janela cancela a espera", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta Trae já conectada nele); na mesma máquina, a conta entra automaticamente ao concluir. Para Docker / painel remoto, cole o endereço de callback da barra de endereços conforme as instruções.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta ZCode já conectada nele); após a autorização, a conta entra automaticamente na lista. No final, a página pode avisar que não conseguiu abrir o link zcode://; isso é normal", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta Huawei Cloud já conectada nele); se o navegador e o gateway não estiverem na mesma máquina, cole o endereço de callback final de volta no painel conforme as instruções acima", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "A página de login será aberta no navegador padrão do sistema (reaproveitando a conta Accio já conectada nele); após o login, a conta entra automaticamente na lista; fechar a janela cancela a espera", "小米 MiMo Token Plan 套餐(新加坡站)": "Plano Token Plan do Xiaomi MiMo (site de Singapura)", "已到账": "Creditado", "已取消登录等待": "Espera de login cancelada", "已取消领取": "Resgate cancelado", "已取消验证码": "Captcha cancelado", "已填写手机号,正在发送验证码…": "Celular preenchido; enviando o código…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "Marcada como sem necessidade de autenticação: a conta é roteada normalmente e nenhum cabeçalho de autenticação é enviado nas requisições de saída", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "{ok} importados, {fail} com falha (os itens com falha estão marcados na lista)", "已建过 · {n} 个账号,点击继续添加": "Já criado · {n} contas, clique para adicionar mais", "已建过,点击继续添加账号": "Já criado, clique para adicionar outra conta", "已打开官方登录页,请在窗口中完成登录…": "Página de login oficial aberta; conclua o login na janela…", "已点发送,等待短信…": "Enviado; aguardando o SMS…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "Página de login aberta no navegador padrão do sistema; conclua o login no navegador…", "已领取,等官方确认": "Resgatado; aguardando confirmação oficial", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "Esta versão do aplicativo não suporta o login web do AutoClaw; atualize o aplicativo", "当前没有可领取的套餐(活动尚未开始)": "Nenhum plano disponível para resgate no momento (a campanha ainda não começou)", "当前环境不支持领取(桥接方法缺失)": "O resgate não é suportado neste ambiente (método de ponte ausente)", "必填,CatPaw 账号标识": "Obrigatório; identificador da conta CatPaw", "恢复 Google / GitHub 入口": "Restaurar acessos Google / GitHub", "手机号": "Celular", "手机验证码登录": "Login com código SMS", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Abra a página de autorização oficial do Trae SOLO (trae.cn) e entre com sua conta Trae: ao concluir a autorização, a página oficial redireciona de volta para uma porta temporária desta máquina; implantações na mesma máquina recebem automaticamente, e no Docker / painel remoto copie o endereço de callback da barra de endereços conforme as instruções.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Abra a página de login oficial do Accio {label} ({site}) e entre com sua conta Accio: após o login, a página oficial redireciona de volta para esta máquina; na mesma máquina tudo se completa automaticamente, e no Docker / painel remoto basta colar o endereço de callback conforme as instruções (o código de autorização é passado ao gateway apenas nesta máquina, e nenhum token em texto claro é exibido na interface).", "打开 Accio {label}登录页": "Abrir a página de login do Accio {label}", "打开 Antigravity 网页登录": "Abrir login web do Antigravity", "打开 CatPaw 网页登录": "Abrir o login web do CatPaw", "打开 Cline 授权页": "Abrir a página de autorização do Cline", "打开 CodeArts 授权页": "Abrir a página de autorização do CodeArts", "打开 Qoder 网页登录": "Abrir o login web do Qoder", "打开 Trae 授权页": "Abrir a página de autorização do Trae", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "Abra a página de autorização oficial do ZCode {label} e entre com sua conta. O resultado da autorização é registrado pelo servidor do ZCode; o gateway busca a credencial em segundo plano e a adiciona à lista de contas.", "打开 ZCode {label}授权页": "Abrir a página de autorização do ZCode {label}", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Abra a página de autorização oficial do Huawei Cloud CodeArts para entrar: após o login, a página oficial leva o navegador de volta ao /oauth/callback do próprio gateway, e o gateway troca o código de autorização de uso único por credenciais temporárias e adiciona a conta à lista.
    Quando o gateway roda em outra máquina, a interface web pede para colar o endereço de callback final da barra de endereços de volta no painel.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Abra a página de autorização do Huawei Cloud e faça login: ao concluir, o gateway consulta a nuvem automaticamente para obter o código de autorização e adiciona a conta à lista (não é preciso instalar o aplicativo de desktop do OfficeAce nem colar manualmente uma URL de retorno).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "Abra a página de autorização oficial e conclua a autorização por código de dispositivo; a conta usada é do {label} ({site}).", "打开授权页": "Abrir a página de autorização", "打开授权页完成确认,账号自动加入 {label}{note}": "Abra a página de autorização e confirme; a conta entra automaticamente em {label}{note}", "打开方式": "Como abrir", "打开网页登录": "Abrir login web", "探测失败:{message}": "Falha na detecção: {message}", "接入一个兼容上游": "Conectar um upstream compatível", "提交中…": "Enviando…", "搜索提供商": "Buscar provedores", "搜索提供商…": "Buscar provedores…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "Cole o JSON de credencial inteiro gravado pelo plugin oficial / CLIProxyAPI (no formato {\"codearts_provider_credential\":{…}}; a versão achatada também serve).
    Obrigatórios: access_key_id, secret_access_key, security_token.Para renovar automaticamente, é preciso colar também refresh_token e oauth_context — as credenciais temporárias expiram em cerca de uma hora, e sem essa parte não há como renovar; será preciso fazer login de novo.", "文件是{edition}凭证,已按该版本导入": "O arquivo contém credenciais da {edition} e foi importado como tal", "新建自定义提供商": "Novo provedor personalizado", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "JWT em texto claro ou o valor criptografado enc: do auth.json (descriptografado automaticamente)", "明文 JWT(国际版账号的 access token)": "JWT em texto claro (o access token da conta da edição internacional)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Plano Coding do bigmodel.cn da Zhipu; obtenha a Key em open.bigmodel.cn/usercenter/apikeys", "未知错误": "Erro desconhecido", "未能获取授权地址,请重试": "Não foi possível obter o endereço de autorização; tente novamente", "未能读取 cc-switch 数据": "Não foi possível ler os dados do cc-switch", "未领取成功": "Resgate não concluído", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "Marque esta opção para upstreams como o Ollama local ou o nível gratuito do OpenCode Zen; caso contrário, a conta não funcionará", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "Este provedor tem duas credenciais que **não se substituem**; preencha as que correspondem aos recursos que você vai usar, pelo menos uma: a API Key do Coding Plan serve para encaminhar inferência (acessa {site}) e para consultar os limites de janela (a porcentagem restante de cada janela de N horas / semanal); o jwt serve para resgatar planos e consultar saldo (acessa o gateway de billing em zcode.z.ai; oficialmente chamado Coding Plan JWT, uma string de três segmentos separados por ponto). As duas consultam saldo, mas leem coisas diferentes: o jwt lê os baldes de saldo e a expiração do plano, enquanto a API Key lê os limites de janela; e o resgate só aceita o jwt, o encaminhamento só aceita a API Key. Preencha a credencial da conta {label} — {plan} (a forma mais fácil: use o \"Login web\" acima — ele troca essa API Key por você e obtém as duas credenciais de uma vez.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "Endpoint compatível com OpenAI do Ollama local; não precisa de API Key (a opção \"Este upstream não exige autenticação\" já vem marcada e nenhum cabeçalho de autenticação é enviado)", "本次未确认到账": "Crédito não confirmado desta vez", "条可导入": "importáveis", "条配置,其中": "configurações no cc-switch, das quais", "桌面运行时不可用(Tauri 未初始化)": "Runtime do desktop indisponível (Tauri não inicializado)", "模型网关基址": "Endereço base do gateway de modelos", "正在打开百度登录页…": "Abrindo a página de login do Baidu…", "正在扫描本机 cc-switch…": "Escaneando o cc-switch desta máquina…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "Aguardando a conclusão do login de {name}; só após concluir ou cancelar você pode iniciar um novo login", "每周": "Semanal", "每日": "Diário", "每月": "Mensal", "没有则无法自动续期": "Sem ele, não é possível renovar automaticamente", "没有匹配「{keyword}」的提供商": "Nenhum provedor corresponde a \"{keyword}\"", "添加 {name} 账号": "Adicionar conta {name}", "添加中…": "Adicionando…", "添加到 ": "Adicionar a ", "添加失败:{reason}": "Falha ao adicionar: {reason}", "添加小浣熊账号": "Adicionar conta Raccoon", "添加方式": "Forma de adicionar", "添加账号": "Adicionar conta", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Plano Coding do Volcano Engine; o endpoint de inferência geral é https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "Clique para adicionar uma conta", "点开即预填,填 Key 接入": "Abre já preenchido; informe a Key para conectar", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "Após clicar no botão, primeiro passe por uma verificação de slider (controle de risco do provedor); em seguida a página de login abre e a conta é adicionada automaticamente ao concluir o login.
    Esta é a única forma oficial de login da edição internacional; se você já entrou no cliente, \"Importar sessão de login do desktop\" é mais rápido.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "Entre com o celular vinculado à conta AutoClaw: clique em \"Obter código\", informe o código recebido por SMS abaixo e entre. O código é enviado desta máquina diretamente à API oficial, e nenhum token é exibido na interface.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "Conclua o login com sua conta CatPaw (Meituan Passport); em caso de sucesso, a conta entra automaticamente na lista.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Entre com o celular vinculado à conta Loomy: clique em \"Obter código\" e informe o código. Esta é a forma mais simples neste provedor.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "Usado para encaminhamento; no formato apiKey.secret, dois segmentos separados por ponto (se vazio, esta conta não pode encaminhar)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "Usado para resgatar planos e consultar saldo; se vazio, esta conta não pode resgatar nem consultar saldo", "用户 ID": "ID do usuário", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "Entre com o celular vinculado: clique em \"Obter código\" e informe o código. Esta é a única forma oficial de login da edição da China.", "留空则用提供商名称": "Se vazio, usa o nome do provedor", "登录 / 添加 {name} 账号": "Entrar / adicionar conta {name}", "登录 session(一长串)": "Sessão de login (uma string longa)", "登录中…": "Entrando…", "登录失败:{message}": "Falha no login: {message}", "登录已结束": "Login encerrado", "登录并添加": "Entrar e adicionar", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "Caminho do arquivo de sessão de login: ~/.box-agent/config/auth.json (Windows: C:\\Users\\\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "Excluir o provedor personalizado \"{name}\"? Isso também excluirá {count} contas desse provedor; a exclusão não pode ser desfeita.", "等待 Accio {label}登录完成…": "Aguardando a conclusão do login do Accio {label}…", "等待 CatPaw 登录完成…": "Aguardando a conclusão do login do CatPaw…", "等待 Cline 授权确认…": "Aguardando a confirmação de autorização do Cline…", "等待 CodeArts 登录完成…": "Aguardando a conclusão do login do CodeArts…", "等待 Google 授权完成…": "Aguardando a conclusão da autorização do Google…", "等待 KukuAI 登录完成…": "Aguardando a conclusão do login do KukuAI…", "等待 OfficeAce 登录完成…": "Aguardando a conclusão do login do OfficeAce…", "等待 Qoder 授权完成…": "Aguardando a conclusão da autorização do Qoder…", "等待 Trae 授权完成…": "Aguardando a conclusão da autorização do Trae…", "等待 ZCode {label}授权完成…": "Aguardando a conclusão da autorização do ZCode {label}…", "等待小浣熊登录完成…": "Aguardando a conclusão do login do Raccoon…", "等待登录完成…": "Aguardando a conclusão do login…", "等待网页登录…": "Aguardando o login web…", "粘贴 API Key": "Colar API Key", "粘贴 Accio 的 accessToken": "Colar o accessToken do Accio", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Cole o Google refresh token do Antigravity (começa com 1//; também pode colar a linha inteira que contém refresh_token=).
    Esta é uma entrada manual além do login web (por exemplo, exportada do IDE oficial em que você já está conectado). O refresh token não expira, e o gateway renova o access token automaticamente ao expirar; se o token for perdido, só resta refazer a autorização do Google, então guarde-o bem.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Cole a API Key do Command Code (começa com user_; obtenha no ~/.commandcode/auth.json do CLI oficial ou no studio web). Colar a linha inteira / com aspas / com o prefixo Bearer funciona; o gateway extrai a key pura sozinho. A key não expira e não há API de renovação, então basta obter uma nova se ela deixar de funcionar. Ao adicionar, o gateway faz uma verificação leve de atividade; uma falha não impede a adição.", "粘贴 Cookie": "Colar Cookie", "粘贴 Google refresh token": "Colar Google refresh token", "粘贴 Qoder 个人访问令牌(pt-…)": "Colar o token de acesso pessoal do Qoder (pt-…)", "粘贴 access_token(一长串 JWT)": "Colar o access_token (um JWT longo)", "粘贴 session cookie": "Colar session cookie", "粘贴 token / refreshToken": "Colar token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "Cole um token começando com workos:… (o prefixo é adicionado automaticamente se faltar)", "粘贴登录凭据": "Colar credenciais de login", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "O que você cola é a sessão de login (que também é o token do gateway de modelos). O Loomy não tem API de renovação; a sessão vale cerca de 14 dias, então basta entrar de novo após expirar.", "粘贴网关凭据": "Colar credenciais do gateway", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "Cole o valor do cookie de sessão de login web monkeycode_ai_session (copiar o Cookie inteiro no navegador e colar diretamente também funciona; o gateway extrai o valor sozinho).
    {siteNote}
    O MonkeyCode não tem API de renovação: a sessão vale cerca de 30 dias (limite rígido); quando expirar, entre novamente no site e cole mais uma vez.", "系统浏览器": "Navegador do sistema", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "O navegador do sistema pode reaproveitar a sessão de login existente (recomendado para a edição internacional); a janela embutida é mais limpa.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Cline já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "Abre no navegador do sistema (reutiliza a conta Google já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Zai / Google já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Meituan já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta já conectada); ao concluir, entra automaticamente na lista", "系统默认浏览器": "Navegador padrão do sistema", "编码套餐 API Key": "API Key do Coding Plan", "网关 Secret": "Segredo do gateway", "网页登录": "Login web", "网页登录的打开方式": "Como abrir o login web", "网页登录(Zai / Google)": "Login web (Zai / Google)", "自定义": "Personalizado", "获取风控配置失败,将直接尝试领取:{message}": "Falha ao obter a configuração de controle de risco; tentando resgatar diretamente: {message}", "获取验证码": "Obter código", "该上游无需鉴权(不发送鉴权头)": "Este upstream não exige autenticação (nenhum cabeçalho de autenticação é enviado)", "该提供商": "Este provedor", "该提供商账号添加功能即将上线": "A adição de contas deste provedor chega em breve", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "Este provedor personalizado não existe mais (pode ter sido excluído); atualize e tente novamente", "请先选择一个自定义提供商": "Selecione primeiro um provedor personalizado", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "Conclua a verificação no slider exibido (etapa de controle de risco exigida pelo provedor)", "请填写 11 位大陆手机号": "Informe um número de celular da China continental com 11 dígitos", "请填写 6 位数字验证码": "Informe o código de 6 dígitos", "请填写 Base URL": "Preencha a Base URL", "请填写 {label}": "Preencha {label}", "请填写名称": "Preencha o nome", "请完成验证…": "Conclua a verificação…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "Lê e descriptografa %APPDATA%/AutoClaw/auth.json; somente no Windows", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Lê ~/.cline/data/settings/providers.json; requer login no cliente Cline", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Lê ~/.meituan-catpaw/auth.json; requer login no cliente CatPaw", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Lê a sessão de login do cliente KukuAI desta máquina (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requer login no cliente KukuAI", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Lê a sessão de login atual do cliente desta máquina (Cookie em texto claro, sem descriptografia). Com o cliente em execução, o arquivo Cookies fica em uso exclusivo; feche o cliente KukuAI antes de importar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, clique em \"Atualizar Token\" para sincronizar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, basta importar de novo.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Usuários que entram no cliente com Zai / Google devem usar esta opção.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Esta opção fica em {label}.", "账号信息": "Informações da conta", "账号信息不完整,请刷新后重试": "Informações da conta incompletas; atualize e tente novamente", "账号已添加,但请留意:{warning}": "Conta adicionada, mas atenção: {warning}", "账号版本": "Edição da conta", "账号类型": "Tipo de conta", "账号:{name}
    ": "Conta: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Usa a rota Inference Providers; crie a Key em hf.co/settings/tokens", "还没有账号": "Ainda não há contas", "这一家当前不支持网页登录,请改用填写凭证": "Este provedor não suporta login web no momento; use \"Preencher credenciais\"", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "Esta conta não tem campanhas com resgate automático no momento (apenas os pontos de brinde do login diário são resgatados automaticamente)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "Esta cota passa pelo canal \"Start Plan\": se o encaminhamento avisar que o Coding Plan expirou, ", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site da China (monkeycode-ai.com): cole a sessão do site da China. O site internacional (monkeycode-ai.net) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site internacional (monkeycode-ai.net): cole a sessão do site internacional. O site da China (monkeycode-ai.com) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", "选择凭证文件导入": "Importar de arquivo de credenciais", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Selecione o arquivo de credenciais de sessão do cliente oficial (workbuddy-desktop.info / workbuddy-desktop-ai.info) ou um JSON de conta exportado pelo wb2api (formato aninhado ou plano); também é possível ler diretamente do cliente oficial nesta máquina.", "选择提供商": "Selecionar provedor", "选择的文件不是合法 JSON": "O arquivo selecionado não é um JSON válido", "选择要添加账号的提供商": "Selecione o provedor para adicionar uma conta", "重新扫描": "Escanear novamente", "鉴权": "Autenticação", "阿里云 Token Plan 套餐(国际站)": "Plano Token Plan do Alibaba Cloud (site internacional)", "阿里云百炼 Coding 套餐(国内站)": "Plano Coding do Alibaba Cloud Model Studio (site da China)", "阿里云百炼 Coding 套餐(国际站)": "Plano Coding do Alibaba Cloud Model Studio (site internacional)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Serviço de modelos Alibaba Cloud Model Studio (site internacional, modo compatível com OpenAI)", "需要图形验证码:登录窗口已弹出,请填写后继续": "Captcha necessário: a janela de login foi aberta; preencha para continuar", "预置 API": "API predefinida", "领取 CodeArts 每日福利": "Resgatar benefício diário do CodeArts", "领取失败:{message}": "Falha ao resgatar: {message}", "领取并让官方确认": "Resgatar e aguardar confirmação oficial", "风控验证配置不完整,请稍后重试": "Configuração de verificação de controle de risco incompleta; tente novamente mais tarde", "验证码": "Código de verificação", "验证码已发送。收到后填入下方并点「登录并添加」": "Código enviado. Informe-o abaixo e clique em \"Entrar e adicionar\"", "验证码已发送,请查看手机短信": "Código enviado; verifique o SMS", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "Código enviado; verifique o SMS. Informe-o abaixo e clique em \"Entrar e adicionar\" para concluir o login", "验证码已发送,请查看短信": "Código enviado; verifique as mensagens", "验证码校验失败,请重试": "Falha na verificação do captcha; tente novamente", "验证码校验超时,请重试": "Tempo esgotado na verificação do captcha; tente novamente", "验证码组件不可用,请重试": "Componente de captcha indisponível; tente novamente", "验证码组件初始化超时,请重试": "Tempo esgotado ao inicializar o componente de captcha; tente novamente", "验证码组件加载失败,请检查网络后重试": "Falha ao carregar o componente de captcha; verifique a rede e tente novamente", "验证码组件加载异常,请重试": "Erro ao carregar o componente de captcha; tente novamente", "验证码组件加载超时,请检查网络后重试": "Tempo esgotado ao carregar o componente de captcha; verifique a rede e tente novamente", "验证码组件未加载,请重启应用后重试": "O componente de captcha não foi carregado; reinicie o aplicativo e tente novamente", "(免费额度池,模型名带 cline-free/ 前缀)。": " (pool de cota gratuita; nomes de modelo com o prefixo cline-free/).", "(其中 {n} 把恢复为不限制)": " ({n} das quais voltaram a ser ilimitadas)", "(必填)": " (obrigatório)", "(有效期 {window})": "(validade {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (pool de assinatura; nomes de modelo com o prefixo cline-pass/, e a conta precisa da assinatura correspondente).", ",下一次最快 {minutes} 分钟后": ", próxima tentativa em pelo menos {minutes} min", ",并从 {n} 把 Key 的可用提供商里移除": ", e removido dos provedores permitidos de {n} keys" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · Modelos: {head}{rest}", " 等 {n} 个": " ({n} no total)", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "Google refresh token começando com 1// (também pode colar a linha refresh_token=… inteira)", "11 位大陆手机号": "Celular da China continental (11 dígitos)", "1~64 个字符,账号列表里按它分组显示": "1 a 64 caracteres; na lista de contas, as contas são agrupadas por ele", "6 位数字": "6 dígitos", "

  • 没有可自动领的活动
  • ": "
  • Nenhuma campanha pode ser resgatada automaticamente
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    O que você recebe são pontos de brinde do plano, que não aumentam o pool de tokens dos modelos de benefício; ", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "O endpoint compatível com Anthropic é https://api.deepseek.com/anthropic (preencha-o ao trocar o protocolo para anthropic)", "Anthropic 协议填根地址,不要带 /v1": "No protocolo Anthropic, preencha o endereço raiz, sem /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw edição da China", "AutoClaw 国际版": "AutoClaw edição internacional", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS é obrigatório; cole o **Cookie completo** (um editor de Cookie exporta com um clique) — o **PTOKEN deve ser mantido**, pois o gateway o usa para trocar com o Baidu por um token de sessão de negócio do KukuAI; sem ele, a atualização de modelos reporta \"não conectado\". São aceitos o cabeçalho Cookie inteiro, um array JSON exportado por um editor de Cookie, ou um objeto {BDUSS, STOKEN}. O KukuAI não tem mecanismo de atualização; quando a sessão de login expirar, basta colar de novo.", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=… (ou o JSON exportado por um editor de Cookie)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "X-Passport-Token do CatPaw (Cookie da sessão de login)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT (três segmentos separados por ponto)", "Command Code": "Command Code", "ModelScope 国内版": "ModelScope edição China", "ModelScope 国际版": "ModelScope edição internacional", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode edição internacional", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "Endpoint gerenciado do NVIDIA NIM; solicite a Key em integrate.api.nvidia.com", "OfficeAce 果办": "OfficeAce", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken é a credencial de login do Accio (um token opaco bem longo, não é JWT); refreshToken é opcional e, se preenchido, permite renovação automática ao expirar. Preencha a credencial da conta {label} — {siteNote} (a forma mais fácil de obter: use o \"Login web\" acima; não é preciso procurar o token manualmente.)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken é o Cloud-IDE-JWT do Trae (três segmentos separados por ponto) e o refreshToken serve para renovação automática ao expirar (este provedor troca o refreshToken a cada uso: assim que é trocado, o antigo é invalidado, então não atualize a mesma conta em dois programas ao mesmo tempo).
    Ao colar manualmente, preencha também machineId / deviceId: o upstream os vincula à chave pública do dispositivo enviada no login para identificar o dispositivo, e inventar um novo par dispara a família de rejeições de vínculo de dispositivo 2xxxx.
    Sem esses três itens, o caminho correto é o \"Login web\" acima; em contêiner / implantação remota, basta colar o endereço de callback da barra de endereços conforme as instruções.", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "O valor de monkeycode_ai_session (também pode colar o Cookie inteiro)", "ms- 开头的 API 令牌": "Token de API começando com ms-", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken é opcional e, se preenchido, permite renovação automática ao expirar; ambos podem ser obtidos do arquivo de sessão de login do cliente Raccoon.", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken é opcional e, se preenchido, permite renovação automática; ambos podem ser obtidos do arquivo de sessão de login do cliente. A mesma conta Cline funciona nos dois pools; aqui ela entra em {label}.", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "O token aceita o prefixo enc: (descriptografado automaticamente no Windows). Sem preencher o refreshToken, não é possível renovar automaticamente.", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "O token é o Cookie da sessão de login; o CatPaw não tem mecanismo de atualização, então faça login novamente no cliente após expirar.", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "API Key começando com user_ (também pode colar a linha Authorization: Bearer … inteira)", "{label} 网页登录的打开方式": "Como abrir o login web de {label}", "{label} 账号地区": "Região da conta {label}", "{label} 账号的添加方式": "Como adicionar uma conta {label}", "{name} 不是合法 JSON:{reason}": "{name} não é um JSON válido: {reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}: cole um objeto JSON (no formato {sample})", "{n} 个账号": "{n} contas", "{n} 个账号,点击添加": "{n} contas, clique para adicionar", "{seconds}s 后重发": "Reenviar em {seconds}s", "✅ {label}账号已添加": "✅ Conta {label} adicionada", "✅ {label}账号已添加{name}": "✅ Conta {label} adicionada{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ {n} provedores importados do cc-switch", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ Provedor personalizado \"{name}\" criado e conta adicionada", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ Provedor personalizado \"{name}\" excluído{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ Login concluído; conta {edition} adicionada à lista", "✅ 领取成功:{planId}{period}": "✅ Resgate concluído: {planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " Um mesmo provedor pode ter várias keys, rotacionadas por prioridade.", "「{name}」的账号添加功能还在开发中,敬请期待。": "A adição de contas para \"{name}\" ainda está em desenvolvimento; aguarde novidades.", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "Uma única Key serve para vários fornecedores; use o nome completo \"fornecedor/modelo\" (ex.: deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "Deixe em branco quando o upstream não exigir autenticação e marque a opção abaixo (em branco e sem marcar é tratado como credencial não configurada)", "上游信息": "Informações do upstream", "不可领({status})": "Não resgatável ({status})", "不支持导入": "Importação não suportada", "不是有效的凭证文件:内容要是一个 JSON 对象": "Não é um arquivo de credenciais válido: o conteúdo deve ser um objeto JSON", "不是有效的凭证文件:需要包含 accessToken 与 uid": "Não é um arquivo de credenciais válido: accessToken e uid são obrigatórios", "不是自定义提供商": "Não é um provedor personalizado", "不需要 Key:转发与拉取模型都不发送鉴权头": "Não precisa de Key: nem o encaminhamento nem a busca de modelos enviam cabeçalhos de autenticação", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "As contas das duas edições podem ser salvas ao mesmo tempo, cada uma com sua própria lista de modelos (as edições da China e internacional são dois provedores, que podem ser ativados e mapeados separadamente).", "中国版": "Edição da China", "今天没有需要领的活动(都已到账)": "Hoje não há campanhas para resgatar (todas já creditadas)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "Hoje (horário de Pequim, {day}) você já tentou {attempts} vezes; restam {left} tentativas{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "Pegue três itens de outra máquina (ou do models.json do aplicativo de desktop do OfficeAce) e cole aqui: o endereço base do gateway de modelos (baseUrl, no formato https://modelgw-…/v2) e modelAppKey / modelAppSecret. Esses três já bastam para encaminhar requisições (a credencial do gateway não expira); as credenciais temporárias do plano de controle (accessKeyId etc.) são opcionais — se ficarem em branco, a consulta de saldo e a renovação automática ficam indisponíveis, mas o encaminhamento não é afetado.", "从本机导入桌面端登录态": "Importar sessão de login do desktop desta máquina", "任务镜像 id": "id da imagem da tarefa", "使用 Google 账号登录": "Entrar com conta Google", "使用 Zai 账号登录": "Entrar com conta Zai", "使用个人访问令牌(PAT)": "Usar token de acesso pessoal (PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "Modelos gratuitos não precisam de Key (a opção \"Este upstream não exige autenticação\" já vem marcada e o gateway usa credenciais anônimas automaticamente); para modelos pagos, preencha a API Key do Zen. O nível gratuito do upstream só aceita o formato do cliente oficial, e a opção \"Simular o cliente oficial do OpenCode\" já vem ativada", "内嵌窗口": "Janela embutida", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "Abre na janela embutida; fechar a janela cancela a espera (se a conta Google for recusada, use o navegador do sistema)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "Abre na janela embutida; ao concluir, entra automaticamente na lista; fechar a janela cancela a espera", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "A janela embutida usa um ambiente totalmente novo, então várias contas não interferem entre si; fechar a janela cancela a espera", "内嵌窗口(推荐)": "Janela embutida (recomendado)", "准备验证…": "Preparando a verificação…", "凭据 JSON": "JSON da credencial", "凭证文件在哪?": "Onde fica o arquivo de credenciais?", "创建并添加账号": "Criar e adicionar conta", "创建这个提供商,并同时建立它的第一个账号。": "Crie este provedor e, ao mesmo tempo, sua primeira conta.", "删除功能不可用(脚本未就绪)": "Exclusão indisponível (script não está pronto)", "删除失败:{reason}": "Falha ao excluir: {reason}", "删除此提供商": "Excluir este provedor", "及 {n} 个账号": " e {n} contas", "发送中…": "Enviando…", "发送失败:{message}": "Falha ao enviar: {message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "Envio não confirmado: a janela de login foi aberta; conclua o login manualmente nessa janela", "取消失败:{message}": "Falha ao cancelar: {message}", "取消等待": "Cancelar espera", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "Somente a \"Janela embutida\" pode restaurar os acessos de terceiros: no navegador do sistema não podemos alterar a página de login", "可选": "Opcional", "可选(cloudaicompanionProject):留空由网关自动发现": "Opcional (cloudaicompanionProject); se vazio, o gateway descobre automaticamente", "可选,展示用": "Opcional, para exibição", "可选,没有则无法自动续期": "Opcional; sem ele, não é possível renovar automaticamente", "可选,留空使用凭据里的 user_name": "Opcional; se vazio, usa o user_name da credencial", "可选,留空使用账号姓名、邮箱或令牌指纹": "Opcional; se vazio, usa o nome, o e-mail ou a impressão digital do token", "可选,留空使用账号昵称或邮箱": "Opcional; se vazio, usa o apelido ou o e-mail da conta", "可选,留空则用 key 尾号": "Opcional; se vazio, usa o final da key", "可选,留空则用 userId": "Opcional; se vazio, usa o userId", "可选,留空则用上游账号昵称": "Opcional; se deixado em branco, o apelido da conta upstream é usado", "可选,留空则用上游返回的账号名或账号 id": "Opcional; se vazio, usa o nome ou o id da conta retornados pelo upstream", "可选,留空则用凭证里的账号名": "Opcional; se vazio, usa o nome da conta na credencial", "可选,留空则用文件里的昵称": "Opcional; deixe vazio para usar o apelido do arquivo", "可选,留空则用登录名或 uid": "Opcional; se vazio, usa o nome de login ou o uid", "可选,留空则用脱敏手机号": "Opcional; se vazio, usa o celular mascarado", "可选,留空则用脱敏手机号或 userId": "Opcional; se vazio, usa o celular mascarado ou o userId", "可选,留空则用账号 uk": "Opcional; se vazio, usa o uk da conta", "可选,留空则用邮箱或令牌尾号": "Opcional; se vazio, usa o e-mail ou o final do token", "可选,留空用「OfficeAce 果办」": "Opcional; se vazio, usa “OfficeAce”", "可选,留空自动生成": "Opcional; se vazio, gerado automaticamente", "可选,留空自动用昵称": "Opcional; se vazio, usa o apelido", "可选,续期时带上": "Opcional; enviado na renovação", "可选,讯飞侧 userid": "Opcional; userid do lado iFlytek", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "Opcional; necessário para iniciar uma conversa. Se vazio, o gateway descobre automaticamente nas tarefas existentes da conta; se não encontrar, preencha manualmente depois.", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "Opcional; e-mail da conta, usado para exibição e identificação (a mesma conta é reconhecida mesmo ao trocar por um token novo)", "可选;UUID 形态,与凭据同生共死": "Opcional; formato UUID, vive e morre com a credencial", "可选;填了才能到期自动续期": "Opcional; preencha para renovar automaticamente ao expirar", "可选;用于去重与展示名(留空时网关会问一次上游)": "Opcional; usado para deduplicação e nome de exibição (se vazio, o gateway consulta o upstream uma vez)", "可选;用于生成账号 id 与展示名": "Opcional; usado para gerar o id e o nome de exibição da conta", "可选;纯数字串(上游只收 8–24 位数字)": "Opcional; apenas dígitos (o upstream aceita somente 8–24 dígitos)", "可领取": "Resgatável", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "No mesmo provedor, podem ser misturados: contas com Key e contas sem autenticação seguem cada uma suas próprias regras", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "No mesmo endereço, troque o protocolo para anthropic e ele usará o endpoint compatível com Claude. Para encaminhar, é obrigatório preencher a API Key do OpenCode Go (por assinatura; obter a lista de modelos não exige Key, mas as requisições recebem 401 \"Missing API key\" do upstream)", "响应为空": "Resposta vazia", "国内版": "Edição da China", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "A edição da China e **a edição internacional são dois conjuntos independentes de contas e planos**; as credenciais e os planos resgatados não são compartilhados.", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "A página de login da edição da China não tem acessos Google / GitHub (o login é por WeChat / celular / e-mail)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "O site de login da edição da China é www.accio-ai.com, diferente do site da edição internacional.", "国内版(WorkBuddy)": "Edição da China (WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "O site da China é https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "Site da China (minimaxi.com); o endereço compatível com OpenAI é https://api.minimaxi.com/v1", "国际版": "Edição internacional", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "Plano Coding do z.ai da edição internacional; o endereço compatível com OpenAI é https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "As edições internacional e da China são **dois conjuntos independentes de contas** (dois sites do mesmo sistema de contas); as credenciais não são compartilhadas.", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "As edições internacional e da China têm sistemas de contas independentes; preencha a credencial da edição internacional. Sem preencher o refreshToken, não é possível renovar automaticamente.", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "A página de login da edição internacional mostra por padrão apenas o login por e-mail; marcar a opção restaura os acessos Google / GitHub / X", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "O site de inferência da edição internacional é api.z.ai, diferente do site da edição da China; os planos também são independentes.", "国际版(WorkBuddy AI)": "Edição internacional (WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "Plano Coding do site internacional; o endereço compatível com OpenAI é https://api.minimax.io/v1", "在 cc-switch 里找到": "Encontradas", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "Conclua o login oficial na janela embutida; em caso de sucesso, a conta entra automaticamente na lista de contas.", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "Gere um PAT nas configurações da conta Qoder do {label} → Integrations (não use um token do Google / GitHub). Contas e credenciais não são compartilhadas entre as duas regiões.", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "Na janela aberta, entre no site principal do KukuAI com sua conta Baidu (código SMS ou QR code, tanto faz); após o login, a conta entra automaticamente na lista. O gateway troca com o Baidu um token de sessão de negócio do KukuAI (requer o cliente KukuAI instalado nesta máquina).", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "Faça login com sua conta Google na janela que abrir (página de autorização do Antigravity); a conta é adicionada à lista automaticamente quando a autorização for concluída.", "在浏览器中打开登录页": "Abrir a página de login no navegador", "地区": "Região", "填写凭证": "Preencher credenciais", "填写凭证添加": "Preencher credenciais para adicionar", "备注名": "Rótulo", "套餐": "Plano", "如:智谱 GLM": "ex.: Zhipu GLM", "完成登录后自动加入账号列表,昵称取自上游。": "Após concluir o login, a conta entra automaticamente na lista; o apelido vem do upstream.", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "Diretório de credenciais do cliente oficial: Windows — C:\\Users\\\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth; macOS — ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "Crédito confirmado oficialmente", "导入": "Importar", "导入中…": "Importando…", "导入凭证文件": "Importar arquivo de credenciais", "导入失败": "Falha na importação", "导入失败:{reason}": "Falha na importação: {reason}", "导入所选": "Importar selecionados", "导入所选({n})": "Importar selecionados ({n})", "导入桌面端登录态": "Importar sessão de login do desktop", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "A janela embutida será aberta; após a autorização, a conta entra automaticamente na lista de contas. Fechar a janela cancela a espera. No final, a página de autorização pode avisar que não conseguiu abrir o link zcode:// — isso é normal; o resultado já foi registrado no servidor", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "A janela embutida será aberta; após a autorização, a conta entra automaticamente na lista de contas. No painel remoto, é possível colar o endereço de callback. Fechar a janela cancela a espera. O link é válido por 5 minutos; se expirar ou não for clicado, ele é invalidado (você pode iniciar de novo)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "A janela embutida será aberta; após o login, a conta entra automaticamente na lista. Fechar a janela cancela a espera", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta Trae já conectada nele); na mesma máquina, a conta entra automaticamente ao concluir. Para Docker / painel remoto, cole o endereço de callback da barra de endereços conforme as instruções.", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta ZCode já conectada nele); após a autorização, a conta entra automaticamente na lista. No final, a página pode avisar que não conseguiu abrir o link zcode://; isso é normal", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "A página de autorização será aberta no navegador padrão do sistema (reaproveitando a conta Huawei Cloud já conectada nele); se o navegador e o gateway não estiverem na mesma máquina, cole o endereço de callback final de volta no painel conforme as instruções acima", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "A página de login será aberta no navegador padrão do sistema (reaproveitando a conta Accio já conectada nele); após o login, a conta entra automaticamente na lista; fechar a janela cancela a espera", "小米 MiMo Token Plan 套餐(新加坡站)": "Plano Token Plan do Xiaomi MiMo (site de Singapura)", "已到账": "Creditado", "已取消登录等待": "Espera de login cancelada", "已取消领取": "Resgate cancelado", "已取消验证码": "Captcha cancelado", "已填写手机号,正在发送验证码…": "Celular preenchido; enviando o código…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "Marcada como sem necessidade de autenticação: a conta é roteada normalmente e nenhum cabeçalho de autenticação é enviado nas requisições de saída", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "{ok} importados, {fail} com falha (os itens com falha estão marcados na lista)", "已建过 · {n} 个账号,点击继续添加": "Já criado · {n} contas, clique para adicionar mais", "已建过,点击继续添加账号": "Já criado, clique para adicionar outra conta", "已打开官方登录页,请在窗口中完成登录…": "Página de login oficial aberta; conclua o login na janela…", "已点发送,等待短信…": "Enviado; aguardando o SMS…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "Página de login aberta no navegador padrão do sistema; conclua o login no navegador…", "已领取,等官方确认": "Resgatado; aguardando confirmação oficial", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "Esta versão do aplicativo não suporta o login web do AutoClaw; atualize o aplicativo", "当前没有可领取的套餐(活动尚未开始)": "Nenhum plano disponível para resgate no momento (a campanha ainda não começou)", "当前环境不支持领取(桥接方法缺失)": "O resgate não é suportado neste ambiente (método de ponte ausente)", "必填,CatPaw 账号标识": "Obrigatório; identificador da conta CatPaw", "恢复 Google / GitHub 入口": "Restaurar acessos Google / GitHub", "手机号": "Celular", "手机验证码登录": "Login com código SMS", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "Abra a página de autorização oficial do Trae SOLO (trae.cn) e entre com sua conta Trae: ao concluir a autorização, a página oficial redireciona de volta para uma porta temporária desta máquina; implantações na mesma máquina recebem automaticamente, e no Docker / painel remoto copie o endereço de callback da barra de endereços conforme as instruções.", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "Abra a página de login oficial do Accio {label} ({site}) e entre com sua conta Accio: após o login, a página oficial redireciona de volta para esta máquina; na mesma máquina tudo se completa automaticamente, e no Docker / painel remoto basta colar o endereço de callback conforme as instruções (o código de autorização é passado ao gateway apenas nesta máquina, e nenhum token em texto claro é exibido na interface).", "打开 Accio {label}登录页": "Abrir a página de login do Accio {label}", "打开 Antigravity 网页登录": "Abrir login web do Antigravity", "打开 CatPaw 网页登录": "Abrir o login web do CatPaw", "打开 Cline 授权页": "Abrir a página de autorização do Cline", "打开 CodeArts 授权页": "Abrir a página de autorização do CodeArts", "打开 Qoder 网页登录": "Abrir o login web do Qoder", "打开 Trae 授权页": "Abrir a página de autorização do Trae", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "Abra a página de autorização oficial do ZCode {label} e entre com sua conta. O resultado da autorização é registrado pelo servidor do ZCode; o gateway busca a credencial em segundo plano e a adiciona à lista de contas.", "打开 ZCode {label}授权页": "Abrir a página de autorização do ZCode {label}", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "Abra a página de autorização oficial do Huawei Cloud CodeArts para entrar: após o login, a página oficial leva o navegador de volta ao /oauth/callback do próprio gateway, e o gateway troca o código de autorização de uso único por credenciais temporárias e adiciona a conta à lista.
    Quando o gateway roda em outra máquina, a interface web pede para colar o endereço de callback final da barra de endereços de volta no painel.", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "Abra a página de autorização do Huawei Cloud e faça login: ao concluir, o gateway consulta a nuvem automaticamente para obter o código de autorização e adiciona a conta à lista (não é preciso instalar o aplicativo de desktop do OfficeAce nem colar manualmente uma URL de retorno).", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "Abra a página de autorização oficial e conclua a autorização por código de dispositivo; a conta usada é do {label} ({site}).", "打开授权页": "Abrir a página de autorização", "打开授权页完成确认,账号自动加入 {label}{note}": "Abra a página de autorização e confirme; a conta entra automaticamente em {label}{note}", "打开方式": "Como abrir", "打开网页登录": "Abrir login web", "探测失败:{message}": "Falha na detecção: {message}", "接入一个兼容上游": "Conectar um upstream compatível", "提交中…": "Enviando…", "搜索提供商": "Buscar provedores", "搜索提供商…": "Buscar provedores…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "Cole o JSON de credencial inteiro gravado pelo plugin oficial / CLIProxyAPI (no formato {\"codearts_provider_credential\":{…}}; a versão achatada também serve).
    Obrigatórios: access_key_id, secret_access_key, security_token.Para renovar automaticamente, é preciso colar também refresh_token e oauth_context — as credenciais temporárias expiram em cerca de uma hora, e sem essa parte não há como renovar; será preciso fazer login de novo.", "文件是{edition}凭证,已按该版本导入": "O arquivo contém credenciais da {edition} e foi importado como tal", "新建自定义提供商": "Novo provedor personalizado", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "JWT em texto claro ou o valor criptografado enc: do auth.json (descriptografado automaticamente)", "明文 JWT(国际版账号的 access token)": "JWT em texto claro (o access token da conta da edição internacional)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "Plano Coding do bigmodel.cn da Zhipu; obtenha a Key em open.bigmodel.cn/usercenter/apikeys", "未知错误": "Erro desconhecido", "未能获取授权地址,请重试": "Não foi possível obter o endereço de autorização; tente novamente", "未能读取 cc-switch 数据": "Não foi possível ler os dados do cc-switch", "未领取成功": "Resgate não concluído", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "Marque esta opção para upstreams como o Ollama local ou o nível gratuito do OpenCode Zen; caso contrário, a conta não funcionará", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "Este provedor tem duas credenciais que **não se substituem**; preencha as que correspondem aos recursos que você vai usar, pelo menos uma: a API Key do Coding Plan serve para encaminhar inferência (acessa {site}) e para consultar os limites de janela (a porcentagem restante de cada janela de N horas / semanal); o jwt serve para resgatar planos e consultar saldo (acessa o gateway de billing em zcode.z.ai; oficialmente chamado Coding Plan JWT, uma string de três segmentos separados por ponto). As duas consultam saldo, mas leem coisas diferentes: o jwt lê os baldes de saldo e a expiração do plano, enquanto a API Key lê os limites de janela; e o resgate só aceita o jwt, o encaminhamento só aceita a API Key. Preencha a credencial da conta {label} — {plan} (a forma mais fácil: use o \"Login web\" acima — ele troca essa API Key por você e obtém as duas credenciais de uma vez.)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "Endpoint compatível com OpenAI do Ollama local; não precisa de API Key (a opção \"Este upstream não exige autenticação\" já vem marcada e nenhum cabeçalho de autenticação é enviado)", "本次未确认到账": "Crédito não confirmado desta vez", "条可导入": "importáveis", "条配置,其中": "configurações no cc-switch, das quais", "桌面运行时不可用(Tauri 未初始化)": "Runtime do desktop indisponível (Tauri não inicializado)", "模型网关基址": "Endereço base do gateway de modelos", "正在打开百度登录页…": "Abrindo a página de login do Baidu…", "正在扫描本机 cc-switch…": "Escaneando o cc-switch desta máquina…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "Aguardando a conclusão do login de {name}; só após concluir ou cancelar você pode iniciar um novo login", "每周": "Semanal", "每日": "Diário", "每月": "Mensal", "没有则无法自动续期": "Sem ele, não é possível renovar automaticamente", "没有匹配「{keyword}」的提供商": "Nenhum provedor corresponde a \"{keyword}\"", "添加 {name} 账号": "Adicionar conta {name}", "添加中…": "Adicionando…", "添加到 ": "Adicionar a ", "添加失败:{reason}": "Falha ao adicionar: {reason}", "添加小浣熊账号": "Adicionar conta Raccoon", "添加方式": "Forma de adicionar", "添加账号": "Adicionar conta", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "Plano Coding do Volcano Engine; o endpoint de inferência geral é https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "Clique para adicionar uma conta", "点开即预填,填 Key 接入": "Abre já preenchido; informe a Key para conectar", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "Após clicar no botão, primeiro passe por uma verificação de slider (controle de risco do provedor); em seguida a página de login abre e a conta é adicionada automaticamente ao concluir o login.
    Esta é a única forma oficial de login da edição internacional; se você já entrou no cliente, \"Importar sessão de login do desktop\" é mais rápido.", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "Entre com o celular vinculado à conta AutoClaw: clique em \"Obter código\", informe o código recebido por SMS abaixo e entre. O código é enviado desta máquina diretamente à API oficial, e nenhum token é exibido na interface.", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "Conclua o login com sua conta CatPaw (Meituan Passport); em caso de sucesso, a conta entra automaticamente na lista.", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "Entre com o celular vinculado à conta Loomy: clique em \"Obter código\" e informe o código. Esta é a forma mais simples neste provedor.", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "Usado para encaminhamento; no formato apiKey.secret, dois segmentos separados por ponto (se vazio, esta conta não pode encaminhar)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "Usado para resgatar planos e consultar saldo; se vazio, esta conta não pode resgatar nem consultar saldo", "用户 ID": "ID do usuário", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "Entre com o celular vinculado: clique em \"Obter código\" e informe o código. Esta é a única forma oficial de login da edição da China.", "留空则用提供商名称": "Se vazio, usa o nome do provedor", "登录 / 添加 {name} 账号": "Entrar / adicionar conta {name}", "登录 session(一长串)": "Sessão de login (uma string longa)", "登录中…": "Entrando…", "登录失败:{message}": "Falha no login: {message}", "登录已结束": "Login encerrado", "登录并添加": "Entrar e adicionar", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "Caminho do arquivo de sessão de login: ~/.box-agent/config/auth.json (Windows: C:\\Users\\\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "Excluir o provedor personalizado \"{name}\"? Isso também excluirá {count} contas desse provedor; a exclusão não pode ser desfeita.", "等待 Accio {label}登录完成…": "Aguardando a conclusão do login do Accio {label}…", "等待 CatPaw 登录完成…": "Aguardando a conclusão do login do CatPaw…", "等待 Cline 授权确认…": "Aguardando a confirmação de autorização do Cline…", "等待 CodeArts 登录完成…": "Aguardando a conclusão do login do CodeArts…", "等待 Google 授权完成…": "Aguardando a conclusão da autorização do Google…", "等待 KukuAI 登录完成…": "Aguardando a conclusão do login do KukuAI…", "等待 OfficeAce 登录完成…": "Aguardando a conclusão do login do OfficeAce…", "等待 Qoder 授权完成…": "Aguardando a conclusão da autorização do Qoder…", "等待 Trae 授权完成…": "Aguardando a conclusão da autorização do Trae…", "等待 ZCode {label}授权完成…": "Aguardando a conclusão da autorização do ZCode {label}…", "等待小浣熊登录完成…": "Aguardando a conclusão do login do Raccoon…", "等待登录完成…": "Aguardando a conclusão do login…", "等待网页登录…": "Aguardando o login web…", "粘贴 API Key": "Colar API Key", "粘贴 API 令牌": "Colar token de API", "粘贴 Accio 的 accessToken": "Colar o accessToken do Accio", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "Cole o Google refresh token do Antigravity (começa com 1//; também pode colar a linha inteira que contém refresh_token=).
    Esta é uma entrada manual além do login web (por exemplo, exportada do IDE oficial em que você já está conectado). O refresh token não expira, e o gateway renova o access token automaticamente ao expirar; se o token for perdido, só resta refazer a autorização do Google, então guarde-o bem.", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "Cole a API Key do Command Code (começa com user_; obtenha no ~/.commandcode/auth.json do CLI oficial ou no studio web). Colar a linha inteira / com aspas / com o prefixo Bearer funciona; o gateway extrai a key pura sozinho. A key não expira e não há API de renovação, então basta obter uma nova se ela deixar de funcionar. Ao adicionar, o gateway faz uma verificação leve de atividade; uma falha não impede a adição.", "粘贴 Cookie": "Colar Cookie", "粘贴 Google refresh token": "Colar Google refresh token", "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "Cole um token de API do ModelScope (começando com ms-, obtido na página \"Tokens de acesso\" em {site}).
    {siteNote}
    Este token tem dupla finalidade: o gateway o usa tanto para chamar a inferência quanto para ler a identidade da conta, o saldo de Magicubes e o check-in diário. O token é de longa duração e não há API de renovação; se parar de funcionar, basta obter um novo e colar de novo.", "粘贴 Qoder 个人访问令牌(pt-…)": "Colar o token de acesso pessoal do Qoder (pt-…)", "粘贴 access_token(一长串 JWT)": "Colar o access_token (um JWT longo)", "粘贴 session cookie": "Colar session cookie", "粘贴 token / refreshToken": "Colar token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "Cole um token começando com workos:… (o prefixo é adicionado automaticamente se faltar)", "粘贴登录凭据": "Colar credenciais de login", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "O que você cola é a sessão de login (que também é o token do gateway de modelos). O Loomy não tem API de renovação; a sessão vale cerca de 14 dias, então basta entrar de novo após expirar.", "粘贴网关凭据": "Colar credenciais do gateway", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "Cole o valor do cookie de sessão de login web monkeycode_ai_session (copiar o Cookie inteiro no navegador e colar diretamente também funciona; o gateway extrai o valor sozinho).
    {siteNote}
    O MonkeyCode não tem API de renovação: a sessão vale cerca de 30 dias (limite rígido); quando expirar, entre novamente no site e cole mais uma vez.", "系统浏览器": "Navegador do sistema", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "O navegador do sistema pode reaproveitar a sessão de login existente (recomendado para a edição internacional); a janela embutida é mais limpa.", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Cline já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "Abre no navegador do sistema (reutiliza a conta Google já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Zai / Google já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta Meituan já conectada); ao concluir, entra automaticamente na lista", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "Abre no navegador do sistema (reaproveita a conta já conectada); ao concluir, entra automaticamente na lista", "系统默认浏览器": "Navegador padrão do sistema", "编码套餐 API Key": "API Key do Coding Plan", "网关 Secret": "Segredo do gateway", "网页登录": "Login web", "网页登录的打开方式": "Como abrir o login web", "网页登录(Zai / Google)": "Login web (Zai / Google)", "自定义": "Personalizado", "获取风控配置失败,将直接尝试领取:{message}": "Falha ao obter a configuração de controle de risco; tentando resgatar diretamente: {message}", "获取验证码": "Obter código", "该上游无需鉴权(不发送鉴权头)": "Este upstream não exige autenticação (nenhum cabeçalho de autenticação é enviado)", "该提供商": "Este provedor", "该提供商账号添加功能即将上线": "A adição de contas deste provedor chega em breve", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "Este provedor personalizado não existe mais (pode ter sido excluído); atualize e tente novamente", "请先选择一个自定义提供商": "Selecione primeiro um provedor personalizado", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "Conclua a verificação no slider exibido (etapa de controle de risco exigida pelo provedor)", "请填写 11 位大陆手机号": "Informe um número de celular da China continental com 11 dígitos", "请填写 6 位数字验证码": "Informe o código de 6 dígitos", "请填写 Base URL": "Preencha a Base URL", "请填写 {label}": "Preencha {label}", "请填写名称": "Preencha o nome", "请完成验证…": "Conclua a verificação…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "Lê e descriptografa %APPDATA%/AutoClaw/auth.json; somente no Windows", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "Lê ~/.cline/data/settings/providers.json; requer login no cliente Cline", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "Lê ~/.meituan-catpaw/auth.json; requer login no cliente CatPaw", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "Lê a sessão de login do cliente KukuAI desta máquina (%APPDATA%\\baidugenflowpro\\Network\\Cookies); requer login no cliente KukuAI", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "Lê a sessão de login atual do cliente desta máquina (Cookie em texto claro, sem descriptografia). Com o cliente em execução, o arquivo Cookies fica em uso exclusivo; feche o cliente KukuAI antes de importar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente).", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, clique em \"Atualizar Token\" para sincronizar.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Após entrar novamente no cliente, basta importar de novo.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Usuários que entram no cliente com Zai / Google devem usar esta opção.", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "Lê a sessão de login atual do cliente desta máquina, em tempo real a cada vez (excluir este registro não afeta a sessão de login do cliente). Esta opção fica em {label}.", "账号信息": "Informações da conta", "账号信息不完整,请刷新后重试": "Informações da conta incompletas; atualize e tente novamente", "账号已添加,但请留意:{warning}": "Conta adicionada, mas atenção: {warning}", "账号版本": "Edição da conta", "账号类型": "Tipo de conta", "账号:{name}
    ": "Conta: {name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "Usa a rota Inference Providers; crie a Key em hf.co/settings/tokens", "还没有账号": "Ainda não há contas", "这一家当前不支持网页登录,请改用填写凭证": "Este provedor não suporta login web no momento; use \"Preencher credenciais\"", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "Esta conta não tem campanhas com resgate automático no momento (apenas os pontos de brinde do login diário são resgatados automaticamente)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "Esta cota passa pelo canal \"Start Plan\": se o encaminhamento avisar que o Coding Plan expirou, ", "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "Aqui é a conta do site da China (modelscope.cn): cole o token do site da China. O site internacional (modelscope.ai) é outro provider com outra conta; os tokens não são intercambiáveis entre os dois.", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site da China (monkeycode-ai.com): cole a sessão do site da China. O site internacional (monkeycode-ai.net) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "Aqui é a conta do site internacional (modelscope.ai): cole o token do site internacional. O site da China (modelscope.cn) é outro provider com outra conta; os tokens não são intercambiáveis entre os dois.", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "Aqui é a conta do site internacional (monkeycode-ai.net): cole a sessão do site internacional. O site da China (monkeycode-ai.com) é outro provedor, com conta própria; as credenciais não são compartilhadas entre os dois.", "选择凭证文件导入": "Importar de arquivo de credenciais", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "Selecione o arquivo de credenciais de sessão do cliente oficial (workbuddy-desktop.info / workbuddy-desktop-ai.info) ou um JSON de conta exportado pelo wb2api (formato aninhado ou plano); também é possível ler diretamente do cliente oficial nesta máquina.", "选择提供商": "Selecionar provedor", "选择的文件不是合法 JSON": "O arquivo selecionado não é um JSON válido", "选择要添加账号的提供商": "Selecione o provedor para adicionar uma conta", "重新扫描": "Escanear novamente", "鉴权": "Autenticação", "阿里云 Token Plan 套餐(国际站)": "Plano Token Plan do Alibaba Cloud (site internacional)", "阿里云百炼 Coding 套餐(国内站)": "Plano Coding do Alibaba Cloud Model Studio (site da China)", "阿里云百炼 Coding 套餐(国际站)": "Plano Coding do Alibaba Cloud Model Studio (site internacional)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "Serviço de modelos Alibaba Cloud Model Studio (site internacional, modo compatível com OpenAI)", "需要图形验证码:登录窗口已弹出,请填写后继续": "Captcha necessário: a janela de login foi aberta; preencha para continuar", "预置 API": "API predefinida", "领取 CodeArts 每日福利": "Resgatar benefício diário do CodeArts", "领取失败:{message}": "Falha ao resgatar: {message}", "领取并让官方确认": "Resgatar e aguardar confirmação oficial", "风控验证配置不完整,请稍后重试": "Configuração de verificação de controle de risco incompleta; tente novamente mais tarde", "验证码": "Código de verificação", "验证码已发送。收到后填入下方并点「登录并添加」": "Código enviado. Informe-o abaixo e clique em \"Entrar e adicionar\"", "验证码已发送,请查看手机短信": "Código enviado; verifique o SMS", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "Código enviado; verifique o SMS. Informe-o abaixo e clique em \"Entrar e adicionar\" para concluir o login", "验证码已发送,请查看短信": "Código enviado; verifique as mensagens", "验证码校验失败,请重试": "Falha na verificação do captcha; tente novamente", "验证码校验超时,请重试": "Tempo esgotado na verificação do captcha; tente novamente", "验证码组件不可用,请重试": "Componente de captcha indisponível; tente novamente", "验证码组件初始化超时,请重试": "Tempo esgotado ao inicializar o componente de captcha; tente novamente", "验证码组件加载失败,请检查网络后重试": "Falha ao carregar o componente de captcha; verifique a rede e tente novamente", "验证码组件加载异常,请重试": "Erro ao carregar o componente de captcha; tente novamente", "验证码组件加载超时,请检查网络后重试": "Tempo esgotado ao carregar o componente de captcha; verifique a rede e tente novamente", "验证码组件未加载,请重启应用后重试": "O componente de captcha não foi carregado; reinicie o aplicativo e tente novamente", "(免费额度池,模型名带 cline-free/ 前缀)。": " (pool de cota gratuita; nomes de modelo com o prefixo cline-free/).", "(其中 {n} 把恢复为不限制)": " ({n} das quais voltaram a ser ilimitadas)", "(必填)": " (obrigatório)", "(有效期 {window})": "(validade {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": " (pool de assinatura; nomes de modelo com o prefixo cline-pass/, e a conta precisa da assinatura correspondente).", ",下一次最快 {minutes} 分钟后": ", próxima tentativa em pelo menos {minutes} min", ",并从 {n} 把 Key 的可用提供商里移除": ", e removido dos provedores permitidos de {n} keys" }); diff --git a/desktop-tauri/ui/i18n/pt-BR/checkin.js b/desktop-tauri/ui/i18n/pt-BR/checkin.js index 343dc5c5..5f7fff72 100644 --- a/desktop-tauri/ui/i18n/pt-BR/checkin.js +++ b/desktop-tauri/ui/i18n/pt-BR/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:pt-BR/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "Resgate de checkin_credits do SOLO · redefinido às 0h do dia natural", "UMID 组件安装失败:{error}": "Falha ao instalar o componente UMID: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Consulte a árvore de tarefas e acenda / resgate com um clique · inclui o evento de volta às aulas e a viagem do gato · clique na linha para detalhes", "WorkBuddy 国际版保活模型,按顺序回退": "Modelos do WorkBuddy internacional para manter ativo, com fallback em ordem", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Modelos gratuitos da atividade diária do WorkBuddy Internacional · uma configuração global, independente dos agendamentos", "{date}(每天 {time})": "{date} (todos os dias às {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} para concluir", "{n} 项待领": "{n} itens a resgatar", "{total} 账号 · {done} 已签": "{total} contas · {done} com check-in", "{total} 项任务 · {pending} 项可完成": "{total} tarefas · {pending} para concluir", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ Componente UMID instalado; no próximo check-in já dá para resgatar os pontos da edição internacional", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Check-in agendado ativado", "✅ 开学季任务执行完成": "✅ Tarefas de volta às aulas concluídas", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Tarefas de crescimento concluídas: créditos +{credit}, energia +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Benefícios iniciais resgatados, {n} pontos no total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in concluído: {succeeded}/{total} contas resgataram com sucesso{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; envie vazio para restaurar o padrão ({defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; limpar a lista e salvar restaura a cadeia padrão (padrão atual: {defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「免费领积分」的每日任务 · 逐个领取": "Tarefa diária do “Ganhe pontos grátis” · resgate um a um", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "Benefício único · consultado e resgatado automaticamente após o check-in; depois de resgatado, fica registrado localmente e o upstream não é mais consultado · clique na linha para expandir a lista de tarefas", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários) · idempotência garantida pelo upstream", "一键安装组件": "Instalar componente", "一键完成": "Concluir tudo", "一键领取({n})": "Resgatar todos ({n})", "上次执行:{line}": "Última execução: {line}", "上次签到时间": "Último check-in", "上次领取 {time} · 领取需通过滑块验证码": "Último resgate: {time} · o resgate exige captcha deslizante", "下次 {date}": "Próxima {date}", "下次 {date} · 点此管理条目": "Próxima {date} · clique para gerenciar os agendamentos", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo; o resgate diário/de planos dele e do ZCode fica em \"Benefícios de atividade\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo, e o benefício diário dele fica logo acima em \"Check-in diário\"; o resgate de planos do ZCode fica em \"Benefícios de atividade\".", "与国内版同一套任务接口 · 站点不同": "Mesma interface de tarefas da edição da China · site diferente", "今天已领 {n} 份": "{n} resgatado(s) hoje", "今天未领": "Não resgatado hoje", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Resgatado hoje (horário de Pequim, {day}) · {n} itens confirmados oficialmente · amanhã é possível resgatar novamente", "今日已执行": "Executado hoje", "今日已派出": "Já enviado hoje", "今日已领取": "Resgatado hoje", "今日签到": "Check-in de hoje", "今日签到进度": "Progresso do check-in de hoje", "从清单里移除": "Remover da lista", "保活": "Manter ativo", "保活 {n}": "{n} mantidos ativos", "保活+领取": "Manter ativo + Resgatar", "保活中…": "Mantendo ativo…", "保活模型链": "Cadeia de modelos para manter ativo", "全选": "Selecionar tudo", "全部 {n} 家": "Todos os {n} provedores", "全部完成": "Tudo concluído", "全部查询": "Consultar todos", "全部结果": "Todos os resultados", "全部账号均可签到": "Todas as contas podem fazer check-in", "全部领取": "Resgatar todos", "关着:所有条目都不执行": "Desligado: nenhum agendamento é executado", "删除失败:{error}": "Falha ao excluir: {error}", "删除定时条目": "Excluir agendamento", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o CodeArts resgata o benefício de campanha do dia (resgatar → confirmar → reler para verificar; execuções automáticas têm limite de 6 gravações por dia com intervalo de 10 minutos); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点时逐个签到,已勾 {n} / {total} 家": "{n} de {total} marcados — o check-in é feito um por um no horário", "北京时间 · 错过时点开机后会自动补签": "Horário de Pequim · execuções perdidas são compensadas automaticamente ao iniciar", "去领取": "Resgatar", "另有 {n} 个账号不参与每日签到": "Outras {n} contas não participam do check-in diário", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Resgatar apenas recompensas de tarefas concluídas (idempotente; cliques repetidos não creditam em dobro)", "可完成": "Pode concluir", "可派出": "Pode enviar", "可选 · 缺省显示时刻": "Opcional · usa o horário como padrão", "可领奖": "Pode resgatar", "后端未返回定时签到数据": "O backend não retornou dados de agendamento", "后端未返回签到中心数据": "O backend não retornou os dados da central de check-in", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "O check-in da edição internacional exige o componente UMID para gerar a identidade de controle de risco do dispositivo (não detectado nesta máquina).", "在途": "Em viagem", "填入缺省链": "Preencher cadeia padrão", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Escolha o horário e os provedores e clique em Salvar; o nome é opcional (quando vazio, mostra-se o horário)", "失败 {n}": "{n} com falha", "套餐明细": "Detalhes dos planos", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Basta instalar o cliente Qoder ou o qodercli (não é preciso reiniciar o gateway).", "安装中…": "Instalando…", "官方客户端的每日签到任务": "Tarefa de check-in diário do cliente oficial", "定时签到": "Check-in agendado", "定时签到已关闭": "Check-in agendado desativado", "尚未查询": "Ainda não consultado", "尚未查询任务状态": "Status das tarefas ainda não consultado", "巡检一次": "Executar uma rodada", "已保存:{label}": "Salvo: {label}", "已保存:保活模型链": "Salvo: cadeia de modelos para manter ativo", "已保存:定时条目": "Salvo: agendamento", "已删除定时条目": "Agendamento excluído", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Atividade reportada (ofensiva acesa), mas a campanha não está ativa (nada para resgatar desta vez)", "已抽 {n} 次": "Sorteou {n} vezes", "已有结果 {checked} / 共 {total} 个账号": "Já com resultado: {checked} / {total} contas", "已签": "Com check-in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Resgatado {claimed}/{total} · {earned} pontos acumulados", "已领养": "Adotado", "已领取": "Resgatado", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Resgatar “100 Credits diários” com a identidade de controle de risco do dispositivo · requer o componente UMID", "开学季执行失败:{error}": "Falha na execução de volta às aulas: {error}", "开学季执行完成:{message}": "Execução de volta às aulas concluída: {message}", "开学季活动": "Evento de volta às aulas", "开着:启用的条目按各自时刻执行": "Ligado: agendamentos habilitados rodam em seus próprios horários", "待签": "Pendente", "待领新手福利": "Benefícios iniciais pendentes", "总开关": "Interruptor principal", "总开关已关闭 · 在「定时签到」页打开": "Interruptor principal desligado · ative na aba \"Check-in agendado\"", "成功 {n}": "{n} com sucesso", "成长任务": "Tarefas de crescimento", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Tarefas de crescimento concluídas ({done} com sucesso, {failed} com falha): créditos +{credit}, energia +{energy}", "成长任务执行失败:{error}": "Falha na execução das tarefas de crescimento: {error}", "执行失败:{error}": "Falha na execução: {error}", "执行并抽奖": "Executar e sortear", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Executar as tarefas de volta às aulas e gastar todas as chances de sorteio (compartilhar / conversar / eventos de especialista)", "把缺省链填进清单,再点「保存」生效": "Coloca a cadeia padrão na lista; clique em Salvar para aplicar", "抽奖机会 {n} 次": "{n} chances de sorteio", "按住拖动调整顺序": "Pressione e arraste para reordenar", "按住拖动,调整这个模型在链里的顺序": "Pressione e arraste para mudar a posição deste modelo na cadeia", "按序逐个尝试,共 {n} 个": "{n} modelos, tentados em ordem", "按结果筛选": "Filtrar por resultado", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detectar + resgatar + manter ativo · mesma combinação do check-in agendado", "探测活动并领取日活奖励 · 不做保活": "Detectar o evento e resgatar a recompensa de atividade diária · sem manter ativo", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Aceitar + acender + resgatar (apenas tarefas com receita verificada)", "搜账号 / 收益 / 错误 / 触发原因": "Pesquisar conta / ganho / erro / motivo do disparo", "收起新建": "Fechar novo item", "新建定时条目": "Nova entrada agendada", "新手福利": "Benefícios iniciais", "新手福利有 {n} 项领取失败,可重试": "{n} item(ns) dos benefícios iniciais falharam no resgate — é possível tentar novamente", "无": "Nenhum", "无独立签到接口 · 每天替账号打一次首次登录积分": "Sem interface de check-in própria · credita uma vez por dia os pontos de primeiro login da conta", "无账号": "Sem contas", "暂不可领": "Indisponível", "暂不支持": "Ainda não suportado", "暂无启用的条目 · 点此添加": "Nenhum agendamento habilitado · clique para adicionar", "有未保存的改动": "Alterações não salvas", "未勾选提供商": "Nenhum provedor selecionado", "未开启": "Desativado", "未解锁": "Bloqueado", "未领养(领养需先完成当日对话量)": "Não adotado (a adoção exige cumprir a cota diária de conversas primeiro)", "未领取": "Não resgatado", "本地台账里今天还没领过;活动期内每天发一份新套餐": "O registro local ainda não tem resgate nenhum hoje; um novo plano é emitido todo dia durante o evento", "本地台账里今天(北京时间)领过的套餐:{plans}": "Planos resgatados hoje (horário de Pequim) conforme o registro local: {plans}", "条启用": "habilitado(s)", "查询于 {time}": "Consultado em {time}", "查询任务": "Consultar tarefas", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Consulte a árvore de tarefas e acenda / resgate com um clique (inclui volta às aulas e viagem do gato)", "查询失败:{error}": "Falha na consulta: {error}", "桌面端每日积分链路": "Fluxo diário de pontos do aplicativo desktop", "正在读取定时签到数据…": "Carregando dados de agendamento…", "正在读取签到数据…": "Lendo os dados de check-in…", "每天 {time}": "Todos os dias às {time}", "每天 {time} · {scope}": "Diário {time} · {scope}", "每天时刻": "Horário diário", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "Uma linha por conta a cada execução · resultados e ganhos conforme registrado pelo backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Tarefas de atividade diária · uma conversa no canal web acende a atividade diária, só o resgate adiciona pontos · os dois podem ser executados separadamente", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Benefício diário · resgatar → confirmar → reler para verificar · redefinido no dia natural (horário de Pequim)", "每日签到": "Check-in diário", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Cada agendamento tem horário e escopo próprios · deduplicação diária por item · execuções perdidas são compensadas ao iniciar", "每账号一条明细 · 点此查看「签到记录」": "Uma linha por conta · abra \"Registros de check-in\"", "没有可领套餐的账号(ZCode 未添加)。": "Nenhuma conta com planos resgatáveis (ZCode não adicionado).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "Nenhuma conta com benefícios para resgatar (CodeArts / ZCode não foram adicionados).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "Nenhuma conta suporta tarefas de crescimento (requer WorkBuddy CN).", "没有支持新手福利的账号": "Nenhuma conta suporta benefícios iniciais", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "Nenhuma conta suporta benefícios iniciais — atualmente Loomy, Raccoon e CodeArts.", "没有符合筛选条件的签到记录": "Nenhum registro de check-in corresponde aos filtros", "没有需要执行的任务": "Nada para executar", "活动福利": "Recompensas de evento", "活动(campaign)领取 · 每天 10:00 刷新": "Resgate de eventos (campaign) · atualizado todos os dias às 10:00", "活跃上报与保活均未成功,且活动未开启": "Tanto o relatório de atividade quanto o keep-alive falharam, e a campanha não está ativa", "活跃上报完成,但保活未成功且活动未开启": "Atividade reportada, mas o keep-alive falhou e a campanha não está ativa", "活跃上报完成,但活动未开启": "Atividade reportada, mas a campanha não está ativa", "活跃上报成功": "Atividade reportada com sucesso", "活跃保活失败": "Falha ao manter a atividade", "活跃保活完成": "Atividade mantida", "活跃保活完成,但活动未开启": "Atividade mantida, mas o evento não está aberto", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive concluído, mas o relatório de atividade falhou e a campanha não está ativa", "添加条目": "Adicionar agendamento", "添加模型": "Adicionar modelo", "清单为空 —— 保存后恢复缺省链": "A lista está vazia — salvar restaura a cadeia padrão", "清单里已经有「{name}」": "A lista já contém \"{name}\"", "清空失败:{error}": "Falha ao limpar: {error}", "清空签到记录": "Limpar registros de check-in", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Clique em \"Detalhes dos planos\" para ver quais você recebeu e quando entram em vigor; dá para resgatar de novo todo dia durante o evento", "点击行展开账号明细 · 单账号签到不受范围限制": "Clique na linha para expandir os detalhes das contas · o check-in individual não é limitado pelo escopo", "独立链路 · 只提供手动入口 · 不进自动签到": "Fluxo independente · apenas entrada manual · não participa do check-in automático", "猫猫旅行": "Viagem do gato", "猫猫旅行失败:{error}": "Falha na viagem do gato: {error}", "猫猫旅行失败:{message}": "Falha na viagem do gato: {message}", "猫猫旅行:{message}": "Viagem do gato: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Manter a conta ativa com modelos gratuitos e uma conversa no canal web · sem resgatar recompensas", "确定删除「{name}」?删除后到点不再执行。": "Excluir \"{name}\"? Ele não será mais executado no horário agendado.", "确定清空全部签到记录?清空后无法恢复。": "Limpar todos os registros de check-in? Isso não pode ser desfeito.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Limpar os registros de check-in filtrados? Isso não pode ser desfeito.", "移除 {name}": "Remover {name}", "立即全部签到": "Fazer check-in de todos agora", "签到": "Check-in", "签到中…": "Fazendo check-in…", "签到中心分区": "Seções do centro de check-in", "签到失败:{error}": "Falha no check-in: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in concluído: {succeeded}/{total} com sucesso{active}; {failed} com falha", "签到成功": "Check-in bem-sucedido", "签到提供商": "Provedores de check-in", "签到范围": "Escopo do check-in", "签到触发时刻": "Horário de disparo do check-in", "签到记录": "Registros de check-in", "签到记录时间范围": "Período dos registros de check-in", "签到记录表": "Tabela de registros de check-in", "累计签到记录": "Total de registros de check-in", "结算于 {time}": "Liquidado em {time}", "能量 {n}": "Energia {n}", "腾讯每日签到接口 · 仅国内版": "Interface de check-in diário da Tencent · apenas edição da China", "至少勾一家才能保存(不勾等于这条条目不签到)": "Selecione ao menos um provedor para salvar (sem seleção, esta entrada não faz check-in)", "读取定时签到数据失败:{error}": "Falha ao carregar dados de agendamento: {error}", "读取签到数据失败:{error}": "Falha ao ler os dados de check-in: {error}", "读取签到记录失败:{error}": "Falha ao carregar registros de check-in: {error}", "跳过 {n}": "{n} ignorados", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Entrega de eventos oficiais (resgatar → confirmar → reler para verificar) · resgate dos pontos de bônus do plano", "还没执行过": "Ainda não executado", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "Nenhum agendamento ainda — clique em \"Adicionar agendamento\" para criar um, ou faça check-in manualmente no \"Centro de check-in\".", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "Nenhum registro de check-in ainda — os detalhes aparecem aqui após um check-in manual ou uma execução agendada.", "连登 {n} 天": "Sequência de {n} dias", "部分": "Parcial", "重签": "Refazer check-in", "重试": "Tentar de novo", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Plano de teste por tempo limitado · o resgate exige CAPTCHA de arrastar · veja e resgate um a um", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Plano de teste por tempo limitado (start-plan), um por dia durante o evento · o resgate exige captcha deslizante", "需真实操作": "Requer ação real", "非活动期": "Evento inativo", "项": "itens", "领取": "Resgatar", "领取中": "Resgatando", "领取中…": "Resgatando…", "领取失败": "Falha no resgate", "领取失败:{error}": "Falha no resgate: {error}", "(共 {n} 个账号)": "({n} contas no total)", "(能量 / 连登读数本次未取到)": "(Leituras de energia / sequência indisponíveis desta vez)", ",日活保活 {n} 个": ", {n} mantidas ativas" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "Resgate de checkin_credits do SOLO · redefinido às 0h do dia natural", "UMID 组件安装失败:{error}": "Falha ao instalar o componente UMID: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Consulte a árvore de tarefas e acenda / resgate com um clique · inclui o evento de volta às aulas e a viagem do gato · clique na linha para detalhes", "WorkBuddy 国际版保活模型,按顺序回退": "Modelos do WorkBuddy internacional para manter ativo, com fallback em ordem", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Modelos gratuitos da atividade diária do WorkBuddy Internacional · uma configuração global, independente dos agendamentos", "{date}(每天 {time})": "{date} (todos os dias às {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} para concluir", "{n} 项待领": "{n} itens a resgatar", "{total} 账号 · {done} 已签": "{total} contas · {done} com check-in", "{total} 项任务 · {pending} 项可完成": "{total} tarefas · {pending} para concluir", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ Componente UMID instalado; no próximo check-in já dá para resgatar os pontos da edição internacional", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Check-in agendado ativado", "✅ 开学季任务执行完成": "✅ Tarefas de volta às aulas concluídas", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Tarefas de crescimento concluídas: créditos +{credit}, energia +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Benefícios iniciais resgatados, {n} pontos no total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in concluído: {succeeded}/{total} contas resgataram com sucesso{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; envie vazio para restaurar o padrão ({defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; limpar a lista e salvar restaura a cadeia padrão (padrão atual: {defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「免费领积分」的每日任务 · 逐个领取": "Tarefa diária do “Ganhe pontos grátis” · resgate um a um", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "Benefício único · consultado e resgatado automaticamente após o check-in; depois de resgatado, fica registrado localmente e o upstream não é mais consultado · clique na linha para expandir a lista de tarefas", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários) · idempotência garantida pelo upstream", "一键安装组件": "Instalar componente", "一键完成": "Concluir tudo", "一键领取({n})": "Resgatar todos ({n})", "上次执行:{line}": "Última execução: {line}", "上次签到时间": "Último check-in", "上次领取 {time} · 领取需通过滑块验证码": "Último resgate: {time} · o resgate exige captcha deslizante", "下次 {date}": "Próxima {date}", "下次 {date} · 点此管理条目": "Próxima {date} · clique para gerenciar os agendamentos", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo; o resgate diário/de planos dele e do ZCode fica em \"Benefícios de atividade\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo, e o benefício diário dele fica logo acima em \"Check-in diário\"; o resgate de planos do ZCode fica em \"Benefícios de atividade\".", "与国内版同一套任务接口 · 站点不同": "Mesma interface de tarefas da edição da China · site diferente", "与国内版同一套链路 · 站点不同、令牌不通用": "Mesmo fluxo da edição China · site diferente, tokens não intercambiáveis", "今天已领 {n} 份": "{n} resgatado(s) hoje", "今天未领": "Não resgatado hoje", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Resgatado hoje (horário de Pequim, {day}) · {n} itens confirmados oficialmente · amanhã é possível resgatar novamente", "今日已执行": "Executado hoje", "今日已派出": "Já enviado hoje", "今日已领取": "Resgatado hoje", "今日签到": "Check-in de hoje", "今日签到进度": "Progresso do check-in de hoje", "从清单里移除": "Remover da lista", "保活": "Manter ativo", "保活 {n}": "{n} mantidos ativos", "保活+领取": "Manter ativo + Resgatar", "保活中…": "Mantendo ativo…", "保活模型链": "Cadeia de modelos para manter ativo", "全选": "Selecionar tudo", "全部 {n} 家": "Todos os {n} provedores", "全部完成": "Tudo concluído", "全部查询": "Consultar todos", "全部结果": "Todos os resultados", "全部账号均可签到": "Todas as contas podem fazer check-in", "全部领取": "Resgatar todos", "关着:所有条目都不执行": "Desligado: nenhum agendamento é executado", "删除失败:{error}": "Falha ao excluir: {error}", "删除定时条目": "Excluir agendamento", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o CodeArts resgata o benefício de campanha do dia (resgatar → confirmar → reler para verificar; execuções automáticas têm limite de 6 gravações por dia com intervalo de 10 minutos); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点时逐个签到,已勾 {n} / {total} 家": "{n} de {total} marcados — o check-in é feito um por um no horário", "北京时间 · 错过时点开机后会自动补签": "Horário de Pequim · execuções perdidas são compensadas automaticamente ao iniciar", "去领取": "Resgatar", "另有 {n} 个账号不参与每日签到": "Outras {n} contas não participam do check-in diário", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Resgatar apenas recompensas de tarefas concluídas (idempotente; cliques repetidos não creditam em dobro)", "可完成": "Pode concluir", "可派出": "Pode enviar", "可选 · 缺省显示时刻": "Opcional · usa o horário como padrão", "可领奖": "Pode resgatar", "后端未返回定时签到数据": "O backend não retornou dados de agendamento", "后端未返回签到中心数据": "O backend não retornou os dados da central de check-in", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "O check-in da edição internacional exige o componente UMID para gerar a identidade de controle de risco do dispositivo (não detectado nesta máquina).", "在途": "Em viagem", "填入缺省链": "Preencher cadeia padrão", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Escolha o horário e os provedores e clique em Salvar; o nome é opcional (quando vazio, mostra-se o horário)", "失败 {n}": "{n} com falha", "套餐明细": "Detalhes dos planos", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Basta instalar o cliente Qoder ou o qodercli (não é preciso reiniciar o gateway).", "安装中…": "Instalando…", "官方客户端的每日签到任务": "Tarefa de check-in diário do cliente oficial", "定时签到": "Check-in agendado", "定时签到已关闭": "Check-in agendado desativado", "尚未查询": "Ainda não consultado", "尚未查询任务状态": "Status das tarefas ainda não consultado", "巡检一次": "Executar uma rodada", "已保存:{label}": "Salvo: {label}", "已保存:保活模型链": "Salvo: cadeia de modelos para manter ativo", "已保存:定时条目": "Salvo: agendamento", "已删除定时条目": "Agendamento excluído", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Atividade reportada (ofensiva acesa), mas a campanha não está ativa (nada para resgatar desta vez)", "已抽 {n} 次": "Sorteou {n} vezes", "已有结果 {checked} / 共 {total} 个账号": "Já com resultado: {checked} / {total} contas", "已签": "Com check-in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Resgatado {claimed}/{total} · {earned} pontos acumulados", "已领养": "Adotado", "已领取": "Resgatado", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Resgatar “100 Credits diários” com a identidade de controle de risco do dispositivo · requer o componente UMID", "开学季执行失败:{error}": "Falha na execução de volta às aulas: {error}", "开学季执行完成:{message}": "Execução de volta às aulas concluída: {message}", "开学季活动": "Evento de volta às aulas", "开着:启用的条目按各自时刻执行": "Ligado: agendamentos habilitados rodam em seus próprios horários", "待签": "Pendente", "待领新手福利": "Benefícios iniciais pendentes", "总开关": "Interruptor principal", "总开关已关闭 · 在「定时签到」页打开": "Interruptor principal desligado · ative na aba \"Check-in agendado\"", "成功 {n}": "{n} com sucesso", "成长任务": "Tarefas de crescimento", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Tarefas de crescimento concluídas ({done} com sucesso, {failed} com falha): créditos +{credit}, energia +{energy}", "成长任务执行失败:{error}": "Falha na execução das tarefas de crescimento: {error}", "执行失败:{error}": "Falha na execução: {error}", "执行并抽奖": "Executar e sortear", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Executar as tarefas de volta às aulas e gastar todas as chances de sorteio (compartilhar / conversar / eventos de especialista)", "把缺省链填进清单,再点「保存」生效": "Coloca a cadeia padrão na lista; clique em Salvar para aplicar", "抽奖机会 {n} 次": "{n} chances de sorteio", "按住拖动调整顺序": "Pressione e arraste para reordenar", "按住拖动,调整这个模型在链里的顺序": "Pressione e arraste para mudar a posição deste modelo na cadeia", "按序逐个尝试,共 {n} 个": "{n} modelos, tentados em ordem", "按结果筛选": "Filtrar por resultado", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detectar + resgatar + manter ativo · mesma combinação do check-in agendado", "探测活动并领取日活奖励 · 不做保活": "Detectar o evento e resgatar a recompensa de atividade diária · sem manter ativo", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Aceitar + acender + resgatar (apenas tarefas com receita verificada)", "搜账号 / 收益 / 错误 / 触发原因": "Pesquisar conta / ganho / erro / motivo do disparo", "收起新建": "Fechar novo item", "新建定时条目": "Nova entrada agendada", "新手福利": "Benefícios iniciais", "新手福利有 {n} 项领取失败,可重试": "{n} item(ns) dos benefícios iniciais falharam no resgate — é possível tentar novamente", "无": "Nenhum", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "Sem API de check-in dedicada · acessa o endpoint de informações de login uma vez por dia por conta (o que concede os Magicubes diários)", "无独立签到接口 · 每天替账号打一次首次登录积分": "Sem interface de check-in própria · credita uma vez por dia os pontos de primeiro login da conta", "无账号": "Sem contas", "暂不可领": "Indisponível", "暂不支持": "Ainda não suportado", "暂无启用的条目 · 点此添加": "Nenhum agendamento habilitado · clique para adicionar", "有未保存的改动": "Alterações não salvas", "未勾选提供商": "Nenhum provedor selecionado", "未开启": "Desativado", "未解锁": "Bloqueado", "未领养(领养需先完成当日对话量)": "Não adotado (a adoção exige cumprir a cota diária de conversas primeiro)", "未领取": "Não resgatado", "本地台账里今天还没领过;活动期内每天发一份新套餐": "O registro local ainda não tem resgate nenhum hoje; um novo plano é emitido todo dia durante o evento", "本地台账里今天(北京时间)领过的套餐:{plans}": "Planos resgatados hoje (horário de Pequim) conforme o registro local: {plans}", "条启用": "habilitado(s)", "查询于 {time}": "Consultado em {time}", "查询任务": "Consultar tarefas", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Consulte a árvore de tarefas e acenda / resgate com um clique (inclui volta às aulas e viagem do gato)", "查询失败:{error}": "Falha na consulta: {error}", "桌面端每日积分链路": "Fluxo diário de pontos do aplicativo desktop", "正在读取定时签到数据…": "Carregando dados de agendamento…", "正在读取签到数据…": "Lendo os dados de check-in…", "每天 {time}": "Todos os dias às {time}", "每天 {time} · {scope}": "Diário {time} · {scope}", "每天时刻": "Horário diário", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "Uma linha por conta a cada execução · resultados e ganhos conforme registrado pelo backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Tarefas de atividade diária · uma conversa no canal web acende a atividade diária, só o resgate adiciona pontos · os dois podem ser executados separadamente", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Benefício diário · resgatar → confirmar → reler para verificar · redefinido no dia natural (horário de Pequim)", "每日签到": "Check-in diário", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Cada agendamento tem horário e escopo próprios · deduplicação diária por item · execuções perdidas são compensadas ao iniciar", "每账号一条明细 · 点此查看「签到记录」": "Uma linha por conta · abra \"Registros de check-in\"", "没有可领套餐的账号(ZCode 未添加)。": "Nenhuma conta com planos resgatáveis (ZCode não adicionado).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "Nenhuma conta com benefícios para resgatar (CodeArts / ZCode não foram adicionados).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "Nenhuma conta suporta tarefas de crescimento (requer WorkBuddy CN).", "没有支持新手福利的账号": "Nenhuma conta suporta benefícios iniciais", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "Nenhuma conta suporta benefícios iniciais — atualmente Loomy, Raccoon e CodeArts.", "没有符合筛选条件的签到记录": "Nenhum registro de check-in corresponde aos filtros", "没有需要执行的任务": "Nada para executar", "活动福利": "Recompensas de evento", "活动(campaign)领取 · 每天 10:00 刷新": "Resgate de eventos (campaign) · atualizado todos os dias às 10:00", "活跃上报与保活均未成功,且活动未开启": "Tanto o relatório de atividade quanto o keep-alive falharam, e a campanha não está ativa", "活跃上报完成,但保活未成功且活动未开启": "Atividade reportada, mas o keep-alive falhou e a campanha não está ativa", "活跃上报完成,但活动未开启": "Atividade reportada, mas a campanha não está ativa", "活跃上报成功": "Atividade reportada com sucesso", "活跃保活失败": "Falha ao manter a atividade", "活跃保活完成": "Atividade mantida", "活跃保活完成,但活动未开启": "Atividade mantida, mas o evento não está aberto", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive concluído, mas o relatório de atividade falhou e a campanha não está ativa", "添加条目": "Adicionar agendamento", "添加模型": "Adicionar modelo", "清单为空 —— 保存后恢复缺省链": "A lista está vazia — salvar restaura a cadeia padrão", "清单里已经有「{name}」": "A lista já contém \"{name}\"", "清空失败:{error}": "Falha ao limpar: {error}", "清空签到记录": "Limpar registros de check-in", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Clique em \"Detalhes dos planos\" para ver quais você recebeu e quando entram em vigor; dá para resgatar de novo todo dia durante o evento", "点击行展开账号明细 · 单账号签到不受范围限制": "Clique na linha para expandir os detalhes das contas · o check-in individual não é limitado pelo escopo", "独立链路 · 只提供手动入口 · 不进自动签到": "Fluxo independente · apenas entrada manual · não participa do check-in automático", "猫猫旅行": "Viagem do gato", "猫猫旅行失败:{error}": "Falha na viagem do gato: {error}", "猫猫旅行失败:{message}": "Falha na viagem do gato: {message}", "猫猫旅行:{message}": "Viagem do gato: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Manter a conta ativa com modelos gratuitos e uma conversa no canal web · sem resgatar recompensas", "确定删除「{name}」?删除后到点不再执行。": "Excluir \"{name}\"? Ele não será mais executado no horário agendado.", "确定清空全部签到记录?清空后无法恢复。": "Limpar todos os registros de check-in? Isso não pode ser desfeito.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Limpar os registros de check-in filtrados? Isso não pode ser desfeito.", "移除 {name}": "Remover {name}", "立即全部签到": "Fazer check-in de todos agora", "签到": "Check-in", "签到中…": "Fazendo check-in…", "签到中心分区": "Seções do centro de check-in", "签到失败:{error}": "Falha no check-in: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in concluído: {succeeded}/{total} com sucesso{active}; {failed} com falha", "签到成功": "Check-in bem-sucedido", "签到提供商": "Provedores de check-in", "签到范围": "Escopo do check-in", "签到触发时刻": "Horário de disparo do check-in", "签到记录": "Registros de check-in", "签到记录时间范围": "Período dos registros de check-in", "签到记录表": "Tabela de registros de check-in", "累计签到记录": "Total de registros de check-in", "结算于 {time}": "Liquidado em {time}", "能量 {n}": "Energia {n}", "腾讯每日签到接口 · 仅国内版": "Interface de check-in diário da Tencent · apenas edição da China", "至少勾一家才能保存(不勾等于这条条目不签到)": "Selecione ao menos um provedor para salvar (sem seleção, esta entrada não faz check-in)", "读取定时签到数据失败:{error}": "Falha ao carregar dados de agendamento: {error}", "读取签到数据失败:{error}": "Falha ao ler os dados de check-in: {error}", "读取签到记录失败:{error}": "Falha ao carregar registros de check-in: {error}", "跳过 {n}": "{n} ignorados", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Entrega de eventos oficiais (resgatar → confirmar → reler para verificar) · resgate dos pontos de bônus do plano", "还没执行过": "Ainda não executado", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "Nenhum agendamento ainda — clique em \"Adicionar agendamento\" para criar um, ou faça check-in manualmente no \"Centro de check-in\".", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "Nenhum registro de check-in ainda — os detalhes aparecem aqui após um check-in manual ou uma execução agendada.", "连登 {n} 天": "Sequência de {n} dias", "部分": "Parcial", "重签": "Refazer check-in", "重试": "Tentar de novo", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Plano de teste por tempo limitado · o resgate exige CAPTCHA de arrastar · veja e resgate um a um", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Plano de teste por tempo limitado (start-plan), um por dia durante o evento · o resgate exige captcha deslizante", "需真实操作": "Requer ação real", "非活动期": "Evento inativo", "项": "itens", "领取": "Resgatar", "领取中": "Resgatando", "领取中…": "Resgatando…", "领取失败": "Falha no resgate", "领取失败:{error}": "Falha no resgate: {error}", "(共 {n} 个账号)": "({n} contas no total)", "(能量 / 连登读数本次未取到)": "(Leituras de energia / sequência indisponíveis desta vez)", ",日活保活 {n} 个": ", {n} mantidas ativas" }); diff --git a/desktop-tauri/ui/i18n/zh-Hant/add-account.js b/desktop-tauri/ui/i18n/zh-Hant/add-account.js index 3ab25336..2fecf990 100644 --- a/desktop-tauri/ui/i18n/zh-Hant/add-account.js +++ b/desktop-tauri/ui/i18n/zh-Hant/add-account.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:zh-Hant/add-account —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · 模型 {head}{rest}", " 等 {n} 个": " 等 {n} 個", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1// 開頭的 Google refresh token(也可直接貼上 refresh_token=… 整行)", "11 位大陆手机号": "11 位大陸手機號", "1~64 个字符,账号列表里按它分组显示": "1~64 個字元,帳號列表裡按它分組顯示", "6 位数字": "6 位數字", "

  • 没有可自动领的活动
  • ": "
  • 沒有可自動領的活動
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    領到的是套餐贈送積分,不會增加福利模型的 token 池;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 相容端點在 https://api.deepseek.com/anthropic(協議換 anthropic 時填它)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic 協議填根地址,不要帶 /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 國內版", "AutoClaw 国际版": "AutoClaw 國際版", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS 必填;請貼上**完整 Cookie**(Cookie 編輯器一鍵匯出即可)—— 其中 **PTOKEN 必須保留**,閘道器要用它向百度換髮 KukuAI 業務會話權杖,缺了它模型重新整理會報「未登入」。支援整段 Cookie 頭、Cookie 編輯器匯出的 JSON 陣列,或 {BDUSS, STOKEN} 物件。KukuAI 沒有重新整理機制,登入態過期後重新貼上即可。", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=…(或 Cookie 編輯器匯出的 JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw 的 X-Passport-Token(登入態 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT(三段點分)", "Command Code": "Command Code", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 國際版", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM 託管端點,Key 在 integrate.api.nvidia.com 申請", "OfficeAce 果办": "OfficeAce 果辦", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken 是 Accio 的登入憑證(一長串不透明 token,不是 JWT);refreshToken 可選,填了之後到期能自動續期。請填寫 {label}帳號的憑證 —— {siteNote}(最容易拿到的辦法:直接用上方的「網頁登入」,不需要手工找 token。)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken 是 Trae 的 Cloud-IDE-JWT(三段點分),refreshToken 用於到期自動續期(本家 refreshToken 一次一換:換髮一次舊的即作廢,所以兩份程式別同時刷同一個帳號)。
    手工貼上時請連 machineId / deviceId 一起填:上游把它們與登入時上傳的裝置公鑰綁在一起判裝置,憑空換一對會撞 2xxxx 那族裝置繫結拒絕。
    沒有這三樣時的正路是用上方的「網頁登入」;容器 / 遠端部署形態按提示貼上位址列回撥地址即可。", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session 的值(也可直接貼上整段 Cookie)", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken 可選,填了到期可自動續期;兩者都能從小浣熊客戶端登入態檔案裡取到。", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken 可選,填了可自動續期;兩者都能從客戶端登入態檔案取到。同一個 Cline 帳號兩個池都能用,這裡歸入 {label}。", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token 支援 enc: 字首(Windows 上自動解密)。未填 refreshToken 無法自動續期。", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token 是登入態 Cookie;CatPaw 沒有重新整理機制,過期後需在客戶端重新登入。", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_ 開頭的 API Key(也可直接貼上 Authorization: Bearer … 整行)", "{label} 网页登录的打开方式": "{label} 網頁登入的開啟方式", "{label} 账号地区": "{label} 帳號地區", "{label} 账号的添加方式": "{label} 帳號的新增方式", "{name} 不是合法 JSON:{reason}": "{name} 不是合法 JSON:{reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}要粘一個 JSON 物件(形如 {sample})", "{n} 个账号": "{n} 個帳號", "{n} 个账号,点击添加": "{n} 個帳號,點擊新增", "{seconds}s 后重发": "{seconds}s 後重發", "✅ {label}账号已添加": "✅ {label}帳號已新增", "✅ {label}账号已添加{name}": "✅ {label}帳號已新增{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ 已從 cc-switch 匯入 {n} 個供應商", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ 已建立自定義提供商「{name}」並新增帳號", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ 已刪除自定義提供商「{name}」{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ 登入成功,{edition}帳號已加入列表", "✅ 领取成功:{planId}{period}": "✅ 領取成功:{planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 同一家可以放多把 key,按優先順序輪換。", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」的帳號新增功能還在開發中,敬請期待。", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "一個 Key 用遍多家模型,模型名用「廠商/模型」全稱(如 deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "上游不要鑑權時留空,並勾選下面一項(留空又不勾會被當成未配置憑證)", "上游信息": "上游資訊", "不可领({status})": "不可領({status})", "不支持导入": "不支援匯入", "不是有效的凭证文件:内容要是一个 JSON 对象": "不是有效的憑證檔案:內容要是一個 JSON 物件", "不是有效的凭证文件:需要包含 accessToken 与 uid": "不是有效的憑證檔案:需要包含 accessToken 與 uid", "不是自定义提供商": "不是自定義提供商", "不需要 Key:转发与拉取模型都不发送鉴权头": "不需要 Key:轉發與拉取模型都不傳送鑑權頭", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "兩版帳號可同時儲存,各自一份模型清單(國內版與國際版是兩家提供商,可分別啟用與對映)。", "中国版": "中國版", "今天没有需要领的活动(都已到账)": "今天沒有需要領的活動(都已到賬)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "今天(北京時間 {day})已試 {attempts} 次,還能試 {left} 次{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "從別的機器(或 OfficeAce 桌面版 models.json)取三項貼進來:模型閘道器基址(baseUrl,形如 https://modelgw-…/v2)與 modelAppKey / modelAppSecret。這三項就能轉發(閘道器憑據不過期);控制面臨時憑據(accessKeyId 等)可選,留空則額度/自動續期不可用,但不影響轉發。", "从本机导入桌面端登录态": "從本機匯入桌面版登入態", "任务镜像 id": "任務映象 id", "余额查询": "餘額查詢", "使用 Google 账号登录": "使用 Google 帳號登入", "使用 Zai 账号登录": "使用 Zai 帳號登入", "使用个人访问令牌(PAT)": "使用個人存取權杖(PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "免費模型不用填 Key(預設勾上「該上游無需鑑權」,閘道器自動用匿名憑證);付費模型則填 Zen 的 API Key。免費檔上游只認官方客戶端形態,已預設開啟「偽裝 OpenCode 官方客戶端」", "内嵌窗口": "內嵌視窗", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "內嵌視窗開啟;關窗即取消等待(Google 帳號被拒時改用系統瀏覽器)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "內嵌視窗開啟;完成後自動加入列表,關窗即取消等待", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "內嵌視窗用全新環境,多帳號互不影響;關窗即取消等待", "内嵌窗口(推荐)": "內嵌視窗(推薦)", "准备验证…": "準備驗證…", "凭据 JSON": "憑據 JSON", "凭证文件在哪?": "憑證檔案在哪?", "创建并添加账号": "建立並新增帳號", "创建这个提供商,并同时建立它的第一个账号。": "建立這個提供商,並同時建立它的第一個帳號。", "删除功能不可用(脚本未就绪)": "刪除功能不可用(指令碼未就緒)", "删除失败:{reason}": "刪除失敗:{reason}", "删除此提供商": "刪除此提供商", "及 {n} 个账号": "及 {n} 個帳號", "发送中…": "傳送中…", "发送失败:{message}": "傳送失敗:{message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "傳送未確認:登入視窗已彈出,請在彈出的視窗中手動完成登入", "取消失败:{message}": "取消失敗:{message}", "取消等待": "取消等待", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "只有「內嵌視窗」能恢復第三方入口:系統瀏覽器裡我們無法改動登入頁", "可选": "可選", "可选(cloudaicompanionProject):留空由网关自动发现": "可選(cloudaicompanionProject):留空由閘道器自動發現", "可选,展示用": "可選,展示用", "可选,没有则无法自动续期": "可選,沒有則無法自動續期", "可选,留空使用凭据里的 user_name": "可選,留空使用憑據裡的 user_name", "可选,留空使用账号姓名、邮箱或令牌指纹": "可選,留空使用帳號姓名、郵箱或權杖指紋", "可选,留空使用账号昵称或邮箱": "可選,留空使用帳號暱稱或郵箱", "可选,留空则用 key 尾号": "可選,留空則用 key 尾號", "可选,留空则用 userId": "可選,留空則用 userId", "可选,留空则用上游返回的账号名或账号 id": "可選,留空則用上游返回的帳號名或帳號 id", "可选,留空则用凭证里的账号名": "可選,留空則用憑證裡的帳號名", "可选,留空则用文件里的昵称": "可選,留空則用檔案裡的暱稱", "可选,留空则用登录名或 uid": "可選,留空則用登入名或 uid", "可选,留空则用脱敏手机号": "可選,留空則用脫敏手機號", "可选,留空则用脱敏手机号或 userId": "可選,留空則用脫敏手機號或 userId", "可选,留空则用账号 uk": "可選,留空則用帳號 uk", "可选,留空则用邮箱或令牌尾号": "可選,留空則用郵箱或權杖尾號", "可选,留空用「OfficeAce 果办」": "可選,留空用「OfficeAce 果辦」", "可选,留空自动生成": "可選,留空自動生成", "可选,留空自动用昵称": "可選,留空自動用暱稱", "可选,续期时带上": "可選,續期時帶上", "可选,讯飞侧 userid": "可選,訊飛側 userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "可選:發起對話必需,留空則由閘道器從該帳號已有任務裡自動發現,發現不到時之後手動補", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "可選:帳號郵箱,用於展示與身份識別(換新權杖也能認回同一帳號)", "可选;UUID 形态,与凭据同生共死": "可選;UUID 形態,與憑據同生共死", "可选;填了才能到期自动续期": "可選;填了才能到期自動續期", "可选;用于去重与展示名(留空时网关会问一次上游)": "可選;用於去重與展示名(留空時閘道器會問一次上游)", "可选;用于生成账号 id 与展示名": "可選;用於生成帳號 id 與展示名", "可选;纯数字串(上游只收 8–24 位数字)": "可選;純數字串(上游只收 8–24 位數字)", "可领取": "可領取", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "同一家可以混著放:有 Key 的帳號與無鑑權帳號各按各的規則走", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "同地址換 anthropic 協議即走它的 Claude 相容端點。轉發必須填 OpenCode Go 的 API Key(訂閱制;獲取模型清單不需要 Key,但發請求上游會回 401「Missing API key」)", "响应为空": "響應為空", "商汤日日新的 OpenAI 兼容端点;余额查询走控制台账号密码(见下方「余额查询」一段)": "商湯日日新的 OpenAI 相容端點;餘額查詢走控制台帳號密碼(見下方「餘額查詢」一段)", "国内版": "國內版", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "國內版與**國際版是兩套獨立的帳號與套餐**,憑證與領取的套餐都不通用。", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "國內版登入頁沒有 Google / GitHub 入口(它用微信 / 手機號 / 郵箱登入)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "國內版的登入站點是 www.accio-ai.com,與國際版不是同一站。", "国内版(WorkBuddy)": "國內版(WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "國內站為 https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "國內站(minimaxi.com);OpenAI 相容地址為 https://api.minimaxi.com/v1", "国际版": "國際版", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "國際版 z.ai 的 Coding 套餐;OpenAI 相容地址為 https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "國際版與國內版是**兩套獨立的帳號**(同一帳號體系的兩個站點),憑證不通用。", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "國際版與國內版帳號體系獨立,請填國際版的憑證。未填 refreshToken 無法自動續期。", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "國際版登入頁預設只顯示郵箱登入,勾選後恢復 Google / GitHub / X 入口", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "國際版的推理站點是 api.z.ai,與國內版不是同一站;套餐也各自獨立。", "国际版(WorkBuddy AI)": "國際版(WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "國際站 Coding 套餐;OpenAI 相容地址為 https://api.minimax.io/v1", "在 cc-switch 里找到": "在 cc-switch 裡找到", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "在內嵌視窗裡完成官方登入,成功後自動加入帳號列表。", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "在{label}的 Qoder 帳號設定 → Integrations 生成 PAT(別填 Google / GitHub 的權杖)。兩個地區的帳號與憑證不通用。", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "在開啟的窗口裡用百度帳號登入 KukuAI 主站(手機驗證碼 / 掃碼均可),登入成功後自動加入帳號列表。閘道器會向百度換髮 KukuAI 業務會話權杖(依賴本機已安裝庫庫AI 客戶端)。", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "在開啟的窗口裡登入 Google 帳號(Antigravity 的授權頁),授權完成後自動加入帳號列表。", "在浏览器中打开登录页": "在瀏覽器中開啟登入頁", "地区": "地區", "填写凭证": "填寫憑證", "填写凭证添加": "填寫憑證新增", "备注名": "備註名", "套餐": "套餐", "如:智谱 GLM": "如:智譜 GLM", "完成登录后自动加入账号列表,昵称取自上游。": "完成登入後自動加入帳號列表,暱稱取自上游。", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "官方客戶端憑證目錄:Windows 是 C:\\Users\\<你的使用者名稱>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "官方已確認到賬", "导入": "匯入", "导入中…": "匯入中…", "导入凭证文件": "匯入憑證檔案", "导入失败": "匯入失敗", "导入失败:{reason}": "匯入失敗:{reason}", "导入所选": "匯入所選", "导入所选({n})": "匯入所選({n})", "导入桌面端登录态": "匯入桌面版登入態", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "將開啟內嵌視窗;授權完成後自動加入帳號列表。關掉視窗即取消等待。授權頁最後可能提示無法開啟 zcode:// 連結,這是正常的 —— 結果已由服務端記下", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "將開啟內嵌視窗;授權完成後自動加入帳號列表。遠端面板可貼上回撥地址。關掉視窗即取消等待。連結 5 分鐘內有效,超時或未點就會作廢(可重新發起)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "將開啟內嵌視窗;登入完成後自動加入帳號列表。關掉視窗即取消等待", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的 Trae 帳號);同機完成後自動加入,Docker / 遠端面板按提示貼上位址列回撥地址。", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的 ZCode 帳號);授權完成後自動加入帳號列表。頁面最後可能提示無法開啟 zcode:// 連結,屬正常現象", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的華為雲帳號);瀏覽器與閘道器不在同一臺機器時,按上方說明把最終回撥地址貼上回面板", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "將用系統預設瀏覽器開啟登入頁(會複用瀏覽器裡已登入的 Accio 帳號);完成登入後自動加入帳號列表,關掉彈窗即取消等待", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan 套餐(新加坡站)", "已到账": "已到賬", "已取消登录等待": "已取消登入等待", "已取消领取": "已取消領取", "已取消验证码": "已取消驗證碼", "已填写手机号,正在发送验证码…": "已填寫手機號,正在傳送驗證碼…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "已宣告無需鑑權:帳號會被正常選路,出網時不帶任何鑑權頭", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "已匯入 {ok} 個,失敗 {fail} 個(失敗項已標註在列表裡)", "已建过 · {n} 个账号,点击继续添加": "已建過 · {n} 個帳號,點擊繼續新增", "已建过,点击继续添加账号": "已建過,點擊繼續新增帳號", "已打开官方登录页,请在窗口中完成登录…": "已開啟官方登入頁,請在視窗中完成登入…", "已点发送,等待短信…": "已點發送,等待簡訊…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "已用系統預設瀏覽器開啟登入頁,請在瀏覽器中完成登入…", "已领取,等官方确认": "已領取,等官方確認", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "當前殼版本不支援 AutoClaw 網頁登入,請更新應用", "当前没有可领取的套餐(活动尚未开始)": "當前沒有可領取的套餐(活動尚未開始)", "当前环境不支持领取(桥接方法缺失)": "當前環境不支援領取(橋接方法缺失)", "必填,CatPaw 账号标识": "必填,CatPaw 帳號標識", "恢复 Google / GitHub 入口": "恢復 Google / GitHub 入口", "手机号": "手機號", "手机验证码登录": "手機驗證碼登入", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "開啟 Trae SOLO 的官方授權頁(trae.cn)並用你的 Trae 帳號登入:授權完成後官方頁面會跳回本機的一個臨時連接埠;同機部署自動接收,Docker / 遠端面板請按提示覆制位址列回撥地址。", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "開啟 Accio {label}的官方登入頁({site})並用你的 Accio 帳號登入:登入成功後官方頁面會跳回本機;同機自動完成,Docker / 遠端面板按提示貼上回撥地址即可(授權碼只在本機傳給閘道器,介面不顯示明文 token)。", "打开 Accio {label}登录页": "開啟 Accio {label}登入頁", "打开 Antigravity 网页登录": "開啟 Antigravity 網頁登入", "打开 CatPaw 网页登录": "開啟 CatPaw 網頁登入", "打开 Cline 授权页": "開啟 Cline 授權頁", "打开 CodeArts 授权页": "開啟 CodeArts 授權頁", "打开 Qoder 网页登录": "開啟 Qoder 網頁登入", "打开 Trae 授权页": "開啟 Trae 授權頁", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "開啟 ZCode {label}的官方授權頁並用你的帳號登入。授權結果由 ZCode 服務端記錄,閘道器在後臺自動取回憑證並加入帳號列表。", "打开 ZCode {label}授权页": "開啟 ZCode {label}授權頁", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "開啟華為雲 CodeArts 的官方授權頁登入:登入完成後官方頁面會把瀏覽器帶回閘道器自己的 /oauth/callback,閘道器用一次性授權碼換取臨時憑據並加入帳號列表。
    閘道器跑在另一臺機器上時,網頁端會提示把位址列中的最終回撥地址直接貼上回面板。", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "開啟華為雲授權頁登入:登入完成後閘道器會自動輪詢雲端取回授權碼並加入帳號列表(不需要裝 OfficeAce 桌面版,也無需手工回填回撥地址)。", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "開啟官方授權頁完成裝置碼授權,登入的是{label}({site})的帳號。", "打开授权页": "開啟授權頁", "打开授权页完成确认,账号自动加入 {label}{note}": "開啟授權頁完成確認,帳號自動加入 {label}{note}", "打开方式": "開啟方式", "打开网页登录": "開啟網頁登入", "探测失败:{message}": "探測失敗:{message}", "接入一个兼容上游": "接入一個相容上游", "提交中…": "提交中…", "搜索提供商": "搜尋提供商", "搜索提供商…": "搜尋提供商…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "整份貼上官方外掛 / CLIProxyAPI 落盤的憑據 JSON(形如 {\"codearts_provider_credential\":{…}},鋪平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自動續期,必須連 refresh_token 與 oauth_context 一起粘 —— 臨時憑據約一小時到期,缺這半塊就續不回來,只能重新登入。", "文件是{edition}凭证,已按该版本导入": "檔案是{edition}憑證,已按該版本匯入", "新建自定义提供商": "新建自定義提供商", "方案:{label}": "方案:{label}", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "明文 JWT 或 auth.json 裡的 enc: 加密值(自動解密)", "明文 JWT(国际版账号的 access token)": "明文 JWT(國際版帳號的 access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "智譜 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys", "未知错误": "未知錯誤", "未能获取授权地址,请重试": "未能獲取授權地址,請重試", "未能读取 cc-switch 数据": "未能讀取 cc-switch 資料", "未领取成功": "未領取成功", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "本地 Ollama、OpenCode Zen 免費檔這類上游要勾上,否則帳號不可用", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "本家有兩個**互不替代**的憑證,按你要用的功能填,至少填一個:編碼套餐 API Key 用於轉發推理(打 {site})與查詢視窗限額(每 N 小時 / 每週的剩餘比例);jwt 用於領取套餐與查詢餘額(打 zcode.z.ai 的 billing 閘道器,官方叫 Coding Plan JWT,是一串三段點分的字串)。餘額兩把都能查、但讀到的東西不同:jwt 讀到餘額桶與套餐到期,API Key 讀到視窗限額;而領取只認 jwt、轉發只認 API Key。請填寫 {label}帳號的憑證 —— {plan}(最容易拿到的辦法:直接用上方的「網頁登入」—— 它會替你把這個 API Key 換好,兩個憑證一起拿到。)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "本機 Ollama 的 OpenAI 相容端點,無需 API Key(預設已勾上「該上游無需鑑權」,鑑權頭一個都不發)", "本次未确认到账": "本次未確認到賬", "条可导入": "條可匯入", "条配置,其中": "條配置,其中", "桌面运行时不可用(Tauri 未初始化)": "桌面執行時不可用(Tauri 未初始化)", "模型网关基址": "模型閘道器基址", "正在打开百度登录页…": "正在開啟百度登入頁…", "正在扫描本机 cc-switch…": "正在掃描本機 cc-switch…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "正在等待{name}登入完成;完成或取消後才能發起新的登入", "每周": "每週", "每日": "每日", "每月": "每月", "没有则无法自动续期": "沒有則無法自動續期", "没有匹配「{keyword}」的提供商": "沒有匹配「{keyword}」的提供商", "添加 {name} 账号": "新增 {name} 帳號", "添加中…": "新增中…", "添加到 ": "新增到 ", "添加失败:{reason}": "新增失敗:{reason}", "添加小浣熊账号": "新增小浣熊帳號", "添加方式": "新增方式", "添加账号": "新增帳號", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "火山引擎 Coding 套餐;通用推理接入點為 https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "點擊新增帳號", "点开即预填,填 Key 接入": "點開即預填,填 Key 接入", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "點按鈕後先過一次滑塊驗證(官方風控),隨後開啟登入頁,登入完成即自動新增帳號。
    這是國際版官方唯一的登入方式;已在客戶端登入過的,用「匯入桌面版登入態」更快。", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "用 AutoClaw 帳號繫結的手機號登入:點擊「獲取驗證碼」,收到簡訊後填入下方並登入。驗證碼由本機直接提交給官方介面,介面不顯示 token。", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "用 CatPaw 帳號完成登入(美團 passport),成功後自動加入帳號列表。", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "用 Loomy 帳號繫結的手機號登入:點「獲取驗證碼」後填入即可。這是本家最省事的入口。", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "用於轉發;形如 apiKey.secret 兩段點分(不填則這個帳號不能轉發)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "用於領取套餐與查詢餘額;不填則這個帳號不能領取與查餘額", "用户 ID": "使用者 ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "用繫結的手機號登入:點「獲取驗證碼」後填入即可。這是國內版官方唯一的登入方式。", "留空则用提供商名称": "留空則用提供商名稱", "登录 / 添加 {name} 账号": "登入 / 新增 {name} 帳號", "登录 session(一长串)": "登入 session(一長串)", "登录中…": "登入中…", "登录失败:{message}": "登入失敗:{message}", "登录已结束": "登入已結束", "登录并添加": "登入並新增", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "登入態檔案路徑:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的使用者名稱>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "確定刪除自定義提供商「{name}」?將同時刪除該提供商下 {count} 個帳號,刪除後無法恢復。", "等待 Accio {label}登录完成…": "等待 Accio {label}登入完成…", "等待 CatPaw 登录完成…": "等待 CatPaw 登入完成…", "等待 Cline 授权确认…": "等待 Cline 授權確認…", "等待 CodeArts 登录完成…": "等待 CodeArts 登入完成…", "等待 Google 授权完成…": "等待 Google 授權完成…", "等待 KukuAI 登录完成…": "等待 KukuAI 登入完成…", "等待 OfficeAce 登录完成…": "等待 OfficeAce 登入完成…", "等待 Qoder 授权完成…": "等待 Qoder 授權完成…", "等待 Trae 授权完成…": "等待 Trae 授權完成…", "等待 ZCode {label}授权完成…": "等待 ZCode {label}授權完成…", "等待小浣熊登录完成…": "等待小浣熊登入完成…", "等待登录完成…": "等待登入完成…", "等待网页登录…": "等待網頁登入…", "粘贴 API Key": "貼上 API Key", "粘贴 Accio 的 accessToken": "貼上 Accio 的 accessToken", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "貼上 Antigravity 的 Google refresh token(以 1// 開頭;直接貼上含 refresh_token= 的整行也行)。
    這是網頁登入之外的手工入口(例如從已登入的官方 IDE 裡匯出)。refresh token 不會過期,access token 到期由閘道器自動續期;權杖丟了只能重新走 Google 授權,請妥善儲存。", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "貼上 Command Code 的 API Key(user_ 開頭;從官方 CLI 的 ~/.commandcode/auth.json 或網頁 studio 獲取)。整行 / 帶引號 / 帶 Bearer 字首地粘都行,閘道器會自己剝成裸 key。key 不過期、也沒有續期介面,失效後重新獲取即可;新增時閘道器會做一次輕量探活,失敗不影響新增。", "粘贴 Cookie": "貼上 Cookie", "粘贴 Google refresh token": "貼上 Google refresh token", "粘贴 Qoder 个人访问令牌(pt-…)": "貼上 Qoder 個人存取權杖(pt-…)", "粘贴 access_token(一长串 JWT)": "貼上 access_token(一長串 JWT)", "粘贴 session cookie": "貼上 session cookie", "粘贴 token / refreshToken": "貼上 token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "貼上 workos:… 開頭的權杖(不帶字首也會自動補上)", "粘贴登录凭据": "貼上登入憑據", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "貼上的是登入 session(同時是模型閘道器的 token)。Loomy 沒有續期介面,session 有效期約 14 天,過期後重新登入即可。", "粘贴网关凭据": "貼上閘道器憑據", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "貼上網頁登入態 cookie monkeycode_ai_session 的值(在瀏覽器裡複製整段 Cookie 直接貼上也行,閘道器會自己剝出值)。
    {siteNote}
    MonkeyCode 沒有續期介面:session 有效期約 30 天(硬限制),過期後重新登入網頁、再貼上一次即可。", "系统浏览器": "系統瀏覽器", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "系統瀏覽器可複用已有登入態(國際版推薦);內嵌視窗更乾淨。", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Cline 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Google 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Zai / Google 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的美團帳號);完成後自動加入列表", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入帳號);完成後自動加入列表", "系统默认浏览器": "系統預設瀏覽器", "编码套餐 API Key": "編碼套餐 API Key", "网关 Secret": "閘道器 Secret", "网页登录": "網頁登入", "网页登录的打开方式": "網頁登入的開啟方式", "网页登录(Zai / Google)": "網頁登入(Zai / Google)", "自定义": "自定義", "自建聚合面板:填你自己的站点地址。余额查询用该账号的 API Key 打 {base}/v1/usage,不需要额外配置": "自建聚合面板:填你自己的站點地址。餘額查詢用該帳號的 API Key 打 {base}/v1/usage,不需要額外配置", "自建聚合面板:填你自己的站点地址;余额查询要另填 NewAPI 的个人访问令牌(见下方「余额查询」一段)": "自建聚合面板:填你自己的站點地址;餘額查詢要另填 NewAPI 的個人存取權杖(見下方「餘額查詢」一段)", "获取风控配置失败,将直接尝试领取:{message}": "獲取風控配置失敗,將直接嘗試領取:{message}", "获取验证码": "獲取驗證碼", "该上游无需鉴权(不发送鉴权头)": "該上游無需鑑權(不傳送鑑權頭)", "该提供商": "該提供商", "该提供商账号添加功能即将上线": "該提供商帳號新增功能即將上線", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "該自定義提供商已不存在(可能已被刪除),請重新整理後重試", "请先选择一个自定义提供商": "請先選擇一個自定義提供商", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "請在彈出的滑塊中完成驗證(官方要求的風控步驟)", "请填写 11 位大陆手机号": "請填寫 11 位大陸手機號", "请填写 6 位数字验证码": "請填寫 6 位數字驗證碼", "请填写 Base URL": "請填寫 Base URL", "请填写 {label}": "請填寫 {label}", "请填写名称": "請填寫名稱", "请完成验证…": "請完成驗證…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "讀取 %APPDATA%/AutoClaw/auth.json 並解密,僅 Windows", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "讀取 ~/.cline/data/settings/providers.json,需已在 Cline 客戶端登入", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "讀取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客戶端登入", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "讀取本機 KukuAI 客戶端登入態(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客戶端登入", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "讀本機客戶端當前登入態(明文 Cookie,無需解密)。客戶端執行時 Cookies 檔案被獨佔佔用,匯入前請先關閉 KukuAI 客戶端。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。客戶端重新登入後點「重新整理 Token」同步。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。客戶端重新登入後重新匯入即可。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。用 Zai / Google 登入客戶端的使用者走這一條。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。這一條歸入 {label}。", "账号信息": "帳號資訊", "账号信息不完整,请刷新后重试": "帳號資訊不完整,請重新整理後重試", "账号已添加,但请留意:{warning}": "帳號已新增,但請留意:{warning}", "账号版本": "帳號版本", "账号类型": "帳號型別", "账号:{name}
    ": "帳號:{name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 建立", "还没有账号": "還沒有帳號", "这一家当前不支持网页登录,请改用填写凭证": "這一家當前不支援網頁登入,請改用填寫憑證", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "這個帳號當前沒有可自動領的活動(只自動領每日登入贈送積分)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "這份額度走「活動套餐」通道:若轉發時提示編碼套餐已到期,", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "這裡填國內站(monkeycode-ai.com)的帳號:請貼上國內站的 session。國際站(monkeycode-ai.net)是另一家 provider、另一套帳號,兩邊的憑證不通用。", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "這裡填國際站(monkeycode-ai.net)的帳號:請貼上國際站的 session。國內站(monkeycode-ai.com)是另一家 provider、另一套帳號,兩邊的憑證不通用。", "选择凭证文件导入": "選擇憑證檔案匯入", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "選擇官方客戶端的登入態憑證檔案(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 匯出的帳號 JSON(巢狀 / 扁平形均可),也可以直接從本機官方客戶端讀取。", "选择提供商": "選擇提供商", "选择的文件不是合法 JSON": "選擇的檔案不是合法 JSON", "选择要添加账号的提供商": "選擇要新增帳號的提供商", "重新扫描": "重新掃描", "鉴权": "鑑權", "阿里云 Token Plan 套餐(国际站)": "阿里雲 Token Plan 套餐(國際站)", "阿里云百炼 Coding 套餐(国内站)": "阿里雲百鍊 Coding 套餐(國內站)", "阿里云百炼 Coding 套餐(国际站)": "阿里雲百鍊 Coding 套餐(國際站)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "阿里雲百鍊模型服務(國際站,OpenAI 相容模式)", "需要图形验证码:登录窗口已弹出,请填写后继续": "需要圖形驗證碼:登入視窗已彈出,請填寫後繼續", "预置 API": "預置 API", "领取 CodeArts 每日福利": "領取 CodeArts 每日福利", "领取失败:{message}": "領取失敗:{message}", "领取并让官方确认": "領取並讓官方確認", "风控验证配置不完整,请稍后重试": "風控驗證配置不完整,請稍後重試", "验证码": "驗證碼", "验证码已发送。收到后填入下方并点「登录并添加」": "驗證碼已傳送。收到後填入下方並點「登入並新增」", "验证码已发送,请查看手机短信": "驗證碼已傳送,請檢視手機簡訊", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "驗證碼已傳送,請檢視手機簡訊。填入下方並點「登入並新增」即完成登入", "验证码已发送,请查看短信": "驗證碼已傳送,請檢視簡訊", "验证码校验失败,请重试": "驗證碼校驗失敗,請重試", "验证码校验超时,请重试": "驗證碼校驗超時,請重試", "验证码组件不可用,请重试": "驗證碼元件不可用,請重試", "验证码组件初始化超时,请重试": "驗證碼元件初始化超時,請重試", "验证码组件加载失败,请检查网络后重试": "驗證碼元件載入失敗,請檢查網路後重試", "验证码组件加载异常,请重试": "驗證碼元件載入異常,請重試", "验证码组件加载超时,请检查网络后重试": "驗證碼元件載入超時,請檢查網路後重試", "验证码组件未加载,请重启应用后重试": "驗證碼元件未載入,請重啟應用後重試", "(免费额度池,模型名带 cline-free/ 前缀)。": "(免費額度池,模型名帶 cline-free/ 字首)。", "(其中 {n} 把恢复为不限制)": "(其中 {n} 把恢復為不限制)", "(必填)": "(必填)", "(有效期 {window})": "(有效期 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": "(訂閱池,模型名帶 cline-pass/ 字首,需要帳號有對應訂閱)。", ",下一次最快 {minutes} 分钟后": ",下一次最快 {minutes} 分鐘後", ",并从 {n} 把 Key 的可用提供商里移除": ",並從 {n} 把 Key 的可用提供商裡移除" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · 模型 {head}{rest}": " · 模型 {head}{rest}", " 等 {n} 个": " 等 {n} 個", "1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)": "1// 開頭的 Google refresh token(也可直接貼上 refresh_token=… 整行)", "11 位大陆手机号": "11 位大陸手機號", "1~64 个字符,账号列表里按它分组显示": "1~64 個字元,帳號列表裡按它分組顯示", "6 位数字": "6 位數字", "

  • 没有可自动领的活动
  • ": "
  • 沒有可自動領的活動
  • ", "

    领到的是套餐赠送积分,不会增加福利模型的 token 池;": "

    領到的是套餐贈送積分,不會增加福利模型的 token 池;", "Anthropic 兼容端点在 https://api.deepseek.com/anthropic(协议换 anthropic 时填它)": "Anthropic 相容端點在 https://api.deepseek.com/anthropic(協議換 anthropic 時填它)", "Anthropic 协议填根地址,不要带 /v1": "Anthropic 協議填根地址,不要帶 /v1", "Antigravity": "Antigravity", "AutoClaw 国内版": "AutoClaw 國內版", "AutoClaw 国际版": "AutoClaw 國際版", "BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。": "BDUSS 必填;請貼上**完整 Cookie**(Cookie 編輯器一鍵匯出即可)—— 其中 **PTOKEN 必須保留**,閘道器要用它向百度換髮 KukuAI 業務會話權杖,缺了它模型重新整理會報「未登入」。支援整段 Cookie 頭、Cookie 編輯器匯出的 JSON 陣列,或 {BDUSS, STOKEN} 物件。KukuAI 沒有重新整理機制,登入態過期後重新貼上即可。", "BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)": "BDUSS=…; STOKEN=…(或 Cookie 編輯器匯出的 JSON)", "CatPaw 的 X-Passport-Token(登录态 Cookie)": "CatPaw 的 X-Passport-Token(登入態 Cookie)", "Cloud-IDE-JWT(三段点分)": "Cloud-IDE-JWT(三段點分)", "Command Code": "Command Code", "JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)": "JWT(三段點分;也可直接貼上 Bearer 整行或 data.bin 內容)", "ModelScope 国内版": "ModelScope 國內版", "ModelScope 国际版": "ModelScope 國際版", "MonkeyCode": "MonkeyCode", "MonkeyCode 国际版": "MonkeyCode 國際版", "NVIDIA NIM 托管端点,Key 在 integrate.api.nvidia.com 申请": "NVIDIA NIM 託管端點,Key 在 integrate.api.nvidia.com 申請", "OfficeAce 果办": "OfficeAce 果辦", "accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)": "accessToken 是 Accio 的登入憑證(一長串不透明 token,不是 JWT);refreshToken 可選,填了之後到期能自動續期。請填寫 {label}帳號的憑證 —— {siteNote}(最容易拿到的辦法:直接用上方的「網頁登入」,不需要手工找 token。)", "accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。": "accessToken 是 Trae 的 Cloud-IDE-JWT(三段點分),refreshToken 用於到期自動續期(本家 refreshToken 一次一換:換髮一次舊的即作廢,所以兩份程式別同時刷同一個帳號)。
    手工貼上時請連 machineId / deviceId 一起填:上游把它們與登入時上傳的裝置公鑰綁在一起判裝置,憑空換一對會撞 2xxxx 那族裝置繫結拒絕。
    沒有這三樣時的正路是用上方的「網頁登入」;容器 / 遠端部署形態按提示貼上位址列回撥地址即可。", "monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)": "monkeycode_ai_session 的值(也可直接貼上整段 Cookie)", "ms- 开头的 API 令牌": "ms- 開頭的 API 權杖", "refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。": "refreshToken 可選,填了到期可自動續期;兩者都能從小浣熊客戶端登入態檔案裡取到。", "refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。": "refreshToken 可選,填了可自動續期;兩者都能從客戶端登入態檔案取到。同一個 Cline 帳號兩個池都能用,這裡歸入 {label}。", "token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。": "token 支援 enc: 字首(Windows 上自動解密)。未填 refreshToken 無法自動續期。", "token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。": "token 是登入態 Cookie;CatPaw 沒有重新整理機制,過期後需在客戶端重新登入。", "user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)": "user_ 開頭的 API Key(也可直接貼上 Authorization: Bearer … 整行)", "{label} 网页登录的打开方式": "{label} 網頁登入的開啟方式", "{label} 账号地区": "{label} 帳號地區", "{label} 账号的添加方式": "{label} 帳號的新增方式", "{name} 不是合法 JSON:{reason}": "{name} 不是合法 JSON:{reason}", "{name}要粘一个 JSON 对象(形如 {sample})": "{name}要粘一個 JSON 物件(形如 {sample})", "{n} 个账号": "{n} 個帳號", "{n} 个账号,点击添加": "{n} 個帳號,點擊新增", "{seconds}s 后重发": "{seconds}s 後重發", "✅ {label}账号已添加": "✅ {label}帳號已新增", "✅ {label}账号已添加{name}": "✅ {label}帳號已新增{name}", "✅ 已从 cc-switch 导入 {n} 个供应商": "✅ 已從 cc-switch 匯入 {n} 個供應商", "✅ 已创建自定义提供商「{name}」并添加账号": "✅ 已建立自定義提供商「{name}」並新增帳號", "✅ 已删除自定义提供商「{name}」{accounts}{keys}": "✅ 已刪除自定義提供商「{name}」{accounts}{keys}", "✅ 登录成功,{edition}账号已加入列表": "✅ 登入成功,{edition}帳號已加入列表", "✅ 领取成功:{planId}{period}": "✅ 領取成功:{planId}{period}", " 同一家可以放多把 key,按优先级轮换。": " 同一家可以放多把 key,按優先順序輪換。", "「{name}」的账号添加功能还在开发中,敬请期待。": "「{name}」的帳號新增功能還在開發中,敬請期待。", "一个 Key 用遍多家模型,模型名用「厂商/模型」全称(如 deepseek/deepseek-chat)": "一個 Key 用遍多家模型,模型名用「廠商/模型」全稱(如 deepseek/deepseek-chat)", "上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)": "上游不要鑑權時留空,並勾選下面一項(留空又不勾會被當成未配置憑證)", "上游信息": "上游資訊", "不可领({status})": "不可領({status})", "不支持导入": "不支援匯入", "不是有效的凭证文件:内容要是一个 JSON 对象": "不是有效的憑證檔案:內容要是一個 JSON 物件", "不是有效的凭证文件:需要包含 accessToken 与 uid": "不是有效的憑證檔案:需要包含 accessToken 與 uid", "不是自定义提供商": "不是自定義提供商", "不需要 Key:转发与拉取模型都不发送鉴权头": "不需要 Key:轉發與拉取模型都不傳送鑑權頭", "两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。": "兩版帳號可同時儲存,各自一份模型清單(國內版與國際版是兩家提供商,可分別啟用與對映)。", "中国版": "中國版", "今天没有需要领的活动(都已到账)": "今天沒有需要領的活動(都已到賬)", "今天(北京时间 {day})已试 {attempts} 次,还能试 {left} 次{next}
    ": "今天(北京時間 {day})已試 {attempts} 次,還能試 {left} 次{next}
    ", "从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。": "從別的機器(或 OfficeAce 桌面版 models.json)取三項貼進來:模型閘道器基址(baseUrl,形如 https://modelgw-…/v2)與 modelAppKey / modelAppSecret。這三項就能轉發(閘道器憑據不過期);控制面臨時憑據(accessKeyId 等)可選,留空則額度/自動續期不可用,但不影響轉發。", "从本机导入桌面端登录态": "從本機匯入桌面版登入態", "任务镜像 id": "任務映象 id", "余额查询": "餘額查詢", "使用 Google 账号登录": "使用 Google 帳號登入", "使用 Zai 账号登录": "使用 Zai 帳號登入", "使用个人访问令牌(PAT)": "使用個人存取權杖(PAT)", "免费模型不用填 Key(默认勾上「该上游无需鉴权」,网关自动用匿名凭证);付费模型则填 Zen 的 API Key。免费档上游只认官方客户端形态,已默认开启「伪装 OpenCode 官方客户端」": "免費模型不用填 Key(預設勾上「該上游無需鑑權」,閘道器自動用匿名憑證);付費模型則填 Zen 的 API Key。免費檔上游只認官方客戶端形態,已預設開啟「偽裝 OpenCode 官方客戶端」", "内嵌窗口": "內嵌視窗", "内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)": "內嵌視窗開啟;關窗即取消等待(Google 帳號被拒時改用系統瀏覽器)", "内嵌窗口打开;完成后自动加入列表,关窗即取消等待": "內嵌視窗開啟;完成後自動加入列表,關窗即取消等待", "内嵌窗口用全新环境,多账号互不影响;关窗即取消等待": "內嵌視窗用全新環境,多帳號互不影響;關窗即取消等待", "内嵌窗口(推荐)": "內嵌視窗(推薦)", "准备验证…": "準備驗證…", "凭据 JSON": "憑據 JSON", "凭证文件在哪?": "憑證檔案在哪?", "创建并添加账号": "建立並新增帳號", "创建这个提供商,并同时建立它的第一个账号。": "建立這個提供商,並同時建立它的第一個帳號。", "删除功能不可用(脚本未就绪)": "刪除功能不可用(指令碼未就緒)", "删除失败:{reason}": "刪除失敗:{reason}", "删除此提供商": "刪除此提供商", "及 {n} 个账号": "及 {n} 個帳號", "发送中…": "傳送中…", "发送失败:{message}": "傳送失敗:{message}", "发送未确认:登录窗口已弹出,请在弹出的窗口中手动完成登录": "傳送未確認:登入視窗已彈出,請在彈出的視窗中手動完成登入", "取消失败:{message}": "取消失敗:{message}", "取消等待": "取消等待", "只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页": "只有「內嵌視窗」能恢復第三方入口:系統瀏覽器裡我們無法改動登入頁", "可选": "可選", "可选(cloudaicompanionProject):留空由网关自动发现": "可選(cloudaicompanionProject):留空由閘道器自動發現", "可选,展示用": "可選,展示用", "可选,没有则无法自动续期": "可選,沒有則無法自動續期", "可选,留空使用凭据里的 user_name": "可選,留空使用憑據裡的 user_name", "可选,留空使用账号姓名、邮箱或令牌指纹": "可選,留空使用帳號姓名、郵箱或權杖指紋", "可选,留空使用账号昵称或邮箱": "可選,留空使用帳號暱稱或郵箱", "可选,留空则用 key 尾号": "可選,留空則用 key 尾號", "可选,留空则用 userId": "可選,留空則用 userId", "可选,留空则用上游账号昵称": "可選,留空則用上游帳號暱稱", "可选,留空则用上游返回的账号名或账号 id": "可選,留空則用上游返回的帳號名或帳號 id", "可选,留空则用凭证里的账号名": "可選,留空則用憑證裡的帳號名", "可选,留空则用文件里的昵称": "可選,留空則用檔案裡的暱稱", "可选,留空则用登录名或 uid": "可選,留空則用登入名或 uid", "可选,留空则用脱敏手机号": "可選,留空則用脫敏手機號", "可选,留空则用脱敏手机号或 userId": "可選,留空則用脫敏手機號或 userId", "可选,留空则用账号 uk": "可選,留空則用帳號 uk", "可选,留空则用账号昵称或 userId": "可選,留空則用帳號暱稱或 userId", "可选,留空则用邮箱或令牌尾号": "可選,留空則用郵箱或權杖尾號", "可选,留空用「OfficeAce 果办」": "可選,留空用「OfficeAce 果辦」", "可选,留空自动生成": "可選,留空自動生成", "可选,留空自动用昵称": "可選,留空自動用暱稱", "可选,续期时带上": "可選,續期時帶上", "可选,讯飞侧 userid": "可選,訊飛側 userid", "可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补": "可選:發起對話必需,留空則由閘道器從該帳號已有任務裡自動發現,發現不到時之後手動補", "可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)": "可選:帳號郵箱,用於展示與身份識別(換新權杖也能認回同一帳號)", "可选;UUID 形态,与凭据同生共死": "可選;UUID 形態,與憑據同生共死", "可选;填了才能到期自动续期": "可選;填了才能到期自動續期", "可选;用于去重与展示名(留空时网关会问一次上游)": "可選;用於去重與展示名(留空時閘道器會問一次上游)", "可选;用于生成账号 id 与展示名": "可選;用於生成帳號 id 與展示名", "可选;纯数字串(上游只收 8–24 位数字)": "可選;純數字串(上游只收 8–24 位數字)", "可领取": "可領取", "同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走": "同一家可以混著放:有 Key 的帳號與無鑑權帳號各按各的規則走", "同地址换 anthropic 协议即走它的 Claude 兼容端点。转发必须填 OpenCode Go 的 API Key(订阅制;获取模型清单不需要 Key,但发请求上游会回 401「Missing API key」)": "同地址換 anthropic 協議即走它的 Claude 相容端點。轉發必須填 OpenCode Go 的 API Key(訂閱制;獲取模型清單不需要 Key,但發請求上游會回 401「Missing API key」)", "响应为空": "響應為空", "商汤日日新的 OpenAI 兼容端点;余额查询走控制台账号密码(见下方「余额查询」一段)": "商湯日日新的 OpenAI 相容端點;餘額查詢走控制台帳號密碼(見下方「餘額查詢」一段)", "国内版": "國內版", "国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。": "國內版與**國際版是兩套獨立的帳號與套餐**,憑證與領取的套餐都不通用。", "国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)": "國內版登入頁沒有 Google / GitHub 入口(它用微信 / 手機號 / 郵箱登入)", "国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。": "國內版的登入站點是 www.accio-ai.com,與國際版不是同一站。", "国内版(WorkBuddy)": "國內版(WorkBuddy)", "国内站为 https://api.siliconflow.cn/v1": "國內站為 https://api.siliconflow.cn/v1", "国内站(minimaxi.com);OpenAI 兼容地址为 https://api.minimaxi.com/v1": "國內站(minimaxi.com);OpenAI 相容地址為 https://api.minimaxi.com/v1", "国际版": "國際版", "国际版 z.ai 的 Coding 套餐;OpenAI 兼容地址为 https://api.z.ai/api/coding/paas/v4": "國際版 z.ai 的 Coding 套餐;OpenAI 相容地址為 https://api.z.ai/api/coding/paas/v4", "国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。": "國際版與國內版是**兩套獨立的帳號**(同一帳號體系的兩個站點),憑證不通用。", "国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。": "國際版與國內版帳號體系獨立,請填國際版的憑證。未填 refreshToken 無法自動續期。", "国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口": "國際版登入頁預設只顯示郵箱登入,勾選後恢復 Google / GitHub / X 入口", "国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。": "國際版的推理站點是 api.z.ai,與國內版不是同一站;套餐也各自獨立。", "国际版(WorkBuddy AI)": "國際版(WorkBuddy AI)", "国际站 Coding 套餐;OpenAI 兼容地址为 https://api.minimax.io/v1": "國際站 Coding 套餐;OpenAI 相容地址為 https://api.minimax.io/v1", "在 cc-switch 里找到": "在 cc-switch 裡找到", "在内嵌窗口里完成官方登录,成功后自动加入账号列表。": "在內嵌視窗裡完成官方登入,成功後自動加入帳號列表。", "在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。": "在{label}的 Qoder 帳號設定 → Integrations 生成 PAT(別填 Google / GitHub 的權杖)。兩個地區的帳號與憑證不通用。", "在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。": "在開啟的窗口裡用百度帳號登入 KukuAI 主站(手機驗證碼 / 掃碼均可),登入成功後自動加入帳號列表。閘道器會向百度換髮 KukuAI 業務會話權杖(依賴本機已安裝庫庫AI 客戶端)。", "在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。": "在開啟的窗口裡登入 Google 帳號(Antigravity 的授權頁),授權完成後自動加入帳號列表。", "在浏览器中打开登录页": "在瀏覽器中開啟登入頁", "地区": "地區", "填写凭证": "填寫憑證", "填写凭证添加": "填寫憑證新增", "备注名": "備註名", "套餐": "套餐", "如:智谱 GLM": "如:智譜 GLM", "完成登录后自动加入账号列表,昵称取自上游。": "完成登入後自動加入帳號列表,暱稱取自上游。", "官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth": "官方客戶端憑證目錄:Windows 是 C:\\Users\\<你的使用者名稱>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth", "官方已确认到账": "官方已確認到賬", "导入": "匯入", "导入中…": "匯入中…", "导入凭证文件": "匯入憑證檔案", "导入失败": "匯入失敗", "导入失败:{reason}": "匯入失敗:{reason}", "导入所选": "匯入所選", "导入所选({n})": "匯入所選({n})", "导入桌面端登录态": "匯入桌面版登入態", "将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下": "將開啟內嵌視窗;授權完成後自動加入帳號列表。關掉視窗即取消等待。授權頁最後可能提示無法開啟 zcode:// 連結,這是正常的 —— 結果已由服務端記下", "将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)": "將開啟內嵌視窗;授權完成後自動加入帳號列表。遠端面板可貼上回撥地址。關掉視窗即取消等待。連結 5 分鐘內有效,超時或未點就會作廢(可重新發起)", "将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待": "將開啟內嵌視窗;登入完成後自動加入帳號列表。關掉視窗即取消等待", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的 Trae 帳號);同機完成後自動加入,Docker / 遠端面板按提示貼上位址列回撥地址。", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的 ZCode 帳號);授權完成後自動加入帳號列表。頁面最後可能提示無法開啟 zcode:// 連結,屬正常現象", "将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板": "將用系統預設瀏覽器開啟授權頁(會複用瀏覽器裡已登入的華為雲帳號);瀏覽器與閘道器不在同一臺機器時,按上方說明把最終回撥地址貼上回面板", "将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待": "將用系統預設瀏覽器開啟登入頁(會複用瀏覽器裡已登入的 Accio 帳號);完成登入後自動加入帳號列表,關掉彈窗即取消等待", "小米 MiMo Token Plan 套餐(新加坡站)": "小米 MiMo Token Plan 套餐(新加坡站)", "已到账": "已到賬", "已取消登录等待": "已取消登入等待", "已取消领取": "已取消領取", "已取消验证码": "已取消驗證碼", "已填写手机号,正在发送验证码…": "已填寫手機號,正在傳送驗證碼…", "已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头": "已宣告無需鑑權:帳號會被正常選路,出網時不帶任何鑑權頭", "已导入 {ok} 个,失败 {fail} 个(失败项已标注在列表里)": "已匯入 {ok} 個,失敗 {fail} 個(失敗項已標註在列表裡)", "已建过 · {n} 个账号,点击继续添加": "已建過 · {n} 個帳號,點擊繼續新增", "已建过,点击继续添加账号": "已建過,點擊繼續新增帳號", "已打开官方登录页,请在窗口中完成登录…": "已開啟官方登入頁,請在視窗中完成登入…", "已点发送,等待短信…": "已點發送,等待簡訊…", "已用系统默认浏览器打开登录页,请在浏览器中完成登录…": "已用系統預設瀏覽器開啟登入頁,請在瀏覽器中完成登入…", "已领取,等官方确认": "已領取,等官方確認", "当前壳版本不支持 AutoClaw 网页登录,请更新应用": "當前殼版本不支援 AutoClaw 網頁登入,請更新應用", "当前没有可领取的套餐(活动尚未开始)": "當前沒有可領取的套餐(活動尚未開始)", "当前环境不支持领取(桥接方法缺失)": "當前環境不支援領取(橋接方法缺失)", "必填,CatPaw 账号标识": "必填,CatPaw 帳號標識", "恢复 Google / GitHub 入口": "恢復 Google / GitHub 入口", "手机号": "手機號", "手机验证码登录": "手機驗證碼登入", "打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。": "開啟 Trae SOLO 的官方授權頁(trae.cn)並用你的 Trae 帳號登入:授權完成後官方頁面會跳回本機的一個臨時連接埠;同機部署自動接收,Docker / 遠端面板請按提示覆制位址列回撥地址。", "打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。": "開啟 Accio {label}的官方登入頁({site})並用你的 Accio 帳號登入:登入成功後官方頁面會跳回本機;同機自動完成,Docker / 遠端面板按提示貼上回撥地址即可(授權碼只在本機傳給閘道器,介面不顯示明文 token)。", "打开 Accio {label}登录页": "開啟 Accio {label}登入頁", "打开 Antigravity 网页登录": "開啟 Antigravity 網頁登入", "打开 CatPaw 网页登录": "開啟 CatPaw 網頁登入", "打开 Cline 授权页": "開啟 Cline 授權頁", "打开 CodeArts 授权页": "開啟 CodeArts 授權頁", "打开 Qoder 网页登录": "開啟 Qoder 網頁登入", "打开 Trae 授权页": "開啟 Trae 授權頁", "打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。": "開啟 ZCode {label}的官方授權頁並用你的帳號登入。授權結果由 ZCode 服務端記錄,閘道器在後臺自動取回憑證並加入帳號列表。", "打开 ZCode {label}授权页": "開啟 ZCode {label}授權頁", "打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。": "開啟華為雲 CodeArts 的官方授權頁登入:登入完成後官方頁面會把瀏覽器帶回閘道器自己的 /oauth/callback,閘道器用一次性授權碼換取臨時憑據並加入帳號列表。
    閘道器跑在另一臺機器上時,網頁端會提示把位址列中的最終回撥地址直接貼上回面板。", "打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。": "開啟華為雲授權頁登入:登入完成後閘道器會自動輪詢雲端取回授權碼並加入帳號列表(不需要裝 OfficeAce 桌面版,也無需手工回填回撥地址)。", "打开官方授权页完成设备码授权,登录的是{label}({site})的账号。": "開啟官方授權頁完成裝置碼授權,登入的是{label}({site})的帳號。", "打开授权页": "開啟授權頁", "打开授权页完成确认,账号自动加入 {label}{note}": "開啟授權頁完成確認,帳號自動加入 {label}{note}", "打开方式": "開啟方式", "打开网页登录": "開啟網頁登入", "探测失败:{message}": "探測失敗:{message}", "接入一个兼容上游": "接入一個相容上游", "提交中…": "提交中…", "搜索提供商": "搜尋提供商", "搜索提供商…": "搜尋提供商…", "整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {\"codearts_provider_credential\":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。": "整份貼上官方外掛 / CLIProxyAPI 落盤的憑據 JSON(形如 {\"codearts_provider_credential\":{…}},鋪平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自動續期,必須連 refresh_token 與 oauth_context 一起粘 —— 臨時憑據約一小時到期,缺這半塊就續不回來,只能重新登入。", "文件是{edition}凭证,已按该版本导入": "檔案是{edition}憑證,已按該版本匯入", "新建自定义提供商": "新建自定義提供商", "方案:{label}": "方案:{label}", "明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)": "明文 JWT 或 auth.json 裡的 enc: 加密值(自動解密)", "明文 JWT(国际版账号的 access token)": "明文 JWT(國際版帳號的 access token)", "智谱 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys": "智譜 bigmodel.cn 的 Coding 套餐,Key 在 open.bigmodel.cn/usercenter/apikeys", "未知错误": "未知錯誤", "未能获取授权地址,请重试": "未能獲取授權地址,請重試", "未能读取 cc-switch 数据": "未能讀取 cc-switch 資料", "未领取成功": "未領取成功", "本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用": "本地 Ollama、OpenCode Zen 免費檔這類上游要勾上,否則帳號不可用", "本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)": "本家有兩個**互不替代**的憑證,按你要用的功能填,至少填一個:編碼套餐 API Key 用於轉發推理(打 {site})與查詢視窗限額(每 N 小時 / 每週的剩餘比例);jwt 用於領取套餐與查詢餘額(打 zcode.z.ai 的 billing 閘道器,官方叫 Coding Plan JWT,是一串三段點分的字串)。餘額兩把都能查、但讀到的東西不同:jwt 讀到餘額桶與套餐到期,API Key 讀到視窗限額;而領取只認 jwt、轉發只認 API Key。請填寫 {label}帳號的憑證 —— {plan}(最容易拿到的辦法:直接用上方的「網頁登入」—— 它會替你把這個 API Key 換好,兩個憑證一起拿到。)", "本机 Ollama 的 OpenAI 兼容端点,无需 API Key(默认已勾上「该上游无需鉴权」,鉴权头一个都不发)": "本機 Ollama 的 OpenAI 相容端點,無需 API Key(預設已勾上「該上游無需鑑權」,鑑權頭一個都不發)", "本次未确认到账": "本次未確認到賬", "条可导入": "條可匯入", "条配置,其中": "條配置,其中", "桌面运行时不可用(Tauri 未初始化)": "桌面執行時不可用(Tauri 未初始化)", "模型网关基址": "模型閘道器基址", "正在打开百度登录页…": "正在開啟百度登入頁…", "正在扫描本机 cc-switch…": "正在掃描本機 cc-switch…", "正在等待{name}登录完成;完成或取消后才能发起新的登录": "正在等待{name}登入完成;完成或取消後才能發起新的登入", "每周": "每週", "每日": "每日", "每月": "每月", "没有则无法自动续期": "沒有則無法自動續期", "没有匹配「{keyword}」的提供商": "沒有匹配「{keyword}」的提供商", "添加 {name} 账号": "新增 {name} 帳號", "添加中…": "新增中…", "添加到 ": "新增到 ", "添加失败:{reason}": "新增失敗:{reason}", "添加小浣熊账号": "新增小浣熊帳號", "添加方式": "新增方式", "添加账号": "新增帳號", "火山引擎 Coding 套餐;通用推理接入点为 https://ark.cn-beijing.volces.com/api/v3": "火山引擎 Coding 套餐;通用推理接入點為 https://ark.cn-beijing.volces.com/api/v3", "点击添加账号": "點擊新增帳號", "点开即预填,填 Key 接入": "點開即預填,填 Key 接入", "点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。": "點按鈕後先過一次滑塊驗證(官方風控),隨後開啟登入頁,登入完成即自動新增帳號。
    這是國際版官方唯一的登入方式;已在客戶端登入過的,用「匯入桌面版登入態」更快。", "用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。": "用 AutoClaw 帳號繫結的手機號登入:點擊「獲取驗證碼」,收到簡訊後填入下方並登入。驗證碼由本機直接提交給官方介面,介面不顯示 token。", "用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。": "用 CatPaw 帳號完成登入(美團 passport),成功後自動加入帳號列表。", "用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。": "用 Loomy 帳號繫結的手機號登入:點「獲取驗證碼」後填入即可。這是本家最省事的入口。", "用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)": "用於轉發;形如 apiKey.secret 兩段點分(不填則這個帳號不能轉發)", "用于领取套餐与查询余额;不填则这个账号不能领取与查余额": "用於領取套餐與查詢餘額;不填則這個帳號不能領取與查餘額", "用户 ID": "使用者 ID", "用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。": "用繫結的手機號登入:點「獲取驗證碼」後填入即可。這是國內版官方唯一的登入方式。", "留空则用提供商名称": "留空則用提供商名稱", "登录 / 添加 {name} 账号": "登入 / 新增 {name} 帳號", "登录 session(一长串)": "登入 session(一長串)", "登录中…": "登入中…", "登录失败:{message}": "登入失敗:{message}", "登录已结束": "登入已結束", "登录并添加": "登入並新增", "登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)": "登入態檔案路徑:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的使用者名稱>\\.box-agent\\config\\auth.json)", "确定删除自定义提供商「{name}」?将同时删除该提供商下 {count} 个账号,删除后无法恢复。": "確定刪除自定義提供商「{name}」?將同時刪除該提供商下 {count} 個帳號,刪除後無法恢復。", "等待 Accio {label}登录完成…": "等待 Accio {label}登入完成…", "等待 CatPaw 登录完成…": "等待 CatPaw 登入完成…", "等待 Cline 授权确认…": "等待 Cline 授權確認…", "等待 CodeArts 登录完成…": "等待 CodeArts 登入完成…", "等待 Google 授权完成…": "等待 Google 授權完成…", "等待 KukuAI 登录完成…": "等待 KukuAI 登入完成…", "等待 OfficeAce 登录完成…": "等待 OfficeAce 登入完成…", "等待 Qoder 授权完成…": "等待 Qoder 授權完成…", "等待 Trae 授权完成…": "等待 Trae 授權完成…", "等待 ZCode {label}授权完成…": "等待 ZCode {label}授權完成…", "等待小浣熊登录完成…": "等待小浣熊登入完成…", "等待登录完成…": "等待登入完成…", "等待网页登录…": "等待網頁登入…", "粘贴 API Key": "貼上 API Key", "粘贴 API 令牌": "貼上 API 權杖", "粘贴 Accio 的 accessToken": "貼上 Accio 的 accessToken", "粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。": "貼上 Antigravity 的 Google refresh token(以 1// 開頭;直接貼上含 refresh_token= 的整行也行)。
    這是網頁登入之外的手工入口(例如從已登入的官方 IDE 裡匯出)。refresh token 不會過期,access token 到期由閘道器自動續期;權杖丟了只能重新走 Google 授權,請妥善儲存。", "粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。": "貼上 Command Code 的 API Key(user_ 開頭;從官方 CLI 的 ~/.commandcode/auth.json 或網頁 studio 獲取)。整行 / 帶引號 / 帶 Bearer 字首地粘都行,閘道器會自己剝成裸 key。key 不過期、也沒有續期介面,失效後重新獲取即可;新增時閘道器會做一次輕量探活,失敗不影響新增。", "粘贴 Cookie": "貼上 Cookie", "粘贴 Google refresh token": "貼上 Google refresh token", "粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。": "貼上 ModelScope 的 API 權杖(ms- 開頭,在 {site} 的「存取權杖」頁獲取)。
    {siteNote}
    這枚權杖兩用:閘道器既用它調推理,也用它讀帳號身份、魔粒餘額與每日簽到。權杖長期有效、沒有續期介面,失效後重新獲取再粘一次即可。", "粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。": "貼上 OrcaTerm 的 OAuth accessToken(JWT,三段點分;從桌面客戶端 data.bin 或 Web 版 Cookie ot_session 獲取)。直接貼上含 Bearer / ot_session= 的整行也行,閘道器會自己剝成裸 token。新增後由閘道器自動續期(上游有續期介面),無需跟隨 2 小時時效手動更換。", "粘贴 Qoder 个人访问令牌(pt-…)": "貼上 Qoder 個人存取權杖(pt-…)", "粘贴 accessToken": "貼上 accessToken", "粘贴 access_token(一长串 JWT)": "貼上 access_token(一長串 JWT)", "粘贴 session cookie": "貼上 session cookie", "粘贴 token / refreshToken": "貼上 token / refreshToken", "粘贴 workos:… 开头的令牌(不带前缀也会自动补上)": "貼上 workos:… 開頭的權杖(不帶字首也會自動補上)", "粘贴登录凭据": "貼上登入憑據", "粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。": "貼上的是登入 session(同時是模型閘道器的 token)。Loomy 沒有續期介面,session 有效期約 14 天,過期後重新登入即可。", "粘贴网关凭据": "貼上閘道器憑據", "粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。": "貼上網頁登入態 cookie monkeycode_ai_session 的值(在瀏覽器裡複製整段 Cookie 直接貼上也行,閘道器會自己剝出值)。
    {siteNote}
    MonkeyCode 沒有續期介面:session 有效期約 30 天(硬限制),過期後重新登入網頁、再貼上一次即可。", "系统浏览器": "系統瀏覽器", "系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。": "系統瀏覽器可複用已有登入態(國際版推薦);內嵌視窗更乾淨。", "系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Cline 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Google 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的 Zai / Google 帳號);完成後自動加入列表", "系统浏览器打开(复用已登录的美团账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入的美團帳號);完成後自動加入列表", "系统浏览器打开(复用已登录账号);完成后自动加入列表": "系統瀏覽器開啟(複用已登入帳號);完成後自動加入列表", "系统默认浏览器": "系統預設瀏覽器", "编码套餐 API Key": "編碼套餐 API Key", "网关 Secret": "閘道器 Secret", "网页登录": "網頁登入", "网页登录的打开方式": "網頁登入的開啟方式", "网页登录(Zai / Google)": "網頁登入(Zai / Google)", "自定义": "自定義", "自建聚合面板:填你自己的站点地址。余额查询用该账号的 API Key 打 {base}/v1/usage,不需要额外配置": "自建聚合面板:填你自己的站點地址。餘額查詢用該帳號的 API Key 打 {base}/v1/usage,不需要額外配置", "自建聚合面板:填你自己的站点地址;余额查询要另填 NewAPI 的个人访问令牌(见下方「余额查询」一段)": "自建聚合面板:填你自己的站點地址;餘額查詢要另填 NewAPI 的個人存取權杖(見下方「餘額查詢」一段)", "获取风控配置失败,将直接尝试领取:{message}": "獲取風控配置失敗,將直接嘗試領取:{message}", "获取验证码": "獲取驗證碼", "该上游无需鉴权(不发送鉴权头)": "該上游無需鑑權(不傳送鑑權頭)", "该提供商": "該提供商", "该提供商账号添加功能即将上线": "該提供商帳號新增功能即將上線", "该自定义提供商已不存在(可能已被删除),请刷新后重试": "該自定義提供商已不存在(可能已被刪除),請重新整理後重試", "请先选择一个自定义提供商": "請先選擇一個自定義提供商", "请在弹出的滑块中完成验证(官方要求的风控步骤)": "請在彈出的滑塊中完成驗證(官方要求的風控步驟)", "请填写 11 位大陆手机号": "請填寫 11 位大陸手機號", "请填写 6 位数字验证码": "請填寫 6 位數字驗證碼", "请填写 Base URL": "請填寫 Base URL", "请填写 {label}": "請填寫 {label}", "请填写名称": "請填寫名稱", "请完成验证…": "請完成驗證…", "读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows": "讀取 %APPDATA%/AutoClaw/auth.json 並解密,僅 Windows", "读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录": "讀取 ~/.cline/data/settings/providers.json,需已在 Cline 客戶端登入", "读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录": "讀取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客戶端登入", "读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录": "讀取本機 KukuAI 客戶端登入態(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客戶端登入", "读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录": "讀取本機 OrcaTerm 客戶端登入態(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客戶端登入", "读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。": "讀本機客戶端當前登入態(明文 Cookie,無需解密)。客戶端執行時 Cookies 檔案被獨佔佔用,匯入前請先關閉 KukuAI 客戶端。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。客戶端重新登入後點「重新整理 Token」同步。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。客戶端重新登入後重新匯入即可。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。用 Zai / Google 登入客戶端的使用者走這一條。", "读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。": "讀本機客戶端當前登入態,每次即時讀取(刪掉這條記錄不影響客戶端登入態)。這一條歸入 {label}。", "读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。": "讀本機客戶端當前登入的 OAuth 權杖(明文 JSON,無需解密)。匯入後由閘道器自動續期,無需跟隨客戶端的 2 小時時效手動換權杖。", "账号信息": "帳號資訊", "账号信息不完整,请刷新后重试": "帳號資訊不完整,請重新整理後重試", "账号已添加,但请留意:{warning}": "帳號已新增,但請留意:{warning}", "账号版本": "帳號版本", "账号类型": "帳號型別", "账号:{name}
    ": "帳號:{name}
    ", "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 创建": "走 Inference Providers 路由,Key 在 hf.co/settings/tokens 建立", "还没有账号": "還沒有帳號", "这一家当前不支持网页登录,请改用填写凭证": "這一家當前不支援網頁登入,請改用填寫憑證", "这个账号当前没有可自动领的活动(只自动领每日登录赠送积分)": "這個帳號當前沒有可自動領的活動(只自動領每日登入贈送積分)", "这份额度走「活动套餐」通道:若转发时提示编码套餐已到期,": "這份額度走「活動套餐」通道:若轉發時提示編碼套餐已到期,", "这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。": "這裡填國內站(modelscope.cn)的帳號:請貼上國內站的權杖。國際站(modelscope.ai)是另一家 provider、另一套帳號,兩邊的權杖不通用。", "这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。": "這裡填國內站(monkeycode-ai.com)的帳號:請貼上國內站的 session。國際站(monkeycode-ai.net)是另一家 provider、另一套帳號,兩邊的憑證不通用。", "这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。": "這裡填國際站(modelscope.ai)的帳號:請貼上國際站的權杖。國內站(modelscope.cn)是另一家 provider、另一套帳號,兩邊的權杖不通用。", "这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。": "這裡填國際站(monkeycode-ai.net)的帳號:請貼上國際站的 session。國內站(monkeycode-ai.com)是另一家 provider、另一套帳號,兩邊的憑證不通用。", "选择凭证文件导入": "選擇憑證檔案匯入", "选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。": "選擇官方客戶端的登入態憑證檔案(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 匯出的帳號 JSON(巢狀 / 扁平形均可),也可以直接從本機官方客戶端讀取。", "选择提供商": "選擇提供商", "选择的文件不是合法 JSON": "選擇的檔案不是合法 JSON", "选择要添加账号的提供商": "選擇要新增帳號的提供商", "重新扫描": "重新掃描", "鉴权": "鑑權", "阿里云 Token Plan 套餐(国际站)": "阿里雲 Token Plan 套餐(國際站)", "阿里云百炼 Coding 套餐(国内站)": "阿里雲百鍊 Coding 套餐(國內站)", "阿里云百炼 Coding 套餐(国际站)": "阿里雲百鍊 Coding 套餐(國際站)", "阿里云百炼模型服务(国际站,OpenAI 兼容模式)": "阿里雲百鍊模型服務(國際站,OpenAI 相容模式)", "需要图形验证码:登录窗口已弹出,请填写后继续": "需要圖形驗證碼:登入視窗已彈出,請填寫後繼續", "预置 API": "預置 API", "领取 CodeArts 每日福利": "領取 CodeArts 每日福利", "领取失败:{message}": "領取失敗:{message}", "领取并让官方确认": "領取並讓官方確認", "风控验证配置不完整,请稍后重试": "風控驗證配置不完整,請稍後重試", "验证码": "驗證碼", "验证码已发送。收到后填入下方并点「登录并添加」": "驗證碼已傳送。收到後填入下方並點「登入並新增」", "验证码已发送,请查看手机短信": "驗證碼已傳送,請檢視手機簡訊", "验证码已发送,请查看手机短信。填入下方并点「登录并添加」即完成登录": "驗證碼已傳送,請檢視手機簡訊。填入下方並點「登入並新增」即完成登入", "验证码已发送,请查看短信": "驗證碼已傳送,請檢視簡訊", "验证码校验失败,请重试": "驗證碼校驗失敗,請重試", "验证码校验超时,请重试": "驗證碼校驗超時,請重試", "验证码组件不可用,请重试": "驗證碼元件不可用,請重試", "验证码组件初始化超时,请重试": "驗證碼元件初始化超時,請重試", "验证码组件加载失败,请检查网络后重试": "驗證碼元件載入失敗,請檢查網路後重試", "验证码组件加载异常,请重试": "驗證碼元件載入異常,請重試", "验证码组件加载超时,请检查网络后重试": "驗證碼元件載入超時,請檢查網路後重試", "验证码组件未加载,请重启应用后重试": "驗證碼元件未載入,請重啟應用後重試", "(免费额度池,模型名带 cline-free/ 前缀)。": "(免費額度池,模型名帶 cline-free/ 字首)。", "(其中 {n} 把恢复为不限制)": "(其中 {n} 把恢復為不限制)", "(必填)": "(必填)", "(有效期 {window})": "(有效期 {window})", "(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。": "(訂閱池,模型名帶 cline-pass/ 字首,需要帳號有對應訂閱)。", ",下一次最快 {minutes} 分钟后": ",下一次最快 {minutes} 分鐘後", ",并从 {n} 把 Key 的可用提供商里移除": ",並從 {n} 把 Key 的可用提供商裡移除" }); diff --git a/desktop-tauri/ui/i18n/zh-Hant/checkin.js b/desktop-tauri/ui/i18n/zh-Hant/checkin.js index de373903..6c685912 100644 --- a/desktop-tauri/ui/i18n/zh-Hant/checkin.js +++ b/desktop-tauri/ui/i18n/zh-Hant/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:zh-Hant/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO 的 checkin_credits 領取 · 按自然日 0 點重新整理", "UMID 组件安装失败:{error}": "UMID 元件安裝失敗:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 國內版 · 查詢任務樹後一鍵點亮/領獎 · 含開學季與貓貓旅行 · 點擊行展開明細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 國際版保活模型,按順序回退", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 國際版日活任務的免費模型 · 全域一份,與條目無關", "{date}(每天 {time})": "{date}(每天 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n} 項可完成", "{n} 项待领": "{n} 項待領", "{total} 账号 · {done} 已签": "{total} 帳號 · {done} 已籤", "{total} 项任务 · {pending} 项可完成": "{total} 項任務 · {pending} 項可完成", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 元件已安裝,下輪簽到即可領取國際版積分", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定時簽到已開啟", "✅ 开学季任务执行完成": "✅ 開學季任務執行完成", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長任務執行完成:積分 +{credit} 能量 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 新手福利領取完成,累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 簽到完成:{succeeded}/{total} 個帳號成功領取{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空提交恢復預設({defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空清單並儲存 = 恢復預設鏈(當前預設:{defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「免费领积分」的每日任务 · 逐个领取": "「免費領積分」的每日任務 · 逐個領取", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一次性福利 · 簽到後自動查詢並領取,領完記在本機不再查上游 · 點擊行展開任務清單", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "一次領當天全部獎勵(每日簽到 + 新人禮) · 冪等由上游保證", "一键安装组件": "一鍵安裝元件", "一键完成": "一鍵完成", "一键领取({n})": "一鍵領取({n})", "上次执行:{line}": "上次執行:{line}", "上次签到时间": "上次簽到時間", "上次领取 {time} · 领取需通过滑块验证码": "上次領取 {time} · 領取需通過滑塊驗證碼", "下次 {date}": "下次 {date}", "下次 {date} · 点此管理条目": "下次 {date} · 點此管理條目", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它與 ZCode 的每日/套餐福利領取見「活動福利」。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它的每日福利就在上方「每日簽到」裡;ZCode 的套餐領取見「活動福利」。", "与国内版同一套任务接口 · 站点不同": "與國內版同一套任務介面 · 站點不同", "今天已领 {n} 份": "今天已領 {n} 份", "今天未领": "今天未領", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "今天(北京時間 {day})已領取 · 官方確認到賬 {n} 項 · 明天可再領", "今日已执行": "今日已執行", "今日已派出": "今日已派出", "今日已领取": "今日已領取", "今日签到": "今日簽到", "今日签到进度": "今日簽到進度", "从清单里移除": "從清單裡移除", "保活": "保活", "保活 {n}": "保活 {n}", "保活+领取": "保活+領取", "保活中…": "保活中…", "保活模型链": "保活模型鏈", "全选": "全選", "全部 {n} 家": "全部 {n} 家", "全部完成": "全部完成", "全部查询": "全部查詢", "全部结果": "全部結果", "全部账号均可签到": "全部帳號均可簽到", "全部领取": "全部領取", "关着:所有条目都不执行": "關著:所有條目都不執行", "删除失败:{error}": "刪除失敗:{error}", "删除定时条目": "刪除定時條目", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活並在網頁通道建會話點亮日活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点时逐个签到,已勾 {n} / {total} 家": "到點時逐個簽到,已勾 {n} / {total} 家", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 錯過時點開機後會自動補籤", "去领取": "去領取", "另有 {n} 个账号不参与每日签到": "另有 {n} 個帳號不參與每日簽到", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "只領取已完成任務的獎勵(冪等,重複點不會重複入帳)", "可完成": "可完成", "可派出": "可派出", "可选 · 缺省显示时刻": "可選 · 預設顯示時刻", "可领奖": "可領獎", "后端未返回定时签到数据": "後端未返回定時簽到資料", "后端未返回签到中心数据": "後端未返回簽到中心資料", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "國際版簽到需要 UMID 元件生成裝置風控身份(本機未檢測到)。", "在途": "在途", "填入缺省链": "填入預設鏈", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "填好時刻與簽到範圍後點「儲存」;名稱可以留空(介面顯示時刻)", "失败 {n}": "失敗 {n}", "套餐明细": "套餐明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "安裝 Qoder 客戶端或 qodercli 後即可(無需重啟閘道器)。", "安装中…": "安裝中…", "官方客户端的每日签到任务": "官方客戶端的每日簽到任務", "定时签到": "定時簽到", "定时签到已关闭": "定時簽到已關閉", "尚未查询": "尚未查詢", "尚未查询任务状态": "尚未查詢任務狀態", "巡检一次": "巡檢一次", "已保存:{label}": "已儲存:{label}", "已保存:保活模型链": "已儲存:保活模型鏈", "已保存:定时条目": "已儲存:定時條目", "已删除定时条目": "已刪除定時條目", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "已完成活躍上報(連登已點亮),但活動未開啟(本次沒有可領的獎勵)", "已抽 {n} 次": "已抽 {n} 次", "已有结果 {checked} / 共 {total} 个账号": "已有結果 {checked} / 共 {total} 個帳號", "已签": "已籤", "已领 {claimed}/{total} · 累计 {earned} 积分": "已領 {claimed}/{total} · 累計 {earned} 積分", "已领养": "已領養", "已领取": "已領取", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "帶裝置風控身份領取「每日 100 Credits」 · 需要 UMID 元件", "开学季执行失败:{error}": "開學季執行失敗:{error}", "开学季执行完成:{message}": "開學季執行完成:{message}", "开学季活动": "開學季活動", "开着:启用的条目按各自时刻执行": "開著:啟用的條目按各自時刻執行", "待签": "待籤", "待领新手福利": "待領新手福利", "总开关": "總開關", "总开关已关闭 · 在「定时签到」页打开": "總開關已關閉 · 在「定時簽到」頁開啟", "成功 {n}": "成功 {n}", "成长任务": "成長任務", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長任務完成({done} 項成功、{failed} 項失敗),積分 +{credit} 能量 +{energy}", "成长任务执行失败:{error}": "成長任務執行失敗:{error}", "执行失败:{error}": "執行失敗:{error}", "执行并抽奖": "執行並抽獎", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "執行開學季任務並抽空抽獎機會(分享/對話/專家事件)", "把缺省链填进清单,再点「保存」生效": "把預設鏈填進清單,再點「儲存」生效", "抽奖机会 {n} 次": "抽獎機會 {n} 次", "按住拖动调整顺序": "按住拖動調整順序", "按住拖动,调整这个模型在链里的顺序": "按住拖動,調整這個模型在鏈裡的順序", "按序逐个尝试,共 {n} 个": "按序逐個嘗試,共 {n} 個", "按结果筛选": "按結果篩選", "探测 + 领取 + 保活 · 与定时签到同一套组合": "探測 + 領取 + 保活 · 與定時簽到同一套組合", "探测活动并领取日活奖励 · 不做保活": "探測活動並領取日活獎勵 · 不做保活", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "接單+點亮+領獎(只處理已實測沉澱的任務)", "搜账号 / 收益 / 错误 / 触发原因": "搜帳號 / 收益 / 錯誤 / 觸發原因", "收起新建": "收起新建", "新建定时条目": "新建定時條目", "新手福利": "新手福利", "新手福利有 {n} 项领取失败,可重试": "新手福利有 {n} 項領取失敗,可重試", "无": "無", "无独立签到接口 · 每天替账号打一次首次登录积分": "無獨立簽到介面 · 每天替帳號打一次首次登入積分", "无账号": "無帳號", "暂不可领": "暫不可領", "暂不支持": "暫不支援", "暂无启用的条目 · 点此添加": "暫無啟用的條目 · 點此新增", "有未保存的改动": "有未儲存的改動", "未勾选提供商": "未勾選提供商", "未开启": "未開啟", "未解锁": "未解鎖", "未领养(领养需先完成当日对话量)": "未領養(領養需先完成當日對話量)", "未领取": "未領取", "本地台账里今天还没领过;活动期内每天发一份新套餐": "本地臺賬裡今天還沒領過;活動期內每天發一份新套餐", "本地台账里今天(北京时间)领过的套餐:{plans}": "本地臺賬裡今天(北京時間)領過的套餐:{plans}", "条启用": "條啟用", "查询于 {time}": "查詢於 {time}", "查询任务": "查詢任務", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "查詢任務樹並一鍵點亮/領獎(含開學季與貓貓旅行)", "查询失败:{error}": "查詢失敗:{error}", "桌面端每日积分链路": "桌面版每日積分鏈路", "正在读取定时签到数据…": "正在讀取定時簽到資料…", "正在读取签到数据…": "正在讀取簽到資料…", "每天 {time}": "每天 {time}", "每天 {time} · {scope}": "每天 {time} · {scope}", "每天时刻": "每天時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "每執行一次簽到 · 每個帳號一條明細 · 結果與收益以後端落賬為準", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "每日活躍任務 · 網頁會話保活點亮日活,領取才加積分 · 兩者可分開執行", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "每日福利 · 領取 → 確認 → 回讀核實 · 按北京時間自然日重置", "每日签到": "每日簽到", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "每條條目各有時刻與範圍 · 各自當天去重 · 錯過時點開機自動補籤", "每账号一条明细 · 点此查看「签到记录」": "每帳號一條明細 · 點此檢視「簽到記錄」", "没有可领套餐的账号(ZCode 未添加)。": "沒有可領套餐的帳號(ZCode 未新增)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "沒有可領福利的帳號(CodeArts / ZCode 未新增)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "沒有支援成長任務的帳號(需要 WorkBuddy 國內版)。", "没有支持新手福利的账号": "沒有支援新手福利的帳號", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "沒有支援新手福利的帳號 —— 目前有 Loomy、小浣熊、CodeArts 三家。", "没有符合筛选条件的签到记录": "沒有符合篩選條件的簽到記錄", "没有需要执行的任务": "沒有需要執行的任務", "活动福利": "活動福利", "活动(campaign)领取 · 每天 10:00 刷新": "活動(campaign)領取 · 每天 10:00 重新整理", "活跃上报与保活均未成功,且活动未开启": "活躍上報與保活均未成功,且活動未開啟", "活跃上报完成,但保活未成功且活动未开启": "活躍上報完成,但保活未成功且活動未開啟", "活跃上报完成,但活动未开启": "活躍上報完成,但活動未開啟", "活跃上报成功": "活躍上報成功", "活跃保活失败": "活躍保活失敗", "活跃保活完成": "活躍保活完成", "活跃保活完成,但活动未开启": "活躍保活完成,但活動未開啟", "活跃保活完成,但活跃上报失败且活动未开启": "活躍保活完成,但活躍上報失敗且活動未開啟", "添加条目": "新增條目", "添加模型": "新增模型", "清单为空 —— 保存后恢复缺省链": "清單為空 —— 儲存後恢復預設鏈", "清单里已经有「{name}」": "清單裡已經有「{name}」", "清空失败:{error}": "清空失敗:{error}", "清空签到记录": "清空簽到記錄", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "點「套餐明細」看領到了哪幾份、什麼時候生效;活動期內每天可再領", "点击行展开账号明细 · 单账号签到不受范围限制": "點擊行展開帳號明細 · 單帳號簽到不受範圍限制", "独立链路 · 只提供手动入口 · 不进自动签到": "獨立鏈路 · 只提供手動入口 · 不進自動簽到", "猫猫旅行": "貓貓旅行", "猫猫旅行失败:{error}": "貓貓旅行失敗:{error}", "猫猫旅行失败:{message}": "貓貓旅行失敗:{message}", "猫猫旅行:{message}": "貓貓旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "用免費模型與網頁會話維持帳號活躍 · 不領取獎勵", "确定删除「{name}」?删除后到点不再执行。": "確定刪除「{name}」?刪除後到點不再執行。", "确定清空全部签到记录?清空后无法恢复。": "確定清空全部簽到記錄?清空後無法恢復。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "確定清空當前篩選出的簽到記錄?清空後無法恢復。", "移除 {name}": "移除 {name}", "立即全部签到": "立即全部簽到", "签到": "簽到", "签到中…": "簽到中…", "签到中心分区": "簽到中心分割槽", "签到失败:{error}": "簽到失敗:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "簽到完成:{succeeded}/{total} 成功{active},{failed} 個失敗", "签到成功": "簽到成功", "签到提供商": "簽到提供商", "签到范围": "簽到範圍", "签到触发时刻": "簽到觸發時刻", "签到记录": "簽到記錄", "签到记录时间范围": "簽到記錄時間範圍", "签到记录表": "簽到記錄表", "累计签到记录": "累計簽到記錄", "结算于 {time}": "結算於 {time}", "能量 {n}": "能量 {n}", "腾讯每日签到接口 · 仅国内版": "騰訊每日簽到介面 · 僅國內版", "至少勾一家才能保存(不勾等于这条条目不签到)": "至少勾一家才能儲存(不勾等於這條條目不簽到)", "读取定时签到数据失败:{error}": "讀取定時簽到資料失敗:{error}", "读取签到数据失败:{error}": "讀取簽到資料失敗:{error}", "读取签到记录失败:{error}": "讀取簽到記錄失敗:{error}", "跳过 {n}": "跳過 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運營活動交付(領取 → 確認 → 回讀核實)· 領的是套餐贈送積分", "还没执行过": "還沒執行過", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "還沒有定時條目 —— 點「新增條目」建一條,或到「簽到中心」手動簽到。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "還沒有簽到記錄 —— 手動簽到或等定時條目執行後,明細會出現在這裡。", "连登 {n} 天": "連登 {n} 天", "部分": "部分", "重签": "重籤", "重试": "重試", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "限時體驗套餐 · 領取需滑塊驗證碼 · 逐份檢視與領取", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "限時體驗套餐(start-plan),活動期內每天一份 · 領取需滑塊驗證碼", "需真实操作": "需真實操作", "非活动期": "非活動期", "项": "項", "领取": "領取", "领取中": "領取中", "领取中…": "領取中…", "领取失败": "領取失敗", "领取失败:{error}": "領取失敗:{error}", "(共 {n} 个账号)": "(共 {n} 個帳號)", "(能量 / 连登读数本次未取到)": "(能量/連登讀數本次未取到)", ",日活保活 {n} 个": ",日活保活 {n} 個" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO 的 checkin_credits 領取 · 按自然日 0 點重新整理", "UMID 组件安装失败:{error}": "UMID 元件安裝失敗:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 國內版 · 查詢任務樹後一鍵點亮/領獎 · 含開學季與貓貓旅行 · 點擊行展開明細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 國際版保活模型,按順序回退", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 國際版日活任務的免費模型 · 全域一份,與條目無關", "{date}(每天 {time})": "{date}(每天 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n} 項可完成", "{n} 项待领": "{n} 項待領", "{total} 账号 · {done} 已签": "{total} 帳號 · {done} 已籤", "{total} 项任务 · {pending} 项可完成": "{total} 項任務 · {pending} 項可完成", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 元件已安裝,下輪簽到即可領取國際版積分", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定時簽到已開啟", "✅ 开学季任务执行完成": "✅ 開學季任務執行完成", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長任務執行完成:積分 +{credit} 能量 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 新手福利領取完成,累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 簽到完成:{succeeded}/{total} 個帳號成功領取{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空提交恢復預設({defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空清單並儲存 = 恢復預設鏈(當前預設:{defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「免费领积分」的每日任务 · 逐个领取": "「免費領積分」的每日任務 · 逐個領取", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一次性福利 · 簽到後自動查詢並領取,領完記在本機不再查上游 · 點擊行展開任務清單", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "一次領當天全部獎勵(每日簽到 + 新人禮) · 冪等由上游保證", "一键安装组件": "一鍵安裝元件", "一键完成": "一鍵完成", "一键领取({n})": "一鍵領取({n})", "上次执行:{line}": "上次執行:{line}", "上次签到时间": "上次簽到時間", "上次领取 {time} · 领取需通过滑块验证码": "上次領取 {time} · 領取需通過滑塊驗證碼", "下次 {date}": "下次 {date}", "下次 {date} · 点此管理条目": "下次 {date} · 點此管理條目", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它與 ZCode 的每日/套餐福利領取見「活動福利」。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它的每日福利就在上方「每日簽到」裡;ZCode 的套餐領取見「活動福利」。", "与国内版同一套任务接口 · 站点不同": "與國內版同一套任務介面 · 站點不同", "与国内版同一套链路 · 站点不同、令牌不通用": "與國內版同一套鏈路 · 站點不同、權杖不通用", "今天已领 {n} 份": "今天已領 {n} 份", "今天未领": "今天未領", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "今天(北京時間 {day})已領取 · 官方確認到賬 {n} 項 · 明天可再領", "今日已执行": "今日已執行", "今日已派出": "今日已派出", "今日已领取": "今日已領取", "今日签到": "今日簽到", "今日签到进度": "今日簽到進度", "从清单里移除": "從清單裡移除", "保活": "保活", "保活 {n}": "保活 {n}", "保活+领取": "保活+領取", "保活中…": "保活中…", "保活模型链": "保活模型鏈", "全选": "全選", "全部 {n} 家": "全部 {n} 家", "全部完成": "全部完成", "全部查询": "全部查詢", "全部结果": "全部結果", "全部账号均可签到": "全部帳號均可簽到", "全部领取": "全部領取", "关着:所有条目都不执行": "關著:所有條目都不執行", "删除失败:{error}": "刪除失敗:{error}", "删除定时条目": "刪除定時條目", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活並在網頁通道建會話點亮日活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点时逐个签到,已勾 {n} / {total} 家": "到點時逐個簽到,已勾 {n} / {total} 家", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 錯過時點開機後會自動補籤", "去领取": "去領取", "另有 {n} 个账号不参与每日签到": "另有 {n} 個帳號不參與每日簽到", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "只領取已完成任務的獎勵(冪等,重複點不會重複入帳)", "可完成": "可完成", "可派出": "可派出", "可选 · 缺省显示时刻": "可選 · 預設顯示時刻", "可领奖": "可領獎", "后端未返回定时签到数据": "後端未返回定時簽到資料", "后端未返回签到中心数据": "後端未返回簽到中心資料", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "國際版簽到需要 UMID 元件生成裝置風控身份(本機未檢測到)。", "在途": "在途", "填入缺省链": "填入預設鏈", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "填好時刻與簽到範圍後點「儲存」;名稱可以留空(介面顯示時刻)", "失败 {n}": "失敗 {n}", "套餐明细": "套餐明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "安裝 Qoder 客戶端或 qodercli 後即可(無需重啟閘道器)。", "安装中…": "安裝中…", "官方客户端的每日签到任务": "官方客戶端的每日簽到任務", "定时签到": "定時簽到", "定时签到已关闭": "定時簽到已關閉", "尚未查询": "尚未查詢", "尚未查询任务状态": "尚未查詢任務狀態", "巡检一次": "巡檢一次", "已保存:{label}": "已儲存:{label}", "已保存:保活模型链": "已儲存:保活模型鏈", "已保存:定时条目": "已儲存:定時條目", "已删除定时条目": "已刪除定時條目", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "已完成活躍上報(連登已點亮),但活動未開啟(本次沒有可領的獎勵)", "已抽 {n} 次": "已抽 {n} 次", "已有结果 {checked} / 共 {total} 个账号": "已有結果 {checked} / 共 {total} 個帳號", "已签": "已籤", "已领 {claimed}/{total} · 累计 {earned} 积分": "已領 {claimed}/{total} · 累計 {earned} 積分", "已领养": "已領養", "已领取": "已領取", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "帶裝置風控身份領取「每日 100 Credits」 · 需要 UMID 元件", "开学季执行失败:{error}": "開學季執行失敗:{error}", "开学季执行完成:{message}": "開學季執行完成:{message}", "开学季活动": "開學季活動", "开着:启用的条目按各自时刻执行": "開著:啟用的條目按各自時刻執行", "待签": "待籤", "待领新手福利": "待領新手福利", "总开关": "總開關", "总开关已关闭 · 在「定时签到」页打开": "總開關已關閉 · 在「定時簽到」頁開啟", "成功 {n}": "成功 {n}", "成长任务": "成長任務", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長任務完成({done} 項成功、{failed} 項失敗),積分 +{credit} 能量 +{energy}", "成长任务执行失败:{error}": "成長任務執行失敗:{error}", "执行失败:{error}": "執行失敗:{error}", "执行并抽奖": "執行並抽獎", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "執行開學季任務並抽空抽獎機會(分享/對話/專家事件)", "把缺省链填进清单,再点「保存」生效": "把預設鏈填進清單,再點「儲存」生效", "抽奖机会 {n} 次": "抽獎機會 {n} 次", "按住拖动调整顺序": "按住拖動調整順序", "按住拖动,调整这个模型在链里的顺序": "按住拖動,調整這個模型在鏈裡的順序", "按序逐个尝试,共 {n} 个": "按序逐個嘗試,共 {n} 個", "按结果筛选": "按結果篩選", "探测 + 领取 + 保活 · 与定时签到同一套组合": "探測 + 領取 + 保活 · 與定時簽到同一套組合", "探测活动并领取日活奖励 · 不做保活": "探測活動並領取日活獎勵 · 不做保活", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "接單+點亮+領獎(只處理已實測沉澱的任務)", "搜账号 / 收益 / 错误 / 触发原因": "搜帳號 / 收益 / 錯誤 / 觸發原因", "收起新建": "收起新建", "新建定时条目": "新建定時條目", "新手福利": "新手福利", "新手福利有 {n} 项领取失败,可重试": "新手福利有 {n} 項領取失敗,可重試", "无": "無", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "無獨立簽到介面 · 每天替帳號打一次登入資訊(即當日魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "無獨立簽到介面 · 每天替帳號打一次首次登入積分", "无账号": "無帳號", "暂不可领": "暫不可領", "暂不支持": "暫不支援", "暂无启用的条目 · 点此添加": "暫無啟用的條目 · 點此新增", "有未保存的改动": "有未儲存的改動", "未勾选提供商": "未勾選提供商", "未开启": "未開啟", "未解锁": "未解鎖", "未领养(领养需先完成当日对话量)": "未領養(領養需先完成當日對話量)", "未领取": "未領取", "本地台账里今天还没领过;活动期内每天发一份新套餐": "本地臺賬裡今天還沒領過;活動期內每天發一份新套餐", "本地台账里今天(北京时间)领过的套餐:{plans}": "本地臺賬裡今天(北京時間)領過的套餐:{plans}", "条启用": "條啟用", "查询于 {time}": "查詢於 {time}", "查询任务": "查詢任務", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "查詢任務樹並一鍵點亮/領獎(含開學季與貓貓旅行)", "查询失败:{error}": "查詢失敗:{error}", "桌面端每日积分链路": "桌面版每日積分鏈路", "正在读取定时签到数据…": "正在讀取定時簽到資料…", "正在读取签到数据…": "正在讀取簽到資料…", "每天 {time}": "每天 {time}", "每天 {time} · {scope}": "每天 {time} · {scope}", "每天时刻": "每天時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "每執行一次簽到 · 每個帳號一條明細 · 結果與收益以後端落賬為準", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "每日活躍任務 · 網頁會話保活點亮日活,領取才加積分 · 兩者可分開執行", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "每日福利 · 領取 → 確認 → 回讀核實 · 按北京時間自然日重置", "每日签到": "每日簽到", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "每條條目各有時刻與範圍 · 各自當天去重 · 錯過時點開機自動補籤", "每账号一条明细 · 点此查看「签到记录」": "每帳號一條明細 · 點此檢視「簽到記錄」", "没有可领套餐的账号(ZCode 未添加)。": "沒有可領套餐的帳號(ZCode 未新增)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "沒有可領福利的帳號(CodeArts / ZCode 未新增)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "沒有支援成長任務的帳號(需要 WorkBuddy 國內版)。", "没有支持新手福利的账号": "沒有支援新手福利的帳號", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "沒有支援新手福利的帳號 —— 目前有 Loomy、小浣熊、CodeArts 三家。", "没有符合筛选条件的签到记录": "沒有符合篩選條件的簽到記錄", "没有需要执行的任务": "沒有需要執行的任務", "活动福利": "活動福利", "活动(campaign)领取 · 每天 10:00 刷新": "活動(campaign)領取 · 每天 10:00 重新整理", "活跃上报与保活均未成功,且活动未开启": "活躍上報與保活均未成功,且活動未開啟", "活跃上报完成,但保活未成功且活动未开启": "活躍上報完成,但保活未成功且活動未開啟", "活跃上报完成,但活动未开启": "活躍上報完成,但活動未開啟", "活跃上报成功": "活躍上報成功", "活跃保活失败": "活躍保活失敗", "活跃保活完成": "活躍保活完成", "活跃保活完成,但活动未开启": "活躍保活完成,但活動未開啟", "活跃保活完成,但活跃上报失败且活动未开启": "活躍保活完成,但活躍上報失敗且活動未開啟", "添加条目": "新增條目", "添加模型": "新增模型", "清单为空 —— 保存后恢复缺省链": "清單為空 —— 儲存後恢復預設鏈", "清单里已经有「{name}」": "清單裡已經有「{name}」", "清空失败:{error}": "清空失敗:{error}", "清空签到记录": "清空簽到記錄", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "點「套餐明細」看領到了哪幾份、什麼時候生效;活動期內每天可再領", "点击行展开账号明细 · 单账号签到不受范围限制": "點擊行展開帳號明細 · 單帳號簽到不受範圍限制", "独立链路 · 只提供手动入口 · 不进自动签到": "獨立鏈路 · 只提供手動入口 · 不進自動簽到", "猫猫旅行": "貓貓旅行", "猫猫旅行失败:{error}": "貓貓旅行失敗:{error}", "猫猫旅行失败:{message}": "貓貓旅行失敗:{message}", "猫猫旅行:{message}": "貓貓旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "用免費模型與網頁會話維持帳號活躍 · 不領取獎勵", "确定删除「{name}」?删除后到点不再执行。": "確定刪除「{name}」?刪除後到點不再執行。", "确定清空全部签到记录?清空后无法恢复。": "確定清空全部簽到記錄?清空後無法恢復。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "確定清空當前篩選出的簽到記錄?清空後無法恢復。", "移除 {name}": "移除 {name}", "立即全部签到": "立即全部簽到", "签到": "簽到", "签到中…": "簽到中…", "签到中心分区": "簽到中心分割槽", "签到失败:{error}": "簽到失敗:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "簽到完成:{succeeded}/{total} 成功{active},{failed} 個失敗", "签到成功": "簽到成功", "签到提供商": "簽到提供商", "签到范围": "簽到範圍", "签到触发时刻": "簽到觸發時刻", "签到记录": "簽到記錄", "签到记录时间范围": "簽到記錄時間範圍", "签到记录表": "簽到記錄表", "累计签到记录": "累計簽到記錄", "结算于 {time}": "結算於 {time}", "能量 {n}": "能量 {n}", "腾讯每日签到接口 · 仅国内版": "騰訊每日簽到介面 · 僅國內版", "至少勾一家才能保存(不勾等于这条条目不签到)": "至少勾一家才能儲存(不勾等於這條條目不簽到)", "读取定时签到数据失败:{error}": "讀取定時簽到資料失敗:{error}", "读取签到数据失败:{error}": "讀取簽到資料失敗:{error}", "读取签到记录失败:{error}": "讀取簽到記錄失敗:{error}", "跳过 {n}": "跳過 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運營活動交付(領取 → 確認 → 回讀核實)· 領的是套餐贈送積分", "还没执行过": "還沒執行過", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "還沒有定時條目 —— 點「新增條目」建一條,或到「簽到中心」手動簽到。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "還沒有簽到記錄 —— 手動簽到或等定時條目執行後,明細會出現在這裡。", "连登 {n} 天": "連登 {n} 天", "部分": "部分", "重签": "重籤", "重试": "重試", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "限時體驗套餐 · 領取需滑塊驗證碼 · 逐份檢視與領取", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "限時體驗套餐(start-plan),活動期內每天一份 · 領取需滑塊驗證碼", "需真实操作": "需真實操作", "非活动期": "非活動期", "项": "項", "领取": "領取", "领取中": "領取中", "领取中…": "領取中…", "领取失败": "領取失敗", "领取失败:{error}": "領取失敗:{error}", "(共 {n} 个账号)": "(共 {n} 個帳號)", "(能量 / 连登读数本次未取到)": "(能量/連登讀數本次未取到)", ",日活保活 {n} 个": ",日活保活 {n} 個" }); diff --git a/desktop-tauri/ui/islands/ui.js b/desktop-tauri/ui/islands/ui.js index 2726f20f..5d9d4644 100644 --- a/desktop-tauri/ui/islands/ui.js +++ b/desktop-tauri/ui/islands/ui.js @@ -1,23 +1,23 @@ -var Mse=Object.defineProperty;var Dse=(xi,gl,to)=>gl in xi?Mse(xi,gl,{enumerable:!0,configurable:!0,writable:!0,value:to}):xi[gl]=to;var ln=(xi,gl,to)=>Dse(xi,typeof gl!="symbol"?gl+"":gl,to);(function(){"use strict";function xi(e,t){for(var a=0;ao[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var to={exports:{}},Ud={};var oC;function P5(){if(oC)return Ud;oC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:e,type:o,key:f,ref:c!==void 0?c:null,props:d}}return Ud.Fragment=t,Ud.jsx=a,Ud.jsxs=a,Ud}var iC;function _5(){return iC||(iC=1,to.exports=P5()),to.exports}var s=_5(),jv={exports:{}},ct={};var cC;function L5(){if(cC)return ct;cC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),j=Symbol.iterator;function S(M){return M===null||typeof M!="object"?null:(M=j&&M[j]||M["@@iterator"],typeof M=="function"?M:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,T={};function D(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}D.prototype.isReactComponent={},D.prototype.setState=function(M,U){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,U,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=D.prototype;function A(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}var R=A.prototype=new C;R.constructor=A,k(R,D.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},_=Object.prototype.hasOwnProperty;function L(M,U,Z){var ae=Z.ref;return{$$typeof:e,type:M,key:U,ref:ae!==void 0?ae:null,props:Z}}function H(M,U){return L(M.type,U,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function z(M){var U={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Z){return U[Z]})}var Q=/\/+/g;function K(M,U){return typeof M=="object"&&M!==null&&M.key!=null?z(""+M.key):U.toString(36)}function X(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(P,P):(M.status="pending",M.then(function(U){M.status==="pending"&&(M.status="fulfilled",M.value=U)},function(U){M.status==="pending"&&(M.status="rejected",M.reason=U)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function q(M,U,Z,ae,ce){var J=typeof M;(J==="undefined"||J==="boolean")&&(M=null);var ie=!1;if(M===null)ie=!0;else switch(J){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(M.$$typeof){case e:case t:ie=!0;break;case y:return ie=M._init,q(ie(M._payload),U,Z,ae,ce)}}if(ie)return ce=ce(M),ie=ae===""?"."+K(M,0):ae,I(ce)?(Z="",ie!=null&&(Z=ie.replace(Q,"$&/")+"/"),q(ce,U,Z,"",function(fe){return fe})):ce!=null&&(B(ce)&&(ce=H(ce,Z+(ce.key==null||M&&M.key===ce.key?"":(""+ce.key).replace(Q,"$&/")+"/")+ie)),U.push(ce)),1;ie=0;var ge=ae===""?".":ae+":";if(I(M))for(var ee=0;ee"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Fd(e){const{overflow:t,overflowX:a,overflowY:o,display:c}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&c!=="inline"&&c!=="contents"}function B5(e){return/^(table|td|th)$/.test(Hs(e))}function Dm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const H5=/transform|translate|scale|rotate|perspective|filter/,U5=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Nv;function kv(e){const t=At(e)?xr(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Cv()&&(bi(t.backdropFilter)||bi(t.filter))||H5.test(t.willChange||"")||U5.test(t.contain||"")}function V5(e){let t=so(e);for(;dn(t)&&!no(t);){if(kv(t))return t;if(Dm(t))return null;t=so(t)}return null}function Cv(){return Nv==null&&(Nv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nv}function no(e){return/^(html|body|#document)$/.test(Hs(e))}function xr(e){return Sn(e).getComputedStyle(e)}function Im(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function so(e){if(Hs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bc(e)&&e.host||xl(e);return Bc(t)?t.host:t}function dC(e){const t=so(e);return no(t)?(e.ownerDocument||e).body:dn(t)&&Fd(t)?t:dC(t)}function Hc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const c=dC(e),d=c===((o=e.ownerDocument)==null?void 0:o.body),f=Sn(c);if(d){const p=Tv(f);return t.concat(f,f.visualViewport||[],Fd(c)?c:[],p&&a?Hc(p):[])}else return t.concat(c,Hc(c,[],a))}function Tv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ev={...z5},fC={};function Ds(e,t){const a=x.useRef(fC);return a.current===fC&&(a.current=e(t)),a}const Av=Ev.useInsertionEffect,F5=Av&&Av!==Ev.useLayoutEffect?Av:e=>e();function Ie(e){const t=Ds($5).current;return t.next=e,F5(t.effect),t.trampoline}function $5(){const e={next:void 0,callback:q5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function q5(){}const De=typeof document<"u"?x.useLayoutEffect:()=>{};function Rv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const Ov={};function Wr(e,t,a,o,c){if(!a&&!o&&!c&&!e)return Pm(t);let d=Pm(e);return t&&(d=$d(d,t)),a&&(d=$d(d,a)),o&&(d=$d(d,o)),c&&(d=$d(d,c)),d}function G5(e){if(e.length===0)return Ov;if(e.length===1)return Pm(e[0]);let t=Pm(e[0]);for(let a=1;a=65&&c<=90&&(typeof t=="function"||typeof t>"u")}function Mv(e){return typeof e=="function"}function mC(e,t){return Mv(e)?e(t):e??Ov}function X5(e,t){return t?e?(...a)=>{const o=a[0];if(xC(o)){const d=o;_m(d);const f=t(...a);return d.baseUIHandlerPrevented||e?.(...a),f}const c=t(...a);return e?.(...a),c}:hC(t):e}function hC(e){return e&&((...t)=>{const a=t[0];return xC(a)&&_m(a),e(...t)})}function _m(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gC(e,t){return t?e?t+" "+e:t:e}function xC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Q5(e,t){return function(o,...c){const d=new URL(e);return d.searchParams.set("code",o.toString()),c.forEach(f=>d.searchParams.append("args[]",f)),`${t} error #${o}; visit ${d} for the full message.`}}const on=Q5("https://base-ui.com/production-error","Base UI"),bC=x.createContext(void 0);function vC(e=!1){const t=x.useContext(bC);if(t===void 0&&!e)throw new Error(on(16));return t}function Z5(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:c=0,isNativeButton:d}=e,f=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const b={onKeyDown(y){a&&t&&y.key!=="Tab"&&y.preventDefault()}};return o||(b.tabIndex=c,!d&&a&&(b.tabIndex=t?c:-1)),(d&&(t||f)||!d&&a)&&(b["aria-disabled"]=a),d&&(!t||p)&&(b.disabled=a),b},[o,a,t,f,p,d,c])}}function $t(e){return e?.ownerDocument||document}function Uc(e,t,{detail:a=0}={}){e.dispatchEvent(new(Sn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Jr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:c=!0,composite:d}=e,f=x.useRef(null),p=vC(!0),h=d??p!==void 0,{props:b}=Z5({focusableWhenDisabled:a,disabled:t,composite:h,tabIndex:o,isNativeButton:c}),y=x.useCallback(()=>{const j=f.current;Dv(j)&&h&&t&&b.disabled===void 0&&j.disabled&&(j.disabled=!1)},[t,b.disabled,h]);De(y,[y]);const v=x.useCallback((j={})=>{const{onClick:S,onMouseDown:N,onKeyUp:k,onKeyDown:T,onPointerDown:D,...C}=j;return Wr({onClick(A){if(t){A.preventDefault();return}S?.(A)},onMouseDown(A){t||N?.(A)},onKeyDown(A){if(t||(_m(A),T?.(A),A.baseUIHandlerPrevented))return;const R=A.target===A.currentTarget,I=A.currentTarget,P=Dv(I),O=!c&&W5(I),_=R&&(c?P:!O),L=A.key==="Enter",H=A.key===" ",B=I.getAttribute("role"),z=B?.startsWith("menuitem")||B==="option"||B==="gridcell";if(R&&h&&H){if(A.defaultPrevented&&z)return;A.preventDefault(),(!c||P)&&(A.preventBaseUIHandler(),Uc(I,A));return}if(!_||c||!H&&!L){R&&O&&H&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),L&&(A.preventBaseUIHandler(),Uc(I,A)))},onKeyUp(A){if(!t){if(_m(A),k?.(A),A.target===A.currentTarget&&c&&h&&Dv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!c&&!h&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Uc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}D?.(A)}},c?{type:"button"}:{role:"button"},b,C)},[t,b,h,c]),w=Ie(j=>{f.current=j,y()});return{getButtonProps:v,buttonRef:w}}function Dv(e){return dn(e)&&e.tagName==="BUTTON"}function W5(e){return dn(e)&&e.tagName==="A"&&!!e.href}function ea(e,t,a,o){const c=Ds(yC).current;return ez(c,e,t,a,o)&&wC(c,[e,t,a,o]),c.callback}function J5(e){const t=Ds(yC).current;return tz(t,e)&&wC(t,e),t.callback}function yC(){return{callback:null,cleanup:null,refs:[]}}function ez(e,t,a,o,c){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==c}function tz(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function wC(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let c=0;c{for(let c=0;c=e}function jC(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Iv(19)?a?.ref:t.ref)??null}function qt(){}const Or=Object.freeze([]),fn=Object.freeze({});function sz(e,t){const a={};for(const o in e){const c=e[o];if(t?.hasOwnProperty(o)){const d=t[o](c);d!=null&&Object.assign(a,d);continue}c===!0?a[`data-${o.toLowerCase()}`]="":c&&(a[`data-${o.toLowerCase()}`]=c.toString())}return a}function rz(e,t){return typeof e=="function"?e(t):e}function az(e,t){return typeof e=="function"?e(t):e}function yt(e,t,a={}){let o=t.render;a.enabled!==!1&&(o=cz(o));const c=lz(t,a,o);if(a.enabled===!1)return null;const d=a.state??fn;return uz(e,o,c,d)}function lz(e,t,a){const{className:o,style:c}=e,{state:d=fn,ref:f,props:p,stateAttributesMapping:h,enabled:b=!0}=t,y=b?rz(o,d):void 0,v=b?az(c,d):void 0,w=b?sz(d,h):fn,j=b&&p?oz(p):void 0,S=b?Rv(w,j)??{}:fn;return typeof document<"u"&&(b?Array.isArray(f)?S.ref=J5([S.ref,jC(a),...f]):S.ref=ea(S.ref,jC(a),f):ea(null,null)),b?(y!==void 0&&(S.className=gC(S.className,y)),v!==void 0&&(S.style=Rv(S.style,v)),S):fn}function oz(e){return Array.isArray(e)?G5(e):Wr(void 0,e)}const iz=Symbol.for("react.lazy");function cz(e){if(e?.$$typeof!==iz)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function uz(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const c=Wr(a,t.props);return c.ref=a.ref,x.cloneElement(t,c)}if(e&&typeof e=="string")return dz(e,a);throw new Error(on(8))}function dz(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const fz=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,focusableWhenDisabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{getButtonProps:y,buttonRef:v}=Jr({disabled:d,focusableWhenDisabled:f,native:p});return yt("button",t,{state:{disabled:d},ref:[a,v],props:[b,y]})});function SC(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,CC=NC,Vc=(e,t)=>a=>{var o;if(t?.variants==null)return CC(e,a?.class,a?.className);const{variants:c,defaultVariants:d}=t,f=Object.keys(c).map(b=>{const y=a?.[b],v=d?.[b];if(y===null)return null;const w=kC(y)||kC(v);return c[b][w]}),p=a&&Object.entries(a).reduce((b,y)=>{let[v,w]=y;return w===void 0||(b[v]=w),b},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((b,y)=>{let{class:v,className:w,...j}=y;return Object.entries(j).every(S=>{let[N,k]=S;return Array.isArray(k)?k.includes({...d,...p}[N]):{...d,...p}[N]===k})?[...b,v,w]:b},[]);return CC(e,f,h,a?.class,a?.className)},pz=(e,t)=>{const a=new Array(e.length+t.length);for(let o=0;o({classGroupId:e,validator:t}),TC=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a}),Lm="-",EC=[],hz="arbitrary..",gz=e=>{const t=bz(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return xz(f);const p=f.split(Lm),h=p[0]===""&&p.length>1?1:0;return AC(p,h,t)},getConflictingClassGroupIds:(f,p)=>{if(p){const h=o[f],b=a[f];return h?b?pz(b,h):h:b||EC}return a[f]||EC}}},AC=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;const c=e[t],d=a.nextPart.get(c);if(d){const b=AC(e,t+1,d);if(b)return b}const f=a.validators;if(f===null)return;const p=t===0?e.join(Lm):e.slice(t).join(Lm),h=f.length;for(let b=0;be.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),a=t.indexOf(":"),o=t.slice(0,a);return o?hz+o:void 0})(),bz=e=>{const{theme:t,classGroups:a}=e;return vz(a,t)},vz=(e,t)=>{const a=TC();for(const o in e){const c=e[o];Pv(c,a,o,t)}return a},Pv=(e,t,a,o)=>{const c=e.length;for(let d=0;d{if(typeof e=="string"){wz(e,t,a);return}if(typeof e=="function"){jz(e,t,a,o);return}Sz(e,t,a,o)},wz=(e,t,a)=>{const o=e===""?t:RC(t,e);o.classGroupId=a},jz=(e,t,a,o)=>{if(Nz(e)){Pv(e(o),t,a,o);return}t.validators===null&&(t.validators=[]),t.validators.push(mz(a,e))},Sz=(e,t,a,o)=>{const c=Object.entries(e),d=c.length;for(let f=0;f{let a=e;const o=t.split(Lm),c=o.length;for(let d=0;d"isThemeGetter"in e&&e.isThemeGetter===!0,kz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),o=Object.create(null);const c=(d,f)=>{a[d]=f,t++,t>e&&(t=0,o=a,a=Object.create(null))};return{get(d){let f=a[d];if(f!==void 0)return f;if((f=o[d])!==void 0)return c(d,f),f},set(d,f){d in a?a[d]=f:c(d,f)}}},_v="!",OC=":",Cz=[],MC=(e,t,a,o,c)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:o,isExternal:c}),Tz=e=>{const{prefix:t,experimentalParseClassName:a}=e;let o=c=>{const d=[];let f=0,p=0,h=0,b;const y=c.length;for(let N=0;Nh?b-h:void 0;return MC(d,j,w,S)};if(t){const c=t+OC,d=o;o=f=>f.startsWith(c)?d(f.slice(c.length)):MC(Cz,!1,f,void 0,!0)}if(a){const c=o;o=d=>a({className:d,parseClassName:c})}return o},Ez=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((a,o)=>{t.set(a,1e6+o)}),a=>{const o=[];let c=[];for(let d=0;d0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Az=e=>({cache:kz(e.cacheSize),parseClassName:Tz(e),sortModifiers:Ez(e),postfixLookupClassGroupIds:Rz(e),...gz(e)}),Rz=e=>{const t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let o=0;o{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:f}=t,p=[],h=e.trim().split(Oz);let b="";for(let y=h.length-1;y>=0;y-=1){const v=h[y],{isExternal:w,modifiers:j,hasImportantModifier:S,baseClassName:N,maybePostfixModifierPosition:k}=a(v);if(w){b=v+(b.length>0?" "+b:b);continue}let T=!!k,D;if(T){const P=N.substring(0,k);D=o(P);const O=D&&f[D]?o(N):void 0;O&&O!==D&&(D=O,T=!1)}else D=o(N);if(!D){if(!T){b=v+(b.length>0?" "+b:b);continue}if(D=o(N),!D){b=v+(b.length>0?" "+b:b);continue}T=!1}const C=j.length===0?"":j.length===1?j[0]:d(j).join(":"),A=S?C+_v:C,R=A+D;if(p.indexOf(R)>-1)continue;p.push(R);const I=c(D,T);for(let P=0;P0?" "+b:b)}return b},Dz=(...e)=>{let t=0,a,o,c="";for(;t{if(typeof e=="string")return e;let t,a="";for(let o=0;o{let a,o,c,d;const f=h=>{const b=t.reduce((y,v)=>v(y),e());return a=Az(b),o=a.cache.get,c=a.cache.set,d=p,p(h)},p=h=>{const b=o(h);if(b)return b;const y=Mz(h,a);return c(h,y),y};return d=f,(...h)=>d(Dz(...h))},Pz=[],Ns=e=>{const t=a=>a[e]||Pz;return t.isThemeGetter=!0,t.themeKey=e,t},IC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_z=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Lz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Bz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Hz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ro=e=>_z.test(e),Nt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Lv=e=>e.endsWith("%")&&Nt(e.slice(0,-1)),bl=e=>Lz.test(e),_C=()=>!0,Vz=e=>zz.test(e)&&!Bz.test(e),zv=()=>!1,Fz=e=>Hz.test(e),$z=e=>Uz.test(e),qz=e=>!Ke(e)&&!Xe(e),Gz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Kz=e=>ao(e,VC,zv),Ke=e=>IC.test(e),vi=e=>ao(e,FC,Vz),LC=e=>ao(e,tB,Nt),Yz=e=>ao(e,qC,_C),Xz=e=>ao(e,$C,zv),zC=e=>ao(e,HC,zv),Qz=e=>ao(e,UC,$z),zm=e=>ao(e,GC,Fz),Xe=e=>PC.test(e),qd=e=>yi(e,FC),Zz=e=>yi(e,$C),BC=e=>yi(e,HC),Wz=e=>yi(e,VC),Jz=e=>yi(e,UC),Bm=e=>yi(e,GC,!0),eB=e=>yi(e,qC,!0),ao=(e,t,a)=>{const o=IC.exec(e);return o?o[1]?t(o[1]):a(o[2]):!1},yi=(e,t,a=!1)=>{const o=PC.exec(e);return o?o[1]?t(o[1]):a:!1},HC=e=>e==="position"||e==="percentage",UC=e=>e==="image"||e==="url",VC=e=>e==="length"||e==="size"||e==="bg-size",FC=e=>e==="length",tB=e=>e==="number",$C=e=>e==="family-name",qC=e=>e==="number"||e==="weight",GC=e=>e==="shadow",nB=Iz(()=>{const e=Ns("color"),t=Ns("font"),a=Ns("text"),o=Ns("font-weight"),c=Ns("tracking"),d=Ns("leading"),f=Ns("breakpoint"),p=Ns("container"),h=Ns("spacing"),b=Ns("radius"),y=Ns("shadow"),v=Ns("inset-shadow"),w=Ns("text-shadow"),j=Ns("drop-shadow"),S=Ns("blur"),N=Ns("perspective"),k=Ns("aspect"),T=Ns("ease"),D=Ns("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...A(),Xe,Ke],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],O=()=>[Xe,Ke,h],_=()=>[ro,"full","auto",...O()],L=()=>[$a,"none","subgrid",Xe,Ke],H=()=>["auto",{span:["full",$a,Xe,Ke]},$a,Xe,Ke],B=()=>[$a,"auto",Xe,Ke],z=()=>["auto","min","max","fr",Xe,Ke],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...O()],q=()=>[ro,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],$=()=>[p,ro,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Y=()=>[ro,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],F=()=>[e,Xe,Ke],G=()=>[...A(),BC,zC,{position:[Xe,Ke]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",Wz,Kz,{size:[Xe,Ke]}],M=()=>[Lv,qd,vi],U=()=>["","none","full",b,Xe,Ke],Z=()=>["",Nt,qd,vi],ae=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Nt,Lv,BC,zC],ie=()=>["","none",S,Xe,Ke],ge=()=>["none",Nt,Xe,Ke],ee=()=>["none",Nt,Xe,Ke],fe=()=>[Nt,Xe,Ke],te=()=>[ro,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bl],breakpoint:[bl],color:[_C],container:[bl],"drop-shadow":[bl],ease:["in","out","in-out"],font:[qz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bl],shadow:[bl],spacing:["px",Nt],text:[bl],"text-shadow":[bl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ro,Ke,Xe,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Xe,Ke]}],"container-named":[Gz],columns:[{columns:[Nt,"auto",Ke,Xe,p]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Xe,Ke]}],basis:[{basis:[ro,"full","auto",p,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nt,ro,"auto","initial","none",Ke]}],grow:[{grow:["",Nt,Xe,Ke]}],shrink:[{shrink:["",Nt,Xe,Ke]}],order:[{order:[$a,"first","last","none",Xe,Ke]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh","none",...q()]}],"font-size":[{text:["base",a,qd,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,eB,Yz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lv,Ke]}],"font-family":[{font:[Zz,Xz,t]}],"font-features":[{"font-features":[Ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Xe,Ke]}],"line-clamp":[{"line-clamp":[Nt,"none",Xe,LC]}],leading:[{leading:["none",d,...O()]}],"list-image":[{"list-image":["none",Xe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Nt,"from-font","auto",Xe,vi]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Nt,"auto",Xe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[$a,Xe,Ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Xe,Ke],radial:["",Xe,Ke],conic:["",$a,Xe,Ke]},Jz,Qz]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Nt,Xe,Ke]}],"outline-w":[{outline:["",Nt,qd,vi]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,Bm,zm]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",v,Bm,zm]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Nt,vi]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",w,Bm,zm]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Nt,Xe,Ke]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Xe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xe,Ke]}],filter:[{filter:["","none",Xe,Ke]}],blur:[{blur:ie()}],brightness:[{brightness:[Nt,Xe,Ke]}],contrast:[{contrast:[Nt,Xe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",j,Bm,zm]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Nt,Xe,Ke]}],"hue-rotate":[{"hue-rotate":[Nt,Xe,Ke]}],invert:[{invert:["",Nt,Xe,Ke]}],saturate:[{saturate:[Nt,Xe,Ke]}],sepia:[{sepia:["",Nt,Xe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Xe,Ke]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Nt,Xe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[Nt,Xe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nt,Xe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nt,Xe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",Nt,Xe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[Nt,Xe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[Nt,Xe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Nt,Xe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nt,"initial",Xe,Ke]}],ease:[{ease:["linear","initial",T,Xe,Ke]}],delay:[{delay:[Nt,Xe,Ke]}],animate:[{animate:["none",D,Xe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Xe,Ke]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[Xe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[$a,Xe,Ke]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xe,Ke]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Nt,qd,vi,LC]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ue(...e){return nB(NC(e))}const sB=Vc(["group/button inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color,transform,box-shadow] duration-150 ease-out","outline-none select-none active:translate-y-[0.5px]","disabled:pointer-events-none disabled:opacity-45 disabled:shadow-none","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:"border-primary bg-primary font-semibold text-primary-on shadow-glow hover:border-primary-hover hover:bg-primary-hover",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"border-transparent bg-transparent text-subtle shadow-none hover:bg-control-hover hover:text-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive hover:bg-destructive-hover",dashed:"border-dashed border-border-strong bg-transparent text-muted-foreground shadow-none hover:border-primary hover:text-primary-fg",link:"border-transparent bg-transparent text-primary shadow-none underline-offset-4 hover:underline"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]","2xs":"h-4 rounded-pill px-1.5 text-[10px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]",icon:"h-[30px] w-[30px] rounded-md p-0","icon-2xs":"size-4 rounded-pill p-0","icon-xs":"size-6 rounded-sm p-0","icon-sm":"h-[26px] w-[26px] rounded-sm p-0","icon-lg":"size-9 rounded-md p-0"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:a,...o}){return s.jsx(fz,{className:Ue(sB({variant:t,size:a}),e),...o})}const rB="data-valid",aB="data-invalid",lB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KC={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},oB={disabled:!1,...KC},wi={valid(e){return e===null?null:e?{[rB]:""}:{[aB]:""}}},YC={invalid:void 0,name:void 0,validityData:{state:lB,errors:[],error:"",value:"",initialValue:null},setValidityData:qt,disabled:void 0,setTouched:qt,setDirty:qt,setFilled:qt,setFocused:qt,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:oB,registerFieldControl:qt,validation:{getValidationProps:(e,t=fn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qt,getInputControl:()=>null,commit:async()=>{},change:qt}},XC=x.createContext(YC);function Sa(e=!0){const t=x.useContext(XC);if(t.setValidityData===qt&&!e)throw new Error(on(28));return t}const iB=x.createContext(void 0);function cB(e=!1){const t=x.useContext(iB);if(!t&&!e)throw new Error(on(86));return t}const uB=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qt,validationMode:"onSubmit",submitCountRef:{current:0}});function Fc(){return x.useContext(uB)}let QC=0;function dB(e,t="mui"){const[a,o]=x.useState(e),c=e||a;return x.useEffect(()=>{a==null&&(QC+=1,o(`${t}-${QC}`))},[a,t]),c}const ZC=Ev.useId;function Gd(e,t){if(ZC!==void 0){const a=ZC();return e??(t?`${t}-${a}`:a)}return dB(e,t)}function Na(e){return Gd(e,"base-ui")}const fB=x.createContext({controlId:void 0,registerControlId:qt,resetControlId:qt,labelId:void 0,setLabelId:qt,messageIds:[],setMessageIds:qt,getDescriptionProps:e=>e});function vl(){return x.useContext(fB)}function Bv(e,t,a,o=!0,c){const[d,f]=x.useState(),p=Na(c?`${c}-label`:void 0),h=e??t??d;return De(()=>{const b=e||t||!o?void 0:pB(a.current,p);d!==b&&f(b)}),h}function pB(e,t){const a=mB(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function mB(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const c=e.nextElementSibling;if(c&&c.htmlFor===a)return c}const o=e.labels;return o&&o[0]}function lo(e={}){const{id:t,enabled:a=!0}=e,{controlId:o,registerControlId:c,resetControlId:d}=vl(),f=Na(),p=Ds(()=>Symbol()),h=x.useRef(!1),b=x.useRef(!1),y=Ie(()=>{!h.current||c===qt||(h.current=!1,c(p.current,void 0))});return De(()=>{if(!a||c===qt){y();return}let v;if(t!==void 0)b.current=!0,v=t;else if(b.current)v=f;else{d();return}if(v===void 0){y();return}h.current=!0,c(p.current,v)},[t,a,c,d,f,p,y]),De(()=>y,[y]),(a?o:void 0)??t??f}function hB(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:gB,platform:xB,maxTouchPoints:bB}=hB(),Hm=gB.toLowerCase(),Kd=xB.toLowerCase(),Yd=/^i(os$|p)/.test(Kd)||Kd==="macintel"&&bB>1,WC="android",Um=Kd===WC||Hm.includes(WC),JC=!Yd&&Kd.startsWith("mac");Kd.startsWith("win");const vB=JC||Yd,yl=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),e1=!yl&&Hm.includes("firefox");!yl&&Hm.includes("chrom");const yB=vB,Hv=/jsdom|happydom/.test(Hm);function or(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Bc(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function cs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Uv="data-base-ui-focusable",t1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ji="ArrowLeft",Si="ArrowRight",Vv="ArrowUp",Vm="ArrowDown",n1="data-starting-style",wB="data-ending-style",jB={[n1]:""},SB={[wB]:""},oo={transitionStatus(e){return e==="starting"?jB:e==="ending"?SB:null}},NB="data-open",kB="data-closed",CB="data-anchor-hidden",s1="data-popup-open",TB="data-pressed",EB={[s1]:""},AB={[s1]:"",[TB]:""},RB={[NB]:""},OB={[kB]:""},MB={[CB]:""},Fv={open(e){return e?EB:null}},$v={open(e){return e?AB:null}},$c={open(e){return e?RB:OB},anchorHidden(e){return e?MB:null}},qv={...$c,...oo},Gv="data-trigger-disabled";function Fm(e,t){if(!At(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute(Gv);for(const[,o]of t.entries())if(Qe(o,a))return!o.hasAttribute(Gv);return!1}function Kv(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function DB(e){return e.matches("html,body")}function $m(e){return dn(e)&&e.matches(t1)}function IB(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${t1}`)!=null}function Yv(e){return e?e.getAttribute("role")==="combobox"&&$m(e):!1}function PB(e){if(!e||Hv)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function qm(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}function io(e,t,a=!0){return e.filter(c=>c.parentId===t).flatMap(c=>[...!a||c.context?.open?[c]:[],...io(e,c.id,a)])}function r1(e,t){let a=[],o=e.find(c=>c.id===t)?.parentId;for(;o;){const c=e.find(d=>d.id===o);o=c?.parentId,c&&(a=a.concat(c))}return a}function ks(e){e.preventDefault(),e.stopPropagation()}function _B(e){return"nativeEvent"in e}function Gm(e){return e.pointerType===""&&e.isTrusted?!0:Um&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Xv(e){return Hv?!1:!Um&&e.width===0&&e.height===0||Um&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function co(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function LB(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const qc=Math.min,wl=Math.max,Km=Math.round,Ni=Math.floor,jl=e=>({x:e,y:e}),zB={left:"right",right:"left",bottom:"top",top:"bottom"};function a1(e,t,a){return wl(e,qc(t,a))}function uo(e,t){return typeof e=="function"?e(t):e}function ta(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Qv(e){return e==="x"?"y":"x"}function Zv(e){return e==="y"?"height":"width"}function na(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wv(e){return Qv(na(e))}function BB(e,t,a){a===void 0&&(a=!1);const o=Sl(e),c=Wv(e),d=Zv(c);let f=c==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(f=Ym(f)),[f,Ym(f)]}function HB(e){const t=Ym(e);return[Jv(e),t,Jv(t)]}function Jv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const l1=["left","right"],o1=["right","left"],UB=["top","bottom"],VB=["bottom","top"];function FB(e,t,a){switch(e){case"top":case"bottom":return a?t?o1:l1:t?l1:o1;case"left":case"right":return t?UB:VB;default:return[]}}function $B(e,t,a,o){const c=Sl(e);let d=FB(ta(e),a==="start",o);return c&&(d=d.map(f=>f+"-"+c),t&&(d=d.concat(d.map(Jv)))),d}function Ym(e){const t=ta(e);return zB[t]+e.slice(t.length)}function qB(e){var t,a,o,c;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(o=e.bottom)!=null?o:0,left:(c=e.left)!=null?c:0}}function i1(e){return typeof e!="number"?qB(e):{top:e,right:e,bottom:e,left:e}}function Xd(e){const{x:t,y:a,width:o,height:c}=e;return{width:o,height:c,top:a,left:t,right:t+o,bottom:a+c,x:t,y:a}}function Xm(e,t,a){return Math.floor(e/t)!==a}function fo(e,t){return t<0||t>=e.length}function Qm(e,t){return Is(e.current,{disabledIndices:t})}function ey(e,t){return Is(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Is(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:c=1}={}){let d=t;do d+=a?-c:c;while(d>=0&&d<=e.length-1&&po(e,d,o));return d}function GB(e,{event:t,orientation:a,loopFocus:o,onLoop:c,rtl:d,cols:f,disabledIndices:p,minIndex:h,maxIndex:b,prevIndex:y,stopEvent:v=!1}){let w=y,j;if(t.key===Vv?j="up":t.key===Vm&&(j="down"),j){const S=[],N=[];let k=!1,T=0;{let _=null,L=-1;e.forEach((H,B)=>{if(H==null)return;T+=1;const z=H.closest('[role="row"]');z&&(k=!0),(z!==_||L===-1)&&(_=z,L+=1,S[L]=[]),S[L].push(B),N[B]=L})}let D=!1,C=0;if(k)for(const _ of S){const L=_.length;L>C&&(C=L),L!==f&&(D=!0)}const A=D&&T{if(!D||y===-1)return;const L=N[y];if(L==null)return;const H=S[L].indexOf(y),B=_==="up"?-1:1;for(let z=L+B,Q=0;Q=S.length){if(!o||A)return;if(z=z<0?S.length-1:0,c){const X=Math.min(H,S[z].length-1),q=S[z][X]??S[z][0],$=c(t,y,q);z=N[$]??z}}const K=S[z];for(let X=Math.min(H,K.length-1);X>=0;X-=1){const q=K[X];if(!po(e,q,p))return q}}},P=_=>{if(!A||y===-1)return;const L=y%R,H=_==="up"?-R:R,B=b-b%R,z=Ni(b/R)+1;for(let Q=y-L+H,K=0;Kb){if(!o)return;Q=Q<0?B:0}const X=Math.min(Q+R-1,b);for(let q=Math.min(Q+L,X);q>=Q;q-=1)if(!po(e,q,p))return q}};v&&ks(t);const O=I(j)??P(j);if(O!==void 0)w=O;else if(y===-1)w=j==="up"?b:h;else if(w=Is(e,{startingIndex:y,amount:R,decrement:j==="up",disabledIndices:p}),o){if(j==="up"&&(y-R_?H:H-R,c&&(w=c(t,y,w))}j==="down"&&y+R>b&&(w=Is(e,{startingIndex:y%R-R,amount:R,disabledIndices:p}),c&&(w=c(t,y,w)))}fo(e,w)&&(w=y)}if(a==="both"){const S=Ni(y/f);t.key===(d?ji:Si)&&(v&&ks(t),y%f!==f-1?(w=Is(e,{startingIndex:y,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y)),t.key===(d?Si:ji)&&(v&&ks(t),y%f!==0?(w=Is(e,{startingIndex:y,decrement:!0,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y));const N=Ni(b/f)===S;fo(e,w)&&(o&&N?(w=t.key===(d?Si:ji)?b:Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))):w=y)}return w}function po(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const c=e[t];return c?!Zm(c)||c.matches(":disabled")?!0:!a&&(c.hasAttribute("disabled")||c.getAttribute("aria-disabled")==="true"):!1}function KB(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zm(e,t=e?xr(e):null){return!e||!e.isConnected||!t||KB(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const YB='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function XB(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Bc(a)?a.host:null}function ty(e){for(const t of Array.from(e.children))if(Hs(t)==="summary")return t;return null}function QB(e,t){const a=ty(t);return!!a&&(e===a||Qe(a,e))}function c1(e){const t=e?Hs(e):"";return e!=null&&e.matches(YB)&&(t!=="summary"||e.parentElement!=null&&Hs(e.parentElement)==="details"&&ty(e.parentElement)===e)&&(t!=="details"||ty(e)==null)&&(t!=="input"||e.type!=="hidden")}function u1(e){if(!c1(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=XB(t)){const a=t!==e,o=Hs(t)==="slot";if(t.hasAttribute("inert")||a&&Hs(t)==="details"&&!t.open&&!QB(e,t)||t.hasAttribute("hidden")||!o&&!ZB(t,a))return!1}return!0}function ZB(e,t){const a=xr(e);return t?a.display!=="none":Zm(e,a)}function d1(e){const t=e.tabIndex;if(t<0){const a=Hs(e);if(a==="details"||a==="audio"||a==="video"||dn(e)&&e.isContentEditable)return 0}return t}function ny(e){if(Hs(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function WB(e,t){const a=ny(e);if(!a)return!0;const o=t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form&&d.checked});return o?o===a:t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form})===a}function f1(e){if(dn(e)&&Hs(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function p1(e,t){f1(e).forEach(a=>{c1(a)&&t.push(a),p1(a,t)})}function m1(e,t,a){f1(e).forEach(o=>{dn(o)&&o.matches(t)&&a.push(o),m1(o,t,a)})}function sy(e){return u1(e)&&d1(e)>=0}function h1(e){const t=[];return p1(e,t),t.filter(u1)}function Qd(e){const t=h1(e);return t.filter(a=>d1(a)>=0&&WB(a,t))}function g1(e,t){const a=Qd(e),o=a.length;if(o===0)return;const c=or($t(e)),d=a.indexOf(c),f=d===-1?t===1?0:o-1:d+t;return a[f]}function ry(e){return g1($t(e).body,1)||e}function x1(e){return g1($t(e).body,-1)||e}function b1(e,t){if(!e)return null;const a=Qd($t(e).body),o=a.length;if(o===0)return null;const c=a.indexOf(e);if(c===-1)return null;const d=(c+t+o)%o;return a[d]}function JB(e){return b1(e,1)}function e4(e){return b1(e,-1)}function Gc(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(a,o)}function t4(e){Qd(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function v1(e){const t=[];m1(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function ay(e){x.useEffect(e,Or)}const Zd=0;class sa{constructor(){ln(this,"currentId",Zd);ln(this,"clear",()=>{this.currentId!==Zd&&(clearTimeout(this.currentId),this.currentId=Zd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new sa}start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zd,a()},t)}isStarted(){return this.currentId!==Zd}}function Zs(){const e=Ds(sa.create).current;return ay(e.disposeEffect),e}function n4(e,t){return e.matches(":disabled")?!1:!t||e.form===t?!0:e.form===null&&!e.hasAttribute("form")}const s4=x.createContext({disabled:!1});function y1(){return x.useContext(s4)}var ly={exports:{}},Us={};var w1;function r4(){if(w1)return Us;w1=1;var e=Vd();function t(y){var v="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ly.exports=r4(),ly.exports}var Cs=S1();const Wm=null;class a4{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let c=0;c=this.callbacks.length||this.callbacks[a]!==null&&(this.callbacks[a]=null,this.callbacksCount-=1)}}let Jm=new a4;class qa{constructor(){ln(this,"currentId",Wm);ln(this,"cancel",()=>{this.currentId!==Wm&&(Jm.cancel(this.currentId),this.currentId=Wm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new qa}static request(t){return Jm.request(t)}static cancel(t){return Jm.cancel(t)}request(t){this.cancel(),this.currentId=Jm.request(()=>{this.currentId=Wm,t()})}}function Kc(){const e=Ds(qa.create).current;return ay(e.disposeEffect),e}function Nl(e){return e==null?e:"current"in e?e.current:e}let eh=null;function l4(e){if(!eh){const t=[];eh=t,queueMicrotask(()=>{eh=null,Cs.flushSync(()=>{for(const a of t)a()})})}eh.push(e)}function N1(e,t=!1,a=!1){const o=Kc();return Ie((c,d=null)=>{o.cancel();const f=Nl(e);if(f==null)return;const p=f,h=()=>{if(!a){Cs.flushSync(c);return}l4(()=>{d?.aborted||c()})};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){c();return}function b(){Promise.all(p.getAnimations().map(y=>y.finished)).then(()=>{d?.aborted||h()},()=>{if(d?.aborted)return;if(p.getAnimations().some(v=>v.pending||v.playState!=="finished")){b();return}h()})}if(t){const y=n1;if(!p.hasAttribute(y)){o.request(b);return}const v=new MutationObserver(()=>{p.hasAttribute(y)||(v.disconnect(),b())});v.observe(p,{attributes:!0,attributeFilter:[y]}),d?.addEventListener("abort",()=>v.disconnect(),{once:!0});return}o.request(b)})}function ra(e){const{enabled:t=!0,open:a,ref:o,batch:c=!1,onComplete:d}=e,f=Ie(d),p=N1(o,a,c);x.useEffect(()=>{if(!t)return;const h=new AbortController;return p(f,h.signal),()=>{h.abort()}},[t,a,f,p])}function ki(e,t=!1,a=!1,o=!1){const[c,d]=x.useState(e&&t?"idle":void 0),[f,p]=x.useState(e&&!o);return e&&!f&&(p(!0),d("starting")),!e&&f&&c!=="ending"&&!a&&d("ending"),!e&&!f&&c==="ending"&&d(void 0),De(()=>{if(!e&&f&&c!=="ending"&&a){const h=qa.request(()=>{d("ending")});return()=>{qa.cancel(h)}}},[e,f,c,a]),De(()=>{if(!e||t)return;const h=qa.request(()=>{d(void 0)});return()=>{qa.cancel(h)}},[t,e]),De(()=>{if(!e||!t)return;e&&f&&c!=="idle"&&d("starting");const h=qa.request(()=>{d("idle")});return()=>{qa.cancel(h)}},[t,e,f,c]),{mounted:f,setMounted:p,transitionStatus:c}}function Ga({controlled:e,default:t,name:a,state:o="value"}){const{current:c}=x.useRef(e!==void 0),[d,f]=x.useState(t),p=c&&e!==void 0?e:d,h=x.useCallback(b=>{c||f(b)},[]);return[p,h]}function Yc(e,t,a,o,c=!0,d){const{registerFieldControl:f}=Sa(),p=Ds(()=>Symbol());De(()=>{const h=p.current;if(!c){f(h,void 0);return}f(h,{controlRef:e,getValue:o,id:t,name:d,value:a})},[e,c,o,t,d,f,p,a]),De(()=>{const h=p.current;return()=>{f(h,void 0)}},[f,p])}function aa(e,t){const a=x.useRef(e),o=Ie(t);De(()=>{a.current!==e&&o(a.current),a.current=e},[e,o])}const Yn="none",mo="trigger-press",Vs="trigger-hover",th="trigger-focus",nh="outside-press",Wd="item-press",oy="close-press",Jd="input-change",Ka="input-clear",o4="input-press",ho="focus-out",Xc="escape-key",iy="list-navigation",k1="keyboard",C1="pointer",T1="cancel-open",i4="disabled",cy="imperative-action",c4="window-resize";function Fe(e,t,a,o){let c=!1,d=!1;const f=o??fn;return{reason:e,event:t??new Event("base-ui"),cancel(){c=!0},allowPropagation(){d=!0},get isCanceled(){return c},get isPropagationAllowed(){return d},trigger:a,...f}}function u4(e,t,a){const o=a??fn;return{reason:e,event:t??new Event("base-ui"),...o}}const d4=x.forwardRef(function(t,a){const{render:o,className:c,id:d,name:f,value:p,disabled:h=!1,onValueChange:b,defaultValue:y,autoFocus:v=!1,style:w,...j}=t,{state:S,name:N,disabled:k,setTouched:T,setDirty:D,validityData:C,setFocused:A,setFilled:R,validationMode:I,validation:P}=Sa(),{clearErrors:O,elementRef:_,submitCountRef:L}=Fc(),H=k||h,B=N??f,z={...S,disabled:H},{labelId:Q}=vl(),K=lo({id:d}),[X]=Ga({controlled:p,default:y,name:"FieldControl",state:"value"}),q=p!==void 0,$=q?X:void 0,Y=$==null?void 0:String($),F=Ie(()=>P.inputRef.current?.value);Yc(P.inputRef,K,Y,F,!H,f),De(()=>{const M=Y??P.inputRef.current?.value;M!==void 0&&R(M!=="")},[Y,P.inputRef,R]),aa(Y,()=>{Y!==void 0&&(O(B),D(Y!==(C.initialValue??"")),P.change(Y))});const G=x.useRef(null),W=Zs();return De(()=>{v&&G.current===or($t(G.current))&&A(!0)},[v,A]),yt("input",t,{ref:[a,G],state:z,props:[{id:K,disabled:H,name:B,ref:P.inputRef,"aria-labelledby":Q,autoFocus:v,...q?{value:$}:{defaultValue:y},onChange(M){const U=M.currentTarget.value,Z=Fe(Yn,M.nativeEvent);b?.(U,Z),!q&&(D(U!==(C.initialValue??"")),R(U!==""),!M.nativeEvent.defaultPrevented&&!Z.isCanceled&&(O(B),P.change(U)))},onFocus(){A(!0)},onBlur(M){if(T(!0),A(!1),I==="onBlur"){const U=M.currentTarget.value;P.commit(U),q&&queueMicrotask(()=>{const Z=P.inputRef.current?.value;Z!==void 0&&Z!==U&&Z!==(C.initialValue??"")&&P.commit(Z)})}},onKeyDown(M){if(M.currentTarget.tagName==="INPUT"&&M.key==="Enter"){T(!0);const U=M.currentTarget.value,Z=M.currentTarget.form;if(Z&&Z===_.current&&!M.defaultPrevented){const ae=M.currentTarget,ce=L.current;W.start(0,()=>{L.current===ce&&P.commit(ae.value)})}else P.commit(U)}}},j,M=>P.getValidationProps(H,M)],stateAttributesMapping:wi})}),f4=x.forwardRef(function(t,a){return s.jsx(d4,{ref:a,...t})});function $e({className:e,type:t,ref:a,...o}){return s.jsx(f4,{ref:a,type:t,"data-slot":"input",className:Ue("h-[30px] w-full min-w-0 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground","file:inline-flex file:border-0 file:bg-transparent file:text-foreground",e),...o})}function Qc({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:Ue("min-h-26 w-full resize-y rounded-md border border-control-border bg-control px-3 py-2.5","font-mono text-[12px] leading-[1.6] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground",e),...t})}function Ci({className:e,...t}){return s.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("group/input-group relative flex h-[30px] w-full min-w-0 items-center rounded-md border border-control-border bg-control","transition-[border-color,box-shadow] duration-150 ease-out","outline-none","has-[[data-slot=input-group-control]:focus-visible]:border-primary","has-[[data-slot=input-group-control]:focus-visible]:shadow-focus","has-[[data-slot=input-group-control]:hover:not(:focus-visible)]:border-control-border-hover","has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-1.5","has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-1.5","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-1.5","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-1.5",e),...t})}const p4=Vc(["flex h-auto cursor-text items-center justify-center gap-1.5 select-none","text-[12px] font-medium text-muted-foreground","group-data-[disabled=true]/input-group:opacity-50"],{variants:{align:{"inline-start":"order-first pl-[9px] has-[>button]:-ml-1","inline-end":"order-last pr-[9px] has-[>button]:-mr-1","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-1.5","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-1.5"}},defaultVariants:{align:"inline-start"}});function Ti({className:e,align:t="inline-start",...a}){return s.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(p4({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus()},...a})}const m4=Vc("flex items-center shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-xs px-1.5",sm:"h-8 gap-1.5 rounded-sm px-2.5","icon-xs":"size-6 rounded-xs p-0","icon-sm":"size-8 rounded-sm p-0"}},defaultVariants:{size:"xs"}});function h4({className:e,type:t="button",variant:a="ghost",size:o="xs",...c}){return s.jsx(se,{type:t,"data-size":o,variant:a,className:Ue(m4({size:o}),e),...c})}function Ei({className:e,...t}){return s.jsx($e,{"data-slot":"input-group-control",className:Ue("flex-1 rounded-none border-0 bg-transparent shadow-none focus:border-0 focus:shadow-none",e),...t})}function g4(e){return yt(e.defaultTagName??"div",e,e)}const x4=Vc("inline-flex w-fit shrink-0 items-center justify-center gap-[5px] overflow-hidden whitespace-nowrap border font-semibold",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive",outline:"border-control-border bg-control text-subtle",ghost:"border-transparent bg-transparent text-muted-foreground",link:"border-transparent bg-transparent text-primary underline-offset-4 hover:underline",success:"border-success-bd bg-success-soft text-success",warning:"border-warning-bd bg-warning-soft text-warning",info:"border-info-bd bg-info-soft text-info",brand:"border-primary-bd bg-primary-soft text-primary-fg",cn:"border-cn-bd bg-cn-soft text-cn",intl:"border-intl-bd bg-intl-soft text-intl",sensitive:"border-sensitive-bd bg-sensitive-soft text-sensitive"},shape:{pill:"min-h-[21px] rounded-pill px-[9px] py-px text-[11.5px]",tag:"min-h-[19px] rounded-xs px-2 py-0 text-[11px]"}},defaultVariants:{variant:"default",shape:"pill"}});function ze({className:e,variant:t,shape:a,render:o,...c}){return g4({render:o,defaultTagName:"span",props:Wr({"data-slot":"badge"},c,{className:Ue(x4({variant:t,shape:a}),e)})})}function uy({className:e,...t}){return s.jsx("span",{className:Ue("size-1.5 flex-none rounded-full bg-current",e),...t})}function go(e,t){if(typeof window>"u")return e;const a=window.wbI18n;return a?a.t(e,t)??e:e}function ef({className:e,...t}){return s.jsx("svg",{"data-slot":"spinner",role:"status","aria-label":go("加载中"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:Ue("size-4 animate-spin [animation-duration:0.7s]",e),...t,children:s.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function Je({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:Ue("flex items-center gap-[6px] text-[11.5px] text-muted-foreground",e),...t})}const E1={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ai={...E1,position:"fixed",top:0,left:0},Zc={...E1,position:"absolute"},A1=x.createContext(void 0);function b4(){const e=x.useContext(A1);if(e===void 0)throw new Error(on(63));return e}const v4="data-checked",y4="data-unchecked",R1={...wi,checked(e){return e?{[v4]:""}:{[y4]:""}}},w4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d,"aria-labelledby":f,form:p,id:h,inputRef:b,name:y,nativeButton:v=!1,onCheckedChange:w,readOnly:j=!1,required:S=!1,disabled:N=!1,render:k,uncheckedValue:T,value:D,style:C,...A}=t,{clearErrors:R}=Fc(),{state:I,setTouched:P,setDirty:O,validityData:_,setFilled:L,setFocused:H,validationMode:B,disabled:z,name:Q,validation:K}=Sa(),{labelId:X}=vl(),q=z||N,$=Q??y,Y=x.useRef(null),F=ea(Y,b,K.inputRef),G=x.useRef(null),W=Na(),le=lo({id:h}),M=v?void 0:le,[U,Z]=Ga({controlled:o,default:!!d,name:"Switch",state:"checked"});Yc(G,W,U,void 0,!q,y),De(()=>{L(U)},[U,L]),aa(U,()=>{R($),O(U!==_.initialValue),K.change(U)});const{getButtonProps:ae,buttonRef:ce}=Jr({disabled:q,native:v}),J=Bv(f,X,Y,!v,M),ie={id:v?le:W,role:"switch","aria-checked":U,"aria-readonly":j||void 0,"aria-required":S||void 0,"aria-labelledby":J,onFocus(){q||H(!0)},onBlur(){const te=Y.current;!te||q||(P(!0),H(!1),B==="onBlur"&&K.commit(te.checked))},onClick(te){if(j||q)return;te.preventDefault();const Ce=Y.current;Ce&&Uc(Ce,te)}},ge={...K.getValidationProps(q),checked:U,disabled:q,form:p,id:M,name:$,required:S,style:$?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(te){if(te.nativeEvent.defaultPrevented)return;if(j){te.preventDefault();return}const Ce=te.currentTarget.checked,re=Fe(Yn,te.nativeEvent);w?.(Ce,re),!re.isCanceled&&Z(Ce)},onClick(te){te.stopPropagation()},onFocus(){G.current?.focus()},...D!==void 0?{value:D}:fn},ee=x.useMemo(()=>({...I,checked:U,disabled:q,readOnly:j,required:S}),[I,U,q,j,S]),fe=yt("span",t,{state:ee,ref:[a,G,ce],props:[ie,A,ae,te=>K.getValidationProps(q,te)],stateAttributesMapping:R1});return s.jsxs(A1.Provider,{value:ee,children:[fe,!U&&$&&T!==void 0&&s.jsx("input",{type:"hidden",form:p,name:$,value:T,disabled:q}),s.jsx("input",{...ge,suppressHydrationWarning:!0})]})}),j4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=b4();return yt("span",t,{state:p,ref:a,stateAttributesMapping:R1,props:f})});function hs({className:e,size:t="default",...a}){const o=t==="sm";return s.jsx(w4,{"data-slot":"switch",className:Ue("relative inline-flex flex-none cursor-pointer items-center rounded-pill border-0 bg-border-strong p-0","transition-colors duration-[180ms] ease-out","data-checked:bg-primary","focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:opacity-50",o?"h-[14px] w-6":"h-[21px] w-9",e),...a,children:s.jsx(j4,{"data-slot":"switch-thumb",className:Ue("block rounded-full bg-primary-on shadow-1","transition-transform duration-[180ms] [transition-timing-function:cubic-bezier(.3,1.4,.6,1)]",o?"size-[10px] translate-x-0.5 data-checked:translate-x-[10px]":"size-[17px] translate-x-0.5 data-checked:translate-x-[15px]")})})}function S4(e){if(!e)return null;for(const t of e.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const o=t;if(o.type==="submit")return o}}return null}const N4="data-checked",k4="data-unchecked";function O1(e){return{checked(t){return e.indeterminate?{}:t?{[N4]:""}:{[k4]:""}},...wi}}const C4=x.createContext(void 0);function T4(){return x.useContext(C4)}const M1=x.createContext(void 0);function E4(){const e=x.useContext(M1);if(e===void 0)throw new Error(on(14));return e}const A4="data-parent",R4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d=!1,"aria-labelledby":f,disabled:p=!1,form:h,id:b,indeterminate:y=!1,inputRef:v,name:w,onCheckedChange:j,parent:S=!1,readOnly:N=!1,render:k,required:T=!1,uncheckedValue:D,value:C,nativeButton:A=!1,style:R,...I}=t,{clearErrors:P}=Fc(),{disabled:O,name:_,setDirty:L,setFilled:H,setFocused:B,setTouched:z,state:Q,validationMode:K,validityData:X,validation:q}=Sa(),$=y1(),{labelId:Y,registerControlId:F,getDescriptionProps:G}=vl(),W=T4(),le=W?.allValues===void 0?void 0:W.parent,M=le!==void 0,U=O||$.disabled||W?.disabled||p,Z=_??w,ae=C??Z,ce=Na(),J=W?.registerControlId!==F,ie=lo({id:b||void 0,enabled:J}),ge=A?ie:ce;let ee={};M&&(S?ee=le.getParentProps():ae!==void 0&&(ee=le.getChildProps(ae)));const{checked:fe=o,indeterminate:te=y,onCheckedChange:Ce,...re}=ee,de=W?.value,ke=x.useRef(null),{getButtonProps:Ee,buttonRef:ve}=Jr({disabled:U,native:A}),he=W?.validation??q,[ye,je]=Ga({controlled:ae!==void 0&&de!==void 0&&!S?de.includes(ae):fe,default:d,name:"Checkbox",state:"checked"}),xe=M?!!fe:ye,Te=M&&te||y;Yc(ke,ce,ye,void 0,!W&&!U,w);const Oe=le?.registerChildId,Ne=x.useRef(null),_e=he.registerInput,Ye=W?ae:void 0,kt=x.useCallback(it=>_e(it,{controlRef:ke,value:Ye}),[_e,Ye]),Ct=ea(v,Ne,S?void 0:kt),Rt=Bv(f,Y,Ne,!A,ie);De(()=>{Ne.current&&(Ne.current.indeterminate=Te),W||H(ye)},[ye,Te,W,H]),aa(ye,()=>{W||(P(Z),L(ye!==X.initialValue),he.change(ye))});const ot=Wr({checked:ye,disabled:U,form:h,name:S?void 0:Z,id:A?void 0:ie,required:T,ref:Ct,style:Z?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(it){if(it.nativeEvent.defaultPrevented)return;if(N){it.preventDefault();return}const Vt=it.currentTarget.checked,Hn=Fe(Yn,it.nativeEvent);if(j?.(Vt,Hn),!Hn.isCanceled&&(Ce?.(Vt,Hn),!Hn.isCanceled&&(je(Vt),ae!==void 0&&W!==void 0&&!S&&!M))){const tn=Vt?[...W.value,ae]:W.value.filter(nt=>nt!==ae);W.setValue(tn,Hn)}},onClick(it){it.stopPropagation()},onFocus(){ke.current?.focus()}},C!==void 0?{value:(W?ye&&C:C)||""}:fn,G,it=>he.getValidationProps(U,it));x.useEffect(()=>{if(!le||ae===void 0)return;const it=le.disabledStatesRef.current;return it.set(ae,U),()=>{it.delete(ae)}},[le,U,ae]);const qn=x.useMemo(()=>({...Q,checked:xe,disabled:U,readOnly:N,required:T,indeterminate:Te}),[Q,xe,U,N,T,Te]),fs=O1(qn),Gn=yt("span",t,{state:qn,ref:[ve,ke,a],props:[{id:ge,role:"checkbox","aria-checked":Te?"mixed":xe,"aria-readonly":N||void 0,"aria-required":T||void 0,"aria-labelledby":Rt,[A4]:S?"":void 0,onFocus(){U||B(!0)},onBlur(){const it=Ne.current;it&&(z(!0),B(!1),K==="onBlur"&&he.commit(W?de:it.checked))},onKeyDown(it){if(it.key!=="Enter"||(it.preventBaseUIHandler(),it.defaultPrevented))return;const Vt=Ne.current?.form??null,Hn=it.currentTarget,tn=it.nativeEvent,nt=it.preventDefault,Ot=tn.preventDefault;let Ft=!1;it.preventDefault=()=>{Ft=!0,nt.call(it)},tn.preventDefault=()=>{Ft=!0,Ot.call(tn)},Ot.call(tn),Sn(Hn).queueMicrotask(()=>{it.preventDefault=nt,tn.preventDefault=Ot,Ft||S4(Vt)?.click()})},onClick(it){if(N||U)return;it.preventDefault();const Vt=Ne.current;Vt&&Uc(Vt,it)}},I,re,Ee,G,it=>he.getValidationProps(U,it)],stateAttributesMapping:fs}),bs=Gn.props.id;return De(()=>{if(!(!Oe||S||ae===void 0||bs===void 0))return Oe(ae,bs)},[Oe,S,ae,bs]),s.jsxs(M1.Provider,{value:qn,children:[Gn,!ye&&!W&&Z&&!S&&D!==void 0&&s.jsx("input",{type:"hidden",form:h,name:Z,value:D,disabled:U}),s.jsx("input",{...ot,suppressHydrationWarning:!0})]})}),O4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=E4(),b=h.checked||h.indeterminate,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j=x.useRef(null),S={...h,transitionStatus:v};ra({batch:!0,enabled:!b,open:b,ref:j,onComplete(){b||w(!1)}});const k={...O1(h),...oo},T=f||y,D=yt("span",t,{ref:[a,j],state:S,stateAttributesMapping:k,props:p});return T?D:null});function Mr({className:e,...t}){return s.jsx(R4,{"data-slot":"checkbox",className:Ue("group/checkbox relative inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(O4,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-primary-foreground data-unchecked:hidden",children:s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-2.5","aria-hidden":"true",children:[s.jsx("path",{d:"M2 6h8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none",className:"hidden group-aria-[checked=indeterminate]/checkbox:block"}),s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:"group-aria-[checked=indeterminate]/checkbox:hidden"})]})})})}function dy(e){return Array.isArray(e)?e.map(t=>dy(t)).join(","):e==null?"":String(e)}const D1=new Map;function M4(e,t){const a=JSON.stringify({locale:dy(e),options:t}),o=D1.get(a);if(o)return o;const c=new Intl.NumberFormat(e,t);return D1.set(a,c),c}function I1(e,t,a){return e==null?"":M4(t,a).format(e)}function Ri(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}function D4(e,t,a){return(e-t)*100/(a-t)}const P1=x.createContext(void 0);function _1(){const e=x.useContext(P1);if(e===void 0)throw new Error(on(51));return e}const I4="data-complete",P4="data-indeterminate",_4="data-progressing",fy={status(e){return e==="progressing"?{[_4]:""}:e==="complete"?{[I4]:""}:e==="indeterminate"?{[P4]:""}:null}},L4=x.forwardRef(function(t,a){const{format:o,getAriaValueText:c,locale:d,max:f=100,min:p=0,value:h,render:b,className:y,children:v,style:w,...j}=t,[S,N]=x.useState();let k="indeterminate",T=null,D=null,C="",A="indeterminate progress";if(h!=null&&Number.isFinite(h)){const _=D4(h,p,f);T=Ri(Number.isNaN(_)?0:_,0,100),D=Ri(h,p,f),k=D===f?"complete":"progressing",C=o?I1(D,d,o):I1(T/100,d,{style:"percent"}),A=C}const R=x.useMemo(()=>({status:k}),[k]),I={"aria-labelledby":S,"aria-valuemax":f,"aria-valuemin":p,"aria-valuenow":D??void 0,"aria-valuetext":c?c(C,h):A,role:"progressbar",children:s.jsxs(x.Fragment,{children:[v,s.jsx("span",{role:"presentation",style:Ai,children:"x"})]})},P=x.useMemo(()=>({formattedValue:C,percentageValue:T,setLabelId:N,state:R,value:h}),[C,T,N,R,h]),O=yt("div",t,{state:R,ref:a,props:[I,j],stateAttributesMapping:fy});return s.jsx(P1.Provider,{value:P,children:O})}),z4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{state:p}=_1();return yt("div",t,{state:p,ref:a,props:f,stateAttributesMapping:fy})}),B4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{percentageValue:p,state:h}=_1(),b=p==null?{}:{insetInlineStart:0,height:"inherit",width:`${p}%`};return yt("div",t,{state:h,ref:a,props:[{style:b},f],stateAttributesMapping:fy})});function tf({className:e,children:t,value:a,...o}){return s.jsxs(L4,{value:a,"data-slot":"progress",className:Ue("flex w-full flex-wrap items-center gap-3",e),...o,children:[t,s.jsx(H4,{children:s.jsx(U4,{})})]})}function H4({className:e,...t}){return s.jsx(z4,{"data-slot":"progress-track",className:Ue("relative flex h-1.5 w-full items-center overflow-x-hidden overflow-y-hidden rounded-pill bg-surface-3",e),...t})}function U4({className:e,...t}){return s.jsx(B4,{"data-slot":"progress-indicator",className:Ue("h-full rounded-[inherit] bg-primary transition-[width] duration-300 ease-out",e),...t})}const py=[];let my;function V4(){return my}function F4(e){py.push(e)}function sh(e){const t=(a,o)=>{const c=Ds($4).current;let d;try{my=c;for(const f of py)f.before(c);d=e(a,o);for(const f of py)f.after(c);c.didInitialize=!0}finally{my=void 0}return d};return t.displayName=e.displayName||e.name,t}function L1(e){return x.forwardRef(sh(e))}function $4(){return{didInitialize:!1}}const z1=x.createContext(void 0);function nf(e){const t=x.useContext(z1);if(t===void 0&&!e)throw new Error(on(72));return t}function q4(e,t){return t!=null&&!co(t)?0:typeof e=="function"?e():e}function Oi(e,t,a){const o=q4(e,a);return typeof o=="number"?o:o?.[t]}function B1(e){return typeof e=="function"?e():e}function H1(e,t){return t||e==="click"||e==="mousedown"}function G4(e){return e?.includes("mouse")&&e!=="mousedown"}const U1=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new sa,currentIdRef:{current:null},currentContextRef:{current:null}});function K4(e,t){e.current=t.current}function Y4(e){const{children:t,delay:a,timeoutMs:o=0}=e,c=x.useRef(a),d=x.useRef(a),f=x.useRef(null),p=x.useRef(null),h=Zs();return De(()=>{if(d.current=a,!f.current){c.current=a;return}c.current={open:Oi(c.current,"open"),close:Oi(a,"close")}},[a,f,c,d]),s.jsx(U1.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:c,initialDelayRef:d,currentIdRef:f,timeoutMs:o,currentContextRef:p,timeout:h}),[o,h]),children:t})}function X4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,c=o.useState("floatingId"),d=x.useContext(U1),{currentIdRef:f,delayRef:p,timeoutMs:h,initialDelayRef:b,currentContextRef:y,hasProvider:v,timeout:w}=d,[j,S]=x.useState(!1),N=x.useRef(a);return De(()=>{N.current=a},[a]),De(()=>{function k(){y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,p.current=b.current,w.clear()}if(f.current&&!a&&f.current===c){if(S(!1),h){const T=c;return w.start(h,()=>{o.select("open")||f.current&&f.current!==T||k()}),()=>{(N.current||f.current!==T)&&w.clear()}}k()}},[a,c,f,p,h,b,y,w,o]),De(()=>{if(!a)return;const k=y.current,T=f.current;w.clear(),y.current={onOpenChange:o.setOpen,setIsInstantPhase:S},f.current=c,p.current={open:0,close:Oi(b.current,"close")},T!==null&&T!==c?(S(!0),k?.setIsInstantPhase(!0),k?.onOpenChange(!1,Fe(Yn))):(S(!1),k?.setIsInstantPhase(!1))},[a,c,o,f,p,b,y,w]),De(()=>()=>{if(f.current===c){if(y.current=null,!N.current)return;f.current=null,K4(p,b),w.clear()}},[y,f,p,c,b,w]),x.useMemo(()=>({activeIdRef:f,hasProvider:v,delayRef:p,isInstantPhase:j}),[f,v,p,j])}function St(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function Ya(...e){return()=>{for(let t=0;t{t.current=t.next}};return t}const Wc=x.forwardRef(function(t,a){const[o,c]=x.useState();De(()=>{yB&&yl&&c("button")},[]);const d={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Ai,"aria-hidden":o?void 0:!0,...d,"data-base-ui-focus-guard":""})});function sf(e){return`data-base-ui-${e}`}let rh=0;function ah(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:c}=t;cancelAnimationFrame(rh);function d(){c&&!c()||e?.focus({preventScroll:a})}if(o)return d(),qt;const f=requestAnimationFrame(d);return rh=f,()=>{rh===f&&(cancelAnimationFrame(f),rh=0)}}const hy={inert:new WeakMap,"aria-hidden":new WeakMap},V1="data-base-ui-inert",gy={inert:new WeakSet,"aria-hidden":new WeakSet};let rf=new WeakMap,xy=0;function Z4(e){return gy[e]}function F1(e){return e?Bc(e)?e.host:F1(e.parentNode):null}const $1=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=F1(a);return e.contains(o)?o:null}).filter(a=>a!=null),q1=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},G1=(e,t,a)=>{const o=[],c=d=>{!d||a.has(d)||Array.from(d.children).forEach(f=>{Hs(f)!=="script"&&(t.has(f)?c(f):o.push(f))})};return c(e),o};function W4(e,t,a,o,{mark:c=!0}){let d=null;o?d="inert":a&&(d="aria-hidden");let f=null,p=null;const h=$1(t,e),b=c?G1(t,q1(h),new Set(h)):[],y=[],v=[];if(d){const w=hy[d],j=Z4(d);p=j,f=w;const S=$1(t,Array.from(t.querySelectorAll("[aria-live]"))),N=h.concat(S);G1(t,q1(N),new Set(N)).forEach(T=>{const D=T.getAttribute(d),C=D!==null&&D!=="false",A=(w.get(T)||0)+1;w.set(T,A),y.push(T),A===1&&C&&j.add(T),C||T.setAttribute(d,d==="inert"?"":"true")})}return c&&b.forEach(w=>{const j=(rf.get(w)||0)+1;rf.set(w,j),v.push(w),j===1&&w.setAttribute(V1,"")}),xy+=1,()=>{f&&y.forEach(w=>{const S=(f.get(w)||0)-1;f.set(w,S),S||(!p?.has(w)&&d&&w.removeAttribute(d),p?.delete(w))}),c&&v.forEach(w=>{const j=(rf.get(w)||0)-1;rf.set(w,j),j||w.removeAttribute(V1)}),xy-=1,xy||(hy.inert=new WeakMap,hy["aria-hidden"]=new WeakMap,gy.inert=new WeakSet,gy["aria-hidden"]=new WeakSet,rf=new WeakMap)}}function K1(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:c=!0}=t,d=$t(e[0]).body;return W4(e,d,a,o,{mark:c})}const J4=500,eH={style:{transition:"none"}},Y1="data-base-ui-click-trigger",X1={fallbackAxisSide:"none"},Q1={fallbackAxisSide:"end"},tH={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Z1=x.createContext(null),W1=()=>x.useContext(Z1),nH=sf("portal");function J1(e={}){const{ref:t,container:a,componentProps:o=fn,elementProps:c}=e,d=Gd(),p=W1()?.portalNode,[h,b]=x.useState(null),[y,v]=x.useState(null),w=Ie(k=>{k!==null&&v(k)}),j=x.useRef(null);De(()=>{if(a===null){j.current&&(j.current=null,v(null),b(null));return}const k=(a&&(Sv(a)?a:a.current))??p??document.body;if(k==null){j.current&&(j.current=null,v(null),b(null));return}j.current!==k&&(j.current=k,v(null),b(k))},[a,p]);const S=yt("div",o,{ref:[t,w],props:[{id:d,[nH]:""},c]}),N=h&&S?Cs.createPortal(S,h):null;return{node:y,nodeId:x.isValidElement(S)?S.props.id:void 0,subtree:N}}const lh=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,container:p,portalOwnerRole:h,...b}=t,{node:y,nodeId:v,subtree:w}=J1({container:p,ref:a,componentProps:t,elementProps:b}),j=x.useRef(null),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),[T,D]=x.useState(null),C=x.useRef(!1),A=T?.modal,R=T?.open,I=!!T&&!T.modal&&T.open&&!!y;x.useEffect(()=>{if(!y||A)return;function O(_){y&&_.relatedTarget&&Gc(_)&&(_.type==="focusin"?C.current&&(v1(y),C.current=!1):(t4(y),C.current=!0))}return Ya(St(y,"focusin",O,!0),St(y,"focusout",O,!0))},[y,A]),De(()=>{!y||R!==!0||!C.current||(v1(y),C.current=!1)},[R,y]);const P=x.useMemo(()=>({beforeOutsideRef:j,afterOutsideRef:S,beforeInsideRef:N,afterInsideRef:k,portalNode:y,setFocusManagerState:D}),[y]);return s.jsxs(x.Fragment,{children:[w,s.jsxs(Z1.Provider,{value:P,children:[I&&y&&s.jsx(Wc,{"data-type":"outside",ref:j,onFocus:O=>{if(Gc(O,y))N.current?.focus();else{const _=T?T.domReference:null;x1(_)?.focus()}}}),I&&y&&s.jsx("span",{role:h,"aria-owns":v,style:tH}),y&&Cs.createPortal(f,y),I&&y&&s.jsx(Wc,{"data-type":"outside",ref:S,onFocus:O=>{if(Gc(O,y))k.current?.focus();else{const _=T?T.domReference:null;ry(_)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,Fe(ho,O.nativeEvent))}}})]})]})});function eT(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class sH{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",eT())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const tT=x.createContext(null),nT=x.createContext(null),Jc=()=>x.useContext(tT)?.id||null,Mi=e=>{const t=x.useContext(nT);return e??t};function rH(e){const t=Gd(),a=Mi(e),o=Jc();return De(()=>{if(!t)return;const c={id:t,parentId:o};return a?.addNode(c),()=>{a?.removeNode(c)}},[a,t,o]),t}function aH(e){const{children:t,id:a}=e,o=Jc();return s.jsx(tT.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function lH(e){const{children:t,externalTree:a}=e,o=Ds(()=>a??new sH).current;return s.jsx(nT.Provider,{value:o,children:t})}function oH(e,t){const a=Sn(cs(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const sT=20;let xo=[];function by(){xo=xo.filter(e=>e.deref()?.isConnected)}function rT(e){by(),e&&Hs(e)!=="body"&&(xo.push(new WeakRef(e)),xo.length>sT&&(xo=xo.slice(-sT)))}function aT(){return by(),xo[xo.length-1]?.deref()}function iH(e){return e?sy(e)?e:Qd(e)[0]||e:null}function lT(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=h1(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return sy(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function oh(e){const{context:t,children:a,disabled:o=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:b="",nextFocusableElement:y,previousFocusableElement:v,beforeContentFocusGuardRef:w,externalTree:j,getInsideElements:S}=e,N="rootStore"in t?t.rootStore:t,k=N.useState("open"),T=N.useState("domReferenceElement"),D=N.useState("floatingElement"),{events:C,dataRef:A}=N.context,R=Ie(()=>A.current.floatingContext?.nodeId),I=c===!1,P=Yv(T)&&I,O=Xn(c),_=Xn(d),L=Xn(b),H=Xn(k),B=Mi(j),z=W1(),Q=x.useRef(!1),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef(null),$=x.useRef(""),Y=x.useRef(""),F=x.useRef(null),G=x.useRef(null),W=ea(F,w,z?.beforeInsideRef),le=ea(G,z?.afterInsideRef),M=Zs(),U=Zs(),Z=Kc(),ae=z!=null,ce=qm(D),J=Ie((ee=ce)=>ee?Qd(ee):[]),ie=Ie(()=>S?.().filter(ee=>ee!=null)??[]);x.useEffect(()=>{if(o||!p)return;function ee(te){te.key==="Tab"&&Qe(ce,or($t(ce)))&&J().length===0&&!P&&ks(te)}const fe=$t(ce);return St(fe,"keydown",ee)},[o,ce,p,P,J]),x.useEffect(()=>{if(o||!k)return;const ee=$t(ce);function fe(){X.current=!1}function te(re){const de=cs(re),ke=ie(),Ee=Qe(D,de)||Qe(T,de)||Qe(z?.portalNode,de)||ke.some(ve=>ve===de||Qe(ve,de));X.current=!Ee,Y.current=re.pointerType||"keyboard",de?.closest(`[${Y1}]`)&&(K.current=!0,U.start(0,()=>{K.current=!1}))}function Ce(){Y.current="keyboard"}return Ya(St(ee,"pointerdown",te,!0),St(ee,"pointerup",fe,!0),St(ee,"pointercancel",fe,!0),St(ee,"keydown",Ce,!0),fe)},[o,D,T,ce,k,z,U,ie]),x.useEffect(()=>{if(o||!h)return;const ee=$t(ce);function fe(){K.current=!0,U.start(0,()=>{K.current=!1})}function te(ke){const Ee=cs(ke);sy(Ee)&&(q.current=Ee)}function Ce(ke){const Ee=ke.relatedTarget,ve=ke.currentTarget,he=cs(ke);p&&Ee==null&&he!=null&&Qe(D,he)&&rT(he),queueMicrotask(()=>{const ye=R(),je=N.context.triggerElements,xe=ie(),Te=Ee?.hasAttribute(sf("focus-guard"))&&[F.current,G.current,z?.beforeInsideRef.current,z?.afterInsideRef.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,Nl(v),Nl(y)].includes(Ee),Oe=!(Qe(T,Ee)||Qe(D,Ee)||Qe(Ee,D)||Qe(z?.portalNode,Ee)||xe.some(Ne=>Ne===Ee||Qe(Ne,Ee))||je.hasMatchingElement(Ne=>Qe(Ne,Ee))||Te||B&&(io(B.nodesRef.current,ye).find(Ne=>Qe(Ne.context?.elements.floating,Ee)||Qe(Ne.context?.elements.domReference,Ee))||r1(B.nodesRef.current,ye).find(Ne=>[Ne.context?.elements.floating,qm(Ne.context?.elements.floating)].includes(Ee)||Ne.context?.elements.domReference===Ee)));if(ve===T&&ce&&lT(ce),f&&ve!==T&&!Zm(he)&&or(ee)===ee.body){if(dn(ce)&&(ce.focus(),f==="popup")){Z.request(()=>{ce.focus()});return}const Ne=J(),_e=q.current,Ye=(_e&&Ne.includes(_e)?_e:null)||Ne[Ne.length-1]||ce;dn(Ye)&&Ye.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(P||!p)&&Ee&&Oe&&!K.current&&(P||Ee!==aT())&&(Q.current=!0,N.setOpen(!1,Fe(ho,ke)))})}function re(){X.current||(A.current.insideReactTree=!0,M.start(0,()=>{A.current.insideReactTree=!1}))}const de=dn(T)?T:null;if(!(!D&&!de))return Ya(de&&St(de,"focusout",Ce),de&&St(de,"pointerdown",fe),D&&St(D,"focusin",te),D&&St(D,"focusout",Ce),D&&z&&St(D,"focusout",re,!0))},[o,T,D,ce,p,B,z,N,h,f,J,P,R,A,M,U,Z,y,v,ie]),x.useEffect(()=>{if(o||!D||!k)return;const ee=Array.from(z?.portalNode?.querySelectorAll(`[${sf("portal")}]`)||[]),te=(B?r1(B.nodesRef.current,R()):[]).find(ve=>Yv(ve.context?.elements.domReference||null))?.context?.elements.domReference,re=[...[D,...ee,F.current,G.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,...ie()],te,Nl(v),Nl(y),P?T:null].filter(ve=>ve!=null),de=K1(re,{ariaHidden:p||P,mark:!1}),ke=[D,...ee].filter(ve=>ve!=null),Ee=K1(ke);return()=>{Ee(),de()}},[k,o,T,D,p,z,P,B,R,y,v,ie]),De(()=>{if(!k||o||!dn(ce))return;$.current="",Y.current="";const ee=$t(ce),fe=or(ee);queueMicrotask(()=>{const te=O.current,Ce=typeof te=="function"?te(L.current||""):te;if(Ce===void 0||Ce===!1||Qe(ce,fe))return;let de=null;const ke=()=>(de==null&&(de=J(ce)),de[0]||ce);let Ee;Ce===!0||Ce===null?Ee=ke():Ee=Nl(Ce),Ee=Ee||ke();const ve=Qe(ce,or(ee));ah(Ee,{preventScroll:Ee===ce,shouldFocus(){if(!H.current)return!1;if(ve)return!0;const he=or(ee);return!(he!==Ee&&Qe(ce,he))}})})},[o,k,ce,J,O,L,H]),De(()=>{if(o||!ce)return;const ee=$t(ce),fe=or(ee),te=L.current==null;rT(fe);function Ce(de){if(de.open||($.current=oH(de.nativeEvent,Y.current)),de.reason===Vs&&de.nativeEvent.type==="mouseleave"&&(Q.current=!0),de.reason===nh)if(de.nested)Q.current=!1;else if(Gm(de.nativeEvent)||Xv(de.nativeEvent))Q.current=!1;else{let ke=!1;$t(ce).createElement("div").focus({get preventScroll(){return ke=!0,!1}}),ke?Q.current=!1:Q.current=!0}}C.on("openchange",Ce);function re(de){const ke=_.current;let Ee=typeof ke=="function"?ke(de):ke;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const ve=T?.isConnected?T:null,he=fe?.isConnected&&Hs(fe)!=="body"?fe:null;let ye=te?he||ve:ve||he;return ye||(ye=aT()||null),typeof Ee=="boolean"?ye:Nl(Ee)||ye||null}return()=>{C.off("openchange",Ce);const de=or(ee),ke=ie(),Ee=Qe(D,de)||ke.some(je=>je===de||Qe(je,de))||B&&io(B.nodesRef.current,R(),!1).some(je=>Qe(je.context?.elements.floating,de)),ve=_.current,he=$.current,ye=re(he);queueMicrotask(()=>{const je=iH(ye),xe=typeof ve!="boolean";if(ve&&!Q.current&&dn(je)&&(!(!xe&&je!==de&&de!==ee.body)||Ee)){const Te={preventScroll:!0};he==="keyboard"&&(Te.focusVisible=!0),je.focus(Te)}Q.current=!1})}},[o,D,ce,_,L,C,B,T,R,ie]),De(()=>{if(!yl||k||!D)return;const ee=or($t(D));!dn(ee)||!$m(ee)||Qe(D,ee)&&ee.blur()},[k,D]),De(()=>{if(!(o||!z))return z.setFocusManagerState({modal:p,closeOnFocusOut:h,open:k,onOpenChange:N.setOpen,domReference:T}),()=>{z.setFocusManagerState(null)}},[o,z,p,k,N,h,T]),De(()=>{if(!(o||!ce))return lT(ce),()=>{queueMicrotask(by)}},[o,ce]);const ge=!o&&(p?!P:!0)&&(ae||p);return s.jsxs(x.Fragment,{children:[ge&&s.jsx(Wc,{"data-type":"inside",ref:W,onFocus:ee=>{if(p){const fe=J();ah(fe[fe.length-1])}else z?.portalNode&&(Q.current=!1,Gc(ee,z.portalNode)?ry(T)?.focus():Nl(v??z.beforeOutsideRef)?.focus())}}),a,ge&&s.jsx(Wc,{"data-type":"inside",ref:le,onFocus:ee=>{p?ah(J()[0]):z?.portalNode&&(h&&(Q.current=!0),Gc(ee,z.portalNode)?x1(T)?.focus():Nl(y??z.afterOutsideRef)?.focus())}})]})}function ih(e,t={}){const{enabled:a=!0,event:o="click",toggle:c=!0,ignoreMouse:d=!1,stickIfOpen:f=!0,touchOpenDelay:p=0,reason:h=mo}=t,b="rootStore"in e?e.rootStore:e,y=b.context.dataRef,v=x.useRef(void 0),w=Kc(),j=Zs(),S=x.useMemo(()=>{function N(T,D,C,A){const R=Fe(h,D,C);T&&A==="touch"&&p>0?j.start(p,()=>{b.setOpen(!0,R)}):b.setOpen(T,R)}function k(T,D,C){const A=y.current.openEvent,R=b.select("domReferenceElement")!==D;return T&&R||!T||!c?!0:A&&f?!C(A.type):!1}return{onPointerDown(T){v.current=co(T.pointerType,!0)&&Xv(T.nativeEvent)?"virtual":T.pointerType},onMouseDown(T){const D=v.current,C=T.nativeEvent,A=b.select("open");if(T.button!==0||o==="click"||co(D,!0)&&d)return;const R=k(A,T.currentTarget,O=>O==="click"||O==="mousedown"),I=cs(C);if($m(I)){N(R,C,I,D);return}const P=T.currentTarget;w.request(()=>{N(R,C,P,D)})},onClick(T){if(o==="mousedown-only")return;const D=v.current;if(o==="mousedown"&&D){v.current=void 0;return}if(co(D,!0)&&d)return;const C=b.select("open"),A=k(C,T.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");N(A,T.nativeEvent,T.currentTarget,D)},onKeyDown(){v.current=void 0}}},[y,o,d,h,b,f,c,w,j,p]);return x.useMemo(()=>a?{reference:S}:fn,[a,S])}function cH(e,t){let a=null,o=null,c=!1;return{contextElement:e||void 0,getBoundingClientRect(){const d=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",h=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let b=d.width,y=d.height,v=d.x,w=d.y;return a==null&&t.x&&f&&(a=d.x-t.x),o==null&&t.y&&p&&(o=d.y-t.y),v-=a||0,w-=o||0,b=0,y=0,!c||h?(b=t.axis==="y"?d.width:0,y=t.axis==="x"?d.height:0,v=f&&t.x!=null?t.x:v,w=p&&t.y!=null?t.y:w):c&&!h&&(y=t.axis==="x"?d.height:y,b=t.axis==="y"?d.width:b),c=!0,{width:b,height:y,x:v,y:w,top:w,right:v+b,bottom:w+y,left:v}}}}function oT(e){return e!=null&&e.clientX!=null}function uH(e,t={}){const{enabled:a=!0,axis:o="both"}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),h=c.context.dataRef,b=x.useRef(!1),y=x.useRef(null),[v,w]=x.useState(),[j,S]=x.useState([]),N=Ie(A=>{c.set("positionReference",A)}),k=Ie((A,R,I)=>{b.current||h.current.openEvent&&!oT(h.current.openEvent)||c.set("positionReference",cH(I??p,{x:A,y:R,axis:o,dataRef:h,pointerType:v}))}),T=Ie(A=>{d?y.current||(k(A.clientX,A.clientY,A.currentTarget),S([])):k(A.clientX,A.clientY,A.currentTarget)}),D=co(v)?f:d;x.useEffect(()=>{if(!a){N(p);return}if(!D)return;function A(){y.current?.(),y.current=null}const R=Sn(f);function I(P){const O=cs(P);Qe(f,O)?A():k(P.clientX,P.clientY)}return!h.current.openEvent||oT(h.current.openEvent)?y.current=St(R,"mousemove",I):N(p),A},[D,a,f,h,p,c,k,N,j]),x.useEffect(()=>()=>{c.set("positionReference",null)},[c]),x.useEffect(()=>{a&&!f&&(b.current=!1)},[a,f]),x.useEffect(()=>{!a&&d&&(b.current=!0)},[a,d]);const C=x.useMemo(()=>{function A(R){w(R.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:T,onMouseEnter:T}},[T]);return x.useMemo(()=>a?{reference:C,trigger:C}:{},[a,C])}function dH(){return!1}function fH(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function af(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:f=dH,bubbles:p,externalTree:h}=t,b="rootStore"in e?e.rootStore:e,y=b.useState("open"),v=b.useState("floatingElement"),{dataRef:w,events:j}=b.context,S=Mi(h),N=Ie(typeof c=="function"?c:()=>!1),k=typeof c=="function"?N:c,T=k!==!1,D=Ie(()=>d),{escapeKey:C,outsidePress:A}=fH(p),R=x.useRef(!1),I=x.useRef(!1),P=x.useRef(!1),O=x.useRef(!1),_=x.useRef(!1),L=x.useRef(""),H=x.useRef(null),B=Zs(),z=Zs(),Q=Ie(()=>{z.clear(),w.current.insideReactTree=!1}),K=Ie(M=>{const U=w.current.floatingContext?.nodeId;return(S?io(S.nodesRef.current,U):[]).some(ae=>ae.context?.open&&!ae.context.dataRef.current[M])}),X=Ie(M=>Kv(M,b.select("floatingElement"))||Kv(M,b.select("domReferenceElement"))),q=Ie(M=>{f()&&b.setOpen(!1,Fe(mo,M.nativeEvent))}),$=Ie(M=>{if(!y||!a||!o||M.key!=="Escape"||_.current||!C&&K("__escapeKeyBubbles"))return;const U=_B(M)?M.nativeEvent:M,Z=Fe(Xc,U);b.setOpen(!1,Z),Z.isCanceled||M.preventDefault(),!C&&!Z.isPropagationAllowed&&M.stopPropagation()}),Y=Ie(()=>{w.current.insideReactTree=!0,z.start(0,Q)}),F=Ie(M=>{if(!y||!a||M.button!==0)return;const U=cs(M.nativeEvent);Qe(b.select("floatingElement"),U)&&(R.current||(R.current=!0,I.current=!1))}),G=Ie(M=>{!y||!a||(M.defaultPrevented||M.nativeEvent.defaultPrevented)&&R.current&&(I.current=!0)});x.useEffect(()=>{function M(U){U.open||(O.current=!1)}return j.on("openchange",M),()=>{j.off("openchange",M)}},[j]),x.useEffect(()=>{if(!y||!a)return y||(O.current=!1),Q;w.current.__escapeKeyBubbles=C,w.current.__outsidePressBubbles=A;const M=new sa,U=new sa,Z=$t(v);function ae(){M.clear(),_.current=!0}function ce(){M.start(yl?5:0,()=>{_.current=!1})}function J(){P.current=!0,U.start(0,()=>{P.current=!1})}function ie(){R.current=!1,I.current=!1}function ge(){const Oe=L.current,Ne=Oe==="pen"||!Oe?"mouse":Oe,_e=D(),Ye=typeof _e=="function"?_e():_e;return typeof Ye=="string"?Ye:Ye[Ne]}function ee(Oe){const Ne=ge();return Ne==="intentional"&&Oe.type!=="click"||Ne==="sloppy"&&Oe.type==="click"}function fe(Oe){const Ne=w.current.floatingContext?.nodeId,_e=S&&io(S.nodesRef.current,Ne).some(Ye=>Kv(Oe,Ye.context?.elements.floating));return X(Oe)||_e}function te(Oe){if(ee(Oe)){Oe.type!=="click"&&!X(Oe)&&(U.clear(),P.current=!1),Q();return}if(w.current.insideReactTree){Q();return}const Ne=cs(Oe),_e=`[${sf("inert")}]`,Ye=At(Ne)?Ne.getRootNode():null,kt=Array.from((Bc(Ye)?Ye:$t(b.select("floatingElement"))).querySelectorAll(_e)),Ct=b.context.triggerElements;if(Ne&&(Ct.hasElement(Ne)||Ct.hasMatchingElement(ot=>Qe(ot,Ne))))return;let Rt=At(Ne)?Ne:null;for(;Rt&&!no(Rt);){const ot=so(Rt);if(no(ot)||!At(ot))break;Rt=ot}if(!(kt.length&&At(Ne)&&!DB(Ne)&&!Qe(Ne,b.select("floatingElement"))&&kt.every(ot=>!Qe(Rt,ot)))){if(dn(Ne)&&!("touches"in Oe)){const ot=no(Ne),qn=xr(Ne),fs=/auto|scroll/,Gn=ot||fs.test(qn.overflowX),bs=ot||fs.test(qn.overflowY),it=Gn&&Ne.clientWidth>0&&Ne.scrollWidth>Ne.clientWidth,Vt=bs&&Ne.clientHeight>0&&Ne.scrollHeight>Ne.clientHeight,Hn=qn.direction==="rtl",tn=Vt&&(Hn?Oe.offsetX<=Ne.offsetWidth-Ne.clientWidth:Oe.offsetX>Ne.clientWidth),nt=it&&Oe.offsetY>Ne.clientHeight;if(tn||nt)return}if(!fe(Oe)){if(ge()==="intentional"){if(Oe.detail!==0&&!Gm(Oe)&&!O.current)return;if(P.current){U.clear(),P.current=!1;return}}typeof k=="function"&&!k(Oe)||K("__outsidePressBubbles")||(b.setOpen(!1,Fe(nh,Oe)),Q())}}}function Ce(Oe){ge()!=="sloppy"||Oe.pointerType==="touch"||!b.select("open")||!a||X(Oe)||te(Oe)}function re(Oe){if(ge()!=="sloppy"||!b.select("open")||!a||X(Oe))return;const Ne=Oe.touches[0];Ne&&(H.current={startTime:Date.now(),startX:Ne.clientX,startY:Ne.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},B.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function de(Oe,Ne){const _e=cs(Oe);if(!_e)return;const Ye=St(_e,Oe.type,()=>{Ne(Oe),Ye()})}function ke(Oe){L.current="touch",de(Oe,re)}function Ee(Oe){B.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),L.current=Oe.pointerType),!(Oe.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&de(Oe,Ne=>{Ne.type==="pointerdown"?Ce(Ne):te(Ne)})}function ve(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!R.current)return;const Ne=I.current;if(ie(),ge()==="intentional"){if(Oe.type==="pointercancel"){Ne&&J();return}if(!fe(Oe)){if(Ne){J();return}typeof k=="function"&&!k(Oe)||(U.clear(),P.current=!0,Q())}}}function he(Oe){if(ge()!=="sloppy"||!H.current||X(Oe))return;const Ne=Oe.touches[0];if(!Ne)return;const _e=Math.abs(Ne.clientX-H.current.startX),Ye=Math.abs(Ne.clientY-H.current.startY),kt=Math.sqrt(_e*_e+Ye*Ye);kt>5&&(H.current.dismissOnTouchEnd=!0),kt>10&&(te(Oe),B.clear(),H.current=null)}function ye(Oe){de(Oe,he)}function je(Oe){ge()!=="sloppy"||!H.current||X(Oe)||(H.current.dismissOnTouchEnd&&te(Oe),B.clear(),H.current=null)}function xe(Oe){de(Oe,je)}const Te=Ya(o&&Ya(St(Z,"keydown",$),St(Z,"compositionstart",ae),St(Z,"compositionend",ce)),T&&Ya(St(Z,"click",Ee,!0),St(Z,"pointerdown",Ee,!0),St(Z,"pointerup",ve,!0),St(Z,"pointercancel",ve,!0),St(Z,"mousedown",Ee,!0),St(Z,"mouseup",ve,!0),St(Z,"touchstart",ke,{capture:!0,passive:!0}),St(Z,"touchmove",ye,{capture:!0,passive:!0}),St(Z,"touchend",xe,{capture:!0,passive:!0})));return()=>{Te(),M.clear(),U.clear(),ie(),P.current=!1,Q()}},[w,v,o,T,k,y,a,C,A,$,Q,D,K,X,S,b,B]);const W=x.useMemo(()=>({onKeyDown:$,onPointerDown:q,onClick:q}),[$,q]),le=x.useMemo(()=>({onKeyDown:$,onPointerDown:G,onMouseDown:G,onClickCapture:Y,onMouseDownCapture(M){Y(),F(M)},onPointerDownCapture(M){Y(),F(M)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[$,Y,F,G]);return x.useMemo(()=>a?{reference:W,floating:le,trigger:W}:{},[a,W,le])}function iT(e,t,a){let{reference:o,floating:c}=e;const d=na(t),f=Wv(t),p=Zv(f),h=ta(t),b=d==="y",y=o.x+o.width/2-c.width/2,v=o.y+o.height/2-c.height/2,w=o[p]/2-c[p]/2;let j;switch(h){case"top":j={x:y,y:o.y-c.height};break;case"bottom":j={x:y,y:o.y+o.height};break;case"right":j={x:o.x+o.width,y:v};break;case"left":j={x:o.x-c.width,y:v};break;default:j={x:o.x,y:o.y}}const S=Sl(t);return S&&(j[f]+=w*(S==="end"?1:-1)*(a&&b?-1:1)),j}async function pH(e,t){var a;t===void 0&&(t={});const{x:o,y:c,platform:d,rects:f,elements:p,strategy:h}=e,{boundary:b="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:w=!1,padding:j=0}=uo(t,e),S=i1(j),k=p[w?v==="floating"?"reference":"floating":v],T=Xd(await d.getClippingRect({element:(a=await(d.isElement==null?void 0:d.isElement(k)))==null||a?k:k.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(p.floating)),boundary:b,rootBoundary:y,strategy:h})),D=v==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,C=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p.floating)),A=await(d.isElement==null?void 0:d.isElement(C))&&await(d.getScale==null?void 0:d.getScale(C))||{x:1,y:1},R=Xd(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:D,offsetParent:C,strategy:h}):D);return{top:(T.top-R.top+S.top)/A.y,bottom:(R.bottom-T.bottom+S.bottom)/A.y,left:(T.left-R.left+S.left)/A.x,right:(R.right-T.right+S.right)/A.x}}const mH=50,hH=async(e,t,a)=>{const{placement:o="bottom",strategy:c="absolute",middleware:d=[],platform:f}=a,p=f.detectOverflow?f:{...f,detectOverflow:pH},h=await(f.isRTL==null?void 0:f.isRTL(t));let b=await f.getElementRects({reference:e,floating:t,strategy:c}),{x:y,y:v}=iT(b,o,h),w=o,j=0;const S={};for(let N=0;NQ<=0)){var H,B;const Q=(((H=d.flip)==null?void 0:H.index)||0)+1,K=P[Q];if(K&&(!(v==="alignment"?D!==na(K):!1)||L.every($=>na($.placement)===D?$.overflows[0]>0:!0)))return{data:{index:Q,overflows:L},reset:{placement:K}};let X=(B=L.filter(q=>q.overflows[0]<=0).sort((q,$)=>q.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!X)switch(j){case"bestFit":{var z;const q=(z=L.filter($=>{if(I){const Y=na($.placement);return Y===D||Y==="y"}return!0}).map($=>[$.placement,$.overflows.filter(Y=>Y>0).reduce((Y,F)=>Y+F,0)]).sort(($,Y)=>$[1]-Y[1])[0])==null?void 0:z[0];q&&(X=q);break}case"initialPlacement":X=p;break}if(c!==X)return{reset:{placement:X}}}return{}}}},cT=new Set(["left","top"]);async function xH(e,t){const{placement:a,platform:o,elements:c}=e,d=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=ta(a),p=Sl(a),h=na(a)==="y",b=cT.has(f)?-1:1,y=d&&h?-1:1,v=uo(t,e);let{mainAxis:w,crossAxis:j,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return p&&typeof S=="number"&&(j=p==="end"?S*-1:S),h?{x:j*y,y:w*b}:{x:w*b,y:j*y}}const bH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:c,y:d,placement:f,middlewareData:p}=t,h=await xH(t,e);return f===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+h.x,y:d+h.y,data:{...h,placement:f}}}}},vH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:c,platform:d}=t,{mainAxis:f=!0,crossAxis:p=!1,limiter:h={fn:D=>{let{x:C,y:A}=D;return{x:C,y:A}}},...b}=uo(e,t),y={x:a,y:o},v=await d.detectOverflow(t,b),w=na(c),j=Qv(w);let S=y[j],N=y[w];const k=(D,C)=>a1(C+v[D==="y"?"top":"left"],C,C-v[D==="y"?"bottom":"right"]);f&&(S=k(j,S)),p&&(N=k(w,N));const T=h.fn({...t,[j]:S,[w]:N});return{...T,data:{x:T.x-a,y:T.y-o,enabled:{[j]:f,[w]:p}}}}}},yH=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,o;const{x:c,y:d,placement:f,rects:p,middlewareData:h}=t,{offset:b=0,mainAxis:y=!0,crossAxis:v=!0}=uo(e,t),w={x:c,y:d},j=na(f),S=Qv(j);let N=w[S],k=w[j];const T=uo(b,t),D=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(a=T.mainAxis)!=null?a:0,crossAxis:(o=T.crossAxis)!=null?o:0};if(y){const R=S==="y"?"height":"width",I=p.reference[S]-p.floating[R]+D.mainAxis,P=p.reference[S]+p.reference[R]-D.mainAxis;NP&&(N=P)}if(v){var C,A;const R=S==="y"?"width":"height",I=cT.has(ta(f)),P=p.reference[j]-p.floating[R]+(I&&((C=h.offset)==null?void 0:C[j])||0)+(I?0:D.crossAxis),O=p.reference[j]+p.reference[R]+(I?0:((A=h.offset)==null?void 0:A[j])||0)-(I?D.crossAxis:0);kO&&(k=O)}return{[S]:N,[j]:k}}}},wH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:o,platform:c,elements:d}=t,{apply:f=()=>{},...p}=uo(e,t),h=await c.detectOverflow(t,p),b=ta(a),y=Sl(a),v=na(a)==="y",{width:w,height:j}=o.floating;let S,N;b==="top"||b==="bottom"?(S=b,N=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(N=b,S=y==="end"?"top":"bottom");const k=j-h.top-h.bottom,T=w-h.left-h.right,D=qc(j-h[S],k),C=qc(w-h[N],T),A=t.middlewareData.shift,R=!A;let I=D,P=C;A!=null&&A.enabled.x&&(P=T),A!=null&&A.enabled.y&&(I=k),R&&!y&&(v?P=w-2*wl(h.left,h.right):I=j-2*wl(h.top,h.bottom)),await f({...t,availableWidth:P,availableHeight:I});const O=await c.getDimensions(d.floating);return w!==O.width||j!==O.height?{reset:{rects:!0}}:{}}}};function uT(e){const t=xr(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const c=dn(e),d=c?e.offsetWidth:a,f=c?e.offsetHeight:o,p=Km(a)!==d||Km(o)!==f;return p&&(a=d,o=f),{width:a,height:o,$:p}}function vy(e){return At(e)?e:e.contextElement}function eu(e){const t=vy(e);if(!dn(t))return jl(1);const a=t.getBoundingClientRect(),{width:o,height:c,$:d}=uT(t);let f=(d?Km(a.width):a.width)/o,p=(d?Km(a.height):a.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const jH=jl(0);function dT(e){const t=Sn(e);return!Cv()||!t.visualViewport?jH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Sn(e)}function Di(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const c=e.getBoundingClientRect(),d=vy(e);let f=jl(1);t&&(o?At(o)&&(f=eu(o)):f=eu(e));const p=SH(d,a,o)?dT(d):jl(0);let h=(c.left+p.x)/f.x,b=(c.top+p.y)/f.y,y=c.width/f.x,v=c.height/f.y;if(d&&o){const w=Sn(d),j=At(o)?Sn(o):o;let S=w,N=Tv(S);for(;N&&j!==S;){const k=eu(N),T=N.getBoundingClientRect(),D=xr(N),C=T.left+(N.clientLeft+parseFloat(D.paddingLeft))*k.x,A=T.top+(N.clientTop+parseFloat(D.paddingTop))*k.y;h*=k.x,b*=k.y,y*=k.x,v*=k.y,h+=C,b+=A,S=Sn(N),N=Tv(S)}}return Xd({width:y,height:v,x:h,y:b})}function ch(e,t){const a=Im(e).scrollLeft;return t?t.left+a:Di(xl(e)).left+a}function fT(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-ch(e,a),c=a.top+t.scrollTop;return{x:o,y:c}}function NH(e){let{elements:t,rect:a,offsetParent:o,strategy:c}=e;const d=c==="fixed",f=xl(o),p=t?Dm(t.floating):!1;if(o===f||p&&d)return a;let h={scrollLeft:0,scrollTop:0},b=jl(1);const y=jl(0),v=dn(o);if((v||!d)&&((Hs(o)!=="body"||Fd(f))&&(h=Im(o)),v)){const j=Di(o);b=eu(o),y.x=j.x+o.clientLeft,y.y=j.y+o.clientTop}const w=f&&!v&&!d?fT(f,h):jl(0);return{width:a.width*b.x,height:a.height*b.y,x:a.x*b.x-h.scrollLeft*b.x+y.x+w.x,y:a.y*b.y-h.scrollTop*b.y+y.y+w.y}}function kH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function CH(e){const t=Im(e),a=e.ownerDocument.body,o=wl(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=wl(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-t.scrollLeft+ch(e);const f=-t.scrollTop;return xr(a).direction==="rtl"&&(d+=wl(e.clientWidth,a.clientWidth)-o),{width:o,height:c,x:d,y:f}}const TH=25;function EH(e,t,a){a===void 0&&(a="viewport");const o=a==="layoutViewport",c=Sn(e),d=xl(e),f=c.visualViewport;let p=d.clientWidth,h=d.clientHeight,b=0,y=0;if(f){const w=!Cv()||t==="fixed";o?w||(b=-f.offsetLeft,y=-f.offsetTop):(p=f.width,h=f.height,w&&(b=f.offsetLeft,y=f.offsetTop))}if(ch(d)<=0){const w=d.ownerDocument,j=w.body,S=getComputedStyle(j),N=w.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,k=Math.abs(d.clientWidth-j.clientWidth-N),T=getComputedStyle(d).scrollbarGutter==="stable both-edges"?k/2:k;T<=TH&&(p-=T)}return{width:p,height:h,x:b,y}}function AH(e,t){const a=Di(e,!0,t==="fixed"),o=a.top+e.clientTop,c=a.left+e.clientLeft,d=eu(e),f=e.clientWidth*d.x,p=e.clientHeight*d.y,h=c*d.x,b=o*d.y;return{width:f,height:p,x:h,y:b}}function pT(e,t,a){let o;if(t==="viewport"||t==="layoutViewport")o=EH(e,a,t);else if(t==="document")o=CH(xl(e));else if(At(t))o=AH(t,a);else{const c=dT(e);o={x:t.x-c.x,y:t.y-c.y,width:t.width,height:t.height}}return Xd(o)}function RH(e,t){const a=t.get(e);if(a)return a;let o=Hc(e,[],!1).filter(p=>At(p)&&Hs(p)!=="body"),c=null;const d=xr(e).position==="fixed";let f=d?so(e):e;for(;At(f)&&!no(f);){const p=xr(f),h=kv(f),b=c?c.position:d?"fixed":"";!h&&(b==="fixed"||b==="absolute"&&p.position==="static")?o=o.filter(v=>v!==f):c=p,f=so(f)}return t.set(e,o),o}function OH(e){let{element:t,boundary:a,rootBoundary:o,strategy:c}=e;const f=[...a==="clippingAncestors"?Dm(t)?[]:RH(t,this._c):[].concat(a),o],p=pT(t,f[0],c);let h=p.top,b=p.right,y=p.bottom,v=p.left;for(let w=1;w{p(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(O,{...I,root:d.ownerDocument})}catch{o=new IntersectionObserver(O,I)}o.observe(e)}const h=Sn(e),b=()=>p(a);return h.addEventListener("resize",b),p(!0),()=>{h.removeEventListener("resize",b),f()}}function bT(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,b=vy(e),y=c||d?[...b?Hc(b):[],...t?Hc(t):[]]:[];y.forEach(T=>{c&&T.addEventListener("scroll",a),d&&T.addEventListener("resize",a)});const v=b&&p?_H(b,a,d):null;let w=-1,j=null;f&&(j=new ResizeObserver(T=>{let[D]=T;D&&D.target===b&&j&&t&&(j.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var C;(C=j)==null||C.observe(t)})),a()}),b&&!h&&j.observe(b),t&&j.observe(t));let S,N=h?Di(e):null;h&&k();function k(){const T=Di(e);N&&!xT(N,T)&&a(),N=T,S=requestAnimationFrame(k)}return a(),()=>{var T;y.forEach(D=>{c&&D.removeEventListener("scroll",a),d&&D.removeEventListener("resize",a)}),v?.(),(T=j)==null||T.disconnect(),j=null,h&&cancelAnimationFrame(S)}}const LH=bH,zH=vH,BH=gH,HH=wH,UH=yH,VH=(e,t,a)=>{const o=new Map,c=a??{},d={...gT,...c.platform,_c:o};return hH(e,t,{...c,platform:d})};var FH=typeof document<"u",$H=function(){},uh=FH?x.useLayoutEffect:$H;function dh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,c;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!dh(e[o],t[o]))return!1;return!0}if(c=Object.keys(e),a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,c[o]))return!1;for(o=a;o--!==0;){const d=c[o];if(!(d==="_owner"&&e.$$typeof)&&!dh(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function vT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yT(e,t){const a=vT(e);return Math.round(t*a)/a}function wy(e){const t=x.useRef(e);return uh(()=>{t.current=e}),t}function qH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:c,elements:{reference:d,floating:f}={},transform:p=!0,whileElementsMounted:h,open:b}=e,[y,v]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[w,j]=x.useState(o);dh(w,o)||j(o);const[S,N]=x.useState(null),[k,T]=x.useState(null),D=x.useCallback($=>{$!==I.current&&(I.current=$,N($))},[]),C=x.useCallback($=>{$!==P.current&&(P.current=$,T($))},[]),A=d||S,R=f||k,I=x.useRef(null),P=x.useRef(null),O=x.useRef(y),_=h!=null,L=wy(h),H=wy(c),B=wy(b),z=x.useCallback(()=>{if(!I.current||!P.current)return;const $={placement:t,strategy:a,middleware:w};H.current&&($.platform=H.current),VH(I.current,P.current,$).then(Y=>{const F={...Y,isPositioned:B.current!==!1};Q.current&&!dh(O.current,F)&&(O.current=F,Cs.flushSync(()=>{v(F)}))})},[w,t,a,H,B]);uh(()=>{b===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,v($=>({...$,isPositioned:!1})))},[b]);const Q=x.useRef(!1);uh(()=>(Q.current=!0,()=>{Q.current=!1}),[]),uh(()=>{if(A&&(I.current=A),R&&(P.current=R),A&&R){if(L.current)return L.current(A,R,z);z()}},[A,R,z,L,_]);const K=x.useMemo(()=>({reference:I,floating:P,setReference:D,setFloating:C}),[D,C]),X=x.useMemo(()=>({reference:A,floating:R}),[A,R]),q=x.useMemo(()=>{const $={position:a,left:0,top:0};if(!X.floating)return $;const Y=yT(X.floating,y.x),F=yT(X.floating,y.y);return p?{...$,transform:"translate("+Y+"px, "+F+"px)",...vT(X.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Y,top:F}},[a,p,X.floating,y.x,y.y]);return x.useMemo(()=>({...y,update:z,refs:K,elements:X,floatingStyles:q}),[y,z,K,X,q])}const GH=(e,t)=>{const a=LH(e);return{name:a.name,fn:a.fn,options:[e,t]}},KH=(e,t)=>{const a=zH(e);return{name:a.name,fn:a.fn,options:[e,t]}},YH=(e,t)=>({fn:UH(e).fn,options:[e,t]}),XH=(e,t)=>{const a=BH(e);return{name:a.name,fn:a.fn,options:[e,t]}},QH=(e,t)=>{const a=HH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var jy={exports:{}},Sy={};var wT;function ZH(){if(wT)return Sy;wT=1;var e=Vd();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,c=e.useEffect,d=e.useLayoutEffect,f=e.useDebugValue;function p(v,w){var j=w(),S=o({inst:{value:j,getSnapshot:w}}),N=S[0].inst,k=S[1];return d(function(){N.value=j,N.getSnapshot=w,h(N)&&k({inst:N})},[v,j,w]),c(function(){return h(N)&&k({inst:N}),v(function(){h(N)&&k({inst:N})})},[v]),f(j),j}function h(v){var w=v.getSnapshot;v=v.value;try{var j=w();return!a(v,j)}catch{return!0}}function b(v,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b:p;return Sy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sy}var jT;function ST(){return jT||(jT=1,jy.exports=ZH()),jy.exports}var Ny=ST(),ky={exports:{}},Cy={};var NT;function WH(){if(NT)return Cy;NT=1;var e=Vd(),t=ST();function a(b,y){return b===y&&(b!==0||1/b===1/y)||b!==b&&y!==y}var o=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,d=e.useRef,f=e.useEffect,p=e.useMemo,h=e.useDebugValue;return Cy.useSyncExternalStoreWithSelector=function(b,y,v,w,j){var S=d(null);if(S.current===null){var N={hasValue:!1,value:null};S.current=N}else N=S.current;S=p(function(){function T(I){if(!D){if(D=!0,C=I,I=w(I),j!==void 0&&N.hasValue){var P=N.value;if(j(P,I))return A=P}return A=I}if(P=A,o(C,I))return P;var O=w(I);return j!==void 0&&j(P,O)?(C=I,P):(C=I,A=O)}var D=!1,C,A,R=v===void 0?null:v;return[function(){return T(y())},R===null?void 0:function(){return T(R())}]},[y,v,w,j]);var k=c(b,S[0],S[1]);return f(function(){N.hasValue=!0,N.value=k},[k]),h(k),k},Cy}var kT;function JH(){return kT||(kT=1,ky.exports=WH()),ky.exports}var eU=JH();const tU=Iv(19)?sU:rU;function CT(e,t,a,o,c){return tU(e,t,a,o,c)}function nU(e,t,a,o,c){const d=x.useCallback(()=>t(e.getSnapshot(),a,o,c),[e,t,a,o,c]);return Ny.useSyncExternalStore(e.subscribe,d,d)}F4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const c of e.syncHooks)a.add(c.store);const o=[];for(const c of a)o.push(c.subscribe(t));return()=>{for(const c of o)c()}}),Ny.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function sU(e,t,a,o,c){const d=V4();if(!d)return nU(e,t,a,o,c);const f=d.syncIndex;d.syncIndex+=1;let p;return d.didInitialize?(p=d.syncHooks[f],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,c))&&(p.store!==e&&(d.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=c,p.value=t(e.getSnapshot(),a,o,c))):(p={store:e,selector:t,a1:a,a2:o,a3:c,value:t(e.getSnapshot(),a,o,c)},d.syncHooks.push(p)),p.value}function rU(e,t,a,o,c){return eU.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,d=>t(d,a,o,c))}class aU{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,c){return CT(this,t,a,o,c)}}class tu extends aU{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;De(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;De(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);De(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,c=a!==void 0;De(()=>{c&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,c])}select(t,a,o,c){const d=this.selectors[t];return d(this.state,a,o,c)}useState(t,a,o,c){return x.useDebugValue(t),CT(this,this.selectors[t],a,o,c)}useContextCallback(t,a){x.useDebugValue(t);const o=Ie(a??qt);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let c=o(this.state);return a(c,c,this),this.subscribe(d=>{const f=o(d);if(!Object.is(c,f)){const p=c;c=f,a(f,p,this)}})}}const lU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Ty extends tu{constructor(a){const{syncOnly:o,nested:c,onOpenChange:d,triggerElements:f,...p}=a;super({...p,positionReference:p.referenceElement,domReferenceElement:p.referenceElement},{onOpenChange:d,dataRef:{current:{}},events:eT(),nested:c,triggerElements:f},lU);ln(this,"syncOpenEvent",(a,o)=>{(!a||!this.state.open||o!=null&&LB(o))&&(this.context.dataRef.current.openEvent=a?o:void 0)});ln(this,"dispatchOpenChange",(a,o)=>{this.syncOpenEvent(a,o.event);const c={open:a,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",c)});ln(this,"setOpen",(a,o)=>{if(this.syncOnly){this.context.onOpenChange?.(a,o);return}this.dispatchOpenChange(a,o),this.context.onOpenChange?.(a,o)});this.syncOnly=o}}function oU(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:c,nested:d,onOpenChange:f}=e,p=t.useState("open"),h=t.useState("activeTriggerElement"),b=t.useState(a?"popupElement":"positionerElement"),y=t.context.triggerElements,v=f,w=x.useRef(null);o===void 0&&w.current===null&&(w.current=new Ty({open:p,transitionStatus:void 0,referenceElement:h,floatingElement:b,triggerElements:y,onOpenChange:v,floatingId:c,syncOnly:!0,nested:d}));const j=o??w.current;return t.useSyncedValue("floatingId",c),De(()=>{const S={open:p,floatingId:c,referenceElement:h,floatingElement:b};At(h)&&(S.domReferenceElement=h),j.state.positionReference===j.state.referenceElement&&(S.positionReference=h),j.update(S)},[p,c,h,b,j]),j.context.onOpenChange=v,j.context.nested=d,j}const lf={tabIndex:-1,[Uv]:""};function TT(e){return t=>t==="touch"?e.current:!0}function Ey(e,t=!1){const a=Gd(),o=Jc()!=null,c=Ds(()=>e(a,o)).current;return oU({popupStore:c,treatPopupAsFloatingElement:t,floatingRootContext:c.state.floatingRootContext,floatingId:a,nested:o,onOpenChange:c.setOpen}),c}function Ay({handle:e,store:t}){return De(()=>e.attachStore(t),[e,t]),null}function ET(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function iU(e,t){const a=x.useRef(null);return Ie(o=>{const c=a.current;if(c!==null){if(c.element===o&&c.store===t&&c.id===e)return;a.current=null;const d=c.store;d.context.triggerElements.getById(c.id)===c.element&&(d.context.triggerElements.delete(c.id),ET(d))}o!==null&&e!==void 0&&(a.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),ET(t))})}function Ry(e,t,a,o=!1){let c=e.preventUnmountingOnClose;t?c=!1:o&&(c=!0);const d=a?.id??null;let f=e.activeTriggerId,p=e.activeTriggerElement;return(d||t)&&(f=d,p=a??null),{open:t,preventUnmountingOnClose:c,activeTriggerId:f,activeTriggerElement:p}}function AT(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function cU(e,t,a,o={}){const c=a.reason,d=c===Vs,f=t&&c===th,p=!t&&(c===mo||c===Xc),h=AT(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const b=()=>{const y=Ry(e.state,t,a.trigger,h()),v={...o.extraState,...y};f?v.instantType="focus":p?v.instantType="dismiss":d&&(v.instantType=void 0),e.update(v)};d?Cs.flushSync(b):b()}function RT(e,t,a,o){const c=a.useState("isMountedByTrigger",e),d=iU(e,a),f=Ie(h=>{const b=a.select("open"),y=a.select("activeTriggerId");if(y===e){const v={activeTriggerElement:h,...b?o:null};a.update(v);return}if(y==null&&b){const v={activeTriggerId:e??null,activeTriggerElement:h,...o};a.update(v)}}),p=Ie(h=>{d(h),h&&f(h)});return De(()=>(p(t.current),()=>p(null)),[p,t,a,e]),De(()=>{if(c){const h={activeTriggerElement:t.current,...o};a.update(h)}},[c,a,t,...Object.values(o)]),{registerTrigger:p,isMountedByThisTrigger:c}}function Oy(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=x.useRef(null),c=e.useState("open"),d=e.useState("triggerCount"),f=e.useState("activeTriggerId"),p=e.useState("activeTriggerElement");De(()=>{if(!c){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const h=e.context.triggerElements.size,b={};e.state.triggerCount!==h&&(b.triggerCount=h);const y=e.select("activeTriggerId");let v=null;if(y){const w=e.context.triggerElements.getById(y);if(w)o.current=y,w!==e.state.activeTriggerElement&&(b.activeTriggerElement=w);else{for(const[j,S]of e.context.triggerElements.entries())if(S===e.state.activeTriggerElement){b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j;break}b.activeTriggerId===void 0&&(o.current===y?v=y:o.current=null)}}else o.current=null;if(!v&&!y&&h===1){const w=e.context.triggerElements.entries().next();if(!w.done){const[j,S]=w.value;b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j}}(b.triggerCount!==void 0||b.activeTriggerId!==void 0||b.activeTriggerElement!==void 0)&&e.update(b),v&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===v&&!e.context.triggerElements.getById(v)){const w=Fe(Yn);e.setOpen(!1,w),w.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[c,e,d,f,p,a])}function My(e,t,a,o){const{mounted:c,setMounted:d,transitionStatus:f}=ki(e,!1,!1,o),p=t.useState("preventUnmountingOnClose"),h=e?!1:p;t.useSyncedValues({mounted:c,transitionStatus:f,preventUnmountingOnClose:h});const b=Ie(()=>{d(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ra({enabled:c&&!e&&!h,open:e,ref:t.context.popupRef,onComplete(){e||b()}}),{forceUnmount:b,transitionStatus:f}}function Dy(e,t){e.useSyncedValues(t),De(()=>()=>{e.update({activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn})},[e])}function OT(e,t){De(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),De(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fh{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Iy(e,t,a=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ty({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn}}const of=e=>e.triggerIdProp??e.activeTriggerId,Py=e=>e.openProp??e.open,MT=e=>(e.popupElement?.id??e.floatingId)||void 0;function DT(e,t){return t!==void 0&&Py(e)&&of(e)===t}function uU(e,t){return DT(e,t)?!0:t!==void 0&&Py(e)&&of(e)==null&&e.triggerCount===1}const _y={open:Py,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:of,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:MT,isTriggerActive:(e,t)=>t!==void 0&&of(e)===t,isOpenedByTrigger:(e,t)=>DT(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&of(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>uU(e,t)?MT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function IT(e){const t=x.useCallback(o=>e===void 0?qt:e.subscribeStore(o),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ny.useSyncExternalStore(t,a,()=>e?.serverStore)}function PT(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,c=Gd(),d=Jc()!=null,f=Ds(()=>new Ty({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new fh,floatingId:c,syncOnly:!1,nested:d})).current;return De(()=>{const p={open:t,floatingId:c};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=At(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),f.update(p)},[t,c,o.reference,o.floating,f]),f.context.onOpenChange=a,f.context.nested=d,f}function dU(e){return fU(e,e.rootContext)}function fU(e,t){const{nodeId:a,externalTree:o}=e,c=t.useState("referenceElement"),d=t.useState("floatingElement"),f=t.useState("domReferenceElement"),p=t.useState("open"),h=t.useState("floatingId"),[b,y]=x.useState(null),[v,w]=x.useState(void 0),[j,S]=x.useState(void 0),N=x.useRef(null),k=Mi(o),T=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),D=qH({...e,elements:{...T,...b&&{reference:b}}}),C=At(v)?v:null,A=j===void 0?t.state.floatingElement:j;t.useSyncedValue("referenceElement",v??null),t.useSyncedValue("domReferenceElement",v===void 0?f:C),t.useSyncedValue("floatingElement",A);const R=x.useCallback(H=>{const B=At(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;y(B),D.refs.setReference(B)},[D.refs]),I=x.useCallback(H=>{(At(H)||H===null)&&(N.current=H,w(H)),(At(D.refs.reference.current)||D.refs.reference.current===null||H!==null&&!At(H))&&D.refs.setReference(H)},[D.refs,w]),P=x.useCallback(H=>{S(H),D.refs.setFloating(H)},[D.refs]),O=x.useMemo(()=>({...D.refs,setReference:I,setFloating:P,setPositionReference:R,domReference:N}),[D.refs,I,P,R]),_=x.useMemo(()=>({...D.elements,domReference:f}),[D.elements,f]),L=x.useMemo(()=>({...D,dataRef:t.context.dataRef,open:p,onOpenChange:t.setOpen,events:t.context.events,floatingId:h,refs:O,elements:_,nodeId:a,rootStore:t}),[D,O,_,a,t,p,h]);return De(()=>{f&&(N.current=f)},[f]),De(()=>{t.context.dataRef.current.floatingContext=L;const H=k?.nodesRef.current.find(B=>B.id===a);H&&(H.context=L)}),x.useMemo(()=>({...D,context:L,refs:O,elements:_,rootStore:t}),[D,O,_,L,t])}const Ly=JC&&yl;function pU(e,t={}){const{enabled:a=!0,delay:o}=t,c="rootStore"in e?e.rootStore:e,{events:d,dataRef:f}=c.context,p=x.useRef(!1),h=x.useRef(null),b=x.useRef(!0),y=Zs();x.useEffect(()=>{const w=c.select("domReferenceElement");if(!a)return;const j=Sn(w);function S(){const T=c.select("domReferenceElement");!c.select("open")&&dn(T)&&T===or($t(T))&&(p.current=!0,h.current=T)}function N(){b.current=!0}function k(){b.current=!1}return Ya(St(j,"blur",S),Ly&&St(j,"keydown",N,!0),Ly&&St(j,"pointerdown",k,!0))},[c,a]),x.useEffect(()=>{if(!a)return;function w(j){if(j.reason===mo||j.reason===Xc){const S=c.select("domReferenceElement");At(S)&&(h.current=S,p.current=!0)}}return d.on("openchange",w),()=>{d.off("openchange",w)}},[d,a,c]);const v=x.useMemo(()=>{function w(){p.current=!1,h.current=null}return{onMouseLeave(){w()},onFocus(j){const S=j.currentTarget;if(p.current){if(h.current===S)return;w()}const N=cs(j.nativeEvent);if(At(N)){if(Ly&&!j.relatedTarget){if(!b.current&&!$m(N))return}else if(!PB(N))return}const k=Fm(j.relatedTarget,c.context.triggerElements),{nativeEvent:T,currentTarget:D}=j,C=typeof o=="function"?o():o;if(c.select("open")&&k||C===0||C===void 0){c.setOpen(!0,Fe(th,T,D));return}y.start(C,()=>{p.current||c.setOpen(!0,Fe(th,T,D))})},onBlur(j){w();const S=j.relatedTarget,N=j.nativeEvent,k=At(S)&&S.hasAttribute(sf("focus-guard"))&&S.getAttribute("data-type")==="outside";y.start(0,()=>{const T=c.select("domReferenceElement"),D=or($t(T));!S&&D===T||Qe(f.current.floatingContext?.refs.floating.current,D)||Qe(T,D)||k||Fm(S??D,c.context.triggerElements)||c.setOpen(!1,Fe(th,N))})}}},[f,o,c,y]);return x.useMemo(()=>a?{reference:v,trigger:v}:{},[a,v])}class zy{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new sa,this.restTimeout=new sa,this.handleCloseOptions=void 0}static create(){return new zy}}const ph=new WeakMap;function mh(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&ph.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ph.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _T(e,t){const{scopeElement:a,referenceElement:o,floatingElement:c}=t,d=ph.get(a);d&&d!==e&&mh(d),mh(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=c,ph.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",c.style.pointerEvents="auto"}function By(e){const t=e.context.dataRef.current,a=Ds(()=>t.hoverInteractionState??zy.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),ay(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function LT(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:c}=t,d="rootStore"in e?e.rootStore:e,f=d.useState("open"),p=d.useState("floatingElement"),h=d.useState("domReferenceElement"),{dataRef:b}=d.context,y=Mi(),v=Jc(),w=By(d),j=Zs(),S=Ie(()=>H1(b.current.openEvent?.type,w.interactedInside)),N=Ie(()=>G4(b.current.openEvent?.type)),k=Ie(()=>{mh(w)});De(()=>{f||(w.pointerType=void 0,w.restTimeoutPending=!1,w.interactedInside=!1,k())},[f,w,k]),x.useEffect(()=>k,[k]),De(()=>{if(a&&f&&w.handleCloseOptions?.blockPointerEvents&&N()&&At(h)&&p){const T=h,D=p,C=$t(p),A=y?.nodesRef.current.find(O=>O.id===v)?.context?.elements.floating;A&&(A.style.pointerEvents="");const R=w.pointerEventsScopeElement!==D?w.pointerEventsScopeElement:null,I=A!==D?A:null,P=w.handleCloseOptions?.getScope?.()??R??I??T.closest("[data-rootownerid]")??C.body;return _T(w,{scopeElement:P,referenceElement:T,floatingElement:D}),()=>{k()}}},[a,f,h,p,w,N,y,v,k]),x.useEffect(()=>{if(!a)return;function T(){return!!(y&&v&&io(y.nodesRef.current,v).length>0)}function D(O){const _=Oi(o,"close",w.pointerType),L=()=>{d.setOpen(!1,Fe(Vs,O)),y?.events.emit("floating.closed",O)};_?w.openChangeTimeout.start(_,L):(w.openChangeTimeout.clear(),L())}function C(O){const _=cs(O);if(!IB(_)){w.interactedInside=!1;return}w.interactedInside=_?.closest("[aria-haspopup]")!=null}function A(){w.openChangeTimeout.clear(),j.clear(),y?.events.off("floating.closed",I),k()}function R(O){if(T()&&y){y.events.on("floating.closed",I);return}if(Fm(O.relatedTarget,d.context.triggerElements))return;const _=b.current.floatingContext?.nodeId??c,L=O.relatedTarget;if(!(y&&_&&At(L)&&io(y.nodesRef.current,_,!1).some(B=>Qe(B.context?.elements.floating,L)))){if(w.handler){w.handler(O);return}k(),N()&&!S()&&D(O)}}function I(O){!y||!v||T()||j.start(0,()=>{y.events.off("floating.closed",I),d.setOpen(!1,Fe(Vs,O)),y.events.emit("floating.closed",O)})}const P=p;return Ya(P&&St(P,"mouseenter",A),P&&St(P,"mouseleave",R),P&&St(P,"pointerdown",C,!0),()=>{y?.events.off("floating.closed",I)})},[a,p,d,b,o,c,N,S,k,w,y,v,j])}const mU={current:null};function zT(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:c=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElementRef:h=mU,externalTree:b,isActiveTrigger:y=!0,getHandleCloseContext:v,isClosing:w,shouldOpen:j,guardStaleOpen:S=!1}=t,N="rootStore"in e?e.rootStore:e,{dataRef:k,events:T}=N.context,D=Mi(b),C=By(N),A=x.useRef(!1),R=Xn(c),I=Xn(o),P=Xn(f),O=Xn(a),_=Xn(j),L=Xn(w),H=Ie(()=>H1(k.current.openEvent?.type,C.interactedInside)),B=Ie(()=>_.current?.()!==!1),z=Ie((X,q,$)=>{const Y=N.context.triggerElements;if(Y.hasElement(q))return!X||!Qe(X,q);if(!At($))return!1;const F=$;return Y.hasMatchingElement(G=>Qe(G,F))&&(!X||!Qe(X,F))}),Q=Ie(()=>{if(!C.handler)return;$t(N.select("domReferenceElement")).removeEventListener("mousemove",C.handler),C.handler=void 0}),K=Ie(()=>{mh(C)});return y&&(C.handleCloseOptions=c?.__options),x.useEffect(()=>Q,[Q]),x.useEffect(()=>{if(!a)return;function X(q){q.open?A.current=!1:(A.current=q.reason===Vs,Q(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return T.on("openchange",X),()=>{T.off("openchange",X)}},[a,T,C,Q]),x.useEffect(()=>{if(!a)return;function X(W,le=!0){const M=Oi(I.current,"close",C.pointerType);M?C.openChangeTimeout.start(M,()=>{N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W)}):le&&(C.openChangeTimeout.clear(),N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W))}const q=h.current??(y?N.select("domReferenceElement"):null);if(!At(q))return;function $(W){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,d&&!co(C.pointerType))return;const le=B1(P.current),M=Oi(I.current,"open",C.pointerType),U=cs(W),Z=W.currentTarget??null,ae=N.select("domReferenceElement");let ce=Z;if(At(U)&&!N.context.triggerElements.hasElement(U)){for(const de of N.context.triggerElements.elements())if(Qe(de,U)){ce=de;break}}At(Z)&&At(ae)&&!N.context.triggerElements.hasElement(Z)&&Qe(Z,ae)&&(ce=ae);const J=ce==null?!1:z(ae,ce,U),ie=N.select("open"),ge=L.current?.()??N.select("transitionStatus")==="ending",ee=!ie&&ge&&A.current,fe=!J&&At(ce)&&At(ae)&&Qe(ae,ce)&&ee,te=le>0&&!M,Ce=J&&(ie||ee)||fe,re=!ie||J;if(Ce){B()&&N.setOpen(!0,Fe(Vs,W,ce));return}te||(M?C.openChangeTimeout.start(M,()=>{re&&B()&&N.setOpen(!0,Fe(Vs,W,ce))}):re&&B()&&N.setOpen(!0,Fe(Vs,W,ce)))}function Y(W){if(H()){K();return}Q();const le=N.select("domReferenceElement"),M=$t(le);C.restTimeout.clear(),C.restTimeoutPending=!1;const U=k.current.floatingContext??v?.();if(Fm(W.relatedTarget,N.context.triggerElements))return;if(R.current&&U){N.select("open")||C.openChangeTimeout.clear();const ae=h.current;C.handler=R.current({...U,tree:D,x:W.clientX,y:W.clientY,onClose(){K(),Q(),O.current&&!H()&&ae===N.select("domReferenceElement")&&X(W,!0)}}),M.addEventListener("mousemove",C.handler),C.handler(W);return}(C.pointerType!=="touch"||!Qe(N.select("floatingElement"),W.relatedTarget))&&X(W)}function F(W){Qe(q,W.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}const G=S?St(q,"mouseout",F):void 0;return p?Ya(St(q,"mousemove",$,{once:!0}),St(q,"mouseenter",$),St(q,"mouseleave",Y),G):Ya(St(q,"mouseenter",$),St(q,"mouseleave",Y),G)},[Q,K,k,I,N,a,R,C,y,z,H,d,p,P,h,D,O,v,L,B,S]),x.useMemo(()=>{if(!a)return;function X(q){C.pointerType=q.pointerType}return{onPointerDown:X,onPointerEnter:X,onMouseMove(q){const{nativeEvent:$}=q,Y=q.currentTarget,F=N.select("domReferenceElement"),G=N.select("open"),W=z(F,Y,q.target);if(d&&!co(C.pointerType))return;if(G&&W&&C.handleCloseOptions?.blockPointerEvents){const U=N.select("floatingElement");if(U){const Z=C.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;_T(C,{scopeElement:Z,referenceElement:Y,floatingElement:U})}}const le=B1(P.current);if(G&&!W||le===0||!W&&C.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;C.restTimeout.clear();function M(){if(C.restTimeoutPending=!1,H())return;const U=N.select("open");!C.blockMouseMove&&(!U||W)&&B()&&N.setOpen(!0,Fe(Vs,$,Y))}C.pointerType==="touch"?Cs.flushSync(()=>{M()}):W&&G?M():(C.restTimeoutPending=!0,C.restTimeout.start(le,M))}}},[a,C,H,z,d,N,P,B])}const hU="Escape";function BT(e){return yl&&e.movementX===0&&e.movementY===0}function hh(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function gh(e,t){return hh(t,e===Vv||e===Vm,e===ji||e===Si)}function Hy(e,t,a){return hh(t,e===Vm,a?e===ji:e===Si)||e==="Enter"||e===" "||e===""}function gU(e,t,a){return hh(t,a?e===ji:e===Si,e===Vm)}function xU(e,t,a,o){const c=a?e===Si:e===ji,d=e===Vv;return t==="both"||t==="horizontal"&&o?e===hU:hh(t,c,d)}function HT(e,t){const{listRef:a,activeIndex:o,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:h=!1,nested:b=!1,rtl:y=!1,virtual:v=!1,focusItemOnOpen:w="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:S=!0,disabledIndices:N=void 0,orientation:k="vertical",parentOrientation:T,id:D,resetOnPointerLeave:C=!0,externalTree:A,grid:R}=t,I=R!=null,P="rootStore"in e?e.rootStore:e,O=P.useState("open"),_=P.useState("floatingElement"),L=P.useState("domReferenceElement"),H=P.context.dataRef,B=qm(_),z=Yv(L),Q=Xn(B),K=Jc(),X=Mi(A),q=x.useRef(w),$=x.useRef(f??-1),Y=x.useRef(null),F=x.useRef(!0),G=Ie(xe=>{c($.current===-1?null:$.current,xe)}),W=x.useRef(!!_),le=x.useRef(O),M=x.useRef(!1),U=x.useRef(!1),Z=x.useRef(null),ae=Xn(N),ce=Xn(O),J=Xn(f),ie=Xn(C),ge=Kc(),ee=Kc(),fe=Ie(()=>{function xe(_e){v?X?.events.emit("virtualfocus",_e):Z.current=ah(_e,{sync:M.current,preventScroll:!0})}const Te=a.current[$.current],Oe=U.current;Te&&xe(Te),(M.current?_e=>_e():_e=>ge.request(_e))(()=>{const _e=a.current[$.current]||Te;if(!_e)return;Te||xe(_e),Ee&&(Oe||!F.current)&&_e.scrollIntoView?.({block:"nearest",inline:"nearest"})})});De(()=>{H.current.orientation=k},[H,k]),De(()=>{d&&(O&&_?($.current=f??-1,q.current&&f!=null&&(U.current=!0,G())):W.current&&($.current=-1,G()))},[d,O,_,f,G]),De(()=>{if(d){if(!O){M.current=!1;return}if(_)if(o==null){if(M.current=!1,J.current!=null)return;if(W.current&&($.current=-1,fe()),(!le.current||!W.current)&&q.current&&(Y.current!=null||q.current===!0&&Y.current==null)){let xe=0;const Te=()=>{a.current[0]==null?(xe<2&&(xe?Ne=>ee.request(Ne):queueMicrotask)(Te),xe+=1):($.current=Y.current==null||Hy(Y.current,k,y)||b?Qm(a):ey(a),Y.current=null,G())};Te()}}else fo(a.current,o)||($.current=o,fe(),U.current=!1)}},[d,O,_,o,J,b,a,k,y,G,fe,ee]),De(()=>{if(!d||_||!X||v||!W.current)return;const xe=X.nodesRef.current,Te=xe.find(_e=>_e.id===K)?.context?.elements.floating,Oe=or($t(L??Te??null)),Ne=xe.some(_e=>_e.context&&Qe(_e.context.elements.floating,Oe));Te&&!Ne&&F.current&&Te.focus({preventScroll:!0})},[d,_,L,X,K,v]),De(()=>{le.current=O,W.current=!!_}),De(()=>{O||(Y.current=null,q.current=w)},[O,w]);const te=o!=null,Ce=Ie(xe=>{if(!ce.current)return;const Te=a.current.indexOf(xe.currentTarget);Te!==-1&&($.current!==Te||o!==Te)&&($.current=Te,G(xe))}),re=Ie(()=>T??X?.nodesRef.current.find(xe=>xe.id===K)?.context?.dataRef?.current.orientation),de=Ie(()=>Qm(a,ae.current)),ke=Ie(xe=>{if(F.current=!1,M.current=!0,xe.which===229||!ce.current&&xe.currentTarget===Q.current)return;if(b&&xU(xe.key,k,y,I)){gh(xe.key,re())||ks(xe),P.setOpen(!1,Fe(iy,xe.nativeEvent)),dn(L)&&(v?X?.events.emit("virtualfocus",L):L.focus());return}const Te=$.current,Oe=Qm(a,N),Ne=ey(a,N);if(z||(xe.key==="Home"&&(ks(xe),$.current=Oe,G(xe)),xe.key==="End"&&(ks(xe),$.current=Ne,G(xe))),R!=null){const _e=R(xe,$.current,a,k,h,y,N,Oe,Ne);if(_e!=null&&($.current=_e,G(xe)),k==="both")return}if(gh(xe.key,k)){if(ks(xe),O&&!v&&or(xe.currentTarget.ownerDocument)===xe.currentTarget){$.current=Hy(xe.key,k,y)?Oe:Ne,G(xe);return}Hy(xe.key,k,y)?h?Te>=Ne?p&&Te!==a.current.length?$.current=-1:(M.current=!1,$.current=Oe):$.current=Is(a.current,{startingIndex:Te,disabledIndices:N}):$.current=Math.min(Ne,Is(a.current,{startingIndex:Te,disabledIndices:N})):h?Te<=Oe?p&&Te!==-1?$.current=a.current.length:(M.current=!1,$.current=Ne):$.current=Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N}):$.current=Math.max(Oe,Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N})),fo(a.current,$.current)&&($.current=-1),G(xe)}}),Ee=x.useMemo(()=>({onFocus(Te){M.current=!0,Ce(Te)},onClick:({currentTarget:Te})=>Te.focus({preventScroll:!0}),onMouseMove(Te){BT(Te)||(M.current=!0,U.current=!1,j&&Ce(Te))},onPointerLeave(Te){if(!ce.current||!F.current||Te.pointerType==="touch")return;M.current=!0;const Oe=Te.relatedTarget;if(!(!j||a.current.includes(Oe))&&ie.current&&(Z.current?.(),Z.current=null,$.current=-1,G(Te),!v)){const Ne=Q.current,_e=or($t(Ne));Ne&&Qe(Ne,_e)&&Ne.focus({preventScroll:!0})}}}),[Ce,ce,Q,j,a,G,ie,v]),ve=x.useMemo(()=>v&&O&&te&&{"aria-activedescendant":`${D}-${o}`},[v,O,te,D,o]),he=x.useMemo(()=>({...z?{}:ve,onKeyDown(xe){if(xe.key==="Tab"&&xe.shiftKey&&O&&!v){const Te=cs(xe.nativeEvent);if(Te&&!Qe(Q.current,Te))return;ks(xe),P.setOpen(!1,Fe(ho,xe.nativeEvent)),dn(L)&&L.focus();return}ke(xe)},onPointerMove(xe){BT(xe)||(F.current=!0)}}),[ve,ke,Q,z,P,O,v,L]),ye=x.useMemo(()=>{function xe(Ne){P.setOpen(!0,Fe(iy,Ne.nativeEvent,Ne.currentTarget))}function Te(Ne){w==="auto"&&Gm(Ne.nativeEvent)&&(q.current=!v)}function Oe(Ne){q.current=w,w==="auto"&&Xv(Ne.nativeEvent)&&(q.current=!0)}return{onKeyDown(Ne){const _e=P.select("open");F.current=!1;const Ye=Ne.key.startsWith("Arrow"),kt=gU(Ne.key,re(),y),Ct=gh(Ne.key,k),Rt=(b?kt:Ct)||Ne.key==="Enter"||Ne.key.trim()==="";if(v&&_e)return ke(Ne);if(!(!_e&&!S&&Ye)){if(Rt){const ot=gh(Ne.key,re());Y.current=b&&ot?null:Ne.key}if(b){kt&&(ks(Ne),_e?($.current=de(),G(Ne)):xe(Ne));return}Ct&&(J.current!=null&&($.current=J.current),ks(Ne),!_e&&S?xe(Ne):ke(Ne),_e&&G(Ne))}},onFocus(Ne){P.select("open")&&!v&&($.current=-1,G(Ne))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Te,onClick:Te}},[ke,w,de,b,G,P,S,k,re,y,J,v]),je=x.useMemo(()=>({...ve,...ye}),[ve,ye]);return x.useMemo(()=>d?{reference:je,floating:he,item:Ee,trigger:ye}:{},[d,je,he,ye,Ee])}function UT(e,t){const{listRef:a,elementsRef:o,activeIndex:c,onMatch:d,disabledIndices:f,onTyping:p,enabled:h=!0,resetMs:b=750,selectedIndex:y=null}=t,v="rootStore"in e?e.rootStore:e,w=v.useState("open"),j=Zs(),S=x.useRef(""),N=x.useRef(y??c??-1),k=x.useRef(null),T=Ie(A=>{function R(Q){return o?.current[Q]}function I(Q){const K=R(Q);return K&&!Zm(K)||K?.matches(":disabled")?!1:f==null||!po(Or,Q,f)}function P(Q,K,X=0){if(Q.length===0)return-1;const q=(X%Q.length+Q.length)%Q.length,$=K.toLowerCase();for(let Y=0;Y0&&A.key===" "&&(ks(A),p?.(!0)),S.current.length>0&&S.current[0]!==" "&&P(O,S.current)===-1&&A.key!==" "&&p?.(!1),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;w&&A.key!==" "&&(ks(A),p?.(!0));const _=S.current==="";_&&(N.current=y??c??-1),O.every((Q,K)=>Q&&I(K)?Q[0]?.toLowerCase()!==Q[1]?.toLowerCase():!0)&&S.current===A.key&&(S.current="",N.current=k.current),S.current+=A.key,j.start(b,()=>{S.current="",N.current=k.current,p?.(!1)});const B=((_?y??c??-1:N.current)??0)+1,z=P(O,S.current,B);z!==-1?(d?.(z),k.current=z):A.key!==" "&&(S.current="",p?.(!1))}),D=Ie(A=>{const R=A.relatedTarget,I=v.select("domReferenceElement"),P=v.select("floatingElement");Qe(I,R)||Qe(P,R)||(j.clear(),S.current="",N.current=k.current,p?.(!1))});De(()=>{!w&&y!==null||(j.clear(),k.current=null,S.current!==""&&(S.current=""))},[w,y,j]);const C=x.useMemo(()=>({onKeyDown:T,onBlur:D}),[T,D]);return x.useMemo(()=>h?{reference:C,floating:C}:{},[h,C])}const VT=.1,bU=VT*VT,bn=.5;function xh(e,t,a,o,c,d){return o>=t!=d>=t&&e<=(c-a)*(t-o)/(d-o)+a}function bh(e,t,a,o,c,d,f,p,h,b){let y=!1;return xh(e,t,a,o,c,d)&&(y=!y),xh(e,t,c,d,f,p)&&(y=!y),xh(e,t,f,p,h,b)&&(y=!y),xh(e,t,h,b,a,o)&&(y=!y),y}function vU(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function vh(e,t,a,o,c,d){const f=Math.min(a,c),p=Math.max(a,c),h=Math.min(o,d),b=Math.max(o,d);return e>=f&&e<=p&&t>=h&&t<=b}function FT(e={}){const{blockPointerEvents:t=!1}=e,a=new sa,o=({x:c,y:d,placement:f,elements:p,onClose:h,nodeId:b,tree:y})=>{const v=f?.split("-")[0];let w=!1,j=null,S=null,N=typeof performance<"u"?performance.now():0;function k(D,C){const A=performance.now(),R=A-N;if(j===null||S===null||R===0)return j=D,S=C,N=A,!1;const I=D-j,P=C-S,O=I*I+P*P,_=R*R*bU;return j=D,S=C,N=A,O<_}function T(){a.clear(),h()}return function(C){a.clear();const A=p.domReference,R=p.floating;if(!A||!R||v==null||c==null||d==null)return;const{clientX:I,clientY:P}=C,O=cs(C),_=C.type==="mouseleave",L=Qe(R,O),H=Qe(A,O);if(L&&(w=!0,!_))return;if(H&&(w=!1,!_)){w=!0;return}if(_&&At(C.relatedTarget)&&Qe(R,C.relatedTarget))return;function B(){return!!(y&&io(y.nodesRef.current,b).length>0)}function z(){B()||T()}if(B())return;const Q=A.getBoundingClientRect(),K=R.getBoundingClientRect(),X=c>K.right-K.width/2,q=d>K.bottom-K.height/2,$=K.width>Q.width,Y=K.height>Q.height,F=($?Q:K).left,G=($?Q:K).right,W=(Y?Q:K).top,le=(Y?Q:K).bottom;if(v==="top"&&d>=Q.bottom-1||v==="bottom"&&d<=Q.top+1||v==="left"&&c>=Q.right-1||v==="right"&&c<=Q.left+1){z();return}let M=!1;switch(v){case"top":M=vh(I,P,F,Q.top+1,G,K.bottom-1);break;case"bottom":M=vh(I,P,F,K.top+1,G,Q.bottom-1);break;case"left":M=vh(I,P,K.right-1,le,Q.left+1,W);break;case"right":M=vh(I,P,Q.right-1,le,K.left+1,W);break}if(M)return;if(w&&!vU(I,P,Q)){z();return}if(!_&&k(I,P)){z();return}let U=!1;switch(v){case"top":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d+bn+1,ie=X||$?K.bottom-bn:K.top,ge=X?$?K.bottom-bn:K.top:K.bottom-bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"bottom":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d-bn,ie=X||$?K.top+bn:K.bottom,ge=X?$?K.top+bn:K.bottom:K.top+bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"left":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c+bn+1,ie=q||Y?K.right-bn:K.left,ge=q?Y?K.right-bn:K.left:K.right-bn;U=bh(I,P,ie,K.top,ge,K.bottom,J,ae,J,ce);break}case"right":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c-bn,ie=q||Y?K.left+bn:K.right,ge=q?Y?K.left+bn:K.right:K.left+bn;U=bh(I,P,J,ae,J,ce,ie,K.top,ge,K.bottom);break}}U?w||a.start(40,z):z()}};return o.__options={...e,blockPointerEvents:t},o}const yU={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class wU extends tu{constructor(a,o,c){const d=new fh;super(jU(a,d,o,c),SU(d),yU);ln(this,"setOpen",(a,o)=>{cU(this,a,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(a){this.state.floatingRootContext.dispatchOpenChange(!1,Fe(mo,a))}}function jU(e,t,a,o=!1){return{...Iy(t,a,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function SU(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const NU=sh(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:c,disableHoverablePopup:d=!1,trackCursorAxis:f="none",actionsRef:p,onOpenChange:h,onOpenChangeComplete:b,handle:y,triggerId:v,defaultTriggerId:w=null,children:j}=t,S=Ey((H,B)=>new wU({open:o,openProp:c,activeTriggerId:w,triggerIdProp:v},H,B));S.useControlledProp("openProp",c),S.useControlledProp("triggerIdProp",v),S.useContextCallback("onOpenChange",h),S.useContextCallback("onOpenChangeComplete",b);const N=S.useState("open"),k=!a&&N,T=S.useState("activeTriggerId"),D=S.useState("mounted"),C=S.useState("payload");S.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:d,disabled:a}),Oy(S,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:R}=My(k,S),I=S.useState("isInstantPhase"),P=S.useState("instantType"),O=S.useState("lastOpenChangeReason"),_=x.useRef(null);De(()=>{N&&a&&S.setOpen(!1,Fe(i4))},[N,a,S]),De(()=>{R==="ending"&&O===Yn||R!=="ending"&&I?(P!=="delay"&&(_.current=P),S.set("instantType","delay")):_.current!==null&&(S.set("instantType",_.current),_.current=null)},[R,I,O,P,S]),De(()=>{k&&T==null&&S.set("payload",void 0)},[S,T,k]),x.useImperativeHandle(p,()=>({unmount:A,close:()=>S.setOpen(!1,Fe(cy))}),[A,S]);const L=k||D||!a&&f!=="none";return s.jsxs(z1.Provider,{value:S,children:[y&&s.jsx(Ay,{handle:y,store:S}),L&&s.jsx(kU,{store:S,disabled:a,trackCursorAxis:f}),typeof j=="function"?j({payload:C}):j]})});function kU({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),c=af(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),d=uH(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),f=x.useMemo(()=>Wr(d.reference,c.reference),[d.reference,c.reference]);return Dy(e,{activeTriggerProps:f,inactiveTriggerProps:f,popupProps:c.floating??fn}),null}const $T=x.createContext(void 0);function CU(){return x.useContext($T)}const TU=600,qT="data-base-ui-tooltip-trigger";function GT(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;ok.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ae=pU(A,{enabled:!X}).reference,ce=fe=>{const te=F.current,Ce=GT(fe),re=U(Ce),de=R.current,ke=de&&Ce&&Qe(de,Ce);if(re&&k.select("open")&&k.select("lastOpenChangeReason")===Vs){k.setOpen(!1,Fe(Vs,fe));return}if(te&&!re&&ke&&!q.current&&!k.select("open")&&de&&co(W.current)){const Ee=()=>{!F.current&&!q.current&&!k.select("open")&&k.setOpen(!0,Fe(Vs,fe,de))},ve=le();ve===0?(G.clear(),Ee()):G.start(ve,Ee)}},J=k.useState("triggerProps",O);return yt("button",t,{state:{open:C},ref:[a,P,R],props:[Z,ae,O||$!=="none"?J:void 0,{onMouseOver(fe){ce(fe.nativeEvent)},onFocus(fe){M(GT(fe.nativeEvent))&&fe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,G.clear(),W.current=void 0},onPointerEnter(fe){W.current=fe.pointerType},onPointerDown(fe){W.current=fe.pointerType,k.set("closeOnClick",y),y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},onClick(fe){y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},id:T,[Gv]:X?"":void 0,[qT]:X?void 0:""},j],stateAttributesMapping:Fv})}),KT=x.createContext(void 0);function RU(){const e=x.useContext(KT);if(e===void 0)throw new Error(on(70));return e}const OU=x.forwardRef(function(t,a){const{children:o,container:c,className:d,render:f,style:p,...h}=t,{node:b,subtree:y}=J1({container:c,ref:a,componentProps:t,elementProps:h});return!y&&!b?null:s.jsxs(x.Fragment,{children:[y,b&&Cs.createPortal(o,b)]})}),MU=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return nf().useState("mounted")||o?s.jsx(KT.Provider,{value:o,children:s.jsx(OU,{ref:a,...c})}):null}),YT=x.createContext(void 0);function XT(){const e=x.useContext(YT);if(e===void 0)throw new Error(on(71));return e}const DU=x.createContext(void 0);function cf(){return x.useContext(DU)?.direction??"ltr"}const IU=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:c,rects:d,platform:f,elements:p,middlewareData:h}=t,{element:b,padding:y=0,offsetParent:v="real"}=uo(e,t)||{};if(b==null)return{};const w=i1(y),j={x:a,y:o},S=Wv(c),N=Zv(S),k=await f.getDimensions(b),T=S==="y",D=T?"top":"left",C=T?"bottom":"right",A=T?"clientHeight":"clientWidth",R=d.reference[N]+d.reference[S]-j[S]-d.floating[N],I=j[S]-d.reference[S],P=v==="real"?await f.getOffsetParent?.(b):p.floating;let O=p.floating[A]||d.floating[N];(!O||!await f.isElement?.(P))&&(O=p.floating[A]||d.floating[N]);const _=R/2-I/2,L=O/2-k[N]/2-1,H=Math.min(w[D],L),B=Math.min(w[C],L),z=H,Q=O-k[N]-B,K=O/2-k[N]/2+_,X=a1(z,K,Q),q=!h.arrow&&Sl(c)!=null&&K!==X&&d.reference[N]/2-(K{const{name:a,fn:o}=IU(e);return{name:a,fn:o,options:[e,t]}},_U={name:"hide",async fn(e){const{width:t,height:a,x:o,y:c}=e.rects.reference,d=t===0&&a===0&&o===0&&c===0,f=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:f.top-a>=0||f.right-t>=0||f.bottom-a>=0||f.left-t>=0||d}}}},LU={sideX:"left",sideY:"top"},zU="--available-width",BU="--available-height",HU="--anchor-width",UU="--anchor-height",VU="--transform-origin",QT=zU,ZT=BU;function WT(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function JT(e,t,a){const{rects:o,placement:c}=e;return{side:WT(t,ta(c),a),align:Sl(c)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function yh(e){return FU(e,dU)}function FU(e,t){const{anchor:a,positionMethod:o="absolute",side:c="bottom",sideOffset:d=0,align:f="center",alignOffset:p=0,collisionBoundary:h,collisionPadding:b=5,sticky:y=!1,arrowPadding:v=5,disableAnchorTracking:w=!1,inline:j,keepMounted:S=!1,floatingRootContext:N,mounted:k,collisionAvoidance:T,shift:D,nodeId:C,adaptiveOrigin:A,lazyFlip:R=!1,externalTree:I}=e,[P,O]=x.useState(null);!k&&P!==null&&O(null);const _=T.side||"flip",L=T.align||"flip",H=T.fallbackAxisSide||"end",B=D?.crossAxis??!1,z=D?.rootBoundary,Q=typeof a=="function"?a:void 0,K=Ie(Q),X=Q?K:a,q=Xn(a),$=Xn(k),F=cf()==="rtl",G=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[c],W=f==="center"?G:`${G}-${f}`;let le=b;typeof le=="number"?le={top:le,right:le,bottom:le,left:le}:le&&(le={top:le.top||0,right:le.right||0,bottom:le.bottom||0,left:le.left||0});const M=1,U=c==="bottom"?M:0,Z=c==="top"?M:0,ae=c==="right"?M:0,ce=c==="left"?M:0,J={boundary:h==="clipping-ancestors"?"clippingAncestors":h,padding:le},ie=x.useRef(null),ge=Xn(d),ee=Xn(p),fe=typeof d!="function"?d:0,te=typeof p!="function"?p:0,Ce=[];j&&Ce.push(j),Ce.push(GH(nt=>{const Ot=JT(nt,c,F),Ft=typeof ge.current=="function"?ge.current(Ot):ge.current,Zn=typeof ee.current=="function"?ee.current(Ot):ee.current;return{mainAxis:Ft,crossAxis:Zn,alignmentAxis:Zn}},[fe,te,F,c]));const re=L==="none"&&_!=="shift",de=!re&&(y||B||_==="shift"),ke=_==="none"?null:XH({...J,padding:{top:le.top+M+U,right:le.right+M+ce,bottom:le.bottom+M+Z,left:le.left+M+ae},mainAxis:!B&&_==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Ee=re?null:KH({...J,rootBoundary:z,mainAxis:L!=="none",crossAxis:de,limiter:y||B?void 0:YH(nt=>{if(!ie.current)return{};const{width:Ot,height:Ft}=ie.current.getBoundingClientRect(),Zn=na(ta(nt.placement)),Un=Zn==="y"?Ot:Ft,Vn=Zn==="y"?le.left+le.right:le.top+le.bottom;return{offset:Un/2+Vn/2}})},[J,y,B,z,le,L]);_==="shift"||L==="shift"||f==="center"?Ce.push(Ee,ke):Ce.push(ke,Ee),Ce.push(QH({...J,apply({elements:{floating:nt},availableWidth:Ot,availableHeight:Ft,rects:Zn}){if(!$.current)return;const Un=nt.style;Un.setProperty(QT,`${Ot}px`),Un.setProperty(ZT,`${Ft}px`);const Vn=Sn(nt).devicePixelRatio||1,{x:Rn,y:Jt,width:ls,height:Tt}=Zn.reference,xt=(Math.round((Rn+ls)*Vn)-Math.round(Rn*Vn))/Vn,wt=(Math.round((Jt+Tt)*Vn)-Math.round(Jt*Vn))/Vn;Un.setProperty(HU,`${xt}px`),Un.setProperty(UU,`${wt}px`)}}),PU(nt=>({element:ie.current||$t(nt.elements.floating).createElement("div"),padding:ie.current?v:0,offsetParent:"floating"}),[v]),{name:"transformOrigin",fn(nt){const{elements:{floating:Ot},middlewareData:Ft,placement:Zn,platform:Un,rects:Vn,y:Rn}=nt,Jt=ta(Zn),ls=Sl(Zn),Tt=na(Jt)==="y",xt=ie.current,wt=typeof d=="function"?d(JT(nt,c,F)):d;let jt;if(!xt&&ls&&Math.abs(Tt?Ft.shift?.x||0:Ft.shift?.y||0)<=1)jt=ls==="start"===(Tt&&Un.isRTL?.(Ot)===!0)?"100%":"0%";else{const rr=Tt?Ft.arrow?.x||0:Ft.arrow?.y||0,Hr=Tt?xt?.clientWidth||0:xt?.clientHeight||0;jt=`${rr+Hr/2}px`}let Nr=Jt==="top"||Jt==="left"?`calc(100% + ${wt}px)`:`${-wt}px`;return de&&Tt&&Math.abs(Ft.shift?.y||0)>wt&&(Nr=`${Vn.reference.y+Vn.reference.height/2-Rn}px`),Ot.style.setProperty(VU,Tt?`${jt} ${Nr}`:`${Nr} ${jt}`),{}}},_U,A),De(()=>{!k&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,N]);const ve=x.useMemo(()=>({ancestorScroll:!w,elementResize:!w&&typeof ResizeObserver<"u",layoutShift:!w&&typeof IntersectionObserver<"u"}),[w]),{refs:he,elements:ye,x:je,y:xe,middlewareData:Te,update:Oe,placement:Ne,context:_e,isPositioned:Ye,floatingStyles:kt}=t({rootContext:N,open:S?k:void 0,placement:W,middleware:Ce,strategy:o,whileElementsMounted:S?void 0:(...nt)=>bT(...nt,ve),nodeId:C,externalTree:I}),{sideX:Ct,sideY:Rt}=Te.adaptiveOrigin||LU,ot=Ye?o:"fixed",qn=x.useMemo(()=>{let nt;return Ye?A?nt={position:ot,[Ct]:je,[Rt]:xe}:nt={...kt,position:ot}:nt={position:ot,top:0,left:0},nt[QT]="100vw",nt[ZT]="100vh",Ye||(nt.opacity=0),nt},[A,ot,Ct,je,Rt,xe,kt,Ye]),fs=x.useRef(null);De(()=>{if(!k)return;const nt=q.current,Ot=typeof nt=="function"?nt():nt,Zn=(eE(Ot)?Ot.current:Ot)||null||null;Zn!==fs.current&&(he.setPositionReference(Zn),fs.current=Zn)},[k,he,X,q]),x.useEffect(()=>{if(!k)return;const nt=q.current;typeof nt!="function"&&eE(nt)&&nt.current!==fs.current&&(he.setPositionReference(nt.current),fs.current=nt.current)},[k,he,X,q]),x.useEffect(()=>{if(S&&k&&ye.reference&&ye.floating)return bT(ye.reference,ye.floating,Oe,ve)},[S,k,ye,Oe,ve]);const Gn=ta(Ne),bs=WT(c,Gn,F),it=Sl(Ne)||"center",Vt=!!Te.hide?.referenceHidden;De(()=>{R&&k&&Ye&&Gn!==G&&O(Gn)},[R,k,Ye,Gn,G]);const Hn=x.useMemo(()=>({position:"absolute",top:Te.arrow?.y,left:Te.arrow?.x}),[Te.arrow]),tn=Te.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:qn,arrowStyles:Hn,arrowRef:ie,arrowUncentered:tn,side:bs,align:it,physicalSide:Gn,anchorHidden:Vt,refs:he,context:_e,isPositioned:Ye,update:Oe}),[qn,Hn,ie,tn,bs,it,Gn,Vt,he,_e,Ye,Oe])}function eE(e){return e!=null&&"current"in e}function uf(e){return e==="starting"?eH:fn}function wh(e,t,{styles:a,transitionStatus:o,props:c,refs:d,hidden:f,inert:p=!1}){const h={...a};return p&&(h.pointerEvents="none"),yt("div",e,{state:t,ref:d,props:[{role:"presentation",hidden:f,style:h},uf(o),c],stateAttributesMapping:$c})}const $U=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f="absolute",side:p="top",align:h="center",sideOffset:b=0,alignOffset:y=0,collisionBoundary:v="clipping-ancestors",collisionPadding:w=5,arrowPadding:j=5,sticky:S=!1,disableAnchorTracking:N=!1,collisionAvoidance:k=Q1,style:T,...D}=t,C=nf(),A=RU(),R=C.useState("open"),I=C.useState("mounted"),P=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),_=C.useState("floatingRootContext"),L=C.useState("instantType"),H=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),z=yh({anchor:d,positionMethod:f,floatingRootContext:_,mounted:I,side:p,sideOffset:b,align:h,alignOffset:y,collisionBoundary:v,collisionPadding:w,sticky:S,arrowPadding:j,disableAnchorTracking:N,keepMounted:A,collisionAvoidance:k,adaptiveOrigin:B}),Q=x.useMemo(()=>({open:R,side:z.side,align:z.align,anchorHidden:z.anchorHidden,instant:P!=="none"?"tracking-cursor":L}),[R,z.side,z.align,z.anchorHidden,P,L]),K=wh(t,Q,{styles:z.positionerStyles,transitionStatus:H,props:D,refs:[a,C.useStateSetter("positionerElement")],hidden:!I,inert:!R||P==="both"||O});return s.jsx(YT.Provider,{value:z,children:K})}),qU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{side:h,align:b}=XT(),y=p.useState("open"),v=p.useState("instantType"),w=p.useState("transitionStatus"),j=p.useState("popupProps"),S=p.useState("floatingRootContext"),N=p.useState("disabled"),k=p.useState("closeDelay");ra({open:y,ref:p.context.popupRef,onComplete(){y&&p.context.onOpenChangeComplete?.(!0)}}),LT(S,{enabled:!N,closeDelay:k});const T=p.useStateSetter("popupElement");return yt("div",t,{state:{open:y,side:h,align:b,instant:v,transitionStatus:w},ref:[a,p.context.popupRef,T],props:[lf,j,uf(w),f],stateAttributesMapping:qv})}),GU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{arrowRef:h,side:b,align:y,arrowUncentered:v,arrowStyles:w}=XT(),j=p.useState("open"),S=p.useState("instantType");return yt("div",t,{state:{open:j,side:b,align:y,uncentered:v,instant:S},ref:[a,h],props:[{style:w,"aria-hidden":!0},f],stateAttributesMapping:$c})}),KU=function(t){const{delay:a,closeDelay:o,timeout:c=400}=t,d=x.useMemo(()=>({open:a,close:o}),[a,o]);return s.jsx($T.Provider,{value:a,children:s.jsx(Y4,{delay:d,timeoutMs:c,children:t.children})})};function jh(e){return Iv(19)?e:e?"true":void 0}function YU(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function XU(e){return s.jsx(KU,{"data-slot":"tooltip-provider",...e})}function Ii(e){return s.jsx(NU,{"data-slot":"tooltip",...e})}function Pi(e){return s.jsx(AU,{"data-slot":"tooltip-trigger",...e})}function _i({className:e,sideOffset:t=8,side:a="top",children:o,...c}){return s.jsx(MU,{children:s.jsx($U,{sideOffset:t,side:a,className:"z-[35]",children:s.jsx(qU,{"data-slot":"tooltip-content",className:Ue("max-w-[288px] rounded-md bg-primary px-2.5 py-2 text-[11.5px] leading-[1.55] text-primary-on shadow-3","break-words outline-none","transition-[opacity,transform] duration-150 ease-out","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:o})})})}function QU({className:e,...t}){return s.jsx(GU,{className:Ue("size-2 rotate-45 rounded-[1px] bg-primary","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1",e),...t})}const tE=x.createContext(void 0);function nu(e){const t=x.useContext(tE);if(!e&&t===void 0)throw new Error(on(27));return t}const nE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,forceRender:f=!1,...p}=t,h=nu(),b=h.useState("open"),y=h.useState("nested"),v=h.useState("mounted"),w=h.useState("transitionStatus");return yt("div",t,{state:{open:b,transitionStatus:w},ref:[h.context.backdropRef,a],stateAttributesMapping:qv,props:[{role:"presentation",hidden:!v,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:f||!y})}),sE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,...h}=t,b=nu(),y=b.useState("open"),{getButtonProps:v,buttonRef:w}=Jr({disabled:f,native:p}),j={disabled:f};function S(N){y&&b.setOpen(!1,Fe(oy,N.nativeEvent))}return yt("button",t,{state:j,ref:[a,w],props:[{onClick:S},h,v]})}),rE=x.createContext(void 0);function ZU(){const e=x.useContext(rE);if(e===void 0)throw new Error(on(26));return e}const Uy="ArrowUp",Vy="ArrowDown",Fy="ArrowLeft",$y="ArrowRight",qy="Home",Gy="End",Sh=new Set([Uy,Vy,Fy,$y,qy,Gy]),aE="Shift",WU=[aE,"Control","Alt","Meta"];function JU(e){return dn(e)&&e.tagName==="INPUT"}function lE(e){return!!(JU(e)&&e.selectionStart!=null||dn(e)&&e.tagName==="TEXTAREA")}function oE(e,t,a,o){if(!e||!t||!t.scrollTo)return;let c=e.scrollLeft,d=e.scrollTop;const f=e.clientWidthe.scrollLeft+e.clientWidth-b.scrollPaddingRight?c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight:h-y.scrollMarginLefte.scrollLeft+e.clientWidth-b.scrollPaddingRight&&(c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight))}if(p&&o!=="horizontal"){const h=iE(e,t,"top"),b=Nh(e),y=Nh(t);h-y.scrollMarginTope.scrollTop+e.clientHeight-b.scrollPaddingBottom&&(d=h+t.offsetHeight+y.scrollMarginBottom-e.clientHeight+b.scrollPaddingBottom)}e.scrollTo({left:c,top:d,behavior:"auto"})}function iE(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let c=0;for(;t.offsetParent&&(c+=t[o],t.offsetParent!==e);)t=t.offsetParent;return c}function Nh(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const eV="--nested-dialogs",tV="data-nested-dialog-open",nV={...$c,...oo,nestedDialogOpen(e){return e?{[tV]:""}:null}},cE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,initialFocus:p,...h}=t,b=nu(),y=b.useState("descriptionElementId"),v=b.useState("disablePointerDismissal"),w=b.useState("floatingRootContext"),j=b.useState("popupProps"),S=b.useState("modal"),N=b.useState("mounted"),k=b.useState("nested"),T=b.useState("nestedOpenDialogCount"),D=b.useState("open"),C=b.useState("openMethod"),A=b.useState("titleElementId"),R=b.useState("transitionStatus"),I=b.useState("role"),P=w.useState("floatingId");ZU(),ra({open:D,ref:b.context.popupRef,onComplete(){D&&b.context.onOpenChangeComplete?.(!0)}});const O=p===void 0?TT(b.context.popupRef):p,_=T>0,L=b.useStateSetter("popupElement"),B=yt("div",t,{state:{open:D,nested:k,transitionStatus:R,nestedDialogOpen:_},props:[j,{id:P,"aria-labelledby":A,"aria-describedby":y,role:I,...lf,hidden:!N,onKeyDown(z){Sh.has(z.key)&&z.stopPropagation()},style:{[eV]:T}},h],ref:[a,b.context.popupRef,L],stateAttributesMapping:nV});return s.jsx(oh,{context:w,openInteractionType:C,disabled:!N,closeOnFocusOut:!v,initialFocus:O,returnFocus:f,modal:S!==!1,restoreFocus:"popup",children:B})}),kh=x.forwardRef(function(t,a){const{cutout:o,...c}=t;let d;if(o){const f=o.getBoundingClientRect();d=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${f.left}px ${f.top}px,${f.left}px ${f.bottom}px,${f.right}px ${f.bottom}px,${f.right}px ${f.top}px,${f.left}px ${f.top}px)`}return s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...c,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:d}})}),uE=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=nu(),f=d.useState("mounted"),p=d.useState("modal"),h=d.useState("open");return f||o?s.jsx(rE.Provider,{value:o,children:s.jsxs(lh,{ref:a,...c,children:[f&&p===!0&&s.jsx(kh,{ref:d.context.internalBackdropRef,inert:jh(!h)}),t.children]})}):null});let dE={},fE={},pE="";function Ch(e,t){return Fd(e)?e:t}function mE(e,t,a){return/hidden|clip/.test(e.getComputedStyle(Ch(t,a)).overflowY)}function sV(e){if(typeof document>"u")return!1;const t=$t(e);return Sn(t).innerWidth-t.documentElement.clientWidth>0}function rV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=$t(e),o=a.documentElement,c=a.body,d=Ch(o,c),f=d.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",d.style.overflowY="scroll";const h=d.offsetWidth;d.style.overflowY="hidden";const b=d.offsetWidth;return d.style.overflowY=f,o.style.scrollbarGutter=p,h===b}function aV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Ch(a,o),d={overflowY:c.style.overflowY,overflowX:c.style.overflowX};return Object.assign(c.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(c.style,d)}}function lV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Sn(a);let d=0,f=0,p=!1;const h=qa.create();if(yl&&(c.visualViewport?.scale??1)!==1)return()=>{};function b(){const j=c.getComputedStyle(a),S=c.getComputedStyle(o),T=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";d=a.scrollTop,f=a.scrollLeft,dE={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},pE=a.style.scrollBehavior,fE={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const D=a.scrollHeight>a.clientHeight,C=a.scrollWidth>a.clientWidth,A=j.overflowY==="scroll"||S.overflowY==="scroll",R=j.overflowX==="scroll"||S.overflowX==="scroll",I=Math.max(0,c.innerWidth-o.clientWidth),P=Math.max(0,c.innerHeight-o.clientHeight),O=parseFloat(S.marginTop)+parseFloat(S.marginBottom),_=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Ch(a,o);if(p=rV(e),p){a.style.scrollbarGutter=T,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(D||A)&&(a.style.overflowY="scroll"),(C||R)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:O||P?`calc(100dvh - ${O+P}px)`:"100dvh",width:_||I?`calc(100vw - ${_+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=d,o.scrollLeft=f,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,dE),Object.assign(o.style,fE),p||(a.scrollTop=d,a.scrollLeft=f,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=pE)}function v(){y(),h.request(b)}b();const w=St(c,"resize",v);return()=>{h.cancel(),y(),typeof c.removeEventListener=="function"&&w()}}class oV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",sa.create());ln(this,"timeoutUnlock",sa.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const a=$t(t),o=a.documentElement,c=a.body,d=Sn(o);if(mE(d,o,c)){const p=new d.MutationObserver(()=>{mE(d,o,c)||(p.disconnect(),this.restore=null,this.lock(t))}),h={attributes:!0};p.observe(o,h),p.observe(c,h),this.restore=()=>p.disconnect();return}const f=Yd||!sV(t);this.restore=f?aV(t):lV(t)}}const iV=new oV;function hE(e=!0,t=null){De(()=>{if(e)return iV.acquire(t)},[e,t])}function cV({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[h,b]=x.useState(0),[y,v]=x.useState(0),w=h===0,j=af(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0)return!1;if("touches"in S){if(S.type==="touchend"){if(S.changedTouches.length!==1||S.touches.length!==0)return!1}else if(S.touches.length!==1)return!1}const N=cs(S);if(w&&!c){if(d){const k=e.context.internalBackdropRef.current,T=e.context.backdropRef.current;return k||T?k===N||T===N||Qe(N,f)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:w});return hE(o&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(S,N)=>{b(S),v(N)}),De(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(h+1,y+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[a,o,h,y,t]),Dy(e,{activeTriggerProps:j.reference,inactiveTriggerProps:j.trigger,popupProps:j.floating,nestedOpenDialogCount:h,nestedOpenDrawerCount:y}),null}const uV={..._y,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class dV extends tu{constructor(a,o,c){const d=new fh,f=fV(a,d,o,c);super(f,pV(d),uV);ln(this,"setOpen",(a,o)=>{o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(a,o),this.update(Ry(this.state,a,o.trigger)))})}}function fV(e,t,a,o=!1){return{...Iy(t,a,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function pV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gE(e,t){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,disablePointerDismissal:p=!1,modal:h=!0,actionsRef:b,handle:y,triggerId:v,defaultTriggerId:w=null}=t,j=e==="drawer",S=e==="alert-dialog",N=S?!0:h,k=S||p,T=S?"alertdialog":"dialog",D=nu(!0),C=D!=null,A={modal:N,disablePointerDismissal:k,nested:C,role:T},R=Ey((H,B)=>new dV({open:c,openProp:o,activeTriggerId:w,triggerIdProp:v,...A},H,B),!0);R.useControlledProp("openProp",o),R.useControlledProp("triggerIdProp",v),R.useSyncedValues(A),R.useContextCallback("onOpenChange",d),R.useContextCallback("onOpenChangeComplete",f);const I=R.useState("open"),P=R.useState("mounted"),O=R.useState("payload");OT(R,I),Oy(R);const{forceUnmount:_}=My(I,R);x.useImperativeHandle(b,()=>({unmount:_,close:()=>R.setOpen(!1,Fe(cy))}),[_,R]);const L=I||P;return s.jsxs(tE.Provider,{value:R,children:[y&&s.jsx(Ay,{handle:y,store:R}),L&&s.jsx(cV,{store:R,parentContext:D?.context,isDrawer:j}),typeof a=="function"?a({payload:O}):a]})}const mV=sh(function(t){return gE("dialog",t)}),xE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,id:f,...p}=t,h=nu(),b=Na(f);return h.useSyncedValueWithCleanup("titleElementId",b),yt("h2",t,{ref:a,props:[{id:b},p]})});function hV(e){const t=x.useRef(""),a=x.useCallback(c=>{c.defaultPrevented||(t.current=c.pointerType,e(c,c.pointerType))},[e]);return{onClick:x.useCallback(c=>{if(c.detail===0){e(c,"keyboard");return}"pointerType"in c?e(c,c.pointerType):e(c,t.current),t.current=""},[e]),onPointerDown:a}}function bE(e,t){const a=Ie((d,f)=>{(typeof e=="function"?e():e)||t(f||(Yd?"touch":""))}),{onClick:o,onPointerDown:c}=hV(a);return x.useMemo(()=>({onClick:o,onPointerDown:c}),[o,c])}function vE(e){const[t,a]=x.useState(null),o=bE(e,a);return aa(e,c=>{c&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Qt(e){return s.jsx(mV,{"data-slot":"dialog",...e})}function gV(e){return s.jsx(uE,{"data-slot":"dialog-portal",...e})}const Gt=e=>s.jsx(xE,{"data-slot":"dialog-title",...e});function xV({className:e,...t}){return s.jsx(nE,{"data-slot":"dialog-overlay",className:Ue("fixed inset-0 isolate z-30 bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function Zt({className:e,children:t,showCloseButton:a=!0,keepMounted:o=!1,overlayForceRender:c=!1,...d}){return s.jsxs(gV,{keepMounted:o,children:[s.jsx(xV,{forceRender:c}),s.jsxs(cE,{"data-slot":"dialog-content",className:Ue("fixed top-1/2 left-1/2 z-30 flex max-h-[calc(100vh-48px)] w-[min(620px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...d,children:[t,a&&s.jsxs(sE,{"data-slot":"dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function Kt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px] pr-10","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function Bt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function zn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-section",className:Ue("flex flex-col gap-2.5 rounded-md border border-border bg-surface-inset p-3.5","[&_h3]:text-[12.5px] [&_h3]:font-semibold","[&_p]:text-xs [&_p]:leading-[1.65] [&_p]:text-subtle",e),...t})}function bV(e){return gE("alert-dialog",e)}const vV=bV,yV=uE,wV=e=>s.jsx(xE,{"data-slot":"alert-dialog-title",...e});function jV({className:e,...t}){return s.jsx(nE,{"data-slot":"alert-dialog-overlay",className:Ue("fixed inset-0 isolate z-[38] bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function SV({className:e,children:t,showCloseButton:a=!1,...o}){return s.jsxs(yV,{children:[s.jsx(jV,{}),s.jsxs(cE,{"data-slot":"alert-dialog-content",className:Ue("fixed top-1/2 left-1/2 z-[38] flex max-h-[calc(100vh-48px)] w-[min(440px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...o,children:[t,a&&s.jsxs(sE,{"data-slot":"alert-dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function NV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px]","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function kV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function CV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function TV({className:e,tone:t="danger",...a}){return s.jsx("div",{"data-slot":"alert-dialog-banner","data-tone":t,className:Ue("rounded-md border px-3.5 py-3 text-xs leading-[1.65] text-subtle","[&_strong]:font-semibold",t==="danger"?"border-destructive-bd bg-destructive-soft [&_strong]:text-destructive":"border-border bg-surface-inset [&_strong]:text-foreground",e),...a})}function Ky({className:e,containerClassName:t,...a}){return s.jsx("div",{"data-slot":"table-container",className:Ue("relative w-full overflow-auto",t),children:s.jsx("table",{"data-slot":"table",className:Ue("w-full caption-bottom border-collapse text-[12.5px]",e),...a})})}function yE({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:Ue(e),...t})}function Yy({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:Ue(e),...t})}function kl({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:Ue("transition-colors duration-100 hover:[&>td]:bg-control-hover",e),...t})}function wE({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:Ue("sticky top-0 z-[2] whitespace-nowrap border-b border-border bg-surface-2 px-3.5 py-2","text-left text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground",e),...t})}function Nn({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:Ue("border-b border-hairline px-3.5 py-2 align-middle",e),...t})}const EV="data-checked",AV="data-unchecked",Xy={checked(e){return e?{[EV]:""}:{[AV]:""}},...oo,...wi},Qy="data-composite-item-active",jE=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function RV(){return x.useContext(jE)}function Zy(e={}){const{guess:t,label:a,metadata:o,textRef:c,index:d}=e,{register:f,unregister:p,subscribeMapChange:h,nextIndexRef:b}=RV(),y=x.useRef(-1),[v,w]=x.useState(d==null&&t?()=>{if(y.current===-1){const k=b.current;b.current+=1,y.current=k}return y.current}:-1),j=d??v,S=x.useRef(null),N=x.useCallback(k=>{const T=S.current;T&&p(T),S.current=k,k&&f(k,{metadata:o??null,index:d??null,label:a,textRef:c})},[d,f,p,o,a,c]);return De(()=>{if(d==null)return h(k=>{const T=S.current?k.get(S.current)?.index:null;T!=null&&w(T)})},[d,h]),{ref:N,index:j}}function OV(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=vC(),{ref:c,index:d}=Zy(e),f=a===d,p=x.useRef(null),h=ea(c,p);return{compositeProps:{tabIndex:f?0:-1,onFocus(){o(d)},onMouseMove(){const y=p.current;if(!t||!y)return;const v=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!v&&y.focus()}},compositeRef:h,index:d}}function SE(e){const{render:t,className:a,style:o,state:c=fn,props:d=Or,refs:f=Or,metadata:p,stateAttributesMapping:h,tag:b="div",...y}=e,{compositeProps:v,compositeRef:w}=OV({metadata:p});return yt(b,e,{state:c,ref:[w,...f],props:[v,...d,y],stateAttributesMapping:h})}const NE=x.createContext(void 0);function MV(){return x.useContext(NE)}function Th(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const kE=x.createContext(void 0);function DV(){const e=x.useContext(kE);if(e===void 0)throw new Error(on(52));return e}const CE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,readOnly:f=!1,required:p=!1,"aria-labelledby":h,value:b,inputRef:y,nativeButton:v=!1,id:w,style:j,...S}=t,N=MV(),{disabled:k,readOnly:T,required:D,form:C,checkedValue:A,touched:R=!1,validation:I,name:P,setCheckedValue:O=qt,setTouched:_=qt,registerInputRef:L=qt}=N??{},{setTouched:H,setFilled:B,state:z,disabled:Q}=Sa(),K=y1(),{labelId:X,getDescriptionProps:q}=vl(),$=Q||K.disabled||k||d,Y=T||f,F=D||p,G=C,W=N?A===b:b==="",le=x.useRef(null),M=x.useRef(null),U=I?.registerInput,Z=x.useCallback(ye=>U?.(ye,{controlRef:le,value:void 0}),[U]),ae=ea(y,M,L,Z);De(()=>{M.current?.checked&&B(!0)},[B]),De(()=>{if(M.current){if($&&W){L(null);return}L(M.current)}},[W,$,L]);const ce=Na(),J=lo({id:w}),ie=v?void 0:J,ge=Bv(h,X,M,!v,ie),ee={role:"radio","aria-checked":W,"aria-labelledby":ge,[Qy]:W?"":void 0,id:v?J:ce,onKeyDown(ye){ye.key==="Enter"&&ye.preventDefault()},onClick(ye){if(ye.defaultPrevented||$||Y)return;ye.preventDefault();const je=M.current;je&&Uc(je,ye)},onFocus(ye){ye.defaultPrevented||$||Y||!R||(M.current?.click(),_(!1))}},{getButtonProps:fe,buttonRef:te}=Jr({disabled:$,native:v,composite:!1}),Ce={type:"radio",ref:ae,form:G,id:ie,name:P,tabIndex:-1,style:P?Zc:Ai,"aria-hidden":!0,...b!==void 0?{value:Th(b)}:fn,disabled:$,checked:W,required:F,readOnly:Y,onChange(ye){if(ye.nativeEvent.defaultPrevented||$||Y||b===void 0)return;const je=Fe(Yn,ye.nativeEvent);O(b,je),!je.isCanceled&&H(!0)},onClick(ye){ye.stopPropagation()},onFocus(){le.current?.focus()}},re=x.useMemo(()=>({...z,required:F,disabled:$,readOnly:Y,checked:W}),[z,$,Y,W,F]),de=re,ke=N!==void 0,Ee=[a,le,te],ve=[ee,S,fe,q,I?ye=>I.getValidationProps($,ye):fn],he=yt("span",t,{enabled:!ke,state:re,ref:Ee,props:ve,stateAttributesMapping:Xy});return s.jsxs(kE.Provider,{value:de,children:[ke?s.jsx(SE,{tag:"span",render:o,className:c,style:j,state:re,refs:Ee,props:ve,stateAttributesMapping:Xy}):he,s.jsx("input",{...Ce,suppressHydrationWarning:!0})]})}),IV=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=DV(),b=h.checked,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j={...h,transitionStatus:v},S=x.useRef(null),N=f||y,k=yt("span",t,{ref:[a,S],state:j,props:p,stateAttributesMapping:Xy});return ra({batch:!0,enabled:!b,open:b,ref:S,onComplete(){b||w(!1)}}),N?k:null});function Wy(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:c}=e,d=Ie(c),[,f]=x.useState(!1),p=Ds(_V).current,h=Ds(PV).current,b=x.useRef(0),y=x.useRef(!0),v=x.useRef(null),w=x.useRef(null),j=Ie(()=>{y.current||(y.current=!0,f(R=>!R))}),S=Ie((R,I)=>{h.set(R,I),j()}),N=Ie(R=>{h.delete(R),j()}),k=Ie(R=>{const I=new Map;return a.current.length=0,o&&(o.current.length=0),R.forEach(P=>{I.set(P.element,{...P.registration.metadata??{},index:P.index}),a.current[P.index]=P.element,o&&(o.current[P.index]=P.registration.label!==void 0?P.registration.label:P.registration.textRef?.current?.textContent??P.element.textContent)}),b.current=a.current.length,I});function T(R){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!="function"||R.length<2)return;const I=new MutationObserver(O=>{if(!BV(O))return;let _=null;for(const L of R)if(L.isConnected){if(_&&TE(_,L)>0){I.disconnect(),j();return}_=L}});w.current=I;const P=new Set;for(let O=1;OI.observe(O,{childList:!0}))}const D=Ie(()=>{const[R,I]=LV(h),P=k(R),O=v.current,_=!O||O.length!==R.length||R.some((L,H)=>{const B=O[H];return L.index!==B.index||L.element!==B.element||L.registration.index!==B.registration.index||L.registration.metadata!==B.registration.metadata});T(I),v.current=R,y.current=!1,_&&(p.forEach(L=>L(P)),d(P))});De(()=>(!y.current&&v.current&&k(v.current),()=>{a.current=[],o&&(o.current=[])}),[a,o,k]),De(()=>{y.current&&D()}),De(()=>()=>{w.current?.disconnect(),y.current=!0},[]);const C=Ie(R=>(p.add(R),()=>{p.delete(R)})),A=x.useMemo(()=>({register:S,unregister:N,subscribeMapChange:C,nextIndexRef:b}),[S,N,C,b]);return s.jsx(jE.Provider,{value:A,children:t})}function PV(){return new Map}function _V(){return new Set}function LV(e){const t=new Set,a=[],o=[];e.forEach((d,f)=>{if(!f.isConnected)return;const p=d.index,h={index:p??-1,element:f,registration:d};p===null?o.push(h):p>=0&&(t.add(p),a.push(h))});let c=0;return o.sort((d,f)=>TE(d.element,f.element)),o.forEach(d=>{for(;t.has(c);)c+=1;d.index=c,a.push(d),c+=1}),t.size>0&&a.sort((d,f)=>d.index-f.index),[a,o.map(d=>d.element)]}function zV(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function BV(e){for(const t of e)for(let a=0;a{if(A.current=D.current[H]??null,(p??S)(H),B){const z=D.current[H];oE(k.current,z,d,a)}}),P=Ie(H=>{if(H.size===0)return;if(C.current){const K=D.current,X=K.indexOf(A.current);if(X===-1){const q=K[R];!q||po(K,R,v)?I(UV(K,v)):A.current=q}else X!==R&&I(X);return}C.current=!0;const B=Array.from(H.keys()),z=B.find(K=>K?.hasAttribute(Qy))??null,Q=z?H.get(z)?.index??-1:-1;if(Q!==-1)I(Q);else if(po(B,R,v)){const K=Is(B,{disabledIndices:v});fo(B,K)||I(K)}oE(k.current,z,d,a)});De(()=>{if(v==null||f!=null||!C.current)return;const H=D.current;if(po(H,R,v)){const B=Is(H,{disabledIndices:v});fo(H,B)||I(B)}},[v,f,R,D,I]);const O=Ie((H,B,z)=>c?c(H,B,z,D):z),_=Ie(H=>{const B=H.key===qy||H.key===Gy;if(!Sh.has(H.key)||!b&&B||VV(H,w)||!k.current)return;const Q=d==="rtl",K=Q?Fy:$y,X=Q?$y:Fy,q=a==="vertical"?Vy:K,$=a==="vertical"?Uy:X,Y=cs(H.nativeEvent);if(Y!=null&&lE(Y)&&!EE(Y)){const U=Y.selectionStart,Z=Y.selectionEnd,ae=Y.value;if(U==null||H.shiftKey||U!==Z||H.key!==$&&U0)return}let F=R;const G=Qm(D,v),W=ey(D,v);o!=null&&(F=o({disabledIndices:v,elementsRef:D,event:H,highlightedIndex:R,loopFocus:t,maxIndex:W,minIndex:G,onLoop:O,orientation:a,rtl:Q}));const le=a!=="vertical"&&H.key===K||a!=="horizontal"&&H.key===Vy,M=a!=="vertical"&&H.key===X||a!=="horizontal"&&H.key===Uy;b&&(H.key===qy?F=G:H.key===Gy&&(F=W)),F===R&&(le||M)&&(t&&F===W&&le?(F=G,c&&(F=c(H,R,F,D))):t&&F===G&&M?(F=W,c&&(F=c(H,R,F,D))):F=Is(D.current,{startingIndex:F,decrement:M,disabledIndices:v})),F!==R&&!fo(D.current,F)&&(y&&H.stopPropagation(),(N||B||le||M)&&H.preventDefault(),I(F,!0),queueMicrotask(()=>{D.current[F]?.focus()}))});return{props:{ref:T,onFocus(H){const B=k.current,z=cs(H.nativeEvent);!B||z==null||!lE(z)||z.setSelectionRange(0,z.value.length)},onKeyDown:_},highlightedIndex:R,onHighlightedIndexChange:I,elementsRef:D,onMapChange:P,relayKeyboardEvent:_}}function UV(e,t){let a=-1;for(let o=0;o({highlightedIndex:_,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:z}),[_,L,A,z]);return s.jsx(bC.Provider,{value:K,children:s.jsx(Wy,{elementsRef:H,onMapChange:X=>{N?.(X),B(X)},children:Q})})}const $V=[aE],AE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d,readOnly:f,required:p,onValueChange:h,value:b,defaultValue:y,form:v,name:w,inputRef:j,id:S,style:N,...k}=t,{setTouched:T,setFocused:D,validationMode:C,name:A,disabled:R,state:I,validation:P,setDirty:O,setFilled:_,validityData:L}=Sa(),{labelId:H}=vl(),{clearErrors:B,elementRef:z}=Fc(),Q=cB(!0),K=R||d,X=A??w,q=Na(S),[$,Y]=Ga({controlled:b,default:y,name:"RadioGroup",state:"value"}),[F,G]=x.useState(!1),W=Ie((te,Ce)=>{h?.(te,Ce),!Ce.isCanceled&&Y(te)}),le=P.getInputControl,M=x.useMemo(()=>({get current(){return le()}}),[le]),U=x.useRef(null),Z=x.useRef(null);function ae(te){let Ce;return j&&(typeof j=="function"?Ce=j(te):j.current=te),U.current=te,Ce}const ce=Ie(te=>{if(!te||te.disabled)return;Z.current||(Z.current=te);const Ce=U.current,re=te.checked||Ce==null||Ce.disabled?ae(te):void 0;return()=>{Z.current===te&&(Z.current=null),U.current===te?re?(re(),U.current=null):ae(null):re?.()}}),J=Ie(()=>{const te=z.current;if(!te)return $??null;for(const Ce of P.registeredInputs.keys())if(Ce.checked&&n4(Ce,te))return $??null;return null});Yc(M,q,$??null,J,!K,w),aa($,()=>{B(X),O($!==L.initialValue),_($!=null),P.change($);const te=Z.current;$==null&&te&&!te.disabled&&ae(te)});const ie=H??Q?.legendId,ge={...I,disabled:K??!1,required:p??!1,readOnly:f??!1},ee=x.useMemo(()=>({checkedValue:$,disabled:K,form:v,validation:P,name:X,readOnly:f,registerInputRef:ce,required:p,setCheckedValue:W,setTouched:G,touched:F}),[$,K,v,P,X,f,ce,p,W,G,F]),fe={id:S,role:"radiogroup","aria-required":p||void 0,"aria-disabled":K||void 0,"aria-readonly":f||void 0,"aria-labelledby":ie,onFocus(){D(!0)},onBlur(te){Qe(te.currentTarget,te.relatedTarget)||(T(!0),D(!1),C==="onBlur"&&P.commit($))},onKeyDownCapture(te){te.key.startsWith("Arrow")&&(G(!0),D(!0))}};return s.jsx(NE.Provider,{value:ee,children:s.jsx(FV,{render:o,className:c,style:N,state:ge,props:[fe,k,te=>P.getValidationProps(K??!1,te)],refs:[a],stateAttributesMapping:wi,enableHomeAndEndKeys:!1,modifierKeys:$V})})});function Eh({className:e,...t}){return s.jsx(AE,{"data-slot":"radio-group",className:Ue("flex flex-col gap-2",e),...t})}function bo({className:e,...t}){return s.jsx(CE,{"data-slot":"radio-group-item",className:Ue("relative inline-flex size-3.5 flex-none cursor-pointer items-center justify-center rounded-full border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(IV,{"data-slot":"radio-group-indicator",className:"grid place-content-center data-unchecked:hidden",children:s.jsx("span",{className:"block size-[5px] rounded-full bg-primary-foreground"})})})}function RE(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const OE=x.createContext(void 0),ME=x.createContext(void 0),DE=x.createContext(void 0);function vo(){const e=x.useContext(OE);if(e===void 0)throw new Error(on(60));return e}function Jy(){const e=x.useContext(ME);if(e===void 0)throw new Error(on(101));return e}function IE(){const e=x.useContext(DE);if(e===void 0)throw new Error(on(61));return e}function qV(e,t,a=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let c=0;cObject.is(e,t);function la(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function PE(e,t,a){return Array.isArray(e)&&Array.isArray(t)?!qV(e,t,(o,c)=>la(o,c,a)):e!==t}function Rh(e,t,a){return e?e.some(o=>o===void 0?!1:la(t,o,a)):!1}function su(e,t,a){return e?e.findIndex(o=>o===void 0?!1:la(o,t,a)):-1}function GV(e,t){if(t!==Ah)return o=>Rh(e,o,t);const a=new Set(e);return a.delete(void 0),o=>a.has(o)&&(o!==0||e.some(c=>Object.is(o,c)))}function df(e,t,a,o){const c=o&&Array.isArray(t)?e.findIndex(GV(t,a)):su(e,t,a);return c===-1?null:c}function _E(e,t,a,o,c,d){return Rh(o,t,c)?d!=null&&e>d&&Rh(o,a[d],c)?d:e:e===d?df(a,o,c,!0):d}function LE(e,t,a){return e.filter(o=>!la(t,o,a))}function KV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function ew(e){return KV(e?.[0])}function Oh(e){return ew(e)?e.flatMap(t=>t.items):e}function zE(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(ew(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function yo(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Th(e)}function ka(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Th(e.value):Th(e)}function BE(e,t,a){function o(){return yo(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const d=Oh(t);if(e==null||typeof e!="object"){const f=d.find(p=>p.value===e);return f&&f.label!=null?f.label:o()}if("value"in e){const f=d.find(p=>p&&p.value===e.value);if(f&&f.label!=null)return f.label}}return o()}function YV(e,t,a){return e.reduce((o,c,d)=>(d>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:BE(c,t,a)},d)),o),[])}const XV={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:ka(t,o)!==""},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(c=>la(t,c,a)):la(t,o,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Cl=1;function HE(e,t){return Math.max(0,e-t)}function QV(e,t){if(t<=0)return 0;const a=Ri(e,0,t),o=a,c=t-a,d=o<=Cl,f=c<=Cl;return d&&f?o<=c?0:t:d?0:f?t:a}function ZV(e){const{id:t,value:a,defaultValue:o=null,onValueChange:c,open:d,defaultOpen:f=!1,onOpenChange:p,name:h,form:b,autoComplete:y,disabled:v=!1,readOnly:w=!1,required:j=!1,modal:S=!0,actionsRef:N,inputRef:k,onOpenChangeComplete:T,items:D,multiple:C=!1,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I=Ah,highlightItemOnHover:P=!0,children:O}=e,{clearErrors:_}=Fc(),{setDirty:L,setTouched:H,setFocused:B,validityData:z,setFilled:Q,name:K,disabled:X,validation:q,validationMode:$}=Sa(),Y=lo({id:t}),F=X||v,G=K??h,[W,le]=Ga({controlled:a,default:C?o??Or:o,name:"Select",state:"value"}),[M,U]=Ga({controlled:d,default:f,name:"Select",state:"open"}),Z=x.useRef([]),ae=x.useRef([]),ce=x.useRef(null),J=x.useRef(null),ie=x.useRef(0),ge=x.useRef(null),ee=x.useRef([]),fe=x.useRef(!1),te=x.useRef(null),Ce=x.useRef(null),re=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=x.useRef(!1),ke=x.useRef(W),{mounted:Ee,setMounted:ve,transitionStatus:he}=ki(M),{openMethod:ye,triggerProps:je}=vE(M),xe=Ds(()=>new tu({id:Y,labelId:void 0,modal:S,multiple:C,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,value:W,open:M,mounted:Ee,transitionStatus:he,items:D,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:fn,triggerProps:fn,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qt,setOpen:qt,handleScrollArrowVisibility:qt,onOpenChangeComplete:qt,listRef:Z,popupRef:ce,scrollHandlerRef:J,scrollArrowsMountedCountRef:ie,valueRef:ge,valuesRef:ee,labelsRef:ae,typingRef:fe,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:Ce,alignItemWithTriggerActiveRef:de,initialValueRef:ke},XV)).current,Te=xe.useState("activeIndex"),Oe=xe.useState("selectedIndex"),Ne=xe.useState("triggerElement"),_e=xe.useState("positionerElement"),Ye=YU(ye),kt=ye??Ye,Ct=x.useMemo(()=>C?"":ka(W,R),[C,W,R]),Rt=x.useMemo(()=>C&&Array.isArray(W)?W.map(xt=>ka(xt,R)):ka(W,R),[C,W,R]),ot=Xn(Ne),qn=Ie(()=>Rt);Yc(ot,Y,W,qn,!F,h);const fs=C?Array.isArray(W)&&W.length>0:W!=null&&Ct!=="";De(()=>{Q(fs)},[fs,Q]),De(function(){const wt=df(ee.current,W,I,C);wt===null&&(Ce.current=null),!M&&xe.set("selectedIndex",wt)},[C,M,W,I,xe]),aa(W,()=>{_(G),L(PE(W,z.initialValue,I)),q.change(W)});const Gn=Ie((xt,wt)=>{p?.(xt,wt),!wt.isCanceled&&(U(xt),!xt&&(wt.reason===ho||wt.reason===nh)&&(H(!0),B(!1),$==="onBlur"&&q.commit(W)))}),bs=Ie(()=>{ve(!1),xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),T?.(!1)});ra({enabled:!N,open:M,ref:ce,onComplete(){M||bs()}}),x.useImperativeHandle(N,()=>({unmount:bs}),[bs]);const it=Ie((xt,wt)=>{c?.(xt,wt),!wt.isCanceled&&le(xt)}),Vt=Ie(xt=>{const wt=HE(xt.scrollHeight,xt.clientHeight),jt=QV(xt.scrollTop,wt),Nr=jt>0,rr=jtEE(Z.current[xt]),onMatch(xt){M?xe.set("activeIndex",xt):it(ee.current[xt],Fe(Yn))},onTyping(xt){fe.current=xt}}),Zn=x.useMemo(()=>Wr(Ft.reference,Ot.reference,nt.reference,tn.reference,je),[tn.reference,Ft.reference,Ot.reference,nt.reference,je]),Un=x.useMemo(()=>Wr(lf,Ft.floating,Ot.floating,nt.floating),[Ft.floating,Ot.floating,nt.floating]),Vn=Ot.item??fn;xe.useContextCallback("setValue",it),xe.useContextCallback("setOpen",Gn),xe.useContextCallback("handleScrollArrowVisibility",Vt),xe.useContextCallback("onOpenChangeComplete",T),RE(()=>{xe.update({popupProps:Un,triggerProps:Zn})}),xe.useSyncedValues({id:Y,modal:S,multiple:C,value:W,open:M,mounted:Ee,transitionStatus:he,popupProps:Un,triggerProps:Zn,items:D,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,openMethod:kt});const Rn=x.useMemo(()=>({disabled:F,readOnly:w,required:j,multiple:C,highlightItemOnHover:P,itemProps:Vn}),[F,w,j,C,P,Vn]),Jt=ea(k,q.inputRef),ls=C?void 0:G,Tt=x.useMemo(()=>!C||!Array.isArray(W)||!G?null:W.map(xt=>{const wt=ka(xt,R);return s.jsx("input",{type:"hidden",form:b,name:G,value:wt,disabled:F},wt)}),[C,W,b,G,R,F]);return s.jsxs(OE.Provider,{value:xe,children:[s.jsx(ME.Provider,{value:Rn,children:s.jsx(DE.Provider,{value:Hn,children:O})}),s.jsx("input",{...q.getValidationProps(F,{onFocus(){xe.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented||F||w)return;const wt=xt.currentTarget.value,jt=Fe(Yn,xt.nativeEvent);function Nr(){if(C)return;const rr=wt.toLowerCase();let Hr=ee.current.findIndex(rl=>ka(rl,R).toLowerCase()===rr||yo(rl,A).toLowerCase()===rr);Hr===-1&&(Hr=ee.current.findIndex((rl,rn)=>{const ic=ae.current[rn];return ic!=null&&ic.toLowerCase()===rr}));const wn=ee.current[Hr];wn!=null&&it(wn,jt)}xe.set("forceMount",!0),queueMicrotask(Nr)}}),id:Y&&ls==null?`${Y}-hidden-input`:void 0,form:b,name:ls,autoComplete:y,value:Ct,disabled:F,required:j&&!(C&&fs),readOnly:w,ref:Jt,style:G?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Tt]})}function UE(e,t){return e??t}const Mh=5;function VE(e,t){const a=WV(t);return e.clientX>=a.left-Mh&&e.clientX<=a.right+Mh&&e.clientY>=a.top-Mh&&e.clientY<=a.bottom+Mh}function WV(e){const t=e.getBoundingClientRect(),a=Sn(e);if(Hv)return t;const o=a.getComputedStyle(e,"::before"),c=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const f=parseFloat(o.width)||0,p=parseFloat(o.height)||0,h=parseFloat(c.width)||0,b=parseFloat(c.height)||0,y=Math.max(t.width,f,h),v=Math.max(t.height,p,b),w=y-t.width,j=v-t.height;return{left:t.left-w/2,right:t.right+w/2,top:t.top-j/2,bottom:t.bottom+j/2}}const JV="data-popup-side",e6=400,t6={...$v,...wi,popupSide:e=>e?{[JV]:e}:null,value:()=>null},n6=x.forwardRef(function(t,a){const{render:o,className:c,id:d,disabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{setTouched:y,setFocused:v,validationMode:w,validation:j,state:S,disabled:N}=Sa(),{labelId:k}=vl(),T=vo(),{readOnly:D,required:C,disabled:A}=Jy(),R=N||A||f,I=T.useState("open"),P=T.useState("mounted"),O=T.useState("value"),_=T.useState("triggerProps"),L=T.useState("positionerElement"),H=T.useState("listElement"),B=T.useState("popupSide"),z=T.useState("id"),Q=T.useState("labelId"),K=T.useState("hasSelectedValue"),X=P&&L?B:null,q=d??z,$=UE(k,Q);lo({id:d});const Y=Xn(L),F=x.useRef(null),{getButtonProps:G,buttonRef:W}=Jr({disabled:R,native:p}),le=T.useStateSetter("triggerElement"),M=Zs(),U=Zs(),Z=Zs();x.useEffect(()=>{if(I)return Z.start(e6,()=>{T.context.selectionRef.current.allowUnselectedMouseUp=!0,T.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Z.clear()};T.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[I,T,U,Z]);const ae=Wr(_,{id:q,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-controls":I?H?.id??qm(L)?.id:void 0,"aria-labelledby":$,"aria-readonly":D||void 0,"aria-required":C||void 0,tabIndex:R?-1:0,onFocus(ie){v(!0),I&&T.context.alignItemWithTriggerActiveRef.current&&T.context.setOpen(!1,Fe(Yn,ie.nativeEvent)),M.start(0,()=>{T.set("forceMount",!0)})},onBlur(ie){Qe(L,ie.relatedTarget)||(y(!0),v(!1),w==="onBlur"&&j.commit(O))},onMouseDown(ie){if(I)return;const ge=$t(ie.currentTarget);function ee(fe){if(!F.current)return;const te=fe.target;Qe(F.current,te)||Qe(Y.current,te)||VE(fe,F.current)||T.context.setOpen(!1,Fe(T1,fe))}U.start(0,()=>{ge.addEventListener("mouseup",ee,{once:!0})})}},b,G),ce=j.getValidationProps(R,ae);ce.role="combobox";const J={...S,open:I,disabled:R,value:O,readOnly:D,popupSide:X,placeholder:!K};return yt("button",t,{ref:[a,F,W,le],state:J,stateAttributesMapping:t6,props:ce})}),s6={value:()=>null},r6=x.forwardRef(function(t,a){const{className:o,render:c,children:d,placeholder:f,style:p,...h}=t,b=vo(),y=b.useState("value"),v=b.useState("items"),w=b.useState("itemToStringLabel"),j=b.useState("hasSelectedValue"),S=!j&&f!=null&&d==null,N=b.useState("hasNullItemLabel",S),k={value:y,placeholder:!j};let T=null;return typeof d=="function"?T=d(y):d!=null?T=d:S&&!N?T=f:Array.isArray(y)?T=YV(y,v,w):T=BE(y,v,w),yt("span",t,{state:k,ref:[a,b.context.valueRef],props:[{children:T},h],stateAttributesMapping:s6})}),a6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,b={open:vo().useState("open")};return yt("span",t,{state:b,ref:a,props:[{"aria-hidden":!0,children:"▼"},f],stateAttributesMapping:Fv})}),l6=x.forwardRef(function(t,a){const o=vo(),c=o.useState("mounted"),d=o.useState("forceMount");return c||d?s.jsx(lh,{ref:a,...t}):null}),FE=x.createContext(void 0);function o6(){const e=x.useContext(FE);if(!e)throw new Error(on(59));return e}function Dh(e,t){e&&Object.assign(e.style,t)}const i6={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},c6=20;function tw(e,t,a,o){const[c,d]=x.useState(!1);De(()=>{if(!e||!t||a==null){d(!1);return}const f=$t(a).documentElement.clientWidth,p=a.offsetWidth;d(f>0&&p>0&&p>=f-c6)},[e,t,a]),hE(e&&(!t||c),o)}const u6={position:"fixed"},d6=x.forwardRef(function(t,a){const{anchor:o,className:c,render:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N,alignItemWithTrigger:k=!0,collisionAvoidance:T=X1,style:D,...C}=t,A=vo(),R=IE(),I=A.useState("open"),P=A.useState("mounted"),O=A.useState("modal"),_=A.useState("value"),L=A.useState("openMethod"),H=A.useState("positionerElement"),B=A.useState("triggerElement"),z=A.useState("isItemEqualToValue"),Q=A.useState("transitionStatus"),K=x.useRef(null),X=x.useRef(null),[q,$]=x.useState(k),Y=P&&q&&L!=="touch";!P&&q!==k&&$(k),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>Y),tw((Y||O)&&I,L==="touch",H,B);const F=yh({anchor:o,floatingRootContext:R,positionMethod:f,mounted:P,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N??Y,collisionAvoidance:T,keepMounted:!0}),G=Y?"none":F.side,W=Y?u6:F.positionerStyles,le={open:I,side:G,align:F.align,anchorHidden:F.anchorHidden};De(()=>{A.set("popupSide",F.side)},[A,F.side]);const M=A.useStateSetter("positionerElement"),U=wh(t,le,{styles:W,transitionStatus:Q,props:C,refs:[a,M],hidden:!P,inert:!I}),Z=x.useRef(0),ae=Ie(J=>{if(A.context.valuesRef.current.length===0)return;const ie=Z.current;Z.current=J.size;const ge=Fe(Yn);if(ie!==0&&!A.state.multiple&&_!==null&&su(A.context.valuesRef.current,_,z)===-1){const fe=A.context.initialValueRef.current,Ce=fe!=null&&su(A.context.valuesRef.current,fe,z)!==-1?fe:null;A.context.setValue(Ce,ge),Ce===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ie!==0&&A.state.multiple&&Array.isArray(_)){const ee=_.filter(fe=>su(A.context.valuesRef.current,fe,z)!==-1);ee.length!==_.length&&(A.context.setValue(ee,ge),ee.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(I&&Y){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ee={height:""};Dh(H,ee),Dh(A.context.popupRef.current,ee)}}),ce=x.useMemo(()=>({...F,side:G,alignItemWithTriggerActive:Y,setControlledAlignItemWithTrigger:$,scrollUpArrowRef:K,scrollDownArrowRef:X}),[F,G,Y,$]);return s.jsx(Wy,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:ae,children:s.jsxs(FE.Provider,{value:ce,children:[P&&O&&s.jsx(kh,{inert:jh(!I),cutout:B}),U]})})}),Ih="base-ui-disable-scrollbar",$E={className:Ih,getElement(e){return s.jsx("style",{nonce:e,href:Ih,precedence:"base-ui:low",children:`.${Ih}{scrollbar-width:none}.${Ih}::-webkit-scrollbar{display:none}`})}},f6=x.createContext(void 0);function qE(e){return x.useContext(f6)}const p6=x.createContext(void 0),m6={disableStyleElements:!1};function h6(){return x.useContext(p6)??m6}const GE="--transform-origin",g6={...$c,...oo},x6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,...p}=t,h=vo(),{multiple:b,readOnly:y,highlightItemOnHover:v}=Jy(),w=IE(),{side:j,align:S,alignItemWithTriggerActive:N,isPositioned:k,setControlledAlignItemWithTrigger:T}=o6(),D=qE()!=null,C=cf(),{nonce:A,disableStyleElements:R}=h6(),I=h.useState("id"),P=h.useState("open"),O=h.useState("openMethod"),_=h.useState("mounted"),L=h.useState("popupProps"),H=h.useState("transitionStatus"),B=h.useState("triggerElement"),z=h.useState("positionerElement"),Q=h.useState("listElement"),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef({}),$=Kc(),Y=Ie(le=>{if(!z||!h.context.popupRef.current||!X.current)return;const M=z.style.top==="0px",U=z.style.bottom==="0px";if(K.current||!N||!M&&!U){h.context.handleScrollArrowVisibility(le);return}const Z=YE(z),ae=ff(z.getBoundingClientRect().height,"y",Z),ce=$t(z),J=Sn(z),ie=J.getComputedStyle(z),ge=parseFloat(ie.marginTop),ee=parseFloat(ie.marginBottom),fe=KE(J.getComputedStyle(h.context.popupRef.current)),te=Math.min(ce.documentElement.clientHeight-ge-ee,fe),Ce=le.scrollTop,re=Ph(le);let de=null;const ke=ye=>{z.style.height=`${ye}px`},Ee=M?re-Ce:Ce,ve=Math.min(ae+Ee,te);if(Ee<=Cl){const ye=Ri(Ee,0,te-ae);ye>0&&ke(ae+ye),le.scrollTop=M?re:0,te-(ae+ye)<=Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le);return}if(te-ve>Cl)de=M?1/0:0;else if(U&&CeCl&&(le.scrollTop=ye)}he>=te-Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le)});x.useImperativeHandle(h.context.scrollHandlerRef,()=>Y,[Y]),ra({open:P,ref:h.context.popupRef,onComplete(){P&&h.context.onOpenChangeComplete(!0)}});const F={open:P,transitionStatus:H,side:j,align:S};De(()=>{!z||!h.context.popupRef.current||Object.keys(q.current).length||(q.current={top:z.style.top||"0",left:z.style.left||"0",right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[h,z]),De(()=>{P||N||(X.current=!1,K.current=!1,Dh(z,q.current))},[P,N,z]),De(()=>{const le=h.context.popupRef.current;if(!P||!B||!z||!le||N&&!k||h.state.transitionStatus==="ending")return;if(X.current=!0,le.style.removeProperty(GE),!N){$.request(()=>h.context.handleScrollArrowVisibility(Q||le));return}const M=b6(le);try{let U=h.context.selectedItemTextRef.current;U?.isConnected||(U=!h.select("hasSelectedValue")&&h.context.firstItemTextRef.current?.isConnected?h.context.firstItemTextRef.current:null);const Z=h.context.valueRef.current,ae=Sn(z),ce=ae.getComputedStyle(z),J=ae.getComputedStyle(le),ie=$t(B),ge=YE(B),ee=_h(B.getBoundingClientRect(),ge),fe=_h(z.getBoundingClientRect(),ge),te=ee.height,Ce=Q||le,re=Ce.scrollHeight,de=parseFloat(J.borderBottomWidth),ke=parseFloat(ce.marginTop)||10,Ee=parseFloat(ce.marginBottom)||10,ve=parseFloat(ce.minHeight)||100,he=KE(J),ye=5,je=5,xe=20,Te=ie.documentElement.clientHeight-ke-Ee,Oe=ie.documentElement.clientWidth,Ne=Te-ee.bottom+te;let _e,Ye=C==="rtl"?ee.right-fe.width:ee.left,kt=0;if(U&&Z){const tn=_h(Z.getBoundingClientRect(),ge);_e=_h(U.getBoundingClientRect(),ge),Ye=fe.left+(C==="rtl"?tn.right-_e.right:tn.left-_e.left);const nt=tn.top-ee.top+tn.height/2;kt=_e.top-fe.top+_e.height/2-nt}const Ct=Ne+kt+Ee+de;let Rt=Math.min(Te,Ct);const ot=Te-ke-Ee,qn=Ct-Rt,fs=Oe-je;z.style.left=`${Ri(Ye,ye,fs-fe.width)}px`,z.style.height=`${Rt}px`,z.style.maxHeight="none",z.style.marginTop=`${ke}px`,z.style.marginBottom=`${Ee}px`,le.style.height="100%";const Gn=Ph(Ce),bs=qn>=Gn-Cl;bs&&(Rt=Math.min(Te,fe.height)-(qn-Gn));const it=ee.topTe-xe||Math.ceil(Rt)+Cl=ot?"0":`${tn}px`,z.style.height=`${Rt}px`,Ce.scrollTop=Ph(Ce)}else z.style.bottom="0",Ce.scrollTop=qn;if(_e){const tn=fe.top,nt=fe.height,Ot=_e.top+_e.height/2,Ft=Ri(nt>0?(Ot-tn)/nt*100:50,0,100);le.style.setProperty(GE,`50% ${Ft}%`)}(Hn===Te||Rt>=he)&&(K.current=!0),h.context.handleScrollArrowVisibility(Ce),v&&h.state.selectedIndex===null&&h.state.activeIndex===null&&h.context.listRef.current[0]!=null&&h.set("activeIndex",0)}finally{M()}},[h,P,z,B,N,T,$,Q,v,C,k]),x.useEffect(()=>{if(!N||!z||!P)return;const le=Sn(z);function M(U){h.context.setOpen(!1,Fe(c4,U))}return St(le,"resize",M)},[h,N,z,P]);const G={...Q?{role:"presentation"}:{role:"listbox","aria-multiselectable":b||void 0,"aria-readonly":y||void 0,id:`${I}-list`},onKeyDown(le){D&&Sh.has(le.key)&&le.stopPropagation()},onScroll(le){Q||Y(le.currentTarget)},...N&&{style:Q?{height:"100%"}:i6},className:!Q&&N?$E.className:void 0},W=yt("div",t,{ref:[a,h.context.popupRef],state:F,stateAttributesMapping:g6,props:[L,G,uf(H),p]});return s.jsxs(x.Fragment,{children:[!R&&$E.getElement(A),s.jsx(oh,{context:w,modal:!1,disabled:!_,openInteractionType:O,returnFocus:f,restoreFocus:!0,children:W})]})});function KE(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Ph(e){return HE(e.scrollHeight,e.clientHeight)}function YE(e){return gT.getScale(e)}function ff(e,t,a){return e/a[t]}function _h(e,t){return Xd({x:ff(e.x,"x",t),y:ff(e.y,"y",t),width:ff(e.width,"x",t),height:ff(e.height,"y",t)})}const XE=[["transform","none"],["scale","1"],["translate","0 0"]];function b6(e){const{style:t}=e,a={};for(const[o,c]of XE)a[o]=t.getPropertyValue(o),t.setProperty(o,c,"important");return()=>{for(const[o]of XE){const c=a[o];c?t.setProperty(o,c):t.removeProperty(o)}}}const QE=x.createContext(void 0);function nw(){const e=x.useContext(QE);if(!e)throw new Error(on(57));return e}const v6=x.memo(x.forwardRef(function(t,a){const{render:o,className:c,style:d,value:f=null,label:p,disabled:h=!1,nativeButton:b=!1,...y}=t,v=x.useRef(null),w=Zy({guess:!0,label:p,textRef:v}),j=vo(),{itemProps:S,multiple:N,disabled:k,readOnly:T}=Jy(),D=k||h,C=j.useState("isActive",w.index),A=j.useState("open"),R=j.useState("isSelected",f),I=j.useState("isSelectedByFocus",w.index),P=j.useState("isItemEqualToValue"),O=w.index,_=x.useRef(null);De(()=>{const F=j.context.valuesRef.current;return F[O]=f,()=>{delete F[O]}},[O,f,j]),De(()=>{const F=j.state.value,G=j.state.selectedIndex;let W=G,le;N&&Array.isArray(F)?(W=_E(O,f,j.context.valuesRef.current,F,P,G),le=W===O,O===G&&!le&&(j.context.selectedItemTextRef.current=null)):(le=F!==void 0&&la(f,F,P),le&&(W=O)),j.set("selectedIndex",W),le&&v.current&&(j.context.selectedItemTextRef.current=v.current)},[O,N,P,j,f]);const L=x.useRef("mouse"),H=x.useRef(!1),{getButtonProps:B,buttonRef:z}=Jr({disabled:D,focusableWhenDisabled:!0,native:b,composite:!0}),Q={disabled:D,selected:R,highlighted:C};function K(F){if(k||T)return;const G=j.state.value;if(N){const W=Array.isArray(G)?G:[],le=R?LE(W,f,P):[...W,f];j.context.setValue(le,Fe(Wd,F))}else j.context.setValue(f,Fe(Wd,F)),j.context.setOpen(!1,Fe(Wd,F))}function X(){j.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":R,tabIndex:A&&C?0:-1,onKeyDown(F){j.set("activeIndex",O),F.key===" "&&j.context.typingRef.current&&F.preventDefault()},onClick(F){const G=L.current!=="touch",W=F.nativeEvent.pointerType,le=G&&Gm(F.nativeEvent)&&(W!==void 0||C),M=G&&!le&&!H.current;H.current=!1,!(D||M)&&K(F.nativeEvent)},onPointerEnter(F){L.current=F.pointerType},onPointerMove(F){if(F.pointerType==="mouse"&&F.buttons===1){const G=j.context.selectionRef.current;G.dragY+=F.movementY,G.dragY**2>=64&&(G.allowUnselectedMouseUp=!0)}},onPointerDown(F){L.current=F.pointerType,H.current=!0,X()},onMouseUp(){if(X(),D||L.current==="touch"||H.current)return;const F=!j.context.selectionRef.current.allowSelectedMouseUp&&R,G=!j.context.selectionRef.current.allowUnselectedMouseUp&&!R;F||G||(H.current=!0,_.current?.click(),H.current=!1)}},$=yt("div",t,{ref:[z,a,w.ref,_],state:Q,props:[S,q,y,B]}),Y=x.useMemo(()=>({selected:R,index:O,textRef:v,selectedByFocus:I}),[R,O,v,I]);return s.jsx(QE.Provider,{value:Y,children:$})})),y6=x.forwardRef(function(t,a){const{selected:o}=nw();return t.keepMounted||o?s.jsx(w6,{...t,ref:a}):null}),w6=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=nw(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),j6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:c,selectedByFocus:d}=nw(),f=vo(),{render:p,className:h,style:b,...y}=t,v=x.useCallback(j=>{j&&(o===0&&(f.context.firstItemTextRef.current=j),d&&(f.context.selectedItemTextRef.current=j))},[f,o,d]);return yt("div",t,{ref:[v,a,c],props:y})})),ft=ZV,pt=r6;function mt({className:e,children:t,...a}){return s.jsxs(n6,{"data-slot":"select-trigger",className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","[&>span]:min-w-0 [&>span]:truncate","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",e),...a,children:[t,s.jsx(a6,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function ht({className:e,sideOffset:t=4,children:a,...o}){return s.jsx(l6,{children:s.jsx(d6,{sideOffset:t,alignItemWithTrigger:!1,className:"z-[35]",children:s.jsx(x6,{"data-slot":"select-content",className:Ue("max-h-[260px] min-w-[var(--anchor-width)] overflow-y-auto overscroll-contain rounded-lg border border-border-strong bg-raised p-[5px] shadow-3","outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0",e),...o,children:a})})})}function qe({className:e,children:t,...a}){return s.jsxs(v6,{"data-slot":"select-item",className:Ue("flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-[9px] text-[12.5px] leading-[1.4] text-foreground select-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:font-normal data-disabled:text-muted-foreground",e),...a,children:[s.jsx(j6,{className:"min-w-0 flex-1 truncate",children:t}),s.jsx(y6,{className:"flex flex-none text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function In({options:e,value:t,onValueChange:a,disabled:o=!1,className:c,...d}){const f=x.useRef(null),p=x.useRef(new Map),[h,b]=x.useState({left:0,width:0,ready:!1}),[y,v]=x.useState(!1),w=x.useCallback(()=>{const j=f.current,S=p.current.get(t);if(!j||!S){b(C=>C.ready?{...C,ready:!1}:C);return}const N=j.getBoundingClientRect(),k=S.getBoundingClientRect(),T=k.left-N.left-j.clientLeft,D=k.width;b(C=>C.ready&&C.left===T&&C.width===D?C:{left:T,width:D,ready:!0})},[t]);return x.useLayoutEffect(()=>{w();const j=f.current;if(!j||typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>w());S.observe(j);for(const N of p.current.values())S.observe(N);return()=>S.disconnect()},[w,e]),x.useEffect(()=>{if(!h.ready||y)return;const j=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(j)},[h.ready,y]),s.jsxs(AE,{ref:f,"data-slot":"segmented-control",className:Ue("relative inline-flex gap-0.5 rounded-md border border-control-border bg-control p-0.5",c),value:t,disabled:o,onValueChange:j=>a(j),...d,children:[s.jsx("span",{"aria-hidden":"true","data-slot":"segmented-thumb","data-ready":h.ready?"true":"false","data-animate":y?"true":"false",className:Ue("pointer-events-none absolute top-0.5 bottom-0.5 left-0 rounded-sm bg-primary-soft","data-[ready=false]:opacity-0","data-[animate=true]:transition-[transform,width] data-[animate=true]:duration-200 data-[animate=true]:ease-in-out"),style:{transform:`translateX(${h.left}px)`,width:h.width}}),e.map(j=>s.jsxs(CE,{value:j.value,"data-slot":"segmented-item",disabled:j.disabled,"data-zero":j.count===0?"true":void 0,className:Ue("group/seg relative z-[1] inline-flex h-6 items-center gap-[5px] rounded-sm border-0 bg-transparent px-2.5","text-xs font-medium whitespace-nowrap text-subtle select-none","transition-[background-color,color] duration-150 ease-out","hover:bg-nav-hover hover:text-foreground","data-checked:bg-transparent data-checked:text-primary-fg data-checked:hover:bg-transparent","data-disabled:cursor-not-allowed data-disabled:opacity-40","data-[zero=true]:data-unchecked:opacity-45"),ref:S=>{S?p.current.set(j.value,S):p.current.delete(j.value)},children:[j.label,j.count!==void 0&&s.jsx("span",{className:Ue("min-w-4 rounded-pill bg-surface-3 px-[5px] text-center text-[10.5px] font-semibold tabular-nums text-muted-foreground","group-data-checked/seg:bg-primary-tint group-data-checked/seg:text-primary-fg"),children:j.count})]},j.value))]})}const S6=x.createContext(void 0);function N6(){return x.useContext(S6)}const k6=x.forwardRef(function(t,a){const{className:o,defaultPressed:c=!1,disabled:d=!1,form:f,onPressedChange:p,pressed:h,render:b,type:y,value:v,nativeButton:w=!0,style:j,...S}=t,N=Na(v||void 0),k=N6(),T=k?.value??[],D=(d||k?.disabled)??!1,[C,A]=Ga({controlled:k?N!==void 0&&T.indexOf(N)>-1:h,default:c,name:"Toggle",state:"pressed"}),{getButtonProps:R,buttonRef:I}=Jr({disabled:D,native:w}),P={disabled:D,pressed:C},O=[I,a],_=[{"aria-pressed":C,onClick(B){const z=!C,Q=Fe(Yn,B.nativeEvent);p?.(z,Q),!Q.isCanceled&&(N&&k?.setGroupValue?.(N,z,Q),!Q.isCanceled&&A(z))}},S,R],L=yt("button",t,{enabled:!k,state:P,ref:O,props:_}),H=x.useMemo(()=>({disabled:D,focusableWhenDisabled:!1}),[D]);return k?s.jsx(SE,{tag:"button",render:b,className:o,style:j,metadata:H,state:P,refs:O,props:_}):L}),C6=Vc(["inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color] duration-150 ease-out","outline-none select-none disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0","data-pressed:border-primary-bd data-pressed:bg-primary-soft data-pressed:font-semibold data-pressed:text-primary-fg","data-pressed:hover:bg-primary-tint"],{variants:{variant:{default:"border-transparent bg-transparent text-subtle hover:bg-nav-hover hover:text-foreground",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]"}},defaultVariants:{variant:"default",size:"default"}});function T6({className:e,variant:t,size:a,...o}){return s.jsx(k6,{"data-slot":"toggle",className:Ue(C6({variant:t,size:a}),e),...o})}function E6(e,t,a,o,c,d,f,p,h,b=2){const y=GB(a.current,{event:e,orientation:o,loopFocus:c,rtl:d,cols:b,disabledIndices:f,minIndex:p,maxIndex:h,prevIndex:t>h?p:t,stopEvent:!0});return fo(a.current,y)?void 0:y}const ZE=x.createContext(void 0),WE=x.createContext(void 0),JE=x.createContext(void 0),eA=x.createContext(!1),tA=x.createContext("");function Ca(){const e=x.useContext(ZE);if(!e)throw new Error(on(22));return e}function Lh(){const e=x.useContext(WE);if(!e)throw new Error(on(23));return e}function pf(){const e=x.useContext(JE);if(!e)throw new Error(on(24));return e}function nA(){return x.useContext(tA)}function A6(){return x.useContext(eA)}const R6={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{const{selectedValue:t,selectionMode:a}=e;return t==null?!1:a==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.selectedValue;return Array.isArray(o)?o.some(c=>la(t,c,a)):la(t,o,a)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function sA(e){return e==null?void 0:`${e}-popup`}function O6(e,t){return(a,o)=>a==null?!1:e.contains(a,o,t)}const rA=new Map;function M6(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},a=`${dy(e.locale)}|${JSON.stringify(t)}`,o=rA.get(a);if(o)return o;const c=new Intl.Collator(e.locale,t),d={contains(f,p,h){if(!p)return!0;const b=yo(f,h);for(let y=0;y<=b.length-p.length;y+=1)if(c.compare(b.slice(y,y+p.length),p)===0)return!0;return!1},startsWith(f,p,h){if(!p)return!0;const b=yo(f,h);return c.compare(b.slice(0,p.length),p)===0},endsWith(f,p,h){if(!p)return!0;const b=yo(f,h),y=p.length;return b.length>=y&&c.compare(b.slice(b.length-y),p)===0}};return rA.set(a,d),d}const D6=M6;function I6(e,t=!1){const{overflowY:a}=xr(e);return a!=="auto"&&a!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const aA=Symbol("none"),sw={value:aA,index:-1};function P6(e,t,a){const o=e.get(t);if(o!==void 0||a===Ah)return o;for(const[c,d]of e)if(la(c,t,a))return d}function _6(e){const{id:t,onOpenChangeComplete:a,defaultSelectedValue:o=null,selectedValue:c,onSelectedValueChange:d,defaultInputValue:f,inputValue:p,open:h,defaultOpen:b=!1,selectionMode:y,onItemHighlighted:v,name:w,form:j,disabled:S=!1,readOnly:N=!1,required:k=!1,inputRef:T,grid:D=!1,items:C,filteredItems:A,filter:R,filterQuery:I,openOnInputClick:P=!0,autoHighlight:O=!1,keepHighlight:_=!1,highlightItemOnHover:L=!0,loopFocus:H=!0,itemToStringLabel:B,itemToStringValue:z,isItemEqualToValue:Q=Ah,virtualized:K=!1,inline:X=!1,fillInputOnItemPress:q=!0,modal:$=!1,limit:Y=-1,autoComplete:F="list",formAutoComplete:G,locale:W,submitOnItemClick:le=!1}=e,{clearErrors:M}=Fc(),{setDirty:U,validityData:Z,setFilled:ae,name:ce,disabled:J,setTouched:ie,setFocused:ge,validationMode:ee,validation:fe}=Sa(),te=cf(),Ce=lo({id:t}),re=D6({locale:W}),de=Array.isArray(C)?null:C;if(de&&typeof de.label!="function")throw new Error(on(100));const ke=de?de.data:C,Ee=de?.value,ve=Ee?void 0:ke,he=x.useMemo(()=>{if(!A||!Ee)return;const Me=Oh(A),Be=Me.map(Ee);let lt;return{values:Be,findItem(Yt,On){if(!lt){lt=new Map;for(let mn=0;mnde?Me=>de.label(Me,Q,Be=>{const lt=he?.findItem(Be,Q);return lt!=null?de.itemLabel(lt):yo(Be,B)}):B,[de,B,he,Q]),je=x.useMemo(()=>de?Object.assign(Me=>de.itemLabel(Me),{selected:Me=>yo(Me,ye)}):B,[de,ye,B]);function xe(Me){return yo(Me,ye)}const[Te,Oe]=x.useState(!1),[Ne,_e]=x.useState(null),Ye=x.useRef(Ne),kt=x.useRef([]),Ct=x.useRef([]),Rt=x.useRef(null),ot=x.useRef(null),qn=x.useRef(null),fs=x.useRef(null),Gn=x.useRef(null),bs=x.useRef(!0),it=x.useRef(!1),Vt=x.useRef(null),Hn=x.useRef(null),tn=x.useRef(null),nt=x.useRef(sw),Ot=x.useRef(null),Ft=x.useRef([]),Zn=x.useRef(null),Un=J||S,Vn=ce??w,Rn=y==="multiple",Jt=y==="single",ls=p!==void 0||f!==void 0,Tt=ke!==void 0,xt=A!==void 0;let wt;O==="always"?wt="always":wt=O?"input-change":!1;const[jt,Nr]=Ga({controlled:c,default:Rn?o??Or:o,name:"Combobox",state:"selectedValue"}),rr=x.useMemo(()=>R===null?()=>!0:R!==void 0?R:O6(re,je),[R,re,je]),Hr=Ds(()=>ls?f??"":Jt?xe(jt):"").current,[wn,rl]=Ga({controlled:p,default:Hr,name:"Combobox",state:"inputValue"}),[rn,ic]=Ga({controlled:h,default:b,name:"Combobox",state:"open"}),Jx=ew(ke),dr=!rn&&Ne!==null?Ne:String(wn).trim(),Ia=Jt?xe(jt):"",Ho=Jt&&!Te&&dr!==""&&Ia.length===dr.length&&re.contains(Ia,dr),Uo=Ho?"":I??dr,_p=Tt&&xt&&Ho&&(!de||de.hasValue(jt,Q)),cc=x.useMemo(()=>ke?Oh(ke):Or,[ke]),Vo=x.useMemo(()=>{if(A&&!_p)return A;if(!ke)return Or;if(Jx){const Be=ke,lt=[];let Yt=0;for(const On of Be){if(Y>-1&&Yt>=Y)break;const mn=Y>-1?Y-Yt:1/0,Mn=Uo===""?On.items.slice(0,mn):[];if(Uo!=="")for(const ps of On.items){if(Mn.length>=mn)break;rr(ps,Uo,je)&&Mn.push(ps)}if(Mn.length>0){const ps={...On,items:Mn};lt.push(ps),Yt+=Mn.length}}return lt}if(Uo==="")return Y>-1?cc.slice(0,Y):cc;const Me=[];for(const Be of cc){if(Y>-1&&Me.length>=Y)break;rr(Be,Uo,je)&&Me.push(Be)}return Me},[A,_p,ke,Jx,Uo,Y,rr,je,cc]),As=x.useMemo(()=>{if(he&&Vo===A)return he.values;const Me=Oh(Vo);return Ee?Me.map(Be=>Ee(Be)):Me},[Vo,A,he,Ee]),et=Ds(()=>{let Me=null;return X&&rn&&Tt&&y!=="none"&&(Me=df(As,jt,Q,Rn)),new tu({id:Ce,labelId:void 0,selectedValue:jt,open:rn,items:ve,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,isItemEqualToValue:Q,modal:$,autoHighlight:wt,submitOnItemClick:le,hasInputValue:ls,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:X,activeIndex:null,selectedIndex:Me,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:fn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:y==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:kt,labelsRef:Ct,popupRef:Rt,emptyRef:Gn,inputRef:ot,startDismissRef:qn,endDismissRef:fs,keyboardActiveRef:bs,chipsContainerRef:Vt,clearRef:Hn,valuesRef:Ft,pointerDownItemRef:Zn,selectionEventRef:tn},R6)}).current,_l=y==="none"?wn:jt,eb=x.useMemo(()=>y==="none"?_l:Array.isArray(jt)?jt.map(Me=>ka(Me,z)):ka(jt,z),[_l,z,y,jt]),Pa=Ie(v),Rs=Ie(a),qs=et.useState("activeIndex"),Fo=et.useState("selectedIndex"),uc=et.useState("positionerElement"),tb=et.useState("listElement"),dc=et.useState("triggerElement"),fc=et.useState("inputElement"),pc=et.useState("inputGroupElement"),Os=et.useState("inline"),ar=et.useState("inputInsidePopup"),Ll=et.useState("inputOwnsFormValue"),zl=Jt&&!ar&&wn===Ia,mc=Xn(dc),{mounted:$o,setMounted:vs,transitionStatus:Lp}=ki(rn),{openMethod:nb,triggerProps:zp}=vE(rn),Bl=Ie(()=>eb);Yc(ar?mc:ot,Ce,_l,Bl,!Un,w);const Hl=Ie(()=>{ke?Ct.current=As.map(xe):et.set("forceMounted",!0)}),qo=Ie((Me,Be,lt)=>{if(Be===-1){if(nt.current===sw)return;nt.current=sw}else nt.current={value:Me,index:Be};Pa(Me,u4(lt,void 0,{index:Be}))}),Ur=Ie(Me=>{const Be={};Me.activeIndex!==void 0&&(Be.activeIndex=Me.activeIndex),Me.selectedIndex!==void 0&&(Be.selectedIndex=Me.selectedIndex),et.update(Be);const lt=Me.activeIndex;if(lt===void 0)return;const Yt=Me.type||Yn;lt===null?qo(void 0,-1,Yt):qo(Ft.current[lt],lt,Yt)}),Vr=Ie((Me,Be)=>{if(e.onInputValueChange?.(Me,Be),!Be.isCanceled){if(it.current=Be.reason===Ka,Be.reason===Jd){rn&&Ne!==null&&_e(null);const lt=Be.event,Yt=lt.inputType;if(lt.type==="compositionend"||Yt!=null&&Yt!==""&&Yt!=="insertReplacementText"){const mn=Me.trim()!=="";mn&&Oe(!0),Ot.current={hasQuery:mn};const Mn=et.state.listElement;if(!et.state.virtualized&&Mn){const ps=Rt.current;for(const kr of Hc(Mn.firstElementChild??Mn)){if(!dn(kr)||(ps?!Qe(ps,kr):kr.getAttribute("role")==="dialog"))break;if(I6(kr)){kr.scrollTop=0;break}}}mn&&wt&&et.state.activeIndex==null&&(rn||Os)&&et.set("activeIndex",0)}}else Be.reason===Ka&&Me===""&&et.state.inputInsidePopup&&(Ot.current={hasQuery:!1,selection:!0});rl(Me)}}),sb=Ie(Me=>{const Be=!Me&&ar&&!Os&&wn!==""&&(String(wn).trim()===Ne||wn===Ia);!Me&&(Be||wn===""||zl)&&Oe(!1),_e(null),Be&&Vr("",Fe(Ka))}),Mt=Ie((Me,Be)=>{if(rn!==Me&&(Be.reason===Xc&&Tt&&As.length===0&&!Gn.current&&Be.allowPropagation(),e.onOpenChange?.(Me,Be),!Be.isCanceled&&(Me&&Ne!==null&&sb(Be.reason===Jd),!Me&&Te&&(Jt?(Os||_e(dr),dr===""&&Oe(!1)):Rn&&(Os||_e(dr),ar&&Ur({activeIndex:null}),(!ar||Os)&&Vr("",Fe(Ka,Be.event,void 0,{isItemPress:Be.reason===Wd})))),ic(Me),!Me&&ar&&(Be.reason===ho||Be.reason===nh)&&(ie(!0),ge(!1),ee==="onBlur")))){const lt=y==="none"?wn:jt;fe.commit(lt)}}),hc=Ie((Me,Be)=>{if(d?.(Me,Be),Be.isCanceled)return;Nr(Me),(y==="none"&&Rt.current&&q||Jt&&!et.state.inputInsidePopup)&&Vr(xe(Me),Fe(Be.reason,Be.event))}),ed=Ie((Me,Be)=>{const lt=cs(Me),Yt=tn.current??Me;tn.current=null;const On=Fe(Wd,Yt),mn=lt?.closest("a")?.getAttribute("href");if(mn){mn.startsWith("#")&&Mt(!1,On);return}if(Rn){const Mn=Array.isArray(jt)?jt:[],ps=Rh(Mn,Be,Q),kr=ps?LE(Mn,Be,Q):[...Mn,Be];if(hc(kr,On),On.isCanceled||!(ot.current?ot.current.value.trim()!=="":!1))return;if(et.state.inputInsidePopup){Vr("",Fe(Ka,On.event,void 0,{isItemPress:!0}));const $r=Ot.current;$r&&!ps&&($r.toggledValue=Be)}else Mt(!1,On)}else{if(hc(Be,On),On.isCanceled)return;Mt(!1,On)}}),td=Ie(()=>{const Me=fe.inputRef.current?.form??et.state.inputElement?.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),Fr=Ie(()=>{if(vs(!1),Rs?.(!1),Oe(!1),_e(null),Ur(y==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Rn&&ot.current&&ot.current.value!==""&&!it.current&&Vr("",Fe(Ka)),Jt)if(et.state.inputInsidePopup)ot.current&&ot.current.value!==""&&Vr("",Fe(Ka));else{const Me=xe(jt);ot.current&&ot.current.value!==Me&&Vr(Me,Fe(Me===""?Ka:Yn))}}),fr=x.useMemo(()=>Os&&uc?{current:uc.closest('[role="dialog"]')}:Rt,[Os,uc]);ra({enabled:!e.actionsRef,open:rn,ref:fr,onComplete(){rn||Fr()}}),x.useImperativeHandle(e.actionsRef,()=>({unmount:Fr}),[Fr]),De(function(){const Be=Ye.current!==null&&Ne===null;if(Ye.current=Ne,rn&&(!Be||!Tt)||(rn||(Zn.current=null),y==="none"))return;const lt=Tt?As:Ft.current;Ur({selectedIndex:df(lt,jt,Q,Rn)})},[rn,Ne,jt,y,Rn,Tt,As,Q,Ur]),De(()=>{ke&&(Ft.current=As,kt.current.length=As.length)},[ke,As]),De(()=>{const Me=Ot.current;if(Me){const ps=rn||Os||et.state.positionerElement?.hidden===!1;if(Me.hasQuery)wt&&ps&&et.set("activeIndex",0),Ot.current=null;else if(String(wn).trim()===""&&(Ot.current=null,ps)){const kr=Me.selection;wt==="always"&&!kr&&et.state.selectionMode==="none"&&et.set("activeIndex",0),queueMicrotask(()=>{if(!et.state.open&&!et.state.inline||ot.current&&ot.current.value.trim()!=="")return;const ma=et.state.selectedValue,$r=et.state.selectionMode==="multiple";if($r&&Array.isArray(ma)?ma.length>0:et.state.selectionMode!=="none"&&ma!=null){const _s=Tt||xt?As:Ft.current,La=su(_s,Me.toggledValue,et.state.isItemEqualToValue);et.set("activeIndex",La!==-1?La:df(_s,ma,et.state.isItemEqualToValue,$r))}else kr?et.set("activeIndex",null):wt==="always"&&et.set("activeIndex",0)})}}if(!rn&&!Os)return;const lt=Tt||xt?As:Ft.current,Yt=et.state.activeIndex;if(Yt==null){if(wt==="always"&<.length>0){et.set("activeIndex",0);return}qo(void 0,-1,Yn);return}if(Yt>=lt.length){qo(void 0,-1,Yn),et.set("activeIndex",null);return}const On=lt[Yt],mn=nt.current.value,Mn=mn!==aA&&la(On,mn,et.state.isItemEqualToValue);(nt.current.index!==Yt||!Mn)&&qo(On,Yt,Yn)},[qs,wt,qo,xt,Tt,As,Os,rn,et,wn]),De(()=>{if(y==="none"){ae(String(wn)!=="");return}ae(Rn?Array.isArray(jt)&&jt.length>0:jt!=null)},[ae,y,wn,jt,Rn]),x.useEffect(()=>{Tt&&wt&&As.length===0&&Ur({activeIndex:null})},[Tt,wt,As.length,Ur]);function rb(){rn&&dr!==""&&dr!==String(Hr)&&!zl&&Oe(!0)}function FS(){rn&&Ne!==null&&sb(!1)}let nd=!1;function Bp(){!nd&&wn!==Ia&&(nd=!0,Vr(Ia,Fe(Yn)))}function $S(){y!=="none"&&(M(Vn),U(PE(jt,Z.initialValue,Q)),fe.change(jt),Jt&&!ls&&!ar&&Bp())}function pr(){Jt&&!ls&&!ar&&!Te&&Bp()}function Hp(){y==="none"&&(M(Vn),U(wn!==Z.initialValue),fe.change(wn))}aa(dr,rb),aa(rn,FS),aa(jt,$S),aa(Ia,pr),aa(ke,pr),aa(wn,Hp);const gc=PT({open:Os?!0:rn,onOpenChange:Mt,elements:{reference:ar?dc:fc,floating:uc}}),sd=D?"grid":"listbox",_a=rn||Os,Up=_a?"true":"false",xc=x.useMemo(()=>{const Me=fc?.tagName==="INPUT",Be=fc==null||Me,lt=Be||_a,Yt=Be?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return lt&&(Yt.role="combobox",Yt["aria-expanded"]=Up,Yt["aria-haspopup"]=sd,Yt["aria-controls"]=_a?tb?.id:void 0,Yt["aria-autocomplete"]=N?"none":F),{reference:Yt,floating:{role:"presentation"}}},[fc,_a,Up,sd,tb?.id,F,N]),Ul=ih(gc,{enabled:!Un&&P,event:"mousedown-only",toggle:!1,touchOpenDelay:ar?0:100,reason:o4}),rd=af(gc,{enabled:!Un&&!Os,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Os?!0:void 0,outsidePress(Me){const Be=cs(Me);return!Qe(dc,Be)&&!Qe(Hn.current,Be)&&!Qe(Vt.current,Be)&&!Qe(pc,Be)}}),Vl=HT(gc,{enabled:!Un,id:Ce,listRef:kt,activeIndex:qs,selectedIndex:Fo,virtual:!0,loopFocus:H,allowEscape:H&&!wt,focusItemOnOpen:Te||y==="none"&&!wt?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!_,orientation:D?"horizontal":void 0,rtl:te==="rtl",disabledIndices:Or,grid:D?E6:void 0,onNavigate(Me,Be){!Be&&!rn||Lp==="ending"||Ur(Be?{activeIndex:Me,type:bs.current?k1:C1}:{activeIndex:Me})}}),Vp=x.useMemo(()=>Wr(Vl.reference,{onKeyDown(Me){D&&et.state.activeIndex==null&&(Me.key==="ArrowLeft"||Me.key==="ArrowRight")&&Me.preventBaseUIHandler()}},rd.reference,Ul.reference,xc.reference),[Vl.reference,rd.reference,Ul.reference,xc.reference,D,et]),ad=x.useMemo(()=>Wr(lf,rd.floating),[rd.floating]),ab=x.useMemo(()=>Wr(Vl.floating,xc.floating),[Vl.floating,xc.floating]),lb=x.useMemo(()=>{const Me=Vl.item;return Me?{...Me,onFocus:void 0}:fn},[Vl.item]);et.useContextCallback("setOpen",Mt),et.useContextCallback("setInputValue",Vr),et.useContextCallback("setSelectedValue",hc),et.useContextCallback("setIndices",Ur),et.useContextCallback("handleSelection",ed),et.useContextCallback("forceMount",Hl),et.useContextCallback("requestSubmit",td),et.useContextCallback("onOpenChangeComplete",a),RE(()=>{et.update({inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb})});const bc={id:Ce,selectedValue:jt,open:rn,mounted:$o,transitionStatus:Lp,items:ve,inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb,openMethod:nb,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,modal:$,autoHighlight:wt,isItemEqualToValue:Q,submitOnItemClick:le,hasInputValue:ls};De(()=>{et.update({...bc,inputOwnsFormValue:y==="none"&&(X||!et.state.inputInsidePopup)})},[et,...Object.values(bc)]);const pa=ea(T,fe.inputRef),Fp=x.useMemo(()=>({query:dr,hasItems:Tt,filteredItems:Vo,flatFilteredValues:As}),[dr,Tt,Vo,As]),$p=x.useMemo(()=>Array.isArray(_l)?"":ka(_l,z),[_l,z]),Go=Rn&&Array.isArray(jt)&&jt.length>0,al=Rn||y==="none"&&Ll?void 0:Vn,ob=x.useMemo(()=>!Rn||!Array.isArray(jt)||!Vn?null:jt.map(Me=>{const Be=ka(Me,z);return s.jsx("input",{type:"hidden",form:j,name:Vn,value:Be,disabled:Un},Be)}),[Rn,jt,j,Vn,z,Un]),qp=s.jsxs(x.Fragment,{children:[e.children,s.jsx("input",{...fe.getValidationProps(Un,{onFocus(){if(ar){dc?.focus();return}(ot.current||dc)?.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented||Un||N)return;const Be=Me.currentTarget.value,lt=Be.toLowerCase(),Yt=Fe(Yn,Me.nativeEvent),On=()=>Ft.current.findIndex(Mn=>ka(Mn,z).toLowerCase()===lt||xe(Mn).toLowerCase()===lt);function mn(){if(Rn)return;if(y==="none"){Vr(Be,Yt);return}let Mn=On();Mn===-1&&(Mn=Ft.current.findIndex((kr,ma)=>{const $r=Ct.current[ma];return $r!=null&&$r.toLowerCase()===lt}));const ps=Mn===-1?void 0:Ft.current[Mn];ps!=null&&hc?.(ps,Yt)}Jt&&(Hl(),ke&&On()===-1&&et.set("forceMounted",!0)),queueMicrotask(mn)}}),id:Ce&&al==null?`${Ce}-hidden-input`:void 0,form:j,name:al,autoComplete:G,disabled:Un,required:k&&!Go,readOnly:N,value:$p,ref:pa,style:al?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ob]});return s.jsx(ZE.Provider,{value:et,children:s.jsx(WE.Provider,{value:gc,children:s.jsx(eA.Provider,{value:Tt,children:s.jsx(JE.Provider,{value:Fp,children:s.jsx(tA.Provider,{value:wn,children:qp})})})})})}function L6(e){const{multiple:t=!1,defaultValue:a,value:o,onValueChange:c,autoComplete:d,...f}=e;return s.jsx(_6,{...f,selectionMode:t?"multiple":"single",selectedValue:o,defaultSelectedValue:a,onSelectedValueChange:c,formAutoComplete:d})}const z6="data-popup-side",B6="data-list-empty",lA={...$v,...wi,popupSide:e=>e?{[z6]:e}:null,listEmpty:e=>e?{[B6]:""}:null},H6=x.createContext(void 0);function U6(){return x.useContext(H6)}const oA=x.createContext(void 0);function rw(e){const t=x.useContext(oA);if(t===void 0&&!e)throw new Error(on(21));return t}const iA=x.forwardRef(function(t,a){const o=Ca(),{buttonRef:c,getButtonProps:d}=Jr({native:!1}),f=ea(a,c);function p(b){o.context.setOpen(!1,Fe(oy,b.nativeEvent,b.currentTarget))}const h=d({onClick:p});return s.jsx("span",{ref:f,...h,"aria-label":"Dismiss",tabIndex:void 0,style:Zc})});function cA(e){const t=e.useState("mounted"),a=e.useState("popupSide"),o=e.useState("positionerElement");return t&&o?a:null}function zh(){return pf().filteredItems.length===0}function V6(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function F6(e,t){const a=e>=t-1?t-2:e;return a>=0?a:void 0}function uA(e,t,a){const o=e.context.listRef.current[t];o&&(e.context.selectionEventRef.current=a,o.click(),e.context.selectionEventRef.current=null)}const $6=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,id:f,style:p,...h}=t,{state:b,disabled:y,setTouched:v,setFocused:w,validationMode:j,validation:S}=Sa(),{labelId:N}=vl(),k=U6(),D=!!rw(!0),C=Ca(),A=nA(),R=cf(),I=C.useState("required"),P=C.useState("disabled"),O=C.useState("readOnly"),_=C.useState("name"),L=C.useState("form"),H=C.useState("selectionMode"),B=C.useState("autoHighlight"),z=C.useState("inputProps"),Q=C.useState("triggerProps"),K=C.useState("open"),X=C.useState("mounted"),q=C.useState("selectedValue"),$=C.useState("id"),Y=C.useState("inline"),F=C.useState("modal"),G=!!B,W=cA(C),le=y||P||d,M=zh(),U=D||Y,Z=!U||F,ae=Na(f??(U?void 0:$)),ce=D?KC:b,[J,ie]=x.useState(null),ge=x.useRef(!1),ee=x.useRef(null),fe=x.useRef(!1),te=H==="none"&&!D,Ce=Ie(je=>{const xe=D||C.state.inline;xe&&!C.state.hasInputValue&&C.context.setInputValue("",Fe(Yn)),C.update({inputElement:je,inputInsidePopup:xe,inputOwnsFormValue:te})}),re=D?h:S.getValidationProps(le,h);function de(){C.context.setIndices({activeIndex:null,selectedIndex:null,type:C.context.keyboardActiveRef.current?k1:C1})}function ke(){C.context.keyboardActiveRef.current=!1}const Ee={...ce,open:K,disabled:le,readOnly:O,popupSide:W,listEmpty:M};function ve(je){if(!k)return;let xe;const{highlightedChipIndex:Te}=k,Oe=k.chipsRef.current.length,[Ne,_e]=V6(R);return Te!==void 0?(je.key===Ne?(je.preventDefault(),Te>0?xe=Te-1:xe=void 0):je.key===_e?(je.preventDefault(),Te0&&(je.preventDefault(),xe=Oe>0?Oe-1:void 0),xe)}const he=yt("input",t,{state:Ee,ref:[a,C.context.inputRef,Ce],props:[z,Q,{value:J??A,"aria-readonly":O||void 0,"aria-required":I||void 0,"aria-labelledby":N,disabled:le,readOnly:O,required:H==="none"?I:void 0,form:L,...te&&_&&{name:_},id:ae,onFocus(){if(w(!0),!Y||!fe.current)return;fe.current=!1;const je=ee.current;je==null||!Object.hasOwn(C.context.valuesRef.current,je)||C.context.setIndices({activeIndex:je})},onBlur(){v(!0),w(!1);const je=C.state.activeIndex;if(Y&&je!==null&&B!=="always"&&(ee.current=je,fe.current=!0,C.context.setIndices({activeIndex:null})),j==="onBlur"){const xe=H==="none"?A:q;S.commit(xe)}},onCompositionStart(je){Um||(ge.current=!0,ie(je.currentTarget.value))},onCompositionEnd(je){ge.current=!1;const xe=je.currentTarget.value;ie(null),C.context.setInputValue(xe,Fe(Jd,je.nativeEvent))},onChange(je){const xe=je.nativeEvent,Te=xe.inputType,Oe=!Te||Te==="insertReplacementText",Ne=ge.current||!Oe;function _e(Rt){O||le||!Rt||!Ne||(C.context.setOpen(!0,Fe(Jd,xe)),G||de())}if(ge.current){const Rt=je.currentTarget.value;ie(Rt),Rt===""&&!C.state.openOnInputClick&&!C.state.inputInsidePopup&&C.context.setOpen(!1,Fe(Ka,xe));const ot=Rt.trim(),qn=G&&ot!=="";_e(ot),K&&C.state.activeIndex!==null&&!qn&&de();return}const Ye=Fe(Jd,xe);if(C.context.setInputValue(je.currentTarget.value,Ye),Ye.isCanceled)return;const kt=je.currentTarget.value==="",Ct=Fe(Ka,xe);kt&&!C.state.inputInsidePopup&&(H==="single"&&C.context.setSelectedValue(null,Ct),C.state.openOnInputClick||C.context.setOpen(!1,Ct)),_e(je.currentTarget.value.trim()),K&&C.state.activeIndex!==null&&!G&&de()},onKeyDown(je){if(je.ctrlKey||je.shiftKey||je.altKey||je.metaKey)return;if(C.context.keyboardActiveRef.current=!0,le||O){O&&je.key==="Enter"&&K&&C.state.activeIndex!==null&&ks(je);return}const xe=je.currentTarget,Te=xe.scrollWidth-xe.clientWidth,Oe=R==="rtl";if(je.key==="Home"){ks(je);const Ye=e1&&Oe?xe.value.length:0;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=0;return}if(je.key==="End"){ks(je);const Ye=e1&&Oe?0:xe.value.length;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=Oe?-Te:Te;return}if(!X&&je.key==="Escape"){const Ye=H==="multiple"&&Array.isArray(q)?q.length===0:q===null,kt=Fe(Xc,je.nativeEvent),Ct=H==="multiple"?[]:null;C.context.setInputValue("",kt),C.context.setSelectedValue(Ct,kt),!Ye&&!C.state.inline&&!kt.isPropagationAllowed&&je.stopPropagation();return}if(k&&je.key==="Backspace"&&xe.value===""&&k.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ye=k.chipsRef.current.length,kt=Ye>0?Ye-1:q.length-1,Ct=q.filter((Rt,ot)=>ot!==kt);de(),C.context.setSelectedValue(Ct,Fe(Yn,je.nativeEvent));return}const Ne=k?.highlightedChipIndex!==void 0,_e=ve(je);if(k?.setHighlightedChipIndex(_e),_e!==void 0?k?.chipsRef.current[_e]?.focus():Ne&&C.context.inputRef.current?.focus(),je.which!==229&&je.key==="Enter"&&K){const Ye=C.state.activeIndex,kt=je.nativeEvent;if(Ye===null){if(Y)return;C.context.setOpen(!1,Fe(Yn,kt));return}ks(je),uA(C,Ye,kt)}},onPointerMove:ke,onPointerDown:ke},re],stateAttributesMapping:lA}),ye=D?s.jsx(XC.Provider,{value:YC,children:he}):he;return s.jsxs(x.Fragment,{children:[K&&Z&&s.jsx(iA,{ref:C.context.startDismissRef}),ye]})}),q6=x.forwardRef(function(t,a){const{render:o,className:c,nativeButton:d=!0,disabled:f=!1,id:p,style:h,...b}=t,{state:y,disabled:v,setTouched:w,setFocused:j,validationMode:S,validation:N}=Sa(),{labelId:k}=vl(),T=Ca(),D=T.useState("selectionMode"),C=T.useState("disabled"),A=T.useState("readOnly"),R=T.useState("required"),I=T.useState("positionerElement"),P=T.useState("listElement"),O=T.useState("popupId"),_=T.useState("triggerProps"),L=T.useState("inputInsidePopup"),H=T.useState("id"),B=T.useState("labelId"),z=T.useState("open"),Q=T.useState("selectedValue"),K=T.useState("activeIndex"),X=T.useState("selectedIndex"),q=T.useState("hasSelectedValue"),$=Lh(),Y=nA(),F=Zs(),G=v||C||f,W=zh(),le=cA(T);lo({id:L?p:void 0});const M=L?p??H:p,U=UE(k,B);let Z;z&&L?Z=O??sA(H):z&&(Z=P?.id);const ae=x.useRef("");function ce(re){ae.current=re.pointerType}const{reference:J}=UT($,{enabled:!z&&!A&&!C&&D==="single",listRef:T.context.labelsRef,activeIndex:K,selectedIndex:X,onMatch(re){const de=T.context.valuesRef.current[re];de!==void 0&&T.context.setSelectedValue(de,Fe(Yn))}}),{reference:ie}=ih($,{enabled:!C,event:"mousedown"}),{buttonRef:ge,getButtonProps:ee}=Jr({native:d,disabled:G}),fe={...y,readOnly:A,open:z,disabled:G,popupSide:le,listEmpty:W,placeholder:D==="none"?!1:!q},te=Ie(re=>{T.set("triggerElement",re)});return yt("button",t,{ref:[a,ge,te],state:fe,props:[_,ie,J,{id:M,tabIndex:L?0:-1,role:L?"combobox":void 0,"aria-expanded":z,"aria-haspopup":L?"dialog":"listbox","aria-controls":Z,"aria-required":L&&R||void 0,"aria-readonly":L&&A||void 0,"aria-labelledby":U,onPointerDown:ce,onPointerEnter:ce,onFocus(){j(!0),!G&&F.start(0,T.context.forceMount)},onBlur(re){if(!Qe(I,re.relatedTarget)&&(w(!0),j(!1),S==="onBlur")){const de=D==="none"?Y:Q;N.commit(de)}},onMouseDown(re){if(G||(L||$.set("domReferenceElement",re.currentTarget),T.context.forceMount(),ae.current!=="touch"&&(T.context.inputRef.current?.focus(),L||re.preventDefault()),z))return;const de=$t(re.currentTarget);function ke(Ee){const ve=T.state.triggerElement;if(!ve)return;const he=cs(Ee),ye=T.state.positionerElement,je=T.state.listElement;Qe(ve,he)||Qe(ye,he)||Qe(je,he)||VE(Ee,ve)||T.context.setOpen(!1,Fe(T1,Ee))}L&&de.addEventListener("mouseup",ke,{once:!0})},onKeyDown(re){(re.key==="ArrowDown"||re.key==="ArrowUp")&&(ks(re),T.context.setOpen(!0,Fe(iy,re.nativeEvent)),T.context.inputRef.current?.focus())}},N.getValidationProps(G,b),ee],stateAttributesMapping:lA})}),G6=x.createContext(null);function K6(){return x.useContext(G6)}function Y6(e){const{children:t}=e,{filteredItems:a}=pf(),o=K6(),c=o?o.items:a;return s.jsx(x.Fragment,{children:c.map(t)})}const X6=x.forwardRef(function(t,a){var o;const{render:c,className:d,style:f,children:p,...h}=t,b=Ca(),y=Lh(),v=!!rw(!0),{filteredItems:w,hasItems:j}=pf(),S=b.useState("selectionMode"),N=b.useState("grid"),k=b.useState("readOnly"),T=b.useState("listProps"),D=b.useState("virtualized"),C=b.useState("forceMounted"),A=S==="multiple",R=w.length===0,I=Ie(z=>{b.set("positionerElement",z)}),P=Ie(z=>{b.set("listElement",z)}),O=x.useMemo(()=>typeof p=="function"?o||(o=s.jsx(Y6,{children:p})):p,[p]),_={empty:R},L=y.useState("floatingId"),H=yt("div",t,{state:_,ref:[a,P,v?null:I],props:[T,{children:O,tabIndex:-1,id:L,role:N?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!N&&k?!0:void 0,onKeyDown(z){if(!(b.state.disabled||b.state.readOnly)&&z.key==="Enter"){const Q=b.state.activeIndex;if(Q==null)return;ks(z),uA(b,Q,z.nativeEvent)}},onKeyDownCapture(){b.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){b.context.keyboardActiveRef.current=!1}},h]});if(D)return H;const B=j&&!C?void 0:b.context.labelsRef;return s.jsx(Wy,{elementsRef:b.context.listRef,labelsRef:B,children:H})}),Q6="⁠",Z6=200;function W6(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let a=null;for(;t.nextNode();){const o=t.currentNode;o.nodeValue!==""&&(a=o)}return a}function J6(){const e=Zs(),t=x.useRef(null);return x.useEffect(()=>{if(Yd)return;const a=t.current;if(a==null)return;const o=W6(a);if(o==null)return;const c=o.data,d=`${c}${Q6}`;return o.nodeValue=d,e.start(Z6,()=>{o.nodeValue===d&&(o.nodeValue=c)}),()=>{e.clear(),o.nodeValue===d&&(o.nodeValue=c)}},[t,e]),t}const dA=x.createContext(void 0);function eF(){const e=x.useContext(dA);if(e===void 0)throw new Error(on(20));return e}const tF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=Ca(),f=d.useState("mounted"),p=d.useState("forceMounted");return f||o||p?s.jsx(dA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),nF=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N=!1,collisionAvoidance:k=X1,style:T,...D}=t,C=Ca(),A=Lh(),R=eF(),I=C.useState("modal"),P=C.useState("open"),O=C.useState("mounted"),_=C.useState("openMethod"),L=C.useState("positionerElement"),H=C.useState("triggerElement"),B=C.useState("inputElement"),z=C.useState("inputGroupElement"),Q=C.useState("inputInsidePopup"),K=C.useState("transitionStatus"),X=zh(),$=yh({anchor:d??(Q?H:z??B),floatingRootContext:A,positionMethod:f,mounted:O,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N,keepMounted:R,collisionAvoidance:k,lazyFlip:!0});tw(P&&I,_==="touch",L,H);const Y={open:P,side:$.side,align:$.align,anchorHidden:$.anchorHidden,empty:X};De(()=>{C.set("popupSide",$.side)},[C,$.side]);const F=Ie(W=>{C.set("positionerElement",W)}),G=wh(t,Y,{styles:$.positionerStyles,transitionStatus:K,props:D,refs:[a,F],hidden:!O,inert:!P});return s.jsxs(oA.Provider,{value:$,children:[O&&I&&s.jsx(kh,{inert:jh(!P),cutout:z??B??H}),G]})}),sF={...$c,...oo},rF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=Ca(),y=rw(),v=Lh(),w=b.useState("mounted"),j=b.useState("open"),S=b.useState("openMethod"),N=b.useState("popupProps"),k=b.useState("transitionStatus"),T=b.useState("inputInsidePopup"),D=b.useState("inputElement"),C=b.useState("modal"),A=b.useState("id"),R=zh(),I=h.id??(T?sA(A):void 0);De(()=>(b.set("popupId",b.context.popupRef.current?.id||I),()=>{b.set("popupId",void 0)}),[b,I]),ra({open:j,ref:b.context.popupRef,onComplete(){j&&b.context.onOpenChangeComplete(!0)}});const P={open:j,side:y.side,align:y.align,anchorHidden:y.anchorHidden,transitionStatus:k,empty:R},O=yt("div",t,{state:P,ref:[a,b.context.popupRef],props:[N,{id:I,role:T?"dialog":"presentation",onFocus(z){const Q=cs(z.nativeEvent);S!=="touch"&&(Qe(b.state.listElement,Q)||Q===z.currentTarget)&&b.context.inputRef.current?.focus()}},uf(k),h],stateAttributesMapping:sF}),L=f===void 0?T?z=>z==="touch"?b.context.popupRef.current:D:!1:f;let H;p!=null?H=p:H=T?void 0:!1;const B=!T||C;return s.jsx(oh,{context:v,disabled:!w,modal:B,openInteractionType:S,initialFocus:L,returnFocus:H,getInsideElements:()=>[b.context.startDismissRef.current,b.context.endDismissRef.current],children:s.jsxs(x.Fragment,{children:[O,B&&s.jsx(iA,{ref:b.context.endDismissRef})]})})}),aF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t;return yt("span",t,{ref:a,props:[{"aria-hidden":!0,children:"▼"},f]})}),fA=x.createContext(void 0);function pA(){const e=x.useContext(fA);if(!e)throw new Error(on(19));return e}const lF=x.createContext(!1);function oF(){return x.useContext(lF)}function mA(e){const{componentProps:t,forwardedRef:a,virtualized:o,indexFromFilter:c}=e,{render:d,className:f,style:p,value:h=null,index:b,disabled:y=!1,nativeButton:v=!1,...w}=t,j=x.useRef(null),S=Zy({guess:!0,index:b,textRef:j}),N=Ca(),k=oF(),T=A6(),D=N.useState("selectionMode"),C=N.useState("disabled"),A=N.useState("readOnly"),R=N.useState("isItemEqualToValue"),I=C||y,P=D!=="none",O=b??c??S.index,_=O!==-1,L=N.useState("id"),H=N.useState("isActive",O),B=N.useState("isSelected",h),z=N.useState("itemProps"),Q=x.useRef(null),K=L!=null&&_?`${L}-${O}`:void 0,X=B&&P;De(()=>{if(!(_&&(o||b!=null)))return;const U=N.context.listRef.current;return U[O]=Q.current,()=>{delete U[O]}},[_,o,O,b,N]),De(()=>{if(!_||T)return;const M=N.context.valuesRef.current;return M[O]=h,()=>{delete M[O]}},[_,T,O,h,N]),De(()=>{if(!_||T)return;const M=N.state.selectedValue;let U=N.state.selectedIndex;N.state.selectionMode==="multiple"&&Array.isArray(M)?U=_E(O,h,N.context.valuesRef.current,M,R,U):la(h,M,R)&&(U=O),N.set("selectedIndex",U)},[_,T,N,O,h,R]);const{getButtonProps:q,buttonRef:$}=Jr({disabled:I,focusableWhenDisabled:!0,native:v,composite:!0}),Y={disabled:I,selected:X,highlighted:H};function F(M){function U(){N.context.handleSelection(M,h)}N.state.submitOnItemClick?(Cs.flushSync(U),N.context.requestSubmit()):U()}const G={id:K,role:k?"gridcell":"option","aria-selected":P?X:void 0,tabIndex:void 0,onPointerDownCapture(M){M.isPrimary&&(N.context.pointerDownItemRef.current=M.currentTarget),M.preventDefault()},onMouseDown(M){M.preventDefault()},onClick(M){I||A||F(M.nativeEvent)},onMouseUp(M){const U=N.context.pointerDownItemRef.current===M.currentTarget;N.context.pointerDownItemRef.current=null,!(I||A||M.button!==0||U||!H)&&F(M.nativeEvent)}},W=yt("div",t,{ref:[$,a,S.ref,Q],state:Y,props:[z,G,w,q]}),le=x.useMemo(()=>({selected:X,textRef:j}),[X,j]);return s.jsx(fA.Provider,{value:le,children:W})}function iF(e){const{componentProps:t,forwardedRef:a}=e,c=Ca().useState("isItemEqualToValue"),{flatFilteredValues:d}=pf(),f=t.value??null,p=su(d,f,c);return s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:!0,indexFromFilter:p})}const cF=x.memo(x.forwardRef(function(t,a){const c=Ca().useState("virtualized");return c&&t.index==null?s.jsx(iF,{componentProps:t,forwardedRef:a}):s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:c,indexFromFilter:void 0})})),uF=x.forwardRef(function(t,a){const{selected:o}=pA();return t.keepMounted||o?s.jsx(dF,{...t,ref:a}):null}),dF=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=pA(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),fF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,...p}=t,{filteredItems:h}=pf(),b=Ca(),y=J6(),v=h.length===0?f:null;return yt("div",t,{ref:[a,b.context.emptyRef,y],props:[{children:v,role:"status","aria-live":"polite","aria-atomic":!0},p]})}),pF="、";function Bh({value:e,onValueChange:t,options:a,placeholder:o="",emptyHint:c=go("没有匹配的选项"),searchPlaceholder:d=go("搜索…"),disabled:f=!1,className:p,id:h,title:b,...y}){const v=x.useMemo(()=>a.filter(j=>e.includes(j.value)),[a,e]),w=v.length?v.map(j=>j.label).join(pF):o;return s.jsxs(L6,{items:a,multiple:!0,value:v,onValueChange:j=>t(j.map(S=>S.value)),isItemEqualToValue:(j,S)=>j?.value===S?.value,disabled:f,children:[s.jsxs(q6,{"data-slot":"multi-select-trigger",id:h,title:b,"aria-label":y["aria-label"],className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",p),children:[s.jsx("span",{"data-slot":"multi-select-value",className:"min-w-0 flex-1 truncate text-left data-[placeholder]:text-muted-foreground","data-placeholder":v.length?void 0:"",title:w,children:w}),s.jsx(aF,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),s.jsx(tF,{children:s.jsx(nF,{sideOffset:4,className:"z-[35]",children:s.jsxs(rF,{"data-slot":"multi-select-content",className:Ue("flex max-h-[280px] w-[max(var(--anchor-width),220px)] flex-col overflow-hidden","rounded-lg border border-border-strong bg-raised shadow-3 outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0"),children:[s.jsxs("div",{className:"flex flex-none items-center gap-1.5 border-b border-hairline px-2.5 py-1.5",children:[s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-3 flex-none text-muted-foreground","aria-hidden":"true",children:[s.jsx("circle",{cx:"5",cy:"5",r:"3.4",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),s.jsx("path",{d:"M7.6 7.6 10.5 10.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),s.jsx($6,{placeholder:d,className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-[12.5px] text-foreground outline-none placeholder:text-muted-foreground"})]}),s.jsx(fF,{children:s.jsx("div",{className:"px-2.5 py-3 text-[11.5px] leading-[1.5] text-muted-foreground",children:c})}),s.jsx(X6,{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-[5px]",children:j=>s.jsxs(cF,{value:j,className:Ue("grid cursor-pointer grid-cols-[14px_minmax(0,1fr)] items-center gap-2 rounded-sm px-[9px] py-[5px]","text-[12.5px] leading-[1.4] text-foreground select-none outline-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:text-muted-foreground"),children:[s.jsx(uF,{className:"col-start-1 flex text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("span",{className:"col-start-2 min-w-0 truncate",children:j.label})]},j.value)})]})})})]})}const hA=x.createContext(void 0);function mf(e){const t=x.useContext(hA);if(t===void 0&&!e)throw new Error(on(47));return t}const mF={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class hF extends tu{constructor(a,o,c){const d=new fh;super(gF(a,d,o,c),xF(d),mF);ln(this,"setOpen",(a,o)=>{const c=o.reason===Vs,d=o.reason===mo&&o.event.detail===0,f=!a&&(o.reason===Xc||o.reason==null),p=AT(o),h=this.select("activeTriggerId");if(!a&&o.reason===oy&&o.trigger==null&&h!=null&&(o.trigger=this.context.triggerElements.getById(h)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(a,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,o);const b=()=>{const v=Ry(this.state,a,o.trigger,p());v.openChangeReason=o.reason,this.update(v)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(J4,()=>{this.set("stickIfOpen",!1)}),Cs.flushSync(b)):b();let y;d?y="click":f?y="dismiss":o.reason===ho&&(y="focus"),this.set("instantType",y)})}}function gF(e,t,a,o=!1){const c={...Iy(t,a,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return c.open&&e?.mounted===void 0&&(c.mounted=!0),c}function xF(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new sa,triggerElements:e}}const gA=sh(function({props:t}){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,modal:p=!1,handle:h,triggerId:b,defaultTriggerId:y=null}=t,v=vF(h,{modal:p,open:c,openProp:o,activeTriggerId:y,triggerIdProp:b});v.useControlledProp("openProp",o),v.useControlledProp("triggerIdProp",b);const w=v.useState("open"),j=v.useState("mounted"),S=v.useState("payload");v.useContextCallback("onOpenChange",d),v.useContextCallback("onOpenChangeComplete",f),OT(v,w),Oy(v);const{forceUnmount:N}=My(w,v,()=>{v.update({stickIfOpen:!0,openChangeReason:null})});v.useSyncedValues({modal:p}),x.useEffect(()=>{w||v.context.stickIfOpenTimeout.clear()},[v,w]),x.useImperativeHandle(t.actionsRef,()=>({unmount:N,close:()=>v.setOpen(!1,Fe(cy))}),[N,v]);const k=w||j;return s.jsxs(hA.Provider,{value:v,children:[h&&s.jsx(Ay,{handle:h,store:v}),k&&s.jsx(yF,{store:v,modal:p}),typeof a=="function"?a({payload:S}):a]})});function bF(e){return mf(!0)?s.jsx(gA,{props:e}):s.jsx(lH,{children:s.jsx(gA,{props:e})})}function vF(e,t){const a=Ey((o,c)=>new hF(t,o,c));return x.useEffect(()=>a.context.stickIfOpenTimeout.disposeEffect(),[a]),a}function yF({store:e,modal:t}){const a=e.useState("floatingRootContext"),o=af(a,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),c=o.reference,d=o.floating;return Dy(e,{activeTriggerProps:c,inactiveTriggerProps:c,popupProps:d}),null}const wF=300;function jF(e,t){const a=x.useRef(null);function o(d){Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))}),e4(a.current)?.focus()}function c(d){const f=e.select("positionerElement");if(f&&Gc(d,f))e.context.beforeContentFocusGuardRef.current?.focus();else{Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))});let p=JB(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(f,p);){const h=p;if(p=ry(p),p===h)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}const SF=L1(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,handle:h,payload:b,openOnHover:y=!1,delay:v=wF,closeDelay:w=0,id:j,...S}=t,N=mf(!0),T=IT(h)??N;if(!T)throw new Error(on(74));const D=Na(j),C=T.useState("isTriggerActive",D),A=T.useState("floatingRootContext"),R=T.useState("isOpenedByTrigger",D),I=T.useState("triggerPopupId",D),P=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:_}=RT(D,P,T,{payload:b,disabled:f,openOnHover:y,closeDelay:w}),L=T.useState("openChangeReason"),H=T.useState("stickIfOpen"),B=T.useState("openMethod"),z=T.useState("focusManagerModal"),Q=zT(A,{enabled:!f&&y&&(B!=="touch"||L!==mo),mouseOnly:!0,move:!1,handleClose:FT(),restMs:v,delay:{close:w},triggerElementRef:P,isActiveTrigger:C,isClosing:()=>T.select("transitionStatus")==="ending"}),K=ih(A,{stickIfOpen:H}),X=bE(()=>T.select("open"),ae=>{T.set("openMethod",ae)}),q=T.useState("triggerProps",_),{getButtonProps:$,buttonRef:Y}=Jr({disabled:f,native:p}),F={open(ae){return ae&&L===mo?$v.open(ae):Fv.open(ae)}},{preFocusGuardRef:G,handlePreFocusGuardFocus:W,handleFocusTargetFocus:le}=jF(T,P),U=yt("button",t,{state:{disabled:f,open:R},ref:[Y,a,O,P],props:[K.reference,Q,q,X,{[Y1]:"",id:D,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":I},S,$],stateAttributesMapping:F}),Z=s.jsx(x.Fragment,{children:U},D);return _&&!z?s.jsxs(x.Fragment,{children:[s.jsx(Wc,{ref:G,onFocus:W}),Z,s.jsx(Wc,{ref:T.context.triggerFocusTargetRef,onFocus:le})]}):Z}),xA=x.createContext(void 0);function NF(){const e=x.useContext(xA);if(e===void 0)throw new Error(on(45));return e}const kF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return mf().useState("mounted")||o?s.jsx(xA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),bA=x.createContext(void 0);function CF(){const e=x.useContext(bA);if(!e)throw new Error(on(46));return e}const TF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,anchor:f,positionMethod:p,side:h,align:b,sideOffset:y,alignOffset:v,collisionBoundary:w="clipping-ancestors",collisionPadding:j,arrowPadding:S,sticky:N,disableAnchorTracking:k=!1,collisionAvoidance:T=Q1,...D}=t,C=mf(),A=NF(),R=rH(),I=C.useState("floatingRootContext"),P=C.useState("mounted"),O=C.useState("open"),_=C.useState("openChangeReason"),L=C.useState("activeTriggerElement"),H=C.useState("modal"),B=C.useState("openMethod"),z=C.useState("positionerElement"),Q=C.useState("instantType"),K=C.useState("transitionStatus"),X=C.useState("adaptiveOrigin"),q=x.useRef(null),$=N1(z),Y=yh({anchor:f,floatingRootContext:I,positionMethod:p,mounted:P,side:h,sideOffset:y,align:b,alignOffset:v,arrowPadding:S,collisionBoundary:w,collisionPadding:j,sticky:N,disableAnchorTracking:k,keepMounted:A,nodeId:R,collisionAvoidance:T,adaptiveOrigin:X}),F=I.useState("domReferenceElement");De(()=>{const U=F,Z=q.current;if(U&&(q.current=U),Z&&U&&U!==Z){C.set("instantType",void 0);const ae=new AbortController;return $(()=>{C.set("instantType","trigger-change")},ae.signal),()=>{ae.abort()}}},[F,$,C]);const G=H===!0&&_!==Vs;tw(O&&G,B==="touch",z,L);const W=C.useStateSetter("positionerElement"),le={open:O,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,instant:Q},M=wh(t,le,{styles:Y.positionerStyles,transitionStatus:K,props:D,refs:[a,W],hidden:!P,inert:!O});return s.jsxs(bA.Provider,{value:Y,children:[P&&G&&s.jsx(kh,{inert:jh(!O),cutout:L}),s.jsx(aH,{id:R,children:M})]})}),EF=x.createContext(void 0);function AF(){const[e,t]=x.useState(0),a=Ie(()=>(t(c=>c+1),()=>{t(c=>Math.max(0,c-1))}));return{context:x.useMemo(()=>({register:a}),[a]),hasClosePart:e>0}}const RF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=mf(),y=CF(),v=qE()!=null,{context:w,hasClosePart:j}=AF(),S=b.useState("open"),N=b.useState("openMethod"),k=b.useState("instantType"),T=b.useState("transitionStatus"),D=b.useState("popupProps"),C=b.useState("titleElementId"),A=b.useState("descriptionElementId"),R=b.useState("modal"),I=b.useState("mounted"),P=b.useState("openChangeReason"),O=b.useState("activeTriggerElement"),_=b.useState("floatingRootContext"),L=_.useState("floatingId"),H=b.useState("disabled"),B=b.useState("openOnHover"),z=b.useState("closeDelay");ra({open:S,ref:b.context.popupRef,onComplete(){S&&b.context.onOpenChangeComplete?.(!0)}}),LT(_,{enabled:B&&!H,closeDelay:z});const Q=f===void 0?TT(b.context.popupRef):f,K=R!==!1&&j;b.useSyncedValue("focusManagerModal",K);const X=b.useStateSetter("popupElement"),q={open:S,side:y.side,align:y.align,instant:k,transitionStatus:T},$=yt("div",t,{state:q,ref:[a,b.context.popupRef,X],props:[D,{id:L,role:"dialog",...lf,"aria-labelledby":C,"aria-describedby":A,onKeyDown(Y){v&&Sh.has(Y.key)&&Y.stopPropagation()}},uf(T),h],stateAttributesMapping:qv});return s.jsx(oh,{context:_,openInteractionType:N,modal:K,disabled:!I||P===Vs,initialFocus:Q,returnFocus:p,restoreFocus:"popup",previousFocusableElement:dn(O)?O:void 0,nextFocusableElement:b.context.triggerFocusTargetRef,beforeContentFocusGuardRef:b.context.beforeContentFocusGuardRef,children:s.jsx(EF.Provider,{value:w,children:$})})});function hf(e){return s.jsx(bF,{"data-slot":"popover",...e})}function Hh(e){return s.jsx(SF,{"data-slot":"popover-trigger",...e})}function gf({className:e,sideOffset:t=6,align:a="start",side:o,alignOffset:c,collisionPadding:d=8,anchor:f,children:p,...h}){return s.jsx(kF,{children:s.jsx(TF,{className:"z-[35] outline-none",sideOffset:t,align:a,side:o,alignOffset:c,collisionPadding:d,anchor:f,children:s.jsx(RF,{"data-slot":"popover-content",className:Ue("flex max-h-[min(70vh,560px)] flex-col overflow-hidden rounded-lg border border-border-strong bg-raised text-foreground shadow-3","outline-none","data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-top-1","data-closed:animate-out data-closed:fade-out-0",e),...h,children:p})})})}function OF({page:e,pageCount:t,onPageChange:a,disabled:o=!1,className:c,infoFirst:d=!1}){const f=Math.max(1,Number(t)||1),p=Math.min(Math.max(1,Number(e)||1),f),h=s.jsx("span",{"data-slot":"pager-info",className:"text-[11.5px] text-subtle [font-variant-numeric:tabular-nums]",children:go("第 {current} / {total} 页",{current:p,total:f})});return s.jsxs("div",{"data-slot":"pager",className:Ue("flex items-center gap-2",c),children:[d&&h,s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p<=1,onClick:()=>a(p-1),children:go("上一页")}),s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p>=f,onClick:()=>a(p+1),children:go("下一页")}),!d&&h]})}const MF=Vc(["relative flex w-full items-center gap-2.5 text-left","border border-transparent rounded-sm","shadow-none","transition-[background-color,border-color,color] duration-150 ease-out","outline-none focus-visible:shadow-focus","disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:["cursor-pointer px-2.5 py-2","text-[12.5px] font-medium text-sidebar-fg","hover:bg-nav-hover hover:text-foreground","data-[active]:border-nav-selected-border data-[active]:bg-nav-selected-bg data-[active]:font-semibold data-[active]:text-nav-selected-fg"],add:["cursor-pointer justify-center px-2 py-1.5","border-dashed border-border-strong bg-transparent","text-[11.5px] text-muted-foreground","hover:border-primary hover:text-primary-fg"]}},defaultVariants:{variant:"default"}});function ru({className:e,variant:t,active:a=!1,count:o,icon:c,trailing:d,children:f,...p}){return s.jsxs("button",{type:"button","data-slot":"nav-item","data-active":a?"":void 0,"aria-current":a?"true":void 0,className:Ue(MF({variant:t}),e),...p,children:[c,s.jsx("span",{"data-slot":"nav-item-label",className:"min-w-0 flex-1 truncate",children:f}),d,o!=null&&s.jsx("span",{"data-slot":"nav-item-count",className:Ue("flex-none text-[10.5px] text-sidebar-muted [font-variant-numeric:tabular-nums]",a&&"text-inherit"),children:o})]})}function r(e,t){const a=typeof window<"u"?window.wbI18n:void 0;return a&&typeof a.t=="function"?a.t(e,t):e}function Uh(e){if(e.source==="subscription"&&(e.port===null||e.port===void 0))return r("未分配端口");const t=e.resolved;return t?.protocol&&t.host&&t.port?`${String(t.protocol).toUpperCase()} ${t.host}:${t.port}`:t?.label||""}function au(e){const t=e.name||e.id,o=[e.resolveError?r("解析失败"):Uh(e),e.enabled===!1?r("已禁用"):""].filter(Boolean);return o.length?r("{name}({parts})",{name:t,parts:o.join(" · ")}):t}const Xa="pool:";function Pe(){return window}function Le(e,t){Pe().wbApp?.toast?.(e,t)}function Qa(e){const t=Pe().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function Fs(e){const t=Pe().wbApp?.formatTime;if(t)return t(e);const a=Number(e);return!Number.isFinite(a)||a<=0?"":new Date(a).toLocaleString("zh-CN")}function ut(e){return e instanceof Error?e.message:String(e)}function lu(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function aw(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const a=o=>String(o).padStart(2,"0");return`${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}`}function DF(e){return e==="积分"?r("积分"):e==="额度"?r("额度"):e}function IF(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e,a=Array.isArray(t.credits)?t.credits:[],o=Date.now();return a.map(c=>{const d=String(c?.name||"").trim()||r("积分包"),f=String(c?.unit||"").trim(),p=lu(c?.total),h=lu(c?.used),b=lu(c?.remain),y=c?.unlimited===!0,v=lu(c?.grantAt),w=lu(c?.startAt),j=lu(c?.expireAt),S=c?.daily===!0,N=String(c?.grantReason||"").trim(),k=j!==null&&j>0&&j<=o,T=p!==null&&p>0,D=y?r("不限"):b!==null?T?r("剩 {remaining} / {total}",{remaining:b,total:p}):r("剩 {remaining}",{remaining:b}):h!==null?r("已用 {used}",{used:h}):"—",C=!y&&f&&D!=="—"?`${D} ${DF(f)}`:D,A=T&&b!==null?Math.max(0,Math.min(100,b/p*100)):null,R=b!==null&&b<=0||b===null&&h!==null&&T&&h>=p,I=!y&&!S&&(R||k),P=[];v!==null&&v>0?P.push(r("{time} 领取",{time:aw(v)})):w!==null&&w>0&&P.push(r("{time} 生效",{time:aw(w)})),S?P.push(r("每日重置")):j!==null&&j>0&&P.push(k?r("已过期"):r("{time} 到期",{time:aw(j)})),N&&P.push(N);const O=k||b===0?"muted":A!==null&&A<20?"warn":b===null&&h===null&&!y?"muted":"ok",_=[d,C,v!==null&&v>0?r("领取 {time}",{time:Fs(v)}):w!==null&&w>0?r("生效 {time}",{time:Fs(w)}):"",j!==null&&j>0?k?r("已过期({time})",{time:Fs(j)}):r("到期 {time}",{time:Fs(j)}):"",S?r("每日重置(额度按周期回满,不是作废)"):"",N,A===null&&b!==null?r("上游未给总量,画不出剩余比例"):"",h!==null&&p!==null?r("已用 {used} / 共 {total}",{used:h,total:p}):""].filter(Boolean).join(" · ");return{name:d,view:C,tone:O,percent:A,window:P.length?P.join(" · "):null,title:_,spent:I}})}function vA({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.window?s.jsx("div",{className:"usage-pop-window",children:e.window}):null,e.percent!==null?s.jsx("span",{className:"usage-pop-track",children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function yA({rows:e,subscriptionLine:t,variant:a,kind:o,title:c,children:d}){const[f,p]=x.useState(!1),[h,b]=x.useState(!1),y=e.filter(k=>!k.spent),v=e.filter(k=>k.spent),w=a==="pool"?`usage-toggle usage-pool-line ${o}`:`usage-toggle ${o}`,j=x.useRef(null),S=x.useCallback(k=>{j.current=k,k&&(k.scrollTop=0)},[]),N=x.useCallback(()=>j.current??null,[]);return x.useLayoutEffect(()=>{if(!h)return;const k=j.current?.querySelector(".usage-pop-spent .usage-pop-row");k instanceof HTMLElement&&k.scrollIntoView({block:"nearest"})},[h]),s.jsxs(hf,{open:f,onOpenChange:p,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:w,title:c,"aria-label":r("积分明细")}),children:[a==="pool"?d:s.jsx("span",{className:"val",children:d}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsx(gf,{align:"end",sideOffset:6,className:"w-[320px]",initialFocus:N,children:s.jsxs("div",{className:"usage-pop-credit",ref:S,tabIndex:-1,children:[t?s.jsx("div",{className:"usage-pop-sub",children:t}):null,s.jsx("div",{className:"usage-pop-group",children:r("积分明细")}),y.map((k,T)=>s.jsx(vA,{row:k},`${k.name}-${T}`)),v.length>0?s.jsxs("div",{className:"usage-pop-spent",children:[s.jsxs("button",{type:"button",className:"usage-pop-spent-head","aria-expanded":h,title:r("展开或收起(默认收起)"),onClick:()=>b(k=>!k),children:[s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"}),s.jsx("span",{children:r("已用完 / 已过期")}),s.jsx("span",{className:"n",children:r("{count} 份",{count:v.length})})]}),h?v.map((k,T)=>s.jsx(vA,{row:k},`spent-${k.name}-${T}`)):null]}):null]})})]})}const ou="workbuddy",PF="raccoon",_F={workbuddy:{usage:!0,creditDetail:!0,edition:!0,identifier:"uid",expiry:"expiresAt"},"workbuddy-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},raccoon:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},catpaw:{usage:!0,edition:!1,identifier:"uid",expiry:"tokenExpiresAt"},autoclaw:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},"autoclaw-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!0},qoder:{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"qoder-intl":{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"cline-free":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},"cline-pass":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},accio:{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"accio-cn":{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},zcode:{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},"zcode-intl":{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},codearts:{usage:!0,usageDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt",concurrencyDefault:3},trae:{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},loomy:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt"},kuku:{usage:!0,edition:!1,identifier:"uid",expiry:""},officeace:{usage:!0,creditDetail:!0,edition:!1,identifier:"id",expiry:"expiresAt"},antigravity:{usage:!0,edition:!1,identifier:"userId",expiry:""}},LF={usage:!1,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!1};function kn(e){const t=e?.provider;return typeof t=="string"&&t?t:ou}function ir(e){return e&&_F[e]||LF}const zF="opencode",BF="https://opencode.ai/zen/go/v1";function wA(e,t){if(!e||e.clientEmulation!==zF)return!1;const o=((typeof t=="string"?t.trim():"")||String(e.baseUrl||"")).trim().replace(/\/+$/,"").toLowerCase();return o?o!==BF:!1}function HF(e){const t=e?kn(e):"";return t.startsWith("custom-")&&(Pe().wbProviders?.customList?.()||[]).find(o=>o?.id===t)||null}function UF(e){return e?wA(HF(e),e.baseUrl):!1}function jA(e){const t=Array.isArray(e?.providers)?e.providers:[],a=Array.isArray(e?.accounts)?e.accounts:[],o=new Map;a.forEach(d=>{const f=kn(d);o.set(f,(o.get(f)||0)+1)});const c=new Map;return t.forEach(d=>{d?.id&&c.set(String(d.id),{id:String(d.id),label:String(d.label||d.id),count:Number(d.count)||0})}),o.forEach((d,f)=>{c.has(f)||c.set(f,{id:f,label:Pe().wbProviders?.labelOf?.(f)||f,count:d})}),c.size||c.set(ou,{id:ou,label:Pe().wbProviders?.labelOf?.(ou)||"WorkBuddy 国内版",count:0}),[...c.values()]}function Vh(e){const t=ir(kn(e)).identifier;return String(e?.[t]||"")}function SA(e){const t=Number(e)||0;return t<=0?0:t<1e11?t*1e3:t}function VF(e){const t=ir(kn(e)).expiry;return SA(e?.[t])}function Ta(e){const t=kn(e);return t.startsWith("custom-")?!!e?.balanceQuery?.scheme:ir(t).usage}const lw=30,NA=86400,kA=60,CA=1800,TA=86400,EA=1,FF=95e5;function $F(e){return e==="codearts"?[{type:"token",action:"skip",threshold:FF,reset:"daily",enabled:!0}]:e==="cline-free"?[]:[{type:"balance",action:"skip",threshold:EA,enabled:!0}]}function AA(e){const t=e?.usageQuery;if(!t||typeof t!="object")return{enabled:!0,interval:kA};const a=t.enabled===void 0?!0:t.enabled===!0,o=Number(t.interval)||0,c=o>=lw&&o<=NA;return{enabled:a,interval:a&&!c?kA:o}}function qF(e){if(!e||typeof e!="object")return!1;const t=e;if(t.type!=="balance"&&t.type!=="token"||t.action!=="skip"&&t.action!=="disable")return!1;const a=Number(t.threshold);if(!Number.isFinite(a)||a<=0)return!1;if(t.type==="token"&&t.reset!=="daily"){const o=Number(t.period);if(!Number.isInteger(o)||oTA)return!1}return!0}function GF(e){const t=e?.lowBalance;if(!t||typeof t!="object"||!t.mode)return $F(kn(e));const a=Number(t.threshold),o=Number.isFinite(a)&&a>0?a:EA;return t.mode!=="skip"&&t.mode!=="disable"?[]:[{type:"balance",action:t.mode,threshold:o,enabled:!0}]}function iu(e){const t=e?.limiters;return Array.isArray(t)?t.filter(qF):GF(e)}function KF(e){return iu(e).filter(t=>t.type==="token")}function YF(e,t){const a=t*1e3;return e-e%a}function RA(e){return e.reset==="daily"?0:e.period??0}function ow(e,t=Date.now()){if(e===0){const a=new Date(t);return a.setHours(0,0,0,0),a.getTime()}return YF(t,e)}function xf(e,t,a=Date.now()){if(e.type!=="token")return null;const o=RA(e),c=(t||[]).find(d=>Number(d.kind)===o);return c&&Number(c.windowStart)===ow(o,a)?c:null}function Fh(e,t){const a=iu(e).filter(f=>f.type==="balance"&&f.action==="skip"&&f.enabled!==!1&&f.threshold>0);if(!a.length||!t||typeof t!="object")return!1;const o=t;if(o.unlimited)return!1;const c=o.totalLeft??o.available;if(c==null||c==="")return!1;const d=Number(c);return Number.isFinite(d)&&a.some(f=>dc.type==="token"&&c.action==="skip"&&c.enabled!==!1);if(!a.length||!t?.length)return!1;const o=Date.now();return a.some(c=>{const d=xf(c,t,o);return d!==null&&Number(d.used)>=c.threshold})}function XF(e,t){return iu(e).some(a=>{if(a.type!=="token"||a.action!=="disable"||a.enabled===!1)return!1;const o=xf(a,t);return o!==null&&Number(o.used)>=a.threshold})}function cw(e,t=Date.now()){const a=RA(e),o=ow(a,t),c=a===0?Math.max(0,ow(0,o+864e5+36e5)-t):Math.max(0,o+a*1e3-t);return{kind:a,startMs:o,remainingMs:c,daily:a===0}}function $h(e,t){if(e<=0)return"";const a=Math.ceil(e/6e4);if(t){const o=Math.ceil(e/36e5);return o>=1?r("今日剩 {n} 小时",{n:o}):r("今日剩 {n} 分钟",{n:a})}return a>=1?r("剩 {n} 分钟",{n:a}):r("剩不到 1 分钟")}function Tl(e){const t=Number(e);if(!Number.isFinite(t))return"—";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(Math.round(t))}function OA(e){return e>0&&e%3600===0?r("{n} 小时",{n:e/3600}):e>0&&e%60===0?r("{n} 分钟",{n:e/60}):r("{n} 秒",{n:e})}function bf(e){return e?.desktop===!0}function MA(e){return e?.chatSupported!==!1}function QF(e){return typeof e=="string"&&e.startsWith("custom-")}function ZF(e){return r(e==="enterprise"?"企业":e==="ultimate"?"旗舰":"个人")}function qh(e,t){const a=Number(e?.priority??100)-Number(t?.priority??100);return a!==0?a:(Number(e?.addedAt)||0)-(Number(t?.addedAt)||0)}function cr(e){return e?.enabled!==!1}function vf(e,t=""){const a=e?.rateLimits||{},o=Date.now();return t?Number(a[t]?.resetAt)>o:Object.values(a).some(c=>Number(c?.resetAt)>o)}function DA(e){return e?.edition==="intl"?"intl":"cn"}function IA(e){return ir(kn(e)).claim?e?.canClaim!==!1:!1}const PA="coding-plan",wo="start-plan";function Gh(e){return!!ir(kn(e)).planChannel}function uw(e){return Gh(e)?String(e?.zcodePlan||"").trim()===wo?wo:PA:""}function WF(e){return r(e===wo?"活动套餐(Start Plan)":"编码套餐(Coding Plan)")}function _A(e){switch(String(e??"").trim()){case"pending":return r("待生效");case"active":return r("生效中");case"expired":return r("已过期");case"unknown":return r("状态未知");default:return String(e??"")}}function Kh(e){const t=e?.claimPlans;if(!t||typeof t!="object"||Array.isArray(t))return[];const a=dw();return Object.entries(t).filter(([,o])=>Number(o)>0&&dw(Number(o))===a).map(([o])=>o)}function JF(e){return Kh(e).length>0}function e$(e){const t=Kh(e),a=t.length?r("({plans})",{plans:t.join(r("、"))}):"";return r("今天(北京时间 {day})已领取 {n} 份{names};还有其他可领套餐时,点这里可以继续领;活动按自然日发新套餐,明天可再领",{day:dw(),n:t.length,names:a})}function t$(e){return!!ir(kn(e)).usageDetail}function LA(e){return!!ir(kn(e)).creditDetail}function zA(e){return/^free$/i.test(String(e??"").trim())}function n$(e){const t=String(e??"").trim();return/^trial$/i.test(t)?r("试用版"):zA(t)?r("免费版"):t}function dw(e=Date.now()){return new Date(e+8*3600*1e3).toISOString().slice(0,10)}function yf(e,t,a){return vf(e)||Fh(e,t)||iw(e,a)}function BA(e,t){const a=String(t.q||"").trim().toLowerCase();return a?[cu(e),e?.name,e?.nickname,e?.email,Vh(e),e?.id].some(c=>String(c||"").toLowerCase().includes(a)):!0}function HA(e,t){return t.provider==="all"||kn(e)===t.provider}function fw(e,t){return t.enabled==="all"?!0:t.enabled==="enabled"?cr(e):!cr(e)}function UA(e,t,a,o){if(t.limit==="all")return!0;if(!cr(e))return!1;const c=yf(e,a?.(e),o?.(e));return t.limit==="limited"?c:!c}function VA(e,t,a,o){return HA(e,t)&&fw(e,t)&&UA(e,t,a,o)&&BA(e,t)}function s$(e,t,a,o){return(e||[]).filter(c=>VA(c,t,a,o))}function FA(e,t,a,o){const c=e||[],d=h=>c.filter(b=>HA(b,t)&&(h==="enabled"||fw(b,t))&&BA(b,t)),f=d("enabled"),p=d("limit");return{enabledAll:f.length,enabled:f.filter(cr).length,disabled:f.filter(h=>!cr(h)).length,limitAll:p.length,normal:p.filter(h=>cr(h)&&!yf(h,a?.(h),o?.(h))).length,limited:p.filter(h=>cr(h)&&yf(h,a?.(h),o?.(h))).length}}function pw(e){const t=e?.rateLimits;if(!t||typeof t!="object")return[];const a=Date.now();return Object.entries(t).map(([o,c])=>({model:o,...c&&typeof c=="object"?c:{}})).filter(o=>Number(o.resetAt)>a).sort((o,c)=>Number(o.resetAt)-Number(c.resetAt))}function mw(e){const t=(e||[]).slice().sort(qh),a=new Map;return t.forEach((o,c)=>a.set(o.id,{position:c+1,total:t.length})),a}function r$(e,t,a,o){const c=(e||[]).slice().sort(qh),d=[],f=new Map;for(const p of c){const h=kn(p);f.has(h)||(f.set(h,[]),d.push(h)),f.get(h).push(p)}return d.map((p,h)=>{const b=f.get(p)||[];return{provider:p,label:Pe().wbProviders?.labelOf?.(p)||p,rank:h+1,members:b,accounts:t?b.filter(t):b,enabled:b.filter(cr).length,disabled:b.filter(y=>!cr(y)).length,limited:b.filter(y=>cr(y)&&yf(y,a?.(y),o?.(y))).length}})}function cu(e){if(!e)return"";const t=String(e.name||"").trim();if(e.nameCustom===!0&&t)return t;const a=String(e.email||"").trim();return ir(kn(e)).emailAsName&&a?a:e?.nickname||t||Vh(e)||e?.id||""}const hw="已限流",$A=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function gw(e){const t=Number(e);if(!Number.isFinite(t)||t<=0||t<=Date.now())return hw;const a=new Date(t),o=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",hour12:!1}),c=Math.round(($A(a)-$A(new Date))/864e5);return c===0?r("今天 {clock}",{clock:o}):c===1?r("明天 {clock}",{clock:o}):r("{month}月{day}日 {clock}",{month:a.getMonth()+1,day:a.getDate(),clock:o})}function a$(e){const t=kn(e);if(!ir(t).edition)return"";const a=DA(e),o=e?.editionLabel,c=o||(a==="intl"?"国际版":"国内版");return(Pe().wbProviders?.labelOf?.(t)||"").includes(c)?"":o||r(a==="intl"?"国际版":"国内版")}function l$(e){return[MA(e)?null:{text:r("仅账号管理"),kind:"plain",title:r("该提供商的推理转发尚未接入,账号不参与转发")},QF(kn(e))&&e.hasCredentials===!1?{text:r("未配置凭证"),kind:"bad",title:r("这条自定义账号既没有 API Key,也没有勾选「无需鉴权」:转发时会被跳过,该提供商下的模型也不会出现在模型列表里。去账号「设置」里补上 Key,或勾选「该上游无需鉴权」")}:null,e.proxy?.error?{text:r("代理异常"),kind:"bad",title:r("{error}(转发时会回退直连)",{error:e.proxy.error})}:null,uw(e)===wo?{text:r("活动套餐"),kind:"plain",title:r("转发走活动套餐通道(zcode.z.ai 的 Anthropic 端点,用账号里领到的额度);在账号设置里可切回编码套餐")}:null].filter(t=>t!==null)}const qA="workbuddy-desktop-accounts-filters",GA="workbuddy-desktop-accounts-collapsed",KA="workbuddy-desktop-accounts-names-hidden";function o$(){const e={provider:"all",enabled:"all",limit:"all",q:""},t=Pe().wbFilterMemory?.load(qA,e)||e;return{provider:String(t.provider||"all"),enabled:String(t.enabled||"all"),limit:String(t.limit||"all"),q:""}}function i$(){try{const e=JSON.parse(localStorage.getItem(GA)||"[]");return new Set(Array.isArray(e)?e.map(t=>String(t)).filter(Boolean):[])}catch{return new Set}}function c$(){try{return localStorage.getItem(KA)==="1"}catch{return!1}}let pn={version:0,filter:o$(),collapsed:i$(),selected:new Set,panels:new Map,connections:new Map,clash:null,dialog:null,namesHidden:c$(),usageBusy:!1,usageInflight:new Set};const xw=new Set;function YA(e){return xw.add(e),()=>{xw.delete(e)}}function Ws(){return pn}function Cn(e){pn={...pn,...e,version:pn.version+1},xw.forEach(t=>t())}function br(){Cn({})}function bw(){return Pe().wbApp?.getState?.()?.accounts}function El(){const e=bw()?.accounts;return Array.isArray(e)?e:[]}function Ea(e){return El().find(t=>t.id===e)||null}function u$(e,t){const a=r$(El(),c=>VA(c,pn.filter,e,t),e,t);return{groups:a.filter(c=>c.accounts.length>0),allGroups:a}}function XA(){return jA(bw())}function d$(e,t){return FA(El(),pn.filter,e,t)}function f$(){return mw(El())}function Yh(){Pe().wbFilterMemory?.save(qA,{provider:pn.filter.provider,enabled:pn.filter.enabled,limit:pn.filter.limit})}function p$(e){pn.filter.q!==e&&Cn({filter:{...pn.filter,q:e}})}function m$(e){const t=e||"all";pn.filter.provider!==t&&(Cn({filter:{...pn.filter,provider:t}}),Yh())}function QA(e,t){const a={...pn.filter,[e]:t};a.enabled==="disabled"&&a.limit!=="all"&&(a.limit="all"),Cn({filter:a}),Yh()}function Xh(){return pn.filter.provider!=="all"||pn.filter.enabled!=="all"||pn.filter.limit!=="all"||pn.filter.q.trim()!==""}function ZA(){Cn({filter:{provider:"all",enabled:"all",limit:"all",q:""}}),Yh()}function h$(){const e=pn.filter.provider;e!=="all"&&(XA().some(t=>t.id===e)||(Cn({filter:{...pn.filter,provider:"all"}}),Yh()))}function WA(e){try{localStorage.setItem(GA,JSON.stringify([...e]))}catch{}}function JA(e){const t=new Set(pn.collapsed);t.has(e)?t.delete(e):t.add(e),WA(t),Cn({collapsed:t})}function g$(e,t){const a=new Set(pn.collapsed);for(const o of e)t?a.add(o):a.delete(o);WA(a),Cn({collapsed:a})}function x$(e){return pn.selected.has(e)}function b$(e,t){const a=new Set(pn.selected);t?a.add(e):a.delete(e),Cn({selected:a})}function eR(e,t){const a=new Set(pn.selected);for(const o of e)t?a.add(o):a.delete(o);Cn({selected:a})}function v$(){Cn({selected:new Set})}function tR(e,t){return pn.panels.get(e)?.has(t)===!0}function nR(e,t,a){if(!e)return;const o=new Map(pn.panels),c=new Set(o.get(e)||[]);a?c.add(t):c.delete(t),c.size?o.set(e,c):o.delete(e),Cn({panels:o})}function y$(e,t){const a=new Map(pn.panels);for(const o of e){const c=new Set(a.get(o)||[]);c.add(t),a.set(o,c)}Cn({panels:a})}function w$(){const e=!pn.namesHidden;try{localStorage.setItem(KA,e?"1":"0")}catch{}Cn({namesHidden:e})}function j$(e){return"*".repeat(Math.min(Math.max(e.length,4),12))}const sR="usage_not_configured",jo=new Map,wf=new Map;function oa(e,t,a){jo.set(e,t),t!=null&&uu(t)?wf.set(e,a):wf.delete(e)}function Za(e){const t=jo.get(e.id);if(t===void 0)return;if(!uu(t))return t;const a=Math.max(Number(e.addedAt)||0,Number(e.updatedAt)||0);return(wf.get(e.id)||0)>=a?t:void 0}const jf=new Map;let rR=0;function Al(e){return e?jf.get(e.id)||[]:[]}function S$(e){const t=Number(e?.tokenAt)||0;if(!t||t===rR)return!1;const a=e?.tokenUsage;if(!a||typeof a!="object")return!1;rR=t;const o=new Map;for(const[d,f]of Object.entries(a)){if(!Array.isArray(f))continue;const p=[];for(const h of f){if(!h||typeof h!="object")continue;const b=Number(h.kind),y=Number(h.windowStart),v=Number(h.used);!Number.isFinite(b)||b<0||!Number.isFinite(y)||y<=0||!Number.isFinite(v)||v<0||p.push({kind:b,windowStart:y,used:v})}o.set(d,p)}const c=o.size!==jf.size||[...o].some(([d,f])=>{const p=jf.get(d);return!p||p.length!==f.length||f.some((h,b)=>h.used!==p[b]?.used||h.windowStart!==p[b]?.windowStart)});jf.clear();for(const[d,f]of o)jf.set(d,f);return c}let Qh=null;async function aR(e={}){const t=Ws().clash;if(!e.force&&t)return t;Qh||(Qh=(async()=>{try{const o=await Pe().workbuddyDesktop?.getProxies?.();if(!o||typeof o!="object"||!o.clash)throw new Error(r("代理列表响应异常({type})",{type:typeof o}));return o.clash}finally{Qh=null}})());const a=await Qh;return Cn({clash:a}),a}function N$(){Cn({clash:null})}let Sf=null,Zh=null;function k$(){return Sf}async function lR(e={}){if(!e.force&&Sf)return Sf;Zh||(Zh=(async()=>{try{const a=await Pe().workbuddyDesktop?.getProxyPool?.();if(!a||typeof a!="object"||!Array.isArray(a.items))throw new Error(r("代理池响应异常({type})",{type:typeof a}));return a.items}finally{Zh=null}})());const t=await Zh;return Sf=t,t}let vw=null;function C$(){return vw}let Wh=0,oR=!1;function T$(){if(!(Sf||Date.now(){Wh=0,vw=null,br()}).catch(e=>{vw=ut(e),br()})}}function Jh(e){if(!Ea(e)){Le(r("账号不存在,请刷新后重试"),"err");return}Cn({dialog:{kind:"settings",id:e}})}function eg(){Cn({dialog:null})}function yw(e,t="enable"){const a=(Array.isArray(e)?e:[]).filter(o=>Ea(o));if(!a.length){Le(r("请先勾选要操作的账号"),"err");return}Cn({dialog:{kind:"batch",ids:a,action:t}})}function E$(e){let t=!1;for(const f of[...jo.keys()])e.has(f)||(jo.delete(f),t=!0);for(const f of[...wf.keys()])e.has(f)||wf.delete(f);const a=new Map(Ws().panels);for(const f of[...a.keys()])e.has(f)||(a.delete(f),t=!0);const o=new Map(Ws().connections);for(const f of[...o.keys()])e.has(f)||(o.delete(f),t=!0);const c=new Set(Ws().usageInflight);for(const f of[...c])e.has(f)||(c.delete(f),t=!0);const d=new Set(Ws().selected);for(const f of[...d])e.has(f)||(d.delete(f),t=!0);t&&Cn({panels:a,connections:o,usageInflight:c,selected:d})}const A$=2e3;function iR(e){return Ws().connections.get(e)||0}async function cR(){try{const e=await Pe().workbuddyDesktop?.getAccountConnections?.(),t=e?.counts&&typeof e.counts=="object"?e.counts:{},a=new Map;for(const[o,c]of Object.entries(t)){const d=Number(c)||0;d>0&&a.set(o,d)}return Cn({connections:a}),!0}catch{return!1}}let uR=null;function R$(){uR||(uR=setInterval(()=>{document.hidden||Pe().wbApp?.currentPage!=="accounts"||cR()},A$))}function ww(){return El().filter(e=>Ta(e)&&e.available!==!1)}function uu(e){if(e==null)return null;if(typeof e=="string")return{message:e,notConfigured:!1};if(typeof e!="object")return null;const t=e.error;return t?{message:String(t),notConfigured:e.code===sR}:null}function dR(e){return e.usage?e.usage:{error:e.error?String(e.error):r("余额响应为空"),code:e.code}}function fR(e){const t=Array.isArray(e?.results)?e.results:[],a=Number(e?.at)||Date.now();let o=0;for(const c of t)c?.id&&(oa(String(c.id),dR(c),Number(c.at)||a),o++);return o&&(br(),Pe().wbApp?.renderTopbarStatus?.()),o}let pR=!1;function O$(e){if(!LA(e))return!1;const t=Za(e);return!t||typeof t!="object"||Array.isArray(t)||uu(t)?!1:!Array.isArray(t.credits)}async function M$(){if(!pR){pR=!0;for(const e of El().filter(O$)){const t=jo.get(e.id);try{await Nf(e.id)}catch{}const a=jo.get(e.id);t!==void 0&&(!a||uu(a))&&oa(e.id,t,Date.now()),br()}}}let mR=0;async function D$(){try{const e=await Pe().workbuddyDesktop?.getBalancesSnapshot?.(),t=S$(e);t&&(br(),Pe().wbApp?.renderTopbarStatus?.());const a=Number(e?.at)||0;return!a||a===mR||(mR=a,!fR(e))?t:(M$(),!0)}catch{return!1}}async function Nf(e){const t=await Pe().workbuddyDesktop?.getAllBalances?.(e||void 0),a=Array.isArray(t?.results)?t.results:[],o=Date.now(),c=new Set;for(const d of a){if(!d?.id)continue;const f=String(d.id);e&&f!==e||(c.add(f),oa(f,dR(d),o))}if(e)return c.has(e)||oa(e,r("未返回余额数据"),o),br(),t;for(const d of ww())c.has(d.id)||oa(d.id,r("未返回余额数据"),o);return br(),t}async function hR(){if(Ws().usageBusy)return;const e=ww();if(!e.length){Le(r("暂无可查询余额的账号"),"err");return}Cn({usageBusy:!0}),e.forEach(t=>oa(t.id,null,Date.now())),br();try{const t=(await Nf(null))?.results||[],a=t.filter(f=>f.usage).length,o=t.filter(f=>f.code===sR).length,c=o?r("({n} 个未配置查询凭证)",{n:o}):"",d=t.length-a-o;Le(a+o===t.length?r("✅ 已更新 {n} 个账号的余额{suffix}",{n:a,suffix:c}):r("已更新 {ok}/{total} 个账号,{failed} 个失败",{ok:a,total:t.length,failed:d}),d?"err":"ok")}catch(t){const a=ut(t);e.forEach(o=>oa(o.id,r("查询失败:{message}",{message:a}),Date.now())),br(),Le(r("余额查询失败:{message}",{message:a}),"err")}finally{Cn({usageBusy:!1})}}async function gR(e){if(Ws().usageInflight.has(e))return;const t=new Set(Ws().usageInflight);t.add(e),oa(e,null,Date.now()),Cn({usageInflight:t});try{await Nf(e)}finally{const a=new Set(Ws().usageInflight);a.delete(e),Cn({usageInflight:a})}}async function I$(e){if(!Ws().usageInflight.has(e))try{await gR(e);const t=uu(jo.get(e));t?.notConfigured?Le(t.message,"ok"):t?Le(r("余额查询失败:{message}",{message:t.message}),"err"):Le(r("✅ 已更新余额"))}catch(t){oa(e,r("查询失败:{message}",{message:ut(t)}),Date.now()),br(),Le(r("余额查询失败:{message}",{message:ut(t)}),"err")}}async function tg(e){if(e){const a=Ea(e);if(!a||!Ta(a))return;try{await gR(e)}catch(o){oa(e,r("查询失败:{message}",{message:ut(o)}),Date.now()),br()}return}if(Ws().usageBusy)return;const t=ww();if(t.length){Cn({usageBusy:!0}),t.forEach(a=>oa(a.id,null,Date.now())),br();try{await Nf(null)}catch(a){const o=ut(a);t.forEach(c=>oa(c.id,r("查询失败:{message}",{message:o}),Date.now())),br()}finally{Cn({usageBusy:!1})}}}async function xR(e,t){try{await Pe().workbuddyDesktop?.updateAccount?.(e,{enabled:t}),await Pe().wbApp?.refresh?.(),Le(r(t?"✅ 已启用":"✅ 已禁用"))}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function bR(e,t){if(!e.length)return!1;try{return await Pe().workbuddyDesktop?.reorderAccounts?.(e),Le(t?r("✅ 已保存:{note}",{note:t}):r("✅ 顺序已保存")),await Pe().wbApp?.refresh?.(),!0}catch(a){return Le(r("顺序未保存:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.(),!1}}async function vR(e,t){if(e.length)try{await Pe().workbuddyDesktop?.batchAccounts?.({action:t?"enable":"disable",ids:e}),Le(t?r("✅ 已启用 {n} 个账号",{n:e.length}):r("✅ 已禁用 {n} 个账号",{n:e.length})),await Pe().wbApp?.refresh?.()}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function P$(e,t){try{await Pe().workbuddyDesktop?.clearRateLimits?.(e,t||null),Le(t?r("✅ 已清除 {model} 的限流标记",{model:t}):r("✅ 已清除该账号全部限流标记")),await Pe().wbApp?.refresh?.()}catch(a){Le(r("清除失败:{message}",{message:ut(a)}),"err")}}async function _$(e,t,a){if(t===yR){Jh(e);return}if(t!==ng&&t!==a)try{const o=t===""?null:{source:"pool",proxyId:t.slice(Xa.length)},d=(await Pe().workbuddyDesktop?.updateAccount?.(e,{proxy:o}))?.changes,f=Array.isArray(d)&&d.length?d[0]:r("代理已更新");Le(`✅ ${f}`)}catch(o){Le(r("保存失败:{message}",{message:ut(o)}),"err")}finally{await Pe().wbApp?.refresh?.()}}const ng="__proxy_custom__",yR="__proxy_custom_edit__";function wR(e,t){const a=Ea(e);if(!a){Le(r("账号不存在,请刷新后重试"),"err");return}const o=Pe().wbZcodePlans;if(!o?.open){Le(r("套餐明细弹窗未加载,请重启应用后重试"),"err");return}o.open({id:e,name:t||a.name})}function L$(e,t,a=1){return{seat:t.get(e.id)||{position:1,total:1},rank:a,picked:x$(e.id),usageEntry:jo.get(e.id),limitsOpen:tR(e.id,"limits"),connections:iR(e.id)}}const z$={DEFAULT_PROVIDER_ID:ou,RACCOON_PROVIDER_ID:PF,providerOf:kn,providerFeatures:ir,providerSummaries:jA,identifierOf:Vh,tokenExpiryOf:VF,supportsUsage:Ta,isDesktopAccount:bf,supportsChat:MA,byPriorityOrder:qh,typeLabel:ZF,isEnabled:cr,isRateLimited:vf,isLimited:e=>yf(e,e?Za(e):void 0,Al(e)),accountEdition:DA,supportsClaim:IA,matchEnabled:fw,matchLimit:UA,visibleAccounts:s$,filterCounts:FA,positionMap:mw,activeLimits:pw,editionSuffix:a$,formatResetText:gw};function B$(){window.wbAccountsView={render:()=>br(),refreshCaches:E$,openPanels:y$,syncConnections:cR,applyBalances:fR,syncBalancesSnapshot:D$,queryUsageFor:Nf,queryAllUsage:hR,refreshUsageAfterCheckin:tg,supportsUsage:Ta,isDesktopAccount:bf,isEnabled:cr,isRateLimited:vf},window.wbAccountsModel=z$,window.wbAccountPanel={open:Jh,close:eg,openBatch:yw,closeBatch:eg,syncAddProvider:()=>Pe().wbAccountAddForms?.syncAddProvider?.(),invalidate:N$}}function H$(e){return e.type==="balance"?r("余额 < {threshold}",{threshold:e.threshold}):e.reset==="daily"?r("每日消耗 ≥ {count} Token(每天 0 点重置)",{count:Tl(e.threshold)}):r("每 {period}消耗 ≥ {count} Token",{period:OA(e.period??0),count:Tl(e.threshold)})}function U$(e){return e.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(自动恢复)")}function V$(e){return`${Math.round(e.threshold).toLocaleString("en-US")} Token`}function F$(e,t){if(t.enabled===!1)return{text:r("已停用"),kind:"off"};if(t.type==="balance"){const b=Za(e),y=Fh(e,b),v=b&&typeof b=="object"?b:null,w=v?v.totalLeft??v.available:void 0,j=w==null||w===""||v?.unlimited?"":r(" · 当前 {n}",{n:Number(w)});return y?{text:r("已跳过{current}",{current:j}),kind:"warn",title:r("余额低于阈值,转发时会跳过该账号(余额回升自动恢复)")}:{text:r("未触发{current}",{current:j}),kind:"ok"}}const a=Al(e),o=xf(t,a),c=o?o.used:0,d=Tl(t.threshold),f=t.reset==="daily"?r(" · 今日 {used} / {quota}",{used:Tl(c),quota:d}):r(" · 本周期 {used} / {quota}",{used:Tl(c),quota:d}),p=o?` · ${$h(cw(t).remainingMs,t.reset==="daily")}`:"";return o!==null&&c>=t.threshold?t.action==="disable"?e.enabled===!1?{text:r("已触发 · 账号已禁用"),kind:"danger",title:r("重置也不恢复,需手动启用")}:{text:r("已达上限{usage}",{usage:f}),kind:"warn",title:r("稍后由后台判定自动禁用")}:{text:r("已跳过{usage}{countdown}",{usage:f,countdown:p}),kind:"warn",title:r("窗口内已用 {used} / {limit} Token,转发时会跳过该账号(重置后自动恢复)",{used:Math.round(c).toLocaleString("en-US"),limit:Math.round(t.threshold).toLocaleString("en-US")})}:{text:r("未触发{usage}{countdown}",{usage:f,countdown:p}),kind:"ok",title:V$(t)}}function $$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:{value:"1",unit:"hours"}}function jR(e){const t={type:"balance",action:"skip",thresholdInput:"",tokenUnit:"wan",reset:"fixed",periodInput:"1",periodUnit:"hours"};if(!e)return t;if(e.type==="balance")return{...t,type:"balance",action:e.action,thresholdInput:String(e.threshold)};if(e.reset==="daily")return{...t,type:"token",action:e.action,reset:"daily",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit"};const a=$$(e.period??0);return{...t,type:"token",action:e.action,reset:"fixed",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit",periodInput:a.value,periodUnit:a.unit}}function SR(e){const t=Number(e.thresholdInput);if(!Number.isFinite(t)||t<=0)return{error:r("限制阈值必须是大于 0 的数字")};if(e.type==="balance")return{rule:{type:"balance",action:e.action,threshold:t,enabled:!0}};const a=Math.round(e.tokenUnit==="wan"?t*1e4:t);if(e.reset==="daily")return{rule:{type:"token",action:e.action,threshold:a,reset:"daily",enabled:!0}};const o=Number(e.periodInput)*(e.periodUnit==="hours"?3600:60);if(!Number.isFinite(o)||o<=0)return{error:r("请填写重置周期")};const c=Math.round(o);return cTA?{error:r("重置周期必须是 30 分钟 ~ 24 小时")}:{rule:{type:"token",action:e.action,threshold:a,period:c,reset:"fixed",enabled:!0}}}function q$({account:e,target:t,onClose:a,onSave:o}){const[c,d]=x.useState(""),[f,p]=x.useState(t?.draft??null);if(x.useEffect(()=>{p(t?.draft??null),d("")},[t]),!t||!f)return null;const h=v=>{d(""),p({...f,...v})},b=()=>{const v=SR(f);if("error"in v){d(v.error);return}o(v.rule,t.index)},y=()=>{if(f.type==="balance"){const D=Za(e);if(D&&typeof D=="object"){const C=D;if(C.unlimited)return r("当前可用 ∞(不参与余额不足判定)");const A=C.totalLeft??C.available;if(A!=null&&A!=="")return r("当前余额 {n};与余额列同一数字口径,严格小于才触发(等于阈值仍可用)",{n:Number(A)})}return r("读数来自自动余额查询;与余额列同一数字口径,严格小于才触发(等于阈值仍可用)")}const v=SR(f);if(!("rule"in v))return"";const w=v.rule,j=xf(w,Al(e));if(!j)return w.reset==="daily"?r("窗口 = 今天 0 点起(本地时区),0 点重置即清零恢复;按账号在 requests 表聚合"):r("窗口对齐自然时间(整点 / 整 N 分钟一轮回),重置即清零恢复;按账号在 requests 表聚合");const S=cw(w),N=Tl(j.used),k=Tl(w.threshold),T=w.reset==="daily"?r("今日已用"):r("本周期已用");return r("{scope} {used} / {quota} Token,{countdown}重置",{scope:T,used:N,quota:k,countdown:$h(S.remainingMs,S.daily)})};return s.jsx(Qt,{open:!0,onOpenChange:v=>{v||a()},children:s.jsxs(Zt,{className:"w-[min(580px,calc(100vw-48px))]",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t.index>=0?r("编辑限制"):r("添加限制")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("限制类型")}),s.jsxs(ft,{value:f.type,onValueChange:v=>h({type:v,thresholdInput:""}),children:[s.jsx(mt,{className:"w-[150px]","aria-label":r("限制类型"),children:s.jsx(pt,{children:f.type==="balance"?r("余额"):r("Token 消耗")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"balance",children:r("余额")}),s.jsx(qe,{value:"token",children:r("Token 消耗")})]})]}),s.jsx("span",{className:"detail",children:r("余额沿用现有口径;Token 按重置方式内的累计消耗判定(切换类型会清空阈值)")})]}),f.type==="balance"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("余额低于")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[120px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("时")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(余额回升自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(余额回升自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("重置方式")}),s.jsxs(ft,{value:f.reset,onValueChange:v=>h({reset:v}),children:[s.jsx(mt,{className:"w-[190px]","aria-label":r("重置方式"),children:s.jsx(pt,{children:f.reset==="daily"?r("自然日(每天 0 点)"):r("固定周期")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"fixed",children:r("固定周期")}),s.jsx(qe,{value:"daily",children:r("自然日(每天 0 点)")})]})]}),s.jsx("span",{className:"detail",children:r("有的账号过了 0 点额度就回来 —— 选「自然日」")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),f.reset==="daily"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每日消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每")}),s.jsx($e,{type:"number",min:1,step:1,className:"max-w-[90px]",placeholder:r("周期"),value:f.periodInput,onChange:v=>h({periodInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.periodUnit,onValueChange:v=>h({periodUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("周期单位"),children:s.jsx(pt,{children:f.periodUnit==="hours"?r("小时"):r("分钟")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("内消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(重置后自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(重置后自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}),s.jsx("p",{className:"detail limiter-hint",children:y()}),c?s.jsx("p",{className:"detail text-destructive",children:c}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:b,children:t.index>=0?r("保存规则"):r("添加规则")})]})]})})}function G$({account:e,draft:t,onChange:a}){const[o,c]=x.useState(null),d=()=>c({index:-1,draft:jR(null)}),f=y=>c({index:y,draft:jR(t[y])}),p=(y,v)=>{const w=[...t];v>=0?w[v]=y:w.push(y),a(w),c(null)},h=y=>{a(t.filter((v,w)=>w!==y)),o&&c(null)},b=(y,v)=>{const w=[...t];w[y]={...w[y],enabled:v},a(w)};return s.jsxs(s.Fragment,{children:[t.length?s.jsx("div",{className:"limiter-rules mt-2.5",children:t.map((y,v)=>{const w=F$(e,y);return s.jsxs("div",{className:"limiter-rule","data-off":y.enabled===!1||void 0,children:[s.jsx(hs,{checked:y.enabled!==!1,"aria-label":r("启用该规则"),onCheckedChange:j=>b(v,j===!0)}),s.jsx("div",{className:"limiter-rule-main",children:s.jsxs("span",{className:"limiter-rule-cond",children:[s.jsx(ze,{variant:"secondary",shape:"tag",children:y.type==="balance"?r("余额"):"Token"})," ",r("{cond} 时 → {action}",{cond:H$(y),action:U$(y)})]})}),s.jsx(ze,{variant:w.kind==="ok"?"success":w.kind==="warn"?"warning":w.kind==="danger"?"destructive":"secondary",shape:"tag",title:w.title,children:w.text}),s.jsxs("div",{className:"limiter-rule-ops",children:[s.jsx(se,{variant:"ghost",onClick:()=>f(v),children:r("编辑")}),s.jsx(se,{variant:"ghost",onClick:()=>h(v),children:r("删除")})]})]},v)})}):s.jsx("p",{className:"detail mt-2.5",children:r("还没有限制规则:账号照常参与转发,余额与 Token 消耗都不设上限。")}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx(se,{variant:"outline",onClick:d,children:r("+ 添加限制")}),s.jsx("span",{className:"detail",children:r("可添加多条;同类规则也允许并存(例如一条按余额、两条不同重置方式的 Token)")})]}),s.jsx(q$,{account:e,target:o,onClose:()=>c(null),onSave:p})]})}function K$(e,t){const a=iu(e);return JSON.stringify(t)===JSON.stringify(a)?null:{patch:{limiters:t}}}function Y$(e){return iu(e).map(t=>({...t}))}const X$={seconds:1,minutes:60,hours:3600};function Q$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:e>0?{value:String(e),unit:"seconds"}:{value:"5",unit:"minutes"}}function Z$(e){const{enabled:t,interval:a}=AA(e),o=Q$(t?a:0);return{enabled:t,intervalInput:o.value,unit:o.unit}}function W$(e,t){const a=Math.round(Number(t.intervalInput)*X$[t.unit]);if(t.enabled){if(!Number.isFinite(Number(t.intervalInput))||Number(t.intervalInput)<=0)return{error:r("请填写查询间隔")};if(aNA)return{error:r("查询间隔必须是 {min} 秒 ~ 24 小时",{min:lw})}}const o={},c=AA(e);return(t.enabled!==c.enabled||t.enabled&&a!==c.interval)&&(o.usageQuery={enabled:t.enabled,interval:t.enabled?a:c.interval}),o.usageQuery?{patch:o}:null}function J$({account:e,draft:t,onChange:a}){const o=c=>a({...t,...c});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(hs,{checked:t.enabled,onCheckedChange:c=>o({enabled:c===!0}),"aria-label":r("自动查询余额")}),s.jsx("span",{className:"text-xs text-subtle",children:r("自动查询余额(按下面的间隔自动刷新余额列的读数)")})]})}),t.enabled?s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-usage-interval",children:r("查询间隔")}),s.jsx($e,{id:"account-usage-interval",type:"number",min:1,step:1,className:"max-w-[110px]",value:t.intervalInput,onChange:c=>o({intervalInput:c.currentTarget.value})}),s.jsxs(ft,{value:t.unit,onValueChange:c=>o({unit:c}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("间隔单位"),children:s.jsx(pt,{children:t.unit==="hours"?r("小时"):t.unit==="minutes"?r("分钟"):r("秒")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"seconds",children:r("秒")}),s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",children:r("30 秒 ~ 24 小时;手动查询会顺延下一轮")})]}):null]})}const e8={sub2api:{label:"Sub2API",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},new_api:{label:"NewAPI",endpoint:"{base}/api/user/self + /api/status",note:r("用 NewAPI 站点的个人访问令牌查询账户余额(不是这条账号的上游 API Key)。令牌在站点的「个人设置」里生成,只有旧版 / 定制站点才需要额外填用户 ID。"),fields:[{key:"accessToken",label:r("NewAPI 个人访问令牌"),secret:!0,placeholder:r("在 NewAPI 站点「个人设置」里生成的访问令牌"),hint:r("必填;留空 = 不修改,清除用右边的按钮")},{key:"userId",label:r("NewAPI 用户 ID"),placeholder:r("旧版 / 定制站点才需要,新版可留空"),hint:r("可留空:新版请求头只认令牌;旧版会把用户 ID 放进 New-Api-User 头")}]},deepseek:{label:"DeepSeek",endpoint:"{base}/user/balance",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},opencode:{label:"OpenCode Go",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询订阅用量,不需要额外配置;读数展开成 5 小时 / 每周 / 每月三个窗口。"),fields:[]},sensenova:{label:"商汤日日新",endpoint:"platform.sensenova.cn 控制台",note:r("用商汤日日新控制台的账号密码查询(与推理用的 API Key 不是同一套)。网关会自动换取登录票并缓存,过期后自动重登,不需要手动维护。"),fields:[{key:"username",label:r("账号"),placeholder:r("商汤日日新控制台的登录账号"),hint:r("必填")},{key:"password",label:r("密码"),secret:!0,placeholder:r("商汤日日新控制台的登录密码"),hint:r("留空 = 不修改,清除用右边的按钮")}]},zhipu:{label:"智谱",endpoint:"bigmodel.cn 控制台",note:r("用 bigmodel.cn 控制台的访问令牌查询账户余额(人民币元)。令牌是登录后浏览器 Cookie `bigmodel_token_production` 的值:开发者工具 → 应用(Application)→ Cookie 里复制。"),fields:[{key:"token",label:r("访问令牌"),secret:!0,placeholder:r("bigmodel_token_production 的值"),hint:r("必填;留空 = 不修改,清除用右边的按钮")}]},zhipu_zai:{label:"智谱(z.ai 国际)",endpoint:"api.z.ai 控制台",note:r("用这条账号的 API Key 生成签名后查询账户余额(美元),不需要额外配置。要求 API Key 是 z.ai 的「id.secret」形态(控制台生成的 Key 就是)。"),fields:[]}};function kf(e){return e?e8[e]??null:null}function t8(e,t){return t.secret?t.key==="accessToken"?e?.hasAccessToken===!0:t.key==="password"?e?.hasPassword===!0:t.key==="token"?e?.hasToken===!0:!1:!1}function n8(e){const t=String(e?.scheme||"");return t==="new_api"?e?.hasAccessToken===!0:t==="sensenova"?String(e?.username||"").trim()!==""&&e?.hasPassword===!0:t==="zhipu"?e?.hasToken===!0:!0}function s8(e){return{userId:String(e?.userId||""),username:String(e?.username||""),accessToken:"",password:"",token:""}}function r8(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=String(t[c.key]??"").trim();if(c.secret){d&&(o[c.key]=d);continue}o[c.key]=d}return Object.keys(o).length?o:null}function a8({field:e,value:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){const p=`${f}-${e.key}`;return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:p,children:e.label}),s.jsx($e,{id:p,className:"min-w-[220px]",type:e.secret?"password":"text",autoComplete:e.secret?"new-password":"off",placeholder:a?r("已配置,留空则不修改"):e.placeholder,title:e.hint,value:t,onChange:h=>o(h.currentTarget.value)}),a&&c?s.jsx(se,{variant:"outline",size:"sm",disabled:d===!0,onClick:c,title:r("清除已配置的 {label}",{label:e.label}),children:r("清除")}):null]})}function l8({spec:e,values:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"detail mt-2.5",children:[r("余额查询方案:{label}",{label:e.label}),s.jsx("span",{className:"ml-1 text-subtle",children:e.endpoint})," — ",e.note]}),e.fields.map(p=>s.jsx(a8,{field:p,idPrefix:f,value:t[p.key]||"",configured:a[p.key]===!0,onValue:h=>o(p.key,h),onClear:c?()=>c(p.key):void 0,clearBusy:d},p.key))]})}const NR=64;function o8(e,t){const a=kn(e);return t.filter(o=>o.id!==e.id&&kn(o)===a)}const Rl=999,kR=8;function sg(e){return cu(e)||e?.id||""}function CR(e){const t=e?.config?.source||e?.source,a=e?.config||null,o=t==="rotate";return{mode:t==="pool"?"pool":o?"rotate":t==="clash"?"clash":t==="custom"?"custom":"none",proxyId:t==="pool"?String(a?.proxyId||""):"",rotateAll:o?a?.all!==!1:!0,rotateIds:o&&Array.isArray(a?.proxyIds)?a.proxyIds.map(String):[],listenerUid:a?.source==="clash"||t==="clash"?String(a?.listenerUid||""):"",protocol:a?.protocol==="socks5"?"socks5":"http",host:a?.host||"",port:a?.port===void 0||a?.port===null?"":String(a.port),username:a?.username||"",password:a?.password||""}}function jw(e){if(e.mode==="none")return null;if(e.mode==="pool"){if(!e.proxyId)throw new Error(r("请先选择已保存的代理"));return{source:"pool",proxyId:e.proxyId}}if(e.mode==="rotate"){if(e.rotateAll)return{source:"rotate",all:!0};if(!e.rotateIds.length)throw new Error(r("轮询至少要选择一条代理(或改选「全部」)"));return{source:"rotate",all:!1,proxyIds:[...e.rotateIds]}}if(e.mode==="clash"){if(!e.listenerUid)throw new Error(r("请先选择 Clash Verge 出口"));return{source:"clash",listenerUid:e.listenerUid}}const t=e.host.trim(),a=Number(e.port);if(!t)throw new Error(r("请填写代理主机地址"));if(!Number.isInteger(a)||a<1||a>65535)throw new Error(r("代理端口必须是 1-65535 的整数"));return{source:"custom",protocol:e.protocol==="socks5"?"socks5":"http",host:t,port:a,username:e.username.trim(),password:e.password}}function TR(e){const t=e.profileActive===!1?r("(其他订阅,可能未生效)"):"",a=e.enabled===!1?r("(已在 Clash 中禁用)"):"";return`${e.name} :${e.port}${t}${a}`}function ER({draft:e,onChange:t,idPrefix:a,allowRotate:o=!1}){const d=Ws().clash,f=Array.isArray(d?.options)?d.options:[],p=e.mode==="clash",[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(null),[S,N]=x.useState(""),k=A=>t({...e,...A});x.useEffect(()=>{p&&aR().catch(()=>{})},[p]);const T=x.useCallback((A=!1)=>{N(""),lR({force:A}).then(R=>j(R)).catch(R=>{j([]),N(ut(R))})},[]);x.useEffect(()=>{(e.mode==="pool"||e.mode==="rotate")&&w===null&&T()},[e.mode,w,T]);function D(){return e.rotateAll?(w??[]).filter(A=>A.enabled!==!1).map(A=>A.id):[...e.rotateIds]}async function C(){if(h)return;if(e.mode==="rotate"){const R=D();if(!R.length){Le(r("轮询至少要选择一条代理(或改选「全部」)"),"err");return}const I=R.slice(0,kR);b(!0),v(r("正在连接上游…"));let P=0;const O=[];for(const H of I){const B=w?.find(z=>z.id===H)?.name||H;try{const z=await Pe().workbuddyDesktop?.testProxyPoolItem?.(H);z?.success?P+=1:O.push(`${B}(${z?.error||r("连接失败")})`)}catch(z){O.push(`${B}(${ut(z)})`)}}const _=R.length-I.length,L=r("✅ {ok}/{total} 个出口可用",{ok:P,total:I.length})+(_>0?r("(只测了前 {limit} 个,还有 {rest} 个未测)",{limit:kR,rest:_}):"");v(s.jsxs("span",{className:O.length?"text-destructive":"text-success",children:[L,O.length?` ${Qa(O.join(r(";")))}`:""]})),b(!1);return}if(e.mode==="pool"){if(!e.proxyId){Le(r("请先选择已保存的代理"),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxyPoolItem?.(e.proxyId);v(R?.success?s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]}):s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}return}let A;try{A=jw(e)}catch(R){Le(ut(R),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxy?.({proxy:A});R?.success?v(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.status!==void 0&&R.status!==""?` HTTP ${Qa(String(R.status))}`:"",R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]})):v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}}return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(Eh,{value:e.mode,onValueChange:A=>k({mode:A}),className:"flex-row flex-wrap items-center gap-5","aria-label":r("代理方式"),children:[s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"none"}),r("无代理(直连)")]}),s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"pool"}),r("已保存的代理")]}),o?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",title:r("逐请求轮换出口(换 IP):OpenCode Zen 免费档按 IP 限流,单个 IP 的额度用完会对它一律 429"),children:[s.jsx(bo,{value:"rotate"}),r("轮询(换 IP)")]}):null,p?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"clash"}),"Clash Verge"]}):null,s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"custom"}),r("自定义")]})]}),e.mode==="pool"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-pool-exit`,children:r("代理")}),s.jsxs(ft,{value:e.proxyId,disabled:!w?.length,onValueChange:A=>k({proxyId:String(A)}),children:[s.jsx(mt,{id:`${a}-pool-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:w?.find(A=>A.id===e.proxyId)?au(w.find(A=>A.id===e.proxyId)):w===null?r("正在读取…"):w.length?r("请选择代理"):r("还没有保存的代理")})}),s.jsx(ht,{children:(w??[]).map(A=>s.jsx(qe,{value:A.id,children:au(A)},A.id))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("地址与端口由「网络代理」页管理:那边改一次、测一次,所有引用它的账号一起生效"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="rotate"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[s.jsx(Mr,{id:`${a}-rotate-all`,checked:e.rotateAll,"aria-label":r("轮询全部代理节点"),onCheckedChange:A=>k({rotateAll:A===!0})}),s.jsx("label",{htmlFor:`${a}-rotate-all`,className:"cursor-pointer text-xs text-subtle",children:r("全部代理节点(推荐)")}),s.jsx("span",{className:"detail",children:r("「网络代理」页里每个启用的出口轮流使用;之后新加的出口自动加入")})]}),e.rotateAll?null:s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-rotate-exits`,children:r("轮询的代理")}),s.jsx(Bh,{id:`${a}-rotate-exits`,value:e.rotateIds,onValueChange:A=>k({rotateIds:A.map(String)}),options:(w??[]).map(A=>({value:A.id,label:au(A)})),placeholder:r("选择要轮询的代理(可多选)"),"aria-label":r("轮询的代理")}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("每条请求换一个出口(按顺序轮流),上游看到的 IP 因此是变化的;出口的地址与端口由「网络代理」页管理"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="clash"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-clash-exit`,children:r("出口")}),s.jsxs(ft,{value:e.listenerUid,disabled:!f.length,onValueChange:A=>k({listenerUid:String(A)}),children:[s.jsx(mt,{id:`${a}-clash-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:f.find(A=>String(A.uid)===e.listenerUid)?TR(f.find(A=>String(A.uid)===e.listenerUid)):d?.available===!1?r("未检测到 Clash Verge"):f.length?r("请选择出口"):r("没有可用出口")})}),s.jsx(ht,{children:f.map(A=>s.jsx(qe,{value:String(A.uid),children:TR(A)},String(A.uid)))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{aR({force:!0}).then(()=>Le(r("✅ 已重新读取 Clash Verge 配置"))).catch(A=>Le(r("读取失败:{error}",{error:ut(A)}),"err"))},children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:d===null?r("正在读取 Clash Verge 配置…"):d.available===!1?d.error?r("不可用:{error}",{error:d.error}):r("未检测到 Clash Verge 配置"):f.length?r("读取自 {dir};端口由 Clash Verge 管理,这里实时同步",{dir:d.dir||"Clash Verge"}):r("Clash Verge 里还没有配置混合监听器或节点端口")}),s.jsxs("p",{className:"detail mt-1.5",children:[r("这是既有配置(直接引用 Clash 出口,不经过代理池)。推荐改用上面的"),s.jsx("b",{children:r("「已保存的代理」")}),r(":到「网络代理」页点「同步 Clash Verge」把出口导进池后即可选 —— 那样能集中测试、也能被多个账号共用。")]})]}):null,e.mode==="custom"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-protocol`,children:r("协议")}),s.jsxs(ft,{value:e.protocol,onValueChange:A=>k({protocol:A}),children:[s.jsx(mt,{id:`${a}-protocol`,className:"min-w-[110px]",children:s.jsx(pt,{children:e.protocol==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]}),s.jsx("label",{htmlFor:`${a}-host`,className:"ml-2",children:r("主机")}),s.jsx($e,{id:`${a}-host`,className:"min-w-[140px]",placeholder:"127.0.0.1",value:e.host,onChange:A=>k({host:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-port`,children:r("端口")}),s.jsx($e,{id:`${a}-port`,type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:e.port,onChange:A=>k({port:A.currentTarget.value})})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-user`,children:r("用户名")}),s.jsx($e,{id:`${a}-user`,placeholder:r("可选"),autoComplete:"off",value:e.username,onChange:A=>k({username:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-pass`,children:r("密码")}),s.jsx($e,{id:`${a}-pass`,type:"password",placeholder:r("可选"),autoComplete:"new-password",value:e.password,onChange:A=>k({password:A.currentTarget.value})})]})]}):null,s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{C()},children:r(h?"测试中…":"测试出口")}),s.jsx("span",{className:"detail",children:y})]})]})}function i8({plan:e,hasJwt:t,onChange:a}){const o=WF(e),[c,d]=x.useState(null);return x.useEffect(()=>{if(e!==wo)return()=>{};let f=!0;const p=()=>{Promise.resolve(Pe().workbuddyDesktop?.zcodeCaptchaStats?.()).then(b=>{f&&b&&d({ready:Number(b.ready)||0,target:Number(b.target)||0})}).catch(()=>{})};p();const h=window.setInterval(p,5e3);return()=>{f=!1,window.clearInterval(h)}},[e]),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-plan-channel",children:r("使用套餐")}),s.jsxs(ft,{value:e,onValueChange:f=>a(String(f)),children:[s.jsx(mt,{id:"account-plan-channel",className:"min-w-[220px]",children:s.jsx(pt,{children:o})}),s.jsxs(ht,{children:[s.jsx(qe,{value:PA,children:r("编码套餐(Coding Plan)— 走开放平台端点,用自己订阅的额度")}),s.jsx(qe,{value:wo,children:r("活动套餐(Start Plan)— 走官方活动端点,用活动里领到的额度")})]})]}),e===wo&&!t?s.jsx("span",{className:"detail text-destructive",children:r("该账号没有套餐登录态(jwt),活动套餐会失败:请重新登录该账号")}):null,e===wo?s.jsxs("span",{className:"detail",title:r("活动套餐的推理端点要求每条请求带一个阿里云验证码令牌;令牌由本应用在后台静默铸造,界面关闭时无法铸造"),children:[r("验证码令牌:{counts}",{counts:c?`${c.ready} / ${c.target||3}`:r("读取中…")}),c&&c.ready===0?r("(库存为空,正在补;补不上时转发会失败)"):""]}):null]})}function c8({configured:e,value:t,onChange:a,onClear:o,clearBusy:c}){return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-balance-token-input",children:r("余额查询凭证")}),s.jsx($e,{id:"account-balance-token-input",className:"min-w-[220px]",placeholder:r(e?"已配置,留空则不修改":"一般不用填"),title:r("积分查询已复用转发用的登录凭证,这里通常留空即可。只有旧版本填过、或从旧代理导入过凭证时才有值"),value:t,onChange:d=>a(d.currentTarget.value)}),e?s.jsx(se,{variant:"outline",size:"sm",disabled:c,onClick:o,title:r("清除已配置的余额查询凭证"),children:r("清除")}):null]})}function u8({hasApiKey:e,noAuth:t,value:a,onValue:o,onToggleNoAuth:c,onClear:d,clearBusy:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-api-key-input",children:r("API Key")}),s.jsx($e,{id:"account-api-key-input",type:"password",autoComplete:"new-password",className:"min-w-[220px]",disabled:t,placeholder:e?r("已配置,留空则不修改"):"sk-…",title:r("上游的 API Key。留空 = 不修改(改凭证不会换账号 id);要清掉已配的凭证用右边的「清除」"),value:a,onChange:p=>o(p.currentTarget.value)}),e&&!t?s.jsx(se,{variant:"outline",size:"sm",disabled:f,onClick:d,title:r("清除已配置的 API Key(转发时会因缺少凭证被跳过)"),children:r("清除")}):null]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:t,"aria-label":r("该上游无需鉴权"),onCheckedChange:p=>c(p===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(转发与拉取模型都不发送鉴权头)")})]})}),s.jsxs("p",{className:"detail",children:[r("上游本来不要凭证时(本地 Ollama、OpenCode Zen 的免费档)勾上这一项:账号会被正常选路;只把 Key 留空"),s.jsx("strong",{children:r("又不勾")}),r("会被当成「未配置凭证」而跳过。")]})]})}function d8({provider:e,name:t,protocol:a,baseUrl:o,count:c,emulation:d,onName:f,onProtocol:p,onBaseUrl:h,onEmulation:b,onRemove:y}){const v=Pe().wbProviders?.PROTOCOL_OPTIONS||[{value:"openai",label:r("OpenAI 兼容")},{value:"anthropic",label:"Anthropic"}],w=v.find(j=>j.value===a)?.label||a;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("提供商")}),s.jsxs("p",{children:[r("这一栏改的是"),s.jsx("strong",{children:r("「{name}」本身",{name:e.name||e.id})}),r("(名下 {count} 个账号共用)",{count:c}),r("改协议 / Base URL 会改变它们的转发方式,正在进行的请求可能失败;模型清单与映射在「模型管理」页。")]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-provider-name",children:r("名称")}),s.jsx($e,{id:"account-provider-name",maxLength:NR,className:"min-w-[220px]",placeholder:r("提供商显示名,1~{max} 个字符",{max:NR}),value:t,onChange:j=>f(j.currentTarget.value)})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-protocol",children:r("协议")}),s.jsxs(ft,{value:a,onValueChange:j=>p(String(j)),children:[s.jsx(mt,{id:"account-provider-protocol",className:"min-w-[180px]",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:v.map(j=>s.jsx(qe,{value:j.value,children:j.label},j.value))})]})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-baseurl",children:r("Base URL")}),s.jsx($e,{id:"account-provider-baseurl",className:"min-w-[260px]",placeholder:r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),value:o,onChange:j=>h(j.currentTarget.value)})]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:d==="opencode","aria-label":r("伪装 OpenCode 官方客户端"),onCheckedChange:j=>b(j===!0?"opencode":"")}),s.jsx("span",{className:"text-xs text-subtle",children:r("伪装 OpenCode 官方客户端(OpenCode Zen 免费档要它才放行)")})]})}),s.jsxs("p",{className:"detail",children:[r("开启后,网关按 OpenCode 官方 CLI 的形状发请求:没填 Key 的账号用匿名凭证"),s.jsx("code",{children:"public"}),r("、补官方会话头、请求体补两个占位工具(上游免费档的三道校验)。"),s.jsx("strong",{children:r("它会改写请求体")}),r(",只对 OpenCode Zen 这类上游有意义,别的家请关掉。")]}),s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"destructive",onClick:y,children:r("删除提供商")}),s.jsx("span",{className:"detail",children:r("级联删除名下全部账号,不可恢复")})]})]})}function f8({id:e,onClose:t}){const a=Ea(e),[o,c]=x.useState(a?.enabled!==!1),[d,f]=x.useState(a?.name||""),[p,h]=x.useState(()=>CR(a?.proxy)),[b,y]=x.useState(""),[v,w]=x.useState(()=>uw(a)),[j,S]=x.useState(!1),[N,k]=x.useState(""),[T,D]=x.useState(null),[C,A]=x.useState(""),[R,I]=x.useState("chat_completions"),[P,O]=x.useState(""),[_,L]=x.useState(""),[H,B]=x.useState(""),[z,Q]=x.useState(a?.noAuth===!0),[K,X]=x.useState(()=>Z$(a)),[q,$]=x.useState(()=>s8(a?.balanceQuery)),[Y,F]=x.useState(()=>Y$(a)),[G,W]=x.useState("basic"),[le,M]=x.useState(()=>String(Number(a?.maxConcurrent)||0));if(x.useEffect(()=>{let he=!0;D(null);const ye=Ea(e);return ye?(Promise.resolve(Pe().wbCustomProvidersUi?.find?.(kn(ye))).then(je=>{!he||!je||(D(je),A(je.name||""),I(je.protocol||"chat_completions"),O(je.baseUrl||""),L(typeof je.clientEmulation=="string"?je.clientEmulation:""))}).catch(()=>{}),()=>{he=!1}):()=>{he=!1}},[e]),!a)return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置")})}),s.jsx(Bt,{children:s.jsx("p",{className:"detail",children:r("账号不存在,请刷新后重试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const U=a,Z=o8(U,El()),ae=kn(U)==="catpaw",ce=kn(U).startsWith("custom-"),J=wA(T,U.baseUrl)||p.mode==="rotate",ie=kf(U.balanceQuery?.scheme),ge={};for(const he of ie?.fields??[])ge[he.key]=t8(U.balanceQuery,he);const ee=!!(ie&&ie.fields.length)&&!n8(U.balanceQuery);async function fe(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceToken:null}),y(""),Le(r("✅ 已清除余额查询凭证")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function te(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{apiKey:null}),B(""),Le(r("✅ 已清除 API Key(该账号现在没有凭证,转发会被跳过)")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function Ce(he){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceQuery:{[he]:null}}),$(ye=>({...ye,[he]:""})),Le(r("✅ 已清除查询凭证")),await Pe().wbApp?.refresh?.()}catch(ye){Le(r("清除失败:{error}",{error:ut(ye)}),"err")}finally{S(!1)}}}function re(){if(!ce)return null;const he=H.trim(),ye={};return he?ye.apiKey=he:z!==(U.noAuth===!0)&&(ye.noAuth=z),Object.keys(ye).length?ye:null}function de(){if(!T)return null;const he=C.trim(),ye=P.trim();if(!he)return{error:r("请填写提供商名称")};if(!ye)return{error:r("请填写提供商的 Base URL")};const je=typeof T.clientEmulation=="string"?T.clientEmulation:"";return T.name===he&&T.protocol===R&&T.baseUrl===ye&&je===_?null:{id:T.id,name:he,protocol:R,baseUrl:ye,clientEmulation:_}}async function ke(){if(j)return;let he;try{he=jw(p)}catch(Ct){Le(ut(Ct),"err");return}const ye=de();if(ye&&"error"in ye){k(s.jsx("span",{className:"text-destructive",children:ye.error}));return}const je=Ta(U)?W$(U,K):null;if(je&&"error"in je){k(s.jsx("span",{className:"text-destructive",children:je.error}));return}const xe=K$(U,Y),Te=r8(U.balanceQuery?.scheme,q),Oe=re()||{},Ne=Number(le);if(!Number.isFinite(Ne)||Ne<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}const _e=Math.min(Rl,Math.round(Ne)),Ye=Number(U.maxConcurrent)||0,kt=_e!==Ye?{maxConcurrent:_e}:{};S(!0);try{const Ct=ae&&b.trim()?{balanceToken:b.trim()}:{},Rt=Gh(U)&&v!==uw(U)?{zcodePlan:v}:{};if(await Pe().workbuddyDesktop?.updateAccount?.(e,{name:d.trim()||U.name,enabled:o,proxy:he,...Ct,...Rt,...Oe,...kt,...Te?{balanceQuery:Te}:{},...je&&"patch"in je?je.patch:{},...xe&&"patch"in xe?xe.patch:{}}),ye)try{await Pe().wbCustomProvidersUi?.update?.(ye)}catch(ot){k(s.jsx("span",{className:"text-destructive",children:r("账号已保存,但提供商未更新:{error}",{error:ut(ot)})})),await Pe().wbApp?.refresh?.(),S(!1);return}t(),Le(r("✅ 账号设置已保存"));try{await Pe().wbApp?.refresh?.()}catch{}}catch(Ct){k(s.jsx("span",{className:"text-destructive",children:ut(Ct)})),Le(r("保存失败:{error}",{error:ut(Ct)}),"err")}finally{S(!1)}}const Ee=Number(ir(kn(U)).concurrencyDefault)||0,ve=ae||ce||Gh(U);return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||j||t()},children:s.jsxs(Zt,{className:"w-[min(900px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置 · {name}",{name:sg(a)})})}),s.jsx(Bt,{className:"p-0",children:s.jsxs("div",{className:"acct-dlg",children:[s.jsx("aside",{className:"prov-rail acct-dlg-rail","aria-label":r("账号设置分组"),children:s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("账号设置")}),[["basic",r("基本")],...ve?[["credential",r("凭证与套餐")]]:[],...Ta(U)?[["query",r("查询设置")],["limiter",r("限制器")]]:[],["network",r("网络")]].map(([he,ye])=>s.jsx(ru,{active:G===he,title:ye,className:"shadow-none",onClick:()=>W(he),children:ye},he))]})}),s.jsxs("div",{className:"acct-dlg-main",children:[G==="basic"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("基本")}),s.jsx("p",{children:r("这条账号是谁、排第几、能不能接请求。")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("启用")}),s.jsx(hs,{checked:o,onCheckedChange:c,"aria-label":r("启用该账号")}),s.jsx("span",{className:"detail",children:r("关闭则不参与转发(余额查询照常,见「查询设置」)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-name-input",children:r("备注名")}),s.jsx($e,{id:"account-name-input",maxLength:100,placeholder:r("账号显示名称"),className:"max-w-[280px]",value:d,onChange:he=>f(he.currentTarget.value)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("转发顺序")}),s.jsx("span",{className:"detail",children:r("在列表里拖:拖分组带调整整组顺位,拖行首把手调整组内先后(顺序由拖拽表达,不再填数字)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-conc-input",children:r("并发上限")}),s.jsx($e,{id:"account-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",value:le,onChange:he=>M(he.currentTarget.value)}),s.jsx("span",{className:"detail",children:Ee>0?r("0 = 按本家默认 {default}",{default:Ee}):r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:Ee>0?r("并发上限 受上游硬顶约束,达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)"):r("并发上限 0~{max};达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)",{max:Rl})})]}):null,G==="credential"&&ve?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("凭证与套餐")}),s.jsx("p",{children:r("这一段按提供商出现:有什么配什么。")})]}),ae?s.jsx(c8,{configured:a.hasBalanceToken===!0,value:b,onChange:y,clearBusy:j,onClear:()=>{fe()}}):null,ce?s.jsx(u8,{hasApiKey:U.hasApiKey===!0,noAuth:z,value:H,onValue:B,onToggleNoAuth:Q,onClear:()=>{te()},clearBusy:j}):null,Gh(U)?s.jsx(i8,{plan:v,hasJwt:a.canClaim===!0,onChange:w}):null,T?s.jsx(d8,{provider:T,count:Z.length+1,name:C,protocol:R,baseUrl:P,emulation:_,onName:A,onProtocol:I,onBaseUrl:O,onEmulation:L,onRemove:()=>{j||Promise.resolve(Pe().wbCustomProvidersUi?.remove?.(T.id)).then(he=>{he&&t()})}}):null]}):null,G==="query"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("查询设置")}),s.jsx("p",{children:r("余额列读数的自动刷新;也是「限制器」余额规则的数据来源。")})]}),ie?s.jsx(l8,{spec:ie,values:q,configured:ge,onValue:(he,ye)=>$(je=>({...je,[he]:ye})),onClear:he=>{Ce(he)},clearBusy:j,idPrefix:"account-balance-query"}):null,ee?s.jsx("p",{className:"detail mt-2.5 text-subtle",children:r("查询凭证还没配齐:填好后余额列才有读数,在此之前会显示「未配置」。")}):null,s.jsx(J$,{account:U,draft:K,onChange:X})]}):null,G==="limiter"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("限制器")}),s.jsx("p",{children:r("按规则限制该账号参与转发:没有规则(或全部停用)= 不限制;跳过档自动恢复,禁用档需手动启用。")})]}),s.jsx(G$,{account:U,draft:Y,onChange:F})]}):null,G==="network"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("网络")}),s.jsx("p",{children:r("这条账号访问上游走哪条线路。")})]}),s.jsx(ER,{draft:p,onChange:h,idPrefix:"account-proxy",allowRotate:J}),a.proxy?.error?s.jsx("p",{className:"detail text-destructive",children:r("当前代理不可用:{error}(转发时会回退直连)",{error:a.proxy.error})}):null]}):null]})]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"detail mr-auto",style:{minHeight:18},children:N}),s.jsx(se,{variant:"outline",disabled:j,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{ke()},children:r(j?"保存中…":"保存")})]})]})})}const p8=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"proxy",label:r("修改代理")},{value:"concurrency",label:r("设置并发上限")},{value:"remove",label:r("删除")}];function m8({ids:e,action:t,onClose:a}){const[o,c]=x.useState(t),[d,f]=x.useState(()=>CR(null)),[p,h]=x.useState(""),[b,y]=x.useState(!1),[v,w]=x.useState(""),j=e.map(C=>Ea(C)).filter(C=>C!==null),S=j.reduce((C,A)=>Math.max(C,Number(ir(kn(A)).concurrencyDefault)||0),0),N=j.length>0&&j.every(C=>UF(C));function k(C){return Promise.resolve(Pe().wbConfirm?.ask?.({title:r("删除选中的账号"),html:r("确定删除选中的 {count} 个账号?此操作不可恢复,账号的登录态会一并移除。",{count:C}),okText:r("删除"),okClass:"danger"})??!1)}async function T(){if(b)return;if(!e.length){Le(r("没有选中的账号"),"err");return}let C;if(o==="proxy")try{C=jw(d)}catch(R){Le(ut(R),"err");return}let A;if(o==="concurrency"){const R=Number(p.trim());if(!p.trim()||!Number.isFinite(R)||R<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}A=Math.min(Rl,Math.round(R))}if(!(o==="remove"&&!await k(e.length))){if(o==="disable"||o==="remove"){const R=new Set(e);if(!El().filter(P=>P.enabled!==!1&&!R.has(P.id)).length){const P=r(o==="remove"?"删除":"禁用");if(!await Promise.resolve(Pe().wbConfirm?.ask?.({title:r("全部启用中的账号将被{what}",{what:P}),html:r("这会{what}所有启用中的账号,转发将不可用。确定继续?",{what:P}),okText:P,okClass:o==="remove"?"danger":"primary"})??!1))return}}y(!0),w("");try{const R={action:o,ids:e};o==="proxy"&&(R.proxy=C),o==="concurrency"&&(R.maxConcurrent=A);const I=await Pe().workbuddyDesktop?.batchAccounts?.(R),P=(I?.ok||[]).filter(B=>B.changes?.length).length,O=(I?.removed||[]).length,_=I?.failed||[],L=o==="remove"?O:P,H={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;if(_.length){const B=_.slice(0,3).map(z=>sg(Ea(String(z.id)))||z.id).join(r("、"));Le(r("{verb}完成:成功 {ok} 个,失败 {fail} 个({detail}{more})",{verb:H,ok:L,fail:_.length,detail:B,more:_.length>3?r(" 等"):""}),"err"),w(s.jsxs("span",{className:"text-destructive",children:[r("失败 {count} 个:",{count:_.length}),_.map(z=>`${sg(Ea(String(z.id)))||z.id}(${z.error})`).join(r(";"))]}))}else Le(r("✅ {verb}完成:共 {count} 个账号",{verb:H,count:L})),a();await Pe().wbApp?.refresh?.()}catch(R){w(s.jsx("span",{className:"text-destructive",children:ut(R)})),Le(r("批量操作失败:{error}",{error:ut(R)}),"err")}finally{y(!1)}}}const D={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||b||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {count} 个账号",{count:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下账号")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:j.map(C=>sg(C)).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:c,className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:p8.map(C=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:C.value}),C.label]},C.value))}),o==="proxy"?s.jsx("div",{className:"mt-2.5",children:s.jsx(ER,{draft:d,onChange:f,idPrefix:"batch-proxy",allowRotate:N})}):null,o==="concurrency"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-conc-input",children:r("并发上限")}),s.jsx($e,{id:"batch-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",placeholder:r("不限"),value:p,onChange:C=>h(C.currentTarget.value)}),s.jsx("span",{className:"detail",children:r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:S>0?r("并发上限 0~{max};有上游硬顶的家(如 CodeArts)以它的硬顶为准;达到上限的账号会被跳过、请求转给其他账号",{max:Rl}):r("并发上限 0~{max};达到上限的账号会被跳过、请求转给其他账号",{max:Rl})})]}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:b,onClick:a,children:r("取消")}),s.jsx(se,{variant:o==="remove"?"destructive":"default",disabled:b,onClick:()=>{T()},children:b?r("执行中…"):r("执行({action})",{action:D})})]})]})})}function h8(){const e=Ws();return e.dialog?e.dialog.kind==="settings"?s.jsx(f8,{id:e.dialog.id,onClose:eg},e.dialog.id):s.jsx(m8,{ids:e.dialog.ids,action:e.dialog.action,onClose:eg},e.dialog.ids.join(",")):null}var Sw={exports:{}},Cf={},Nw={exports:{}},kw={};var AR;function g8(){return AR||(AR=1,(function(e){function t(X,q){var $=X.length;X.push(q);e:for(;0<$;){var Y=$-1>>>1,F=X[Y];if(0>>1;Yc(le,$))Mc(U,le)?(X[Y]=U,X[M]=$,Y=M):(X[Y]=le,X[W]=$,Y=W);else if(Mc(U,$))X[Y]=U,X[M]=$,Y=M;else break e}}return q}function c(X,q){var $=X.sortIndex-q.sortIndex;return $!==0?$:X.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();e.unstable_now=function(){return f.now()-p}}var h=[],b=[],y=1,v=null,w=3,j=!1,S=!1,N=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function A(X){for(var q=a(b);q!==null;){if(q.callback===null)o(b);else if(q.startTime<=X)o(b),q.sortIndex=q.expirationTime,t(h,q);else break;q=a(b)}}function R(X){if(N=!1,A(X),!S)if(a(h)!==null)S=!0,I||(I=!0,B());else{var q=a(b);q!==null&&K(R,q.startTime-X)}}var I=!1,P=-1,O=5,_=-1;function L(){return k?!0:!(e.unstable_now()-_X&&L());){var Y=v.callback;if(typeof Y=="function"){v.callback=null,w=v.priorityLevel;var F=Y(v.expirationTime<=X);if(X=e.unstable_now(),typeof F=="function"){v.callback=F,A(X),q=!0;break t}v===a(h)&&o(h),A(X)}else o(h);v=a(h)}if(v!==null)q=!0;else{var G=a(b);G!==null&&K(R,G.startTime-X),q=!1}}break e}finally{v=null,w=$,j=!1}q=void 0}}finally{q?B():I=!1}}}var B;if(typeof C=="function")B=function(){C(H)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,Q=z.port2;z.port1.onmessage=H,B=function(){Q.postMessage(null)}}else B=function(){T(H,0)};function K(X,q){P=T(function(){X(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_forceFrameRate=function(X){0>X||125Y?(X.sortIndex=$,t(b,X),a(h)===null&&X===a(b)&&(N?(D(P),P=-1):N=!0,K(R,$-Y))):(X.sortIndex=F,t(h,X),S||j||(S=!0,I||(I=!0,B()))),X},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(X){var q=w;return function(){var $=w;w=q;try{return X.apply(this,arguments)}finally{w=$}}}})(kw)),kw}var RR;function x8(){return RR||(RR=1,Nw.exports=g8()),Nw.exports}var OR;function b8(){if(OR)return Cf;OR=1;var e=x8(),t=Vd(),a=S1();function o(n){var l="https://react.dev/errors/"+n;if(1Ce||(n.current=te[Ce],te[Ce]=null,Ce--)}function ke(n,l){Ce++,te[Ce]=n.current,n.current=l}var Ee=re(null),ve=re(null),he=re(null),ye=re(null);function je(n,l){switch(ke(he,l),ke(ve,n),ke(Ee,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?$3(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=$3(l),n=q3(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}de(Ee),ke(Ee,n)}function xe(){de(Ee),de(ve),de(he)}function Te(n){var l=n.memoizedState;l!==null&&(zd._currentValue=l.memoizedState,ke(ye,n)),l=Ee.current;var i=q3(l,n.type);l!==i&&(ke(ve,n),ke(Ee,i))}function Oe(n){ve.current===n&&(de(Ee),de(ve)),ye.current===n&&(de(ye),zd._currentValue=fe)}var Ne,_e;function Ye(n){if(Ne===void 0)try{throw Error()}catch(i){var l=i.stack.trim().match(/\n( *(at )?)/);Ne=l&&l[1]||"",_e=-1gl in xi?Pse(xi,gl,{enumerable:!0,configurable:!0,writable:!0,value:to}):xi[gl]=to;var ln=(xi,gl,to)=>_se(xi,typeof gl!="symbol"?gl+"":gl,to);(function(){"use strict";function xi(e,t){for(var a=0;ao[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var to={exports:{}},Ud={};var oC;function _5(){if(oC)return Ud;oC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:e,type:o,key:f,ref:c!==void 0?c:null,props:d}}return Ud.Fragment=t,Ud.jsx=a,Ud.jsxs=a,Ud}var iC;function L5(){return iC||(iC=1,to.exports=_5()),to.exports}var s=L5(),jv={exports:{}},ct={};var cC;function z5(){if(cC)return ct;cC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),j=Symbol.iterator;function S(M){return M===null||typeof M!="object"?null:(M=j&&M[j]||M["@@iterator"],typeof M=="function"?M:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,T={};function D(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}D.prototype.isReactComponent={},D.prototype.setState=function(M,U){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,U,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=D.prototype;function A(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}var R=A.prototype=new C;R.constructor=A,k(R,D.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},_=Object.prototype.hasOwnProperty;function L(M,U,Z){var ae=Z.ref;return{$$typeof:e,type:M,key:U,ref:ae!==void 0?ae:null,props:Z}}function H(M,U){return L(M.type,U,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function z(M){var U={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Z){return U[Z]})}var Q=/\/+/g;function K(M,U){return typeof M=="object"&&M!==null&&M.key!=null?z(""+M.key):U.toString(36)}function X(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(P,P):(M.status="pending",M.then(function(U){M.status==="pending"&&(M.status="fulfilled",M.value=U)},function(U){M.status==="pending"&&(M.status="rejected",M.reason=U)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function q(M,U,Z,ae,ce){var J=typeof M;(J==="undefined"||J==="boolean")&&(M=null);var ie=!1;if(M===null)ie=!0;else switch(J){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(M.$$typeof){case e:case t:ie=!0;break;case y:return ie=M._init,q(ie(M._payload),U,Z,ae,ce)}}if(ie)return ce=ce(M),ie=ae===""?"."+K(M,0):ae,I(ce)?(Z="",ie!=null&&(Z=ie.replace(Q,"$&/")+"/"),q(ce,U,Z,"",function(fe){return fe})):ce!=null&&(B(ce)&&(ce=H(ce,Z+(ce.key==null||M&&M.key===ce.key?"":(""+ce.key).replace(Q,"$&/")+"/")+ie)),U.push(ce)),1;ie=0;var ge=ae===""?".":ae+":";if(I(M))for(var ee=0;ee"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Fd(e){const{overflow:t,overflowX:a,overflowY:o,display:c}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&c!=="inline"&&c!=="contents"}function H5(e){return/^(table|td|th)$/.test(Hs(e))}function Dm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const U5=/transform|translate|scale|rotate|perspective|filter/,V5=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Nv;function kv(e){const t=At(e)?xr(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Cv()&&(bi(t.backdropFilter)||bi(t.filter))||U5.test(t.willChange||"")||V5.test(t.contain||"")}function F5(e){let t=so(e);for(;dn(t)&&!no(t);){if(kv(t))return t;if(Dm(t))return null;t=so(t)}return null}function Cv(){return Nv==null&&(Nv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nv}function no(e){return/^(html|body|#document)$/.test(Hs(e))}function xr(e){return Sn(e).getComputedStyle(e)}function Im(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function so(e){if(Hs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bc(e)&&e.host||xl(e);return Bc(t)?t.host:t}function dC(e){const t=so(e);return no(t)?(e.ownerDocument||e).body:dn(t)&&Fd(t)?t:dC(t)}function Hc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const c=dC(e),d=c===((o=e.ownerDocument)==null?void 0:o.body),f=Sn(c);if(d){const p=Tv(f);return t.concat(f,f.visualViewport||[],Fd(c)?c:[],p&&a?Hc(p):[])}else return t.concat(c,Hc(c,[],a))}function Tv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ev={...B5},fC={};function Ds(e,t){const a=x.useRef(fC);return a.current===fC&&(a.current=e(t)),a}const Av=Ev.useInsertionEffect,$5=Av&&Av!==Ev.useLayoutEffect?Av:e=>e();function Ie(e){const t=Ds(q5).current;return t.next=e,$5(t.effect),t.trampoline}function q5(){const e={next:void 0,callback:G5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function G5(){}const De=typeof document<"u"?x.useLayoutEffect:()=>{};function Rv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const Ov={};function Wr(e,t,a,o,c){if(!a&&!o&&!c&&!e)return Pm(t);let d=Pm(e);return t&&(d=$d(d,t)),a&&(d=$d(d,a)),o&&(d=$d(d,o)),c&&(d=$d(d,c)),d}function K5(e){if(e.length===0)return Ov;if(e.length===1)return Pm(e[0]);let t=Pm(e[0]);for(let a=1;a=65&&c<=90&&(typeof t=="function"||typeof t>"u")}function Mv(e){return typeof e=="function"}function mC(e,t){return Mv(e)?e(t):e??Ov}function Q5(e,t){return t?e?(...a)=>{const o=a[0];if(xC(o)){const d=o;_m(d);const f=t(...a);return d.baseUIHandlerPrevented||e?.(...a),f}const c=t(...a);return e?.(...a),c}:hC(t):e}function hC(e){return e&&((...t)=>{const a=t[0];return xC(a)&&_m(a),e(...t)})}function _m(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gC(e,t){return t?e?t+" "+e:t:e}function xC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Z5(e,t){return function(o,...c){const d=new URL(e);return d.searchParams.set("code",o.toString()),c.forEach(f=>d.searchParams.append("args[]",f)),`${t} error #${o}; visit ${d} for the full message.`}}const on=Z5("https://base-ui.com/production-error","Base UI"),bC=x.createContext(void 0);function vC(e=!1){const t=x.useContext(bC);if(t===void 0&&!e)throw new Error(on(16));return t}function W5(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:c=0,isNativeButton:d}=e,f=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const b={onKeyDown(y){a&&t&&y.key!=="Tab"&&y.preventDefault()}};return o||(b.tabIndex=c,!d&&a&&(b.tabIndex=t?c:-1)),(d&&(t||f)||!d&&a)&&(b["aria-disabled"]=a),d&&(!t||p)&&(b.disabled=a),b},[o,a,t,f,p,d,c])}}function $t(e){return e?.ownerDocument||document}function Uc(e,t,{detail:a=0}={}){e.dispatchEvent(new(Sn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Jr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:c=!0,composite:d}=e,f=x.useRef(null),p=vC(!0),h=d??p!==void 0,{props:b}=W5({focusableWhenDisabled:a,disabled:t,composite:h,tabIndex:o,isNativeButton:c}),y=x.useCallback(()=>{const j=f.current;Dv(j)&&h&&t&&b.disabled===void 0&&j.disabled&&(j.disabled=!1)},[t,b.disabled,h]);De(y,[y]);const v=x.useCallback((j={})=>{const{onClick:S,onMouseDown:N,onKeyUp:k,onKeyDown:T,onPointerDown:D,...C}=j;return Wr({onClick(A){if(t){A.preventDefault();return}S?.(A)},onMouseDown(A){t||N?.(A)},onKeyDown(A){if(t||(_m(A),T?.(A),A.baseUIHandlerPrevented))return;const R=A.target===A.currentTarget,I=A.currentTarget,P=Dv(I),O=!c&&J5(I),_=R&&(c?P:!O),L=A.key==="Enter",H=A.key===" ",B=I.getAttribute("role"),z=B?.startsWith("menuitem")||B==="option"||B==="gridcell";if(R&&h&&H){if(A.defaultPrevented&&z)return;A.preventDefault(),(!c||P)&&(A.preventBaseUIHandler(),Uc(I,A));return}if(!_||c||!H&&!L){R&&O&&H&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),L&&(A.preventBaseUIHandler(),Uc(I,A)))},onKeyUp(A){if(!t){if(_m(A),k?.(A),A.target===A.currentTarget&&c&&h&&Dv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!c&&!h&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Uc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}D?.(A)}},c?{type:"button"}:{role:"button"},b,C)},[t,b,h,c]),w=Ie(j=>{f.current=j,y()});return{getButtonProps:v,buttonRef:w}}function Dv(e){return dn(e)&&e.tagName==="BUTTON"}function J5(e){return dn(e)&&e.tagName==="A"&&!!e.href}function ea(e,t,a,o){const c=Ds(yC).current;return tz(c,e,t,a,o)&&wC(c,[e,t,a,o]),c.callback}function ez(e){const t=Ds(yC).current;return nz(t,e)&&wC(t,e),t.callback}function yC(){return{callback:null,cleanup:null,refs:[]}}function tz(e,t,a,o,c){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==c}function nz(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function wC(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let c=0;c{for(let c=0;c=e}function jC(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Iv(19)?a?.ref:t.ref)??null}function qt(){}const Or=Object.freeze([]),fn=Object.freeze({});function rz(e,t){const a={};for(const o in e){const c=e[o];if(t?.hasOwnProperty(o)){const d=t[o](c);d!=null&&Object.assign(a,d);continue}c===!0?a[`data-${o.toLowerCase()}`]="":c&&(a[`data-${o.toLowerCase()}`]=c.toString())}return a}function az(e,t){return typeof e=="function"?e(t):e}function lz(e,t){return typeof e=="function"?e(t):e}function yt(e,t,a={}){let o=t.render;a.enabled!==!1&&(o=uz(o));const c=oz(t,a,o);if(a.enabled===!1)return null;const d=a.state??fn;return dz(e,o,c,d)}function oz(e,t,a){const{className:o,style:c}=e,{state:d=fn,ref:f,props:p,stateAttributesMapping:h,enabled:b=!0}=t,y=b?az(o,d):void 0,v=b?lz(c,d):void 0,w=b?rz(d,h):fn,j=b&&p?iz(p):void 0,S=b?Rv(w,j)??{}:fn;return typeof document<"u"&&(b?Array.isArray(f)?S.ref=ez([S.ref,jC(a),...f]):S.ref=ea(S.ref,jC(a),f):ea(null,null)),b?(y!==void 0&&(S.className=gC(S.className,y)),v!==void 0&&(S.style=Rv(S.style,v)),S):fn}function iz(e){return Array.isArray(e)?K5(e):Wr(void 0,e)}const cz=Symbol.for("react.lazy");function uz(e){if(e?.$$typeof!==cz)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function dz(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const c=Wr(a,t.props);return c.ref=a.ref,x.cloneElement(t,c)}if(e&&typeof e=="string")return fz(e,a);throw new Error(on(8))}function fz(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const pz=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,focusableWhenDisabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{getButtonProps:y,buttonRef:v}=Jr({disabled:d,focusableWhenDisabled:f,native:p});return yt("button",t,{state:{disabled:d},ref:[a,v],props:[b,y]})});function SC(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,CC=NC,Vc=(e,t)=>a=>{var o;if(t?.variants==null)return CC(e,a?.class,a?.className);const{variants:c,defaultVariants:d}=t,f=Object.keys(c).map(b=>{const y=a?.[b],v=d?.[b];if(y===null)return null;const w=kC(y)||kC(v);return c[b][w]}),p=a&&Object.entries(a).reduce((b,y)=>{let[v,w]=y;return w===void 0||(b[v]=w),b},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((b,y)=>{let{class:v,className:w,...j}=y;return Object.entries(j).every(S=>{let[N,k]=S;return Array.isArray(k)?k.includes({...d,...p}[N]):{...d,...p}[N]===k})?[...b,v,w]:b},[]);return CC(e,f,h,a?.class,a?.className)},mz=(e,t)=>{const a=new Array(e.length+t.length);for(let o=0;o({classGroupId:e,validator:t}),TC=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a}),Lm="-",EC=[],gz="arbitrary..",xz=e=>{const t=vz(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return bz(f);const p=f.split(Lm),h=p[0]===""&&p.length>1?1:0;return AC(p,h,t)},getConflictingClassGroupIds:(f,p)=>{if(p){const h=o[f],b=a[f];return h?b?mz(b,h):h:b||EC}return a[f]||EC}}},AC=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;const c=e[t],d=a.nextPart.get(c);if(d){const b=AC(e,t+1,d);if(b)return b}const f=a.validators;if(f===null)return;const p=t===0?e.join(Lm):e.slice(t).join(Lm),h=f.length;for(let b=0;be.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),a=t.indexOf(":"),o=t.slice(0,a);return o?gz+o:void 0})(),vz=e=>{const{theme:t,classGroups:a}=e;return yz(a,t)},yz=(e,t)=>{const a=TC();for(const o in e){const c=e[o];Pv(c,a,o,t)}return a},Pv=(e,t,a,o)=>{const c=e.length;for(let d=0;d{if(typeof e=="string"){jz(e,t,a);return}if(typeof e=="function"){Sz(e,t,a,o);return}Nz(e,t,a,o)},jz=(e,t,a)=>{const o=e===""?t:RC(t,e);o.classGroupId=a},Sz=(e,t,a,o)=>{if(kz(e)){Pv(e(o),t,a,o);return}t.validators===null&&(t.validators=[]),t.validators.push(hz(a,e))},Nz=(e,t,a,o)=>{const c=Object.entries(e),d=c.length;for(let f=0;f{let a=e;const o=t.split(Lm),c=o.length;for(let d=0;d"isThemeGetter"in e&&e.isThemeGetter===!0,Cz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),o=Object.create(null);const c=(d,f)=>{a[d]=f,t++,t>e&&(t=0,o=a,a=Object.create(null))};return{get(d){let f=a[d];if(f!==void 0)return f;if((f=o[d])!==void 0)return c(d,f),f},set(d,f){d in a?a[d]=f:c(d,f)}}},_v="!",OC=":",Tz=[],MC=(e,t,a,o,c)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:o,isExternal:c}),Ez=e=>{const{prefix:t,experimentalParseClassName:a}=e;let o=c=>{const d=[];let f=0,p=0,h=0,b;const y=c.length;for(let N=0;Nh?b-h:void 0;return MC(d,j,w,S)};if(t){const c=t+OC,d=o;o=f=>f.startsWith(c)?d(f.slice(c.length)):MC(Tz,!1,f,void 0,!0)}if(a){const c=o;o=d=>a({className:d,parseClassName:c})}return o},Az=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((a,o)=>{t.set(a,1e6+o)}),a=>{const o=[];let c=[];for(let d=0;d0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Rz=e=>({cache:Cz(e.cacheSize),parseClassName:Ez(e),sortModifiers:Az(e),postfixLookupClassGroupIds:Oz(e),...xz(e)}),Oz=e=>{const t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let o=0;o{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:f}=t,p=[],h=e.trim().split(Mz);let b="";for(let y=h.length-1;y>=0;y-=1){const v=h[y],{isExternal:w,modifiers:j,hasImportantModifier:S,baseClassName:N,maybePostfixModifierPosition:k}=a(v);if(w){b=v+(b.length>0?" "+b:b);continue}let T=!!k,D;if(T){const P=N.substring(0,k);D=o(P);const O=D&&f[D]?o(N):void 0;O&&O!==D&&(D=O,T=!1)}else D=o(N);if(!D){if(!T){b=v+(b.length>0?" "+b:b);continue}if(D=o(N),!D){b=v+(b.length>0?" "+b:b);continue}T=!1}const C=j.length===0?"":j.length===1?j[0]:d(j).join(":"),A=S?C+_v:C,R=A+D;if(p.indexOf(R)>-1)continue;p.push(R);const I=c(D,T);for(let P=0;P0?" "+b:b)}return b},Iz=(...e)=>{let t=0,a,o,c="";for(;t{if(typeof e=="string")return e;let t,a="";for(let o=0;o{let a,o,c,d;const f=h=>{const b=t.reduce((y,v)=>v(y),e());return a=Rz(b),o=a.cache.get,c=a.cache.set,d=p,p(h)},p=h=>{const b=o(h);if(b)return b;const y=Dz(h,a);return c(h,y),y};return d=f,(...h)=>d(Iz(...h))},_z=[],Ns=e=>{const t=a=>a[e]||_z;return t.isThemeGetter=!0,t.themeKey=e,t},IC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Uz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Vz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ro=e=>Lz.test(e),Nt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Lv=e=>e.endsWith("%")&&Nt(e.slice(0,-1)),bl=e=>zz.test(e),_C=()=>!0,Fz=e=>Bz.test(e)&&!Hz.test(e),zv=()=>!1,$z=e=>Uz.test(e),qz=e=>Vz.test(e),Gz=e=>!Ke(e)&&!Xe(e),Kz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Yz=e=>ao(e,VC,zv),Ke=e=>IC.test(e),vi=e=>ao(e,FC,Fz),LC=e=>ao(e,nB,Nt),Xz=e=>ao(e,qC,_C),Qz=e=>ao(e,$C,zv),zC=e=>ao(e,HC,zv),Zz=e=>ao(e,UC,qz),zm=e=>ao(e,GC,$z),Xe=e=>PC.test(e),qd=e=>yi(e,FC),Wz=e=>yi(e,$C),BC=e=>yi(e,HC),Jz=e=>yi(e,VC),eB=e=>yi(e,UC),Bm=e=>yi(e,GC,!0),tB=e=>yi(e,qC,!0),ao=(e,t,a)=>{const o=IC.exec(e);return o?o[1]?t(o[1]):a(o[2]):!1},yi=(e,t,a=!1)=>{const o=PC.exec(e);return o?o[1]?t(o[1]):a:!1},HC=e=>e==="position"||e==="percentage",UC=e=>e==="image"||e==="url",VC=e=>e==="length"||e==="size"||e==="bg-size",FC=e=>e==="length",nB=e=>e==="number",$C=e=>e==="family-name",qC=e=>e==="number"||e==="weight",GC=e=>e==="shadow",sB=Pz(()=>{const e=Ns("color"),t=Ns("font"),a=Ns("text"),o=Ns("font-weight"),c=Ns("tracking"),d=Ns("leading"),f=Ns("breakpoint"),p=Ns("container"),h=Ns("spacing"),b=Ns("radius"),y=Ns("shadow"),v=Ns("inset-shadow"),w=Ns("text-shadow"),j=Ns("drop-shadow"),S=Ns("blur"),N=Ns("perspective"),k=Ns("aspect"),T=Ns("ease"),D=Ns("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...A(),Xe,Ke],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],O=()=>[Xe,Ke,h],_=()=>[ro,"full","auto",...O()],L=()=>[$a,"none","subgrid",Xe,Ke],H=()=>["auto",{span:["full",$a,Xe,Ke]},$a,Xe,Ke],B=()=>[$a,"auto",Xe,Ke],z=()=>["auto","min","max","fr",Xe,Ke],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...O()],q=()=>[ro,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],$=()=>[p,ro,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Y=()=>[ro,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],F=()=>[e,Xe,Ke],G=()=>[...A(),BC,zC,{position:[Xe,Ke]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",Jz,Yz,{size:[Xe,Ke]}],M=()=>[Lv,qd,vi],U=()=>["","none","full",b,Xe,Ke],Z=()=>["",Nt,qd,vi],ae=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Nt,Lv,BC,zC],ie=()=>["","none",S,Xe,Ke],ge=()=>["none",Nt,Xe,Ke],ee=()=>["none",Nt,Xe,Ke],fe=()=>[Nt,Xe,Ke],te=()=>[ro,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bl],breakpoint:[bl],color:[_C],container:[bl],"drop-shadow":[bl],ease:["in","out","in-out"],font:[Gz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bl],shadow:[bl],spacing:["px",Nt],text:[bl],"text-shadow":[bl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ro,Ke,Xe,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Xe,Ke]}],"container-named":[Kz],columns:[{columns:[Nt,"auto",Ke,Xe,p]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Xe,Ke]}],basis:[{basis:[ro,"full","auto",p,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nt,ro,"auto","initial","none",Ke]}],grow:[{grow:["",Nt,Xe,Ke]}],shrink:[{shrink:["",Nt,Xe,Ke]}],order:[{order:[$a,"first","last","none",Xe,Ke]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh","none",...q()]}],"font-size":[{text:["base",a,qd,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,tB,Xz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lv,Ke]}],"font-family":[{font:[Wz,Qz,t]}],"font-features":[{"font-features":[Ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Xe,Ke]}],"line-clamp":[{"line-clamp":[Nt,"none",Xe,LC]}],leading:[{leading:["none",d,...O()]}],"list-image":[{"list-image":["none",Xe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Nt,"from-font","auto",Xe,vi]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Nt,"auto",Xe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[$a,Xe,Ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Xe,Ke],radial:["",Xe,Ke],conic:["",$a,Xe,Ke]},eB,Zz]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Nt,Xe,Ke]}],"outline-w":[{outline:["",Nt,qd,vi]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,Bm,zm]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",v,Bm,zm]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Nt,vi]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",w,Bm,zm]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Nt,Xe,Ke]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Xe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xe,Ke]}],filter:[{filter:["","none",Xe,Ke]}],blur:[{blur:ie()}],brightness:[{brightness:[Nt,Xe,Ke]}],contrast:[{contrast:[Nt,Xe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",j,Bm,zm]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Nt,Xe,Ke]}],"hue-rotate":[{"hue-rotate":[Nt,Xe,Ke]}],invert:[{invert:["",Nt,Xe,Ke]}],saturate:[{saturate:[Nt,Xe,Ke]}],sepia:[{sepia:["",Nt,Xe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Xe,Ke]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Nt,Xe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[Nt,Xe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nt,Xe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nt,Xe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",Nt,Xe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[Nt,Xe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[Nt,Xe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Nt,Xe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nt,"initial",Xe,Ke]}],ease:[{ease:["linear","initial",T,Xe,Ke]}],delay:[{delay:[Nt,Xe,Ke]}],animate:[{animate:["none",D,Xe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Xe,Ke]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[Xe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[$a,Xe,Ke]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xe,Ke]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Nt,qd,vi,LC]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ue(...e){return sB(NC(e))}const rB=Vc(["group/button inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color,transform,box-shadow] duration-150 ease-out","outline-none select-none active:translate-y-[0.5px]","disabled:pointer-events-none disabled:opacity-45 disabled:shadow-none","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:"border-primary bg-primary font-semibold text-primary-on shadow-glow hover:border-primary-hover hover:bg-primary-hover",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"border-transparent bg-transparent text-subtle shadow-none hover:bg-control-hover hover:text-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive hover:bg-destructive-hover",dashed:"border-dashed border-border-strong bg-transparent text-muted-foreground shadow-none hover:border-primary hover:text-primary-fg",link:"border-transparent bg-transparent text-primary shadow-none underline-offset-4 hover:underline"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]","2xs":"h-4 rounded-pill px-1.5 text-[10px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]",icon:"h-[30px] w-[30px] rounded-md p-0","icon-2xs":"size-4 rounded-pill p-0","icon-xs":"size-6 rounded-sm p-0","icon-sm":"h-[26px] w-[26px] rounded-sm p-0","icon-lg":"size-9 rounded-md p-0"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:a,...o}){return s.jsx(pz,{className:Ue(rB({variant:t,size:a}),e),...o})}const aB="data-valid",lB="data-invalid",oB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KC={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},iB={disabled:!1,...KC},wi={valid(e){return e===null?null:e?{[aB]:""}:{[lB]:""}}},YC={invalid:void 0,name:void 0,validityData:{state:oB,errors:[],error:"",value:"",initialValue:null},setValidityData:qt,disabled:void 0,setTouched:qt,setDirty:qt,setFilled:qt,setFocused:qt,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:iB,registerFieldControl:qt,validation:{getValidationProps:(e,t=fn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qt,getInputControl:()=>null,commit:async()=>{},change:qt}},XC=x.createContext(YC);function Sa(e=!0){const t=x.useContext(XC);if(t.setValidityData===qt&&!e)throw new Error(on(28));return t}const cB=x.createContext(void 0);function uB(e=!1){const t=x.useContext(cB);if(!t&&!e)throw new Error(on(86));return t}const dB=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qt,validationMode:"onSubmit",submitCountRef:{current:0}});function Fc(){return x.useContext(dB)}let QC=0;function fB(e,t="mui"){const[a,o]=x.useState(e),c=e||a;return x.useEffect(()=>{a==null&&(QC+=1,o(`${t}-${QC}`))},[a,t]),c}const ZC=Ev.useId;function Gd(e,t){if(ZC!==void 0){const a=ZC();return e??(t?`${t}-${a}`:a)}return fB(e,t)}function Na(e){return Gd(e,"base-ui")}const pB=x.createContext({controlId:void 0,registerControlId:qt,resetControlId:qt,labelId:void 0,setLabelId:qt,messageIds:[],setMessageIds:qt,getDescriptionProps:e=>e});function vl(){return x.useContext(pB)}function Bv(e,t,a,o=!0,c){const[d,f]=x.useState(),p=Na(c?`${c}-label`:void 0),h=e??t??d;return De(()=>{const b=e||t||!o?void 0:mB(a.current,p);d!==b&&f(b)}),h}function mB(e,t){const a=hB(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function hB(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const c=e.nextElementSibling;if(c&&c.htmlFor===a)return c}const o=e.labels;return o&&o[0]}function lo(e={}){const{id:t,enabled:a=!0}=e,{controlId:o,registerControlId:c,resetControlId:d}=vl(),f=Na(),p=Ds(()=>Symbol()),h=x.useRef(!1),b=x.useRef(!1),y=Ie(()=>{!h.current||c===qt||(h.current=!1,c(p.current,void 0))});return De(()=>{if(!a||c===qt){y();return}let v;if(t!==void 0)b.current=!0,v=t;else if(b.current)v=f;else{d();return}if(v===void 0){y();return}h.current=!0,c(p.current,v)},[t,a,c,d,f,p,y]),De(()=>y,[y]),(a?o:void 0)??t??f}function gB(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:xB,platform:bB,maxTouchPoints:vB}=gB(),Hm=xB.toLowerCase(),Kd=bB.toLowerCase(),Yd=/^i(os$|p)/.test(Kd)||Kd==="macintel"&&vB>1,WC="android",Um=Kd===WC||Hm.includes(WC),JC=!Yd&&Kd.startsWith("mac");Kd.startsWith("win");const yB=JC||Yd,yl=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),e1=!yl&&Hm.includes("firefox");!yl&&Hm.includes("chrom");const wB=yB,Hv=/jsdom|happydom/.test(Hm);function or(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Bc(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function cs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Uv="data-base-ui-focusable",t1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ji="ArrowLeft",Si="ArrowRight",Vv="ArrowUp",Vm="ArrowDown",n1="data-starting-style",jB="data-ending-style",SB={[n1]:""},NB={[jB]:""},oo={transitionStatus(e){return e==="starting"?SB:e==="ending"?NB:null}},kB="data-open",CB="data-closed",TB="data-anchor-hidden",s1="data-popup-open",EB="data-pressed",AB={[s1]:""},RB={[s1]:"",[EB]:""},OB={[kB]:""},MB={[CB]:""},DB={[TB]:""},Fv={open(e){return e?AB:null}},$v={open(e){return e?RB:null}},$c={open(e){return e?OB:MB},anchorHidden(e){return e?DB:null}},qv={...$c,...oo},Gv="data-trigger-disabled";function Fm(e,t){if(!At(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute(Gv);for(const[,o]of t.entries())if(Qe(o,a))return!o.hasAttribute(Gv);return!1}function Kv(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function IB(e){return e.matches("html,body")}function $m(e){return dn(e)&&e.matches(t1)}function PB(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${t1}`)!=null}function Yv(e){return e?e.getAttribute("role")==="combobox"&&$m(e):!1}function _B(e){if(!e||Hv)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function qm(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}function io(e,t,a=!0){return e.filter(c=>c.parentId===t).flatMap(c=>[...!a||c.context?.open?[c]:[],...io(e,c.id,a)])}function r1(e,t){let a=[],o=e.find(c=>c.id===t)?.parentId;for(;o;){const c=e.find(d=>d.id===o);o=c?.parentId,c&&(a=a.concat(c))}return a}function ks(e){e.preventDefault(),e.stopPropagation()}function LB(e){return"nativeEvent"in e}function Gm(e){return e.pointerType===""&&e.isTrusted?!0:Um&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Xv(e){return Hv?!1:!Um&&e.width===0&&e.height===0||Um&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function co(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function zB(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const qc=Math.min,wl=Math.max,Km=Math.round,Ni=Math.floor,jl=e=>({x:e,y:e}),BB={left:"right",right:"left",bottom:"top",top:"bottom"};function a1(e,t,a){return wl(e,qc(t,a))}function uo(e,t){return typeof e=="function"?e(t):e}function ta(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Qv(e){return e==="x"?"y":"x"}function Zv(e){return e==="y"?"height":"width"}function na(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wv(e){return Qv(na(e))}function HB(e,t,a){a===void 0&&(a=!1);const o=Sl(e),c=Wv(e),d=Zv(c);let f=c==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(f=Ym(f)),[f,Ym(f)]}function UB(e){const t=Ym(e);return[Jv(e),t,Jv(t)]}function Jv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const l1=["left","right"],o1=["right","left"],VB=["top","bottom"],FB=["bottom","top"];function $B(e,t,a){switch(e){case"top":case"bottom":return a?t?o1:l1:t?l1:o1;case"left":case"right":return t?VB:FB;default:return[]}}function qB(e,t,a,o){const c=Sl(e);let d=$B(ta(e),a==="start",o);return c&&(d=d.map(f=>f+"-"+c),t&&(d=d.concat(d.map(Jv)))),d}function Ym(e){const t=ta(e);return BB[t]+e.slice(t.length)}function GB(e){var t,a,o,c;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(o=e.bottom)!=null?o:0,left:(c=e.left)!=null?c:0}}function i1(e){return typeof e!="number"?GB(e):{top:e,right:e,bottom:e,left:e}}function Xd(e){const{x:t,y:a,width:o,height:c}=e;return{width:o,height:c,top:a,left:t,right:t+o,bottom:a+c,x:t,y:a}}function Xm(e,t,a){return Math.floor(e/t)!==a}function fo(e,t){return t<0||t>=e.length}function Qm(e,t){return Is(e.current,{disabledIndices:t})}function ey(e,t){return Is(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Is(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:c=1}={}){let d=t;do d+=a?-c:c;while(d>=0&&d<=e.length-1&&po(e,d,o));return d}function KB(e,{event:t,orientation:a,loopFocus:o,onLoop:c,rtl:d,cols:f,disabledIndices:p,minIndex:h,maxIndex:b,prevIndex:y,stopEvent:v=!1}){let w=y,j;if(t.key===Vv?j="up":t.key===Vm&&(j="down"),j){const S=[],N=[];let k=!1,T=0;{let _=null,L=-1;e.forEach((H,B)=>{if(H==null)return;T+=1;const z=H.closest('[role="row"]');z&&(k=!0),(z!==_||L===-1)&&(_=z,L+=1,S[L]=[]),S[L].push(B),N[B]=L})}let D=!1,C=0;if(k)for(const _ of S){const L=_.length;L>C&&(C=L),L!==f&&(D=!0)}const A=D&&T{if(!D||y===-1)return;const L=N[y];if(L==null)return;const H=S[L].indexOf(y),B=_==="up"?-1:1;for(let z=L+B,Q=0;Q=S.length){if(!o||A)return;if(z=z<0?S.length-1:0,c){const X=Math.min(H,S[z].length-1),q=S[z][X]??S[z][0],$=c(t,y,q);z=N[$]??z}}const K=S[z];for(let X=Math.min(H,K.length-1);X>=0;X-=1){const q=K[X];if(!po(e,q,p))return q}}},P=_=>{if(!A||y===-1)return;const L=y%R,H=_==="up"?-R:R,B=b-b%R,z=Ni(b/R)+1;for(let Q=y-L+H,K=0;Kb){if(!o)return;Q=Q<0?B:0}const X=Math.min(Q+R-1,b);for(let q=Math.min(Q+L,X);q>=Q;q-=1)if(!po(e,q,p))return q}};v&&ks(t);const O=I(j)??P(j);if(O!==void 0)w=O;else if(y===-1)w=j==="up"?b:h;else if(w=Is(e,{startingIndex:y,amount:R,decrement:j==="up",disabledIndices:p}),o){if(j==="up"&&(y-R_?H:H-R,c&&(w=c(t,y,w))}j==="down"&&y+R>b&&(w=Is(e,{startingIndex:y%R-R,amount:R,disabledIndices:p}),c&&(w=c(t,y,w)))}fo(e,w)&&(w=y)}if(a==="both"){const S=Ni(y/f);t.key===(d?ji:Si)&&(v&&ks(t),y%f!==f-1?(w=Is(e,{startingIndex:y,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y)),t.key===(d?Si:ji)&&(v&&ks(t),y%f!==0?(w=Is(e,{startingIndex:y,decrement:!0,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y));const N=Ni(b/f)===S;fo(e,w)&&(o&&N?(w=t.key===(d?Si:ji)?b:Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))):w=y)}return w}function po(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const c=e[t];return c?!Zm(c)||c.matches(":disabled")?!0:!a&&(c.hasAttribute("disabled")||c.getAttribute("aria-disabled")==="true"):!1}function YB(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zm(e,t=e?xr(e):null){return!e||!e.isConnected||!t||YB(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const XB='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function QB(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Bc(a)?a.host:null}function ty(e){for(const t of Array.from(e.children))if(Hs(t)==="summary")return t;return null}function ZB(e,t){const a=ty(t);return!!a&&(e===a||Qe(a,e))}function c1(e){const t=e?Hs(e):"";return e!=null&&e.matches(XB)&&(t!=="summary"||e.parentElement!=null&&Hs(e.parentElement)==="details"&&ty(e.parentElement)===e)&&(t!=="details"||ty(e)==null)&&(t!=="input"||e.type!=="hidden")}function u1(e){if(!c1(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=QB(t)){const a=t!==e,o=Hs(t)==="slot";if(t.hasAttribute("inert")||a&&Hs(t)==="details"&&!t.open&&!ZB(e,t)||t.hasAttribute("hidden")||!o&&!WB(t,a))return!1}return!0}function WB(e,t){const a=xr(e);return t?a.display!=="none":Zm(e,a)}function d1(e){const t=e.tabIndex;if(t<0){const a=Hs(e);if(a==="details"||a==="audio"||a==="video"||dn(e)&&e.isContentEditable)return 0}return t}function ny(e){if(Hs(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function JB(e,t){const a=ny(e);if(!a)return!0;const o=t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form&&d.checked});return o?o===a:t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form})===a}function f1(e){if(dn(e)&&Hs(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function p1(e,t){f1(e).forEach(a=>{c1(a)&&t.push(a),p1(a,t)})}function m1(e,t,a){f1(e).forEach(o=>{dn(o)&&o.matches(t)&&a.push(o),m1(o,t,a)})}function sy(e){return u1(e)&&d1(e)>=0}function h1(e){const t=[];return p1(e,t),t.filter(u1)}function Qd(e){const t=h1(e);return t.filter(a=>d1(a)>=0&&JB(a,t))}function g1(e,t){const a=Qd(e),o=a.length;if(o===0)return;const c=or($t(e)),d=a.indexOf(c),f=d===-1?t===1?0:o-1:d+t;return a[f]}function ry(e){return g1($t(e).body,1)||e}function x1(e){return g1($t(e).body,-1)||e}function b1(e,t){if(!e)return null;const a=Qd($t(e).body),o=a.length;if(o===0)return null;const c=a.indexOf(e);if(c===-1)return null;const d=(c+t+o)%o;return a[d]}function e4(e){return b1(e,1)}function t4(e){return b1(e,-1)}function Gc(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(a,o)}function n4(e){Qd(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function v1(e){const t=[];m1(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function ay(e){x.useEffect(e,Or)}const Zd=0;class sa{constructor(){ln(this,"currentId",Zd);ln(this,"clear",()=>{this.currentId!==Zd&&(clearTimeout(this.currentId),this.currentId=Zd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new sa}start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zd,a()},t)}isStarted(){return this.currentId!==Zd}}function Zs(){const e=Ds(sa.create).current;return ay(e.disposeEffect),e}function s4(e,t){return e.matches(":disabled")?!1:!t||e.form===t?!0:e.form===null&&!e.hasAttribute("form")}const r4=x.createContext({disabled:!1});function y1(){return x.useContext(r4)}var ly={exports:{}},Us={};var w1;function a4(){if(w1)return Us;w1=1;var e=Vd();function t(y){var v="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ly.exports=a4(),ly.exports}var Cs=S1();const Wm=null;class l4{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let c=0;c=this.callbacks.length||this.callbacks[a]!==null&&(this.callbacks[a]=null,this.callbacksCount-=1)}}let Jm=new l4;class qa{constructor(){ln(this,"currentId",Wm);ln(this,"cancel",()=>{this.currentId!==Wm&&(Jm.cancel(this.currentId),this.currentId=Wm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new qa}static request(t){return Jm.request(t)}static cancel(t){return Jm.cancel(t)}request(t){this.cancel(),this.currentId=Jm.request(()=>{this.currentId=Wm,t()})}}function Kc(){const e=Ds(qa.create).current;return ay(e.disposeEffect),e}function Nl(e){return e==null?e:"current"in e?e.current:e}let eh=null;function o4(e){if(!eh){const t=[];eh=t,queueMicrotask(()=>{eh=null,Cs.flushSync(()=>{for(const a of t)a()})})}eh.push(e)}function N1(e,t=!1,a=!1){const o=Kc();return Ie((c,d=null)=>{o.cancel();const f=Nl(e);if(f==null)return;const p=f,h=()=>{if(!a){Cs.flushSync(c);return}o4(()=>{d?.aborted||c()})};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){c();return}function b(){Promise.all(p.getAnimations().map(y=>y.finished)).then(()=>{d?.aborted||h()},()=>{if(d?.aborted)return;if(p.getAnimations().some(v=>v.pending||v.playState!=="finished")){b();return}h()})}if(t){const y=n1;if(!p.hasAttribute(y)){o.request(b);return}const v=new MutationObserver(()=>{p.hasAttribute(y)||(v.disconnect(),b())});v.observe(p,{attributes:!0,attributeFilter:[y]}),d?.addEventListener("abort",()=>v.disconnect(),{once:!0});return}o.request(b)})}function ra(e){const{enabled:t=!0,open:a,ref:o,batch:c=!1,onComplete:d}=e,f=Ie(d),p=N1(o,a,c);x.useEffect(()=>{if(!t)return;const h=new AbortController;return p(f,h.signal),()=>{h.abort()}},[t,a,f,p])}function ki(e,t=!1,a=!1,o=!1){const[c,d]=x.useState(e&&t?"idle":void 0),[f,p]=x.useState(e&&!o);return e&&!f&&(p(!0),d("starting")),!e&&f&&c!=="ending"&&!a&&d("ending"),!e&&!f&&c==="ending"&&d(void 0),De(()=>{if(!e&&f&&c!=="ending"&&a){const h=qa.request(()=>{d("ending")});return()=>{qa.cancel(h)}}},[e,f,c,a]),De(()=>{if(!e||t)return;const h=qa.request(()=>{d(void 0)});return()=>{qa.cancel(h)}},[t,e]),De(()=>{if(!e||!t)return;e&&f&&c!=="idle"&&d("starting");const h=qa.request(()=>{d("idle")});return()=>{qa.cancel(h)}},[t,e,f,c]),{mounted:f,setMounted:p,transitionStatus:c}}function Ga({controlled:e,default:t,name:a,state:o="value"}){const{current:c}=x.useRef(e!==void 0),[d,f]=x.useState(t),p=c&&e!==void 0?e:d,h=x.useCallback(b=>{c||f(b)},[]);return[p,h]}function Yc(e,t,a,o,c=!0,d){const{registerFieldControl:f}=Sa(),p=Ds(()=>Symbol());De(()=>{const h=p.current;if(!c){f(h,void 0);return}f(h,{controlRef:e,getValue:o,id:t,name:d,value:a})},[e,c,o,t,d,f,p,a]),De(()=>{const h=p.current;return()=>{f(h,void 0)}},[f,p])}function aa(e,t){const a=x.useRef(e),o=Ie(t);De(()=>{a.current!==e&&o(a.current),a.current=e},[e,o])}const Yn="none",mo="trigger-press",Vs="trigger-hover",th="trigger-focus",nh="outside-press",Wd="item-press",oy="close-press",Jd="input-change",Ka="input-clear",i4="input-press",ho="focus-out",Xc="escape-key",iy="list-navigation",k1="keyboard",C1="pointer",T1="cancel-open",c4="disabled",cy="imperative-action",u4="window-resize";function Fe(e,t,a,o){let c=!1,d=!1;const f=o??fn;return{reason:e,event:t??new Event("base-ui"),cancel(){c=!0},allowPropagation(){d=!0},get isCanceled(){return c},get isPropagationAllowed(){return d},trigger:a,...f}}function d4(e,t,a){const o=a??fn;return{reason:e,event:t??new Event("base-ui"),...o}}const f4=x.forwardRef(function(t,a){const{render:o,className:c,id:d,name:f,value:p,disabled:h=!1,onValueChange:b,defaultValue:y,autoFocus:v=!1,style:w,...j}=t,{state:S,name:N,disabled:k,setTouched:T,setDirty:D,validityData:C,setFocused:A,setFilled:R,validationMode:I,validation:P}=Sa(),{clearErrors:O,elementRef:_,submitCountRef:L}=Fc(),H=k||h,B=N??f,z={...S,disabled:H},{labelId:Q}=vl(),K=lo({id:d}),[X]=Ga({controlled:p,default:y,name:"FieldControl",state:"value"}),q=p!==void 0,$=q?X:void 0,Y=$==null?void 0:String($),F=Ie(()=>P.inputRef.current?.value);Yc(P.inputRef,K,Y,F,!H,f),De(()=>{const M=Y??P.inputRef.current?.value;M!==void 0&&R(M!=="")},[Y,P.inputRef,R]),aa(Y,()=>{Y!==void 0&&(O(B),D(Y!==(C.initialValue??"")),P.change(Y))});const G=x.useRef(null),W=Zs();return De(()=>{v&&G.current===or($t(G.current))&&A(!0)},[v,A]),yt("input",t,{ref:[a,G],state:z,props:[{id:K,disabled:H,name:B,ref:P.inputRef,"aria-labelledby":Q,autoFocus:v,...q?{value:$}:{defaultValue:y},onChange(M){const U=M.currentTarget.value,Z=Fe(Yn,M.nativeEvent);b?.(U,Z),!q&&(D(U!==(C.initialValue??"")),R(U!==""),!M.nativeEvent.defaultPrevented&&!Z.isCanceled&&(O(B),P.change(U)))},onFocus(){A(!0)},onBlur(M){if(T(!0),A(!1),I==="onBlur"){const U=M.currentTarget.value;P.commit(U),q&&queueMicrotask(()=>{const Z=P.inputRef.current?.value;Z!==void 0&&Z!==U&&Z!==(C.initialValue??"")&&P.commit(Z)})}},onKeyDown(M){if(M.currentTarget.tagName==="INPUT"&&M.key==="Enter"){T(!0);const U=M.currentTarget.value,Z=M.currentTarget.form;if(Z&&Z===_.current&&!M.defaultPrevented){const ae=M.currentTarget,ce=L.current;W.start(0,()=>{L.current===ce&&P.commit(ae.value)})}else P.commit(U)}}},j,M=>P.getValidationProps(H,M)],stateAttributesMapping:wi})}),p4=x.forwardRef(function(t,a){return s.jsx(f4,{ref:a,...t})});function $e({className:e,type:t,ref:a,...o}){return s.jsx(p4,{ref:a,type:t,"data-slot":"input",className:Ue("h-[30px] w-full min-w-0 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground","file:inline-flex file:border-0 file:bg-transparent file:text-foreground",e),...o})}function Qc({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:Ue("min-h-26 w-full resize-y rounded-md border border-control-border bg-control px-3 py-2.5","font-mono text-[12px] leading-[1.6] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground",e),...t})}function Ci({className:e,...t}){return s.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("group/input-group relative flex h-[30px] w-full min-w-0 items-center rounded-md border border-control-border bg-control","transition-[border-color,box-shadow] duration-150 ease-out","outline-none","has-[[data-slot=input-group-control]:focus-visible]:border-primary","has-[[data-slot=input-group-control]:focus-visible]:shadow-focus","has-[[data-slot=input-group-control]:hover:not(:focus-visible)]:border-control-border-hover","has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-1.5","has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-1.5","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-1.5","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-1.5",e),...t})}const m4=Vc(["flex h-auto cursor-text items-center justify-center gap-1.5 select-none","text-[12px] font-medium text-muted-foreground","group-data-[disabled=true]/input-group:opacity-50"],{variants:{align:{"inline-start":"order-first pl-[9px] has-[>button]:-ml-1","inline-end":"order-last pr-[9px] has-[>button]:-mr-1","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-1.5","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-1.5"}},defaultVariants:{align:"inline-start"}});function Ti({className:e,align:t="inline-start",...a}){return s.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(m4({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus()},...a})}const h4=Vc("flex items-center shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-xs px-1.5",sm:"h-8 gap-1.5 rounded-sm px-2.5","icon-xs":"size-6 rounded-xs p-0","icon-sm":"size-8 rounded-sm p-0"}},defaultVariants:{size:"xs"}});function g4({className:e,type:t="button",variant:a="ghost",size:o="xs",...c}){return s.jsx(se,{type:t,"data-size":o,variant:a,className:Ue(h4({size:o}),e),...c})}function Ei({className:e,...t}){return s.jsx($e,{"data-slot":"input-group-control",className:Ue("flex-1 rounded-none border-0 bg-transparent shadow-none focus:border-0 focus:shadow-none",e),...t})}function x4(e){return yt(e.defaultTagName??"div",e,e)}const b4=Vc("inline-flex w-fit shrink-0 items-center justify-center gap-[5px] overflow-hidden whitespace-nowrap border font-semibold",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive",outline:"border-control-border bg-control text-subtle",ghost:"border-transparent bg-transparent text-muted-foreground",link:"border-transparent bg-transparent text-primary underline-offset-4 hover:underline",success:"border-success-bd bg-success-soft text-success",warning:"border-warning-bd bg-warning-soft text-warning",info:"border-info-bd bg-info-soft text-info",brand:"border-primary-bd bg-primary-soft text-primary-fg",cn:"border-cn-bd bg-cn-soft text-cn",intl:"border-intl-bd bg-intl-soft text-intl",sensitive:"border-sensitive-bd bg-sensitive-soft text-sensitive"},shape:{pill:"min-h-[21px] rounded-pill px-[9px] py-px text-[11.5px]",tag:"min-h-[19px] rounded-xs px-2 py-0 text-[11px]"}},defaultVariants:{variant:"default",shape:"pill"}});function ze({className:e,variant:t,shape:a,render:o,...c}){return x4({render:o,defaultTagName:"span",props:Wr({"data-slot":"badge"},c,{className:Ue(b4({variant:t,shape:a}),e)})})}function uy({className:e,...t}){return s.jsx("span",{className:Ue("size-1.5 flex-none rounded-full bg-current",e),...t})}function go(e,t){if(typeof window>"u")return e;const a=window.wbI18n;return a?a.t(e,t)??e:e}function ef({className:e,...t}){return s.jsx("svg",{"data-slot":"spinner",role:"status","aria-label":go("加载中"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:Ue("size-4 animate-spin [animation-duration:0.7s]",e),...t,children:s.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function Je({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:Ue("flex items-center gap-[6px] text-[11.5px] text-muted-foreground",e),...t})}const E1={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ai={...E1,position:"fixed",top:0,left:0},Zc={...E1,position:"absolute"},A1=x.createContext(void 0);function v4(){const e=x.useContext(A1);if(e===void 0)throw new Error(on(63));return e}const y4="data-checked",w4="data-unchecked",R1={...wi,checked(e){return e?{[y4]:""}:{[w4]:""}}},j4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d,"aria-labelledby":f,form:p,id:h,inputRef:b,name:y,nativeButton:v=!1,onCheckedChange:w,readOnly:j=!1,required:S=!1,disabled:N=!1,render:k,uncheckedValue:T,value:D,style:C,...A}=t,{clearErrors:R}=Fc(),{state:I,setTouched:P,setDirty:O,validityData:_,setFilled:L,setFocused:H,validationMode:B,disabled:z,name:Q,validation:K}=Sa(),{labelId:X}=vl(),q=z||N,$=Q??y,Y=x.useRef(null),F=ea(Y,b,K.inputRef),G=x.useRef(null),W=Na(),le=lo({id:h}),M=v?void 0:le,[U,Z]=Ga({controlled:o,default:!!d,name:"Switch",state:"checked"});Yc(G,W,U,void 0,!q,y),De(()=>{L(U)},[U,L]),aa(U,()=>{R($),O(U!==_.initialValue),K.change(U)});const{getButtonProps:ae,buttonRef:ce}=Jr({disabled:q,native:v}),J=Bv(f,X,Y,!v,M),ie={id:v?le:W,role:"switch","aria-checked":U,"aria-readonly":j||void 0,"aria-required":S||void 0,"aria-labelledby":J,onFocus(){q||H(!0)},onBlur(){const te=Y.current;!te||q||(P(!0),H(!1),B==="onBlur"&&K.commit(te.checked))},onClick(te){if(j||q)return;te.preventDefault();const Ce=Y.current;Ce&&Uc(Ce,te)}},ge={...K.getValidationProps(q),checked:U,disabled:q,form:p,id:M,name:$,required:S,style:$?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(te){if(te.nativeEvent.defaultPrevented)return;if(j){te.preventDefault();return}const Ce=te.currentTarget.checked,re=Fe(Yn,te.nativeEvent);w?.(Ce,re),!re.isCanceled&&Z(Ce)},onClick(te){te.stopPropagation()},onFocus(){G.current?.focus()},...D!==void 0?{value:D}:fn},ee=x.useMemo(()=>({...I,checked:U,disabled:q,readOnly:j,required:S}),[I,U,q,j,S]),fe=yt("span",t,{state:ee,ref:[a,G,ce],props:[ie,A,ae,te=>K.getValidationProps(q,te)],stateAttributesMapping:R1});return s.jsxs(A1.Provider,{value:ee,children:[fe,!U&&$&&T!==void 0&&s.jsx("input",{type:"hidden",form:p,name:$,value:T,disabled:q}),s.jsx("input",{...ge,suppressHydrationWarning:!0})]})}),S4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=v4();return yt("span",t,{state:p,ref:a,stateAttributesMapping:R1,props:f})});function hs({className:e,size:t="default",...a}){const o=t==="sm";return s.jsx(j4,{"data-slot":"switch",className:Ue("relative inline-flex flex-none cursor-pointer items-center rounded-pill border-0 bg-border-strong p-0","transition-colors duration-[180ms] ease-out","data-checked:bg-primary","focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:opacity-50",o?"h-[14px] w-6":"h-[21px] w-9",e),...a,children:s.jsx(S4,{"data-slot":"switch-thumb",className:Ue("block rounded-full bg-primary-on shadow-1","transition-transform duration-[180ms] [transition-timing-function:cubic-bezier(.3,1.4,.6,1)]",o?"size-[10px] translate-x-0.5 data-checked:translate-x-[10px]":"size-[17px] translate-x-0.5 data-checked:translate-x-[15px]")})})}function N4(e){if(!e)return null;for(const t of e.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const o=t;if(o.type==="submit")return o}}return null}const k4="data-checked",C4="data-unchecked";function O1(e){return{checked(t){return e.indeterminate?{}:t?{[k4]:""}:{[C4]:""}},...wi}}const T4=x.createContext(void 0);function E4(){return x.useContext(T4)}const M1=x.createContext(void 0);function A4(){const e=x.useContext(M1);if(e===void 0)throw new Error(on(14));return e}const R4="data-parent",O4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d=!1,"aria-labelledby":f,disabled:p=!1,form:h,id:b,indeterminate:y=!1,inputRef:v,name:w,onCheckedChange:j,parent:S=!1,readOnly:N=!1,render:k,required:T=!1,uncheckedValue:D,value:C,nativeButton:A=!1,style:R,...I}=t,{clearErrors:P}=Fc(),{disabled:O,name:_,setDirty:L,setFilled:H,setFocused:B,setTouched:z,state:Q,validationMode:K,validityData:X,validation:q}=Sa(),$=y1(),{labelId:Y,registerControlId:F,getDescriptionProps:G}=vl(),W=E4(),le=W?.allValues===void 0?void 0:W.parent,M=le!==void 0,U=O||$.disabled||W?.disabled||p,Z=_??w,ae=C??Z,ce=Na(),J=W?.registerControlId!==F,ie=lo({id:b||void 0,enabled:J}),ge=A?ie:ce;let ee={};M&&(S?ee=le.getParentProps():ae!==void 0&&(ee=le.getChildProps(ae)));const{checked:fe=o,indeterminate:te=y,onCheckedChange:Ce,...re}=ee,de=W?.value,ke=x.useRef(null),{getButtonProps:Ee,buttonRef:ve}=Jr({disabled:U,native:A}),he=W?.validation??q,[ye,je]=Ga({controlled:ae!==void 0&&de!==void 0&&!S?de.includes(ae):fe,default:d,name:"Checkbox",state:"checked"}),xe=M?!!fe:ye,Te=M&&te||y;Yc(ke,ce,ye,void 0,!W&&!U,w);const Oe=le?.registerChildId,Ne=x.useRef(null),_e=he.registerInput,Ye=W?ae:void 0,kt=x.useCallback(it=>_e(it,{controlRef:ke,value:Ye}),[_e,Ye]),Ct=ea(v,Ne,S?void 0:kt),Rt=Bv(f,Y,Ne,!A,ie);De(()=>{Ne.current&&(Ne.current.indeterminate=Te),W||H(ye)},[ye,Te,W,H]),aa(ye,()=>{W||(P(Z),L(ye!==X.initialValue),he.change(ye))});const ot=Wr({checked:ye,disabled:U,form:h,name:S?void 0:Z,id:A?void 0:ie,required:T,ref:Ct,style:Z?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(it){if(it.nativeEvent.defaultPrevented)return;if(N){it.preventDefault();return}const Vt=it.currentTarget.checked,Hn=Fe(Yn,it.nativeEvent);if(j?.(Vt,Hn),!Hn.isCanceled&&(Ce?.(Vt,Hn),!Hn.isCanceled&&(je(Vt),ae!==void 0&&W!==void 0&&!S&&!M))){const tn=Vt?[...W.value,ae]:W.value.filter(nt=>nt!==ae);W.setValue(tn,Hn)}},onClick(it){it.stopPropagation()},onFocus(){ke.current?.focus()}},C!==void 0?{value:(W?ye&&C:C)||""}:fn,G,it=>he.getValidationProps(U,it));x.useEffect(()=>{if(!le||ae===void 0)return;const it=le.disabledStatesRef.current;return it.set(ae,U),()=>{it.delete(ae)}},[le,U,ae]);const qn=x.useMemo(()=>({...Q,checked:xe,disabled:U,readOnly:N,required:T,indeterminate:Te}),[Q,xe,U,N,T,Te]),fs=O1(qn),Gn=yt("span",t,{state:qn,ref:[ve,ke,a],props:[{id:ge,role:"checkbox","aria-checked":Te?"mixed":xe,"aria-readonly":N||void 0,"aria-required":T||void 0,"aria-labelledby":Rt,[R4]:S?"":void 0,onFocus(){U||B(!0)},onBlur(){const it=Ne.current;it&&(z(!0),B(!1),K==="onBlur"&&he.commit(W?de:it.checked))},onKeyDown(it){if(it.key!=="Enter"||(it.preventBaseUIHandler(),it.defaultPrevented))return;const Vt=Ne.current?.form??null,Hn=it.currentTarget,tn=it.nativeEvent,nt=it.preventDefault,Ot=tn.preventDefault;let Ft=!1;it.preventDefault=()=>{Ft=!0,nt.call(it)},tn.preventDefault=()=>{Ft=!0,Ot.call(tn)},Ot.call(tn),Sn(Hn).queueMicrotask(()=>{it.preventDefault=nt,tn.preventDefault=Ot,Ft||N4(Vt)?.click()})},onClick(it){if(N||U)return;it.preventDefault();const Vt=Ne.current;Vt&&Uc(Vt,it)}},I,re,Ee,G,it=>he.getValidationProps(U,it)],stateAttributesMapping:fs}),bs=Gn.props.id;return De(()=>{if(!(!Oe||S||ae===void 0||bs===void 0))return Oe(ae,bs)},[Oe,S,ae,bs]),s.jsxs(M1.Provider,{value:qn,children:[Gn,!ye&&!W&&Z&&!S&&D!==void 0&&s.jsx("input",{type:"hidden",form:h,name:Z,value:D,disabled:U}),s.jsx("input",{...ot,suppressHydrationWarning:!0})]})}),M4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=A4(),b=h.checked||h.indeterminate,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j=x.useRef(null),S={...h,transitionStatus:v};ra({batch:!0,enabled:!b,open:b,ref:j,onComplete(){b||w(!1)}});const k={...O1(h),...oo},T=f||y,D=yt("span",t,{ref:[a,j],state:S,stateAttributesMapping:k,props:p});return T?D:null});function Mr({className:e,...t}){return s.jsx(O4,{"data-slot":"checkbox",className:Ue("group/checkbox relative inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(M4,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-primary-foreground data-unchecked:hidden",children:s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-2.5","aria-hidden":"true",children:[s.jsx("path",{d:"M2 6h8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none",className:"hidden group-aria-[checked=indeterminate]/checkbox:block"}),s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:"group-aria-[checked=indeterminate]/checkbox:hidden"})]})})})}function dy(e){return Array.isArray(e)?e.map(t=>dy(t)).join(","):e==null?"":String(e)}const D1=new Map;function D4(e,t){const a=JSON.stringify({locale:dy(e),options:t}),o=D1.get(a);if(o)return o;const c=new Intl.NumberFormat(e,t);return D1.set(a,c),c}function I1(e,t,a){return e==null?"":D4(t,a).format(e)}function Ri(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}function I4(e,t,a){return(e-t)*100/(a-t)}const P1=x.createContext(void 0);function _1(){const e=x.useContext(P1);if(e===void 0)throw new Error(on(51));return e}const P4="data-complete",_4="data-indeterminate",L4="data-progressing",fy={status(e){return e==="progressing"?{[L4]:""}:e==="complete"?{[P4]:""}:e==="indeterminate"?{[_4]:""}:null}},z4=x.forwardRef(function(t,a){const{format:o,getAriaValueText:c,locale:d,max:f=100,min:p=0,value:h,render:b,className:y,children:v,style:w,...j}=t,[S,N]=x.useState();let k="indeterminate",T=null,D=null,C="",A="indeterminate progress";if(h!=null&&Number.isFinite(h)){const _=I4(h,p,f);T=Ri(Number.isNaN(_)?0:_,0,100),D=Ri(h,p,f),k=D===f?"complete":"progressing",C=o?I1(D,d,o):I1(T/100,d,{style:"percent"}),A=C}const R=x.useMemo(()=>({status:k}),[k]),I={"aria-labelledby":S,"aria-valuemax":f,"aria-valuemin":p,"aria-valuenow":D??void 0,"aria-valuetext":c?c(C,h):A,role:"progressbar",children:s.jsxs(x.Fragment,{children:[v,s.jsx("span",{role:"presentation",style:Ai,children:"x"})]})},P=x.useMemo(()=>({formattedValue:C,percentageValue:T,setLabelId:N,state:R,value:h}),[C,T,N,R,h]),O=yt("div",t,{state:R,ref:a,props:[I,j],stateAttributesMapping:fy});return s.jsx(P1.Provider,{value:P,children:O})}),B4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{state:p}=_1();return yt("div",t,{state:p,ref:a,props:f,stateAttributesMapping:fy})}),H4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{percentageValue:p,state:h}=_1(),b=p==null?{}:{insetInlineStart:0,height:"inherit",width:`${p}%`};return yt("div",t,{state:h,ref:a,props:[{style:b},f],stateAttributesMapping:fy})});function tf({className:e,children:t,value:a,...o}){return s.jsxs(z4,{value:a,"data-slot":"progress",className:Ue("flex w-full flex-wrap items-center gap-3",e),...o,children:[t,s.jsx(U4,{children:s.jsx(V4,{})})]})}function U4({className:e,...t}){return s.jsx(B4,{"data-slot":"progress-track",className:Ue("relative flex h-1.5 w-full items-center overflow-x-hidden overflow-y-hidden rounded-pill bg-surface-3",e),...t})}function V4({className:e,...t}){return s.jsx(H4,{"data-slot":"progress-indicator",className:Ue("h-full rounded-[inherit] bg-primary transition-[width] duration-300 ease-out",e),...t})}const py=[];let my;function F4(){return my}function $4(e){py.push(e)}function sh(e){const t=(a,o)=>{const c=Ds(q4).current;let d;try{my=c;for(const f of py)f.before(c);d=e(a,o);for(const f of py)f.after(c);c.didInitialize=!0}finally{my=void 0}return d};return t.displayName=e.displayName||e.name,t}function L1(e){return x.forwardRef(sh(e))}function q4(){return{didInitialize:!1}}const z1=x.createContext(void 0);function nf(e){const t=x.useContext(z1);if(t===void 0&&!e)throw new Error(on(72));return t}function G4(e,t){return t!=null&&!co(t)?0:typeof e=="function"?e():e}function Oi(e,t,a){const o=G4(e,a);return typeof o=="number"?o:o?.[t]}function B1(e){return typeof e=="function"?e():e}function H1(e,t){return t||e==="click"||e==="mousedown"}function K4(e){return e?.includes("mouse")&&e!=="mousedown"}const U1=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new sa,currentIdRef:{current:null},currentContextRef:{current:null}});function Y4(e,t){e.current=t.current}function X4(e){const{children:t,delay:a,timeoutMs:o=0}=e,c=x.useRef(a),d=x.useRef(a),f=x.useRef(null),p=x.useRef(null),h=Zs();return De(()=>{if(d.current=a,!f.current){c.current=a;return}c.current={open:Oi(c.current,"open"),close:Oi(a,"close")}},[a,f,c,d]),s.jsx(U1.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:c,initialDelayRef:d,currentIdRef:f,timeoutMs:o,currentContextRef:p,timeout:h}),[o,h]),children:t})}function Q4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,c=o.useState("floatingId"),d=x.useContext(U1),{currentIdRef:f,delayRef:p,timeoutMs:h,initialDelayRef:b,currentContextRef:y,hasProvider:v,timeout:w}=d,[j,S]=x.useState(!1),N=x.useRef(a);return De(()=>{N.current=a},[a]),De(()=>{function k(){y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,p.current=b.current,w.clear()}if(f.current&&!a&&f.current===c){if(S(!1),h){const T=c;return w.start(h,()=>{o.select("open")||f.current&&f.current!==T||k()}),()=>{(N.current||f.current!==T)&&w.clear()}}k()}},[a,c,f,p,h,b,y,w,o]),De(()=>{if(!a)return;const k=y.current,T=f.current;w.clear(),y.current={onOpenChange:o.setOpen,setIsInstantPhase:S},f.current=c,p.current={open:0,close:Oi(b.current,"close")},T!==null&&T!==c?(S(!0),k?.setIsInstantPhase(!0),k?.onOpenChange(!1,Fe(Yn))):(S(!1),k?.setIsInstantPhase(!1))},[a,c,o,f,p,b,y,w]),De(()=>()=>{if(f.current===c){if(y.current=null,!N.current)return;f.current=null,Y4(p,b),w.clear()}},[y,f,p,c,b,w]),x.useMemo(()=>({activeIdRef:f,hasProvider:v,delayRef:p,isInstantPhase:j}),[f,v,p,j])}function St(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function Ya(...e){return()=>{for(let t=0;t{t.current=t.next}};return t}const Wc=x.forwardRef(function(t,a){const[o,c]=x.useState();De(()=>{wB&&yl&&c("button")},[]);const d={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Ai,"aria-hidden":o?void 0:!0,...d,"data-base-ui-focus-guard":""})});function sf(e){return`data-base-ui-${e}`}let rh=0;function ah(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:c}=t;cancelAnimationFrame(rh);function d(){c&&!c()||e?.focus({preventScroll:a})}if(o)return d(),qt;const f=requestAnimationFrame(d);return rh=f,()=>{rh===f&&(cancelAnimationFrame(f),rh=0)}}const hy={inert:new WeakMap,"aria-hidden":new WeakMap},V1="data-base-ui-inert",gy={inert:new WeakSet,"aria-hidden":new WeakSet};let rf=new WeakMap,xy=0;function W4(e){return gy[e]}function F1(e){return e?Bc(e)?e.host:F1(e.parentNode):null}const $1=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=F1(a);return e.contains(o)?o:null}).filter(a=>a!=null),q1=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},G1=(e,t,a)=>{const o=[],c=d=>{!d||a.has(d)||Array.from(d.children).forEach(f=>{Hs(f)!=="script"&&(t.has(f)?c(f):o.push(f))})};return c(e),o};function J4(e,t,a,o,{mark:c=!0}){let d=null;o?d="inert":a&&(d="aria-hidden");let f=null,p=null;const h=$1(t,e),b=c?G1(t,q1(h),new Set(h)):[],y=[],v=[];if(d){const w=hy[d],j=W4(d);p=j,f=w;const S=$1(t,Array.from(t.querySelectorAll("[aria-live]"))),N=h.concat(S);G1(t,q1(N),new Set(N)).forEach(T=>{const D=T.getAttribute(d),C=D!==null&&D!=="false",A=(w.get(T)||0)+1;w.set(T,A),y.push(T),A===1&&C&&j.add(T),C||T.setAttribute(d,d==="inert"?"":"true")})}return c&&b.forEach(w=>{const j=(rf.get(w)||0)+1;rf.set(w,j),v.push(w),j===1&&w.setAttribute(V1,"")}),xy+=1,()=>{f&&y.forEach(w=>{const S=(f.get(w)||0)-1;f.set(w,S),S||(!p?.has(w)&&d&&w.removeAttribute(d),p?.delete(w))}),c&&v.forEach(w=>{const j=(rf.get(w)||0)-1;rf.set(w,j),j||w.removeAttribute(V1)}),xy-=1,xy||(hy.inert=new WeakMap,hy["aria-hidden"]=new WeakMap,gy.inert=new WeakSet,gy["aria-hidden"]=new WeakSet,rf=new WeakMap)}}function K1(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:c=!0}=t,d=$t(e[0]).body;return J4(e,d,a,o,{mark:c})}const eH=500,tH={style:{transition:"none"}},Y1="data-base-ui-click-trigger",X1={fallbackAxisSide:"none"},Q1={fallbackAxisSide:"end"},nH={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Z1=x.createContext(null),W1=()=>x.useContext(Z1),sH=sf("portal");function J1(e={}){const{ref:t,container:a,componentProps:o=fn,elementProps:c}=e,d=Gd(),p=W1()?.portalNode,[h,b]=x.useState(null),[y,v]=x.useState(null),w=Ie(k=>{k!==null&&v(k)}),j=x.useRef(null);De(()=>{if(a===null){j.current&&(j.current=null,v(null),b(null));return}const k=(a&&(Sv(a)?a:a.current))??p??document.body;if(k==null){j.current&&(j.current=null,v(null),b(null));return}j.current!==k&&(j.current=k,v(null),b(k))},[a,p]);const S=yt("div",o,{ref:[t,w],props:[{id:d,[sH]:""},c]}),N=h&&S?Cs.createPortal(S,h):null;return{node:y,nodeId:x.isValidElement(S)?S.props.id:void 0,subtree:N}}const lh=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,container:p,portalOwnerRole:h,...b}=t,{node:y,nodeId:v,subtree:w}=J1({container:p,ref:a,componentProps:t,elementProps:b}),j=x.useRef(null),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),[T,D]=x.useState(null),C=x.useRef(!1),A=T?.modal,R=T?.open,I=!!T&&!T.modal&&T.open&&!!y;x.useEffect(()=>{if(!y||A)return;function O(_){y&&_.relatedTarget&&Gc(_)&&(_.type==="focusin"?C.current&&(v1(y),C.current=!1):(n4(y),C.current=!0))}return Ya(St(y,"focusin",O,!0),St(y,"focusout",O,!0))},[y,A]),De(()=>{!y||R!==!0||!C.current||(v1(y),C.current=!1)},[R,y]);const P=x.useMemo(()=>({beforeOutsideRef:j,afterOutsideRef:S,beforeInsideRef:N,afterInsideRef:k,portalNode:y,setFocusManagerState:D}),[y]);return s.jsxs(x.Fragment,{children:[w,s.jsxs(Z1.Provider,{value:P,children:[I&&y&&s.jsx(Wc,{"data-type":"outside",ref:j,onFocus:O=>{if(Gc(O,y))N.current?.focus();else{const _=T?T.domReference:null;x1(_)?.focus()}}}),I&&y&&s.jsx("span",{role:h,"aria-owns":v,style:nH}),y&&Cs.createPortal(f,y),I&&y&&s.jsx(Wc,{"data-type":"outside",ref:S,onFocus:O=>{if(Gc(O,y))k.current?.focus();else{const _=T?T.domReference:null;ry(_)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,Fe(ho,O.nativeEvent))}}})]})]})});function eT(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class rH{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",eT())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const tT=x.createContext(null),nT=x.createContext(null),Jc=()=>x.useContext(tT)?.id||null,Mi=e=>{const t=x.useContext(nT);return e??t};function aH(e){const t=Gd(),a=Mi(e),o=Jc();return De(()=>{if(!t)return;const c={id:t,parentId:o};return a?.addNode(c),()=>{a?.removeNode(c)}},[a,t,o]),t}function lH(e){const{children:t,id:a}=e,o=Jc();return s.jsx(tT.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function oH(e){const{children:t,externalTree:a}=e,o=Ds(()=>a??new rH).current;return s.jsx(nT.Provider,{value:o,children:t})}function iH(e,t){const a=Sn(cs(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const sT=20;let xo=[];function by(){xo=xo.filter(e=>e.deref()?.isConnected)}function rT(e){by(),e&&Hs(e)!=="body"&&(xo.push(new WeakRef(e)),xo.length>sT&&(xo=xo.slice(-sT)))}function aT(){return by(),xo[xo.length-1]?.deref()}function cH(e){return e?sy(e)?e:Qd(e)[0]||e:null}function lT(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=h1(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return sy(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function oh(e){const{context:t,children:a,disabled:o=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:b="",nextFocusableElement:y,previousFocusableElement:v,beforeContentFocusGuardRef:w,externalTree:j,getInsideElements:S}=e,N="rootStore"in t?t.rootStore:t,k=N.useState("open"),T=N.useState("domReferenceElement"),D=N.useState("floatingElement"),{events:C,dataRef:A}=N.context,R=Ie(()=>A.current.floatingContext?.nodeId),I=c===!1,P=Yv(T)&&I,O=Xn(c),_=Xn(d),L=Xn(b),H=Xn(k),B=Mi(j),z=W1(),Q=x.useRef(!1),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef(null),$=x.useRef(""),Y=x.useRef(""),F=x.useRef(null),G=x.useRef(null),W=ea(F,w,z?.beforeInsideRef),le=ea(G,z?.afterInsideRef),M=Zs(),U=Zs(),Z=Kc(),ae=z!=null,ce=qm(D),J=Ie((ee=ce)=>ee?Qd(ee):[]),ie=Ie(()=>S?.().filter(ee=>ee!=null)??[]);x.useEffect(()=>{if(o||!p)return;function ee(te){te.key==="Tab"&&Qe(ce,or($t(ce)))&&J().length===0&&!P&&ks(te)}const fe=$t(ce);return St(fe,"keydown",ee)},[o,ce,p,P,J]),x.useEffect(()=>{if(o||!k)return;const ee=$t(ce);function fe(){X.current=!1}function te(re){const de=cs(re),ke=ie(),Ee=Qe(D,de)||Qe(T,de)||Qe(z?.portalNode,de)||ke.some(ve=>ve===de||Qe(ve,de));X.current=!Ee,Y.current=re.pointerType||"keyboard",de?.closest(`[${Y1}]`)&&(K.current=!0,U.start(0,()=>{K.current=!1}))}function Ce(){Y.current="keyboard"}return Ya(St(ee,"pointerdown",te,!0),St(ee,"pointerup",fe,!0),St(ee,"pointercancel",fe,!0),St(ee,"keydown",Ce,!0),fe)},[o,D,T,ce,k,z,U,ie]),x.useEffect(()=>{if(o||!h)return;const ee=$t(ce);function fe(){K.current=!0,U.start(0,()=>{K.current=!1})}function te(ke){const Ee=cs(ke);sy(Ee)&&(q.current=Ee)}function Ce(ke){const Ee=ke.relatedTarget,ve=ke.currentTarget,he=cs(ke);p&&Ee==null&&he!=null&&Qe(D,he)&&rT(he),queueMicrotask(()=>{const ye=R(),je=N.context.triggerElements,xe=ie(),Te=Ee?.hasAttribute(sf("focus-guard"))&&[F.current,G.current,z?.beforeInsideRef.current,z?.afterInsideRef.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,Nl(v),Nl(y)].includes(Ee),Oe=!(Qe(T,Ee)||Qe(D,Ee)||Qe(Ee,D)||Qe(z?.portalNode,Ee)||xe.some(Ne=>Ne===Ee||Qe(Ne,Ee))||je.hasMatchingElement(Ne=>Qe(Ne,Ee))||Te||B&&(io(B.nodesRef.current,ye).find(Ne=>Qe(Ne.context?.elements.floating,Ee)||Qe(Ne.context?.elements.domReference,Ee))||r1(B.nodesRef.current,ye).find(Ne=>[Ne.context?.elements.floating,qm(Ne.context?.elements.floating)].includes(Ee)||Ne.context?.elements.domReference===Ee)));if(ve===T&&ce&&lT(ce),f&&ve!==T&&!Zm(he)&&or(ee)===ee.body){if(dn(ce)&&(ce.focus(),f==="popup")){Z.request(()=>{ce.focus()});return}const Ne=J(),_e=q.current,Ye=(_e&&Ne.includes(_e)?_e:null)||Ne[Ne.length-1]||ce;dn(Ye)&&Ye.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(P||!p)&&Ee&&Oe&&!K.current&&(P||Ee!==aT())&&(Q.current=!0,N.setOpen(!1,Fe(ho,ke)))})}function re(){X.current||(A.current.insideReactTree=!0,M.start(0,()=>{A.current.insideReactTree=!1}))}const de=dn(T)?T:null;if(!(!D&&!de))return Ya(de&&St(de,"focusout",Ce),de&&St(de,"pointerdown",fe),D&&St(D,"focusin",te),D&&St(D,"focusout",Ce),D&&z&&St(D,"focusout",re,!0))},[o,T,D,ce,p,B,z,N,h,f,J,P,R,A,M,U,Z,y,v,ie]),x.useEffect(()=>{if(o||!D||!k)return;const ee=Array.from(z?.portalNode?.querySelectorAll(`[${sf("portal")}]`)||[]),te=(B?r1(B.nodesRef.current,R()):[]).find(ve=>Yv(ve.context?.elements.domReference||null))?.context?.elements.domReference,re=[...[D,...ee,F.current,G.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,...ie()],te,Nl(v),Nl(y),P?T:null].filter(ve=>ve!=null),de=K1(re,{ariaHidden:p||P,mark:!1}),ke=[D,...ee].filter(ve=>ve!=null),Ee=K1(ke);return()=>{Ee(),de()}},[k,o,T,D,p,z,P,B,R,y,v,ie]),De(()=>{if(!k||o||!dn(ce))return;$.current="",Y.current="";const ee=$t(ce),fe=or(ee);queueMicrotask(()=>{const te=O.current,Ce=typeof te=="function"?te(L.current||""):te;if(Ce===void 0||Ce===!1||Qe(ce,fe))return;let de=null;const ke=()=>(de==null&&(de=J(ce)),de[0]||ce);let Ee;Ce===!0||Ce===null?Ee=ke():Ee=Nl(Ce),Ee=Ee||ke();const ve=Qe(ce,or(ee));ah(Ee,{preventScroll:Ee===ce,shouldFocus(){if(!H.current)return!1;if(ve)return!0;const he=or(ee);return!(he!==Ee&&Qe(ce,he))}})})},[o,k,ce,J,O,L,H]),De(()=>{if(o||!ce)return;const ee=$t(ce),fe=or(ee),te=L.current==null;rT(fe);function Ce(de){if(de.open||($.current=iH(de.nativeEvent,Y.current)),de.reason===Vs&&de.nativeEvent.type==="mouseleave"&&(Q.current=!0),de.reason===nh)if(de.nested)Q.current=!1;else if(Gm(de.nativeEvent)||Xv(de.nativeEvent))Q.current=!1;else{let ke=!1;$t(ce).createElement("div").focus({get preventScroll(){return ke=!0,!1}}),ke?Q.current=!1:Q.current=!0}}C.on("openchange",Ce);function re(de){const ke=_.current;let Ee=typeof ke=="function"?ke(de):ke;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const ve=T?.isConnected?T:null,he=fe?.isConnected&&Hs(fe)!=="body"?fe:null;let ye=te?he||ve:ve||he;return ye||(ye=aT()||null),typeof Ee=="boolean"?ye:Nl(Ee)||ye||null}return()=>{C.off("openchange",Ce);const de=or(ee),ke=ie(),Ee=Qe(D,de)||ke.some(je=>je===de||Qe(je,de))||B&&io(B.nodesRef.current,R(),!1).some(je=>Qe(je.context?.elements.floating,de)),ve=_.current,he=$.current,ye=re(he);queueMicrotask(()=>{const je=cH(ye),xe=typeof ve!="boolean";if(ve&&!Q.current&&dn(je)&&(!(!xe&&je!==de&&de!==ee.body)||Ee)){const Te={preventScroll:!0};he==="keyboard"&&(Te.focusVisible=!0),je.focus(Te)}Q.current=!1})}},[o,D,ce,_,L,C,B,T,R,ie]),De(()=>{if(!yl||k||!D)return;const ee=or($t(D));!dn(ee)||!$m(ee)||Qe(D,ee)&&ee.blur()},[k,D]),De(()=>{if(!(o||!z))return z.setFocusManagerState({modal:p,closeOnFocusOut:h,open:k,onOpenChange:N.setOpen,domReference:T}),()=>{z.setFocusManagerState(null)}},[o,z,p,k,N,h,T]),De(()=>{if(!(o||!ce))return lT(ce),()=>{queueMicrotask(by)}},[o,ce]);const ge=!o&&(p?!P:!0)&&(ae||p);return s.jsxs(x.Fragment,{children:[ge&&s.jsx(Wc,{"data-type":"inside",ref:W,onFocus:ee=>{if(p){const fe=J();ah(fe[fe.length-1])}else z?.portalNode&&(Q.current=!1,Gc(ee,z.portalNode)?ry(T)?.focus():Nl(v??z.beforeOutsideRef)?.focus())}}),a,ge&&s.jsx(Wc,{"data-type":"inside",ref:le,onFocus:ee=>{p?ah(J()[0]):z?.portalNode&&(h&&(Q.current=!0),Gc(ee,z.portalNode)?x1(T)?.focus():Nl(y??z.afterOutsideRef)?.focus())}})]})}function ih(e,t={}){const{enabled:a=!0,event:o="click",toggle:c=!0,ignoreMouse:d=!1,stickIfOpen:f=!0,touchOpenDelay:p=0,reason:h=mo}=t,b="rootStore"in e?e.rootStore:e,y=b.context.dataRef,v=x.useRef(void 0),w=Kc(),j=Zs(),S=x.useMemo(()=>{function N(T,D,C,A){const R=Fe(h,D,C);T&&A==="touch"&&p>0?j.start(p,()=>{b.setOpen(!0,R)}):b.setOpen(T,R)}function k(T,D,C){const A=y.current.openEvent,R=b.select("domReferenceElement")!==D;return T&&R||!T||!c?!0:A&&f?!C(A.type):!1}return{onPointerDown(T){v.current=co(T.pointerType,!0)&&Xv(T.nativeEvent)?"virtual":T.pointerType},onMouseDown(T){const D=v.current,C=T.nativeEvent,A=b.select("open");if(T.button!==0||o==="click"||co(D,!0)&&d)return;const R=k(A,T.currentTarget,O=>O==="click"||O==="mousedown"),I=cs(C);if($m(I)){N(R,C,I,D);return}const P=T.currentTarget;w.request(()=>{N(R,C,P,D)})},onClick(T){if(o==="mousedown-only")return;const D=v.current;if(o==="mousedown"&&D){v.current=void 0;return}if(co(D,!0)&&d)return;const C=b.select("open"),A=k(C,T.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");N(A,T.nativeEvent,T.currentTarget,D)},onKeyDown(){v.current=void 0}}},[y,o,d,h,b,f,c,w,j,p]);return x.useMemo(()=>a?{reference:S}:fn,[a,S])}function uH(e,t){let a=null,o=null,c=!1;return{contextElement:e||void 0,getBoundingClientRect(){const d=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",h=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let b=d.width,y=d.height,v=d.x,w=d.y;return a==null&&t.x&&f&&(a=d.x-t.x),o==null&&t.y&&p&&(o=d.y-t.y),v-=a||0,w-=o||0,b=0,y=0,!c||h?(b=t.axis==="y"?d.width:0,y=t.axis==="x"?d.height:0,v=f&&t.x!=null?t.x:v,w=p&&t.y!=null?t.y:w):c&&!h&&(y=t.axis==="x"?d.height:y,b=t.axis==="y"?d.width:b),c=!0,{width:b,height:y,x:v,y:w,top:w,right:v+b,bottom:w+y,left:v}}}}function oT(e){return e!=null&&e.clientX!=null}function dH(e,t={}){const{enabled:a=!0,axis:o="both"}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),h=c.context.dataRef,b=x.useRef(!1),y=x.useRef(null),[v,w]=x.useState(),[j,S]=x.useState([]),N=Ie(A=>{c.set("positionReference",A)}),k=Ie((A,R,I)=>{b.current||h.current.openEvent&&!oT(h.current.openEvent)||c.set("positionReference",uH(I??p,{x:A,y:R,axis:o,dataRef:h,pointerType:v}))}),T=Ie(A=>{d?y.current||(k(A.clientX,A.clientY,A.currentTarget),S([])):k(A.clientX,A.clientY,A.currentTarget)}),D=co(v)?f:d;x.useEffect(()=>{if(!a){N(p);return}if(!D)return;function A(){y.current?.(),y.current=null}const R=Sn(f);function I(P){const O=cs(P);Qe(f,O)?A():k(P.clientX,P.clientY)}return!h.current.openEvent||oT(h.current.openEvent)?y.current=St(R,"mousemove",I):N(p),A},[D,a,f,h,p,c,k,N,j]),x.useEffect(()=>()=>{c.set("positionReference",null)},[c]),x.useEffect(()=>{a&&!f&&(b.current=!1)},[a,f]),x.useEffect(()=>{!a&&d&&(b.current=!0)},[a,d]);const C=x.useMemo(()=>{function A(R){w(R.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:T,onMouseEnter:T}},[T]);return x.useMemo(()=>a?{reference:C,trigger:C}:{},[a,C])}function fH(){return!1}function pH(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function af(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:f=fH,bubbles:p,externalTree:h}=t,b="rootStore"in e?e.rootStore:e,y=b.useState("open"),v=b.useState("floatingElement"),{dataRef:w,events:j}=b.context,S=Mi(h),N=Ie(typeof c=="function"?c:()=>!1),k=typeof c=="function"?N:c,T=k!==!1,D=Ie(()=>d),{escapeKey:C,outsidePress:A}=pH(p),R=x.useRef(!1),I=x.useRef(!1),P=x.useRef(!1),O=x.useRef(!1),_=x.useRef(!1),L=x.useRef(""),H=x.useRef(null),B=Zs(),z=Zs(),Q=Ie(()=>{z.clear(),w.current.insideReactTree=!1}),K=Ie(M=>{const U=w.current.floatingContext?.nodeId;return(S?io(S.nodesRef.current,U):[]).some(ae=>ae.context?.open&&!ae.context.dataRef.current[M])}),X=Ie(M=>Kv(M,b.select("floatingElement"))||Kv(M,b.select("domReferenceElement"))),q=Ie(M=>{f()&&b.setOpen(!1,Fe(mo,M.nativeEvent))}),$=Ie(M=>{if(!y||!a||!o||M.key!=="Escape"||_.current||!C&&K("__escapeKeyBubbles"))return;const U=LB(M)?M.nativeEvent:M,Z=Fe(Xc,U);b.setOpen(!1,Z),Z.isCanceled||M.preventDefault(),!C&&!Z.isPropagationAllowed&&M.stopPropagation()}),Y=Ie(()=>{w.current.insideReactTree=!0,z.start(0,Q)}),F=Ie(M=>{if(!y||!a||M.button!==0)return;const U=cs(M.nativeEvent);Qe(b.select("floatingElement"),U)&&(R.current||(R.current=!0,I.current=!1))}),G=Ie(M=>{!y||!a||(M.defaultPrevented||M.nativeEvent.defaultPrevented)&&R.current&&(I.current=!0)});x.useEffect(()=>{function M(U){U.open||(O.current=!1)}return j.on("openchange",M),()=>{j.off("openchange",M)}},[j]),x.useEffect(()=>{if(!y||!a)return y||(O.current=!1),Q;w.current.__escapeKeyBubbles=C,w.current.__outsidePressBubbles=A;const M=new sa,U=new sa,Z=$t(v);function ae(){M.clear(),_.current=!0}function ce(){M.start(yl?5:0,()=>{_.current=!1})}function J(){P.current=!0,U.start(0,()=>{P.current=!1})}function ie(){R.current=!1,I.current=!1}function ge(){const Oe=L.current,Ne=Oe==="pen"||!Oe?"mouse":Oe,_e=D(),Ye=typeof _e=="function"?_e():_e;return typeof Ye=="string"?Ye:Ye[Ne]}function ee(Oe){const Ne=ge();return Ne==="intentional"&&Oe.type!=="click"||Ne==="sloppy"&&Oe.type==="click"}function fe(Oe){const Ne=w.current.floatingContext?.nodeId,_e=S&&io(S.nodesRef.current,Ne).some(Ye=>Kv(Oe,Ye.context?.elements.floating));return X(Oe)||_e}function te(Oe){if(ee(Oe)){Oe.type!=="click"&&!X(Oe)&&(U.clear(),P.current=!1),Q();return}if(w.current.insideReactTree){Q();return}const Ne=cs(Oe),_e=`[${sf("inert")}]`,Ye=At(Ne)?Ne.getRootNode():null,kt=Array.from((Bc(Ye)?Ye:$t(b.select("floatingElement"))).querySelectorAll(_e)),Ct=b.context.triggerElements;if(Ne&&(Ct.hasElement(Ne)||Ct.hasMatchingElement(ot=>Qe(ot,Ne))))return;let Rt=At(Ne)?Ne:null;for(;Rt&&!no(Rt);){const ot=so(Rt);if(no(ot)||!At(ot))break;Rt=ot}if(!(kt.length&&At(Ne)&&!IB(Ne)&&!Qe(Ne,b.select("floatingElement"))&&kt.every(ot=>!Qe(Rt,ot)))){if(dn(Ne)&&!("touches"in Oe)){const ot=no(Ne),qn=xr(Ne),fs=/auto|scroll/,Gn=ot||fs.test(qn.overflowX),bs=ot||fs.test(qn.overflowY),it=Gn&&Ne.clientWidth>0&&Ne.scrollWidth>Ne.clientWidth,Vt=bs&&Ne.clientHeight>0&&Ne.scrollHeight>Ne.clientHeight,Hn=qn.direction==="rtl",tn=Vt&&(Hn?Oe.offsetX<=Ne.offsetWidth-Ne.clientWidth:Oe.offsetX>Ne.clientWidth),nt=it&&Oe.offsetY>Ne.clientHeight;if(tn||nt)return}if(!fe(Oe)){if(ge()==="intentional"){if(Oe.detail!==0&&!Gm(Oe)&&!O.current)return;if(P.current){U.clear(),P.current=!1;return}}typeof k=="function"&&!k(Oe)||K("__outsidePressBubbles")||(b.setOpen(!1,Fe(nh,Oe)),Q())}}}function Ce(Oe){ge()!=="sloppy"||Oe.pointerType==="touch"||!b.select("open")||!a||X(Oe)||te(Oe)}function re(Oe){if(ge()!=="sloppy"||!b.select("open")||!a||X(Oe))return;const Ne=Oe.touches[0];Ne&&(H.current={startTime:Date.now(),startX:Ne.clientX,startY:Ne.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},B.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function de(Oe,Ne){const _e=cs(Oe);if(!_e)return;const Ye=St(_e,Oe.type,()=>{Ne(Oe),Ye()})}function ke(Oe){L.current="touch",de(Oe,re)}function Ee(Oe){B.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),L.current=Oe.pointerType),!(Oe.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&de(Oe,Ne=>{Ne.type==="pointerdown"?Ce(Ne):te(Ne)})}function ve(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!R.current)return;const Ne=I.current;if(ie(),ge()==="intentional"){if(Oe.type==="pointercancel"){Ne&&J();return}if(!fe(Oe)){if(Ne){J();return}typeof k=="function"&&!k(Oe)||(U.clear(),P.current=!0,Q())}}}function he(Oe){if(ge()!=="sloppy"||!H.current||X(Oe))return;const Ne=Oe.touches[0];if(!Ne)return;const _e=Math.abs(Ne.clientX-H.current.startX),Ye=Math.abs(Ne.clientY-H.current.startY),kt=Math.sqrt(_e*_e+Ye*Ye);kt>5&&(H.current.dismissOnTouchEnd=!0),kt>10&&(te(Oe),B.clear(),H.current=null)}function ye(Oe){de(Oe,he)}function je(Oe){ge()!=="sloppy"||!H.current||X(Oe)||(H.current.dismissOnTouchEnd&&te(Oe),B.clear(),H.current=null)}function xe(Oe){de(Oe,je)}const Te=Ya(o&&Ya(St(Z,"keydown",$),St(Z,"compositionstart",ae),St(Z,"compositionend",ce)),T&&Ya(St(Z,"click",Ee,!0),St(Z,"pointerdown",Ee,!0),St(Z,"pointerup",ve,!0),St(Z,"pointercancel",ve,!0),St(Z,"mousedown",Ee,!0),St(Z,"mouseup",ve,!0),St(Z,"touchstart",ke,{capture:!0,passive:!0}),St(Z,"touchmove",ye,{capture:!0,passive:!0}),St(Z,"touchend",xe,{capture:!0,passive:!0})));return()=>{Te(),M.clear(),U.clear(),ie(),P.current=!1,Q()}},[w,v,o,T,k,y,a,C,A,$,Q,D,K,X,S,b,B]);const W=x.useMemo(()=>({onKeyDown:$,onPointerDown:q,onClick:q}),[$,q]),le=x.useMemo(()=>({onKeyDown:$,onPointerDown:G,onMouseDown:G,onClickCapture:Y,onMouseDownCapture(M){Y(),F(M)},onPointerDownCapture(M){Y(),F(M)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[$,Y,F,G]);return x.useMemo(()=>a?{reference:W,floating:le,trigger:W}:{},[a,W,le])}function iT(e,t,a){let{reference:o,floating:c}=e;const d=na(t),f=Wv(t),p=Zv(f),h=ta(t),b=d==="y",y=o.x+o.width/2-c.width/2,v=o.y+o.height/2-c.height/2,w=o[p]/2-c[p]/2;let j;switch(h){case"top":j={x:y,y:o.y-c.height};break;case"bottom":j={x:y,y:o.y+o.height};break;case"right":j={x:o.x+o.width,y:v};break;case"left":j={x:o.x-c.width,y:v};break;default:j={x:o.x,y:o.y}}const S=Sl(t);return S&&(j[f]+=w*(S==="end"?1:-1)*(a&&b?-1:1)),j}async function mH(e,t){var a;t===void 0&&(t={});const{x:o,y:c,platform:d,rects:f,elements:p,strategy:h}=e,{boundary:b="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:w=!1,padding:j=0}=uo(t,e),S=i1(j),k=p[w?v==="floating"?"reference":"floating":v],T=Xd(await d.getClippingRect({element:(a=await(d.isElement==null?void 0:d.isElement(k)))==null||a?k:k.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(p.floating)),boundary:b,rootBoundary:y,strategy:h})),D=v==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,C=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p.floating)),A=await(d.isElement==null?void 0:d.isElement(C))&&await(d.getScale==null?void 0:d.getScale(C))||{x:1,y:1},R=Xd(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:D,offsetParent:C,strategy:h}):D);return{top:(T.top-R.top+S.top)/A.y,bottom:(R.bottom-T.bottom+S.bottom)/A.y,left:(T.left-R.left+S.left)/A.x,right:(R.right-T.right+S.right)/A.x}}const hH=50,gH=async(e,t,a)=>{const{placement:o="bottom",strategy:c="absolute",middleware:d=[],platform:f}=a,p=f.detectOverflow?f:{...f,detectOverflow:mH},h=await(f.isRTL==null?void 0:f.isRTL(t));let b=await f.getElementRects({reference:e,floating:t,strategy:c}),{x:y,y:v}=iT(b,o,h),w=o,j=0;const S={};for(let N=0;NQ<=0)){var H,B;const Q=(((H=d.flip)==null?void 0:H.index)||0)+1,K=P[Q];if(K&&(!(v==="alignment"?D!==na(K):!1)||L.every($=>na($.placement)===D?$.overflows[0]>0:!0)))return{data:{index:Q,overflows:L},reset:{placement:K}};let X=(B=L.filter(q=>q.overflows[0]<=0).sort((q,$)=>q.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!X)switch(j){case"bestFit":{var z;const q=(z=L.filter($=>{if(I){const Y=na($.placement);return Y===D||Y==="y"}return!0}).map($=>[$.placement,$.overflows.filter(Y=>Y>0).reduce((Y,F)=>Y+F,0)]).sort(($,Y)=>$[1]-Y[1])[0])==null?void 0:z[0];q&&(X=q);break}case"initialPlacement":X=p;break}if(c!==X)return{reset:{placement:X}}}return{}}}},cT=new Set(["left","top"]);async function bH(e,t){const{placement:a,platform:o,elements:c}=e,d=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=ta(a),p=Sl(a),h=na(a)==="y",b=cT.has(f)?-1:1,y=d&&h?-1:1,v=uo(t,e);let{mainAxis:w,crossAxis:j,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return p&&typeof S=="number"&&(j=p==="end"?S*-1:S),h?{x:j*y,y:w*b}:{x:w*b,y:j*y}}const vH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:c,y:d,placement:f,middlewareData:p}=t,h=await bH(t,e);return f===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+h.x,y:d+h.y,data:{...h,placement:f}}}}},yH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:c,platform:d}=t,{mainAxis:f=!0,crossAxis:p=!1,limiter:h={fn:D=>{let{x:C,y:A}=D;return{x:C,y:A}}},...b}=uo(e,t),y={x:a,y:o},v=await d.detectOverflow(t,b),w=na(c),j=Qv(w);let S=y[j],N=y[w];const k=(D,C)=>a1(C+v[D==="y"?"top":"left"],C,C-v[D==="y"?"bottom":"right"]);f&&(S=k(j,S)),p&&(N=k(w,N));const T=h.fn({...t,[j]:S,[w]:N});return{...T,data:{x:T.x-a,y:T.y-o,enabled:{[j]:f,[w]:p}}}}}},wH=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,o;const{x:c,y:d,placement:f,rects:p,middlewareData:h}=t,{offset:b=0,mainAxis:y=!0,crossAxis:v=!0}=uo(e,t),w={x:c,y:d},j=na(f),S=Qv(j);let N=w[S],k=w[j];const T=uo(b,t),D=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(a=T.mainAxis)!=null?a:0,crossAxis:(o=T.crossAxis)!=null?o:0};if(y){const R=S==="y"?"height":"width",I=p.reference[S]-p.floating[R]+D.mainAxis,P=p.reference[S]+p.reference[R]-D.mainAxis;NP&&(N=P)}if(v){var C,A;const R=S==="y"?"width":"height",I=cT.has(ta(f)),P=p.reference[j]-p.floating[R]+(I&&((C=h.offset)==null?void 0:C[j])||0)+(I?0:D.crossAxis),O=p.reference[j]+p.reference[R]+(I?0:((A=h.offset)==null?void 0:A[j])||0)-(I?D.crossAxis:0);kO&&(k=O)}return{[S]:N,[j]:k}}}},jH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:o,platform:c,elements:d}=t,{apply:f=()=>{},...p}=uo(e,t),h=await c.detectOverflow(t,p),b=ta(a),y=Sl(a),v=na(a)==="y",{width:w,height:j}=o.floating;let S,N;b==="top"||b==="bottom"?(S=b,N=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(N=b,S=y==="end"?"top":"bottom");const k=j-h.top-h.bottom,T=w-h.left-h.right,D=qc(j-h[S],k),C=qc(w-h[N],T),A=t.middlewareData.shift,R=!A;let I=D,P=C;A!=null&&A.enabled.x&&(P=T),A!=null&&A.enabled.y&&(I=k),R&&!y&&(v?P=w-2*wl(h.left,h.right):I=j-2*wl(h.top,h.bottom)),await f({...t,availableWidth:P,availableHeight:I});const O=await c.getDimensions(d.floating);return w!==O.width||j!==O.height?{reset:{rects:!0}}:{}}}};function uT(e){const t=xr(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const c=dn(e),d=c?e.offsetWidth:a,f=c?e.offsetHeight:o,p=Km(a)!==d||Km(o)!==f;return p&&(a=d,o=f),{width:a,height:o,$:p}}function vy(e){return At(e)?e:e.contextElement}function eu(e){const t=vy(e);if(!dn(t))return jl(1);const a=t.getBoundingClientRect(),{width:o,height:c,$:d}=uT(t);let f=(d?Km(a.width):a.width)/o,p=(d?Km(a.height):a.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const SH=jl(0);function dT(e){const t=Sn(e);return!Cv()||!t.visualViewport?SH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Sn(e)}function Di(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const c=e.getBoundingClientRect(),d=vy(e);let f=jl(1);t&&(o?At(o)&&(f=eu(o)):f=eu(e));const p=NH(d,a,o)?dT(d):jl(0);let h=(c.left+p.x)/f.x,b=(c.top+p.y)/f.y,y=c.width/f.x,v=c.height/f.y;if(d&&o){const w=Sn(d),j=At(o)?Sn(o):o;let S=w,N=Tv(S);for(;N&&j!==S;){const k=eu(N),T=N.getBoundingClientRect(),D=xr(N),C=T.left+(N.clientLeft+parseFloat(D.paddingLeft))*k.x,A=T.top+(N.clientTop+parseFloat(D.paddingTop))*k.y;h*=k.x,b*=k.y,y*=k.x,v*=k.y,h+=C,b+=A,S=Sn(N),N=Tv(S)}}return Xd({width:y,height:v,x:h,y:b})}function ch(e,t){const a=Im(e).scrollLeft;return t?t.left+a:Di(xl(e)).left+a}function fT(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-ch(e,a),c=a.top+t.scrollTop;return{x:o,y:c}}function kH(e){let{elements:t,rect:a,offsetParent:o,strategy:c}=e;const d=c==="fixed",f=xl(o),p=t?Dm(t.floating):!1;if(o===f||p&&d)return a;let h={scrollLeft:0,scrollTop:0},b=jl(1);const y=jl(0),v=dn(o);if((v||!d)&&((Hs(o)!=="body"||Fd(f))&&(h=Im(o)),v)){const j=Di(o);b=eu(o),y.x=j.x+o.clientLeft,y.y=j.y+o.clientTop}const w=f&&!v&&!d?fT(f,h):jl(0);return{width:a.width*b.x,height:a.height*b.y,x:a.x*b.x-h.scrollLeft*b.x+y.x+w.x,y:a.y*b.y-h.scrollTop*b.y+y.y+w.y}}function CH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function TH(e){const t=Im(e),a=e.ownerDocument.body,o=wl(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=wl(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-t.scrollLeft+ch(e);const f=-t.scrollTop;return xr(a).direction==="rtl"&&(d+=wl(e.clientWidth,a.clientWidth)-o),{width:o,height:c,x:d,y:f}}const EH=25;function AH(e,t,a){a===void 0&&(a="viewport");const o=a==="layoutViewport",c=Sn(e),d=xl(e),f=c.visualViewport;let p=d.clientWidth,h=d.clientHeight,b=0,y=0;if(f){const w=!Cv()||t==="fixed";o?w||(b=-f.offsetLeft,y=-f.offsetTop):(p=f.width,h=f.height,w&&(b=f.offsetLeft,y=f.offsetTop))}if(ch(d)<=0){const w=d.ownerDocument,j=w.body,S=getComputedStyle(j),N=w.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,k=Math.abs(d.clientWidth-j.clientWidth-N),T=getComputedStyle(d).scrollbarGutter==="stable both-edges"?k/2:k;T<=EH&&(p-=T)}return{width:p,height:h,x:b,y}}function RH(e,t){const a=Di(e,!0,t==="fixed"),o=a.top+e.clientTop,c=a.left+e.clientLeft,d=eu(e),f=e.clientWidth*d.x,p=e.clientHeight*d.y,h=c*d.x,b=o*d.y;return{width:f,height:p,x:h,y:b}}function pT(e,t,a){let o;if(t==="viewport"||t==="layoutViewport")o=AH(e,a,t);else if(t==="document")o=TH(xl(e));else if(At(t))o=RH(t,a);else{const c=dT(e);o={x:t.x-c.x,y:t.y-c.y,width:t.width,height:t.height}}return Xd(o)}function OH(e,t){const a=t.get(e);if(a)return a;let o=Hc(e,[],!1).filter(p=>At(p)&&Hs(p)!=="body"),c=null;const d=xr(e).position==="fixed";let f=d?so(e):e;for(;At(f)&&!no(f);){const p=xr(f),h=kv(f),b=c?c.position:d?"fixed":"";!h&&(b==="fixed"||b==="absolute"&&p.position==="static")?o=o.filter(v=>v!==f):c=p,f=so(f)}return t.set(e,o),o}function MH(e){let{element:t,boundary:a,rootBoundary:o,strategy:c}=e;const f=[...a==="clippingAncestors"?Dm(t)?[]:OH(t,this._c):[].concat(a),o],p=pT(t,f[0],c);let h=p.top,b=p.right,y=p.bottom,v=p.left;for(let w=1;w{p(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(O,{...I,root:d.ownerDocument})}catch{o=new IntersectionObserver(O,I)}o.observe(e)}const h=Sn(e),b=()=>p(a);return h.addEventListener("resize",b),p(!0),()=>{h.removeEventListener("resize",b),f()}}function bT(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,b=vy(e),y=c||d?[...b?Hc(b):[],...t?Hc(t):[]]:[];y.forEach(T=>{c&&T.addEventListener("scroll",a),d&&T.addEventListener("resize",a)});const v=b&&p?LH(b,a,d):null;let w=-1,j=null;f&&(j=new ResizeObserver(T=>{let[D]=T;D&&D.target===b&&j&&t&&(j.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var C;(C=j)==null||C.observe(t)})),a()}),b&&!h&&j.observe(b),t&&j.observe(t));let S,N=h?Di(e):null;h&&k();function k(){const T=Di(e);N&&!xT(N,T)&&a(),N=T,S=requestAnimationFrame(k)}return a(),()=>{var T;y.forEach(D=>{c&&D.removeEventListener("scroll",a),d&&D.removeEventListener("resize",a)}),v?.(),(T=j)==null||T.disconnect(),j=null,h&&cancelAnimationFrame(S)}}const zH=vH,BH=yH,HH=xH,UH=jH,VH=wH,FH=(e,t,a)=>{const o=new Map,c=a??{},d={...gT,...c.platform,_c:o};return gH(e,t,{...c,platform:d})};var $H=typeof document<"u",qH=function(){},uh=$H?x.useLayoutEffect:qH;function dh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,c;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!dh(e[o],t[o]))return!1;return!0}if(c=Object.keys(e),a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,c[o]))return!1;for(o=a;o--!==0;){const d=c[o];if(!(d==="_owner"&&e.$$typeof)&&!dh(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function vT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yT(e,t){const a=vT(e);return Math.round(t*a)/a}function wy(e){const t=x.useRef(e);return uh(()=>{t.current=e}),t}function GH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:c,elements:{reference:d,floating:f}={},transform:p=!0,whileElementsMounted:h,open:b}=e,[y,v]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[w,j]=x.useState(o);dh(w,o)||j(o);const[S,N]=x.useState(null),[k,T]=x.useState(null),D=x.useCallback($=>{$!==I.current&&(I.current=$,N($))},[]),C=x.useCallback($=>{$!==P.current&&(P.current=$,T($))},[]),A=d||S,R=f||k,I=x.useRef(null),P=x.useRef(null),O=x.useRef(y),_=h!=null,L=wy(h),H=wy(c),B=wy(b),z=x.useCallback(()=>{if(!I.current||!P.current)return;const $={placement:t,strategy:a,middleware:w};H.current&&($.platform=H.current),FH(I.current,P.current,$).then(Y=>{const F={...Y,isPositioned:B.current!==!1};Q.current&&!dh(O.current,F)&&(O.current=F,Cs.flushSync(()=>{v(F)}))})},[w,t,a,H,B]);uh(()=>{b===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,v($=>({...$,isPositioned:!1})))},[b]);const Q=x.useRef(!1);uh(()=>(Q.current=!0,()=>{Q.current=!1}),[]),uh(()=>{if(A&&(I.current=A),R&&(P.current=R),A&&R){if(L.current)return L.current(A,R,z);z()}},[A,R,z,L,_]);const K=x.useMemo(()=>({reference:I,floating:P,setReference:D,setFloating:C}),[D,C]),X=x.useMemo(()=>({reference:A,floating:R}),[A,R]),q=x.useMemo(()=>{const $={position:a,left:0,top:0};if(!X.floating)return $;const Y=yT(X.floating,y.x),F=yT(X.floating,y.y);return p?{...$,transform:"translate("+Y+"px, "+F+"px)",...vT(X.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Y,top:F}},[a,p,X.floating,y.x,y.y]);return x.useMemo(()=>({...y,update:z,refs:K,elements:X,floatingStyles:q}),[y,z,K,X,q])}const KH=(e,t)=>{const a=zH(e);return{name:a.name,fn:a.fn,options:[e,t]}},YH=(e,t)=>{const a=BH(e);return{name:a.name,fn:a.fn,options:[e,t]}},XH=(e,t)=>({fn:VH(e).fn,options:[e,t]}),QH=(e,t)=>{const a=HH(e);return{name:a.name,fn:a.fn,options:[e,t]}},ZH=(e,t)=>{const a=UH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var jy={exports:{}},Sy={};var wT;function WH(){if(wT)return Sy;wT=1;var e=Vd();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,c=e.useEffect,d=e.useLayoutEffect,f=e.useDebugValue;function p(v,w){var j=w(),S=o({inst:{value:j,getSnapshot:w}}),N=S[0].inst,k=S[1];return d(function(){N.value=j,N.getSnapshot=w,h(N)&&k({inst:N})},[v,j,w]),c(function(){return h(N)&&k({inst:N}),v(function(){h(N)&&k({inst:N})})},[v]),f(j),j}function h(v){var w=v.getSnapshot;v=v.value;try{var j=w();return!a(v,j)}catch{return!0}}function b(v,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b:p;return Sy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sy}var jT;function ST(){return jT||(jT=1,jy.exports=WH()),jy.exports}var Ny=ST(),ky={exports:{}},Cy={};var NT;function JH(){if(NT)return Cy;NT=1;var e=Vd(),t=ST();function a(b,y){return b===y&&(b!==0||1/b===1/y)||b!==b&&y!==y}var o=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,d=e.useRef,f=e.useEffect,p=e.useMemo,h=e.useDebugValue;return Cy.useSyncExternalStoreWithSelector=function(b,y,v,w,j){var S=d(null);if(S.current===null){var N={hasValue:!1,value:null};S.current=N}else N=S.current;S=p(function(){function T(I){if(!D){if(D=!0,C=I,I=w(I),j!==void 0&&N.hasValue){var P=N.value;if(j(P,I))return A=P}return A=I}if(P=A,o(C,I))return P;var O=w(I);return j!==void 0&&j(P,O)?(C=I,P):(C=I,A=O)}var D=!1,C,A,R=v===void 0?null:v;return[function(){return T(y())},R===null?void 0:function(){return T(R())}]},[y,v,w,j]);var k=c(b,S[0],S[1]);return f(function(){N.hasValue=!0,N.value=k},[k]),h(k),k},Cy}var kT;function eU(){return kT||(kT=1,ky.exports=JH()),ky.exports}var tU=eU();const nU=Iv(19)?rU:aU;function CT(e,t,a,o,c){return nU(e,t,a,o,c)}function sU(e,t,a,o,c){const d=x.useCallback(()=>t(e.getSnapshot(),a,o,c),[e,t,a,o,c]);return Ny.useSyncExternalStore(e.subscribe,d,d)}$4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const c of e.syncHooks)a.add(c.store);const o=[];for(const c of a)o.push(c.subscribe(t));return()=>{for(const c of o)c()}}),Ny.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function rU(e,t,a,o,c){const d=F4();if(!d)return sU(e,t,a,o,c);const f=d.syncIndex;d.syncIndex+=1;let p;return d.didInitialize?(p=d.syncHooks[f],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,c))&&(p.store!==e&&(d.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=c,p.value=t(e.getSnapshot(),a,o,c))):(p={store:e,selector:t,a1:a,a2:o,a3:c,value:t(e.getSnapshot(),a,o,c)},d.syncHooks.push(p)),p.value}function aU(e,t,a,o,c){return tU.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,d=>t(d,a,o,c))}class lU{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,c){return CT(this,t,a,o,c)}}class tu extends lU{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;De(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;De(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);De(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,c=a!==void 0;De(()=>{c&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,c])}select(t,a,o,c){const d=this.selectors[t];return d(this.state,a,o,c)}useState(t,a,o,c){return x.useDebugValue(t),CT(this,this.selectors[t],a,o,c)}useContextCallback(t,a){x.useDebugValue(t);const o=Ie(a??qt);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let c=o(this.state);return a(c,c,this),this.subscribe(d=>{const f=o(d);if(!Object.is(c,f)){const p=c;c=f,a(f,p,this)}})}}const oU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Ty extends tu{constructor(a){const{syncOnly:o,nested:c,onOpenChange:d,triggerElements:f,...p}=a;super({...p,positionReference:p.referenceElement,domReferenceElement:p.referenceElement},{onOpenChange:d,dataRef:{current:{}},events:eT(),nested:c,triggerElements:f},oU);ln(this,"syncOpenEvent",(a,o)=>{(!a||!this.state.open||o!=null&&zB(o))&&(this.context.dataRef.current.openEvent=a?o:void 0)});ln(this,"dispatchOpenChange",(a,o)=>{this.syncOpenEvent(a,o.event);const c={open:a,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",c)});ln(this,"setOpen",(a,o)=>{if(this.syncOnly){this.context.onOpenChange?.(a,o);return}this.dispatchOpenChange(a,o),this.context.onOpenChange?.(a,o)});this.syncOnly=o}}function iU(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:c,nested:d,onOpenChange:f}=e,p=t.useState("open"),h=t.useState("activeTriggerElement"),b=t.useState(a?"popupElement":"positionerElement"),y=t.context.triggerElements,v=f,w=x.useRef(null);o===void 0&&w.current===null&&(w.current=new Ty({open:p,transitionStatus:void 0,referenceElement:h,floatingElement:b,triggerElements:y,onOpenChange:v,floatingId:c,syncOnly:!0,nested:d}));const j=o??w.current;return t.useSyncedValue("floatingId",c),De(()=>{const S={open:p,floatingId:c,referenceElement:h,floatingElement:b};At(h)&&(S.domReferenceElement=h),j.state.positionReference===j.state.referenceElement&&(S.positionReference=h),j.update(S)},[p,c,h,b,j]),j.context.onOpenChange=v,j.context.nested=d,j}const lf={tabIndex:-1,[Uv]:""};function TT(e){return t=>t==="touch"?e.current:!0}function Ey(e,t=!1){const a=Gd(),o=Jc()!=null,c=Ds(()=>e(a,o)).current;return iU({popupStore:c,treatPopupAsFloatingElement:t,floatingRootContext:c.state.floatingRootContext,floatingId:a,nested:o,onOpenChange:c.setOpen}),c}function Ay({handle:e,store:t}){return De(()=>e.attachStore(t),[e,t]),null}function ET(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function cU(e,t){const a=x.useRef(null);return Ie(o=>{const c=a.current;if(c!==null){if(c.element===o&&c.store===t&&c.id===e)return;a.current=null;const d=c.store;d.context.triggerElements.getById(c.id)===c.element&&(d.context.triggerElements.delete(c.id),ET(d))}o!==null&&e!==void 0&&(a.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),ET(t))})}function Ry(e,t,a,o=!1){let c=e.preventUnmountingOnClose;t?c=!1:o&&(c=!0);const d=a?.id??null;let f=e.activeTriggerId,p=e.activeTriggerElement;return(d||t)&&(f=d,p=a??null),{open:t,preventUnmountingOnClose:c,activeTriggerId:f,activeTriggerElement:p}}function AT(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function uU(e,t,a,o={}){const c=a.reason,d=c===Vs,f=t&&c===th,p=!t&&(c===mo||c===Xc),h=AT(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const b=()=>{const y=Ry(e.state,t,a.trigger,h()),v={...o.extraState,...y};f?v.instantType="focus":p?v.instantType="dismiss":d&&(v.instantType=void 0),e.update(v)};d?Cs.flushSync(b):b()}function RT(e,t,a,o){const c=a.useState("isMountedByTrigger",e),d=cU(e,a),f=Ie(h=>{const b=a.select("open"),y=a.select("activeTriggerId");if(y===e){const v={activeTriggerElement:h,...b?o:null};a.update(v);return}if(y==null&&b){const v={activeTriggerId:e??null,activeTriggerElement:h,...o};a.update(v)}}),p=Ie(h=>{d(h),h&&f(h)});return De(()=>(p(t.current),()=>p(null)),[p,t,a,e]),De(()=>{if(c){const h={activeTriggerElement:t.current,...o};a.update(h)}},[c,a,t,...Object.values(o)]),{registerTrigger:p,isMountedByThisTrigger:c}}function Oy(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=x.useRef(null),c=e.useState("open"),d=e.useState("triggerCount"),f=e.useState("activeTriggerId"),p=e.useState("activeTriggerElement");De(()=>{if(!c){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const h=e.context.triggerElements.size,b={};e.state.triggerCount!==h&&(b.triggerCount=h);const y=e.select("activeTriggerId");let v=null;if(y){const w=e.context.triggerElements.getById(y);if(w)o.current=y,w!==e.state.activeTriggerElement&&(b.activeTriggerElement=w);else{for(const[j,S]of e.context.triggerElements.entries())if(S===e.state.activeTriggerElement){b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j;break}b.activeTriggerId===void 0&&(o.current===y?v=y:o.current=null)}}else o.current=null;if(!v&&!y&&h===1){const w=e.context.triggerElements.entries().next();if(!w.done){const[j,S]=w.value;b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j}}(b.triggerCount!==void 0||b.activeTriggerId!==void 0||b.activeTriggerElement!==void 0)&&e.update(b),v&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===v&&!e.context.triggerElements.getById(v)){const w=Fe(Yn);e.setOpen(!1,w),w.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[c,e,d,f,p,a])}function My(e,t,a,o){const{mounted:c,setMounted:d,transitionStatus:f}=ki(e,!1,!1,o),p=t.useState("preventUnmountingOnClose"),h=e?!1:p;t.useSyncedValues({mounted:c,transitionStatus:f,preventUnmountingOnClose:h});const b=Ie(()=>{d(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ra({enabled:c&&!e&&!h,open:e,ref:t.context.popupRef,onComplete(){e||b()}}),{forceUnmount:b,transitionStatus:f}}function Dy(e,t){e.useSyncedValues(t),De(()=>()=>{e.update({activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn})},[e])}function OT(e,t){De(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),De(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fh{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Iy(e,t,a=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ty({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn}}const of=e=>e.triggerIdProp??e.activeTriggerId,Py=e=>e.openProp??e.open,MT=e=>(e.popupElement?.id??e.floatingId)||void 0;function DT(e,t){return t!==void 0&&Py(e)&&of(e)===t}function dU(e,t){return DT(e,t)?!0:t!==void 0&&Py(e)&&of(e)==null&&e.triggerCount===1}const _y={open:Py,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:of,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:MT,isTriggerActive:(e,t)=>t!==void 0&&of(e)===t,isOpenedByTrigger:(e,t)=>DT(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&of(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>dU(e,t)?MT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function IT(e){const t=x.useCallback(o=>e===void 0?qt:e.subscribeStore(o),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ny.useSyncExternalStore(t,a,()=>e?.serverStore)}function PT(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,c=Gd(),d=Jc()!=null,f=Ds(()=>new Ty({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new fh,floatingId:c,syncOnly:!1,nested:d})).current;return De(()=>{const p={open:t,floatingId:c};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=At(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),f.update(p)},[t,c,o.reference,o.floating,f]),f.context.onOpenChange=a,f.context.nested=d,f}function fU(e){return pU(e,e.rootContext)}function pU(e,t){const{nodeId:a,externalTree:o}=e,c=t.useState("referenceElement"),d=t.useState("floatingElement"),f=t.useState("domReferenceElement"),p=t.useState("open"),h=t.useState("floatingId"),[b,y]=x.useState(null),[v,w]=x.useState(void 0),[j,S]=x.useState(void 0),N=x.useRef(null),k=Mi(o),T=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),D=GH({...e,elements:{...T,...b&&{reference:b}}}),C=At(v)?v:null,A=j===void 0?t.state.floatingElement:j;t.useSyncedValue("referenceElement",v??null),t.useSyncedValue("domReferenceElement",v===void 0?f:C),t.useSyncedValue("floatingElement",A);const R=x.useCallback(H=>{const B=At(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;y(B),D.refs.setReference(B)},[D.refs]),I=x.useCallback(H=>{(At(H)||H===null)&&(N.current=H,w(H)),(At(D.refs.reference.current)||D.refs.reference.current===null||H!==null&&!At(H))&&D.refs.setReference(H)},[D.refs,w]),P=x.useCallback(H=>{S(H),D.refs.setFloating(H)},[D.refs]),O=x.useMemo(()=>({...D.refs,setReference:I,setFloating:P,setPositionReference:R,domReference:N}),[D.refs,I,P,R]),_=x.useMemo(()=>({...D.elements,domReference:f}),[D.elements,f]),L=x.useMemo(()=>({...D,dataRef:t.context.dataRef,open:p,onOpenChange:t.setOpen,events:t.context.events,floatingId:h,refs:O,elements:_,nodeId:a,rootStore:t}),[D,O,_,a,t,p,h]);return De(()=>{f&&(N.current=f)},[f]),De(()=>{t.context.dataRef.current.floatingContext=L;const H=k?.nodesRef.current.find(B=>B.id===a);H&&(H.context=L)}),x.useMemo(()=>({...D,context:L,refs:O,elements:_,rootStore:t}),[D,O,_,L,t])}const Ly=JC&&yl;function mU(e,t={}){const{enabled:a=!0,delay:o}=t,c="rootStore"in e?e.rootStore:e,{events:d,dataRef:f}=c.context,p=x.useRef(!1),h=x.useRef(null),b=x.useRef(!0),y=Zs();x.useEffect(()=>{const w=c.select("domReferenceElement");if(!a)return;const j=Sn(w);function S(){const T=c.select("domReferenceElement");!c.select("open")&&dn(T)&&T===or($t(T))&&(p.current=!0,h.current=T)}function N(){b.current=!0}function k(){b.current=!1}return Ya(St(j,"blur",S),Ly&&St(j,"keydown",N,!0),Ly&&St(j,"pointerdown",k,!0))},[c,a]),x.useEffect(()=>{if(!a)return;function w(j){if(j.reason===mo||j.reason===Xc){const S=c.select("domReferenceElement");At(S)&&(h.current=S,p.current=!0)}}return d.on("openchange",w),()=>{d.off("openchange",w)}},[d,a,c]);const v=x.useMemo(()=>{function w(){p.current=!1,h.current=null}return{onMouseLeave(){w()},onFocus(j){const S=j.currentTarget;if(p.current){if(h.current===S)return;w()}const N=cs(j.nativeEvent);if(At(N)){if(Ly&&!j.relatedTarget){if(!b.current&&!$m(N))return}else if(!_B(N))return}const k=Fm(j.relatedTarget,c.context.triggerElements),{nativeEvent:T,currentTarget:D}=j,C=typeof o=="function"?o():o;if(c.select("open")&&k||C===0||C===void 0){c.setOpen(!0,Fe(th,T,D));return}y.start(C,()=>{p.current||c.setOpen(!0,Fe(th,T,D))})},onBlur(j){w();const S=j.relatedTarget,N=j.nativeEvent,k=At(S)&&S.hasAttribute(sf("focus-guard"))&&S.getAttribute("data-type")==="outside";y.start(0,()=>{const T=c.select("domReferenceElement"),D=or($t(T));!S&&D===T||Qe(f.current.floatingContext?.refs.floating.current,D)||Qe(T,D)||k||Fm(S??D,c.context.triggerElements)||c.setOpen(!1,Fe(th,N))})}}},[f,o,c,y]);return x.useMemo(()=>a?{reference:v,trigger:v}:{},[a,v])}class zy{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new sa,this.restTimeout=new sa,this.handleCloseOptions=void 0}static create(){return new zy}}const ph=new WeakMap;function mh(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&ph.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ph.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _T(e,t){const{scopeElement:a,referenceElement:o,floatingElement:c}=t,d=ph.get(a);d&&d!==e&&mh(d),mh(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=c,ph.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",c.style.pointerEvents="auto"}function By(e){const t=e.context.dataRef.current,a=Ds(()=>t.hoverInteractionState??zy.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),ay(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function LT(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:c}=t,d="rootStore"in e?e.rootStore:e,f=d.useState("open"),p=d.useState("floatingElement"),h=d.useState("domReferenceElement"),{dataRef:b}=d.context,y=Mi(),v=Jc(),w=By(d),j=Zs(),S=Ie(()=>H1(b.current.openEvent?.type,w.interactedInside)),N=Ie(()=>K4(b.current.openEvent?.type)),k=Ie(()=>{mh(w)});De(()=>{f||(w.pointerType=void 0,w.restTimeoutPending=!1,w.interactedInside=!1,k())},[f,w,k]),x.useEffect(()=>k,[k]),De(()=>{if(a&&f&&w.handleCloseOptions?.blockPointerEvents&&N()&&At(h)&&p){const T=h,D=p,C=$t(p),A=y?.nodesRef.current.find(O=>O.id===v)?.context?.elements.floating;A&&(A.style.pointerEvents="");const R=w.pointerEventsScopeElement!==D?w.pointerEventsScopeElement:null,I=A!==D?A:null,P=w.handleCloseOptions?.getScope?.()??R??I??T.closest("[data-rootownerid]")??C.body;return _T(w,{scopeElement:P,referenceElement:T,floatingElement:D}),()=>{k()}}},[a,f,h,p,w,N,y,v,k]),x.useEffect(()=>{if(!a)return;function T(){return!!(y&&v&&io(y.nodesRef.current,v).length>0)}function D(O){const _=Oi(o,"close",w.pointerType),L=()=>{d.setOpen(!1,Fe(Vs,O)),y?.events.emit("floating.closed",O)};_?w.openChangeTimeout.start(_,L):(w.openChangeTimeout.clear(),L())}function C(O){const _=cs(O);if(!PB(_)){w.interactedInside=!1;return}w.interactedInside=_?.closest("[aria-haspopup]")!=null}function A(){w.openChangeTimeout.clear(),j.clear(),y?.events.off("floating.closed",I),k()}function R(O){if(T()&&y){y.events.on("floating.closed",I);return}if(Fm(O.relatedTarget,d.context.triggerElements))return;const _=b.current.floatingContext?.nodeId??c,L=O.relatedTarget;if(!(y&&_&&At(L)&&io(y.nodesRef.current,_,!1).some(B=>Qe(B.context?.elements.floating,L)))){if(w.handler){w.handler(O);return}k(),N()&&!S()&&D(O)}}function I(O){!y||!v||T()||j.start(0,()=>{y.events.off("floating.closed",I),d.setOpen(!1,Fe(Vs,O)),y.events.emit("floating.closed",O)})}const P=p;return Ya(P&&St(P,"mouseenter",A),P&&St(P,"mouseleave",R),P&&St(P,"pointerdown",C,!0),()=>{y?.events.off("floating.closed",I)})},[a,p,d,b,o,c,N,S,k,w,y,v,j])}const hU={current:null};function zT(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:c=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElementRef:h=hU,externalTree:b,isActiveTrigger:y=!0,getHandleCloseContext:v,isClosing:w,shouldOpen:j,guardStaleOpen:S=!1}=t,N="rootStore"in e?e.rootStore:e,{dataRef:k,events:T}=N.context,D=Mi(b),C=By(N),A=x.useRef(!1),R=Xn(c),I=Xn(o),P=Xn(f),O=Xn(a),_=Xn(j),L=Xn(w),H=Ie(()=>H1(k.current.openEvent?.type,C.interactedInside)),B=Ie(()=>_.current?.()!==!1),z=Ie((X,q,$)=>{const Y=N.context.triggerElements;if(Y.hasElement(q))return!X||!Qe(X,q);if(!At($))return!1;const F=$;return Y.hasMatchingElement(G=>Qe(G,F))&&(!X||!Qe(X,F))}),Q=Ie(()=>{if(!C.handler)return;$t(N.select("domReferenceElement")).removeEventListener("mousemove",C.handler),C.handler=void 0}),K=Ie(()=>{mh(C)});return y&&(C.handleCloseOptions=c?.__options),x.useEffect(()=>Q,[Q]),x.useEffect(()=>{if(!a)return;function X(q){q.open?A.current=!1:(A.current=q.reason===Vs,Q(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return T.on("openchange",X),()=>{T.off("openchange",X)}},[a,T,C,Q]),x.useEffect(()=>{if(!a)return;function X(W,le=!0){const M=Oi(I.current,"close",C.pointerType);M?C.openChangeTimeout.start(M,()=>{N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W)}):le&&(C.openChangeTimeout.clear(),N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W))}const q=h.current??(y?N.select("domReferenceElement"):null);if(!At(q))return;function $(W){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,d&&!co(C.pointerType))return;const le=B1(P.current),M=Oi(I.current,"open",C.pointerType),U=cs(W),Z=W.currentTarget??null,ae=N.select("domReferenceElement");let ce=Z;if(At(U)&&!N.context.triggerElements.hasElement(U)){for(const de of N.context.triggerElements.elements())if(Qe(de,U)){ce=de;break}}At(Z)&&At(ae)&&!N.context.triggerElements.hasElement(Z)&&Qe(Z,ae)&&(ce=ae);const J=ce==null?!1:z(ae,ce,U),ie=N.select("open"),ge=L.current?.()??N.select("transitionStatus")==="ending",ee=!ie&&ge&&A.current,fe=!J&&At(ce)&&At(ae)&&Qe(ae,ce)&&ee,te=le>0&&!M,Ce=J&&(ie||ee)||fe,re=!ie||J;if(Ce){B()&&N.setOpen(!0,Fe(Vs,W,ce));return}te||(M?C.openChangeTimeout.start(M,()=>{re&&B()&&N.setOpen(!0,Fe(Vs,W,ce))}):re&&B()&&N.setOpen(!0,Fe(Vs,W,ce)))}function Y(W){if(H()){K();return}Q();const le=N.select("domReferenceElement"),M=$t(le);C.restTimeout.clear(),C.restTimeoutPending=!1;const U=k.current.floatingContext??v?.();if(Fm(W.relatedTarget,N.context.triggerElements))return;if(R.current&&U){N.select("open")||C.openChangeTimeout.clear();const ae=h.current;C.handler=R.current({...U,tree:D,x:W.clientX,y:W.clientY,onClose(){K(),Q(),O.current&&!H()&&ae===N.select("domReferenceElement")&&X(W,!0)}}),M.addEventListener("mousemove",C.handler),C.handler(W);return}(C.pointerType!=="touch"||!Qe(N.select("floatingElement"),W.relatedTarget))&&X(W)}function F(W){Qe(q,W.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}const G=S?St(q,"mouseout",F):void 0;return p?Ya(St(q,"mousemove",$,{once:!0}),St(q,"mouseenter",$),St(q,"mouseleave",Y),G):Ya(St(q,"mouseenter",$),St(q,"mouseleave",Y),G)},[Q,K,k,I,N,a,R,C,y,z,H,d,p,P,h,D,O,v,L,B,S]),x.useMemo(()=>{if(!a)return;function X(q){C.pointerType=q.pointerType}return{onPointerDown:X,onPointerEnter:X,onMouseMove(q){const{nativeEvent:$}=q,Y=q.currentTarget,F=N.select("domReferenceElement"),G=N.select("open"),W=z(F,Y,q.target);if(d&&!co(C.pointerType))return;if(G&&W&&C.handleCloseOptions?.blockPointerEvents){const U=N.select("floatingElement");if(U){const Z=C.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;_T(C,{scopeElement:Z,referenceElement:Y,floatingElement:U})}}const le=B1(P.current);if(G&&!W||le===0||!W&&C.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;C.restTimeout.clear();function M(){if(C.restTimeoutPending=!1,H())return;const U=N.select("open");!C.blockMouseMove&&(!U||W)&&B()&&N.setOpen(!0,Fe(Vs,$,Y))}C.pointerType==="touch"?Cs.flushSync(()=>{M()}):W&&G?M():(C.restTimeoutPending=!0,C.restTimeout.start(le,M))}}},[a,C,H,z,d,N,P,B])}const gU="Escape";function BT(e){return yl&&e.movementX===0&&e.movementY===0}function hh(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function gh(e,t){return hh(t,e===Vv||e===Vm,e===ji||e===Si)}function Hy(e,t,a){return hh(t,e===Vm,a?e===ji:e===Si)||e==="Enter"||e===" "||e===""}function xU(e,t,a){return hh(t,a?e===ji:e===Si,e===Vm)}function bU(e,t,a,o){const c=a?e===Si:e===ji,d=e===Vv;return t==="both"||t==="horizontal"&&o?e===gU:hh(t,c,d)}function HT(e,t){const{listRef:a,activeIndex:o,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:h=!1,nested:b=!1,rtl:y=!1,virtual:v=!1,focusItemOnOpen:w="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:S=!0,disabledIndices:N=void 0,orientation:k="vertical",parentOrientation:T,id:D,resetOnPointerLeave:C=!0,externalTree:A,grid:R}=t,I=R!=null,P="rootStore"in e?e.rootStore:e,O=P.useState("open"),_=P.useState("floatingElement"),L=P.useState("domReferenceElement"),H=P.context.dataRef,B=qm(_),z=Yv(L),Q=Xn(B),K=Jc(),X=Mi(A),q=x.useRef(w),$=x.useRef(f??-1),Y=x.useRef(null),F=x.useRef(!0),G=Ie(xe=>{c($.current===-1?null:$.current,xe)}),W=x.useRef(!!_),le=x.useRef(O),M=x.useRef(!1),U=x.useRef(!1),Z=x.useRef(null),ae=Xn(N),ce=Xn(O),J=Xn(f),ie=Xn(C),ge=Kc(),ee=Kc(),fe=Ie(()=>{function xe(_e){v?X?.events.emit("virtualfocus",_e):Z.current=ah(_e,{sync:M.current,preventScroll:!0})}const Te=a.current[$.current],Oe=U.current;Te&&xe(Te),(M.current?_e=>_e():_e=>ge.request(_e))(()=>{const _e=a.current[$.current]||Te;if(!_e)return;Te||xe(_e),Ee&&(Oe||!F.current)&&_e.scrollIntoView?.({block:"nearest",inline:"nearest"})})});De(()=>{H.current.orientation=k},[H,k]),De(()=>{d&&(O&&_?($.current=f??-1,q.current&&f!=null&&(U.current=!0,G())):W.current&&($.current=-1,G()))},[d,O,_,f,G]),De(()=>{if(d){if(!O){M.current=!1;return}if(_)if(o==null){if(M.current=!1,J.current!=null)return;if(W.current&&($.current=-1,fe()),(!le.current||!W.current)&&q.current&&(Y.current!=null||q.current===!0&&Y.current==null)){let xe=0;const Te=()=>{a.current[0]==null?(xe<2&&(xe?Ne=>ee.request(Ne):queueMicrotask)(Te),xe+=1):($.current=Y.current==null||Hy(Y.current,k,y)||b?Qm(a):ey(a),Y.current=null,G())};Te()}}else fo(a.current,o)||($.current=o,fe(),U.current=!1)}},[d,O,_,o,J,b,a,k,y,G,fe,ee]),De(()=>{if(!d||_||!X||v||!W.current)return;const xe=X.nodesRef.current,Te=xe.find(_e=>_e.id===K)?.context?.elements.floating,Oe=or($t(L??Te??null)),Ne=xe.some(_e=>_e.context&&Qe(_e.context.elements.floating,Oe));Te&&!Ne&&F.current&&Te.focus({preventScroll:!0})},[d,_,L,X,K,v]),De(()=>{le.current=O,W.current=!!_}),De(()=>{O||(Y.current=null,q.current=w)},[O,w]);const te=o!=null,Ce=Ie(xe=>{if(!ce.current)return;const Te=a.current.indexOf(xe.currentTarget);Te!==-1&&($.current!==Te||o!==Te)&&($.current=Te,G(xe))}),re=Ie(()=>T??X?.nodesRef.current.find(xe=>xe.id===K)?.context?.dataRef?.current.orientation),de=Ie(()=>Qm(a,ae.current)),ke=Ie(xe=>{if(F.current=!1,M.current=!0,xe.which===229||!ce.current&&xe.currentTarget===Q.current)return;if(b&&bU(xe.key,k,y,I)){gh(xe.key,re())||ks(xe),P.setOpen(!1,Fe(iy,xe.nativeEvent)),dn(L)&&(v?X?.events.emit("virtualfocus",L):L.focus());return}const Te=$.current,Oe=Qm(a,N),Ne=ey(a,N);if(z||(xe.key==="Home"&&(ks(xe),$.current=Oe,G(xe)),xe.key==="End"&&(ks(xe),$.current=Ne,G(xe))),R!=null){const _e=R(xe,$.current,a,k,h,y,N,Oe,Ne);if(_e!=null&&($.current=_e,G(xe)),k==="both")return}if(gh(xe.key,k)){if(ks(xe),O&&!v&&or(xe.currentTarget.ownerDocument)===xe.currentTarget){$.current=Hy(xe.key,k,y)?Oe:Ne,G(xe);return}Hy(xe.key,k,y)?h?Te>=Ne?p&&Te!==a.current.length?$.current=-1:(M.current=!1,$.current=Oe):$.current=Is(a.current,{startingIndex:Te,disabledIndices:N}):$.current=Math.min(Ne,Is(a.current,{startingIndex:Te,disabledIndices:N})):h?Te<=Oe?p&&Te!==-1?$.current=a.current.length:(M.current=!1,$.current=Ne):$.current=Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N}):$.current=Math.max(Oe,Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N})),fo(a.current,$.current)&&($.current=-1),G(xe)}}),Ee=x.useMemo(()=>({onFocus(Te){M.current=!0,Ce(Te)},onClick:({currentTarget:Te})=>Te.focus({preventScroll:!0}),onMouseMove(Te){BT(Te)||(M.current=!0,U.current=!1,j&&Ce(Te))},onPointerLeave(Te){if(!ce.current||!F.current||Te.pointerType==="touch")return;M.current=!0;const Oe=Te.relatedTarget;if(!(!j||a.current.includes(Oe))&&ie.current&&(Z.current?.(),Z.current=null,$.current=-1,G(Te),!v)){const Ne=Q.current,_e=or($t(Ne));Ne&&Qe(Ne,_e)&&Ne.focus({preventScroll:!0})}}}),[Ce,ce,Q,j,a,G,ie,v]),ve=x.useMemo(()=>v&&O&&te&&{"aria-activedescendant":`${D}-${o}`},[v,O,te,D,o]),he=x.useMemo(()=>({...z?{}:ve,onKeyDown(xe){if(xe.key==="Tab"&&xe.shiftKey&&O&&!v){const Te=cs(xe.nativeEvent);if(Te&&!Qe(Q.current,Te))return;ks(xe),P.setOpen(!1,Fe(ho,xe.nativeEvent)),dn(L)&&L.focus();return}ke(xe)},onPointerMove(xe){BT(xe)||(F.current=!0)}}),[ve,ke,Q,z,P,O,v,L]),ye=x.useMemo(()=>{function xe(Ne){P.setOpen(!0,Fe(iy,Ne.nativeEvent,Ne.currentTarget))}function Te(Ne){w==="auto"&&Gm(Ne.nativeEvent)&&(q.current=!v)}function Oe(Ne){q.current=w,w==="auto"&&Xv(Ne.nativeEvent)&&(q.current=!0)}return{onKeyDown(Ne){const _e=P.select("open");F.current=!1;const Ye=Ne.key.startsWith("Arrow"),kt=xU(Ne.key,re(),y),Ct=gh(Ne.key,k),Rt=(b?kt:Ct)||Ne.key==="Enter"||Ne.key.trim()==="";if(v&&_e)return ke(Ne);if(!(!_e&&!S&&Ye)){if(Rt){const ot=gh(Ne.key,re());Y.current=b&&ot?null:Ne.key}if(b){kt&&(ks(Ne),_e?($.current=de(),G(Ne)):xe(Ne));return}Ct&&(J.current!=null&&($.current=J.current),ks(Ne),!_e&&S?xe(Ne):ke(Ne),_e&&G(Ne))}},onFocus(Ne){P.select("open")&&!v&&($.current=-1,G(Ne))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Te,onClick:Te}},[ke,w,de,b,G,P,S,k,re,y,J,v]),je=x.useMemo(()=>({...ve,...ye}),[ve,ye]);return x.useMemo(()=>d?{reference:je,floating:he,item:Ee,trigger:ye}:{},[d,je,he,ye,Ee])}function UT(e,t){const{listRef:a,elementsRef:o,activeIndex:c,onMatch:d,disabledIndices:f,onTyping:p,enabled:h=!0,resetMs:b=750,selectedIndex:y=null}=t,v="rootStore"in e?e.rootStore:e,w=v.useState("open"),j=Zs(),S=x.useRef(""),N=x.useRef(y??c??-1),k=x.useRef(null),T=Ie(A=>{function R(Q){return o?.current[Q]}function I(Q){const K=R(Q);return K&&!Zm(K)||K?.matches(":disabled")?!1:f==null||!po(Or,Q,f)}function P(Q,K,X=0){if(Q.length===0)return-1;const q=(X%Q.length+Q.length)%Q.length,$=K.toLowerCase();for(let Y=0;Y0&&A.key===" "&&(ks(A),p?.(!0)),S.current.length>0&&S.current[0]!==" "&&P(O,S.current)===-1&&A.key!==" "&&p?.(!1),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;w&&A.key!==" "&&(ks(A),p?.(!0));const _=S.current==="";_&&(N.current=y??c??-1),O.every((Q,K)=>Q&&I(K)?Q[0]?.toLowerCase()!==Q[1]?.toLowerCase():!0)&&S.current===A.key&&(S.current="",N.current=k.current),S.current+=A.key,j.start(b,()=>{S.current="",N.current=k.current,p?.(!1)});const B=((_?y??c??-1:N.current)??0)+1,z=P(O,S.current,B);z!==-1?(d?.(z),k.current=z):A.key!==" "&&(S.current="",p?.(!1))}),D=Ie(A=>{const R=A.relatedTarget,I=v.select("domReferenceElement"),P=v.select("floatingElement");Qe(I,R)||Qe(P,R)||(j.clear(),S.current="",N.current=k.current,p?.(!1))});De(()=>{!w&&y!==null||(j.clear(),k.current=null,S.current!==""&&(S.current=""))},[w,y,j]);const C=x.useMemo(()=>({onKeyDown:T,onBlur:D}),[T,D]);return x.useMemo(()=>h?{reference:C,floating:C}:{},[h,C])}const VT=.1,vU=VT*VT,bn=.5;function xh(e,t,a,o,c,d){return o>=t!=d>=t&&e<=(c-a)*(t-o)/(d-o)+a}function bh(e,t,a,o,c,d,f,p,h,b){let y=!1;return xh(e,t,a,o,c,d)&&(y=!y),xh(e,t,c,d,f,p)&&(y=!y),xh(e,t,f,p,h,b)&&(y=!y),xh(e,t,h,b,a,o)&&(y=!y),y}function yU(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function vh(e,t,a,o,c,d){const f=Math.min(a,c),p=Math.max(a,c),h=Math.min(o,d),b=Math.max(o,d);return e>=f&&e<=p&&t>=h&&t<=b}function FT(e={}){const{blockPointerEvents:t=!1}=e,a=new sa,o=({x:c,y:d,placement:f,elements:p,onClose:h,nodeId:b,tree:y})=>{const v=f?.split("-")[0];let w=!1,j=null,S=null,N=typeof performance<"u"?performance.now():0;function k(D,C){const A=performance.now(),R=A-N;if(j===null||S===null||R===0)return j=D,S=C,N=A,!1;const I=D-j,P=C-S,O=I*I+P*P,_=R*R*vU;return j=D,S=C,N=A,O<_}function T(){a.clear(),h()}return function(C){a.clear();const A=p.domReference,R=p.floating;if(!A||!R||v==null||c==null||d==null)return;const{clientX:I,clientY:P}=C,O=cs(C),_=C.type==="mouseleave",L=Qe(R,O),H=Qe(A,O);if(L&&(w=!0,!_))return;if(H&&(w=!1,!_)){w=!0;return}if(_&&At(C.relatedTarget)&&Qe(R,C.relatedTarget))return;function B(){return!!(y&&io(y.nodesRef.current,b).length>0)}function z(){B()||T()}if(B())return;const Q=A.getBoundingClientRect(),K=R.getBoundingClientRect(),X=c>K.right-K.width/2,q=d>K.bottom-K.height/2,$=K.width>Q.width,Y=K.height>Q.height,F=($?Q:K).left,G=($?Q:K).right,W=(Y?Q:K).top,le=(Y?Q:K).bottom;if(v==="top"&&d>=Q.bottom-1||v==="bottom"&&d<=Q.top+1||v==="left"&&c>=Q.right-1||v==="right"&&c<=Q.left+1){z();return}let M=!1;switch(v){case"top":M=vh(I,P,F,Q.top+1,G,K.bottom-1);break;case"bottom":M=vh(I,P,F,K.top+1,G,Q.bottom-1);break;case"left":M=vh(I,P,K.right-1,le,Q.left+1,W);break;case"right":M=vh(I,P,Q.right-1,le,K.left+1,W);break}if(M)return;if(w&&!yU(I,P,Q)){z();return}if(!_&&k(I,P)){z();return}let U=!1;switch(v){case"top":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d+bn+1,ie=X||$?K.bottom-bn:K.top,ge=X?$?K.bottom-bn:K.top:K.bottom-bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"bottom":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d-bn,ie=X||$?K.top+bn:K.bottom,ge=X?$?K.top+bn:K.bottom:K.top+bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"left":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c+bn+1,ie=q||Y?K.right-bn:K.left,ge=q?Y?K.right-bn:K.left:K.right-bn;U=bh(I,P,ie,K.top,ge,K.bottom,J,ae,J,ce);break}case"right":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c-bn,ie=q||Y?K.left+bn:K.right,ge=q?Y?K.left+bn:K.right:K.left+bn;U=bh(I,P,J,ae,J,ce,ie,K.top,ge,K.bottom);break}}U?w||a.start(40,z):z()}};return o.__options={...e,blockPointerEvents:t},o}const wU={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class jU extends tu{constructor(a,o,c){const d=new fh;super(SU(a,d,o,c),NU(d),wU);ln(this,"setOpen",(a,o)=>{uU(this,a,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(a){this.state.floatingRootContext.dispatchOpenChange(!1,Fe(mo,a))}}function SU(e,t,a,o=!1){return{...Iy(t,a,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function NU(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const kU=sh(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:c,disableHoverablePopup:d=!1,trackCursorAxis:f="none",actionsRef:p,onOpenChange:h,onOpenChangeComplete:b,handle:y,triggerId:v,defaultTriggerId:w=null,children:j}=t,S=Ey((H,B)=>new jU({open:o,openProp:c,activeTriggerId:w,triggerIdProp:v},H,B));S.useControlledProp("openProp",c),S.useControlledProp("triggerIdProp",v),S.useContextCallback("onOpenChange",h),S.useContextCallback("onOpenChangeComplete",b);const N=S.useState("open"),k=!a&&N,T=S.useState("activeTriggerId"),D=S.useState("mounted"),C=S.useState("payload");S.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:d,disabled:a}),Oy(S,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:R}=My(k,S),I=S.useState("isInstantPhase"),P=S.useState("instantType"),O=S.useState("lastOpenChangeReason"),_=x.useRef(null);De(()=>{N&&a&&S.setOpen(!1,Fe(c4))},[N,a,S]),De(()=>{R==="ending"&&O===Yn||R!=="ending"&&I?(P!=="delay"&&(_.current=P),S.set("instantType","delay")):_.current!==null&&(S.set("instantType",_.current),_.current=null)},[R,I,O,P,S]),De(()=>{k&&T==null&&S.set("payload",void 0)},[S,T,k]),x.useImperativeHandle(p,()=>({unmount:A,close:()=>S.setOpen(!1,Fe(cy))}),[A,S]);const L=k||D||!a&&f!=="none";return s.jsxs(z1.Provider,{value:S,children:[y&&s.jsx(Ay,{handle:y,store:S}),L&&s.jsx(CU,{store:S,disabled:a,trackCursorAxis:f}),typeof j=="function"?j({payload:C}):j]})});function CU({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),c=af(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),d=dH(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),f=x.useMemo(()=>Wr(d.reference,c.reference),[d.reference,c.reference]);return Dy(e,{activeTriggerProps:f,inactiveTriggerProps:f,popupProps:c.floating??fn}),null}const $T=x.createContext(void 0);function TU(){return x.useContext($T)}const EU=600,qT="data-base-ui-tooltip-trigger";function GT(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;ok.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ae=mU(A,{enabled:!X}).reference,ce=fe=>{const te=F.current,Ce=GT(fe),re=U(Ce),de=R.current,ke=de&&Ce&&Qe(de,Ce);if(re&&k.select("open")&&k.select("lastOpenChangeReason")===Vs){k.setOpen(!1,Fe(Vs,fe));return}if(te&&!re&&ke&&!q.current&&!k.select("open")&&de&&co(W.current)){const Ee=()=>{!F.current&&!q.current&&!k.select("open")&&k.setOpen(!0,Fe(Vs,fe,de))},ve=le();ve===0?(G.clear(),Ee()):G.start(ve,Ee)}},J=k.useState("triggerProps",O);return yt("button",t,{state:{open:C},ref:[a,P,R],props:[Z,ae,O||$!=="none"?J:void 0,{onMouseOver(fe){ce(fe.nativeEvent)},onFocus(fe){M(GT(fe.nativeEvent))&&fe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,G.clear(),W.current=void 0},onPointerEnter(fe){W.current=fe.pointerType},onPointerDown(fe){W.current=fe.pointerType,k.set("closeOnClick",y),y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},onClick(fe){y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},id:T,[Gv]:X?"":void 0,[qT]:X?void 0:""},j],stateAttributesMapping:Fv})}),KT=x.createContext(void 0);function OU(){const e=x.useContext(KT);if(e===void 0)throw new Error(on(70));return e}const MU=x.forwardRef(function(t,a){const{children:o,container:c,className:d,render:f,style:p,...h}=t,{node:b,subtree:y}=J1({container:c,ref:a,componentProps:t,elementProps:h});return!y&&!b?null:s.jsxs(x.Fragment,{children:[y,b&&Cs.createPortal(o,b)]})}),DU=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return nf().useState("mounted")||o?s.jsx(KT.Provider,{value:o,children:s.jsx(MU,{ref:a,...c})}):null}),YT=x.createContext(void 0);function XT(){const e=x.useContext(YT);if(e===void 0)throw new Error(on(71));return e}const IU=x.createContext(void 0);function cf(){return x.useContext(IU)?.direction??"ltr"}const PU=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:c,rects:d,platform:f,elements:p,middlewareData:h}=t,{element:b,padding:y=0,offsetParent:v="real"}=uo(e,t)||{};if(b==null)return{};const w=i1(y),j={x:a,y:o},S=Wv(c),N=Zv(S),k=await f.getDimensions(b),T=S==="y",D=T?"top":"left",C=T?"bottom":"right",A=T?"clientHeight":"clientWidth",R=d.reference[N]+d.reference[S]-j[S]-d.floating[N],I=j[S]-d.reference[S],P=v==="real"?await f.getOffsetParent?.(b):p.floating;let O=p.floating[A]||d.floating[N];(!O||!await f.isElement?.(P))&&(O=p.floating[A]||d.floating[N]);const _=R/2-I/2,L=O/2-k[N]/2-1,H=Math.min(w[D],L),B=Math.min(w[C],L),z=H,Q=O-k[N]-B,K=O/2-k[N]/2+_,X=a1(z,K,Q),q=!h.arrow&&Sl(c)!=null&&K!==X&&d.reference[N]/2-(K{const{name:a,fn:o}=PU(e);return{name:a,fn:o,options:[e,t]}},LU={name:"hide",async fn(e){const{width:t,height:a,x:o,y:c}=e.rects.reference,d=t===0&&a===0&&o===0&&c===0,f=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:f.top-a>=0||f.right-t>=0||f.bottom-a>=0||f.left-t>=0||d}}}},zU={sideX:"left",sideY:"top"},BU="--available-width",HU="--available-height",UU="--anchor-width",VU="--anchor-height",FU="--transform-origin",QT=BU,ZT=HU;function WT(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function JT(e,t,a){const{rects:o,placement:c}=e;return{side:WT(t,ta(c),a),align:Sl(c)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function yh(e){return $U(e,fU)}function $U(e,t){const{anchor:a,positionMethod:o="absolute",side:c="bottom",sideOffset:d=0,align:f="center",alignOffset:p=0,collisionBoundary:h,collisionPadding:b=5,sticky:y=!1,arrowPadding:v=5,disableAnchorTracking:w=!1,inline:j,keepMounted:S=!1,floatingRootContext:N,mounted:k,collisionAvoidance:T,shift:D,nodeId:C,adaptiveOrigin:A,lazyFlip:R=!1,externalTree:I}=e,[P,O]=x.useState(null);!k&&P!==null&&O(null);const _=T.side||"flip",L=T.align||"flip",H=T.fallbackAxisSide||"end",B=D?.crossAxis??!1,z=D?.rootBoundary,Q=typeof a=="function"?a:void 0,K=Ie(Q),X=Q?K:a,q=Xn(a),$=Xn(k),F=cf()==="rtl",G=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[c],W=f==="center"?G:`${G}-${f}`;let le=b;typeof le=="number"?le={top:le,right:le,bottom:le,left:le}:le&&(le={top:le.top||0,right:le.right||0,bottom:le.bottom||0,left:le.left||0});const M=1,U=c==="bottom"?M:0,Z=c==="top"?M:0,ae=c==="right"?M:0,ce=c==="left"?M:0,J={boundary:h==="clipping-ancestors"?"clippingAncestors":h,padding:le},ie=x.useRef(null),ge=Xn(d),ee=Xn(p),fe=typeof d!="function"?d:0,te=typeof p!="function"?p:0,Ce=[];j&&Ce.push(j),Ce.push(KH(nt=>{const Ot=JT(nt,c,F),Ft=typeof ge.current=="function"?ge.current(Ot):ge.current,Zn=typeof ee.current=="function"?ee.current(Ot):ee.current;return{mainAxis:Ft,crossAxis:Zn,alignmentAxis:Zn}},[fe,te,F,c]));const re=L==="none"&&_!=="shift",de=!re&&(y||B||_==="shift"),ke=_==="none"?null:QH({...J,padding:{top:le.top+M+U,right:le.right+M+ce,bottom:le.bottom+M+Z,left:le.left+M+ae},mainAxis:!B&&_==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Ee=re?null:YH({...J,rootBoundary:z,mainAxis:L!=="none",crossAxis:de,limiter:y||B?void 0:XH(nt=>{if(!ie.current)return{};const{width:Ot,height:Ft}=ie.current.getBoundingClientRect(),Zn=na(ta(nt.placement)),Un=Zn==="y"?Ot:Ft,Vn=Zn==="y"?le.left+le.right:le.top+le.bottom;return{offset:Un/2+Vn/2}})},[J,y,B,z,le,L]);_==="shift"||L==="shift"||f==="center"?Ce.push(Ee,ke):Ce.push(ke,Ee),Ce.push(ZH({...J,apply({elements:{floating:nt},availableWidth:Ot,availableHeight:Ft,rects:Zn}){if(!$.current)return;const Un=nt.style;Un.setProperty(QT,`${Ot}px`),Un.setProperty(ZT,`${Ft}px`);const Vn=Sn(nt).devicePixelRatio||1,{x:Rn,y:Jt,width:ls,height:Tt}=Zn.reference,xt=(Math.round((Rn+ls)*Vn)-Math.round(Rn*Vn))/Vn,wt=(Math.round((Jt+Tt)*Vn)-Math.round(Jt*Vn))/Vn;Un.setProperty(UU,`${xt}px`),Un.setProperty(VU,`${wt}px`)}}),_U(nt=>({element:ie.current||$t(nt.elements.floating).createElement("div"),padding:ie.current?v:0,offsetParent:"floating"}),[v]),{name:"transformOrigin",fn(nt){const{elements:{floating:Ot},middlewareData:Ft,placement:Zn,platform:Un,rects:Vn,y:Rn}=nt,Jt=ta(Zn),ls=Sl(Zn),Tt=na(Jt)==="y",xt=ie.current,wt=typeof d=="function"?d(JT(nt,c,F)):d;let jt;if(!xt&&ls&&Math.abs(Tt?Ft.shift?.x||0:Ft.shift?.y||0)<=1)jt=ls==="start"===(Tt&&Un.isRTL?.(Ot)===!0)?"100%":"0%";else{const rr=Tt?Ft.arrow?.x||0:Ft.arrow?.y||0,Hr=Tt?xt?.clientWidth||0:xt?.clientHeight||0;jt=`${rr+Hr/2}px`}let Nr=Jt==="top"||Jt==="left"?`calc(100% + ${wt}px)`:`${-wt}px`;return de&&Tt&&Math.abs(Ft.shift?.y||0)>wt&&(Nr=`${Vn.reference.y+Vn.reference.height/2-Rn}px`),Ot.style.setProperty(FU,Tt?`${jt} ${Nr}`:`${Nr} ${jt}`),{}}},LU,A),De(()=>{!k&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,N]);const ve=x.useMemo(()=>({ancestorScroll:!w,elementResize:!w&&typeof ResizeObserver<"u",layoutShift:!w&&typeof IntersectionObserver<"u"}),[w]),{refs:he,elements:ye,x:je,y:xe,middlewareData:Te,update:Oe,placement:Ne,context:_e,isPositioned:Ye,floatingStyles:kt}=t({rootContext:N,open:S?k:void 0,placement:W,middleware:Ce,strategy:o,whileElementsMounted:S?void 0:(...nt)=>bT(...nt,ve),nodeId:C,externalTree:I}),{sideX:Ct,sideY:Rt}=Te.adaptiveOrigin||zU,ot=Ye?o:"fixed",qn=x.useMemo(()=>{let nt;return Ye?A?nt={position:ot,[Ct]:je,[Rt]:xe}:nt={...kt,position:ot}:nt={position:ot,top:0,left:0},nt[QT]="100vw",nt[ZT]="100vh",Ye||(nt.opacity=0),nt},[A,ot,Ct,je,Rt,xe,kt,Ye]),fs=x.useRef(null);De(()=>{if(!k)return;const nt=q.current,Ot=typeof nt=="function"?nt():nt,Zn=(eE(Ot)?Ot.current:Ot)||null||null;Zn!==fs.current&&(he.setPositionReference(Zn),fs.current=Zn)},[k,he,X,q]),x.useEffect(()=>{if(!k)return;const nt=q.current;typeof nt!="function"&&eE(nt)&&nt.current!==fs.current&&(he.setPositionReference(nt.current),fs.current=nt.current)},[k,he,X,q]),x.useEffect(()=>{if(S&&k&&ye.reference&&ye.floating)return bT(ye.reference,ye.floating,Oe,ve)},[S,k,ye,Oe,ve]);const Gn=ta(Ne),bs=WT(c,Gn,F),it=Sl(Ne)||"center",Vt=!!Te.hide?.referenceHidden;De(()=>{R&&k&&Ye&&Gn!==G&&O(Gn)},[R,k,Ye,Gn,G]);const Hn=x.useMemo(()=>({position:"absolute",top:Te.arrow?.y,left:Te.arrow?.x}),[Te.arrow]),tn=Te.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:qn,arrowStyles:Hn,arrowRef:ie,arrowUncentered:tn,side:bs,align:it,physicalSide:Gn,anchorHidden:Vt,refs:he,context:_e,isPositioned:Ye,update:Oe}),[qn,Hn,ie,tn,bs,it,Gn,Vt,he,_e,Ye,Oe])}function eE(e){return e!=null&&"current"in e}function uf(e){return e==="starting"?tH:fn}function wh(e,t,{styles:a,transitionStatus:o,props:c,refs:d,hidden:f,inert:p=!1}){const h={...a};return p&&(h.pointerEvents="none"),yt("div",e,{state:t,ref:d,props:[{role:"presentation",hidden:f,style:h},uf(o),c],stateAttributesMapping:$c})}const qU=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f="absolute",side:p="top",align:h="center",sideOffset:b=0,alignOffset:y=0,collisionBoundary:v="clipping-ancestors",collisionPadding:w=5,arrowPadding:j=5,sticky:S=!1,disableAnchorTracking:N=!1,collisionAvoidance:k=Q1,style:T,...D}=t,C=nf(),A=OU(),R=C.useState("open"),I=C.useState("mounted"),P=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),_=C.useState("floatingRootContext"),L=C.useState("instantType"),H=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),z=yh({anchor:d,positionMethod:f,floatingRootContext:_,mounted:I,side:p,sideOffset:b,align:h,alignOffset:y,collisionBoundary:v,collisionPadding:w,sticky:S,arrowPadding:j,disableAnchorTracking:N,keepMounted:A,collisionAvoidance:k,adaptiveOrigin:B}),Q=x.useMemo(()=>({open:R,side:z.side,align:z.align,anchorHidden:z.anchorHidden,instant:P!=="none"?"tracking-cursor":L}),[R,z.side,z.align,z.anchorHidden,P,L]),K=wh(t,Q,{styles:z.positionerStyles,transitionStatus:H,props:D,refs:[a,C.useStateSetter("positionerElement")],hidden:!I,inert:!R||P==="both"||O});return s.jsx(YT.Provider,{value:z,children:K})}),GU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{side:h,align:b}=XT(),y=p.useState("open"),v=p.useState("instantType"),w=p.useState("transitionStatus"),j=p.useState("popupProps"),S=p.useState("floatingRootContext"),N=p.useState("disabled"),k=p.useState("closeDelay");ra({open:y,ref:p.context.popupRef,onComplete(){y&&p.context.onOpenChangeComplete?.(!0)}}),LT(S,{enabled:!N,closeDelay:k});const T=p.useStateSetter("popupElement");return yt("div",t,{state:{open:y,side:h,align:b,instant:v,transitionStatus:w},ref:[a,p.context.popupRef,T],props:[lf,j,uf(w),f],stateAttributesMapping:qv})}),KU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{arrowRef:h,side:b,align:y,arrowUncentered:v,arrowStyles:w}=XT(),j=p.useState("open"),S=p.useState("instantType");return yt("div",t,{state:{open:j,side:b,align:y,uncentered:v,instant:S},ref:[a,h],props:[{style:w,"aria-hidden":!0},f],stateAttributesMapping:$c})}),YU=function(t){const{delay:a,closeDelay:o,timeout:c=400}=t,d=x.useMemo(()=>({open:a,close:o}),[a,o]);return s.jsx($T.Provider,{value:a,children:s.jsx(X4,{delay:d,timeoutMs:c,children:t.children})})};function jh(e){return Iv(19)?e:e?"true":void 0}function XU(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function QU(e){return s.jsx(YU,{"data-slot":"tooltip-provider",...e})}function Ii(e){return s.jsx(kU,{"data-slot":"tooltip",...e})}function Pi(e){return s.jsx(RU,{"data-slot":"tooltip-trigger",...e})}function _i({className:e,sideOffset:t=8,side:a="top",children:o,...c}){return s.jsx(DU,{children:s.jsx(qU,{sideOffset:t,side:a,className:"z-[35]",children:s.jsx(GU,{"data-slot":"tooltip-content",className:Ue("max-w-[288px] rounded-md bg-primary px-2.5 py-2 text-[11.5px] leading-[1.55] text-primary-on shadow-3","break-words outline-none","transition-[opacity,transform] duration-150 ease-out","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:o})})})}function ZU({className:e,...t}){return s.jsx(KU,{className:Ue("size-2 rotate-45 rounded-[1px] bg-primary","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1",e),...t})}const tE=x.createContext(void 0);function nu(e){const t=x.useContext(tE);if(!e&&t===void 0)throw new Error(on(27));return t}const nE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,forceRender:f=!1,...p}=t,h=nu(),b=h.useState("open"),y=h.useState("nested"),v=h.useState("mounted"),w=h.useState("transitionStatus");return yt("div",t,{state:{open:b,transitionStatus:w},ref:[h.context.backdropRef,a],stateAttributesMapping:qv,props:[{role:"presentation",hidden:!v,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:f||!y})}),sE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,...h}=t,b=nu(),y=b.useState("open"),{getButtonProps:v,buttonRef:w}=Jr({disabled:f,native:p}),j={disabled:f};function S(N){y&&b.setOpen(!1,Fe(oy,N.nativeEvent))}return yt("button",t,{state:j,ref:[a,w],props:[{onClick:S},h,v]})}),rE=x.createContext(void 0);function WU(){const e=x.useContext(rE);if(e===void 0)throw new Error(on(26));return e}const Uy="ArrowUp",Vy="ArrowDown",Fy="ArrowLeft",$y="ArrowRight",qy="Home",Gy="End",Sh=new Set([Uy,Vy,Fy,$y,qy,Gy]),aE="Shift",JU=[aE,"Control","Alt","Meta"];function eV(e){return dn(e)&&e.tagName==="INPUT"}function lE(e){return!!(eV(e)&&e.selectionStart!=null||dn(e)&&e.tagName==="TEXTAREA")}function oE(e,t,a,o){if(!e||!t||!t.scrollTo)return;let c=e.scrollLeft,d=e.scrollTop;const f=e.clientWidthe.scrollLeft+e.clientWidth-b.scrollPaddingRight?c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight:h-y.scrollMarginLefte.scrollLeft+e.clientWidth-b.scrollPaddingRight&&(c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight))}if(p&&o!=="horizontal"){const h=iE(e,t,"top"),b=Nh(e),y=Nh(t);h-y.scrollMarginTope.scrollTop+e.clientHeight-b.scrollPaddingBottom&&(d=h+t.offsetHeight+y.scrollMarginBottom-e.clientHeight+b.scrollPaddingBottom)}e.scrollTo({left:c,top:d,behavior:"auto"})}function iE(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let c=0;for(;t.offsetParent&&(c+=t[o],t.offsetParent!==e);)t=t.offsetParent;return c}function Nh(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const tV="--nested-dialogs",nV="data-nested-dialog-open",sV={...$c,...oo,nestedDialogOpen(e){return e?{[nV]:""}:null}},cE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,initialFocus:p,...h}=t,b=nu(),y=b.useState("descriptionElementId"),v=b.useState("disablePointerDismissal"),w=b.useState("floatingRootContext"),j=b.useState("popupProps"),S=b.useState("modal"),N=b.useState("mounted"),k=b.useState("nested"),T=b.useState("nestedOpenDialogCount"),D=b.useState("open"),C=b.useState("openMethod"),A=b.useState("titleElementId"),R=b.useState("transitionStatus"),I=b.useState("role"),P=w.useState("floatingId");WU(),ra({open:D,ref:b.context.popupRef,onComplete(){D&&b.context.onOpenChangeComplete?.(!0)}});const O=p===void 0?TT(b.context.popupRef):p,_=T>0,L=b.useStateSetter("popupElement"),B=yt("div",t,{state:{open:D,nested:k,transitionStatus:R,nestedDialogOpen:_},props:[j,{id:P,"aria-labelledby":A,"aria-describedby":y,role:I,...lf,hidden:!N,onKeyDown(z){Sh.has(z.key)&&z.stopPropagation()},style:{[tV]:T}},h],ref:[a,b.context.popupRef,L],stateAttributesMapping:sV});return s.jsx(oh,{context:w,openInteractionType:C,disabled:!N,closeOnFocusOut:!v,initialFocus:O,returnFocus:f,modal:S!==!1,restoreFocus:"popup",children:B})}),kh=x.forwardRef(function(t,a){const{cutout:o,...c}=t;let d;if(o){const f=o.getBoundingClientRect();d=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${f.left}px ${f.top}px,${f.left}px ${f.bottom}px,${f.right}px ${f.bottom}px,${f.right}px ${f.top}px,${f.left}px ${f.top}px)`}return s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...c,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:d}})}),uE=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=nu(),f=d.useState("mounted"),p=d.useState("modal"),h=d.useState("open");return f||o?s.jsx(rE.Provider,{value:o,children:s.jsxs(lh,{ref:a,...c,children:[f&&p===!0&&s.jsx(kh,{ref:d.context.internalBackdropRef,inert:jh(!h)}),t.children]})}):null});let dE={},fE={},pE="";function Ch(e,t){return Fd(e)?e:t}function mE(e,t,a){return/hidden|clip/.test(e.getComputedStyle(Ch(t,a)).overflowY)}function rV(e){if(typeof document>"u")return!1;const t=$t(e);return Sn(t).innerWidth-t.documentElement.clientWidth>0}function aV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=$t(e),o=a.documentElement,c=a.body,d=Ch(o,c),f=d.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",d.style.overflowY="scroll";const h=d.offsetWidth;d.style.overflowY="hidden";const b=d.offsetWidth;return d.style.overflowY=f,o.style.scrollbarGutter=p,h===b}function lV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Ch(a,o),d={overflowY:c.style.overflowY,overflowX:c.style.overflowX};return Object.assign(c.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(c.style,d)}}function oV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Sn(a);let d=0,f=0,p=!1;const h=qa.create();if(yl&&(c.visualViewport?.scale??1)!==1)return()=>{};function b(){const j=c.getComputedStyle(a),S=c.getComputedStyle(o),T=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";d=a.scrollTop,f=a.scrollLeft,dE={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},pE=a.style.scrollBehavior,fE={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const D=a.scrollHeight>a.clientHeight,C=a.scrollWidth>a.clientWidth,A=j.overflowY==="scroll"||S.overflowY==="scroll",R=j.overflowX==="scroll"||S.overflowX==="scroll",I=Math.max(0,c.innerWidth-o.clientWidth),P=Math.max(0,c.innerHeight-o.clientHeight),O=parseFloat(S.marginTop)+parseFloat(S.marginBottom),_=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Ch(a,o);if(p=aV(e),p){a.style.scrollbarGutter=T,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(D||A)&&(a.style.overflowY="scroll"),(C||R)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:O||P?`calc(100dvh - ${O+P}px)`:"100dvh",width:_||I?`calc(100vw - ${_+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=d,o.scrollLeft=f,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,dE),Object.assign(o.style,fE),p||(a.scrollTop=d,a.scrollLeft=f,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=pE)}function v(){y(),h.request(b)}b();const w=St(c,"resize",v);return()=>{h.cancel(),y(),typeof c.removeEventListener=="function"&&w()}}class iV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",sa.create());ln(this,"timeoutUnlock",sa.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const a=$t(t),o=a.documentElement,c=a.body,d=Sn(o);if(mE(d,o,c)){const p=new d.MutationObserver(()=>{mE(d,o,c)||(p.disconnect(),this.restore=null,this.lock(t))}),h={attributes:!0};p.observe(o,h),p.observe(c,h),this.restore=()=>p.disconnect();return}const f=Yd||!rV(t);this.restore=f?lV(t):oV(t)}}const cV=new iV;function hE(e=!0,t=null){De(()=>{if(e)return cV.acquire(t)},[e,t])}function uV({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[h,b]=x.useState(0),[y,v]=x.useState(0),w=h===0,j=af(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0)return!1;if("touches"in S){if(S.type==="touchend"){if(S.changedTouches.length!==1||S.touches.length!==0)return!1}else if(S.touches.length!==1)return!1}const N=cs(S);if(w&&!c){if(d){const k=e.context.internalBackdropRef.current,T=e.context.backdropRef.current;return k||T?k===N||T===N||Qe(N,f)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:w});return hE(o&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(S,N)=>{b(S),v(N)}),De(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(h+1,y+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[a,o,h,y,t]),Dy(e,{activeTriggerProps:j.reference,inactiveTriggerProps:j.trigger,popupProps:j.floating,nestedOpenDialogCount:h,nestedOpenDrawerCount:y}),null}const dV={..._y,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class fV extends tu{constructor(a,o,c){const d=new fh,f=pV(a,d,o,c);super(f,mV(d),dV);ln(this,"setOpen",(a,o)=>{o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(a,o),this.update(Ry(this.state,a,o.trigger)))})}}function pV(e,t,a,o=!1){return{...Iy(t,a,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function mV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gE(e,t){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,disablePointerDismissal:p=!1,modal:h=!0,actionsRef:b,handle:y,triggerId:v,defaultTriggerId:w=null}=t,j=e==="drawer",S=e==="alert-dialog",N=S?!0:h,k=S||p,T=S?"alertdialog":"dialog",D=nu(!0),C=D!=null,A={modal:N,disablePointerDismissal:k,nested:C,role:T},R=Ey((H,B)=>new fV({open:c,openProp:o,activeTriggerId:w,triggerIdProp:v,...A},H,B),!0);R.useControlledProp("openProp",o),R.useControlledProp("triggerIdProp",v),R.useSyncedValues(A),R.useContextCallback("onOpenChange",d),R.useContextCallback("onOpenChangeComplete",f);const I=R.useState("open"),P=R.useState("mounted"),O=R.useState("payload");OT(R,I),Oy(R);const{forceUnmount:_}=My(I,R);x.useImperativeHandle(b,()=>({unmount:_,close:()=>R.setOpen(!1,Fe(cy))}),[_,R]);const L=I||P;return s.jsxs(tE.Provider,{value:R,children:[y&&s.jsx(Ay,{handle:y,store:R}),L&&s.jsx(uV,{store:R,parentContext:D?.context,isDrawer:j}),typeof a=="function"?a({payload:O}):a]})}const hV=sh(function(t){return gE("dialog",t)}),xE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,id:f,...p}=t,h=nu(),b=Na(f);return h.useSyncedValueWithCleanup("titleElementId",b),yt("h2",t,{ref:a,props:[{id:b},p]})});function gV(e){const t=x.useRef(""),a=x.useCallback(c=>{c.defaultPrevented||(t.current=c.pointerType,e(c,c.pointerType))},[e]);return{onClick:x.useCallback(c=>{if(c.detail===0){e(c,"keyboard");return}"pointerType"in c?e(c,c.pointerType):e(c,t.current),t.current=""},[e]),onPointerDown:a}}function bE(e,t){const a=Ie((d,f)=>{(typeof e=="function"?e():e)||t(f||(Yd?"touch":""))}),{onClick:o,onPointerDown:c}=gV(a);return x.useMemo(()=>({onClick:o,onPointerDown:c}),[o,c])}function vE(e){const[t,a]=x.useState(null),o=bE(e,a);return aa(e,c=>{c&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Qt(e){return s.jsx(hV,{"data-slot":"dialog",...e})}function xV(e){return s.jsx(uE,{"data-slot":"dialog-portal",...e})}const Gt=e=>s.jsx(xE,{"data-slot":"dialog-title",...e});function bV({className:e,...t}){return s.jsx(nE,{"data-slot":"dialog-overlay",className:Ue("fixed inset-0 isolate z-30 bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function Zt({className:e,children:t,showCloseButton:a=!0,keepMounted:o=!1,overlayForceRender:c=!1,...d}){return s.jsxs(xV,{keepMounted:o,children:[s.jsx(bV,{forceRender:c}),s.jsxs(cE,{"data-slot":"dialog-content",className:Ue("fixed top-1/2 left-1/2 z-30 flex max-h-[calc(100vh-48px)] w-[min(620px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...d,children:[t,a&&s.jsxs(sE,{"data-slot":"dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function Kt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px] pr-10","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function Bt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function zn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-section",className:Ue("flex flex-col gap-2.5 rounded-md border border-border bg-surface-inset p-3.5","[&_h3]:text-[12.5px] [&_h3]:font-semibold","[&_p]:text-xs [&_p]:leading-[1.65] [&_p]:text-subtle",e),...t})}function vV(e){return gE("alert-dialog",e)}const yV=vV,wV=uE,jV=e=>s.jsx(xE,{"data-slot":"alert-dialog-title",...e});function SV({className:e,...t}){return s.jsx(nE,{"data-slot":"alert-dialog-overlay",className:Ue("fixed inset-0 isolate z-[38] bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function NV({className:e,children:t,showCloseButton:a=!1,...o}){return s.jsxs(wV,{children:[s.jsx(SV,{}),s.jsxs(cE,{"data-slot":"alert-dialog-content",className:Ue("fixed top-1/2 left-1/2 z-[38] flex max-h-[calc(100vh-48px)] w-[min(440px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...o,children:[t,a&&s.jsxs(sE,{"data-slot":"alert-dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function kV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px]","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function CV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function TV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function EV({className:e,tone:t="danger",...a}){return s.jsx("div",{"data-slot":"alert-dialog-banner","data-tone":t,className:Ue("rounded-md border px-3.5 py-3 text-xs leading-[1.65] text-subtle","[&_strong]:font-semibold",t==="danger"?"border-destructive-bd bg-destructive-soft [&_strong]:text-destructive":"border-border bg-surface-inset [&_strong]:text-foreground",e),...a})}function Ky({className:e,containerClassName:t,...a}){return s.jsx("div",{"data-slot":"table-container",className:Ue("relative w-full overflow-auto",t),children:s.jsx("table",{"data-slot":"table",className:Ue("w-full caption-bottom border-collapse text-[12.5px]",e),...a})})}function yE({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:Ue(e),...t})}function Yy({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:Ue(e),...t})}function kl({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:Ue("transition-colors duration-100 hover:[&>td]:bg-control-hover",e),...t})}function wE({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:Ue("sticky top-0 z-[2] whitespace-nowrap border-b border-border bg-surface-2 px-3.5 py-2","text-left text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground",e),...t})}function Nn({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:Ue("border-b border-hairline px-3.5 py-2 align-middle",e),...t})}const AV="data-checked",RV="data-unchecked",Xy={checked(e){return e?{[AV]:""}:{[RV]:""}},...oo,...wi},Qy="data-composite-item-active",jE=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function OV(){return x.useContext(jE)}function Zy(e={}){const{guess:t,label:a,metadata:o,textRef:c,index:d}=e,{register:f,unregister:p,subscribeMapChange:h,nextIndexRef:b}=OV(),y=x.useRef(-1),[v,w]=x.useState(d==null&&t?()=>{if(y.current===-1){const k=b.current;b.current+=1,y.current=k}return y.current}:-1),j=d??v,S=x.useRef(null),N=x.useCallback(k=>{const T=S.current;T&&p(T),S.current=k,k&&f(k,{metadata:o??null,index:d??null,label:a,textRef:c})},[d,f,p,o,a,c]);return De(()=>{if(d==null)return h(k=>{const T=S.current?k.get(S.current)?.index:null;T!=null&&w(T)})},[d,h]),{ref:N,index:j}}function MV(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=vC(),{ref:c,index:d}=Zy(e),f=a===d,p=x.useRef(null),h=ea(c,p);return{compositeProps:{tabIndex:f?0:-1,onFocus(){o(d)},onMouseMove(){const y=p.current;if(!t||!y)return;const v=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!v&&y.focus()}},compositeRef:h,index:d}}function SE(e){const{render:t,className:a,style:o,state:c=fn,props:d=Or,refs:f=Or,metadata:p,stateAttributesMapping:h,tag:b="div",...y}=e,{compositeProps:v,compositeRef:w}=MV({metadata:p});return yt(b,e,{state:c,ref:[w,...f],props:[v,...d,y],stateAttributesMapping:h})}const NE=x.createContext(void 0);function DV(){return x.useContext(NE)}function Th(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const kE=x.createContext(void 0);function IV(){const e=x.useContext(kE);if(e===void 0)throw new Error(on(52));return e}const CE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,readOnly:f=!1,required:p=!1,"aria-labelledby":h,value:b,inputRef:y,nativeButton:v=!1,id:w,style:j,...S}=t,N=DV(),{disabled:k,readOnly:T,required:D,form:C,checkedValue:A,touched:R=!1,validation:I,name:P,setCheckedValue:O=qt,setTouched:_=qt,registerInputRef:L=qt}=N??{},{setTouched:H,setFilled:B,state:z,disabled:Q}=Sa(),K=y1(),{labelId:X,getDescriptionProps:q}=vl(),$=Q||K.disabled||k||d,Y=T||f,F=D||p,G=C,W=N?A===b:b==="",le=x.useRef(null),M=x.useRef(null),U=I?.registerInput,Z=x.useCallback(ye=>U?.(ye,{controlRef:le,value:void 0}),[U]),ae=ea(y,M,L,Z);De(()=>{M.current?.checked&&B(!0)},[B]),De(()=>{if(M.current){if($&&W){L(null);return}L(M.current)}},[W,$,L]);const ce=Na(),J=lo({id:w}),ie=v?void 0:J,ge=Bv(h,X,M,!v,ie),ee={role:"radio","aria-checked":W,"aria-labelledby":ge,[Qy]:W?"":void 0,id:v?J:ce,onKeyDown(ye){ye.key==="Enter"&&ye.preventDefault()},onClick(ye){if(ye.defaultPrevented||$||Y)return;ye.preventDefault();const je=M.current;je&&Uc(je,ye)},onFocus(ye){ye.defaultPrevented||$||Y||!R||(M.current?.click(),_(!1))}},{getButtonProps:fe,buttonRef:te}=Jr({disabled:$,native:v,composite:!1}),Ce={type:"radio",ref:ae,form:G,id:ie,name:P,tabIndex:-1,style:P?Zc:Ai,"aria-hidden":!0,...b!==void 0?{value:Th(b)}:fn,disabled:$,checked:W,required:F,readOnly:Y,onChange(ye){if(ye.nativeEvent.defaultPrevented||$||Y||b===void 0)return;const je=Fe(Yn,ye.nativeEvent);O(b,je),!je.isCanceled&&H(!0)},onClick(ye){ye.stopPropagation()},onFocus(){le.current?.focus()}},re=x.useMemo(()=>({...z,required:F,disabled:$,readOnly:Y,checked:W}),[z,$,Y,W,F]),de=re,ke=N!==void 0,Ee=[a,le,te],ve=[ee,S,fe,q,I?ye=>I.getValidationProps($,ye):fn],he=yt("span",t,{enabled:!ke,state:re,ref:Ee,props:ve,stateAttributesMapping:Xy});return s.jsxs(kE.Provider,{value:de,children:[ke?s.jsx(SE,{tag:"span",render:o,className:c,style:j,state:re,refs:Ee,props:ve,stateAttributesMapping:Xy}):he,s.jsx("input",{...Ce,suppressHydrationWarning:!0})]})}),PV=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=IV(),b=h.checked,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j={...h,transitionStatus:v},S=x.useRef(null),N=f||y,k=yt("span",t,{ref:[a,S],state:j,props:p,stateAttributesMapping:Xy});return ra({batch:!0,enabled:!b,open:b,ref:S,onComplete(){b||w(!1)}}),N?k:null});function Wy(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:c}=e,d=Ie(c),[,f]=x.useState(!1),p=Ds(LV).current,h=Ds(_V).current,b=x.useRef(0),y=x.useRef(!0),v=x.useRef(null),w=x.useRef(null),j=Ie(()=>{y.current||(y.current=!0,f(R=>!R))}),S=Ie((R,I)=>{h.set(R,I),j()}),N=Ie(R=>{h.delete(R),j()}),k=Ie(R=>{const I=new Map;return a.current.length=0,o&&(o.current.length=0),R.forEach(P=>{I.set(P.element,{...P.registration.metadata??{},index:P.index}),a.current[P.index]=P.element,o&&(o.current[P.index]=P.registration.label!==void 0?P.registration.label:P.registration.textRef?.current?.textContent??P.element.textContent)}),b.current=a.current.length,I});function T(R){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!="function"||R.length<2)return;const I=new MutationObserver(O=>{if(!HV(O))return;let _=null;for(const L of R)if(L.isConnected){if(_&&TE(_,L)>0){I.disconnect(),j();return}_=L}});w.current=I;const P=new Set;for(let O=1;OI.observe(O,{childList:!0}))}const D=Ie(()=>{const[R,I]=zV(h),P=k(R),O=v.current,_=!O||O.length!==R.length||R.some((L,H)=>{const B=O[H];return L.index!==B.index||L.element!==B.element||L.registration.index!==B.registration.index||L.registration.metadata!==B.registration.metadata});T(I),v.current=R,y.current=!1,_&&(p.forEach(L=>L(P)),d(P))});De(()=>(!y.current&&v.current&&k(v.current),()=>{a.current=[],o&&(o.current=[])}),[a,o,k]),De(()=>{y.current&&D()}),De(()=>()=>{w.current?.disconnect(),y.current=!0},[]);const C=Ie(R=>(p.add(R),()=>{p.delete(R)})),A=x.useMemo(()=>({register:S,unregister:N,subscribeMapChange:C,nextIndexRef:b}),[S,N,C,b]);return s.jsx(jE.Provider,{value:A,children:t})}function _V(){return new Map}function LV(){return new Set}function zV(e){const t=new Set,a=[],o=[];e.forEach((d,f)=>{if(!f.isConnected)return;const p=d.index,h={index:p??-1,element:f,registration:d};p===null?o.push(h):p>=0&&(t.add(p),a.push(h))});let c=0;return o.sort((d,f)=>TE(d.element,f.element)),o.forEach(d=>{for(;t.has(c);)c+=1;d.index=c,a.push(d),c+=1}),t.size>0&&a.sort((d,f)=>d.index-f.index),[a,o.map(d=>d.element)]}function BV(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function HV(e){for(const t of e)for(let a=0;a{if(A.current=D.current[H]??null,(p??S)(H),B){const z=D.current[H];oE(k.current,z,d,a)}}),P=Ie(H=>{if(H.size===0)return;if(C.current){const K=D.current,X=K.indexOf(A.current);if(X===-1){const q=K[R];!q||po(K,R,v)?I(VV(K,v)):A.current=q}else X!==R&&I(X);return}C.current=!0;const B=Array.from(H.keys()),z=B.find(K=>K?.hasAttribute(Qy))??null,Q=z?H.get(z)?.index??-1:-1;if(Q!==-1)I(Q);else if(po(B,R,v)){const K=Is(B,{disabledIndices:v});fo(B,K)||I(K)}oE(k.current,z,d,a)});De(()=>{if(v==null||f!=null||!C.current)return;const H=D.current;if(po(H,R,v)){const B=Is(H,{disabledIndices:v});fo(H,B)||I(B)}},[v,f,R,D,I]);const O=Ie((H,B,z)=>c?c(H,B,z,D):z),_=Ie(H=>{const B=H.key===qy||H.key===Gy;if(!Sh.has(H.key)||!b&&B||FV(H,w)||!k.current)return;const Q=d==="rtl",K=Q?Fy:$y,X=Q?$y:Fy,q=a==="vertical"?Vy:K,$=a==="vertical"?Uy:X,Y=cs(H.nativeEvent);if(Y!=null&&lE(Y)&&!EE(Y)){const U=Y.selectionStart,Z=Y.selectionEnd,ae=Y.value;if(U==null||H.shiftKey||U!==Z||H.key!==$&&U0)return}let F=R;const G=Qm(D,v),W=ey(D,v);o!=null&&(F=o({disabledIndices:v,elementsRef:D,event:H,highlightedIndex:R,loopFocus:t,maxIndex:W,minIndex:G,onLoop:O,orientation:a,rtl:Q}));const le=a!=="vertical"&&H.key===K||a!=="horizontal"&&H.key===Vy,M=a!=="vertical"&&H.key===X||a!=="horizontal"&&H.key===Uy;b&&(H.key===qy?F=G:H.key===Gy&&(F=W)),F===R&&(le||M)&&(t&&F===W&&le?(F=G,c&&(F=c(H,R,F,D))):t&&F===G&&M?(F=W,c&&(F=c(H,R,F,D))):F=Is(D.current,{startingIndex:F,decrement:M,disabledIndices:v})),F!==R&&!fo(D.current,F)&&(y&&H.stopPropagation(),(N||B||le||M)&&H.preventDefault(),I(F,!0),queueMicrotask(()=>{D.current[F]?.focus()}))});return{props:{ref:T,onFocus(H){const B=k.current,z=cs(H.nativeEvent);!B||z==null||!lE(z)||z.setSelectionRange(0,z.value.length)},onKeyDown:_},highlightedIndex:R,onHighlightedIndexChange:I,elementsRef:D,onMapChange:P,relayKeyboardEvent:_}}function VV(e,t){let a=-1;for(let o=0;o({highlightedIndex:_,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:z}),[_,L,A,z]);return s.jsx(bC.Provider,{value:K,children:s.jsx(Wy,{elementsRef:H,onMapChange:X=>{N?.(X),B(X)},children:Q})})}const qV=[aE],AE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d,readOnly:f,required:p,onValueChange:h,value:b,defaultValue:y,form:v,name:w,inputRef:j,id:S,style:N,...k}=t,{setTouched:T,setFocused:D,validationMode:C,name:A,disabled:R,state:I,validation:P,setDirty:O,setFilled:_,validityData:L}=Sa(),{labelId:H}=vl(),{clearErrors:B,elementRef:z}=Fc(),Q=uB(!0),K=R||d,X=A??w,q=Na(S),[$,Y]=Ga({controlled:b,default:y,name:"RadioGroup",state:"value"}),[F,G]=x.useState(!1),W=Ie((te,Ce)=>{h?.(te,Ce),!Ce.isCanceled&&Y(te)}),le=P.getInputControl,M=x.useMemo(()=>({get current(){return le()}}),[le]),U=x.useRef(null),Z=x.useRef(null);function ae(te){let Ce;return j&&(typeof j=="function"?Ce=j(te):j.current=te),U.current=te,Ce}const ce=Ie(te=>{if(!te||te.disabled)return;Z.current||(Z.current=te);const Ce=U.current,re=te.checked||Ce==null||Ce.disabled?ae(te):void 0;return()=>{Z.current===te&&(Z.current=null),U.current===te?re?(re(),U.current=null):ae(null):re?.()}}),J=Ie(()=>{const te=z.current;if(!te)return $??null;for(const Ce of P.registeredInputs.keys())if(Ce.checked&&s4(Ce,te))return $??null;return null});Yc(M,q,$??null,J,!K,w),aa($,()=>{B(X),O($!==L.initialValue),_($!=null),P.change($);const te=Z.current;$==null&&te&&!te.disabled&&ae(te)});const ie=H??Q?.legendId,ge={...I,disabled:K??!1,required:p??!1,readOnly:f??!1},ee=x.useMemo(()=>({checkedValue:$,disabled:K,form:v,validation:P,name:X,readOnly:f,registerInputRef:ce,required:p,setCheckedValue:W,setTouched:G,touched:F}),[$,K,v,P,X,f,ce,p,W,G,F]),fe={id:S,role:"radiogroup","aria-required":p||void 0,"aria-disabled":K||void 0,"aria-readonly":f||void 0,"aria-labelledby":ie,onFocus(){D(!0)},onBlur(te){Qe(te.currentTarget,te.relatedTarget)||(T(!0),D(!1),C==="onBlur"&&P.commit($))},onKeyDownCapture(te){te.key.startsWith("Arrow")&&(G(!0),D(!0))}};return s.jsx(NE.Provider,{value:ee,children:s.jsx($V,{render:o,className:c,style:N,state:ge,props:[fe,k,te=>P.getValidationProps(K??!1,te)],refs:[a],stateAttributesMapping:wi,enableHomeAndEndKeys:!1,modifierKeys:qV})})});function Eh({className:e,...t}){return s.jsx(AE,{"data-slot":"radio-group",className:Ue("flex flex-col gap-2",e),...t})}function bo({className:e,...t}){return s.jsx(CE,{"data-slot":"radio-group-item",className:Ue("relative inline-flex size-3.5 flex-none cursor-pointer items-center justify-center rounded-full border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(PV,{"data-slot":"radio-group-indicator",className:"grid place-content-center data-unchecked:hidden",children:s.jsx("span",{className:"block size-[5px] rounded-full bg-primary-foreground"})})})}function RE(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const OE=x.createContext(void 0),ME=x.createContext(void 0),DE=x.createContext(void 0);function vo(){const e=x.useContext(OE);if(e===void 0)throw new Error(on(60));return e}function Jy(){const e=x.useContext(ME);if(e===void 0)throw new Error(on(101));return e}function IE(){const e=x.useContext(DE);if(e===void 0)throw new Error(on(61));return e}function GV(e,t,a=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let c=0;cObject.is(e,t);function la(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function PE(e,t,a){return Array.isArray(e)&&Array.isArray(t)?!GV(e,t,(o,c)=>la(o,c,a)):e!==t}function Rh(e,t,a){return e?e.some(o=>o===void 0?!1:la(t,o,a)):!1}function su(e,t,a){return e?e.findIndex(o=>o===void 0?!1:la(o,t,a)):-1}function KV(e,t){if(t!==Ah)return o=>Rh(e,o,t);const a=new Set(e);return a.delete(void 0),o=>a.has(o)&&(o!==0||e.some(c=>Object.is(o,c)))}function df(e,t,a,o){const c=o&&Array.isArray(t)?e.findIndex(KV(t,a)):su(e,t,a);return c===-1?null:c}function _E(e,t,a,o,c,d){return Rh(o,t,c)?d!=null&&e>d&&Rh(o,a[d],c)?d:e:e===d?df(a,o,c,!0):d}function LE(e,t,a){return e.filter(o=>!la(t,o,a))}function YV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function ew(e){return YV(e?.[0])}function Oh(e){return ew(e)?e.flatMap(t=>t.items):e}function zE(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(ew(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function yo(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Th(e)}function ka(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Th(e.value):Th(e)}function BE(e,t,a){function o(){return yo(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const d=Oh(t);if(e==null||typeof e!="object"){const f=d.find(p=>p.value===e);return f&&f.label!=null?f.label:o()}if("value"in e){const f=d.find(p=>p&&p.value===e.value);if(f&&f.label!=null)return f.label}}return o()}function XV(e,t,a){return e.reduce((o,c,d)=>(d>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:BE(c,t,a)},d)),o),[])}const QV={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:ka(t,o)!==""},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(c=>la(t,c,a)):la(t,o,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Cl=1;function HE(e,t){return Math.max(0,e-t)}function ZV(e,t){if(t<=0)return 0;const a=Ri(e,0,t),o=a,c=t-a,d=o<=Cl,f=c<=Cl;return d&&f?o<=c?0:t:d?0:f?t:a}function WV(e){const{id:t,value:a,defaultValue:o=null,onValueChange:c,open:d,defaultOpen:f=!1,onOpenChange:p,name:h,form:b,autoComplete:y,disabled:v=!1,readOnly:w=!1,required:j=!1,modal:S=!0,actionsRef:N,inputRef:k,onOpenChangeComplete:T,items:D,multiple:C=!1,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I=Ah,highlightItemOnHover:P=!0,children:O}=e,{clearErrors:_}=Fc(),{setDirty:L,setTouched:H,setFocused:B,validityData:z,setFilled:Q,name:K,disabled:X,validation:q,validationMode:$}=Sa(),Y=lo({id:t}),F=X||v,G=K??h,[W,le]=Ga({controlled:a,default:C?o??Or:o,name:"Select",state:"value"}),[M,U]=Ga({controlled:d,default:f,name:"Select",state:"open"}),Z=x.useRef([]),ae=x.useRef([]),ce=x.useRef(null),J=x.useRef(null),ie=x.useRef(0),ge=x.useRef(null),ee=x.useRef([]),fe=x.useRef(!1),te=x.useRef(null),Ce=x.useRef(null),re=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=x.useRef(!1),ke=x.useRef(W),{mounted:Ee,setMounted:ve,transitionStatus:he}=ki(M),{openMethod:ye,triggerProps:je}=vE(M),xe=Ds(()=>new tu({id:Y,labelId:void 0,modal:S,multiple:C,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,value:W,open:M,mounted:Ee,transitionStatus:he,items:D,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:fn,triggerProps:fn,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qt,setOpen:qt,handleScrollArrowVisibility:qt,onOpenChangeComplete:qt,listRef:Z,popupRef:ce,scrollHandlerRef:J,scrollArrowsMountedCountRef:ie,valueRef:ge,valuesRef:ee,labelsRef:ae,typingRef:fe,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:Ce,alignItemWithTriggerActiveRef:de,initialValueRef:ke},QV)).current,Te=xe.useState("activeIndex"),Oe=xe.useState("selectedIndex"),Ne=xe.useState("triggerElement"),_e=xe.useState("positionerElement"),Ye=XU(ye),kt=ye??Ye,Ct=x.useMemo(()=>C?"":ka(W,R),[C,W,R]),Rt=x.useMemo(()=>C&&Array.isArray(W)?W.map(xt=>ka(xt,R)):ka(W,R),[C,W,R]),ot=Xn(Ne),qn=Ie(()=>Rt);Yc(ot,Y,W,qn,!F,h);const fs=C?Array.isArray(W)&&W.length>0:W!=null&&Ct!=="";De(()=>{Q(fs)},[fs,Q]),De(function(){const wt=df(ee.current,W,I,C);wt===null&&(Ce.current=null),!M&&xe.set("selectedIndex",wt)},[C,M,W,I,xe]),aa(W,()=>{_(G),L(PE(W,z.initialValue,I)),q.change(W)});const Gn=Ie((xt,wt)=>{p?.(xt,wt),!wt.isCanceled&&(U(xt),!xt&&(wt.reason===ho||wt.reason===nh)&&(H(!0),B(!1),$==="onBlur"&&q.commit(W)))}),bs=Ie(()=>{ve(!1),xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),T?.(!1)});ra({enabled:!N,open:M,ref:ce,onComplete(){M||bs()}}),x.useImperativeHandle(N,()=>({unmount:bs}),[bs]);const it=Ie((xt,wt)=>{c?.(xt,wt),!wt.isCanceled&&le(xt)}),Vt=Ie(xt=>{const wt=HE(xt.scrollHeight,xt.clientHeight),jt=ZV(xt.scrollTop,wt),Nr=jt>0,rr=jtEE(Z.current[xt]),onMatch(xt){M?xe.set("activeIndex",xt):it(ee.current[xt],Fe(Yn))},onTyping(xt){fe.current=xt}}),Zn=x.useMemo(()=>Wr(Ft.reference,Ot.reference,nt.reference,tn.reference,je),[tn.reference,Ft.reference,Ot.reference,nt.reference,je]),Un=x.useMemo(()=>Wr(lf,Ft.floating,Ot.floating,nt.floating),[Ft.floating,Ot.floating,nt.floating]),Vn=Ot.item??fn;xe.useContextCallback("setValue",it),xe.useContextCallback("setOpen",Gn),xe.useContextCallback("handleScrollArrowVisibility",Vt),xe.useContextCallback("onOpenChangeComplete",T),RE(()=>{xe.update({popupProps:Un,triggerProps:Zn})}),xe.useSyncedValues({id:Y,modal:S,multiple:C,value:W,open:M,mounted:Ee,transitionStatus:he,popupProps:Un,triggerProps:Zn,items:D,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,openMethod:kt});const Rn=x.useMemo(()=>({disabled:F,readOnly:w,required:j,multiple:C,highlightItemOnHover:P,itemProps:Vn}),[F,w,j,C,P,Vn]),Jt=ea(k,q.inputRef),ls=C?void 0:G,Tt=x.useMemo(()=>!C||!Array.isArray(W)||!G?null:W.map(xt=>{const wt=ka(xt,R);return s.jsx("input",{type:"hidden",form:b,name:G,value:wt,disabled:F},wt)}),[C,W,b,G,R,F]);return s.jsxs(OE.Provider,{value:xe,children:[s.jsx(ME.Provider,{value:Rn,children:s.jsx(DE.Provider,{value:Hn,children:O})}),s.jsx("input",{...q.getValidationProps(F,{onFocus(){xe.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented||F||w)return;const wt=xt.currentTarget.value,jt=Fe(Yn,xt.nativeEvent);function Nr(){if(C)return;const rr=wt.toLowerCase();let Hr=ee.current.findIndex(rl=>ka(rl,R).toLowerCase()===rr||yo(rl,A).toLowerCase()===rr);Hr===-1&&(Hr=ee.current.findIndex((rl,rn)=>{const ic=ae.current[rn];return ic!=null&&ic.toLowerCase()===rr}));const wn=ee.current[Hr];wn!=null&&it(wn,jt)}xe.set("forceMount",!0),queueMicrotask(Nr)}}),id:Y&&ls==null?`${Y}-hidden-input`:void 0,form:b,name:ls,autoComplete:y,value:Ct,disabled:F,required:j&&!(C&&fs),readOnly:w,ref:Jt,style:G?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Tt]})}function UE(e,t){return e??t}const Mh=5;function VE(e,t){const a=JV(t);return e.clientX>=a.left-Mh&&e.clientX<=a.right+Mh&&e.clientY>=a.top-Mh&&e.clientY<=a.bottom+Mh}function JV(e){const t=e.getBoundingClientRect(),a=Sn(e);if(Hv)return t;const o=a.getComputedStyle(e,"::before"),c=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const f=parseFloat(o.width)||0,p=parseFloat(o.height)||0,h=parseFloat(c.width)||0,b=parseFloat(c.height)||0,y=Math.max(t.width,f,h),v=Math.max(t.height,p,b),w=y-t.width,j=v-t.height;return{left:t.left-w/2,right:t.right+w/2,top:t.top-j/2,bottom:t.bottom+j/2}}const e6="data-popup-side",t6=400,n6={...$v,...wi,popupSide:e=>e?{[e6]:e}:null,value:()=>null},s6=x.forwardRef(function(t,a){const{render:o,className:c,id:d,disabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{setTouched:y,setFocused:v,validationMode:w,validation:j,state:S,disabled:N}=Sa(),{labelId:k}=vl(),T=vo(),{readOnly:D,required:C,disabled:A}=Jy(),R=N||A||f,I=T.useState("open"),P=T.useState("mounted"),O=T.useState("value"),_=T.useState("triggerProps"),L=T.useState("positionerElement"),H=T.useState("listElement"),B=T.useState("popupSide"),z=T.useState("id"),Q=T.useState("labelId"),K=T.useState("hasSelectedValue"),X=P&&L?B:null,q=d??z,$=UE(k,Q);lo({id:d});const Y=Xn(L),F=x.useRef(null),{getButtonProps:G,buttonRef:W}=Jr({disabled:R,native:p}),le=T.useStateSetter("triggerElement"),M=Zs(),U=Zs(),Z=Zs();x.useEffect(()=>{if(I)return Z.start(t6,()=>{T.context.selectionRef.current.allowUnselectedMouseUp=!0,T.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Z.clear()};T.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[I,T,U,Z]);const ae=Wr(_,{id:q,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-controls":I?H?.id??qm(L)?.id:void 0,"aria-labelledby":$,"aria-readonly":D||void 0,"aria-required":C||void 0,tabIndex:R?-1:0,onFocus(ie){v(!0),I&&T.context.alignItemWithTriggerActiveRef.current&&T.context.setOpen(!1,Fe(Yn,ie.nativeEvent)),M.start(0,()=>{T.set("forceMount",!0)})},onBlur(ie){Qe(L,ie.relatedTarget)||(y(!0),v(!1),w==="onBlur"&&j.commit(O))},onMouseDown(ie){if(I)return;const ge=$t(ie.currentTarget);function ee(fe){if(!F.current)return;const te=fe.target;Qe(F.current,te)||Qe(Y.current,te)||VE(fe,F.current)||T.context.setOpen(!1,Fe(T1,fe))}U.start(0,()=>{ge.addEventListener("mouseup",ee,{once:!0})})}},b,G),ce=j.getValidationProps(R,ae);ce.role="combobox";const J={...S,open:I,disabled:R,value:O,readOnly:D,popupSide:X,placeholder:!K};return yt("button",t,{ref:[a,F,W,le],state:J,stateAttributesMapping:n6,props:ce})}),r6={value:()=>null},a6=x.forwardRef(function(t,a){const{className:o,render:c,children:d,placeholder:f,style:p,...h}=t,b=vo(),y=b.useState("value"),v=b.useState("items"),w=b.useState("itemToStringLabel"),j=b.useState("hasSelectedValue"),S=!j&&f!=null&&d==null,N=b.useState("hasNullItemLabel",S),k={value:y,placeholder:!j};let T=null;return typeof d=="function"?T=d(y):d!=null?T=d:S&&!N?T=f:Array.isArray(y)?T=XV(y,v,w):T=BE(y,v,w),yt("span",t,{state:k,ref:[a,b.context.valueRef],props:[{children:T},h],stateAttributesMapping:r6})}),l6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,b={open:vo().useState("open")};return yt("span",t,{state:b,ref:a,props:[{"aria-hidden":!0,children:"▼"},f],stateAttributesMapping:Fv})}),o6=x.forwardRef(function(t,a){const o=vo(),c=o.useState("mounted"),d=o.useState("forceMount");return c||d?s.jsx(lh,{ref:a,...t}):null}),FE=x.createContext(void 0);function i6(){const e=x.useContext(FE);if(!e)throw new Error(on(59));return e}function Dh(e,t){e&&Object.assign(e.style,t)}const c6={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},u6=20;function tw(e,t,a,o){const[c,d]=x.useState(!1);De(()=>{if(!e||!t||a==null){d(!1);return}const f=$t(a).documentElement.clientWidth,p=a.offsetWidth;d(f>0&&p>0&&p>=f-u6)},[e,t,a]),hE(e&&(!t||c),o)}const d6={position:"fixed"},f6=x.forwardRef(function(t,a){const{anchor:o,className:c,render:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N,alignItemWithTrigger:k=!0,collisionAvoidance:T=X1,style:D,...C}=t,A=vo(),R=IE(),I=A.useState("open"),P=A.useState("mounted"),O=A.useState("modal"),_=A.useState("value"),L=A.useState("openMethod"),H=A.useState("positionerElement"),B=A.useState("triggerElement"),z=A.useState("isItemEqualToValue"),Q=A.useState("transitionStatus"),K=x.useRef(null),X=x.useRef(null),[q,$]=x.useState(k),Y=P&&q&&L!=="touch";!P&&q!==k&&$(k),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>Y),tw((Y||O)&&I,L==="touch",H,B);const F=yh({anchor:o,floatingRootContext:R,positionMethod:f,mounted:P,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N??Y,collisionAvoidance:T,keepMounted:!0}),G=Y?"none":F.side,W=Y?d6:F.positionerStyles,le={open:I,side:G,align:F.align,anchorHidden:F.anchorHidden};De(()=>{A.set("popupSide",F.side)},[A,F.side]);const M=A.useStateSetter("positionerElement"),U=wh(t,le,{styles:W,transitionStatus:Q,props:C,refs:[a,M],hidden:!P,inert:!I}),Z=x.useRef(0),ae=Ie(J=>{if(A.context.valuesRef.current.length===0)return;const ie=Z.current;Z.current=J.size;const ge=Fe(Yn);if(ie!==0&&!A.state.multiple&&_!==null&&su(A.context.valuesRef.current,_,z)===-1){const fe=A.context.initialValueRef.current,Ce=fe!=null&&su(A.context.valuesRef.current,fe,z)!==-1?fe:null;A.context.setValue(Ce,ge),Ce===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ie!==0&&A.state.multiple&&Array.isArray(_)){const ee=_.filter(fe=>su(A.context.valuesRef.current,fe,z)!==-1);ee.length!==_.length&&(A.context.setValue(ee,ge),ee.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(I&&Y){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ee={height:""};Dh(H,ee),Dh(A.context.popupRef.current,ee)}}),ce=x.useMemo(()=>({...F,side:G,alignItemWithTriggerActive:Y,setControlledAlignItemWithTrigger:$,scrollUpArrowRef:K,scrollDownArrowRef:X}),[F,G,Y,$]);return s.jsx(Wy,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:ae,children:s.jsxs(FE.Provider,{value:ce,children:[P&&O&&s.jsx(kh,{inert:jh(!I),cutout:B}),U]})})}),Ih="base-ui-disable-scrollbar",$E={className:Ih,getElement(e){return s.jsx("style",{nonce:e,href:Ih,precedence:"base-ui:low",children:`.${Ih}{scrollbar-width:none}.${Ih}::-webkit-scrollbar{display:none}`})}},p6=x.createContext(void 0);function qE(e){return x.useContext(p6)}const m6=x.createContext(void 0),h6={disableStyleElements:!1};function g6(){return x.useContext(m6)??h6}const GE="--transform-origin",x6={...$c,...oo},b6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,...p}=t,h=vo(),{multiple:b,readOnly:y,highlightItemOnHover:v}=Jy(),w=IE(),{side:j,align:S,alignItemWithTriggerActive:N,isPositioned:k,setControlledAlignItemWithTrigger:T}=i6(),D=qE()!=null,C=cf(),{nonce:A,disableStyleElements:R}=g6(),I=h.useState("id"),P=h.useState("open"),O=h.useState("openMethod"),_=h.useState("mounted"),L=h.useState("popupProps"),H=h.useState("transitionStatus"),B=h.useState("triggerElement"),z=h.useState("positionerElement"),Q=h.useState("listElement"),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef({}),$=Kc(),Y=Ie(le=>{if(!z||!h.context.popupRef.current||!X.current)return;const M=z.style.top==="0px",U=z.style.bottom==="0px";if(K.current||!N||!M&&!U){h.context.handleScrollArrowVisibility(le);return}const Z=YE(z),ae=ff(z.getBoundingClientRect().height,"y",Z),ce=$t(z),J=Sn(z),ie=J.getComputedStyle(z),ge=parseFloat(ie.marginTop),ee=parseFloat(ie.marginBottom),fe=KE(J.getComputedStyle(h.context.popupRef.current)),te=Math.min(ce.documentElement.clientHeight-ge-ee,fe),Ce=le.scrollTop,re=Ph(le);let de=null;const ke=ye=>{z.style.height=`${ye}px`},Ee=M?re-Ce:Ce,ve=Math.min(ae+Ee,te);if(Ee<=Cl){const ye=Ri(Ee,0,te-ae);ye>0&&ke(ae+ye),le.scrollTop=M?re:0,te-(ae+ye)<=Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le);return}if(te-ve>Cl)de=M?1/0:0;else if(U&&CeCl&&(le.scrollTop=ye)}he>=te-Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le)});x.useImperativeHandle(h.context.scrollHandlerRef,()=>Y,[Y]),ra({open:P,ref:h.context.popupRef,onComplete(){P&&h.context.onOpenChangeComplete(!0)}});const F={open:P,transitionStatus:H,side:j,align:S};De(()=>{!z||!h.context.popupRef.current||Object.keys(q.current).length||(q.current={top:z.style.top||"0",left:z.style.left||"0",right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[h,z]),De(()=>{P||N||(X.current=!1,K.current=!1,Dh(z,q.current))},[P,N,z]),De(()=>{const le=h.context.popupRef.current;if(!P||!B||!z||!le||N&&!k||h.state.transitionStatus==="ending")return;if(X.current=!0,le.style.removeProperty(GE),!N){$.request(()=>h.context.handleScrollArrowVisibility(Q||le));return}const M=v6(le);try{let U=h.context.selectedItemTextRef.current;U?.isConnected||(U=!h.select("hasSelectedValue")&&h.context.firstItemTextRef.current?.isConnected?h.context.firstItemTextRef.current:null);const Z=h.context.valueRef.current,ae=Sn(z),ce=ae.getComputedStyle(z),J=ae.getComputedStyle(le),ie=$t(B),ge=YE(B),ee=_h(B.getBoundingClientRect(),ge),fe=_h(z.getBoundingClientRect(),ge),te=ee.height,Ce=Q||le,re=Ce.scrollHeight,de=parseFloat(J.borderBottomWidth),ke=parseFloat(ce.marginTop)||10,Ee=parseFloat(ce.marginBottom)||10,ve=parseFloat(ce.minHeight)||100,he=KE(J),ye=5,je=5,xe=20,Te=ie.documentElement.clientHeight-ke-Ee,Oe=ie.documentElement.clientWidth,Ne=Te-ee.bottom+te;let _e,Ye=C==="rtl"?ee.right-fe.width:ee.left,kt=0;if(U&&Z){const tn=_h(Z.getBoundingClientRect(),ge);_e=_h(U.getBoundingClientRect(),ge),Ye=fe.left+(C==="rtl"?tn.right-_e.right:tn.left-_e.left);const nt=tn.top-ee.top+tn.height/2;kt=_e.top-fe.top+_e.height/2-nt}const Ct=Ne+kt+Ee+de;let Rt=Math.min(Te,Ct);const ot=Te-ke-Ee,qn=Ct-Rt,fs=Oe-je;z.style.left=`${Ri(Ye,ye,fs-fe.width)}px`,z.style.height=`${Rt}px`,z.style.maxHeight="none",z.style.marginTop=`${ke}px`,z.style.marginBottom=`${Ee}px`,le.style.height="100%";const Gn=Ph(Ce),bs=qn>=Gn-Cl;bs&&(Rt=Math.min(Te,fe.height)-(qn-Gn));const it=ee.topTe-xe||Math.ceil(Rt)+Cl=ot?"0":`${tn}px`,z.style.height=`${Rt}px`,Ce.scrollTop=Ph(Ce)}else z.style.bottom="0",Ce.scrollTop=qn;if(_e){const tn=fe.top,nt=fe.height,Ot=_e.top+_e.height/2,Ft=Ri(nt>0?(Ot-tn)/nt*100:50,0,100);le.style.setProperty(GE,`50% ${Ft}%`)}(Hn===Te||Rt>=he)&&(K.current=!0),h.context.handleScrollArrowVisibility(Ce),v&&h.state.selectedIndex===null&&h.state.activeIndex===null&&h.context.listRef.current[0]!=null&&h.set("activeIndex",0)}finally{M()}},[h,P,z,B,N,T,$,Q,v,C,k]),x.useEffect(()=>{if(!N||!z||!P)return;const le=Sn(z);function M(U){h.context.setOpen(!1,Fe(u4,U))}return St(le,"resize",M)},[h,N,z,P]);const G={...Q?{role:"presentation"}:{role:"listbox","aria-multiselectable":b||void 0,"aria-readonly":y||void 0,id:`${I}-list`},onKeyDown(le){D&&Sh.has(le.key)&&le.stopPropagation()},onScroll(le){Q||Y(le.currentTarget)},...N&&{style:Q?{height:"100%"}:c6},className:!Q&&N?$E.className:void 0},W=yt("div",t,{ref:[a,h.context.popupRef],state:F,stateAttributesMapping:x6,props:[L,G,uf(H),p]});return s.jsxs(x.Fragment,{children:[!R&&$E.getElement(A),s.jsx(oh,{context:w,modal:!1,disabled:!_,openInteractionType:O,returnFocus:f,restoreFocus:!0,children:W})]})});function KE(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Ph(e){return HE(e.scrollHeight,e.clientHeight)}function YE(e){return gT.getScale(e)}function ff(e,t,a){return e/a[t]}function _h(e,t){return Xd({x:ff(e.x,"x",t),y:ff(e.y,"y",t),width:ff(e.width,"x",t),height:ff(e.height,"y",t)})}const XE=[["transform","none"],["scale","1"],["translate","0 0"]];function v6(e){const{style:t}=e,a={};for(const[o,c]of XE)a[o]=t.getPropertyValue(o),t.setProperty(o,c,"important");return()=>{for(const[o]of XE){const c=a[o];c?t.setProperty(o,c):t.removeProperty(o)}}}const QE=x.createContext(void 0);function nw(){const e=x.useContext(QE);if(!e)throw new Error(on(57));return e}const y6=x.memo(x.forwardRef(function(t,a){const{render:o,className:c,style:d,value:f=null,label:p,disabled:h=!1,nativeButton:b=!1,...y}=t,v=x.useRef(null),w=Zy({guess:!0,label:p,textRef:v}),j=vo(),{itemProps:S,multiple:N,disabled:k,readOnly:T}=Jy(),D=k||h,C=j.useState("isActive",w.index),A=j.useState("open"),R=j.useState("isSelected",f),I=j.useState("isSelectedByFocus",w.index),P=j.useState("isItemEqualToValue"),O=w.index,_=x.useRef(null);De(()=>{const F=j.context.valuesRef.current;return F[O]=f,()=>{delete F[O]}},[O,f,j]),De(()=>{const F=j.state.value,G=j.state.selectedIndex;let W=G,le;N&&Array.isArray(F)?(W=_E(O,f,j.context.valuesRef.current,F,P,G),le=W===O,O===G&&!le&&(j.context.selectedItemTextRef.current=null)):(le=F!==void 0&&la(f,F,P),le&&(W=O)),j.set("selectedIndex",W),le&&v.current&&(j.context.selectedItemTextRef.current=v.current)},[O,N,P,j,f]);const L=x.useRef("mouse"),H=x.useRef(!1),{getButtonProps:B,buttonRef:z}=Jr({disabled:D,focusableWhenDisabled:!0,native:b,composite:!0}),Q={disabled:D,selected:R,highlighted:C};function K(F){if(k||T)return;const G=j.state.value;if(N){const W=Array.isArray(G)?G:[],le=R?LE(W,f,P):[...W,f];j.context.setValue(le,Fe(Wd,F))}else j.context.setValue(f,Fe(Wd,F)),j.context.setOpen(!1,Fe(Wd,F))}function X(){j.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":R,tabIndex:A&&C?0:-1,onKeyDown(F){j.set("activeIndex",O),F.key===" "&&j.context.typingRef.current&&F.preventDefault()},onClick(F){const G=L.current!=="touch",W=F.nativeEvent.pointerType,le=G&&Gm(F.nativeEvent)&&(W!==void 0||C),M=G&&!le&&!H.current;H.current=!1,!(D||M)&&K(F.nativeEvent)},onPointerEnter(F){L.current=F.pointerType},onPointerMove(F){if(F.pointerType==="mouse"&&F.buttons===1){const G=j.context.selectionRef.current;G.dragY+=F.movementY,G.dragY**2>=64&&(G.allowUnselectedMouseUp=!0)}},onPointerDown(F){L.current=F.pointerType,H.current=!0,X()},onMouseUp(){if(X(),D||L.current==="touch"||H.current)return;const F=!j.context.selectionRef.current.allowSelectedMouseUp&&R,G=!j.context.selectionRef.current.allowUnselectedMouseUp&&!R;F||G||(H.current=!0,_.current?.click(),H.current=!1)}},$=yt("div",t,{ref:[z,a,w.ref,_],state:Q,props:[S,q,y,B]}),Y=x.useMemo(()=>({selected:R,index:O,textRef:v,selectedByFocus:I}),[R,O,v,I]);return s.jsx(QE.Provider,{value:Y,children:$})})),w6=x.forwardRef(function(t,a){const{selected:o}=nw();return t.keepMounted||o?s.jsx(j6,{...t,ref:a}):null}),j6=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=nw(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),S6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:c,selectedByFocus:d}=nw(),f=vo(),{render:p,className:h,style:b,...y}=t,v=x.useCallback(j=>{j&&(o===0&&(f.context.firstItemTextRef.current=j),d&&(f.context.selectedItemTextRef.current=j))},[f,o,d]);return yt("div",t,{ref:[v,a,c],props:y})})),ft=WV,pt=a6;function mt({className:e,children:t,...a}){return s.jsxs(s6,{"data-slot":"select-trigger",className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","[&>span]:min-w-0 [&>span]:truncate","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",e),...a,children:[t,s.jsx(l6,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function ht({className:e,sideOffset:t=4,children:a,...o}){return s.jsx(o6,{children:s.jsx(f6,{sideOffset:t,alignItemWithTrigger:!1,className:"z-[35]",children:s.jsx(b6,{"data-slot":"select-content",className:Ue("max-h-[260px] min-w-[var(--anchor-width)] overflow-y-auto overscroll-contain rounded-lg border border-border-strong bg-raised p-[5px] shadow-3","outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0",e),...o,children:a})})})}function qe({className:e,children:t,...a}){return s.jsxs(y6,{"data-slot":"select-item",className:Ue("flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-[9px] text-[12.5px] leading-[1.4] text-foreground select-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:font-normal data-disabled:text-muted-foreground",e),...a,children:[s.jsx(S6,{className:"min-w-0 flex-1 truncate",children:t}),s.jsx(w6,{className:"flex flex-none text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function In({options:e,value:t,onValueChange:a,disabled:o=!1,className:c,...d}){const f=x.useRef(null),p=x.useRef(new Map),[h,b]=x.useState({left:0,width:0,ready:!1}),[y,v]=x.useState(!1),w=x.useCallback(()=>{const j=f.current,S=p.current.get(t);if(!j||!S){b(C=>C.ready?{...C,ready:!1}:C);return}const N=j.getBoundingClientRect(),k=S.getBoundingClientRect(),T=k.left-N.left-j.clientLeft,D=k.width;b(C=>C.ready&&C.left===T&&C.width===D?C:{left:T,width:D,ready:!0})},[t]);return x.useLayoutEffect(()=>{w();const j=f.current;if(!j||typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>w());S.observe(j);for(const N of p.current.values())S.observe(N);return()=>S.disconnect()},[w,e]),x.useEffect(()=>{if(!h.ready||y)return;const j=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(j)},[h.ready,y]),s.jsxs(AE,{ref:f,"data-slot":"segmented-control",className:Ue("relative inline-flex gap-0.5 rounded-md border border-control-border bg-control p-0.5",c),value:t,disabled:o,onValueChange:j=>a(j),...d,children:[s.jsx("span",{"aria-hidden":"true","data-slot":"segmented-thumb","data-ready":h.ready?"true":"false","data-animate":y?"true":"false",className:Ue("pointer-events-none absolute top-0.5 bottom-0.5 left-0 rounded-sm bg-primary-soft","data-[ready=false]:opacity-0","data-[animate=true]:transition-[transform,width] data-[animate=true]:duration-200 data-[animate=true]:ease-in-out"),style:{transform:`translateX(${h.left}px)`,width:h.width}}),e.map(j=>s.jsxs(CE,{value:j.value,"data-slot":"segmented-item",disabled:j.disabled,"data-zero":j.count===0?"true":void 0,className:Ue("group/seg relative z-[1] inline-flex h-6 items-center gap-[5px] rounded-sm border-0 bg-transparent px-2.5","text-xs font-medium whitespace-nowrap text-subtle select-none","transition-[background-color,color] duration-150 ease-out","hover:bg-nav-hover hover:text-foreground","data-checked:bg-transparent data-checked:text-primary-fg data-checked:hover:bg-transparent","data-disabled:cursor-not-allowed data-disabled:opacity-40","data-[zero=true]:data-unchecked:opacity-45"),ref:S=>{S?p.current.set(j.value,S):p.current.delete(j.value)},children:[j.label,j.count!==void 0&&s.jsx("span",{className:Ue("min-w-4 rounded-pill bg-surface-3 px-[5px] text-center text-[10.5px] font-semibold tabular-nums text-muted-foreground","group-data-checked/seg:bg-primary-tint group-data-checked/seg:text-primary-fg"),children:j.count})]},j.value))]})}const N6=x.createContext(void 0);function k6(){return x.useContext(N6)}const C6=x.forwardRef(function(t,a){const{className:o,defaultPressed:c=!1,disabled:d=!1,form:f,onPressedChange:p,pressed:h,render:b,type:y,value:v,nativeButton:w=!0,style:j,...S}=t,N=Na(v||void 0),k=k6(),T=k?.value??[],D=(d||k?.disabled)??!1,[C,A]=Ga({controlled:k?N!==void 0&&T.indexOf(N)>-1:h,default:c,name:"Toggle",state:"pressed"}),{getButtonProps:R,buttonRef:I}=Jr({disabled:D,native:w}),P={disabled:D,pressed:C},O=[I,a],_=[{"aria-pressed":C,onClick(B){const z=!C,Q=Fe(Yn,B.nativeEvent);p?.(z,Q),!Q.isCanceled&&(N&&k?.setGroupValue?.(N,z,Q),!Q.isCanceled&&A(z))}},S,R],L=yt("button",t,{enabled:!k,state:P,ref:O,props:_}),H=x.useMemo(()=>({disabled:D,focusableWhenDisabled:!1}),[D]);return k?s.jsx(SE,{tag:"button",render:b,className:o,style:j,metadata:H,state:P,refs:O,props:_}):L}),T6=Vc(["inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color] duration-150 ease-out","outline-none select-none disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0","data-pressed:border-primary-bd data-pressed:bg-primary-soft data-pressed:font-semibold data-pressed:text-primary-fg","data-pressed:hover:bg-primary-tint"],{variants:{variant:{default:"border-transparent bg-transparent text-subtle hover:bg-nav-hover hover:text-foreground",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]"}},defaultVariants:{variant:"default",size:"default"}});function E6({className:e,variant:t,size:a,...o}){return s.jsx(C6,{"data-slot":"toggle",className:Ue(T6({variant:t,size:a}),e),...o})}function A6(e,t,a,o,c,d,f,p,h,b=2){const y=KB(a.current,{event:e,orientation:o,loopFocus:c,rtl:d,cols:b,disabledIndices:f,minIndex:p,maxIndex:h,prevIndex:t>h?p:t,stopEvent:!0});return fo(a.current,y)?void 0:y}const ZE=x.createContext(void 0),WE=x.createContext(void 0),JE=x.createContext(void 0),eA=x.createContext(!1),tA=x.createContext("");function Ca(){const e=x.useContext(ZE);if(!e)throw new Error(on(22));return e}function Lh(){const e=x.useContext(WE);if(!e)throw new Error(on(23));return e}function pf(){const e=x.useContext(JE);if(!e)throw new Error(on(24));return e}function nA(){return x.useContext(tA)}function R6(){return x.useContext(eA)}const O6={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{const{selectedValue:t,selectionMode:a}=e;return t==null?!1:a==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.selectedValue;return Array.isArray(o)?o.some(c=>la(t,c,a)):la(t,o,a)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function sA(e){return e==null?void 0:`${e}-popup`}function M6(e,t){return(a,o)=>a==null?!1:e.contains(a,o,t)}const rA=new Map;function D6(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},a=`${dy(e.locale)}|${JSON.stringify(t)}`,o=rA.get(a);if(o)return o;const c=new Intl.Collator(e.locale,t),d={contains(f,p,h){if(!p)return!0;const b=yo(f,h);for(let y=0;y<=b.length-p.length;y+=1)if(c.compare(b.slice(y,y+p.length),p)===0)return!0;return!1},startsWith(f,p,h){if(!p)return!0;const b=yo(f,h);return c.compare(b.slice(0,p.length),p)===0},endsWith(f,p,h){if(!p)return!0;const b=yo(f,h),y=p.length;return b.length>=y&&c.compare(b.slice(b.length-y),p)===0}};return rA.set(a,d),d}const I6=D6;function P6(e,t=!1){const{overflowY:a}=xr(e);return a!=="auto"&&a!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const aA=Symbol("none"),sw={value:aA,index:-1};function _6(e,t,a){const o=e.get(t);if(o!==void 0||a===Ah)return o;for(const[c,d]of e)if(la(c,t,a))return d}function L6(e){const{id:t,onOpenChangeComplete:a,defaultSelectedValue:o=null,selectedValue:c,onSelectedValueChange:d,defaultInputValue:f,inputValue:p,open:h,defaultOpen:b=!1,selectionMode:y,onItemHighlighted:v,name:w,form:j,disabled:S=!1,readOnly:N=!1,required:k=!1,inputRef:T,grid:D=!1,items:C,filteredItems:A,filter:R,filterQuery:I,openOnInputClick:P=!0,autoHighlight:O=!1,keepHighlight:_=!1,highlightItemOnHover:L=!0,loopFocus:H=!0,itemToStringLabel:B,itemToStringValue:z,isItemEqualToValue:Q=Ah,virtualized:K=!1,inline:X=!1,fillInputOnItemPress:q=!0,modal:$=!1,limit:Y=-1,autoComplete:F="list",formAutoComplete:G,locale:W,submitOnItemClick:le=!1}=e,{clearErrors:M}=Fc(),{setDirty:U,validityData:Z,setFilled:ae,name:ce,disabled:J,setTouched:ie,setFocused:ge,validationMode:ee,validation:fe}=Sa(),te=cf(),Ce=lo({id:t}),re=I6({locale:W}),de=Array.isArray(C)?null:C;if(de&&typeof de.label!="function")throw new Error(on(100));const ke=de?de.data:C,Ee=de?.value,ve=Ee?void 0:ke,he=x.useMemo(()=>{if(!A||!Ee)return;const Me=Oh(A),Be=Me.map(Ee);let lt;return{values:Be,findItem(Yt,On){if(!lt){lt=new Map;for(let mn=0;mnde?Me=>de.label(Me,Q,Be=>{const lt=he?.findItem(Be,Q);return lt!=null?de.itemLabel(lt):yo(Be,B)}):B,[de,B,he,Q]),je=x.useMemo(()=>de?Object.assign(Me=>de.itemLabel(Me),{selected:Me=>yo(Me,ye)}):B,[de,ye,B]);function xe(Me){return yo(Me,ye)}const[Te,Oe]=x.useState(!1),[Ne,_e]=x.useState(null),Ye=x.useRef(Ne),kt=x.useRef([]),Ct=x.useRef([]),Rt=x.useRef(null),ot=x.useRef(null),qn=x.useRef(null),fs=x.useRef(null),Gn=x.useRef(null),bs=x.useRef(!0),it=x.useRef(!1),Vt=x.useRef(null),Hn=x.useRef(null),tn=x.useRef(null),nt=x.useRef(sw),Ot=x.useRef(null),Ft=x.useRef([]),Zn=x.useRef(null),Un=J||S,Vn=ce??w,Rn=y==="multiple",Jt=y==="single",ls=p!==void 0||f!==void 0,Tt=ke!==void 0,xt=A!==void 0;let wt;O==="always"?wt="always":wt=O?"input-change":!1;const[jt,Nr]=Ga({controlled:c,default:Rn?o??Or:o,name:"Combobox",state:"selectedValue"}),rr=x.useMemo(()=>R===null?()=>!0:R!==void 0?R:M6(re,je),[R,re,je]),Hr=Ds(()=>ls?f??"":Jt?xe(jt):"").current,[wn,rl]=Ga({controlled:p,default:Hr,name:"Combobox",state:"inputValue"}),[rn,ic]=Ga({controlled:h,default:b,name:"Combobox",state:"open"}),Jx=ew(ke),dr=!rn&&Ne!==null?Ne:String(wn).trim(),Ia=Jt?xe(jt):"",Ho=Jt&&!Te&&dr!==""&&Ia.length===dr.length&&re.contains(Ia,dr),Uo=Ho?"":I??dr,_p=Tt&&xt&&Ho&&(!de||de.hasValue(jt,Q)),cc=x.useMemo(()=>ke?Oh(ke):Or,[ke]),Vo=x.useMemo(()=>{if(A&&!_p)return A;if(!ke)return Or;if(Jx){const Be=ke,lt=[];let Yt=0;for(const On of Be){if(Y>-1&&Yt>=Y)break;const mn=Y>-1?Y-Yt:1/0,Mn=Uo===""?On.items.slice(0,mn):[];if(Uo!=="")for(const ps of On.items){if(Mn.length>=mn)break;rr(ps,Uo,je)&&Mn.push(ps)}if(Mn.length>0){const ps={...On,items:Mn};lt.push(ps),Yt+=Mn.length}}return lt}if(Uo==="")return Y>-1?cc.slice(0,Y):cc;const Me=[];for(const Be of cc){if(Y>-1&&Me.length>=Y)break;rr(Be,Uo,je)&&Me.push(Be)}return Me},[A,_p,ke,Jx,Uo,Y,rr,je,cc]),As=x.useMemo(()=>{if(he&&Vo===A)return he.values;const Me=Oh(Vo);return Ee?Me.map(Be=>Ee(Be)):Me},[Vo,A,he,Ee]),et=Ds(()=>{let Me=null;return X&&rn&&Tt&&y!=="none"&&(Me=df(As,jt,Q,Rn)),new tu({id:Ce,labelId:void 0,selectedValue:jt,open:rn,items:ve,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,isItemEqualToValue:Q,modal:$,autoHighlight:wt,submitOnItemClick:le,hasInputValue:ls,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:X,activeIndex:null,selectedIndex:Me,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:fn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:y==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:kt,labelsRef:Ct,popupRef:Rt,emptyRef:Gn,inputRef:ot,startDismissRef:qn,endDismissRef:fs,keyboardActiveRef:bs,chipsContainerRef:Vt,clearRef:Hn,valuesRef:Ft,pointerDownItemRef:Zn,selectionEventRef:tn},O6)}).current,_l=y==="none"?wn:jt,eb=x.useMemo(()=>y==="none"?_l:Array.isArray(jt)?jt.map(Me=>ka(Me,z)):ka(jt,z),[_l,z,y,jt]),Pa=Ie(v),Rs=Ie(a),qs=et.useState("activeIndex"),Fo=et.useState("selectedIndex"),uc=et.useState("positionerElement"),tb=et.useState("listElement"),dc=et.useState("triggerElement"),fc=et.useState("inputElement"),pc=et.useState("inputGroupElement"),Os=et.useState("inline"),ar=et.useState("inputInsidePopup"),Ll=et.useState("inputOwnsFormValue"),zl=Jt&&!ar&&wn===Ia,mc=Xn(dc),{mounted:$o,setMounted:vs,transitionStatus:Lp}=ki(rn),{openMethod:nb,triggerProps:zp}=vE(rn),Bl=Ie(()=>eb);Yc(ar?mc:ot,Ce,_l,Bl,!Un,w);const Hl=Ie(()=>{ke?Ct.current=As.map(xe):et.set("forceMounted",!0)}),qo=Ie((Me,Be,lt)=>{if(Be===-1){if(nt.current===sw)return;nt.current=sw}else nt.current={value:Me,index:Be};Pa(Me,d4(lt,void 0,{index:Be}))}),Ur=Ie(Me=>{const Be={};Me.activeIndex!==void 0&&(Be.activeIndex=Me.activeIndex),Me.selectedIndex!==void 0&&(Be.selectedIndex=Me.selectedIndex),et.update(Be);const lt=Me.activeIndex;if(lt===void 0)return;const Yt=Me.type||Yn;lt===null?qo(void 0,-1,Yt):qo(Ft.current[lt],lt,Yt)}),Vr=Ie((Me,Be)=>{if(e.onInputValueChange?.(Me,Be),!Be.isCanceled){if(it.current=Be.reason===Ka,Be.reason===Jd){rn&&Ne!==null&&_e(null);const lt=Be.event,Yt=lt.inputType;if(lt.type==="compositionend"||Yt!=null&&Yt!==""&&Yt!=="insertReplacementText"){const mn=Me.trim()!=="";mn&&Oe(!0),Ot.current={hasQuery:mn};const Mn=et.state.listElement;if(!et.state.virtualized&&Mn){const ps=Rt.current;for(const kr of Hc(Mn.firstElementChild??Mn)){if(!dn(kr)||(ps?!Qe(ps,kr):kr.getAttribute("role")==="dialog"))break;if(P6(kr)){kr.scrollTop=0;break}}}mn&&wt&&et.state.activeIndex==null&&(rn||Os)&&et.set("activeIndex",0)}}else Be.reason===Ka&&Me===""&&et.state.inputInsidePopup&&(Ot.current={hasQuery:!1,selection:!0});rl(Me)}}),sb=Ie(Me=>{const Be=!Me&&ar&&!Os&&wn!==""&&(String(wn).trim()===Ne||wn===Ia);!Me&&(Be||wn===""||zl)&&Oe(!1),_e(null),Be&&Vr("",Fe(Ka))}),Mt=Ie((Me,Be)=>{if(rn!==Me&&(Be.reason===Xc&&Tt&&As.length===0&&!Gn.current&&Be.allowPropagation(),e.onOpenChange?.(Me,Be),!Be.isCanceled&&(Me&&Ne!==null&&sb(Be.reason===Jd),!Me&&Te&&(Jt?(Os||_e(dr),dr===""&&Oe(!1)):Rn&&(Os||_e(dr),ar&&Ur({activeIndex:null}),(!ar||Os)&&Vr("",Fe(Ka,Be.event,void 0,{isItemPress:Be.reason===Wd})))),ic(Me),!Me&&ar&&(Be.reason===ho||Be.reason===nh)&&(ie(!0),ge(!1),ee==="onBlur")))){const lt=y==="none"?wn:jt;fe.commit(lt)}}),hc=Ie((Me,Be)=>{if(d?.(Me,Be),Be.isCanceled)return;Nr(Me),(y==="none"&&Rt.current&&q||Jt&&!et.state.inputInsidePopup)&&Vr(xe(Me),Fe(Be.reason,Be.event))}),ed=Ie((Me,Be)=>{const lt=cs(Me),Yt=tn.current??Me;tn.current=null;const On=Fe(Wd,Yt),mn=lt?.closest("a")?.getAttribute("href");if(mn){mn.startsWith("#")&&Mt(!1,On);return}if(Rn){const Mn=Array.isArray(jt)?jt:[],ps=Rh(Mn,Be,Q),kr=ps?LE(Mn,Be,Q):[...Mn,Be];if(hc(kr,On),On.isCanceled||!(ot.current?ot.current.value.trim()!=="":!1))return;if(et.state.inputInsidePopup){Vr("",Fe(Ka,On.event,void 0,{isItemPress:!0}));const $r=Ot.current;$r&&!ps&&($r.toggledValue=Be)}else Mt(!1,On)}else{if(hc(Be,On),On.isCanceled)return;Mt(!1,On)}}),td=Ie(()=>{const Me=fe.inputRef.current?.form??et.state.inputElement?.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),Fr=Ie(()=>{if(vs(!1),Rs?.(!1),Oe(!1),_e(null),Ur(y==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Rn&&ot.current&&ot.current.value!==""&&!it.current&&Vr("",Fe(Ka)),Jt)if(et.state.inputInsidePopup)ot.current&&ot.current.value!==""&&Vr("",Fe(Ka));else{const Me=xe(jt);ot.current&&ot.current.value!==Me&&Vr(Me,Fe(Me===""?Ka:Yn))}}),fr=x.useMemo(()=>Os&&uc?{current:uc.closest('[role="dialog"]')}:Rt,[Os,uc]);ra({enabled:!e.actionsRef,open:rn,ref:fr,onComplete(){rn||Fr()}}),x.useImperativeHandle(e.actionsRef,()=>({unmount:Fr}),[Fr]),De(function(){const Be=Ye.current!==null&&Ne===null;if(Ye.current=Ne,rn&&(!Be||!Tt)||(rn||(Zn.current=null),y==="none"))return;const lt=Tt?As:Ft.current;Ur({selectedIndex:df(lt,jt,Q,Rn)})},[rn,Ne,jt,y,Rn,Tt,As,Q,Ur]),De(()=>{ke&&(Ft.current=As,kt.current.length=As.length)},[ke,As]),De(()=>{const Me=Ot.current;if(Me){const ps=rn||Os||et.state.positionerElement?.hidden===!1;if(Me.hasQuery)wt&&ps&&et.set("activeIndex",0),Ot.current=null;else if(String(wn).trim()===""&&(Ot.current=null,ps)){const kr=Me.selection;wt==="always"&&!kr&&et.state.selectionMode==="none"&&et.set("activeIndex",0),queueMicrotask(()=>{if(!et.state.open&&!et.state.inline||ot.current&&ot.current.value.trim()!=="")return;const ma=et.state.selectedValue,$r=et.state.selectionMode==="multiple";if($r&&Array.isArray(ma)?ma.length>0:et.state.selectionMode!=="none"&&ma!=null){const _s=Tt||xt?As:Ft.current,La=su(_s,Me.toggledValue,et.state.isItemEqualToValue);et.set("activeIndex",La!==-1?La:df(_s,ma,et.state.isItemEqualToValue,$r))}else kr?et.set("activeIndex",null):wt==="always"&&et.set("activeIndex",0)})}}if(!rn&&!Os)return;const lt=Tt||xt?As:Ft.current,Yt=et.state.activeIndex;if(Yt==null){if(wt==="always"&<.length>0){et.set("activeIndex",0);return}qo(void 0,-1,Yn);return}if(Yt>=lt.length){qo(void 0,-1,Yn),et.set("activeIndex",null);return}const On=lt[Yt],mn=nt.current.value,Mn=mn!==aA&&la(On,mn,et.state.isItemEqualToValue);(nt.current.index!==Yt||!Mn)&&qo(On,Yt,Yn)},[qs,wt,qo,xt,Tt,As,Os,rn,et,wn]),De(()=>{if(y==="none"){ae(String(wn)!=="");return}ae(Rn?Array.isArray(jt)&&jt.length>0:jt!=null)},[ae,y,wn,jt,Rn]),x.useEffect(()=>{Tt&&wt&&As.length===0&&Ur({activeIndex:null})},[Tt,wt,As.length,Ur]);function rb(){rn&&dr!==""&&dr!==String(Hr)&&!zl&&Oe(!0)}function FS(){rn&&Ne!==null&&sb(!1)}let nd=!1;function Bp(){!nd&&wn!==Ia&&(nd=!0,Vr(Ia,Fe(Yn)))}function $S(){y!=="none"&&(M(Vn),U(PE(jt,Z.initialValue,Q)),fe.change(jt),Jt&&!ls&&!ar&&Bp())}function pr(){Jt&&!ls&&!ar&&!Te&&Bp()}function Hp(){y==="none"&&(M(Vn),U(wn!==Z.initialValue),fe.change(wn))}aa(dr,rb),aa(rn,FS),aa(jt,$S),aa(Ia,pr),aa(ke,pr),aa(wn,Hp);const gc=PT({open:Os?!0:rn,onOpenChange:Mt,elements:{reference:ar?dc:fc,floating:uc}}),sd=D?"grid":"listbox",_a=rn||Os,Up=_a?"true":"false",xc=x.useMemo(()=>{const Me=fc?.tagName==="INPUT",Be=fc==null||Me,lt=Be||_a,Yt=Be?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return lt&&(Yt.role="combobox",Yt["aria-expanded"]=Up,Yt["aria-haspopup"]=sd,Yt["aria-controls"]=_a?tb?.id:void 0,Yt["aria-autocomplete"]=N?"none":F),{reference:Yt,floating:{role:"presentation"}}},[fc,_a,Up,sd,tb?.id,F,N]),Ul=ih(gc,{enabled:!Un&&P,event:"mousedown-only",toggle:!1,touchOpenDelay:ar?0:100,reason:i4}),rd=af(gc,{enabled:!Un&&!Os,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Os?!0:void 0,outsidePress(Me){const Be=cs(Me);return!Qe(dc,Be)&&!Qe(Hn.current,Be)&&!Qe(Vt.current,Be)&&!Qe(pc,Be)}}),Vl=HT(gc,{enabled:!Un,id:Ce,listRef:kt,activeIndex:qs,selectedIndex:Fo,virtual:!0,loopFocus:H,allowEscape:H&&!wt,focusItemOnOpen:Te||y==="none"&&!wt?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!_,orientation:D?"horizontal":void 0,rtl:te==="rtl",disabledIndices:Or,grid:D?A6:void 0,onNavigate(Me,Be){!Be&&!rn||Lp==="ending"||Ur(Be?{activeIndex:Me,type:bs.current?k1:C1}:{activeIndex:Me})}}),Vp=x.useMemo(()=>Wr(Vl.reference,{onKeyDown(Me){D&&et.state.activeIndex==null&&(Me.key==="ArrowLeft"||Me.key==="ArrowRight")&&Me.preventBaseUIHandler()}},rd.reference,Ul.reference,xc.reference),[Vl.reference,rd.reference,Ul.reference,xc.reference,D,et]),ad=x.useMemo(()=>Wr(lf,rd.floating),[rd.floating]),ab=x.useMemo(()=>Wr(Vl.floating,xc.floating),[Vl.floating,xc.floating]),lb=x.useMemo(()=>{const Me=Vl.item;return Me?{...Me,onFocus:void 0}:fn},[Vl.item]);et.useContextCallback("setOpen",Mt),et.useContextCallback("setInputValue",Vr),et.useContextCallback("setSelectedValue",hc),et.useContextCallback("setIndices",Ur),et.useContextCallback("handleSelection",ed),et.useContextCallback("forceMount",Hl),et.useContextCallback("requestSubmit",td),et.useContextCallback("onOpenChangeComplete",a),RE(()=>{et.update({inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb})});const bc={id:Ce,selectedValue:jt,open:rn,mounted:$o,transitionStatus:Lp,items:ve,inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb,openMethod:nb,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,modal:$,autoHighlight:wt,isItemEqualToValue:Q,submitOnItemClick:le,hasInputValue:ls};De(()=>{et.update({...bc,inputOwnsFormValue:y==="none"&&(X||!et.state.inputInsidePopup)})},[et,...Object.values(bc)]);const pa=ea(T,fe.inputRef),Fp=x.useMemo(()=>({query:dr,hasItems:Tt,filteredItems:Vo,flatFilteredValues:As}),[dr,Tt,Vo,As]),$p=x.useMemo(()=>Array.isArray(_l)?"":ka(_l,z),[_l,z]),Go=Rn&&Array.isArray(jt)&&jt.length>0,al=Rn||y==="none"&&Ll?void 0:Vn,ob=x.useMemo(()=>!Rn||!Array.isArray(jt)||!Vn?null:jt.map(Me=>{const Be=ka(Me,z);return s.jsx("input",{type:"hidden",form:j,name:Vn,value:Be,disabled:Un},Be)}),[Rn,jt,j,Vn,z,Un]),qp=s.jsxs(x.Fragment,{children:[e.children,s.jsx("input",{...fe.getValidationProps(Un,{onFocus(){if(ar){dc?.focus();return}(ot.current||dc)?.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented||Un||N)return;const Be=Me.currentTarget.value,lt=Be.toLowerCase(),Yt=Fe(Yn,Me.nativeEvent),On=()=>Ft.current.findIndex(Mn=>ka(Mn,z).toLowerCase()===lt||xe(Mn).toLowerCase()===lt);function mn(){if(Rn)return;if(y==="none"){Vr(Be,Yt);return}let Mn=On();Mn===-1&&(Mn=Ft.current.findIndex((kr,ma)=>{const $r=Ct.current[ma];return $r!=null&&$r.toLowerCase()===lt}));const ps=Mn===-1?void 0:Ft.current[Mn];ps!=null&&hc?.(ps,Yt)}Jt&&(Hl(),ke&&On()===-1&&et.set("forceMounted",!0)),queueMicrotask(mn)}}),id:Ce&&al==null?`${Ce}-hidden-input`:void 0,form:j,name:al,autoComplete:G,disabled:Un,required:k&&!Go,readOnly:N,value:$p,ref:pa,style:al?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ob]});return s.jsx(ZE.Provider,{value:et,children:s.jsx(WE.Provider,{value:gc,children:s.jsx(eA.Provider,{value:Tt,children:s.jsx(JE.Provider,{value:Fp,children:s.jsx(tA.Provider,{value:wn,children:qp})})})})})}function z6(e){const{multiple:t=!1,defaultValue:a,value:o,onValueChange:c,autoComplete:d,...f}=e;return s.jsx(L6,{...f,selectionMode:t?"multiple":"single",selectedValue:o,defaultSelectedValue:a,onSelectedValueChange:c,formAutoComplete:d})}const B6="data-popup-side",H6="data-list-empty",lA={...$v,...wi,popupSide:e=>e?{[B6]:e}:null,listEmpty:e=>e?{[H6]:""}:null},U6=x.createContext(void 0);function V6(){return x.useContext(U6)}const oA=x.createContext(void 0);function rw(e){const t=x.useContext(oA);if(t===void 0&&!e)throw new Error(on(21));return t}const iA=x.forwardRef(function(t,a){const o=Ca(),{buttonRef:c,getButtonProps:d}=Jr({native:!1}),f=ea(a,c);function p(b){o.context.setOpen(!1,Fe(oy,b.nativeEvent,b.currentTarget))}const h=d({onClick:p});return s.jsx("span",{ref:f,...h,"aria-label":"Dismiss",tabIndex:void 0,style:Zc})});function cA(e){const t=e.useState("mounted"),a=e.useState("popupSide"),o=e.useState("positionerElement");return t&&o?a:null}function zh(){return pf().filteredItems.length===0}function F6(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function $6(e,t){const a=e>=t-1?t-2:e;return a>=0?a:void 0}function uA(e,t,a){const o=e.context.listRef.current[t];o&&(e.context.selectionEventRef.current=a,o.click(),e.context.selectionEventRef.current=null)}const q6=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,id:f,style:p,...h}=t,{state:b,disabled:y,setTouched:v,setFocused:w,validationMode:j,validation:S}=Sa(),{labelId:N}=vl(),k=V6(),D=!!rw(!0),C=Ca(),A=nA(),R=cf(),I=C.useState("required"),P=C.useState("disabled"),O=C.useState("readOnly"),_=C.useState("name"),L=C.useState("form"),H=C.useState("selectionMode"),B=C.useState("autoHighlight"),z=C.useState("inputProps"),Q=C.useState("triggerProps"),K=C.useState("open"),X=C.useState("mounted"),q=C.useState("selectedValue"),$=C.useState("id"),Y=C.useState("inline"),F=C.useState("modal"),G=!!B,W=cA(C),le=y||P||d,M=zh(),U=D||Y,Z=!U||F,ae=Na(f??(U?void 0:$)),ce=D?KC:b,[J,ie]=x.useState(null),ge=x.useRef(!1),ee=x.useRef(null),fe=x.useRef(!1),te=H==="none"&&!D,Ce=Ie(je=>{const xe=D||C.state.inline;xe&&!C.state.hasInputValue&&C.context.setInputValue("",Fe(Yn)),C.update({inputElement:je,inputInsidePopup:xe,inputOwnsFormValue:te})}),re=D?h:S.getValidationProps(le,h);function de(){C.context.setIndices({activeIndex:null,selectedIndex:null,type:C.context.keyboardActiveRef.current?k1:C1})}function ke(){C.context.keyboardActiveRef.current=!1}const Ee={...ce,open:K,disabled:le,readOnly:O,popupSide:W,listEmpty:M};function ve(je){if(!k)return;let xe;const{highlightedChipIndex:Te}=k,Oe=k.chipsRef.current.length,[Ne,_e]=F6(R);return Te!==void 0?(je.key===Ne?(je.preventDefault(),Te>0?xe=Te-1:xe=void 0):je.key===_e?(je.preventDefault(),Te0&&(je.preventDefault(),xe=Oe>0?Oe-1:void 0),xe)}const he=yt("input",t,{state:Ee,ref:[a,C.context.inputRef,Ce],props:[z,Q,{value:J??A,"aria-readonly":O||void 0,"aria-required":I||void 0,"aria-labelledby":N,disabled:le,readOnly:O,required:H==="none"?I:void 0,form:L,...te&&_&&{name:_},id:ae,onFocus(){if(w(!0),!Y||!fe.current)return;fe.current=!1;const je=ee.current;je==null||!Object.hasOwn(C.context.valuesRef.current,je)||C.context.setIndices({activeIndex:je})},onBlur(){v(!0),w(!1);const je=C.state.activeIndex;if(Y&&je!==null&&B!=="always"&&(ee.current=je,fe.current=!0,C.context.setIndices({activeIndex:null})),j==="onBlur"){const xe=H==="none"?A:q;S.commit(xe)}},onCompositionStart(je){Um||(ge.current=!0,ie(je.currentTarget.value))},onCompositionEnd(je){ge.current=!1;const xe=je.currentTarget.value;ie(null),C.context.setInputValue(xe,Fe(Jd,je.nativeEvent))},onChange(je){const xe=je.nativeEvent,Te=xe.inputType,Oe=!Te||Te==="insertReplacementText",Ne=ge.current||!Oe;function _e(Rt){O||le||!Rt||!Ne||(C.context.setOpen(!0,Fe(Jd,xe)),G||de())}if(ge.current){const Rt=je.currentTarget.value;ie(Rt),Rt===""&&!C.state.openOnInputClick&&!C.state.inputInsidePopup&&C.context.setOpen(!1,Fe(Ka,xe));const ot=Rt.trim(),qn=G&&ot!=="";_e(ot),K&&C.state.activeIndex!==null&&!qn&&de();return}const Ye=Fe(Jd,xe);if(C.context.setInputValue(je.currentTarget.value,Ye),Ye.isCanceled)return;const kt=je.currentTarget.value==="",Ct=Fe(Ka,xe);kt&&!C.state.inputInsidePopup&&(H==="single"&&C.context.setSelectedValue(null,Ct),C.state.openOnInputClick||C.context.setOpen(!1,Ct)),_e(je.currentTarget.value.trim()),K&&C.state.activeIndex!==null&&!G&&de()},onKeyDown(je){if(je.ctrlKey||je.shiftKey||je.altKey||je.metaKey)return;if(C.context.keyboardActiveRef.current=!0,le||O){O&&je.key==="Enter"&&K&&C.state.activeIndex!==null&&ks(je);return}const xe=je.currentTarget,Te=xe.scrollWidth-xe.clientWidth,Oe=R==="rtl";if(je.key==="Home"){ks(je);const Ye=e1&&Oe?xe.value.length:0;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=0;return}if(je.key==="End"){ks(je);const Ye=e1&&Oe?0:xe.value.length;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=Oe?-Te:Te;return}if(!X&&je.key==="Escape"){const Ye=H==="multiple"&&Array.isArray(q)?q.length===0:q===null,kt=Fe(Xc,je.nativeEvent),Ct=H==="multiple"?[]:null;C.context.setInputValue("",kt),C.context.setSelectedValue(Ct,kt),!Ye&&!C.state.inline&&!kt.isPropagationAllowed&&je.stopPropagation();return}if(k&&je.key==="Backspace"&&xe.value===""&&k.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ye=k.chipsRef.current.length,kt=Ye>0?Ye-1:q.length-1,Ct=q.filter((Rt,ot)=>ot!==kt);de(),C.context.setSelectedValue(Ct,Fe(Yn,je.nativeEvent));return}const Ne=k?.highlightedChipIndex!==void 0,_e=ve(je);if(k?.setHighlightedChipIndex(_e),_e!==void 0?k?.chipsRef.current[_e]?.focus():Ne&&C.context.inputRef.current?.focus(),je.which!==229&&je.key==="Enter"&&K){const Ye=C.state.activeIndex,kt=je.nativeEvent;if(Ye===null){if(Y)return;C.context.setOpen(!1,Fe(Yn,kt));return}ks(je),uA(C,Ye,kt)}},onPointerMove:ke,onPointerDown:ke},re],stateAttributesMapping:lA}),ye=D?s.jsx(XC.Provider,{value:YC,children:he}):he;return s.jsxs(x.Fragment,{children:[K&&Z&&s.jsx(iA,{ref:C.context.startDismissRef}),ye]})}),G6=x.forwardRef(function(t,a){const{render:o,className:c,nativeButton:d=!0,disabled:f=!1,id:p,style:h,...b}=t,{state:y,disabled:v,setTouched:w,setFocused:j,validationMode:S,validation:N}=Sa(),{labelId:k}=vl(),T=Ca(),D=T.useState("selectionMode"),C=T.useState("disabled"),A=T.useState("readOnly"),R=T.useState("required"),I=T.useState("positionerElement"),P=T.useState("listElement"),O=T.useState("popupId"),_=T.useState("triggerProps"),L=T.useState("inputInsidePopup"),H=T.useState("id"),B=T.useState("labelId"),z=T.useState("open"),Q=T.useState("selectedValue"),K=T.useState("activeIndex"),X=T.useState("selectedIndex"),q=T.useState("hasSelectedValue"),$=Lh(),Y=nA(),F=Zs(),G=v||C||f,W=zh(),le=cA(T);lo({id:L?p:void 0});const M=L?p??H:p,U=UE(k,B);let Z;z&&L?Z=O??sA(H):z&&(Z=P?.id);const ae=x.useRef("");function ce(re){ae.current=re.pointerType}const{reference:J}=UT($,{enabled:!z&&!A&&!C&&D==="single",listRef:T.context.labelsRef,activeIndex:K,selectedIndex:X,onMatch(re){const de=T.context.valuesRef.current[re];de!==void 0&&T.context.setSelectedValue(de,Fe(Yn))}}),{reference:ie}=ih($,{enabled:!C,event:"mousedown"}),{buttonRef:ge,getButtonProps:ee}=Jr({native:d,disabled:G}),fe={...y,readOnly:A,open:z,disabled:G,popupSide:le,listEmpty:W,placeholder:D==="none"?!1:!q},te=Ie(re=>{T.set("triggerElement",re)});return yt("button",t,{ref:[a,ge,te],state:fe,props:[_,ie,J,{id:M,tabIndex:L?0:-1,role:L?"combobox":void 0,"aria-expanded":z,"aria-haspopup":L?"dialog":"listbox","aria-controls":Z,"aria-required":L&&R||void 0,"aria-readonly":L&&A||void 0,"aria-labelledby":U,onPointerDown:ce,onPointerEnter:ce,onFocus(){j(!0),!G&&F.start(0,T.context.forceMount)},onBlur(re){if(!Qe(I,re.relatedTarget)&&(w(!0),j(!1),S==="onBlur")){const de=D==="none"?Y:Q;N.commit(de)}},onMouseDown(re){if(G||(L||$.set("domReferenceElement",re.currentTarget),T.context.forceMount(),ae.current!=="touch"&&(T.context.inputRef.current?.focus(),L||re.preventDefault()),z))return;const de=$t(re.currentTarget);function ke(Ee){const ve=T.state.triggerElement;if(!ve)return;const he=cs(Ee),ye=T.state.positionerElement,je=T.state.listElement;Qe(ve,he)||Qe(ye,he)||Qe(je,he)||VE(Ee,ve)||T.context.setOpen(!1,Fe(T1,Ee))}L&&de.addEventListener("mouseup",ke,{once:!0})},onKeyDown(re){(re.key==="ArrowDown"||re.key==="ArrowUp")&&(ks(re),T.context.setOpen(!0,Fe(iy,re.nativeEvent)),T.context.inputRef.current?.focus())}},N.getValidationProps(G,b),ee],stateAttributesMapping:lA})}),K6=x.createContext(null);function Y6(){return x.useContext(K6)}function X6(e){const{children:t}=e,{filteredItems:a}=pf(),o=Y6(),c=o?o.items:a;return s.jsx(x.Fragment,{children:c.map(t)})}const Q6=x.forwardRef(function(t,a){var o;const{render:c,className:d,style:f,children:p,...h}=t,b=Ca(),y=Lh(),v=!!rw(!0),{filteredItems:w,hasItems:j}=pf(),S=b.useState("selectionMode"),N=b.useState("grid"),k=b.useState("readOnly"),T=b.useState("listProps"),D=b.useState("virtualized"),C=b.useState("forceMounted"),A=S==="multiple",R=w.length===0,I=Ie(z=>{b.set("positionerElement",z)}),P=Ie(z=>{b.set("listElement",z)}),O=x.useMemo(()=>typeof p=="function"?o||(o=s.jsx(X6,{children:p})):p,[p]),_={empty:R},L=y.useState("floatingId"),H=yt("div",t,{state:_,ref:[a,P,v?null:I],props:[T,{children:O,tabIndex:-1,id:L,role:N?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!N&&k?!0:void 0,onKeyDown(z){if(!(b.state.disabled||b.state.readOnly)&&z.key==="Enter"){const Q=b.state.activeIndex;if(Q==null)return;ks(z),uA(b,Q,z.nativeEvent)}},onKeyDownCapture(){b.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){b.context.keyboardActiveRef.current=!1}},h]});if(D)return H;const B=j&&!C?void 0:b.context.labelsRef;return s.jsx(Wy,{elementsRef:b.context.listRef,labelsRef:B,children:H})}),Z6="⁠",W6=200;function J6(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let a=null;for(;t.nextNode();){const o=t.currentNode;o.nodeValue!==""&&(a=o)}return a}function eF(){const e=Zs(),t=x.useRef(null);return x.useEffect(()=>{if(Yd)return;const a=t.current;if(a==null)return;const o=J6(a);if(o==null)return;const c=o.data,d=`${c}${Z6}`;return o.nodeValue=d,e.start(W6,()=>{o.nodeValue===d&&(o.nodeValue=c)}),()=>{e.clear(),o.nodeValue===d&&(o.nodeValue=c)}},[t,e]),t}const dA=x.createContext(void 0);function tF(){const e=x.useContext(dA);if(e===void 0)throw new Error(on(20));return e}const nF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=Ca(),f=d.useState("mounted"),p=d.useState("forceMounted");return f||o||p?s.jsx(dA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),sF=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N=!1,collisionAvoidance:k=X1,style:T,...D}=t,C=Ca(),A=Lh(),R=tF(),I=C.useState("modal"),P=C.useState("open"),O=C.useState("mounted"),_=C.useState("openMethod"),L=C.useState("positionerElement"),H=C.useState("triggerElement"),B=C.useState("inputElement"),z=C.useState("inputGroupElement"),Q=C.useState("inputInsidePopup"),K=C.useState("transitionStatus"),X=zh(),$=yh({anchor:d??(Q?H:z??B),floatingRootContext:A,positionMethod:f,mounted:O,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N,keepMounted:R,collisionAvoidance:k,lazyFlip:!0});tw(P&&I,_==="touch",L,H);const Y={open:P,side:$.side,align:$.align,anchorHidden:$.anchorHidden,empty:X};De(()=>{C.set("popupSide",$.side)},[C,$.side]);const F=Ie(W=>{C.set("positionerElement",W)}),G=wh(t,Y,{styles:$.positionerStyles,transitionStatus:K,props:D,refs:[a,F],hidden:!O,inert:!P});return s.jsxs(oA.Provider,{value:$,children:[O&&I&&s.jsx(kh,{inert:jh(!P),cutout:z??B??H}),G]})}),rF={...$c,...oo},aF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=Ca(),y=rw(),v=Lh(),w=b.useState("mounted"),j=b.useState("open"),S=b.useState("openMethod"),N=b.useState("popupProps"),k=b.useState("transitionStatus"),T=b.useState("inputInsidePopup"),D=b.useState("inputElement"),C=b.useState("modal"),A=b.useState("id"),R=zh(),I=h.id??(T?sA(A):void 0);De(()=>(b.set("popupId",b.context.popupRef.current?.id||I),()=>{b.set("popupId",void 0)}),[b,I]),ra({open:j,ref:b.context.popupRef,onComplete(){j&&b.context.onOpenChangeComplete(!0)}});const P={open:j,side:y.side,align:y.align,anchorHidden:y.anchorHidden,transitionStatus:k,empty:R},O=yt("div",t,{state:P,ref:[a,b.context.popupRef],props:[N,{id:I,role:T?"dialog":"presentation",onFocus(z){const Q=cs(z.nativeEvent);S!=="touch"&&(Qe(b.state.listElement,Q)||Q===z.currentTarget)&&b.context.inputRef.current?.focus()}},uf(k),h],stateAttributesMapping:rF}),L=f===void 0?T?z=>z==="touch"?b.context.popupRef.current:D:!1:f;let H;p!=null?H=p:H=T?void 0:!1;const B=!T||C;return s.jsx(oh,{context:v,disabled:!w,modal:B,openInteractionType:S,initialFocus:L,returnFocus:H,getInsideElements:()=>[b.context.startDismissRef.current,b.context.endDismissRef.current],children:s.jsxs(x.Fragment,{children:[O,B&&s.jsx(iA,{ref:b.context.endDismissRef})]})})}),lF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t;return yt("span",t,{ref:a,props:[{"aria-hidden":!0,children:"▼"},f]})}),fA=x.createContext(void 0);function pA(){const e=x.useContext(fA);if(!e)throw new Error(on(19));return e}const oF=x.createContext(!1);function iF(){return x.useContext(oF)}function mA(e){const{componentProps:t,forwardedRef:a,virtualized:o,indexFromFilter:c}=e,{render:d,className:f,style:p,value:h=null,index:b,disabled:y=!1,nativeButton:v=!1,...w}=t,j=x.useRef(null),S=Zy({guess:!0,index:b,textRef:j}),N=Ca(),k=iF(),T=R6(),D=N.useState("selectionMode"),C=N.useState("disabled"),A=N.useState("readOnly"),R=N.useState("isItemEqualToValue"),I=C||y,P=D!=="none",O=b??c??S.index,_=O!==-1,L=N.useState("id"),H=N.useState("isActive",O),B=N.useState("isSelected",h),z=N.useState("itemProps"),Q=x.useRef(null),K=L!=null&&_?`${L}-${O}`:void 0,X=B&&P;De(()=>{if(!(_&&(o||b!=null)))return;const U=N.context.listRef.current;return U[O]=Q.current,()=>{delete U[O]}},[_,o,O,b,N]),De(()=>{if(!_||T)return;const M=N.context.valuesRef.current;return M[O]=h,()=>{delete M[O]}},[_,T,O,h,N]),De(()=>{if(!_||T)return;const M=N.state.selectedValue;let U=N.state.selectedIndex;N.state.selectionMode==="multiple"&&Array.isArray(M)?U=_E(O,h,N.context.valuesRef.current,M,R,U):la(h,M,R)&&(U=O),N.set("selectedIndex",U)},[_,T,N,O,h,R]);const{getButtonProps:q,buttonRef:$}=Jr({disabled:I,focusableWhenDisabled:!0,native:v,composite:!0}),Y={disabled:I,selected:X,highlighted:H};function F(M){function U(){N.context.handleSelection(M,h)}N.state.submitOnItemClick?(Cs.flushSync(U),N.context.requestSubmit()):U()}const G={id:K,role:k?"gridcell":"option","aria-selected":P?X:void 0,tabIndex:void 0,onPointerDownCapture(M){M.isPrimary&&(N.context.pointerDownItemRef.current=M.currentTarget),M.preventDefault()},onMouseDown(M){M.preventDefault()},onClick(M){I||A||F(M.nativeEvent)},onMouseUp(M){const U=N.context.pointerDownItemRef.current===M.currentTarget;N.context.pointerDownItemRef.current=null,!(I||A||M.button!==0||U||!H)&&F(M.nativeEvent)}},W=yt("div",t,{ref:[$,a,S.ref,Q],state:Y,props:[z,G,w,q]}),le=x.useMemo(()=>({selected:X,textRef:j}),[X,j]);return s.jsx(fA.Provider,{value:le,children:W})}function cF(e){const{componentProps:t,forwardedRef:a}=e,c=Ca().useState("isItemEqualToValue"),{flatFilteredValues:d}=pf(),f=t.value??null,p=su(d,f,c);return s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:!0,indexFromFilter:p})}const uF=x.memo(x.forwardRef(function(t,a){const c=Ca().useState("virtualized");return c&&t.index==null?s.jsx(cF,{componentProps:t,forwardedRef:a}):s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:c,indexFromFilter:void 0})})),dF=x.forwardRef(function(t,a){const{selected:o}=pA();return t.keepMounted||o?s.jsx(fF,{...t,ref:a}):null}),fF=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=pA(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),pF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,...p}=t,{filteredItems:h}=pf(),b=Ca(),y=eF(),v=h.length===0?f:null;return yt("div",t,{ref:[a,b.context.emptyRef,y],props:[{children:v,role:"status","aria-live":"polite","aria-atomic":!0},p]})}),mF="、";function Bh({value:e,onValueChange:t,options:a,placeholder:o="",emptyHint:c=go("没有匹配的选项"),searchPlaceholder:d=go("搜索…"),disabled:f=!1,className:p,id:h,title:b,...y}){const v=x.useMemo(()=>a.filter(j=>e.includes(j.value)),[a,e]),w=v.length?v.map(j=>j.label).join(mF):o;return s.jsxs(z6,{items:a,multiple:!0,value:v,onValueChange:j=>t(j.map(S=>S.value)),isItemEqualToValue:(j,S)=>j?.value===S?.value,disabled:f,children:[s.jsxs(G6,{"data-slot":"multi-select-trigger",id:h,title:b,"aria-label":y["aria-label"],className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",p),children:[s.jsx("span",{"data-slot":"multi-select-value",className:"min-w-0 flex-1 truncate text-left data-[placeholder]:text-muted-foreground","data-placeholder":v.length?void 0:"",title:w,children:w}),s.jsx(lF,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),s.jsx(nF,{children:s.jsx(sF,{sideOffset:4,className:"z-[35]",children:s.jsxs(aF,{"data-slot":"multi-select-content",className:Ue("flex max-h-[280px] w-[max(var(--anchor-width),220px)] flex-col overflow-hidden","rounded-lg border border-border-strong bg-raised shadow-3 outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0"),children:[s.jsxs("div",{className:"flex flex-none items-center gap-1.5 border-b border-hairline px-2.5 py-1.5",children:[s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-3 flex-none text-muted-foreground","aria-hidden":"true",children:[s.jsx("circle",{cx:"5",cy:"5",r:"3.4",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),s.jsx("path",{d:"M7.6 7.6 10.5 10.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),s.jsx(q6,{placeholder:d,className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-[12.5px] text-foreground outline-none placeholder:text-muted-foreground"})]}),s.jsx(pF,{children:s.jsx("div",{className:"px-2.5 py-3 text-[11.5px] leading-[1.5] text-muted-foreground",children:c})}),s.jsx(Q6,{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-[5px]",children:j=>s.jsxs(uF,{value:j,className:Ue("grid cursor-pointer grid-cols-[14px_minmax(0,1fr)] items-center gap-2 rounded-sm px-[9px] py-[5px]","text-[12.5px] leading-[1.4] text-foreground select-none outline-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:text-muted-foreground"),children:[s.jsx(dF,{className:"col-start-1 flex text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("span",{className:"col-start-2 min-w-0 truncate",children:j.label})]},j.value)})]})})})]})}const hA=x.createContext(void 0);function mf(e){const t=x.useContext(hA);if(t===void 0&&!e)throw new Error(on(47));return t}const hF={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class gF extends tu{constructor(a,o,c){const d=new fh;super(xF(a,d,o,c),bF(d),hF);ln(this,"setOpen",(a,o)=>{const c=o.reason===Vs,d=o.reason===mo&&o.event.detail===0,f=!a&&(o.reason===Xc||o.reason==null),p=AT(o),h=this.select("activeTriggerId");if(!a&&o.reason===oy&&o.trigger==null&&h!=null&&(o.trigger=this.context.triggerElements.getById(h)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(a,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,o);const b=()=>{const v=Ry(this.state,a,o.trigger,p());v.openChangeReason=o.reason,this.update(v)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(eH,()=>{this.set("stickIfOpen",!1)}),Cs.flushSync(b)):b();let y;d?y="click":f?y="dismiss":o.reason===ho&&(y="focus"),this.set("instantType",y)})}}function xF(e,t,a,o=!1){const c={...Iy(t,a,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return c.open&&e?.mounted===void 0&&(c.mounted=!0),c}function bF(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new sa,triggerElements:e}}const gA=sh(function({props:t}){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,modal:p=!1,handle:h,triggerId:b,defaultTriggerId:y=null}=t,v=yF(h,{modal:p,open:c,openProp:o,activeTriggerId:y,triggerIdProp:b});v.useControlledProp("openProp",o),v.useControlledProp("triggerIdProp",b);const w=v.useState("open"),j=v.useState("mounted"),S=v.useState("payload");v.useContextCallback("onOpenChange",d),v.useContextCallback("onOpenChangeComplete",f),OT(v,w),Oy(v);const{forceUnmount:N}=My(w,v,()=>{v.update({stickIfOpen:!0,openChangeReason:null})});v.useSyncedValues({modal:p}),x.useEffect(()=>{w||v.context.stickIfOpenTimeout.clear()},[v,w]),x.useImperativeHandle(t.actionsRef,()=>({unmount:N,close:()=>v.setOpen(!1,Fe(cy))}),[N,v]);const k=w||j;return s.jsxs(hA.Provider,{value:v,children:[h&&s.jsx(Ay,{handle:h,store:v}),k&&s.jsx(wF,{store:v,modal:p}),typeof a=="function"?a({payload:S}):a]})});function vF(e){return mf(!0)?s.jsx(gA,{props:e}):s.jsx(oH,{children:s.jsx(gA,{props:e})})}function yF(e,t){const a=Ey((o,c)=>new gF(t,o,c));return x.useEffect(()=>a.context.stickIfOpenTimeout.disposeEffect(),[a]),a}function wF({store:e,modal:t}){const a=e.useState("floatingRootContext"),o=af(a,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),c=o.reference,d=o.floating;return Dy(e,{activeTriggerProps:c,inactiveTriggerProps:c,popupProps:d}),null}const jF=300;function SF(e,t){const a=x.useRef(null);function o(d){Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))}),t4(a.current)?.focus()}function c(d){const f=e.select("positionerElement");if(f&&Gc(d,f))e.context.beforeContentFocusGuardRef.current?.focus();else{Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))});let p=e4(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(f,p);){const h=p;if(p=ry(p),p===h)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}const NF=L1(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,handle:h,payload:b,openOnHover:y=!1,delay:v=jF,closeDelay:w=0,id:j,...S}=t,N=mf(!0),T=IT(h)??N;if(!T)throw new Error(on(74));const D=Na(j),C=T.useState("isTriggerActive",D),A=T.useState("floatingRootContext"),R=T.useState("isOpenedByTrigger",D),I=T.useState("triggerPopupId",D),P=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:_}=RT(D,P,T,{payload:b,disabled:f,openOnHover:y,closeDelay:w}),L=T.useState("openChangeReason"),H=T.useState("stickIfOpen"),B=T.useState("openMethod"),z=T.useState("focusManagerModal"),Q=zT(A,{enabled:!f&&y&&(B!=="touch"||L!==mo),mouseOnly:!0,move:!1,handleClose:FT(),restMs:v,delay:{close:w},triggerElementRef:P,isActiveTrigger:C,isClosing:()=>T.select("transitionStatus")==="ending"}),K=ih(A,{stickIfOpen:H}),X=bE(()=>T.select("open"),ae=>{T.set("openMethod",ae)}),q=T.useState("triggerProps",_),{getButtonProps:$,buttonRef:Y}=Jr({disabled:f,native:p}),F={open(ae){return ae&&L===mo?$v.open(ae):Fv.open(ae)}},{preFocusGuardRef:G,handlePreFocusGuardFocus:W,handleFocusTargetFocus:le}=SF(T,P),U=yt("button",t,{state:{disabled:f,open:R},ref:[Y,a,O,P],props:[K.reference,Q,q,X,{[Y1]:"",id:D,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":I},S,$],stateAttributesMapping:F}),Z=s.jsx(x.Fragment,{children:U},D);return _&&!z?s.jsxs(x.Fragment,{children:[s.jsx(Wc,{ref:G,onFocus:W}),Z,s.jsx(Wc,{ref:T.context.triggerFocusTargetRef,onFocus:le})]}):Z}),xA=x.createContext(void 0);function kF(){const e=x.useContext(xA);if(e===void 0)throw new Error(on(45));return e}const CF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return mf().useState("mounted")||o?s.jsx(xA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),bA=x.createContext(void 0);function TF(){const e=x.useContext(bA);if(!e)throw new Error(on(46));return e}const EF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,anchor:f,positionMethod:p,side:h,align:b,sideOffset:y,alignOffset:v,collisionBoundary:w="clipping-ancestors",collisionPadding:j,arrowPadding:S,sticky:N,disableAnchorTracking:k=!1,collisionAvoidance:T=Q1,...D}=t,C=mf(),A=kF(),R=aH(),I=C.useState("floatingRootContext"),P=C.useState("mounted"),O=C.useState("open"),_=C.useState("openChangeReason"),L=C.useState("activeTriggerElement"),H=C.useState("modal"),B=C.useState("openMethod"),z=C.useState("positionerElement"),Q=C.useState("instantType"),K=C.useState("transitionStatus"),X=C.useState("adaptiveOrigin"),q=x.useRef(null),$=N1(z),Y=yh({anchor:f,floatingRootContext:I,positionMethod:p,mounted:P,side:h,sideOffset:y,align:b,alignOffset:v,arrowPadding:S,collisionBoundary:w,collisionPadding:j,sticky:N,disableAnchorTracking:k,keepMounted:A,nodeId:R,collisionAvoidance:T,adaptiveOrigin:X}),F=I.useState("domReferenceElement");De(()=>{const U=F,Z=q.current;if(U&&(q.current=U),Z&&U&&U!==Z){C.set("instantType",void 0);const ae=new AbortController;return $(()=>{C.set("instantType","trigger-change")},ae.signal),()=>{ae.abort()}}},[F,$,C]);const G=H===!0&&_!==Vs;tw(O&&G,B==="touch",z,L);const W=C.useStateSetter("positionerElement"),le={open:O,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,instant:Q},M=wh(t,le,{styles:Y.positionerStyles,transitionStatus:K,props:D,refs:[a,W],hidden:!P,inert:!O});return s.jsxs(bA.Provider,{value:Y,children:[P&&G&&s.jsx(kh,{inert:jh(!O),cutout:L}),s.jsx(lH,{id:R,children:M})]})}),AF=x.createContext(void 0);function RF(){const[e,t]=x.useState(0),a=Ie(()=>(t(c=>c+1),()=>{t(c=>Math.max(0,c-1))}));return{context:x.useMemo(()=>({register:a}),[a]),hasClosePart:e>0}}const OF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=mf(),y=TF(),v=qE()!=null,{context:w,hasClosePart:j}=RF(),S=b.useState("open"),N=b.useState("openMethod"),k=b.useState("instantType"),T=b.useState("transitionStatus"),D=b.useState("popupProps"),C=b.useState("titleElementId"),A=b.useState("descriptionElementId"),R=b.useState("modal"),I=b.useState("mounted"),P=b.useState("openChangeReason"),O=b.useState("activeTriggerElement"),_=b.useState("floatingRootContext"),L=_.useState("floatingId"),H=b.useState("disabled"),B=b.useState("openOnHover"),z=b.useState("closeDelay");ra({open:S,ref:b.context.popupRef,onComplete(){S&&b.context.onOpenChangeComplete?.(!0)}}),LT(_,{enabled:B&&!H,closeDelay:z});const Q=f===void 0?TT(b.context.popupRef):f,K=R!==!1&&j;b.useSyncedValue("focusManagerModal",K);const X=b.useStateSetter("popupElement"),q={open:S,side:y.side,align:y.align,instant:k,transitionStatus:T},$=yt("div",t,{state:q,ref:[a,b.context.popupRef,X],props:[D,{id:L,role:"dialog",...lf,"aria-labelledby":C,"aria-describedby":A,onKeyDown(Y){v&&Sh.has(Y.key)&&Y.stopPropagation()}},uf(T),h],stateAttributesMapping:qv});return s.jsx(oh,{context:_,openInteractionType:N,modal:K,disabled:!I||P===Vs,initialFocus:Q,returnFocus:p,restoreFocus:"popup",previousFocusableElement:dn(O)?O:void 0,nextFocusableElement:b.context.triggerFocusTargetRef,beforeContentFocusGuardRef:b.context.beforeContentFocusGuardRef,children:s.jsx(AF.Provider,{value:w,children:$})})});function hf(e){return s.jsx(vF,{"data-slot":"popover",...e})}function Hh(e){return s.jsx(NF,{"data-slot":"popover-trigger",...e})}function gf({className:e,sideOffset:t=6,align:a="start",side:o,alignOffset:c,collisionPadding:d=8,anchor:f,children:p,...h}){return s.jsx(CF,{children:s.jsx(EF,{className:"z-[35] outline-none",sideOffset:t,align:a,side:o,alignOffset:c,collisionPadding:d,anchor:f,children:s.jsx(OF,{"data-slot":"popover-content",className:Ue("flex max-h-[min(70vh,560px)] flex-col overflow-hidden rounded-lg border border-border-strong bg-raised text-foreground shadow-3","outline-none","data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-top-1","data-closed:animate-out data-closed:fade-out-0",e),...h,children:p})})})}function MF({page:e,pageCount:t,onPageChange:a,disabled:o=!1,className:c,infoFirst:d=!1}){const f=Math.max(1,Number(t)||1),p=Math.min(Math.max(1,Number(e)||1),f),h=s.jsx("span",{"data-slot":"pager-info",className:"text-[11.5px] text-subtle [font-variant-numeric:tabular-nums]",children:go("第 {current} / {total} 页",{current:p,total:f})});return s.jsxs("div",{"data-slot":"pager",className:Ue("flex items-center gap-2",c),children:[d&&h,s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p<=1,onClick:()=>a(p-1),children:go("上一页")}),s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p>=f,onClick:()=>a(p+1),children:go("下一页")}),!d&&h]})}const DF=Vc(["relative flex w-full items-center gap-2.5 text-left","border border-transparent rounded-sm","shadow-none","transition-[background-color,border-color,color] duration-150 ease-out","outline-none focus-visible:shadow-focus","disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:["cursor-pointer px-2.5 py-2","text-[12.5px] font-medium text-sidebar-fg","hover:bg-nav-hover hover:text-foreground","data-[active]:border-nav-selected-border data-[active]:bg-nav-selected-bg data-[active]:font-semibold data-[active]:text-nav-selected-fg"],add:["cursor-pointer justify-center px-2 py-1.5","border-dashed border-border-strong bg-transparent","text-[11.5px] text-muted-foreground","hover:border-primary hover:text-primary-fg"]}},defaultVariants:{variant:"default"}});function ru({className:e,variant:t,active:a=!1,count:o,icon:c,trailing:d,children:f,...p}){return s.jsxs("button",{type:"button","data-slot":"nav-item","data-active":a?"":void 0,"aria-current":a?"true":void 0,className:Ue(DF({variant:t}),e),...p,children:[c,s.jsx("span",{"data-slot":"nav-item-label",className:"min-w-0 flex-1 truncate",children:f}),d,o!=null&&s.jsx("span",{"data-slot":"nav-item-count",className:Ue("flex-none text-[10.5px] text-sidebar-muted [font-variant-numeric:tabular-nums]",a&&"text-inherit"),children:o})]})}function r(e,t){const a=typeof window<"u"?window.wbI18n:void 0;return a&&typeof a.t=="function"?a.t(e,t):e}function Uh(e){if(e.source==="subscription"&&(e.port===null||e.port===void 0))return r("未分配端口");const t=e.resolved;return t?.protocol&&t.host&&t.port?`${String(t.protocol).toUpperCase()} ${t.host}:${t.port}`:t?.label||""}function au(e){const t=e.name||e.id,o=[e.resolveError?r("解析失败"):Uh(e),e.enabled===!1?r("已禁用"):""].filter(Boolean);return o.length?r("{name}({parts})",{name:t,parts:o.join(" · ")}):t}const Xa="pool:";function Pe(){return window}function Le(e,t){Pe().wbApp?.toast?.(e,t)}function Qa(e){const t=Pe().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function Fs(e){const t=Pe().wbApp?.formatTime;if(t)return t(e);const a=Number(e);return!Number.isFinite(a)||a<=0?"":new Date(a).toLocaleString("zh-CN")}function ut(e){return e instanceof Error?e.message:String(e)}function lu(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function aw(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const a=o=>String(o).padStart(2,"0");return`${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}`}function IF(e){return e==="积分"?r("积分"):e==="额度"?r("额度"):e}function PF(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e,a=Array.isArray(t.credits)?t.credits:[],o=Date.now();return a.map(c=>{const d=String(c?.name||"").trim()||r("积分包"),f=String(c?.unit||"").trim(),p=lu(c?.total),h=lu(c?.used),b=lu(c?.remain),y=c?.unlimited===!0,v=lu(c?.grantAt),w=lu(c?.startAt),j=lu(c?.expireAt),S=c?.daily===!0,N=String(c?.grantReason||"").trim(),k=j!==null&&j>0&&j<=o,T=p!==null&&p>0,D=y?r("不限"):b!==null?T?r("剩 {remaining} / {total}",{remaining:b,total:p}):r("剩 {remaining}",{remaining:b}):h!==null?r("已用 {used}",{used:h}):"—",C=!y&&f&&D!=="—"?`${D} ${IF(f)}`:D,A=T&&b!==null?Math.max(0,Math.min(100,b/p*100)):null,R=b!==null&&b<=0||b===null&&h!==null&&T&&h>=p,I=!y&&!S&&(R||k),P=[];v!==null&&v>0?P.push(r("{time} 领取",{time:aw(v)})):w!==null&&w>0&&P.push(r("{time} 生效",{time:aw(w)})),S?P.push(r("每日重置")):j!==null&&j>0&&P.push(k?r("已过期"):r("{time} 到期",{time:aw(j)})),N&&P.push(N);const O=k||b===0?"muted":A!==null&&A<20?"warn":b===null&&h===null&&!y?"muted":"ok",_=[d,C,v!==null&&v>0?r("领取 {time}",{time:Fs(v)}):w!==null&&w>0?r("生效 {time}",{time:Fs(w)}):"",j!==null&&j>0?k?r("已过期({time})",{time:Fs(j)}):r("到期 {time}",{time:Fs(j)}):"",S?r("每日重置(额度按周期回满,不是作废)"):"",N,A===null&&b!==null?r("上游未给总量,画不出剩余比例"):"",h!==null&&p!==null?r("已用 {used} / 共 {total}",{used:h,total:p}):""].filter(Boolean).join(" · ");return{name:d,view:C,tone:O,percent:A,window:P.length?P.join(" · "):null,title:_,spent:I}})}function vA({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.window?s.jsx("div",{className:"usage-pop-window",children:e.window}):null,e.percent!==null?s.jsx("span",{className:"usage-pop-track",children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function yA({rows:e,subscriptionLine:t,variant:a,kind:o,title:c,children:d}){const[f,p]=x.useState(!1),[h,b]=x.useState(!1),y=e.filter(k=>!k.spent),v=e.filter(k=>k.spent),w=a==="pool"?`usage-toggle usage-pool-line ${o}`:`usage-toggle ${o}`,j=x.useRef(null),S=x.useCallback(k=>{j.current=k,k&&(k.scrollTop=0)},[]),N=x.useCallback(()=>j.current??null,[]);return x.useLayoutEffect(()=>{if(!h)return;const k=j.current?.querySelector(".usage-pop-spent .usage-pop-row");k instanceof HTMLElement&&k.scrollIntoView({block:"nearest"})},[h]),s.jsxs(hf,{open:f,onOpenChange:p,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:w,title:c,"aria-label":r("积分明细")}),children:[a==="pool"?d:s.jsx("span",{className:"val",children:d}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsx(gf,{align:"end",sideOffset:6,className:"w-[320px]",initialFocus:N,children:s.jsxs("div",{className:"usage-pop-credit",ref:S,tabIndex:-1,children:[t?s.jsx("div",{className:"usage-pop-sub",children:t}):null,s.jsx("div",{className:"usage-pop-group",children:r("积分明细")}),y.map((k,T)=>s.jsx(vA,{row:k},`${k.name}-${T}`)),v.length>0?s.jsxs("div",{className:"usage-pop-spent",children:[s.jsxs("button",{type:"button",className:"usage-pop-spent-head","aria-expanded":h,title:r("展开或收起(默认收起)"),onClick:()=>b(k=>!k),children:[s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"}),s.jsx("span",{children:r("已用完 / 已过期")}),s.jsx("span",{className:"n",children:r("{count} 份",{count:v.length})})]}),h?v.map((k,T)=>s.jsx(vA,{row:k},`spent-${k.name}-${T}`)):null]}):null]})})]})}const ou="workbuddy",_F="raccoon",LF={workbuddy:{usage:!0,creditDetail:!0,edition:!0,identifier:"uid",expiry:"expiresAt"},"workbuddy-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},raccoon:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},catpaw:{usage:!0,edition:!1,identifier:"uid",expiry:"tokenExpiresAt"},autoclaw:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},"autoclaw-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!0},qoder:{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"qoder-intl":{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"cline-free":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},"cline-pass":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},accio:{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"accio-cn":{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},zcode:{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},"zcode-intl":{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},codearts:{usage:!0,usageDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt",concurrencyDefault:3},trae:{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},loomy:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt"},kuku:{usage:!0,edition:!1,identifier:"uid",expiry:""},officeace:{usage:!0,creditDetail:!0,edition:!1,identifier:"id",expiry:"expiresAt"},antigravity:{usage:!0,edition:!1,identifier:"userId",expiry:""},modelscope:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""},"modelscope-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""}},zF={usage:!1,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!1};function kn(e){const t=e?.provider;return typeof t=="string"&&t?t:ou}function ir(e){return e&&LF[e]||zF}const BF="opencode",HF="https://opencode.ai/zen/go/v1";function wA(e,t){if(!e||e.clientEmulation!==BF)return!1;const o=((typeof t=="string"?t.trim():"")||String(e.baseUrl||"")).trim().replace(/\/+$/,"").toLowerCase();return o?o!==HF:!1}function UF(e){const t=e?kn(e):"";return t.startsWith("custom-")&&(Pe().wbProviders?.customList?.()||[]).find(o=>o?.id===t)||null}function VF(e){return e?wA(UF(e),e.baseUrl):!1}function jA(e){const t=Array.isArray(e?.providers)?e.providers:[],a=Array.isArray(e?.accounts)?e.accounts:[],o=new Map;a.forEach(d=>{const f=kn(d);o.set(f,(o.get(f)||0)+1)});const c=new Map;return t.forEach(d=>{d?.id&&c.set(String(d.id),{id:String(d.id),label:String(d.label||d.id),count:Number(d.count)||0})}),o.forEach((d,f)=>{c.has(f)||c.set(f,{id:f,label:Pe().wbProviders?.labelOf?.(f)||f,count:d})}),c.size||c.set(ou,{id:ou,label:Pe().wbProviders?.labelOf?.(ou)||"WorkBuddy 国内版",count:0}),[...c.values()]}function Vh(e){const t=ir(kn(e)).identifier;return String(e?.[t]||"")}function SA(e){const t=Number(e)||0;return t<=0?0:t<1e11?t*1e3:t}function FF(e){const t=ir(kn(e)).expiry;return SA(e?.[t])}function Ta(e){const t=kn(e);return t.startsWith("custom-")?!!e?.balanceQuery?.scheme:ir(t).usage}const lw=30,NA=86400,kA=60,CA=1800,TA=86400,EA=1,$F=95e5;function qF(e){return e==="codearts"?[{type:"token",action:"skip",threshold:$F,reset:"daily",enabled:!0}]:e==="cline-free"?[]:[{type:"balance",action:"skip",threshold:EA,enabled:!0}]}function AA(e){const t=e?.usageQuery;if(!t||typeof t!="object")return{enabled:!0,interval:kA};const a=t.enabled===void 0?!0:t.enabled===!0,o=Number(t.interval)||0,c=o>=lw&&o<=NA;return{enabled:a,interval:a&&!c?kA:o}}function GF(e){if(!e||typeof e!="object")return!1;const t=e;if(t.type!=="balance"&&t.type!=="token"||t.action!=="skip"&&t.action!=="disable")return!1;const a=Number(t.threshold);if(!Number.isFinite(a)||a<=0)return!1;if(t.type==="token"&&t.reset!=="daily"){const o=Number(t.period);if(!Number.isInteger(o)||oTA)return!1}return!0}function KF(e){const t=e?.lowBalance;if(!t||typeof t!="object"||!t.mode)return qF(kn(e));const a=Number(t.threshold),o=Number.isFinite(a)&&a>0?a:EA;return t.mode!=="skip"&&t.mode!=="disable"?[]:[{type:"balance",action:t.mode,threshold:o,enabled:!0}]}function iu(e){const t=e?.limiters;return Array.isArray(t)?t.filter(GF):KF(e)}function YF(e){return iu(e).filter(t=>t.type==="token")}function XF(e,t){const a=t*1e3;return e-e%a}function RA(e){return e.reset==="daily"?0:e.period??0}function ow(e,t=Date.now()){if(e===0){const a=new Date(t);return a.setHours(0,0,0,0),a.getTime()}return XF(t,e)}function xf(e,t,a=Date.now()){if(e.type!=="token")return null;const o=RA(e),c=(t||[]).find(d=>Number(d.kind)===o);return c&&Number(c.windowStart)===ow(o,a)?c:null}function Fh(e,t){const a=iu(e).filter(f=>f.type==="balance"&&f.action==="skip"&&f.enabled!==!1&&f.threshold>0);if(!a.length||!t||typeof t!="object")return!1;const o=t;if(o.unlimited)return!1;const c=o.totalLeft??o.available;if(c==null||c==="")return!1;const d=Number(c);return Number.isFinite(d)&&a.some(f=>dc.type==="token"&&c.action==="skip"&&c.enabled!==!1);if(!a.length||!t?.length)return!1;const o=Date.now();return a.some(c=>{const d=xf(c,t,o);return d!==null&&Number(d.used)>=c.threshold})}function QF(e,t){return iu(e).some(a=>{if(a.type!=="token"||a.action!=="disable"||a.enabled===!1)return!1;const o=xf(a,t);return o!==null&&Number(o.used)>=a.threshold})}function cw(e,t=Date.now()){const a=RA(e),o=ow(a,t),c=a===0?Math.max(0,ow(0,o+864e5+36e5)-t):Math.max(0,o+a*1e3-t);return{kind:a,startMs:o,remainingMs:c,daily:a===0}}function $h(e,t){if(e<=0)return"";const a=Math.ceil(e/6e4);if(t){const o=Math.ceil(e/36e5);return o>=1?r("今日剩 {n} 小时",{n:o}):r("今日剩 {n} 分钟",{n:a})}return a>=1?r("剩 {n} 分钟",{n:a}):r("剩不到 1 分钟")}function Tl(e){const t=Number(e);if(!Number.isFinite(t))return"—";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(Math.round(t))}function OA(e){return e>0&&e%3600===0?r("{n} 小时",{n:e/3600}):e>0&&e%60===0?r("{n} 分钟",{n:e/60}):r("{n} 秒",{n:e})}function bf(e){return e?.desktop===!0}function MA(e){return e?.chatSupported!==!1}function ZF(e){return typeof e=="string"&&e.startsWith("custom-")}function WF(e){return r(e==="enterprise"?"企业":e==="ultimate"?"旗舰":"个人")}function qh(e,t){const a=Number(e?.priority??100)-Number(t?.priority??100);return a!==0?a:(Number(e?.addedAt)||0)-(Number(t?.addedAt)||0)}function cr(e){return e?.enabled!==!1}function vf(e,t=""){const a=e?.rateLimits||{},o=Date.now();return t?Number(a[t]?.resetAt)>o:Object.values(a).some(c=>Number(c?.resetAt)>o)}function DA(e){return e?.edition==="intl"?"intl":"cn"}function IA(e){return ir(kn(e)).claim?e?.canClaim!==!1:!1}const PA="coding-plan",wo="start-plan";function Gh(e){return!!ir(kn(e)).planChannel}function uw(e){return Gh(e)?String(e?.zcodePlan||"").trim()===wo?wo:PA:""}function JF(e){return r(e===wo?"活动套餐(Start Plan)":"编码套餐(Coding Plan)")}function _A(e){switch(String(e??"").trim()){case"pending":return r("待生效");case"active":return r("生效中");case"expired":return r("已过期");case"unknown":return r("状态未知");default:return String(e??"")}}function Kh(e){const t=e?.claimPlans;if(!t||typeof t!="object"||Array.isArray(t))return[];const a=dw();return Object.entries(t).filter(([,o])=>Number(o)>0&&dw(Number(o))===a).map(([o])=>o)}function e$(e){return Kh(e).length>0}function t$(e){const t=Kh(e),a=t.length?r("({plans})",{plans:t.join(r("、"))}):"";return r("今天(北京时间 {day})已领取 {n} 份{names};还有其他可领套餐时,点这里可以继续领;活动按自然日发新套餐,明天可再领",{day:dw(),n:t.length,names:a})}function n$(e){return!!ir(kn(e)).usageDetail}function LA(e){return!!ir(kn(e)).creditDetail}function zA(e){return/^free$/i.test(String(e??"").trim())}function s$(e){const t=String(e??"").trim();return/^trial$/i.test(t)?r("试用版"):zA(t)?r("免费版"):t}function dw(e=Date.now()){return new Date(e+8*3600*1e3).toISOString().slice(0,10)}function yf(e,t,a){return vf(e)||Fh(e,t)||iw(e,a)}function BA(e,t){const a=String(t.q||"").trim().toLowerCase();return a?[cu(e),e?.name,e?.nickname,e?.email,Vh(e),e?.id].some(c=>String(c||"").toLowerCase().includes(a)):!0}function HA(e,t){return t.provider==="all"||kn(e)===t.provider}function fw(e,t){return t.enabled==="all"?!0:t.enabled==="enabled"?cr(e):!cr(e)}function UA(e,t,a,o){if(t.limit==="all")return!0;if(!cr(e))return!1;const c=yf(e,a?.(e),o?.(e));return t.limit==="limited"?c:!c}function VA(e,t,a,o){return HA(e,t)&&fw(e,t)&&UA(e,t,a,o)&&BA(e,t)}function r$(e,t,a,o){return(e||[]).filter(c=>VA(c,t,a,o))}function FA(e,t,a,o){const c=e||[],d=h=>c.filter(b=>HA(b,t)&&(h==="enabled"||fw(b,t))&&BA(b,t)),f=d("enabled"),p=d("limit");return{enabledAll:f.length,enabled:f.filter(cr).length,disabled:f.filter(h=>!cr(h)).length,limitAll:p.length,normal:p.filter(h=>cr(h)&&!yf(h,a?.(h),o?.(h))).length,limited:p.filter(h=>cr(h)&&yf(h,a?.(h),o?.(h))).length}}function pw(e){const t=e?.rateLimits;if(!t||typeof t!="object")return[];const a=Date.now();return Object.entries(t).map(([o,c])=>({model:o,...c&&typeof c=="object"?c:{}})).filter(o=>Number(o.resetAt)>a).sort((o,c)=>Number(o.resetAt)-Number(c.resetAt))}function mw(e){const t=(e||[]).slice().sort(qh),a=new Map;return t.forEach((o,c)=>a.set(o.id,{position:c+1,total:t.length})),a}function a$(e,t,a,o){const c=(e||[]).slice().sort(qh),d=[],f=new Map;for(const p of c){const h=kn(p);f.has(h)||(f.set(h,[]),d.push(h)),f.get(h).push(p)}return d.map((p,h)=>{const b=f.get(p)||[];return{provider:p,label:Pe().wbProviders?.labelOf?.(p)||p,rank:h+1,members:b,accounts:t?b.filter(t):b,enabled:b.filter(cr).length,disabled:b.filter(y=>!cr(y)).length,limited:b.filter(y=>cr(y)&&yf(y,a?.(y),o?.(y))).length}})}function cu(e){if(!e)return"";const t=String(e.name||"").trim();if(e.nameCustom===!0&&t)return t;const a=String(e.email||"").trim();return ir(kn(e)).emailAsName&&a?a:e?.nickname||t||Vh(e)||e?.id||""}const hw="已限流",$A=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function gw(e){const t=Number(e);if(!Number.isFinite(t)||t<=0||t<=Date.now())return hw;const a=new Date(t),o=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",hour12:!1}),c=Math.round(($A(a)-$A(new Date))/864e5);return c===0?r("今天 {clock}",{clock:o}):c===1?r("明天 {clock}",{clock:o}):r("{month}月{day}日 {clock}",{month:a.getMonth()+1,day:a.getDate(),clock:o})}function l$(e){const t=kn(e);if(!ir(t).edition)return"";const a=DA(e),o=e?.editionLabel,c=o||(a==="intl"?"国际版":"国内版");return(Pe().wbProviders?.labelOf?.(t)||"").includes(c)?"":o||r(a==="intl"?"国际版":"国内版")}function o$(e){return[MA(e)?null:{text:r("仅账号管理"),kind:"plain",title:r("该提供商的推理转发尚未接入,账号不参与转发")},ZF(kn(e))&&e.hasCredentials===!1?{text:r("未配置凭证"),kind:"bad",title:r("这条自定义账号既没有 API Key,也没有勾选「无需鉴权」:转发时会被跳过,该提供商下的模型也不会出现在模型列表里。去账号「设置」里补上 Key,或勾选「该上游无需鉴权」")}:null,e.proxy?.error?{text:r("代理异常"),kind:"bad",title:r("{error}(转发时会回退直连)",{error:e.proxy.error})}:null,uw(e)===wo?{text:r("活动套餐"),kind:"plain",title:r("转发走活动套餐通道(zcode.z.ai 的 Anthropic 端点,用账号里领到的额度);在账号设置里可切回编码套餐")}:null].filter(t=>t!==null)}const qA="workbuddy-desktop-accounts-filters",GA="workbuddy-desktop-accounts-collapsed",KA="workbuddy-desktop-accounts-names-hidden";function i$(){const e={provider:"all",enabled:"all",limit:"all",q:""},t=Pe().wbFilterMemory?.load(qA,e)||e;return{provider:String(t.provider||"all"),enabled:String(t.enabled||"all"),limit:String(t.limit||"all"),q:""}}function c$(){try{const e=JSON.parse(localStorage.getItem(GA)||"[]");return new Set(Array.isArray(e)?e.map(t=>String(t)).filter(Boolean):[])}catch{return new Set}}function u$(){try{return localStorage.getItem(KA)==="1"}catch{return!1}}let pn={version:0,filter:i$(),collapsed:c$(),selected:new Set,panels:new Map,connections:new Map,clash:null,dialog:null,namesHidden:u$(),usageBusy:!1,usageInflight:new Set};const xw=new Set;function YA(e){return xw.add(e),()=>{xw.delete(e)}}function Ws(){return pn}function Cn(e){pn={...pn,...e,version:pn.version+1},xw.forEach(t=>t())}function br(){Cn({})}function bw(){return Pe().wbApp?.getState?.()?.accounts}function El(){const e=bw()?.accounts;return Array.isArray(e)?e:[]}function Ea(e){return El().find(t=>t.id===e)||null}function d$(e,t){const a=a$(El(),c=>VA(c,pn.filter,e,t),e,t);return{groups:a.filter(c=>c.accounts.length>0),allGroups:a}}function XA(){return jA(bw())}function f$(e,t){return FA(El(),pn.filter,e,t)}function p$(){return mw(El())}function Yh(){Pe().wbFilterMemory?.save(qA,{provider:pn.filter.provider,enabled:pn.filter.enabled,limit:pn.filter.limit})}function m$(e){pn.filter.q!==e&&Cn({filter:{...pn.filter,q:e}})}function h$(e){const t=e||"all";pn.filter.provider!==t&&(Cn({filter:{...pn.filter,provider:t}}),Yh())}function QA(e,t){const a={...pn.filter,[e]:t};a.enabled==="disabled"&&a.limit!=="all"&&(a.limit="all"),Cn({filter:a}),Yh()}function Xh(){return pn.filter.provider!=="all"||pn.filter.enabled!=="all"||pn.filter.limit!=="all"||pn.filter.q.trim()!==""}function ZA(){Cn({filter:{provider:"all",enabled:"all",limit:"all",q:""}}),Yh()}function g$(){const e=pn.filter.provider;e!=="all"&&(XA().some(t=>t.id===e)||(Cn({filter:{...pn.filter,provider:"all"}}),Yh()))}function WA(e){try{localStorage.setItem(GA,JSON.stringify([...e]))}catch{}}function JA(e){const t=new Set(pn.collapsed);t.has(e)?t.delete(e):t.add(e),WA(t),Cn({collapsed:t})}function x$(e,t){const a=new Set(pn.collapsed);for(const o of e)t?a.add(o):a.delete(o);WA(a),Cn({collapsed:a})}function b$(e){return pn.selected.has(e)}function v$(e,t){const a=new Set(pn.selected);t?a.add(e):a.delete(e),Cn({selected:a})}function eR(e,t){const a=new Set(pn.selected);for(const o of e)t?a.add(o):a.delete(o);Cn({selected:a})}function y$(){Cn({selected:new Set})}function tR(e,t){return pn.panels.get(e)?.has(t)===!0}function nR(e,t,a){if(!e)return;const o=new Map(pn.panels),c=new Set(o.get(e)||[]);a?c.add(t):c.delete(t),c.size?o.set(e,c):o.delete(e),Cn({panels:o})}function w$(e,t){const a=new Map(pn.panels);for(const o of e){const c=new Set(a.get(o)||[]);c.add(t),a.set(o,c)}Cn({panels:a})}function j$(){const e=!pn.namesHidden;try{localStorage.setItem(KA,e?"1":"0")}catch{}Cn({namesHidden:e})}function S$(e){return"*".repeat(Math.min(Math.max(e.length,4),12))}const sR="usage_not_configured",jo=new Map,wf=new Map;function oa(e,t,a){jo.set(e,t),t!=null&&uu(t)?wf.set(e,a):wf.delete(e)}function Za(e){const t=jo.get(e.id);if(t===void 0)return;if(!uu(t))return t;const a=Math.max(Number(e.addedAt)||0,Number(e.updatedAt)||0);return(wf.get(e.id)||0)>=a?t:void 0}const jf=new Map;let rR=0;function Al(e){return e?jf.get(e.id)||[]:[]}function N$(e){const t=Number(e?.tokenAt)||0;if(!t||t===rR)return!1;const a=e?.tokenUsage;if(!a||typeof a!="object")return!1;rR=t;const o=new Map;for(const[d,f]of Object.entries(a)){if(!Array.isArray(f))continue;const p=[];for(const h of f){if(!h||typeof h!="object")continue;const b=Number(h.kind),y=Number(h.windowStart),v=Number(h.used);!Number.isFinite(b)||b<0||!Number.isFinite(y)||y<=0||!Number.isFinite(v)||v<0||p.push({kind:b,windowStart:y,used:v})}o.set(d,p)}const c=o.size!==jf.size||[...o].some(([d,f])=>{const p=jf.get(d);return!p||p.length!==f.length||f.some((h,b)=>h.used!==p[b]?.used||h.windowStart!==p[b]?.windowStart)});jf.clear();for(const[d,f]of o)jf.set(d,f);return c}let Qh=null;async function aR(e={}){const t=Ws().clash;if(!e.force&&t)return t;Qh||(Qh=(async()=>{try{const o=await Pe().workbuddyDesktop?.getProxies?.();if(!o||typeof o!="object"||!o.clash)throw new Error(r("代理列表响应异常({type})",{type:typeof o}));return o.clash}finally{Qh=null}})());const a=await Qh;return Cn({clash:a}),a}function k$(){Cn({clash:null})}let Sf=null,Zh=null;function C$(){return Sf}async function lR(e={}){if(!e.force&&Sf)return Sf;Zh||(Zh=(async()=>{try{const a=await Pe().workbuddyDesktop?.getProxyPool?.();if(!a||typeof a!="object"||!Array.isArray(a.items))throw new Error(r("代理池响应异常({type})",{type:typeof a}));return a.items}finally{Zh=null}})());const t=await Zh;return Sf=t,t}let vw=null;function T$(){return vw}let Wh=0,oR=!1;function E$(){if(!(Sf||Date.now(){Wh=0,vw=null,br()}).catch(e=>{vw=ut(e),br()})}}function Jh(e){if(!Ea(e)){Le(r("账号不存在,请刷新后重试"),"err");return}Cn({dialog:{kind:"settings",id:e}})}function eg(){Cn({dialog:null})}function yw(e,t="enable"){const a=(Array.isArray(e)?e:[]).filter(o=>Ea(o));if(!a.length){Le(r("请先勾选要操作的账号"),"err");return}Cn({dialog:{kind:"batch",ids:a,action:t}})}function A$(e){let t=!1;for(const f of[...jo.keys()])e.has(f)||(jo.delete(f),t=!0);for(const f of[...wf.keys()])e.has(f)||wf.delete(f);const a=new Map(Ws().panels);for(const f of[...a.keys()])e.has(f)||(a.delete(f),t=!0);const o=new Map(Ws().connections);for(const f of[...o.keys()])e.has(f)||(o.delete(f),t=!0);const c=new Set(Ws().usageInflight);for(const f of[...c])e.has(f)||(c.delete(f),t=!0);const d=new Set(Ws().selected);for(const f of[...d])e.has(f)||(d.delete(f),t=!0);t&&Cn({panels:a,connections:o,usageInflight:c,selected:d})}const R$=2e3;function iR(e){return Ws().connections.get(e)||0}async function cR(){try{const e=await Pe().workbuddyDesktop?.getAccountConnections?.(),t=e?.counts&&typeof e.counts=="object"?e.counts:{},a=new Map;for(const[o,c]of Object.entries(t)){const d=Number(c)||0;d>0&&a.set(o,d)}return Cn({connections:a}),!0}catch{return!1}}let uR=null;function O$(){uR||(uR=setInterval(()=>{document.hidden||Pe().wbApp?.currentPage!=="accounts"||cR()},R$))}function ww(){return El().filter(e=>Ta(e)&&e.available!==!1)}function uu(e){if(e==null)return null;if(typeof e=="string")return{message:e,notConfigured:!1};if(typeof e!="object")return null;const t=e.error;return t?{message:String(t),notConfigured:e.code===sR}:null}function dR(e){return e.usage?e.usage:{error:e.error?String(e.error):r("余额响应为空"),code:e.code}}function fR(e){const t=Array.isArray(e?.results)?e.results:[],a=Number(e?.at)||Date.now();let o=0;for(const c of t)c?.id&&(oa(String(c.id),dR(c),Number(c.at)||a),o++);return o&&(br(),Pe().wbApp?.renderTopbarStatus?.()),o}let pR=!1;function M$(e){if(!LA(e))return!1;const t=Za(e);return!t||typeof t!="object"||Array.isArray(t)||uu(t)?!1:!Array.isArray(t.credits)}async function D$(){if(!pR){pR=!0;for(const e of El().filter(M$)){const t=jo.get(e.id);try{await Nf(e.id)}catch{}const a=jo.get(e.id);t!==void 0&&(!a||uu(a))&&oa(e.id,t,Date.now()),br()}}}let mR=0;async function I$(){try{const e=await Pe().workbuddyDesktop?.getBalancesSnapshot?.(),t=N$(e);t&&(br(),Pe().wbApp?.renderTopbarStatus?.());const a=Number(e?.at)||0;return!a||a===mR||(mR=a,!fR(e))?t:(D$(),!0)}catch{return!1}}async function Nf(e){const t=await Pe().workbuddyDesktop?.getAllBalances?.(e||void 0),a=Array.isArray(t?.results)?t.results:[],o=Date.now(),c=new Set;for(const d of a){if(!d?.id)continue;const f=String(d.id);e&&f!==e||(c.add(f),oa(f,dR(d),o))}if(e)return c.has(e)||oa(e,r("未返回余额数据"),o),br(),t;for(const d of ww())c.has(d.id)||oa(d.id,r("未返回余额数据"),o);return br(),t}async function hR(){if(Ws().usageBusy)return;const e=ww();if(!e.length){Le(r("暂无可查询余额的账号"),"err");return}Cn({usageBusy:!0}),e.forEach(t=>oa(t.id,null,Date.now())),br();try{const t=(await Nf(null))?.results||[],a=t.filter(f=>f.usage).length,o=t.filter(f=>f.code===sR).length,c=o?r("({n} 个未配置查询凭证)",{n:o}):"",d=t.length-a-o;Le(a+o===t.length?r("✅ 已更新 {n} 个账号的余额{suffix}",{n:a,suffix:c}):r("已更新 {ok}/{total} 个账号,{failed} 个失败",{ok:a,total:t.length,failed:d}),d?"err":"ok")}catch(t){const a=ut(t);e.forEach(o=>oa(o.id,r("查询失败:{message}",{message:a}),Date.now())),br(),Le(r("余额查询失败:{message}",{message:a}),"err")}finally{Cn({usageBusy:!1})}}async function gR(e){if(Ws().usageInflight.has(e))return;const t=new Set(Ws().usageInflight);t.add(e),oa(e,null,Date.now()),Cn({usageInflight:t});try{await Nf(e)}finally{const a=new Set(Ws().usageInflight);a.delete(e),Cn({usageInflight:a})}}async function P$(e){if(!Ws().usageInflight.has(e))try{await gR(e);const t=uu(jo.get(e));t?.notConfigured?Le(t.message,"ok"):t?Le(r("余额查询失败:{message}",{message:t.message}),"err"):Le(r("✅ 已更新余额"))}catch(t){oa(e,r("查询失败:{message}",{message:ut(t)}),Date.now()),br(),Le(r("余额查询失败:{message}",{message:ut(t)}),"err")}}async function tg(e){if(e){const a=Ea(e);if(!a||!Ta(a))return;try{await gR(e)}catch(o){oa(e,r("查询失败:{message}",{message:ut(o)}),Date.now()),br()}return}if(Ws().usageBusy)return;const t=ww();if(t.length){Cn({usageBusy:!0}),t.forEach(a=>oa(a.id,null,Date.now())),br();try{await Nf(null)}catch(a){const o=ut(a);t.forEach(c=>oa(c.id,r("查询失败:{message}",{message:o}),Date.now())),br()}finally{Cn({usageBusy:!1})}}}async function xR(e,t){try{await Pe().workbuddyDesktop?.updateAccount?.(e,{enabled:t}),await Pe().wbApp?.refresh?.(),Le(r(t?"✅ 已启用":"✅ 已禁用"))}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function bR(e,t){if(!e.length)return!1;try{return await Pe().workbuddyDesktop?.reorderAccounts?.(e),Le(t?r("✅ 已保存:{note}",{note:t}):r("✅ 顺序已保存")),await Pe().wbApp?.refresh?.(),!0}catch(a){return Le(r("顺序未保存:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.(),!1}}async function vR(e,t){if(e.length)try{await Pe().workbuddyDesktop?.batchAccounts?.({action:t?"enable":"disable",ids:e}),Le(t?r("✅ 已启用 {n} 个账号",{n:e.length}):r("✅ 已禁用 {n} 个账号",{n:e.length})),await Pe().wbApp?.refresh?.()}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function _$(e,t){try{await Pe().workbuddyDesktop?.clearRateLimits?.(e,t||null),Le(t?r("✅ 已清除 {model} 的限流标记",{model:t}):r("✅ 已清除该账号全部限流标记")),await Pe().wbApp?.refresh?.()}catch(a){Le(r("清除失败:{message}",{message:ut(a)}),"err")}}async function L$(e,t,a){if(t===yR){Jh(e);return}if(t!==ng&&t!==a)try{const o=t===""?null:{source:"pool",proxyId:t.slice(Xa.length)},d=(await Pe().workbuddyDesktop?.updateAccount?.(e,{proxy:o}))?.changes,f=Array.isArray(d)&&d.length?d[0]:r("代理已更新");Le(`✅ ${f}`)}catch(o){Le(r("保存失败:{message}",{message:ut(o)}),"err")}finally{await Pe().wbApp?.refresh?.()}}const ng="__proxy_custom__",yR="__proxy_custom_edit__";function wR(e,t){const a=Ea(e);if(!a){Le(r("账号不存在,请刷新后重试"),"err");return}const o=Pe().wbZcodePlans;if(!o?.open){Le(r("套餐明细弹窗未加载,请重启应用后重试"),"err");return}o.open({id:e,name:t||a.name})}function z$(e,t,a=1){return{seat:t.get(e.id)||{position:1,total:1},rank:a,picked:b$(e.id),usageEntry:jo.get(e.id),limitsOpen:tR(e.id,"limits"),connections:iR(e.id)}}const B$={DEFAULT_PROVIDER_ID:ou,RACCOON_PROVIDER_ID:_F,providerOf:kn,providerFeatures:ir,providerSummaries:jA,identifierOf:Vh,tokenExpiryOf:FF,supportsUsage:Ta,isDesktopAccount:bf,supportsChat:MA,byPriorityOrder:qh,typeLabel:WF,isEnabled:cr,isRateLimited:vf,isLimited:e=>yf(e,e?Za(e):void 0,Al(e)),accountEdition:DA,supportsClaim:IA,matchEnabled:fw,matchLimit:UA,visibleAccounts:r$,filterCounts:FA,positionMap:mw,activeLimits:pw,editionSuffix:l$,formatResetText:gw};function H$(){window.wbAccountsView={render:()=>br(),refreshCaches:A$,openPanels:w$,syncConnections:cR,applyBalances:fR,syncBalancesSnapshot:I$,queryUsageFor:Nf,queryAllUsage:hR,refreshUsageAfterCheckin:tg,supportsUsage:Ta,isDesktopAccount:bf,isEnabled:cr,isRateLimited:vf},window.wbAccountsModel=B$,window.wbAccountPanel={open:Jh,close:eg,openBatch:yw,closeBatch:eg,syncAddProvider:()=>Pe().wbAccountAddForms?.syncAddProvider?.(),invalidate:k$}}function U$(e){return e.type==="balance"?r("余额 < {threshold}",{threshold:e.threshold}):e.reset==="daily"?r("每日消耗 ≥ {count} Token(每天 0 点重置)",{count:Tl(e.threshold)}):r("每 {period}消耗 ≥ {count} Token",{period:OA(e.period??0),count:Tl(e.threshold)})}function V$(e){return e.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(自动恢复)")}function F$(e){return`${Math.round(e.threshold).toLocaleString("en-US")} Token`}function $$(e,t){if(t.enabled===!1)return{text:r("已停用"),kind:"off"};if(t.type==="balance"){const b=Za(e),y=Fh(e,b),v=b&&typeof b=="object"?b:null,w=v?v.totalLeft??v.available:void 0,j=w==null||w===""||v?.unlimited?"":r(" · 当前 {n}",{n:Number(w)});return y?{text:r("已跳过{current}",{current:j}),kind:"warn",title:r("余额低于阈值,转发时会跳过该账号(余额回升自动恢复)")}:{text:r("未触发{current}",{current:j}),kind:"ok"}}const a=Al(e),o=xf(t,a),c=o?o.used:0,d=Tl(t.threshold),f=t.reset==="daily"?r(" · 今日 {used} / {quota}",{used:Tl(c),quota:d}):r(" · 本周期 {used} / {quota}",{used:Tl(c),quota:d}),p=o?` · ${$h(cw(t).remainingMs,t.reset==="daily")}`:"";return o!==null&&c>=t.threshold?t.action==="disable"?e.enabled===!1?{text:r("已触发 · 账号已禁用"),kind:"danger",title:r("重置也不恢复,需手动启用")}:{text:r("已达上限{usage}",{usage:f}),kind:"warn",title:r("稍后由后台判定自动禁用")}:{text:r("已跳过{usage}{countdown}",{usage:f,countdown:p}),kind:"warn",title:r("窗口内已用 {used} / {limit} Token,转发时会跳过该账号(重置后自动恢复)",{used:Math.round(c).toLocaleString("en-US"),limit:Math.round(t.threshold).toLocaleString("en-US")})}:{text:r("未触发{usage}{countdown}",{usage:f,countdown:p}),kind:"ok",title:F$(t)}}function q$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:{value:"1",unit:"hours"}}function jR(e){const t={type:"balance",action:"skip",thresholdInput:"",tokenUnit:"wan",reset:"fixed",periodInput:"1",periodUnit:"hours"};if(!e)return t;if(e.type==="balance")return{...t,type:"balance",action:e.action,thresholdInput:String(e.threshold)};if(e.reset==="daily")return{...t,type:"token",action:e.action,reset:"daily",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit"};const a=q$(e.period??0);return{...t,type:"token",action:e.action,reset:"fixed",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit",periodInput:a.value,periodUnit:a.unit}}function SR(e){const t=Number(e.thresholdInput);if(!Number.isFinite(t)||t<=0)return{error:r("限制阈值必须是大于 0 的数字")};if(e.type==="balance")return{rule:{type:"balance",action:e.action,threshold:t,enabled:!0}};const a=Math.round(e.tokenUnit==="wan"?t*1e4:t);if(e.reset==="daily")return{rule:{type:"token",action:e.action,threshold:a,reset:"daily",enabled:!0}};const o=Number(e.periodInput)*(e.periodUnit==="hours"?3600:60);if(!Number.isFinite(o)||o<=0)return{error:r("请填写重置周期")};const c=Math.round(o);return cTA?{error:r("重置周期必须是 30 分钟 ~ 24 小时")}:{rule:{type:"token",action:e.action,threshold:a,period:c,reset:"fixed",enabled:!0}}}function G$({account:e,target:t,onClose:a,onSave:o}){const[c,d]=x.useState(""),[f,p]=x.useState(t?.draft??null);if(x.useEffect(()=>{p(t?.draft??null),d("")},[t]),!t||!f)return null;const h=v=>{d(""),p({...f,...v})},b=()=>{const v=SR(f);if("error"in v){d(v.error);return}o(v.rule,t.index)},y=()=>{if(f.type==="balance"){const D=Za(e);if(D&&typeof D=="object"){const C=D;if(C.unlimited)return r("当前可用 ∞(不参与余额不足判定)");const A=C.totalLeft??C.available;if(A!=null&&A!=="")return r("当前余额 {n};与余额列同一数字口径,严格小于才触发(等于阈值仍可用)",{n:Number(A)})}return r("读数来自自动余额查询;与余额列同一数字口径,严格小于才触发(等于阈值仍可用)")}const v=SR(f);if(!("rule"in v))return"";const w=v.rule,j=xf(w,Al(e));if(!j)return w.reset==="daily"?r("窗口 = 今天 0 点起(本地时区),0 点重置即清零恢复;按账号在 requests 表聚合"):r("窗口对齐自然时间(整点 / 整 N 分钟一轮回),重置即清零恢复;按账号在 requests 表聚合");const S=cw(w),N=Tl(j.used),k=Tl(w.threshold),T=w.reset==="daily"?r("今日已用"):r("本周期已用");return r("{scope} {used} / {quota} Token,{countdown}重置",{scope:T,used:N,quota:k,countdown:$h(S.remainingMs,S.daily)})};return s.jsx(Qt,{open:!0,onOpenChange:v=>{v||a()},children:s.jsxs(Zt,{className:"w-[min(580px,calc(100vw-48px))]",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t.index>=0?r("编辑限制"):r("添加限制")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("限制类型")}),s.jsxs(ft,{value:f.type,onValueChange:v=>h({type:v,thresholdInput:""}),children:[s.jsx(mt,{className:"w-[150px]","aria-label":r("限制类型"),children:s.jsx(pt,{children:f.type==="balance"?r("余额"):r("Token 消耗")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"balance",children:r("余额")}),s.jsx(qe,{value:"token",children:r("Token 消耗")})]})]}),s.jsx("span",{className:"detail",children:r("余额沿用现有口径;Token 按重置方式内的累计消耗判定(切换类型会清空阈值)")})]}),f.type==="balance"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("余额低于")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[120px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("时")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(余额回升自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(余额回升自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("重置方式")}),s.jsxs(ft,{value:f.reset,onValueChange:v=>h({reset:v}),children:[s.jsx(mt,{className:"w-[190px]","aria-label":r("重置方式"),children:s.jsx(pt,{children:f.reset==="daily"?r("自然日(每天 0 点)"):r("固定周期")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"fixed",children:r("固定周期")}),s.jsx(qe,{value:"daily",children:r("自然日(每天 0 点)")})]})]}),s.jsx("span",{className:"detail",children:r("有的账号过了 0 点额度就回来 —— 选「自然日」")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),f.reset==="daily"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每日消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每")}),s.jsx($e,{type:"number",min:1,step:1,className:"max-w-[90px]",placeholder:r("周期"),value:f.periodInput,onChange:v=>h({periodInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.periodUnit,onValueChange:v=>h({periodUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("周期单位"),children:s.jsx(pt,{children:f.periodUnit==="hours"?r("小时"):r("分钟")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("内消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(重置后自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(重置后自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}),s.jsx("p",{className:"detail limiter-hint",children:y()}),c?s.jsx("p",{className:"detail text-destructive",children:c}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:b,children:t.index>=0?r("保存规则"):r("添加规则")})]})]})})}function K$({account:e,draft:t,onChange:a}){const[o,c]=x.useState(null),d=()=>c({index:-1,draft:jR(null)}),f=y=>c({index:y,draft:jR(t[y])}),p=(y,v)=>{const w=[...t];v>=0?w[v]=y:w.push(y),a(w),c(null)},h=y=>{a(t.filter((v,w)=>w!==y)),o&&c(null)},b=(y,v)=>{const w=[...t];w[y]={...w[y],enabled:v},a(w)};return s.jsxs(s.Fragment,{children:[t.length?s.jsx("div",{className:"limiter-rules mt-2.5",children:t.map((y,v)=>{const w=$$(e,y);return s.jsxs("div",{className:"limiter-rule","data-off":y.enabled===!1||void 0,children:[s.jsx(hs,{checked:y.enabled!==!1,"aria-label":r("启用该规则"),onCheckedChange:j=>b(v,j===!0)}),s.jsx("div",{className:"limiter-rule-main",children:s.jsxs("span",{className:"limiter-rule-cond",children:[s.jsx(ze,{variant:"secondary",shape:"tag",children:y.type==="balance"?r("余额"):"Token"})," ",r("{cond} 时 → {action}",{cond:U$(y),action:V$(y)})]})}),s.jsx(ze,{variant:w.kind==="ok"?"success":w.kind==="warn"?"warning":w.kind==="danger"?"destructive":"secondary",shape:"tag",title:w.title,children:w.text}),s.jsxs("div",{className:"limiter-rule-ops",children:[s.jsx(se,{variant:"ghost",onClick:()=>f(v),children:r("编辑")}),s.jsx(se,{variant:"ghost",onClick:()=>h(v),children:r("删除")})]})]},v)})}):s.jsx("p",{className:"detail mt-2.5",children:r("还没有限制规则:账号照常参与转发,余额与 Token 消耗都不设上限。")}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx(se,{variant:"outline",onClick:d,children:r("+ 添加限制")}),s.jsx("span",{className:"detail",children:r("可添加多条;同类规则也允许并存(例如一条按余额、两条不同重置方式的 Token)")})]}),s.jsx(G$,{account:e,target:o,onClose:()=>c(null),onSave:p})]})}function Y$(e,t){const a=iu(e);return JSON.stringify(t)===JSON.stringify(a)?null:{patch:{limiters:t}}}function X$(e){return iu(e).map(t=>({...t}))}const Q$={seconds:1,minutes:60,hours:3600};function Z$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:e>0?{value:String(e),unit:"seconds"}:{value:"5",unit:"minutes"}}function W$(e){const{enabled:t,interval:a}=AA(e),o=Z$(t?a:0);return{enabled:t,intervalInput:o.value,unit:o.unit}}function J$(e,t){const a=Math.round(Number(t.intervalInput)*Q$[t.unit]);if(t.enabled){if(!Number.isFinite(Number(t.intervalInput))||Number(t.intervalInput)<=0)return{error:r("请填写查询间隔")};if(aNA)return{error:r("查询间隔必须是 {min} 秒 ~ 24 小时",{min:lw})}}const o={},c=AA(e);return(t.enabled!==c.enabled||t.enabled&&a!==c.interval)&&(o.usageQuery={enabled:t.enabled,interval:t.enabled?a:c.interval}),o.usageQuery?{patch:o}:null}function e8({account:e,draft:t,onChange:a}){const o=c=>a({...t,...c});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(hs,{checked:t.enabled,onCheckedChange:c=>o({enabled:c===!0}),"aria-label":r("自动查询余额")}),s.jsx("span",{className:"text-xs text-subtle",children:r("自动查询余额(按下面的间隔自动刷新余额列的读数)")})]})}),t.enabled?s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-usage-interval",children:r("查询间隔")}),s.jsx($e,{id:"account-usage-interval",type:"number",min:1,step:1,className:"max-w-[110px]",value:t.intervalInput,onChange:c=>o({intervalInput:c.currentTarget.value})}),s.jsxs(ft,{value:t.unit,onValueChange:c=>o({unit:c}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("间隔单位"),children:s.jsx(pt,{children:t.unit==="hours"?r("小时"):t.unit==="minutes"?r("分钟"):r("秒")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"seconds",children:r("秒")}),s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",children:r("30 秒 ~ 24 小时;手动查询会顺延下一轮")})]}):null]})}const t8={sub2api:{label:"Sub2API",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},new_api:{label:"NewAPI",endpoint:"{base}/api/user/self + /api/status",note:r("用 NewAPI 站点的个人访问令牌查询账户余额(不是这条账号的上游 API Key)。令牌在站点的「个人设置」里生成,只有旧版 / 定制站点才需要额外填用户 ID。"),fields:[{key:"accessToken",label:r("NewAPI 个人访问令牌"),secret:!0,placeholder:r("在 NewAPI 站点「个人设置」里生成的访问令牌"),hint:r("必填;留空 = 不修改,清除用右边的按钮")},{key:"userId",label:r("NewAPI 用户 ID"),placeholder:r("旧版 / 定制站点才需要,新版可留空"),hint:r("可留空:新版请求头只认令牌;旧版会把用户 ID 放进 New-Api-User 头")}]},deepseek:{label:"DeepSeek",endpoint:"{base}/user/balance",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},opencode:{label:"OpenCode Go",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询订阅用量,不需要额外配置;读数展开成 5 小时 / 每周 / 每月三个窗口。"),fields:[]},sensenova:{label:"商汤日日新",endpoint:"platform.sensenova.cn 控制台",note:r("用商汤日日新控制台的账号密码查询(与推理用的 API Key 不是同一套)。网关会自动换取登录票并缓存,过期后自动重登,不需要手动维护。"),fields:[{key:"username",label:r("账号"),placeholder:r("商汤日日新控制台的登录账号"),hint:r("必填")},{key:"password",label:r("密码"),secret:!0,placeholder:r("商汤日日新控制台的登录密码"),hint:r("留空 = 不修改,清除用右边的按钮")}]},zhipu:{label:"智谱",endpoint:"bigmodel.cn 控制台",note:r("用 bigmodel.cn 控制台的访问令牌查询账户余额(人民币元)。令牌是登录后浏览器 Cookie `bigmodel_token_production` 的值:开发者工具 → 应用(Application)→ Cookie 里复制。"),fields:[{key:"token",label:r("访问令牌"),secret:!0,placeholder:r("bigmodel_token_production 的值"),hint:r("必填;留空 = 不修改,清除用右边的按钮")}]},zhipu_zai:{label:"智谱(z.ai 国际)",endpoint:"api.z.ai 控制台",note:r("用这条账号的 API Key 生成签名后查询账户余额(美元),不需要额外配置。要求 API Key 是 z.ai 的「id.secret」形态(控制台生成的 Key 就是)。"),fields:[]}};function kf(e){return e?t8[e]??null:null}function n8(e,t){return t.secret?t.key==="accessToken"?e?.hasAccessToken===!0:t.key==="password"?e?.hasPassword===!0:t.key==="token"?e?.hasToken===!0:!1:!1}function s8(e){const t=String(e?.scheme||"");return t==="new_api"?e?.hasAccessToken===!0:t==="sensenova"?String(e?.username||"").trim()!==""&&e?.hasPassword===!0:t==="zhipu"?e?.hasToken===!0:!0}function r8(e){return{userId:String(e?.userId||""),username:String(e?.username||""),accessToken:"",password:"",token:""}}function a8(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=String(t[c.key]??"").trim();if(c.secret){d&&(o[c.key]=d);continue}o[c.key]=d}return Object.keys(o).length?o:null}function l8({field:e,value:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){const p=`${f}-${e.key}`;return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:p,children:e.label}),s.jsx($e,{id:p,className:"min-w-[220px]",type:e.secret?"password":"text",autoComplete:e.secret?"new-password":"off",placeholder:a?r("已配置,留空则不修改"):e.placeholder,title:e.hint,value:t,onChange:h=>o(h.currentTarget.value)}),a&&c?s.jsx(se,{variant:"outline",size:"sm",disabled:d===!0,onClick:c,title:r("清除已配置的 {label}",{label:e.label}),children:r("清除")}):null]})}function o8({spec:e,values:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"detail mt-2.5",children:[r("余额查询方案:{label}",{label:e.label}),s.jsx("span",{className:"ml-1 text-subtle",children:e.endpoint})," — ",e.note]}),e.fields.map(p=>s.jsx(l8,{field:p,idPrefix:f,value:t[p.key]||"",configured:a[p.key]===!0,onValue:h=>o(p.key,h),onClear:c?()=>c(p.key):void 0,clearBusy:d},p.key))]})}const NR=64;function i8(e,t){const a=kn(e);return t.filter(o=>o.id!==e.id&&kn(o)===a)}const Rl=999,kR=8;function sg(e){return cu(e)||e?.id||""}function CR(e){const t=e?.config?.source||e?.source,a=e?.config||null,o=t==="rotate";return{mode:t==="pool"?"pool":o?"rotate":t==="clash"?"clash":t==="custom"?"custom":"none",proxyId:t==="pool"?String(a?.proxyId||""):"",rotateAll:o?a?.all!==!1:!0,rotateIds:o&&Array.isArray(a?.proxyIds)?a.proxyIds.map(String):[],listenerUid:a?.source==="clash"||t==="clash"?String(a?.listenerUid||""):"",protocol:a?.protocol==="socks5"?"socks5":"http",host:a?.host||"",port:a?.port===void 0||a?.port===null?"":String(a.port),username:a?.username||"",password:a?.password||""}}function jw(e){if(e.mode==="none")return null;if(e.mode==="pool"){if(!e.proxyId)throw new Error(r("请先选择已保存的代理"));return{source:"pool",proxyId:e.proxyId}}if(e.mode==="rotate"){if(e.rotateAll)return{source:"rotate",all:!0};if(!e.rotateIds.length)throw new Error(r("轮询至少要选择一条代理(或改选「全部」)"));return{source:"rotate",all:!1,proxyIds:[...e.rotateIds]}}if(e.mode==="clash"){if(!e.listenerUid)throw new Error(r("请先选择 Clash Verge 出口"));return{source:"clash",listenerUid:e.listenerUid}}const t=e.host.trim(),a=Number(e.port);if(!t)throw new Error(r("请填写代理主机地址"));if(!Number.isInteger(a)||a<1||a>65535)throw new Error(r("代理端口必须是 1-65535 的整数"));return{source:"custom",protocol:e.protocol==="socks5"?"socks5":"http",host:t,port:a,username:e.username.trim(),password:e.password}}function TR(e){const t=e.profileActive===!1?r("(其他订阅,可能未生效)"):"",a=e.enabled===!1?r("(已在 Clash 中禁用)"):"";return`${e.name} :${e.port}${t}${a}`}function ER({draft:e,onChange:t,idPrefix:a,allowRotate:o=!1}){const d=Ws().clash,f=Array.isArray(d?.options)?d.options:[],p=e.mode==="clash",[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(null),[S,N]=x.useState(""),k=A=>t({...e,...A});x.useEffect(()=>{p&&aR().catch(()=>{})},[p]);const T=x.useCallback((A=!1)=>{N(""),lR({force:A}).then(R=>j(R)).catch(R=>{j([]),N(ut(R))})},[]);x.useEffect(()=>{(e.mode==="pool"||e.mode==="rotate")&&w===null&&T()},[e.mode,w,T]);function D(){return e.rotateAll?(w??[]).filter(A=>A.enabled!==!1).map(A=>A.id):[...e.rotateIds]}async function C(){if(h)return;if(e.mode==="rotate"){const R=D();if(!R.length){Le(r("轮询至少要选择一条代理(或改选「全部」)"),"err");return}const I=R.slice(0,kR);b(!0),v(r("正在连接上游…"));let P=0;const O=[];for(const H of I){const B=w?.find(z=>z.id===H)?.name||H;try{const z=await Pe().workbuddyDesktop?.testProxyPoolItem?.(H);z?.success?P+=1:O.push(`${B}(${z?.error||r("连接失败")})`)}catch(z){O.push(`${B}(${ut(z)})`)}}const _=R.length-I.length,L=r("✅ {ok}/{total} 个出口可用",{ok:P,total:I.length})+(_>0?r("(只测了前 {limit} 个,还有 {rest} 个未测)",{limit:kR,rest:_}):"");v(s.jsxs("span",{className:O.length?"text-destructive":"text-success",children:[L,O.length?` ${Qa(O.join(r(";")))}`:""]})),b(!1);return}if(e.mode==="pool"){if(!e.proxyId){Le(r("请先选择已保存的代理"),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxyPoolItem?.(e.proxyId);v(R?.success?s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]}):s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}return}let A;try{A=jw(e)}catch(R){Le(ut(R),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxy?.({proxy:A});R?.success?v(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.status!==void 0&&R.status!==""?` HTTP ${Qa(String(R.status))}`:"",R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]})):v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}}return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(Eh,{value:e.mode,onValueChange:A=>k({mode:A}),className:"flex-row flex-wrap items-center gap-5","aria-label":r("代理方式"),children:[s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"none"}),r("无代理(直连)")]}),s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"pool"}),r("已保存的代理")]}),o?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",title:r("逐请求轮换出口(换 IP):OpenCode Zen 免费档按 IP 限流,单个 IP 的额度用完会对它一律 429"),children:[s.jsx(bo,{value:"rotate"}),r("轮询(换 IP)")]}):null,p?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"clash"}),"Clash Verge"]}):null,s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"custom"}),r("自定义")]})]}),e.mode==="pool"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-pool-exit`,children:r("代理")}),s.jsxs(ft,{value:e.proxyId,disabled:!w?.length,onValueChange:A=>k({proxyId:String(A)}),children:[s.jsx(mt,{id:`${a}-pool-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:w?.find(A=>A.id===e.proxyId)?au(w.find(A=>A.id===e.proxyId)):w===null?r("正在读取…"):w.length?r("请选择代理"):r("还没有保存的代理")})}),s.jsx(ht,{children:(w??[]).map(A=>s.jsx(qe,{value:A.id,children:au(A)},A.id))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("地址与端口由「网络代理」页管理:那边改一次、测一次,所有引用它的账号一起生效"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="rotate"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[s.jsx(Mr,{id:`${a}-rotate-all`,checked:e.rotateAll,"aria-label":r("轮询全部代理节点"),onCheckedChange:A=>k({rotateAll:A===!0})}),s.jsx("label",{htmlFor:`${a}-rotate-all`,className:"cursor-pointer text-xs text-subtle",children:r("全部代理节点(推荐)")}),s.jsx("span",{className:"detail",children:r("「网络代理」页里每个启用的出口轮流使用;之后新加的出口自动加入")})]}),e.rotateAll?null:s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-rotate-exits`,children:r("轮询的代理")}),s.jsx(Bh,{id:`${a}-rotate-exits`,value:e.rotateIds,onValueChange:A=>k({rotateIds:A.map(String)}),options:(w??[]).map(A=>({value:A.id,label:au(A)})),placeholder:r("选择要轮询的代理(可多选)"),"aria-label":r("轮询的代理")}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("每条请求换一个出口(按顺序轮流),上游看到的 IP 因此是变化的;出口的地址与端口由「网络代理」页管理"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="clash"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-clash-exit`,children:r("出口")}),s.jsxs(ft,{value:e.listenerUid,disabled:!f.length,onValueChange:A=>k({listenerUid:String(A)}),children:[s.jsx(mt,{id:`${a}-clash-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:f.find(A=>String(A.uid)===e.listenerUid)?TR(f.find(A=>String(A.uid)===e.listenerUid)):d?.available===!1?r("未检测到 Clash Verge"):f.length?r("请选择出口"):r("没有可用出口")})}),s.jsx(ht,{children:f.map(A=>s.jsx(qe,{value:String(A.uid),children:TR(A)},String(A.uid)))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{aR({force:!0}).then(()=>Le(r("✅ 已重新读取 Clash Verge 配置"))).catch(A=>Le(r("读取失败:{error}",{error:ut(A)}),"err"))},children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:d===null?r("正在读取 Clash Verge 配置…"):d.available===!1?d.error?r("不可用:{error}",{error:d.error}):r("未检测到 Clash Verge 配置"):f.length?r("读取自 {dir};端口由 Clash Verge 管理,这里实时同步",{dir:d.dir||"Clash Verge"}):r("Clash Verge 里还没有配置混合监听器或节点端口")}),s.jsxs("p",{className:"detail mt-1.5",children:[r("这是既有配置(直接引用 Clash 出口,不经过代理池)。推荐改用上面的"),s.jsx("b",{children:r("「已保存的代理」")}),r(":到「网络代理」页点「同步 Clash Verge」把出口导进池后即可选 —— 那样能集中测试、也能被多个账号共用。")]})]}):null,e.mode==="custom"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-protocol`,children:r("协议")}),s.jsxs(ft,{value:e.protocol,onValueChange:A=>k({protocol:A}),children:[s.jsx(mt,{id:`${a}-protocol`,className:"min-w-[110px]",children:s.jsx(pt,{children:e.protocol==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]}),s.jsx("label",{htmlFor:`${a}-host`,className:"ml-2",children:r("主机")}),s.jsx($e,{id:`${a}-host`,className:"min-w-[140px]",placeholder:"127.0.0.1",value:e.host,onChange:A=>k({host:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-port`,children:r("端口")}),s.jsx($e,{id:`${a}-port`,type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:e.port,onChange:A=>k({port:A.currentTarget.value})})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-user`,children:r("用户名")}),s.jsx($e,{id:`${a}-user`,placeholder:r("可选"),autoComplete:"off",value:e.username,onChange:A=>k({username:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-pass`,children:r("密码")}),s.jsx($e,{id:`${a}-pass`,type:"password",placeholder:r("可选"),autoComplete:"new-password",value:e.password,onChange:A=>k({password:A.currentTarget.value})})]})]}):null,s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{C()},children:r(h?"测试中…":"测试出口")}),s.jsx("span",{className:"detail",children:y})]})]})}function c8({plan:e,hasJwt:t,onChange:a}){const o=JF(e),[c,d]=x.useState(null);return x.useEffect(()=>{if(e!==wo)return()=>{};let f=!0;const p=()=>{Promise.resolve(Pe().workbuddyDesktop?.zcodeCaptchaStats?.()).then(b=>{f&&b&&d({ready:Number(b.ready)||0,target:Number(b.target)||0})}).catch(()=>{})};p();const h=window.setInterval(p,5e3);return()=>{f=!1,window.clearInterval(h)}},[e]),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-plan-channel",children:r("使用套餐")}),s.jsxs(ft,{value:e,onValueChange:f=>a(String(f)),children:[s.jsx(mt,{id:"account-plan-channel",className:"min-w-[220px]",children:s.jsx(pt,{children:o})}),s.jsxs(ht,{children:[s.jsx(qe,{value:PA,children:r("编码套餐(Coding Plan)— 走开放平台端点,用自己订阅的额度")}),s.jsx(qe,{value:wo,children:r("活动套餐(Start Plan)— 走官方活动端点,用活动里领到的额度")})]})]}),e===wo&&!t?s.jsx("span",{className:"detail text-destructive",children:r("该账号没有套餐登录态(jwt),活动套餐会失败:请重新登录该账号")}):null,e===wo?s.jsxs("span",{className:"detail",title:r("活动套餐的推理端点要求每条请求带一个阿里云验证码令牌;令牌由本应用在后台静默铸造,界面关闭时无法铸造"),children:[r("验证码令牌:{counts}",{counts:c?`${c.ready} / ${c.target||3}`:r("读取中…")}),c&&c.ready===0?r("(库存为空,正在补;补不上时转发会失败)"):""]}):null]})}function u8({configured:e,value:t,onChange:a,onClear:o,clearBusy:c}){return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-balance-token-input",children:r("余额查询凭证")}),s.jsx($e,{id:"account-balance-token-input",className:"min-w-[220px]",placeholder:r(e?"已配置,留空则不修改":"一般不用填"),title:r("积分查询已复用转发用的登录凭证,这里通常留空即可。只有旧版本填过、或从旧代理导入过凭证时才有值"),value:t,onChange:d=>a(d.currentTarget.value)}),e?s.jsx(se,{variant:"outline",size:"sm",disabled:c,onClick:o,title:r("清除已配置的余额查询凭证"),children:r("清除")}):null]})}function d8({hasApiKey:e,noAuth:t,value:a,onValue:o,onToggleNoAuth:c,onClear:d,clearBusy:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-api-key-input",children:r("API Key")}),s.jsx($e,{id:"account-api-key-input",type:"password",autoComplete:"new-password",className:"min-w-[220px]",disabled:t,placeholder:e?r("已配置,留空则不修改"):"sk-…",title:r("上游的 API Key。留空 = 不修改(改凭证不会换账号 id);要清掉已配的凭证用右边的「清除」"),value:a,onChange:p=>o(p.currentTarget.value)}),e&&!t?s.jsx(se,{variant:"outline",size:"sm",disabled:f,onClick:d,title:r("清除已配置的 API Key(转发时会因缺少凭证被跳过)"),children:r("清除")}):null]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:t,"aria-label":r("该上游无需鉴权"),onCheckedChange:p=>c(p===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(转发与拉取模型都不发送鉴权头)")})]})}),s.jsxs("p",{className:"detail",children:[r("上游本来不要凭证时(本地 Ollama、OpenCode Zen 的免费档)勾上这一项:账号会被正常选路;只把 Key 留空"),s.jsx("strong",{children:r("又不勾")}),r("会被当成「未配置凭证」而跳过。")]})]})}function f8({provider:e,name:t,protocol:a,baseUrl:o,count:c,emulation:d,onName:f,onProtocol:p,onBaseUrl:h,onEmulation:b,onRemove:y}){const v=Pe().wbProviders?.PROTOCOL_OPTIONS||[{value:"openai",label:r("OpenAI 兼容")},{value:"anthropic",label:"Anthropic"}],w=v.find(j=>j.value===a)?.label||a;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("提供商")}),s.jsxs("p",{children:[r("这一栏改的是"),s.jsx("strong",{children:r("「{name}」本身",{name:e.name||e.id})}),r("(名下 {count} 个账号共用)",{count:c}),r("改协议 / Base URL 会改变它们的转发方式,正在进行的请求可能失败;模型清单与映射在「模型管理」页。")]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-provider-name",children:r("名称")}),s.jsx($e,{id:"account-provider-name",maxLength:NR,className:"min-w-[220px]",placeholder:r("提供商显示名,1~{max} 个字符",{max:NR}),value:t,onChange:j=>f(j.currentTarget.value)})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-protocol",children:r("协议")}),s.jsxs(ft,{value:a,onValueChange:j=>p(String(j)),children:[s.jsx(mt,{id:"account-provider-protocol",className:"min-w-[180px]",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:v.map(j=>s.jsx(qe,{value:j.value,children:j.label},j.value))})]})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-baseurl",children:r("Base URL")}),s.jsx($e,{id:"account-provider-baseurl",className:"min-w-[260px]",placeholder:r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),value:o,onChange:j=>h(j.currentTarget.value)})]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:d==="opencode","aria-label":r("伪装 OpenCode 官方客户端"),onCheckedChange:j=>b(j===!0?"opencode":"")}),s.jsx("span",{className:"text-xs text-subtle",children:r("伪装 OpenCode 官方客户端(OpenCode Zen 免费档要它才放行)")})]})}),s.jsxs("p",{className:"detail",children:[r("开启后,网关按 OpenCode 官方 CLI 的形状发请求:没填 Key 的账号用匿名凭证"),s.jsx("code",{children:"public"}),r("、补官方会话头、请求体补两个占位工具(上游免费档的三道校验)。"),s.jsx("strong",{children:r("它会改写请求体")}),r(",只对 OpenCode Zen 这类上游有意义,别的家请关掉。")]}),s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"destructive",onClick:y,children:r("删除提供商")}),s.jsx("span",{className:"detail",children:r("级联删除名下全部账号,不可恢复")})]})]})}function p8({id:e,onClose:t}){const a=Ea(e),[o,c]=x.useState(a?.enabled!==!1),[d,f]=x.useState(a?.name||""),[p,h]=x.useState(()=>CR(a?.proxy)),[b,y]=x.useState(""),[v,w]=x.useState(()=>uw(a)),[j,S]=x.useState(!1),[N,k]=x.useState(""),[T,D]=x.useState(null),[C,A]=x.useState(""),[R,I]=x.useState("chat_completions"),[P,O]=x.useState(""),[_,L]=x.useState(""),[H,B]=x.useState(""),[z,Q]=x.useState(a?.noAuth===!0),[K,X]=x.useState(()=>W$(a)),[q,$]=x.useState(()=>r8(a?.balanceQuery)),[Y,F]=x.useState(()=>X$(a)),[G,W]=x.useState("basic"),[le,M]=x.useState(()=>String(Number(a?.maxConcurrent)||0));if(x.useEffect(()=>{let he=!0;D(null);const ye=Ea(e);return ye?(Promise.resolve(Pe().wbCustomProvidersUi?.find?.(kn(ye))).then(je=>{!he||!je||(D(je),A(je.name||""),I(je.protocol||"chat_completions"),O(je.baseUrl||""),L(typeof je.clientEmulation=="string"?je.clientEmulation:""))}).catch(()=>{}),()=>{he=!1}):()=>{he=!1}},[e]),!a)return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置")})}),s.jsx(Bt,{children:s.jsx("p",{className:"detail",children:r("账号不存在,请刷新后重试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const U=a,Z=i8(U,El()),ae=kn(U)==="catpaw",ce=kn(U).startsWith("custom-"),J=wA(T,U.baseUrl)||p.mode==="rotate",ie=kf(U.balanceQuery?.scheme),ge={};for(const he of ie?.fields??[])ge[he.key]=n8(U.balanceQuery,he);const ee=!!(ie&&ie.fields.length)&&!s8(U.balanceQuery);async function fe(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceToken:null}),y(""),Le(r("✅ 已清除余额查询凭证")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function te(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{apiKey:null}),B(""),Le(r("✅ 已清除 API Key(该账号现在没有凭证,转发会被跳过)")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function Ce(he){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceQuery:{[he]:null}}),$(ye=>({...ye,[he]:""})),Le(r("✅ 已清除查询凭证")),await Pe().wbApp?.refresh?.()}catch(ye){Le(r("清除失败:{error}",{error:ut(ye)}),"err")}finally{S(!1)}}}function re(){if(!ce)return null;const he=H.trim(),ye={};return he?ye.apiKey=he:z!==(U.noAuth===!0)&&(ye.noAuth=z),Object.keys(ye).length?ye:null}function de(){if(!T)return null;const he=C.trim(),ye=P.trim();if(!he)return{error:r("请填写提供商名称")};if(!ye)return{error:r("请填写提供商的 Base URL")};const je=typeof T.clientEmulation=="string"?T.clientEmulation:"";return T.name===he&&T.protocol===R&&T.baseUrl===ye&&je===_?null:{id:T.id,name:he,protocol:R,baseUrl:ye,clientEmulation:_}}async function ke(){if(j)return;let he;try{he=jw(p)}catch(Ct){Le(ut(Ct),"err");return}const ye=de();if(ye&&"error"in ye){k(s.jsx("span",{className:"text-destructive",children:ye.error}));return}const je=Ta(U)?J$(U,K):null;if(je&&"error"in je){k(s.jsx("span",{className:"text-destructive",children:je.error}));return}const xe=Y$(U,Y),Te=a8(U.balanceQuery?.scheme,q),Oe=re()||{},Ne=Number(le);if(!Number.isFinite(Ne)||Ne<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}const _e=Math.min(Rl,Math.round(Ne)),Ye=Number(U.maxConcurrent)||0,kt=_e!==Ye?{maxConcurrent:_e}:{};S(!0);try{const Ct=ae&&b.trim()?{balanceToken:b.trim()}:{},Rt=Gh(U)&&v!==uw(U)?{zcodePlan:v}:{};if(await Pe().workbuddyDesktop?.updateAccount?.(e,{name:d.trim()||U.name,enabled:o,proxy:he,...Ct,...Rt,...Oe,...kt,...Te?{balanceQuery:Te}:{},...je&&"patch"in je?je.patch:{},...xe&&"patch"in xe?xe.patch:{}}),ye)try{await Pe().wbCustomProvidersUi?.update?.(ye)}catch(ot){k(s.jsx("span",{className:"text-destructive",children:r("账号已保存,但提供商未更新:{error}",{error:ut(ot)})})),await Pe().wbApp?.refresh?.(),S(!1);return}t(),Le(r("✅ 账号设置已保存"));try{await Pe().wbApp?.refresh?.()}catch{}}catch(Ct){k(s.jsx("span",{className:"text-destructive",children:ut(Ct)})),Le(r("保存失败:{error}",{error:ut(Ct)}),"err")}finally{S(!1)}}const Ee=Number(ir(kn(U)).concurrencyDefault)||0,ve=ae||ce||Gh(U);return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||j||t()},children:s.jsxs(Zt,{className:"w-[min(900px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置 · {name}",{name:sg(a)})})}),s.jsx(Bt,{className:"p-0",children:s.jsxs("div",{className:"acct-dlg",children:[s.jsx("aside",{className:"prov-rail acct-dlg-rail","aria-label":r("账号设置分组"),children:s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("账号设置")}),[["basic",r("基本")],...ve?[["credential",r("凭证与套餐")]]:[],...Ta(U)?[["query",r("查询设置")],["limiter",r("限制器")]]:[],["network",r("网络")]].map(([he,ye])=>s.jsx(ru,{active:G===he,title:ye,className:"shadow-none",onClick:()=>W(he),children:ye},he))]})}),s.jsxs("div",{className:"acct-dlg-main",children:[G==="basic"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("基本")}),s.jsx("p",{children:r("这条账号是谁、排第几、能不能接请求。")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("启用")}),s.jsx(hs,{checked:o,onCheckedChange:c,"aria-label":r("启用该账号")}),s.jsx("span",{className:"detail",children:r("关闭则不参与转发(余额查询照常,见「查询设置」)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-name-input",children:r("备注名")}),s.jsx($e,{id:"account-name-input",maxLength:100,placeholder:r("账号显示名称"),className:"max-w-[280px]",value:d,onChange:he=>f(he.currentTarget.value)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("转发顺序")}),s.jsx("span",{className:"detail",children:r("在列表里拖:拖分组带调整整组顺位,拖行首把手调整组内先后(顺序由拖拽表达,不再填数字)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-conc-input",children:r("并发上限")}),s.jsx($e,{id:"account-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",value:le,onChange:he=>M(he.currentTarget.value)}),s.jsx("span",{className:"detail",children:Ee>0?r("0 = 按本家默认 {default}",{default:Ee}):r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:Ee>0?r("并发上限 受上游硬顶约束,达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)"):r("并发上限 0~{max};达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)",{max:Rl})})]}):null,G==="credential"&&ve?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("凭证与套餐")}),s.jsx("p",{children:r("这一段按提供商出现:有什么配什么。")})]}),ae?s.jsx(u8,{configured:a.hasBalanceToken===!0,value:b,onChange:y,clearBusy:j,onClear:()=>{fe()}}):null,ce?s.jsx(d8,{hasApiKey:U.hasApiKey===!0,noAuth:z,value:H,onValue:B,onToggleNoAuth:Q,onClear:()=>{te()},clearBusy:j}):null,Gh(U)?s.jsx(c8,{plan:v,hasJwt:a.canClaim===!0,onChange:w}):null,T?s.jsx(f8,{provider:T,count:Z.length+1,name:C,protocol:R,baseUrl:P,emulation:_,onName:A,onProtocol:I,onBaseUrl:O,onEmulation:L,onRemove:()=>{j||Promise.resolve(Pe().wbCustomProvidersUi?.remove?.(T.id)).then(he=>{he&&t()})}}):null]}):null,G==="query"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("查询设置")}),s.jsx("p",{children:r("余额列读数的自动刷新;也是「限制器」余额规则的数据来源。")})]}),ie?s.jsx(o8,{spec:ie,values:q,configured:ge,onValue:(he,ye)=>$(je=>({...je,[he]:ye})),onClear:he=>{Ce(he)},clearBusy:j,idPrefix:"account-balance-query"}):null,ee?s.jsx("p",{className:"detail mt-2.5 text-subtle",children:r("查询凭证还没配齐:填好后余额列才有读数,在此之前会显示「未配置」。")}):null,s.jsx(e8,{account:U,draft:K,onChange:X})]}):null,G==="limiter"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("限制器")}),s.jsx("p",{children:r("按规则限制该账号参与转发:没有规则(或全部停用)= 不限制;跳过档自动恢复,禁用档需手动启用。")})]}),s.jsx(K$,{account:U,draft:Y,onChange:F})]}):null,G==="network"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("网络")}),s.jsx("p",{children:r("这条账号访问上游走哪条线路。")})]}),s.jsx(ER,{draft:p,onChange:h,idPrefix:"account-proxy",allowRotate:J}),a.proxy?.error?s.jsx("p",{className:"detail text-destructive",children:r("当前代理不可用:{error}(转发时会回退直连)",{error:a.proxy.error})}):null]}):null]})]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"detail mr-auto",style:{minHeight:18},children:N}),s.jsx(se,{variant:"outline",disabled:j,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{ke()},children:r(j?"保存中…":"保存")})]})]})})}const m8=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"proxy",label:r("修改代理")},{value:"concurrency",label:r("设置并发上限")},{value:"remove",label:r("删除")}];function h8({ids:e,action:t,onClose:a}){const[o,c]=x.useState(t),[d,f]=x.useState(()=>CR(null)),[p,h]=x.useState(""),[b,y]=x.useState(!1),[v,w]=x.useState(""),j=e.map(C=>Ea(C)).filter(C=>C!==null),S=j.reduce((C,A)=>Math.max(C,Number(ir(kn(A)).concurrencyDefault)||0),0),N=j.length>0&&j.every(C=>VF(C));function k(C){return Promise.resolve(Pe().wbConfirm?.ask?.({title:r("删除选中的账号"),html:r("确定删除选中的 {count} 个账号?此操作不可恢复,账号的登录态会一并移除。",{count:C}),okText:r("删除"),okClass:"danger"})??!1)}async function T(){if(b)return;if(!e.length){Le(r("没有选中的账号"),"err");return}let C;if(o==="proxy")try{C=jw(d)}catch(R){Le(ut(R),"err");return}let A;if(o==="concurrency"){const R=Number(p.trim());if(!p.trim()||!Number.isFinite(R)||R<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}A=Math.min(Rl,Math.round(R))}if(!(o==="remove"&&!await k(e.length))){if(o==="disable"||o==="remove"){const R=new Set(e);if(!El().filter(P=>P.enabled!==!1&&!R.has(P.id)).length){const P=r(o==="remove"?"删除":"禁用");if(!await Promise.resolve(Pe().wbConfirm?.ask?.({title:r("全部启用中的账号将被{what}",{what:P}),html:r("这会{what}所有启用中的账号,转发将不可用。确定继续?",{what:P}),okText:P,okClass:o==="remove"?"danger":"primary"})??!1))return}}y(!0),w("");try{const R={action:o,ids:e};o==="proxy"&&(R.proxy=C),o==="concurrency"&&(R.maxConcurrent=A);const I=await Pe().workbuddyDesktop?.batchAccounts?.(R),P=(I?.ok||[]).filter(B=>B.changes?.length).length,O=(I?.removed||[]).length,_=I?.failed||[],L=o==="remove"?O:P,H={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;if(_.length){const B=_.slice(0,3).map(z=>sg(Ea(String(z.id)))||z.id).join(r("、"));Le(r("{verb}完成:成功 {ok} 个,失败 {fail} 个({detail}{more})",{verb:H,ok:L,fail:_.length,detail:B,more:_.length>3?r(" 等"):""}),"err"),w(s.jsxs("span",{className:"text-destructive",children:[r("失败 {count} 个:",{count:_.length}),_.map(z=>`${sg(Ea(String(z.id)))||z.id}(${z.error})`).join(r(";"))]}))}else Le(r("✅ {verb}完成:共 {count} 个账号",{verb:H,count:L})),a();await Pe().wbApp?.refresh?.()}catch(R){w(s.jsx("span",{className:"text-destructive",children:ut(R)})),Le(r("批量操作失败:{error}",{error:ut(R)}),"err")}finally{y(!1)}}}const D={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||b||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {count} 个账号",{count:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下账号")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:j.map(C=>sg(C)).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:c,className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:m8.map(C=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:C.value}),C.label]},C.value))}),o==="proxy"?s.jsx("div",{className:"mt-2.5",children:s.jsx(ER,{draft:d,onChange:f,idPrefix:"batch-proxy",allowRotate:N})}):null,o==="concurrency"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-conc-input",children:r("并发上限")}),s.jsx($e,{id:"batch-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",placeholder:r("不限"),value:p,onChange:C=>h(C.currentTarget.value)}),s.jsx("span",{className:"detail",children:r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:S>0?r("并发上限 0~{max};有上游硬顶的家(如 CodeArts)以它的硬顶为准;达到上限的账号会被跳过、请求转给其他账号",{max:Rl}):r("并发上限 0~{max};达到上限的账号会被跳过、请求转给其他账号",{max:Rl})})]}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:b,onClick:a,children:r("取消")}),s.jsx(se,{variant:o==="remove"?"destructive":"default",disabled:b,onClick:()=>{T()},children:b?r("执行中…"):r("执行({action})",{action:D})})]})]})})}function g8(){const e=Ws();return e.dialog?e.dialog.kind==="settings"?s.jsx(p8,{id:e.dialog.id,onClose:eg},e.dialog.id):s.jsx(h8,{ids:e.dialog.ids,action:e.dialog.action,onClose:eg},e.dialog.ids.join(",")):null}var Sw={exports:{}},Cf={},Nw={exports:{}},kw={};var AR;function x8(){return AR||(AR=1,(function(e){function t(X,q){var $=X.length;X.push(q);e:for(;0<$;){var Y=$-1>>>1,F=X[Y];if(0>>1;Yc(le,$))Mc(U,le)?(X[Y]=U,X[M]=$,Y=M):(X[Y]=le,X[W]=$,Y=W);else if(Mc(U,$))X[Y]=U,X[M]=$,Y=M;else break e}}return q}function c(X,q){var $=X.sortIndex-q.sortIndex;return $!==0?$:X.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();e.unstable_now=function(){return f.now()-p}}var h=[],b=[],y=1,v=null,w=3,j=!1,S=!1,N=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function A(X){for(var q=a(b);q!==null;){if(q.callback===null)o(b);else if(q.startTime<=X)o(b),q.sortIndex=q.expirationTime,t(h,q);else break;q=a(b)}}function R(X){if(N=!1,A(X),!S)if(a(h)!==null)S=!0,I||(I=!0,B());else{var q=a(b);q!==null&&K(R,q.startTime-X)}}var I=!1,P=-1,O=5,_=-1;function L(){return k?!0:!(e.unstable_now()-_X&&L());){var Y=v.callback;if(typeof Y=="function"){v.callback=null,w=v.priorityLevel;var F=Y(v.expirationTime<=X);if(X=e.unstable_now(),typeof F=="function"){v.callback=F,A(X),q=!0;break t}v===a(h)&&o(h),A(X)}else o(h);v=a(h)}if(v!==null)q=!0;else{var G=a(b);G!==null&&K(R,G.startTime-X),q=!1}}break e}finally{v=null,w=$,j=!1}q=void 0}}finally{q?B():I=!1}}}var B;if(typeof C=="function")B=function(){C(H)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,Q=z.port2;z.port1.onmessage=H,B=function(){Q.postMessage(null)}}else B=function(){T(H,0)};function K(X,q){P=T(function(){X(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_forceFrameRate=function(X){0>X||125Y?(X.sortIndex=$,t(b,X),a(h)===null&&X===a(b)&&(N?(D(P),P=-1):N=!0,K(R,$-Y))):(X.sortIndex=F,t(h,X),S||j||(S=!0,I||(I=!0,B()))),X},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(X){var q=w;return function(){var $=w;w=q;try{return X.apply(this,arguments)}finally{w=$}}}})(kw)),kw}var RR;function b8(){return RR||(RR=1,Nw.exports=x8()),Nw.exports}var OR;function v8(){if(OR)return Cf;OR=1;var e=b8(),t=Vd(),a=S1();function o(n){var l="https://react.dev/errors/"+n;if(1Ce||(n.current=te[Ce],te[Ce]=null,Ce--)}function ke(n,l){Ce++,te[Ce]=n.current,n.current=l}var Ee=re(null),ve=re(null),he=re(null),ye=re(null);function je(n,l){switch(ke(he,l),ke(ve,n),ke(Ee,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?q3(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=q3(l),n=G3(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}de(Ee),ke(Ee,n)}function xe(){de(Ee),de(ve),de(he)}function Te(n){var l=n.memoizedState;l!==null&&(zd._currentValue=l.memoizedState,ke(ye,n)),l=Ee.current;var i=G3(l,n.type);l!==i&&(ke(ve,n),ke(Ee,i))}function Oe(n){ve.current===n&&(de(Ee),de(ve)),ye.current===n&&(de(ye),zd._currentValue=fe)}var Ne,_e;function Ye(n){if(Ne===void 0)try{throw Error()}catch(i){var l=i.stack.trim().match(/\n( *(at )?)/);Ne=l&&l[1]||"",_e=-1)":-1m||ne[u]!==me[m]){var Se=` `+ne[u].replace(" at new "," at ");return n.displayName&&Se.includes("")&&(Se=Se.replace("",n.displayName)),Se}while(1<=u&&0<=m);break}}}finally{kt=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ye(i):""}function Rt(n,l){switch(n.tag){case 26:case 27:case 5:return Ye(n.type);case 16:return Ye("Lazy");case 13:return n.child!==l&&l!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return Ct(n.type,!1);case 11:return Ct(n.type.render,!1);case 1:return Ct(n.type,!0);case 31:return Ye("Activity");case 30:return Ye("ViewTransition");default:return""}}function ot(n){try{var l="",i=null;do l+=Rt(n,i),i=n,n=n.return;while(n);return l}catch(u){return` Error generating stack: `+u.message+` -`+u.stack}}var qn=Object.prototype.hasOwnProperty,fs=e.unstable_scheduleCallback,Gn=e.unstable_cancelCallback,bs=e.unstable_shouldYield,it=e.unstable_requestPaint,Vt=e.unstable_now,Hn=e.unstable_getCurrentPriorityLevel,tn=e.unstable_ImmediatePriority,nt=e.unstable_UserBlockingPriority,Ot=e.unstable_NormalPriority,Ft=e.unstable_LowPriority,Zn=e.unstable_IdlePriority,Un=e.log,Vn=e.unstable_setDisableYieldValue,Rn=null,Jt=null;function ls(n){if(typeof Un=="function"&&Vn(n),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Rn,n)}catch{}}var Tt=Math.clz32?Math.clz32:jt,xt=Math.log,wt=Math.LN2;function jt(n){return n>>>=0,n===0?32:31-(xt(n)/wt|0)|0}var Nr=256,rr=262144,Hr=4194304;function wn(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function rl(n,l,i){var u=n.pendingLanes;if(u===0)return 0;var m=0,g=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var V=u&134217727;return V!==0?(u=V&~g,u!==0?m=wn(u):(E&=V,E!==0?m=wn(E):i||(i=V&~n,i!==0&&(m=wn(i))))):(V=u&~g,V!==0?m=wn(V):E!==0?m=wn(E):i||(i=u&~n,i!==0&&(m=wn(i)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,i=l&-l,g>=i||g===32&&(i&4194048)!==0)?l:m}function rn(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function ic(n,l){(l&8)!==0&&(l|=l&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=l;0i;i++)l.push(n);return l}function Ho(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Uo(n,l,i,u,m,g){var E=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var V=n.entanglements,ne=n.expirationTimes,me=n.hiddenUpdates;for(i=E&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yt=!1;if(lt)try{var On={};Object.defineProperty(On,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{Yt=!1}var mn=null,Mn=null,ps=null;function kr(){if(ps)return ps;var n,l=Mn,i=l.length,u,m="value"in mn?mn.value:mn.textContent,g=m.length;for(n=0;n=Yp),GP=" ",KP=!1;function YP(n,l){switch(n){case"keyup":return Ate.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XP(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ld=!1;function Ote(n,l){switch(n){case"compositionend":return XP(l);case"keypress":return l.which!==32?null:(KP=!0,GP);case"textInput":return n=l.data,n===GP&&KP?null:n;default:return null}}function Mte(n,l){if(ld)return n==="compositionend"||!QS&&YP(n,l)?(n=kr(),ps=Mn=mn=null,ld=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function s_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function r_(n,l){var i=s_(n);n=0;for(var u;i;){if(i.nodeType===3){if(u=n+i.textContent.length,n<=l&&u>=l)return{node:i,offset:l-n};n=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=s_(i)}}function a_(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?a_(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function l_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=JS(n.document);l instanceof n.HTMLIFrameElement;){try{var i=typeof l.contentWindow.location.href=="string"}catch{i=!1}if(i)n=l.contentWindow;else break;l=JS(n.document)}return l}function eN(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Hte=lt&&"documentMode"in document&&11>=document.documentMode,od=null,tN=null,Wp=null,nN=!1;function o_(n,l,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;nN||od==null||od!==JS(u)||(u=od,"selectionStart"in u&&eN(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Wp&&Zp(Wp,u)||(Wp=u,u=uv(tN,"onSelect"),0>=E,m-=E,ll=1<<32-Tt(l)+m|i<rt?(Ss=st,st=null):Ss=st.sibling;var Xt=ue(pe,st,be[rt],Ae);if(Xt===null){st===null&&(st=Ss);break}n&&st&&Xt.alternate===null&&l(pe,st),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt,st=Ss}if(rt===be.length)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;rtrt?(Ss=st,st=null):Ss=st.sibling;var gi=ue(pe,st,Xt.value,Ae);if(gi===null){st===null&&(st=Ss);break}n&&st&&gi.alternate===null&&l(pe,st),oe=g(gi,oe,rt),zt===null?Ge=gi:zt.sibling=gi,zt=gi,st=Ss}if(Xt.done)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;!Xt.done;rt++,Xt=be.next())Xt=Re(pe,Xt.value,Ae),Xt!==null&&(oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return Et&&Gl(pe,rt),Ge}for(st=u(st);!Xt.done;rt++,Xt=be.next())Xt=we(st,pe,rt,Xt.value,Ae),Xt!==null&&(n&&(Ss=Xt.alternate,Ss!==null&&st.delete(Ss.key===null?rt:Ss.key)),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return n&&st.forEach(function(Ose){return l(pe,Ose)}),Et&&Gl(pe,rt),Ge}function vt(pe,oe,be,Ae){if(typeof be=="object"&&be!==null&&be.type===H&&be.key===null&&be.props.ref===void 0&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case _:e:{for(var Ge=be.key;oe!==null;){if(oe.key===Ge){if(Ge=be.type,Ge===H){if(oe.tag===7){i(pe,oe.sibling),Ae=m(oe,be.props.children),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}}else if(oe.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&Ac(Ge)===oe.type){i(pe,oe.sibling),Ae=m(oe,be.props),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}i(pe,oe);break}else l(pe,oe);oe=oe.sibling}be.type===H?(Ae=jc(be.props.children,pe.mode,Ae,be.key),Zo(Ae,be),Ae.return=pe,pe=Ae):(Ae=hb(be.type,be.key,be.props,null,pe.mode,Ae),Zo(Ae,be),Ae.return=pe,pe=Ae)}return E(pe);case L:e:{for(Ge=be.key;oe!==null;){if(oe.key===Ge)if(oe.tag===4&&oe.stateNode.containerInfo===be.containerInfo&&oe.stateNode.implementation===be.implementation){i(pe,oe.sibling),Ae=m(oe,be.children||[]),Ae.return=pe,pe=Ae;break e}else{i(pe,oe);break}else l(pe,oe);oe=oe.sibling}Ae=cN(be,pe.mode,Ae),Ae.return=pe,pe=Ae}return E(pe);case F:return be=Ac(be),vt(pe,oe,be,Ae)}if(ie(be))return He(pe,oe,be,Ae);if(ae(be)){if(Ge=ae(be),typeof Ge!="function")throw Error(o(150));return be=Ge.call(be),We(pe,oe,be,Ae)}if(typeof be.then=="function")return vt(pe,oe,kb(be),Ae);if(be.$$typeof===K)return vt(pe,oe,wb(pe,be),Ae);Cb(pe,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,oe!==null&&oe.tag===6?(i(pe,oe.sibling),Ae=m(oe,be),Ae.return=pe,pe=Ae):(i(pe,oe),Ae=iN(be,pe.mode,Ae),Ae.return=pe,pe=Ae),E(pe)):i(pe,oe)}return function(pe,oe,be,Ae){try{rm=0;var Ge=vt(pe,oe,be,Ae);return gd=null,Ge}catch(st){if(st===hd||st===Sb)throw st;var zt=Cr(29,st,null,pe.mode);return zt.lanes=Ae,zt.return=pe,zt}}}var Oc=O_(!0),M_=O_(!1),Wo=!1;function vN(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yN(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Jo(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ei(n,l,i){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(an&2)!==0){var m=u.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),u.pending=l,l=mb(n),h_(n,null,i),l}return pb(n,u,l,i),mb(n)}function am(n,l,i){if(l=l.updateQueue,l!==null&&(l=l.shared,(i&4194048)!==0)){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}function wN(n,l){var i=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var m=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var E={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?m=g=E:g=g.next=E,i=i.next}while(i!==null);g===null?m=g=l:g=g.next=l}else m=g=l;i={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=l:n.next=l,i.lastBaseUpdate=l}var jN=!1;function lm(){if(jN){var n=md;if(n!==null)throw n}}function om(n,l,i,u){jN=!1;var m=n.updateQueue;Wo=!1;var g=m.firstBaseUpdate,E=m.lastBaseUpdate,V=m.shared.pending;if(V!==null){m.shared.pending=null;var ne=V,me=ne.next;ne.next=null,E===null?g=me:E.next=me,E=ne;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,V=Se.lastBaseUpdate,V!==E&&(V===null?Se.firstBaseUpdate=me:V.next=me,Se.lastBaseUpdate=ne))}if(g!==null){var Re=m.baseState;E=0,Se=me=ne=null,V=g;do{var ue=V.lane&-536870913,we=ue!==V.lane;if(we?(Lt&ue)===ue:(u&ue)===ue){ue!==0&&ue===Tc&&(jN=!0),Se!==null&&(Se=Se.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var He=n,We=V;ue=l;var vt=i;switch(We.tag){case 1:if(He=We.payload,typeof He=="function"){Re=He.call(vt,Re,ue);break e}Re=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=We.payload,ue=typeof He=="function"?He.call(vt,Re,ue):He,ue==null)break e;Re=P({},Re,ue);break e;case 2:Wo=!0}}ue=V.callback,ue!==null&&(n.flags|=64,we&&(n.flags|=8192),we=m.callbacks,we===null?m.callbacks=[ue]:we.push(ue))}else we={lane:ue,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Se===null?(me=Se=we,ne=Re):Se=Se.next=we,E|=ue;if(V=V.next,V===null){if(V=m.shared.pending,V===null)break;we=V,V=we.next,we.next=null,m.lastBaseUpdate=we,m.shared.pending=null}}while(!0);Se===null&&(ne=Re),m.baseState=ne,m.firstBaseUpdate=me,m.lastBaseUpdate=Se,g===null&&(m.shared.lanes=0),oi|=E,n.lanes=E,n.memoizedState=Re}}function D_(n,l){if(typeof n!="function")throw Error(o(191,n));n.call(l)}function I_(n,l){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;ng?g:8;var E=ge.T,V={};V.types=E!==null?E.types:null,ge.T=V,VN(n,!1,l,i);try{var ne=m(),me=ge.S;if(me!==null&&me(V,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Se=Zte(ne,u);dm(n,l,Se,Qr(n))}else dm(n,l,u,Qr(n))}catch(Re){dm(n,l,{then:function(){},status:"rejected",reason:Re},Qr())}finally{ee.p=g,E!==null&&V.types!==null&&(E.types=V.types),ge.T=E}}function sne(){}function HN(n,l,i,u){if(n.tag!==5)throw Error(o(476));var m=fL(n).queue;dL(n,m,l,fe,i===null?sne:function(){return pL(n),i(u)})}function fL(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:fe},next:null};var i={};return l.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:i},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function pL(n){var l=fL(n);l.next===null&&(l=n.alternate.memoizedState),dm(n,l.next.queue,{},Qr())}function UN(){return Gs(zd)}function mL(){return ms().memoizedState}function hL(){return ms().memoizedState}function rne(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var i=Qr();n=Jo(i);var u=ei(l,n,i);u!==null&&(Rr(u,l,i),am(u,l,i)),l={cache:hN()},n.payload=l;return}l=l.return}}function ane(n,l,i){var u=Qr();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_b(n)?xL(l,i):(i=lN(n,l,i,u),i!==null&&(Rr(i,n,u),bL(i,l,u)))}function gL(n,l,i){var u=Qr();dm(n,l,i,u)}function dm(n,l,i,u){var m={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(_b(n))xL(l,m);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var E=l.lastRenderedState,V=g(E,i);if(m.hasEagerState=!0,m.eagerState=V,qr(V,E))return pb(n,l,m,0),Dn===null&&fb(),!1}catch{}if(i=lN(n,l,m,u),i!==null)return Rr(i,n,u),bL(i,l,u),!0}return!1}function VN(n,l,i,u){if(u={lane:2,revertLane:Mk(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_b(n)){if(l)throw Error(o(479))}else l=lN(n,i,u,2),l!==null&&Rr(l,n,2)}function _b(n){var l=n.alternate;return n===bt||l!==null&&l===bt}function xL(n,l){xd=Ab=!0;var i=n.pending;i===null?l.next=l:(l.next=i.next,i.next=l),n.pending=l}function bL(n,l,i){if((i&4194048)!==0){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}var Lb={readContext:Gs,use:Mb,useCallback:os,useContext:os,useEffect:os,useImperativeHandle:os,useLayoutEffect:os,useInsertionEffect:os,useMemo:os,useReducer:os,useRef:os,useState:os,useDebugValue:os,useDeferredValue:os,useTransition:os,useSyncExternalStore:os,useId:os,useHostTransitionStatus:os,useFormState:os,useActionState:os,useOptimistic:os,useMemoCache:os,useCacheRefresh:os,useEffectEvent:os},vL={readContext:Gs,use:Mb,useCallback:function(n,l){return mr().memoizedState=[n,l===void 0?null:l],n},useContext:Gs,useEffect:nL,useImperativeHandle:function(n,l,i){i=i!=null?i.concat([n]):null,Ib(4194308,4,lL.bind(null,l,n),i)},useLayoutEffect:function(n,l){return Ib(4194308,4,n,l)},useInsertionEffect:function(n,l){Ib(4,2,n,l)},useMemo:function(n,l){var i=mr();l=l===void 0?null:l;var u=n();if(Mc){ls(!0);try{n()}finally{ls(!1)}}return i.memoizedState=[u,l],u},useReducer:function(n,l,i){var u=mr();if(i!==void 0){var m=i(l);if(Mc){ls(!0);try{i(l)}finally{ls(!1)}}}else m=l;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=ane.bind(null,bt,n),[u.memoizedState,n]},useRef:function(n){var l=mr();return n={current:n},l.memoizedState=n},useState:function(n){n=PN(n);var l=n.queue,i=gL.bind(null,bt,l);return l.dispatch=i,[n.memoizedState,i]},useDebugValue:zN,useDeferredValue:function(n,l){var i=mr();return BN(i,n,l)},useTransition:function(){var n=PN(!1);return n=dL.bind(null,bt,n.queue,!0,!1),mr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,i){var u=bt,m=mr();if(Et){if(i===void 0)throw Error(o(407));i=i()}else{if(i=l(),Dn===null)throw Error(o(349));(Lt&127)!==0||H_(u,l,i)}m.memoizedState=i;var g={value:i,getSnapshot:l};return m.queue=g,nL(V_.bind(null,u,g,n),[n]),u.flags|=2048,vd(9,{destroy:void 0},U_.bind(null,u,g,i,l),null),i},useId:function(){var n=mr(),l=Dn.identifierPrefix;if(Et){var i=ol,u=ll;i=(u&~(1<<32-Tt(u)-1)).toString(32)+i,l="_"+l+"R_"+i,i=Rb++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}g[Rs]=l,g[qs]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)g.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=g;e:switch(Qs(g,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Wl(l)}}return Ln(l),l.subtreeFlags&=-33554433,tk(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,i),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==u&&Wl(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(o(166));if(n=he.current,pd(l)){if(n=l.stateNode,i=l.memoizedProps,u=null,m=Ls,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[Rs]=l,n=!!(n.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||V3(n.nodeValue,i)),n||Xo(l,!0)}else n=Nm(n).createTextNode(u),n[Rs]=l,l.stateNode=n}return Ln(l),null;case 31:if(i=l.memoizedState,n===null||n.memoizedState!==null){if(u=pd(l),i!==null){if(n===null){if(!u)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),n=!1}else i=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return l.flags&256?(Gr(l),l):(Gr(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ln(l),null;case 13:if(u=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=pd(l),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(o(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));m[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),m=!1}else m=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Gr(l),l):(Gr(l),null)}return Gr(l),(l.flags&128)!==0?(l.lanes=i,l):(i=u!==null,n=n!==null&&n.memoizedState!==null,i&&(u=l.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==m&&(u.flags|=2048)),i!==n&&i&&(l.child.flags|=8192),Fb(l,l.updateQueue),Ln(l),null);case 4:return xe(),n===null&&_k(l.stateNode.containerInfo),l.flags|=67108864,Ln(l),null;case 10:return Yl(l.type),Ln(l),null;case 19:if(CN(l),u=l.memoizedState,u===null)return Ln(l),null;if(m=(l.flags&128)!==0,g=u.rendering,g===null)if(m)pm(u,!1);else{if(is!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(g=Eb(n),g!==null){for(l.flags|=128,pm(u,!1),n=g.updateQueue,l.updateQueue=n,Fb(l,n),l.subtreeFlags=0,n=i,i=l.child;i!==null;)g_(i,n),i=i.sibling;return im(l,Ys.current&1|2),Et&&Gl(l,u.treeForkCount),l.child}n=n.sibling}u.tail!==null&&Vt()>tv&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304)}else{if(!m)if(n=Eb(g),n!==null){if(l.flags|=128,m=!0,n=n.updateQueue,l.updateQueue=n,Fb(l,n),pm(u,!0),u.tail===null&&u.tailMode!=="collapsed"&&u.tailMode!=="visible"&&!g.alternate&&!Et)return Ln(l),null}else 2*Vt()-u.renderingStartTime>tv&&i!==536870912&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304);u.isBackwards?(g.sibling=l.child,l.child=g):(n=u.last,n!==null?n.sibling=g:l.child=g,u.last=g)}if(u.tail!==null){n=u.tail;e:{for(i=n;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Vt(),n.sibling=null,g=Ys.current,g=m?g&1|2:g&1,u.tailMode==="visible"||u.tailMode==="collapsed"||!i||Et?im(l,g):(i=g,ke(Ks,l),ke(Ys,i),lr===null&&(lr=l)),Et&&Gl(l,u.treeForkCount),n}return Ln(l),null;case 22:case 23:return Gr(l),NN(),u=l.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(i&536870912)!==0&&(l.flags&128)===0&&(Ln(l),l.subtreeFlags&6&&(l.flags|=8192)):Ln(l),i=l.updateQueue,i!==null&&Fb(l,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==i&&(l.flags|=2048),n!==null&&de(Ec),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),l.memoizedState.cache!==i&&(l.flags|=2048),Yl(ys),Ln(l),null;case 25:return null;case 30:return l.flags|=33554432,Ln(l),null}throw Error(o(156,l.tag))}function fne(n,l){switch(uN(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Yl(ys),xe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return Oe(l),null;case 31:if(l.memoizedState!==null){if(Gr(l),l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Gr(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return CN(l),n=l.flags,n&65536?(l.flags=n&-65537|128,n=l.memoizedState,n!==null&&(n.rendering=null,n.tail=null),l.flags|=4,l):null;case 4:return xe(),null;case 10:return Yl(l.type),null;case 22:case 23:return Gr(l),NN(),n!==null&&de(Ec),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Yl(ys),null;case 25:return null;default:return null}}function $L(n,l){switch(uN(l),l.tag){case 3:Yl(ys),xe();break;case 26:case 27:case 5:Oe(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Gr(l);break;case 13:Gr(l);break;case 19:CN(l);break;case 10:Yl(l.type);break;case 22:case 23:Gr(l),NN(),n!==null&&de(Ec);break;case 24:Yl(ys)}}function mm(n,l){try{var i=l.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&n)===n){u=void 0;var g=i.create,E=i.inst;u=g(),E.destroy=u}i=i.next}while(i!==m)}}catch(V){gn(l,l.return,V)}}function ri(n,l,i){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var g=m.next;u=g;do{if((u.tag&n)===n){var E=u.inst,V=E.destroy;if(V!==void 0){E.destroy=void 0,m=l;var ne=i,me=V;try{me()}catch(Se){gn(m,ne,Se)}}}u=u.next}while(u!==g)}}catch(Se){gn(l,l.return,Se)}}function qL(n){var l=n.updateQueue;if(l!==null){var i=n.stateNode;try{I_(l,i)}catch(u){gn(n,n.return,u)}}}function GL(n,l,i){i.props=Dc(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(u){gn(n,l,u)}}function il(n,l){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:var m=n.stateNode,g=Fl(n.memoizedProps,m);(m.ref===null||m.ref.name!==g)&&(m.ref=J3(g)),u=m.ref;break;case 7:if(n.stateNode===null){var E=new Zr(n);v(n.child,!1,nse,E,void 0,void 0),n.stateNode=E}u=n.stateNode;break;default:u=n.stateNode}typeof i=="function"?n.refCleanup=i(u):i.current=u}}catch(V){gn(n,l,V)}}function Xs(n,l){var i=n.ref,u=n.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(m){gn(n,l,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(m){gn(n,l,m)}else i.current=null}function $b(n,l){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&l!==null)for(var i=0;i title"))),Qs(u,l,i),u[Rs]=n,vs(u),l=u;break e;case"link":if(g=g5("link","href",m).get(l+(i.href||""))){for(E=0;Evt&&(E=vt,vt=We,We=E);var pe=r_(V,We),oe=r_(V,vt);if(pe&&oe&&(we.rangeCount!==1||we.anchorNode!==pe.node||we.anchorOffset!==pe.offset||we.focusNode!==oe.node||we.focusOffset!==oe.offset)){var be=Re.createRange();be.setStart(pe.node,pe.offset),we.removeAllRanges(),We>vt?(we.addRange(be),we.extend(oe.node,oe.offset)):(be.setEnd(oe.node,oe.offset),we.addRange(be))}}}}for(Re=[],we=V;we=we.parentNode;)we.nodeType===1&&Re.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;Vi?32:i,ge.T=null,i=jk,jk=null;var g=Va,E=ml;if(Wn=0,Lc=Va=null,ml=0,(an&6)!==0)throw Error(o(331));var V=an;if(an|=4,h3(g.current),f3(g,g.current,E,i),an=V,wm(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Rn,g)}catch{}return!0}finally{ee.p=m,ge.T=u,R3(n,l)}}function O3(n,l,i){l=ga(i,l),l=qN(n.stateNode,l,2),n=ei(n,l,2),n!==null&&(Ho(n,2),hl(n))}function gn(n,l,i){if(n.tag===3)O3(n,n,i);else for(;l!==null;){if(l.tag===3){O3(l,n,i);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ii===null||!ii.has(u))){n=ga(i,n),i=TL(2),u=ei(l,i,2),u!==null&&(EL(i,u,l,n),Ho(u,2),hl(u));break}}l=l.return}}function Ak(n,l,i){var u=n.pingCache;if(u===null){u=n.pingCache=new gne;var m=new Set;u.set(l,m)}else m=u.get(l),m===void 0&&(m=new Set,u.set(l,m));m.has(i)||(vk=!0,m.add(i),n=Nne.bind(null,n,l,i),l.then(n,n))}function Nne(n,l,i){var u=n.pingCache;u!==null&&u.delete(l),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Dn===n&&(Lt&i)===i&&((is===4||is===3&&(Lt&62914560)===Lt&&300>Vt()-ev)&&(an&2)===0?Rd(n,0):Jb|=i,kd===Lt&&(kd=0)),hl(n)}function M3(n,l){l===0&&(l=dr()),n=wc(n,l),n!==null&&(Ho(n,l),hl(n))}function kne(n){var l=n.memoizedState,i=0;l!==null&&(i=l.retryLane),M3(n,i)}function Cne(n,l){var i=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(i=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(l),M3(n,i)}function Tne(n,l){return fs(n,l)}var Md=null,Dd=null,Rk=!1,iv=!1,Ok=!1,ui=0;function hl(n){n!==Dd&&n.next===null&&(Dd===null?Md=Dd=n:Dd=Dd.next=n),iv=!0,Rk||(Rk=!0,Ane())}function wm(n,l){if(!Ok&&iv){Ok=!0;do for(var i=!1,u=Md;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var g=0;else{var E=u.suspendedLanes,V=u.pingedLanes;g=(1<<31-Tt(42|n)+1)-1,g&=m&~(E&~V),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,_3(u,g))}else g=Lt,g=rl(u,u===Dn?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||rn(u,g)||(i=!0,_3(u,g));u=u.next}while(i);Ok=!1}}function Ene(){D3()}function D3(){iv=Rk=!1;var n=0;ui!==0&&Hne()&&(n=ui);for(var l=Vt(),i=null,u=Md;u!==null;){var m=u.next,g=I3(u,l);g===0?(u.next=null,i===null?Md=m:i.next=m,m===null&&(Dd=i)):(i=u,(n!==0||(g&3)!==0)&&(iv=!0)),u=m}Wn!==0&&Wn!==5||wm(n),ui!==0&&(ui=0)}function I3(n,l){for(var i=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,g=n.pendingLanes&-62914561;0V)break;var Se=ne.transferSize,Re=ne.initiatorType;Se&&F3(Re)&&(ne=ne.responseEnd,E+=Se*(nepv){We.length=He;break}be=new Promise(Gne.bind(be)),We.push(be)}}}if(0"u"?null:document;function f5(n,l,i){var u=Pd;if(u&&typeof l=="string"&&l){var m=pr(l);m='link[rel="'+n+'"][href="'+m+'"]',typeof i=="string"&&(m+='[crossorigin="'+i+'"]'),d5.has(m)||(d5.add(m),n={rel:n,crossOrigin:i,href:l},u.querySelector(m)===null&&(l=u.createElement("link"),Qs(l,"link",n),vs(l),u.head.appendChild(l)))}}function dse(n){eo.D(n),f5("dns-prefetch",n,null)}function fse(n,l){eo.C(n,l),f5("preconnect",n,l)}function pse(n,l,i){eo.L(n,l,i);var u=Pd;if(u&&n&&l){var m='link[rel="preload"][as="'+pr(l)+'"]';l==="image"&&i&&i.imageSrcSet?(m+='[imagesrcset="'+pr(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(m+='[imagesizes="'+pr(i.imageSizes)+'"]')):m+='[href="'+pr(n)+'"]';var g=m;switch(l){case"style":g=_d(n);break;case"script":g=Ld(n)}if(!(ja.has(g)||(n=P({rel:"preload",href:l==="image"&&i&&i.imageSrcSet?void 0:n,as:l},i),ja.set(g,n),u.querySelector(m)!==null||l==="style"&&u.querySelector(Cm(g))||l==="script"&&u.querySelector(Tm(g))))){var E=u.createElement("link");Qs(E,"link",n),l==="style"&&(E[Os]=!0,E.onload=E.onerror=function(){Lp(E)}),vs(E),u.head.appendChild(E)}}}function mse(n,l){eo.m(n,l);var i=Pd;if(i&&n){var u=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+pr(u)+'"][href="'+pr(n)+'"]',g=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Ld(n)}if(!ja.has(g)&&(n=P({rel:"modulepreload",href:n},l),ja.set(g,n),i.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Tm(g)))return}u=i.createElement("link"),Qs(u,"link",n),vs(u),i.head.appendChild(u)}}}function hse(n,l,i){eo.S(n,l,i);var u=Pd;if(u&&n){var m=$o(u).hoistableStyles,g=_d(n);l=l||"default";var E=m.get(g);if(!E){var V={loading:0,preload:null};if(E=u.querySelector(Cm(g)))V.loading=5;else{n=P({rel:"stylesheet",href:n,"data-precedence":l},i),(i=ja.get(g))&&Wk(n,i);var ne=E=u.createElement("link");vs(ne),Qs(ne,"link",n),ne._p=new Promise(function(me,Se){ne.onload=me,ne.onerror=Se}),ne.addEventListener("load",function(){V.loading|=1}),ne.addEventListener("error",function(){V.loading|=2}),V.loading|=4,dv(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:V},m.set(g,E)}}}function gse(n,l){eo.X(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function xse(n,l){eo.M(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0,type:"module"},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function p5(n,l,i,u){var m=(m=he.current)?km(m):null;if(!m)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=_d(i.href),l=$o(m).hoistableStyles,u=l.get(i),u||(u={type:"style",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=_d(i.href);var g=$o(m).hoistableStyles,E=g.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,E),(g=m.querySelector(Cm(n)))?g._p||(E.instance=g,E.state.loading=5):(g=ja.get(n),g||(g={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ja.set(n,g)),bse(m,n,g,E.state))),l&&u===null)throw Error(o(528,""));return E}if(l&&u!==null)throw Error(o(529,""));return null;case"script":return l=i.async,i=i.src,typeof i=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(i=Ld(i),l=$o(m).hoistableScripts,u=l.get(i),u||(u={type:"script",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function _d(n){return'href="'+pr(n)+'"'}function Cm(n){return'link[rel="stylesheet"]['+n+"]"}function m5(n){return P({},n,{"data-precedence":n.precedence,precedence:null})}function bse(n,l,i,u){if(l=n.querySelector('link[rel="preload"][as="style"]['+l+"]")){if(l[Os]!==!0){u.loading=1;return}}else l=n.createElement("link"),l[Os]=!0,l.onload=l.onerror=Lp.bind(null,l),Qs(l,"link",i),vs(l),n.head.appendChild(l);u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2})}function Ld(n){return'[src="'+pr(n)+'"]'}function Tm(n){return"script[async]"+n}function h5(n,l,i){if(l.count++,l.instance===null)switch(l.type){case"style":var u=n.querySelector('style[data-href~="'+pr(i.href)+'"]');if(u)return l.instance=u,vs(u),u;var m=P({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),vs(u),Qs(u,"style",m),dv(u,i.precedence,n),l.instance=u;case"stylesheet":m=_d(i.href);var g=n.querySelector(Cm(m));if(g)return l.state.loading|=4,l.instance=g,vs(g),g;u=m5(i),(m=ja.get(m))&&Wk(u,m),g=(n.ownerDocument||n).createElement("link"),vs(g);var E=g;return E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),l.state.loading|=4,dv(g,i.precedence,n),l.instance=g;case"script":return g=Ld(i.src),(m=n.querySelector(Tm(g)))?(l.instance=m,vs(m),m):(u=i,(m=ja.get(g))&&(u=P({},i),Jk(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),vs(m),Qs(m,"link",u),n.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,dv(u,i.precedence,n));return l.instance}function dv(n,l,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,g=m,E=0;E title"):null)}function vse(n,l,i){if(i===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(n=l.disabled,typeof l.precedence=="string"&&n==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function x5(n,l){return n==="img"&&l.src!=null&&l.src!==""&&l.onLoad==null&&l.loading!=="lazy"}function b5(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function v5(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function y5(n,l){typeof l.decode=="function"&&(n.imgCount++,l.complete||(n.imgBytes+=v5(l),n.suspenseyImages.push(l)),n=jse.bind(n),l.decode().then(n,n))}function yse(n,l,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var m=_d(u.href),g=l.querySelector(Cm(m));if(g){l=g._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Em.bind(n),l.then(n,n)),i.state.loading|=4,i.instance=g,vs(g);return}g=l.ownerDocument||l,u=m5(u),(m=ja.get(m))&&Wk(u,m),g=g.createElement("link"),vs(g);var E=g;E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),i.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,l),(l=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Em.bind(n),l.addEventListener("load",i),l.addEventListener("error",i))}}var pv=0;function wse(n,l){return n.stylesheets&&n.count===0&&hv(n,n.stylesheets),0pv?50:800)+l);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function w5(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)hv(n,n.stylesheets);else if(n.unsuspend){var l=n.unsuspend;n.unsuspend=null,l()}}}function Em(){this.count--,w5(this)}function jse(){this.imgCount--,w5(this)}var mv=null;function hv(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,mv=new Map,l.forEach(Sse,n),mv=null,Em.call(n))}function Sse(n,l){if(!(l.state.loading&4)){var i=mv.get(n);if(i)var u=i.get(null);else{i=new Map,mv.set(n,i);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sw.exports=b8(),Sw.exports}var vn=v8();const rg=[20,50,100,200],ag=[20,50,100,200,"all"],du=50,DR="workbuddy-desktop-table-size:";function IR(e){return e==="all"?r("全部"):String(e)}function lg(e,t=ag,a=du){t.includes(a)||(a=t.includes(du)?du:t[0]);let o=null;try{o=localStorage.getItem(DR+e)}catch{return a}if(o===null||o.trim()==="")return a;if(o==="all")return t.includes("all")?"all":a;const c=Number(o);return Number.isFinite(c)&&t.includes(c)?c:a}function og(e,t){try{localStorage.setItem(DR+e,String(t))}catch{}}function ig(e,t,a={}){const o=a.sizes??ag,c=a.defaultSize??du,[d,f]=x.useState(()=>lg(t,o,c)),[p,h]=x.useState(1),b=Math.max(1,d==="all"?1:Math.ceil(e/d)),y=Math.min(Math.max(1,p),b);x.useEffect(()=>{y!==p&&h(y)},[y,p]);const v=x.useCallback(k=>{f(k),og(t,k),h(1)},[t]),w=x.useCallback(k=>{h(Math.min(Math.max(1,Math.round(k)||1),b))},[b]),j=d==="all"?0:(y-1)*d,S=d==="all"?e:Math.min(e,j+d),N=x.useCallback(k=>d==="all"?k.slice():k.slice(j,S),[d,j,S]);return{size:d,page:y,pageCount:b,rangeStart:e?j+1:0,rangeEnd:e?S:0,paged:d!=="all",setSize:v,goto:w,slice:N}}function Li({total:e,page:t,pageCount:a,size:o,sizes:c=ag,onSizeChange:d,onPageChange:f,range:p=null,disabled:h=!1,leading:b,className:y}){const[v,w]=x.useState(String(t));x.useEffect(()=>w(String(t)),[t]);const j=()=>{const k=v.trim();if(!k){w(String(t));return}const T=Number(k);if(!Number.isFinite(T)){w(String(t));return}const D=Math.min(Math.max(1,Math.round(T)),a);w(String(D)),D!==t&&f(D)},S=a<=1,N=e===0?r("共 0 条"):p?r("共 {total} 条 · 当前第 {start}–{end} 条",{total:e,start:p.start,end:p.end}):r("共 {total} 条(全部显示)",{total:e});return s.jsxs("div",{className:y?`panel-foot table-foot-bar ${y}`:"panel-foot table-foot-bar",children:[b,s.jsx("div",{className:"spacer"}),s.jsxs("div",{className:"table-foot-ctl",children:[s.jsx("span",{className:"table-foot-count",children:N}),s.jsxs("span",{className:"table-foot-size",children:[r("每页"),s.jsxs(ft,{value:String(o),onValueChange:k=>d(k==="all"?"all":Number(k)),children:[s.jsx(mt,{className:"h-[26px] w-[86px]",disabled:h,"aria-label":r("每页条数"),children:s.jsx(pt,{children:IR(o)})}),s.jsx(ht,{children:c.map(k=>s.jsx(qe,{value:String(k),children:IR(k)},String(k)))})]}),r("条")]}),s.jsxs("span",{className:"table-foot-jump",children:[r("跳至"),s.jsx($e,{className:"h-[26px] w-[52px] px-1 text-center",value:v,disabled:h||S,"aria-label":r("跳转到指定页"),title:S?r("当前只有一页"):r("跳转到第 1–{pageCount} 页",{pageCount:a}),inputMode:"numeric",onChange:k=>w(k.target.value),onKeyDown:k=>{k.key==="Enter"?(k.preventDefault(),j()):k.key==="Escape"&&w(String(t))},onBlur:j}),r("页")]}),s.jsx(OF,{page:t,pageCount:a,onPageChange:f,disabled:h})]})]})}const Cw=[{key:"pick",label:r("选择"),align:"center",legacyAlign:"left"},{key:"order",label:r("顺序"),title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),align:"center",legacyAlign:"left"},{key:"account",label:r("账号"),align:"center",legacyAlign:"left"},{key:"proxy",label:r("代理"),title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),align:"center"},{key:"connections",label:r("连接数"),title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),align:"center"},{key:"status",label:r("状态"),align:"center",legacyAlign:"left"},{key:"limits",label:r("限流"),title:r("该账号当前限流中的模型;点徽章看明细"),align:"center",legacyAlign:"left"},{key:"expiry",label:r("有效期"),align:"center",legacyAlign:"left"},{key:"usage",label:r("余额"),align:"center",legacyAlign:"left"},{key:"actions",label:r("操作"),align:"right"}],PR="agent2api-accounts-col-widths",Tf={pick:47,order:84,proxy:186,connections:56,status:80,limits:148,expiry:80,usage:132,actions:200},Tw=new Set(["account"]),y8=300,Ew=56,w8=new Set([...Object.keys(Tf),...Tw]),fu=(()=>{try{const e=JSON.parse(localStorage.getItem(PR)||"{}"),t={};for(const[a,o]of Object.entries(e||{})){const c=Number(o);w8.has(a)&&Number.isFinite(c)&&c>=Ew&&(t[a]=Math.round(c))}return t}catch{return{}}})();function _R(){try{localStorage.setItem(PR,JSON.stringify(fu))}catch{}}function j8(){return{...Tf,...fu}}function S8(e){let t=0;for(const a of e){const o=fu[a];o?t+=o:Tw.has(a)?t+=y8:Tf[a]?t+=Tf[a]:t+=Ew}return Math.round(t)}function LR(e,t){const a=e?.querySelector(`thead th:nth-child(${t+1})`),o=a?.getAttribute("data-col")||a?.className.match(/cell-([a-z]+)/)?.[1];if(!o)return null;const c=e?.querySelector(`colgroup col[data-col="${CSS.escape(o)}"]`)||e?.querySelectorAll("colgroup col")[t];return c?{key:o,col:c}:null}function N8(e,t,a){const o=Math.max(Ew,Math.round(a));e.style.width=o+"px",Tw.has(t)||o!==Tf[t]?fu[t]=o:delete fu[t]}let Aw=()=>{};function k8(e,t){if(Aw=t,!e)return;let a=null;e.addEventListener("pointerdown",o=>{if(o.button!==0)return;const c=o.target?.closest?.(".col-grip");if(!c)return;o.preventDefault();const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);if(!h)return;const b=o.clientX,y=h.col.getBoundingClientRect().width;c.classList.add("active"),document.body.classList.add("col-resizing");try{c.setPointerCapture(o.pointerId)}catch{}a={...h,startX:b,startWidth:y,grip:c,pointerId:o.pointerId},window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w),window.addEventListener("blur",w);function v(j){if(a){if(j.buttons===0){w();return}N8(a.col,a.key,a.startWidth+j.clientX-a.startX)}}function w(){if(!a)return;const{grip:j,pointerId:S}=a;a=null,j.classList.remove("active"),document.body.classList.remove("col-resizing");try{j.releasePointerCapture(S)}catch{}window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),window.removeEventListener("blur",w),_R(),Aw()}}),e.addEventListener("dblclick",o=>{const c=o.target?.closest?.(".col-grip");if(!c)return;const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);h&&(delete fu[h.key],_R(),Aw())})}function gt(){return window}function Jn(e,t){gt().wbApp?.toast?.(e,t)}function pu(e){return e instanceof Error&&e.message?e.message:String(e??"").trim()||r("未知错误")}function Rw(e){return(gt().wbApp?.getState?.()?.accounts?.accounts||[]).filter(a=>(a?.provider||"workbuddy")===e).length}function zR(e){const t=e?.name||"";if(t)return(gt().wbProviders?.customList?.()||[]).find(a=>(a.name||"")===t)}function C8(e){const t=e?.name||"";return t?(gt().wbPresetProviders?.list||[]).some(a=>a.name===t):!1}async function cg(e){const t=gt().__TAURI_INTERNALS__;if(!t||typeof t.invoke!="function")throw new Error(r("桌面运行时不可用(Tauri 未初始化)"));return t.invoke("api_request",{request:{method:"POST",path:"/api/accounts",body:e}})}function ug(e){return e?.name||e?.uid||e?.userId||""}function Ow(){gt().wbAddAccountModal?.close?.()}async function mu(e,t){Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ {label}账号已添加{name}",{label:t,name:e?`:${e}`:""}))}const hu=new Map;function Aa(e){return{defaultValue:hu.get(e)??"",onChange:t=>{const a=t.currentTarget.value;a?hu.set(e,a):hu.delete(e)}}}function So(e,t){t?hu.set(e,t):hu.delete(e);const a=document.getElementById(e);(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&(a.value=t)}function vr(e){const t=document.getElementById(e);return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value.trim():(hu.get(e)??"").trim()}function Mw(e){for(const t of e)So(t,"")}const zi={edition:"cn",loginMode:"embedded",socialRestore:!1},T8=100,E8=256,A8=e=>e.key==="name"?T8:E8,R8={provider:"raccoon",label:"小浣熊",addButton:r("添加小浣熊账号"),webLogin:{noteHtml:r("在内嵌窗口里完成官方登录,成功后自动加入账号列表。"),button:r("打开网页登录"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待"),busyText:r("等待小浣熊登录完成…")},manualTitle:r("粘贴 token / refreshToken"),manualNoteHtml:r('refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。'),fields:[{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用凭证里的账号名")},{key:"token",label:"token",rows:3,placeholder:r("粘贴 access_token(一长串 JWT)")},{key:"refreshToken",inputKey:"refresh",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。")},O8={provider:"catpaw",label:"CatPaw",webLogin:{noteHtml:r("用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。"),button:r("打开 CatPaw 网页登录"),busyText:r("等待 CatPaw 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的美团账号);完成后自动加入列表")}]},manualNote:r("token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。"),fields:[{key:"token",label:"token",rows:3,placeholder:r("CatPaw 的 X-Passport-Token(登录态 Cookie)")},{key:"uid",label:"uid",placeholder:r("必填,CatPaw 账号标识")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用登录名或 uid")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。"),desktopHint:r("读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录")},M8={provider:"autoclaw",label:r("AutoClaw 国内版"),manualNote:r("token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。"),smsLogin:{noteHtml:r("用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。")},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0},D8={provider:"autoclaw-intl",label:r("AutoClaw 国际版"),manualNote:r("国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。"),oauthLogin:{title:r("网页登录(Zai / Google)"),noteHtml:r("点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表")}]},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT(国际版账号的 access token)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0};function BR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开官方授权页完成设备码授权,登录的是{label}({site})的账号。",{label:a,site:o}),button:r("打开 Qoder 网页登录"),busyText:r("等待 Qoder 授权完成…"),edition:t==="qoder"?"cn":"global",modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口用全新环境,多账号互不影响;关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录账号);完成后自动加入列表")}]},manualTitle:r("使用个人访问令牌(PAT)"),manualNote:r("在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。",{label:a}),fields:[{key:"pat",label:"Qoder PAT",rows:3,placeholder:r("粘贴 Qoder 个人访问令牌(pt-…)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}const I8=BR({provider:"qoder",label:r("中国版"),siteNote:"qoder.com.cn"}),P8=BR({provider:"qoder-intl",label:r("国际版"),siteNote:"qoder.com"});function HR(e){const{provider:t,label:a,poolNote:o}=e;return{provider:t,label:a,desktop:!0,webLogin:{noteHtml:r("打开授权页完成确认,账号自动加入 {label}{note}",{label:a,note:o}),button:r("打开 Cline 授权页"),busyText:r("等待 Cline 授权确认…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表")}]},manualTitle:r("填写凭证"),manualNote:r("refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。",{label:a}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 workos:… 开头的令牌(不带前缀也会自动补上)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号姓名、邮箱或令牌指纹")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。",{label:a}),desktopHint:r("读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录")}}function UR(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,webLogin:{noteHtml:r("打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。",{label:a,site:o}),button:r("打开 Accio {label}登录页",{label:a}),busyText:r("等待 Accio {label}登录完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)",{label:a,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 Accio 的 accessToken")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}function VR(e){const{provider:t,label:a,site:o,planNote:c}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。",{label:a}),button:r("打开 ZCode {label}授权页",{label:a}),busyText:r("等待 ZCode {label}授权完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)",{site:o,label:a,plan:c}),fields:[{key:"accessToken",label:r("编码套餐 API Key"),rows:3,optional:!0,placeholder:r("用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)")},{key:"jwt",label:"Coding Plan JWT",inputKey:"jwt",rows:3,optional:!0,placeholder:r("用于领取套餐与查询余额;不填则这个账号不能领取与查余额")},{key:"userId",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于生成账号 id 与展示名")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动生成")}]}}const _8={provider:"codearts",label:"CodeArts",desktop:!1,webLogin:{noteHtml:r("打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。"),button:r("打开 CodeArts 授权页"),busyText:r("等待 CodeArts 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板")}]},manualTitle:r("粘贴登录凭据"),manualNoteHtml:r('整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {"codearts_provider_credential":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。'),fields:[{key:"credentialJson",label:r("凭据 JSON"),rows:8,jsonExpand:!0,placeholder:'{"codearts_provider_credential":{"access_key_id":"HSTA…","secret_access_key":"…","security_token":"…","expires_at":"2026-09-27T16:17:00.327Z","domain_id":"…","user_id":"…","user_name":"…","refresh_token":"eyJ…","oauth_context":{…}}}'},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用凭据里的 user_name")}]},L8={provider:"trae",label:"Trae",desktop:!1,webLogin:{noteHtml:r("打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。"),button:r("打开 Trae 授权页"),busyText:r("等待 Trae 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("Cloud-IDE-JWT(三段点分)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选;填了才能到期自动续期")},{key:"uid",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于去重与展示名(留空时网关会问一次上游)")},{key:"machineId",label:"machineId",optional:!0,placeholder:r("可选;UUID 形态,与凭据同生共死")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选;纯数字串(上游只收 8–24 位数字)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动用昵称")}]},z8={provider:"loomy",label:"Loomy",smsLogin:{noteHtml:r("用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。")},manualNote:r("粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。"),fields:[{key:"session",label:"session",rows:3,placeholder:r("登录 session(一长串)")},{key:"userId",label:"userId",optional:!0,placeholder:r("可选,讯飞侧 userid")},{key:"phone",label:r("手机号"),optional:!0,placeholder:r("可选,展示用")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用脱敏手机号或 userId")}],desktop:!1},B8={provider:"kuku",label:"KukuAI",webLogin:{noteHtml:r("在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。"),button:r("打开网页登录"),busyText:r("等待 KukuAI 登录完成…")},manualTitle:r("粘贴 Cookie"),manualNote:r("BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。"),fields:[{key:"cookie",label:"Cookie",rows:3,placeholder:r("BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号 uk")}],desktop:!0,desktopHint:r("读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录"),desktopNote:r("读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。")};function FR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 session cookie"),manualNoteHtml:r("粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。",{siteNote:o}),fields:[{key:"session",label:"session",rows:3,placeholder:r("monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)")},{key:"imageId",label:r("任务镜像 id"),optional:!0,placeholder:r("可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游返回的账号名或账号 id")}]}}const H8=FR({provider:"monkeycode",label:r("MonkeyCode"),siteNote:r("这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。")}),U8=FR({provider:"monkeycode-intl",label:r("MonkeyCode 国际版"),siteNote:r("这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。")}),V8={provider:"commandcode",label:r("Command Code"),desktop:!1,manualTitle:r("粘贴 API Key"),manualNote:r("粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。"),fields:[{key:"apiKey",label:"apiKey",rows:3,placeholder:r("user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 key 尾号")}]},F8={provider:"antigravity",label:r("Antigravity"),desktop:!1,webLogin:{noteHtml:r("在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。"),button:r("打开 Antigravity 网页登录"),busyText:r("等待 Google 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表")}]},manualTitle:r("粘贴 Google refresh token"),manualNoteHtml:r("粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。"),fields:[{key:"refreshToken",label:"refreshToken",rows:2,placeholder:r("1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)")},{key:"projectId",label:"projectId",optional:!0,placeholder:r("可选(cloudaicompanionProject):留空由网关自动发现")},{key:"email",label:"email",optional:!0,placeholder:r("可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用邮箱或令牌尾号")}]},$8={provider:"officeace",label:r("OfficeAce 果办"),desktop:!1,webLogin:{noteHtml:r("打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。"),button:r("打开授权页"),busyText:r("等待 OfficeAce 登录完成…")},manualTitle:r("粘贴网关凭据"),manualNoteHtml:r("从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。"),fields:[{key:"baseUrl",label:r("模型网关基址"),placeholder:"https://modelgw-…huaweicloud-agentarts.com/v2"},{key:"modelAppKey",label:r("网关 Key"),placeholder:"model_app_key"},{key:"modelAppSecret",label:r("网关 Secret"),placeholder:"model_app_secret"},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空用「OfficeAce 果办」")}]},q8={provider:"orcaterm",label:"OrcaTerm",desktop:!0,desktopHint:r("读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录"),desktopNote:r("读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。"),manualTitle:r("粘贴 accessToken"),manualNoteHtml:r("粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号昵称或 userId")}]},$R=[R8,O8,M8,D8,I8,P8,HR({provider:"cline-free",label:"Cline Free",poolNote:r("(免费额度池,模型名带 cline-free/ 前缀)。")}),HR({provider:"cline-pass",label:"Cline Pass",poolNote:r("(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。")}),UR({provider:"accio",label:r("国际版"),site:"www.accio.com",siteNote:r("国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。")}),UR({provider:"accio-cn",label:r("国内版"),site:"www.accio-ai.com",siteNote:r("国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。")}),VR({provider:"zcode",label:r("国内版"),site:"open.bigmodel.cn",planNote:r("国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。")}),VR({provider:"zcode-intl",label:r("国际版"),site:"api.z.ai",planNote:r("国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。")}),_8,L8,z8,B8,H8,U8,V8,F8,$8,q8],Bi="workbuddy",gu="custom",Dw="WorkBuddy";function G8(e){return $R.find(t=>t.provider===e)}const qR=[{id:"oauth",label:r("网页登录(Zai / Google)")},{id:"sms",label:r("手机验证码登录")},{id:"web",label:r("网页登录")},{id:"manual",label:r("填写凭证")},{id:"desktop",label:r("导入桌面端登录态")}],Iw=()=>gt().workbuddyDesktop?.platform||"";function GR(e){return!(e.desktop===!1||Iw()==="web"||e.desktopWindowsOnly&&Iw()==="macos")}function KR(e,t){return qR.filter(a=>a.id==="oauth"?!!e.oauthLogin:a.id==="sms"?!!e.smsLogin:a.id==="web"?!!e.webLogin&&(!e.webLogin?.region||t===e.webLogin.region):a.id==="desktop"?GR(e):!0).map(a=>a.id)}const K8=e=>e.manualTitle||r("填写凭证添加"),Y8=e=>e.manualNoteHtml?{html:e.manualNoteHtml}:{text:e.manualNote||""},X8=e=>e.addButton||r("添加 {name} 账号",{name:e.label}),Pw=(e,t)=>`${e.provider}-${t.inputKey||t.key}-input`,Ef="max-w-full flex-wrap [&_[data-slot=segmented-item]]:h-7 [&_[data-slot=segmented-item]]:px-3 [&_[data-slot=segmented-item]]:text-[12.5px]",Q8=r("登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)");let _w=!1;async function dg(e,t){if(!_w){_w=!0,e(!0);try{await t()}finally{_w=!1,e(!1)}}}function Af({html:e,text:t}){return e?s.jsx("p",{dangerouslySetInnerHTML:{__html:e}}):s.jsx("p",{children:t||""})}function Z8(e,t,a){let o;try{o=JSON.parse(t)}catch(c){return Jn(r("{name} 不是合法 JSON:{reason}",{name:e.label,reason:pu(c)}),"err"),!1}return!o||typeof o!="object"||Array.isArray(o)?(Jn(r("{name}要粘一个 JSON 对象(形如 {sample})",{name:e.label,sample:'{"codearts_provider_credential":{…}}'}),"err"),!1):(Object.assign(a,o),!0)}function W8({config:e,region:t,visible:a}){const o=e.provider,[c,d]=x.useState(!1),[f,p]=x.useState(""),h=Y8(e),b=e.fields.map(v=>Pw(e,v));async function y(){const v={provider:e.provider};e.regionOptions?.length&&(v.mode=t);for(const w of e.fields){const j=vr(Pw(e,w));if(!w.optional&&!j){Jn(r("请填写 {label}",{label:w.label}),"err");return}if(j){if(w.jsonExpand){if(!Z8(w,j,v))return;continue}v[w.key]=j}}await dg(d,async()=>{try{const w=await cg(v);Mw(b),p(""),await mu(ug(w?.account),e.label)}catch(w){Jn(r("添加失败:{reason}",{reason:pu(w)}),"err")}})}return s.jsxs(zn,{hidden:!a,onClick:v=>{v.target.closest("[data-raccoon-hint]")&&(v.preventDefault(),p(Q8))},children:[s.jsx("h3",{children:K8(e)}),s.jsx(Af,{...h}),e.fields.map(v=>{const w=Pw(e,v),j=v.optional?"":r("(必填)");return s.jsxs("div",{className:`field-row${v.rows?" stack":""}`,children:[s.jsxs("label",{htmlFor:w,children:[v.label,j]}),v.rows?s.jsx(Qc,{id:w,rows:v.rows,placeholder:v.placeholder,...Aa(w)}):s.jsx($e,{id:w,type:"text",maxLength:A8(v),placeholder:v.placeholder,...Aa(w)})]},w)}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${o}-add-button`,onClick:()=>{y()},disabled:c,children:c?r("添加中…"):X8(e)}),s.jsx("span",{className:"detail",id:`${o}-add-hint`,children:f})]})]})}function J8({config:e,visible:t}){const a=e.provider,[o,c]=x.useState(!1);if(!GR(e)||!e.desktopNote)return null;async function d(){await dg(c,async()=>{try{const f=await cg({provider:e.provider,importDesktop:!0});await mu(f?.account?.name||"",e.label)}catch(f){Jn(r("导入失败:{reason}",{reason:pu(f)}),"err")}})}return s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("从本机导入桌面端登录态")}),s.jsx("p",{children:e.desktopNote}),s.jsx("div",{className:"field-row",children:s.jsx(se,{id:`${a}-desktop-button`,title:e.desktopHint,onClick:()=>{d()},disabled:o,children:r(o?"导入中…":"从本机导入桌面端登录态")})})]})}function eq({config:e,mode:t,onModeChange:a,region:o,visible:c}){const d=e.webLogin,f=e.provider,p=x.useRef(t),h=x.useRef(o),b=x.useRef(null);return p.current=t,h.current=o,x.useEffect(()=>{const y=gt().wbWebLogin;if(!y||!d)return;const v=d.modes;b.current=y.create({provider:f,buttonId:`${f}-web-button`,cancelId:`${f}-web-cancel`,hintId:`${f}-web-hint`,busyText:d.busyText,texts:()=>{const w=v?.find(j=>j.value===p.current);return{button:d.button,hint:w?.hint||d.hint||""}},start:()=>gt().workbuddyDesktop?.startLogin(d.edition||h.current||"cn",p.current||"embedded",f),onSuccess:async w=>{Ow(),await gt().wbApp?.refresh?.();const j=w?.payload?.warning;j?Jn(r("账号已添加,但请留意:{warning}",{warning:j}),"err"):Jn(r("✅ {label}账号已添加",{label:e.label}))}})??null},[]),x.useEffect(()=>{b.current?.syncTexts()},[t]),d?s.jsxs(zn,{hidden:!c,children:[s.jsx("h3",{children:r("网页登录")}),s.jsx(Af,{html:d.noteHtml}),d.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:d.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${f}-web-button`,onClick:()=>b.current?.start(),children:d.button}),s.jsx(se,{id:`${f}-web-cancel`,variant:"outline",hidden:!0,onClick:()=>b.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:`${f}-web-hint`,children:d.hint||d.modes?.[0]?.hint||""})]})]}):null}function tq({config:e,visible:t}){const a=e.smsLogin,o=e.provider;return x.useEffect(()=>{a&>().wbSmsLogin?.create({provider:o,onSuccess:c=>mu(ug(c?.account),e.label)})},[]),a?s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("手机验证码登录")}),s.jsx(Af,{html:a.noteHtml,text:r("用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。")}),s.jsxs("div",{className:"sms-form",children:[s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-phone`,children:[r("手机号"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs(Ci,{children:[s.jsx(Ei,{id:`${o}-sms-phone`,type:"text",maxLength:11,placeholder:r("11 位大陆手机号"),...Aa(`${o}-sms-phone`)}),s.jsx(Ti,{align:"inline-end",children:s.jsx(h4,{id:`${o}-sms-send`,className:"text-primary-fg",children:r("获取验证码")})})]})]}),s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-code`,children:[r("验证码"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs("div",{className:"sms-pair",children:[s.jsx($e,{id:`${o}-sms-code`,className:"sms-code",type:"text",maxLength:6,placeholder:r("6 位数字")}),s.jsx("label",{className:"lb-inline",htmlFor:`${o}-sms-name`,children:r("备注名")}),s.jsx($e,{id:`${o}-sms-name`,className:"sms-name",type:"text",placeholder:r("可选,留空则用脱敏手机号"),...Aa(`${o}-sms-name`)})]})]}),s.jsxs("div",{className:"sms-foot",children:[s.jsx(se,{id:`${o}-sms-submit`,children:r("登录并添加")}),s.jsx("span",{className:"detail sms-hint",id:`${o}-sms-hint`})]})]})]}):null}function nq({config:e,mode:t,onModeChange:a,visible:o}){const c=e.oauthLogin,d=e.provider,f=x.useRef(t),p=x.useRef(null);f.current=t;const h=()=>c?.modes?.find(b=>b.value===f.current)?.hint||c?.hint||"";return x.useEffect(()=>{const b=gt().wbAutoclawOauth;!b||!c||(p.current=b.create({provider:d,mode:()=>f.current||"embedded",hint:h,cancelId:`${d}-oauth-cancel`,onSuccess:()=>mu("",e.label)})??null)},[]),x.useEffect(()=>{p.current?.syncTexts()},[t]),c?s.jsxs(zn,{hidden:!o,children:[s.jsx("h3",{children:c.title||r("网页登录")}),s.jsx(Af,{html:c.noteHtml}),c.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:c.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${d}-oauth-zai`,children:r("使用 Zai 账号登录")}),s.jsx(se,{id:`${d}-oauth-google`,variant:"outline",children:r("使用 Google 账号登录")}),s.jsx(se,{id:`${d}-oauth-cancel`,variant:"outline",hidden:!0,children:r("取消")})]}),s.jsx("div",{className:"field-row",children:s.jsx("span",{className:"detail",id:`${d}-oauth-hint`,children:c.modes?.[0]?.hint||c.hint||""})})]}):null}function sq({config:e,active:t}){const a=e.regionOptions?.[0]?.value??"",[o,c]=x.useState(a),[d,f]=x.useState(()=>KR(e,a)[0]),[p,h]=x.useState(e.webLogin?.modes?.[0]?.value??""),[b,y]=x.useState(e.oauthLogin?.modes?.[0]?.value??""),v=KR(e,o),w=v.includes(d)?d:v[0],j=x.useMemo(()=>qR.filter(S=>v.includes(S.id)).map(S=>({value:S.id,label:S.label})),[v.join(",")]);return s.jsxs("div",{className:"add-provider-block",hidden:!t,children:[e.regionOptions?.length?s.jsxs(zn,{children:[s.jsx("h3",{children:r("地区")}),s.jsx(In,{"aria-label":r("{label} 账号地区",{label:e.label}),className:Ef,options:e.regionOptions,value:o,onValueChange:c})]}):null,s.jsxs(zn,{children:[s.jsx("h3",{children:r("添加方式")}),s.jsx(In,{"aria-label":r("{label} 账号的添加方式",{label:e.label}),className:Ef,options:j,value:w,onValueChange:S=>f(S)})]}),s.jsx(nq,{config:e,mode:b,onModeChange:y,visible:w==="oauth"}),s.jsx(tq,{config:e,visible:w==="sms"}),s.jsx(eq,{config:e,mode:p,onModeChange:h,region:o,visible:w==="web"}),s.jsx(W8,{config:e,region:o,visible:w==="manual"}),s.jsx(J8,{config:e,visible:w==="desktop"})]})}const rq=r("官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth"),fg="workbuddy-file-name";function Lw(e,t,a){const o=e[a],c=[];o&&typeof o=="object"&&!Array.isArray(o)&&c.push(o),c.push(e);for(const d of c)for(const f of t){const p=d[f];if(typeof p=="string"&&p.trim())return p.trim()}return""}function aq(e){const t=Lw(e,["domain"],"auth");return/workbuddy\.ai/i.test(t)?"intl":/workbuddy\.cn|codebuddy\.cn/i.test(t)?"cn":null}function lq({edition:e}){const[t,a]=x.useState(!1),[o,c]=x.useState(""),d=x.useRef(null);async function f(h){await dg(a,async()=>{try{let b;try{b=JSON.parse(await h.text())}catch{Jn(r("选择的文件不是合法 JSON"),"err");return}if(!b||typeof b!="object"||Array.isArray(b)){Jn(r("不是有效的凭证文件:内容要是一个 JSON 对象"),"err");return}const y=b,v=Lw(y,["accessToken","token","access_token"],"auth"),w=Lw(y,["uid"],"account");if(!v||!w){Jn(r("不是有效的凭证文件:需要包含 accessToken 与 uid"),"err");return}const j=aq(y),S=j??e;j&&j!==e&&Jn(r("文件是{edition}凭证,已按该版本导入",{edition:r(j==="intl"?"国际版":"国内版")}),"warn");const N=vr(fg),k={...y,provider:pg(S)};N&&(k.name=N);const T=await cg(k);c(""),await mu(ug(T?.account),S==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(b){Jn(r("导入失败:{reason}",{reason:pu(b)}),"err")}})}async function p(){await dg(a,async()=>{try{const h=await cg({provider:pg(e),importDesktop:!0});await mu(ug(h?.account),e==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(h){Jn(r("导入失败:{reason}",{reason:pu(h)}),"err")}})}return s.jsxs(zn,{children:[s.jsx("h3",{children:r("导入凭证文件")}),s.jsx(Af,{text:r("选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。")}),s.jsx("p",{className:"detail",children:s.jsx("a",{href:"#",onClick:h=>{h.preventDefault(),c(rq)},children:r("凭证文件在哪?")})}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"lb-inline",htmlFor:fg,children:r("备注名")}),s.jsx($e,{id:fg,type:"text",maxLength:100,placeholder:r("可选,留空则用文件里的昵称"),...Aa(fg)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("input",{ref:d,type:"file",accept:".info,.json,application/json",hidden:!0,onChange:h=>{const b=h.target.files?.[0];h.target.value="",b&&f(b)}}),s.jsx(se,{onClick:()=>d.current?.click(),disabled:t,children:r(t?"导入中…":"选择凭证文件导入")}),Iw()!=="web"?s.jsx(se,{variant:"outline",onClick:()=>{p()},disabled:t,children:r("从本机导入桌面端登录态")}):null,s.jsx("span",{className:"detail",children:o})]})]})}function pg(e){return e==="intl"?"workbuddy-intl":"workbuddy"}function oq({active:e}){const[t,a]=x.useState(zi.edition),[o,c]=x.useState(zi.loginMode),[d,f]=x.useState(zi.socialRestore),p=x.useRef(t),h=x.useRef(o),b=x.useRef(d),y=x.useRef(null);p.current=t,h.current=o,b.current=d,x.useEffect(()=>{const T=gt().wbWebLogin;T&&(y.current=T.create({get provider(){return pg(p.current)},buttonId:"web-login-button",cancelId:"web-login-cancel",hintId:"web-login-hint",busyText:r("等待网页登录…"),texts:()=>{const D=h.current==="external";return{button:r(D?"在浏览器中打开登录页":"打开网页登录"),hint:r(D?"系统浏览器打开(复用已登录账号);完成后自动加入列表":"内嵌窗口打开;完成后自动加入列表,关窗即取消等待")}},start:()=>gt().workbuddyDesktop?.startLogin(p.current,h.current,pg(p.current),b.current),onSuccess:async()=>{const D=p.current==="intl"?r("国际版"):r("国内版");Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ 登录成功,{edition}账号已加入列表",{edition:D}))}})??null)},[]),x.useEffect(()=>{y.current?.syncTexts()},[t,o]);function v(T){const D=T==="intl"?"external":"embedded";a(T),zi.edition=T,c(D),zi.loginMode=D}function w(T){const D=T==="external"?"external":"embedded";c(D),zi.loginMode=D}const j=t==="intl",N=j&&o==="embedded",k=r(N?"国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口":j?"只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页":"国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)");return s.jsxs("div",{className:"add-provider-block",hidden:!e,children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("账号版本")}),s.jsx("p",{children:r("两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。")}),s.jsx(In,{"aria-label":r("账号版本"),className:Ef,options:[{value:"cn",label:r("国内版(WorkBuddy)")},{value:"intl",label:r("国际版(WorkBuddy AI)")}],value:t,onValueChange:T=>v(T)})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("网页登录")}),s.jsx("p",{children:r("完成登录后自动加入账号列表,昵称取自上游。")}),s.jsxs("div",{className:"field-row",children:[s.jsx("span",{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("网页登录的打开方式"),className:Ef,options:[{value:"embedded",label:r("内嵌窗口")},{value:"external",label:r("系统默认浏览器")}],value:o,onValueChange:w}),s.jsxs("label",{className:"flex items-center gap-2",title:k,children:[s.jsx(hs,{checked:d,disabled:!N,onCheckedChange:T=>{f(T),zi.socialRestore=T}}),s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("恢复 Google / GitHub 入口")})]})]}),s.jsx("p",{children:r("系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。")}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:"web-login-button",onClick:()=>y.current?.start(),children:r("打开网页登录")}),s.jsx(se,{id:"web-login-cancel",variant:"outline",hidden:!0,onClick:()=>y.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:"web-login-hint",children:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")})]})]}),s.jsx(lq,{edition:t})]})}const zw="proxy",Bw="preset",mg="custom",iq="import",Rf="preset:",Hw="__new__";function cq(e){return e===Bw||e===mg?e:zw}const hg={workbuddy:"assets/providers/workbuddy.png","workbuddy-intl":"assets/providers/workbuddy.png",raccoon:"assets/providers/raccoon.png",catpaw:"assets/providers/catpaw.png",autoclaw:"assets/providers/autoclaw.png","autoclaw-intl":"assets/providers/autoclaw.png",qoder:"assets/providers/qoder.png","qoder-intl":"assets/providers/qoder.png","cline-free":"assets/providers/cline.png","cline-pass":"assets/providers/cline.png",accio:"assets/providers/accio.png","accio-cn":"assets/providers/accio.png",zcode:"assets/providers/zcode.png","zcode-intl":"assets/providers/zcode.png",codearts:"assets/providers/codearts.png",trae:"assets/providers/trae.png",loomy:"assets/providers/loomy.png",kuku:"assets/providers/kuku.png",monkeycode:"assets/providers/monkeycode.png","monkeycode-intl":"assets/providers/monkeycode.png",commandcode:"assets/providers/commandcode.png",antigravity:"assets/providers/antigravity.png",officeace:"assets/providers/officeace.png",orcaterm:"assets/providers/orcaterm.png"},uq=new Set(["monkeycode","monkeycode-intl","commandcode","antigravity"]);function dq(e){const t=gt().wbProviders;if(e===Bw)return(gt().wbPresetProviders?.list||[]).map(h=>{const b=zR(h);return{id:Rf+h.key,label:h.name,count:b?Rw(b.id):0,preset:!0,builtId:b?.id||""}});if(e===mg)return(t?.customList?.()||[]).filter(h=>!C8(h)).map(h=>({id:h.id,label:h.name||h.id,count:Rw(h.id),custom:!0}));const a=t?.all?.()||[],o=(h,b)=>h===Bi?Dw:gt().wbProviders?.labelOf?.(h)||b,d=(a.length?a.map(h=>{const b=String(h.id||"");return{id:b,label:o(b,String(h.label||h.id||"")),count:Number(h.count)||0,beta:uq.has(b)}}):[{id:Bi,label:Dw,count:Rw(Bi)}]).filter(h=>h.id!=="workbuddy-intl"),f=d.findIndex(h=>h.id==="autoclaw-intl"),p=d.findIndex(h=>h.id==="autoclaw");return p>=0&&f>p&&d.splice(p+1,0,d.splice(f,1)[0]),d}function fq({item:e}){const t=e.id.startsWith(Rf)?gt().wbPresetProviders?.iconOf?.(e.id.slice(Rf.length))||"":hg[e.id];if(t)return s.jsx("span",{className:"add-provider-logo has-icon",children:s.jsx("img",{src:t,alt:"",loading:"lazy"})});const a=String(e.label||"?").trim().slice(0,1).toUpperCase()||"?";return s.jsx("span",{className:"add-provider-logo",children:a})}function pq(e){return e.preset?e.builtId?e.count?r("已建过 · {n} 个账号,点击继续添加",{n:e.count}):r("已建过,点击继续添加账号"):r("点开即预填,填 Key 接入"):e.custom?e.count?r("{n} 个账号,点击添加",{n:e.count}):r("点击添加账号"):e.count?r("{n} 个账号",{n:e.count}):r("还没有账号")}function mq({item:e,onPick:t}){return s.jsxs("button",{type:"button",className:"add-provider-card","data-provider":e.id,role:"option",onClick:()=>t(e.id),children:[s.jsx(fq,{item:e}),s.jsxs("span",{className:"add-provider-info",children:[s.jsxs("span",{className:"add-provider-name",children:[e.label,e.beta?s.jsx("span",{className:"add-provider-beta",children:"(beta)"}):null]}),s.jsx("span",{className:"add-provider-meta",children:pq(e)})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function hq({onPick:e}){return s.jsxs("button",{type:"button",className:"add-provider-card is-new","data-provider":Hw,role:"option",onClick:()=>e(Hw),children:[s.jsx("span",{className:"add-provider-logo is-new",children:"+"}),s.jsxs("span",{className:"add-provider-info",children:[s.jsx("span",{className:"add-provider-name",children:r("新建自定义提供商")}),s.jsx("span",{className:"add-provider-meta",children:r("接入一个兼容上游")})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function gq({accountType:e,onAccountTypeChange:t,search:a,onSearchChange:o,onPick:c,version:d,importing:f,importPanel:p}){const h=x.useMemo(()=>dq(e),[e,d]),b=a.trim().toLowerCase(),y=h.filter(w=>!b||w.label.toLowerCase().includes(b)),v=e===mg&&!b;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("选择提供商")}),s.jsxs("div",{className:"add-pick-row",style:f?{display:"none"}:void 0,children:[s.jsx(In,{"aria-label":r("账号类型"),className:Ef,options:[{value:zw,label:"Agent"},{value:Bw,label:r("预置 API")},{value:mg,label:r("自定义")}],value:e,onValueChange:w=>t(cq(w))}),s.jsx("span",{id:"add-search-wrap",className:"add-provider-search ml-auto max-w-[340px] min-w-0 flex-[1_1_200px]",children:s.jsxs(Ci,{children:[s.jsx(Ti,{children:"⌕"}),s.jsx(Ei,{id:"add-provider-search",type:"search",placeholder:r("搜索提供商…"),autoComplete:"off","aria-label":r("搜索提供商"),value:a,onChange:w=>o(w.currentTarget.value)})]})})]}),p,s.jsxs("div",{className:"add-provider-grid",id:"add-provider-grid",role:"listbox","aria-label":r("选择要添加账号的提供商"),style:f?{display:"none"}:void 0,children:[v?s.jsx(hq,{onPick:c}):null,y.map(w=>s.jsx(mq,{item:w,onPick:c},w.id)),!y.length&&b?s.jsx("div",{className:"add-provider-empty",children:r("没有匹配「{keyword}」的提供商",{keyword:a.trim()})}):null]})]})}function gg(e,t){return Pe().wbIcons?.icon?.(e,t)||""}function xq({account:e,rank:t}){const a=r("组内第 {rank} 位",{rank:t});return s.jsxs("div",{className:"order-cell",children:[s.jsx("span",{className:"order-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整组内顺序"),title:r("按住拖动,调整这个账号在本组内的顺序"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"order-rank",title:a,children:`#${t}`})]})}function bq({group:e,ids:t,collapsed:a}){const[o,c]=x.useState(!1),d="w-full justify-start px-2 font-normal";return s.jsxs(hf,{open:o,onOpenChange:c,children:[s.jsx(Hh,{render:s.jsx("button",{type:"button",className:"grp-iconbtn",title:r("本组操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[196px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("启用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!0)},children:r("全部启用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("禁用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!1)},children:r("全部禁用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("打开批量操作弹窗,并预选这一组的账号(改代理等动作在弹窗里挑参数)"),onClick:()=>{c(!1),yw(t,"proxy")},children:r("批量操作本组")}),s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:d,onClick:()=>{c(!1),JA(e.provider)},children:r(a?"展开这一组":"折叠这一组")})]})})]})}function vq({group:e,collapsed:t,colSpan:a}){const o=hg[e.provider];return s.jsx("tr",{className:"grp-band","data-provider":e.provider,children:s.jsx("td",{colSpan:a,children:s.jsxs("div",{className:"grp-band-inner",children:[s.jsx("span",{className:"queue-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整整组顺序"),title:r("按住拖动,调整这一家的组顺位(整组一起动)"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"grp-rank",title:r("组顺位:越小越先用(拖动分组带调整)"),children:r("第 {rank} 顺位",{rank:e.rank})}),s.jsx("span",{className:"grp-logo",children:o?s.jsx("img",{src:o,alt:"",loading:"lazy"}):s.jsx("span",{className:"grp-logo-txt",children:String(e.label||"?").trim().slice(0,1).toUpperCase()})}),s.jsx("span",{className:"grp-name",children:e.label}),s.jsx("span",{className:"grp-stat",children:r("{total} 个账号 · 启用 {enabled} · 禁用 {disabled}{limited}",{total:e.members.length,enabled:e.enabled,disabled:e.disabled,limited:e.limited>0?r(" · 限流 {n}",{n:e.limited}):""})}),s.jsx("span",{className:"grp-spacer"}),s.jsx("button",{type:"button",className:"grp-iconbtn grp-fold","aria-expanded":!t,title:r(t?"展开这一组":"折叠这一组"),onClick:()=>JA(e.provider),dangerouslySetInnerHTML:{__html:gg("chevronDown",14)}}),s.jsx(bq,{group:e,ids:e.accounts.map(c=>c.id),collapsed:t})]})})})}function yq({account:e}){const t=cr(e),a=l$(e);!t&&XF(e,Al(e))&&a.push({text:r("Token 限额 · 已禁用"),kind:"bad",title:r("本周期 Token 消耗达到限制器的上限,账号已被自动禁用(窗口重置也不恢复,需手动启用)")});const o=cu(e)||e.id;return s.jsxs(s.Fragment,{children:[s.jsx(hs,{checked:t,"aria-label":r("{action}{who}",{action:r(t?"禁用":"启用"),who:o}),title:r(t?"已启用,点击禁用(不参与转发)":"已禁用,点击启用"),onCheckedChange:c=>{xR(e.id,c)}}),a.length?s.jsx("div",{className:"status-tags",children:a.map(c=>s.jsx(ze,{shape:"tag",variant:c.kind==="bad"?"destructive":"secondary",title:c.title,children:c.text},c.text))}):null]})}function wq({account:e,open:t}){const a=pw(e);if(!a.length)return Fh(e,Za(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额")}):s.jsxs(ze,{variant:"success",shape:"tag",title:r("当前没有任何模型处于限流中"),children:[s.jsx(uy,{}),r("正常")]});const o=gw(a[0].resetAt);return s.jsxs(s.Fragment,{children:[s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:t?"ring-2 ring-warning-soft":void 0,title:r("点击{action}各模型的限流明细",{action:r(t?"收起":"查看")}),onClick:()=>nR(e.id,"limits",!t),children:r("{n} 个模型 ▾",{n:a.length})}),s.jsx("span",{className:"lim-sub",title:r("最早恢复"),children:r("最早 {soonest} 恢复",{soonest:o===hw?r("待定"):o})})]})}function jq({account:e}){const t=ir(kn(e)),a=SA(t.edition?e.expiresAt:e[t.expiry]);if(!a)return s.jsx("span",{className:"muted",title:r("记录里没有过期时间"),children:"—"});const o=a-Date.now();if(o<=0)return s.jsx(ze,{variant:"destructive",shape:"tag",title:r("凭证已过期,转发时会先刷新"),children:r("已过期")});const c=o<36e5?r("{n} 分钟后",{n:Math.max(1,Math.round(o/6e4))}):o<48*36e5?r("{n} 小时后",{n:(o/36e5).toFixed(1)}):r("{n} 天后",{n:Math.floor(o/24/36e5)}),d=Fs(a);return s.jsx("span",{title:d?r("{text}过期({full})",{text:c,full:d}):r("{text}过期",{text:c}),children:c})}function Sq({account:e}){const t=iR(e.id);return t<=0?null:s.jsx("span",{className:"conn-count",title:r("{n} 个请求正在使用该账号(含还在下发内容的流式请求)",{n:t}),children:t})}function yr(e){if(e==null||e==="")return"—";const t=Number(e);return Number.isFinite(t)?String(t):String(e)}function Nq(e){return!e||typeof e!="object"||Array.isArray(e)?"":YR(e.subscription)}function YR(e){if(!e||typeof e!="object")return"";const t=e,a=[];t.planName&&a.push(r("套餐 {name}",{name:String(t.planName)})),t.status&&a.push(r("状态 {status}",{status:String(t.status)})),t.state&&String(t.state)!=="active"&&a.push(_A(t.state));const o=t.expireAt;if(o!=null&&o!==""){const c=Number(o),d=Number.isFinite(c)&&c>1e11?Fs(c):String(o);d&&a.push(r("到期 {time}",{time:d}))}return Number.isFinite(Number(t.remainQuota))&&a.push(r("余量 {value}",{value:yr(t.remainQuota)})),Number.isFinite(Number(t.totalQuota))&&a.push(r("总量 {value}",{value:yr(t.totalQuota)})),a.join(" ")}function kq(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e.plans;return Array.isArray(t)?t.filter(a=>a&&typeof a=="object"&&String(a.state||"")==="pending"):[]}function Cq(e){const t=e.map(a=>{const o=String(a.name||a.planId||r("套餐")),c=Number(a.pendingUntil??a.startsAt);return Number.isFinite(c)&&c>0?r("{name}({time} 起生效)",{name:o,time:Fs(c*1e3)}):o});return r(`已领到、还没到生效时间的套餐(生效后余额列会按它显示): +`+u.stack}}var qn=Object.prototype.hasOwnProperty,fs=e.unstable_scheduleCallback,Gn=e.unstable_cancelCallback,bs=e.unstable_shouldYield,it=e.unstable_requestPaint,Vt=e.unstable_now,Hn=e.unstable_getCurrentPriorityLevel,tn=e.unstable_ImmediatePriority,nt=e.unstable_UserBlockingPriority,Ot=e.unstable_NormalPriority,Ft=e.unstable_LowPriority,Zn=e.unstable_IdlePriority,Un=e.log,Vn=e.unstable_setDisableYieldValue,Rn=null,Jt=null;function ls(n){if(typeof Un=="function"&&Vn(n),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Rn,n)}catch{}}var Tt=Math.clz32?Math.clz32:jt,xt=Math.log,wt=Math.LN2;function jt(n){return n>>>=0,n===0?32:31-(xt(n)/wt|0)|0}var Nr=256,rr=262144,Hr=4194304;function wn(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function rl(n,l,i){var u=n.pendingLanes;if(u===0)return 0;var m=0,g=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var V=u&134217727;return V!==0?(u=V&~g,u!==0?m=wn(u):(E&=V,E!==0?m=wn(E):i||(i=V&~n,i!==0&&(m=wn(i))))):(V=u&~g,V!==0?m=wn(V):E!==0?m=wn(E):i||(i=u&~n,i!==0&&(m=wn(i)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,i=l&-l,g>=i||g===32&&(i&4194048)!==0)?l:m}function rn(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function ic(n,l){(l&8)!==0&&(l|=l&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=l;0i;i++)l.push(n);return l}function Ho(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Uo(n,l,i,u,m,g){var E=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var V=n.entanglements,ne=n.expirationTimes,me=n.hiddenUpdates;for(i=E&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yt=!1;if(lt)try{var On={};Object.defineProperty(On,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{Yt=!1}var mn=null,Mn=null,ps=null;function kr(){if(ps)return ps;var n,l=Mn,i=l.length,u,m="value"in mn?mn.value:mn.textContent,g=m.length;for(n=0;n=Yp),KP=" ",YP=!1;function XP(n,l){switch(n){case"keyup":return Mte.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function QP(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ld=!1;function Ite(n,l){switch(n){case"compositionend":return QP(l);case"keypress":return l.which!==32?null:(YP=!0,KP);case"textInput":return n=l.data,n===KP&&YP?null:n;default:return null}}function Pte(n,l){if(ld)return n==="compositionend"||!QS&&XP(n,l)?(n=kr(),ps=Mn=mn=null,ld=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function r_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function a_(n,l){var i=r_(n);n=0;for(var u;i;){if(i.nodeType===3){if(u=n+i.textContent.length,n<=l&&u>=l)return{node:i,offset:l-n};n=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=r_(i)}}function l_(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?l_(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function o_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=JS(n.document);l instanceof n.HTMLIFrameElement;){try{var i=typeof l.contentWindow.location.href=="string"}catch{i=!1}if(i)n=l.contentWindow;else break;l=JS(n.document)}return l}function eN(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Fte=lt&&"documentMode"in document&&11>=document.documentMode,od=null,tN=null,Wp=null,nN=!1;function i_(n,l,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;nN||od==null||od!==JS(u)||(u=od,"selectionStart"in u&&eN(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Wp&&Zp(Wp,u)||(Wp=u,u=uv(tN,"onSelect"),0>=E,m-=E,ll=1<<32-Tt(l)+m|i<rt?(Ss=st,st=null):Ss=st.sibling;var Xt=ue(pe,st,be[rt],Ae);if(Xt===null){st===null&&(st=Ss);break}n&&st&&Xt.alternate===null&&l(pe,st),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt,st=Ss}if(rt===be.length)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;rtrt?(Ss=st,st=null):Ss=st.sibling;var gi=ue(pe,st,Xt.value,Ae);if(gi===null){st===null&&(st=Ss);break}n&&st&&gi.alternate===null&&l(pe,st),oe=g(gi,oe,rt),zt===null?Ge=gi:zt.sibling=gi,zt=gi,st=Ss}if(Xt.done)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;!Xt.done;rt++,Xt=be.next())Xt=Re(pe,Xt.value,Ae),Xt!==null&&(oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return Et&&Gl(pe,rt),Ge}for(st=u(st);!Xt.done;rt++,Xt=be.next())Xt=we(st,pe,rt,Xt.value,Ae),Xt!==null&&(n&&(Ss=Xt.alternate,Ss!==null&&st.delete(Ss.key===null?rt:Ss.key)),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return n&&st.forEach(function(Ise){return l(pe,Ise)}),Et&&Gl(pe,rt),Ge}function vt(pe,oe,be,Ae){if(typeof be=="object"&&be!==null&&be.type===H&&be.key===null&&be.props.ref===void 0&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case _:e:{for(var Ge=be.key;oe!==null;){if(oe.key===Ge){if(Ge=be.type,Ge===H){if(oe.tag===7){i(pe,oe.sibling),Ae=m(oe,be.props.children),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}}else if(oe.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&Ac(Ge)===oe.type){i(pe,oe.sibling),Ae=m(oe,be.props),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}i(pe,oe);break}else l(pe,oe);oe=oe.sibling}be.type===H?(Ae=jc(be.props.children,pe.mode,Ae,be.key),Zo(Ae,be),Ae.return=pe,pe=Ae):(Ae=hb(be.type,be.key,be.props,null,pe.mode,Ae),Zo(Ae,be),Ae.return=pe,pe=Ae)}return E(pe);case L:e:{for(Ge=be.key;oe!==null;){if(oe.key===Ge)if(oe.tag===4&&oe.stateNode.containerInfo===be.containerInfo&&oe.stateNode.implementation===be.implementation){i(pe,oe.sibling),Ae=m(oe,be.children||[]),Ae.return=pe,pe=Ae;break e}else{i(pe,oe);break}else l(pe,oe);oe=oe.sibling}Ae=cN(be,pe.mode,Ae),Ae.return=pe,pe=Ae}return E(pe);case F:return be=Ac(be),vt(pe,oe,be,Ae)}if(ie(be))return He(pe,oe,be,Ae);if(ae(be)){if(Ge=ae(be),typeof Ge!="function")throw Error(o(150));return be=Ge.call(be),We(pe,oe,be,Ae)}if(typeof be.then=="function")return vt(pe,oe,kb(be),Ae);if(be.$$typeof===K)return vt(pe,oe,wb(pe,be),Ae);Cb(pe,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,oe!==null&&oe.tag===6?(i(pe,oe.sibling),Ae=m(oe,be),Ae.return=pe,pe=Ae):(i(pe,oe),Ae=iN(be,pe.mode,Ae),Ae.return=pe,pe=Ae),E(pe)):i(pe,oe)}return function(pe,oe,be,Ae){try{rm=0;var Ge=vt(pe,oe,be,Ae);return gd=null,Ge}catch(st){if(st===hd||st===Sb)throw st;var zt=Cr(29,st,null,pe.mode);return zt.lanes=Ae,zt.return=pe,zt}}}var Oc=M_(!0),D_=M_(!1),Wo=!1;function vN(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yN(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Jo(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ei(n,l,i){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(an&2)!==0){var m=u.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),u.pending=l,l=mb(n),g_(n,null,i),l}return pb(n,u,l,i),mb(n)}function am(n,l,i){if(l=l.updateQueue,l!==null&&(l=l.shared,(i&4194048)!==0)){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}function wN(n,l){var i=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var m=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var E={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?m=g=E:g=g.next=E,i=i.next}while(i!==null);g===null?m=g=l:g=g.next=l}else m=g=l;i={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=l:n.next=l,i.lastBaseUpdate=l}var jN=!1;function lm(){if(jN){var n=md;if(n!==null)throw n}}function om(n,l,i,u){jN=!1;var m=n.updateQueue;Wo=!1;var g=m.firstBaseUpdate,E=m.lastBaseUpdate,V=m.shared.pending;if(V!==null){m.shared.pending=null;var ne=V,me=ne.next;ne.next=null,E===null?g=me:E.next=me,E=ne;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,V=Se.lastBaseUpdate,V!==E&&(V===null?Se.firstBaseUpdate=me:V.next=me,Se.lastBaseUpdate=ne))}if(g!==null){var Re=m.baseState;E=0,Se=me=ne=null,V=g;do{var ue=V.lane&-536870913,we=ue!==V.lane;if(we?(Lt&ue)===ue:(u&ue)===ue){ue!==0&&ue===Tc&&(jN=!0),Se!==null&&(Se=Se.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var He=n,We=V;ue=l;var vt=i;switch(We.tag){case 1:if(He=We.payload,typeof He=="function"){Re=He.call(vt,Re,ue);break e}Re=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=We.payload,ue=typeof He=="function"?He.call(vt,Re,ue):He,ue==null)break e;Re=P({},Re,ue);break e;case 2:Wo=!0}}ue=V.callback,ue!==null&&(n.flags|=64,we&&(n.flags|=8192),we=m.callbacks,we===null?m.callbacks=[ue]:we.push(ue))}else we={lane:ue,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Se===null?(me=Se=we,ne=Re):Se=Se.next=we,E|=ue;if(V=V.next,V===null){if(V=m.shared.pending,V===null)break;we=V,V=we.next,we.next=null,m.lastBaseUpdate=we,m.shared.pending=null}}while(!0);Se===null&&(ne=Re),m.baseState=ne,m.firstBaseUpdate=me,m.lastBaseUpdate=Se,g===null&&(m.shared.lanes=0),oi|=E,n.lanes=E,n.memoizedState=Re}}function I_(n,l){if(typeof n!="function")throw Error(o(191,n));n.call(l)}function P_(n,l){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;ng?g:8;var E=ge.T,V={};V.types=E!==null?E.types:null,ge.T=V,VN(n,!1,l,i);try{var ne=m(),me=ge.S;if(me!==null&&me(V,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Se=ene(ne,u);dm(n,l,Se,Qr(n))}else dm(n,l,u,Qr(n))}catch(Re){dm(n,l,{then:function(){},status:"rejected",reason:Re},Qr())}finally{ee.p=g,E!==null&&V.types!==null&&(E.types=V.types),ge.T=E}}function lne(){}function HN(n,l,i,u){if(n.tag!==5)throw Error(o(476));var m=pL(n).queue;fL(n,m,l,fe,i===null?lne:function(){return mL(n),i(u)})}function pL(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:fe},next:null};var i={};return l.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:i},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function mL(n){var l=pL(n);l.next===null&&(l=n.alternate.memoizedState),dm(n,l.next.queue,{},Qr())}function UN(){return Gs(zd)}function hL(){return ms().memoizedState}function gL(){return ms().memoizedState}function one(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var i=Qr();n=Jo(i);var u=ei(l,n,i);u!==null&&(Rr(u,l,i),am(u,l,i)),l={cache:hN()},n.payload=l;return}l=l.return}}function ine(n,l,i){var u=Qr();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_b(n)?bL(l,i):(i=lN(n,l,i,u),i!==null&&(Rr(i,n,u),vL(i,l,u)))}function xL(n,l,i){var u=Qr();dm(n,l,i,u)}function dm(n,l,i,u){var m={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(_b(n))bL(l,m);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var E=l.lastRenderedState,V=g(E,i);if(m.hasEagerState=!0,m.eagerState=V,qr(V,E))return pb(n,l,m,0),Dn===null&&fb(),!1}catch{}if(i=lN(n,l,m,u),i!==null)return Rr(i,n,u),vL(i,l,u),!0}return!1}function VN(n,l,i,u){if(u={lane:2,revertLane:Mk(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_b(n)){if(l)throw Error(o(479))}else l=lN(n,i,u,2),l!==null&&Rr(l,n,2)}function _b(n){var l=n.alternate;return n===bt||l!==null&&l===bt}function bL(n,l){xd=Ab=!0;var i=n.pending;i===null?l.next=l:(l.next=i.next,i.next=l),n.pending=l}function vL(n,l,i){if((i&4194048)!==0){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}var Lb={readContext:Gs,use:Mb,useCallback:os,useContext:os,useEffect:os,useImperativeHandle:os,useLayoutEffect:os,useInsertionEffect:os,useMemo:os,useReducer:os,useRef:os,useState:os,useDebugValue:os,useDeferredValue:os,useTransition:os,useSyncExternalStore:os,useId:os,useHostTransitionStatus:os,useFormState:os,useActionState:os,useOptimistic:os,useMemoCache:os,useCacheRefresh:os,useEffectEvent:os},yL={readContext:Gs,use:Mb,useCallback:function(n,l){return mr().memoizedState=[n,l===void 0?null:l],n},useContext:Gs,useEffect:sL,useImperativeHandle:function(n,l,i){i=i!=null?i.concat([n]):null,Ib(4194308,4,oL.bind(null,l,n),i)},useLayoutEffect:function(n,l){return Ib(4194308,4,n,l)},useInsertionEffect:function(n,l){Ib(4,2,n,l)},useMemo:function(n,l){var i=mr();l=l===void 0?null:l;var u=n();if(Mc){ls(!0);try{n()}finally{ls(!1)}}return i.memoizedState=[u,l],u},useReducer:function(n,l,i){var u=mr();if(i!==void 0){var m=i(l);if(Mc){ls(!0);try{i(l)}finally{ls(!1)}}}else m=l;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=ine.bind(null,bt,n),[u.memoizedState,n]},useRef:function(n){var l=mr();return n={current:n},l.memoizedState=n},useState:function(n){n=PN(n);var l=n.queue,i=xL.bind(null,bt,l);return l.dispatch=i,[n.memoizedState,i]},useDebugValue:zN,useDeferredValue:function(n,l){var i=mr();return BN(i,n,l)},useTransition:function(){var n=PN(!1);return n=fL.bind(null,bt,n.queue,!0,!1),mr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,i){var u=bt,m=mr();if(Et){if(i===void 0)throw Error(o(407));i=i()}else{if(i=l(),Dn===null)throw Error(o(349));(Lt&127)!==0||U_(u,l,i)}m.memoizedState=i;var g={value:i,getSnapshot:l};return m.queue=g,sL(F_.bind(null,u,g,n),[n]),u.flags|=2048,vd(9,{destroy:void 0},V_.bind(null,u,g,i,l),null),i},useId:function(){var n=mr(),l=Dn.identifierPrefix;if(Et){var i=ol,u=ll;i=(u&~(1<<32-Tt(u)-1)).toString(32)+i,l="_"+l+"R_"+i,i=Rb++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}g[Rs]=l,g[qs]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)g.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=g;e:switch(Qs(g,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Wl(l)}}return Ln(l),l.subtreeFlags&=-33554433,tk(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,i),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==u&&Wl(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(o(166));if(n=he.current,pd(l)){if(n=l.stateNode,i=l.memoizedProps,u=null,m=Ls,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[Rs]=l,n=!!(n.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||F3(n.nodeValue,i)),n||Xo(l,!0)}else n=Nm(n).createTextNode(u),n[Rs]=l,l.stateNode=n}return Ln(l),null;case 31:if(i=l.memoizedState,n===null||n.memoizedState!==null){if(u=pd(l),i!==null){if(n===null){if(!u)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),n=!1}else i=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return l.flags&256?(Gr(l),l):(Gr(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ln(l),null;case 13:if(u=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=pd(l),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(o(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));m[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),m=!1}else m=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Gr(l),l):(Gr(l),null)}return Gr(l),(l.flags&128)!==0?(l.lanes=i,l):(i=u!==null,n=n!==null&&n.memoizedState!==null,i&&(u=l.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==m&&(u.flags|=2048)),i!==n&&i&&(l.child.flags|=8192),Fb(l,l.updateQueue),Ln(l),null);case 4:return xe(),n===null&&_k(l.stateNode.containerInfo),l.flags|=67108864,Ln(l),null;case 10:return Yl(l.type),Ln(l),null;case 19:if(CN(l),u=l.memoizedState,u===null)return Ln(l),null;if(m=(l.flags&128)!==0,g=u.rendering,g===null)if(m)pm(u,!1);else{if(is!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(g=Eb(n),g!==null){for(l.flags|=128,pm(u,!1),n=g.updateQueue,l.updateQueue=n,Fb(l,n),l.subtreeFlags=0,n=i,i=l.child;i!==null;)x_(i,n),i=i.sibling;return im(l,Ys.current&1|2),Et&&Gl(l,u.treeForkCount),l.child}n=n.sibling}u.tail!==null&&Vt()>tv&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304)}else{if(!m)if(n=Eb(g),n!==null){if(l.flags|=128,m=!0,n=n.updateQueue,l.updateQueue=n,Fb(l,n),pm(u,!0),u.tail===null&&u.tailMode!=="collapsed"&&u.tailMode!=="visible"&&!g.alternate&&!Et)return Ln(l),null}else 2*Vt()-u.renderingStartTime>tv&&i!==536870912&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304);u.isBackwards?(g.sibling=l.child,l.child=g):(n=u.last,n!==null?n.sibling=g:l.child=g,u.last=g)}if(u.tail!==null){n=u.tail;e:{for(i=n;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Vt(),n.sibling=null,g=Ys.current,g=m?g&1|2:g&1,u.tailMode==="visible"||u.tailMode==="collapsed"||!i||Et?im(l,g):(i=g,ke(Ks,l),ke(Ys,i),lr===null&&(lr=l)),Et&&Gl(l,u.treeForkCount),n}return Ln(l),null;case 22:case 23:return Gr(l),NN(),u=l.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(i&536870912)!==0&&(l.flags&128)===0&&(Ln(l),l.subtreeFlags&6&&(l.flags|=8192)):Ln(l),i=l.updateQueue,i!==null&&Fb(l,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==i&&(l.flags|=2048),n!==null&&de(Ec),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),l.memoizedState.cache!==i&&(l.flags|=2048),Yl(ys),Ln(l),null;case 25:return null;case 30:return l.flags|=33554432,Ln(l),null}throw Error(o(156,l.tag))}function hne(n,l){switch(uN(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Yl(ys),xe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return Oe(l),null;case 31:if(l.memoizedState!==null){if(Gr(l),l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Gr(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return CN(l),n=l.flags,n&65536?(l.flags=n&-65537|128,n=l.memoizedState,n!==null&&(n.rendering=null,n.tail=null),l.flags|=4,l):null;case 4:return xe(),null;case 10:return Yl(l.type),null;case 22:case 23:return Gr(l),NN(),n!==null&&de(Ec),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Yl(ys),null;case 25:return null;default:return null}}function qL(n,l){switch(uN(l),l.tag){case 3:Yl(ys),xe();break;case 26:case 27:case 5:Oe(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Gr(l);break;case 13:Gr(l);break;case 19:CN(l);break;case 10:Yl(l.type);break;case 22:case 23:Gr(l),NN(),n!==null&&de(Ec);break;case 24:Yl(ys)}}function mm(n,l){try{var i=l.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&n)===n){u=void 0;var g=i.create,E=i.inst;u=g(),E.destroy=u}i=i.next}while(i!==m)}}catch(V){gn(l,l.return,V)}}function ri(n,l,i){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var g=m.next;u=g;do{if((u.tag&n)===n){var E=u.inst,V=E.destroy;if(V!==void 0){E.destroy=void 0,m=l;var ne=i,me=V;try{me()}catch(Se){gn(m,ne,Se)}}}u=u.next}while(u!==g)}}catch(Se){gn(l,l.return,Se)}}function GL(n){var l=n.updateQueue;if(l!==null){var i=n.stateNode;try{P_(l,i)}catch(u){gn(n,n.return,u)}}}function KL(n,l,i){i.props=Dc(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(u){gn(n,l,u)}}function il(n,l){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:var m=n.stateNode,g=Fl(n.memoizedProps,m);(m.ref===null||m.ref.name!==g)&&(m.ref=e5(g)),u=m.ref;break;case 7:if(n.stateNode===null){var E=new Zr(n);v(n.child,!1,ase,E,void 0,void 0),n.stateNode=E}u=n.stateNode;break;default:u=n.stateNode}typeof i=="function"?n.refCleanup=i(u):i.current=u}}catch(V){gn(n,l,V)}}function Xs(n,l){var i=n.ref,u=n.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(m){gn(n,l,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(m){gn(n,l,m)}else i.current=null}function $b(n,l){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&l!==null)for(var i=0;i title"))),Qs(u,l,i),u[Rs]=n,vs(u),l=u;break e;case"link":if(g=x5("link","href",m).get(l+(i.href||""))){for(E=0;Evt&&(E=vt,vt=We,We=E);var pe=a_(V,We),oe=a_(V,vt);if(pe&&oe&&(we.rangeCount!==1||we.anchorNode!==pe.node||we.anchorOffset!==pe.offset||we.focusNode!==oe.node||we.focusOffset!==oe.offset)){var be=Re.createRange();be.setStart(pe.node,pe.offset),we.removeAllRanges(),We>vt?(we.addRange(be),we.extend(oe.node,oe.offset)):(be.setEnd(oe.node,oe.offset),we.addRange(be))}}}}for(Re=[],we=V;we=we.parentNode;)we.nodeType===1&&Re.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;Vi?32:i,ge.T=null,i=jk,jk=null;var g=Va,E=ml;if(Wn=0,Lc=Va=null,ml=0,(an&6)!==0)throw Error(o(331));var V=an;if(an|=4,g3(g.current),p3(g,g.current,E,i),an=V,wm(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Rn,g)}catch{}return!0}finally{ee.p=m,ge.T=u,O3(n,l)}}function M3(n,l,i){l=ga(i,l),l=qN(n.stateNode,l,2),n=ei(n,l,2),n!==null&&(Ho(n,2),hl(n))}function gn(n,l,i){if(n.tag===3)M3(n,n,i);else for(;l!==null;){if(l.tag===3){M3(l,n,i);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ii===null||!ii.has(u))){n=ga(i,n),i=EL(2),u=ei(l,i,2),u!==null&&(AL(i,u,l,n),Ho(u,2),hl(u));break}}l=l.return}}function Ak(n,l,i){var u=n.pingCache;if(u===null){u=n.pingCache=new vne;var m=new Set;u.set(l,m)}else m=u.get(l),m===void 0&&(m=new Set,u.set(l,m));m.has(i)||(vk=!0,m.add(i),n=Tne.bind(null,n,l,i),l.then(n,n))}function Tne(n,l,i){var u=n.pingCache;u!==null&&u.delete(l),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Dn===n&&(Lt&i)===i&&((is===4||is===3&&(Lt&62914560)===Lt&&300>Vt()-ev)&&(an&2)===0?Rd(n,0):Jb|=i,kd===Lt&&(kd=0)),hl(n)}function D3(n,l){l===0&&(l=dr()),n=wc(n,l),n!==null&&(Ho(n,l),hl(n))}function Ene(n){var l=n.memoizedState,i=0;l!==null&&(i=l.retryLane),D3(n,i)}function Ane(n,l){var i=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(i=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(l),D3(n,i)}function Rne(n,l){return fs(n,l)}var Md=null,Dd=null,Rk=!1,iv=!1,Ok=!1,ui=0;function hl(n){n!==Dd&&n.next===null&&(Dd===null?Md=Dd=n:Dd=Dd.next=n),iv=!0,Rk||(Rk=!0,Mne())}function wm(n,l){if(!Ok&&iv){Ok=!0;do for(var i=!1,u=Md;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var g=0;else{var E=u.suspendedLanes,V=u.pingedLanes;g=(1<<31-Tt(42|n)+1)-1,g&=m&~(E&~V),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,L3(u,g))}else g=Lt,g=rl(u,u===Dn?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||rn(u,g)||(i=!0,L3(u,g));u=u.next}while(i);Ok=!1}}function One(){I3()}function I3(){iv=Rk=!1;var n=0;ui!==0&&Fne()&&(n=ui);for(var l=Vt(),i=null,u=Md;u!==null;){var m=u.next,g=P3(u,l);g===0?(u.next=null,i===null?Md=m:i.next=m,m===null&&(Dd=i)):(i=u,(n!==0||(g&3)!==0)&&(iv=!0)),u=m}Wn!==0&&Wn!==5||wm(n),ui!==0&&(ui=0)}function P3(n,l){for(var i=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,g=n.pendingLanes&-62914561;0V)break;var Se=ne.transferSize,Re=ne.initiatorType;Se&&$3(Re)&&(ne=ne.responseEnd,E+=Se*(nepv){We.length=He;break}be=new Promise(Xne.bind(be)),We.push(be)}}}if(0"u"?null:document;function p5(n,l,i){var u=Pd;if(u&&typeof l=="string"&&l){var m=pr(l);m='link[rel="'+n+'"][href="'+m+'"]',typeof i=="string"&&(m+='[crossorigin="'+i+'"]'),f5.has(m)||(f5.add(m),n={rel:n,crossOrigin:i,href:l},u.querySelector(m)===null&&(l=u.createElement("link"),Qs(l,"link",n),vs(l),u.head.appendChild(l)))}}function mse(n){eo.D(n),p5("dns-prefetch",n,null)}function hse(n,l){eo.C(n,l),p5("preconnect",n,l)}function gse(n,l,i){eo.L(n,l,i);var u=Pd;if(u&&n&&l){var m='link[rel="preload"][as="'+pr(l)+'"]';l==="image"&&i&&i.imageSrcSet?(m+='[imagesrcset="'+pr(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(m+='[imagesizes="'+pr(i.imageSizes)+'"]')):m+='[href="'+pr(n)+'"]';var g=m;switch(l){case"style":g=_d(n);break;case"script":g=Ld(n)}if(!(ja.has(g)||(n=P({rel:"preload",href:l==="image"&&i&&i.imageSrcSet?void 0:n,as:l},i),ja.set(g,n),u.querySelector(m)!==null||l==="style"&&u.querySelector(Cm(g))||l==="script"&&u.querySelector(Tm(g))))){var E=u.createElement("link");Qs(E,"link",n),l==="style"&&(E[Os]=!0,E.onload=E.onerror=function(){Lp(E)}),vs(E),u.head.appendChild(E)}}}function xse(n,l){eo.m(n,l);var i=Pd;if(i&&n){var u=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+pr(u)+'"][href="'+pr(n)+'"]',g=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Ld(n)}if(!ja.has(g)&&(n=P({rel:"modulepreload",href:n},l),ja.set(g,n),i.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Tm(g)))return}u=i.createElement("link"),Qs(u,"link",n),vs(u),i.head.appendChild(u)}}}function bse(n,l,i){eo.S(n,l,i);var u=Pd;if(u&&n){var m=$o(u).hoistableStyles,g=_d(n);l=l||"default";var E=m.get(g);if(!E){var V={loading:0,preload:null};if(E=u.querySelector(Cm(g)))V.loading=5;else{n=P({rel:"stylesheet",href:n,"data-precedence":l},i),(i=ja.get(g))&&Wk(n,i);var ne=E=u.createElement("link");vs(ne),Qs(ne,"link",n),ne._p=new Promise(function(me,Se){ne.onload=me,ne.onerror=Se}),ne.addEventListener("load",function(){V.loading|=1}),ne.addEventListener("error",function(){V.loading|=2}),V.loading|=4,dv(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:V},m.set(g,E)}}}function vse(n,l){eo.X(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function yse(n,l){eo.M(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0,type:"module"},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function m5(n,l,i,u){var m=(m=he.current)?km(m):null;if(!m)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=_d(i.href),l=$o(m).hoistableStyles,u=l.get(i),u||(u={type:"style",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=_d(i.href);var g=$o(m).hoistableStyles,E=g.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,E),(g=m.querySelector(Cm(n)))?g._p||(E.instance=g,E.state.loading=5):(g=ja.get(n),g||(g={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ja.set(n,g)),wse(m,n,g,E.state))),l&&u===null)throw Error(o(528,""));return E}if(l&&u!==null)throw Error(o(529,""));return null;case"script":return l=i.async,i=i.src,typeof i=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(i=Ld(i),l=$o(m).hoistableScripts,u=l.get(i),u||(u={type:"script",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function _d(n){return'href="'+pr(n)+'"'}function Cm(n){return'link[rel="stylesheet"]['+n+"]"}function h5(n){return P({},n,{"data-precedence":n.precedence,precedence:null})}function wse(n,l,i,u){if(l=n.querySelector('link[rel="preload"][as="style"]['+l+"]")){if(l[Os]!==!0){u.loading=1;return}}else l=n.createElement("link"),l[Os]=!0,l.onload=l.onerror=Lp.bind(null,l),Qs(l,"link",i),vs(l),n.head.appendChild(l);u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2})}function Ld(n){return'[src="'+pr(n)+'"]'}function Tm(n){return"script[async]"+n}function g5(n,l,i){if(l.count++,l.instance===null)switch(l.type){case"style":var u=n.querySelector('style[data-href~="'+pr(i.href)+'"]');if(u)return l.instance=u,vs(u),u;var m=P({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),vs(u),Qs(u,"style",m),dv(u,i.precedence,n),l.instance=u;case"stylesheet":m=_d(i.href);var g=n.querySelector(Cm(m));if(g)return l.state.loading|=4,l.instance=g,vs(g),g;u=h5(i),(m=ja.get(m))&&Wk(u,m),g=(n.ownerDocument||n).createElement("link"),vs(g);var E=g;return E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),l.state.loading|=4,dv(g,i.precedence,n),l.instance=g;case"script":return g=Ld(i.src),(m=n.querySelector(Tm(g)))?(l.instance=m,vs(m),m):(u=i,(m=ja.get(g))&&(u=P({},i),Jk(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),vs(m),Qs(m,"link",u),n.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,dv(u,i.precedence,n));return l.instance}function dv(n,l,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,g=m,E=0;E title"):null)}function jse(n,l,i){if(i===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(n=l.disabled,typeof l.precedence=="string"&&n==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function b5(n,l){return n==="img"&&l.src!=null&&l.src!==""&&l.onLoad==null&&l.loading!=="lazy"}function v5(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function y5(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function w5(n,l){typeof l.decode=="function"&&(n.imgCount++,l.complete||(n.imgBytes+=y5(l),n.suspenseyImages.push(l)),n=kse.bind(n),l.decode().then(n,n))}function Sse(n,l,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var m=_d(u.href),g=l.querySelector(Cm(m));if(g){l=g._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Em.bind(n),l.then(n,n)),i.state.loading|=4,i.instance=g,vs(g);return}g=l.ownerDocument||l,u=h5(u),(m=ja.get(m))&&Wk(u,m),g=g.createElement("link"),vs(g);var E=g;E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),i.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,l),(l=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Em.bind(n),l.addEventListener("load",i),l.addEventListener("error",i))}}var pv=0;function Nse(n,l){return n.stylesheets&&n.count===0&&hv(n,n.stylesheets),0pv?50:800)+l);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function j5(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)hv(n,n.stylesheets);else if(n.unsuspend){var l=n.unsuspend;n.unsuspend=null,l()}}}function Em(){this.count--,j5(this)}function kse(){this.imgCount--,j5(this)}var mv=null;function hv(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,mv=new Map,l.forEach(Cse,n),mv=null,Em.call(n))}function Cse(n,l){if(!(l.state.loading&4)){var i=mv.get(n);if(i)var u=i.get(null);else{i=new Map,mv.set(n,i);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sw.exports=v8(),Sw.exports}var vn=y8();const rg=[20,50,100,200],ag=[20,50,100,200,"all"],du=50,DR="workbuddy-desktop-table-size:";function IR(e){return e==="all"?r("全部"):String(e)}function lg(e,t=ag,a=du){t.includes(a)||(a=t.includes(du)?du:t[0]);let o=null;try{o=localStorage.getItem(DR+e)}catch{return a}if(o===null||o.trim()==="")return a;if(o==="all")return t.includes("all")?"all":a;const c=Number(o);return Number.isFinite(c)&&t.includes(c)?c:a}function og(e,t){try{localStorage.setItem(DR+e,String(t))}catch{}}function ig(e,t,a={}){const o=a.sizes??ag,c=a.defaultSize??du,[d,f]=x.useState(()=>lg(t,o,c)),[p,h]=x.useState(1),b=Math.max(1,d==="all"?1:Math.ceil(e/d)),y=Math.min(Math.max(1,p),b);x.useEffect(()=>{y!==p&&h(y)},[y,p]);const v=x.useCallback(k=>{f(k),og(t,k),h(1)},[t]),w=x.useCallback(k=>{h(Math.min(Math.max(1,Math.round(k)||1),b))},[b]),j=d==="all"?0:(y-1)*d,S=d==="all"?e:Math.min(e,j+d),N=x.useCallback(k=>d==="all"?k.slice():k.slice(j,S),[d,j,S]);return{size:d,page:y,pageCount:b,rangeStart:e?j+1:0,rangeEnd:e?S:0,paged:d!=="all",setSize:v,goto:w,slice:N}}function Li({total:e,page:t,pageCount:a,size:o,sizes:c=ag,onSizeChange:d,onPageChange:f,range:p=null,disabled:h=!1,leading:b,className:y}){const[v,w]=x.useState(String(t));x.useEffect(()=>w(String(t)),[t]);const j=()=>{const k=v.trim();if(!k){w(String(t));return}const T=Number(k);if(!Number.isFinite(T)){w(String(t));return}const D=Math.min(Math.max(1,Math.round(T)),a);w(String(D)),D!==t&&f(D)},S=a<=1,N=e===0?r("共 0 条"):p?r("共 {total} 条 · 当前第 {start}–{end} 条",{total:e,start:p.start,end:p.end}):r("共 {total} 条(全部显示)",{total:e});return s.jsxs("div",{className:y?`panel-foot table-foot-bar ${y}`:"panel-foot table-foot-bar",children:[b,s.jsx("div",{className:"spacer"}),s.jsxs("div",{className:"table-foot-ctl",children:[s.jsx("span",{className:"table-foot-count",children:N}),s.jsxs("span",{className:"table-foot-size",children:[r("每页"),s.jsxs(ft,{value:String(o),onValueChange:k=>d(k==="all"?"all":Number(k)),children:[s.jsx(mt,{className:"h-[26px] w-[86px]",disabled:h,"aria-label":r("每页条数"),children:s.jsx(pt,{children:IR(o)})}),s.jsx(ht,{children:c.map(k=>s.jsx(qe,{value:String(k),children:IR(k)},String(k)))})]}),r("条")]}),s.jsxs("span",{className:"table-foot-jump",children:[r("跳至"),s.jsx($e,{className:"h-[26px] w-[52px] px-1 text-center",value:v,disabled:h||S,"aria-label":r("跳转到指定页"),title:S?r("当前只有一页"):r("跳转到第 1–{pageCount} 页",{pageCount:a}),inputMode:"numeric",onChange:k=>w(k.target.value),onKeyDown:k=>{k.key==="Enter"?(k.preventDefault(),j()):k.key==="Escape"&&w(String(t))},onBlur:j}),r("页")]}),s.jsx(MF,{page:t,pageCount:a,onPageChange:f,disabled:h})]})]})}const Cw=[{key:"pick",label:r("选择"),align:"center",legacyAlign:"left"},{key:"order",label:r("顺序"),title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),align:"center",legacyAlign:"left"},{key:"account",label:r("账号"),align:"center",legacyAlign:"left"},{key:"proxy",label:r("代理"),title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),align:"center"},{key:"connections",label:r("连接数"),title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),align:"center"},{key:"status",label:r("状态"),align:"center",legacyAlign:"left"},{key:"limits",label:r("限流"),title:r("该账号当前限流中的模型;点徽章看明细"),align:"center",legacyAlign:"left"},{key:"expiry",label:r("有效期"),align:"center",legacyAlign:"left"},{key:"usage",label:r("余额"),align:"center",legacyAlign:"left"},{key:"actions",label:r("操作"),align:"right"}],PR="agent2api-accounts-col-widths",Tf={pick:47,order:84,proxy:186,connections:56,status:80,limits:148,expiry:80,usage:132,actions:200},Tw=new Set(["account"]),w8=300,Ew=56,j8=new Set([...Object.keys(Tf),...Tw]),fu=(()=>{try{const e=JSON.parse(localStorage.getItem(PR)||"{}"),t={};for(const[a,o]of Object.entries(e||{})){const c=Number(o);j8.has(a)&&Number.isFinite(c)&&c>=Ew&&(t[a]=Math.round(c))}return t}catch{return{}}})();function _R(){try{localStorage.setItem(PR,JSON.stringify(fu))}catch{}}function S8(){return{...Tf,...fu}}function N8(e){let t=0;for(const a of e){const o=fu[a];o?t+=o:Tw.has(a)?t+=w8:Tf[a]?t+=Tf[a]:t+=Ew}return Math.round(t)}function LR(e,t){const a=e?.querySelector(`thead th:nth-child(${t+1})`),o=a?.getAttribute("data-col")||a?.className.match(/cell-([a-z]+)/)?.[1];if(!o)return null;const c=e?.querySelector(`colgroup col[data-col="${CSS.escape(o)}"]`)||e?.querySelectorAll("colgroup col")[t];return c?{key:o,col:c}:null}function k8(e,t,a){const o=Math.max(Ew,Math.round(a));e.style.width=o+"px",Tw.has(t)||o!==Tf[t]?fu[t]=o:delete fu[t]}let Aw=()=>{};function C8(e,t){if(Aw=t,!e)return;let a=null;e.addEventListener("pointerdown",o=>{if(o.button!==0)return;const c=o.target?.closest?.(".col-grip");if(!c)return;o.preventDefault();const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);if(!h)return;const b=o.clientX,y=h.col.getBoundingClientRect().width;c.classList.add("active"),document.body.classList.add("col-resizing");try{c.setPointerCapture(o.pointerId)}catch{}a={...h,startX:b,startWidth:y,grip:c,pointerId:o.pointerId},window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w),window.addEventListener("blur",w);function v(j){if(a){if(j.buttons===0){w();return}k8(a.col,a.key,a.startWidth+j.clientX-a.startX)}}function w(){if(!a)return;const{grip:j,pointerId:S}=a;a=null,j.classList.remove("active"),document.body.classList.remove("col-resizing");try{j.releasePointerCapture(S)}catch{}window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),window.removeEventListener("blur",w),_R(),Aw()}}),e.addEventListener("dblclick",o=>{const c=o.target?.closest?.(".col-grip");if(!c)return;const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);h&&(delete fu[h.key],_R(),Aw())})}function gt(){return window}function Jn(e,t){gt().wbApp?.toast?.(e,t)}function pu(e){return e instanceof Error&&e.message?e.message:String(e??"").trim()||r("未知错误")}function Rw(e){return(gt().wbApp?.getState?.()?.accounts?.accounts||[]).filter(a=>(a?.provider||"workbuddy")===e).length}function zR(e){const t=e?.name||"";if(t)return(gt().wbProviders?.customList?.()||[]).find(a=>(a.name||"")===t)}function T8(e){const t=e?.name||"";return t?(gt().wbPresetProviders?.list||[]).some(a=>a.name===t):!1}async function cg(e){const t=gt().__TAURI_INTERNALS__;if(!t||typeof t.invoke!="function")throw new Error(r("桌面运行时不可用(Tauri 未初始化)"));return t.invoke("api_request",{request:{method:"POST",path:"/api/accounts",body:e}})}function ug(e){return e?.name||e?.uid||e?.userId||""}function Ow(){gt().wbAddAccountModal?.close?.()}async function mu(e,t){Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ {label}账号已添加{name}",{label:t,name:e?`:${e}`:""}))}const hu=new Map;function Aa(e){return{defaultValue:hu.get(e)??"",onChange:t=>{const a=t.currentTarget.value;a?hu.set(e,a):hu.delete(e)}}}function So(e,t){t?hu.set(e,t):hu.delete(e);const a=document.getElementById(e);(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&(a.value=t)}function vr(e){const t=document.getElementById(e);return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value.trim():(hu.get(e)??"").trim()}function Mw(e){for(const t of e)So(t,"")}const zi={edition:"cn",loginMode:"embedded",socialRestore:!1},E8=100,A8=256,R8=e=>e.key==="name"?E8:A8,O8={provider:"raccoon",label:"小浣熊",addButton:r("添加小浣熊账号"),webLogin:{noteHtml:r("在内嵌窗口里完成官方登录,成功后自动加入账号列表。"),button:r("打开网页登录"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待"),busyText:r("等待小浣熊登录完成…")},manualTitle:r("粘贴 token / refreshToken"),manualNoteHtml:r('refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。'),fields:[{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用凭证里的账号名")},{key:"token",label:"token",rows:3,placeholder:r("粘贴 access_token(一长串 JWT)")},{key:"refreshToken",inputKey:"refresh",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。")},M8={provider:"catpaw",label:"CatPaw",webLogin:{noteHtml:r("用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。"),button:r("打开 CatPaw 网页登录"),busyText:r("等待 CatPaw 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的美团账号);完成后自动加入列表")}]},manualNote:r("token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。"),fields:[{key:"token",label:"token",rows:3,placeholder:r("CatPaw 的 X-Passport-Token(登录态 Cookie)")},{key:"uid",label:"uid",placeholder:r("必填,CatPaw 账号标识")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用登录名或 uid")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。"),desktopHint:r("读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录")},D8={provider:"autoclaw",label:r("AutoClaw 国内版"),manualNote:r("token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。"),smsLogin:{noteHtml:r("用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。")},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0},I8={provider:"autoclaw-intl",label:r("AutoClaw 国际版"),manualNote:r("国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。"),oauthLogin:{title:r("网页登录(Zai / Google)"),noteHtml:r("点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表")}]},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT(国际版账号的 access token)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0};function BR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开官方授权页完成设备码授权,登录的是{label}({site})的账号。",{label:a,site:o}),button:r("打开 Qoder 网页登录"),busyText:r("等待 Qoder 授权完成…"),edition:t==="qoder"?"cn":"global",modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口用全新环境,多账号互不影响;关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录账号);完成后自动加入列表")}]},manualTitle:r("使用个人访问令牌(PAT)"),manualNote:r("在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。",{label:a}),fields:[{key:"pat",label:"Qoder PAT",rows:3,placeholder:r("粘贴 Qoder 个人访问令牌(pt-…)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}const P8=BR({provider:"qoder",label:r("中国版"),siteNote:"qoder.com.cn"}),_8=BR({provider:"qoder-intl",label:r("国际版"),siteNote:"qoder.com"});function HR(e){const{provider:t,label:a,poolNote:o}=e;return{provider:t,label:a,desktop:!0,webLogin:{noteHtml:r("打开授权页完成确认,账号自动加入 {label}{note}",{label:a,note:o}),button:r("打开 Cline 授权页"),busyText:r("等待 Cline 授权确认…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表")}]},manualTitle:r("填写凭证"),manualNote:r("refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。",{label:a}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 workos:… 开头的令牌(不带前缀也会自动补上)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号姓名、邮箱或令牌指纹")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。",{label:a}),desktopHint:r("读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录")}}function UR(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,webLogin:{noteHtml:r("打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。",{label:a,site:o}),button:r("打开 Accio {label}登录页",{label:a}),busyText:r("等待 Accio {label}登录完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)",{label:a,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 Accio 的 accessToken")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}function VR(e){const{provider:t,label:a,site:o,planNote:c}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。",{label:a}),button:r("打开 ZCode {label}授权页",{label:a}),busyText:r("等待 ZCode {label}授权完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)",{site:o,label:a,plan:c}),fields:[{key:"accessToken",label:r("编码套餐 API Key"),rows:3,optional:!0,placeholder:r("用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)")},{key:"jwt",label:"Coding Plan JWT",inputKey:"jwt",rows:3,optional:!0,placeholder:r("用于领取套餐与查询余额;不填则这个账号不能领取与查余额")},{key:"userId",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于生成账号 id 与展示名")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动生成")}]}}const L8={provider:"codearts",label:"CodeArts",desktop:!1,webLogin:{noteHtml:r("打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。"),button:r("打开 CodeArts 授权页"),busyText:r("等待 CodeArts 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板")}]},manualTitle:r("粘贴登录凭据"),manualNoteHtml:r('整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {"codearts_provider_credential":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。'),fields:[{key:"credentialJson",label:r("凭据 JSON"),rows:8,jsonExpand:!0,placeholder:'{"codearts_provider_credential":{"access_key_id":"HSTA…","secret_access_key":"…","security_token":"…","expires_at":"2026-09-27T16:17:00.327Z","domain_id":"…","user_id":"…","user_name":"…","refresh_token":"eyJ…","oauth_context":{…}}}'},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用凭据里的 user_name")}]},z8={provider:"trae",label:"Trae",desktop:!1,webLogin:{noteHtml:r("打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。"),button:r("打开 Trae 授权页"),busyText:r("等待 Trae 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("Cloud-IDE-JWT(三段点分)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选;填了才能到期自动续期")},{key:"uid",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于去重与展示名(留空时网关会问一次上游)")},{key:"machineId",label:"machineId",optional:!0,placeholder:r("可选;UUID 形态,与凭据同生共死")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选;纯数字串(上游只收 8–24 位数字)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动用昵称")}]},B8={provider:"loomy",label:"Loomy",smsLogin:{noteHtml:r("用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。")},manualNote:r("粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。"),fields:[{key:"session",label:"session",rows:3,placeholder:r("登录 session(一长串)")},{key:"userId",label:"userId",optional:!0,placeholder:r("可选,讯飞侧 userid")},{key:"phone",label:r("手机号"),optional:!0,placeholder:r("可选,展示用")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用脱敏手机号或 userId")}],desktop:!1},H8={provider:"kuku",label:"KukuAI",webLogin:{noteHtml:r("在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。"),button:r("打开网页登录"),busyText:r("等待 KukuAI 登录完成…")},manualTitle:r("粘贴 Cookie"),manualNote:r("BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。"),fields:[{key:"cookie",label:"Cookie",rows:3,placeholder:r("BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号 uk")}],desktop:!0,desktopHint:r("读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录"),desktopNote:r("读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。")};function FR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 session cookie"),manualNoteHtml:r("粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。",{siteNote:o}),fields:[{key:"session",label:"session",rows:3,placeholder:r("monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)")},{key:"imageId",label:r("任务镜像 id"),optional:!0,placeholder:r("可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游返回的账号名或账号 id")}]}}const U8=FR({provider:"monkeycode",label:r("MonkeyCode"),siteNote:r("这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。")}),V8=FR({provider:"monkeycode-intl",label:r("MonkeyCode 国际版"),siteNote:r("这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。")}),F8={provider:"commandcode",label:r("Command Code"),desktop:!1,manualTitle:r("粘贴 API Key"),manualNote:r("粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。"),fields:[{key:"apiKey",label:"apiKey",rows:3,placeholder:r("user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 key 尾号")}]},$8={provider:"antigravity",label:r("Antigravity"),desktop:!1,webLogin:{noteHtml:r("在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。"),button:r("打开 Antigravity 网页登录"),busyText:r("等待 Google 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表")}]},manualTitle:r("粘贴 Google refresh token"),manualNoteHtml:r("粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。"),fields:[{key:"refreshToken",label:"refreshToken",rows:2,placeholder:r("1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)")},{key:"projectId",label:"projectId",optional:!0,placeholder:r("可选(cloudaicompanionProject):留空由网关自动发现")},{key:"email",label:"email",optional:!0,placeholder:r("可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用邮箱或令牌尾号")}]},q8={provider:"officeace",label:r("OfficeAce 果办"),desktop:!1,webLogin:{noteHtml:r("打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。"),button:r("打开授权页"),busyText:r("等待 OfficeAce 登录完成…")},manualTitle:r("粘贴网关凭据"),manualNoteHtml:r("从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。"),fields:[{key:"baseUrl",label:r("模型网关基址"),placeholder:"https://modelgw-…huaweicloud-agentarts.com/v2"},{key:"modelAppKey",label:r("网关 Key"),placeholder:"model_app_key"},{key:"modelAppSecret",label:r("网关 Secret"),placeholder:"model_app_secret"},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空用「OfficeAce 果办」")}]},G8={provider:"orcaterm",label:"OrcaTerm",desktop:!0,desktopHint:r("读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录"),desktopNote:r("读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。"),manualTitle:r("粘贴 accessToken"),manualNoteHtml:r("粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号昵称或 userId")}]};function $R(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 API 令牌"),manualNoteHtml:r("粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。",{site:o,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("ms- 开头的 API 令牌")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游账号昵称")}]}}const K8=$R({provider:"modelscope",label:r("ModelScope 国内版"),site:"modelscope.cn",siteNote:r("这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。")}),Y8=$R({provider:"modelscope-intl",label:r("ModelScope 国际版"),site:"modelscope.ai",siteNote:r("这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。")}),qR=[O8,M8,D8,I8,P8,_8,HR({provider:"cline-free",label:"Cline Free",poolNote:r("(免费额度池,模型名带 cline-free/ 前缀)。")}),HR({provider:"cline-pass",label:"Cline Pass",poolNote:r("(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。")}),UR({provider:"accio",label:r("国际版"),site:"www.accio.com",siteNote:r("国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。")}),UR({provider:"accio-cn",label:r("国内版"),site:"www.accio-ai.com",siteNote:r("国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。")}),VR({provider:"zcode",label:r("国内版"),site:"open.bigmodel.cn",planNote:r("国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。")}),VR({provider:"zcode-intl",label:r("国际版"),site:"api.z.ai",planNote:r("国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。")}),L8,z8,B8,H8,U8,V8,F8,$8,q8,G8,K8,Y8],Bi="workbuddy",gu="custom",Dw="WorkBuddy";function X8(e){return qR.find(t=>t.provider===e)}const GR=[{id:"oauth",label:r("网页登录(Zai / Google)")},{id:"sms",label:r("手机验证码登录")},{id:"web",label:r("网页登录")},{id:"manual",label:r("填写凭证")},{id:"desktop",label:r("导入桌面端登录态")}],Iw=()=>gt().workbuddyDesktop?.platform||"";function KR(e){return!(e.desktop===!1||Iw()==="web"||e.desktopWindowsOnly&&Iw()==="macos")}function YR(e,t){return GR.filter(a=>a.id==="oauth"?!!e.oauthLogin:a.id==="sms"?!!e.smsLogin:a.id==="web"?!!e.webLogin&&(!e.webLogin?.region||t===e.webLogin.region):a.id==="desktop"?KR(e):!0).map(a=>a.id)}const Q8=e=>e.manualTitle||r("填写凭证添加"),Z8=e=>e.manualNoteHtml?{html:e.manualNoteHtml}:{text:e.manualNote||""},W8=e=>e.addButton||r("添加 {name} 账号",{name:e.label}),Pw=(e,t)=>`${e.provider}-${t.inputKey||t.key}-input`,Ef="max-w-full flex-wrap [&_[data-slot=segmented-item]]:h-7 [&_[data-slot=segmented-item]]:px-3 [&_[data-slot=segmented-item]]:text-[12.5px]",J8=r("登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)");let _w=!1;async function dg(e,t){if(!_w){_w=!0,e(!0);try{await t()}finally{_w=!1,e(!1)}}}function Af({html:e,text:t}){return e?s.jsx("p",{dangerouslySetInnerHTML:{__html:e}}):s.jsx("p",{children:t||""})}function eq(e,t,a){let o;try{o=JSON.parse(t)}catch(c){return Jn(r("{name} 不是合法 JSON:{reason}",{name:e.label,reason:pu(c)}),"err"),!1}return!o||typeof o!="object"||Array.isArray(o)?(Jn(r("{name}要粘一个 JSON 对象(形如 {sample})",{name:e.label,sample:'{"codearts_provider_credential":{…}}'}),"err"),!1):(Object.assign(a,o),!0)}function tq({config:e,region:t,visible:a}){const o=e.provider,[c,d]=x.useState(!1),[f,p]=x.useState(""),h=Z8(e),b=e.fields.map(v=>Pw(e,v));async function y(){const v={provider:e.provider};e.regionOptions?.length&&(v.mode=t);for(const w of e.fields){const j=vr(Pw(e,w));if(!w.optional&&!j){Jn(r("请填写 {label}",{label:w.label}),"err");return}if(j){if(w.jsonExpand){if(!eq(w,j,v))return;continue}v[w.key]=j}}await dg(d,async()=>{try{const w=await cg(v);Mw(b),p(""),await mu(ug(w?.account),e.label)}catch(w){Jn(r("添加失败:{reason}",{reason:pu(w)}),"err")}})}return s.jsxs(zn,{hidden:!a,onClick:v=>{v.target.closest("[data-raccoon-hint]")&&(v.preventDefault(),p(J8))},children:[s.jsx("h3",{children:Q8(e)}),s.jsx(Af,{...h}),e.fields.map(v=>{const w=Pw(e,v),j=v.optional?"":r("(必填)");return s.jsxs("div",{className:`field-row${v.rows?" stack":""}`,children:[s.jsxs("label",{htmlFor:w,children:[v.label,j]}),v.rows?s.jsx(Qc,{id:w,rows:v.rows,placeholder:v.placeholder,...Aa(w)}):s.jsx($e,{id:w,type:"text",maxLength:R8(v),placeholder:v.placeholder,...Aa(w)})]},w)}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${o}-add-button`,onClick:()=>{y()},disabled:c,children:c?r("添加中…"):W8(e)}),s.jsx("span",{className:"detail",id:`${o}-add-hint`,children:f})]})]})}function nq({config:e,visible:t}){const a=e.provider,[o,c]=x.useState(!1);if(!KR(e)||!e.desktopNote)return null;async function d(){await dg(c,async()=>{try{const f=await cg({provider:e.provider,importDesktop:!0});await mu(f?.account?.name||"",e.label)}catch(f){Jn(r("导入失败:{reason}",{reason:pu(f)}),"err")}})}return s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("从本机导入桌面端登录态")}),s.jsx("p",{children:e.desktopNote}),s.jsx("div",{className:"field-row",children:s.jsx(se,{id:`${a}-desktop-button`,title:e.desktopHint,onClick:()=>{d()},disabled:o,children:r(o?"导入中…":"从本机导入桌面端登录态")})})]})}function sq({config:e,mode:t,onModeChange:a,region:o,visible:c}){const d=e.webLogin,f=e.provider,p=x.useRef(t),h=x.useRef(o),b=x.useRef(null);return p.current=t,h.current=o,x.useEffect(()=>{const y=gt().wbWebLogin;if(!y||!d)return;const v=d.modes;b.current=y.create({provider:f,buttonId:`${f}-web-button`,cancelId:`${f}-web-cancel`,hintId:`${f}-web-hint`,busyText:d.busyText,texts:()=>{const w=v?.find(j=>j.value===p.current);return{button:d.button,hint:w?.hint||d.hint||""}},start:()=>gt().workbuddyDesktop?.startLogin(d.edition||h.current||"cn",p.current||"embedded",f),onSuccess:async w=>{Ow(),await gt().wbApp?.refresh?.();const j=w?.payload?.warning;j?Jn(r("账号已添加,但请留意:{warning}",{warning:j}),"err"):Jn(r("✅ {label}账号已添加",{label:e.label}))}})??null},[]),x.useEffect(()=>{b.current?.syncTexts()},[t]),d?s.jsxs(zn,{hidden:!c,children:[s.jsx("h3",{children:r("网页登录")}),s.jsx(Af,{html:d.noteHtml}),d.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:d.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${f}-web-button`,onClick:()=>b.current?.start(),children:d.button}),s.jsx(se,{id:`${f}-web-cancel`,variant:"outline",hidden:!0,onClick:()=>b.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:`${f}-web-hint`,children:d.hint||d.modes?.[0]?.hint||""})]})]}):null}function rq({config:e,visible:t}){const a=e.smsLogin,o=e.provider;return x.useEffect(()=>{a&>().wbSmsLogin?.create({provider:o,onSuccess:c=>mu(ug(c?.account),e.label)})},[]),a?s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("手机验证码登录")}),s.jsx(Af,{html:a.noteHtml,text:r("用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。")}),s.jsxs("div",{className:"sms-form",children:[s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-phone`,children:[r("手机号"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs(Ci,{children:[s.jsx(Ei,{id:`${o}-sms-phone`,type:"text",maxLength:11,placeholder:r("11 位大陆手机号"),...Aa(`${o}-sms-phone`)}),s.jsx(Ti,{align:"inline-end",children:s.jsx(g4,{id:`${o}-sms-send`,className:"text-primary-fg",children:r("获取验证码")})})]})]}),s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-code`,children:[r("验证码"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs("div",{className:"sms-pair",children:[s.jsx($e,{id:`${o}-sms-code`,className:"sms-code",type:"text",maxLength:6,placeholder:r("6 位数字")}),s.jsx("label",{className:"lb-inline",htmlFor:`${o}-sms-name`,children:r("备注名")}),s.jsx($e,{id:`${o}-sms-name`,className:"sms-name",type:"text",placeholder:r("可选,留空则用脱敏手机号"),...Aa(`${o}-sms-name`)})]})]}),s.jsxs("div",{className:"sms-foot",children:[s.jsx(se,{id:`${o}-sms-submit`,children:r("登录并添加")}),s.jsx("span",{className:"detail sms-hint",id:`${o}-sms-hint`})]})]})]}):null}function aq({config:e,mode:t,onModeChange:a,visible:o}){const c=e.oauthLogin,d=e.provider,f=x.useRef(t),p=x.useRef(null);f.current=t;const h=()=>c?.modes?.find(b=>b.value===f.current)?.hint||c?.hint||"";return x.useEffect(()=>{const b=gt().wbAutoclawOauth;!b||!c||(p.current=b.create({provider:d,mode:()=>f.current||"embedded",hint:h,cancelId:`${d}-oauth-cancel`,onSuccess:()=>mu("",e.label)})??null)},[]),x.useEffect(()=>{p.current?.syncTexts()},[t]),c?s.jsxs(zn,{hidden:!o,children:[s.jsx("h3",{children:c.title||r("网页登录")}),s.jsx(Af,{html:c.noteHtml}),c.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:c.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${d}-oauth-zai`,children:r("使用 Zai 账号登录")}),s.jsx(se,{id:`${d}-oauth-google`,variant:"outline",children:r("使用 Google 账号登录")}),s.jsx(se,{id:`${d}-oauth-cancel`,variant:"outline",hidden:!0,children:r("取消")})]}),s.jsx("div",{className:"field-row",children:s.jsx("span",{className:"detail",id:`${d}-oauth-hint`,children:c.modes?.[0]?.hint||c.hint||""})})]}):null}function lq({config:e,active:t}){const a=e.regionOptions?.[0]?.value??"",[o,c]=x.useState(a),[d,f]=x.useState(()=>YR(e,a)[0]),[p,h]=x.useState(e.webLogin?.modes?.[0]?.value??""),[b,y]=x.useState(e.oauthLogin?.modes?.[0]?.value??""),v=YR(e,o),w=v.includes(d)?d:v[0],j=x.useMemo(()=>GR.filter(S=>v.includes(S.id)).map(S=>({value:S.id,label:S.label})),[v.join(",")]);return s.jsxs("div",{className:"add-provider-block",hidden:!t,children:[e.regionOptions?.length?s.jsxs(zn,{children:[s.jsx("h3",{children:r("地区")}),s.jsx(In,{"aria-label":r("{label} 账号地区",{label:e.label}),className:Ef,options:e.regionOptions,value:o,onValueChange:c})]}):null,s.jsxs(zn,{children:[s.jsx("h3",{children:r("添加方式")}),s.jsx(In,{"aria-label":r("{label} 账号的添加方式",{label:e.label}),className:Ef,options:j,value:w,onValueChange:S=>f(S)})]}),s.jsx(aq,{config:e,mode:b,onModeChange:y,visible:w==="oauth"}),s.jsx(rq,{config:e,visible:w==="sms"}),s.jsx(sq,{config:e,mode:p,onModeChange:h,region:o,visible:w==="web"}),s.jsx(tq,{config:e,region:o,visible:w==="manual"}),s.jsx(nq,{config:e,visible:w==="desktop"})]})}const oq=r("官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth"),fg="workbuddy-file-name";function Lw(e,t,a){const o=e[a],c=[];o&&typeof o=="object"&&!Array.isArray(o)&&c.push(o),c.push(e);for(const d of c)for(const f of t){const p=d[f];if(typeof p=="string"&&p.trim())return p.trim()}return""}function iq(e){const t=Lw(e,["domain"],"auth");return/workbuddy\.ai/i.test(t)?"intl":/workbuddy\.cn|codebuddy\.cn/i.test(t)?"cn":null}function cq({edition:e}){const[t,a]=x.useState(!1),[o,c]=x.useState(""),d=x.useRef(null);async function f(h){await dg(a,async()=>{try{let b;try{b=JSON.parse(await h.text())}catch{Jn(r("选择的文件不是合法 JSON"),"err");return}if(!b||typeof b!="object"||Array.isArray(b)){Jn(r("不是有效的凭证文件:内容要是一个 JSON 对象"),"err");return}const y=b,v=Lw(y,["accessToken","token","access_token"],"auth"),w=Lw(y,["uid"],"account");if(!v||!w){Jn(r("不是有效的凭证文件:需要包含 accessToken 与 uid"),"err");return}const j=iq(y),S=j??e;j&&j!==e&&Jn(r("文件是{edition}凭证,已按该版本导入",{edition:r(j==="intl"?"国际版":"国内版")}),"warn");const N=vr(fg),k={...y,provider:pg(S)};N&&(k.name=N);const T=await cg(k);c(""),await mu(ug(T?.account),S==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(b){Jn(r("导入失败:{reason}",{reason:pu(b)}),"err")}})}async function p(){await dg(a,async()=>{try{const h=await cg({provider:pg(e),importDesktop:!0});await mu(ug(h?.account),e==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(h){Jn(r("导入失败:{reason}",{reason:pu(h)}),"err")}})}return s.jsxs(zn,{children:[s.jsx("h3",{children:r("导入凭证文件")}),s.jsx(Af,{text:r("选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。")}),s.jsx("p",{className:"detail",children:s.jsx("a",{href:"#",onClick:h=>{h.preventDefault(),c(oq)},children:r("凭证文件在哪?")})}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"lb-inline",htmlFor:fg,children:r("备注名")}),s.jsx($e,{id:fg,type:"text",maxLength:100,placeholder:r("可选,留空则用文件里的昵称"),...Aa(fg)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("input",{ref:d,type:"file",accept:".info,.json,application/json",hidden:!0,onChange:h=>{const b=h.target.files?.[0];h.target.value="",b&&f(b)}}),s.jsx(se,{onClick:()=>d.current?.click(),disabled:t,children:r(t?"导入中…":"选择凭证文件导入")}),Iw()!=="web"?s.jsx(se,{variant:"outline",onClick:()=>{p()},disabled:t,children:r("从本机导入桌面端登录态")}):null,s.jsx("span",{className:"detail",children:o})]})]})}function pg(e){return e==="intl"?"workbuddy-intl":"workbuddy"}function uq({active:e}){const[t,a]=x.useState(zi.edition),[o,c]=x.useState(zi.loginMode),[d,f]=x.useState(zi.socialRestore),p=x.useRef(t),h=x.useRef(o),b=x.useRef(d),y=x.useRef(null);p.current=t,h.current=o,b.current=d,x.useEffect(()=>{const T=gt().wbWebLogin;T&&(y.current=T.create({get provider(){return pg(p.current)},buttonId:"web-login-button",cancelId:"web-login-cancel",hintId:"web-login-hint",busyText:r("等待网页登录…"),texts:()=>{const D=h.current==="external";return{button:r(D?"在浏览器中打开登录页":"打开网页登录"),hint:r(D?"系统浏览器打开(复用已登录账号);完成后自动加入列表":"内嵌窗口打开;完成后自动加入列表,关窗即取消等待")}},start:()=>gt().workbuddyDesktop?.startLogin(p.current,h.current,pg(p.current),b.current),onSuccess:async()=>{const D=p.current==="intl"?r("国际版"):r("国内版");Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ 登录成功,{edition}账号已加入列表",{edition:D}))}})??null)},[]),x.useEffect(()=>{y.current?.syncTexts()},[t,o]);function v(T){const D=T==="intl"?"external":"embedded";a(T),zi.edition=T,c(D),zi.loginMode=D}function w(T){const D=T==="external"?"external":"embedded";c(D),zi.loginMode=D}const j=t==="intl",N=j&&o==="embedded",k=r(N?"国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口":j?"只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页":"国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)");return s.jsxs("div",{className:"add-provider-block",hidden:!e,children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("账号版本")}),s.jsx("p",{children:r("两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。")}),s.jsx(In,{"aria-label":r("账号版本"),className:Ef,options:[{value:"cn",label:r("国内版(WorkBuddy)")},{value:"intl",label:r("国际版(WorkBuddy AI)")}],value:t,onValueChange:T=>v(T)})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("网页登录")}),s.jsx("p",{children:r("完成登录后自动加入账号列表,昵称取自上游。")}),s.jsxs("div",{className:"field-row",children:[s.jsx("span",{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("网页登录的打开方式"),className:Ef,options:[{value:"embedded",label:r("内嵌窗口")},{value:"external",label:r("系统默认浏览器")}],value:o,onValueChange:w}),s.jsxs("label",{className:"flex items-center gap-2",title:k,children:[s.jsx(hs,{checked:d,disabled:!N,onCheckedChange:T=>{f(T),zi.socialRestore=T}}),s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("恢复 Google / GitHub 入口")})]})]}),s.jsx("p",{children:r("系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。")}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:"web-login-button",onClick:()=>y.current?.start(),children:r("打开网页登录")}),s.jsx(se,{id:"web-login-cancel",variant:"outline",hidden:!0,onClick:()=>y.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:"web-login-hint",children:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")})]})]}),s.jsx(cq,{edition:t})]})}const zw="proxy",Bw="preset",mg="custom",dq="import",Rf="preset:",Hw="__new__";function fq(e){return e===Bw||e===mg?e:zw}const hg={workbuddy:"assets/providers/workbuddy.png","workbuddy-intl":"assets/providers/workbuddy.png",raccoon:"assets/providers/raccoon.png",catpaw:"assets/providers/catpaw.png",autoclaw:"assets/providers/autoclaw.png","autoclaw-intl":"assets/providers/autoclaw.png",qoder:"assets/providers/qoder.png","qoder-intl":"assets/providers/qoder.png","cline-free":"assets/providers/cline.png","cline-pass":"assets/providers/cline.png",accio:"assets/providers/accio.png","accio-cn":"assets/providers/accio.png",zcode:"assets/providers/zcode.png","zcode-intl":"assets/providers/zcode.png",codearts:"assets/providers/codearts.png",trae:"assets/providers/trae.png",loomy:"assets/providers/loomy.png",kuku:"assets/providers/kuku.png",monkeycode:"assets/providers/monkeycode.png","monkeycode-intl":"assets/providers/monkeycode.png",commandcode:"assets/providers/commandcode.png",antigravity:"assets/providers/antigravity.png",officeace:"assets/providers/officeace.png",orcaterm:"assets/providers/orcaterm.png",modelscope:"assets/providers/modelscope.png","modelscope-intl":"assets/providers/modelscope.png"},pq=new Set(["monkeycode","monkeycode-intl","commandcode","antigravity"]);function mq(e){const t=gt().wbProviders;if(e===Bw)return(gt().wbPresetProviders?.list||[]).map(h=>{const b=zR(h);return{id:Rf+h.key,label:h.name,count:b?Rw(b.id):0,preset:!0,builtId:b?.id||""}});if(e===mg)return(t?.customList?.()||[]).filter(h=>!T8(h)).map(h=>({id:h.id,label:h.name||h.id,count:Rw(h.id),custom:!0}));const a=t?.all?.()||[],o=(h,b)=>h===Bi?Dw:gt().wbProviders?.labelOf?.(h)||b,d=(a.length?a.map(h=>{const b=String(h.id||"");return{id:b,label:o(b,String(h.label||h.id||"")),count:Number(h.count)||0,beta:pq.has(b)}}):[{id:Bi,label:Dw,count:Rw(Bi)}]).filter(h=>h.id!=="workbuddy-intl"),f=d.findIndex(h=>h.id==="autoclaw-intl"),p=d.findIndex(h=>h.id==="autoclaw");return p>=0&&f>p&&d.splice(p+1,0,d.splice(f,1)[0]),d}function hq({item:e}){const t=e.id.startsWith(Rf)?gt().wbPresetProviders?.iconOf?.(e.id.slice(Rf.length))||"":hg[e.id];if(t)return s.jsx("span",{className:"add-provider-logo has-icon",children:s.jsx("img",{src:t,alt:"",loading:"lazy"})});const a=String(e.label||"?").trim().slice(0,1).toUpperCase()||"?";return s.jsx("span",{className:"add-provider-logo",children:a})}function gq(e){return e.preset?e.builtId?e.count?r("已建过 · {n} 个账号,点击继续添加",{n:e.count}):r("已建过,点击继续添加账号"):r("点开即预填,填 Key 接入"):e.custom?e.count?r("{n} 个账号,点击添加",{n:e.count}):r("点击添加账号"):e.count?r("{n} 个账号",{n:e.count}):r("还没有账号")}function xq({item:e,onPick:t}){return s.jsxs("button",{type:"button",className:"add-provider-card","data-provider":e.id,role:"option",onClick:()=>t(e.id),children:[s.jsx(hq,{item:e}),s.jsxs("span",{className:"add-provider-info",children:[s.jsxs("span",{className:"add-provider-name",children:[e.label,e.beta?s.jsx("span",{className:"add-provider-beta",children:"(beta)"}):null]}),s.jsx("span",{className:"add-provider-meta",children:gq(e)})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function bq({onPick:e}){return s.jsxs("button",{type:"button",className:"add-provider-card is-new","data-provider":Hw,role:"option",onClick:()=>e(Hw),children:[s.jsx("span",{className:"add-provider-logo is-new",children:"+"}),s.jsxs("span",{className:"add-provider-info",children:[s.jsx("span",{className:"add-provider-name",children:r("新建自定义提供商")}),s.jsx("span",{className:"add-provider-meta",children:r("接入一个兼容上游")})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function vq({accountType:e,onAccountTypeChange:t,search:a,onSearchChange:o,onPick:c,version:d,importing:f,importPanel:p}){const h=x.useMemo(()=>mq(e),[e,d]),b=a.trim().toLowerCase(),y=h.filter(w=>!b||w.label.toLowerCase().includes(b)),v=e===mg&&!b;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("选择提供商")}),s.jsxs("div",{className:"add-pick-row",style:f?{display:"none"}:void 0,children:[s.jsx(In,{"aria-label":r("账号类型"),className:Ef,options:[{value:zw,label:"Agent"},{value:Bw,label:r("预置 API")},{value:mg,label:r("自定义")}],value:e,onValueChange:w=>t(fq(w))}),s.jsx("span",{id:"add-search-wrap",className:"add-provider-search ml-auto max-w-[340px] min-w-0 flex-[1_1_200px]",children:s.jsxs(Ci,{children:[s.jsx(Ti,{children:"⌕"}),s.jsx(Ei,{id:"add-provider-search",type:"search",placeholder:r("搜索提供商…"),autoComplete:"off","aria-label":r("搜索提供商"),value:a,onChange:w=>o(w.currentTarget.value)})]})})]}),p,s.jsxs("div",{className:"add-provider-grid",id:"add-provider-grid",role:"listbox","aria-label":r("选择要添加账号的提供商"),style:f?{display:"none"}:void 0,children:[v?s.jsx(bq,{onPick:c}):null,y.map(w=>s.jsx(xq,{item:w,onPick:c},w.id)),!y.length&&b?s.jsx("div",{className:"add-provider-empty",children:r("没有匹配「{keyword}」的提供商",{keyword:a.trim()})}):null]})]})}function gg(e,t){return Pe().wbIcons?.icon?.(e,t)||""}function yq({account:e,rank:t}){const a=r("组内第 {rank} 位",{rank:t});return s.jsxs("div",{className:"order-cell",children:[s.jsx("span",{className:"order-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整组内顺序"),title:r("按住拖动,调整这个账号在本组内的顺序"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"order-rank",title:a,children:`#${t}`})]})}function wq({group:e,ids:t,collapsed:a}){const[o,c]=x.useState(!1),d="w-full justify-start px-2 font-normal";return s.jsxs(hf,{open:o,onOpenChange:c,children:[s.jsx(Hh,{render:s.jsx("button",{type:"button",className:"grp-iconbtn",title:r("本组操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[196px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("启用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!0)},children:r("全部启用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("禁用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!1)},children:r("全部禁用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("打开批量操作弹窗,并预选这一组的账号(改代理等动作在弹窗里挑参数)"),onClick:()=>{c(!1),yw(t,"proxy")},children:r("批量操作本组")}),s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:d,onClick:()=>{c(!1),JA(e.provider)},children:r(a?"展开这一组":"折叠这一组")})]})})]})}function jq({group:e,collapsed:t,colSpan:a}){const o=hg[e.provider];return s.jsx("tr",{className:"grp-band","data-provider":e.provider,children:s.jsx("td",{colSpan:a,children:s.jsxs("div",{className:"grp-band-inner",children:[s.jsx("span",{className:"queue-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整整组顺序"),title:r("按住拖动,调整这一家的组顺位(整组一起动)"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"grp-rank",title:r("组顺位:越小越先用(拖动分组带调整)"),children:r("第 {rank} 顺位",{rank:e.rank})}),s.jsx("span",{className:"grp-logo",children:o?s.jsx("img",{src:o,alt:"",loading:"lazy"}):s.jsx("span",{className:"grp-logo-txt",children:String(e.label||"?").trim().slice(0,1).toUpperCase()})}),s.jsx("span",{className:"grp-name",children:e.label}),s.jsx("span",{className:"grp-stat",children:r("{total} 个账号 · 启用 {enabled} · 禁用 {disabled}{limited}",{total:e.members.length,enabled:e.enabled,disabled:e.disabled,limited:e.limited>0?r(" · 限流 {n}",{n:e.limited}):""})}),s.jsx("span",{className:"grp-spacer"}),s.jsx("button",{type:"button",className:"grp-iconbtn grp-fold","aria-expanded":!t,title:r(t?"展开这一组":"折叠这一组"),onClick:()=>JA(e.provider),dangerouslySetInnerHTML:{__html:gg("chevronDown",14)}}),s.jsx(wq,{group:e,ids:e.accounts.map(c=>c.id),collapsed:t})]})})})}function Sq({account:e}){const t=cr(e),a=o$(e);!t&&QF(e,Al(e))&&a.push({text:r("Token 限额 · 已禁用"),kind:"bad",title:r("本周期 Token 消耗达到限制器的上限,账号已被自动禁用(窗口重置也不恢复,需手动启用)")});const o=cu(e)||e.id;return s.jsxs(s.Fragment,{children:[s.jsx(hs,{checked:t,"aria-label":r("{action}{who}",{action:r(t?"禁用":"启用"),who:o}),title:r(t?"已启用,点击禁用(不参与转发)":"已禁用,点击启用"),onCheckedChange:c=>{xR(e.id,c)}}),a.length?s.jsx("div",{className:"status-tags",children:a.map(c=>s.jsx(ze,{shape:"tag",variant:c.kind==="bad"?"destructive":"secondary",title:c.title,children:c.text},c.text))}):null]})}function Nq({account:e,open:t}){const a=pw(e);if(!a.length)return Fh(e,Za(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额")}):s.jsxs(ze,{variant:"success",shape:"tag",title:r("当前没有任何模型处于限流中"),children:[s.jsx(uy,{}),r("正常")]});const o=gw(a[0].resetAt);return s.jsxs(s.Fragment,{children:[s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:t?"ring-2 ring-warning-soft":void 0,title:r("点击{action}各模型的限流明细",{action:r(t?"收起":"查看")}),onClick:()=>nR(e.id,"limits",!t),children:r("{n} 个模型 ▾",{n:a.length})}),s.jsx("span",{className:"lim-sub",title:r("最早恢复"),children:r("最早 {soonest} 恢复",{soonest:o===hw?r("待定"):o})})]})}function kq({account:e}){const t=ir(kn(e)),a=SA(t.edition?e.expiresAt:e[t.expiry]);if(!a)return s.jsx("span",{className:"muted",title:r("记录里没有过期时间"),children:"—"});const o=a-Date.now();if(o<=0)return s.jsx(ze,{variant:"destructive",shape:"tag",title:r("凭证已过期,转发时会先刷新"),children:r("已过期")});const c=o<36e5?r("{n} 分钟后",{n:Math.max(1,Math.round(o/6e4))}):o<48*36e5?r("{n} 小时后",{n:(o/36e5).toFixed(1)}):r("{n} 天后",{n:Math.floor(o/24/36e5)}),d=Fs(a);return s.jsx("span",{title:d?r("{text}过期({full})",{text:c,full:d}):r("{text}过期",{text:c}),children:c})}function Cq({account:e}){const t=iR(e.id);return t<=0?null:s.jsx("span",{className:"conn-count",title:r("{n} 个请求正在使用该账号(含还在下发内容的流式请求)",{n:t}),children:t})}function yr(e){if(e==null||e==="")return"—";const t=Number(e);return Number.isFinite(t)?String(t):String(e)}function Tq(e){return!e||typeof e!="object"||Array.isArray(e)?"":XR(e.subscription)}function XR(e){if(!e||typeof e!="object")return"";const t=e,a=[];t.planName&&a.push(r("套餐 {name}",{name:String(t.planName)})),t.status&&a.push(r("状态 {status}",{status:String(t.status)})),t.state&&String(t.state)!=="active"&&a.push(_A(t.state));const o=t.expireAt;if(o!=null&&o!==""){const c=Number(o),d=Number.isFinite(c)&&c>1e11?Fs(c):String(o);d&&a.push(r("到期 {time}",{time:d}))}return Number.isFinite(Number(t.remainQuota))&&a.push(r("余量 {value}",{value:yr(t.remainQuota)})),Number.isFinite(Number(t.totalQuota))&&a.push(r("总量 {value}",{value:yr(t.totalQuota)})),a.join(" ")}function Eq(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e.plans;return Array.isArray(t)?t.filter(a=>a&&typeof a=="object"&&String(a.state||"")==="pending"):[]}function Aq(e){const t=e.map(a=>{const o=String(a.name||a.planId||r("套餐")),c=Number(a.pendingUntil??a.startsAt);return Number.isFinite(c)&&c>0?r("{name}({time} 起生效)",{name:o,time:Fs(c*1e3)}):o});return r(`已领到、还没到生效时间的套餐(生效后余额列会按它显示): {lines}`,{lines:t.join(` -`)})}function Tq(e){if(e===void 0)return{text:r("未查询"),kind:"muted",title:r("尚未查询该账号的余额")};if(e===null)return{text:r("查询中…"),kind:"muted",title:r("正在查询")};const t=uu(e);if(t)return t.notConfigured?{text:r("未配置"),kind:"muted",title:r("{message}(去该账号的「设置」里填上查询凭证即可)",{message:t.message})}:{text:r("查询失败"),kind:"bad",title:t.message};if(typeof e!="object"||e===null)return{text:r("无数据"),kind:"muted",title:String(e)};const a=e;if(Object.prototype.hasOwnProperty.call(a,"totalLeft")){const o=a.unlimited?"∞":yr(a.totalLeft);return{text:r("可用 {total}",{total:o}),kind:"ok",title:r("总剩余 {total} · 套餐 {plan} · 奖励 {bonus}",{total:o,plan:yr(a.planLeft),bonus:yr(a.bonusLeft)})}}if(Object.prototype.hasOwnProperty.call(a,"available")||Array.isArray(a.wallets)){const o=String(a.unit||r("积分")),c=Array.isArray(a.wallets)?a.wallets:[],d=c.map(w=>`${w?.displayName||w?.type||r("明细")} ${w?.balanceView?String(w.balanceView):yr(w?.balance)}`).join(" · "),f=YR(a.subscription),p=[];if(c.length===0&&Array.isArray(a.plans)&&a.plans.length>0){const w=XR(a);p.push(w&&QR(w)?r("读数里没有额度桶,这里按套餐权益里的已用 / 总量显示(上游给的数)"):r("上游的余额读数里没有这个套餐的额度桶,剩余量读不到;余额列显示的是套餐发放的权益额度,不是剩余量"))}String(a.walletsFrom||"")==="monitor"&&p.push(r("额度窗口读数来自开放平台监控通道(套餐 JWT 那条通道没有额度桶):读的是每 N 小时 / 每周窗口的剩余比例"));const h=a.available==null?c.find(w=>w?.balance!=null):void 0,b=a.availableView?String(a.availableView):h?r("可用 {value} {unit}",{value:yr(h.balance),unit:String(h.unit||o)}):r("可用 {value} {unit}",{value:yr(a.available),unit:o}),y=[a.statisticsError?r("订阅统计未读到:{error}",{error:String(a.statisticsError)}):"",a.benefitError?r("福利网关未读到:{error}",{error:String(a.benefitError)}):""].filter(Boolean),v=a.benefitAbsent?[r("该账号没有福利模型额度(福利按活动下发,不是每个账号都有)")]:[];return{text:b+(y.length?" ⚠":""),kind:y.length?"warn":"ok",title:[b,d,f,...p,...v,...y].filter(Boolean).join(" · ")}}return{text:r("无数据"),kind:"muted",title:r("未返回可识别的余额数据")}}function XR(e){const t=Array.isArray(e.plans)?e.plans:[],a=o=>String(o?.state||"");return t.find(o=>a(o)==="active")||t.find(o=>a(o)==="pending")||t[0]||null}function Eq(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];let a=null;for(const o of t){const c=Number(o?.grantUnits);if(!Number.isFinite(c)||c<=0)continue;const d=String(o?.unitType||"").trim();(!a||c>a.units)&&(a={units:c,unit:d})}return a}function QR(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];for(const a of t){const o=Dr(a?.totalUnits);if(o===null||o<=0)continue;const c=Dr(a?.usedUnits),d=Dr(a?.remainingUnits),f=c===null?d===null?null:Math.max(0,o-d):c;if(f!==null)return{used:f,total:o,unit:String(a?.unitType||"").trim()}}return null}function Aq(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,a=Array.isArray(t.wallets)?t.wallets:[];let o=null;for(const p of a){const h=Number(p?.total);!Number.isFinite(h)||h<=0||(!o||h>Number(o.total))&&(o=p)}const c=t.subscription&&typeof t.subscription=="object"?t.subscription:{};if(!o){let p=null;for(const w of a){const j=Dr(w?.remainingPercent);j!==null&&(!p||j0,N=S?Math.max(0,Math.min(100,y/v*100)):null;c.push({name:b,view:S?r("剩 {remaining} / {total}",{remaining:yr(y),total:yr(v)}):r("剩 {remaining}",{remaining:yr(y)}),tone:y<=0?"muted":N!==null&&N<20?"warn":"ok",percent:N,over:!1,title:S?void 0:r("上游未给总量,画不出剩余比例")});continue}if(j!==null||Dr(h.allowanceTokens)!==null){const S=Dr(h.usedTokens)??0,N=Dr(h.allowanceTokens),k=N!==null&&N>1,T=k&&S>N,D=h.unlimited===!0,C=k?Math.max(0,Math.min(100,(1-S/N)*100)):null,A=D?r("无上限 · 已用 {used}",{used:No(S)}):k?r("剩 {remaining} / {total}",{remaining:No(Math.max(0,N-S)),total:No(N)}):S>0?r("已用 {used}",{used:No(S)}):r("未使用");d.push({name:Oq(b),view:A,tone:T?"bad":!k&&!D?"muted":C!==null&&C<20?"warn":"ok",percent:C,over:T,title:[w,D?r("无上限按日计(上游到达上限后仍继续计数,超额如实显示)"):null].filter(Boolean).join(" · ")});continue}d.push({name:b,view:w,tone:"muted",percent:null,over:!1,title:w})}const f=t.subscription&&typeof t.subscription=="object"?t.subscription:{},p=[t.statisticsError?r("订阅统计未读到:{error}",{error:String(t.statisticsError)}):"",t.benefitError?r("福利网关未读到:{error}",{error:String(t.benefitError)}):""].filter(Boolean);return{credit:c,token:d,total:Dr(t.available),unit:o,plan:n$(f.planName),free:zA(f.planName),resetDate:String(f.resetDate||""),missing:p,benefitAbsent:t.benefitAbsent===!0}}function Dq(e){const t=Al(e);let a=null;for(const v of KF(e)){if(v.enabled===!1)continue;const w=xf(v,t);if(!w)continue;const j=v.threshold>0?w.used/v.threshold:0;if(j>=1){a={rule:v,reading:w,ratio:j};break}(!a||j>a.ratio)&&(a={rule:v,reading:w,ratio:j})}if(!a)return null;const{rule:o,reading:c}=a,d=c.used>=o.threshold,f=cw(o),p=d?"":` · ${$h(f.remainingMs,f.daily)}`,h=f.daily?r("今日已用"):r("周期 Token"),b=o.reset==="daily"?r("今天(本地 0 点重置)"):r("{period}窗口",{period:OA(o.period??0)}),y=r("限制器:{window}已用 {used} / {threshold} Token",{window:b,used:Math.round(c.used).toLocaleString("en-US"),threshold:Math.round(o.threshold).toLocaleString("en-US")})+(d?r(",已达到上限"):r(",{countdown}重置",{countdown:$h(f.remainingMs,f.daily)}));return s.jsxs("span",{className:"usage-token-sub",title:y,children:[h," ",s.jsx("span",{className:d?"hit":void 0,children:Tl(c.used)})," ","/ ",Tl(o.threshold),p]})}function Iq({account:e}){if(!Ta(e))return s.jsx("span",{className:"muted",title:r("该提供商没有余额查询"),children:"—"});const t=Za(e),a=Tq(t),o=Fh(e,t)?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足 · 已跳过")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额 · 已跳过")}):null,c=Dq(e),d=a.kind==="ok"||a.kind==="warn"?kq(t):[],f=d.length?s.jsx(ze,{variant:"warning",shape:"tag",title:Cq(d),children:r("待生效 {n} 份",{n:d.length})}):null,p=a.kind==="ok"||a.kind==="warn"?IF(t):[],h=LA(e)&&p.length?{rows:p,subscriptionLine:Nq(t),kind:a.kind,title:a.title}:null,b=a.kind==="ok"||a.kind==="warn"?Rq(t):[];if(b.length)return s.jsxs("span",{className:"usage-cell",title:a.title,children:[b.map(w=>s.jsx(ZR,{row:w},w.name)),o,f,c]});if(t$(e)){const j=a.kind==="ok"||a.kind==="warn"?Mq(t):null;return j?s.jsx(Pq,{summary:a,detail:j,blockedBadge:o,tokenSub:c}):s.jsxs("span",{className:"usage-sum-wrap",children:[s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]})}const y=a.kind==="ok"||a.kind==="warn"?Aq(t):null;if(!y)return s.jsxs("span",{className:"usage-sum-wrap",children:[h?s.jsx(yA,{variant:"sum",...h,children:a.text}):s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]});const v=s.jsxs(s.Fragment,{children:[y.percent!==null?s.jsx(tf,{value:y.percent,className:"usage-pool-bar"}):null,s.jsx("span",{className:`usage-pool-view ${a.kind}`,children:y.text})]});return s.jsxs("span",{className:"usage-pool",title:a.title,children:[y.planName?s.jsx("span",{className:"usage-pool-name",children:y.planName}):null,h?s.jsx(yA,{variant:"pool",...h,children:v}):s.jsx("span",{className:"usage-pool-line",children:v}),o,f,c]})}function Pq({summary:e,detail:t,blockedBadge:a,tokenSub:o}){const[c,d]=x.useState(!1),f=e.kind==="ok"||e.kind==="warn";return s.jsxs("span",{className:c?"usage-cell open":"usage-cell",children:[s.jsxs("span",{className:"usage-plan",children:[t.plan?s.jsx("span",{className:`plan-chip${t.free?" free":""}`,children:t.plan}):null,t.resetDate?s.jsx("span",{className:"plan-sub",title:r("套餐积分的重置日期"),children:r("重置 {date}",{date:t.resetDate})}):null]}),s.jsxs(hf,{open:c,onOpenChange:d,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:`usage-toggle ${e.kind}`,title:e.title,"aria-label":r("积分明细")}),children:[s.jsx("span",{className:"val",children:e.text}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsxs(gf,{align:"end",sideOffset:6,className:"usage-pop w-[288px]",children:[f&&t.missing.length?t.missing.map(p=>s.jsx("div",{className:"usage-pop-missing",title:p,children:p},p)):null,t.credit.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"usage-pop-group",children:r("积分")}),t.credit.map(p=>s.jsx(_q,{row:p},p.name))]}):null,t.total!==null?s.jsxs("div",{className:"usage-pop-total",children:[s.jsx("span",{className:"k",children:r("可用合计")}),s.jsxs("span",{className:"v",children:[yr(t.total)," ",s.jsx("small",{children:t.unit})]})]}):null,!t.credit.length&&t.total===null?s.jsx("div",{className:"usage-pop-empty",title:r("该账号的额度只有福利 token 池(见余额格那两行),订阅统计没有积分类计量表"),children:r("该账号没有积分类读数(额度只有福利 token 池)")}):null]})]}),t.token.map(p=>s.jsx(ZR,{row:p},p.name)),t.benefitAbsent?s.jsxs("span",{className:"usage-flat-line",title:r("福利按限时活动下发,不是每个账号都有 —— 正常状态,不是查询失败"),children:[s.jsx("span",{className:"usage-flat-name",children:r("福利日额度")}),s.jsx("span",{className:"usage-flat-view muted",children:r("无福利额度")})]}):null,a,o]})}function _q({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.percent!==null?s.jsx("span",{className:`usage-pop-track${e.over?" over":""}`,children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function Lq({account:e,namesHidden:t}){const a=Vh(e),o=ir(kn(e)),c=cu(e)||r("未命名账号"),d=String(e.email||"").trim(),f=String(e.nickname||"").trim(),p=String(e.name||"").trim(),h=j=>t?j$(j):j,b=[d&&d!==c?r("邮箱 {email}",{email:h(d)}):"",a?`${o.identifier} ${a}`:"",!e.nameCustom&&p&&p!==d&&p!==f?r("备注名 {name}",{name:h(p)}):"",f&&f!==c&&f!==d?r("昵称 {name}",{name:h(f)}):"",bf(e)?r("桌面端实时登录态(凭证每次从客户端登录态文件读取)"):"",e.updatedAt?r("更新于 {time}",{time:Fs(e.updatedAt)}):"",e.source?r("来源 {source}",{source:e.source==="imported"?r("旧数据导入"):r("手动添加")}):""].filter(Boolean),y=d&&d!==c,v=e.proxy?.error,w=b.length?s.jsx(XU,{delay:0,children:s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("div",{className:"acct-name"}),children:s.jsx("span",{className:"name",children:h(c)})}),s.jsxs(_i,{children:[s.jsx(QU,{}),b.map((j,S)=>s.jsx("div",{children:j},S))]})]})}):s.jsx("div",{className:"acct-name",children:s.jsx("span",{className:"name",children:h(c)})});return s.jsxs(s.Fragment,{children:[w,y?s.jsx("div",{className:"acct-sub",children:s.jsx("span",{className:"acct-email",title:r("账号邮箱"),children:h(d)})}):null,v?s.jsx("div",{className:"acct-note bad",title:r("代理不可用:{error}",{error:v}),children:r("代理不可用:{error}",{error:v})}):null]})}function zq({account:e}){const t=e.proxy,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=t?.error,d=k$(),f=Array.isArray(d)?d:[];let p="";a==="pool"&&t?.config?.proxyId?p=`${Xa}${t.config.proxyId}`:t&&(p=ng);const h=[{value:"",label:r("直连")}];for(const v of f)h.push({value:`${Xa}${v.id}`,label:au(v)});if(d===null?h.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):f.length||h.push({value:"__hint_pool__",label:C$()?r("代理列表读取失败(重试中)"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),p===ng){const v=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";h.push({value:ng,label:`${v}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!f.some(v=>`${Xa}${v.id}`===p)&&h.push({value:p,label:`${o}${c?r("(不可用)"):""}`});h.push({value:yR,label:r("自定义代理…")});const b=c?r("代理不可用:{error}(转发时会回退直连);选「自定义代理…」去修改",{error:c}):a==="rotate"?r("当前:{label}(每条请求换一个出口);「自定义代理…」打开完整设置",{label:o}):a==="clash"||a==="custom"?r("当前:{label}(未经过代理池 —— 可在「网络代理」页把出口同步进池后来这里改选)",{label:o}):r("当前:{label};选项来自「网络代理」页;「自定义代理…」打开完整设置",{label:t?o:r("直连")}),y=h.find(v=>v.value===p);return s.jsxs(ft,{value:p,onValueChange:v=>{_$(e.id,String(v),p)},children:[s.jsx(mt,{className:Ue("w-full",c&&"border-destructive-bd"),title:b,"aria-label":r("出网代理"),children:s.jsx(pt,{children:y?.label||r("直连")})}),s.jsx(ht,{children:h.map(v=>s.jsx(qe,{value:v.value,disabled:v.disabled,children:v.label},v.value))})]})}function Bq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=Ta(e),d=IA(e);return s.jsxs("div",{className:"acct-actions",children:[d?s.jsx(se,{variant:"outline",size:"xs",title:JF(e)?e$(e):r("查看可领取的套餐与名下已有的套餐(每天一期,领取需过一次人机验证)"),onClick:()=>wR(e.id),children:r("领套餐")}):null,c?s.jsx(se,{variant:"outline",size:"xs",disabled:a,title:r("查询该账号剩余余额(读数显示在余额列)"),onClick:()=>{o(!0),I$(e.id).finally(()=>o(!1))},children:r("余额")}):null,s.jsx(se,{variant:"outline",size:"xs",title:r("备注名 / 启用 / 代理"),onClick:()=>Jh(e.id),children:r("设置")}),s.jsx(Hq,{account:e,atFront:t})]})}function Hq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=cr(e),d=Number(e.maxConcurrent)||0,f="w-full justify-start px-2 font-normal",p=`${f} text-destructive hover:text-destructive`;return s.jsxs(hf,{open:a,onOpenChange:o,children:[s.jsx(Hh,{render:s.jsx(se,{variant:"outline",size:"xs",title:r("更多操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[172px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:p,onClick:()=>{o(!1),xR(e.id,!c)},children:r(c?"禁用":"启用")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,disabled:t,title:r(t?"已在全局队列第一位":"仅将优先级调整到全局第一位,不改变启用状态"),onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("switch",e.id)},children:r("设为首选")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,title:r("在账号设置的「基本」分组里设置该账号同时最多处理的请求数"),onClick:()=>{o(!1),Jh(e.id)},children:r("并发上限:{value}",{value:d>0?d:r("不限")})}),e.hasRefreshToken?s.jsx(se,{variant:"ghost",size:"sm",className:f,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("refresh",e.id)},children:r("刷新 Token")}):null,s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:p,title:bf(e)?r("删除这条账号记录(不会影响客户端自己的登录态;之后可再点「导入桌面端登录态」加回来)"):void 0,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("remove",e.id)},children:r("删除账号")})]})})]})}function Uq({account:e,onClose:t,onClear:a}){const o=pw(e),c=s.jsx(se,{variant:"ghost",size:"icon-xs",className:"panel-close",title:r("收起"),onClick:t,children:"✕"});return o.length?s.jsxs("div",{className:"row-panel limit-panel",children:[c,s.jsxs("div",{className:"lp-head",children:[s.jsx("b",{children:cu(e)}),s.jsx("span",{className:"muted",children:r("{n} 个模型限流中 · 记录来自上游 429 / 限额码,到恢复时间自动解除",{n:o.length})}),s.jsx(se,{variant:"outline",size:"xs",title:r("清掉该账号全部模型的限流标记"),onClick:()=>a(""),children:r("全部清除")})]}),o.map(d=>{const f=gw(d.resetAt),p=d.message||(d.status?r("上游返回 {status}",{status:d.status}):"");return s.jsxs("div",{className:"lp-row",children:[s.jsx("span",{className:"lp-model",title:d.model,children:d.model}),s.jsx(ze,{variant:"warning",shape:"tag",children:r("限流中")}),s.jsx("span",{className:"lp-reset",title:r("到恢复时间后自动解除,无需手动操作"),children:f===hw?r("恢复时间未知"):r("{time} 恢复",{time:f})}),s.jsx("span",{className:"lp-reason",title:p,children:p}),s.jsx(se,{variant:"outline",size:"2xs",title:r("清掉本机的限流标记,立刻重新尝试该模型(上游若仍在限流会再次被标记)"),onClick:()=>a(d.model),children:r("清除标记")})]},d.model)})]}):s.jsxs("div",{className:"row-panel limit-panel",children:[r("当前没有限流中的模型。"),c]})}function Vq({account:e,colSpan:t,limitsOpen:a,onClear:o}){return a?s.jsx("tr",{className:"acct-panels","data-panels-for":e.id,children:s.jsx("td",{colSpan:t,children:s.jsx(Uq,{account:e,onClose:()=>nR(e.id,"limits",!1),onClear:c=>o(e.id,c)})})}):null}function Fq({namesHidden:e,allPicked:t,somePicked:a,disabled:o,onToggleAll:c}){const d=s.jsx("span",{className:"col-grip",title:r("拖动调整列宽(双击还原)")});return s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"cell-pick","data-col":"pick",children:s.jsx(Mr,{id:"acct-select-all",checked:t,indeterminate:!t&&a,disabled:o,"aria-label":r("全选当前筛选结果"),title:r("全选 / 取消全选当前筛选结果(与批量栏同一个选择)"),onCheckedChange:f=>c(f)})}),s.jsxs("th",{className:"cell-order","data-col":"order",children:[s.jsx("span",{className:"th-label",title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),children:r("顺序")}),d]}),s.jsxs("th",{className:"cell-account","data-col":"account",children:[s.jsxs("span",{className:"th-label",children:[r("账号"),s.jsx($q,{hidden:e})]}),d]}),s.jsxs("th",{className:"cell-proxy","data-col":"proxy",children:[s.jsx("span",{className:"th-label",title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),children:r("代理")}),d]}),s.jsxs("th",{className:"cell-connections","data-col":"connections",children:[s.jsx("span",{className:"th-label",title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),children:r("连接数")}),d]}),s.jsxs("th",{className:"cell-status","data-col":"status",children:[s.jsx("span",{className:"th-label",children:r("状态")}),d]}),s.jsxs("th",{className:"cell-limits","data-col":"limits",children:[s.jsx("span",{className:"th-label",title:r("该账号当前限流中的模型;点徽章看明细"),children:r("限流")}),d]}),s.jsxs("th",{className:"cell-expiry","data-col":"expiry",children:[s.jsx("span",{className:"th-label",children:r("有效期")}),d]}),s.jsxs("th",{className:"cell-usage","data-col":"usage",children:[s.jsx("span",{className:"th-label",children:r("余额")}),d]}),s.jsx("th",{className:"cell-actions","data-col":"actions",children:s.jsx("span",{className:"th-label",children:r("操作")})})]})})}function $q({hidden:e}){const t=r(e?"显示账号名":"隐藏账号名(名字显示为星号)");return s.jsx("button",{type:"button",className:`name-eye${e?" on":""}`,title:t,"aria-label":t,"aria-pressed":e,onClick:()=>w$(),dangerouslySetInnerHTML:{__html:gg(e?"eyeOff":"eye",13)}})}const WR="dragging",Of=["drop-before","drop-after"];let Wa=null;function JR(e){e.querySelectorAll(`.${Of[0]}, .${Of[1]}`).forEach(t=>{t.classList.remove(...Of)})}function qq(e,t){if(t==="group"){const o=e.parentElement;return o?[...o.children].filter(c=>c.classList.contains("acct-group")):[]}const a=e.parentElement;return a?[...a.children].filter(o=>o.classList.contains("acct-row")):[]}function eO(e,t){for(let a=0;aa!==e.item);JR(e.container),t.length&&(e.index>=t.length?t[t.length-1].classList.add(Of[1]):t[e.index].classList.add(Of[0]))}function tO(e){if(!Wa)return;if(e.buttons===0){xg(!1);return}const t=Wa.items.filter(o=>o!==Wa.item),a=eO(t,e.clientY);a!==Wa.index&&(Wa.index=a,Gq(Wa))}function xg(e){const t=Wa;t&&(Wa=null,window.removeEventListener("pointermove",tO),window.removeEventListener("pointerup",nO),window.removeEventListener("pointercancel",sO),window.removeEventListener("keydown",rO),document.body.classList.remove("queue-dragging"),t.item.classList.remove(WR),JR(t.container),e&&(t.kind==="group"?Uw?.onDrop({kind:"group",provider:t.provider,index:t.index}):Uw?.onDrop({kind:"row",provider:t.provider,accountId:t.accountId,index:t.index})))}function nO(){xg(!0)}function sO(){xg(!1)}function rO(e){e.key==="Escape"&&xg(!1)}let Uw=null;function Kq(e,t){Uw=t,e&&e.dataset.queueDragBound!=="1"&&(e.dataset.queueDragBound="1",e.addEventListener("pointerdown",a=>{if(a.button!==0||Wa)return;const o=a.target,c=o?.closest?.(".queue-grip"),d=o?.closest?.(".order-grip");if(!c&&!d)return;if(a.preventDefault(),c&&t.isLocked()){t.onLockedAttempt();return}const f=(c??d).closest("tbody.acct-group, tr.acct-row");if(!f)return;const p=c?"group":"row",h=f.dataset.provider||f.closest("tbody.acct-group")?.dataset.provider||"",b=f.dataset.id||"";if(p==="row"&&!b)return;const y=qq(f,p);if(y.length<2)return;const v=y.filter(w=>w!==f);Wa={kind:p,provider:h,accountId:b,item:f,container:f.parentElement||e,items:y,index:eO(v,a.clientY)},f.classList.add(WR),document.body.classList.add("queue-dragging"),window.addEventListener("pointermove",tO),window.addEventListener("pointerup",nO),window.addEventListener("pointercancel",sO),window.addEventListener("keydown",rO)}))}let bg=null,aO=!1,Vw=0,vg=null,lO="";function oO(){return bg?bg.apply(Cw):Cw}function iO(){window.wbAccountsView?.render?.()}function Yq(){const e=oO(),t=`${vg?"T":"F"}|${e.map(o=>`${o.key}:${o.align}`).join("|")}`;if(t===lO)return;lO=t,Pe().wbColSettings?.syncStaticHead("accounts",vg);const a=[...vg?.querySelectorAll("thead th")||[]];a.forEach((o,c)=>{const d=o.querySelector(".col-grip");d&&(d.style.display=c===a.length-1?"none":"")})}function Xq(){const e=x.useSyncExternalStore(YA,Ws),t=x.useRef(null),[,a]=x.useReducer(B=>B+1,0),o=!!bw(),c=El(),{groups:d,allGroups:f}=u$(Za,Al),p=d$(Za,Al),h=[{value:"all",label:r("全部({n})",{n:c.length})}].concat(XA().map(B=>({value:B.id,label:r("{label}({count})",{label:B.label,count:B.count})}))),b=d.flatMap(B=>B.accounts),y=f$(),v=oO(),w=ig(b.length,"accounts",{defaultSize:"all"}),j=w.paged?w.slice(b):b,S=Xh()||w.paged,N=Xh()?r("清除筛选"):r("把每页调回「全部」");x.useEffect(()=>{T$()}),x.useEffect(()=>{h$()},[e.version]),x.useLayoutEffect(()=>{if(!aO){if(!Pe().wbColSettings?.register){window.clearTimeout(Vw),Vw=window.setTimeout(()=>k(B=>B+1),50);return}aO=!0,bg=Pe().wbColSettings?.register({id:"accounts",label:r("账号表"),columns:Cw.map(B=>({key:B.key,label:B.label,align:B.align,legacyAlign:B.legacyAlign})),mount:()=>document.querySelector("#batch-bar .batch-actions"),onChange:iO})||null,bg&&a();return}Yq()});const[,k]=x.useState(0);x.useEffect(()=>()=>window.clearTimeout(Vw),[]),x.useEffect(()=>{k8(t.current,iO)},[]);const T=b.map(B=>B.id),D=T.length>0&&T.every(B=>e.selected.has(B)),C=T.some(B=>e.selected.has(B)),A=[...e.selected].filter(B=>!T.includes(B)).length,R=e.selected.size>0,I=f.length>0&&f.every(B=>e.collapsed.has(B.provider)),P=new Map;for(const B of d)P.set(B.provider,j.filter(z=>kn(z)===B.provider).map(z=>z.id));const O=x.useRef({displayed:d,all:f,renderedRows:P});x.useEffect(()=>{O.current={displayed:d,all:f,renderedRows:P}});const _=x.useRef({locked:!1,lockReason:"",onDrop:B=>{}}),L=x.useCallback(B=>{const{displayed:z,all:Q}=O.current;if(B.kind==="group"){const Z=Q.findIndex(te=>te.provider===B.provider);if(Z<0)return;const ae=Q[Z],ce=Q.filter((te,Ce)=>Ce!==Z),J=B.indexte.provider===J),ge=J===null||ie<0?ce.length:ie;if(ge===Z)return;const fe=[...ce.slice(0,ge),ae,...ce.slice(ge)].flatMap(te=>te.members.map(Ce=>Ce.id));bR(fe,r("{name} 移到第 {rank} 顺位",{name:ae.label,rank:ge+1}));return}const K=Q.find(Z=>Z.provider===B.provider);if(!K)return;const X=K.members.findIndex(Z=>Z.id===B.accountId);if(X<0)return;const q=K.members[X],$=K.members.filter((Z,ae)=>ae!==X),Y=O.current.renderedRows.get(B.provider)||[],F=B.indexZ.id===F),W=F===null||G<0?$.length:G;if(W===X)return;const le=[...$.slice(0,W),q,...$.slice(W)],U=Q.map(Z=>Z.provider===B.provider?{...Z,members:le}:Z).flatMap(Z=>Z.members.map(ae=>ae.id));bR(U,r("{name} 移到 {group} 组内第 {rank} 位",{name:String(q.name||q.id),group:K.label,rank:W+1}))},[]);x.useEffect(()=>{_.current={locked:S,lockReason:N,onDrop:L}}),x.useEffect(()=>{Kq(t.current,{isLocked:()=>_.current.locked,onLockedAttempt:()=>Le(r("当前视图不能调整组顺位:{reason} 之后再拖动",{reason:_.current.lockReason}),"err"),onDrop:B=>_.current.onDrop(B)})},[]);function H(B,z,Q){switch(B){case"pick":return s.jsx(Mr,{checked:Q.picked,"data-pick":z.id,title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:K=>b$(z.id,K)});case"order":return s.jsx(xq,{account:z,rank:Q.rank});case"account":return s.jsx(Lq,{account:z,namesHidden:e.namesHidden});case"proxy":return s.jsx(zq,{account:z});case"connections":return s.jsx(Sq,{account:z});case"status":return s.jsx(yq,{account:z});case"limits":return s.jsx(wq,{account:z,open:Q.limitsOpen});case"expiry":return s.jsx(jq,{account:z});case"usage":return s.jsx(Iq,{account:z});case"actions":return s.jsx(Bq,{account:z,atFront:Q.seat.position<=1});default:return null}}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel account-table",children:[s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"group","data-provider-group":"1",children:[s.jsx("span",{className:"label",children:r("提供商")}),s.jsxs(ft,{value:e.filter.provider,onValueChange:B=>m$(String(B)),children:[s.jsx(mt,{className:"max-w-none min-w-0 w-full min-[768px]:max-w-[200px] min-[768px]:min-w-[130px] min-[768px]:w-auto","aria-label":r("按提供商筛选账号"),children:s.jsx(pt,{children:h.find(B=>B.value===e.filter.provider)?.label||r("全部")})}),s.jsx(ht,{children:h.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsx("div",{className:"divider","data-provider-divider":"1"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("搜索")}),s.jsx($e,{className:"acct-search",type:"search",value:e.filter.q,placeholder:r("账号名 / 邮箱 / 备注"),"aria-label":r("搜索账号"),onChange:B=>p$(B.currentTarget.value)})]}),s.jsx("div",{className:"divider"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("状态")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.enabledAll??0},{value:"enabled",label:r("启用"),count:p.enabled??0},{value:"disabled",label:r("禁用"),count:p.disabled??0}],value:e.filter.enabled,onValueChange:B=>QA("enabled",B),"aria-label":r("启用状态")})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("限额")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.limitAll??0},{value:"normal",label:r("正常"),count:p.normal??0,disabled:e.filter.enabled==="disabled"},{value:"limited",label:r("已限流"),count:p.limited??0,disabled:e.filter.enabled==="disabled"}],value:e.filter.limit,onValueChange:B=>QA("limit",B),"aria-label":r("限额状态")})]}),s.jsxs("div",{className:"actions",children:[s.jsx(se,{id:"btn-fold-groups",variant:"outline",disabled:!f.length,title:r(I?"展开全部分组":"折叠全部分组(只留组头)"),onClick:()=>g$(f.map(B=>B.provider),!I),children:r(I?"展开全部":"折叠全部")}),s.jsx(se,{id:"btn-add-account-2",variant:"default",title:r("登录 / 导入一个新账号"),onClick:()=>{Pe().wbAddAccountModal?.open?.(),Pe().wbAccountAddForms?.syncAddProvider?.()},children:r("添加账号")}),s.jsx(se,{id:"btn-query-usage",variant:"outline",disabled:e.usageBusy||!c.some(Ta),title:r("查询全部账号的余额(含已禁用账号 —— 禁用只表示不参与转发)"),onClick:()=>{hR()},children:e.usageBusy?r("查询中…"):r("查询余额")})]})]}),s.jsxs("div",{className:Ue("batch-bar",R&&"active"),id:"batch-bar",children:[s.jsxs("label",{className:"batch-select-all",children:[s.jsx(Mr,{id:"batch-select-all",checked:D,indeterminate:!D&&C,disabled:!T.length,"aria-label":r("全选当前筛选结果"),onCheckedChange:B=>eR(T,B)}),s.jsx("span",{id:"batch-select-label",children:T.length?r("全选当前筛选结果({n} 个)",{n:T.length}):r("没有可全选的账号")})]}),s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{id:"batch-count",children:e.selected.size})," ",r("个 · 共")," ",s.jsx("b",{id:"accounts-count",children:c.length})," ",r("个")]}),s.jsx("span",{className:"batch-summary",id:"accounts-group-summary",children:d.length?r("{groups} 家 · 显示 {rows} 行",{groups:d.length,rows:T.length}):""}),S?s.jsx("span",{className:"batch-hidden",title:r("筛选 / 搜索 / 分页生效时组顺位不可拖动(别家的组整组不可见,落点没法定位)"),children:r("组顺位已锁定")}):null,Xh()?s.jsx(se,{id:"btn-clear-filter",variant:"ghost",size:"xs",title:r("清空搜索与三个筛选档位,回到全部账号"),onClick:()=>ZA(),children:r("清除筛选")}):null,A?s.jsx("span",{className:"batch-hidden",id:"batch-hidden-hint",children:r("另有 {n} 个已勾选账号被当前筛选隐藏,仍会参与操作",{n:A})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{id:"btn-batch-open",variant:"outline",disabled:!R,onClick:()=>yw([...e.selected],"enable"),children:r("批量操作")}),s.jsx(se,{id:"btn-batch-clear",variant:"outline",disabled:!R,onClick:()=>v$(),children:r("取消选择")})]})]}),s.jsx("div",{className:"acct-scroll",id:"account-list",ref:t,children:o?c.length?b.length?s.jsxs("table",{className:"acct-table",ref:Qq,style:{minWidth:`${S8(v.map(B=>B.key))}px`},children:[s.jsx(Zq,{}),s.jsx(Fq,{namesHidden:e.namesHidden,allPicked:D,somePicked:C,disabled:!T.length,onToggleAll:B=>eR(T,B)}),d.map(B=>{const z=e.collapsed.has(B.provider),Q=j.filter(K=>kn(K)===B.provider);return s.jsxs("tbody",{className:"acct-group","data-provider":B.provider,children:[s.jsx(vq,{group:B,collapsed:z,colSpan:v.length}),z?null:Q.map(K=>{const X=B.members.findIndex($=>$.id===K.id)+1,q=L$(K,y,X>0?X:1);return s.jsxs(x.Fragment,{children:[s.jsx("tr",{className:Ue("acct-row",!cr(K)&&"disabled",q.picked&&"selected"),"data-id":K.id,"data-provider":B.provider,"data-desktop":bf(K)?"1":void 0,children:v.map($=>s.jsx("td",{className:`cell-${$.key} ta-${$.align}`,children:H($.key,K,q)},$.key))}),s.jsx(Vq,{account:K,colSpan:v.length,limitsOpen:tR(K.id,"limits"),onClear:($,Y)=>{P$($,Y)}})]},K.id)})]},B.provider)})]}):s.jsxs("div",{className:"empty",children:[r("当前筛选条件下没有账号"),Xh()?s.jsx("button",{type:"button",className:"link-btn",onClick:()=>ZA(),children:r("清除筛选")}):null]}):s.jsx("div",{className:"empty",children:r("暂无账号,请点击右上角「添加账号」")}):s.jsxs("div",{className:"empty",children:[s.jsx("span",{className:"spinner"}),r("正在加载…")]})}),s.jsx(Li,{total:b.length,range:w.paged?{start:w.rangeStart,end:w.rangeEnd}:null,page:w.page,pageCount:w.pageCount,size:w.size,onSizeChange:w.setSize,onPageChange:w.goto})]}),s.jsx(h8,{})]})}function Qq(e){vg=e}function Zq(){const e=j8(),t=a=>s.jsx("col",{"data-col":a,style:e[a]?{width:`${e[a]}px`}:void 0},a);return s.jsxs("colgroup",{children:[t("pick"),t("order"),t("account"),t("proxy"),t("connections"),t("status"),t("limits"),t("expiry"),t("usage"),t("actions")]})}const cO='.page[data-page="accounts"]';let Fw=null;function uO(){if(Fw)return;const e=document.querySelector(cO);e&&(e.replaceChildren(),Fw=vn.createRoot(e),Cs.flushSync(()=>{Fw.render(s.jsx(Xq,{}))}))}B$(),R$(),document.querySelector(cO)?uO():document.addEventListener("DOMContentLoaded",uO,{once:!0});const Wq=64,Jq=100,eG=r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),tG=r("Anthropic 协议填根地址,不要带 /v1"),nG="https://open.bigmodel.cn/api/paas/v4",sG="https://api.anthropic.com",rG=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],xu="custom-protocol-select",bu="custom-name-input",vu="custom-baseurl-input",Mf="custom-apikey-input",Df="custom-noauth-check",yu="custom-existing-select",If="custom-existing-apikey-input",Pf="custom-existing-noauth-check",_f="custom-existing-name-input",aG="custom-create-button",lG="custom-existing-button",oG="custom-existing-remove";let $w=!1;const dO=()=>gt().wbProviders?.PROTOCOL_OPTIONS||rG,qw=()=>gt().wbProviders?.customList?.()||[],Gw="custom-balance",Kw="custom-existing-balance",Lf=(e,t)=>`${e}-${t}-input`;function fO(e){if(!e)return"";const t=gt().wbPresetProviders?.presetOf?.(e);return String(t?.balance?.scheme||"")}function pO(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=vr(Lf(t,c.key));d&&(o[c.key]=d)}return Object.keys(o).length?o:null}function mO(e,t){const a=kf(e);if(a)for(const o of a.fields)So(Lf(t,o.key),"")}function hO({scheme:e,prefix:t}){const a=kf(e);return a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("余额查询")}),s.jsxs("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:[s.jsx("span",{className:"text-xs text-subtle",children:r("方案:{label}",{label:a.label})}),s.jsx("span",{className:"ml-1.5 text-xs text-subtle",children:a.endpoint})]}),s.jsx("span",{className:"hint",children:a.note})]}),a.fields.map(o=>s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Lf(t,o.key),children:o.label}),s.jsx($e,{id:Lf(t,o.key),type:o.secret?"password":"text",autoComplete:o.secret?"new-password":"off",placeholder:o.placeholder,...Aa(Lf(t,o.key))}),s.jsx("span",{className:"hint",children:o.hint})]},o.key))]}):null}async function Yw(e,t){if(!$w){$w=!0,e(!0);try{await t()}finally{$w=!1,e(!1)}}}async function gO(e){gt().wbAddAccountModal?.close?.(),gt().wbProviders?.refreshCustom?.(),await gt().wbApp?.refresh?.(),Jn(e)}function zf(e,t){So(e,t?"1":"")}function yg(e){return vr(e)==="1"}function xO({checked:e,note:t,onChange:a}){return s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("鉴权")}),s.jsx("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:s.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2.5",children:[s.jsx(Mr,{checked:e,"aria-label":r("该上游无需鉴权"),onCheckedChange:o=>a(o===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(不发送鉴权头)")})]})}),s.jsx("span",{className:"hint",children:t})]})}function iG({mode:e,providerHint:t,presetKey:a,showToken:o,version:c}){const d=dO(),[f,p]=x.useState(()=>vr(xu)||d[0].value),[h,b]=x.useState(""),[y,v]=x.useState(""),[w,j]=x.useState(()=>vr(yu)),[S,N]=x.useState(()=>yg(Df)),[k,T]=x.useState(()=>yg(Pf)),D=x.useMemo(()=>qw(),[c]),A=(t&&D.some(B=>B.id===t)?t:"")||(D.some(B=>B.id===w)?w:D[0]?.id||""),R=D.find(B=>B.id===A)?.name||r("该提供商");x.useEffect(()=>{So(yu,A)},[A]),x.useEffect(()=>{if(!a)return;const B=gt().wbPresetProviders?.presetOf?.(a);if(!B)return;const z=B.account?.noAuth===!0;if(e!=="create"){T(z),zf(Pf,z);return}So(bu,B.name||""),So(vu,B.baseUrl||""),B.protocol&&(p(B.protocol),So(xu,B.protocol)),N(z),zf(Df,z),b(B.hint||""),v(B.placeholder||"")},[e,a,t,o]);const I=f==="anthropic",P=h||(I?tG:eG),O=y||(I?sG:nG),_=e==="create"?fO(a):"",L=e==="existing"?String(D.find(B=>B.id===A)?.balanceScheme||""):"",H=(B,z)=>Q=>{z(Q),zf(B,Q)};return s.jsxs(s.Fragment,{children:[s.jsxs(zn,{hidden:e!=="create",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("上游信息")}),s.jsx("span",{children:r("创建这个提供商,并同时建立它的第一个账号。")})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:bu,children:[r("名称"),s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:bu,type:"text",maxLength:Wq,"aria-required":"true",placeholder:r("如:智谱 GLM"),...Aa(bu)}),s.jsx("span",{className:"hint",children:r("1~64 个字符,账号列表里按它分组显示")})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:xu,children:r("协议")}),s.jsxs(ft,{value:f,onValueChange:B=>{const z=String(B);p(z),So(xu,z),b("")},children:[s.jsx(mt,{id:xu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:d.find(B=>B.value===f)?.label||f})}),s.jsx(ht,{children:d.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:vu,children:["Base URL",s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:vu,type:"text","aria-required":"true",placeholder:O,...Aa(vu)}),s.jsx("span",{className:"hint",id:"custom-baseurl-hint",children:P})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Mf,children:"API Key"}),s.jsx($e,{id:Mf,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:S,...Aa(Mf)}),s.jsx("span",{className:"hint",children:r(S?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(xO,{checked:S,note:r(S?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用"),onChange:H(Df,N)}),s.jsx(hO,{scheme:_,prefix:Gw})]})]}),s.jsxs(zn,{hidden:e!=="existing",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("账号信息")}),s.jsxs("span",{children:[r("添加到 "),s.jsx("b",{children:R}),r(" 同一家可以放多把 key,按优先级轮换。")]})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:yu,children:r("提供商")}),s.jsxs(ft,{value:A,onValueChange:B=>j(String(B)),children:[s.jsx(mt,{id:yu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:R})}),s.jsx(ht,{children:D.map(B=>s.jsx(qe,{value:B.id,children:B.name||B.id},B.id))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:If,children:"API Key"}),s.jsx($e,{id:If,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:k,...Aa(If)}),s.jsx("span",{className:"hint",children:r(k?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(xO,{checked:k,note:r(k?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走"),onChange:H(Pf,T)}),s.jsx(hO,{scheme:L,prefix:Kw}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:_f,children:r("备注名")}),s.jsx($e,{id:_f,type:"text",maxLength:Jq,placeholder:r("可选"),...Aa(_f)}),s.jsx("span",{className:"hint",children:r("留空则用提供商名称")})]})]})]})]})}function bO(e,t){const a=pu(t);Jn(r("添加失败:{reason}",{reason:a}),"err"),e.setHint(a)}async function cG(e){const t=vr(bu),a=vr(xu)||dO()[0].value,o=vr(vu),c=vr(Mf),d=yg(Df);if(!t){Jn(r("请填写名称"),"err");return}if(!o){Jn(r("请填写 Base URL"),"err");return}await Yw(e.setBusy,async()=>{const f={name:t,protocol:a,baseUrl:o},p=e.presetKey?gt().wbPresetProviders?.presetOf?.(e.presetKey):null,h=p?.quirks||{};h.urlSuffix&&(f.urlSuffix=h.urlSuffix),h.headers&&Object.keys(h.headers).length&&(f.headers={...h.headers}),h.anthropicToolType&&(f.anthropicToolType=h.anthropicToolType),p?.clientEmulation&&(f.clientEmulation=p.clientEmulation);const b=fO(e.presetKey);b&&(f.balanceScheme=b);const y=pO(b,Gw);y&&(f.balanceQuery=y),d?f.noAuth=!0:c&&(f.apiKey=c),e.setHint("");try{const v=await gt().wbProviders?.customRequest?.("POST","/api/custom-providers",f);Mw([bu,vu,Mf]),mO(b,Gw),zf(Df,!1);const w=v?.provider?.name||t;await gO(r("✅ 已创建自定义提供商「{name}」并添加账号",{name:w}))}catch(v){bO(e,v)}})}async function uG(e){const t=vr(yu);if(!t){Jn(r("请先选择一个自定义提供商"),"err");return}const a=vr(If),o=yg(Pf),c=vr(_f),d=String(qw().find(f=>f.id===t)?.balanceScheme||"");await Yw(e.setBusy,async()=>{const f={provider:t};o?f.noAuth=!0:a&&(f.apiKey=a),c&&(f.name=c);const p=pO(d,Kw);p&&(f.balanceQuery=p),e.setHint("");try{const h=await gt().wbProviders?.customRequest?.("POST","/api/accounts",f);Mw([If,_f]),mO(d,Kw),zf(Pf,!1);const b=h?.account?.name||qw().find(y=>y.id===t)?.name||"";await gO(r("✅ {label}账号已添加{name}",{label:"",name:b?`:${b}`:""}))}catch(h){bO(e,h)}})}async function dG(){const e=vr(yu);if(!e){Jn(r("请先选择一个自定义提供商"),"err");return}const t=gt().wbCustomProvidersUi?.remove;if(typeof t!="function"){Jn(r("删除功能不可用(脚本未就绪)"),"err");return}await Yw(()=>{},async()=>{await t(e)&>().wbAddAccountModal?.close?.()})}function fG({mode:e,presetKey:t}){const[a,o]=x.useState(!1),[c,d]=x.useState(""),f={presetKey:t,setBusy:o,setHint:d};return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`add-foot-hint${c?" err":""}`,id:"add-form-foot-hint",children:c}),s.jsxs("span",{className:"add-foot-actions",id:"add-form-foot-actions",children:[e==="existing"?s.jsx(se,{id:oG,variant:"destructive",title:r("级联删除名下全部账号,不可恢复"),onClick:()=>{dG()},children:r("删除此提供商")}):null,s.jsx(se,{id:aG,hidden:e!=="create",disabled:a,onClick:()=>{cG(f)},children:r(a&&e==="create"?"提交中…":"创建并添加账号")}),s.jsx(se,{id:lG,hidden:e!=="existing",disabled:a,onClick:()=>{uG(f)},children:r(a&&e==="existing"?"提交中…":"添加账号")})]})]})}const Xw={step:"pick",accountType:zw,search:"",provider:Bi,providerHint:"",presetKey:"",showToken:0},vO=()=>gt().wbProviders?.customList?.()||[];function pG({onClose:e,onReady:t}){const[a,o]=x.useState(Xw),[c,d]=x.useState(0),f=x.useCallback(()=>d(C=>C+1),[]),p=x.useCallback(()=>{o(Xw);const C=gt().wbProviders;(C?.all?.()||[]).length||C?.load?.().then(f),C?.refreshCustom?.().then(f)},[f]),h=x.useCallback(()=>{p(),o({...Xw,step:"form",provider:gu})},[p]);x.useEffect(()=>(t({reset:p,openNewCustomForm:h}),()=>t(null)),[t,p,h]),x.useEffect(()=>{gt().wbWebLogin?.refresh?.()},[]),x.useEffect(()=>{gt().wbProviders?.refreshCustom?.().then(f)},[f]),x.useEffect(()=>{a.step!=="form"||a.provider!==gu||gt().wbProviders?.refreshCustom?.().then(f)},[a.step,a.provider,a.showToken,f]);const b=G8(a.provider),y=a.provider===gu,v=a.provider===Bi||y||!!b,w=a.providerHint?"existing":"create",j=a.providerHint?vO().find(C=>C.id===a.providerHint)?.name||"":a.presetKey&>().wbPresetProviders?.presetOf?.(a.presetKey)?.name||"",S=a.provider===Bi?Dw:gt().wbProviders?.labelOf?.(a.provider)||a.provider,N=y?a.providerHint||a.presetKey?r("登录 / 添加 {name} 账号",{name:j||r("自定义提供商")}):r("新建自定义提供商"):r("登录 / 添加 {name} 账号",{name:S});function k(C){if(!C)return;const A={step:"form",showToken:a.showToken+1};if(C===Hw)o(R=>({...R,...A,provider:gu,providerHint:"",presetKey:""}));else if(C.startsWith(Rf)){const R=C.slice(Rf.length),I=zR(gt().wbPresetProviders?.presetOf?.(R));o(P=>({...P,...A,provider:gu,providerHint:I?.id||"",presetKey:R}))}else vO().some(R=>R.id===C)?o(R=>({...R,...A,provider:gu,providerHint:C,presetKey:""})):o(R=>({...R,...A,provider:C,providerHint:"",presetKey:""}))}const T=()=>o(C=>({...C,step:"pick"})),D=a.accountType===iq;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||e()},children:s.jsxs(Zt,{className:"w-[min(1100px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加账号")})}),s.jsx(Bt,{children:s.jsx(gq,{accountType:a.accountType,onAccountTypeChange:C=>o(A=>({...A,accountType:C})),search:a.search,onSearchChange:C=>o(A=>({...A,search:C})),onPick:k,version:c,importing:D,importPanel:void 0})}),null,s.jsx(Qt,{open:a.step==="form",onOpenChange:C=>{C||T()},children:s.jsxs(Zt,{keepMounted:!0,overlayForceRender:!0,className:"w-[min(620px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:N})}),s.jsxs(Bt,{children:[s.jsx(oq,{active:a.provider===Bi}),$R.map(C=>s.jsx(sq,{config:C,active:a.provider===C.provider},C.provider)),s.jsx("div",{className:"add-provider-block",style:y?void 0:{display:"none"},children:s.jsx(iG,{mode:w,providerHint:a.providerHint,presetKey:a.presetKey,showToken:a.showToken,version:c})}),v?null:s.jsx("div",{className:"add-provider-block",children:s.jsxs(zn,{children:[s.jsx("h3",{children:r("该提供商账号添加功能即将上线")}),s.jsx("p",{children:r("「{name}」的账号添加功能还在开发中,敬请期待。",{name:S})})]})})]}),y?s.jsx(nn,{children:s.jsx(fG,{mode:w,presetKey:a.presetKey})}):null]})})]})})}let ko=null,wu=null,Hi=null,wg=null;function mG(){ko&&(ko.unmount(),ko=null),wu&&(wu.remove(),wu=null),Hi=null}function yO(){wu=document.createElement("div"),document.body.append(wu),ko=vn.createRoot(wu),ko.render(s.jsx(pG,{onClose:wO,onReady:e=>{if(Hi=e,!e)return;const t=wg;wg=null,t?.()}}))}function wO(){gt().wbWebLogin?.cancelIfActive?.(""),gt().wbAutoclawOauth?.cancel?.(),mG()}function Qw(){if(ko){Hi?.reset();return}wg=()=>Hi?.reset(),yO()}function hG(){if(ko){Hi?.openNewCustomForm();return}wg=()=>Hi?.openNewCustomForm(),yO()}for(const e of["btn-add-account","btn-add-account-2"])document.getElementById(e)?.addEventListener("click",Qw);const jO=window;jO.wbAddAccountModal={open:Qw,close:wO},jO.wbAccountAddForms={syncAddProvider:()=>{ko?Hi?.reset():Qw()},openNewCustomForm:hG};const gG=3065;let ju=null;function xG(){return window.workbuddyDesktop}const SO="same-origin";async function Zw(e=!1){if(ju&&!e)return ju;const t=xG();if(t?.platform==="web"){const o=typeof window>"u"?"":window.location?.origin;if(o&&o!=="null")return ju=o,ju}let a=0;try{const o=await t?.getBackendStatus?.(),c=Number(o?.port);Number.isFinite(c)&&c>0&&(a=c)}catch{}return a>0?(ju=`http://127.0.0.1:${a}`,ju):`http://127.0.0.1:${gG}`}async function bG(){const t=await window.workbuddyDesktop?.getModelManage?.(),a=Array.isArray(t?.models)?t.models:[],o=Array.isArray(t?.mappings)?t.mappings:[],c=new Set,d=[],f=new Set;for(const p of a){if(p.enabled!==!0)continue;const h=String(p.provider??""),b=String(p.id??"");!h||!b||(c.add(`${h}${b}`),f.has(b)||(f.add(b),d.push(b)))}for(const p of o){if(p.enabled!==!0||p.isDefault===!0)continue;const h=String(p.provider??""),b=String(p.target??""),y=String(p.alias??"");(!y||!f.has(y)&&c.has(`${h}${b}`))&&(f.add(y),d.push(y))}return d}function NO(e,t){if(typeof e=="string"&&e.trim())return e.trim();if(e&&typeof e=="object"){const a=e.message;if(typeof a=="string"&&a.trim())return a.trim();try{return JSON.stringify(e)}catch{}}return`HTTP ${t}`}function kO(e,t){const a=e instanceof Error?e.message:String(e);return new Error(`连接网关失败(${t}):${a}`)}async function CO(e,t,a){const o=await Zw();let c;try{c=await fetch(o+t,{method:e,headers:a===void 0?void 0:{"Content-Type":"application/json"},body:a===void 0?void 0:JSON.stringify(a),credentials:SO})}catch(b){throw kO(b,o)}const d=await c.text();let f=null;try{f=d?JSON.parse(d):null}catch{f=null}const p=f;if(!c.ok||p?.success===!1){const b=p?.error??f?.error,y=NO(b,c.status);throw c.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${y}`):new Error(y)}return p&&typeof p=="object"&&"data"in p?p.data:f}async function vG(){const t=(await CO("GET","/api/assistant/config"))?.config;if(!t||typeof t!="object")throw new Error("配置响应不完整");const a=typeof t.model=="string"?t.model:t.model?.id;return{model:typeof a=="string"&&a.trim()?a:null,systemPromptEnabled:t.systemPromptEnabled!==!1,systemPrompt:typeof t.systemPrompt=="string"?t.systemPrompt:"",tools:t.tools&&typeof t.tools=="object"?t.tools:{}}}async function yG(e){const t=await CO("PUT","/api/assistant/config",{config:e});return t?.config&&typeof t.config=="object"?t.config:e}function wG(e){return e.map(t=>{if(t.role==="tool")return{role:"tool",tool_call_id:t.toolCallId,content:t.content};if(t.role==="assistant"){const a={role:"assistant",content:t.content||""};return t.toolCalls?.length&&(a.tool_calls=t.toolCalls.map(o=>({id:o.id,type:"function",function:{name:o.name,arguments:o.arguments}}))),a}return{role:"user",content:t.content}})}async function jG(e){const t=await Zw(),a={messages:wG(e.messages)};e.tools.length&&(a.tools=e.tools);let o;try{o=await fetch(t+"/api/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),signal:e.signal,credentials:SO})}catch(v){throw e.signal?.aborted?v:kO(v,t)}if(!o.ok||!o.body){const v=await o.text().catch(()=>"");let w=null;try{w=v?JSON.parse(v):null}catch{}const j=w?.error,S=NO(j,o.status);throw o.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${S}`):new Error(S)}const c=o.body.getReader(),d=new TextDecoder;let f="";const p=new Map;let h="";const b=v=>{for(const w of v.split(` +`)})}function Rq(e){if(e===void 0)return{text:r("未查询"),kind:"muted",title:r("尚未查询该账号的余额")};if(e===null)return{text:r("查询中…"),kind:"muted",title:r("正在查询")};const t=uu(e);if(t)return t.notConfigured?{text:r("未配置"),kind:"muted",title:r("{message}(去该账号的「设置」里填上查询凭证即可)",{message:t.message})}:{text:r("查询失败"),kind:"bad",title:t.message};if(typeof e!="object"||e===null)return{text:r("无数据"),kind:"muted",title:String(e)};const a=e;if(Object.prototype.hasOwnProperty.call(a,"totalLeft")){const o=a.unlimited?"∞":yr(a.totalLeft);return{text:r("可用 {total}",{total:o}),kind:"ok",title:r("总剩余 {total} · 套餐 {plan} · 奖励 {bonus}",{total:o,plan:yr(a.planLeft),bonus:yr(a.bonusLeft)})}}if(Object.prototype.hasOwnProperty.call(a,"available")||Array.isArray(a.wallets)){const o=String(a.unit||r("积分")),c=Array.isArray(a.wallets)?a.wallets:[],d=c.map(w=>`${w?.displayName||w?.type||r("明细")} ${w?.balanceView?String(w.balanceView):yr(w?.balance)}`).join(" · "),f=XR(a.subscription),p=[];if(c.length===0&&Array.isArray(a.plans)&&a.plans.length>0){const w=QR(a);p.push(w&&ZR(w)?r("读数里没有额度桶,这里按套餐权益里的已用 / 总量显示(上游给的数)"):r("上游的余额读数里没有这个套餐的额度桶,剩余量读不到;余额列显示的是套餐发放的权益额度,不是剩余量"))}String(a.walletsFrom||"")==="monitor"&&p.push(r("额度窗口读数来自开放平台监控通道(套餐 JWT 那条通道没有额度桶):读的是每 N 小时 / 每周窗口的剩余比例"));const h=a.available==null?c.find(w=>w?.balance!=null):void 0,b=a.availableView?String(a.availableView):h?r("可用 {value} {unit}",{value:yr(h.balance),unit:String(h.unit||o)}):r("可用 {value} {unit}",{value:yr(a.available),unit:o}),y=[a.statisticsError?r("订阅统计未读到:{error}",{error:String(a.statisticsError)}):"",a.benefitError?r("福利网关未读到:{error}",{error:String(a.benefitError)}):""].filter(Boolean),v=a.benefitAbsent?[r("该账号没有福利模型额度(福利按活动下发,不是每个账号都有)")]:[];return{text:b+(y.length?" ⚠":""),kind:y.length?"warn":"ok",title:[b,d,f,...p,...v,...y].filter(Boolean).join(" · ")}}return{text:r("无数据"),kind:"muted",title:r("未返回可识别的余额数据")}}function QR(e){const t=Array.isArray(e.plans)?e.plans:[],a=o=>String(o?.state||"");return t.find(o=>a(o)==="active")||t.find(o=>a(o)==="pending")||t[0]||null}function Oq(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];let a=null;for(const o of t){const c=Number(o?.grantUnits);if(!Number.isFinite(c)||c<=0)continue;const d=String(o?.unitType||"").trim();(!a||c>a.units)&&(a={units:c,unit:d})}return a}function ZR(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];for(const a of t){const o=Dr(a?.totalUnits);if(o===null||o<=0)continue;const c=Dr(a?.usedUnits),d=Dr(a?.remainingUnits),f=c===null?d===null?null:Math.max(0,o-d):c;if(f!==null)return{used:f,total:o,unit:String(a?.unitType||"").trim()}}return null}function Mq(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,a=Array.isArray(t.wallets)?t.wallets:[];let o=null;for(const p of a){const h=Number(p?.total);!Number.isFinite(h)||h<=0||(!o||h>Number(o.total))&&(o=p)}const c=t.subscription&&typeof t.subscription=="object"?t.subscription:{};if(!o){let p=null;for(const w of a){const j=Dr(w?.remainingPercent);j!==null&&(!p||j0,N=S?Math.max(0,Math.min(100,y/v*100)):null;c.push({name:b,view:S?r("剩 {remaining} / {total}",{remaining:yr(y),total:yr(v)}):r("剩 {remaining}",{remaining:yr(y)}),tone:y<=0?"muted":N!==null&&N<20?"warn":"ok",percent:N,over:!1,title:S?void 0:r("上游未给总量,画不出剩余比例")});continue}if(j!==null||Dr(h.allowanceTokens)!==null){const S=Dr(h.usedTokens)??0,N=Dr(h.allowanceTokens),k=N!==null&&N>1,T=k&&S>N,D=h.unlimited===!0,C=k?Math.max(0,Math.min(100,(1-S/N)*100)):null,A=D?r("无上限 · 已用 {used}",{used:No(S)}):k?r("剩 {remaining} / {total}",{remaining:No(Math.max(0,N-S)),total:No(N)}):S>0?r("已用 {used}",{used:No(S)}):r("未使用");d.push({name:Iq(b),view:A,tone:T?"bad":!k&&!D?"muted":C!==null&&C<20?"warn":"ok",percent:C,over:T,title:[w,D?r("无上限按日计(上游到达上限后仍继续计数,超额如实显示)"):null].filter(Boolean).join(" · ")});continue}d.push({name:b,view:w,tone:"muted",percent:null,over:!1,title:w})}const f=t.subscription&&typeof t.subscription=="object"?t.subscription:{},p=[t.statisticsError?r("订阅统计未读到:{error}",{error:String(t.statisticsError)}):"",t.benefitError?r("福利网关未读到:{error}",{error:String(t.benefitError)}):""].filter(Boolean);return{credit:c,token:d,total:Dr(t.available),unit:o,plan:s$(f.planName),free:zA(f.planName),resetDate:String(f.resetDate||""),missing:p,benefitAbsent:t.benefitAbsent===!0}}function _q(e){const t=Al(e);let a=null;for(const v of YF(e)){if(v.enabled===!1)continue;const w=xf(v,t);if(!w)continue;const j=v.threshold>0?w.used/v.threshold:0;if(j>=1){a={rule:v,reading:w,ratio:j};break}(!a||j>a.ratio)&&(a={rule:v,reading:w,ratio:j})}if(!a)return null;const{rule:o,reading:c}=a,d=c.used>=o.threshold,f=cw(o),p=d?"":` · ${$h(f.remainingMs,f.daily)}`,h=f.daily?r("今日已用"):r("周期 Token"),b=o.reset==="daily"?r("今天(本地 0 点重置)"):r("{period}窗口",{period:OA(o.period??0)}),y=r("限制器:{window}已用 {used} / {threshold} Token",{window:b,used:Math.round(c.used).toLocaleString("en-US"),threshold:Math.round(o.threshold).toLocaleString("en-US")})+(d?r(",已达到上限"):r(",{countdown}重置",{countdown:$h(f.remainingMs,f.daily)}));return s.jsxs("span",{className:"usage-token-sub",title:y,children:[h," ",s.jsx("span",{className:d?"hit":void 0,children:Tl(c.used)})," ","/ ",Tl(o.threshold),p]})}function Lq({account:e}){if(!Ta(e))return s.jsx("span",{className:"muted",title:r("该提供商没有余额查询"),children:"—"});const t=Za(e),a=Rq(t),o=Fh(e,t)?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足 · 已跳过")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额 · 已跳过")}):null,c=_q(e),d=a.kind==="ok"||a.kind==="warn"?Eq(t):[],f=d.length?s.jsx(ze,{variant:"warning",shape:"tag",title:Aq(d),children:r("待生效 {n} 份",{n:d.length})}):null,p=a.kind==="ok"||a.kind==="warn"?PF(t):[],h=LA(e)&&p.length?{rows:p,subscriptionLine:Tq(t),kind:a.kind,title:a.title}:null,b=a.kind==="ok"||a.kind==="warn"?Dq(t):[];if(b.length)return s.jsxs("span",{className:"usage-cell",title:a.title,children:[b.map(w=>s.jsx(WR,{row:w},w.name)),o,f,c]});if(n$(e)){const j=a.kind==="ok"||a.kind==="warn"?Pq(t):null;return j?s.jsx(zq,{summary:a,detail:j,blockedBadge:o,tokenSub:c}):s.jsxs("span",{className:"usage-sum-wrap",children:[s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]})}const y=a.kind==="ok"||a.kind==="warn"?Mq(t):null;if(!y)return s.jsxs("span",{className:"usage-sum-wrap",children:[h?s.jsx(yA,{variant:"sum",...h,children:a.text}):s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]});const v=s.jsxs(s.Fragment,{children:[y.percent!==null?s.jsx(tf,{value:y.percent,className:"usage-pool-bar"}):null,s.jsx("span",{className:`usage-pool-view ${a.kind}`,children:y.text})]});return s.jsxs("span",{className:"usage-pool",title:a.title,children:[y.planName?s.jsx("span",{className:"usage-pool-name",children:y.planName}):null,h?s.jsx(yA,{variant:"pool",...h,children:v}):s.jsx("span",{className:"usage-pool-line",children:v}),o,f,c]})}function zq({summary:e,detail:t,blockedBadge:a,tokenSub:o}){const[c,d]=x.useState(!1),f=e.kind==="ok"||e.kind==="warn";return s.jsxs("span",{className:c?"usage-cell open":"usage-cell",children:[s.jsxs("span",{className:"usage-plan",children:[t.plan?s.jsx("span",{className:`plan-chip${t.free?" free":""}`,children:t.plan}):null,t.resetDate?s.jsx("span",{className:"plan-sub",title:r("套餐积分的重置日期"),children:r("重置 {date}",{date:t.resetDate})}):null]}),s.jsxs(hf,{open:c,onOpenChange:d,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:`usage-toggle ${e.kind}`,title:e.title,"aria-label":r("积分明细")}),children:[s.jsx("span",{className:"val",children:e.text}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsxs(gf,{align:"end",sideOffset:6,className:"usage-pop w-[288px]",children:[f&&t.missing.length?t.missing.map(p=>s.jsx("div",{className:"usage-pop-missing",title:p,children:p},p)):null,t.credit.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"usage-pop-group",children:r("积分")}),t.credit.map(p=>s.jsx(Bq,{row:p},p.name))]}):null,t.total!==null?s.jsxs("div",{className:"usage-pop-total",children:[s.jsx("span",{className:"k",children:r("可用合计")}),s.jsxs("span",{className:"v",children:[yr(t.total)," ",s.jsx("small",{children:t.unit})]})]}):null,!t.credit.length&&t.total===null?s.jsx("div",{className:"usage-pop-empty",title:r("该账号的额度只有福利 token 池(见余额格那两行),订阅统计没有积分类计量表"),children:r("该账号没有积分类读数(额度只有福利 token 池)")}):null]})]}),t.token.map(p=>s.jsx(WR,{row:p},p.name)),t.benefitAbsent?s.jsxs("span",{className:"usage-flat-line",title:r("福利按限时活动下发,不是每个账号都有 —— 正常状态,不是查询失败"),children:[s.jsx("span",{className:"usage-flat-name",children:r("福利日额度")}),s.jsx("span",{className:"usage-flat-view muted",children:r("无福利额度")})]}):null,a,o]})}function Bq({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.percent!==null?s.jsx("span",{className:`usage-pop-track${e.over?" over":""}`,children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function Hq({account:e,namesHidden:t}){const a=Vh(e),o=ir(kn(e)),c=cu(e)||r("未命名账号"),d=String(e.email||"").trim(),f=String(e.nickname||"").trim(),p=String(e.name||"").trim(),h=j=>t?S$(j):j,b=[d&&d!==c?r("邮箱 {email}",{email:h(d)}):"",a?`${o.identifier} ${a}`:"",!e.nameCustom&&p&&p!==d&&p!==f?r("备注名 {name}",{name:h(p)}):"",f&&f!==c&&f!==d?r("昵称 {name}",{name:h(f)}):"",bf(e)?r("桌面端实时登录态(凭证每次从客户端登录态文件读取)"):"",e.updatedAt?r("更新于 {time}",{time:Fs(e.updatedAt)}):"",e.source?r("来源 {source}",{source:e.source==="imported"?r("旧数据导入"):r("手动添加")}):""].filter(Boolean),y=d&&d!==c,v=e.proxy?.error,w=b.length?s.jsx(QU,{delay:0,children:s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("div",{className:"acct-name"}),children:s.jsx("span",{className:"name",children:h(c)})}),s.jsxs(_i,{children:[s.jsx(ZU,{}),b.map((j,S)=>s.jsx("div",{children:j},S))]})]})}):s.jsx("div",{className:"acct-name",children:s.jsx("span",{className:"name",children:h(c)})});return s.jsxs(s.Fragment,{children:[w,y?s.jsx("div",{className:"acct-sub",children:s.jsx("span",{className:"acct-email",title:r("账号邮箱"),children:h(d)})}):null,v?s.jsx("div",{className:"acct-note bad",title:r("代理不可用:{error}",{error:v}),children:r("代理不可用:{error}",{error:v})}):null]})}function Uq({account:e}){const t=e.proxy,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=t?.error,d=C$(),f=Array.isArray(d)?d:[];let p="";a==="pool"&&t?.config?.proxyId?p=`${Xa}${t.config.proxyId}`:t&&(p=ng);const h=[{value:"",label:r("直连")}];for(const v of f)h.push({value:`${Xa}${v.id}`,label:au(v)});if(d===null?h.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):f.length||h.push({value:"__hint_pool__",label:T$()?r("代理列表读取失败(重试中)"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),p===ng){const v=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";h.push({value:ng,label:`${v}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!f.some(v=>`${Xa}${v.id}`===p)&&h.push({value:p,label:`${o}${c?r("(不可用)"):""}`});h.push({value:yR,label:r("自定义代理…")});const b=c?r("代理不可用:{error}(转发时会回退直连);选「自定义代理…」去修改",{error:c}):a==="rotate"?r("当前:{label}(每条请求换一个出口);「自定义代理…」打开完整设置",{label:o}):a==="clash"||a==="custom"?r("当前:{label}(未经过代理池 —— 可在「网络代理」页把出口同步进池后来这里改选)",{label:o}):r("当前:{label};选项来自「网络代理」页;「自定义代理…」打开完整设置",{label:t?o:r("直连")}),y=h.find(v=>v.value===p);return s.jsxs(ft,{value:p,onValueChange:v=>{L$(e.id,String(v),p)},children:[s.jsx(mt,{className:Ue("w-full",c&&"border-destructive-bd"),title:b,"aria-label":r("出网代理"),children:s.jsx(pt,{children:y?.label||r("直连")})}),s.jsx(ht,{children:h.map(v=>s.jsx(qe,{value:v.value,disabled:v.disabled,children:v.label},v.value))})]})}function Vq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=Ta(e),d=IA(e);return s.jsxs("div",{className:"acct-actions",children:[d?s.jsx(se,{variant:"outline",size:"xs",title:e$(e)?t$(e):r("查看可领取的套餐与名下已有的套餐(每天一期,领取需过一次人机验证)"),onClick:()=>wR(e.id),children:r("领套餐")}):null,c?s.jsx(se,{variant:"outline",size:"xs",disabled:a,title:r("查询该账号剩余余额(读数显示在余额列)"),onClick:()=>{o(!0),P$(e.id).finally(()=>o(!1))},children:r("余额")}):null,s.jsx(se,{variant:"outline",size:"xs",title:r("备注名 / 启用 / 代理"),onClick:()=>Jh(e.id),children:r("设置")}),s.jsx(Fq,{account:e,atFront:t})]})}function Fq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=cr(e),d=Number(e.maxConcurrent)||0,f="w-full justify-start px-2 font-normal",p=`${f} text-destructive hover:text-destructive`;return s.jsxs(hf,{open:a,onOpenChange:o,children:[s.jsx(Hh,{render:s.jsx(se,{variant:"outline",size:"xs",title:r("更多操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[172px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:p,onClick:()=>{o(!1),xR(e.id,!c)},children:r(c?"禁用":"启用")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,disabled:t,title:r(t?"已在全局队列第一位":"仅将优先级调整到全局第一位,不改变启用状态"),onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("switch",e.id)},children:r("设为首选")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,title:r("在账号设置的「基本」分组里设置该账号同时最多处理的请求数"),onClick:()=>{o(!1),Jh(e.id)},children:r("并发上限:{value}",{value:d>0?d:r("不限")})}),e.hasRefreshToken?s.jsx(se,{variant:"ghost",size:"sm",className:f,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("refresh",e.id)},children:r("刷新 Token")}):null,s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:p,title:bf(e)?r("删除这条账号记录(不会影响客户端自己的登录态;之后可再点「导入桌面端登录态」加回来)"):void 0,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("remove",e.id)},children:r("删除账号")})]})})]})}function $q({account:e,onClose:t,onClear:a}){const o=pw(e),c=s.jsx(se,{variant:"ghost",size:"icon-xs",className:"panel-close",title:r("收起"),onClick:t,children:"✕"});return o.length?s.jsxs("div",{className:"row-panel limit-panel",children:[c,s.jsxs("div",{className:"lp-head",children:[s.jsx("b",{children:cu(e)}),s.jsx("span",{className:"muted",children:r("{n} 个模型限流中 · 记录来自上游 429 / 限额码,到恢复时间自动解除",{n:o.length})}),s.jsx(se,{variant:"outline",size:"xs",title:r("清掉该账号全部模型的限流标记"),onClick:()=>a(""),children:r("全部清除")})]}),o.map(d=>{const f=gw(d.resetAt),p=d.message||(d.status?r("上游返回 {status}",{status:d.status}):"");return s.jsxs("div",{className:"lp-row",children:[s.jsx("span",{className:"lp-model",title:d.model,children:d.model}),s.jsx(ze,{variant:"warning",shape:"tag",children:r("限流中")}),s.jsx("span",{className:"lp-reset",title:r("到恢复时间后自动解除,无需手动操作"),children:f===hw?r("恢复时间未知"):r("{time} 恢复",{time:f})}),s.jsx("span",{className:"lp-reason",title:p,children:p}),s.jsx(se,{variant:"outline",size:"2xs",title:r("清掉本机的限流标记,立刻重新尝试该模型(上游若仍在限流会再次被标记)"),onClick:()=>a(d.model),children:r("清除标记")})]},d.model)})]}):s.jsxs("div",{className:"row-panel limit-panel",children:[r("当前没有限流中的模型。"),c]})}function qq({account:e,colSpan:t,limitsOpen:a,onClear:o}){return a?s.jsx("tr",{className:"acct-panels","data-panels-for":e.id,children:s.jsx("td",{colSpan:t,children:s.jsx($q,{account:e,onClose:()=>nR(e.id,"limits",!1),onClear:c=>o(e.id,c)})})}):null}function Gq({namesHidden:e,allPicked:t,somePicked:a,disabled:o,onToggleAll:c}){const d=s.jsx("span",{className:"col-grip",title:r("拖动调整列宽(双击还原)")});return s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"cell-pick","data-col":"pick",children:s.jsx(Mr,{id:"acct-select-all",checked:t,indeterminate:!t&&a,disabled:o,"aria-label":r("全选当前筛选结果"),title:r("全选 / 取消全选当前筛选结果(与批量栏同一个选择)"),onCheckedChange:f=>c(f)})}),s.jsxs("th",{className:"cell-order","data-col":"order",children:[s.jsx("span",{className:"th-label",title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),children:r("顺序")}),d]}),s.jsxs("th",{className:"cell-account","data-col":"account",children:[s.jsxs("span",{className:"th-label",children:[r("账号"),s.jsx(Kq,{hidden:e})]}),d]}),s.jsxs("th",{className:"cell-proxy","data-col":"proxy",children:[s.jsx("span",{className:"th-label",title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),children:r("代理")}),d]}),s.jsxs("th",{className:"cell-connections","data-col":"connections",children:[s.jsx("span",{className:"th-label",title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),children:r("连接数")}),d]}),s.jsxs("th",{className:"cell-status","data-col":"status",children:[s.jsx("span",{className:"th-label",children:r("状态")}),d]}),s.jsxs("th",{className:"cell-limits","data-col":"limits",children:[s.jsx("span",{className:"th-label",title:r("该账号当前限流中的模型;点徽章看明细"),children:r("限流")}),d]}),s.jsxs("th",{className:"cell-expiry","data-col":"expiry",children:[s.jsx("span",{className:"th-label",children:r("有效期")}),d]}),s.jsxs("th",{className:"cell-usage","data-col":"usage",children:[s.jsx("span",{className:"th-label",children:r("余额")}),d]}),s.jsx("th",{className:"cell-actions","data-col":"actions",children:s.jsx("span",{className:"th-label",children:r("操作")})})]})})}function Kq({hidden:e}){const t=r(e?"显示账号名":"隐藏账号名(名字显示为星号)");return s.jsx("button",{type:"button",className:`name-eye${e?" on":""}`,title:t,"aria-label":t,"aria-pressed":e,onClick:()=>j$(),dangerouslySetInnerHTML:{__html:gg(e?"eyeOff":"eye",13)}})}const JR="dragging",Of=["drop-before","drop-after"];let Wa=null;function eO(e){e.querySelectorAll(`.${Of[0]}, .${Of[1]}`).forEach(t=>{t.classList.remove(...Of)})}function Yq(e,t){if(t==="group"){const o=e.parentElement;return o?[...o.children].filter(c=>c.classList.contains("acct-group")):[]}const a=e.parentElement;return a?[...a.children].filter(o=>o.classList.contains("acct-row")):[]}function tO(e,t){for(let a=0;aa!==e.item);eO(e.container),t.length&&(e.index>=t.length?t[t.length-1].classList.add(Of[1]):t[e.index].classList.add(Of[0]))}function nO(e){if(!Wa)return;if(e.buttons===0){xg(!1);return}const t=Wa.items.filter(o=>o!==Wa.item),a=tO(t,e.clientY);a!==Wa.index&&(Wa.index=a,Xq(Wa))}function xg(e){const t=Wa;t&&(Wa=null,window.removeEventListener("pointermove",nO),window.removeEventListener("pointerup",sO),window.removeEventListener("pointercancel",rO),window.removeEventListener("keydown",aO),document.body.classList.remove("queue-dragging"),t.item.classList.remove(JR),eO(t.container),e&&(t.kind==="group"?Uw?.onDrop({kind:"group",provider:t.provider,index:t.index}):Uw?.onDrop({kind:"row",provider:t.provider,accountId:t.accountId,index:t.index})))}function sO(){xg(!0)}function rO(){xg(!1)}function aO(e){e.key==="Escape"&&xg(!1)}let Uw=null;function Qq(e,t){Uw=t,e&&e.dataset.queueDragBound!=="1"&&(e.dataset.queueDragBound="1",e.addEventListener("pointerdown",a=>{if(a.button!==0||Wa)return;const o=a.target,c=o?.closest?.(".queue-grip"),d=o?.closest?.(".order-grip");if(!c&&!d)return;if(a.preventDefault(),c&&t.isLocked()){t.onLockedAttempt();return}const f=(c??d).closest("tbody.acct-group, tr.acct-row");if(!f)return;const p=c?"group":"row",h=f.dataset.provider||f.closest("tbody.acct-group")?.dataset.provider||"",b=f.dataset.id||"";if(p==="row"&&!b)return;const y=Yq(f,p);if(y.length<2)return;const v=y.filter(w=>w!==f);Wa={kind:p,provider:h,accountId:b,item:f,container:f.parentElement||e,items:y,index:tO(v,a.clientY)},f.classList.add(JR),document.body.classList.add("queue-dragging"),window.addEventListener("pointermove",nO),window.addEventListener("pointerup",sO),window.addEventListener("pointercancel",rO),window.addEventListener("keydown",aO)}))}let bg=null,lO=!1,Vw=0,vg=null,oO="";function iO(){return bg?bg.apply(Cw):Cw}function cO(){window.wbAccountsView?.render?.()}function Zq(){const e=iO(),t=`${vg?"T":"F"}|${e.map(o=>`${o.key}:${o.align}`).join("|")}`;if(t===oO)return;oO=t,Pe().wbColSettings?.syncStaticHead("accounts",vg);const a=[...vg?.querySelectorAll("thead th")||[]];a.forEach((o,c)=>{const d=o.querySelector(".col-grip");d&&(d.style.display=c===a.length-1?"none":"")})}function Wq(){const e=x.useSyncExternalStore(YA,Ws),t=x.useRef(null),[,a]=x.useReducer(B=>B+1,0),o=!!bw(),c=El(),{groups:d,allGroups:f}=d$(Za,Al),p=f$(Za,Al),h=[{value:"all",label:r("全部({n})",{n:c.length})}].concat(XA().map(B=>({value:B.id,label:r("{label}({count})",{label:B.label,count:B.count})}))),b=d.flatMap(B=>B.accounts),y=p$(),v=iO(),w=ig(b.length,"accounts",{defaultSize:"all"}),j=w.paged?w.slice(b):b,S=Xh()||w.paged,N=Xh()?r("清除筛选"):r("把每页调回「全部」");x.useEffect(()=>{E$()}),x.useEffect(()=>{g$()},[e.version]),x.useLayoutEffect(()=>{if(!lO){if(!Pe().wbColSettings?.register){window.clearTimeout(Vw),Vw=window.setTimeout(()=>k(B=>B+1),50);return}lO=!0,bg=Pe().wbColSettings?.register({id:"accounts",label:r("账号表"),columns:Cw.map(B=>({key:B.key,label:B.label,align:B.align,legacyAlign:B.legacyAlign})),mount:()=>document.querySelector("#batch-bar .batch-actions"),onChange:cO})||null,bg&&a();return}Zq()});const[,k]=x.useState(0);x.useEffect(()=>()=>window.clearTimeout(Vw),[]),x.useEffect(()=>{C8(t.current,cO)},[]);const T=b.map(B=>B.id),D=T.length>0&&T.every(B=>e.selected.has(B)),C=T.some(B=>e.selected.has(B)),A=[...e.selected].filter(B=>!T.includes(B)).length,R=e.selected.size>0,I=f.length>0&&f.every(B=>e.collapsed.has(B.provider)),P=new Map;for(const B of d)P.set(B.provider,j.filter(z=>kn(z)===B.provider).map(z=>z.id));const O=x.useRef({displayed:d,all:f,renderedRows:P});x.useEffect(()=>{O.current={displayed:d,all:f,renderedRows:P}});const _=x.useRef({locked:!1,lockReason:"",onDrop:B=>{}}),L=x.useCallback(B=>{const{displayed:z,all:Q}=O.current;if(B.kind==="group"){const Z=Q.findIndex(te=>te.provider===B.provider);if(Z<0)return;const ae=Q[Z],ce=Q.filter((te,Ce)=>Ce!==Z),J=B.indexte.provider===J),ge=J===null||ie<0?ce.length:ie;if(ge===Z)return;const fe=[...ce.slice(0,ge),ae,...ce.slice(ge)].flatMap(te=>te.members.map(Ce=>Ce.id));bR(fe,r("{name} 移到第 {rank} 顺位",{name:ae.label,rank:ge+1}));return}const K=Q.find(Z=>Z.provider===B.provider);if(!K)return;const X=K.members.findIndex(Z=>Z.id===B.accountId);if(X<0)return;const q=K.members[X],$=K.members.filter((Z,ae)=>ae!==X),Y=O.current.renderedRows.get(B.provider)||[],F=B.indexZ.id===F),W=F===null||G<0?$.length:G;if(W===X)return;const le=[...$.slice(0,W),q,...$.slice(W)],U=Q.map(Z=>Z.provider===B.provider?{...Z,members:le}:Z).flatMap(Z=>Z.members.map(ae=>ae.id));bR(U,r("{name} 移到 {group} 组内第 {rank} 位",{name:String(q.name||q.id),group:K.label,rank:W+1}))},[]);x.useEffect(()=>{_.current={locked:S,lockReason:N,onDrop:L}}),x.useEffect(()=>{Qq(t.current,{isLocked:()=>_.current.locked,onLockedAttempt:()=>Le(r("当前视图不能调整组顺位:{reason} 之后再拖动",{reason:_.current.lockReason}),"err"),onDrop:B=>_.current.onDrop(B)})},[]);function H(B,z,Q){switch(B){case"pick":return s.jsx(Mr,{checked:Q.picked,"data-pick":z.id,title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:K=>v$(z.id,K)});case"order":return s.jsx(yq,{account:z,rank:Q.rank});case"account":return s.jsx(Hq,{account:z,namesHidden:e.namesHidden});case"proxy":return s.jsx(Uq,{account:z});case"connections":return s.jsx(Cq,{account:z});case"status":return s.jsx(Sq,{account:z});case"limits":return s.jsx(Nq,{account:z,open:Q.limitsOpen});case"expiry":return s.jsx(kq,{account:z});case"usage":return s.jsx(Lq,{account:z});case"actions":return s.jsx(Vq,{account:z,atFront:Q.seat.position<=1});default:return null}}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel account-table",children:[s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"group","data-provider-group":"1",children:[s.jsx("span",{className:"label",children:r("提供商")}),s.jsxs(ft,{value:e.filter.provider,onValueChange:B=>h$(String(B)),children:[s.jsx(mt,{className:"max-w-none min-w-0 w-full min-[768px]:max-w-[200px] min-[768px]:min-w-[130px] min-[768px]:w-auto","aria-label":r("按提供商筛选账号"),children:s.jsx(pt,{children:h.find(B=>B.value===e.filter.provider)?.label||r("全部")})}),s.jsx(ht,{children:h.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsx("div",{className:"divider","data-provider-divider":"1"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("搜索")}),s.jsx($e,{className:"acct-search",type:"search",value:e.filter.q,placeholder:r("账号名 / 邮箱 / 备注"),"aria-label":r("搜索账号"),onChange:B=>m$(B.currentTarget.value)})]}),s.jsx("div",{className:"divider"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("状态")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.enabledAll??0},{value:"enabled",label:r("启用"),count:p.enabled??0},{value:"disabled",label:r("禁用"),count:p.disabled??0}],value:e.filter.enabled,onValueChange:B=>QA("enabled",B),"aria-label":r("启用状态")})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("限额")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.limitAll??0},{value:"normal",label:r("正常"),count:p.normal??0,disabled:e.filter.enabled==="disabled"},{value:"limited",label:r("已限流"),count:p.limited??0,disabled:e.filter.enabled==="disabled"}],value:e.filter.limit,onValueChange:B=>QA("limit",B),"aria-label":r("限额状态")})]}),s.jsxs("div",{className:"actions",children:[s.jsx(se,{id:"btn-fold-groups",variant:"outline",disabled:!f.length,title:r(I?"展开全部分组":"折叠全部分组(只留组头)"),onClick:()=>x$(f.map(B=>B.provider),!I),children:r(I?"展开全部":"折叠全部")}),s.jsx(se,{id:"btn-add-account-2",variant:"default",title:r("登录 / 导入一个新账号"),onClick:()=>{Pe().wbAddAccountModal?.open?.(),Pe().wbAccountAddForms?.syncAddProvider?.()},children:r("添加账号")}),s.jsx(se,{id:"btn-query-usage",variant:"outline",disabled:e.usageBusy||!c.some(Ta),title:r("查询全部账号的余额(含已禁用账号 —— 禁用只表示不参与转发)"),onClick:()=>{hR()},children:e.usageBusy?r("查询中…"):r("查询余额")})]})]}),s.jsxs("div",{className:Ue("batch-bar",R&&"active"),id:"batch-bar",children:[s.jsxs("label",{className:"batch-select-all",children:[s.jsx(Mr,{id:"batch-select-all",checked:D,indeterminate:!D&&C,disabled:!T.length,"aria-label":r("全选当前筛选结果"),onCheckedChange:B=>eR(T,B)}),s.jsx("span",{id:"batch-select-label",children:T.length?r("全选当前筛选结果({n} 个)",{n:T.length}):r("没有可全选的账号")})]}),s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{id:"batch-count",children:e.selected.size})," ",r("个 · 共")," ",s.jsx("b",{id:"accounts-count",children:c.length})," ",r("个")]}),s.jsx("span",{className:"batch-summary",id:"accounts-group-summary",children:d.length?r("{groups} 家 · 显示 {rows} 行",{groups:d.length,rows:T.length}):""}),S?s.jsx("span",{className:"batch-hidden",title:r("筛选 / 搜索 / 分页生效时组顺位不可拖动(别家的组整组不可见,落点没法定位)"),children:r("组顺位已锁定")}):null,Xh()?s.jsx(se,{id:"btn-clear-filter",variant:"ghost",size:"xs",title:r("清空搜索与三个筛选档位,回到全部账号"),onClick:()=>ZA(),children:r("清除筛选")}):null,A?s.jsx("span",{className:"batch-hidden",id:"batch-hidden-hint",children:r("另有 {n} 个已勾选账号被当前筛选隐藏,仍会参与操作",{n:A})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{id:"btn-batch-open",variant:"outline",disabled:!R,onClick:()=>yw([...e.selected],"enable"),children:r("批量操作")}),s.jsx(se,{id:"btn-batch-clear",variant:"outline",disabled:!R,onClick:()=>y$(),children:r("取消选择")})]})]}),s.jsx("div",{className:"acct-scroll",id:"account-list",ref:t,children:o?c.length?b.length?s.jsxs("table",{className:"acct-table",ref:Jq,style:{minWidth:`${N8(v.map(B=>B.key))}px`},children:[s.jsx(eG,{}),s.jsx(Gq,{namesHidden:e.namesHidden,allPicked:D,somePicked:C,disabled:!T.length,onToggleAll:B=>eR(T,B)}),d.map(B=>{const z=e.collapsed.has(B.provider),Q=j.filter(K=>kn(K)===B.provider);return s.jsxs("tbody",{className:"acct-group","data-provider":B.provider,children:[s.jsx(jq,{group:B,collapsed:z,colSpan:v.length}),z?null:Q.map(K=>{const X=B.members.findIndex($=>$.id===K.id)+1,q=z$(K,y,X>0?X:1);return s.jsxs(x.Fragment,{children:[s.jsx("tr",{className:Ue("acct-row",!cr(K)&&"disabled",q.picked&&"selected"),"data-id":K.id,"data-provider":B.provider,"data-desktop":bf(K)?"1":void 0,children:v.map($=>s.jsx("td",{className:`cell-${$.key} ta-${$.align}`,children:H($.key,K,q)},$.key))}),s.jsx(qq,{account:K,colSpan:v.length,limitsOpen:tR(K.id,"limits"),onClear:($,Y)=>{_$($,Y)}})]},K.id)})]},B.provider)})]}):s.jsxs("div",{className:"empty",children:[r("当前筛选条件下没有账号"),Xh()?s.jsx("button",{type:"button",className:"link-btn",onClick:()=>ZA(),children:r("清除筛选")}):null]}):s.jsx("div",{className:"empty",children:r("暂无账号,请点击右上角「添加账号」")}):s.jsxs("div",{className:"empty",children:[s.jsx("span",{className:"spinner"}),r("正在加载…")]})}),s.jsx(Li,{total:b.length,range:w.paged?{start:w.rangeStart,end:w.rangeEnd}:null,page:w.page,pageCount:w.pageCount,size:w.size,onSizeChange:w.setSize,onPageChange:w.goto})]}),s.jsx(g8,{})]})}function Jq(e){vg=e}function eG(){const e=S8(),t=a=>s.jsx("col",{"data-col":a,style:e[a]?{width:`${e[a]}px`}:void 0},a);return s.jsxs("colgroup",{children:[t("pick"),t("order"),t("account"),t("proxy"),t("connections"),t("status"),t("limits"),t("expiry"),t("usage"),t("actions")]})}const uO='.page[data-page="accounts"]';let Fw=null;function dO(){if(Fw)return;const e=document.querySelector(uO);e&&(e.replaceChildren(),Fw=vn.createRoot(e),Cs.flushSync(()=>{Fw.render(s.jsx(Wq,{}))}))}H$(),O$(),document.querySelector(uO)?dO():document.addEventListener("DOMContentLoaded",dO,{once:!0});const tG=64,nG=100,sG=r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),rG=r("Anthropic 协议填根地址,不要带 /v1"),aG="https://open.bigmodel.cn/api/paas/v4",lG="https://api.anthropic.com",oG=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],xu="custom-protocol-select",bu="custom-name-input",vu="custom-baseurl-input",Mf="custom-apikey-input",Df="custom-noauth-check",yu="custom-existing-select",If="custom-existing-apikey-input",Pf="custom-existing-noauth-check",_f="custom-existing-name-input",iG="custom-create-button",cG="custom-existing-button",uG="custom-existing-remove";let $w=!1;const fO=()=>gt().wbProviders?.PROTOCOL_OPTIONS||oG,qw=()=>gt().wbProviders?.customList?.()||[],Gw="custom-balance",Kw="custom-existing-balance",Lf=(e,t)=>`${e}-${t}-input`;function pO(e){if(!e)return"";const t=gt().wbPresetProviders?.presetOf?.(e);return String(t?.balance?.scheme||"")}function mO(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=vr(Lf(t,c.key));d&&(o[c.key]=d)}return Object.keys(o).length?o:null}function hO(e,t){const a=kf(e);if(a)for(const o of a.fields)So(Lf(t,o.key),"")}function gO({scheme:e,prefix:t}){const a=kf(e);return a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("余额查询")}),s.jsxs("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:[s.jsx("span",{className:"text-xs text-subtle",children:r("方案:{label}",{label:a.label})}),s.jsx("span",{className:"ml-1.5 text-xs text-subtle",children:a.endpoint})]}),s.jsx("span",{className:"hint",children:a.note})]}),a.fields.map(o=>s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Lf(t,o.key),children:o.label}),s.jsx($e,{id:Lf(t,o.key),type:o.secret?"password":"text",autoComplete:o.secret?"new-password":"off",placeholder:o.placeholder,...Aa(Lf(t,o.key))}),s.jsx("span",{className:"hint",children:o.hint})]},o.key))]}):null}async function Yw(e,t){if(!$w){$w=!0,e(!0);try{await t()}finally{$w=!1,e(!1)}}}async function xO(e){gt().wbAddAccountModal?.close?.(),gt().wbProviders?.refreshCustom?.(),await gt().wbApp?.refresh?.(),Jn(e)}function zf(e,t){So(e,t?"1":"")}function yg(e){return vr(e)==="1"}function bO({checked:e,note:t,onChange:a}){return s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("鉴权")}),s.jsx("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:s.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2.5",children:[s.jsx(Mr,{checked:e,"aria-label":r("该上游无需鉴权"),onCheckedChange:o=>a(o===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(不发送鉴权头)")})]})}),s.jsx("span",{className:"hint",children:t})]})}function dG({mode:e,providerHint:t,presetKey:a,showToken:o,version:c}){const d=fO(),[f,p]=x.useState(()=>vr(xu)||d[0].value),[h,b]=x.useState(""),[y,v]=x.useState(""),[w,j]=x.useState(()=>vr(yu)),[S,N]=x.useState(()=>yg(Df)),[k,T]=x.useState(()=>yg(Pf)),D=x.useMemo(()=>qw(),[c]),A=(t&&D.some(B=>B.id===t)?t:"")||(D.some(B=>B.id===w)?w:D[0]?.id||""),R=D.find(B=>B.id===A)?.name||r("该提供商");x.useEffect(()=>{So(yu,A)},[A]),x.useEffect(()=>{if(!a)return;const B=gt().wbPresetProviders?.presetOf?.(a);if(!B)return;const z=B.account?.noAuth===!0;if(e!=="create"){T(z),zf(Pf,z);return}So(bu,B.name||""),So(vu,B.baseUrl||""),B.protocol&&(p(B.protocol),So(xu,B.protocol)),N(z),zf(Df,z),b(B.hint||""),v(B.placeholder||"")},[e,a,t,o]);const I=f==="anthropic",P=h||(I?rG:sG),O=y||(I?lG:aG),_=e==="create"?pO(a):"",L=e==="existing"?String(D.find(B=>B.id===A)?.balanceScheme||""):"",H=(B,z)=>Q=>{z(Q),zf(B,Q)};return s.jsxs(s.Fragment,{children:[s.jsxs(zn,{hidden:e!=="create",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("上游信息")}),s.jsx("span",{children:r("创建这个提供商,并同时建立它的第一个账号。")})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:bu,children:[r("名称"),s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:bu,type:"text",maxLength:tG,"aria-required":"true",placeholder:r("如:智谱 GLM"),...Aa(bu)}),s.jsx("span",{className:"hint",children:r("1~64 个字符,账号列表里按它分组显示")})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:xu,children:r("协议")}),s.jsxs(ft,{value:f,onValueChange:B=>{const z=String(B);p(z),So(xu,z),b("")},children:[s.jsx(mt,{id:xu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:d.find(B=>B.value===f)?.label||f})}),s.jsx(ht,{children:d.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:vu,children:["Base URL",s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:vu,type:"text","aria-required":"true",placeholder:O,...Aa(vu)}),s.jsx("span",{className:"hint",id:"custom-baseurl-hint",children:P})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Mf,children:"API Key"}),s.jsx($e,{id:Mf,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:S,...Aa(Mf)}),s.jsx("span",{className:"hint",children:r(S?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:S,note:r(S?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用"),onChange:H(Df,N)}),s.jsx(gO,{scheme:_,prefix:Gw})]})]}),s.jsxs(zn,{hidden:e!=="existing",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("账号信息")}),s.jsxs("span",{children:[r("添加到 "),s.jsx("b",{children:R}),r(" 同一家可以放多把 key,按优先级轮换。")]})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:yu,children:r("提供商")}),s.jsxs(ft,{value:A,onValueChange:B=>j(String(B)),children:[s.jsx(mt,{id:yu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:R})}),s.jsx(ht,{children:D.map(B=>s.jsx(qe,{value:B.id,children:B.name||B.id},B.id))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:If,children:"API Key"}),s.jsx($e,{id:If,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:k,...Aa(If)}),s.jsx("span",{className:"hint",children:r(k?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:k,note:r(k?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走"),onChange:H(Pf,T)}),s.jsx(gO,{scheme:L,prefix:Kw}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:_f,children:r("备注名")}),s.jsx($e,{id:_f,type:"text",maxLength:nG,placeholder:r("可选"),...Aa(_f)}),s.jsx("span",{className:"hint",children:r("留空则用提供商名称")})]})]})]})]})}function vO(e,t){const a=pu(t);Jn(r("添加失败:{reason}",{reason:a}),"err"),e.setHint(a)}async function fG(e){const t=vr(bu),a=vr(xu)||fO()[0].value,o=vr(vu),c=vr(Mf),d=yg(Df);if(!t){Jn(r("请填写名称"),"err");return}if(!o){Jn(r("请填写 Base URL"),"err");return}await Yw(e.setBusy,async()=>{const f={name:t,protocol:a,baseUrl:o},p=e.presetKey?gt().wbPresetProviders?.presetOf?.(e.presetKey):null,h=p?.quirks||{};h.urlSuffix&&(f.urlSuffix=h.urlSuffix),h.headers&&Object.keys(h.headers).length&&(f.headers={...h.headers}),h.anthropicToolType&&(f.anthropicToolType=h.anthropicToolType),p?.clientEmulation&&(f.clientEmulation=p.clientEmulation);const b=pO(e.presetKey);b&&(f.balanceScheme=b);const y=mO(b,Gw);y&&(f.balanceQuery=y),d?f.noAuth=!0:c&&(f.apiKey=c),e.setHint("");try{const v=await gt().wbProviders?.customRequest?.("POST","/api/custom-providers",f);Mw([bu,vu,Mf]),hO(b,Gw),zf(Df,!1);const w=v?.provider?.name||t;await xO(r("✅ 已创建自定义提供商「{name}」并添加账号",{name:w}))}catch(v){vO(e,v)}})}async function pG(e){const t=vr(yu);if(!t){Jn(r("请先选择一个自定义提供商"),"err");return}const a=vr(If),o=yg(Pf),c=vr(_f),d=String(qw().find(f=>f.id===t)?.balanceScheme||"");await Yw(e.setBusy,async()=>{const f={provider:t};o?f.noAuth=!0:a&&(f.apiKey=a),c&&(f.name=c);const p=mO(d,Kw);p&&(f.balanceQuery=p),e.setHint("");try{const h=await gt().wbProviders?.customRequest?.("POST","/api/accounts",f);Mw([If,_f]),hO(d,Kw),zf(Pf,!1);const b=h?.account?.name||qw().find(y=>y.id===t)?.name||"";await xO(r("✅ {label}账号已添加{name}",{label:"",name:b?`:${b}`:""}))}catch(h){vO(e,h)}})}async function mG(){const e=vr(yu);if(!e){Jn(r("请先选择一个自定义提供商"),"err");return}const t=gt().wbCustomProvidersUi?.remove;if(typeof t!="function"){Jn(r("删除功能不可用(脚本未就绪)"),"err");return}await Yw(()=>{},async()=>{await t(e)&>().wbAddAccountModal?.close?.()})}function hG({mode:e,presetKey:t}){const[a,o]=x.useState(!1),[c,d]=x.useState(""),f={presetKey:t,setBusy:o,setHint:d};return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`add-foot-hint${c?" err":""}`,id:"add-form-foot-hint",children:c}),s.jsxs("span",{className:"add-foot-actions",id:"add-form-foot-actions",children:[e==="existing"?s.jsx(se,{id:uG,variant:"destructive",title:r("级联删除名下全部账号,不可恢复"),onClick:()=>{mG()},children:r("删除此提供商")}):null,s.jsx(se,{id:iG,hidden:e!=="create",disabled:a,onClick:()=>{fG(f)},children:r(a&&e==="create"?"提交中…":"创建并添加账号")}),s.jsx(se,{id:cG,hidden:e!=="existing",disabled:a,onClick:()=>{pG(f)},children:r(a&&e==="existing"?"提交中…":"添加账号")})]})]})}const Xw={step:"pick",accountType:zw,search:"",provider:Bi,providerHint:"",presetKey:"",showToken:0},yO=()=>gt().wbProviders?.customList?.()||[];function gG({onClose:e,onReady:t}){const[a,o]=x.useState(Xw),[c,d]=x.useState(0),f=x.useCallback(()=>d(C=>C+1),[]),p=x.useCallback(()=>{o(Xw);const C=gt().wbProviders;(C?.all?.()||[]).length||C?.load?.().then(f),C?.refreshCustom?.().then(f)},[f]),h=x.useCallback(()=>{p(),o({...Xw,step:"form",provider:gu})},[p]);x.useEffect(()=>(t({reset:p,openNewCustomForm:h}),()=>t(null)),[t,p,h]),x.useEffect(()=>{gt().wbWebLogin?.refresh?.()},[]),x.useEffect(()=>{gt().wbProviders?.refreshCustom?.().then(f)},[f]),x.useEffect(()=>{a.step!=="form"||a.provider!==gu||gt().wbProviders?.refreshCustom?.().then(f)},[a.step,a.provider,a.showToken,f]);const b=X8(a.provider),y=a.provider===gu,v=a.provider===Bi||y||!!b,w=a.providerHint?"existing":"create",j=a.providerHint?yO().find(C=>C.id===a.providerHint)?.name||"":a.presetKey&>().wbPresetProviders?.presetOf?.(a.presetKey)?.name||"",S=a.provider===Bi?Dw:gt().wbProviders?.labelOf?.(a.provider)||a.provider,N=y?a.providerHint||a.presetKey?r("登录 / 添加 {name} 账号",{name:j||r("自定义提供商")}):r("新建自定义提供商"):r("登录 / 添加 {name} 账号",{name:S});function k(C){if(!C)return;const A={step:"form",showToken:a.showToken+1};if(C===Hw)o(R=>({...R,...A,provider:gu,providerHint:"",presetKey:""}));else if(C.startsWith(Rf)){const R=C.slice(Rf.length),I=zR(gt().wbPresetProviders?.presetOf?.(R));o(P=>({...P,...A,provider:gu,providerHint:I?.id||"",presetKey:R}))}else yO().some(R=>R.id===C)?o(R=>({...R,...A,provider:gu,providerHint:C,presetKey:""})):o(R=>({...R,...A,provider:C,providerHint:"",presetKey:""}))}const T=()=>o(C=>({...C,step:"pick"})),D=a.accountType===dq;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||e()},children:s.jsxs(Zt,{className:"w-[min(1100px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加账号")})}),s.jsx(Bt,{children:s.jsx(vq,{accountType:a.accountType,onAccountTypeChange:C=>o(A=>({...A,accountType:C})),search:a.search,onSearchChange:C=>o(A=>({...A,search:C})),onPick:k,version:c,importing:D,importPanel:void 0})}),null,s.jsx(Qt,{open:a.step==="form",onOpenChange:C=>{C||T()},children:s.jsxs(Zt,{keepMounted:!0,overlayForceRender:!0,className:"w-[min(620px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:N})}),s.jsxs(Bt,{children:[s.jsx(uq,{active:a.provider===Bi}),qR.map(C=>s.jsx(lq,{config:C,active:a.provider===C.provider},C.provider)),s.jsx("div",{className:"add-provider-block",style:y?void 0:{display:"none"},children:s.jsx(dG,{mode:w,providerHint:a.providerHint,presetKey:a.presetKey,showToken:a.showToken,version:c})}),v?null:s.jsx("div",{className:"add-provider-block",children:s.jsxs(zn,{children:[s.jsx("h3",{children:r("该提供商账号添加功能即将上线")}),s.jsx("p",{children:r("「{name}」的账号添加功能还在开发中,敬请期待。",{name:S})})]})})]}),y?s.jsx(nn,{children:s.jsx(hG,{mode:w,presetKey:a.presetKey})}):null]})})]})})}let ko=null,wu=null,Hi=null,wg=null;function xG(){ko&&(ko.unmount(),ko=null),wu&&(wu.remove(),wu=null),Hi=null}function wO(){wu=document.createElement("div"),document.body.append(wu),ko=vn.createRoot(wu),ko.render(s.jsx(gG,{onClose:jO,onReady:e=>{if(Hi=e,!e)return;const t=wg;wg=null,t?.()}}))}function jO(){gt().wbWebLogin?.cancelIfActive?.(""),gt().wbAutoclawOauth?.cancel?.(),xG()}function Qw(){if(ko){Hi?.reset();return}wg=()=>Hi?.reset(),wO()}function bG(){if(ko){Hi?.openNewCustomForm();return}wg=()=>Hi?.openNewCustomForm(),wO()}for(const e of["btn-add-account","btn-add-account-2"])document.getElementById(e)?.addEventListener("click",Qw);const SO=window;SO.wbAddAccountModal={open:Qw,close:jO},SO.wbAccountAddForms={syncAddProvider:()=>{ko?Hi?.reset():Qw()},openNewCustomForm:bG};const vG=3065;let ju=null;function yG(){return window.workbuddyDesktop}const NO="same-origin";async function Zw(e=!1){if(ju&&!e)return ju;const t=yG();if(t?.platform==="web"){const o=typeof window>"u"?"":window.location?.origin;if(o&&o!=="null")return ju=o,ju}let a=0;try{const o=await t?.getBackendStatus?.(),c=Number(o?.port);Number.isFinite(c)&&c>0&&(a=c)}catch{}return a>0?(ju=`http://127.0.0.1:${a}`,ju):`http://127.0.0.1:${vG}`}async function wG(){const t=await window.workbuddyDesktop?.getModelManage?.(),a=Array.isArray(t?.models)?t.models:[],o=Array.isArray(t?.mappings)?t.mappings:[],c=new Set,d=[],f=new Set;for(const p of a){if(p.enabled!==!0)continue;const h=String(p.provider??""),b=String(p.id??"");!h||!b||(c.add(`${h}${b}`),f.has(b)||(f.add(b),d.push(b)))}for(const p of o){if(p.enabled!==!0||p.isDefault===!0)continue;const h=String(p.provider??""),b=String(p.target??""),y=String(p.alias??"");(!y||!f.has(y)&&c.has(`${h}${b}`))&&(f.add(y),d.push(y))}return d}function kO(e,t){if(typeof e=="string"&&e.trim())return e.trim();if(e&&typeof e=="object"){const a=e.message;if(typeof a=="string"&&a.trim())return a.trim();try{return JSON.stringify(e)}catch{}}return`HTTP ${t}`}function CO(e,t){const a=e instanceof Error?e.message:String(e);return new Error(`连接网关失败(${t}):${a}`)}async function TO(e,t,a){const o=await Zw();let c;try{c=await fetch(o+t,{method:e,headers:a===void 0?void 0:{"Content-Type":"application/json"},body:a===void 0?void 0:JSON.stringify(a),credentials:NO})}catch(b){throw CO(b,o)}const d=await c.text();let f=null;try{f=d?JSON.parse(d):null}catch{f=null}const p=f;if(!c.ok||p?.success===!1){const b=p?.error??f?.error,y=kO(b,c.status);throw c.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${y}`):new Error(y)}return p&&typeof p=="object"&&"data"in p?p.data:f}async function jG(){const t=(await TO("GET","/api/assistant/config"))?.config;if(!t||typeof t!="object")throw new Error("配置响应不完整");const a=typeof t.model=="string"?t.model:t.model?.id;return{model:typeof a=="string"&&a.trim()?a:null,systemPromptEnabled:t.systemPromptEnabled!==!1,systemPrompt:typeof t.systemPrompt=="string"?t.systemPrompt:"",tools:t.tools&&typeof t.tools=="object"?t.tools:{}}}async function SG(e){const t=await TO("PUT","/api/assistant/config",{config:e});return t?.config&&typeof t.config=="object"?t.config:e}function NG(e){return e.map(t=>{if(t.role==="tool")return{role:"tool",tool_call_id:t.toolCallId,content:t.content};if(t.role==="assistant"){const a={role:"assistant",content:t.content||""};return t.toolCalls?.length&&(a.tool_calls=t.toolCalls.map(o=>({id:o.id,type:"function",function:{name:o.name,arguments:o.arguments}}))),a}return{role:"user",content:t.content}})}async function kG(e){const t=await Zw(),a={messages:NG(e.messages)};e.tools.length&&(a.tools=e.tools);let o;try{o=await fetch(t+"/api/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),signal:e.signal,credentials:NO})}catch(v){throw e.signal?.aborted?v:CO(v,t)}if(!o.ok||!o.body){const v=await o.text().catch(()=>"");let w=null;try{w=v?JSON.parse(v):null}catch{}const j=w?.error,S=kO(j,o.status);throw o.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${S}`):new Error(S)}const c=o.body.getReader(),d=new TextDecoder;let f="";const p=new Map;let h="";const b=v=>{for(const w of v.split(` `)){const j=w.trimEnd();if(!j.startsWith("data:"))continue;const S=j.slice(5).trim();if(!S)continue;if(S==="[DONE]")return!0;let N;try{N=JSON.parse(S)}catch{continue}const k=Array.isArray(N.choices)?N.choices[0]:void 0,T=k?.delta||{},D=typeof T.content=="string"?T.content:"";if(D&&e.onEvent({type:"delta",text:D}),Array.isArray(T.tool_calls))for(const C of T.tool_calls){const A=Number(C.index??0),R=p.get(A)||{id:"",name:"",arguments:""};typeof C.id=="string"&&C.id&&(R.id=C.id);const I=C.function||{};typeof I.name=="string"&&I.name&&(R.name=I.name),typeof I.arguments=="string"&&(R.arguments+=I.arguments),p.set(A,R)}typeof k?.finish_reason=="string"&&(h=k.finish_reason)}return!1};for(;;){const{done:v,value:w}=await c.read();if(v)break;f+=d.decode(w,{stream:!0});let j=f.indexOf(` `);for(;j>=0;){const S=f.slice(0,j);if(f=f.slice(j+2),b(S)){await c.cancel().catch(()=>{}),f="",j=-1;break}j=f.indexOf(` -`)}}const y=[...p.entries()].sort((v,w)=>v[0]-w[0]).map(([,v])=>v);y.length&&e.onEvent({type:"toolCalls",calls:y}),e.onEvent({type:"done",finishReason:h})}function Ww(e){const t=String(e||"").trim();if(!t)return{};try{const a=JSON.parse(t);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Ja(){const e=window.workbuddyDesktop;if(!e)throw new Error(r("桌面桥不可用(本页需要在 Agent2API 客户端里打开)"));return e}function Su(){window.wbApp?.refresh?.()}function at(e,t=256){return typeof e=="string"?e.trim().slice(0,t):""}function Ui(e){return typeof e=="boolean"?e:void 0}function Bf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Nu(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"):[]}function ku(e){return(e instanceof Error?e.message:String(e)).replace(/^Error:\s*/,"")}async function jg(){const e=await Ja().getState?.();return(Array.isArray(e?.accounts)?e.accounts:[]).slice().sort((a,o)=>Number(a.priority??0)-Number(o.priority??0))}function Hf(e){return at(e.name)||at(e.nickname)||at(e.id)||"(未命名账号)"}function Jw(e,t){const a=t.trim();if(!a)throw new Error(r("没给账号名"));const o=e.find(p=>at(p.id)===a);if(o)return o;const c=e.filter(p=>Hf(p)===a);if(c.length===1)return c[0];const d=e.filter(p=>Hf(p).includes(a));if(d.length===1)return d[0];const f=(c.length?c:d).map(Hf).slice(0,6);throw f.length?new Error(r("「{name}」匹配到多个账号:{list},请用完整账号名重试",{name:a,list:f.join("、")})):new Error(r("没有找到账号「{name}」",{name:a}))}const SG={id:"list_models",label:r("获取模型列表"),kind:"read",desc:"读取各提供商的模型清单(模型 ID、所属提供商、是否启用、已挂的映射名)以及全部映射。回答「有哪些模型」「哪些模型在多家重复」「某个名字挂在哪」这类问题之前先调用它。",params:{type:"object",properties:{provider:{type:"string",description:"只看某一家(提供商 id,如 codearts / workbuddy);不填 = 全部"},keyword:{type:"string",description:"按模型 ID 或映射名做子串过滤;不填 = 不过滤"},enabledOnly:{type:"boolean",description:"true = 只看已启用的模型"}}},run:async e=>{const t=at(e.provider,64).toLowerCase(),a=at(e.keyword,128).toLowerCase(),o=Ui(e.enabledOnly)===!0,c=await Ja().getModelManage?.(),f=(Array.isArray(c?.models)?c.models:[]).filter(p=>!(t&&at(p.provider).toLowerCase()!==t||o&&p.enabled!==!0||a&&![at(p.id),at(p.name),...Array.isArray(p.aliases)?p.aliases.map(b=>at(b)):[]].join(" ").toLowerCase().includes(a))).map(p=>({provider:at(p.provider),id:at(p.id),enabled:p.enabled===!0,aliases:Array.isArray(p.aliases)?p.aliases.map(h=>at(h)):[]}));return{text:JSON.stringify({total:f.length,models:f.slice(0,400)}),summary:r("{n} 个模型",{n:f.length})}}},NG={id:"list_account_balance",label:r("查询账号余额"),kind:"read",desc:"查询各账号的余额 / 剩余额度(会向各上游发起真实的余额查询)。回答「还剩多少」「哪个账号快用完了」这类问题之前先调用它。",params:{type:"object",properties:{account:{type:"string",description:"只查某个账号(账号名或 id);不填 = 全部账号"}}},run:async e=>{const t=at(e.account,128),a=t?at(Jw(await jg(),t).id):"",o=await Ja().getAllBalances?.(a||void 0),c=Array.isArray(o?.results)?o.results:o,d=Array.isArray(c)?c:[];return{text:JSON.stringify({accounts:d.slice(0,60)}).slice(0,12e3),summary:r("{n} 个账号",{n:d.length})}}},kG={id:"set_model_enabled",label:r("启用 / 禁用模型"),kind:"write",desc:"开启或关闭某几个模型在网关上的可用性(粒度是「提供商 × 模型」)。禁用后下游请求不再路由到它。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的模型列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["provider","id","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items);return{lead:r("将修改 {n} 个模型的启停状态:",{n:t.length}),table:{head:[r("提供商"),r("模型"),r("改成")],rows:t.map(a=>[at(a.provider),at(a.id),Ui(a.enabled)===!1?r("禁用"):r("启用")])},note:r("改动立即生效;禁用后指向它的请求会落到下一个候选。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=Ui(c.enabled);if(!d||!f||p===void 0)throw new Error(r("参数不完整(需要 provider / id / enabled)"));await t.setModelState?.({provider:d,id:f,enabled:p}),o.push(`${p?"启用":"禁用"} ${d}/${f}`)}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已修改 {n} 个模型",{n:o.length})}}},CG={id:"set_model_mapping",label:r("设置模型映射 ID"),kind:"write",desc:"给模型新增或删除映射名(对外名)。同一对外名可以在多个提供商各挂一条:下游用同一个名字请求,网关按账号优先级主备切换;也可以给不同家的同名模型各加前缀(如 ca/claude-sonnet-4.5)来精确指定某一家。一次可以改多条。删掉的映射名只是不再对外可用,不删任何模型。",params:{type:"object",properties:{items:{type:"array",description:"要改的映射列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"上游模型 ID"},alias:{type:"string",description:"要新增 / 删除的映射名(对外名)"},action:{type:"string",enum:["add","remove"],description:"add = 新增映射,remove = 删除映射"}},required:["provider","id","alias","action"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(d=>at(d.action)!=="remove").length,o=t.length-a,c=[];return a&&c.push(r("新增 {n} 条",{n:a})),o&&c.push(r("删除 {n} 条",{n:o})),{lead:r("将改动 {n} 条映射({parts}):",{n:t.length,parts:c.join("、")}),table:{head:[r("提供商"),r("上游模型"),r("操作"),r("映射名")],rows:t.map(d=>[at(d.provider),at(d.id),at(d.action)==="remove"?r("删除"):r("新增"),at(d.alias)])},note:r("只改映射名,不动上游模型 ID;映射立即生效(新对话即可用)。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=at(c.alias,128);if(!d||!f||!p)throw new Error(r("参数不完整(需要 provider / id / alias)"));at(c.action)==="remove"?(await t.removeModelMapping?.(p,f,d),o.push(`删除 ${p} → ${d}/${f}`)):(await t.addModelMapping?.(p,f,d),o.push(`新增 ${p} → ${d}/${f}`))}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已改动 {n} 条映射",{n:o.length})}}},TO=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],ej={maxInputTokens:"上下文窗口",maxOutputTokens:"最大输出 Token",supportsToolCall:"工具调用",supportsImages:"图片识别",supportsVideo:"视频识别",supportsReasoning:"深度推理"},TG={id:"set_model_capability",label:r("修改模型能力"),kind:"write",desc:"修改某个模型对下游声明的能力位:上下文窗口、最大输出 Token、工具调用 / 图片 / 视频 / 深度推理四个布尔位。只传要改的键;布尔位给 null 表示恢复上游原值。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},capabilities:{type:"object",description:"要改的能力位(只写要改的键)",properties:{maxInputTokens:{type:["number","null"],description:"上下文窗口(token 数)"},maxOutputTokens:{type:["number","null"],description:"最大输出 token 数"},supportsToolCall:{type:["boolean","null"],description:"是否支持工具调用;null = 恢复上游原值"},supportsImages:{type:["boolean","null"],description:"是否支持图片识别;null = 恢复上游原值"},supportsVideo:{type:["boolean","null"],description:"是否支持视频识别;null = 恢复上游原值"},supportsReasoning:{type:["boolean","null"],description:"是否支持深度推理;null = 恢复上游原值"}}}},required:["provider","id","capabilities"]},plan:e=>{const t=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},a=TO.filter(o=>o in t);return{lead:r("将修改 {model} 的 {n} 项能力:",{model:`${at(e.provider)} / ${at(e.id)}`,n:a.length}),table:{head:[r("能力"),r("改成")],rows:a.map(o=>{const c=t[o],d=c===null?r("恢复上游原值"):typeof c=="boolean"?r(c?"支持":"不支持"):String(c);return[ej[o]||o,d]})},note:r("能力位决定下游看到的声明(能不能贴图、能塞多少上下文),不改上游的真实行为。")}},run:async e=>{const t=at(e.provider),a=at(e.id),o=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},c={};for(const d of TO){if(!(d in o))continue;const f=o[d];if(f===null){c[d]=null;continue}if(d==="maxInputTokens"||d==="maxOutputTokens"){const p=Bf(f);if(p===void 0)throw new Error(r("{key} 需要数字",{key:ej[d]}));c[d]=Math.round(p)}else{const p=Ui(f);if(p===void 0)throw new Error(r("{key} 需要 true / false / null",{key:ej[d]}));c[d]=p}}if(!t||!a||!Object.keys(c).length)throw new Error(r("参数不完整(需要 provider / id / capabilities)"));return await Ja().setModelCapabilities?.(t,a,c),Su(),{text:JSON.stringify({ok:!0,provider:t,id:a,capabilities:c}),summary:r("已修改 {n} 项能力",{n:Object.keys(c).length})}}},EG={id:"test_model",label:r("发起模型测试"),kind:"run",desc:"对某个模型发一次真实的对话请求,回报连通性、耗时与首字延迟。会消耗该账号的额度。回答「这个模型通不通 / 快不快」时用它。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},prompt:{type:"string",description:"测试用的用户提示词;不填 = 默认一句问候(最小请求)"}},required:["provider","id"]},plan:e=>({lead:r("将对 {model} 发起一次真实请求:",{model:`${at(e.provider)} / ${at(e.id)}`}),table:{head:[r("项"),r("值")],rows:[[r("提示词"),at(e.prompt)||r("(默认问候)")],[r("代价"),r("消耗该账号额度")]]},note:r("这是真实的上游请求,与生产走同一条链路(会记账,报表排除)。")}),run:async e=>{const t={provider:at(e.provider),model:at(e.id)},a=at(e.prompt,4e3);a&&(t.prompt=a);const o=await Ja().testModel?.(t),c=String(o?.status??""),d=o?.success===!0,f={ok:d,status:c,error:o?.error??null,reply:String(o?.reply??"").slice(0,1500),duration_ms:o?.duration_ms??null,ttfb_ms:o?.ttfb_ms??null,account:o?.account_name??null};return{text:JSON.stringify(f).slice(0,6e3),summary:d?r("连通 · {ms}ms",{ms:String(f.duration_ms??"")}):r("失败 · {status}",{status:c||"—"})}}},AG={id:"set_provider_order",label:r("调整提供商顺位"),kind:"write",desc:"调整某个提供商在账号全局队列里的**整组顺位**(第几组),决定路由时先试哪一家。这一家的所有账号会作为一整块移动。位置从 1 开始数。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},position:{type:"number",description:"目标组顺位(1 = 最前)"}},required:["provider","position"]},plan:e=>({lead:r("将把「{provider}」整组移到第 {position} 顺位:",{provider:at(e.provider)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交(后端按新顺序重编优先级),移动会连带调整其它组的相对次序。")}),run:async e=>{const t=at(e.provider).toLowerCase(),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 provider / position)"));const o=await jg(),c=[];for(const h of o){const b=at(h.id),y=at(h.provider).toLowerCase();if(!b)continue;const v=c[c.length-1];v&&v.provider===y?v.ids.push(b):c.push({provider:y,ids:[b]})}const d=c.findIndex(h=>h.provider===t);if(d<0)throw new Error(r("没有找到提供商「{provider}」的账号",{provider:t}));const f=Math.max(0,Math.min(c.length-1,Math.round(a)-1)),[p]=c.splice(d,1);return c.splice(f,0,p),await Ja().reorderAccounts?.(c.flatMap(h=>h.ids)),Su(),{text:JSON.stringify({ok:!0,provider:t,from:d+1,to:f+1,moved:p.ids.length}),summary:r("已移到第 {n} 顺位",{n:f+1})}}},RG={id:"set_account_order",label:r("调整账号优先级"),kind:"write",desc:"把某个账号移动到账号全局队列的第 N 顺位(1 = 最前)。位置决定主备与切换顺序:越靠前越先被使用。",params:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},position:{type:"number",description:"目标顺位(1 = 最前)"}},required:["account","position"]},plan:e=>({lead:r("将把账号「{account}」移到第 {position} 顺位:",{account:at(e.account)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交;位置越靠前,路由时越先被选中。")}),run:async e=>{const t=at(e.account,128),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 account / position)"));const o=await jg(),c=Jw(o,t),d=at(c.id),f=o.map(b=>at(b.id)).filter(Boolean),p=f.indexOf(d);if(p<0)throw new Error(r("账号不在当前队列里"));f.splice(p,1);const h=Math.max(0,Math.min(f.length,Math.round(a)-1));return f.splice(h,0,d),await Ja().reorderAccounts?.(f),Su(),{text:JSON.stringify({ok:!0,account:Hf(c),from:p+1,to:h+1}),summary:r("已移到第 {n} 顺位",{n:h+1})}}},OG={id:"set_account_enabled",label:r("启用 / 禁用账号"),kind:"write",desc:"开启或关闭某几个账号的转发资格。禁用只是把它移出队列(余额仍可查),但**如果某条线路只剩它**,禁用会直接断供。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的账号列表",items:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["account","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(o=>Ui(o.enabled)===!1).length;return{lead:r("将修改 {n} 个账号的启用状态(其中禁用 {k} 个):",{n:t.length,k:a}),table:{head:[r("账号"),r("改成")],rows:t.map(o=>[at(o.account),Ui(o.enabled)===!1?r("禁用"):r("启用")])},note:r("禁用会把账号移出转发队列;若这条线路没有别的可用账号,请求会直接失败。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=await jg(),c=[];for(const d of a){const f=Ui(d.enabled);if(f===void 0)throw new Error(r("参数不完整(需要 account / enabled)"));const p=Jw(o,at(d.account,128));await t.updateAccount?.(at(p.id),{enabled:f}),c.push(`${f?"启用":"禁用"} ${Hf(p)}`)}return Su(),{text:JSON.stringify({ok:!0,changed:c}),summary:r("已修改 {n} 个账号",{n:c.length})}}},Sg=[SG,NG,kG,CG,TG,EG,AG,RG,OG];function tj(e){return Sg.find(t=>t.id===e)}function MG(e){return Sg.filter(t=>e[t.id]).map(t=>({type:"function",function:{name:t.id,description:t.desc,parameters:t.params}}))}r("获取模型列表"),r("读各提供商的模型清单、映射名与启用状态。"),r("查询账号余额"),r("读各账号的额度 / 剩余用量。"),r("启用 / 禁用模型"),r("开关模型的对外可用性,不改其它属性。"),r("设置模型映射 ID"),r("新增 / 删除映射名,支持批量加前缀与同名合并到多家。"),r("修改模型能力"),r("改上下文窗口 / 最大输出 Token / 工具调用等能力位。"),r("发起模型测试"),r("对指定模型发一次真实请求,回报连通性与耗时。"),r("调整提供商顺位"),r("改某一家的整组顺位(先试哪一家)。"),r("调整账号优先级"),r("改账号在全局队列里的名次,决定主备与切换顺序。"),r("启用 / 禁用账号"),r("禁用会把账号移出转发队列,线路可能因此断供。");const EO=12;function Uf(e,t){return window.wbIcons?.icon?.(e,t)||""}function DG(e){const t=window.wbMarkdown;return t?.render?t.render(e):e.replace(/[&<>]/g,a=>({"&":"&","<":"<",">":">"})[a]||a)}function IG({tone:e}){return e==="plain"?s.jsx("span",{className:"asst-tc-ico",dangerouslySetInnerHTML:{__html:Uf("spark",13)}}):s.jsx("span",{className:Ue("asst-tc-ico",e),children:e==="warn"?"!":"✕"})}function PG({item:e,onConfirm:t}){const a=tj(e.call.name),o=a?.label||e.call.name,c=Ww(e.call.arguments),d=Object.keys(c).length?JSON.stringify(c,null,2):"";return s.jsxs("div",{className:Ue("asst-tool-card",e.state==="confirm"&&"confirm",e.state==="confirm"&&a?.kind==="run"&&"danger",e.state==="failed"&&"failed",e.state==="running"&&"running"),children:[s.jsxs("div",{className:"asst-tc-head",children:[e.state==="running"?s.jsx("span",{className:"asst-tc-ico",children:s.jsx("span",{className:"spin"})}):s.jsx(IG,{tone:e.state==="failed"?"bad":e.state==="confirm"?"warn":"plain"}),s.jsx("span",{className:"asst-tc-name",children:o}),e.state==="confirm"&&s.jsx("span",{className:"badge tag warn",children:r("待确认")}),e.state==="done"&&s.jsxs("span",{className:"asst-tc-state",children:["✓ ",e.summary||r("完成")]}),e.state==="failed"&&s.jsx("span",{className:"asst-tc-state bad",children:r("失败")}),e.state==="cancelled"&&s.jsx("span",{className:"asst-tc-state plain",children:r("已取消")})]}),e.state==="confirm"&&e.plan&&s.jsxs("div",{className:"asst-tc-plan",children:[e.plan.lead,e.plan.table&&s.jsxs("table",{className:"asst-mini-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.plan.table.head.map((f,p)=>s.jsx("th",{children:f},p))})}),s.jsx("tbody",{children:e.plan.table.rows.slice(0,20).map((f,p)=>s.jsx("tr",{children:f.map((h,b)=>s.jsx("td",{className:b===f.length-1?"mono hl":"",children:h},b))},p))})]}),e.plan.table&&e.plan.table.rows.length>20&&s.jsx("div",{className:"hint",children:r("(仅显示前 20 条,共 {n} 条)",{n:e.plan.table.rows.length})}),e.plan.note&&s.jsx("div",{className:"hint",children:e.plan.note})]}),e.state==="failed"&&e.error&&s.jsx("div",{className:"asst-tc-error",children:e.error}),e.state==="done"&&e.detail&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看结果")}),s.jsx("pre",{className:"asst-tc-json",children:e.detail})]}),e.state!=="confirm"&&d&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看参数")}),s.jsx("pre",{className:"asst-tc-json",children:d})]}),e.state==="confirm"&&s.jsxs("div",{className:"asst-tc-foot",children:[s.jsx("span",{className:Ue("hint",a?.kind==="run"&&"danger"),children:a?.kind==="run"?r("这会真实发起上游请求并消耗额度"):r("确认后立即生效")}),s.jsx(se,{size:"sm",variant:a?.kind==="run"?"destructive":"default",onClick:()=>t(!0),children:r("执行")}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(!1),children:r("取消")})]})]})}function _G(){const[e,t]=x.useState(null),[a,o]=x.useState([]),[c,d]=x.useState([]),[f,p]=x.useState(!1),[h,b]=x.useState(!1),[y,v]=x.useState(""),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=x.useRef([]),T=x.useRef([]),D=x.useRef(null),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useRef(0),P=x.useRef(null),O=x.useRef(0),_=x.useCallback(()=>{d(k.current.slice())},[]);x.useEffect(()=>{const M=A.current;if(!M)return;M.scrollHeight-M.scrollTop-M.clientHeight<160&&(M.scrollTop=M.scrollHeight)},[c]);const L=x.useCallback(async()=>{if(!R.current){R.current=!0;try{const M=await vG();t(M),N(!1),I.current=0}catch(M){N(!0),j(r("加载助手设置失败:{message}",{message:ku(M)})),I.current<3&&(I.current+=1,R.current=!1,setTimeout(()=>{L()},4e3))}try{o(await bG())}catch(M){j(U=>U||r("读取模型清单失败:{message}",{message:ku(M)}))}}},[]);x.useEffect(()=>{const M=window;return M.wbAssistant={activate:()=>{L()}},L(),()=>{delete M.wbAssistant}},[L]);const H=x.useMemo(()=>{const M={};for(const U of Sg)M[U.id]=e?.tools?.[U.id]??!1;return M},[e]),B=x.useMemo(()=>MG(H),[H]),z=Object.values(H).filter(Boolean).length,Q=e?.model??null,K=x.useCallback(async(M,U,Z)=>{for(let ae=U;ae{if(O.current>=EO){k.current.push({kind:"notice",text:r("这一轮来回已达 {n} 次上限,我先停下等你指示(可以换个说法,或拆成几步让我做)。",{n:EO}),bad:!0}),_();return}O.current+=1,p(!0),j("");const M=new AbortController;C.current=M;const U=k.current.push({kind:"bot",text:"",streaming:!0})-1;_();let Z=[],ae=!1;try{await jG({messages:T.current,tools:B,signal:M.signal,onEvent:ie=>{if(ie.type==="delta"){const ge=k.current[U];ge&&ge.kind==="bot"&&(k.current[U]={...ge,text:ge.text+ie.text},_())}ie.type==="toolCalls"&&(Z=ie.calls)}})}catch(ie){ae=!0;const ge=ku(ie),ee=k.current[U],fe=ee&&ee.kind==="bot"?ee.text:"";fe?k.current[U]={kind:"bot",text:fe}:k.current.splice(U,1);const te=M.signal.aborted;k.current.push({kind:"notice",text:te?r("已停止这次回答。"):r("请求失败:{message}",{message:ge}),bad:!te}),_()}finally{C.current=null}if(ae){p(!1);return}const ce=k.current[U];ce&&ce.kind==="bot"&&(k.current[U]={...ce,streaming:!1});const J=ce&&ce.kind==="bot"?ce.text:"";if(T.current.push({role:"assistant",content:J,toolCalls:Z.length?Z:void 0}),_(),!Z.length){p(!1);return}await K(Z,0,[])},[B,K,_]);P.current=X;const q=x.useCallback(async M=>{const U=D.current;if(!U)return;D.current=null,b(!1);const Z=U.calls[U.index],ae=tj(Z.name),ce=Ww(Z.arguments);if(!M||!ae)k.current[U.cardIndex]={kind:"tool",call:Z,state:"cancelled"},U.collected.push({toolCallId:Z.id,content:"用户取消了这次操作,没有做任何改动。"}),_();else{k.current[U.cardIndex]={kind:"tool",call:Z,state:"running"},p(!0),_();try{const J=await ae.run(ce);k.current[U.cardIndex]={kind:"tool",call:Z,state:"done",summary:J.summary,detail:J.text},U.collected.push({toolCallId:Z.id,content:J.text})}catch(J){const ie=ku(J);k.current[U.cardIndex]={kind:"tool",call:Z,state:"failed",error:ie},U.collected.push({toolCallId:Z.id,content:`工具执行失败:${ie}`})}_()}await K(U.calls,U.index+1,U.collected)},[K,_]),$=x.useCallback(async M=>{const U=M.trim();if(!(!U||f||h)){if(O.current=0,k.current.push({kind:"user",text:U}),T.current.push({role:"user",content:U}),v(""),_(),!e){k.current.push({kind:"notice",text:r("助手设置没读出来,现在还不能发消息 —— 看输入框下方的提示。"),bad:!0}),_();return}if(!e.model){k.current.push({kind:"notice",text:r("还没有选择对话模型:先在下方选一个(或去「设置 → AI 助手」里选)。"),bad:!0}),_();return}await X()}},[h,f,e,X,_]),Y=x.useCallback(()=>{C.current?.abort()},[]),F=x.useCallback(()=>{C.current?.abort(),D.current=null,k.current=[],T.current=[],b(!1),p(!1),j(""),_()},[_]),G=x.useCallback(async M=>{if(!M)return;if(!e){j(r("助手设置没读出来,暂时存不了对话模型 —— 看输入框下方的提示。"));return}const U={...e,model:M};t(U);try{await yG(U)}catch(Z){j(r("保存对话模型失败:{message}",{message:ku(Z)}))}},[e]),W=f||h,le=x.useRef(null);return s.jsxs("div",{className:"asst-layout",children:[s.jsxs("div",{className:"asst-top",children:[s.jsxs(ft,{value:Q??"",onValueChange:M=>{G(String(M))},children:[s.jsx(mt,{className:"asst-model-pick","aria-label":r("对话模型"),children:s.jsx(pt,{children:Q?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:Ue("dot","ok")}),s.jsx("span",{className:"mono",children:Q})]}):r("选择模型…")})}),s.jsxs(ht,{children:[a.length===0&&s.jsx(qe,{value:"none",disabled:!0,children:r("没有可用的模型")}),a.map(M=>s.jsx(qe,{value:M,children:M},M))]})]}),s.jsx("span",{className:"asst-top-hint",children:r("助手走本地网关,消耗所选账号的额度")}),s.jsx("span",{className:"spacer"}),s.jsx(se,{variant:"ghost",size:"sm",onClick:F,disabled:f||h||!c.length,children:r("新对话")})]}),s.jsxs("div",{className:"asst-scroll",ref:A,children:[c.length===0&&s.jsxs("div",{className:"asst-empty",children:[s.jsx("div",{className:"empty-logo",dangerouslySetInnerHTML:{__html:Uf("spark",26)||""}}),s.jsx("h3",{children:r("AI 助手")}),s.jsxs("p",{children:[r("用一句话让我查或改本机的模型转发配置。"),s.jsx("br",{}),r("我会在动手前把改动列给你确认。")]}),s.jsx("div",{className:"asst-suggests",children:[r("看看哪些模型在多家重复了"),r("测一下当前最快的模型通不通"),r("CodeArts 的账号余额还剩多少?"),r("把重复的模型加上家名前缀区分开")].map(M=>s.jsxs("button",{type:"button",onClick:()=>{$(M)},children:["“",M,"”"]},M))}),e!==null&&z===0&&s.jsx("div",{className:"asst-empty-warn",children:r("当前一个工具都没勾选,助手只能纯聊天。去「设置 → AI 助手 → 工具」里勾上需要的工具。")}),S&&s.jsx("div",{className:"asst-empty-warn bad",children:w||r("助手设置读取失败,工具可能已过时。")})]}),c.map((M,U)=>M.kind==="user"?s.jsx("div",{className:"asst-msg user",children:s.jsx("div",{className:"bubble",children:M.text})},U):M.kind==="bot"?!M.text&&M.streaming?s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsx("div",{className:"body",children:s.jsx("span",{className:"spin"})})]},U):s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsxs("div",{className:"body",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:DG(M.text)}}),M.streaming&&s.jsx("span",{className:"asst-caret"})]})]},U):M.kind==="notice"?s.jsx("div",{className:"asst-msg bot",children:s.jsx("div",{className:Ue("asst-empty-warn",M.bad&&"bad"),style:{margin:0},children:M.text})},U):s.jsx(PG,{item:M,onConfirm:Z=>{q(Z)}},U))]}),s.jsxs("div",{className:"asst-composer",children:[s.jsxs("div",{className:"asst-ta-wrap",children:[s.jsx(Qc,{ref:le,rows:1,value:y,placeholder:r(W?"等这一轮跑完…":"直接说要改什么 / 查什么…(Enter 发送,Shift+Enter 换行)"),disabled:W,onChange:M=>{v(M.currentTarget.value);const U=M.currentTarget;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,132)}px`},onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing&&(M.preventDefault(),$(y))}}),f?s.jsx("button",{type:"button",className:"asst-send stop",title:r("停止"),onClick:Y,children:"■"}):s.jsx("button",{type:"button",className:"asst-send",title:r("发送"),disabled:W||!y.trim(),onClick:()=>{$(y)},children:"➤"})]}),s.jsxs("div",{className:"asst-composer-foot",children:[s.jsxs("span",{className:"tools-state",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("settings",12)||""}}),r("已注入 {n} / {total} 个工具 · 系统提示词:{state}",{n:z,total:Sg.length,state:e?.systemPromptEnabled?r("开"):r("关")})]}),s.jsx("span",{className:"spacer"}),w?s.jsxs("span",{className:"hint",children:[w,S&&s.jsx("button",{type:"button",className:"asst-tc-more",onClick:()=>{L()},children:r("重试")})]}):Q?s.jsx("span",{className:"hint",children:r("回复由 {model} 生成 · 走本地网关",{model:Q})}):null]})]})]})}const AO='.page[data-page="assistant"]';let nj=null;function RO(){if(nj)return;const e=document.querySelector(AO);e&&(e.replaceChildren(),nj=vn.createRoot(e),nj.render(s.jsx(_G,{})))}document.querySelector(AO)?RO():document.addEventListener("DOMContentLoaded",RO,{once:!0}),Zw().catch(()=>{});function Ir(){return Pe().workbuddyDesktop??{}}function OO(){return window}const MO="workbuddy-desktop-checkin-tab",LG=["center","schedule","records"];function zG(){try{const e=localStorage.getItem(MO);return LG.includes(e)?e:"center"}catch{return"center"}}function DO(e){if(e!==gs.tab){try{localStorage.setItem(MO,e)}catch{}Js({tab:e})}}async function Ng(e){DO(e),gs.loaded||await Ol()}let gs={version:0,tab:zG(),snapshot:null,loaded:!1,loadError:"",expanded:new Set,runningAll:!1,autoSaving:!1,autoTimeDraft:null,keepaliveSaving:!1,keepaliveDraft:null,signing:new Set,onboarding:new Map,growth:new Map};const sj=new Set;function BG(){for(const e of sj)e()}function Js(e){gs={...gs,...e,version:gs.version+1},BG()}function ur(){return gs}function IO(e){return sj.add(e),()=>sj.delete(e)}function HG(e){const t=typeof e?.key=="string"?e.key:"";return t?{key:t,title:typeof e.title=="string"&&e.title?e.title:t,group:typeof e.group=="string"&&e.group?e.group:"",points:Number(e.points)||0,done:e.done===!0,blocked:e.blocked===!0}:null}function rj(e){return(Array.isArray(e)?e:[]).map(HG).filter(a=>a!==null)}function us(e){return Number(e)||0}async function Ol(){try{const e=await Ir().getCheckinCenter?.();if(!e)throw new Error(r("后端未返回签到中心数据"));Js({snapshot:e,loaded:!0,loadError:"",autoTimeDraft:null,keepaliveDraft:null}),UG(e.extras?.onboarding??[])}catch(e){Js({loaded:!0,loadError:ut(e)})}}function UG(e){for(const t of e){const a=t.settled;if(!a||typeof a!="object")continue;const o=gs.onboarding.get(t.id);if(o?.status==="loaded"&&o.unclaimed>0)continue;const c=rj(a.tasks),d=us(a.at);Co(t.id,{status:"loaded",error:void 0,checkedAt:void 0,settled:!0,settledAt:d>0?d:void 0,tasks:c,unclaimed:0,earned:us(a.earned),total:us(a.total)})}}function PO(e){const t=new Set(gs.expanded);t.has(e)?t.delete(e):t.add(e),Js({expanded:t})}function aj(e){const t=`onb:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}function _O(e){return gs.expanded.has(`onb:${e}`)}async function VG(){if(!gs.runningAll){Js({runningAll:!0});try{const e=await Ir().runAutoCheckinNow?.();if(e){const t=us(e.succeeded),a=us(e.active),o=us(e.total),c=us(e.failedCount),d=a>0?r(",日活保活 {n} 个",{n:a}):"";c>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:t,total:o,active:d,failed:c}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:t,total:o,active:d})),OO().wbAccountsView?.refreshUsageAfterCheckin?.(null)}}catch(e){Le(r("签到失败:{error}",{error:ut(e)}),"err")}finally{Js({runningAll:!1}),await Ol(),LO(ur().snapshot?.extras.onboarding??[]),Pe().wbApp?.refresh?.()}}}async function kg(e,t="checkin"){const a=`${e}:${t}`;if(gs.signing.has(a))return;const o=new Set(gs.signing);o.add(a),Js({signing:o});try{let c;t==="checkin"?c=(await Ir().checkinAllAccounts?.(e))?.results?.[0]:c=await Ir().runCheckinActivity?.(e,t)??void 0;const d=c?.claim,f=c?.activity,p=f?.report?.succeeded===!0,h=f?.webConversation?.succeeded===!0;c?.error?Le(r("签到失败:{error}",{error:String(c.error)}),"err"):t==="keepalive"?f?.pokeSucceeded===!0||h||p?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成")})):Le(d?.msg||r("活跃保活失败"),"err"):d?.success===!0?Le(r("✅ {message}",{message:d.msg||r("签到成功")})):d?.alreadyCompleted===!0?Le(d?.msg||r("今日已领取"),"err"):p?Le(r("✅ {message}",{message:d?.msg||r("活跃上报完成,但活动未开启")})):f?.pokeSucceeded===!0||h?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成,但活动未开启")})):Le(d?.msg||r("未领取"),"err"),OO().wbAccountsView?.refreshUsageAfterCheckin?.(e)}catch(c){Le(r("签到失败:{error}",{error:ut(c)}),"err")}finally{const c=new Set(ur().signing);c.delete(a),Js({signing:c}),await Ol();const d=(ur().snapshot?.extras.onboarding??[]).filter(f=>f.id===e);LO(d),Pe().wbApp?.refresh?.()}}function Cg(e){Js({keepaliveDraft:e.map(t=>t.trim()).filter(Boolean)})}async function FG(e){const t=e.map(a=>a.trim()).filter(Boolean);if(!ur().keepaliveSaving){Js({keepaliveSaving:!0});try{const a=await Ir().saveCheckinKeepalive?.(t);if(a){const o=ur().snapshot;Js({snapshot:o&&{...o,keepalive:a},keepaliveDraft:null}),Le(r("已保存:保活模型链"))}}catch(a){Le(r("保存失败:{error}",{error:ut(a)}),"err")}finally{Js({keepaliveSaving:!1})}}}async function LO(e){for(const t of e)$G(t.id)||await lj(t.id);for(const t of e){const a=ur().onboarding.get(t.id);a?.status!=="loaded"||a.claiming||a.settled||(t.provider==="officeace"||a.unclaimed>0)&&await zO(t.id)}}function $G(e){return gs.onboarding.get(e)?.settled===!0}function Cu(e){return gs.onboarding.get(e)??{status:"idle",tasks:[],unclaimed:0,earned:0,total:0,claiming:!1}}function Co(e,t){const a=new Map(gs.onboarding);a.set(e,{...Cu(e),...t}),Js({onboarding:a})}async function lj(e,t){const a=Cu(e);if(!(a.status==="loading"||a.claiming)){Co(e,{status:"loading",error:void 0,settled:!1});try{const o=await Ir().getOnboardingTasks?.(e,t?.refresh===!0),c=rj(o?.tasks),d=o?.settled===!0;Co(e,{status:"loaded",checkedAt:Date.now(),tasks:c,unclaimed:c.filter(f=>!f.done&&!f.blocked).length,earned:us(o?.earned),total:us(o?.total),settled:d,settledAt:d&&us(o?.settledAt)||void 0}),t?.expand===!0&&c.length>0&&!_O(e)&&aj(e)}catch(o){Co(e,{status:"error",error:ut(o),settled:!1})}}}async function zO(e){const t=Cu(e);if(!(t.claiming||t.status!=="loaded")){Co(e,{claiming:!0});try{Co(e,{tasks:Cu(e).tasks.map(v=>v.done?v:{...v,claiming:!0,error:void 0})});const a=await Ir().claimOnboardingTasks?.(e),o=new Map,c=Array.isArray(a?.results)?a.results:[];for(const v of c){const w=typeof v?.key=="string"?v.key:"";w&&v?.ok!==!0&&o.set(w,String(v?.error||r("领取失败")))}const d=rj(a?.tasks),f=(d.length?d:Cu(e).tasks).map(v=>({...v,claiming:!1,error:o.get(v.key)})),p=f.filter(v=>v.done&&!o.has(v.key)).length,h=a?.settled===!0;Co(e,{claiming:!1,checkedAt:Date.now(),tasks:f,unclaimed:f.filter(v=>!v.done&&!v.blocked).length,earned:us(a?.earned),total:us(a?.total),settled:h,settledAt:h&&us(a?.settledAt)||void 0});const b=f.filter(v=>v.error&&!v.done).length,y=typeof a?.message=="string"?a.message.trim():"";b?Le(r("新手福利有 {n} 项领取失败,可重试",{n:b}),"err"):y?Le(y,"ok"):p&&Le(r("✅ 新手福利领取完成,累计 {n} 积分",{n:us(a?.earned)}))}catch(a){const o=ut(a);Co(e,{claiming:!1,tasks:Cu(e).tasks.map(c=>({...c,claiming:!1,error:c.done?void 0:o}))}),Le(r("领取失败:{error}",{error:o}),"err")}finally{await Ol()}}}function BO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,title:typeof o.title=="string"&&o.title?o.title:c,description:typeof o.description=="string"?o.description:"",status:typeof o.status=="string"?o.status:"",current:us(o.current),target:us(o.target),locked:o.locked===!0,unlockAt:o.unlockAt,supported:o.supported===!0,unforgeable:o.unforgeable===!0,unforgeableReason:typeof o.unforgeableReason=="string"?o.unforgeableReason:"",kind:typeof o.kind=="string"?o.kind:"",source:typeof o.source=="string"?o.source:""}:null}).filter(a=>a!==null)}function HO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,outcome:typeof o.outcome=="string"?o.outcome:"failed",message:typeof o.message=="string"?o.message:"",credit:us(o.credit),energy:us(o.energy)}:null}).filter(a=>a!==null)}function Vi(e){return gs.growth.get(e)??{status:"idle",energy:null,streak:null,tasks:[],travel:null,school:null,running:!1,runningSchool:!1,runningTravel:!1}}function Pr(e,t){const a=new Map(gs.growth);a.set(e,{...Vi(e),...t}),Js({growth:a})}function qG(e){return gs.expanded.has(`growth:${e}`)}function UO(e){const t=`growth:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}async function Tg(e){const t=Vi(e);if(!(t.status==="loading"||t.running)){Pr(e,{status:"loading",error:void 0});try{const a=await Ir().getGrowthStatus?.(e),o=a?.tasks??{},c=a?.travel??null,d=a?.school??null;Pr(e,{status:"loaded",checkedAt:Date.now(),energy:a?.energy===null||a?.energy===void 0?null:us(a.energy),streak:a?.streak===null||a?.streak===void 0?null:us(a.streak),tasks:BO(o.tasks),travel:c,school:d?{...d,tasks:BO(d.tasks)}:null,error:typeof o.error=="string"?o.error:void 0})}catch(a){Pr(e,{status:"error",error:ut(a)})}}}async function VO(e,t){const a=Vi(e);if(a.running)return;const o=(a.tasks??[]).filter(h=>!h.supported||h.unforgeable===!0||h.locked===!0?!1:t==="claim"?h.status==="completed"||h.current>=h.target&&h.status!=="claimed":h.status!=="claimed");if(o.length===0){Le(r("没有需要执行的任务"));return}Pr(e,{running:!0,results:[],error:void 0});let c=0,d=0,f=0,p=0;for(const h of o)try{const b=await Ir().runGrowthTask?.(e,h.code,t),y=HO([b])[0];y&&(Pr(e,{results:[...Vi(e).results??[],y]}),c+=y.credit??0,d+=y.energy??0,(y.outcome==="done"||y.outcome==="already")&&(f+=1),y.outcome==="failed"&&(p+=1))}catch(b){p+=1,Pr(e,{results:[...Vi(e).results??[],{code:h.code,outcome:"failed",message:ut(b),credit:0,energy:0}]})}Pr(e,{running:!1}),p>0?Le(r("成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}",{done:f,failed:p,credit:c,energy:d}),"err"):Le(r("✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}",{credit:c,energy:d})),await Tg(e)}async function GG(e,t){if(!Vi(e).runningSchool){Pr(e,{runningSchool:!0,error:void 0});try{const o=await Ir().runGrowthSchool?.(e,t),c=HO(o?.results),d=o?.lottery??null;Pr(e,{runningSchool:!1,results:c,schoolText:c.length?c.map(f=>`${f.code}:${f.message}`).join(";"):void 0,lotteryText:d?String(d.message??r("已抽 {n} 次",{n:us(d.drawn)})):void 0,checkedAt:Date.now()}),Le(d?r("开学季执行完成:{message}",{message:String(d.message??"")}):r("✅ 开学季任务执行完成")),await Tg(e)}catch(o){Pr(e,{runningSchool:!1,error:ut(o)}),Le(r("开学季执行失败:{error}",{error:ut(o)}),"err")}}}async function KG(e){if(!Vi(e).runningTravel){Pr(e,{runningTravel:!0,error:void 0});try{const a=await Ir().runGrowthTravel?.(e),o=String(a?.message??""),c=String(a?.outcome??"");Pr(e,{runningTravel:!1,checkedAt:Date.now()}),c==="failed"?Le(r("猫猫旅行失败:{message}",{message:o}),"err"):Le(r("猫猫旅行:{message}",{message:o})),await Tg(e)}catch(a){Pr(e,{runningTravel:!1,error:ut(a)}),Le(r("猫猫旅行失败:{error}",{error:ut(a)}),"err")}}}function YG(e){return e.totalCount?e.doneCount>=e.totalCount?"done":e.doneCount>0?"part":"todo":"none"}function XG(e){const a=(Array.isArray(e?.schedules)?e.schedules:[]).filter(o=>o.enabled===!0).map(o=>Number(o.nextRunAt)).filter(o=>Number.isFinite(o)&&o>0);return a.length?Math.min(...a):null}let To={version:0,data:null,loaded:!1,loadError:"",saving:!1,runningId:null,editingId:null};const oj=new Set;function QG(){for(const e of oj)e()}function _r(e){To={...To,...e,version:To.version+1},QG()}function FO(){return To}function ZG(e){return oj.add(e),()=>oj.delete(e)}function Tu(){return Pe().workbuddyDesktop??{}}async function $O(){try{const e=await Tu().getCheckinSchedules?.();if(!e)throw new Error(r("后端未返回定时签到数据"));_r({data:e,loaded:!0,loadError:""})}catch(e){_r({loaded:!0,loadError:ut(e)})}}function Eg(e){e&&_r({data:e,loadError:""}),Ol()}async function WG(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveAutoCheckin?.({enabled:e});Eg(t),Le(r(e?"✅ 定时签到已开启":"定时签到已关闭"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function qO(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveCheckinSchedule?.(e);Eg(t),_r({editingId:null}),Le(r("已保存:定时条目"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function JG(e,t){await qO({id:e.id,label:e.label??"",enabled:t,time:e.time??"",providers:Array.isArray(e.providers)?e.providers:[]})}async function e7(e){if(!To.saving){_r({saving:!0});try{await Tu().deleteCheckinSchedule?.(e),Eg(await Tu().getCheckinSchedules?.()),Le(r("已删除定时条目"))}catch(t){Le(r("删除失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function t7(e){if(!To.runningId){_r({runningId:e});try{const t=await Tu().runCheckinSchedule?.(e)??void 0,a=o=>Number(o)||0;if(t){const o=a(t.succeeded),c=a(t.active),d=a(t.total),f=a(t.failedCount),p=c>0?r(",日活保活 {n} 个",{n:c}):"";f>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:o,total:d,active:p,failed:f}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:o,total:d,active:p})),Eg(t)}}catch(t){Le(r("执行失败:{error}",{error:ut(t)}),"err")}finally{_r({runningId:null}),await Ol()}}}function ij(e){_r({editingId:e})}const n7=r("到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。");function s7(){const[e,t]=x.useState(FO());return x.useEffect(()=>ZG(()=>t(FO())),[]),e}function r7(){const[e,t]=x.useState(ur());return x.useEffect(()=>IO(()=>t(ur())),[]),e}function GO(e,t){const a=Array.isArray(e.providers)?e.providers:[];return t.filter(o=>a.includes(o.id)).map(o=>o.label)}function a7(e,t){const a=GO(e,t);return a.length?t.length>0&&a.length>=t.length?r("全部 {n} 家",{n:t.length}):a.join(r("、")):r("未勾选提供商")}function l7(e,t){const a=GO(e,t);return a.length?a.join(r("、")):r("未勾选提供商")}function o7(e){const t=e.lastResult;if(!t)return r("还没执行过");const a=f=>Number(f)||0,o=[r("成功 {n}",{n:a(t.succeeded)})],c=a(t.active);c>0&&o.push(r("保活 {n}",{n:c}));const d=a(t.failedCount);return d>0&&o.push(r("失败 {n}",{n:d})),`${t.at?Fs(t.at):"—"}${t.reason?` · ${t.reason}`:""} —— ${o.join(r(" · "))}`}function KO({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=e===null,[c,d]=x.useState(e?.label??""),[f,p]=x.useState(e?.time??"00:01"),[h,b]=x.useState(new Set(o?a.map(S=>S.id):e?.providers??[]));x.useEffect(()=>{o&&a.length>0&&b(new Set(a.map(S=>S.id)))},[]);const y=f.trim()!==""&&h.size>0,v=()=>b(new Set(a.map(S=>S.id))),w=()=>b(new Set),j=async()=>{await qO({id:e?.id,label:c.trim(),enabled:e?.enabled??!0,time:f.trim(),providers:a.map(S=>S.id).filter(S=>h.has(S))})};return s.jsxs("div",{className:"ck-sched-editor",children:[s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("名称")}),s.jsx("span",{className:"ck-set-v",children:s.jsx($e,{type:"text",className:"max-w-[220px]",placeholder:r("可选 · 缺省显示时刻"),value:c,disabled:t.saving,onChange:S=>d(S.currentTarget.value)})})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("每天时刻")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx($e,{type:"time",className:"w-[96px] max-w-[96px] font-mono tabular-nums",value:f,disabled:t.saving,onChange:S=>p(S.currentTarget.value)}),s.jsx("span",{className:"text-subtle text-xs",children:r("北京时间 · 错过时点开机后会自动补签")})]})]}),s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("签到范围")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("到点时逐个签到,已勾 {n} / {total} 家",{n:h.size,total:a.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving,onClick:v,children:r("全选")}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving||h.size===0,onClick:w,children:r("清空")})]}),s.jsx("div",{className:"ck-range",children:a.map(S=>s.jsxs("label",{className:"ck-range-item",children:[s.jsx(Mr,{checked:h.has(S.id),disabled:t.saving,onCheckedChange:N=>{const k=new Set(h);N===!0?k.add(S.id):k.delete(S.id),b(k)}}),s.jsx("span",{className:"ck-range-name",title:S.label,children:S.label})]},S.id))}),h.size===0?s.jsx("div",{className:"ck-mini-warn",children:r("至少勾一家才能保存(不勾等于这条条目不签到)")}):null]})]}),s.jsxs("div",{className:"ck-sched-actions",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.saving,onClick:()=>ij(null),children:r("取消")}),s.jsx(se,{size:"sm",variant:"default",disabled:!y||t.saving,onClick:()=>{j()},children:t.saving?r("保存中…"):r("保存")})]})]})}function i7({store:e}){return s.jsxs("div",{className:"ck-sched-row open ck-sched-row-new",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx("span",{className:"ck-new-dot","aria-hidden":!0,children:"+"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:r("新建定时条目")}),s.jsx("div",{className:"ck-prov-desc",children:r("填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)")})]})]}),s.jsx(KO,{entry:null,store:e})]})}function c7({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=t.editingId===e.id,c=t.runningId===e.id,d=t.data?.enabled===!0,f=Number(e.nextRunAt),p=async()=>{const h=Pe().wbConfirm?.ask;if(!h)return;const y=(e.displayLabel||e.time||e.id).replace(/&/g,"&").replace(//g,">");await h({title:r("删除定时条目"),html:r("确定删除「{name}」?删除后到点不再执行。",{name:y}),okText:r("删除"),okClass:"danger"})&&await e7(e.id)};return s.jsxs("div",{className:o?"ck-sched-row open":"ck-sched-row",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx(hs,{checked:e.enabled===!0,disabled:t.saving,onCheckedChange:h=>{JG(e,h===!0)}}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.displayLabel||e.time||e.id,e.enabled===!0?null:s.jsx(ze,{variant:"outline",shape:"tag",children:r("已停用")})]}),s.jsx("div",{className:"ck-prov-desc ck-sched-scope",title:l7(e,a),children:r("每天 {time} · {scope}",{time:e.time??"—",scope:a7(e,a)})}),s.jsx("div",{className:"ck-prov-desc",children:r("上次执行:{line}",{line:o7(e)})})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-sched-next",children:d&&e.enabled===!0&&Number.isFinite(f)&&f>0?r("下次 {date}",{date:Fs(f)}):"—"}),s.jsx(se,{size:"sm",variant:"ghost",disabled:c||t.runningId!==null,onClick:()=>{t7(e.id)},children:r(c?"执行中…":"立即执行")}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>ij(o?null:e.id),children:r(o?"收起":"编辑")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",disabled:t.saving,onClick:()=>{p()},children:r("删除")})]})]}),o?s.jsx(KO,{entry:e,store:t}):null]})}function u7(e,t){return e.length===t.length&&e.every((a,o)=>a===t[o])}let Vf=null;function d7(e,t){for(let a=0;ah!==t.row),d=d7(c,e.clientY);if(d===t.from)return;const f=[...t.list],[p]=f.splice(t.from,1);f.splice(d,0,p),t.list=f,t.from=d,t.onChange(f)}function Ff(){const e=Vf;Vf=null,window.removeEventListener("pointermove",YO),window.removeEventListener("pointerup",Ff),window.removeEventListener("pointercancel",Ff),document.body.classList.remove("ck-chain-dragging"),e?.row.classList.remove("dragging")}function f7(e,t,a,o){if(e.button!==0||Vf||a.length<2)return;const c=e.currentTarget.closest(".ck-chain-row");c&&(e.preventDefault(),Vf={list:[...a],from:t,row:c,onChange:o},c.classList.add("dragging"),document.body.classList.add("ck-chain-dragging"),window.addEventListener("pointermove",YO),window.addEventListener("pointerup",Ff),window.addEventListener("pointercancel",Ff))}function p7({models:e,defaultModels:t,dirty:a,saving:o}){const[c,d]=x.useState(""),f=()=>{const p=c.trim();if(p){if(e.includes(p)){Le(r("清单里已经有「{name}」",{name:p}),"err");return}Cg([...e,p]),d("")}};return s.jsxs("section",{className:"panel ck-chain-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("保活模型链")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:!a||o,onClick:()=>{FG(e)},children:r(o?"保存中…":"保存")})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("模型清单")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("按序逐个尝试,共 {n} 个",{n:e.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:o||t.length===0,title:r("把缺省链填进清单,再点「保存」生效"),onClick:()=>Cg([...t]),children:r("填入缺省链")})]}),s.jsxs("div",{className:"ck-chain",children:[e.map((p,h)=>s.jsxs("div",{className:"ck-chain-row",children:[s.jsx("span",{className:"ck-chain-grip",role:"button",tabIndex:-1,"aria-label":r("按住拖动调整顺序"),title:r("按住拖动,调整这个模型在链里的顺序"),onPointerDown:b=>f7(b,h,e,Cg),dangerouslySetInnerHTML:{__html:Pe().wbIcons?.icon?.("gripVertical",14)||""}}),s.jsx("span",{className:"ck-chain-name",title:p,children:p}),s.jsxs("span",{className:"ck-chain-index",children:["#",h+1]}),s.jsx("button",{type:"button",className:"ck-chain-del",disabled:o,"aria-label":r("移除 {name}",{name:p}),title:r("从清单里移除"),onClick:()=>Cg(e.filter((b,y)=>y!==h)),children:"×"})]},p)),e.length===0?s.jsx("div",{className:"ck-chain-empty",children:r("清单为空 —— 保存后恢复缺省链")}):null]}),s.jsxs("div",{className:"ck-chain-add",children:[s.jsx($e,{type:"text",className:"max-w-[260px] font-mono text-xs",placeholder:r("WorkBuddy 国际版保活模型,按顺序回退"),value:c,disabled:o,onChange:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}}),s.jsx(se,{size:"sm",variant:"outline",disabled:o||c.trim()==="",onClick:f,children:r("添加模型")}),a?s.jsx("span",{className:"ck-chain-dirty",children:r("有未保存的改动")}):null]})]})]}),s.jsx("div",{className:"ck-note",children:r("「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。",{defaults:t.join(r("、"))})})]})]})}function m7(){const e=s7(),t=r7();if(x.useEffect(()=>{$O()},[]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取定时签到数据…")})]});const a=e.data,o=a?.enabled===!0,c=Array.isArray(a?.schedules)?a.schedules:[],d=t.snapshot?.keepalive,f=Array.isArray(d?.models)?d.models:[],p=Array.isArray(d?.defaultModels)?d.defaultModels:[],h=t.keepaliveDraft,b=h??f,y=h!==null&&!u7(h,f);return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取定时签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{$O()},children:r("重试")})]}):null,s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("定时签到")}),s.jsx("span",{className:"tip-q","data-tip":n7}),s.jsx("span",{className:"panel-sub",children:r("每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签")}),s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto flex-none",disabled:e.saving,onClick:()=>ij(e.editingId==="new"?null:"new"),children:e.editingId==="new"?r("收起新建"):r("添加条目")})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("总开关")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(hs,{checked:o,disabled:e.saving,onCheckedChange:v=>{WG(v===!0)}}),s.jsx("span",{className:"text-subtle text-xs",children:r(o?"开着:启用的条目按各自时刻执行":"关着:所有条目都不执行")})]})]})}),s.jsxs("div",{children:[e.editingId==="new"?s.jsx(i7,{store:e}):null,c.map(v=>s.jsx(c7,{entry:v,store:e},v.id)),c.length===0?s.jsx("div",{className:"ck-empty",children:r("还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。")}):null]})]}),s.jsx(p7,{models:b,defaultModels:p,dirty:y,saving:t.keepaliveSaving})]})}const Ag="checkin-records",XO=["today","7","30","month","all"],Eu="all",h7=[{value:"today",label:r("今天")},{value:"7",label:r("7 天")},{value:"30",label:r("30 天")},{value:"month",label:r("本月")},{value:"all",label:r("全部")}],QO="workbuddy-desktop-checkin-records-range";function Rg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function ZO(e){const t=new Date;switch(e){case"today":return Rg(t);case"7":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Rg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function g7(){try{const e=localStorage.getItem(QO);return e!==null&&XO.includes(e)?e:Eu}catch{return Eu}}function WO(e){try{localStorage.setItem(QO,e)}catch{}}function JO(e){return typeof e=="number"&&e>0?e:du}const cj={success:{label:"成功领取",variant:"success"},already:{label:"今日已领",variant:"brand"},pending:{label:"等待窗口",variant:"warning"},failed:{label:"失败",variant:"destructive"}},x7={schedule:"定时",startup:"补签",manual:"手动",single:"单签",activity:"活动"},uj=[{key:"time",label:r("时间")},{key:"account",label:r("账号")},{key:"provider",label:r("提供商")},{key:"source",label:r("来源")},{key:"outcome",label:r("结果")},{key:"detail",label:r("说明")}];let dj=null;function eM(){return dj?dj.apply([...uj]):uj.map(e=>({...e,align:e.align??"left"}))}function tM(){window.wbTableColumns?.repaint?.(Ag)}function nM(e){return(ur().snapshot?.auto?.providerOptions??[]).find(a=>a.id===e)?.label??e}function b7(e,t){const a=`ck-col-${t.key} ta-${t.align}`;switch(t.key){case"time":return s.jsxs("td",{className:a,children:[e.ts?Fs(e.ts):"—",s.jsx("span",{className:"ck-record-date",children:e.date||""})]},t.key);case"account":return s.jsx("td",{className:a,children:e.accountName||e.accountId||"—"},t.key);case"provider":return s.jsx("td",{className:a,children:e.provider?nM(e.provider):"—"},t.key);case"source":return s.jsxs("td",{className:a,children:[s.jsx("span",{className:"ck-record-source",children:x7[e.source??""]??e.source??"—"}),e.reason?s.jsx("span",{className:"ck-record-reason",children:e.reason}):null]},t.key);case"outcome":{const o=cj[e.outcome??""]??{label:e.outcome||"—",variant:"outline"};return s.jsxs("td",{className:a,children:[s.jsx(ze,{variant:o.variant,shape:"tag",children:o.label}),e.keptActive?s.jsx(ze,{variant:"outline",shape:"tag",className:"ml-1",children:r("保活")}):null]},t.key)}case"detail":return s.jsx("td",{className:e.error?`${a} ck-record-detail-fail`:a,children:e.error||e.message||"—"},t.key);default:return null}}function v7(){const[e,t]=x.useState([]),[a,o]=x.useState(0),[c,d]=x.useState(1),[f,p]=x.useState(()=>g7()),[h,b]=x.useState(()=>JO(lg(Ag,rg))),[y,v]=x.useState({outcome:"",provider:"",keyword:""}),[w,j]=x.useState(""),[S,N]=x.useState(!1),[k,T]=x.useState(""),[D,C]=x.useState(0),A=x.useRef(null),R=x.useRef(0),[,I]=x.useReducer(Y=>Y+1,0),P=ur().snapshot?.auto?.providerOptions??[],O=eM(),_=Math.max(1,Math.ceil(a/h)),L=Math.min(c,_),H=y.outcome!==""||y.provider!==""||y.keyword!==""||f!==Eu,B=a?{start:(L-1)*h+1,end:Math.min(a,L*h)}:null,z=x.useCallback(async Y=>{const F=R.current+1;R.current=F,N(!0),T("");try{const W=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:Y.size,offset:(Y.page-1)*Y.size,outcome:Y.filters.outcome,provider:Y.filters.provider,keyword:Y.filters.keyword,start:ZO(Y.range)});if(F!==R.current)return;t(Array.isArray(W?.records)?W.records:[]),o(Number(W?.total)||0)}catch(G){if(F!==R.current)return;T(G instanceof Error?G.message:String(G))}finally{F===R.current&&N(!1)}},[]);x.useEffect(()=>{z({page:c,size:h,range:f,filters:y})},[z,c,h,f,y]),x.useEffect(()=>{c>_&&d(_)},[c,_]),x.useLayoutEffect(()=>{const Y=Pe().wbColSettings;if(!Y?.register){const F=window.setTimeout(()=>C(G=>G+1),50);return()=>window.clearTimeout(F)}dj=Y.register({id:Ag,label:r("签到记录表"),columns:uj.map(F=>({key:F.key,label:F.label,align:F.align??"left"})),mount:()=>A.current,onChange:()=>{Cs.flushSync(()=>I()),tM()}}),I()},[D]),x.useLayoutEffect(()=>{tM()}),x.useEffect(()=>()=>{Pe().wbColSettings?.close()},[]);const Q=Y=>{v(Y),d(1)},K=Y=>{const F=XO.includes(Y)?Y:Eu;F!==f&&(WO(F),p(F),d(1))},X=Y=>{b(JO(Y)),og(Ag,Y),d(1)},q=()=>{j(""),WO(Eu),p(Eu),Q({outcome:"",provider:"",keyword:""})},$=async()=>{const Y=Pe().wbConfirm?.ask;if(!Y)return;const F=r(H?"确定清空当前筛选出的签到记录?清空后无法恢复。":"确定清空全部签到记录?清空后无法恢复。");if(await Y({title:r("清空签到记录"),html:F,okText:r("清空"),okClass:"danger"}))try{await Pe().workbuddyDesktop?.clearCheckinRecords?.(H?{outcome:y.outcome,provider:y.provider,keyword:y.keyword,start:ZO(f)}:{all:"1"}),sM("签到记录已清空"),await z({page:1,size:h,range:f,filters:y}),d(1)}catch(G){sM(r("清空失败:{error}",{error:G instanceof Error?G.message:String(G)}),"err")}};return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("签到记录")}),s.jsx("span",{className:"panel-sub",children:r("每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准")}),s.jsxs("div",{ref:A,className:"ml-auto flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:S,onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r(S?"刷新中…":"刷新")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{$()},children:r("清空")})]})]}),s.jsxs("div",{className:"ck-records-filters",children:[s.jsx(In,{options:h7,value:f,onValueChange:K,"aria-label":r("签到记录时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:y.outcome,onValueChange:Y=>Q({...y,outcome:Y??""}),children:[s.jsx(mt,{className:"w-[128px] shrink-0","aria-label":r("按结果筛选"),children:s.jsx(pt,{children:y.outcome?cj[y.outcome]?.label??y.outcome:r("全部结果")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部结果")}),Object.entries(cj).map(([Y,F])=>s.jsx(qe,{value:Y,children:F.label},Y))]})]}),s.jsxs(ft,{value:y.provider,onValueChange:Y=>Q({...y,provider:Y??""}),children:[s.jsx(mt,{className:"w-[148px] shrink-0","aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:y.provider?nM(y.provider):r("全部提供商")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部提供商")}),P.map(Y=>s.jsx(qe,{value:Y.id,children:Y.label},Y.id))]})]}),s.jsx("div",{className:"spacer"}),s.jsx($e,{type:"search",className:"ck-records-search w-[200px] basis-[200px] min-w-[150px] grow-0 shrink",placeholder:r("搜账号 / 收益 / 错误 / 触发原因"),value:w,onChange:Y=>j(Y.currentTarget.value),onBlur:()=>{w!==y.keyword&&Q({...y,keyword:w.trim()})},onKeyDown:Y=>{Y.key==="Enter"&&Y.currentTarget.blur(),Y.key==="Escape"&&(j(y.keyword),Y.currentTarget.blur())}}),H?s.jsx(se,{size:"sm",variant:"ghost",onClick:q,children:r("清除筛选")}):null,s.jsx("span",{className:"panel-sub",children:S?r("读取中…"):r("{n} 条",{n:a})})]}),k?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到记录失败:{error}",{error:k})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r("重试")})]}):null,e.length===0&&!S?s.jsx("div",{className:"ck-empty",children:r(H?"没有符合筛选条件的签到记录":"还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。")}):s.jsx("div",{className:"ck-records-scroll",children:s.jsxs("table",{className:"ck-table ck-records-table",children:[s.jsx("colgroup",{children:O.map(Y=>s.jsx("col",{"data-col":Y.key,className:`ck-col-${Y.key}`},Y.key))}),s.jsx("thead",{children:s.jsx("tr",{children:O.map(Y=>s.jsx("th",{"data-col":Y.key,className:`ck-col-${Y.key} ta-${Y.align}`,children:Y.label},Y.key))})}),s.jsx("tbody",{children:e.map(Y=>s.jsx("tr",{children:O.map(F=>b7(Y,F))},Y.rowId))})]})}),s.jsx(Li,{total:a,range:B,page:L,pageCount:_,size:h,sizes:rg,onSizeChange:X,onPageChange:d,disabled:S})]})}function sM(e,t){Pe().wbApp?.toast?.(e,t)}window.wbCheckinRecords={visibleColumns:()=>eM().map(e=>({key:e.key}))};const rM={workbuddy:r("腾讯每日签到接口 · 仅国内版"),"workbuddy-intl":r("每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行"),raccoon:r("桌面端每日积分链路"),autoclaw:r("官方客户端的每日签到任务"),"autoclaw-intl":r("与国内版同一套任务接口 · 站点不同"),qoder:r("活动(campaign)领取 · 每天 10:00 刷新"),"qoder-intl":r("带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件"),trae:r("SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新"),loomy:r("无独立签到接口 · 每天替账号打一次首次登录积分"),kuku:r("「免费领积分」的每日任务 · 逐个领取"),officeace:r("一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证"),codearts:r("每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置")},y7=[{value:"center",label:r("签到中心")},{value:"schedule",label:r("定时签到")},{value:"records",label:r("签到记录")}];function w7(e){return e==="raccoon"?"小浣熊":e==="loomy"?"Loomy":e==="codearts"?"CodeArts":e==="officeace"?"OfficeAce 果办":e}function j7(){const[e,t]=x.useState(ur());return x.useEffect(()=>IO(()=>t(ur())),[]),e}function S7({group:e}){const t=YG(e);return t==="none"?s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")}):t==="done"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):t==="part"?s.jsx(ze,{variant:"warning",shape:"tag",children:r("部分")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}function $f({id:e,label:t}){const a=hg[e==="workbuddy-intl"?"workbuddy":e];return s.jsx("span",{className:"ck-prov-logo",children:a?s.jsx("img",{src:a,alt:""}):t.slice(0,1)||"·"})}function N7({group:e}){const t=ur().signing,a=(o,c)=>t.has(`${o}:${c}`);return s.jsxs("table",{className:"ck-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("账号")}),s.jsx("th",{children:r("今日签到")}),s.jsx("th",{children:r("上次签到时间")}),s.jsx("th",{"aria-label":r("操作")})]})}),s.jsx("tbody",{children:e.accounts.map(o=>{const c=e.id==="workbuddy-intl";return s.jsxs("tr",{children:[s.jsx("td",{children:o.name||o.id}),s.jsx("td",{children:o.checkedInToday?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}),s.jsx("td",{className:"text-subtle",children:o.checkinAt?Fs(o.checkinAt):"—"}),s.jsx("td",{className:"text-right",children:c?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"keepalive"),title:r("用免费模型与网页会话维持账号活跃 · 不领取奖励"),onClick:()=>{kg(o.id,"keepalive")},children:a(o.id,"keepalive")?r("保活中…"):r("保活")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"claim"),title:r("探测活动并领取日活奖励 · 不做保活"),onClick:()=>{kg(o.id,"claim")},children:a(o.id,"claim")?r("领取中…"):r("领取")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"full"),title:r("探测 + 领取 + 保活 · 与定时签到同一套组合"),onClick:()=>{kg(o.id,"full")},children:a(o.id,"full")?r("执行中…"):r("保活+领取")})]}):s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"checkin"),onClick:()=>{kg(o.id)},children:a(o.id,"checkin")?r("签到中…"):o.checkedInToday?r("重签"):r("签到")})})]},o.id)})})]})}function k7({group:e,expanded:t}){const a=e.totalCount>0;return s.jsxs("div",{className:t?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:()=>a&&PO(e.id),onKeyDown:o=>{a&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),PO(e.id))},role:a?"button":void 0,tabIndex:a?0:-1,"aria-expanded":a?t:void 0,children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:rM[e.id]??""})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-prov-count",children:a?r("{total} 账号 · {done} 已签",{total:e.totalCount,done:e.doneCount}):"—"}),s.jsx(S7,{group:e}),a?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),e.id==="qoder-intl"?s.jsx(aM,{}):null,t?s.jsx("div",{className:"ck-prov-detail",children:s.jsx(N7,{group:e})}):null]})}function aM(){const[e,t]=x.useState(null),a=x.useCallback(async()=>{try{t(await Ir().getQoderUmid?.()??null)}catch{}},[]);x.useEffect(()=>{a()},[a]);const o=e?.installing===!0&&e.available!==!0;if(x.useEffect(()=>{if(!o)return;const d=window.setInterval(()=>{a()},3e3);return()=>{window.clearInterval(d)}},[o,a]),!e||e.available)return null;const c=async()=>{try{t(d=>d&&{...d,installing:!0}),await Ir().installQoderUmid?.(),Pe().wbApp?.toast?.(r("✅ UMID 组件已安装,下轮签到即可领取国际版积分"))}catch(d){Pe().wbApp?.toast?.(r("UMID 组件安装失败:{error}",{error:d instanceof Error?d.message:String(d)}),"err")}finally{a()}};return s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-2.5 pl-[58px] pr-4 text-[12px] text-muted-foreground",children:[s.jsx("span",{children:r("国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。")}),e.installSupported?s.jsx(se,{variant:"outline",size:"sm",disabled:e.installing===!0,onClick:()=>{c()},children:e.installing?r("安装中…"):r("一键安装组件")}):s.jsx("span",{children:r("安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。")})]})}function C7({row:e}){const t=e.provider??"loomy",a=ur().onboarding.get(e.id),o=a?.tasks??[],c=a?.unclaimed??0,d=a?.status==="loaded"&&o.length>0,f=d&&_O(e.id);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>aj(e.id):void 0,onKeyDown:p=>{d&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),aj(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:t,label:w7(t)}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[a?.status==="loaded"?r("已领 {claimed}/{total} · 累计 {earned} 积分",{claimed:o.length-c,total:o.length,earned:a.total?`${a.earned} / ${a.total}`:a.earned}):r("尚未查询任务状态"),a?.settled&&a.settledAt?` · ${r("结算于 {time}",{time:Fs(a.settledAt)})}`:a?.checkedAt?` · ${r("查询于 {time}",{time:Fs(a.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:p=>p.stopPropagation(),children:[a?.status==="loaded"&&c>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项待领",{n:c})}):a?.status==="loaded"?s.jsx(ze,{variant:"success",shape:"tag",children:r("全部领取")}):a?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status==="loading"||a?.claiming===!0,onClick:()=>{lj(e.id,{expand:!0,refresh:!0})},children:a?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status!=="loaded"||t!=="officeace"&&c===0||a?.claiming===!0,onClick:()=>{zO(e.id)},children:a?.claiming?r("领取中…"):c>0?r("一键领取({n})",{n:c}):r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),a?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:a.error??""})}):null,f?s.jsx("div",{className:"ck-prov-detail",children:o.map(p=>s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:p.done?"ck-task-tick done":"ck-task-tick",children:p.done?"✓":"·"}),s.jsx("span",{children:p.title}),s.jsxs("span",{className:"ck-task-pts",children:["+",p.points]}),s.jsx("span",{className:"ck-task-st",children:p.claiming?s.jsx(ze,{variant:"warning",shape:"tag",children:r("领取中")}):p.done?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):p.blocked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不可领")}):p.error?s.jsx(ze,{variant:"destructive",shape:"tag",children:p.error}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")})})]},p.key))}):null]})}function T7({row:e}){const t=Kh({claimPlans:e.claimPlans}),a=t.length>0;return s.jsxs("div",{className:"ck-welfare-row",children:[s.jsx($f,{id:"zcode",label:"ZCode"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.name||e.id,a?s.jsx(ze,{variant:"success",shape:"tag",title:r("本地台账里今天(北京时间)领过的套餐:{plans}",{plans:t.join(r("、"))}),children:r("今天已领 {n} 份",{n:t.length})}):s.jsx(ze,{variant:"outline",shape:"tag",title:r("本地台账里今天还没领过;活动期内每天发一份新套餐"),children:r("今天未领")})]}),s.jsx("div",{className:"ck-prov-desc",children:a?r("点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领"):e.claimAt?r("上次领取 {time} · 领取需通过滑块验证码",{time:Fs(e.claimAt)}):r("限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码")})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(se,{size:"sm",variant:"outline",onClick:()=>wR(e.id,e.name),children:r(a?"套餐明细":"去领取")})})]})}function E7({row:e}){const t=ur().growth.get(e.id),a=t?.tasks??[],o=a.filter(v=>v.supported&&!v.unforgeable),c=o.filter(v=>v.status!=="claimed"&&v.current0,f=d&&qG(e.id),p=t?.travel,h=t?.school,b=t?.results??[],y=v=>b.find(w=>w.code===v);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>UO(e.id):void 0,onKeyDown:v=>{d&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),UO(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:"workbuddy",label:"WorkBuddy"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[t?.status==="loaded"?r("{total} 项任务 · {pending} 项可完成",{total:o.length,pending:c.length}):r("查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)"),t?.checkedAt?` · ${r("查询于 {time}",{time:Fs(t.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:v=>v.stopPropagation(),children:[t?.status==="loaded"?c.length>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项可完成",{n:c.length})}):s.jsx(ze,{variant:"success",shape:"tag",children:r("全部完成")}):t?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status==="loading"||t?.running===!0,onClick:()=>{Tg(e.id)},children:t?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status!=="loaded"||t?.running===!0,title:r("接单 + 点亮 + 领奖(只处理已实测沉淀的任务)"),onClick:()=>{VO(e.id,"full")},children:t?.running?r("执行中…"):r("一键完成")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.status!=="loaded"||t?.running===!0,title:r("只领取已完成任务的奖励(幂等,重复点不会重复入账)"),onClick:()=>{VO(e.id,"claim")},children:r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),t?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:t.error??""})}):null,f?s.jsxs("div",{className:"ck-prov-detail",children:[s.jsxs("div",{className:"ck-fold-note",children:[t?.energy!==null&&t?.energy!==void 0?r("能量 {n}",{n:t.energy}):"",t?.streak!==null&&t?.streak!==void 0?` · ${r("连登 {n} 天",{n:t.streak})}`:"",t?.energy===null&&t?.streak===null?r("(能量 / 连登读数本次未取到)"):""]}),a.map(v=>{const w=y(v.code);return s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:v.status==="claimed"?"ck-task-tick done":"ck-task-tick",children:v.status==="claimed"?"✓":"·"}),s.jsxs("span",{title:v.description||v.source||v.code,children:[v.title||v.code,v.target>1?` (${v.current}/${v.target})`:""]}),w?s.jsx("span",{className:"ck-task-pts",children:w.message}):null,s.jsx("span",{className:"ck-task-st",children:v.unforgeable?s.jsx(ze,{variant:"outline",shape:"tag",children:r("需真实操作")}):v.supported?v.status==="claimed"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):v.status==="completed"?s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")}):v.locked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("未解锁")}):s.jsx(ze,{variant:"warning",shape:"tag",children:r("可完成")}):s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不支持")})})]},v.code)}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🐾"}),s.jsxs("span",{children:[r("猫猫旅行"),p&&p.hasBuddy===!0?`:${p.buddyName||r("已领养")} · ${p.state==="traveling"?r("在途"):p.state==="arrived"?r("可领奖"):p.state==="idle"?p.dailyLimitReached?r("今日已派出"):r("可派出"):p.state??""}`:p&&p.hasBuddy===!1?`:${r("未领养(领养需先完成当日对话量)")}`:":"+(p?.error?String(p.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningTravel===!0||t?.status!=="loaded",onClick:()=>{KG(e.id)},children:t?.runningTravel?r("执行中…"):r("巡检一次")})})]}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🎓"}),s.jsxs("span",{children:[r("开学季活动"),h&&h.inPeriod===!0?`:${r("进行中")}${h.lottery?.balance!==void 0&&h.lottery?.balance!==null?` · ${r("抽奖机会 {n} 次",{n:h.lottery.balance})}`:""}`:h&&h.inPeriod===!1?`:${r("非活动期")}`:":"+(h?.error?String(h.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningSchool===!0||t?.status!=="loaded",title:r("执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)"),onClick:()=>{GG(e.id,!0)},children:t?.runningSchool?r("执行中…"):r("执行并抽奖")})})]}),t?.schoolText?s.jsx("div",{className:"ck-fold-note",children:t.schoolText}):null,t?.lotteryText?s.jsx("div",{className:"ck-fold-note",children:t.lotteryText}):null]}):null]})}function A7({group:e}){return s.jsxs("div",{className:"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",style:{cursor:"default"},children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:rM[e.id]??""})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")})})]}),e.id==="qoder-intl"?s.jsx(aM,{}):null]})}function R7({store:e}){const t=e.snapshot,[a,o]=x.useState(null);x.useEffect(()=>{let N=!0;return(async()=>{try{const T=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:1});N&&o(Number(T?.total)||0)}catch{}})(),()=>{N=!1}},[e.version]);const c=t?.daily,d=t?.auto,f=(c?.outOfScope??[]).reduce((N,k)=>N+(Number(k.count)||0),0),p=t?.extras.onboarding??[],h=p.filter(N=>e.onboarding.get(N.id)?.status==="loaded"),b=p.reduce((N,k)=>N+(e.onboarding.get(k.id)?.unclaimed??0),0),y=t?.extras.plans??[],v=t?.extras.growth??[],w=Array.isArray(d?.schedules)?d.schedules:[],j=w.filter(N=>N.enabled===!0).length,S=XG(d);return s.jsxs("div",{children:[s.jsxs("div",{className:"ck-stats",children:[s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("今日签到进度")}),s.jsx("div",{className:"ck-stat-value",children:c?s.jsxs(s.Fragment,{children:[" ",c.todayDone,s.jsxs("small",{children:[" / ",c.todayEligible]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx(tf,{className:"ck-stat-bar",value:c&&c.todayEligible>0?c.todayDone/c.todayEligible*100:0}),s.jsx("div",{className:"ck-stat-foot",children:f>0?r("另有 {n} 个账号不参与每日签到",{n:f}):r("全部账号均可签到")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("schedule")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("schedule")},children:[s.jsx("div",{className:"ck-stat-label",children:r("定时签到")}),s.jsx("div",{className:"ck-stat-value",children:d?s.jsxs(s.Fragment,{children:[j,s.jsxs("small",{children:[" / ",w.length," ",r("条启用")]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx("div",{className:"ck-stat-foot",children:d?.enabled!==!0?r("总开关已关闭 · 在「定时签到」页打开"):S?r("下次 {date} · 点此管理条目",{date:Fs(S)}):r("暂无启用的条目 · 点此添加")})]}),s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("待领新手福利")}),s.jsx("div",{className:"ck-stat-value",children:p.length?s.jsxs(s.Fragment,{children:[b,s.jsxs("small",{children:[" ",r("项")]})]}):s.jsx("span",{className:"ck-pending",children:r("无")})}),s.jsx("div",{className:"ck-stat-foot",children:p.length?r("已有结果 {checked} / 共 {total} 个账号",{checked:h.length,total:p.length}):r("没有支持新手福利的账号")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("records")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("records")},children:[s.jsx("div",{className:"ck-stat-label",children:r("累计签到记录")}),s.jsx("div",{className:"ck-stat-value",children:a===null?s.jsx("span",{className:"ck-pending",children:"—"}):a}),s.jsx("div",{className:"ck-stat-foot",children:r("每账号一条明细 · 点此查看「签到记录」")})]})]}),s.jsxs("div",{className:"ck-main",children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("每日签到")}),s.jsx("span",{className:"panel-sub",children:r("点击行展开账号明细 · 单账号签到不受范围限制")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:e.runningAll||d?.running===!0,onClick:()=>{VG()},children:e.runningAll||d?.running===!0?r("签到中…"):r("立即全部签到")})]}),s.jsxs("div",{children:[(c?.providers??[]).map(N=>N.totalCount>0?s.jsx(k7,{group:N,expanded:e.expanded.has(N.id)},N.id):s.jsx(A7,{group:N},N.id)),(c?.outOfScope??[]).length>0?s.jsx("div",{className:"ck-fold-note",children:r("不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。",{list:c.outOfScope.map(N=>r("{label} ×{count}({reason})",{label:N.label,count:N.count,reason:N.reason})).join(r(";"))})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("新手福利")}),s.jsx("span",{className:"panel-sub",children:r("一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单")}),p.length>0?s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>{for(const N of p)N.settled&&typeof N.settled=="object"||lj(N.id)},children:r("全部查询")}):null]}),p.length?s.jsx("div",{children:p.map(N=>s.jsx(C7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活动福利")}),s.jsx("span",{className:"panel-sub",children:r("限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取")})]}),y.length>0?s.jsx("div",{children:y.map(N=>s.jsx(T7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有可领套餐的账号(ZCode 未添加)。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("成长任务")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细")})]}),v.length>0?s.jsx("div",{children:v.map(N=>s.jsx(E7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持成长任务的账号(需要 WorkBuddy 国内版)。")})]})]})]})}function O7(){const e=j7(),t=e.snapshot;if(x.useEffect(()=>{Ol()},[]),x.useEffect(()=>{window.wbApp?.renderTopbarStatus?.()},[e.version]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取签到数据…")})]});const a=t?.auto,o=a?.enabled===!0;return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{Ol()},children:r("重试")})]}):null,s.jsxs("div",{className:"ck-tabs",children:[s.jsx(In,{options:y7,value:e.tab,onValueChange:c=>DO(c),"aria-label":r("签到中心分区")}),s.jsx(ze,{id:"checkin-badge",className:"ml-auto",variant:a?o?"success":"outline":"destructive","data-tone":a?o?"ok":"":"bad",children:a?o?a?.lastFiredToday?r("今日已执行"):r("已开启"):r("已关闭"):r("不可用")})]}),e.tab==="center"?s.jsx(R7,{store:e}):null,e.tab==="schedule"?s.jsx(m7,{}):null,e.tab==="records"?s.jsx(v7,{}):null]})}const lM='.page[data-page="checkin"]';let oM=!1;function iM(){if(oM)return;const e=document.querySelector(lM);e&&(oM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(O7,{})))}const cM=()=>Ol();window.wbCheckinPanel={load:cM},document.querySelector(lM)?iM():document.addEventListener("DOMContentLoaded",iM,{once:!0}),Pe().wbApp?.currentPage==="checkin"&&cM();function M7(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function D7({options:e,onSettle:t}){const{title:a="确认操作",html:o="",text:c="",okText:d="确定",okClass:f="primary",bodyClass:p="danger-zone",cancelText:h="取消"}=e,b=x.useRef(null);return x.useEffect(()=>{function y(v){v.key==="Escape"&&t(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t]),x.useEffect(()=>{function y(v){v.target?.dataset.slot==="alert-dialog-overlay"&&t(!1)}return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[t]),s.jsx(vV,{open:!0,onOpenChange:y=>{y||t(!1)},children:s.jsxs(SV,{initialFocus:b,showCloseButton:!0,children:[s.jsx(NV,{className:"pr-10",children:s.jsx(wV,{children:a})}),s.jsx(kV,{children:s.jsx(TV,{tone:p==="danger-zone"?"danger":"neutral",dangerouslySetInnerHTML:{__html:o||M7(c).replace(/\n/g,"
    ")}})}),s.jsxs(CV,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:b,variant:"outline",onClick:()=>t(!1),children:h}),s.jsx(se,{variant:f==="danger"?"destructive":"default",onClick:()=>t(!0),children:d})]})]})})}let qf=null,Au=null,Og=null;function I7(){qf&&(qf.unmount(),qf=null),Au&&(Au.remove(),Au=null)}function uM(e){const t=Og;Og=null,I7(),t?.(e)}function P7(e={}){return new Promise(t=>{Og&&uM(!1),Og=t,Au=document.createElement("div"),document.body.append(Au),qf=vn.createRoot(Au),qf.render(s.jsx(D7,{options:e,onSettle:uM}))})}window.wbConfirm={ask:P7};const _7=r("Base URL 填进客户端的「API 地址 / Base URL」栏;对话协议按客户端支持的类型三选一(Chat Completions / Responses / Anthropic Messages),三者共用同一套模型与账号池,可随时切换;鉴权用「网关 Key」页里任一启用 Key。");function Gf({id:e,name:t,note:a}){return s.jsxs("div",{className:"ep-row",children:[s.jsxs("div",{className:"ep-head",children:[s.jsx("span",{className:"ep-name",children:t}),s.jsx("span",{className:"ep-note",children:a})]}),s.jsxs("div",{className:"ep-line",children:[s.jsx("code",{className:"ep-value",id:e,children:"—"}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)]","data-copy-from":e,title:r("复制地址"),children:"⧉"})]})]})}function L7(){return s.jsxs("section",{className:"panel ep-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("接口地址")}),s.jsx("span",{className:"tip-q","data-tip":_7})]}),s.jsxs("div",{className:"ep-list",children:[s.jsx(Gf,{id:"api-base",name:"Base URL",note:r("填进客户端的「API 地址 / Base URL」")}),s.jsx("div",{className:"ep-group",children:r("对话协议(按客户端支持的类型选一行)")}),s.jsx(Gf,{id:"api-chat",name:"OpenAI Chat Completions",note:r("多数 OpenAI 兼容客户端的默认协议")}),s.jsx(Gf,{id:"api-responses",name:"OpenAI Responses",note:r("OpenAI 新协议(Codex、新版 SDK)")}),s.jsx(Gf,{id:"api-messages",name:"Anthropic Messages",note:r("Claude Code / Anthropic SDK(token 计数:/v1/messages/count_tokens)")}),s.jsx("div",{className:"ep-group",children:r("模型清单")}),s.jsx(Gf,{id:"api-models",name:r("模型列表"),note:r("客户端自动拉取可用模型;不受鉴权限制,配 Key 之前就能拉")})]}),s.jsx("div",{className:"panel-foot",children:s.jsxs("span",{children:[r("鉴权用「网关 Key」页里任一"),s.jsx("b",{children:r("启用")}),r("的 Key:请求带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("。一把启用的 Key 都没有时不鉴权(默认网关只监听 127.0.0.1;在设置页开启「局域网访问」后监听所有网卡,鉴权与安全闸门随之启用)。")]})})]})}const dM='.page[data-page="docs"]';let fM=!1;function pM(){if(fM)return;const e=document.querySelector(dM);e&&(fM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(L7,{})))}document.querySelector(dM)?pM():document.addEventListener("DOMContentLoaded",pM,{once:!0});function ia(){return window}function fj(e){return e instanceof Error?e.message:String(e)}function Kf(e,t){ia().wbApp?.toast?.(e,t)}function z7(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const pj=[{key:"name",label:r("名称")},{key:"key",label:"Key"},{key:"time",label:r("创建时间")},{key:"state",label:r("启用")},{key:"act",label:r("操作"),align:"right"}],B7={name:"cell-name",key:"cell-key",time:"cell-time",state:"cell-state state",act:"cell-act r"},mM='.page[data-page="keys"]';let Mg=null,mj=null;function hM(){return Mg?Mg.apply([...pj]):pj.map(e=>({...e,align:e.align??"left"}))}function gM(){ia().wbColSettings?.syncStaticHead?.("keys",document.querySelector("table.keys-table"))}function H7(){if(Mg)return;const e=ia().wbColSettings?.register({id:"keys",label:r("网关 Key 表"),columns:pj,mount:()=>document.querySelector('.page[data-page="keys"] .panel-head .head-actions'),onChange:()=>{gM(),mj?.()}});e&&(Mg=e,gM())}function U7(e){return Array.isArray(e?.keys)?e.keys:[]}function V7(e){return Array.isArray(e?.providers)?e.providers:[]}function F7(e){const t=e?.modelsByProvider;return t&&typeof t=="object"?t:{}}function hj(e){return ia().wbProviders?.labelOf?.(e)||e}function $7(e,t,a){const o=new Map,c=f=>{const p=String(f??"").trim();if(!p)return;const h=p.toLowerCase();o.has(h)||o.set(h,p)};t.forEach(f=>{const p=e[f]??e[String(f).toLowerCase()];Array.isArray(p)&&p.forEach(c)}),a.forEach(c);const d=[...o.values()].map(f=>({value:f,label:r(f)}));return d.sort((f,p)=>f.value.toLowerCase()String(t)):[]}function bM(e,t){const a=new Map(t.map(c=>[c.value.toLowerCase(),c.value])),o=new Set;return e.forEach(c=>{const d=a.get(String(c).toLowerCase());d&&o.add(d)}),t.filter(c=>o.has(c.value)).map(c=>c.value)}function Y7({target:e,providers:t,modelsByProvider:a,onClose:o,onSaved:c}){const d=e?.id??null,f=!!d,[p,h]=x.useState(e?.name??""),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(!1),N=x.useRef(!1),[k,T]=x.useState(()=>xM(e?.allowedProviders)),[D,C]=x.useState(()=>xM(e?.allowedModels)),A=x.useMemo(()=>t.map(H=>({value:String(H.id),label:r(String(H.label??H.id))})),[t]),R=x.useMemo(()=>bM(k,A),[k,A]),I=x.useMemo(()=>$7(a,R,D),[a,R,D]),P=x.useMemo(()=>bM(D,I),[D,I]),O=I.length?r("没有匹配的选项"):R.length?r("这几家当前没有可用模型(账号未登录或清单为空)"):r("请先在上面选择可用提供商");function _(){N.current=!1,S(!1)}async function L(){if(!N.current){N.current=!0,S(!0),w(r("保存中…"));try{const H=ia().workbuddyDesktop;if(!H)throw new Error(r("后端桥不可用"));if(d){const Q=await H.updateKey(d,{allowedProviders:R,allowedModels:P});_(),c(Q),o(),Kf(r("✅ 可用范围已保存"));return}const B=b.trim();if(B&&B.length<8){w(r("Key 至少需要 8 个字符"));return}const z=await H.createKey({name:p.trim(),key:B||void 0,allowedProviders:R,allowedModels:P});_(),c(z,z?.created?.id),o(),Kf(r("✅ Key 已创建,记得复制给客户端"))}catch(H){w(r("保存失败:{reason}",{reason:fj(H)}))}finally{_()}}}return s.jsx(Qt,{open:!0,onOpenChange:(H,B)=>{if(!H){if(N.current){B.cancel();return}o()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:f?r("可用范围 · {name}",{name:e?.name||r("未命名")}):r("新建 API Key")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-name",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("名称")}),s.jsx($e,{id:"key-name",type:"text",maxLength:60,placeholder:r("例如 Cursor / 公司电脑"),autoComplete:"off",value:p,disabled:f,onChange:H=>h(H.currentTarget.value)})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-value",className:"text-[12.5px] whitespace-nowrap text-subtle",children:"Key"}),s.jsx($e,{id:"key-value",type:"text",placeholder:r("留空自动生成;手填至少 8 个字符"),autoComplete:"off",spellCheck:!1,value:b,onChange:H=>y(H.currentTarget.value),onKeyDown:H=>{H.key==="Enter"&&L()}})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用提供商")}),s.jsx(Bh,{value:R,onValueChange:T,options:A,placeholder:r("留空 = 不限制"),searchPlaceholder:r("搜索提供商…"),"aria-label":r("可用提供商"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用模型")}),s.jsx(Bh,{value:P,onValueChange:C,options:I,placeholder:r("留空 = 不限制"),emptyHint:O,searchPlaceholder:r("搜索模型…"),"aria-label":r("可用模型"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsx("p",{children:r("留空表示不限制;同时设置时请求需同时满足两个条件(模型在白名单内且路由到允许的提供商)。 「可用模型」的候选跟着上面勾选的提供商走:没勾提供商时它是空的(还没有约束范围), 勾了几家就列出这几家能收的全部对外名。")}),s.jsx("p",{id:"key-restrict-summary",children:K7(R,P)})]}),s.jsx("div",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:o,disabled:j,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{L()},children:r(f?"保存范围":"创建")})]})]})})}let Dg=null;async function X7(){await Dg?.load()}function Q7(){Dg?.render()}function Z7(){const[e,t]=x.useState(null),[a,o]=x.useState(()=>new Set),[c,d]=x.useState(()=>new Set),[f,p]=x.useState(null),[,h]=x.useState(0),b=x.useRef(new Set),y=x.useRef(!1),v=x.useCallback(L=>{t(L)},[]),w=x.useCallback(L=>{L&&Array.isArray(L.keys)&&v(L)},[v]),j=x.useCallback(async()=>{if(!y.current){y.current=!0;try{const L=ia().workbuddyDesktop;if(!L)throw new Error(r("后端桥不可用"));v(await L.getKeys()??null)}catch(L){Kf(r("读取 Key 列表失败:{reason}",{reason:fj(L)}),"err")}finally{y.current=!1}}},[v]);async function S(L,H,B){if(!b.current.has(L)){b.current.add(L),d(new Set(b.current));try{w(await H()),B&&Kf(B)}catch(z){Kf(r("操作失败:{reason}",{reason:fj(z)}),"err")}finally{b.current.delete(L),d(new Set(b.current))}}}function N(L){o(H=>{const B=new Set(H);return B.has(L)?B.delete(L):B.add(L),B})}async function k(L){const H=ia().workbuddyDesktop,B=ia().wbConfirm?.ask;if(!H||!B)return;const z=z7(L.name||L.masked||L.id);await B({title:r("删除网关 Key"),html:r("确定删除 Key「{name}」?使用它的客户端会立刻无法访问。",{name:z}),okText:r("删除"),okClass:"danger"})&&S(L.id,()=>H.deleteKey(L.id),r("Key 已删除"))}function T(L,H){const B=ia().workbuddyDesktop;B&&S(L.id,()=>B.updateKey(L.id,{enabled:H}),r(H?"Key 已启用":"Key 已停用"))}x.useLayoutEffect(()=>(Dg={load:j,render:()=>h(L=>L+1)},mj=()=>h(L=>L+1),H7(),h(L=>L+1),()=>{Dg=null,mj=null}),[j]),x.useEffect(()=>{ia().wbApp?.currentPage==="keys"&&j()},[j]),x.useEffect(()=>{ia().wbApp?.renderTopbarStatus?.()},[e]);const D=U7(e),C=ig(D.length,"keys"),A=C.paged?C.slice(D):D,R=hM(),I=e?.authRequired===!0,P=A.filter(L=>L.enabled).length,O=I?r("已启用鉴权 · {n} 把 Key 生效",{n:P}):r("未启用鉴权");function _(L,H,B){switch(L){case"name":return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t",children:H.name||r("未命名")})}),s.jsx("div",{className:"mname",title:G7(H),children:q7(H)})]});case"key":{const z=a.has(H.id);return s.jsxs("div",{className:"keycell",children:[s.jsx("code",{className:"kv",children:z?H.key:H.masked}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>N(H.id),children:r(z?"隐藏":"显示")}),s.jsx(se,{size:"sm",variant:"ghost","data-copy":H.key,title:r("复制 Key"),children:r("复制")})]})}case"time":return s.jsx("span",{className:"muted",children:H.createdAt?ia().wbApp?.formatTime?.(H.createdAt):"—"});case"state":return s.jsx(hs,{checked:H.enabled===!0,disabled:B,"aria-label":r("启用「{name}」",{name:H.name||r("未命名")}),onCheckedChange:z=>T(H,z)});case"act":return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:B,onClick:()=>p({key:H}),children:r("可用范围")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:B,onClick:()=>{k(H)},children:r("删除")})]});default:return null}}return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("API Key 列表")}),s.jsx(ze,{id:"keys-status",variant:I?"success":"warning","data-tone":I?"ok":"warn",children:O}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"default",onClick:()=>p({key:null}),children:r("+ 新建 Key")})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table keys-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"k-name","data-col":"name"}),s.jsx("col",{className:"k-key","data-col":"key"}),s.jsx("col",{className:"k-time","data-col":"time"}),s.jsx("col",{className:"k-state","data-col":"state"}),s.jsx("col",{className:"k-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"name",children:r("名称")}),s.jsx("th",{"data-col":"key",children:"Key"}),s.jsx("th",{"data-col":"time",children:r("创建时间")}),s.jsx("th",{"data-col":"state",children:r("启用")}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{children:A.length?A.map(L=>{const H=c.has(L.id);return s.jsx("tr",{className:L.enabled?"":"off","data-id":L.id,children:R.map(B=>s.jsx("td",{className:`${B7[B.key]??""} ta-${B.align}`,children:_(B.key,L,H)},B.key))},L.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:R.length,className:"empty",children:r(e?"还没有 Key,当前不鉴权":"加载中…")})})})]})}),s.jsx(Li,{leading:s.jsxs("span",{children:[r("客户端请求需带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("; 修改后立即生效,本程序自身会自动使用第一把启用的 Key。每把 Key 可单独限制"),s.jsx("b",{children:r("可用提供商")}),r("与"),s.jsx("b",{children:r("可用模型")}),r("(行内「可用范围」):留空 = 不限制,两个都设时 按交集生效 —— 被限制的模型对这把 Key 表现为「不存在」(拉 /v1/models 也看不到它), 提供它的家不在可用列表里时请求同样被拒。")]}),total:D.length,range:C.paged?{start:C.rangeStart,end:C.rangeEnd}:null,page:C.page,pageCount:C.pageCount,size:C.size,onSizeChange:C.setSize,onPageChange:C.goto}),f?s.jsx(Y7,{target:f.key,providers:V7(e),modelsByProvider:F7(e),onClose:()=>p(null),onSaved:(L,H)=>{H&&o(B=>new Set(B).add(H)),w(L)}}):null]})}let vM=!1;function yM(){if(vM)return;const e=document.querySelector(mM);e&&(vM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(Z7,{})))}document.querySelector(mM)?yM():document.addEventListener("DOMContentLoaded",yM,{once:!0}),window.wbKeysPanel={load:X7,render:Q7,visibleColumns:hM};const W7="login-app",J7=x.createElement("panel-captcha",{id:"captcha"});function e9(){return s.jsxs("div",{className:"w-[min(400px,100%)] rounded-lg border border-border bg-card p-[36px_34px_30px] shadow-3",children:[s.jsxs("div",{className:"mb-[26px] flex flex-col items-center gap-3 text-center",children:[s.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Agent2API",className:"size-[52px] rounded-[12px] shadow-[0_6px_18px_rgba(0,122,255,0.35)]",children:[s.jsx("rect",{width:"24",height:"24",rx:"5.4",fill:"#007AFF"}),s.jsxs("g",{fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M5.23 9.24h10.71"}),s.jsx("path",{d:"M15.94 6.72 18.77 9.24 15.94 11.76"}),s.jsx("path",{d:"M18.77 14.76H8.06"}),s.jsx("path",{d:"M8.06 12.24 5.23 14.76 8.06 17.28"})]})]}),s.jsxs("div",{children:[s.jsx("h1",{className:"m-0 text-[21px] font-bold tracking-[0.2px]",children:"Agent2API"}),s.jsx("div",{className:"text-[12.5px] text-muted-foreground",children:r("OpenAI 兼容网关 · 管理面板")})]})]}),s.jsx("div",{id:"mode-tip",className:"mb-[18px] text-center text-[13px] text-muted-foreground"}),s.jsxs("form",{id:"form",autoComplete:"on",children:[s.jsx(Je,{htmlFor:"username",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("账号")}),s.jsx($e,{id:"username",autoComplete:"username",placeholder:r("管理员账号")}),s.jsx(Je,{htmlFor:"password",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("密码")}),s.jsx($e,{id:"password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位")}),J7,s.jsx(se,{id:"submit",type:"submit",size:"lg",className:"w-full",children:r("继续")}),s.jsx("div",{id:"error",className:"mt-3 min-h-5 text-center text-[13px] whitespace-pre-wrap text-destructive"})]}),s.jsx("div",{className:"mt-[22px] text-center text-[12px] text-muted-foreground",children:r("登录后可在「网关 Key」页为 API 客户端创建密钥")})]})}function t9(){const e=document.getElementById(W7);e&&Cs.flushSync(()=>{vn.createRoot(e).render(s.jsx(e9,{}))})}t9();function Lr(){return window}function gj(e){return e instanceof Error?e.message:String(e)}function Ig(e,t){Lr().wbApp?.toast?.(e,t)}const wM=1e3,n9=ag,s9=500,jM="workbuddy-desktop-logs-range",xj="workbuddy-desktop-logs-filters",r9=300,a9="~/.agent2api/logs.jsonl",bj=["today","7","30","month","all"],vj="all",l9={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},o9=bj.map(e=>({value:e,label:l9[e]})),yj=[{value:"",label:r("全部级别")},{value:"debug",label:r("debug 及以上")},{value:"info",label:r("info 及以上")},{value:"warn",label:r("warn 及以上")},{value:"error",label:r("仅 error")}],i9=r("全部级别"),SM=r("全部分类"),c9={debug:r("调试"),info:r("信息"),warn:r("警告"),error:r("错误")};let Pg=wM,_g=!0,wj=!1,jj=!1,Sj=!1,Nj=null,Eo=null,kj=null,Lg=null,Cj=!1,Tj=!1;const Ej={level:"",category:"",keyword:""};function u9(){const e=Lr().wbFilterMemory;if(!e)return{...Ej};Cj=!0;const t=e.load(xj,{...Ej});return{level:yj.some(a=>a.value===t.level)?t.level:"",category:t.category,keyword:t.keyword}}function zg(e){Lr().wbFilterMemory?.save(xj,{level:e.level||"",category:e.category||"",keyword:e.keyword.trim()||""})}function d9(){try{const e=localStorage.getItem(jM);return e!==null&&bj.includes(e)?e:vj}catch{return vj}}function f9(e){try{localStorage.setItem(jM,e)}catch{}}function Bg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function p9(e){const t=new Date;switch(e){case"today":return Bg(t);case"7":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Bg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function m9(e){if(!e)return"—";const t=new Date(e),a=d=>String(d).padStart(2,"0"),o=`${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`,c=`${a(t.getMonth()+1)}-${a(t.getDate())}`;return t.getFullYear()===new Date().getFullYear()?`${c} ${o}`:`${t.getFullYear()}-${c} ${o}`}function h9(e){const t=e.data;if(!t)return"";const a=[];return(t.from||t.to)&&a.push([t.from,t.to].filter(Boolean).join(" → ")),t.model&&a.push(r("模型 {model}",{model:t.model})),t.resetAtText?a.push(r("{time} 恢复",{time:t.resetAtText})):t.status&&!t.from&&!t.to&&a.push(`HTTP ${t.status}`),a.length?a.join(" · "):""}function Aj(e){return Array.isArray(e?.entries)?e.entries:[]}function Hg(e,t,a){const o=Math.max(1,a==="all"?1:Math.ceil(t.length/a));return Math.min(Math.max(1,e),o)}function Rj(e,t){return Object.hasOwn(e,t)}function g9(e){const t={};if(e&&typeof e=="object")for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function NM(e,t){const a=new URLSearchParams,o=e.keyword.trim(),c=p9(t);return e.level&&a.set("level",e.level),e.category&&a.set("category",e.category),o&&a.set("keyword",o),c!==null&&a.set("start",String(c)),a}function x9(e,t){const a=NM(e,t);return a.set("limit",String(s9)),a.toString()}function b9(e,t){return NM(e,t).toString()}function v9(e){Nj=e||null,Lr().wbApp?.updateLogsBadge?.(Nj)}async function y9(){if(!wj)try{const e=await Lr().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="logsAutoRefresh");Oj(t||null),wj=Array.isArray(e?.tasks)}catch(e){console.warn("读取日志自动刷新间隔失败,按默认 10 秒:",gj(e)),Oj(null)}}function Oj(e){wj=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(_g=e.enabled!==!1,Pg=e.unit==="minutes"?t*6e4:t*1e3):(_g=!0,Pg=wM),Eo?.applyAutoConfig(Pg,_g)}async function w9(e={}){await Eo?.load(e)}function j9(e){if(!Eo){Lg={data:e??null};return}Eo.render(e)}function S9(){return Nj}async function N9(e){if(!Eo){kj=e;return}await Eo.showCategory(e)}const k9={entries:[],total:0,matched:0,file:a9,categories:{},loaded:!1};function Mj(e,t){return{entries:Aj(e),total:Number(e?.total)||0,matched:Number(e?.matched)||0,file:e?.file||t.file,categories:Object.keys(t.categories).length?t.categories:g9(e?.categories),loaded:!0}}function C9(e){return e.loaded?e.total?r("没有符合筛选条件的日志"):r("暂无日志"):r("正在加载日志…")}function T9(){const[e,t]=x.useState(k9),[a,o]=x.useState(u9),[c,d]=x.useState(d9),[f,p]=x.useState(1),[h,b]=x.useState(()=>lg("logs")),[y,v]=x.useState(null),[w,j]=x.useState(()=>({ms:Pg,enabled:_g})),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),T=x.useRef(null),D=x.useRef(a),C=x.useRef(c),A=x.useRef(f),R=x.useRef(h),I=x.useRef(e),P=x.useCallback(re=>{const de={...D.current,...re};return D.current=de,o(de),de},[]),O=x.useCallback(re=>{C.current=re,d(re)},[]),_=x.useCallback(re=>{A.current=re,p(re)},[]),L=x.useCallback(re=>{R.current=re,b(re),og("logs",re)},[]),H=x.useCallback(re=>{I.current=re,t(re)},[]),B=x.useCallback(()=>{if(Cj)return;const re=Lr().wbFilterMemory;if(!re||(Cj=!0,Tj))return;const de=re.load(xj,{...Ej});P({level:de.level,category:de.category,keyword:de.keyword})},[P]),z=x.useCallback(async(re={})=>{const{silent:de=!1,resetPage:ke=!1}=re;ke&&_(1),y9(),B();const Ee=x9(D.current,C.current),ve=A.current;try{const he=Lr().workbuddyDesktop;if(!he)throw new Error(r("后端桥不可用"));const[ye,je]=await Promise.all([he.getLogs(Ee),he.getLogStats()]),xe=ke?0:S.current?.scrollTop??0,Te=Mj(ye,I.current);H(Te),_(Hg(A.current,Aj(ye),R.current)),N.current=A.current===ve?xe:0,v9(je),Object.keys(Te.categories).length&&D.current.category&&!Rj(Te.categories,D.current.category)&&(zg(P({category:""})),z({resetPage:!0}))}catch(he){de||(console.warn("读取运行日志失败:",gj(he)),H(Mj(null,I.current)),_(Hg(A.current,[],R.current)))}},[H,_,B]),Q=x.useCallback(re=>{re!==void 0&&(H(Mj(re,I.current)),_(Hg(A.current,Aj(re),R.current)))},[H,_]),K=x.useCallback(async re=>{if(Rj(I.current.categories,re)||await z({silent:!0}),!Rj(I.current.categories,re))return;const de=P({category:re});zg(de),_(1),await z({resetPage:!0}),Lr().wbApp?.showPage?.("logs",{persist:!0})},[P,_,z]);x.useEffect(()=>{if(Eo={load:z,render:Q,showCategory:K,applyAutoConfig:(de,ke)=>j({ms:de,enabled:ke})},Lg){const de=Lg;Lg=null,Q(de.data)}const re=kj;return re!==null?(kj=null,K(re)):z({silent:!0}),()=>{Eo=null,k.current!==null&&window.clearTimeout(k.current),k.current=null}},[z,Q,K]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const re=window.setInterval(()=>{document.hidden||Lr().wbApp?.currentPage!=="logs"||jj||(jj=!0,z({silent:!0}).finally(()=>{jj=!1}))},w.ms);return()=>{window.clearInterval(re)}},[w,z]),x.useLayoutEffect(()=>{const re=N.current;if(re===null)return;N.current=null;const de=S.current;de&&(de.scrollTop=re)});async function X(re,de,ke){if(!Sj){Sj=!0,v({which:re,label:de});try{await ke()}catch(Ee){Ig(r("操作失败:{error}",{error:gj(Ee)}),"err")}finally{Sj=!1,v(null)}}}async function q(){const re=b9(D.current,C.current),de=re.length>0,ke=de?r("确定清空当前筛选出的 {count} 条日志?清空后无法恢复。",{count:Number(I.current.matched)||0}):r("确定清空全部运行日志?清空后无法恢复。"),Ee=Lr().wbConfirm?.ask;Ee&&await Ee({title:r("清空运行日志"),html:ke,okText:r("清空"),okClass:"danger"})&&await X("clear",r("清空中…"),async()=>{const ve=Lr().workbuddyDesktop;if(!ve)throw new Error(r("后端桥不可用"));await ve.clearLogs(de?re:"all=1"),await z({resetPage:!0}),Ig(r("运行日志已清空"))})}async function $(){await X("export",r("导出中…"),async()=>{const re=Lr().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.exportLogs();if(!(!de||de.canceled)){if(de.count===0){Ig(r("暂无日志可导出"),"err");return}Ig(r("✅ 已导出 {count} 条日志到 {file}",{count:String(de.count),file:String(de.file)}))}})}function Y(re){const de=Hg(re,I.current.entries,R.current);de!==A.current&&(_(de),N.current=0)}function F(re){if(re===R.current)return;const de=I.current.entries.length,ke=de?(A.current-1)*(R.current==="all"?de:R.current):0;L(re),_(re==="all"?1:Math.floor(ke/re)+1),N.current=0}function G(re){Tj=!0,zg(P(re)),z({resetPage:!0})}function W(re){Tj=!0,P({keyword:re}),k.current!==null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,zg(D.current),z({resetPage:!0})},r9)}function le(re){const de=bj.includes(re)?re:vj;de!==C.current&&(O(de),f9(de),z({resetPage:!0}))}const M=e.entries,U=h!=="all",Z=Math.max(1,U?Math.ceil(M.length/h):1),ae=Math.min(Math.max(1,f),Z),ce=U?M.slice((ae-1)*h,ae*h):M,J=M.length?U?(ae-1)*h+1:1:0,ie=M.length?U?J+ce.length-1:M.length:0,ge=e.categories,ee=e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total});x.useEffect(()=>{const re=e.loaded?ee:"—";T.current!==re&&(T.current=re,Lr().wbApp?.renderTopbarStatus?.())},[e.loaded,ee]);function fe(re,de){const ke=re.level||"",Ee=h9(re);return s.jsxs("div",{className:`log-row ${ke}`,children:[s.jsx("span",{className:"log-rail",children:s.jsx("span",{className:`log-dot ${ke}`})}),s.jsxs("div",{className:"log-main",children:[s.jsxs("div",{className:"log-line",children:[s.jsx("span",{className:"log-cat",children:ge[re.category||""]||re.category}),s.jsx("span",{className:`log-lvl ${ke}`,children:c9[ke]||re.level}),s.jsx("span",{className:"msg",children:re.message})]}),Ee?s.jsx("div",{className:"log-extra-wrap",children:s.jsx("span",{className:"extra",children:Ee})}):null]}),s.jsx("span",{className:"time",children:m9(re.ts)})]},re.id??de)}const te=y?.which==="export",Ce=y?.which==="clear";return s.jsxs("section",{className:"panel",id:"logs-panel-events",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("系统事件")}),s.jsx(ze,{id:"logs-badge",variant:"outline","data-tone":"",children:e.loaded?ee:"—"}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-logs-export",variant:"outline",disabled:y!==null,onClick:()=>{$()},children:te?y?.label:r("导出")}),s.jsx(se,{id:"btn-logs-clear",variant:"destructive",disabled:y!==null,onClick:()=>{q()},children:Ce?y?.label:r("清空")})]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:o9,value:c,onValueChange:le,"aria-label":r("事件日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.level,onValueChange:re=>G({level:String(re??"")}),children:[s.jsx(mt,{id:"logs-level",className:"min-w-[120px]",title:r("按最低级别筛选"),"aria-label":r("按最低级别筛选"),children:s.jsx(pt,{children:yj.find(re=>re.value===a.level)?.label??i9})}),s.jsx(ht,{children:yj.map(re=>s.jsx(qe,{value:re.value,children:re.label},re.value))})]}),s.jsxs(ft,{value:a.category,onValueChange:re=>G({category:String(re??"")}),children:[s.jsx(mt,{id:"logs-category",className:"min-w-[120px]",title:r("按分类筛选"),"aria-label":r("按分类筛选"),children:s.jsx(pt,{children:a.category?ge[a.category]||a.category:SM})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:SM}),Object.entries(ge).map(([re,de])=>s.jsx(qe,{value:re,children:de},re))]})]}),s.jsxs(Ci,{className:"w-auto flex-auto",children:[s.jsx(Ei,{id:"logs-keyword",type:"search",placeholder:r("搜索消息关键词…"),autoComplete:"off","aria-label":r("搜索消息关键词"),value:a.keyword,onChange:re=>W(re.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]})]}),s.jsx("div",{className:"log-list",id:"log-list",ref:S,children:ce.length?ce.map((re,de)=>fe(re,de)):s.jsx("div",{className:"log-empty",children:C9(e)})})]}),s.jsx(Li,{total:M.length,range:U?{start:J,end:ie}:null,page:ae,pageCount:Z,size:h,sizes:n9,onSizeChange:F,onPageChange:Y})]})}const kM='.page[data-page="logs"]';let CM=!1;function TM(){if(CM)return;const e=document.querySelector(kM);e&&(CM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(T9,{})))}document.querySelector(kM)?TM():document.addEventListener("DOMContentLoaded",TM,{once:!0}),window.wbLogsPanel={load:w9,render:j9,lastStats:S9,applyAutoRefresh:Oj,showCategory:N9};const Ru=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Yf=["maxInputTokens","maxOutputTokens"],EM=["supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Ou={maxInputTokens:r("上下文窗口"),maxOutputTokens:r("最大输出 Token"),supportsToolCall:r("工具调用"),supportsImages:r("图片识别"),supportsVideo:r("视频识别"),supportsReasoning:r("支持思考")};r("工具"),r("图片"),r("视频"),r("思考");const E9=1e8;function Dj(e){return Yf.includes(e)}function Ij(e,t){if(Dj(e)){const a=typeof t=="number"?t:Number(t);return!Number.isFinite(a)||a<1||a>E9?null:Math.trunc(a)}return typeof t=="boolean"?t:null}function AM(e){const t={};if(!e||typeof e!="object")return t;const a=e;for(const o of Ru){const c=Ij(o,a[o]);c!==null&&(t[o]=c)}return t}function Pj(e){return Array.isArray(e)?Ru.filter(t=>e.some(a=>a===t)):[]}function _j(e){return AM(e?.capabilities)}function RM(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"—";const a=o=>o.toFixed(1).replace(/\.0$/,"");return t>=1e6?`${a(t/1e6)}M`:t>=1e3?`${a(t/1e3)}K`:String(Math.round(t))}function Xf(e){const t=Number(e);return!Number.isFinite(t)||t<=0?r("未声明"):Math.round(t).toLocaleString("en-US")}function Lj(e){return e===!0?"on":e===!1?"off":"unset"}function A9(e){const t=e?.reasoningLevels;if(!Array.isArray(t))return null;const a=t.filter(c=>typeof c=="string"&&c.trim()!=="");if(!a.length)return null;const o=e?.reasoningDefaultLevel;return{levels:a,defaultLevel:typeof o=="string"?o.trim():""}}function R9(e,t,a,o=""){const c=Ou[e],d=a?r("(已被手动覆盖,弹窗里可恢复继承)"):"",f=O9(o);if(Dj(e))return t==null?r("{label}:上游未声明{suffix}",{label:c,suffix:d}):r("{label}:{value}(对下游声明的精确值){origin}{suffix}",{label:c,value:Xf(t),origin:f,suffix:d});const p=Lj(t);return p==="on"?r("{label}:支持{origin}{suffix}",{label:c,origin:f,suffix:d}):p==="off"?r("{label}:不支持{origin}{suffix}",{label:c,origin:f,suffix:d}):r("{label}:上游未声明(下游会按不支持处理){suffix}",{label:c,suffix:d})}function Mu(e,t){const a=e?.capSources?.[t];return a==="upstream"||a==="modelsdev"||a==="user"?a:""}function O9(e){return e==="modelsdev"?r("(由 models.dev 补齐)"):e==="user"?r("(手动设定)"):""}function M9(e){const t={};for(const a of Ru){const o=e[a];Dj(a)?t[a]=Ij(a,o.trim()):t[a]=o==="on"?!0:o==="off"?!1:null}return t}function Qf(){return window}const OM=e=>String(e??"").trim().toLowerCase(),$s=(e,t)=>OM(e)===OM(t);function es(e){return typeof e=="string"&&e.startsWith("custom-")}function Fi(){return(Qf().wbProviders?.customList?.()||[]).filter(e=>es(e?.id))}function MM(){return Qf().wbProviders?.customList?.()||[]}function Ao(e){return Fi().find(t=>t.id===e)||null}function D9(e){const t=AM(e),a={};for(const o of Ru){const c=t[o];(typeof c=="number"||typeof c=="boolean")&&(a[o]=c)}return Object.keys(a).length?a:void 0}function DM(e){const t=(Array.isArray(e?.models)?e.models:[]).map(c=>{const d={id:String(c?.id??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""};return d.capabilities=D9(c?.capabilities),d}).filter(c=>c.id),a=(Array.isArray(e?.mappings)?e.mappings:[]).map(c=>({alias:String(c?.alias??"").trim(),target:String(c?.target??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""})).filter(c=>c.alias&&c.target);for(const c of t){const d=a.find(f=>$s(f.alias,c.id)&&$s(f.target,c.id));d&&(c.enabled=c.enabled&&d.enabled,c.reasoning=d.reasoning||c.reasoning)}const o=a.filter(c=>!($s(c.alias,c.target)&&t.some(d=>$s(d.id,c.target))));return{models:t,mappings:o}}function IM(e){const t=Ao(e);if(!t)return null;const a=DM(t),o=t.name||e,c=[],d=[];for(const f of a.models)c.push({id:f.id,name:"",provider:e,providerLabel:o,source:"",enabled:f.enabled,aliases:[],capabilities:f.capabilities||{},capOverrides:[]}),d.push({alias:f.id,target:f.id,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!0,dangling:!1,carried:!0});for(const f of a.mappings){const p=c.find(h=>$s(h.id,f.target));d.push({alias:f.alias,target:f.target,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!1,dangling:!p,carried:!!p}),p&&p.aliases.push(f.alias)}return{models:c,mappings:d}}async function $i(e,t){const a=Qf().wbProviders;if(!a?.customRequest)throw new Error(r("目录模块未就绪"));const o=Ao(e);if(!o)throw new Error(r("该自定义提供商已不存在(可能已被删除),请刷新后重试"));const c=DM(o),d=t(c);return await a.customRequest("POST","/api/custom-providers/models",{providerId:e,models:c.models,mappings:c.mappings}),await a.refreshCustom?.(),d}async function PM(e,t,a,o={}){const{enabled:c,reasoning:d}=o;await $i(e,f=>{if($s(t,a)){const h=f.models.find(b=>$s(b.id,a));if(!h)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:a}));return c!==void 0&&(h.enabled=!!c),d!==void 0&&(h.reasoning=String(d??"")),null}const p=f.mappings.find(h=>$s(h.alias,t)&&$s(h.target,a));if(p)return c!==void 0&&(p.enabled=!!c),d!==void 0&&(p.reasoning=String(d??"")),null;if(c===!1)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return f.mappings.push({alias:t,target:a,enabled:c??!0,reasoning:String(d??"")}),null})}async function _M(e,t,a){await $i(e,o=>{const c=o.mappings.length;if(o.mappings=o.mappings.filter(d=>!($s(d.alias,t)&&$s(d.target,a))),o.mappings.length===c)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return null})}async function LM(e,t){const a=String(t??"").trim();if(!a)throw new Error(r("请填写模型 ID"));await $i(e,o=>{if(o.models.some(c=>$s(c.id,a)))throw new Error(r("模型「{name}」已存在(忽略大小写判重)",{name:a}));return o.models.push({id:a,enabled:!0,reasoning:""}),null})}async function I9(e,t){const a=(Array.isArray(t)?t:[]).map(o=>String(o??"").trim()).filter(Boolean);if(!a.length)throw new Error(r("没有选中任何模型"));return $i(e,o=>{let c=0;for(const d of a)o.models.some(f=>$s(f.id,d))||(o.models.push({id:d,enabled:!0,reasoning:""}),c++);return c})}async function zM(e,t,a){await $i(e,o=>{const c=o.models.find(f=>$s(f.id,t));if(!c)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:t}));const d={...c.capabilities||{}};for(const[f,p]of Object.entries(a))p==null?delete d[f]:d[f]=p;return c.capabilities=Object.keys(d).length?d:void 0,null})}async function BM(e,t){return $i(e,a=>{const o=a.mappings.length;a.mappings=a.mappings.filter(d=>!$s(d.target,t));const c=o-a.mappings.length;return a.models=a.models.filter(d=>!$s(d.id,t)),{removedMappings:c}})}async function P9(e){const t=Qf().wbProviders;if(!t?.customRequest)throw new Error(r("目录模块未就绪"));const a=await t.customRequest("POST","/api/custom-providers/fetch-models",{providerId:e}),o=(Array.isArray(a?.models)?a.models:[]).map(d=>String(d??"").trim()).filter(Boolean),c=await $i(e,d=>{let f=0;for(const p of o)d.models.some(h=>$s(h.id,p))||(d.models.push({id:p,enabled:!0,reasoning:""}),f++);return f});return{total:o.length,added:Number(c)||0}}Qf().wbModelsCustom={isCustom:es,list:Fi,listSource:MM,record:Ao,buildView:IM,setBinding:PM,removeMapping:_M,addModel:LM,addModels:I9,removeModel:BM,setCapabilities:zM,fetchModels:P9};const ca="__custom__",_9=["off","none","minimal","low","medium","high","xhigh","max"];function Zf(e,t){const a=HM(t);if(a.length)return a;const o=e?.reasoningLevels;return Array.isArray(o)&&o.length?o.filter(c=>typeof c=="string"):[..._9]}function HM(e){const t=e?.reasoningLevels;return Array.isArray(t)?t.filter(a=>typeof a=="string"&&a.trim()!==""):[]}function L9(e,t){const a=t.map(HM).filter(f=>f.length>0);if(!a.length||a.length!==t.length)return Zf(e);const[o,...c]=a,d=o.filter(f=>c.every(p=>p.includes(f)));return d.length?d:Zf(e)}function UM(e,t,a){return`${String(e??"").trim().toLowerCase()}${String(t??"").trim().toLowerCase()}${String(a??"").trim().toLowerCase()}`}function z9(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=typeof a?.reasoning=="string"?a.reasoning.trim():"";o&&t.set(UM(a.alias,a.target,a.provider),o)}return(a,o,c)=>t.get(UM(a,o,c))||""}function Wt(){return window}function Ro(e){return e instanceof Error?e.message:String(e)}function wr(e,t){Wt().wbApp?.toast?.(e,t)}function zj(e){const t=Wt().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function B9(e){const t=Wt().formatTime??Wt().wbApp?.formatTime;return String(t?.(e)??"")}const VM=e=>String(e??"").trim().toLowerCase(),Oo=(e,t)=>VM(e)===VM(t),FM=8,$M="workbuddy-desktop-models-filters",Bj=["all","enabled","disabled","mapped"],H9={all:r("全部"),enabled:r("已启用"),disabled:r("已禁用"),mapped:r("有映射")},U9=Bj.map(e=>({value:e,label:H9[e]})),Hj=["default","rate-asc","rate-desc"],V9={default:r("默认"),"rate-asc":r("倍率升序"),"rate-desc":r("倍率降序")},F9=Hj.map(e=>({value:e,label:V9[e]})),Uj=[{key:"check",label:r("选择"),align:"center"},{key:"model",label:r("上游模型")},{key:"rate",label:r("倍率")},{key:"source",label:r("来源")},{key:"budget",label:r("上下文 / 输出")},{key:"caps",label:r("能力")},{key:"alias",label:r("模型映射")},{key:"act",label:r("操作"),align:"right"}],qM=new Set(["rate","source"]),Wf="custom-all",Vj={models:[],mappings:[]},GM={provider:"all",state:"all",search:"",sort:"default"};function KM(){const e=Wt().wbFilterMemory;if(!e)return{...GM};const t=e.load($M,{...GM});return{provider:String(t.provider||"all"),state:Bj.includes(t.state)?t.state:"all",search:String(t.search||""),sort:Hj.includes(t.sort)?t.sort:"default"}}const Ug=KM();let YM=!!Wt().wbFilterMemory,Vg=!1,ts={provider:Ug.provider,stateFilter:Ug.state,search:Ug.search,sort:Ug.sort,data:null,expanded:new Set,pending:new Set,mapping:null,customModel:null,capability:null};const Fj=new Set;function Jf(){return ts}function $9(e){return Fj.add(e),()=>{Fj.delete(e)}}function Ps(e){const t={...ts,...e},a=$g(t),o=$g(ts)!==a;ts=a===t.provider?t:{...t,provider:a},G9(),o&&qg();for(const c of Fj)c()}function Fg(e){Wt().wbFilterMemory?.save($M,e)}function XM(){if(YM||Vg||!Wt().wbFilterMemory)return;YM=!0;const e=KM();(e.provider!==ts.provider||e.state!==ts.stateFilter||e.search!==ts.search||e.sort!==ts.sort)&&Ps(e)}function $g(e){const t=e.provider;return t==="all"||t===Wf||Fi().some(a=>a.id===t)||Array.isArray(e.data?.models)&&e.data.models.some(a=>(a.provider||"")===t)||!e.data||!$j()?t:"all"}function Du(){return $g(ts)}function $j(){return!!Wt().wbProviders}function Iu(){return Du()===Wf}function QM(){return Iu()||es(Du())}let ep=null;function qj(e){const t=Ao(e);return(!ep||ep.id!==e||ep.record!==t)&&(ep={id:e,record:t,view:IM(e)||Vj}),ep.view}let tp=null;function q9(){const e=MM();if(tp&&tp.directory===e)return tp.view;const t=[],a=[];for(const o of Fi()){const c=qj(String(o.id||""));t.push(...c.models||[]),a.push(...c.mappings||[])}return tp={directory:e,view:t.length||a.length?{models:t,mappings:a}:Vj},tp.view}function Gj(){const e=Du();return es(e)?qj(e):e===Wf?q9():ts.data||Vj}function np(){const e=Gj();return Array.isArray(e.models)?e.models:[]}function ZM(){const e=Gj();return Array.isArray(e.mappings)?e.mappings:[]}let WM=(e,t,a)=>"";function G9(){WM=z9(ZM())}function Kj(){const e=new Map,t=Array.isArray(ts.data?.models)?ts.data.models:[];for(const a of t){const o=a.provider||"";if(!o)continue;const c=e.get(o)||{label:a.providerLabel||o,n:0};c.n++,e.set(o,c)}return e}function K9(){const e=new Map;for(const t of Fi()){const a=String(t.id||"");if(!a)continue;const o=qj(a);e.set(a,{label:String(t.name||a),n:(o.models||[]).length})}return e}function Y9(){return[...Kj().keys()]}function X9(e){const a=(Array.isArray(ts.data?.models)?ts.data.models:[]).find(o=>o.provider===e);return Number(a?.refreshedAt)||0}function Yj(){const e=new Map;for(const t of np()){const a=t.provider||"";a&&!e.has(a)&&e.set(a,t.providerLabel||a)}return[...e].map(([t,a])=>({id:t,label:a}))}function JM(e){return e?np().filter(t=>(t.provider||"")===e).sort((t,a)=>+(t.enabled===!1)-+(a.enabled===!1)).map(t=>({id:t.id,label:t.name&&t.name!==t.id?r("{id}({name})",{id:t.id,name:t.name}):t.id,off:t.enabled===!1})):[]}function Q9(){const e=[],t=Wt().wbProviders?.all?.();if(Array.isArray(t))for(const a of t){const o=String(a?.id||"");o&&e.push({id:o,label:String(a?.label||o)})}for(const a of Fi()){const o=String(a.id||"");o&&e.push({id:o,label:String(a.name||o)})}return e.length?e:Yj()}let sp=null,Xj=null;function e2(){const e=sp?sp.apply(Uj):Uj;return QM()?e.filter(t=>!qM.has(t.key)):e}function qg(){Wt().wbColSettings?.syncStaticHead("models",Xj,QM()?qM:null)}function Z9(){if(sp)return;sp=Wt().wbColSettings?.register({id:"models",label:r("模型管理表"),columns:Uj,mount:()=>document.querySelector('.page[data-page="gateway"] .panel-head .head-actions'),buttonPlacement:"last",onChange:()=>{qg(),qi()}})||null,sp&&qi()}let Gg=0,Qj=!1;async function Kg({force:e=!1}={}){if(Qj&&!e)return;const t=++Gg;Qj=!0,XM();try{const a=await Wt().workbuddyDesktop?.getModelManage();if(t!==Gg)return;Ps({data:a&&Array.isArray(a.models)?a:null})}catch(a){if(t!==Gg)return;qi(),wr(r("读取模型清单失败:{message}",{message:Ro(a)}),"err")}finally{t===Gg&&(Qj=!1)}}async function t2(){try{await Wt().wbProviders?.refreshCustom?.()}catch{}await Kg({force:!0})}function qi(){Ps({})}function Gi(e){const t=e;if(t&&Array.isArray(t.models)){Ps({data:t});return}qi()}async function Yg(e,t,a,o){if(es(e))return PM(e,t,a,o);const c=Wt().workbuddyDesktop;if(!c)throw new Error(r("后端桥不可用"));return c.addModelMapping(t,a,e,o.reasoning,o.enabled)}async function W9(e,t,a){if(es(e))return _M(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.removeModelMapping(t,a,e)}async function J9(e,t){if(es(e))return LM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.addCustomModel(e,t)}async function n2(e,t){if(es(e))return BM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.removeCustomModel(e,t)}async function eK(e,t,a){if(es(e))return zM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.setModelCapabilities(e,t,a)}async function Zj(e,t,a){if(!ts.pending.has(e)){Ps({pending:new Set(ts.pending).add(e)});try{Gi(await t()),a&&wr(a)}catch(o){wr(r("操作失败:{message}",{message:Ro(o)}),"err")}finally{const o=new Set(ts.pending);o.delete(e),Ps({pending:o})}}}function rp(e){return Pu(e).some(t=>t.enabled!==!1)}function Pu(e){const t=e.provider||"",a=ZM().filter(p=>Oo(p.target,e.id)&&(!p.provider||Oo(p.provider,t))),o=new Map;for(const p of a){const h=String(p.alias).toLowerCase();(!o.has(h)||p.provider)&&o.set(h,p)}const c=String(e.id).toLowerCase(),d=o.get(c);o.delete(c);const f=[{alias:e.id,target:e.id,provider:t,enabled:e.enabled!==!1&&d?.enabled!==!1,isDefault:!0}];return f.push(...o.values()),f}const Ki=e=>`${e.provider||""}:${e.id}`,Wj=(e,t,a)=>`${e}:${t}:${a||""}`;function tK(e){Ps({expanded:new Set(ts.expanded).add(e)})}function nK(e){const t=new Set(ts.expanded);t.delete(e),Ps({expanded:t})}function sK(e){const t=Bj.includes(e)?e:"all";t!==ts.stateFilter&&(Vg=!0,Ps({stateFilter:t}),Fg({state:t}))}function rK(e){const t=Hj.includes(e)?e:"default";t!==ts.sort&&(Vg=!0,Ps({sort:t}),Fg({sort:t}))}function aK(e){Vg=!0,Ps({search:e}),Fg({search:e})}function ap(e){Ps({provider:String(e??"").trim()||"all"}),Fg({provider:ts.provider}),qg()}async function lK(e){const t=Wt().wbCustomProvidersUi;if(!t?.remove){wr(r("删除入口未就绪,请重试或重启应用"),"err");return}await t.remove(e)&&await Kg({force:!0})}function oK(){Wt().wbAccountAddForms?.openNewCustomForm?.()}function s2(e){Ps({mapping:e})}function iK(){Ps({mapping:null})}function cK(){const e=Du(),t=es(e);Ps({customModel:{provider:t||e!=="all"&&e!==Wf?e:"",locked:t}})}function uK(){Ps({customModel:null})}function r2(e,t){Ps({capability:{provider:e,id:t}})}function dK(){Ps({capability:null})}function a2(e,t){return np().find(a=>(a.provider||"")===e&&Oo(a.id,t))||null}function Jj(e){if(es(e)){const t=Ao(e)?.name;return typeof t=="string"&&t||e}return Wt().wbProviders?.labelOf?.(e)||e}function l2(){const e=Du(),t=es(e),a=t?Ao(e)?.name||e:r("内置提供商");Wt().wbModelsFetchModal?.open({providerId:e===Wf?"":e,custom:t,name:a,onDone:()=>qi(),onRefreshed:()=>{Kg({force:!0})}})}window.wbModelsPanel={render:qi,load:Kg,refreshAll:t2,refreshModels:l2,visibleColumns:e2,selectProvider:ap,builtinProviders:Y9,providerRefreshedAt:X9};function e0(e,t,a){return WM(e,t,a)}function fK(e){Xj=e}function pK(){const e=Xj;if(!e)return;const t=o=>Object.keys(o).some(c=>c.startsWith("__reactFiber$")||c.startsWith("__reactInternalInstance$"));for(const o of[...e.children])o.tagName==="TBODY"?o.id!=="models"&&o.remove():o.tagName==="TR"&&!t(o)&&o.remove();const a=e.querySelector("tbody#models");if(a)for(const o of[...a.children])t(o)||o.remove()}const mK=e=>[{value:"inherit",label:e},{value:"on",label:r("支持")},{value:"off",label:r("不支持")}];function hK(e){const t=Lj(e);return r(t==="on"?"支持":t==="off"?"不支持":"未声明")}function o2(e,t,a,o,c=""){const d=t!=null,f=Yf.includes(e)?Xf(t):hK(t);return a?o?r("已填写:对下游声明 {value}",{value:f}):r("已覆盖:对下游声明 {value}",{value:f}):o?r("未填写(下游按未声明处理)"):d?c==="modelsdev"?r("models.dev 补齐:对下游声明 {value}",{value:f}):r("继承上游:{value}",{value:f}):r("上游未声明(下游会按不支持处理)")}function gK(e,t,a){return a?Ru.filter(o=>{const c=e[o];return c!=null}):t}function xK(e,t){const a={};for(const o of Ru){const c=t.includes(o),d=e[o];Yf.includes(o)?a[o]=c&&typeof d=="number"?String(d):"":a[o]=c?d===!0?"on":"off":"inherit"}return a}function bK({context:e,onClose:t}){const a=es(e.provider),o=a2(e.provider,e.id),c=A9(o),d=_j(o),f=gK(d,Pj(o?.capOverrides),a),[p,h]=x.useState(()=>xK(d,f)),[b,y]=x.useState(""),[v,w]=x.useState(!1);if(!o)return s.jsx(Qt,{open:!0,onOpenChange:R=>{R||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const j=o.id,S=o.providerLabel||Jj(e.provider),N=r(a?"未声明":"继承上游"),k=r(a?"清除":"恢复继承");function T(R){const I=d[R];return D(R)?"":a?r("未填写"):typeof I=="number"?r("继承上游 {value}",{value:Xf(I)}):r("上游未声明")}function D(R){return f.includes(R)}function C(R,I){h(P=>({...P,[R]:I}))}async function A(){if(!v){for(const R of Yf){const I=p[R].trim();if(I&&Ij(R,I)===null){y(r("{label}要填 1 ~ 1 亿之间的整数(留空 = {inherit})",{label:Ou[R],inherit:N}));return}}w(!0),y(r("保存中…"));try{Gi(await eK(e.provider,e.id,M9(p))),t(),wr(r("✅ 已保存 {id} 的能力位({provider})",{id:j,provider:S}))}catch(R){y(r("保存失败:{message}",{message:Ro(R)})),w(!1)}}}return s.jsx(Qt,{open:!0,onOpenChange:(R,I)=>{if(!R){if(v){I.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[s.jsx("b",{className:"text-primary-fg",children:o.id}),r("({provider})",{provider:S})]}),Yf.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:`cap-${R}`,children:Ou[R]}),D(R)?s.jsx(se,{variant:"ghost",size:"2xs",disabled:v,title:r(a?"清除这一项(回到未声明)":"清除覆盖,回到上游声明值"),onClick:()=>C(R,""),children:k}):null]}),s.jsx($e,{id:`cap-${R}`,inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:T(R),disabled:v,value:p[R],onChange:I=>C(R,I.currentTarget.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A())}}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:o2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),EM.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:Ou[R]}),s.jsx(In,{options:mK(N),value:p[R],"aria-label":Ou[R],className:"self-start",onValueChange:I=>C(R,String(I))}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:o2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),c?s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 text-xs leading-[1.7] text-subtle",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{children:r("可配思考档位")}),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.levels.join(" / ")}),c.defaultLevel?s.jsxs("span",{children:[r("(默认 "),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.defaultLevel}),r(")")]}):null]}),s.jsx("div",{className:"mt-1",children:r("这是模型自己能配的档位(来自上游目录),只读;要改某一档请到映射弹窗里选。")})]}):null,s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("这几项是给"),s.jsx("b",{children:r("下游客户端")}),r("看的能力声明("),s.jsx("code",{children:"/v1/models"}),r(" 里的 "),s.jsx("code",{children:"max_input_tokens"})," / ",s.jsx("code",{children:"supports_*"}),r(" 与 "),s.jsx("code",{children:"input_modalities"}),r("),下游按它们决定发不发图片、按多大的窗口堆历史。"),s.jsx("b",{children:r("不影响网关的转发与路由")}),r("。上游清单给的值不准时,在这里改;"),r(a?"这家的清单是你自己登记的,不填的项下游按未声明处理。":"「恢复继承」会把这一项交还给上游清单的值。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:v,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{A()},children:r("保存")})]})]})})}function lp(){return window}const vK="你好",i2=4e3,yK=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],wK={chat_completions:"Chat Completions",responses:"Responses",anthropic:"Anthropic Messages"},jK="direct",SK={remote:r("远程目录"),builtin:r("内置清单"),manual:r("手动登记")},NK=[{test:e=>e===429,hint:r("该账号对这个模型正在限额冷却,等一会儿自己会好;也可以先测别的账号。")},{test:e=>e===401||e===403,hint:r("上游拒绝了这条登录态:重新登录一次,或把这条账号删掉。")},{test:e=>e===404,hint:r("上游不认识这个模型名:先点「获取模型」刷新清单,或核对默认绑定指向的上游模型。")},{test:e=>e===504,hint:r("上游没在预算内给完回答。可以只勾一个账号再测一次,看是普遍慢还是某一个账号慢。")},{test:e=>e>=500,hint:r("多半是上游自己的问题,过一会儿再试。同一个错误出现在所有账号上时,先查模型目录与映射。")}];function c2(){return lp().wbApp?.getState?.()?.accounts?.accounts||[]}function u2(e){return c2().filter(t=>(t.provider||ou)===e&&t.available!==!1&&t.enabled!==!1).sort(qh)}function d2(e){const t=String(e.email||"").trim();return t&&ir(e.provider).emailAsName?t:cu(e)||t||r("未命名账号")}function kK(){const e=globalThis.crypto?.randomUUID?.();if(e)return e;const t=a=>Array.from({length:a},()=>Math.floor(Math.random()*16).toString(16)).join("");return`${t(8)}-${t(4)}-4${t(3)}-a${t(3)}-${t(12)}`}function t0(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"—":t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function CK(e,t){return u2(e).length?"":r("该提供商没有可用账号(要在账号页启用一个、且凭证完整),一行都发不出去")}function f2({children:e,plain:t=!1}){return s.jsxs("p",{className:t?"flex items-center gap-2 text-xs leading-[1.6] text-subtle":"flex gap-2 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs leading-[1.65] text-subtle",children:[s.jsx("span",{"aria-hidden":"true",className:t?"size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]":"mt-px size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]",children:"i"}),s.jsx("span",{children:e})]})}function TK({open:e,label:t,text:a,onToggle:o}){return s.jsxs("div",{className:"overflow-hidden rounded-sm border border-border",children:[s.jsxs(se,{variant:"ghost",size:"xs",className:"w-full","aria-expanded":e,onClick:o,children:[s.jsx("span",{className:"truncate",children:t}),s.jsx("span",{"aria-hidden":"true",className:"ml-auto text-[10px]",children:e?"▴":"▾"})]}),e?s.jsx("div",{className:"border-t border-hairline bg-surface px-2.5 py-2",children:s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-[1.65] text-subtle",children:a})}):null]})}function EK(e){const[t,a]=x.useState(()=>Date.now());return x.useEffect(()=>{if(!e)return;a(Date.now());const o=window.setInterval(()=>a(Date.now()),400);return()=>window.clearInterval(o)},[e]),t}function p2(e){if(e.transport||!e.result||e.result.error)return!1;const t=Number(e.result.status)||0;return t>=200&&t<300}function AK({target:e,onClose:t}){const a=e.provider,o=a2(a,e.id),c=u2(a),d=mw(c2()),[f,p]=x.useState(""),[h,b]=x.useState(vK),[y,v]=x.useState("chat_completions"),[w,j]=x.useState(""),[S,N]=x.useState(null),[k,T]=x.useState(""),[D,C]=x.useState(""),[A,R]=x.useState(!0),[I,P]=x.useState(()=>{const te=c.find(Ce=>!vf(Ce,e.id))||c[0];return te?[te.id]:[]}),[O,_]=x.useState([]),[L,H]=x.useState(()=>new Set),B=x.useRef(0),z=x.useRef([]);z.current=O;const Q=O.some(te=>te.state==="running"),K=EK(Q);x.useEffect(()=>{let te=!0;return(async()=>{try{const Ce=lp().workbuddyDesktop?.getProxyPool;if(typeof Ce!="function")throw new Error(r("当前环境不支持代理池"));const re=await Ce();if(!te)return;if(!re||typeof re!="object"||!Array.isArray(re.items))throw new Error(r("代理池响应异常"));N(re.items),T("")}catch(Ce){if(!te)return;N([]),T(Ro(Ce))}})(),()=>{te=!1}},[]);const X=x.useCallback((te=!1)=>{const Ce=z.current.filter(re=>re.state==="running");B.current+=1;for(const re of Ce)lp().workbuddyDesktop?.terminateStatsRequest?.(re.testId)?.catch(()=>{});_([]),Ce.length&&!te&&wr(r("已中止在途测试({n} 个账号)",{n:Ce.length}))},[]);x.useEffect(()=>()=>{X(!0)},[X]);async function q(te,Ce){const re={provider:a,model:e.id,account_id:te.accountId,prompt:h.trim(),system_prompt:f.trim(),reasoning:D,stream:A,protocol:y,...w?{proxy:w}:{},test_id:te.testId},de=ke=>{B.current===Ce&&_(Ee=>Ee.map(ve=>ve.testId===te.testId?{...ve,...ke}:ve))};try{const ke=await lp().workbuddyDesktop?.testModel(re);if(!ke){de({state:"done",transport:r("桥接调用返回空(本机网关没有响应这次测试)")});return}de({state:"done",result:ke})}catch(ke){de({state:"done",transport:Ro(ke)})}}function $(){const te=c.filter(ke=>I.includes(ke.id));if(!te.length){wr(r("至少选一个测试账号"),"err");return}const Ce=B.current+1;B.current=Ce;const re=Date.now(),de=te.map(ke=>({accountId:ke.id,label:d2(ke),position:d.get(ke.id)?.position||0,testId:kK(),startedAt:re,state:"running"}));H(new Set),_(de);for(const ke of de)q(ke,Ce)}function Y(){Q?X():_([])}const F=s.jsx("span",{className:"ml-2 font-mono text-[12px] font-normal text-subtle",children:e.id});if(!o)return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("测试模型")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const G=Pu(o).find(te=>te.isDefault)?.enabled===!1,W=e0(o.id,o.id,a),le=Pu(o).filter(te=>!te.isDefault).map(te=>te.alias),M=Zf(Jf().data,o).filter(te=>te!=="off"&&te!=="none"),U=G?r("跟随映射(该行未启用,本次不注入)"):W?r("跟随映射(当前 {level})",{level:W}):r("跟随映射(未绑定等级)"),Z=[r("以模型本名直发"),le.length?r("另有 {n} 条别名映射({aliases}),别名不参与本次",{n:le.length,aliases:le.join(r("、"))}):"",G?r("该行当前未启用:测试照常按本名直发(「先测通、再决定要不要启用」正是这颗按钮的用法),但本行的思考等级绑定不参与本次,生产路由也要等绑定打开后才会放行"):W?r("映射上绑定的思考等级是 {level},「跟随映射」按它注入",{level:W}):r("映射上未绑定思考等级,「跟随映射」等于这次不注入")].filter(Boolean).join(r(";"))+r("。"),ae=lp().wbProviders?.PROTOCOL_OPTIONS||yK,ce=ae.find(te=>te.value===y)?.label||y,J=[{value:"",label:r("跟随账号配置")},{value:jK,label:r("直连(不使用代理)")},...(S??[]).map(te=>({value:`${Xa}${te.id}`,label:au(te)}))];S===null?J.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):S.length||J.push({value:"__hint_pool__",label:r(k?"代理列表读取失败":"还没有代理(去「网络代理」页添加)"),disabled:!0});const ie=J.find(te=>te.value===w)?.label||r("跟随账号配置"),ge=c.map(te=>({value:te.id,label:`#${d.get(te.id)?.position||0} ${d2(te)}`+(vf(te,e.id)?r(" · 限额中"):"")}));function ee(te){const Ce=(he,ye)=>s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-hairline px-3 py-2",children:[he,s.jsx("b",{className:"min-w-0 truncate text-[12.5px] text-foreground",title:te.label,children:te.label}),te.position?s.jsxs("span",{className:"flex-none text-xs text-subtle",children:["#",te.position]}):null,s.jsx("span",{className:"ml-auto flex-none font-mono text-[11.5px] tabular-nums text-subtle",children:ye})]},"head");if(te.state==="running"){const he=(K-te.startedAt)/1e3;return s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs text-subtle",children:[s.jsx(ef,{className:"flex-none"}),s.jsxs("span",{className:"min-w-0 truncate",children:[r("账号 "),s.jsx("b",{className:"text-foreground",children:te.label}),r(" 已发出,等待上游首帧…")]}),s.jsx("span",{className:"ml-auto flex-none font-mono tabular-nums",children:r("已等待 {seconds}s",{seconds:he.toFixed(1)})})]},te.testId)}const re=te.result;if(!p2(te)){const he=Number(re?.status)||0,ye=NK.find(je=>je.test(he))?.hint??(te.transport?r("确认桌面端还在运行,再重试一次。"):"");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"destructive",className:"flex-none",children:he||r("失败")}),r("用时 {time}",{time:t0(re?.duration_ms)})),s.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2.5",children:[s.jsxs("div",{className:"text-[12.5px] leading-[1.7]",children:[te.transport?s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("本机网关没有返回结论")}),r(":"),te.transport]}):s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("测试未通过")}),r(":"),re?.error||r("上游没有给出可读的错误说明")]}),Number(re?.attempts)>1?r("(中间共尝试 {n} 次)",{n:Number(re?.attempts)}):""]}),ye?s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:ye}):null]})]},te.testId)}const de=String(re?.reply??""),ke=String(re?.reasoning??""),Ee=`think-${te.testId}`,ve=[re?.upstream_model&&re.upstream_model!==e.id?r("上游 {model}",{model:re.upstream_model}):"",re?.upstream_reasoning?r("思考等级 {level}",{level:re.upstream_reasoning}):"",re?.protocol&&re.protocol!=="chat_completions"?wK[re.protocol]||re.protocol:"",re?.proxy?r("节点 {proxy}",{proxy:re.proxy}):"",Number(re?.attempts)>1?r("尝试 {n} 次",{n:Number(re?.attempts)}):""].filter(Boolean).join(" · ");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"success",className:"flex-none",children:Number(re?.status)||200}),r("用时 {time} · 首字 {ttfb}",{time:t0(re?.duration_ms),ttfb:t0(re?.ttfb_ms)})),s.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-subtle",children:[s.jsx("span",{className:"flex-none",children:r("回复")}),ve?s.jsx("span",{className:"min-w-0 truncate",title:ve,children:ve}):null,s.jsx(se,{variant:"ghost",size:"2xs",className:"ml-auto flex-none","data-copy":de,children:r("复制")})]}),s.jsx("div",{className:"max-h-[220px] overflow-y-auto whitespace-pre-wrap rounded-sm border border-border bg-surface px-3 py-2 text-[12.5px] leading-[1.7]",children:de||s.jsx("span",{className:"text-subtle",children:r("(上游这一次返回了空正文)")})}),ke?s.jsx(TK,{open:L.has(Ee),label:r("思考过程({n} 字)",{n:ke.length}),text:ke,onToggle:()=>H(he=>{const ye=new Set(he);return ye.has(Ee)?ye.delete(Ee):ye.add(Ee),ye})}):null]})]},te.testId)}function fe(){if(Q){const Ce=O.length-O.filter(re=>re.state==="running").length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[r("正在测 "),s.jsx("b",{className:"text-foreground",children:O.length}),r(" 个账号"),Ce?s.jsxs(s.Fragment,{children:[r(",已完成 "),s.jsx("b",{className:"text-foreground",children:Ce})]}):null,r("。")]}):null,O.map(re=>ee(re))]})}const te=O.filter(p2).length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[s.jsx("b",{className:te?"text-success":"text-foreground",children:te}),r(" 成功 ·"),s.jsxs("b",{className:O.length-te?"text-destructive":"text-foreground",children:[" ",O.length-te]}),r(" 失败")]}):null,O.map(Ce=>ee(Ce)),te===0?s.jsxs(f2,{children:[r("两边原因不一样时各自处理。如果"),s.jsx("b",{className:"text-foreground",children:r("同一条错误出现在所有账号上")}),r(",通常就不是账号问题了:先确认这个模型还在上游目录里(「获取模型」刷一次),再看默认绑定指向的上游模型对不对。")]}):null]})}return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r("测试模型"),F]})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-inset px-3 py-2.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12.5px] font-semibold text-primary-fg",title:o.id,children:o.id}),s.jsx(ze,{shape:"tag",variant:"brand",children:Jj(a)}),s.jsx(ze,{shape:"tag",variant:"outline",children:es(a)?r("自定义家"):SK[o.source]||r("来源未知")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("本次测试的发送口径")}),children:"?"}),s.jsx(_i,{children:Z})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-system",children:r("系统提示词")}),s.jsx(Qc,{id:"model-test-system",rows:2,maxLength:i2,placeholder:r("留空则不携带;设置页的提示词模式照常生效"),value:f,onChange:te=>p(te.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-prompt",children:r("用户提示词")}),s.jsx(Qc,{id:"model-test-prompt",rows:2,maxLength:i2,placeholder:r("留空用默认问候「你好」"),value:h,onChange:te=>b(te.currentTarget.value)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-protocol",children:r("对话协议")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("对话协议的说明")}),children:"?"}),s.jsx(_i,{children:r("按所选网关对话协议组装请求并校验响应转换(Chat Completions / Responses / Anthropic Messages)。")})]})]}),s.jsxs(ft,{value:y,onValueChange:te=>v(String(te)),children:[s.jsx(mt,{id:"model-test-protocol",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ce})}),s.jsx(ht,{children:ae.map(te=>s.jsx(qe,{value:te.value,children:te.label},te.value))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-proxy",children:r("测试节点")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试节点的说明")}),children:"?"}),s.jsx(_i,{children:r("仅本次测试临时生效,不修改账号保存的代理配置。可选「网络代理」页里的节点或强制直连。")})]})]}),s.jsxs(ft,{value:w,onValueChange:te=>j(String(te)),children:[s.jsx(mt,{id:"model-test-proxy",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ie})}),s.jsx(ht,{children:J.map(te=>s.jsx(qe,{value:te.value,disabled:te.disabled,children:te.label},te.value))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:D,onValueChange:te=>C(String(te)),children:[s.jsx(mt,{id:"model-test-reasoning",className:"w-full",children:s.jsx(pt,{children:D?r("{level}(本次指定)",{level:D}):U})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:U}),M.map(te=>s.jsx(qe,{value:te,children:r("{level}(本次指定)",{level:te})},te))]})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-stream",children:r("流式请求")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("流式请求的说明")}),children:"?"}),s.jsx(_i,{children:r("默认开,与真实请求一致:可同时验证 SSE 链路与首字延迟。")})]})]}),s.jsx(hs,{id:"model-test-stream",checked:A,onCheckedChange:te=>R(!!te)})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Je,{htmlFor:"model-test-accounts",children:r("测试账号")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试账号的说明")}),children:"?"}),s.jsx(_i,{children:r("勾几个就并行测几次;默认选队列里最靠前的一个。")})]}),s.jsx(se,{variant:"ghost",size:"xs",className:"ml-auto",disabled:!c.length||I.length===c.length,onClick:()=>P(c.map(te=>te.id)),children:r("全选({n})",{n:c.length})})]}),s.jsx(Bh,{id:"model-test-accounts",value:I,onValueChange:P,options:ge,placeholder:r("选一个账号(至少一个)"),searchPlaceholder:r("搜索账号…"),emptyHint:r("这家没有可用账号(要在账号页启用一个、且凭证完整)")})]}),s.jsx(f2,{plain:!0,children:r("真实链路 · 消耗少量额度 · 日志带「测试」标记,不计报表")})]}),s.jsxs(nn,{className:"justify-end",children:[s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:!I.length||!c.length,onClick:$,children:r("开始测试")})]}),s.jsx(Qt,{open:O.length>0,onOpenChange:te=>{te||Y()},children:s.jsxs(Zt,{overlayForceRender:!0,className:"w-[min(680px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r(Q?"测试中…":"测试结果"),F]})}),s.jsx(Bt,{children:fe()}),s.jsx(nn,{className:"justify-end",children:Q?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-xs text-subtle",children:r("关闭即中止")}),s.jsx(se,{variant:"outline",onClick:()=>X(),children:r("中止测试")}),s.jsx(se,{variant:"default",disabled:!0,children:r("测试中…")})]}):s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"outline",onClick:Y,children:r("关闭")}),s.jsx(se,{variant:"default",onClick:$,children:r("再测一次")})]})})]})})]})})}const m2=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"reasoning",label:r("设置思考等级")},{value:"delete",label:r("删除")}];function h2(e){return e.source==="manual"||es(e.provider)}function RK(e){return(e.name&&e.name!==e.id?r("{name}({id})",{name:e.name,id:e.id}):e.id)||e.id}function OK({models:e,onClose:t,onDone:a}){const[o,c]=x.useState("enable"),d=L9(Jf().data,e),[f,p]=x.useState(()=>({select:d[0]||"",custom:""})),[h,b]=x.useState(!1),[y,v]=x.useState(""),w=f.select===ca?f.custom.trim():f.select,j=e.filter(h2).length,S=m2.find(T=>T.value===o)?.label||r("操作");async function N(T){return Promise.resolve(Wt().wbConfirm?.ask?.({title:r("删除选中的模型"),html:r("确定删除选中的 {count} 个模型登记?删除后 /v1/models 不再广告它们、请求也会被拒。",{count:T})+(e.length>T?"
    "+r("另有 {n} 个非手动登记的模型将被跳过。",{n:e.length-T}):""),okText:r("删除"),okClass:"danger"})??!1)}async function k(){if(h)return;if(!e.length){wr(r("没有选中的模型"),"err");return}if(o==="reasoning"&&f.select===ca&&!w){v(s.jsx("span",{className:"text-destructive",children:r("请填写自定义思考等级,或改选候选档 / 「清除」")}));return}if(o==="delete"){if(j===0){v(s.jsx("span",{className:"text-destructive",children:r("选中的模型都不是手动登记,无法删除(开关映射才是它们的手段)")}));return}if(!await N(j))return}b(!0),v("");let T=0,D=0,C=0,A="";for(const R of e){const I=R.provider||"";try{if(o==="delete"){if(!h2(R)){D+=1;continue}Gi(await n2(I,R.id))}else if(o==="enable"||o==="disable"){const P=o==="enable";for(const O of Pu(R))Gi(await Yg(I,O.alias,R.id,{enabled:P}))}else for(const P of Pu(R))Gi(await Yg(I,P.alias,R.id,{reasoning:w}));T+=1}catch(P){C+=1,A||(A=Ro(P)),v(s.jsx("span",{className:"text-destructive",children:r("失败 {n} 个 · 首个失败:{error}",{n:C,error:A})}))}}C===0?(wr(D?r("✅ 批量{action}完成:共 {n} 个模型(跳过不可删除的 {skipped} 个)",{action:S,n:T,skipped:D}):r("✅ 批量{action}完成:共 {n} 个模型",{action:S,n:T})),a()):(wr(r("批量{action}完成:成功 {ok} 个,失败 {failed} 个",{action:S,ok:T,failed:C}),"err"),v(s.jsxs("span",{className:"text-destructive",children:[r("成功 {ok} 个,失败 {failed} 个",{ok:T,failed:C}),D?r(",跳过 {n} 个",{n:D}):"",A?r(";首个失败:{error}",{error:A}):""]}))),b(!1)}return s.jsx(Qt,{open:!0,onOpenChange:T=>{T||h||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {n} 个模型",{n:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下模型")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:e.map(RK).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:T=>c(T),className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:m2.map(T=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:T.value}),T.label]},T.value))}),o==="reasoning"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-model-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:f.select,onValueChange:T=>p(D=>({...D,select:String(T)})),children:[s.jsx(mt,{id:"batch-model-reasoning",className:"min-w-[220px]",children:s.jsx(pt,{children:f.select===ca?r("自定义等级…"):f.select||r("清除(不覆盖)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("清除(不覆盖)")}),d.map(T=>s.jsx(qe,{value:T,children:T},T)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]})]}),f.select===ca?s.jsxs("div",{className:"field-row mt-2",children:[s.jsx("label",{htmlFor:"batch-model-reasoning-custom",children:r("自定义等级")}),s.jsx($e,{id:"batch-model-reasoning-custom",maxLength:32,value:f.custom,onChange:T=>p(D=>({...D,custom:T.currentTarget.value}))})]}):null,s.jsxs("p",{className:"detail mt-1.5",children:[r("设置 / 清除会应用到选中模型的"),s.jsx("b",{children:r("全部映射")}),r("(默认绑定与别名 chips);「清除」= 不给这些映射指定等级(选「不覆盖」的口径与映射弹窗一致)")]})]}):null,o==="delete"?s.jsx("p",{className:"detail mt-2",children:j===0?r("选中的都不是手动登记的模型,删除不可用(上游目录带回来的行由清单决定存在性)"):r("可删除 {n} 个(手动登记 / 自定义家);",{n:j})+(e.length>j?r("其余 {n} 个会被跳过。",{n:e.length-j}):"")}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:y})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:h,onClick:t,children:r("关闭")}),s.jsx(se,{variant:o==="delete"?"destructive":"default",disabled:h,onClick:()=>{k()},children:h?r("执行中…"):r("执行{action}",{action:S})})]})]})})}function er(){return window}const g2={intl:"fm-table-intl",custom:"fm-table-custom"},x2={intl:"fetch-models",custom:"fetch-models-custom"},n0=["provider","source","state","count","note","updated","op"],s0=["pick","model","state"],MK={provider:"w-[13%]",source:"w-[21%]",state:"w-[9%]",count:"w-[6%]",note:"w-[20%]",updated:"w-[16%]",op:"w-[15%]"},DK={pick:"w-[8%]",model:"w-[74%]",state:"w-[18%]"},IK={pick:"",provider:r("提供商"),source:r("模型来源"),state:r("状态"),count:r("模型数"),note:r("说明"),updated:r("更新日期"),model:r("上游模型"),op:r("操作")},PK={refreshed:{variant:"brand",label:r("已刷新")},failed:{variant:"destructive",label:r("失败")},skipped:{variant:"outline",label:r("跳过")}},b2=new Set(["cline-free","cline-pass"]),v2="workbuddy-desktop-fetch-model-source";function op(e){return String(e??"").trim().toLowerCase()}function r0(e,t){er().wbApp?.toast?.(e,t)}function a0(e){return e instanceof Error?e.message:String(e)}function y2(e){const t=er().formatTime??er().wbApp?.formatTime;return String(t?.(e)??"")}function w2(){return er().wbApp?.getState?.()?.accounts?.accounts||[]}function _K(e){const a=(er().wbProviders?.customList?.()||[]).find(o=>o.id===e)?.models;return new Set((Array.isArray(a)?a:[]).map(o=>op(o?.id)).filter(Boolean))}function j2(e){if(e?.nameCustom===!0&&e?.name)return e.name;const t=String(e?.email||"").trim();return er().wbAccountsModel?.providerFeatures?.(e?.provider)?.emailAsName&&t?t:String(e?.nickname||e?.name||t||e?.id||"").trim()||r("未命名账号")}function LK(e){if(b2.has(e))return[];const t=er().wbAccountsModel?.byPriorityOrder,a=w2().filter(o=>(o?.provider||"workbuddy")===e&&o?.available!==!1&&o?.enabled!==!1);return t?a.sort(t):a}function S2(){const e=new Set(er().wbModelsPanel?.builtinProviders?.()||[]);for(const t of w2())t?.available===!1||t?.enabled===!1||e.add(t?.provider||"workbuddy");return[...e]}function zK(){const e=new Set(S2());return(er().wbProviders?.all?.()||[]).filter(t=>e.has(t?.id??""))}function BK(e){return y2(Number(e.refreshedAt)||0)||"—"}function HK(e){return PK[String(e.status)]??{variant:"outline",label:String(e.status||r("未知"))}}function UK(){try{const e=JSON.parse(localStorage.getItem(v2)||"{}");if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&o&&(t[a]=o);return t}catch{return{}}}function VK(e){er().wbFilterMemory?.save?.(v2,e)}function FK({options:e,onClose:t}){const a=e.providerId,o=!!e.custom,c=e.name||a,{onDone:d,onRefreshed:f}=e,[p,h]=x.useState("idle"),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(null),[N,k]=x.useState(""),T=j!==null,[D,C]=x.useState(!1),[A,R]=x.useState([]),[I,P]=x.useState(()=>new Set),[O,_]=x.useState(()=>new Set),[L,H]=x.useState([]),[B,z]=x.useState(""),[Q,K]=x.useState(UK);x.useEffect(()=>{er().wbTableColumns?.repaint?.(o?x2.custom:x2.intl)},[o]);const X=o?[]:zK(),q=o?[]:G(),$=B.trim().toLowerCase(),Y=A.filter(ve=>!$||ve.toLowerCase().includes($)),F=o?D?r("已选 {picked} 个 · 上游共 {upstream} 个 · 清单已有 {managed} 个",{picked:O.size,upstream:A.length,managed:I.size}):r("尚未获取"):W(q);function G(){const ve=new Map(L.map(je=>[String(je.provider||""),je])),he=X.map(je=>{const xe=String(je.id||"");return{provider:xe,label:String(je.label||xe),item:ve.get(xe)}}),ye=new Set(he.map(je=>je.provider));for(const je of L){const xe=String(je.provider||"");ye.has(xe)||he.push({provider:xe,label:String(je.providerLabel||xe),item:je})}return he}function W(ve){if(p==="loading")return r("正在刷新…");if(p==="error")return"";const he=ve.map(xe=>xe.item).filter(xe=>!!xe);if(!he.length)return D?r("刷新完成,但没有得到任何结果"):ve.length?r("共 {n} 家 · 点「获取模型」开始",{n:ve.length}):r("0 家");const ye=he.filter(xe=>xe.status==="refreshed").length,je=he.filter(xe=>xe.status==="failed").length;return je?r("{total} 家 · 成功 {done} · 失败 {failed}",{total:ve.length,done:ye,failed:je}):r("{total} 家 · 成功 {done}",{total:ve.length,done:ye})}function le(ve,he){const ye=LK(ve);if(!ye.length)return{list:ye,selected:""};const je=String(Q[ve]||""),xe=String(he||""),Te=Oe=>ye.some(Ne=>String(Ne.id)===Oe);return{list:ye,selected:Te(je)?je:Te(xe)?xe:String(ye[0].id)}}function M(ve){const he={};for(const[ye,je]of Object.entries(Q))je&&(he[ye]=je);for(const ye of ve){const{selected:je}=le(ye.provider,ye.reported);je&&(he[ye.provider]=je)}return he}const U=q.map(ve=>({provider:ve.provider,reported:ve.item?.accountId}));function Z(ve,he){K(ye=>({...ye,[ve]:he})),VK({[ve]:he})}async function ae(){if(!T){S("load"),w(""),y(""),h("loading");try{if(o){const he=await er().wbProviders?.customRequest?.("POST","/api/custom-providers/fetch-models",{providerId:a}),ye=new Set,je=(Array.isArray(he?.models)?he.models:[]).map(Te=>String(Te??"").trim()).filter(Te=>{const Oe=op(Te);return!Te||ye.has(Oe)?!1:(ye.add(Oe),!0)}),xe=_K(a);R(je),P(xe),_(new Set(je.filter(Te=>!xe.has(op(Te))))),C(!0),h("ready");return}const ve=await er().workbuddyDesktop?.refreshModels({accounts:M(U),providers:S2()});H(Array.isArray(ve?.results)?ve.results:[]),C(!0),h("ready"),Number(ve?.refreshed)>0&&f?.()}catch(ve){const he=a0(ve);y(he),h("error"),w(he)}finally{S(null)}}}async function ce(ve){if(!(T||!ve.provider)){S("row"),k(ve.provider),w("");try{const he=await er().workbuddyDesktop?.refreshModels({accounts:M([{provider:ve.provider,reported:ve.item?.accountId}]),providers:[ve.provider]});H(ye=>J(ye,Array.isArray(he?.results)?he.results:[])),C(!0),h("ready"),Number(he?.refreshed)>0&&f?.()}catch(he){const ye=a0(he);w(ye),r0(r("获取失败:{message}",{message:ye}),"err")}finally{S(null),k("")}}}function J(ve,he){const ye=new Map(he.map(Te=>[String(Te.provider||""),Te])),je=ve.map(Te=>ye.get(String(Te.provider||""))??Te),xe=new Set(je.map(Te=>String(Te.provider||"")));for(const Te of he)xe.has(String(Te.provider||""))||je.push(Te);return je}async function ie(){if(!o||T||!O.size)return;const ve=[...O];S("import"),w("");try{const he=Number(await er().wbModelsCustom?.addModels?.(a,ve))||0;r0(r("✅ 已导入 {added} 个模型({skipped} 个已存在,跳过)",{added:he,skipped:ve.length-he})),S(null),t(),d?.()}catch(he){const ye=a0(he);r0(r("导入失败:{message}",{message:ye}),"err"),w(ye),S(null)}}function ge(){T||t()}function ee(){const ve=new Set(O);for(const he of A)I.has(op(he))||ve.add(he);_(ve)}function fe(ve){return s.jsx(kl,{children:s.jsx(Nn,{colSpan:o?s0.length:n0.length,className:"py-[26px] text-center text-muted-foreground",children:ve})})}function te(ve){return s.jsx("span",{className:"font-mono text-[11.5px] tabular-nums text-muted-foreground",children:ve})}function Ce(ve){return s.jsx("div",{className:"truncate font-mono text-[12px] font-semibold",children:ve})}function re(ve,he){const{list:ye,selected:je}=le(ve,he);if(!ye.length){const Te=b2.has(ve)?r("这家的模型清单是全局的,不跟账号走"):r("这家还没有可用账号,刷新会使用默认登录态");return s.jsx("span",{className:"text-[11.5px] text-muted-foreground",title:Te,children:"—"})}const xe=ye.find(Te=>String(Te.id)===je);return s.jsxs(ft,{value:je,onValueChange:Te=>Z(ve,String(Te)),children:[s.jsx(mt,{className:"w-full",title:r("用哪个账号去拉这家的模型清单"),"aria-label":r("模型来源"),children:s.jsx(pt,{children:xe?j2(xe):"—"})}),s.jsx(ht,{children:ye.map(Te=>s.jsx(qe,{value:String(Te.id),children:j2(Te)},String(Te.id)))})]})}function de(){return p==="idle"?fe(r("点右侧「获取模型」从上游拉取这家的模型清单")):p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):Y.length?Y.map(ve=>{const he=I.has(op(ve));return s.jsxs(kl,{className:he?"opacity-50":void 0,children:[s.jsx(Nn,{children:s.jsx(Mr,{checked:O.has(ve),disabled:he,"aria-label":ve,onCheckedChange:ye=>_(je=>{const xe=new Set(je);return ye?xe.add(ve):xe.delete(ve),xe})})}),s.jsx(Nn,{children:Ce(ve)}),s.jsx(Nn,{children:he?s.jsx(ze,{variant:"brand",title:r("这个模型已经在这家的清单里,不重复导入"),children:r("已添加")}):s.jsx(ze,{variant:"outline",title:r("勾上它,导入后即进入这家的清单"),children:r("未添加")})})]},ve)}):fe(A.length?r("没有匹配「{keyword}」的模型",{keyword:$}):r("上游没有返回任何模型"))}function ke(ve){const he=j==="row"&&N===ve.provider;return s.jsx(se,{variant:"outline",size:"sm",className:"w-full",disabled:T,title:r("只刷新这一家的模型清单"),onClick:()=>{ce(ve)},children:he?r("获取中…"):ve.item?r("重新获取"):r("获取")})}function Ee(){return p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):q.length?q.map(ve=>{const he=ve.item;if(!he){const Te=y2(Number(er().wbModelsPanel?.providerRefreshedAt?.(ve.provider))||0);return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider)}),s.jsx(Nn,{children:s.jsx(ze,{variant:"outline",children:r("待获取")})}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te(Te||"—")}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}const ye=HK(he),je=Number(he.count),xe=he.status==="refreshed"?r("远程目录已更新,「来源」列会显示为「远程」"):he.message||(he.fixed?r("这家用固定模型清单,无可刷新"):r("本次没有取到新内容"));return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider,he.accountId)}),s.jsx(Nn,{children:s.jsx(ze,{variant:ye.variant,children:ye.label})}),s.jsx(Nn,{children:te(je?r("{n} 个",{n:je}):"—")}),s.jsx(Nn,{children:s.jsx("span",{className:"text-[11.5px] leading-[1.5] text-muted-foreground",children:xe})}),s.jsx(Nn,{children:te(BK(he))}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}):fe(r("还没有可刷新的提供商:先在账号页添加一个账号"))}return s.jsx(Qt,{open:!0,onOpenChange:(ve,he)=>{if(!ve){if(T){he.cancel();return}t()}},children:s.jsxs(Zt,{className:o?"w-[min(552px,calc(100vw-48px))]":"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("获取模型 — {name}",{name:c})})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:F}),o&&s.jsxs(Ci,{className:"w-[240px] flex-none",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID…"),autoComplete:"off",value:B,onChange:ve=>z(ve.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),s.jsx("div",{className:"mr-auto"}),o&&s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",size:"sm",onClick:ee,children:r("全选未添加")}),s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_(new Set),children:r("清空")})]}),s.jsx(se,{variant:"outline",size:"sm",title:r("刷新全部家(逐家打上游)"),disabled:T,onClick:()=>{ae()},children:r(j==="load"?"获取中…":D?"重新获取":"获取模型")})]}),s.jsxs(Ky,{id:o?g2.custom:g2.intl,className:"table-fixed",containerClassName:"max-h-[min(48vh,460px)]",children:[s.jsx("colgroup",{children:(o?s0:n0).map(ve=>s.jsx("col",{"data-col":ve,className:o?DK[ve]:MK[ve]},ve))}),s.jsx(yE,{children:s.jsx(kl,{children:(o?s0:n0).map(ve=>s.jsx(wE,{"data-col":ve,children:IK[ve]},ve))})}),s.jsx(Yy,{className:"[&_tr:last-child>td]:border-b-0",children:o?de():Ee()})]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:v}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:ge,children:r(o?"取消":"完成")}),o&&s.jsx(se,{variant:"default",disabled:!O.size||T,onClick:()=>{ie()},children:j==="import"?r("导入中…"):O.size?r("导入选中的 {n} 个模型",{n:O.size}):r("导入")})]})]})})}let ip=null,_u=null;function N2(){ip&&(ip.unmount(),ip=null),_u&&(_u.remove(),_u=null)}function $K(e){e?.providerId&&(N2(),_u=document.createElement("div"),document.body.append(_u),ip=vn.createRoot(_u),ip.render(s.jsx(FK,{options:e,onClose:N2})))}window.wbModelsFetchModal={open:$K};const Mo=(e,t)=>t?`${e} ta-${t}`:e;function k2(e,t){const a=(t||"").trim();if(a)return np().find(o=>Oo(o.provider,e)&&Oo(o.id,a))}const qK="[.pv-row:hover_&_[data-slot=nav-item-count]]:invisible";function GK(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));return t?`${t[1]}x`:String(e||"")}function C2(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));if(!t)return null;const a=Number(t[1]);return Number.isFinite(a)?a:null}const KK={workbuddy:250,"workbuddy-intl":295,raccoon:60,catpaw:85,autoclaw:250,"autoclaw-intl":295,qoder:330,"qoder-intl":350,"cline-free":200,"cline-pass":200,codearts:210,loomy:155,kuku:15,accio:320,"accio-intl":335,trae:170,zcode:285};function YK(e){const t=KK[e];if(t!==void 0)return t;let a=0;for(let o=0;o>>0;return a%360}function XK(e){const t=String(e||"").trim();if(!t)return"?";const a=t.match(/[A-Za-z]/);return(a?a[0]:t[t.length-1]).toUpperCase()}const QK=e=>({"--av-h":String(YK(e))}),l0=s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"})]})});function ZK(e){if(!e)return"";const t=Wt().wbPresetProviders?.list;if(!Array.isArray(t))return"";const a=t.find(o=>o.name===e);return a&&Wt().wbPresetProviders?.iconOf?.(String(a.key||""))||""}function WK(e,t){return es(e)?ZK(t):hg[e==="workbuddy-intl"?"workbuddy":e]||""}function Lu(e,t,a){const o=a?"":WK(e,t),c=e==="all"||e==="custom-all";return s.jsx("span",{className:Ue("pv-ico",c&&"mute",o&&"img"),style:o?void 0:QK(e),"aria-hidden":"true",children:o?s.jsx("img",{src:o,alt:""}):a??XK(t)})}const JK={supportsToolCall:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),supportsImages:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),supportsVideo:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M10 8.5l6 3.5-6 3.5z"})]})}),supportsReasoning:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),s.jsx("path",{d:"M9 18h6M10 22h4"})]})})};function eY(e,t,a,o){return o==="enabled"&&!rp(e)||o==="disabled"&&rp(e)||o==="mapped"&&!(e.aliases||[]).length||a!=="all"&&(e.provider||"")!==a?!1:t?[e.id,e.name,...e.aliases||[]].join(" ").toLowerCase().includes(t):!0}function tY(){const e=x.useSyncExternalStore($9,Jf),t=$g(e),a=es(t)||t==="custom-all",[o,c]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(new Set),b=a&&!Iu()&&$j()&&!Ao(t);x.useEffect(()=>{Z9(),qg(),XM(),Wt().wbApp?.currentPage==="gateway"&&t2().then(()=>Wt().wbProviders?.refreshCustom?.()).then(()=>{qi()})},[]),x.useEffect(()=>{pK()});const y=Gj(),v=Array.isArray(y.models)?y.models:[],w=e.search.trim().toLowerCase(),j=v.filter(G=>eY(G,w,t,e.stateFilter)),S=e.sort,N=e2(),k=N.length,T=t==="all"?r("全部"):t==="custom-all"?r("自定义 · 全部"):a?String(Ao(t)?.name||t):Kj().get(t)?.label||Jj(t),D=v.filter(rp).length,C=v.filter(G=>(G.aliases||[]).length>0).length,A=ig(j.length,"models"),R=v.filter(G=>p.has(Ki(G))),I=(G,W)=>{const le=new Set(p);W?le.add(G):le.delete(G),h(le)},P=j.map(Ki),O=P.length>0&&P.every(G=>p.has(G)),_=P.some(G=>p.has(G)),L=s.jsx(Mr,{checked:O,indeterminate:!O&&_,disabled:!P.length,"aria-label":r("全选当前筛选结果"),title:r("全选当前筛选出的模型(跨分页);再点取消"),onCheckedChange:G=>{const W=new Set(p);for(const le of P)G===!0?W.add(le):W.delete(le);h(W)}});function H(){const G=Kj(),W=Fi(),le=K9(),M=[...G.values()].reduce((ce,J)=>ce+J.n,0),U=r("全部({n} 家)",{n:G.size}),Z=[...le.values()].reduce((ce,J)=>ce+J.n,0),ae=r("全部({n} 家)",{n:[...le.values()].filter(ce=>ce.n>0).length});return s.jsxs("aside",{className:"prov-rail",id:"prov-rail","aria-label":r("按提供商选择"),children:[s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("内置提供商")}),s.jsx(ru,{active:t==="all","data-provider":"all",title:U,count:M,icon:Lu("all","",l0),className:"shadow-none",onClick:()=>ap("all"),children:U}),[...G].map(([ce,J])=>s.jsx(ru,{active:t===ce,"data-provider":ce,title:J.label,count:J.n,icon:Lu(ce,J.label),className:"shadow-none",onClick:()=>ap(ce),children:J.label},ce)),s.jsx("div",{className:"rail-label",children:r("自定义提供商")}),W.length?[...Z>0?[s.jsx(ru,{active:Iu(),"data-provider":"custom-all",title:ae,count:Z,icon:Lu("custom-all","",l0),className:"shadow-none",onClick:()=>ap("custom-all"),children:ae},"custom-all")]:[],...W.map(ce=>{const J=String(ce.id||""),ie=String(ce.name||J);return s.jsxs("div",{className:"pv-row",children:[s.jsx(ru,{active:t===J,"data-provider":J,title:ie,count:le.get(J)?.n??0,icon:Lu(J,ie),className:Ue("shadow-none",qK),onClick:()=>ap(J),children:ie}),s.jsx("button",{type:"button",className:"pv-del","aria-label":r("删除自定义提供商"),title:r("删除这个自定义提供商(连同名下账号)"),onClick:()=>{lK(J)},children:"×"})]},J)})]:s.jsx("div",{className:"rail-empty",children:r("还没有自定义提供商")})]}),s.jsx("div",{className:"rail-foot",children:s.jsx(ru,{variant:"add",id:"rail-add-custom",title:r("新建一个自定义提供商(同时创建它的第一个账号)"),onClick:()=>oK(),children:r("+ 新建自定义提供商")})})]})}function B(G,W,le,M){const U=e0(G,W,le);return s.jsx(se,{variant:U?"secondary":"dashed",size:"2xs",disabled:M,className:"font-mono font-bold shadow-none",title:U?r("思考等级 {level}(点击修改)",{level:U}):r("设置思考等级(当前未绑定)"),onClick:()=>s2({alias:G,target:W,provider:le}),children:U||r("+等级")})}function z(G){const W=G.provider||"",le=Pu(G),[M,...U]=le;async function Z(ce){await Wt().wbConfirm?.ask?.({title:r("删除映射"),html:r("确定删除映射「{alias} → {target}」?",{alias:zj(ce),target:zj(G.id)}),okText:r("删除"),okClass:"danger"})&&Zj(Wj(ce,G.id,W),()=>W9(W,ce,G.id),r("映射已删除"))}const ae=ce=>{const J=ce.alias,ie=ce.enabled!==!1,ge=e.pending.has(Wj(J,G.id,W));return s.jsxs("span",{className:Ue("alias",!ie&&"map-off"),children:[s.jsx(hs,{size:"sm",checked:ie,disabled:ge,title:r(ie?"映射已启用,点击关闭":"映射已关闭,点击启用"),"aria-label":r("{action}映射 {alias}",{action:r(ie?"关闭":"启用"),alias:J}),onCheckedChange:ee=>{Zj(Wj(J,G.id,W),()=>Yg(W,J,G.id,{enabled:ee}),r(ee?"映射已启用":"映射已关闭"))}}),s.jsx("span",{className:"t","data-copy":J,title:r("点击复制:{name}",{name:J}),children:J}),ce.isDefault?s.jsx("span",{className:"binding-default",children:r("默认")}):null,B(J,G.id,W,ge),ce.isDefault?null:s.jsx(se,{variant:"ghost",size:"icon-2xs",className:"text-[12px] leading-none",disabled:ge,title:r("删除映射 {alias}",{alias:J}),onClick:()=>{Z(J)},children:"×"})]},`${J}${ce.isDefault?"d":"m"}`)};return s.jsxs("div",{className:"aliases",children:[s.jsxs("div",{className:"alias-row",children:[M?ae(M):null,s.jsx(se,{variant:"dashed",size:"xs",onClick:()=>s2({target:G.id,provider:W}),children:r("+ 映射")})]}),U.map(ae)]})}function Q(G){if(G.source==="manual")return s.jsxs("span",{className:"src manual",title:r("手动登记的上游模型;移除它会直接删掉这条登记"),children:[s.jsx("i",{"aria-hidden":"true"}),r("手动")]});if(!G.source&&es(G.provider))return s.jsxs("span",{className:"src manual",title:r("用户登记的自定义模型;整份清单只属于这一家"),children:[s.jsx("i",{"aria-hidden":"true"}),r("自定义")]});if(G.source!=="remote"&&G.source!=="builtin")return s.jsx("span",{className:"rate",children:"—"});const W=G.source==="remote",le=B9(Number(G.refreshedAt)||0),M=W?le?r("来自上游目录接口,清单拉取于 {at};刷新失败时保留上一份成功结果",{at:le}):r("来自上游目录接口;刷新失败时保留上一份成功结果"):r("上游目录尚未拉到,用的是内置静态清单;点「刷新模型清单」可重试");return s.jsxs("span",{className:Ue("src",W?"remote":"builtin"),title:M,children:[s.jsx("i",{"aria-hidden":"true"}),r(W?"远程":"内置")]})}function K(G){const W=_j(G),le=Pj(G.capOverrides),M=typeof W.maxInputTokens=="number"?W.maxInputTokens:null,U=typeof W.maxOutputTokens=="number"?W.maxOutputTokens:null,Z=r("上下文窗口 {input} / 最大输出 Token {output} —— 点击修改模型能力",{input:Xf(M),output:Xf(U)})+X(G);return s.jsxs("button",{type:"button",className:"caps-open",title:Z,onClick:()=>r2(G.provider||"",G.id),children:[s.jsxs("span",{className:Ue("cap-num",M===null&&"unset",Mu(G,"maxInputTokens")==="modelsdev"&&"filled"),children:[RM(M),le.includes("maxInputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]}),s.jsx("span",{className:"cap-sep",children:"/"}),s.jsxs("span",{className:Ue("cap-num",U===null&&"unset",Mu(G,"maxOutputTokens")==="modelsdev"&&"filled"),children:[RM(U),le.includes("maxOutputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]})]})}function X(G){const W=["maxInputTokens","maxOutputTokens"].filter(le=>Mu(G,le)==="modelsdev").map(le=>Ou[le]);return W.length?r(";其中 {keys} 由 models.dev 补齐",{keys:W.join(r("、"))}):""}function q(G){const W=_j(G),le=Pj(G.capOverrides);return s.jsx("button",{type:"button",className:"caps-open caps-badges",title:r("对下游声明的能力(工具调用 / 图片识别 / 视频识别 / 支持思考)—— 点击修改"),onClick:()=>r2(G.provider||"",G.id),children:EM.map(M=>{const U=W[M]??null,Z=Lj(U),ae=le.includes(M),ce=Mu(G,M);return s.jsxs("span",{className:Ue("cap-dot",Z,ce==="modelsdev"&&"filled",ae&&"marked"),title:R9(M,U,ae,ce),children:[JK[M],ae?s.jsx("i",{className:"cap-mark"}):null]},M)})})}function $(G,W,le){async function M(){await Wt().wbConfirm?.ask?.({title:r("移除自定义模型"),html:r("确定移除自定义模型「{id}」?这条登记会被直接移除,之后 /v1/models 不再广告它、请求它也会被拒。",{id:zj(W.id)}),okText:r("移除"),okClass:"danger"})&&Zj(Ki(W),()=>n2(W.provider||"",W.id),es(W.provider||"")?r("模型已移除"):r("自定义模型已移除"))}switch(G.key){case"check":return s.jsx("td",{className:Mo("cell-check",G.align),children:s.jsx(Mr,{checked:p.has(Ki(W)),title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:U=>I(Ki(W),U===!0)})});case"model":return s.jsxs("td",{className:Mo("cell-model",G.align),children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t","data-copy":W.id,title:r("点击复制:{name}",{name:W.id}),children:W.id})}),W.name&&W.name!==W.id?s.jsx("div",{className:"mname",children:W.name}):null]});case"rate":return s.jsx("td",{className:Mo("cell-rate",G.align),children:s.jsx("span",{className:"rate",children:W.credits?GK(W.credits):"—"})});case"source":return s.jsx("td",{className:Mo("cell-source",G.align),children:Q(W)});case"budget":return s.jsx("td",{className:Mo("cell-budget",G.align),children:K(W)});case"caps":return s.jsx("td",{className:Mo("cell-caps",G.align),children:q(W)});case"alias":return s.jsx("td",{className:Mo("cell-alias",G.align),children:z(W)});case"act":{const U=CK(W.provider||""),Z=W.source==="manual"||es(W.provider||"");return s.jsx("td",{className:Mo("cell-act r",G.align),children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{variant:"ghost",size:"sm",disabled:!!U,title:U||r("以这个上游模型发一次最小请求,走真实转发链路"),onClick:()=>c({provider:W.provider||"",id:W.id}),children:r("测试")}),Z?s.jsx(se,{variant:"ghost",size:"sm",className:"text-destructive",disabled:le,onClick:()=>{M()},children:r("移除")}):null]})})}default:return null}}function Y(G){const W=e.pending.has(Ki(G)),le=p.has(Ki(G));return s.jsx("tr",{className:Ue(le&&"sel"),children:N.map(M=>s.jsx(x.Fragment,{children:$(M,G,W)},M.key))},`${G.provider||""}${G.id}`)}function F(){if(!v.length){const Z=a?$j()?Iu()?r("自定义提供商还没有模型:先在左栏选一家,点「添加模型」登记,或「获取上游模型」从上游拉取"):r(b?"该提供商已不存在(可能已被删除),请刷新列表":"这家还没有模型:点「添加模型」登记,或「获取上游模型」从上游拉取"):r("加载中…"):e.data?r("暂无模型(请先添加账号)"):r("加载中…");return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:Z})})}if(!j.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:w?r("没有匹配「{keyword}」的模型",{keyword:w}):r("没有匹配当前筛选的模型")})});const G=t==="all"||Iu(),W=G&&!w&&e.stateFilter==="all"&&!A.paged,le=new Map;for(const Z of j){const ae=Z.provider||"";le.has(ae)||le.set(ae,{label:Z.providerLabel||ae||r("未知"),items:[]}),le.get(ae)?.items.push(Z)}const M=[];let U=0;for(const[Z,ae]of le){ae.items.sort((te,Ce)=>{const re=+!rp(te)-+!rp(Ce);if(re!==0||S==="default")return re;const de=C2(te.credits),ke=C2(Ce.credits);return de===null||ke===null?de===ke?0:de===null?1:-1:S==="rate-asc"?de-ke:ke-de});const ce=e.expanded.has(Z)||!W,J=ce?ae.items:ae.items.slice(0,FM),ie=ae.items.length-J.length,ge=A.paged?Math.max(0,A.rangeStart-1-U):0,ee=A.paged?Math.min(J.length,A.rangeEnd-U):J.length,fe=ge0?r("(续)"):"",r("{n} 个模型",{n:ae.items.length})]})},`group:${Z}`));for(const te of fe)M.push(Y(te));U+=J.length,ie>0?M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>tK(Z),children:r("展开其余 {n} 个模型 ▾",{n:ie})})})},`more:${Z}`)):ce&&W&&ae.items.length>FM&&M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>nK(Z),children:r("收起 ▴")})})},`collapse:${Z}`))}return M}return s.jsxs(s.Fragment,{children:[s.jsx("section",{className:"panel",children:s.jsxs("div",{className:"mm",children:[H(),s.jsxs("div",{className:"mm-main",children:[s.jsxs("div",{className:"panel-head",children:[s.jsxs("div",{className:"mm-titlebar",children:[s.jsxs("div",{className:"mm-title",children:[t==="all"||t==="custom-all"?Lu(t,"",l0):Lu(t,T),s.jsx("h2",{children:T}),s.jsxs("span",{className:"mm-meta",children:[s.jsx("b",{children:v.length}),r(" 个模型 · 已启用 "),s.jsx("b",{children:D}),r(" · 有映射 "),s.jsx("b",{children:C})]})]}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-refresh-models",title:es(t)?r("从这一家的上游拉一份模型清单,勾选要哪些再导入(已添加的不会重复导入)"):r("刷新模型管理页里各提供商的远程模型目录,逐家结果列在弹窗里"),onClick:()=>l2(),children:r("获取模型")}),s.jsx(se,{id:"btn-add-custom-model",variant:"outline",size:"sm",onClick:()=>cK(),children:r("+ 添加模型")})]})]}),s.jsxs("div",{className:"mm-filters",children:[s.jsx(In,{options:U9,value:e.stateFilter,onValueChange:sK,"aria-label":r("按状态筛选"),className:"shrink-0"}),s.jsx(In,{options:F9,value:e.sort,onValueChange:rK,"aria-label":r("按倍率排序"),className:"shrink-0"}),s.jsxs(Ci,{className:"w-full min-[768px]:w-[240px] flex-none min-[768px]:flex-none",id:"models-search",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID / 名称 / 映射名…"),"aria-label":r("搜索模型"),autoComplete:"off",value:e.search,onChange:G=>aK(G.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),R.length>0?s.jsxs("span",{className:"batch-chip",children:[r("已选 "),s.jsx("b",{children:R.length}),r(" 个"),s.jsx(se,{id:"btn-batch-models",variant:"outline",size:"xs",title:r("对选中的 {n} 个模型执行批量操作",{n:R.length}),onClick:()=>f(!0),children:r("批量操作")})]}):null]})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",ref:G=>fK(G),children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"c-check","data-col":"check"}),s.jsx("col",{className:"c-model","data-col":"model"}),s.jsx("col",{className:"c-rate","data-col":"rate"}),s.jsx("col",{className:"c-source","data-col":"source"}),s.jsx("col",{className:"c-budget","data-col":"budget"}),s.jsx("col",{className:"c-caps","data-col":"caps"}),s.jsx("col",{className:"c-alias","data-col":"alias"}),s.jsx("col",{className:"c-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"check",children:L}),s.jsx("th",{"data-col":"model",children:r("上游模型")}),s.jsx("th",{"data-col":"rate",children:r("倍率")}),s.jsx("th",{"data-col":"source",children:r("来源")}),s.jsxs("th",{"data-col":"budget",children:[r("上下文 / 输出"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("数字带虚线底 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;— = 未声明。点任意一格可改。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"caps",children:[r("能力"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("圆点带内侧描边 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;虚线圈 = 未声明。悬停某一枚可看逐项出处。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"alias",children:[r("模型映射"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("每条映射 = 对外名 → 上游模型;原始 ID 与别名有独立开关,默认绑定永远存在(没有映射时是合成的那条)。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{id:"models",children:F()})]})}),s.jsx(Li,{className:"models-panel-foot",leading:Iu()?s.jsxs(s.Fragment,{children:[r("这里是"),s.jsx("b",{children:r("全部自定义提供商")}),r("的模型合集:每家的清单互相独立,别名也只在自己那家内生效;要改名称 / 协议 / Base URL,到账号页该家账号的「设置」→ 提供商一栏。")]}):a?s.jsxs(s.Fragment,{children:[r("自定义提供商的清单"),s.jsx("b",{children:r("只属于这一家")}),r(":这里的模型不会出现在其他家,别名也只在这一家内生效。改名称 / 协议 / Base URL 在账号页该家账号的「设置」→ 提供商一栏;整家不要了,鼠标移到左栏这家上点 × 删除(连同名下账号)。")]}):void 0,total:j.length,range:A.paged?{start:A.rangeStart,end:A.rangeEnd}:null,page:A.page,pageCount:A.pageCount,size:A.size,onSizeChange:A.setSize,onPageChange:A.goto})]})]})}),e.mapping?s.jsx(sY,{context:e.mapping,onClose:iK}):null,e.customModel?s.jsx(rY,{initial:e.customModel,onClose:uK}):null,e.capability?s.jsx(bK,{context:e.capability,onClose:dK}):null,o?s.jsx(AK,{target:o,onClose:()=>c(null)}):null,d?s.jsx(OK,{models:R,onClose:()=>f(!1),onDone:()=>{h(new Set),f(!1)}}):null]})}const nY=r("绑定在「对外名 → 上游模型」这一条映射上的思考等级(列表照抄 OmniProxy 的手动绑定),选「不覆盖」表示不给这条映射指定等级。它会跟着这条映射注入转发,由承载的那家翻译成自己的档位字段(CatPaw 归并成 low/high/max,Qoder 按模型声明的档位归一)。以下几种情况故意不注入:① off / none(关闭思考)—— 本项目没有安全的表达方式;② 表外的自定义等级(各家能力范围不同,无法判断上游收不收);③ 客户端请求体里已经自己指定了档位(那是更明确的意图,绑定不覆盖);④ 这家上游不认识档位字段(如 WorkBuddy / 小浣熊 / AutoClaw / Cline)。注入与跳过都会写进详细日志。");function T2(e,t,a){const o=JM(e),c=(t||"").trim(),d=o.find(f=>f.id.toLowerCase()===c.toLowerCase());return d?d.id:c||o[0]?.id||""}function sY({context:e,onClose:t}){const a=!!e.alias,[o,c]=x.useState(()=>e.provider||Yj()[0]?.id||""),[d,f]=x.useState(e.alias||""),[p,h]=x.useState(()=>T2(o,e.target)),[b,y]=x.useState(""),[v,w]=x.useState(!1),[j,S]=x.useState(()=>{const _=Zf(Jf().data,k2(o,p)),L=a?e0(e.alias,e.target,e.provider):"";return L&&_.includes(L)?{select:L,custom:""}:{select:L?ca:"",custom:L}}),N=Zf(Jf().data,k2(o,p)),k=(()=>{const _=Yj();for(const L of[e.provider,o])L&&!_.some(H=>H.id===L)&&_.push({id:L,label:Wt().wbProviders?.labelOf?.(L)||L});return _})(),T=(()=>{const _=JM(o),L=(p||"").trim();return L&&!_.some(H=>H.id.toLowerCase()===L.toLowerCase())&&_.unshift({id:L,label:r("{name}(不在该家当前清单里)",{name:L}),off:!0}),_})(),D=k.find(_=>_.id===o)?.label||o||r("(全局)"),C=j.select&&j.select!==ca&&!N.includes(j.select)?{select:ca,custom:j.custom||j.select}:j,A=C.select===ca?C.custom.trim():C.select,R=C.select===ca;function I(_){c(_),h(T2(_,p))}async function P(){if(v)return;const _=a?e.alias||"":d.trim(),L=p;if(!_){y(r("请填写对外映射名"));return}if(!L){y(r("该提供商当前没有可选的上游模型"));return}if(!o){y(r("请选择提供商"));return}if(!a&&Oo(_,L)&&np().some(H=>Oo(H.id,L)&&Oo(H.provider,o))){y(r("原始 ID 已作为默认绑定,请直接使用该绑定的开关或等级按钮"));return}w(!0),y(r("保存中…"));try{Gi(await Yg(o,_,L,{reasoning:A})),w(!1),t();const H=A?r(" · 思考等级 {level}",{level:A}):"",B=Wt().wbProviders?.labelOf?.(o)||o;wr(a?r("✅ 已更新 {name} 的思考等级",{name:_}):r("✅ 已添加映射 {name} → {target}({label}){suffix}",{name:_,target:L,label:B,suffix:H}))}catch(H){y(r("保存失败:{message}",{message:Ro(H)})),w(!1)}}const O=_=>{_.key==="Enter"&&(_.preventDefault(),P())};return s.jsx(Qt,{open:!0,onOpenChange:(_,L)=>{if(!_){if(v){L.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"设置思考等级":"添加模型映射")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-provider",children:r("提供商")}),s.jsxs(ft,{value:o,disabled:!0,onValueChange:_=>I(String(_)),children:[s.jsx(mt,{id:"mapping-provider",className:"w-full",children:s.jsx(pt,{children:k.find(_=>_.id===o)?.label||o})}),s.jsx(ht,{children:k.map(_=>s.jsx(qe,{value:_.id,children:_.label},_.id))})]})]}),s.jsxs("div",{className:"grid grid-cols-[1fr_24px_1fr] items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-alias",children:r("对外映射名(下游请求时用)")}),s.jsx($e,{id:"mapping-alias",maxLength:128,placeholder:r("例如 gpt-4o"),autoComplete:"off",autoFocus:!a,value:d,disabled:a,onChange:_=>f(_.currentTarget.value),onKeyDown:O})]}),s.jsx("div",{className:"pb-2 text-center text-muted-foreground",children:"→"}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-upstream",children:r("转发到上游模型")}),s.jsxs(ft,{value:p,disabled:!0,onValueChange:_=>h(String(_)),children:[s.jsx(mt,{id:"mapping-upstream",className:"w-full",children:s.jsx(pt,{children:T.find(_=>_.id===p)?.label||p})}),s.jsx(ht,{children:T.map(_=>s.jsxs(qe,{value:_.id,children:[_.label,_.off?r("(已禁用)"):""]},_.id))})]})]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("下游请求 "),s.jsx("b",{className:"text-primary-fg",children:d.trim()||r("<对外名>")}),r(" → 转发")," ",s.jsx("b",{className:"text-primary-fg",children:p||r("<上游模型>")}),r("({label})",{label:D}),A?s.jsxs(s.Fragment,{children:[r(" · 思考等级 "),s.jsx("b",{className:"text-primary-fg",children:A})]}):null]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:"mapping-reasoning",children:r("思考等级")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("思考等级的注入规则")}),children:"?"}),s.jsx(_i,{children:nY})]})]}),s.jsxs(ft,{value:C.select,onValueChange:_=>{const L=String(_);S(H=>({...H,select:L}))},children:[s.jsx(mt,{id:"mapping-reasoning",className:"w-full",autoFocus:a,children:s.jsx(pt,{children:C.select===ca?r("自定义等级…"):C.select||r("不覆盖")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("不覆盖")}),N.map(_=>s.jsx(qe,{value:_,children:_},_)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]}),R?s.jsx($e,{id:"mapping-reasoning-custom",maxLength:32,autoFocus:!0,placeholder:r("自定义等级(例如 custom-high)"),autoComplete:"off",disabled:v,value:C.custom,onChange:_=>S(L=>({...L,custom:_.currentTarget.value})),onKeyDown:O}):null]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("对外名可自由命名,允许与上游模型 ID 同名(同名时该上游的原生路由优先,映射作兜底); 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。同一对外名可在多个提供商各添加一条: 下游用同一个名字请求,网关按账号优先级主备切换,失败自动落到下一个提供商。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{P()},children:r(a?"保存等级":"保存映射")})]})]})})}function rY({initial:e,onClose:t}){const[a,o]=x.useState(e.provider),[c,d]=x.useState(""),[f,p]=x.useState(""),[h,b]=x.useState(!1),y=(()=>{const N=Q9();return a&&!N.some(k=>k.id===a)&&N.push({id:a,label:Wt().wbProviders?.labelOf?.(a)||a}),N})(),v=y.some(N=>N.id===a)?a:y[0]?.id||"",w=y.find(N=>N.id===v)?.label||v||r("(未选)");async function j(){if(h)return;const N=c.trim();if(!v){p(r("请选择提供商"));return}if(!N){p(r("请填写上游模型 ID"));return}b(!0),p(r("保存中…"));try{const k=await J9(v,N);Gi(k),b(!1),t();const T=y.find(D=>D.id===v)?.label||v;if(es(Du()))wr(r("✅ 已登记模型 {name}({label})",{name:N,label:T}));else{const D=k;Array.isArray(D?.models)&&D.models.some(A=>A.id===N&&(A.provider||"")===v)?wr(r("✅ 已登记自定义模型 {name}({label})",{name:N,label:T})):wr(r("✅ 已登记 {name}({label}),但该提供商还没有可用账号,这一行要加上账号后才会显示",{name:N,label:T}),"err")}}catch(k){p(r("保存失败:{message}",{message:Ro(k)})),b(!1)}}const S=N=>{N.key==="Enter"&&(N.preventDefault(),j())};return s.jsx(Qt,{open:!0,onOpenChange:(N,k)=>{if(!N){if(h){k.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加自定义模型")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-provider",children:r("提供商")}),s.jsxs(ft,{value:v,disabled:e.locked,onValueChange:N=>o(String(N)),children:[s.jsx(mt,{id:"custom-model-provider",className:"w-full",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:y.map(N=>s.jsx(qe,{value:N.id,children:N.label},N.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-id",children:r("上游模型 ID")}),s.jsx($e,{id:"custom-model-id",maxLength:128,placeholder:r("例如 gpt-5.5-preview"),autoComplete:"off",spellCheck:!1,autoFocus:!0,value:c,onChange:N=>d(N.currentTarget.value),onKeyDown:S})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("在 "),s.jsx("b",{className:"text-primary-fg",children:w}),r(" 上登记上游模型")," ",s.jsx("b",{className:"text-primary-fg",children:c.trim()||r("<上游模型 ID>")}),r("(登记后即可用这个名字请求)")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("填上游真正认识的那个模型 ID(不是给下游用的名字)。登记后它会进入该家的模型清单: 表格里出现这一行、"),s.jsx("code",{children:"/v1/models"}),r(" 会广告它、请求它也会被转发到这家。 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("「来源」列会标成"),s.jsx("b",{children:r("手动")}),r(",与远程目录 / 内置清单区分开。删除自定义模型是"),s.jsx("b",{children:r("直接移除")}),r("这条登记(不像内置模型那样只是隐藏),因为它的存在完全由这次登记决定。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:f})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:h,onClick:()=>{j()},children:r("保存")})]})]})})}const E2='.page[data-page="gateway"]';let o0=null;function A2(){if(o0)return;const e=document.querySelector(E2);e&&(e.replaceChildren(),o0=vn.createRoot(e),o0.render(s.jsx(tY,{})))}document.querySelector(E2)?A2():document.addEventListener("DOMContentLoaded",A2,{once:!0});const R2=3065;function aY(){if(el().workbuddyDesktop?.platform!=="web")return null;const e=typeof window>"u"?"":window.location?.origin;return e&&e!=="null"?e:null}function O2(e,t){return aY()??(e?`http://127.0.0.1:${e}`:t)}function el(){return window}function Xg(e){return e instanceof Error?e.message:String(e)}function zu(e,t){el().wbApp?.toast?.(e,t)}let cp={backend:null,gatewayBase:O2(0,`http://127.0.0.1:${R2}`)};const i0=new Set;function c0(){return cp}function lY(e){return i0.add(e),()=>{i0.delete(e)}}function oY(e){cp=e;for(const t of i0)t()}function M2(){return cp.gatewayBase.replace(/^https?:\/\//,"")}function iY(){return cp.backend?.ready===!0}function D2(e){const t=(a,o)=>{const c=document.getElementById(a);c&&(c.textContent=o)};t("api-base",`${e}/v1`),t("api-chat",`POST ${e}/v1/chat/completions`),t("api-responses",`POST ${e}/v1/responses`),t("api-messages",`POST ${e}/v1/messages`),t("api-models",`GET ${e}/v1/models`)}let u0=!1;async function Bu(){if(!u0){u0=!0;try{const e=el().workbuddyDesktop;if(!e)throw new Error("后端桥不可用");const t=await e.getBackendStatus(),a=Number(t?.port)||0,o=c0(),c={backend:t??null,gatewayBase:O2(a,o.gatewayBase)};c.gatewayBase!==o.gatewayBase&&D2(c.gatewayBase),oY(c),el().wbApp?.renderTopbarStatus?.()}catch(e){console.warn("读取后端状态失败:",Xg(e))}finally{u0=!1}}}function cY(){D2(cp.gatewayBase),Bu()}async function I2(e){zu(e||r("正在重启…"));try{await el().workbuddyDesktop?.restartApp()}catch(t){zu(r("重启失败:{reason}",{reason:Xg(t)}),"err")}}const uY={idle:r("结束占用进程"),querying:r("查询中…"),ending:r("结束中…")};function dY({container:e}){const{backend:t,gatewayBase:a}=x.useSyncExternalStore(lY,c0),[o,c]=x.useState("idle"),d=t?.failure||null,f=M2(),p=t?.ready;let h="live off",b=r("正在检查… · {port}",{port:f});p===!0?(h="live pulse",b=r("网关运行中 · {port}",{port:f})):d?(h="live bad",b=r("{label} · {port}",{label:d.label||r("网关启动失败"),port:f})):p===!1&&(b=r("网关启动中… · {port}",{port:f}));const y=d?d.message??"":p===!0?r("本地网关正在监听 {url},可直接调用 OpenAI 兼容接口",{url:a}):r("正在确认网关是否已就绪");x.useEffect(()=>{Bu()},[]),x.useEffect(()=>{const w=el().workbuddyDesktop?.onBackendError?.(()=>{Bu()});return typeof w=="function"?w:void 0},[]),x.useEffect(()=>{e.title=y},[e,y]);async function v(){if(o!=="idle")return;const w=el().workbuddyDesktop;if(w){c("querying");try{const j=await w.getPortOccupant(),S=j?.occupant;if(!S){zu(r("端口 {port} 上没有查到监听进程,请改用「更换端口」",{port:j?.port??""}),"err");return}const N=[r("即将结束以下进程:"),"",r("进程名:{name}",{name:String(S.name)}),r("PID:{pid}",{pid:String(S.pid)}),r("路径:{path}",{path:S.path||r("(未知)")}),"",r("结束它会强制退出该程序未保存的数据。确认继续?")],k=el().wbConfirm?.ask;if(!k||!await k({title:r("结束占用端口的进程"),text:N.join(` -`),okText:r("结束进程"),okClass:"danger"}))return;c("ending"),(await w.endPortOccupant())?.released?(zu(r("已结束进程 {name}(PID {pid}),端口已释放",{name:String(S.name),pid:String(S.pid)})),await k({title:r("重启程序"),text:r("端口已释放。现在重启程序让网关用这个端口启动?"),okText:r("重启")})?await I2(r("重启中…")):await Bu()):(zu(r("进程已结束,但端口仍被占用,建议改用「更换端口」"),"err"),await Bu())}catch(j){zu(r("结束失败:{reason}",{reason:Xg(j)}),"err")}finally{c("idle")}}}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-line",children:[s.jsx("span",{className:h}),s.jsx("span",{className:"txt",children:b})]}),d?.conflict?s.jsxs("div",{className:"status-actions",children:[d.canEndOccupant===!0?s.jsx(se,{size:"sm",disabled:o!=="idle",onClick:()=>{v()},children:uY[o]}):null,s.jsx(se,{size:"sm",onClick:()=>{mY()},children:r("更换端口")})]}):null]})}let d0=null;function P2(){if(d0)return;const e=document.getElementById("sidebar-status");e&&(e.replaceChildren(),d0=vn.createRoot(e),d0.render(s.jsx(dY,{container:e})))}const fY={idle:r("保存并重启"),checking:r("校验中…"),saving:r("保存中…")};function pY({status:e,onClose:t}){const a=Number(e?.port)||R2,[o,c]=x.useState(()=>a<65535?String(a+1):String(a-1)),[d,f]=x.useState("idle"),[p,h]=x.useState(""),[b,y]=x.useState(""),v=x.useRef(!0),w=Number(o)||0,j=e?.failure?.message||r("当前端口 {port},网关运行正常。",{port:a});async function S(){if(d!=="idle")return;const N=el().workbuddyDesktop;if(!N)return;const k=Number(o)||0;if(!k||k<1024||k>65535){y(r("端口需在 1024-65535 之间"));return}f("checking"),y(""),h("");try{const T=await N.checkPort(k);if(!T?.ok){h(T?.message||r("该端口不可用"));return}if(T.same){h(T.message??"");return}if(f("saving"),(await N.changePort(k))?.changed===!1){h(r("与当前端口相同,无需重启"));return}t(),await I2(r("端口已改为 {port},正在重启…",{port:k}))}catch(T){y(Xg(T))}finally{f("idle")}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更换网关端口")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("当前状态")}),s.jsx("p",{children:j})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("新端口")}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"port-input",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("端口号")}),s.jsx($e,{id:"port-input",type:"number",min:1024,max:65535,step:1,placeholder:r("例如 3066"),autoComplete:"off",className:"max-w-[130px]",value:o,onChange:N=>{c(N.currentTarget.value)},onKeyDown:N=>{N.key==="Enter"&&S()},autoFocus:!0,onFocus:N=>{v.current&&(v.current=!1,N.currentTarget.select())}})]}),p?s.jsx("p",{children:p}):null,s.jsx("p",{children:r("端口需在 1024-65535 之间。1023 及以下是系统保留范围,普通程序无法监听。")})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("换端口后要改的地方")}),s.jsxs("p",{children:[r("网关地址会变成 "),s.jsx("code",{children:`http://127.0.0.1:${w||"—"}`}),r("。已经把这个地址填进其它工具(Claude Code、Cherry Studio 等)的,需要一并改成新地址,否则那些工具会连不上。")]})]}),s.jsx("p",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:d!=="idle",onClick:()=>{S()},children:fY[d]})]})]})})}let up=null,Hu=null;function _2(){up&&(up.unmount(),up=null),Hu&&(Hu.remove(),Hu=null)}async function mY(){let e=c0().backend;e||(e=await el().workbuddyDesktop?.getBackendStatus().catch(()=>null)??null),_2(),Hu=document.createElement("div"),document.body.append(Hu),up=vn.createRoot(Hu),up.render(s.jsx(pY,{status:e,onClose:_2}))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",P2,{once:!0}):P2(),window.wbPortPanel={render:cY,sync:Bu,portLabel:M2,isReady:iY};function hY(e){return e.source==="subscription"&&(e.port===null||e.port===void 0)}function tr(){return window}function Fn(e,t){tr().wbApp?.toast?.(e,t)}function Ra(e){return e instanceof Error?e.message:String(e)}function L2(e){return tr().wbApp?.formatTime?.(e)||""}function f0(e){const t=Number(e);return!Number.isFinite(t)||t<0?"":t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}function p0(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]||t)}function Uu(e){return String(e?.name||e?.id||"")}function z2(e){return e.source==="clash"}function dp(e){return e.source==="subscription"}function Qg(e){return z2(e)||dp(e)}function gY(e){return e.localDisabled===!0||e.enabled===!1}function B2(e){return Qg(e)&&e.enabled===!1&&e.localDisabled!==!0}function xY(e){return dp(e)&&gY(e)}function Zg(e){return dp(e)&&e.orphan===!0}function H2(e){return!Qg(e)||Zg(e)}const bY=r("来自 Clash Verge 同步(名称、端口跟随 Clash),请到 Clash Verge 中修改;启用可在本页关闭"),vY=r("该节点来自订阅(名称、端口跟随订阅与内核),请在「订阅管理」里修改;启用可在本页关闭"),U2=r("该节点所属订阅已删除,不会再被同步更新,可手动删除清理");function V2(e){return Zg(e)?U2:dp(e)?vY:bY}const yY=r("禁用后本端不再用它(引用它的账号回退直连);端口在 Clash Verge 侧,不受影响"),wY=r("禁用后本端不再用它(引用它的账号回退直连),并会关掉它的本地监听端口"),jY=r("已在本页禁用(打开开关即恢复)"),SY=r("这条在 Clash Verge 里是停用的,本页启用不生效 —— 到 Clash Verge 里打开它");function NY(e){if(Zg(e))return U2;if(e.localDisabled===!0)return jY;if(B2(e))return SY;if(dp(e))return wY;if(z2(e))return yY}let xs={data:null,loading:!1,error:"",testing:null,pending:new Set,syncing:!1,batchBusy:!1,batchProgress:null,selected:new Set};const m0=new Set;function kY(e){return m0.add(e),()=>{m0.delete(e)}}function CY(){return xs}function ns(e){xs={...xs,...e},m0.forEach(t=>t())}function Wg(){return xs.data?.items??[]}function TY(e){return xs.selected.has(e)}function EY(e,t){const a=new Set(xs.selected);t?a.add(e):a.delete(e),ns({selected:a})}function AY(e,t){const a=new Set(xs.selected);for(const o of e)t?a.add(o):a.delete(o);ns({selected:a})}function RY(){ns({selected:new Set})}function Do(e){if(!e||typeof e!="object"||!Array.isArray(e.items))return;const t=new Set(e.items.map(o=>o.id)),a=new Set([...xs.selected].filter(o=>t.has(o)));ns({data:e,error:"",selected:a})}async function fp(e=!1){const t=tr().workbuddyDesktop;if(typeof t?.getProxyPool!="function"){ns({error:r("当前环境不支持代理池(桥接方法缺失)")});return}e||ns({loading:!0});try{Do(await t.getProxyPool())}catch(a){ns({error:Ra(a)}),e||Fn(r("代理列表加载失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({loading:!1})}}async function OY(){const e=tr().workbuddyDesktop;if(typeof e?.syncClashToProxyPool!="function"){Fn(r("当前环境不支持同步(桥接方法缺失)"),"err");return}if(!xs.syncing){ns({syncing:!0});try{const t=await e.syncClashToProxyPool();Do(t),t?.syncError?Fn(r("没能同步:{reason}",{reason:t.syncError}),"err"):t?.changes?Fn(r("✅ 已同步 Clash Verge 出口({n} 项变更)",{n:t.changes})):Fn(r("已是最新,没有需要同步的变更"))}catch(t){Fn(r("同步失败:{reason}",{reason:Ra(t)}),"err")}finally{ns({syncing:!1})}}}async function MY(e){const t=tr().workbuddyDesktop;if(typeof t?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(!xs.testing){ns({testing:e.id});try{const a=await t.testProxyPoolItem(e.id);if(a?.items&&Do({items:a.items}),a?.success){const o=f0(a.durationMs);Fn(r("✅ 「{name}」出口可用{ip}{took}",{name:Uu(e),ip:a.ip?r(" 出口 IP {ip}",{ip:a.ip}):"",took:o?` ${o}`:""}))}else Fn(r("❌ 「{name}」{error}",{name:Uu(e),error:a?.error||r("连接失败")}),"err");a?.saveError&&Fn(r("测试结果没能记下:{reason}",{reason:a.saveError}),"err")}catch(a){Fn(r("测试失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({testing:null})}}}async function DY(e,t){const a=tr().workbuddyDesktop;if(typeof a?.setProxyPoolItemEnabled!="function"){Fn(r("当前环境不支持启停(桥接方法缺失)"),"err");return}const o=new Set(xs.pending);o.add(e.id),ns({pending:o});try{const c=await a.setProxyPoolItemEnabled({id:e.id,enabled:t});Do(c);const d=Uu(e),f=c?.listener??"none";Fn(t?f==="opening"?r("已启用「{name}」,正在补建监听端口(内核重建中)",{name:d}):r("已启用「{name}」",{name:d}):f==="closing"?r("已禁用「{name}」,监听端口正在关闭(内核重建中)",{name:d}):r("已禁用「{name}」",{name:d})),(f==="closing"||f==="opening")&&IY(e.id,f)}catch(c){Fn(r("保存失败:{reason}",{reason:Ra(c)}),"err")}finally{const c=new Set(xs.pending);c.delete(e.id),ns({pending:c})}}async function IY(e,t){for(let a=0;a<12;a+=1){await new Promise(d=>setTimeout(d,1500)),await fp(!0);const o=Wg().find(d=>d.id===e);if(!o)return;const c=o.port!==null&&o.port!==void 0;if(t==="closing"?!c:c)return}}async function F2(e){const t=tr().workbuddyDesktop;if(typeof t?.removeProxyPoolItem!="function")return;if(!H2(e)){Fn(V2(e),"err");return}const a=e.usedBy||[],o=a.length?`

    ${r("有 {n} 个账号正在使用它({names})—— 删除后这些账号会回退直连。",{n:a.length,names:a.map(f=>p0(String(f.name||f.id||""))).join(r("、"))})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("删除代理"),html:r("确定删除「{name}」?{used}",{name:p0(Uu(e)),used:o}),okText:r("删除"),okClass:"danger"}))return;const d=new Set(xs.pending);d.add(e.id),ns({pending:d});try{const f=await t.removeProxyPoolItem(e.id);Do(f),Fn(r("已删除「{name}」",{name:Uu(e)}))}catch(f){Fn(r("删除失败:{reason}",{reason:Ra(f)}),"err")}finally{const f=new Set(xs.pending);f.delete(e.id),ns({pending:f})}}async function PY(){const e=tr().workbuddyDesktop;if(typeof e?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(xs.batchBusy||xs.testing)return;const t=Wg().filter(f=>xs.selected.has(f.id));if(!t.length)return;ns({batchBusy:!0,batchProgress:{done:0,total:t.length}});let a=0,o=0,c="";for(const[f,p]of t.entries()){ns({testing:p.id,batchProgress:{done:f,total:t.length}});try{const h=await e.testProxyPoolItem(p.id);h?.items&&Do({items:h.items}),h?.success?a+=1:o+=1,h?.saveError&&!c&&(c=h.saveError)}catch{o+=1}}ns({testing:null,batchBusy:!1,batchProgress:null});const d=o?r("批量测试完成:{ok} 个可用、{failed} 个失败(共 {total} 个)",{ok:a,failed:o,total:t.length}):r("批量测试完成:{ok} 个可用(共 {total} 个)",{ok:a,total:t.length});Fn(o?d:`✅ ${d}`,o?"err":"ok"),c&&Fn(r("部分测试结果没能记下:{reason}",{reason:c}),"err")}async function _Y(){const e=tr().workbuddyDesktop;if(typeof e?.removeProxyPoolItem!="function"||xs.batchBusy||xs.testing)return;const t=Wg().filter(S=>xs.selected.has(S.id)),a=t.filter(S=>H2(S)),o=t.length-a.length;if(!a.length){Fn(o?r("选中的 {n} 条都是同步来的只读条目(Clash / 订阅),不能删除",{n:o}):r("没有可删除的条目"),"err");return}const c=a.slice(0,8).map(S=>p0(Uu(S))).join(r("、")),d=a.length>8?r("{names} 等 {n} 条",{names:c,n:a.length}):c,f=a.filter(S=>(S.usedBy||[]).length).length,p=f?`

    ${r("其中 {n} 条正被账号使用 —— 删除后那些账号会回退直连。",{n:f})}

    `:"",h=o?`

    ${r("另有 {n} 条是同步来的只读条目(Clash / 订阅),将跳过。",{n:o})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("批量删除代理"),html:`${r("确定删除选中的 {n} 个代理?",{n:a.length})}

    ${d}

    ${p}${h}`,okText:r("删除"),okClass:"danger"}))return;ns({batchBusy:!0,batchProgress:{done:0,total:a.length}});let y=0,v=0,w="";for(const[S,N]of a.entries()){ns({batchProgress:{done:S,total:a.length}});try{const k=await e.removeProxyPoolItem(N.id);Do(k),y+=1}catch(k){v+=1,w||(w=Ra(k))}}ns({batchBusy:!1,batchProgress:null});const j=[r("已删除 {n} 个代理",{n:y})];o&&j.push(r("跳过 {n} 个(同步只读条目)",{n:o})),v&&j.push(r("失败 {n} 个({reason})",{n:v,reason:w})),Fn(v?j.join(r(",")):`✅ ${j.join(r(","))}`,v?"err":"ok")}async function LY(e,t){const a=tr().workbuddyDesktop,o=e?{...t,id:e.id}:t,c=e?await a?.updateProxyPoolItem?.(o):await a?.createProxyPoolItem?.(o);return Do(c),c}async function $2(){const e=tr().workbuddyDesktop;if(typeof e?.getProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const t=await e.getProxySettings();if(!t||typeof t!="object")throw new Error(r("代理设置响应异常"));return t}async function zY(e){const t=tr().workbuddyDesktop;if(typeof t?.saveProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const a=await t.saveProxySettings(e);if(!a||typeof a!="object")throw new Error(r("代理设置响应异常"));return a}function BY({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.name||""),[d,f]=x.useState(e?.protocol==="socks5"?"socks5":"http"),[p,h]=x.useState(e?.host||""),[b,y]=x.useState(e?.port?String(e.port):""),[v,w]=x.useState(e?.username||""),[j,S]=x.useState(e?.password||""),[N,k]=x.useState(e?e.enabled:!0),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null);function P(){const L=o.trim();if(!L)return{error:r("请填写代理名称")};const H=p.trim();if(!H)return{error:r("请填写代理主机地址")};const B=Number(b);return!Number.isInteger(B)||B<1||B>65535?{error:r("代理端口必须是 1-65535 的整数")}:{payload:{name:L,source:"manual",protocol:d,host:H,port:B,username:v.trim(),password:j,enabled:N}}}async function O(){if(C)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}const H=L.payload,B={source:"custom",protocol:H.protocol,host:H.host,port:H.port,username:H.username,password:H.password};A(!0),I(r("正在连接上游…"));try{const z=await tr().workbuddyDesktop?.testProxy?.({proxy:B});if(z?.success){const Q=f0(z.durationMs);I(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),z.ip?r(" 出口 IP {ip}",{ip:z.ip}):"",Q?` ${Q}`:""]}))}else I(s.jsxs("span",{className:"text-destructive",children:["❌ ",z?.error||r("连接失败")]}))}catch(z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(z)]}))}finally{A(!1)}}async function _(){if(T)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}D(!0),I(null);try{await LY(e,L.payload),Fn(a?r("已保存「{name}」",{name:o.trim()}):r("已新增「{name}」",{name:o.trim()})),t()}catch(H){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(H)]})),D(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:L=>{!L&&!T&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑代理":"新增代理")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-name",children:r("名称")}),s.jsx($e,{id:"proxy-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:香港 HTTP 出口"),value:o,onChange:L=>c(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-protocol",children:r("协议")}),s.jsxs(ft,{value:d,onValueChange:L=>f(L),children:[s.jsx(mt,{id:"proxy-protocol",className:"min-w-[110px]",children:s.jsx(pt,{children:d==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-host",children:r("主机")}),s.jsx($e,{id:"proxy-host",placeholder:"127.0.0.1",autoComplete:"off",spellCheck:!1,value:p,onChange:L=>h(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-port",children:r("端口")}),s.jsx($e,{id:"proxy-port",type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:b,onChange:L=>y(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-user",children:r("用户名")}),s.jsx($e,{id:"proxy-user",placeholder:r("可选"),autoComplete:"off",value:v,onChange:L=>w(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-pass",children:r("密码")}),s.jsx($e,{id:"proxy-pass",placeholder:r("可选"),autoComplete:"off",value:j,onChange:L=>S(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:N,onCheckedChange:k,"aria-label":r("启用这条代理")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的条目不会被账号使用,被引用时账号回退直连;仍可测试)")})]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("想要 Clash Verge 的出口?那类条目由工具条的"),s.jsx("b",{children:r("「同步 Clash Verge」")}),r("整体 镜像进来(进本页时也会自动同步一次),名称与端口跟随 Clash、因此是只读的 —— 不必(也不能)在这里手工填。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",disabled:C||T,onClick:()=>{O()},children:r(C?"测试中…":"测试出口")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:T,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:T,onClick:()=>{_()},children:r(T?"保存中…":"保存")})]})]})})}function HY({onClose:e}){const[t,a]=x.useState(!0),[o,c]=x.useState(!1),[d,f]=x.useState(""),[p,h]=x.useState(""),[b,y]=x.useState(""),[v,w]=x.useState({}),[j,S]=x.useState(""),[N,k]=x.useState(!1);x.useEffect(()=>{let A=!0;return(async()=>{try{const R=await $2();if(!A||R===null)return;f(String(R.listenerPortBase??"")),h(String(R.listenerPortEnd??"")),y(String(R.testUrl??"")),w(R.defaults??{}),a(!1)}catch(R){if(!A)return;S(Ra(R)),a(!1)}})(),()=>{A=!1}},[]);function T(){const A=Number(d),R=Number(p);if(!Number.isInteger(A)||A<1||A>65535||!Number.isInteger(R)||R<1||R>65535)return S(r("端口范围必须是 1-65535 的整数")),null;if(A>R)return S(r("起始端口不能大于结束端口")),null;const I=b.trim();return I&&!I.startsWith("http://")&&!I.startsWith("https://")?(S(r("测试网址要以 http:// 或 https:// 开头")),null):(S(""),{listenerPortBase:A,listenerPortEnd:R,testUrl:I})}async function D(){if(o||t)return;const A=T();if(A){c(!0);try{await zY(A),k(!0)}catch(R){S(Ra(R))}finally{c(!1)}}}function C(){f(String(v.listenerPortBase??"")),h(String(v.listenerPortEnd??"")),y(String(v.testUrl??"")),k(!1),S("")}return s.jsx(Qt,{open:!0,onOpenChange:A=>{!A&&!o&&e()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("代理设置")})}),s.jsx(Bt,{className:"flex flex-col gap-3.5",children:t?s.jsx("p",{className:"text-xs text-subtle",children:r("加载中…")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-base",children:r("节点端口范围(起始)")}),s.jsx($e,{id:"proxy-settings-base",type:"number",min:1,max:65535,placeholder:String(v.listenerPortBase??""),autoComplete:"off",value:d,onChange:A=>{f(A.currentTarget.value),k(!1)}})]}),s.jsx("span",{"aria-hidden":"true",className:"flex-none pb-[7px] text-subtle",children:"—"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-end",children:r("节点端口范围(结束)")}),s.jsx($e,{id:"proxy-settings-end",type:"number",min:1,max:65535,placeholder:String(v.listenerPortEnd??""),autoComplete:"off",value:p,onChange:A=>{h(A.currentTarget.value),k(!1)}})]})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅节点会在本机各占一个监听端口,从该范围里挑空闲的分配;节点多的大订阅把默认范围({base}-{end})用尽时会报「没有可用的节点端口」,这时把范围调大再重启内核。已分配出去的端口不会因改范围而失效。",{base:v.listenerPortBase??"",end:v.listenerPortEnd??""})}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-url",children:r("出口测试网址")}),s.jsx($e,{id:"proxy-settings-url",placeholder:v.testUrl||"",autoComplete:"off",spellCheck:!1,className:"font-mono text-[12px]",value:b,onChange:A=>{y(A.currentTarget.value),k(!1)}})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("「测试」与「批量测试」访问的目标;留空用默认(打 WorkBuddy 上游)。判据是能否拿到 HTTP 响应,不用考虑该网址返回什么内容。")}),s.jsxs("div",{className:"min-h-[18px] text-xs",children:[j?s.jsxs("span",{className:"text-destructive",children:["❌ ",j]}):null,!j&&N?s.jsxs("span",{className:"text-success",children:["✅ ",r("已保存。重启内核后,新分配的节点端口才会按新范围来。")]}):null]})]})}),s.jsxs(nn,{children:[s.jsx(se,{variant:"ghost",disabled:t||o,onClick:C,children:r("恢复默认")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:o,onClick:e,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:t||o,onClick:()=>{D()},children:r(o?"保存中…":"保存")})]})]})})}function Pn(){return window}function nr(e,t){Pn().wbApp?.toast?.(e,t)}function zr(e){return e instanceof Error?e.message:String(e)}function q2(e){const t=String(e||"").trim();return/^https?:\/\//i.test(t)?t:""}async function G2(e){const t=q2(e);if(!t){nr(r("链接地址不受支持"),"err");return}try{await Pn().workbuddyDesktop?.openReleasePage(t)}catch(a){nr(r("打开链接失败:{error}",{error:zr(a)}),"err")}}const Jg="1127656296",UY=`assets/qq-group/${Jg}.jpg`;function K2(e){return Pn().wbMarkdown?.render?.(e)||""}function Y2(e){const a=e.target?.closest?.("[data-external]");a&&(e.preventDefault(),G2(a.dataset.external||""))}const pp="__proxy_other__",X2={proxyChoice:null,pool:null,poolError:""};async function VY(){const e=Pn().workbuddyDesktop,t={...X2};if(!e?.getUpdateProxy)return t;try{t.proxyChoice=(await e.getUpdateProxy())?.proxy??null}catch{}try{if(typeof e.getProxyPool!="function")throw new Error("桥未提供代理池方法");const a=(await e.getProxyPool())?.items;if(!Array.isArray(a))throw new Error("代理池响应异常");t.pool=a}catch(a){t.pool=[],t.poolError=zr(a)}return t}async function FY(e){if(e===pp)return null;const t=Pn().workbuddyDesktop;if(!t?.setUpdateProxy)return null;const a=e===""?null:{source:"pool",proxyId:e.slice(Xa.length)};try{const o=await t.setUpdateProxy({proxy:a}),c=o?.proxy??null,d=o?.saved!==!1;return d?nr(c?r("✅ 更新出网已切换为 {label}",{label:c.label||r("指定代理")}):r("✅ 更新出网已切换为直连")):nr(r("出网线路已切换,但写入磁盘失败(重启后会恢复原线路)"),"err"),{choice:c,saved:d}}catch(o){return nr(r("保存失败:{error}",{error:zr(o)}),"err"),null}}function Q2(e){const t=e.proxyChoice,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=!!t?.error,d=Array.isArray(e.pool)?e.pool:[];let f="";a==="pool"&&t?.config?.proxyId?f=`${Xa}${t.config.proxyId}`:t&&(f=pp);const p=[{value:"",label:r("直连")}];for(const h of d)p.push({value:`${Xa}${h.id}`,label:au(h)});if(e.pool===null?p.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):d.length||p.push({value:"__hint_pool__",label:e.poolError?r("代理列表读取失败"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),f===pp){const h=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";p.push({value:pp,label:`${h}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!d.some(h=>`${Xa}${h.id}`===f)&&p.push({value:f,label:`${o}${c?r("(不可用)"):""}`});return{current:f,items:p,selected:p.find(h=>h.value===f),broken:c,title:c?r("当前线路不可用:{error};请重新选择代理或切回直连",{error:String(t?.error||"")}):r("检查更新与下载安装包走哪条线路(当前:{current});选择即保存。选项来自「网络代理」页;直连失败时会自动借 Clash 混合端口重试一次,选定指定代理后只走它",{current:t?o:r("直连")})}}function sr(){return window}function sn(e,t){sr().wbApp?.toast?.(e,t)}function jr(e){return e instanceof Error?e.message:String(e)}let Ht={data:null,loading:!1,error:"",pending:!1,refreshing:null};const h0=new Set;function ex(e){return h0.add(e),()=>{h0.delete(e)}}function tx(){return Ht}function yn(e){Ht={...Ht,...e},h0.forEach(t=>t())}function $Y(){return Ht.data?.items??[]}function Vu(){return Ht.data?.kernel??null}function Yi(e){!e||typeof e!="object"||!Array.isArray(e.items)||yn({data:e,error:""})}function Io(){fp(!0)}async function Ml(e=!1){const t=sr().workbuddyDesktop;if(typeof t?.getSubscriptions!="function"){yn({error:r("当前环境不支持订阅(桥接方法缺失)")});return}e||yn({loading:!0});try{Yi(await t.getSubscriptions())}catch(a){yn({error:jr(a)})}finally{e||yn({loading:!1})}}const qY=20;function GY(e){const t=e.kernel;if(!t||t.download.state==="downloading")return!1;if(!t.installed||t.lastError&&!t.running)return!0;const a=t.providerSync??{};return(e.items??[]).filter(o=>o.enabled!==!1).every(o=>!!a[o.id])}async function Xi(){const e=sr().workbuddyDesktop;if(typeof e?.getSubscriptions=="function")for(let t=0;tsetTimeout(o,1500)),Io();let a;try{a=await e.getSubscriptions()}catch{return}if(Yi(a),t>=1&&a&&Array.isArray(a.items)&&GY(a))return}}async function Z2(e){const a=await sr().workbuddyDesktop?.addSubscription?.({enabled:!0,kind:"url",url:"",...e});return Yi(a),sn(r("已新增订阅「{name}」,内核正在同步节点…",{name:e.name.trim()})),Io(),Xi(),a??null}async function W2(e,t){const o=await sr().workbuddyDesktop?.saveSubscription?.({id:e.id,...t});Yi(o),sn(r("已保存「{name}」",{name:t.name.trim()})),Io(),Xi()}async function KY(e,t){const a=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const o=await a?.saveSubscription?.({id:e.id,name:e.name,url:e.url,kind:e.kind,enabled:t});Yi(o),sn(t?r("已启用「{name}」",{name:e.name}):r("已禁用「{name}」",{name:e.name})),Io(),Xi()}catch(o){sn(r("保存失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function YY(e){const t=sr().workbuddyDesktop;if(!(Ht.refreshing||Ht.pending)){yn({refreshing:e.id});try{const a=await t?.refreshSubscription?.(e.id);Yi(a),sn(r("已刷新「{name}」,正在同步节点…",{name:e.name})),Io(),Xi()}catch(a){sn(r("刷新失败:{reason}",{reason:jr(a)}),"err")}finally{yn({refreshing:null})}}}async function XY(e){const t=sr().workbuddyDesktop;if(await window.wbConfirm?.ask?.({title:r("删除订阅"),html:r("确定删除「{name}」?它在代理池里的节点会一并移除,引用这些节点的账号会回退直连。",{name:e.name||e.id}),okText:r("删除"),okClass:"danger"})&&!Ht.pending){yn({pending:!0});try{const o=await t?.removeSubscription?.(e.id);Yi(o),sn(r("已删除「{name}」",{name:e.name||e.id})),Io(),Xi()}catch(o){sn(r("删除失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function QY(e){const t=sr().workbuddyDesktop;if(typeof t?.downloadKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const a=await t.downloadKernel(e);a&&Ht.data&&yn({data:{...Ht.data,kernel:a}}),a?.saved===!1&&sn(r("下载线路 / 存放目录没能写进配置(本次下载已按新设置走,重启后会恢复原值)"),"err");for(let c=0;c<300;c+=1){await new Promise(f=>setTimeout(f,1e3));const d=await t.getKernelStatus?.();if(d&&Ht.data&&yn({data:{...Ht.data,kernel:d}}),!d||d.download.state!=="downloading")break}const o=Ht.data?.kernel;o?.download.state==="error"?sn(r("内核下载失败:{reason}",{reason:o.download.error||r("未知错误")}),"err"):o?.download.state==="canceled"?sn(r("已停止下载内核(未下载完的临时文件已删除)")):o?.download.state==="done"&&(sn(r("✅ 内核下载完成,正在启动…")),Xi())}catch(a){sn(r("内核下载失败:{reason}",{reason:jr(a)}),"err")}finally{yn({pending:!1})}}}async function ZY(){const e=sr().workbuddyDesktop;if(typeof e?.cancelKernelDownload!="function")return"none";try{const t=await e.cancelKernelDownload();if(t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),t?.canceled===!1)return"none";for(let o=0;o<20;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.download.state!=="downloading")break;await new Promise(d=>setTimeout(d,250))}const a=Ht.data?.kernel?.download.state;return a==="canceled"?"canceled":a==="done"?"done":"stalled"}catch(t){return sn(r("停止下载失败:{reason}",{reason:jr(t)}),"err"),"none"}}async function WY(){const e=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const t=await e?.restartKernel?.();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),sn(r("内核正在启动…")),Io(),Xi()}catch(t){sn(r("内核启动失败:{reason}",{reason:jr(t)}),"err")}finally{yn({pending:!1})}}}async function JY(){const e=sr().workbuddyDesktop;if(typeof e?.stopKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const t=await e.stopKernel();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}});for(let o=0;o<10;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.running===!1)break;await new Promise(d=>setTimeout(d,500))}const a=Ht.data?.kernel;if(a?.running===!1)sn(r("内核已关闭(订阅与端口注册表保留,「启动内核」后原位恢复)"));else{const o=a?.lastError||r("内核没有在超时内停下来");sn(r("关闭内核失败:{reason}",{reason:o}),"err")}Ml(!0)}catch(t){sn(r("关闭内核失败:{reason}",{reason:jr(t)}),"err"),Ml(!0)}finally{yn({pending:!1})}}}async function eX(){const e=sr().workbuddyDesktop;if(typeof e?.removeKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}const t=Vu()?.version;if(!await window.wbConfirm?.ask?.({title:r("删除内核"),html:r("确定删除已下载的内核{version}?内核文件与端口映射会被移除,订阅节点会变成「未分配端口」,引用它们的账号会暂时回退直连;订阅本身保留,重新下载内核后会重新分配端口。",{version:t?`(${t})`:""}),okText:r("删除内核"),okClass:"danger"})||Ht.pending)return;yn({pending:!0});const o=Vu()?.lastError||"";try{const c=await e.removeKernel();c&&Ht.data&&yn({data:{...Ht.data,kernel:c}});for(let f=0;f<20;f+=1){const p=await e.getKernelStatus?.();if(p&&Ht.data&&yn({data:{...Ht.data,kernel:p}}),p&&p.installed===!1||p?.lastError&&p.lastError!==o)break;await new Promise(h=>setTimeout(h,500))}const d=Ht.data?.kernel;if(d?.installed===!1)sn(r("已删除内核(订阅与账号引用保留,重新下载后会重新分配端口)")),Io();else{const f=d?.lastError&&d.lastError!==o?d.lastError:r("内核目录没能删掉(可能仍被进程占用),稍后重试一次");sn(r("删除内核失败:{reason}",{reason:f}),"err")}Ml(!0)}catch(c){sn(r("删除内核失败:{reason}",{reason:jr(c)}),"err"),Ml(!0)}finally{yn({pending:!1})}}async function tX(e){const t=sr().workbuddyDesktop;if(typeof t?.decodeQrImage!="function")throw new Error(r("当前环境不支持订阅(桥接方法缺失)"));const a=await new Promise((d,f)=>{const p=new FileReader;p.onload=()=>d(String(p.result||"")),p.onerror=()=>f(new Error(r("图片读取失败"))),p.readAsDataURL(e)}),c=(await t.decodeQrImage({imageBase64:a}))?.url;if(!c)throw new Error(r("二维码里没有订阅链接"));return c}function nX(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result||"")),o.onerror=()=>a(new Error(r("文件读取失败"))),o.readAsDataURL(e)})}function J2(e){return(Math.max(0,Number(e)||0)/1024/1024).toFixed(1)}function sX(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")}function rX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),o=a?.download,c=o?.state==="downloading",d=c&&o&&o.total>0?Math.round(o.received/o.total*100):null,[f,p]=x.useState(null),[h,b]=x.useState(""),[y,v]=x.useState(null),[w,j]=x.useState(a?.kernelDir||""),[S,N]=x.useState(!1),[k,T]=x.useState(!1),[D,C]=x.useState("");x.useEffect(()=>{let H=!0;return(async()=>{try{const B=(await sr().workbuddyDesktop?.getProxyPool?.())?.items;if(!Array.isArray(B))throw new Error(r("代理池响应异常"));H&&p(B)}catch(B){if(!H)return;p([]),b(jr(B))}})(),()=>{H=!1}},[]),x.useEffect(()=>{a?.installed&&e()},[a?.installed]);const A=Q2({proxyChoice:a?.downloadProxy??null,pool:f,poolError:h}),R=y??A.current,I=A.items.find(H=>H.value===R)??A.selected,P=a?.kernelDirDefault||"";async function O(){if(S)return;const H=w.trim();if(H&&!sX(H)){C(r("存放位置要填绝对路径,例如 D:\\proxy-kernel"));return}C(""),N(!0);try{const B={dir:H};R!==pp&&(B.proxy=R===""?null:{source:"pool",proxyId:R.slice(Xa.length)}),QY(B)}finally{N(!1)}}async function _(){if(!k){T(!0);try{const H=await ZY();H==="done"?sn(r("下载已经完成,停止没赶上(内核已安装)")):H==="none"?sn(r("当前没有正在进行的下载"),"err"):H==="stalled"&&sn(r("停止请求已发出,但下载还没收手,稍后再看一次进度"),"err")}finally{T(!1)}}}async function L(){const H=sr().workbuddyDesktop;if(typeof H?.pickFolder!="function"){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}try{const B=await H.pickFolder(w.trim()||P||null);if(B?.unsupported){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}if(B?.canceled||!B?.path)return;j(B.path)}catch(B){sn(r("打开文件夹选择框失败:{reason}",{reason:jr(B)}),"err")}}return s.jsx(Qt,{open:!0,onOpenChange:H=>{H||e()},children:s.jsxs(Zt,{className:"w-[min(520px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r(c?"正在下载内核":"下载内核")}),s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("内核 {version}({asset})",{version:a?.version||"—",asset:a?.asset||"—"})})]}),c?s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tf,{value:d??null}),s.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[s.jsx("span",{className:"text-text-2",children:d!==null?r("{percent}%({received} / {total} MB)",{percent:d,received:J2(o?.received),total:J2(o?.total)}):r("正在连接 GitHub…")}),s.jsx("span",{className:"text-subtle",children:r("存放位置 {dir}",{dir:a?.kernelDir||"—"})})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("关掉这个窗口不会中断下载(它在后台继续跑)—— 要停下就点下面的「停止下载」,未下载完的临时文件会被删除。")})]}):s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-proxy",children:r("下载线路")}),s.jsxs(ft,{value:R,onValueChange:H=>v(String(H)),children:[s.jsx(mt,{id:"kernel-proxy",className:Ue("w-full",A.broken&&"border-destructive-bd"),children:s.jsx(pt,{className:"min-w-0 truncate",children:I?.label||r("直连")})}),s.jsx(ht,{children:A.items.map(H=>s.jsx(qe,{value:H.value,disabled:H.disabled,children:H.label},H.value))})]}),s.jsx("div",{className:"text-[12px] text-subtle",children:A.broken?r("当前线路不可用:{error};重新选一条或切回直连",{error:String(a?.downloadProxy?.error||"")}):r("选项来自「网络代理」页(Clash Verge 同步的出口在这里可用;订阅节点要等内核起来才有端口)。选「直连」时连不上会自动借 Clash 混合端口重试一次;选定某条线路后只走它。")})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-dir",children:r("存放位置")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{id:"kernel-dir",className:"min-w-0 flex-1 font-mono text-[12px]",autoComplete:"off",spellCheck:!1,value:w,placeholder:P,onChange:H=>j(H.currentTarget.value)}),s.jsx(se,{variant:"outline",size:"sm",className:"flex-none",onClick:()=>{L()},children:r("选择目录…")}),P&&w.trim()!==P?s.jsx(se,{variant:"ghost",size:"sm",className:"flex-none",title:P,onClick:()=>j(P),children:r("恢复默认")}):null]}),s.jsx("div",{className:"text-[12px] text-subtle",children:r("内核二进制 / 配置 / 端口映射都会放在这里,默认 {dir};目录不存在会在下载开始时自动创建。",{dir:P||"—"})})]}),o?.state==="error"&&o.error?s.jsx("span",{className:"text-[12px] text-destructive",children:r("上次下载失败:{reason}",{reason:o.error})}):null,o?.state==="canceled"?s.jsx("span",{className:"text-[12px] text-subtle",children:r("上次下载已停止,未下载完的临时文件已删除")}):null,D?s.jsx("span",{className:"text-[12px] text-destructive",children:D}):null]}),s.jsx(nn,{children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("后台继续")}),s.jsx(se,{variant:"destructive",disabled:k,onClick:()=>{_()},children:r(k?"正在停止…":"停止下载")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("取消")}),s.jsx(se,{variant:"default",disabled:S||t.pending,onClick:()=>{O()},children:r(S?"正在开始…":"下载")})]})})]})})}function eD({showPortRange:e=!1}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),[o,c]=x.useState(null),[d,f]=x.useState(!1);x.useEffect(()=>{let b=!0;return(async()=>{try{const y=await $2();if(!b||!y)return;const v=Number(y.listenerPortBase),w=Number(y.listenerPortEnd);Number.isFinite(v)&&Number.isFinite(w)&&v>0&&w>0&&c({base:v,end:w})}catch{}})(),()=>{b=!1}},[]);const p=a?.download.state==="downloading",h=p&&a.download.total>0?Math.round(a.download.received/a.download.total*100):null;return s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ze,{variant:a?.running?"default":"secondary",children:a?.running?r("内核运行中"):a?.installed?a.halted?r("内核已手动关闭"):r("内核已停止"):r("内核未安装")}),s.jsxs("span",{className:"text-[12.5px] text-text-2",children:[a?.installed?r("内核 {version}",{version:a.version})+" · ":"",a?.running?r("控制端口 {port} · {n} 个节点监听器",{port:a?.controllerPort??"—",n:a?.listenerCount??0}):a?.installed?a.halted?r("内核已手动关闭(点「启动内核」拉起)"):r("内核已停止,点「启动内核」拉起"):r("按需下载(约 20-40MB)")]}),e&&o?s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("节点端口范围 {base}–{end}",{base:o.base,end:o.end})}):null,s.jsx("div",{className:"ml-auto flex items-center gap-2",children:a?.installed?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{WY()},children:a?.running?r("重启内核"):r("启动内核")}),a?.running?s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{JY()},children:r("关闭内核")}):null,s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending||p,onClick:()=>{eX()},children:r("删除内核")})]}):s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending&&!p,onClick:()=>f(!0),children:r(p?"下载中…":"下载内核")})})]}),p?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tf,{className:"min-w-[200px] flex-1",value:h??null}),s.jsx("span",{className:"text-[11px] text-subtle",children:h!==null?r("{percent}%({received} / {total} MB)",{percent:h,received:tD(a.download.received),total:tD(a.download.total)}):r("下载中…")})]}):null,a?.lastError?s.jsx("span",{className:"text-[12px] text-destructive",children:a.lastError}):null,d?s.jsx(rX,{onClose:()=>f(!1)}):null]})}function aX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=$Y(),o=t.data!==null,[c,d]=x.useState(null);return x.useEffect(()=>{Ml()},[]),s.jsxs(Qt,{open:!0,onOpenChange:f=>{f||e()},children:[s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r("订阅管理")}),s.jsxs("span",{className:"text-[11.5px] text-subtle",children:[o?r("{n} 条订阅",{n:a.length}):r("加载中…")," · ",r("节点由内核起成本地监听器,镜像进代理池")]})]}),s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(eD,{}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-[18%]"}),s.jsx("col",{className:"w-[31%]"}),s.jsx("col",{className:"w-[9%]"}),s.jsx("col",{className:"w-[14%]"}),s.jsx("col",{className:"w-[8%]"}),s.jsx("col",{className:"w-[20%]"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("名称")}),s.jsx("th",{children:r("订阅来源")}),s.jsx("th",{className:"ta-center",children:r("节点")}),s.jsx("th",{children:r("上次同步")}),s.jsx("th",{className:"ta-center",children:r("启用")}),s.jsx("th",{className:"ta-right",children:r("操作")})]})}),s.jsx("tbody",{children:a.length?a.map(f=>{const p=Vu()?.providerSync?.[f.id];return s.jsxs("tr",{className:f.enabled?"":"off",children:[s.jsx("td",{children:s.jsx("b",{children:f.name||r("未命名")})}),s.jsx("td",{className:"group",children:s.jsx("div",{className:"flex min-w-0 items-center gap-1",children:f.kind==="local"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.fileName,children:f.fileName||r("本地 YAML 文件")}),s.jsx(ze,{variant:"secondary",children:r("本地文件")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.url,children:lX(f.url)}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)] opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","data-copy":f.url,title:r("复制订阅链接"),children:"⧉"})]})})}),s.jsx("td",{className:"ta-center",children:nD(p,f)>0?s.jsx(ze,{variant:"secondary",children:r("{n} 个",{n:nD(p,f)})}):s.jsx("span",{className:"text-subtle",children:r("—")})}),s.jsx("td",{children:p?.at?s.jsx("span",{className:"text-[12px] text-text-2",children:L2(p.at)}):s.jsx("span",{className:"text-subtle",children:r("未同步")})}),s.jsx("td",{className:"ta-center",children:s.jsx(hs,{checked:f.enabled,disabled:t.pending,"aria-label":r("启用订阅「{name}」",{name:f.name||r("未命名")}),onCheckedChange:h=>{KY(f,h)}})}),s.jsx("td",{children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending||t.refreshing!==null||f.kind==="local",title:f.kind==="local"?r("本地文件订阅无需更新(要换内容请编辑后重新选择文件)"):void 0,onClick:()=>{YY(f)},children:t.refreshing===f.id?r("更新中…"):r("立即更新")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending,onClick:()=>d({item:f}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending,onClick:()=>{XY(f)},children:r("删除")})]})})]},f.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"empty",children:o?s.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[s.jsx("span",{children:r("还没有订阅:粘贴订阅链接、导入本地 YAML 文件,或从图片识别二维码。")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅里的节点会自动同步进代理池,账号即可引用。")})]}):r("加载中…")})})})]})}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅里的节点会被内核起成本地监听器,镜像到代理池(账号按 id 引用,与本页其它出口同一用法)。内核只在用到订阅时按需下载(约 20-40MB),不随安装包分发。")}),t.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:t.error})}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"default",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("完成")})]})]}),c?s.jsx(oX,{item:c.item,onClose:()=>d(null)}):null]})}function tD(e){return!Number.isFinite(e)||e<=0?"—":(e/1e3/1e3).toFixed(1)}function lX(e){try{const t=new URL(e);return t.host+(t.pathname!=="/"?"/…":"")}catch{return e.slice(0,60)}}function nD(e,t){return e?.count??t.nodeCount}function oX({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.kind==="local"?"local":"url"),[d,f]=x.useState(e?.name||""),[p,h]=x.useState(e?.url||""),[b,y]=x.useState(e?.fileName||""),[v,w]=x.useState(""),[j,S]=x.useState(e?e.enabled:!0),[N,k]=x.useState(!1),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null),P=x.useRef(null);async function O(){if(N)return;const z=d.trim();if(!z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请填写订阅名称")]}));return}const Q=p.trim();if(o==="url"&&!(Q.startsWith("http://")||Q.startsWith("https://"))){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("订阅链接必须是 http:// 或 https:// 开头")]}));return}if(!a&&o==="local"&&!v){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请选择要导入的 YAML 文件")]}));return}k(!0);try{a&&o==="local"?await W2(e,{name:z,enabled:j,kind:"local",fileName:b||void 0,...v?{contentB64:v}:{}}):a?await W2(e,{name:z,url:Q,enabled:j,kind:"url"}):o==="local"?await Z2({name:z,kind:"local",fileName:b||void 0,contentB64:v}):await Z2({name:z,kind:"url",url:Q}),t()}catch(K){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(K)]})),k(!1)}}async function _(z){if(!T){D(!0),I(r("正在识别二维码…"));try{const Q=await tX(z);h(Q),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已识别订阅链接")]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{D(!1)}}}async function L(z){if(!C){A(!0),I(null);try{const Q=await nX(z);w(Q),y(z.name),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已选择「{name}」,保存后导入",{name:z.name})]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{A(!1)}}}function H(z){if(o!=="url")return;const K=Array.from(z.clipboardData?.files||[]).find(X=>X.type.startsWith("image/"));K&&(z.preventDefault(),_(K))}function B(z){z!==o&&(c(z),I(null))}return s.jsx(Qt,{open:!0,onOpenChange:z=>{!z&&!N&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",overlayForceRender:!0,onPaste:H,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑订阅":"新增订阅")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-name",children:r("名称")}),s.jsx($e,{id:"sub-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:我的机场"),value:d,onChange:z=>f(z.currentTarget.value)})]}),a?null:s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:r("订阅来源")}),s.jsx(In,{options:[{value:"url",label:r("订阅链接")},{value:"local",label:r("本地 YAML 文件")}],value:o,onValueChange:B,"aria-label":r("订阅来源")})]}),o==="url"?s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-url",children:r("订阅链接")}),s.jsx($e,{id:"sub-url",autoComplete:"off",spellCheck:!1,placeholder:"https://…",value:p,onChange:z=>h(z.currentTarget.value)}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:T,onClick:()=>P.current?.click(),children:r(T?"识别中…":"从图片识别二维码")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("也可以把二维码截图直接粘贴到弹窗里(Ctrl+V)")}),s.jsx("input",{ref:P,type:"file",accept:"image/*",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&_(Q),z.currentTarget.value=""}})]})]}):s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-file",children:r("YAML 文件")}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:C,className:"shrink-0",onClick:()=>P.current?.click(),children:r(C?"读取中…":a?"重新选择文件…":"选择 YAML 文件…")}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:b||void 0,children:b||r(a?"保持原文件":"未选择文件")})]}),a?s.jsx("span",{className:"text-[11px] text-subtle",children:r("本地文件不会自动更新:要更新节点,重新选择文件后保存;不重选则内容保持不变。")}):null,s.jsx("input",{ref:P,type:"file",accept:".yaml,.yml,text/yaml,application/yaml,text/plain",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&L(Q),z.currentTarget.value=""}})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:j,onCheckedChange:S,"aria-label":r("启用这条订阅")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的订阅不参与内核同步,它的节点会从代理池移除)")})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r(o==="url"?"订阅内容由内核定时刷新(每 24 小时);节点数与同步状态在保存后由轮询刷新,稍等几秒。":"本地文件订阅的内容在导入时固定:节点会由内核起成本地监听器并镜像进代理池,节点数稍等几秒由轮询刷新。")}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:N,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:N||T||C,onClick:()=>{O()},children:r(N?"保存中…":"保存")})]})]})})}const g0=[{key:"pick",label:r("选择"),align:"center"},{key:"name",label:r("节点")},{key:"addr",label:r("地址")},{key:"state",label:r("启用"),align:"center"},{key:"test",label:r("连通性")},{key:"act",label:r("操作"),align:"right"}],iX={pick:"p-pick",name:"",addr:"p-addr",state:"p-state",test:"p-test",act:"p-act"},sD="proxies";function x0(){return window}let nx=null,rD=null;function aD(){return nx?nx.apply([...g0]):g0.map(e=>({...e,align:e.align??"left"}))}function cX(){x0().wbTableColumns?.repaint?.(sD)}function uX(e){if(rD=e,nx)return!0;const t=x0().wbColSettings;return t?.register?(nx=t.register({id:sD,label:r("代理池表"),columns:g0.map(a=>({key:a.key,label:a.label,align:a.align??"left"})),mount:()=>document.querySelector('.page[data-page="proxies"] .panel-head .head-actions'),onChange:()=>rD?.()}),!0):!1}function dX(){x0().wbColSettings?.close?.()}function fX(){const e=x.useSyncExternalStore(kY,CY),t=x.useSyncExternalStore(ex,tx).data?.items??[],[a,o]=x.useState(null),[c,d]=x.useState(!1),[f,p]=x.useState(!1),[h,b]=x.useState(""),[y,v]=x.useState("all"),[w,j]=x.useState("all"),[S,N]=x.useState("all"),[k,T]=x.useState(0),[,D]=x.useReducer(J=>J+1,0),C=Wg(),A=e.data!==null,R=e.selected.size,I=C.filter(J=>e.selected.has(J.id)&&Qg(J)).length,P=e.batchProgress;x.useEffect(()=>{Ml()},[]),x.useLayoutEffect(()=>{if(!uX(()=>D())){const J=window.setTimeout(()=>T(ie=>ie+1),50);return()=>window.clearTimeout(J)}D()},[k]),x.useLayoutEffect(()=>{cX()}),x.useEffect(()=>()=>{dX()},[]);const O=h.trim().toLowerCase(),_=hX(C,t);function L(J){return w==="all"?!0:w==="manual"||w==="clash"||w==="subscription"?tl(J)===w:w===iD?!!J.orphan:J.source==="subscription"&&!J.orphan&&J.providerId===w}function H(J){return!(y!=="all"&&tl(J)!==y||!L(J)||S!=="all"&&oD(J)!==S||O&&![J.name,Uh(J),J.host,J.protocol,String(J.port??"")].join(" ").toLowerCase().includes(O))}function B(J){const ie=J??"all";j(ie),v(ie==="all"?"all":ie==="manual"||ie==="clash"?ie:"subscription")}function z(J){v(J),j("all")}const Q=C.filter(H),K=Q.map(J=>J.id),X=K.length>0&&K.every(J=>e.selected.has(J)),q=K.some(J=>e.selected.has(J))&&!X,$=aD(),Y=[];for(const J of lD())Y.push(...Q.filter(ie=>tl(ie)===J.key));const F=ig(Q.length,"proxies"),G=F.paged?F.slice(Y):Y,W=new Map;for(const J of Q)W.set(tl(J),(W.get(tl(J))??0)+1);x.useEffect(()=>{F.goto(1)},[O,y,w,S]);function le(J){const ie=J.lastTest;if(!ie||!ie.at)return s.jsx("span",{className:"text-subtle",children:r("未测试")});const ge=f0(ie.durationMs);return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsxs("span",{className:ie.success?"text-success":"text-destructive",children:[ie.success?r("✅ {ip}",{ip:ie.ip||r("连接成功")}):r("❌ 连接失败"),ge?` ${ge}`:"",s.jsxs("span",{className:"text-[11px] text-subtle",children:[" ",L2(ie.at)]})]}),ie.success?null:s.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-subtle",title:String(ie.error||r("连接失败")),children:String(ie.error||r("连接失败"))})]})}function M(J){const ie=J.usedBy||[],ge=[];return J.protocol&&ge.push(J.protocol),ie.length&&ge.push(s.jsx("span",{className:"text-warn",title:ie.map(ee=>String(ee.name||ee.id||"")).join(r("、")),children:r("{n} 个账号在用",{n:ie.length})})),ge.length?s.jsx("span",{className:"text-[11px] text-subtle",children:ge.map((ee,fe)=>s.jsxs(x.Fragment,{children:[fe?" · ":"",ee]},fe))}):null}function U(J){if(xY(J)&&(J.port===null||J.port===void 0))return s.jsx("span",{className:"text-subtle",children:r("已禁用(未开监听端口)")});if(J.resolveError){const ge=J.source==="subscription"&&(J.port===null||J.port===void 0);return s.jsx("span",{className:ge?"text-subtle":"text-destructive",title:J.resolveError,children:r(ge?"未分配端口":"解析失败")})}if(hY(J)){const ge=Vu()?.installed===!1;return s.jsx("span",{className:"text-subtle",title:r(ge?"代理内核未安装(在「订阅管理」里下载内核后,节点会自动分配监听端口)":"还没有监听端口(还没有账号引用它 —— 在账号里选它并保存后,内核会自动开端口)"),children:Uh(J)||r("未分配端口")})}const ie=Uh(J);return s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx("span",{className:"min-w-0 flex-1 font-mono text-[12px] leading-[1.45] text-text-2 break-all",title:ie||void 0,children:ie||"—"}),ie?s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn flex-none","data-copy":ie,title:r("复制地址"),children:"⧉"}):null]})}function Z(J,ie,ge,ee){const fe=ge||e.batchBusy;switch(J){case"pick":return s.jsx(Mr,{checked:ee,title:r("勾选后可批量操作"),"aria-label":r("勾选「{name}」",{name:ie.name||r("未命名")}),onCheckedChange:te=>EY(ie.id,te)});case"name":return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsx("b",{children:ie.name||r("未命名")}),M(ie)]});case"addr":return U(ie);case"state":{const te=B2(ie);return s.jsx(hs,{checked:ie.enabled!==!1,disabled:fe||te,"aria-label":r("启用「{name}」",{name:ie.name||r("未命名")}),title:NY(ie),onCheckedChange:Ce=>{DY(ie,Ce)}})}case"test":return le(ie);case"act":{const te=Zg(ie);Qg(ie);const Ce=V2(ie),re=e.testing===ie.id;return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe||e.testing!==null,onClick:()=>{MY(ie)},children:r(re?"测试中…":"测试")}),ie.source!=="clash"&&ie.source!=="subscription"?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe,onClick:()=>o({item:ie}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,onClick:()=>{F2(ie)},children:r("删除")})]}):null,te?s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,title:Ce,onClick:()=>{F2(ie)},children:r("删除")}):null]})}default:return null}}function ae(J){const ie=e.pending.has(J.id),ge=TY(J.id);return s.jsx("tr",{className:Ue(J.enabled?"":"off",ge&&"bg-primary-soft"),"data-id":J.id,children:$.map(ee=>s.jsx("td",{className:`ta-${ee.align}`,children:Z(ee.key,J,ie,ge)},ee.key))},J.id)}function ce(){if(!C.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:r(A?"还没有代理。点右上角「+ 新增代理」手填一个,点「同步 Clash Verge」把 Clash 的出口导进来,或在「订阅管理」里导入订阅节点。":"加载中…")})});if(!Q.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:O?r("没有匹配「{kw}」的出口",{kw:h.trim()}):r("没有匹配当前筛选的出口")})});const J=[];let ie="";for(const ge of G){const ee=tl(ge);if(ee!==ie){ie=ee;const fe=lD().find(te=>te.key===ee);J.push(s.jsx("tr",{className:"tr-group",children:s.jsxs("td",{colSpan:$.length,children:[s.jsx("span",{className:"prov-tag",children:fe?.label??ee}),r("{n} 个",{n:W.get(ee)??0}),fe?.note?s.jsxs("span",{className:"font-normal",children:[" · ",fe.note]}):null]})},`group:${ee}:${J.length}`))}J.push(ae(ge))}return s.jsx(s.Fragment,{children:J})}return s.jsx(s.Fragment,{children:s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("代理池")}),s.jsx("span",{className:"panel-sub",children:A?r("{n} 个出口",{n:C.length}):r("加载中…")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅与 Clash 的出口自动镜像进来")}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>d(!0),children:r("设置")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>p(!0),children:t.length?r("订阅管理({n})",{n:t.length}):r("订阅管理")}),s.jsx(se,{variant:"outline",disabled:e.syncing||e.batchBusy,onClick:()=>{OY()},children:e.syncing?r("同步中…"):r("同步 Clash Verge")}),s.jsx(se,{variant:"outline",disabled:e.loading||e.batchBusy,onClick:()=>{fp(),Ml()},children:e.loading?r("刷新中…"):r("刷新")}),s.jsx(se,{variant:"default",disabled:e.batchBusy,onClick:()=>o({item:null}),children:r("+ 新增代理")})]})]}),s.jsx("div",{className:"px-3 pt-3",children:s.jsx(eD,{showPortRange:!0})}),R>0?s.jsxs("div",{className:"batch-bar active",children:[s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{children:R})," ",r("个 · 共")," ",s.jsx("b",{children:Q.length})," ",r("个")]}),I?s.jsx("span",{className:"batch-hidden",children:r("其中 {n} 条是同步来的只读条目(Clash / 订阅):可参与批量测试,删除会跳过",{n:I})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>{PY()},children:P?r("测试中 {done}/{total}",{done:P.done,total:P.total}):r("批量测试")}),s.jsx(se,{variant:"destructive",disabled:e.batchBusy,onClick:()=>{_Y()},children:r("批量删除")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>RY(),children:r("取消选择")})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 border-b border-border px-4 py-[10px]",children:[s.jsxs(Ci,{className:"w-[clamp(150px,22vw,220px)]",children:[s.jsx(Ei,{type:"search",value:h,"aria-label":r("搜索节点"),placeholder:r("搜索名称 / 地址 / 端口"),onChange:J=>b(J.currentTarget.value)}),s.jsx(Ti,{align:"inline-start","aria-hidden":"true",children:s.jsx(gX,{})})]}),s.jsxs(ft,{value:w,onValueChange:B,children:[s.jsx(mt,{className:"w-[clamp(150px,18vw,210px)]","aria-label":r("按提供方筛选"),children:s.jsx(pt,{children:_.find(J=>J.value===w)?.label??r("全部提供方")})}),s.jsx(ht,{children:_.map(J=>s.jsx(qe,{value:J.value,children:s.jsxs("span",{className:"flex w-full items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate"+(J.count?"":" text-subtle"),children:J.label}),s.jsx("span",{className:"flex-none text-[11px] text-subtle",children:J.count})]})},J.value))})]}),s.jsx(In,{options:pX(C),value:y,onValueChange:z,"aria-label":r("按来源筛选")}),s.jsx(In,{options:mX(C),value:S,onValueChange:N,"aria-label":r("按状态筛选")}),s.jsx("span",{className:"ml-auto text-[11px] text-subtle",children:r("显示 {n} / 共 {total} 个出口",{n:Q.length,total:C.length})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table proxies-table",children:[s.jsx("colgroup",{children:$.map(J=>s.jsx("col",{"data-col":J.key,className:iX[J.key]||void 0},J.key))}),s.jsx("thead",{children:s.jsx("tr",{children:$.map(J=>s.jsx("th",{"data-col":J.key,className:`ta-${J.align}`,children:J.key==="pick"?s.jsx(Mr,{checked:X,indeterminate:q,disabled:!K.length,title:r("全选当前筛选出的出口"),"aria-label":r("全选当前筛选出的出口"),onCheckedChange:ie=>AY(K,ie)}):J.label},J.key))})}),s.jsx("tbody",{children:ce()})]})}),s.jsx(Li,{leading:s.jsxs(s.Fragment,{children:[e.data?.clash&&e.data.clash.available===!1?s.jsx("span",{className:"text-subtle",children:e.data.clash.error?r("未检测到 Clash Verge:{reason}",{reason:e.data.clash.error}):r("未检测到 Clash Verge")}):null,e.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:e.error})}):null]}),total:Q.length,page:F.page,pageCount:F.pageCount,size:F.size,onSizeChange:F.setSize,onPageChange:F.goto,range:F.paged?{start:F.rangeStart,end:F.rangeEnd}:null}),a?s.jsx(BY,{item:a.item,onClose:()=>o(null)}):null,c?s.jsx(HY,{onClose:()=>d(!1)}):null,f?s.jsx(aX,{onClose:()=>p(!1)}):null]})})}function tl(e){return e.source==="clash"?"clash":e.source==="subscription"?"subscription":"manual"}function lD(){return[{key:"manual",label:r("手动"),note:r("本页可编辑、可删除")},{key:"clash",label:"Clash Verge",note:r("名字与端口在 Clash Verge 里改;启用可在本页关闭")},{key:"subscription",label:r("订阅"),note:r("名字与端口跟随订阅与内核;启用可在本页关闭")}]}function pX(e){const t=a=>e.filter(o=>tl(o)===a).length;return[{value:"all",label:r("全部"),count:e.length},{value:"manual",label:r("手动"),count:t("manual")},{value:"clash",label:"Clash",count:t("clash")},{value:"subscription",label:r("订阅"),count:t("subscription")}]}function oD(e){return e.enabled===!1?"off":e.port===null||e.port===void 0?"wait":e.lastTest?.at?e.lastTest.success?"ok":"fail":"none"}function mX(e){const t=a=>e.filter(o=>oD(o)===a).length;return[{value:"all",label:r("全部状态"),count:e.length},{value:"ok",label:r("可用"),count:t("ok")},{value:"fail",label:r("失败"),count:t("fail")},{value:"wait",label:r("未就绪"),count:t("wait")},{value:"off",label:r("已禁用"),count:t("off")}]}const iD="__orphan";function hX(e,t){const a=e.filter(d=>tl(d)==="subscription"),o=t.map(d=>({value:d.id,label:d.name||d.id,count:a.filter(f=>!f.orphan&&f.providerId===d.id).length})).sort((d,f)=>f.count-d.count||d.label.localeCompare(f.label)),c=a.filter(d=>d.orphan).length;return[{value:"all",label:r("全部提供方"),count:e.length},{value:"manual",label:r("手动"),count:e.filter(d=>tl(d)==="manual").length},{value:"clash",label:"Clash Verge",count:e.filter(d=>tl(d)==="clash").length},{value:"subscription",label:r("全部订阅"),count:a.length},...o,...c?[{value:iD,label:r("已移除的订阅"),count:c}]:[]]}function gX(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]})}window.wbProxiesPanel={load:async()=>{await fp(),await Ml()},visibleColumns:()=>aD().map(e=>({key:e.key}))};const cD='.page[data-page="proxies"]';function uD(){const e=document.querySelector(cD);!e||e.dataset.mounted==="1"||(e.dataset.mounted="1",e.replaceChildren(),vn.createRoot(e).render(s.jsx(fX,{})),tr().wbApp?.currentPage==="proxies"&&(fp(),Ml()))}document.querySelector(cD)?uD():document.addEventListener("DOMContentLoaded",uD,{once:!0});const sx=["today","7","30","month","all","custom"],b0="7",v0="custom",dD="workbuddy-desktop-report-range",fD="workbuddy-desktop-report-custom-range",pD={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部"),custom:r("自定义区间")},xX={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部"),custom:r("自定义")};function bX(){try{const e=localStorage.getItem(dD);return e!==null&&sx.includes(e)?e:b0}catch{return b0}}function y0(e){const t=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function vX(){const e=new Date;return{start:y0(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),end:y0(e)}}const rx=/^\d{4}-\d{2}-\d{2}$/;function yX(){try{const e=localStorage.getItem(fD);if(e){const t=JSON.parse(e),a=typeof t?.start=="string"?t.start:"",o=typeof t?.end=="string"?t.end:"";if(rx.test(a)&&rx.test(o)&&a<=o)return{start:a,end:o}}}catch{}return vX()}function wX(e){try{localStorage.setItem(fD,JSON.stringify(e))}catch{}}const jX=[[0,r("一")],[2,r("三")],[4,r("五")]],mD=400;function Qi(e){const t=w0();return t.formatInt?t.formatInt(e):(Number(e)||0).toLocaleString("zh-CN")}function w0(){return window.wbUnits||{}}function ss(e){const t=w0();return t.formatTokens?t.formatTokens(e):String(Number(e)||0)}function hD(e,t){const a=w0();return a.formatAxis?a.formatAxis(e,t):String(e)}function Zi(e){return`${((Number(e)||0)*100).toFixed(1)}%`}function Pt(e){return Math.round(e*10)/10}function ax(e){return[...e].reduce((t,a)=>t+(/[\u2e80-\u9fff]/.test(a)?9.7:5.4),0)}function lx(e){const[t,a,o]=String(e||"").split("-").map(Number);return new Date(t||1970,(a||1)-1,o||1)}const SX=[r("日"),r("一"),r("二"),r("三"),r("四"),r("五"),r("六")];function ox(e){const t=lx(e);return r("{m}月{d}日 周{wd}",{m:t.getMonth()+1,d:t.getDate(),wd:SX[t.getDay()]})}function gD(e){const t=String(e||"").slice(11,13);return t?`${t}:00`:"—"}const NX=8;function xD(e,t){const a=(Array.isArray(e)?e:[]).map(d=>({name:String(d?.label??d?.model??"").trim()||r("未知模型"),tokens:Number(d?.tokens)||0})).filter(d=>d.tokens>0);if(!a.length)return[];const o=a.slice(0,NX),c=o.map(d=>`${t?`[${t(d.name)}]`:""}${r("{model}:{tokens} tokens",{model:d.name,tokens:ss(d.tokens)})}`);return a.length>o.length&&c.push(r("…还有 {n} 个模型",{n:a.length-o.length})),c}function bD(e,t){return[ox(e.date),r("总 Token:{tokens}({n} 次请求)",{tokens:ss(e.tokens),n:Qi(e.requests)}),...xD(e.models,t)].join(` -`)}function kX(e,t){return[`${ox(String(e.hour).slice(0,10))} ${gD(e.hour)}`,r("命中率 {rate}(命中 {hit} / 输入 {input})",{rate:Zi(e.rate),hit:ss(e.hitTokens),input:ss(e.inputTokens)}),r("总 Token:{tokens}",{tokens:ss(e.totalTokens)}),...xD(e.models,t)].join(` -`)}const CX=[1,1.5,2,2.5,3,4,5,6,8,10];function TX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;return(CX.find(c=>c>=a-1e-9)??10)*t}function j0(e){return TX(e/4)*4}function EX(e,t,a){const o=e||{},c=o.topModel,d=Number(o.requests)||0,f=Number(o.successful)||0,p=d?`${(f/d*100).toFixed(1)}%`:"—",h=[{key:"requests",label:r("总请求数"),value:Qi(d),sub:pD[t]||"",mono:!1},{key:"successful",label:r("成功请求数"),value:Qi(f),sub:r("成功率 {rate}",{rate:p}),mono:!1},{key:"tokens",label:r("总 Token"),value:ss(o.tokens),sub:r("输入 + 输出"),mono:!1},{key:"activeDays",label:r("活跃天数"),value:Qi(o.activeDays),sub:r("区间共 {n} 天",{n:a}),mono:!1},{key:"streak",label:r("当前连续天数"),value:Qi(o.streak),sub:r("含今天在内往前数"),mono:!1}];return h.push(c?{key:"topModel",label:r("Top 模型"),value:String(c.model??""),sub:r("{tokens} tokens · 占 {pct}",{tokens:ss(c.tokens),pct:Zi(c.percentage)}),mono:!0}:{key:"topModel",label:r("Top 模型"),value:"—",sub:r("所选范围内还没有模型用量"),mono:!1}),h}function vD(e){if(!Array.isArray(e))return null;const t=e.map(c=>({id:String(c?.id??"").trim(),label:String(c?.label??"").trim(),tokens:Number(c?.totalTokens??c?.tokens)||0})).filter(c=>c.tokens>0);if(!t.length)return[];const a=t.reduce((c,d)=>c+d.tokens,0),o=c=>a?c/a*100:0;return[...t].sort((c,d)=>d.tokens-c.tokens).map((c,d)=>{const f=o(c.tokens),p=ss(c.tokens),h=c.label||c.id||r("未知"),b=c.id?r("{name}({id})",{name:h,id:c.id}):h;return{key:`${d}-${c.id||h}`,id:c.id,name:h,full:b,tip:r("{name}:{tokens} tokens · 占 {pct}%",{name:b,tokens:p,pct:f.toFixed(1)}),tokensText:p,percentText:`${f.toFixed(1)}%`,barWidth:`${f.toFixed(1)}%`}})}function yD(e){return`${ss(e.reduce((t,a)=>t+(Number(a?.totalTokens??a?.tokens)||0),0))} tokens`}const ix=["#f73b00","#f7bb07","#4aaa4d","#1872cb","#3444a3","#13c2c2","#722ed1","#eb2f96","#a0d911","#34d399","#d946ef","#ff85c0","#b37feb","#9d174d","#ffa39e","#69b1ff"],AX={size:220,inner:.62,outer:.88,padAngle:2};function RX(e,t,a,o,c,d){const f=D=>(D-90)*Math.PI/180,p=(D,C)=>[Pt(e+D*Math.cos(f(C))),Pt(t+D*Math.sin(f(C)))],h=d-c;if(h>=359.999){const[D,C]=p(a,0),[A,R]=p(a,180),[I,P]=p(o,0),[O,_]=p(o,180);return`M ${D} ${C} A ${a} ${a} 0 1 1 ${A} ${R} A ${a} ${a} 0 1 1 ${D} ${C} Z M ${I} ${P} A ${o} ${o} 0 1 0 ${O} ${_} A ${o} ${o} 0 1 0 ${I} ${P} Z`}const[b,y]=p(a,c),[v,w]=p(a,d),[j,S]=p(o,d),[N,k]=p(o,c),T=h>180?1:0;return`M ${b} ${y} A ${a} ${a} 0 ${T} 1 ${v} ${w} L ${j} ${S} A ${o} ${o} 0 ${T} 0 ${N} ${k} Z`}const OX="#9aa0a6";function wD(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=String(a?.label??a?.model??a?.id??"").trim();!o||t.has(o)||(Number(a?.totalTokens??a?.tokens)||0)>0&&t.set(o,ix[t.size%ix.length])}return t}function jD(e,t){const a=(Array.isArray(e)?e:[]).map(k=>({label:String(k?.label??k?.model??k?.id??"").trim()||t,tokens:Number(k?.totalTokens??k?.tokens)||0,requests:Number(k?.requests)||0})).filter(k=>k.tokens>0);if(!a.length)return null;const o=a.reduce((k,T)=>k+T.tokens,0);if(!o)return null;const c=wD(e),{size:d,inner:f,outer:p,padAngle:h}=AX,b=d/2,y=d/2,v=d/2*p,w=d/2*f;let j=0;const S=[],N=[];return a.forEach((k,T)=>{const D=k.tokens/o,C=D*360,A=a.length>1?Math.min(h/2,C/4):0,R=j+A,I=j+C-A;j+=C;const P=c.get(k.label)??ix[T%ix.length];let O=null;if(D>=.03){const _=(R+I)/2,L=w+(v-w)*.6,H=(_-90)*Math.PI/180;O={x:Pt(b+L*Math.cos(H)),y:Pt(y+L*Math.sin(H)),text:`${Math.round(D*100)}%`}}I>R&&S.push({key:`${T}-${k.label}`,d:RX(b,y,v,w,R,I),fill:P,evenOdd:C>=359.999,label:O,tip:`${k.label} · ${ss(k.tokens)} tokens · ${Zi(D)}`}),N.push({key:`${T}-${k.label}`,fill:P,name:k.label,tokensText:ss(k.tokens),percentText:Zi(D),tip:r("{name} · {tokens} tokens · {n} 次请求 · {pct}",{name:k.label,tokens:ss(k.tokens),n:Qi(k.requests),pct:Zi(D)})})}),{size:d,slices:S,legend:N,totalText:ss(o)}}const MX=[1,1.25,1.5,2,2.5,3,4,5,6,8,10];function DX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;let o=1;for(const c of MX)c<=a+1e-9&&(o=c);return o*t}function IX(e){const t=Number(e)||0;if(t<=0)return[0,1,2,3,1/0];const a=Math.max(1,DX(t/4));return[0,a,a*2,a*3,1/0]}function PX(e,t){if(e===0)return"0";const a=t[e-1],o=t[e];return Number.isFinite(o)?a===0?`≤${ss(o)}`:`${ss(a)}–${ss(o)}`:`>${ss(a)}`}function SD(e){const t=Array.isArray(e)?e:[];return IX(t.reduce((a,o)=>Math.max(a,Number(o?.tokens)||0),0))}function _X(e,t){const a=Array.isArray(e)?e:[];if(!a.length)return null;const o=(lx(a[0].date).getDay()+6)%7,c=new Array(o).fill(null).concat(a),d=Math.ceil(c.length/7),f=3,p=20,h=t-p,b=Math.floor((h-f*(d-1))/d),y=Math.max(7,Math.min(26,b)),v=y+3,w=y+f,j=p+d*w-f,S=Math.max(0,Math.round((t-j)/2)),N=v+7*w-f+2,k=Math.max(j,Math.round(t)),T=SD(a),D=O=>T.findIndex(_=>Number(O)<=_),C=[];for(let O=0;O({key:_,x:S+p-6,y:Pt(v+O*w+y/2),text:_})),R=[];let I=-1,P=-9;for(let O=0;O({level:t,text:PX(t,e)}))}function zX(e){const t=e||{};return[["last10m",r("近 10 分钟")],["last1h",r("近 1 小时")],["last24h",r("近 24 小时")],["last7d",r("近 7 天")]].map(([o,c])=>{const d=t[o]||{},f=Number(d.inputTokens)||0;return{key:o,label:c,value:f?Zi(d.rate):"—",sub:r("命中 {hit} / 输入 {input}",{hit:ss(d.hitTokens),input:ss(f)})}})}function BX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=230,d={left:44,right:56,top:26,bottom:24},f=Math.max(40,t-d.left-d.right),p=c-d.top-d.bottom,h=o.map(q=>Number(q.rate)||0),b=o.map(q=>Number(q.totalTokens)||0),y=Math.max(1,j0(Math.max(...h))),v=Math.max(...b),w=j0(v),j=v>0,S=q=>d.left+(o.length>1?f*q/(o.length-1):f/2),N=q=>d.top+p-p*q/y,k=q=>d.top+p-p*q/w,T=[],D=[],C=[];for(let q=0;q<=4;q+=1){const $=y*q/4,Y=Pt(N($)),F=$*100;T.push({key:`g${q}`,y:Y}),D.push({key:`r${q}`,x:d.left-8,y:Y,anchor:"end",text:`${Number.isInteger(F)?F:F.toFixed(1)}%`}),j&&C.push({key:`t${q}`,x:Pt(d.left+f+8),y:Y,anchor:"start",text:hD(w*q/4,w)})}const A=o.length===1?4.5:2.5,R=(q,$)=>({points:q.map((Y,F)=>`${Pt(S(F))},${Pt($(Y))}`).join(" "),dots:q.map((Y,F)=>({key:`d${F}`,cx:Pt(S(F)),cy:Pt($(Y))}))}),I=[],P=(q,$,Y,F)=>{const G=ax(Y),W=F==="middle"?q-G/2:F==="end"?q-G:q,le={left:W,right:W+G,top:$-8.5,bottom:$+2.5};return I.some(M=>le.leftM.left-2&&le.topM.top-1)?null:(I.push(le),{key:`${Y}-${q}-${$}`,x:Pt(q),y:Pt($),text:Y,anchor:F})},O=(q,$)=>{const Y=ax($)/2;return q-Yd.left+f+6?"end":"middle"},_=[];j&&o.forEach((q,$)=>{if(!(Number(q.totalTokens)>0))return;const Y=k(b[$]),F=Y-12>=d.top-10,G=ss(b[$]),W=P(S($),F?Y-12:Y+13,G,O(S($),G));W&&_.push({...W,key:`tl${$}`})});const L=[];o.forEach((q,$)=>{if(!((Number(q.inputTokens)||0)+(Number(q.hitTokens)||0)>0))return;const F=N(h[$]),G=F+15<=d.top+p+8,W=Zi(h[$]),le=P(S($),G?F+13:F-7,W,O(S($),W));le&&L.push({...le,key:`rl${$}`})});const H=o.length>1?f/(o.length-1):f,B=d.left,z=d.left+f,Q=o.length<=mD?o.map((q,$)=>{const Y=Math.max(B,S($)-H/2),F=Math.min(z,S($)+H/2);return{key:`h${$}`,x:Pt(Y),width:Pt(F-Y),tip:kX(q,a)}}):null,K=Math.max(1,Math.ceil(o.length/8)),X=[];for(let q=0;q=o.length;X.push({key:`x${q}`,x:Pt(S(q)),y:c-8,anchor:q===0?"start":$?"end":"middle",text:gD(o[q].hour)})}return{width:t,height:c,plotLeft:B,plotW:f,plotH:p,plotTop:d.top,grid:T,rateTicks:D,tokenTicks:C,rateLine:R(h,N),tokenLine:j?R(b,k):null,dotR:A,rateLabels:L,tokenLabels:_,hourTicks:X,hits:Q}}const HX=13;function UX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=240,d={left:50,right:14,top:26,bottom:26},f=Math.max(40,t-d.left-d.right),p=f/o.length,h=o.map(K=>Number(K.tokens)>0?ss(K.tokens):""),b=Math.max(0,...h.map(ax)),y=h.every(K=>!K)||b+4<=p,v=!y&&p>=HX;v&&(d.top=10+Math.ceil(b*1.25));const w=c-d.top-d.bottom,j=o.map(K=>Number(K.tokens)||0),S=Math.max(...j),N=j0(S),k=Math.max(1,Math.min(28,p*.68)),T=d.top+w,D=K=>d.top+w-w*K/N,C=o.length<=mD,A=S<=0,R=[],I=[];if(!A)for(let K=0;K<=4;K+=1){const X=N*K/4,q=Pt(D(X));R.push({key:`g${K}`,x1:d.left,y:q,x2:Pt(d.left+f)}),I.push({key:`v${K}`,x:d.left-8,y:q,anchor:"end",text:hD(X,N)})}const P=[];o.forEach((K,X)=>{const q=Number(K.tokens)||0;if(q<=0)return;const $=D(q);P.push({key:String(K.date??X),x:Pt(d.left+p*X+(p-k)/2),y:Pt($),width:Pt(k),height:Pt(Math.max(1,T-$)),rx:k>4?2:1,tip:bD(K),nativeTip:!C})});const O=[],_=[],L=(K,X)=>{const q=h[K],$=D(Number(o[K].tokens)||0),Y=Pt(d.left+p*K+p/2);if(v)return{key:`b${K}`,x:Y,y:Pt($-6),anchor:"start",text:q,rotate:!0};const F=$-6,G=F-9M.leftU.left-2&&M.topU.top-1))return null;_.push(M)}return{key:`b${K}`,x:Y,y:W,anchor:"middle",text:q}};if(y||v)h.forEach((K,X)=>{if(!K)return;const q=L(X,!1);q&&O.push(q)});else{const K=o.map((X,q)=>({index:q,value:Number(X.tokens)||0})).filter(X=>X.value>0).sort((X,q)=>q.value-X.value);for(const X of K){if(O.length>=8)break;const q=L(X.index,!0);q&&O.push(q)}}const H=C?o.map((K,X)=>({key:`h${X}`,x:Pt(d.left+p*X),width:Pt(p),tip:bD(K,a)})):null,B=Math.max(1,Math.ceil(o.length/6)),z=[];for(let K=0;K{const X=o.length===1,q=!X&&K===o.length-1,$=lx(o[K].date);return{key:`d${K}`,x:X?d.left+f/2:q?d.left+f:Pt(d.left+p*K+p/2),y:c-8,anchor:X?"middle":q?"end":K===0?"start":"middle",text:`${$.getMonth()+1}/${$.getDate()}`}});return{width:t,height:c,plotLeft:d.left,plotW:f,plotH:w,plotTop:d.top,grid:R,valueTicks:I,bars:P,barLabels:O,dateTicks:Q,hits:H,blank:A}}function Wi(){return window}const ND=1e3,VX=sx.map(e=>({value:e,label:xX[e]})),FX=r("所选范围内每个账号各消耗了多少 Token,按 Token 用量从多到少排。账号是比提供商更细的一维:同一家可以挂多个账号,转发时按优先级在候选链上依次尝试,所以这里反映的是「具体哪个登录态在出力」。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知账号」是指那批请求没有账号身份:走默认登录态转发(未配置账号列表)时会这样;这一维上线前写出的旧聚合行也没有账号明细,但它们会在升级导入旧数据时按明细自动补算回来 —— 只有明细已被手动清理掉的那几天补不回来,仍留在「未知账号」里,那是确实无从恢复的部分。"),$X=r("所选范围内每个提供商各消耗了多少 Token,按 Token 用量从多到少排。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了(请求体非法、模型不存在、没有可用账号)。这一维与账号那一维不同:旧明细里根本没有「哪家承载」的信息(早期版本只有单一上游,但那是配置事实而非逐条记录),所以无法回算,旧数据会一直留在「未知」里;此后新产生的请求都会记上具体的提供商。"),qX=r("所选范围内每个模型各消耗了多少 Token,按用量从多到少排,扇区角度即占比。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该模型的 Token 用量与百分比。扇区内的百分比只在 ≥3% 时标出,更小的会挤成一团 —— 完整读数在右侧列表与悬停气泡里。颜色按用量排名分配:最大的那段是红色,依次往后;同一份报表里换个维度看,配色口径不变。"),GX=r("所选范围内每个提供商各消耗了多少 Token,按用量从多到少排,扇区角度即占比。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该提供商的 Token 用量与百分比。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了。"),KX=r("命中率 = 缓存读取 Token / 输入 Token(promptTokens)。窗口越短越贴近「此刻」:上游把缓存读取与输入分开上报时,该比值合法地可能超过 100%,此处不夹取值、如实展示。"),YX=r("每天的总 Token 用量(输入 + 输出)。柱顶标出当天的读数;区间很长、柱子挤到放不下时只标最高的那几天,其余悬停柱子即可读到。");let cx=ND,ux=!0,S0=!1,N0=!1,k0=0,Po=null,Ji=null,dx=null;function ec(e,t="empty"){return s.jsx("div",{className:t,style:{padding:"14px 0"},children:e})}function fx({text:e}){return s.jsx("span",{className:"tip-q","data-tip":e})}function XX({accountId:e}){const t=(Wi().wbApp?.getState?.()?.accounts?.accounts||[]).find(f=>f?.id===e),a=typeof t?.provider=="string"?t.provider:"";if(!a)return null;const o=Wi().wbProviders?.labelOf?.(a)||a,c=t&&Wi().wbAccountsModel?.editionSuffix?.(t)||"",d=c?`${o} ${c}`:o;return s.jsx("span",{className:`pbadge p-${a}`,title:r("提供商:{text}",{text:d}),children:d})}function QX({summary:e,range:t}){const a=Array.isArray(e.dailyTrend)?e.dailyTrend:[];return s.jsx(s.Fragment,{children:EX(e.overview,t,a.length).map(o=>s.jsxs("div",{className:"field",children:[s.jsx("div",{className:"label",children:o.label}),s.jsxs("div",{className:o.mono?"value mono":"value",children:[o.value,o.sub?s.jsx("div",{className:"sub",children:o.sub}):null]})]},o.key))})}function kD({panelId:e,listId:t,labelId:a,title:o,tip:c,rows:d,totalText:f,withBadge:p,emptyText:h}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:o}),s.jsx(fx,{text:c}),s.jsx("span",{className:"panel-sub",id:a,children:f})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"rank-shares",id:t,children:d.length?d.map(b=>s.jsxs("div",{className:"rank-row","data-tip":b.tip,children:[s.jsxs("span",{className:"name",title:b.full,children:[p?s.jsx(XX,{accountId:b.id}):null,b.name]}),s.jsx("span",{className:"track",children:s.jsx("span",{className:"bar",style:{width:b.barWidth}})}),s.jsx("span",{className:"num",title:`${b.tokensText} tokens`,children:b.tokensText}),s.jsx("span",{className:"pct",children:b.percentText})]},b.key)):ec(h)})})]})}function CD({panelId:e,listId:t,title:a,tip:o,ariaLabel:c,view:d,emptyText:f}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:a}),s.jsx(fx,{text:o})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{id:t,children:d?s.jsxs("div",{className:"donut-layout",children:[s.jsxs("div",{className:"donut-wrap",children:[s.jsx("svg",{className:"donut-svg",width:d.size,height:d.size,viewBox:`0 0 ${d.size} ${d.size}`,role:"img","aria-label":c,children:d.slices.map(p=>s.jsxs(x.Fragment,{children:[s.jsx("path",{className:"donut-slice",d:p.d,fill:p.fill,fillRule:p.evenOdd?"evenodd":void 0,tabIndex:-1,"data-tip":p.tip}),p.label?s.jsx("text",{className:"donut-label",x:p.label.x,y:p.label.y,textAnchor:"middle",dominantBaseline:"central",children:p.label.text}):null]},p.key))}),s.jsxs("div",{className:"donut-center",children:[s.jsx("div",{className:"donut-center-value",children:d.totalText}),s.jsx("div",{className:"donut-center-label",children:r("总 Token")})]})]}),s.jsx("div",{className:"donut-legend",children:d.legend.map(p=>s.jsxs("div",{className:"donut-legend-row","data-tip":p.tip,children:[s.jsx("span",{className:"donut-dot",style:{background:p.fill}}),s.jsx("span",{className:"donut-legend-name",title:p.name,children:p.name}),s.jsx("span",{className:"donut-legend-tokens",children:p.tokensText}),s.jsx("span",{className:"donut-legend-percent",children:p.percentText})]},p.key))})]}):ec(f)})})]})}function ZX({view:e}){return s.jsxs("svg",{className:"report-svg",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,role:"img","aria-label":r("近 365 天活跃热力图"),children:[e.months.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:10,children:t.text},t.key)),e.weekdays.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:t.y,textAnchor:"end",dominantBaseline:"middle",children:t.text},t.key)),e.cells.map(t=>s.jsx("rect",{className:`hm-cell l${t.level}`,x:t.x,y:t.y,width:t.size,height:t.size,rx:2,tabIndex:-1,"data-tip":t.tip},t.key))]})}function TD({line:e,cls:t,radius:a}){return s.jsxs(s.Fragment,{children:[s.jsx("polyline",{className:`chart-line ${t}`,points:e.points}),e.dots.map(o=>s.jsx("circle",{className:`chart-dot ${t}`,cx:o.cx,cy:o.cy,r:a},o.key))]})}function C0({items:e,cls:t}){return s.jsx(s.Fragment,{children:e.map(a=>s.jsx("text",{className:`chart-label ${t}`,x:a.x,y:a.y,textAnchor:a.anchor,transform:a.rotate?`rotate(-90 ${a.x} ${a.y})`:void 0,dominantBaseline:a.rotate?"central":void 0,children:a.text},a.key))})}function WX({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("近 24 小时缓存命中率与总 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:o,y1:p.y,x2:Pt(o+c),y2:p.y},p.key)),e.rateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenLine?s.jsx(TD,{line:e.tokenLine,cls:"tokens",radius:e.dotR}):null,s.jsx(TD,{line:e.rateLine,cls:"rate",radius:e.dotR}),s.jsx(C0,{items:e.tokenLabels,cls:"tokens"}),s.jsx(C0,{items:e.rateLabels,cls:"rate"}),e.hourTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key))]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}function JX({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("按天 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:p.x1,y1:p.y,x2:p.x2,y2:p.y},p.key)),e.valueTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.bars.map(p=>p.nativeTip?s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx,children:s.jsx("title",{children:p.tip})},p.key):s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx},p.key)),s.jsx(C0,{items:e.barLabels,cls:"tokens"}),e.dateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key)),e.blank?s.jsx("text",{className:"chart-empty",x:Pt(o+c/2),y:Pt(d+f/2),textAnchor:"middle",children:r("所选范围内暂无请求")}):null]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}const eQ=680;function T0(){const e=x.useRef(null),[t,a]=x.useState(0);return x.useLayoutEffect(()=>{const o=e.current;if(!o)return;let c=o.clientWidth;if(c&&a(c),typeof ResizeObserver!="function")return;const d=new ResizeObserver(()=>{const f=o.clientWidth;!f||f===c||(c=f,a(f))});return d.observe(o),()=>d.disconnect()},[]),[e,t||eQ]}async function ED(){if(!S0)try{const e=await Wi().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="reportAutoRefresh");E0(t||null),S0=Array.isArray(e?.tasks)}catch(e){console.warn("读取报表自动刷新间隔失败,按默认 1 秒:",e instanceof Error?e.message:e),E0(null)}}function E0(e){S0=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(ux=e.enabled!==!1,cx=e.unit==="minutes"?t*6e4:t*1e3):(ux=!0,cx=ND),Ji?.applyAutoConfig(cx,ux)}const tQ={summary:null,error:null};function nQ(){const[e,t]=x.useState(tQ),[a,o]=x.useState(bX),[c,d]=x.useState(yX),[f,p]=x.useState(()=>({ms:cx,enabled:ux})),[,h]=x.useState(0),b=x.useRef(a),y=x.useRef(c),v=x.useCallback(G=>{t(G)},[]),w=x.useCallback(async(G={})=>{ED();const W=++k0,le=b.current,M=le===v0?y.current:void 0;try{const U=Wi().workbuddyDesktop;if(!U)throw new Error("后端桥不可用");const Z=await U.getStatsSummary(le,M);if(W!==k0)return Po;if(!Z||typeof Z!="object")throw new Error("后端未返回报表数据");return Po=Z,v({summary:Z,error:null}),Po}catch(U){if(W!==k0)return Po;const Z=U instanceof Error?U.message:"";return Po=null,G.silent||console.warn("读取报表数据失败:",Z),v({summary:null,error:Z||r("未知错误")}),null}},[v]),j=x.useCallback(G=>{G!==void 0&&(Po=G||null,G&&v({summary:G,error:null}))},[v]),S=x.useCallback(G=>{const W=sx.includes(G)?G:b0;if(W!==b.current){b.current=W,o(W);try{localStorage.setItem(dD,W)}catch{}w()}},[w]),N=x.useCallback(G=>{const W={...y.current,...G};if(!rx.test(W.start)||!rx.test(W.end))return;const le=W.start<=W.end?W:G.start?{start:W.start,end:W.start}:{start:W.end,end:W.end};y.current=le,d(le),wX(le),b.current===v0&&w()},[w]);x.useEffect(()=>{if(Ji={load:w,render:j,applyAutoConfig:(G,W)=>p({ms:G,enabled:W})},dx){const G=dx;dx=null,j(G.data)}return Wi().wbApp?.currentPage==="overview"&&w({silent:!0}),()=>{Ji=null}},[w,j]),x.useEffect(()=>{if(!f.enabled||f.ms<=0)return;const G=window.setInterval(()=>{document.hidden||Wi().wbApp?.currentPage!=="overview"||N0||(N0=!0,w({silent:!0}).finally(()=>{N0=!1}))},f.ms);return()=>{window.clearInterval(G)}},[f,w]),x.useEffect(()=>{const G=()=>h(W=>W+1);return window.addEventListener("wb-units-changed",G),()=>window.removeEventListener("wb-units-changed",G)},[]);const k=T0(),T=T0(),D=T0(),{summary:C,error:A}=e,R=C&&sx.includes(C.range??"")?C.range:a,I=C&&Array.isArray(C.heatmap)?C.heatmap:[],P=C&&Array.isArray(C.cacheTrend24h)?C.cacheTrend24h:[],O=C&&Array.isArray(C.dailyTrend)?C.dailyTrend:[],_=C&&Array.isArray(C.providers)?C.providers:null,L=C&&Array.isArray(C.accounts)?C.accounts:null,H=C&&Array.isArray(C.models)?C.models:null,B=A?ec(r("读取报表失败:{error}",{error:A}),"empty report-error"):null,z=ec(r("正在加载…")),Q=B??z,K=x.useMemo(()=>wD(H||[]),[H]),X=x.useCallback(G=>K.get(G)||OX,[K]),q=C?_X(I,k[1]):null,$=C?BX(P,T[1],X):null,Y=C?UX(O,D[1],X):null,F=y0(new Date);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("统计概览")}),s.jsx("span",{className:"panel-sub",id:"report-range-label",children:pD[R]||""}),s.jsxs("div",{className:"head-actions",children:[s.jsx(In,{options:VX,value:a,onValueChange:S,"aria-label":r("报表时间范围")}),a===v0?s.jsxs("span",{className:"report-date-range",children:[s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.start,max:c.end||F,"aria-label":r("开始日期"),title:r("起始日期(含当天)"),onChange:G=>N({start:G.target.value})}),s.jsx("span",{className:"report-date-sep","aria-hidden":"true",children:"~"}),s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.end,min:c.start||void 0,max:F,"aria-label":r("结束日期"),title:r("结束日期(含当天)"),onChange:G=>N({end:G.target.value})})]}):null]})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-overview",children:C?s.jsx(QX,{summary:C,range:R}):Q})})]}),s.jsxs("div",{className:"report-rank-grid",children:[L?s.jsx(kD,{panelId:"report-accounts-panel",listId:"report-accounts",labelId:"report-accounts-label",title:r("Top 账号"),tip:FX,rows:vD(L)||[],totalText:yD(L),withBadge:!0,emptyText:r("所选范围内还没有账号用量")}):null,_?s.jsx(kD,{panelId:"report-providers-panel",listId:"report-providers",labelId:"report-providers-label",title:r("Top 提供商"),tip:$X,rows:vD(_)||[],totalText:yD(_),withBadge:!1,emptyText:r("所选范围内还没有请求记录")}):null]}),s.jsxs("div",{className:"report-donut-grid",children:[H?s.jsx(CD,{panelId:"report-models-panel",listId:"report-models-donut",title:r("模型用量"),tip:qX,ariaLabel:r("模型用量占比"),view:jD(H,r("未知模型")),emptyText:r("所选范围内还没有模型用量")}):null,_?s.jsx(CD,{panelId:"report-providers-pie-panel",listId:"report-providers-donut",title:r("提供商用"),tip:GX,ariaLabel:r("提供商用占比"),view:jD(_,r("未知")),emptyText:r("所选范围内还没有提供商用量")}):null]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活跃热力图")}),s.jsx("span",{className:"panel-sub",children:r("近 365 天,按天 Token 用量着色(档位按本窗口峰值自动定)")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"heat-wrap",id:"report-heatmap",ref:k[0],children:C?q?s.jsx(ZX,{view:q}):ec(r("暂无热力图数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsx("span",{className:"heat-scale-label",children:r("Token")}),s.jsx("span",{className:"heat-legend",id:"report-heat-legend",children:C?LX(SD(I)).map(G=>s.jsxs("span",{className:"heat-legend-item",children:[s.jsx("span",{className:`l${G.level}`}),G.text]},G.level)):null}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("方格为本地自然日,无请求显示为空槽")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("缓存命中率")}),s.jsx(fx,{text:KX})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-cache-rates",children:C?zX(C.cacheRates).map(G=>s.jsxs("div",{className:"field rate",children:[s.jsx("div",{className:"label",children:G.label}),s.jsxs("div",{className:"value big",children:[G.value,s.jsx("div",{className:"sub",children:G.sub})]})]},G.key)):Q})})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("近 24 小时缓存命中率趋势")}),s.jsx("span",{className:"panel-sub",children:r("按本地整点,无请求的整点不标注")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap",id:"report-cache-trend",ref:T[0],children:C?$?s.jsx(WX,{view:$}):ec(r("暂无缓存趋势数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch rate"}),r("缓存命中率"),s.jsx("span",{className:"axis-hint",children:r("左轴")})]}),s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch tokens"}),r("总 Token"),s.jsx("span",{className:"axis-hint",children:r("右轴")})]}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("无请求的整点按 0% 计,但不写读数")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("按天 Token 趋势")}),s.jsx(fx,{text:YX}),s.jsx("span",{className:"panel-sub",id:"report-trend-label",children:C?`${C.startDate||"—"} ~ ${C.endDate||"—"}`:"—"})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap tall",id:"report-daily-trend",ref:D[0],children:C?Y?s.jsx(JX,{view:Y}):ec(r("暂无趋势数据")):Q})})]})]})}async function sQ(e={}){return Ji?Ji.load(e):Po}function rQ(e){if(e!==void 0){if(!Ji){dx={data:e??null};return}Ji.render(e)}}function aQ(){return Po}window.wbReport={load:sQ,render:rQ,lastSummary:aQ,applyAutoRefresh:E0};const AD='.page[data-page="overview"]';let RD=!1;function OD(){if(RD)return;const e=document.querySelector(AD);e&&(RD=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(nQ,{})))}document.querySelector(AD)?OD():document.addEventListener("DOMContentLoaded",OD,{once:!0}),ED();const A0={all:{title:r("全部删除"),desc:r("删除日志记录本身。当前有筛选时只删命中的条目,按天聚合报表不受影响;无筛选时清空全部并重置报表。此方式无法恢复。")},raw:{title:r("仅清空报文原文"),desc:r("保留统计行与报表,只抹掉请求 / 响应正文。清理后详情弹窗的「预览对话」将无原文可看,统计数字分毫不动。")}},lQ=["all","raw"],oQ=3e3;function Dl(){return window}let mp=!1;function hp(e,t){Dl().wbApp?.toast?.(e,t)}function iQ(e){const t=Math.max(0,Number(e)||0);if(t<1024)return`${Math.round(t)} B`;const a=t/1024;if(a<1024)return`${a.toFixed(1)} KB`;const o=a/1024;return o<1024?`${o.toFixed(1)} MB`:`${(o/1024).toFixed(2)} GB`}function R0(){const e=Dl().wbRequestsPanel?.clearParams?.();return typeof e=="string"?e:""}function MD(e){return{all:Number(e?.all)||0,raw:Number(e?.raw)||0,dbBytes:Number(e?.dbBytes)||0,vacuumRunning:e?.vacuumRunning===!0}}function O0(e){return e instanceof Error?e.message:String(e)}function DD(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}function cQ({onClose:e}){const[t,a]=x.useState("all"),[o,c]=x.useState({status:"loading"}),[d,f]=x.useState(""),[p,h]=x.useState(!1),[b,y]=x.useState(!1),v=x.useRef(!0),w=x.useRef(null),j=x.useCallback(I=>{mp=I,y(I)},[]),S=x.useCallback(()=>{w.current!==null&&(window.clearInterval(w.current),w.current=null)},[]),N=x.useCallback(I=>{c({status:"ready",all:I.all,raw:I.raw,dbBytes:I.dbBytes}),h(I.vacuumRunning)},[]),k=x.useCallback(async()=>{const I=Dl().workbuddyDesktop;if(!I)return;let P;try{P=await I.getStatsClearPreview(R0())}catch{return}if(!v.current)return;const O=MD(P);N(O),!O.vacuumRunning&&(S(),f(""),hp(r("✅ 压缩完成")),Dl().wbRequestsPanel?.load?.({silent:!0}))},[N,S]),T=x.useCallback(()=>{w.current===null&&(h(!0),w.current=window.setInterval(()=>{k()},oQ))},[k]);async function D(){c({status:"loading"});try{const I=Dl().workbuddyDesktop;if(!I)throw new Error(r("后端桥不可用"));const P=await I.getStatsClearPreview(R0());if(!v.current)return;const O=MD(P);N(O),O.vacuumRunning&&T()}catch(I){if(!v.current)return;c({status:"failed"}),f(r("预览读取失败:{error}",{error:O0(I)}))}}x.useEffect(()=>(v.current=!0,D(),()=>{v.current=!1,S(),mp=!1}),[]);async function C(){const I=Dl().workbuddyDesktop;if(I){h(!0);try{await I.compactStatsDb(),f(r("压缩已在后台开始,完成后会自动提示")),T()}catch(P){const O=O0(P);if(/409|正在进行/.test(O)){hp(r("压缩已在进行中")),f(r("压缩已在进行中,接上它的进度等待完成")),T();return}h(!1),f(r("压缩失败:{message}",{message:O})),hp(r("压缩失败:{message}",{message:O}),"err")}}}async function A(){if(mp)return;const I=Dl().workbuddyDesktop,P=Dl().wbConfirm?.ask;if(!I||!P)return;const O=A0[t].title,_=R0(),L=_.length>0,H=o.status==="ready"?t==="raw"?o.raw:o.all:0;if(await P({title:r("清理请求日志"),html:L?r("确定按当前筛选执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:DD(O),count:H}):r("确定对全部请求日志执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:DD(O),count:H}),okText:r(t==="raw"?"抹掉原文":"删除"),okClass:"danger"})){j(!0);try{const z=L?`mode=${t}&${_}`:`mode=${t}&all=1`,Q=await I.clearStatsRequests(z),K=Number(Q?.deleted)||0;hp(t==="raw"?r("已抹掉 {count} 条报文原文",{count:K}):r("已删除 {count} 条",{count:K})),j(!1),e(),Dl().wbRequestsPanel?.notifyCleared?.()}catch(z){const Q=O0(z);f(r("清理失败:{message}",{message:Q})),hp(r("清理失败:{message}",{message:Q}),"err"),j(!1)}}}const R=o.status==="ready"?r("将删除 {count} 条日志 · 其中 {raw} 条仍带报文原文 · 数据库占用 {db}",{count:o.all,raw:o.raw,db:iQ(o.dbBytes)}):o.status==="failed"?r("预览读取失败"):r("正在统计…");return s.jsx(Qt,{open:!0,onOpenChange:(I,P)=>{if(!I){if(mp){P.cancel();return}e()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("清理请求日志")})}),s.jsxs(Bt,{children:[s.jsx(Eh,{"aria-label":r("清理方式"),value:t,onValueChange:I=>a(I==="raw"?"raw":"all"),children:lQ.map(I=>{const P=t===I;return s.jsxs("label",{"data-checked":P?"":void 0,className:"group/card grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2.5 gap-y-0.5 rounded-md border border-border px-3 py-2.5 transition-colors duration-150 ease-out hover:border-border-strong data-checked:border-primary data-checked:bg-primary-soft",children:[s.jsx(bo,{value:I,className:"row-span-2 self-center"}),s.jsx("span",{className:"text-[13px] font-semibold text-foreground group-data-checked/card:text-primary-fg",children:A0[I].title}),s.jsx("span",{className:"text-[11.5px] leading-[1.55] text-subtle",children:A0[I].desc})]},I)})}),s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:R})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:d}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{C()},disabled:p,title:r(p?"压缩正在后台执行,完成后自动恢复":"回收已删除数据占用的磁盘空间(checkpoint + VACUUM,后台执行)"),children:r(p?"压缩中…":"压缩数据库")}),s.jsx(se,{variant:"outline",onClick:e,disabled:b,children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>{A()},disabled:b,children:r(b?"清理中…":"执行清理")})]})]})})}let gp=null,Fu=null;function ID(){gp&&(gp.unmount(),gp=null),Fu&&(Fu.remove(),Fu=null)}function uQ(){mp||ID()}function dQ(){ID(),Fu=document.createElement("div"),document.body.append(Fu),gp=vn.createRoot(Fu),gp.render(s.jsx(cQ,{onClose:uQ}))}window.wbRequestClearModal={open:dQ};const PD=[{value:"detail",label:r("请求详情")},{value:"preview",label:r("预览对话")},{value:"raw",label:r("原始报文")}],fQ="detail",_D="border-b border-hairline px-2.5 py-[7px] align-top",_o="border border-hairline px-2 py-1 align-top",pQ="border border-hairline bg-surface-2 px-2 py-1 text-[11.5px] tracking-normal",px="hover:[&>td]:bg-transparent";function $u(){return window}function M0(){const e=$u().workbuddyDesktop;if(!e)throw new Error(r("后端桥不可用"));return e}let D0=0;function mQ(e){if(!e)return"—";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`}function LD(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}function hQ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":LD(t)}const gQ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计");function xQ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=500&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function mx(e){return $u().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function bQ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function vQ(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function hx(e){return(Number(e?.status)||0)===0&&!e?.error}function zD(e){const t=String(e.provider??"").trim();return String(e.providerLabel??"").trim()||(t?$u().wbProviders?.labelOf?.(t)||t:"")}function xp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I0(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return""}}function P0(e){return e instanceof Error?e.message:String(e)}const BD=[{label:r("请求头"),pick:e=>I0(e.requestHeaders)},{label:r("请求体"),pick:e=>I0(e.requestBody)},{label:r("响应头"),pick:e=>I0(e.responseHeaders)},{label:r("响应体"),pick:e=>e.responseBody?String(e.responseBody):""}];function gx({text:e,loading:t=!1}){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-center text-[12.5px] text-muted-foreground",children:[t?s.jsx(ef,{className:"size-3.5"}):null,e]})}function ua({label:e,children:t}){return s.jsxs(kl,{className:px,children:[s.jsx("th",{scope:"row",className:`w-[76px] whitespace-nowrap text-left text-[12.5px] font-semibold text-muted-foreground ${_D}`,children:e}),s.jsx(Nn,{className:_D,children:t})]})}function yQ({row:e}){if(hx(e)){const c=$u().wbRequestPhase;if(!c?.badgeHtml)return s.jsxs(ze,{variant:"info",shape:"tag",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot"}),r("进行中")]});const d=c.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:c.badgeHtml(e)}}),d?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",dangerouslySetInnerHTML:{__html:d}}):null]})}const t=Number(e.status)||0,a=vQ(e),o=!a&&t>=200&&t<300?r("HTTP {status},但响应体阶段出错",{status:t}):"";return s.jsx(ze,{variant:a?"success":"destructive",shape:"tag",title:o||void 0,children:t||r("失败")})}function wQ({row:e}){const t=String(e.clientModel??"").trim(),a=String(e.upstreamModel??"").trim(),o=String(e.model??"").trim(),c=String(e.clientReasoning??"").trim(),d=String(e.upstreamReasoning??"").trim(),f=(b,y)=>y?`${b}(${y})`:b;if(!t||!a||a.toLowerCase()===t.toLowerCase())return s.jsx(s.Fragment,{children:f(o,d||c)||"—"});const p=f(a,d),h=f(t,c);return s.jsxs("span",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{title:r("转发到上游的模型:{model}",{model:p}),children:["⬆️ ",p]}),s.jsxs("span",{className:"text-muted-foreground",title:r("下游请求的模型:{model}",{model:h}),children:["⬇️ ",h]})]})}function jQ(e){const t=Number(e?.status),a=e?.status!==null&&e?.status!==void 0&&Number.isFinite(t),o=e?.error?String(e.error):"";if(o){const c=a?r("失败({status}):{error}",{status:String(t),error:o}):r("失败:{error}",{error:o});return s.jsx("span",{className:"break-words text-destructive",children:c})}return a?s.jsx("span",{className:"text-success",children:r("成功({status})",{status:String(t)})}):s.jsx("span",{className:"text-muted-foreground",children:r("无结果记录")})}function SQ({row:e}){const t=Array.isArray(e.attemptDetails)?e.attemptDetails:[];if(!t.length)return s.jsx(s.Fragment,{children:"-"});const a=Number(e.attempts)||1;return s.jsxs(Ky,{className:"text-[11.5px]",children:[s.jsx(yE,{children:s.jsx(kl,{className:px,children:[r("轮次"),r("提供商"),r("账号"),r("结果"),r("体积"),r("内部重试"),r("提示")].map(o=>s.jsx(wE,{className:pQ,children:o},o))})}),s.jsxs(Yy,{children:[t.map((o,c)=>{const d=Array.isArray(o?.retries)?o.retries:[],f=d.map(v=>{const w=Number(v?.delayMs),j=Number.isFinite(w)&&w>0?w>=1e3?r(",{n}秒后重试",{n:Math.round(w/1e3)}):r(",{n}毫秒后重试",{n:Math.round(w)}):"";return`${String(v?.reason||r("未知原因"))}${j}`}).join(` -`),p=String(o?.notice??"").trim(),h=Number(o?.bodyBytes),b=Number.isFinite(h)&&h>0?h>=1024*1024?`${(h/1024/1024).toFixed(1)} MB`:h>=1024?`${Math.round(h/1024)} KB`:`${h} B`:"—",y=Number.isFinite(h)&&h>0?r("实际发给上游 {bytes} 字节",{bytes:h.toLocaleString()}):void 0;return s.jsxs(kl,{className:px,children:[s.jsx(Nn,{className:_o,children:c+1}),s.jsx(Nn,{className:_o,children:zD(o)||(o?.provider?String(o.provider):r("未知"))}),s.jsx(Nn,{className:_o,children:o?.account?String(o.account):"—"}),s.jsx(Nn,{className:_o,children:jQ(o)}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:y,children:b}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:f||void 0,children:d.length?r("↻ {n} 次",{n:d.length}):"-"}),s.jsx(Nn,{className:_o,children:p||"—"})]},c)}),t.lengths.jsxs("li",{className:"py-0.5",children:[s.jsxs("b",{children:[y+1,". ",String(b.name||b.id||"—")]}),s.jsxs("span",{className:"text-muted-foreground",children:[" ",String(b.reason||"")]})]},String(b.id??y)))}):null,p.length?s.jsxs("div",{className:"mt-1 text-muted-foreground",children:[r("被跳过:"),p.map(b=>String(b.name||b.id||"")).join("、")]}):null,h?s.jsx("div",{className:"mt-1",children:r("最终承载:{picked}",{picked:h})}):null]})}function kQ({row:e}){if(!e)return s.jsx(gx,{text:r("列表数据已刷新,请重试(关闭后重新打开这条详情)")});const t=String(e.accountName??"").trim(),a=xQ(e);return s.jsx(Ky,{className:"text-[12.5px] text-subtle [&_tr:last-child>td]:border-b-0 [&_tr:last-child>th]:border-b-0",children:s.jsxs(Yy,{children:[s.jsx(ua,{label:r("时间"),children:mQ(e.ts)}),s.jsx(ua,{label:r("状态"),children:s.jsx(yQ,{row:e})}),s.jsx(ua,{label:r("耗时"),children:hx(e)?s.jsxs(s.Fragment,{children:[bQ(e.ts),s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(请求仍在转发中)")})]}):r("{duration} / 首帧 {first}",{duration:LD(e.durationMs),first:hQ(e.firstResponseMs)})}),s.jsx(ua,{label:r("重试次数"),children:String(Number(e.attempts)||1)}),s.jsx(ua,{label:r("模型"),children:s.jsx(wQ,{row:e})}),s.jsxs(ua,{label:r("提供商"),children:[zD(e)||"—",t?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(账号:{account})",{account:t})}):null]}),s.jsxs(ua,{label:r("令牌"),children:[r("输入 {input} · 输出 {output} · 总计 {total} · 缓存读 {cache}",{input:mx(e.promptTokens),output:mx(e.completionTokens),total:mx(e.totalTokens),cache:mx(e.cacheReadTokens)}),a?s.jsxs("span",{title:gQ,children:[" · ",a]}):null]}),e.isTest?s.jsx(ua,{label:r("来源"),children:s.jsx(ze,{variant:"brand",shape:"tag",title:r("模型管理页操作列那颗「测试」发起的请求:与真实请求同一条转发链路,但不计入报表统计"),children:r("模型测试")})}):null,s.jsx(ua,{label:r("错误"),children:e.error?s.jsx("span",{className:"text-destructive",children:String(e.error)}):"—"}),s.jsx(ua,{label:r("尝试明细"),children:s.jsx(SQ,{row:e})}),e.route?s.jsx(ua,{label:r("路由回放"),children:s.jsx(NQ,{row:e})}):null,s.jsx(ua,{label:r("敏感词"),children:Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length?s.jsx("span",{className:"inline-flex flex-wrap gap-1.5",children:e.sensitiveHits.map((o,c)=>s.jsxs(ze,{variant:"sensitive",shape:"tag",children:[String(o?.word??"")," × ",String(Number(o?.count)||0)]},c))}):"—"})]})})}function CQ({state:e}){if(!e)return s.jsx(gx,{text:r("正在读取…"),loading:!0});const t=e==="gone"?null:e.body,a=t&&$u().wbConversationPreview?.render?.(t.requestBody,t.responseBody)||"";return a?s.jsxs("div",{children:[e!=="gone"&&e.truncated?s.jsx("div",{className:"mb-2 text-[11.5px] text-warning",children:r("正文超过单条上限,可能已被截断")}):null,s.jsx("div",{dangerouslySetInnerHTML:{__html:a}})]}):s.jsx(gx,{text:r("无报文原文(未开启「调试模式」,或已被清理)")})}function TQ({data:e}){const t=e.status===null||e.status===void 0?"-":String(e.status),a=[e.url?`URL: ${e.url}`:"",e.provider?r("提供商: {provider}",{provider:String(e.provider)}):"",r("上游状态码: {status}",{status:t})].filter(Boolean);return s.jsxs("div",{className:"flex flex-col gap-4",children:[a.length?s.jsx("div",{className:"border-b border-hairline pb-2.5 text-xs leading-[1.7] break-all text-subtle",children:a.map((o,c)=>s.jsx("div",{children:o},c))}):null,BD.map(o=>{const c=o.pick(e)||"";return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("h3",{className:"text-[11.5px] font-semibold tracking-[.02em] text-muted-foreground",children:o.label}),c?s.jsx("pre",{className:"max-h-80 overflow-auto rounded-md border border-border bg-surface-2 p-[10px_12px] font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-subtle",children:c}):s.jsx(gx,{text:r("这条请求没有保存这一段报文")})]},o.label)})]})}function EQ({id:e,row:t,token:a,onClose:o}){const[c,d]=x.useState(fQ),[f,p]=x.useState(null),[h,b]=x.useState(null),[y,v]=x.useState("—"),[w,j]=x.useState("idle"),S=x.useRef(!0),N=x.useRef(null),k=x.useRef({detail:0,preview:0,raw:0}),T=x.useCallback(()=>!S.current||a!==D0,[a]);async function D(){try{const O=await M0().getStatsRequestRaw(e);if(T())return;const _=xp(O)?O:null,L=String(_?.requestBody??"").trim()!==""||String(_?.responseBody??"").trim()!=="";p(_&&L?{body:_,truncated:!!_.truncated}:"gone")}catch(O){if(T())return;p("gone"),console.warn("读取原始正文失败(预览对话显示空态):",P0(O))}}async function C(){try{const O=await M0().getDebugTraffic(e);if(T())return;const _=xp(O)?O:{};if(!BD.some(L=>(L.pick(_)||"").trim())){b("gone");return}b({data:_}),v(_.truncated?r("报文超过单条上限,请求体 / 响应体已按上限截断"):r("内容按原样保存,请求头中的凭据字段已替换为 [redacted]"))}catch(O){if(T())return;b("gone"),v(r("在设置 → 通用里开启「调试模式」后,新发生的请求才会保存报文")),console.warn("读取调试报文失败(原始报文标签隐藏):",P0(O))}}x.useEffect(()=>(S.current=!0,D(),C(),()=>{S.current=!1}),[]),x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollTop=k.current[c])},[c]);function A(O){if(O==="raw"&&!xp(h)||O===c)return;const _=N.current;_&&(k.current[c]=_.scrollTop),d(O)}async function R(){if(!e||!hx(t))return;const O=$u().wbConfirm?.ask;if(!(!O||!await O({title:r("终止请求"),html:r("确定终止这条正在转发的请求?
    上游连接会立即断开,明细将记为「请求已被手动终止」。"),okText:r("终止"),okClass:"danger"}))){j("pending");try{if(await M0().terminateStatsRequest(e),!S.current)return;j("accepted"),v(r("已受理终止:上游连接已断开,列表稍后刷新为「请求已被手动终止」"))}catch(L){if(!S.current)return;j("idle"),v(r("终止失败:{error}",{error:P0(L)}))}}}const I=xp(h),P=x.useMemo(()=>I?PD:PD.filter(O=>O.value!=="raw"),[I]);return s.jsx(Qt,{open:!0,onOpenChange:O=>{O||o()},children:s.jsxs(Zt,{className:"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("请求详情")})}),s.jsxs(Bt,{ref:N,className:"gap-3",children:[s.jsx(In,{options:P,value:c,onValueChange:A,"aria-label":r("详情内容"),className:"self-start"}),s.jsx("section",{hidden:c!=="detail",children:s.jsx(kQ,{row:t})}),s.jsx("section",{hidden:c!=="preview",children:s.jsx(CQ,{state:f})}),I?s.jsx("section",{hidden:c!=="raw",children:s.jsx(TQ,{data:h.data})}):null]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:y}),s.jsx("div",{className:"mr-auto"}),hx(t)?s.jsx(se,{variant:"destructive",disabled:w!=="idle",onClick:()=>{R()},title:r("断开上游连接,明细记为「请求已被手动终止」"),children:r("终止请求")}):null,s.jsx(se,{variant:"outline",onClick:o,children:r("关闭")})]})]})})}let bp=null,qu=null;function HD(){bp&&(bp.unmount(),bp=null),qu&&(qu.remove(),qu=null)}function UD(){D0+=1,HD()}function AQ(e,t){const a=String(e??"").trim();if(!a)return;HD();const o=++D0;qu=document.createElement("div"),document.body.append(qu),bp=vn.createRoot(qu),bp.render(s.jsx(EQ,{id:a,row:xp(t)?t:null,token:o,onClose:UD}))}window.wbRequestDetail={open:AQ,close:UD};const RQ=150,OQ=80,tc=8,xx=8,MQ=520,DQ=220,IQ=1.1,PQ=900,_0=12,L0="req-hover-panel",_Q=["fixed z-[35] pointer-events-none","max-h-[min(360px,60vh)] overflow-x-hidden overflow-y-auto","rounded-md p-[10px_12px] text-[12px] leading-[1.6] break-normal","bg-surface-2 text-foreground shadow-3","border-0 dark:border dark:border-border-strong dark:bg-surface-3"].join(" "),vp="rh-row rh-dim min-w-0 break-words text-muted-foreground",LQ="rh-row min-w-0 break-words";function zQ(){return window}function z0(e){return typeof e=="object"&&e!==null?e:null}const VD=e=>Array.isArray(e?.attemptDetails)?e.attemptDetails:[],FD=e=>Array.isArray(e?.retries)?e.retries:[],BQ=e=>Array.isArray(e?.sensitiveHits)?e.sensitiveHits:[];function B0(e){const t=String(e??"").trim();return t?zQ().wbProviders?.labelOf?.(t)||t:""}function HQ(e){const t=z0(e);return(Number(t?.attempts)||1)>1?!0:VD(t).some(a=>FD(a).length>0||!!a?.notice)}function $D(e){return e.dataset.reqHover==="sensitive"?"sensitive":"chain"}function UQ({details:e}){if(e.length<2)return null;const t=e.map(a=>B0(a.provider)||r("未知"));return s.jsxs("div",{className:"rh-chain mb-1.5 border-b border-border pb-1.5 break-words",children:[s.jsx("span",{className:"rh-chain-k font-semibold text-muted-foreground",children:r("切换路径:")}),s.jsx("span",{className:"rh-chain-v font-semibold text-foreground",children:t.join(" → ")})]})}function VQ({item:e}){const t=FD(e);return t.length?s.jsxs("div",{className:"rh-retry mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2",children:[s.jsx("div",{className:"rh-retry-head text-[11.5px] font-semibold text-warning",children:r("↻ 重试 {n} 次",{n:t.length})}),t.map((a,o)=>{const c=String(a?.reason??"").trim(),d=Number(a?.status),f=a?.status!==null&&a?.status!==void 0&&Number.isFinite(d),p=Number(a?.delayMs),h=Number.isFinite(p)&&p>0?p>=1e3?r(",{n}秒后重试",{n:Math.round(p/1e3)}):r(",{n}毫秒后重试",{n:Math.round(p)}):"";return s.jsxs("div",{className:"rh-retry-row min-w-0 break-words",children:[s.jsx("span",{className:"rh-retry-why mr-1 text-subtle [overflow-wrap:anywhere]",children:c||r("未知原因")}),f?s.jsx("span",{className:"rh-retry-status mr-1 text-muted-foreground tabular-nums whitespace-nowrap",children:`HTTP ${String(d)}`}):null,h?s.jsx("span",{className:"rh-dim text-muted-foreground",children:h}):null]},o)})]}):null}function FQ({item:e,index:t,inFlight:a}){const o=B0(e.provider),c=String(e.account??"").trim(),d=Number(e.status),f=e.status!==null&&e.status!==void 0&&Number.isFinite(d),p=e.error?String(e.error):"",h=String(e.notice??"").trim();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:LQ,children:[s.jsx("span",{className:"rh-no mr-1 text-muted-foreground",children:r("尝试 {n} ·",{n:t+1})}),s.jsx("span",{className:"rh-who mr-1 font-semibold text-foreground",children:o||r("未知")}),c?s.jsx("span",{className:"rh-account mr-1 text-muted-foreground [overflow-wrap:anywhere]",children:c}):null,s.jsx("span",{className:"rh-arrow mr-1 text-muted-foreground",children:"→"}),p?s.jsx("span",{className:"rh-bad font-medium text-destructive [overflow-wrap:anywhere]",children:f?r("失败({status}):{error}",{status:String(d),error:p}):r("失败:{error}",{error:p})}):f?s.jsx("span",{className:"rh-ok font-medium text-success",children:r("成功({status})",{status:String(d)})}):a?s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("进行中…")}):s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("无结果记录")})]}),h?s.jsx("div",{className:"rh-notice mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2 text-warning [overflow-wrap:anywhere]",children:`⚠️ ${h}`}):null,s.jsx(VQ,{item:e})]})}function $Q({entry:e}){const t=Number(e.attempts)||1,a=VD(e);if(!a.length){const c=B0(e.provider),d=c?r("共 {n} 次尝试,最终由 {provider} 承载",{n:t,provider:c}):r("共 {n} 次尝试",{n:t});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:vp,children:d}),s.jsx("div",{className:vp,children:r("这条记录的尝试明细未采集(该字段上线前的旧数据,或请求在转发前就失败)")})]})}const o=(Number(e.status)||0)===0&&!e.error;return s.jsxs(s.Fragment,{children:[s.jsx(UQ,{details:a}),a.map((c,d)=>s.jsx(FQ,{item:c,index:d,inFlight:o&&d===a.length-1},d)),a.lengths.jsxs("div",{className:"rh-row rh-hit flex items-baseline justify-between gap-2.5",children:[s.jsx("span",{className:"rh-hit-w break-words text-foreground",children:String(a?.word??"")}),s.jsx("span",{className:"rh-hit-c text-muted-foreground tabular-nums whitespace-nowrap",children:`× ${String(Number(a?.count)||0)}`})]},o)),t.length>_0?s.jsx("div",{className:vp,children:r("另有 {n} 个词命中",{n:t.length-_0})}):null]}):s.jsx("div",{className:vp,children:r("这条记录命中了敏感词,但没有留下命中明细")})}function GQ({kind:e,entry:t,panelRef:a}){return s.jsx("div",{ref:a,id:L0,role:"tooltip","data-kind":e,className:_Q,children:e==="sensitive"?s.jsx(qQ,{entry:t}):s.jsx($Q,{entry:t})})}let Tn=null,Lo=0,yp=0,wp=null,bx=null,H0=null,U0=null,nc=null,sc=null,jp=null,qD="chain";function V0(){window.clearTimeout(Lo),window.clearTimeout(yp),Lo=0,yp=0,wp=null}function KQ(){const e=jp?.current,t=Tn;if(!e||!t)return;const a=t.getBoundingClientRect(),o=window.innerWidth-tc*2;e.style.maxWidth="none",e.style.width="max-content";const c=e.offsetWidth,d=qD==="sensitive",p=Math.max(d?DQ:MQ,c)*(d?IQ:1),h=Math.min(p,o,PQ);e.style.maxWidth=`${h}px`,e.style.width=d?`${h}px`:"auto";const b=e.offsetWidth,y=e.offsetHeight,v=window.innerHeight-a.bottom-xx-tc,w=a.top-xx-tc,j=vv,S=a.left+a.width/2,N=Math.max(tc,Math.min(S-b/2,window.innerWidth-tc-b)),k=j?a.top-xx-y:a.bottom+xx;e.style.left=`${Math.round(N)}px`,e.style.top=`${Math.round(Math.max(tc,Math.min(k,window.innerHeight-tc-y)))}px`}function GD(e){if(!Tn)return;const t=e.target;t instanceof Node&&(t===Tn||Tn.contains(t)||Oa())}function KD(){Oa()}function YD(){Oa()}let vx=!1;function YQ(){vx||(vx=!0,document.addEventListener("click",GD,!0),window.addEventListener("scroll",KD,!0),window.addEventListener("resize",YD))}function XQ(){vx&&(vx=!1,document.removeEventListener("click",GD,!0),window.removeEventListener("scroll",KD,!0),window.removeEventListener("resize",YD))}function QQ(){XQ(),sc&&(sc.unmount(),sc=null),nc&&(nc.remove(),nc=null),jp=null}function XD(e,t){qD=e,(!nc||!sc||!jp)&&(nc=document.createElement("div"),document.body.append(nc),jp=x.createRef(),sc=vn.createRoot(nc));const a=sc,o=jp;Cs.flushSync(()=>{a.render(s.jsx(GQ,{kind:e,entry:t,panelRef:o}))}),YQ(),KQ()}function QD(e){if(!e.isConnected)return;const t=z0(H0?.(e));t&&(V0(),Tn&&Tn!==e&&Oa(),Tn=e,XD($D(e),t),e.classList.add("active"),e.setAttribute("aria-describedby",L0))}function Oa(){V0(),Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=null),QQ()}function ZQ(){if(!Tn)return;const e=String(Tn.dataset.reqHover||""),t=String(Tn.dataset.reqId||"");U0=!!(e&&t)&&Tn.matches(":hover")&&!yp?{action:"move",kind:e,key:t}:{action:"close"}}function WQ(){const e=U0;if(U0=null,!e||!Tn)return;if(e.action==="close"){Oa();return}const t=bx?JQ(bx,e.kind,e.key):null,a=t?z0(H0?.(t)):null;if(!t||!a){Oa();return}t!==Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=t,XD($D(t),a),t.classList.add("active"),t.setAttribute("aria-describedby",L0))}function JQ(e,t,a){for(const o of e.querySelectorAll("[data-req-hover]"))if(String(o.dataset.reqHover||"")===t&&String(o.dataset.reqId||"")===a)return o;return null}function yx(e){const t=e.target;return t instanceof Element?t.closest("[data-req-hover]"):null}function eZ(e){const t=yx(e);if(!t||!bx?.contains(t)||(V0(),Tn===t&&sc))return;const a=Tn?0:RQ;Tn&&Oa(),wp=t,Lo=window.setTimeout(()=>{Lo=0,wp=null,QD(t)},a)}function tZ(e){const t=yx(e);if(t){if(wp===t){window.clearTimeout(Lo),Lo=0,wp=null;return}Tn===t&&(window.clearTimeout(Lo),Lo=0,yp=window.setTimeout(()=>{yp=0,Tn===t&&Oa()},OQ))}}function nZ(e){const t=yx(e);t&&QD(t)}function sZ(e){const t=yx(e);t&&Tn===t&&Oa()}function rZ(e){e.key!=="Escape"||!Tn||Oa()}function aZ(e){const t=e?.host;t&&(bx=t,H0=e?.entryOf??null,t.addEventListener("pointerover",eZ),t.addEventListener("pointerout",tZ),t.addEventListener("focusin",nZ),t.addEventListener("focusout",sZ),t.addEventListener("keydown",rZ))}window.wbRequestHover={bind:aZ,close:Oa,hasProcessFacts:HQ,beforeListRedraw:ZQ,afterListRedraw:WQ};function Ts(){return window}function F0(e){return e instanceof Error?e.message:String(e)}function wx(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const jx={connecting:{label:r("连接中"),cls:"phase-connecting"},waiting:{label:r("等待响应"),cls:"phase-waiting"},streaming:{label:r("响应中"),cls:"phase-streaming"},retrying:{label:r("重试中"),cls:"phase-retrying"},queued:{label:r("排队中"),cls:"phase-queued"}},ZD=r("进行中"),lZ="running",WD={connecting:r("请求已受理,正在选路、取凭证、建立上游连接"),waiting:r("上游请求已发出,正在等第一个字节到达(模型的思考时间也在这段)"),streaming:r("首帧已到,上游内容正在下发"),retrying:r("本轮尝试失败,正在退避等待或切换到下一个账号"),queued:r("上游模型繁忙,请求已排进上游队列;网关正按上游建议的时长等待后重发(不是登录态或额度问题)"),"":r("请求正在转发中,用时列显示的是已用时")};function $0(e){const t=String(e?.phase??"").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(jx,t)?t:""}function JD(e){const t=$0(e);return t?jx[t].label:ZD}function eI(e){if(e==null||e==="")return"";const t=Number(e);if(!Number.isFinite(t)||t<0)return"";const a=Math.max(1,Math.floor(t/1e3));return a<60?r("{n}秒",{n:a}):r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60})}function oZ(e){const t=e?.phaseElapsedMs;if(t!=null&&t!==""){const c=Number(t);if(Number.isFinite(c)&&c>=0)return c}const a=Number(e?.phaseStartedAt);if(!Number.isFinite(a)||a<=0)return null;const o=Date.now()-a;return Number.isFinite(o)?Math.max(0,o):null}function iZ(e){const t=$0(e),a=t?jx[t].label:ZD,o=t?jx[t].cls:lZ,c=WD[t]||WD[""];return`${wx(a)}`}function cZ(e){const t=eI(oZ(e));if(!t)return"";const a=JD(e),o=r("进入「{phase}」阶段已持续 {time}",{phase:a,time:t});return`${wx(t)}`}const q0=[{key:"time",label:r("时间"),sel:".req-time",track:"92px"},{key:"target",label:r("提供商 / 账号"),sel:".req-target",track:"minmax(0, 1.1fr)"},{key:"retry",label:r("重试"),sel:".req-retry",track:"52px"},{key:"status",label:r("状态"),sel:".req-status",track:"96px"},{key:"model",label:r("模型"),sel:".req-model",track:"minmax(0, 1.3fr)"},{key:"client",label:r("客户端"),sel:".req-client",track:"110px"},{key:"dur",label:r("用时"),sel:".req-dur",track:"96px",align:"right"},{key:"usage",label:r("用量"),sel:".req-usage",track:"minmax(0, 1.6fr)"},{key:"error",label:r("错误"),sel:".req-error-cell",track:"minmax(0, 1.2fr)"},{key:"detail",label:r("详情"),sel:".req-detail",track:"60px",align:"right"}],tI=1e3,uZ=rg;function nI(e){return typeof e=="number"&&e>0?e:du}const sI="workbuddy-desktop-logs-requests-range",rI="workbuddy-desktop-requests-filters",dZ=3e4,G0=["today","7","30","month","all"],K0="all",fZ={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部")},pZ={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},mZ=G0.map(e=>({value:e,label:pZ[e]})),aI=[{value:"",label:r("全部状态")},{value:"ok",label:r("成功")},{value:"error",label:r("失败")}],hZ=r("全部状态"),lI=r("全部提供商"),oI=r("全部模型"),Sx={status:"",provider:"",model:""};function Nx(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function gZ(e){const t=new Date;switch(e){case"today":return Nx(t);case"7":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Nx(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}const en={filters:{...Sx},range:xZ(),runningOnly:!1,offset:0,size:nI(lg("requests",rg))};let kx={...Sx},Y0=!1,iI=!1,X0=[],Cx=tI,Tx=!0,Q0=!1,Z0=!1,cI=0,W0=0,J0=null,uI=!1,Gu=null;function xZ(){try{const e=localStorage.getItem(sI);return e!==null&&G0.includes(e)?e:K0}catch{return K0}}function bZ(e){try{localStorage.setItem(sI,e)}catch{}}function dI(){const e=Ts().wbFilterMemory;return e?(Y0=!0,kx=e.load(rI,{...Sx}),en.filters={...kx},{...kx}):{...Sx}}function vZ(e){kx={...e},Ts().wbFilterMemory?.save(rI,{status:e.status||"",provider:e.provider||"",model:e.model||""})}function fI(){const e=new URLSearchParams,t=gZ(en.range);t!==null&&e.set("start",String(t));const a=en.runningOnly?"running":en.filters.status;return a&&e.set("status",a),en.filters.provider&&e.set("provider",en.filters.provider),en.filters.model&&e.set("model",en.filters.model),e}function yZ(){const e=fI();return e.set("offset",String(en.offset)),e.set("limit",String(en.size)),e.toString()}function eS(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}const wZ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计"),jZ=500;function SZ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=jZ&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function NZ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":eS(t)}function Ex(e){return Ts().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function kZ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function CZ(e){const t=Number(e.promptTokens)||0;return t<=0?"-":`${((Number(e.cacheReadTokens)||0)/t*100).toFixed(2)}%`}function tS(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function Sp(e){return(Number(e?.status)||0)===0&&!e?.error}const pI=e=>String(e?.id||e?.ts||"");function TZ(e){return(Array.isArray(e?.attemptDetails)?e.attemptDetails:[]).reduce((a,o)=>{const c=o?.retries;return a+(Array.isArray(c)?c.length:0)},0)}function mI(e){return Ts().wbProviders?.labelOf?.(e)||e}function EZ(e){const t=new Set;return e.map((a,o)=>{const c=pI(a)||`i${o}`;let d=c,f=1;for(;t.has(d);)d=`${c}#${f++}`;return t.add(d),d})}async function hI(){if(!(Date.now()-W0({value:String(o?.id||""),label:String(o?.label||o?.id||"")})).filter(o=>o.value),a=(Array.isArray(e?.models)?e.models:[]).map(o=>String(o||"")).filter(Boolean);Gu?.setFilterOptions(t,a)}catch(e){console.warn("读取请求日志筛选清单失败,筛选项退化为「全部」:",F0(e))}}}async function AZ(){if(!Q0)try{const e=await Ts().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="requestsAutoRefresh");nS(t||null),Q0=Array.isArray(e?.tasks)}catch(e){console.warn("读取请求日志自动刷新间隔失败,按默认 1 秒:",F0(e)),nS(null)}}function nS(e){Q0=!0;const t=Number(e?.interval),a=e?.unit;!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(a==="seconds"||a==="minutes")?(Tx=e.enabled!==!1,Cx=a==="minutes"?t*6e4:t*1e3):(Tx=!0,Cx=tI),Gu?.setAuto({ms:Cx,enabled:Tx})}function RZ(){if(uI)return;const e=Ts().wbColSettings;e&&(uI=!0,J0=e.register({id:"requests",label:r("请求日志表"),columns:q0.map(({key:t,label:a,align:o})=>({key:t,label:a,align:o})),mount:()=>document.querySelector('.page[data-page="requests"] .panel-head .head-actions'),onChange:()=>{Cs.flushSync(()=>Gu?.repaint()),Ts().wbTableColumns?.repaint?.("requests")}}))}function sS(){return(J0?J0.apply(q0):q0).map(t=>({...t,align:t.align||"left"}))}const OZ={entries:[],total:0,matched:0,running:0,loaded:!1,error:""};function MZ(e){return e.loaded?e.total?r("没有符合筛选条件的请求"):r("暂无请求日志,网关还没有转发过请求"):r("正在加载请求日志…")}function DZ(e){const t=Number(e.firstResponseMs);return!Number.isFinite(t)||t<=0?null:s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时(请求仍在转发中)"),children:r("首响 {time}",{time:eS(t)})})}function IZ(e,t){const{align:a,key:o}=t,c=t.sel.slice(1)+(o==="dur"?" req-num":""),d=`${c} ta-${a}`;switch(o){case"time":{if(!e.ts)return s.jsx("span",{className:d,children:"—"},o);const f=new Date(e.ts),p=h=>String(h).padStart(2,"0");return s.jsxs("span",{className:d,children:[s.jsx("span",{children:`${f.getFullYear()}-${p(f.getMonth()+1)}-${p(f.getDate())}`}),s.jsx("span",{children:`${p(f.getHours())}:${p(f.getMinutes())}:${p(f.getSeconds())}`})]},o)}case"target":{const f=String(e.provider??"").trim(),h=String(e.providerLabel??"").trim()||(f?mI(f):"");return s.jsxs("span",{className:d,children:[h?s.jsx("span",{className:"req-provider",title:f&&f!==h?r("{name}({id})",{name:h,id:f}):h,children:h}):s.jsx("span",{className:"req-provider is-empty",title:r("这条明细没有记录提供商(旧数据或请求未走到转发)"),children:"—"}),e.accountName?s.jsx("span",{className:"req-acct",title:e.accountId||e.accountName,children:e.accountName}):s.jsx("span",{className:"req-acct is-empty",title:r("请求在任何账号接手之前就失败了"),children:"—"})]},o)}case"retry":{const f=Number(e.attempts)||1,p=pI(e),h=[];if(e.isTest&&h.push(s.jsx(ze,{variant:"brand",shape:"tag",title:r("这条明细是一次模型测试(人工发起):走的是真实转发链路,但不计入报表统计"),children:r("测试")},"test")),Ts().wbRequestHover?.hasProcessFacts?.(e)??f>1){const y=f>1?f:TZ(e);h.push(s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"chain","data-req-id":p,children:y>1?r("重试 {n}",{n:y}):r("重试")},"chain"))}return Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length&&h.push(s.jsx(ze,{variant:"sensitive",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"sensitive","data-req-id":p,"aria-label":r("命中了敏感词"),children:r("敏")},"sensitive")),h.length?s.jsx("span",{className:d,children:h},o):s.jsx("span",{className:`req-none ta-${a}`,children:"-"},o)}case"status":{if(Sp(e)){const b=window.wbRequestPhase;if(!b?.badgeHtml)return s.jsx("span",{className:d,children:s.jsx("span",{className:"req-status-badge",children:s.jsxs(ze,{shape:"tag",variant:"info",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot","aria-hidden":"true"}),r("进行中")]})})},o);const y=b.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-status-badge",dangerouslySetInnerHTML:{__html:b.badgeHtml(e)}}),y?s.jsx("span",{className:"req-status-line",dangerouslySetInnerHTML:{__html:y}}):null]},o)}const f=Number(e.status)||0,p=tS(e),h=!p&&f>=200&&f<300?r("HTTP {status},但响应体阶段出错:见错误列",{status:f}):void 0;return s.jsx("span",{className:d,children:s.jsx(ze,{shape:"tag",variant:p?"success":"destructive",title:h,children:f||r("失败")})},o)}case"model":{const f=String(e.clientModel??"").trim(),p=String(e.upstreamModel??"").trim(),h=String(e.model??"").trim(),b=String(e.clientReasoning??"").trim(),y=String(e.upstreamReasoning??"").trim(),v=(S,N)=>N?`${S}(${N})`:S;if(!f||!p||p.toLowerCase()===f.toLowerCase()){const S=v(h,y||b);return s.jsx("span",{className:d,title:S,children:S||"—"},o)}const w=v(p,y),j=v(f,b);return s.jsxs("span",{className:`${d} req-model-split`,children:[s.jsxs("span",{className:"req-model-line",title:r("转发到上游的模型:{model}",{model:w}),children:["⬆️ ",w]}),s.jsxs("span",{className:"req-model-line sub",title:r("下游请求的模型:{model}",{model:j}),children:["⬇️ ",j]})]},o)}case"client":{const f=String(e.client??"").trim();if(!f)return s.jsx("span",{className:`${d} is-empty`,title:r("这条明细没有记录来源客户端(旧数据、模型测试,或请求未带 User-Agent)"),children:"—"},o);const p=f==="other"?r("其它"):f;return s.jsx("span",{className:d,title:f==="other"?r("识别到 User-Agent,但不属于已知的客户端类型:{ua}",{ua:f}):r("来源客户端:{client}",{client:p}),children:p},o)}case"dur":return Sp(e)?s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",title:r("已用时(请求仍在转发中)"),children:kZ(e.ts)}),DZ(e)]},o):s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",children:eS(e.durationMs)}),s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时"),children:r("首响 {time}",{time:NZ(e.firstResponseMs)})})]},o);case"usage":{if(Sp(e))return s.jsx("span",{className:d},o);if(!tS(e))return s.jsxs("span",{className:d,title:r("失败请求不记录用量"),children:[s.jsx("span",{className:"req-usage-line",children:"in: - / out: - / all: -"}),s.jsx("span",{className:"req-usage-line sub",children:r("缓存读取: - / 命中率: -")})]},o);const f=`in: ${Ex(e.promptTokens)} / out: ${Ex(e.completionTokens)} / all: ${Ex(e.totalTokens)}`,p=r("缓存读取: {cache} / 命中率: {rate}",{cache:Ex(e.cacheReadTokens),rate:CZ(e)}),h=SZ(e),b=h?`${p} · ${h}`:p;return s.jsxs("span",{className:d,title:[f,b].filter(Boolean).join(` -`),children:[s.jsx("span",{className:"req-usage-line",children:f}),s.jsxs("span",{className:"req-usage-line sub",children:[p,h?s.jsxs("span",{title:wZ,children:[" · ",h]}):null]})]},o)}case"error":return Sp(e)?s.jsx("span",{className:d},o):e.error?s.jsx("span",{className:d,title:String(e.error),children:String(e.error)},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o);case"detail":{const f=e.id?String(e.id):"";return f?s.jsx("span",{className:d,children:s.jsx(se,{size:"sm",variant:"outline",className:"req-detail-btn",title:r("查看该请求的上游原始报文"),onClick:()=>{Ts().wbRequestDetail?.open?.(f,e)},children:r("详情")})},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o)}default:return null}}function PZ(e){return s.jsx("div",{className:"req-head",children:e.map(t=>s.jsx("span",{"data-col":t.key,className:`${t.sel.slice(1)}${t.key==="dur"?" req-num":""} ta-${t.align}`,children:t.label},t.key))},"__head")}function _Z(){const[e,t]=x.useState(OZ),[a,o]=x.useState(()=>dI()),[c,d]=x.useState(()=>en.range),[f,p]=x.useState(!1),[h,b]=x.useState(0),[y,v]=x.useState(()=>en.size),[w,j]=x.useState(()=>({ms:Cx,enabled:Tx})),[S,N]=x.useState([]),[k,T]=x.useState([]),[,D]=x.useState(0),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useCallback(ee=>(en.filters={...en.filters,...ee},o({...en.filters}),en.filters),[]),P=x.useCallback(ee=>{en.range=ee,d(ee)},[]),O=x.useCallback(ee=>{en.offset=ee,b(ee)},[]),_=x.useCallback(ee=>{en.runningOnly=ee,p(ee)},[]),L=x.useCallback(()=>{Y0||!Ts().wbFilterMemory||(Y0=!0,!iI&&I(dI()))},[I]),H=x.useCallback((ee,fe)=>{Ts().wbRequestHover?.beforeListRedraw?.(),fe&&(X0=fe),R.current=!0,t(ee)},[]),B=x.useCallback(ee=>{Ts().wbRequestHover?.beforeListRedraw?.(),R.current=!0,t(fe=>({...fe,error:ee}))},[]),z=x.useCallback(async(ee={})=>{const{silent:fe=!1,resetPage:te=!1}=ee;te&&O(0),AZ(),L(),fe||hI();const Ce=++cI;try{const re=Ts().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.getStatsRequests(yZ());if(Ce!==cI)return;const ke={entries:Array.isArray(de?.entries)?de.entries:[],total:Number(de?.total)||0,matched:Number(de?.matched)||0,running:Number(de?.running)||0,loaded:!0,error:""},Ee=Math.max(0,(Math.ceil(ke.matched/en.size)-1)*en.size);if(en.offset>Ee)return O(Ee),z({silent:fe});te&&(A.current=0),H(ke,ke.entries)}catch(re){fe||(console.warn("读取请求日志失败:",F0(re)),B(r("读取请求日志失败,详见控制台")))}},[O,H,B,L]);x.useEffect(()=>(Gu={load:z,setAuto:ee=>j(ee),setFilterOptions:(ee,fe)=>{N(ee),T(fe)},repaint:()=>D(ee=>ee+1)},Ts().wbRequestHover?.bind?.({host:C.current,entryOf:ee=>{const fe=ee?.dataset?.reqId||"";return fe&&(X0.find(te=>String(te?.id||"")===fe)||X0.find(te=>String(te?.ts||"")===fe))||null}}),z({silent:!0}),hI(),()=>{Gu=null}),[z]),x.useLayoutEffect(()=>{RZ(),D(ee=>ee+1)},[]);const Q=e.error||!e.entries.length?"":sS().map(ee=>ee.key).join("|");x.useLayoutEffect(()=>{Q&&Ts().wbTableColumns?.repaint?.("requests")},[Q]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const ee=window.setInterval(()=>{document.hidden||Ts().wbApp?.currentPage!=="requests"||Z0||(Z0=!0,z({silent:!0}).finally(()=>{Z0=!1}))},w.ms);return()=>{window.clearInterval(ee)}},[w,z]),x.useLayoutEffect(()=>{R.current&&(R.current=!1,Ts().wbRequestHover?.afterListRedraw?.());const ee=A.current;if(ee===null)return;A.current=null;const fe=C.current;fe&&(fe.scrollTop=ee)});function K(ee){const fe=Math.max(1,Math.ceil(e.matched/en.size)),Ce=(Math.min(Math.max(1,ee),fe)-1)*en.size;Ce!==en.offset&&(O(Ce),A.current=0,z())}function X(ee){const fe=nI(ee);if(fe===en.size)return;en.size=fe,v(fe),og("requests",fe);const te=en.offset+1;O(Math.max(0,Math.floor((te-1)/fe)*fe)),A.current=0,z()}function q(ee){iI=!0,vZ(I(ee)),z({resetPage:!0})}function $(ee){const fe=G0.includes(ee)?ee:K0;fe!==en.range&&(P(fe),bZ(fe),z({resetPage:!0}))}function Y(ee){ee!==en.runningOnly&&(_(ee),z({resetPage:!0}))}const F=sS(),G=Math.max(1,Math.ceil(e.matched/en.size)),W=Math.min(G,Math.floor(h/en.size)+1),le=e.matched?h+1:0,M=e.matched?h+e.entries.length:0,U=e.error?"—":e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total}),Z=!f&&e.running>0?r(" · {n} 进行中",{n:e.running}):"",ae=[fZ[c]||r("全部")];f?ae.push(r("只看进行中")):a.status==="ok"?ae.push(r("只看成功")):a.status==="error"&&ae.push(r("只看失败")),a.provider&&ae.push(mI(a.provider)),a.model&&ae.push(a.model);const ce=x.useMemo(()=>!a.provider||S.some(ee=>ee.value===a.provider)?S:[{value:a.provider,label:a.provider},...S],[a.provider,S]),J=x.useMemo(()=>!a.model||k.includes(a.model)?k:[a.model,...k],[a.model,k]),ie=EZ(e.entries),ge=e.entries.map((ee,fe)=>s.jsx("div",{className:`req-row${Sp(ee)?" running":tS(ee)?"":" failed"}`,children:F.map(te=>IZ(ee,te))},ie[fe]));return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("请求日志列表")}),s.jsx(ze,{id:"req-badge",variant:"outline","data-tone":"",children:U+Z}),s.jsx("span",{className:"panel-sub",children:r("按时间倒序,全量保留")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{id:"btn-req-clear",variant:"destructive",onClick:()=>{Ts().wbRequestClearModal?.open?.()},children:r("清理")})})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:mZ,value:c,onValueChange:$,"aria-label":r("请求日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.status,disabled:f,onValueChange:ee=>q({status:String(ee??"")}),children:[s.jsx(mt,{id:"req-status",className:"min-w-[120px]",title:r(f?"「仅看进行中」开启时,状态固定为进行中":"按请求结果筛选"),"aria-label":r("按请求结果筛选"),children:s.jsx(pt,{children:aI.find(ee=>ee.value===a.status)?.label??hZ})}),s.jsx(ht,{children:aI.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))})]}),s.jsxs(ft,{value:a.provider,onValueChange:ee=>q({provider:String(ee??"")}),children:[s.jsx(mt,{id:"req-provider",className:"min-w-[120px]",title:r("按提供商筛选(只列日志里出现过的)"),"aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:a.provider?ce.find(ee=>ee.value===a.provider)?.label||a.provider:lI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:lI}),ce.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))]})]}),s.jsxs(ft,{value:a.model,onValueChange:ee=>q({model:String(ee??"")}),children:[s.jsx(mt,{id:"req-model",className:"min-w-[120px]",title:r("按模型筛选(只列日志里出现过的;精确匹配模型名)"),"aria-label":r("按模型筛选"),children:s.jsx(pt,{children:a.model||oI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:oI}),J.map(ee=>s.jsx(qe,{value:ee,children:ee},ee))]})]}),s.jsx(T6,{id:"btn-req-running",variant:"outline",size:"default",pressed:f,onPressedChange:Y,title:r("只显示正在转发中的请求(状态列按阶段显示:连接中 / 等待响应 / 响应中 / 重试中,用时列显示已用时)"),children:r("仅看进行中")}),s.jsx("div",{className:"spacer"}),s.jsx("span",{className:"panel-sub",id:"req-summary",children:ae.join(" · ")})]}),s.jsx("div",{className:"log-list",id:"req-list",ref:C,children:e.error?s.jsx("div",{className:"log-empty",children:e.error}):e.entries.length?[PZ(F),...ge]:s.jsx("div",{className:"log-empty",children:MZ(e)})})]}),s.jsx(Li,{total:e.matched,range:{start:le,end:M},page:W,pageCount:G,size:y,sizes:uZ,onSizeChange:X,onPageChange:K,disabled:!e.loaded&&!e.error})]})}async function gI(e={}){await Gu?.load(e)}function LZ(){return fI().toString()}function zZ(){return W0=0,gI({resetPage:!0})}const xI='.page[data-page="requests"]';let bI=!1;function vI(){if(bI)return;const e=document.querySelector(xI);e&&(bI=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(_Z,{})))}document.querySelector(xI)?vI():document.addEventListener("DOMContentLoaded",vI,{once:!0}),window.wbRequestsPanel={load:gI,applyAutoRefresh:nS,visibleColumns:sS,clearParams:LZ,notifyCleared:zZ},window.wbRequestPhase={labelOf:JD,badgeHtml:iZ,elapsedLineHtml:cZ,elapsedText:eI,phaseOf:$0};function BZ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.modelsDevUnavailable;const t=e.source==="builtin"?Ut.modelsDevSourceBuiltin:e.source==="cache"?Ut.modelsDevSourceCache:e.source==="network"?Ut.modelsDevSourceNetwork:e.source,a=e.updatedAt>0?String(tt().wbApp?.formatTime?.(e.updatedAt)??""):"";if(!t&&!a&&!e.count)return Ut.modelsDevEmpty;const o=a?r(",{time}",{time:a}):"",c=e.enabled?r("正在联网更新"):r("仅用现有数据、不联网刷新");return r("{count} 条 · 来自{origin}{at} · {mode}",{count:Number(e.count).toLocaleString("zh-CN"),origin:t||r("未知来源"),at:o,mode:c})}function tt(){return window}function _t(e){return e instanceof Error?e.message:String(e)}function Ve(e,t){tt().wbApp?.toast?.(e,t)}async function HZ(e){try{await tt().workbuddyDesktop?.openReleasePage?.(e)}catch(t){Ve(r("打开链接失败:{error}",{error:_t(t)}),"err")}}const Ax=[{id:"general",label:r("通用"),icon:"sliders"},{id:"display",label:r("显示"),icon:"display"},{id:"gateway",label:r("网关"),icon:"traffic"},{id:"routing",label:r("路由"),icon:"route"},{id:"retry",label:r("重试"),icon:"refresh"},{id:"timeout",label:r("超时"),icon:"timer"},{id:"security",label:r("安全"),icon:"shield"},{id:"data",label:r("数据"),icon:"database"},{id:"feedback",label:r("反馈与需求"),icon:"feedback"},{id:"about",label:r("更新"),icon:"download"}],yI="workbuddy-desktop-settings-cat",UZ="workbuddy-desktop-theme",VZ="workbuddy-desktop-zoom",wI="wb:theme",jI="wb:zoom",rS=80,SI=130,Rx=5,FZ=Array.from({length:(SI-rS)/Rx+1},(e,t)=>rS+t*Rx),$Z=[{value:"system",label:r("跟随系统")},{value:"light",label:r("浅色")},{value:"dark",label:r("深色")}];function qZ(){try{const e=localStorage.getItem(UZ);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function GZ(){try{const e=localStorage.getItem(VZ);if(e===null||e.trim()==="")return 100;const t=Number(e);if(!Number.isFinite(t))return 100;const a=Math.round(t/Rx)*Rx;return Math.min(SI,Math.max(rS,a))}catch{return 100}}const aS=1,lS=99999,oS=[{key:"logRetentionDays",id:"settings-retention-log",label:r("事件日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("登录 / 账号切换 / 429 切换等系统事件,可填 1–99999 天。")},{key:"requestLogRetentionDays",id:"settings-retention-request",label:r("请求日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("「请求日志」页的逐条请求记录,默认 99999 天(近似全量保留),可填 1–99999 天。")},{key:"dailyAggregateRetentionDays",id:"settings-retention-daily",label:r("按天聚合保留天数"),unit:r("天"),min:aS,max:lS,hint:r("报表页的热力图与按天趋势,默认 99999 天(近似全量保留),可填 1–99999 天。")}],NI=[{key:"retryCount",id:"settings-retry-count",label:r("同一账号重试次数"),unit:r("次"),min:0,max:10,hint:r("在同一个账号上原地重发几次(不含首发;整条请求共用一份,用完后换来的账号只发一次就继续换)。可填 0–10,0 表示失败立即换号。")},{key:"retryCrossProviderCount",id:"settings-retry-cross-provider-count",label:r("切换账号重试次数"),unit:r("次"),min:0,max:10,hint:r("失败后最多再换几个账号试(填 N = 最多换 N 个,首发那个不算)。换到同一家名下另一个账号、或换到另一家,都各算一次;换满仍失败就返回错误。可填 0–10,0 表示失败立即报错。")},{key:"retryIntervalSeconds",id:"settings-retry-interval",label:r("重试间隔"),unit:r("秒"),min:0,max:300,hint:r("两次重试之间的等待时间,两项共用,可填 0–300 秒。")}],kI=[{key:"connectTimeoutSeconds",id:"settings-timeout-connect",label:r("连接中超时"),unit:r("秒"),min:1,max:3600,hint:r("建立上游 TCP/TLS 连接或代理隧道的最大等待时间(秒),默认 30 秒,范围 1~3600。")},{key:"headersTimeoutSeconds",id:"settings-timeout-headers",label:r("等待响应超时"),unit:r("秒"),min:1,max:3600,hint:r("请求发出后等待上游响应头的最大时间(秒),默认 300 秒,范围 1~3600。")},{key:"streamIdleTimeoutSeconds",id:"settings-timeout-stream-idle",label:r("流式响应空闲超时"),unit:r("秒"),min:1,max:3600,hint:r("流式响应相邻数据之间允许的最大空闲时间(秒),收到新数据后重新计时,默认 300 秒,范围 1~3600。")},{key:"bodyTimeoutSeconds",id:"settings-timeout-body",label:r("非流式响应超时"),unit:r("秒"),min:1,max:3600,hint:r("读取完整非流式响应体允许的最大时间(秒),默认 300 秒,范围 1~3600。")}],CI=[{key:"queueMaxWaits",id:"settings-queue-max-waits",label:r("排队等待次数"),unit:r("次"),min:0,max:10,hint:r("上游模型繁忙时会先排队(回一句「建议 N 秒后再来」,Qoder 免费模型就是这样):网关等一会儿再发同一请求,最多等几次。默认 2 次,可填 0–10;填 0 表示不等待,排队直接返回 503 并说明「不是登录态或额度问题」。")},{key:"queueWaitSeconds",id:"settings-queue-wait-seconds",label:r("排队等待秒数"),unit:r("秒"),min:0,max:120,hint:r("每次等待的时长,默认 0 = 跟随上游建议(实测 9~30 秒,上游没给建议时用 15 秒)。可填 0–120 秒强制一个固定时长。")}],TI="noRetryStatusCodes",iS=100,cS=599,EI=50,zo=[{value:"passthrough",optionLabel:r("透传客户端 system(默认)"),toastLabel:r("透传客户端 system")},{value:"custom",optionLabel:r("替换为网关提示词"),toastLabel:r("替换为网关提示词")},{value:"append",optionLabel:r("追加网关提示词"),toastLabel:r("追加网关提示词")}];function AI(e,t,a,o){const c=String(e??"").trim();if(!c)return{ok:!1,message:r("{noun}不能为空(可填 {min}–{max})",{noun:o,min:t,max:a})};if(!/^\d+$/.test(c))return{ok:!1,message:r("{noun}必须是整数",{noun:o})};const d=Number(c);return da?{ok:!1,message:r("{noun}必须在 {min}–{max} 之间(当前填的是 {text})",{noun:o,min:t,max:a,text:c})}:{ok:!0,value:d}}function KZ(e,t){const a={...t};if(e&&typeof e=="object"){const o=e;typeof o.closeToTray=="boolean"&&(a.closeToTray=o.closeToTray),typeof o.autostart=="boolean"&&(a.autostart=o.autostart),typeof o.lanAccess=="boolean"&&(a.lanAccess=o.lanAccess),typeof o.lanPanel=="boolean"&&(a.lanPanel=o.lanPanel),typeof o.lightweightMode=="boolean"&&(a.lightweightMode=o.lightweightMode)}return a}function RI(e,t,a){if(!t||typeof t!="object")return null;const o=t,c={...a||{}};for(const d of e){const f=Number(o[d.key]);Number.isInteger(f)&&f>=d.min&&f<=d.max&&(c[d.key]=f)}return e.some(d=>Number.isInteger(c[d.key]))?c:null}function OI(e){if(!Number.isFinite(e)||e<=0)return"0 B";if(e<1024)return`${e} B`;const t=e/1024;if(t<1024)return`${t.toFixed(1)} KB`;const a=t/1024;return a<1024?`${a.toFixed(1)} MB`:`${(a/1024).toFixed(2)} GB`}function YZ(e){const t=Number(e);return!Number.isFinite(t)||t<0?"—":t.toLocaleString("zh-CN")}const rs={displayTheme:r("控制界面的深浅色,与左侧边栏底部的三个主题按钮是同一个设置(改哪一处,另一处立刻跟上)。「跟随系统」会随操作系统当前的浅色 / 深色自动切换,并在系统主题变化时即时跟上;选「浅色」或「深色」则把界面固定在该模式,不再随系统变化。窗口标题栏的深浅色会一并同步,不会出现深色界面配一条浅色标题栏的情况。"),displayZoom:r("等比放大或缩小整个界面(文字、控件、间距一起变),效果与浏览器按 Ctrl +/- 相同:80%–130%、5% 一档。窗口本身不缩放,变的是页面内容的显示比例,设置立即生效并记住,下次启动直接按这个比例打开。放得越大可视范围越小,窗口较窄或表格较宽时不建议调得太大。"),displayLanguage:r("界面语言。可选简体中文、繁體中文、English、日本語、한국어、Português (Brasil),或「跟随系统」(按浏览器 / 系统的语言列表自动选)。切换后整页立即刷新;该偏好只存在本机(localStorage),不影响账号、密钥与转发。"),tray:r("默认关闭窗口不会退出程序,而是把窗口缩到系统托盘,转发继续在后台运行(OpenAI 客户端不受影响);要彻底退出程序,请在托盘图标上右键选「退出」。关掉这个开关后,点关闭按钮即退出程序、转发随之中断。「开机自动启动」开启后,登录系统时会自动启动本程序(通常直接驻留托盘),不需要手动打开。"),lightweight:r("开启后,关闭窗口不只是隐藏,而是把界面窗口整个销毁:底层的 WebView2 六个常驻进程(约 200MB 内存)随之退出,网关转发、定时签到、余额查询都在后台进程里继续,不受影响;需要界面时点托盘图标重新打开(WebView 冷启动约 1 秒)。注意:界面销毁期间「ZCode 活动套餐」通道的验证码令牌由界面铸造,无法补充 —— 走该通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。此开关只在「关闭窗口时最小化到托盘」开启时有意义,最小化窗口不受影响。"),lan:r("默认网关只监听 127.0.0.1,只有本机能访问。开启后网关改听所有网卡,同一局域网内的设备可以把 API 地址指向本机 IP 一起使用。出于安全考虑,开启前必须先注册一个面板管理员:管理接口从此要求管理员会话或网关 Key,模型额度不会对局域网裸奔;一把启用的网关 Key 都没有时,转发接口也会拒绝服务,直到创建第一把。改动需要重启应用生效。「同时开放网页管理面板」把管理界面也出给局域网(其他设备的浏览器打开本机 IP 即可管理),默认关闭 —— 桌面端的面板仍只由本程序自己出。"),units:r("控制报表与请求日志里 Token 读数的写法:开启后按中文量级显示(1.2亿 / 8400万),关闭则用 k / M 缩写(与上游文档、接口字段的写法一致)。这只影响显示口径,不改变任何统计与存储的数值。"),queue:r("只对「排队制」的上游生效(目前是 Qoder 的免费模型):模型繁忙时上游不报错,只回一句「建议 N 秒后再来」(业务码 10605),网关按建议时长等一会儿再发同一请求,等满次数仍排不上才把「排队中」作为错误返回(HTTP 503,文案会说明这不是登录态或额度问题)。等待发生在首个字节之前,吃的是「等待响应超时」那份预算 —— 两项设置一起决定一次请求最多卡多久;排队不会标记账号限额、也不会换账号(换谁都一样在排队)。保存后对下一个请求立即生效,不用重启。"),captchaPool:r("ZCode「活动套餐」通道的每条推理请求都要附一个当次铸造的阿里云无痕验证令牌(一次性、约 2 分钟过期):令牌由界面里的铸造守卫静默铸好、推给网关入池,转发时逐条取用。这里的三个值管的是补货节奏:①「库存目标」= 库存低于它守卫才补铸、补到它为止,默认 3 个;②「轮询间隔」= 守卫多久看一次库存,默认 2500 毫秒,只影响反应速度(库存够用时不会多铸);③「单轮铸造上限」= 发现缺货时一轮最多铸几个,默认 1 个(连铸之间固定隔 500 毫秒)。请求密集、请求日志里连续出现「需要人机验证令牌」的 503 时,把目标与单轮上限适当调大、轮询调快,能让池子跟得上消耗 —— 代价是上游(阿里云)对铸造频率有风控,铸得越多越快越容易触发限流,且用不掉的令牌 2 分钟即过期作废、等于白烧配额,所以建议小步调。保存后对下一轮补货立即生效,不用重启。"),timeouts:r("上游请求四个阶段各自的等待上限(秒,1~3600):①「连接中超时」= 建立 TCP/TLS 连接或代理隧道的最大等待,默认 30 秒;②「等待响应超时」= 请求发出后等上游响应头的最大时间,默认 300 秒 —— 网关请求上游恒带 stream,响应头在 SSE 建立时就到达,与模型思考多久无关;③「流式响应空闲超时」= 流式响应相邻两块数据之间允许的最大空闲,收到新数据即重新计时,默认 300 秒 —— 上游长时间不吐数据即判定连接僵死并断开;④「非流式响应超时」= 读完整份非流式响应体的总预算(一次性计时、不重置),默认 300 秒。四项都是「等待上限」,只要数据还在来,正常的流式回答就一直往下传。保存后对下一个请求立即生效,不用重启。"),retry:r("请求转发到上游失败时(服务器瞬时错误、连接失败,以及 WorkBuddy 的 11-128 敏感词拦截),网关会等一段间隔后再发一次。次数分两档,管的是两件事:①「同一账号重试次数」在同一账号上原地重发几次 —— 一般是提示词被上游拦截、或链路瞬时抖动,等一会儿重发往往就好了;②「切换账号重试次数」这份请求最多再换几个账号试 —— 首发的那个账号不算,每换一个扣一次,不分是不是同一家(换到同一家的下一个账号也算一次),换满还失败就把错误返回给客户端。两项都设为 0 表示失败不重试、直接报错。注意账号级限额(429)不占这里的换号次数 —— 那类失败走「冷却该账号并换下一个账号」的降级,与这里的重试是两条路。另有「指定错误码直接换号」名单(默认 402):命中名单的上游状态码不在同一账号重发,直接按队列换下一个账号继续试(换号也占「切换账号重试次数」),换满仍失败才把错误返回给客户端。"),routing:r("转发一个请求时按什么顺序挑账号:①「路由策略」决定排队规则 —— 顺序优先是排第 1 的接走所有请求、直到它不能答(限流 / 故障 / 额度尽)才轮到下一位;负载均衡是每条请求换下一位,把负载摊到各个账号上。②「会话粘性」让同一会话(相同的模型 + 相同的开头消息)尽量跟住同一个账号 —— 多轮对话的上下文缓存能复用、少换号少浪费;自动档粘 5 分钟、会话内档粘 6 小时、每轮与关闭都不粘。账号的排队位次(账号表的第一列)在所有策略下都是地基,策略在它之上再排。此外路由还有三层自愈保护:转发失败的账号退避休息一会儿(15 分钟起步翻倍、封顶 1 小时)、被 429 的账号垫底排到队尾 30 分钟、余额不足 / Token 周期用量到顶的账号由限制器拦下 —— 前两层可以在下面按需开关,限制器由账号的「限制器」设置管。"),sanitize:r("上游用「逐字精确匹配」的方式审核请求体(不是语义审核):客户端注入的固定模板句、计费头字段名、以及某些裸错误码出现在报文里就会整单拦截,返回 400。开启本项后,网关在每次转发前改写这些指纹 —— 表头键值整段删除,承载语义的模板句只换一个词(如 official CLI for Claude → official CLI tool for Claude),对话内容与语义都不受影响。规则集是内置的,不需要也无法维护词表。关掉本项后客户端模板会原样发往上游,可能重新出现模板句被误拦的报错。"),clineHeaders:r("Cline 上游按请求头判定「调用方是不是 Cline 自家产品」:X-CLIENT-TYPE: cline-sdk 是硬门槛(缺了它免费池模型一律 403),版本号与平台标识让请求更贴近官方客户端的形态。这里列出的是网关默认会发的头:改某一行的值 = 覆盖默认值(也可以新增默认清单之外的自定义头);把值清空保存 = 这个头不发送;在界面删掉被改过的行 = 回落默认值。改完点「保存」,下一个 Cline 请求立即生效。不懂某一行的含义就不要动它 —— 伪装头的价值在「与官方客户端逐字一致」。"),cors:r("网关面(/v1/*)默认不应答浏览器跨源请求:页面直连会被预检拦下,只报「无法连接 API」。注意来源是 * —— 未配「网关 Key」时任何网页都能借本机网关打上游,故默认关闭;只给自己用的话,让页面与网关同源(本地反代 /v1)更稳妥。面板接口(/api/*)不受影响。"),prompt:r("客户端(Claude Code / Codex 等 CLI)会在 system 提示词里注入几十句固定模板,上游按逐字匹配审核,命中就整单拦截(HTTP 400)。指纹脱敏能改写实测命中过的那几句,但换一个客户端版本就可能冒出新的。这里可以把 system 整段换成网关自己那份:①「透传」= 不动客户端 system(默认,行为与之前完全一致);②「替换」= 删掉客户端所有 system / developer 消息,换成网关的提示词(客户端项目规范随之消失);③「追加」= 在开头连续 system 块之后插入一条网关提示词,既有消息逐字不动(客户端规范与网关提示词并用)。那份提示词有两个来源:提示词文件(留空用内置默认),或直接在界面上编辑正文 —— 编辑过就以那份正文为准(优先于文件),清空则回到文件 / 内置默认。另外,透传 / 追加模式下撞了内容拦截(多半是指纹误报)时,网关会自动换一段最小中性提示词重试一次,并把「降级期」开到次日 00:00 —— 期间所有请求直接带中性提示词出门,不再先撞一次 400;这里能看见并提前解除它。上面几项是**默认值**:想给某个提供商单独配,用下面的「按提供商」加一行(带「网关自带」的家默认就列在那里)—— 不同的上游对这些内容的接受程度不一样。"),debug:r("开启后,网关会把每次转发**发给上游的请求**(请求头 + 请求体)与**上游返回的响应**(状态码 + 响应头 + 响应体)完整保存到本地,供请求日志页的「详情」查看。请求头里的 Authorization、Cookie、API Key 等凭据字段一律替换成 [redacted],不会明文落盘;请求体与响应体按原样保存(可能包含你的对话内容)。报文只保留最近 500 条,超出后丢弃最旧的。这是排障用的临时开关,不需要时建议关闭。"),io:r("导出会把全部账号与自定义提供商定义写入一个 JSON 文件,可以拷到另一台机器上导入后继续使用。导入采用合并策略:同提供商下按业务身份(UID / userId / apiKey 等)去重 —— 已存在的账号只更新凭证,保留本机原有的优先级顺序;新账号追加到转发顺序末尾,不会抢占当前正在使用的账号;自定义提供商定义按 id 合并,本机缺失时自动补建。"),backup:r("把整份数据库(账号、网关配置、事件日志、请求统计、调试报文与桌面设置)导出成一个 SQL 文件,恢复时整体替换本机全部数据 —— 与上面「账号导入 / 导出」的逐条合并是两种语义:恢复会连配置、日志与当前启用状态一起换成备份那台机器的状态。导出默认包含日志与调试报文(文件可能很大),不需要时可以取消勾选只备业务数据。恢复前会自动把当前数据备份到配置目录的 backups/ 下,恢复后需要重新登录管理面板。"),retention:r("三档数据各自独立计时,超出保留天数的部分会被删除:事件日志是登录、账号切换、429 切换这类系统事件;请求日志是网关每次转发到上游的逐条记录;按天聚合供报表页的热力图与按天趋势使用。请求日志与按天聚合默认 99999 天(约 274 年,效果上等于全量保留),事件日志默认 30 天。把某一档改小(例如 30 天改成 7 天)保存后会立即删除超出的历史数据,此操作不可恢复;改大或保持不变不会删除任何数据。三档的可填范围均为 1–99999 天。"),storage:r("全部数据(账号、事件日志、请求记录、调试报文、设置)统一保存在配置目录下的 agent2api.db 这一个 SQLite 数据库里。备份时只需拷贝这个文件;更换保存位置请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),modelsDev:r("models.dev 是一个开源的模型资料库(社区维护),这里用它补齐「上游没告诉我们」的模型能力:上下文窗口、最大输出、工具调用、图片、视频、是否支持思考,以及这个模型认识哪些思考档位。优先级是:你在「模型能力」里手工改的值 > 上游清单自己声明的值 > models.dev 的值 —— 它只填上游没声明的空位,从不推翻上游已声明的。网关随包内嵌了一份快照,所以离线、首次启动、访问不通时也有数据;开启时会按「模型目录刷新」任务的间隔联网更新(同一轮里一并刷新,也可在这里立即刷新)。关闭只停联网刷新,已经拿到的数据继续用。")},$n={timeouts:r("保存后立即生效,不用重启;超时按上游失败处理(计入请求日志的「错误」列,并按「请求重试」的设置决定是否重试)。"),queue:r("等待期间请求日志的状态列会显示「排队中」阶段,详情弹窗的「内部重试」里能逐次看到等待时长;等待用尽后返回 HTTP 503(不是 401/429:既不会刷新凭证,也不会把账号标成限额)。"),captchaPool:r("保存后对下一轮补货立即生效,不用重启。守卫跑在应用界面里:轻量模式关窗销毁界面期间无法铸造,走活动套餐通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。"),retry:r("保存后立即生效,不用重启;次数用尽仍失败时,错误原样返回给客户端。"),routing:r("保存后立即生效,不用重启:策略与粘性作用于**下一次**转发的选路,进行中的请求不受影响。"),retryCodes:r("命中这些上游状态码的失败不在同一账号重发,直接换下一个账号继续试(换号占用「切换账号重试次数」,换满仍失败才把错误原样返回给客户端)。输入 100–599 的状态码后回车添加,点 × 或退格删除;默认 402(积分不足)。清空全部表示任何错误都照常重试。"),sanitize:r("默认开启。命中明细会记进请求日志的「敏」标签(悬停可看命中了哪几条规则)。本项只改发给上游的副本,客户端看到的响应内容不变。"),clineHeaders:r("值与默认值相同的行不占覆盖(存的是「改过的键」,不是全量配置);值留空保存表示这个头不发送,删除改过的行表示回落默认值。改完立即生效,不用重启。"),cors:r("默认关闭。改动立即生效,不用重启;关闭期间的跨源请求会被预检拦下。"),debug:r("开启后新发生的请求才会被记录(已经过去的请求补不回来)。报文统一存放在本地数据库里,只保留最近 500 条(超出后丢弃最旧的),条数见左侧「数据 → 数据存储」的「调试报文」。"),promptMode:r("替换 = 客户端 system / developer 消息全部删掉,换成网关的提示词;追加 = 保留客户端内容,只在开头 system 块之后多插一条。两者都只改发给上游的副本,客户端看到的响应不变。"),promptFile:r("UTF-8 文本文件路径,留空用内置默认提示词(通用编码助手提示词,不含任何会被上游拦截的模板句)。只在「替换 / 追加」模式下生效,透传模式不读它。"),promptText:r("在这里直接编辑提示词正文:保存后以这份文本为准(优先于上面的提示词文件),清空则回到文件 / 内置默认。改一个字不必再去编辑器里开文件。"),promptGatewayText:r("上游按「结构」校验身份:三段必须各自成块,所以这里分开编辑三段(不能合成一段)。动态段里的运行值写成占位符,发请求时才替换:{cwd} 工作目录、{platform} 平台、{shell} shell、{os_version} 系统版本、{git} 是否 git 仓库、{provider} 提供方标识、{model} 模型名。清空某一段 = 那一段恢复官方原文。第三段发出时前面会自带一个空行(官方形状)。"),prompt:r("改完立即生效,不用重启(下一个请求就用新模式)。降级是自动的临时状态,解除后本模式自己的提示词立刻恢复。"),promptProviders:r("「用哪份提示词」本来是按上游分别决定的事,所以每家可以有自己的模式、提示词文件与正文:不在这里列出的提供商一律沿用上面那份默认设置,「跟随默认」把这一家取消、回到默认。带「网关自带」那一行的家(目前是 ZCode 两家)默认就列在这里 —— 那一段是网关自己装上去的文本,不来自客户端也不来自提示词文件,默认开启、可以关掉,也可以改它的正文(改过的那一段以你的文本为准);关掉后还能不能通过上游校验,取决于上游当下的口径,行内说明了实测依据。「模式 / 提示词文件 / 正文」管的是客户端自己的 system 怎么处理,与那个开关是两件事。"),modelsDev:r("「模型管理」里每个能力的来源标记(上游 / models.dev / 已覆盖)读的就是这份数据;映射弹窗的思考档位下拉也按这里的数据只列该模型真实认识的档位。"),retention:r("保存后立即生效:改小保留天数会立刻删除超出的历史数据,且不可恢复。"),storageFile:r("配置目录下的 agent2api.db(账号、日志、请求记录、调试报文与设置都在里面)。"),storageSize:r("库主文件的大小(不含运行期间的 WAL 临时文件,退出时已自动并回)。"),storage:r("数据统一保存在配置目录下的 agent2api.db;如需更换位置,请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),captcha:r("开启后,登录页在浏览器后台自动完成验证(对真人无感),而脚本每次尝试都要先算一道题 —— 暴力破解与抢注的成本显著上升。仅影响面板的登录 / 注册,与 API 客户端的 API Key 无关。"),panelLogin:r("当前浏览器以管理员身份登录着本面板。「退出登录」会撤销这台设备的登录会话(30 天内的自动续期一并失效),需要重新输入账号密码;其他已登录的设备不受影响。"),exportDanger:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义,可直接用于登录。请妥善保管,不要外传或上传到公共位置。"),backupDanger:r("备份文件内含全部账号凭证、网关 API Key 与面板管理员凭据,可直接用于登录。请妥善保管,不要外传或上传到公共位置。")},Ut={appLoading:"—",appUnavailable:r("主进程未返回启动设置,请更新桌面端后重试"),appTrayOn:r("关闭窗口时程序不退出,转发继续在后台运行;退出请用托盘菜单"),appTrayOff:r("关闭窗口即退出程序,后台转发随之中断"),appLightOn:r("轻量模式已开启:关窗即销毁界面进程(释放约 200MB 内存),网关在后台继续;界面销毁期间 ZCode 活动套餐通道不可用,相关请求会在请求日志里注明原因"),appLightOff:r("未开启轻量模式:关窗仅隐藏窗口,界面进程常驻内存,随时打开不等待"),unitsOn:r("当前显示为「1.2亿 / 8400万」这类中文量级。"),unitsOff:r("当前显示为「1.20M / 8.4k」这类英文缩写。"),debugUnavailable:r("未能读取调试模式设置,请稍后重试"),debugOn:r("正在保存上游原始报文:"),debugOff:r("未开启,转发时不保存任何原始报文。"),sanitizeUnavailable:r("未能读取指纹脱敏设置,请稍后重试"),sanitizeOn:r("正在剥离出站请求里的审核指纹:表头键值整段删除,模板句最小改写。"),sanitizeOff:r("未开启,客户端 system 模板会原样发往上游,可能被内容审核误拦(400)。"),corsUnavailable:r("未能读取网关跨域访问设置,请稍后重试"),corsOn:r("正在应答跨源请求:浏览器跨域请求可直连 /v1/*。"),corsOff:r("未开启,浏览器跨域无法直连网关。"),modelsDevUnavailable:r("未能读取 models.dev 元数据状态,请稍后重试"),modelsDevSourceBuiltin:r("随包内嵌的快照(发版时的那份)"),modelsDevSourceCache:r("上次成功刷新的结果(存在本机数据库里)"),modelsDevSourceNetwork:r("刚刚从 models.dev 拉到的最新数据"),modelsDevEmpty:r("还没有装载任何数据。"),promptUnavailable:r("未能读取系统提示词设置,请稍后重试"),degradeUntilFallback:r("次日 00:00"),themeSystem:r("当前跟随操作系统的深浅色设置,系统切换时界面会自动跟上。"),themeLight:r("当前固定为浅色模式,不随系统变化。"),themeDark:r("当前固定为深色模式,不随系统变化。"),zoomWeb:r("网页端的界面缩放由浏览器自己控制(Ctrl + / Ctrl -,或浏览器菜单里的缩放),此项不可调。"),zoomDefault:r("当前按 100% 显示(默认比例)。"),languageHint:r("界面语言只保存在本机(localStorage)。切换后整页立即刷新,不影响账号、密钥与转发。")},Ox=[{value:"order",label:r("顺序优先"),tip:r("排第 1 的接走所有请求,直到它不能答(限流 / 故障 / 额度尽)才轮到下一位 —— 就是「从上往下」的现状行为。")},{value:"rotate",label:r("负载均衡"),tip:r("每条请求轮换到下一个可用账号;新会话交给当前最闲的那位。适合想把手里的号摊开用、不让某一个一直扛。")},{value:"provider",label:r("家内轮询"),tip:r("家之间仍按优先级,只有同一家内部轮流用各账号 —— 想优先用某几家、又不愿把某一家的某个账号焊死时用它。")}],Mx=[{value:"auto",label:r("自动"),tip:r("同一会话在 5 分钟内尽量跟住同一个账号;停了 5 分钟再发就算新会话。多数场景用它 —— 多轮对话少换号,也不至于把账号焊死。")},{value:"session",label:r("会话内"),tip:r("同一会话在 6 小时内跟住同一个账号;适合一坐几个小时的长会话,上游的上下文缓存能吃到更多。")},{value:"turn",label:r("每轮"),tip:r("每条请求都重新按策略选路 —— 行为与「关闭」一致,仅保留会话识别的记录。")},{value:"off",label:r("关闭"),tip:r("不做会话识别,每条请求都重新按策略选路。")}],XZ=[{key:"routingFailoverBackoff",label:r("失败退避"),defaultOn:!0,tip:r("转发失败的账号休息一会儿再回来:15 分钟起步,连续失败翻倍,封顶 1 小时;成功一次立即恢复。目的是「让这次失败先凉一会儿」,免得一条条地反复撞同一个坏账号。")},{key:"routingSink",label:r("限流垫底"),defaultOn:!0,tip:r("还有额度时被 429 的账号排到队尾,30 分钟后自动回到队列(成功转发一次也会立即回来)。它标记的是「疑似共享池被别人抢」,不是「这个账号本身有问题」。⚠️ 注意它与路由策略的配合:在「家内轮询」下,队尾意味着这一家整体被往后排 —— 如果某个提供商的账号被批量限流,它们会集体沉到队尾,那个家可能长时间轮不到。这时可以关掉本项,让 429 过的账号只受冷却约束(冷却到点自动回来)。")},{key:"routingBreakerEnabled",label:r("熔断"),defaultOn:!1,tip:r("连续失败到阈值后把这个账号整个打开(默认关)。与失败退避的分工:退避管「单次失败先凉一会儿」,惩罚轻、自动恢复;熔断管「这个账号现在整体不对劲,别再一条条地试」,要连续成功若干次才关。打开期间该账号被跳过,除非全场只剩它 —— 那时仍放行试一次。")}],MI=[{key:"zcodeCaptchaPoolTarget",id:"settings-captcha-pool-target",label:r("库存目标"),unit:r("个"),min:1,max:10,hint:r("ZCode 活动套餐通道每条请求都要消耗一个当次铸造的人机验证令牌(一次性,2 分钟过期),库存低于该值时界面自动补铸到它。默认 3 个。调大能吸收突发并发,但用不掉的令牌 2 分钟就过期作废,烧的是上游风控配额。可填 1–10。")},{key:"zcodeCaptchaPoolPollMs",id:"settings-captcha-pool-poll-ms",label:r("轮询间隔"),unit:r("毫秒"),min:1e3,max:3e4,hint:r("铸造守卫每隔多久看一次库存(毫秒)。只影响发现缺货的反应速度 —— 库存够用时轮询不会铸造任何令牌。默认 2500 毫秒,可填 1000–30000。")},{key:"zcodeCaptchaPoolMaxPerRound",id:"settings-captcha-pool-max-per-round",label:r("单轮铸造上限"),unit:r("个"),min:1,max:5,hint:r("发现缺货时一轮最多铸几个(连铸之间固定隔 500 毫秒)。默认 1 个:SDK 同一实例连铸容易互相干扰。调大补货更快,但单轮连铸越多越容易触发上游风控。可填 1–5。")}];function DI(){return tt().workbuddyDesktop?.platform==="web"}let dt={...{category:Ax[0].id,scrollReset:0,busy:null,app:{status:"loading",closeToTray:!1,autostart:!1,lanAccess:!1,lanPanel:!1,lightweightMode:!1,lanIp:null,port:0,adminRegistered:null},unitsChinese:!0,retention:{status:"loading",values:null},retry:{status:"loading",values:null},retryCodes:null,timeouts:{status:"loading",values:null},queue:{status:"loading",values:null},captchaPool:{status:"loading",values:null},routing:{status:"loading",strategy:"order",sticky:"auto",failoverBackoff:!0,sink:!0,breakerEnabled:!1},debug:{status:"loading",on:!1,count:null,limit:null},sanitize:{status:"loading",on:!1},clineHeaders:{status:"loading",defaults:{},overrides:{},effective:{}},cors:{status:"loading",on:!1},prompt:{status:"loading",mode:"passthrough",file:"",text:"",source:"",lines:0,fileError:"",degradeActive:!1,degradeUntilText:"",providers:[],gateway:{},gatewayText:{},options:[]},storage:{status:"loading",available:!0,file:"",bytes:0,accounts:null,logs:null,requests:null,dailyDays:null,debug:null},captcha:{available:!0,enabled:!1},modelsDev:{status:"loading",enabled:!0,source:"",updatedAt:0,count:0},ioFailure:null,retentionConfirm:null,dbIncludeLogs:!0,dbBackupConfirm:null,dbWarning:null,lanConfirm:null,lanRegister:null,panelLogin:!1},panelLogin:DI()};const uS=new Set;function QZ(e){return uS.add(e),()=>{uS.delete(e)}}function ZZ(){return dt}function WZ(){return x.useSyncExternalStore(QZ,ZZ)}function Ze(e){dt={...dt,...e};for(const t of uS)t()}function Ma(e){Ze({app:{...dt.app,...e}})}function nl(){Ze({})}let En=null;function ds(e){En=e,Ze({busy:e})}function as(){En=null,Ze({busy:null})}function dS(e){const t=Ax.some(a=>a.id===e)?String(e):Ax[0].id;Ze({category:t,scrollReset:dt.scrollReset+1})}function JZ(e){dS(e);try{localStorage.setItem(yI,e)}catch{}}function II(){let e=null;try{e=localStorage.getItem(yI)}catch{e=null}dS(e)}function PI(){Ze({unitsChinese:tt().wbUnits?.isChinese?.()!==!1})}function eW(e){tt().wbUnits?.setChinese?.(e),PI(),Ve(r(e?"✅ 已改用本地量级词(万 / 亿式)":"✅ 已改用 k / M 缩写"))}function fS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ma({status:"unavailable"});return}const t=e;Ma({status:"ready",closeToTray:t.closeToTray===!0,autostart:t.autostart===!0,lanAccess:t.lanAccess===!0,lanPanel:t.lanPanel===!0,lightweightMode:t.lightweightMode===!0})}async function _I(){try{fS(await tt().workbuddyDesktop?.getAppSettings())}catch(e){console.warn("读取应用设置失败:",_t(e)),fS(null)}}async function tW(){const e=tt().workbuddyDesktop;if(e?.localIp){try{Ma({lanIp:await e.localIp()||null})}catch{}try{const t=Number((await e.getBackendStatus?.())?.port)||0;t&&Ma({port:t})}catch{}try{const t=(await e.panelAdminStatus?.())?.registered===!0;Ma({adminRegistered:t})}catch{}}}async function pS(e,t){if(En){nl();return}const a=dt.app,o={closeToTray:e==="tray"?t:a.closeToTray,autostart:e==="autostart"?t:a.autostart,lanAccess:a.lanAccess,lanPanel:a.lanPanel,lightweightMode:e==="lightweight"?t:a.lightweightMode};ds("app"),Ma(o);const c=r(e==="autostart"?"开机自动启动":e==="lightweight"?"轻量模式":"关闭窗口时最小化到托盘");try{const d=tt().workbuddyDesktop;if(!d)throw new Error(r("主进程桥不可用"));const f=await d.saveAppSettings(o);Ma({status:"ready",...KZ(f,o)}),Ve(r("✅ 已更新「{label}」",{label:c}))}catch(d){Ma(a),Ve(r("保存失败:{message}",{message:_t(d)}),"err")}finally{as()}}function nW(e){if(En){nl();return}Ze({lanConfirm:{mode:e?"enable":"disable",panel:dt.app.lanPanel}})}function sW(e){if(En){nl();return}Ze({lanConfirm:{mode:"panel",panel:e}})}function mS(e){const t=dt.lanConfirm;if(Ze({lanConfirm:null}),!(!t||!e)){if(t.mode==="disable"){Dx(!1,!1);return}if(t.mode==="panel"){Dx(!0,t.panel);return}rW()}}async function rW(){const e=tt().workbuddyDesktop;if(!e?.panelAdminStatus){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan");let t;try{t=(await e.panelAdminStatus())?.registered===!0}catch(a){as(),Ve(r("查询管理员状态失败:{message}",{message:_t(a)}),"err");return}if(as(),Ma({adminRegistered:t}),t){await Dx(!0,dt.app.lanPanel);return}Ze({lanRegister:{busy:!1,error:""}})}async function aW(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.panelRegister)return;const o=e.trim();if(!o||o.length>64){Ze({lanRegister:{busy:!1,error:r("请填写管理员账号(64 字符以内)")}});return}if(t.length<8){Ze({lanRegister:{busy:!1,error:r("密码至少 8 位")}});return}Ze({lanRegister:{busy:!0,error:""}});try{if(await a.panelRegister(o,t),dt.lanRegister===null)return;Ze({lanRegister:null}),Ma({adminRegistered:!0}),await Dx(!0,dt.app.lanPanel)}catch(c){Ze({lanRegister:{busy:!1,error:_t(c)}})}}function LI(){Ze({lanRegister:null})}async function Dx(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.changeLanAccess){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan"),Ma({lanAccess:e,lanPanel:t});try{(await a.changeLanAccess(e,t))?.createdKey&&Ve(r("✅ 已自动创建网关 Key「默认」(可在「网关 Key」页查看)")),Ve(r("✅ 设置已保存,应用正在重启…"))}catch(o){Ve(r("保存失败:{message}",{message:_t(o)}),"err"),await _I()}finally{as()}}async function lW(){if(!En){Ze({ioFailure:null}),ds("export");try{const e=await tt().workbuddyDesktop?.exportAccounts();if(e?.canceled){Ve(r("已取消导出"));return}const t=Number(e?.count)||0,a=Number(e?.customProviders)||0;if(!t&&!a){Ve(r("没有可导出的账号"),"err");return}const o=a?r("、{n} 个自定义提供商",{n:a}):"",c=e?.file?r(" 到 {file}",{file:e.file}):"";Ve(r("✅ 已导出 {count} 个账号{note}{file}",{count:t,note:o,file:c}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}async function oW(){if(!En){Ze({ioFailure:null}),ds("import");try{const e=await tt().workbuddyDesktop?.importAccounts();if(e?.canceled){Ve(r("已取消导入"));return}const t=Number(e?.added)||0,a=Number(e?.updated)||0,o=Number(e?.skipped)||0,c=Number(e?.failed)||0,d=Array.isArray(e?.errors)?e.errors:[],f=e?.customProviders??{},p=Number(f.added)||0,h=Number(f.updated)||0,b=[];o&&b.push(r("跳过 {n} 个",{n:o})),c&&b.push(r("失败 {n} 个",{n:c}));const y=b.length?r(",{items}",{items:b.join(r("、"))}):"",v=p||h?r(",自定义提供商新增 {added} 个、更新 {updated} 个",{added:p,updated:h}):"",w=r("新增 {added} 个、更新 {updated} 个{suffix}{note}",{added:t,updated:a,suffix:y,note:v});if(c){Ve(r("导入完成:{summary}",{summary:w}),"err");const j=d.slice(0,3).map(S=>{const N=S?.customProvider?r("自定义提供商 {id}",{id:S?.id||r("(无 id)")}):S?.id??r("未知账号"),k=S?.message??r("未知原因");return r("{label}({message})",{label:N,message:k})}).join(r(";"));Ze({ioFailure:{failed:c,detail:j,more:d.length>3}})}else Ve(r("✅ 导入完成:{summary}",{summary:w}));(t||a||p||h)&&await tt().wbApp?.refresh?.()}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function iW(e){Ze({dbIncludeLogs:e})}async function cW(){if(!En){ds("dbExport");try{const e=tt().workbuddyDesktop;if(!e?.exportDatabase){Ve(r("当前环境不支持整库备份(仅桌面端可用)"),"err");return}const t=await e.exportDatabase(dt.dbIncludeLogs);if(t?.canceled){Ve(r("已取消导出"));return}const a=Number(t?.bytes)||0,o=Array.isArray(t?.tables)?t.tables.length:0;Ve(r("✅ 已备份 {n} 张表({size})到 {file}",{n:o,size:OI(a),file:t?.file||""}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function uW(){En||Ze({dbBackupConfirm:{includeLogs:dt.dbIncludeLogs}})}function hS(e){Ze({dbBackupConfirm:null}),e&&dW()}async function dW(){if(En)return;const e=tt().workbuddyDesktop;if(!e?.importDatabase){Ve(r("当前环境不支持整库恢复(仅桌面端可用)"),"err");return}ds("dbImport"),Ze({dbWarning:null});try{const t=await e.importDatabase(),a=Array.isArray(t?.tables)?t.tables.length:0,o=t?.safetyBackup?r(",替换前的数据已备份为 {name}",{name:t.safetyBackup}):"";Ve(r("✅ 已恢复 {n} 张表{note}",{n:a,note:o}));const c=typeof t?.warning=="string"?t.warning.trim():"";c&&Ze({dbWarning:c}),await ES(),await tt().wbApp?.refresh?.()}catch(t){Ve(r("恢复失败:{message}",{message:_t(t)}),"err")}finally{as()}}function Ix(e){if(e===void 0)return;const t=RI(oS,e,dt.retention.values);Ze({retention:{status:t===null?"unavailable":"ready",values:t}})}async function Px(){try{Ix(await tt().workbuddyDesktop?.getRetention())}catch(e){console.warn("读取数据保留设置失败:",_t(e)),Ix(null)}}let _x=null;function Lx(e){const t=_x;_x=null,Ze({retentionConfirm:null}),t?.(e)}function fW(e){return new Promise(t=>{_x&&Lx(!1),_x=t,Ze({retentionConfirm:{head:e}})})}function pW(e,t,a){return t===null?r("没能读到「{label}」的当前值,改为 {days} 天可能会删除超出的历史数据。",{label:e.label,days:a}):r("「{label}」将从 {previous} 天改为 {days} 天。",{label:e.label,previous:t,days:a})}async function mW(e,t){if(En||dt.retentionConfirm)return;const a=AI(t,e.min,e.max,r("天数"));if(!a.ok){Ve(a.message,"err");return}const o=dt.retention.values?.[e.key],c=typeof o=="number"&&Number.isInteger(o)?o:null;if(c!==null&&a.value===c)return;const d=c===null||a.valueNumber.isInteger(d?.[f.key]))){const f=d?.[e.key]??t;Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:f}):r("✅ 已保留 {days} 天",{days:f}));return}await Px(),Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:t}):r("✅ 已保留 {days} 天",{days:t}))}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await Px()}finally{as()}}function Np(e,t){if(t===void 0)return;const a=RI(e.fields,t,e.read().values);e.write({status:a===null?"unavailable":"ready",values:a}),e.syncExtras?.(a===null?null:t)}async function Ku(e){try{Np(e,await e.get())}catch(t){console.warn(`${e.consoleLabel}失败:`,_t(t)),Np(e,null)}}async function zx(e,t,a){if(En)return;const o=AI(a,t.min,t.max,t.label);if(!o.ok){Ve(o.message,"err");return}const c=e.read().values?.[t.key];if(Number.isInteger(c)&&o.value===c)return;ds(e.scope);const d=e.read().values;d&&e.write({status:"ready",values:{...d,[t.key]:o.value}});try{const f=await e.save({[t.key]:o.value});Np(e,f);const p=e.read().values?.[t.key],h=Number.isInteger(p)?p:o.value;Ve(r("✅ 已保存:{label} {value}",{label:t.label,value:String(h)}))}catch(f){Ve(r("保存失败:{message}",{message:_t(f)}),"err"),await Ku(e)}finally{as()}}const zI={scope:"queue",fields:CI,consoleLabel:"读取排队等待设置",get:()=>tt().workbuddyDesktop?.getQueue(),save:e=>tt().workbuddyDesktop?.saveQueue(e),read:()=>dt.queue,write:e=>Ze({queue:e})};async function BI(){await Ku(zI)}async function gW(e,t){await zx(zI,e,t)}const HI={scope:"captchaPool",fields:MI,consoleLabel:"读取验证码令牌池设置",get:()=>tt().workbuddyDesktop?.getCaptchaPool(),save:e=>tt().workbuddyDesktop?.saveCaptchaPool(e),read:()=>dt.captchaPool,write:e=>Ze({captchaPool:e})};async function UI(){await Ku(HI)}async function xW(e,t){await zx(HI,e,t)}const VI="routingStrategy",FI="routingSticky",bW="routingFailoverBackoff",vW="routingSink",yW="routingBreakerEnabled",wW={[VI]:new Set(Ox.map(e=>e.value)),[FI]:new Set(Mx.map(e=>e.value))};function $I(e){const t=e&&typeof e=="object"?e:{},a=(c,d)=>{const f=t[c];return typeof f=="string"&&wW[c].has(f)?f:d},o=(c,d)=>{const f=t[c];return typeof f=="boolean"?f:d};return{strategy:a(VI,"order"),sticky:a(FI,"auto"),failoverBackoff:o(bW,!0),sink:o(vW,!0),breakerEnabled:o(yW,!1)}}async function Bx(){try{const e=await tt().workbuddyDesktop?.getRoutingConfig();if(e===void 0){Ze({routing:{...dt.routing,status:"unavailable"}});return}Ze({routing:{status:"ready",...$I(e)}})}catch(e){console.warn("读取路由设置失败:",_t(e)),Ze({routing:{...dt.routing,status:"unavailable"}})}}async function gS(e){if(En)return;const t=tt().workbuddyDesktop;if(!t?.setRoutingConfig){Ve(r("桌面运行时不可用,暂时无法保存"),"err");return}ds("routing");try{const a=await t.setRoutingConfig(e);a!==void 0?Ze({routing:{status:"ready",...$I(a)}}):await Bx(),Ve(r("✅ 路由设置已保存"))}catch(a){Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await Bx()}finally{as()}}const kp={scope:"retry",fields:NI,consoleLabel:"读取请求重试设置",get:()=>tt().workbuddyDesktop?.getRetry(),save:e=>tt().workbuddyDesktop?.saveRetry(e),read:()=>dt.retry,write:e=>Ze({retry:e}),syncExtras:e=>{if(e===null){Ze({retryCodes:null});return}const t=e[TI];if(!Array.isArray(t))return;Ze({retryCodes:t.filter(o=>typeof o=="number"&&Number.isInteger(o)&&o>=iS&&o<=cS)})}};function jW(e){Np(kp,e)}async function qI(){await Ku(kp)}async function SW(e,t){await zx(kp,e,t)}async function xS(e){if(!En){Ze({retryCodes:e}),ds("codes");try{const t=await tt().workbuddyDesktop?.saveRetry({[TI]:e});Np(kp,t),Ve(r("✅ 已保存:指定错误码直接换号"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await Ku(kp)}finally{as()}}}async function NW(e){const t=dt.retryCodes;if(t===null)return;const a=String(e??"").trim();if(!a)return;if(!/^\d+$/.test(a)||Number(a)cS){Ve(r("状态码必须是 {min}–{max} 的整数(收到: {text})",{min:iS,max:cS,text:a}),"err");return}const o=Number(a);if(t.includes(o)){Ve(r("状态码 {code} 已在名单里",{code:o}));return}if(t.length>=EI){Ve(r("名单最多 {max} 个状态码",{max:EI}),"err");return}await xS([...t,o])}async function kW(e){const t=dt.retryCodes;!t||!t.includes(e)||await xS(t.filter(a=>a!==e))}async function CW(){const e=dt.retryCodes;e?.length&&await xS(e.slice(0,-1))}const GI={scope:"timeouts",fields:kI,consoleLabel:"读取请求超时设置",get:()=>tt().workbuddyDesktop?.getTimeouts(),save:e=>tt().workbuddyDesktop?.saveTimeouts(e),read:()=>dt.timeouts,write:e=>Ze({timeouts:e})};async function KI(){await Ku(GI)}async function TW(e,t){await zx(GI,e,t)}function Hx(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({debug:{status:"unavailable",on:!1,count:null,limit:null}});return}const t=e,a=Number(t.count),o=Number(t.limit);Ze({debug:{status:"ready",on:t.debugMode===!0,count:Number.isInteger(a)?a:null,limit:Number.isInteger(o)?o:null}})}async function bS(){try{Hx(await tt().workbuddyDesktop?.getDebug())}catch(e){console.warn("读取调试模式设置失败:",_t(e)),Hx(null)}}async function EW(e){if(En){nl();return}ds("debug"),Ze({debug:{...dt.debug,on:e}});try{const t=await tt().workbuddyDesktop?.saveDebug(e);Hx(t),Ve(r(e?"✅ 调试模式已开启":"✅ 调试模式已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await bS()}finally{as()}}function Ux(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({sanitize:{status:"unavailable",on:!1}});return}Ze({sanitize:{status:"ready",on:e.sanitizeBlacklistFingerprints===!0}})}async function vS(){try{Ux(await tt().workbuddyDesktop?.getSanitize())}catch(e){console.warn("读取出站指纹脱敏设置失败:",_t(e)),Ux(null)}}async function AW(e){if(En){nl();return}ds("sanitize"),Ze({sanitize:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveSanitize(e);Ux(t),Ve(r(e?"✅ 出站指纹脱敏已开启":"已关闭出站指纹脱敏"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await vS()}finally{as()}}function yS(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function wS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({clineHeaders:{status:"unavailable",defaults:{},overrides:{},effective:{}}});return}const t=e;Ze({clineHeaders:{status:"ready",defaults:yS(t.defaults),overrides:yS(t.overrides),effective:yS(t.effective)}})}async function jS(){try{wS(await tt().workbuddyDesktop?.getClineHeaders())}catch(e){console.warn("读取 Cline 伪装头失败:",_t(e)),wS(null)}}async function RW(){await jS(),Ve(r("Cline 伪装头已刷新"))}async function YI(e){if(En){nl();return}ds("clineHeaders");try{const t=await tt().workbuddyDesktop?.saveClineHeaders(e);wS(t),Ve(r("✅ Cline 伪装头已保存"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await jS()}finally{as()}}function SS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({cors:{status:"unavailable",on:!1}});return}Ze({cors:{status:"ready",on:e.corsEnabled===!0}})}async function NS(){try{SS(await tt().workbuddyDesktop?.getCors())}catch(e){console.warn("读取网关跨域访问设置失败:",_t(e)),SS(null)}}async function OW(e){if(En){nl();return}ds("cors"),Ze({cors:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveCors(e);SS(t),Ve(r(e?"网关跨域访问已开启":"已关闭网关跨域访问"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await NS()}finally{as()}}async function XI(){try{const e=await tt().workbuddyDesktop?.getCaptchaSetting();Ze({captcha:{available:!0,enabled:e?.captchaEnabled===!0}})}catch(e){Ze({captcha:{available:!1,enabled:!1}}),console.warn("读取机器人校验设置失败:",_t(e))}}async function MW(e){if(En){nl();return}ds("captcha"),Ze({captcha:{...dt.captcha,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveCaptchaSetting(e);Ze({captcha:{available:!0,enabled:t?.captchaEnabled===!0}}),Ve(r(e?"✅ 机器人校验已开启":"⚠️ 机器人校验已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await XI()}finally{as()}}function kS(e){return!e||typeof e!="object"?{status:"unavailable",enabled:!0,source:"",updatedAt:0,count:0}:{status:"ready",enabled:e.modelsDevEnabled!==!1,source:typeof e.source=="string"?e.source:"",updatedAt:Number(e.updatedAt)||0,count:Number(e.count)||0}}async function CS(){try{const e=await tt().workbuddyDesktop?.getModelsDev?.();Ze({modelsDev:kS(e)})}catch(e){Ze({modelsDev:{...dt.modelsDev,status:"unavailable"}}),console.warn("读取 models.dev 元数据设置失败:",_t(e))}}async function DW(e){if(En){nl();return}ds("modelsDev"),Ze({modelsDev:{...dt.modelsDev,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveModelsDev?.(e);Ze({modelsDev:kS(t)}),Ve(r(e?"✅ models.dev 模型元数据已开启":"已关闭 models.dev 联网刷新"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await CS()}finally{as()}}async function IW(){if(En){nl();return}ds("modelsDevRefresh");try{const e=await tt().workbuddyDesktop?.refreshModelsDev?.();Ze({modelsDev:kS(e?.status)});const t=e?.result,a=String(t?.status||"");a==="refreshed"?Ve(r("models.dev 元数据已更新({count} 条)",{count:Number(t?.count)||0})):a==="failed"?Ve(r("刷新失败:{message}",{message:String(t?.message||"")}),"err"):Ve(String(t?.message||r("本次无需刷新")))}catch(e){Ve(r("刷新失败:{message}",{message:_t(e)}),"err"),await CS()}finally{as()}}function Yu(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({prompt:{...dt.prompt,status:"unavailable"}});return}const t=e,a=LW(t.promptGateway);Ze({prompt:{status:"ready",mode:String(t.promptMode||"passthrough"),file:String(t.promptFile||""),text:String(t.promptText||""),source:String(t.promptSource||""),lines:Number(t.promptLines)||0,fileError:String(t.promptFileError||""),degradeActive:t.degradeActive===!0,degradeUntilText:String(t.degradeUntilText||""),providers:PW(t.promptProviders,a),gateway:a,gatewayText:zW(t.promptGatewayText),options:_W(t.promptProviderOptions)}})}function PW(e,t){return!e||typeof e!="object"?[]:Object.entries(e).filter(([a,o])=>!!a&&!!o&&typeof o=="object").map(([a,o])=>{const c=o;return{id:a,mode:String(c.promptMode||"passthrough"),file:String(c.promptFile||""),text:String(c.promptText||""),source:String(c.promptSource||""),lines:Number(c.promptLines)||0,fileError:String(c.promptFileError||""),gateway:t[a]??!0,configured:!0}}).sort((a,o)=>a.id.localeCompare(o.id))}function _W(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&String(t.id||"")).map(t=>{const a=t;return{id:String(a.id),label:String(a.label||a.id),gatewayNote:String(a.gatewayNote||""),gatewayChars:Number(a.gatewayChars)||0,gatewayBlocks:BW(a.gatewayBlocks)}}):[]}function LW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();!c||typeof o!="boolean"||(t[c]=o)}return t}function zW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();if(!c||!o||typeof o!="object")continue;const d=o,f={identity:"",stable:"",dynamic:""};let p=!1;for(const h of["identity","stable","dynamic"]){const b=String(d[h]||"");f[h]=b,b.trim()&&(p=!0)}p&&(t[c]=f)}return t}function BW(e){if(!e||typeof e!="object")return null;const t=e,a={identity:String(t.identity||""),stable:String(t.stable||""),dynamic:String(t.dynamic||"")};return!a.identity.trim()&&!a.stable.trim()&&!a.dynamic.trim()?null:a}async function rc(){try{Yu(await tt().workbuddyDesktop?.getPrompt())}catch(e){console.warn("读取系统提示词设置失败:",_t(e)),Yu(null)}}async function Cp(e,t){if(En)return await rc(),!1;ds("prompt");try{const a=await tt().workbuddyDesktop?.savePrompt(t);return Yu(a),Ve(r("✅ 已保存:{label}",{label:e})),!0}catch(a){return Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await rc(),!1}finally{as()}}async function HW(e){const t=zo.find(a=>a.value===e);await Cp(r("模式改为「{mode}」",{mode:t?.toastLabel??e}),{promptMode:e})}async function UW(e){await Cp(e.trim()?r("提示词文件已更新"):r("已改回内置默认提示词"),{promptFile:e})}async function VW(e){const t=!e.trim();return Cp(r(t?"已清掉界面编辑的提示词(回落文件 / 内置默认)":"提示词正文已更新"),{promptText:t?"":e})}function Bo(e,t){return e.options.find(a=>a.id===t)?.label||t}function ac(e){const t=e==null?"":String(e).trim();return t&&dt.prompt.options.some(a=>a.id===t)?t:""}async function Tp(e,t,a){return Cp(e,{promptProviders:{[t]:a}})}function Vx(e,t){const a=!t.configured;return{promptMode:t.mode,promptFile:t.file,promptText:a&&e.source==="inline"?e.text:""}}async function FW(e){const t=ac(e);if(!t)return;const a=dt.prompt;await Tp(r("已为「{label}」单独配置提示词",{label:Bo(a,t)}),t,Vx(a,{mode:a.mode,file:a.file,text:a.text,source:a.source,lines:a.lines,fileError:a.fileError,gateway:a.gateway[t]??!0,configured:!1}))}async function $W(e,t){const a=ac(e.id);if(!a||!zo.some(c=>c.value===t))return;const o=zo.find(c=>c.value===t);await Tp(r("「{label}」的模式改为「{mode}」",{label:Bo(dt.prompt,a),mode:o?.toastLabel??t}),a,{...Vx(dt.prompt,e),promptMode:t})}async function qW(e,t){const a=ac(e.id);a&&await Tp(t.trim()?r("「{label}」的提示词文件已更新",{label:Bo(dt.prompt,a)}):r("「{label}」改用内置默认提示词",{label:Bo(dt.prompt,a)}),a,{...Vx(dt.prompt,e),promptFile:t})}async function GW(e,t){const a=ac(e.id);if(!a)return!1;const o=!t.trim(),c=Bo(dt.prompt,a);return Tp(o?r("已清掉「{label}」界面编辑的正文",{label:c}):r("「{label}」的提示词正文已更新",{label:c}),a,{...Vx(dt.prompt,e),promptText:o?"":t})}async function KW(e){const t=ac(e);t&&await Tp(r("已取消「{label}」的单独配置",{label:Bo(dt.prompt,t)}),t,null)}async function YW(e,t){const a=ac(e);if(!a)return;const o=Bo(dt.prompt,a);if(En){await rc();return}ds("prompt");try{const c=await tt().workbuddyDesktop?.savePrompt({promptGateway:{[a]:t}});Yu(c),Ve(t?r("✅ 已为「{label}」装上网关自带提示词",{label:o}):r("已关闭「{label}」的网关自带提示词:能否通过上游校验取决于上游当前口径",{label:o}),t?"ok":"err")}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await rc()}finally{as()}}async function XW(e,t){const a=ac(e);if(!a)return!1;const o=Bo(dt.prompt,a),c=!t||!(t.identity.trim()||t.stable.trim()||t.dynamic.trim());return Cp(c?r("「{label}」的网关自带提示词已改回官方原文",{label:o}):r("「{label}」的网关自带提示词正文已更新",{label:o}),{promptGatewayText:{[a]:c?null:t}})}async function QW(){if(!En){ds("prompt");try{const e=await tt().workbuddyDesktop?.savePrompt({clearDegrade:!0});Yu(e),Ve(r("✅ 已解除内容拦截降级"))}catch(e){Ve(r("解除失败:{message}",{message:_t(e)}),"err"),await rc()}finally{as()}}}function Ep(e){const t=Number(e);return Number.isFinite(t)?t:null}function TS(e){if(e===void 0)return;const t=e&&typeof e=="object"?e.database:null;if(!t||typeof t!="object"){Ze({storage:{...dt.storage,status:"unavailable"}});return}const a=t;Ze({storage:{status:"ready",available:a.available!==!1,file:String(a.file||""),bytes:Number(a.bytes)||0,accounts:Ep(a.accounts),logs:Ep(a.logs),requests:Ep(a.requests),dailyDays:Ep(a.dailyDays),debug:Ep(a.debug)}})}async function QI(){try{TS(await tt().workbuddyDesktop?.getStorage())}catch(e){console.warn("读取数据存储概况失败:",_t(e)),TS(null)}}async function ZW(){try{return await tt().workbuddyDesktop?.panelLogout(),window.location.href="/login",!0}catch(e){return Ve(r("退出失败:{message}",{message:_t(e)}),"err"),!1}}async function ES(){II(),PI(),Ze({panelLogin:DI()}),await Promise.all([_I(),tW(),Px(),qI(),KI(),BI(),UI(),Bx(),bS(),vS(),jS(),NS(),rc(),QI(),XI(),CS(),tt().wbUpdatePanel?.load?.()])}async function WW(){await Px(),Ve(r("保留天数已刷新"))}async function JW(){await qI(),Ve(r("重试设置已刷新"))}async function eJ(){await KI(),Ve(r("超时设置已刷新"))}async function tJ(){await BI(),Ve(r("排队等待设置已刷新"))}async function nJ(){await UI(),Ve(r("验证码令牌池设置已刷新"))}async function sJ(){await Bx(),Ve(r("路由设置已刷新"))}async function rJ(){await bS(),Ve(r("调试模式设置已刷新"))}async function aJ(){await vS(),Ve(r("指纹脱敏设置已刷新"))}async function lJ(){await NS(),Ve(r("网关跨域访问设置已刷新"))}async function oJ(){await rc(),Ve(r("系统提示词设置已刷新"))}async function iJ(){await QI(),Ve(r("存储概况已刷新"))}const Fx=[{key:"identity",label:r("第一段(身份句)"),short:r("第一段"),hint:r("官方原文只有一句:声明自己是 ZCode。")},{key:"stable",label:r("第二段(稳定段)"),short:r("第二段"),hint:r("工具用法与环境说明那一大段。")},{key:"dynamic",label:r("第三段(动态段)"),short:r("第三段"),hint:r("沟通方式 / 上下文管理 + Environment 段。")}];function cJ(e){return r(e==="inline"?"界面里编辑的正文":e==="file"?"提示词文件":e==="builtin"?"内置默认提示词":"(未生效)")}function ZI({title:e,text:t,source:a,file:o,disabled:c,save:d,onClose:f}){const[p,h]=x.useState(t),[b,y]=x.useState(!1),v=b||c,w=p!==t;async function j(S){y(!0);try{await d(S)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:S=>{S||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("保存后以这里的文本为准")}),s.jsxs("p",{children:[r("这一份就是「替换 / 追加」模式下网关要发的 system 正文。"),a==="none"?r("当前是透传模式:存下来也不会发出,切成「替换 / 追加」之后才生效。"):r("当前生效的正文来自{source}{file}。保存后这一份会盖过提示词文件与内置默认{note}。",{source:cJ(a),file:o.trim()&&a!=="inline"?r("(文件:{path})",{path:o.trim()}):"",note:a!=="inline"&&o.trim()?r(",文件里后续的改动在清空这里之前不再生效"):""}),r("想回到原来那份,把这里清空再保存即可(不会删掉你配的文件路径)。")]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"settings-prompt-body",children:r("提示词正文")}),s.jsx(Qc,{id:"settings-prompt-body",rows:18,className:"min-h-[320px]",spellCheck:!1,disabled:v,value:p,onChange:S=>h(S.currentTarget.value)}),s.jsx("div",{className:"hint",children:p.trim()?r("{lines} 行、{chars} 字符(按当前草稿计)",{lines:p.split(` -`).length,chars:p.length}):r("空 = 不要这一份,回落提示词文件 / 内置默认提示词。")})]})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||a!=="inline",onClick:()=>{j("")},children:r("清除这里的正文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{j(p)},children:r(b?"保存中…":"保存")})]})]})})}function uJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-prompt-edit-body",variant:"outline",disabled:t||a,onClick:()=>c(!0),children:r("编辑正文")}),o?s.jsx(ZI,{title:r("编辑提示词正文 · 全局"),text:e.text,source:e.source,file:e.file,disabled:a,save:VW,onClose:()=>c(!1)}):null]})}function dJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-edit-body-${e.id}`,variant:"outline",disabled:a||o,onClick:()=>d(!0),children:r("编辑正文")}),c?s.jsx(ZI,{title:r("编辑提示词正文 · {label}",{label:t}),text:e.text,source:e.source,file:e.file,disabled:o,save:f=>GW(e,f),onClose:()=>d(!1)}):null]})}function fJ({id:e,title:t,official:a,over:o,enabled:c,disabled:d,onClose:f}){const[p,h]=x.useState(()=>({identity:o?.identity?.trim()?o.identity:a.identity,stable:o?.stable?.trim()?o.stable:a.stable,dynamic:o?.dynamic?.trim()?o.dynamic:a.dynamic})),[b,y]=x.useState(!1),v=b||d,w=Fx.some(N=>p[N.key]!==a[N.key]),j=Fx.filter(N=>o?.[N.key]?.trim()).map(N=>N.label);async function S(N){y(!0);try{await XW(e,N)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("三段各自成块,所以分开编辑")}),s.jsxs("p",{children:[r("上游按"),s.jsx("strong",{children:r("结构")}),r("校验身份:这三段必须各自成块排在最前(实测:三段并成一段会被回 405 / 3012)。因此这里按段编辑,不能合成一段。改过的段以你的文本为准,没改的段继续用官方原文;清空某一段 = 那一段恢复官方原文。"),j.length?r("当前已改过:{edited}。",{edited:j.join(r("、"))}):r("当前三段都是官方原文。"),c?"":r("注意:这一家的「网关自带」开关现在是关的,改过的正文要等开关打开才生效。")]}),s.jsx("p",{children:$n.promptGatewayText})]}),Fx.map(N=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs(Je,{htmlFor:`settings-prompt-block-${e}-${N.key}`,children:[N.label,s.jsx("span",{className:"ml-2 font-normal text-subtle",children:p[N.key]===a[N.key]?r("(官方原文)"):r("(已改)")})]}),s.jsx(Qc,{id:`settings-prompt-block-${e}-${N.key}`,rows:N.key==="identity"?2:10,className:N.key==="identity"?"min-h-[64px]":"min-h-[200px]",spellCheck:!1,disabled:v,value:p[N.key],onChange:k=>{const T=k.currentTarget.value;h(D=>({...D,[N.key]:T}))}}),s.jsx("div",{className:"hint",children:N.hint})]},N.key))]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||!j.length,onClick:()=>{S(null)},children:r("恢复官方原文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{S(p)},children:r(b?"保存中…":"保存")})]})]})})}function pJ({item:e,option:t,over:a,locked:o,busy:c}){const[d,f]=x.useState(!1),p=t.gatewayBlocks;return p?s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-gateway-text-${e.id}`,variant:"outline",disabled:o||c,onClick:()=>f(!0),children:r("编辑正文")}),d?s.jsx(fJ,{id:e.id,title:r("编辑网关自带提示词 · {label}",{label:t.label}),official:p,over:a,enabled:e.gateway,disabled:c,onClose:()=>f(!1)}):null]}):null}function mJ(e){return e?Fx.filter(t=>(e[t.key]||"").trim()).map(t=>t.short).join(r("、")):""}function WI(e,t){return tt().wbIcons?.icon?.(e,t)||""}function cn({tone:e,children:t}){const a=e==="ok"?"success":e==="bad"?"destructive":"outline";return s.jsx(ze,{variant:a,children:t})}function Qn({title:e,tip:t,badge:a,actions:o}){return s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]})}function hJ({title:e,tip:t,badge:a,actions:o,children:c}){function d(f){f.target.closest(".tip-q, .head-actions")&&f.preventDefault()}return s.jsxs("details",{className:"panel panel-fold",children:[s.jsxs("summary",{className:"panel-head",onClick:d,children:[s.jsx("span",{className:"fold-caret","aria-hidden":!0,dangerouslySetInnerHTML:{__html:WI("caretRight",14)}}),s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]}),c]})}function da({id:e,label:t,checked:a,disabled:o,tip:c,onCheckedChange:d}){return s.jsxs("label",{className:"switch",children:[s.jsx(hs,{id:e,checked:a,disabled:o,onCheckedChange:f=>d(f)}),s.jsx("span",{children:t}),c?s.jsx("span",{className:"tip-q","data-tip":c}):null]})}function Ap({field:e,value:t,disabled:a,onCommit:o}){const[c,d]=x.useState(null),f=c!==null?c:t===null?"":String(t);async function p(){const h=c;if(h!==null)try{await o(h)}finally{d(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:e.id,children:e.label}),s.jsxs("span",{className:"retention-input",children:[s.jsx($e,{id:e.id,type:"number",min:e.min,max:e.max,step:1,inputMode:"numeric",className:"w-[92px] max-w-[92px] text-center tabular-nums",value:f,disabled:a||t===null,onChange:h=>d(h.target.value),onFocus:()=>d(String(t??"")),onBlur:()=>{p()},onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}}),s.jsx("span",{className:"unit",children:e.unit})]}),s.jsx("div",{className:"hint",children:e.hint})]})}function Rp(e){return e.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}function Br({id:e,onClick:t}){return s.jsx(se,{id:e,variant:"outline",onClick:t,children:r("刷新")})}function gJ(e){const{lanAccess:t,lanPanel:a,lanIp:o,port:c}=e.app;if(!t)return r("未开启:网关只监听 127.0.0.1,仅本机可以访问。");const d=`http://${o||r("<本机IP>")}${c?`:${c}`:""}`,f=a?r(";网页管理面板已一并开放(浏览器打开同一地址)"):"";return r("已开启:其他设备把 API 地址指向 {url}{panel}。",{url:`${d}/v1`,panel:f})}function xJ({snap:e}){const t=e.app,a=t.status==="unavailable"?Ut.appUnavailable:t.status==="loading"?Ut.appLoading:t.closeToTray?t.lightweightMode?Ut.appLightOn:Ut.appTrayOn:Ut.appTrayOff;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("启动与托盘"),tip:rs.tray,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已应用")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-close-to-tray",label:r("关闭窗口时最小化到托盘"),checked:t.closeToTray,disabled:e.busy==="app",onCheckedChange:o=>{pS("tray",o)}}),s.jsx(da,{id:"settings-lightweight",label:r("轻量模式(关窗释放界面内存)"),tip:rs.lightweight,checked:t.lightweightMode,disabled:e.busy==="app"||!t.closeToTray,onCheckedChange:o=>{pS("lightweight",o)}}),s.jsx(da,{id:"settings-autostart",label:r("开机自动启动"),checked:t.autostart,disabled:e.busy==="app",onCheckedChange:o=>{pS("autostart",o)}})]}),s.jsx("div",{className:"settings-state",children:a})]})]}),!e.panelLogin&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("局域网访问"),tip:rs.lan}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-lan-access",label:r("允许局域网内的设备访问网关"),checked:e.app.lanAccess,disabled:e.busy==="lan",onCheckedChange:nW}),s.jsx(da,{id:"settings-lan-panel",label:r("同时开放网页管理面板"),checked:e.app.lanPanel,disabled:e.busy==="lan"||!e.app.lanAccess,onCheckedChange:sW})]}),s.jsx("div",{className:"settings-state",children:gJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("计量单位"),tip:rs.units}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-chinese-units",label:r("使用中文单位(亿 / 万)"),checked:e.unitsChinese,onCheckedChange:eW})}),s.jsx("div",{className:"settings-state",children:e.unitsChinese?Ut.unitsOn:Ut.unitsOff})]})]})]})}function bJ(e){return e==="light"?Ut.themeLight:e==="dark"?Ut.themeDark:Ut.themeSystem}function vJ(){const[e,t]=x.useState(qZ),[a,o]=x.useState(GZ),c=tt().workbuddyDesktop?.platform==="web";x.useEffect(()=>{const f=h=>t(String(h.detail||"system")),p=h=>o(Number(h.detail)||100);return window.addEventListener(wI,f),window.addEventListener(jI,p),()=>{window.removeEventListener(wI,f),window.removeEventListener(jI,p)}},[]);const d=a===100?r("100%(默认)"):`${a}%`;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("显示模式"),tip:rs.displayTheme}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{children:s.jsx(In,{"aria-label":r("显示模式"),options:$Z,value:e,onValueChange:f=>tt().wbApp?.applyTheme?.(f)})}),s.jsx("div",{className:"settings-state",children:bJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("界面缩放"),tip:rs.displayZoom}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-zoom",children:r("缩放比例")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:String(a),onValueChange:f=>tt().wbApp?.applyZoom?.(Number(f)),children:[s.jsx(mt,{id:"settings-zoom",className:"w-[140px]",disabled:c,"aria-label":r("界面缩放比例"),children:s.jsx(pt,{children:d})}),s.jsx(ht,{children:FZ.map(f=>s.jsx(qe,{value:String(f),children:f===100?r("100%(默认)"):`${f}%`},f))})]})}),s.jsx("div",{className:"hint",children:r("放大或缩小整个界面(文字与控件一起变),效果与浏览器 Ctrl +/- 相同:共 11 档,立即生效并记住。")})]})}),s.jsx("div",{className:"settings-state",children:c?Ut.zoomWeb:a===100?Ut.zoomDefault:r("当前按 {n}% 显示。",{n:a})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("语言设置"),tip:rs.displayLanguage}),s.jsxs("div",{className:"panel-body",children:[s.jsx(yJ,{}),s.jsx("div",{className:"settings-state",children:Ut.languageHint})]})]})]})}function yJ(){const e=window.wbI18n,t=e?.rawLocale?.()??"auto",a=e?.LOCALES??[],o=c=>c==="auto"?r("跟随系统"):a.find(d=>d.code===c)?.label??c;return s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-language",children:r("界面语言")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t,onValueChange:c=>{c&&e?.setLocale(c)},children:[s.jsx(mt,{id:"settings-language",className:"w-[200px]","aria-label":r("界面语言"),children:s.jsx(pt,{children:o(t)})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"auto",children:r("跟随系统")}),a.map(c=>s.jsx(qe,{value:c.code,children:c.label},c.code))]})]})})]})})}function wJ({codes:e,status:t,busy:a}){const[o,c]=x.useState(""),d=x.useRef(null),f=t==="unavailable";return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-retry-no-codes-input",children:r("指定错误码直接换号")}),s.jsx("div",{className:"retention-input",children:s.jsxs("div",{className:f?"tag-input disabled":"tag-input",onClick:()=>d.current?.focus(),children:[(e||[]).map(p=>s.jsxs("span",{className:"tag-chip",children:[s.jsx("span",{className:"v",children:p}),s.jsx(se,{type:"button",variant:"ghost",size:"icon-2xs",className:"tag-x text-muted-foreground hover:bg-destructive-soft hover:text-destructive",title:r("删除 {code}",{code:p}),"aria-label":r("删除状态码 {code}",{code:p}),onClick:h=>{h.stopPropagation(),kW(p)},children:"✕"})]},p)),s.jsx($e,{ref:d,id:"settings-retry-no-codes-input",type:"text",className:"tag-input-field h-auto border-0 bg-transparent px-0 shadow-none focus:shadow-none",placeholder:f?"—":r("输入状态码,回车添加"),inputMode:"numeric",autoComplete:"off",value:o,disabled:f||a,onChange:p=>c(p.target.value),onKeyDown:p=>{if(p.key==="Enter"){p.preventDefault(),NW(o),c("");return}p.key==="Backspace"&&!o&&CW()}})]})}),s.jsx("div",{className:"hint",children:$n.retryCodes})]})}function jJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(null);async function d(){const f=o;if(f!==null)try{await UW(f)}finally{c(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-file",children:r("提示词文件")}),s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:"settings-prompt-file",type:"text",placeholder:r("留空 = 用内置默认提示词"),value:o!==null?o:e.file,disabled:t||a,onChange:f=>c(f.target.value),onFocus:()=>c(e.file),onBlur:()=>{d()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()}})}),s.jsx("div",{className:"hint",children:$n.promptFile})]})}function SJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.promptUnavailable;const t=JI(e.source),a=[];return e.mode==="passthrough"?a.push(r("客户端 system 原样出站(只靠指纹脱敏改写模板句)。")):a.push(r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:t,lines:e.lines?r("({n} 行)",{n:e.lines}):""})),e.fileError&&a.push(`⚠️ ${e.fileError}`),a.join("")}function JI(e){return e==="inline"?r("界面里编辑的正文"):e==="file"?r("提示词文件"):e==="builtin"?r("内置默认提示词"):""}function NJ(e){return r("已自动切换到最小中性提示词(撞了上游内容拦截,多半是 system 指纹误报),到 {until} 自动解除。",{until:e.degradeUntilText||Ut.degradeUntilFallback})+r("期间本模式自己的提示词不会发出;把提示词改好后可以立即解除。")}function kJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(null);async function f(){const p=c;if(p!==null)try{p!==e.file&&await qW(e,p)}finally{d(null)}}return s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:`settings-prompt-file-${e.id}`,type:"text",placeholder:r("留空 = 用内置默认提示词"),"aria-label":r("{label} 提示词文件",{label:t}),value:c!==null?c:e.file,disabled:a||o,onChange:p=>d(p.target.value),onFocus:()=>d(e.file),onBlur:()=>{f()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})})}function CJ(e,t){if(!t)return r("未单独配置:模式、提示词文件与正文都跟随上面的全局配置(当前「{mode}」)。",{mode:zo.find(o=>o.value===e.mode)?.toastLabel??e.mode});if(e.mode==="passthrough")return r("客户端 system 原样出站。");const a=r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:JI(e.source),lines:e.lines?r("({n} 行)",{n:e.lines}):""});return e.fileError?`${a} ⚠️ ${e.fileError}`:a}function TJ({item:e,option:t,over:a,locked:o,busy:c}){const d=e.gateway,f=t.gatewayChars,p=f?r("约 {n} 字符",{n:f.toLocaleString("zh-CN")}):r("一段内置装配"),h=mJ(a);return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{className:"prompt-gateway-label",children:r("网关自带")}),s.jsxs("span",{className:"prompt-input",children:[s.jsx(da,{id:`settings-prompt-gateway-${e.id}`,label:r("装上{size}的官方身份提示词",{size:p}),checked:d,disabled:o||c,onCheckedChange:b=>{YW(e.id,b)}}),s.jsx(pJ,{item:e,option:t,over:a,locked:o,busy:c})]}),s.jsxs("div",{className:d?"hint":"hint prompt-gateway-off",children:[d?t.gatewayNote:r("已关闭。{note}",{note:t.gatewayNote}),h?r(" 正文已改:{edited}(其余段用官方原文)。",{edited:h}):""]})]})}function EJ({prompt:e,locked:t,busy:a}){const o=e.options,c=new Map(e.providers.map(j=>[j.id,j])),d=[];for(const j of o)j.gatewayNote&&d.push(c.get(j.id)??{id:j.id,mode:e.mode,file:e.file,text:e.text,source:e.source,lines:e.lines,fileError:e.fileError,gateway:e.gateway[j.id]??!0,configured:!1});for(const j of e.providers)d.some(S=>S.id===j.id)||d.push({...j,gateway:e.gateway[j.id]??!0,configured:!0});const f=new Set(d.map(j=>j.id)),p=o.filter(j=>!j.gatewayNote&&!f.has(j.id)),[h,b]=x.useState(""),y=j=>o.find(S=>S.id===j)?.label||j,v=j=>o.find(S=>S.id===j),w=j=>v(j)?.gatewayNote||"";return s.jsxs(s.Fragment,{children:[d.map(j=>{const S=y(j.id),N=zo.find(D=>D.value===j.mode)?.optionLabel??j.mode,k=w(j.id),T=v(j.id);return s.jsxs(x.Fragment,{children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:`settings-prompt-mode-${j.id}`,children:S}),s.jsxs("span",{className:"prompt-input",children:[s.jsxs(ft,{value:j.mode,onValueChange:D=>{D!=null&&String(D)&&$W(j,String(D))},children:[s.jsx(mt,{id:`settings-prompt-mode-${j.id}`,className:"w-[240px]",disabled:t||a,"aria-label":r("{label} 的提示词模式",{label:S}),children:s.jsx(pt,{children:N})}),s.jsx(ht,{children:zo.map(D=>s.jsx(qe,{value:D.value,children:D.optionLabel},D.value))})]}),s.jsx(kJ,{item:j,label:S,locked:t,busy:a}),s.jsx(dJ,{item:j,label:S,locked:t,busy:a}),j.configured?s.jsx(se,{variant:"outline",disabled:t||a,onClick:()=>{KW(j.id)},children:r("跟随默认")}):null]}),s.jsx("div",{className:"hint",children:CJ(j,j.configured)})]}),T&&k?s.jsx(TJ,{item:j,option:T,over:e.gatewayText[j.id],locked:t,busy:a}):null]},j.id)}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-provider-add",children:r("添加提供商")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:h,onValueChange:j=>{b("");const S=j==null?"":String(j);S&&FW(S)},children:[s.jsx(mt,{id:"settings-prompt-provider-add",className:"w-[240px]",disabled:t||a||p.length===0,"aria-label":r("添加要单独配置的提供商"),children:s.jsx(pt,{children:h?y(h):p.length?r("添加提供商…"):r("全部已配置")})}),s.jsx(ht,{children:p.map(j=>s.jsx(qe,{value:j.id,children:j.label},j.id))})]})}),s.jsx("div",{className:"hint",children:$n.promptProviders})]})]})}function AJ({snap:e}){const t=e.prompt,a=t.status!=="ready",o=e.busy==="prompt",c=zo.find(d=>d.value===t.mode)?.optionLabel??t.mode;return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("系统提示词"),tip:rs.prompt,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:t.mode==="passthrough"?r("透传"):r("已接管")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-prompt-refresh",onClick:()=>{oJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"prompt-group",children:[r("全局配置"),s.jsx("span",{className:"note",children:r("所有未单独配置的提供商都用这一份")})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-mode",children:r("模式")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t.mode,onValueChange:d=>{d!=null&&String(d)&&HW(String(d))},children:[s.jsx(mt,{id:"settings-prompt-mode",className:"w-[240px]",disabled:a||o,"aria-label":r("系统提示词模式"),children:s.jsx(pt,{children:c})}),s.jsx(ht,{children:zo.map(d=>s.jsx(qe,{value:d.value,children:d.optionLabel},d.value))})]})}),s.jsx("div",{className:"hint",children:$n.promptMode})]}),s.jsx(jJ,{prompt:t,locked:a,busy:o}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"btn-prompt-edit-body",children:r("提示词正文")}),s.jsx("span",{className:"prompt-input",children:s.jsx(uJ,{prompt:t,locked:a,busy:o})}),s.jsxs("div",{className:"hint",children:[$n.promptText,t.source==="inline"?r("(当前生效的就是这一份,{n} 行)",{n:t.lines}):t.text.trim()?r("(已存一份正文,{n} 行;切成「替换 / 追加」后生效)",{n:t.lines}):""]})]}),s.jsxs("div",{className:"prompt-group",children:[r("按提供商配置"),s.jsx("span",{className:"note",children:r("只列单独配置过的家,其余沿用上面的全局配置")})]}),s.jsx(EJ,{prompt:t,locked:a,busy:o}),t.status==="ready"&&t.degradeActive?s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("内容拦截降级")}),s.jsx("span",{className:"prompt-input",children:s.jsx(se,{id:"btn-prompt-clear-degrade",variant:"outline",disabled:o,onClick:()=>{QW()},children:r("立即解除")})}),s.jsx("div",{className:"hint",children:NJ(t)})]}):null]}),s.jsx("div",{className:"settings-state",children:SJ(t)}),s.jsx("div",{className:"hint retention-note",children:$n.prompt})]})]})}function RJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.debugUnavailable;const t=e.count!==null&&e.limit!==null?r("已保存 {count} / {limit} 条报文(超出后丢弃最旧的)。",{count:e.count,limit:e.limit}):"";return e.on?`${Ut.debugOn}${t}${r("凭据类请求头已脱敏。")}`:Ut.debugOff}function OJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求超时"),tip:rs.timeouts,badge:Rp(e.timeouts),actions:s.jsx(Br,{id:"btn-timeouts-refresh",onClick:()=>{eJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:kI.map(t=>s.jsx(Ap,{field:t,value:e.timeouts.values?.[t.key]??null,disabled:e.busy==="timeouts",onCommit:a=>TW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.timeouts})]})]})}function MJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求重试"),tip:rs.retry,badge:Rp(e.retry),actions:s.jsx(Br,{id:"btn-retry-refresh",onClick:()=>{JW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[NI.map(t=>s.jsx(Ap,{field:t,value:e.retry.values?.[t.key]??null,disabled:e.busy==="retry",onCommit:a=>SW(t,a)},t.key)),s.jsx(wJ,{codes:e.retryCodes,status:e.retry.status,busy:e.busy==="codes"||e.busy==="retry"})]}),s.jsx("div",{className:"hint retention-note",children:$n.retry})]})]})}const DJ={routingFailoverBackoff:"failoverBackoff",routingSink:"sink",routingBreakerEnabled:"breakerEnabled"};function IJ({snap:e}){const t=e.routing,a=e.busy==="routing"||t.status!=="ready",o=Ox.find(d=>d.value===t.strategy)?.value??"order",c=Mx.find(d=>d.value===t.sticky)?.value??"auto";return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号路由"),tip:rs.routing,badge:t.status==="ready"?void 0:t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-routing-refresh",onClick:()=>{sJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsx("div",{className:"prompt-group",children:r("选路规则")}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("路由策略")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Ox.find(d=>d.value===o)?.tip}),s.jsx(In,{options:Ox.map(d=>({value:d.value,label:d.label})),value:o,disabled:a,"aria-label":r("路由策略"),onValueChange:d=>{gS({routingStrategy:String(d)})}})]})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("会话粘性")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Mx.find(d=>d.value===c)?.tip}),s.jsx(In,{options:Mx.map(d=>({value:d.value,label:d.label})),value:c,disabled:a,"aria-label":r("会话粘性"),onValueChange:d=>{gS({routingSticky:String(d)})}})]})]}),s.jsxs("div",{className:"prompt-group",children:[r("自愈保护"),s.jsx("span",{className:"note",children:r("默认值通常够用,出问题时才需要调")})]}),XZ.map(d=>{const f=`route-protection-${d.key}`;return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:f,children:d.label}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":d.tip}),s.jsx(hs,{id:f,checked:t[DJ[d.key]],disabled:a,onCheckedChange:p=>{gS({[d.key]:p})}})]})]},d.key)})]}),s.jsx("div",{className:"hint retention-note",children:$n.routing})]})]})}function PJ({snap:e}){return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("排队等待"),tip:rs.queue,badge:Rp(e.queue),actions:s.jsx(Br,{id:"btn-queue-refresh",onClick:()=>{tJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:CI.map(t=>s.jsx(Ap,{field:t,value:e.queue.values?.[t.key]??null,disabled:e.busy==="queue",onCommit:a=>gW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.queue})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("验证码令牌池"),tip:rs.captchaPool,badge:Rp(e.captchaPool),actions:s.jsx(Br,{id:"btn-captcha-pool-refresh",onClick:()=>{nJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:MI.map(t=>s.jsx(Ap,{field:t,value:e.captchaPool.values?.[t.key]??null,disabled:e.busy==="captchaPool",onCommit:a=>xW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.captchaPool})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("models.dev 模型元数据"),tip:rs.modelsDev,badge:e.modelsDev.status==="ready"?s.jsx(cn,{tone:"ok",children:r("{count} 条",{count:Number(e.modelsDev.count).toLocaleString("zh-CN")})}):e.modelsDev.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-modelsdev-refresh",onClick:()=>{IW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-modelsdev",label:r("用 models.dev 补齐上游没声明的模型能力与思考档位(联网刷新,内嵌快照始终生效)"),checked:e.modelsDev.enabled,disabled:e.modelsDev.status!=="ready"||e.busy==="modelsDev",onCheckedChange:t=>{DW(t)}}),s.jsx("div",{className:"settings-state",children:BZ(e.modelsDev)}),s.jsx("div",{className:"hint retention-note",children:$n.modelsDev})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("指纹脱敏"),tip:rs.sanitize,badge:e.sanitize.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.sanitize.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-sanitize-refresh",onClick:()=>{aJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-sanitize",label:r("剥离上游审核黑名单指纹(改写请求体里的模板句与表头)"),checked:e.sanitize.on,disabled:e.sanitize.status!=="ready"||e.busy==="sanitize",onCheckedChange:t=>{AW(t)}})}),s.jsx("div",{className:"settings-state",children:e.sanitize.status==="loading"?Ut.appLoading:e.sanitize.status==="unavailable"?Ut.sanitizeUnavailable:e.sanitize.on?Ut.sanitizeOn:Ut.sanitizeOff}),s.jsx("div",{className:"hint retention-note",children:$n.sanitize})]})]}),s.jsx(LJ,{snap:e}),s.jsx(AJ,{snap:e}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("调试模式"),tip:rs.debug,badge:e.debug.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.debug.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-debug-refresh",onClick:()=>{rJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-debug-mode",label:r("保存上游原始报文(请求头、请求体、响应头、响应体)"),checked:e.debug.on,disabled:e.debug.status!=="ready"||e.busy==="debug",onCheckedChange:t=>{EW(t)}})}),s.jsx("div",{className:"settings-state",children:RJ(e.debug)}),s.jsx("div",{className:"hint retention-note",children:$n.debug})]})]})]})}function eP(e){const t=Object.entries(e.defaults).map(([a,o])=>({key:a,value:a in e.overrides?e.overrides[a]:o,isDefault:!0}));for(const[a,o]of Object.entries(e.overrides))a in e.defaults||t.push({key:a,value:o,isDefault:!1});return t}function _J(e,t){const a=Object.keys(e);return a.length!==Object.keys(t).length?!1:a.every(o=>e[o]===t[o])}function LJ({snap:e}){const t=e.clineHeaders,[a,o]=x.useState(()=>eP(t));x.useEffect(()=>{o(eP(t))},[t]);const c=e.busy==="clineHeaders",d=t.status==="ready";function f(b,y){o(v=>v.map((w,j)=>j===b?{...w,...y}:w))}function p(){const b={};for(const y of a){const v=y.key.trim();v&&(y.isDefault?y.value!==(t.defaults[v]??"")&&(b[v]=y.value):y.value!==""&&(b[v]=y.value))}return b}const h=d&&!_J(p(),t.overrides);return s.jsx(hJ,{title:r("Cline 伪装头"),tip:rs.clineHeaders,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cline-headers-refresh",onClick:()=>{RW()}}),children:s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[d?a.map((b,y)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-[190px] shrink-0 font-mono text-[13px]",value:b.key,readOnly:b.isDefault,disabled:c,placeholder:"X-Custom-Header",onChange:v=>f(y,{key:v.target.value})}),s.jsx($e,{className:"flex-1 font-mono text-[13px]",value:b.value,disabled:c,placeholder:b.isDefault?r("值(留空 = 不发送)"):r("值"),onChange:v=>f(y,{value:v.target.value})}),s.jsx(se,{variant:"ghost",disabled:c,onClick:()=>{b.isDefault?f(y,{value:t.defaults[b.key]??""}):o(v=>v.filter((w,j)=>j!==y))},children:b.isDefault?r("还原"):r("删除")})]},String(y))):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:"outline",disabled:c||!d,onClick:()=>o(b=>[...b,{key:"",value:"",isDefault:!1}]),children:r("添加自定义头")}),s.jsx("div",{className:"flex-1"}),s.jsx(se,{variant:"ghost",disabled:c||!d||Object.keys(t.overrides).length===0,onClick:()=>{YI({})},children:r("恢复默认")}),s.jsx(se,{disabled:c||!d||!h,onClick:()=>{YI(p())},children:r("保存")})]})]}),s.jsx("div",{className:"settings-state",children:t.status==="loading"?Ut.appLoading:t.status==="unavailable"?r("未能读取 Cline 伪装头设置,请稍后重试"):h?r("有未保存的修改"):r("{n} 个头将随每个 Cline 请求发送",{n:Object.keys(t.effective).length})+(Object.keys(t.overrides).length>0?r("({n} 项被覆盖)",{n:Object.keys(t.overrides).length}):r("(全部为默认值)"))}),s.jsx("div",{className:"hint retention-note",children:$n.clineHeaders})]})})}function zJ({snap:e}){const[t,a]=x.useState(!1);async function o(){a(!0),await ZW()||a(!1)}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("网关跨域访问(CORS)"),tip:rs.cors,badge:e.cors.status==="ready"?e.cors.on?s.jsx(cn,{tone:"bad",children:r("已开启")}):s.jsx(cn,{tone:"ok",children:r("已关闭")}):e.cors.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cors-refresh",onClick:()=>{lJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-cors",label:r("允许浏览器里的页面跨来源调用网关(/v1/*)"),checked:e.cors.on,disabled:e.cors.status!=="ready"||e.busy==="cors",onCheckedChange:c=>{OW(c)}})}),s.jsx("div",{className:"settings-state",children:e.cors.status==="loading"?Ut.appLoading:e.cors.status==="unavailable"?Ut.corsUnavailable:e.cors.on?Ut.corsOn:Ut.corsOff}),s.jsx("div",{className:"hint retention-note",children:$n.cors})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("机器人校验")}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-captcha",label:r("登录 / 注册需要通过 ALTCHA 人机验证(工作量证明)"),checked:e.captcha.enabled,disabled:!e.captcha.available||e.busy==="captcha",onCheckedChange:c=>{MW(c)}}),s.jsx("div",{className:"hint",children:$n.captcha})]})]}),e.panelLogin?s.jsxs("section",{className:"panel",id:"panel-login-section",children:[s.jsx(Qn,{title:r("面板登录")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:$n.panelLogin}),s.jsx("div",{className:"mt-2.5",children:s.jsx(se,{id:"btn-panel-logout",variant:"outline",disabled:t,onClick:()=>{o()},children:r("退出登录")})})]})]}):null]})}function Op({label:e,value:t}){return s.jsxs("div",{className:"storage-count",children:[s.jsx("span",{className:"k",children:e}),s.jsx("span",{className:"v",children:t})]})}function BJ(e){return e.status==="loading"?s.jsx(cn,{tone:"idle",children:r("检测中…")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:e.available?"ok":"bad",children:e.available?r("已生效"):r("数据库不可用")})}function HJ({snap:e}){const t=e.busy,a=e.storage,o=tt().workbuddyDesktop?.platform==="web",c=a.status==="ready",d=c&&a.available,f=c&&a.file?a.file:"—",p=h=>d&&h!==null?YZ(h):"—";return s.jsxs(s.Fragment,{children:[!o&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("整库备份 / 恢复"),tip:rs.backup,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-db-export",variant:"outline",disabled:t==="dbExport"||t==="dbImport",onClick:()=>{cW()},children:r(t==="dbExport"?"备份中…":"备份整库")}),s.jsx(se,{id:"btn-settings-db-restore",variant:"destructive",disabled:t==="dbExport"||t==="dbImport",onClick:()=>uW(),children:r(t==="dbImport"?"恢复中…":"恢复整库")})]})}),s.jsxs("div",{className:"panel-body",children:[e.dbWarning?s.jsxs("div",{className:"danger-zone",id:"settings-db-warning",children:[s.jsx("strong",{children:r("⚠️ 密钥警告")}),s.jsx("br",{}),e.dbWarning]}):null,s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-db-include-logs",children:r("包含日志与调试报文")}),s.jsx(hs,{id:"settings-db-include-logs",checked:e.dbIncludeLogs,disabled:t!==null,onCheckedChange:iW}),s.jsx("div",{className:"hint",children:r("取消勾选后只备份业务数据(账号、配置与余额记录),文件显著变小;事件日志、请求统计与调试报文不会进备份文件。")})]}),s.jsx("div",{className:"danger-zone",children:s.jsx("strong",{children:$n.backupDanger})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号导入 / 导出"),tip:rs.io,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-export",variant:"outline",disabled:t==="export",onClick:()=>{lW()},children:r(t==="export"?"导出中…":"导出账号")}),s.jsx(se,{id:"btn-settings-import",variant:"default",disabled:t==="import",onClick:()=>{oW()},children:r(t==="import"?"导入中…":"导入账号")})]})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"danger-zone",children:[s.jsx("strong",{children:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义")}),r(",可直接用于登录。请妥善保管,不要外传或上传到公共位置。")]}),e.ioFailure?s.jsx("div",{className:"io-result",children:s.jsxs("span",{className:"text-destructive",children:[r("失败 {n} 个:{detail}",{n:e.ioFailure.failed,detail:e.ioFailure.detail}),e.ioFailure.more?r(" 等"):""]})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据保留"),tip:rs.retention,badge:Rp(e.retention),actions:s.jsx(Br,{id:"btn-retention-refresh",onClick:()=>{WW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:oS.map(h=>s.jsx(Ap,{field:h,value:e.retention.values?.[h.key]??null,disabled:e.busy==="retention",onCommit:b=>mW(h,b)},h.key))}),s.jsx("div",{className:"hint retention-note",children:$n.retention})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据存储"),tip:rs.storage,badge:BJ(a),actions:s.jsx(Br,{id:"btn-storage-refresh",onClick:()=>{iJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-path",children:r("数据库文件")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-path",title:f,children:f})}),s.jsx("div",{className:"hint",children:$n.storageFile})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-size",children:r("占用大小")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-size",children:d?OI(a.bytes):"—"})}),s.jsx("div",{className:"hint",children:$n.storageSize})]})]}),s.jsxs("div",{className:"retention-list storage-counts",children:[s.jsx(Op,{label:r("账号"),value:p(a.accounts)}),s.jsx(Op,{label:r("事件日志"),value:p(a.logs)}),s.jsx(Op,{label:r("请求记录"),value:p(a.requests)}),s.jsx(Op,{label:r("报表天数"),value:p(a.dailyDays)}),s.jsx(Op,{label:r("调试报文"),value:p(a.debug)})]}),s.jsx("div",{className:"hint retention-note",children:$n.storage})]})]})]})}const UJ=[{title:r("问题反馈"),desc:r("遇到 Bug、报错或异常行为"),cta:r("去反馈"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=bug_report.yml"},{title:r("功能建议"),desc:r("想要的新功能或改进想法"),cta:r("提建议"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=feature_request.yml"},{title:r("请求提供商 / 模型支持"),desc:r("希望接入新的提供商或模型"),cta:r("去申请"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=provider_request.yml"}];function VJ(){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("反馈与需求")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:r("点下面的入口会用系统默认浏览器打开 GitHub 的对应表单(需要 GitHub 账号,模板已预设好,填完直接提交即可)。")}),s.jsx("div",{className:"mt-3 flex flex-col gap-2",children:UJ.map(e=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-hairline bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12.5px] text-foreground",children:e.title}),s.jsx("div",{className:"mt-0.5 text-[12px] text-subtle",children:e.desc})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{HZ(e.url)},children:e.cta})]},e.url))})]})]})}function FJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||Lx(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("确认缩短保留天数")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[e?.head,s.jsx("br",{}),s.jsx("strong",{children:r("超出的历史数据会被立即删除,且不可恢复。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>Lx(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>Lx(!0),children:r("继续并清理")})]})]})})}const AS={enable:{title:r("开启局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("为了安全,开启前需要先注册一个"),s.jsx("b",{children:r("面板管理员账号")}),r("(已注册过会跳过这一步,直接生效)。"),s.jsx("br",{}),r("开启后网关将监听所有网卡,同一局域网内的设备即可把 API 地址指向本机 IP 一起使用;管理接口从此要求管理员会话或网关 Key,转发接口在没有一把启用的 Key 时也会拒绝服务(届时会自动创建一把名为「默认」的 Key)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("继续")},disable:{title:r("关闭局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("关闭后网关回到只监听 127.0.0.1,局域网内的设备将无法继续访问;已配置的网关 Key 与账号都不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("关闭并重启")},panel:{title:r("变更网页管理面板"),body:e=>e?s.jsxs(s.Fragment,{children:[r("开放后,局域网内其他设备的浏览器打开本机 IP 即可进入管理面板(需管理员账号登录)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}):s.jsxs(s.Fragment,{children:[r("关闭后,管理界面不再从局域网提供,只有本机的桌面程序可以管理;已开启的 API 转发不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("保存并重启")}};function $J({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||hS(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("恢复整库备份")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[r("本机的全部数据(账号、网关配置、日志统计与桌面设置)将被所选备份文件"),s.jsx("strong",{children:r("整体替换")}),r(",包括恢复后需要重新登录管理面板。"),s.jsx("br",{}),s.jsx("strong",{children:r("替换前会自动把当前数据备份到配置目录的 backups/ 文件夹。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>hS(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>hS(!0),children:r("选择备份文件并恢复")})]})]})})}function qJ({confirm:e,register:t}){const a=x.useRef(null),o=x.useRef(null),c=x.useRef(null),d=e!==null||t!==null,f=()=>{t!==null?LI():mS(!1)},p=()=>{aW(o.current?.value??"",c.current?.value??"")};return s.jsx(Qt,{open:d,onOpenChange:h=>{h||f()},children:s.jsx(Zt,{className:"w-[min(480px,calc(100vw-48px))]",initialFocus:a,children:t!==null?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("注册管理员账号")})}),s.jsxs(Bt,{children:[s.jsx("div",{children:r("局域网开放后,管理接口要求登录。请设置管理员账号与密码,注册完成会直接继续开启流程。")}),s.jsxs("form",{onSubmit:h=>{h.preventDefault(),t.busy||p()},children:[s.jsx(Je,{htmlFor:"lan-admin-name",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("账号")}),s.jsx($e,{ref:o,id:"lan-admin-name",autoComplete:"username",placeholder:r("管理员账号"),disabled:t.busy}),s.jsx(Je,{htmlFor:"lan-admin-password",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("密码")}),s.jsx($e,{ref:c,id:"lan-admin-password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位"),disabled:t.busy})]}),s.jsx("div",{className:"mt-3 min-h-5 text-[13px] whitespace-pre-wrap text-destructive",children:t.error})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:LI,disabled:t.busy,children:r("取消")}),s.jsx(se,{onClick:p,disabled:t.busy,children:t.busy?r("正在注册…"):r("注册并开启")})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e?AS[e.mode].title:""})}),s.jsx(Bt,{children:s.jsx("div",{children:e?AS[e.mode].body(e.panel):null})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:()=>mS(!1),children:r("取消")}),s.jsx(se,{onClick:()=>mS(!0),children:e?AS[e.mode].label:r("继续")})]})]})})})}function GJ(){const e=WZ(),t=x.useRef(null);x.useEffect(()=>{const o=t.current;o&&(o.scrollTop=0)},[e.scrollReset]);const a=o=>e.category===o?"settings-pane active":"settings-pane";return s.jsxs("div",{className:"settings-layout",children:[s.jsx("nav",{className:"settings-nav",id:"settings-nav",children:Ax.map(o=>s.jsxs("button",{type:"button",className:e.category===o.id?"settings-nav-item active":"settings-nav-item","data-cat":o.id,onClick:()=>JZ(o.id),children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:WI(o.icon,17)}}),o.label]},o.id))}),s.jsxs("div",{className:"settings-panes",ref:t,children:[s.jsx("div",{className:a("general"),"data-cat":"general",children:s.jsx(xJ,{snap:e})}),s.jsx("div",{className:a("display"),"data-cat":"display",children:s.jsx(vJ,{})}),s.jsx("div",{className:a("gateway"),"data-cat":"gateway",children:s.jsx(PJ,{snap:e})}),s.jsx("div",{className:a("routing"),"data-cat":"routing",children:s.jsx(IJ,{snap:e})}),s.jsx("div",{className:a("retry"),"data-cat":"retry",children:s.jsx(MJ,{snap:e})}),s.jsx("div",{className:a("timeout"),"data-cat":"timeout",children:s.jsx(OJ,{snap:e})}),s.jsx("div",{className:a("security"),"data-cat":"security",children:s.jsx(zJ,{snap:e})}),s.jsx("div",{className:a("data"),"data-cat":"data",children:s.jsx(HJ,{snap:e})}),s.jsx("div",{className:a("feedback"),"data-cat":"feedback",children:s.jsx(VJ,{})}),s.jsx("div",{className:a("about"),"data-cat":"about"})]}),s.jsx(FJ,{confirm:e.retentionConfirm}),s.jsx($J,{confirm:e.dbBackupConfirm}),s.jsx(qJ,{confirm:e.lanConfirm,register:e.lanRegister})]})}const tP='.page[data-page="settings"]';let RS=null;function nP(){if(RS)return;const e=document.querySelector(tP);e&&(e.replaceChildren(),RS=vn.createRoot(e),Cs.flushSync(()=>{RS?.render(s.jsx(GJ,{}))}))}II(),document.querySelector(tP)?nP():document.addEventListener("DOMContentLoaded",nP,{once:!0}),window.wbSettingsPanel={load:ES,render:fS,renderRetention:Ix,renderRetry:jW,renderDebug:Hx,renderSanitize:Ux,renderPrompt:Yu,renderStorage:TS,showCategory:dS},tt().wbApp?.currentPage==="settings"&&ES();const sP="agent2api-col-config:",OS=[{value:"left",label:r("左")},{value:"center",label:r("中")},{value:"right",label:r("右")}],KJ=e=>OS.some(t=>t.value===e),YJ=OS.map(e=>`ta-${e.value}`),rP="colset-dragging",aP="open";let MS=null;const lP="grid grid-cols-[18px_minmax(78px,1fr)_44px_minmax(106px,auto)] items-center gap-2";function oP(){return window}const $x=new Map;function DS(e){return e.columns.map(t=>({key:t.key,visible:t.visible!==!1,align:t.align||"left"}))}function XJ(e,t){const a=Array.isArray(t),o=!a&&t&&typeof t=="object"?t:null,c=a?t:Array.isArray(o?.items)?o.items:[],d=o?.defaults&&typeof o.defaults=="object"?o.defaults:null,f=new Map(e.columns.map(y=>[y.key,y])),p=new Map(DS(e).map(y=>[y.key,y])),h=[],b=new Set;for(const y of c){const v=y&&typeof y=="object"?y:{},w=String(v.key||"");if(!f.has(w)||b.has(w))continue;b.add(w);const j=f.get(w),S=j.align||"left",N=d?d[w]??S:j.legacyAlign??S,k=KJ(v.align)?v.align:null;h.push({key:w,visible:v.visible!==!1,align:k&&k!==N?k:S})}for(const y of e.columns)b.has(y.key)||QJ(h,e,{...p.get(y.key)});return h}function QJ(e,t,a){const o=t.columns.findIndex(c=>c.key===a.key);for(let c=o-1;c>=0;c-=1){const d=e.findIndex(f=>f.key===t.columns[c].key);if(d>=0){e.splice(d+1,0,a);return}}e.unshift(a)}function ZJ(e){try{const t=localStorage.getItem(sP+e.id);return XJ(e,t?JSON.parse(t):[])}catch{return DS(e)}}function WJ(e){try{const t={};for(const a of e.columns)t[a.key]=a.align||"left";localStorage.setItem(sP+e.id,JSON.stringify({v:2,defaults:t,items:e.config}))}catch{}}const JJ=e=>$x.get(e)?.config||null,eee=(e,t)=>e.columns.find(a=>a.key===t)?.label||t;function iP(e,t){const a=$x.get(e);if(!a)return t;const o=new Map(t.map(c=>[c.key,c]));return a.config.filter(c=>c.visible&&o.has(c.key)).map(c=>({...o.get(c.key),align:c.align}))}function Mp(e,{silent:t=!1}={}){WJ(e),t||e.onChange?.(e.config),Il&&Il.id===e.id&&Il.repaint()}let Il=null;function qx(){if(!Il)return;const e=Il;Il=null,e.destroy()}function tee(e,t){qx();const a=document.createElement("div");document.body.append(a);const o=vn.createRoot(a),c={current:null};Il={id:e.id,spec:e,repaint:()=>c.current?.(),destroy:()=>{o.unmount(),a.remove()}},o.render(s.jsx(lee,{spec:e,anchor:t,repaintRef:c,onClose:qx}))}function nee(e,t){Il&&Il.id===e.id?qx():tee(e,t)}function see(e,t,a){const o=[...e],[c]=o.splice(t,1);return o.splice(a,0,c),o}function ree(e,t,a,o){const c=document.elementFromPoint(e,t)?.closest?.("[data-col-key]");if(!c||!a||!a.contains(c))return"";const d=c.getAttribute("data-col-key")||"";return o.some(f=>f.key===d)?d:""}const aee=s.jsxs("svg",{viewBox:"0 0 24 24",width:13,height:13,fill:"currentColor","aria-hidden":"true",className:"block",children:[s.jsx("circle",{cx:"9",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"18",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"18",r:"1.6"})]});function lee({spec:e,anchor:t,repaintRef:a,onClose:o}){const c=t,d=x.useRef(null),[f,p]=x.useState(null),h=x.useRef(null),[,b]=x.useState(0),y=x.useCallback(()=>b(N=>N+1),[]);x.useLayoutEffect(()=>(a.current=y,()=>{a.current=null}),[y,a]),x.useEffect(()=>(c.classList.add(aP),c.setAttribute("aria-expanded","true"),()=>{c.classList.remove(aP),c.setAttribute("aria-expanded","false")}),[c]),x.useEffect(()=>{const N=()=>{const k=c.getBoundingClientRect();(!c.isConnected||!k.width||k.bottom<=0||k.top>=window.innerHeight)&&o()};return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[c,o]),x.useEffect(()=>()=>{const N=h.current;N&&(N.teardown(),Mp(e))},[e]);function v(N,k){const T=e.config.find(D=>D.key===N);T&&(!k&&e.config.filter(D=>D.visible).length<=1||(T.visible=k,Mp(e)))}function w(N,k){const T=e.config.find(D=>D.key===N);!T||T.align===k||(T.align=k,Mp(e))}function j(){e.config=DS(e),Mp(e)}function S(N,k){k.preventDefault(),h.current?.teardown(),p(N),document.body.classList.add(rP);const T=d.current;function D(){window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",A),document.body.classList.remove(rP),h.current=null,p(null)}function C(R){const I=ree(R.clientX,R.clientY,T,e.config);if(!I||I===N)return;const P=e.config.findIndex(_=>_.key===N),O=e.config.findIndex(_=>_.key===I);P<0||O<0||(e.config=see(e.config,P,O),y())}function A(){D(),Mp(e)}h.current={teardown:D},window.addEventListener("pointermove",C),window.addEventListener("pointerup",A)}return s.jsx(hf,{open:!0,modal:!1,onOpenChange:(N,k)=>{N||(k?.reason==="outside-press"&&(MS=k.event??null),o())},children:s.jsxs(gf,{anchor:c,side:"bottom",align:"end",sideOffset:6,collisionPadding:8,className:"w-[336px]","aria-label":r("{name}的列设置",{name:e.label||e.id}),children:[s.jsxs("div",{className:Ue(lP,"border-b border-hairline px-3 pt-[9px] pb-[7px]","text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground"),children:[s.jsx("span",{}),s.jsx("span",{className:"text-center",children:r("列")}),s.jsx("span",{className:"text-center",children:r("显示")}),s.jsx("span",{className:"text-center",children:r("对齐")})]}),s.jsx("div",{ref:d,className:"min-h-0 flex-1 overflow-y-auto px-3 py-1",children:e.config.map(N=>{const k=eee(e,N.key),T=f===N.key;return s.jsxs("div",{"data-col-key":N.key,className:Ue(lP,"rounded-sm py-[5px] hover:bg-nav-hover",T&&"opacity-50"),children:[s.jsx("span",{className:"flex cursor-grab items-center justify-center text-muted-foreground opacity-50 hover:opacity-100",title:r("按住拖动调整列顺序"),onPointerDown:D=>S(N.key,D),children:aee}),s.jsx("span",{className:"min-w-0 truncate text-xs text-foreground",title:k,children:k}),s.jsx(hs,{className:"justify-self-center",checked:N.visible,onCheckedChange:D=>v(N.key,D),"aria-label":r("显示「{label}」列",{label:k}),title:N.visible?r("这一列正在显示"):r("这一列已隐藏")}),s.jsx(In,{className:"w-full justify-center",options:OS,value:N.align,onValueChange:D=>w(N.key,D),"aria-label":r("「{label}」列的对齐",{label:k})})]},N.key)})}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 pt-2 pb-[9px]",children:[s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:r("拖动 ⋮⋮ 调整顺序")}),s.jsx(se,{variant:"outline",size:"sm",onClick:j,children:r("恢复默认")})]})]})})}function oee(e,t){e&&(e.classList.remove(...YJ),e.classList.add(`ta-${t}`))}const cP=new Map;function iee(e,t){const a=cP.get(e);if(a&&a.table===t&&a.row.isConnected)return a;const o=t?.querySelector("thead tr");if(!o)return null;const c=t?.querySelector("colgroup")??null,d={table:t,row:o,group:c,ths:new Map([...o.querySelectorAll("th[data-col]")].map(f=>[f.getAttribute("data-col")||"",f])),cols:new Map([...c?.querySelectorAll("col[data-col]")||[]].map(f=>[f.getAttribute("data-col")||"",f]))};return cP.set(e,d),d}function cee(e,t,a){const o=$x.get(e);if(!o||!t)return;const c=iee(e,t);if(!c)return;const{row:d,group:f,ths:p,cols:h}=c;for(const b of o.config){const y=p.get(b.key);if(!y)continue;const v=h.get(b.key);if(!b.visible||a?.has(b.key)){y.remove(),v?.remove();continue}oee(y,b.align),d.appendChild(y),v&&f&&f.appendChild(v)}oP().wbTableColumns?.repaint?.(e)}function uee(e){const t=document.createElement("button");return t.type="button",t.className=`sm colset-btn${e.buttonClass?` ${e.buttonClass}`:""}`,t.id=`btn-colset-${e.id}`,t.title=r("调整「{name}」的列:显示 / 隐藏、顺序、对齐",{name:e.label||e.id}),t.innerHTML=`${oP().wbIcons?.icon?.("settings",14)||""}${r("列设置")}`,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.addEventListener("click",a=>{if(MS===a){MS=null;return}nee(e,t)}),t}function dee(e){return(typeof e.mount=="function"?e.mount():e.mount?document.querySelector(e.mount):null)||null}function fee(e){const t={...e,config:ZJ(e)};$x.set(e.id,t);const a=dee(e),o=uee(t);return a&&(e.buttonPlacement==="last"?a.appendChild(o):a.insertBefore(o,a.firstChild)),{apply:c=>iP(e.id,c),config:()=>t.config}}window.wbColSettings={register:fee,apply:iP,configOf:JJ,syncStaticHead:cee,close:qx};function sl(){return window}const pee=new Set(["updateCheck"]);function uP(e){return(Array.isArray(e?.tasks)?e.tasks:[]).filter(a=>!pee.has(a.id))}const mee=2e4,dP=1,hee=" · ";function Xu(e,t){sl().wbApp?.toast?.(e,t)}function Gx(e){return e instanceof Error?e.message:String(e)}function fP(e){return r(e==="seconds"?"秒":"分钟")}function pP(e){const t=Number(e)||0;return t?new Date(t).toLocaleTimeString("zh-CN",{hour12:!1}):""}function mP(e){const t=Number(e)||0;if(!t)return"";const a=t-Date.now();if(a<=0)return r("即将执行");const o=Math.round(a/1e3);if(o<60)return r("{n} 秒后",{n:o});const c=Math.round(o/60);if(c<60)return r("{n} 分钟后",{n:c});const d=Math.round(c/60);return d<24?r("{n} 小时后",{n:d}):r("{n} 天后",{n:Math.round(d/24)})}function gee(e){const t=e.runner==="backend",a=[];if(e.lastRunAt){const o=pP(e.lastRunAt);a.push(e.lastResult?r("上次执行 {time}({result})",{time:o,result:e.lastResult}):r("上次执行 {time}",{time:o}))}else a.push(r(t?"还没有执行记录":"由页面按间隔自动刷新"));return t&&e.enabled&&e.nextRunAt&&a.push(r("下次执行 {time}({relative})",{time:pP(e.nextRunAt),relative:mP(e.nextRunAt)})),t&&e.retryAt&&e.retryAt>Date.now()&&a.push(r("冷却中,{relative}重试",{relative:mP(e.retryAt)})),a.join(hee)}function xee(e,t){const a=String(t??"").trim(),o=fP(e.unit);if(!a)return{ok:!1,message:r("间隔不能为空(可填 {min}–{max} {unit})",{min:e.min,max:e.max,unit:o})};if(!/^\d+$/.test(a))return{ok:!1,message:r("间隔必须是整数")};const c=Number(a);return ce.max?{ok:!1,message:r("间隔必须在 {min}–{max} {unit} 之间(当前填的是 {value})",{min:e.min,max:e.max,unit:o,value:a})}:{ok:!0,value:c}}function bee(e){const t=sl();e.id==="logsAutoRefresh"?t.wbLogsPanel?.applyAutoRefresh?.(e):e.id==="requestsAutoRefresh"?t.wbRequestsPanel?.applyAutoRefresh?.(e):e.id==="reportAutoRefresh"&&t.wbReport?.applyAutoRefresh?.(e)}let lc=!1,Kx=null,IS=!1;async function hP(){if(!Kx){IS=!0;return}await Kx()}function vee(){const[e,t]=x.useState([]),[a,o]=x.useState(!1),[c,d]=x.useState(null),[f,p]=x.useState({});function h(I){p(P=>{if(!(I in P))return P;const O={...P};return delete O[I],O})}const b=x.useCallback(async()=>{const I=sl().workbuddyDesktop;try{if(!I)throw new Error(r("后端桥不可用"));const P=await I.getScheduledTasks();t(uP(P)),o(!0)}catch(P){console.warn("读取定时任务失败:",Gx(P)),t([]),o(!0)}},[]),y=x.useCallback(async()=>{if(lc||document.hidden||sl().wbApp?.currentPage!=="tasks")return;const I=sl().workbuddyDesktop;if(I)try{const P=await I.getScheduledTasks();t(uP(P))}catch(P){console.warn("同步定时任务状态失败:",Gx(P))}},[]);x.useEffect(()=>{const I=window.setInterval(()=>{y()},mee);return()=>{window.clearInterval(I)}},[y]),x.useEffect(()=>{sl().wbApp?.renderTopbarStatus?.()},[e,a]),x.useEffect(()=>(Kx=b,IS&&(IS=!1,b()),()=>{Kx=null}),[b]);async function v(I,P,O){if(lc)return;const _=sl().workbuddyDesktop;if(_){lc=!0;try{const L=await _.saveScheduledTask(I,P);t(H=>H.map(B=>B.id===I?L:B)),bee(L),Xu(r("✅ 已更新「{label}」",{label:O}))}catch(L){Xu(r("保存失败:{reason}",{reason:Gx(L)}),"err"),await b()}finally{lc=!1}}}async function w(I,P){const O=xee(I,P);if(!O.ok){Xu(O.message,"err"),h(I.id);return}if(O.value===I.interval){h(I.id);return}await v(I.id,{interval:O.value},r("{name}间隔",{name:r(I.label)})),h(I.id)}async function j(I){if(lc)return;const P=sl().workbuddyDesktop;if(P){lc=!0,d(I.id);try{const O=await P.runScheduledTask(I.id);if(O?.task){const _=O.task;t(L=>L.map(H=>H.id===I.id?_:H))}Xu(r("✅ {task}:{summary}",{task:r(I.label),summary:O?.summary||r("已执行")})),I.id==="credentialMaintenance"&&await sl().wbApp?.refresh?.()}catch(O){Xu(r("执行失败:{reason}",{reason:Gx(O)}),"err"),await b()}finally{lc=!1,d(null)}}}function S(I){const P=fP(I.unit),O=c===I.id;return s.jsxs("div",{className:"task-item","data-task":I.id,children:[s.jsxs("div",{className:"task-main",children:[s.jsxs("div",{className:"task-title",children:[s.jsxs("label",{className:"switch",children:[s.jsx(hs,{checked:I.enabled===!0,onCheckedChange:_=>{v(I.id,{enabled:_},r("{name}开关",{name:r(I.label)}))}}),s.jsx("span",{className:"task-name",children:r(I.label)})]}),s.jsx("span",{className:"tip-q","data-tip":r(I.description)}),s.jsx(ze,{className:"task-badge",variant:I.enabled?"success":"outline",children:I.enabled?r("已开启"):r("已关闭")}),I.running?s.jsx(ze,{className:"task-badge",variant:"warning",children:r("执行中…")}):null]}),s.jsx("div",{className:"task-state",children:gee(I)})]}),s.jsxs("div",{className:"task-actions",children:[s.jsxs("span",{className:"task-interval",children:[s.jsx("span",{className:"task-interval-label",children:r("每")}),s.jsx($e,{type:"number",inputMode:"numeric",min:I.min,max:I.max,step:1,className:"w-[74px] max-w-[74px] text-center tabular-nums",value:f[I.id]??String(I.interval),title:r("可填 {min}–{max} {unit}(默认 {def} {unit})",{min:I.min,max:I.max,unit:P,def:I.defaultInterval}),onChange:_=>{const L=_.currentTarget.value;p(H=>({...H,[I.id]:L}))},onBlur:_=>{w(I,_.currentTarget.value)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}}),s.jsx("span",{className:"task-interval-unit",children:P})]}),I.canRun===!0?s.jsx(se,{size:"sm",variant:"outline",disabled:O||I.running===!0,onClick:()=>{j(I)},children:r(O?"执行中…":"立即执行")}):null]})]},I.id)}const N=e.length===0,k=e.filter(I=>I.enabled).length,T=N?a?r("不可用"):"—":r("{enabled} / {total} 个已开启",{enabled:k,total:e.length}),D=N?a?"destructive":"outline":k?"success":"outline",C=D==="destructive"?"bad":D==="success"?"ok":"",A=e.map(I=>S(I)),R=A.slice(dP);return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("任务清单")}),s.jsx(ze,{id:"tasks-badge",variant:D,"data-tone":C,children:T}),s.jsx("span",{className:"panel-sub",children:r("状态每 20 秒自动同步")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"outline",onClick:()=>{b().then(()=>Xu(r("定时任务已刷新")))},children:r("刷新")})})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"task-list",children:N?s.jsx("div",{className:"log-empty",children:r(a?"没有可显示的定时任务。后端未返回任务清单,请确认网关正在运行。":"正在加载定时任务…")}):s.jsxs(s.Fragment,{children:[A.slice(0,dP),R.length?s.jsx("div",{className:"task-grid",children:R}):null]})})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{children:[r("任务配置保存在 "),s.jsx("code",{children:"~/.agent2api/config.json"}),r(" 的 "),s.jsx("code",{children:"scheduledTasks"}),r(" 字段")]}),s.jsx("span",{children:r("改动立即生效,不需要重启程序")})]})]})}const gP='.page[data-page="tasks"]';let xP=!1;function bP(){if(xP)return;const e=document.querySelector(gP);e&&(xP=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(vee,{})))}document.querySelector(gP)?bP():document.addEventListener("DOMContentLoaded",bP,{once:!0}),window.wbTasksPanel={load:hP},sl().wbApp?.currentPage==="tasks"&&hP();const vP="workbuddy-desktop-update-skip";function yee(){try{return localStorage.getItem(vP)||""}catch{return""}}function wee(e){try{localStorage.setItem(vP,e)}catch{}}let yP="";function Yx(e,t){if(!e||e.hasUpdate!==!0||e.pendingRestart===!0)return;const a=String(e.latestVersion||"").trim();a&&Pn().wbApp?.currentPage!=="settings"&&(a===yee()||a===yP||(yP=a,wP(),Qu=document.createElement("div"),document.body.append(Qu),Dp=vn.createRoot(Qu),Dp.render(s.jsx(jee,{info:e,onGoUpdate:t,onClose:wP}))))}function jee({info:e,onGoUpdate:t,onClose:a}){const o=String(e.latestVersion||""),c=String(e.notes||"").trim(),d=c?K2(c):"";function f(){wee(o),a()}function p(){a();const h=Pn();h.wbApp?.showPage?.("settings"),h.wbSettingsPanel?.showCategory?.("about"),t(e)}return s.jsx(Qt,{open:!0,onOpenChange:h=>{h||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("检测到更新")})}),s.jsxs(Bt,{children:[s.jsxs("p",{className:"text-[12.5px] leading-[1.6] text-subtle",children:[r("新版本 "),s.jsx("strong",{className:"text-foreground",children:o}),r(" 已发布(当前 {current}),更新日志如下:",{current:e.currentVersion||r("未知")})]}),s.jsx("div",{className:"max-h-[46vh] overflow-y-auto overscroll-contain pr-1.5",onClick:Y2,children:d?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:d}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})})})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",size:"sm",onClick:f,children:r("跳过此次更新")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:p,children:r("去更新")})]})]})})}let Dp=null,Qu=null;function wP(){Dp&&(Dp.unmount(),Dp=null),Qu&&(Qu.remove(),Qu=null)}const jP="updateCheck",Zu=1,Xx=1440,See="https://github.com/settings/tokens/new?description="+encodeURIComponent("Agent2API 更新检查");function Nee(e){return e?e.error?{badge:s.jsx(ze,{shape:"tag",variant:"destructive",title:e.error,children:r("无法解密")}),hint:r("重新粘贴保存一次即可自愈")}:e.filled&&e.origin==="stored"?{badge:s.jsx(ze,{shape:"tag",variant:"success",children:r("已填写")}),hint:r("已加密存储在本地,不显示具体值;粘贴新令牌可覆盖")}:e.filled?{badge:s.jsx(ze,{shape:"tag",variant:"secondary",children:r("环境变量")}),hint:r("已配置 GITHUB_TOKEN 环境变量,界面保存的令牌优先于它")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("未填写")}),hint:r("填写后检查限额 60 → 5000 次/小时(创建令牌无需勾选任何权限)")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("读取中")}),hint:""}}function kee({open:e,onClose:t}){const[a,o]=x.useState(X2),[c,d]=x.useState(null),[f,p]=x.useState(""),[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=Q2(a);x.useEffect(()=>{e&&(p(""),VY().then(o),(async()=>{try{d(await Pn().workbuddyDesktop?.getUpdateToken()??null)}catch{}})(),(async()=>{try{const L=((await Pn().workbuddyDesktop?.getScheduledTasks?.())?.tasks??[]).find(z=>z.id===jP),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B))}catch{}})())},[e]);async function T(_){if(!S){N(!0);try{const L=await Pn().workbuddyDesktop?.saveScheduledTask?.(jP,_),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B)),nr(r("✅ 自动检查更新已保存"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{N(!1)}}}async function D(){const _=Math.round(Number(w));if(!Number.isFinite(_)||_Xx){nr(r("检查间隔必须是 {min} ~ {max} 分钟",{min:Zu,max:Xx}),"err");return}y&&_===y.interval||await T({interval:_})}async function C(_){const L=await FY(_);L&&o(H=>({...H,proxyChoice:L.choice}))}async function A(){const _=f.trim();if(!_){nr(r("请先粘贴 GitHub 令牌"),"err");return}b(!0);try{const L=await Pn().workbuddyDesktop?.setUpdateToken({token:_});d(L??null),p(""),L?.saved===!1?nr(r("令牌已生效,但写入磁盘失败(重启后会丢失)"),"err"):nr(r("✅ GitHub 令牌已保存(加密存储,界面不再显示)"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{b(!1)}}async function R(){b(!0);try{const _=await Pn().workbuddyDesktop?.setUpdateToken({token:null});d(_??null),nr(r("✅ 已清除界面保存的 GitHub 令牌(环境变量若配置过则继续生效)"))}catch(_){nr(r("清除失败:{error}",{error:zr(_)}),"err")}finally{b(!1)}}const I=Nee(c),P=!!c?.error||c?.origin==="stored",O=c?.filled&&c?.origin!=="env"?r("已填写(粘贴新令牌可覆盖)"):r("粘贴 GitHub 令牌(ghp_… / github_pat_…)");return s.jsx(Qt,{open:e,onOpenChange:_=>{_||t()},children:s.jsxs(Zt,{className:"w-[min(460px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更新设置")})}),s.jsxs(Bt,{className:"gap-3.5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("自动检查更新")}),s.jsx(hs,{checked:y?.enabled===!0,disabled:S||!y,onCheckedChange:_=>{T({enabled:_===!0})},"aria-label":r("自动检查更新")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsx($e,{type:"number",min:Zu,max:Xx,step:1,className:"w-[110px]",disabled:S||!y||y.enabled!==!0,value:w,onChange:_=>j(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),D())},"aria-label":r("检查间隔(分钟)")}),s.jsx("span",{className:"text-[12px] text-subtle",children:r("分钟({min} ~ {max})",{min:Zu,max:Xx})}),s.jsx(se,{variant:"outline",size:"sm",disabled:S||!y||Math.round(Number(w))===y.interval,onClick:()=>{D()},children:r("保存")})]}),s.jsx("div",{className:"mt-1.5 text-[12px] text-subtle",children:r("到点自动向 GitHub 查询新版本,查到就走「检测到更新」弹窗;关闭后「检查更新」按钮仍可手动触发")})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("出网代理")}),s.jsx("div",{className:"mt-1.5",children:s.jsxs(ft,{value:k.current,onValueChange:_=>{C(String(_))},children:[s.jsx(mt,{className:Ue("w-full",k.broken&&"border-destructive-bd"),title:k.title,"aria-label":r("更新出网代理"),children:s.jsx(pt,{className:"min-w-0 truncate",children:k.selected?.label||r("直连")})}),s.jsx(ht,{children:k.items.map(_=>s.jsx(qe,{value:_.value,disabled:_.disabled,children:_.label},_.value))})]})})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("GitHub 令牌")}),s.jsx(se,{variant:"outline",size:"xs",title:r("在默认浏览器中打开 GitHub 的令牌创建页(备注已预设,无需勾选任何权限,直接点 Generate token)"),onClick:()=>{G2(See)},children:r("打开 GitHub 令牌页面")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[I.badge,s.jsx("span",{className:"text-[12px] text-subtle",children:I.hint})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[s.jsx($e,{type:"password",className:"flex-1",placeholder:O,autoComplete:"new-password",spellCheck:!1,value:f,onChange:_=>p(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),A())}}),s.jsx(se,{variant:"default",size:"sm",disabled:h||!f.trim(),onClick:()=>{A()},children:r("保存")}),P?s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{R()},children:r("清除")}):null]})]})]})]})})}function Cee({open:e,onClose:t}){return s.jsx(Qt,{open:e,onOpenChange:a=>{a||t()},children:s.jsxs(Zt,{className:"w-[min(320px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("加入 QQ 群")})}),s.jsxs(Bt,{className:"items-center gap-3 text-center",children:[s.jsx("img",{className:"qq-qr",src:UY,alt:r("QQ 群二维码")}),s.jsxs("div",{className:"qq-no",children:[s.jsx("span",{className:"k",children:r("群号")}),s.jsx("code",{children:Jg}),s.jsx(se,{type:"button",size:"sm",variant:"ghost","data-copy":Jg,children:r("复制")})]}),s.jsx("p",{className:"qq-hint",children:r("用手机 QQ 扫上面的二维码,或在 QQ 里搜索群号加入。")})]})]})})}const Tee=1e3,SP=8,Eee=10,Aee=1e3,Ree={"":"outline",ok:"success",warn:"warning",bad:"destructive"},Oee={info:null,checkedAt:0,repository:"",badgeText:r("未检查"),badgeTone:"",stateText:r("点击「检查更新」查询最新发布版本。"),stateError:!1,percent:0,phase:"idle",readyPath:"",checking:!1,actionBusy:!1,restartSeconds:0};function Pl(e){return String(e).padStart(2,"0")}function Mee(e){const t=new Date(String(e??""));return!e||Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${Pl(t.getHours())}:${Pl(t.getMinutes())}`}function NP(e){const t=new Date(e);if(!e||Number.isNaN(t.getTime()))return"";const a=new Date,o=t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate(),c=`${Pl(t.getHours())}:${Pl(t.getMinutes())}:${Pl(t.getSeconds())}`;return o?c:`${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${c}`}function Qx(e){return e?.installerKind?e.installerKind==="dmg":/Mac|iPhone|iPad/.test(navigator.userAgent||"")}function Da(e){return e?.selfUpdate===!0}function kP(e){return e?Da(e)?e.serverAsset??null:e.asset??null:null}function Dee(e){return Da(e)?r("正在下载服务端更新包…(下载完成后由面板完成替换,重启容器内的服务后生效)"):Qx(e)?r("正在下载安装包…(下载完成后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装)"):r("正在下载安装包…(下载完成后启动安装程序需要管理员权限,会弹出 UAC 确认框)")}function CP(e,t){return Da(e)?r("更新包已就绪:{name}。点「安装并重启」后,面板会校验并替换容器内的程序与界面文件,然后重启服务(页面会自动刷新)。",{name:t}):Qx(e)?r("安装包已就绪:{name}。点击「打开安装包」后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装。",{name:t}):r("安装包已就绪:{name}。点击「安装并重启」后需要管理员权限,会弹出 UAC 确认框。",{name:t})}function Iee(e){return Da(e)?r("安装并重启"):Qx(e)?r("打开安装包"):r("安装并重启")}let fa=Oee;const PS=new Set;function _S(){return fa}function Pee(e){return PS.add(e),()=>{PS.delete(e)}}function Bn(e){fa={...fa,...e};for(const t of PS)t()}let Sr=!1,LS=null,Zx=null;function Wu(){Zx!==null&&(window.clearInterval(Zx),Zx=null)}function Es(e,t=""){Bn({badgeText:e,badgeTone:t})}function An(e,t=!1){Bn({stateText:e,stateError:t})}function Wx(){const{info:e,checkedAt:t}=fa;if(!e)return;const a=t?r("(检查于 {time})",{time:NP(t)}):"";if(e.pendingRestart===!0){Es(r("待重启"),"warn"),An(r("更新已应用到容器内,重启服务后生效。{at}",{at:a}));return}if(e.hasUpdate===!0){if(Es(r("有新版本"),"warn"),Da(e)&&!e.serverAsset){An(r("发现新版本 {latest}(当前 {current}),但该版本没有提供容器内更新包;请在宿主机执行 docker compose pull && docker compose up -d 升级。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}));return}An(r("发现新版本 {latest}(当前 {current})。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}))}else e.hasUpdate===!1?(Es(r("已是最新"),"ok"),An(r("当前已是最新版本({current})。{at}",{current:String(e.currentVersion||""),at:a}))):(Es(r("无法比较"),"warn"),An(e.latestVersion?r("最新发布版本为 {latest},但当前版本号「{current}」无法解析,未做新旧判断。{at}",{latest:e.latestVersion,current:e.currentVersion||r("未知"),at:a}):r("仓库暂无发布版本。{at}",{at:a})))}function TP(e){!e||e.checked===!1||(Bn({info:e,checkedAt:Number(e.checkedAt)||0}),e.repository&&zS(e.repository),fa.phase==="idle"&&Wx())}function zS(e){const t=String(e||"").trim();/^[\w.-]+\/[\w.-]+$/.test(t)&&Bn({repository:t})}function BS(e){if(!e)return!1;if(e.active){const t=Math.max(0,Math.min(100,Number(e.percent)||0)),a=(Number(e.received)||0)/1024/1024,o=(Number(e.total)||0)/1024/1024;return Bn({phase:"downloading",percent:t}),Es(r("下载中"),"warn"),An(r("正在下载 {name}:{percent}%({received} / {total} MB)",{name:e.filename||r("安装包"),percent:t,received:a.toFixed(1),total:o.toFixed(1)})),!0}if(Wu(),Bn({percent:0}),e.error)return Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:e.error}),!0),Bn({phase:"failed"}),!0;if(e.canceled)return Es(r("已取消"),"warn"),An(Da(fa.info)?r("下载已取消,可重新点击「下载并更新」。"):r("下载已取消,可重新点击「下载并安装」。")),Bn({phase:"idle"}),!0;if(e.done&&e.path){const t=e.path,a=e.filename||t;return Es(r("可安装"),"ok"),Bn({phase:"ready",readyPath:t}),Da(fa.info)?(An(CP(fa.info,a)),!0):(t!==LS?(LS=t,An(Qx(fa.info)?r("安装包已下载完成,正在挂载磁盘映像…"):r("安装包已下载完成,正在启动安装程序(需要管理员权限,会弹出 UAC 确认框)…")),AP(t)):An(CP(fa.info,a)),!0)}return!1}async function _ee(){try{const e=await Pn().workbuddyDesktop?.updateProgress();if(!e){Wu();return}BS(e)}catch(e){Wu(),An(r("读取下载进度失败:{error}",{error:zr(e)}),!0)}}function EP(){Wu(),Zx=window.setInterval(()=>{_ee()},Tee)}async function AP(e){const t=Pn().workbuddyDesktop;if(t)try{const o=(await t.runInstaller(e,!0))?.restart!==!1;An(r(o?"安装程序已启动,本程序将退出以便完成覆盖安装。安装程序需要管理员权限,会弹出 UAC 确认框,请选择「是」。":"安装包已挂载,请在弹出的窗口里把应用拖进「应用程序」完成安装。安装完成后重新打开本程序即可。"))}catch(a){Es(r("启动失败"),"bad"),An(r("启动安装程序失败:{error}",{error:zr(a)}),!0)}}async function Lee(){const e=Pn().workbuddyDesktop;if(e?.installUpdate)try{Es(r("安装中"),"warn"),An(r("正在校验并替换容器内的程序与界面文件…"));const t=await e.installUpdate(),a=String(t?.version||"").trim();An(a?r("已替换为 {version},正在重启服务…",{version:a}):r("替换完成,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS(a)}catch(t){Es(r("安装失败"),"bad"),An(r("安装失败:{error}",{error:zr(t)}),!0)}}async function zee(){const e=Pn().workbuddyDesktop;if(!(!e?.rollbackUpdate||Sr)){Sr=!0,Bn({actionBusy:!0});try{Es(r("回滚中"),"warn"),An(r("正在回滚到上一版本…")),await e.rollbackUpdate(),An(r("已还原上一版本,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS("")}catch(t){Es(r("回滚失败"),"bad"),An(r("回滚失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}function HS(e){Wu(),Bn({phase:"restarting",restartSeconds:SP,readyPath:""}),Es(r("重启中"),"warn");let t=SP;const a=()=>{if(An(e?r("{version} 已就位,服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{version:e,seconds:Math.max(0,t)}):r("服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{seconds:Math.max(0,t)})),t<=0){window.clearInterval(o),Bee();return}t-=1,Bn({restartSeconds:t})},o=window.setInterval(a,1e3);a()}async function Bee(){for(let e=0;e{window.setTimeout(t,Aee)})}window.location.reload()}async function RP(){if(Sr)return null;Sr=!0,Bn({checking:!0}),Es(r("检查中"),"warn"),An(r("正在查询 GitHub 上的最新发布版本…"));let e=null;try{const t=Pn().workbuddyDesktop;if(!t)throw new Error(r("后端桥不可用"));e=await t.checkUpdate()??null,Bn({info:e,checkedAt:Number(e?.checkedAt)||Date.now()}),e?.repository&&zS(e.repository),Wx()}catch(t){e=null,Bn({info:null,checkedAt:0}),Es(r("检查失败"),"bad"),An(r("检查更新失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({checking:!1})}return Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip),e}async function OP(){let e=null;try{e=await Pn().workbuddyDesktop?.getUpdateStatus()??null}catch{}if(e&&e.checked!==!1){TP(e),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip);return}fa.info||(Es(r("未检查")),An(r("点击「检查更新」查询 GitHub 上的最新发布版本。")))}async function US(){if(Sr)return;const e=_S();if(e.info?.pendingRestart===!0&&e.phase!=="downloading"){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.restartService?.().catch(()=>{}),HS("")}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase!=="downloading"&&e.readyPath){Sr=!0,Bn({actionBusy:!0});try{Da(e.info)?await Lee():await AP(e.readyPath)}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase==="downloading"){try{await Pn().workbuddyDesktop?.cancelUpdate(),An(r("正在取消下载…"))}catch(a){nr(r("取消失败:{error}",{error:zr(a)}),"err")}return}const t=kP(e.info);if(!t?.url){nr(Da(e.info)?r("这一版没有提供容器内更新包"):r("没有可下载的安装包"),"err");return}if(DP(e)){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.downloadUpdate({url:t.url,name:t.name}),LS=null,Bn({phase:"downloading",readyPath:"",percent:0}),Es(r("下载中"),"warn"),An(Dee(e.info)),EP()}catch(a){Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:zr(a)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}async function MP(){Wx(),await OP();try{const e=await Pn().workbuddyDesktop?.updateProgress();if(e?.active){BS(e),EP();return}if(e?.done&&e.path){BS(e);return}}catch{}}async function Ip(e){if(e?.pendingRestart===!0){await US();return}e?.hasUpdate===!0&&(Bn({info:e,checkedAt:Number(e.checkedAt)||fa.checkedAt}),e.repository&&zS(e.repository),Wx(),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip)),await MP();const t=_S();if(!(t.phase==="downloading"||t.readyPath)&&t.info?.hasUpdate)for(let a=0;a<3;a+=1){if(Sr){await new Promise(o=>{window.setTimeout(o,400)});continue}await US();return}}function DP(e){return e.phase==="restarting"?null:e.info?.pendingRestart===!0&&e.phase==="idle"?{label:r("立即重启"),disabled:e.actionBusy}:!(e.info?.hasUpdate===!0&&!!kP(e.info)?.url)&&e.phase!=="downloading"&&e.phase!=="ready"?null:{label:e.phase==="downloading"?r("取消下载"):e.phase==="failed"?r("重试下载"):e.phase==="ready"?Iee(e.info):Da(e.info)?r("下载并更新"):r("下载并安装"),disabled:e.actionBusy}}function Hee(e,t){const a=e.info,o=String(a?.notes||"").trim();if(!o)return s.jsx("div",{className:"update-log-hint",children:r(a?"这个版本没有填写发布说明。":"点击「检查更新」后,这里会显示最新版本的更新说明。")});const c=K2(o),d=q2(a?.pageUrl),f=Mee(a?.publishedAt);return s.jsxs("div",{className:"rel-note",children:[s.jsxs("div",{className:"rel-note-head",children:[s.jsx("span",{className:"rel-tag",children:String(a?.latestVersion||r("最新版本"))}),a?.prerelease===!0?s.jsx(ze,{shape:"tag",variant:"warning",children:r("预发布")}):null,f?s.jsx("span",{className:"rel-date",children:f}):null]}),s.jsxs("div",{className:"rel-note-body",children:[c?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:c}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})}),s.jsxs("div",{className:"rel-foot",children:[d?s.jsx("a",{href:d,"data-external":d,target:"_blank",rel:"noopener",children:r("在 GitHub 查看完整说明")}):null,s.jsx(se,{type:"button",variant:"link",size:"sm",className:"h-auto border-0 px-0 text-[11.5px] font-semibold text-primary-fg underline-offset-auto",title:r("群号:{group}",{group:Jg}),onClick:t,children:r("加入 QQ 群")})]})]})]})}function Uee(){const e=x.useSyncExternalStore(Pee,_S),t=DP(e),[a,o]=x.useState(!1),[c,d]=x.useState(!1);x.useEffect(()=>()=>{Wu()},[]);const f=e.repository?`https://github.com/${e.repository}`:"",p=e.repository?`https://github.com/${e.repository.split("/")[0]}`:"",h=Da(e.info),b=h&&e.info?.backupAvailable===!0&&e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="restarting",y=e.info?.latestVersion?e.info.prerelease?r("{version}(预发布)",{version:e.info.latestVersion}):e.info.latestVersion:"—",v=String(e.info?.latestVersion||"").trim(),w=v?`${v}${e.checkedAt?r(" · 检查于 {time}",{time:NP(e.checkedAt)}):""}`:"";return s.jsxs("section",{className:"panel",onClick:Y2,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("软件更新")}),s.jsx("span",{className:"tip-q","data-tip":r(h?"容器内更新:更新包从 GitHub 发布页下载,校验 sha256 后由面板替换容器内的程序与界面文件,再重启服务(容器由 restart 策略拉起,页面会自动刷新)。更新的是容器里的文件,compose 里的镜像标签不变 —— 之后执行 docker compose pull && up -d 会回到镜像里的版本;更新失败可一键回滚到上一版本。检查更新与下载的出网线路、GitHub 令牌都在「更新设置」里。":"更新包从 GitHub 发布页下载,下载完成后可直接启动安装程序并自动重启本程序。安装包会先校验来源域名与文件完整性。检查更新与下载安装包的出网线路、GitHub 令牌都在「更新设置」里:线路默认直连(直连失败时自动借 Clash Verge 的混合端口重试一次),选定指定出口后只走该出口;填写 GitHub 令牌可把检查限额从 60 次/小时提高到 5000 次/小时。")}),s.jsx(ze,{id:"update-badge",variant:Ree[e.badgeTone],"data-tone":e.badgeTone,children:e.badgeText}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-update-settings",variant:"outline",title:r("出网线路与 GitHub 令牌设置"),onClick:()=>o(!0),children:r("更新设置")}),s.jsx(se,{id:"btn-update-check",variant:"outline",disabled:e.checking||e.phase==="restarting",onClick:()=>{RP()},children:e.checking?r("检查中…"):r("检查更新")}),b?s.jsx(se,{id:"btn-update-rollback",variant:"outline",disabled:e.actionBusy,title:r("把容器内的程序与界面文件还原到更新前的版本,并重启服务"),onClick:()=>{zee()},children:r("回滚到上一版本")}):null,t?s.jsx(se,{id:"btn-update-download",variant:"default",disabled:t.disabled,onClick:()=>{US()},children:t.label}):null]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"update-version",children:[s.jsxs("span",{className:"version-pill",children:[s.jsx("span",{className:"k",children:r("当前版本")}),s.jsx("span",{className:"v",id:"update-current",children:e.info?.currentVersion||"—"})]}),s.jsx("span",{className:"version-arrow",children:"→"}),s.jsxs("span",{className:"version-pill new",children:[s.jsx("span",{className:"k",children:r("最新版本")}),s.jsx("span",{className:"v",id:"update-latest",children:y})]})]}),s.jsx("div",{className:"detail",id:"update-state",style:e.stateError?{color:"var(--danger)"}:void 0,children:e.stateText}),e.phase==="downloading"&&e.percent>0&&e.percent<100?s.jsx(tf,{value:e.percent}):null,p&&f?s.jsxs("div",{className:"update-author",id:"update-author",children:[s.jsxs("div",{className:"update-author-text",children:[s.jsx("strong",{children:r("关于作者")}),s.jsxs("span",{children:[r("本工具由")," ",s.jsx("a",{id:"update-author-link",href:p,"data-external":p,target:"_blank",rel:"noopener",children:e.repository.split("/")[0]})," ",r("个人开发并开源维护,免费使用、不带广告,也不会收集你的账号数据。如果它帮到了你,欢迎到项目仓库点个 Star 支持一下。")]})]}),s.jsx("div",{className:"update-author-actions",children:s.jsx(se,{id:"btn-update-favorite",type:"button",size:"sm",variant:"outline","data-external":f,title:r("在浏览器中打开项目仓库,点 Star 支持作者"),children:r("收藏项目")})})]}):null,s.jsxs("div",{className:"update-log",id:"update-notes",children:[s.jsxs("div",{className:"update-log-head",children:[s.jsx("span",{className:"update-log-title",children:r("更新日志")}),s.jsx("span",{className:"update-log-meta",id:"update-log-meta",children:w})]}),s.jsx("div",{className:"update-log-body",id:"update-log-body",children:Hee(e,()=>d(!0))})]})]}),a?s.jsx(kee,{open:!0,onClose:()=>o(!1)}):null,c?s.jsx(Cee,{open:!0,onClose:()=>d(!1)}):null]})}const IP='.settings-pane[data-cat="about"]';let VS=null;function PP(){if(VS)return;const e=document.querySelector(IP);e&&(e.replaceChildren(),VS=vn.createRoot(e),VS.render(s.jsx(Uee,{})))}document.querySelector(IP)?PP():document.addEventListener("DOMContentLoaded",PP,{once:!0}),window.wbUpdatePanel={load:MP,check:RP,syncFromCache:OP,openAndDownload:Ip,applyStatus:TP,showUpdateModal:e=>Yx(e,Ip)};const Vee="zcode.z.ai/billing",Fee={active:"success",pending:"warning",expired:"ghost",unknown:"outline"};function $ee(e){const t=String(e||"").trim().toLowerCase();return t==="daily"?r("每日"):t==="weekly"?r("每周"):t==="monthly"?r("每月"):""}function qee(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(t)}function oc(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"":Pe().wbApp?.formatTime?.(t*1e3)||new Date(t*1e3).toLocaleString()}function Gee(e){const t=qee(e.grantUnits),a=String(e.unitType||"").trim(),o=t?[t,a].filter(Boolean).join(" "):"",c=$ee(e.period),d=[String(e.showName||"").trim(),o].filter(Boolean).join(" ");return d?c?r("{body}({period})",{body:d,period:c}):d:""}function _P(e){return(e.entitlements||[]).map(Gee).filter(Boolean).join(r("、"))}function Kee(e){const t=oc(e.startsAt),a=oc(e.endsAt);return t&&a?`${t} → ${a}`:a?r("到期 {time}",{time:a}):t?r("开始 {time}",{time:t}):""}function Yee(e){const t=new Date(e*1e3);if(Number.isNaN(t.getTime()))return"";const a=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`,o=d=>Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/864e5),c=o(t)-o(new Date);return c===0?r("今天 {time}",{time:a}):c===1?r("明天 {time}",{time:a}):oc(e)}function Xee(e){const t=[],a=Number(e.pendingUntil);if(Number.isFinite(a)&&a>0){const c=Yee(a);c&&t.push(r("待生效 {time}",{time:c}))}const o=oc(e.endsAt);if(o&&t.push(r("到期 {time}",{time:o})),t.length===0){const c=oc(e.startsAt);c&&t.push(r("开始 {time}",{time:c}))}return t.join(" · ")}function Qee({options:e,onClose:t}){const a=e.id,[,o]=x.useState(0);x.useEffect(()=>YA(()=>o(P=>P+1)),[]);const[c,d]=x.useState([]),[f,p]=x.useState({status:"loading"}),[h,b]=x.useState(""),y=Ea(a),v=String(y?.name||e.name||a),w=Kh(y),j=[...new Set([...w,...c])],S=y?.claimPlans&&typeof y.claimPlans=="object"&&!Array.isArray(y.claimPlans)?y.claimPlans:{},N=y?Za(y):void 0,k=N&&typeof N=="object"&&!Array.isArray(N)?N:null,T=k&&Array.isArray(k.plans)?k.plans:[],D=j.filter(P=>P&&!T.some(O=>String(O.planId||"")===P)),C=Ws().usageInflight.has(a),A=Pe().wbZcodeClaim,R=x.useCallback(async()=>{if(!A?.preview){p({status:"error",message:r("当前环境不支持领取(桥接方法缺失)")});return}p({status:"loading"});try{const P=await A.preview(a);p({status:"ready",result:P||{}})}catch(P){p({status:"error",message:ut(P)})}},[A,a]);x.useEffect(()=>{R();const P=Ea(a);P&&Za(P)===void 0&&tg(a)},[a,R]);async function I(P){if(!(!A?.claim||h)){b(P);try{const O=await A.claim(a,P);if(O?.ok||O?.failure==="already_claimed"){const _=O.planId||P;_&&d(L=>L.includes(_)?L:[...L,_]),tg(a),Pe().wbApp?.refresh?.(),R()}}finally{b("")}}}return s.jsx(Qt,{open:!0,onOpenChange:(P,O)=>{if(!P){if(h){O.cancel();return}t()}},children:s.jsxs(Zt,{className:"w-[min(560px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("ZCode 套餐明细 — {name}",{name:v})})}),s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("可领取的套餐"),s.jsx(ze,{variant:"outline",shape:"tag",children:r("官方限时活动")})]}),f.status==="loading"?s.jsxs("div",{className:"flex items-center gap-2 py-2 text-[12.5px] text-muted-foreground",children:[s.jsx(ef,{className:"size-3"}),r("正在探测可领取的套餐…")]}):f.status==="error"?s.jsxs("div",{className:"py-1 text-[12.5px] text-destructive",children:[r("探测失败:{message}",{message:f.message}),s.jsx(se,{variant:"outline",size:"xs",className:"ml-2",onClick:()=>{R()},children:r("重试")})]}):f.result.deployed?(f.result.plans||[]).length===0?s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动期内每天发一份,明天可再领)")}):s.jsx("ul",{className:"m-0 list-none p-0",children:(f.result.plans||[]).map(P=>{const O=String(P.planId||""),_=j.includes(O),L=_P(P),H=Kee(P);return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),_?s.jsx(ze,{variant:"success",shape:"tag",children:r("今日已领")}):null]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null,P.description?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:P.description}):null]}),s.jsx(se,{variant:"outline",size:"xs",className:"flex-none",title:_?r("这一份今天已经领过了(重复领取上游会回「已领取过」)"):void 0,disabled:h!=="",onClick:()=>{I(O)},children:r(h===O?"领取中…":_?"再领一次":"领取")})]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动尚未开始)")}),s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("活动期内每天发一份新套餐;同一份当天重复领取会提示「已领取过」,次日可再领。领取要走一次人机验证(滑块)。")}),f.status==="ready"&&f.result.activationError?s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:r("(激活事件补报失败,可能影响领取资格:{message})",{message:f.result.activationError})}):null]}),s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("我的套餐"),Array.isArray(k?.wallets)&&k.wallets.length>0&&k.availableView?s.jsx(ze,{variant:"outline",shape:"tag",children:String(k.walletsFrom||"")==="monitor"?String(k.availableView):r("可用 {value}",{value:String(k.availableView)})}):null,s.jsx("div",{className:"ml-auto",children:s.jsx(se,{variant:"outline",size:"xs",disabled:C,title:r("重新读取该账号的余额与套餐(走余额查询那条链)"),onClick:()=>{tg(a)},children:r(C?"查询中…":"查询余额")})})]}),T.length>0?s.jsx("ul",{className:"m-0 list-none p-0",children:T.map(P=>{const O=String(P.planId||""),_=String(P.state||"unknown"),L=_P(P),H=Xee(P),B=O&&y?.claimPlans&&Number(y.claimPlans[O])||0;return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),s.jsx(ze,{variant:Fee[_]||"outline",shape:"tag",children:_A(_)})]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null]}),B>0?s.jsx("span",{className:"flex-none text-[11.5px] text-muted-foreground",children:r("本地领取于 {time}",{time:oc(B/1e3)})}):null]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:N===void 0?r("还没有余额读数(已自动查询一次,稍候;也可以点右上角「查询余额」重读)"):k&&k.source&&k.source!==Vee?r("这个账号的余额走窗口限额通道(只配了编码套餐 API Key):只有每 N 小时的剩余比例,读不到套餐清单"):r("读数里没有套餐清单(免费账号、或套餐的上游状态还没刷新;可点右上角「查询余额」重读)")}),D.length>0?s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("本地台账里今天还领过这些,但上面的读数里还没有:{plans}(读数刷新可能有延迟)",{plans:D.map(P=>{const O=Number(S[P])||0,_=O>0?oc(O/1e3):"";return _?r("{plan}({time} 领取)",{plan:P,time:_}):P}).join(r("、"))})}):null]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:j.length>0?r("今天(北京时间)已领取 {n} 份:{plans}",{n:j.length,plans:j.join(r("、"))}):r("今天还没有领过:上面「可领取的套餐」里逐份点「领取」即可")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})})}let Pp=null,Ju=null;function LP(){Pp&&(Pp.unmount(),Pp=null),Ju&&(Ju.remove(),Ju=null)}function Zee(e){e?.id&&(LP(),Ju=document.createElement("div"),document.body.append(Ju),Pp=vn.createRoot(Ju),Pp.render(s.jsx(Qee,{options:e,onClose:LP})))}window.wbZcodePlans={open:Zee};const zP="w-auto flex-auto";function BP({onInput:e,domRef:t,icon:a,className:o,inputClassName:c,...d}){const f=h=>{t.current=h},p=h=>{e?.(h.currentTarget.value)};return a?s.jsxs(Ci,{className:Ue(zP,o),children:[s.jsx(Ei,{ref:f,className:c,onInput:p,...d}),s.jsx(Ti,{"aria-hidden":"true",children:a})]}):s.jsx($e,{ref:f,className:Ue(zP,c),onInput:p,...d})}function Wee(e,t){const a=vn.createRoot(e),o={current:null};return a.render(s.jsx(BP,{domRef:o,defaultValue:t.value,placeholder:t.placeholder,type:t.type??"search",icon:t.icon,"aria-label":t.ariaLabel,onInput:t.onInput})),{setValue(c){const d=o.current;d&&d.value!==c&&(d.value=c)},getValue(){return o.current?.value??""},focus(){o.current?.focus()},unmount(){a.unmount()}}}const Jee=[["id","id"],["type","type"],["name","name"],["title","title"],["placeholder","placeholder"],["min","min"],["max","max"],["step","step"],["autocomplete","autoComplete"]];function ete(e){const t={defaultValue:e.value||void 0,inputClassName:e.className||void 0};for(const[f,p]of Jee){const h=e.getAttribute(f);h!=null&&(t[p]=h)}const a=e.getAttribute("maxlength");a!=null&&(t.maxLength=Number(a));const o=e.getAttribute("inputmode");o!=null&&(t.inputMode=o),e.hasAttribute("spellcheck")&&(t.spellCheck=e.spellcheck),e.disabled&&(t.disabled=!0),e.readOnly&&(t.readOnly=!0),e.hidden&&(t.hidden=!0);const c=e.getAttribute("aria-label");c!=null&&(t["aria-label"]=c);for(const f of e.getAttributeNames())!f.startsWith("data-")||f.startsWith("data-island-")||(t[f]=e.getAttribute(f)??"");const d=e.getAttribute("data-island-icon");return d!=null&&(t.icon=d),t}function HP(e){if(e.dataset.islandUpgraded)return;e.dataset.islandUpgraded="1";const t=ete(e),a=e.parentElement?.classList.contains("input-affix")?e.parentElement:null;let o;a?(a.className=a.className.replace(/\binput-affix\b/,"").trim(),a.style.display="flex",a.style.alignItems="center",o=a):(o=document.createElement("span"),o.style.display="contents",e.replaceWith(o));const c={current:null},d=vn.createRoot(o);Cs.flushSync(()=>{d.render(s.jsx(BP,{...t,domRef:c}))})}function UP(e=document){if(e instanceof HTMLInputElement&&e.matches("[data-island-input]")){HP(e);return}e.querySelectorAll("input[data-island-input]").forEach(HP)}function tte(){UP();const e=new MutationObserver(t=>{for(const a of t)for(const o of a.addedNodes)o instanceof Element&&UP(o)});return e.observe(document.body,{childList:!0,subtree:!0}),e}function nte(e,t){const a=vn.createRoot(e);let o={options:t.options,value:t.value,ariaLabel:t.ariaLabel,className:t.className};const c=()=>{a.render(s.jsx(In,{options:o.options,value:o.value,onValueChange:t.onChange,"aria-label":o.ariaLabel,className:o.className}))};return c(),{setValue(d){d!==o.value&&(o={...o,value:d},c())},setOptions(d){o={...o,options:d},c()},unmount(){a.unmount()}}}window.wbSegmented={mount:nte},window.wbInput={mount:Wee},tte()})(); +`)}}const y=[...p.entries()].sort((v,w)=>v[0]-w[0]).map(([,v])=>v);y.length&&e.onEvent({type:"toolCalls",calls:y}),e.onEvent({type:"done",finishReason:h})}function Ww(e){const t=String(e||"").trim();if(!t)return{};try{const a=JSON.parse(t);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Ja(){const e=window.workbuddyDesktop;if(!e)throw new Error(r("桌面桥不可用(本页需要在 Agent2API 客户端里打开)"));return e}function Su(){window.wbApp?.refresh?.()}function at(e,t=256){return typeof e=="string"?e.trim().slice(0,t):""}function Ui(e){return typeof e=="boolean"?e:void 0}function Bf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Nu(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"):[]}function ku(e){return(e instanceof Error?e.message:String(e)).replace(/^Error:\s*/,"")}async function jg(){const e=await Ja().getState?.();return(Array.isArray(e?.accounts)?e.accounts:[]).slice().sort((a,o)=>Number(a.priority??0)-Number(o.priority??0))}function Hf(e){return at(e.name)||at(e.nickname)||at(e.id)||"(未命名账号)"}function Jw(e,t){const a=t.trim();if(!a)throw new Error(r("没给账号名"));const o=e.find(p=>at(p.id)===a);if(o)return o;const c=e.filter(p=>Hf(p)===a);if(c.length===1)return c[0];const d=e.filter(p=>Hf(p).includes(a));if(d.length===1)return d[0];const f=(c.length?c:d).map(Hf).slice(0,6);throw f.length?new Error(r("「{name}」匹配到多个账号:{list},请用完整账号名重试",{name:a,list:f.join("、")})):new Error(r("没有找到账号「{name}」",{name:a}))}const CG={id:"list_models",label:r("获取模型列表"),kind:"read",desc:"读取各提供商的模型清单(模型 ID、所属提供商、是否启用、已挂的映射名)以及全部映射。回答「有哪些模型」「哪些模型在多家重复」「某个名字挂在哪」这类问题之前先调用它。",params:{type:"object",properties:{provider:{type:"string",description:"只看某一家(提供商 id,如 codearts / workbuddy);不填 = 全部"},keyword:{type:"string",description:"按模型 ID 或映射名做子串过滤;不填 = 不过滤"},enabledOnly:{type:"boolean",description:"true = 只看已启用的模型"}}},run:async e=>{const t=at(e.provider,64).toLowerCase(),a=at(e.keyword,128).toLowerCase(),o=Ui(e.enabledOnly)===!0,c=await Ja().getModelManage?.(),f=(Array.isArray(c?.models)?c.models:[]).filter(p=>!(t&&at(p.provider).toLowerCase()!==t||o&&p.enabled!==!0||a&&![at(p.id),at(p.name),...Array.isArray(p.aliases)?p.aliases.map(b=>at(b)):[]].join(" ").toLowerCase().includes(a))).map(p=>({provider:at(p.provider),id:at(p.id),enabled:p.enabled===!0,aliases:Array.isArray(p.aliases)?p.aliases.map(h=>at(h)):[]}));return{text:JSON.stringify({total:f.length,models:f.slice(0,400)}),summary:r("{n} 个模型",{n:f.length})}}},TG={id:"list_account_balance",label:r("查询账号余额"),kind:"read",desc:"查询各账号的余额 / 剩余额度(会向各上游发起真实的余额查询)。回答「还剩多少」「哪个账号快用完了」这类问题之前先调用它。",params:{type:"object",properties:{account:{type:"string",description:"只查某个账号(账号名或 id);不填 = 全部账号"}}},run:async e=>{const t=at(e.account,128),a=t?at(Jw(await jg(),t).id):"",o=await Ja().getAllBalances?.(a||void 0),c=Array.isArray(o?.results)?o.results:o,d=Array.isArray(c)?c:[];return{text:JSON.stringify({accounts:d.slice(0,60)}).slice(0,12e3),summary:r("{n} 个账号",{n:d.length})}}},EG={id:"set_model_enabled",label:r("启用 / 禁用模型"),kind:"write",desc:"开启或关闭某几个模型在网关上的可用性(粒度是「提供商 × 模型」)。禁用后下游请求不再路由到它。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的模型列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["provider","id","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items);return{lead:r("将修改 {n} 个模型的启停状态:",{n:t.length}),table:{head:[r("提供商"),r("模型"),r("改成")],rows:t.map(a=>[at(a.provider),at(a.id),Ui(a.enabled)===!1?r("禁用"):r("启用")])},note:r("改动立即生效;禁用后指向它的请求会落到下一个候选。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=Ui(c.enabled);if(!d||!f||p===void 0)throw new Error(r("参数不完整(需要 provider / id / enabled)"));await t.setModelState?.({provider:d,id:f,enabled:p}),o.push(`${p?"启用":"禁用"} ${d}/${f}`)}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已修改 {n} 个模型",{n:o.length})}}},AG={id:"set_model_mapping",label:r("设置模型映射 ID"),kind:"write",desc:"给模型新增或删除映射名(对外名)。同一对外名可以在多个提供商各挂一条:下游用同一个名字请求,网关按账号优先级主备切换;也可以给不同家的同名模型各加前缀(如 ca/claude-sonnet-4.5)来精确指定某一家。一次可以改多条。删掉的映射名只是不再对外可用,不删任何模型。",params:{type:"object",properties:{items:{type:"array",description:"要改的映射列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"上游模型 ID"},alias:{type:"string",description:"要新增 / 删除的映射名(对外名)"},action:{type:"string",enum:["add","remove"],description:"add = 新增映射,remove = 删除映射"}},required:["provider","id","alias","action"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(d=>at(d.action)!=="remove").length,o=t.length-a,c=[];return a&&c.push(r("新增 {n} 条",{n:a})),o&&c.push(r("删除 {n} 条",{n:o})),{lead:r("将改动 {n} 条映射({parts}):",{n:t.length,parts:c.join("、")}),table:{head:[r("提供商"),r("上游模型"),r("操作"),r("映射名")],rows:t.map(d=>[at(d.provider),at(d.id),at(d.action)==="remove"?r("删除"):r("新增"),at(d.alias)])},note:r("只改映射名,不动上游模型 ID;映射立即生效(新对话即可用)。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=at(c.alias,128);if(!d||!f||!p)throw new Error(r("参数不完整(需要 provider / id / alias)"));at(c.action)==="remove"?(await t.removeModelMapping?.(p,f,d),o.push(`删除 ${p} → ${d}/${f}`)):(await t.addModelMapping?.(p,f,d),o.push(`新增 ${p} → ${d}/${f}`))}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已改动 {n} 条映射",{n:o.length})}}},EO=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],ej={maxInputTokens:"上下文窗口",maxOutputTokens:"最大输出 Token",supportsToolCall:"工具调用",supportsImages:"图片识别",supportsVideo:"视频识别",supportsReasoning:"深度推理"},RG={id:"set_model_capability",label:r("修改模型能力"),kind:"write",desc:"修改某个模型对下游声明的能力位:上下文窗口、最大输出 Token、工具调用 / 图片 / 视频 / 深度推理四个布尔位。只传要改的键;布尔位给 null 表示恢复上游原值。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},capabilities:{type:"object",description:"要改的能力位(只写要改的键)",properties:{maxInputTokens:{type:["number","null"],description:"上下文窗口(token 数)"},maxOutputTokens:{type:["number","null"],description:"最大输出 token 数"},supportsToolCall:{type:["boolean","null"],description:"是否支持工具调用;null = 恢复上游原值"},supportsImages:{type:["boolean","null"],description:"是否支持图片识别;null = 恢复上游原值"},supportsVideo:{type:["boolean","null"],description:"是否支持视频识别;null = 恢复上游原值"},supportsReasoning:{type:["boolean","null"],description:"是否支持深度推理;null = 恢复上游原值"}}}},required:["provider","id","capabilities"]},plan:e=>{const t=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},a=EO.filter(o=>o in t);return{lead:r("将修改 {model} 的 {n} 项能力:",{model:`${at(e.provider)} / ${at(e.id)}`,n:a.length}),table:{head:[r("能力"),r("改成")],rows:a.map(o=>{const c=t[o],d=c===null?r("恢复上游原值"):typeof c=="boolean"?r(c?"支持":"不支持"):String(c);return[ej[o]||o,d]})},note:r("能力位决定下游看到的声明(能不能贴图、能塞多少上下文),不改上游的真实行为。")}},run:async e=>{const t=at(e.provider),a=at(e.id),o=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},c={};for(const d of EO){if(!(d in o))continue;const f=o[d];if(f===null){c[d]=null;continue}if(d==="maxInputTokens"||d==="maxOutputTokens"){const p=Bf(f);if(p===void 0)throw new Error(r("{key} 需要数字",{key:ej[d]}));c[d]=Math.round(p)}else{const p=Ui(f);if(p===void 0)throw new Error(r("{key} 需要 true / false / null",{key:ej[d]}));c[d]=p}}if(!t||!a||!Object.keys(c).length)throw new Error(r("参数不完整(需要 provider / id / capabilities)"));return await Ja().setModelCapabilities?.(t,a,c),Su(),{text:JSON.stringify({ok:!0,provider:t,id:a,capabilities:c}),summary:r("已修改 {n} 项能力",{n:Object.keys(c).length})}}},OG={id:"test_model",label:r("发起模型测试"),kind:"run",desc:"对某个模型发一次真实的对话请求,回报连通性、耗时与首字延迟。会消耗该账号的额度。回答「这个模型通不通 / 快不快」时用它。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},prompt:{type:"string",description:"测试用的用户提示词;不填 = 默认一句问候(最小请求)"}},required:["provider","id"]},plan:e=>({lead:r("将对 {model} 发起一次真实请求:",{model:`${at(e.provider)} / ${at(e.id)}`}),table:{head:[r("项"),r("值")],rows:[[r("提示词"),at(e.prompt)||r("(默认问候)")],[r("代价"),r("消耗该账号额度")]]},note:r("这是真实的上游请求,与生产走同一条链路(会记账,报表排除)。")}),run:async e=>{const t={provider:at(e.provider),model:at(e.id)},a=at(e.prompt,4e3);a&&(t.prompt=a);const o=await Ja().testModel?.(t),c=String(o?.status??""),d=o?.success===!0,f={ok:d,status:c,error:o?.error??null,reply:String(o?.reply??"").slice(0,1500),duration_ms:o?.duration_ms??null,ttfb_ms:o?.ttfb_ms??null,account:o?.account_name??null};return{text:JSON.stringify(f).slice(0,6e3),summary:d?r("连通 · {ms}ms",{ms:String(f.duration_ms??"")}):r("失败 · {status}",{status:c||"—"})}}},MG={id:"set_provider_order",label:r("调整提供商顺位"),kind:"write",desc:"调整某个提供商在账号全局队列里的**整组顺位**(第几组),决定路由时先试哪一家。这一家的所有账号会作为一整块移动。位置从 1 开始数。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},position:{type:"number",description:"目标组顺位(1 = 最前)"}},required:["provider","position"]},plan:e=>({lead:r("将把「{provider}」整组移到第 {position} 顺位:",{provider:at(e.provider)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交(后端按新顺序重编优先级),移动会连带调整其它组的相对次序。")}),run:async e=>{const t=at(e.provider).toLowerCase(),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 provider / position)"));const o=await jg(),c=[];for(const h of o){const b=at(h.id),y=at(h.provider).toLowerCase();if(!b)continue;const v=c[c.length-1];v&&v.provider===y?v.ids.push(b):c.push({provider:y,ids:[b]})}const d=c.findIndex(h=>h.provider===t);if(d<0)throw new Error(r("没有找到提供商「{provider}」的账号",{provider:t}));const f=Math.max(0,Math.min(c.length-1,Math.round(a)-1)),[p]=c.splice(d,1);return c.splice(f,0,p),await Ja().reorderAccounts?.(c.flatMap(h=>h.ids)),Su(),{text:JSON.stringify({ok:!0,provider:t,from:d+1,to:f+1,moved:p.ids.length}),summary:r("已移到第 {n} 顺位",{n:f+1})}}},DG={id:"set_account_order",label:r("调整账号优先级"),kind:"write",desc:"把某个账号移动到账号全局队列的第 N 顺位(1 = 最前)。位置决定主备与切换顺序:越靠前越先被使用。",params:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},position:{type:"number",description:"目标顺位(1 = 最前)"}},required:["account","position"]},plan:e=>({lead:r("将把账号「{account}」移到第 {position} 顺位:",{account:at(e.account)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交;位置越靠前,路由时越先被选中。")}),run:async e=>{const t=at(e.account,128),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 account / position)"));const o=await jg(),c=Jw(o,t),d=at(c.id),f=o.map(b=>at(b.id)).filter(Boolean),p=f.indexOf(d);if(p<0)throw new Error(r("账号不在当前队列里"));f.splice(p,1);const h=Math.max(0,Math.min(f.length,Math.round(a)-1));return f.splice(h,0,d),await Ja().reorderAccounts?.(f),Su(),{text:JSON.stringify({ok:!0,account:Hf(c),from:p+1,to:h+1}),summary:r("已移到第 {n} 顺位",{n:h+1})}}},IG={id:"set_account_enabled",label:r("启用 / 禁用账号"),kind:"write",desc:"开启或关闭某几个账号的转发资格。禁用只是把它移出队列(余额仍可查),但**如果某条线路只剩它**,禁用会直接断供。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的账号列表",items:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["account","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(o=>Ui(o.enabled)===!1).length;return{lead:r("将修改 {n} 个账号的启用状态(其中禁用 {k} 个):",{n:t.length,k:a}),table:{head:[r("账号"),r("改成")],rows:t.map(o=>[at(o.account),Ui(o.enabled)===!1?r("禁用"):r("启用")])},note:r("禁用会把账号移出转发队列;若这条线路没有别的可用账号,请求会直接失败。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=await jg(),c=[];for(const d of a){const f=Ui(d.enabled);if(f===void 0)throw new Error(r("参数不完整(需要 account / enabled)"));const p=Jw(o,at(d.account,128));await t.updateAccount?.(at(p.id),{enabled:f}),c.push(`${f?"启用":"禁用"} ${Hf(p)}`)}return Su(),{text:JSON.stringify({ok:!0,changed:c}),summary:r("已修改 {n} 个账号",{n:c.length})}}},Sg=[CG,TG,EG,AG,RG,OG,MG,DG,IG];function tj(e){return Sg.find(t=>t.id===e)}function PG(e){return Sg.filter(t=>e[t.id]).map(t=>({type:"function",function:{name:t.id,description:t.desc,parameters:t.params}}))}r("获取模型列表"),r("读各提供商的模型清单、映射名与启用状态。"),r("查询账号余额"),r("读各账号的额度 / 剩余用量。"),r("启用 / 禁用模型"),r("开关模型的对外可用性,不改其它属性。"),r("设置模型映射 ID"),r("新增 / 删除映射名,支持批量加前缀与同名合并到多家。"),r("修改模型能力"),r("改上下文窗口 / 最大输出 Token / 工具调用等能力位。"),r("发起模型测试"),r("对指定模型发一次真实请求,回报连通性与耗时。"),r("调整提供商顺位"),r("改某一家的整组顺位(先试哪一家)。"),r("调整账号优先级"),r("改账号在全局队列里的名次,决定主备与切换顺序。"),r("启用 / 禁用账号"),r("禁用会把账号移出转发队列,线路可能因此断供。");const AO=12;function Uf(e,t){return window.wbIcons?.icon?.(e,t)||""}function _G(e){const t=window.wbMarkdown;return t?.render?t.render(e):e.replace(/[&<>]/g,a=>({"&":"&","<":"<",">":">"})[a]||a)}function LG({tone:e}){return e==="plain"?s.jsx("span",{className:"asst-tc-ico",dangerouslySetInnerHTML:{__html:Uf("spark",13)}}):s.jsx("span",{className:Ue("asst-tc-ico",e),children:e==="warn"?"!":"✕"})}function zG({item:e,onConfirm:t}){const a=tj(e.call.name),o=a?.label||e.call.name,c=Ww(e.call.arguments),d=Object.keys(c).length?JSON.stringify(c,null,2):"";return s.jsxs("div",{className:Ue("asst-tool-card",e.state==="confirm"&&"confirm",e.state==="confirm"&&a?.kind==="run"&&"danger",e.state==="failed"&&"failed",e.state==="running"&&"running"),children:[s.jsxs("div",{className:"asst-tc-head",children:[e.state==="running"?s.jsx("span",{className:"asst-tc-ico",children:s.jsx("span",{className:"spin"})}):s.jsx(LG,{tone:e.state==="failed"?"bad":e.state==="confirm"?"warn":"plain"}),s.jsx("span",{className:"asst-tc-name",children:o}),e.state==="confirm"&&s.jsx("span",{className:"badge tag warn",children:r("待确认")}),e.state==="done"&&s.jsxs("span",{className:"asst-tc-state",children:["✓ ",e.summary||r("完成")]}),e.state==="failed"&&s.jsx("span",{className:"asst-tc-state bad",children:r("失败")}),e.state==="cancelled"&&s.jsx("span",{className:"asst-tc-state plain",children:r("已取消")})]}),e.state==="confirm"&&e.plan&&s.jsxs("div",{className:"asst-tc-plan",children:[e.plan.lead,e.plan.table&&s.jsxs("table",{className:"asst-mini-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.plan.table.head.map((f,p)=>s.jsx("th",{children:f},p))})}),s.jsx("tbody",{children:e.plan.table.rows.slice(0,20).map((f,p)=>s.jsx("tr",{children:f.map((h,b)=>s.jsx("td",{className:b===f.length-1?"mono hl":"",children:h},b))},p))})]}),e.plan.table&&e.plan.table.rows.length>20&&s.jsx("div",{className:"hint",children:r("(仅显示前 20 条,共 {n} 条)",{n:e.plan.table.rows.length})}),e.plan.note&&s.jsx("div",{className:"hint",children:e.plan.note})]}),e.state==="failed"&&e.error&&s.jsx("div",{className:"asst-tc-error",children:e.error}),e.state==="done"&&e.detail&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看结果")}),s.jsx("pre",{className:"asst-tc-json",children:e.detail})]}),e.state!=="confirm"&&d&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看参数")}),s.jsx("pre",{className:"asst-tc-json",children:d})]}),e.state==="confirm"&&s.jsxs("div",{className:"asst-tc-foot",children:[s.jsx("span",{className:Ue("hint",a?.kind==="run"&&"danger"),children:a?.kind==="run"?r("这会真实发起上游请求并消耗额度"):r("确认后立即生效")}),s.jsx(se,{size:"sm",variant:a?.kind==="run"?"destructive":"default",onClick:()=>t(!0),children:r("执行")}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(!1),children:r("取消")})]})]})}function BG(){const[e,t]=x.useState(null),[a,o]=x.useState([]),[c,d]=x.useState([]),[f,p]=x.useState(!1),[h,b]=x.useState(!1),[y,v]=x.useState(""),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=x.useRef([]),T=x.useRef([]),D=x.useRef(null),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useRef(0),P=x.useRef(null),O=x.useRef(0),_=x.useCallback(()=>{d(k.current.slice())},[]);x.useEffect(()=>{const M=A.current;if(!M)return;M.scrollHeight-M.scrollTop-M.clientHeight<160&&(M.scrollTop=M.scrollHeight)},[c]);const L=x.useCallback(async()=>{if(!R.current){R.current=!0;try{const M=await jG();t(M),N(!1),I.current=0}catch(M){N(!0),j(r("加载助手设置失败:{message}",{message:ku(M)})),I.current<3&&(I.current+=1,R.current=!1,setTimeout(()=>{L()},4e3))}try{o(await wG())}catch(M){j(U=>U||r("读取模型清单失败:{message}",{message:ku(M)}))}}},[]);x.useEffect(()=>{const M=window;return M.wbAssistant={activate:()=>{L()}},L(),()=>{delete M.wbAssistant}},[L]);const H=x.useMemo(()=>{const M={};for(const U of Sg)M[U.id]=e?.tools?.[U.id]??!1;return M},[e]),B=x.useMemo(()=>PG(H),[H]),z=Object.values(H).filter(Boolean).length,Q=e?.model??null,K=x.useCallback(async(M,U,Z)=>{for(let ae=U;ae{if(O.current>=AO){k.current.push({kind:"notice",text:r("这一轮来回已达 {n} 次上限,我先停下等你指示(可以换个说法,或拆成几步让我做)。",{n:AO}),bad:!0}),_();return}O.current+=1,p(!0),j("");const M=new AbortController;C.current=M;const U=k.current.push({kind:"bot",text:"",streaming:!0})-1;_();let Z=[],ae=!1;try{await kG({messages:T.current,tools:B,signal:M.signal,onEvent:ie=>{if(ie.type==="delta"){const ge=k.current[U];ge&&ge.kind==="bot"&&(k.current[U]={...ge,text:ge.text+ie.text},_())}ie.type==="toolCalls"&&(Z=ie.calls)}})}catch(ie){ae=!0;const ge=ku(ie),ee=k.current[U],fe=ee&&ee.kind==="bot"?ee.text:"";fe?k.current[U]={kind:"bot",text:fe}:k.current.splice(U,1);const te=M.signal.aborted;k.current.push({kind:"notice",text:te?r("已停止这次回答。"):r("请求失败:{message}",{message:ge}),bad:!te}),_()}finally{C.current=null}if(ae){p(!1);return}const ce=k.current[U];ce&&ce.kind==="bot"&&(k.current[U]={...ce,streaming:!1});const J=ce&&ce.kind==="bot"?ce.text:"";if(T.current.push({role:"assistant",content:J,toolCalls:Z.length?Z:void 0}),_(),!Z.length){p(!1);return}await K(Z,0,[])},[B,K,_]);P.current=X;const q=x.useCallback(async M=>{const U=D.current;if(!U)return;D.current=null,b(!1);const Z=U.calls[U.index],ae=tj(Z.name),ce=Ww(Z.arguments);if(!M||!ae)k.current[U.cardIndex]={kind:"tool",call:Z,state:"cancelled"},U.collected.push({toolCallId:Z.id,content:"用户取消了这次操作,没有做任何改动。"}),_();else{k.current[U.cardIndex]={kind:"tool",call:Z,state:"running"},p(!0),_();try{const J=await ae.run(ce);k.current[U.cardIndex]={kind:"tool",call:Z,state:"done",summary:J.summary,detail:J.text},U.collected.push({toolCallId:Z.id,content:J.text})}catch(J){const ie=ku(J);k.current[U.cardIndex]={kind:"tool",call:Z,state:"failed",error:ie},U.collected.push({toolCallId:Z.id,content:`工具执行失败:${ie}`})}_()}await K(U.calls,U.index+1,U.collected)},[K,_]),$=x.useCallback(async M=>{const U=M.trim();if(!(!U||f||h)){if(O.current=0,k.current.push({kind:"user",text:U}),T.current.push({role:"user",content:U}),v(""),_(),!e){k.current.push({kind:"notice",text:r("助手设置没读出来,现在还不能发消息 —— 看输入框下方的提示。"),bad:!0}),_();return}if(!e.model){k.current.push({kind:"notice",text:r("还没有选择对话模型:先在下方选一个(或去「设置 → AI 助手」里选)。"),bad:!0}),_();return}await X()}},[h,f,e,X,_]),Y=x.useCallback(()=>{C.current?.abort()},[]),F=x.useCallback(()=>{C.current?.abort(),D.current=null,k.current=[],T.current=[],b(!1),p(!1),j(""),_()},[_]),G=x.useCallback(async M=>{if(!M)return;if(!e){j(r("助手设置没读出来,暂时存不了对话模型 —— 看输入框下方的提示。"));return}const U={...e,model:M};t(U);try{await SG(U)}catch(Z){j(r("保存对话模型失败:{message}",{message:ku(Z)}))}},[e]),W=f||h,le=x.useRef(null);return s.jsxs("div",{className:"asst-layout",children:[s.jsxs("div",{className:"asst-top",children:[s.jsxs(ft,{value:Q??"",onValueChange:M=>{G(String(M))},children:[s.jsx(mt,{className:"asst-model-pick","aria-label":r("对话模型"),children:s.jsx(pt,{children:Q?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:Ue("dot","ok")}),s.jsx("span",{className:"mono",children:Q})]}):r("选择模型…")})}),s.jsxs(ht,{children:[a.length===0&&s.jsx(qe,{value:"none",disabled:!0,children:r("没有可用的模型")}),a.map(M=>s.jsx(qe,{value:M,children:M},M))]})]}),s.jsx("span",{className:"asst-top-hint",children:r("助手走本地网关,消耗所选账号的额度")}),s.jsx("span",{className:"spacer"}),s.jsx(se,{variant:"ghost",size:"sm",onClick:F,disabled:f||h||!c.length,children:r("新对话")})]}),s.jsxs("div",{className:"asst-scroll",ref:A,children:[c.length===0&&s.jsxs("div",{className:"asst-empty",children:[s.jsx("div",{className:"empty-logo",dangerouslySetInnerHTML:{__html:Uf("spark",26)||""}}),s.jsx("h3",{children:r("AI 助手")}),s.jsxs("p",{children:[r("用一句话让我查或改本机的模型转发配置。"),s.jsx("br",{}),r("我会在动手前把改动列给你确认。")]}),s.jsx("div",{className:"asst-suggests",children:[r("看看哪些模型在多家重复了"),r("测一下当前最快的模型通不通"),r("CodeArts 的账号余额还剩多少?"),r("把重复的模型加上家名前缀区分开")].map(M=>s.jsxs("button",{type:"button",onClick:()=>{$(M)},children:["“",M,"”"]},M))}),e!==null&&z===0&&s.jsx("div",{className:"asst-empty-warn",children:r("当前一个工具都没勾选,助手只能纯聊天。去「设置 → AI 助手 → 工具」里勾上需要的工具。")}),S&&s.jsx("div",{className:"asst-empty-warn bad",children:w||r("助手设置读取失败,工具可能已过时。")})]}),c.map((M,U)=>M.kind==="user"?s.jsx("div",{className:"asst-msg user",children:s.jsx("div",{className:"bubble",children:M.text})},U):M.kind==="bot"?!M.text&&M.streaming?s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsx("div",{className:"body",children:s.jsx("span",{className:"spin"})})]},U):s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsxs("div",{className:"body",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:_G(M.text)}}),M.streaming&&s.jsx("span",{className:"asst-caret"})]})]},U):M.kind==="notice"?s.jsx("div",{className:"asst-msg bot",children:s.jsx("div",{className:Ue("asst-empty-warn",M.bad&&"bad"),style:{margin:0},children:M.text})},U):s.jsx(zG,{item:M,onConfirm:Z=>{q(Z)}},U))]}),s.jsxs("div",{className:"asst-composer",children:[s.jsxs("div",{className:"asst-ta-wrap",children:[s.jsx(Qc,{ref:le,rows:1,value:y,placeholder:r(W?"等这一轮跑完…":"直接说要改什么 / 查什么…(Enter 发送,Shift+Enter 换行)"),disabled:W,onChange:M=>{v(M.currentTarget.value);const U=M.currentTarget;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,132)}px`},onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing&&(M.preventDefault(),$(y))}}),f?s.jsx("button",{type:"button",className:"asst-send stop",title:r("停止"),onClick:Y,children:"■"}):s.jsx("button",{type:"button",className:"asst-send",title:r("发送"),disabled:W||!y.trim(),onClick:()=>{$(y)},children:"➤"})]}),s.jsxs("div",{className:"asst-composer-foot",children:[s.jsxs("span",{className:"tools-state",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("settings",12)||""}}),r("已注入 {n} / {total} 个工具 · 系统提示词:{state}",{n:z,total:Sg.length,state:e?.systemPromptEnabled?r("开"):r("关")})]}),s.jsx("span",{className:"spacer"}),w?s.jsxs("span",{className:"hint",children:[w,S&&s.jsx("button",{type:"button",className:"asst-tc-more",onClick:()=>{L()},children:r("重试")})]}):Q?s.jsx("span",{className:"hint",children:r("回复由 {model} 生成 · 走本地网关",{model:Q})}):null]})]})]})}const RO='.page[data-page="assistant"]';let nj=null;function OO(){if(nj)return;const e=document.querySelector(RO);e&&(e.replaceChildren(),nj=vn.createRoot(e),nj.render(s.jsx(BG,{})))}document.querySelector(RO)?OO():document.addEventListener("DOMContentLoaded",OO,{once:!0}),Zw().catch(()=>{});function Ir(){return Pe().workbuddyDesktop??{}}function MO(){return window}const DO="workbuddy-desktop-checkin-tab",HG=["center","schedule","records"];function UG(){try{const e=localStorage.getItem(DO);return HG.includes(e)?e:"center"}catch{return"center"}}function IO(e){if(e!==gs.tab){try{localStorage.setItem(DO,e)}catch{}Js({tab:e})}}async function Ng(e){IO(e),gs.loaded||await Ol()}let gs={version:0,tab:UG(),snapshot:null,loaded:!1,loadError:"",expanded:new Set,runningAll:!1,autoSaving:!1,autoTimeDraft:null,keepaliveSaving:!1,keepaliveDraft:null,signing:new Set,onboarding:new Map,growth:new Map};const sj=new Set;function VG(){for(const e of sj)e()}function Js(e){gs={...gs,...e,version:gs.version+1},VG()}function ur(){return gs}function PO(e){return sj.add(e),()=>sj.delete(e)}function FG(e){const t=typeof e?.key=="string"?e.key:"";return t?{key:t,title:typeof e.title=="string"&&e.title?e.title:t,group:typeof e.group=="string"&&e.group?e.group:"",points:Number(e.points)||0,done:e.done===!0,blocked:e.blocked===!0}:null}function rj(e){return(Array.isArray(e)?e:[]).map(FG).filter(a=>a!==null)}function us(e){return Number(e)||0}async function Ol(){try{const e=await Ir().getCheckinCenter?.();if(!e)throw new Error(r("后端未返回签到中心数据"));Js({snapshot:e,loaded:!0,loadError:"",autoTimeDraft:null,keepaliveDraft:null}),$G(e.extras?.onboarding??[])}catch(e){Js({loaded:!0,loadError:ut(e)})}}function $G(e){for(const t of e){const a=t.settled;if(!a||typeof a!="object")continue;const o=gs.onboarding.get(t.id);if(o?.status==="loaded"&&o.unclaimed>0)continue;const c=rj(a.tasks),d=us(a.at);Co(t.id,{status:"loaded",error:void 0,checkedAt:void 0,settled:!0,settledAt:d>0?d:void 0,tasks:c,unclaimed:0,earned:us(a.earned),total:us(a.total)})}}function _O(e){const t=new Set(gs.expanded);t.has(e)?t.delete(e):t.add(e),Js({expanded:t})}function aj(e){const t=`onb:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}function LO(e){return gs.expanded.has(`onb:${e}`)}async function qG(){if(!gs.runningAll){Js({runningAll:!0});try{const e=await Ir().runAutoCheckinNow?.();if(e){const t=us(e.succeeded),a=us(e.active),o=us(e.total),c=us(e.failedCount),d=a>0?r(",日活保活 {n} 个",{n:a}):"";c>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:t,total:o,active:d,failed:c}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:t,total:o,active:d})),MO().wbAccountsView?.refreshUsageAfterCheckin?.(null)}}catch(e){Le(r("签到失败:{error}",{error:ut(e)}),"err")}finally{Js({runningAll:!1}),await Ol(),zO(ur().snapshot?.extras.onboarding??[]),Pe().wbApp?.refresh?.()}}}async function kg(e,t="checkin"){const a=`${e}:${t}`;if(gs.signing.has(a))return;const o=new Set(gs.signing);o.add(a),Js({signing:o});try{let c;t==="checkin"?c=(await Ir().checkinAllAccounts?.(e))?.results?.[0]:c=await Ir().runCheckinActivity?.(e,t)??void 0;const d=c?.claim,f=c?.activity,p=f?.report?.succeeded===!0,h=f?.webConversation?.succeeded===!0;c?.error?Le(r("签到失败:{error}",{error:String(c.error)}),"err"):t==="keepalive"?f?.pokeSucceeded===!0||h||p?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成")})):Le(d?.msg||r("活跃保活失败"),"err"):d?.success===!0?Le(r("✅ {message}",{message:d.msg||r("签到成功")})):d?.alreadyCompleted===!0?Le(d?.msg||r("今日已领取"),"err"):p?Le(r("✅ {message}",{message:d?.msg||r("活跃上报完成,但活动未开启")})):f?.pokeSucceeded===!0||h?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成,但活动未开启")})):Le(d?.msg||r("未领取"),"err"),MO().wbAccountsView?.refreshUsageAfterCheckin?.(e)}catch(c){Le(r("签到失败:{error}",{error:ut(c)}),"err")}finally{const c=new Set(ur().signing);c.delete(a),Js({signing:c}),await Ol();const d=(ur().snapshot?.extras.onboarding??[]).filter(f=>f.id===e);zO(d),Pe().wbApp?.refresh?.()}}function Cg(e){Js({keepaliveDraft:e.map(t=>t.trim()).filter(Boolean)})}async function GG(e){const t=e.map(a=>a.trim()).filter(Boolean);if(!ur().keepaliveSaving){Js({keepaliveSaving:!0});try{const a=await Ir().saveCheckinKeepalive?.(t);if(a){const o=ur().snapshot;Js({snapshot:o&&{...o,keepalive:a},keepaliveDraft:null}),Le(r("已保存:保活模型链"))}}catch(a){Le(r("保存失败:{error}",{error:ut(a)}),"err")}finally{Js({keepaliveSaving:!1})}}}async function zO(e){for(const t of e)KG(t.id)||await lj(t.id);for(const t of e){const a=ur().onboarding.get(t.id);a?.status!=="loaded"||a.claiming||a.settled||(t.provider==="officeace"||a.unclaimed>0)&&await BO(t.id)}}function KG(e){return gs.onboarding.get(e)?.settled===!0}function Cu(e){return gs.onboarding.get(e)??{status:"idle",tasks:[],unclaimed:0,earned:0,total:0,claiming:!1}}function Co(e,t){const a=new Map(gs.onboarding);a.set(e,{...Cu(e),...t}),Js({onboarding:a})}async function lj(e,t){const a=Cu(e);if(!(a.status==="loading"||a.claiming)){Co(e,{status:"loading",error:void 0,settled:!1});try{const o=await Ir().getOnboardingTasks?.(e,t?.refresh===!0),c=rj(o?.tasks),d=o?.settled===!0;Co(e,{status:"loaded",checkedAt:Date.now(),tasks:c,unclaimed:c.filter(f=>!f.done&&!f.blocked).length,earned:us(o?.earned),total:us(o?.total),settled:d,settledAt:d&&us(o?.settledAt)||void 0}),t?.expand===!0&&c.length>0&&!LO(e)&&aj(e)}catch(o){Co(e,{status:"error",error:ut(o),settled:!1})}}}async function BO(e){const t=Cu(e);if(!(t.claiming||t.status!=="loaded")){Co(e,{claiming:!0});try{Co(e,{tasks:Cu(e).tasks.map(v=>v.done?v:{...v,claiming:!0,error:void 0})});const a=await Ir().claimOnboardingTasks?.(e),o=new Map,c=Array.isArray(a?.results)?a.results:[];for(const v of c){const w=typeof v?.key=="string"?v.key:"";w&&v?.ok!==!0&&o.set(w,String(v?.error||r("领取失败")))}const d=rj(a?.tasks),f=(d.length?d:Cu(e).tasks).map(v=>({...v,claiming:!1,error:o.get(v.key)})),p=f.filter(v=>v.done&&!o.has(v.key)).length,h=a?.settled===!0;Co(e,{claiming:!1,checkedAt:Date.now(),tasks:f,unclaimed:f.filter(v=>!v.done&&!v.blocked).length,earned:us(a?.earned),total:us(a?.total),settled:h,settledAt:h&&us(a?.settledAt)||void 0});const b=f.filter(v=>v.error&&!v.done).length,y=typeof a?.message=="string"?a.message.trim():"";b?Le(r("新手福利有 {n} 项领取失败,可重试",{n:b}),"err"):y?Le(y,"ok"):p&&Le(r("✅ 新手福利领取完成,累计 {n} 积分",{n:us(a?.earned)}))}catch(a){const o=ut(a);Co(e,{claiming:!1,tasks:Cu(e).tasks.map(c=>({...c,claiming:!1,error:c.done?void 0:o}))}),Le(r("领取失败:{error}",{error:o}),"err")}finally{await Ol()}}}function HO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,title:typeof o.title=="string"&&o.title?o.title:c,description:typeof o.description=="string"?o.description:"",status:typeof o.status=="string"?o.status:"",current:us(o.current),target:us(o.target),locked:o.locked===!0,unlockAt:o.unlockAt,supported:o.supported===!0,unforgeable:o.unforgeable===!0,unforgeableReason:typeof o.unforgeableReason=="string"?o.unforgeableReason:"",kind:typeof o.kind=="string"?o.kind:"",source:typeof o.source=="string"?o.source:""}:null}).filter(a=>a!==null)}function UO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,outcome:typeof o.outcome=="string"?o.outcome:"failed",message:typeof o.message=="string"?o.message:"",credit:us(o.credit),energy:us(o.energy)}:null}).filter(a=>a!==null)}function Vi(e){return gs.growth.get(e)??{status:"idle",energy:null,streak:null,tasks:[],travel:null,school:null,running:!1,runningSchool:!1,runningTravel:!1}}function Pr(e,t){const a=new Map(gs.growth);a.set(e,{...Vi(e),...t}),Js({growth:a})}function YG(e){return gs.expanded.has(`growth:${e}`)}function VO(e){const t=`growth:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}async function Tg(e){const t=Vi(e);if(!(t.status==="loading"||t.running)){Pr(e,{status:"loading",error:void 0});try{const a=await Ir().getGrowthStatus?.(e),o=a?.tasks??{},c=a?.travel??null,d=a?.school??null;Pr(e,{status:"loaded",checkedAt:Date.now(),energy:a?.energy===null||a?.energy===void 0?null:us(a.energy),streak:a?.streak===null||a?.streak===void 0?null:us(a.streak),tasks:HO(o.tasks),travel:c,school:d?{...d,tasks:HO(d.tasks)}:null,error:typeof o.error=="string"?o.error:void 0})}catch(a){Pr(e,{status:"error",error:ut(a)})}}}async function FO(e,t){const a=Vi(e);if(a.running)return;const o=(a.tasks??[]).filter(h=>!h.supported||h.unforgeable===!0||h.locked===!0?!1:t==="claim"?h.status==="completed"||h.current>=h.target&&h.status!=="claimed":h.status!=="claimed");if(o.length===0){Le(r("没有需要执行的任务"));return}Pr(e,{running:!0,results:[],error:void 0});let c=0,d=0,f=0,p=0;for(const h of o)try{const b=await Ir().runGrowthTask?.(e,h.code,t),y=UO([b])[0];y&&(Pr(e,{results:[...Vi(e).results??[],y]}),c+=y.credit??0,d+=y.energy??0,(y.outcome==="done"||y.outcome==="already")&&(f+=1),y.outcome==="failed"&&(p+=1))}catch(b){p+=1,Pr(e,{results:[...Vi(e).results??[],{code:h.code,outcome:"failed",message:ut(b),credit:0,energy:0}]})}Pr(e,{running:!1}),p>0?Le(r("成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}",{done:f,failed:p,credit:c,energy:d}),"err"):Le(r("✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}",{credit:c,energy:d})),await Tg(e)}async function XG(e,t){if(!Vi(e).runningSchool){Pr(e,{runningSchool:!0,error:void 0});try{const o=await Ir().runGrowthSchool?.(e,t),c=UO(o?.results),d=o?.lottery??null;Pr(e,{runningSchool:!1,results:c,schoolText:c.length?c.map(f=>`${f.code}:${f.message}`).join(";"):void 0,lotteryText:d?String(d.message??r("已抽 {n} 次",{n:us(d.drawn)})):void 0,checkedAt:Date.now()}),Le(d?r("开学季执行完成:{message}",{message:String(d.message??"")}):r("✅ 开学季任务执行完成")),await Tg(e)}catch(o){Pr(e,{runningSchool:!1,error:ut(o)}),Le(r("开学季执行失败:{error}",{error:ut(o)}),"err")}}}async function QG(e){if(!Vi(e).runningTravel){Pr(e,{runningTravel:!0,error:void 0});try{const a=await Ir().runGrowthTravel?.(e),o=String(a?.message??""),c=String(a?.outcome??"");Pr(e,{runningTravel:!1,checkedAt:Date.now()}),c==="failed"?Le(r("猫猫旅行失败:{message}",{message:o}),"err"):Le(r("猫猫旅行:{message}",{message:o})),await Tg(e)}catch(a){Pr(e,{runningTravel:!1,error:ut(a)}),Le(r("猫猫旅行失败:{error}",{error:ut(a)}),"err")}}}function ZG(e){return e.totalCount?e.doneCount>=e.totalCount?"done":e.doneCount>0?"part":"todo":"none"}function WG(e){const a=(Array.isArray(e?.schedules)?e.schedules:[]).filter(o=>o.enabled===!0).map(o=>Number(o.nextRunAt)).filter(o=>Number.isFinite(o)&&o>0);return a.length?Math.min(...a):null}let To={version:0,data:null,loaded:!1,loadError:"",saving:!1,runningId:null,editingId:null};const oj=new Set;function JG(){for(const e of oj)e()}function _r(e){To={...To,...e,version:To.version+1},JG()}function $O(){return To}function e7(e){return oj.add(e),()=>oj.delete(e)}function Tu(){return Pe().workbuddyDesktop??{}}async function qO(){try{const e=await Tu().getCheckinSchedules?.();if(!e)throw new Error(r("后端未返回定时签到数据"));_r({data:e,loaded:!0,loadError:""})}catch(e){_r({loaded:!0,loadError:ut(e)})}}function Eg(e){e&&_r({data:e,loadError:""}),Ol()}async function t7(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveAutoCheckin?.({enabled:e});Eg(t),Le(r(e?"✅ 定时签到已开启":"定时签到已关闭"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function GO(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveCheckinSchedule?.(e);Eg(t),_r({editingId:null}),Le(r("已保存:定时条目"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function n7(e,t){await GO({id:e.id,label:e.label??"",enabled:t,time:e.time??"",providers:Array.isArray(e.providers)?e.providers:[]})}async function s7(e){if(!To.saving){_r({saving:!0});try{await Tu().deleteCheckinSchedule?.(e),Eg(await Tu().getCheckinSchedules?.()),Le(r("已删除定时条目"))}catch(t){Le(r("删除失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function r7(e){if(!To.runningId){_r({runningId:e});try{const t=await Tu().runCheckinSchedule?.(e)??void 0,a=o=>Number(o)||0;if(t){const o=a(t.succeeded),c=a(t.active),d=a(t.total),f=a(t.failedCount),p=c>0?r(",日活保活 {n} 个",{n:c}):"";f>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:o,total:d,active:p,failed:f}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:o,total:d,active:p})),Eg(t)}}catch(t){Le(r("执行失败:{error}",{error:ut(t)}),"err")}finally{_r({runningId:null}),await Ol()}}}function ij(e){_r({editingId:e})}const a7=r("到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。");function l7(){const[e,t]=x.useState($O());return x.useEffect(()=>e7(()=>t($O())),[]),e}function o7(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function KO(e,t){const a=Array.isArray(e.providers)?e.providers:[];return t.filter(o=>a.includes(o.id)).map(o=>o.label)}function i7(e,t){const a=KO(e,t);return a.length?t.length>0&&a.length>=t.length?r("全部 {n} 家",{n:t.length}):a.join(r("、")):r("未勾选提供商")}function c7(e,t){const a=KO(e,t);return a.length?a.join(r("、")):r("未勾选提供商")}function u7(e){const t=e.lastResult;if(!t)return r("还没执行过");const a=f=>Number(f)||0,o=[r("成功 {n}",{n:a(t.succeeded)})],c=a(t.active);c>0&&o.push(r("保活 {n}",{n:c}));const d=a(t.failedCount);return d>0&&o.push(r("失败 {n}",{n:d})),`${t.at?Fs(t.at):"—"}${t.reason?` · ${t.reason}`:""} —— ${o.join(r(" · "))}`}function YO({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=e===null,[c,d]=x.useState(e?.label??""),[f,p]=x.useState(e?.time??"00:01"),[h,b]=x.useState(new Set(o?a.map(S=>S.id):e?.providers??[]));x.useEffect(()=>{o&&a.length>0&&b(new Set(a.map(S=>S.id)))},[]);const y=f.trim()!==""&&h.size>0,v=()=>b(new Set(a.map(S=>S.id))),w=()=>b(new Set),j=async()=>{await GO({id:e?.id,label:c.trim(),enabled:e?.enabled??!0,time:f.trim(),providers:a.map(S=>S.id).filter(S=>h.has(S))})};return s.jsxs("div",{className:"ck-sched-editor",children:[s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("名称")}),s.jsx("span",{className:"ck-set-v",children:s.jsx($e,{type:"text",className:"max-w-[220px]",placeholder:r("可选 · 缺省显示时刻"),value:c,disabled:t.saving,onChange:S=>d(S.currentTarget.value)})})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("每天时刻")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx($e,{type:"time",className:"w-[96px] max-w-[96px] font-mono tabular-nums",value:f,disabled:t.saving,onChange:S=>p(S.currentTarget.value)}),s.jsx("span",{className:"text-subtle text-xs",children:r("北京时间 · 错过时点开机后会自动补签")})]})]}),s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("签到范围")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("到点时逐个签到,已勾 {n} / {total} 家",{n:h.size,total:a.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving,onClick:v,children:r("全选")}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving||h.size===0,onClick:w,children:r("清空")})]}),s.jsx("div",{className:"ck-range",children:a.map(S=>s.jsxs("label",{className:"ck-range-item",children:[s.jsx(Mr,{checked:h.has(S.id),disabled:t.saving,onCheckedChange:N=>{const k=new Set(h);N===!0?k.add(S.id):k.delete(S.id),b(k)}}),s.jsx("span",{className:"ck-range-name",title:S.label,children:S.label})]},S.id))}),h.size===0?s.jsx("div",{className:"ck-mini-warn",children:r("至少勾一家才能保存(不勾等于这条条目不签到)")}):null]})]}),s.jsxs("div",{className:"ck-sched-actions",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.saving,onClick:()=>ij(null),children:r("取消")}),s.jsx(se,{size:"sm",variant:"default",disabled:!y||t.saving,onClick:()=>{j()},children:t.saving?r("保存中…"):r("保存")})]})]})}function d7({store:e}){return s.jsxs("div",{className:"ck-sched-row open ck-sched-row-new",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx("span",{className:"ck-new-dot","aria-hidden":!0,children:"+"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:r("新建定时条目")}),s.jsx("div",{className:"ck-prov-desc",children:r("填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)")})]})]}),s.jsx(YO,{entry:null,store:e})]})}function f7({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=t.editingId===e.id,c=t.runningId===e.id,d=t.data?.enabled===!0,f=Number(e.nextRunAt),p=async()=>{const h=Pe().wbConfirm?.ask;if(!h)return;const y=(e.displayLabel||e.time||e.id).replace(/&/g,"&").replace(//g,">");await h({title:r("删除定时条目"),html:r("确定删除「{name}」?删除后到点不再执行。",{name:y}),okText:r("删除"),okClass:"danger"})&&await s7(e.id)};return s.jsxs("div",{className:o?"ck-sched-row open":"ck-sched-row",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx(hs,{checked:e.enabled===!0,disabled:t.saving,onCheckedChange:h=>{n7(e,h===!0)}}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.displayLabel||e.time||e.id,e.enabled===!0?null:s.jsx(ze,{variant:"outline",shape:"tag",children:r("已停用")})]}),s.jsx("div",{className:"ck-prov-desc ck-sched-scope",title:c7(e,a),children:r("每天 {time} · {scope}",{time:e.time??"—",scope:i7(e,a)})}),s.jsx("div",{className:"ck-prov-desc",children:r("上次执行:{line}",{line:u7(e)})})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-sched-next",children:d&&e.enabled===!0&&Number.isFinite(f)&&f>0?r("下次 {date}",{date:Fs(f)}):"—"}),s.jsx(se,{size:"sm",variant:"ghost",disabled:c||t.runningId!==null,onClick:()=>{r7(e.id)},children:r(c?"执行中…":"立即执行")}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>ij(o?null:e.id),children:r(o?"收起":"编辑")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",disabled:t.saving,onClick:()=>{p()},children:r("删除")})]})]}),o?s.jsx(YO,{entry:e,store:t}):null]})}function p7(e,t){return e.length===t.length&&e.every((a,o)=>a===t[o])}let Vf=null;function m7(e,t){for(let a=0;ah!==t.row),d=m7(c,e.clientY);if(d===t.from)return;const f=[...t.list],[p]=f.splice(t.from,1);f.splice(d,0,p),t.list=f,t.from=d,t.onChange(f)}function Ff(){const e=Vf;Vf=null,window.removeEventListener("pointermove",XO),window.removeEventListener("pointerup",Ff),window.removeEventListener("pointercancel",Ff),document.body.classList.remove("ck-chain-dragging"),e?.row.classList.remove("dragging")}function h7(e,t,a,o){if(e.button!==0||Vf||a.length<2)return;const c=e.currentTarget.closest(".ck-chain-row");c&&(e.preventDefault(),Vf={list:[...a],from:t,row:c,onChange:o},c.classList.add("dragging"),document.body.classList.add("ck-chain-dragging"),window.addEventListener("pointermove",XO),window.addEventListener("pointerup",Ff),window.addEventListener("pointercancel",Ff))}function g7({models:e,defaultModels:t,dirty:a,saving:o}){const[c,d]=x.useState(""),f=()=>{const p=c.trim();if(p){if(e.includes(p)){Le(r("清单里已经有「{name}」",{name:p}),"err");return}Cg([...e,p]),d("")}};return s.jsxs("section",{className:"panel ck-chain-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("保活模型链")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:!a||o,onClick:()=>{GG(e)},children:r(o?"保存中…":"保存")})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("模型清单")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("按序逐个尝试,共 {n} 个",{n:e.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:o||t.length===0,title:r("把缺省链填进清单,再点「保存」生效"),onClick:()=>Cg([...t]),children:r("填入缺省链")})]}),s.jsxs("div",{className:"ck-chain",children:[e.map((p,h)=>s.jsxs("div",{className:"ck-chain-row",children:[s.jsx("span",{className:"ck-chain-grip",role:"button",tabIndex:-1,"aria-label":r("按住拖动调整顺序"),title:r("按住拖动,调整这个模型在链里的顺序"),onPointerDown:b=>h7(b,h,e,Cg),dangerouslySetInnerHTML:{__html:Pe().wbIcons?.icon?.("gripVertical",14)||""}}),s.jsx("span",{className:"ck-chain-name",title:p,children:p}),s.jsxs("span",{className:"ck-chain-index",children:["#",h+1]}),s.jsx("button",{type:"button",className:"ck-chain-del",disabled:o,"aria-label":r("移除 {name}",{name:p}),title:r("从清单里移除"),onClick:()=>Cg(e.filter((b,y)=>y!==h)),children:"×"})]},p)),e.length===0?s.jsx("div",{className:"ck-chain-empty",children:r("清单为空 —— 保存后恢复缺省链")}):null]}),s.jsxs("div",{className:"ck-chain-add",children:[s.jsx($e,{type:"text",className:"max-w-[260px] font-mono text-xs",placeholder:r("WorkBuddy 国际版保活模型,按顺序回退"),value:c,disabled:o,onChange:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}}),s.jsx(se,{size:"sm",variant:"outline",disabled:o||c.trim()==="",onClick:f,children:r("添加模型")}),a?s.jsx("span",{className:"ck-chain-dirty",children:r("有未保存的改动")}):null]})]})]}),s.jsx("div",{className:"ck-note",children:r("「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。",{defaults:t.join(r("、"))})})]})]})}function x7(){const e=l7(),t=o7();if(x.useEffect(()=>{qO()},[]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取定时签到数据…")})]});const a=e.data,o=a?.enabled===!0,c=Array.isArray(a?.schedules)?a.schedules:[],d=t.snapshot?.keepalive,f=Array.isArray(d?.models)?d.models:[],p=Array.isArray(d?.defaultModels)?d.defaultModels:[],h=t.keepaliveDraft,b=h??f,y=h!==null&&!p7(h,f);return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取定时签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{qO()},children:r("重试")})]}):null,s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("定时签到")}),s.jsx("span",{className:"tip-q","data-tip":a7}),s.jsx("span",{className:"panel-sub",children:r("每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签")}),s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto flex-none",disabled:e.saving,onClick:()=>ij(e.editingId==="new"?null:"new"),children:e.editingId==="new"?r("收起新建"):r("添加条目")})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("总开关")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(hs,{checked:o,disabled:e.saving,onCheckedChange:v=>{t7(v===!0)}}),s.jsx("span",{className:"text-subtle text-xs",children:r(o?"开着:启用的条目按各自时刻执行":"关着:所有条目都不执行")})]})]})}),s.jsxs("div",{children:[e.editingId==="new"?s.jsx(d7,{store:e}):null,c.map(v=>s.jsx(f7,{entry:v,store:e},v.id)),c.length===0?s.jsx("div",{className:"ck-empty",children:r("还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。")}):null]})]}),s.jsx(g7,{models:b,defaultModels:p,dirty:y,saving:t.keepaliveSaving})]})}const Ag="checkin-records",QO=["today","7","30","month","all"],Eu="all",b7=[{value:"today",label:r("今天")},{value:"7",label:r("7 天")},{value:"30",label:r("30 天")},{value:"month",label:r("本月")},{value:"all",label:r("全部")}],ZO="workbuddy-desktop-checkin-records-range";function Rg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function WO(e){const t=new Date;switch(e){case"today":return Rg(t);case"7":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Rg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function v7(){try{const e=localStorage.getItem(ZO);return e!==null&&QO.includes(e)?e:Eu}catch{return Eu}}function JO(e){try{localStorage.setItem(ZO,e)}catch{}}function eM(e){return typeof e=="number"&&e>0?e:du}const cj={success:{label:"成功领取",variant:"success"},already:{label:"今日已领",variant:"brand"},pending:{label:"等待窗口",variant:"warning"},failed:{label:"失败",variant:"destructive"}},y7={schedule:"定时",startup:"补签",manual:"手动",single:"单签",activity:"活动"},uj=[{key:"time",label:r("时间")},{key:"account",label:r("账号")},{key:"provider",label:r("提供商")},{key:"source",label:r("来源")},{key:"outcome",label:r("结果")},{key:"detail",label:r("说明")}];let dj=null;function tM(){return dj?dj.apply([...uj]):uj.map(e=>({...e,align:e.align??"left"}))}function nM(){window.wbTableColumns?.repaint?.(Ag)}function sM(e){return(ur().snapshot?.auto?.providerOptions??[]).find(a=>a.id===e)?.label??e}function w7(e,t){const a=`ck-col-${t.key} ta-${t.align}`;switch(t.key){case"time":return s.jsxs("td",{className:a,children:[e.ts?Fs(e.ts):"—",s.jsx("span",{className:"ck-record-date",children:e.date||""})]},t.key);case"account":return s.jsx("td",{className:a,children:e.accountName||e.accountId||"—"},t.key);case"provider":return s.jsx("td",{className:a,children:e.provider?sM(e.provider):"—"},t.key);case"source":return s.jsxs("td",{className:a,children:[s.jsx("span",{className:"ck-record-source",children:y7[e.source??""]??e.source??"—"}),e.reason?s.jsx("span",{className:"ck-record-reason",children:e.reason}):null]},t.key);case"outcome":{const o=cj[e.outcome??""]??{label:e.outcome||"—",variant:"outline"};return s.jsxs("td",{className:a,children:[s.jsx(ze,{variant:o.variant,shape:"tag",children:o.label}),e.keptActive?s.jsx(ze,{variant:"outline",shape:"tag",className:"ml-1",children:r("保活")}):null]},t.key)}case"detail":return s.jsx("td",{className:e.error?`${a} ck-record-detail-fail`:a,children:e.error||e.message||"—"},t.key);default:return null}}function j7(){const[e,t]=x.useState([]),[a,o]=x.useState(0),[c,d]=x.useState(1),[f,p]=x.useState(()=>v7()),[h,b]=x.useState(()=>eM(lg(Ag,rg))),[y,v]=x.useState({outcome:"",provider:"",keyword:""}),[w,j]=x.useState(""),[S,N]=x.useState(!1),[k,T]=x.useState(""),[D,C]=x.useState(0),A=x.useRef(null),R=x.useRef(0),[,I]=x.useReducer(Y=>Y+1,0),P=ur().snapshot?.auto?.providerOptions??[],O=tM(),_=Math.max(1,Math.ceil(a/h)),L=Math.min(c,_),H=y.outcome!==""||y.provider!==""||y.keyword!==""||f!==Eu,B=a?{start:(L-1)*h+1,end:Math.min(a,L*h)}:null,z=x.useCallback(async Y=>{const F=R.current+1;R.current=F,N(!0),T("");try{const W=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:Y.size,offset:(Y.page-1)*Y.size,outcome:Y.filters.outcome,provider:Y.filters.provider,keyword:Y.filters.keyword,start:WO(Y.range)});if(F!==R.current)return;t(Array.isArray(W?.records)?W.records:[]),o(Number(W?.total)||0)}catch(G){if(F!==R.current)return;T(G instanceof Error?G.message:String(G))}finally{F===R.current&&N(!1)}},[]);x.useEffect(()=>{z({page:c,size:h,range:f,filters:y})},[z,c,h,f,y]),x.useEffect(()=>{c>_&&d(_)},[c,_]),x.useLayoutEffect(()=>{const Y=Pe().wbColSettings;if(!Y?.register){const F=window.setTimeout(()=>C(G=>G+1),50);return()=>window.clearTimeout(F)}dj=Y.register({id:Ag,label:r("签到记录表"),columns:uj.map(F=>({key:F.key,label:F.label,align:F.align??"left"})),mount:()=>A.current,onChange:()=>{Cs.flushSync(()=>I()),nM()}}),I()},[D]),x.useLayoutEffect(()=>{nM()}),x.useEffect(()=>()=>{Pe().wbColSettings?.close()},[]);const Q=Y=>{v(Y),d(1)},K=Y=>{const F=QO.includes(Y)?Y:Eu;F!==f&&(JO(F),p(F),d(1))},X=Y=>{b(eM(Y)),og(Ag,Y),d(1)},q=()=>{j(""),JO(Eu),p(Eu),Q({outcome:"",provider:"",keyword:""})},$=async()=>{const Y=Pe().wbConfirm?.ask;if(!Y)return;const F=r(H?"确定清空当前筛选出的签到记录?清空后无法恢复。":"确定清空全部签到记录?清空后无法恢复。");if(await Y({title:r("清空签到记录"),html:F,okText:r("清空"),okClass:"danger"}))try{await Pe().workbuddyDesktop?.clearCheckinRecords?.(H?{outcome:y.outcome,provider:y.provider,keyword:y.keyword,start:WO(f)}:{all:"1"}),rM("签到记录已清空"),await z({page:1,size:h,range:f,filters:y}),d(1)}catch(G){rM(r("清空失败:{error}",{error:G instanceof Error?G.message:String(G)}),"err")}};return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("签到记录")}),s.jsx("span",{className:"panel-sub",children:r("每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准")}),s.jsxs("div",{ref:A,className:"ml-auto flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:S,onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r(S?"刷新中…":"刷新")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{$()},children:r("清空")})]})]}),s.jsxs("div",{className:"ck-records-filters",children:[s.jsx(In,{options:b7,value:f,onValueChange:K,"aria-label":r("签到记录时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:y.outcome,onValueChange:Y=>Q({...y,outcome:Y??""}),children:[s.jsx(mt,{className:"w-[128px] shrink-0","aria-label":r("按结果筛选"),children:s.jsx(pt,{children:y.outcome?cj[y.outcome]?.label??y.outcome:r("全部结果")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部结果")}),Object.entries(cj).map(([Y,F])=>s.jsx(qe,{value:Y,children:F.label},Y))]})]}),s.jsxs(ft,{value:y.provider,onValueChange:Y=>Q({...y,provider:Y??""}),children:[s.jsx(mt,{className:"w-[148px] shrink-0","aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:y.provider?sM(y.provider):r("全部提供商")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部提供商")}),P.map(Y=>s.jsx(qe,{value:Y.id,children:Y.label},Y.id))]})]}),s.jsx("div",{className:"spacer"}),s.jsx($e,{type:"search",className:"ck-records-search w-[200px] basis-[200px] min-w-[150px] grow-0 shrink",placeholder:r("搜账号 / 收益 / 错误 / 触发原因"),value:w,onChange:Y=>j(Y.currentTarget.value),onBlur:()=>{w!==y.keyword&&Q({...y,keyword:w.trim()})},onKeyDown:Y=>{Y.key==="Enter"&&Y.currentTarget.blur(),Y.key==="Escape"&&(j(y.keyword),Y.currentTarget.blur())}}),H?s.jsx(se,{size:"sm",variant:"ghost",onClick:q,children:r("清除筛选")}):null,s.jsx("span",{className:"panel-sub",children:S?r("读取中…"):r("{n} 条",{n:a})})]}),k?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到记录失败:{error}",{error:k})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r("重试")})]}):null,e.length===0&&!S?s.jsx("div",{className:"ck-empty",children:r(H?"没有符合筛选条件的签到记录":"还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。")}):s.jsx("div",{className:"ck-records-scroll",children:s.jsxs("table",{className:"ck-table ck-records-table",children:[s.jsx("colgroup",{children:O.map(Y=>s.jsx("col",{"data-col":Y.key,className:`ck-col-${Y.key}`},Y.key))}),s.jsx("thead",{children:s.jsx("tr",{children:O.map(Y=>s.jsx("th",{"data-col":Y.key,className:`ck-col-${Y.key} ta-${Y.align}`,children:Y.label},Y.key))})}),s.jsx("tbody",{children:e.map(Y=>s.jsx("tr",{children:O.map(F=>w7(Y,F))},Y.rowId))})]})}),s.jsx(Li,{total:a,range:B,page:L,pageCount:_,size:h,sizes:rg,onSizeChange:X,onPageChange:d,disabled:S})]})}function rM(e,t){Pe().wbApp?.toast?.(e,t)}window.wbCheckinRecords={visibleColumns:()=>tM().map(e=>({key:e.key}))};const aM={workbuddy:r("腾讯每日签到接口 · 仅国内版"),"workbuddy-intl":r("每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行"),raccoon:r("桌面端每日积分链路"),autoclaw:r("官方客户端的每日签到任务"),"autoclaw-intl":r("与国内版同一套任务接口 · 站点不同"),qoder:r("活动(campaign)领取 · 每天 10:00 刷新"),"qoder-intl":r("带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件"),trae:r("SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新"),loomy:r("无独立签到接口 · 每天替账号打一次首次登录积分"),kuku:r("「免费领积分」的每日任务 · 逐个领取"),officeace:r("一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证"),codearts:r("每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置"),modelscope:r("无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)"),"modelscope-intl":r("与国内版同一套链路 · 站点不同、令牌不通用")},S7=[{value:"center",label:r("签到中心")},{value:"schedule",label:r("定时签到")},{value:"records",label:r("签到记录")}];function N7(e){return e==="raccoon"?"小浣熊":e==="loomy"?"Loomy":e==="codearts"?"CodeArts":e==="officeace"?"OfficeAce 果办":e}function k7(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function C7({group:e}){const t=ZG(e);return t==="none"?s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")}):t==="done"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):t==="part"?s.jsx(ze,{variant:"warning",shape:"tag",children:r("部分")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}function $f({id:e,label:t}){const a=hg[e==="workbuddy-intl"?"workbuddy":e];return s.jsx("span",{className:"ck-prov-logo",children:a?s.jsx("img",{src:a,alt:""}):t.slice(0,1)||"·"})}function T7({group:e}){const t=ur().signing,a=(o,c)=>t.has(`${o}:${c}`);return s.jsxs("table",{className:"ck-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("账号")}),s.jsx("th",{children:r("今日签到")}),s.jsx("th",{children:r("上次签到时间")}),s.jsx("th",{"aria-label":r("操作")})]})}),s.jsx("tbody",{children:e.accounts.map(o=>{const c=e.id==="workbuddy-intl";return s.jsxs("tr",{children:[s.jsx("td",{children:o.name||o.id}),s.jsx("td",{children:o.checkedInToday?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}),s.jsx("td",{className:"text-subtle",children:o.checkinAt?Fs(o.checkinAt):"—"}),s.jsx("td",{className:"text-right",children:c?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"keepalive"),title:r("用免费模型与网页会话维持账号活跃 · 不领取奖励"),onClick:()=>{kg(o.id,"keepalive")},children:a(o.id,"keepalive")?r("保活中…"):r("保活")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"claim"),title:r("探测活动并领取日活奖励 · 不做保活"),onClick:()=>{kg(o.id,"claim")},children:a(o.id,"claim")?r("领取中…"):r("领取")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"full"),title:r("探测 + 领取 + 保活 · 与定时签到同一套组合"),onClick:()=>{kg(o.id,"full")},children:a(o.id,"full")?r("执行中…"):r("保活+领取")})]}):s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"checkin"),onClick:()=>{kg(o.id)},children:a(o.id,"checkin")?r("签到中…"):o.checkedInToday?r("重签"):r("签到")})})]},o.id)})})]})}function E7({group:e,expanded:t}){const a=e.totalCount>0;return s.jsxs("div",{className:t?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:()=>a&&_O(e.id),onKeyDown:o=>{a&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),_O(e.id))},role:a?"button":void 0,tabIndex:a?0:-1,"aria-expanded":a?t:void 0,children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:aM[e.id]??""})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-prov-count",children:a?r("{total} 账号 · {done} 已签",{total:e.totalCount,done:e.doneCount}):"—"}),s.jsx(C7,{group:e}),a?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),e.id==="qoder-intl"?s.jsx(lM,{}):null,t?s.jsx("div",{className:"ck-prov-detail",children:s.jsx(T7,{group:e})}):null]})}function lM(){const[e,t]=x.useState(null),a=x.useCallback(async()=>{try{t(await Ir().getQoderUmid?.()??null)}catch{}},[]);x.useEffect(()=>{a()},[a]);const o=e?.installing===!0&&e.available!==!0;if(x.useEffect(()=>{if(!o)return;const d=window.setInterval(()=>{a()},3e3);return()=>{window.clearInterval(d)}},[o,a]),!e||e.available)return null;const c=async()=>{try{t(d=>d&&{...d,installing:!0}),await Ir().installQoderUmid?.(),Pe().wbApp?.toast?.(r("✅ UMID 组件已安装,下轮签到即可领取国际版积分"))}catch(d){Pe().wbApp?.toast?.(r("UMID 组件安装失败:{error}",{error:d instanceof Error?d.message:String(d)}),"err")}finally{a()}};return s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-2.5 pl-[58px] pr-4 text-[12px] text-muted-foreground",children:[s.jsx("span",{children:r("国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。")}),e.installSupported?s.jsx(se,{variant:"outline",size:"sm",disabled:e.installing===!0,onClick:()=>{c()},children:e.installing?r("安装中…"):r("一键安装组件")}):s.jsx("span",{children:r("安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。")})]})}function A7({row:e}){const t=e.provider??"loomy",a=ur().onboarding.get(e.id),o=a?.tasks??[],c=a?.unclaimed??0,d=a?.status==="loaded"&&o.length>0,f=d&&LO(e.id);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>aj(e.id):void 0,onKeyDown:p=>{d&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),aj(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:t,label:N7(t)}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[a?.status==="loaded"?r("已领 {claimed}/{total} · 累计 {earned} 积分",{claimed:o.length-c,total:o.length,earned:a.total?`${a.earned} / ${a.total}`:a.earned}):r("尚未查询任务状态"),a?.settled&&a.settledAt?` · ${r("结算于 {time}",{time:Fs(a.settledAt)})}`:a?.checkedAt?` · ${r("查询于 {time}",{time:Fs(a.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:p=>p.stopPropagation(),children:[a?.status==="loaded"&&c>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项待领",{n:c})}):a?.status==="loaded"?s.jsx(ze,{variant:"success",shape:"tag",children:r("全部领取")}):a?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status==="loading"||a?.claiming===!0,onClick:()=>{lj(e.id,{expand:!0,refresh:!0})},children:a?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status!=="loaded"||t!=="officeace"&&c===0||a?.claiming===!0,onClick:()=>{BO(e.id)},children:a?.claiming?r("领取中…"):c>0?r("一键领取({n})",{n:c}):r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),a?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:a.error??""})}):null,f?s.jsx("div",{className:"ck-prov-detail",children:o.map(p=>s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:p.done?"ck-task-tick done":"ck-task-tick",children:p.done?"✓":"·"}),s.jsx("span",{children:p.title}),s.jsxs("span",{className:"ck-task-pts",children:["+",p.points]}),s.jsx("span",{className:"ck-task-st",children:p.claiming?s.jsx(ze,{variant:"warning",shape:"tag",children:r("领取中")}):p.done?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):p.blocked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不可领")}):p.error?s.jsx(ze,{variant:"destructive",shape:"tag",children:p.error}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")})})]},p.key))}):null]})}function R7({row:e}){const t=Kh({claimPlans:e.claimPlans}),a=t.length>0;return s.jsxs("div",{className:"ck-welfare-row",children:[s.jsx($f,{id:"zcode",label:"ZCode"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.name||e.id,a?s.jsx(ze,{variant:"success",shape:"tag",title:r("本地台账里今天(北京时间)领过的套餐:{plans}",{plans:t.join(r("、"))}),children:r("今天已领 {n} 份",{n:t.length})}):s.jsx(ze,{variant:"outline",shape:"tag",title:r("本地台账里今天还没领过;活动期内每天发一份新套餐"),children:r("今天未领")})]}),s.jsx("div",{className:"ck-prov-desc",children:a?r("点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领"):e.claimAt?r("上次领取 {time} · 领取需通过滑块验证码",{time:Fs(e.claimAt)}):r("限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码")})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(se,{size:"sm",variant:"outline",onClick:()=>wR(e.id,e.name),children:r(a?"套餐明细":"去领取")})})]})}function O7({row:e}){const t=ur().growth.get(e.id),a=t?.tasks??[],o=a.filter(v=>v.supported&&!v.unforgeable),c=o.filter(v=>v.status!=="claimed"&&v.current0,f=d&&YG(e.id),p=t?.travel,h=t?.school,b=t?.results??[],y=v=>b.find(w=>w.code===v);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>VO(e.id):void 0,onKeyDown:v=>{d&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),VO(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:"workbuddy",label:"WorkBuddy"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[t?.status==="loaded"?r("{total} 项任务 · {pending} 项可完成",{total:o.length,pending:c.length}):r("查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)"),t?.checkedAt?` · ${r("查询于 {time}",{time:Fs(t.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:v=>v.stopPropagation(),children:[t?.status==="loaded"?c.length>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项可完成",{n:c.length})}):s.jsx(ze,{variant:"success",shape:"tag",children:r("全部完成")}):t?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status==="loading"||t?.running===!0,onClick:()=>{Tg(e.id)},children:t?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status!=="loaded"||t?.running===!0,title:r("接单 + 点亮 + 领奖(只处理已实测沉淀的任务)"),onClick:()=>{FO(e.id,"full")},children:t?.running?r("执行中…"):r("一键完成")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.status!=="loaded"||t?.running===!0,title:r("只领取已完成任务的奖励(幂等,重复点不会重复入账)"),onClick:()=>{FO(e.id,"claim")},children:r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),t?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:t.error??""})}):null,f?s.jsxs("div",{className:"ck-prov-detail",children:[s.jsxs("div",{className:"ck-fold-note",children:[t?.energy!==null&&t?.energy!==void 0?r("能量 {n}",{n:t.energy}):"",t?.streak!==null&&t?.streak!==void 0?` · ${r("连登 {n} 天",{n:t.streak})}`:"",t?.energy===null&&t?.streak===null?r("(能量 / 连登读数本次未取到)"):""]}),a.map(v=>{const w=y(v.code);return s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:v.status==="claimed"?"ck-task-tick done":"ck-task-tick",children:v.status==="claimed"?"✓":"·"}),s.jsxs("span",{title:v.description||v.source||v.code,children:[v.title||v.code,v.target>1?` (${v.current}/${v.target})`:""]}),w?s.jsx("span",{className:"ck-task-pts",children:w.message}):null,s.jsx("span",{className:"ck-task-st",children:v.unforgeable?s.jsx(ze,{variant:"outline",shape:"tag",children:r("需真实操作")}):v.supported?v.status==="claimed"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):v.status==="completed"?s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")}):v.locked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("未解锁")}):s.jsx(ze,{variant:"warning",shape:"tag",children:r("可完成")}):s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不支持")})})]},v.code)}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🐾"}),s.jsxs("span",{children:[r("猫猫旅行"),p&&p.hasBuddy===!0?`:${p.buddyName||r("已领养")} · ${p.state==="traveling"?r("在途"):p.state==="arrived"?r("可领奖"):p.state==="idle"?p.dailyLimitReached?r("今日已派出"):r("可派出"):p.state??""}`:p&&p.hasBuddy===!1?`:${r("未领养(领养需先完成当日对话量)")}`:":"+(p?.error?String(p.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningTravel===!0||t?.status!=="loaded",onClick:()=>{QG(e.id)},children:t?.runningTravel?r("执行中…"):r("巡检一次")})})]}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🎓"}),s.jsxs("span",{children:[r("开学季活动"),h&&h.inPeriod===!0?`:${r("进行中")}${h.lottery?.balance!==void 0&&h.lottery?.balance!==null?` · ${r("抽奖机会 {n} 次",{n:h.lottery.balance})}`:""}`:h&&h.inPeriod===!1?`:${r("非活动期")}`:":"+(h?.error?String(h.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningSchool===!0||t?.status!=="loaded",title:r("执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)"),onClick:()=>{XG(e.id,!0)},children:t?.runningSchool?r("执行中…"):r("执行并抽奖")})})]}),t?.schoolText?s.jsx("div",{className:"ck-fold-note",children:t.schoolText}):null,t?.lotteryText?s.jsx("div",{className:"ck-fold-note",children:t.lotteryText}):null]}):null]})}function M7({group:e}){return s.jsxs("div",{className:"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",style:{cursor:"default"},children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:aM[e.id]??""})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")})})]}),e.id==="qoder-intl"?s.jsx(lM,{}):null]})}function D7({store:e}){const t=e.snapshot,[a,o]=x.useState(null);x.useEffect(()=>{let N=!0;return(async()=>{try{const T=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:1});N&&o(Number(T?.total)||0)}catch{}})(),()=>{N=!1}},[e.version]);const c=t?.daily,d=t?.auto,f=(c?.outOfScope??[]).reduce((N,k)=>N+(Number(k.count)||0),0),p=t?.extras.onboarding??[],h=p.filter(N=>e.onboarding.get(N.id)?.status==="loaded"),b=p.reduce((N,k)=>N+(e.onboarding.get(k.id)?.unclaimed??0),0),y=t?.extras.plans??[],v=t?.extras.growth??[],w=Array.isArray(d?.schedules)?d.schedules:[],j=w.filter(N=>N.enabled===!0).length,S=WG(d);return s.jsxs("div",{children:[s.jsxs("div",{className:"ck-stats",children:[s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("今日签到进度")}),s.jsx("div",{className:"ck-stat-value",children:c?s.jsxs(s.Fragment,{children:[" ",c.todayDone,s.jsxs("small",{children:[" / ",c.todayEligible]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx(tf,{className:"ck-stat-bar",value:c&&c.todayEligible>0?c.todayDone/c.todayEligible*100:0}),s.jsx("div",{className:"ck-stat-foot",children:f>0?r("另有 {n} 个账号不参与每日签到",{n:f}):r("全部账号均可签到")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("schedule")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("schedule")},children:[s.jsx("div",{className:"ck-stat-label",children:r("定时签到")}),s.jsx("div",{className:"ck-stat-value",children:d?s.jsxs(s.Fragment,{children:[j,s.jsxs("small",{children:[" / ",w.length," ",r("条启用")]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx("div",{className:"ck-stat-foot",children:d?.enabled!==!0?r("总开关已关闭 · 在「定时签到」页打开"):S?r("下次 {date} · 点此管理条目",{date:Fs(S)}):r("暂无启用的条目 · 点此添加")})]}),s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("待领新手福利")}),s.jsx("div",{className:"ck-stat-value",children:p.length?s.jsxs(s.Fragment,{children:[b,s.jsxs("small",{children:[" ",r("项")]})]}):s.jsx("span",{className:"ck-pending",children:r("无")})}),s.jsx("div",{className:"ck-stat-foot",children:p.length?r("已有结果 {checked} / 共 {total} 个账号",{checked:h.length,total:p.length}):r("没有支持新手福利的账号")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("records")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("records")},children:[s.jsx("div",{className:"ck-stat-label",children:r("累计签到记录")}),s.jsx("div",{className:"ck-stat-value",children:a===null?s.jsx("span",{className:"ck-pending",children:"—"}):a}),s.jsx("div",{className:"ck-stat-foot",children:r("每账号一条明细 · 点此查看「签到记录」")})]})]}),s.jsxs("div",{className:"ck-main",children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("每日签到")}),s.jsx("span",{className:"panel-sub",children:r("点击行展开账号明细 · 单账号签到不受范围限制")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:e.runningAll||d?.running===!0,onClick:()=>{qG()},children:e.runningAll||d?.running===!0?r("签到中…"):r("立即全部签到")})]}),s.jsxs("div",{children:[(c?.providers??[]).map(N=>N.totalCount>0?s.jsx(E7,{group:N,expanded:e.expanded.has(N.id)},N.id):s.jsx(M7,{group:N},N.id)),(c?.outOfScope??[]).length>0?s.jsx("div",{className:"ck-fold-note",children:r("不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。",{list:c.outOfScope.map(N=>r("{label} ×{count}({reason})",{label:N.label,count:N.count,reason:N.reason})).join(r(";"))})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("新手福利")}),s.jsx("span",{className:"panel-sub",children:r("一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单")}),p.length>0?s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>{for(const N of p)N.settled&&typeof N.settled=="object"||lj(N.id)},children:r("全部查询")}):null]}),p.length?s.jsx("div",{children:p.map(N=>s.jsx(A7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活动福利")}),s.jsx("span",{className:"panel-sub",children:r("限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取")})]}),y.length>0?s.jsx("div",{children:y.map(N=>s.jsx(R7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有可领套餐的账号(ZCode 未添加)。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("成长任务")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细")})]}),v.length>0?s.jsx("div",{children:v.map(N=>s.jsx(O7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持成长任务的账号(需要 WorkBuddy 国内版)。")})]})]})]})}function I7(){const e=k7(),t=e.snapshot;if(x.useEffect(()=>{Ol()},[]),x.useEffect(()=>{window.wbApp?.renderTopbarStatus?.()},[e.version]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取签到数据…")})]});const a=t?.auto,o=a?.enabled===!0;return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{Ol()},children:r("重试")})]}):null,s.jsxs("div",{className:"ck-tabs",children:[s.jsx(In,{options:S7,value:e.tab,onValueChange:c=>IO(c),"aria-label":r("签到中心分区")}),s.jsx(ze,{id:"checkin-badge",className:"ml-auto",variant:a?o?"success":"outline":"destructive","data-tone":a?o?"ok":"":"bad",children:a?o?a?.lastFiredToday?r("今日已执行"):r("已开启"):r("已关闭"):r("不可用")})]}),e.tab==="center"?s.jsx(D7,{store:e}):null,e.tab==="schedule"?s.jsx(x7,{}):null,e.tab==="records"?s.jsx(j7,{}):null]})}const oM='.page[data-page="checkin"]';let iM=!1;function cM(){if(iM)return;const e=document.querySelector(oM);e&&(iM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(I7,{})))}const uM=()=>Ol();window.wbCheckinPanel={load:uM},document.querySelector(oM)?cM():document.addEventListener("DOMContentLoaded",cM,{once:!0}),Pe().wbApp?.currentPage==="checkin"&&uM();function P7(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _7({options:e,onSettle:t}){const{title:a="确认操作",html:o="",text:c="",okText:d="确定",okClass:f="primary",bodyClass:p="danger-zone",cancelText:h="取消"}=e,b=x.useRef(null);return x.useEffect(()=>{function y(v){v.key==="Escape"&&t(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t]),x.useEffect(()=>{function y(v){v.target?.dataset.slot==="alert-dialog-overlay"&&t(!1)}return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[t]),s.jsx(yV,{open:!0,onOpenChange:y=>{y||t(!1)},children:s.jsxs(NV,{initialFocus:b,showCloseButton:!0,children:[s.jsx(kV,{className:"pr-10",children:s.jsx(jV,{children:a})}),s.jsx(CV,{children:s.jsx(EV,{tone:p==="danger-zone"?"danger":"neutral",dangerouslySetInnerHTML:{__html:o||P7(c).replace(/\n/g,"
    ")}})}),s.jsxs(TV,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:b,variant:"outline",onClick:()=>t(!1),children:h}),s.jsx(se,{variant:f==="danger"?"destructive":"default",onClick:()=>t(!0),children:d})]})]})})}let qf=null,Au=null,Og=null;function L7(){qf&&(qf.unmount(),qf=null),Au&&(Au.remove(),Au=null)}function dM(e){const t=Og;Og=null,L7(),t?.(e)}function z7(e={}){return new Promise(t=>{Og&&dM(!1),Og=t,Au=document.createElement("div"),document.body.append(Au),qf=vn.createRoot(Au),qf.render(s.jsx(_7,{options:e,onSettle:dM}))})}window.wbConfirm={ask:z7};const B7=r("Base URL 填进客户端的「API 地址 / Base URL」栏;对话协议按客户端支持的类型三选一(Chat Completions / Responses / Anthropic Messages),三者共用同一套模型与账号池,可随时切换;鉴权用「网关 Key」页里任一启用 Key。");function Gf({id:e,name:t,note:a}){return s.jsxs("div",{className:"ep-row",children:[s.jsxs("div",{className:"ep-head",children:[s.jsx("span",{className:"ep-name",children:t}),s.jsx("span",{className:"ep-note",children:a})]}),s.jsxs("div",{className:"ep-line",children:[s.jsx("code",{className:"ep-value",id:e,children:"—"}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)]","data-copy-from":e,title:r("复制地址"),children:"⧉"})]})]})}function H7(){return s.jsxs("section",{className:"panel ep-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("接口地址")}),s.jsx("span",{className:"tip-q","data-tip":B7})]}),s.jsxs("div",{className:"ep-list",children:[s.jsx(Gf,{id:"api-base",name:"Base URL",note:r("填进客户端的「API 地址 / Base URL」")}),s.jsx("div",{className:"ep-group",children:r("对话协议(按客户端支持的类型选一行)")}),s.jsx(Gf,{id:"api-chat",name:"OpenAI Chat Completions",note:r("多数 OpenAI 兼容客户端的默认协议")}),s.jsx(Gf,{id:"api-responses",name:"OpenAI Responses",note:r("OpenAI 新协议(Codex、新版 SDK)")}),s.jsx(Gf,{id:"api-messages",name:"Anthropic Messages",note:r("Claude Code / Anthropic SDK(token 计数:/v1/messages/count_tokens)")}),s.jsx("div",{className:"ep-group",children:r("模型清单")}),s.jsx(Gf,{id:"api-models",name:r("模型列表"),note:r("客户端自动拉取可用模型;不受鉴权限制,配 Key 之前就能拉")})]}),s.jsx("div",{className:"panel-foot",children:s.jsxs("span",{children:[r("鉴权用「网关 Key」页里任一"),s.jsx("b",{children:r("启用")}),r("的 Key:请求带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("。一把启用的 Key 都没有时不鉴权(默认网关只监听 127.0.0.1;在设置页开启「局域网访问」后监听所有网卡,鉴权与安全闸门随之启用)。")]})})]})}const fM='.page[data-page="docs"]';let pM=!1;function mM(){if(pM)return;const e=document.querySelector(fM);e&&(pM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(H7,{})))}document.querySelector(fM)?mM():document.addEventListener("DOMContentLoaded",mM,{once:!0});function ia(){return window}function fj(e){return e instanceof Error?e.message:String(e)}function Kf(e,t){ia().wbApp?.toast?.(e,t)}function U7(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const pj=[{key:"name",label:r("名称")},{key:"key",label:"Key"},{key:"time",label:r("创建时间")},{key:"state",label:r("启用")},{key:"act",label:r("操作"),align:"right"}],V7={name:"cell-name",key:"cell-key",time:"cell-time",state:"cell-state state",act:"cell-act r"},hM='.page[data-page="keys"]';let Mg=null,mj=null;function gM(){return Mg?Mg.apply([...pj]):pj.map(e=>({...e,align:e.align??"left"}))}function xM(){ia().wbColSettings?.syncStaticHead?.("keys",document.querySelector("table.keys-table"))}function F7(){if(Mg)return;const e=ia().wbColSettings?.register({id:"keys",label:r("网关 Key 表"),columns:pj,mount:()=>document.querySelector('.page[data-page="keys"] .panel-head .head-actions'),onChange:()=>{xM(),mj?.()}});e&&(Mg=e,xM())}function $7(e){return Array.isArray(e?.keys)?e.keys:[]}function q7(e){return Array.isArray(e?.providers)?e.providers:[]}function G7(e){const t=e?.modelsByProvider;return t&&typeof t=="object"?t:{}}function hj(e){return ia().wbProviders?.labelOf?.(e)||e}function K7(e,t,a){const o=new Map,c=f=>{const p=String(f??"").trim();if(!p)return;const h=p.toLowerCase();o.has(h)||o.set(h,p)};t.forEach(f=>{const p=e[f]??e[String(f).toLowerCase()];Array.isArray(p)&&p.forEach(c)}),a.forEach(c);const d=[...o.values()].map(f=>({value:f,label:r(f)}));return d.sort((f,p)=>f.value.toLowerCase()String(t)):[]}function vM(e,t){const a=new Map(t.map(c=>[c.value.toLowerCase(),c.value])),o=new Set;return e.forEach(c=>{const d=a.get(String(c).toLowerCase());d&&o.add(d)}),t.filter(c=>o.has(c.value)).map(c=>c.value)}function Z7({target:e,providers:t,modelsByProvider:a,onClose:o,onSaved:c}){const d=e?.id??null,f=!!d,[p,h]=x.useState(e?.name??""),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(!1),N=x.useRef(!1),[k,T]=x.useState(()=>bM(e?.allowedProviders)),[D,C]=x.useState(()=>bM(e?.allowedModels)),A=x.useMemo(()=>t.map(H=>({value:String(H.id),label:r(String(H.label??H.id))})),[t]),R=x.useMemo(()=>vM(k,A),[k,A]),I=x.useMemo(()=>K7(a,R,D),[a,R,D]),P=x.useMemo(()=>vM(D,I),[D,I]),O=I.length?r("没有匹配的选项"):R.length?r("这几家当前没有可用模型(账号未登录或清单为空)"):r("请先在上面选择可用提供商");function _(){N.current=!1,S(!1)}async function L(){if(!N.current){N.current=!0,S(!0),w(r("保存中…"));try{const H=ia().workbuddyDesktop;if(!H)throw new Error(r("后端桥不可用"));if(d){const Q=await H.updateKey(d,{allowedProviders:R,allowedModels:P});_(),c(Q),o(),Kf(r("✅ 可用范围已保存"));return}const B=b.trim();if(B&&B.length<8){w(r("Key 至少需要 8 个字符"));return}const z=await H.createKey({name:p.trim(),key:B||void 0,allowedProviders:R,allowedModels:P});_(),c(z,z?.created?.id),o(),Kf(r("✅ Key 已创建,记得复制给客户端"))}catch(H){w(r("保存失败:{reason}",{reason:fj(H)}))}finally{_()}}}return s.jsx(Qt,{open:!0,onOpenChange:(H,B)=>{if(!H){if(N.current){B.cancel();return}o()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:f?r("可用范围 · {name}",{name:e?.name||r("未命名")}):r("新建 API Key")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-name",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("名称")}),s.jsx($e,{id:"key-name",type:"text",maxLength:60,placeholder:r("例如 Cursor / 公司电脑"),autoComplete:"off",value:p,disabled:f,onChange:H=>h(H.currentTarget.value)})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-value",className:"text-[12.5px] whitespace-nowrap text-subtle",children:"Key"}),s.jsx($e,{id:"key-value",type:"text",placeholder:r("留空自动生成;手填至少 8 个字符"),autoComplete:"off",spellCheck:!1,value:b,onChange:H=>y(H.currentTarget.value),onKeyDown:H=>{H.key==="Enter"&&L()}})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用提供商")}),s.jsx(Bh,{value:R,onValueChange:T,options:A,placeholder:r("留空 = 不限制"),searchPlaceholder:r("搜索提供商…"),"aria-label":r("可用提供商"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用模型")}),s.jsx(Bh,{value:P,onValueChange:C,options:I,placeholder:r("留空 = 不限制"),emptyHint:O,searchPlaceholder:r("搜索模型…"),"aria-label":r("可用模型"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsx("p",{children:r("留空表示不限制;同时设置时请求需同时满足两个条件(模型在白名单内且路由到允许的提供商)。 「可用模型」的候选跟着上面勾选的提供商走:没勾提供商时它是空的(还没有约束范围), 勾了几家就列出这几家能收的全部对外名。")}),s.jsx("p",{id:"key-restrict-summary",children:Q7(R,P)})]}),s.jsx("div",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:o,disabled:j,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{L()},children:r(f?"保存范围":"创建")})]})]})})}let Dg=null;async function W7(){await Dg?.load()}function J7(){Dg?.render()}function e9(){const[e,t]=x.useState(null),[a,o]=x.useState(()=>new Set),[c,d]=x.useState(()=>new Set),[f,p]=x.useState(null),[,h]=x.useState(0),b=x.useRef(new Set),y=x.useRef(!1),v=x.useCallback(L=>{t(L)},[]),w=x.useCallback(L=>{L&&Array.isArray(L.keys)&&v(L)},[v]),j=x.useCallback(async()=>{if(!y.current){y.current=!0;try{const L=ia().workbuddyDesktop;if(!L)throw new Error(r("后端桥不可用"));v(await L.getKeys()??null)}catch(L){Kf(r("读取 Key 列表失败:{reason}",{reason:fj(L)}),"err")}finally{y.current=!1}}},[v]);async function S(L,H,B){if(!b.current.has(L)){b.current.add(L),d(new Set(b.current));try{w(await H()),B&&Kf(B)}catch(z){Kf(r("操作失败:{reason}",{reason:fj(z)}),"err")}finally{b.current.delete(L),d(new Set(b.current))}}}function N(L){o(H=>{const B=new Set(H);return B.has(L)?B.delete(L):B.add(L),B})}async function k(L){const H=ia().workbuddyDesktop,B=ia().wbConfirm?.ask;if(!H||!B)return;const z=U7(L.name||L.masked||L.id);await B({title:r("删除网关 Key"),html:r("确定删除 Key「{name}」?使用它的客户端会立刻无法访问。",{name:z}),okText:r("删除"),okClass:"danger"})&&S(L.id,()=>H.deleteKey(L.id),r("Key 已删除"))}function T(L,H){const B=ia().workbuddyDesktop;B&&S(L.id,()=>B.updateKey(L.id,{enabled:H}),r(H?"Key 已启用":"Key 已停用"))}x.useLayoutEffect(()=>(Dg={load:j,render:()=>h(L=>L+1)},mj=()=>h(L=>L+1),F7(),h(L=>L+1),()=>{Dg=null,mj=null}),[j]),x.useEffect(()=>{ia().wbApp?.currentPage==="keys"&&j()},[j]),x.useEffect(()=>{ia().wbApp?.renderTopbarStatus?.()},[e]);const D=$7(e),C=ig(D.length,"keys"),A=C.paged?C.slice(D):D,R=gM(),I=e?.authRequired===!0,P=A.filter(L=>L.enabled).length,O=I?r("已启用鉴权 · {n} 把 Key 生效",{n:P}):r("未启用鉴权");function _(L,H,B){switch(L){case"name":return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t",children:H.name||r("未命名")})}),s.jsx("div",{className:"mname",title:X7(H),children:Y7(H)})]});case"key":{const z=a.has(H.id);return s.jsxs("div",{className:"keycell",children:[s.jsx("code",{className:"kv",children:z?H.key:H.masked}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>N(H.id),children:r(z?"隐藏":"显示")}),s.jsx(se,{size:"sm",variant:"ghost","data-copy":H.key,title:r("复制 Key"),children:r("复制")})]})}case"time":return s.jsx("span",{className:"muted",children:H.createdAt?ia().wbApp?.formatTime?.(H.createdAt):"—"});case"state":return s.jsx(hs,{checked:H.enabled===!0,disabled:B,"aria-label":r("启用「{name}」",{name:H.name||r("未命名")}),onCheckedChange:z=>T(H,z)});case"act":return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:B,onClick:()=>p({key:H}),children:r("可用范围")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:B,onClick:()=>{k(H)},children:r("删除")})]});default:return null}}return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("API Key 列表")}),s.jsx(ze,{id:"keys-status",variant:I?"success":"warning","data-tone":I?"ok":"warn",children:O}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"default",onClick:()=>p({key:null}),children:r("+ 新建 Key")})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table keys-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"k-name","data-col":"name"}),s.jsx("col",{className:"k-key","data-col":"key"}),s.jsx("col",{className:"k-time","data-col":"time"}),s.jsx("col",{className:"k-state","data-col":"state"}),s.jsx("col",{className:"k-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"name",children:r("名称")}),s.jsx("th",{"data-col":"key",children:"Key"}),s.jsx("th",{"data-col":"time",children:r("创建时间")}),s.jsx("th",{"data-col":"state",children:r("启用")}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{children:A.length?A.map(L=>{const H=c.has(L.id);return s.jsx("tr",{className:L.enabled?"":"off","data-id":L.id,children:R.map(B=>s.jsx("td",{className:`${V7[B.key]??""} ta-${B.align}`,children:_(B.key,L,H)},B.key))},L.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:R.length,className:"empty",children:r(e?"还没有 Key,当前不鉴权":"加载中…")})})})]})}),s.jsx(Li,{leading:s.jsxs("span",{children:[r("客户端请求需带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("; 修改后立即生效,本程序自身会自动使用第一把启用的 Key。每把 Key 可单独限制"),s.jsx("b",{children:r("可用提供商")}),r("与"),s.jsx("b",{children:r("可用模型")}),r("(行内「可用范围」):留空 = 不限制,两个都设时 按交集生效 —— 被限制的模型对这把 Key 表现为「不存在」(拉 /v1/models 也看不到它), 提供它的家不在可用列表里时请求同样被拒。")]}),total:D.length,range:C.paged?{start:C.rangeStart,end:C.rangeEnd}:null,page:C.page,pageCount:C.pageCount,size:C.size,onSizeChange:C.setSize,onPageChange:C.goto}),f?s.jsx(Z7,{target:f.key,providers:q7(e),modelsByProvider:G7(e),onClose:()=>p(null),onSaved:(L,H)=>{H&&o(B=>new Set(B).add(H)),w(L)}}):null]})}let yM=!1;function wM(){if(yM)return;const e=document.querySelector(hM);e&&(yM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(e9,{})))}document.querySelector(hM)?wM():document.addEventListener("DOMContentLoaded",wM,{once:!0}),window.wbKeysPanel={load:W7,render:J7,visibleColumns:gM};const t9="login-app",n9=x.createElement("panel-captcha",{id:"captcha"});function s9(){return s.jsxs("div",{className:"w-[min(400px,100%)] rounded-lg border border-border bg-card p-[36px_34px_30px] shadow-3",children:[s.jsxs("div",{className:"mb-[26px] flex flex-col items-center gap-3 text-center",children:[s.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Agent2API",className:"size-[52px] rounded-[12px] shadow-[0_6px_18px_rgba(0,122,255,0.35)]",children:[s.jsx("rect",{width:"24",height:"24",rx:"5.4",fill:"#007AFF"}),s.jsxs("g",{fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M5.23 9.24h10.71"}),s.jsx("path",{d:"M15.94 6.72 18.77 9.24 15.94 11.76"}),s.jsx("path",{d:"M18.77 14.76H8.06"}),s.jsx("path",{d:"M8.06 12.24 5.23 14.76 8.06 17.28"})]})]}),s.jsxs("div",{children:[s.jsx("h1",{className:"m-0 text-[21px] font-bold tracking-[0.2px]",children:"Agent2API"}),s.jsx("div",{className:"text-[12.5px] text-muted-foreground",children:r("OpenAI 兼容网关 · 管理面板")})]})]}),s.jsx("div",{id:"mode-tip",className:"mb-[18px] text-center text-[13px] text-muted-foreground"}),s.jsxs("form",{id:"form",autoComplete:"on",children:[s.jsx(Je,{htmlFor:"username",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("账号")}),s.jsx($e,{id:"username",autoComplete:"username",placeholder:r("管理员账号")}),s.jsx(Je,{htmlFor:"password",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("密码")}),s.jsx($e,{id:"password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位")}),n9,s.jsx(se,{id:"submit",type:"submit",size:"lg",className:"w-full",children:r("继续")}),s.jsx("div",{id:"error",className:"mt-3 min-h-5 text-center text-[13px] whitespace-pre-wrap text-destructive"})]}),s.jsx("div",{className:"mt-[22px] text-center text-[12px] text-muted-foreground",children:r("登录后可在「网关 Key」页为 API 客户端创建密钥")})]})}function r9(){const e=document.getElementById(t9);e&&Cs.flushSync(()=>{vn.createRoot(e).render(s.jsx(s9,{}))})}r9();function Lr(){return window}function gj(e){return e instanceof Error?e.message:String(e)}function Ig(e,t){Lr().wbApp?.toast?.(e,t)}const jM=1e3,a9=ag,l9=500,SM="workbuddy-desktop-logs-range",xj="workbuddy-desktop-logs-filters",o9=300,i9="~/.agent2api/logs.jsonl",bj=["today","7","30","month","all"],vj="all",c9={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},u9=bj.map(e=>({value:e,label:c9[e]})),yj=[{value:"",label:r("全部级别")},{value:"debug",label:r("debug 及以上")},{value:"info",label:r("info 及以上")},{value:"warn",label:r("warn 及以上")},{value:"error",label:r("仅 error")}],d9=r("全部级别"),NM=r("全部分类"),f9={debug:r("调试"),info:r("信息"),warn:r("警告"),error:r("错误")};let Pg=jM,_g=!0,wj=!1,jj=!1,Sj=!1,Nj=null,Eo=null,kj=null,Lg=null,Cj=!1,Tj=!1;const Ej={level:"",category:"",keyword:""};function p9(){const e=Lr().wbFilterMemory;if(!e)return{...Ej};Cj=!0;const t=e.load(xj,{...Ej});return{level:yj.some(a=>a.value===t.level)?t.level:"",category:t.category,keyword:t.keyword}}function zg(e){Lr().wbFilterMemory?.save(xj,{level:e.level||"",category:e.category||"",keyword:e.keyword.trim()||""})}function m9(){try{const e=localStorage.getItem(SM);return e!==null&&bj.includes(e)?e:vj}catch{return vj}}function h9(e){try{localStorage.setItem(SM,e)}catch{}}function Bg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function g9(e){const t=new Date;switch(e){case"today":return Bg(t);case"7":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Bg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function x9(e){if(!e)return"—";const t=new Date(e),a=d=>String(d).padStart(2,"0"),o=`${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`,c=`${a(t.getMonth()+1)}-${a(t.getDate())}`;return t.getFullYear()===new Date().getFullYear()?`${c} ${o}`:`${t.getFullYear()}-${c} ${o}`}function b9(e){const t=e.data;if(!t)return"";const a=[];return(t.from||t.to)&&a.push([t.from,t.to].filter(Boolean).join(" → ")),t.model&&a.push(r("模型 {model}",{model:t.model})),t.resetAtText?a.push(r("{time} 恢复",{time:t.resetAtText})):t.status&&!t.from&&!t.to&&a.push(`HTTP ${t.status}`),a.length?a.join(" · "):""}function Aj(e){return Array.isArray(e?.entries)?e.entries:[]}function Hg(e,t,a){const o=Math.max(1,a==="all"?1:Math.ceil(t.length/a));return Math.min(Math.max(1,e),o)}function Rj(e,t){return Object.hasOwn(e,t)}function v9(e){const t={};if(e&&typeof e=="object")for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function kM(e,t){const a=new URLSearchParams,o=e.keyword.trim(),c=g9(t);return e.level&&a.set("level",e.level),e.category&&a.set("category",e.category),o&&a.set("keyword",o),c!==null&&a.set("start",String(c)),a}function y9(e,t){const a=kM(e,t);return a.set("limit",String(l9)),a.toString()}function w9(e,t){return kM(e,t).toString()}function j9(e){Nj=e||null,Lr().wbApp?.updateLogsBadge?.(Nj)}async function S9(){if(!wj)try{const e=await Lr().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="logsAutoRefresh");Oj(t||null),wj=Array.isArray(e?.tasks)}catch(e){console.warn("读取日志自动刷新间隔失败,按默认 10 秒:",gj(e)),Oj(null)}}function Oj(e){wj=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(_g=e.enabled!==!1,Pg=e.unit==="minutes"?t*6e4:t*1e3):(_g=!0,Pg=jM),Eo?.applyAutoConfig(Pg,_g)}async function N9(e={}){await Eo?.load(e)}function k9(e){if(!Eo){Lg={data:e??null};return}Eo.render(e)}function C9(){return Nj}async function T9(e){if(!Eo){kj=e;return}await Eo.showCategory(e)}const E9={entries:[],total:0,matched:0,file:i9,categories:{},loaded:!1};function Mj(e,t){return{entries:Aj(e),total:Number(e?.total)||0,matched:Number(e?.matched)||0,file:e?.file||t.file,categories:Object.keys(t.categories).length?t.categories:v9(e?.categories),loaded:!0}}function A9(e){return e.loaded?e.total?r("没有符合筛选条件的日志"):r("暂无日志"):r("正在加载日志…")}function R9(){const[e,t]=x.useState(E9),[a,o]=x.useState(p9),[c,d]=x.useState(m9),[f,p]=x.useState(1),[h,b]=x.useState(()=>lg("logs")),[y,v]=x.useState(null),[w,j]=x.useState(()=>({ms:Pg,enabled:_g})),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),T=x.useRef(null),D=x.useRef(a),C=x.useRef(c),A=x.useRef(f),R=x.useRef(h),I=x.useRef(e),P=x.useCallback(re=>{const de={...D.current,...re};return D.current=de,o(de),de},[]),O=x.useCallback(re=>{C.current=re,d(re)},[]),_=x.useCallback(re=>{A.current=re,p(re)},[]),L=x.useCallback(re=>{R.current=re,b(re),og("logs",re)},[]),H=x.useCallback(re=>{I.current=re,t(re)},[]),B=x.useCallback(()=>{if(Cj)return;const re=Lr().wbFilterMemory;if(!re||(Cj=!0,Tj))return;const de=re.load(xj,{...Ej});P({level:de.level,category:de.category,keyword:de.keyword})},[P]),z=x.useCallback(async(re={})=>{const{silent:de=!1,resetPage:ke=!1}=re;ke&&_(1),S9(),B();const Ee=y9(D.current,C.current),ve=A.current;try{const he=Lr().workbuddyDesktop;if(!he)throw new Error(r("后端桥不可用"));const[ye,je]=await Promise.all([he.getLogs(Ee),he.getLogStats()]),xe=ke?0:S.current?.scrollTop??0,Te=Mj(ye,I.current);H(Te),_(Hg(A.current,Aj(ye),R.current)),N.current=A.current===ve?xe:0,j9(je),Object.keys(Te.categories).length&&D.current.category&&!Rj(Te.categories,D.current.category)&&(zg(P({category:""})),z({resetPage:!0}))}catch(he){de||(console.warn("读取运行日志失败:",gj(he)),H(Mj(null,I.current)),_(Hg(A.current,[],R.current)))}},[H,_,B]),Q=x.useCallback(re=>{re!==void 0&&(H(Mj(re,I.current)),_(Hg(A.current,Aj(re),R.current)))},[H,_]),K=x.useCallback(async re=>{if(Rj(I.current.categories,re)||await z({silent:!0}),!Rj(I.current.categories,re))return;const de=P({category:re});zg(de),_(1),await z({resetPage:!0}),Lr().wbApp?.showPage?.("logs",{persist:!0})},[P,_,z]);x.useEffect(()=>{if(Eo={load:z,render:Q,showCategory:K,applyAutoConfig:(de,ke)=>j({ms:de,enabled:ke})},Lg){const de=Lg;Lg=null,Q(de.data)}const re=kj;return re!==null?(kj=null,K(re)):z({silent:!0}),()=>{Eo=null,k.current!==null&&window.clearTimeout(k.current),k.current=null}},[z,Q,K]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const re=window.setInterval(()=>{document.hidden||Lr().wbApp?.currentPage!=="logs"||jj||(jj=!0,z({silent:!0}).finally(()=>{jj=!1}))},w.ms);return()=>{window.clearInterval(re)}},[w,z]),x.useLayoutEffect(()=>{const re=N.current;if(re===null)return;N.current=null;const de=S.current;de&&(de.scrollTop=re)});async function X(re,de,ke){if(!Sj){Sj=!0,v({which:re,label:de});try{await ke()}catch(Ee){Ig(r("操作失败:{error}",{error:gj(Ee)}),"err")}finally{Sj=!1,v(null)}}}async function q(){const re=w9(D.current,C.current),de=re.length>0,ke=de?r("确定清空当前筛选出的 {count} 条日志?清空后无法恢复。",{count:Number(I.current.matched)||0}):r("确定清空全部运行日志?清空后无法恢复。"),Ee=Lr().wbConfirm?.ask;Ee&&await Ee({title:r("清空运行日志"),html:ke,okText:r("清空"),okClass:"danger"})&&await X("clear",r("清空中…"),async()=>{const ve=Lr().workbuddyDesktop;if(!ve)throw new Error(r("后端桥不可用"));await ve.clearLogs(de?re:"all=1"),await z({resetPage:!0}),Ig(r("运行日志已清空"))})}async function $(){await X("export",r("导出中…"),async()=>{const re=Lr().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.exportLogs();if(!(!de||de.canceled)){if(de.count===0){Ig(r("暂无日志可导出"),"err");return}Ig(r("✅ 已导出 {count} 条日志到 {file}",{count:String(de.count),file:String(de.file)}))}})}function Y(re){const de=Hg(re,I.current.entries,R.current);de!==A.current&&(_(de),N.current=0)}function F(re){if(re===R.current)return;const de=I.current.entries.length,ke=de?(A.current-1)*(R.current==="all"?de:R.current):0;L(re),_(re==="all"?1:Math.floor(ke/re)+1),N.current=0}function G(re){Tj=!0,zg(P(re)),z({resetPage:!0})}function W(re){Tj=!0,P({keyword:re}),k.current!==null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,zg(D.current),z({resetPage:!0})},o9)}function le(re){const de=bj.includes(re)?re:vj;de!==C.current&&(O(de),h9(de),z({resetPage:!0}))}const M=e.entries,U=h!=="all",Z=Math.max(1,U?Math.ceil(M.length/h):1),ae=Math.min(Math.max(1,f),Z),ce=U?M.slice((ae-1)*h,ae*h):M,J=M.length?U?(ae-1)*h+1:1:0,ie=M.length?U?J+ce.length-1:M.length:0,ge=e.categories,ee=e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total});x.useEffect(()=>{const re=e.loaded?ee:"—";T.current!==re&&(T.current=re,Lr().wbApp?.renderTopbarStatus?.())},[e.loaded,ee]);function fe(re,de){const ke=re.level||"",Ee=b9(re);return s.jsxs("div",{className:`log-row ${ke}`,children:[s.jsx("span",{className:"log-rail",children:s.jsx("span",{className:`log-dot ${ke}`})}),s.jsxs("div",{className:"log-main",children:[s.jsxs("div",{className:"log-line",children:[s.jsx("span",{className:"log-cat",children:ge[re.category||""]||re.category}),s.jsx("span",{className:`log-lvl ${ke}`,children:f9[ke]||re.level}),s.jsx("span",{className:"msg",children:re.message})]}),Ee?s.jsx("div",{className:"log-extra-wrap",children:s.jsx("span",{className:"extra",children:Ee})}):null]}),s.jsx("span",{className:"time",children:x9(re.ts)})]},re.id??de)}const te=y?.which==="export",Ce=y?.which==="clear";return s.jsxs("section",{className:"panel",id:"logs-panel-events",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("系统事件")}),s.jsx(ze,{id:"logs-badge",variant:"outline","data-tone":"",children:e.loaded?ee:"—"}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-logs-export",variant:"outline",disabled:y!==null,onClick:()=>{$()},children:te?y?.label:r("导出")}),s.jsx(se,{id:"btn-logs-clear",variant:"destructive",disabled:y!==null,onClick:()=>{q()},children:Ce?y?.label:r("清空")})]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:u9,value:c,onValueChange:le,"aria-label":r("事件日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.level,onValueChange:re=>G({level:String(re??"")}),children:[s.jsx(mt,{id:"logs-level",className:"min-w-[120px]",title:r("按最低级别筛选"),"aria-label":r("按最低级别筛选"),children:s.jsx(pt,{children:yj.find(re=>re.value===a.level)?.label??d9})}),s.jsx(ht,{children:yj.map(re=>s.jsx(qe,{value:re.value,children:re.label},re.value))})]}),s.jsxs(ft,{value:a.category,onValueChange:re=>G({category:String(re??"")}),children:[s.jsx(mt,{id:"logs-category",className:"min-w-[120px]",title:r("按分类筛选"),"aria-label":r("按分类筛选"),children:s.jsx(pt,{children:a.category?ge[a.category]||a.category:NM})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:NM}),Object.entries(ge).map(([re,de])=>s.jsx(qe,{value:re,children:de},re))]})]}),s.jsxs(Ci,{className:"w-auto flex-auto",children:[s.jsx(Ei,{id:"logs-keyword",type:"search",placeholder:r("搜索消息关键词…"),autoComplete:"off","aria-label":r("搜索消息关键词"),value:a.keyword,onChange:re=>W(re.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]})]}),s.jsx("div",{className:"log-list",id:"log-list",ref:S,children:ce.length?ce.map((re,de)=>fe(re,de)):s.jsx("div",{className:"log-empty",children:A9(e)})})]}),s.jsx(Li,{total:M.length,range:U?{start:J,end:ie}:null,page:ae,pageCount:Z,size:h,sizes:a9,onSizeChange:F,onPageChange:Y})]})}const CM='.page[data-page="logs"]';let TM=!1;function EM(){if(TM)return;const e=document.querySelector(CM);e&&(TM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(R9,{})))}document.querySelector(CM)?EM():document.addEventListener("DOMContentLoaded",EM,{once:!0}),window.wbLogsPanel={load:N9,render:k9,lastStats:C9,applyAutoRefresh:Oj,showCategory:T9};const Ru=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Yf=["maxInputTokens","maxOutputTokens"],AM=["supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Ou={maxInputTokens:r("上下文窗口"),maxOutputTokens:r("最大输出 Token"),supportsToolCall:r("工具调用"),supportsImages:r("图片识别"),supportsVideo:r("视频识别"),supportsReasoning:r("支持思考")};r("工具"),r("图片"),r("视频"),r("思考");const O9=1e8;function Dj(e){return Yf.includes(e)}function Ij(e,t){if(Dj(e)){const a=typeof t=="number"?t:Number(t);return!Number.isFinite(a)||a<1||a>O9?null:Math.trunc(a)}return typeof t=="boolean"?t:null}function RM(e){const t={};if(!e||typeof e!="object")return t;const a=e;for(const o of Ru){const c=Ij(o,a[o]);c!==null&&(t[o]=c)}return t}function Pj(e){return Array.isArray(e)?Ru.filter(t=>e.some(a=>a===t)):[]}function _j(e){return RM(e?.capabilities)}function OM(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"—";const a=o=>o.toFixed(1).replace(/\.0$/,"");return t>=1e6?`${a(t/1e6)}M`:t>=1e3?`${a(t/1e3)}K`:String(Math.round(t))}function Xf(e){const t=Number(e);return!Number.isFinite(t)||t<=0?r("未声明"):Math.round(t).toLocaleString("en-US")}function Lj(e){return e===!0?"on":e===!1?"off":"unset"}function M9(e){const t=e?.reasoningLevels;if(!Array.isArray(t))return null;const a=t.filter(c=>typeof c=="string"&&c.trim()!=="");if(!a.length)return null;const o=e?.reasoningDefaultLevel;return{levels:a,defaultLevel:typeof o=="string"?o.trim():""}}function D9(e,t,a,o=""){const c=Ou[e],d=a?r("(已被手动覆盖,弹窗里可恢复继承)"):"",f=I9(o);if(Dj(e))return t==null?r("{label}:上游未声明{suffix}",{label:c,suffix:d}):r("{label}:{value}(对下游声明的精确值){origin}{suffix}",{label:c,value:Xf(t),origin:f,suffix:d});const p=Lj(t);return p==="on"?r("{label}:支持{origin}{suffix}",{label:c,origin:f,suffix:d}):p==="off"?r("{label}:不支持{origin}{suffix}",{label:c,origin:f,suffix:d}):r("{label}:上游未声明(下游会按不支持处理){suffix}",{label:c,suffix:d})}function Mu(e,t){const a=e?.capSources?.[t];return a==="upstream"||a==="modelsdev"||a==="user"?a:""}function I9(e){return e==="modelsdev"?r("(由 models.dev 补齐)"):e==="user"?r("(手动设定)"):""}function P9(e){const t={};for(const a of Ru){const o=e[a];Dj(a)?t[a]=Ij(a,o.trim()):t[a]=o==="on"?!0:o==="off"?!1:null}return t}function Qf(){return window}const MM=e=>String(e??"").trim().toLowerCase(),$s=(e,t)=>MM(e)===MM(t);function es(e){return typeof e=="string"&&e.startsWith("custom-")}function Fi(){return(Qf().wbProviders?.customList?.()||[]).filter(e=>es(e?.id))}function DM(){return Qf().wbProviders?.customList?.()||[]}function Ao(e){return Fi().find(t=>t.id===e)||null}function _9(e){const t=RM(e),a={};for(const o of Ru){const c=t[o];(typeof c=="number"||typeof c=="boolean")&&(a[o]=c)}return Object.keys(a).length?a:void 0}function IM(e){const t=(Array.isArray(e?.models)?e.models:[]).map(c=>{const d={id:String(c?.id??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""};return d.capabilities=_9(c?.capabilities),d}).filter(c=>c.id),a=(Array.isArray(e?.mappings)?e.mappings:[]).map(c=>({alias:String(c?.alias??"").trim(),target:String(c?.target??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""})).filter(c=>c.alias&&c.target);for(const c of t){const d=a.find(f=>$s(f.alias,c.id)&&$s(f.target,c.id));d&&(c.enabled=c.enabled&&d.enabled,c.reasoning=d.reasoning||c.reasoning)}const o=a.filter(c=>!($s(c.alias,c.target)&&t.some(d=>$s(d.id,c.target))));return{models:t,mappings:o}}function PM(e){const t=Ao(e);if(!t)return null;const a=IM(t),o=t.name||e,c=[],d=[];for(const f of a.models)c.push({id:f.id,name:"",provider:e,providerLabel:o,source:"",enabled:f.enabled,aliases:[],capabilities:f.capabilities||{},capOverrides:[]}),d.push({alias:f.id,target:f.id,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!0,dangling:!1,carried:!0});for(const f of a.mappings){const p=c.find(h=>$s(h.id,f.target));d.push({alias:f.alias,target:f.target,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!1,dangling:!p,carried:!!p}),p&&p.aliases.push(f.alias)}return{models:c,mappings:d}}async function $i(e,t){const a=Qf().wbProviders;if(!a?.customRequest)throw new Error(r("目录模块未就绪"));const o=Ao(e);if(!o)throw new Error(r("该自定义提供商已不存在(可能已被删除),请刷新后重试"));const c=IM(o),d=t(c);return await a.customRequest("POST","/api/custom-providers/models",{providerId:e,models:c.models,mappings:c.mappings}),await a.refreshCustom?.(),d}async function _M(e,t,a,o={}){const{enabled:c,reasoning:d}=o;await $i(e,f=>{if($s(t,a)){const h=f.models.find(b=>$s(b.id,a));if(!h)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:a}));return c!==void 0&&(h.enabled=!!c),d!==void 0&&(h.reasoning=String(d??"")),null}const p=f.mappings.find(h=>$s(h.alias,t)&&$s(h.target,a));if(p)return c!==void 0&&(p.enabled=!!c),d!==void 0&&(p.reasoning=String(d??"")),null;if(c===!1)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return f.mappings.push({alias:t,target:a,enabled:c??!0,reasoning:String(d??"")}),null})}async function LM(e,t,a){await $i(e,o=>{const c=o.mappings.length;if(o.mappings=o.mappings.filter(d=>!($s(d.alias,t)&&$s(d.target,a))),o.mappings.length===c)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return null})}async function zM(e,t){const a=String(t??"").trim();if(!a)throw new Error(r("请填写模型 ID"));await $i(e,o=>{if(o.models.some(c=>$s(c.id,a)))throw new Error(r("模型「{name}」已存在(忽略大小写判重)",{name:a}));return o.models.push({id:a,enabled:!0,reasoning:""}),null})}async function L9(e,t){const a=(Array.isArray(t)?t:[]).map(o=>String(o??"").trim()).filter(Boolean);if(!a.length)throw new Error(r("没有选中任何模型"));return $i(e,o=>{let c=0;for(const d of a)o.models.some(f=>$s(f.id,d))||(o.models.push({id:d,enabled:!0,reasoning:""}),c++);return c})}async function BM(e,t,a){await $i(e,o=>{const c=o.models.find(f=>$s(f.id,t));if(!c)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:t}));const d={...c.capabilities||{}};for(const[f,p]of Object.entries(a))p==null?delete d[f]:d[f]=p;return c.capabilities=Object.keys(d).length?d:void 0,null})}async function HM(e,t){return $i(e,a=>{const o=a.mappings.length;a.mappings=a.mappings.filter(d=>!$s(d.target,t));const c=o-a.mappings.length;return a.models=a.models.filter(d=>!$s(d.id,t)),{removedMappings:c}})}async function z9(e){const t=Qf().wbProviders;if(!t?.customRequest)throw new Error(r("目录模块未就绪"));const a=await t.customRequest("POST","/api/custom-providers/fetch-models",{providerId:e}),o=(Array.isArray(a?.models)?a.models:[]).map(d=>String(d??"").trim()).filter(Boolean),c=await $i(e,d=>{let f=0;for(const p of o)d.models.some(h=>$s(h.id,p))||(d.models.push({id:p,enabled:!0,reasoning:""}),f++);return f});return{total:o.length,added:Number(c)||0}}Qf().wbModelsCustom={isCustom:es,list:Fi,listSource:DM,record:Ao,buildView:PM,setBinding:_M,removeMapping:LM,addModel:zM,addModels:L9,removeModel:HM,setCapabilities:BM,fetchModels:z9};const ca="__custom__",B9=["off","none","minimal","low","medium","high","xhigh","max"];function Zf(e,t){const a=UM(t);if(a.length)return a;const o=e?.reasoningLevels;return Array.isArray(o)&&o.length?o.filter(c=>typeof c=="string"):[...B9]}function UM(e){const t=e?.reasoningLevels;return Array.isArray(t)?t.filter(a=>typeof a=="string"&&a.trim()!==""):[]}function H9(e,t){const a=t.map(UM).filter(f=>f.length>0);if(!a.length||a.length!==t.length)return Zf(e);const[o,...c]=a,d=o.filter(f=>c.every(p=>p.includes(f)));return d.length?d:Zf(e)}function VM(e,t,a){return`${String(e??"").trim().toLowerCase()}${String(t??"").trim().toLowerCase()}${String(a??"").trim().toLowerCase()}`}function U9(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=typeof a?.reasoning=="string"?a.reasoning.trim():"";o&&t.set(VM(a.alias,a.target,a.provider),o)}return(a,o,c)=>t.get(VM(a,o,c))||""}function Wt(){return window}function Ro(e){return e instanceof Error?e.message:String(e)}function wr(e,t){Wt().wbApp?.toast?.(e,t)}function zj(e){const t=Wt().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function V9(e){const t=Wt().formatTime??Wt().wbApp?.formatTime;return String(t?.(e)??"")}const FM=e=>String(e??"").trim().toLowerCase(),Oo=(e,t)=>FM(e)===FM(t),$M=8,qM="workbuddy-desktop-models-filters",Bj=["all","enabled","disabled","mapped"],F9={all:r("全部"),enabled:r("已启用"),disabled:r("已禁用"),mapped:r("有映射")},$9=Bj.map(e=>({value:e,label:F9[e]})),Hj=["default","rate-asc","rate-desc"],q9={default:r("默认"),"rate-asc":r("倍率升序"),"rate-desc":r("倍率降序")},G9=Hj.map(e=>({value:e,label:q9[e]})),Uj=[{key:"check",label:r("选择"),align:"center"},{key:"model",label:r("上游模型")},{key:"rate",label:r("倍率")},{key:"source",label:r("来源")},{key:"budget",label:r("上下文 / 输出")},{key:"caps",label:r("能力")},{key:"alias",label:r("模型映射")},{key:"act",label:r("操作"),align:"right"}],GM=new Set(["rate","source"]),Wf="custom-all",Vj={models:[],mappings:[]},KM={provider:"all",state:"all",search:"",sort:"default"};function YM(){const e=Wt().wbFilterMemory;if(!e)return{...KM};const t=e.load(qM,{...KM});return{provider:String(t.provider||"all"),state:Bj.includes(t.state)?t.state:"all",search:String(t.search||""),sort:Hj.includes(t.sort)?t.sort:"default"}}const Ug=YM();let XM=!!Wt().wbFilterMemory,Vg=!1,ts={provider:Ug.provider,stateFilter:Ug.state,search:Ug.search,sort:Ug.sort,data:null,expanded:new Set,pending:new Set,mapping:null,customModel:null,capability:null};const Fj=new Set;function Jf(){return ts}function K9(e){return Fj.add(e),()=>{Fj.delete(e)}}function Ps(e){const t={...ts,...e},a=$g(t),o=$g(ts)!==a;ts=a===t.provider?t:{...t,provider:a},X9(),o&&qg();for(const c of Fj)c()}function Fg(e){Wt().wbFilterMemory?.save(qM,e)}function QM(){if(XM||Vg||!Wt().wbFilterMemory)return;XM=!0;const e=YM();(e.provider!==ts.provider||e.state!==ts.stateFilter||e.search!==ts.search||e.sort!==ts.sort)&&Ps(e)}function $g(e){const t=e.provider;return t==="all"||t===Wf||Fi().some(a=>a.id===t)||Array.isArray(e.data?.models)&&e.data.models.some(a=>(a.provider||"")===t)||!e.data||!$j()?t:"all"}function Du(){return $g(ts)}function $j(){return!!Wt().wbProviders}function Iu(){return Du()===Wf}function ZM(){return Iu()||es(Du())}let ep=null;function qj(e){const t=Ao(e);return(!ep||ep.id!==e||ep.record!==t)&&(ep={id:e,record:t,view:PM(e)||Vj}),ep.view}let tp=null;function Y9(){const e=DM();if(tp&&tp.directory===e)return tp.view;const t=[],a=[];for(const o of Fi()){const c=qj(String(o.id||""));t.push(...c.models||[]),a.push(...c.mappings||[])}return tp={directory:e,view:t.length||a.length?{models:t,mappings:a}:Vj},tp.view}function Gj(){const e=Du();return es(e)?qj(e):e===Wf?Y9():ts.data||Vj}function np(){const e=Gj();return Array.isArray(e.models)?e.models:[]}function WM(){const e=Gj();return Array.isArray(e.mappings)?e.mappings:[]}let JM=(e,t,a)=>"";function X9(){JM=U9(WM())}function Kj(){const e=new Map,t=Array.isArray(ts.data?.models)?ts.data.models:[];for(const a of t){const o=a.provider||"";if(!o)continue;const c=e.get(o)||{label:a.providerLabel||o,n:0};c.n++,e.set(o,c)}return e}function Q9(){const e=new Map;for(const t of Fi()){const a=String(t.id||"");if(!a)continue;const o=qj(a);e.set(a,{label:String(t.name||a),n:(o.models||[]).length})}return e}function Z9(){return[...Kj().keys()]}function W9(e){const a=(Array.isArray(ts.data?.models)?ts.data.models:[]).find(o=>o.provider===e);return Number(a?.refreshedAt)||0}function Yj(){const e=new Map;for(const t of np()){const a=t.provider||"";a&&!e.has(a)&&e.set(a,t.providerLabel||a)}return[...e].map(([t,a])=>({id:t,label:a}))}function e2(e){return e?np().filter(t=>(t.provider||"")===e).sort((t,a)=>+(t.enabled===!1)-+(a.enabled===!1)).map(t=>({id:t.id,label:t.name&&t.name!==t.id?r("{id}({name})",{id:t.id,name:t.name}):t.id,off:t.enabled===!1})):[]}function J9(){const e=[],t=Wt().wbProviders?.all?.();if(Array.isArray(t))for(const a of t){const o=String(a?.id||"");o&&e.push({id:o,label:String(a?.label||o)})}for(const a of Fi()){const o=String(a.id||"");o&&e.push({id:o,label:String(a.name||o)})}return e.length?e:Yj()}let sp=null,Xj=null;function t2(){const e=sp?sp.apply(Uj):Uj;return ZM()?e.filter(t=>!GM.has(t.key)):e}function qg(){Wt().wbColSettings?.syncStaticHead("models",Xj,ZM()?GM:null)}function eK(){if(sp)return;sp=Wt().wbColSettings?.register({id:"models",label:r("模型管理表"),columns:Uj,mount:()=>document.querySelector('.page[data-page="gateway"] .panel-head .head-actions'),buttonPlacement:"last",onChange:()=>{qg(),qi()}})||null,sp&&qi()}let Gg=0,Qj=!1;async function Kg({force:e=!1}={}){if(Qj&&!e)return;const t=++Gg;Qj=!0,QM();try{const a=await Wt().workbuddyDesktop?.getModelManage();if(t!==Gg)return;Ps({data:a&&Array.isArray(a.models)?a:null})}catch(a){if(t!==Gg)return;qi(),wr(r("读取模型清单失败:{message}",{message:Ro(a)}),"err")}finally{t===Gg&&(Qj=!1)}}async function n2(){try{await Wt().wbProviders?.refreshCustom?.()}catch{}await Kg({force:!0})}function qi(){Ps({})}function Gi(e){const t=e;if(t&&Array.isArray(t.models)){Ps({data:t});return}qi()}async function Yg(e,t,a,o){if(es(e))return _M(e,t,a,o);const c=Wt().workbuddyDesktop;if(!c)throw new Error(r("后端桥不可用"));return c.addModelMapping(t,a,e,o.reasoning,o.enabled)}async function tK(e,t,a){if(es(e))return LM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.removeModelMapping(t,a,e)}async function nK(e,t){if(es(e))return zM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.addCustomModel(e,t)}async function s2(e,t){if(es(e))return HM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.removeCustomModel(e,t)}async function sK(e,t,a){if(es(e))return BM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.setModelCapabilities(e,t,a)}async function Zj(e,t,a){if(!ts.pending.has(e)){Ps({pending:new Set(ts.pending).add(e)});try{Gi(await t()),a&&wr(a)}catch(o){wr(r("操作失败:{message}",{message:Ro(o)}),"err")}finally{const o=new Set(ts.pending);o.delete(e),Ps({pending:o})}}}function rp(e){return Pu(e).some(t=>t.enabled!==!1)}function Pu(e){const t=e.provider||"",a=WM().filter(p=>Oo(p.target,e.id)&&(!p.provider||Oo(p.provider,t))),o=new Map;for(const p of a){const h=String(p.alias).toLowerCase();(!o.has(h)||p.provider)&&o.set(h,p)}const c=String(e.id).toLowerCase(),d=o.get(c);o.delete(c);const f=[{alias:e.id,target:e.id,provider:t,enabled:e.enabled!==!1&&d?.enabled!==!1,isDefault:!0}];return f.push(...o.values()),f}const Ki=e=>`${e.provider||""}:${e.id}`,Wj=(e,t,a)=>`${e}:${t}:${a||""}`;function rK(e){Ps({expanded:new Set(ts.expanded).add(e)})}function aK(e){const t=new Set(ts.expanded);t.delete(e),Ps({expanded:t})}function lK(e){const t=Bj.includes(e)?e:"all";t!==ts.stateFilter&&(Vg=!0,Ps({stateFilter:t}),Fg({state:t}))}function oK(e){const t=Hj.includes(e)?e:"default";t!==ts.sort&&(Vg=!0,Ps({sort:t}),Fg({sort:t}))}function iK(e){Vg=!0,Ps({search:e}),Fg({search:e})}function ap(e){Ps({provider:String(e??"").trim()||"all"}),Fg({provider:ts.provider}),qg()}async function cK(e){const t=Wt().wbCustomProvidersUi;if(!t?.remove){wr(r("删除入口未就绪,请重试或重启应用"),"err");return}await t.remove(e)&&await Kg({force:!0})}function uK(){Wt().wbAccountAddForms?.openNewCustomForm?.()}function r2(e){Ps({mapping:e})}function dK(){Ps({mapping:null})}function fK(){const e=Du(),t=es(e);Ps({customModel:{provider:t||e!=="all"&&e!==Wf?e:"",locked:t}})}function pK(){Ps({customModel:null})}function a2(e,t){Ps({capability:{provider:e,id:t}})}function mK(){Ps({capability:null})}function l2(e,t){return np().find(a=>(a.provider||"")===e&&Oo(a.id,t))||null}function Jj(e){if(es(e)){const t=Ao(e)?.name;return typeof t=="string"&&t||e}return Wt().wbProviders?.labelOf?.(e)||e}function o2(){const e=Du(),t=es(e),a=t?Ao(e)?.name||e:r("内置提供商");Wt().wbModelsFetchModal?.open({providerId:e===Wf?"":e,custom:t,name:a,onDone:()=>qi(),onRefreshed:()=>{Kg({force:!0})}})}window.wbModelsPanel={render:qi,load:Kg,refreshAll:n2,refreshModels:o2,visibleColumns:t2,selectProvider:ap,builtinProviders:Z9,providerRefreshedAt:W9};function e0(e,t,a){return JM(e,t,a)}function hK(e){Xj=e}function gK(){const e=Xj;if(!e)return;const t=o=>Object.keys(o).some(c=>c.startsWith("__reactFiber$")||c.startsWith("__reactInternalInstance$"));for(const o of[...e.children])o.tagName==="TBODY"?o.id!=="models"&&o.remove():o.tagName==="TR"&&!t(o)&&o.remove();const a=e.querySelector("tbody#models");if(a)for(const o of[...a.children])t(o)||o.remove()}const xK=e=>[{value:"inherit",label:e},{value:"on",label:r("支持")},{value:"off",label:r("不支持")}];function bK(e){const t=Lj(e);return r(t==="on"?"支持":t==="off"?"不支持":"未声明")}function i2(e,t,a,o,c=""){const d=t!=null,f=Yf.includes(e)?Xf(t):bK(t);return a?o?r("已填写:对下游声明 {value}",{value:f}):r("已覆盖:对下游声明 {value}",{value:f}):o?r("未填写(下游按未声明处理)"):d?c==="modelsdev"?r("models.dev 补齐:对下游声明 {value}",{value:f}):r("继承上游:{value}",{value:f}):r("上游未声明(下游会按不支持处理)")}function vK(e,t,a){return a?Ru.filter(o=>{const c=e[o];return c!=null}):t}function yK(e,t){const a={};for(const o of Ru){const c=t.includes(o),d=e[o];Yf.includes(o)?a[o]=c&&typeof d=="number"?String(d):"":a[o]=c?d===!0?"on":"off":"inherit"}return a}function wK({context:e,onClose:t}){const a=es(e.provider),o=l2(e.provider,e.id),c=M9(o),d=_j(o),f=vK(d,Pj(o?.capOverrides),a),[p,h]=x.useState(()=>yK(d,f)),[b,y]=x.useState(""),[v,w]=x.useState(!1);if(!o)return s.jsx(Qt,{open:!0,onOpenChange:R=>{R||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const j=o.id,S=o.providerLabel||Jj(e.provider),N=r(a?"未声明":"继承上游"),k=r(a?"清除":"恢复继承");function T(R){const I=d[R];return D(R)?"":a?r("未填写"):typeof I=="number"?r("继承上游 {value}",{value:Xf(I)}):r("上游未声明")}function D(R){return f.includes(R)}function C(R,I){h(P=>({...P,[R]:I}))}async function A(){if(!v){for(const R of Yf){const I=p[R].trim();if(I&&Ij(R,I)===null){y(r("{label}要填 1 ~ 1 亿之间的整数(留空 = {inherit})",{label:Ou[R],inherit:N}));return}}w(!0),y(r("保存中…"));try{Gi(await sK(e.provider,e.id,P9(p))),t(),wr(r("✅ 已保存 {id} 的能力位({provider})",{id:j,provider:S}))}catch(R){y(r("保存失败:{message}",{message:Ro(R)})),w(!1)}}}return s.jsx(Qt,{open:!0,onOpenChange:(R,I)=>{if(!R){if(v){I.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[s.jsx("b",{className:"text-primary-fg",children:o.id}),r("({provider})",{provider:S})]}),Yf.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:`cap-${R}`,children:Ou[R]}),D(R)?s.jsx(se,{variant:"ghost",size:"2xs",disabled:v,title:r(a?"清除这一项(回到未声明)":"清除覆盖,回到上游声明值"),onClick:()=>C(R,""),children:k}):null]}),s.jsx($e,{id:`cap-${R}`,inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:T(R),disabled:v,value:p[R],onChange:I=>C(R,I.currentTarget.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A())}}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:i2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),AM.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:Ou[R]}),s.jsx(In,{options:xK(N),value:p[R],"aria-label":Ou[R],className:"self-start",onValueChange:I=>C(R,String(I))}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:i2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),c?s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 text-xs leading-[1.7] text-subtle",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{children:r("可配思考档位")}),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.levels.join(" / ")}),c.defaultLevel?s.jsxs("span",{children:[r("(默认 "),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.defaultLevel}),r(")")]}):null]}),s.jsx("div",{className:"mt-1",children:r("这是模型自己能配的档位(来自上游目录),只读;要改某一档请到映射弹窗里选。")})]}):null,s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("这几项是给"),s.jsx("b",{children:r("下游客户端")}),r("看的能力声明("),s.jsx("code",{children:"/v1/models"}),r(" 里的 "),s.jsx("code",{children:"max_input_tokens"})," / ",s.jsx("code",{children:"supports_*"}),r(" 与 "),s.jsx("code",{children:"input_modalities"}),r("),下游按它们决定发不发图片、按多大的窗口堆历史。"),s.jsx("b",{children:r("不影响网关的转发与路由")}),r("。上游清单给的值不准时,在这里改;"),r(a?"这家的清单是你自己登记的,不填的项下游按未声明处理。":"「恢复继承」会把这一项交还给上游清单的值。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:v,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{A()},children:r("保存")})]})]})})}function lp(){return window}const jK="你好",c2=4e3,SK=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],NK={chat_completions:"Chat Completions",responses:"Responses",anthropic:"Anthropic Messages"},kK="direct",CK={remote:r("远程目录"),builtin:r("内置清单"),manual:r("手动登记")},TK=[{test:e=>e===429,hint:r("该账号对这个模型正在限额冷却,等一会儿自己会好;也可以先测别的账号。")},{test:e=>e===401||e===403,hint:r("上游拒绝了这条登录态:重新登录一次,或把这条账号删掉。")},{test:e=>e===404,hint:r("上游不认识这个模型名:先点「获取模型」刷新清单,或核对默认绑定指向的上游模型。")},{test:e=>e===504,hint:r("上游没在预算内给完回答。可以只勾一个账号再测一次,看是普遍慢还是某一个账号慢。")},{test:e=>e>=500,hint:r("多半是上游自己的问题,过一会儿再试。同一个错误出现在所有账号上时,先查模型目录与映射。")}];function u2(){return lp().wbApp?.getState?.()?.accounts?.accounts||[]}function d2(e){return u2().filter(t=>(t.provider||ou)===e&&t.available!==!1&&t.enabled!==!1).sort(qh)}function f2(e){const t=String(e.email||"").trim();return t&&ir(e.provider).emailAsName?t:cu(e)||t||r("未命名账号")}function EK(){const e=globalThis.crypto?.randomUUID?.();if(e)return e;const t=a=>Array.from({length:a},()=>Math.floor(Math.random()*16).toString(16)).join("");return`${t(8)}-${t(4)}-4${t(3)}-a${t(3)}-${t(12)}`}function t0(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"—":t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function AK(e,t){return d2(e).length?"":r("该提供商没有可用账号(要在账号页启用一个、且凭证完整),一行都发不出去")}function p2({children:e,plain:t=!1}){return s.jsxs("p",{className:t?"flex items-center gap-2 text-xs leading-[1.6] text-subtle":"flex gap-2 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs leading-[1.65] text-subtle",children:[s.jsx("span",{"aria-hidden":"true",className:t?"size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]":"mt-px size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]",children:"i"}),s.jsx("span",{children:e})]})}function RK({open:e,label:t,text:a,onToggle:o}){return s.jsxs("div",{className:"overflow-hidden rounded-sm border border-border",children:[s.jsxs(se,{variant:"ghost",size:"xs",className:"w-full","aria-expanded":e,onClick:o,children:[s.jsx("span",{className:"truncate",children:t}),s.jsx("span",{"aria-hidden":"true",className:"ml-auto text-[10px]",children:e?"▴":"▾"})]}),e?s.jsx("div",{className:"border-t border-hairline bg-surface px-2.5 py-2",children:s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-[1.65] text-subtle",children:a})}):null]})}function OK(e){const[t,a]=x.useState(()=>Date.now());return x.useEffect(()=>{if(!e)return;a(Date.now());const o=window.setInterval(()=>a(Date.now()),400);return()=>window.clearInterval(o)},[e]),t}function m2(e){if(e.transport||!e.result||e.result.error)return!1;const t=Number(e.result.status)||0;return t>=200&&t<300}function MK({target:e,onClose:t}){const a=e.provider,o=l2(a,e.id),c=d2(a),d=mw(u2()),[f,p]=x.useState(""),[h,b]=x.useState(jK),[y,v]=x.useState("chat_completions"),[w,j]=x.useState(""),[S,N]=x.useState(null),[k,T]=x.useState(""),[D,C]=x.useState(""),[A,R]=x.useState(!0),[I,P]=x.useState(()=>{const te=c.find(Ce=>!vf(Ce,e.id))||c[0];return te?[te.id]:[]}),[O,_]=x.useState([]),[L,H]=x.useState(()=>new Set),B=x.useRef(0),z=x.useRef([]);z.current=O;const Q=O.some(te=>te.state==="running"),K=OK(Q);x.useEffect(()=>{let te=!0;return(async()=>{try{const Ce=lp().workbuddyDesktop?.getProxyPool;if(typeof Ce!="function")throw new Error(r("当前环境不支持代理池"));const re=await Ce();if(!te)return;if(!re||typeof re!="object"||!Array.isArray(re.items))throw new Error(r("代理池响应异常"));N(re.items),T("")}catch(Ce){if(!te)return;N([]),T(Ro(Ce))}})(),()=>{te=!1}},[]);const X=x.useCallback((te=!1)=>{const Ce=z.current.filter(re=>re.state==="running");B.current+=1;for(const re of Ce)lp().workbuddyDesktop?.terminateStatsRequest?.(re.testId)?.catch(()=>{});_([]),Ce.length&&!te&&wr(r("已中止在途测试({n} 个账号)",{n:Ce.length}))},[]);x.useEffect(()=>()=>{X(!0)},[X]);async function q(te,Ce){const re={provider:a,model:e.id,account_id:te.accountId,prompt:h.trim(),system_prompt:f.trim(),reasoning:D,stream:A,protocol:y,...w?{proxy:w}:{},test_id:te.testId},de=ke=>{B.current===Ce&&_(Ee=>Ee.map(ve=>ve.testId===te.testId?{...ve,...ke}:ve))};try{const ke=await lp().workbuddyDesktop?.testModel(re);if(!ke){de({state:"done",transport:r("桥接调用返回空(本机网关没有响应这次测试)")});return}de({state:"done",result:ke})}catch(ke){de({state:"done",transport:Ro(ke)})}}function $(){const te=c.filter(ke=>I.includes(ke.id));if(!te.length){wr(r("至少选一个测试账号"),"err");return}const Ce=B.current+1;B.current=Ce;const re=Date.now(),de=te.map(ke=>({accountId:ke.id,label:f2(ke),position:d.get(ke.id)?.position||0,testId:EK(),startedAt:re,state:"running"}));H(new Set),_(de);for(const ke of de)q(ke,Ce)}function Y(){Q?X():_([])}const F=s.jsx("span",{className:"ml-2 font-mono text-[12px] font-normal text-subtle",children:e.id});if(!o)return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("测试模型")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const G=Pu(o).find(te=>te.isDefault)?.enabled===!1,W=e0(o.id,o.id,a),le=Pu(o).filter(te=>!te.isDefault).map(te=>te.alias),M=Zf(Jf().data,o).filter(te=>te!=="off"&&te!=="none"),U=G?r("跟随映射(该行未启用,本次不注入)"):W?r("跟随映射(当前 {level})",{level:W}):r("跟随映射(未绑定等级)"),Z=[r("以模型本名直发"),le.length?r("另有 {n} 条别名映射({aliases}),别名不参与本次",{n:le.length,aliases:le.join(r("、"))}):"",G?r("该行当前未启用:测试照常按本名直发(「先测通、再决定要不要启用」正是这颗按钮的用法),但本行的思考等级绑定不参与本次,生产路由也要等绑定打开后才会放行"):W?r("映射上绑定的思考等级是 {level},「跟随映射」按它注入",{level:W}):r("映射上未绑定思考等级,「跟随映射」等于这次不注入")].filter(Boolean).join(r(";"))+r("。"),ae=lp().wbProviders?.PROTOCOL_OPTIONS||SK,ce=ae.find(te=>te.value===y)?.label||y,J=[{value:"",label:r("跟随账号配置")},{value:kK,label:r("直连(不使用代理)")},...(S??[]).map(te=>({value:`${Xa}${te.id}`,label:au(te)}))];S===null?J.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):S.length||J.push({value:"__hint_pool__",label:r(k?"代理列表读取失败":"还没有代理(去「网络代理」页添加)"),disabled:!0});const ie=J.find(te=>te.value===w)?.label||r("跟随账号配置"),ge=c.map(te=>({value:te.id,label:`#${d.get(te.id)?.position||0} ${f2(te)}`+(vf(te,e.id)?r(" · 限额中"):"")}));function ee(te){const Ce=(he,ye)=>s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-hairline px-3 py-2",children:[he,s.jsx("b",{className:"min-w-0 truncate text-[12.5px] text-foreground",title:te.label,children:te.label}),te.position?s.jsxs("span",{className:"flex-none text-xs text-subtle",children:["#",te.position]}):null,s.jsx("span",{className:"ml-auto flex-none font-mono text-[11.5px] tabular-nums text-subtle",children:ye})]},"head");if(te.state==="running"){const he=(K-te.startedAt)/1e3;return s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs text-subtle",children:[s.jsx(ef,{className:"flex-none"}),s.jsxs("span",{className:"min-w-0 truncate",children:[r("账号 "),s.jsx("b",{className:"text-foreground",children:te.label}),r(" 已发出,等待上游首帧…")]}),s.jsx("span",{className:"ml-auto flex-none font-mono tabular-nums",children:r("已等待 {seconds}s",{seconds:he.toFixed(1)})})]},te.testId)}const re=te.result;if(!m2(te)){const he=Number(re?.status)||0,ye=TK.find(je=>je.test(he))?.hint??(te.transport?r("确认桌面端还在运行,再重试一次。"):"");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"destructive",className:"flex-none",children:he||r("失败")}),r("用时 {time}",{time:t0(re?.duration_ms)})),s.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2.5",children:[s.jsxs("div",{className:"text-[12.5px] leading-[1.7]",children:[te.transport?s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("本机网关没有返回结论")}),r(":"),te.transport]}):s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("测试未通过")}),r(":"),re?.error||r("上游没有给出可读的错误说明")]}),Number(re?.attempts)>1?r("(中间共尝试 {n} 次)",{n:Number(re?.attempts)}):""]}),ye?s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:ye}):null]})]},te.testId)}const de=String(re?.reply??""),ke=String(re?.reasoning??""),Ee=`think-${te.testId}`,ve=[re?.upstream_model&&re.upstream_model!==e.id?r("上游 {model}",{model:re.upstream_model}):"",re?.upstream_reasoning?r("思考等级 {level}",{level:re.upstream_reasoning}):"",re?.protocol&&re.protocol!=="chat_completions"?NK[re.protocol]||re.protocol:"",re?.proxy?r("节点 {proxy}",{proxy:re.proxy}):"",Number(re?.attempts)>1?r("尝试 {n} 次",{n:Number(re?.attempts)}):""].filter(Boolean).join(" · ");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"success",className:"flex-none",children:Number(re?.status)||200}),r("用时 {time} · 首字 {ttfb}",{time:t0(re?.duration_ms),ttfb:t0(re?.ttfb_ms)})),s.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-subtle",children:[s.jsx("span",{className:"flex-none",children:r("回复")}),ve?s.jsx("span",{className:"min-w-0 truncate",title:ve,children:ve}):null,s.jsx(se,{variant:"ghost",size:"2xs",className:"ml-auto flex-none","data-copy":de,children:r("复制")})]}),s.jsx("div",{className:"max-h-[220px] overflow-y-auto whitespace-pre-wrap rounded-sm border border-border bg-surface px-3 py-2 text-[12.5px] leading-[1.7]",children:de||s.jsx("span",{className:"text-subtle",children:r("(上游这一次返回了空正文)")})}),ke?s.jsx(RK,{open:L.has(Ee),label:r("思考过程({n} 字)",{n:ke.length}),text:ke,onToggle:()=>H(he=>{const ye=new Set(he);return ye.has(Ee)?ye.delete(Ee):ye.add(Ee),ye})}):null]})]},te.testId)}function fe(){if(Q){const Ce=O.length-O.filter(re=>re.state==="running").length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[r("正在测 "),s.jsx("b",{className:"text-foreground",children:O.length}),r(" 个账号"),Ce?s.jsxs(s.Fragment,{children:[r(",已完成 "),s.jsx("b",{className:"text-foreground",children:Ce})]}):null,r("。")]}):null,O.map(re=>ee(re))]})}const te=O.filter(m2).length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[s.jsx("b",{className:te?"text-success":"text-foreground",children:te}),r(" 成功 ·"),s.jsxs("b",{className:O.length-te?"text-destructive":"text-foreground",children:[" ",O.length-te]}),r(" 失败")]}):null,O.map(Ce=>ee(Ce)),te===0?s.jsxs(p2,{children:[r("两边原因不一样时各自处理。如果"),s.jsx("b",{className:"text-foreground",children:r("同一条错误出现在所有账号上")}),r(",通常就不是账号问题了:先确认这个模型还在上游目录里(「获取模型」刷一次),再看默认绑定指向的上游模型对不对。")]}):null]})}return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r("测试模型"),F]})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-inset px-3 py-2.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12.5px] font-semibold text-primary-fg",title:o.id,children:o.id}),s.jsx(ze,{shape:"tag",variant:"brand",children:Jj(a)}),s.jsx(ze,{shape:"tag",variant:"outline",children:es(a)?r("自定义家"):CK[o.source]||r("来源未知")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("本次测试的发送口径")}),children:"?"}),s.jsx(_i,{children:Z})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-system",children:r("系统提示词")}),s.jsx(Qc,{id:"model-test-system",rows:2,maxLength:c2,placeholder:r("留空则不携带;设置页的提示词模式照常生效"),value:f,onChange:te=>p(te.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-prompt",children:r("用户提示词")}),s.jsx(Qc,{id:"model-test-prompt",rows:2,maxLength:c2,placeholder:r("留空用默认问候「你好」"),value:h,onChange:te=>b(te.currentTarget.value)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-protocol",children:r("对话协议")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("对话协议的说明")}),children:"?"}),s.jsx(_i,{children:r("按所选网关对话协议组装请求并校验响应转换(Chat Completions / Responses / Anthropic Messages)。")})]})]}),s.jsxs(ft,{value:y,onValueChange:te=>v(String(te)),children:[s.jsx(mt,{id:"model-test-protocol",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ce})}),s.jsx(ht,{children:ae.map(te=>s.jsx(qe,{value:te.value,children:te.label},te.value))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-proxy",children:r("测试节点")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试节点的说明")}),children:"?"}),s.jsx(_i,{children:r("仅本次测试临时生效,不修改账号保存的代理配置。可选「网络代理」页里的节点或强制直连。")})]})]}),s.jsxs(ft,{value:w,onValueChange:te=>j(String(te)),children:[s.jsx(mt,{id:"model-test-proxy",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ie})}),s.jsx(ht,{children:J.map(te=>s.jsx(qe,{value:te.value,disabled:te.disabled,children:te.label},te.value))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:D,onValueChange:te=>C(String(te)),children:[s.jsx(mt,{id:"model-test-reasoning",className:"w-full",children:s.jsx(pt,{children:D?r("{level}(本次指定)",{level:D}):U})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:U}),M.map(te=>s.jsx(qe,{value:te,children:r("{level}(本次指定)",{level:te})},te))]})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-stream",children:r("流式请求")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("流式请求的说明")}),children:"?"}),s.jsx(_i,{children:r("默认开,与真实请求一致:可同时验证 SSE 链路与首字延迟。")})]})]}),s.jsx(hs,{id:"model-test-stream",checked:A,onCheckedChange:te=>R(!!te)})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Je,{htmlFor:"model-test-accounts",children:r("测试账号")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试账号的说明")}),children:"?"}),s.jsx(_i,{children:r("勾几个就并行测几次;默认选队列里最靠前的一个。")})]}),s.jsx(se,{variant:"ghost",size:"xs",className:"ml-auto",disabled:!c.length||I.length===c.length,onClick:()=>P(c.map(te=>te.id)),children:r("全选({n})",{n:c.length})})]}),s.jsx(Bh,{id:"model-test-accounts",value:I,onValueChange:P,options:ge,placeholder:r("选一个账号(至少一个)"),searchPlaceholder:r("搜索账号…"),emptyHint:r("这家没有可用账号(要在账号页启用一个、且凭证完整)")})]}),s.jsx(p2,{plain:!0,children:r("真实链路 · 消耗少量额度 · 日志带「测试」标记,不计报表")})]}),s.jsxs(nn,{className:"justify-end",children:[s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:!I.length||!c.length,onClick:$,children:r("开始测试")})]}),s.jsx(Qt,{open:O.length>0,onOpenChange:te=>{te||Y()},children:s.jsxs(Zt,{overlayForceRender:!0,className:"w-[min(680px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r(Q?"测试中…":"测试结果"),F]})}),s.jsx(Bt,{children:fe()}),s.jsx(nn,{className:"justify-end",children:Q?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-xs text-subtle",children:r("关闭即中止")}),s.jsx(se,{variant:"outline",onClick:()=>X(),children:r("中止测试")}),s.jsx(se,{variant:"default",disabled:!0,children:r("测试中…")})]}):s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"outline",onClick:Y,children:r("关闭")}),s.jsx(se,{variant:"default",onClick:$,children:r("再测一次")})]})})]})})]})})}const h2=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"reasoning",label:r("设置思考等级")},{value:"delete",label:r("删除")}];function g2(e){return e.source==="manual"||es(e.provider)}function DK(e){return(e.name&&e.name!==e.id?r("{name}({id})",{name:e.name,id:e.id}):e.id)||e.id}function IK({models:e,onClose:t,onDone:a}){const[o,c]=x.useState("enable"),d=H9(Jf().data,e),[f,p]=x.useState(()=>({select:d[0]||"",custom:""})),[h,b]=x.useState(!1),[y,v]=x.useState(""),w=f.select===ca?f.custom.trim():f.select,j=e.filter(g2).length,S=h2.find(T=>T.value===o)?.label||r("操作");async function N(T){return Promise.resolve(Wt().wbConfirm?.ask?.({title:r("删除选中的模型"),html:r("确定删除选中的 {count} 个模型登记?删除后 /v1/models 不再广告它们、请求也会被拒。",{count:T})+(e.length>T?"
    "+r("另有 {n} 个非手动登记的模型将被跳过。",{n:e.length-T}):""),okText:r("删除"),okClass:"danger"})??!1)}async function k(){if(h)return;if(!e.length){wr(r("没有选中的模型"),"err");return}if(o==="reasoning"&&f.select===ca&&!w){v(s.jsx("span",{className:"text-destructive",children:r("请填写自定义思考等级,或改选候选档 / 「清除」")}));return}if(o==="delete"){if(j===0){v(s.jsx("span",{className:"text-destructive",children:r("选中的模型都不是手动登记,无法删除(开关映射才是它们的手段)")}));return}if(!await N(j))return}b(!0),v("");let T=0,D=0,C=0,A="";for(const R of e){const I=R.provider||"";try{if(o==="delete"){if(!g2(R)){D+=1;continue}Gi(await s2(I,R.id))}else if(o==="enable"||o==="disable"){const P=o==="enable";for(const O of Pu(R))Gi(await Yg(I,O.alias,R.id,{enabled:P}))}else for(const P of Pu(R))Gi(await Yg(I,P.alias,R.id,{reasoning:w}));T+=1}catch(P){C+=1,A||(A=Ro(P)),v(s.jsx("span",{className:"text-destructive",children:r("失败 {n} 个 · 首个失败:{error}",{n:C,error:A})}))}}C===0?(wr(D?r("✅ 批量{action}完成:共 {n} 个模型(跳过不可删除的 {skipped} 个)",{action:S,n:T,skipped:D}):r("✅ 批量{action}完成:共 {n} 个模型",{action:S,n:T})),a()):(wr(r("批量{action}完成:成功 {ok} 个,失败 {failed} 个",{action:S,ok:T,failed:C}),"err"),v(s.jsxs("span",{className:"text-destructive",children:[r("成功 {ok} 个,失败 {failed} 个",{ok:T,failed:C}),D?r(",跳过 {n} 个",{n:D}):"",A?r(";首个失败:{error}",{error:A}):""]}))),b(!1)}return s.jsx(Qt,{open:!0,onOpenChange:T=>{T||h||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {n} 个模型",{n:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下模型")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:e.map(DK).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:T=>c(T),className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:h2.map(T=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:T.value}),T.label]},T.value))}),o==="reasoning"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-model-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:f.select,onValueChange:T=>p(D=>({...D,select:String(T)})),children:[s.jsx(mt,{id:"batch-model-reasoning",className:"min-w-[220px]",children:s.jsx(pt,{children:f.select===ca?r("自定义等级…"):f.select||r("清除(不覆盖)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("清除(不覆盖)")}),d.map(T=>s.jsx(qe,{value:T,children:T},T)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]})]}),f.select===ca?s.jsxs("div",{className:"field-row mt-2",children:[s.jsx("label",{htmlFor:"batch-model-reasoning-custom",children:r("自定义等级")}),s.jsx($e,{id:"batch-model-reasoning-custom",maxLength:32,value:f.custom,onChange:T=>p(D=>({...D,custom:T.currentTarget.value}))})]}):null,s.jsxs("p",{className:"detail mt-1.5",children:[r("设置 / 清除会应用到选中模型的"),s.jsx("b",{children:r("全部映射")}),r("(默认绑定与别名 chips);「清除」= 不给这些映射指定等级(选「不覆盖」的口径与映射弹窗一致)")]})]}):null,o==="delete"?s.jsx("p",{className:"detail mt-2",children:j===0?r("选中的都不是手动登记的模型,删除不可用(上游目录带回来的行由清单决定存在性)"):r("可删除 {n} 个(手动登记 / 自定义家);",{n:j})+(e.length>j?r("其余 {n} 个会被跳过。",{n:e.length-j}):"")}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:y})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:h,onClick:t,children:r("关闭")}),s.jsx(se,{variant:o==="delete"?"destructive":"default",disabled:h,onClick:()=>{k()},children:h?r("执行中…"):r("执行{action}",{action:S})})]})]})})}function er(){return window}const x2={intl:"fm-table-intl",custom:"fm-table-custom"},b2={intl:"fetch-models",custom:"fetch-models-custom"},n0=["provider","source","state","count","note","updated","op"],s0=["pick","model","state"],PK={provider:"w-[13%]",source:"w-[21%]",state:"w-[9%]",count:"w-[6%]",note:"w-[20%]",updated:"w-[16%]",op:"w-[15%]"},_K={pick:"w-[8%]",model:"w-[74%]",state:"w-[18%]"},LK={pick:"",provider:r("提供商"),source:r("模型来源"),state:r("状态"),count:r("模型数"),note:r("说明"),updated:r("更新日期"),model:r("上游模型"),op:r("操作")},zK={refreshed:{variant:"brand",label:r("已刷新")},failed:{variant:"destructive",label:r("失败")},skipped:{variant:"outline",label:r("跳过")}},v2=new Set(["cline-free","cline-pass"]),y2="workbuddy-desktop-fetch-model-source";function op(e){return String(e??"").trim().toLowerCase()}function r0(e,t){er().wbApp?.toast?.(e,t)}function a0(e){return e instanceof Error?e.message:String(e)}function w2(e){const t=er().formatTime??er().wbApp?.formatTime;return String(t?.(e)??"")}function j2(){return er().wbApp?.getState?.()?.accounts?.accounts||[]}function BK(e){const a=(er().wbProviders?.customList?.()||[]).find(o=>o.id===e)?.models;return new Set((Array.isArray(a)?a:[]).map(o=>op(o?.id)).filter(Boolean))}function S2(e){if(e?.nameCustom===!0&&e?.name)return e.name;const t=String(e?.email||"").trim();return er().wbAccountsModel?.providerFeatures?.(e?.provider)?.emailAsName&&t?t:String(e?.nickname||e?.name||t||e?.id||"").trim()||r("未命名账号")}function HK(e){if(v2.has(e))return[];const t=er().wbAccountsModel?.byPriorityOrder,a=j2().filter(o=>(o?.provider||"workbuddy")===e&&o?.available!==!1&&o?.enabled!==!1);return t?a.sort(t):a}function N2(){const e=new Set(er().wbModelsPanel?.builtinProviders?.()||[]);for(const t of j2())t?.available===!1||t?.enabled===!1||e.add(t?.provider||"workbuddy");return[...e]}function UK(){const e=new Set(N2());return(er().wbProviders?.all?.()||[]).filter(t=>e.has(t?.id??""))}function VK(e){return w2(Number(e.refreshedAt)||0)||"—"}function FK(e){return zK[String(e.status)]??{variant:"outline",label:String(e.status||r("未知"))}}function $K(){try{const e=JSON.parse(localStorage.getItem(y2)||"{}");if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&o&&(t[a]=o);return t}catch{return{}}}function qK(e){er().wbFilterMemory?.save?.(y2,e)}function GK({options:e,onClose:t}){const a=e.providerId,o=!!e.custom,c=e.name||a,{onDone:d,onRefreshed:f}=e,[p,h]=x.useState("idle"),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(null),[N,k]=x.useState(""),T=j!==null,[D,C]=x.useState(!1),[A,R]=x.useState([]),[I,P]=x.useState(()=>new Set),[O,_]=x.useState(()=>new Set),[L,H]=x.useState([]),[B,z]=x.useState(""),[Q,K]=x.useState($K);x.useEffect(()=>{er().wbTableColumns?.repaint?.(o?b2.custom:b2.intl)},[o]);const X=o?[]:UK(),q=o?[]:G(),$=B.trim().toLowerCase(),Y=A.filter(ve=>!$||ve.toLowerCase().includes($)),F=o?D?r("已选 {picked} 个 · 上游共 {upstream} 个 · 清单已有 {managed} 个",{picked:O.size,upstream:A.length,managed:I.size}):r("尚未获取"):W(q);function G(){const ve=new Map(L.map(je=>[String(je.provider||""),je])),he=X.map(je=>{const xe=String(je.id||"");return{provider:xe,label:String(je.label||xe),item:ve.get(xe)}}),ye=new Set(he.map(je=>je.provider));for(const je of L){const xe=String(je.provider||"");ye.has(xe)||he.push({provider:xe,label:String(je.providerLabel||xe),item:je})}return he}function W(ve){if(p==="loading")return r("正在刷新…");if(p==="error")return"";const he=ve.map(xe=>xe.item).filter(xe=>!!xe);if(!he.length)return D?r("刷新完成,但没有得到任何结果"):ve.length?r("共 {n} 家 · 点「获取模型」开始",{n:ve.length}):r("0 家");const ye=he.filter(xe=>xe.status==="refreshed").length,je=he.filter(xe=>xe.status==="failed").length;return je?r("{total} 家 · 成功 {done} · 失败 {failed}",{total:ve.length,done:ye,failed:je}):r("{total} 家 · 成功 {done}",{total:ve.length,done:ye})}function le(ve,he){const ye=HK(ve);if(!ye.length)return{list:ye,selected:""};const je=String(Q[ve]||""),xe=String(he||""),Te=Oe=>ye.some(Ne=>String(Ne.id)===Oe);return{list:ye,selected:Te(je)?je:Te(xe)?xe:String(ye[0].id)}}function M(ve){const he={};for(const[ye,je]of Object.entries(Q))je&&(he[ye]=je);for(const ye of ve){const{selected:je}=le(ye.provider,ye.reported);je&&(he[ye.provider]=je)}return he}const U=q.map(ve=>({provider:ve.provider,reported:ve.item?.accountId}));function Z(ve,he){K(ye=>({...ye,[ve]:he})),qK({[ve]:he})}async function ae(){if(!T){S("load"),w(""),y(""),h("loading");try{if(o){const he=await er().wbProviders?.customRequest?.("POST","/api/custom-providers/fetch-models",{providerId:a}),ye=new Set,je=(Array.isArray(he?.models)?he.models:[]).map(Te=>String(Te??"").trim()).filter(Te=>{const Oe=op(Te);return!Te||ye.has(Oe)?!1:(ye.add(Oe),!0)}),xe=BK(a);R(je),P(xe),_(new Set(je.filter(Te=>!xe.has(op(Te))))),C(!0),h("ready");return}const ve=await er().workbuddyDesktop?.refreshModels({accounts:M(U),providers:N2()});H(Array.isArray(ve?.results)?ve.results:[]),C(!0),h("ready"),Number(ve?.refreshed)>0&&f?.()}catch(ve){const he=a0(ve);y(he),h("error"),w(he)}finally{S(null)}}}async function ce(ve){if(!(T||!ve.provider)){S("row"),k(ve.provider),w("");try{const he=await er().workbuddyDesktop?.refreshModels({accounts:M([{provider:ve.provider,reported:ve.item?.accountId}]),providers:[ve.provider]});H(ye=>J(ye,Array.isArray(he?.results)?he.results:[])),C(!0),h("ready"),Number(he?.refreshed)>0&&f?.()}catch(he){const ye=a0(he);w(ye),r0(r("获取失败:{message}",{message:ye}),"err")}finally{S(null),k("")}}}function J(ve,he){const ye=new Map(he.map(Te=>[String(Te.provider||""),Te])),je=ve.map(Te=>ye.get(String(Te.provider||""))??Te),xe=new Set(je.map(Te=>String(Te.provider||"")));for(const Te of he)xe.has(String(Te.provider||""))||je.push(Te);return je}async function ie(){if(!o||T||!O.size)return;const ve=[...O];S("import"),w("");try{const he=Number(await er().wbModelsCustom?.addModels?.(a,ve))||0;r0(r("✅ 已导入 {added} 个模型({skipped} 个已存在,跳过)",{added:he,skipped:ve.length-he})),S(null),t(),d?.()}catch(he){const ye=a0(he);r0(r("导入失败:{message}",{message:ye}),"err"),w(ye),S(null)}}function ge(){T||t()}function ee(){const ve=new Set(O);for(const he of A)I.has(op(he))||ve.add(he);_(ve)}function fe(ve){return s.jsx(kl,{children:s.jsx(Nn,{colSpan:o?s0.length:n0.length,className:"py-[26px] text-center text-muted-foreground",children:ve})})}function te(ve){return s.jsx("span",{className:"font-mono text-[11.5px] tabular-nums text-muted-foreground",children:ve})}function Ce(ve){return s.jsx("div",{className:"truncate font-mono text-[12px] font-semibold",children:ve})}function re(ve,he){const{list:ye,selected:je}=le(ve,he);if(!ye.length){const Te=v2.has(ve)?r("这家的模型清单是全局的,不跟账号走"):r("这家还没有可用账号,刷新会使用默认登录态");return s.jsx("span",{className:"text-[11.5px] text-muted-foreground",title:Te,children:"—"})}const xe=ye.find(Te=>String(Te.id)===je);return s.jsxs(ft,{value:je,onValueChange:Te=>Z(ve,String(Te)),children:[s.jsx(mt,{className:"w-full",title:r("用哪个账号去拉这家的模型清单"),"aria-label":r("模型来源"),children:s.jsx(pt,{children:xe?S2(xe):"—"})}),s.jsx(ht,{children:ye.map(Te=>s.jsx(qe,{value:String(Te.id),children:S2(Te)},String(Te.id)))})]})}function de(){return p==="idle"?fe(r("点右侧「获取模型」从上游拉取这家的模型清单")):p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):Y.length?Y.map(ve=>{const he=I.has(op(ve));return s.jsxs(kl,{className:he?"opacity-50":void 0,children:[s.jsx(Nn,{children:s.jsx(Mr,{checked:O.has(ve),disabled:he,"aria-label":ve,onCheckedChange:ye=>_(je=>{const xe=new Set(je);return ye?xe.add(ve):xe.delete(ve),xe})})}),s.jsx(Nn,{children:Ce(ve)}),s.jsx(Nn,{children:he?s.jsx(ze,{variant:"brand",title:r("这个模型已经在这家的清单里,不重复导入"),children:r("已添加")}):s.jsx(ze,{variant:"outline",title:r("勾上它,导入后即进入这家的清单"),children:r("未添加")})})]},ve)}):fe(A.length?r("没有匹配「{keyword}」的模型",{keyword:$}):r("上游没有返回任何模型"))}function ke(ve){const he=j==="row"&&N===ve.provider;return s.jsx(se,{variant:"outline",size:"sm",className:"w-full",disabled:T,title:r("只刷新这一家的模型清单"),onClick:()=>{ce(ve)},children:he?r("获取中…"):ve.item?r("重新获取"):r("获取")})}function Ee(){return p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):q.length?q.map(ve=>{const he=ve.item;if(!he){const Te=w2(Number(er().wbModelsPanel?.providerRefreshedAt?.(ve.provider))||0);return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider)}),s.jsx(Nn,{children:s.jsx(ze,{variant:"outline",children:r("待获取")})}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te(Te||"—")}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}const ye=FK(he),je=Number(he.count),xe=he.status==="refreshed"?r("远程目录已更新,「来源」列会显示为「远程」"):he.message||(he.fixed?r("这家用固定模型清单,无可刷新"):r("本次没有取到新内容"));return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider,he.accountId)}),s.jsx(Nn,{children:s.jsx(ze,{variant:ye.variant,children:ye.label})}),s.jsx(Nn,{children:te(je?r("{n} 个",{n:je}):"—")}),s.jsx(Nn,{children:s.jsx("span",{className:"text-[11.5px] leading-[1.5] text-muted-foreground",children:xe})}),s.jsx(Nn,{children:te(VK(he))}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}):fe(r("还没有可刷新的提供商:先在账号页添加一个账号"))}return s.jsx(Qt,{open:!0,onOpenChange:(ve,he)=>{if(!ve){if(T){he.cancel();return}t()}},children:s.jsxs(Zt,{className:o?"w-[min(552px,calc(100vw-48px))]":"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("获取模型 — {name}",{name:c})})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:F}),o&&s.jsxs(Ci,{className:"w-[240px] flex-none",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID…"),autoComplete:"off",value:B,onChange:ve=>z(ve.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),s.jsx("div",{className:"mr-auto"}),o&&s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",size:"sm",onClick:ee,children:r("全选未添加")}),s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_(new Set),children:r("清空")})]}),s.jsx(se,{variant:"outline",size:"sm",title:r("刷新全部家(逐家打上游)"),disabled:T,onClick:()=>{ae()},children:r(j==="load"?"获取中…":D?"重新获取":"获取模型")})]}),s.jsxs(Ky,{id:o?x2.custom:x2.intl,className:"table-fixed",containerClassName:"max-h-[min(48vh,460px)]",children:[s.jsx("colgroup",{children:(o?s0:n0).map(ve=>s.jsx("col",{"data-col":ve,className:o?_K[ve]:PK[ve]},ve))}),s.jsx(yE,{children:s.jsx(kl,{children:(o?s0:n0).map(ve=>s.jsx(wE,{"data-col":ve,children:LK[ve]},ve))})}),s.jsx(Yy,{className:"[&_tr:last-child>td]:border-b-0",children:o?de():Ee()})]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:v}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:ge,children:r(o?"取消":"完成")}),o&&s.jsx(se,{variant:"default",disabled:!O.size||T,onClick:()=>{ie()},children:j==="import"?r("导入中…"):O.size?r("导入选中的 {n} 个模型",{n:O.size}):r("导入")})]})]})})}let ip=null,_u=null;function k2(){ip&&(ip.unmount(),ip=null),_u&&(_u.remove(),_u=null)}function KK(e){e?.providerId&&(k2(),_u=document.createElement("div"),document.body.append(_u),ip=vn.createRoot(_u),ip.render(s.jsx(GK,{options:e,onClose:k2})))}window.wbModelsFetchModal={open:KK};const Mo=(e,t)=>t?`${e} ta-${t}`:e;function C2(e,t){const a=(t||"").trim();if(a)return np().find(o=>Oo(o.provider,e)&&Oo(o.id,a))}const YK="[.pv-row:hover_&_[data-slot=nav-item-count]]:invisible";function XK(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));return t?`${t[1]}x`:String(e||"")}function T2(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));if(!t)return null;const a=Number(t[1]);return Number.isFinite(a)?a:null}const QK={workbuddy:250,"workbuddy-intl":295,raccoon:60,catpaw:85,autoclaw:250,"autoclaw-intl":295,qoder:330,"qoder-intl":350,"cline-free":200,"cline-pass":200,codearts:210,loomy:155,kuku:15,accio:320,"accio-intl":335,trae:170,zcode:285};function ZK(e){const t=QK[e];if(t!==void 0)return t;let a=0;for(let o=0;o>>0;return a%360}function WK(e){const t=String(e||"").trim();if(!t)return"?";const a=t.match(/[A-Za-z]/);return(a?a[0]:t[t.length-1]).toUpperCase()}const JK=e=>({"--av-h":String(ZK(e))}),l0=s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"})]})});function eY(e){if(!e)return"";const t=Wt().wbPresetProviders?.list;if(!Array.isArray(t))return"";const a=t.find(o=>o.name===e);return a&&Wt().wbPresetProviders?.iconOf?.(String(a.key||""))||""}function tY(e,t){return es(e)?eY(t):hg[e==="workbuddy-intl"?"workbuddy":e]||""}function Lu(e,t,a){const o=a?"":tY(e,t),c=e==="all"||e==="custom-all";return s.jsx("span",{className:Ue("pv-ico",c&&"mute",o&&"img"),style:o?void 0:JK(e),"aria-hidden":"true",children:o?s.jsx("img",{src:o,alt:""}):a??WK(t)})}const nY={supportsToolCall:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),supportsImages:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),supportsVideo:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M10 8.5l6 3.5-6 3.5z"})]})}),supportsReasoning:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),s.jsx("path",{d:"M9 18h6M10 22h4"})]})})};function sY(e,t,a,o){return o==="enabled"&&!rp(e)||o==="disabled"&&rp(e)||o==="mapped"&&!(e.aliases||[]).length||a!=="all"&&(e.provider||"")!==a?!1:t?[e.id,e.name,...e.aliases||[]].join(" ").toLowerCase().includes(t):!0}function rY(){const e=x.useSyncExternalStore(K9,Jf),t=$g(e),a=es(t)||t==="custom-all",[o,c]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(new Set),b=a&&!Iu()&&$j()&&!Ao(t);x.useEffect(()=>{eK(),qg(),QM(),Wt().wbApp?.currentPage==="gateway"&&n2().then(()=>Wt().wbProviders?.refreshCustom?.()).then(()=>{qi()})},[]),x.useEffect(()=>{gK()});const y=Gj(),v=Array.isArray(y.models)?y.models:[],w=e.search.trim().toLowerCase(),j=v.filter(G=>sY(G,w,t,e.stateFilter)),S=e.sort,N=t2(),k=N.length,T=t==="all"?r("全部"):t==="custom-all"?r("自定义 · 全部"):a?String(Ao(t)?.name||t):Kj().get(t)?.label||Jj(t),D=v.filter(rp).length,C=v.filter(G=>(G.aliases||[]).length>0).length,A=ig(j.length,"models"),R=v.filter(G=>p.has(Ki(G))),I=(G,W)=>{const le=new Set(p);W?le.add(G):le.delete(G),h(le)},P=j.map(Ki),O=P.length>0&&P.every(G=>p.has(G)),_=P.some(G=>p.has(G)),L=s.jsx(Mr,{checked:O,indeterminate:!O&&_,disabled:!P.length,"aria-label":r("全选当前筛选结果"),title:r("全选当前筛选出的模型(跨分页);再点取消"),onCheckedChange:G=>{const W=new Set(p);for(const le of P)G===!0?W.add(le):W.delete(le);h(W)}});function H(){const G=Kj(),W=Fi(),le=Q9(),M=[...G.values()].reduce((ce,J)=>ce+J.n,0),U=r("全部({n} 家)",{n:G.size}),Z=[...le.values()].reduce((ce,J)=>ce+J.n,0),ae=r("全部({n} 家)",{n:[...le.values()].filter(ce=>ce.n>0).length});return s.jsxs("aside",{className:"prov-rail",id:"prov-rail","aria-label":r("按提供商选择"),children:[s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("内置提供商")}),s.jsx(ru,{active:t==="all","data-provider":"all",title:U,count:M,icon:Lu("all","",l0),className:"shadow-none",onClick:()=>ap("all"),children:U}),[...G].map(([ce,J])=>s.jsx(ru,{active:t===ce,"data-provider":ce,title:J.label,count:J.n,icon:Lu(ce,J.label),className:"shadow-none",onClick:()=>ap(ce),children:J.label},ce)),s.jsx("div",{className:"rail-label",children:r("自定义提供商")}),W.length?[...Z>0?[s.jsx(ru,{active:Iu(),"data-provider":"custom-all",title:ae,count:Z,icon:Lu("custom-all","",l0),className:"shadow-none",onClick:()=>ap("custom-all"),children:ae},"custom-all")]:[],...W.map(ce=>{const J=String(ce.id||""),ie=String(ce.name||J);return s.jsxs("div",{className:"pv-row",children:[s.jsx(ru,{active:t===J,"data-provider":J,title:ie,count:le.get(J)?.n??0,icon:Lu(J,ie),className:Ue("shadow-none",YK),onClick:()=>ap(J),children:ie}),s.jsx("button",{type:"button",className:"pv-del","aria-label":r("删除自定义提供商"),title:r("删除这个自定义提供商(连同名下账号)"),onClick:()=>{cK(J)},children:"×"})]},J)})]:s.jsx("div",{className:"rail-empty",children:r("还没有自定义提供商")})]}),s.jsx("div",{className:"rail-foot",children:s.jsx(ru,{variant:"add",id:"rail-add-custom",title:r("新建一个自定义提供商(同时创建它的第一个账号)"),onClick:()=>uK(),children:r("+ 新建自定义提供商")})})]})}function B(G,W,le,M){const U=e0(G,W,le);return s.jsx(se,{variant:U?"secondary":"dashed",size:"2xs",disabled:M,className:"font-mono font-bold shadow-none",title:U?r("思考等级 {level}(点击修改)",{level:U}):r("设置思考等级(当前未绑定)"),onClick:()=>r2({alias:G,target:W,provider:le}),children:U||r("+等级")})}function z(G){const W=G.provider||"",le=Pu(G),[M,...U]=le;async function Z(ce){await Wt().wbConfirm?.ask?.({title:r("删除映射"),html:r("确定删除映射「{alias} → {target}」?",{alias:zj(ce),target:zj(G.id)}),okText:r("删除"),okClass:"danger"})&&Zj(Wj(ce,G.id,W),()=>tK(W,ce,G.id),r("映射已删除"))}const ae=ce=>{const J=ce.alias,ie=ce.enabled!==!1,ge=e.pending.has(Wj(J,G.id,W));return s.jsxs("span",{className:Ue("alias",!ie&&"map-off"),children:[s.jsx(hs,{size:"sm",checked:ie,disabled:ge,title:r(ie?"映射已启用,点击关闭":"映射已关闭,点击启用"),"aria-label":r("{action}映射 {alias}",{action:r(ie?"关闭":"启用"),alias:J}),onCheckedChange:ee=>{Zj(Wj(J,G.id,W),()=>Yg(W,J,G.id,{enabled:ee}),r(ee?"映射已启用":"映射已关闭"))}}),s.jsx("span",{className:"t","data-copy":J,title:r("点击复制:{name}",{name:J}),children:J}),ce.isDefault?s.jsx("span",{className:"binding-default",children:r("默认")}):null,B(J,G.id,W,ge),ce.isDefault?null:s.jsx(se,{variant:"ghost",size:"icon-2xs",className:"text-[12px] leading-none",disabled:ge,title:r("删除映射 {alias}",{alias:J}),onClick:()=>{Z(J)},children:"×"})]},`${J}${ce.isDefault?"d":"m"}`)};return s.jsxs("div",{className:"aliases",children:[s.jsxs("div",{className:"alias-row",children:[M?ae(M):null,s.jsx(se,{variant:"dashed",size:"xs",onClick:()=>r2({target:G.id,provider:W}),children:r("+ 映射")})]}),U.map(ae)]})}function Q(G){if(G.source==="manual")return s.jsxs("span",{className:"src manual",title:r("手动登记的上游模型;移除它会直接删掉这条登记"),children:[s.jsx("i",{"aria-hidden":"true"}),r("手动")]});if(!G.source&&es(G.provider))return s.jsxs("span",{className:"src manual",title:r("用户登记的自定义模型;整份清单只属于这一家"),children:[s.jsx("i",{"aria-hidden":"true"}),r("自定义")]});if(G.source!=="remote"&&G.source!=="builtin")return s.jsx("span",{className:"rate",children:"—"});const W=G.source==="remote",le=V9(Number(G.refreshedAt)||0),M=W?le?r("来自上游目录接口,清单拉取于 {at};刷新失败时保留上一份成功结果",{at:le}):r("来自上游目录接口;刷新失败时保留上一份成功结果"):r("上游目录尚未拉到,用的是内置静态清单;点「刷新模型清单」可重试");return s.jsxs("span",{className:Ue("src",W?"remote":"builtin"),title:M,children:[s.jsx("i",{"aria-hidden":"true"}),r(W?"远程":"内置")]})}function K(G){const W=_j(G),le=Pj(G.capOverrides),M=typeof W.maxInputTokens=="number"?W.maxInputTokens:null,U=typeof W.maxOutputTokens=="number"?W.maxOutputTokens:null,Z=r("上下文窗口 {input} / 最大输出 Token {output} —— 点击修改模型能力",{input:Xf(M),output:Xf(U)})+X(G);return s.jsxs("button",{type:"button",className:"caps-open",title:Z,onClick:()=>a2(G.provider||"",G.id),children:[s.jsxs("span",{className:Ue("cap-num",M===null&&"unset",Mu(G,"maxInputTokens")==="modelsdev"&&"filled"),children:[OM(M),le.includes("maxInputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]}),s.jsx("span",{className:"cap-sep",children:"/"}),s.jsxs("span",{className:Ue("cap-num",U===null&&"unset",Mu(G,"maxOutputTokens")==="modelsdev"&&"filled"),children:[OM(U),le.includes("maxOutputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]})]})}function X(G){const W=["maxInputTokens","maxOutputTokens"].filter(le=>Mu(G,le)==="modelsdev").map(le=>Ou[le]);return W.length?r(";其中 {keys} 由 models.dev 补齐",{keys:W.join(r("、"))}):""}function q(G){const W=_j(G),le=Pj(G.capOverrides);return s.jsx("button",{type:"button",className:"caps-open caps-badges",title:r("对下游声明的能力(工具调用 / 图片识别 / 视频识别 / 支持思考)—— 点击修改"),onClick:()=>a2(G.provider||"",G.id),children:AM.map(M=>{const U=W[M]??null,Z=Lj(U),ae=le.includes(M),ce=Mu(G,M);return s.jsxs("span",{className:Ue("cap-dot",Z,ce==="modelsdev"&&"filled",ae&&"marked"),title:D9(M,U,ae,ce),children:[nY[M],ae?s.jsx("i",{className:"cap-mark"}):null]},M)})})}function $(G,W,le){async function M(){await Wt().wbConfirm?.ask?.({title:r("移除自定义模型"),html:r("确定移除自定义模型「{id}」?这条登记会被直接移除,之后 /v1/models 不再广告它、请求它也会被拒。",{id:zj(W.id)}),okText:r("移除"),okClass:"danger"})&&Zj(Ki(W),()=>s2(W.provider||"",W.id),es(W.provider||"")?r("模型已移除"):r("自定义模型已移除"))}switch(G.key){case"check":return s.jsx("td",{className:Mo("cell-check",G.align),children:s.jsx(Mr,{checked:p.has(Ki(W)),title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:U=>I(Ki(W),U===!0)})});case"model":return s.jsxs("td",{className:Mo("cell-model",G.align),children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t","data-copy":W.id,title:r("点击复制:{name}",{name:W.id}),children:W.id})}),W.name&&W.name!==W.id?s.jsx("div",{className:"mname",children:W.name}):null]});case"rate":return s.jsx("td",{className:Mo("cell-rate",G.align),children:s.jsx("span",{className:"rate",children:W.credits?XK(W.credits):"—"})});case"source":return s.jsx("td",{className:Mo("cell-source",G.align),children:Q(W)});case"budget":return s.jsx("td",{className:Mo("cell-budget",G.align),children:K(W)});case"caps":return s.jsx("td",{className:Mo("cell-caps",G.align),children:q(W)});case"alias":return s.jsx("td",{className:Mo("cell-alias",G.align),children:z(W)});case"act":{const U=AK(W.provider||""),Z=W.source==="manual"||es(W.provider||"");return s.jsx("td",{className:Mo("cell-act r",G.align),children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{variant:"ghost",size:"sm",disabled:!!U,title:U||r("以这个上游模型发一次最小请求,走真实转发链路"),onClick:()=>c({provider:W.provider||"",id:W.id}),children:r("测试")}),Z?s.jsx(se,{variant:"ghost",size:"sm",className:"text-destructive",disabled:le,onClick:()=>{M()},children:r("移除")}):null]})})}default:return null}}function Y(G){const W=e.pending.has(Ki(G)),le=p.has(Ki(G));return s.jsx("tr",{className:Ue(le&&"sel"),children:N.map(M=>s.jsx(x.Fragment,{children:$(M,G,W)},M.key))},`${G.provider||""}${G.id}`)}function F(){if(!v.length){const Z=a?$j()?Iu()?r("自定义提供商还没有模型:先在左栏选一家,点「添加模型」登记,或「获取上游模型」从上游拉取"):r(b?"该提供商已不存在(可能已被删除),请刷新列表":"这家还没有模型:点「添加模型」登记,或「获取上游模型」从上游拉取"):r("加载中…"):e.data?r("暂无模型(请先添加账号)"):r("加载中…");return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:Z})})}if(!j.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:w?r("没有匹配「{keyword}」的模型",{keyword:w}):r("没有匹配当前筛选的模型")})});const G=t==="all"||Iu(),W=G&&!w&&e.stateFilter==="all"&&!A.paged,le=new Map;for(const Z of j){const ae=Z.provider||"";le.has(ae)||le.set(ae,{label:Z.providerLabel||ae||r("未知"),items:[]}),le.get(ae)?.items.push(Z)}const M=[];let U=0;for(const[Z,ae]of le){ae.items.sort((te,Ce)=>{const re=+!rp(te)-+!rp(Ce);if(re!==0||S==="default")return re;const de=T2(te.credits),ke=T2(Ce.credits);return de===null||ke===null?de===ke?0:de===null?1:-1:S==="rate-asc"?de-ke:ke-de});const ce=e.expanded.has(Z)||!W,J=ce?ae.items:ae.items.slice(0,$M),ie=ae.items.length-J.length,ge=A.paged?Math.max(0,A.rangeStart-1-U):0,ee=A.paged?Math.min(J.length,A.rangeEnd-U):J.length,fe=ge0?r("(续)"):"",r("{n} 个模型",{n:ae.items.length})]})},`group:${Z}`));for(const te of fe)M.push(Y(te));U+=J.length,ie>0?M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>rK(Z),children:r("展开其余 {n} 个模型 ▾",{n:ie})})})},`more:${Z}`)):ce&&W&&ae.items.length>$M&&M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>aK(Z),children:r("收起 ▴")})})},`collapse:${Z}`))}return M}return s.jsxs(s.Fragment,{children:[s.jsx("section",{className:"panel",children:s.jsxs("div",{className:"mm",children:[H(),s.jsxs("div",{className:"mm-main",children:[s.jsxs("div",{className:"panel-head",children:[s.jsxs("div",{className:"mm-titlebar",children:[s.jsxs("div",{className:"mm-title",children:[t==="all"||t==="custom-all"?Lu(t,"",l0):Lu(t,T),s.jsx("h2",{children:T}),s.jsxs("span",{className:"mm-meta",children:[s.jsx("b",{children:v.length}),r(" 个模型 · 已启用 "),s.jsx("b",{children:D}),r(" · 有映射 "),s.jsx("b",{children:C})]})]}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-refresh-models",title:es(t)?r("从这一家的上游拉一份模型清单,勾选要哪些再导入(已添加的不会重复导入)"):r("刷新模型管理页里各提供商的远程模型目录,逐家结果列在弹窗里"),onClick:()=>o2(),children:r("获取模型")}),s.jsx(se,{id:"btn-add-custom-model",variant:"outline",size:"sm",onClick:()=>fK(),children:r("+ 添加模型")})]})]}),s.jsxs("div",{className:"mm-filters",children:[s.jsx(In,{options:$9,value:e.stateFilter,onValueChange:lK,"aria-label":r("按状态筛选"),className:"shrink-0"}),s.jsx(In,{options:G9,value:e.sort,onValueChange:oK,"aria-label":r("按倍率排序"),className:"shrink-0"}),s.jsxs(Ci,{className:"w-full min-[768px]:w-[240px] flex-none min-[768px]:flex-none",id:"models-search",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID / 名称 / 映射名…"),"aria-label":r("搜索模型"),autoComplete:"off",value:e.search,onChange:G=>iK(G.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),R.length>0?s.jsxs("span",{className:"batch-chip",children:[r("已选 "),s.jsx("b",{children:R.length}),r(" 个"),s.jsx(se,{id:"btn-batch-models",variant:"outline",size:"xs",title:r("对选中的 {n} 个模型执行批量操作",{n:R.length}),onClick:()=>f(!0),children:r("批量操作")})]}):null]})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",ref:G=>hK(G),children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"c-check","data-col":"check"}),s.jsx("col",{className:"c-model","data-col":"model"}),s.jsx("col",{className:"c-rate","data-col":"rate"}),s.jsx("col",{className:"c-source","data-col":"source"}),s.jsx("col",{className:"c-budget","data-col":"budget"}),s.jsx("col",{className:"c-caps","data-col":"caps"}),s.jsx("col",{className:"c-alias","data-col":"alias"}),s.jsx("col",{className:"c-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"check",children:L}),s.jsx("th",{"data-col":"model",children:r("上游模型")}),s.jsx("th",{"data-col":"rate",children:r("倍率")}),s.jsx("th",{"data-col":"source",children:r("来源")}),s.jsxs("th",{"data-col":"budget",children:[r("上下文 / 输出"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("数字带虚线底 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;— = 未声明。点任意一格可改。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"caps",children:[r("能力"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("圆点带内侧描边 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;虚线圈 = 未声明。悬停某一枚可看逐项出处。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"alias",children:[r("模型映射"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("每条映射 = 对外名 → 上游模型;原始 ID 与别名有独立开关,默认绑定永远存在(没有映射时是合成的那条)。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{id:"models",children:F()})]})}),s.jsx(Li,{className:"models-panel-foot",leading:Iu()?s.jsxs(s.Fragment,{children:[r("这里是"),s.jsx("b",{children:r("全部自定义提供商")}),r("的模型合集:每家的清单互相独立,别名也只在自己那家内生效;要改名称 / 协议 / Base URL,到账号页该家账号的「设置」→ 提供商一栏。")]}):a?s.jsxs(s.Fragment,{children:[r("自定义提供商的清单"),s.jsx("b",{children:r("只属于这一家")}),r(":这里的模型不会出现在其他家,别名也只在这一家内生效。改名称 / 协议 / Base URL 在账号页该家账号的「设置」→ 提供商一栏;整家不要了,鼠标移到左栏这家上点 × 删除(连同名下账号)。")]}):void 0,total:j.length,range:A.paged?{start:A.rangeStart,end:A.rangeEnd}:null,page:A.page,pageCount:A.pageCount,size:A.size,onSizeChange:A.setSize,onPageChange:A.goto})]})]})}),e.mapping?s.jsx(lY,{context:e.mapping,onClose:dK}):null,e.customModel?s.jsx(oY,{initial:e.customModel,onClose:pK}):null,e.capability?s.jsx(wK,{context:e.capability,onClose:mK}):null,o?s.jsx(MK,{target:o,onClose:()=>c(null)}):null,d?s.jsx(IK,{models:R,onClose:()=>f(!1),onDone:()=>{h(new Set),f(!1)}}):null]})}const aY=r("绑定在「对外名 → 上游模型」这一条映射上的思考等级(列表照抄 OmniProxy 的手动绑定),选「不覆盖」表示不给这条映射指定等级。它会跟着这条映射注入转发,由承载的那家翻译成自己的档位字段(CatPaw 归并成 low/high/max,Qoder 按模型声明的档位归一)。以下几种情况故意不注入:① off / none(关闭思考)—— 本项目没有安全的表达方式;② 表外的自定义等级(各家能力范围不同,无法判断上游收不收);③ 客户端请求体里已经自己指定了档位(那是更明确的意图,绑定不覆盖);④ 这家上游不认识档位字段(如 WorkBuddy / 小浣熊 / AutoClaw / Cline)。注入与跳过都会写进详细日志。");function E2(e,t,a){const o=e2(e),c=(t||"").trim(),d=o.find(f=>f.id.toLowerCase()===c.toLowerCase());return d?d.id:c||o[0]?.id||""}function lY({context:e,onClose:t}){const a=!!e.alias,[o,c]=x.useState(()=>e.provider||Yj()[0]?.id||""),[d,f]=x.useState(e.alias||""),[p,h]=x.useState(()=>E2(o,e.target)),[b,y]=x.useState(""),[v,w]=x.useState(!1),[j,S]=x.useState(()=>{const _=Zf(Jf().data,C2(o,p)),L=a?e0(e.alias,e.target,e.provider):"";return L&&_.includes(L)?{select:L,custom:""}:{select:L?ca:"",custom:L}}),N=Zf(Jf().data,C2(o,p)),k=(()=>{const _=Yj();for(const L of[e.provider,o])L&&!_.some(H=>H.id===L)&&_.push({id:L,label:Wt().wbProviders?.labelOf?.(L)||L});return _})(),T=(()=>{const _=e2(o),L=(p||"").trim();return L&&!_.some(H=>H.id.toLowerCase()===L.toLowerCase())&&_.unshift({id:L,label:r("{name}(不在该家当前清单里)",{name:L}),off:!0}),_})(),D=k.find(_=>_.id===o)?.label||o||r("(全局)"),C=j.select&&j.select!==ca&&!N.includes(j.select)?{select:ca,custom:j.custom||j.select}:j,A=C.select===ca?C.custom.trim():C.select,R=C.select===ca;function I(_){c(_),h(E2(_,p))}async function P(){if(v)return;const _=a?e.alias||"":d.trim(),L=p;if(!_){y(r("请填写对外映射名"));return}if(!L){y(r("该提供商当前没有可选的上游模型"));return}if(!o){y(r("请选择提供商"));return}if(!a&&Oo(_,L)&&np().some(H=>Oo(H.id,L)&&Oo(H.provider,o))){y(r("原始 ID 已作为默认绑定,请直接使用该绑定的开关或等级按钮"));return}w(!0),y(r("保存中…"));try{Gi(await Yg(o,_,L,{reasoning:A})),w(!1),t();const H=A?r(" · 思考等级 {level}",{level:A}):"",B=Wt().wbProviders?.labelOf?.(o)||o;wr(a?r("✅ 已更新 {name} 的思考等级",{name:_}):r("✅ 已添加映射 {name} → {target}({label}){suffix}",{name:_,target:L,label:B,suffix:H}))}catch(H){y(r("保存失败:{message}",{message:Ro(H)})),w(!1)}}const O=_=>{_.key==="Enter"&&(_.preventDefault(),P())};return s.jsx(Qt,{open:!0,onOpenChange:(_,L)=>{if(!_){if(v){L.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"设置思考等级":"添加模型映射")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-provider",children:r("提供商")}),s.jsxs(ft,{value:o,disabled:!0,onValueChange:_=>I(String(_)),children:[s.jsx(mt,{id:"mapping-provider",className:"w-full",children:s.jsx(pt,{children:k.find(_=>_.id===o)?.label||o})}),s.jsx(ht,{children:k.map(_=>s.jsx(qe,{value:_.id,children:_.label},_.id))})]})]}),s.jsxs("div",{className:"grid grid-cols-[1fr_24px_1fr] items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-alias",children:r("对外映射名(下游请求时用)")}),s.jsx($e,{id:"mapping-alias",maxLength:128,placeholder:r("例如 gpt-4o"),autoComplete:"off",autoFocus:!a,value:d,disabled:a,onChange:_=>f(_.currentTarget.value),onKeyDown:O})]}),s.jsx("div",{className:"pb-2 text-center text-muted-foreground",children:"→"}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-upstream",children:r("转发到上游模型")}),s.jsxs(ft,{value:p,disabled:!0,onValueChange:_=>h(String(_)),children:[s.jsx(mt,{id:"mapping-upstream",className:"w-full",children:s.jsx(pt,{children:T.find(_=>_.id===p)?.label||p})}),s.jsx(ht,{children:T.map(_=>s.jsxs(qe,{value:_.id,children:[_.label,_.off?r("(已禁用)"):""]},_.id))})]})]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("下游请求 "),s.jsx("b",{className:"text-primary-fg",children:d.trim()||r("<对外名>")}),r(" → 转发")," ",s.jsx("b",{className:"text-primary-fg",children:p||r("<上游模型>")}),r("({label})",{label:D}),A?s.jsxs(s.Fragment,{children:[r(" · 思考等级 "),s.jsx("b",{className:"text-primary-fg",children:A})]}):null]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:"mapping-reasoning",children:r("思考等级")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("思考等级的注入规则")}),children:"?"}),s.jsx(_i,{children:aY})]})]}),s.jsxs(ft,{value:C.select,onValueChange:_=>{const L=String(_);S(H=>({...H,select:L}))},children:[s.jsx(mt,{id:"mapping-reasoning",className:"w-full",autoFocus:a,children:s.jsx(pt,{children:C.select===ca?r("自定义等级…"):C.select||r("不覆盖")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("不覆盖")}),N.map(_=>s.jsx(qe,{value:_,children:_},_)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]}),R?s.jsx($e,{id:"mapping-reasoning-custom",maxLength:32,autoFocus:!0,placeholder:r("自定义等级(例如 custom-high)"),autoComplete:"off",disabled:v,value:C.custom,onChange:_=>S(L=>({...L,custom:_.currentTarget.value})),onKeyDown:O}):null]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("对外名可自由命名,允许与上游模型 ID 同名(同名时该上游的原生路由优先,映射作兜底); 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。同一对外名可在多个提供商各添加一条: 下游用同一个名字请求,网关按账号优先级主备切换,失败自动落到下一个提供商。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{P()},children:r(a?"保存等级":"保存映射")})]})]})})}function oY({initial:e,onClose:t}){const[a,o]=x.useState(e.provider),[c,d]=x.useState(""),[f,p]=x.useState(""),[h,b]=x.useState(!1),y=(()=>{const N=J9();return a&&!N.some(k=>k.id===a)&&N.push({id:a,label:Wt().wbProviders?.labelOf?.(a)||a}),N})(),v=y.some(N=>N.id===a)?a:y[0]?.id||"",w=y.find(N=>N.id===v)?.label||v||r("(未选)");async function j(){if(h)return;const N=c.trim();if(!v){p(r("请选择提供商"));return}if(!N){p(r("请填写上游模型 ID"));return}b(!0),p(r("保存中…"));try{const k=await nK(v,N);Gi(k),b(!1),t();const T=y.find(D=>D.id===v)?.label||v;if(es(Du()))wr(r("✅ 已登记模型 {name}({label})",{name:N,label:T}));else{const D=k;Array.isArray(D?.models)&&D.models.some(A=>A.id===N&&(A.provider||"")===v)?wr(r("✅ 已登记自定义模型 {name}({label})",{name:N,label:T})):wr(r("✅ 已登记 {name}({label}),但该提供商还没有可用账号,这一行要加上账号后才会显示",{name:N,label:T}),"err")}}catch(k){p(r("保存失败:{message}",{message:Ro(k)})),b(!1)}}const S=N=>{N.key==="Enter"&&(N.preventDefault(),j())};return s.jsx(Qt,{open:!0,onOpenChange:(N,k)=>{if(!N){if(h){k.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加自定义模型")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-provider",children:r("提供商")}),s.jsxs(ft,{value:v,disabled:e.locked,onValueChange:N=>o(String(N)),children:[s.jsx(mt,{id:"custom-model-provider",className:"w-full",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:y.map(N=>s.jsx(qe,{value:N.id,children:N.label},N.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-id",children:r("上游模型 ID")}),s.jsx($e,{id:"custom-model-id",maxLength:128,placeholder:r("例如 gpt-5.5-preview"),autoComplete:"off",spellCheck:!1,autoFocus:!0,value:c,onChange:N=>d(N.currentTarget.value),onKeyDown:S})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("在 "),s.jsx("b",{className:"text-primary-fg",children:w}),r(" 上登记上游模型")," ",s.jsx("b",{className:"text-primary-fg",children:c.trim()||r("<上游模型 ID>")}),r("(登记后即可用这个名字请求)")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("填上游真正认识的那个模型 ID(不是给下游用的名字)。登记后它会进入该家的模型清单: 表格里出现这一行、"),s.jsx("code",{children:"/v1/models"}),r(" 会广告它、请求它也会被转发到这家。 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("「来源」列会标成"),s.jsx("b",{children:r("手动")}),r(",与远程目录 / 内置清单区分开。删除自定义模型是"),s.jsx("b",{children:r("直接移除")}),r("这条登记(不像内置模型那样只是隐藏),因为它的存在完全由这次登记决定。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:f})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:h,onClick:()=>{j()},children:r("保存")})]})]})})}const A2='.page[data-page="gateway"]';let o0=null;function R2(){if(o0)return;const e=document.querySelector(A2);e&&(e.replaceChildren(),o0=vn.createRoot(e),o0.render(s.jsx(rY,{})))}document.querySelector(A2)?R2():document.addEventListener("DOMContentLoaded",R2,{once:!0});const O2=3065;function iY(){if(el().workbuddyDesktop?.platform!=="web")return null;const e=typeof window>"u"?"":window.location?.origin;return e&&e!=="null"?e:null}function M2(e,t){return iY()??(e?`http://127.0.0.1:${e}`:t)}function el(){return window}function Xg(e){return e instanceof Error?e.message:String(e)}function zu(e,t){el().wbApp?.toast?.(e,t)}let cp={backend:null,gatewayBase:M2(0,`http://127.0.0.1:${O2}`)};const i0=new Set;function c0(){return cp}function cY(e){return i0.add(e),()=>{i0.delete(e)}}function uY(e){cp=e;for(const t of i0)t()}function D2(){return cp.gatewayBase.replace(/^https?:\/\//,"")}function dY(){return cp.backend?.ready===!0}function I2(e){const t=(a,o)=>{const c=document.getElementById(a);c&&(c.textContent=o)};t("api-base",`${e}/v1`),t("api-chat",`POST ${e}/v1/chat/completions`),t("api-responses",`POST ${e}/v1/responses`),t("api-messages",`POST ${e}/v1/messages`),t("api-models",`GET ${e}/v1/models`)}let u0=!1;async function Bu(){if(!u0){u0=!0;try{const e=el().workbuddyDesktop;if(!e)throw new Error("后端桥不可用");const t=await e.getBackendStatus(),a=Number(t?.port)||0,o=c0(),c={backend:t??null,gatewayBase:M2(a,o.gatewayBase)};c.gatewayBase!==o.gatewayBase&&I2(c.gatewayBase),uY(c),el().wbApp?.renderTopbarStatus?.()}catch(e){console.warn("读取后端状态失败:",Xg(e))}finally{u0=!1}}}function fY(){I2(cp.gatewayBase),Bu()}async function P2(e){zu(e||r("正在重启…"));try{await el().workbuddyDesktop?.restartApp()}catch(t){zu(r("重启失败:{reason}",{reason:Xg(t)}),"err")}}const pY={idle:r("结束占用进程"),querying:r("查询中…"),ending:r("结束中…")};function mY({container:e}){const{backend:t,gatewayBase:a}=x.useSyncExternalStore(cY,c0),[o,c]=x.useState("idle"),d=t?.failure||null,f=D2(),p=t?.ready;let h="live off",b=r("正在检查… · {port}",{port:f});p===!0?(h="live pulse",b=r("网关运行中 · {port}",{port:f})):d?(h="live bad",b=r("{label} · {port}",{label:d.label||r("网关启动失败"),port:f})):p===!1&&(b=r("网关启动中… · {port}",{port:f}));const y=d?d.message??"":p===!0?r("本地网关正在监听 {url},可直接调用 OpenAI 兼容接口",{url:a}):r("正在确认网关是否已就绪");x.useEffect(()=>{Bu()},[]),x.useEffect(()=>{const w=el().workbuddyDesktop?.onBackendError?.(()=>{Bu()});return typeof w=="function"?w:void 0},[]),x.useEffect(()=>{e.title=y},[e,y]);async function v(){if(o!=="idle")return;const w=el().workbuddyDesktop;if(w){c("querying");try{const j=await w.getPortOccupant(),S=j?.occupant;if(!S){zu(r("端口 {port} 上没有查到监听进程,请改用「更换端口」",{port:j?.port??""}),"err");return}const N=[r("即将结束以下进程:"),"",r("进程名:{name}",{name:String(S.name)}),r("PID:{pid}",{pid:String(S.pid)}),r("路径:{path}",{path:S.path||r("(未知)")}),"",r("结束它会强制退出该程序未保存的数据。确认继续?")],k=el().wbConfirm?.ask;if(!k||!await k({title:r("结束占用端口的进程"),text:N.join(` +`),okText:r("结束进程"),okClass:"danger"}))return;c("ending"),(await w.endPortOccupant())?.released?(zu(r("已结束进程 {name}(PID {pid}),端口已释放",{name:String(S.name),pid:String(S.pid)})),await k({title:r("重启程序"),text:r("端口已释放。现在重启程序让网关用这个端口启动?"),okText:r("重启")})?await P2(r("重启中…")):await Bu()):(zu(r("进程已结束,但端口仍被占用,建议改用「更换端口」"),"err"),await Bu())}catch(j){zu(r("结束失败:{reason}",{reason:Xg(j)}),"err")}finally{c("idle")}}}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-line",children:[s.jsx("span",{className:h}),s.jsx("span",{className:"txt",children:b})]}),d?.conflict?s.jsxs("div",{className:"status-actions",children:[d.canEndOccupant===!0?s.jsx(se,{size:"sm",disabled:o!=="idle",onClick:()=>{v()},children:pY[o]}):null,s.jsx(se,{size:"sm",onClick:()=>{xY()},children:r("更换端口")})]}):null]})}let d0=null;function _2(){if(d0)return;const e=document.getElementById("sidebar-status");e&&(e.replaceChildren(),d0=vn.createRoot(e),d0.render(s.jsx(mY,{container:e})))}const hY={idle:r("保存并重启"),checking:r("校验中…"),saving:r("保存中…")};function gY({status:e,onClose:t}){const a=Number(e?.port)||O2,[o,c]=x.useState(()=>a<65535?String(a+1):String(a-1)),[d,f]=x.useState("idle"),[p,h]=x.useState(""),[b,y]=x.useState(""),v=x.useRef(!0),w=Number(o)||0,j=e?.failure?.message||r("当前端口 {port},网关运行正常。",{port:a});async function S(){if(d!=="idle")return;const N=el().workbuddyDesktop;if(!N)return;const k=Number(o)||0;if(!k||k<1024||k>65535){y(r("端口需在 1024-65535 之间"));return}f("checking"),y(""),h("");try{const T=await N.checkPort(k);if(!T?.ok){h(T?.message||r("该端口不可用"));return}if(T.same){h(T.message??"");return}if(f("saving"),(await N.changePort(k))?.changed===!1){h(r("与当前端口相同,无需重启"));return}t(),await P2(r("端口已改为 {port},正在重启…",{port:k}))}catch(T){y(Xg(T))}finally{f("idle")}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更换网关端口")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("当前状态")}),s.jsx("p",{children:j})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("新端口")}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"port-input",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("端口号")}),s.jsx($e,{id:"port-input",type:"number",min:1024,max:65535,step:1,placeholder:r("例如 3066"),autoComplete:"off",className:"max-w-[130px]",value:o,onChange:N=>{c(N.currentTarget.value)},onKeyDown:N=>{N.key==="Enter"&&S()},autoFocus:!0,onFocus:N=>{v.current&&(v.current=!1,N.currentTarget.select())}})]}),p?s.jsx("p",{children:p}):null,s.jsx("p",{children:r("端口需在 1024-65535 之间。1023 及以下是系统保留范围,普通程序无法监听。")})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("换端口后要改的地方")}),s.jsxs("p",{children:[r("网关地址会变成 "),s.jsx("code",{children:`http://127.0.0.1:${w||"—"}`}),r("。已经把这个地址填进其它工具(Claude Code、Cherry Studio 等)的,需要一并改成新地址,否则那些工具会连不上。")]})]}),s.jsx("p",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:d!=="idle",onClick:()=>{S()},children:hY[d]})]})]})})}let up=null,Hu=null;function L2(){up&&(up.unmount(),up=null),Hu&&(Hu.remove(),Hu=null)}async function xY(){let e=c0().backend;e||(e=await el().workbuddyDesktop?.getBackendStatus().catch(()=>null)??null),L2(),Hu=document.createElement("div"),document.body.append(Hu),up=vn.createRoot(Hu),up.render(s.jsx(gY,{status:e,onClose:L2}))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",_2,{once:!0}):_2(),window.wbPortPanel={render:fY,sync:Bu,portLabel:D2,isReady:dY};function bY(e){return e.source==="subscription"&&(e.port===null||e.port===void 0)}function tr(){return window}function Fn(e,t){tr().wbApp?.toast?.(e,t)}function Ra(e){return e instanceof Error?e.message:String(e)}function z2(e){return tr().wbApp?.formatTime?.(e)||""}function f0(e){const t=Number(e);return!Number.isFinite(t)||t<0?"":t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}function p0(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]||t)}function Uu(e){return String(e?.name||e?.id||"")}function B2(e){return e.source==="clash"}function dp(e){return e.source==="subscription"}function Qg(e){return B2(e)||dp(e)}function vY(e){return e.localDisabled===!0||e.enabled===!1}function H2(e){return Qg(e)&&e.enabled===!1&&e.localDisabled!==!0}function yY(e){return dp(e)&&vY(e)}function Zg(e){return dp(e)&&e.orphan===!0}function U2(e){return!Qg(e)||Zg(e)}const wY=r("来自 Clash Verge 同步(名称、端口跟随 Clash),请到 Clash Verge 中修改;启用可在本页关闭"),jY=r("该节点来自订阅(名称、端口跟随订阅与内核),请在「订阅管理」里修改;启用可在本页关闭"),V2=r("该节点所属订阅已删除,不会再被同步更新,可手动删除清理");function F2(e){return Zg(e)?V2:dp(e)?jY:wY}const SY=r("禁用后本端不再用它(引用它的账号回退直连);端口在 Clash Verge 侧,不受影响"),NY=r("禁用后本端不再用它(引用它的账号回退直连),并会关掉它的本地监听端口"),kY=r("已在本页禁用(打开开关即恢复)"),CY=r("这条在 Clash Verge 里是停用的,本页启用不生效 —— 到 Clash Verge 里打开它");function TY(e){if(Zg(e))return V2;if(e.localDisabled===!0)return kY;if(H2(e))return CY;if(dp(e))return NY;if(B2(e))return SY}let xs={data:null,loading:!1,error:"",testing:null,pending:new Set,syncing:!1,batchBusy:!1,batchProgress:null,selected:new Set};const m0=new Set;function EY(e){return m0.add(e),()=>{m0.delete(e)}}function AY(){return xs}function ns(e){xs={...xs,...e},m0.forEach(t=>t())}function Wg(){return xs.data?.items??[]}function RY(e){return xs.selected.has(e)}function OY(e,t){const a=new Set(xs.selected);t?a.add(e):a.delete(e),ns({selected:a})}function MY(e,t){const a=new Set(xs.selected);for(const o of e)t?a.add(o):a.delete(o);ns({selected:a})}function DY(){ns({selected:new Set})}function Do(e){if(!e||typeof e!="object"||!Array.isArray(e.items))return;const t=new Set(e.items.map(o=>o.id)),a=new Set([...xs.selected].filter(o=>t.has(o)));ns({data:e,error:"",selected:a})}async function fp(e=!1){const t=tr().workbuddyDesktop;if(typeof t?.getProxyPool!="function"){ns({error:r("当前环境不支持代理池(桥接方法缺失)")});return}e||ns({loading:!0});try{Do(await t.getProxyPool())}catch(a){ns({error:Ra(a)}),e||Fn(r("代理列表加载失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({loading:!1})}}async function IY(){const e=tr().workbuddyDesktop;if(typeof e?.syncClashToProxyPool!="function"){Fn(r("当前环境不支持同步(桥接方法缺失)"),"err");return}if(!xs.syncing){ns({syncing:!0});try{const t=await e.syncClashToProxyPool();Do(t),t?.syncError?Fn(r("没能同步:{reason}",{reason:t.syncError}),"err"):t?.changes?Fn(r("✅ 已同步 Clash Verge 出口({n} 项变更)",{n:t.changes})):Fn(r("已是最新,没有需要同步的变更"))}catch(t){Fn(r("同步失败:{reason}",{reason:Ra(t)}),"err")}finally{ns({syncing:!1})}}}async function PY(e){const t=tr().workbuddyDesktop;if(typeof t?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(!xs.testing){ns({testing:e.id});try{const a=await t.testProxyPoolItem(e.id);if(a?.items&&Do({items:a.items}),a?.success){const o=f0(a.durationMs);Fn(r("✅ 「{name}」出口可用{ip}{took}",{name:Uu(e),ip:a.ip?r(" 出口 IP {ip}",{ip:a.ip}):"",took:o?` ${o}`:""}))}else Fn(r("❌ 「{name}」{error}",{name:Uu(e),error:a?.error||r("连接失败")}),"err");a?.saveError&&Fn(r("测试结果没能记下:{reason}",{reason:a.saveError}),"err")}catch(a){Fn(r("测试失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({testing:null})}}}async function _Y(e,t){const a=tr().workbuddyDesktop;if(typeof a?.setProxyPoolItemEnabled!="function"){Fn(r("当前环境不支持启停(桥接方法缺失)"),"err");return}const o=new Set(xs.pending);o.add(e.id),ns({pending:o});try{const c=await a.setProxyPoolItemEnabled({id:e.id,enabled:t});Do(c);const d=Uu(e),f=c?.listener??"none";Fn(t?f==="opening"?r("已启用「{name}」,正在补建监听端口(内核重建中)",{name:d}):r("已启用「{name}」",{name:d}):f==="closing"?r("已禁用「{name}」,监听端口正在关闭(内核重建中)",{name:d}):r("已禁用「{name}」",{name:d})),(f==="closing"||f==="opening")&&LY(e.id,f)}catch(c){Fn(r("保存失败:{reason}",{reason:Ra(c)}),"err")}finally{const c=new Set(xs.pending);c.delete(e.id),ns({pending:c})}}async function LY(e,t){for(let a=0;a<12;a+=1){await new Promise(d=>setTimeout(d,1500)),await fp(!0);const o=Wg().find(d=>d.id===e);if(!o)return;const c=o.port!==null&&o.port!==void 0;if(t==="closing"?!c:c)return}}async function $2(e){const t=tr().workbuddyDesktop;if(typeof t?.removeProxyPoolItem!="function")return;if(!U2(e)){Fn(F2(e),"err");return}const a=e.usedBy||[],o=a.length?`

    ${r("有 {n} 个账号正在使用它({names})—— 删除后这些账号会回退直连。",{n:a.length,names:a.map(f=>p0(String(f.name||f.id||""))).join(r("、"))})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("删除代理"),html:r("确定删除「{name}」?{used}",{name:p0(Uu(e)),used:o}),okText:r("删除"),okClass:"danger"}))return;const d=new Set(xs.pending);d.add(e.id),ns({pending:d});try{const f=await t.removeProxyPoolItem(e.id);Do(f),Fn(r("已删除「{name}」",{name:Uu(e)}))}catch(f){Fn(r("删除失败:{reason}",{reason:Ra(f)}),"err")}finally{const f=new Set(xs.pending);f.delete(e.id),ns({pending:f})}}async function zY(){const e=tr().workbuddyDesktop;if(typeof e?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(xs.batchBusy||xs.testing)return;const t=Wg().filter(f=>xs.selected.has(f.id));if(!t.length)return;ns({batchBusy:!0,batchProgress:{done:0,total:t.length}});let a=0,o=0,c="";for(const[f,p]of t.entries()){ns({testing:p.id,batchProgress:{done:f,total:t.length}});try{const h=await e.testProxyPoolItem(p.id);h?.items&&Do({items:h.items}),h?.success?a+=1:o+=1,h?.saveError&&!c&&(c=h.saveError)}catch{o+=1}}ns({testing:null,batchBusy:!1,batchProgress:null});const d=o?r("批量测试完成:{ok} 个可用、{failed} 个失败(共 {total} 个)",{ok:a,failed:o,total:t.length}):r("批量测试完成:{ok} 个可用(共 {total} 个)",{ok:a,total:t.length});Fn(o?d:`✅ ${d}`,o?"err":"ok"),c&&Fn(r("部分测试结果没能记下:{reason}",{reason:c}),"err")}async function BY(){const e=tr().workbuddyDesktop;if(typeof e?.removeProxyPoolItem!="function"||xs.batchBusy||xs.testing)return;const t=Wg().filter(S=>xs.selected.has(S.id)),a=t.filter(S=>U2(S)),o=t.length-a.length;if(!a.length){Fn(o?r("选中的 {n} 条都是同步来的只读条目(Clash / 订阅),不能删除",{n:o}):r("没有可删除的条目"),"err");return}const c=a.slice(0,8).map(S=>p0(Uu(S))).join(r("、")),d=a.length>8?r("{names} 等 {n} 条",{names:c,n:a.length}):c,f=a.filter(S=>(S.usedBy||[]).length).length,p=f?`

    ${r("其中 {n} 条正被账号使用 —— 删除后那些账号会回退直连。",{n:f})}

    `:"",h=o?`

    ${r("另有 {n} 条是同步来的只读条目(Clash / 订阅),将跳过。",{n:o})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("批量删除代理"),html:`${r("确定删除选中的 {n} 个代理?",{n:a.length})}

    ${d}

    ${p}${h}`,okText:r("删除"),okClass:"danger"}))return;ns({batchBusy:!0,batchProgress:{done:0,total:a.length}});let y=0,v=0,w="";for(const[S,N]of a.entries()){ns({batchProgress:{done:S,total:a.length}});try{const k=await e.removeProxyPoolItem(N.id);Do(k),y+=1}catch(k){v+=1,w||(w=Ra(k))}}ns({batchBusy:!1,batchProgress:null});const j=[r("已删除 {n} 个代理",{n:y})];o&&j.push(r("跳过 {n} 个(同步只读条目)",{n:o})),v&&j.push(r("失败 {n} 个({reason})",{n:v,reason:w})),Fn(v?j.join(r(",")):`✅ ${j.join(r(","))}`,v?"err":"ok")}async function HY(e,t){const a=tr().workbuddyDesktop,o=e?{...t,id:e.id}:t,c=e?await a?.updateProxyPoolItem?.(o):await a?.createProxyPoolItem?.(o);return Do(c),c}async function q2(){const e=tr().workbuddyDesktop;if(typeof e?.getProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const t=await e.getProxySettings();if(!t||typeof t!="object")throw new Error(r("代理设置响应异常"));return t}async function UY(e){const t=tr().workbuddyDesktop;if(typeof t?.saveProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const a=await t.saveProxySettings(e);if(!a||typeof a!="object")throw new Error(r("代理设置响应异常"));return a}function VY({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.name||""),[d,f]=x.useState(e?.protocol==="socks5"?"socks5":"http"),[p,h]=x.useState(e?.host||""),[b,y]=x.useState(e?.port?String(e.port):""),[v,w]=x.useState(e?.username||""),[j,S]=x.useState(e?.password||""),[N,k]=x.useState(e?e.enabled:!0),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null);function P(){const L=o.trim();if(!L)return{error:r("请填写代理名称")};const H=p.trim();if(!H)return{error:r("请填写代理主机地址")};const B=Number(b);return!Number.isInteger(B)||B<1||B>65535?{error:r("代理端口必须是 1-65535 的整数")}:{payload:{name:L,source:"manual",protocol:d,host:H,port:B,username:v.trim(),password:j,enabled:N}}}async function O(){if(C)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}const H=L.payload,B={source:"custom",protocol:H.protocol,host:H.host,port:H.port,username:H.username,password:H.password};A(!0),I(r("正在连接上游…"));try{const z=await tr().workbuddyDesktop?.testProxy?.({proxy:B});if(z?.success){const Q=f0(z.durationMs);I(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),z.ip?r(" 出口 IP {ip}",{ip:z.ip}):"",Q?` ${Q}`:""]}))}else I(s.jsxs("span",{className:"text-destructive",children:["❌ ",z?.error||r("连接失败")]}))}catch(z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(z)]}))}finally{A(!1)}}async function _(){if(T)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}D(!0),I(null);try{await HY(e,L.payload),Fn(a?r("已保存「{name}」",{name:o.trim()}):r("已新增「{name}」",{name:o.trim()})),t()}catch(H){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(H)]})),D(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:L=>{!L&&!T&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑代理":"新增代理")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-name",children:r("名称")}),s.jsx($e,{id:"proxy-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:香港 HTTP 出口"),value:o,onChange:L=>c(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-protocol",children:r("协议")}),s.jsxs(ft,{value:d,onValueChange:L=>f(L),children:[s.jsx(mt,{id:"proxy-protocol",className:"min-w-[110px]",children:s.jsx(pt,{children:d==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-host",children:r("主机")}),s.jsx($e,{id:"proxy-host",placeholder:"127.0.0.1",autoComplete:"off",spellCheck:!1,value:p,onChange:L=>h(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-port",children:r("端口")}),s.jsx($e,{id:"proxy-port",type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:b,onChange:L=>y(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-user",children:r("用户名")}),s.jsx($e,{id:"proxy-user",placeholder:r("可选"),autoComplete:"off",value:v,onChange:L=>w(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-pass",children:r("密码")}),s.jsx($e,{id:"proxy-pass",placeholder:r("可选"),autoComplete:"off",value:j,onChange:L=>S(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:N,onCheckedChange:k,"aria-label":r("启用这条代理")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的条目不会被账号使用,被引用时账号回退直连;仍可测试)")})]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("想要 Clash Verge 的出口?那类条目由工具条的"),s.jsx("b",{children:r("「同步 Clash Verge」")}),r("整体 镜像进来(进本页时也会自动同步一次),名称与端口跟随 Clash、因此是只读的 —— 不必(也不能)在这里手工填。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",disabled:C||T,onClick:()=>{O()},children:r(C?"测试中…":"测试出口")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:T,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:T,onClick:()=>{_()},children:r(T?"保存中…":"保存")})]})]})})}function FY({onClose:e}){const[t,a]=x.useState(!0),[o,c]=x.useState(!1),[d,f]=x.useState(""),[p,h]=x.useState(""),[b,y]=x.useState(""),[v,w]=x.useState({}),[j,S]=x.useState(""),[N,k]=x.useState(!1);x.useEffect(()=>{let A=!0;return(async()=>{try{const R=await q2();if(!A||R===null)return;f(String(R.listenerPortBase??"")),h(String(R.listenerPortEnd??"")),y(String(R.testUrl??"")),w(R.defaults??{}),a(!1)}catch(R){if(!A)return;S(Ra(R)),a(!1)}})(),()=>{A=!1}},[]);function T(){const A=Number(d),R=Number(p);if(!Number.isInteger(A)||A<1||A>65535||!Number.isInteger(R)||R<1||R>65535)return S(r("端口范围必须是 1-65535 的整数")),null;if(A>R)return S(r("起始端口不能大于结束端口")),null;const I=b.trim();return I&&!I.startsWith("http://")&&!I.startsWith("https://")?(S(r("测试网址要以 http:// 或 https:// 开头")),null):(S(""),{listenerPortBase:A,listenerPortEnd:R,testUrl:I})}async function D(){if(o||t)return;const A=T();if(A){c(!0);try{await UY(A),k(!0)}catch(R){S(Ra(R))}finally{c(!1)}}}function C(){f(String(v.listenerPortBase??"")),h(String(v.listenerPortEnd??"")),y(String(v.testUrl??"")),k(!1),S("")}return s.jsx(Qt,{open:!0,onOpenChange:A=>{!A&&!o&&e()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("代理设置")})}),s.jsx(Bt,{className:"flex flex-col gap-3.5",children:t?s.jsx("p",{className:"text-xs text-subtle",children:r("加载中…")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-base",children:r("节点端口范围(起始)")}),s.jsx($e,{id:"proxy-settings-base",type:"number",min:1,max:65535,placeholder:String(v.listenerPortBase??""),autoComplete:"off",value:d,onChange:A=>{f(A.currentTarget.value),k(!1)}})]}),s.jsx("span",{"aria-hidden":"true",className:"flex-none pb-[7px] text-subtle",children:"—"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-end",children:r("节点端口范围(结束)")}),s.jsx($e,{id:"proxy-settings-end",type:"number",min:1,max:65535,placeholder:String(v.listenerPortEnd??""),autoComplete:"off",value:p,onChange:A=>{h(A.currentTarget.value),k(!1)}})]})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅节点会在本机各占一个监听端口,从该范围里挑空闲的分配;节点多的大订阅把默认范围({base}-{end})用尽时会报「没有可用的节点端口」,这时把范围调大再重启内核。已分配出去的端口不会因改范围而失效。",{base:v.listenerPortBase??"",end:v.listenerPortEnd??""})}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-url",children:r("出口测试网址")}),s.jsx($e,{id:"proxy-settings-url",placeholder:v.testUrl||"",autoComplete:"off",spellCheck:!1,className:"font-mono text-[12px]",value:b,onChange:A=>{y(A.currentTarget.value),k(!1)}})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("「测试」与「批量测试」访问的目标;留空用默认(打 WorkBuddy 上游)。判据是能否拿到 HTTP 响应,不用考虑该网址返回什么内容。")}),s.jsxs("div",{className:"min-h-[18px] text-xs",children:[j?s.jsxs("span",{className:"text-destructive",children:["❌ ",j]}):null,!j&&N?s.jsxs("span",{className:"text-success",children:["✅ ",r("已保存。重启内核后,新分配的节点端口才会按新范围来。")]}):null]})]})}),s.jsxs(nn,{children:[s.jsx(se,{variant:"ghost",disabled:t||o,onClick:C,children:r("恢复默认")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:o,onClick:e,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:t||o,onClick:()=>{D()},children:r(o?"保存中…":"保存")})]})]})})}function Pn(){return window}function nr(e,t){Pn().wbApp?.toast?.(e,t)}function zr(e){return e instanceof Error?e.message:String(e)}function G2(e){const t=String(e||"").trim();return/^https?:\/\//i.test(t)?t:""}async function K2(e){const t=G2(e);if(!t){nr(r("链接地址不受支持"),"err");return}try{await Pn().workbuddyDesktop?.openReleasePage(t)}catch(a){nr(r("打开链接失败:{error}",{error:zr(a)}),"err")}}const Jg="1127656296",$Y=`assets/qq-group/${Jg}.jpg`;function Y2(e){return Pn().wbMarkdown?.render?.(e)||""}function X2(e){const a=e.target?.closest?.("[data-external]");a&&(e.preventDefault(),K2(a.dataset.external||""))}const pp="__proxy_other__",Q2={proxyChoice:null,pool:null,poolError:""};async function qY(){const e=Pn().workbuddyDesktop,t={...Q2};if(!e?.getUpdateProxy)return t;try{t.proxyChoice=(await e.getUpdateProxy())?.proxy??null}catch{}try{if(typeof e.getProxyPool!="function")throw new Error("桥未提供代理池方法");const a=(await e.getProxyPool())?.items;if(!Array.isArray(a))throw new Error("代理池响应异常");t.pool=a}catch(a){t.pool=[],t.poolError=zr(a)}return t}async function GY(e){if(e===pp)return null;const t=Pn().workbuddyDesktop;if(!t?.setUpdateProxy)return null;const a=e===""?null:{source:"pool",proxyId:e.slice(Xa.length)};try{const o=await t.setUpdateProxy({proxy:a}),c=o?.proxy??null,d=o?.saved!==!1;return d?nr(c?r("✅ 更新出网已切换为 {label}",{label:c.label||r("指定代理")}):r("✅ 更新出网已切换为直连")):nr(r("出网线路已切换,但写入磁盘失败(重启后会恢复原线路)"),"err"),{choice:c,saved:d}}catch(o){return nr(r("保存失败:{error}",{error:zr(o)}),"err"),null}}function Z2(e){const t=e.proxyChoice,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=!!t?.error,d=Array.isArray(e.pool)?e.pool:[];let f="";a==="pool"&&t?.config?.proxyId?f=`${Xa}${t.config.proxyId}`:t&&(f=pp);const p=[{value:"",label:r("直连")}];for(const h of d)p.push({value:`${Xa}${h.id}`,label:au(h)});if(e.pool===null?p.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):d.length||p.push({value:"__hint_pool__",label:e.poolError?r("代理列表读取失败"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),f===pp){const h=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";p.push({value:pp,label:`${h}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!d.some(h=>`${Xa}${h.id}`===f)&&p.push({value:f,label:`${o}${c?r("(不可用)"):""}`});return{current:f,items:p,selected:p.find(h=>h.value===f),broken:c,title:c?r("当前线路不可用:{error};请重新选择代理或切回直连",{error:String(t?.error||"")}):r("检查更新与下载安装包走哪条线路(当前:{current});选择即保存。选项来自「网络代理」页;直连失败时会自动借 Clash 混合端口重试一次,选定指定代理后只走它",{current:t?o:r("直连")})}}function sr(){return window}function sn(e,t){sr().wbApp?.toast?.(e,t)}function jr(e){return e instanceof Error?e.message:String(e)}let Ht={data:null,loading:!1,error:"",pending:!1,refreshing:null};const h0=new Set;function ex(e){return h0.add(e),()=>{h0.delete(e)}}function tx(){return Ht}function yn(e){Ht={...Ht,...e},h0.forEach(t=>t())}function KY(){return Ht.data?.items??[]}function Vu(){return Ht.data?.kernel??null}function Yi(e){!e||typeof e!="object"||!Array.isArray(e.items)||yn({data:e,error:""})}function Io(){fp(!0)}async function Ml(e=!1){const t=sr().workbuddyDesktop;if(typeof t?.getSubscriptions!="function"){yn({error:r("当前环境不支持订阅(桥接方法缺失)")});return}e||yn({loading:!0});try{Yi(await t.getSubscriptions())}catch(a){yn({error:jr(a)})}finally{e||yn({loading:!1})}}const YY=20;function XY(e){const t=e.kernel;if(!t||t.download.state==="downloading")return!1;if(!t.installed||t.lastError&&!t.running)return!0;const a=t.providerSync??{};return(e.items??[]).filter(o=>o.enabled!==!1).every(o=>!!a[o.id])}async function Xi(){const e=sr().workbuddyDesktop;if(typeof e?.getSubscriptions=="function")for(let t=0;tsetTimeout(o,1500)),Io();let a;try{a=await e.getSubscriptions()}catch{return}if(Yi(a),t>=1&&a&&Array.isArray(a.items)&&XY(a))return}}async function W2(e){const a=await sr().workbuddyDesktop?.addSubscription?.({enabled:!0,kind:"url",url:"",...e});return Yi(a),sn(r("已新增订阅「{name}」,内核正在同步节点…",{name:e.name.trim()})),Io(),Xi(),a??null}async function J2(e,t){const o=await sr().workbuddyDesktop?.saveSubscription?.({id:e.id,...t});Yi(o),sn(r("已保存「{name}」",{name:t.name.trim()})),Io(),Xi()}async function QY(e,t){const a=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const o=await a?.saveSubscription?.({id:e.id,name:e.name,url:e.url,kind:e.kind,enabled:t});Yi(o),sn(t?r("已启用「{name}」",{name:e.name}):r("已禁用「{name}」",{name:e.name})),Io(),Xi()}catch(o){sn(r("保存失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function ZY(e){const t=sr().workbuddyDesktop;if(!(Ht.refreshing||Ht.pending)){yn({refreshing:e.id});try{const a=await t?.refreshSubscription?.(e.id);Yi(a),sn(r("已刷新「{name}」,正在同步节点…",{name:e.name})),Io(),Xi()}catch(a){sn(r("刷新失败:{reason}",{reason:jr(a)}),"err")}finally{yn({refreshing:null})}}}async function WY(e){const t=sr().workbuddyDesktop;if(await window.wbConfirm?.ask?.({title:r("删除订阅"),html:r("确定删除「{name}」?它在代理池里的节点会一并移除,引用这些节点的账号会回退直连。",{name:e.name||e.id}),okText:r("删除"),okClass:"danger"})&&!Ht.pending){yn({pending:!0});try{const o=await t?.removeSubscription?.(e.id);Yi(o),sn(r("已删除「{name}」",{name:e.name||e.id})),Io(),Xi()}catch(o){sn(r("删除失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function JY(e){const t=sr().workbuddyDesktop;if(typeof t?.downloadKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const a=await t.downloadKernel(e);a&&Ht.data&&yn({data:{...Ht.data,kernel:a}}),a?.saved===!1&&sn(r("下载线路 / 存放目录没能写进配置(本次下载已按新设置走,重启后会恢复原值)"),"err");for(let c=0;c<300;c+=1){await new Promise(f=>setTimeout(f,1e3));const d=await t.getKernelStatus?.();if(d&&Ht.data&&yn({data:{...Ht.data,kernel:d}}),!d||d.download.state!=="downloading")break}const o=Ht.data?.kernel;o?.download.state==="error"?sn(r("内核下载失败:{reason}",{reason:o.download.error||r("未知错误")}),"err"):o?.download.state==="canceled"?sn(r("已停止下载内核(未下载完的临时文件已删除)")):o?.download.state==="done"&&(sn(r("✅ 内核下载完成,正在启动…")),Xi())}catch(a){sn(r("内核下载失败:{reason}",{reason:jr(a)}),"err")}finally{yn({pending:!1})}}}async function eX(){const e=sr().workbuddyDesktop;if(typeof e?.cancelKernelDownload!="function")return"none";try{const t=await e.cancelKernelDownload();if(t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),t?.canceled===!1)return"none";for(let o=0;o<20;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.download.state!=="downloading")break;await new Promise(d=>setTimeout(d,250))}const a=Ht.data?.kernel?.download.state;return a==="canceled"?"canceled":a==="done"?"done":"stalled"}catch(t){return sn(r("停止下载失败:{reason}",{reason:jr(t)}),"err"),"none"}}async function tX(){const e=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const t=await e?.restartKernel?.();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),sn(r("内核正在启动…")),Io(),Xi()}catch(t){sn(r("内核启动失败:{reason}",{reason:jr(t)}),"err")}finally{yn({pending:!1})}}}async function nX(){const e=sr().workbuddyDesktop;if(typeof e?.stopKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const t=await e.stopKernel();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}});for(let o=0;o<10;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.running===!1)break;await new Promise(d=>setTimeout(d,500))}const a=Ht.data?.kernel;if(a?.running===!1)sn(r("内核已关闭(订阅与端口注册表保留,「启动内核」后原位恢复)"));else{const o=a?.lastError||r("内核没有在超时内停下来");sn(r("关闭内核失败:{reason}",{reason:o}),"err")}Ml(!0)}catch(t){sn(r("关闭内核失败:{reason}",{reason:jr(t)}),"err"),Ml(!0)}finally{yn({pending:!1})}}}async function sX(){const e=sr().workbuddyDesktop;if(typeof e?.removeKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}const t=Vu()?.version;if(!await window.wbConfirm?.ask?.({title:r("删除内核"),html:r("确定删除已下载的内核{version}?内核文件与端口映射会被移除,订阅节点会变成「未分配端口」,引用它们的账号会暂时回退直连;订阅本身保留,重新下载内核后会重新分配端口。",{version:t?`(${t})`:""}),okText:r("删除内核"),okClass:"danger"})||Ht.pending)return;yn({pending:!0});const o=Vu()?.lastError||"";try{const c=await e.removeKernel();c&&Ht.data&&yn({data:{...Ht.data,kernel:c}});for(let f=0;f<20;f+=1){const p=await e.getKernelStatus?.();if(p&&Ht.data&&yn({data:{...Ht.data,kernel:p}}),p&&p.installed===!1||p?.lastError&&p.lastError!==o)break;await new Promise(h=>setTimeout(h,500))}const d=Ht.data?.kernel;if(d?.installed===!1)sn(r("已删除内核(订阅与账号引用保留,重新下载后会重新分配端口)")),Io();else{const f=d?.lastError&&d.lastError!==o?d.lastError:r("内核目录没能删掉(可能仍被进程占用),稍后重试一次");sn(r("删除内核失败:{reason}",{reason:f}),"err")}Ml(!0)}catch(c){sn(r("删除内核失败:{reason}",{reason:jr(c)}),"err"),Ml(!0)}finally{yn({pending:!1})}}async function rX(e){const t=sr().workbuddyDesktop;if(typeof t?.decodeQrImage!="function")throw new Error(r("当前环境不支持订阅(桥接方法缺失)"));const a=await new Promise((d,f)=>{const p=new FileReader;p.onload=()=>d(String(p.result||"")),p.onerror=()=>f(new Error(r("图片读取失败"))),p.readAsDataURL(e)}),c=(await t.decodeQrImage({imageBase64:a}))?.url;if(!c)throw new Error(r("二维码里没有订阅链接"));return c}function aX(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result||"")),o.onerror=()=>a(new Error(r("文件读取失败"))),o.readAsDataURL(e)})}function eD(e){return(Math.max(0,Number(e)||0)/1024/1024).toFixed(1)}function lX(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")}function oX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),o=a?.download,c=o?.state==="downloading",d=c&&o&&o.total>0?Math.round(o.received/o.total*100):null,[f,p]=x.useState(null),[h,b]=x.useState(""),[y,v]=x.useState(null),[w,j]=x.useState(a?.kernelDir||""),[S,N]=x.useState(!1),[k,T]=x.useState(!1),[D,C]=x.useState("");x.useEffect(()=>{let H=!0;return(async()=>{try{const B=(await sr().workbuddyDesktop?.getProxyPool?.())?.items;if(!Array.isArray(B))throw new Error(r("代理池响应异常"));H&&p(B)}catch(B){if(!H)return;p([]),b(jr(B))}})(),()=>{H=!1}},[]),x.useEffect(()=>{a?.installed&&e()},[a?.installed]);const A=Z2({proxyChoice:a?.downloadProxy??null,pool:f,poolError:h}),R=y??A.current,I=A.items.find(H=>H.value===R)??A.selected,P=a?.kernelDirDefault||"";async function O(){if(S)return;const H=w.trim();if(H&&!lX(H)){C(r("存放位置要填绝对路径,例如 D:\\proxy-kernel"));return}C(""),N(!0);try{const B={dir:H};R!==pp&&(B.proxy=R===""?null:{source:"pool",proxyId:R.slice(Xa.length)}),JY(B)}finally{N(!1)}}async function _(){if(!k){T(!0);try{const H=await eX();H==="done"?sn(r("下载已经完成,停止没赶上(内核已安装)")):H==="none"?sn(r("当前没有正在进行的下载"),"err"):H==="stalled"&&sn(r("停止请求已发出,但下载还没收手,稍后再看一次进度"),"err")}finally{T(!1)}}}async function L(){const H=sr().workbuddyDesktop;if(typeof H?.pickFolder!="function"){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}try{const B=await H.pickFolder(w.trim()||P||null);if(B?.unsupported){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}if(B?.canceled||!B?.path)return;j(B.path)}catch(B){sn(r("打开文件夹选择框失败:{reason}",{reason:jr(B)}),"err")}}return s.jsx(Qt,{open:!0,onOpenChange:H=>{H||e()},children:s.jsxs(Zt,{className:"w-[min(520px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r(c?"正在下载内核":"下载内核")}),s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("内核 {version}({asset})",{version:a?.version||"—",asset:a?.asset||"—"})})]}),c?s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tf,{value:d??null}),s.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[s.jsx("span",{className:"text-text-2",children:d!==null?r("{percent}%({received} / {total} MB)",{percent:d,received:eD(o?.received),total:eD(o?.total)}):r("正在连接 GitHub…")}),s.jsx("span",{className:"text-subtle",children:r("存放位置 {dir}",{dir:a?.kernelDir||"—"})})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("关掉这个窗口不会中断下载(它在后台继续跑)—— 要停下就点下面的「停止下载」,未下载完的临时文件会被删除。")})]}):s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-proxy",children:r("下载线路")}),s.jsxs(ft,{value:R,onValueChange:H=>v(String(H)),children:[s.jsx(mt,{id:"kernel-proxy",className:Ue("w-full",A.broken&&"border-destructive-bd"),children:s.jsx(pt,{className:"min-w-0 truncate",children:I?.label||r("直连")})}),s.jsx(ht,{children:A.items.map(H=>s.jsx(qe,{value:H.value,disabled:H.disabled,children:H.label},H.value))})]}),s.jsx("div",{className:"text-[12px] text-subtle",children:A.broken?r("当前线路不可用:{error};重新选一条或切回直连",{error:String(a?.downloadProxy?.error||"")}):r("选项来自「网络代理」页(Clash Verge 同步的出口在这里可用;订阅节点要等内核起来才有端口)。选「直连」时连不上会自动借 Clash 混合端口重试一次;选定某条线路后只走它。")})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-dir",children:r("存放位置")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{id:"kernel-dir",className:"min-w-0 flex-1 font-mono text-[12px]",autoComplete:"off",spellCheck:!1,value:w,placeholder:P,onChange:H=>j(H.currentTarget.value)}),s.jsx(se,{variant:"outline",size:"sm",className:"flex-none",onClick:()=>{L()},children:r("选择目录…")}),P&&w.trim()!==P?s.jsx(se,{variant:"ghost",size:"sm",className:"flex-none",title:P,onClick:()=>j(P),children:r("恢复默认")}):null]}),s.jsx("div",{className:"text-[12px] text-subtle",children:r("内核二进制 / 配置 / 端口映射都会放在这里,默认 {dir};目录不存在会在下载开始时自动创建。",{dir:P||"—"})})]}),o?.state==="error"&&o.error?s.jsx("span",{className:"text-[12px] text-destructive",children:r("上次下载失败:{reason}",{reason:o.error})}):null,o?.state==="canceled"?s.jsx("span",{className:"text-[12px] text-subtle",children:r("上次下载已停止,未下载完的临时文件已删除")}):null,D?s.jsx("span",{className:"text-[12px] text-destructive",children:D}):null]}),s.jsx(nn,{children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("后台继续")}),s.jsx(se,{variant:"destructive",disabled:k,onClick:()=>{_()},children:r(k?"正在停止…":"停止下载")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("取消")}),s.jsx(se,{variant:"default",disabled:S||t.pending,onClick:()=>{O()},children:r(S?"正在开始…":"下载")})]})})]})})}function tD({showPortRange:e=!1}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),[o,c]=x.useState(null),[d,f]=x.useState(!1);x.useEffect(()=>{let b=!0;return(async()=>{try{const y=await q2();if(!b||!y)return;const v=Number(y.listenerPortBase),w=Number(y.listenerPortEnd);Number.isFinite(v)&&Number.isFinite(w)&&v>0&&w>0&&c({base:v,end:w})}catch{}})(),()=>{b=!1}},[]);const p=a?.download.state==="downloading",h=p&&a.download.total>0?Math.round(a.download.received/a.download.total*100):null;return s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ze,{variant:a?.running?"default":"secondary",children:a?.running?r("内核运行中"):a?.installed?a.halted?r("内核已手动关闭"):r("内核已停止"):r("内核未安装")}),s.jsxs("span",{className:"text-[12.5px] text-text-2",children:[a?.installed?r("内核 {version}",{version:a.version})+" · ":"",a?.running?r("控制端口 {port} · {n} 个节点监听器",{port:a?.controllerPort??"—",n:a?.listenerCount??0}):a?.installed?a.halted?r("内核已手动关闭(点「启动内核」拉起)"):r("内核已停止,点「启动内核」拉起"):r("按需下载(约 20-40MB)")]}),e&&o?s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("节点端口范围 {base}–{end}",{base:o.base,end:o.end})}):null,s.jsx("div",{className:"ml-auto flex items-center gap-2",children:a?.installed?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{tX()},children:a?.running?r("重启内核"):r("启动内核")}),a?.running?s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{nX()},children:r("关闭内核")}):null,s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending||p,onClick:()=>{sX()},children:r("删除内核")})]}):s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending&&!p,onClick:()=>f(!0),children:r(p?"下载中…":"下载内核")})})]}),p?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tf,{className:"min-w-[200px] flex-1",value:h??null}),s.jsx("span",{className:"text-[11px] text-subtle",children:h!==null?r("{percent}%({received} / {total} MB)",{percent:h,received:nD(a.download.received),total:nD(a.download.total)}):r("下载中…")})]}):null,a?.lastError?s.jsx("span",{className:"text-[12px] text-destructive",children:a.lastError}):null,d?s.jsx(oX,{onClose:()=>f(!1)}):null]})}function iX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=KY(),o=t.data!==null,[c,d]=x.useState(null);return x.useEffect(()=>{Ml()},[]),s.jsxs(Qt,{open:!0,onOpenChange:f=>{f||e()},children:[s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r("订阅管理")}),s.jsxs("span",{className:"text-[11.5px] text-subtle",children:[o?r("{n} 条订阅",{n:a.length}):r("加载中…")," · ",r("节点由内核起成本地监听器,镜像进代理池")]})]}),s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tD,{}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-[18%]"}),s.jsx("col",{className:"w-[31%]"}),s.jsx("col",{className:"w-[9%]"}),s.jsx("col",{className:"w-[14%]"}),s.jsx("col",{className:"w-[8%]"}),s.jsx("col",{className:"w-[20%]"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("名称")}),s.jsx("th",{children:r("订阅来源")}),s.jsx("th",{className:"ta-center",children:r("节点")}),s.jsx("th",{children:r("上次同步")}),s.jsx("th",{className:"ta-center",children:r("启用")}),s.jsx("th",{className:"ta-right",children:r("操作")})]})}),s.jsx("tbody",{children:a.length?a.map(f=>{const p=Vu()?.providerSync?.[f.id];return s.jsxs("tr",{className:f.enabled?"":"off",children:[s.jsx("td",{children:s.jsx("b",{children:f.name||r("未命名")})}),s.jsx("td",{className:"group",children:s.jsx("div",{className:"flex min-w-0 items-center gap-1",children:f.kind==="local"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.fileName,children:f.fileName||r("本地 YAML 文件")}),s.jsx(ze,{variant:"secondary",children:r("本地文件")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.url,children:cX(f.url)}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)] opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","data-copy":f.url,title:r("复制订阅链接"),children:"⧉"})]})})}),s.jsx("td",{className:"ta-center",children:sD(p,f)>0?s.jsx(ze,{variant:"secondary",children:r("{n} 个",{n:sD(p,f)})}):s.jsx("span",{className:"text-subtle",children:r("—")})}),s.jsx("td",{children:p?.at?s.jsx("span",{className:"text-[12px] text-text-2",children:z2(p.at)}):s.jsx("span",{className:"text-subtle",children:r("未同步")})}),s.jsx("td",{className:"ta-center",children:s.jsx(hs,{checked:f.enabled,disabled:t.pending,"aria-label":r("启用订阅「{name}」",{name:f.name||r("未命名")}),onCheckedChange:h=>{QY(f,h)}})}),s.jsx("td",{children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending||t.refreshing!==null||f.kind==="local",title:f.kind==="local"?r("本地文件订阅无需更新(要换内容请编辑后重新选择文件)"):void 0,onClick:()=>{ZY(f)},children:t.refreshing===f.id?r("更新中…"):r("立即更新")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending,onClick:()=>d({item:f}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending,onClick:()=>{WY(f)},children:r("删除")})]})})]},f.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"empty",children:o?s.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[s.jsx("span",{children:r("还没有订阅:粘贴订阅链接、导入本地 YAML 文件,或从图片识别二维码。")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅里的节点会自动同步进代理池,账号即可引用。")})]}):r("加载中…")})})})]})}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅里的节点会被内核起成本地监听器,镜像到代理池(账号按 id 引用,与本页其它出口同一用法)。内核只在用到订阅时按需下载(约 20-40MB),不随安装包分发。")}),t.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:t.error})}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"default",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("完成")})]})]}),c?s.jsx(uX,{item:c.item,onClose:()=>d(null)}):null]})}function nD(e){return!Number.isFinite(e)||e<=0?"—":(e/1e3/1e3).toFixed(1)}function cX(e){try{const t=new URL(e);return t.host+(t.pathname!=="/"?"/…":"")}catch{return e.slice(0,60)}}function sD(e,t){return e?.count??t.nodeCount}function uX({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.kind==="local"?"local":"url"),[d,f]=x.useState(e?.name||""),[p,h]=x.useState(e?.url||""),[b,y]=x.useState(e?.fileName||""),[v,w]=x.useState(""),[j,S]=x.useState(e?e.enabled:!0),[N,k]=x.useState(!1),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null),P=x.useRef(null);async function O(){if(N)return;const z=d.trim();if(!z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请填写订阅名称")]}));return}const Q=p.trim();if(o==="url"&&!(Q.startsWith("http://")||Q.startsWith("https://"))){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("订阅链接必须是 http:// 或 https:// 开头")]}));return}if(!a&&o==="local"&&!v){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请选择要导入的 YAML 文件")]}));return}k(!0);try{a&&o==="local"?await J2(e,{name:z,enabled:j,kind:"local",fileName:b||void 0,...v?{contentB64:v}:{}}):a?await J2(e,{name:z,url:Q,enabled:j,kind:"url"}):o==="local"?await W2({name:z,kind:"local",fileName:b||void 0,contentB64:v}):await W2({name:z,kind:"url",url:Q}),t()}catch(K){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(K)]})),k(!1)}}async function _(z){if(!T){D(!0),I(r("正在识别二维码…"));try{const Q=await rX(z);h(Q),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已识别订阅链接")]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{D(!1)}}}async function L(z){if(!C){A(!0),I(null);try{const Q=await aX(z);w(Q),y(z.name),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已选择「{name}」,保存后导入",{name:z.name})]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{A(!1)}}}function H(z){if(o!=="url")return;const K=Array.from(z.clipboardData?.files||[]).find(X=>X.type.startsWith("image/"));K&&(z.preventDefault(),_(K))}function B(z){z!==o&&(c(z),I(null))}return s.jsx(Qt,{open:!0,onOpenChange:z=>{!z&&!N&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",overlayForceRender:!0,onPaste:H,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑订阅":"新增订阅")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-name",children:r("名称")}),s.jsx($e,{id:"sub-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:我的机场"),value:d,onChange:z=>f(z.currentTarget.value)})]}),a?null:s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:r("订阅来源")}),s.jsx(In,{options:[{value:"url",label:r("订阅链接")},{value:"local",label:r("本地 YAML 文件")}],value:o,onValueChange:B,"aria-label":r("订阅来源")})]}),o==="url"?s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-url",children:r("订阅链接")}),s.jsx($e,{id:"sub-url",autoComplete:"off",spellCheck:!1,placeholder:"https://…",value:p,onChange:z=>h(z.currentTarget.value)}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:T,onClick:()=>P.current?.click(),children:r(T?"识别中…":"从图片识别二维码")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("也可以把二维码截图直接粘贴到弹窗里(Ctrl+V)")}),s.jsx("input",{ref:P,type:"file",accept:"image/*",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&_(Q),z.currentTarget.value=""}})]})]}):s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-file",children:r("YAML 文件")}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:C,className:"shrink-0",onClick:()=>P.current?.click(),children:r(C?"读取中…":a?"重新选择文件…":"选择 YAML 文件…")}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:b||void 0,children:b||r(a?"保持原文件":"未选择文件")})]}),a?s.jsx("span",{className:"text-[11px] text-subtle",children:r("本地文件不会自动更新:要更新节点,重新选择文件后保存;不重选则内容保持不变。")}):null,s.jsx("input",{ref:P,type:"file",accept:".yaml,.yml,text/yaml,application/yaml,text/plain",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&L(Q),z.currentTarget.value=""}})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:j,onCheckedChange:S,"aria-label":r("启用这条订阅")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的订阅不参与内核同步,它的节点会从代理池移除)")})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r(o==="url"?"订阅内容由内核定时刷新(每 24 小时);节点数与同步状态在保存后由轮询刷新,稍等几秒。":"本地文件订阅的内容在导入时固定:节点会由内核起成本地监听器并镜像进代理池,节点数稍等几秒由轮询刷新。")}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:N,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:N||T||C,onClick:()=>{O()},children:r(N?"保存中…":"保存")})]})]})})}const g0=[{key:"pick",label:r("选择"),align:"center"},{key:"name",label:r("节点")},{key:"addr",label:r("地址")},{key:"state",label:r("启用"),align:"center"},{key:"test",label:r("连通性")},{key:"act",label:r("操作"),align:"right"}],dX={pick:"p-pick",name:"",addr:"p-addr",state:"p-state",test:"p-test",act:"p-act"},rD="proxies";function x0(){return window}let nx=null,aD=null;function lD(){return nx?nx.apply([...g0]):g0.map(e=>({...e,align:e.align??"left"}))}function fX(){x0().wbTableColumns?.repaint?.(rD)}function pX(e){if(aD=e,nx)return!0;const t=x0().wbColSettings;return t?.register?(nx=t.register({id:rD,label:r("代理池表"),columns:g0.map(a=>({key:a.key,label:a.label,align:a.align??"left"})),mount:()=>document.querySelector('.page[data-page="proxies"] .panel-head .head-actions'),onChange:()=>aD?.()}),!0):!1}function mX(){x0().wbColSettings?.close?.()}function hX(){const e=x.useSyncExternalStore(EY,AY),t=x.useSyncExternalStore(ex,tx).data?.items??[],[a,o]=x.useState(null),[c,d]=x.useState(!1),[f,p]=x.useState(!1),[h,b]=x.useState(""),[y,v]=x.useState("all"),[w,j]=x.useState("all"),[S,N]=x.useState("all"),[k,T]=x.useState(0),[,D]=x.useReducer(J=>J+1,0),C=Wg(),A=e.data!==null,R=e.selected.size,I=C.filter(J=>e.selected.has(J.id)&&Qg(J)).length,P=e.batchProgress;x.useEffect(()=>{Ml()},[]),x.useLayoutEffect(()=>{if(!pX(()=>D())){const J=window.setTimeout(()=>T(ie=>ie+1),50);return()=>window.clearTimeout(J)}D()},[k]),x.useLayoutEffect(()=>{fX()}),x.useEffect(()=>()=>{mX()},[]);const O=h.trim().toLowerCase(),_=bX(C,t);function L(J){return w==="all"?!0:w==="manual"||w==="clash"||w==="subscription"?tl(J)===w:w===cD?!!J.orphan:J.source==="subscription"&&!J.orphan&&J.providerId===w}function H(J){return!(y!=="all"&&tl(J)!==y||!L(J)||S!=="all"&&iD(J)!==S||O&&![J.name,Uh(J),J.host,J.protocol,String(J.port??"")].join(" ").toLowerCase().includes(O))}function B(J){const ie=J??"all";j(ie),v(ie==="all"?"all":ie==="manual"||ie==="clash"?ie:"subscription")}function z(J){v(J),j("all")}const Q=C.filter(H),K=Q.map(J=>J.id),X=K.length>0&&K.every(J=>e.selected.has(J)),q=K.some(J=>e.selected.has(J))&&!X,$=lD(),Y=[];for(const J of oD())Y.push(...Q.filter(ie=>tl(ie)===J.key));const F=ig(Q.length,"proxies"),G=F.paged?F.slice(Y):Y,W=new Map;for(const J of Q)W.set(tl(J),(W.get(tl(J))??0)+1);x.useEffect(()=>{F.goto(1)},[O,y,w,S]);function le(J){const ie=J.lastTest;if(!ie||!ie.at)return s.jsx("span",{className:"text-subtle",children:r("未测试")});const ge=f0(ie.durationMs);return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsxs("span",{className:ie.success?"text-success":"text-destructive",children:[ie.success?r("✅ {ip}",{ip:ie.ip||r("连接成功")}):r("❌ 连接失败"),ge?` ${ge}`:"",s.jsxs("span",{className:"text-[11px] text-subtle",children:[" ",z2(ie.at)]})]}),ie.success?null:s.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-subtle",title:String(ie.error||r("连接失败")),children:String(ie.error||r("连接失败"))})]})}function M(J){const ie=J.usedBy||[],ge=[];return J.protocol&&ge.push(J.protocol),ie.length&&ge.push(s.jsx("span",{className:"text-warn",title:ie.map(ee=>String(ee.name||ee.id||"")).join(r("、")),children:r("{n} 个账号在用",{n:ie.length})})),ge.length?s.jsx("span",{className:"text-[11px] text-subtle",children:ge.map((ee,fe)=>s.jsxs(x.Fragment,{children:[fe?" · ":"",ee]},fe))}):null}function U(J){if(yY(J)&&(J.port===null||J.port===void 0))return s.jsx("span",{className:"text-subtle",children:r("已禁用(未开监听端口)")});if(J.resolveError){const ge=J.source==="subscription"&&(J.port===null||J.port===void 0);return s.jsx("span",{className:ge?"text-subtle":"text-destructive",title:J.resolveError,children:r(ge?"未分配端口":"解析失败")})}if(bY(J)){const ge=Vu()?.installed===!1;return s.jsx("span",{className:"text-subtle",title:r(ge?"代理内核未安装(在「订阅管理」里下载内核后,节点会自动分配监听端口)":"还没有监听端口(还没有账号引用它 —— 在账号里选它并保存后,内核会自动开端口)"),children:Uh(J)||r("未分配端口")})}const ie=Uh(J);return s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx("span",{className:"min-w-0 flex-1 font-mono text-[12px] leading-[1.45] text-text-2 break-all",title:ie||void 0,children:ie||"—"}),ie?s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn flex-none","data-copy":ie,title:r("复制地址"),children:"⧉"}):null]})}function Z(J,ie,ge,ee){const fe=ge||e.batchBusy;switch(J){case"pick":return s.jsx(Mr,{checked:ee,title:r("勾选后可批量操作"),"aria-label":r("勾选「{name}」",{name:ie.name||r("未命名")}),onCheckedChange:te=>OY(ie.id,te)});case"name":return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsx("b",{children:ie.name||r("未命名")}),M(ie)]});case"addr":return U(ie);case"state":{const te=H2(ie);return s.jsx(hs,{checked:ie.enabled!==!1,disabled:fe||te,"aria-label":r("启用「{name}」",{name:ie.name||r("未命名")}),title:TY(ie),onCheckedChange:Ce=>{_Y(ie,Ce)}})}case"test":return le(ie);case"act":{const te=Zg(ie);Qg(ie);const Ce=F2(ie),re=e.testing===ie.id;return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe||e.testing!==null,onClick:()=>{PY(ie)},children:r(re?"测试中…":"测试")}),ie.source!=="clash"&&ie.source!=="subscription"?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe,onClick:()=>o({item:ie}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,onClick:()=>{$2(ie)},children:r("删除")})]}):null,te?s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,title:Ce,onClick:()=>{$2(ie)},children:r("删除")}):null]})}default:return null}}function ae(J){const ie=e.pending.has(J.id),ge=RY(J.id);return s.jsx("tr",{className:Ue(J.enabled?"":"off",ge&&"bg-primary-soft"),"data-id":J.id,children:$.map(ee=>s.jsx("td",{className:`ta-${ee.align}`,children:Z(ee.key,J,ie,ge)},ee.key))},J.id)}function ce(){if(!C.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:r(A?"还没有代理。点右上角「+ 新增代理」手填一个,点「同步 Clash Verge」把 Clash 的出口导进来,或在「订阅管理」里导入订阅节点。":"加载中…")})});if(!Q.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:O?r("没有匹配「{kw}」的出口",{kw:h.trim()}):r("没有匹配当前筛选的出口")})});const J=[];let ie="";for(const ge of G){const ee=tl(ge);if(ee!==ie){ie=ee;const fe=oD().find(te=>te.key===ee);J.push(s.jsx("tr",{className:"tr-group",children:s.jsxs("td",{colSpan:$.length,children:[s.jsx("span",{className:"prov-tag",children:fe?.label??ee}),r("{n} 个",{n:W.get(ee)??0}),fe?.note?s.jsxs("span",{className:"font-normal",children:[" · ",fe.note]}):null]})},`group:${ee}:${J.length}`))}J.push(ae(ge))}return s.jsx(s.Fragment,{children:J})}return s.jsx(s.Fragment,{children:s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("代理池")}),s.jsx("span",{className:"panel-sub",children:A?r("{n} 个出口",{n:C.length}):r("加载中…")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅与 Clash 的出口自动镜像进来")}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>d(!0),children:r("设置")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>p(!0),children:t.length?r("订阅管理({n})",{n:t.length}):r("订阅管理")}),s.jsx(se,{variant:"outline",disabled:e.syncing||e.batchBusy,onClick:()=>{IY()},children:e.syncing?r("同步中…"):r("同步 Clash Verge")}),s.jsx(se,{variant:"outline",disabled:e.loading||e.batchBusy,onClick:()=>{fp(),Ml()},children:e.loading?r("刷新中…"):r("刷新")}),s.jsx(se,{variant:"default",disabled:e.batchBusy,onClick:()=>o({item:null}),children:r("+ 新增代理")})]})]}),s.jsx("div",{className:"px-3 pt-3",children:s.jsx(tD,{showPortRange:!0})}),R>0?s.jsxs("div",{className:"batch-bar active",children:[s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{children:R})," ",r("个 · 共")," ",s.jsx("b",{children:Q.length})," ",r("个")]}),I?s.jsx("span",{className:"batch-hidden",children:r("其中 {n} 条是同步来的只读条目(Clash / 订阅):可参与批量测试,删除会跳过",{n:I})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>{zY()},children:P?r("测试中 {done}/{total}",{done:P.done,total:P.total}):r("批量测试")}),s.jsx(se,{variant:"destructive",disabled:e.batchBusy,onClick:()=>{BY()},children:r("批量删除")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>DY(),children:r("取消选择")})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 border-b border-border px-4 py-[10px]",children:[s.jsxs(Ci,{className:"w-[clamp(150px,22vw,220px)]",children:[s.jsx(Ei,{type:"search",value:h,"aria-label":r("搜索节点"),placeholder:r("搜索名称 / 地址 / 端口"),onChange:J=>b(J.currentTarget.value)}),s.jsx(Ti,{align:"inline-start","aria-hidden":"true",children:s.jsx(vX,{})})]}),s.jsxs(ft,{value:w,onValueChange:B,children:[s.jsx(mt,{className:"w-[clamp(150px,18vw,210px)]","aria-label":r("按提供方筛选"),children:s.jsx(pt,{children:_.find(J=>J.value===w)?.label??r("全部提供方")})}),s.jsx(ht,{children:_.map(J=>s.jsx(qe,{value:J.value,children:s.jsxs("span",{className:"flex w-full items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate"+(J.count?"":" text-subtle"),children:J.label}),s.jsx("span",{className:"flex-none text-[11px] text-subtle",children:J.count})]})},J.value))})]}),s.jsx(In,{options:gX(C),value:y,onValueChange:z,"aria-label":r("按来源筛选")}),s.jsx(In,{options:xX(C),value:S,onValueChange:N,"aria-label":r("按状态筛选")}),s.jsx("span",{className:"ml-auto text-[11px] text-subtle",children:r("显示 {n} / 共 {total} 个出口",{n:Q.length,total:C.length})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table proxies-table",children:[s.jsx("colgroup",{children:$.map(J=>s.jsx("col",{"data-col":J.key,className:dX[J.key]||void 0},J.key))}),s.jsx("thead",{children:s.jsx("tr",{children:$.map(J=>s.jsx("th",{"data-col":J.key,className:`ta-${J.align}`,children:J.key==="pick"?s.jsx(Mr,{checked:X,indeterminate:q,disabled:!K.length,title:r("全选当前筛选出的出口"),"aria-label":r("全选当前筛选出的出口"),onCheckedChange:ie=>MY(K,ie)}):J.label},J.key))})}),s.jsx("tbody",{children:ce()})]})}),s.jsx(Li,{leading:s.jsxs(s.Fragment,{children:[e.data?.clash&&e.data.clash.available===!1?s.jsx("span",{className:"text-subtle",children:e.data.clash.error?r("未检测到 Clash Verge:{reason}",{reason:e.data.clash.error}):r("未检测到 Clash Verge")}):null,e.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:e.error})}):null]}),total:Q.length,page:F.page,pageCount:F.pageCount,size:F.size,onSizeChange:F.setSize,onPageChange:F.goto,range:F.paged?{start:F.rangeStart,end:F.rangeEnd}:null}),a?s.jsx(VY,{item:a.item,onClose:()=>o(null)}):null,c?s.jsx(FY,{onClose:()=>d(!1)}):null,f?s.jsx(iX,{onClose:()=>p(!1)}):null]})})}function tl(e){return e.source==="clash"?"clash":e.source==="subscription"?"subscription":"manual"}function oD(){return[{key:"manual",label:r("手动"),note:r("本页可编辑、可删除")},{key:"clash",label:"Clash Verge",note:r("名字与端口在 Clash Verge 里改;启用可在本页关闭")},{key:"subscription",label:r("订阅"),note:r("名字与端口跟随订阅与内核;启用可在本页关闭")}]}function gX(e){const t=a=>e.filter(o=>tl(o)===a).length;return[{value:"all",label:r("全部"),count:e.length},{value:"manual",label:r("手动"),count:t("manual")},{value:"clash",label:"Clash",count:t("clash")},{value:"subscription",label:r("订阅"),count:t("subscription")}]}function iD(e){return e.enabled===!1?"off":e.port===null||e.port===void 0?"wait":e.lastTest?.at?e.lastTest.success?"ok":"fail":"none"}function xX(e){const t=a=>e.filter(o=>iD(o)===a).length;return[{value:"all",label:r("全部状态"),count:e.length},{value:"ok",label:r("可用"),count:t("ok")},{value:"fail",label:r("失败"),count:t("fail")},{value:"wait",label:r("未就绪"),count:t("wait")},{value:"off",label:r("已禁用"),count:t("off")}]}const cD="__orphan";function bX(e,t){const a=e.filter(d=>tl(d)==="subscription"),o=t.map(d=>({value:d.id,label:d.name||d.id,count:a.filter(f=>!f.orphan&&f.providerId===d.id).length})).sort((d,f)=>f.count-d.count||d.label.localeCompare(f.label)),c=a.filter(d=>d.orphan).length;return[{value:"all",label:r("全部提供方"),count:e.length},{value:"manual",label:r("手动"),count:e.filter(d=>tl(d)==="manual").length},{value:"clash",label:"Clash Verge",count:e.filter(d=>tl(d)==="clash").length},{value:"subscription",label:r("全部订阅"),count:a.length},...o,...c?[{value:cD,label:r("已移除的订阅"),count:c}]:[]]}function vX(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]})}window.wbProxiesPanel={load:async()=>{await fp(),await Ml()},visibleColumns:()=>lD().map(e=>({key:e.key}))};const uD='.page[data-page="proxies"]';function dD(){const e=document.querySelector(uD);!e||e.dataset.mounted==="1"||(e.dataset.mounted="1",e.replaceChildren(),vn.createRoot(e).render(s.jsx(hX,{})),tr().wbApp?.currentPage==="proxies"&&(fp(),Ml()))}document.querySelector(uD)?dD():document.addEventListener("DOMContentLoaded",dD,{once:!0});const sx=["today","7","30","month","all","custom"],b0="7",v0="custom",fD="workbuddy-desktop-report-range",pD="workbuddy-desktop-report-custom-range",mD={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部"),custom:r("自定义区间")},yX={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部"),custom:r("自定义")};function wX(){try{const e=localStorage.getItem(fD);return e!==null&&sx.includes(e)?e:b0}catch{return b0}}function y0(e){const t=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function jX(){const e=new Date;return{start:y0(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),end:y0(e)}}const rx=/^\d{4}-\d{2}-\d{2}$/;function SX(){try{const e=localStorage.getItem(pD);if(e){const t=JSON.parse(e),a=typeof t?.start=="string"?t.start:"",o=typeof t?.end=="string"?t.end:"";if(rx.test(a)&&rx.test(o)&&a<=o)return{start:a,end:o}}}catch{}return jX()}function NX(e){try{localStorage.setItem(pD,JSON.stringify(e))}catch{}}const kX=[[0,r("一")],[2,r("三")],[4,r("五")]],hD=400;function Qi(e){const t=w0();return t.formatInt?t.formatInt(e):(Number(e)||0).toLocaleString("zh-CN")}function w0(){return window.wbUnits||{}}function ss(e){const t=w0();return t.formatTokens?t.formatTokens(e):String(Number(e)||0)}function gD(e,t){const a=w0();return a.formatAxis?a.formatAxis(e,t):String(e)}function Zi(e){return`${((Number(e)||0)*100).toFixed(1)}%`}function Pt(e){return Math.round(e*10)/10}function ax(e){return[...e].reduce((t,a)=>t+(/[\u2e80-\u9fff]/.test(a)?9.7:5.4),0)}function lx(e){const[t,a,o]=String(e||"").split("-").map(Number);return new Date(t||1970,(a||1)-1,o||1)}const CX=[r("日"),r("一"),r("二"),r("三"),r("四"),r("五"),r("六")];function ox(e){const t=lx(e);return r("{m}月{d}日 周{wd}",{m:t.getMonth()+1,d:t.getDate(),wd:CX[t.getDay()]})}function xD(e){const t=String(e||"").slice(11,13);return t?`${t}:00`:"—"}const TX=8;function bD(e,t){const a=(Array.isArray(e)?e:[]).map(d=>({name:String(d?.label??d?.model??"").trim()||r("未知模型"),tokens:Number(d?.tokens)||0})).filter(d=>d.tokens>0);if(!a.length)return[];const o=a.slice(0,TX),c=o.map(d=>`${t?`[${t(d.name)}]`:""}${r("{model}:{tokens} tokens",{model:d.name,tokens:ss(d.tokens)})}`);return a.length>o.length&&c.push(r("…还有 {n} 个模型",{n:a.length-o.length})),c}function vD(e,t){return[ox(e.date),r("总 Token:{tokens}({n} 次请求)",{tokens:ss(e.tokens),n:Qi(e.requests)}),...bD(e.models,t)].join(` +`)}function EX(e,t){return[`${ox(String(e.hour).slice(0,10))} ${xD(e.hour)}`,r("命中率 {rate}(命中 {hit} / 输入 {input})",{rate:Zi(e.rate),hit:ss(e.hitTokens),input:ss(e.inputTokens)}),r("总 Token:{tokens}",{tokens:ss(e.totalTokens)}),...bD(e.models,t)].join(` +`)}const AX=[1,1.5,2,2.5,3,4,5,6,8,10];function RX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;return(AX.find(c=>c>=a-1e-9)??10)*t}function j0(e){return RX(e/4)*4}function OX(e,t,a){const o=e||{},c=o.topModel,d=Number(o.requests)||0,f=Number(o.successful)||0,p=d?`${(f/d*100).toFixed(1)}%`:"—",h=[{key:"requests",label:r("总请求数"),value:Qi(d),sub:mD[t]||"",mono:!1},{key:"successful",label:r("成功请求数"),value:Qi(f),sub:r("成功率 {rate}",{rate:p}),mono:!1},{key:"tokens",label:r("总 Token"),value:ss(o.tokens),sub:r("输入 + 输出"),mono:!1},{key:"activeDays",label:r("活跃天数"),value:Qi(o.activeDays),sub:r("区间共 {n} 天",{n:a}),mono:!1},{key:"streak",label:r("当前连续天数"),value:Qi(o.streak),sub:r("含今天在内往前数"),mono:!1}];return h.push(c?{key:"topModel",label:r("Top 模型"),value:String(c.model??""),sub:r("{tokens} tokens · 占 {pct}",{tokens:ss(c.tokens),pct:Zi(c.percentage)}),mono:!0}:{key:"topModel",label:r("Top 模型"),value:"—",sub:r("所选范围内还没有模型用量"),mono:!1}),h}function yD(e){if(!Array.isArray(e))return null;const t=e.map(c=>({id:String(c?.id??"").trim(),label:String(c?.label??"").trim(),tokens:Number(c?.totalTokens??c?.tokens)||0})).filter(c=>c.tokens>0);if(!t.length)return[];const a=t.reduce((c,d)=>c+d.tokens,0),o=c=>a?c/a*100:0;return[...t].sort((c,d)=>d.tokens-c.tokens).map((c,d)=>{const f=o(c.tokens),p=ss(c.tokens),h=c.label||c.id||r("未知"),b=c.id?r("{name}({id})",{name:h,id:c.id}):h;return{key:`${d}-${c.id||h}`,id:c.id,name:h,full:b,tip:r("{name}:{tokens} tokens · 占 {pct}%",{name:b,tokens:p,pct:f.toFixed(1)}),tokensText:p,percentText:`${f.toFixed(1)}%`,barWidth:`${f.toFixed(1)}%`}})}function wD(e){return`${ss(e.reduce((t,a)=>t+(Number(a?.totalTokens??a?.tokens)||0),0))} tokens`}const ix=["#f73b00","#f7bb07","#4aaa4d","#1872cb","#3444a3","#13c2c2","#722ed1","#eb2f96","#a0d911","#34d399","#d946ef","#ff85c0","#b37feb","#9d174d","#ffa39e","#69b1ff"],MX={size:220,inner:.62,outer:.88,padAngle:2};function DX(e,t,a,o,c,d){const f=D=>(D-90)*Math.PI/180,p=(D,C)=>[Pt(e+D*Math.cos(f(C))),Pt(t+D*Math.sin(f(C)))],h=d-c;if(h>=359.999){const[D,C]=p(a,0),[A,R]=p(a,180),[I,P]=p(o,0),[O,_]=p(o,180);return`M ${D} ${C} A ${a} ${a} 0 1 1 ${A} ${R} A ${a} ${a} 0 1 1 ${D} ${C} Z M ${I} ${P} A ${o} ${o} 0 1 0 ${O} ${_} A ${o} ${o} 0 1 0 ${I} ${P} Z`}const[b,y]=p(a,c),[v,w]=p(a,d),[j,S]=p(o,d),[N,k]=p(o,c),T=h>180?1:0;return`M ${b} ${y} A ${a} ${a} 0 ${T} 1 ${v} ${w} L ${j} ${S} A ${o} ${o} 0 ${T} 0 ${N} ${k} Z`}const IX="#9aa0a6";function jD(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=String(a?.label??a?.model??a?.id??"").trim();!o||t.has(o)||(Number(a?.totalTokens??a?.tokens)||0)>0&&t.set(o,ix[t.size%ix.length])}return t}function SD(e,t){const a=(Array.isArray(e)?e:[]).map(k=>({label:String(k?.label??k?.model??k?.id??"").trim()||t,tokens:Number(k?.totalTokens??k?.tokens)||0,requests:Number(k?.requests)||0})).filter(k=>k.tokens>0);if(!a.length)return null;const o=a.reduce((k,T)=>k+T.tokens,0);if(!o)return null;const c=jD(e),{size:d,inner:f,outer:p,padAngle:h}=MX,b=d/2,y=d/2,v=d/2*p,w=d/2*f;let j=0;const S=[],N=[];return a.forEach((k,T)=>{const D=k.tokens/o,C=D*360,A=a.length>1?Math.min(h/2,C/4):0,R=j+A,I=j+C-A;j+=C;const P=c.get(k.label)??ix[T%ix.length];let O=null;if(D>=.03){const _=(R+I)/2,L=w+(v-w)*.6,H=(_-90)*Math.PI/180;O={x:Pt(b+L*Math.cos(H)),y:Pt(y+L*Math.sin(H)),text:`${Math.round(D*100)}%`}}I>R&&S.push({key:`${T}-${k.label}`,d:DX(b,y,v,w,R,I),fill:P,evenOdd:C>=359.999,label:O,tip:`${k.label} · ${ss(k.tokens)} tokens · ${Zi(D)}`}),N.push({key:`${T}-${k.label}`,fill:P,name:k.label,tokensText:ss(k.tokens),percentText:Zi(D),tip:r("{name} · {tokens} tokens · {n} 次请求 · {pct}",{name:k.label,tokens:ss(k.tokens),n:Qi(k.requests),pct:Zi(D)})})}),{size:d,slices:S,legend:N,totalText:ss(o)}}const PX=[1,1.25,1.5,2,2.5,3,4,5,6,8,10];function _X(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;let o=1;for(const c of PX)c<=a+1e-9&&(o=c);return o*t}function LX(e){const t=Number(e)||0;if(t<=0)return[0,1,2,3,1/0];const a=Math.max(1,_X(t/4));return[0,a,a*2,a*3,1/0]}function zX(e,t){if(e===0)return"0";const a=t[e-1],o=t[e];return Number.isFinite(o)?a===0?`≤${ss(o)}`:`${ss(a)}–${ss(o)}`:`>${ss(a)}`}function ND(e){const t=Array.isArray(e)?e:[];return LX(t.reduce((a,o)=>Math.max(a,Number(o?.tokens)||0),0))}function BX(e,t){const a=Array.isArray(e)?e:[];if(!a.length)return null;const o=(lx(a[0].date).getDay()+6)%7,c=new Array(o).fill(null).concat(a),d=Math.ceil(c.length/7),f=3,p=20,h=t-p,b=Math.floor((h-f*(d-1))/d),y=Math.max(7,Math.min(26,b)),v=y+3,w=y+f,j=p+d*w-f,S=Math.max(0,Math.round((t-j)/2)),N=v+7*w-f+2,k=Math.max(j,Math.round(t)),T=ND(a),D=O=>T.findIndex(_=>Number(O)<=_),C=[];for(let O=0;O({key:_,x:S+p-6,y:Pt(v+O*w+y/2),text:_})),R=[];let I=-1,P=-9;for(let O=0;O({level:t,text:zX(t,e)}))}function UX(e){const t=e||{};return[["last10m",r("近 10 分钟")],["last1h",r("近 1 小时")],["last24h",r("近 24 小时")],["last7d",r("近 7 天")]].map(([o,c])=>{const d=t[o]||{},f=Number(d.inputTokens)||0;return{key:o,label:c,value:f?Zi(d.rate):"—",sub:r("命中 {hit} / 输入 {input}",{hit:ss(d.hitTokens),input:ss(f)})}})}function VX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=230,d={left:44,right:56,top:26,bottom:24},f=Math.max(40,t-d.left-d.right),p=c-d.top-d.bottom,h=o.map(q=>Number(q.rate)||0),b=o.map(q=>Number(q.totalTokens)||0),y=Math.max(1,j0(Math.max(...h))),v=Math.max(...b),w=j0(v),j=v>0,S=q=>d.left+(o.length>1?f*q/(o.length-1):f/2),N=q=>d.top+p-p*q/y,k=q=>d.top+p-p*q/w,T=[],D=[],C=[];for(let q=0;q<=4;q+=1){const $=y*q/4,Y=Pt(N($)),F=$*100;T.push({key:`g${q}`,y:Y}),D.push({key:`r${q}`,x:d.left-8,y:Y,anchor:"end",text:`${Number.isInteger(F)?F:F.toFixed(1)}%`}),j&&C.push({key:`t${q}`,x:Pt(d.left+f+8),y:Y,anchor:"start",text:gD(w*q/4,w)})}const A=o.length===1?4.5:2.5,R=(q,$)=>({points:q.map((Y,F)=>`${Pt(S(F))},${Pt($(Y))}`).join(" "),dots:q.map((Y,F)=>({key:`d${F}`,cx:Pt(S(F)),cy:Pt($(Y))}))}),I=[],P=(q,$,Y,F)=>{const G=ax(Y),W=F==="middle"?q-G/2:F==="end"?q-G:q,le={left:W,right:W+G,top:$-8.5,bottom:$+2.5};return I.some(M=>le.leftM.left-2&&le.topM.top-1)?null:(I.push(le),{key:`${Y}-${q}-${$}`,x:Pt(q),y:Pt($),text:Y,anchor:F})},O=(q,$)=>{const Y=ax($)/2;return q-Yd.left+f+6?"end":"middle"},_=[];j&&o.forEach((q,$)=>{if(!(Number(q.totalTokens)>0))return;const Y=k(b[$]),F=Y-12>=d.top-10,G=ss(b[$]),W=P(S($),F?Y-12:Y+13,G,O(S($),G));W&&_.push({...W,key:`tl${$}`})});const L=[];o.forEach((q,$)=>{if(!((Number(q.inputTokens)||0)+(Number(q.hitTokens)||0)>0))return;const F=N(h[$]),G=F+15<=d.top+p+8,W=Zi(h[$]),le=P(S($),G?F+13:F-7,W,O(S($),W));le&&L.push({...le,key:`rl${$}`})});const H=o.length>1?f/(o.length-1):f,B=d.left,z=d.left+f,Q=o.length<=hD?o.map((q,$)=>{const Y=Math.max(B,S($)-H/2),F=Math.min(z,S($)+H/2);return{key:`h${$}`,x:Pt(Y),width:Pt(F-Y),tip:EX(q,a)}}):null,K=Math.max(1,Math.ceil(o.length/8)),X=[];for(let q=0;q=o.length;X.push({key:`x${q}`,x:Pt(S(q)),y:c-8,anchor:q===0?"start":$?"end":"middle",text:xD(o[q].hour)})}return{width:t,height:c,plotLeft:B,plotW:f,plotH:p,plotTop:d.top,grid:T,rateTicks:D,tokenTicks:C,rateLine:R(h,N),tokenLine:j?R(b,k):null,dotR:A,rateLabels:L,tokenLabels:_,hourTicks:X,hits:Q}}const FX=13;function $X(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=240,d={left:50,right:14,top:26,bottom:26},f=Math.max(40,t-d.left-d.right),p=f/o.length,h=o.map(K=>Number(K.tokens)>0?ss(K.tokens):""),b=Math.max(0,...h.map(ax)),y=h.every(K=>!K)||b+4<=p,v=!y&&p>=FX;v&&(d.top=10+Math.ceil(b*1.25));const w=c-d.top-d.bottom,j=o.map(K=>Number(K.tokens)||0),S=Math.max(...j),N=j0(S),k=Math.max(1,Math.min(28,p*.68)),T=d.top+w,D=K=>d.top+w-w*K/N,C=o.length<=hD,A=S<=0,R=[],I=[];if(!A)for(let K=0;K<=4;K+=1){const X=N*K/4,q=Pt(D(X));R.push({key:`g${K}`,x1:d.left,y:q,x2:Pt(d.left+f)}),I.push({key:`v${K}`,x:d.left-8,y:q,anchor:"end",text:gD(X,N)})}const P=[];o.forEach((K,X)=>{const q=Number(K.tokens)||0;if(q<=0)return;const $=D(q);P.push({key:String(K.date??X),x:Pt(d.left+p*X+(p-k)/2),y:Pt($),width:Pt(k),height:Pt(Math.max(1,T-$)),rx:k>4?2:1,tip:vD(K),nativeTip:!C})});const O=[],_=[],L=(K,X)=>{const q=h[K],$=D(Number(o[K].tokens)||0),Y=Pt(d.left+p*K+p/2);if(v)return{key:`b${K}`,x:Y,y:Pt($-6),anchor:"start",text:q,rotate:!0};const F=$-6,G=F-9M.leftU.left-2&&M.topU.top-1))return null;_.push(M)}return{key:`b${K}`,x:Y,y:W,anchor:"middle",text:q}};if(y||v)h.forEach((K,X)=>{if(!K)return;const q=L(X,!1);q&&O.push(q)});else{const K=o.map((X,q)=>({index:q,value:Number(X.tokens)||0})).filter(X=>X.value>0).sort((X,q)=>q.value-X.value);for(const X of K){if(O.length>=8)break;const q=L(X.index,!0);q&&O.push(q)}}const H=C?o.map((K,X)=>({key:`h${X}`,x:Pt(d.left+p*X),width:Pt(p),tip:vD(K,a)})):null,B=Math.max(1,Math.ceil(o.length/6)),z=[];for(let K=0;K{const X=o.length===1,q=!X&&K===o.length-1,$=lx(o[K].date);return{key:`d${K}`,x:X?d.left+f/2:q?d.left+f:Pt(d.left+p*K+p/2),y:c-8,anchor:X?"middle":q?"end":K===0?"start":"middle",text:`${$.getMonth()+1}/${$.getDate()}`}});return{width:t,height:c,plotLeft:d.left,plotW:f,plotH:w,plotTop:d.top,grid:R,valueTicks:I,bars:P,barLabels:O,dateTicks:Q,hits:H,blank:A}}function Wi(){return window}const kD=1e3,qX=sx.map(e=>({value:e,label:yX[e]})),GX=r("所选范围内每个账号各消耗了多少 Token,按 Token 用量从多到少排。账号是比提供商更细的一维:同一家可以挂多个账号,转发时按优先级在候选链上依次尝试,所以这里反映的是「具体哪个登录态在出力」。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知账号」是指那批请求没有账号身份:走默认登录态转发(未配置账号列表)时会这样;这一维上线前写出的旧聚合行也没有账号明细,但它们会在升级导入旧数据时按明细自动补算回来 —— 只有明细已被手动清理掉的那几天补不回来,仍留在「未知账号」里,那是确实无从恢复的部分。"),KX=r("所选范围内每个提供商各消耗了多少 Token,按 Token 用量从多到少排。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了(请求体非法、模型不存在、没有可用账号)。这一维与账号那一维不同:旧明细里根本没有「哪家承载」的信息(早期版本只有单一上游,但那是配置事实而非逐条记录),所以无法回算,旧数据会一直留在「未知」里;此后新产生的请求都会记上具体的提供商。"),YX=r("所选范围内每个模型各消耗了多少 Token,按用量从多到少排,扇区角度即占比。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该模型的 Token 用量与百分比。扇区内的百分比只在 ≥3% 时标出,更小的会挤成一团 —— 完整读数在右侧列表与悬停气泡里。颜色按用量排名分配:最大的那段是红色,依次往后;同一份报表里换个维度看,配色口径不变。"),XX=r("所选范围内每个提供商各消耗了多少 Token,按用量从多到少排,扇区角度即占比。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该提供商的 Token 用量与百分比。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了。"),QX=r("命中率 = 缓存读取 Token / 输入 Token(promptTokens)。窗口越短越贴近「此刻」:上游把缓存读取与输入分开上报时,该比值合法地可能超过 100%,此处不夹取值、如实展示。"),ZX=r("每天的总 Token 用量(输入 + 输出)。柱顶标出当天的读数;区间很长、柱子挤到放不下时只标最高的那几天,其余悬停柱子即可读到。");let cx=kD,ux=!0,S0=!1,N0=!1,k0=0,Po=null,Ji=null,dx=null;function ec(e,t="empty"){return s.jsx("div",{className:t,style:{padding:"14px 0"},children:e})}function fx({text:e}){return s.jsx("span",{className:"tip-q","data-tip":e})}function WX({accountId:e}){const t=(Wi().wbApp?.getState?.()?.accounts?.accounts||[]).find(f=>f?.id===e),a=typeof t?.provider=="string"?t.provider:"";if(!a)return null;const o=Wi().wbProviders?.labelOf?.(a)||a,c=t&&Wi().wbAccountsModel?.editionSuffix?.(t)||"",d=c?`${o} ${c}`:o;return s.jsx("span",{className:`pbadge p-${a}`,title:r("提供商:{text}",{text:d}),children:d})}function JX({summary:e,range:t}){const a=Array.isArray(e.dailyTrend)?e.dailyTrend:[];return s.jsx(s.Fragment,{children:OX(e.overview,t,a.length).map(o=>s.jsxs("div",{className:"field",children:[s.jsx("div",{className:"label",children:o.label}),s.jsxs("div",{className:o.mono?"value mono":"value",children:[o.value,o.sub?s.jsx("div",{className:"sub",children:o.sub}):null]})]},o.key))})}function CD({panelId:e,listId:t,labelId:a,title:o,tip:c,rows:d,totalText:f,withBadge:p,emptyText:h}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:o}),s.jsx(fx,{text:c}),s.jsx("span",{className:"panel-sub",id:a,children:f})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"rank-shares",id:t,children:d.length?d.map(b=>s.jsxs("div",{className:"rank-row","data-tip":b.tip,children:[s.jsxs("span",{className:"name",title:b.full,children:[p?s.jsx(WX,{accountId:b.id}):null,b.name]}),s.jsx("span",{className:"track",children:s.jsx("span",{className:"bar",style:{width:b.barWidth}})}),s.jsx("span",{className:"num",title:`${b.tokensText} tokens`,children:b.tokensText}),s.jsx("span",{className:"pct",children:b.percentText})]},b.key)):ec(h)})})]})}function TD({panelId:e,listId:t,title:a,tip:o,ariaLabel:c,view:d,emptyText:f}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:a}),s.jsx(fx,{text:o})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{id:t,children:d?s.jsxs("div",{className:"donut-layout",children:[s.jsxs("div",{className:"donut-wrap",children:[s.jsx("svg",{className:"donut-svg",width:d.size,height:d.size,viewBox:`0 0 ${d.size} ${d.size}`,role:"img","aria-label":c,children:d.slices.map(p=>s.jsxs(x.Fragment,{children:[s.jsx("path",{className:"donut-slice",d:p.d,fill:p.fill,fillRule:p.evenOdd?"evenodd":void 0,tabIndex:-1,"data-tip":p.tip}),p.label?s.jsx("text",{className:"donut-label",x:p.label.x,y:p.label.y,textAnchor:"middle",dominantBaseline:"central",children:p.label.text}):null]},p.key))}),s.jsxs("div",{className:"donut-center",children:[s.jsx("div",{className:"donut-center-value",children:d.totalText}),s.jsx("div",{className:"donut-center-label",children:r("总 Token")})]})]}),s.jsx("div",{className:"donut-legend",children:d.legend.map(p=>s.jsxs("div",{className:"donut-legend-row","data-tip":p.tip,children:[s.jsx("span",{className:"donut-dot",style:{background:p.fill}}),s.jsx("span",{className:"donut-legend-name",title:p.name,children:p.name}),s.jsx("span",{className:"donut-legend-tokens",children:p.tokensText}),s.jsx("span",{className:"donut-legend-percent",children:p.percentText})]},p.key))})]}):ec(f)})})]})}function eQ({view:e}){return s.jsxs("svg",{className:"report-svg",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,role:"img","aria-label":r("近 365 天活跃热力图"),children:[e.months.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:10,children:t.text},t.key)),e.weekdays.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:t.y,textAnchor:"end",dominantBaseline:"middle",children:t.text},t.key)),e.cells.map(t=>s.jsx("rect",{className:`hm-cell l${t.level}`,x:t.x,y:t.y,width:t.size,height:t.size,rx:2,tabIndex:-1,"data-tip":t.tip},t.key))]})}function ED({line:e,cls:t,radius:a}){return s.jsxs(s.Fragment,{children:[s.jsx("polyline",{className:`chart-line ${t}`,points:e.points}),e.dots.map(o=>s.jsx("circle",{className:`chart-dot ${t}`,cx:o.cx,cy:o.cy,r:a},o.key))]})}function C0({items:e,cls:t}){return s.jsx(s.Fragment,{children:e.map(a=>s.jsx("text",{className:`chart-label ${t}`,x:a.x,y:a.y,textAnchor:a.anchor,transform:a.rotate?`rotate(-90 ${a.x} ${a.y})`:void 0,dominantBaseline:a.rotate?"central":void 0,children:a.text},a.key))})}function tQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("近 24 小时缓存命中率与总 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:o,y1:p.y,x2:Pt(o+c),y2:p.y},p.key)),e.rateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenLine?s.jsx(ED,{line:e.tokenLine,cls:"tokens",radius:e.dotR}):null,s.jsx(ED,{line:e.rateLine,cls:"rate",radius:e.dotR}),s.jsx(C0,{items:e.tokenLabels,cls:"tokens"}),s.jsx(C0,{items:e.rateLabels,cls:"rate"}),e.hourTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key))]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}function nQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("按天 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:p.x1,y1:p.y,x2:p.x2,y2:p.y},p.key)),e.valueTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.bars.map(p=>p.nativeTip?s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx,children:s.jsx("title",{children:p.tip})},p.key):s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx},p.key)),s.jsx(C0,{items:e.barLabels,cls:"tokens"}),e.dateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key)),e.blank?s.jsx("text",{className:"chart-empty",x:Pt(o+c/2),y:Pt(d+f/2),textAnchor:"middle",children:r("所选范围内暂无请求")}):null]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}const sQ=680;function T0(){const e=x.useRef(null),[t,a]=x.useState(0);return x.useLayoutEffect(()=>{const o=e.current;if(!o)return;let c=o.clientWidth;if(c&&a(c),typeof ResizeObserver!="function")return;const d=new ResizeObserver(()=>{const f=o.clientWidth;!f||f===c||(c=f,a(f))});return d.observe(o),()=>d.disconnect()},[]),[e,t||sQ]}async function AD(){if(!S0)try{const e=await Wi().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="reportAutoRefresh");E0(t||null),S0=Array.isArray(e?.tasks)}catch(e){console.warn("读取报表自动刷新间隔失败,按默认 1 秒:",e instanceof Error?e.message:e),E0(null)}}function E0(e){S0=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(ux=e.enabled!==!1,cx=e.unit==="minutes"?t*6e4:t*1e3):(ux=!0,cx=kD),Ji?.applyAutoConfig(cx,ux)}const rQ={summary:null,error:null};function aQ(){const[e,t]=x.useState(rQ),[a,o]=x.useState(wX),[c,d]=x.useState(SX),[f,p]=x.useState(()=>({ms:cx,enabled:ux})),[,h]=x.useState(0),b=x.useRef(a),y=x.useRef(c),v=x.useCallback(G=>{t(G)},[]),w=x.useCallback(async(G={})=>{AD();const W=++k0,le=b.current,M=le===v0?y.current:void 0;try{const U=Wi().workbuddyDesktop;if(!U)throw new Error("后端桥不可用");const Z=await U.getStatsSummary(le,M);if(W!==k0)return Po;if(!Z||typeof Z!="object")throw new Error("后端未返回报表数据");return Po=Z,v({summary:Z,error:null}),Po}catch(U){if(W!==k0)return Po;const Z=U instanceof Error?U.message:"";return Po=null,G.silent||console.warn("读取报表数据失败:",Z),v({summary:null,error:Z||r("未知错误")}),null}},[v]),j=x.useCallback(G=>{G!==void 0&&(Po=G||null,G&&v({summary:G,error:null}))},[v]),S=x.useCallback(G=>{const W=sx.includes(G)?G:b0;if(W!==b.current){b.current=W,o(W);try{localStorage.setItem(fD,W)}catch{}w()}},[w]),N=x.useCallback(G=>{const W={...y.current,...G};if(!rx.test(W.start)||!rx.test(W.end))return;const le=W.start<=W.end?W:G.start?{start:W.start,end:W.start}:{start:W.end,end:W.end};y.current=le,d(le),NX(le),b.current===v0&&w()},[w]);x.useEffect(()=>{if(Ji={load:w,render:j,applyAutoConfig:(G,W)=>p({ms:G,enabled:W})},dx){const G=dx;dx=null,j(G.data)}return Wi().wbApp?.currentPage==="overview"&&w({silent:!0}),()=>{Ji=null}},[w,j]),x.useEffect(()=>{if(!f.enabled||f.ms<=0)return;const G=window.setInterval(()=>{document.hidden||Wi().wbApp?.currentPage!=="overview"||N0||(N0=!0,w({silent:!0}).finally(()=>{N0=!1}))},f.ms);return()=>{window.clearInterval(G)}},[f,w]),x.useEffect(()=>{const G=()=>h(W=>W+1);return window.addEventListener("wb-units-changed",G),()=>window.removeEventListener("wb-units-changed",G)},[]);const k=T0(),T=T0(),D=T0(),{summary:C,error:A}=e,R=C&&sx.includes(C.range??"")?C.range:a,I=C&&Array.isArray(C.heatmap)?C.heatmap:[],P=C&&Array.isArray(C.cacheTrend24h)?C.cacheTrend24h:[],O=C&&Array.isArray(C.dailyTrend)?C.dailyTrend:[],_=C&&Array.isArray(C.providers)?C.providers:null,L=C&&Array.isArray(C.accounts)?C.accounts:null,H=C&&Array.isArray(C.models)?C.models:null,B=A?ec(r("读取报表失败:{error}",{error:A}),"empty report-error"):null,z=ec(r("正在加载…")),Q=B??z,K=x.useMemo(()=>jD(H||[]),[H]),X=x.useCallback(G=>K.get(G)||IX,[K]),q=C?BX(I,k[1]):null,$=C?VX(P,T[1],X):null,Y=C?$X(O,D[1],X):null,F=y0(new Date);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("统计概览")}),s.jsx("span",{className:"panel-sub",id:"report-range-label",children:mD[R]||""}),s.jsxs("div",{className:"head-actions",children:[s.jsx(In,{options:qX,value:a,onValueChange:S,"aria-label":r("报表时间范围")}),a===v0?s.jsxs("span",{className:"report-date-range",children:[s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.start,max:c.end||F,"aria-label":r("开始日期"),title:r("起始日期(含当天)"),onChange:G=>N({start:G.target.value})}),s.jsx("span",{className:"report-date-sep","aria-hidden":"true",children:"~"}),s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.end,min:c.start||void 0,max:F,"aria-label":r("结束日期"),title:r("结束日期(含当天)"),onChange:G=>N({end:G.target.value})})]}):null]})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-overview",children:C?s.jsx(JX,{summary:C,range:R}):Q})})]}),s.jsxs("div",{className:"report-rank-grid",children:[L?s.jsx(CD,{panelId:"report-accounts-panel",listId:"report-accounts",labelId:"report-accounts-label",title:r("Top 账号"),tip:GX,rows:yD(L)||[],totalText:wD(L),withBadge:!0,emptyText:r("所选范围内还没有账号用量")}):null,_?s.jsx(CD,{panelId:"report-providers-panel",listId:"report-providers",labelId:"report-providers-label",title:r("Top 提供商"),tip:KX,rows:yD(_)||[],totalText:wD(_),withBadge:!1,emptyText:r("所选范围内还没有请求记录")}):null]}),s.jsxs("div",{className:"report-donut-grid",children:[H?s.jsx(TD,{panelId:"report-models-panel",listId:"report-models-donut",title:r("模型用量"),tip:YX,ariaLabel:r("模型用量占比"),view:SD(H,r("未知模型")),emptyText:r("所选范围内还没有模型用量")}):null,_?s.jsx(TD,{panelId:"report-providers-pie-panel",listId:"report-providers-donut",title:r("提供商用"),tip:XX,ariaLabel:r("提供商用占比"),view:SD(_,r("未知")),emptyText:r("所选范围内还没有提供商用量")}):null]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活跃热力图")}),s.jsx("span",{className:"panel-sub",children:r("近 365 天,按天 Token 用量着色(档位按本窗口峰值自动定)")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"heat-wrap",id:"report-heatmap",ref:k[0],children:C?q?s.jsx(eQ,{view:q}):ec(r("暂无热力图数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsx("span",{className:"heat-scale-label",children:r("Token")}),s.jsx("span",{className:"heat-legend",id:"report-heat-legend",children:C?HX(ND(I)).map(G=>s.jsxs("span",{className:"heat-legend-item",children:[s.jsx("span",{className:`l${G.level}`}),G.text]},G.level)):null}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("方格为本地自然日,无请求显示为空槽")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("缓存命中率")}),s.jsx(fx,{text:QX})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-cache-rates",children:C?UX(C.cacheRates).map(G=>s.jsxs("div",{className:"field rate",children:[s.jsx("div",{className:"label",children:G.label}),s.jsxs("div",{className:"value big",children:[G.value,s.jsx("div",{className:"sub",children:G.sub})]})]},G.key)):Q})})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("近 24 小时缓存命中率趋势")}),s.jsx("span",{className:"panel-sub",children:r("按本地整点,无请求的整点不标注")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap",id:"report-cache-trend",ref:T[0],children:C?$?s.jsx(tQ,{view:$}):ec(r("暂无缓存趋势数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch rate"}),r("缓存命中率"),s.jsx("span",{className:"axis-hint",children:r("左轴")})]}),s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch tokens"}),r("总 Token"),s.jsx("span",{className:"axis-hint",children:r("右轴")})]}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("无请求的整点按 0% 计,但不写读数")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("按天 Token 趋势")}),s.jsx(fx,{text:ZX}),s.jsx("span",{className:"panel-sub",id:"report-trend-label",children:C?`${C.startDate||"—"} ~ ${C.endDate||"—"}`:"—"})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap tall",id:"report-daily-trend",ref:D[0],children:C?Y?s.jsx(nQ,{view:Y}):ec(r("暂无趋势数据")):Q})})]})]})}async function lQ(e={}){return Ji?Ji.load(e):Po}function oQ(e){if(e!==void 0){if(!Ji){dx={data:e??null};return}Ji.render(e)}}function iQ(){return Po}window.wbReport={load:lQ,render:oQ,lastSummary:iQ,applyAutoRefresh:E0};const RD='.page[data-page="overview"]';let OD=!1;function MD(){if(OD)return;const e=document.querySelector(RD);e&&(OD=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(aQ,{})))}document.querySelector(RD)?MD():document.addEventListener("DOMContentLoaded",MD,{once:!0}),AD();const A0={all:{title:r("全部删除"),desc:r("删除日志记录本身。当前有筛选时只删命中的条目,按天聚合报表不受影响;无筛选时清空全部并重置报表。此方式无法恢复。")},raw:{title:r("仅清空报文原文"),desc:r("保留统计行与报表,只抹掉请求 / 响应正文。清理后详情弹窗的「预览对话」将无原文可看,统计数字分毫不动。")}},cQ=["all","raw"],uQ=3e3;function Dl(){return window}let mp=!1;function hp(e,t){Dl().wbApp?.toast?.(e,t)}function dQ(e){const t=Math.max(0,Number(e)||0);if(t<1024)return`${Math.round(t)} B`;const a=t/1024;if(a<1024)return`${a.toFixed(1)} KB`;const o=a/1024;return o<1024?`${o.toFixed(1)} MB`:`${(o/1024).toFixed(2)} GB`}function R0(){const e=Dl().wbRequestsPanel?.clearParams?.();return typeof e=="string"?e:""}function DD(e){return{all:Number(e?.all)||0,raw:Number(e?.raw)||0,dbBytes:Number(e?.dbBytes)||0,vacuumRunning:e?.vacuumRunning===!0}}function O0(e){return e instanceof Error?e.message:String(e)}function ID(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}function fQ({onClose:e}){const[t,a]=x.useState("all"),[o,c]=x.useState({status:"loading"}),[d,f]=x.useState(""),[p,h]=x.useState(!1),[b,y]=x.useState(!1),v=x.useRef(!0),w=x.useRef(null),j=x.useCallback(I=>{mp=I,y(I)},[]),S=x.useCallback(()=>{w.current!==null&&(window.clearInterval(w.current),w.current=null)},[]),N=x.useCallback(I=>{c({status:"ready",all:I.all,raw:I.raw,dbBytes:I.dbBytes}),h(I.vacuumRunning)},[]),k=x.useCallback(async()=>{const I=Dl().workbuddyDesktop;if(!I)return;let P;try{P=await I.getStatsClearPreview(R0())}catch{return}if(!v.current)return;const O=DD(P);N(O),!O.vacuumRunning&&(S(),f(""),hp(r("✅ 压缩完成")),Dl().wbRequestsPanel?.load?.({silent:!0}))},[N,S]),T=x.useCallback(()=>{w.current===null&&(h(!0),w.current=window.setInterval(()=>{k()},uQ))},[k]);async function D(){c({status:"loading"});try{const I=Dl().workbuddyDesktop;if(!I)throw new Error(r("后端桥不可用"));const P=await I.getStatsClearPreview(R0());if(!v.current)return;const O=DD(P);N(O),O.vacuumRunning&&T()}catch(I){if(!v.current)return;c({status:"failed"}),f(r("预览读取失败:{error}",{error:O0(I)}))}}x.useEffect(()=>(v.current=!0,D(),()=>{v.current=!1,S(),mp=!1}),[]);async function C(){const I=Dl().workbuddyDesktop;if(I){h(!0);try{await I.compactStatsDb(),f(r("压缩已在后台开始,完成后会自动提示")),T()}catch(P){const O=O0(P);if(/409|正在进行/.test(O)){hp(r("压缩已在进行中")),f(r("压缩已在进行中,接上它的进度等待完成")),T();return}h(!1),f(r("压缩失败:{message}",{message:O})),hp(r("压缩失败:{message}",{message:O}),"err")}}}async function A(){if(mp)return;const I=Dl().workbuddyDesktop,P=Dl().wbConfirm?.ask;if(!I||!P)return;const O=A0[t].title,_=R0(),L=_.length>0,H=o.status==="ready"?t==="raw"?o.raw:o.all:0;if(await P({title:r("清理请求日志"),html:L?r("确定按当前筛选执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:ID(O),count:H}):r("确定对全部请求日志执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:ID(O),count:H}),okText:r(t==="raw"?"抹掉原文":"删除"),okClass:"danger"})){j(!0);try{const z=L?`mode=${t}&${_}`:`mode=${t}&all=1`,Q=await I.clearStatsRequests(z),K=Number(Q?.deleted)||0;hp(t==="raw"?r("已抹掉 {count} 条报文原文",{count:K}):r("已删除 {count} 条",{count:K})),j(!1),e(),Dl().wbRequestsPanel?.notifyCleared?.()}catch(z){const Q=O0(z);f(r("清理失败:{message}",{message:Q})),hp(r("清理失败:{message}",{message:Q}),"err"),j(!1)}}}const R=o.status==="ready"?r("将删除 {count} 条日志 · 其中 {raw} 条仍带报文原文 · 数据库占用 {db}",{count:o.all,raw:o.raw,db:dQ(o.dbBytes)}):o.status==="failed"?r("预览读取失败"):r("正在统计…");return s.jsx(Qt,{open:!0,onOpenChange:(I,P)=>{if(!I){if(mp){P.cancel();return}e()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("清理请求日志")})}),s.jsxs(Bt,{children:[s.jsx(Eh,{"aria-label":r("清理方式"),value:t,onValueChange:I=>a(I==="raw"?"raw":"all"),children:cQ.map(I=>{const P=t===I;return s.jsxs("label",{"data-checked":P?"":void 0,className:"group/card grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2.5 gap-y-0.5 rounded-md border border-border px-3 py-2.5 transition-colors duration-150 ease-out hover:border-border-strong data-checked:border-primary data-checked:bg-primary-soft",children:[s.jsx(bo,{value:I,className:"row-span-2 self-center"}),s.jsx("span",{className:"text-[13px] font-semibold text-foreground group-data-checked/card:text-primary-fg",children:A0[I].title}),s.jsx("span",{className:"text-[11.5px] leading-[1.55] text-subtle",children:A0[I].desc})]},I)})}),s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:R})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:d}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{C()},disabled:p,title:r(p?"压缩正在后台执行,完成后自动恢复":"回收已删除数据占用的磁盘空间(checkpoint + VACUUM,后台执行)"),children:r(p?"压缩中…":"压缩数据库")}),s.jsx(se,{variant:"outline",onClick:e,disabled:b,children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>{A()},disabled:b,children:r(b?"清理中…":"执行清理")})]})]})})}let gp=null,Fu=null;function PD(){gp&&(gp.unmount(),gp=null),Fu&&(Fu.remove(),Fu=null)}function pQ(){mp||PD()}function mQ(){PD(),Fu=document.createElement("div"),document.body.append(Fu),gp=vn.createRoot(Fu),gp.render(s.jsx(fQ,{onClose:pQ}))}window.wbRequestClearModal={open:mQ};const _D=[{value:"detail",label:r("请求详情")},{value:"preview",label:r("预览对话")},{value:"raw",label:r("原始报文")}],hQ="detail",LD="border-b border-hairline px-2.5 py-[7px] align-top",_o="border border-hairline px-2 py-1 align-top",gQ="border border-hairline bg-surface-2 px-2 py-1 text-[11.5px] tracking-normal",px="hover:[&>td]:bg-transparent";function $u(){return window}function M0(){const e=$u().workbuddyDesktop;if(!e)throw new Error(r("后端桥不可用"));return e}let D0=0;function xQ(e){if(!e)return"—";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`}function zD(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}function bQ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":zD(t)}const vQ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计");function yQ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=500&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function mx(e){return $u().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function wQ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function jQ(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function hx(e){return(Number(e?.status)||0)===0&&!e?.error}function BD(e){const t=String(e.provider??"").trim();return String(e.providerLabel??"").trim()||(t?$u().wbProviders?.labelOf?.(t)||t:"")}function xp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I0(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return""}}function P0(e){return e instanceof Error?e.message:String(e)}const HD=[{label:r("请求头"),pick:e=>I0(e.requestHeaders)},{label:r("请求体"),pick:e=>I0(e.requestBody)},{label:r("响应头"),pick:e=>I0(e.responseHeaders)},{label:r("响应体"),pick:e=>e.responseBody?String(e.responseBody):""}];function gx({text:e,loading:t=!1}){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-center text-[12.5px] text-muted-foreground",children:[t?s.jsx(ef,{className:"size-3.5"}):null,e]})}function ua({label:e,children:t}){return s.jsxs(kl,{className:px,children:[s.jsx("th",{scope:"row",className:`w-[76px] whitespace-nowrap text-left text-[12.5px] font-semibold text-muted-foreground ${LD}`,children:e}),s.jsx(Nn,{className:LD,children:t})]})}function SQ({row:e}){if(hx(e)){const c=$u().wbRequestPhase;if(!c?.badgeHtml)return s.jsxs(ze,{variant:"info",shape:"tag",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot"}),r("进行中")]});const d=c.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:c.badgeHtml(e)}}),d?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",dangerouslySetInnerHTML:{__html:d}}):null]})}const t=Number(e.status)||0,a=jQ(e),o=!a&&t>=200&&t<300?r("HTTP {status},但响应体阶段出错",{status:t}):"";return s.jsx(ze,{variant:a?"success":"destructive",shape:"tag",title:o||void 0,children:t||r("失败")})}function NQ({row:e}){const t=String(e.clientModel??"").trim(),a=String(e.upstreamModel??"").trim(),o=String(e.model??"").trim(),c=String(e.clientReasoning??"").trim(),d=String(e.upstreamReasoning??"").trim(),f=(b,y)=>y?`${b}(${y})`:b;if(!t||!a||a.toLowerCase()===t.toLowerCase())return s.jsx(s.Fragment,{children:f(o,d||c)||"—"});const p=f(a,d),h=f(t,c);return s.jsxs("span",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{title:r("转发到上游的模型:{model}",{model:p}),children:["⬆️ ",p]}),s.jsxs("span",{className:"text-muted-foreground",title:r("下游请求的模型:{model}",{model:h}),children:["⬇️ ",h]})]})}function kQ(e){const t=Number(e?.status),a=e?.status!==null&&e?.status!==void 0&&Number.isFinite(t),o=e?.error?String(e.error):"";if(o){const c=a?r("失败({status}):{error}",{status:String(t),error:o}):r("失败:{error}",{error:o});return s.jsx("span",{className:"break-words text-destructive",children:c})}return a?s.jsx("span",{className:"text-success",children:r("成功({status})",{status:String(t)})}):s.jsx("span",{className:"text-muted-foreground",children:r("无结果记录")})}function CQ({row:e}){const t=Array.isArray(e.attemptDetails)?e.attemptDetails:[];if(!t.length)return s.jsx(s.Fragment,{children:"-"});const a=Number(e.attempts)||1;return s.jsxs(Ky,{className:"text-[11.5px]",children:[s.jsx(yE,{children:s.jsx(kl,{className:px,children:[r("轮次"),r("提供商"),r("账号"),r("结果"),r("体积"),r("内部重试"),r("提示")].map(o=>s.jsx(wE,{className:gQ,children:o},o))})}),s.jsxs(Yy,{children:[t.map((o,c)=>{const d=Array.isArray(o?.retries)?o.retries:[],f=d.map(v=>{const w=Number(v?.delayMs),j=Number.isFinite(w)&&w>0?w>=1e3?r(",{n}秒后重试",{n:Math.round(w/1e3)}):r(",{n}毫秒后重试",{n:Math.round(w)}):"";return`${String(v?.reason||r("未知原因"))}${j}`}).join(` +`),p=String(o?.notice??"").trim(),h=Number(o?.bodyBytes),b=Number.isFinite(h)&&h>0?h>=1024*1024?`${(h/1024/1024).toFixed(1)} MB`:h>=1024?`${Math.round(h/1024)} KB`:`${h} B`:"—",y=Number.isFinite(h)&&h>0?r("实际发给上游 {bytes} 字节",{bytes:h.toLocaleString()}):void 0;return s.jsxs(kl,{className:px,children:[s.jsx(Nn,{className:_o,children:c+1}),s.jsx(Nn,{className:_o,children:BD(o)||(o?.provider?String(o.provider):r("未知"))}),s.jsx(Nn,{className:_o,children:o?.account?String(o.account):"—"}),s.jsx(Nn,{className:_o,children:kQ(o)}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:y,children:b}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:f||void 0,children:d.length?r("↻ {n} 次",{n:d.length}):"-"}),s.jsx(Nn,{className:_o,children:p||"—"})]},c)}),t.lengths.jsxs("li",{className:"py-0.5",children:[s.jsxs("b",{children:[y+1,". ",String(b.name||b.id||"—")]}),s.jsxs("span",{className:"text-muted-foreground",children:[" ",String(b.reason||"")]})]},String(b.id??y)))}):null,p.length?s.jsxs("div",{className:"mt-1 text-muted-foreground",children:[r("被跳过:"),p.map(b=>String(b.name||b.id||"")).join("、")]}):null,h?s.jsx("div",{className:"mt-1",children:r("最终承载:{picked}",{picked:h})}):null]})}function EQ({row:e}){if(!e)return s.jsx(gx,{text:r("列表数据已刷新,请重试(关闭后重新打开这条详情)")});const t=String(e.accountName??"").trim(),a=yQ(e);return s.jsx(Ky,{className:"text-[12.5px] text-subtle [&_tr:last-child>td]:border-b-0 [&_tr:last-child>th]:border-b-0",children:s.jsxs(Yy,{children:[s.jsx(ua,{label:r("时间"),children:xQ(e.ts)}),s.jsx(ua,{label:r("状态"),children:s.jsx(SQ,{row:e})}),s.jsx(ua,{label:r("耗时"),children:hx(e)?s.jsxs(s.Fragment,{children:[wQ(e.ts),s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(请求仍在转发中)")})]}):r("{duration} / 首帧 {first}",{duration:zD(e.durationMs),first:bQ(e.firstResponseMs)})}),s.jsx(ua,{label:r("重试次数"),children:String(Number(e.attempts)||1)}),s.jsx(ua,{label:r("模型"),children:s.jsx(NQ,{row:e})}),s.jsxs(ua,{label:r("提供商"),children:[BD(e)||"—",t?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(账号:{account})",{account:t})}):null]}),s.jsxs(ua,{label:r("令牌"),children:[r("输入 {input} · 输出 {output} · 总计 {total} · 缓存读 {cache}",{input:mx(e.promptTokens),output:mx(e.completionTokens),total:mx(e.totalTokens),cache:mx(e.cacheReadTokens)}),a?s.jsxs("span",{title:vQ,children:[" · ",a]}):null]}),e.isTest?s.jsx(ua,{label:r("来源"),children:s.jsx(ze,{variant:"brand",shape:"tag",title:r("模型管理页操作列那颗「测试」发起的请求:与真实请求同一条转发链路,但不计入报表统计"),children:r("模型测试")})}):null,s.jsx(ua,{label:r("错误"),children:e.error?s.jsx("span",{className:"text-destructive",children:String(e.error)}):"—"}),s.jsx(ua,{label:r("尝试明细"),children:s.jsx(CQ,{row:e})}),e.route?s.jsx(ua,{label:r("路由回放"),children:s.jsx(TQ,{row:e})}):null,s.jsx(ua,{label:r("敏感词"),children:Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length?s.jsx("span",{className:"inline-flex flex-wrap gap-1.5",children:e.sensitiveHits.map((o,c)=>s.jsxs(ze,{variant:"sensitive",shape:"tag",children:[String(o?.word??"")," × ",String(Number(o?.count)||0)]},c))}):"—"})]})})}function AQ({state:e}){if(!e)return s.jsx(gx,{text:r("正在读取…"),loading:!0});const t=e==="gone"?null:e.body,a=t&&$u().wbConversationPreview?.render?.(t.requestBody,t.responseBody)||"";return a?s.jsxs("div",{children:[e!=="gone"&&e.truncated?s.jsx("div",{className:"mb-2 text-[11.5px] text-warning",children:r("正文超过单条上限,可能已被截断")}):null,s.jsx("div",{dangerouslySetInnerHTML:{__html:a}})]}):s.jsx(gx,{text:r("无报文原文(未开启「调试模式」,或已被清理)")})}function RQ({data:e}){const t=e.status===null||e.status===void 0?"-":String(e.status),a=[e.url?`URL: ${e.url}`:"",e.provider?r("提供商: {provider}",{provider:String(e.provider)}):"",r("上游状态码: {status}",{status:t})].filter(Boolean);return s.jsxs("div",{className:"flex flex-col gap-4",children:[a.length?s.jsx("div",{className:"border-b border-hairline pb-2.5 text-xs leading-[1.7] break-all text-subtle",children:a.map((o,c)=>s.jsx("div",{children:o},c))}):null,HD.map(o=>{const c=o.pick(e)||"";return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("h3",{className:"text-[11.5px] font-semibold tracking-[.02em] text-muted-foreground",children:o.label}),c?s.jsx("pre",{className:"max-h-80 overflow-auto rounded-md border border-border bg-surface-2 p-[10px_12px] font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-subtle",children:c}):s.jsx(gx,{text:r("这条请求没有保存这一段报文")})]},o.label)})]})}function OQ({id:e,row:t,token:a,onClose:o}){const[c,d]=x.useState(hQ),[f,p]=x.useState(null),[h,b]=x.useState(null),[y,v]=x.useState("—"),[w,j]=x.useState("idle"),S=x.useRef(!0),N=x.useRef(null),k=x.useRef({detail:0,preview:0,raw:0}),T=x.useCallback(()=>!S.current||a!==D0,[a]);async function D(){try{const O=await M0().getStatsRequestRaw(e);if(T())return;const _=xp(O)?O:null,L=String(_?.requestBody??"").trim()!==""||String(_?.responseBody??"").trim()!=="";p(_&&L?{body:_,truncated:!!_.truncated}:"gone")}catch(O){if(T())return;p("gone"),console.warn("读取原始正文失败(预览对话显示空态):",P0(O))}}async function C(){try{const O=await M0().getDebugTraffic(e);if(T())return;const _=xp(O)?O:{};if(!HD.some(L=>(L.pick(_)||"").trim())){b("gone");return}b({data:_}),v(_.truncated?r("报文超过单条上限,请求体 / 响应体已按上限截断"):r("内容按原样保存,请求头中的凭据字段已替换为 [redacted]"))}catch(O){if(T())return;b("gone"),v(r("在设置 → 通用里开启「调试模式」后,新发生的请求才会保存报文")),console.warn("读取调试报文失败(原始报文标签隐藏):",P0(O))}}x.useEffect(()=>(S.current=!0,D(),C(),()=>{S.current=!1}),[]),x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollTop=k.current[c])},[c]);function A(O){if(O==="raw"&&!xp(h)||O===c)return;const _=N.current;_&&(k.current[c]=_.scrollTop),d(O)}async function R(){if(!e||!hx(t))return;const O=$u().wbConfirm?.ask;if(!(!O||!await O({title:r("终止请求"),html:r("确定终止这条正在转发的请求?
    上游连接会立即断开,明细将记为「请求已被手动终止」。"),okText:r("终止"),okClass:"danger"}))){j("pending");try{if(await M0().terminateStatsRequest(e),!S.current)return;j("accepted"),v(r("已受理终止:上游连接已断开,列表稍后刷新为「请求已被手动终止」"))}catch(L){if(!S.current)return;j("idle"),v(r("终止失败:{error}",{error:P0(L)}))}}}const I=xp(h),P=x.useMemo(()=>I?_D:_D.filter(O=>O.value!=="raw"),[I]);return s.jsx(Qt,{open:!0,onOpenChange:O=>{O||o()},children:s.jsxs(Zt,{className:"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("请求详情")})}),s.jsxs(Bt,{ref:N,className:"gap-3",children:[s.jsx(In,{options:P,value:c,onValueChange:A,"aria-label":r("详情内容"),className:"self-start"}),s.jsx("section",{hidden:c!=="detail",children:s.jsx(EQ,{row:t})}),s.jsx("section",{hidden:c!=="preview",children:s.jsx(AQ,{state:f})}),I?s.jsx("section",{hidden:c!=="raw",children:s.jsx(RQ,{data:h.data})}):null]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:y}),s.jsx("div",{className:"mr-auto"}),hx(t)?s.jsx(se,{variant:"destructive",disabled:w!=="idle",onClick:()=>{R()},title:r("断开上游连接,明细记为「请求已被手动终止」"),children:r("终止请求")}):null,s.jsx(se,{variant:"outline",onClick:o,children:r("关闭")})]})]})})}let bp=null,qu=null;function UD(){bp&&(bp.unmount(),bp=null),qu&&(qu.remove(),qu=null)}function VD(){D0+=1,UD()}function MQ(e,t){const a=String(e??"").trim();if(!a)return;UD();const o=++D0;qu=document.createElement("div"),document.body.append(qu),bp=vn.createRoot(qu),bp.render(s.jsx(OQ,{id:a,row:xp(t)?t:null,token:o,onClose:VD}))}window.wbRequestDetail={open:MQ,close:VD};const DQ=150,IQ=80,tc=8,xx=8,PQ=520,_Q=220,LQ=1.1,zQ=900,_0=12,L0="req-hover-panel",BQ=["fixed z-[35] pointer-events-none","max-h-[min(360px,60vh)] overflow-x-hidden overflow-y-auto","rounded-md p-[10px_12px] text-[12px] leading-[1.6] break-normal","bg-surface-2 text-foreground shadow-3","border-0 dark:border dark:border-border-strong dark:bg-surface-3"].join(" "),vp="rh-row rh-dim min-w-0 break-words text-muted-foreground",HQ="rh-row min-w-0 break-words";function UQ(){return window}function z0(e){return typeof e=="object"&&e!==null?e:null}const FD=e=>Array.isArray(e?.attemptDetails)?e.attemptDetails:[],$D=e=>Array.isArray(e?.retries)?e.retries:[],VQ=e=>Array.isArray(e?.sensitiveHits)?e.sensitiveHits:[];function B0(e){const t=String(e??"").trim();return t?UQ().wbProviders?.labelOf?.(t)||t:""}function FQ(e){const t=z0(e);return(Number(t?.attempts)||1)>1?!0:FD(t).some(a=>$D(a).length>0||!!a?.notice)}function qD(e){return e.dataset.reqHover==="sensitive"?"sensitive":"chain"}function $Q({details:e}){if(e.length<2)return null;const t=e.map(a=>B0(a.provider)||r("未知"));return s.jsxs("div",{className:"rh-chain mb-1.5 border-b border-border pb-1.5 break-words",children:[s.jsx("span",{className:"rh-chain-k font-semibold text-muted-foreground",children:r("切换路径:")}),s.jsx("span",{className:"rh-chain-v font-semibold text-foreground",children:t.join(" → ")})]})}function qQ({item:e}){const t=$D(e);return t.length?s.jsxs("div",{className:"rh-retry mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2",children:[s.jsx("div",{className:"rh-retry-head text-[11.5px] font-semibold text-warning",children:r("↻ 重试 {n} 次",{n:t.length})}),t.map((a,o)=>{const c=String(a?.reason??"").trim(),d=Number(a?.status),f=a?.status!==null&&a?.status!==void 0&&Number.isFinite(d),p=Number(a?.delayMs),h=Number.isFinite(p)&&p>0?p>=1e3?r(",{n}秒后重试",{n:Math.round(p/1e3)}):r(",{n}毫秒后重试",{n:Math.round(p)}):"";return s.jsxs("div",{className:"rh-retry-row min-w-0 break-words",children:[s.jsx("span",{className:"rh-retry-why mr-1 text-subtle [overflow-wrap:anywhere]",children:c||r("未知原因")}),f?s.jsx("span",{className:"rh-retry-status mr-1 text-muted-foreground tabular-nums whitespace-nowrap",children:`HTTP ${String(d)}`}):null,h?s.jsx("span",{className:"rh-dim text-muted-foreground",children:h}):null]},o)})]}):null}function GQ({item:e,index:t,inFlight:a}){const o=B0(e.provider),c=String(e.account??"").trim(),d=Number(e.status),f=e.status!==null&&e.status!==void 0&&Number.isFinite(d),p=e.error?String(e.error):"",h=String(e.notice??"").trim();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:HQ,children:[s.jsx("span",{className:"rh-no mr-1 text-muted-foreground",children:r("尝试 {n} ·",{n:t+1})}),s.jsx("span",{className:"rh-who mr-1 font-semibold text-foreground",children:o||r("未知")}),c?s.jsx("span",{className:"rh-account mr-1 text-muted-foreground [overflow-wrap:anywhere]",children:c}):null,s.jsx("span",{className:"rh-arrow mr-1 text-muted-foreground",children:"→"}),p?s.jsx("span",{className:"rh-bad font-medium text-destructive [overflow-wrap:anywhere]",children:f?r("失败({status}):{error}",{status:String(d),error:p}):r("失败:{error}",{error:p})}):f?s.jsx("span",{className:"rh-ok font-medium text-success",children:r("成功({status})",{status:String(d)})}):a?s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("进行中…")}):s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("无结果记录")})]}),h?s.jsx("div",{className:"rh-notice mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2 text-warning [overflow-wrap:anywhere]",children:`⚠️ ${h}`}):null,s.jsx(qQ,{item:e})]})}function KQ({entry:e}){const t=Number(e.attempts)||1,a=FD(e);if(!a.length){const c=B0(e.provider),d=c?r("共 {n} 次尝试,最终由 {provider} 承载",{n:t,provider:c}):r("共 {n} 次尝试",{n:t});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:vp,children:d}),s.jsx("div",{className:vp,children:r("这条记录的尝试明细未采集(该字段上线前的旧数据,或请求在转发前就失败)")})]})}const o=(Number(e.status)||0)===0&&!e.error;return s.jsxs(s.Fragment,{children:[s.jsx($Q,{details:a}),a.map((c,d)=>s.jsx(GQ,{item:c,index:d,inFlight:o&&d===a.length-1},d)),a.lengths.jsxs("div",{className:"rh-row rh-hit flex items-baseline justify-between gap-2.5",children:[s.jsx("span",{className:"rh-hit-w break-words text-foreground",children:String(a?.word??"")}),s.jsx("span",{className:"rh-hit-c text-muted-foreground tabular-nums whitespace-nowrap",children:`× ${String(Number(a?.count)||0)}`})]},o)),t.length>_0?s.jsx("div",{className:vp,children:r("另有 {n} 个词命中",{n:t.length-_0})}):null]}):s.jsx("div",{className:vp,children:r("这条记录命中了敏感词,但没有留下命中明细")})}function XQ({kind:e,entry:t,panelRef:a}){return s.jsx("div",{ref:a,id:L0,role:"tooltip","data-kind":e,className:BQ,children:e==="sensitive"?s.jsx(YQ,{entry:t}):s.jsx(KQ,{entry:t})})}let Tn=null,Lo=0,yp=0,wp=null,bx=null,H0=null,U0=null,nc=null,sc=null,jp=null,GD="chain";function V0(){window.clearTimeout(Lo),window.clearTimeout(yp),Lo=0,yp=0,wp=null}function QQ(){const e=jp?.current,t=Tn;if(!e||!t)return;const a=t.getBoundingClientRect(),o=window.innerWidth-tc*2;e.style.maxWidth="none",e.style.width="max-content";const c=e.offsetWidth,d=GD==="sensitive",p=Math.max(d?_Q:PQ,c)*(d?LQ:1),h=Math.min(p,o,zQ);e.style.maxWidth=`${h}px`,e.style.width=d?`${h}px`:"auto";const b=e.offsetWidth,y=e.offsetHeight,v=window.innerHeight-a.bottom-xx-tc,w=a.top-xx-tc,j=vv,S=a.left+a.width/2,N=Math.max(tc,Math.min(S-b/2,window.innerWidth-tc-b)),k=j?a.top-xx-y:a.bottom+xx;e.style.left=`${Math.round(N)}px`,e.style.top=`${Math.round(Math.max(tc,Math.min(k,window.innerHeight-tc-y)))}px`}function KD(e){if(!Tn)return;const t=e.target;t instanceof Node&&(t===Tn||Tn.contains(t)||Oa())}function YD(){Oa()}function XD(){Oa()}let vx=!1;function ZQ(){vx||(vx=!0,document.addEventListener("click",KD,!0),window.addEventListener("scroll",YD,!0),window.addEventListener("resize",XD))}function WQ(){vx&&(vx=!1,document.removeEventListener("click",KD,!0),window.removeEventListener("scroll",YD,!0),window.removeEventListener("resize",XD))}function JQ(){WQ(),sc&&(sc.unmount(),sc=null),nc&&(nc.remove(),nc=null),jp=null}function QD(e,t){GD=e,(!nc||!sc||!jp)&&(nc=document.createElement("div"),document.body.append(nc),jp=x.createRef(),sc=vn.createRoot(nc));const a=sc,o=jp;Cs.flushSync(()=>{a.render(s.jsx(XQ,{kind:e,entry:t,panelRef:o}))}),ZQ(),QQ()}function ZD(e){if(!e.isConnected)return;const t=z0(H0?.(e));t&&(V0(),Tn&&Tn!==e&&Oa(),Tn=e,QD(qD(e),t),e.classList.add("active"),e.setAttribute("aria-describedby",L0))}function Oa(){V0(),Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=null),JQ()}function eZ(){if(!Tn)return;const e=String(Tn.dataset.reqHover||""),t=String(Tn.dataset.reqId||"");U0=!!(e&&t)&&Tn.matches(":hover")&&!yp?{action:"move",kind:e,key:t}:{action:"close"}}function tZ(){const e=U0;if(U0=null,!e||!Tn)return;if(e.action==="close"){Oa();return}const t=bx?nZ(bx,e.kind,e.key):null,a=t?z0(H0?.(t)):null;if(!t||!a){Oa();return}t!==Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=t,QD(qD(t),a),t.classList.add("active"),t.setAttribute("aria-describedby",L0))}function nZ(e,t,a){for(const o of e.querySelectorAll("[data-req-hover]"))if(String(o.dataset.reqHover||"")===t&&String(o.dataset.reqId||"")===a)return o;return null}function yx(e){const t=e.target;return t instanceof Element?t.closest("[data-req-hover]"):null}function sZ(e){const t=yx(e);if(!t||!bx?.contains(t)||(V0(),Tn===t&&sc))return;const a=Tn?0:DQ;Tn&&Oa(),wp=t,Lo=window.setTimeout(()=>{Lo=0,wp=null,ZD(t)},a)}function rZ(e){const t=yx(e);if(t){if(wp===t){window.clearTimeout(Lo),Lo=0,wp=null;return}Tn===t&&(window.clearTimeout(Lo),Lo=0,yp=window.setTimeout(()=>{yp=0,Tn===t&&Oa()},IQ))}}function aZ(e){const t=yx(e);t&&ZD(t)}function lZ(e){const t=yx(e);t&&Tn===t&&Oa()}function oZ(e){e.key!=="Escape"||!Tn||Oa()}function iZ(e){const t=e?.host;t&&(bx=t,H0=e?.entryOf??null,t.addEventListener("pointerover",sZ),t.addEventListener("pointerout",rZ),t.addEventListener("focusin",aZ),t.addEventListener("focusout",lZ),t.addEventListener("keydown",oZ))}window.wbRequestHover={bind:iZ,close:Oa,hasProcessFacts:FQ,beforeListRedraw:eZ,afterListRedraw:tZ};function Ts(){return window}function F0(e){return e instanceof Error?e.message:String(e)}function wx(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const jx={connecting:{label:r("连接中"),cls:"phase-connecting"},waiting:{label:r("等待响应"),cls:"phase-waiting"},streaming:{label:r("响应中"),cls:"phase-streaming"},retrying:{label:r("重试中"),cls:"phase-retrying"},queued:{label:r("排队中"),cls:"phase-queued"}},WD=r("进行中"),cZ="running",JD={connecting:r("请求已受理,正在选路、取凭证、建立上游连接"),waiting:r("上游请求已发出,正在等第一个字节到达(模型的思考时间也在这段)"),streaming:r("首帧已到,上游内容正在下发"),retrying:r("本轮尝试失败,正在退避等待或切换到下一个账号"),queued:r("上游模型繁忙,请求已排进上游队列;网关正按上游建议的时长等待后重发(不是登录态或额度问题)"),"":r("请求正在转发中,用时列显示的是已用时")};function $0(e){const t=String(e?.phase??"").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(jx,t)?t:""}function eI(e){const t=$0(e);return t?jx[t].label:WD}function tI(e){if(e==null||e==="")return"";const t=Number(e);if(!Number.isFinite(t)||t<0)return"";const a=Math.max(1,Math.floor(t/1e3));return a<60?r("{n}秒",{n:a}):r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60})}function uZ(e){const t=e?.phaseElapsedMs;if(t!=null&&t!==""){const c=Number(t);if(Number.isFinite(c)&&c>=0)return c}const a=Number(e?.phaseStartedAt);if(!Number.isFinite(a)||a<=0)return null;const o=Date.now()-a;return Number.isFinite(o)?Math.max(0,o):null}function dZ(e){const t=$0(e),a=t?jx[t].label:WD,o=t?jx[t].cls:cZ,c=JD[t]||JD[""];return`${wx(a)}`}function fZ(e){const t=tI(uZ(e));if(!t)return"";const a=eI(e),o=r("进入「{phase}」阶段已持续 {time}",{phase:a,time:t});return`${wx(t)}`}const q0=[{key:"time",label:r("时间"),sel:".req-time",track:"92px"},{key:"target",label:r("提供商 / 账号"),sel:".req-target",track:"minmax(0, 1.1fr)"},{key:"retry",label:r("重试"),sel:".req-retry",track:"52px"},{key:"status",label:r("状态"),sel:".req-status",track:"96px"},{key:"model",label:r("模型"),sel:".req-model",track:"minmax(0, 1.3fr)"},{key:"client",label:r("客户端"),sel:".req-client",track:"110px"},{key:"dur",label:r("用时"),sel:".req-dur",track:"96px",align:"right"},{key:"usage",label:r("用量"),sel:".req-usage",track:"minmax(0, 1.6fr)"},{key:"error",label:r("错误"),sel:".req-error-cell",track:"minmax(0, 1.2fr)"},{key:"detail",label:r("详情"),sel:".req-detail",track:"60px",align:"right"}],nI=1e3,pZ=rg;function sI(e){return typeof e=="number"&&e>0?e:du}const rI="workbuddy-desktop-logs-requests-range",aI="workbuddy-desktop-requests-filters",mZ=3e4,G0=["today","7","30","month","all"],K0="all",hZ={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部")},gZ={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},xZ=G0.map(e=>({value:e,label:gZ[e]})),lI=[{value:"",label:r("全部状态")},{value:"ok",label:r("成功")},{value:"error",label:r("失败")}],bZ=r("全部状态"),oI=r("全部提供商"),iI=r("全部模型"),Sx={status:"",provider:"",model:""};function Nx(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function vZ(e){const t=new Date;switch(e){case"today":return Nx(t);case"7":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Nx(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}const en={filters:{...Sx},range:yZ(),runningOnly:!1,offset:0,size:sI(lg("requests",rg))};let kx={...Sx},Y0=!1,cI=!1,X0=[],Cx=nI,Tx=!0,Q0=!1,Z0=!1,uI=0,W0=0,J0=null,dI=!1,Gu=null;function yZ(){try{const e=localStorage.getItem(rI);return e!==null&&G0.includes(e)?e:K0}catch{return K0}}function wZ(e){try{localStorage.setItem(rI,e)}catch{}}function fI(){const e=Ts().wbFilterMemory;return e?(Y0=!0,kx=e.load(aI,{...Sx}),en.filters={...kx},{...kx}):{...Sx}}function jZ(e){kx={...e},Ts().wbFilterMemory?.save(aI,{status:e.status||"",provider:e.provider||"",model:e.model||""})}function pI(){const e=new URLSearchParams,t=vZ(en.range);t!==null&&e.set("start",String(t));const a=en.runningOnly?"running":en.filters.status;return a&&e.set("status",a),en.filters.provider&&e.set("provider",en.filters.provider),en.filters.model&&e.set("model",en.filters.model),e}function SZ(){const e=pI();return e.set("offset",String(en.offset)),e.set("limit",String(en.size)),e.toString()}function eS(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}const NZ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计"),kZ=500;function CZ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=kZ&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function TZ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":eS(t)}function Ex(e){return Ts().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function EZ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function AZ(e){const t=Number(e.promptTokens)||0;return t<=0?"-":`${((Number(e.cacheReadTokens)||0)/t*100).toFixed(2)}%`}function tS(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function Sp(e){return(Number(e?.status)||0)===0&&!e?.error}const mI=e=>String(e?.id||e?.ts||"");function RZ(e){return(Array.isArray(e?.attemptDetails)?e.attemptDetails:[]).reduce((a,o)=>{const c=o?.retries;return a+(Array.isArray(c)?c.length:0)},0)}function hI(e){return Ts().wbProviders?.labelOf?.(e)||e}function OZ(e){const t=new Set;return e.map((a,o)=>{const c=mI(a)||`i${o}`;let d=c,f=1;for(;t.has(d);)d=`${c}#${f++}`;return t.add(d),d})}async function gI(){if(!(Date.now()-W0({value:String(o?.id||""),label:String(o?.label||o?.id||"")})).filter(o=>o.value),a=(Array.isArray(e?.models)?e.models:[]).map(o=>String(o||"")).filter(Boolean);Gu?.setFilterOptions(t,a)}catch(e){console.warn("读取请求日志筛选清单失败,筛选项退化为「全部」:",F0(e))}}}async function MZ(){if(!Q0)try{const e=await Ts().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="requestsAutoRefresh");nS(t||null),Q0=Array.isArray(e?.tasks)}catch(e){console.warn("读取请求日志自动刷新间隔失败,按默认 1 秒:",F0(e)),nS(null)}}function nS(e){Q0=!0;const t=Number(e?.interval),a=e?.unit;!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(a==="seconds"||a==="minutes")?(Tx=e.enabled!==!1,Cx=a==="minutes"?t*6e4:t*1e3):(Tx=!0,Cx=nI),Gu?.setAuto({ms:Cx,enabled:Tx})}function DZ(){if(dI)return;const e=Ts().wbColSettings;e&&(dI=!0,J0=e.register({id:"requests",label:r("请求日志表"),columns:q0.map(({key:t,label:a,align:o})=>({key:t,label:a,align:o})),mount:()=>document.querySelector('.page[data-page="requests"] .panel-head .head-actions'),onChange:()=>{Cs.flushSync(()=>Gu?.repaint()),Ts().wbTableColumns?.repaint?.("requests")}}))}function sS(){return(J0?J0.apply(q0):q0).map(t=>({...t,align:t.align||"left"}))}const IZ={entries:[],total:0,matched:0,running:0,loaded:!1,error:""};function PZ(e){return e.loaded?e.total?r("没有符合筛选条件的请求"):r("暂无请求日志,网关还没有转发过请求"):r("正在加载请求日志…")}function _Z(e){const t=Number(e.firstResponseMs);return!Number.isFinite(t)||t<=0?null:s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时(请求仍在转发中)"),children:r("首响 {time}",{time:eS(t)})})}function LZ(e,t){const{align:a,key:o}=t,c=t.sel.slice(1)+(o==="dur"?" req-num":""),d=`${c} ta-${a}`;switch(o){case"time":{if(!e.ts)return s.jsx("span",{className:d,children:"—"},o);const f=new Date(e.ts),p=h=>String(h).padStart(2,"0");return s.jsxs("span",{className:d,children:[s.jsx("span",{children:`${f.getFullYear()}-${p(f.getMonth()+1)}-${p(f.getDate())}`}),s.jsx("span",{children:`${p(f.getHours())}:${p(f.getMinutes())}:${p(f.getSeconds())}`})]},o)}case"target":{const f=String(e.provider??"").trim(),h=String(e.providerLabel??"").trim()||(f?hI(f):"");return s.jsxs("span",{className:d,children:[h?s.jsx("span",{className:"req-provider",title:f&&f!==h?r("{name}({id})",{name:h,id:f}):h,children:h}):s.jsx("span",{className:"req-provider is-empty",title:r("这条明细没有记录提供商(旧数据或请求未走到转发)"),children:"—"}),e.accountName?s.jsx("span",{className:"req-acct",title:e.accountId||e.accountName,children:e.accountName}):s.jsx("span",{className:"req-acct is-empty",title:r("请求在任何账号接手之前就失败了"),children:"—"})]},o)}case"retry":{const f=Number(e.attempts)||1,p=mI(e),h=[];if(e.isTest&&h.push(s.jsx(ze,{variant:"brand",shape:"tag",title:r("这条明细是一次模型测试(人工发起):走的是真实转发链路,但不计入报表统计"),children:r("测试")},"test")),Ts().wbRequestHover?.hasProcessFacts?.(e)??f>1){const y=f>1?f:RZ(e);h.push(s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"chain","data-req-id":p,children:y>1?r("重试 {n}",{n:y}):r("重试")},"chain"))}return Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length&&h.push(s.jsx(ze,{variant:"sensitive",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"sensitive","data-req-id":p,"aria-label":r("命中了敏感词"),children:r("敏")},"sensitive")),h.length?s.jsx("span",{className:d,children:h},o):s.jsx("span",{className:`req-none ta-${a}`,children:"-"},o)}case"status":{if(Sp(e)){const b=window.wbRequestPhase;if(!b?.badgeHtml)return s.jsx("span",{className:d,children:s.jsx("span",{className:"req-status-badge",children:s.jsxs(ze,{shape:"tag",variant:"info",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot","aria-hidden":"true"}),r("进行中")]})})},o);const y=b.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-status-badge",dangerouslySetInnerHTML:{__html:b.badgeHtml(e)}}),y?s.jsx("span",{className:"req-status-line",dangerouslySetInnerHTML:{__html:y}}):null]},o)}const f=Number(e.status)||0,p=tS(e),h=!p&&f>=200&&f<300?r("HTTP {status},但响应体阶段出错:见错误列",{status:f}):void 0;return s.jsx("span",{className:d,children:s.jsx(ze,{shape:"tag",variant:p?"success":"destructive",title:h,children:f||r("失败")})},o)}case"model":{const f=String(e.clientModel??"").trim(),p=String(e.upstreamModel??"").trim(),h=String(e.model??"").trim(),b=String(e.clientReasoning??"").trim(),y=String(e.upstreamReasoning??"").trim(),v=(S,N)=>N?`${S}(${N})`:S;if(!f||!p||p.toLowerCase()===f.toLowerCase()){const S=v(h,y||b);return s.jsx("span",{className:d,title:S,children:S||"—"},o)}const w=v(p,y),j=v(f,b);return s.jsxs("span",{className:`${d} req-model-split`,children:[s.jsxs("span",{className:"req-model-line",title:r("转发到上游的模型:{model}",{model:w}),children:["⬆️ ",w]}),s.jsxs("span",{className:"req-model-line sub",title:r("下游请求的模型:{model}",{model:j}),children:["⬇️ ",j]})]},o)}case"client":{const f=String(e.client??"").trim();if(!f)return s.jsx("span",{className:`${d} is-empty`,title:r("这条明细没有记录来源客户端(旧数据、模型测试,或请求未带 User-Agent)"),children:"—"},o);const p=f==="other"?r("其它"):f;return s.jsx("span",{className:d,title:f==="other"?r("识别到 User-Agent,但不属于已知的客户端类型:{ua}",{ua:f}):r("来源客户端:{client}",{client:p}),children:p},o)}case"dur":return Sp(e)?s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",title:r("已用时(请求仍在转发中)"),children:EZ(e.ts)}),_Z(e)]},o):s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",children:eS(e.durationMs)}),s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时"),children:r("首响 {time}",{time:TZ(e.firstResponseMs)})})]},o);case"usage":{if(Sp(e))return s.jsx("span",{className:d},o);if(!tS(e))return s.jsxs("span",{className:d,title:r("失败请求不记录用量"),children:[s.jsx("span",{className:"req-usage-line",children:"in: - / out: - / all: -"}),s.jsx("span",{className:"req-usage-line sub",children:r("缓存读取: - / 命中率: -")})]},o);const f=`in: ${Ex(e.promptTokens)} / out: ${Ex(e.completionTokens)} / all: ${Ex(e.totalTokens)}`,p=r("缓存读取: {cache} / 命中率: {rate}",{cache:Ex(e.cacheReadTokens),rate:AZ(e)}),h=CZ(e),b=h?`${p} · ${h}`:p;return s.jsxs("span",{className:d,title:[f,b].filter(Boolean).join(` +`),children:[s.jsx("span",{className:"req-usage-line",children:f}),s.jsxs("span",{className:"req-usage-line sub",children:[p,h?s.jsxs("span",{title:NZ,children:[" · ",h]}):null]})]},o)}case"error":return Sp(e)?s.jsx("span",{className:d},o):e.error?s.jsx("span",{className:d,title:String(e.error),children:String(e.error)},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o);case"detail":{const f=e.id?String(e.id):"";return f?s.jsx("span",{className:d,children:s.jsx(se,{size:"sm",variant:"outline",className:"req-detail-btn",title:r("查看该请求的上游原始报文"),onClick:()=>{Ts().wbRequestDetail?.open?.(f,e)},children:r("详情")})},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o)}default:return null}}function zZ(e){return s.jsx("div",{className:"req-head",children:e.map(t=>s.jsx("span",{"data-col":t.key,className:`${t.sel.slice(1)}${t.key==="dur"?" req-num":""} ta-${t.align}`,children:t.label},t.key))},"__head")}function BZ(){const[e,t]=x.useState(IZ),[a,o]=x.useState(()=>fI()),[c,d]=x.useState(()=>en.range),[f,p]=x.useState(!1),[h,b]=x.useState(0),[y,v]=x.useState(()=>en.size),[w,j]=x.useState(()=>({ms:Cx,enabled:Tx})),[S,N]=x.useState([]),[k,T]=x.useState([]),[,D]=x.useState(0),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useCallback(ee=>(en.filters={...en.filters,...ee},o({...en.filters}),en.filters),[]),P=x.useCallback(ee=>{en.range=ee,d(ee)},[]),O=x.useCallback(ee=>{en.offset=ee,b(ee)},[]),_=x.useCallback(ee=>{en.runningOnly=ee,p(ee)},[]),L=x.useCallback(()=>{Y0||!Ts().wbFilterMemory||(Y0=!0,!cI&&I(fI()))},[I]),H=x.useCallback((ee,fe)=>{Ts().wbRequestHover?.beforeListRedraw?.(),fe&&(X0=fe),R.current=!0,t(ee)},[]),B=x.useCallback(ee=>{Ts().wbRequestHover?.beforeListRedraw?.(),R.current=!0,t(fe=>({...fe,error:ee}))},[]),z=x.useCallback(async(ee={})=>{const{silent:fe=!1,resetPage:te=!1}=ee;te&&O(0),MZ(),L(),fe||gI();const Ce=++uI;try{const re=Ts().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.getStatsRequests(SZ());if(Ce!==uI)return;const ke={entries:Array.isArray(de?.entries)?de.entries:[],total:Number(de?.total)||0,matched:Number(de?.matched)||0,running:Number(de?.running)||0,loaded:!0,error:""},Ee=Math.max(0,(Math.ceil(ke.matched/en.size)-1)*en.size);if(en.offset>Ee)return O(Ee),z({silent:fe});te&&(A.current=0),H(ke,ke.entries)}catch(re){fe||(console.warn("读取请求日志失败:",F0(re)),B(r("读取请求日志失败,详见控制台")))}},[O,H,B,L]);x.useEffect(()=>(Gu={load:z,setAuto:ee=>j(ee),setFilterOptions:(ee,fe)=>{N(ee),T(fe)},repaint:()=>D(ee=>ee+1)},Ts().wbRequestHover?.bind?.({host:C.current,entryOf:ee=>{const fe=ee?.dataset?.reqId||"";return fe&&(X0.find(te=>String(te?.id||"")===fe)||X0.find(te=>String(te?.ts||"")===fe))||null}}),z({silent:!0}),gI(),()=>{Gu=null}),[z]),x.useLayoutEffect(()=>{DZ(),D(ee=>ee+1)},[]);const Q=e.error||!e.entries.length?"":sS().map(ee=>ee.key).join("|");x.useLayoutEffect(()=>{Q&&Ts().wbTableColumns?.repaint?.("requests")},[Q]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const ee=window.setInterval(()=>{document.hidden||Ts().wbApp?.currentPage!=="requests"||Z0||(Z0=!0,z({silent:!0}).finally(()=>{Z0=!1}))},w.ms);return()=>{window.clearInterval(ee)}},[w,z]),x.useLayoutEffect(()=>{R.current&&(R.current=!1,Ts().wbRequestHover?.afterListRedraw?.());const ee=A.current;if(ee===null)return;A.current=null;const fe=C.current;fe&&(fe.scrollTop=ee)});function K(ee){const fe=Math.max(1,Math.ceil(e.matched/en.size)),Ce=(Math.min(Math.max(1,ee),fe)-1)*en.size;Ce!==en.offset&&(O(Ce),A.current=0,z())}function X(ee){const fe=sI(ee);if(fe===en.size)return;en.size=fe,v(fe),og("requests",fe);const te=en.offset+1;O(Math.max(0,Math.floor((te-1)/fe)*fe)),A.current=0,z()}function q(ee){cI=!0,jZ(I(ee)),z({resetPage:!0})}function $(ee){const fe=G0.includes(ee)?ee:K0;fe!==en.range&&(P(fe),wZ(fe),z({resetPage:!0}))}function Y(ee){ee!==en.runningOnly&&(_(ee),z({resetPage:!0}))}const F=sS(),G=Math.max(1,Math.ceil(e.matched/en.size)),W=Math.min(G,Math.floor(h/en.size)+1),le=e.matched?h+1:0,M=e.matched?h+e.entries.length:0,U=e.error?"—":e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total}),Z=!f&&e.running>0?r(" · {n} 进行中",{n:e.running}):"",ae=[hZ[c]||r("全部")];f?ae.push(r("只看进行中")):a.status==="ok"?ae.push(r("只看成功")):a.status==="error"&&ae.push(r("只看失败")),a.provider&&ae.push(hI(a.provider)),a.model&&ae.push(a.model);const ce=x.useMemo(()=>!a.provider||S.some(ee=>ee.value===a.provider)?S:[{value:a.provider,label:a.provider},...S],[a.provider,S]),J=x.useMemo(()=>!a.model||k.includes(a.model)?k:[a.model,...k],[a.model,k]),ie=OZ(e.entries),ge=e.entries.map((ee,fe)=>s.jsx("div",{className:`req-row${Sp(ee)?" running":tS(ee)?"":" failed"}`,children:F.map(te=>LZ(ee,te))},ie[fe]));return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("请求日志列表")}),s.jsx(ze,{id:"req-badge",variant:"outline","data-tone":"",children:U+Z}),s.jsx("span",{className:"panel-sub",children:r("按时间倒序,全量保留")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{id:"btn-req-clear",variant:"destructive",onClick:()=>{Ts().wbRequestClearModal?.open?.()},children:r("清理")})})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:xZ,value:c,onValueChange:$,"aria-label":r("请求日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.status,disabled:f,onValueChange:ee=>q({status:String(ee??"")}),children:[s.jsx(mt,{id:"req-status",className:"min-w-[120px]",title:r(f?"「仅看进行中」开启时,状态固定为进行中":"按请求结果筛选"),"aria-label":r("按请求结果筛选"),children:s.jsx(pt,{children:lI.find(ee=>ee.value===a.status)?.label??bZ})}),s.jsx(ht,{children:lI.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))})]}),s.jsxs(ft,{value:a.provider,onValueChange:ee=>q({provider:String(ee??"")}),children:[s.jsx(mt,{id:"req-provider",className:"min-w-[120px]",title:r("按提供商筛选(只列日志里出现过的)"),"aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:a.provider?ce.find(ee=>ee.value===a.provider)?.label||a.provider:oI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:oI}),ce.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))]})]}),s.jsxs(ft,{value:a.model,onValueChange:ee=>q({model:String(ee??"")}),children:[s.jsx(mt,{id:"req-model",className:"min-w-[120px]",title:r("按模型筛选(只列日志里出现过的;精确匹配模型名)"),"aria-label":r("按模型筛选"),children:s.jsx(pt,{children:a.model||iI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:iI}),J.map(ee=>s.jsx(qe,{value:ee,children:ee},ee))]})]}),s.jsx(E6,{id:"btn-req-running",variant:"outline",size:"default",pressed:f,onPressedChange:Y,title:r("只显示正在转发中的请求(状态列按阶段显示:连接中 / 等待响应 / 响应中 / 重试中,用时列显示已用时)"),children:r("仅看进行中")}),s.jsx("div",{className:"spacer"}),s.jsx("span",{className:"panel-sub",id:"req-summary",children:ae.join(" · ")})]}),s.jsx("div",{className:"log-list",id:"req-list",ref:C,children:e.error?s.jsx("div",{className:"log-empty",children:e.error}):e.entries.length?[zZ(F),...ge]:s.jsx("div",{className:"log-empty",children:PZ(e)})})]}),s.jsx(Li,{total:e.matched,range:{start:le,end:M},page:W,pageCount:G,size:y,sizes:pZ,onSizeChange:X,onPageChange:K,disabled:!e.loaded&&!e.error})]})}async function xI(e={}){await Gu?.load(e)}function HZ(){return pI().toString()}function UZ(){return W0=0,xI({resetPage:!0})}const bI='.page[data-page="requests"]';let vI=!1;function yI(){if(vI)return;const e=document.querySelector(bI);e&&(vI=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(BZ,{})))}document.querySelector(bI)?yI():document.addEventListener("DOMContentLoaded",yI,{once:!0}),window.wbRequestsPanel={load:xI,applyAutoRefresh:nS,visibleColumns:sS,clearParams:HZ,notifyCleared:UZ},window.wbRequestPhase={labelOf:eI,badgeHtml:dZ,elapsedLineHtml:fZ,elapsedText:tI,phaseOf:$0};function VZ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.modelsDevUnavailable;const t=e.source==="builtin"?Ut.modelsDevSourceBuiltin:e.source==="cache"?Ut.modelsDevSourceCache:e.source==="network"?Ut.modelsDevSourceNetwork:e.source,a=e.updatedAt>0?String(tt().wbApp?.formatTime?.(e.updatedAt)??""):"";if(!t&&!a&&!e.count)return Ut.modelsDevEmpty;const o=a?r(",{time}",{time:a}):"",c=e.enabled?r("正在联网更新"):r("仅用现有数据、不联网刷新");return r("{count} 条 · 来自{origin}{at} · {mode}",{count:Number(e.count).toLocaleString("zh-CN"),origin:t||r("未知来源"),at:o,mode:c})}function tt(){return window}function _t(e){return e instanceof Error?e.message:String(e)}function Ve(e,t){tt().wbApp?.toast?.(e,t)}async function FZ(e){try{await tt().workbuddyDesktop?.openReleasePage?.(e)}catch(t){Ve(r("打开链接失败:{error}",{error:_t(t)}),"err")}}const Ax=[{id:"general",label:r("通用"),icon:"sliders"},{id:"display",label:r("显示"),icon:"display"},{id:"gateway",label:r("网关"),icon:"traffic"},{id:"routing",label:r("路由"),icon:"route"},{id:"retry",label:r("重试"),icon:"refresh"},{id:"timeout",label:r("超时"),icon:"timer"},{id:"security",label:r("安全"),icon:"shield"},{id:"data",label:r("数据"),icon:"database"},{id:"feedback",label:r("反馈与需求"),icon:"feedback"},{id:"about",label:r("更新"),icon:"download"}],wI="workbuddy-desktop-settings-cat",$Z="workbuddy-desktop-theme",qZ="workbuddy-desktop-zoom",jI="wb:theme",SI="wb:zoom",rS=80,NI=130,Rx=5,GZ=Array.from({length:(NI-rS)/Rx+1},(e,t)=>rS+t*Rx),KZ=[{value:"system",label:r("跟随系统")},{value:"light",label:r("浅色")},{value:"dark",label:r("深色")}];function YZ(){try{const e=localStorage.getItem($Z);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function XZ(){try{const e=localStorage.getItem(qZ);if(e===null||e.trim()==="")return 100;const t=Number(e);if(!Number.isFinite(t))return 100;const a=Math.round(t/Rx)*Rx;return Math.min(NI,Math.max(rS,a))}catch{return 100}}const aS=1,lS=99999,oS=[{key:"logRetentionDays",id:"settings-retention-log",label:r("事件日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("登录 / 账号切换 / 429 切换等系统事件,可填 1–99999 天。")},{key:"requestLogRetentionDays",id:"settings-retention-request",label:r("请求日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("「请求日志」页的逐条请求记录,默认 99999 天(近似全量保留),可填 1–99999 天。")},{key:"dailyAggregateRetentionDays",id:"settings-retention-daily",label:r("按天聚合保留天数"),unit:r("天"),min:aS,max:lS,hint:r("报表页的热力图与按天趋势,默认 99999 天(近似全量保留),可填 1–99999 天。")}],kI=[{key:"retryCount",id:"settings-retry-count",label:r("同一账号重试次数"),unit:r("次"),min:0,max:10,hint:r("在同一个账号上原地重发几次(不含首发;整条请求共用一份,用完后换来的账号只发一次就继续换)。可填 0–10,0 表示失败立即换号。")},{key:"retryCrossProviderCount",id:"settings-retry-cross-provider-count",label:r("切换账号重试次数"),unit:r("次"),min:0,max:10,hint:r("失败后最多再换几个账号试(填 N = 最多换 N 个,首发那个不算)。换到同一家名下另一个账号、或换到另一家,都各算一次;换满仍失败就返回错误。可填 0–10,0 表示失败立即报错。")},{key:"retryIntervalSeconds",id:"settings-retry-interval",label:r("重试间隔"),unit:r("秒"),min:0,max:300,hint:r("两次重试之间的等待时间,两项共用,可填 0–300 秒。")}],CI=[{key:"connectTimeoutSeconds",id:"settings-timeout-connect",label:r("连接中超时"),unit:r("秒"),min:1,max:3600,hint:r("建立上游 TCP/TLS 连接或代理隧道的最大等待时间(秒),默认 30 秒,范围 1~3600。")},{key:"headersTimeoutSeconds",id:"settings-timeout-headers",label:r("等待响应超时"),unit:r("秒"),min:1,max:3600,hint:r("请求发出后等待上游响应头的最大时间(秒),默认 300 秒,范围 1~3600。")},{key:"streamIdleTimeoutSeconds",id:"settings-timeout-stream-idle",label:r("流式响应空闲超时"),unit:r("秒"),min:1,max:3600,hint:r("流式响应相邻数据之间允许的最大空闲时间(秒),收到新数据后重新计时,默认 300 秒,范围 1~3600。")},{key:"bodyTimeoutSeconds",id:"settings-timeout-body",label:r("非流式响应超时"),unit:r("秒"),min:1,max:3600,hint:r("读取完整非流式响应体允许的最大时间(秒),默认 300 秒,范围 1~3600。")}],TI=[{key:"queueMaxWaits",id:"settings-queue-max-waits",label:r("排队等待次数"),unit:r("次"),min:0,max:10,hint:r("上游模型繁忙时会先排队(回一句「建议 N 秒后再来」,Qoder 免费模型就是这样):网关等一会儿再发同一请求,最多等几次。默认 2 次,可填 0–10;填 0 表示不等待,排队直接返回 503 并说明「不是登录态或额度问题」。")},{key:"queueWaitSeconds",id:"settings-queue-wait-seconds",label:r("排队等待秒数"),unit:r("秒"),min:0,max:120,hint:r("每次等待的时长,默认 0 = 跟随上游建议(实测 9~30 秒,上游没给建议时用 15 秒)。可填 0–120 秒强制一个固定时长。")}],EI="noRetryStatusCodes",iS=100,cS=599,AI=50,zo=[{value:"passthrough",optionLabel:r("透传客户端 system(默认)"),toastLabel:r("透传客户端 system")},{value:"custom",optionLabel:r("替换为网关提示词"),toastLabel:r("替换为网关提示词")},{value:"append",optionLabel:r("追加网关提示词"),toastLabel:r("追加网关提示词")}];function RI(e,t,a,o){const c=String(e??"").trim();if(!c)return{ok:!1,message:r("{noun}不能为空(可填 {min}–{max})",{noun:o,min:t,max:a})};if(!/^\d+$/.test(c))return{ok:!1,message:r("{noun}必须是整数",{noun:o})};const d=Number(c);return da?{ok:!1,message:r("{noun}必须在 {min}–{max} 之间(当前填的是 {text})",{noun:o,min:t,max:a,text:c})}:{ok:!0,value:d}}function QZ(e,t){const a={...t};if(e&&typeof e=="object"){const o=e;typeof o.closeToTray=="boolean"&&(a.closeToTray=o.closeToTray),typeof o.autostart=="boolean"&&(a.autostart=o.autostart),typeof o.lanAccess=="boolean"&&(a.lanAccess=o.lanAccess),typeof o.lanPanel=="boolean"&&(a.lanPanel=o.lanPanel),typeof o.lightweightMode=="boolean"&&(a.lightweightMode=o.lightweightMode)}return a}function OI(e,t,a){if(!t||typeof t!="object")return null;const o=t,c={...a||{}};for(const d of e){const f=Number(o[d.key]);Number.isInteger(f)&&f>=d.min&&f<=d.max&&(c[d.key]=f)}return e.some(d=>Number.isInteger(c[d.key]))?c:null}function MI(e){if(!Number.isFinite(e)||e<=0)return"0 B";if(e<1024)return`${e} B`;const t=e/1024;if(t<1024)return`${t.toFixed(1)} KB`;const a=t/1024;return a<1024?`${a.toFixed(1)} MB`:`${(a/1024).toFixed(2)} GB`}function ZZ(e){const t=Number(e);return!Number.isFinite(t)||t<0?"—":t.toLocaleString("zh-CN")}const rs={displayTheme:r("控制界面的深浅色,与左侧边栏底部的三个主题按钮是同一个设置(改哪一处,另一处立刻跟上)。「跟随系统」会随操作系统当前的浅色 / 深色自动切换,并在系统主题变化时即时跟上;选「浅色」或「深色」则把界面固定在该模式,不再随系统变化。窗口标题栏的深浅色会一并同步,不会出现深色界面配一条浅色标题栏的情况。"),displayZoom:r("等比放大或缩小整个界面(文字、控件、间距一起变),效果与浏览器按 Ctrl +/- 相同:80%–130%、5% 一档。窗口本身不缩放,变的是页面内容的显示比例,设置立即生效并记住,下次启动直接按这个比例打开。放得越大可视范围越小,窗口较窄或表格较宽时不建议调得太大。"),displayLanguage:r("界面语言。可选简体中文、繁體中文、English、日本語、한국어、Português (Brasil),或「跟随系统」(按浏览器 / 系统的语言列表自动选)。切换后整页立即刷新;该偏好只存在本机(localStorage),不影响账号、密钥与转发。"),tray:r("默认关闭窗口不会退出程序,而是把窗口缩到系统托盘,转发继续在后台运行(OpenAI 客户端不受影响);要彻底退出程序,请在托盘图标上右键选「退出」。关掉这个开关后,点关闭按钮即退出程序、转发随之中断。「开机自动启动」开启后,登录系统时会自动启动本程序(通常直接驻留托盘),不需要手动打开。"),lightweight:r("开启后,关闭窗口不只是隐藏,而是把界面窗口整个销毁:底层的 WebView2 六个常驻进程(约 200MB 内存)随之退出,网关转发、定时签到、余额查询都在后台进程里继续,不受影响;需要界面时点托盘图标重新打开(WebView 冷启动约 1 秒)。注意:界面销毁期间「ZCode 活动套餐」通道的验证码令牌由界面铸造,无法补充 —— 走该通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。此开关只在「关闭窗口时最小化到托盘」开启时有意义,最小化窗口不受影响。"),lan:r("默认网关只监听 127.0.0.1,只有本机能访问。开启后网关改听所有网卡,同一局域网内的设备可以把 API 地址指向本机 IP 一起使用。出于安全考虑,开启前必须先注册一个面板管理员:管理接口从此要求管理员会话或网关 Key,模型额度不会对局域网裸奔;一把启用的网关 Key 都没有时,转发接口也会拒绝服务,直到创建第一把。改动需要重启应用生效。「同时开放网页管理面板」把管理界面也出给局域网(其他设备的浏览器打开本机 IP 即可管理),默认关闭 —— 桌面端的面板仍只由本程序自己出。"),units:r("控制报表与请求日志里 Token 读数的写法:开启后按中文量级显示(1.2亿 / 8400万),关闭则用 k / M 缩写(与上游文档、接口字段的写法一致)。这只影响显示口径,不改变任何统计与存储的数值。"),queue:r("只对「排队制」的上游生效(目前是 Qoder 的免费模型):模型繁忙时上游不报错,只回一句「建议 N 秒后再来」(业务码 10605),网关按建议时长等一会儿再发同一请求,等满次数仍排不上才把「排队中」作为错误返回(HTTP 503,文案会说明这不是登录态或额度问题)。等待发生在首个字节之前,吃的是「等待响应超时」那份预算 —— 两项设置一起决定一次请求最多卡多久;排队不会标记账号限额、也不会换账号(换谁都一样在排队)。保存后对下一个请求立即生效,不用重启。"),captchaPool:r("ZCode「活动套餐」通道的每条推理请求都要附一个当次铸造的阿里云无痕验证令牌(一次性、约 2 分钟过期):令牌由界面里的铸造守卫静默铸好、推给网关入池,转发时逐条取用。这里的三个值管的是补货节奏:①「库存目标」= 库存低于它守卫才补铸、补到它为止,默认 3 个;②「轮询间隔」= 守卫多久看一次库存,默认 2500 毫秒,只影响反应速度(库存够用时不会多铸);③「单轮铸造上限」= 发现缺货时一轮最多铸几个,默认 1 个(连铸之间固定隔 500 毫秒)。请求密集、请求日志里连续出现「需要人机验证令牌」的 503 时,把目标与单轮上限适当调大、轮询调快,能让池子跟得上消耗 —— 代价是上游(阿里云)对铸造频率有风控,铸得越多越快越容易触发限流,且用不掉的令牌 2 分钟即过期作废、等于白烧配额,所以建议小步调。保存后对下一轮补货立即生效,不用重启。"),timeouts:r("上游请求四个阶段各自的等待上限(秒,1~3600):①「连接中超时」= 建立 TCP/TLS 连接或代理隧道的最大等待,默认 30 秒;②「等待响应超时」= 请求发出后等上游响应头的最大时间,默认 300 秒 —— 网关请求上游恒带 stream,响应头在 SSE 建立时就到达,与模型思考多久无关;③「流式响应空闲超时」= 流式响应相邻两块数据之间允许的最大空闲,收到新数据即重新计时,默认 300 秒 —— 上游长时间不吐数据即判定连接僵死并断开;④「非流式响应超时」= 读完整份非流式响应体的总预算(一次性计时、不重置),默认 300 秒。四项都是「等待上限」,只要数据还在来,正常的流式回答就一直往下传。保存后对下一个请求立即生效,不用重启。"),retry:r("请求转发到上游失败时(服务器瞬时错误、连接失败,以及 WorkBuddy 的 11-128 敏感词拦截),网关会等一段间隔后再发一次。次数分两档,管的是两件事:①「同一账号重试次数」在同一账号上原地重发几次 —— 一般是提示词被上游拦截、或链路瞬时抖动,等一会儿重发往往就好了;②「切换账号重试次数」这份请求最多再换几个账号试 —— 首发的那个账号不算,每换一个扣一次,不分是不是同一家(换到同一家的下一个账号也算一次),换满还失败就把错误返回给客户端。两项都设为 0 表示失败不重试、直接报错。注意账号级限额(429)不占这里的换号次数 —— 那类失败走「冷却该账号并换下一个账号」的降级,与这里的重试是两条路。另有「指定错误码直接换号」名单(默认 402):命中名单的上游状态码不在同一账号重发,直接按队列换下一个账号继续试(换号也占「切换账号重试次数」),换满仍失败才把错误返回给客户端。"),routing:r("转发一个请求时按什么顺序挑账号:①「路由策略」决定排队规则 —— 顺序优先是排第 1 的接走所有请求、直到它不能答(限流 / 故障 / 额度尽)才轮到下一位;负载均衡是每条请求换下一位,把负载摊到各个账号上。②「会话粘性」让同一会话(相同的模型 + 相同的开头消息)尽量跟住同一个账号 —— 多轮对话的上下文缓存能复用、少换号少浪费;自动档粘 5 分钟、会话内档粘 6 小时、每轮与关闭都不粘。账号的排队位次(账号表的第一列)在所有策略下都是地基,策略在它之上再排。此外路由还有三层自愈保护:转发失败的账号退避休息一会儿(15 分钟起步翻倍、封顶 1 小时)、被 429 的账号垫底排到队尾 30 分钟、余额不足 / Token 周期用量到顶的账号由限制器拦下 —— 前两层可以在下面按需开关,限制器由账号的「限制器」设置管。"),sanitize:r("上游用「逐字精确匹配」的方式审核请求体(不是语义审核):客户端注入的固定模板句、计费头字段名、以及某些裸错误码出现在报文里就会整单拦截,返回 400。开启本项后,网关在每次转发前改写这些指纹 —— 表头键值整段删除,承载语义的模板句只换一个词(如 official CLI for Claude → official CLI tool for Claude),对话内容与语义都不受影响。规则集是内置的,不需要也无法维护词表。关掉本项后客户端模板会原样发往上游,可能重新出现模板句被误拦的报错。"),clineHeaders:r("Cline 上游按请求头判定「调用方是不是 Cline 自家产品」:X-CLIENT-TYPE: cline-sdk 是硬门槛(缺了它免费池模型一律 403),版本号与平台标识让请求更贴近官方客户端的形态。这里列出的是网关默认会发的头:改某一行的值 = 覆盖默认值(也可以新增默认清单之外的自定义头);把值清空保存 = 这个头不发送;在界面删掉被改过的行 = 回落默认值。改完点「保存」,下一个 Cline 请求立即生效。不懂某一行的含义就不要动它 —— 伪装头的价值在「与官方客户端逐字一致」。"),cors:r("网关面(/v1/*)默认不应答浏览器跨源请求:页面直连会被预检拦下,只报「无法连接 API」。注意来源是 * —— 未配「网关 Key」时任何网页都能借本机网关打上游,故默认关闭;只给自己用的话,让页面与网关同源(本地反代 /v1)更稳妥。面板接口(/api/*)不受影响。"),prompt:r("客户端(Claude Code / Codex 等 CLI)会在 system 提示词里注入几十句固定模板,上游按逐字匹配审核,命中就整单拦截(HTTP 400)。指纹脱敏能改写实测命中过的那几句,但换一个客户端版本就可能冒出新的。这里可以把 system 整段换成网关自己那份:①「透传」= 不动客户端 system(默认,行为与之前完全一致);②「替换」= 删掉客户端所有 system / developer 消息,换成网关的提示词(客户端项目规范随之消失);③「追加」= 在开头连续 system 块之后插入一条网关提示词,既有消息逐字不动(客户端规范与网关提示词并用)。那份提示词有两个来源:提示词文件(留空用内置默认),或直接在界面上编辑正文 —— 编辑过就以那份正文为准(优先于文件),清空则回到文件 / 内置默认。另外,透传 / 追加模式下撞了内容拦截(多半是指纹误报)时,网关会自动换一段最小中性提示词重试一次,并把「降级期」开到次日 00:00 —— 期间所有请求直接带中性提示词出门,不再先撞一次 400;这里能看见并提前解除它。上面几项是**默认值**:想给某个提供商单独配,用下面的「按提供商」加一行(带「网关自带」的家默认就列在那里)—— 不同的上游对这些内容的接受程度不一样。"),debug:r("开启后,网关会把每次转发**发给上游的请求**(请求头 + 请求体)与**上游返回的响应**(状态码 + 响应头 + 响应体)完整保存到本地,供请求日志页的「详情」查看。请求头里的 Authorization、Cookie、API Key 等凭据字段一律替换成 [redacted],不会明文落盘;请求体与响应体按原样保存(可能包含你的对话内容)。报文只保留最近 500 条,超出后丢弃最旧的。这是排障用的临时开关,不需要时建议关闭。"),io:r("导出会把全部账号与自定义提供商定义写入一个 JSON 文件,可以拷到另一台机器上导入后继续使用。导入采用合并策略:同提供商下按业务身份(UID / userId / apiKey 等)去重 —— 已存在的账号只更新凭证,保留本机原有的优先级顺序;新账号追加到转发顺序末尾,不会抢占当前正在使用的账号;自定义提供商定义按 id 合并,本机缺失时自动补建。"),backup:r("把整份数据库(账号、网关配置、事件日志、请求统计、调试报文与桌面设置)导出成一个 SQL 文件,恢复时整体替换本机全部数据 —— 与上面「账号导入 / 导出」的逐条合并是两种语义:恢复会连配置、日志与当前启用状态一起换成备份那台机器的状态。导出默认包含日志与调试报文(文件可能很大),不需要时可以取消勾选只备业务数据。恢复前会自动把当前数据备份到配置目录的 backups/ 下,恢复后需要重新登录管理面板。"),retention:r("三档数据各自独立计时,超出保留天数的部分会被删除:事件日志是登录、账号切换、429 切换这类系统事件;请求日志是网关每次转发到上游的逐条记录;按天聚合供报表页的热力图与按天趋势使用。请求日志与按天聚合默认 99999 天(约 274 年,效果上等于全量保留),事件日志默认 30 天。把某一档改小(例如 30 天改成 7 天)保存后会立即删除超出的历史数据,此操作不可恢复;改大或保持不变不会删除任何数据。三档的可填范围均为 1–99999 天。"),storage:r("全部数据(账号、事件日志、请求记录、调试报文、设置)统一保存在配置目录下的 agent2api.db 这一个 SQLite 数据库里。备份时只需拷贝这个文件;更换保存位置请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),modelsDev:r("models.dev 是一个开源的模型资料库(社区维护),这里用它补齐「上游没告诉我们」的模型能力:上下文窗口、最大输出、工具调用、图片、视频、是否支持思考,以及这个模型认识哪些思考档位。优先级是:你在「模型能力」里手工改的值 > 上游清单自己声明的值 > models.dev 的值 —— 它只填上游没声明的空位,从不推翻上游已声明的。网关随包内嵌了一份快照,所以离线、首次启动、访问不通时也有数据;开启时会按「模型目录刷新」任务的间隔联网更新(同一轮里一并刷新,也可在这里立即刷新)。关闭只停联网刷新,已经拿到的数据继续用。")},$n={timeouts:r("保存后立即生效,不用重启;超时按上游失败处理(计入请求日志的「错误」列,并按「请求重试」的设置决定是否重试)。"),queue:r("等待期间请求日志的状态列会显示「排队中」阶段,详情弹窗的「内部重试」里能逐次看到等待时长;等待用尽后返回 HTTP 503(不是 401/429:既不会刷新凭证,也不会把账号标成限额)。"),captchaPool:r("保存后对下一轮补货立即生效,不用重启。守卫跑在应用界面里:轻量模式关窗销毁界面期间无法铸造,走活动套餐通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。"),retry:r("保存后立即生效,不用重启;次数用尽仍失败时,错误原样返回给客户端。"),routing:r("保存后立即生效,不用重启:策略与粘性作用于**下一次**转发的选路,进行中的请求不受影响。"),retryCodes:r("命中这些上游状态码的失败不在同一账号重发,直接换下一个账号继续试(换号占用「切换账号重试次数」,换满仍失败才把错误原样返回给客户端)。输入 100–599 的状态码后回车添加,点 × 或退格删除;默认 402(积分不足)。清空全部表示任何错误都照常重试。"),sanitize:r("默认开启。命中明细会记进请求日志的「敏」标签(悬停可看命中了哪几条规则)。本项只改发给上游的副本,客户端看到的响应内容不变。"),clineHeaders:r("值与默认值相同的行不占覆盖(存的是「改过的键」,不是全量配置);值留空保存表示这个头不发送,删除改过的行表示回落默认值。改完立即生效,不用重启。"),cors:r("默认关闭。改动立即生效,不用重启;关闭期间的跨源请求会被预检拦下。"),debug:r("开启后新发生的请求才会被记录(已经过去的请求补不回来)。报文统一存放在本地数据库里,只保留最近 500 条(超出后丢弃最旧的),条数见左侧「数据 → 数据存储」的「调试报文」。"),promptMode:r("替换 = 客户端 system / developer 消息全部删掉,换成网关的提示词;追加 = 保留客户端内容,只在开头 system 块之后多插一条。两者都只改发给上游的副本,客户端看到的响应不变。"),promptFile:r("UTF-8 文本文件路径,留空用内置默认提示词(通用编码助手提示词,不含任何会被上游拦截的模板句)。只在「替换 / 追加」模式下生效,透传模式不读它。"),promptText:r("在这里直接编辑提示词正文:保存后以这份文本为准(优先于上面的提示词文件),清空则回到文件 / 内置默认。改一个字不必再去编辑器里开文件。"),promptGatewayText:r("上游按「结构」校验身份:三段必须各自成块,所以这里分开编辑三段(不能合成一段)。动态段里的运行值写成占位符,发请求时才替换:{cwd} 工作目录、{platform} 平台、{shell} shell、{os_version} 系统版本、{git} 是否 git 仓库、{provider} 提供方标识、{model} 模型名。清空某一段 = 那一段恢复官方原文。第三段发出时前面会自带一个空行(官方形状)。"),prompt:r("改完立即生效,不用重启(下一个请求就用新模式)。降级是自动的临时状态,解除后本模式自己的提示词立刻恢复。"),promptProviders:r("「用哪份提示词」本来是按上游分别决定的事,所以每家可以有自己的模式、提示词文件与正文:不在这里列出的提供商一律沿用上面那份默认设置,「跟随默认」把这一家取消、回到默认。带「网关自带」那一行的家(目前是 ZCode 两家)默认就列在这里 —— 那一段是网关自己装上去的文本,不来自客户端也不来自提示词文件,默认开启、可以关掉,也可以改它的正文(改过的那一段以你的文本为准);关掉后还能不能通过上游校验,取决于上游当下的口径,行内说明了实测依据。「模式 / 提示词文件 / 正文」管的是客户端自己的 system 怎么处理,与那个开关是两件事。"),modelsDev:r("「模型管理」里每个能力的来源标记(上游 / models.dev / 已覆盖)读的就是这份数据;映射弹窗的思考档位下拉也按这里的数据只列该模型真实认识的档位。"),retention:r("保存后立即生效:改小保留天数会立刻删除超出的历史数据,且不可恢复。"),storageFile:r("配置目录下的 agent2api.db(账号、日志、请求记录、调试报文与设置都在里面)。"),storageSize:r("库主文件的大小(不含运行期间的 WAL 临时文件,退出时已自动并回)。"),storage:r("数据统一保存在配置目录下的 agent2api.db;如需更换位置,请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),captcha:r("开启后,登录页在浏览器后台自动完成验证(对真人无感),而脚本每次尝试都要先算一道题 —— 暴力破解与抢注的成本显著上升。仅影响面板的登录 / 注册,与 API 客户端的 API Key 无关。"),panelLogin:r("当前浏览器以管理员身份登录着本面板。「退出登录」会撤销这台设备的登录会话(30 天内的自动续期一并失效),需要重新输入账号密码;其他已登录的设备不受影响。"),exportDanger:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义,可直接用于登录。请妥善保管,不要外传或上传到公共位置。"),backupDanger:r("备份文件内含全部账号凭证、网关 API Key 与面板管理员凭据,可直接用于登录。请妥善保管,不要外传或上传到公共位置。")},Ut={appLoading:"—",appUnavailable:r("主进程未返回启动设置,请更新桌面端后重试"),appTrayOn:r("关闭窗口时程序不退出,转发继续在后台运行;退出请用托盘菜单"),appTrayOff:r("关闭窗口即退出程序,后台转发随之中断"),appLightOn:r("轻量模式已开启:关窗即销毁界面进程(释放约 200MB 内存),网关在后台继续;界面销毁期间 ZCode 活动套餐通道不可用,相关请求会在请求日志里注明原因"),appLightOff:r("未开启轻量模式:关窗仅隐藏窗口,界面进程常驻内存,随时打开不等待"),unitsOn:r("当前显示为「1.2亿 / 8400万」这类中文量级。"),unitsOff:r("当前显示为「1.20M / 8.4k」这类英文缩写。"),debugUnavailable:r("未能读取调试模式设置,请稍后重试"),debugOn:r("正在保存上游原始报文:"),debugOff:r("未开启,转发时不保存任何原始报文。"),sanitizeUnavailable:r("未能读取指纹脱敏设置,请稍后重试"),sanitizeOn:r("正在剥离出站请求里的审核指纹:表头键值整段删除,模板句最小改写。"),sanitizeOff:r("未开启,客户端 system 模板会原样发往上游,可能被内容审核误拦(400)。"),corsUnavailable:r("未能读取网关跨域访问设置,请稍后重试"),corsOn:r("正在应答跨源请求:浏览器跨域请求可直连 /v1/*。"),corsOff:r("未开启,浏览器跨域无法直连网关。"),modelsDevUnavailable:r("未能读取 models.dev 元数据状态,请稍后重试"),modelsDevSourceBuiltin:r("随包内嵌的快照(发版时的那份)"),modelsDevSourceCache:r("上次成功刷新的结果(存在本机数据库里)"),modelsDevSourceNetwork:r("刚刚从 models.dev 拉到的最新数据"),modelsDevEmpty:r("还没有装载任何数据。"),promptUnavailable:r("未能读取系统提示词设置,请稍后重试"),degradeUntilFallback:r("次日 00:00"),themeSystem:r("当前跟随操作系统的深浅色设置,系统切换时界面会自动跟上。"),themeLight:r("当前固定为浅色模式,不随系统变化。"),themeDark:r("当前固定为深色模式,不随系统变化。"),zoomWeb:r("网页端的界面缩放由浏览器自己控制(Ctrl + / Ctrl -,或浏览器菜单里的缩放),此项不可调。"),zoomDefault:r("当前按 100% 显示(默认比例)。"),languageHint:r("界面语言只保存在本机(localStorage)。切换后整页立即刷新,不影响账号、密钥与转发。")},Ox=[{value:"order",label:r("顺序优先"),tip:r("排第 1 的接走所有请求,直到它不能答(限流 / 故障 / 额度尽)才轮到下一位 —— 就是「从上往下」的现状行为。")},{value:"rotate",label:r("负载均衡"),tip:r("每条请求轮换到下一个可用账号;新会话交给当前最闲的那位。适合想把手里的号摊开用、不让某一个一直扛。")},{value:"provider",label:r("家内轮询"),tip:r("家之间仍按优先级,只有同一家内部轮流用各账号 —— 想优先用某几家、又不愿把某一家的某个账号焊死时用它。")}],Mx=[{value:"auto",label:r("自动"),tip:r("同一会话在 5 分钟内尽量跟住同一个账号;停了 5 分钟再发就算新会话。多数场景用它 —— 多轮对话少换号,也不至于把账号焊死。")},{value:"session",label:r("会话内"),tip:r("同一会话在 6 小时内跟住同一个账号;适合一坐几个小时的长会话,上游的上下文缓存能吃到更多。")},{value:"turn",label:r("每轮"),tip:r("每条请求都重新按策略选路 —— 行为与「关闭」一致,仅保留会话识别的记录。")},{value:"off",label:r("关闭"),tip:r("不做会话识别,每条请求都重新按策略选路。")}],WZ=[{key:"routingFailoverBackoff",label:r("失败退避"),defaultOn:!0,tip:r("转发失败的账号休息一会儿再回来:15 分钟起步,连续失败翻倍,封顶 1 小时;成功一次立即恢复。目的是「让这次失败先凉一会儿」,免得一条条地反复撞同一个坏账号。")},{key:"routingSink",label:r("限流垫底"),defaultOn:!0,tip:r("还有额度时被 429 的账号排到队尾,30 分钟后自动回到队列(成功转发一次也会立即回来)。它标记的是「疑似共享池被别人抢」,不是「这个账号本身有问题」。⚠️ 注意它与路由策略的配合:在「家内轮询」下,队尾意味着这一家整体被往后排 —— 如果某个提供商的账号被批量限流,它们会集体沉到队尾,那个家可能长时间轮不到。这时可以关掉本项,让 429 过的账号只受冷却约束(冷却到点自动回来)。")},{key:"routingBreakerEnabled",label:r("熔断"),defaultOn:!1,tip:r("连续失败到阈值后把这个账号整个打开(默认关)。与失败退避的分工:退避管「单次失败先凉一会儿」,惩罚轻、自动恢复;熔断管「这个账号现在整体不对劲,别再一条条地试」,要连续成功若干次才关。打开期间该账号被跳过,除非全场只剩它 —— 那时仍放行试一次。")}],DI=[{key:"zcodeCaptchaPoolTarget",id:"settings-captcha-pool-target",label:r("库存目标"),unit:r("个"),min:1,max:10,hint:r("ZCode 活动套餐通道每条请求都要消耗一个当次铸造的人机验证令牌(一次性,2 分钟过期),库存低于该值时界面自动补铸到它。默认 3 个。调大能吸收突发并发,但用不掉的令牌 2 分钟就过期作废,烧的是上游风控配额。可填 1–10。")},{key:"zcodeCaptchaPoolPollMs",id:"settings-captcha-pool-poll-ms",label:r("轮询间隔"),unit:r("毫秒"),min:1e3,max:3e4,hint:r("铸造守卫每隔多久看一次库存(毫秒)。只影响发现缺货的反应速度 —— 库存够用时轮询不会铸造任何令牌。默认 2500 毫秒,可填 1000–30000。")},{key:"zcodeCaptchaPoolMaxPerRound",id:"settings-captcha-pool-max-per-round",label:r("单轮铸造上限"),unit:r("个"),min:1,max:5,hint:r("发现缺货时一轮最多铸几个(连铸之间固定隔 500 毫秒)。默认 1 个:SDK 同一实例连铸容易互相干扰。调大补货更快,但单轮连铸越多越容易触发上游风控。可填 1–5。")}];function II(){return tt().workbuddyDesktop?.platform==="web"}let dt={...{category:Ax[0].id,scrollReset:0,busy:null,app:{status:"loading",closeToTray:!1,autostart:!1,lanAccess:!1,lanPanel:!1,lightweightMode:!1,lanIp:null,port:0,adminRegistered:null},unitsChinese:!0,retention:{status:"loading",values:null},retry:{status:"loading",values:null},retryCodes:null,timeouts:{status:"loading",values:null},queue:{status:"loading",values:null},captchaPool:{status:"loading",values:null},routing:{status:"loading",strategy:"order",sticky:"auto",failoverBackoff:!0,sink:!0,breakerEnabled:!1},debug:{status:"loading",on:!1,count:null,limit:null},sanitize:{status:"loading",on:!1},clineHeaders:{status:"loading",defaults:{},overrides:{},effective:{}},cors:{status:"loading",on:!1},prompt:{status:"loading",mode:"passthrough",file:"",text:"",source:"",lines:0,fileError:"",degradeActive:!1,degradeUntilText:"",providers:[],gateway:{},gatewayText:{},options:[]},storage:{status:"loading",available:!0,file:"",bytes:0,accounts:null,logs:null,requests:null,dailyDays:null,debug:null},captcha:{available:!0,enabled:!1},modelsDev:{status:"loading",enabled:!0,source:"",updatedAt:0,count:0},ioFailure:null,retentionConfirm:null,dbIncludeLogs:!0,dbBackupConfirm:null,dbWarning:null,lanConfirm:null,lanRegister:null,panelLogin:!1},panelLogin:II()};const uS=new Set;function JZ(e){return uS.add(e),()=>{uS.delete(e)}}function eW(){return dt}function tW(){return x.useSyncExternalStore(JZ,eW)}function Ze(e){dt={...dt,...e};for(const t of uS)t()}function Ma(e){Ze({app:{...dt.app,...e}})}function nl(){Ze({})}let En=null;function ds(e){En=e,Ze({busy:e})}function as(){En=null,Ze({busy:null})}function dS(e){const t=Ax.some(a=>a.id===e)?String(e):Ax[0].id;Ze({category:t,scrollReset:dt.scrollReset+1})}function nW(e){dS(e);try{localStorage.setItem(wI,e)}catch{}}function PI(){let e=null;try{e=localStorage.getItem(wI)}catch{e=null}dS(e)}function _I(){Ze({unitsChinese:tt().wbUnits?.isChinese?.()!==!1})}function sW(e){tt().wbUnits?.setChinese?.(e),_I(),Ve(r(e?"✅ 已改用本地量级词(万 / 亿式)":"✅ 已改用 k / M 缩写"))}function fS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ma({status:"unavailable"});return}const t=e;Ma({status:"ready",closeToTray:t.closeToTray===!0,autostart:t.autostart===!0,lanAccess:t.lanAccess===!0,lanPanel:t.lanPanel===!0,lightweightMode:t.lightweightMode===!0})}async function LI(){try{fS(await tt().workbuddyDesktop?.getAppSettings())}catch(e){console.warn("读取应用设置失败:",_t(e)),fS(null)}}async function rW(){const e=tt().workbuddyDesktop;if(e?.localIp){try{Ma({lanIp:await e.localIp()||null})}catch{}try{const t=Number((await e.getBackendStatus?.())?.port)||0;t&&Ma({port:t})}catch{}try{const t=(await e.panelAdminStatus?.())?.registered===!0;Ma({adminRegistered:t})}catch{}}}async function pS(e,t){if(En){nl();return}const a=dt.app,o={closeToTray:e==="tray"?t:a.closeToTray,autostart:e==="autostart"?t:a.autostart,lanAccess:a.lanAccess,lanPanel:a.lanPanel,lightweightMode:e==="lightweight"?t:a.lightweightMode};ds("app"),Ma(o);const c=r(e==="autostart"?"开机自动启动":e==="lightweight"?"轻量模式":"关闭窗口时最小化到托盘");try{const d=tt().workbuddyDesktop;if(!d)throw new Error(r("主进程桥不可用"));const f=await d.saveAppSettings(o);Ma({status:"ready",...QZ(f,o)}),Ve(r("✅ 已更新「{label}」",{label:c}))}catch(d){Ma(a),Ve(r("保存失败:{message}",{message:_t(d)}),"err")}finally{as()}}function aW(e){if(En){nl();return}Ze({lanConfirm:{mode:e?"enable":"disable",panel:dt.app.lanPanel}})}function lW(e){if(En){nl();return}Ze({lanConfirm:{mode:"panel",panel:e}})}function mS(e){const t=dt.lanConfirm;if(Ze({lanConfirm:null}),!(!t||!e)){if(t.mode==="disable"){Dx(!1,!1);return}if(t.mode==="panel"){Dx(!0,t.panel);return}oW()}}async function oW(){const e=tt().workbuddyDesktop;if(!e?.panelAdminStatus){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan");let t;try{t=(await e.panelAdminStatus())?.registered===!0}catch(a){as(),Ve(r("查询管理员状态失败:{message}",{message:_t(a)}),"err");return}if(as(),Ma({adminRegistered:t}),t){await Dx(!0,dt.app.lanPanel);return}Ze({lanRegister:{busy:!1,error:""}})}async function iW(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.panelRegister)return;const o=e.trim();if(!o||o.length>64){Ze({lanRegister:{busy:!1,error:r("请填写管理员账号(64 字符以内)")}});return}if(t.length<8){Ze({lanRegister:{busy:!1,error:r("密码至少 8 位")}});return}Ze({lanRegister:{busy:!0,error:""}});try{if(await a.panelRegister(o,t),dt.lanRegister===null)return;Ze({lanRegister:null}),Ma({adminRegistered:!0}),await Dx(!0,dt.app.lanPanel)}catch(c){Ze({lanRegister:{busy:!1,error:_t(c)}})}}function zI(){Ze({lanRegister:null})}async function Dx(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.changeLanAccess){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan"),Ma({lanAccess:e,lanPanel:t});try{(await a.changeLanAccess(e,t))?.createdKey&&Ve(r("✅ 已自动创建网关 Key「默认」(可在「网关 Key」页查看)")),Ve(r("✅ 设置已保存,应用正在重启…"))}catch(o){Ve(r("保存失败:{message}",{message:_t(o)}),"err"),await LI()}finally{as()}}async function cW(){if(!En){Ze({ioFailure:null}),ds("export");try{const e=await tt().workbuddyDesktop?.exportAccounts();if(e?.canceled){Ve(r("已取消导出"));return}const t=Number(e?.count)||0,a=Number(e?.customProviders)||0;if(!t&&!a){Ve(r("没有可导出的账号"),"err");return}const o=a?r("、{n} 个自定义提供商",{n:a}):"",c=e?.file?r(" 到 {file}",{file:e.file}):"";Ve(r("✅ 已导出 {count} 个账号{note}{file}",{count:t,note:o,file:c}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}async function uW(){if(!En){Ze({ioFailure:null}),ds("import");try{const e=await tt().workbuddyDesktop?.importAccounts();if(e?.canceled){Ve(r("已取消导入"));return}const t=Number(e?.added)||0,a=Number(e?.updated)||0,o=Number(e?.skipped)||0,c=Number(e?.failed)||0,d=Array.isArray(e?.errors)?e.errors:[],f=e?.customProviders??{},p=Number(f.added)||0,h=Number(f.updated)||0,b=[];o&&b.push(r("跳过 {n} 个",{n:o})),c&&b.push(r("失败 {n} 个",{n:c}));const y=b.length?r(",{items}",{items:b.join(r("、"))}):"",v=p||h?r(",自定义提供商新增 {added} 个、更新 {updated} 个",{added:p,updated:h}):"",w=r("新增 {added} 个、更新 {updated} 个{suffix}{note}",{added:t,updated:a,suffix:y,note:v});if(c){Ve(r("导入完成:{summary}",{summary:w}),"err");const j=d.slice(0,3).map(S=>{const N=S?.customProvider?r("自定义提供商 {id}",{id:S?.id||r("(无 id)")}):S?.id??r("未知账号"),k=S?.message??r("未知原因");return r("{label}({message})",{label:N,message:k})}).join(r(";"));Ze({ioFailure:{failed:c,detail:j,more:d.length>3}})}else Ve(r("✅ 导入完成:{summary}",{summary:w}));(t||a||p||h)&&await tt().wbApp?.refresh?.()}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function dW(e){Ze({dbIncludeLogs:e})}async function fW(){if(!En){ds("dbExport");try{const e=tt().workbuddyDesktop;if(!e?.exportDatabase){Ve(r("当前环境不支持整库备份(仅桌面端可用)"),"err");return}const t=await e.exportDatabase(dt.dbIncludeLogs);if(t?.canceled){Ve(r("已取消导出"));return}const a=Number(t?.bytes)||0,o=Array.isArray(t?.tables)?t.tables.length:0;Ve(r("✅ 已备份 {n} 张表({size})到 {file}",{n:o,size:MI(a),file:t?.file||""}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function pW(){En||Ze({dbBackupConfirm:{includeLogs:dt.dbIncludeLogs}})}function hS(e){Ze({dbBackupConfirm:null}),e&&mW()}async function mW(){if(En)return;const e=tt().workbuddyDesktop;if(!e?.importDatabase){Ve(r("当前环境不支持整库恢复(仅桌面端可用)"),"err");return}ds("dbImport"),Ze({dbWarning:null});try{const t=await e.importDatabase(),a=Array.isArray(t?.tables)?t.tables.length:0,o=t?.safetyBackup?r(",替换前的数据已备份为 {name}",{name:t.safetyBackup}):"";Ve(r("✅ 已恢复 {n} 张表{note}",{n:a,note:o}));const c=typeof t?.warning=="string"?t.warning.trim():"";c&&Ze({dbWarning:c}),await ES(),await tt().wbApp?.refresh?.()}catch(t){Ve(r("恢复失败:{message}",{message:_t(t)}),"err")}finally{as()}}function Ix(e){if(e===void 0)return;const t=OI(oS,e,dt.retention.values);Ze({retention:{status:t===null?"unavailable":"ready",values:t}})}async function Px(){try{Ix(await tt().workbuddyDesktop?.getRetention())}catch(e){console.warn("读取数据保留设置失败:",_t(e)),Ix(null)}}let _x=null;function Lx(e){const t=_x;_x=null,Ze({retentionConfirm:null}),t?.(e)}function hW(e){return new Promise(t=>{_x&&Lx(!1),_x=t,Ze({retentionConfirm:{head:e}})})}function gW(e,t,a){return t===null?r("没能读到「{label}」的当前值,改为 {days} 天可能会删除超出的历史数据。",{label:e.label,days:a}):r("「{label}」将从 {previous} 天改为 {days} 天。",{label:e.label,previous:t,days:a})}async function xW(e,t){if(En||dt.retentionConfirm)return;const a=RI(t,e.min,e.max,r("天数"));if(!a.ok){Ve(a.message,"err");return}const o=dt.retention.values?.[e.key],c=typeof o=="number"&&Number.isInteger(o)?o:null;if(c!==null&&a.value===c)return;const d=c===null||a.valueNumber.isInteger(d?.[f.key]))){const f=d?.[e.key]??t;Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:f}):r("✅ 已保留 {days} 天",{days:f}));return}await Px(),Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:t}):r("✅ 已保留 {days} 天",{days:t}))}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await Px()}finally{as()}}function Np(e,t){if(t===void 0)return;const a=OI(e.fields,t,e.read().values);e.write({status:a===null?"unavailable":"ready",values:a}),e.syncExtras?.(a===null?null:t)}async function Ku(e){try{Np(e,await e.get())}catch(t){console.warn(`${e.consoleLabel}失败:`,_t(t)),Np(e,null)}}async function zx(e,t,a){if(En)return;const o=RI(a,t.min,t.max,t.label);if(!o.ok){Ve(o.message,"err");return}const c=e.read().values?.[t.key];if(Number.isInteger(c)&&o.value===c)return;ds(e.scope);const d=e.read().values;d&&e.write({status:"ready",values:{...d,[t.key]:o.value}});try{const f=await e.save({[t.key]:o.value});Np(e,f);const p=e.read().values?.[t.key],h=Number.isInteger(p)?p:o.value;Ve(r("✅ 已保存:{label} {value}",{label:t.label,value:String(h)}))}catch(f){Ve(r("保存失败:{message}",{message:_t(f)}),"err"),await Ku(e)}finally{as()}}const BI={scope:"queue",fields:TI,consoleLabel:"读取排队等待设置",get:()=>tt().workbuddyDesktop?.getQueue(),save:e=>tt().workbuddyDesktop?.saveQueue(e),read:()=>dt.queue,write:e=>Ze({queue:e})};async function HI(){await Ku(BI)}async function vW(e,t){await zx(BI,e,t)}const UI={scope:"captchaPool",fields:DI,consoleLabel:"读取验证码令牌池设置",get:()=>tt().workbuddyDesktop?.getCaptchaPool(),save:e=>tt().workbuddyDesktop?.saveCaptchaPool(e),read:()=>dt.captchaPool,write:e=>Ze({captchaPool:e})};async function VI(){await Ku(UI)}async function yW(e,t){await zx(UI,e,t)}const FI="routingStrategy",$I="routingSticky",wW="routingFailoverBackoff",jW="routingSink",SW="routingBreakerEnabled",NW={[FI]:new Set(Ox.map(e=>e.value)),[$I]:new Set(Mx.map(e=>e.value))};function qI(e){const t=e&&typeof e=="object"?e:{},a=(c,d)=>{const f=t[c];return typeof f=="string"&&NW[c].has(f)?f:d},o=(c,d)=>{const f=t[c];return typeof f=="boolean"?f:d};return{strategy:a(FI,"order"),sticky:a($I,"auto"),failoverBackoff:o(wW,!0),sink:o(jW,!0),breakerEnabled:o(SW,!1)}}async function Bx(){try{const e=await tt().workbuddyDesktop?.getRoutingConfig();if(e===void 0){Ze({routing:{...dt.routing,status:"unavailable"}});return}Ze({routing:{status:"ready",...qI(e)}})}catch(e){console.warn("读取路由设置失败:",_t(e)),Ze({routing:{...dt.routing,status:"unavailable"}})}}async function gS(e){if(En)return;const t=tt().workbuddyDesktop;if(!t?.setRoutingConfig){Ve(r("桌面运行时不可用,暂时无法保存"),"err");return}ds("routing");try{const a=await t.setRoutingConfig(e);a!==void 0?Ze({routing:{status:"ready",...qI(a)}}):await Bx(),Ve(r("✅ 路由设置已保存"))}catch(a){Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await Bx()}finally{as()}}const kp={scope:"retry",fields:kI,consoleLabel:"读取请求重试设置",get:()=>tt().workbuddyDesktop?.getRetry(),save:e=>tt().workbuddyDesktop?.saveRetry(e),read:()=>dt.retry,write:e=>Ze({retry:e}),syncExtras:e=>{if(e===null){Ze({retryCodes:null});return}const t=e[EI];if(!Array.isArray(t))return;Ze({retryCodes:t.filter(o=>typeof o=="number"&&Number.isInteger(o)&&o>=iS&&o<=cS)})}};function kW(e){Np(kp,e)}async function GI(){await Ku(kp)}async function CW(e,t){await zx(kp,e,t)}async function xS(e){if(!En){Ze({retryCodes:e}),ds("codes");try{const t=await tt().workbuddyDesktop?.saveRetry({[EI]:e});Np(kp,t),Ve(r("✅ 已保存:指定错误码直接换号"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await Ku(kp)}finally{as()}}}async function TW(e){const t=dt.retryCodes;if(t===null)return;const a=String(e??"").trim();if(!a)return;if(!/^\d+$/.test(a)||Number(a)cS){Ve(r("状态码必须是 {min}–{max} 的整数(收到: {text})",{min:iS,max:cS,text:a}),"err");return}const o=Number(a);if(t.includes(o)){Ve(r("状态码 {code} 已在名单里",{code:o}));return}if(t.length>=AI){Ve(r("名单最多 {max} 个状态码",{max:AI}),"err");return}await xS([...t,o])}async function EW(e){const t=dt.retryCodes;!t||!t.includes(e)||await xS(t.filter(a=>a!==e))}async function AW(){const e=dt.retryCodes;e?.length&&await xS(e.slice(0,-1))}const KI={scope:"timeouts",fields:CI,consoleLabel:"读取请求超时设置",get:()=>tt().workbuddyDesktop?.getTimeouts(),save:e=>tt().workbuddyDesktop?.saveTimeouts(e),read:()=>dt.timeouts,write:e=>Ze({timeouts:e})};async function YI(){await Ku(KI)}async function RW(e,t){await zx(KI,e,t)}function Hx(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({debug:{status:"unavailable",on:!1,count:null,limit:null}});return}const t=e,a=Number(t.count),o=Number(t.limit);Ze({debug:{status:"ready",on:t.debugMode===!0,count:Number.isInteger(a)?a:null,limit:Number.isInteger(o)?o:null}})}async function bS(){try{Hx(await tt().workbuddyDesktop?.getDebug())}catch(e){console.warn("读取调试模式设置失败:",_t(e)),Hx(null)}}async function OW(e){if(En){nl();return}ds("debug"),Ze({debug:{...dt.debug,on:e}});try{const t=await tt().workbuddyDesktop?.saveDebug(e);Hx(t),Ve(r(e?"✅ 调试模式已开启":"✅ 调试模式已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await bS()}finally{as()}}function Ux(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({sanitize:{status:"unavailable",on:!1}});return}Ze({sanitize:{status:"ready",on:e.sanitizeBlacklistFingerprints===!0}})}async function vS(){try{Ux(await tt().workbuddyDesktop?.getSanitize())}catch(e){console.warn("读取出站指纹脱敏设置失败:",_t(e)),Ux(null)}}async function MW(e){if(En){nl();return}ds("sanitize"),Ze({sanitize:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveSanitize(e);Ux(t),Ve(r(e?"✅ 出站指纹脱敏已开启":"已关闭出站指纹脱敏"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await vS()}finally{as()}}function yS(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function wS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({clineHeaders:{status:"unavailable",defaults:{},overrides:{},effective:{}}});return}const t=e;Ze({clineHeaders:{status:"ready",defaults:yS(t.defaults),overrides:yS(t.overrides),effective:yS(t.effective)}})}async function jS(){try{wS(await tt().workbuddyDesktop?.getClineHeaders())}catch(e){console.warn("读取 Cline 伪装头失败:",_t(e)),wS(null)}}async function DW(){await jS(),Ve(r("Cline 伪装头已刷新"))}async function XI(e){if(En){nl();return}ds("clineHeaders");try{const t=await tt().workbuddyDesktop?.saveClineHeaders(e);wS(t),Ve(r("✅ Cline 伪装头已保存"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await jS()}finally{as()}}function SS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({cors:{status:"unavailable",on:!1}});return}Ze({cors:{status:"ready",on:e.corsEnabled===!0}})}async function NS(){try{SS(await tt().workbuddyDesktop?.getCors())}catch(e){console.warn("读取网关跨域访问设置失败:",_t(e)),SS(null)}}async function IW(e){if(En){nl();return}ds("cors"),Ze({cors:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveCors(e);SS(t),Ve(r(e?"网关跨域访问已开启":"已关闭网关跨域访问"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await NS()}finally{as()}}async function QI(){try{const e=await tt().workbuddyDesktop?.getCaptchaSetting();Ze({captcha:{available:!0,enabled:e?.captchaEnabled===!0}})}catch(e){Ze({captcha:{available:!1,enabled:!1}}),console.warn("读取机器人校验设置失败:",_t(e))}}async function PW(e){if(En){nl();return}ds("captcha"),Ze({captcha:{...dt.captcha,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveCaptchaSetting(e);Ze({captcha:{available:!0,enabled:t?.captchaEnabled===!0}}),Ve(r(e?"✅ 机器人校验已开启":"⚠️ 机器人校验已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await QI()}finally{as()}}function kS(e){return!e||typeof e!="object"?{status:"unavailable",enabled:!0,source:"",updatedAt:0,count:0}:{status:"ready",enabled:e.modelsDevEnabled!==!1,source:typeof e.source=="string"?e.source:"",updatedAt:Number(e.updatedAt)||0,count:Number(e.count)||0}}async function CS(){try{const e=await tt().workbuddyDesktop?.getModelsDev?.();Ze({modelsDev:kS(e)})}catch(e){Ze({modelsDev:{...dt.modelsDev,status:"unavailable"}}),console.warn("读取 models.dev 元数据设置失败:",_t(e))}}async function _W(e){if(En){nl();return}ds("modelsDev"),Ze({modelsDev:{...dt.modelsDev,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveModelsDev?.(e);Ze({modelsDev:kS(t)}),Ve(r(e?"✅ models.dev 模型元数据已开启":"已关闭 models.dev 联网刷新"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await CS()}finally{as()}}async function LW(){if(En){nl();return}ds("modelsDevRefresh");try{const e=await tt().workbuddyDesktop?.refreshModelsDev?.();Ze({modelsDev:kS(e?.status)});const t=e?.result,a=String(t?.status||"");a==="refreshed"?Ve(r("models.dev 元数据已更新({count} 条)",{count:Number(t?.count)||0})):a==="failed"?Ve(r("刷新失败:{message}",{message:String(t?.message||"")}),"err"):Ve(String(t?.message||r("本次无需刷新")))}catch(e){Ve(r("刷新失败:{message}",{message:_t(e)}),"err"),await CS()}finally{as()}}function Yu(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({prompt:{...dt.prompt,status:"unavailable"}});return}const t=e,a=HW(t.promptGateway);Ze({prompt:{status:"ready",mode:String(t.promptMode||"passthrough"),file:String(t.promptFile||""),text:String(t.promptText||""),source:String(t.promptSource||""),lines:Number(t.promptLines)||0,fileError:String(t.promptFileError||""),degradeActive:t.degradeActive===!0,degradeUntilText:String(t.degradeUntilText||""),providers:zW(t.promptProviders,a),gateway:a,gatewayText:UW(t.promptGatewayText),options:BW(t.promptProviderOptions)}})}function zW(e,t){return!e||typeof e!="object"?[]:Object.entries(e).filter(([a,o])=>!!a&&!!o&&typeof o=="object").map(([a,o])=>{const c=o;return{id:a,mode:String(c.promptMode||"passthrough"),file:String(c.promptFile||""),text:String(c.promptText||""),source:String(c.promptSource||""),lines:Number(c.promptLines)||0,fileError:String(c.promptFileError||""),gateway:t[a]??!0,configured:!0}}).sort((a,o)=>a.id.localeCompare(o.id))}function BW(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&String(t.id||"")).map(t=>{const a=t;return{id:String(a.id),label:String(a.label||a.id),gatewayNote:String(a.gatewayNote||""),gatewayChars:Number(a.gatewayChars)||0,gatewayBlocks:VW(a.gatewayBlocks)}}):[]}function HW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();!c||typeof o!="boolean"||(t[c]=o)}return t}function UW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();if(!c||!o||typeof o!="object")continue;const d=o,f={identity:"",stable:"",dynamic:""};let p=!1;for(const h of["identity","stable","dynamic"]){const b=String(d[h]||"");f[h]=b,b.trim()&&(p=!0)}p&&(t[c]=f)}return t}function VW(e){if(!e||typeof e!="object")return null;const t=e,a={identity:String(t.identity||""),stable:String(t.stable||""),dynamic:String(t.dynamic||"")};return!a.identity.trim()&&!a.stable.trim()&&!a.dynamic.trim()?null:a}async function rc(){try{Yu(await tt().workbuddyDesktop?.getPrompt())}catch(e){console.warn("读取系统提示词设置失败:",_t(e)),Yu(null)}}async function Cp(e,t){if(En)return await rc(),!1;ds("prompt");try{const a=await tt().workbuddyDesktop?.savePrompt(t);return Yu(a),Ve(r("✅ 已保存:{label}",{label:e})),!0}catch(a){return Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await rc(),!1}finally{as()}}async function FW(e){const t=zo.find(a=>a.value===e);await Cp(r("模式改为「{mode}」",{mode:t?.toastLabel??e}),{promptMode:e})}async function $W(e){await Cp(e.trim()?r("提示词文件已更新"):r("已改回内置默认提示词"),{promptFile:e})}async function qW(e){const t=!e.trim();return Cp(r(t?"已清掉界面编辑的提示词(回落文件 / 内置默认)":"提示词正文已更新"),{promptText:t?"":e})}function Bo(e,t){return e.options.find(a=>a.id===t)?.label||t}function ac(e){const t=e==null?"":String(e).trim();return t&&dt.prompt.options.some(a=>a.id===t)?t:""}async function Tp(e,t,a){return Cp(e,{promptProviders:{[t]:a}})}function Vx(e,t){const a=!t.configured;return{promptMode:t.mode,promptFile:t.file,promptText:a&&e.source==="inline"?e.text:""}}async function GW(e){const t=ac(e);if(!t)return;const a=dt.prompt;await Tp(r("已为「{label}」单独配置提示词",{label:Bo(a,t)}),t,Vx(a,{mode:a.mode,file:a.file,text:a.text,source:a.source,lines:a.lines,fileError:a.fileError,gateway:a.gateway[t]??!0,configured:!1}))}async function KW(e,t){const a=ac(e.id);if(!a||!zo.some(c=>c.value===t))return;const o=zo.find(c=>c.value===t);await Tp(r("「{label}」的模式改为「{mode}」",{label:Bo(dt.prompt,a),mode:o?.toastLabel??t}),a,{...Vx(dt.prompt,e),promptMode:t})}async function YW(e,t){const a=ac(e.id);a&&await Tp(t.trim()?r("「{label}」的提示词文件已更新",{label:Bo(dt.prompt,a)}):r("「{label}」改用内置默认提示词",{label:Bo(dt.prompt,a)}),a,{...Vx(dt.prompt,e),promptFile:t})}async function XW(e,t){const a=ac(e.id);if(!a)return!1;const o=!t.trim(),c=Bo(dt.prompt,a);return Tp(o?r("已清掉「{label}」界面编辑的正文",{label:c}):r("「{label}」的提示词正文已更新",{label:c}),a,{...Vx(dt.prompt,e),promptText:o?"":t})}async function QW(e){const t=ac(e);t&&await Tp(r("已取消「{label}」的单独配置",{label:Bo(dt.prompt,t)}),t,null)}async function ZW(e,t){const a=ac(e);if(!a)return;const o=Bo(dt.prompt,a);if(En){await rc();return}ds("prompt");try{const c=await tt().workbuddyDesktop?.savePrompt({promptGateway:{[a]:t}});Yu(c),Ve(t?r("✅ 已为「{label}」装上网关自带提示词",{label:o}):r("已关闭「{label}」的网关自带提示词:能否通过上游校验取决于上游当前口径",{label:o}),t?"ok":"err")}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await rc()}finally{as()}}async function WW(e,t){const a=ac(e);if(!a)return!1;const o=Bo(dt.prompt,a),c=!t||!(t.identity.trim()||t.stable.trim()||t.dynamic.trim());return Cp(c?r("「{label}」的网关自带提示词已改回官方原文",{label:o}):r("「{label}」的网关自带提示词正文已更新",{label:o}),{promptGatewayText:{[a]:c?null:t}})}async function JW(){if(!En){ds("prompt");try{const e=await tt().workbuddyDesktop?.savePrompt({clearDegrade:!0});Yu(e),Ve(r("✅ 已解除内容拦截降级"))}catch(e){Ve(r("解除失败:{message}",{message:_t(e)}),"err"),await rc()}finally{as()}}}function Ep(e){const t=Number(e);return Number.isFinite(t)?t:null}function TS(e){if(e===void 0)return;const t=e&&typeof e=="object"?e.database:null;if(!t||typeof t!="object"){Ze({storage:{...dt.storage,status:"unavailable"}});return}const a=t;Ze({storage:{status:"ready",available:a.available!==!1,file:String(a.file||""),bytes:Number(a.bytes)||0,accounts:Ep(a.accounts),logs:Ep(a.logs),requests:Ep(a.requests),dailyDays:Ep(a.dailyDays),debug:Ep(a.debug)}})}async function ZI(){try{TS(await tt().workbuddyDesktop?.getStorage())}catch(e){console.warn("读取数据存储概况失败:",_t(e)),TS(null)}}async function eJ(){try{return await tt().workbuddyDesktop?.panelLogout(),window.location.href="/login",!0}catch(e){return Ve(r("退出失败:{message}",{message:_t(e)}),"err"),!1}}async function ES(){PI(),_I(),Ze({panelLogin:II()}),await Promise.all([LI(),rW(),Px(),GI(),YI(),HI(),VI(),Bx(),bS(),vS(),jS(),NS(),rc(),ZI(),QI(),CS(),tt().wbUpdatePanel?.load?.()])}async function tJ(){await Px(),Ve(r("保留天数已刷新"))}async function nJ(){await GI(),Ve(r("重试设置已刷新"))}async function sJ(){await YI(),Ve(r("超时设置已刷新"))}async function rJ(){await HI(),Ve(r("排队等待设置已刷新"))}async function aJ(){await VI(),Ve(r("验证码令牌池设置已刷新"))}async function lJ(){await Bx(),Ve(r("路由设置已刷新"))}async function oJ(){await bS(),Ve(r("调试模式设置已刷新"))}async function iJ(){await vS(),Ve(r("指纹脱敏设置已刷新"))}async function cJ(){await NS(),Ve(r("网关跨域访问设置已刷新"))}async function uJ(){await rc(),Ve(r("系统提示词设置已刷新"))}async function dJ(){await ZI(),Ve(r("存储概况已刷新"))}const Fx=[{key:"identity",label:r("第一段(身份句)"),short:r("第一段"),hint:r("官方原文只有一句:声明自己是 ZCode。")},{key:"stable",label:r("第二段(稳定段)"),short:r("第二段"),hint:r("工具用法与环境说明那一大段。")},{key:"dynamic",label:r("第三段(动态段)"),short:r("第三段"),hint:r("沟通方式 / 上下文管理 + Environment 段。")}];function fJ(e){return r(e==="inline"?"界面里编辑的正文":e==="file"?"提示词文件":e==="builtin"?"内置默认提示词":"(未生效)")}function WI({title:e,text:t,source:a,file:o,disabled:c,save:d,onClose:f}){const[p,h]=x.useState(t),[b,y]=x.useState(!1),v=b||c,w=p!==t;async function j(S){y(!0);try{await d(S)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:S=>{S||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("保存后以这里的文本为准")}),s.jsxs("p",{children:[r("这一份就是「替换 / 追加」模式下网关要发的 system 正文。"),a==="none"?r("当前是透传模式:存下来也不会发出,切成「替换 / 追加」之后才生效。"):r("当前生效的正文来自{source}{file}。保存后这一份会盖过提示词文件与内置默认{note}。",{source:fJ(a),file:o.trim()&&a!=="inline"?r("(文件:{path})",{path:o.trim()}):"",note:a!=="inline"&&o.trim()?r(",文件里后续的改动在清空这里之前不再生效"):""}),r("想回到原来那份,把这里清空再保存即可(不会删掉你配的文件路径)。")]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"settings-prompt-body",children:r("提示词正文")}),s.jsx(Qc,{id:"settings-prompt-body",rows:18,className:"min-h-[320px]",spellCheck:!1,disabled:v,value:p,onChange:S=>h(S.currentTarget.value)}),s.jsx("div",{className:"hint",children:p.trim()?r("{lines} 行、{chars} 字符(按当前草稿计)",{lines:p.split(` +`).length,chars:p.length}):r("空 = 不要这一份,回落提示词文件 / 内置默认提示词。")})]})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||a!=="inline",onClick:()=>{j("")},children:r("清除这里的正文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{j(p)},children:r(b?"保存中…":"保存")})]})]})})}function pJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-prompt-edit-body",variant:"outline",disabled:t||a,onClick:()=>c(!0),children:r("编辑正文")}),o?s.jsx(WI,{title:r("编辑提示词正文 · 全局"),text:e.text,source:e.source,file:e.file,disabled:a,save:qW,onClose:()=>c(!1)}):null]})}function mJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-edit-body-${e.id}`,variant:"outline",disabled:a||o,onClick:()=>d(!0),children:r("编辑正文")}),c?s.jsx(WI,{title:r("编辑提示词正文 · {label}",{label:t}),text:e.text,source:e.source,file:e.file,disabled:o,save:f=>XW(e,f),onClose:()=>d(!1)}):null]})}function hJ({id:e,title:t,official:a,over:o,enabled:c,disabled:d,onClose:f}){const[p,h]=x.useState(()=>({identity:o?.identity?.trim()?o.identity:a.identity,stable:o?.stable?.trim()?o.stable:a.stable,dynamic:o?.dynamic?.trim()?o.dynamic:a.dynamic})),[b,y]=x.useState(!1),v=b||d,w=Fx.some(N=>p[N.key]!==a[N.key]),j=Fx.filter(N=>o?.[N.key]?.trim()).map(N=>N.label);async function S(N){y(!0);try{await WW(e,N)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("三段各自成块,所以分开编辑")}),s.jsxs("p",{children:[r("上游按"),s.jsx("strong",{children:r("结构")}),r("校验身份:这三段必须各自成块排在最前(实测:三段并成一段会被回 405 / 3012)。因此这里按段编辑,不能合成一段。改过的段以你的文本为准,没改的段继续用官方原文;清空某一段 = 那一段恢复官方原文。"),j.length?r("当前已改过:{edited}。",{edited:j.join(r("、"))}):r("当前三段都是官方原文。"),c?"":r("注意:这一家的「网关自带」开关现在是关的,改过的正文要等开关打开才生效。")]}),s.jsx("p",{children:$n.promptGatewayText})]}),Fx.map(N=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs(Je,{htmlFor:`settings-prompt-block-${e}-${N.key}`,children:[N.label,s.jsx("span",{className:"ml-2 font-normal text-subtle",children:p[N.key]===a[N.key]?r("(官方原文)"):r("(已改)")})]}),s.jsx(Qc,{id:`settings-prompt-block-${e}-${N.key}`,rows:N.key==="identity"?2:10,className:N.key==="identity"?"min-h-[64px]":"min-h-[200px]",spellCheck:!1,disabled:v,value:p[N.key],onChange:k=>{const T=k.currentTarget.value;h(D=>({...D,[N.key]:T}))}}),s.jsx("div",{className:"hint",children:N.hint})]},N.key))]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||!j.length,onClick:()=>{S(null)},children:r("恢复官方原文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{S(p)},children:r(b?"保存中…":"保存")})]})]})})}function gJ({item:e,option:t,over:a,locked:o,busy:c}){const[d,f]=x.useState(!1),p=t.gatewayBlocks;return p?s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-gateway-text-${e.id}`,variant:"outline",disabled:o||c,onClick:()=>f(!0),children:r("编辑正文")}),d?s.jsx(hJ,{id:e.id,title:r("编辑网关自带提示词 · {label}",{label:t.label}),official:p,over:a,enabled:e.gateway,disabled:c,onClose:()=>f(!1)}):null]}):null}function xJ(e){return e?Fx.filter(t=>(e[t.key]||"").trim()).map(t=>t.short).join(r("、")):""}function JI(e,t){return tt().wbIcons?.icon?.(e,t)||""}function cn({tone:e,children:t}){const a=e==="ok"?"success":e==="bad"?"destructive":"outline";return s.jsx(ze,{variant:a,children:t})}function Qn({title:e,tip:t,badge:a,actions:o}){return s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]})}function bJ({title:e,tip:t,badge:a,actions:o,children:c}){function d(f){f.target.closest(".tip-q, .head-actions")&&f.preventDefault()}return s.jsxs("details",{className:"panel panel-fold",children:[s.jsxs("summary",{className:"panel-head",onClick:d,children:[s.jsx("span",{className:"fold-caret","aria-hidden":!0,dangerouslySetInnerHTML:{__html:JI("caretRight",14)}}),s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]}),c]})}function da({id:e,label:t,checked:a,disabled:o,tip:c,onCheckedChange:d}){return s.jsxs("label",{className:"switch",children:[s.jsx(hs,{id:e,checked:a,disabled:o,onCheckedChange:f=>d(f)}),s.jsx("span",{children:t}),c?s.jsx("span",{className:"tip-q","data-tip":c}):null]})}function Ap({field:e,value:t,disabled:a,onCommit:o}){const[c,d]=x.useState(null),f=c!==null?c:t===null?"":String(t);async function p(){const h=c;if(h!==null)try{await o(h)}finally{d(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:e.id,children:e.label}),s.jsxs("span",{className:"retention-input",children:[s.jsx($e,{id:e.id,type:"number",min:e.min,max:e.max,step:1,inputMode:"numeric",className:"w-[92px] max-w-[92px] text-center tabular-nums",value:f,disabled:a||t===null,onChange:h=>d(h.target.value),onFocus:()=>d(String(t??"")),onBlur:()=>{p()},onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}}),s.jsx("span",{className:"unit",children:e.unit})]}),s.jsx("div",{className:"hint",children:e.hint})]})}function Rp(e){return e.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}function Br({id:e,onClick:t}){return s.jsx(se,{id:e,variant:"outline",onClick:t,children:r("刷新")})}function vJ(e){const{lanAccess:t,lanPanel:a,lanIp:o,port:c}=e.app;if(!t)return r("未开启:网关只监听 127.0.0.1,仅本机可以访问。");const d=`http://${o||r("<本机IP>")}${c?`:${c}`:""}`,f=a?r(";网页管理面板已一并开放(浏览器打开同一地址)"):"";return r("已开启:其他设备把 API 地址指向 {url}{panel}。",{url:`${d}/v1`,panel:f})}function yJ({snap:e}){const t=e.app,a=t.status==="unavailable"?Ut.appUnavailable:t.status==="loading"?Ut.appLoading:t.closeToTray?t.lightweightMode?Ut.appLightOn:Ut.appTrayOn:Ut.appTrayOff;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("启动与托盘"),tip:rs.tray,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已应用")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-close-to-tray",label:r("关闭窗口时最小化到托盘"),checked:t.closeToTray,disabled:e.busy==="app",onCheckedChange:o=>{pS("tray",o)}}),s.jsx(da,{id:"settings-lightweight",label:r("轻量模式(关窗释放界面内存)"),tip:rs.lightweight,checked:t.lightweightMode,disabled:e.busy==="app"||!t.closeToTray,onCheckedChange:o=>{pS("lightweight",o)}}),s.jsx(da,{id:"settings-autostart",label:r("开机自动启动"),checked:t.autostart,disabled:e.busy==="app",onCheckedChange:o=>{pS("autostart",o)}})]}),s.jsx("div",{className:"settings-state",children:a})]})]}),!e.panelLogin&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("局域网访问"),tip:rs.lan}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-lan-access",label:r("允许局域网内的设备访问网关"),checked:e.app.lanAccess,disabled:e.busy==="lan",onCheckedChange:aW}),s.jsx(da,{id:"settings-lan-panel",label:r("同时开放网页管理面板"),checked:e.app.lanPanel,disabled:e.busy==="lan"||!e.app.lanAccess,onCheckedChange:lW})]}),s.jsx("div",{className:"settings-state",children:vJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("计量单位"),tip:rs.units}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-chinese-units",label:r("使用中文单位(亿 / 万)"),checked:e.unitsChinese,onCheckedChange:sW})}),s.jsx("div",{className:"settings-state",children:e.unitsChinese?Ut.unitsOn:Ut.unitsOff})]})]})]})}function wJ(e){return e==="light"?Ut.themeLight:e==="dark"?Ut.themeDark:Ut.themeSystem}function jJ(){const[e,t]=x.useState(YZ),[a,o]=x.useState(XZ),c=tt().workbuddyDesktop?.platform==="web";x.useEffect(()=>{const f=h=>t(String(h.detail||"system")),p=h=>o(Number(h.detail)||100);return window.addEventListener(jI,f),window.addEventListener(SI,p),()=>{window.removeEventListener(jI,f),window.removeEventListener(SI,p)}},[]);const d=a===100?r("100%(默认)"):`${a}%`;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("显示模式"),tip:rs.displayTheme}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{children:s.jsx(In,{"aria-label":r("显示模式"),options:KZ,value:e,onValueChange:f=>tt().wbApp?.applyTheme?.(f)})}),s.jsx("div",{className:"settings-state",children:wJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("界面缩放"),tip:rs.displayZoom}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-zoom",children:r("缩放比例")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:String(a),onValueChange:f=>tt().wbApp?.applyZoom?.(Number(f)),children:[s.jsx(mt,{id:"settings-zoom",className:"w-[140px]",disabled:c,"aria-label":r("界面缩放比例"),children:s.jsx(pt,{children:d})}),s.jsx(ht,{children:GZ.map(f=>s.jsx(qe,{value:String(f),children:f===100?r("100%(默认)"):`${f}%`},f))})]})}),s.jsx("div",{className:"hint",children:r("放大或缩小整个界面(文字与控件一起变),效果与浏览器 Ctrl +/- 相同:共 11 档,立即生效并记住。")})]})}),s.jsx("div",{className:"settings-state",children:c?Ut.zoomWeb:a===100?Ut.zoomDefault:r("当前按 {n}% 显示。",{n:a})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("语言设置"),tip:rs.displayLanguage}),s.jsxs("div",{className:"panel-body",children:[s.jsx(SJ,{}),s.jsx("div",{className:"settings-state",children:Ut.languageHint})]})]})]})}function SJ(){const e=window.wbI18n,t=e?.rawLocale?.()??"auto",a=e?.LOCALES??[],o=c=>c==="auto"?r("跟随系统"):a.find(d=>d.code===c)?.label??c;return s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-language",children:r("界面语言")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t,onValueChange:c=>{c&&e?.setLocale(c)},children:[s.jsx(mt,{id:"settings-language",className:"w-[200px]","aria-label":r("界面语言"),children:s.jsx(pt,{children:o(t)})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"auto",children:r("跟随系统")}),a.map(c=>s.jsx(qe,{value:c.code,children:c.label},c.code))]})]})})]})})}function NJ({codes:e,status:t,busy:a}){const[o,c]=x.useState(""),d=x.useRef(null),f=t==="unavailable";return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-retry-no-codes-input",children:r("指定错误码直接换号")}),s.jsx("div",{className:"retention-input",children:s.jsxs("div",{className:f?"tag-input disabled":"tag-input",onClick:()=>d.current?.focus(),children:[(e||[]).map(p=>s.jsxs("span",{className:"tag-chip",children:[s.jsx("span",{className:"v",children:p}),s.jsx(se,{type:"button",variant:"ghost",size:"icon-2xs",className:"tag-x text-muted-foreground hover:bg-destructive-soft hover:text-destructive",title:r("删除 {code}",{code:p}),"aria-label":r("删除状态码 {code}",{code:p}),onClick:h=>{h.stopPropagation(),EW(p)},children:"✕"})]},p)),s.jsx($e,{ref:d,id:"settings-retry-no-codes-input",type:"text",className:"tag-input-field h-auto border-0 bg-transparent px-0 shadow-none focus:shadow-none",placeholder:f?"—":r("输入状态码,回车添加"),inputMode:"numeric",autoComplete:"off",value:o,disabled:f||a,onChange:p=>c(p.target.value),onKeyDown:p=>{if(p.key==="Enter"){p.preventDefault(),TW(o),c("");return}p.key==="Backspace"&&!o&&AW()}})]})}),s.jsx("div",{className:"hint",children:$n.retryCodes})]})}function kJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(null);async function d(){const f=o;if(f!==null)try{await $W(f)}finally{c(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-file",children:r("提示词文件")}),s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:"settings-prompt-file",type:"text",placeholder:r("留空 = 用内置默认提示词"),value:o!==null?o:e.file,disabled:t||a,onChange:f=>c(f.target.value),onFocus:()=>c(e.file),onBlur:()=>{d()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()}})}),s.jsx("div",{className:"hint",children:$n.promptFile})]})}function CJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.promptUnavailable;const t=eP(e.source),a=[];return e.mode==="passthrough"?a.push(r("客户端 system 原样出站(只靠指纹脱敏改写模板句)。")):a.push(r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:t,lines:e.lines?r("({n} 行)",{n:e.lines}):""})),e.fileError&&a.push(`⚠️ ${e.fileError}`),a.join("")}function eP(e){return e==="inline"?r("界面里编辑的正文"):e==="file"?r("提示词文件"):e==="builtin"?r("内置默认提示词"):""}function TJ(e){return r("已自动切换到最小中性提示词(撞了上游内容拦截,多半是 system 指纹误报),到 {until} 自动解除。",{until:e.degradeUntilText||Ut.degradeUntilFallback})+r("期间本模式自己的提示词不会发出;把提示词改好后可以立即解除。")}function EJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(null);async function f(){const p=c;if(p!==null)try{p!==e.file&&await YW(e,p)}finally{d(null)}}return s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:`settings-prompt-file-${e.id}`,type:"text",placeholder:r("留空 = 用内置默认提示词"),"aria-label":r("{label} 提示词文件",{label:t}),value:c!==null?c:e.file,disabled:a||o,onChange:p=>d(p.target.value),onFocus:()=>d(e.file),onBlur:()=>{f()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})})}function AJ(e,t){if(!t)return r("未单独配置:模式、提示词文件与正文都跟随上面的全局配置(当前「{mode}」)。",{mode:zo.find(o=>o.value===e.mode)?.toastLabel??e.mode});if(e.mode==="passthrough")return r("客户端 system 原样出站。");const a=r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:eP(e.source),lines:e.lines?r("({n} 行)",{n:e.lines}):""});return e.fileError?`${a} ⚠️ ${e.fileError}`:a}function RJ({item:e,option:t,over:a,locked:o,busy:c}){const d=e.gateway,f=t.gatewayChars,p=f?r("约 {n} 字符",{n:f.toLocaleString("zh-CN")}):r("一段内置装配"),h=xJ(a);return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{className:"prompt-gateway-label",children:r("网关自带")}),s.jsxs("span",{className:"prompt-input",children:[s.jsx(da,{id:`settings-prompt-gateway-${e.id}`,label:r("装上{size}的官方身份提示词",{size:p}),checked:d,disabled:o||c,onCheckedChange:b=>{ZW(e.id,b)}}),s.jsx(gJ,{item:e,option:t,over:a,locked:o,busy:c})]}),s.jsxs("div",{className:d?"hint":"hint prompt-gateway-off",children:[d?t.gatewayNote:r("已关闭。{note}",{note:t.gatewayNote}),h?r(" 正文已改:{edited}(其余段用官方原文)。",{edited:h}):""]})]})}function OJ({prompt:e,locked:t,busy:a}){const o=e.options,c=new Map(e.providers.map(j=>[j.id,j])),d=[];for(const j of o)j.gatewayNote&&d.push(c.get(j.id)??{id:j.id,mode:e.mode,file:e.file,text:e.text,source:e.source,lines:e.lines,fileError:e.fileError,gateway:e.gateway[j.id]??!0,configured:!1});for(const j of e.providers)d.some(S=>S.id===j.id)||d.push({...j,gateway:e.gateway[j.id]??!0,configured:!0});const f=new Set(d.map(j=>j.id)),p=o.filter(j=>!j.gatewayNote&&!f.has(j.id)),[h,b]=x.useState(""),y=j=>o.find(S=>S.id===j)?.label||j,v=j=>o.find(S=>S.id===j),w=j=>v(j)?.gatewayNote||"";return s.jsxs(s.Fragment,{children:[d.map(j=>{const S=y(j.id),N=zo.find(D=>D.value===j.mode)?.optionLabel??j.mode,k=w(j.id),T=v(j.id);return s.jsxs(x.Fragment,{children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:`settings-prompt-mode-${j.id}`,children:S}),s.jsxs("span",{className:"prompt-input",children:[s.jsxs(ft,{value:j.mode,onValueChange:D=>{D!=null&&String(D)&&KW(j,String(D))},children:[s.jsx(mt,{id:`settings-prompt-mode-${j.id}`,className:"w-[240px]",disabled:t||a,"aria-label":r("{label} 的提示词模式",{label:S}),children:s.jsx(pt,{children:N})}),s.jsx(ht,{children:zo.map(D=>s.jsx(qe,{value:D.value,children:D.optionLabel},D.value))})]}),s.jsx(EJ,{item:j,label:S,locked:t,busy:a}),s.jsx(mJ,{item:j,label:S,locked:t,busy:a}),j.configured?s.jsx(se,{variant:"outline",disabled:t||a,onClick:()=>{QW(j.id)},children:r("跟随默认")}):null]}),s.jsx("div",{className:"hint",children:AJ(j,j.configured)})]}),T&&k?s.jsx(RJ,{item:j,option:T,over:e.gatewayText[j.id],locked:t,busy:a}):null]},j.id)}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-provider-add",children:r("添加提供商")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:h,onValueChange:j=>{b("");const S=j==null?"":String(j);S&&GW(S)},children:[s.jsx(mt,{id:"settings-prompt-provider-add",className:"w-[240px]",disabled:t||a||p.length===0,"aria-label":r("添加要单独配置的提供商"),children:s.jsx(pt,{children:h?y(h):p.length?r("添加提供商…"):r("全部已配置")})}),s.jsx(ht,{children:p.map(j=>s.jsx(qe,{value:j.id,children:j.label},j.id))})]})}),s.jsx("div",{className:"hint",children:$n.promptProviders})]})]})}function MJ({snap:e}){const t=e.prompt,a=t.status!=="ready",o=e.busy==="prompt",c=zo.find(d=>d.value===t.mode)?.optionLabel??t.mode;return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("系统提示词"),tip:rs.prompt,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:t.mode==="passthrough"?r("透传"):r("已接管")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-prompt-refresh",onClick:()=>{uJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"prompt-group",children:[r("全局配置"),s.jsx("span",{className:"note",children:r("所有未单独配置的提供商都用这一份")})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-mode",children:r("模式")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t.mode,onValueChange:d=>{d!=null&&String(d)&&FW(String(d))},children:[s.jsx(mt,{id:"settings-prompt-mode",className:"w-[240px]",disabled:a||o,"aria-label":r("系统提示词模式"),children:s.jsx(pt,{children:c})}),s.jsx(ht,{children:zo.map(d=>s.jsx(qe,{value:d.value,children:d.optionLabel},d.value))})]})}),s.jsx("div",{className:"hint",children:$n.promptMode})]}),s.jsx(kJ,{prompt:t,locked:a,busy:o}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"btn-prompt-edit-body",children:r("提示词正文")}),s.jsx("span",{className:"prompt-input",children:s.jsx(pJ,{prompt:t,locked:a,busy:o})}),s.jsxs("div",{className:"hint",children:[$n.promptText,t.source==="inline"?r("(当前生效的就是这一份,{n} 行)",{n:t.lines}):t.text.trim()?r("(已存一份正文,{n} 行;切成「替换 / 追加」后生效)",{n:t.lines}):""]})]}),s.jsxs("div",{className:"prompt-group",children:[r("按提供商配置"),s.jsx("span",{className:"note",children:r("只列单独配置过的家,其余沿用上面的全局配置")})]}),s.jsx(OJ,{prompt:t,locked:a,busy:o}),t.status==="ready"&&t.degradeActive?s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("内容拦截降级")}),s.jsx("span",{className:"prompt-input",children:s.jsx(se,{id:"btn-prompt-clear-degrade",variant:"outline",disabled:o,onClick:()=>{JW()},children:r("立即解除")})}),s.jsx("div",{className:"hint",children:TJ(t)})]}):null]}),s.jsx("div",{className:"settings-state",children:CJ(t)}),s.jsx("div",{className:"hint retention-note",children:$n.prompt})]})]})}function DJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.debugUnavailable;const t=e.count!==null&&e.limit!==null?r("已保存 {count} / {limit} 条报文(超出后丢弃最旧的)。",{count:e.count,limit:e.limit}):"";return e.on?`${Ut.debugOn}${t}${r("凭据类请求头已脱敏。")}`:Ut.debugOff}function IJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求超时"),tip:rs.timeouts,badge:Rp(e.timeouts),actions:s.jsx(Br,{id:"btn-timeouts-refresh",onClick:()=>{sJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:CI.map(t=>s.jsx(Ap,{field:t,value:e.timeouts.values?.[t.key]??null,disabled:e.busy==="timeouts",onCommit:a=>RW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.timeouts})]})]})}function PJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求重试"),tip:rs.retry,badge:Rp(e.retry),actions:s.jsx(Br,{id:"btn-retry-refresh",onClick:()=>{nJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[kI.map(t=>s.jsx(Ap,{field:t,value:e.retry.values?.[t.key]??null,disabled:e.busy==="retry",onCommit:a=>CW(t,a)},t.key)),s.jsx(NJ,{codes:e.retryCodes,status:e.retry.status,busy:e.busy==="codes"||e.busy==="retry"})]}),s.jsx("div",{className:"hint retention-note",children:$n.retry})]})]})}const _J={routingFailoverBackoff:"failoverBackoff",routingSink:"sink",routingBreakerEnabled:"breakerEnabled"};function LJ({snap:e}){const t=e.routing,a=e.busy==="routing"||t.status!=="ready",o=Ox.find(d=>d.value===t.strategy)?.value??"order",c=Mx.find(d=>d.value===t.sticky)?.value??"auto";return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号路由"),tip:rs.routing,badge:t.status==="ready"?void 0:t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-routing-refresh",onClick:()=>{lJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsx("div",{className:"prompt-group",children:r("选路规则")}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("路由策略")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Ox.find(d=>d.value===o)?.tip}),s.jsx(In,{options:Ox.map(d=>({value:d.value,label:d.label})),value:o,disabled:a,"aria-label":r("路由策略"),onValueChange:d=>{gS({routingStrategy:String(d)})}})]})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("会话粘性")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Mx.find(d=>d.value===c)?.tip}),s.jsx(In,{options:Mx.map(d=>({value:d.value,label:d.label})),value:c,disabled:a,"aria-label":r("会话粘性"),onValueChange:d=>{gS({routingSticky:String(d)})}})]})]}),s.jsxs("div",{className:"prompt-group",children:[r("自愈保护"),s.jsx("span",{className:"note",children:r("默认值通常够用,出问题时才需要调")})]}),WZ.map(d=>{const f=`route-protection-${d.key}`;return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:f,children:d.label}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":d.tip}),s.jsx(hs,{id:f,checked:t[_J[d.key]],disabled:a,onCheckedChange:p=>{gS({[d.key]:p})}})]})]},d.key)})]}),s.jsx("div",{className:"hint retention-note",children:$n.routing})]})]})}function zJ({snap:e}){return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("排队等待"),tip:rs.queue,badge:Rp(e.queue),actions:s.jsx(Br,{id:"btn-queue-refresh",onClick:()=>{rJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:TI.map(t=>s.jsx(Ap,{field:t,value:e.queue.values?.[t.key]??null,disabled:e.busy==="queue",onCommit:a=>vW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.queue})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("验证码令牌池"),tip:rs.captchaPool,badge:Rp(e.captchaPool),actions:s.jsx(Br,{id:"btn-captcha-pool-refresh",onClick:()=>{aJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:DI.map(t=>s.jsx(Ap,{field:t,value:e.captchaPool.values?.[t.key]??null,disabled:e.busy==="captchaPool",onCommit:a=>yW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.captchaPool})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("models.dev 模型元数据"),tip:rs.modelsDev,badge:e.modelsDev.status==="ready"?s.jsx(cn,{tone:"ok",children:r("{count} 条",{count:Number(e.modelsDev.count).toLocaleString("zh-CN")})}):e.modelsDev.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-modelsdev-refresh",onClick:()=>{LW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-modelsdev",label:r("用 models.dev 补齐上游没声明的模型能力与思考档位(联网刷新,内嵌快照始终生效)"),checked:e.modelsDev.enabled,disabled:e.modelsDev.status!=="ready"||e.busy==="modelsDev",onCheckedChange:t=>{_W(t)}}),s.jsx("div",{className:"settings-state",children:VZ(e.modelsDev)}),s.jsx("div",{className:"hint retention-note",children:$n.modelsDev})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("指纹脱敏"),tip:rs.sanitize,badge:e.sanitize.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.sanitize.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-sanitize-refresh",onClick:()=>{iJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-sanitize",label:r("剥离上游审核黑名单指纹(改写请求体里的模板句与表头)"),checked:e.sanitize.on,disabled:e.sanitize.status!=="ready"||e.busy==="sanitize",onCheckedChange:t=>{MW(t)}})}),s.jsx("div",{className:"settings-state",children:e.sanitize.status==="loading"?Ut.appLoading:e.sanitize.status==="unavailable"?Ut.sanitizeUnavailable:e.sanitize.on?Ut.sanitizeOn:Ut.sanitizeOff}),s.jsx("div",{className:"hint retention-note",children:$n.sanitize})]})]}),s.jsx(HJ,{snap:e}),s.jsx(MJ,{snap:e}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("调试模式"),tip:rs.debug,badge:e.debug.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.debug.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-debug-refresh",onClick:()=>{oJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-debug-mode",label:r("保存上游原始报文(请求头、请求体、响应头、响应体)"),checked:e.debug.on,disabled:e.debug.status!=="ready"||e.busy==="debug",onCheckedChange:t=>{OW(t)}})}),s.jsx("div",{className:"settings-state",children:DJ(e.debug)}),s.jsx("div",{className:"hint retention-note",children:$n.debug})]})]})]})}function tP(e){const t=Object.entries(e.defaults).map(([a,o])=>({key:a,value:a in e.overrides?e.overrides[a]:o,isDefault:!0}));for(const[a,o]of Object.entries(e.overrides))a in e.defaults||t.push({key:a,value:o,isDefault:!1});return t}function BJ(e,t){const a=Object.keys(e);return a.length!==Object.keys(t).length?!1:a.every(o=>e[o]===t[o])}function HJ({snap:e}){const t=e.clineHeaders,[a,o]=x.useState(()=>tP(t));x.useEffect(()=>{o(tP(t))},[t]);const c=e.busy==="clineHeaders",d=t.status==="ready";function f(b,y){o(v=>v.map((w,j)=>j===b?{...w,...y}:w))}function p(){const b={};for(const y of a){const v=y.key.trim();v&&(y.isDefault?y.value!==(t.defaults[v]??"")&&(b[v]=y.value):y.value!==""&&(b[v]=y.value))}return b}const h=d&&!BJ(p(),t.overrides);return s.jsx(bJ,{title:r("Cline 伪装头"),tip:rs.clineHeaders,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cline-headers-refresh",onClick:()=>{DW()}}),children:s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[d?a.map((b,y)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-[190px] shrink-0 font-mono text-[13px]",value:b.key,readOnly:b.isDefault,disabled:c,placeholder:"X-Custom-Header",onChange:v=>f(y,{key:v.target.value})}),s.jsx($e,{className:"flex-1 font-mono text-[13px]",value:b.value,disabled:c,placeholder:b.isDefault?r("值(留空 = 不发送)"):r("值"),onChange:v=>f(y,{value:v.target.value})}),s.jsx(se,{variant:"ghost",disabled:c,onClick:()=>{b.isDefault?f(y,{value:t.defaults[b.key]??""}):o(v=>v.filter((w,j)=>j!==y))},children:b.isDefault?r("还原"):r("删除")})]},String(y))):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:"outline",disabled:c||!d,onClick:()=>o(b=>[...b,{key:"",value:"",isDefault:!1}]),children:r("添加自定义头")}),s.jsx("div",{className:"flex-1"}),s.jsx(se,{variant:"ghost",disabled:c||!d||Object.keys(t.overrides).length===0,onClick:()=>{XI({})},children:r("恢复默认")}),s.jsx(se,{disabled:c||!d||!h,onClick:()=>{XI(p())},children:r("保存")})]})]}),s.jsx("div",{className:"settings-state",children:t.status==="loading"?Ut.appLoading:t.status==="unavailable"?r("未能读取 Cline 伪装头设置,请稍后重试"):h?r("有未保存的修改"):r("{n} 个头将随每个 Cline 请求发送",{n:Object.keys(t.effective).length})+(Object.keys(t.overrides).length>0?r("({n} 项被覆盖)",{n:Object.keys(t.overrides).length}):r("(全部为默认值)"))}),s.jsx("div",{className:"hint retention-note",children:$n.clineHeaders})]})})}function UJ({snap:e}){const[t,a]=x.useState(!1);async function o(){a(!0),await eJ()||a(!1)}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("网关跨域访问(CORS)"),tip:rs.cors,badge:e.cors.status==="ready"?e.cors.on?s.jsx(cn,{tone:"bad",children:r("已开启")}):s.jsx(cn,{tone:"ok",children:r("已关闭")}):e.cors.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cors-refresh",onClick:()=>{cJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-cors",label:r("允许浏览器里的页面跨来源调用网关(/v1/*)"),checked:e.cors.on,disabled:e.cors.status!=="ready"||e.busy==="cors",onCheckedChange:c=>{IW(c)}})}),s.jsx("div",{className:"settings-state",children:e.cors.status==="loading"?Ut.appLoading:e.cors.status==="unavailable"?Ut.corsUnavailable:e.cors.on?Ut.corsOn:Ut.corsOff}),s.jsx("div",{className:"hint retention-note",children:$n.cors})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("机器人校验")}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-captcha",label:r("登录 / 注册需要通过 ALTCHA 人机验证(工作量证明)"),checked:e.captcha.enabled,disabled:!e.captcha.available||e.busy==="captcha",onCheckedChange:c=>{PW(c)}}),s.jsx("div",{className:"hint",children:$n.captcha})]})]}),e.panelLogin?s.jsxs("section",{className:"panel",id:"panel-login-section",children:[s.jsx(Qn,{title:r("面板登录")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:$n.panelLogin}),s.jsx("div",{className:"mt-2.5",children:s.jsx(se,{id:"btn-panel-logout",variant:"outline",disabled:t,onClick:()=>{o()},children:r("退出登录")})})]})]}):null]})}function Op({label:e,value:t}){return s.jsxs("div",{className:"storage-count",children:[s.jsx("span",{className:"k",children:e}),s.jsx("span",{className:"v",children:t})]})}function VJ(e){return e.status==="loading"?s.jsx(cn,{tone:"idle",children:r("检测中…")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:e.available?"ok":"bad",children:e.available?r("已生效"):r("数据库不可用")})}function FJ({snap:e}){const t=e.busy,a=e.storage,o=tt().workbuddyDesktop?.platform==="web",c=a.status==="ready",d=c&&a.available,f=c&&a.file?a.file:"—",p=h=>d&&h!==null?ZZ(h):"—";return s.jsxs(s.Fragment,{children:[!o&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("整库备份 / 恢复"),tip:rs.backup,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-db-export",variant:"outline",disabled:t==="dbExport"||t==="dbImport",onClick:()=>{fW()},children:r(t==="dbExport"?"备份中…":"备份整库")}),s.jsx(se,{id:"btn-settings-db-restore",variant:"destructive",disabled:t==="dbExport"||t==="dbImport",onClick:()=>pW(),children:r(t==="dbImport"?"恢复中…":"恢复整库")})]})}),s.jsxs("div",{className:"panel-body",children:[e.dbWarning?s.jsxs("div",{className:"danger-zone",id:"settings-db-warning",children:[s.jsx("strong",{children:r("⚠️ 密钥警告")}),s.jsx("br",{}),e.dbWarning]}):null,s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-db-include-logs",children:r("包含日志与调试报文")}),s.jsx(hs,{id:"settings-db-include-logs",checked:e.dbIncludeLogs,disabled:t!==null,onCheckedChange:dW}),s.jsx("div",{className:"hint",children:r("取消勾选后只备份业务数据(账号、配置与余额记录),文件显著变小;事件日志、请求统计与调试报文不会进备份文件。")})]}),s.jsx("div",{className:"danger-zone",children:s.jsx("strong",{children:$n.backupDanger})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号导入 / 导出"),tip:rs.io,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-export",variant:"outline",disabled:t==="export",onClick:()=>{cW()},children:r(t==="export"?"导出中…":"导出账号")}),s.jsx(se,{id:"btn-settings-import",variant:"default",disabled:t==="import",onClick:()=>{uW()},children:r(t==="import"?"导入中…":"导入账号")})]})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"danger-zone",children:[s.jsx("strong",{children:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义")}),r(",可直接用于登录。请妥善保管,不要外传或上传到公共位置。")]}),e.ioFailure?s.jsx("div",{className:"io-result",children:s.jsxs("span",{className:"text-destructive",children:[r("失败 {n} 个:{detail}",{n:e.ioFailure.failed,detail:e.ioFailure.detail}),e.ioFailure.more?r(" 等"):""]})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据保留"),tip:rs.retention,badge:Rp(e.retention),actions:s.jsx(Br,{id:"btn-retention-refresh",onClick:()=>{tJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:oS.map(h=>s.jsx(Ap,{field:h,value:e.retention.values?.[h.key]??null,disabled:e.busy==="retention",onCommit:b=>xW(h,b)},h.key))}),s.jsx("div",{className:"hint retention-note",children:$n.retention})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据存储"),tip:rs.storage,badge:VJ(a),actions:s.jsx(Br,{id:"btn-storage-refresh",onClick:()=>{dJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-path",children:r("数据库文件")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-path",title:f,children:f})}),s.jsx("div",{className:"hint",children:$n.storageFile})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-size",children:r("占用大小")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-size",children:d?MI(a.bytes):"—"})}),s.jsx("div",{className:"hint",children:$n.storageSize})]})]}),s.jsxs("div",{className:"retention-list storage-counts",children:[s.jsx(Op,{label:r("账号"),value:p(a.accounts)}),s.jsx(Op,{label:r("事件日志"),value:p(a.logs)}),s.jsx(Op,{label:r("请求记录"),value:p(a.requests)}),s.jsx(Op,{label:r("报表天数"),value:p(a.dailyDays)}),s.jsx(Op,{label:r("调试报文"),value:p(a.debug)})]}),s.jsx("div",{className:"hint retention-note",children:$n.storage})]})]})]})}const $J=[{title:r("问题反馈"),desc:r("遇到 Bug、报错或异常行为"),cta:r("去反馈"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=bug_report.yml"},{title:r("功能建议"),desc:r("想要的新功能或改进想法"),cta:r("提建议"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=feature_request.yml"},{title:r("请求提供商 / 模型支持"),desc:r("希望接入新的提供商或模型"),cta:r("去申请"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=provider_request.yml"}];function qJ(){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("反馈与需求")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:r("点下面的入口会用系统默认浏览器打开 GitHub 的对应表单(需要 GitHub 账号,模板已预设好,填完直接提交即可)。")}),s.jsx("div",{className:"mt-3 flex flex-col gap-2",children:$J.map(e=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-hairline bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12.5px] text-foreground",children:e.title}),s.jsx("div",{className:"mt-0.5 text-[12px] text-subtle",children:e.desc})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{FZ(e.url)},children:e.cta})]},e.url))})]})]})}function GJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||Lx(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("确认缩短保留天数")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[e?.head,s.jsx("br",{}),s.jsx("strong",{children:r("超出的历史数据会被立即删除,且不可恢复。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>Lx(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>Lx(!0),children:r("继续并清理")})]})]})})}const AS={enable:{title:r("开启局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("为了安全,开启前需要先注册一个"),s.jsx("b",{children:r("面板管理员账号")}),r("(已注册过会跳过这一步,直接生效)。"),s.jsx("br",{}),r("开启后网关将监听所有网卡,同一局域网内的设备即可把 API 地址指向本机 IP 一起使用;管理接口从此要求管理员会话或网关 Key,转发接口在没有一把启用的 Key 时也会拒绝服务(届时会自动创建一把名为「默认」的 Key)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("继续")},disable:{title:r("关闭局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("关闭后网关回到只监听 127.0.0.1,局域网内的设备将无法继续访问;已配置的网关 Key 与账号都不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("关闭并重启")},panel:{title:r("变更网页管理面板"),body:e=>e?s.jsxs(s.Fragment,{children:[r("开放后,局域网内其他设备的浏览器打开本机 IP 即可进入管理面板(需管理员账号登录)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}):s.jsxs(s.Fragment,{children:[r("关闭后,管理界面不再从局域网提供,只有本机的桌面程序可以管理;已开启的 API 转发不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("保存并重启")}};function KJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||hS(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("恢复整库备份")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[r("本机的全部数据(账号、网关配置、日志统计与桌面设置)将被所选备份文件"),s.jsx("strong",{children:r("整体替换")}),r(",包括恢复后需要重新登录管理面板。"),s.jsx("br",{}),s.jsx("strong",{children:r("替换前会自动把当前数据备份到配置目录的 backups/ 文件夹。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>hS(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>hS(!0),children:r("选择备份文件并恢复")})]})]})})}function YJ({confirm:e,register:t}){const a=x.useRef(null),o=x.useRef(null),c=x.useRef(null),d=e!==null||t!==null,f=()=>{t!==null?zI():mS(!1)},p=()=>{iW(o.current?.value??"",c.current?.value??"")};return s.jsx(Qt,{open:d,onOpenChange:h=>{h||f()},children:s.jsx(Zt,{className:"w-[min(480px,calc(100vw-48px))]",initialFocus:a,children:t!==null?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("注册管理员账号")})}),s.jsxs(Bt,{children:[s.jsx("div",{children:r("局域网开放后,管理接口要求登录。请设置管理员账号与密码,注册完成会直接继续开启流程。")}),s.jsxs("form",{onSubmit:h=>{h.preventDefault(),t.busy||p()},children:[s.jsx(Je,{htmlFor:"lan-admin-name",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("账号")}),s.jsx($e,{ref:o,id:"lan-admin-name",autoComplete:"username",placeholder:r("管理员账号"),disabled:t.busy}),s.jsx(Je,{htmlFor:"lan-admin-password",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("密码")}),s.jsx($e,{ref:c,id:"lan-admin-password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位"),disabled:t.busy})]}),s.jsx("div",{className:"mt-3 min-h-5 text-[13px] whitespace-pre-wrap text-destructive",children:t.error})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:zI,disabled:t.busy,children:r("取消")}),s.jsx(se,{onClick:p,disabled:t.busy,children:t.busy?r("正在注册…"):r("注册并开启")})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e?AS[e.mode].title:""})}),s.jsx(Bt,{children:s.jsx("div",{children:e?AS[e.mode].body(e.panel):null})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:()=>mS(!1),children:r("取消")}),s.jsx(se,{onClick:()=>mS(!0),children:e?AS[e.mode].label:r("继续")})]})]})})})}function XJ(){const e=tW(),t=x.useRef(null);x.useEffect(()=>{const o=t.current;o&&(o.scrollTop=0)},[e.scrollReset]);const a=o=>e.category===o?"settings-pane active":"settings-pane";return s.jsxs("div",{className:"settings-layout",children:[s.jsx("nav",{className:"settings-nav",id:"settings-nav",children:Ax.map(o=>s.jsxs("button",{type:"button",className:e.category===o.id?"settings-nav-item active":"settings-nav-item","data-cat":o.id,onClick:()=>nW(o.id),children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:JI(o.icon,17)}}),o.label]},o.id))}),s.jsxs("div",{className:"settings-panes",ref:t,children:[s.jsx("div",{className:a("general"),"data-cat":"general",children:s.jsx(yJ,{snap:e})}),s.jsx("div",{className:a("display"),"data-cat":"display",children:s.jsx(jJ,{})}),s.jsx("div",{className:a("gateway"),"data-cat":"gateway",children:s.jsx(zJ,{snap:e})}),s.jsx("div",{className:a("routing"),"data-cat":"routing",children:s.jsx(LJ,{snap:e})}),s.jsx("div",{className:a("retry"),"data-cat":"retry",children:s.jsx(PJ,{snap:e})}),s.jsx("div",{className:a("timeout"),"data-cat":"timeout",children:s.jsx(IJ,{snap:e})}),s.jsx("div",{className:a("security"),"data-cat":"security",children:s.jsx(UJ,{snap:e})}),s.jsx("div",{className:a("data"),"data-cat":"data",children:s.jsx(FJ,{snap:e})}),s.jsx("div",{className:a("feedback"),"data-cat":"feedback",children:s.jsx(qJ,{})}),s.jsx("div",{className:a("about"),"data-cat":"about"})]}),s.jsx(GJ,{confirm:e.retentionConfirm}),s.jsx(KJ,{confirm:e.dbBackupConfirm}),s.jsx(YJ,{confirm:e.lanConfirm,register:e.lanRegister})]})}const nP='.page[data-page="settings"]';let RS=null;function sP(){if(RS)return;const e=document.querySelector(nP);e&&(e.replaceChildren(),RS=vn.createRoot(e),Cs.flushSync(()=>{RS?.render(s.jsx(XJ,{}))}))}PI(),document.querySelector(nP)?sP():document.addEventListener("DOMContentLoaded",sP,{once:!0}),window.wbSettingsPanel={load:ES,render:fS,renderRetention:Ix,renderRetry:kW,renderDebug:Hx,renderSanitize:Ux,renderPrompt:Yu,renderStorage:TS,showCategory:dS},tt().wbApp?.currentPage==="settings"&&ES();const rP="agent2api-col-config:",OS=[{value:"left",label:r("左")},{value:"center",label:r("中")},{value:"right",label:r("右")}],QJ=e=>OS.some(t=>t.value===e),ZJ=OS.map(e=>`ta-${e.value}`),aP="colset-dragging",lP="open";let MS=null;const oP="grid grid-cols-[18px_minmax(78px,1fr)_44px_minmax(106px,auto)] items-center gap-2";function iP(){return window}const $x=new Map;function DS(e){return e.columns.map(t=>({key:t.key,visible:t.visible!==!1,align:t.align||"left"}))}function WJ(e,t){const a=Array.isArray(t),o=!a&&t&&typeof t=="object"?t:null,c=a?t:Array.isArray(o?.items)?o.items:[],d=o?.defaults&&typeof o.defaults=="object"?o.defaults:null,f=new Map(e.columns.map(y=>[y.key,y])),p=new Map(DS(e).map(y=>[y.key,y])),h=[],b=new Set;for(const y of c){const v=y&&typeof y=="object"?y:{},w=String(v.key||"");if(!f.has(w)||b.has(w))continue;b.add(w);const j=f.get(w),S=j.align||"left",N=d?d[w]??S:j.legacyAlign??S,k=QJ(v.align)?v.align:null;h.push({key:w,visible:v.visible!==!1,align:k&&k!==N?k:S})}for(const y of e.columns)b.has(y.key)||JJ(h,e,{...p.get(y.key)});return h}function JJ(e,t,a){const o=t.columns.findIndex(c=>c.key===a.key);for(let c=o-1;c>=0;c-=1){const d=e.findIndex(f=>f.key===t.columns[c].key);if(d>=0){e.splice(d+1,0,a);return}}e.unshift(a)}function eee(e){try{const t=localStorage.getItem(rP+e.id);return WJ(e,t?JSON.parse(t):[])}catch{return DS(e)}}function tee(e){try{const t={};for(const a of e.columns)t[a.key]=a.align||"left";localStorage.setItem(rP+e.id,JSON.stringify({v:2,defaults:t,items:e.config}))}catch{}}const nee=e=>$x.get(e)?.config||null,see=(e,t)=>e.columns.find(a=>a.key===t)?.label||t;function cP(e,t){const a=$x.get(e);if(!a)return t;const o=new Map(t.map(c=>[c.key,c]));return a.config.filter(c=>c.visible&&o.has(c.key)).map(c=>({...o.get(c.key),align:c.align}))}function Mp(e,{silent:t=!1}={}){tee(e),t||e.onChange?.(e.config),Il&&Il.id===e.id&&Il.repaint()}let Il=null;function qx(){if(!Il)return;const e=Il;Il=null,e.destroy()}function ree(e,t){qx();const a=document.createElement("div");document.body.append(a);const o=vn.createRoot(a),c={current:null};Il={id:e.id,spec:e,repaint:()=>c.current?.(),destroy:()=>{o.unmount(),a.remove()}},o.render(s.jsx(cee,{spec:e,anchor:t,repaintRef:c,onClose:qx}))}function aee(e,t){Il&&Il.id===e.id?qx():ree(e,t)}function lee(e,t,a){const o=[...e],[c]=o.splice(t,1);return o.splice(a,0,c),o}function oee(e,t,a,o){const c=document.elementFromPoint(e,t)?.closest?.("[data-col-key]");if(!c||!a||!a.contains(c))return"";const d=c.getAttribute("data-col-key")||"";return o.some(f=>f.key===d)?d:""}const iee=s.jsxs("svg",{viewBox:"0 0 24 24",width:13,height:13,fill:"currentColor","aria-hidden":"true",className:"block",children:[s.jsx("circle",{cx:"9",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"18",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"18",r:"1.6"})]});function cee({spec:e,anchor:t,repaintRef:a,onClose:o}){const c=t,d=x.useRef(null),[f,p]=x.useState(null),h=x.useRef(null),[,b]=x.useState(0),y=x.useCallback(()=>b(N=>N+1),[]);x.useLayoutEffect(()=>(a.current=y,()=>{a.current=null}),[y,a]),x.useEffect(()=>(c.classList.add(lP),c.setAttribute("aria-expanded","true"),()=>{c.classList.remove(lP),c.setAttribute("aria-expanded","false")}),[c]),x.useEffect(()=>{const N=()=>{const k=c.getBoundingClientRect();(!c.isConnected||!k.width||k.bottom<=0||k.top>=window.innerHeight)&&o()};return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[c,o]),x.useEffect(()=>()=>{const N=h.current;N&&(N.teardown(),Mp(e))},[e]);function v(N,k){const T=e.config.find(D=>D.key===N);T&&(!k&&e.config.filter(D=>D.visible).length<=1||(T.visible=k,Mp(e)))}function w(N,k){const T=e.config.find(D=>D.key===N);!T||T.align===k||(T.align=k,Mp(e))}function j(){e.config=DS(e),Mp(e)}function S(N,k){k.preventDefault(),h.current?.teardown(),p(N),document.body.classList.add(aP);const T=d.current;function D(){window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",A),document.body.classList.remove(aP),h.current=null,p(null)}function C(R){const I=oee(R.clientX,R.clientY,T,e.config);if(!I||I===N)return;const P=e.config.findIndex(_=>_.key===N),O=e.config.findIndex(_=>_.key===I);P<0||O<0||(e.config=lee(e.config,P,O),y())}function A(){D(),Mp(e)}h.current={teardown:D},window.addEventListener("pointermove",C),window.addEventListener("pointerup",A)}return s.jsx(hf,{open:!0,modal:!1,onOpenChange:(N,k)=>{N||(k?.reason==="outside-press"&&(MS=k.event??null),o())},children:s.jsxs(gf,{anchor:c,side:"bottom",align:"end",sideOffset:6,collisionPadding:8,className:"w-[336px]","aria-label":r("{name}的列设置",{name:e.label||e.id}),children:[s.jsxs("div",{className:Ue(oP,"border-b border-hairline px-3 pt-[9px] pb-[7px]","text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground"),children:[s.jsx("span",{}),s.jsx("span",{className:"text-center",children:r("列")}),s.jsx("span",{className:"text-center",children:r("显示")}),s.jsx("span",{className:"text-center",children:r("对齐")})]}),s.jsx("div",{ref:d,className:"min-h-0 flex-1 overflow-y-auto px-3 py-1",children:e.config.map(N=>{const k=see(e,N.key),T=f===N.key;return s.jsxs("div",{"data-col-key":N.key,className:Ue(oP,"rounded-sm py-[5px] hover:bg-nav-hover",T&&"opacity-50"),children:[s.jsx("span",{className:"flex cursor-grab items-center justify-center text-muted-foreground opacity-50 hover:opacity-100",title:r("按住拖动调整列顺序"),onPointerDown:D=>S(N.key,D),children:iee}),s.jsx("span",{className:"min-w-0 truncate text-xs text-foreground",title:k,children:k}),s.jsx(hs,{className:"justify-self-center",checked:N.visible,onCheckedChange:D=>v(N.key,D),"aria-label":r("显示「{label}」列",{label:k}),title:N.visible?r("这一列正在显示"):r("这一列已隐藏")}),s.jsx(In,{className:"w-full justify-center",options:OS,value:N.align,onValueChange:D=>w(N.key,D),"aria-label":r("「{label}」列的对齐",{label:k})})]},N.key)})}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 pt-2 pb-[9px]",children:[s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:r("拖动 ⋮⋮ 调整顺序")}),s.jsx(se,{variant:"outline",size:"sm",onClick:j,children:r("恢复默认")})]})]})})}function uee(e,t){e&&(e.classList.remove(...ZJ),e.classList.add(`ta-${t}`))}const uP=new Map;function dee(e,t){const a=uP.get(e);if(a&&a.table===t&&a.row.isConnected)return a;const o=t?.querySelector("thead tr");if(!o)return null;const c=t?.querySelector("colgroup")??null,d={table:t,row:o,group:c,ths:new Map([...o.querySelectorAll("th[data-col]")].map(f=>[f.getAttribute("data-col")||"",f])),cols:new Map([...c?.querySelectorAll("col[data-col]")||[]].map(f=>[f.getAttribute("data-col")||"",f]))};return uP.set(e,d),d}function fee(e,t,a){const o=$x.get(e);if(!o||!t)return;const c=dee(e,t);if(!c)return;const{row:d,group:f,ths:p,cols:h}=c;for(const b of o.config){const y=p.get(b.key);if(!y)continue;const v=h.get(b.key);if(!b.visible||a?.has(b.key)){y.remove(),v?.remove();continue}uee(y,b.align),d.appendChild(y),v&&f&&f.appendChild(v)}iP().wbTableColumns?.repaint?.(e)}function pee(e){const t=document.createElement("button");return t.type="button",t.className=`sm colset-btn${e.buttonClass?` ${e.buttonClass}`:""}`,t.id=`btn-colset-${e.id}`,t.title=r("调整「{name}」的列:显示 / 隐藏、顺序、对齐",{name:e.label||e.id}),t.innerHTML=`${iP().wbIcons?.icon?.("settings",14)||""}${r("列设置")}`,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.addEventListener("click",a=>{if(MS===a){MS=null;return}aee(e,t)}),t}function mee(e){return(typeof e.mount=="function"?e.mount():e.mount?document.querySelector(e.mount):null)||null}function hee(e){const t={...e,config:eee(e)};$x.set(e.id,t);const a=mee(e),o=pee(t);return a&&(e.buttonPlacement==="last"?a.appendChild(o):a.insertBefore(o,a.firstChild)),{apply:c=>cP(e.id,c),config:()=>t.config}}window.wbColSettings={register:hee,apply:cP,configOf:nee,syncStaticHead:fee,close:qx};function sl(){return window}const gee=new Set(["updateCheck"]);function dP(e){return(Array.isArray(e?.tasks)?e.tasks:[]).filter(a=>!gee.has(a.id))}const xee=2e4,fP=1,bee=" · ";function Xu(e,t){sl().wbApp?.toast?.(e,t)}function Gx(e){return e instanceof Error?e.message:String(e)}function pP(e){return r(e==="seconds"?"秒":"分钟")}function mP(e){const t=Number(e)||0;return t?new Date(t).toLocaleTimeString("zh-CN",{hour12:!1}):""}function hP(e){const t=Number(e)||0;if(!t)return"";const a=t-Date.now();if(a<=0)return r("即将执行");const o=Math.round(a/1e3);if(o<60)return r("{n} 秒后",{n:o});const c=Math.round(o/60);if(c<60)return r("{n} 分钟后",{n:c});const d=Math.round(c/60);return d<24?r("{n} 小时后",{n:d}):r("{n} 天后",{n:Math.round(d/24)})}function vee(e){const t=e.runner==="backend",a=[];if(e.lastRunAt){const o=mP(e.lastRunAt);a.push(e.lastResult?r("上次执行 {time}({result})",{time:o,result:e.lastResult}):r("上次执行 {time}",{time:o}))}else a.push(r(t?"还没有执行记录":"由页面按间隔自动刷新"));return t&&e.enabled&&e.nextRunAt&&a.push(r("下次执行 {time}({relative})",{time:mP(e.nextRunAt),relative:hP(e.nextRunAt)})),t&&e.retryAt&&e.retryAt>Date.now()&&a.push(r("冷却中,{relative}重试",{relative:hP(e.retryAt)})),a.join(bee)}function yee(e,t){const a=String(t??"").trim(),o=pP(e.unit);if(!a)return{ok:!1,message:r("间隔不能为空(可填 {min}–{max} {unit})",{min:e.min,max:e.max,unit:o})};if(!/^\d+$/.test(a))return{ok:!1,message:r("间隔必须是整数")};const c=Number(a);return ce.max?{ok:!1,message:r("间隔必须在 {min}–{max} {unit} 之间(当前填的是 {value})",{min:e.min,max:e.max,unit:o,value:a})}:{ok:!0,value:c}}function wee(e){const t=sl();e.id==="logsAutoRefresh"?t.wbLogsPanel?.applyAutoRefresh?.(e):e.id==="requestsAutoRefresh"?t.wbRequestsPanel?.applyAutoRefresh?.(e):e.id==="reportAutoRefresh"&&t.wbReport?.applyAutoRefresh?.(e)}let lc=!1,Kx=null,IS=!1;async function gP(){if(!Kx){IS=!0;return}await Kx()}function jee(){const[e,t]=x.useState([]),[a,o]=x.useState(!1),[c,d]=x.useState(null),[f,p]=x.useState({});function h(I){p(P=>{if(!(I in P))return P;const O={...P};return delete O[I],O})}const b=x.useCallback(async()=>{const I=sl().workbuddyDesktop;try{if(!I)throw new Error(r("后端桥不可用"));const P=await I.getScheduledTasks();t(dP(P)),o(!0)}catch(P){console.warn("读取定时任务失败:",Gx(P)),t([]),o(!0)}},[]),y=x.useCallback(async()=>{if(lc||document.hidden||sl().wbApp?.currentPage!=="tasks")return;const I=sl().workbuddyDesktop;if(I)try{const P=await I.getScheduledTasks();t(dP(P))}catch(P){console.warn("同步定时任务状态失败:",Gx(P))}},[]);x.useEffect(()=>{const I=window.setInterval(()=>{y()},xee);return()=>{window.clearInterval(I)}},[y]),x.useEffect(()=>{sl().wbApp?.renderTopbarStatus?.()},[e,a]),x.useEffect(()=>(Kx=b,IS&&(IS=!1,b()),()=>{Kx=null}),[b]);async function v(I,P,O){if(lc)return;const _=sl().workbuddyDesktop;if(_){lc=!0;try{const L=await _.saveScheduledTask(I,P);t(H=>H.map(B=>B.id===I?L:B)),wee(L),Xu(r("✅ 已更新「{label}」",{label:O}))}catch(L){Xu(r("保存失败:{reason}",{reason:Gx(L)}),"err"),await b()}finally{lc=!1}}}async function w(I,P){const O=yee(I,P);if(!O.ok){Xu(O.message,"err"),h(I.id);return}if(O.value===I.interval){h(I.id);return}await v(I.id,{interval:O.value},r("{name}间隔",{name:r(I.label)})),h(I.id)}async function j(I){if(lc)return;const P=sl().workbuddyDesktop;if(P){lc=!0,d(I.id);try{const O=await P.runScheduledTask(I.id);if(O?.task){const _=O.task;t(L=>L.map(H=>H.id===I.id?_:H))}Xu(r("✅ {task}:{summary}",{task:r(I.label),summary:O?.summary||r("已执行")})),I.id==="credentialMaintenance"&&await sl().wbApp?.refresh?.()}catch(O){Xu(r("执行失败:{reason}",{reason:Gx(O)}),"err"),await b()}finally{lc=!1,d(null)}}}function S(I){const P=pP(I.unit),O=c===I.id;return s.jsxs("div",{className:"task-item","data-task":I.id,children:[s.jsxs("div",{className:"task-main",children:[s.jsxs("div",{className:"task-title",children:[s.jsxs("label",{className:"switch",children:[s.jsx(hs,{checked:I.enabled===!0,onCheckedChange:_=>{v(I.id,{enabled:_},r("{name}开关",{name:r(I.label)}))}}),s.jsx("span",{className:"task-name",children:r(I.label)})]}),s.jsx("span",{className:"tip-q","data-tip":r(I.description)}),s.jsx(ze,{className:"task-badge",variant:I.enabled?"success":"outline",children:I.enabled?r("已开启"):r("已关闭")}),I.running?s.jsx(ze,{className:"task-badge",variant:"warning",children:r("执行中…")}):null]}),s.jsx("div",{className:"task-state",children:vee(I)})]}),s.jsxs("div",{className:"task-actions",children:[s.jsxs("span",{className:"task-interval",children:[s.jsx("span",{className:"task-interval-label",children:r("每")}),s.jsx($e,{type:"number",inputMode:"numeric",min:I.min,max:I.max,step:1,className:"w-[74px] max-w-[74px] text-center tabular-nums",value:f[I.id]??String(I.interval),title:r("可填 {min}–{max} {unit}(默认 {def} {unit})",{min:I.min,max:I.max,unit:P,def:I.defaultInterval}),onChange:_=>{const L=_.currentTarget.value;p(H=>({...H,[I.id]:L}))},onBlur:_=>{w(I,_.currentTarget.value)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}}),s.jsx("span",{className:"task-interval-unit",children:P})]}),I.canRun===!0?s.jsx(se,{size:"sm",variant:"outline",disabled:O||I.running===!0,onClick:()=>{j(I)},children:r(O?"执行中…":"立即执行")}):null]})]},I.id)}const N=e.length===0,k=e.filter(I=>I.enabled).length,T=N?a?r("不可用"):"—":r("{enabled} / {total} 个已开启",{enabled:k,total:e.length}),D=N?a?"destructive":"outline":k?"success":"outline",C=D==="destructive"?"bad":D==="success"?"ok":"",A=e.map(I=>S(I)),R=A.slice(fP);return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("任务清单")}),s.jsx(ze,{id:"tasks-badge",variant:D,"data-tone":C,children:T}),s.jsx("span",{className:"panel-sub",children:r("状态每 20 秒自动同步")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"outline",onClick:()=>{b().then(()=>Xu(r("定时任务已刷新")))},children:r("刷新")})})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"task-list",children:N?s.jsx("div",{className:"log-empty",children:r(a?"没有可显示的定时任务。后端未返回任务清单,请确认网关正在运行。":"正在加载定时任务…")}):s.jsxs(s.Fragment,{children:[A.slice(0,fP),R.length?s.jsx("div",{className:"task-grid",children:R}):null]})})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{children:[r("任务配置保存在 "),s.jsx("code",{children:"~/.agent2api/config.json"}),r(" 的 "),s.jsx("code",{children:"scheduledTasks"}),r(" 字段")]}),s.jsx("span",{children:r("改动立即生效,不需要重启程序")})]})]})}const xP='.page[data-page="tasks"]';let bP=!1;function vP(){if(bP)return;const e=document.querySelector(xP);e&&(bP=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(jee,{})))}document.querySelector(xP)?vP():document.addEventListener("DOMContentLoaded",vP,{once:!0}),window.wbTasksPanel={load:gP},sl().wbApp?.currentPage==="tasks"&&gP();const yP="workbuddy-desktop-update-skip";function See(){try{return localStorage.getItem(yP)||""}catch{return""}}function Nee(e){try{localStorage.setItem(yP,e)}catch{}}let wP="";function Yx(e,t){if(!e||e.hasUpdate!==!0||e.pendingRestart===!0)return;const a=String(e.latestVersion||"").trim();a&&Pn().wbApp?.currentPage!=="settings"&&(a===See()||a===wP||(wP=a,jP(),Qu=document.createElement("div"),document.body.append(Qu),Dp=vn.createRoot(Qu),Dp.render(s.jsx(kee,{info:e,onGoUpdate:t,onClose:jP}))))}function kee({info:e,onGoUpdate:t,onClose:a}){const o=String(e.latestVersion||""),c=String(e.notes||"").trim(),d=c?Y2(c):"";function f(){Nee(o),a()}function p(){a();const h=Pn();h.wbApp?.showPage?.("settings"),h.wbSettingsPanel?.showCategory?.("about"),t(e)}return s.jsx(Qt,{open:!0,onOpenChange:h=>{h||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("检测到更新")})}),s.jsxs(Bt,{children:[s.jsxs("p",{className:"text-[12.5px] leading-[1.6] text-subtle",children:[r("新版本 "),s.jsx("strong",{className:"text-foreground",children:o}),r(" 已发布(当前 {current}),更新日志如下:",{current:e.currentVersion||r("未知")})]}),s.jsx("div",{className:"max-h-[46vh] overflow-y-auto overscroll-contain pr-1.5",onClick:X2,children:d?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:d}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})})})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",size:"sm",onClick:f,children:r("跳过此次更新")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:p,children:r("去更新")})]})]})})}let Dp=null,Qu=null;function jP(){Dp&&(Dp.unmount(),Dp=null),Qu&&(Qu.remove(),Qu=null)}const SP="updateCheck",Zu=1,Xx=1440,Cee="https://github.com/settings/tokens/new?description="+encodeURIComponent("Agent2API 更新检查");function Tee(e){return e?e.error?{badge:s.jsx(ze,{shape:"tag",variant:"destructive",title:e.error,children:r("无法解密")}),hint:r("重新粘贴保存一次即可自愈")}:e.filled&&e.origin==="stored"?{badge:s.jsx(ze,{shape:"tag",variant:"success",children:r("已填写")}),hint:r("已加密存储在本地,不显示具体值;粘贴新令牌可覆盖")}:e.filled?{badge:s.jsx(ze,{shape:"tag",variant:"secondary",children:r("环境变量")}),hint:r("已配置 GITHUB_TOKEN 环境变量,界面保存的令牌优先于它")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("未填写")}),hint:r("填写后检查限额 60 → 5000 次/小时(创建令牌无需勾选任何权限)")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("读取中")}),hint:""}}function Eee({open:e,onClose:t}){const[a,o]=x.useState(Q2),[c,d]=x.useState(null),[f,p]=x.useState(""),[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=Z2(a);x.useEffect(()=>{e&&(p(""),qY().then(o),(async()=>{try{d(await Pn().workbuddyDesktop?.getUpdateToken()??null)}catch{}})(),(async()=>{try{const L=((await Pn().workbuddyDesktop?.getScheduledTasks?.())?.tasks??[]).find(z=>z.id===SP),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B))}catch{}})())},[e]);async function T(_){if(!S){N(!0);try{const L=await Pn().workbuddyDesktop?.saveScheduledTask?.(SP,_),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B)),nr(r("✅ 自动检查更新已保存"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{N(!1)}}}async function D(){const _=Math.round(Number(w));if(!Number.isFinite(_)||_Xx){nr(r("检查间隔必须是 {min} ~ {max} 分钟",{min:Zu,max:Xx}),"err");return}y&&_===y.interval||await T({interval:_})}async function C(_){const L=await GY(_);L&&o(H=>({...H,proxyChoice:L.choice}))}async function A(){const _=f.trim();if(!_){nr(r("请先粘贴 GitHub 令牌"),"err");return}b(!0);try{const L=await Pn().workbuddyDesktop?.setUpdateToken({token:_});d(L??null),p(""),L?.saved===!1?nr(r("令牌已生效,但写入磁盘失败(重启后会丢失)"),"err"):nr(r("✅ GitHub 令牌已保存(加密存储,界面不再显示)"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{b(!1)}}async function R(){b(!0);try{const _=await Pn().workbuddyDesktop?.setUpdateToken({token:null});d(_??null),nr(r("✅ 已清除界面保存的 GitHub 令牌(环境变量若配置过则继续生效)"))}catch(_){nr(r("清除失败:{error}",{error:zr(_)}),"err")}finally{b(!1)}}const I=Tee(c),P=!!c?.error||c?.origin==="stored",O=c?.filled&&c?.origin!=="env"?r("已填写(粘贴新令牌可覆盖)"):r("粘贴 GitHub 令牌(ghp_… / github_pat_…)");return s.jsx(Qt,{open:e,onOpenChange:_=>{_||t()},children:s.jsxs(Zt,{className:"w-[min(460px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更新设置")})}),s.jsxs(Bt,{className:"gap-3.5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("自动检查更新")}),s.jsx(hs,{checked:y?.enabled===!0,disabled:S||!y,onCheckedChange:_=>{T({enabled:_===!0})},"aria-label":r("自动检查更新")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsx($e,{type:"number",min:Zu,max:Xx,step:1,className:"w-[110px]",disabled:S||!y||y.enabled!==!0,value:w,onChange:_=>j(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),D())},"aria-label":r("检查间隔(分钟)")}),s.jsx("span",{className:"text-[12px] text-subtle",children:r("分钟({min} ~ {max})",{min:Zu,max:Xx})}),s.jsx(se,{variant:"outline",size:"sm",disabled:S||!y||Math.round(Number(w))===y.interval,onClick:()=>{D()},children:r("保存")})]}),s.jsx("div",{className:"mt-1.5 text-[12px] text-subtle",children:r("到点自动向 GitHub 查询新版本,查到就走「检测到更新」弹窗;关闭后「检查更新」按钮仍可手动触发")})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("出网代理")}),s.jsx("div",{className:"mt-1.5",children:s.jsxs(ft,{value:k.current,onValueChange:_=>{C(String(_))},children:[s.jsx(mt,{className:Ue("w-full",k.broken&&"border-destructive-bd"),title:k.title,"aria-label":r("更新出网代理"),children:s.jsx(pt,{className:"min-w-0 truncate",children:k.selected?.label||r("直连")})}),s.jsx(ht,{children:k.items.map(_=>s.jsx(qe,{value:_.value,disabled:_.disabled,children:_.label},_.value))})]})})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("GitHub 令牌")}),s.jsx(se,{variant:"outline",size:"xs",title:r("在默认浏览器中打开 GitHub 的令牌创建页(备注已预设,无需勾选任何权限,直接点 Generate token)"),onClick:()=>{K2(Cee)},children:r("打开 GitHub 令牌页面")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[I.badge,s.jsx("span",{className:"text-[12px] text-subtle",children:I.hint})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[s.jsx($e,{type:"password",className:"flex-1",placeholder:O,autoComplete:"new-password",spellCheck:!1,value:f,onChange:_=>p(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),A())}}),s.jsx(se,{variant:"default",size:"sm",disabled:h||!f.trim(),onClick:()=>{A()},children:r("保存")}),P?s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{R()},children:r("清除")}):null]})]})]})]})})}function Aee({open:e,onClose:t}){return s.jsx(Qt,{open:e,onOpenChange:a=>{a||t()},children:s.jsxs(Zt,{className:"w-[min(320px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("加入 QQ 群")})}),s.jsxs(Bt,{className:"items-center gap-3 text-center",children:[s.jsx("img",{className:"qq-qr",src:$Y,alt:r("QQ 群二维码")}),s.jsxs("div",{className:"qq-no",children:[s.jsx("span",{className:"k",children:r("群号")}),s.jsx("code",{children:Jg}),s.jsx(se,{type:"button",size:"sm",variant:"ghost","data-copy":Jg,children:r("复制")})]}),s.jsx("p",{className:"qq-hint",children:r("用手机 QQ 扫上面的二维码,或在 QQ 里搜索群号加入。")})]})]})})}const Ree=1e3,NP=8,Oee=10,Mee=1e3,Dee={"":"outline",ok:"success",warn:"warning",bad:"destructive"},Iee={info:null,checkedAt:0,repository:"",badgeText:r("未检查"),badgeTone:"",stateText:r("点击「检查更新」查询最新发布版本。"),stateError:!1,percent:0,phase:"idle",readyPath:"",checking:!1,actionBusy:!1,restartSeconds:0};function Pl(e){return String(e).padStart(2,"0")}function Pee(e){const t=new Date(String(e??""));return!e||Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${Pl(t.getHours())}:${Pl(t.getMinutes())}`}function kP(e){const t=new Date(e);if(!e||Number.isNaN(t.getTime()))return"";const a=new Date,o=t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate(),c=`${Pl(t.getHours())}:${Pl(t.getMinutes())}:${Pl(t.getSeconds())}`;return o?c:`${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${c}`}function Qx(e){return e?.installerKind?e.installerKind==="dmg":/Mac|iPhone|iPad/.test(navigator.userAgent||"")}function Da(e){return e?.selfUpdate===!0}function CP(e){return e?Da(e)?e.serverAsset??null:e.asset??null:null}function _ee(e){return Da(e)?r("正在下载服务端更新包…(下载完成后由面板完成替换,重启容器内的服务后生效)"):Qx(e)?r("正在下载安装包…(下载完成后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装)"):r("正在下载安装包…(下载完成后启动安装程序需要管理员权限,会弹出 UAC 确认框)")}function TP(e,t){return Da(e)?r("更新包已就绪:{name}。点「安装并重启」后,面板会校验并替换容器内的程序与界面文件,然后重启服务(页面会自动刷新)。",{name:t}):Qx(e)?r("安装包已就绪:{name}。点击「打开安装包」后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装。",{name:t}):r("安装包已就绪:{name}。点击「安装并重启」后需要管理员权限,会弹出 UAC 确认框。",{name:t})}function Lee(e){return Da(e)?r("安装并重启"):Qx(e)?r("打开安装包"):r("安装并重启")}let fa=Iee;const PS=new Set;function _S(){return fa}function zee(e){return PS.add(e),()=>{PS.delete(e)}}function Bn(e){fa={...fa,...e};for(const t of PS)t()}let Sr=!1,LS=null,Zx=null;function Wu(){Zx!==null&&(window.clearInterval(Zx),Zx=null)}function Es(e,t=""){Bn({badgeText:e,badgeTone:t})}function An(e,t=!1){Bn({stateText:e,stateError:t})}function Wx(){const{info:e,checkedAt:t}=fa;if(!e)return;const a=t?r("(检查于 {time})",{time:kP(t)}):"";if(e.pendingRestart===!0){Es(r("待重启"),"warn"),An(r("更新已应用到容器内,重启服务后生效。{at}",{at:a}));return}if(e.hasUpdate===!0){if(Es(r("有新版本"),"warn"),Da(e)&&!e.serverAsset){An(r("发现新版本 {latest}(当前 {current}),但该版本没有提供容器内更新包;请在宿主机执行 docker compose pull && docker compose up -d 升级。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}));return}An(r("发现新版本 {latest}(当前 {current})。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}))}else e.hasUpdate===!1?(Es(r("已是最新"),"ok"),An(r("当前已是最新版本({current})。{at}",{current:String(e.currentVersion||""),at:a}))):(Es(r("无法比较"),"warn"),An(e.latestVersion?r("最新发布版本为 {latest},但当前版本号「{current}」无法解析,未做新旧判断。{at}",{latest:e.latestVersion,current:e.currentVersion||r("未知"),at:a}):r("仓库暂无发布版本。{at}",{at:a})))}function EP(e){!e||e.checked===!1||(Bn({info:e,checkedAt:Number(e.checkedAt)||0}),e.repository&&zS(e.repository),fa.phase==="idle"&&Wx())}function zS(e){const t=String(e||"").trim();/^[\w.-]+\/[\w.-]+$/.test(t)&&Bn({repository:t})}function BS(e){if(!e)return!1;if(e.active){const t=Math.max(0,Math.min(100,Number(e.percent)||0)),a=(Number(e.received)||0)/1024/1024,o=(Number(e.total)||0)/1024/1024;return Bn({phase:"downloading",percent:t}),Es(r("下载中"),"warn"),An(r("正在下载 {name}:{percent}%({received} / {total} MB)",{name:e.filename||r("安装包"),percent:t,received:a.toFixed(1),total:o.toFixed(1)})),!0}if(Wu(),Bn({percent:0}),e.error)return Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:e.error}),!0),Bn({phase:"failed"}),!0;if(e.canceled)return Es(r("已取消"),"warn"),An(Da(fa.info)?r("下载已取消,可重新点击「下载并更新」。"):r("下载已取消,可重新点击「下载并安装」。")),Bn({phase:"idle"}),!0;if(e.done&&e.path){const t=e.path,a=e.filename||t;return Es(r("可安装"),"ok"),Bn({phase:"ready",readyPath:t}),Da(fa.info)?(An(TP(fa.info,a)),!0):(t!==LS?(LS=t,An(Qx(fa.info)?r("安装包已下载完成,正在挂载磁盘映像…"):r("安装包已下载完成,正在启动安装程序(需要管理员权限,会弹出 UAC 确认框)…")),RP(t)):An(TP(fa.info,a)),!0)}return!1}async function Bee(){try{const e=await Pn().workbuddyDesktop?.updateProgress();if(!e){Wu();return}BS(e)}catch(e){Wu(),An(r("读取下载进度失败:{error}",{error:zr(e)}),!0)}}function AP(){Wu(),Zx=window.setInterval(()=>{Bee()},Ree)}async function RP(e){const t=Pn().workbuddyDesktop;if(t)try{const o=(await t.runInstaller(e,!0))?.restart!==!1;An(r(o?"安装程序已启动,本程序将退出以便完成覆盖安装。安装程序需要管理员权限,会弹出 UAC 确认框,请选择「是」。":"安装包已挂载,请在弹出的窗口里把应用拖进「应用程序」完成安装。安装完成后重新打开本程序即可。"))}catch(a){Es(r("启动失败"),"bad"),An(r("启动安装程序失败:{error}",{error:zr(a)}),!0)}}async function Hee(){const e=Pn().workbuddyDesktop;if(e?.installUpdate)try{Es(r("安装中"),"warn"),An(r("正在校验并替换容器内的程序与界面文件…"));const t=await e.installUpdate(),a=String(t?.version||"").trim();An(a?r("已替换为 {version},正在重启服务…",{version:a}):r("替换完成,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS(a)}catch(t){Es(r("安装失败"),"bad"),An(r("安装失败:{error}",{error:zr(t)}),!0)}}async function Uee(){const e=Pn().workbuddyDesktop;if(!(!e?.rollbackUpdate||Sr)){Sr=!0,Bn({actionBusy:!0});try{Es(r("回滚中"),"warn"),An(r("正在回滚到上一版本…")),await e.rollbackUpdate(),An(r("已还原上一版本,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS("")}catch(t){Es(r("回滚失败"),"bad"),An(r("回滚失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}function HS(e){Wu(),Bn({phase:"restarting",restartSeconds:NP,readyPath:""}),Es(r("重启中"),"warn");let t=NP;const a=()=>{if(An(e?r("{version} 已就位,服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{version:e,seconds:Math.max(0,t)}):r("服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{seconds:Math.max(0,t)})),t<=0){window.clearInterval(o),Vee();return}t-=1,Bn({restartSeconds:t})},o=window.setInterval(a,1e3);a()}async function Vee(){for(let e=0;e{window.setTimeout(t,Mee)})}window.location.reload()}async function OP(){if(Sr)return null;Sr=!0,Bn({checking:!0}),Es(r("检查中"),"warn"),An(r("正在查询 GitHub 上的最新发布版本…"));let e=null;try{const t=Pn().workbuddyDesktop;if(!t)throw new Error(r("后端桥不可用"));e=await t.checkUpdate()??null,Bn({info:e,checkedAt:Number(e?.checkedAt)||Date.now()}),e?.repository&&zS(e.repository),Wx()}catch(t){e=null,Bn({info:null,checkedAt:0}),Es(r("检查失败"),"bad"),An(r("检查更新失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({checking:!1})}return Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip),e}async function MP(){let e=null;try{e=await Pn().workbuddyDesktop?.getUpdateStatus()??null}catch{}if(e&&e.checked!==!1){EP(e),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip);return}fa.info||(Es(r("未检查")),An(r("点击「检查更新」查询 GitHub 上的最新发布版本。")))}async function US(){if(Sr)return;const e=_S();if(e.info?.pendingRestart===!0&&e.phase!=="downloading"){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.restartService?.().catch(()=>{}),HS("")}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase!=="downloading"&&e.readyPath){Sr=!0,Bn({actionBusy:!0});try{Da(e.info)?await Hee():await RP(e.readyPath)}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase==="downloading"){try{await Pn().workbuddyDesktop?.cancelUpdate(),An(r("正在取消下载…"))}catch(a){nr(r("取消失败:{error}",{error:zr(a)}),"err")}return}const t=CP(e.info);if(!t?.url){nr(Da(e.info)?r("这一版没有提供容器内更新包"):r("没有可下载的安装包"),"err");return}if(IP(e)){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.downloadUpdate({url:t.url,name:t.name}),LS=null,Bn({phase:"downloading",readyPath:"",percent:0}),Es(r("下载中"),"warn"),An(_ee(e.info)),AP()}catch(a){Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:zr(a)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}async function DP(){Wx(),await MP();try{const e=await Pn().workbuddyDesktop?.updateProgress();if(e?.active){BS(e),AP();return}if(e?.done&&e.path){BS(e);return}}catch{}}async function Ip(e){if(e?.pendingRestart===!0){await US();return}e?.hasUpdate===!0&&(Bn({info:e,checkedAt:Number(e.checkedAt)||fa.checkedAt}),e.repository&&zS(e.repository),Wx(),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip)),await DP();const t=_S();if(!(t.phase==="downloading"||t.readyPath)&&t.info?.hasUpdate)for(let a=0;a<3;a+=1){if(Sr){await new Promise(o=>{window.setTimeout(o,400)});continue}await US();return}}function IP(e){return e.phase==="restarting"?null:e.info?.pendingRestart===!0&&e.phase==="idle"?{label:r("立即重启"),disabled:e.actionBusy}:!(e.info?.hasUpdate===!0&&!!CP(e.info)?.url)&&e.phase!=="downloading"&&e.phase!=="ready"?null:{label:e.phase==="downloading"?r("取消下载"):e.phase==="failed"?r("重试下载"):e.phase==="ready"?Lee(e.info):Da(e.info)?r("下载并更新"):r("下载并安装"),disabled:e.actionBusy}}function Fee(e,t){const a=e.info,o=String(a?.notes||"").trim();if(!o)return s.jsx("div",{className:"update-log-hint",children:r(a?"这个版本没有填写发布说明。":"点击「检查更新」后,这里会显示最新版本的更新说明。")});const c=Y2(o),d=G2(a?.pageUrl),f=Pee(a?.publishedAt);return s.jsxs("div",{className:"rel-note",children:[s.jsxs("div",{className:"rel-note-head",children:[s.jsx("span",{className:"rel-tag",children:String(a?.latestVersion||r("最新版本"))}),a?.prerelease===!0?s.jsx(ze,{shape:"tag",variant:"warning",children:r("预发布")}):null,f?s.jsx("span",{className:"rel-date",children:f}):null]}),s.jsxs("div",{className:"rel-note-body",children:[c?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:c}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})}),s.jsxs("div",{className:"rel-foot",children:[d?s.jsx("a",{href:d,"data-external":d,target:"_blank",rel:"noopener",children:r("在 GitHub 查看完整说明")}):null,s.jsx(se,{type:"button",variant:"link",size:"sm",className:"h-auto border-0 px-0 text-[11.5px] font-semibold text-primary-fg underline-offset-auto",title:r("群号:{group}",{group:Jg}),onClick:t,children:r("加入 QQ 群")})]})]})]})}function $ee(){const e=x.useSyncExternalStore(zee,_S),t=IP(e),[a,o]=x.useState(!1),[c,d]=x.useState(!1);x.useEffect(()=>()=>{Wu()},[]);const f=e.repository?`https://github.com/${e.repository}`:"",p=e.repository?`https://github.com/${e.repository.split("/")[0]}`:"",h=Da(e.info),b=h&&e.info?.backupAvailable===!0&&e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="restarting",y=e.info?.latestVersion?e.info.prerelease?r("{version}(预发布)",{version:e.info.latestVersion}):e.info.latestVersion:"—",v=String(e.info?.latestVersion||"").trim(),w=v?`${v}${e.checkedAt?r(" · 检查于 {time}",{time:kP(e.checkedAt)}):""}`:"";return s.jsxs("section",{className:"panel",onClick:X2,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("软件更新")}),s.jsx("span",{className:"tip-q","data-tip":r(h?"容器内更新:更新包从 GitHub 发布页下载,校验 sha256 后由面板替换容器内的程序与界面文件,再重启服务(容器由 restart 策略拉起,页面会自动刷新)。更新的是容器里的文件,compose 里的镜像标签不变 —— 之后执行 docker compose pull && up -d 会回到镜像里的版本;更新失败可一键回滚到上一版本。检查更新与下载的出网线路、GitHub 令牌都在「更新设置」里。":"更新包从 GitHub 发布页下载,下载完成后可直接启动安装程序并自动重启本程序。安装包会先校验来源域名与文件完整性。检查更新与下载安装包的出网线路、GitHub 令牌都在「更新设置」里:线路默认直连(直连失败时自动借 Clash Verge 的混合端口重试一次),选定指定出口后只走该出口;填写 GitHub 令牌可把检查限额从 60 次/小时提高到 5000 次/小时。")}),s.jsx(ze,{id:"update-badge",variant:Dee[e.badgeTone],"data-tone":e.badgeTone,children:e.badgeText}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-update-settings",variant:"outline",title:r("出网线路与 GitHub 令牌设置"),onClick:()=>o(!0),children:r("更新设置")}),s.jsx(se,{id:"btn-update-check",variant:"outline",disabled:e.checking||e.phase==="restarting",onClick:()=>{OP()},children:e.checking?r("检查中…"):r("检查更新")}),b?s.jsx(se,{id:"btn-update-rollback",variant:"outline",disabled:e.actionBusy,title:r("把容器内的程序与界面文件还原到更新前的版本,并重启服务"),onClick:()=>{Uee()},children:r("回滚到上一版本")}):null,t?s.jsx(se,{id:"btn-update-download",variant:"default",disabled:t.disabled,onClick:()=>{US()},children:t.label}):null]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"update-version",children:[s.jsxs("span",{className:"version-pill",children:[s.jsx("span",{className:"k",children:r("当前版本")}),s.jsx("span",{className:"v",id:"update-current",children:e.info?.currentVersion||"—"})]}),s.jsx("span",{className:"version-arrow",children:"→"}),s.jsxs("span",{className:"version-pill new",children:[s.jsx("span",{className:"k",children:r("最新版本")}),s.jsx("span",{className:"v",id:"update-latest",children:y})]})]}),s.jsx("div",{className:"detail",id:"update-state",style:e.stateError?{color:"var(--danger)"}:void 0,children:e.stateText}),e.phase==="downloading"&&e.percent>0&&e.percent<100?s.jsx(tf,{value:e.percent}):null,p&&f?s.jsxs("div",{className:"update-author",id:"update-author",children:[s.jsxs("div",{className:"update-author-text",children:[s.jsx("strong",{children:r("关于作者")}),s.jsxs("span",{children:[r("本工具由")," ",s.jsx("a",{id:"update-author-link",href:p,"data-external":p,target:"_blank",rel:"noopener",children:e.repository.split("/")[0]})," ",r("个人开发并开源维护,免费使用、不带广告,也不会收集你的账号数据。如果它帮到了你,欢迎到项目仓库点个 Star 支持一下。")]})]}),s.jsx("div",{className:"update-author-actions",children:s.jsx(se,{id:"btn-update-favorite",type:"button",size:"sm",variant:"outline","data-external":f,title:r("在浏览器中打开项目仓库,点 Star 支持作者"),children:r("收藏项目")})})]}):null,s.jsxs("div",{className:"update-log",id:"update-notes",children:[s.jsxs("div",{className:"update-log-head",children:[s.jsx("span",{className:"update-log-title",children:r("更新日志")}),s.jsx("span",{className:"update-log-meta",id:"update-log-meta",children:w})]}),s.jsx("div",{className:"update-log-body",id:"update-log-body",children:Fee(e,()=>d(!0))})]})]}),a?s.jsx(Eee,{open:!0,onClose:()=>o(!1)}):null,c?s.jsx(Aee,{open:!0,onClose:()=>d(!1)}):null]})}const PP='.settings-pane[data-cat="about"]';let VS=null;function _P(){if(VS)return;const e=document.querySelector(PP);e&&(e.replaceChildren(),VS=vn.createRoot(e),VS.render(s.jsx($ee,{})))}document.querySelector(PP)?_P():document.addEventListener("DOMContentLoaded",_P,{once:!0}),window.wbUpdatePanel={load:DP,check:OP,syncFromCache:MP,openAndDownload:Ip,applyStatus:EP,showUpdateModal:e=>Yx(e,Ip)};const qee="zcode.z.ai/billing",Gee={active:"success",pending:"warning",expired:"ghost",unknown:"outline"};function Kee(e){const t=String(e||"").trim().toLowerCase();return t==="daily"?r("每日"):t==="weekly"?r("每周"):t==="monthly"?r("每月"):""}function Yee(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(t)}function oc(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"":Pe().wbApp?.formatTime?.(t*1e3)||new Date(t*1e3).toLocaleString()}function Xee(e){const t=Yee(e.grantUnits),a=String(e.unitType||"").trim(),o=t?[t,a].filter(Boolean).join(" "):"",c=Kee(e.period),d=[String(e.showName||"").trim(),o].filter(Boolean).join(" ");return d?c?r("{body}({period})",{body:d,period:c}):d:""}function LP(e){return(e.entitlements||[]).map(Xee).filter(Boolean).join(r("、"))}function Qee(e){const t=oc(e.startsAt),a=oc(e.endsAt);return t&&a?`${t} → ${a}`:a?r("到期 {time}",{time:a}):t?r("开始 {time}",{time:t}):""}function Zee(e){const t=new Date(e*1e3);if(Number.isNaN(t.getTime()))return"";const a=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`,o=d=>Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/864e5),c=o(t)-o(new Date);return c===0?r("今天 {time}",{time:a}):c===1?r("明天 {time}",{time:a}):oc(e)}function Wee(e){const t=[],a=Number(e.pendingUntil);if(Number.isFinite(a)&&a>0){const c=Zee(a);c&&t.push(r("待生效 {time}",{time:c}))}const o=oc(e.endsAt);if(o&&t.push(r("到期 {time}",{time:o})),t.length===0){const c=oc(e.startsAt);c&&t.push(r("开始 {time}",{time:c}))}return t.join(" · ")}function Jee({options:e,onClose:t}){const a=e.id,[,o]=x.useState(0);x.useEffect(()=>YA(()=>o(P=>P+1)),[]);const[c,d]=x.useState([]),[f,p]=x.useState({status:"loading"}),[h,b]=x.useState(""),y=Ea(a),v=String(y?.name||e.name||a),w=Kh(y),j=[...new Set([...w,...c])],S=y?.claimPlans&&typeof y.claimPlans=="object"&&!Array.isArray(y.claimPlans)?y.claimPlans:{},N=y?Za(y):void 0,k=N&&typeof N=="object"&&!Array.isArray(N)?N:null,T=k&&Array.isArray(k.plans)?k.plans:[],D=j.filter(P=>P&&!T.some(O=>String(O.planId||"")===P)),C=Ws().usageInflight.has(a),A=Pe().wbZcodeClaim,R=x.useCallback(async()=>{if(!A?.preview){p({status:"error",message:r("当前环境不支持领取(桥接方法缺失)")});return}p({status:"loading"});try{const P=await A.preview(a);p({status:"ready",result:P||{}})}catch(P){p({status:"error",message:ut(P)})}},[A,a]);x.useEffect(()=>{R();const P=Ea(a);P&&Za(P)===void 0&&tg(a)},[a,R]);async function I(P){if(!(!A?.claim||h)){b(P);try{const O=await A.claim(a,P);if(O?.ok||O?.failure==="already_claimed"){const _=O.planId||P;_&&d(L=>L.includes(_)?L:[...L,_]),tg(a),Pe().wbApp?.refresh?.(),R()}}finally{b("")}}}return s.jsx(Qt,{open:!0,onOpenChange:(P,O)=>{if(!P){if(h){O.cancel();return}t()}},children:s.jsxs(Zt,{className:"w-[min(560px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("ZCode 套餐明细 — {name}",{name:v})})}),s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("可领取的套餐"),s.jsx(ze,{variant:"outline",shape:"tag",children:r("官方限时活动")})]}),f.status==="loading"?s.jsxs("div",{className:"flex items-center gap-2 py-2 text-[12.5px] text-muted-foreground",children:[s.jsx(ef,{className:"size-3"}),r("正在探测可领取的套餐…")]}):f.status==="error"?s.jsxs("div",{className:"py-1 text-[12.5px] text-destructive",children:[r("探测失败:{message}",{message:f.message}),s.jsx(se,{variant:"outline",size:"xs",className:"ml-2",onClick:()=>{R()},children:r("重试")})]}):f.result.deployed?(f.result.plans||[]).length===0?s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动期内每天发一份,明天可再领)")}):s.jsx("ul",{className:"m-0 list-none p-0",children:(f.result.plans||[]).map(P=>{const O=String(P.planId||""),_=j.includes(O),L=LP(P),H=Qee(P);return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),_?s.jsx(ze,{variant:"success",shape:"tag",children:r("今日已领")}):null]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null,P.description?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:P.description}):null]}),s.jsx(se,{variant:"outline",size:"xs",className:"flex-none",title:_?r("这一份今天已经领过了(重复领取上游会回「已领取过」)"):void 0,disabled:h!=="",onClick:()=>{I(O)},children:r(h===O?"领取中…":_?"再领一次":"领取")})]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动尚未开始)")}),s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("活动期内每天发一份新套餐;同一份当天重复领取会提示「已领取过」,次日可再领。领取要走一次人机验证(滑块)。")}),f.status==="ready"&&f.result.activationError?s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:r("(激活事件补报失败,可能影响领取资格:{message})",{message:f.result.activationError})}):null]}),s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("我的套餐"),Array.isArray(k?.wallets)&&k.wallets.length>0&&k.availableView?s.jsx(ze,{variant:"outline",shape:"tag",children:String(k.walletsFrom||"")==="monitor"?String(k.availableView):r("可用 {value}",{value:String(k.availableView)})}):null,s.jsx("div",{className:"ml-auto",children:s.jsx(se,{variant:"outline",size:"xs",disabled:C,title:r("重新读取该账号的余额与套餐(走余额查询那条链)"),onClick:()=>{tg(a)},children:r(C?"查询中…":"查询余额")})})]}),T.length>0?s.jsx("ul",{className:"m-0 list-none p-0",children:T.map(P=>{const O=String(P.planId||""),_=String(P.state||"unknown"),L=LP(P),H=Wee(P),B=O&&y?.claimPlans&&Number(y.claimPlans[O])||0;return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),s.jsx(ze,{variant:Gee[_]||"outline",shape:"tag",children:_A(_)})]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null]}),B>0?s.jsx("span",{className:"flex-none text-[11.5px] text-muted-foreground",children:r("本地领取于 {time}",{time:oc(B/1e3)})}):null]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:N===void 0?r("还没有余额读数(已自动查询一次,稍候;也可以点右上角「查询余额」重读)"):k&&k.source&&k.source!==qee?r("这个账号的余额走窗口限额通道(只配了编码套餐 API Key):只有每 N 小时的剩余比例,读不到套餐清单"):r("读数里没有套餐清单(免费账号、或套餐的上游状态还没刷新;可点右上角「查询余额」重读)")}),D.length>0?s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("本地台账里今天还领过这些,但上面的读数里还没有:{plans}(读数刷新可能有延迟)",{plans:D.map(P=>{const O=Number(S[P])||0,_=O>0?oc(O/1e3):"";return _?r("{plan}({time} 领取)",{plan:P,time:_}):P}).join(r("、"))})}):null]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:j.length>0?r("今天(北京时间)已领取 {n} 份:{plans}",{n:j.length,plans:j.join(r("、"))}):r("今天还没有领过:上面「可领取的套餐」里逐份点「领取」即可")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})})}let Pp=null,Ju=null;function zP(){Pp&&(Pp.unmount(),Pp=null),Ju&&(Ju.remove(),Ju=null)}function ete(e){e?.id&&(zP(),Ju=document.createElement("div"),document.body.append(Ju),Pp=vn.createRoot(Ju),Pp.render(s.jsx(Jee,{options:e,onClose:zP})))}window.wbZcodePlans={open:ete};const BP="w-auto flex-auto";function HP({onInput:e,domRef:t,icon:a,className:o,inputClassName:c,...d}){const f=h=>{t.current=h},p=h=>{e?.(h.currentTarget.value)};return a?s.jsxs(Ci,{className:Ue(BP,o),children:[s.jsx(Ei,{ref:f,className:c,onInput:p,...d}),s.jsx(Ti,{"aria-hidden":"true",children:a})]}):s.jsx($e,{ref:f,className:Ue(BP,c),onInput:p,...d})}function tte(e,t){const a=vn.createRoot(e),o={current:null};return a.render(s.jsx(HP,{domRef:o,defaultValue:t.value,placeholder:t.placeholder,type:t.type??"search",icon:t.icon,"aria-label":t.ariaLabel,onInput:t.onInput})),{setValue(c){const d=o.current;d&&d.value!==c&&(d.value=c)},getValue(){return o.current?.value??""},focus(){o.current?.focus()},unmount(){a.unmount()}}}const nte=[["id","id"],["type","type"],["name","name"],["title","title"],["placeholder","placeholder"],["min","min"],["max","max"],["step","step"],["autocomplete","autoComplete"]];function ste(e){const t={defaultValue:e.value||void 0,inputClassName:e.className||void 0};for(const[f,p]of nte){const h=e.getAttribute(f);h!=null&&(t[p]=h)}const a=e.getAttribute("maxlength");a!=null&&(t.maxLength=Number(a));const o=e.getAttribute("inputmode");o!=null&&(t.inputMode=o),e.hasAttribute("spellcheck")&&(t.spellCheck=e.spellcheck),e.disabled&&(t.disabled=!0),e.readOnly&&(t.readOnly=!0),e.hidden&&(t.hidden=!0);const c=e.getAttribute("aria-label");c!=null&&(t["aria-label"]=c);for(const f of e.getAttributeNames())!f.startsWith("data-")||f.startsWith("data-island-")||(t[f]=e.getAttribute(f)??"");const d=e.getAttribute("data-island-icon");return d!=null&&(t.icon=d),t}function UP(e){if(e.dataset.islandUpgraded)return;e.dataset.islandUpgraded="1";const t=ste(e),a=e.parentElement?.classList.contains("input-affix")?e.parentElement:null;let o;a?(a.className=a.className.replace(/\binput-affix\b/,"").trim(),a.style.display="flex",a.style.alignItems="center",o=a):(o=document.createElement("span"),o.style.display="contents",e.replaceWith(o));const c={current:null},d=vn.createRoot(o);Cs.flushSync(()=>{d.render(s.jsx(HP,{...t,domRef:c}))})}function VP(e=document){if(e instanceof HTMLInputElement&&e.matches("[data-island-input]")){UP(e);return}e.querySelectorAll("input[data-island-input]").forEach(UP)}function rte(){VP();const e=new MutationObserver(t=>{for(const a of t)for(const o of a.addedNodes)o instanceof Element&&VP(o)});return e.observe(document.body,{childList:!0,subtree:!0}),e}function ate(e,t){const a=vn.createRoot(e);let o={options:t.options,value:t.value,ariaLabel:t.ariaLabel,className:t.className};const c=()=>{a.render(s.jsx(In,{options:o.options,value:o.value,onValueChange:t.onChange,"aria-label":o.ariaLabel,className:o.className}))};return c(),{setValue(d){d!==o.value&&(o={...o,value:d},c())},setOptions(d){o={...o,options:d},c()},unmount(){a.unmount()}}}window.wbSegmented={mount:ate},window.wbInput={mount:tte},rte()})(); From 751ee4e6af4c44fbae8b852c94903f524b42b958 Mon Sep 17 00:00:00 2001 From: coulsontl <149155411+coulsontl@users.noreply.github.com> Date: Sat, 17 Oct 2026 12:18:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E7=AD=BE=E5=88=B0=E3=80=8C=E9=9A=8F=E6=9C=BA=E5=89=8D?= =?UTF-8?q?=E5=90=8E=20N=20=E5=88=86=E9=92=9F=E3=80=8D=E2=80=94=E2=80=94?= =?UTF-8?q?=20=E6=AF=8F=E6=9D=A1=E5=AE=9A=E6=97=B6=E6=9D=A1=E7=9B=AE?= =?UTF-8?q?=E5=8F=AF=E8=AE=BE=E7=AA=97=E5=8F=A3=20[=E6=97=B6=E5=88=BB-N,?= =?UTF-8?q?=20=E6=97=B6=E5=88=BB+N]=EF=BC=88=E5=A4=B9=E5=88=B0=E5=BD=93?= =?UTF-8?q?=E5=A4=A9=200:00=E2=80=9323:59=EF=BC=89=EF=BC=8C=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E8=B5=B7=E7=82=B9=E7=94=B1=2030=20=E7=A7=92=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=E8=A7=A6=E5=8F=91=E4=B8=80=E6=AC=A1=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E8=BD=AE=E8=B4=A6=E5=8F=B7=E5=9C=A8=E7=AA=97=E5=8F=A3=E5=86=85?= =?UTF-8?q?=E5=90=84=E8=87=AA=E5=8F=96=E4=B8=80=E4=B8=AA=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E6=80=A7=E5=81=8F=E7=A7=BB=E4=BE=9D=E6=AC=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=9B=E5=AF=B9=E4=B8=8A=E6=B8=B8=E5=91=88=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E6=98=AF=E6=95=A3=E5=9C=A8=E7=AA=97=E5=8F=A3=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E9=80=90=E4=B8=AA=E8=AF=B7=E6=B1=82=EF=BC=8C=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E6=AF=8F=E5=A4=A9=E5=90=8C=E4=B8=80=E5=88=86=E9=92=9F?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=B8=B2=E3=80=82=E5=81=8F=E7=A7=BB=E7=94=A8?= =?UTF-8?q?=20sha256(=E6=9D=A1=E7=9B=AE=20id=20|=20=E6=97=A5=E6=9C=9F=20|?= =?UTF-8?q?=20=E6=97=B6=E5=88=BB=20|=20N=20|=20=E8=B4=A6=E5=8F=B7=20id)=20?= =?UTF-8?q?=E6=B4=BE=E7=94=9F=EF=BC=8C=E5=90=8C=E4=B8=80=E5=A4=A9=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E8=90=BD=E5=9C=A8=E5=90=8C=E4=B8=80=E6=97=B6=E5=88=BB?= =?UTF-8?q?=EF=BC=8C=E9=9D=A2=E6=9D=BF=E3=80=8C=E4=B8=8B=E6=AC=A1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E3=80=8D=E4=B8=8E=E7=9C=9F=E5=AE=9E=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?=E4=B8=80=E8=87=B4=202.=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E3=80=8C?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=A1=A5=E7=AD=BE=E3=80=8D=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=BC=80=E5=85=B3=EF=BC=88=E7=BC=BA=E7=9C=81=E5=BC=80=20=3D=20?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E6=94=B9=E9=80=A0=E5=89=8D=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?=EF=BC=89=E2=80=94=E2=80=94=20=E5=85=B3=E6=8E=89=E5=90=8E?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8F=AA=E8=B5=B7=E8=B0=83=E5=BA=A6=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=EF=BC=8C=E4=BB=8A=E5=A4=A9=E6=9C=AA=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=9A=84=E6=9D=A1=E7=9B=AE=E7=AD=89=E5=88=B0=E5=90=84=E8=87=AA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E8=B5=B7=E7=82=B9=E5=86=8D=E7=94=B1=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=E8=A7=A6=E5=8F=91=EF=BC=8C=E9=81=BF=E5=85=8D=E6=97=A9?= =?UTF-8?q?=E4=B8=8A=E5=BC=80=E6=9C=BA=E6=8A=8A=E5=BD=93=E5=A4=A9=E7=9A=84?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E7=AA=97=E5=8F=A3=E6=8F=90=E5=89=8D=E7=AD=BE?= =?UTF-8?q?=E6=8E=89=203.=20=E4=BC=98=E5=8C=96=EF=BC=9A=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E7=9A=84=E9=93=BA=E5=BC=80=E8=B5=B0=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E4=BB=BB=E5=8A=A1=E8=80=8C=E9=9D=9E=E5=9C=A8=20tick?= =?UTF-8?q?=20=E9=87=8C=20await=20=E2=80=94=E2=80=94=20=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=9C=80=E9=95=BF=204=20=E5=B0=8F=E6=97=B6=EF=BC=8C=E5=8D=A0?= =?UTF-8?q?=E4=BD=8F=20tick=20=E4=BC=9A=E5=BB=B6=E5=90=8E=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E6=9D=A1=E7=9B=AE=EF=BC=8C=E5=8D=A0=E4=BD=8F=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=89=A7=E8=A1=8C=E9=94=81=E4=BC=9A=E6=8B=92=E6=8E=89?= =?UTF-8?q?=E6=89=80=E6=9C=89=E6=89=8B=E5=8A=A8=E7=AD=BE=E5=88=B0=EF=BC=9B?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BB=BB=E5=8A=A1=E5=8F=AA=E5=9C=A8=E6=AF=8F?= =?UTF-8?q?=E4=B8=AA=E8=B4=A6=E5=8F=B7=E6=89=A7=E8=A1=8C=E7=9A=84=E5=87=A0?= =?UTF-8?q?=E7=A7=92=E9=87=8C=E6=8A=A2=E9=94=81=EF=BC=8C=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E4=B9=8B=E9=97=B4=E7=9A=84=E7=AD=89=E5=BE=85=E5=85=A8=E7=A8=8B?= =?UTF-8?q?=E5=9C=A8=E9=94=81=E5=A4=96=EF=BC=8C=E6=8C=89=E5=A2=99=E4=B8=8A?= =?UTF-8?q?=E6=97=B6=E9=92=9F=E5=88=86=E6=AE=B5=E9=87=8D=E7=AE=97=EF=BC=88?= =?UTF-8?q?=E4=BC=91=E7=9C=A0=20/=20=E6=94=B9=E6=97=B6=E9=92=9F=E9=83=BD?= =?UTF-8?q?=E8=83=BD=E8=87=AA=E6=84=88=EF=BC=89=204.=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9A`run=5Fcheckin`=20=E6=8A=BD=E5=87=BA=20`run=5Faccount`?= =?UTF-8?q?=20=E4=B8=8E=20`summarize=5Fresults`=EF=BC=8C=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E9=93=BA=E5=BC=80=E4=B8=8E=E6=89=B9=E9=87=8F=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=85=B1=E7=94=A8=E5=90=8C=E4=B8=80=E6=AE=B5=E8=AE=B0=E8=B4=A6?= =?UTF-8?q?=EF=BC=88=E8=90=BD=20checkinAt=E3=80=81=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=8F=B0=E8=B4=A6=E3=80=81=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E5=8F=A3=E5=BE=84=EF=BC=89=EF=BC=8C=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E4=B8=A4=E5=A5=97=E8=A1=8C=E4=B8=BA=EF=BC=9B`run=5Fcheckin`=20?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E4=B8=8D=E5=8F=98=EF=BC=8C=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=9B=B6=E6=94=B9=E5=8A=A8=205.=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9A=E9=9A=8F=E6=9C=BA=E7=AA=97=E5=8F=A3=E9=93=BA?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E6=97=B6=E9=97=B4=E8=B5=B7=E7=82=B9=E7=94=B1?= =?UTF-8?q?=E3=80=8C=E8=BF=99=E4=B8=80=E8=BD=AE=E7=9A=84=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E3=80=8D=E6=8E=A8=E5=87=BA=E8=80=8C=E4=B8=8D=E6=98=AF=E3=80=8C?= =?UTF-8?q?=E6=AD=A4=E5=88=BB=E7=9A=84=E6=97=A5=E6=9C=9F=E3=80=8D=E2=80=94?= =?UTF-8?q?=E2=80=94=2023:5x=20=E7=9A=84=E7=AA=97=E5=8F=A3=E8=B7=A8?= =?UTF-8?q?=E8=BF=87=E9=9B=B6=E7=82=B9=E6=97=B6=EF=BC=8C=E7=94=A8=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E6=97=B6=E9=97=B4=E4=BC=9A=E7=AE=97=E5=87=BA?= =?UTF-8?q?=E6=AC=A1=E6=97=A5=E5=90=8C=E4=B8=80=E5=88=86=E9=92=9F=EF=BC=8C?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=B4=A6=E5=8F=B7=E8=A6=81=E7=99=BD=E7=9D=A1?= =?UTF-8?q?=E7=BA=A6=2024=20=E5=B0=8F=E6=97=B6=206.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=88=E8=87=AA=E5=AE=A1=EF=BC=89=EF=BC=9A=E9=93=BA=E5=BC=80?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E7=9B=AE=E6=A0=87=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E4=B8=8E=E8=AE=A1=E5=88=92=E5=89=8D=E7=A7=BB=E5=88=B0=20spawn?= =?UTF-8?q?=20=E4=B9=8B=E5=89=8D=20=E2=80=94=E2=80=94=20=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E8=83=BD=E5=9B=9E=E9=80=80=20`lastF?= =?UTF-8?q?iredDate`=20=E5=B9=B6=E8=AE=A9=E4=B8=8B=E4=B8=AA=20tick=20?= =?UTF-8?q?=E9=87=8D=E8=AF=95=EF=BC=8C=E6=AD=A4=E5=89=8D=E6=98=AF=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E5=81=B6=E5=8F=91=E5=A4=B1=E8=B4=A5=E5=B0=B1=E8=AE=A9?= =?UTF-8?q?=E8=BF=99=E6=9D=A1=E6=9D=A1=E7=9B=AE=E6=95=B4=E5=A4=A9=E9=9D=99?= =?UTF-8?q?=E9=BB=98=EF=BC=9B=E8=B4=A6=E5=8F=B7=E9=9B=86=E5=90=88=E4=B9=9F?= =?UTF-8?q?=E5=9C=A8=20spawn=20=E6=97=B6=E5=AE=9A=E6=A0=BC=EF=BC=8C?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=B7=91=204=20=E5=B0=8F=E6=97=B6=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E8=B4=A6=E5=8F=B7=E5=A2=9E=E5=88=A0=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=AE=A9=E8=AE=A1=E5=88=92=E4=B8=AD=E9=80=94=E5=8F=98=E5=BD=A2?= =?UTF-8?q?=207.=20=E4=BF=AE=E5=A4=8D=EF=BC=88=E8=87=AA=E5=AE=A1=EF=BC=89?= =?UTF-8?q?=EF=BC=9A`spreads`=20=E7=9A=84=20key=20=E6=94=B9=E7=94=B1=20`Sp?= =?UTF-8?q?readGuard`=20=E7=9A=84=20Drop=20=E6=B8=85=E7=90=86=20=E2=80=94?= =?UTF-8?q?=E2=80=94=20=E6=AD=A3=E5=B8=B8=E7=BB=93=E6=9D=9F=20/=20?= =?UTF-8?q?=E6=8F=90=E5=89=8D=20return=20/=20=E5=90=8E=E5=8F=B0=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=A2=AB=20abort=20=E4=B8=89=E7=A7=8D=E5=87=BA?= =?UTF-8?q?=E5=8F=A3=E9=83=BD=E8=A6=86=E7=9B=96=EF=BC=9B=E6=AD=A4=E5=89=8D?= =?UTF-8?q?=E5=8F=AA=E5=9C=A8=E6=AD=A3=E5=B8=B8=E8=B7=AF=E5=BE=84=E6=89=8B?= =?UTF-8?q?=E5=86=99=E6=B8=85=E7=90=86=EF=BC=8C=E4=B8=80=E6=AC=A1=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=B0=B1=E8=AE=A9=E8=BF=99=E6=9D=A1=E6=9D=A1=E7=9B=AE?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=B0=B8=E4=B9=85=E4=B8=8D=E5=86=8D=E9=87=8D?= =?UTF-8?q?=E8=AF=95=208.=20=E4=BF=AE=E5=A4=8D=EF=BC=88=E8=87=AA=E5=AE=A1?= =?UTF-8?q?=EF=BC=89=EF=BC=9A`acquire=5Frunning`=20=E5=8A=A0=2010=20?= =?UTF-8?q?=E5=88=86=E9=92=9F=E4=B8=8A=E9=99=90=20=E2=80=94=E2=80=94=20?= =?UTF-8?q?=E5=8F=A6=E4=B8=80=E8=BD=AE=E7=AD=BE=E5=88=B0=E8=8B=A5=E5=8D=A1?= =?UTF-8?q?=E6=AD=BB=E5=9C=A8=E4=B8=8A=E6=B8=B8=EF=BC=8C=E6=97=A0=E9=99=90?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E4=BC=9A=E8=AE=A9=E9=93=BA=E5=BC=80=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=B0=B8=E4=B9=85=E6=8C=82=E4=BD=8F=E3=80=81key=20?= =?UTF-8?q?=E6=B0=B8=E4=B8=8D=E9=87=8A=E6=94=BE=EF=BC=9B=E5=88=B0=E7=82=B9?= =?UTF-8?q?=E5=A6=82=E5=AE=9E=E8=B7=B3=E8=BF=87=E5=89=A9=E4=BD=99=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=209.=20=E4=BF=AE=E5=A4=8D=EF=BC=88=E8=87=AA=E5=AE=A1?= =?UTF-8?q?=EF=BC=89=EF=BC=9A=E6=9C=AC=E8=BD=AE=E8=A2=AB=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E6=88=AA=E6=96=AD=EF=BC=88=E5=81=9C=E6=9C=BA=20/=20=E7=AD=89?= =?UTF-8?q?=E9=94=81=E8=B6=85=E6=97=B6=EF=BC=89=E6=97=B6=E4=B8=8D=E8=90=BD?= =?UTF-8?q?=20`lastFiredDate`=20=E2=80=94=E2=80=94=20=E5=89=A9=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E8=B4=A6=E5=8F=B7=E4=BB=8A=E5=A4=A9=E8=BF=98=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=B2=A1=E7=AD=BE=EF=BC=8C=E8=90=BD=E8=B4=A6=E4=BC=9A?= =?UTF-8?q?=E6=8A=8A=E5=AE=83=E4=BB=AC=E6=95=B4=E5=A4=A9=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E6=8E=89=EF=BC=9B=E5=B7=B2=E7=AD=BE=E8=BF=87=E7=9A=84=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E5=B9=82=E7=AD=89=2010.=20=E4=BF=AE=E5=A4=8D=EF=BC=88?= =?UTF-8?q?=E8=87=AA=E5=AE=A1=EF=BC=89=EF=BC=9A`jitterMinutes`=20=E7=9A=84?= =?UTF-8?q?=E5=86=99=E5=85=A5=E6=A0=A1=E9=AA=8C=E6=8B=92=E7=BB=9D=20`1e3`?= =?UTF-8?q?=20/=20=E5=8D=81=E5=85=AD=E8=BF=9B=E5=88=B6=20/=20=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E7=A9=BA=E6=A0=BC=E7=AD=89=20`Number()`=20=E4=BC=9A?= =?UTF-8?q?=E6=94=BE=E8=BF=87=E7=9A=84=E5=86=99=E6=B3=95=EF=BC=9B`submit`?= =?UTF-8?q?=20=E5=8A=A0=20`canSave`=20=E5=AE=88=E5=8D=AB=EF=BC=8C=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E4=B8=8E=E7=A8=8B=E5=BA=8F=E5=8C=96=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=B9=9F=E6=8C=A1=E5=BE=97=E4=BD=8F=2011.=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=EF=BC=9A19=20=E4=B8=AA=E7=BA=AF=E5=87=BD=E6=95=B0=E5=8D=95?= =?UTF-8?q?=E6=B5=8B=EF=BC=88=E7=AA=97=E5=8F=A3=E8=BE=B9=E7=95=8C=E5=A4=B9?= =?UTF-8?q?=E5=8F=96=E3=80=81=E5=81=8F=E7=A7=BB=E7=A1=AE=E5=AE=9A=E6=80=A7?= =?UTF-8?q?/=E8=8C=83=E5=9B=B4/=E5=88=86=E6=95=A3=E3=80=81=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E5=88=A4=E5=AE=9A=E3=80=81=E5=AD=97=E6=AE=B5=E5=BE=80?= =?UTF-8?q?=E8=BF=94=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop-tauri/i18n/i18n-src/en/checkin.json | 10 +- desktop-tauri/i18n/i18n-src/ja/checkin.json | 10 +- desktop-tauri/i18n/i18n-src/ko/checkin.json | 10 +- .../i18n/i18n-src/pt-BR/checkin.json | 10 +- .../i18n/i18n-src/zh-Hant/checkin.json | 10 +- .../server/src/server/api/auto_checkin.rs | 4 +- .../src/server/api/checkin_schedules.rs | 2 +- .../server/src/server/core/auto_checkin.rs | 678 ++++++++++++++++-- .../server/src/server/core/billing/checkin.rs | 110 +-- .../src/server/core/checkin_schedules.rs | 131 +++- .../src/islands/checkin-schedule-tab.tsx | 68 +- .../src/islands/checkin-schedules-state.ts | 23 +- .../ui-islands/src/islands/checkin-state.ts | 4 + desktop-tauri/ui/i18n/en/checkin.js | 2 +- desktop-tauri/ui/i18n/ja/checkin.js | 2 +- desktop-tauri/ui/i18n/ko/checkin.js | 2 +- desktop-tauri/ui/i18n/pt-BR/checkin.js | 2 +- desktop-tauri/ui/i18n/zh-Hant/checkin.js | 2 +- desktop-tauri/ui/islands/ui.js | 30 +- 19 files changed, 986 insertions(+), 124 deletions(-) diff --git a/desktop-tauri/i18n/i18n-src/en/checkin.json b/desktop-tauri/i18n/i18n-src/en/checkin.json index c4146288..70b5736e 100644 --- a/desktop-tauri/i18n/i18n-src/en/checkin.json +++ b/desktop-tauri/i18n/i18n-src/en/checkin.json @@ -56,10 +56,12 @@ "全部结果": "All outcomes", "全部账号均可签到": "All accounts can check in", "全部领取": "All claimed", + "关着:开机后等到窗口起点再签,随机窗口当天生效": "Off: wait for the window start after startup, so the random window applies today", "关着:所有条目都不执行": "Off: no schedule runs", + "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "minutes · accounts run at random moments inside the window; 0 = run immediately at the scheduled time", "删除失败:{error}": "Delete failed: {error}", "删除定时条目": "Delete schedule", - "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", + "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "Signs in the available accounts of the selected providers when due (WorkBuddy CN uses its daily check-in API; WorkBuddy Intl uses the daily activity task: probe activities, claim the daily reward, then keep a free model warm and open a web session to light up the streak; Raccoon uses its desktop daily points chain; AutoClaw uses the official client's daily sign-in task; Qoder CN claims campaign rewards and shows a neutral notice for accounts without campaigns; Qoder Intl needs a device risk identity (generated by the UMID component of the local Qoder client / qodercli) to see the 'daily 100 Credits' campaign and shows a clear explanation instead of an error when the component is missing; Trae claims the SOLO daily check-in credits (reset at local midnight) and reports 'not claimed + reason' instead of an error when the upstream has no campaign for the account or the credential has no device id; Loomy calls its first-login points endpoint once a day; KukuAI claims the 'free points' daily tasks; CodeArts claims the daily ops welfare (claim → confirm → read back, with automatic runs limited to 6 writes per day and 10 minutes apart); OfficeAce claims all of the day's rewards (daily check-in + newcomer gift) in one call). With 'random offset N minutes', the accounts of a round run spread across their own window (clamped to 0:00-23:59 of the same day) instead of all at the same minute; if the window has already passed they all run immediately. Missed runs are caught up after startup so nothing is lost when the machine was off (turn off 'Startup catch-up' to wait for the window start instead). Every provider's check-in API is idempotent, so repeated runs never double-claim.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; CodeArts claims that day's campaign welfare (claim → confirm → read back to verify; automatic runs are limited to 6 write attempts per day with a 10-minute gap); OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点时逐个签到,已勾 {n} / {total} 家": "Checked {n} of {total} — each is checked in at the scheduled time", @@ -73,6 +75,9 @@ "可领奖": "Can claim", "后端未返回定时签到数据": "Backend returned no schedule data", "后端未返回签到中心数据": "The backend did not return check-in center data", + "启动补签": "Startup catch-up", + "启动补签已关闭": "Startup catch-up disabled", + "启动补签已开启": "Startup catch-up enabled", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "International check-in requires the UMID component to generate a device risk-control identity (not detected on this machine).", "在途": "Traveling", "填入缺省链": "Fill in default chain", @@ -103,6 +108,7 @@ "开学季执行完成:{message}": "School-season run completed: {message}", "开学季活动": "School-season event", "开着:启用的条目按各自时刻执行": "On: enabled schedules run at their own times", + "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "On: schedules not yet run today catch up right after startup, ignoring the random window", "待签": "Not checked in", "待领新手福利": "Starter rewards to claim", "总开关": "Master switch", @@ -153,6 +159,7 @@ "正在读取签到数据…": "Loading check-in data…", "每天 {time}": "Daily at {time}", "每天 {time} · {scope}": "Daily {time} · {scope}", + "每天 {time} · 随机前后 {n} 分钟 · {scope}": "Daily {time} ± {n} min · {scope}", "每天时刻": "Daily time", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "One row per account per check-in run · outcomes and gains as recorded by the backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Daily activity tasks · a web-app conversation lights up the daily activity, only claims add points · the two can run separately", @@ -227,6 +234,7 @@ "重试": "Retry", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Limited-time trial plan · claim requires a slider CAPTCHA · view and claim one by one", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Limited-time trial plan (start-plan), one per day during the campaign · claim requires a slider CAPTCHA", + "随机前后": "Random offset", "需真实操作": "Requires real action", "非活动期": "Event inactive", "项": "items", diff --git a/desktop-tauri/i18n/i18n-src/ja/checkin.json b/desktop-tauri/i18n/i18n-src/ja/checkin.json index 37889727..ac2ece81 100644 --- a/desktop-tauri/i18n/i18n-src/ja/checkin.json +++ b/desktop-tauri/i18n/i18n-src/ja/checkin.json @@ -56,10 +56,12 @@ "全部结果": "すべての結果", "全部账号均可签到": "すべてのアカウントがチェックイン可能", "全部领取": "すべて受け取り済み", + "关着:开机后等到窗口起点再签,随机窗口当天生效": "オフ:起動後はウィンドウ開始まで待ち、当日からランダムウィンドウを適用", "关着:所有条目都不执行": "オフ:どのスケジュールも実行されません", + "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "分 · ウィンドウ内で各アカウントをランダムな時刻に実行、0 = 定刻に即実行", "删除失败:{error}": "削除に失敗しました:{error}", "删除定时条目": "スケジュールを削除", - "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", + "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると選択プロバイダーの利用可能なアカウントをサインインします(WorkBuddy 中国版は毎日チェックイン API、国際版はデイリーアクティブタスク:アクティビティ検出・日次報酬受取・無料モデルでキープアライブと Web セッションで連続日数を点灯。小浣熊はデスクトップの毎日ポイント経路、AutoClaw は公式クライアントの毎日サインインタスク、Qoder 中国版はキャンペーン受取でキャンペーン未配信のアカウントには中立の案内を表示、Qoder 国際版はデバイス風控身分(ローカルの Qoder クライアント / qodercli の UMID コンポーネントが生成)が必要で、コンポーネント欠如時はエラーではなく明確な説明を表示。Trae は SOLO の毎日チェックインクレジット(現地 0 時リセット)を受け取り、上流がアカウントにキャンペーンを出していない場合や資格情報にデバイス ID がない場合はエラーではなく「未受取 + 理由」を返します。Loomy は毎日初回ログインポイントを 1 回呼び、KukuAI は「無料ポイント」の毎日タスクを受け取り、CodeArts は当日の運営特典(受取 → 確認 → 読み戻し、自動実行は 1 日 6 回・10 分間隔の書き込み制限あり)を受け取り、OfficeAce はその日の全報酬(毎日チェックイン + 新規特典)を 1 回で受け取ります)。「ランダム幅 N 分」を設定すると、その回のアカウントは各自のウィンドウ内(当日 0:00〜23:59 にクランプ)に分散して実行され、同じ 1 分に集中しません。ウィンドウを過ぎている場合は全員すぐに実行します。逃した回は起動後にキャッチアップするので、電源が入っていなかったことで失われることはありません(「起動時キャッチアップ」をオフにするとウィンドウ開始まで待つ動作になります)。各プロバイダーのチェックイン API は冪等で、繰り返し実行しても二重取得にはなりません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;CodeArts はその日の運営特典を受け取ります(受け取り → 確認 → 読み戻し検証。自動実行は 1 日 6 回・間隔 10 分の書き込み制限を受けます);OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点时逐个签到,已勾 {n} / {total} 家": "定刻に 1 社ずつチェックインします。選択 {n} / {total} 社", @@ -73,6 +75,9 @@ "可领奖": "受け取り可能", "后端未返回定时签到数据": "バックエンドがスケジュールデータを返しませんでした", "后端未返回签到中心数据": "バックエンドがチェックインセンターのデータを返しませんでした", + "启动补签": "起動時キャッチアップ", + "启动补签已关闭": "起動時キャッチアップを無効にしました", + "启动补签已开启": "起動時キャッチアップを有効にしました", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "国際版のチェックインには、UMID コンポーネントで生成するデバイスリスク制御 ID が必要です(本機では検出されませんでした)。", "在途": "旅行中", "填入缺省链": "既定のチェーンを入力", @@ -103,6 +108,7 @@ "开学季执行完成:{message}": "新学期の実行が完了:{message}", "开学季活动": "新学期イベント", "开着:启用的条目按各自时刻执行": "オン:有効なスケジュールがそれぞれの時刻に実行されます", + "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "オン:起動後、本日未実行のスケジュールをランダムウィンドウを無視して即補完", "待签": "未チェックイン", "待领新手福利": "受け取り待ちの初心者ボーナス", "总开关": "マスタースイッチ", @@ -153,6 +159,7 @@ "正在读取签到数据…": "チェックインデータを読み込み中…", "每天 {time}": "毎日 {time}", "每天 {time} · {scope}": "毎日 {time} · {scope}", + "每天 {time} · 随机前后 {n} 分钟 · {scope}": "毎日 {time} 前後 {n} 分 · {scope}", "每天时刻": "毎日の時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "チェックイン1回ごとに · アカウントごとに1行 · 結果と収益はバックエンドの記録が正", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "毎日のアクティブタスク · Webチャネルの会話で日活を達成、ポイントは受け取りで加算 · 両方は別々に実行可能", @@ -227,6 +234,7 @@ "重试": "再試行", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "期間限定お試しプラン · 受け取りにはスライダー認証が必要 · 1 件ずつ確認して受け取り", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "期間限定体験プラン(start-plan)。開催期間中は毎日 1 件 · 受け取りにはスライダー認証が必要", + "随机前后": "ランダム幅", "需真实操作": "実際の操作が必要", "非活动期": "イベント期間外", "项": "件", diff --git a/desktop-tauri/i18n/i18n-src/ko/checkin.json b/desktop-tauri/i18n/i18n-src/ko/checkin.json index 14b794dc..d53ba834 100644 --- a/desktop-tauri/i18n/i18n-src/ko/checkin.json +++ b/desktop-tauri/i18n/i18n-src/ko/checkin.json @@ -56,10 +56,12 @@ "全部结果": "모든 결과", "全部账号均可签到": "모든 계정이 출석할 수 있습니다", "全部领取": "전체 수령 완료", + "关着:开机后等到窗口起点再签,随机窗口当天生效": "꺼짐: 시작 후 윈도 시작까지 기다리며, 당일부터 랜덤 윈도가 적용", "关着:所有条目都不执行": "꺼짐: 어떤 항목도 실행되지 않습니다", + "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "분 · 윈도 내에서 계정별로 무작위 시각에 실행, 0 = 정시에 즉시 실행", "删除失败:{error}": "삭제 실패: {error}", "删除定时条目": "예약 항목 삭제", - "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", + "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "시간이 되면 선택한 제공자의 사용 가능한 계정으로 출석합니다(WorkBuddy 중국판은 일일 출석 API, 국제판은 데일리 액티브 작업: 액티비티 탐지·일일 보상 수령·무료 모델로 키프얼라이브와 웹 세션으로 연속일 점등. 라쿤은 데스크톱 일일 포인트 경로, AutoClaw는 공식 클라이언트의 일일 출석 작업, Qoder 중국판은 캠페인 수령이며 캠페인이 없는 계정에는 중립 안내를 표시, Qoder 국제판은 기기 리스크 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트 생성)이 필요하며 컴포넌트가 없으면 오류 대신 명확한 설명을 표시합니다. Trae는 SOLO의 일일 출석 크레딧(현지 0시 리셋)을 받고, 업스트림이 계정에 캠페인을 내려주지 않았거나 자격 증명에 기기 ID가 없으면 오류 대신 \"미수령 + 사유\"를 반환합니다. Loomy는 매일 최초 로그인 포인트를 한 번 호출하고, KukuAI는 \"무료 포인트\" 일일 작업을 받고, CodeArts는 당일 운영 혜택(수령 → 확인 → 재조회, 자동 실행은 하루 6회·10분 간격 쓰기 제한)을 받고, OfficeAce는 그날의 모든 보상(일일 출석 + 신규 혜택)을 한 번에 받습니다). \"랜덤 폭 N분\"을 설정하면 해당 회차의 계정은 각자의 윈도 내(당일 0:00-23:59로 클램프)에 분산 실행되어 같은 1분에 몰리지 않습니다. 윈도가 이미 지났다면 전부 즉시 실행합니다. 놓친 회차는 시작 후 보충되므로 전원이 꺼져 있었다고 해서 사라지지 않습니다(\"시작 시 보충\"을 끄면 윈도 시작까지 기다립니다). 각 제공자의 출석 API는 멱등이며 반복 실행해도 이중 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; CodeArts는 당일 운영 혜택을 수령합니다(수령 → 확인 → 재조회 검증, 자동 실행은 하루 6회 / 간격 10분의 쓰기 요청 제한이 적용됩니다); OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点时逐个签到,已勾 {n} / {total} 家": "정해진 시각에 하나씩 출석합니다. 선택 {n} / {total}개", @@ -73,6 +75,9 @@ "可领奖": "수령 가능", "后端未返回定时签到数据": "백엔드가 예약 데이터를 반환하지 않았습니다", "后端未返回签到中心数据": "백엔드가 출석 체크 센터 데이터를 반환하지 않았습니다", + "启动补签": "시작 시 보충", + "启动补签已关闭": "시작 시 보충을 껐습니다", + "启动补签已开启": "시작 시 보충을 켰습니다", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "국제판 출석에는 기기 리스크 관리 신원을 생성할 UMID 컴포넌트가 필요합니다 (이 기기에서 감지되지 않음).", "在途": "여행 중", "填入缺省链": "기본 체인 채우기", @@ -103,6 +108,7 @@ "开学季执行完成:{message}": "개학 시즌 실행 완료: {message}", "开学季活动": "개학 시즌 이벤트", "开着:启用的条目按各自时刻执行": "켜짐: 활성화된 항목이 각자의 시간에 실행됩니다", + "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "켜짐: 시작 직후 오늘 아직 실행하지 않은 스케줄을 랜덤 윈도를 무시하고 즉시 보충", "待签": "출석 대기", "待领新手福利": "수령 대기 입문 혜택", "总开关": "메인 스위치", @@ -153,6 +159,7 @@ "正在读取签到数据…": "출석 데이터를 읽는 중…", "每天 {time}": "매일 {time}", "每天 {time} · {scope}": "매일 {time} · {scope}", + "每天 {time} · 随机前后 {n} 分钟 · {scope}": "매일 {time} ± {n}분 · {scope}", "每天时刻": "매일 시각", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "출석 실행마다 · 계정별 한 행 · 결과와 수익은 백엔드 기록 기준", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "매일 활성 작업 · 웹 채널 세션으로 일일 활성 달성, 포인트는 수령 시 적립 · 두 가지는 따로 실행 가능", @@ -227,6 +234,7 @@ "重试": "다시 시도", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "기간 한정 체험 플랜 · 수령 시 슬라이더 인증 필요 · 항목별로 확인하고 수령", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "기간 한정 체험 플랜(start-plan), 이벤트 기간 내 매일 1회 · 수령 시 슬라이더 캡차 필요", + "随机前后": "랜덤 폭", "需真实操作": "실제 조작 필요", "非活动期": "이벤트 기간 아님", "项": "건", diff --git a/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json b/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json index 7a2c5b9e..5485421e 100644 --- a/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json +++ b/desktop-tauri/i18n/i18n-src/pt-BR/checkin.json @@ -56,10 +56,12 @@ "全部结果": "Todos os resultados", "全部账号均可签到": "Todas as contas podem fazer check-in", "全部领取": "Resgatar todos", + "关着:开机后等到窗口起点再签,随机窗口当天生效": "Desligado: após iniciar, esperar o início da janela para que a janela aleatória valha hoje", "关着:所有条目都不执行": "Desligado: nenhum agendamento é executado", + "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "minutos · contas executam em momentos aleatórios dentro da janela; 0 = executar imediatamente no horário", "删除失败:{error}": "Falha ao excluir: {error}", "删除定时条目": "Excluir agendamento", - "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", + "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "Faz check-in nas contas disponíveis dos provedores marcados quando chega a hora (WorkBuddy CN usa a API de check-in diário; WorkBuddy Intl usa a tarefa de atividade diária: sondar atividades, resgatar a recompensa diária, manter um modelo gratuito ativo e abrir uma sessão web para acender a sequência; Raccoon usa a cadeia diária de pontos do desktop; AutoClaw usa a tarefa diária de sign-in do cliente oficial; Qoder CN resgata campanhas e mostra um aviso neutro para contas sem campanha; Qoder Intl precisa de uma identidade de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para ver a campanha de '100 Credits diários' e mostra uma explicação clara em vez de erro quando o componente falta; Trae resgata os créditos de check-in diário do SOLO (reset à meia-noite local) e informa 'não resgatado + motivo' em vez de erro quando o upstream não tem campanha para a conta ou a credencial não tem device id; Loomy chama o endpoint de pontos do primeiro login uma vez por dia; KukuAI resgata as tarefas diárias de 'pontos grátis'; CodeArts resgata o benefício diário de operações (resgatar → confirmar → reler, com execuções automáticas limitadas a 6 escritas por dia e 10 minutos de intervalo; OfficeAce resgata todas as recompensas do dia (check-in diário + presente de novato) em uma chamada). Com 'margem aleatória de N minutos', as contas de uma rodada executam espalhadas dentro da própria janela (limitada a 0:00-23:59 do mesmo dia) em vez de todas no mesmo minuto; se a janela já passou, todas executam imediatamente. Execuções perdidas são recuperadas após iniciar, então nada se perde quando a máquina estava desligada (desligue 'Recuperação na inicialização' para esperar o início da janela). A API de check-in de cada provedor é idempotente, então execuções repetidas nunca resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o CodeArts resgata o benefício de campanha do dia (resgatar → confirmar → reler para verificar; execuções automáticas têm limite de 6 gravações por dia com intervalo de 10 minutos); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点时逐个签到,已勾 {n} / {total} 家": "{n} de {total} marcados — o check-in é feito um por um no horário", @@ -73,6 +75,9 @@ "可领奖": "Pode resgatar", "后端未返回定时签到数据": "O backend não retornou dados de agendamento", "后端未返回签到中心数据": "O backend não retornou os dados da central de check-in", + "启动补签": "Recuperação na inicialização", + "启动补签已关闭": "Recuperação na inicialização desativada", + "启动补签已开启": "Recuperação na inicialização ativada", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "O check-in da edição internacional exige o componente UMID para gerar a identidade de controle de risco do dispositivo (não detectado nesta máquina).", "在途": "Em viagem", "填入缺省链": "Preencher cadeia padrão", @@ -103,6 +108,7 @@ "开学季执行完成:{message}": "Execução de volta às aulas concluída: {message}", "开学季活动": "Evento de volta às aulas", "开着:启用的条目按各自时刻执行": "Ligado: agendamentos habilitados rodam em seus próprios horários", + "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "Ligado: agendamentos ainda não executados hoje são recuperados logo após iniciar, ignorando a janela aleatória", "待签": "Pendente", "待领新手福利": "Benefícios iniciais pendentes", "总开关": "Interruptor principal", @@ -153,6 +159,7 @@ "正在读取签到数据…": "Lendo os dados de check-in…", "每天 {time}": "Todos os dias às {time}", "每天 {time} · {scope}": "Diário {time} · {scope}", + "每天 {time} · 随机前后 {n} 分钟 · {scope}": "Diariamente {time} ± {n} min · {scope}", "每天时刻": "Horário diário", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "Uma linha por conta a cada execução · resultados e ganhos conforme registrado pelo backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Tarefas de atividade diária · uma conversa no canal web acende a atividade diária, só o resgate adiciona pontos · os dois podem ser executados separadamente", @@ -227,6 +234,7 @@ "重试": "Tentar de novo", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Plano de teste por tempo limitado · o resgate exige CAPTCHA de arrastar · veja e resgate um a um", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Plano de teste por tempo limitado (start-plan), um por dia durante o evento · o resgate exige captcha deslizante", + "随机前后": "Margem aleatória", "需真实操作": "Requer ação real", "非活动期": "Evento inativo", "项": "itens", diff --git a/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json b/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json index da455647..cdc63654 100644 --- a/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json +++ b/desktop-tauri/i18n/i18n-src/zh-Hant/checkin.json @@ -56,10 +56,12 @@ "全部结果": "", "全部账号均可签到": "", "全部领取": "", + "关着:开机后等到窗口起点再签,随机窗口当天生效": "", "关着:所有条目都不执行": "", + "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "", "删除失败:{error}": "", "删除定时条目": "", - "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", + "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "", "到点时逐个签到,已勾 {n} / {total} 家": "", @@ -73,6 +75,9 @@ "可领奖": "可領獎", "后端未返回定时签到数据": "", "后端未返回签到中心数据": "", + "启动补签": "", + "启动补签已关闭": "", + "启动补签已开启": "", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "", "在途": "在途", "填入缺省链": "", @@ -102,6 +107,7 @@ "开学季执行完成:{message}": "開學季執行完成:{message}", "开学季活动": "開學季活動", "开着:启用的条目按各自时刻执行": "", + "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "", "待签": "", "待领新手福利": "", "总开关": "", @@ -152,6 +158,7 @@ "正在读取签到数据…": "", "每天 {time}": "", "每天 {time} · {scope}": "", + "每天 {time} · 随机前后 {n} 分钟 · {scope}": "", "每天时刻": "", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "", @@ -222,6 +229,7 @@ "重试": "", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "", + "随机前后": "", "需真实操作": "需真實操作", "非活动期": "非活動期", "项": "", diff --git a/desktop-tauri/src-tauri/server/src/server/api/auto_checkin.rs b/desktop-tauri/src-tauri/server/src/server/api/auto_checkin.rs index fe7c5f41..e9fe0259 100644 --- a/desktop-tauri/src-tauri/server/src/server/api/auto_checkin.rs +++ b/desktop-tauri/src-tauri/server/src/server/api/auto_checkin.rs @@ -1,7 +1,7 @@ //! 定时签到路由(对照 server.mjs 726-746 行)。 //! //! GET /api/auto-checkin 读取开关、触发时刻、上次结果 -//! POST /api/auto-checkin 修改设置 { enabled?, time? } +//! POST /api/auto-checkin 修改设置 { enabled?, time?, startupCatchUp? } //! POST /api/auto-checkin/run 立即执行一次 //! //! ── 错误信封(照抄 Node 的落点)──────────────────────────── @@ -43,7 +43,7 @@ pub async fn get_state(State(state): State) -> Response { ok_json(state.auto_checkin().state()) } -/// POST /api/auto-checkin —— 修改设置({ enabled?, time? }) +/// POST /api/auto-checkin —— 修改设置({ enabled?, time?, startupCatchUp? }) pub async fn configure(State(state): State, body: Bytes) -> Response { // 空 body 视为 {}(Node 的 `|| '{}'`);非法 JSON 在 Node 里由 JSON.parse // 抛出的 SyntaxError 走到 errorPayload → 500 proxy_error(实测如此), diff --git a/desktop-tauri/src-tauri/server/src/server/api/checkin_schedules.rs b/desktop-tauri/src-tauri/server/src/server/api/checkin_schedules.rs index 7fcbe66b..d361a272 100644 --- a/desktop-tauri/src-tauri/server/src/server/api/checkin_schedules.rs +++ b/desktop-tauri/src-tauri/server/src/server/api/checkin_schedules.rs @@ -2,7 +2,7 @@ //! //! ```text //! GET /api/checkin-schedules 状态(总开关 + 条目数组 + 提供商清单) -//! POST /api/checkin-schedules 保存一条(按 id upsert,{id?, label?, enabled?, time?, providers?}) +//! POST /api/checkin-schedules 保存一条(按 id upsert,{id?, label?, enabled?, time?, jitterMinutes?, providers?}) //! POST /api/checkin-schedules/{id}/delete 删除一条(DELETE 方法同受理) //! POST /api/checkin-schedules/{id}/run 立即执行这一条 //! ``` diff --git a/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs b/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs index 324f71b5..893dced7 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/auto_checkin.rs @@ -23,6 +23,20 @@ //! 「今日已签到」也按错误的日期显示。移植自 Node 版(作者在国内,`Local` //! 恰好等于 UTC+8)时没有显式钉住这个前提,这里补上。 //! +//! ── 随机窗口(`jitterMinutes`,0 = 关闭)──────────────────── +//! 每条条目可设「随机前后 N 分钟」,窗口 = `[时刻-N, 时刻+N]` 夹到当天。 +//! 窗口起点由 tick 触发**一次**,然后本轮账号在窗口内各自取一个确定性 +//! 偏移(`spread_offset_seconds`),按时间顺序执行 —— 对上游呈现的是散在 +//! 窗口里的逐个请求,而不是每天同一分钟的一串。 +//! 两个关键实现约束: +//! ① 铺开在**后台任务**里(`spawn_spread`),不在 tick 里 await:窗口最长 +//! 4 小时,占住 tick 会延后其他条目,占住全局 `running` 会拒掉所有手动 +//! 签到;后台任务只在每个账号执行的几秒里抢锁。 +//! ② 偏移是**确定性哈希**(条目 id + 日期 + 时刻 + N + 账号 id),不是每次 +//! 随机:同一天的重试(Qoder 国际版窗口、停机重启)必须落在同一点, +//! 面板的「下次执行」也才与真实行为一致。 +//! 手动签到(批量 / 单账号 / 条目「立即执行」)不铺开,行为与改造前一致。 +//! //! ── 补签(有意的行为,别「顺手优化」)──────────────────────── //! Node 版 `start()` 的条件是**「今天还没签过」**,并不判「时间点是否已过」: //! 开着自动签到却在 00:01 时没开机、白天才启动 → 立刻补一次。 @@ -31,6 +45,8 @@ //! 把 enabled 设为 true、time 设为 23:00(未来时点)时,Node 版立即执行了 //! 一次 reason='启动补签' 的签到 —— 所以这里的条件同样只看日期键。 //! 多条目之后按条目各补各的:今天没跑过的**启用**条目每条补一次。 +//! 该行为可通过 `autoCheckin.startupCatchUp`(缺省开)整体关掉,见 +//! [`startup_catch_up`]:关掉后启动只起调度循环,等各自窗口起点由 tick 触发。 //! //! ── 配置读写 ──────────────────────────────────────────────── //! 状态存在 config.json 的 `autoCheckin` 字段:`enabled` 是总开关, @@ -62,6 +78,21 @@ pub const TICK_MS: u64 = 30_000; /// 默认触发时刻:零点一分(Node 版 DEFAULT_TIME) pub const DEFAULT_TIME: &str = "00:01"; +/// 「随机前后 N 分钟」的上限。 +/// +/// 为什么是 120 而不是更大:窗口跨度直接决定一轮签到最长铺多久,而这一轮 +/// 期间每个账号执行时都要抢全局「执行中」标记(见 `acquire_running`), +/// 窗口越大,手动签到被拒的概率越高。2 小时足够打散「每天同一分钟」的形态, +/// 又不至于让「立即执行」在最坏情况下等太久。 +pub const MAX_JITTER_MINUTES: u32 = 120; + +/// 随机窗口铺开时,为单个账号等「执行中」标记的上限。 +/// +/// 正常的争用只来自手动签到(几秒到几分钟),等 10 分钟足够;超过就说明 +/// 另一轮卡死在上游了 —— 继续等只会让铺开任务永久挂住、连带条目今天不再 +/// 重试。到点如实跳过剩余账号(见 `acquire_running`)。 +const RUNNING_WAIT_MS: i64 = 10 * 60 * 1000; + /// 缺省触发时刻(`DEFAULT_TIME` 的 owned 形态,读侧兜底用) pub fn default_time() -> String { DEFAULT_TIME.to_string() @@ -348,11 +379,96 @@ pub fn today_key() -> String { beijing::today_key() } +/// 随机窗口的起止分钟(当天 00:00 起的分钟数)与跨度秒数。 +/// +/// `center` = `time` 换算成分钟;`start = max(0, center - N)`、 +/// `end = min(1439, center + N)` —— **夹到当天**。跨午夜时收敛到边界, +/// 分布因此会偏向一侧:这是有意的取舍(见模块头「随机窗口」), +/// 因为「某天没签、次日签两次」的观感比分布不均匀更糟。 +/// +/// time 非法 → None(与 `normalize_time` 同口径,调度起不来的情形不编时间)。 +pub fn window_bounds(time_text: &str, jitter_minutes: u32) -> Option<(u32, u32)> { + let normalized = normalize_time(Some(&Value::String(time_text.to_string()))).ok()?; + let (hour, minute) = normalized.split_once(':')?; + let center = hour.parse::().ok()? * 60 + minute.parse::().ok()?; + let start = center.saturating_sub(jitter_minutes); + let end = (center + jitter_minutes).min(23 * 60 + 59); + Some((start, end)) +} + +/// 窗口起点的绝对时刻(北京时间,当天)。时间非法 → None。 +fn window_start_at( + time_text: &str, + jitter_minutes: u32, + now: DateTime, +) -> Option> { + let (start, _) = window_bounds(time_text, jitter_minutes)?; + minute_of_day_at(start, now) +} + +/// 当天的第 `minute` 分钟(北京时间):窗口起点的落点。 +/// +/// 固定偏移没有夏令时问题(构造恒为 `Single`),因此不需要 Node 那种 +/// 「DST 当天该时刻不存在」的兜底 —— `single()` 取不到就当 None, +/// 也就是这台机器上的时钟环境异常到连北京时间的固定偏移都构造不出来。 +fn minute_of_day_at(minute: u32, now: DateTime) -> Option> { + let naive = now.date_naive().and_hms_opt(minute / 60, minute % 60, 0)?; + beijing::offset().from_local_datetime(&naive).single() +} + +/// 某个账号在窗口内的偏移秒数(`[0, span]`,含端点)。 +/// +/// ── 为什么是确定性哈希而不是 `getrandom` ──────────────────── +/// 同一天同一账号多次进入计算(tick 判定、重试、面板刷新)必须拿到**同一个** +/// 偏移:否则「Qoder 国际版窗口未开」的重试会每次换时间,面板也无法预演。 +/// 用 `sha256(条目 id | 日期 | 时刻 | 随机分钟 | 账号 id)` 派生,日期参与 +/// 哈希 ⇒ 每天不同;改时刻/随机值 ⇒ 当天未触发时偏移跟着变(符合直觉)。 +/// `span == 0`(N=0 或窗口被夹成一点)→ 恒 0,行为与不随机完全一致。 +/// +/// 取模偏差在 4 小时量级(≤14400)的跨度上可以忽略,不需要拒绝采样。 +pub fn spread_offset_seconds( + schedule_id: &str, + date: &str, + time_text: &str, + jitter_minutes: u32, + account_id: &str, +) -> u32 { + let Some((start, end)) = window_bounds(time_text, jitter_minutes) else { + return 0; + }; + let span = (end - start) * 60; + if span == 0 { + return 0; + } + use sha2::{Digest, Sha256}; + let mut hasher = Sha256::new(); + hasher.update(schedule_id.as_bytes()); + hasher.update(b"|"); + hasher.update(date.as_bytes()); + hasher.update(b"|"); + hasher.update(time_text.as_bytes()); + hasher.update(b"|"); + hasher.update(jitter_minutes.to_string().as_bytes()); + hasher.update(b"|"); + hasher.update(account_id.as_bytes()); + let digest = hasher.finalize(); + let mut bytes = [0u8; 8]; + bytes.copy_from_slice(&digest[..8]); + (u64::from_le_bytes(bytes) % (span as u64 + 1)) as u32 +} + /// 今天的触发时刻(北京时间);已过则返回 Some,未到返回 None。 /// 对应 Node 版 dueNow:非法的 time 文本在这里同样表现为 None(Node 是抛异常, /// 但调用方一律 catch 后 return,结果一致)。 -fn due_now(time_text: &str, now: DateTime) -> Option> { - let target = today_at(time_text, now)?; +/// +/// 有随机窗口时判的是**窗口起点**(到点即开始铺开,见 `spawn_spread`), +/// 而不是窗口中心——中心时刻本身不执行任何东西。 +fn due_now( + time_text: &str, + jitter_minutes: u32, + now: DateTime, +) -> Option> { + let target = window_start_at(time_text, jitter_minutes, now)?; if now >= target { Some(target) } else { @@ -367,32 +483,19 @@ fn due_now(time_text: &str, now: DateTime) -> Option) -> Option { - let mut target = today_at(time_text, now)?; +fn next_run_at_ms( + time_text: &str, + jitter_minutes: u32, + fired_today: bool, + now: DateTime, +) -> Option { + let mut target = window_start_at(time_text, jitter_minutes, now)?; if fired_today || target <= now { target += chrono::Duration::days(1); } Some(target.timestamp_millis()) } -/// 今天的 HH:MM 时刻(北京时间);time 文本非法时 None。 -/// -/// Node 用 `target.setHours(hour, minute, 0, 0)`(就地改到当天); -/// chrono 没有 set_* 的就地 API,用 `with_ymd_and_hms` 重建。 -/// 固定偏移没有夏令时问题(构造恒为 `Single`),因此不需要 Node 那种 -/// 「DST 当天该时刻不存在」的兜底 —— `single()` 取不到就当 None, -/// 也就是这台机器上的时钟环境异常到连北京时间的固定偏移都构造不出来。 -fn today_at(time_text: &str, now: DateTime) -> Option> { - let normalized = normalize_time(Some(&Value::String(time_text.to_string()))).ok()?; - let (hour, minute) = normalized.split_once(':')?; - let hour: u32 = hour.parse().ok()?; - let minute: u32 = minute.parse().ok()?; - let naive = now.date_naive().and_hms_opt(hour, minute, 0)?; - beijing::offset() - .from_local_datetime(&naive) - .single() -} - // ─── 状态读写 ─────────────────────────────────────────────── /// `autoCheckin` 字段的原始对象(非对象/缺失都给空对象)。 @@ -411,6 +514,19 @@ pub fn master_enabled() -> bool { raw_object().get("enabled").and_then(Value::as_bool) == Some(true) } +/// 「启动时立即补签」(`autoCheckin.startupCatchUp`,缺省 **开**)。 +/// +/// 开着 = 改造前的行为:启动时今天没签过的条目立刻补一次,不看时点是否已过 +/// (理由见模块头「补签」)。关掉 = 启动不补,交给 tick 按窗口起点判定 —— +/// 用户开了随机窗口又不希望「早上开机就提前签掉」时用这个开关。 +/// 缺省为开是刻意的:升级后行为零变化。 +pub fn startup_catch_up() -> bool { + raw_object() + .get("startupCatchUp") + .and_then(Value::as_bool) + .unwrap_or(true) +} + /// 合并写回 `autoCheckin`(对应 Node 版 writeState 的 `{...current, ...patch}`)。 /// 走 config.rs 的 `update_raw_field`,config.json 里的其它字段原样保留。 /// `pub(crate)`:多条目配置在同一键下写回,合并逻辑只有这一份。 @@ -434,6 +550,12 @@ struct Inner { task: Option>, /// 停机标志:stop() 置位后循环退出(幂等;再次 start 会重置) stopped: Arc, + /// 正在进行的「随机窗口铺开」任务,键是 `条目 id | 日期`。 + /// + /// 与 `running` 是两件事:铺开任务的大部分时间在 sleep(不该占执行锁), + /// 但同一个条目同一天不能起两轮(每个 tick 都会看到它到点且未落账 —— + /// 落账在 spawned 任务结束前,必须靠这个集合挡住重复 spawn)。 + spreads: std::collections::HashSet, } /// 定时签到服务句柄:内部一把锁 + Clone,与 update / models 同构。 @@ -464,6 +586,22 @@ impl Drop for RunningGuard { } } +/// 铺开任务的存续标记:Drop 时把 key 从 `spreads` 移除。 +/// +/// 覆盖三种出口:正常结束、提前 return、后台任务被 abort。守卫必须**移进** +/// 被 spawn 的 future 里 —— 放在 `spawn_spread` 的外层,函数一返回就 drop, +/// 等于什么都没保护。漏了这一步的后果是这条条目当天再也不会被 tick 重试。 +struct SpreadGuard { + service: AutoCheckin, + key: String, +} + +impl Drop for SpreadGuard { + fn drop(&mut self) { + self.service.finish_spread(&self.key); + } +} + impl AutoCheckin { pub fn new(store: AccountStore, billing: BillingService) -> Self { Self { @@ -473,6 +611,7 @@ impl AutoCheckin { running: false, task: None, stopped: Arc::new(AtomicBool::new(false)), + spreads: std::collections::HashSet::new(), })), } } @@ -512,7 +651,12 @@ impl AutoCheckin { .map(|schedule| { let fired_today = schedule.last_fired_date.as_deref() == Some(today.as_str()); let next_run_at = if master && schedule.enabled { - next_run_at_ms(&schedule.time, fired_today, now) + next_run_at_ms( + &schedule.time, + schedule.jitter_minutes, + fired_today, + now, + ) } else { None }; @@ -523,6 +667,7 @@ impl AutoCheckin { "displayLabel": checkin_schedules::display_label(schedule), "enabled": schedule.enabled, "time": schedule.time, + "jitterMinutes": schedule.jitter_minutes, "providers": schedule.providers, "lastFiredDate": schedule.last_fired_date, "lastFiredToday": fired_today, @@ -546,6 +691,7 @@ impl AutoCheckin { label: String::new(), enabled: false, time: default_time(), + jitter_minutes: 0, providers: default_providers(), last_fired_date: None, last_result: None, @@ -570,6 +716,8 @@ impl AutoCheckin { json!({ "id": id, "label": provider_label(id) }) }).collect::>(), "schedules": entries, + // 启动时立即补签(缺省 true;界面用总开关面板下面的那颗开关回显) + "startupCatchUp": startup_catch_up(), "running": self.is_running(), }) } @@ -648,23 +796,7 @@ impl AutoCheckin { Some(summary) } Err(error) => { - // 失败也写 lastResult(failed 里放错误文案),与 Node 的 catch 分支一致 - let failure = json!({ - "at": logging::now_ms(), - "date": today, - "reason": reason, - "succeeded": 0, - "active": 0, - "total": 0, - "skipped": 0, - "failed": [error.message.clone()], - "failedCount": 1, - }); - write_state(json!({ "lastResult": failure.clone() })); - if let Some(id) = schedule_id { - checkin_schedules::mark_result(id, Some(failure)); - } - logging::log("[Checkin]", &format!("❌ 定时签到失败: {}", error.message)); + self.record_failure(schedule_id, &today, reason, &error.message); None } }; @@ -672,8 +804,280 @@ impl AutoCheckin { outcome } + /// 失败分支:写 lastResult(failed 里放错误文案),与 Node 的 catch 分支一致。 + /// 两条路径共用:`fire_for` 的 `run_checkin` 报错、`spawn_spread` 的目标 + /// 解析失败(两者都只记一处账,文案口径一致)。 + fn record_failure(&self, schedule_id: Option<&str>, today: &str, reason: &str, message: &str) { + let failure = json!({ + "at": logging::now_ms(), + "date": today, + "reason": reason, + "succeeded": 0, + "active": 0, + "total": 0, + "skipped": 0, + "failed": [message], + "failedCount": 1, + }); + write_state(json!({ "lastResult": failure.clone() })); + if let Some(id) = schedule_id { + checkin_schedules::mark_result(id, Some(failure)); + } + logging::log("[Checkin]", &format!("❌ 定时签到失败: {message}")); + } + + /// 等到墙上时钟到达 `at_ms`;停机时返回 false。 + /// + /// 不直接 `sleep(很长的时长)`:tokio 定时器基于**单调时钟**,机器休眠期间 + /// 不推进,一觉醒来会白等超出预期的时间;而且单次长 sleep 期间无法响应 + /// 停机。这里封顶 30 秒,每一段都按墙上时钟(与 tick 同源,见模块头 + /// 「触发方式」)重新计算剩余量 —— 休眠、改系统时间都能自愈。 + async fn wait_until(&self, at_ms: i64) -> bool { + loop { + if self.lock().stopped.load(Ordering::SeqCst) { + return false; + } + let remaining = at_ms - logging::now_ms(); + if remaining <= 0 { + return true; + } + let chunk = remaining.min(TICK_MS as i64); + tokio::time::sleep(Duration::from_millis(chunk as u64)).await; + } + } + + /// 抢「执行中」标记;已有轮次在跑时按 500ms 轮询等待,直到拿到、停机 + /// 或等满 `RUNNING_WAIT_MS`。 + /// + /// 给随机窗口铺开用:铺开任务逐个账号执行,每次执行前抢一次锁,执行完 + /// 立刻放 —— 两个账号之间的 sleep 不持有锁,因此手动签到只可能在这些 + /// 几秒钟的窗口里撞上并得到「正在执行中」,而不是整段窗口都被拒绝。 + /// + /// **超时不是可选的**:另一轮签到若卡在上游(连接不断、迟迟不回), + /// `running` 会一直为 true。无限等待会让铺开任务永久挂住,连带 `spreads` + /// 里的 key 永不释放 —— 这条条目今天彻底静默。等满就如实跳过这个账号 + /// (返回 None 让调用方 break),本次轮次照常汇总落账。 + async fn acquire_running(&self) -> Option { + let deadline = logging::now_ms() + RUNNING_WAIT_MS; + loop { + { + let mut inner = self.lock(); + if inner.stopped.load(Ordering::SeqCst) { + return None; + } + if !inner.running { + inner.running = true; + return Some(RunningGuard { inner: self.inner.clone() }); + } + } + if logging::now_ms() >= deadline { + logging::verbose( + "[Checkin]", + "另一轮签到长时间未结束,本轮随机窗口跳过剩余账号", + ); + return None; + } + tokio::time::sleep(Duration::from_millis(500)).await; + } + } + + /// 起一轮「随机窗口铺开」:条目到窗口起点后,本轮账号在窗口内各自 + /// 随机一个时刻执行。 + /// + /// ── 为什么是后台任务而不是在 tick 里 await ───────────────── + /// 窗口最长 `2 × MAX_JITTER_MINUTES`(4 小时)。若照 `fire_for` 那样在 + /// tick 里一路 await 到底:① tick 循环被占住,其他条目到点会被延后; + /// ② 全局 `running` 会被持有一整个窗口,期间所有手动签到都被拒。 + /// 所以这里只做**同步的准备工作**(落账、起后台任务)后 spawn, + /// tick 立即返回;目标解析与 sleep 都在后台任务里、且不在锁内。 + fn spawn_spread(&self, schedule: &Schedule, reason: &str, today: &str) { + let key = format!("{}|{today}", schedule.id); + { + let mut inner = self.lock(); + if inner.spreads.contains(&key) { + return; + } + inner.spreads.insert(key.clone()); + } + // 从这里起,key 的移除由 Drop 负责:**任何**提前 return 或任务 abort + // 都要把 key 清掉,否则这条条目今天再也不会被 tick 重试(永久静默)。 + // 与 `RunningGuard` 同一手法,只是作用对象不同。 + let _spread_guard = SpreadGuard { service: self.clone(), key: key.clone() }; + // 先落日期再执行(与 fire_for 同一理由:进程中途被杀也不会反复补签) + write_state(json!({ "lastFiredDate": today })); + checkin_schedules::mark_fired(&schedule.id, Some(today)); + let span_minutes = window_bounds(&schedule.time, schedule.jitter_minutes) + .map(|(start, end)| end - start) + .unwrap_or(0); + logging::log( + "[Checkin]", + &format!( + "⏰ 定时签到开始({reason},{} 分钟窗口内逐个账号随机执行)", + span_minutes + ), + ); + + // ── 目标解析在 spawn **之前**做 ────────────────────────── + // 两个理由: + // ① 解析失败要走「回退去重标记」的路径(见下),而那需要已经拿到结果; + // ② 账号集合在 spawn 时就定下来,后台任务跑 4 小时期间账号增删不会让 + // 计划中途变化(与 fire_for 一次性解析目标的口径一致)。 + let (targets, skipped) = + match checkin::resolve_checkin_targets(&self.store, schedule.providers.as_slice(), None) { + Ok(found) => found, + Err(error) => { + // 整条条目失败:记账 + **回退今天已触发标记**,让下个 tick + // 还能再来一次。不回退的话一次偶发失败会让这条条目当天彻底 + // 静默(fire_for 那侧失败也落账,但它是单轮执行、重试代价高; + // 铺开的失败多半来自账号库暂时读不出来,值得再试)。 + self.record_failure(Some(&schedule.id), today, reason, &error.message); + checkin_schedules::mark_fired(&schedule.id, None); + return; + } + }; + let Some((start_minute, _)) = window_bounds(&schedule.time, schedule.jitter_minutes) else { + // time 在读取时已归一,走到这里说明配置在调度后被改坏 + self.record_failure(Some(&schedule.id), today, reason, "定时条目的时刻无效"); + checkin_schedules::mark_fired(&schedule.id, None); + return; + }; + // 起点必须由**这一轮的日期**推出,不能用「此刻」的日期:任务若恰好 + // 跨过零点(23:5x 的窗口),用现在的时间会算出次日同一分钟, + // 所有账号要白睡约 24 小时。today 是 spawn 时的日期键。 + let Some(start_at_ms) = chrono::NaiveDate::parse_from_str(today, "%Y-%m-%d") + .ok() + .and_then(|date| date.and_hms_opt(start_minute / 60, start_minute % 60, 0)) + .and_then(|naive| beijing::offset().from_local_datetime(&naive).single()) + .map(|target| target.timestamp_millis()) + else { + self.record_failure(Some(&schedule.id), today, reason, "无法计算随机窗口的起点"); + checkin_schedules::mark_fired(&schedule.id, None); + return; + }; + + // 计划也在这里算好:偏移是纯函数,不依赖后台任务的状态 + let mut plan: Vec<(i64, Value)> = targets + .iter() + .map(|account| { + let account_id = account.get("id").and_then(Value::as_str).unwrap_or(""); + let offset = spread_offset_seconds( + &schedule.id, + today, + &schedule.time, + schedule.jitter_minutes, + account_id, + ); + (start_at_ms + i64::from(offset) * 1000, account.clone()) + }) + .collect(); + plan.sort_by_key(|(at, _)| *at); + logging::verbose( + "[Checkin]", + &format!( + "随机窗口计划({}): {} 个账号,窗口起点 {},首个 {},末个 {}", + checkin_schedules::display_label(schedule), + plan.len(), + start_at_ms, + plan.first().map(|(at, _)| *at).unwrap_or(start_at_ms), + plan.last().map(|(at, _)| *at).unwrap_or(start_at_ms), + ), + ); + + let service = self.clone(); + let schedule = schedule.clone(); + let reason = reason.to_string(); + let today = today.to_string(); + // 守卫**移进**后台任务:任务正常结束、提前 return、或被 abort(停机时 + // `stop()` 只关循环,`spawn_task` 的 future 随运行时一起 drop)都会在 + // Drop 里清掉 key。放在外层是不行的 —— 外层函数一返回守卫就 drop 了。 + crate::spawn_task(async move { + let _spread_guard = _spread_guard; + service.run_spread(schedule, reason, today, plan, skipped).await; + }); + } + + /// 铺开任务的执行体:逐个账号等到自己的偏移时刻再签。 + /// + /// 偏移已过的(窗口中途启动、补签、Qoder 国际版重试)立即执行 —— + /// 这正是「错过窗口就全部立刻签完」的实现,不需要单独分支。 + async fn run_spread( + &self, + schedule: Schedule, + reason: String, + today: String, + plan: Vec<(i64, Value)>, + skipped: usize, + ) { + let mut results = Vec::with_capacity(plan.len()); + // 本轮是否因为「等不到执行锁 / 停机」而提前收工:这种情况下还有账号 + // 一次都没签,今天该保持未落账让后续 tick 接手(见下面的处理)。 + let mut cut_short = false; + for (at, account) in plan { + // 睡在锁外:这段时间别人可以正常手动签到 + if !self.wait_until(at).await { + cut_short = true; + break; + } + let Some(_guard) = self.acquire_running().await else { + cut_short = true; + break; + }; + results.push( + checkin::run_account( + &self.store, + &self.billing, + &account, + false, + "schedule", + &reason, + ) + .await, + ); + } + + // 原始汇总(带 results 数组)先记签到历史台账,再转成界面摘要: + // `record_success` 产出的摘要没有 results(只留前 5 条失败文案), + // 台账需要逐账号明细(见 checkin_history 的模块头)。 + let result = checkin::summarize_results(&results, skipped); + crate::server::core::checkin_history::record(&result, &reason); + let summary = self.record_success(&result, &today, &reason); + checkin_schedules::mark_result(&schedule.id, Some(summary.clone())); + // ── 今天要不要保持「未落账」───────────────────────────── + // 两种情况都要留着让后续 tick 再试: + // ① 有 Qoder 国际版账号还在等 10:00 的活动窗口(既有规则); + // ② 本轮被提前截断(停机 / 等锁超时):剩下的账号今天还一次没签, + // 落账就等于把它们整天静默掉。已经签过的账号重试时是幂等的。 + let qoder_pending = summary.get("qoderIntlPending").and_then(Value::as_bool) == Some(true); + if qoder_pending || cut_short { + checkin_schedules::mark_fired(&schedule.id, None); + } + if qoder_pending { + logging::log( + "[Checkin]", + "⏳ Qoder 国际版的活动窗口未开(官方每日 10:00 UTC+8),今天会自动重试到领到为止", + ); + } + if cut_short { + logging::log( + "[Checkin]", + "⏸ 本轮随机窗口提前收工(停机或等执行锁超时),剩余账号由后续调度继续", + ); + } + // key 的移除由 `SpreadGuard` 的 Drop 负责(见 spawn_spread 的注释) + } + + /// 铺开任务收尾:从「进行中」集合移除(幂等;`SpreadGuard` 的 Drop 也走这里)。 + fn finish_spread(&self, key: &str) { + self.lock().spreads.remove(key); + } + /// 本轮是否有「Qoder 国际版账号没领到且不算已签」的行 —— 有则今天保持 /// 未落账状态,等窗口开了重试(见 tick 的说明)。 + /// + /// 判定只看这一条账号的结果,**不要求它同时是「未成功」**:重试是整条 + /// 条目重来,已经领到的账号在下一次会返回 `alreadyCompleted`(不算 pending), + /// 而仍未领到的账号会继续 pending —— 「只要还有 pending 就继续等窗口」, + /// 领到之后下一轮就自然落到已签,不再重试。 fn qoder_intl_pending(result: &Value) -> bool { result .get("results") @@ -791,8 +1195,8 @@ impl AutoCheckin { if !schedule.enabled { continue; } - // 未到点直接看下一条(time 在读取时已归一,这里不会解析失败) - if due_now(&schedule.time, now).is_none() { + // 未到窗口起点直接看下一条(time 在读取时已归一,这里不会解析失败) + if due_now(&schedule.time, schedule.jitter_minutes, now).is_none() { continue; } // 条目级当天去重 @@ -801,6 +1205,11 @@ impl AutoCheckin { } let reason = format!("到点触发({})", checkin_schedules::display_label(&schedule)); + // 随机窗口:后台铺开,不占 tick 循环与全局执行锁(见 spawn_spread) + if schedule.jitter_minutes > 0 { + self.spawn_spread(&schedule, &reason, &today); + continue; + } match self.fire_for(&reason, Some(&schedule.id), "schedule").await { Some(result) => { // 领取轮次完成,但里面有「Qoder 国际版无活动」的行 → 这一条 @@ -855,11 +1264,22 @@ impl AutoCheckin { /// (理由见模块头部「补签」)。多条目之后按条目各补各的:今天没跑过的 /// **启用**条目每条补一次,串在一个任务里跑(fire 的全局防重本来就只允许 /// 一轮在跑,串行省得互相抢空)。 + /// + /// 关掉「启动时立即补签」(`startup_catch_up`)时只起调度循环、不补签: + /// 今天还没到窗口起点的条目留给 tick —— 否则早上开机就会把当天的随机 + /// 窗口提前签掉,等于随机失效。已过窗口的条目 tick 下一个 30 秒就会补。 pub fn start(&self) { if !master_enabled() { return; } self.schedule(); + if !startup_catch_up() { + logging::verbose( + "[Checkin]", + "启动补签已关闭:今天未执行的条目等到各自的窗口起点再由调度触发", + ); + return; + } let today = today_key(); let pending: Vec = checkin_schedules::list() .into_iter() @@ -919,9 +1339,19 @@ impl AutoCheckin { let has_enabled = payload.get("enabled").is_some(); let has_time = payload.get("time").is_some(); let has_providers = payload.get("providers").is_some(); - if !has_enabled && !has_time && !has_providers { + let has_startup_catch_up = payload.get("startupCatchUp").is_some(); + if !has_enabled && !has_time && !has_providers && !has_startup_catch_up { return Err(AutoCheckinConfigError::new("没有需要更新的字段")); } + if has_startup_catch_up { + // 与 enabled 同款口径:只有显式 true 才算开,其余(null / 字符串 / 0)都关 + let on = payload.get("startupCatchUp") == Some(&Value::Bool(true)); + write_state(json!({ "startupCatchUp": on })); + logging::log( + "[Checkin]", + &format!("启动时立即补签已{}", if on { "开启" } else { "关闭" }), + ); + } if has_enabled { // Node: `enabled !== undefined` → `patch.enabled = enabled === true`, // 也就是说 null / 字符串 / 0 都会把开关置为 false(不是「忽略」) @@ -1029,3 +1459,165 @@ pub fn stop_global() { service.stop(); } } + +#[cfg(test)] +mod tests { + //! 随机窗口的纯函数边界。 + //! + //! 只测不碰全局 config / 网络的函数(`window_bounds` / + //! `spread_offset_seconds` / `due_now` / `next_run_at_ms`):这些是 + //! 调度语义的全部来源,边界错一格就是「某天不签」或「同一天签两次」。 + //! `tick` / `spawn_spread` 的端到端需要 mock 账号库与上游,不在这一层做。 + use super::*; + use chrono::TimeZone; + + /// 构造一个北京时间时刻(测试用;固定偏移恒为 `Single`) + fn at(month: u32, day: u32, hour: u32, minute: u32) -> DateTime { + beijing::offset() + .with_ymd_and_hms(2026, month, day, hour, minute, 0) + .single() + .expect("北京时间构造恒成功") + } + + // ── 窗口边界 ────────────────────────────────────────────── + + #[test] + fn window_without_jitter_is_the_point_itself() { + assert_eq!(window_bounds("07:20", 0), Some((7 * 60 + 20, 7 * 60 + 20))); + } + + #[test] + fn window_extends_both_ways() { + assert_eq!(window_bounds("07:20", 30), Some((6 * 60 + 50, 7 * 60 + 50))); + } + + #[test] + fn window_clamps_to_day_start() { + // 00:01 - 30 分钟夹到 00:00,而不是昨天 23:31 + assert_eq!(window_bounds("00:01", 30), Some((0, 31))); + } + + #[test] + fn window_clamps_to_day_end() { + // 23:50 + 30 分钟夹到 23:59,而不是次日 00:20 + assert_eq!(window_bounds("23:50", 30), Some((23 * 60 + 20, 23 * 60 + 59))); + } + + #[test] + fn window_rejects_invalid_time() { + assert_eq!(window_bounds("25:00", 10), None); + assert_eq!(window_bounds("", 10), None); + } + + // ── 账号偏移 ────────────────────────────────────────────── + + #[test] + fn spread_offset_is_deterministic() { + let first = spread_offset_seconds("default", "2026-10-17", "07:20", 30, "acc-1"); + let second = spread_offset_seconds("default", "2026-10-17", "07:20", 30, "acc-1"); + assert_eq!(first, second, "同一天同一账号必须落在同一偏移,否则重试会换时间"); + } + + #[test] + fn spread_offset_changes_with_date() { + // 日期参与哈希是「每天不同」的全部依据;这里只钉住「至少变了一个」, + // 不假设具体数值(哈希值是实现细节) + let today = spread_offset_seconds("default", "2026-10-17", "07:20", 30, "acc-1"); + let tomorrow = spread_offset_seconds("default", "2026-10-18", "07:20", 30, "acc-1"); + assert_ne!(today, tomorrow); + } + + #[test] + fn spread_offset_stays_inside_window() { + let (start, end) = window_bounds("07:20", 30).unwrap(); + let span = (end - start) * 60; + for index in 0..64 { + let account = format!("acc-{index}"); + let offset = spread_offset_seconds("default", "2026-10-17", "07:20", 30, &account); + assert!(offset <= span, "偏移 {offset} 超出窗口跨度 {span}"); + } + } + + #[test] + fn spread_offset_is_zero_without_jitter() { + // N=0 时窗口跨度 0,偏移必须恒 0 —— 这是「不随机时行为逐字不变」的保证 + for account in ["acc-1", "acc-2", "acc-3"] { + assert_eq!( + spread_offset_seconds("default", "2026-10-17", "07:20", 0, account), + 0 + ); + } + } + + #[test] + fn spread_offsets_spread_across_accounts() { + // 不要求完美均匀,只要求不是所有账号都堆在同一点(哈希取模的正常形态) + let offsets: std::collections::HashSet = (0..32) + .map(|index| { + spread_offset_seconds( + "default", + "2026-10-17", + "07:20", + 30, + &format!("acc-{index}"), + ) + }) + .collect(); + assert!(offsets.len() > 16, "32 个账号只落出 {} 个不同偏移", offsets.len()); + } + + // ── 触发判定与展示 ──────────────────────────────────────── + + #[test] + fn due_now_keeps_legacy_semantics_without_jitter() { + let now = at(10, 17, 7, 20); + assert_eq!(due_now("07:20", 0, now), Some(now)); + assert_eq!(due_now("07:21", 0, now), None); + } + + #[test] + fn due_now_fires_at_window_start() { + let now = at(10, 17, 6, 50); + // 中心是 07:20,N=30 ⇒ 06:50 就到点 + assert_eq!(due_now("07:20", 30, now), Some(now)); + assert_eq!(due_now("07:20", 30, at(10, 17, 6, 49)), None); + } + + #[test] + fn next_run_without_jitter_matches_legacy() { + let now = at(10, 17, 6, 0); + let target = at(10, 17, 7, 20); + assert_eq!(next_run_at_ms("07:20", 0, false, now), Some(target.timestamp_millis())); + // 已过 → 明天 + let later = at(10, 17, 8, 0); + let tomorrow = at(10, 18, 7, 20); + assert_eq!(next_run_at_ms("07:20", 0, false, later), Some(tomorrow.timestamp_millis())); + // 今天已触发(启动补签会在时点前落账)→ 明天 + assert_eq!( + next_run_at_ms("07:20", 0, true, now), + Some(tomorrow.timestamp_millis()) + ); + } + + #[test] + fn next_run_uses_window_start() { + let now = at(10, 17, 6, 0); + let start = at(10, 17, 6, 50); + assert_eq!( + next_run_at_ms("07:20", 30, false, now), + Some(start.timestamp_millis()) + ); + } + + #[test] + fn next_run_after_window_start_rolls_to_tomorrow() { + // 已过窗口起点即使还没到中心时刻,今天的窗口也已开始过 —— 展示明天, + // 与 tick 的 due_now(now >= start 即触发)保持一致 + let now = at(10, 17, 7, 0); + let tomorrow = at(10, 18, 6, 50); + assert_eq!( + next_run_at_ms("07:20", 30, false, now), + Some(tomorrow.timestamp_millis()) + ); + } +} diff --git a/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs b/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs index a152a2dc..30f82037 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/billing/checkin.rs @@ -568,38 +568,70 @@ pub async fn run_checkin( let manual = matches!(source, "single" | "manual"); let mut results = Vec::with_capacity(targets.len()); for account in &targets { - let row = checkin_for(store, billing, account, manual).await; - // 落签到时间:手动单签与定时签到走的是**这一段**(两条链都调本函数), - // 所以账号页的「已签到」在两种路径下都会亮起来,不需要各自记一次。 - // 写盘失败只记日志、不改签到结果 —— 上游那边积分已经领到了, - // 因为一次落盘失败就把成功的签到报成失败是本末倒置。 - if let Some(account_id) = row.get("id").and_then(Value::as_str) { - let completed = row - .get("claim") - .map(checkin_completed_today) - .unwrap_or(false); - if completed && !store.mark_checkin(account_id, logging::now_ms()) { - logging::verbose( - "[Accounts]", - &format!("账号 {account_id} 的签到时间未能落盘(账号可能已被删除)"), - ); - } + results.push(run_account(store, billing, account, manual, source, reason).await); + } + let summary = summarize_results(&results, skipped); + // 批量轮次进台账(签到中心时间线)。写盘失败只记日志:上游那边积分已经 + // 领到,台账缺一条不该让这次签到的响应报错。 + if id.is_none() { + crate::server::core::checkin_history::record(&summary, reason); + } + Ok(summary) +} + +/// 单个账号的签到 + 落 `checkinAt` + 记签到记录台账。 +/// +/// 从 `run_checkin` 的循环体抽出(2026-10 随机窗口改造):定时铺开路径 +/// (`auto_checkin::run_spread`)逐个账号调用它,与批量路径共用同一段记账, +/// 不会出现「铺开签到的账号不亮『已签到』」这类两套行为。 +/// `manual` 的语义见 [`checkin_for`](只对 CodeArts 的限流闸有意义)。 +pub async fn run_account( + store: &AccountStore, + billing: &BillingService, + account: &Value, + manual: bool, + source: &str, + reason: &str, +) -> Value { + let row = checkin_for(store, billing, account, manual).await; + // 落签到时间:手动单签与定时签到走的是**这一段**(两条链都调本函数), + // 所以账号页的「已签到」在两种路径下都会亮起来,不需要各自记一次。 + // 写盘失败只记日志、不改签到结果 —— 上游那边积分已经领到了, + // 因为一次落盘失败就把成功的签到报成失败是本末倒置。 + if let Some(account_id) = row.get("id").and_then(Value::as_str) { + let completed = row + .get("claim") + .map(checkin_completed_today) + .unwrap_or(false); + if completed && !store.mark_checkin(account_id, logging::now_ms()) { + logging::verbose( + "[Accounts]", + &format!("账号 {account_id} 的签到时间未能落盘(账号可能已被删除)"), + ); } - // 签到记录台账(schema v11):每个账号行落一条明细(成败 / 错误原文 / - // 收益文案都在结果行里)。写盘失败只记日志:台账缺一条不该让这次 - // 签到的响应报错 —— 与上面 mark_checkin 的取舍同构。provider 由账号 - // 记录带上(结果行里没有这个字段,记录页的提供商筛选列要用)。 - crate::server::core::checkin_records::record_row( - &row, - account.get("provider").and_then(Value::as_str).unwrap_or(""), - source, - reason, - ); - results.push(row); } - // 「真实领取」与「今日已领取」都表示本日签到已完成;只有活跃保活不计入 - // succeeded,避免把普通签到时间与活跃任务混为一谈 —— 保活读数单独统计在 - // `active`(`activity.pokeSucceeded`),它的成功不落 `checkinAt`。 + // 签到记录台账(schema v11):每个账号行落一条明细(成败 / 错误原文 / + // 收益文案都在结果行里)。写盘失败只记日志:台账缺一条不该让这次 + // 签到的响应报错 —— 与上面 mark_checkin 的取舍同构。provider 由账号 + // 记录带上(结果行里没有这个字段,记录页的提供商筛选列要用)。 + crate::server::core::checkin_records::record_row( + &row, + account.get("provider").and_then(Value::as_str).unwrap_or(""), + source, + reason, + ); + row +} + +/// 一轮签到结果 → `{results, succeeded, active, total, skipped}` 汇总。 +/// +/// 「真实领取」与「今日已领取」都表示本日签到已完成;只有活跃保活不计入 +/// succeeded,避免把普通签到时间与活跃任务混为一谈 —— 保活读数单独统计在 +/// `active`(`activity.pokeSucceeded`),它的成功不落 `checkinAt`。 +/// +/// 抽成公开函数供 `auto_checkin::run_spread` 复用:铺开路径自己控制节奏, +/// 但统计口径必须与批量路径逐字一致。 +pub fn summarize_results(results: &[Value], skipped: usize) -> Value { let succeeded = results .iter() .filter(|item| { @@ -638,27 +670,13 @@ pub async fn run_checkin( results.len() ), ); - // 批量轮次进台账(签到中心时间线)。写盘失败只记日志:上游那边积分已经 - // 领到,台账缺一条不该让这次签到的响应报错。 - if id.is_none() { - crate::server::core::checkin_history::record( - &json!({ - "succeeded": succeeded, - "active": active, - "total": results.len(), - "skipped": skipped, - "results": results, - }), - reason, - ); - } - Ok(json!({ + json!({ "results": results, "succeeded": succeeded, "active": active, "total": results.len(), "skipped": skipped, - })) + }) } #[cfg(test)] diff --git a/desktop-tauri/src-tauri/server/src/server/core/checkin_schedules.rs b/desktop-tauri/src-tauri/server/src/server/core/checkin_schedules.rs index 9c0a11dd..bbe4146b 100644 --- a/desktop-tauri/src-tauri/server/src/server/core/checkin_schedules.rs +++ b/desktop-tauri/src-tauri/server/src/server/core/checkin_schedules.rs @@ -2,11 +2,13 @@ //! //! ── 形状 ──────────────────────────────────────────────────── //! 每条条目是一次「定点签到」的完整配置: -//! `{id, label, enabled, time, providers, lastFiredDate, lastResult}` +//! `{id, label, enabled, time, jitterMinutes, providers, lastFiredDate, lastResult}` //! - `id` 稳定标识(界面按它 upsert / 删除 / 立即执行;合成条目是 "default") //! - `label` 展示名(可空;空时展示退到 `time`) //! - `enabled` 条目自己的开关 //! - `time` HH:MM,北京时间口径(见 `core::beijing`,issue #138) +//! - `jitterMinutes` 随机前后 N 分钟(0 = 不随机);窗口与账号铺开的语义见 +//! `core::auto_checkin` 的模块头「随机窗口」 //! - `providers` 这条要签的提供商(`CHECKIN_PROVIDERS` 子集,至少一家) //! - `lastFiredDate` / `lastResult` 条目级的当天去重与上一轮结果 //! 总开关沿用 `autoCheckin.enabled`(见 `core::auto_checkin`):关了所有条目都不跑。 @@ -40,11 +42,51 @@ pub struct Schedule { pub label: String, pub enabled: bool, pub time: String, + /// 随机前后 N 分钟(0 = 不随机,时刻即触发点)。窗口与账号铺开见 + /// `auto_checkin` 的「随机窗口」说明。 + pub jitter_minutes: u32, pub providers: Vec, pub last_fired_date: Option, pub last_result: Option, } +/// 读侧的随机分钟归一:缺省 / 非数字 / 负数 / 小数一律当 0,超上限夹取。 +/// +/// 读侧刻意宽容(与 `time` 坏了回落 `DEFAULT_TIME` 同一原则):配置是用户 +/// 手改过也可能被旧版本写过,读不出来时退到「不随机」这个安全行为, +/// 而不是让整条条目失效。写入侧的校验更严(见 `upsert`),非法值当场拒绝。 +pub fn normalize_jitter(value: Option<&Value>) -> u32 { + let Some(number) = value.and_then(Value::as_u64) else { + return 0; + }; + u32::try_from(number) + .unwrap_or(auto_checkin::MAX_JITTER_MINUTES) + .min(auto_checkin::MAX_JITTER_MINUTES) +} + +/// 写入侧的随机分钟校验:`None` 表示「这次请求没带该字段」(保持原值), +/// `Some(0)` 是**合法的显式值**(关闭随机)——两者必须能区分开。 +/// +/// 非法值当场拒绝而不是悄悄夹取:用户填 999 却看到保存成功、实际只按 120 +/// 生效,比直接报错更难排查。错误文案与 `normalize_time` 的既有风格一致。 +fn parse_jitter(value: Option<&Value>) -> Result, String> { + let Some(value) = value else { + return Ok(None); + }; + // `as_u64` 已经挡住了负数、小数、字符串与 null,这里只剩「超上限」要判 + value + .as_u64() + .and_then(|number| u32::try_from(number).ok()) + .filter(|minutes| *minutes <= auto_checkin::MAX_JITTER_MINUTES) + .map(Some) + .ok_or_else(|| { + format!( + "随机分钟应为 0 - {} 的整数", + auto_checkin::MAX_JITTER_MINUTES + ) + }) +} + /// 展示名:用户起的名,没起就退到时刻(时刻是唯一必填项,一定能展示) pub fn display_label(schedule: &Schedule) -> &str { if schedule.label.is_empty() { @@ -72,7 +114,7 @@ fn stored_entries() -> Option> { .cloned() } -/// 单条的归一化:id / label / enabled / time / providers 逐个兜底。 +/// 单条的归一化:id / label / enabled / time / jitter / providers 逐个兜底。 /// time 坏了回落 DEFAULT_TIME(调度起不来比时刻错更糟,与 auto_checkin 同)。 fn normalize_schedule(raw: &Value) -> Schedule { let id = raw @@ -92,12 +134,14 @@ fn normalize_schedule(raw: &Value) -> Schedule { .filter(|value| !value.is_null()) .and_then(|value| auto_checkin::normalize_time(Some(value)).ok()) .unwrap_or_else(auto_checkin::default_time); + let jitter_minutes = normalize_jitter(raw.get("jitterMinutes")); let providers = auto_checkin::normalize_providers(raw.get("providers")); Schedule { id, label, enabled, time, + jitter_minutes, providers, last_fired_date: raw .get("lastFiredDate") @@ -139,13 +183,18 @@ fn write_entries(entries: Vec) { config::update_raw_field(auto_checkin::CONFIG_KEY, Value::Object(merged)); } -/// 条目 → 存储原文(保留 lastFiredDate / lastResult,条目级的去重状态跨重启) +/// 条目 → 存储原文(保留 lastFiredDate / lastResult,条目级的去重状态跨重启)。 +/// +/// ⚠️ 新增字段必须同时加到 `normalize_schedule` 与本函数:`patch_entry` 是 +/// 「读原文 → normalize → 改 → to_value 全量写回」,漏一处就会让 `mark_fired` +/// 每次把该字段静默清掉。 fn to_value(schedule: &Schedule) -> Value { json!({ "id": schedule.id, "label": schedule.label, "enabled": schedule.enabled, "time": schedule.time, + "jitterMinutes": schedule.jitter_minutes, "providers": schedule.providers, "lastFiredDate": schedule.last_fired_date, "lastResult": schedule.last_result, @@ -168,6 +217,7 @@ pub fn upsert(payload: &Value) -> Result { .unwrap_or_else(|| format!("schedule-{}", crate::server::logging::now_ms())); let time = auto_checkin::normalize_time(payload.get("time")) .map_err(|error| error.message)?; + let jitter_minutes = parse_jitter(payload.get("jitterMinutes"))?; // 范围:只认注册过的提供商(去重、按注册顺序);一条不勾到点也无账号可签 let list_value = payload.get("providers"); let picked: Vec = CHECKIN_PROVIDERS @@ -209,6 +259,15 @@ pub fn upsert(payload: &Value) -> Result { None => true, }, }; + // 随机分钟同样「缺省保持原值、新建默认 0」:界面的条目开关按钮是整表单 + // 重发,漏带这个字段时不能把它清零(见前端 `toggleScheduleEnabled`)。 + let jitter_minutes = match jitter_minutes { + Some(minutes) => minutes, + None => existing_entry + .as_ref() + .map(|old| old.jitter_minutes) + .unwrap_or(0), + }; // 更新已有条目时保留它的去重状态;新建条目从「今天还没跑」开始 let (last_fired_date, last_result) = existing_entry .map(|old| (old.last_fired_date, old.last_result)) @@ -225,6 +284,7 @@ pub fn upsert(payload: &Value) -> Result { label, enabled, time, + jitter_minutes, providers: picked, last_fired_date, last_result, @@ -387,3 +447,68 @@ pub fn extend_providers_once() -> bool { fn record_providers_version() { auto_checkin::write_state(json!({ "providersVersion": auto_checkin::PROVIDERS_VERSION })); } + +#[cfg(test)] +mod tests { + //! 随机分钟字段的归一与往返。 + //! + //! 重点钉住 `normalize_schedule` ↔ `to_value` 的对称性:`patch_entry` 是 + //! 「读原文 → normalize → 改 → to_value 全量写回」,漏了任何一侧, + //! `mark_fired` 都会把 `jitterMinutes` 静默清掉(用户只在第二天发现随机 + //! 没了,极难排查)。这些函数不碰全局 config,可并行跑。 + use super::*; + use serde_json::json; + + fn roundtrip(raw: Value) -> Value { + to_value(&normalize_schedule(&raw)) + } + + #[test] + fn jitter_roundtrips_through_storage() { + let stored = roundtrip(json!({ + "id": "s1", + "enabled": true, + "time": "07:20", + "jitterMinutes": 45, + "providers": ["trae"], + })); + assert_eq!(stored.get("jitterMinutes").and_then(Value::as_u64), Some(45)); + } + + #[test] + fn missing_jitter_reads_as_zero() { + let schedule = normalize_schedule(&json!({ + "id": "s1", + "time": "07:20", + "providers": ["trae"], + })); + assert_eq!(schedule.jitter_minutes, 0); + } + + #[test] + fn invalid_jitter_reads_as_zero_or_clamps() { + // 读侧宽容:手改配置写坏了不能整条条目失效 + assert_eq!(normalize_jitter(Some(&json!(null))), 0); + assert_eq!(normalize_jitter(Some(&json!("abc"))), 0); + assert_eq!(normalize_jitter(Some(&json!(-5))), 0); + assert_eq!(normalize_jitter(None), 0); + // 超上限夹取(不报错) + assert_eq!( + normalize_jitter(Some(&json!(9999))), + auto_checkin::MAX_JITTER_MINUTES + ); + } + + #[test] + fn write_side_rejects_invalid_jitter() { + // 写入侧严格:用户填 999 却按 120 生效比直接报错更难排查。 + // None = 「没带这个字段」→ 保持原值,与 Some(0) 必须区分开。 + assert_eq!(parse_jitter(None).unwrap(), None); + assert_eq!(parse_jitter(Some(&json!(0))).unwrap(), Some(0)); + assert_eq!(parse_jitter(Some(&json!(120))).unwrap(), Some(120)); + assert!(parse_jitter(Some(&json!(121))).is_err()); + assert!(parse_jitter(Some(&json!(-1))).is_err()); + assert!(parse_jitter(Some(&json!(1.5))).is_err()); + assert!(parse_jitter(Some(&json!("30"))).is_err()); + } +} diff --git a/desktop-tauri/ui-islands/src/islands/checkin-schedule-tab.tsx b/desktop-tauri/ui-islands/src/islands/checkin-schedule-tab.tsx index c0d8277f..4ee87b41 100644 --- a/desktop-tauri/ui-islands/src/islands/checkin-schedule-tab.tsx +++ b/desktop-tauri/ui-islands/src/islands/checkin-schedule-tab.tsx @@ -9,6 +9,7 @@ import { import { deleteSchedule, getSchedulesStore, loadSchedules, runScheduleNow, saveSchedule, setEditingId, subscribeSchedulesStore, toggleMaster, toggleScheduleEnabled, + toggleStartupCatchUp, type SchedulesStore, } from './checkin-schedules-state' import type { ScheduleEntry } from './checkin-state' @@ -37,7 +38,7 @@ import type { ScheduleEntry } from './checkin-state' * 整段是一个键:扫描器只认字符串字面量(拼接串 / 模板串提不到键),所以不拆行。 */ const AUTO_CHECKIN_DESC = t( - '到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。', + '到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。', ) /* ─── store 订阅 ───────────────────────────── */ @@ -106,6 +107,9 @@ function ScheduleEditor({ entry, store }: { entry: ScheduleEntry | null; store: const isNew = entry === null const [label, setLabel] = React.useState(entry?.label ?? '') const [time, setTime] = React.useState(entry?.time ?? '00:01') + // 随机窗口(分钟)。草稿用字符串:`type='number'` 清空时是 '',直接存数字 + // 会让输入框在「删光重填」时跳回 0 + const [jitter, setJitter] = React.useState(String(entry?.jitterMinutes ?? 0)) const [picked, setPicked] = React.useState>( new Set(isNew ? options.map(option => option.id) : entry?.providers ?? []), ) @@ -115,15 +119,31 @@ function ScheduleEditor({ entry, store }: { entry: ScheduleEntry | null; store: // 只在挂载 / 切换编辑对象时初始化一次:options 后到不该把用户改了一半的勾选冲掉 // eslint-disable-next-line react-hooks/exhaustive-deps }, []) - const canSave = time.trim() !== '' && picked.size > 0 + // 0 是合法值(关闭随机);空串按 0 处理(用户删光内容就是想关掉)。 + // 非整数 / 超范围不让保存:夹取交给后端会得到「填了 999 却按 120 生效」的 + // 静默偏差,不如当场拦住。上限与后端 auto_checkin::MAX_JITTER_MINUTES 对应。 + // + // 先用正则挡掉 `Number()` 会接受的非十进制写法(`1e3` / `0x10` / ` 5 `): + // 它们转出来都是整数,但用户显然没想表达那个意思。 + const jitterText = jitter.trim() + const jitterValue = jitterText === '' ? 0 : Number(jitterText) + const jitterValid = + (jitterText === '' || /^\d+$/.test(jitterText)) && + Number.isInteger(jitterValue) && + jitterValue >= 0 && + jitterValue <= 120 + const canSave = time.trim() !== '' && picked.size > 0 && jitterValid const pickAll = (): void => setPicked(new Set(options.map(option => option.id))) const clearAll = (): void => setPicked(new Set()) const submit = async (): Promise => { + // 双重保险:按钮的 disabled 已经挡住非法输入,但回车 / 程序化点击也要挡住 + if (!canSave) return await saveSchedule({ id: entry?.id, label: label.trim(), enabled: entry?.enabled ?? true, time: time.trim(), + jitterMinutes: jitterValue, providers: options.map(option => option.id).filter(id => picked.has(id)), }) } @@ -155,6 +175,25 @@ function ScheduleEditor({ entry, store }: { entry: ScheduleEntry | null; store: {t('北京时间 · 错过时点开机后会自动补签')} +
    + {t('随机前后')} + + setJitter(event.currentTarget.value)} + /> + + {t('分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行')} + + +
    {t('签到范围')} @@ -271,7 +310,13 @@ function ScheduleEntryRow({ entry, store }: { entry: ScheduleEntry; store: Sched : {t('已停用')}}
    - {t('每天 {time} · {scope}', { time: entry.time ?? '—', scope: providersSummary(entry, options) })} + {Number(entry.jitterMinutes) > 0 + ? t('每天 {time} · 随机前后 {n} 分钟 · {scope}', { + time: entry.time ?? '—', + n: Number(entry.jitterMinutes), + scope: providersSummary(entry, options), + }) + : t('每天 {time} · {scope}', { time: entry.time ?? '—', scope: providersSummary(entry, options) })}
    {t('上次执行:{line}', { line: lastResultLine(entry) })} @@ -530,6 +575,8 @@ function ScheduleTab(): React.ReactElement { const data = store.data const masterOn = data?.enabled === true + // 缺省开:老配置没有这个键,与后端 `startup_catch_up()` 的缺省一致 + const startupCatchUp = data?.startupCatchUp !== false const entries = Array.isArray(data?.schedules) ? data!.schedules! : [] // 保活模型链(全局一份,随卡迁入本页):草稿非空表示用户正在编辑,否则跟随快照 const keepalive = checkin.snapshot?.keepalive @@ -579,6 +626,21 @@ function ScheduleTab(): React.ReactElement {
    +
    + {t('启动补签')} + + void toggleStartupCatchUp(next === true)} + /> + + {startupCatchUp + ? t('开着:开机后今天没签过的条目立刻补签,不看随机窗口') + : t('关着:开机后等到窗口起点再签,随机窗口当天生效')} + + +
    {store.editingId === 'new' ? : null} diff --git a/desktop-tauri/ui-islands/src/islands/checkin-schedules-state.ts b/desktop-tauri/ui-islands/src/islands/checkin-schedules-state.ts index 78dbb545..dbfff19e 100644 --- a/desktop-tauri/ui-islands/src/islands/checkin-schedules-state.ts +++ b/desktop-tauri/ui-islands/src/islands/checkin-schedules-state.ts @@ -132,6 +132,7 @@ export async function saveSchedule(payload: { label?: string enabled?: boolean time?: string + jitterMinutes?: number providers?: string[] }): Promise { if (store.saving) return @@ -148,17 +149,37 @@ export async function saveSchedule(payload: { } } -/** 条目开关(不发整表单:带上这条的 time / providers,后端 upsert 需要时刻必填) */ +/** 条目开关(不发整表单:带上这条的 time / jitterMinutes / providers,后端 upsert 需要时刻必填) */ export async function toggleScheduleEnabled(entry: ScheduleEntry, enabled: boolean): Promise { await saveSchedule({ id: entry.id, label: entry.label ?? '', enabled, time: entry.time ?? '', + // 必须带上:这是整表单重发,漏了会走「缺省保持原值」侥幸保住, + // 一旦后端那侧语义调整,点一次开关就会把随机窗口静默清零 + jitterMinutes: Number(entry.jitterMinutes) || 0, providers: Array.isArray(entry.providers) ? entry.providers : [], }) } +/** 「启动时立即补签」开关(全局,走老接口 POST /api/auto-checkin) */ +export async function toggleStartupCatchUp(enabled: boolean): Promise { + if (store.saving) return + patch({ saving: true }) + try { + const next = await bridge().saveAutoCheckin?.({ startupCatchUp: enabled }) + applySnapshot(next) + // 与总开关同一口径:两条分开调(扫描器只认字面量首参) + if (enabled) toast(t('启动补签已开启')) + else toast(t('启动补签已关闭')) + } catch (error) { + toast(t('保存失败:{error}', { error: errorMessage(error) }), 'err') + } finally { + patch({ saving: false }) + } +} + /** * 删除一条条目。确认在组件层做(wbConfirm),这里只管删。 * 删除合成的默认条目 = 后端写空数组,「从旧字段合成」不再发生(界面照实变空)。 diff --git a/desktop-tauri/ui-islands/src/islands/checkin-state.ts b/desktop-tauri/ui-islands/src/islands/checkin-state.ts index 6cb899d6..570c26f0 100644 --- a/desktop-tauri/ui-islands/src/islands/checkin-state.ts +++ b/desktop-tauri/ui-islands/src/islands/checkin-state.ts @@ -71,6 +71,8 @@ export type AutoCheckinState = { lastFiredToday?: boolean nextRunAt?: number | null lastResult?: CheckinHistoryEntry | null + /** 启动时立即补签(缺省 true;关掉后启动不补,等到窗口起点由调度触发) */ + startupCatchUp?: boolean running?: boolean } @@ -85,6 +87,8 @@ export type ScheduleEntry = { displayLabel?: string enabled?: boolean time?: string + /** 随机前后 N 分钟(0 / 缺省 = 不随机,窗口就是时刻本身) */ + jitterMinutes?: number providers?: string[] lastFiredDate?: string | null lastFiredToday?: boolean diff --git a/desktop-tauri/ui/i18n/en/checkin.js b/desktop-tauri/ui/i18n/en/checkin.js index 59ace287..1a4abf74 100644 --- a/desktop-tauri/ui/i18n/en/checkin.js +++ b/desktop-tauri/ui/i18n/en/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:en/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO checkin_credits claims · reset at midnight (calendar day)", "UMID 组件安装失败:{error}": "UMID component installation failed: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Query the task tree, then light up / claim in one click · includes the school-season event and cat travel · click a row for details", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy International keep-alive models, tried in order", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Free models for WorkBuddy International daily activity · one global setting, unrelated to schedules", "{date}(每天 {time})": "{date} (daily at {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} to complete", "{n} 项待领": "{n} to claim", "{total} 账号 · {done} 已签": "{done} of {total} checked in", "{total} 项任务 · {pending} 项可完成": "{total} tasks · {pending} to complete", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID component installed — the next check-in can claim International points", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Scheduled check-in enabled", "✅ 开学季任务执行完成": "✅ School-season tasks completed", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Growth tasks completed: credits +{credit}, energy +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Starter rewards claimed, {n} points earned in total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in complete: {succeeded}/{total} accounts claimed successfully{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; submit empty to restore the default ({defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; clearing the list and saving restores the default chain (current default: {defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「免费领积分」的每日任务 · 逐个领取": "\"Free points\" daily tasks · claimed one by one", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "One-time rewards · queried and claimed automatically after check-in; once claimed they are recorded locally and no longer queried upstream · click a row to expand the task list", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Claims all of the day’s rewards in one action (daily check-in + newcomer gift) · idempotency guaranteed by the upstream", "一键安装组件": "Install component", "一键完成": "Complete all", "一键领取({n})": "Claim all ({n})", "上次执行:{line}": "Last run: {line}", "上次签到时间": "Last check-in", "上次领取 {time} · 领取需通过滑块验证码": "Last claimed {time} · claim requires passing a slider CAPTCHA", "下次 {date}": "Next {date}", "下次 {date} · 点此管理条目": "Next {date} · click to manage schedules", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below; its and ZCode's daily/plan benefits are claimed under \"Activity rewards\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below, and its daily welfare is right above under \"Daily check-in\"; ZCode plan claims are under \"Activity rewards\".", "与国内版同一套任务接口 · 站点不同": "Same task API as the China edition · different site", "与国内版同一套链路 · 站点不同、令牌不通用": "Same flow as the China edition · different site, tokens not interchangeable", "今天已领 {n} 份": "Claimed {n} today", "今天未领": "Not claimed today", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Claimed today (Beijing time {day}) · {n} items confirmed received · can claim again tomorrow", "今日已执行": "Ran today", "今日已派出": "Sent out today", "今日已领取": "Claimed today", "今日签到": "Today", "今日签到进度": "Today's check-in progress", "从清单里移除": "Remove from the list", "保活": "Keep-alive", "保活 {n}": "{n} kept alive", "保活+领取": "Keep-alive + claim", "保活中…": "Keeping alive…", "保活模型链": "Keep-alive model chain", "全选": "Select all", "全部 {n} 家": "All {n} providers", "全部完成": "All done", "全部查询": "Query all", "全部结果": "All outcomes", "全部账号均可签到": "All accounts can check in", "全部领取": "All claimed", "关着:所有条目都不执行": "Off: no schedule runs", "删除失败:{error}": "Delete failed: {error}", "删除定时条目": "Delete schedule", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; CodeArts claims that day's campaign welfare (claim → confirm → read back to verify; automatic runs are limited to 6 write attempts per day with a 10-minute gap); OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点时逐个签到,已勾 {n} / {total} 家": "Checked {n} of {total} — each is checked in at the scheduled time", "北京时间 · 错过时点开机后会自动补签": "Beijing time · missed runs are made up automatically after startup", "去领取": "Claim now", "另有 {n} 个账号不参与每日签到": "{n} more accounts are not part of daily check-in", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Claim rewards of completed tasks only (idempotent; repeated clicks will not double-credit)", "可完成": "Can complete", "可派出": "Can send out", "可选 · 缺省显示时刻": "Optional · defaults to the time", "可领奖": "Can claim", "后端未返回定时签到数据": "Backend returned no schedule data", "后端未返回签到中心数据": "The backend did not return check-in center data", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "International check-in requires the UMID component to generate a device risk-control identity (not detected on this machine).", "在途": "Traveling", "填入缺省链": "Fill in default chain", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Pick a time and the providers, then click Save; the name is optional (the time is shown when empty)", "失败 {n}": "{n} failed", "套餐明细": "Plan details", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Install the Qoder client or qodercli to enable it (no need to restart the gateway).", "安装中…": "Installing…", "官方客户端的每日签到任务": "Official client's daily check-in task", "定时签到": "Scheduled check-in", "定时签到已关闭": "Scheduled check-in disabled", "尚未查询": "Not queried yet", "尚未查询任务状态": "Task status not queried yet", "巡检一次": "Run one round", "已保存:{label}": "Saved: {label}", "已保存:保活模型链": "Saved: Keep-alive model chain", "已保存:定时条目": "Saved: schedule", "已删除定时条目": "Schedule deleted", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Activity reported (streak lit up), but the campaign is not active (nothing to claim this time)", "已抽 {n} 次": "Drew {n} times", "已有结果 {checked} / 共 {total} 个账号": "Results for {checked} / {total} accounts", "已签": "Checked in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Claimed {claimed}/{total} · {earned} points earned", "已领养": "Adopted", "已领取": "Claimed", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Claim \"Daily 100 Credits\" with a device risk-control identity · requires the UMID component", "开学季执行失败:{error}": "School-season run failed: {error}", "开学季执行完成:{message}": "School-season run completed: {message}", "开学季活动": "School-season event", "开着:启用的条目按各自时刻执行": "On: enabled schedules run at their own times", "待签": "Not checked in", "待领新手福利": "Starter rewards to claim", "总开关": "Master switch", "总开关已关闭 · 在「定时签到」页打开": "Master switch is off · enable it on the \"Scheduled check-in\" tab", "成功 {n}": "{n} succeeded", "成长任务": "Growth tasks", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Growth tasks finished ({done} succeeded, {failed} failed): credits +{credit}, energy +{energy}", "成长任务执行失败:{error}": "Growth task run failed: {error}", "执行失败:{error}": "Run failed: {error}", "执行并抽奖": "Run & draw", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Run school-season tasks and spend all draw chances (share / chat / expert events)", "把缺省链填进清单,再点「保存」生效": "Puts the default chain into the list; click Save to apply", "抽奖机会 {n} 次": "{n} draw chances", "按住拖动调整顺序": "Press and drag to reorder", "按住拖动,调整这个模型在链里的顺序": "Press and drag to change this model's position in the chain", "按序逐个尝试,共 {n} 个": "{n} models, tried in order", "按结果筛选": "Filter by outcome", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detect + claim + keep-alive · same combo as scheduled check-in", "探测活动并领取日活奖励 · 不做保活": "Detect the campaign and claim the daily-activity reward · no keep-alive", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Accept + light up + claim (only tasks with verified recipes)", "搜账号 / 收益 / 错误 / 触发原因": "Search account / gain / error / trigger reason", "收起新建": "Close new entry", "新建定时条目": "New scheduled entry", "新手福利": "Starter rewards", "新手福利有 {n} 项领取失败,可重试": "{n} starter reward(s) failed to claim — you can retry", "无": "None", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "No dedicated check-in API · hits the login-info endpoint once a day per account (which grants the daily Magicubes)", "无独立签到接口 · 每天替账号打一次首次登录积分": "No dedicated check-in API · awards first-login points once a day per account", "无账号": "No accounts", "暂不可领": "Not claimable yet", "暂不支持": "Not supported yet", "暂无启用的条目 · 点此添加": "No enabled schedules · click to add one", "有未保存的改动": "Unsaved changes", "未勾选提供商": "No provider selected", "未开启": "Off", "未解锁": "Locked", "未领养(领养需先完成当日对话量)": "Not adopted (adoption requires the daily chat quota first)", "未领取": "Not claimed", "本地台账里今天还没领过;活动期内每天发一份新套餐": "No claim recorded locally for today yet; a new plan is issued every day during the event", "本地台账里今天(北京时间)领过的套餐:{plans}": "Plans claimed today (Beijing time) according to the local record: {plans}", "条启用": "enabled", "查询于 {time}": "Queried at {time}", "查询任务": "Query tasks", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Query the task tree, then light up / claim in one click (includes school-season and cat travel)", "查询失败:{error}": "Query failed: {error}", "桌面端每日积分链路": "Desktop daily points flow", "正在读取定时签到数据…": "Loading schedule data…", "正在读取签到数据…": "Loading check-in data…", "每天 {time}": "Daily at {time}", "每天 {time} · {scope}": "Daily {time} · {scope}", "每天时刻": "Daily time", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "One row per account per check-in run · outcomes and gains as recorded by the backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Daily activity tasks · a web-app conversation lights up the daily activity, only claims add points · the two can run separately", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Daily welfare · claim → confirm → read back to verify · resets on the Beijing calendar day", "每日签到": "Daily check-in", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Each schedule has its own time and scope · same-day dedup per entry · missed runs are made up after startup", "每账号一条明细 · 点此查看「签到记录」": "One row per account · open \"Check-in records\"", "没有可领套餐的账号(ZCode 未添加)。": "No accounts with claimable plans (ZCode not added).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "No accounts with claimable rewards (CodeArts / ZCode not added).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "No accounts support growth tasks (WorkBuddy CN required).", "没有支持新手福利的账号": "No accounts support starter rewards", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "No accounts support starter rewards — currently Loomy, Raccoon and CodeArts.", "没有符合筛选条件的签到记录": "No check-in records match the current filters", "没有需要执行的任务": "Nothing to run", "活动福利": "Event rewards", "活动(campaign)领取 · 每天 10:00 刷新": "Campaign claims · refreshed daily at 10:00", "活跃上报与保活均未成功,且活动未开启": "Both the activity report and keep-alive failed, and the campaign is not active", "活跃上报完成,但保活未成功且活动未开启": "Activity reported, but keep-alive failed and the campaign is not active", "活跃上报完成,但活动未开启": "Activity reported, but the campaign is not active", "活跃上报成功": "Activity reported", "活跃保活失败": "Keep-alive failed", "活跃保活完成": "Keep-alive complete", "活跃保活完成,但活动未开启": "Keep-alive complete, but the campaign is not active", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive complete, but the activity report failed and the campaign is not active", "添加条目": "Add schedule", "添加模型": "Add model", "清单为空 —— 保存后恢复缺省链": "The list is empty — saving restores the default chain", "清单里已经有「{name}」": "The list already contains \"{name}\"", "清空失败:{error}": "Clear failed: {error}", "清空签到记录": "Clear check-in records", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Click \"Plan details\" to see which plans you got and when they take effect; you can claim again every day during the event", "点击行展开账号明细 · 单账号签到不受范围限制": "Click a row to expand account details · single-account check-in is not limited by scope", "独立链路 · 只提供手动入口 · 不进自动签到": "Separate flow · manual entry only · not part of auto check-in", "猫猫旅行": "Cat travel", "猫猫旅行失败:{error}": "Cat travel failed: {error}", "猫猫旅行失败:{message}": "Cat travel failed: {message}", "猫猫旅行:{message}": "Cat travel: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Keep the account active with free models and a web-app conversation · no rewards claimed", "确定删除「{name}」?删除后到点不再执行。": "Delete \"{name}\"? It will no longer run at its scheduled time.", "确定清空全部签到记录?清空后无法恢复。": "Clear ALL check-in records? This cannot be undone.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Clear the filtered check-in records? This cannot be undone.", "移除 {name}": "Remove {name}", "立即全部签到": "Check in all now", "签到": "Check in", "签到中…": "Checking in…", "签到中心分区": "Check-in center sections", "签到失败:{error}": "Check-in failed: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in complete: {succeeded}/{total} succeeded{active}, {failed} failed", "签到成功": "Check-in succeeded", "签到提供商": "Check-in providers", "签到范围": "Check-in scope", "签到触发时刻": "Check-in trigger time", "签到记录": "Check-in records", "签到记录时间范围": "Check-in records time range", "签到记录表": "Check-in records table", "累计签到记录": "Total check-in records", "结算于 {time}": "Settled at {time}", "能量 {n}": "Energy {n}", "腾讯每日签到接口 · 仅国内版": "Tencent daily check-in API · China edition only", "至少勾一家才能保存(不勾等于这条条目不签到)": "Select at least one provider to save (an empty scope means this entry checks in nothing)", "读取定时签到数据失败:{error}": "Failed to load schedule data: {error}", "读取签到数据失败:{error}": "Failed to load check-in data: {error}", "读取签到记录失败:{error}": "Failed to load check-in records: {error}", "跳过 {n}": "{n} skipped", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Campaign delivery (claim → confirm → read back to verify) · these are plan bonus points", "还没执行过": "Never run yet", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "No schedules yet — click \"Add schedule\" to create one, or check in manually on the \"Check-in center\" tab.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "No check-in records yet — details appear here after a manual check-in or a scheduled run.", "连登 {n} 天": "{n}-day streak", "部分": "Partial", "重签": "Check in again", "重试": "Retry", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Limited-time trial plan · claim requires a slider CAPTCHA · view and claim one by one", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Limited-time trial plan (start-plan), one per day during the campaign · claim requires a slider CAPTCHA", "需真实操作": "Requires real action", "非活动期": "Event inactive", "项": "items", "领取": "Claim", "领取中": "Claiming", "领取中…": "Claiming…", "领取失败": "Claim failed", "领取失败:{error}": "Claim failed: {error}", "(共 {n} 个账号)": " ({n} accounts total)", "(能量 / 连登读数本次未取到)": "(Energy / streak readings unavailable this time)", ",日活保活 {n} 个": ", {n} kept alive" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO checkin_credits claims · reset at midnight (calendar day)", "UMID 组件安装失败:{error}": "UMID component installation failed: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Query the task tree, then light up / claim in one click · includes the school-season event and cat travel · click a row for details", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy International keep-alive models, tried in order", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Free models for WorkBuddy International daily activity · one global setting, unrelated to schedules", "{date}(每天 {time})": "{date} (daily at {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} to complete", "{n} 项待领": "{n} to claim", "{total} 账号 · {done} 已签": "{done} of {total} checked in", "{total} 项任务 · {pending} 项可完成": "{total} tasks · {pending} to complete", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID component installed — the next check-in can claim International points", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Scheduled check-in enabled", "✅ 开学季任务执行完成": "✅ School-season tasks completed", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Growth tasks completed: credits +{credit}, energy +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Starter rewards claimed, {n} points earned in total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in complete: {succeeded}/{total} accounts claimed successfully{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; submit empty to restore the default ({defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "The \"keep-alive model chain\" is the free models used to keep WorkBuddy International accounts active during daily activity runs — tried in order, stops at the first success; clearing the list and saving restores the default chain (current default: {defaults}). Same-day dedup + idempotent claiming: repeat runs only return \"already claimed\" and never add points twice.", "「免费领积分」的每日任务 · 逐个领取": "\"Free points\" daily tasks · claimed one by one", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "One-time rewards · queried and claimed automatically after check-in; once claimed they are recorded locally and no longer queried upstream · click a row to expand the task list", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Claims all of the day’s rewards in one action (daily check-in + newcomer gift) · idempotency guaranteed by the upstream", "一键安装组件": "Install component", "一键完成": "Complete all", "一键领取({n})": "Claim all ({n})", "上次执行:{line}": "Last run: {line}", "上次签到时间": "Last check-in", "上次领取 {time} · 领取需通过滑块验证码": "Last claimed {time} · claim requires passing a slider CAPTCHA", "下次 {date}": "Next {date}", "下次 {date} · 点此管理条目": "Next {date} · click to manage schedules", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below; its and ZCode's daily/plan benefits are claimed under \"Activity rewards\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Not in daily check-in: {list}. CodeArts one-time rewards are under \"Starter rewards\" below, and its daily welfare is right above under \"Daily check-in\"; ZCode plan claims are under \"Activity rewards\".", "与国内版同一套任务接口 · 站点不同": "Same task API as the China edition · different site", "与国内版同一套链路 · 站点不同、令牌不通用": "Same flow as the China edition · different site, tokens not interchangeable", "今天已领 {n} 份": "Claimed {n} today", "今天未领": "Not claimed today", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Claimed today (Beijing time {day}) · {n} items confirmed received · can claim again tomorrow", "今日已执行": "Ran today", "今日已派出": "Sent out today", "今日已领取": "Claimed today", "今日签到": "Today", "今日签到进度": "Today's check-in progress", "从清单里移除": "Remove from the list", "保活": "Keep-alive", "保活 {n}": "{n} kept alive", "保活+领取": "Keep-alive + claim", "保活中…": "Keeping alive…", "保活模型链": "Keep-alive model chain", "全选": "Select all", "全部 {n} 家": "All {n} providers", "全部完成": "All done", "全部查询": "Query all", "全部结果": "All outcomes", "全部账号均可签到": "All accounts can check in", "全部领取": "All claimed", "关着:开机后等到窗口起点再签,随机窗口当天生效": "Off: wait for the window start after startup, so the random window applies today", "关着:所有条目都不执行": "Off: no schedule runs", "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "minutes · accounts run at random moments inside the window; 0 = run immediately at the scheduled time", "删除失败:{error}": "Delete failed: {error}", "删除定时条目": "Delete schedule", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "Signs in the available accounts of the selected providers when due (WorkBuddy CN uses its daily check-in API; WorkBuddy Intl uses the daily activity task: probe activities, claim the daily reward, then keep a free model warm and open a web session to light up the streak; Raccoon uses its desktop daily points chain; AutoClaw uses the official client's daily sign-in task; Qoder CN claims campaign rewards and shows a neutral notice for accounts without campaigns; Qoder Intl needs a device risk identity (generated by the UMID component of the local Qoder client / qodercli) to see the 'daily 100 Credits' campaign and shows a clear explanation instead of an error when the component is missing; Trae claims the SOLO daily check-in credits (reset at local midnight) and reports 'not claimed + reason' instead of an error when the upstream has no campaign for the account or the credential has no device id; Loomy calls its first-login points endpoint once a day; KukuAI claims the 'free points' daily tasks; CodeArts claims the daily ops welfare (claim → confirm → read back, with automatic runs limited to 6 writes per day and 10 minutes apart); OfficeAce claims all of the day's rewards (daily check-in + newcomer gift) in one call). With 'random offset N minutes', the accounts of a round run spread across their own window (clamped to 0:00-23:59 of the same day) instead of all at the same minute; if the window has already passed they all run immediately. Missed runs are caught up after startup so nothing is lost when the machine was off (turn off 'Startup catch-up' to wait for the window start instead). Every provider's check-in API is idempotent, so repeated runs never double-claim.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; CodeArts claims that day's campaign welfare (claim → confirm → read back to verify; automatic runs are limited to 6 write attempts per day with a 10-minute gap); OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "At the scheduled time, auto check-in runs for the available accounts of the selected providers (WorkBuddy China uses the daily check-in API; International uses daily activity tasks — detect the campaign, claim the daily-activity reward, then keep the account alive with free models; Raccoon uses the desktop daily points flow; AutoClaw uses the official client's daily check-in task; Qoder China uses campaign claims, and accounts with no campaign assigned get a neutral notice; Qoder International needs a device risk-control identity first (generated by the UMID component of the local Qoder client / qodercli) to see the \"Daily 100 Credits\" campaign, and a missing component yields a clear explanation instead of an error; Trae claims SOLO's daily check-in points (reset at midnight by calendar day), and when the upstream has no campaign for the account or the credential has no device ID the result is \"not claimed + the specific reason\" instead of an error; Loomy awards first-login points once a day per account; KukuAI claims the \"Free points\" daily tasks; OfficeAce claims all of that day's rewards in one action (daily check-in + newcomer gift)). If the machine was off at the scheduled time, the missed run is made up automatically after it starts — nothing is skipped just because the machine was off. Every provider's check-in API is idempotent, so running it again never claims twice.", "到点时逐个签到,已勾 {n} / {total} 家": "Checked {n} of {total} — each is checked in at the scheduled time", "北京时间 · 错过时点开机后会自动补签": "Beijing time · missed runs are made up automatically after startup", "去领取": "Claim now", "另有 {n} 个账号不参与每日签到": "{n} more accounts are not part of daily check-in", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Claim rewards of completed tasks only (idempotent; repeated clicks will not double-credit)", "可完成": "Can complete", "可派出": "Can send out", "可选 · 缺省显示时刻": "Optional · defaults to the time", "可领奖": "Can claim", "后端未返回定时签到数据": "Backend returned no schedule data", "后端未返回签到中心数据": "The backend did not return check-in center data", "启动补签": "Startup catch-up", "启动补签已关闭": "Startup catch-up disabled", "启动补签已开启": "Startup catch-up enabled", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "International check-in requires the UMID component to generate a device risk-control identity (not detected on this machine).", "在途": "Traveling", "填入缺省链": "Fill in default chain", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Pick a time and the providers, then click Save; the name is optional (the time is shown when empty)", "失败 {n}": "{n} failed", "套餐明细": "Plan details", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Install the Qoder client or qodercli to enable it (no need to restart the gateway).", "安装中…": "Installing…", "官方客户端的每日签到任务": "Official client's daily check-in task", "定时签到": "Scheduled check-in", "定时签到已关闭": "Scheduled check-in disabled", "尚未查询": "Not queried yet", "尚未查询任务状态": "Task status not queried yet", "巡检一次": "Run one round", "已保存:{label}": "Saved: {label}", "已保存:保活模型链": "Saved: Keep-alive model chain", "已保存:定时条目": "Saved: schedule", "已删除定时条目": "Schedule deleted", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Activity reported (streak lit up), but the campaign is not active (nothing to claim this time)", "已抽 {n} 次": "Drew {n} times", "已有结果 {checked} / 共 {total} 个账号": "Results for {checked} / {total} accounts", "已签": "Checked in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Claimed {claimed}/{total} · {earned} points earned", "已领养": "Adopted", "已领取": "Claimed", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Claim \"Daily 100 Credits\" with a device risk-control identity · requires the UMID component", "开学季执行失败:{error}": "School-season run failed: {error}", "开学季执行完成:{message}": "School-season run completed: {message}", "开学季活动": "School-season event", "开着:启用的条目按各自时刻执行": "On: enabled schedules run at their own times", "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "On: schedules not yet run today catch up right after startup, ignoring the random window", "待签": "Not checked in", "待领新手福利": "Starter rewards to claim", "总开关": "Master switch", "总开关已关闭 · 在「定时签到」页打开": "Master switch is off · enable it on the \"Scheduled check-in\" tab", "成功 {n}": "{n} succeeded", "成长任务": "Growth tasks", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Growth tasks finished ({done} succeeded, {failed} failed): credits +{credit}, energy +{energy}", "成长任务执行失败:{error}": "Growth task run failed: {error}", "执行失败:{error}": "Run failed: {error}", "执行并抽奖": "Run & draw", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Run school-season tasks and spend all draw chances (share / chat / expert events)", "把缺省链填进清单,再点「保存」生效": "Puts the default chain into the list; click Save to apply", "抽奖机会 {n} 次": "{n} draw chances", "按住拖动调整顺序": "Press and drag to reorder", "按住拖动,调整这个模型在链里的顺序": "Press and drag to change this model's position in the chain", "按序逐个尝试,共 {n} 个": "{n} models, tried in order", "按结果筛选": "Filter by outcome", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detect + claim + keep-alive · same combo as scheduled check-in", "探测活动并领取日活奖励 · 不做保活": "Detect the campaign and claim the daily-activity reward · no keep-alive", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Accept + light up + claim (only tasks with verified recipes)", "搜账号 / 收益 / 错误 / 触发原因": "Search account / gain / error / trigger reason", "收起新建": "Close new entry", "新建定时条目": "New scheduled entry", "新手福利": "Starter rewards", "新手福利有 {n} 项领取失败,可重试": "{n} starter reward(s) failed to claim — you can retry", "无": "None", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "No dedicated check-in API · hits the login-info endpoint once a day per account (which grants the daily Magicubes)", "无独立签到接口 · 每天替账号打一次首次登录积分": "No dedicated check-in API · awards first-login points once a day per account", "无账号": "No accounts", "暂不可领": "Not claimable yet", "暂不支持": "Not supported yet", "暂无启用的条目 · 点此添加": "No enabled schedules · click to add one", "有未保存的改动": "Unsaved changes", "未勾选提供商": "No provider selected", "未开启": "Off", "未解锁": "Locked", "未领养(领养需先完成当日对话量)": "Not adopted (adoption requires the daily chat quota first)", "未领取": "Not claimed", "本地台账里今天还没领过;活动期内每天发一份新套餐": "No claim recorded locally for today yet; a new plan is issued every day during the event", "本地台账里今天(北京时间)领过的套餐:{plans}": "Plans claimed today (Beijing time) according to the local record: {plans}", "条启用": "enabled", "查询于 {time}": "Queried at {time}", "查询任务": "Query tasks", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Query the task tree, then light up / claim in one click (includes school-season and cat travel)", "查询失败:{error}": "Query failed: {error}", "桌面端每日积分链路": "Desktop daily points flow", "正在读取定时签到数据…": "Loading schedule data…", "正在读取签到数据…": "Loading check-in data…", "每天 {time}": "Daily at {time}", "每天 {time} · {scope}": "Daily {time} · {scope}", "每天 {time} · 随机前后 {n} 分钟 · {scope}": "Daily {time} ± {n} min · {scope}", "每天时刻": "Daily time", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "One row per account per check-in run · outcomes and gains as recorded by the backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Daily activity tasks · a web-app conversation lights up the daily activity, only claims add points · the two can run separately", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Daily welfare · claim → confirm → read back to verify · resets on the Beijing calendar day", "每日签到": "Daily check-in", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Each schedule has its own time and scope · same-day dedup per entry · missed runs are made up after startup", "每账号一条明细 · 点此查看「签到记录」": "One row per account · open \"Check-in records\"", "没有可领套餐的账号(ZCode 未添加)。": "No accounts with claimable plans (ZCode not added).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "No accounts with claimable rewards (CodeArts / ZCode not added).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "No accounts support growth tasks (WorkBuddy CN required).", "没有支持新手福利的账号": "No accounts support starter rewards", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "No accounts support starter rewards — currently Loomy, Raccoon and CodeArts.", "没有符合筛选条件的签到记录": "No check-in records match the current filters", "没有需要执行的任务": "Nothing to run", "活动福利": "Event rewards", "活动(campaign)领取 · 每天 10:00 刷新": "Campaign claims · refreshed daily at 10:00", "活跃上报与保活均未成功,且活动未开启": "Both the activity report and keep-alive failed, and the campaign is not active", "活跃上报完成,但保活未成功且活动未开启": "Activity reported, but keep-alive failed and the campaign is not active", "活跃上报完成,但活动未开启": "Activity reported, but the campaign is not active", "活跃上报成功": "Activity reported", "活跃保活失败": "Keep-alive failed", "活跃保活完成": "Keep-alive complete", "活跃保活完成,但活动未开启": "Keep-alive complete, but the campaign is not active", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive complete, but the activity report failed and the campaign is not active", "添加条目": "Add schedule", "添加模型": "Add model", "清单为空 —— 保存后恢复缺省链": "The list is empty — saving restores the default chain", "清单里已经有「{name}」": "The list already contains \"{name}\"", "清空失败:{error}": "Clear failed: {error}", "清空签到记录": "Clear check-in records", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Click \"Plan details\" to see which plans you got and when they take effect; you can claim again every day during the event", "点击行展开账号明细 · 单账号签到不受范围限制": "Click a row to expand account details · single-account check-in is not limited by scope", "独立链路 · 只提供手动入口 · 不进自动签到": "Separate flow · manual entry only · not part of auto check-in", "猫猫旅行": "Cat travel", "猫猫旅行失败:{error}": "Cat travel failed: {error}", "猫猫旅行失败:{message}": "Cat travel failed: {message}", "猫猫旅行:{message}": "Cat travel: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Keep the account active with free models and a web-app conversation · no rewards claimed", "确定删除「{name}」?删除后到点不再执行。": "Delete \"{name}\"? It will no longer run at its scheduled time.", "确定清空全部签到记录?清空后无法恢复。": "Clear ALL check-in records? This cannot be undone.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Clear the filtered check-in records? This cannot be undone.", "移除 {name}": "Remove {name}", "立即全部签到": "Check in all now", "签到": "Check in", "签到中…": "Checking in…", "签到中心分区": "Check-in center sections", "签到失败:{error}": "Check-in failed: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in complete: {succeeded}/{total} succeeded{active}, {failed} failed", "签到成功": "Check-in succeeded", "签到提供商": "Check-in providers", "签到范围": "Check-in scope", "签到触发时刻": "Check-in trigger time", "签到记录": "Check-in records", "签到记录时间范围": "Check-in records time range", "签到记录表": "Check-in records table", "累计签到记录": "Total check-in records", "结算于 {time}": "Settled at {time}", "能量 {n}": "Energy {n}", "腾讯每日签到接口 · 仅国内版": "Tencent daily check-in API · China edition only", "至少勾一家才能保存(不勾等于这条条目不签到)": "Select at least one provider to save (an empty scope means this entry checks in nothing)", "读取定时签到数据失败:{error}": "Failed to load schedule data: {error}", "读取签到数据失败:{error}": "Failed to load check-in data: {error}", "读取签到记录失败:{error}": "Failed to load check-in records: {error}", "跳过 {n}": "{n} skipped", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Campaign delivery (claim → confirm → read back to verify) · these are plan bonus points", "还没执行过": "Never run yet", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "No schedules yet — click \"Add schedule\" to create one, or check in manually on the \"Check-in center\" tab.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "No check-in records yet — details appear here after a manual check-in or a scheduled run.", "连登 {n} 天": "{n}-day streak", "部分": "Partial", "重签": "Check in again", "重试": "Retry", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Limited-time trial plan · claim requires a slider CAPTCHA · view and claim one by one", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Limited-time trial plan (start-plan), one per day during the campaign · claim requires a slider CAPTCHA", "随机前后": "Random offset", "需真实操作": "Requires real action", "非活动期": "Event inactive", "项": "items", "领取": "Claim", "领取中": "Claiming", "领取中…": "Claiming…", "领取失败": "Claim failed", "领取失败:{error}": "Claim failed: {error}", "(共 {n} 个账号)": " ({n} accounts total)", "(能量 / 连登读数本次未取到)": "(Energy / streak readings unavailable this time)", ",日活保活 {n} 个": ", {n} kept alive" }); diff --git a/desktop-tauri/ui/i18n/ja/checkin.js b/desktop-tauri/ui/i18n/ja/checkin.js index a35a1fc8..515ac4f5 100644 --- a/desktop-tauri/ui/i18n/ja/checkin.js +++ b/desktop-tauri/ui/i18n/ja/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ja/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO の checkin_credits 受け取り · 自然日 0 時に更新", "UMID 组件安装失败:{error}": "UMID コンポーネントのインストールに失敗しました:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 中国版 · タスクツリーを照会してワンクリックで点灯/受け取り · 新学期イベントとねこ旅行を含む · 行をクリックで詳細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 国際版のキープアライブ用モデル(順番にフォールバック)", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy国際版のデイリーアクティビティ用の無料モデル · 全体で1つの設定、スケジュールとは無関係", "{date}(每天 {time})": "{date}(毎日 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "完了可能 {n} 件", "{n} 项待领": "{n} 件受け取り待ち", "{total} 账号 · {done} 已签": "{total} アカウント · {done} チェックイン済み", "{total} 项任务 · {pending} 项可完成": "タスク {total} 件 · 完了可能 {pending} 件", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID コンポーネントをインストールしました。次回のチェックインで国際版の積分を受け取れます", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定期チェックインを有効にしました", "✅ 开学季任务执行完成": "✅ 新学期タスクの実行が完了しました", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長タスク完了:クレジット +{credit} エネルギー +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 初心者ボーナスの受け取りが完了しました。累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ チェックイン完了:{succeeded}/{total} 件のアカウントが受け取りに成功{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。空で送信すると既定({defaults})に戻します。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。リストを空にして保存すると既定のチェーン(現在の既定:{defaults})に戻ります。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「免费领积分」的每日任务 · 逐个领取": "「無料積分受け取り」のデイリータスク · 1 つずつ受け取る", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一度きりの特典 · チェックイン後に自動で照会して受け取り、受け取り済みは本機に記録し以降はアップストリームに問い合わせません · 行をクリックしてタスク一覧を展開", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "その日の報酬を一度にまとめて受け取ります(毎日チェックイン+新規特典) · 冪等性はアップストリームが保証", "一键安装组件": "ワンクリックでインストール", "一键完成": "一括完了", "一键领取({n})": "一括受け取り({n})", "上次执行:{line}": "前回実行:{line}", "上次签到时间": "前回のチェックイン時刻", "上次领取 {time} · 领取需通过滑块验证码": "前回の受け取り {time} · 受け取りにはスライダー認証が必要", "下次 {date}": "次回 {date}", "下次 {date} · 点此管理条目": "次回 {date} · クリックしてスケジュールを管理", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」に、CodeArts と ZCode の日次/プラン特典の受け取りは「アクティビティ特典」にあります。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」、CodeArts のデイリー特典はすぐ上の「デイリーチェックイン」にあります。ZCode のプラン受け取りは「アクティビティ特典」です。", "与国内版同一套任务接口 · 站点不同": "中国版と同じタスク API · サイトが異なる", "与国内版同一套链路 · 站点不同、令牌不通用": "中国版と同じフロー · サイトが異なり、トークンに互換性なし", "今天已领 {n} 份": "本日 {n} 件受け取り済み", "今天未领": "本日は未受取", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "本日(北京時間 {day})受け取り済み · 公式に {n} 件の到着を確認 · 明日また受け取れます", "今日已执行": "本日実行済み", "今日已派出": "本日は出発済み", "今日已领取": "本日受け取り済み", "今日签到": "本日のチェックイン", "今日签到进度": "本日のチェックイン進捗", "从清单里移除": "リストから削除", "保活": "キープアライブ", "保活 {n}": "キープアライブ {n}", "保活+领取": "キープアライブ+受け取り", "保活中…": "キープアライブ中…", "保活模型链": "キープアライブモデルチェーン", "全选": "すべて選択", "全部 {n} 家": "全 {n} 社", "全部完成": "すべて完了", "全部查询": "一括クエリ", "全部结果": "すべての結果", "全部账号均可签到": "すべてのアカウントがチェックイン可能", "全部领取": "すべて受け取り済み", "关着:所有条目都不执行": "オフ:どのスケジュールも実行されません", "删除失败:{error}": "削除に失敗しました:{error}", "删除定时条目": "スケジュールを削除", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;CodeArts はその日の運営特典を受け取ります(受け取り → 確認 → 読み戻し検証。自動実行は 1 日 6 回・間隔 10 分の書き込み制限を受けます);OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点时逐个签到,已勾 {n} / {total} 家": "定刻に 1 社ずつチェックインします。選択 {n} / {total} 社", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 起動時に自動で補完します", "去领取": "受け取りへ", "另有 {n} 个账号不参与每日签到": "ほかにデイリーチェックインの対象外のアカウントが {n} 件", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "完了済みタスクの報酬のみ受け取り(冪等・連打しても二重加算されません)", "可完成": "完了可能", "可派出": "出発可能", "可选 · 缺省显示时刻": "任意 · 未指定では時刻を表示", "可领奖": "受け取り可能", "后端未返回定时签到数据": "バックエンドがスケジュールデータを返しませんでした", "后端未返回签到中心数据": "バックエンドがチェックインセンターのデータを返しませんでした", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "国際版のチェックインには、UMID コンポーネントで生成するデバイスリスク制御 ID が必要です(本機では検出されませんでした)。", "在途": "旅行中", "填入缺省链": "既定のチェーンを入力", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "時刻と範囲を決めて「保存」を押してください。名前は空欄でも構いません(空欄なら時刻を表示)", "失败 {n}": "失敗 {n}", "套餐明细": "プラン明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder クライアントまたは qodercli をインストールすれば利用できます(ゲートウェイの再起動は不要)。", "安装中…": "インストール中…", "官方客户端的每日签到任务": "公式クライアントのデイリーチェックインタスク", "定时签到": "定期チェックイン", "定时签到已关闭": "定期チェックインを無効にしました", "尚未查询": "未照会", "尚未查询任务状态": "タスク状態は未クエリ", "巡检一次": "1 回実行", "已保存:{label}": "保存しました:{label}", "已保存:保活模型链": "保存しました:キープアライブモデルチェーン", "已保存:定时条目": "保存しました:スケジュール", "已删除定时条目": "スケジュールを削除しました", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "アクティビティを報告しました(連続ログイン達成)が、キャンペーンは未実施です(今回の報酬はなし)", "已抽 {n} 次": "{n} 回抽選しました", "已有结果 {checked} / 共 {total} 个账号": "結果あり {checked} / 全 {total} アカウント", "已签": "チェックイン済み", "已领 {claimed}/{total} · 累计 {earned} 积分": "受け取り済み {claimed}/{total} · 累計 {earned} 積分", "已领养": "飼い主になりました", "已领取": "受け取り済み", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "デバイスリスク制御 ID を付けて「毎日 100 Credits」を受け取り · UMID コンポーネントが必要", "开学季执行失败:{error}": "新学期の実行に失敗:{error}", "开学季执行完成:{message}": "新学期の実行が完了:{message}", "开学季活动": "新学期イベント", "开着:启用的条目按各自时刻执行": "オン:有効なスケジュールがそれぞれの時刻に実行されます", "待签": "未チェックイン", "待领新手福利": "受け取り待ちの初心者ボーナス", "总开关": "マスタースイッチ", "总开关已关闭 · 在「定时签到」页打开": "マスタースイッチがオフです · 「定期チェックイン」タブで有効化してください", "成功 {n}": "成功 {n}", "成长任务": "成長タスク", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長タスク完了(成功 {done} 件・失敗 {failed} 件):クレジット +{credit} エネルギー +{energy}", "成长任务执行失败:{error}": "成長タスクの実行に失敗:{error}", "执行失败:{error}": "実行に失敗しました:{error}", "执行并抽奖": "実行して抽選", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "新学期タスクを実行し、抽選回数を使い切る(シェア/会話/エキスパートイベント)", "把缺省链填进清单,再点「保存」生效": "既定のチェーンを一覧に入れます。「保存」で反映されます", "抽奖机会 {n} 次": "抽選チャンス {n} 回", "按住拖动调整顺序": "押したままドラッグで並べ替え", "按住拖动,调整这个模型在链里的顺序": "押したままドラッグして、チェーン内でのこのモデルの順序を変更します", "按序逐个尝试,共 {n} 个": "順番に試行、計 {n} 件", "按结果筛选": "結果で絞り込み", "探测 + 领取 + 保活 · 与定时签到同一套组合": "検出 + 受け取り + キープアライブ · 定期チェックインと同じ組み合わせ", "探测活动并领取日活奖励 · 不做保活": "イベントを検出して日活報酬を受け取り · キープアライブは行わない", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "受注+点灯+受け取り(実測で検証済みのタスクのみ処理)", "搜账号 / 收益 / 错误 / 触发原因": "アカウント / 収益 / エラー / トリガー理由を検索", "收起新建": "新規入力を閉じる", "新建定时条目": "新しい定時エントリ", "新手福利": "初心者ボーナス", "新手福利有 {n} 项领取失败,可重试": "初心者ボーナスで {n} 件の受け取りに失敗しました。再試行できます", "无": "なし", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "専用のチェックイン API なし · 1 日 1 回アカウントの代わりにログイン情報エンドポイントを叩く(それが当日の魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "専用のチェックイン API なし · 毎日アカウントの初回ログイン積分を 1 回付与", "无账号": "アカウントなし", "暂不可领": "受け取り不可", "暂不支持": "未対応", "暂无启用的条目 · 点此添加": "有効なスケジュールがありません · クリックして追加", "有未保存的改动": "未保存の変更があります", "未勾选提供商": "プロバイダー未選択", "未开启": "未有効", "未解锁": "未解禁", "未领养(领养需先完成当日对话量)": "未飼育(飼育には当日の会話量の達成が先に必要)", "未领取": "未受け取り", "本地台账里今天还没领过;活动期内每天发一份新套餐": "ローカルの記録では本日まだ受け取っていません。キャンペーン期間中は毎日新しいプランが 1 件配布されます", "本地台账里今天(北京时间)领过的套餐:{plans}": "ローカル記録で本日(北京時間)受け取ったプラン:{plans}", "条启用": "件有効", "查询于 {time}": "{time} にクエリ", "查询任务": "タスクをクエリ", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "タスクツリーを照会してワンクリックで点灯/受け取り(新学期・ねこ旅行を含む)", "查询失败:{error}": "クエリに失敗しました:{error}", "桌面端每日积分链路": "デスクトップ版のデイリー積分経路", "正在读取定时签到数据…": "定期チェックインデータを読み込み中…", "正在读取签到数据…": "チェックインデータを読み込み中…", "每天 {time}": "毎日 {time}", "每天 {time} · {scope}": "毎日 {time} · {scope}", "每天时刻": "毎日の時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "チェックイン1回ごとに · アカウントごとに1行 · 結果と収益はバックエンドの記録が正", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "毎日のアクティブタスク · Webチャネルの会話で日活を達成、ポイントは受け取りで加算 · 両方は別々に実行可能", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "デイリー特典 · 受け取り → 確認 → 読み戻し検証 · 北京時間の自然日でリセット", "每日签到": "デイリーチェックイン", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "スケジュールごとに時刻と範囲 · 当日はそれぞれ重複排除 · 起動時に自動補完", "每账号一条明细 · 点此查看「签到记录」": "アカウントごとに1行 · 「チェックイン記録」を開く", "没有可领套餐的账号(ZCode 未添加)。": "受け取れるプランのあるアカウントがありません(ZCode 未追加)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "受け取れる特典のあるアカウントがありません(CodeArts / ZCode が未追加)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "成長タスクに対応するアカウントがありません(WorkBuddy 中国版が必要)。", "没有支持新手福利的账号": "初心者ボーナスに対応するアカウントがありません", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "初心者ボーナスに対応するアカウントがありません —— 現在は Loomy、小浣熊、CodeArts の 3 社です。", "没有符合筛选条件的签到记录": "絞り込み条件に一致するチェックイン記録がありません", "没有需要执行的任务": "実行するタスクはありません", "活动福利": "イベント特典", "活动(campaign)领取 · 每天 10:00 刷新": "イベント(campaign)の受け取り · 毎日 10:00 に更新", "活跃上报与保活均未成功,且活动未开启": "アクティビティの報告とキープアライブの両方に失敗し、キャンペーンも未実施です", "活跃上报完成,但保活未成功且活动未开启": "アクティビティの報告は完了しましたが、キープアライブに失敗し、キャンペーンも未実施です", "活跃上报完成,但活动未开启": "アクティビティを報告しましたが、キャンペーンは未実施です", "活跃上报成功": "アクティビティの報告に成功しました", "活跃保活失败": "アクティブのキープアライブに失敗しました", "活跃保活完成": "アクティブのキープアライブが完了しました", "活跃保活完成,但活动未开启": "アクティブのキープアライブは完了しましたが、イベントが有効ではありません", "活跃保活完成,但活跃上报失败且活动未开启": "キープアライブは完了しましたが、アクティビティの報告に失敗し、キャンペーンも未実施です", "添加条目": "スケジュールを追加", "添加模型": "モデルを追加", "清单为空 —— 保存后恢复缺省链": "リストが空です — 保存すると既定のチェーンに戻ります", "清单里已经有「{name}」": "リストに「{name}」はすでにあります", "清空失败:{error}": "クリアに失敗しました:{error}", "清空签到记录": "チェックイン記録をクリア", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "「プラン明細」で受け取ったプランと有効になる時期を確認できます。キャンペーン期間中は毎日また受け取れます", "点击行展开账号明细 · 单账号签到不受范围限制": "行をクリックしてアカウントの詳細を展開 · 単一アカウントのチェックインは範囲の制限を受けません", "独立链路 · 只提供手动入口 · 不进自动签到": "独立した経路 · 手動入口のみ · 自動チェックインには含まれない", "猫猫旅行": "ねこ旅行", "猫猫旅行失败:{error}": "ねこ旅行に失敗:{error}", "猫猫旅行失败:{message}": "ねこ旅行に失敗:{message}", "猫猫旅行:{message}": "ねこ旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "無料モデルとWebチャネルの会話でアカウントのアクティブ状態を維持 · 報酬は受け取らない", "确定删除「{name}」?删除后到点不再执行。": "「{name}」を削除しますか?削除後は予定時刻に実行されません。", "确定清空全部签到记录?清空后无法恢复。": "すべてのチェックイン記録をクリアしますか?クリア後は復元できません。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "現在の絞り込みに一致するチェックイン記録をクリアしますか?クリア後は復元できません。", "移除 {name}": "{name} を削除", "立即全部签到": "今すぐ一括チェックイン", "签到": "チェックイン", "签到中…": "チェックイン中…", "签到中心分区": "チェックインセンターのセクション", "签到失败:{error}": "チェックインに失敗しました:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "チェックイン完了:{succeeded}/{total} 成功{active}、{failed} 件失敗", "签到成功": "チェックインに成功しました", "签到提供商": "チェックインプロバイダー", "签到范围": "チェックイン範囲", "签到触发时刻": "チェックイン実行時刻", "签到记录": "チェックイン記録", "签到记录时间范围": "チェックイン記録の時間範囲", "签到记录表": "チェックイン記録テーブル", "累计签到记录": "累計チェックイン記録", "结算于 {time}": "{time} に確定", "能量 {n}": "エネルギー {n}", "腾讯每日签到接口 · 仅国内版": "Tencent のデイリーチェックイン API · 中国版のみ", "至少勾一家才能保存(不勾等于这条条目不签到)": "保存するには 1 社以上選択してください(未選択=このエントリは何もチェックインしません)", "读取定时签到数据失败:{error}": "定期チェックインデータの読み込みに失敗しました:{error}", "读取签到数据失败:{error}": "チェックインデータの読み込みに失敗しました:{error}", "读取签到记录失败:{error}": "チェックイン記録の読み込みに失敗しました:{error}", "跳过 {n}": "スキップ {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運営イベントの受け渡し(受け取り → 確認 → 読み戻しで検証)· 受け取るのはプラン特典積分", "还没执行过": "まだ実行されていません", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "スケジュールがまだありません —— 「スケジュールを追加」で作成するか、「チェックインセンター」で手動チェックインしてください。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "チェックイン記録はまだありません —— 手動チェックインまたは定期実行の後に、明細がここに表示されます。", "连登 {n} 天": "連続ログイン {n} 日", "部分": "一部", "重签": "再チェックイン", "重试": "再試行", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "期間限定お試しプラン · 受け取りにはスライダー認証が必要 · 1 件ずつ確認して受け取り", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "期間限定体験プラン(start-plan)。開催期間中は毎日 1 件 · 受け取りにはスライダー認証が必要", "需真实操作": "実際の操作が必要", "非活动期": "イベント期間外", "项": "件", "领取": "受け取る", "领取中": "受け取り中", "领取中…": "受け取り中…", "领取失败": "受け取りに失敗", "领取失败:{error}": "受け取りに失敗しました:{error}", "(共 {n} 个账号)": "(全 {n} アカウント)", "(能量 / 连登读数本次未取到)": "(エネルギー/連続ログインの数値は今回取得できませんでした)", ",日活保活 {n} 个": "、日活キープアライブ {n} 件" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO の checkin_credits 受け取り · 自然日 0 時に更新", "UMID 组件安装失败:{error}": "UMID コンポーネントのインストールに失敗しました:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 中国版 · タスクツリーを照会してワンクリックで点灯/受け取り · 新学期イベントとねこ旅行を含む · 行をクリックで詳細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 国際版のキープアライブ用モデル(順番にフォールバック)", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy国際版のデイリーアクティビティ用の無料モデル · 全体で1つの設定、スケジュールとは無関係", "{date}(每天 {time})": "{date}(毎日 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "完了可能 {n} 件", "{n} 项待领": "{n} 件受け取り待ち", "{total} 账号 · {done} 已签": "{total} アカウント · {done} チェックイン済み", "{total} 项任务 · {pending} 项可完成": "タスク {total} 件 · 完了可能 {pending} 件", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID コンポーネントをインストールしました。次回のチェックインで国際版の積分を受け取れます", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定期チェックインを有効にしました", "✅ 开学季任务执行完成": "✅ 新学期タスクの実行が完了しました", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長タスク完了:クレジット +{credit} エネルギー +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 初心者ボーナスの受け取りが完了しました。累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ チェックイン完了:{succeeded}/{total} 件のアカウントが受け取りに成功{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。空で送信すると既定({defaults})に戻します。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「キープアライブモデルチェーン」は、WorkBuddy国際版のデイリーアクティビティでアカウントを活性化し続けるための無料モデルです。順に試し、最初の成功で止まります。リストを空にして保存すると既定のチェーン(現在の既定:{defaults})に戻ります。当日の重複排除+冪等な受け取り:再実行しても「受取済み」が返るだけで、ポイントが二重に加算されることはありません。", "「免费领积分」的每日任务 · 逐个领取": "「無料積分受け取り」のデイリータスク · 1 つずつ受け取る", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一度きりの特典 · チェックイン後に自動で照会して受け取り、受け取り済みは本機に記録し以降はアップストリームに問い合わせません · 行をクリックしてタスク一覧を展開", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "その日の報酬を一度にまとめて受け取ります(毎日チェックイン+新規特典) · 冪等性はアップストリームが保証", "一键安装组件": "ワンクリックでインストール", "一键完成": "一括完了", "一键领取({n})": "一括受け取り({n})", "上次执行:{line}": "前回実行:{line}", "上次签到时间": "前回のチェックイン時刻", "上次领取 {time} · 领取需通过滑块验证码": "前回の受け取り {time} · 受け取りにはスライダー認証が必要", "下次 {date}": "次回 {date}", "下次 {date} · 点此管理条目": "次回 {date} · クリックしてスケジュールを管理", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」に、CodeArts と ZCode の日次/プラン特典の受け取りは「アクティビティ特典」にあります。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "デイリーチェックインの対象外:{list}。CodeArts の一度きりの特典は下の「初心者ボーナス」、CodeArts のデイリー特典はすぐ上の「デイリーチェックイン」にあります。ZCode のプラン受け取りは「アクティビティ特典」です。", "与国内版同一套任务接口 · 站点不同": "中国版と同じタスク API · サイトが異なる", "与国内版同一套链路 · 站点不同、令牌不通用": "中国版と同じフロー · サイトが異なり、トークンに互換性なし", "今天已领 {n} 份": "本日 {n} 件受け取り済み", "今天未领": "本日は未受取", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "本日(北京時間 {day})受け取り済み · 公式に {n} 件の到着を確認 · 明日また受け取れます", "今日已执行": "本日実行済み", "今日已派出": "本日は出発済み", "今日已领取": "本日受け取り済み", "今日签到": "本日のチェックイン", "今日签到进度": "本日のチェックイン進捗", "从清单里移除": "リストから削除", "保活": "キープアライブ", "保活 {n}": "キープアライブ {n}", "保活+领取": "キープアライブ+受け取り", "保活中…": "キープアライブ中…", "保活模型链": "キープアライブモデルチェーン", "全选": "すべて選択", "全部 {n} 家": "全 {n} 社", "全部完成": "すべて完了", "全部查询": "一括クエリ", "全部结果": "すべての結果", "全部账号均可签到": "すべてのアカウントがチェックイン可能", "全部领取": "すべて受け取り済み", "关着:开机后等到窗口起点再签,随机窗口当天生效": "オフ:起動後はウィンドウ開始まで待ち、当日からランダムウィンドウを適用", "关着:所有条目都不执行": "オフ:どのスケジュールも実行されません", "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "分 · ウィンドウ内で各アカウントをランダムな時刻に実行、0 = 定刻に即実行", "删除失败:{error}": "削除に失敗しました:{error}", "删除定时条目": "スケジュールを削除", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると選択プロバイダーの利用可能なアカウントをサインインします(WorkBuddy 中国版は毎日チェックイン API、国際版はデイリーアクティブタスク:アクティビティ検出・日次報酬受取・無料モデルでキープアライブと Web セッションで連続日数を点灯。小浣熊はデスクトップの毎日ポイント経路、AutoClaw は公式クライアントの毎日サインインタスク、Qoder 中国版はキャンペーン受取でキャンペーン未配信のアカウントには中立の案内を表示、Qoder 国際版はデバイス風控身分(ローカルの Qoder クライアント / qodercli の UMID コンポーネントが生成)が必要で、コンポーネント欠如時はエラーではなく明確な説明を表示。Trae は SOLO の毎日チェックインクレジット(現地 0 時リセット)を受け取り、上流がアカウントにキャンペーンを出していない場合や資格情報にデバイス ID がない場合はエラーではなく「未受取 + 理由」を返します。Loomy は毎日初回ログインポイントを 1 回呼び、KukuAI は「無料ポイント」の毎日タスクを受け取り、CodeArts は当日の運営特典(受取 → 確認 → 読み戻し、自動実行は 1 日 6 回・10 分間隔の書き込み制限あり)を受け取り、OfficeAce はその日の全報酬(毎日チェックイン + 新規特典)を 1 回で受け取ります)。「ランダム幅 N 分」を設定すると、その回のアカウントは各自のウィンドウ内(当日 0:00〜23:59 にクランプ)に分散して実行され、同じ 1 分に集中しません。ウィンドウを過ぎている場合は全員すぐに実行します。逃した回は起動後にキャッチアップするので、電源が入っていなかったことで失われることはありません(「起動時キャッチアップ」をオフにするとウィンドウ開始まで待つ動作になります)。各プロバイダーのチェックイン API は冪等で、繰り返し実行しても二重取得にはなりません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;CodeArts はその日の運営特典を受け取ります(受け取り → 確認 → 読み戻し検証。自動実行は 1 日 6 回・間隔 10 分の書き込み制限を受けます);OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "時刻になると、チェックしたプロバイダーの利用可能なアカウントを自動でチェックインします(WorkBuddy 中国版はデイリーチェックイン API、国際版はデイリーアクティブタスク:イベントを検出して日活報酬を受け取り、無料モデルでキープアライブ。小浣熊はデスクトップ版のデイリー積分経路。AutoClaw は公式クライアントのデイリーチェックインタスク。Qoder 中国版はイベント受け取りで、イベントが配信されていないアカウントには中立的な案内が出ます。Qoder 国際版はデバイスリスク制御 ID(本機の Qoder クライアント / qodercli の UMID コンポーネントで生成)を付けて初めて「毎日 100 Credits」イベントが見えるようになり、コンポーネントが欠けている場合はエラーではなく明確な説明が出ます。Trae は SOLO のデイリーチェックイン積分を受け取り(自然日 0 時にリセット)、アップストリームがそのアカウントにイベントを開いていない場合や認証情報にデバイス ID がない場合は、エラーではなく「未受け取り + 具体的な理由」が返ります。Loomy は毎日アカウントの初回ログイン積分を 1 回付与します。KukuAI は「無料積分受け取り」のデイリータスクを消化します;OfficeAce はその日の報酬を一度の操作でまとめて受け取ります(毎日チェックイン+新規特典))。時刻を逃しても、起動後に自動で補完チェックインされ、当時電源が入っていなかったことを理由に漏れることはありません。各社のチェックイン API はすべて冪等なので、繰り返し実行しても二重に受け取ることはありません。", "到点时逐个签到,已勾 {n} / {total} 家": "定刻に 1 社ずつチェックインします。選択 {n} / {total} 社", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 起動時に自動で補完します", "去领取": "受け取りへ", "另有 {n} 个账号不参与每日签到": "ほかにデイリーチェックインの対象外のアカウントが {n} 件", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "完了済みタスクの報酬のみ受け取り(冪等・連打しても二重加算されません)", "可完成": "完了可能", "可派出": "出発可能", "可选 · 缺省显示时刻": "任意 · 未指定では時刻を表示", "可领奖": "受け取り可能", "后端未返回定时签到数据": "バックエンドがスケジュールデータを返しませんでした", "后端未返回签到中心数据": "バックエンドがチェックインセンターのデータを返しませんでした", "启动补签": "起動時キャッチアップ", "启动补签已关闭": "起動時キャッチアップを無効にしました", "启动补签已开启": "起動時キャッチアップを有効にしました", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "国際版のチェックインには、UMID コンポーネントで生成するデバイスリスク制御 ID が必要です(本機では検出されませんでした)。", "在途": "旅行中", "填入缺省链": "既定のチェーンを入力", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "時刻と範囲を決めて「保存」を押してください。名前は空欄でも構いません(空欄なら時刻を表示)", "失败 {n}": "失敗 {n}", "套餐明细": "プラン明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder クライアントまたは qodercli をインストールすれば利用できます(ゲートウェイの再起動は不要)。", "安装中…": "インストール中…", "官方客户端的每日签到任务": "公式クライアントのデイリーチェックインタスク", "定时签到": "定期チェックイン", "定时签到已关闭": "定期チェックインを無効にしました", "尚未查询": "未照会", "尚未查询任务状态": "タスク状態は未クエリ", "巡检一次": "1 回実行", "已保存:{label}": "保存しました:{label}", "已保存:保活模型链": "保存しました:キープアライブモデルチェーン", "已保存:定时条目": "保存しました:スケジュール", "已删除定时条目": "スケジュールを削除しました", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "アクティビティを報告しました(連続ログイン達成)が、キャンペーンは未実施です(今回の報酬はなし)", "已抽 {n} 次": "{n} 回抽選しました", "已有结果 {checked} / 共 {total} 个账号": "結果あり {checked} / 全 {total} アカウント", "已签": "チェックイン済み", "已领 {claimed}/{total} · 累计 {earned} 积分": "受け取り済み {claimed}/{total} · 累計 {earned} 積分", "已领养": "飼い主になりました", "已领取": "受け取り済み", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "デバイスリスク制御 ID を付けて「毎日 100 Credits」を受け取り · UMID コンポーネントが必要", "开学季执行失败:{error}": "新学期の実行に失敗:{error}", "开学季执行完成:{message}": "新学期の実行が完了:{message}", "开学季活动": "新学期イベント", "开着:启用的条目按各自时刻执行": "オン:有効なスケジュールがそれぞれの時刻に実行されます", "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "オン:起動後、本日未実行のスケジュールをランダムウィンドウを無視して即補完", "待签": "未チェックイン", "待领新手福利": "受け取り待ちの初心者ボーナス", "总开关": "マスタースイッチ", "总开关已关闭 · 在「定时签到」页打开": "マスタースイッチがオフです · 「定期チェックイン」タブで有効化してください", "成功 {n}": "成功 {n}", "成长任务": "成長タスク", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長タスク完了(成功 {done} 件・失敗 {failed} 件):クレジット +{credit} エネルギー +{energy}", "成长任务执行失败:{error}": "成長タスクの実行に失敗:{error}", "执行失败:{error}": "実行に失敗しました:{error}", "执行并抽奖": "実行して抽選", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "新学期タスクを実行し、抽選回数を使い切る(シェア/会話/エキスパートイベント)", "把缺省链填进清单,再点「保存」生效": "既定のチェーンを一覧に入れます。「保存」で反映されます", "抽奖机会 {n} 次": "抽選チャンス {n} 回", "按住拖动调整顺序": "押したままドラッグで並べ替え", "按住拖动,调整这个模型在链里的顺序": "押したままドラッグして、チェーン内でのこのモデルの順序を変更します", "按序逐个尝试,共 {n} 个": "順番に試行、計 {n} 件", "按结果筛选": "結果で絞り込み", "探测 + 领取 + 保活 · 与定时签到同一套组合": "検出 + 受け取り + キープアライブ · 定期チェックインと同じ組み合わせ", "探测活动并领取日活奖励 · 不做保活": "イベントを検出して日活報酬を受け取り · キープアライブは行わない", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "受注+点灯+受け取り(実測で検証済みのタスクのみ処理)", "搜账号 / 收益 / 错误 / 触发原因": "アカウント / 収益 / エラー / トリガー理由を検索", "收起新建": "新規入力を閉じる", "新建定时条目": "新しい定時エントリ", "新手福利": "初心者ボーナス", "新手福利有 {n} 项领取失败,可重试": "初心者ボーナスで {n} 件の受け取りに失敗しました。再試行できます", "无": "なし", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "専用のチェックイン API なし · 1 日 1 回アカウントの代わりにログイン情報エンドポイントを叩く(それが当日の魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "専用のチェックイン API なし · 毎日アカウントの初回ログイン積分を 1 回付与", "无账号": "アカウントなし", "暂不可领": "受け取り不可", "暂不支持": "未対応", "暂无启用的条目 · 点此添加": "有効なスケジュールがありません · クリックして追加", "有未保存的改动": "未保存の変更があります", "未勾选提供商": "プロバイダー未選択", "未开启": "未有効", "未解锁": "未解禁", "未领养(领养需先完成当日对话量)": "未飼育(飼育には当日の会話量の達成が先に必要)", "未领取": "未受け取り", "本地台账里今天还没领过;活动期内每天发一份新套餐": "ローカルの記録では本日まだ受け取っていません。キャンペーン期間中は毎日新しいプランが 1 件配布されます", "本地台账里今天(北京时间)领过的套餐:{plans}": "ローカル記録で本日(北京時間)受け取ったプラン:{plans}", "条启用": "件有効", "查询于 {time}": "{time} にクエリ", "查询任务": "タスクをクエリ", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "タスクツリーを照会してワンクリックで点灯/受け取り(新学期・ねこ旅行を含む)", "查询失败:{error}": "クエリに失敗しました:{error}", "桌面端每日积分链路": "デスクトップ版のデイリー積分経路", "正在读取定时签到数据…": "定期チェックインデータを読み込み中…", "正在读取签到数据…": "チェックインデータを読み込み中…", "每天 {time}": "毎日 {time}", "每天 {time} · {scope}": "毎日 {time} · {scope}", "每天 {time} · 随机前后 {n} 分钟 · {scope}": "毎日 {time} 前後 {n} 分 · {scope}", "每天时刻": "毎日の時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "チェックイン1回ごとに · アカウントごとに1行 · 結果と収益はバックエンドの記録が正", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "毎日のアクティブタスク · Webチャネルの会話で日活を達成、ポイントは受け取りで加算 · 両方は別々に実行可能", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "デイリー特典 · 受け取り → 確認 → 読み戻し検証 · 北京時間の自然日でリセット", "每日签到": "デイリーチェックイン", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "スケジュールごとに時刻と範囲 · 当日はそれぞれ重複排除 · 起動時に自動補完", "每账号一条明细 · 点此查看「签到记录」": "アカウントごとに1行 · 「チェックイン記録」を開く", "没有可领套餐的账号(ZCode 未添加)。": "受け取れるプランのあるアカウントがありません(ZCode 未追加)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "受け取れる特典のあるアカウントがありません(CodeArts / ZCode が未追加)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "成長タスクに対応するアカウントがありません(WorkBuddy 中国版が必要)。", "没有支持新手福利的账号": "初心者ボーナスに対応するアカウントがありません", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "初心者ボーナスに対応するアカウントがありません —— 現在は Loomy、小浣熊、CodeArts の 3 社です。", "没有符合筛选条件的签到记录": "絞り込み条件に一致するチェックイン記録がありません", "没有需要执行的任务": "実行するタスクはありません", "活动福利": "イベント特典", "活动(campaign)领取 · 每天 10:00 刷新": "イベント(campaign)の受け取り · 毎日 10:00 に更新", "活跃上报与保活均未成功,且活动未开启": "アクティビティの報告とキープアライブの両方に失敗し、キャンペーンも未実施です", "活跃上报完成,但保活未成功且活动未开启": "アクティビティの報告は完了しましたが、キープアライブに失敗し、キャンペーンも未実施です", "活跃上报完成,但活动未开启": "アクティビティを報告しましたが、キャンペーンは未実施です", "活跃上报成功": "アクティビティの報告に成功しました", "活跃保活失败": "アクティブのキープアライブに失敗しました", "活跃保活完成": "アクティブのキープアライブが完了しました", "活跃保活完成,但活动未开启": "アクティブのキープアライブは完了しましたが、イベントが有効ではありません", "活跃保活完成,但活跃上报失败且活动未开启": "キープアライブは完了しましたが、アクティビティの報告に失敗し、キャンペーンも未実施です", "添加条目": "スケジュールを追加", "添加模型": "モデルを追加", "清单为空 —— 保存后恢复缺省链": "リストが空です — 保存すると既定のチェーンに戻ります", "清单里已经有「{name}」": "リストに「{name}」はすでにあります", "清空失败:{error}": "クリアに失敗しました:{error}", "清空签到记录": "チェックイン記録をクリア", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "「プラン明細」で受け取ったプランと有効になる時期を確認できます。キャンペーン期間中は毎日また受け取れます", "点击行展开账号明细 · 单账号签到不受范围限制": "行をクリックしてアカウントの詳細を展開 · 単一アカウントのチェックインは範囲の制限を受けません", "独立链路 · 只提供手动入口 · 不进自动签到": "独立した経路 · 手動入口のみ · 自動チェックインには含まれない", "猫猫旅行": "ねこ旅行", "猫猫旅行失败:{error}": "ねこ旅行に失敗:{error}", "猫猫旅行失败:{message}": "ねこ旅行に失敗:{message}", "猫猫旅行:{message}": "ねこ旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "無料モデルとWebチャネルの会話でアカウントのアクティブ状態を維持 · 報酬は受け取らない", "确定删除「{name}」?删除后到点不再执行。": "「{name}」を削除しますか?削除後は予定時刻に実行されません。", "确定清空全部签到记录?清空后无法恢复。": "すべてのチェックイン記録をクリアしますか?クリア後は復元できません。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "現在の絞り込みに一致するチェックイン記録をクリアしますか?クリア後は復元できません。", "移除 {name}": "{name} を削除", "立即全部签到": "今すぐ一括チェックイン", "签到": "チェックイン", "签到中…": "チェックイン中…", "签到中心分区": "チェックインセンターのセクション", "签到失败:{error}": "チェックインに失敗しました:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "チェックイン完了:{succeeded}/{total} 成功{active}、{failed} 件失敗", "签到成功": "チェックインに成功しました", "签到提供商": "チェックインプロバイダー", "签到范围": "チェックイン範囲", "签到触发时刻": "チェックイン実行時刻", "签到记录": "チェックイン記録", "签到记录时间范围": "チェックイン記録の時間範囲", "签到记录表": "チェックイン記録テーブル", "累计签到记录": "累計チェックイン記録", "结算于 {time}": "{time} に確定", "能量 {n}": "エネルギー {n}", "腾讯每日签到接口 · 仅国内版": "Tencent のデイリーチェックイン API · 中国版のみ", "至少勾一家才能保存(不勾等于这条条目不签到)": "保存するには 1 社以上選択してください(未選択=このエントリは何もチェックインしません)", "读取定时签到数据失败:{error}": "定期チェックインデータの読み込みに失敗しました:{error}", "读取签到数据失败:{error}": "チェックインデータの読み込みに失敗しました:{error}", "读取签到记录失败:{error}": "チェックイン記録の読み込みに失敗しました:{error}", "跳过 {n}": "スキップ {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運営イベントの受け渡し(受け取り → 確認 → 読み戻しで検証)· 受け取るのはプラン特典積分", "还没执行过": "まだ実行されていません", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "スケジュールがまだありません —— 「スケジュールを追加」で作成するか、「チェックインセンター」で手動チェックインしてください。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "チェックイン記録はまだありません —— 手動チェックインまたは定期実行の後に、明細がここに表示されます。", "连登 {n} 天": "連続ログイン {n} 日", "部分": "一部", "重签": "再チェックイン", "重试": "再試行", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "期間限定お試しプラン · 受け取りにはスライダー認証が必要 · 1 件ずつ確認して受け取り", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "期間限定体験プラン(start-plan)。開催期間中は毎日 1 件 · 受け取りにはスライダー認証が必要", "随机前后": "ランダム幅", "需真实操作": "実際の操作が必要", "非活动期": "イベント期間外", "项": "件", "领取": "受け取る", "领取中": "受け取り中", "领取中…": "受け取り中…", "领取失败": "受け取りに失敗", "领取失败:{error}": "受け取りに失敗しました:{error}", "(共 {n} 个账号)": "(全 {n} アカウント)", "(能量 / 连登读数本次未取到)": "(エネルギー/連続ログインの数値は今回取得できませんでした)", ",日活保活 {n} 个": "、日活キープアライブ {n} 件" }); diff --git a/desktop-tauri/ui/i18n/ko/checkin.js b/desktop-tauri/ui/i18n/ko/checkin.js index 150d4da1..77532d43 100644 --- a/desktop-tauri/ui/i18n/ko/checkin.js +++ b/desktop-tauri/ui/i18n/ko/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:ko/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO의 checkin_credits 수령 · 자연일 0시 기준 새로고침", "UMID 组件安装失败:{error}": "UMID 컴포넌트 설치 실패: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 중국판 · 작업 트리를 조회한 뒤 한 번에 점등/수령 · 개학 시즌 이벤트와 고양이 여행 포함 · 행을 클릭하면 상세", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 국제판 키핑 모델, 순서대로 폴백", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 국제판 일일 활동용 무료 모델 · 전역 단일 설정, 항목과 무관", "{date}(每天 {time})": "{date} (매일 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n}개 완료 가능", "{n} 项待领": "수령 대기 {n}건", "{total} 账号 · {done} 已签": "계정 {total}개 · 출석 완료 {done}개", "{total} 项任务 · {pending} 项可完成": "작업 {total}개 · 완료 가능 {pending}개", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 컴포넌트를 설치했습니다. 다음 출석부터 국제판 포인트를 수령할 수 있습니다", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 예약 출석이 켜졌습니다", "✅ 开学季任务执行完成": "✅ 개학 시즌 작업 실행 완료", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 성장 과제 완료: 크레딧 +{credit} 에너지 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 입문 혜택 수령 완료, 누적 {n} 포인트", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 출석 완료: {succeeded}/{total}개 계정 수령 성공{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 비운 채로 제출하면 기본값({defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 목록을 비우고 저장하면 기본 체인(현재 기본값: {defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「免费领积分」的每日任务 · 逐个领取": "「무료 포인트 받기」 일일 작업 · 하나씩 수령", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "일회성 혜택 · 출석 후 자동으로 조회하고 수령하며, 수령을 마치면 로컬에 기록해 업스트림을 더 조회하지 않음 · 행을 클릭해 작업 목록 펼치기", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "그날의 보상을 한 번에 일괄 수령합니다(매일 출석 + 신규 혜택) · 멱등성은 업스트림이 보장", "一键安装组件": "컴포넌트 한 번에 설치", "一键完成": "한 번에 완료", "一键领取({n})": "전체 수령({n})", "上次执行:{line}": "마지막 실행: {line}", "上次签到时间": "최근 출석 시간", "上次领取 {time} · 领取需通过滑块验证码": "최근 수령 {time} · 수령 시 슬라이더 캡차 필요", "下次 {date}": "다음 {date}", "下次 {date} · 点此管理条目": "다음 {date} · 클릭하여 항목 관리", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에 있으며, CodeArts와 ZCode의 일일/플랜 혜택 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에, CodeArts의 일일 혜택은 바로 위 \"일일 출석\"에 있습니다. ZCode의 플랜 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "与国内版同一套任务接口 · 站点不同": "중국판과 동일한 작업 인터페이스 · 사이트만 다름", "与国内版同一套链路 · 站点不同、令牌不通用": "중국판과 동일한 흐름 · 사이트가 다르고 토큰은 호환되지 않음", "今天已领 {n} 份": "오늘 {n}건 받음", "今天未领": "오늘 미수령", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "오늘(베이징 시간 {day}) 수령 완료 · 공식 확인 반영 {n}건 · 내일 다시 수령 가능", "今日已执行": "오늘 실행됨", "今日已派出": "오늘 이미 출발", "今日已领取": "오늘 수령 완료", "今日签到": "오늘 출석", "今日签到进度": "오늘 출석 진행률", "从清单里移除": "목록에서 제거", "保活": "키핑", "保活 {n}": "키핑 {n}", "保活+领取": "키핑+수령", "保活中…": "키핑 중…", "保活模型链": "키핑 모델 체인", "全选": "전체 선택", "全部 {n} 家": "전체 {n}곳", "全部完成": "모두 완료", "全部查询": "전체 조회", "全部结果": "모든 결과", "全部账号均可签到": "모든 계정이 출석할 수 있습니다", "全部领取": "전체 수령 완료", "关着:所有条目都不执行": "꺼짐: 어떤 항목도 실행되지 않습니다", "删除失败:{error}": "삭제 실패: {error}", "删除定时条目": "예약 항목 삭제", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; CodeArts는 당일 운영 혜택을 수령합니다(수령 → 확인 → 재조회 검증, 자동 실행은 하루 6회 / 간격 10분의 쓰기 요청 제한이 적용됩니다); OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点时逐个签到,已勾 {n} / {total} 家": "정해진 시각에 하나씩 출석합니다. 선택 {n} / {total}개", "北京时间 · 错过时点开机后会自动补签": "베이징 시간 · 시간을 놓쳐도 시작 후 자동으로 보완됩니다", "去领取": "수령하러 가기", "另有 {n} 个账号不参与每日签到": "그 외 {n}개 계정은 매일 출석 체크에 참여하지 않습니다", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "완료된 작업의 보상만 수령(멱등, 반복 클릭해도 중복 적립되지 않음)", "可完成": "완료 가능", "可派出": "출발 가능", "可选 · 缺省显示时刻": "선택 · 기본값은 시간 표시", "可领奖": "수령 가능", "后端未返回定时签到数据": "백엔드가 예약 데이터를 반환하지 않았습니다", "后端未返回签到中心数据": "백엔드가 출석 체크 센터 데이터를 반환하지 않았습니다", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "국제판 출석에는 기기 리스크 관리 신원을 생성할 UMID 컴포넌트가 필요합니다 (이 기기에서 감지되지 않음).", "在途": "여행 중", "填入缺省链": "기본 체인 채우기", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "시각과 출석 범위를 정한 뒤 「저장」을 누르세요. 이름은 비워도 됩니다(비우면 시각이 표시됩니다)", "失败 {n}": "실패 {n}", "套餐明细": "플랜 상세", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder 클라이언트 또는 qodercli를 설치하면 됩니다 (게이트웨이 재시작 불필요).", "安装中…": "설치 중…", "官方客户端的每日签到任务": "공식 클라이언트의 매일 출석 작업", "定时签到": "예약 출석", "定时签到已关闭": "예약 출석이 꺼졌습니다", "尚未查询": "아직 조회하지 않음", "尚未查询任务状态": "작업 상태를 아직 조회하지 않았습니다", "巡检一次": "한 번 점검", "已保存:{label}": "저장됨: {label}", "已保存:保活模型链": "저장됨: 키핑 모델 체인", "已保存:定时条目": "저장됨: 예약 항목", "已删除定时条目": "예약 항목이 삭제되었습니다", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "활동 보고 완료(연속 출석 점등), but 캠페인이 진행 중이 아닙니다(이번에 받을 보상 없음)", "已抽 {n} 次": "{n}회 추첨함", "已有结果 {checked} / 共 {total} 个账号": "결과 있음 {checked} / 전체 {total}개 계정", "已签": "출석 완료", "已领 {claimed}/{total} · 累计 {earned} 积分": "수령 {claimed}/{total} · 누적 {earned} 포인트", "已领养": "입양 완료", "已领取": "수령 완료", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "기기 리스크 관리 신원을 갖춰 「매일 100 Credits」 수령 · UMID 컴포넌트 필요", "开学季执行失败:{error}": "개학 시즌 실행 실패: {error}", "开学季执行完成:{message}": "개학 시즌 실행 완료: {message}", "开学季活动": "개학 시즌 이벤트", "开着:启用的条目按各自时刻执行": "켜짐: 활성화된 항목이 각자의 시간에 실행됩니다", "待签": "출석 대기", "待领新手福利": "수령 대기 입문 혜택", "总开关": "메인 스위치", "总开关已关闭 · 在「定时签到」页打开": "메인 스위치가 꺼져 있습니다 · \"예약 출석\" 탭에서 켜세요", "成功 {n}": "성공 {n}", "成长任务": "성장 과제", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "성장 과제 완료(성공 {done}개, 실패 {failed}개): 크레딧 +{credit} 에너지 +{energy}", "成长任务执行失败:{error}": "성장 과제 실행 실패: {error}", "执行失败:{error}": "실행 실패: {error}", "执行并抽奖": "실행 및 추첨", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "개학 시즌 작업을 실행하고 추첨 기회를 모두 사용(공유/대화/전문가 이벤트)", "把缺省链填进清单,再点「保存」生效": "기본 체인을 목록에 채웁니다. 「저장」을 눌러야 반영됩니다", "抽奖机会 {n} 次": "추첨 기회 {n}회", "按住拖动调整顺序": "길게 눌러 드래그해 순서 변경", "按住拖动,调整这个模型在链里的顺序": "길게 눌러 드래그해 체인에서 이 모델의 순서를 조정합니다", "按序逐个尝试,共 {n} 个": "순서대로 시도, 총 {n}개", "按结果筛选": "결과로 필터", "探测 + 领取 + 保活 · 与定时签到同一套组合": "탐지 + 수령 + 키핑 · 예약 출석과 동일한 조합", "探测活动并领取日活奖励 · 不做保活": "이벤트를 탐지해 일일 활성 보상을 수령 · 키핑은 하지 않음", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "수락 + 점등 + 수령(실측으로 검증된 작업만 처리)", "搜账号 / 收益 / 错误 / 触发原因": "계정 / 수익 / 오류 / 트리거 사유 검색", "收起新建": "새 항목 닫기", "新建定时条目": "새 예약 항목", "新手福利": "입문 혜택", "新手福利有 {n} 项领取失败,可重试": "입문 혜택 {n}건의 수령에 실패했습니다. 재시도할 수 있습니다", "无": "없음", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "전용 체크인 API 없음 · 하루에 한 번 계정 대신 로그인 정보 엔드포인트를 호출(그것이 당일 마립)", "无独立签到接口 · 每天替账号打一次首次登录积分": "독립 출석 인터페이스 없음 · 매일 계정당 최초 로그인 포인트를 한 번 적립", "无账号": "계정 없음", "暂不可领": "지금은 수령 불가", "暂不支持": "아직 미지원", "暂无启用的条目 · 点此添加": "활성화된 항목이 없습니다 · 클릭하여 추가", "有未保存的改动": "저장되지 않은 변경 사항이 있습니다", "未勾选提供商": "공급자 미선택", "未开启": "꺼짐", "未解锁": "잠김", "未领养(领养需先完成当日对话量)": "미입양(입양하려면 먼저 당일 대화량을 채워야 함)", "未领取": "미수령", "本地台账里今天还没领过;活动期内每天发一份新套餐": "로컬 기록상 오늘은 아직 받지 않았습니다. 이벤트 기간에는 매일 새 플랜이 한 건씩 지급됩니다", "本地台账里今天(北京时间)领过的套餐:{plans}": "로컬 기록상 오늘(베이징 시간) 받은 플랜: {plans}", "条启用": "개 활성화", "查询于 {time}": "조회 시각 {time}", "查询任务": "작업 조회", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "작업 트리를 조회하고 한 번에 점등/수령(개학 시즌과 고양이 여행 포함)", "查询失败:{error}": "조회 실패: {error}", "桌面端每日积分链路": "데스크톱 앱 일일 포인트 경로", "正在读取定时签到数据…": "예약 출석 데이터를 읽는 중…", "正在读取签到数据…": "출석 데이터를 읽는 중…", "每天 {time}": "매일 {time}", "每天 {time} · {scope}": "매일 {time} · {scope}", "每天时刻": "매일 시각", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "출석 실행마다 · 계정별 한 행 · 결과와 수익은 백엔드 기록 기준", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "매일 활성 작업 · 웹 채널 세션으로 일일 활성 달성, 포인트는 수령 시 적립 · 두 가지는 따로 실행 가능", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "일일 혜택 · 수령 → 확인 → 재조회 검증 · 베이징 시간 자연일 기준 초기화", "每日签到": "매일 출석 체크", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "항목별 시간과 범위 · 항목별 당일 중복 제거 · 시작 시 자동 보완", "每账号一条明细 · 点此查看「签到记录」": "계정별 한 행 · \"출석 기록\" 열기", "没有可领套餐的账号(ZCode 未添加)。": "수령할 플랜이 있는 계정이 없습니다 (ZCode 미추가).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "혜택을 수령할 수 있는 계정이 없습니다 (CodeArts / ZCode 미추가).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "성장 과제를 지원하는 계정이 없습니다(WorkBuddy 중국판 필요).", "没有支持新手福利的账号": "입문 혜택을 지원하는 계정이 없습니다", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "입문 혜택을 지원하는 계정이 없습니다 — 현재 Loomy, 小浣熊, CodeArts 세 곳입니다.", "没有符合筛选条件的签到记录": "필터 조건에 맞는 출석 기록이 없습니다", "没有需要执行的任务": "실행할 작업이 없습니다", "活动福利": "이벤트 혜택", "活动(campaign)领取 · 每天 10:00 刷新": "캠페인(campaign) 수령 · 매일 10:00 새로고침", "活跃上报与保活均未成功,且活动未开启": "활동 보고와 keep-alive 모두 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但保活未成功且活动未开启": "활동 보고는 완료되었지만 keep-alive에 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但活动未开启": "활동 보고 완료, but 캠페인이 진행 중이 아닙니다", "活跃上报成功": "활동 보고 성공", "活跃保活失败": "활성 키핑 실패", "活跃保活完成": "활성 키핑 완료", "活跃保活完成,但活动未开启": "활성 키핑 완료, 다만 이벤트는 열리지 않았습니다", "活跃保活完成,但活跃上报失败且活动未开启": "keep-alive는 완료되었지만 활동 보고에 실패했고 캠페인도 진행 중이 아닙니다", "添加条目": "항목 추가", "添加模型": "모델 추가", "清单为空 —— 保存后恢复缺省链": "목록이 비어 있습니다 — 저장하면 기본 체인으로 복원됩니다", "清单里已经有「{name}」": "목록에 \"{name}\"이(가) 이미 있습니다", "清空失败:{error}": "비우기 실패: {error}", "清空签到记录": "출석 기록 비우기", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "\"플랜 상세\"에서 어떤 플랜을 받았고 언제 적용되는지 확인하세요. 이벤트 기간에는 매일 다시 받을 수 있습니다", "点击行展开账号明细 · 单账号签到不受范围限制": "행을 클릭해 계정 상세 펼치기 · 개별 계정 출석은 범위 제한을 받지 않습니다", "独立链路 · 只提供手动入口 · 不进自动签到": "독립 경로 · 수동 진입점만 제공 · 자동 출석에는 포함되지 않음", "猫猫旅行": "고양이 여행", "猫猫旅行失败:{error}": "고양이 여행 실패: {error}", "猫猫旅行失败:{message}": "고양이 여행 실패: {message}", "猫猫旅行:{message}": "고양이 여행: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "무료 모델과 웹 채널 세션으로 계정 활성 유지 · 보상은 수령하지 않음", "确定删除「{name}」?删除后到点不再执行。": "\"{name}\"을(를) 삭제할까요? 삭제 후 예약 시간에 실행되지 않습니다.", "确定清空全部签到记录?清空后无法恢复。": "모든 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "현재 필터된 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "移除 {name}": "{name} 제거", "立即全部签到": "지금 전체 출석", "签到": "출석", "签到中…": "출석 중…", "签到中心分区": "출석 센터 구역", "签到失败:{error}": "출석 실패: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "출석 완료: {succeeded}/{total} 성공{active}, {failed}개 실패", "签到成功": "출석 성공", "签到提供商": "출석 제공자", "签到范围": "출석 범위", "签到触发时刻": "출석 실행 시각", "签到记录": "출석 기록", "签到记录时间范围": "출석 기록 시간 범위", "签到记录表": "출석 기록 표", "累计签到记录": "누적 출석 기록", "结算于 {time}": "결산 시각 {time}", "能量 {n}": "에너지 {n}", "腾讯每日签到接口 · 仅国内版": "텐센트 매일 출석 인터페이스 · 중국판 전용", "至少勾一家才能保存(不勾等于这条条目不签到)": "저장하려면 최소 한 곳을 선택하세요(선택하지 않으면 이 항목은 아무것도 출석하지 않습니다)", "读取定时签到数据失败:{error}": "예약 출석 데이터 로드 실패: {error}", "读取签到数据失败:{error}": "출석 데이터 읽기 실패: {error}", "读取签到记录失败:{error}": "출석 기록 로드 실패: {error}", "跳过 {n}": "건너뜀 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "운영 이벤트 전달 (수령 → 확인 → 재조회 검증) · 플랜 증정 포인트를 수령합니다", "还没执行过": "아직 실행된 적 없음", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "예약 항목이 아직 없습니다 — \"항목 추가\"로 만들거나 \"출석 센터\"에서 수동으로 출석하세요.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "출석 기록이 아직 없습니다 — 수동 출석 또는 예약 실행 후 여기에 상세 내역이 표시됩니다.", "连登 {n} 天": "연속 로그인 {n}일", "部分": "일부", "重签": "재출석", "重试": "다시 시도", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "기간 한정 체험 플랜 · 수령 시 슬라이더 인증 필요 · 항목별로 확인하고 수령", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "기간 한정 체험 플랜(start-plan), 이벤트 기간 내 매일 1회 · 수령 시 슬라이더 캡차 필요", "需真实操作": "실제 조작 필요", "非活动期": "이벤트 기간 아님", "项": "건", "领取": "수령", "领取中": "수령 중", "领取中…": "수령 중…", "领取失败": "수령 실패", "领取失败:{error}": "수령 실패: {error}", "(共 {n} 个账号)": "(전체 {n}개 계정)", "(能量 / 连登读数本次未取到)": "(에너지/연속 로그인 수치는 이번에 가져오지 못했습니다)", ",日活保活 {n} 个": ", 일일 활성 키핑 {n}개" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO의 checkin_credits 수령 · 자연일 0시 기준 새로고침", "UMID 组件安装失败:{error}": "UMID 컴포넌트 설치 실패: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 중국판 · 작업 트리를 조회한 뒤 한 번에 점등/수령 · 개학 시즌 이벤트와 고양이 여행 포함 · 행을 클릭하면 상세", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 국제판 키핑 모델, 순서대로 폴백", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 국제판 일일 활동용 무료 모델 · 전역 단일 설정, 항목과 무관", "{date}(每天 {time})": "{date} (매일 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n}개 완료 가능", "{n} 项待领": "수령 대기 {n}건", "{total} 账号 · {done} 已签": "계정 {total}개 · 출석 완료 {done}개", "{total} 项任务 · {pending} 项可完成": "작업 {total}개 · 완료 가능 {pending}개", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 컴포넌트를 설치했습니다. 다음 출석부터 국제판 포인트를 수령할 수 있습니다", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 예약 출석이 켜졌습니다", "✅ 开学季任务执行完成": "✅ 개학 시즌 작업 실행 완료", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 성장 과제 완료: 크레딧 +{credit} 에너지 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 입문 혜택 수령 완료, 누적 {n} 포인트", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 출석 완료: {succeeded}/{total}개 계정 수령 성공{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 비운 채로 제출하면 기본값({defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "\"키핑 모델 체인\"은 WorkBuddy 국제판 일일 활동에서 계정을 활성 상태로 유지하는 무료 모델입니다. 순서대로 시도하며 첫 성공에서 멈춥니다. 목록을 비우고 저장하면 기본 체인(현재 기본값: {defaults})으로 복원됩니다. 당일 중복 제거 + 멱등한 수령: 반복 실행해도 \"이미 수령됨\"만 반환되며 포인트가 이중으로 적립되지 않습니다.", "「免费领积分」的每日任务 · 逐个领取": "「무료 포인트 받기」 일일 작업 · 하나씩 수령", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "일회성 혜택 · 출석 후 자동으로 조회하고 수령하며, 수령을 마치면 로컬에 기록해 업스트림을 더 조회하지 않음 · 행을 클릭해 작업 목록 펼치기", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "그날의 보상을 한 번에 일괄 수령합니다(매일 출석 + 신규 혜택) · 멱등성은 업스트림이 보장", "一键安装组件": "컴포넌트 한 번에 설치", "一键完成": "한 번에 완료", "一键领取({n})": "전체 수령({n})", "上次执行:{line}": "마지막 실행: {line}", "上次签到时间": "최근 출석 시간", "上次领取 {time} · 领取需通过滑块验证码": "최근 수령 {time} · 수령 시 슬라이더 캡차 필요", "下次 {date}": "다음 {date}", "下次 {date} · 点此管理条目": "다음 {date} · 클릭하여 항목 관리", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에 있으며, CodeArts와 ZCode의 일일/플랜 혜택 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "일일 출석 제외: {list}. CodeArts의 일회성 보상은 아래 \"입문 혜택\"에, CodeArts의 일일 혜택은 바로 위 \"일일 출석\"에 있습니다. ZCode의 플랜 수령은 \"활동 혜택\"에서 볼 수 있습니다.", "与国内版同一套任务接口 · 站点不同": "중국판과 동일한 작업 인터페이스 · 사이트만 다름", "与国内版同一套链路 · 站点不同、令牌不通用": "중국판과 동일한 흐름 · 사이트가 다르고 토큰은 호환되지 않음", "今天已领 {n} 份": "오늘 {n}건 받음", "今天未领": "오늘 미수령", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "오늘(베이징 시간 {day}) 수령 완료 · 공식 확인 반영 {n}건 · 내일 다시 수령 가능", "今日已执行": "오늘 실행됨", "今日已派出": "오늘 이미 출발", "今日已领取": "오늘 수령 완료", "今日签到": "오늘 출석", "今日签到进度": "오늘 출석 진행률", "从清单里移除": "목록에서 제거", "保活": "키핑", "保活 {n}": "키핑 {n}", "保活+领取": "키핑+수령", "保活中…": "키핑 중…", "保活模型链": "키핑 모델 체인", "全选": "전체 선택", "全部 {n} 家": "전체 {n}곳", "全部完成": "모두 완료", "全部查询": "전체 조회", "全部结果": "모든 결과", "全部账号均可签到": "모든 계정이 출석할 수 있습니다", "全部领取": "전체 수령 완료", "关着:开机后等到窗口起点再签,随机窗口当天生效": "꺼짐: 시작 후 윈도 시작까지 기다리며, 당일부터 랜덤 윈도가 적용", "关着:所有条目都不执行": "꺼짐: 어떤 항목도 실행되지 않습니다", "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "분 · 윈도 내에서 계정별로 무작위 시각에 실행, 0 = 정시에 즉시 실행", "删除失败:{error}": "삭제 실패: {error}", "删除定时条目": "예약 항목 삭제", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "시간이 되면 선택한 제공자의 사용 가능한 계정으로 출석합니다(WorkBuddy 중국판은 일일 출석 API, 국제판은 데일리 액티브 작업: 액티비티 탐지·일일 보상 수령·무료 모델로 키프얼라이브와 웹 세션으로 연속일 점등. 라쿤은 데스크톱 일일 포인트 경로, AutoClaw는 공식 클라이언트의 일일 출석 작업, Qoder 중국판은 캠페인 수령이며 캠페인이 없는 계정에는 중립 안내를 표시, Qoder 국제판은 기기 리스크 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트 생성)이 필요하며 컴포넌트가 없으면 오류 대신 명확한 설명을 표시합니다. Trae는 SOLO의 일일 출석 크레딧(현지 0시 리셋)을 받고, 업스트림이 계정에 캠페인을 내려주지 않았거나 자격 증명에 기기 ID가 없으면 오류 대신 \"미수령 + 사유\"를 반환합니다. Loomy는 매일 최초 로그인 포인트를 한 번 호출하고, KukuAI는 \"무료 포인트\" 일일 작업을 받고, CodeArts는 당일 운영 혜택(수령 → 확인 → 재조회, 자동 실행은 하루 6회·10분 간격 쓰기 제한)을 받고, OfficeAce는 그날의 모든 보상(일일 출석 + 신규 혜택)을 한 번에 받습니다). \"랜덤 폭 N분\"을 설정하면 해당 회차의 계정은 각자의 윈도 내(당일 0:00-23:59로 클램프)에 분산 실행되어 같은 1분에 몰리지 않습니다. 윈도가 이미 지났다면 전부 즉시 실행합니다. 놓친 회차는 시작 후 보충되므로 전원이 꺼져 있었다고 해서 사라지지 않습니다(\"시작 시 보충\"을 끄면 윈도 시작까지 기다립니다). 각 제공자의 출석 API는 멱등이며 반복 실행해도 이중 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; CodeArts는 당일 운영 혜택을 수령합니다(수령 → 확인 → 재조회 검증, 자동 실행은 하루 6회 / 간격 10분의 쓰기 요청 제한이 적용됩니다); OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "정해진 시각이 되면 선택한 제공자의 사용 가능한 계정으로 자동 출석합니다 (WorkBuddy 중국판은 매일 출석 체크 인터페이스, 국제판은 일일 활성 작업으로 진행합니다: 이벤트 탐지, 일일 활성 보상 수령, 무료 모델로 키핑; 小浣熊은 데스크톱 앱 일일 포인트 경로를 사용하고; AutoClaw는 공식 클라이언트의 매일 출석 작업을 사용합니다; Qoder 중국판은 이벤트 수령으로 진행하며, 이벤트가 배정되지 않은 계정은 중립적인 안내를 받습니다; Qoder 국제판은 기기 리스크 관리 신원(로컬 Qoder 클라이언트 / qodercli의 UMID 컴포넌트로 생성)을 먼저 갖춰야 「매일 100 Credits」 이벤트가 보이며, 컴포넌트가 없으면 오류 대신 명확한 설명이 표시됩니다; Trae는 SOLO의 매일 출석 포인트를 수령하며(자연일 0시 기준 초기화), 업스트림이 해당 계정에 이벤트를 열지 않았거나 자격 증명에 기기 번호가 없으면 오류 대신 「미수령 + 구체적 사유」가 표시됩니다; Loomy는 매일 계정당 최초 로그인 포인트를 한 번 적립합니다; KukuAI는 「무료 포인트 받기」 일일 작업을 수령합니다; OfficeAce 는 그날의 보상을 한 번의 동작으로 일괄 수령합니다(매일 출석 + 신규 혜택)). 시각을 놓치면 부팅 후 자동으로 보충 출석하며, 당시 컴퓨터가 꺼져 있었다고 해서 빠지지 않습니다. 각 사의 출석 인터페이스는 멱등이므로 반복 실행해도 중복 수령되지 않습니다.", "到点时逐个签到,已勾 {n} / {total} 家": "정해진 시각에 하나씩 출석합니다. 선택 {n} / {total}개", "北京时间 · 错过时点开机后会自动补签": "베이징 시간 · 시간을 놓쳐도 시작 후 자동으로 보완됩니다", "去领取": "수령하러 가기", "另有 {n} 个账号不参与每日签到": "그 외 {n}개 계정은 매일 출석 체크에 참여하지 않습니다", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "완료된 작업의 보상만 수령(멱등, 반복 클릭해도 중복 적립되지 않음)", "可完成": "완료 가능", "可派出": "출발 가능", "可选 · 缺省显示时刻": "선택 · 기본값은 시간 표시", "可领奖": "수령 가능", "后端未返回定时签到数据": "백엔드가 예약 데이터를 반환하지 않았습니다", "后端未返回签到中心数据": "백엔드가 출석 체크 센터 데이터를 반환하지 않았습니다", "启动补签": "시작 시 보충", "启动补签已关闭": "시작 시 보충을 껐습니다", "启动补签已开启": "시작 시 보충을 켰습니다", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "국제판 출석에는 기기 리스크 관리 신원을 생성할 UMID 컴포넌트가 필요합니다 (이 기기에서 감지되지 않음).", "在途": "여행 중", "填入缺省链": "기본 체인 채우기", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "시각과 출석 범위를 정한 뒤 「저장」을 누르세요. 이름은 비워도 됩니다(비우면 시각이 표시됩니다)", "失败 {n}": "실패 {n}", "套餐明细": "플랜 상세", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Qoder 클라이언트 또는 qodercli를 설치하면 됩니다 (게이트웨이 재시작 불필요).", "安装中…": "설치 중…", "官方客户端的每日签到任务": "공식 클라이언트의 매일 출석 작업", "定时签到": "예약 출석", "定时签到已关闭": "예약 출석이 꺼졌습니다", "尚未查询": "아직 조회하지 않음", "尚未查询任务状态": "작업 상태를 아직 조회하지 않았습니다", "巡检一次": "한 번 점검", "已保存:{label}": "저장됨: {label}", "已保存:保活模型链": "저장됨: 키핑 모델 체인", "已保存:定时条目": "저장됨: 예약 항목", "已删除定时条目": "예약 항목이 삭제되었습니다", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "활동 보고 완료(연속 출석 점등), but 캠페인이 진행 중이 아닙니다(이번에 받을 보상 없음)", "已抽 {n} 次": "{n}회 추첨함", "已有结果 {checked} / 共 {total} 个账号": "결과 있음 {checked} / 전체 {total}개 계정", "已签": "출석 완료", "已领 {claimed}/{total} · 累计 {earned} 积分": "수령 {claimed}/{total} · 누적 {earned} 포인트", "已领养": "입양 완료", "已领取": "수령 완료", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "기기 리스크 관리 신원을 갖춰 「매일 100 Credits」 수령 · UMID 컴포넌트 필요", "开学季执行失败:{error}": "개학 시즌 실행 실패: {error}", "开学季执行完成:{message}": "개학 시즌 실행 완료: {message}", "开学季活动": "개학 시즌 이벤트", "开着:启用的条目按各自时刻执行": "켜짐: 활성화된 항목이 각자의 시간에 실행됩니다", "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "켜짐: 시작 직후 오늘 아직 실행하지 않은 스케줄을 랜덤 윈도를 무시하고 즉시 보충", "待签": "출석 대기", "待领新手福利": "수령 대기 입문 혜택", "总开关": "메인 스위치", "总开关已关闭 · 在「定时签到」页打开": "메인 스위치가 꺼져 있습니다 · \"예약 출석\" 탭에서 켜세요", "成功 {n}": "성공 {n}", "成长任务": "성장 과제", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "성장 과제 완료(성공 {done}개, 실패 {failed}개): 크레딧 +{credit} 에너지 +{energy}", "成长任务执行失败:{error}": "성장 과제 실행 실패: {error}", "执行失败:{error}": "실행 실패: {error}", "执行并抽奖": "실행 및 추첨", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "개학 시즌 작업을 실행하고 추첨 기회를 모두 사용(공유/대화/전문가 이벤트)", "把缺省链填进清单,再点「保存」生效": "기본 체인을 목록에 채웁니다. 「저장」을 눌러야 반영됩니다", "抽奖机会 {n} 次": "추첨 기회 {n}회", "按住拖动调整顺序": "길게 눌러 드래그해 순서 변경", "按住拖动,调整这个模型在链里的顺序": "길게 눌러 드래그해 체인에서 이 모델의 순서를 조정합니다", "按序逐个尝试,共 {n} 个": "순서대로 시도, 총 {n}개", "按结果筛选": "결과로 필터", "探测 + 领取 + 保活 · 与定时签到同一套组合": "탐지 + 수령 + 키핑 · 예약 출석과 동일한 조합", "探测活动并领取日活奖励 · 不做保活": "이벤트를 탐지해 일일 활성 보상을 수령 · 키핑은 하지 않음", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "수락 + 점등 + 수령(실측으로 검증된 작업만 처리)", "搜账号 / 收益 / 错误 / 触发原因": "계정 / 수익 / 오류 / 트리거 사유 검색", "收起新建": "새 항목 닫기", "新建定时条目": "새 예약 항목", "新手福利": "입문 혜택", "新手福利有 {n} 项领取失败,可重试": "입문 혜택 {n}건의 수령에 실패했습니다. 재시도할 수 있습니다", "无": "없음", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "전용 체크인 API 없음 · 하루에 한 번 계정 대신 로그인 정보 엔드포인트를 호출(그것이 당일 마립)", "无独立签到接口 · 每天替账号打一次首次登录积分": "독립 출석 인터페이스 없음 · 매일 계정당 최초 로그인 포인트를 한 번 적립", "无账号": "계정 없음", "暂不可领": "지금은 수령 불가", "暂不支持": "아직 미지원", "暂无启用的条目 · 点此添加": "활성화된 항목이 없습니다 · 클릭하여 추가", "有未保存的改动": "저장되지 않은 변경 사항이 있습니다", "未勾选提供商": "공급자 미선택", "未开启": "꺼짐", "未解锁": "잠김", "未领养(领养需先完成当日对话量)": "미입양(입양하려면 먼저 당일 대화량을 채워야 함)", "未领取": "미수령", "本地台账里今天还没领过;活动期内每天发一份新套餐": "로컬 기록상 오늘은 아직 받지 않았습니다. 이벤트 기간에는 매일 새 플랜이 한 건씩 지급됩니다", "本地台账里今天(北京时间)领过的套餐:{plans}": "로컬 기록상 오늘(베이징 시간) 받은 플랜: {plans}", "条启用": "개 활성화", "查询于 {time}": "조회 시각 {time}", "查询任务": "작업 조회", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "작업 트리를 조회하고 한 번에 점등/수령(개학 시즌과 고양이 여행 포함)", "查询失败:{error}": "조회 실패: {error}", "桌面端每日积分链路": "데스크톱 앱 일일 포인트 경로", "正在读取定时签到数据…": "예약 출석 데이터를 읽는 중…", "正在读取签到数据…": "출석 데이터를 읽는 중…", "每天 {time}": "매일 {time}", "每天 {time} · {scope}": "매일 {time} · {scope}", "每天 {time} · 随机前后 {n} 分钟 · {scope}": "매일 {time} ± {n}분 · {scope}", "每天时刻": "매일 시각", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "출석 실행마다 · 계정별 한 행 · 결과와 수익은 백엔드 기록 기준", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "매일 활성 작업 · 웹 채널 세션으로 일일 활성 달성, 포인트는 수령 시 적립 · 두 가지는 따로 실행 가능", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "일일 혜택 · 수령 → 확인 → 재조회 검증 · 베이징 시간 자연일 기준 초기화", "每日签到": "매일 출석 체크", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "항목별 시간과 범위 · 항목별 당일 중복 제거 · 시작 시 자동 보완", "每账号一条明细 · 点此查看「签到记录」": "계정별 한 행 · \"출석 기록\" 열기", "没有可领套餐的账号(ZCode 未添加)。": "수령할 플랜이 있는 계정이 없습니다 (ZCode 미추가).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "혜택을 수령할 수 있는 계정이 없습니다 (CodeArts / ZCode 미추가).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "성장 과제를 지원하는 계정이 없습니다(WorkBuddy 중국판 필요).", "没有支持新手福利的账号": "입문 혜택을 지원하는 계정이 없습니다", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "입문 혜택을 지원하는 계정이 없습니다 — 현재 Loomy, 小浣熊, CodeArts 세 곳입니다.", "没有符合筛选条件的签到记录": "필터 조건에 맞는 출석 기록이 없습니다", "没有需要执行的任务": "실행할 작업이 없습니다", "活动福利": "이벤트 혜택", "活动(campaign)领取 · 每天 10:00 刷新": "캠페인(campaign) 수령 · 매일 10:00 새로고침", "活跃上报与保活均未成功,且活动未开启": "활동 보고와 keep-alive 모두 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但保活未成功且活动未开启": "활동 보고는 완료되었지만 keep-alive에 실패했고 캠페인도 진행 중이 아닙니다", "活跃上报完成,但活动未开启": "활동 보고 완료, but 캠페인이 진행 중이 아닙니다", "活跃上报成功": "활동 보고 성공", "活跃保活失败": "활성 키핑 실패", "活跃保活完成": "활성 키핑 완료", "活跃保活完成,但活动未开启": "활성 키핑 완료, 다만 이벤트는 열리지 않았습니다", "活跃保活完成,但活跃上报失败且活动未开启": "keep-alive는 완료되었지만 활동 보고에 실패했고 캠페인도 진행 중이 아닙니다", "添加条目": "항목 추가", "添加模型": "모델 추가", "清单为空 —— 保存后恢复缺省链": "목록이 비어 있습니다 — 저장하면 기본 체인으로 복원됩니다", "清单里已经有「{name}」": "목록에 \"{name}\"이(가) 이미 있습니다", "清空失败:{error}": "비우기 실패: {error}", "清空签到记录": "출석 기록 비우기", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "\"플랜 상세\"에서 어떤 플랜을 받았고 언제 적용되는지 확인하세요. 이벤트 기간에는 매일 다시 받을 수 있습니다", "点击行展开账号明细 · 单账号签到不受范围限制": "행을 클릭해 계정 상세 펼치기 · 개별 계정 출석은 범위 제한을 받지 않습니다", "独立链路 · 只提供手动入口 · 不进自动签到": "독립 경로 · 수동 진입점만 제공 · 자동 출석에는 포함되지 않음", "猫猫旅行": "고양이 여행", "猫猫旅行失败:{error}": "고양이 여행 실패: {error}", "猫猫旅行失败:{message}": "고양이 여행 실패: {message}", "猫猫旅行:{message}": "고양이 여행: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "무료 모델과 웹 채널 세션으로 계정 활성 유지 · 보상은 수령하지 않음", "确定删除「{name}」?删除后到点不再执行。": "\"{name}\"을(를) 삭제할까요? 삭제 후 예약 시간에 실행되지 않습니다.", "确定清空全部签到记录?清空后无法恢复。": "모든 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "현재 필터된 출석 기록을 비울까요? 비운 후에는 복구할 수 없습니다.", "移除 {name}": "{name} 제거", "立即全部签到": "지금 전체 출석", "签到": "출석", "签到中…": "출석 중…", "签到中心分区": "출석 센터 구역", "签到失败:{error}": "출석 실패: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "출석 완료: {succeeded}/{total} 성공{active}, {failed}개 실패", "签到成功": "출석 성공", "签到提供商": "출석 제공자", "签到范围": "출석 범위", "签到触发时刻": "출석 실행 시각", "签到记录": "출석 기록", "签到记录时间范围": "출석 기록 시간 범위", "签到记录表": "출석 기록 표", "累计签到记录": "누적 출석 기록", "结算于 {time}": "결산 시각 {time}", "能量 {n}": "에너지 {n}", "腾讯每日签到接口 · 仅国内版": "텐센트 매일 출석 인터페이스 · 중국판 전용", "至少勾一家才能保存(不勾等于这条条目不签到)": "저장하려면 최소 한 곳을 선택하세요(선택하지 않으면 이 항목은 아무것도 출석하지 않습니다)", "读取定时签到数据失败:{error}": "예약 출석 데이터 로드 실패: {error}", "读取签到数据失败:{error}": "출석 데이터 읽기 실패: {error}", "读取签到记录失败:{error}": "출석 기록 로드 실패: {error}", "跳过 {n}": "건너뜀 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "운영 이벤트 전달 (수령 → 확인 → 재조회 검증) · 플랜 증정 포인트를 수령합니다", "还没执行过": "아직 실행된 적 없음", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "예약 항목이 아직 없습니다 — \"항목 추가\"로 만들거나 \"출석 센터\"에서 수동으로 출석하세요.", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "출석 기록이 아직 없습니다 — 수동 출석 또는 예약 실행 후 여기에 상세 내역이 표시됩니다.", "连登 {n} 天": "연속 로그인 {n}일", "部分": "일부", "重签": "재출석", "重试": "다시 시도", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "기간 한정 체험 플랜 · 수령 시 슬라이더 인증 필요 · 항목별로 확인하고 수령", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "기간 한정 체험 플랜(start-plan), 이벤트 기간 내 매일 1회 · 수령 시 슬라이더 캡차 필요", "随机前后": "랜덤 폭", "需真实操作": "실제 조작 필요", "非活动期": "이벤트 기간 아님", "项": "건", "领取": "수령", "领取中": "수령 중", "领取中…": "수령 중…", "领取失败": "수령 실패", "领取失败:{error}": "수령 실패: {error}", "(共 {n} 个账号)": "(전체 {n}개 계정)", "(能量 / 连登读数本次未取到)": "(에너지/연속 로그인 수치는 이번에 가져오지 못했습니다)", ",日活保活 {n} 个": ", 일일 활성 키핑 {n}개" }); diff --git a/desktop-tauri/ui/i18n/pt-BR/checkin.js b/desktop-tauri/ui/i18n/pt-BR/checkin.js index 5f7fff72..d1150f73 100644 --- a/desktop-tauri/ui/i18n/pt-BR/checkin.js +++ b/desktop-tauri/ui/i18n/pt-BR/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:pt-BR/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "Resgate de checkin_credits do SOLO · redefinido às 0h do dia natural", "UMID 组件安装失败:{error}": "Falha ao instalar o componente UMID: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Consulte a árvore de tarefas e acenda / resgate com um clique · inclui o evento de volta às aulas e a viagem do gato · clique na linha para detalhes", "WorkBuddy 国际版保活模型,按顺序回退": "Modelos do WorkBuddy internacional para manter ativo, com fallback em ordem", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Modelos gratuitos da atividade diária do WorkBuddy Internacional · uma configuração global, independente dos agendamentos", "{date}(每天 {time})": "{date} (todos os dias às {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} para concluir", "{n} 项待领": "{n} itens a resgatar", "{total} 账号 · {done} 已签": "{total} contas · {done} com check-in", "{total} 项任务 · {pending} 项可完成": "{total} tarefas · {pending} para concluir", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ Componente UMID instalado; no próximo check-in já dá para resgatar os pontos da edição internacional", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Check-in agendado ativado", "✅ 开学季任务执行完成": "✅ Tarefas de volta às aulas concluídas", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Tarefas de crescimento concluídas: créditos +{credit}, energia +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Benefícios iniciais resgatados, {n} pontos no total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in concluído: {succeeded}/{total} contas resgataram com sucesso{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; envie vazio para restaurar o padrão ({defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; limpar a lista e salvar restaura a cadeia padrão (padrão atual: {defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「免费领积分」的每日任务 · 逐个领取": "Tarefa diária do “Ganhe pontos grátis” · resgate um a um", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "Benefício único · consultado e resgatado automaticamente após o check-in; depois de resgatado, fica registrado localmente e o upstream não é mais consultado · clique na linha para expandir a lista de tarefas", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários) · idempotência garantida pelo upstream", "一键安装组件": "Instalar componente", "一键完成": "Concluir tudo", "一键领取({n})": "Resgatar todos ({n})", "上次执行:{line}": "Última execução: {line}", "上次签到时间": "Último check-in", "上次领取 {time} · 领取需通过滑块验证码": "Último resgate: {time} · o resgate exige captcha deslizante", "下次 {date}": "Próxima {date}", "下次 {date} · 点此管理条目": "Próxima {date} · clique para gerenciar os agendamentos", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo; o resgate diário/de planos dele e do ZCode fica em \"Benefícios de atividade\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo, e o benefício diário dele fica logo acima em \"Check-in diário\"; o resgate de planos do ZCode fica em \"Benefícios de atividade\".", "与国内版同一套任务接口 · 站点不同": "Mesma interface de tarefas da edição da China · site diferente", "与国内版同一套链路 · 站点不同、令牌不通用": "Mesmo fluxo da edição China · site diferente, tokens não intercambiáveis", "今天已领 {n} 份": "{n} resgatado(s) hoje", "今天未领": "Não resgatado hoje", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Resgatado hoje (horário de Pequim, {day}) · {n} itens confirmados oficialmente · amanhã é possível resgatar novamente", "今日已执行": "Executado hoje", "今日已派出": "Já enviado hoje", "今日已领取": "Resgatado hoje", "今日签到": "Check-in de hoje", "今日签到进度": "Progresso do check-in de hoje", "从清单里移除": "Remover da lista", "保活": "Manter ativo", "保活 {n}": "{n} mantidos ativos", "保活+领取": "Manter ativo + Resgatar", "保活中…": "Mantendo ativo…", "保活模型链": "Cadeia de modelos para manter ativo", "全选": "Selecionar tudo", "全部 {n} 家": "Todos os {n} provedores", "全部完成": "Tudo concluído", "全部查询": "Consultar todos", "全部结果": "Todos os resultados", "全部账号均可签到": "Todas as contas podem fazer check-in", "全部领取": "Resgatar todos", "关着:所有条目都不执行": "Desligado: nenhum agendamento é executado", "删除失败:{error}": "Falha ao excluir: {error}", "删除定时条目": "Excluir agendamento", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o CodeArts resgata o benefício de campanha do dia (resgatar → confirmar → reler para verificar; execuções automáticas têm limite de 6 gravações por dia com intervalo de 10 minutos); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点时逐个签到,已勾 {n} / {total} 家": "{n} de {total} marcados — o check-in é feito um por um no horário", "北京时间 · 错过时点开机后会自动补签": "Horário de Pequim · execuções perdidas são compensadas automaticamente ao iniciar", "去领取": "Resgatar", "另有 {n} 个账号不参与每日签到": "Outras {n} contas não participam do check-in diário", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Resgatar apenas recompensas de tarefas concluídas (idempotente; cliques repetidos não creditam em dobro)", "可完成": "Pode concluir", "可派出": "Pode enviar", "可选 · 缺省显示时刻": "Opcional · usa o horário como padrão", "可领奖": "Pode resgatar", "后端未返回定时签到数据": "O backend não retornou dados de agendamento", "后端未返回签到中心数据": "O backend não retornou os dados da central de check-in", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "O check-in da edição internacional exige o componente UMID para gerar a identidade de controle de risco do dispositivo (não detectado nesta máquina).", "在途": "Em viagem", "填入缺省链": "Preencher cadeia padrão", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Escolha o horário e os provedores e clique em Salvar; o nome é opcional (quando vazio, mostra-se o horário)", "失败 {n}": "{n} com falha", "套餐明细": "Detalhes dos planos", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Basta instalar o cliente Qoder ou o qodercli (não é preciso reiniciar o gateway).", "安装中…": "Instalando…", "官方客户端的每日签到任务": "Tarefa de check-in diário do cliente oficial", "定时签到": "Check-in agendado", "定时签到已关闭": "Check-in agendado desativado", "尚未查询": "Ainda não consultado", "尚未查询任务状态": "Status das tarefas ainda não consultado", "巡检一次": "Executar uma rodada", "已保存:{label}": "Salvo: {label}", "已保存:保活模型链": "Salvo: cadeia de modelos para manter ativo", "已保存:定时条目": "Salvo: agendamento", "已删除定时条目": "Agendamento excluído", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Atividade reportada (ofensiva acesa), mas a campanha não está ativa (nada para resgatar desta vez)", "已抽 {n} 次": "Sorteou {n} vezes", "已有结果 {checked} / 共 {total} 个账号": "Já com resultado: {checked} / {total} contas", "已签": "Com check-in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Resgatado {claimed}/{total} · {earned} pontos acumulados", "已领养": "Adotado", "已领取": "Resgatado", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Resgatar “100 Credits diários” com a identidade de controle de risco do dispositivo · requer o componente UMID", "开学季执行失败:{error}": "Falha na execução de volta às aulas: {error}", "开学季执行完成:{message}": "Execução de volta às aulas concluída: {message}", "开学季活动": "Evento de volta às aulas", "开着:启用的条目按各自时刻执行": "Ligado: agendamentos habilitados rodam em seus próprios horários", "待签": "Pendente", "待领新手福利": "Benefícios iniciais pendentes", "总开关": "Interruptor principal", "总开关已关闭 · 在「定时签到」页打开": "Interruptor principal desligado · ative na aba \"Check-in agendado\"", "成功 {n}": "{n} com sucesso", "成长任务": "Tarefas de crescimento", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Tarefas de crescimento concluídas ({done} com sucesso, {failed} com falha): créditos +{credit}, energia +{energy}", "成长任务执行失败:{error}": "Falha na execução das tarefas de crescimento: {error}", "执行失败:{error}": "Falha na execução: {error}", "执行并抽奖": "Executar e sortear", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Executar as tarefas de volta às aulas e gastar todas as chances de sorteio (compartilhar / conversar / eventos de especialista)", "把缺省链填进清单,再点「保存」生效": "Coloca a cadeia padrão na lista; clique em Salvar para aplicar", "抽奖机会 {n} 次": "{n} chances de sorteio", "按住拖动调整顺序": "Pressione e arraste para reordenar", "按住拖动,调整这个模型在链里的顺序": "Pressione e arraste para mudar a posição deste modelo na cadeia", "按序逐个尝试,共 {n} 个": "{n} modelos, tentados em ordem", "按结果筛选": "Filtrar por resultado", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detectar + resgatar + manter ativo · mesma combinação do check-in agendado", "探测活动并领取日活奖励 · 不做保活": "Detectar o evento e resgatar a recompensa de atividade diária · sem manter ativo", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Aceitar + acender + resgatar (apenas tarefas com receita verificada)", "搜账号 / 收益 / 错误 / 触发原因": "Pesquisar conta / ganho / erro / motivo do disparo", "收起新建": "Fechar novo item", "新建定时条目": "Nova entrada agendada", "新手福利": "Benefícios iniciais", "新手福利有 {n} 项领取失败,可重试": "{n} item(ns) dos benefícios iniciais falharam no resgate — é possível tentar novamente", "无": "Nenhum", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "Sem API de check-in dedicada · acessa o endpoint de informações de login uma vez por dia por conta (o que concede os Magicubes diários)", "无独立签到接口 · 每天替账号打一次首次登录积分": "Sem interface de check-in própria · credita uma vez por dia os pontos de primeiro login da conta", "无账号": "Sem contas", "暂不可领": "Indisponível", "暂不支持": "Ainda não suportado", "暂无启用的条目 · 点此添加": "Nenhum agendamento habilitado · clique para adicionar", "有未保存的改动": "Alterações não salvas", "未勾选提供商": "Nenhum provedor selecionado", "未开启": "Desativado", "未解锁": "Bloqueado", "未领养(领养需先完成当日对话量)": "Não adotado (a adoção exige cumprir a cota diária de conversas primeiro)", "未领取": "Não resgatado", "本地台账里今天还没领过;活动期内每天发一份新套餐": "O registro local ainda não tem resgate nenhum hoje; um novo plano é emitido todo dia durante o evento", "本地台账里今天(北京时间)领过的套餐:{plans}": "Planos resgatados hoje (horário de Pequim) conforme o registro local: {plans}", "条启用": "habilitado(s)", "查询于 {time}": "Consultado em {time}", "查询任务": "Consultar tarefas", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Consulte a árvore de tarefas e acenda / resgate com um clique (inclui volta às aulas e viagem do gato)", "查询失败:{error}": "Falha na consulta: {error}", "桌面端每日积分链路": "Fluxo diário de pontos do aplicativo desktop", "正在读取定时签到数据…": "Carregando dados de agendamento…", "正在读取签到数据…": "Lendo os dados de check-in…", "每天 {time}": "Todos os dias às {time}", "每天 {time} · {scope}": "Diário {time} · {scope}", "每天时刻": "Horário diário", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "Uma linha por conta a cada execução · resultados e ganhos conforme registrado pelo backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Tarefas de atividade diária · uma conversa no canal web acende a atividade diária, só o resgate adiciona pontos · os dois podem ser executados separadamente", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Benefício diário · resgatar → confirmar → reler para verificar · redefinido no dia natural (horário de Pequim)", "每日签到": "Check-in diário", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Cada agendamento tem horário e escopo próprios · deduplicação diária por item · execuções perdidas são compensadas ao iniciar", "每账号一条明细 · 点此查看「签到记录」": "Uma linha por conta · abra \"Registros de check-in\"", "没有可领套餐的账号(ZCode 未添加)。": "Nenhuma conta com planos resgatáveis (ZCode não adicionado).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "Nenhuma conta com benefícios para resgatar (CodeArts / ZCode não foram adicionados).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "Nenhuma conta suporta tarefas de crescimento (requer WorkBuddy CN).", "没有支持新手福利的账号": "Nenhuma conta suporta benefícios iniciais", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "Nenhuma conta suporta benefícios iniciais — atualmente Loomy, Raccoon e CodeArts.", "没有符合筛选条件的签到记录": "Nenhum registro de check-in corresponde aos filtros", "没有需要执行的任务": "Nada para executar", "活动福利": "Recompensas de evento", "活动(campaign)领取 · 每天 10:00 刷新": "Resgate de eventos (campaign) · atualizado todos os dias às 10:00", "活跃上报与保活均未成功,且活动未开启": "Tanto o relatório de atividade quanto o keep-alive falharam, e a campanha não está ativa", "活跃上报完成,但保活未成功且活动未开启": "Atividade reportada, mas o keep-alive falhou e a campanha não está ativa", "活跃上报完成,但活动未开启": "Atividade reportada, mas a campanha não está ativa", "活跃上报成功": "Atividade reportada com sucesso", "活跃保活失败": "Falha ao manter a atividade", "活跃保活完成": "Atividade mantida", "活跃保活完成,但活动未开启": "Atividade mantida, mas o evento não está aberto", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive concluído, mas o relatório de atividade falhou e a campanha não está ativa", "添加条目": "Adicionar agendamento", "添加模型": "Adicionar modelo", "清单为空 —— 保存后恢复缺省链": "A lista está vazia — salvar restaura a cadeia padrão", "清单里已经有「{name}」": "A lista já contém \"{name}\"", "清空失败:{error}": "Falha ao limpar: {error}", "清空签到记录": "Limpar registros de check-in", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Clique em \"Detalhes dos planos\" para ver quais você recebeu e quando entram em vigor; dá para resgatar de novo todo dia durante o evento", "点击行展开账号明细 · 单账号签到不受范围限制": "Clique na linha para expandir os detalhes das contas · o check-in individual não é limitado pelo escopo", "独立链路 · 只提供手动入口 · 不进自动签到": "Fluxo independente · apenas entrada manual · não participa do check-in automático", "猫猫旅行": "Viagem do gato", "猫猫旅行失败:{error}": "Falha na viagem do gato: {error}", "猫猫旅行失败:{message}": "Falha na viagem do gato: {message}", "猫猫旅行:{message}": "Viagem do gato: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Manter a conta ativa com modelos gratuitos e uma conversa no canal web · sem resgatar recompensas", "确定删除「{name}」?删除后到点不再执行。": "Excluir \"{name}\"? Ele não será mais executado no horário agendado.", "确定清空全部签到记录?清空后无法恢复。": "Limpar todos os registros de check-in? Isso não pode ser desfeito.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Limpar os registros de check-in filtrados? Isso não pode ser desfeito.", "移除 {name}": "Remover {name}", "立即全部签到": "Fazer check-in de todos agora", "签到": "Check-in", "签到中…": "Fazendo check-in…", "签到中心分区": "Seções do centro de check-in", "签到失败:{error}": "Falha no check-in: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in concluído: {succeeded}/{total} com sucesso{active}; {failed} com falha", "签到成功": "Check-in bem-sucedido", "签到提供商": "Provedores de check-in", "签到范围": "Escopo do check-in", "签到触发时刻": "Horário de disparo do check-in", "签到记录": "Registros de check-in", "签到记录时间范围": "Período dos registros de check-in", "签到记录表": "Tabela de registros de check-in", "累计签到记录": "Total de registros de check-in", "结算于 {time}": "Liquidado em {time}", "能量 {n}": "Energia {n}", "腾讯每日签到接口 · 仅国内版": "Interface de check-in diário da Tencent · apenas edição da China", "至少勾一家才能保存(不勾等于这条条目不签到)": "Selecione ao menos um provedor para salvar (sem seleção, esta entrada não faz check-in)", "读取定时签到数据失败:{error}": "Falha ao carregar dados de agendamento: {error}", "读取签到数据失败:{error}": "Falha ao ler os dados de check-in: {error}", "读取签到记录失败:{error}": "Falha ao carregar registros de check-in: {error}", "跳过 {n}": "{n} ignorados", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Entrega de eventos oficiais (resgatar → confirmar → reler para verificar) · resgate dos pontos de bônus do plano", "还没执行过": "Ainda não executado", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "Nenhum agendamento ainda — clique em \"Adicionar agendamento\" para criar um, ou faça check-in manualmente no \"Centro de check-in\".", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "Nenhum registro de check-in ainda — os detalhes aparecem aqui após um check-in manual ou uma execução agendada.", "连登 {n} 天": "Sequência de {n} dias", "部分": "Parcial", "重签": "Refazer check-in", "重试": "Tentar de novo", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Plano de teste por tempo limitado · o resgate exige CAPTCHA de arrastar · veja e resgate um a um", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Plano de teste por tempo limitado (start-plan), um por dia durante o evento · o resgate exige captcha deslizante", "需真实操作": "Requer ação real", "非活动期": "Evento inativo", "项": "itens", "领取": "Resgatar", "领取中": "Resgatando", "领取中…": "Resgatando…", "领取失败": "Falha no resgate", "领取失败:{error}": "Falha no resgate: {error}", "(共 {n} 个账号)": "({n} contas no total)", "(能量 / 连登读数本次未取到)": "(Leituras de energia / sequência indisponíveis desta vez)", ",日活保活 {n} 个": ", {n} mantidas ativas" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "Resgate de checkin_credits do SOLO · redefinido às 0h do dia natural", "UMID 组件安装失败:{error}": "Falha ao instalar o componente UMID: {error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy CN · Consulte a árvore de tarefas e acenda / resgate com um clique · inclui o evento de volta às aulas e a viagem do gato · clique na linha para detalhes", "WorkBuddy 国际版保活模型,按顺序回退": "Modelos do WorkBuddy internacional para manter ativo, com fallback em ordem", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "Modelos gratuitos da atividade diária do WorkBuddy Internacional · uma configuração global, independente dos agendamentos", "{date}(每天 {time})": "{date} (todos os dias às {time})", "{label} ×{count}({reason})": "{label} ×{count} ({reason})", "{n} 项可完成": "{n} para concluir", "{n} 项待领": "{n} itens a resgatar", "{total} 账号 · {done} 已签": "{total} contas · {done} com check-in", "{total} 项任务 · {pending} 项可完成": "{total} tarefas · {pending} para concluir", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ Componente UMID instalado; no próximo check-in já dá para resgatar os pontos da edição internacional", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ Check-in agendado ativado", "✅ 开学季任务执行完成": "✅ Tarefas de volta às aulas concluídas", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ Tarefas de crescimento concluídas: créditos +{credit}, energia +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ Benefícios iniciais resgatados, {n} pontos no total", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ Check-in concluído: {succeeded}/{total} contas resgataram com sucesso{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; envie vazio para restaurar o padrão ({defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "A \"cadeia de modelos de keep-alive\" são os modelos gratuitos usados para manter contas do WorkBuddy Internacional ativas na atividade diária — tentados em ordem, parando no primeiro sucesso; limpar a lista e salvar restaura a cadeia padrão (padrão atual: {defaults}). Deduplicação no dia + resgate idempotente: repetir a execução só retorna \"já resgatado\" e nunca pontua duas vezes.", "「免费领积分」的每日任务 · 逐个领取": "Tarefa diária do “Ganhe pontos grátis” · resgate um a um", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "Benefício único · consultado e resgatado automaticamente após o check-in; depois de resgatado, fica registrado localmente e o upstream não é mais consultado · clique na linha para expandir a lista de tarefas", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "Resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários) · idempotência garantida pelo upstream", "一键安装组件": "Instalar componente", "一键完成": "Concluir tudo", "一键领取({n})": "Resgatar todos ({n})", "上次执行:{line}": "Última execução: {line}", "上次签到时间": "Último check-in", "上次领取 {time} · 领取需通过滑块验证码": "Último resgate: {time} · o resgate exige captcha deslizante", "下次 {date}": "Próxima {date}", "下次 {date} · 点此管理条目": "Próxima {date} · clique para gerenciar os agendamentos", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo; o resgate diário/de planos dele e do ZCode fica em \"Benefícios de atividade\".", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "Fora do check-in diário: {list}. As recompensas únicas do CodeArts ficam em \"Benefícios iniciais\" abaixo, e o benefício diário dele fica logo acima em \"Check-in diário\"; o resgate de planos do ZCode fica em \"Benefícios de atividade\".", "与国内版同一套任务接口 · 站点不同": "Mesma interface de tarefas da edição da China · site diferente", "与国内版同一套链路 · 站点不同、令牌不通用": "Mesmo fluxo da edição China · site diferente, tokens não intercambiáveis", "今天已领 {n} 份": "{n} resgatado(s) hoje", "今天未领": "Não resgatado hoje", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "Resgatado hoje (horário de Pequim, {day}) · {n} itens confirmados oficialmente · amanhã é possível resgatar novamente", "今日已执行": "Executado hoje", "今日已派出": "Já enviado hoje", "今日已领取": "Resgatado hoje", "今日签到": "Check-in de hoje", "今日签到进度": "Progresso do check-in de hoje", "从清单里移除": "Remover da lista", "保活": "Manter ativo", "保活 {n}": "{n} mantidos ativos", "保活+领取": "Manter ativo + Resgatar", "保活中…": "Mantendo ativo…", "保活模型链": "Cadeia de modelos para manter ativo", "全选": "Selecionar tudo", "全部 {n} 家": "Todos os {n} provedores", "全部完成": "Tudo concluído", "全部查询": "Consultar todos", "全部结果": "Todos os resultados", "全部账号均可签到": "Todas as contas podem fazer check-in", "全部领取": "Resgatar todos", "关着:开机后等到窗口起点再签,随机窗口当天生效": "Desligado: após iniciar, esperar o início da janela para que a janela aleatória valha hoje", "关着:所有条目都不执行": "Desligado: nenhum agendamento é executado", "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "minutos · contas executam em momentos aleatórios dentro da janela; 0 = executar imediatamente no horário", "删除失败:{error}": "Falha ao excluir: {error}", "删除定时条目": "Excluir agendamento", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "Faz check-in nas contas disponíveis dos provedores marcados quando chega a hora (WorkBuddy CN usa a API de check-in diário; WorkBuddy Intl usa a tarefa de atividade diária: sondar atividades, resgatar a recompensa diária, manter um modelo gratuito ativo e abrir uma sessão web para acender a sequência; Raccoon usa a cadeia diária de pontos do desktop; AutoClaw usa a tarefa diária de sign-in do cliente oficial; Qoder CN resgata campanhas e mostra um aviso neutro para contas sem campanha; Qoder Intl precisa de uma identidade de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para ver a campanha de '100 Credits diários' e mostra uma explicação clara em vez de erro quando o componente falta; Trae resgata os créditos de check-in diário do SOLO (reset à meia-noite local) e informa 'não resgatado + motivo' em vez de erro quando o upstream não tem campanha para a conta ou a credencial não tem device id; Loomy chama o endpoint de pontos do primeiro login uma vez por dia; KukuAI resgata as tarefas diárias de 'pontos grátis'; CodeArts resgata o benefício diário de operações (resgatar → confirmar → reler, com execuções automáticas limitadas a 6 escritas por dia e 10 minutos de intervalo; OfficeAce resgata todas as recompensas do dia (check-in diário + presente de novato) em uma chamada). Com 'margem aleatória de N minutos', as contas de uma rodada executam espalhadas dentro da própria janela (limitada a 0:00-23:59 do mesmo dia) em vez de todas no mesmo minuto; se a janela já passou, todas executam imediatamente. Execuções perdidas são recuperadas após iniciar, então nada se perde quando a máquina estava desligada (desligue 'Recuperação na inicialização' para esperar o início da janela). A API de check-in de cada provedor é idempotente, então execuções repetidas nunca resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o CodeArts resgata o benefício de campanha do dia (resgatar → confirmar → reler para verificar; execuções automáticas têm limite de 6 gravações por dia com intervalo de 10 minutos); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "No horário definido, o check-in automático é feito nas contas disponíveis dos provedores marcados (o WorkBuddy edição da China usa a interface de check-in diário; a edição internacional usa as tarefas de atividade diária: detectar o evento, resgatar a recompensa de atividade diária e então manter a conta ativa com modelos gratuitos; o Raccoon usa o fluxo diário de pontos do aplicativo desktop; o AutoClaw usa a tarefa de check-in diário do cliente oficial; o Qoder China usa o resgate de evento, e contas sem evento distribuído recebem um aviso neutro; o Qoder internacional precisa primeiro da identidade de controle de risco do dispositivo (gerada pelo componente UMID do cliente Qoder / qodercli local) para enxergar o evento “100 Credits diários”, e sem o componente recebe uma explicação clara em vez de um erro; o Trae resgata os pontos de check-in diário do SOLO (redefinidos às 0h do dia natural), e quando o upstream não abriu o evento para a conta ou a credencial não tem o ID do dispositivo, o resultado é “não resgatado + motivo específico” em vez de um erro; o Loomy credita uma vez por dia os pontos de primeiro login da conta; o KukuAI resgata a tarefa diária do “Ganhe pontos grátis”); o OfficeAce resgata todas as recompensas do dia em uma única ação (check-in diário + presente de novos usuários)). Se o horário for perdido, o check-in é compensado automaticamente após o computador ser ligado, sem que nada se perca por o computador estar desligado no horário. As interfaces de check-in de cada provedor são idempotentes; execuções repetidas não resgatam duas vezes.", "到点时逐个签到,已勾 {n} / {total} 家": "{n} de {total} marcados — o check-in é feito um por um no horário", "北京时间 · 错过时点开机后会自动补签": "Horário de Pequim · execuções perdidas são compensadas automaticamente ao iniciar", "去领取": "Resgatar", "另有 {n} 个账号不参与每日签到": "Outras {n} contas não participam do check-in diário", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "Resgatar apenas recompensas de tarefas concluídas (idempotente; cliques repetidos não creditam em dobro)", "可完成": "Pode concluir", "可派出": "Pode enviar", "可选 · 缺省显示时刻": "Opcional · usa o horário como padrão", "可领奖": "Pode resgatar", "后端未返回定时签到数据": "O backend não retornou dados de agendamento", "后端未返回签到中心数据": "O backend não retornou os dados da central de check-in", "启动补签": "Recuperação na inicialização", "启动补签已关闭": "Recuperação na inicialização desativada", "启动补签已开启": "Recuperação na inicialização ativada", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "O check-in da edição internacional exige o componente UMID para gerar a identidade de controle de risco do dispositivo (não detectado nesta máquina).", "在途": "Em viagem", "填入缺省链": "Preencher cadeia padrão", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "Escolha o horário e os provedores e clique em Salvar; o nome é opcional (quando vazio, mostra-se o horário)", "失败 {n}": "{n} com falha", "套餐明细": "Detalhes dos planos", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "Basta instalar o cliente Qoder ou o qodercli (não é preciso reiniciar o gateway).", "安装中…": "Instalando…", "官方客户端的每日签到任务": "Tarefa de check-in diário do cliente oficial", "定时签到": "Check-in agendado", "定时签到已关闭": "Check-in agendado desativado", "尚未查询": "Ainda não consultado", "尚未查询任务状态": "Status das tarefas ainda não consultado", "巡检一次": "Executar uma rodada", "已保存:{label}": "Salvo: {label}", "已保存:保活模型链": "Salvo: cadeia de modelos para manter ativo", "已保存:定时条目": "Salvo: agendamento", "已删除定时条目": "Agendamento excluído", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "Atividade reportada (ofensiva acesa), mas a campanha não está ativa (nada para resgatar desta vez)", "已抽 {n} 次": "Sorteou {n} vezes", "已有结果 {checked} / 共 {total} 个账号": "Já com resultado: {checked} / {total} contas", "已签": "Com check-in", "已领 {claimed}/{total} · 累计 {earned} 积分": "Resgatado {claimed}/{total} · {earned} pontos acumulados", "已领养": "Adotado", "已领取": "Resgatado", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "Resgatar “100 Credits diários” com a identidade de controle de risco do dispositivo · requer o componente UMID", "开学季执行失败:{error}": "Falha na execução de volta às aulas: {error}", "开学季执行完成:{message}": "Execução de volta às aulas concluída: {message}", "开学季活动": "Evento de volta às aulas", "开着:启用的条目按各自时刻执行": "Ligado: agendamentos habilitados rodam em seus próprios horários", "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "Ligado: agendamentos ainda não executados hoje são recuperados logo após iniciar, ignorando a janela aleatória", "待签": "Pendente", "待领新手福利": "Benefícios iniciais pendentes", "总开关": "Interruptor principal", "总开关已关闭 · 在「定时签到」页打开": "Interruptor principal desligado · ative na aba \"Check-in agendado\"", "成功 {n}": "{n} com sucesso", "成长任务": "Tarefas de crescimento", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "Tarefas de crescimento concluídas ({done} com sucesso, {failed} com falha): créditos +{credit}, energia +{energy}", "成长任务执行失败:{error}": "Falha na execução das tarefas de crescimento: {error}", "执行失败:{error}": "Falha na execução: {error}", "执行并抽奖": "Executar e sortear", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "Executar as tarefas de volta às aulas e gastar todas as chances de sorteio (compartilhar / conversar / eventos de especialista)", "把缺省链填进清单,再点「保存」生效": "Coloca a cadeia padrão na lista; clique em Salvar para aplicar", "抽奖机会 {n} 次": "{n} chances de sorteio", "按住拖动调整顺序": "Pressione e arraste para reordenar", "按住拖动,调整这个模型在链里的顺序": "Pressione e arraste para mudar a posição deste modelo na cadeia", "按序逐个尝试,共 {n} 个": "{n} modelos, tentados em ordem", "按结果筛选": "Filtrar por resultado", "探测 + 领取 + 保活 · 与定时签到同一套组合": "Detectar + resgatar + manter ativo · mesma combinação do check-in agendado", "探测活动并领取日活奖励 · 不做保活": "Detectar o evento e resgatar a recompensa de atividade diária · sem manter ativo", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "Aceitar + acender + resgatar (apenas tarefas com receita verificada)", "搜账号 / 收益 / 错误 / 触发原因": "Pesquisar conta / ganho / erro / motivo do disparo", "收起新建": "Fechar novo item", "新建定时条目": "Nova entrada agendada", "新手福利": "Benefícios iniciais", "新手福利有 {n} 项领取失败,可重试": "{n} item(ns) dos benefícios iniciais falharam no resgate — é possível tentar novamente", "无": "Nenhum", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "Sem API de check-in dedicada · acessa o endpoint de informações de login uma vez por dia por conta (o que concede os Magicubes diários)", "无独立签到接口 · 每天替账号打一次首次登录积分": "Sem interface de check-in própria · credita uma vez por dia os pontos de primeiro login da conta", "无账号": "Sem contas", "暂不可领": "Indisponível", "暂不支持": "Ainda não suportado", "暂无启用的条目 · 点此添加": "Nenhum agendamento habilitado · clique para adicionar", "有未保存的改动": "Alterações não salvas", "未勾选提供商": "Nenhum provedor selecionado", "未开启": "Desativado", "未解锁": "Bloqueado", "未领养(领养需先完成当日对话量)": "Não adotado (a adoção exige cumprir a cota diária de conversas primeiro)", "未领取": "Não resgatado", "本地台账里今天还没领过;活动期内每天发一份新套餐": "O registro local ainda não tem resgate nenhum hoje; um novo plano é emitido todo dia durante o evento", "本地台账里今天(北京时间)领过的套餐:{plans}": "Planos resgatados hoje (horário de Pequim) conforme o registro local: {plans}", "条启用": "habilitado(s)", "查询于 {time}": "Consultado em {time}", "查询任务": "Consultar tarefas", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "Consulte a árvore de tarefas e acenda / resgate com um clique (inclui volta às aulas e viagem do gato)", "查询失败:{error}": "Falha na consulta: {error}", "桌面端每日积分链路": "Fluxo diário de pontos do aplicativo desktop", "正在读取定时签到数据…": "Carregando dados de agendamento…", "正在读取签到数据…": "Lendo os dados de check-in…", "每天 {time}": "Todos os dias às {time}", "每天 {time} · {scope}": "Diário {time} · {scope}", "每天 {time} · 随机前后 {n} 分钟 · {scope}": "Diariamente {time} ± {n} min · {scope}", "每天时刻": "Horário diário", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "Uma linha por conta a cada execução · resultados e ganhos conforme registrado pelo backend", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "Tarefas de atividade diária · uma conversa no canal web acende a atividade diária, só o resgate adiciona pontos · os dois podem ser executados separadamente", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "Benefício diário · resgatar → confirmar → reler para verificar · redefinido no dia natural (horário de Pequim)", "每日签到": "Check-in diário", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "Cada agendamento tem horário e escopo próprios · deduplicação diária por item · execuções perdidas são compensadas ao iniciar", "每账号一条明细 · 点此查看「签到记录」": "Uma linha por conta · abra \"Registros de check-in\"", "没有可领套餐的账号(ZCode 未添加)。": "Nenhuma conta com planos resgatáveis (ZCode não adicionado).", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "Nenhuma conta com benefícios para resgatar (CodeArts / ZCode não foram adicionados).", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "Nenhuma conta suporta tarefas de crescimento (requer WorkBuddy CN).", "没有支持新手福利的账号": "Nenhuma conta suporta benefícios iniciais", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "Nenhuma conta suporta benefícios iniciais — atualmente Loomy, Raccoon e CodeArts.", "没有符合筛选条件的签到记录": "Nenhum registro de check-in corresponde aos filtros", "没有需要执行的任务": "Nada para executar", "活动福利": "Recompensas de evento", "活动(campaign)领取 · 每天 10:00 刷新": "Resgate de eventos (campaign) · atualizado todos os dias às 10:00", "活跃上报与保活均未成功,且活动未开启": "Tanto o relatório de atividade quanto o keep-alive falharam, e a campanha não está ativa", "活跃上报完成,但保活未成功且活动未开启": "Atividade reportada, mas o keep-alive falhou e a campanha não está ativa", "活跃上报完成,但活动未开启": "Atividade reportada, mas a campanha não está ativa", "活跃上报成功": "Atividade reportada com sucesso", "活跃保活失败": "Falha ao manter a atividade", "活跃保活完成": "Atividade mantida", "活跃保活完成,但活动未开启": "Atividade mantida, mas o evento não está aberto", "活跃保活完成,但活跃上报失败且活动未开启": "Keep-alive concluído, mas o relatório de atividade falhou e a campanha não está ativa", "添加条目": "Adicionar agendamento", "添加模型": "Adicionar modelo", "清单为空 —— 保存后恢复缺省链": "A lista está vazia — salvar restaura a cadeia padrão", "清单里已经有「{name}」": "A lista já contém \"{name}\"", "清空失败:{error}": "Falha ao limpar: {error}", "清空签到记录": "Limpar registros de check-in", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "Clique em \"Detalhes dos planos\" para ver quais você recebeu e quando entram em vigor; dá para resgatar de novo todo dia durante o evento", "点击行展开账号明细 · 单账号签到不受范围限制": "Clique na linha para expandir os detalhes das contas · o check-in individual não é limitado pelo escopo", "独立链路 · 只提供手动入口 · 不进自动签到": "Fluxo independente · apenas entrada manual · não participa do check-in automático", "猫猫旅行": "Viagem do gato", "猫猫旅行失败:{error}": "Falha na viagem do gato: {error}", "猫猫旅行失败:{message}": "Falha na viagem do gato: {message}", "猫猫旅行:{message}": "Viagem do gato: {message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "Manter a conta ativa com modelos gratuitos e uma conversa no canal web · sem resgatar recompensas", "确定删除「{name}」?删除后到点不再执行。": "Excluir \"{name}\"? Ele não será mais executado no horário agendado.", "确定清空全部签到记录?清空后无法恢复。": "Limpar todos os registros de check-in? Isso não pode ser desfeito.", "确定清空当前筛选出的签到记录?清空后无法恢复。": "Limpar os registros de check-in filtrados? Isso não pode ser desfeito.", "移除 {name}": "Remover {name}", "立即全部签到": "Fazer check-in de todos agora", "签到": "Check-in", "签到中…": "Fazendo check-in…", "签到中心分区": "Seções do centro de check-in", "签到失败:{error}": "Falha no check-in: {error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "Check-in concluído: {succeeded}/{total} com sucesso{active}; {failed} com falha", "签到成功": "Check-in bem-sucedido", "签到提供商": "Provedores de check-in", "签到范围": "Escopo do check-in", "签到触发时刻": "Horário de disparo do check-in", "签到记录": "Registros de check-in", "签到记录时间范围": "Período dos registros de check-in", "签到记录表": "Tabela de registros de check-in", "累计签到记录": "Total de registros de check-in", "结算于 {time}": "Liquidado em {time}", "能量 {n}": "Energia {n}", "腾讯每日签到接口 · 仅国内版": "Interface de check-in diário da Tencent · apenas edição da China", "至少勾一家才能保存(不勾等于这条条目不签到)": "Selecione ao menos um provedor para salvar (sem seleção, esta entrada não faz check-in)", "读取定时签到数据失败:{error}": "Falha ao carregar dados de agendamento: {error}", "读取签到数据失败:{error}": "Falha ao ler os dados de check-in: {error}", "读取签到记录失败:{error}": "Falha ao carregar registros de check-in: {error}", "跳过 {n}": "{n} ignorados", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "Entrega de eventos oficiais (resgatar → confirmar → reler para verificar) · resgate dos pontos de bônus do plano", "还没执行过": "Ainda não executado", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "Nenhum agendamento ainda — clique em \"Adicionar agendamento\" para criar um, ou faça check-in manualmente no \"Centro de check-in\".", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "Nenhum registro de check-in ainda — os detalhes aparecem aqui após um check-in manual ou uma execução agendada.", "连登 {n} 天": "Sequência de {n} dias", "部分": "Parcial", "重签": "Refazer check-in", "重试": "Tentar de novo", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "Plano de teste por tempo limitado · o resgate exige CAPTCHA de arrastar · veja e resgate um a um", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "Plano de teste por tempo limitado (start-plan), um por dia durante o evento · o resgate exige captcha deslizante", "随机前后": "Margem aleatória", "需真实操作": "Requer ação real", "非活动期": "Evento inativo", "项": "itens", "领取": "Resgatar", "领取中": "Resgatando", "领取中…": "Resgatando…", "领取失败": "Falha no resgate", "领取失败:{error}": "Falha no resgate: {error}", "(共 {n} 个账号)": "({n} contas no total)", "(能量 / 连登读数本次未取到)": "(Leituras de energia / sequência indisponíveis desta vez)", ",日活保活 {n} 个": ", {n} mantidas ativas" }); diff --git a/desktop-tauri/ui/i18n/zh-Hant/checkin.js b/desktop-tauri/ui/i18n/zh-Hant/checkin.js index 6c685912..44f612c2 100644 --- a/desktop-tauri/ui/i18n/zh-Hant/checkin.js +++ b/desktop-tauri/ui/i18n/zh-Hant/checkin.js @@ -1,2 +1,2 @@ /* Agent2API 词典构建产物:zh-Hant/checkin —— 由 desktop-tauri/i18n/build.mjs 生成,请勿手改;源头是 i18n-src/*.json */ -window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO 的 checkin_credits 領取 · 按自然日 0 點重新整理", "UMID 组件安装失败:{error}": "UMID 元件安裝失敗:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 國內版 · 查詢任務樹後一鍵點亮/領獎 · 含開學季與貓貓旅行 · 點擊行展開明細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 國際版保活模型,按順序回退", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 國際版日活任務的免費模型 · 全域一份,與條目無關", "{date}(每天 {time})": "{date}(每天 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n} 項可完成", "{n} 项待领": "{n} 項待領", "{total} 账号 · {done} 已签": "{total} 帳號 · {done} 已籤", "{total} 项任务 · {pending} 项可完成": "{total} 項任務 · {pending} 項可完成", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 元件已安裝,下輪簽到即可領取國際版積分", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定時簽到已開啟", "✅ 开学季任务执行完成": "✅ 開學季任務執行完成", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長任務執行完成:積分 +{credit} 能量 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 新手福利領取完成,累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 簽到完成:{succeeded}/{total} 個帳號成功領取{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空提交恢復預設({defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空清單並儲存 = 恢復預設鏈(當前預設:{defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「免费领积分」的每日任务 · 逐个领取": "「免費領積分」的每日任務 · 逐個領取", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一次性福利 · 簽到後自動查詢並領取,領完記在本機不再查上游 · 點擊行展開任務清單", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "一次領當天全部獎勵(每日簽到 + 新人禮) · 冪等由上游保證", "一键安装组件": "一鍵安裝元件", "一键完成": "一鍵完成", "一键领取({n})": "一鍵領取({n})", "上次执行:{line}": "上次執行:{line}", "上次签到时间": "上次簽到時間", "上次领取 {time} · 领取需通过滑块验证码": "上次領取 {time} · 領取需通過滑塊驗證碼", "下次 {date}": "下次 {date}", "下次 {date} · 点此管理条目": "下次 {date} · 點此管理條目", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它與 ZCode 的每日/套餐福利領取見「活動福利」。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它的每日福利就在上方「每日簽到」裡;ZCode 的套餐領取見「活動福利」。", "与国内版同一套任务接口 · 站点不同": "與國內版同一套任務介面 · 站點不同", "与国内版同一套链路 · 站点不同、令牌不通用": "與國內版同一套鏈路 · 站點不同、權杖不通用", "今天已领 {n} 份": "今天已領 {n} 份", "今天未领": "今天未領", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "今天(北京時間 {day})已領取 · 官方確認到賬 {n} 項 · 明天可再領", "今日已执行": "今日已執行", "今日已派出": "今日已派出", "今日已领取": "今日已領取", "今日签到": "今日簽到", "今日签到进度": "今日簽到進度", "从清单里移除": "從清單裡移除", "保活": "保活", "保活 {n}": "保活 {n}", "保活+领取": "保活+領取", "保活中…": "保活中…", "保活模型链": "保活模型鏈", "全选": "全選", "全部 {n} 家": "全部 {n} 家", "全部完成": "全部完成", "全部查询": "全部查詢", "全部结果": "全部結果", "全部账号均可签到": "全部帳號均可簽到", "全部领取": "全部領取", "关着:所有条目都不执行": "關著:所有條目都不執行", "删除失败:{error}": "刪除失敗:{error}", "删除定时条目": "刪除定時條目", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活並在網頁通道建會話點亮日活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点时逐个签到,已勾 {n} / {total} 家": "到點時逐個簽到,已勾 {n} / {total} 家", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 錯過時點開機後會自動補籤", "去领取": "去領取", "另有 {n} 个账号不参与每日签到": "另有 {n} 個帳號不參與每日簽到", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "只領取已完成任務的獎勵(冪等,重複點不會重複入帳)", "可完成": "可完成", "可派出": "可派出", "可选 · 缺省显示时刻": "可選 · 預設顯示時刻", "可领奖": "可領獎", "后端未返回定时签到数据": "後端未返回定時簽到資料", "后端未返回签到中心数据": "後端未返回簽到中心資料", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "國際版簽到需要 UMID 元件生成裝置風控身份(本機未檢測到)。", "在途": "在途", "填入缺省链": "填入預設鏈", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "填好時刻與簽到範圍後點「儲存」;名稱可以留空(介面顯示時刻)", "失败 {n}": "失敗 {n}", "套餐明细": "套餐明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "安裝 Qoder 客戶端或 qodercli 後即可(無需重啟閘道器)。", "安装中…": "安裝中…", "官方客户端的每日签到任务": "官方客戶端的每日簽到任務", "定时签到": "定時簽到", "定时签到已关闭": "定時簽到已關閉", "尚未查询": "尚未查詢", "尚未查询任务状态": "尚未查詢任務狀態", "巡检一次": "巡檢一次", "已保存:{label}": "已儲存:{label}", "已保存:保活模型链": "已儲存:保活模型鏈", "已保存:定时条目": "已儲存:定時條目", "已删除定时条目": "已刪除定時條目", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "已完成活躍上報(連登已點亮),但活動未開啟(本次沒有可領的獎勵)", "已抽 {n} 次": "已抽 {n} 次", "已有结果 {checked} / 共 {total} 个账号": "已有結果 {checked} / 共 {total} 個帳號", "已签": "已籤", "已领 {claimed}/{total} · 累计 {earned} 积分": "已領 {claimed}/{total} · 累計 {earned} 積分", "已领养": "已領養", "已领取": "已領取", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "帶裝置風控身份領取「每日 100 Credits」 · 需要 UMID 元件", "开学季执行失败:{error}": "開學季執行失敗:{error}", "开学季执行完成:{message}": "開學季執行完成:{message}", "开学季活动": "開學季活動", "开着:启用的条目按各自时刻执行": "開著:啟用的條目按各自時刻執行", "待签": "待籤", "待领新手福利": "待領新手福利", "总开关": "總開關", "总开关已关闭 · 在「定时签到」页打开": "總開關已關閉 · 在「定時簽到」頁開啟", "成功 {n}": "成功 {n}", "成长任务": "成長任務", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長任務完成({done} 項成功、{failed} 項失敗),積分 +{credit} 能量 +{energy}", "成长任务执行失败:{error}": "成長任務執行失敗:{error}", "执行失败:{error}": "執行失敗:{error}", "执行并抽奖": "執行並抽獎", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "執行開學季任務並抽空抽獎機會(分享/對話/專家事件)", "把缺省链填进清单,再点「保存」生效": "把預設鏈填進清單,再點「儲存」生效", "抽奖机会 {n} 次": "抽獎機會 {n} 次", "按住拖动调整顺序": "按住拖動調整順序", "按住拖动,调整这个模型在链里的顺序": "按住拖動,調整這個模型在鏈裡的順序", "按序逐个尝试,共 {n} 个": "按序逐個嘗試,共 {n} 個", "按结果筛选": "按結果篩選", "探测 + 领取 + 保活 · 与定时签到同一套组合": "探測 + 領取 + 保活 · 與定時簽到同一套組合", "探测活动并领取日活奖励 · 不做保活": "探測活動並領取日活獎勵 · 不做保活", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "接單+點亮+領獎(只處理已實測沉澱的任務)", "搜账号 / 收益 / 错误 / 触发原因": "搜帳號 / 收益 / 錯誤 / 觸發原因", "收起新建": "收起新建", "新建定时条目": "新建定時條目", "新手福利": "新手福利", "新手福利有 {n} 项领取失败,可重试": "新手福利有 {n} 項領取失敗,可重試", "无": "無", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "無獨立簽到介面 · 每天替帳號打一次登入資訊(即當日魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "無獨立簽到介面 · 每天替帳號打一次首次登入積分", "无账号": "無帳號", "暂不可领": "暫不可領", "暂不支持": "暫不支援", "暂无启用的条目 · 点此添加": "暫無啟用的條目 · 點此新增", "有未保存的改动": "有未儲存的改動", "未勾选提供商": "未勾選提供商", "未开启": "未開啟", "未解锁": "未解鎖", "未领养(领养需先完成当日对话量)": "未領養(領養需先完成當日對話量)", "未领取": "未領取", "本地台账里今天还没领过;活动期内每天发一份新套餐": "本地臺賬裡今天還沒領過;活動期內每天發一份新套餐", "本地台账里今天(北京时间)领过的套餐:{plans}": "本地臺賬裡今天(北京時間)領過的套餐:{plans}", "条启用": "條啟用", "查询于 {time}": "查詢於 {time}", "查询任务": "查詢任務", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "查詢任務樹並一鍵點亮/領獎(含開學季與貓貓旅行)", "查询失败:{error}": "查詢失敗:{error}", "桌面端每日积分链路": "桌面版每日積分鏈路", "正在读取定时签到数据…": "正在讀取定時簽到資料…", "正在读取签到数据…": "正在讀取簽到資料…", "每天 {time}": "每天 {time}", "每天 {time} · {scope}": "每天 {time} · {scope}", "每天时刻": "每天時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "每執行一次簽到 · 每個帳號一條明細 · 結果與收益以後端落賬為準", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "每日活躍任務 · 網頁會話保活點亮日活,領取才加積分 · 兩者可分開執行", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "每日福利 · 領取 → 確認 → 回讀核實 · 按北京時間自然日重置", "每日签到": "每日簽到", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "每條條目各有時刻與範圍 · 各自當天去重 · 錯過時點開機自動補籤", "每账号一条明细 · 点此查看「签到记录」": "每帳號一條明細 · 點此檢視「簽到記錄」", "没有可领套餐的账号(ZCode 未添加)。": "沒有可領套餐的帳號(ZCode 未新增)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "沒有可領福利的帳號(CodeArts / ZCode 未新增)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "沒有支援成長任務的帳號(需要 WorkBuddy 國內版)。", "没有支持新手福利的账号": "沒有支援新手福利的帳號", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "沒有支援新手福利的帳號 —— 目前有 Loomy、小浣熊、CodeArts 三家。", "没有符合筛选条件的签到记录": "沒有符合篩選條件的簽到記錄", "没有需要执行的任务": "沒有需要執行的任務", "活动福利": "活動福利", "活动(campaign)领取 · 每天 10:00 刷新": "活動(campaign)領取 · 每天 10:00 重新整理", "活跃上报与保活均未成功,且活动未开启": "活躍上報與保活均未成功,且活動未開啟", "活跃上报完成,但保活未成功且活动未开启": "活躍上報完成,但保活未成功且活動未開啟", "活跃上报完成,但活动未开启": "活躍上報完成,但活動未開啟", "活跃上报成功": "活躍上報成功", "活跃保活失败": "活躍保活失敗", "活跃保活完成": "活躍保活完成", "活跃保活完成,但活动未开启": "活躍保活完成,但活動未開啟", "活跃保活完成,但活跃上报失败且活动未开启": "活躍保活完成,但活躍上報失敗且活動未開啟", "添加条目": "新增條目", "添加模型": "新增模型", "清单为空 —— 保存后恢复缺省链": "清單為空 —— 儲存後恢復預設鏈", "清单里已经有「{name}」": "清單裡已經有「{name}」", "清空失败:{error}": "清空失敗:{error}", "清空签到记录": "清空簽到記錄", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "點「套餐明細」看領到了哪幾份、什麼時候生效;活動期內每天可再領", "点击行展开账号明细 · 单账号签到不受范围限制": "點擊行展開帳號明細 · 單帳號簽到不受範圍限制", "独立链路 · 只提供手动入口 · 不进自动签到": "獨立鏈路 · 只提供手動入口 · 不進自動簽到", "猫猫旅行": "貓貓旅行", "猫猫旅行失败:{error}": "貓貓旅行失敗:{error}", "猫猫旅行失败:{message}": "貓貓旅行失敗:{message}", "猫猫旅行:{message}": "貓貓旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "用免費模型與網頁會話維持帳號活躍 · 不領取獎勵", "确定删除「{name}」?删除后到点不再执行。": "確定刪除「{name}」?刪除後到點不再執行。", "确定清空全部签到记录?清空后无法恢复。": "確定清空全部簽到記錄?清空後無法恢復。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "確定清空當前篩選出的簽到記錄?清空後無法恢復。", "移除 {name}": "移除 {name}", "立即全部签到": "立即全部簽到", "签到": "簽到", "签到中…": "簽到中…", "签到中心分区": "簽到中心分割槽", "签到失败:{error}": "簽到失敗:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "簽到完成:{succeeded}/{total} 成功{active},{failed} 個失敗", "签到成功": "簽到成功", "签到提供商": "簽到提供商", "签到范围": "簽到範圍", "签到触发时刻": "簽到觸發時刻", "签到记录": "簽到記錄", "签到记录时间范围": "簽到記錄時間範圍", "签到记录表": "簽到記錄表", "累计签到记录": "累計簽到記錄", "结算于 {time}": "結算於 {time}", "能量 {n}": "能量 {n}", "腾讯每日签到接口 · 仅国内版": "騰訊每日簽到介面 · 僅國內版", "至少勾一家才能保存(不勾等于这条条目不签到)": "至少勾一家才能儲存(不勾等於這條條目不簽到)", "读取定时签到数据失败:{error}": "讀取定時簽到資料失敗:{error}", "读取签到数据失败:{error}": "讀取簽到資料失敗:{error}", "读取签到记录失败:{error}": "讀取簽到記錄失敗:{error}", "跳过 {n}": "跳過 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運營活動交付(領取 → 確認 → 回讀核實)· 領的是套餐贈送積分", "还没执行过": "還沒執行過", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "還沒有定時條目 —— 點「新增條目」建一條,或到「簽到中心」手動簽到。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "還沒有簽到記錄 —— 手動簽到或等定時條目執行後,明細會出現在這裡。", "连登 {n} 天": "連登 {n} 天", "部分": "部分", "重签": "重籤", "重试": "重試", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "限時體驗套餐 · 領取需滑塊驗證碼 · 逐份檢視與領取", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "限時體驗套餐(start-plan),活動期內每天一份 · 領取需滑塊驗證碼", "需真实操作": "需真實操作", "非活动期": "非活動期", "项": "項", "领取": "領取", "领取中": "領取中", "领取中…": "領取中…", "领取失败": "領取失敗", "领取失败:{error}": "領取失敗:{error}", "(共 {n} 个账号)": "(共 {n} 個帳號)", "(能量 / 连登读数本次未取到)": "(能量/連登讀數本次未取到)", ",日活保活 {n} 个": ",日活保活 {n} 個" }); +window.wbI18nDict = window.wbI18nDict || {}; Object.assign(window.wbI18nDict, { " · ": " · ", "SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新": "SOLO 的 checkin_credits 領取 · 按自然日 0 點重新整理", "UMID 组件安装失败:{error}": "UMID 元件安裝失敗:{error}", "WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细": "WorkBuddy 國內版 · 查詢任務樹後一鍵點亮/領獎 · 含開學季與貓貓旅行 · 點擊行展開明細", "WorkBuddy 国际版保活模型,按顺序回退": "WorkBuddy 國際版保活模型,按順序回退", "WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关": "WorkBuddy 國際版日活任務的免費模型 · 全域一份,與條目無關", "{date}(每天 {time})": "{date}(每天 {time})", "{label} ×{count}({reason})": "{label} ×{count}({reason})", "{n} 项可完成": "{n} 項可完成", "{n} 项待领": "{n} 項待領", "{total} 账号 · {done} 已签": "{total} 帳號 · {done} 已籤", "{total} 项任务 · {pending} 项可完成": "{total} 項任務 · {pending} 項可完成", "✅ UMID 组件已安装,下轮签到即可领取国际版积分": "✅ UMID 元件已安裝,下輪簽到即可領取國際版積分", "✅ {message}": "✅ {message}", "✅ 定时签到已开启": "✅ 定時簽到已開啟", "✅ 开学季任务执行完成": "✅ 開學季任務執行完成", "✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}": "✅ 成長任務執行完成:積分 +{credit} 能量 +{energy}", "✅ 新手福利领取完成,累计 {n} 积分": "✅ 新手福利領取完成,累計 {n} 積分", "✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}": "✅ 簽到完成:{succeeded}/{total} 個帳號成功領取{active}", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空提交恢复缺省({defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空提交恢復預設({defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。": "「保活模型鏈」是 WorkBuddy 國際版領日活時用來保活的免費模型,按順序逐個嘗試、 第一個成功即止;清空清單並儲存 = 恢復預設鏈(當前預設:{defaults})。 當天去重 + 冪等領取:重複執行只會拿到「已領取」,不會重複加分。", "「免费领积分」的每日任务 · 逐个领取": "「免費領積分」的每日任務 · 逐個領取", "一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单": "一次性福利 · 簽到後自動查詢並領取,領完記在本機不再查上游 · 點擊行展開任務清單", "一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证": "一次領當天全部獎勵(每日簽到 + 新人禮) · 冪等由上游保證", "一键安装组件": "一鍵安裝元件", "一键完成": "一鍵完成", "一键领取({n})": "一鍵領取({n})", "上次执行:{line}": "上次執行:{line}", "上次签到时间": "上次簽到時間", "上次领取 {time} · 领取需通过滑块验证码": "上次領取 {time} · 領取需通過滑塊驗證碼", "下次 {date}": "下次 {date}", "下次 {date} · 点此管理条目": "下次 {date} · 點此管理條目", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它与 ZCode 的每日/套餐福利领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它與 ZCode 的每日/套餐福利領取見「活動福利」。", "不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。": "不參與每日簽到:{list}。CodeArts 的一次性獎勵在下方「新手福利」,它的每日福利就在上方「每日簽到」裡;ZCode 的套餐領取見「活動福利」。", "与国内版同一套任务接口 · 站点不同": "與國內版同一套任務介面 · 站點不同", "与国内版同一套链路 · 站点不同、令牌不通用": "與國內版同一套鏈路 · 站點不同、權杖不通用", "今天已领 {n} 份": "今天已領 {n} 份", "今天未领": "今天未領", "今天(北京时间 {day})已领取 · 官方确认到账 {n} 项 · 明天可再领": "今天(北京時間 {day})已領取 · 官方確認到賬 {n} 項 · 明天可再領", "今日已执行": "今日已執行", "今日已派出": "今日已派出", "今日已领取": "今日已領取", "今日签到": "今日簽到", "今日签到进度": "今日簽到進度", "从清单里移除": "從清單裡移除", "保活": "保活", "保活 {n}": "保活 {n}", "保活+领取": "保活+領取", "保活中…": "保活中…", "保活模型链": "保活模型鏈", "全选": "全選", "全部 {n} 家": "全部 {n} 家", "全部完成": "全部完成", "全部查询": "全部查詢", "全部结果": "全部結果", "全部账号均可签到": "全部帳號均可簽到", "全部领取": "全部領取", "关着:开机后等到窗口起点再签,随机窗口当天生效": "關著:開機後等到視窗起點再籤,隨機視窗當天生效", "关着:所有条目都不执行": "關著:所有條目都不執行", "分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行": "分鐘 · 視窗內逐個帳號隨機執行,0 = 到點立即執行", "删除失败:{error}": "刪除失敗:{error}", "删除定时条目": "刪除定時條目", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活並在網頁通道建會話點亮日活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。設了「隨機前後 N 分鐘」時,本輪帳號在各自視窗內分散執行(視窗夾在當天 0 點到 23:59 之間),不再全部擠在同一分鐘;視窗已過則立即全部執行。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉(可在「啟動補籤」關掉,改為等到視窗起點)。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;CodeArts 領當日的運營福利(領取 → 確認 → 回讀核實,自動執行受每天 6 次 / 間隔 10 分鐘的寫請求限流);OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。": "到點後自動簽到勾選提供商的可用帳號(WorkBuddy 國內版走每日簽到介面,國際版走每日活躍任務:探測活動、領日活獎勵、再用免費模型保活;小浣熊走桌面版每日積分鏈路;AutoClaw 走官方客戶端的每日簽到任務;Qoder 中國版走活動領取,沒被下發活動的帳號會得到中性提示;Qoder 國際版要先帶裝置風控身份(本機 Qoder 客戶端 / qodercli 的 UMID 元件生成)才能看到「每日 100 Credits」活動,缺元件時會得到明確的說明而不是報錯;Trae 領 SOLO 的每日簽到積分(按自然日 0 點重置),上游沒對該帳號開活動、或憑據裡沒有裝置號時得到的是「未領取 + 具體原因」而不是報錯;Loomy 每天替帳號打一次首次登入積分;KukuAI 領「免費領積分」的每日任務;OfficeAce 果辦一次領當天全部獎勵(每日簽到 + 新人禮))。錯過時點開機後會自動補籤,不會因為當時沒開機而漏掉。各家簽到介面都是冪等的,重複執行不會重複領取。", "到点时逐个签到,已勾 {n} / {total} 家": "到點時逐個簽到,已勾 {n} / {total} 家", "北京时间 · 错过时点开机后会自动补签": "北京時間 · 錯過時點開機後會自動補籤", "去领取": "去領取", "另有 {n} 个账号不参与每日签到": "另有 {n} 個帳號不參與每日簽到", "只领取已完成任务的奖励(幂等,重复点不会重复入账)": "只領取已完成任務的獎勵(冪等,重複點不會重複入帳)", "可完成": "可完成", "可派出": "可派出", "可选 · 缺省显示时刻": "可選 · 預設顯示時刻", "可领奖": "可領獎", "后端未返回定时签到数据": "後端未返回定時簽到資料", "后端未返回签到中心数据": "後端未返回簽到中心資料", "启动补签": "啟動補籤", "启动补签已关闭": "啟動補籤已關閉", "启动补签已开启": "啟動補籤已開啟", "国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。": "國際版簽到需要 UMID 元件生成裝置風控身份(本機未檢測到)。", "在途": "在途", "填入缺省链": "填入預設鏈", "填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)": "填好時刻與簽到範圍後點「儲存」;名稱可以留空(介面顯示時刻)", "失败 {n}": "失敗 {n}", "套餐明细": "套餐明細", "安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。": "安裝 Qoder 客戶端或 qodercli 後即可(無需重啟閘道器)。", "安装中…": "安裝中…", "官方客户端的每日签到任务": "官方客戶端的每日簽到任務", "定时签到": "定時簽到", "定时签到已关闭": "定時簽到已關閉", "尚未查询": "尚未查詢", "尚未查询任务状态": "尚未查詢任務狀態", "巡检一次": "巡檢一次", "已保存:{label}": "已儲存:{label}", "已保存:保活模型链": "已儲存:保活模型鏈", "已保存:定时条目": "已儲存:定時條目", "已删除定时条目": "已刪除定時條目", "已完成活跃上报(连登已点亮),但活动未开启(本次没有可领的奖励)": "已完成活躍上報(連登已點亮),但活動未開啟(本次沒有可領的獎勵)", "已抽 {n} 次": "已抽 {n} 次", "已有结果 {checked} / 共 {total} 个账号": "已有結果 {checked} / 共 {total} 個帳號", "已签": "已籤", "已领 {claimed}/{total} · 累计 {earned} 积分": "已領 {claimed}/{total} · 累計 {earned} 積分", "已领养": "已領養", "已领取": "已領取", "带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件": "帶裝置風控身份領取「每日 100 Credits」 · 需要 UMID 元件", "开学季执行失败:{error}": "開學季執行失敗:{error}", "开学季执行完成:{message}": "開學季執行完成:{message}", "开学季活动": "開學季活動", "开着:启用的条目按各自时刻执行": "開著:啟用的條目按各自時刻執行", "开着:开机后今天没签过的条目立刻补签,不看随机窗口": "開著:開機後今天沒簽過的條目立刻補籤,不看隨機視窗", "待签": "待籤", "待领新手福利": "待領新手福利", "总开关": "總開關", "总开关已关闭 · 在「定时签到」页打开": "總開關已關閉 · 在「定時簽到」頁開啟", "成功 {n}": "成功 {n}", "成长任务": "成長任務", "成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}": "成長任務完成({done} 項成功、{failed} 項失敗),積分 +{credit} 能量 +{energy}", "成长任务执行失败:{error}": "成長任務執行失敗:{error}", "执行失败:{error}": "執行失敗:{error}", "执行并抽奖": "執行並抽獎", "执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)": "執行開學季任務並抽空抽獎機會(分享/對話/專家事件)", "把缺省链填进清单,再点「保存」生效": "把預設鏈填進清單,再點「儲存」生效", "抽奖机会 {n} 次": "抽獎機會 {n} 次", "按住拖动调整顺序": "按住拖動調整順序", "按住拖动,调整这个模型在链里的顺序": "按住拖動,調整這個模型在鏈裡的順序", "按序逐个尝试,共 {n} 个": "按序逐個嘗試,共 {n} 個", "按结果筛选": "按結果篩選", "探测 + 领取 + 保活 · 与定时签到同一套组合": "探測 + 領取 + 保活 · 與定時簽到同一套組合", "探测活动并领取日活奖励 · 不做保活": "探測活動並領取日活獎勵 · 不做保活", "接单 + 点亮 + 领奖(只处理已实测沉淀的任务)": "接單+點亮+領獎(只處理已實測沉澱的任務)", "搜账号 / 收益 / 错误 / 触发原因": "搜帳號 / 收益 / 錯誤 / 觸發原因", "收起新建": "收起新建", "新建定时条目": "新建定時條目", "新手福利": "新手福利", "新手福利有 {n} 项领取失败,可重试": "新手福利有 {n} 項領取失敗,可重試", "无": "無", "无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)": "無獨立簽到介面 · 每天替帳號打一次登入資訊(即當日魔粒)", "无独立签到接口 · 每天替账号打一次首次登录积分": "無獨立簽到介面 · 每天替帳號打一次首次登入積分", "无账号": "無帳號", "暂不可领": "暫不可領", "暂不支持": "暫不支援", "暂无启用的条目 · 点此添加": "暫無啟用的條目 · 點此新增", "有未保存的改动": "有未儲存的改動", "未勾选提供商": "未勾選提供商", "未开启": "未開啟", "未解锁": "未解鎖", "未领养(领养需先完成当日对话量)": "未領養(領養需先完成當日對話量)", "未领取": "未領取", "本地台账里今天还没领过;活动期内每天发一份新套餐": "本地臺賬裡今天還沒領過;活動期內每天發一份新套餐", "本地台账里今天(北京时间)领过的套餐:{plans}": "本地臺賬裡今天(北京時間)領過的套餐:{plans}", "条启用": "條啟用", "查询于 {time}": "查詢於 {time}", "查询任务": "查詢任務", "查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)": "查詢任務樹並一鍵點亮/領獎(含開學季與貓貓旅行)", "查询失败:{error}": "查詢失敗:{error}", "桌面端每日积分链路": "桌面版每日積分鏈路", "正在读取定时签到数据…": "正在讀取定時簽到資料…", "正在读取签到数据…": "正在讀取簽到資料…", "每天 {time}": "每天 {time}", "每天 {time} · {scope}": "每天 {time} · {scope}", "每天 {time} · 随机前后 {n} 分钟 · {scope}": "每天 {time} · 隨機前後 {n} 分鐘 · {scope}", "每天时刻": "每天時刻", "每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准": "每執行一次簽到 · 每個帳號一條明細 · 結果與收益以後端落賬為準", "每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行": "每日活躍任務 · 網頁會話保活點亮日活,領取才加積分 · 兩者可分開執行", "每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置": "每日福利 · 領取 → 確認 → 回讀核實 · 按北京時間自然日重置", "每日签到": "每日簽到", "每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签": "每條條目各有時刻與範圍 · 各自當天去重 · 錯過時點開機自動補籤", "每账号一条明细 · 点此查看「签到记录」": "每帳號一條明細 · 點此檢視「簽到記錄」", "没有可领套餐的账号(ZCode 未添加)。": "沒有可領套餐的帳號(ZCode 未新增)。", "没有可领福利的账号(CodeArts / ZCode 未添加)。": "沒有可領福利的帳號(CodeArts / ZCode 未新增)。", "没有支持成长任务的账号(需要 WorkBuddy 国内版)。": "沒有支援成長任務的帳號(需要 WorkBuddy 國內版)。", "没有支持新手福利的账号": "沒有支援新手福利的帳號", "没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。": "沒有支援新手福利的帳號 —— 目前有 Loomy、小浣熊、CodeArts 三家。", "没有符合筛选条件的签到记录": "沒有符合篩選條件的簽到記錄", "没有需要执行的任务": "沒有需要執行的任務", "活动福利": "活動福利", "活动(campaign)领取 · 每天 10:00 刷新": "活動(campaign)領取 · 每天 10:00 重新整理", "活跃上报与保活均未成功,且活动未开启": "活躍上報與保活均未成功,且活動未開啟", "活跃上报完成,但保活未成功且活动未开启": "活躍上報完成,但保活未成功且活動未開啟", "活跃上报完成,但活动未开启": "活躍上報完成,但活動未開啟", "活跃上报成功": "活躍上報成功", "活跃保活失败": "活躍保活失敗", "活跃保活完成": "活躍保活完成", "活跃保活完成,但活动未开启": "活躍保活完成,但活動未開啟", "活跃保活完成,但活跃上报失败且活动未开启": "活躍保活完成,但活躍上報失敗且活動未開啟", "添加条目": "新增條目", "添加模型": "新增模型", "清单为空 —— 保存后恢复缺省链": "清單為空 —— 儲存後恢復預設鏈", "清单里已经有「{name}」": "清單裡已經有「{name}」", "清空失败:{error}": "清空失敗:{error}", "清空签到记录": "清空簽到記錄", "点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领": "點「套餐明細」看領到了哪幾份、什麼時候生效;活動期內每天可再領", "点击行展开账号明细 · 单账号签到不受范围限制": "點擊行展開帳號明細 · 單帳號簽到不受範圍限制", "独立链路 · 只提供手动入口 · 不进自动签到": "獨立鏈路 · 只提供手動入口 · 不進自動簽到", "猫猫旅行": "貓貓旅行", "猫猫旅行失败:{error}": "貓貓旅行失敗:{error}", "猫猫旅行失败:{message}": "貓貓旅行失敗:{message}", "猫猫旅行:{message}": "貓貓旅行:{message}", "用免费模型与网页会话维持账号活跃 · 不领取奖励": "用免費模型與網頁會話維持帳號活躍 · 不領取獎勵", "确定删除「{name}」?删除后到点不再执行。": "確定刪除「{name}」?刪除後到點不再執行。", "确定清空全部签到记录?清空后无法恢复。": "確定清空全部簽到記錄?清空後無法恢復。", "确定清空当前筛选出的签到记录?清空后无法恢复。": "確定清空當前篩選出的簽到記錄?清空後無法恢復。", "移除 {name}": "移除 {name}", "立即全部签到": "立即全部簽到", "签到": "簽到", "签到中…": "簽到中…", "签到中心分区": "簽到中心分割槽", "签到失败:{error}": "簽到失敗:{error}", "签到完成:{succeeded}/{total} 成功{active},{failed} 个失败": "簽到完成:{succeeded}/{total} 成功{active},{failed} 個失敗", "签到成功": "簽到成功", "签到提供商": "簽到提供商", "签到范围": "簽到範圍", "签到触发时刻": "簽到觸發時刻", "签到记录": "簽到記錄", "签到记录时间范围": "簽到記錄時間範圍", "签到记录表": "簽到記錄表", "累计签到记录": "累計簽到記錄", "结算于 {time}": "結算於 {time}", "能量 {n}": "能量 {n}", "腾讯每日签到接口 · 仅国内版": "騰訊每日簽到介面 · 僅國內版", "至少勾一家才能保存(不勾等于这条条目不签到)": "至少勾一家才能儲存(不勾等於這條條目不簽到)", "读取定时签到数据失败:{error}": "讀取定時簽到資料失敗:{error}", "读取签到数据失败:{error}": "讀取簽到資料失敗:{error}", "读取签到记录失败:{error}": "讀取簽到記錄失敗:{error}", "跳过 {n}": "跳過 {n}", "运营活动交付(领取 → 确认 → 回读核实)· 领的是套餐赠送积分": "運營活動交付(領取 → 確認 → 回讀核實)· 領的是套餐贈送積分", "还没执行过": "還沒執行過", "还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。": "還沒有定時條目 —— 點「新增條目」建一條,或到「簽到中心」手動簽到。", "还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。": "還沒有簽到記錄 —— 手動簽到或等定時條目執行後,明細會出現在這裡。", "连登 {n} 天": "連登 {n} 天", "部分": "部分", "重签": "重籤", "重试": "重試", "限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取": "限時體驗套餐 · 領取需滑塊驗證碼 · 逐份檢視與領取", "限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码": "限時體驗套餐(start-plan),活動期內每天一份 · 領取需滑塊驗證碼", "随机前后": "隨機前後", "需真实操作": "需真實操作", "非活动期": "非活動期", "项": "項", "领取": "領取", "领取中": "領取中", "领取中…": "領取中…", "领取失败": "領取失敗", "领取失败:{error}": "領取失敗:{error}", "(共 {n} 个账号)": "(共 {n} 個帳號)", "(能量 / 连登读数本次未取到)": "(能量/連登讀數本次未取到)", ",日活保活 {n} 个": ",日活保活 {n} 個" }); diff --git a/desktop-tauri/ui/islands/ui.js b/desktop-tauri/ui/islands/ui.js index 5d9d4644..76e0d9f9 100644 --- a/desktop-tauri/ui/islands/ui.js +++ b/desktop-tauri/ui/islands/ui.js @@ -1,23 +1,23 @@ -var Pse=Object.defineProperty;var _se=(xi,gl,to)=>gl in xi?Pse(xi,gl,{enumerable:!0,configurable:!0,writable:!0,value:to}):xi[gl]=to;var ln=(xi,gl,to)=>_se(xi,typeof gl!="symbol"?gl+"":gl,to);(function(){"use strict";function xi(e,t){for(var a=0;ao[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var to={exports:{}},Ud={};var oC;function _5(){if(oC)return Ud;oC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:e,type:o,key:f,ref:c!==void 0?c:null,props:d}}return Ud.Fragment=t,Ud.jsx=a,Ud.jsxs=a,Ud}var iC;function L5(){return iC||(iC=1,to.exports=_5()),to.exports}var s=L5(),jv={exports:{}},ct={};var cC;function z5(){if(cC)return ct;cC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),j=Symbol.iterator;function S(M){return M===null||typeof M!="object"?null:(M=j&&M[j]||M["@@iterator"],typeof M=="function"?M:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,T={};function D(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}D.prototype.isReactComponent={},D.prototype.setState=function(M,U){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,U,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=D.prototype;function A(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||N}var R=A.prototype=new C;R.constructor=A,k(R,D.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},_=Object.prototype.hasOwnProperty;function L(M,U,Z){var ae=Z.ref;return{$$typeof:e,type:M,key:U,ref:ae!==void 0?ae:null,props:Z}}function H(M,U){return L(M.type,U,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function z(M){var U={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Z){return U[Z]})}var Q=/\/+/g;function K(M,U){return typeof M=="object"&&M!==null&&M.key!=null?z(""+M.key):U.toString(36)}function X(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(P,P):(M.status="pending",M.then(function(U){M.status==="pending"&&(M.status="fulfilled",M.value=U)},function(U){M.status==="pending"&&(M.status="rejected",M.reason=U)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function q(M,U,Z,ae,ce){var J=typeof M;(J==="undefined"||J==="boolean")&&(M=null);var ie=!1;if(M===null)ie=!0;else switch(J){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(M.$$typeof){case e:case t:ie=!0;break;case y:return ie=M._init,q(ie(M._payload),U,Z,ae,ce)}}if(ie)return ce=ce(M),ie=ae===""?"."+K(M,0):ae,I(ce)?(Z="",ie!=null&&(Z=ie.replace(Q,"$&/")+"/"),q(ce,U,Z,"",function(fe){return fe})):ce!=null&&(B(ce)&&(ce=H(ce,Z+(ce.key==null||M&&M.key===ce.key?"":(""+ce.key).replace(Q,"$&/")+"/")+ie)),U.push(ce)),1;ie=0;var ge=ae===""?".":ae+":";if(I(M))for(var ee=0;ee"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Fd(e){const{overflow:t,overflowX:a,overflowY:o,display:c}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&c!=="inline"&&c!=="contents"}function H5(e){return/^(table|td|th)$/.test(Hs(e))}function Dm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const U5=/transform|translate|scale|rotate|perspective|filter/,V5=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Nv;function kv(e){const t=At(e)?xr(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Cv()&&(bi(t.backdropFilter)||bi(t.filter))||U5.test(t.willChange||"")||V5.test(t.contain||"")}function F5(e){let t=so(e);for(;dn(t)&&!no(t);){if(kv(t))return t;if(Dm(t))return null;t=so(t)}return null}function Cv(){return Nv==null&&(Nv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nv}function no(e){return/^(html|body|#document)$/.test(Hs(e))}function xr(e){return Sn(e).getComputedStyle(e)}function Im(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function so(e){if(Hs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bc(e)&&e.host||xl(e);return Bc(t)?t.host:t}function dC(e){const t=so(e);return no(t)?(e.ownerDocument||e).body:dn(t)&&Fd(t)?t:dC(t)}function Hc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const c=dC(e),d=c===((o=e.ownerDocument)==null?void 0:o.body),f=Sn(c);if(d){const p=Tv(f);return t.concat(f,f.visualViewport||[],Fd(c)?c:[],p&&a?Hc(p):[])}else return t.concat(c,Hc(c,[],a))}function Tv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ev={...B5},fC={};function Ds(e,t){const a=x.useRef(fC);return a.current===fC&&(a.current=e(t)),a}const Av=Ev.useInsertionEffect,$5=Av&&Av!==Ev.useLayoutEffect?Av:e=>e();function Ie(e){const t=Ds(q5).current;return t.next=e,$5(t.effect),t.trampoline}function q5(){const e={next:void 0,callback:G5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function G5(){}const De=typeof document<"u"?x.useLayoutEffect:()=>{};function Rv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const Ov={};function Wr(e,t,a,o,c){if(!a&&!o&&!c&&!e)return Pm(t);let d=Pm(e);return t&&(d=$d(d,t)),a&&(d=$d(d,a)),o&&(d=$d(d,o)),c&&(d=$d(d,c)),d}function K5(e){if(e.length===0)return Ov;if(e.length===1)return Pm(e[0]);let t=Pm(e[0]);for(let a=1;a=65&&c<=90&&(typeof t=="function"||typeof t>"u")}function Mv(e){return typeof e=="function"}function mC(e,t){return Mv(e)?e(t):e??Ov}function Q5(e,t){return t?e?(...a)=>{const o=a[0];if(xC(o)){const d=o;_m(d);const f=t(...a);return d.baseUIHandlerPrevented||e?.(...a),f}const c=t(...a);return e?.(...a),c}:hC(t):e}function hC(e){return e&&((...t)=>{const a=t[0];return xC(a)&&_m(a),e(...t)})}function _m(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gC(e,t){return t?e?t+" "+e:t:e}function xC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Z5(e,t){return function(o,...c){const d=new URL(e);return d.searchParams.set("code",o.toString()),c.forEach(f=>d.searchParams.append("args[]",f)),`${t} error #${o}; visit ${d} for the full message.`}}const on=Z5("https://base-ui.com/production-error","Base UI"),bC=x.createContext(void 0);function vC(e=!1){const t=x.useContext(bC);if(t===void 0&&!e)throw new Error(on(16));return t}function W5(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:c=0,isNativeButton:d}=e,f=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const b={onKeyDown(y){a&&t&&y.key!=="Tab"&&y.preventDefault()}};return o||(b.tabIndex=c,!d&&a&&(b.tabIndex=t?c:-1)),(d&&(t||f)||!d&&a)&&(b["aria-disabled"]=a),d&&(!t||p)&&(b.disabled=a),b},[o,a,t,f,p,d,c])}}function $t(e){return e?.ownerDocument||document}function Uc(e,t,{detail:a=0}={}){e.dispatchEvent(new(Sn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Jr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:c=!0,composite:d}=e,f=x.useRef(null),p=vC(!0),h=d??p!==void 0,{props:b}=W5({focusableWhenDisabled:a,disabled:t,composite:h,tabIndex:o,isNativeButton:c}),y=x.useCallback(()=>{const j=f.current;Dv(j)&&h&&t&&b.disabled===void 0&&j.disabled&&(j.disabled=!1)},[t,b.disabled,h]);De(y,[y]);const v=x.useCallback((j={})=>{const{onClick:S,onMouseDown:N,onKeyUp:k,onKeyDown:T,onPointerDown:D,...C}=j;return Wr({onClick(A){if(t){A.preventDefault();return}S?.(A)},onMouseDown(A){t||N?.(A)},onKeyDown(A){if(t||(_m(A),T?.(A),A.baseUIHandlerPrevented))return;const R=A.target===A.currentTarget,I=A.currentTarget,P=Dv(I),O=!c&&J5(I),_=R&&(c?P:!O),L=A.key==="Enter",H=A.key===" ",B=I.getAttribute("role"),z=B?.startsWith("menuitem")||B==="option"||B==="gridcell";if(R&&h&&H){if(A.defaultPrevented&&z)return;A.preventDefault(),(!c||P)&&(A.preventBaseUIHandler(),Uc(I,A));return}if(!_||c||!H&&!L){R&&O&&H&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),L&&(A.preventBaseUIHandler(),Uc(I,A)))},onKeyUp(A){if(!t){if(_m(A),k?.(A),A.target===A.currentTarget&&c&&h&&Dv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!c&&!h&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Uc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}D?.(A)}},c?{type:"button"}:{role:"button"},b,C)},[t,b,h,c]),w=Ie(j=>{f.current=j,y()});return{getButtonProps:v,buttonRef:w}}function Dv(e){return dn(e)&&e.tagName==="BUTTON"}function J5(e){return dn(e)&&e.tagName==="A"&&!!e.href}function ea(e,t,a,o){const c=Ds(yC).current;return tz(c,e,t,a,o)&&wC(c,[e,t,a,o]),c.callback}function ez(e){const t=Ds(yC).current;return nz(t,e)&&wC(t,e),t.callback}function yC(){return{callback:null,cleanup:null,refs:[]}}function tz(e,t,a,o,c){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==c}function nz(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function wC(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let c=0;c{for(let c=0;c=e}function jC(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Iv(19)?a?.ref:t.ref)??null}function qt(){}const Or=Object.freeze([]),fn=Object.freeze({});function rz(e,t){const a={};for(const o in e){const c=e[o];if(t?.hasOwnProperty(o)){const d=t[o](c);d!=null&&Object.assign(a,d);continue}c===!0?a[`data-${o.toLowerCase()}`]="":c&&(a[`data-${o.toLowerCase()}`]=c.toString())}return a}function az(e,t){return typeof e=="function"?e(t):e}function lz(e,t){return typeof e=="function"?e(t):e}function yt(e,t,a={}){let o=t.render;a.enabled!==!1&&(o=uz(o));const c=oz(t,a,o);if(a.enabled===!1)return null;const d=a.state??fn;return dz(e,o,c,d)}function oz(e,t,a){const{className:o,style:c}=e,{state:d=fn,ref:f,props:p,stateAttributesMapping:h,enabled:b=!0}=t,y=b?az(o,d):void 0,v=b?lz(c,d):void 0,w=b?rz(d,h):fn,j=b&&p?iz(p):void 0,S=b?Rv(w,j)??{}:fn;return typeof document<"u"&&(b?Array.isArray(f)?S.ref=ez([S.ref,jC(a),...f]):S.ref=ea(S.ref,jC(a),f):ea(null,null)),b?(y!==void 0&&(S.className=gC(S.className,y)),v!==void 0&&(S.style=Rv(S.style,v)),S):fn}function iz(e){return Array.isArray(e)?K5(e):Wr(void 0,e)}const cz=Symbol.for("react.lazy");function uz(e){if(e?.$$typeof!==cz)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function dz(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const c=Wr(a,t.props);return c.ref=a.ref,x.cloneElement(t,c)}if(e&&typeof e=="string")return fz(e,a);throw new Error(on(8))}function fz(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const pz=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,focusableWhenDisabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{getButtonProps:y,buttonRef:v}=Jr({disabled:d,focusableWhenDisabled:f,native:p});return yt("button",t,{state:{disabled:d},ref:[a,v],props:[b,y]})});function SC(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,CC=NC,Vc=(e,t)=>a=>{var o;if(t?.variants==null)return CC(e,a?.class,a?.className);const{variants:c,defaultVariants:d}=t,f=Object.keys(c).map(b=>{const y=a?.[b],v=d?.[b];if(y===null)return null;const w=kC(y)||kC(v);return c[b][w]}),p=a&&Object.entries(a).reduce((b,y)=>{let[v,w]=y;return w===void 0||(b[v]=w),b},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((b,y)=>{let{class:v,className:w,...j}=y;return Object.entries(j).every(S=>{let[N,k]=S;return Array.isArray(k)?k.includes({...d,...p}[N]):{...d,...p}[N]===k})?[...b,v,w]:b},[]);return CC(e,f,h,a?.class,a?.className)},mz=(e,t)=>{const a=new Array(e.length+t.length);for(let o=0;o({classGroupId:e,validator:t}),TC=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a}),Lm="-",EC=[],gz="arbitrary..",xz=e=>{const t=vz(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return bz(f);const p=f.split(Lm),h=p[0]===""&&p.length>1?1:0;return AC(p,h,t)},getConflictingClassGroupIds:(f,p)=>{if(p){const h=o[f],b=a[f];return h?b?mz(b,h):h:b||EC}return a[f]||EC}}},AC=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;const c=e[t],d=a.nextPart.get(c);if(d){const b=AC(e,t+1,d);if(b)return b}const f=a.validators;if(f===null)return;const p=t===0?e.join(Lm):e.slice(t).join(Lm),h=f.length;for(let b=0;be.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),a=t.indexOf(":"),o=t.slice(0,a);return o?gz+o:void 0})(),vz=e=>{const{theme:t,classGroups:a}=e;return yz(a,t)},yz=(e,t)=>{const a=TC();for(const o in e){const c=e[o];Pv(c,a,o,t)}return a},Pv=(e,t,a,o)=>{const c=e.length;for(let d=0;d{if(typeof e=="string"){jz(e,t,a);return}if(typeof e=="function"){Sz(e,t,a,o);return}Nz(e,t,a,o)},jz=(e,t,a)=>{const o=e===""?t:RC(t,e);o.classGroupId=a},Sz=(e,t,a,o)=>{if(kz(e)){Pv(e(o),t,a,o);return}t.validators===null&&(t.validators=[]),t.validators.push(hz(a,e))},Nz=(e,t,a,o)=>{const c=Object.entries(e),d=c.length;for(let f=0;f{let a=e;const o=t.split(Lm),c=o.length;for(let d=0;d"isThemeGetter"in e&&e.isThemeGetter===!0,Cz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),o=Object.create(null);const c=(d,f)=>{a[d]=f,t++,t>e&&(t=0,o=a,a=Object.create(null))};return{get(d){let f=a[d];if(f!==void 0)return f;if((f=o[d])!==void 0)return c(d,f),f},set(d,f){d in a?a[d]=f:c(d,f)}}},_v="!",OC=":",Tz=[],MC=(e,t,a,o,c)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:o,isExternal:c}),Ez=e=>{const{prefix:t,experimentalParseClassName:a}=e;let o=c=>{const d=[];let f=0,p=0,h=0,b;const y=c.length;for(let N=0;Nh?b-h:void 0;return MC(d,j,w,S)};if(t){const c=t+OC,d=o;o=f=>f.startsWith(c)?d(f.slice(c.length)):MC(Tz,!1,f,void 0,!0)}if(a){const c=o;o=d=>a({className:d,parseClassName:c})}return o},Az=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((a,o)=>{t.set(a,1e6+o)}),a=>{const o=[];let c=[];for(let d=0;d0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Rz=e=>({cache:Cz(e.cacheSize),parseClassName:Ez(e),sortModifiers:Az(e),postfixLookupClassGroupIds:Oz(e),...xz(e)}),Oz=e=>{const t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let o=0;o{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:f}=t,p=[],h=e.trim().split(Mz);let b="";for(let y=h.length-1;y>=0;y-=1){const v=h[y],{isExternal:w,modifiers:j,hasImportantModifier:S,baseClassName:N,maybePostfixModifierPosition:k}=a(v);if(w){b=v+(b.length>0?" "+b:b);continue}let T=!!k,D;if(T){const P=N.substring(0,k);D=o(P);const O=D&&f[D]?o(N):void 0;O&&O!==D&&(D=O,T=!1)}else D=o(N);if(!D){if(!T){b=v+(b.length>0?" "+b:b);continue}if(D=o(N),!D){b=v+(b.length>0?" "+b:b);continue}T=!1}const C=j.length===0?"":j.length===1?j[0]:d(j).join(":"),A=S?C+_v:C,R=A+D;if(p.indexOf(R)>-1)continue;p.push(R);const I=c(D,T);for(let P=0;P0?" "+b:b)}return b},Iz=(...e)=>{let t=0,a,o,c="";for(;t{if(typeof e=="string")return e;let t,a="";for(let o=0;o{let a,o,c,d;const f=h=>{const b=t.reduce((y,v)=>v(y),e());return a=Rz(b),o=a.cache.get,c=a.cache.set,d=p,p(h)},p=h=>{const b=o(h);if(b)return b;const y=Dz(h,a);return c(h,y),y};return d=f,(...h)=>d(Iz(...h))},_z=[],Ns=e=>{const t=a=>a[e]||_z;return t.isThemeGetter=!0,t.themeKey=e,t},IC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Uz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Vz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ro=e=>Lz.test(e),Nt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Lv=e=>e.endsWith("%")&&Nt(e.slice(0,-1)),bl=e=>zz.test(e),_C=()=>!0,Fz=e=>Bz.test(e)&&!Hz.test(e),zv=()=>!1,$z=e=>Uz.test(e),qz=e=>Vz.test(e),Gz=e=>!Ke(e)&&!Xe(e),Kz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Yz=e=>ao(e,VC,zv),Ke=e=>IC.test(e),vi=e=>ao(e,FC,Fz),LC=e=>ao(e,nB,Nt),Xz=e=>ao(e,qC,_C),Qz=e=>ao(e,$C,zv),zC=e=>ao(e,HC,zv),Zz=e=>ao(e,UC,qz),zm=e=>ao(e,GC,$z),Xe=e=>PC.test(e),qd=e=>yi(e,FC),Wz=e=>yi(e,$C),BC=e=>yi(e,HC),Jz=e=>yi(e,VC),eB=e=>yi(e,UC),Bm=e=>yi(e,GC,!0),tB=e=>yi(e,qC,!0),ao=(e,t,a)=>{const o=IC.exec(e);return o?o[1]?t(o[1]):a(o[2]):!1},yi=(e,t,a=!1)=>{const o=PC.exec(e);return o?o[1]?t(o[1]):a:!1},HC=e=>e==="position"||e==="percentage",UC=e=>e==="image"||e==="url",VC=e=>e==="length"||e==="size"||e==="bg-size",FC=e=>e==="length",nB=e=>e==="number",$C=e=>e==="family-name",qC=e=>e==="number"||e==="weight",GC=e=>e==="shadow",sB=Pz(()=>{const e=Ns("color"),t=Ns("font"),a=Ns("text"),o=Ns("font-weight"),c=Ns("tracking"),d=Ns("leading"),f=Ns("breakpoint"),p=Ns("container"),h=Ns("spacing"),b=Ns("radius"),y=Ns("shadow"),v=Ns("inset-shadow"),w=Ns("text-shadow"),j=Ns("drop-shadow"),S=Ns("blur"),N=Ns("perspective"),k=Ns("aspect"),T=Ns("ease"),D=Ns("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...A(),Xe,Ke],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],O=()=>[Xe,Ke,h],_=()=>[ro,"full","auto",...O()],L=()=>[$a,"none","subgrid",Xe,Ke],H=()=>["auto",{span:["full",$a,Xe,Ke]},$a,Xe,Ke],B=()=>[$a,"auto",Xe,Ke],z=()=>["auto","min","max","fr",Xe,Ke],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...O()],q=()=>[ro,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],$=()=>[p,ro,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Y=()=>[ro,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],F=()=>[e,Xe,Ke],G=()=>[...A(),BC,zC,{position:[Xe,Ke]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",Jz,Yz,{size:[Xe,Ke]}],M=()=>[Lv,qd,vi],U=()=>["","none","full",b,Xe,Ke],Z=()=>["",Nt,qd,vi],ae=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Nt,Lv,BC,zC],ie=()=>["","none",S,Xe,Ke],ge=()=>["none",Nt,Xe,Ke],ee=()=>["none",Nt,Xe,Ke],fe=()=>[Nt,Xe,Ke],te=()=>[ro,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bl],breakpoint:[bl],color:[_C],container:[bl],"drop-shadow":[bl],ease:["in","out","in-out"],font:[Gz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bl],shadow:[bl],spacing:["px",Nt],text:[bl],"text-shadow":[bl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ro,Ke,Xe,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Xe,Ke]}],"container-named":[Kz],columns:[{columns:[Nt,"auto",Ke,Xe,p]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Xe,Ke]}],basis:[{basis:[ro,"full","auto",p,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nt,ro,"auto","initial","none",Ke]}],grow:[{grow:["",Nt,Xe,Ke]}],shrink:[{shrink:["",Nt,Xe,Ke]}],order:[{order:[$a,"first","last","none",Xe,Ke]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh","none",...q()]}],"font-size":[{text:["base",a,qd,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,tB,Xz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lv,Ke]}],"font-family":[{font:[Wz,Qz,t]}],"font-features":[{"font-features":[Ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Xe,Ke]}],"line-clamp":[{"line-clamp":[Nt,"none",Xe,LC]}],leading:[{leading:["none",d,...O()]}],"list-image":[{"list-image":["none",Xe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Nt,"from-font","auto",Xe,vi]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Nt,"auto",Xe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[$a,Xe,Ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Xe,Ke],radial:["",Xe,Ke],conic:["",$a,Xe,Ke]},eB,Zz]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Nt,Xe,Ke]}],"outline-w":[{outline:["",Nt,qd,vi]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,Bm,zm]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",v,Bm,zm]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Nt,vi]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",w,Bm,zm]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Nt,Xe,Ke]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Xe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xe,Ke]}],filter:[{filter:["","none",Xe,Ke]}],blur:[{blur:ie()}],brightness:[{brightness:[Nt,Xe,Ke]}],contrast:[{contrast:[Nt,Xe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",j,Bm,zm]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Nt,Xe,Ke]}],"hue-rotate":[{"hue-rotate":[Nt,Xe,Ke]}],invert:[{invert:["",Nt,Xe,Ke]}],saturate:[{saturate:[Nt,Xe,Ke]}],sepia:[{sepia:["",Nt,Xe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Xe,Ke]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Nt,Xe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[Nt,Xe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nt,Xe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nt,Xe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",Nt,Xe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[Nt,Xe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[Nt,Xe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Nt,Xe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nt,"initial",Xe,Ke]}],ease:[{ease:["linear","initial",T,Xe,Ke]}],delay:[{delay:[Nt,Xe,Ke]}],animate:[{animate:["none",D,Xe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Xe,Ke]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[Xe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[$a,Xe,Ke]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xe,Ke]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Nt,qd,vi,LC]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ue(...e){return sB(NC(e))}const rB=Vc(["group/button inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color,transform,box-shadow] duration-150 ease-out","outline-none select-none active:translate-y-[0.5px]","disabled:pointer-events-none disabled:opacity-45 disabled:shadow-none","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:"border-primary bg-primary font-semibold text-primary-on shadow-glow hover:border-primary-hover hover:bg-primary-hover",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"border-transparent bg-transparent text-subtle shadow-none hover:bg-control-hover hover:text-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive hover:bg-destructive-hover",dashed:"border-dashed border-border-strong bg-transparent text-muted-foreground shadow-none hover:border-primary hover:text-primary-fg",link:"border-transparent bg-transparent text-primary shadow-none underline-offset-4 hover:underline"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]","2xs":"h-4 rounded-pill px-1.5 text-[10px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]",icon:"h-[30px] w-[30px] rounded-md p-0","icon-2xs":"size-4 rounded-pill p-0","icon-xs":"size-6 rounded-sm p-0","icon-sm":"h-[26px] w-[26px] rounded-sm p-0","icon-lg":"size-9 rounded-md p-0"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:a,...o}){return s.jsx(pz,{className:Ue(rB({variant:t,size:a}),e),...o})}const aB="data-valid",lB="data-invalid",oB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KC={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},iB={disabled:!1,...KC},wi={valid(e){return e===null?null:e?{[aB]:""}:{[lB]:""}}},YC={invalid:void 0,name:void 0,validityData:{state:oB,errors:[],error:"",value:"",initialValue:null},setValidityData:qt,disabled:void 0,setTouched:qt,setDirty:qt,setFilled:qt,setFocused:qt,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:iB,registerFieldControl:qt,validation:{getValidationProps:(e,t=fn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qt,getInputControl:()=>null,commit:async()=>{},change:qt}},XC=x.createContext(YC);function Sa(e=!0){const t=x.useContext(XC);if(t.setValidityData===qt&&!e)throw new Error(on(28));return t}const cB=x.createContext(void 0);function uB(e=!1){const t=x.useContext(cB);if(!t&&!e)throw new Error(on(86));return t}const dB=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qt,validationMode:"onSubmit",submitCountRef:{current:0}});function Fc(){return x.useContext(dB)}let QC=0;function fB(e,t="mui"){const[a,o]=x.useState(e),c=e||a;return x.useEffect(()=>{a==null&&(QC+=1,o(`${t}-${QC}`))},[a,t]),c}const ZC=Ev.useId;function Gd(e,t){if(ZC!==void 0){const a=ZC();return e??(t?`${t}-${a}`:a)}return fB(e,t)}function Na(e){return Gd(e,"base-ui")}const pB=x.createContext({controlId:void 0,registerControlId:qt,resetControlId:qt,labelId:void 0,setLabelId:qt,messageIds:[],setMessageIds:qt,getDescriptionProps:e=>e});function vl(){return x.useContext(pB)}function Bv(e,t,a,o=!0,c){const[d,f]=x.useState(),p=Na(c?`${c}-label`:void 0),h=e??t??d;return De(()=>{const b=e||t||!o?void 0:mB(a.current,p);d!==b&&f(b)}),h}function mB(e,t){const a=hB(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function hB(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const c=e.nextElementSibling;if(c&&c.htmlFor===a)return c}const o=e.labels;return o&&o[0]}function lo(e={}){const{id:t,enabled:a=!0}=e,{controlId:o,registerControlId:c,resetControlId:d}=vl(),f=Na(),p=Ds(()=>Symbol()),h=x.useRef(!1),b=x.useRef(!1),y=Ie(()=>{!h.current||c===qt||(h.current=!1,c(p.current,void 0))});return De(()=>{if(!a||c===qt){y();return}let v;if(t!==void 0)b.current=!0,v=t;else if(b.current)v=f;else{d();return}if(v===void 0){y();return}h.current=!0,c(p.current,v)},[t,a,c,d,f,p,y]),De(()=>y,[y]),(a?o:void 0)??t??f}function gB(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:xB,platform:bB,maxTouchPoints:vB}=gB(),Hm=xB.toLowerCase(),Kd=bB.toLowerCase(),Yd=/^i(os$|p)/.test(Kd)||Kd==="macintel"&&vB>1,WC="android",Um=Kd===WC||Hm.includes(WC),JC=!Yd&&Kd.startsWith("mac");Kd.startsWith("win");const yB=JC||Yd,yl=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),e1=!yl&&Hm.includes("firefox");!yl&&Hm.includes("chrom");const wB=yB,Hv=/jsdom|happydom/.test(Hm);function or(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Bc(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function cs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Uv="data-base-ui-focusable",t1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ji="ArrowLeft",Si="ArrowRight",Vv="ArrowUp",Vm="ArrowDown",n1="data-starting-style",jB="data-ending-style",SB={[n1]:""},NB={[jB]:""},oo={transitionStatus(e){return e==="starting"?SB:e==="ending"?NB:null}},kB="data-open",CB="data-closed",TB="data-anchor-hidden",s1="data-popup-open",EB="data-pressed",AB={[s1]:""},RB={[s1]:"",[EB]:""},OB={[kB]:""},MB={[CB]:""},DB={[TB]:""},Fv={open(e){return e?AB:null}},$v={open(e){return e?RB:null}},$c={open(e){return e?OB:MB},anchorHidden(e){return e?DB:null}},qv={...$c,...oo},Gv="data-trigger-disabled";function Fm(e,t){if(!At(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute(Gv);for(const[,o]of t.entries())if(Qe(o,a))return!o.hasAttribute(Gv);return!1}function Kv(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function IB(e){return e.matches("html,body")}function $m(e){return dn(e)&&e.matches(t1)}function PB(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${t1}`)!=null}function Yv(e){return e?e.getAttribute("role")==="combobox"&&$m(e):!1}function _B(e){if(!e||Hv)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function qm(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}function io(e,t,a=!0){return e.filter(c=>c.parentId===t).flatMap(c=>[...!a||c.context?.open?[c]:[],...io(e,c.id,a)])}function r1(e,t){let a=[],o=e.find(c=>c.id===t)?.parentId;for(;o;){const c=e.find(d=>d.id===o);o=c?.parentId,c&&(a=a.concat(c))}return a}function ks(e){e.preventDefault(),e.stopPropagation()}function LB(e){return"nativeEvent"in e}function Gm(e){return e.pointerType===""&&e.isTrusted?!0:Um&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Xv(e){return Hv?!1:!Um&&e.width===0&&e.height===0||Um&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function co(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function zB(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const qc=Math.min,wl=Math.max,Km=Math.round,Ni=Math.floor,jl=e=>({x:e,y:e}),BB={left:"right",right:"left",bottom:"top",top:"bottom"};function a1(e,t,a){return wl(e,qc(t,a))}function uo(e,t){return typeof e=="function"?e(t):e}function ta(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Qv(e){return e==="x"?"y":"x"}function Zv(e){return e==="y"?"height":"width"}function na(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wv(e){return Qv(na(e))}function HB(e,t,a){a===void 0&&(a=!1);const o=Sl(e),c=Wv(e),d=Zv(c);let f=c==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(f=Ym(f)),[f,Ym(f)]}function UB(e){const t=Ym(e);return[Jv(e),t,Jv(t)]}function Jv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const l1=["left","right"],o1=["right","left"],VB=["top","bottom"],FB=["bottom","top"];function $B(e,t,a){switch(e){case"top":case"bottom":return a?t?o1:l1:t?l1:o1;case"left":case"right":return t?VB:FB;default:return[]}}function qB(e,t,a,o){const c=Sl(e);let d=$B(ta(e),a==="start",o);return c&&(d=d.map(f=>f+"-"+c),t&&(d=d.concat(d.map(Jv)))),d}function Ym(e){const t=ta(e);return BB[t]+e.slice(t.length)}function GB(e){var t,a,o,c;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(o=e.bottom)!=null?o:0,left:(c=e.left)!=null?c:0}}function i1(e){return typeof e!="number"?GB(e):{top:e,right:e,bottom:e,left:e}}function Xd(e){const{x:t,y:a,width:o,height:c}=e;return{width:o,height:c,top:a,left:t,right:t+o,bottom:a+c,x:t,y:a}}function Xm(e,t,a){return Math.floor(e/t)!==a}function fo(e,t){return t<0||t>=e.length}function Qm(e,t){return Is(e.current,{disabledIndices:t})}function ey(e,t){return Is(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Is(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:c=1}={}){let d=t;do d+=a?-c:c;while(d>=0&&d<=e.length-1&&po(e,d,o));return d}function KB(e,{event:t,orientation:a,loopFocus:o,onLoop:c,rtl:d,cols:f,disabledIndices:p,minIndex:h,maxIndex:b,prevIndex:y,stopEvent:v=!1}){let w=y,j;if(t.key===Vv?j="up":t.key===Vm&&(j="down"),j){const S=[],N=[];let k=!1,T=0;{let _=null,L=-1;e.forEach((H,B)=>{if(H==null)return;T+=1;const z=H.closest('[role="row"]');z&&(k=!0),(z!==_||L===-1)&&(_=z,L+=1,S[L]=[]),S[L].push(B),N[B]=L})}let D=!1,C=0;if(k)for(const _ of S){const L=_.length;L>C&&(C=L),L!==f&&(D=!0)}const A=D&&T{if(!D||y===-1)return;const L=N[y];if(L==null)return;const H=S[L].indexOf(y),B=_==="up"?-1:1;for(let z=L+B,Q=0;Q=S.length){if(!o||A)return;if(z=z<0?S.length-1:0,c){const X=Math.min(H,S[z].length-1),q=S[z][X]??S[z][0],$=c(t,y,q);z=N[$]??z}}const K=S[z];for(let X=Math.min(H,K.length-1);X>=0;X-=1){const q=K[X];if(!po(e,q,p))return q}}},P=_=>{if(!A||y===-1)return;const L=y%R,H=_==="up"?-R:R,B=b-b%R,z=Ni(b/R)+1;for(let Q=y-L+H,K=0;Kb){if(!o)return;Q=Q<0?B:0}const X=Math.min(Q+R-1,b);for(let q=Math.min(Q+L,X);q>=Q;q-=1)if(!po(e,q,p))return q}};v&&ks(t);const O=I(j)??P(j);if(O!==void 0)w=O;else if(y===-1)w=j==="up"?b:h;else if(w=Is(e,{startingIndex:y,amount:R,decrement:j==="up",disabledIndices:p}),o){if(j==="up"&&(y-R_?H:H-R,c&&(w=c(t,y,w))}j==="down"&&y+R>b&&(w=Is(e,{startingIndex:y%R-R,amount:R,disabledIndices:p}),c&&(w=c(t,y,w)))}fo(e,w)&&(w=y)}if(a==="both"){const S=Ni(y/f);t.key===(d?ji:Si)&&(v&&ks(t),y%f!==f-1?(w=Is(e,{startingIndex:y,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y)),t.key===(d?Si:ji)&&(v&&ks(t),y%f!==0?(w=Is(e,{startingIndex:y,decrement:!0,disabledIndices:p}),o&&Xm(w,f,S)&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w)))):o&&(w=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(w=c(t,y,w))),Xm(w,f,S)&&(w=y));const N=Ni(b/f)===S;fo(e,w)&&(o&&N?(w=t.key===(d?Si:ji)?b:Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(w=c(t,y,w))):w=y)}return w}function po(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const c=e[t];return c?!Zm(c)||c.matches(":disabled")?!0:!a&&(c.hasAttribute("disabled")||c.getAttribute("aria-disabled")==="true"):!1}function YB(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zm(e,t=e?xr(e):null){return!e||!e.isConnected||!t||YB(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const XB='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function QB(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Bc(a)?a.host:null}function ty(e){for(const t of Array.from(e.children))if(Hs(t)==="summary")return t;return null}function ZB(e,t){const a=ty(t);return!!a&&(e===a||Qe(a,e))}function c1(e){const t=e?Hs(e):"";return e!=null&&e.matches(XB)&&(t!=="summary"||e.parentElement!=null&&Hs(e.parentElement)==="details"&&ty(e.parentElement)===e)&&(t!=="details"||ty(e)==null)&&(t!=="input"||e.type!=="hidden")}function u1(e){if(!c1(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=QB(t)){const a=t!==e,o=Hs(t)==="slot";if(t.hasAttribute("inert")||a&&Hs(t)==="details"&&!t.open&&!ZB(e,t)||t.hasAttribute("hidden")||!o&&!WB(t,a))return!1}return!0}function WB(e,t){const a=xr(e);return t?a.display!=="none":Zm(e,a)}function d1(e){const t=e.tabIndex;if(t<0){const a=Hs(e);if(a==="details"||a==="audio"||a==="video"||dn(e)&&e.isContentEditable)return 0}return t}function ny(e){if(Hs(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function JB(e,t){const a=ny(e);if(!a)return!0;const o=t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form&&d.checked});return o?o===a:t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form})===a}function f1(e){if(dn(e)&&Hs(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function p1(e,t){f1(e).forEach(a=>{c1(a)&&t.push(a),p1(a,t)})}function m1(e,t,a){f1(e).forEach(o=>{dn(o)&&o.matches(t)&&a.push(o),m1(o,t,a)})}function sy(e){return u1(e)&&d1(e)>=0}function h1(e){const t=[];return p1(e,t),t.filter(u1)}function Qd(e){const t=h1(e);return t.filter(a=>d1(a)>=0&&JB(a,t))}function g1(e,t){const a=Qd(e),o=a.length;if(o===0)return;const c=or($t(e)),d=a.indexOf(c),f=d===-1?t===1?0:o-1:d+t;return a[f]}function ry(e){return g1($t(e).body,1)||e}function x1(e){return g1($t(e).body,-1)||e}function b1(e,t){if(!e)return null;const a=Qd($t(e).body),o=a.length;if(o===0)return null;const c=a.indexOf(e);if(c===-1)return null;const d=(c+t+o)%o;return a[d]}function e4(e){return b1(e,1)}function t4(e){return b1(e,-1)}function Gc(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(a,o)}function n4(e){Qd(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function v1(e){const t=[];m1(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function ay(e){x.useEffect(e,Or)}const Zd=0;class sa{constructor(){ln(this,"currentId",Zd);ln(this,"clear",()=>{this.currentId!==Zd&&(clearTimeout(this.currentId),this.currentId=Zd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new sa}start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zd,a()},t)}isStarted(){return this.currentId!==Zd}}function Zs(){const e=Ds(sa.create).current;return ay(e.disposeEffect),e}function s4(e,t){return e.matches(":disabled")?!1:!t||e.form===t?!0:e.form===null&&!e.hasAttribute("form")}const r4=x.createContext({disabled:!1});function y1(){return x.useContext(r4)}var ly={exports:{}},Us={};var w1;function a4(){if(w1)return Us;w1=1;var e=Vd();function t(y){var v="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ly.exports=a4(),ly.exports}var Cs=S1();const Wm=null;class l4{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let c=0;c=this.callbacks.length||this.callbacks[a]!==null&&(this.callbacks[a]=null,this.callbacksCount-=1)}}let Jm=new l4;class qa{constructor(){ln(this,"currentId",Wm);ln(this,"cancel",()=>{this.currentId!==Wm&&(Jm.cancel(this.currentId),this.currentId=Wm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new qa}static request(t){return Jm.request(t)}static cancel(t){return Jm.cancel(t)}request(t){this.cancel(),this.currentId=Jm.request(()=>{this.currentId=Wm,t()})}}function Kc(){const e=Ds(qa.create).current;return ay(e.disposeEffect),e}function Nl(e){return e==null?e:"current"in e?e.current:e}let eh=null;function o4(e){if(!eh){const t=[];eh=t,queueMicrotask(()=>{eh=null,Cs.flushSync(()=>{for(const a of t)a()})})}eh.push(e)}function N1(e,t=!1,a=!1){const o=Kc();return Ie((c,d=null)=>{o.cancel();const f=Nl(e);if(f==null)return;const p=f,h=()=>{if(!a){Cs.flushSync(c);return}o4(()=>{d?.aborted||c()})};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){c();return}function b(){Promise.all(p.getAnimations().map(y=>y.finished)).then(()=>{d?.aborted||h()},()=>{if(d?.aborted)return;if(p.getAnimations().some(v=>v.pending||v.playState!=="finished")){b();return}h()})}if(t){const y=n1;if(!p.hasAttribute(y)){o.request(b);return}const v=new MutationObserver(()=>{p.hasAttribute(y)||(v.disconnect(),b())});v.observe(p,{attributes:!0,attributeFilter:[y]}),d?.addEventListener("abort",()=>v.disconnect(),{once:!0});return}o.request(b)})}function ra(e){const{enabled:t=!0,open:a,ref:o,batch:c=!1,onComplete:d}=e,f=Ie(d),p=N1(o,a,c);x.useEffect(()=>{if(!t)return;const h=new AbortController;return p(f,h.signal),()=>{h.abort()}},[t,a,f,p])}function ki(e,t=!1,a=!1,o=!1){const[c,d]=x.useState(e&&t?"idle":void 0),[f,p]=x.useState(e&&!o);return e&&!f&&(p(!0),d("starting")),!e&&f&&c!=="ending"&&!a&&d("ending"),!e&&!f&&c==="ending"&&d(void 0),De(()=>{if(!e&&f&&c!=="ending"&&a){const h=qa.request(()=>{d("ending")});return()=>{qa.cancel(h)}}},[e,f,c,a]),De(()=>{if(!e||t)return;const h=qa.request(()=>{d(void 0)});return()=>{qa.cancel(h)}},[t,e]),De(()=>{if(!e||!t)return;e&&f&&c!=="idle"&&d("starting");const h=qa.request(()=>{d("idle")});return()=>{qa.cancel(h)}},[t,e,f,c]),{mounted:f,setMounted:p,transitionStatus:c}}function Ga({controlled:e,default:t,name:a,state:o="value"}){const{current:c}=x.useRef(e!==void 0),[d,f]=x.useState(t),p=c&&e!==void 0?e:d,h=x.useCallback(b=>{c||f(b)},[]);return[p,h]}function Yc(e,t,a,o,c=!0,d){const{registerFieldControl:f}=Sa(),p=Ds(()=>Symbol());De(()=>{const h=p.current;if(!c){f(h,void 0);return}f(h,{controlRef:e,getValue:o,id:t,name:d,value:a})},[e,c,o,t,d,f,p,a]),De(()=>{const h=p.current;return()=>{f(h,void 0)}},[f,p])}function aa(e,t){const a=x.useRef(e),o=Ie(t);De(()=>{a.current!==e&&o(a.current),a.current=e},[e,o])}const Yn="none",mo="trigger-press",Vs="trigger-hover",th="trigger-focus",nh="outside-press",Wd="item-press",oy="close-press",Jd="input-change",Ka="input-clear",i4="input-press",ho="focus-out",Xc="escape-key",iy="list-navigation",k1="keyboard",C1="pointer",T1="cancel-open",c4="disabled",cy="imperative-action",u4="window-resize";function Fe(e,t,a,o){let c=!1,d=!1;const f=o??fn;return{reason:e,event:t??new Event("base-ui"),cancel(){c=!0},allowPropagation(){d=!0},get isCanceled(){return c},get isPropagationAllowed(){return d},trigger:a,...f}}function d4(e,t,a){const o=a??fn;return{reason:e,event:t??new Event("base-ui"),...o}}const f4=x.forwardRef(function(t,a){const{render:o,className:c,id:d,name:f,value:p,disabled:h=!1,onValueChange:b,defaultValue:y,autoFocus:v=!1,style:w,...j}=t,{state:S,name:N,disabled:k,setTouched:T,setDirty:D,validityData:C,setFocused:A,setFilled:R,validationMode:I,validation:P}=Sa(),{clearErrors:O,elementRef:_,submitCountRef:L}=Fc(),H=k||h,B=N??f,z={...S,disabled:H},{labelId:Q}=vl(),K=lo({id:d}),[X]=Ga({controlled:p,default:y,name:"FieldControl",state:"value"}),q=p!==void 0,$=q?X:void 0,Y=$==null?void 0:String($),F=Ie(()=>P.inputRef.current?.value);Yc(P.inputRef,K,Y,F,!H,f),De(()=>{const M=Y??P.inputRef.current?.value;M!==void 0&&R(M!=="")},[Y,P.inputRef,R]),aa(Y,()=>{Y!==void 0&&(O(B),D(Y!==(C.initialValue??"")),P.change(Y))});const G=x.useRef(null),W=Zs();return De(()=>{v&&G.current===or($t(G.current))&&A(!0)},[v,A]),yt("input",t,{ref:[a,G],state:z,props:[{id:K,disabled:H,name:B,ref:P.inputRef,"aria-labelledby":Q,autoFocus:v,...q?{value:$}:{defaultValue:y},onChange(M){const U=M.currentTarget.value,Z=Fe(Yn,M.nativeEvent);b?.(U,Z),!q&&(D(U!==(C.initialValue??"")),R(U!==""),!M.nativeEvent.defaultPrevented&&!Z.isCanceled&&(O(B),P.change(U)))},onFocus(){A(!0)},onBlur(M){if(T(!0),A(!1),I==="onBlur"){const U=M.currentTarget.value;P.commit(U),q&&queueMicrotask(()=>{const Z=P.inputRef.current?.value;Z!==void 0&&Z!==U&&Z!==(C.initialValue??"")&&P.commit(Z)})}},onKeyDown(M){if(M.currentTarget.tagName==="INPUT"&&M.key==="Enter"){T(!0);const U=M.currentTarget.value,Z=M.currentTarget.form;if(Z&&Z===_.current&&!M.defaultPrevented){const ae=M.currentTarget,ce=L.current;W.start(0,()=>{L.current===ce&&P.commit(ae.value)})}else P.commit(U)}}},j,M=>P.getValidationProps(H,M)],stateAttributesMapping:wi})}),p4=x.forwardRef(function(t,a){return s.jsx(f4,{ref:a,...t})});function $e({className:e,type:t,ref:a,...o}){return s.jsx(p4,{ref:a,type:t,"data-slot":"input",className:Ue("h-[30px] w-full min-w-0 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground","file:inline-flex file:border-0 file:bg-transparent file:text-foreground",e),...o})}function Qc({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:Ue("min-h-26 w-full resize-y rounded-md border border-control-border bg-control px-3 py-2.5","font-mono text-[12px] leading-[1.6] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground",e),...t})}function Ci({className:e,...t}){return s.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("group/input-group relative flex h-[30px] w-full min-w-0 items-center rounded-md border border-control-border bg-control","transition-[border-color,box-shadow] duration-150 ease-out","outline-none","has-[[data-slot=input-group-control]:focus-visible]:border-primary","has-[[data-slot=input-group-control]:focus-visible]:shadow-focus","has-[[data-slot=input-group-control]:hover:not(:focus-visible)]:border-control-border-hover","has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-1.5","has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-1.5","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-1.5","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-1.5",e),...t})}const m4=Vc(["flex h-auto cursor-text items-center justify-center gap-1.5 select-none","text-[12px] font-medium text-muted-foreground","group-data-[disabled=true]/input-group:opacity-50"],{variants:{align:{"inline-start":"order-first pl-[9px] has-[>button]:-ml-1","inline-end":"order-last pr-[9px] has-[>button]:-mr-1","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-1.5","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-1.5"}},defaultVariants:{align:"inline-start"}});function Ti({className:e,align:t="inline-start",...a}){return s.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(m4({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus()},...a})}const h4=Vc("flex items-center shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-xs px-1.5",sm:"h-8 gap-1.5 rounded-sm px-2.5","icon-xs":"size-6 rounded-xs p-0","icon-sm":"size-8 rounded-sm p-0"}},defaultVariants:{size:"xs"}});function g4({className:e,type:t="button",variant:a="ghost",size:o="xs",...c}){return s.jsx(se,{type:t,"data-size":o,variant:a,className:Ue(h4({size:o}),e),...c})}function Ei({className:e,...t}){return s.jsx($e,{"data-slot":"input-group-control",className:Ue("flex-1 rounded-none border-0 bg-transparent shadow-none focus:border-0 focus:shadow-none",e),...t})}function x4(e){return yt(e.defaultTagName??"div",e,e)}const b4=Vc("inline-flex w-fit shrink-0 items-center justify-center gap-[5px] overflow-hidden whitespace-nowrap border font-semibold",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive",outline:"border-control-border bg-control text-subtle",ghost:"border-transparent bg-transparent text-muted-foreground",link:"border-transparent bg-transparent text-primary underline-offset-4 hover:underline",success:"border-success-bd bg-success-soft text-success",warning:"border-warning-bd bg-warning-soft text-warning",info:"border-info-bd bg-info-soft text-info",brand:"border-primary-bd bg-primary-soft text-primary-fg",cn:"border-cn-bd bg-cn-soft text-cn",intl:"border-intl-bd bg-intl-soft text-intl",sensitive:"border-sensitive-bd bg-sensitive-soft text-sensitive"},shape:{pill:"min-h-[21px] rounded-pill px-[9px] py-px text-[11.5px]",tag:"min-h-[19px] rounded-xs px-2 py-0 text-[11px]"}},defaultVariants:{variant:"default",shape:"pill"}});function ze({className:e,variant:t,shape:a,render:o,...c}){return x4({render:o,defaultTagName:"span",props:Wr({"data-slot":"badge"},c,{className:Ue(b4({variant:t,shape:a}),e)})})}function uy({className:e,...t}){return s.jsx("span",{className:Ue("size-1.5 flex-none rounded-full bg-current",e),...t})}function go(e,t){if(typeof window>"u")return e;const a=window.wbI18n;return a?a.t(e,t)??e:e}function ef({className:e,...t}){return s.jsx("svg",{"data-slot":"spinner",role:"status","aria-label":go("加载中"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:Ue("size-4 animate-spin [animation-duration:0.7s]",e),...t,children:s.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function Je({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:Ue("flex items-center gap-[6px] text-[11.5px] text-muted-foreground",e),...t})}const E1={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ai={...E1,position:"fixed",top:0,left:0},Zc={...E1,position:"absolute"},A1=x.createContext(void 0);function v4(){const e=x.useContext(A1);if(e===void 0)throw new Error(on(63));return e}const y4="data-checked",w4="data-unchecked",R1={...wi,checked(e){return e?{[y4]:""}:{[w4]:""}}},j4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d,"aria-labelledby":f,form:p,id:h,inputRef:b,name:y,nativeButton:v=!1,onCheckedChange:w,readOnly:j=!1,required:S=!1,disabled:N=!1,render:k,uncheckedValue:T,value:D,style:C,...A}=t,{clearErrors:R}=Fc(),{state:I,setTouched:P,setDirty:O,validityData:_,setFilled:L,setFocused:H,validationMode:B,disabled:z,name:Q,validation:K}=Sa(),{labelId:X}=vl(),q=z||N,$=Q??y,Y=x.useRef(null),F=ea(Y,b,K.inputRef),G=x.useRef(null),W=Na(),le=lo({id:h}),M=v?void 0:le,[U,Z]=Ga({controlled:o,default:!!d,name:"Switch",state:"checked"});Yc(G,W,U,void 0,!q,y),De(()=>{L(U)},[U,L]),aa(U,()=>{R($),O(U!==_.initialValue),K.change(U)});const{getButtonProps:ae,buttonRef:ce}=Jr({disabled:q,native:v}),J=Bv(f,X,Y,!v,M),ie={id:v?le:W,role:"switch","aria-checked":U,"aria-readonly":j||void 0,"aria-required":S||void 0,"aria-labelledby":J,onFocus(){q||H(!0)},onBlur(){const te=Y.current;!te||q||(P(!0),H(!1),B==="onBlur"&&K.commit(te.checked))},onClick(te){if(j||q)return;te.preventDefault();const Ce=Y.current;Ce&&Uc(Ce,te)}},ge={...K.getValidationProps(q),checked:U,disabled:q,form:p,id:M,name:$,required:S,style:$?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(te){if(te.nativeEvent.defaultPrevented)return;if(j){te.preventDefault();return}const Ce=te.currentTarget.checked,re=Fe(Yn,te.nativeEvent);w?.(Ce,re),!re.isCanceled&&Z(Ce)},onClick(te){te.stopPropagation()},onFocus(){G.current?.focus()},...D!==void 0?{value:D}:fn},ee=x.useMemo(()=>({...I,checked:U,disabled:q,readOnly:j,required:S}),[I,U,q,j,S]),fe=yt("span",t,{state:ee,ref:[a,G,ce],props:[ie,A,ae,te=>K.getValidationProps(q,te)],stateAttributesMapping:R1});return s.jsxs(A1.Provider,{value:ee,children:[fe,!U&&$&&T!==void 0&&s.jsx("input",{type:"hidden",form:p,name:$,value:T,disabled:q}),s.jsx("input",{...ge,suppressHydrationWarning:!0})]})}),S4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=v4();return yt("span",t,{state:p,ref:a,stateAttributesMapping:R1,props:f})});function hs({className:e,size:t="default",...a}){const o=t==="sm";return s.jsx(j4,{"data-slot":"switch",className:Ue("relative inline-flex flex-none cursor-pointer items-center rounded-pill border-0 bg-border-strong p-0","transition-colors duration-[180ms] ease-out","data-checked:bg-primary","focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:opacity-50",o?"h-[14px] w-6":"h-[21px] w-9",e),...a,children:s.jsx(S4,{"data-slot":"switch-thumb",className:Ue("block rounded-full bg-primary-on shadow-1","transition-transform duration-[180ms] [transition-timing-function:cubic-bezier(.3,1.4,.6,1)]",o?"size-[10px] translate-x-0.5 data-checked:translate-x-[10px]":"size-[17px] translate-x-0.5 data-checked:translate-x-[15px]")})})}function N4(e){if(!e)return null;for(const t of e.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const o=t;if(o.type==="submit")return o}}return null}const k4="data-checked",C4="data-unchecked";function O1(e){return{checked(t){return e.indeterminate?{}:t?{[k4]:""}:{[C4]:""}},...wi}}const T4=x.createContext(void 0);function E4(){return x.useContext(T4)}const M1=x.createContext(void 0);function A4(){const e=x.useContext(M1);if(e===void 0)throw new Error(on(14));return e}const R4="data-parent",O4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d=!1,"aria-labelledby":f,disabled:p=!1,form:h,id:b,indeterminate:y=!1,inputRef:v,name:w,onCheckedChange:j,parent:S=!1,readOnly:N=!1,render:k,required:T=!1,uncheckedValue:D,value:C,nativeButton:A=!1,style:R,...I}=t,{clearErrors:P}=Fc(),{disabled:O,name:_,setDirty:L,setFilled:H,setFocused:B,setTouched:z,state:Q,validationMode:K,validityData:X,validation:q}=Sa(),$=y1(),{labelId:Y,registerControlId:F,getDescriptionProps:G}=vl(),W=E4(),le=W?.allValues===void 0?void 0:W.parent,M=le!==void 0,U=O||$.disabled||W?.disabled||p,Z=_??w,ae=C??Z,ce=Na(),J=W?.registerControlId!==F,ie=lo({id:b||void 0,enabled:J}),ge=A?ie:ce;let ee={};M&&(S?ee=le.getParentProps():ae!==void 0&&(ee=le.getChildProps(ae)));const{checked:fe=o,indeterminate:te=y,onCheckedChange:Ce,...re}=ee,de=W?.value,ke=x.useRef(null),{getButtonProps:Ee,buttonRef:ve}=Jr({disabled:U,native:A}),he=W?.validation??q,[ye,je]=Ga({controlled:ae!==void 0&&de!==void 0&&!S?de.includes(ae):fe,default:d,name:"Checkbox",state:"checked"}),xe=M?!!fe:ye,Te=M&&te||y;Yc(ke,ce,ye,void 0,!W&&!U,w);const Oe=le?.registerChildId,Ne=x.useRef(null),_e=he.registerInput,Ye=W?ae:void 0,kt=x.useCallback(it=>_e(it,{controlRef:ke,value:Ye}),[_e,Ye]),Ct=ea(v,Ne,S?void 0:kt),Rt=Bv(f,Y,Ne,!A,ie);De(()=>{Ne.current&&(Ne.current.indeterminate=Te),W||H(ye)},[ye,Te,W,H]),aa(ye,()=>{W||(P(Z),L(ye!==X.initialValue),he.change(ye))});const ot=Wr({checked:ye,disabled:U,form:h,name:S?void 0:Z,id:A?void 0:ie,required:T,ref:Ct,style:Z?Zc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(it){if(it.nativeEvent.defaultPrevented)return;if(N){it.preventDefault();return}const Vt=it.currentTarget.checked,Hn=Fe(Yn,it.nativeEvent);if(j?.(Vt,Hn),!Hn.isCanceled&&(Ce?.(Vt,Hn),!Hn.isCanceled&&(je(Vt),ae!==void 0&&W!==void 0&&!S&&!M))){const tn=Vt?[...W.value,ae]:W.value.filter(nt=>nt!==ae);W.setValue(tn,Hn)}},onClick(it){it.stopPropagation()},onFocus(){ke.current?.focus()}},C!==void 0?{value:(W?ye&&C:C)||""}:fn,G,it=>he.getValidationProps(U,it));x.useEffect(()=>{if(!le||ae===void 0)return;const it=le.disabledStatesRef.current;return it.set(ae,U),()=>{it.delete(ae)}},[le,U,ae]);const qn=x.useMemo(()=>({...Q,checked:xe,disabled:U,readOnly:N,required:T,indeterminate:Te}),[Q,xe,U,N,T,Te]),fs=O1(qn),Gn=yt("span",t,{state:qn,ref:[ve,ke,a],props:[{id:ge,role:"checkbox","aria-checked":Te?"mixed":xe,"aria-readonly":N||void 0,"aria-required":T||void 0,"aria-labelledby":Rt,[R4]:S?"":void 0,onFocus(){U||B(!0)},onBlur(){const it=Ne.current;it&&(z(!0),B(!1),K==="onBlur"&&he.commit(W?de:it.checked))},onKeyDown(it){if(it.key!=="Enter"||(it.preventBaseUIHandler(),it.defaultPrevented))return;const Vt=Ne.current?.form??null,Hn=it.currentTarget,tn=it.nativeEvent,nt=it.preventDefault,Ot=tn.preventDefault;let Ft=!1;it.preventDefault=()=>{Ft=!0,nt.call(it)},tn.preventDefault=()=>{Ft=!0,Ot.call(tn)},Ot.call(tn),Sn(Hn).queueMicrotask(()=>{it.preventDefault=nt,tn.preventDefault=Ot,Ft||N4(Vt)?.click()})},onClick(it){if(N||U)return;it.preventDefault();const Vt=Ne.current;Vt&&Uc(Vt,it)}},I,re,Ee,G,it=>he.getValidationProps(U,it)],stateAttributesMapping:fs}),bs=Gn.props.id;return De(()=>{if(!(!Oe||S||ae===void 0||bs===void 0))return Oe(ae,bs)},[Oe,S,ae,bs]),s.jsxs(M1.Provider,{value:qn,children:[Gn,!ye&&!W&&Z&&!S&&D!==void 0&&s.jsx("input",{type:"hidden",form:h,name:Z,value:D,disabled:U}),s.jsx("input",{...ot,suppressHydrationWarning:!0})]})}),M4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=A4(),b=h.checked||h.indeterminate,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j=x.useRef(null),S={...h,transitionStatus:v};ra({batch:!0,enabled:!b,open:b,ref:j,onComplete(){b||w(!1)}});const k={...O1(h),...oo},T=f||y,D=yt("span",t,{ref:[a,j],state:S,stateAttributesMapping:k,props:p});return T?D:null});function Mr({className:e,...t}){return s.jsx(O4,{"data-slot":"checkbox",className:Ue("group/checkbox relative inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(M4,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-primary-foreground data-unchecked:hidden",children:s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-2.5","aria-hidden":"true",children:[s.jsx("path",{d:"M2 6h8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none",className:"hidden group-aria-[checked=indeterminate]/checkbox:block"}),s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:"group-aria-[checked=indeterminate]/checkbox:hidden"})]})})})}function dy(e){return Array.isArray(e)?e.map(t=>dy(t)).join(","):e==null?"":String(e)}const D1=new Map;function D4(e,t){const a=JSON.stringify({locale:dy(e),options:t}),o=D1.get(a);if(o)return o;const c=new Intl.NumberFormat(e,t);return D1.set(a,c),c}function I1(e,t,a){return e==null?"":D4(t,a).format(e)}function Ri(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}function I4(e,t,a){return(e-t)*100/(a-t)}const P1=x.createContext(void 0);function _1(){const e=x.useContext(P1);if(e===void 0)throw new Error(on(51));return e}const P4="data-complete",_4="data-indeterminate",L4="data-progressing",fy={status(e){return e==="progressing"?{[L4]:""}:e==="complete"?{[P4]:""}:e==="indeterminate"?{[_4]:""}:null}},z4=x.forwardRef(function(t,a){const{format:o,getAriaValueText:c,locale:d,max:f=100,min:p=0,value:h,render:b,className:y,children:v,style:w,...j}=t,[S,N]=x.useState();let k="indeterminate",T=null,D=null,C="",A="indeterminate progress";if(h!=null&&Number.isFinite(h)){const _=I4(h,p,f);T=Ri(Number.isNaN(_)?0:_,0,100),D=Ri(h,p,f),k=D===f?"complete":"progressing",C=o?I1(D,d,o):I1(T/100,d,{style:"percent"}),A=C}const R=x.useMemo(()=>({status:k}),[k]),I={"aria-labelledby":S,"aria-valuemax":f,"aria-valuemin":p,"aria-valuenow":D??void 0,"aria-valuetext":c?c(C,h):A,role:"progressbar",children:s.jsxs(x.Fragment,{children:[v,s.jsx("span",{role:"presentation",style:Ai,children:"x"})]})},P=x.useMemo(()=>({formattedValue:C,percentageValue:T,setLabelId:N,state:R,value:h}),[C,T,N,R,h]),O=yt("div",t,{state:R,ref:a,props:[I,j],stateAttributesMapping:fy});return s.jsx(P1.Provider,{value:P,children:O})}),B4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{state:p}=_1();return yt("div",t,{state:p,ref:a,props:f,stateAttributesMapping:fy})}),H4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{percentageValue:p,state:h}=_1(),b=p==null?{}:{insetInlineStart:0,height:"inherit",width:`${p}%`};return yt("div",t,{state:h,ref:a,props:[{style:b},f],stateAttributesMapping:fy})});function tf({className:e,children:t,value:a,...o}){return s.jsxs(z4,{value:a,"data-slot":"progress",className:Ue("flex w-full flex-wrap items-center gap-3",e),...o,children:[t,s.jsx(U4,{children:s.jsx(V4,{})})]})}function U4({className:e,...t}){return s.jsx(B4,{"data-slot":"progress-track",className:Ue("relative flex h-1.5 w-full items-center overflow-x-hidden overflow-y-hidden rounded-pill bg-surface-3",e),...t})}function V4({className:e,...t}){return s.jsx(H4,{"data-slot":"progress-indicator",className:Ue("h-full rounded-[inherit] bg-primary transition-[width] duration-300 ease-out",e),...t})}const py=[];let my;function F4(){return my}function $4(e){py.push(e)}function sh(e){const t=(a,o)=>{const c=Ds(q4).current;let d;try{my=c;for(const f of py)f.before(c);d=e(a,o);for(const f of py)f.after(c);c.didInitialize=!0}finally{my=void 0}return d};return t.displayName=e.displayName||e.name,t}function L1(e){return x.forwardRef(sh(e))}function q4(){return{didInitialize:!1}}const z1=x.createContext(void 0);function nf(e){const t=x.useContext(z1);if(t===void 0&&!e)throw new Error(on(72));return t}function G4(e,t){return t!=null&&!co(t)?0:typeof e=="function"?e():e}function Oi(e,t,a){const o=G4(e,a);return typeof o=="number"?o:o?.[t]}function B1(e){return typeof e=="function"?e():e}function H1(e,t){return t||e==="click"||e==="mousedown"}function K4(e){return e?.includes("mouse")&&e!=="mousedown"}const U1=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new sa,currentIdRef:{current:null},currentContextRef:{current:null}});function Y4(e,t){e.current=t.current}function X4(e){const{children:t,delay:a,timeoutMs:o=0}=e,c=x.useRef(a),d=x.useRef(a),f=x.useRef(null),p=x.useRef(null),h=Zs();return De(()=>{if(d.current=a,!f.current){c.current=a;return}c.current={open:Oi(c.current,"open"),close:Oi(a,"close")}},[a,f,c,d]),s.jsx(U1.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:c,initialDelayRef:d,currentIdRef:f,timeoutMs:o,currentContextRef:p,timeout:h}),[o,h]),children:t})}function Q4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,c=o.useState("floatingId"),d=x.useContext(U1),{currentIdRef:f,delayRef:p,timeoutMs:h,initialDelayRef:b,currentContextRef:y,hasProvider:v,timeout:w}=d,[j,S]=x.useState(!1),N=x.useRef(a);return De(()=>{N.current=a},[a]),De(()=>{function k(){y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,p.current=b.current,w.clear()}if(f.current&&!a&&f.current===c){if(S(!1),h){const T=c;return w.start(h,()=>{o.select("open")||f.current&&f.current!==T||k()}),()=>{(N.current||f.current!==T)&&w.clear()}}k()}},[a,c,f,p,h,b,y,w,o]),De(()=>{if(!a)return;const k=y.current,T=f.current;w.clear(),y.current={onOpenChange:o.setOpen,setIsInstantPhase:S},f.current=c,p.current={open:0,close:Oi(b.current,"close")},T!==null&&T!==c?(S(!0),k?.setIsInstantPhase(!0),k?.onOpenChange(!1,Fe(Yn))):(S(!1),k?.setIsInstantPhase(!1))},[a,c,o,f,p,b,y,w]),De(()=>()=>{if(f.current===c){if(y.current=null,!N.current)return;f.current=null,Y4(p,b),w.clear()}},[y,f,p,c,b,w]),x.useMemo(()=>({activeIdRef:f,hasProvider:v,delayRef:p,isInstantPhase:j}),[f,v,p,j])}function St(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function Ya(...e){return()=>{for(let t=0;t{t.current=t.next}};return t}const Wc=x.forwardRef(function(t,a){const[o,c]=x.useState();De(()=>{wB&&yl&&c("button")},[]);const d={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Ai,"aria-hidden":o?void 0:!0,...d,"data-base-ui-focus-guard":""})});function sf(e){return`data-base-ui-${e}`}let rh=0;function ah(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:c}=t;cancelAnimationFrame(rh);function d(){c&&!c()||e?.focus({preventScroll:a})}if(o)return d(),qt;const f=requestAnimationFrame(d);return rh=f,()=>{rh===f&&(cancelAnimationFrame(f),rh=0)}}const hy={inert:new WeakMap,"aria-hidden":new WeakMap},V1="data-base-ui-inert",gy={inert:new WeakSet,"aria-hidden":new WeakSet};let rf=new WeakMap,xy=0;function W4(e){return gy[e]}function F1(e){return e?Bc(e)?e.host:F1(e.parentNode):null}const $1=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=F1(a);return e.contains(o)?o:null}).filter(a=>a!=null),q1=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},G1=(e,t,a)=>{const o=[],c=d=>{!d||a.has(d)||Array.from(d.children).forEach(f=>{Hs(f)!=="script"&&(t.has(f)?c(f):o.push(f))})};return c(e),o};function J4(e,t,a,o,{mark:c=!0}){let d=null;o?d="inert":a&&(d="aria-hidden");let f=null,p=null;const h=$1(t,e),b=c?G1(t,q1(h),new Set(h)):[],y=[],v=[];if(d){const w=hy[d],j=W4(d);p=j,f=w;const S=$1(t,Array.from(t.querySelectorAll("[aria-live]"))),N=h.concat(S);G1(t,q1(N),new Set(N)).forEach(T=>{const D=T.getAttribute(d),C=D!==null&&D!=="false",A=(w.get(T)||0)+1;w.set(T,A),y.push(T),A===1&&C&&j.add(T),C||T.setAttribute(d,d==="inert"?"":"true")})}return c&&b.forEach(w=>{const j=(rf.get(w)||0)+1;rf.set(w,j),v.push(w),j===1&&w.setAttribute(V1,"")}),xy+=1,()=>{f&&y.forEach(w=>{const S=(f.get(w)||0)-1;f.set(w,S),S||(!p?.has(w)&&d&&w.removeAttribute(d),p?.delete(w))}),c&&v.forEach(w=>{const j=(rf.get(w)||0)-1;rf.set(w,j),j||w.removeAttribute(V1)}),xy-=1,xy||(hy.inert=new WeakMap,hy["aria-hidden"]=new WeakMap,gy.inert=new WeakSet,gy["aria-hidden"]=new WeakSet,rf=new WeakMap)}}function K1(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:c=!0}=t,d=$t(e[0]).body;return J4(e,d,a,o,{mark:c})}const eH=500,tH={style:{transition:"none"}},Y1="data-base-ui-click-trigger",X1={fallbackAxisSide:"none"},Q1={fallbackAxisSide:"end"},nH={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Z1=x.createContext(null),W1=()=>x.useContext(Z1),sH=sf("portal");function J1(e={}){const{ref:t,container:a,componentProps:o=fn,elementProps:c}=e,d=Gd(),p=W1()?.portalNode,[h,b]=x.useState(null),[y,v]=x.useState(null),w=Ie(k=>{k!==null&&v(k)}),j=x.useRef(null);De(()=>{if(a===null){j.current&&(j.current=null,v(null),b(null));return}const k=(a&&(Sv(a)?a:a.current))??p??document.body;if(k==null){j.current&&(j.current=null,v(null),b(null));return}j.current!==k&&(j.current=k,v(null),b(k))},[a,p]);const S=yt("div",o,{ref:[t,w],props:[{id:d,[sH]:""},c]}),N=h&&S?Cs.createPortal(S,h):null;return{node:y,nodeId:x.isValidElement(S)?S.props.id:void 0,subtree:N}}const lh=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,container:p,portalOwnerRole:h,...b}=t,{node:y,nodeId:v,subtree:w}=J1({container:p,ref:a,componentProps:t,elementProps:b}),j=x.useRef(null),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),[T,D]=x.useState(null),C=x.useRef(!1),A=T?.modal,R=T?.open,I=!!T&&!T.modal&&T.open&&!!y;x.useEffect(()=>{if(!y||A)return;function O(_){y&&_.relatedTarget&&Gc(_)&&(_.type==="focusin"?C.current&&(v1(y),C.current=!1):(n4(y),C.current=!0))}return Ya(St(y,"focusin",O,!0),St(y,"focusout",O,!0))},[y,A]),De(()=>{!y||R!==!0||!C.current||(v1(y),C.current=!1)},[R,y]);const P=x.useMemo(()=>({beforeOutsideRef:j,afterOutsideRef:S,beforeInsideRef:N,afterInsideRef:k,portalNode:y,setFocusManagerState:D}),[y]);return s.jsxs(x.Fragment,{children:[w,s.jsxs(Z1.Provider,{value:P,children:[I&&y&&s.jsx(Wc,{"data-type":"outside",ref:j,onFocus:O=>{if(Gc(O,y))N.current?.focus();else{const _=T?T.domReference:null;x1(_)?.focus()}}}),I&&y&&s.jsx("span",{role:h,"aria-owns":v,style:nH}),y&&Cs.createPortal(f,y),I&&y&&s.jsx(Wc,{"data-type":"outside",ref:S,onFocus:O=>{if(Gc(O,y))k.current?.focus();else{const _=T?T.domReference:null;ry(_)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,Fe(ho,O.nativeEvent))}}})]})]})});function eT(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class rH{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",eT())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const tT=x.createContext(null),nT=x.createContext(null),Jc=()=>x.useContext(tT)?.id||null,Mi=e=>{const t=x.useContext(nT);return e??t};function aH(e){const t=Gd(),a=Mi(e),o=Jc();return De(()=>{if(!t)return;const c={id:t,parentId:o};return a?.addNode(c),()=>{a?.removeNode(c)}},[a,t,o]),t}function lH(e){const{children:t,id:a}=e,o=Jc();return s.jsx(tT.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function oH(e){const{children:t,externalTree:a}=e,o=Ds(()=>a??new rH).current;return s.jsx(nT.Provider,{value:o,children:t})}function iH(e,t){const a=Sn(cs(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const sT=20;let xo=[];function by(){xo=xo.filter(e=>e.deref()?.isConnected)}function rT(e){by(),e&&Hs(e)!=="body"&&(xo.push(new WeakRef(e)),xo.length>sT&&(xo=xo.slice(-sT)))}function aT(){return by(),xo[xo.length-1]?.deref()}function cH(e){return e?sy(e)?e:Qd(e)[0]||e:null}function lT(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=h1(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return sy(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function oh(e){const{context:t,children:a,disabled:o=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:b="",nextFocusableElement:y,previousFocusableElement:v,beforeContentFocusGuardRef:w,externalTree:j,getInsideElements:S}=e,N="rootStore"in t?t.rootStore:t,k=N.useState("open"),T=N.useState("domReferenceElement"),D=N.useState("floatingElement"),{events:C,dataRef:A}=N.context,R=Ie(()=>A.current.floatingContext?.nodeId),I=c===!1,P=Yv(T)&&I,O=Xn(c),_=Xn(d),L=Xn(b),H=Xn(k),B=Mi(j),z=W1(),Q=x.useRef(!1),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef(null),$=x.useRef(""),Y=x.useRef(""),F=x.useRef(null),G=x.useRef(null),W=ea(F,w,z?.beforeInsideRef),le=ea(G,z?.afterInsideRef),M=Zs(),U=Zs(),Z=Kc(),ae=z!=null,ce=qm(D),J=Ie((ee=ce)=>ee?Qd(ee):[]),ie=Ie(()=>S?.().filter(ee=>ee!=null)??[]);x.useEffect(()=>{if(o||!p)return;function ee(te){te.key==="Tab"&&Qe(ce,or($t(ce)))&&J().length===0&&!P&&ks(te)}const fe=$t(ce);return St(fe,"keydown",ee)},[o,ce,p,P,J]),x.useEffect(()=>{if(o||!k)return;const ee=$t(ce);function fe(){X.current=!1}function te(re){const de=cs(re),ke=ie(),Ee=Qe(D,de)||Qe(T,de)||Qe(z?.portalNode,de)||ke.some(ve=>ve===de||Qe(ve,de));X.current=!Ee,Y.current=re.pointerType||"keyboard",de?.closest(`[${Y1}]`)&&(K.current=!0,U.start(0,()=>{K.current=!1}))}function Ce(){Y.current="keyboard"}return Ya(St(ee,"pointerdown",te,!0),St(ee,"pointerup",fe,!0),St(ee,"pointercancel",fe,!0),St(ee,"keydown",Ce,!0),fe)},[o,D,T,ce,k,z,U,ie]),x.useEffect(()=>{if(o||!h)return;const ee=$t(ce);function fe(){K.current=!0,U.start(0,()=>{K.current=!1})}function te(ke){const Ee=cs(ke);sy(Ee)&&(q.current=Ee)}function Ce(ke){const Ee=ke.relatedTarget,ve=ke.currentTarget,he=cs(ke);p&&Ee==null&&he!=null&&Qe(D,he)&&rT(he),queueMicrotask(()=>{const ye=R(),je=N.context.triggerElements,xe=ie(),Te=Ee?.hasAttribute(sf("focus-guard"))&&[F.current,G.current,z?.beforeInsideRef.current,z?.afterInsideRef.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,Nl(v),Nl(y)].includes(Ee),Oe=!(Qe(T,Ee)||Qe(D,Ee)||Qe(Ee,D)||Qe(z?.portalNode,Ee)||xe.some(Ne=>Ne===Ee||Qe(Ne,Ee))||je.hasMatchingElement(Ne=>Qe(Ne,Ee))||Te||B&&(io(B.nodesRef.current,ye).find(Ne=>Qe(Ne.context?.elements.floating,Ee)||Qe(Ne.context?.elements.domReference,Ee))||r1(B.nodesRef.current,ye).find(Ne=>[Ne.context?.elements.floating,qm(Ne.context?.elements.floating)].includes(Ee)||Ne.context?.elements.domReference===Ee)));if(ve===T&&ce&&lT(ce),f&&ve!==T&&!Zm(he)&&or(ee)===ee.body){if(dn(ce)&&(ce.focus(),f==="popup")){Z.request(()=>{ce.focus()});return}const Ne=J(),_e=q.current,Ye=(_e&&Ne.includes(_e)?_e:null)||Ne[Ne.length-1]||ce;dn(Ye)&&Ye.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(P||!p)&&Ee&&Oe&&!K.current&&(P||Ee!==aT())&&(Q.current=!0,N.setOpen(!1,Fe(ho,ke)))})}function re(){X.current||(A.current.insideReactTree=!0,M.start(0,()=>{A.current.insideReactTree=!1}))}const de=dn(T)?T:null;if(!(!D&&!de))return Ya(de&&St(de,"focusout",Ce),de&&St(de,"pointerdown",fe),D&&St(D,"focusin",te),D&&St(D,"focusout",Ce),D&&z&&St(D,"focusout",re,!0))},[o,T,D,ce,p,B,z,N,h,f,J,P,R,A,M,U,Z,y,v,ie]),x.useEffect(()=>{if(o||!D||!k)return;const ee=Array.from(z?.portalNode?.querySelectorAll(`[${sf("portal")}]`)||[]),te=(B?r1(B.nodesRef.current,R()):[]).find(ve=>Yv(ve.context?.elements.domReference||null))?.context?.elements.domReference,re=[...[D,...ee,F.current,G.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,...ie()],te,Nl(v),Nl(y),P?T:null].filter(ve=>ve!=null),de=K1(re,{ariaHidden:p||P,mark:!1}),ke=[D,...ee].filter(ve=>ve!=null),Ee=K1(ke);return()=>{Ee(),de()}},[k,o,T,D,p,z,P,B,R,y,v,ie]),De(()=>{if(!k||o||!dn(ce))return;$.current="",Y.current="";const ee=$t(ce),fe=or(ee);queueMicrotask(()=>{const te=O.current,Ce=typeof te=="function"?te(L.current||""):te;if(Ce===void 0||Ce===!1||Qe(ce,fe))return;let de=null;const ke=()=>(de==null&&(de=J(ce)),de[0]||ce);let Ee;Ce===!0||Ce===null?Ee=ke():Ee=Nl(Ce),Ee=Ee||ke();const ve=Qe(ce,or(ee));ah(Ee,{preventScroll:Ee===ce,shouldFocus(){if(!H.current)return!1;if(ve)return!0;const he=or(ee);return!(he!==Ee&&Qe(ce,he))}})})},[o,k,ce,J,O,L,H]),De(()=>{if(o||!ce)return;const ee=$t(ce),fe=or(ee),te=L.current==null;rT(fe);function Ce(de){if(de.open||($.current=iH(de.nativeEvent,Y.current)),de.reason===Vs&&de.nativeEvent.type==="mouseleave"&&(Q.current=!0),de.reason===nh)if(de.nested)Q.current=!1;else if(Gm(de.nativeEvent)||Xv(de.nativeEvent))Q.current=!1;else{let ke=!1;$t(ce).createElement("div").focus({get preventScroll(){return ke=!0,!1}}),ke?Q.current=!1:Q.current=!0}}C.on("openchange",Ce);function re(de){const ke=_.current;let Ee=typeof ke=="function"?ke(de):ke;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const ve=T?.isConnected?T:null,he=fe?.isConnected&&Hs(fe)!=="body"?fe:null;let ye=te?he||ve:ve||he;return ye||(ye=aT()||null),typeof Ee=="boolean"?ye:Nl(Ee)||ye||null}return()=>{C.off("openchange",Ce);const de=or(ee),ke=ie(),Ee=Qe(D,de)||ke.some(je=>je===de||Qe(je,de))||B&&io(B.nodesRef.current,R(),!1).some(je=>Qe(je.context?.elements.floating,de)),ve=_.current,he=$.current,ye=re(he);queueMicrotask(()=>{const je=cH(ye),xe=typeof ve!="boolean";if(ve&&!Q.current&&dn(je)&&(!(!xe&&je!==de&&de!==ee.body)||Ee)){const Te={preventScroll:!0};he==="keyboard"&&(Te.focusVisible=!0),je.focus(Te)}Q.current=!1})}},[o,D,ce,_,L,C,B,T,R,ie]),De(()=>{if(!yl||k||!D)return;const ee=or($t(D));!dn(ee)||!$m(ee)||Qe(D,ee)&&ee.blur()},[k,D]),De(()=>{if(!(o||!z))return z.setFocusManagerState({modal:p,closeOnFocusOut:h,open:k,onOpenChange:N.setOpen,domReference:T}),()=>{z.setFocusManagerState(null)}},[o,z,p,k,N,h,T]),De(()=>{if(!(o||!ce))return lT(ce),()=>{queueMicrotask(by)}},[o,ce]);const ge=!o&&(p?!P:!0)&&(ae||p);return s.jsxs(x.Fragment,{children:[ge&&s.jsx(Wc,{"data-type":"inside",ref:W,onFocus:ee=>{if(p){const fe=J();ah(fe[fe.length-1])}else z?.portalNode&&(Q.current=!1,Gc(ee,z.portalNode)?ry(T)?.focus():Nl(v??z.beforeOutsideRef)?.focus())}}),a,ge&&s.jsx(Wc,{"data-type":"inside",ref:le,onFocus:ee=>{p?ah(J()[0]):z?.portalNode&&(h&&(Q.current=!0),Gc(ee,z.portalNode)?x1(T)?.focus():Nl(y??z.afterOutsideRef)?.focus())}})]})}function ih(e,t={}){const{enabled:a=!0,event:o="click",toggle:c=!0,ignoreMouse:d=!1,stickIfOpen:f=!0,touchOpenDelay:p=0,reason:h=mo}=t,b="rootStore"in e?e.rootStore:e,y=b.context.dataRef,v=x.useRef(void 0),w=Kc(),j=Zs(),S=x.useMemo(()=>{function N(T,D,C,A){const R=Fe(h,D,C);T&&A==="touch"&&p>0?j.start(p,()=>{b.setOpen(!0,R)}):b.setOpen(T,R)}function k(T,D,C){const A=y.current.openEvent,R=b.select("domReferenceElement")!==D;return T&&R||!T||!c?!0:A&&f?!C(A.type):!1}return{onPointerDown(T){v.current=co(T.pointerType,!0)&&Xv(T.nativeEvent)?"virtual":T.pointerType},onMouseDown(T){const D=v.current,C=T.nativeEvent,A=b.select("open");if(T.button!==0||o==="click"||co(D,!0)&&d)return;const R=k(A,T.currentTarget,O=>O==="click"||O==="mousedown"),I=cs(C);if($m(I)){N(R,C,I,D);return}const P=T.currentTarget;w.request(()=>{N(R,C,P,D)})},onClick(T){if(o==="mousedown-only")return;const D=v.current;if(o==="mousedown"&&D){v.current=void 0;return}if(co(D,!0)&&d)return;const C=b.select("open"),A=k(C,T.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");N(A,T.nativeEvent,T.currentTarget,D)},onKeyDown(){v.current=void 0}}},[y,o,d,h,b,f,c,w,j,p]);return x.useMemo(()=>a?{reference:S}:fn,[a,S])}function uH(e,t){let a=null,o=null,c=!1;return{contextElement:e||void 0,getBoundingClientRect(){const d=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",h=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let b=d.width,y=d.height,v=d.x,w=d.y;return a==null&&t.x&&f&&(a=d.x-t.x),o==null&&t.y&&p&&(o=d.y-t.y),v-=a||0,w-=o||0,b=0,y=0,!c||h?(b=t.axis==="y"?d.width:0,y=t.axis==="x"?d.height:0,v=f&&t.x!=null?t.x:v,w=p&&t.y!=null?t.y:w):c&&!h&&(y=t.axis==="x"?d.height:y,b=t.axis==="y"?d.width:b),c=!0,{width:b,height:y,x:v,y:w,top:w,right:v+b,bottom:w+y,left:v}}}}function oT(e){return e!=null&&e.clientX!=null}function dH(e,t={}){const{enabled:a=!0,axis:o="both"}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),h=c.context.dataRef,b=x.useRef(!1),y=x.useRef(null),[v,w]=x.useState(),[j,S]=x.useState([]),N=Ie(A=>{c.set("positionReference",A)}),k=Ie((A,R,I)=>{b.current||h.current.openEvent&&!oT(h.current.openEvent)||c.set("positionReference",uH(I??p,{x:A,y:R,axis:o,dataRef:h,pointerType:v}))}),T=Ie(A=>{d?y.current||(k(A.clientX,A.clientY,A.currentTarget),S([])):k(A.clientX,A.clientY,A.currentTarget)}),D=co(v)?f:d;x.useEffect(()=>{if(!a){N(p);return}if(!D)return;function A(){y.current?.(),y.current=null}const R=Sn(f);function I(P){const O=cs(P);Qe(f,O)?A():k(P.clientX,P.clientY)}return!h.current.openEvent||oT(h.current.openEvent)?y.current=St(R,"mousemove",I):N(p),A},[D,a,f,h,p,c,k,N,j]),x.useEffect(()=>()=>{c.set("positionReference",null)},[c]),x.useEffect(()=>{a&&!f&&(b.current=!1)},[a,f]),x.useEffect(()=>{!a&&d&&(b.current=!0)},[a,d]);const C=x.useMemo(()=>{function A(R){w(R.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:T,onMouseEnter:T}},[T]);return x.useMemo(()=>a?{reference:C,trigger:C}:{},[a,C])}function fH(){return!1}function pH(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function af(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:f=fH,bubbles:p,externalTree:h}=t,b="rootStore"in e?e.rootStore:e,y=b.useState("open"),v=b.useState("floatingElement"),{dataRef:w,events:j}=b.context,S=Mi(h),N=Ie(typeof c=="function"?c:()=>!1),k=typeof c=="function"?N:c,T=k!==!1,D=Ie(()=>d),{escapeKey:C,outsidePress:A}=pH(p),R=x.useRef(!1),I=x.useRef(!1),P=x.useRef(!1),O=x.useRef(!1),_=x.useRef(!1),L=x.useRef(""),H=x.useRef(null),B=Zs(),z=Zs(),Q=Ie(()=>{z.clear(),w.current.insideReactTree=!1}),K=Ie(M=>{const U=w.current.floatingContext?.nodeId;return(S?io(S.nodesRef.current,U):[]).some(ae=>ae.context?.open&&!ae.context.dataRef.current[M])}),X=Ie(M=>Kv(M,b.select("floatingElement"))||Kv(M,b.select("domReferenceElement"))),q=Ie(M=>{f()&&b.setOpen(!1,Fe(mo,M.nativeEvent))}),$=Ie(M=>{if(!y||!a||!o||M.key!=="Escape"||_.current||!C&&K("__escapeKeyBubbles"))return;const U=LB(M)?M.nativeEvent:M,Z=Fe(Xc,U);b.setOpen(!1,Z),Z.isCanceled||M.preventDefault(),!C&&!Z.isPropagationAllowed&&M.stopPropagation()}),Y=Ie(()=>{w.current.insideReactTree=!0,z.start(0,Q)}),F=Ie(M=>{if(!y||!a||M.button!==0)return;const U=cs(M.nativeEvent);Qe(b.select("floatingElement"),U)&&(R.current||(R.current=!0,I.current=!1))}),G=Ie(M=>{!y||!a||(M.defaultPrevented||M.nativeEvent.defaultPrevented)&&R.current&&(I.current=!0)});x.useEffect(()=>{function M(U){U.open||(O.current=!1)}return j.on("openchange",M),()=>{j.off("openchange",M)}},[j]),x.useEffect(()=>{if(!y||!a)return y||(O.current=!1),Q;w.current.__escapeKeyBubbles=C,w.current.__outsidePressBubbles=A;const M=new sa,U=new sa,Z=$t(v);function ae(){M.clear(),_.current=!0}function ce(){M.start(yl?5:0,()=>{_.current=!1})}function J(){P.current=!0,U.start(0,()=>{P.current=!1})}function ie(){R.current=!1,I.current=!1}function ge(){const Oe=L.current,Ne=Oe==="pen"||!Oe?"mouse":Oe,_e=D(),Ye=typeof _e=="function"?_e():_e;return typeof Ye=="string"?Ye:Ye[Ne]}function ee(Oe){const Ne=ge();return Ne==="intentional"&&Oe.type!=="click"||Ne==="sloppy"&&Oe.type==="click"}function fe(Oe){const Ne=w.current.floatingContext?.nodeId,_e=S&&io(S.nodesRef.current,Ne).some(Ye=>Kv(Oe,Ye.context?.elements.floating));return X(Oe)||_e}function te(Oe){if(ee(Oe)){Oe.type!=="click"&&!X(Oe)&&(U.clear(),P.current=!1),Q();return}if(w.current.insideReactTree){Q();return}const Ne=cs(Oe),_e=`[${sf("inert")}]`,Ye=At(Ne)?Ne.getRootNode():null,kt=Array.from((Bc(Ye)?Ye:$t(b.select("floatingElement"))).querySelectorAll(_e)),Ct=b.context.triggerElements;if(Ne&&(Ct.hasElement(Ne)||Ct.hasMatchingElement(ot=>Qe(ot,Ne))))return;let Rt=At(Ne)?Ne:null;for(;Rt&&!no(Rt);){const ot=so(Rt);if(no(ot)||!At(ot))break;Rt=ot}if(!(kt.length&&At(Ne)&&!IB(Ne)&&!Qe(Ne,b.select("floatingElement"))&&kt.every(ot=>!Qe(Rt,ot)))){if(dn(Ne)&&!("touches"in Oe)){const ot=no(Ne),qn=xr(Ne),fs=/auto|scroll/,Gn=ot||fs.test(qn.overflowX),bs=ot||fs.test(qn.overflowY),it=Gn&&Ne.clientWidth>0&&Ne.scrollWidth>Ne.clientWidth,Vt=bs&&Ne.clientHeight>0&&Ne.scrollHeight>Ne.clientHeight,Hn=qn.direction==="rtl",tn=Vt&&(Hn?Oe.offsetX<=Ne.offsetWidth-Ne.clientWidth:Oe.offsetX>Ne.clientWidth),nt=it&&Oe.offsetY>Ne.clientHeight;if(tn||nt)return}if(!fe(Oe)){if(ge()==="intentional"){if(Oe.detail!==0&&!Gm(Oe)&&!O.current)return;if(P.current){U.clear(),P.current=!1;return}}typeof k=="function"&&!k(Oe)||K("__outsidePressBubbles")||(b.setOpen(!1,Fe(nh,Oe)),Q())}}}function Ce(Oe){ge()!=="sloppy"||Oe.pointerType==="touch"||!b.select("open")||!a||X(Oe)||te(Oe)}function re(Oe){if(ge()!=="sloppy"||!b.select("open")||!a||X(Oe))return;const Ne=Oe.touches[0];Ne&&(H.current={startTime:Date.now(),startX:Ne.clientX,startY:Ne.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},B.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function de(Oe,Ne){const _e=cs(Oe);if(!_e)return;const Ye=St(_e,Oe.type,()=>{Ne(Oe),Ye()})}function ke(Oe){L.current="touch",de(Oe,re)}function Ee(Oe){B.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),L.current=Oe.pointerType),!(Oe.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&de(Oe,Ne=>{Ne.type==="pointerdown"?Ce(Ne):te(Ne)})}function ve(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!R.current)return;const Ne=I.current;if(ie(),ge()==="intentional"){if(Oe.type==="pointercancel"){Ne&&J();return}if(!fe(Oe)){if(Ne){J();return}typeof k=="function"&&!k(Oe)||(U.clear(),P.current=!0,Q())}}}function he(Oe){if(ge()!=="sloppy"||!H.current||X(Oe))return;const Ne=Oe.touches[0];if(!Ne)return;const _e=Math.abs(Ne.clientX-H.current.startX),Ye=Math.abs(Ne.clientY-H.current.startY),kt=Math.sqrt(_e*_e+Ye*Ye);kt>5&&(H.current.dismissOnTouchEnd=!0),kt>10&&(te(Oe),B.clear(),H.current=null)}function ye(Oe){de(Oe,he)}function je(Oe){ge()!=="sloppy"||!H.current||X(Oe)||(H.current.dismissOnTouchEnd&&te(Oe),B.clear(),H.current=null)}function xe(Oe){de(Oe,je)}const Te=Ya(o&&Ya(St(Z,"keydown",$),St(Z,"compositionstart",ae),St(Z,"compositionend",ce)),T&&Ya(St(Z,"click",Ee,!0),St(Z,"pointerdown",Ee,!0),St(Z,"pointerup",ve,!0),St(Z,"pointercancel",ve,!0),St(Z,"mousedown",Ee,!0),St(Z,"mouseup",ve,!0),St(Z,"touchstart",ke,{capture:!0,passive:!0}),St(Z,"touchmove",ye,{capture:!0,passive:!0}),St(Z,"touchend",xe,{capture:!0,passive:!0})));return()=>{Te(),M.clear(),U.clear(),ie(),P.current=!1,Q()}},[w,v,o,T,k,y,a,C,A,$,Q,D,K,X,S,b,B]);const W=x.useMemo(()=>({onKeyDown:$,onPointerDown:q,onClick:q}),[$,q]),le=x.useMemo(()=>({onKeyDown:$,onPointerDown:G,onMouseDown:G,onClickCapture:Y,onMouseDownCapture(M){Y(),F(M)},onPointerDownCapture(M){Y(),F(M)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[$,Y,F,G]);return x.useMemo(()=>a?{reference:W,floating:le,trigger:W}:{},[a,W,le])}function iT(e,t,a){let{reference:o,floating:c}=e;const d=na(t),f=Wv(t),p=Zv(f),h=ta(t),b=d==="y",y=o.x+o.width/2-c.width/2,v=o.y+o.height/2-c.height/2,w=o[p]/2-c[p]/2;let j;switch(h){case"top":j={x:y,y:o.y-c.height};break;case"bottom":j={x:y,y:o.y+o.height};break;case"right":j={x:o.x+o.width,y:v};break;case"left":j={x:o.x-c.width,y:v};break;default:j={x:o.x,y:o.y}}const S=Sl(t);return S&&(j[f]+=w*(S==="end"?1:-1)*(a&&b?-1:1)),j}async function mH(e,t){var a;t===void 0&&(t={});const{x:o,y:c,platform:d,rects:f,elements:p,strategy:h}=e,{boundary:b="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:w=!1,padding:j=0}=uo(t,e),S=i1(j),k=p[w?v==="floating"?"reference":"floating":v],T=Xd(await d.getClippingRect({element:(a=await(d.isElement==null?void 0:d.isElement(k)))==null||a?k:k.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(p.floating)),boundary:b,rootBoundary:y,strategy:h})),D=v==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,C=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p.floating)),A=await(d.isElement==null?void 0:d.isElement(C))&&await(d.getScale==null?void 0:d.getScale(C))||{x:1,y:1},R=Xd(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:D,offsetParent:C,strategy:h}):D);return{top:(T.top-R.top+S.top)/A.y,bottom:(R.bottom-T.bottom+S.bottom)/A.y,left:(T.left-R.left+S.left)/A.x,right:(R.right-T.right+S.right)/A.x}}const hH=50,gH=async(e,t,a)=>{const{placement:o="bottom",strategy:c="absolute",middleware:d=[],platform:f}=a,p=f.detectOverflow?f:{...f,detectOverflow:mH},h=await(f.isRTL==null?void 0:f.isRTL(t));let b=await f.getElementRects({reference:e,floating:t,strategy:c}),{x:y,y:v}=iT(b,o,h),w=o,j=0;const S={};for(let N=0;NQ<=0)){var H,B;const Q=(((H=d.flip)==null?void 0:H.index)||0)+1,K=P[Q];if(K&&(!(v==="alignment"?D!==na(K):!1)||L.every($=>na($.placement)===D?$.overflows[0]>0:!0)))return{data:{index:Q,overflows:L},reset:{placement:K}};let X=(B=L.filter(q=>q.overflows[0]<=0).sort((q,$)=>q.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!X)switch(j){case"bestFit":{var z;const q=(z=L.filter($=>{if(I){const Y=na($.placement);return Y===D||Y==="y"}return!0}).map($=>[$.placement,$.overflows.filter(Y=>Y>0).reduce((Y,F)=>Y+F,0)]).sort(($,Y)=>$[1]-Y[1])[0])==null?void 0:z[0];q&&(X=q);break}case"initialPlacement":X=p;break}if(c!==X)return{reset:{placement:X}}}return{}}}},cT=new Set(["left","top"]);async function bH(e,t){const{placement:a,platform:o,elements:c}=e,d=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=ta(a),p=Sl(a),h=na(a)==="y",b=cT.has(f)?-1:1,y=d&&h?-1:1,v=uo(t,e);let{mainAxis:w,crossAxis:j,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return p&&typeof S=="number"&&(j=p==="end"?S*-1:S),h?{x:j*y,y:w*b}:{x:w*b,y:j*y}}const vH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:c,y:d,placement:f,middlewareData:p}=t,h=await bH(t,e);return f===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+h.x,y:d+h.y,data:{...h,placement:f}}}}},yH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:c,platform:d}=t,{mainAxis:f=!0,crossAxis:p=!1,limiter:h={fn:D=>{let{x:C,y:A}=D;return{x:C,y:A}}},...b}=uo(e,t),y={x:a,y:o},v=await d.detectOverflow(t,b),w=na(c),j=Qv(w);let S=y[j],N=y[w];const k=(D,C)=>a1(C+v[D==="y"?"top":"left"],C,C-v[D==="y"?"bottom":"right"]);f&&(S=k(j,S)),p&&(N=k(w,N));const T=h.fn({...t,[j]:S,[w]:N});return{...T,data:{x:T.x-a,y:T.y-o,enabled:{[j]:f,[w]:p}}}}}},wH=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,o;const{x:c,y:d,placement:f,rects:p,middlewareData:h}=t,{offset:b=0,mainAxis:y=!0,crossAxis:v=!0}=uo(e,t),w={x:c,y:d},j=na(f),S=Qv(j);let N=w[S],k=w[j];const T=uo(b,t),D=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(a=T.mainAxis)!=null?a:0,crossAxis:(o=T.crossAxis)!=null?o:0};if(y){const R=S==="y"?"height":"width",I=p.reference[S]-p.floating[R]+D.mainAxis,P=p.reference[S]+p.reference[R]-D.mainAxis;NP&&(N=P)}if(v){var C,A;const R=S==="y"?"width":"height",I=cT.has(ta(f)),P=p.reference[j]-p.floating[R]+(I&&((C=h.offset)==null?void 0:C[j])||0)+(I?0:D.crossAxis),O=p.reference[j]+p.reference[R]+(I?0:((A=h.offset)==null?void 0:A[j])||0)-(I?D.crossAxis:0);kO&&(k=O)}return{[S]:N,[j]:k}}}},jH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:o,platform:c,elements:d}=t,{apply:f=()=>{},...p}=uo(e,t),h=await c.detectOverflow(t,p),b=ta(a),y=Sl(a),v=na(a)==="y",{width:w,height:j}=o.floating;let S,N;b==="top"||b==="bottom"?(S=b,N=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(N=b,S=y==="end"?"top":"bottom");const k=j-h.top-h.bottom,T=w-h.left-h.right,D=qc(j-h[S],k),C=qc(w-h[N],T),A=t.middlewareData.shift,R=!A;let I=D,P=C;A!=null&&A.enabled.x&&(P=T),A!=null&&A.enabled.y&&(I=k),R&&!y&&(v?P=w-2*wl(h.left,h.right):I=j-2*wl(h.top,h.bottom)),await f({...t,availableWidth:P,availableHeight:I});const O=await c.getDimensions(d.floating);return w!==O.width||j!==O.height?{reset:{rects:!0}}:{}}}};function uT(e){const t=xr(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const c=dn(e),d=c?e.offsetWidth:a,f=c?e.offsetHeight:o,p=Km(a)!==d||Km(o)!==f;return p&&(a=d,o=f),{width:a,height:o,$:p}}function vy(e){return At(e)?e:e.contextElement}function eu(e){const t=vy(e);if(!dn(t))return jl(1);const a=t.getBoundingClientRect(),{width:o,height:c,$:d}=uT(t);let f=(d?Km(a.width):a.width)/o,p=(d?Km(a.height):a.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const SH=jl(0);function dT(e){const t=Sn(e);return!Cv()||!t.visualViewport?SH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Sn(e)}function Di(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const c=e.getBoundingClientRect(),d=vy(e);let f=jl(1);t&&(o?At(o)&&(f=eu(o)):f=eu(e));const p=NH(d,a,o)?dT(d):jl(0);let h=(c.left+p.x)/f.x,b=(c.top+p.y)/f.y,y=c.width/f.x,v=c.height/f.y;if(d&&o){const w=Sn(d),j=At(o)?Sn(o):o;let S=w,N=Tv(S);for(;N&&j!==S;){const k=eu(N),T=N.getBoundingClientRect(),D=xr(N),C=T.left+(N.clientLeft+parseFloat(D.paddingLeft))*k.x,A=T.top+(N.clientTop+parseFloat(D.paddingTop))*k.y;h*=k.x,b*=k.y,y*=k.x,v*=k.y,h+=C,b+=A,S=Sn(N),N=Tv(S)}}return Xd({width:y,height:v,x:h,y:b})}function ch(e,t){const a=Im(e).scrollLeft;return t?t.left+a:Di(xl(e)).left+a}function fT(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-ch(e,a),c=a.top+t.scrollTop;return{x:o,y:c}}function kH(e){let{elements:t,rect:a,offsetParent:o,strategy:c}=e;const d=c==="fixed",f=xl(o),p=t?Dm(t.floating):!1;if(o===f||p&&d)return a;let h={scrollLeft:0,scrollTop:0},b=jl(1);const y=jl(0),v=dn(o);if((v||!d)&&((Hs(o)!=="body"||Fd(f))&&(h=Im(o)),v)){const j=Di(o);b=eu(o),y.x=j.x+o.clientLeft,y.y=j.y+o.clientTop}const w=f&&!v&&!d?fT(f,h):jl(0);return{width:a.width*b.x,height:a.height*b.y,x:a.x*b.x-h.scrollLeft*b.x+y.x+w.x,y:a.y*b.y-h.scrollTop*b.y+y.y+w.y}}function CH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function TH(e){const t=Im(e),a=e.ownerDocument.body,o=wl(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=wl(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-t.scrollLeft+ch(e);const f=-t.scrollTop;return xr(a).direction==="rtl"&&(d+=wl(e.clientWidth,a.clientWidth)-o),{width:o,height:c,x:d,y:f}}const EH=25;function AH(e,t,a){a===void 0&&(a="viewport");const o=a==="layoutViewport",c=Sn(e),d=xl(e),f=c.visualViewport;let p=d.clientWidth,h=d.clientHeight,b=0,y=0;if(f){const w=!Cv()||t==="fixed";o?w||(b=-f.offsetLeft,y=-f.offsetTop):(p=f.width,h=f.height,w&&(b=f.offsetLeft,y=f.offsetTop))}if(ch(d)<=0){const w=d.ownerDocument,j=w.body,S=getComputedStyle(j),N=w.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,k=Math.abs(d.clientWidth-j.clientWidth-N),T=getComputedStyle(d).scrollbarGutter==="stable both-edges"?k/2:k;T<=EH&&(p-=T)}return{width:p,height:h,x:b,y}}function RH(e,t){const a=Di(e,!0,t==="fixed"),o=a.top+e.clientTop,c=a.left+e.clientLeft,d=eu(e),f=e.clientWidth*d.x,p=e.clientHeight*d.y,h=c*d.x,b=o*d.y;return{width:f,height:p,x:h,y:b}}function pT(e,t,a){let o;if(t==="viewport"||t==="layoutViewport")o=AH(e,a,t);else if(t==="document")o=TH(xl(e));else if(At(t))o=RH(t,a);else{const c=dT(e);o={x:t.x-c.x,y:t.y-c.y,width:t.width,height:t.height}}return Xd(o)}function OH(e,t){const a=t.get(e);if(a)return a;let o=Hc(e,[],!1).filter(p=>At(p)&&Hs(p)!=="body"),c=null;const d=xr(e).position==="fixed";let f=d?so(e):e;for(;At(f)&&!no(f);){const p=xr(f),h=kv(f),b=c?c.position:d?"fixed":"";!h&&(b==="fixed"||b==="absolute"&&p.position==="static")?o=o.filter(v=>v!==f):c=p,f=so(f)}return t.set(e,o),o}function MH(e){let{element:t,boundary:a,rootBoundary:o,strategy:c}=e;const f=[...a==="clippingAncestors"?Dm(t)?[]:OH(t,this._c):[].concat(a),o],p=pT(t,f[0],c);let h=p.top,b=p.right,y=p.bottom,v=p.left;for(let w=1;w{p(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(O,{...I,root:d.ownerDocument})}catch{o=new IntersectionObserver(O,I)}o.observe(e)}const h=Sn(e),b=()=>p(a);return h.addEventListener("resize",b),p(!0),()=>{h.removeEventListener("resize",b),f()}}function bT(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,b=vy(e),y=c||d?[...b?Hc(b):[],...t?Hc(t):[]]:[];y.forEach(T=>{c&&T.addEventListener("scroll",a),d&&T.addEventListener("resize",a)});const v=b&&p?LH(b,a,d):null;let w=-1,j=null;f&&(j=new ResizeObserver(T=>{let[D]=T;D&&D.target===b&&j&&t&&(j.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var C;(C=j)==null||C.observe(t)})),a()}),b&&!h&&j.observe(b),t&&j.observe(t));let S,N=h?Di(e):null;h&&k();function k(){const T=Di(e);N&&!xT(N,T)&&a(),N=T,S=requestAnimationFrame(k)}return a(),()=>{var T;y.forEach(D=>{c&&D.removeEventListener("scroll",a),d&&D.removeEventListener("resize",a)}),v?.(),(T=j)==null||T.disconnect(),j=null,h&&cancelAnimationFrame(S)}}const zH=vH,BH=yH,HH=xH,UH=jH,VH=wH,FH=(e,t,a)=>{const o=new Map,c=a??{},d={...gT,...c.platform,_c:o};return gH(e,t,{...c,platform:d})};var $H=typeof document<"u",qH=function(){},uh=$H?x.useLayoutEffect:qH;function dh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,c;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!dh(e[o],t[o]))return!1;return!0}if(c=Object.keys(e),a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,c[o]))return!1;for(o=a;o--!==0;){const d=c[o];if(!(d==="_owner"&&e.$$typeof)&&!dh(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function vT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yT(e,t){const a=vT(e);return Math.round(t*a)/a}function wy(e){const t=x.useRef(e);return uh(()=>{t.current=e}),t}function GH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:c,elements:{reference:d,floating:f}={},transform:p=!0,whileElementsMounted:h,open:b}=e,[y,v]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[w,j]=x.useState(o);dh(w,o)||j(o);const[S,N]=x.useState(null),[k,T]=x.useState(null),D=x.useCallback($=>{$!==I.current&&(I.current=$,N($))},[]),C=x.useCallback($=>{$!==P.current&&(P.current=$,T($))},[]),A=d||S,R=f||k,I=x.useRef(null),P=x.useRef(null),O=x.useRef(y),_=h!=null,L=wy(h),H=wy(c),B=wy(b),z=x.useCallback(()=>{if(!I.current||!P.current)return;const $={placement:t,strategy:a,middleware:w};H.current&&($.platform=H.current),FH(I.current,P.current,$).then(Y=>{const F={...Y,isPositioned:B.current!==!1};Q.current&&!dh(O.current,F)&&(O.current=F,Cs.flushSync(()=>{v(F)}))})},[w,t,a,H,B]);uh(()=>{b===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,v($=>({...$,isPositioned:!1})))},[b]);const Q=x.useRef(!1);uh(()=>(Q.current=!0,()=>{Q.current=!1}),[]),uh(()=>{if(A&&(I.current=A),R&&(P.current=R),A&&R){if(L.current)return L.current(A,R,z);z()}},[A,R,z,L,_]);const K=x.useMemo(()=>({reference:I,floating:P,setReference:D,setFloating:C}),[D,C]),X=x.useMemo(()=>({reference:A,floating:R}),[A,R]),q=x.useMemo(()=>{const $={position:a,left:0,top:0};if(!X.floating)return $;const Y=yT(X.floating,y.x),F=yT(X.floating,y.y);return p?{...$,transform:"translate("+Y+"px, "+F+"px)",...vT(X.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Y,top:F}},[a,p,X.floating,y.x,y.y]);return x.useMemo(()=>({...y,update:z,refs:K,elements:X,floatingStyles:q}),[y,z,K,X,q])}const KH=(e,t)=>{const a=zH(e);return{name:a.name,fn:a.fn,options:[e,t]}},YH=(e,t)=>{const a=BH(e);return{name:a.name,fn:a.fn,options:[e,t]}},XH=(e,t)=>({fn:VH(e).fn,options:[e,t]}),QH=(e,t)=>{const a=HH(e);return{name:a.name,fn:a.fn,options:[e,t]}},ZH=(e,t)=>{const a=UH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var jy={exports:{}},Sy={};var wT;function WH(){if(wT)return Sy;wT=1;var e=Vd();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,c=e.useEffect,d=e.useLayoutEffect,f=e.useDebugValue;function p(v,w){var j=w(),S=o({inst:{value:j,getSnapshot:w}}),N=S[0].inst,k=S[1];return d(function(){N.value=j,N.getSnapshot=w,h(N)&&k({inst:N})},[v,j,w]),c(function(){return h(N)&&k({inst:N}),v(function(){h(N)&&k({inst:N})})},[v]),f(j),j}function h(v){var w=v.getSnapshot;v=v.value;try{var j=w();return!a(v,j)}catch{return!0}}function b(v,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b:p;return Sy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sy}var jT;function ST(){return jT||(jT=1,jy.exports=WH()),jy.exports}var Ny=ST(),ky={exports:{}},Cy={};var NT;function JH(){if(NT)return Cy;NT=1;var e=Vd(),t=ST();function a(b,y){return b===y&&(b!==0||1/b===1/y)||b!==b&&y!==y}var o=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,d=e.useRef,f=e.useEffect,p=e.useMemo,h=e.useDebugValue;return Cy.useSyncExternalStoreWithSelector=function(b,y,v,w,j){var S=d(null);if(S.current===null){var N={hasValue:!1,value:null};S.current=N}else N=S.current;S=p(function(){function T(I){if(!D){if(D=!0,C=I,I=w(I),j!==void 0&&N.hasValue){var P=N.value;if(j(P,I))return A=P}return A=I}if(P=A,o(C,I))return P;var O=w(I);return j!==void 0&&j(P,O)?(C=I,P):(C=I,A=O)}var D=!1,C,A,R=v===void 0?null:v;return[function(){return T(y())},R===null?void 0:function(){return T(R())}]},[y,v,w,j]);var k=c(b,S[0],S[1]);return f(function(){N.hasValue=!0,N.value=k},[k]),h(k),k},Cy}var kT;function eU(){return kT||(kT=1,ky.exports=JH()),ky.exports}var tU=eU();const nU=Iv(19)?rU:aU;function CT(e,t,a,o,c){return nU(e,t,a,o,c)}function sU(e,t,a,o,c){const d=x.useCallback(()=>t(e.getSnapshot(),a,o,c),[e,t,a,o,c]);return Ny.useSyncExternalStore(e.subscribe,d,d)}$4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const c of e.syncHooks)a.add(c.store);const o=[];for(const c of a)o.push(c.subscribe(t));return()=>{for(const c of o)c()}}),Ny.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function rU(e,t,a,o,c){const d=F4();if(!d)return sU(e,t,a,o,c);const f=d.syncIndex;d.syncIndex+=1;let p;return d.didInitialize?(p=d.syncHooks[f],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,c))&&(p.store!==e&&(d.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=c,p.value=t(e.getSnapshot(),a,o,c))):(p={store:e,selector:t,a1:a,a2:o,a3:c,value:t(e.getSnapshot(),a,o,c)},d.syncHooks.push(p)),p.value}function aU(e,t,a,o,c){return tU.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,d=>t(d,a,o,c))}class lU{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,c){return CT(this,t,a,o,c)}}class tu extends lU{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;De(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;De(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);De(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,c=a!==void 0;De(()=>{c&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,c])}select(t,a,o,c){const d=this.selectors[t];return d(this.state,a,o,c)}useState(t,a,o,c){return x.useDebugValue(t),CT(this,this.selectors[t],a,o,c)}useContextCallback(t,a){x.useDebugValue(t);const o=Ie(a??qt);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let c=o(this.state);return a(c,c,this),this.subscribe(d=>{const f=o(d);if(!Object.is(c,f)){const p=c;c=f,a(f,p,this)}})}}const oU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Ty extends tu{constructor(a){const{syncOnly:o,nested:c,onOpenChange:d,triggerElements:f,...p}=a;super({...p,positionReference:p.referenceElement,domReferenceElement:p.referenceElement},{onOpenChange:d,dataRef:{current:{}},events:eT(),nested:c,triggerElements:f},oU);ln(this,"syncOpenEvent",(a,o)=>{(!a||!this.state.open||o!=null&&zB(o))&&(this.context.dataRef.current.openEvent=a?o:void 0)});ln(this,"dispatchOpenChange",(a,o)=>{this.syncOpenEvent(a,o.event);const c={open:a,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",c)});ln(this,"setOpen",(a,o)=>{if(this.syncOnly){this.context.onOpenChange?.(a,o);return}this.dispatchOpenChange(a,o),this.context.onOpenChange?.(a,o)});this.syncOnly=o}}function iU(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:c,nested:d,onOpenChange:f}=e,p=t.useState("open"),h=t.useState("activeTriggerElement"),b=t.useState(a?"popupElement":"positionerElement"),y=t.context.triggerElements,v=f,w=x.useRef(null);o===void 0&&w.current===null&&(w.current=new Ty({open:p,transitionStatus:void 0,referenceElement:h,floatingElement:b,triggerElements:y,onOpenChange:v,floatingId:c,syncOnly:!0,nested:d}));const j=o??w.current;return t.useSyncedValue("floatingId",c),De(()=>{const S={open:p,floatingId:c,referenceElement:h,floatingElement:b};At(h)&&(S.domReferenceElement=h),j.state.positionReference===j.state.referenceElement&&(S.positionReference=h),j.update(S)},[p,c,h,b,j]),j.context.onOpenChange=v,j.context.nested=d,j}const lf={tabIndex:-1,[Uv]:""};function TT(e){return t=>t==="touch"?e.current:!0}function Ey(e,t=!1){const a=Gd(),o=Jc()!=null,c=Ds(()=>e(a,o)).current;return iU({popupStore:c,treatPopupAsFloatingElement:t,floatingRootContext:c.state.floatingRootContext,floatingId:a,nested:o,onOpenChange:c.setOpen}),c}function Ay({handle:e,store:t}){return De(()=>e.attachStore(t),[e,t]),null}function ET(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function cU(e,t){const a=x.useRef(null);return Ie(o=>{const c=a.current;if(c!==null){if(c.element===o&&c.store===t&&c.id===e)return;a.current=null;const d=c.store;d.context.triggerElements.getById(c.id)===c.element&&(d.context.triggerElements.delete(c.id),ET(d))}o!==null&&e!==void 0&&(a.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),ET(t))})}function Ry(e,t,a,o=!1){let c=e.preventUnmountingOnClose;t?c=!1:o&&(c=!0);const d=a?.id??null;let f=e.activeTriggerId,p=e.activeTriggerElement;return(d||t)&&(f=d,p=a??null),{open:t,preventUnmountingOnClose:c,activeTriggerId:f,activeTriggerElement:p}}function AT(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function uU(e,t,a,o={}){const c=a.reason,d=c===Vs,f=t&&c===th,p=!t&&(c===mo||c===Xc),h=AT(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const b=()=>{const y=Ry(e.state,t,a.trigger,h()),v={...o.extraState,...y};f?v.instantType="focus":p?v.instantType="dismiss":d&&(v.instantType=void 0),e.update(v)};d?Cs.flushSync(b):b()}function RT(e,t,a,o){const c=a.useState("isMountedByTrigger",e),d=cU(e,a),f=Ie(h=>{const b=a.select("open"),y=a.select("activeTriggerId");if(y===e){const v={activeTriggerElement:h,...b?o:null};a.update(v);return}if(y==null&&b){const v={activeTriggerId:e??null,activeTriggerElement:h,...o};a.update(v)}}),p=Ie(h=>{d(h),h&&f(h)});return De(()=>(p(t.current),()=>p(null)),[p,t,a,e]),De(()=>{if(c){const h={activeTriggerElement:t.current,...o};a.update(h)}},[c,a,t,...Object.values(o)]),{registerTrigger:p,isMountedByThisTrigger:c}}function Oy(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=x.useRef(null),c=e.useState("open"),d=e.useState("triggerCount"),f=e.useState("activeTriggerId"),p=e.useState("activeTriggerElement");De(()=>{if(!c){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const h=e.context.triggerElements.size,b={};e.state.triggerCount!==h&&(b.triggerCount=h);const y=e.select("activeTriggerId");let v=null;if(y){const w=e.context.triggerElements.getById(y);if(w)o.current=y,w!==e.state.activeTriggerElement&&(b.activeTriggerElement=w);else{for(const[j,S]of e.context.triggerElements.entries())if(S===e.state.activeTriggerElement){b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j;break}b.activeTriggerId===void 0&&(o.current===y?v=y:o.current=null)}}else o.current=null;if(!v&&!y&&h===1){const w=e.context.triggerElements.entries().next();if(!w.done){const[j,S]=w.value;b.activeTriggerId=j,b.activeTriggerElement=S,o.current=j}}(b.triggerCount!==void 0||b.activeTriggerId!==void 0||b.activeTriggerElement!==void 0)&&e.update(b),v&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===v&&!e.context.triggerElements.getById(v)){const w=Fe(Yn);e.setOpen(!1,w),w.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[c,e,d,f,p,a])}function My(e,t,a,o){const{mounted:c,setMounted:d,transitionStatus:f}=ki(e,!1,!1,o),p=t.useState("preventUnmountingOnClose"),h=e?!1:p;t.useSyncedValues({mounted:c,transitionStatus:f,preventUnmountingOnClose:h});const b=Ie(()=>{d(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ra({enabled:c&&!e&&!h,open:e,ref:t.context.popupRef,onComplete(){e||b()}}),{forceUnmount:b,transitionStatus:f}}function Dy(e,t){e.useSyncedValues(t),De(()=>()=>{e.update({activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn})},[e])}function OT(e,t){De(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),De(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fh{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Iy(e,t,a=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ty({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn}}const of=e=>e.triggerIdProp??e.activeTriggerId,Py=e=>e.openProp??e.open,MT=e=>(e.popupElement?.id??e.floatingId)||void 0;function DT(e,t){return t!==void 0&&Py(e)&&of(e)===t}function dU(e,t){return DT(e,t)?!0:t!==void 0&&Py(e)&&of(e)==null&&e.triggerCount===1}const _y={open:Py,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:of,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:MT,isTriggerActive:(e,t)=>t!==void 0&&of(e)===t,isOpenedByTrigger:(e,t)=>DT(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&of(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>dU(e,t)?MT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function IT(e){const t=x.useCallback(o=>e===void 0?qt:e.subscribeStore(o),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ny.useSyncExternalStore(t,a,()=>e?.serverStore)}function PT(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,c=Gd(),d=Jc()!=null,f=Ds(()=>new Ty({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new fh,floatingId:c,syncOnly:!1,nested:d})).current;return De(()=>{const p={open:t,floatingId:c};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=At(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),f.update(p)},[t,c,o.reference,o.floating,f]),f.context.onOpenChange=a,f.context.nested=d,f}function fU(e){return pU(e,e.rootContext)}function pU(e,t){const{nodeId:a,externalTree:o}=e,c=t.useState("referenceElement"),d=t.useState("floatingElement"),f=t.useState("domReferenceElement"),p=t.useState("open"),h=t.useState("floatingId"),[b,y]=x.useState(null),[v,w]=x.useState(void 0),[j,S]=x.useState(void 0),N=x.useRef(null),k=Mi(o),T=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),D=GH({...e,elements:{...T,...b&&{reference:b}}}),C=At(v)?v:null,A=j===void 0?t.state.floatingElement:j;t.useSyncedValue("referenceElement",v??null),t.useSyncedValue("domReferenceElement",v===void 0?f:C),t.useSyncedValue("floatingElement",A);const R=x.useCallback(H=>{const B=At(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;y(B),D.refs.setReference(B)},[D.refs]),I=x.useCallback(H=>{(At(H)||H===null)&&(N.current=H,w(H)),(At(D.refs.reference.current)||D.refs.reference.current===null||H!==null&&!At(H))&&D.refs.setReference(H)},[D.refs,w]),P=x.useCallback(H=>{S(H),D.refs.setFloating(H)},[D.refs]),O=x.useMemo(()=>({...D.refs,setReference:I,setFloating:P,setPositionReference:R,domReference:N}),[D.refs,I,P,R]),_=x.useMemo(()=>({...D.elements,domReference:f}),[D.elements,f]),L=x.useMemo(()=>({...D,dataRef:t.context.dataRef,open:p,onOpenChange:t.setOpen,events:t.context.events,floatingId:h,refs:O,elements:_,nodeId:a,rootStore:t}),[D,O,_,a,t,p,h]);return De(()=>{f&&(N.current=f)},[f]),De(()=>{t.context.dataRef.current.floatingContext=L;const H=k?.nodesRef.current.find(B=>B.id===a);H&&(H.context=L)}),x.useMemo(()=>({...D,context:L,refs:O,elements:_,rootStore:t}),[D,O,_,L,t])}const Ly=JC&&yl;function mU(e,t={}){const{enabled:a=!0,delay:o}=t,c="rootStore"in e?e.rootStore:e,{events:d,dataRef:f}=c.context,p=x.useRef(!1),h=x.useRef(null),b=x.useRef(!0),y=Zs();x.useEffect(()=>{const w=c.select("domReferenceElement");if(!a)return;const j=Sn(w);function S(){const T=c.select("domReferenceElement");!c.select("open")&&dn(T)&&T===or($t(T))&&(p.current=!0,h.current=T)}function N(){b.current=!0}function k(){b.current=!1}return Ya(St(j,"blur",S),Ly&&St(j,"keydown",N,!0),Ly&&St(j,"pointerdown",k,!0))},[c,a]),x.useEffect(()=>{if(!a)return;function w(j){if(j.reason===mo||j.reason===Xc){const S=c.select("domReferenceElement");At(S)&&(h.current=S,p.current=!0)}}return d.on("openchange",w),()=>{d.off("openchange",w)}},[d,a,c]);const v=x.useMemo(()=>{function w(){p.current=!1,h.current=null}return{onMouseLeave(){w()},onFocus(j){const S=j.currentTarget;if(p.current){if(h.current===S)return;w()}const N=cs(j.nativeEvent);if(At(N)){if(Ly&&!j.relatedTarget){if(!b.current&&!$m(N))return}else if(!_B(N))return}const k=Fm(j.relatedTarget,c.context.triggerElements),{nativeEvent:T,currentTarget:D}=j,C=typeof o=="function"?o():o;if(c.select("open")&&k||C===0||C===void 0){c.setOpen(!0,Fe(th,T,D));return}y.start(C,()=>{p.current||c.setOpen(!0,Fe(th,T,D))})},onBlur(j){w();const S=j.relatedTarget,N=j.nativeEvent,k=At(S)&&S.hasAttribute(sf("focus-guard"))&&S.getAttribute("data-type")==="outside";y.start(0,()=>{const T=c.select("domReferenceElement"),D=or($t(T));!S&&D===T||Qe(f.current.floatingContext?.refs.floating.current,D)||Qe(T,D)||k||Fm(S??D,c.context.triggerElements)||c.setOpen(!1,Fe(th,N))})}}},[f,o,c,y]);return x.useMemo(()=>a?{reference:v,trigger:v}:{},[a,v])}class zy{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new sa,this.restTimeout=new sa,this.handleCloseOptions=void 0}static create(){return new zy}}const ph=new WeakMap;function mh(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&ph.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ph.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _T(e,t){const{scopeElement:a,referenceElement:o,floatingElement:c}=t,d=ph.get(a);d&&d!==e&&mh(d),mh(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=c,ph.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",c.style.pointerEvents="auto"}function By(e){const t=e.context.dataRef.current,a=Ds(()=>t.hoverInteractionState??zy.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),ay(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function LT(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:c}=t,d="rootStore"in e?e.rootStore:e,f=d.useState("open"),p=d.useState("floatingElement"),h=d.useState("domReferenceElement"),{dataRef:b}=d.context,y=Mi(),v=Jc(),w=By(d),j=Zs(),S=Ie(()=>H1(b.current.openEvent?.type,w.interactedInside)),N=Ie(()=>K4(b.current.openEvent?.type)),k=Ie(()=>{mh(w)});De(()=>{f||(w.pointerType=void 0,w.restTimeoutPending=!1,w.interactedInside=!1,k())},[f,w,k]),x.useEffect(()=>k,[k]),De(()=>{if(a&&f&&w.handleCloseOptions?.blockPointerEvents&&N()&&At(h)&&p){const T=h,D=p,C=$t(p),A=y?.nodesRef.current.find(O=>O.id===v)?.context?.elements.floating;A&&(A.style.pointerEvents="");const R=w.pointerEventsScopeElement!==D?w.pointerEventsScopeElement:null,I=A!==D?A:null,P=w.handleCloseOptions?.getScope?.()??R??I??T.closest("[data-rootownerid]")??C.body;return _T(w,{scopeElement:P,referenceElement:T,floatingElement:D}),()=>{k()}}},[a,f,h,p,w,N,y,v,k]),x.useEffect(()=>{if(!a)return;function T(){return!!(y&&v&&io(y.nodesRef.current,v).length>0)}function D(O){const _=Oi(o,"close",w.pointerType),L=()=>{d.setOpen(!1,Fe(Vs,O)),y?.events.emit("floating.closed",O)};_?w.openChangeTimeout.start(_,L):(w.openChangeTimeout.clear(),L())}function C(O){const _=cs(O);if(!PB(_)){w.interactedInside=!1;return}w.interactedInside=_?.closest("[aria-haspopup]")!=null}function A(){w.openChangeTimeout.clear(),j.clear(),y?.events.off("floating.closed",I),k()}function R(O){if(T()&&y){y.events.on("floating.closed",I);return}if(Fm(O.relatedTarget,d.context.triggerElements))return;const _=b.current.floatingContext?.nodeId??c,L=O.relatedTarget;if(!(y&&_&&At(L)&&io(y.nodesRef.current,_,!1).some(B=>Qe(B.context?.elements.floating,L)))){if(w.handler){w.handler(O);return}k(),N()&&!S()&&D(O)}}function I(O){!y||!v||T()||j.start(0,()=>{y.events.off("floating.closed",I),d.setOpen(!1,Fe(Vs,O)),y.events.emit("floating.closed",O)})}const P=p;return Ya(P&&St(P,"mouseenter",A),P&&St(P,"mouseleave",R),P&&St(P,"pointerdown",C,!0),()=>{y?.events.off("floating.closed",I)})},[a,p,d,b,o,c,N,S,k,w,y,v,j])}const hU={current:null};function zT(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:c=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElementRef:h=hU,externalTree:b,isActiveTrigger:y=!0,getHandleCloseContext:v,isClosing:w,shouldOpen:j,guardStaleOpen:S=!1}=t,N="rootStore"in e?e.rootStore:e,{dataRef:k,events:T}=N.context,D=Mi(b),C=By(N),A=x.useRef(!1),R=Xn(c),I=Xn(o),P=Xn(f),O=Xn(a),_=Xn(j),L=Xn(w),H=Ie(()=>H1(k.current.openEvent?.type,C.interactedInside)),B=Ie(()=>_.current?.()!==!1),z=Ie((X,q,$)=>{const Y=N.context.triggerElements;if(Y.hasElement(q))return!X||!Qe(X,q);if(!At($))return!1;const F=$;return Y.hasMatchingElement(G=>Qe(G,F))&&(!X||!Qe(X,F))}),Q=Ie(()=>{if(!C.handler)return;$t(N.select("domReferenceElement")).removeEventListener("mousemove",C.handler),C.handler=void 0}),K=Ie(()=>{mh(C)});return y&&(C.handleCloseOptions=c?.__options),x.useEffect(()=>Q,[Q]),x.useEffect(()=>{if(!a)return;function X(q){q.open?A.current=!1:(A.current=q.reason===Vs,Q(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return T.on("openchange",X),()=>{T.off("openchange",X)}},[a,T,C,Q]),x.useEffect(()=>{if(!a)return;function X(W,le=!0){const M=Oi(I.current,"close",C.pointerType);M?C.openChangeTimeout.start(M,()=>{N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W)}):le&&(C.openChangeTimeout.clear(),N.setOpen(!1,Fe(Vs,W)),D?.events.emit("floating.closed",W))}const q=h.current??(y?N.select("domReferenceElement"):null);if(!At(q))return;function $(W){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,d&&!co(C.pointerType))return;const le=B1(P.current),M=Oi(I.current,"open",C.pointerType),U=cs(W),Z=W.currentTarget??null,ae=N.select("domReferenceElement");let ce=Z;if(At(U)&&!N.context.triggerElements.hasElement(U)){for(const de of N.context.triggerElements.elements())if(Qe(de,U)){ce=de;break}}At(Z)&&At(ae)&&!N.context.triggerElements.hasElement(Z)&&Qe(Z,ae)&&(ce=ae);const J=ce==null?!1:z(ae,ce,U),ie=N.select("open"),ge=L.current?.()??N.select("transitionStatus")==="ending",ee=!ie&&ge&&A.current,fe=!J&&At(ce)&&At(ae)&&Qe(ae,ce)&&ee,te=le>0&&!M,Ce=J&&(ie||ee)||fe,re=!ie||J;if(Ce){B()&&N.setOpen(!0,Fe(Vs,W,ce));return}te||(M?C.openChangeTimeout.start(M,()=>{re&&B()&&N.setOpen(!0,Fe(Vs,W,ce))}):re&&B()&&N.setOpen(!0,Fe(Vs,W,ce)))}function Y(W){if(H()){K();return}Q();const le=N.select("domReferenceElement"),M=$t(le);C.restTimeout.clear(),C.restTimeoutPending=!1;const U=k.current.floatingContext??v?.();if(Fm(W.relatedTarget,N.context.triggerElements))return;if(R.current&&U){N.select("open")||C.openChangeTimeout.clear();const ae=h.current;C.handler=R.current({...U,tree:D,x:W.clientX,y:W.clientY,onClose(){K(),Q(),O.current&&!H()&&ae===N.select("domReferenceElement")&&X(W,!0)}}),M.addEventListener("mousemove",C.handler),C.handler(W);return}(C.pointerType!=="touch"||!Qe(N.select("floatingElement"),W.relatedTarget))&&X(W)}function F(W){Qe(q,W.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}const G=S?St(q,"mouseout",F):void 0;return p?Ya(St(q,"mousemove",$,{once:!0}),St(q,"mouseenter",$),St(q,"mouseleave",Y),G):Ya(St(q,"mouseenter",$),St(q,"mouseleave",Y),G)},[Q,K,k,I,N,a,R,C,y,z,H,d,p,P,h,D,O,v,L,B,S]),x.useMemo(()=>{if(!a)return;function X(q){C.pointerType=q.pointerType}return{onPointerDown:X,onPointerEnter:X,onMouseMove(q){const{nativeEvent:$}=q,Y=q.currentTarget,F=N.select("domReferenceElement"),G=N.select("open"),W=z(F,Y,q.target);if(d&&!co(C.pointerType))return;if(G&&W&&C.handleCloseOptions?.blockPointerEvents){const U=N.select("floatingElement");if(U){const Z=C.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;_T(C,{scopeElement:Z,referenceElement:Y,floatingElement:U})}}const le=B1(P.current);if(G&&!W||le===0||!W&&C.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;C.restTimeout.clear();function M(){if(C.restTimeoutPending=!1,H())return;const U=N.select("open");!C.blockMouseMove&&(!U||W)&&B()&&N.setOpen(!0,Fe(Vs,$,Y))}C.pointerType==="touch"?Cs.flushSync(()=>{M()}):W&&G?M():(C.restTimeoutPending=!0,C.restTimeout.start(le,M))}}},[a,C,H,z,d,N,P,B])}const gU="Escape";function BT(e){return yl&&e.movementX===0&&e.movementY===0}function hh(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function gh(e,t){return hh(t,e===Vv||e===Vm,e===ji||e===Si)}function Hy(e,t,a){return hh(t,e===Vm,a?e===ji:e===Si)||e==="Enter"||e===" "||e===""}function xU(e,t,a){return hh(t,a?e===ji:e===Si,e===Vm)}function bU(e,t,a,o){const c=a?e===Si:e===ji,d=e===Vv;return t==="both"||t==="horizontal"&&o?e===gU:hh(t,c,d)}function HT(e,t){const{listRef:a,activeIndex:o,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:h=!1,nested:b=!1,rtl:y=!1,virtual:v=!1,focusItemOnOpen:w="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:S=!0,disabledIndices:N=void 0,orientation:k="vertical",parentOrientation:T,id:D,resetOnPointerLeave:C=!0,externalTree:A,grid:R}=t,I=R!=null,P="rootStore"in e?e.rootStore:e,O=P.useState("open"),_=P.useState("floatingElement"),L=P.useState("domReferenceElement"),H=P.context.dataRef,B=qm(_),z=Yv(L),Q=Xn(B),K=Jc(),X=Mi(A),q=x.useRef(w),$=x.useRef(f??-1),Y=x.useRef(null),F=x.useRef(!0),G=Ie(xe=>{c($.current===-1?null:$.current,xe)}),W=x.useRef(!!_),le=x.useRef(O),M=x.useRef(!1),U=x.useRef(!1),Z=x.useRef(null),ae=Xn(N),ce=Xn(O),J=Xn(f),ie=Xn(C),ge=Kc(),ee=Kc(),fe=Ie(()=>{function xe(_e){v?X?.events.emit("virtualfocus",_e):Z.current=ah(_e,{sync:M.current,preventScroll:!0})}const Te=a.current[$.current],Oe=U.current;Te&&xe(Te),(M.current?_e=>_e():_e=>ge.request(_e))(()=>{const _e=a.current[$.current]||Te;if(!_e)return;Te||xe(_e),Ee&&(Oe||!F.current)&&_e.scrollIntoView?.({block:"nearest",inline:"nearest"})})});De(()=>{H.current.orientation=k},[H,k]),De(()=>{d&&(O&&_?($.current=f??-1,q.current&&f!=null&&(U.current=!0,G())):W.current&&($.current=-1,G()))},[d,O,_,f,G]),De(()=>{if(d){if(!O){M.current=!1;return}if(_)if(o==null){if(M.current=!1,J.current!=null)return;if(W.current&&($.current=-1,fe()),(!le.current||!W.current)&&q.current&&(Y.current!=null||q.current===!0&&Y.current==null)){let xe=0;const Te=()=>{a.current[0]==null?(xe<2&&(xe?Ne=>ee.request(Ne):queueMicrotask)(Te),xe+=1):($.current=Y.current==null||Hy(Y.current,k,y)||b?Qm(a):ey(a),Y.current=null,G())};Te()}}else fo(a.current,o)||($.current=o,fe(),U.current=!1)}},[d,O,_,o,J,b,a,k,y,G,fe,ee]),De(()=>{if(!d||_||!X||v||!W.current)return;const xe=X.nodesRef.current,Te=xe.find(_e=>_e.id===K)?.context?.elements.floating,Oe=or($t(L??Te??null)),Ne=xe.some(_e=>_e.context&&Qe(_e.context.elements.floating,Oe));Te&&!Ne&&F.current&&Te.focus({preventScroll:!0})},[d,_,L,X,K,v]),De(()=>{le.current=O,W.current=!!_}),De(()=>{O||(Y.current=null,q.current=w)},[O,w]);const te=o!=null,Ce=Ie(xe=>{if(!ce.current)return;const Te=a.current.indexOf(xe.currentTarget);Te!==-1&&($.current!==Te||o!==Te)&&($.current=Te,G(xe))}),re=Ie(()=>T??X?.nodesRef.current.find(xe=>xe.id===K)?.context?.dataRef?.current.orientation),de=Ie(()=>Qm(a,ae.current)),ke=Ie(xe=>{if(F.current=!1,M.current=!0,xe.which===229||!ce.current&&xe.currentTarget===Q.current)return;if(b&&bU(xe.key,k,y,I)){gh(xe.key,re())||ks(xe),P.setOpen(!1,Fe(iy,xe.nativeEvent)),dn(L)&&(v?X?.events.emit("virtualfocus",L):L.focus());return}const Te=$.current,Oe=Qm(a,N),Ne=ey(a,N);if(z||(xe.key==="Home"&&(ks(xe),$.current=Oe,G(xe)),xe.key==="End"&&(ks(xe),$.current=Ne,G(xe))),R!=null){const _e=R(xe,$.current,a,k,h,y,N,Oe,Ne);if(_e!=null&&($.current=_e,G(xe)),k==="both")return}if(gh(xe.key,k)){if(ks(xe),O&&!v&&or(xe.currentTarget.ownerDocument)===xe.currentTarget){$.current=Hy(xe.key,k,y)?Oe:Ne,G(xe);return}Hy(xe.key,k,y)?h?Te>=Ne?p&&Te!==a.current.length?$.current=-1:(M.current=!1,$.current=Oe):$.current=Is(a.current,{startingIndex:Te,disabledIndices:N}):$.current=Math.min(Ne,Is(a.current,{startingIndex:Te,disabledIndices:N})):h?Te<=Oe?p&&Te!==-1?$.current=a.current.length:(M.current=!1,$.current=Ne):$.current=Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N}):$.current=Math.max(Oe,Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:N})),fo(a.current,$.current)&&($.current=-1),G(xe)}}),Ee=x.useMemo(()=>({onFocus(Te){M.current=!0,Ce(Te)},onClick:({currentTarget:Te})=>Te.focus({preventScroll:!0}),onMouseMove(Te){BT(Te)||(M.current=!0,U.current=!1,j&&Ce(Te))},onPointerLeave(Te){if(!ce.current||!F.current||Te.pointerType==="touch")return;M.current=!0;const Oe=Te.relatedTarget;if(!(!j||a.current.includes(Oe))&&ie.current&&(Z.current?.(),Z.current=null,$.current=-1,G(Te),!v)){const Ne=Q.current,_e=or($t(Ne));Ne&&Qe(Ne,_e)&&Ne.focus({preventScroll:!0})}}}),[Ce,ce,Q,j,a,G,ie,v]),ve=x.useMemo(()=>v&&O&&te&&{"aria-activedescendant":`${D}-${o}`},[v,O,te,D,o]),he=x.useMemo(()=>({...z?{}:ve,onKeyDown(xe){if(xe.key==="Tab"&&xe.shiftKey&&O&&!v){const Te=cs(xe.nativeEvent);if(Te&&!Qe(Q.current,Te))return;ks(xe),P.setOpen(!1,Fe(ho,xe.nativeEvent)),dn(L)&&L.focus();return}ke(xe)},onPointerMove(xe){BT(xe)||(F.current=!0)}}),[ve,ke,Q,z,P,O,v,L]),ye=x.useMemo(()=>{function xe(Ne){P.setOpen(!0,Fe(iy,Ne.nativeEvent,Ne.currentTarget))}function Te(Ne){w==="auto"&&Gm(Ne.nativeEvent)&&(q.current=!v)}function Oe(Ne){q.current=w,w==="auto"&&Xv(Ne.nativeEvent)&&(q.current=!0)}return{onKeyDown(Ne){const _e=P.select("open");F.current=!1;const Ye=Ne.key.startsWith("Arrow"),kt=xU(Ne.key,re(),y),Ct=gh(Ne.key,k),Rt=(b?kt:Ct)||Ne.key==="Enter"||Ne.key.trim()==="";if(v&&_e)return ke(Ne);if(!(!_e&&!S&&Ye)){if(Rt){const ot=gh(Ne.key,re());Y.current=b&&ot?null:Ne.key}if(b){kt&&(ks(Ne),_e?($.current=de(),G(Ne)):xe(Ne));return}Ct&&(J.current!=null&&($.current=J.current),ks(Ne),!_e&&S?xe(Ne):ke(Ne),_e&&G(Ne))}},onFocus(Ne){P.select("open")&&!v&&($.current=-1,G(Ne))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Te,onClick:Te}},[ke,w,de,b,G,P,S,k,re,y,J,v]),je=x.useMemo(()=>({...ve,...ye}),[ve,ye]);return x.useMemo(()=>d?{reference:je,floating:he,item:Ee,trigger:ye}:{},[d,je,he,ye,Ee])}function UT(e,t){const{listRef:a,elementsRef:o,activeIndex:c,onMatch:d,disabledIndices:f,onTyping:p,enabled:h=!0,resetMs:b=750,selectedIndex:y=null}=t,v="rootStore"in e?e.rootStore:e,w=v.useState("open"),j=Zs(),S=x.useRef(""),N=x.useRef(y??c??-1),k=x.useRef(null),T=Ie(A=>{function R(Q){return o?.current[Q]}function I(Q){const K=R(Q);return K&&!Zm(K)||K?.matches(":disabled")?!1:f==null||!po(Or,Q,f)}function P(Q,K,X=0){if(Q.length===0)return-1;const q=(X%Q.length+Q.length)%Q.length,$=K.toLowerCase();for(let Y=0;Y0&&A.key===" "&&(ks(A),p?.(!0)),S.current.length>0&&S.current[0]!==" "&&P(O,S.current)===-1&&A.key!==" "&&p?.(!1),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;w&&A.key!==" "&&(ks(A),p?.(!0));const _=S.current==="";_&&(N.current=y??c??-1),O.every((Q,K)=>Q&&I(K)?Q[0]?.toLowerCase()!==Q[1]?.toLowerCase():!0)&&S.current===A.key&&(S.current="",N.current=k.current),S.current+=A.key,j.start(b,()=>{S.current="",N.current=k.current,p?.(!1)});const B=((_?y??c??-1:N.current)??0)+1,z=P(O,S.current,B);z!==-1?(d?.(z),k.current=z):A.key!==" "&&(S.current="",p?.(!1))}),D=Ie(A=>{const R=A.relatedTarget,I=v.select("domReferenceElement"),P=v.select("floatingElement");Qe(I,R)||Qe(P,R)||(j.clear(),S.current="",N.current=k.current,p?.(!1))});De(()=>{!w&&y!==null||(j.clear(),k.current=null,S.current!==""&&(S.current=""))},[w,y,j]);const C=x.useMemo(()=>({onKeyDown:T,onBlur:D}),[T,D]);return x.useMemo(()=>h?{reference:C,floating:C}:{},[h,C])}const VT=.1,vU=VT*VT,bn=.5;function xh(e,t,a,o,c,d){return o>=t!=d>=t&&e<=(c-a)*(t-o)/(d-o)+a}function bh(e,t,a,o,c,d,f,p,h,b){let y=!1;return xh(e,t,a,o,c,d)&&(y=!y),xh(e,t,c,d,f,p)&&(y=!y),xh(e,t,f,p,h,b)&&(y=!y),xh(e,t,h,b,a,o)&&(y=!y),y}function yU(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function vh(e,t,a,o,c,d){const f=Math.min(a,c),p=Math.max(a,c),h=Math.min(o,d),b=Math.max(o,d);return e>=f&&e<=p&&t>=h&&t<=b}function FT(e={}){const{blockPointerEvents:t=!1}=e,a=new sa,o=({x:c,y:d,placement:f,elements:p,onClose:h,nodeId:b,tree:y})=>{const v=f?.split("-")[0];let w=!1,j=null,S=null,N=typeof performance<"u"?performance.now():0;function k(D,C){const A=performance.now(),R=A-N;if(j===null||S===null||R===0)return j=D,S=C,N=A,!1;const I=D-j,P=C-S,O=I*I+P*P,_=R*R*vU;return j=D,S=C,N=A,O<_}function T(){a.clear(),h()}return function(C){a.clear();const A=p.domReference,R=p.floating;if(!A||!R||v==null||c==null||d==null)return;const{clientX:I,clientY:P}=C,O=cs(C),_=C.type==="mouseleave",L=Qe(R,O),H=Qe(A,O);if(L&&(w=!0,!_))return;if(H&&(w=!1,!_)){w=!0;return}if(_&&At(C.relatedTarget)&&Qe(R,C.relatedTarget))return;function B(){return!!(y&&io(y.nodesRef.current,b).length>0)}function z(){B()||T()}if(B())return;const Q=A.getBoundingClientRect(),K=R.getBoundingClientRect(),X=c>K.right-K.width/2,q=d>K.bottom-K.height/2,$=K.width>Q.width,Y=K.height>Q.height,F=($?Q:K).left,G=($?Q:K).right,W=(Y?Q:K).top,le=(Y?Q:K).bottom;if(v==="top"&&d>=Q.bottom-1||v==="bottom"&&d<=Q.top+1||v==="left"&&c>=Q.right-1||v==="right"&&c<=Q.left+1){z();return}let M=!1;switch(v){case"top":M=vh(I,P,F,Q.top+1,G,K.bottom-1);break;case"bottom":M=vh(I,P,F,K.top+1,G,Q.bottom-1);break;case"left":M=vh(I,P,K.right-1,le,Q.left+1,W);break;case"right":M=vh(I,P,Q.right-1,le,K.left+1,W);break}if(M)return;if(w&&!yU(I,P,Q)){z();return}if(!_&&k(I,P)){z();return}let U=!1;switch(v){case"top":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d+bn+1,ie=X||$?K.bottom-bn:K.top,ge=X?$?K.bottom-bn:K.top:K.bottom-bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"bottom":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d-bn,ie=X||$?K.top+bn:K.bottom,ge=X?$?K.top+bn:K.bottom:K.top+bn;U=bh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"left":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c+bn+1,ie=q||Y?K.right-bn:K.left,ge=q?Y?K.right-bn:K.left:K.right-bn;U=bh(I,P,ie,K.top,ge,K.bottom,J,ae,J,ce);break}case"right":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c-bn,ie=q||Y?K.left+bn:K.right,ge=q?Y?K.left+bn:K.right:K.left+bn;U=bh(I,P,J,ae,J,ce,ie,K.top,ge,K.bottom);break}}U?w||a.start(40,z):z()}};return o.__options={...e,blockPointerEvents:t},o}const wU={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class jU extends tu{constructor(a,o,c){const d=new fh;super(SU(a,d,o,c),NU(d),wU);ln(this,"setOpen",(a,o)=>{uU(this,a,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(a){this.state.floatingRootContext.dispatchOpenChange(!1,Fe(mo,a))}}function SU(e,t,a,o=!1){return{...Iy(t,a,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function NU(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const kU=sh(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:c,disableHoverablePopup:d=!1,trackCursorAxis:f="none",actionsRef:p,onOpenChange:h,onOpenChangeComplete:b,handle:y,triggerId:v,defaultTriggerId:w=null,children:j}=t,S=Ey((H,B)=>new jU({open:o,openProp:c,activeTriggerId:w,triggerIdProp:v},H,B));S.useControlledProp("openProp",c),S.useControlledProp("triggerIdProp",v),S.useContextCallback("onOpenChange",h),S.useContextCallback("onOpenChangeComplete",b);const N=S.useState("open"),k=!a&&N,T=S.useState("activeTriggerId"),D=S.useState("mounted"),C=S.useState("payload");S.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:d,disabled:a}),Oy(S,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:R}=My(k,S),I=S.useState("isInstantPhase"),P=S.useState("instantType"),O=S.useState("lastOpenChangeReason"),_=x.useRef(null);De(()=>{N&&a&&S.setOpen(!1,Fe(c4))},[N,a,S]),De(()=>{R==="ending"&&O===Yn||R!=="ending"&&I?(P!=="delay"&&(_.current=P),S.set("instantType","delay")):_.current!==null&&(S.set("instantType",_.current),_.current=null)},[R,I,O,P,S]),De(()=>{k&&T==null&&S.set("payload",void 0)},[S,T,k]),x.useImperativeHandle(p,()=>({unmount:A,close:()=>S.setOpen(!1,Fe(cy))}),[A,S]);const L=k||D||!a&&f!=="none";return s.jsxs(z1.Provider,{value:S,children:[y&&s.jsx(Ay,{handle:y,store:S}),L&&s.jsx(CU,{store:S,disabled:a,trackCursorAxis:f}),typeof j=="function"?j({payload:C}):j]})});function CU({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),c=af(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),d=dH(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),f=x.useMemo(()=>Wr(d.reference,c.reference),[d.reference,c.reference]);return Dy(e,{activeTriggerProps:f,inactiveTriggerProps:f,popupProps:c.floating??fn}),null}const $T=x.createContext(void 0);function TU(){return x.useContext($T)}const EU=600,qT="data-base-ui-tooltip-trigger";function GT(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;ok.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ae=mU(A,{enabled:!X}).reference,ce=fe=>{const te=F.current,Ce=GT(fe),re=U(Ce),de=R.current,ke=de&&Ce&&Qe(de,Ce);if(re&&k.select("open")&&k.select("lastOpenChangeReason")===Vs){k.setOpen(!1,Fe(Vs,fe));return}if(te&&!re&&ke&&!q.current&&!k.select("open")&&de&&co(W.current)){const Ee=()=>{!F.current&&!q.current&&!k.select("open")&&k.setOpen(!0,Fe(Vs,fe,de))},ve=le();ve===0?(G.clear(),Ee()):G.start(ve,Ee)}},J=k.useState("triggerProps",O);return yt("button",t,{state:{open:C},ref:[a,P,R],props:[Z,ae,O||$!=="none"?J:void 0,{onMouseOver(fe){ce(fe.nativeEvent)},onFocus(fe){M(GT(fe.nativeEvent))&&fe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,G.clear(),W.current=void 0},onPointerEnter(fe){W.current=fe.pointerType},onPointerDown(fe){W.current=fe.pointerType,k.set("closeOnClick",y),y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},onClick(fe){y&&!k.select("open")&&k.cancelPendingOpen(fe.nativeEvent)},id:T,[Gv]:X?"":void 0,[qT]:X?void 0:""},j],stateAttributesMapping:Fv})}),KT=x.createContext(void 0);function OU(){const e=x.useContext(KT);if(e===void 0)throw new Error(on(70));return e}const MU=x.forwardRef(function(t,a){const{children:o,container:c,className:d,render:f,style:p,...h}=t,{node:b,subtree:y}=J1({container:c,ref:a,componentProps:t,elementProps:h});return!y&&!b?null:s.jsxs(x.Fragment,{children:[y,b&&Cs.createPortal(o,b)]})}),DU=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return nf().useState("mounted")||o?s.jsx(KT.Provider,{value:o,children:s.jsx(MU,{ref:a,...c})}):null}),YT=x.createContext(void 0);function XT(){const e=x.useContext(YT);if(e===void 0)throw new Error(on(71));return e}const IU=x.createContext(void 0);function cf(){return x.useContext(IU)?.direction??"ltr"}const PU=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:c,rects:d,platform:f,elements:p,middlewareData:h}=t,{element:b,padding:y=0,offsetParent:v="real"}=uo(e,t)||{};if(b==null)return{};const w=i1(y),j={x:a,y:o},S=Wv(c),N=Zv(S),k=await f.getDimensions(b),T=S==="y",D=T?"top":"left",C=T?"bottom":"right",A=T?"clientHeight":"clientWidth",R=d.reference[N]+d.reference[S]-j[S]-d.floating[N],I=j[S]-d.reference[S],P=v==="real"?await f.getOffsetParent?.(b):p.floating;let O=p.floating[A]||d.floating[N];(!O||!await f.isElement?.(P))&&(O=p.floating[A]||d.floating[N]);const _=R/2-I/2,L=O/2-k[N]/2-1,H=Math.min(w[D],L),B=Math.min(w[C],L),z=H,Q=O-k[N]-B,K=O/2-k[N]/2+_,X=a1(z,K,Q),q=!h.arrow&&Sl(c)!=null&&K!==X&&d.reference[N]/2-(K{const{name:a,fn:o}=PU(e);return{name:a,fn:o,options:[e,t]}},LU={name:"hide",async fn(e){const{width:t,height:a,x:o,y:c}=e.rects.reference,d=t===0&&a===0&&o===0&&c===0,f=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:f.top-a>=0||f.right-t>=0||f.bottom-a>=0||f.left-t>=0||d}}}},zU={sideX:"left",sideY:"top"},BU="--available-width",HU="--available-height",UU="--anchor-width",VU="--anchor-height",FU="--transform-origin",QT=BU,ZT=HU;function WT(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function JT(e,t,a){const{rects:o,placement:c}=e;return{side:WT(t,ta(c),a),align:Sl(c)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function yh(e){return $U(e,fU)}function $U(e,t){const{anchor:a,positionMethod:o="absolute",side:c="bottom",sideOffset:d=0,align:f="center",alignOffset:p=0,collisionBoundary:h,collisionPadding:b=5,sticky:y=!1,arrowPadding:v=5,disableAnchorTracking:w=!1,inline:j,keepMounted:S=!1,floatingRootContext:N,mounted:k,collisionAvoidance:T,shift:D,nodeId:C,adaptiveOrigin:A,lazyFlip:R=!1,externalTree:I}=e,[P,O]=x.useState(null);!k&&P!==null&&O(null);const _=T.side||"flip",L=T.align||"flip",H=T.fallbackAxisSide||"end",B=D?.crossAxis??!1,z=D?.rootBoundary,Q=typeof a=="function"?a:void 0,K=Ie(Q),X=Q?K:a,q=Xn(a),$=Xn(k),F=cf()==="rtl",G=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[c],W=f==="center"?G:`${G}-${f}`;let le=b;typeof le=="number"?le={top:le,right:le,bottom:le,left:le}:le&&(le={top:le.top||0,right:le.right||0,bottom:le.bottom||0,left:le.left||0});const M=1,U=c==="bottom"?M:0,Z=c==="top"?M:0,ae=c==="right"?M:0,ce=c==="left"?M:0,J={boundary:h==="clipping-ancestors"?"clippingAncestors":h,padding:le},ie=x.useRef(null),ge=Xn(d),ee=Xn(p),fe=typeof d!="function"?d:0,te=typeof p!="function"?p:0,Ce=[];j&&Ce.push(j),Ce.push(KH(nt=>{const Ot=JT(nt,c,F),Ft=typeof ge.current=="function"?ge.current(Ot):ge.current,Zn=typeof ee.current=="function"?ee.current(Ot):ee.current;return{mainAxis:Ft,crossAxis:Zn,alignmentAxis:Zn}},[fe,te,F,c]));const re=L==="none"&&_!=="shift",de=!re&&(y||B||_==="shift"),ke=_==="none"?null:QH({...J,padding:{top:le.top+M+U,right:le.right+M+ce,bottom:le.bottom+M+Z,left:le.left+M+ae},mainAxis:!B&&_==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Ee=re?null:YH({...J,rootBoundary:z,mainAxis:L!=="none",crossAxis:de,limiter:y||B?void 0:XH(nt=>{if(!ie.current)return{};const{width:Ot,height:Ft}=ie.current.getBoundingClientRect(),Zn=na(ta(nt.placement)),Un=Zn==="y"?Ot:Ft,Vn=Zn==="y"?le.left+le.right:le.top+le.bottom;return{offset:Un/2+Vn/2}})},[J,y,B,z,le,L]);_==="shift"||L==="shift"||f==="center"?Ce.push(Ee,ke):Ce.push(ke,Ee),Ce.push(ZH({...J,apply({elements:{floating:nt},availableWidth:Ot,availableHeight:Ft,rects:Zn}){if(!$.current)return;const Un=nt.style;Un.setProperty(QT,`${Ot}px`),Un.setProperty(ZT,`${Ft}px`);const Vn=Sn(nt).devicePixelRatio||1,{x:Rn,y:Jt,width:ls,height:Tt}=Zn.reference,xt=(Math.round((Rn+ls)*Vn)-Math.round(Rn*Vn))/Vn,wt=(Math.round((Jt+Tt)*Vn)-Math.round(Jt*Vn))/Vn;Un.setProperty(UU,`${xt}px`),Un.setProperty(VU,`${wt}px`)}}),_U(nt=>({element:ie.current||$t(nt.elements.floating).createElement("div"),padding:ie.current?v:0,offsetParent:"floating"}),[v]),{name:"transformOrigin",fn(nt){const{elements:{floating:Ot},middlewareData:Ft,placement:Zn,platform:Un,rects:Vn,y:Rn}=nt,Jt=ta(Zn),ls=Sl(Zn),Tt=na(Jt)==="y",xt=ie.current,wt=typeof d=="function"?d(JT(nt,c,F)):d;let jt;if(!xt&&ls&&Math.abs(Tt?Ft.shift?.x||0:Ft.shift?.y||0)<=1)jt=ls==="start"===(Tt&&Un.isRTL?.(Ot)===!0)?"100%":"0%";else{const rr=Tt?Ft.arrow?.x||0:Ft.arrow?.y||0,Hr=Tt?xt?.clientWidth||0:xt?.clientHeight||0;jt=`${rr+Hr/2}px`}let Nr=Jt==="top"||Jt==="left"?`calc(100% + ${wt}px)`:`${-wt}px`;return de&&Tt&&Math.abs(Ft.shift?.y||0)>wt&&(Nr=`${Vn.reference.y+Vn.reference.height/2-Rn}px`),Ot.style.setProperty(FU,Tt?`${jt} ${Nr}`:`${Nr} ${jt}`),{}}},LU,A),De(()=>{!k&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,N]);const ve=x.useMemo(()=>({ancestorScroll:!w,elementResize:!w&&typeof ResizeObserver<"u",layoutShift:!w&&typeof IntersectionObserver<"u"}),[w]),{refs:he,elements:ye,x:je,y:xe,middlewareData:Te,update:Oe,placement:Ne,context:_e,isPositioned:Ye,floatingStyles:kt}=t({rootContext:N,open:S?k:void 0,placement:W,middleware:Ce,strategy:o,whileElementsMounted:S?void 0:(...nt)=>bT(...nt,ve),nodeId:C,externalTree:I}),{sideX:Ct,sideY:Rt}=Te.adaptiveOrigin||zU,ot=Ye?o:"fixed",qn=x.useMemo(()=>{let nt;return Ye?A?nt={position:ot,[Ct]:je,[Rt]:xe}:nt={...kt,position:ot}:nt={position:ot,top:0,left:0},nt[QT]="100vw",nt[ZT]="100vh",Ye||(nt.opacity=0),nt},[A,ot,Ct,je,Rt,xe,kt,Ye]),fs=x.useRef(null);De(()=>{if(!k)return;const nt=q.current,Ot=typeof nt=="function"?nt():nt,Zn=(eE(Ot)?Ot.current:Ot)||null||null;Zn!==fs.current&&(he.setPositionReference(Zn),fs.current=Zn)},[k,he,X,q]),x.useEffect(()=>{if(!k)return;const nt=q.current;typeof nt!="function"&&eE(nt)&&nt.current!==fs.current&&(he.setPositionReference(nt.current),fs.current=nt.current)},[k,he,X,q]),x.useEffect(()=>{if(S&&k&&ye.reference&&ye.floating)return bT(ye.reference,ye.floating,Oe,ve)},[S,k,ye,Oe,ve]);const Gn=ta(Ne),bs=WT(c,Gn,F),it=Sl(Ne)||"center",Vt=!!Te.hide?.referenceHidden;De(()=>{R&&k&&Ye&&Gn!==G&&O(Gn)},[R,k,Ye,Gn,G]);const Hn=x.useMemo(()=>({position:"absolute",top:Te.arrow?.y,left:Te.arrow?.x}),[Te.arrow]),tn=Te.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:qn,arrowStyles:Hn,arrowRef:ie,arrowUncentered:tn,side:bs,align:it,physicalSide:Gn,anchorHidden:Vt,refs:he,context:_e,isPositioned:Ye,update:Oe}),[qn,Hn,ie,tn,bs,it,Gn,Vt,he,_e,Ye,Oe])}function eE(e){return e!=null&&"current"in e}function uf(e){return e==="starting"?tH:fn}function wh(e,t,{styles:a,transitionStatus:o,props:c,refs:d,hidden:f,inert:p=!1}){const h={...a};return p&&(h.pointerEvents="none"),yt("div",e,{state:t,ref:d,props:[{role:"presentation",hidden:f,style:h},uf(o),c],stateAttributesMapping:$c})}const qU=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f="absolute",side:p="top",align:h="center",sideOffset:b=0,alignOffset:y=0,collisionBoundary:v="clipping-ancestors",collisionPadding:w=5,arrowPadding:j=5,sticky:S=!1,disableAnchorTracking:N=!1,collisionAvoidance:k=Q1,style:T,...D}=t,C=nf(),A=OU(),R=C.useState("open"),I=C.useState("mounted"),P=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),_=C.useState("floatingRootContext"),L=C.useState("instantType"),H=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),z=yh({anchor:d,positionMethod:f,floatingRootContext:_,mounted:I,side:p,sideOffset:b,align:h,alignOffset:y,collisionBoundary:v,collisionPadding:w,sticky:S,arrowPadding:j,disableAnchorTracking:N,keepMounted:A,collisionAvoidance:k,adaptiveOrigin:B}),Q=x.useMemo(()=>({open:R,side:z.side,align:z.align,anchorHidden:z.anchorHidden,instant:P!=="none"?"tracking-cursor":L}),[R,z.side,z.align,z.anchorHidden,P,L]),K=wh(t,Q,{styles:z.positionerStyles,transitionStatus:H,props:D,refs:[a,C.useStateSetter("positionerElement")],hidden:!I,inert:!R||P==="both"||O});return s.jsx(YT.Provider,{value:z,children:K})}),GU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{side:h,align:b}=XT(),y=p.useState("open"),v=p.useState("instantType"),w=p.useState("transitionStatus"),j=p.useState("popupProps"),S=p.useState("floatingRootContext"),N=p.useState("disabled"),k=p.useState("closeDelay");ra({open:y,ref:p.context.popupRef,onComplete(){y&&p.context.onOpenChangeComplete?.(!0)}}),LT(S,{enabled:!N,closeDelay:k});const T=p.useStateSetter("popupElement");return yt("div",t,{state:{open:y,side:h,align:b,instant:v,transitionStatus:w},ref:[a,p.context.popupRef,T],props:[lf,j,uf(w),f],stateAttributesMapping:qv})}),KU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{arrowRef:h,side:b,align:y,arrowUncentered:v,arrowStyles:w}=XT(),j=p.useState("open"),S=p.useState("instantType");return yt("div",t,{state:{open:j,side:b,align:y,uncentered:v,instant:S},ref:[a,h],props:[{style:w,"aria-hidden":!0},f],stateAttributesMapping:$c})}),YU=function(t){const{delay:a,closeDelay:o,timeout:c=400}=t,d=x.useMemo(()=>({open:a,close:o}),[a,o]);return s.jsx($T.Provider,{value:a,children:s.jsx(X4,{delay:d,timeoutMs:c,children:t.children})})};function jh(e){return Iv(19)?e:e?"true":void 0}function XU(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function QU(e){return s.jsx(YU,{"data-slot":"tooltip-provider",...e})}function Ii(e){return s.jsx(kU,{"data-slot":"tooltip",...e})}function Pi(e){return s.jsx(RU,{"data-slot":"tooltip-trigger",...e})}function _i({className:e,sideOffset:t=8,side:a="top",children:o,...c}){return s.jsx(DU,{children:s.jsx(qU,{sideOffset:t,side:a,className:"z-[35]",children:s.jsx(GU,{"data-slot":"tooltip-content",className:Ue("max-w-[288px] rounded-md bg-primary px-2.5 py-2 text-[11.5px] leading-[1.55] text-primary-on shadow-3","break-words outline-none","transition-[opacity,transform] duration-150 ease-out","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:o})})})}function ZU({className:e,...t}){return s.jsx(KU,{className:Ue("size-2 rotate-45 rounded-[1px] bg-primary","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1",e),...t})}const tE=x.createContext(void 0);function nu(e){const t=x.useContext(tE);if(!e&&t===void 0)throw new Error(on(27));return t}const nE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,forceRender:f=!1,...p}=t,h=nu(),b=h.useState("open"),y=h.useState("nested"),v=h.useState("mounted"),w=h.useState("transitionStatus");return yt("div",t,{state:{open:b,transitionStatus:w},ref:[h.context.backdropRef,a],stateAttributesMapping:qv,props:[{role:"presentation",hidden:!v,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:f||!y})}),sE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,...h}=t,b=nu(),y=b.useState("open"),{getButtonProps:v,buttonRef:w}=Jr({disabled:f,native:p}),j={disabled:f};function S(N){y&&b.setOpen(!1,Fe(oy,N.nativeEvent))}return yt("button",t,{state:j,ref:[a,w],props:[{onClick:S},h,v]})}),rE=x.createContext(void 0);function WU(){const e=x.useContext(rE);if(e===void 0)throw new Error(on(26));return e}const Uy="ArrowUp",Vy="ArrowDown",Fy="ArrowLeft",$y="ArrowRight",qy="Home",Gy="End",Sh=new Set([Uy,Vy,Fy,$y,qy,Gy]),aE="Shift",JU=[aE,"Control","Alt","Meta"];function eV(e){return dn(e)&&e.tagName==="INPUT"}function lE(e){return!!(eV(e)&&e.selectionStart!=null||dn(e)&&e.tagName==="TEXTAREA")}function oE(e,t,a,o){if(!e||!t||!t.scrollTo)return;let c=e.scrollLeft,d=e.scrollTop;const f=e.clientWidthe.scrollLeft+e.clientWidth-b.scrollPaddingRight?c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight:h-y.scrollMarginLefte.scrollLeft+e.clientWidth-b.scrollPaddingRight&&(c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+b.scrollPaddingRight))}if(p&&o!=="horizontal"){const h=iE(e,t,"top"),b=Nh(e),y=Nh(t);h-y.scrollMarginTope.scrollTop+e.clientHeight-b.scrollPaddingBottom&&(d=h+t.offsetHeight+y.scrollMarginBottom-e.clientHeight+b.scrollPaddingBottom)}e.scrollTo({left:c,top:d,behavior:"auto"})}function iE(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let c=0;for(;t.offsetParent&&(c+=t[o],t.offsetParent!==e);)t=t.offsetParent;return c}function Nh(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const tV="--nested-dialogs",nV="data-nested-dialog-open",sV={...$c,...oo,nestedDialogOpen(e){return e?{[nV]:""}:null}},cE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,initialFocus:p,...h}=t,b=nu(),y=b.useState("descriptionElementId"),v=b.useState("disablePointerDismissal"),w=b.useState("floatingRootContext"),j=b.useState("popupProps"),S=b.useState("modal"),N=b.useState("mounted"),k=b.useState("nested"),T=b.useState("nestedOpenDialogCount"),D=b.useState("open"),C=b.useState("openMethod"),A=b.useState("titleElementId"),R=b.useState("transitionStatus"),I=b.useState("role"),P=w.useState("floatingId");WU(),ra({open:D,ref:b.context.popupRef,onComplete(){D&&b.context.onOpenChangeComplete?.(!0)}});const O=p===void 0?TT(b.context.popupRef):p,_=T>0,L=b.useStateSetter("popupElement"),B=yt("div",t,{state:{open:D,nested:k,transitionStatus:R,nestedDialogOpen:_},props:[j,{id:P,"aria-labelledby":A,"aria-describedby":y,role:I,...lf,hidden:!N,onKeyDown(z){Sh.has(z.key)&&z.stopPropagation()},style:{[tV]:T}},h],ref:[a,b.context.popupRef,L],stateAttributesMapping:sV});return s.jsx(oh,{context:w,openInteractionType:C,disabled:!N,closeOnFocusOut:!v,initialFocus:O,returnFocus:f,modal:S!==!1,restoreFocus:"popup",children:B})}),kh=x.forwardRef(function(t,a){const{cutout:o,...c}=t;let d;if(o){const f=o.getBoundingClientRect();d=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${f.left}px ${f.top}px,${f.left}px ${f.bottom}px,${f.right}px ${f.bottom}px,${f.right}px ${f.top}px,${f.left}px ${f.top}px)`}return s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...c,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:d}})}),uE=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=nu(),f=d.useState("mounted"),p=d.useState("modal"),h=d.useState("open");return f||o?s.jsx(rE.Provider,{value:o,children:s.jsxs(lh,{ref:a,...c,children:[f&&p===!0&&s.jsx(kh,{ref:d.context.internalBackdropRef,inert:jh(!h)}),t.children]})}):null});let dE={},fE={},pE="";function Ch(e,t){return Fd(e)?e:t}function mE(e,t,a){return/hidden|clip/.test(e.getComputedStyle(Ch(t,a)).overflowY)}function rV(e){if(typeof document>"u")return!1;const t=$t(e);return Sn(t).innerWidth-t.documentElement.clientWidth>0}function aV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=$t(e),o=a.documentElement,c=a.body,d=Ch(o,c),f=d.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",d.style.overflowY="scroll";const h=d.offsetWidth;d.style.overflowY="hidden";const b=d.offsetWidth;return d.style.overflowY=f,o.style.scrollbarGutter=p,h===b}function lV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Ch(a,o),d={overflowY:c.style.overflowY,overflowX:c.style.overflowX};return Object.assign(c.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(c.style,d)}}function oV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Sn(a);let d=0,f=0,p=!1;const h=qa.create();if(yl&&(c.visualViewport?.scale??1)!==1)return()=>{};function b(){const j=c.getComputedStyle(a),S=c.getComputedStyle(o),T=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";d=a.scrollTop,f=a.scrollLeft,dE={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},pE=a.style.scrollBehavior,fE={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const D=a.scrollHeight>a.clientHeight,C=a.scrollWidth>a.clientWidth,A=j.overflowY==="scroll"||S.overflowY==="scroll",R=j.overflowX==="scroll"||S.overflowX==="scroll",I=Math.max(0,c.innerWidth-o.clientWidth),P=Math.max(0,c.innerHeight-o.clientHeight),O=parseFloat(S.marginTop)+parseFloat(S.marginBottom),_=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Ch(a,o);if(p=aV(e),p){a.style.scrollbarGutter=T,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(D||A)&&(a.style.overflowY="scroll"),(C||R)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:O||P?`calc(100dvh - ${O+P}px)`:"100dvh",width:_||I?`calc(100vw - ${_+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=d,o.scrollLeft=f,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,dE),Object.assign(o.style,fE),p||(a.scrollTop=d,a.scrollLeft=f,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=pE)}function v(){y(),h.request(b)}b();const w=St(c,"resize",v);return()=>{h.cancel(),y(),typeof c.removeEventListener=="function"&&w()}}class iV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",sa.create());ln(this,"timeoutUnlock",sa.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const a=$t(t),o=a.documentElement,c=a.body,d=Sn(o);if(mE(d,o,c)){const p=new d.MutationObserver(()=>{mE(d,o,c)||(p.disconnect(),this.restore=null,this.lock(t))}),h={attributes:!0};p.observe(o,h),p.observe(c,h),this.restore=()=>p.disconnect();return}const f=Yd||!rV(t);this.restore=f?lV(t):oV(t)}}const cV=new iV;function hE(e=!0,t=null){De(()=>{if(e)return cV.acquire(t)},[e,t])}function uV({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[h,b]=x.useState(0),[y,v]=x.useState(0),w=h===0,j=af(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0)return!1;if("touches"in S){if(S.type==="touchend"){if(S.changedTouches.length!==1||S.touches.length!==0)return!1}else if(S.touches.length!==1)return!1}const N=cs(S);if(w&&!c){if(d){const k=e.context.internalBackdropRef.current,T=e.context.backdropRef.current;return k||T?k===N||T===N||Qe(N,f)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:w});return hE(o&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(S,N)=>{b(S),v(N)}),De(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(h+1,y+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[a,o,h,y,t]),Dy(e,{activeTriggerProps:j.reference,inactiveTriggerProps:j.trigger,popupProps:j.floating,nestedOpenDialogCount:h,nestedOpenDrawerCount:y}),null}const dV={..._y,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class fV extends tu{constructor(a,o,c){const d=new fh,f=pV(a,d,o,c);super(f,mV(d),dV);ln(this,"setOpen",(a,o)=>{o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(a,o),this.update(Ry(this.state,a,o.trigger)))})}}function pV(e,t,a,o=!1){return{...Iy(t,a,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function mV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gE(e,t){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,disablePointerDismissal:p=!1,modal:h=!0,actionsRef:b,handle:y,triggerId:v,defaultTriggerId:w=null}=t,j=e==="drawer",S=e==="alert-dialog",N=S?!0:h,k=S||p,T=S?"alertdialog":"dialog",D=nu(!0),C=D!=null,A={modal:N,disablePointerDismissal:k,nested:C,role:T},R=Ey((H,B)=>new fV({open:c,openProp:o,activeTriggerId:w,triggerIdProp:v,...A},H,B),!0);R.useControlledProp("openProp",o),R.useControlledProp("triggerIdProp",v),R.useSyncedValues(A),R.useContextCallback("onOpenChange",d),R.useContextCallback("onOpenChangeComplete",f);const I=R.useState("open"),P=R.useState("mounted"),O=R.useState("payload");OT(R,I),Oy(R);const{forceUnmount:_}=My(I,R);x.useImperativeHandle(b,()=>({unmount:_,close:()=>R.setOpen(!1,Fe(cy))}),[_,R]);const L=I||P;return s.jsxs(tE.Provider,{value:R,children:[y&&s.jsx(Ay,{handle:y,store:R}),L&&s.jsx(uV,{store:R,parentContext:D?.context,isDrawer:j}),typeof a=="function"?a({payload:O}):a]})}const hV=sh(function(t){return gE("dialog",t)}),xE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,id:f,...p}=t,h=nu(),b=Na(f);return h.useSyncedValueWithCleanup("titleElementId",b),yt("h2",t,{ref:a,props:[{id:b},p]})});function gV(e){const t=x.useRef(""),a=x.useCallback(c=>{c.defaultPrevented||(t.current=c.pointerType,e(c,c.pointerType))},[e]);return{onClick:x.useCallback(c=>{if(c.detail===0){e(c,"keyboard");return}"pointerType"in c?e(c,c.pointerType):e(c,t.current),t.current=""},[e]),onPointerDown:a}}function bE(e,t){const a=Ie((d,f)=>{(typeof e=="function"?e():e)||t(f||(Yd?"touch":""))}),{onClick:o,onPointerDown:c}=gV(a);return x.useMemo(()=>({onClick:o,onPointerDown:c}),[o,c])}function vE(e){const[t,a]=x.useState(null),o=bE(e,a);return aa(e,c=>{c&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Qt(e){return s.jsx(hV,{"data-slot":"dialog",...e})}function xV(e){return s.jsx(uE,{"data-slot":"dialog-portal",...e})}const Gt=e=>s.jsx(xE,{"data-slot":"dialog-title",...e});function bV({className:e,...t}){return s.jsx(nE,{"data-slot":"dialog-overlay",className:Ue("fixed inset-0 isolate z-30 bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function Zt({className:e,children:t,showCloseButton:a=!0,keepMounted:o=!1,overlayForceRender:c=!1,...d}){return s.jsxs(xV,{keepMounted:o,children:[s.jsx(bV,{forceRender:c}),s.jsxs(cE,{"data-slot":"dialog-content",className:Ue("fixed top-1/2 left-1/2 z-30 flex max-h-[calc(100vh-48px)] w-[min(620px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...d,children:[t,a&&s.jsxs(sE,{"data-slot":"dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function Kt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px] pr-10","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function Bt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function zn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-section",className:Ue("flex flex-col gap-2.5 rounded-md border border-border bg-surface-inset p-3.5","[&_h3]:text-[12.5px] [&_h3]:font-semibold","[&_p]:text-xs [&_p]:leading-[1.65] [&_p]:text-subtle",e),...t})}function vV(e){return gE("alert-dialog",e)}const yV=vV,wV=uE,jV=e=>s.jsx(xE,{"data-slot":"alert-dialog-title",...e});function SV({className:e,...t}){return s.jsx(nE,{"data-slot":"alert-dialog-overlay",className:Ue("fixed inset-0 isolate z-[38] bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function NV({className:e,children:t,showCloseButton:a=!1,...o}){return s.jsxs(wV,{children:[s.jsx(SV,{}),s.jsxs(cE,{"data-slot":"alert-dialog-content",className:Ue("fixed top-1/2 left-1/2 z-[38] flex max-h-[calc(100vh-48px)] w-[min(440px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...o,children:[t,a&&s.jsxs(sE,{"data-slot":"alert-dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:go("关闭")})]})]})]})}function kV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px]","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function CV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function TV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function EV({className:e,tone:t="danger",...a}){return s.jsx("div",{"data-slot":"alert-dialog-banner","data-tone":t,className:Ue("rounded-md border px-3.5 py-3 text-xs leading-[1.65] text-subtle","[&_strong]:font-semibold",t==="danger"?"border-destructive-bd bg-destructive-soft [&_strong]:text-destructive":"border-border bg-surface-inset [&_strong]:text-foreground",e),...a})}function Ky({className:e,containerClassName:t,...a}){return s.jsx("div",{"data-slot":"table-container",className:Ue("relative w-full overflow-auto",t),children:s.jsx("table",{"data-slot":"table",className:Ue("w-full caption-bottom border-collapse text-[12.5px]",e),...a})})}function yE({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:Ue(e),...t})}function Yy({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:Ue(e),...t})}function kl({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:Ue("transition-colors duration-100 hover:[&>td]:bg-control-hover",e),...t})}function wE({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:Ue("sticky top-0 z-[2] whitespace-nowrap border-b border-border bg-surface-2 px-3.5 py-2","text-left text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground",e),...t})}function Nn({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:Ue("border-b border-hairline px-3.5 py-2 align-middle",e),...t})}const AV="data-checked",RV="data-unchecked",Xy={checked(e){return e?{[AV]:""}:{[RV]:""}},...oo,...wi},Qy="data-composite-item-active",jE=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function OV(){return x.useContext(jE)}function Zy(e={}){const{guess:t,label:a,metadata:o,textRef:c,index:d}=e,{register:f,unregister:p,subscribeMapChange:h,nextIndexRef:b}=OV(),y=x.useRef(-1),[v,w]=x.useState(d==null&&t?()=>{if(y.current===-1){const k=b.current;b.current+=1,y.current=k}return y.current}:-1),j=d??v,S=x.useRef(null),N=x.useCallback(k=>{const T=S.current;T&&p(T),S.current=k,k&&f(k,{metadata:o??null,index:d??null,label:a,textRef:c})},[d,f,p,o,a,c]);return De(()=>{if(d==null)return h(k=>{const T=S.current?k.get(S.current)?.index:null;T!=null&&w(T)})},[d,h]),{ref:N,index:j}}function MV(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=vC(),{ref:c,index:d}=Zy(e),f=a===d,p=x.useRef(null),h=ea(c,p);return{compositeProps:{tabIndex:f?0:-1,onFocus(){o(d)},onMouseMove(){const y=p.current;if(!t||!y)return;const v=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!v&&y.focus()}},compositeRef:h,index:d}}function SE(e){const{render:t,className:a,style:o,state:c=fn,props:d=Or,refs:f=Or,metadata:p,stateAttributesMapping:h,tag:b="div",...y}=e,{compositeProps:v,compositeRef:w}=MV({metadata:p});return yt(b,e,{state:c,ref:[w,...f],props:[v,...d,y],stateAttributesMapping:h})}const NE=x.createContext(void 0);function DV(){return x.useContext(NE)}function Th(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const kE=x.createContext(void 0);function IV(){const e=x.useContext(kE);if(e===void 0)throw new Error(on(52));return e}const CE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,readOnly:f=!1,required:p=!1,"aria-labelledby":h,value:b,inputRef:y,nativeButton:v=!1,id:w,style:j,...S}=t,N=DV(),{disabled:k,readOnly:T,required:D,form:C,checkedValue:A,touched:R=!1,validation:I,name:P,setCheckedValue:O=qt,setTouched:_=qt,registerInputRef:L=qt}=N??{},{setTouched:H,setFilled:B,state:z,disabled:Q}=Sa(),K=y1(),{labelId:X,getDescriptionProps:q}=vl(),$=Q||K.disabled||k||d,Y=T||f,F=D||p,G=C,W=N?A===b:b==="",le=x.useRef(null),M=x.useRef(null),U=I?.registerInput,Z=x.useCallback(ye=>U?.(ye,{controlRef:le,value:void 0}),[U]),ae=ea(y,M,L,Z);De(()=>{M.current?.checked&&B(!0)},[B]),De(()=>{if(M.current){if($&&W){L(null);return}L(M.current)}},[W,$,L]);const ce=Na(),J=lo({id:w}),ie=v?void 0:J,ge=Bv(h,X,M,!v,ie),ee={role:"radio","aria-checked":W,"aria-labelledby":ge,[Qy]:W?"":void 0,id:v?J:ce,onKeyDown(ye){ye.key==="Enter"&&ye.preventDefault()},onClick(ye){if(ye.defaultPrevented||$||Y)return;ye.preventDefault();const je=M.current;je&&Uc(je,ye)},onFocus(ye){ye.defaultPrevented||$||Y||!R||(M.current?.click(),_(!1))}},{getButtonProps:fe,buttonRef:te}=Jr({disabled:$,native:v,composite:!1}),Ce={type:"radio",ref:ae,form:G,id:ie,name:P,tabIndex:-1,style:P?Zc:Ai,"aria-hidden":!0,...b!==void 0?{value:Th(b)}:fn,disabled:$,checked:W,required:F,readOnly:Y,onChange(ye){if(ye.nativeEvent.defaultPrevented||$||Y||b===void 0)return;const je=Fe(Yn,ye.nativeEvent);O(b,je),!je.isCanceled&&H(!0)},onClick(ye){ye.stopPropagation()},onFocus(){le.current?.focus()}},re=x.useMemo(()=>({...z,required:F,disabled:$,readOnly:Y,checked:W}),[z,$,Y,W,F]),de=re,ke=N!==void 0,Ee=[a,le,te],ve=[ee,S,fe,q,I?ye=>I.getValidationProps($,ye):fn],he=yt("span",t,{enabled:!ke,state:re,ref:Ee,props:ve,stateAttributesMapping:Xy});return s.jsxs(kE.Provider,{value:de,children:[ke?s.jsx(SE,{tag:"span",render:o,className:c,style:j,state:re,refs:Ee,props:ve,stateAttributesMapping:Xy}):he,s.jsx("input",{...Ce,suppressHydrationWarning:!0})]})}),PV=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=IV(),b=h.checked,{mounted:y,transitionStatus:v,setMounted:w}=ki(b),j={...h,transitionStatus:v},S=x.useRef(null),N=f||y,k=yt("span",t,{ref:[a,S],state:j,props:p,stateAttributesMapping:Xy});return ra({batch:!0,enabled:!b,open:b,ref:S,onComplete(){b||w(!1)}}),N?k:null});function Wy(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:c}=e,d=Ie(c),[,f]=x.useState(!1),p=Ds(LV).current,h=Ds(_V).current,b=x.useRef(0),y=x.useRef(!0),v=x.useRef(null),w=x.useRef(null),j=Ie(()=>{y.current||(y.current=!0,f(R=>!R))}),S=Ie((R,I)=>{h.set(R,I),j()}),N=Ie(R=>{h.delete(R),j()}),k=Ie(R=>{const I=new Map;return a.current.length=0,o&&(o.current.length=0),R.forEach(P=>{I.set(P.element,{...P.registration.metadata??{},index:P.index}),a.current[P.index]=P.element,o&&(o.current[P.index]=P.registration.label!==void 0?P.registration.label:P.registration.textRef?.current?.textContent??P.element.textContent)}),b.current=a.current.length,I});function T(R){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!="function"||R.length<2)return;const I=new MutationObserver(O=>{if(!HV(O))return;let _=null;for(const L of R)if(L.isConnected){if(_&&TE(_,L)>0){I.disconnect(),j();return}_=L}});w.current=I;const P=new Set;for(let O=1;OI.observe(O,{childList:!0}))}const D=Ie(()=>{const[R,I]=zV(h),P=k(R),O=v.current,_=!O||O.length!==R.length||R.some((L,H)=>{const B=O[H];return L.index!==B.index||L.element!==B.element||L.registration.index!==B.registration.index||L.registration.metadata!==B.registration.metadata});T(I),v.current=R,y.current=!1,_&&(p.forEach(L=>L(P)),d(P))});De(()=>(!y.current&&v.current&&k(v.current),()=>{a.current=[],o&&(o.current=[])}),[a,o,k]),De(()=>{y.current&&D()}),De(()=>()=>{w.current?.disconnect(),y.current=!0},[]);const C=Ie(R=>(p.add(R),()=>{p.delete(R)})),A=x.useMemo(()=>({register:S,unregister:N,subscribeMapChange:C,nextIndexRef:b}),[S,N,C,b]);return s.jsx(jE.Provider,{value:A,children:t})}function _V(){return new Map}function LV(){return new Set}function zV(e){const t=new Set,a=[],o=[];e.forEach((d,f)=>{if(!f.isConnected)return;const p=d.index,h={index:p??-1,element:f,registration:d};p===null?o.push(h):p>=0&&(t.add(p),a.push(h))});let c=0;return o.sort((d,f)=>TE(d.element,f.element)),o.forEach(d=>{for(;t.has(c);)c+=1;d.index=c,a.push(d),c+=1}),t.size>0&&a.sort((d,f)=>d.index-f.index),[a,o.map(d=>d.element)]}function BV(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function HV(e){for(const t of e)for(let a=0;a{if(A.current=D.current[H]??null,(p??S)(H),B){const z=D.current[H];oE(k.current,z,d,a)}}),P=Ie(H=>{if(H.size===0)return;if(C.current){const K=D.current,X=K.indexOf(A.current);if(X===-1){const q=K[R];!q||po(K,R,v)?I(VV(K,v)):A.current=q}else X!==R&&I(X);return}C.current=!0;const B=Array.from(H.keys()),z=B.find(K=>K?.hasAttribute(Qy))??null,Q=z?H.get(z)?.index??-1:-1;if(Q!==-1)I(Q);else if(po(B,R,v)){const K=Is(B,{disabledIndices:v});fo(B,K)||I(K)}oE(k.current,z,d,a)});De(()=>{if(v==null||f!=null||!C.current)return;const H=D.current;if(po(H,R,v)){const B=Is(H,{disabledIndices:v});fo(H,B)||I(B)}},[v,f,R,D,I]);const O=Ie((H,B,z)=>c?c(H,B,z,D):z),_=Ie(H=>{const B=H.key===qy||H.key===Gy;if(!Sh.has(H.key)||!b&&B||FV(H,w)||!k.current)return;const Q=d==="rtl",K=Q?Fy:$y,X=Q?$y:Fy,q=a==="vertical"?Vy:K,$=a==="vertical"?Uy:X,Y=cs(H.nativeEvent);if(Y!=null&&lE(Y)&&!EE(Y)){const U=Y.selectionStart,Z=Y.selectionEnd,ae=Y.value;if(U==null||H.shiftKey||U!==Z||H.key!==$&&U0)return}let F=R;const G=Qm(D,v),W=ey(D,v);o!=null&&(F=o({disabledIndices:v,elementsRef:D,event:H,highlightedIndex:R,loopFocus:t,maxIndex:W,minIndex:G,onLoop:O,orientation:a,rtl:Q}));const le=a!=="vertical"&&H.key===K||a!=="horizontal"&&H.key===Vy,M=a!=="vertical"&&H.key===X||a!=="horizontal"&&H.key===Uy;b&&(H.key===qy?F=G:H.key===Gy&&(F=W)),F===R&&(le||M)&&(t&&F===W&&le?(F=G,c&&(F=c(H,R,F,D))):t&&F===G&&M?(F=W,c&&(F=c(H,R,F,D))):F=Is(D.current,{startingIndex:F,decrement:M,disabledIndices:v})),F!==R&&!fo(D.current,F)&&(y&&H.stopPropagation(),(N||B||le||M)&&H.preventDefault(),I(F,!0),queueMicrotask(()=>{D.current[F]?.focus()}))});return{props:{ref:T,onFocus(H){const B=k.current,z=cs(H.nativeEvent);!B||z==null||!lE(z)||z.setSelectionRange(0,z.value.length)},onKeyDown:_},highlightedIndex:R,onHighlightedIndexChange:I,elementsRef:D,onMapChange:P,relayKeyboardEvent:_}}function VV(e,t){let a=-1;for(let o=0;o({highlightedIndex:_,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:z}),[_,L,A,z]);return s.jsx(bC.Provider,{value:K,children:s.jsx(Wy,{elementsRef:H,onMapChange:X=>{N?.(X),B(X)},children:Q})})}const qV=[aE],AE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d,readOnly:f,required:p,onValueChange:h,value:b,defaultValue:y,form:v,name:w,inputRef:j,id:S,style:N,...k}=t,{setTouched:T,setFocused:D,validationMode:C,name:A,disabled:R,state:I,validation:P,setDirty:O,setFilled:_,validityData:L}=Sa(),{labelId:H}=vl(),{clearErrors:B,elementRef:z}=Fc(),Q=uB(!0),K=R||d,X=A??w,q=Na(S),[$,Y]=Ga({controlled:b,default:y,name:"RadioGroup",state:"value"}),[F,G]=x.useState(!1),W=Ie((te,Ce)=>{h?.(te,Ce),!Ce.isCanceled&&Y(te)}),le=P.getInputControl,M=x.useMemo(()=>({get current(){return le()}}),[le]),U=x.useRef(null),Z=x.useRef(null);function ae(te){let Ce;return j&&(typeof j=="function"?Ce=j(te):j.current=te),U.current=te,Ce}const ce=Ie(te=>{if(!te||te.disabled)return;Z.current||(Z.current=te);const Ce=U.current,re=te.checked||Ce==null||Ce.disabled?ae(te):void 0;return()=>{Z.current===te&&(Z.current=null),U.current===te?re?(re(),U.current=null):ae(null):re?.()}}),J=Ie(()=>{const te=z.current;if(!te)return $??null;for(const Ce of P.registeredInputs.keys())if(Ce.checked&&s4(Ce,te))return $??null;return null});Yc(M,q,$??null,J,!K,w),aa($,()=>{B(X),O($!==L.initialValue),_($!=null),P.change($);const te=Z.current;$==null&&te&&!te.disabled&&ae(te)});const ie=H??Q?.legendId,ge={...I,disabled:K??!1,required:p??!1,readOnly:f??!1},ee=x.useMemo(()=>({checkedValue:$,disabled:K,form:v,validation:P,name:X,readOnly:f,registerInputRef:ce,required:p,setCheckedValue:W,setTouched:G,touched:F}),[$,K,v,P,X,f,ce,p,W,G,F]),fe={id:S,role:"radiogroup","aria-required":p||void 0,"aria-disabled":K||void 0,"aria-readonly":f||void 0,"aria-labelledby":ie,onFocus(){D(!0)},onBlur(te){Qe(te.currentTarget,te.relatedTarget)||(T(!0),D(!1),C==="onBlur"&&P.commit($))},onKeyDownCapture(te){te.key.startsWith("Arrow")&&(G(!0),D(!0))}};return s.jsx(NE.Provider,{value:ee,children:s.jsx($V,{render:o,className:c,style:N,state:ge,props:[fe,k,te=>P.getValidationProps(K??!1,te)],refs:[a],stateAttributesMapping:wi,enableHomeAndEndKeys:!1,modifierKeys:qV})})});function Eh({className:e,...t}){return s.jsx(AE,{"data-slot":"radio-group",className:Ue("flex flex-col gap-2",e),...t})}function bo({className:e,...t}){return s.jsx(CE,{"data-slot":"radio-group-item",className:Ue("relative inline-flex size-3.5 flex-none cursor-pointer items-center justify-center rounded-full border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(PV,{"data-slot":"radio-group-indicator",className:"grid place-content-center data-unchecked:hidden",children:s.jsx("span",{className:"block size-[5px] rounded-full bg-primary-foreground"})})})}function RE(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const OE=x.createContext(void 0),ME=x.createContext(void 0),DE=x.createContext(void 0);function vo(){const e=x.useContext(OE);if(e===void 0)throw new Error(on(60));return e}function Jy(){const e=x.useContext(ME);if(e===void 0)throw new Error(on(101));return e}function IE(){const e=x.useContext(DE);if(e===void 0)throw new Error(on(61));return e}function GV(e,t,a=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let c=0;cObject.is(e,t);function la(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function PE(e,t,a){return Array.isArray(e)&&Array.isArray(t)?!GV(e,t,(o,c)=>la(o,c,a)):e!==t}function Rh(e,t,a){return e?e.some(o=>o===void 0?!1:la(t,o,a)):!1}function su(e,t,a){return e?e.findIndex(o=>o===void 0?!1:la(o,t,a)):-1}function KV(e,t){if(t!==Ah)return o=>Rh(e,o,t);const a=new Set(e);return a.delete(void 0),o=>a.has(o)&&(o!==0||e.some(c=>Object.is(o,c)))}function df(e,t,a,o){const c=o&&Array.isArray(t)?e.findIndex(KV(t,a)):su(e,t,a);return c===-1?null:c}function _E(e,t,a,o,c,d){return Rh(o,t,c)?d!=null&&e>d&&Rh(o,a[d],c)?d:e:e===d?df(a,o,c,!0):d}function LE(e,t,a){return e.filter(o=>!la(t,o,a))}function YV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function ew(e){return YV(e?.[0])}function Oh(e){return ew(e)?e.flatMap(t=>t.items):e}function zE(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(ew(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function yo(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Th(e)}function ka(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Th(e.value):Th(e)}function BE(e,t,a){function o(){return yo(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const d=Oh(t);if(e==null||typeof e!="object"){const f=d.find(p=>p.value===e);return f&&f.label!=null?f.label:o()}if("value"in e){const f=d.find(p=>p&&p.value===e.value);if(f&&f.label!=null)return f.label}}return o()}function XV(e,t,a){return e.reduce((o,c,d)=>(d>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:BE(c,t,a)},d)),o),[])}const QV={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:ka(t,o)!==""},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(c=>la(t,c,a)):la(t,o,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Cl=1;function HE(e,t){return Math.max(0,e-t)}function ZV(e,t){if(t<=0)return 0;const a=Ri(e,0,t),o=a,c=t-a,d=o<=Cl,f=c<=Cl;return d&&f?o<=c?0:t:d?0:f?t:a}function WV(e){const{id:t,value:a,defaultValue:o=null,onValueChange:c,open:d,defaultOpen:f=!1,onOpenChange:p,name:h,form:b,autoComplete:y,disabled:v=!1,readOnly:w=!1,required:j=!1,modal:S=!0,actionsRef:N,inputRef:k,onOpenChangeComplete:T,items:D,multiple:C=!1,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I=Ah,highlightItemOnHover:P=!0,children:O}=e,{clearErrors:_}=Fc(),{setDirty:L,setTouched:H,setFocused:B,validityData:z,setFilled:Q,name:K,disabled:X,validation:q,validationMode:$}=Sa(),Y=lo({id:t}),F=X||v,G=K??h,[W,le]=Ga({controlled:a,default:C?o??Or:o,name:"Select",state:"value"}),[M,U]=Ga({controlled:d,default:f,name:"Select",state:"open"}),Z=x.useRef([]),ae=x.useRef([]),ce=x.useRef(null),J=x.useRef(null),ie=x.useRef(0),ge=x.useRef(null),ee=x.useRef([]),fe=x.useRef(!1),te=x.useRef(null),Ce=x.useRef(null),re=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=x.useRef(!1),ke=x.useRef(W),{mounted:Ee,setMounted:ve,transitionStatus:he}=ki(M),{openMethod:ye,triggerProps:je}=vE(M),xe=Ds(()=>new tu({id:Y,labelId:void 0,modal:S,multiple:C,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,value:W,open:M,mounted:Ee,transitionStatus:he,items:D,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:fn,triggerProps:fn,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qt,setOpen:qt,handleScrollArrowVisibility:qt,onOpenChangeComplete:qt,listRef:Z,popupRef:ce,scrollHandlerRef:J,scrollArrowsMountedCountRef:ie,valueRef:ge,valuesRef:ee,labelsRef:ae,typingRef:fe,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:Ce,alignItemWithTriggerActiveRef:de,initialValueRef:ke},QV)).current,Te=xe.useState("activeIndex"),Oe=xe.useState("selectedIndex"),Ne=xe.useState("triggerElement"),_e=xe.useState("positionerElement"),Ye=XU(ye),kt=ye??Ye,Ct=x.useMemo(()=>C?"":ka(W,R),[C,W,R]),Rt=x.useMemo(()=>C&&Array.isArray(W)?W.map(xt=>ka(xt,R)):ka(W,R),[C,W,R]),ot=Xn(Ne),qn=Ie(()=>Rt);Yc(ot,Y,W,qn,!F,h);const fs=C?Array.isArray(W)&&W.length>0:W!=null&&Ct!=="";De(()=>{Q(fs)},[fs,Q]),De(function(){const wt=df(ee.current,W,I,C);wt===null&&(Ce.current=null),!M&&xe.set("selectedIndex",wt)},[C,M,W,I,xe]),aa(W,()=>{_(G),L(PE(W,z.initialValue,I)),q.change(W)});const Gn=Ie((xt,wt)=>{p?.(xt,wt),!wt.isCanceled&&(U(xt),!xt&&(wt.reason===ho||wt.reason===nh)&&(H(!0),B(!1),$==="onBlur"&&q.commit(W)))}),bs=Ie(()=>{ve(!1),xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),T?.(!1)});ra({enabled:!N,open:M,ref:ce,onComplete(){M||bs()}}),x.useImperativeHandle(N,()=>({unmount:bs}),[bs]);const it=Ie((xt,wt)=>{c?.(xt,wt),!wt.isCanceled&&le(xt)}),Vt=Ie(xt=>{const wt=HE(xt.scrollHeight,xt.clientHeight),jt=ZV(xt.scrollTop,wt),Nr=jt>0,rr=jtEE(Z.current[xt]),onMatch(xt){M?xe.set("activeIndex",xt):it(ee.current[xt],Fe(Yn))},onTyping(xt){fe.current=xt}}),Zn=x.useMemo(()=>Wr(Ft.reference,Ot.reference,nt.reference,tn.reference,je),[tn.reference,Ft.reference,Ot.reference,nt.reference,je]),Un=x.useMemo(()=>Wr(lf,Ft.floating,Ot.floating,nt.floating),[Ft.floating,Ot.floating,nt.floating]),Vn=Ot.item??fn;xe.useContextCallback("setValue",it),xe.useContextCallback("setOpen",Gn),xe.useContextCallback("handleScrollArrowVisibility",Vt),xe.useContextCallback("onOpenChangeComplete",T),RE(()=>{xe.update({popupProps:Un,triggerProps:Zn})}),xe.useSyncedValues({id:Y,modal:S,multiple:C,value:W,open:M,mounted:Ee,transitionStatus:he,popupProps:Un,triggerProps:Zn,items:D,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,openMethod:kt});const Rn=x.useMemo(()=>({disabled:F,readOnly:w,required:j,multiple:C,highlightItemOnHover:P,itemProps:Vn}),[F,w,j,C,P,Vn]),Jt=ea(k,q.inputRef),ls=C?void 0:G,Tt=x.useMemo(()=>!C||!Array.isArray(W)||!G?null:W.map(xt=>{const wt=ka(xt,R);return s.jsx("input",{type:"hidden",form:b,name:G,value:wt,disabled:F},wt)}),[C,W,b,G,R,F]);return s.jsxs(OE.Provider,{value:xe,children:[s.jsx(ME.Provider,{value:Rn,children:s.jsx(DE.Provider,{value:Hn,children:O})}),s.jsx("input",{...q.getValidationProps(F,{onFocus(){xe.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented||F||w)return;const wt=xt.currentTarget.value,jt=Fe(Yn,xt.nativeEvent);function Nr(){if(C)return;const rr=wt.toLowerCase();let Hr=ee.current.findIndex(rl=>ka(rl,R).toLowerCase()===rr||yo(rl,A).toLowerCase()===rr);Hr===-1&&(Hr=ee.current.findIndex((rl,rn)=>{const ic=ae.current[rn];return ic!=null&&ic.toLowerCase()===rr}));const wn=ee.current[Hr];wn!=null&&it(wn,jt)}xe.set("forceMount",!0),queueMicrotask(Nr)}}),id:Y&&ls==null?`${Y}-hidden-input`:void 0,form:b,name:ls,autoComplete:y,value:Ct,disabled:F,required:j&&!(C&&fs),readOnly:w,ref:Jt,style:G?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Tt]})}function UE(e,t){return e??t}const Mh=5;function VE(e,t){const a=JV(t);return e.clientX>=a.left-Mh&&e.clientX<=a.right+Mh&&e.clientY>=a.top-Mh&&e.clientY<=a.bottom+Mh}function JV(e){const t=e.getBoundingClientRect(),a=Sn(e);if(Hv)return t;const o=a.getComputedStyle(e,"::before"),c=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const f=parseFloat(o.width)||0,p=parseFloat(o.height)||0,h=parseFloat(c.width)||0,b=parseFloat(c.height)||0,y=Math.max(t.width,f,h),v=Math.max(t.height,p,b),w=y-t.width,j=v-t.height;return{left:t.left-w/2,right:t.right+w/2,top:t.top-j/2,bottom:t.bottom+j/2}}const e6="data-popup-side",t6=400,n6={...$v,...wi,popupSide:e=>e?{[e6]:e}:null,value:()=>null},s6=x.forwardRef(function(t,a){const{render:o,className:c,id:d,disabled:f=!1,nativeButton:p=!0,style:h,...b}=t,{setTouched:y,setFocused:v,validationMode:w,validation:j,state:S,disabled:N}=Sa(),{labelId:k}=vl(),T=vo(),{readOnly:D,required:C,disabled:A}=Jy(),R=N||A||f,I=T.useState("open"),P=T.useState("mounted"),O=T.useState("value"),_=T.useState("triggerProps"),L=T.useState("positionerElement"),H=T.useState("listElement"),B=T.useState("popupSide"),z=T.useState("id"),Q=T.useState("labelId"),K=T.useState("hasSelectedValue"),X=P&&L?B:null,q=d??z,$=UE(k,Q);lo({id:d});const Y=Xn(L),F=x.useRef(null),{getButtonProps:G,buttonRef:W}=Jr({disabled:R,native:p}),le=T.useStateSetter("triggerElement"),M=Zs(),U=Zs(),Z=Zs();x.useEffect(()=>{if(I)return Z.start(t6,()=>{T.context.selectionRef.current.allowUnselectedMouseUp=!0,T.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Z.clear()};T.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[I,T,U,Z]);const ae=Wr(_,{id:q,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-controls":I?H?.id??qm(L)?.id:void 0,"aria-labelledby":$,"aria-readonly":D||void 0,"aria-required":C||void 0,tabIndex:R?-1:0,onFocus(ie){v(!0),I&&T.context.alignItemWithTriggerActiveRef.current&&T.context.setOpen(!1,Fe(Yn,ie.nativeEvent)),M.start(0,()=>{T.set("forceMount",!0)})},onBlur(ie){Qe(L,ie.relatedTarget)||(y(!0),v(!1),w==="onBlur"&&j.commit(O))},onMouseDown(ie){if(I)return;const ge=$t(ie.currentTarget);function ee(fe){if(!F.current)return;const te=fe.target;Qe(F.current,te)||Qe(Y.current,te)||VE(fe,F.current)||T.context.setOpen(!1,Fe(T1,fe))}U.start(0,()=>{ge.addEventListener("mouseup",ee,{once:!0})})}},b,G),ce=j.getValidationProps(R,ae);ce.role="combobox";const J={...S,open:I,disabled:R,value:O,readOnly:D,popupSide:X,placeholder:!K};return yt("button",t,{ref:[a,F,W,le],state:J,stateAttributesMapping:n6,props:ce})}),r6={value:()=>null},a6=x.forwardRef(function(t,a){const{className:o,render:c,children:d,placeholder:f,style:p,...h}=t,b=vo(),y=b.useState("value"),v=b.useState("items"),w=b.useState("itemToStringLabel"),j=b.useState("hasSelectedValue"),S=!j&&f!=null&&d==null,N=b.useState("hasNullItemLabel",S),k={value:y,placeholder:!j};let T=null;return typeof d=="function"?T=d(y):d!=null?T=d:S&&!N?T=f:Array.isArray(y)?T=XV(y,v,w):T=BE(y,v,w),yt("span",t,{state:k,ref:[a,b.context.valueRef],props:[{children:T},h],stateAttributesMapping:r6})}),l6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,b={open:vo().useState("open")};return yt("span",t,{state:b,ref:a,props:[{"aria-hidden":!0,children:"▼"},f],stateAttributesMapping:Fv})}),o6=x.forwardRef(function(t,a){const o=vo(),c=o.useState("mounted"),d=o.useState("forceMount");return c||d?s.jsx(lh,{ref:a,...t}):null}),FE=x.createContext(void 0);function i6(){const e=x.useContext(FE);if(!e)throw new Error(on(59));return e}function Dh(e,t){e&&Object.assign(e.style,t)}const c6={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},u6=20;function tw(e,t,a,o){const[c,d]=x.useState(!1);De(()=>{if(!e||!t||a==null){d(!1);return}const f=$t(a).documentElement.clientWidth,p=a.offsetWidth;d(f>0&&p>0&&p>=f-u6)},[e,t,a]),hE(e&&(!t||c),o)}const d6={position:"fixed"},f6=x.forwardRef(function(t,a){const{anchor:o,className:c,render:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N,alignItemWithTrigger:k=!0,collisionAvoidance:T=X1,style:D,...C}=t,A=vo(),R=IE(),I=A.useState("open"),P=A.useState("mounted"),O=A.useState("modal"),_=A.useState("value"),L=A.useState("openMethod"),H=A.useState("positionerElement"),B=A.useState("triggerElement"),z=A.useState("isItemEqualToValue"),Q=A.useState("transitionStatus"),K=x.useRef(null),X=x.useRef(null),[q,$]=x.useState(k),Y=P&&q&&L!=="touch";!P&&q!==k&&$(k),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>Y),tw((Y||O)&&I,L==="touch",H,B);const F=yh({anchor:o,floatingRootContext:R,positionMethod:f,mounted:P,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N??Y,collisionAvoidance:T,keepMounted:!0}),G=Y?"none":F.side,W=Y?d6:F.positionerStyles,le={open:I,side:G,align:F.align,anchorHidden:F.anchorHidden};De(()=>{A.set("popupSide",F.side)},[A,F.side]);const M=A.useStateSetter("positionerElement"),U=wh(t,le,{styles:W,transitionStatus:Q,props:C,refs:[a,M],hidden:!P,inert:!I}),Z=x.useRef(0),ae=Ie(J=>{if(A.context.valuesRef.current.length===0)return;const ie=Z.current;Z.current=J.size;const ge=Fe(Yn);if(ie!==0&&!A.state.multiple&&_!==null&&su(A.context.valuesRef.current,_,z)===-1){const fe=A.context.initialValueRef.current,Ce=fe!=null&&su(A.context.valuesRef.current,fe,z)!==-1?fe:null;A.context.setValue(Ce,ge),Ce===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ie!==0&&A.state.multiple&&Array.isArray(_)){const ee=_.filter(fe=>su(A.context.valuesRef.current,fe,z)!==-1);ee.length!==_.length&&(A.context.setValue(ee,ge),ee.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(I&&Y){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ee={height:""};Dh(H,ee),Dh(A.context.popupRef.current,ee)}}),ce=x.useMemo(()=>({...F,side:G,alignItemWithTriggerActive:Y,setControlledAlignItemWithTrigger:$,scrollUpArrowRef:K,scrollDownArrowRef:X}),[F,G,Y,$]);return s.jsx(Wy,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:ae,children:s.jsxs(FE.Provider,{value:ce,children:[P&&O&&s.jsx(kh,{inert:jh(!I),cutout:B}),U]})})}),Ih="base-ui-disable-scrollbar",$E={className:Ih,getElement(e){return s.jsx("style",{nonce:e,href:Ih,precedence:"base-ui:low",children:`.${Ih}{scrollbar-width:none}.${Ih}::-webkit-scrollbar{display:none}`})}},p6=x.createContext(void 0);function qE(e){return x.useContext(p6)}const m6=x.createContext(void 0),h6={disableStyleElements:!1};function g6(){return x.useContext(m6)??h6}const GE="--transform-origin",x6={...$c,...oo},b6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,...p}=t,h=vo(),{multiple:b,readOnly:y,highlightItemOnHover:v}=Jy(),w=IE(),{side:j,align:S,alignItemWithTriggerActive:N,isPositioned:k,setControlledAlignItemWithTrigger:T}=i6(),D=qE()!=null,C=cf(),{nonce:A,disableStyleElements:R}=g6(),I=h.useState("id"),P=h.useState("open"),O=h.useState("openMethod"),_=h.useState("mounted"),L=h.useState("popupProps"),H=h.useState("transitionStatus"),B=h.useState("triggerElement"),z=h.useState("positionerElement"),Q=h.useState("listElement"),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef({}),$=Kc(),Y=Ie(le=>{if(!z||!h.context.popupRef.current||!X.current)return;const M=z.style.top==="0px",U=z.style.bottom==="0px";if(K.current||!N||!M&&!U){h.context.handleScrollArrowVisibility(le);return}const Z=YE(z),ae=ff(z.getBoundingClientRect().height,"y",Z),ce=$t(z),J=Sn(z),ie=J.getComputedStyle(z),ge=parseFloat(ie.marginTop),ee=parseFloat(ie.marginBottom),fe=KE(J.getComputedStyle(h.context.popupRef.current)),te=Math.min(ce.documentElement.clientHeight-ge-ee,fe),Ce=le.scrollTop,re=Ph(le);let de=null;const ke=ye=>{z.style.height=`${ye}px`},Ee=M?re-Ce:Ce,ve=Math.min(ae+Ee,te);if(Ee<=Cl){const ye=Ri(Ee,0,te-ae);ye>0&&ke(ae+ye),le.scrollTop=M?re:0,te-(ae+ye)<=Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le);return}if(te-ve>Cl)de=M?1/0:0;else if(U&&CeCl&&(le.scrollTop=ye)}he>=te-Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le)});x.useImperativeHandle(h.context.scrollHandlerRef,()=>Y,[Y]),ra({open:P,ref:h.context.popupRef,onComplete(){P&&h.context.onOpenChangeComplete(!0)}});const F={open:P,transitionStatus:H,side:j,align:S};De(()=>{!z||!h.context.popupRef.current||Object.keys(q.current).length||(q.current={top:z.style.top||"0",left:z.style.left||"0",right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[h,z]),De(()=>{P||N||(X.current=!1,K.current=!1,Dh(z,q.current))},[P,N,z]),De(()=>{const le=h.context.popupRef.current;if(!P||!B||!z||!le||N&&!k||h.state.transitionStatus==="ending")return;if(X.current=!0,le.style.removeProperty(GE),!N){$.request(()=>h.context.handleScrollArrowVisibility(Q||le));return}const M=v6(le);try{let U=h.context.selectedItemTextRef.current;U?.isConnected||(U=!h.select("hasSelectedValue")&&h.context.firstItemTextRef.current?.isConnected?h.context.firstItemTextRef.current:null);const Z=h.context.valueRef.current,ae=Sn(z),ce=ae.getComputedStyle(z),J=ae.getComputedStyle(le),ie=$t(B),ge=YE(B),ee=_h(B.getBoundingClientRect(),ge),fe=_h(z.getBoundingClientRect(),ge),te=ee.height,Ce=Q||le,re=Ce.scrollHeight,de=parseFloat(J.borderBottomWidth),ke=parseFloat(ce.marginTop)||10,Ee=parseFloat(ce.marginBottom)||10,ve=parseFloat(ce.minHeight)||100,he=KE(J),ye=5,je=5,xe=20,Te=ie.documentElement.clientHeight-ke-Ee,Oe=ie.documentElement.clientWidth,Ne=Te-ee.bottom+te;let _e,Ye=C==="rtl"?ee.right-fe.width:ee.left,kt=0;if(U&&Z){const tn=_h(Z.getBoundingClientRect(),ge);_e=_h(U.getBoundingClientRect(),ge),Ye=fe.left+(C==="rtl"?tn.right-_e.right:tn.left-_e.left);const nt=tn.top-ee.top+tn.height/2;kt=_e.top-fe.top+_e.height/2-nt}const Ct=Ne+kt+Ee+de;let Rt=Math.min(Te,Ct);const ot=Te-ke-Ee,qn=Ct-Rt,fs=Oe-je;z.style.left=`${Ri(Ye,ye,fs-fe.width)}px`,z.style.height=`${Rt}px`,z.style.maxHeight="none",z.style.marginTop=`${ke}px`,z.style.marginBottom=`${Ee}px`,le.style.height="100%";const Gn=Ph(Ce),bs=qn>=Gn-Cl;bs&&(Rt=Math.min(Te,fe.height)-(qn-Gn));const it=ee.topTe-xe||Math.ceil(Rt)+Cl=ot?"0":`${tn}px`,z.style.height=`${Rt}px`,Ce.scrollTop=Ph(Ce)}else z.style.bottom="0",Ce.scrollTop=qn;if(_e){const tn=fe.top,nt=fe.height,Ot=_e.top+_e.height/2,Ft=Ri(nt>0?(Ot-tn)/nt*100:50,0,100);le.style.setProperty(GE,`50% ${Ft}%`)}(Hn===Te||Rt>=he)&&(K.current=!0),h.context.handleScrollArrowVisibility(Ce),v&&h.state.selectedIndex===null&&h.state.activeIndex===null&&h.context.listRef.current[0]!=null&&h.set("activeIndex",0)}finally{M()}},[h,P,z,B,N,T,$,Q,v,C,k]),x.useEffect(()=>{if(!N||!z||!P)return;const le=Sn(z);function M(U){h.context.setOpen(!1,Fe(u4,U))}return St(le,"resize",M)},[h,N,z,P]);const G={...Q?{role:"presentation"}:{role:"listbox","aria-multiselectable":b||void 0,"aria-readonly":y||void 0,id:`${I}-list`},onKeyDown(le){D&&Sh.has(le.key)&&le.stopPropagation()},onScroll(le){Q||Y(le.currentTarget)},...N&&{style:Q?{height:"100%"}:c6},className:!Q&&N?$E.className:void 0},W=yt("div",t,{ref:[a,h.context.popupRef],state:F,stateAttributesMapping:x6,props:[L,G,uf(H),p]});return s.jsxs(x.Fragment,{children:[!R&&$E.getElement(A),s.jsx(oh,{context:w,modal:!1,disabled:!_,openInteractionType:O,returnFocus:f,restoreFocus:!0,children:W})]})});function KE(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Ph(e){return HE(e.scrollHeight,e.clientHeight)}function YE(e){return gT.getScale(e)}function ff(e,t,a){return e/a[t]}function _h(e,t){return Xd({x:ff(e.x,"x",t),y:ff(e.y,"y",t),width:ff(e.width,"x",t),height:ff(e.height,"y",t)})}const XE=[["transform","none"],["scale","1"],["translate","0 0"]];function v6(e){const{style:t}=e,a={};for(const[o,c]of XE)a[o]=t.getPropertyValue(o),t.setProperty(o,c,"important");return()=>{for(const[o]of XE){const c=a[o];c?t.setProperty(o,c):t.removeProperty(o)}}}const QE=x.createContext(void 0);function nw(){const e=x.useContext(QE);if(!e)throw new Error(on(57));return e}const y6=x.memo(x.forwardRef(function(t,a){const{render:o,className:c,style:d,value:f=null,label:p,disabled:h=!1,nativeButton:b=!1,...y}=t,v=x.useRef(null),w=Zy({guess:!0,label:p,textRef:v}),j=vo(),{itemProps:S,multiple:N,disabled:k,readOnly:T}=Jy(),D=k||h,C=j.useState("isActive",w.index),A=j.useState("open"),R=j.useState("isSelected",f),I=j.useState("isSelectedByFocus",w.index),P=j.useState("isItemEqualToValue"),O=w.index,_=x.useRef(null);De(()=>{const F=j.context.valuesRef.current;return F[O]=f,()=>{delete F[O]}},[O,f,j]),De(()=>{const F=j.state.value,G=j.state.selectedIndex;let W=G,le;N&&Array.isArray(F)?(W=_E(O,f,j.context.valuesRef.current,F,P,G),le=W===O,O===G&&!le&&(j.context.selectedItemTextRef.current=null)):(le=F!==void 0&&la(f,F,P),le&&(W=O)),j.set("selectedIndex",W),le&&v.current&&(j.context.selectedItemTextRef.current=v.current)},[O,N,P,j,f]);const L=x.useRef("mouse"),H=x.useRef(!1),{getButtonProps:B,buttonRef:z}=Jr({disabled:D,focusableWhenDisabled:!0,native:b,composite:!0}),Q={disabled:D,selected:R,highlighted:C};function K(F){if(k||T)return;const G=j.state.value;if(N){const W=Array.isArray(G)?G:[],le=R?LE(W,f,P):[...W,f];j.context.setValue(le,Fe(Wd,F))}else j.context.setValue(f,Fe(Wd,F)),j.context.setOpen(!1,Fe(Wd,F))}function X(){j.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":R,tabIndex:A&&C?0:-1,onKeyDown(F){j.set("activeIndex",O),F.key===" "&&j.context.typingRef.current&&F.preventDefault()},onClick(F){const G=L.current!=="touch",W=F.nativeEvent.pointerType,le=G&&Gm(F.nativeEvent)&&(W!==void 0||C),M=G&&!le&&!H.current;H.current=!1,!(D||M)&&K(F.nativeEvent)},onPointerEnter(F){L.current=F.pointerType},onPointerMove(F){if(F.pointerType==="mouse"&&F.buttons===1){const G=j.context.selectionRef.current;G.dragY+=F.movementY,G.dragY**2>=64&&(G.allowUnselectedMouseUp=!0)}},onPointerDown(F){L.current=F.pointerType,H.current=!0,X()},onMouseUp(){if(X(),D||L.current==="touch"||H.current)return;const F=!j.context.selectionRef.current.allowSelectedMouseUp&&R,G=!j.context.selectionRef.current.allowUnselectedMouseUp&&!R;F||G||(H.current=!0,_.current?.click(),H.current=!1)}},$=yt("div",t,{ref:[z,a,w.ref,_],state:Q,props:[S,q,y,B]}),Y=x.useMemo(()=>({selected:R,index:O,textRef:v,selectedByFocus:I}),[R,O,v,I]);return s.jsx(QE.Provider,{value:Y,children:$})})),w6=x.forwardRef(function(t,a){const{selected:o}=nw();return t.keepMounted||o?s.jsx(j6,{...t,ref:a}):null}),j6=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=nw(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),S6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:c,selectedByFocus:d}=nw(),f=vo(),{render:p,className:h,style:b,...y}=t,v=x.useCallback(j=>{j&&(o===0&&(f.context.firstItemTextRef.current=j),d&&(f.context.selectedItemTextRef.current=j))},[f,o,d]);return yt("div",t,{ref:[v,a,c],props:y})})),ft=WV,pt=a6;function mt({className:e,children:t,...a}){return s.jsxs(s6,{"data-slot":"select-trigger",className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","[&>span]:min-w-0 [&>span]:truncate","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",e),...a,children:[t,s.jsx(l6,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function ht({className:e,sideOffset:t=4,children:a,...o}){return s.jsx(o6,{children:s.jsx(f6,{sideOffset:t,alignItemWithTrigger:!1,className:"z-[35]",children:s.jsx(b6,{"data-slot":"select-content",className:Ue("max-h-[260px] min-w-[var(--anchor-width)] overflow-y-auto overscroll-contain rounded-lg border border-border-strong bg-raised p-[5px] shadow-3","outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0",e),...o,children:a})})})}function qe({className:e,children:t,...a}){return s.jsxs(y6,{"data-slot":"select-item",className:Ue("flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-[9px] text-[12.5px] leading-[1.4] text-foreground select-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:font-normal data-disabled:text-muted-foreground",e),...a,children:[s.jsx(S6,{className:"min-w-0 flex-1 truncate",children:t}),s.jsx(w6,{className:"flex flex-none text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function In({options:e,value:t,onValueChange:a,disabled:o=!1,className:c,...d}){const f=x.useRef(null),p=x.useRef(new Map),[h,b]=x.useState({left:0,width:0,ready:!1}),[y,v]=x.useState(!1),w=x.useCallback(()=>{const j=f.current,S=p.current.get(t);if(!j||!S){b(C=>C.ready?{...C,ready:!1}:C);return}const N=j.getBoundingClientRect(),k=S.getBoundingClientRect(),T=k.left-N.left-j.clientLeft,D=k.width;b(C=>C.ready&&C.left===T&&C.width===D?C:{left:T,width:D,ready:!0})},[t]);return x.useLayoutEffect(()=>{w();const j=f.current;if(!j||typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>w());S.observe(j);for(const N of p.current.values())S.observe(N);return()=>S.disconnect()},[w,e]),x.useEffect(()=>{if(!h.ready||y)return;const j=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(j)},[h.ready,y]),s.jsxs(AE,{ref:f,"data-slot":"segmented-control",className:Ue("relative inline-flex gap-0.5 rounded-md border border-control-border bg-control p-0.5",c),value:t,disabled:o,onValueChange:j=>a(j),...d,children:[s.jsx("span",{"aria-hidden":"true","data-slot":"segmented-thumb","data-ready":h.ready?"true":"false","data-animate":y?"true":"false",className:Ue("pointer-events-none absolute top-0.5 bottom-0.5 left-0 rounded-sm bg-primary-soft","data-[ready=false]:opacity-0","data-[animate=true]:transition-[transform,width] data-[animate=true]:duration-200 data-[animate=true]:ease-in-out"),style:{transform:`translateX(${h.left}px)`,width:h.width}}),e.map(j=>s.jsxs(CE,{value:j.value,"data-slot":"segmented-item",disabled:j.disabled,"data-zero":j.count===0?"true":void 0,className:Ue("group/seg relative z-[1] inline-flex h-6 items-center gap-[5px] rounded-sm border-0 bg-transparent px-2.5","text-xs font-medium whitespace-nowrap text-subtle select-none","transition-[background-color,color] duration-150 ease-out","hover:bg-nav-hover hover:text-foreground","data-checked:bg-transparent data-checked:text-primary-fg data-checked:hover:bg-transparent","data-disabled:cursor-not-allowed data-disabled:opacity-40","data-[zero=true]:data-unchecked:opacity-45"),ref:S=>{S?p.current.set(j.value,S):p.current.delete(j.value)},children:[j.label,j.count!==void 0&&s.jsx("span",{className:Ue("min-w-4 rounded-pill bg-surface-3 px-[5px] text-center text-[10.5px] font-semibold tabular-nums text-muted-foreground","group-data-checked/seg:bg-primary-tint group-data-checked/seg:text-primary-fg"),children:j.count})]},j.value))]})}const N6=x.createContext(void 0);function k6(){return x.useContext(N6)}const C6=x.forwardRef(function(t,a){const{className:o,defaultPressed:c=!1,disabled:d=!1,form:f,onPressedChange:p,pressed:h,render:b,type:y,value:v,nativeButton:w=!0,style:j,...S}=t,N=Na(v||void 0),k=k6(),T=k?.value??[],D=(d||k?.disabled)??!1,[C,A]=Ga({controlled:k?N!==void 0&&T.indexOf(N)>-1:h,default:c,name:"Toggle",state:"pressed"}),{getButtonProps:R,buttonRef:I}=Jr({disabled:D,native:w}),P={disabled:D,pressed:C},O=[I,a],_=[{"aria-pressed":C,onClick(B){const z=!C,Q=Fe(Yn,B.nativeEvent);p?.(z,Q),!Q.isCanceled&&(N&&k?.setGroupValue?.(N,z,Q),!Q.isCanceled&&A(z))}},S,R],L=yt("button",t,{enabled:!k,state:P,ref:O,props:_}),H=x.useMemo(()=>({disabled:D,focusableWhenDisabled:!1}),[D]);return k?s.jsx(SE,{tag:"button",render:b,className:o,style:j,metadata:H,state:P,refs:O,props:_}):L}),T6=Vc(["inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color] duration-150 ease-out","outline-none select-none disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0","data-pressed:border-primary-bd data-pressed:bg-primary-soft data-pressed:font-semibold data-pressed:text-primary-fg","data-pressed:hover:bg-primary-tint"],{variants:{variant:{default:"border-transparent bg-transparent text-subtle hover:bg-nav-hover hover:text-foreground",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]"}},defaultVariants:{variant:"default",size:"default"}});function E6({className:e,variant:t,size:a,...o}){return s.jsx(C6,{"data-slot":"toggle",className:Ue(T6({variant:t,size:a}),e),...o})}function A6(e,t,a,o,c,d,f,p,h,b=2){const y=KB(a.current,{event:e,orientation:o,loopFocus:c,rtl:d,cols:b,disabledIndices:f,minIndex:p,maxIndex:h,prevIndex:t>h?p:t,stopEvent:!0});return fo(a.current,y)?void 0:y}const ZE=x.createContext(void 0),WE=x.createContext(void 0),JE=x.createContext(void 0),eA=x.createContext(!1),tA=x.createContext("");function Ca(){const e=x.useContext(ZE);if(!e)throw new Error(on(22));return e}function Lh(){const e=x.useContext(WE);if(!e)throw new Error(on(23));return e}function pf(){const e=x.useContext(JE);if(!e)throw new Error(on(24));return e}function nA(){return x.useContext(tA)}function R6(){return x.useContext(eA)}const O6={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{const{selectedValue:t,selectionMode:a}=e;return t==null?!1:a==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.selectedValue;return Array.isArray(o)?o.some(c=>la(t,c,a)):la(t,o,a)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function sA(e){return e==null?void 0:`${e}-popup`}function M6(e,t){return(a,o)=>a==null?!1:e.contains(a,o,t)}const rA=new Map;function D6(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},a=`${dy(e.locale)}|${JSON.stringify(t)}`,o=rA.get(a);if(o)return o;const c=new Intl.Collator(e.locale,t),d={contains(f,p,h){if(!p)return!0;const b=yo(f,h);for(let y=0;y<=b.length-p.length;y+=1)if(c.compare(b.slice(y,y+p.length),p)===0)return!0;return!1},startsWith(f,p,h){if(!p)return!0;const b=yo(f,h);return c.compare(b.slice(0,p.length),p)===0},endsWith(f,p,h){if(!p)return!0;const b=yo(f,h),y=p.length;return b.length>=y&&c.compare(b.slice(b.length-y),p)===0}};return rA.set(a,d),d}const I6=D6;function P6(e,t=!1){const{overflowY:a}=xr(e);return a!=="auto"&&a!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const aA=Symbol("none"),sw={value:aA,index:-1};function _6(e,t,a){const o=e.get(t);if(o!==void 0||a===Ah)return o;for(const[c,d]of e)if(la(c,t,a))return d}function L6(e){const{id:t,onOpenChangeComplete:a,defaultSelectedValue:o=null,selectedValue:c,onSelectedValueChange:d,defaultInputValue:f,inputValue:p,open:h,defaultOpen:b=!1,selectionMode:y,onItemHighlighted:v,name:w,form:j,disabled:S=!1,readOnly:N=!1,required:k=!1,inputRef:T,grid:D=!1,items:C,filteredItems:A,filter:R,filterQuery:I,openOnInputClick:P=!0,autoHighlight:O=!1,keepHighlight:_=!1,highlightItemOnHover:L=!0,loopFocus:H=!0,itemToStringLabel:B,itemToStringValue:z,isItemEqualToValue:Q=Ah,virtualized:K=!1,inline:X=!1,fillInputOnItemPress:q=!0,modal:$=!1,limit:Y=-1,autoComplete:F="list",formAutoComplete:G,locale:W,submitOnItemClick:le=!1}=e,{clearErrors:M}=Fc(),{setDirty:U,validityData:Z,setFilled:ae,name:ce,disabled:J,setTouched:ie,setFocused:ge,validationMode:ee,validation:fe}=Sa(),te=cf(),Ce=lo({id:t}),re=I6({locale:W}),de=Array.isArray(C)?null:C;if(de&&typeof de.label!="function")throw new Error(on(100));const ke=de?de.data:C,Ee=de?.value,ve=Ee?void 0:ke,he=x.useMemo(()=>{if(!A||!Ee)return;const Me=Oh(A),Be=Me.map(Ee);let lt;return{values:Be,findItem(Yt,On){if(!lt){lt=new Map;for(let mn=0;mnde?Me=>de.label(Me,Q,Be=>{const lt=he?.findItem(Be,Q);return lt!=null?de.itemLabel(lt):yo(Be,B)}):B,[de,B,he,Q]),je=x.useMemo(()=>de?Object.assign(Me=>de.itemLabel(Me),{selected:Me=>yo(Me,ye)}):B,[de,ye,B]);function xe(Me){return yo(Me,ye)}const[Te,Oe]=x.useState(!1),[Ne,_e]=x.useState(null),Ye=x.useRef(Ne),kt=x.useRef([]),Ct=x.useRef([]),Rt=x.useRef(null),ot=x.useRef(null),qn=x.useRef(null),fs=x.useRef(null),Gn=x.useRef(null),bs=x.useRef(!0),it=x.useRef(!1),Vt=x.useRef(null),Hn=x.useRef(null),tn=x.useRef(null),nt=x.useRef(sw),Ot=x.useRef(null),Ft=x.useRef([]),Zn=x.useRef(null),Un=J||S,Vn=ce??w,Rn=y==="multiple",Jt=y==="single",ls=p!==void 0||f!==void 0,Tt=ke!==void 0,xt=A!==void 0;let wt;O==="always"?wt="always":wt=O?"input-change":!1;const[jt,Nr]=Ga({controlled:c,default:Rn?o??Or:o,name:"Combobox",state:"selectedValue"}),rr=x.useMemo(()=>R===null?()=>!0:R!==void 0?R:M6(re,je),[R,re,je]),Hr=Ds(()=>ls?f??"":Jt?xe(jt):"").current,[wn,rl]=Ga({controlled:p,default:Hr,name:"Combobox",state:"inputValue"}),[rn,ic]=Ga({controlled:h,default:b,name:"Combobox",state:"open"}),Jx=ew(ke),dr=!rn&&Ne!==null?Ne:String(wn).trim(),Ia=Jt?xe(jt):"",Ho=Jt&&!Te&&dr!==""&&Ia.length===dr.length&&re.contains(Ia,dr),Uo=Ho?"":I??dr,_p=Tt&&xt&&Ho&&(!de||de.hasValue(jt,Q)),cc=x.useMemo(()=>ke?Oh(ke):Or,[ke]),Vo=x.useMemo(()=>{if(A&&!_p)return A;if(!ke)return Or;if(Jx){const Be=ke,lt=[];let Yt=0;for(const On of Be){if(Y>-1&&Yt>=Y)break;const mn=Y>-1?Y-Yt:1/0,Mn=Uo===""?On.items.slice(0,mn):[];if(Uo!=="")for(const ps of On.items){if(Mn.length>=mn)break;rr(ps,Uo,je)&&Mn.push(ps)}if(Mn.length>0){const ps={...On,items:Mn};lt.push(ps),Yt+=Mn.length}}return lt}if(Uo==="")return Y>-1?cc.slice(0,Y):cc;const Me=[];for(const Be of cc){if(Y>-1&&Me.length>=Y)break;rr(Be,Uo,je)&&Me.push(Be)}return Me},[A,_p,ke,Jx,Uo,Y,rr,je,cc]),As=x.useMemo(()=>{if(he&&Vo===A)return he.values;const Me=Oh(Vo);return Ee?Me.map(Be=>Ee(Be)):Me},[Vo,A,he,Ee]),et=Ds(()=>{let Me=null;return X&&rn&&Tt&&y!=="none"&&(Me=df(As,jt,Q,Rn)),new tu({id:Ce,labelId:void 0,selectedValue:jt,open:rn,items:ve,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,isItemEqualToValue:Q,modal:$,autoHighlight:wt,submitOnItemClick:le,hasInputValue:ls,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:X,activeIndex:null,selectedIndex:Me,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:fn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:y==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:kt,labelsRef:Ct,popupRef:Rt,emptyRef:Gn,inputRef:ot,startDismissRef:qn,endDismissRef:fs,keyboardActiveRef:bs,chipsContainerRef:Vt,clearRef:Hn,valuesRef:Ft,pointerDownItemRef:Zn,selectionEventRef:tn},O6)}).current,_l=y==="none"?wn:jt,eb=x.useMemo(()=>y==="none"?_l:Array.isArray(jt)?jt.map(Me=>ka(Me,z)):ka(jt,z),[_l,z,y,jt]),Pa=Ie(v),Rs=Ie(a),qs=et.useState("activeIndex"),Fo=et.useState("selectedIndex"),uc=et.useState("positionerElement"),tb=et.useState("listElement"),dc=et.useState("triggerElement"),fc=et.useState("inputElement"),pc=et.useState("inputGroupElement"),Os=et.useState("inline"),ar=et.useState("inputInsidePopup"),Ll=et.useState("inputOwnsFormValue"),zl=Jt&&!ar&&wn===Ia,mc=Xn(dc),{mounted:$o,setMounted:vs,transitionStatus:Lp}=ki(rn),{openMethod:nb,triggerProps:zp}=vE(rn),Bl=Ie(()=>eb);Yc(ar?mc:ot,Ce,_l,Bl,!Un,w);const Hl=Ie(()=>{ke?Ct.current=As.map(xe):et.set("forceMounted",!0)}),qo=Ie((Me,Be,lt)=>{if(Be===-1){if(nt.current===sw)return;nt.current=sw}else nt.current={value:Me,index:Be};Pa(Me,d4(lt,void 0,{index:Be}))}),Ur=Ie(Me=>{const Be={};Me.activeIndex!==void 0&&(Be.activeIndex=Me.activeIndex),Me.selectedIndex!==void 0&&(Be.selectedIndex=Me.selectedIndex),et.update(Be);const lt=Me.activeIndex;if(lt===void 0)return;const Yt=Me.type||Yn;lt===null?qo(void 0,-1,Yt):qo(Ft.current[lt],lt,Yt)}),Vr=Ie((Me,Be)=>{if(e.onInputValueChange?.(Me,Be),!Be.isCanceled){if(it.current=Be.reason===Ka,Be.reason===Jd){rn&&Ne!==null&&_e(null);const lt=Be.event,Yt=lt.inputType;if(lt.type==="compositionend"||Yt!=null&&Yt!==""&&Yt!=="insertReplacementText"){const mn=Me.trim()!=="";mn&&Oe(!0),Ot.current={hasQuery:mn};const Mn=et.state.listElement;if(!et.state.virtualized&&Mn){const ps=Rt.current;for(const kr of Hc(Mn.firstElementChild??Mn)){if(!dn(kr)||(ps?!Qe(ps,kr):kr.getAttribute("role")==="dialog"))break;if(P6(kr)){kr.scrollTop=0;break}}}mn&&wt&&et.state.activeIndex==null&&(rn||Os)&&et.set("activeIndex",0)}}else Be.reason===Ka&&Me===""&&et.state.inputInsidePopup&&(Ot.current={hasQuery:!1,selection:!0});rl(Me)}}),sb=Ie(Me=>{const Be=!Me&&ar&&!Os&&wn!==""&&(String(wn).trim()===Ne||wn===Ia);!Me&&(Be||wn===""||zl)&&Oe(!1),_e(null),Be&&Vr("",Fe(Ka))}),Mt=Ie((Me,Be)=>{if(rn!==Me&&(Be.reason===Xc&&Tt&&As.length===0&&!Gn.current&&Be.allowPropagation(),e.onOpenChange?.(Me,Be),!Be.isCanceled&&(Me&&Ne!==null&&sb(Be.reason===Jd),!Me&&Te&&(Jt?(Os||_e(dr),dr===""&&Oe(!1)):Rn&&(Os||_e(dr),ar&&Ur({activeIndex:null}),(!ar||Os)&&Vr("",Fe(Ka,Be.event,void 0,{isItemPress:Be.reason===Wd})))),ic(Me),!Me&&ar&&(Be.reason===ho||Be.reason===nh)&&(ie(!0),ge(!1),ee==="onBlur")))){const lt=y==="none"?wn:jt;fe.commit(lt)}}),hc=Ie((Me,Be)=>{if(d?.(Me,Be),Be.isCanceled)return;Nr(Me),(y==="none"&&Rt.current&&q||Jt&&!et.state.inputInsidePopup)&&Vr(xe(Me),Fe(Be.reason,Be.event))}),ed=Ie((Me,Be)=>{const lt=cs(Me),Yt=tn.current??Me;tn.current=null;const On=Fe(Wd,Yt),mn=lt?.closest("a")?.getAttribute("href");if(mn){mn.startsWith("#")&&Mt(!1,On);return}if(Rn){const Mn=Array.isArray(jt)?jt:[],ps=Rh(Mn,Be,Q),kr=ps?LE(Mn,Be,Q):[...Mn,Be];if(hc(kr,On),On.isCanceled||!(ot.current?ot.current.value.trim()!=="":!1))return;if(et.state.inputInsidePopup){Vr("",Fe(Ka,On.event,void 0,{isItemPress:!0}));const $r=Ot.current;$r&&!ps&&($r.toggledValue=Be)}else Mt(!1,On)}else{if(hc(Be,On),On.isCanceled)return;Mt(!1,On)}}),td=Ie(()=>{const Me=fe.inputRef.current?.form??et.state.inputElement?.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),Fr=Ie(()=>{if(vs(!1),Rs?.(!1),Oe(!1),_e(null),Ur(y==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Rn&&ot.current&&ot.current.value!==""&&!it.current&&Vr("",Fe(Ka)),Jt)if(et.state.inputInsidePopup)ot.current&&ot.current.value!==""&&Vr("",Fe(Ka));else{const Me=xe(jt);ot.current&&ot.current.value!==Me&&Vr(Me,Fe(Me===""?Ka:Yn))}}),fr=x.useMemo(()=>Os&&uc?{current:uc.closest('[role="dialog"]')}:Rt,[Os,uc]);ra({enabled:!e.actionsRef,open:rn,ref:fr,onComplete(){rn||Fr()}}),x.useImperativeHandle(e.actionsRef,()=>({unmount:Fr}),[Fr]),De(function(){const Be=Ye.current!==null&&Ne===null;if(Ye.current=Ne,rn&&(!Be||!Tt)||(rn||(Zn.current=null),y==="none"))return;const lt=Tt?As:Ft.current;Ur({selectedIndex:df(lt,jt,Q,Rn)})},[rn,Ne,jt,y,Rn,Tt,As,Q,Ur]),De(()=>{ke&&(Ft.current=As,kt.current.length=As.length)},[ke,As]),De(()=>{const Me=Ot.current;if(Me){const ps=rn||Os||et.state.positionerElement?.hidden===!1;if(Me.hasQuery)wt&&ps&&et.set("activeIndex",0),Ot.current=null;else if(String(wn).trim()===""&&(Ot.current=null,ps)){const kr=Me.selection;wt==="always"&&!kr&&et.state.selectionMode==="none"&&et.set("activeIndex",0),queueMicrotask(()=>{if(!et.state.open&&!et.state.inline||ot.current&&ot.current.value.trim()!=="")return;const ma=et.state.selectedValue,$r=et.state.selectionMode==="multiple";if($r&&Array.isArray(ma)?ma.length>0:et.state.selectionMode!=="none"&&ma!=null){const _s=Tt||xt?As:Ft.current,La=su(_s,Me.toggledValue,et.state.isItemEqualToValue);et.set("activeIndex",La!==-1?La:df(_s,ma,et.state.isItemEqualToValue,$r))}else kr?et.set("activeIndex",null):wt==="always"&&et.set("activeIndex",0)})}}if(!rn&&!Os)return;const lt=Tt||xt?As:Ft.current,Yt=et.state.activeIndex;if(Yt==null){if(wt==="always"&<.length>0){et.set("activeIndex",0);return}qo(void 0,-1,Yn);return}if(Yt>=lt.length){qo(void 0,-1,Yn),et.set("activeIndex",null);return}const On=lt[Yt],mn=nt.current.value,Mn=mn!==aA&&la(On,mn,et.state.isItemEqualToValue);(nt.current.index!==Yt||!Mn)&&qo(On,Yt,Yn)},[qs,wt,qo,xt,Tt,As,Os,rn,et,wn]),De(()=>{if(y==="none"){ae(String(wn)!=="");return}ae(Rn?Array.isArray(jt)&&jt.length>0:jt!=null)},[ae,y,wn,jt,Rn]),x.useEffect(()=>{Tt&&wt&&As.length===0&&Ur({activeIndex:null})},[Tt,wt,As.length,Ur]);function rb(){rn&&dr!==""&&dr!==String(Hr)&&!zl&&Oe(!0)}function FS(){rn&&Ne!==null&&sb(!1)}let nd=!1;function Bp(){!nd&&wn!==Ia&&(nd=!0,Vr(Ia,Fe(Yn)))}function $S(){y!=="none"&&(M(Vn),U(PE(jt,Z.initialValue,Q)),fe.change(jt),Jt&&!ls&&!ar&&Bp())}function pr(){Jt&&!ls&&!ar&&!Te&&Bp()}function Hp(){y==="none"&&(M(Vn),U(wn!==Z.initialValue),fe.change(wn))}aa(dr,rb),aa(rn,FS),aa(jt,$S),aa(Ia,pr),aa(ke,pr),aa(wn,Hp);const gc=PT({open:Os?!0:rn,onOpenChange:Mt,elements:{reference:ar?dc:fc,floating:uc}}),sd=D?"grid":"listbox",_a=rn||Os,Up=_a?"true":"false",xc=x.useMemo(()=>{const Me=fc?.tagName==="INPUT",Be=fc==null||Me,lt=Be||_a,Yt=Be?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return lt&&(Yt.role="combobox",Yt["aria-expanded"]=Up,Yt["aria-haspopup"]=sd,Yt["aria-controls"]=_a?tb?.id:void 0,Yt["aria-autocomplete"]=N?"none":F),{reference:Yt,floating:{role:"presentation"}}},[fc,_a,Up,sd,tb?.id,F,N]),Ul=ih(gc,{enabled:!Un&&P,event:"mousedown-only",toggle:!1,touchOpenDelay:ar?0:100,reason:i4}),rd=af(gc,{enabled:!Un&&!Os,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Os?!0:void 0,outsidePress(Me){const Be=cs(Me);return!Qe(dc,Be)&&!Qe(Hn.current,Be)&&!Qe(Vt.current,Be)&&!Qe(pc,Be)}}),Vl=HT(gc,{enabled:!Un,id:Ce,listRef:kt,activeIndex:qs,selectedIndex:Fo,virtual:!0,loopFocus:H,allowEscape:H&&!wt,focusItemOnOpen:Te||y==="none"&&!wt?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!_,orientation:D?"horizontal":void 0,rtl:te==="rtl",disabledIndices:Or,grid:D?A6:void 0,onNavigate(Me,Be){!Be&&!rn||Lp==="ending"||Ur(Be?{activeIndex:Me,type:bs.current?k1:C1}:{activeIndex:Me})}}),Vp=x.useMemo(()=>Wr(Vl.reference,{onKeyDown(Me){D&&et.state.activeIndex==null&&(Me.key==="ArrowLeft"||Me.key==="ArrowRight")&&Me.preventBaseUIHandler()}},rd.reference,Ul.reference,xc.reference),[Vl.reference,rd.reference,Ul.reference,xc.reference,D,et]),ad=x.useMemo(()=>Wr(lf,rd.floating),[rd.floating]),ab=x.useMemo(()=>Wr(Vl.floating,xc.floating),[Vl.floating,xc.floating]),lb=x.useMemo(()=>{const Me=Vl.item;return Me?{...Me,onFocus:void 0}:fn},[Vl.item]);et.useContextCallback("setOpen",Mt),et.useContextCallback("setInputValue",Vr),et.useContextCallback("setSelectedValue",hc),et.useContextCallback("setIndices",Ur),et.useContextCallback("handleSelection",ed),et.useContextCallback("forceMount",Hl),et.useContextCallback("requestSubmit",td),et.useContextCallback("onOpenChangeComplete",a),RE(()=>{et.update({inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb})});const bc={id:Ce,selectedValue:jt,open:rn,mounted:$o,transitionStatus:Lp,items:ve,inline:X,popupProps:ad,listProps:ab,inputProps:Vp,triggerProps:zp,itemProps:lb,openMethod:nb,selectionMode:y,name:Vn,form:j,disabled:Un,readOnly:N,required:k,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,modal:$,autoHighlight:wt,isItemEqualToValue:Q,submitOnItemClick:le,hasInputValue:ls};De(()=>{et.update({...bc,inputOwnsFormValue:y==="none"&&(X||!et.state.inputInsidePopup)})},[et,...Object.values(bc)]);const pa=ea(T,fe.inputRef),Fp=x.useMemo(()=>({query:dr,hasItems:Tt,filteredItems:Vo,flatFilteredValues:As}),[dr,Tt,Vo,As]),$p=x.useMemo(()=>Array.isArray(_l)?"":ka(_l,z),[_l,z]),Go=Rn&&Array.isArray(jt)&&jt.length>0,al=Rn||y==="none"&&Ll?void 0:Vn,ob=x.useMemo(()=>!Rn||!Array.isArray(jt)||!Vn?null:jt.map(Me=>{const Be=ka(Me,z);return s.jsx("input",{type:"hidden",form:j,name:Vn,value:Be,disabled:Un},Be)}),[Rn,jt,j,Vn,z,Un]),qp=s.jsxs(x.Fragment,{children:[e.children,s.jsx("input",{...fe.getValidationProps(Un,{onFocus(){if(ar){dc?.focus();return}(ot.current||dc)?.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented||Un||N)return;const Be=Me.currentTarget.value,lt=Be.toLowerCase(),Yt=Fe(Yn,Me.nativeEvent),On=()=>Ft.current.findIndex(Mn=>ka(Mn,z).toLowerCase()===lt||xe(Mn).toLowerCase()===lt);function mn(){if(Rn)return;if(y==="none"){Vr(Be,Yt);return}let Mn=On();Mn===-1&&(Mn=Ft.current.findIndex((kr,ma)=>{const $r=Ct.current[ma];return $r!=null&&$r.toLowerCase()===lt}));const ps=Mn===-1?void 0:Ft.current[Mn];ps!=null&&hc?.(ps,Yt)}Jt&&(Hl(),ke&&On()===-1&&et.set("forceMounted",!0)),queueMicrotask(mn)}}),id:Ce&&al==null?`${Ce}-hidden-input`:void 0,form:j,name:al,autoComplete:G,disabled:Un,required:k&&!Go,readOnly:N,value:$p,ref:pa,style:al?Zc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ob]});return s.jsx(ZE.Provider,{value:et,children:s.jsx(WE.Provider,{value:gc,children:s.jsx(eA.Provider,{value:Tt,children:s.jsx(JE.Provider,{value:Fp,children:s.jsx(tA.Provider,{value:wn,children:qp})})})})})}function z6(e){const{multiple:t=!1,defaultValue:a,value:o,onValueChange:c,autoComplete:d,...f}=e;return s.jsx(L6,{...f,selectionMode:t?"multiple":"single",selectedValue:o,defaultSelectedValue:a,onSelectedValueChange:c,formAutoComplete:d})}const B6="data-popup-side",H6="data-list-empty",lA={...$v,...wi,popupSide:e=>e?{[B6]:e}:null,listEmpty:e=>e?{[H6]:""}:null},U6=x.createContext(void 0);function V6(){return x.useContext(U6)}const oA=x.createContext(void 0);function rw(e){const t=x.useContext(oA);if(t===void 0&&!e)throw new Error(on(21));return t}const iA=x.forwardRef(function(t,a){const o=Ca(),{buttonRef:c,getButtonProps:d}=Jr({native:!1}),f=ea(a,c);function p(b){o.context.setOpen(!1,Fe(oy,b.nativeEvent,b.currentTarget))}const h=d({onClick:p});return s.jsx("span",{ref:f,...h,"aria-label":"Dismiss",tabIndex:void 0,style:Zc})});function cA(e){const t=e.useState("mounted"),a=e.useState("popupSide"),o=e.useState("positionerElement");return t&&o?a:null}function zh(){return pf().filteredItems.length===0}function F6(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function $6(e,t){const a=e>=t-1?t-2:e;return a>=0?a:void 0}function uA(e,t,a){const o=e.context.listRef.current[t];o&&(e.context.selectionEventRef.current=a,o.click(),e.context.selectionEventRef.current=null)}const q6=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,id:f,style:p,...h}=t,{state:b,disabled:y,setTouched:v,setFocused:w,validationMode:j,validation:S}=Sa(),{labelId:N}=vl(),k=V6(),D=!!rw(!0),C=Ca(),A=nA(),R=cf(),I=C.useState("required"),P=C.useState("disabled"),O=C.useState("readOnly"),_=C.useState("name"),L=C.useState("form"),H=C.useState("selectionMode"),B=C.useState("autoHighlight"),z=C.useState("inputProps"),Q=C.useState("triggerProps"),K=C.useState("open"),X=C.useState("mounted"),q=C.useState("selectedValue"),$=C.useState("id"),Y=C.useState("inline"),F=C.useState("modal"),G=!!B,W=cA(C),le=y||P||d,M=zh(),U=D||Y,Z=!U||F,ae=Na(f??(U?void 0:$)),ce=D?KC:b,[J,ie]=x.useState(null),ge=x.useRef(!1),ee=x.useRef(null),fe=x.useRef(!1),te=H==="none"&&!D,Ce=Ie(je=>{const xe=D||C.state.inline;xe&&!C.state.hasInputValue&&C.context.setInputValue("",Fe(Yn)),C.update({inputElement:je,inputInsidePopup:xe,inputOwnsFormValue:te})}),re=D?h:S.getValidationProps(le,h);function de(){C.context.setIndices({activeIndex:null,selectedIndex:null,type:C.context.keyboardActiveRef.current?k1:C1})}function ke(){C.context.keyboardActiveRef.current=!1}const Ee={...ce,open:K,disabled:le,readOnly:O,popupSide:W,listEmpty:M};function ve(je){if(!k)return;let xe;const{highlightedChipIndex:Te}=k,Oe=k.chipsRef.current.length,[Ne,_e]=F6(R);return Te!==void 0?(je.key===Ne?(je.preventDefault(),Te>0?xe=Te-1:xe=void 0):je.key===_e?(je.preventDefault(),Te0&&(je.preventDefault(),xe=Oe>0?Oe-1:void 0),xe)}const he=yt("input",t,{state:Ee,ref:[a,C.context.inputRef,Ce],props:[z,Q,{value:J??A,"aria-readonly":O||void 0,"aria-required":I||void 0,"aria-labelledby":N,disabled:le,readOnly:O,required:H==="none"?I:void 0,form:L,...te&&_&&{name:_},id:ae,onFocus(){if(w(!0),!Y||!fe.current)return;fe.current=!1;const je=ee.current;je==null||!Object.hasOwn(C.context.valuesRef.current,je)||C.context.setIndices({activeIndex:je})},onBlur(){v(!0),w(!1);const je=C.state.activeIndex;if(Y&&je!==null&&B!=="always"&&(ee.current=je,fe.current=!0,C.context.setIndices({activeIndex:null})),j==="onBlur"){const xe=H==="none"?A:q;S.commit(xe)}},onCompositionStart(je){Um||(ge.current=!0,ie(je.currentTarget.value))},onCompositionEnd(je){ge.current=!1;const xe=je.currentTarget.value;ie(null),C.context.setInputValue(xe,Fe(Jd,je.nativeEvent))},onChange(je){const xe=je.nativeEvent,Te=xe.inputType,Oe=!Te||Te==="insertReplacementText",Ne=ge.current||!Oe;function _e(Rt){O||le||!Rt||!Ne||(C.context.setOpen(!0,Fe(Jd,xe)),G||de())}if(ge.current){const Rt=je.currentTarget.value;ie(Rt),Rt===""&&!C.state.openOnInputClick&&!C.state.inputInsidePopup&&C.context.setOpen(!1,Fe(Ka,xe));const ot=Rt.trim(),qn=G&&ot!=="";_e(ot),K&&C.state.activeIndex!==null&&!qn&&de();return}const Ye=Fe(Jd,xe);if(C.context.setInputValue(je.currentTarget.value,Ye),Ye.isCanceled)return;const kt=je.currentTarget.value==="",Ct=Fe(Ka,xe);kt&&!C.state.inputInsidePopup&&(H==="single"&&C.context.setSelectedValue(null,Ct),C.state.openOnInputClick||C.context.setOpen(!1,Ct)),_e(je.currentTarget.value.trim()),K&&C.state.activeIndex!==null&&!G&&de()},onKeyDown(je){if(je.ctrlKey||je.shiftKey||je.altKey||je.metaKey)return;if(C.context.keyboardActiveRef.current=!0,le||O){O&&je.key==="Enter"&&K&&C.state.activeIndex!==null&&ks(je);return}const xe=je.currentTarget,Te=xe.scrollWidth-xe.clientWidth,Oe=R==="rtl";if(je.key==="Home"){ks(je);const Ye=e1&&Oe?xe.value.length:0;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=0;return}if(je.key==="End"){ks(je);const Ye=e1&&Oe?0:xe.value.length;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=Oe?-Te:Te;return}if(!X&&je.key==="Escape"){const Ye=H==="multiple"&&Array.isArray(q)?q.length===0:q===null,kt=Fe(Xc,je.nativeEvent),Ct=H==="multiple"?[]:null;C.context.setInputValue("",kt),C.context.setSelectedValue(Ct,kt),!Ye&&!C.state.inline&&!kt.isPropagationAllowed&&je.stopPropagation();return}if(k&&je.key==="Backspace"&&xe.value===""&&k.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ye=k.chipsRef.current.length,kt=Ye>0?Ye-1:q.length-1,Ct=q.filter((Rt,ot)=>ot!==kt);de(),C.context.setSelectedValue(Ct,Fe(Yn,je.nativeEvent));return}const Ne=k?.highlightedChipIndex!==void 0,_e=ve(je);if(k?.setHighlightedChipIndex(_e),_e!==void 0?k?.chipsRef.current[_e]?.focus():Ne&&C.context.inputRef.current?.focus(),je.which!==229&&je.key==="Enter"&&K){const Ye=C.state.activeIndex,kt=je.nativeEvent;if(Ye===null){if(Y)return;C.context.setOpen(!1,Fe(Yn,kt));return}ks(je),uA(C,Ye,kt)}},onPointerMove:ke,onPointerDown:ke},re],stateAttributesMapping:lA}),ye=D?s.jsx(XC.Provider,{value:YC,children:he}):he;return s.jsxs(x.Fragment,{children:[K&&Z&&s.jsx(iA,{ref:C.context.startDismissRef}),ye]})}),G6=x.forwardRef(function(t,a){const{render:o,className:c,nativeButton:d=!0,disabled:f=!1,id:p,style:h,...b}=t,{state:y,disabled:v,setTouched:w,setFocused:j,validationMode:S,validation:N}=Sa(),{labelId:k}=vl(),T=Ca(),D=T.useState("selectionMode"),C=T.useState("disabled"),A=T.useState("readOnly"),R=T.useState("required"),I=T.useState("positionerElement"),P=T.useState("listElement"),O=T.useState("popupId"),_=T.useState("triggerProps"),L=T.useState("inputInsidePopup"),H=T.useState("id"),B=T.useState("labelId"),z=T.useState("open"),Q=T.useState("selectedValue"),K=T.useState("activeIndex"),X=T.useState("selectedIndex"),q=T.useState("hasSelectedValue"),$=Lh(),Y=nA(),F=Zs(),G=v||C||f,W=zh(),le=cA(T);lo({id:L?p:void 0});const M=L?p??H:p,U=UE(k,B);let Z;z&&L?Z=O??sA(H):z&&(Z=P?.id);const ae=x.useRef("");function ce(re){ae.current=re.pointerType}const{reference:J}=UT($,{enabled:!z&&!A&&!C&&D==="single",listRef:T.context.labelsRef,activeIndex:K,selectedIndex:X,onMatch(re){const de=T.context.valuesRef.current[re];de!==void 0&&T.context.setSelectedValue(de,Fe(Yn))}}),{reference:ie}=ih($,{enabled:!C,event:"mousedown"}),{buttonRef:ge,getButtonProps:ee}=Jr({native:d,disabled:G}),fe={...y,readOnly:A,open:z,disabled:G,popupSide:le,listEmpty:W,placeholder:D==="none"?!1:!q},te=Ie(re=>{T.set("triggerElement",re)});return yt("button",t,{ref:[a,ge,te],state:fe,props:[_,ie,J,{id:M,tabIndex:L?0:-1,role:L?"combobox":void 0,"aria-expanded":z,"aria-haspopup":L?"dialog":"listbox","aria-controls":Z,"aria-required":L&&R||void 0,"aria-readonly":L&&A||void 0,"aria-labelledby":U,onPointerDown:ce,onPointerEnter:ce,onFocus(){j(!0),!G&&F.start(0,T.context.forceMount)},onBlur(re){if(!Qe(I,re.relatedTarget)&&(w(!0),j(!1),S==="onBlur")){const de=D==="none"?Y:Q;N.commit(de)}},onMouseDown(re){if(G||(L||$.set("domReferenceElement",re.currentTarget),T.context.forceMount(),ae.current!=="touch"&&(T.context.inputRef.current?.focus(),L||re.preventDefault()),z))return;const de=$t(re.currentTarget);function ke(Ee){const ve=T.state.triggerElement;if(!ve)return;const he=cs(Ee),ye=T.state.positionerElement,je=T.state.listElement;Qe(ve,he)||Qe(ye,he)||Qe(je,he)||VE(Ee,ve)||T.context.setOpen(!1,Fe(T1,Ee))}L&&de.addEventListener("mouseup",ke,{once:!0})},onKeyDown(re){(re.key==="ArrowDown"||re.key==="ArrowUp")&&(ks(re),T.context.setOpen(!0,Fe(iy,re.nativeEvent)),T.context.inputRef.current?.focus())}},N.getValidationProps(G,b),ee],stateAttributesMapping:lA})}),K6=x.createContext(null);function Y6(){return x.useContext(K6)}function X6(e){const{children:t}=e,{filteredItems:a}=pf(),o=Y6(),c=o?o.items:a;return s.jsx(x.Fragment,{children:c.map(t)})}const Q6=x.forwardRef(function(t,a){var o;const{render:c,className:d,style:f,children:p,...h}=t,b=Ca(),y=Lh(),v=!!rw(!0),{filteredItems:w,hasItems:j}=pf(),S=b.useState("selectionMode"),N=b.useState("grid"),k=b.useState("readOnly"),T=b.useState("listProps"),D=b.useState("virtualized"),C=b.useState("forceMounted"),A=S==="multiple",R=w.length===0,I=Ie(z=>{b.set("positionerElement",z)}),P=Ie(z=>{b.set("listElement",z)}),O=x.useMemo(()=>typeof p=="function"?o||(o=s.jsx(X6,{children:p})):p,[p]),_={empty:R},L=y.useState("floatingId"),H=yt("div",t,{state:_,ref:[a,P,v?null:I],props:[T,{children:O,tabIndex:-1,id:L,role:N?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!N&&k?!0:void 0,onKeyDown(z){if(!(b.state.disabled||b.state.readOnly)&&z.key==="Enter"){const Q=b.state.activeIndex;if(Q==null)return;ks(z),uA(b,Q,z.nativeEvent)}},onKeyDownCapture(){b.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){b.context.keyboardActiveRef.current=!1}},h]});if(D)return H;const B=j&&!C?void 0:b.context.labelsRef;return s.jsx(Wy,{elementsRef:b.context.listRef,labelsRef:B,children:H})}),Z6="⁠",W6=200;function J6(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let a=null;for(;t.nextNode();){const o=t.currentNode;o.nodeValue!==""&&(a=o)}return a}function eF(){const e=Zs(),t=x.useRef(null);return x.useEffect(()=>{if(Yd)return;const a=t.current;if(a==null)return;const o=J6(a);if(o==null)return;const c=o.data,d=`${c}${Z6}`;return o.nodeValue=d,e.start(W6,()=>{o.nodeValue===d&&(o.nodeValue=c)}),()=>{e.clear(),o.nodeValue===d&&(o.nodeValue=c)}},[t,e]),t}const dA=x.createContext(void 0);function tF(){const e=x.useContext(dA);if(e===void 0)throw new Error(on(20));return e}const nF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=Ca(),f=d.useState("mounted"),p=d.useState("forceMounted");return f||o||p?s.jsx(dA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),sF=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f,side:p,align:h,sideOffset:b,alignOffset:y,collisionBoundary:v="clipping-ancestors",collisionPadding:w,arrowPadding:j,sticky:S,disableAnchorTracking:N=!1,collisionAvoidance:k=X1,style:T,...D}=t,C=Ca(),A=Lh(),R=tF(),I=C.useState("modal"),P=C.useState("open"),O=C.useState("mounted"),_=C.useState("openMethod"),L=C.useState("positionerElement"),H=C.useState("triggerElement"),B=C.useState("inputElement"),z=C.useState("inputGroupElement"),Q=C.useState("inputInsidePopup"),K=C.useState("transitionStatus"),X=zh(),$=yh({anchor:d??(Q?H:z??B),floatingRootContext:A,positionMethod:f,mounted:O,side:p,sideOffset:b,align:h,alignOffset:y,arrowPadding:j,collisionBoundary:v,collisionPadding:w,sticky:S,disableAnchorTracking:N,keepMounted:R,collisionAvoidance:k,lazyFlip:!0});tw(P&&I,_==="touch",L,H);const Y={open:P,side:$.side,align:$.align,anchorHidden:$.anchorHidden,empty:X};De(()=>{C.set("popupSide",$.side)},[C,$.side]);const F=Ie(W=>{C.set("positionerElement",W)}),G=wh(t,Y,{styles:$.positionerStyles,transitionStatus:K,props:D,refs:[a,F],hidden:!O,inert:!P});return s.jsxs(oA.Provider,{value:$,children:[O&&I&&s.jsx(kh,{inert:jh(!P),cutout:z??B??H}),G]})}),rF={...$c,...oo},aF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=Ca(),y=rw(),v=Lh(),w=b.useState("mounted"),j=b.useState("open"),S=b.useState("openMethod"),N=b.useState("popupProps"),k=b.useState("transitionStatus"),T=b.useState("inputInsidePopup"),D=b.useState("inputElement"),C=b.useState("modal"),A=b.useState("id"),R=zh(),I=h.id??(T?sA(A):void 0);De(()=>(b.set("popupId",b.context.popupRef.current?.id||I),()=>{b.set("popupId",void 0)}),[b,I]),ra({open:j,ref:b.context.popupRef,onComplete(){j&&b.context.onOpenChangeComplete(!0)}});const P={open:j,side:y.side,align:y.align,anchorHidden:y.anchorHidden,transitionStatus:k,empty:R},O=yt("div",t,{state:P,ref:[a,b.context.popupRef],props:[N,{id:I,role:T?"dialog":"presentation",onFocus(z){const Q=cs(z.nativeEvent);S!=="touch"&&(Qe(b.state.listElement,Q)||Q===z.currentTarget)&&b.context.inputRef.current?.focus()}},uf(k),h],stateAttributesMapping:rF}),L=f===void 0?T?z=>z==="touch"?b.context.popupRef.current:D:!1:f;let H;p!=null?H=p:H=T?void 0:!1;const B=!T||C;return s.jsx(oh,{context:v,disabled:!w,modal:B,openInteractionType:S,initialFocus:L,returnFocus:H,getInsideElements:()=>[b.context.startDismissRef.current,b.context.endDismissRef.current],children:s.jsxs(x.Fragment,{children:[O,B&&s.jsx(iA,{ref:b.context.endDismissRef})]})})}),lF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t;return yt("span",t,{ref:a,props:[{"aria-hidden":!0,children:"▼"},f]})}),fA=x.createContext(void 0);function pA(){const e=x.useContext(fA);if(!e)throw new Error(on(19));return e}const oF=x.createContext(!1);function iF(){return x.useContext(oF)}function mA(e){const{componentProps:t,forwardedRef:a,virtualized:o,indexFromFilter:c}=e,{render:d,className:f,style:p,value:h=null,index:b,disabled:y=!1,nativeButton:v=!1,...w}=t,j=x.useRef(null),S=Zy({guess:!0,index:b,textRef:j}),N=Ca(),k=iF(),T=R6(),D=N.useState("selectionMode"),C=N.useState("disabled"),A=N.useState("readOnly"),R=N.useState("isItemEqualToValue"),I=C||y,P=D!=="none",O=b??c??S.index,_=O!==-1,L=N.useState("id"),H=N.useState("isActive",O),B=N.useState("isSelected",h),z=N.useState("itemProps"),Q=x.useRef(null),K=L!=null&&_?`${L}-${O}`:void 0,X=B&&P;De(()=>{if(!(_&&(o||b!=null)))return;const U=N.context.listRef.current;return U[O]=Q.current,()=>{delete U[O]}},[_,o,O,b,N]),De(()=>{if(!_||T)return;const M=N.context.valuesRef.current;return M[O]=h,()=>{delete M[O]}},[_,T,O,h,N]),De(()=>{if(!_||T)return;const M=N.state.selectedValue;let U=N.state.selectedIndex;N.state.selectionMode==="multiple"&&Array.isArray(M)?U=_E(O,h,N.context.valuesRef.current,M,R,U):la(h,M,R)&&(U=O),N.set("selectedIndex",U)},[_,T,N,O,h,R]);const{getButtonProps:q,buttonRef:$}=Jr({disabled:I,focusableWhenDisabled:!0,native:v,composite:!0}),Y={disabled:I,selected:X,highlighted:H};function F(M){function U(){N.context.handleSelection(M,h)}N.state.submitOnItemClick?(Cs.flushSync(U),N.context.requestSubmit()):U()}const G={id:K,role:k?"gridcell":"option","aria-selected":P?X:void 0,tabIndex:void 0,onPointerDownCapture(M){M.isPrimary&&(N.context.pointerDownItemRef.current=M.currentTarget),M.preventDefault()},onMouseDown(M){M.preventDefault()},onClick(M){I||A||F(M.nativeEvent)},onMouseUp(M){const U=N.context.pointerDownItemRef.current===M.currentTarget;N.context.pointerDownItemRef.current=null,!(I||A||M.button!==0||U||!H)&&F(M.nativeEvent)}},W=yt("div",t,{ref:[$,a,S.ref,Q],state:Y,props:[z,G,w,q]}),le=x.useMemo(()=>({selected:X,textRef:j}),[X,j]);return s.jsx(fA.Provider,{value:le,children:W})}function cF(e){const{componentProps:t,forwardedRef:a}=e,c=Ca().useState("isItemEqualToValue"),{flatFilteredValues:d}=pf(),f=t.value??null,p=su(d,f,c);return s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:!0,indexFromFilter:p})}const uF=x.memo(x.forwardRef(function(t,a){const c=Ca().useState("virtualized");return c&&t.index==null?s.jsx(cF,{componentProps:t,forwardedRef:a}):s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:c,indexFromFilter:void 0})})),dF=x.forwardRef(function(t,a){const{selected:o}=pA();return t.keepMounted||o?s.jsx(fF,{...t,ref:a}):null}),fF=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=pA(),h=x.useRef(null),{transitionStatus:b,setMounted:y}=ki(p),w=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:oo});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),w})),pF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,...p}=t,{filteredItems:h}=pf(),b=Ca(),y=eF(),v=h.length===0?f:null;return yt("div",t,{ref:[a,b.context.emptyRef,y],props:[{children:v,role:"status","aria-live":"polite","aria-atomic":!0},p]})}),mF="、";function Bh({value:e,onValueChange:t,options:a,placeholder:o="",emptyHint:c=go("没有匹配的选项"),searchPlaceholder:d=go("搜索…"),disabled:f=!1,className:p,id:h,title:b,...y}){const v=x.useMemo(()=>a.filter(j=>e.includes(j.value)),[a,e]),w=v.length?v.map(j=>j.label).join(mF):o;return s.jsxs(z6,{items:a,multiple:!0,value:v,onValueChange:j=>t(j.map(S=>S.value)),isItemEqualToValue:(j,S)=>j?.value===S?.value,disabled:f,children:[s.jsxs(G6,{"data-slot":"multi-select-trigger",id:h,title:b,"aria-label":y["aria-label"],className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",p),children:[s.jsx("span",{"data-slot":"multi-select-value",className:"min-w-0 flex-1 truncate text-left data-[placeholder]:text-muted-foreground","data-placeholder":v.length?void 0:"",title:w,children:w}),s.jsx(lF,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),s.jsx(nF,{children:s.jsx(sF,{sideOffset:4,className:"z-[35]",children:s.jsxs(aF,{"data-slot":"multi-select-content",className:Ue("flex max-h-[280px] w-[max(var(--anchor-width),220px)] flex-col overflow-hidden","rounded-lg border border-border-strong bg-raised shadow-3 outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0"),children:[s.jsxs("div",{className:"flex flex-none items-center gap-1.5 border-b border-hairline px-2.5 py-1.5",children:[s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-3 flex-none text-muted-foreground","aria-hidden":"true",children:[s.jsx("circle",{cx:"5",cy:"5",r:"3.4",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),s.jsx("path",{d:"M7.6 7.6 10.5 10.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),s.jsx(q6,{placeholder:d,className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-[12.5px] text-foreground outline-none placeholder:text-muted-foreground"})]}),s.jsx(pF,{children:s.jsx("div",{className:"px-2.5 py-3 text-[11.5px] leading-[1.5] text-muted-foreground",children:c})}),s.jsx(Q6,{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-[5px]",children:j=>s.jsxs(uF,{value:j,className:Ue("grid cursor-pointer grid-cols-[14px_minmax(0,1fr)] items-center gap-2 rounded-sm px-[9px] py-[5px]","text-[12.5px] leading-[1.4] text-foreground select-none outline-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:text-muted-foreground"),children:[s.jsx(dF,{className:"col-start-1 flex text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("span",{className:"col-start-2 min-w-0 truncate",children:j.label})]},j.value)})]})})})]})}const hA=x.createContext(void 0);function mf(e){const t=x.useContext(hA);if(t===void 0&&!e)throw new Error(on(47));return t}const hF={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class gF extends tu{constructor(a,o,c){const d=new fh;super(xF(a,d,o,c),bF(d),hF);ln(this,"setOpen",(a,o)=>{const c=o.reason===Vs,d=o.reason===mo&&o.event.detail===0,f=!a&&(o.reason===Xc||o.reason==null),p=AT(o),h=this.select("activeTriggerId");if(!a&&o.reason===oy&&o.trigger==null&&h!=null&&(o.trigger=this.context.triggerElements.getById(h)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(a,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,o);const b=()=>{const v=Ry(this.state,a,o.trigger,p());v.openChangeReason=o.reason,this.update(v)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(eH,()=>{this.set("stickIfOpen",!1)}),Cs.flushSync(b)):b();let y;d?y="click":f?y="dismiss":o.reason===ho&&(y="focus"),this.set("instantType",y)})}}function xF(e,t,a,o=!1){const c={...Iy(t,a,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return c.open&&e?.mounted===void 0&&(c.mounted=!0),c}function bF(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new sa,triggerElements:e}}const gA=sh(function({props:t}){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,modal:p=!1,handle:h,triggerId:b,defaultTriggerId:y=null}=t,v=yF(h,{modal:p,open:c,openProp:o,activeTriggerId:y,triggerIdProp:b});v.useControlledProp("openProp",o),v.useControlledProp("triggerIdProp",b);const w=v.useState("open"),j=v.useState("mounted"),S=v.useState("payload");v.useContextCallback("onOpenChange",d),v.useContextCallback("onOpenChangeComplete",f),OT(v,w),Oy(v);const{forceUnmount:N}=My(w,v,()=>{v.update({stickIfOpen:!0,openChangeReason:null})});v.useSyncedValues({modal:p}),x.useEffect(()=>{w||v.context.stickIfOpenTimeout.clear()},[v,w]),x.useImperativeHandle(t.actionsRef,()=>({unmount:N,close:()=>v.setOpen(!1,Fe(cy))}),[N,v]);const k=w||j;return s.jsxs(hA.Provider,{value:v,children:[h&&s.jsx(Ay,{handle:h,store:v}),k&&s.jsx(wF,{store:v,modal:p}),typeof a=="function"?a({payload:S}):a]})});function vF(e){return mf(!0)?s.jsx(gA,{props:e}):s.jsx(oH,{children:s.jsx(gA,{props:e})})}function yF(e,t){const a=Ey((o,c)=>new gF(t,o,c));return x.useEffect(()=>a.context.stickIfOpenTimeout.disposeEffect(),[a]),a}function wF({store:e,modal:t}){const a=e.useState("floatingRootContext"),o=af(a,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),c=o.reference,d=o.floating;return Dy(e,{activeTriggerProps:c,inactiveTriggerProps:c,popupProps:d}),null}const jF=300;function SF(e,t){const a=x.useRef(null);function o(d){Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))}),t4(a.current)?.focus()}function c(d){const f=e.select("positionerElement");if(f&&Gc(d,f))e.context.beforeContentFocusGuardRef.current?.focus();else{Cs.flushSync(()=>{e.setOpen(!1,Fe(ho,d.nativeEvent,d.currentTarget))});let p=e4(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(f,p);){const h=p;if(p=ry(p),p===h)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}const NF=L1(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,handle:h,payload:b,openOnHover:y=!1,delay:v=jF,closeDelay:w=0,id:j,...S}=t,N=mf(!0),T=IT(h)??N;if(!T)throw new Error(on(74));const D=Na(j),C=T.useState("isTriggerActive",D),A=T.useState("floatingRootContext"),R=T.useState("isOpenedByTrigger",D),I=T.useState("triggerPopupId",D),P=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:_}=RT(D,P,T,{payload:b,disabled:f,openOnHover:y,closeDelay:w}),L=T.useState("openChangeReason"),H=T.useState("stickIfOpen"),B=T.useState("openMethod"),z=T.useState("focusManagerModal"),Q=zT(A,{enabled:!f&&y&&(B!=="touch"||L!==mo),mouseOnly:!0,move:!1,handleClose:FT(),restMs:v,delay:{close:w},triggerElementRef:P,isActiveTrigger:C,isClosing:()=>T.select("transitionStatus")==="ending"}),K=ih(A,{stickIfOpen:H}),X=bE(()=>T.select("open"),ae=>{T.set("openMethod",ae)}),q=T.useState("triggerProps",_),{getButtonProps:$,buttonRef:Y}=Jr({disabled:f,native:p}),F={open(ae){return ae&&L===mo?$v.open(ae):Fv.open(ae)}},{preFocusGuardRef:G,handlePreFocusGuardFocus:W,handleFocusTargetFocus:le}=SF(T,P),U=yt("button",t,{state:{disabled:f,open:R},ref:[Y,a,O,P],props:[K.reference,Q,q,X,{[Y1]:"",id:D,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":I},S,$],stateAttributesMapping:F}),Z=s.jsx(x.Fragment,{children:U},D);return _&&!z?s.jsxs(x.Fragment,{children:[s.jsx(Wc,{ref:G,onFocus:W}),Z,s.jsx(Wc,{ref:T.context.triggerFocusTargetRef,onFocus:le})]}):Z}),xA=x.createContext(void 0);function kF(){const e=x.useContext(xA);if(e===void 0)throw new Error(on(45));return e}const CF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return mf().useState("mounted")||o?s.jsx(xA.Provider,{value:o,children:s.jsx(lh,{ref:a,...c})}):null}),bA=x.createContext(void 0);function TF(){const e=x.useContext(bA);if(!e)throw new Error(on(46));return e}const EF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,anchor:f,positionMethod:p,side:h,align:b,sideOffset:y,alignOffset:v,collisionBoundary:w="clipping-ancestors",collisionPadding:j,arrowPadding:S,sticky:N,disableAnchorTracking:k=!1,collisionAvoidance:T=Q1,...D}=t,C=mf(),A=kF(),R=aH(),I=C.useState("floatingRootContext"),P=C.useState("mounted"),O=C.useState("open"),_=C.useState("openChangeReason"),L=C.useState("activeTriggerElement"),H=C.useState("modal"),B=C.useState("openMethod"),z=C.useState("positionerElement"),Q=C.useState("instantType"),K=C.useState("transitionStatus"),X=C.useState("adaptiveOrigin"),q=x.useRef(null),$=N1(z),Y=yh({anchor:f,floatingRootContext:I,positionMethod:p,mounted:P,side:h,sideOffset:y,align:b,alignOffset:v,arrowPadding:S,collisionBoundary:w,collisionPadding:j,sticky:N,disableAnchorTracking:k,keepMounted:A,nodeId:R,collisionAvoidance:T,adaptiveOrigin:X}),F=I.useState("domReferenceElement");De(()=>{const U=F,Z=q.current;if(U&&(q.current=U),Z&&U&&U!==Z){C.set("instantType",void 0);const ae=new AbortController;return $(()=>{C.set("instantType","trigger-change")},ae.signal),()=>{ae.abort()}}},[F,$,C]);const G=H===!0&&_!==Vs;tw(O&&G,B==="touch",z,L);const W=C.useStateSetter("positionerElement"),le={open:O,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,instant:Q},M=wh(t,le,{styles:Y.positionerStyles,transitionStatus:K,props:D,refs:[a,W],hidden:!P,inert:!O});return s.jsxs(bA.Provider,{value:Y,children:[P&&G&&s.jsx(kh,{inert:jh(!O),cutout:L}),s.jsx(lH,{id:R,children:M})]})}),AF=x.createContext(void 0);function RF(){const[e,t]=x.useState(0),a=Ie(()=>(t(c=>c+1),()=>{t(c=>Math.max(0,c-1))}));return{context:x.useMemo(()=>({register:a}),[a]),hasClosePart:e>0}}const OF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,b=mf(),y=TF(),v=qE()!=null,{context:w,hasClosePart:j}=RF(),S=b.useState("open"),N=b.useState("openMethod"),k=b.useState("instantType"),T=b.useState("transitionStatus"),D=b.useState("popupProps"),C=b.useState("titleElementId"),A=b.useState("descriptionElementId"),R=b.useState("modal"),I=b.useState("mounted"),P=b.useState("openChangeReason"),O=b.useState("activeTriggerElement"),_=b.useState("floatingRootContext"),L=_.useState("floatingId"),H=b.useState("disabled"),B=b.useState("openOnHover"),z=b.useState("closeDelay");ra({open:S,ref:b.context.popupRef,onComplete(){S&&b.context.onOpenChangeComplete?.(!0)}}),LT(_,{enabled:B&&!H,closeDelay:z});const Q=f===void 0?TT(b.context.popupRef):f,K=R!==!1&&j;b.useSyncedValue("focusManagerModal",K);const X=b.useStateSetter("popupElement"),q={open:S,side:y.side,align:y.align,instant:k,transitionStatus:T},$=yt("div",t,{state:q,ref:[a,b.context.popupRef,X],props:[D,{id:L,role:"dialog",...lf,"aria-labelledby":C,"aria-describedby":A,onKeyDown(Y){v&&Sh.has(Y.key)&&Y.stopPropagation()}},uf(T),h],stateAttributesMapping:qv});return s.jsx(oh,{context:_,openInteractionType:N,modal:K,disabled:!I||P===Vs,initialFocus:Q,returnFocus:p,restoreFocus:"popup",previousFocusableElement:dn(O)?O:void 0,nextFocusableElement:b.context.triggerFocusTargetRef,beforeContentFocusGuardRef:b.context.beforeContentFocusGuardRef,children:s.jsx(AF.Provider,{value:w,children:$})})});function hf(e){return s.jsx(vF,{"data-slot":"popover",...e})}function Hh(e){return s.jsx(NF,{"data-slot":"popover-trigger",...e})}function gf({className:e,sideOffset:t=6,align:a="start",side:o,alignOffset:c,collisionPadding:d=8,anchor:f,children:p,...h}){return s.jsx(CF,{children:s.jsx(EF,{className:"z-[35] outline-none",sideOffset:t,align:a,side:o,alignOffset:c,collisionPadding:d,anchor:f,children:s.jsx(OF,{"data-slot":"popover-content",className:Ue("flex max-h-[min(70vh,560px)] flex-col overflow-hidden rounded-lg border border-border-strong bg-raised text-foreground shadow-3","outline-none","data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-top-1","data-closed:animate-out data-closed:fade-out-0",e),...h,children:p})})})}function MF({page:e,pageCount:t,onPageChange:a,disabled:o=!1,className:c,infoFirst:d=!1}){const f=Math.max(1,Number(t)||1),p=Math.min(Math.max(1,Number(e)||1),f),h=s.jsx("span",{"data-slot":"pager-info",className:"text-[11.5px] text-subtle [font-variant-numeric:tabular-nums]",children:go("第 {current} / {total} 页",{current:p,total:f})});return s.jsxs("div",{"data-slot":"pager",className:Ue("flex items-center gap-2",c),children:[d&&h,s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p<=1,onClick:()=>a(p-1),children:go("上一页")}),s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p>=f,onClick:()=>a(p+1),children:go("下一页")}),!d&&h]})}const DF=Vc(["relative flex w-full items-center gap-2.5 text-left","border border-transparent rounded-sm","shadow-none","transition-[background-color,border-color,color] duration-150 ease-out","outline-none focus-visible:shadow-focus","disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:["cursor-pointer px-2.5 py-2","text-[12.5px] font-medium text-sidebar-fg","hover:bg-nav-hover hover:text-foreground","data-[active]:border-nav-selected-border data-[active]:bg-nav-selected-bg data-[active]:font-semibold data-[active]:text-nav-selected-fg"],add:["cursor-pointer justify-center px-2 py-1.5","border-dashed border-border-strong bg-transparent","text-[11.5px] text-muted-foreground","hover:border-primary hover:text-primary-fg"]}},defaultVariants:{variant:"default"}});function ru({className:e,variant:t,active:a=!1,count:o,icon:c,trailing:d,children:f,...p}){return s.jsxs("button",{type:"button","data-slot":"nav-item","data-active":a?"":void 0,"aria-current":a?"true":void 0,className:Ue(DF({variant:t}),e),...p,children:[c,s.jsx("span",{"data-slot":"nav-item-label",className:"min-w-0 flex-1 truncate",children:f}),d,o!=null&&s.jsx("span",{"data-slot":"nav-item-count",className:Ue("flex-none text-[10.5px] text-sidebar-muted [font-variant-numeric:tabular-nums]",a&&"text-inherit"),children:o})]})}function r(e,t){const a=typeof window<"u"?window.wbI18n:void 0;return a&&typeof a.t=="function"?a.t(e,t):e}function Uh(e){if(e.source==="subscription"&&(e.port===null||e.port===void 0))return r("未分配端口");const t=e.resolved;return t?.protocol&&t.host&&t.port?`${String(t.protocol).toUpperCase()} ${t.host}:${t.port}`:t?.label||""}function au(e){const t=e.name||e.id,o=[e.resolveError?r("解析失败"):Uh(e),e.enabled===!1?r("已禁用"):""].filter(Boolean);return o.length?r("{name}({parts})",{name:t,parts:o.join(" · ")}):t}const Xa="pool:";function Pe(){return window}function Le(e,t){Pe().wbApp?.toast?.(e,t)}function Qa(e){const t=Pe().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function Fs(e){const t=Pe().wbApp?.formatTime;if(t)return t(e);const a=Number(e);return!Number.isFinite(a)||a<=0?"":new Date(a).toLocaleString("zh-CN")}function ut(e){return e instanceof Error?e.message:String(e)}function lu(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function aw(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const a=o=>String(o).padStart(2,"0");return`${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}`}function IF(e){return e==="积分"?r("积分"):e==="额度"?r("额度"):e}function PF(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e,a=Array.isArray(t.credits)?t.credits:[],o=Date.now();return a.map(c=>{const d=String(c?.name||"").trim()||r("积分包"),f=String(c?.unit||"").trim(),p=lu(c?.total),h=lu(c?.used),b=lu(c?.remain),y=c?.unlimited===!0,v=lu(c?.grantAt),w=lu(c?.startAt),j=lu(c?.expireAt),S=c?.daily===!0,N=String(c?.grantReason||"").trim(),k=j!==null&&j>0&&j<=o,T=p!==null&&p>0,D=y?r("不限"):b!==null?T?r("剩 {remaining} / {total}",{remaining:b,total:p}):r("剩 {remaining}",{remaining:b}):h!==null?r("已用 {used}",{used:h}):"—",C=!y&&f&&D!=="—"?`${D} ${IF(f)}`:D,A=T&&b!==null?Math.max(0,Math.min(100,b/p*100)):null,R=b!==null&&b<=0||b===null&&h!==null&&T&&h>=p,I=!y&&!S&&(R||k),P=[];v!==null&&v>0?P.push(r("{time} 领取",{time:aw(v)})):w!==null&&w>0&&P.push(r("{time} 生效",{time:aw(w)})),S?P.push(r("每日重置")):j!==null&&j>0&&P.push(k?r("已过期"):r("{time} 到期",{time:aw(j)})),N&&P.push(N);const O=k||b===0?"muted":A!==null&&A<20?"warn":b===null&&h===null&&!y?"muted":"ok",_=[d,C,v!==null&&v>0?r("领取 {time}",{time:Fs(v)}):w!==null&&w>0?r("生效 {time}",{time:Fs(w)}):"",j!==null&&j>0?k?r("已过期({time})",{time:Fs(j)}):r("到期 {time}",{time:Fs(j)}):"",S?r("每日重置(额度按周期回满,不是作废)"):"",N,A===null&&b!==null?r("上游未给总量,画不出剩余比例"):"",h!==null&&p!==null?r("已用 {used} / 共 {total}",{used:h,total:p}):""].filter(Boolean).join(" · ");return{name:d,view:C,tone:O,percent:A,window:P.length?P.join(" · "):null,title:_,spent:I}})}function vA({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.window?s.jsx("div",{className:"usage-pop-window",children:e.window}):null,e.percent!==null?s.jsx("span",{className:"usage-pop-track",children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function yA({rows:e,subscriptionLine:t,variant:a,kind:o,title:c,children:d}){const[f,p]=x.useState(!1),[h,b]=x.useState(!1),y=e.filter(k=>!k.spent),v=e.filter(k=>k.spent),w=a==="pool"?`usage-toggle usage-pool-line ${o}`:`usage-toggle ${o}`,j=x.useRef(null),S=x.useCallback(k=>{j.current=k,k&&(k.scrollTop=0)},[]),N=x.useCallback(()=>j.current??null,[]);return x.useLayoutEffect(()=>{if(!h)return;const k=j.current?.querySelector(".usage-pop-spent .usage-pop-row");k instanceof HTMLElement&&k.scrollIntoView({block:"nearest"})},[h]),s.jsxs(hf,{open:f,onOpenChange:p,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:w,title:c,"aria-label":r("积分明细")}),children:[a==="pool"?d:s.jsx("span",{className:"val",children:d}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsx(gf,{align:"end",sideOffset:6,className:"w-[320px]",initialFocus:N,children:s.jsxs("div",{className:"usage-pop-credit",ref:S,tabIndex:-1,children:[t?s.jsx("div",{className:"usage-pop-sub",children:t}):null,s.jsx("div",{className:"usage-pop-group",children:r("积分明细")}),y.map((k,T)=>s.jsx(vA,{row:k},`${k.name}-${T}`)),v.length>0?s.jsxs("div",{className:"usage-pop-spent",children:[s.jsxs("button",{type:"button",className:"usage-pop-spent-head","aria-expanded":h,title:r("展开或收起(默认收起)"),onClick:()=>b(k=>!k),children:[s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"}),s.jsx("span",{children:r("已用完 / 已过期")}),s.jsx("span",{className:"n",children:r("{count} 份",{count:v.length})})]}),h?v.map((k,T)=>s.jsx(vA,{row:k},`spent-${k.name}-${T}`)):null]}):null]})})]})}const ou="workbuddy",_F="raccoon",LF={workbuddy:{usage:!0,creditDetail:!0,edition:!0,identifier:"uid",expiry:"expiresAt"},"workbuddy-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},raccoon:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},catpaw:{usage:!0,edition:!1,identifier:"uid",expiry:"tokenExpiresAt"},autoclaw:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},"autoclaw-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!0},qoder:{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"qoder-intl":{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"cline-free":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},"cline-pass":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},accio:{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"accio-cn":{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},zcode:{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},"zcode-intl":{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},codearts:{usage:!0,usageDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt",concurrencyDefault:3},trae:{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},loomy:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt"},kuku:{usage:!0,edition:!1,identifier:"uid",expiry:""},officeace:{usage:!0,creditDetail:!0,edition:!1,identifier:"id",expiry:"expiresAt"},antigravity:{usage:!0,edition:!1,identifier:"userId",expiry:""},modelscope:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""},"modelscope-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""}},zF={usage:!1,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!1};function kn(e){const t=e?.provider;return typeof t=="string"&&t?t:ou}function ir(e){return e&&LF[e]||zF}const BF="opencode",HF="https://opencode.ai/zen/go/v1";function wA(e,t){if(!e||e.clientEmulation!==BF)return!1;const o=((typeof t=="string"?t.trim():"")||String(e.baseUrl||"")).trim().replace(/\/+$/,"").toLowerCase();return o?o!==HF:!1}function UF(e){const t=e?kn(e):"";return t.startsWith("custom-")&&(Pe().wbProviders?.customList?.()||[]).find(o=>o?.id===t)||null}function VF(e){return e?wA(UF(e),e.baseUrl):!1}function jA(e){const t=Array.isArray(e?.providers)?e.providers:[],a=Array.isArray(e?.accounts)?e.accounts:[],o=new Map;a.forEach(d=>{const f=kn(d);o.set(f,(o.get(f)||0)+1)});const c=new Map;return t.forEach(d=>{d?.id&&c.set(String(d.id),{id:String(d.id),label:String(d.label||d.id),count:Number(d.count)||0})}),o.forEach((d,f)=>{c.has(f)||c.set(f,{id:f,label:Pe().wbProviders?.labelOf?.(f)||f,count:d})}),c.size||c.set(ou,{id:ou,label:Pe().wbProviders?.labelOf?.(ou)||"WorkBuddy 国内版",count:0}),[...c.values()]}function Vh(e){const t=ir(kn(e)).identifier;return String(e?.[t]||"")}function SA(e){const t=Number(e)||0;return t<=0?0:t<1e11?t*1e3:t}function FF(e){const t=ir(kn(e)).expiry;return SA(e?.[t])}function Ta(e){const t=kn(e);return t.startsWith("custom-")?!!e?.balanceQuery?.scheme:ir(t).usage}const lw=30,NA=86400,kA=60,CA=1800,TA=86400,EA=1,$F=95e5;function qF(e){return e==="codearts"?[{type:"token",action:"skip",threshold:$F,reset:"daily",enabled:!0}]:e==="cline-free"?[]:[{type:"balance",action:"skip",threshold:EA,enabled:!0}]}function AA(e){const t=e?.usageQuery;if(!t||typeof t!="object")return{enabled:!0,interval:kA};const a=t.enabled===void 0?!0:t.enabled===!0,o=Number(t.interval)||0,c=o>=lw&&o<=NA;return{enabled:a,interval:a&&!c?kA:o}}function GF(e){if(!e||typeof e!="object")return!1;const t=e;if(t.type!=="balance"&&t.type!=="token"||t.action!=="skip"&&t.action!=="disable")return!1;const a=Number(t.threshold);if(!Number.isFinite(a)||a<=0)return!1;if(t.type==="token"&&t.reset!=="daily"){const o=Number(t.period);if(!Number.isInteger(o)||oTA)return!1}return!0}function KF(e){const t=e?.lowBalance;if(!t||typeof t!="object"||!t.mode)return qF(kn(e));const a=Number(t.threshold),o=Number.isFinite(a)&&a>0?a:EA;return t.mode!=="skip"&&t.mode!=="disable"?[]:[{type:"balance",action:t.mode,threshold:o,enabled:!0}]}function iu(e){const t=e?.limiters;return Array.isArray(t)?t.filter(GF):KF(e)}function YF(e){return iu(e).filter(t=>t.type==="token")}function XF(e,t){const a=t*1e3;return e-e%a}function RA(e){return e.reset==="daily"?0:e.period??0}function ow(e,t=Date.now()){if(e===0){const a=new Date(t);return a.setHours(0,0,0,0),a.getTime()}return XF(t,e)}function xf(e,t,a=Date.now()){if(e.type!=="token")return null;const o=RA(e),c=(t||[]).find(d=>Number(d.kind)===o);return c&&Number(c.windowStart)===ow(o,a)?c:null}function Fh(e,t){const a=iu(e).filter(f=>f.type==="balance"&&f.action==="skip"&&f.enabled!==!1&&f.threshold>0);if(!a.length||!t||typeof t!="object")return!1;const o=t;if(o.unlimited)return!1;const c=o.totalLeft??o.available;if(c==null||c==="")return!1;const d=Number(c);return Number.isFinite(d)&&a.some(f=>dc.type==="token"&&c.action==="skip"&&c.enabled!==!1);if(!a.length||!t?.length)return!1;const o=Date.now();return a.some(c=>{const d=xf(c,t,o);return d!==null&&Number(d.used)>=c.threshold})}function QF(e,t){return iu(e).some(a=>{if(a.type!=="token"||a.action!=="disable"||a.enabled===!1)return!1;const o=xf(a,t);return o!==null&&Number(o.used)>=a.threshold})}function cw(e,t=Date.now()){const a=RA(e),o=ow(a,t),c=a===0?Math.max(0,ow(0,o+864e5+36e5)-t):Math.max(0,o+a*1e3-t);return{kind:a,startMs:o,remainingMs:c,daily:a===0}}function $h(e,t){if(e<=0)return"";const a=Math.ceil(e/6e4);if(t){const o=Math.ceil(e/36e5);return o>=1?r("今日剩 {n} 小时",{n:o}):r("今日剩 {n} 分钟",{n:a})}return a>=1?r("剩 {n} 分钟",{n:a}):r("剩不到 1 分钟")}function Tl(e){const t=Number(e);if(!Number.isFinite(t))return"—";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(Math.round(t))}function OA(e){return e>0&&e%3600===0?r("{n} 小时",{n:e/3600}):e>0&&e%60===0?r("{n} 分钟",{n:e/60}):r("{n} 秒",{n:e})}function bf(e){return e?.desktop===!0}function MA(e){return e?.chatSupported!==!1}function ZF(e){return typeof e=="string"&&e.startsWith("custom-")}function WF(e){return r(e==="enterprise"?"企业":e==="ultimate"?"旗舰":"个人")}function qh(e,t){const a=Number(e?.priority??100)-Number(t?.priority??100);return a!==0?a:(Number(e?.addedAt)||0)-(Number(t?.addedAt)||0)}function cr(e){return e?.enabled!==!1}function vf(e,t=""){const a=e?.rateLimits||{},o=Date.now();return t?Number(a[t]?.resetAt)>o:Object.values(a).some(c=>Number(c?.resetAt)>o)}function DA(e){return e?.edition==="intl"?"intl":"cn"}function IA(e){return ir(kn(e)).claim?e?.canClaim!==!1:!1}const PA="coding-plan",wo="start-plan";function Gh(e){return!!ir(kn(e)).planChannel}function uw(e){return Gh(e)?String(e?.zcodePlan||"").trim()===wo?wo:PA:""}function JF(e){return r(e===wo?"活动套餐(Start Plan)":"编码套餐(Coding Plan)")}function _A(e){switch(String(e??"").trim()){case"pending":return r("待生效");case"active":return r("生效中");case"expired":return r("已过期");case"unknown":return r("状态未知");default:return String(e??"")}}function Kh(e){const t=e?.claimPlans;if(!t||typeof t!="object"||Array.isArray(t))return[];const a=dw();return Object.entries(t).filter(([,o])=>Number(o)>0&&dw(Number(o))===a).map(([o])=>o)}function e$(e){return Kh(e).length>0}function t$(e){const t=Kh(e),a=t.length?r("({plans})",{plans:t.join(r("、"))}):"";return r("今天(北京时间 {day})已领取 {n} 份{names};还有其他可领套餐时,点这里可以继续领;活动按自然日发新套餐,明天可再领",{day:dw(),n:t.length,names:a})}function n$(e){return!!ir(kn(e)).usageDetail}function LA(e){return!!ir(kn(e)).creditDetail}function zA(e){return/^free$/i.test(String(e??"").trim())}function s$(e){const t=String(e??"").trim();return/^trial$/i.test(t)?r("试用版"):zA(t)?r("免费版"):t}function dw(e=Date.now()){return new Date(e+8*3600*1e3).toISOString().slice(0,10)}function yf(e,t,a){return vf(e)||Fh(e,t)||iw(e,a)}function BA(e,t){const a=String(t.q||"").trim().toLowerCase();return a?[cu(e),e?.name,e?.nickname,e?.email,Vh(e),e?.id].some(c=>String(c||"").toLowerCase().includes(a)):!0}function HA(e,t){return t.provider==="all"||kn(e)===t.provider}function fw(e,t){return t.enabled==="all"?!0:t.enabled==="enabled"?cr(e):!cr(e)}function UA(e,t,a,o){if(t.limit==="all")return!0;if(!cr(e))return!1;const c=yf(e,a?.(e),o?.(e));return t.limit==="limited"?c:!c}function VA(e,t,a,o){return HA(e,t)&&fw(e,t)&&UA(e,t,a,o)&&BA(e,t)}function r$(e,t,a,o){return(e||[]).filter(c=>VA(c,t,a,o))}function FA(e,t,a,o){const c=e||[],d=h=>c.filter(b=>HA(b,t)&&(h==="enabled"||fw(b,t))&&BA(b,t)),f=d("enabled"),p=d("limit");return{enabledAll:f.length,enabled:f.filter(cr).length,disabled:f.filter(h=>!cr(h)).length,limitAll:p.length,normal:p.filter(h=>cr(h)&&!yf(h,a?.(h),o?.(h))).length,limited:p.filter(h=>cr(h)&&yf(h,a?.(h),o?.(h))).length}}function pw(e){const t=e?.rateLimits;if(!t||typeof t!="object")return[];const a=Date.now();return Object.entries(t).map(([o,c])=>({model:o,...c&&typeof c=="object"?c:{}})).filter(o=>Number(o.resetAt)>a).sort((o,c)=>Number(o.resetAt)-Number(c.resetAt))}function mw(e){const t=(e||[]).slice().sort(qh),a=new Map;return t.forEach((o,c)=>a.set(o.id,{position:c+1,total:t.length})),a}function a$(e,t,a,o){const c=(e||[]).slice().sort(qh),d=[],f=new Map;for(const p of c){const h=kn(p);f.has(h)||(f.set(h,[]),d.push(h)),f.get(h).push(p)}return d.map((p,h)=>{const b=f.get(p)||[];return{provider:p,label:Pe().wbProviders?.labelOf?.(p)||p,rank:h+1,members:b,accounts:t?b.filter(t):b,enabled:b.filter(cr).length,disabled:b.filter(y=>!cr(y)).length,limited:b.filter(y=>cr(y)&&yf(y,a?.(y),o?.(y))).length}})}function cu(e){if(!e)return"";const t=String(e.name||"").trim();if(e.nameCustom===!0&&t)return t;const a=String(e.email||"").trim();return ir(kn(e)).emailAsName&&a?a:e?.nickname||t||Vh(e)||e?.id||""}const hw="已限流",$A=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function gw(e){const t=Number(e);if(!Number.isFinite(t)||t<=0||t<=Date.now())return hw;const a=new Date(t),o=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",hour12:!1}),c=Math.round(($A(a)-$A(new Date))/864e5);return c===0?r("今天 {clock}",{clock:o}):c===1?r("明天 {clock}",{clock:o}):r("{month}月{day}日 {clock}",{month:a.getMonth()+1,day:a.getDate(),clock:o})}function l$(e){const t=kn(e);if(!ir(t).edition)return"";const a=DA(e),o=e?.editionLabel,c=o||(a==="intl"?"国际版":"国内版");return(Pe().wbProviders?.labelOf?.(t)||"").includes(c)?"":o||r(a==="intl"?"国际版":"国内版")}function o$(e){return[MA(e)?null:{text:r("仅账号管理"),kind:"plain",title:r("该提供商的推理转发尚未接入,账号不参与转发")},ZF(kn(e))&&e.hasCredentials===!1?{text:r("未配置凭证"),kind:"bad",title:r("这条自定义账号既没有 API Key,也没有勾选「无需鉴权」:转发时会被跳过,该提供商下的模型也不会出现在模型列表里。去账号「设置」里补上 Key,或勾选「该上游无需鉴权」")}:null,e.proxy?.error?{text:r("代理异常"),kind:"bad",title:r("{error}(转发时会回退直连)",{error:e.proxy.error})}:null,uw(e)===wo?{text:r("活动套餐"),kind:"plain",title:r("转发走活动套餐通道(zcode.z.ai 的 Anthropic 端点,用账号里领到的额度);在账号设置里可切回编码套餐")}:null].filter(t=>t!==null)}const qA="workbuddy-desktop-accounts-filters",GA="workbuddy-desktop-accounts-collapsed",KA="workbuddy-desktop-accounts-names-hidden";function i$(){const e={provider:"all",enabled:"all",limit:"all",q:""},t=Pe().wbFilterMemory?.load(qA,e)||e;return{provider:String(t.provider||"all"),enabled:String(t.enabled||"all"),limit:String(t.limit||"all"),q:""}}function c$(){try{const e=JSON.parse(localStorage.getItem(GA)||"[]");return new Set(Array.isArray(e)?e.map(t=>String(t)).filter(Boolean):[])}catch{return new Set}}function u$(){try{return localStorage.getItem(KA)==="1"}catch{return!1}}let pn={version:0,filter:i$(),collapsed:c$(),selected:new Set,panels:new Map,connections:new Map,clash:null,dialog:null,namesHidden:u$(),usageBusy:!1,usageInflight:new Set};const xw=new Set;function YA(e){return xw.add(e),()=>{xw.delete(e)}}function Ws(){return pn}function Cn(e){pn={...pn,...e,version:pn.version+1},xw.forEach(t=>t())}function br(){Cn({})}function bw(){return Pe().wbApp?.getState?.()?.accounts}function El(){const e=bw()?.accounts;return Array.isArray(e)?e:[]}function Ea(e){return El().find(t=>t.id===e)||null}function d$(e,t){const a=a$(El(),c=>VA(c,pn.filter,e,t),e,t);return{groups:a.filter(c=>c.accounts.length>0),allGroups:a}}function XA(){return jA(bw())}function f$(e,t){return FA(El(),pn.filter,e,t)}function p$(){return mw(El())}function Yh(){Pe().wbFilterMemory?.save(qA,{provider:pn.filter.provider,enabled:pn.filter.enabled,limit:pn.filter.limit})}function m$(e){pn.filter.q!==e&&Cn({filter:{...pn.filter,q:e}})}function h$(e){const t=e||"all";pn.filter.provider!==t&&(Cn({filter:{...pn.filter,provider:t}}),Yh())}function QA(e,t){const a={...pn.filter,[e]:t};a.enabled==="disabled"&&a.limit!=="all"&&(a.limit="all"),Cn({filter:a}),Yh()}function Xh(){return pn.filter.provider!=="all"||pn.filter.enabled!=="all"||pn.filter.limit!=="all"||pn.filter.q.trim()!==""}function ZA(){Cn({filter:{provider:"all",enabled:"all",limit:"all",q:""}}),Yh()}function g$(){const e=pn.filter.provider;e!=="all"&&(XA().some(t=>t.id===e)||(Cn({filter:{...pn.filter,provider:"all"}}),Yh()))}function WA(e){try{localStorage.setItem(GA,JSON.stringify([...e]))}catch{}}function JA(e){const t=new Set(pn.collapsed);t.has(e)?t.delete(e):t.add(e),WA(t),Cn({collapsed:t})}function x$(e,t){const a=new Set(pn.collapsed);for(const o of e)t?a.add(o):a.delete(o);WA(a),Cn({collapsed:a})}function b$(e){return pn.selected.has(e)}function v$(e,t){const a=new Set(pn.selected);t?a.add(e):a.delete(e),Cn({selected:a})}function eR(e,t){const a=new Set(pn.selected);for(const o of e)t?a.add(o):a.delete(o);Cn({selected:a})}function y$(){Cn({selected:new Set})}function tR(e,t){return pn.panels.get(e)?.has(t)===!0}function nR(e,t,a){if(!e)return;const o=new Map(pn.panels),c=new Set(o.get(e)||[]);a?c.add(t):c.delete(t),c.size?o.set(e,c):o.delete(e),Cn({panels:o})}function w$(e,t){const a=new Map(pn.panels);for(const o of e){const c=new Set(a.get(o)||[]);c.add(t),a.set(o,c)}Cn({panels:a})}function j$(){const e=!pn.namesHidden;try{localStorage.setItem(KA,e?"1":"0")}catch{}Cn({namesHidden:e})}function S$(e){return"*".repeat(Math.min(Math.max(e.length,4),12))}const sR="usage_not_configured",jo=new Map,wf=new Map;function oa(e,t,a){jo.set(e,t),t!=null&&uu(t)?wf.set(e,a):wf.delete(e)}function Za(e){const t=jo.get(e.id);if(t===void 0)return;if(!uu(t))return t;const a=Math.max(Number(e.addedAt)||0,Number(e.updatedAt)||0);return(wf.get(e.id)||0)>=a?t:void 0}const jf=new Map;let rR=0;function Al(e){return e?jf.get(e.id)||[]:[]}function N$(e){const t=Number(e?.tokenAt)||0;if(!t||t===rR)return!1;const a=e?.tokenUsage;if(!a||typeof a!="object")return!1;rR=t;const o=new Map;for(const[d,f]of Object.entries(a)){if(!Array.isArray(f))continue;const p=[];for(const h of f){if(!h||typeof h!="object")continue;const b=Number(h.kind),y=Number(h.windowStart),v=Number(h.used);!Number.isFinite(b)||b<0||!Number.isFinite(y)||y<=0||!Number.isFinite(v)||v<0||p.push({kind:b,windowStart:y,used:v})}o.set(d,p)}const c=o.size!==jf.size||[...o].some(([d,f])=>{const p=jf.get(d);return!p||p.length!==f.length||f.some((h,b)=>h.used!==p[b]?.used||h.windowStart!==p[b]?.windowStart)});jf.clear();for(const[d,f]of o)jf.set(d,f);return c}let Qh=null;async function aR(e={}){const t=Ws().clash;if(!e.force&&t)return t;Qh||(Qh=(async()=>{try{const o=await Pe().workbuddyDesktop?.getProxies?.();if(!o||typeof o!="object"||!o.clash)throw new Error(r("代理列表响应异常({type})",{type:typeof o}));return o.clash}finally{Qh=null}})());const a=await Qh;return Cn({clash:a}),a}function k$(){Cn({clash:null})}let Sf=null,Zh=null;function C$(){return Sf}async function lR(e={}){if(!e.force&&Sf)return Sf;Zh||(Zh=(async()=>{try{const a=await Pe().workbuddyDesktop?.getProxyPool?.();if(!a||typeof a!="object"||!Array.isArray(a.items))throw new Error(r("代理池响应异常({type})",{type:typeof a}));return a.items}finally{Zh=null}})());const t=await Zh;return Sf=t,t}let vw=null;function T$(){return vw}let Wh=0,oR=!1;function E$(){if(!(Sf||Date.now(){Wh=0,vw=null,br()}).catch(e=>{vw=ut(e),br()})}}function Jh(e){if(!Ea(e)){Le(r("账号不存在,请刷新后重试"),"err");return}Cn({dialog:{kind:"settings",id:e}})}function eg(){Cn({dialog:null})}function yw(e,t="enable"){const a=(Array.isArray(e)?e:[]).filter(o=>Ea(o));if(!a.length){Le(r("请先勾选要操作的账号"),"err");return}Cn({dialog:{kind:"batch",ids:a,action:t}})}function A$(e){let t=!1;for(const f of[...jo.keys()])e.has(f)||(jo.delete(f),t=!0);for(const f of[...wf.keys()])e.has(f)||wf.delete(f);const a=new Map(Ws().panels);for(const f of[...a.keys()])e.has(f)||(a.delete(f),t=!0);const o=new Map(Ws().connections);for(const f of[...o.keys()])e.has(f)||(o.delete(f),t=!0);const c=new Set(Ws().usageInflight);for(const f of[...c])e.has(f)||(c.delete(f),t=!0);const d=new Set(Ws().selected);for(const f of[...d])e.has(f)||(d.delete(f),t=!0);t&&Cn({panels:a,connections:o,usageInflight:c,selected:d})}const R$=2e3;function iR(e){return Ws().connections.get(e)||0}async function cR(){try{const e=await Pe().workbuddyDesktop?.getAccountConnections?.(),t=e?.counts&&typeof e.counts=="object"?e.counts:{},a=new Map;for(const[o,c]of Object.entries(t)){const d=Number(c)||0;d>0&&a.set(o,d)}return Cn({connections:a}),!0}catch{return!1}}let uR=null;function O$(){uR||(uR=setInterval(()=>{document.hidden||Pe().wbApp?.currentPage!=="accounts"||cR()},R$))}function ww(){return El().filter(e=>Ta(e)&&e.available!==!1)}function uu(e){if(e==null)return null;if(typeof e=="string")return{message:e,notConfigured:!1};if(typeof e!="object")return null;const t=e.error;return t?{message:String(t),notConfigured:e.code===sR}:null}function dR(e){return e.usage?e.usage:{error:e.error?String(e.error):r("余额响应为空"),code:e.code}}function fR(e){const t=Array.isArray(e?.results)?e.results:[],a=Number(e?.at)||Date.now();let o=0;for(const c of t)c?.id&&(oa(String(c.id),dR(c),Number(c.at)||a),o++);return o&&(br(),Pe().wbApp?.renderTopbarStatus?.()),o}let pR=!1;function M$(e){if(!LA(e))return!1;const t=Za(e);return!t||typeof t!="object"||Array.isArray(t)||uu(t)?!1:!Array.isArray(t.credits)}async function D$(){if(!pR){pR=!0;for(const e of El().filter(M$)){const t=jo.get(e.id);try{await Nf(e.id)}catch{}const a=jo.get(e.id);t!==void 0&&(!a||uu(a))&&oa(e.id,t,Date.now()),br()}}}let mR=0;async function I$(){try{const e=await Pe().workbuddyDesktop?.getBalancesSnapshot?.(),t=N$(e);t&&(br(),Pe().wbApp?.renderTopbarStatus?.());const a=Number(e?.at)||0;return!a||a===mR||(mR=a,!fR(e))?t:(D$(),!0)}catch{return!1}}async function Nf(e){const t=await Pe().workbuddyDesktop?.getAllBalances?.(e||void 0),a=Array.isArray(t?.results)?t.results:[],o=Date.now(),c=new Set;for(const d of a){if(!d?.id)continue;const f=String(d.id);e&&f!==e||(c.add(f),oa(f,dR(d),o))}if(e)return c.has(e)||oa(e,r("未返回余额数据"),o),br(),t;for(const d of ww())c.has(d.id)||oa(d.id,r("未返回余额数据"),o);return br(),t}async function hR(){if(Ws().usageBusy)return;const e=ww();if(!e.length){Le(r("暂无可查询余额的账号"),"err");return}Cn({usageBusy:!0}),e.forEach(t=>oa(t.id,null,Date.now())),br();try{const t=(await Nf(null))?.results||[],a=t.filter(f=>f.usage).length,o=t.filter(f=>f.code===sR).length,c=o?r("({n} 个未配置查询凭证)",{n:o}):"",d=t.length-a-o;Le(a+o===t.length?r("✅ 已更新 {n} 个账号的余额{suffix}",{n:a,suffix:c}):r("已更新 {ok}/{total} 个账号,{failed} 个失败",{ok:a,total:t.length,failed:d}),d?"err":"ok")}catch(t){const a=ut(t);e.forEach(o=>oa(o.id,r("查询失败:{message}",{message:a}),Date.now())),br(),Le(r("余额查询失败:{message}",{message:a}),"err")}finally{Cn({usageBusy:!1})}}async function gR(e){if(Ws().usageInflight.has(e))return;const t=new Set(Ws().usageInflight);t.add(e),oa(e,null,Date.now()),Cn({usageInflight:t});try{await Nf(e)}finally{const a=new Set(Ws().usageInflight);a.delete(e),Cn({usageInflight:a})}}async function P$(e){if(!Ws().usageInflight.has(e))try{await gR(e);const t=uu(jo.get(e));t?.notConfigured?Le(t.message,"ok"):t?Le(r("余额查询失败:{message}",{message:t.message}),"err"):Le(r("✅ 已更新余额"))}catch(t){oa(e,r("查询失败:{message}",{message:ut(t)}),Date.now()),br(),Le(r("余额查询失败:{message}",{message:ut(t)}),"err")}}async function tg(e){if(e){const a=Ea(e);if(!a||!Ta(a))return;try{await gR(e)}catch(o){oa(e,r("查询失败:{message}",{message:ut(o)}),Date.now()),br()}return}if(Ws().usageBusy)return;const t=ww();if(t.length){Cn({usageBusy:!0}),t.forEach(a=>oa(a.id,null,Date.now())),br();try{await Nf(null)}catch(a){const o=ut(a);t.forEach(c=>oa(c.id,r("查询失败:{message}",{message:o}),Date.now())),br()}finally{Cn({usageBusy:!1})}}}async function xR(e,t){try{await Pe().workbuddyDesktop?.updateAccount?.(e,{enabled:t}),await Pe().wbApp?.refresh?.(),Le(r(t?"✅ 已启用":"✅ 已禁用"))}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function bR(e,t){if(!e.length)return!1;try{return await Pe().workbuddyDesktop?.reorderAccounts?.(e),Le(t?r("✅ 已保存:{note}",{note:t}):r("✅ 顺序已保存")),await Pe().wbApp?.refresh?.(),!0}catch(a){return Le(r("顺序未保存:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.(),!1}}async function vR(e,t){if(e.length)try{await Pe().workbuddyDesktop?.batchAccounts?.({action:t?"enable":"disable",ids:e}),Le(t?r("✅ 已启用 {n} 个账号",{n:e.length}):r("✅ 已禁用 {n} 个账号",{n:e.length})),await Pe().wbApp?.refresh?.()}catch(a){Le(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function _$(e,t){try{await Pe().workbuddyDesktop?.clearRateLimits?.(e,t||null),Le(t?r("✅ 已清除 {model} 的限流标记",{model:t}):r("✅ 已清除该账号全部限流标记")),await Pe().wbApp?.refresh?.()}catch(a){Le(r("清除失败:{message}",{message:ut(a)}),"err")}}async function L$(e,t,a){if(t===yR){Jh(e);return}if(t!==ng&&t!==a)try{const o=t===""?null:{source:"pool",proxyId:t.slice(Xa.length)},d=(await Pe().workbuddyDesktop?.updateAccount?.(e,{proxy:o}))?.changes,f=Array.isArray(d)&&d.length?d[0]:r("代理已更新");Le(`✅ ${f}`)}catch(o){Le(r("保存失败:{message}",{message:ut(o)}),"err")}finally{await Pe().wbApp?.refresh?.()}}const ng="__proxy_custom__",yR="__proxy_custom_edit__";function wR(e,t){const a=Ea(e);if(!a){Le(r("账号不存在,请刷新后重试"),"err");return}const o=Pe().wbZcodePlans;if(!o?.open){Le(r("套餐明细弹窗未加载,请重启应用后重试"),"err");return}o.open({id:e,name:t||a.name})}function z$(e,t,a=1){return{seat:t.get(e.id)||{position:1,total:1},rank:a,picked:b$(e.id),usageEntry:jo.get(e.id),limitsOpen:tR(e.id,"limits"),connections:iR(e.id)}}const B$={DEFAULT_PROVIDER_ID:ou,RACCOON_PROVIDER_ID:_F,providerOf:kn,providerFeatures:ir,providerSummaries:jA,identifierOf:Vh,tokenExpiryOf:FF,supportsUsage:Ta,isDesktopAccount:bf,supportsChat:MA,byPriorityOrder:qh,typeLabel:WF,isEnabled:cr,isRateLimited:vf,isLimited:e=>yf(e,e?Za(e):void 0,Al(e)),accountEdition:DA,supportsClaim:IA,matchEnabled:fw,matchLimit:UA,visibleAccounts:r$,filterCounts:FA,positionMap:mw,activeLimits:pw,editionSuffix:l$,formatResetText:gw};function H$(){window.wbAccountsView={render:()=>br(),refreshCaches:A$,openPanels:w$,syncConnections:cR,applyBalances:fR,syncBalancesSnapshot:I$,queryUsageFor:Nf,queryAllUsage:hR,refreshUsageAfterCheckin:tg,supportsUsage:Ta,isDesktopAccount:bf,isEnabled:cr,isRateLimited:vf},window.wbAccountsModel=B$,window.wbAccountPanel={open:Jh,close:eg,openBatch:yw,closeBatch:eg,syncAddProvider:()=>Pe().wbAccountAddForms?.syncAddProvider?.(),invalidate:k$}}function U$(e){return e.type==="balance"?r("余额 < {threshold}",{threshold:e.threshold}):e.reset==="daily"?r("每日消耗 ≥ {count} Token(每天 0 点重置)",{count:Tl(e.threshold)}):r("每 {period}消耗 ≥ {count} Token",{period:OA(e.period??0),count:Tl(e.threshold)})}function V$(e){return e.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(自动恢复)")}function F$(e){return`${Math.round(e.threshold).toLocaleString("en-US")} Token`}function $$(e,t){if(t.enabled===!1)return{text:r("已停用"),kind:"off"};if(t.type==="balance"){const b=Za(e),y=Fh(e,b),v=b&&typeof b=="object"?b:null,w=v?v.totalLeft??v.available:void 0,j=w==null||w===""||v?.unlimited?"":r(" · 当前 {n}",{n:Number(w)});return y?{text:r("已跳过{current}",{current:j}),kind:"warn",title:r("余额低于阈值,转发时会跳过该账号(余额回升自动恢复)")}:{text:r("未触发{current}",{current:j}),kind:"ok"}}const a=Al(e),o=xf(t,a),c=o?o.used:0,d=Tl(t.threshold),f=t.reset==="daily"?r(" · 今日 {used} / {quota}",{used:Tl(c),quota:d}):r(" · 本周期 {used} / {quota}",{used:Tl(c),quota:d}),p=o?` · ${$h(cw(t).remainingMs,t.reset==="daily")}`:"";return o!==null&&c>=t.threshold?t.action==="disable"?e.enabled===!1?{text:r("已触发 · 账号已禁用"),kind:"danger",title:r("重置也不恢复,需手动启用")}:{text:r("已达上限{usage}",{usage:f}),kind:"warn",title:r("稍后由后台判定自动禁用")}:{text:r("已跳过{usage}{countdown}",{usage:f,countdown:p}),kind:"warn",title:r("窗口内已用 {used} / {limit} Token,转发时会跳过该账号(重置后自动恢复)",{used:Math.round(c).toLocaleString("en-US"),limit:Math.round(t.threshold).toLocaleString("en-US")})}:{text:r("未触发{usage}{countdown}",{usage:f,countdown:p}),kind:"ok",title:F$(t)}}function q$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:{value:"1",unit:"hours"}}function jR(e){const t={type:"balance",action:"skip",thresholdInput:"",tokenUnit:"wan",reset:"fixed",periodInput:"1",periodUnit:"hours"};if(!e)return t;if(e.type==="balance")return{...t,type:"balance",action:e.action,thresholdInput:String(e.threshold)};if(e.reset==="daily")return{...t,type:"token",action:e.action,reset:"daily",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit"};const a=q$(e.period??0);return{...t,type:"token",action:e.action,reset:"fixed",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit",periodInput:a.value,periodUnit:a.unit}}function SR(e){const t=Number(e.thresholdInput);if(!Number.isFinite(t)||t<=0)return{error:r("限制阈值必须是大于 0 的数字")};if(e.type==="balance")return{rule:{type:"balance",action:e.action,threshold:t,enabled:!0}};const a=Math.round(e.tokenUnit==="wan"?t*1e4:t);if(e.reset==="daily")return{rule:{type:"token",action:e.action,threshold:a,reset:"daily",enabled:!0}};const o=Number(e.periodInput)*(e.periodUnit==="hours"?3600:60);if(!Number.isFinite(o)||o<=0)return{error:r("请填写重置周期")};const c=Math.round(o);return cTA?{error:r("重置周期必须是 30 分钟 ~ 24 小时")}:{rule:{type:"token",action:e.action,threshold:a,period:c,reset:"fixed",enabled:!0}}}function G$({account:e,target:t,onClose:a,onSave:o}){const[c,d]=x.useState(""),[f,p]=x.useState(t?.draft??null);if(x.useEffect(()=>{p(t?.draft??null),d("")},[t]),!t||!f)return null;const h=v=>{d(""),p({...f,...v})},b=()=>{const v=SR(f);if("error"in v){d(v.error);return}o(v.rule,t.index)},y=()=>{if(f.type==="balance"){const D=Za(e);if(D&&typeof D=="object"){const C=D;if(C.unlimited)return r("当前可用 ∞(不参与余额不足判定)");const A=C.totalLeft??C.available;if(A!=null&&A!=="")return r("当前余额 {n};与余额列同一数字口径,严格小于才触发(等于阈值仍可用)",{n:Number(A)})}return r("读数来自自动余额查询;与余额列同一数字口径,严格小于才触发(等于阈值仍可用)")}const v=SR(f);if(!("rule"in v))return"";const w=v.rule,j=xf(w,Al(e));if(!j)return w.reset==="daily"?r("窗口 = 今天 0 点起(本地时区),0 点重置即清零恢复;按账号在 requests 表聚合"):r("窗口对齐自然时间(整点 / 整 N 分钟一轮回),重置即清零恢复;按账号在 requests 表聚合");const S=cw(w),N=Tl(j.used),k=Tl(w.threshold),T=w.reset==="daily"?r("今日已用"):r("本周期已用");return r("{scope} {used} / {quota} Token,{countdown}重置",{scope:T,used:N,quota:k,countdown:$h(S.remainingMs,S.daily)})};return s.jsx(Qt,{open:!0,onOpenChange:v=>{v||a()},children:s.jsxs(Zt,{className:"w-[min(580px,calc(100vw-48px))]",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t.index>=0?r("编辑限制"):r("添加限制")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("限制类型")}),s.jsxs(ft,{value:f.type,onValueChange:v=>h({type:v,thresholdInput:""}),children:[s.jsx(mt,{className:"w-[150px]","aria-label":r("限制类型"),children:s.jsx(pt,{children:f.type==="balance"?r("余额"):r("Token 消耗")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"balance",children:r("余额")}),s.jsx(qe,{value:"token",children:r("Token 消耗")})]})]}),s.jsx("span",{className:"detail",children:r("余额沿用现有口径;Token 按重置方式内的累计消耗判定(切换类型会清空阈值)")})]}),f.type==="balance"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("余额低于")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[120px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("时")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(余额回升自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(余额回升自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("重置方式")}),s.jsxs(ft,{value:f.reset,onValueChange:v=>h({reset:v}),children:[s.jsx(mt,{className:"w-[190px]","aria-label":r("重置方式"),children:s.jsx(pt,{children:f.reset==="daily"?r("自然日(每天 0 点)"):r("固定周期")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"fixed",children:r("固定周期")}),s.jsx(qe,{value:"daily",children:r("自然日(每天 0 点)")})]})]}),s.jsx("span",{className:"detail",children:r("有的账号过了 0 点额度就回来 —— 选「自然日」")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),f.reset==="daily"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每日消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每")}),s.jsx($e,{type:"number",min:1,step:1,className:"max-w-[90px]",placeholder:r("周期"),value:f.periodInput,onChange:v=>h({periodInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.periodUnit,onValueChange:v=>h({periodUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("周期单位"),children:s.jsx(pt,{children:f.periodUnit==="hours"?r("小时"):r("分钟")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("内消耗 ≥")}),s.jsx($e,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:v=>h({thresholdInput:v.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:v=>h({tokenUnit:v}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:v=>h({action:v}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(重置后自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(重置后自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}),s.jsx("p",{className:"detail limiter-hint",children:y()}),c?s.jsx("p",{className:"detail text-destructive",children:c}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:b,children:t.index>=0?r("保存规则"):r("添加规则")})]})]})})}function K$({account:e,draft:t,onChange:a}){const[o,c]=x.useState(null),d=()=>c({index:-1,draft:jR(null)}),f=y=>c({index:y,draft:jR(t[y])}),p=(y,v)=>{const w=[...t];v>=0?w[v]=y:w.push(y),a(w),c(null)},h=y=>{a(t.filter((v,w)=>w!==y)),o&&c(null)},b=(y,v)=>{const w=[...t];w[y]={...w[y],enabled:v},a(w)};return s.jsxs(s.Fragment,{children:[t.length?s.jsx("div",{className:"limiter-rules mt-2.5",children:t.map((y,v)=>{const w=$$(e,y);return s.jsxs("div",{className:"limiter-rule","data-off":y.enabled===!1||void 0,children:[s.jsx(hs,{checked:y.enabled!==!1,"aria-label":r("启用该规则"),onCheckedChange:j=>b(v,j===!0)}),s.jsx("div",{className:"limiter-rule-main",children:s.jsxs("span",{className:"limiter-rule-cond",children:[s.jsx(ze,{variant:"secondary",shape:"tag",children:y.type==="balance"?r("余额"):"Token"})," ",r("{cond} 时 → {action}",{cond:U$(y),action:V$(y)})]})}),s.jsx(ze,{variant:w.kind==="ok"?"success":w.kind==="warn"?"warning":w.kind==="danger"?"destructive":"secondary",shape:"tag",title:w.title,children:w.text}),s.jsxs("div",{className:"limiter-rule-ops",children:[s.jsx(se,{variant:"ghost",onClick:()=>f(v),children:r("编辑")}),s.jsx(se,{variant:"ghost",onClick:()=>h(v),children:r("删除")})]})]},v)})}):s.jsx("p",{className:"detail mt-2.5",children:r("还没有限制规则:账号照常参与转发,余额与 Token 消耗都不设上限。")}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx(se,{variant:"outline",onClick:d,children:r("+ 添加限制")}),s.jsx("span",{className:"detail",children:r("可添加多条;同类规则也允许并存(例如一条按余额、两条不同重置方式的 Token)")})]}),s.jsx(G$,{account:e,target:o,onClose:()=>c(null),onSave:p})]})}function Y$(e,t){const a=iu(e);return JSON.stringify(t)===JSON.stringify(a)?null:{patch:{limiters:t}}}function X$(e){return iu(e).map(t=>({...t}))}const Q$={seconds:1,minutes:60,hours:3600};function Z$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:e>0?{value:String(e),unit:"seconds"}:{value:"5",unit:"minutes"}}function W$(e){const{enabled:t,interval:a}=AA(e),o=Z$(t?a:0);return{enabled:t,intervalInput:o.value,unit:o.unit}}function J$(e,t){const a=Math.round(Number(t.intervalInput)*Q$[t.unit]);if(t.enabled){if(!Number.isFinite(Number(t.intervalInput))||Number(t.intervalInput)<=0)return{error:r("请填写查询间隔")};if(aNA)return{error:r("查询间隔必须是 {min} 秒 ~ 24 小时",{min:lw})}}const o={},c=AA(e);return(t.enabled!==c.enabled||t.enabled&&a!==c.interval)&&(o.usageQuery={enabled:t.enabled,interval:t.enabled?a:c.interval}),o.usageQuery?{patch:o}:null}function e8({account:e,draft:t,onChange:a}){const o=c=>a({...t,...c});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(hs,{checked:t.enabled,onCheckedChange:c=>o({enabled:c===!0}),"aria-label":r("自动查询余额")}),s.jsx("span",{className:"text-xs text-subtle",children:r("自动查询余额(按下面的间隔自动刷新余额列的读数)")})]})}),t.enabled?s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-usage-interval",children:r("查询间隔")}),s.jsx($e,{id:"account-usage-interval",type:"number",min:1,step:1,className:"max-w-[110px]",value:t.intervalInput,onChange:c=>o({intervalInput:c.currentTarget.value})}),s.jsxs(ft,{value:t.unit,onValueChange:c=>o({unit:c}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("间隔单位"),children:s.jsx(pt,{children:t.unit==="hours"?r("小时"):t.unit==="minutes"?r("分钟"):r("秒")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"seconds",children:r("秒")}),s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",children:r("30 秒 ~ 24 小时;手动查询会顺延下一轮")})]}):null]})}const t8={sub2api:{label:"Sub2API",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},new_api:{label:"NewAPI",endpoint:"{base}/api/user/self + /api/status",note:r("用 NewAPI 站点的个人访问令牌查询账户余额(不是这条账号的上游 API Key)。令牌在站点的「个人设置」里生成,只有旧版 / 定制站点才需要额外填用户 ID。"),fields:[{key:"accessToken",label:r("NewAPI 个人访问令牌"),secret:!0,placeholder:r("在 NewAPI 站点「个人设置」里生成的访问令牌"),hint:r("必填;留空 = 不修改,清除用右边的按钮")},{key:"userId",label:r("NewAPI 用户 ID"),placeholder:r("旧版 / 定制站点才需要,新版可留空"),hint:r("可留空:新版请求头只认令牌;旧版会把用户 ID 放进 New-Api-User 头")}]},deepseek:{label:"DeepSeek",endpoint:"{base}/user/balance",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},opencode:{label:"OpenCode Go",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询订阅用量,不需要额外配置;读数展开成 5 小时 / 每周 / 每月三个窗口。"),fields:[]},sensenova:{label:"商汤日日新",endpoint:"platform.sensenova.cn 控制台",note:r("用商汤日日新控制台的账号密码查询(与推理用的 API Key 不是同一套)。网关会自动换取登录票并缓存,过期后自动重登,不需要手动维护。"),fields:[{key:"username",label:r("账号"),placeholder:r("商汤日日新控制台的登录账号"),hint:r("必填")},{key:"password",label:r("密码"),secret:!0,placeholder:r("商汤日日新控制台的登录密码"),hint:r("留空 = 不修改,清除用右边的按钮")}]},zhipu:{label:"智谱",endpoint:"bigmodel.cn 控制台",note:r("用 bigmodel.cn 控制台的访问令牌查询账户余额(人民币元)。令牌是登录后浏览器 Cookie `bigmodel_token_production` 的值:开发者工具 → 应用(Application)→ Cookie 里复制。"),fields:[{key:"token",label:r("访问令牌"),secret:!0,placeholder:r("bigmodel_token_production 的值"),hint:r("必填;留空 = 不修改,清除用右边的按钮")}]},zhipu_zai:{label:"智谱(z.ai 国际)",endpoint:"api.z.ai 控制台",note:r("用这条账号的 API Key 生成签名后查询账户余额(美元),不需要额外配置。要求 API Key 是 z.ai 的「id.secret」形态(控制台生成的 Key 就是)。"),fields:[]}};function kf(e){return e?t8[e]??null:null}function n8(e,t){return t.secret?t.key==="accessToken"?e?.hasAccessToken===!0:t.key==="password"?e?.hasPassword===!0:t.key==="token"?e?.hasToken===!0:!1:!1}function s8(e){const t=String(e?.scheme||"");return t==="new_api"?e?.hasAccessToken===!0:t==="sensenova"?String(e?.username||"").trim()!==""&&e?.hasPassword===!0:t==="zhipu"?e?.hasToken===!0:!0}function r8(e){return{userId:String(e?.userId||""),username:String(e?.username||""),accessToken:"",password:"",token:""}}function a8(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=String(t[c.key]??"").trim();if(c.secret){d&&(o[c.key]=d);continue}o[c.key]=d}return Object.keys(o).length?o:null}function l8({field:e,value:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){const p=`${f}-${e.key}`;return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:p,children:e.label}),s.jsx($e,{id:p,className:"min-w-[220px]",type:e.secret?"password":"text",autoComplete:e.secret?"new-password":"off",placeholder:a?r("已配置,留空则不修改"):e.placeholder,title:e.hint,value:t,onChange:h=>o(h.currentTarget.value)}),a&&c?s.jsx(se,{variant:"outline",size:"sm",disabled:d===!0,onClick:c,title:r("清除已配置的 {label}",{label:e.label}),children:r("清除")}):null]})}function o8({spec:e,values:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"detail mt-2.5",children:[r("余额查询方案:{label}",{label:e.label}),s.jsx("span",{className:"ml-1 text-subtle",children:e.endpoint})," — ",e.note]}),e.fields.map(p=>s.jsx(l8,{field:p,idPrefix:f,value:t[p.key]||"",configured:a[p.key]===!0,onValue:h=>o(p.key,h),onClear:c?()=>c(p.key):void 0,clearBusy:d},p.key))]})}const NR=64;function i8(e,t){const a=kn(e);return t.filter(o=>o.id!==e.id&&kn(o)===a)}const Rl=999,kR=8;function sg(e){return cu(e)||e?.id||""}function CR(e){const t=e?.config?.source||e?.source,a=e?.config||null,o=t==="rotate";return{mode:t==="pool"?"pool":o?"rotate":t==="clash"?"clash":t==="custom"?"custom":"none",proxyId:t==="pool"?String(a?.proxyId||""):"",rotateAll:o?a?.all!==!1:!0,rotateIds:o&&Array.isArray(a?.proxyIds)?a.proxyIds.map(String):[],listenerUid:a?.source==="clash"||t==="clash"?String(a?.listenerUid||""):"",protocol:a?.protocol==="socks5"?"socks5":"http",host:a?.host||"",port:a?.port===void 0||a?.port===null?"":String(a.port),username:a?.username||"",password:a?.password||""}}function jw(e){if(e.mode==="none")return null;if(e.mode==="pool"){if(!e.proxyId)throw new Error(r("请先选择已保存的代理"));return{source:"pool",proxyId:e.proxyId}}if(e.mode==="rotate"){if(e.rotateAll)return{source:"rotate",all:!0};if(!e.rotateIds.length)throw new Error(r("轮询至少要选择一条代理(或改选「全部」)"));return{source:"rotate",all:!1,proxyIds:[...e.rotateIds]}}if(e.mode==="clash"){if(!e.listenerUid)throw new Error(r("请先选择 Clash Verge 出口"));return{source:"clash",listenerUid:e.listenerUid}}const t=e.host.trim(),a=Number(e.port);if(!t)throw new Error(r("请填写代理主机地址"));if(!Number.isInteger(a)||a<1||a>65535)throw new Error(r("代理端口必须是 1-65535 的整数"));return{source:"custom",protocol:e.protocol==="socks5"?"socks5":"http",host:t,port:a,username:e.username.trim(),password:e.password}}function TR(e){const t=e.profileActive===!1?r("(其他订阅,可能未生效)"):"",a=e.enabled===!1?r("(已在 Clash 中禁用)"):"";return`${e.name} :${e.port}${t}${a}`}function ER({draft:e,onChange:t,idPrefix:a,allowRotate:o=!1}){const d=Ws().clash,f=Array.isArray(d?.options)?d.options:[],p=e.mode==="clash",[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(null),[S,N]=x.useState(""),k=A=>t({...e,...A});x.useEffect(()=>{p&&aR().catch(()=>{})},[p]);const T=x.useCallback((A=!1)=>{N(""),lR({force:A}).then(R=>j(R)).catch(R=>{j([]),N(ut(R))})},[]);x.useEffect(()=>{(e.mode==="pool"||e.mode==="rotate")&&w===null&&T()},[e.mode,w,T]);function D(){return e.rotateAll?(w??[]).filter(A=>A.enabled!==!1).map(A=>A.id):[...e.rotateIds]}async function C(){if(h)return;if(e.mode==="rotate"){const R=D();if(!R.length){Le(r("轮询至少要选择一条代理(或改选「全部」)"),"err");return}const I=R.slice(0,kR);b(!0),v(r("正在连接上游…"));let P=0;const O=[];for(const H of I){const B=w?.find(z=>z.id===H)?.name||H;try{const z=await Pe().workbuddyDesktop?.testProxyPoolItem?.(H);z?.success?P+=1:O.push(`${B}(${z?.error||r("连接失败")})`)}catch(z){O.push(`${B}(${ut(z)})`)}}const _=R.length-I.length,L=r("✅ {ok}/{total} 个出口可用",{ok:P,total:I.length})+(_>0?r("(只测了前 {limit} 个,还有 {rest} 个未测)",{limit:kR,rest:_}):"");v(s.jsxs("span",{className:O.length?"text-destructive":"text-success",children:[L,O.length?` ${Qa(O.join(r(";")))}`:""]})),b(!1);return}if(e.mode==="pool"){if(!e.proxyId){Le(r("请先选择已保存的代理"),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxyPoolItem?.(e.proxyId);v(R?.success?s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]}):s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}return}let A;try{A=jw(e)}catch(R){Le(ut(R),"err");return}b(!0),v(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxy?.({proxy:A});R?.success?v(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.status!==void 0&&R.status!==""?` HTTP ${Qa(String(R.status))}`:"",R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]})):v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){v(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{b(!1)}}return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(Eh,{value:e.mode,onValueChange:A=>k({mode:A}),className:"flex-row flex-wrap items-center gap-5","aria-label":r("代理方式"),children:[s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"none"}),r("无代理(直连)")]}),s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"pool"}),r("已保存的代理")]}),o?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",title:r("逐请求轮换出口(换 IP):OpenCode Zen 免费档按 IP 限流,单个 IP 的额度用完会对它一律 429"),children:[s.jsx(bo,{value:"rotate"}),r("轮询(换 IP)")]}):null,p?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"clash"}),"Clash Verge"]}):null,s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:"custom"}),r("自定义")]})]}),e.mode==="pool"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-pool-exit`,children:r("代理")}),s.jsxs(ft,{value:e.proxyId,disabled:!w?.length,onValueChange:A=>k({proxyId:String(A)}),children:[s.jsx(mt,{id:`${a}-pool-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:w?.find(A=>A.id===e.proxyId)?au(w.find(A=>A.id===e.proxyId)):w===null?r("正在读取…"):w.length?r("请选择代理"):r("还没有保存的代理")})}),s.jsx(ht,{children:(w??[]).map(A=>s.jsx(qe,{value:A.id,children:au(A)},A.id))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("地址与端口由「网络代理」页管理:那边改一次、测一次,所有引用它的账号一起生效"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="rotate"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[s.jsx(Mr,{id:`${a}-rotate-all`,checked:e.rotateAll,"aria-label":r("轮询全部代理节点"),onCheckedChange:A=>k({rotateAll:A===!0})}),s.jsx("label",{htmlFor:`${a}-rotate-all`,className:"cursor-pointer text-xs text-subtle",children:r("全部代理节点(推荐)")}),s.jsx("span",{className:"detail",children:r("「网络代理」页里每个启用的出口轮流使用;之后新加的出口自动加入")})]}),e.rotateAll?null:s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-rotate-exits`,children:r("轮询的代理")}),s.jsx(Bh,{id:`${a}-rotate-exits`,value:e.rotateIds,onValueChange:A=>k({rotateIds:A.map(String)}),options:(w??[]).map(A=>({value:A.id,label:au(A)})),placeholder:r("选择要轮询的代理(可多选)"),"aria-label":r("轮询的代理")}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:S?r("读取失败:{error}",{error:S}):w===null?r("正在读取代理列表…"):w.length?r("每条请求换一个出口(按顺序轮流),上游看到的 IP 因此是变化的;出口的地址与端口由「网络代理」页管理"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="clash"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-clash-exit`,children:r("出口")}),s.jsxs(ft,{value:e.listenerUid,disabled:!f.length,onValueChange:A=>k({listenerUid:String(A)}),children:[s.jsx(mt,{id:`${a}-clash-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:f.find(A=>String(A.uid)===e.listenerUid)?TR(f.find(A=>String(A.uid)===e.listenerUid)):d?.available===!1?r("未检测到 Clash Verge"):f.length?r("请选择出口"):r("没有可用出口")})}),s.jsx(ht,{children:f.map(A=>s.jsx(qe,{value:String(A.uid),children:TR(A)},String(A.uid)))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{aR({force:!0}).then(()=>Le(r("✅ 已重新读取 Clash Verge 配置"))).catch(A=>Le(r("读取失败:{error}",{error:ut(A)}),"err"))},children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:d===null?r("正在读取 Clash Verge 配置…"):d.available===!1?d.error?r("不可用:{error}",{error:d.error}):r("未检测到 Clash Verge 配置"):f.length?r("读取自 {dir};端口由 Clash Verge 管理,这里实时同步",{dir:d.dir||"Clash Verge"}):r("Clash Verge 里还没有配置混合监听器或节点端口")}),s.jsxs("p",{className:"detail mt-1.5",children:[r("这是既有配置(直接引用 Clash 出口,不经过代理池)。推荐改用上面的"),s.jsx("b",{children:r("「已保存的代理」")}),r(":到「网络代理」页点「同步 Clash Verge」把出口导进池后即可选 —— 那样能集中测试、也能被多个账号共用。")]})]}):null,e.mode==="custom"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-protocol`,children:r("协议")}),s.jsxs(ft,{value:e.protocol,onValueChange:A=>k({protocol:A}),children:[s.jsx(mt,{id:`${a}-protocol`,className:"min-w-[110px]",children:s.jsx(pt,{children:e.protocol==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]}),s.jsx("label",{htmlFor:`${a}-host`,className:"ml-2",children:r("主机")}),s.jsx($e,{id:`${a}-host`,className:"min-w-[140px]",placeholder:"127.0.0.1",value:e.host,onChange:A=>k({host:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-port`,children:r("端口")}),s.jsx($e,{id:`${a}-port`,type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:e.port,onChange:A=>k({port:A.currentTarget.value})})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-user`,children:r("用户名")}),s.jsx($e,{id:`${a}-user`,placeholder:r("可选"),autoComplete:"off",value:e.username,onChange:A=>k({username:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-pass`,children:r("密码")}),s.jsx($e,{id:`${a}-pass`,type:"password",placeholder:r("可选"),autoComplete:"new-password",value:e.password,onChange:A=>k({password:A.currentTarget.value})})]})]}):null,s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{C()},children:r(h?"测试中…":"测试出口")}),s.jsx("span",{className:"detail",children:y})]})]})}function c8({plan:e,hasJwt:t,onChange:a}){const o=JF(e),[c,d]=x.useState(null);return x.useEffect(()=>{if(e!==wo)return()=>{};let f=!0;const p=()=>{Promise.resolve(Pe().workbuddyDesktop?.zcodeCaptchaStats?.()).then(b=>{f&&b&&d({ready:Number(b.ready)||0,target:Number(b.target)||0})}).catch(()=>{})};p();const h=window.setInterval(p,5e3);return()=>{f=!1,window.clearInterval(h)}},[e]),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-plan-channel",children:r("使用套餐")}),s.jsxs(ft,{value:e,onValueChange:f=>a(String(f)),children:[s.jsx(mt,{id:"account-plan-channel",className:"min-w-[220px]",children:s.jsx(pt,{children:o})}),s.jsxs(ht,{children:[s.jsx(qe,{value:PA,children:r("编码套餐(Coding Plan)— 走开放平台端点,用自己订阅的额度")}),s.jsx(qe,{value:wo,children:r("活动套餐(Start Plan)— 走官方活动端点,用活动里领到的额度")})]})]}),e===wo&&!t?s.jsx("span",{className:"detail text-destructive",children:r("该账号没有套餐登录态(jwt),活动套餐会失败:请重新登录该账号")}):null,e===wo?s.jsxs("span",{className:"detail",title:r("活动套餐的推理端点要求每条请求带一个阿里云验证码令牌;令牌由本应用在后台静默铸造,界面关闭时无法铸造"),children:[r("验证码令牌:{counts}",{counts:c?`${c.ready} / ${c.target||3}`:r("读取中…")}),c&&c.ready===0?r("(库存为空,正在补;补不上时转发会失败)"):""]}):null]})}function u8({configured:e,value:t,onChange:a,onClear:o,clearBusy:c}){return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-balance-token-input",children:r("余额查询凭证")}),s.jsx($e,{id:"account-balance-token-input",className:"min-w-[220px]",placeholder:r(e?"已配置,留空则不修改":"一般不用填"),title:r("积分查询已复用转发用的登录凭证,这里通常留空即可。只有旧版本填过、或从旧代理导入过凭证时才有值"),value:t,onChange:d=>a(d.currentTarget.value)}),e?s.jsx(se,{variant:"outline",size:"sm",disabled:c,onClick:o,title:r("清除已配置的余额查询凭证"),children:r("清除")}):null]})}function d8({hasApiKey:e,noAuth:t,value:a,onValue:o,onToggleNoAuth:c,onClear:d,clearBusy:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-api-key-input",children:r("API Key")}),s.jsx($e,{id:"account-api-key-input",type:"password",autoComplete:"new-password",className:"min-w-[220px]",disabled:t,placeholder:e?r("已配置,留空则不修改"):"sk-…",title:r("上游的 API Key。留空 = 不修改(改凭证不会换账号 id);要清掉已配的凭证用右边的「清除」"),value:a,onChange:p=>o(p.currentTarget.value)}),e&&!t?s.jsx(se,{variant:"outline",size:"sm",disabled:f,onClick:d,title:r("清除已配置的 API Key(转发时会因缺少凭证被跳过)"),children:r("清除")}):null]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:t,"aria-label":r("该上游无需鉴权"),onCheckedChange:p=>c(p===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(转发与拉取模型都不发送鉴权头)")})]})}),s.jsxs("p",{className:"detail",children:[r("上游本来不要凭证时(本地 Ollama、OpenCode Zen 的免费档)勾上这一项:账号会被正常选路;只把 Key 留空"),s.jsx("strong",{children:r("又不勾")}),r("会被当成「未配置凭证」而跳过。")]})]})}function f8({provider:e,name:t,protocol:a,baseUrl:o,count:c,emulation:d,onName:f,onProtocol:p,onBaseUrl:h,onEmulation:b,onRemove:y}){const v=Pe().wbProviders?.PROTOCOL_OPTIONS||[{value:"openai",label:r("OpenAI 兼容")},{value:"anthropic",label:"Anthropic"}],w=v.find(j=>j.value===a)?.label||a;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("提供商")}),s.jsxs("p",{children:[r("这一栏改的是"),s.jsx("strong",{children:r("「{name}」本身",{name:e.name||e.id})}),r("(名下 {count} 个账号共用)",{count:c}),r("改协议 / Base URL 会改变它们的转发方式,正在进行的请求可能失败;模型清单与映射在「模型管理」页。")]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-provider-name",children:r("名称")}),s.jsx($e,{id:"account-provider-name",maxLength:NR,className:"min-w-[220px]",placeholder:r("提供商显示名,1~{max} 个字符",{max:NR}),value:t,onChange:j=>f(j.currentTarget.value)})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-protocol",children:r("协议")}),s.jsxs(ft,{value:a,onValueChange:j=>p(String(j)),children:[s.jsx(mt,{id:"account-provider-protocol",className:"min-w-[180px]",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:v.map(j=>s.jsx(qe,{value:j.value,children:j.label},j.value))})]})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-baseurl",children:r("Base URL")}),s.jsx($e,{id:"account-provider-baseurl",className:"min-w-[260px]",placeholder:r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),value:o,onChange:j=>h(j.currentTarget.value)})]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Mr,{checked:d==="opencode","aria-label":r("伪装 OpenCode 官方客户端"),onCheckedChange:j=>b(j===!0?"opencode":"")}),s.jsx("span",{className:"text-xs text-subtle",children:r("伪装 OpenCode 官方客户端(OpenCode Zen 免费档要它才放行)")})]})}),s.jsxs("p",{className:"detail",children:[r("开启后,网关按 OpenCode 官方 CLI 的形状发请求:没填 Key 的账号用匿名凭证"),s.jsx("code",{children:"public"}),r("、补官方会话头、请求体补两个占位工具(上游免费档的三道校验)。"),s.jsx("strong",{children:r("它会改写请求体")}),r(",只对 OpenCode Zen 这类上游有意义,别的家请关掉。")]}),s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"destructive",onClick:y,children:r("删除提供商")}),s.jsx("span",{className:"detail",children:r("级联删除名下全部账号,不可恢复")})]})]})}function p8({id:e,onClose:t}){const a=Ea(e),[o,c]=x.useState(a?.enabled!==!1),[d,f]=x.useState(a?.name||""),[p,h]=x.useState(()=>CR(a?.proxy)),[b,y]=x.useState(""),[v,w]=x.useState(()=>uw(a)),[j,S]=x.useState(!1),[N,k]=x.useState(""),[T,D]=x.useState(null),[C,A]=x.useState(""),[R,I]=x.useState("chat_completions"),[P,O]=x.useState(""),[_,L]=x.useState(""),[H,B]=x.useState(""),[z,Q]=x.useState(a?.noAuth===!0),[K,X]=x.useState(()=>W$(a)),[q,$]=x.useState(()=>r8(a?.balanceQuery)),[Y,F]=x.useState(()=>X$(a)),[G,W]=x.useState("basic"),[le,M]=x.useState(()=>String(Number(a?.maxConcurrent)||0));if(x.useEffect(()=>{let he=!0;D(null);const ye=Ea(e);return ye?(Promise.resolve(Pe().wbCustomProvidersUi?.find?.(kn(ye))).then(je=>{!he||!je||(D(je),A(je.name||""),I(je.protocol||"chat_completions"),O(je.baseUrl||""),L(typeof je.clientEmulation=="string"?je.clientEmulation:""))}).catch(()=>{}),()=>{he=!1}):()=>{he=!1}},[e]),!a)return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置")})}),s.jsx(Bt,{children:s.jsx("p",{className:"detail",children:r("账号不存在,请刷新后重试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const U=a,Z=i8(U,El()),ae=kn(U)==="catpaw",ce=kn(U).startsWith("custom-"),J=wA(T,U.baseUrl)||p.mode==="rotate",ie=kf(U.balanceQuery?.scheme),ge={};for(const he of ie?.fields??[])ge[he.key]=n8(U.balanceQuery,he);const ee=!!(ie&&ie.fields.length)&&!s8(U.balanceQuery);async function fe(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceToken:null}),y(""),Le(r("✅ 已清除余额查询凭证")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function te(){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{apiKey:null}),B(""),Le(r("✅ 已清除 API Key(该账号现在没有凭证,转发会被跳过)")),await Pe().wbApp?.refresh?.()}catch(he){Le(r("清除失败:{error}",{error:ut(he)}),"err")}finally{S(!1)}}}async function Ce(he){if(!j){S(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceQuery:{[he]:null}}),$(ye=>({...ye,[he]:""})),Le(r("✅ 已清除查询凭证")),await Pe().wbApp?.refresh?.()}catch(ye){Le(r("清除失败:{error}",{error:ut(ye)}),"err")}finally{S(!1)}}}function re(){if(!ce)return null;const he=H.trim(),ye={};return he?ye.apiKey=he:z!==(U.noAuth===!0)&&(ye.noAuth=z),Object.keys(ye).length?ye:null}function de(){if(!T)return null;const he=C.trim(),ye=P.trim();if(!he)return{error:r("请填写提供商名称")};if(!ye)return{error:r("请填写提供商的 Base URL")};const je=typeof T.clientEmulation=="string"?T.clientEmulation:"";return T.name===he&&T.protocol===R&&T.baseUrl===ye&&je===_?null:{id:T.id,name:he,protocol:R,baseUrl:ye,clientEmulation:_}}async function ke(){if(j)return;let he;try{he=jw(p)}catch(Ct){Le(ut(Ct),"err");return}const ye=de();if(ye&&"error"in ye){k(s.jsx("span",{className:"text-destructive",children:ye.error}));return}const je=Ta(U)?J$(U,K):null;if(je&&"error"in je){k(s.jsx("span",{className:"text-destructive",children:je.error}));return}const xe=Y$(U,Y),Te=a8(U.balanceQuery?.scheme,q),Oe=re()||{},Ne=Number(le);if(!Number.isFinite(Ne)||Ne<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}const _e=Math.min(Rl,Math.round(Ne)),Ye=Number(U.maxConcurrent)||0,kt=_e!==Ye?{maxConcurrent:_e}:{};S(!0);try{const Ct=ae&&b.trim()?{balanceToken:b.trim()}:{},Rt=Gh(U)&&v!==uw(U)?{zcodePlan:v}:{};if(await Pe().workbuddyDesktop?.updateAccount?.(e,{name:d.trim()||U.name,enabled:o,proxy:he,...Ct,...Rt,...Oe,...kt,...Te?{balanceQuery:Te}:{},...je&&"patch"in je?je.patch:{},...xe&&"patch"in xe?xe.patch:{}}),ye)try{await Pe().wbCustomProvidersUi?.update?.(ye)}catch(ot){k(s.jsx("span",{className:"text-destructive",children:r("账号已保存,但提供商未更新:{error}",{error:ut(ot)})})),await Pe().wbApp?.refresh?.(),S(!1);return}t(),Le(r("✅ 账号设置已保存"));try{await Pe().wbApp?.refresh?.()}catch{}}catch(Ct){k(s.jsx("span",{className:"text-destructive",children:ut(Ct)})),Le(r("保存失败:{error}",{error:ut(Ct)}),"err")}finally{S(!1)}}const Ee=Number(ir(kn(U)).concurrencyDefault)||0,ve=ae||ce||Gh(U);return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||j||t()},children:s.jsxs(Zt,{className:"w-[min(900px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置 · {name}",{name:sg(a)})})}),s.jsx(Bt,{className:"p-0",children:s.jsxs("div",{className:"acct-dlg",children:[s.jsx("aside",{className:"prov-rail acct-dlg-rail","aria-label":r("账号设置分组"),children:s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("账号设置")}),[["basic",r("基本")],...ve?[["credential",r("凭证与套餐")]]:[],...Ta(U)?[["query",r("查询设置")],["limiter",r("限制器")]]:[],["network",r("网络")]].map(([he,ye])=>s.jsx(ru,{active:G===he,title:ye,className:"shadow-none",onClick:()=>W(he),children:ye},he))]})}),s.jsxs("div",{className:"acct-dlg-main",children:[G==="basic"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("基本")}),s.jsx("p",{children:r("这条账号是谁、排第几、能不能接请求。")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("启用")}),s.jsx(hs,{checked:o,onCheckedChange:c,"aria-label":r("启用该账号")}),s.jsx("span",{className:"detail",children:r("关闭则不参与转发(余额查询照常,见「查询设置」)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-name-input",children:r("备注名")}),s.jsx($e,{id:"account-name-input",maxLength:100,placeholder:r("账号显示名称"),className:"max-w-[280px]",value:d,onChange:he=>f(he.currentTarget.value)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("转发顺序")}),s.jsx("span",{className:"detail",children:r("在列表里拖:拖分组带调整整组顺位,拖行首把手调整组内先后(顺序由拖拽表达,不再填数字)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-conc-input",children:r("并发上限")}),s.jsx($e,{id:"account-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",value:le,onChange:he=>M(he.currentTarget.value)}),s.jsx("span",{className:"detail",children:Ee>0?r("0 = 按本家默认 {default}",{default:Ee}):r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:Ee>0?r("并发上限 受上游硬顶约束,达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)"):r("并发上限 0~{max};达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)",{max:Rl})})]}):null,G==="credential"&&ve?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("凭证与套餐")}),s.jsx("p",{children:r("这一段按提供商出现:有什么配什么。")})]}),ae?s.jsx(u8,{configured:a.hasBalanceToken===!0,value:b,onChange:y,clearBusy:j,onClear:()=>{fe()}}):null,ce?s.jsx(d8,{hasApiKey:U.hasApiKey===!0,noAuth:z,value:H,onValue:B,onToggleNoAuth:Q,onClear:()=>{te()},clearBusy:j}):null,Gh(U)?s.jsx(c8,{plan:v,hasJwt:a.canClaim===!0,onChange:w}):null,T?s.jsx(f8,{provider:T,count:Z.length+1,name:C,protocol:R,baseUrl:P,emulation:_,onName:A,onProtocol:I,onBaseUrl:O,onEmulation:L,onRemove:()=>{j||Promise.resolve(Pe().wbCustomProvidersUi?.remove?.(T.id)).then(he=>{he&&t()})}}):null]}):null,G==="query"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("查询设置")}),s.jsx("p",{children:r("余额列读数的自动刷新;也是「限制器」余额规则的数据来源。")})]}),ie?s.jsx(o8,{spec:ie,values:q,configured:ge,onValue:(he,ye)=>$(je=>({...je,[he]:ye})),onClear:he=>{Ce(he)},clearBusy:j,idPrefix:"account-balance-query"}):null,ee?s.jsx("p",{className:"detail mt-2.5 text-subtle",children:r("查询凭证还没配齐:填好后余额列才有读数,在此之前会显示「未配置」。")}):null,s.jsx(e8,{account:U,draft:K,onChange:X})]}):null,G==="limiter"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("限制器")}),s.jsx("p",{children:r("按规则限制该账号参与转发:没有规则(或全部停用)= 不限制;跳过档自动恢复,禁用档需手动启用。")})]}),s.jsx(K$,{account:U,draft:Y,onChange:F})]}):null,G==="network"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("网络")}),s.jsx("p",{children:r("这条账号访问上游走哪条线路。")})]}),s.jsx(ER,{draft:p,onChange:h,idPrefix:"account-proxy",allowRotate:J}),a.proxy?.error?s.jsx("p",{className:"detail text-destructive",children:r("当前代理不可用:{error}(转发时会回退直连)",{error:a.proxy.error})}):null]}):null]})]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"detail mr-auto",style:{minHeight:18},children:N}),s.jsx(se,{variant:"outline",disabled:j,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{ke()},children:r(j?"保存中…":"保存")})]})]})})}const m8=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"proxy",label:r("修改代理")},{value:"concurrency",label:r("设置并发上限")},{value:"remove",label:r("删除")}];function h8({ids:e,action:t,onClose:a}){const[o,c]=x.useState(t),[d,f]=x.useState(()=>CR(null)),[p,h]=x.useState(""),[b,y]=x.useState(!1),[v,w]=x.useState(""),j=e.map(C=>Ea(C)).filter(C=>C!==null),S=j.reduce((C,A)=>Math.max(C,Number(ir(kn(A)).concurrencyDefault)||0),0),N=j.length>0&&j.every(C=>VF(C));function k(C){return Promise.resolve(Pe().wbConfirm?.ask?.({title:r("删除选中的账号"),html:r("确定删除选中的 {count} 个账号?此操作不可恢复,账号的登录态会一并移除。",{count:C}),okText:r("删除"),okClass:"danger"})??!1)}async function T(){if(b)return;if(!e.length){Le(r("没有选中的账号"),"err");return}let C;if(o==="proxy")try{C=jw(d)}catch(R){Le(ut(R),"err");return}let A;if(o==="concurrency"){const R=Number(p.trim());if(!p.trim()||!Number.isFinite(R)||R<0){Le(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}A=Math.min(Rl,Math.round(R))}if(!(o==="remove"&&!await k(e.length))){if(o==="disable"||o==="remove"){const R=new Set(e);if(!El().filter(P=>P.enabled!==!1&&!R.has(P.id)).length){const P=r(o==="remove"?"删除":"禁用");if(!await Promise.resolve(Pe().wbConfirm?.ask?.({title:r("全部启用中的账号将被{what}",{what:P}),html:r("这会{what}所有启用中的账号,转发将不可用。确定继续?",{what:P}),okText:P,okClass:o==="remove"?"danger":"primary"})??!1))return}}y(!0),w("");try{const R={action:o,ids:e};o==="proxy"&&(R.proxy=C),o==="concurrency"&&(R.maxConcurrent=A);const I=await Pe().workbuddyDesktop?.batchAccounts?.(R),P=(I?.ok||[]).filter(B=>B.changes?.length).length,O=(I?.removed||[]).length,_=I?.failed||[],L=o==="remove"?O:P,H={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;if(_.length){const B=_.slice(0,3).map(z=>sg(Ea(String(z.id)))||z.id).join(r("、"));Le(r("{verb}完成:成功 {ok} 个,失败 {fail} 个({detail}{more})",{verb:H,ok:L,fail:_.length,detail:B,more:_.length>3?r(" 等"):""}),"err"),w(s.jsxs("span",{className:"text-destructive",children:[r("失败 {count} 个:",{count:_.length}),_.map(z=>`${sg(Ea(String(z.id)))||z.id}(${z.error})`).join(r(";"))]}))}else Le(r("✅ {verb}完成:共 {count} 个账号",{verb:H,count:L})),a();await Pe().wbApp?.refresh?.()}catch(R){w(s.jsx("span",{className:"text-destructive",children:ut(R)})),Le(r("批量操作失败:{error}",{error:ut(R)}),"err")}finally{y(!1)}}}const D={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||b||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {count} 个账号",{count:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下账号")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:j.map(C=>sg(C)).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:c,className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:m8.map(C=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:C.value}),C.label]},C.value))}),o==="proxy"?s.jsx("div",{className:"mt-2.5",children:s.jsx(ER,{draft:d,onChange:f,idPrefix:"batch-proxy",allowRotate:N})}):null,o==="concurrency"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-conc-input",children:r("并发上限")}),s.jsx($e,{id:"batch-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",placeholder:r("不限"),value:p,onChange:C=>h(C.currentTarget.value)}),s.jsx("span",{className:"detail",children:r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:S>0?r("并发上限 0~{max};有上游硬顶的家(如 CodeArts)以它的硬顶为准;达到上限的账号会被跳过、请求转给其他账号",{max:Rl}):r("并发上限 0~{max};达到上限的账号会被跳过、请求转给其他账号",{max:Rl})})]}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:b,onClick:a,children:r("取消")}),s.jsx(se,{variant:o==="remove"?"destructive":"default",disabled:b,onClick:()=>{T()},children:b?r("执行中…"):r("执行({action})",{action:D})})]})]})})}function g8(){const e=Ws();return e.dialog?e.dialog.kind==="settings"?s.jsx(p8,{id:e.dialog.id,onClose:eg},e.dialog.id):s.jsx(h8,{ids:e.dialog.ids,action:e.dialog.action,onClose:eg},e.dialog.ids.join(",")):null}var Sw={exports:{}},Cf={},Nw={exports:{}},kw={};var AR;function x8(){return AR||(AR=1,(function(e){function t(X,q){var $=X.length;X.push(q);e:for(;0<$;){var Y=$-1>>>1,F=X[Y];if(0>>1;Yc(le,$))Mc(U,le)?(X[Y]=U,X[M]=$,Y=M):(X[Y]=le,X[W]=$,Y=W);else if(Mc(U,$))X[Y]=U,X[M]=$,Y=M;else break e}}return q}function c(X,q){var $=X.sortIndex-q.sortIndex;return $!==0?$:X.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();e.unstable_now=function(){return f.now()-p}}var h=[],b=[],y=1,v=null,w=3,j=!1,S=!1,N=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function A(X){for(var q=a(b);q!==null;){if(q.callback===null)o(b);else if(q.startTime<=X)o(b),q.sortIndex=q.expirationTime,t(h,q);else break;q=a(b)}}function R(X){if(N=!1,A(X),!S)if(a(h)!==null)S=!0,I||(I=!0,B());else{var q=a(b);q!==null&&K(R,q.startTime-X)}}var I=!1,P=-1,O=5,_=-1;function L(){return k?!0:!(e.unstable_now()-_X&&L());){var Y=v.callback;if(typeof Y=="function"){v.callback=null,w=v.priorityLevel;var F=Y(v.expirationTime<=X);if(X=e.unstable_now(),typeof F=="function"){v.callback=F,A(X),q=!0;break t}v===a(h)&&o(h),A(X)}else o(h);v=a(h)}if(v!==null)q=!0;else{var G=a(b);G!==null&&K(R,G.startTime-X),q=!1}}break e}finally{v=null,w=$,j=!1}q=void 0}}finally{q?B():I=!1}}}var B;if(typeof C=="function")B=function(){C(H)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,Q=z.port2;z.port1.onmessage=H,B=function(){Q.postMessage(null)}}else B=function(){T(H,0)};function K(X,q){P=T(function(){X(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_forceFrameRate=function(X){0>X||125Y?(X.sortIndex=$,t(b,X),a(h)===null&&X===a(b)&&(N?(D(P),P=-1):N=!0,K(R,$-Y))):(X.sortIndex=F,t(h,X),S||j||(S=!0,I||(I=!0,B()))),X},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(X){var q=w;return function(){var $=w;w=q;try{return X.apply(this,arguments)}finally{w=$}}}})(kw)),kw}var RR;function b8(){return RR||(RR=1,Nw.exports=x8()),Nw.exports}var OR;function v8(){if(OR)return Cf;OR=1;var e=b8(),t=Vd(),a=S1();function o(n){var l="https://react.dev/errors/"+n;if(1Ce||(n.current=te[Ce],te[Ce]=null,Ce--)}function ke(n,l){Ce++,te[Ce]=n.current,n.current=l}var Ee=re(null),ve=re(null),he=re(null),ye=re(null);function je(n,l){switch(ke(he,l),ke(ve,n),ke(Ee,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?q3(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=q3(l),n=G3(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}de(Ee),ke(Ee,n)}function xe(){de(Ee),de(ve),de(he)}function Te(n){var l=n.memoizedState;l!==null&&(zd._currentValue=l.memoizedState,ke(ye,n)),l=Ee.current;var i=G3(l,n.type);l!==i&&(ke(ve,n),ke(Ee,i))}function Oe(n){ve.current===n&&(de(Ee),de(ve)),ye.current===n&&(de(ye),zd._currentValue=fe)}var Ne,_e;function Ye(n){if(Ne===void 0)try{throw Error()}catch(i){var l=i.stack.trim().match(/\n( *(at )?)/);Ne=l&&l[1]||"",_e=-1gl in xi?_se(xi,gl,{enumerable:!0,configurable:!0,writable:!0,value:no}):xi[gl]=no;var ln=(xi,gl,no)=>Lse(xi,typeof gl!="symbol"?gl+"":gl,no);(function(){"use strict";function xi(e,t){for(var a=0;ao[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var no={exports:{}},Ud={};var oC;function L5(){if(oC)return Ud;oC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:e,type:o,key:f,ref:c!==void 0?c:null,props:d}}return Ud.Fragment=t,Ud.jsx=a,Ud.jsxs=a,Ud}var iC;function z5(){return iC||(iC=1,no.exports=L5()),no.exports}var s=z5(),wv={exports:{}},ct={};var cC;function B5(){if(cC)return ct;cC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),j=Symbol.for("react.view_transition"),w=Symbol.iterator;function k(M){return M===null||typeof M!="object"?null:(M=w&&M[w]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,T={};function D(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||S}D.prototype.isReactComponent={},D.prototype.setState=function(M,U){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,U,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=D.prototype;function A(M,U,Z){this.props=M,this.context=U,this.refs=T,this.updater=Z||S}var R=A.prototype=new C;R.constructor=A,N(R,D.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},_=Object.prototype.hasOwnProperty;function L(M,U,Z){var ae=Z.ref;return{$$typeof:e,type:M,key:U,ref:ae!==void 0?ae:null,props:Z}}function H(M,U){return L(M.type,U,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function z(M){var U={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Z){return U[Z]})}var Q=/\/+/g;function K(M,U){return typeof M=="object"&&M!==null&&M.key!=null?z(""+M.key):U.toString(36)}function X(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(P,P):(M.status="pending",M.then(function(U){M.status==="pending"&&(M.status="fulfilled",M.value=U)},function(U){M.status==="pending"&&(M.status="rejected",M.reason=U)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function q(M,U,Z,ae,ce){var J=typeof M;(J==="undefined"||J==="boolean")&&(M=null);var ie=!1;if(M===null)ie=!0;else switch(J){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(M.$$typeof){case e:case t:ie=!0;break;case y:return ie=M._init,q(ie(M._payload),U,Z,ae,ce)}}if(ie)return ce=ce(M),ie=ae===""?"."+K(M,0):ae,I(ce)?(Z="",ie!=null&&(Z=ie.replace(Q,"$&/")+"/"),q(ce,U,Z,"",function(fe){return fe})):ce!=null&&(B(ce)&&(ce=H(ce,Z+(ce.key==null||M&&M.key===ce.key?"":(""+ce.key).replace(Q,"$&/")+"/")+ie)),U.push(ce)),1;ie=0;var ge=ae===""?".":ae+":";if(I(M))for(var ee=0;ee"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Fd(e){const{overflow:t,overflowX:a,overflowY:o,display:c}=br(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&c!=="inline"&&c!=="contents"}function U5(e){return/^(table|td|th)$/.test(Hs(e))}function Im(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const V5=/transform|translate|scale|rotate|perspective|filter/,F5=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Nv;function kv(e){const t=At(e)?br(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Cv()&&(bi(t.backdropFilter)||bi(t.filter))||V5.test(t.willChange||"")||F5.test(t.contain||"")}function $5(e){let t=ro(e);for(;dn(t)&&!so(t);){if(kv(t))return t;if(Im(t))return null;t=ro(t)}return null}function Cv(){return Nv==null&&(Nv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nv}function so(e){return/^(html|body|#document)$/.test(Hs(e))}function br(e){return Sn(e).getComputedStyle(e)}function Pm(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ro(e){if(Hs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hc(e)&&e.host||xl(e);return Hc(t)?t.host:t}function dC(e){const t=ro(e);return so(t)?(e.ownerDocument||e).body:dn(t)&&Fd(t)?t:dC(t)}function Uc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const c=dC(e),d=c===((o=e.ownerDocument)==null?void 0:o.body),f=Sn(c);if(d){const p=Tv(f);return t.concat(f,f.visualViewport||[],Fd(c)?c:[],p&&a?Uc(p):[])}else return t.concat(c,Uc(c,[],a))}function Tv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ev={...H5},fC={};function Ds(e,t){const a=x.useRef(fC);return a.current===fC&&(a.current=e(t)),a}const Av=Ev.useInsertionEffect,q5=Av&&Av!==Ev.useLayoutEffect?Av:e=>e();function Ie(e){const t=Ds(G5).current;return t.next=e,q5(t.effect),t.trampoline}function G5(){const e={next:void 0,callback:K5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function K5(){}const De=typeof document<"u"?x.useLayoutEffect:()=>{};function Rv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const Ov={};function Wr(e,t,a,o,c){if(!a&&!o&&!c&&!e)return _m(t);let d=_m(e);return t&&(d=$d(d,t)),a&&(d=$d(d,a)),o&&(d=$d(d,o)),c&&(d=$d(d,c)),d}function Y5(e){if(e.length===0)return Ov;if(e.length===1)return _m(e[0]);let t=_m(e[0]);for(let a=1;a=65&&c<=90&&(typeof t=="function"||typeof t>"u")}function Mv(e){return typeof e=="function"}function mC(e,t){return Mv(e)?e(t):e??Ov}function Z5(e,t){return t?e?(...a)=>{const o=a[0];if(xC(o)){const d=o;Lm(d);const f=t(...a);return d.baseUIHandlerPrevented||e?.(...a),f}const c=t(...a);return e?.(...a),c}:hC(t):e}function hC(e){return e&&((...t)=>{const a=t[0];return xC(a)&&Lm(a),e(...t)})}function Lm(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gC(e,t){return t?e?t+" "+e:t:e}function xC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function W5(e,t){return function(o,...c){const d=new URL(e);return d.searchParams.set("code",o.toString()),c.forEach(f=>d.searchParams.append("args[]",f)),`${t} error #${o}; visit ${d} for the full message.`}}const on=W5("https://base-ui.com/production-error","Base UI"),bC=x.createContext(void 0);function vC(e=!1){const t=x.useContext(bC);if(t===void 0&&!e)throw new Error(on(16));return t}function J5(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:c=0,isNativeButton:d}=e,f=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const v={onKeyDown(y){a&&t&&y.key!=="Tab"&&y.preventDefault()}};return o||(v.tabIndex=c,!d&&a&&(v.tabIndex=t?c:-1)),(d&&(t||f)||!d&&a)&&(v["aria-disabled"]=a),d&&(!t||p)&&(v.disabled=a),v},[o,a,t,f,p,d,c])}}function $t(e){return e?.ownerDocument||document}function Vc(e,t,{detail:a=0}={}){e.dispatchEvent(new(Sn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Jr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:c=!0,composite:d}=e,f=x.useRef(null),p=vC(!0),h=d??p!==void 0,{props:v}=J5({focusableWhenDisabled:a,disabled:t,composite:h,tabIndex:o,isNativeButton:c}),y=x.useCallback(()=>{const w=f.current;Dv(w)&&h&&t&&v.disabled===void 0&&w.disabled&&(w.disabled=!1)},[t,v.disabled,h]);De(y,[y]);const b=x.useCallback((w={})=>{const{onClick:k,onMouseDown:S,onKeyUp:N,onKeyDown:T,onPointerDown:D,...C}=w;return Wr({onClick(A){if(t){A.preventDefault();return}k?.(A)},onMouseDown(A){t||S?.(A)},onKeyDown(A){if(t||(Lm(A),T?.(A),A.baseUIHandlerPrevented))return;const R=A.target===A.currentTarget,I=A.currentTarget,P=Dv(I),O=!c&&ez(I),_=R&&(c?P:!O),L=A.key==="Enter",H=A.key===" ",B=I.getAttribute("role"),z=B?.startsWith("menuitem")||B==="option"||B==="gridcell";if(R&&h&&H){if(A.defaultPrevented&&z)return;A.preventDefault(),(!c||P)&&(A.preventBaseUIHandler(),Vc(I,A));return}if(!_||c||!H&&!L){R&&O&&H&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),L&&(A.preventBaseUIHandler(),Vc(I,A)))},onKeyUp(A){if(!t){if(Lm(A),N?.(A),A.target===A.currentTarget&&c&&h&&Dv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!c&&!h&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Vc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}D?.(A)}},c?{type:"button"}:{role:"button"},v,C)},[t,v,h,c]),j=Ie(w=>{f.current=w,y()});return{getButtonProps:b,buttonRef:j}}function Dv(e){return dn(e)&&e.tagName==="BUTTON"}function ez(e){return dn(e)&&e.tagName==="A"&&!!e.href}function ea(e,t,a,o){const c=Ds(yC).current;return nz(c,e,t,a,o)&&jC(c,[e,t,a,o]),c.callback}function tz(e){const t=Ds(yC).current;return sz(t,e)&&jC(t,e),t.callback}function yC(){return{callback:null,cleanup:null,refs:[]}}function nz(e,t,a,o,c){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==c}function sz(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function jC(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let c=0;c{for(let c=0;c=e}function wC(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Iv(19)?a?.ref:t.ref)??null}function qt(){}const Mr=Object.freeze([]),fn=Object.freeze({});function az(e,t){const a={};for(const o in e){const c=e[o];if(t?.hasOwnProperty(o)){const d=t[o](c);d!=null&&Object.assign(a,d);continue}c===!0?a[`data-${o.toLowerCase()}`]="":c&&(a[`data-${o.toLowerCase()}`]=c.toString())}return a}function lz(e,t){return typeof e=="function"?e(t):e}function oz(e,t){return typeof e=="function"?e(t):e}function yt(e,t,a={}){let o=t.render;a.enabled!==!1&&(o=dz(o));const c=iz(t,a,o);if(a.enabled===!1)return null;const d=a.state??fn;return fz(e,o,c,d)}function iz(e,t,a){const{className:o,style:c}=e,{state:d=fn,ref:f,props:p,stateAttributesMapping:h,enabled:v=!0}=t,y=v?lz(o,d):void 0,b=v?oz(c,d):void 0,j=v?az(d,h):fn,w=v&&p?cz(p):void 0,k=v?Rv(j,w)??{}:fn;return typeof document<"u"&&(v?Array.isArray(f)?k.ref=tz([k.ref,wC(a),...f]):k.ref=ea(k.ref,wC(a),f):ea(null,null)),v?(y!==void 0&&(k.className=gC(k.className,y)),b!==void 0&&(k.style=Rv(k.style,b)),k):fn}function cz(e){return Array.isArray(e)?Y5(e):Wr(void 0,e)}const uz=Symbol.for("react.lazy");function dz(e){if(e?.$$typeof!==uz)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function fz(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const c=Wr(a,t.props);return c.ref=a.ref,x.cloneElement(t,c)}if(e&&typeof e=="string")return pz(e,a);throw new Error(on(8))}function pz(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const mz=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,focusableWhenDisabled:f=!1,nativeButton:p=!0,style:h,...v}=t,{getButtonProps:y,buttonRef:b}=Jr({disabled:d,focusableWhenDisabled:f,native:p});return yt("button",t,{state:{disabled:d},ref:[a,b],props:[v,y]})});function SC(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,CC=NC,Fc=(e,t)=>a=>{var o;if(t?.variants==null)return CC(e,a?.class,a?.className);const{variants:c,defaultVariants:d}=t,f=Object.keys(c).map(v=>{const y=a?.[v],b=d?.[v];if(y===null)return null;const j=kC(y)||kC(b);return c[v][j]}),p=a&&Object.entries(a).reduce((v,y)=>{let[b,j]=y;return j===void 0||(v[b]=j),v},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((v,y)=>{let{class:b,className:j,...w}=y;return Object.entries(w).every(k=>{let[S,N]=k;return Array.isArray(N)?N.includes({...d,...p}[S]):{...d,...p}[S]===N})?[...v,b,j]:v},[]);return CC(e,f,h,a?.class,a?.className)},hz=(e,t)=>{const a=new Array(e.length+t.length);for(let o=0;o({classGroupId:e,validator:t}),TC=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a}),zm="-",EC=[],xz="arbitrary..",bz=e=>{const t=yz(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return vz(f);const p=f.split(zm),h=p[0]===""&&p.length>1?1:0;return AC(p,h,t)},getConflictingClassGroupIds:(f,p)=>{if(p){const h=o[f],v=a[f];return h?v?hz(v,h):h:v||EC}return a[f]||EC}}},AC=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;const c=e[t],d=a.nextPart.get(c);if(d){const v=AC(e,t+1,d);if(v)return v}const f=a.validators;if(f===null)return;const p=t===0?e.join(zm):e.slice(t).join(zm),h=f.length;for(let v=0;ve.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),a=t.indexOf(":"),o=t.slice(0,a);return o?xz+o:void 0})(),yz=e=>{const{theme:t,classGroups:a}=e;return jz(a,t)},jz=(e,t)=>{const a=TC();for(const o in e){const c=e[o];Pv(c,a,o,t)}return a},Pv=(e,t,a,o)=>{const c=e.length;for(let d=0;d{if(typeof e=="string"){Sz(e,t,a);return}if(typeof e=="function"){Nz(e,t,a,o);return}kz(e,t,a,o)},Sz=(e,t,a)=>{const o=e===""?t:RC(t,e);o.classGroupId=a},Nz=(e,t,a,o)=>{if(Cz(e)){Pv(e(o),t,a,o);return}t.validators===null&&(t.validators=[]),t.validators.push(gz(a,e))},kz=(e,t,a,o)=>{const c=Object.entries(e),d=c.length;for(let f=0;f{let a=e;const o=t.split(zm),c=o.length;for(let d=0;d"isThemeGetter"in e&&e.isThemeGetter===!0,Tz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),o=Object.create(null);const c=(d,f)=>{a[d]=f,t++,t>e&&(t=0,o=a,a=Object.create(null))};return{get(d){let f=a[d];if(f!==void 0)return f;if((f=o[d])!==void 0)return c(d,f),f},set(d,f){d in a?a[d]=f:c(d,f)}}},_v="!",OC=":",Ez=[],MC=(e,t,a,o,c)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:o,isExternal:c}),Az=e=>{const{prefix:t,experimentalParseClassName:a}=e;let o=c=>{const d=[];let f=0,p=0,h=0,v;const y=c.length;for(let S=0;Sh?v-h:void 0;return MC(d,w,j,k)};if(t){const c=t+OC,d=o;o=f=>f.startsWith(c)?d(f.slice(c.length)):MC(Ez,!1,f,void 0,!0)}if(a){const c=o;o=d=>a({className:d,parseClassName:c})}return o},Rz=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((a,o)=>{t.set(a,1e6+o)}),a=>{const o=[];let c=[];for(let d=0;d0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Oz=e=>({cache:Tz(e.cacheSize),parseClassName:Az(e),sortModifiers:Rz(e),postfixLookupClassGroupIds:Mz(e),...bz(e)}),Mz=e=>{const t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let o=0;o{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:f}=t,p=[],h=e.trim().split(Dz);let v="";for(let y=h.length-1;y>=0;y-=1){const b=h[y],{isExternal:j,modifiers:w,hasImportantModifier:k,baseClassName:S,maybePostfixModifierPosition:N}=a(b);if(j){v=b+(v.length>0?" "+v:v);continue}let T=!!N,D;if(T){const P=S.substring(0,N);D=o(P);const O=D&&f[D]?o(S):void 0;O&&O!==D&&(D=O,T=!1)}else D=o(S);if(!D){if(!T){v=b+(v.length>0?" "+v:v);continue}if(D=o(S),!D){v=b+(v.length>0?" "+v:v);continue}T=!1}const C=w.length===0?"":w.length===1?w[0]:d(w).join(":"),A=k?C+_v:C,R=A+D;if(p.indexOf(R)>-1)continue;p.push(R);const I=c(D,T);for(let P=0;P0?" "+v:v)}return v},Pz=(...e)=>{let t=0,a,o,c="";for(;t{if(typeof e=="string")return e;let t,a="";for(let o=0;o{let a,o,c,d;const f=h=>{const v=t.reduce((y,b)=>b(y),e());return a=Oz(v),o=a.cache.get,c=a.cache.set,d=p,p(h)},p=h=>{const v=o(h);if(v)return v;const y=Iz(h,a);return c(h,y),y};return d=f,(...h)=>d(Pz(...h))},Lz=[],Ns=e=>{const t=a=>a[e]||Lz;return t.isThemeGetter=!0,t.themeKey=e,t},IC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Uz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Vz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ao=e=>zz.test(e),Nt=e=>!!e&&!Number.isNaN(Number(e)),$a=e=>!!e&&Number.isInteger(Number(e)),Lv=e=>e.endsWith("%")&&Nt(e.slice(0,-1)),bl=e=>Bz.test(e),_C=()=>!0,$z=e=>Hz.test(e)&&!Uz.test(e),zv=()=>!1,qz=e=>Vz.test(e),Gz=e=>Fz.test(e),Kz=e=>!Ke(e)&&!Xe(e),Yz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Xz=e=>lo(e,VC,zv),Ke=e=>IC.test(e),vi=e=>lo(e,FC,$z),LC=e=>lo(e,sB,Nt),Qz=e=>lo(e,qC,_C),Zz=e=>lo(e,$C,zv),zC=e=>lo(e,HC,zv),Wz=e=>lo(e,UC,Gz),Bm=e=>lo(e,GC,qz),Xe=e=>PC.test(e),qd=e=>yi(e,FC),Jz=e=>yi(e,$C),BC=e=>yi(e,HC),eB=e=>yi(e,VC),tB=e=>yi(e,UC),Hm=e=>yi(e,GC,!0),nB=e=>yi(e,qC,!0),lo=(e,t,a)=>{const o=IC.exec(e);return o?o[1]?t(o[1]):a(o[2]):!1},yi=(e,t,a=!1)=>{const o=PC.exec(e);return o?o[1]?t(o[1]):a:!1},HC=e=>e==="position"||e==="percentage",UC=e=>e==="image"||e==="url",VC=e=>e==="length"||e==="size"||e==="bg-size",FC=e=>e==="length",sB=e=>e==="number",$C=e=>e==="family-name",qC=e=>e==="number"||e==="weight",GC=e=>e==="shadow",rB=_z(()=>{const e=Ns("color"),t=Ns("font"),a=Ns("text"),o=Ns("font-weight"),c=Ns("tracking"),d=Ns("leading"),f=Ns("breakpoint"),p=Ns("container"),h=Ns("spacing"),v=Ns("radius"),y=Ns("shadow"),b=Ns("inset-shadow"),j=Ns("text-shadow"),w=Ns("drop-shadow"),k=Ns("blur"),S=Ns("perspective"),N=Ns("aspect"),T=Ns("ease"),D=Ns("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...A(),Xe,Ke],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],O=()=>[Xe,Ke,h],_=()=>[ao,"full","auto",...O()],L=()=>[$a,"none","subgrid",Xe,Ke],H=()=>["auto",{span:["full",$a,Xe,Ke]},$a,Xe,Ke],B=()=>[$a,"auto",Xe,Ke],z=()=>["auto","min","max","fr",Xe,Ke],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...O()],q=()=>[ao,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],$=()=>[p,ao,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Y=()=>[ao,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],F=()=>[e,Xe,Ke],G=()=>[...A(),BC,zC,{position:[Xe,Ke]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",eB,Xz,{size:[Xe,Ke]}],M=()=>[Lv,qd,vi],U=()=>["","none","full",v,Xe,Ke],Z=()=>["",Nt,qd,vi],ae=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Nt,Lv,BC,zC],ie=()=>["","none",k,Xe,Ke],ge=()=>["none",Nt,Xe,Ke],ee=()=>["none",Nt,Xe,Ke],fe=()=>[Nt,Xe,Ke],te=()=>[ao,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bl],breakpoint:[bl],color:[_C],container:[bl],"drop-shadow":[bl],ease:["in","out","in-out"],font:[Kz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bl],shadow:[bl],spacing:["px",Nt],text:[bl],"text-shadow":[bl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ao,Ke,Xe,N]}],container:["container"],"container-type":[{"@container":["","normal","size",Xe,Ke]}],"container-named":[Yz],columns:[{columns:[Nt,"auto",Ke,Xe,p]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Xe,Ke]}],basis:[{basis:[ao,"full","auto",p,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nt,ao,"auto","initial","none",Ke]}],grow:[{grow:["",Nt,Xe,Ke]}],shrink:[{shrink:["",Nt,Xe,Ke]}],order:[{order:[$a,"first","last","none",Xe,Ke]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh","none",...q()]}],"font-size":[{text:["base",a,qd,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,nB,Qz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lv,Ke]}],"font-family":[{font:[Jz,Zz,t]}],"font-features":[{"font-features":[Ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Xe,Ke]}],"line-clamp":[{"line-clamp":[Nt,"none",Xe,LC]}],leading:[{leading:["none",d,...O()]}],"list-image":[{"list-image":["none",Xe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Nt,"from-font","auto",Xe,vi]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Nt,"auto",Xe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[$a,Xe,Ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Xe,Ke],radial:["",Xe,Ke],conic:["",$a,Xe,Ke]},tB,Wz]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Nt,Xe,Ke]}],"outline-w":[{outline:["",Nt,qd,vi]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,Hm,Bm]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",b,Hm,Bm]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Nt,vi]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",j,Hm,Bm]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Nt,Xe,Ke]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Xe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xe,Ke]}],filter:[{filter:["","none",Xe,Ke]}],blur:[{blur:ie()}],brightness:[{brightness:[Nt,Xe,Ke]}],contrast:[{contrast:[Nt,Xe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",w,Hm,Bm]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Nt,Xe,Ke]}],"hue-rotate":[{"hue-rotate":[Nt,Xe,Ke]}],invert:[{invert:["",Nt,Xe,Ke]}],saturate:[{saturate:[Nt,Xe,Ke]}],sepia:[{sepia:["",Nt,Xe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Xe,Ke]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Nt,Xe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[Nt,Xe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nt,Xe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nt,Xe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",Nt,Xe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[Nt,Xe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[Nt,Xe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Nt,Xe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nt,"initial",Xe,Ke]}],ease:[{ease:["linear","initial",T,Xe,Ke]}],delay:[{delay:[Nt,Xe,Ke]}],animate:[{animate:["none",D,Xe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Xe,Ke]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[Xe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[$a,Xe,Ke]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xe,Ke]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Nt,qd,vi,LC]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ue(...e){return rB(NC(e))}const aB=Fc(["group/button inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color,transform,box-shadow] duration-150 ease-out","outline-none select-none active:translate-y-[0.5px]","disabled:pointer-events-none disabled:opacity-45 disabled:shadow-none","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:"border-primary bg-primary font-semibold text-primary-on shadow-glow hover:border-primary-hover hover:bg-primary-hover",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"border-transparent bg-transparent text-subtle shadow-none hover:bg-control-hover hover:text-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive hover:bg-destructive-hover",dashed:"border-dashed border-border-strong bg-transparent text-muted-foreground shadow-none hover:border-primary hover:text-primary-fg",link:"border-transparent bg-transparent text-primary shadow-none underline-offset-4 hover:underline"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]","2xs":"h-4 rounded-pill px-1.5 text-[10px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]",icon:"h-[30px] w-[30px] rounded-md p-0","icon-2xs":"size-4 rounded-pill p-0","icon-xs":"size-6 rounded-sm p-0","icon-sm":"h-[26px] w-[26px] rounded-sm p-0","icon-lg":"size-9 rounded-md p-0"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:a,...o}){return s.jsx(mz,{className:Ue(aB({variant:t,size:a}),e),...o})}const lB="data-valid",oB="data-invalid",iB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KC={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},cB={disabled:!1,...KC},ji={valid(e){return e===null?null:e?{[lB]:""}:{[oB]:""}}},YC={invalid:void 0,name:void 0,validityData:{state:iB,errors:[],error:"",value:"",initialValue:null},setValidityData:qt,disabled:void 0,setTouched:qt,setDirty:qt,setFilled:qt,setFocused:qt,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:cB,registerFieldControl:qt,validation:{getValidationProps:(e,t=fn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qt,getInputControl:()=>null,commit:async()=>{},change:qt}},XC=x.createContext(YC);function Sa(e=!0){const t=x.useContext(XC);if(t.setValidityData===qt&&!e)throw new Error(on(28));return t}const uB=x.createContext(void 0);function dB(e=!1){const t=x.useContext(uB);if(!t&&!e)throw new Error(on(86));return t}const fB=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qt,validationMode:"onSubmit",submitCountRef:{current:0}});function $c(){return x.useContext(fB)}let QC=0;function pB(e,t="mui"){const[a,o]=x.useState(e),c=e||a;return x.useEffect(()=>{a==null&&(QC+=1,o(`${t}-${QC}`))},[a,t]),c}const ZC=Ev.useId;function Gd(e,t){if(ZC!==void 0){const a=ZC();return e??(t?`${t}-${a}`:a)}return pB(e,t)}function Na(e){return Gd(e,"base-ui")}const mB=x.createContext({controlId:void 0,registerControlId:qt,resetControlId:qt,labelId:void 0,setLabelId:qt,messageIds:[],setMessageIds:qt,getDescriptionProps:e=>e});function vl(){return x.useContext(mB)}function Bv(e,t,a,o=!0,c){const[d,f]=x.useState(),p=Na(c?`${c}-label`:void 0),h=e??t??d;return De(()=>{const v=e||t||!o?void 0:hB(a.current,p);d!==v&&f(v)}),h}function hB(e,t){const a=gB(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function gB(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const c=e.nextElementSibling;if(c&&c.htmlFor===a)return c}const o=e.labels;return o&&o[0]}function oo(e={}){const{id:t,enabled:a=!0}=e,{controlId:o,registerControlId:c,resetControlId:d}=vl(),f=Na(),p=Ds(()=>Symbol()),h=x.useRef(!1),v=x.useRef(!1),y=Ie(()=>{!h.current||c===qt||(h.current=!1,c(p.current,void 0))});return De(()=>{if(!a||c===qt){y();return}let b;if(t!==void 0)v.current=!0,b=t;else if(v.current)b=f;else{d();return}if(b===void 0){y();return}h.current=!0,c(p.current,b)},[t,a,c,d,f,p,y]),De(()=>y,[y]),(a?o:void 0)??t??f}function xB(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:bB,platform:vB,maxTouchPoints:yB}=xB(),Um=bB.toLowerCase(),Kd=vB.toLowerCase(),Yd=/^i(os$|p)/.test(Kd)||Kd==="macintel"&&yB>1,WC="android",Vm=Kd===WC||Um.includes(WC),JC=!Yd&&Kd.startsWith("mac");Kd.startsWith("win");const jB=JC||Yd,yl=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),e1=!yl&&Um.includes("firefox");!yl&&Um.includes("chrom");const wB=jB,Hv=/jsdom|happydom/.test(Um);function or(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Hc(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function cs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Uv="data-base-ui-focusable",t1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",wi="ArrowLeft",Si="ArrowRight",Vv="ArrowUp",Fm="ArrowDown",n1="data-starting-style",SB="data-ending-style",NB={[n1]:""},kB={[SB]:""},io={transitionStatus(e){return e==="starting"?NB:e==="ending"?kB:null}},CB="data-open",TB="data-closed",EB="data-anchor-hidden",s1="data-popup-open",AB="data-pressed",RB={[s1]:""},OB={[s1]:"",[AB]:""},MB={[CB]:""},DB={[TB]:""},IB={[EB]:""},Fv={open(e){return e?RB:null}},$v={open(e){return e?OB:null}},qc={open(e){return e?MB:DB},anchorHidden(e){return e?IB:null}},qv={...qc,...io},Gv="data-trigger-disabled";function $m(e,t){if(!At(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute(Gv);for(const[,o]of t.entries())if(Qe(o,a))return!o.hasAttribute(Gv);return!1}function Kv(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function PB(e){return e.matches("html,body")}function qm(e){return dn(e)&&e.matches(t1)}function _B(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${t1}`)!=null}function Yv(e){return e?e.getAttribute("role")==="combobox"&&qm(e):!1}function LB(e){if(!e||Hv)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Gm(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}function co(e,t,a=!0){return e.filter(c=>c.parentId===t).flatMap(c=>[...!a||c.context?.open?[c]:[],...co(e,c.id,a)])}function r1(e,t){let a=[],o=e.find(c=>c.id===t)?.parentId;for(;o;){const c=e.find(d=>d.id===o);o=c?.parentId,c&&(a=a.concat(c))}return a}function ks(e){e.preventDefault(),e.stopPropagation()}function zB(e){return"nativeEvent"in e}function Km(e){return e.pointerType===""&&e.isTrusted?!0:Vm&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Xv(e){return Hv?!1:!Vm&&e.width===0&&e.height===0||Vm&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function uo(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function BB(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Gc=Math.min,jl=Math.max,Ym=Math.round,Ni=Math.floor,wl=e=>({x:e,y:e}),HB={left:"right",right:"left",bottom:"top",top:"bottom"};function a1(e,t,a){return jl(e,Gc(t,a))}function fo(e,t){return typeof e=="function"?e(t):e}function ta(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Qv(e){return e==="x"?"y":"x"}function Zv(e){return e==="y"?"height":"width"}function na(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wv(e){return Qv(na(e))}function UB(e,t,a){a===void 0&&(a=!1);const o=Sl(e),c=Wv(e),d=Zv(c);let f=c==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(f=Xm(f)),[f,Xm(f)]}function VB(e){const t=Xm(e);return[Jv(e),t,Jv(t)]}function Jv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const l1=["left","right"],o1=["right","left"],FB=["top","bottom"],$B=["bottom","top"];function qB(e,t,a){switch(e){case"top":case"bottom":return a?t?o1:l1:t?l1:o1;case"left":case"right":return t?FB:$B;default:return[]}}function GB(e,t,a,o){const c=Sl(e);let d=qB(ta(e),a==="start",o);return c&&(d=d.map(f=>f+"-"+c),t&&(d=d.concat(d.map(Jv)))),d}function Xm(e){const t=ta(e);return HB[t]+e.slice(t.length)}function KB(e){var t,a,o,c;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(o=e.bottom)!=null?o:0,left:(c=e.left)!=null?c:0}}function i1(e){return typeof e!="number"?KB(e):{top:e,right:e,bottom:e,left:e}}function Xd(e){const{x:t,y:a,width:o,height:c}=e;return{width:o,height:c,top:a,left:t,right:t+o,bottom:a+c,x:t,y:a}}function Qm(e,t,a){return Math.floor(e/t)!==a}function po(e,t){return t<0||t>=e.length}function Zm(e,t){return Is(e.current,{disabledIndices:t})}function ey(e,t){return Is(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Is(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:c=1}={}){let d=t;do d+=a?-c:c;while(d>=0&&d<=e.length-1&&mo(e,d,o));return d}function YB(e,{event:t,orientation:a,loopFocus:o,onLoop:c,rtl:d,cols:f,disabledIndices:p,minIndex:h,maxIndex:v,prevIndex:y,stopEvent:b=!1}){let j=y,w;if(t.key===Vv?w="up":t.key===Fm&&(w="down"),w){const k=[],S=[];let N=!1,T=0;{let _=null,L=-1;e.forEach((H,B)=>{if(H==null)return;T+=1;const z=H.closest('[role="row"]');z&&(N=!0),(z!==_||L===-1)&&(_=z,L+=1,k[L]=[]),k[L].push(B),S[B]=L})}let D=!1,C=0;if(N)for(const _ of k){const L=_.length;L>C&&(C=L),L!==f&&(D=!0)}const A=D&&T{if(!D||y===-1)return;const L=S[y];if(L==null)return;const H=k[L].indexOf(y),B=_==="up"?-1:1;for(let z=L+B,Q=0;Q=k.length){if(!o||A)return;if(z=z<0?k.length-1:0,c){const X=Math.min(H,k[z].length-1),q=k[z][X]??k[z][0],$=c(t,y,q);z=S[$]??z}}const K=k[z];for(let X=Math.min(H,K.length-1);X>=0;X-=1){const q=K[X];if(!mo(e,q,p))return q}}},P=_=>{if(!A||y===-1)return;const L=y%R,H=_==="up"?-R:R,B=v-v%R,z=Ni(v/R)+1;for(let Q=y-L+H,K=0;Kv){if(!o)return;Q=Q<0?B:0}const X=Math.min(Q+R-1,v);for(let q=Math.min(Q+L,X);q>=Q;q-=1)if(!mo(e,q,p))return q}};b&&ks(t);const O=I(w)??P(w);if(O!==void 0)j=O;else if(y===-1)j=w==="up"?v:h;else if(j=Is(e,{startingIndex:y,amount:R,decrement:w==="up",disabledIndices:p}),o){if(w==="up"&&(y-R_?H:H-R,c&&(j=c(t,y,j))}w==="down"&&y+R>v&&(j=Is(e,{startingIndex:y%R-R,amount:R,disabledIndices:p}),c&&(j=c(t,y,j)))}po(e,j)&&(j=y)}if(a==="both"){const k=Ni(y/f);t.key===(d?wi:Si)&&(b&&ks(t),y%f!==f-1?(j=Is(e,{startingIndex:y,disabledIndices:p}),o&&Qm(j,f,k)&&(j=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(j=c(t,y,j)))):o&&(j=Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(j=c(t,y,j))),Qm(j,f,k)&&(j=y)),t.key===(d?Si:wi)&&(b&&ks(t),y%f!==0?(j=Is(e,{startingIndex:y,decrement:!0,disabledIndices:p}),o&&Qm(j,f,k)&&(j=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(j=c(t,y,j)))):o&&(j=Is(e,{startingIndex:y+(f-y%f),decrement:!0,disabledIndices:p}),c&&(j=c(t,y,j))),Qm(j,f,k)&&(j=y));const S=Ni(v/f)===k;po(e,j)&&(o&&S?(j=t.key===(d?Si:wi)?v:Is(e,{startingIndex:y-y%f-1,disabledIndices:p}),c&&(j=c(t,y,j))):j=y)}return j}function mo(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const c=e[t];return c?!Wm(c)||c.matches(":disabled")?!0:!a&&(c.hasAttribute("disabled")||c.getAttribute("aria-disabled")==="true"):!1}function XB(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Wm(e,t=e?br(e):null){return!e||!e.isConnected||!t||XB(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const QB='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function ZB(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Hc(a)?a.host:null}function ty(e){for(const t of Array.from(e.children))if(Hs(t)==="summary")return t;return null}function WB(e,t){const a=ty(t);return!!a&&(e===a||Qe(a,e))}function c1(e){const t=e?Hs(e):"";return e!=null&&e.matches(QB)&&(t!=="summary"||e.parentElement!=null&&Hs(e.parentElement)==="details"&&ty(e.parentElement)===e)&&(t!=="details"||ty(e)==null)&&(t!=="input"||e.type!=="hidden")}function u1(e){if(!c1(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=ZB(t)){const a=t!==e,o=Hs(t)==="slot";if(t.hasAttribute("inert")||a&&Hs(t)==="details"&&!t.open&&!WB(e,t)||t.hasAttribute("hidden")||!o&&!JB(t,a))return!1}return!0}function JB(e,t){const a=br(e);return t?a.display!=="none":Wm(e,a)}function d1(e){const t=e.tabIndex;if(t<0){const a=Hs(e);if(a==="details"||a==="audio"||a==="video"||dn(e)&&e.isContentEditable)return 0}return t}function ny(e){if(Hs(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function e4(e,t){const a=ny(e);if(!a)return!0;const o=t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form&&d.checked});return o?o===a:t.find(c=>{const d=ny(c);return d?.name===a.name&&d.form===a.form})===a}function f1(e){if(dn(e)&&Hs(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function p1(e,t){f1(e).forEach(a=>{c1(a)&&t.push(a),p1(a,t)})}function m1(e,t,a){f1(e).forEach(o=>{dn(o)&&o.matches(t)&&a.push(o),m1(o,t,a)})}function sy(e){return u1(e)&&d1(e)>=0}function h1(e){const t=[];return p1(e,t),t.filter(u1)}function Qd(e){const t=h1(e);return t.filter(a=>d1(a)>=0&&e4(a,t))}function g1(e,t){const a=Qd(e),o=a.length;if(o===0)return;const c=or($t(e)),d=a.indexOf(c),f=d===-1?t===1?0:o-1:d+t;return a[f]}function ry(e){return g1($t(e).body,1)||e}function x1(e){return g1($t(e).body,-1)||e}function b1(e,t){if(!e)return null;const a=Qd($t(e).body),o=a.length;if(o===0)return null;const c=a.indexOf(e);if(c===-1)return null;const d=(c+t+o)%o;return a[d]}function t4(e){return b1(e,1)}function n4(e){return b1(e,-1)}function Kc(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(a,o)}function s4(e){Qd(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function v1(e){const t=[];m1(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function ay(e){x.useEffect(e,Mr)}const Zd=0;class sa{constructor(){ln(this,"currentId",Zd);ln(this,"clear",()=>{this.currentId!==Zd&&(clearTimeout(this.currentId),this.currentId=Zd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new sa}start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zd,a()},t)}isStarted(){return this.currentId!==Zd}}function Zs(){const e=Ds(sa.create).current;return ay(e.disposeEffect),e}function r4(e,t){return e.matches(":disabled")?!1:!t||e.form===t?!0:e.form===null&&!e.hasAttribute("form")}const a4=x.createContext({disabled:!1});function y1(){return x.useContext(a4)}var ly={exports:{}},Us={};var j1;function l4(){if(j1)return Us;j1=1;var e=Vd();function t(y){var b="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ly.exports=l4(),ly.exports}var Cs=S1();const Jm=null;class o4{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let c=0;c=this.callbacks.length||this.callbacks[a]!==null&&(this.callbacks[a]=null,this.callbacksCount-=1)}}let eh=new o4;class qa{constructor(){ln(this,"currentId",Jm);ln(this,"cancel",()=>{this.currentId!==Jm&&(eh.cancel(this.currentId),this.currentId=Jm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new qa}static request(t){return eh.request(t)}static cancel(t){return eh.cancel(t)}request(t){this.cancel(),this.currentId=eh.request(()=>{this.currentId=Jm,t()})}}function Yc(){const e=Ds(qa.create).current;return ay(e.disposeEffect),e}function Nl(e){return e==null?e:"current"in e?e.current:e}let th=null;function i4(e){if(!th){const t=[];th=t,queueMicrotask(()=>{th=null,Cs.flushSync(()=>{for(const a of t)a()})})}th.push(e)}function N1(e,t=!1,a=!1){const o=Yc();return Ie((c,d=null)=>{o.cancel();const f=Nl(e);if(f==null)return;const p=f,h=()=>{if(!a){Cs.flushSync(c);return}i4(()=>{d?.aborted||c()})};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){c();return}function v(){Promise.all(p.getAnimations().map(y=>y.finished)).then(()=>{d?.aborted||h()},()=>{if(d?.aborted)return;if(p.getAnimations().some(b=>b.pending||b.playState!=="finished")){v();return}h()})}if(t){const y=n1;if(!p.hasAttribute(y)){o.request(v);return}const b=new MutationObserver(()=>{p.hasAttribute(y)||(b.disconnect(),v())});b.observe(p,{attributes:!0,attributeFilter:[y]}),d?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(v)})}function ra(e){const{enabled:t=!0,open:a,ref:o,batch:c=!1,onComplete:d}=e,f=Ie(d),p=N1(o,a,c);x.useEffect(()=>{if(!t)return;const h=new AbortController;return p(f,h.signal),()=>{h.abort()}},[t,a,f,p])}function ki(e,t=!1,a=!1,o=!1){const[c,d]=x.useState(e&&t?"idle":void 0),[f,p]=x.useState(e&&!o);return e&&!f&&(p(!0),d("starting")),!e&&f&&c!=="ending"&&!a&&d("ending"),!e&&!f&&c==="ending"&&d(void 0),De(()=>{if(!e&&f&&c!=="ending"&&a){const h=qa.request(()=>{d("ending")});return()=>{qa.cancel(h)}}},[e,f,c,a]),De(()=>{if(!e||t)return;const h=qa.request(()=>{d(void 0)});return()=>{qa.cancel(h)}},[t,e]),De(()=>{if(!e||!t)return;e&&f&&c!=="idle"&&d("starting");const h=qa.request(()=>{d("idle")});return()=>{qa.cancel(h)}},[t,e,f,c]),{mounted:f,setMounted:p,transitionStatus:c}}function Ga({controlled:e,default:t,name:a,state:o="value"}){const{current:c}=x.useRef(e!==void 0),[d,f]=x.useState(t),p=c&&e!==void 0?e:d,h=x.useCallback(v=>{c||f(v)},[]);return[p,h]}function Xc(e,t,a,o,c=!0,d){const{registerFieldControl:f}=Sa(),p=Ds(()=>Symbol());De(()=>{const h=p.current;if(!c){f(h,void 0);return}f(h,{controlRef:e,getValue:o,id:t,name:d,value:a})},[e,c,o,t,d,f,p,a]),De(()=>{const h=p.current;return()=>{f(h,void 0)}},[f,p])}function aa(e,t){const a=x.useRef(e),o=Ie(t);De(()=>{a.current!==e&&o(a.current),a.current=e},[e,o])}const Yn="none",ho="trigger-press",Vs="trigger-hover",nh="trigger-focus",sh="outside-press",Wd="item-press",oy="close-press",Jd="input-change",Ka="input-clear",c4="input-press",go="focus-out",Qc="escape-key",iy="list-navigation",k1="keyboard",C1="pointer",T1="cancel-open",u4="disabled",cy="imperative-action",d4="window-resize";function $e(e,t,a,o){let c=!1,d=!1;const f=o??fn;return{reason:e,event:t??new Event("base-ui"),cancel(){c=!0},allowPropagation(){d=!0},get isCanceled(){return c},get isPropagationAllowed(){return d},trigger:a,...f}}function f4(e,t,a){const o=a??fn;return{reason:e,event:t??new Event("base-ui"),...o}}const p4=x.forwardRef(function(t,a){const{render:o,className:c,id:d,name:f,value:p,disabled:h=!1,onValueChange:v,defaultValue:y,autoFocus:b=!1,style:j,...w}=t,{state:k,name:S,disabled:N,setTouched:T,setDirty:D,validityData:C,setFocused:A,setFilled:R,validationMode:I,validation:P}=Sa(),{clearErrors:O,elementRef:_,submitCountRef:L}=$c(),H=N||h,B=S??f,z={...k,disabled:H},{labelId:Q}=vl(),K=oo({id:d}),[X]=Ga({controlled:p,default:y,name:"FieldControl",state:"value"}),q=p!==void 0,$=q?X:void 0,Y=$==null?void 0:String($),F=Ie(()=>P.inputRef.current?.value);Xc(P.inputRef,K,Y,F,!H,f),De(()=>{const M=Y??P.inputRef.current?.value;M!==void 0&&R(M!=="")},[Y,P.inputRef,R]),aa(Y,()=>{Y!==void 0&&(O(B),D(Y!==(C.initialValue??"")),P.change(Y))});const G=x.useRef(null),W=Zs();return De(()=>{b&&G.current===or($t(G.current))&&A(!0)},[b,A]),yt("input",t,{ref:[a,G],state:z,props:[{id:K,disabled:H,name:B,ref:P.inputRef,"aria-labelledby":Q,autoFocus:b,...q?{value:$}:{defaultValue:y},onChange(M){const U=M.currentTarget.value,Z=$e(Yn,M.nativeEvent);v?.(U,Z),!q&&(D(U!==(C.initialValue??"")),R(U!==""),!M.nativeEvent.defaultPrevented&&!Z.isCanceled&&(O(B),P.change(U)))},onFocus(){A(!0)},onBlur(M){if(T(!0),A(!1),I==="onBlur"){const U=M.currentTarget.value;P.commit(U),q&&queueMicrotask(()=>{const Z=P.inputRef.current?.value;Z!==void 0&&Z!==U&&Z!==(C.initialValue??"")&&P.commit(Z)})}},onKeyDown(M){if(M.currentTarget.tagName==="INPUT"&&M.key==="Enter"){T(!0);const U=M.currentTarget.value,Z=M.currentTarget.form;if(Z&&Z===_.current&&!M.defaultPrevented){const ae=M.currentTarget,ce=L.current;W.start(0,()=>{L.current===ce&&P.commit(ae.value)})}else P.commit(U)}}},w,M=>P.getValidationProps(H,M)],stateAttributesMapping:ji})}),m4=x.forwardRef(function(t,a){return s.jsx(p4,{ref:a,...t})});function Fe({className:e,type:t,ref:a,...o}){return s.jsx(m4,{ref:a,type:t,"data-slot":"input",className:Ue("h-[30px] w-full min-w-0 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground","file:inline-flex file:border-0 file:bg-transparent file:text-foreground",e),...o})}function Zc({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:Ue("min-h-26 w-full resize-y rounded-md border border-control-border bg-control px-3 py-2.5","font-mono text-[12px] leading-[1.6] text-foreground outline-none","transition-[border-color,box-shadow] duration-150 ease-out","placeholder:text-muted-foreground","hover:border-control-border-hover","focus:border-primary focus:shadow-focus","disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-muted-foreground",e),...t})}function Ci({className:e,...t}){return s.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("group/input-group relative flex h-[30px] w-full min-w-0 items-center rounded-md border border-control-border bg-control","transition-[border-color,box-shadow] duration-150 ease-out","outline-none","has-[[data-slot=input-group-control]:focus-visible]:border-primary","has-[[data-slot=input-group-control]:focus-visible]:shadow-focus","has-[[data-slot=input-group-control]:hover:not(:focus-visible)]:border-control-border-hover","has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-1.5","has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-1.5","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-1.5","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-1.5",e),...t})}const h4=Fc(["flex h-auto cursor-text items-center justify-center gap-1.5 select-none","text-[12px] font-medium text-muted-foreground","group-data-[disabled=true]/input-group:opacity-50"],{variants:{align:{"inline-start":"order-first pl-[9px] has-[>button]:-ml-1","inline-end":"order-last pr-[9px] has-[>button]:-mr-1","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-1.5","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-1.5"}},defaultVariants:{align:"inline-start"}});function Ti({className:e,align:t="inline-start",...a}){return s.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(h4({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus()},...a})}const g4=Fc("flex items-center shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-xs px-1.5",sm:"h-8 gap-1.5 rounded-sm px-2.5","icon-xs":"size-6 rounded-xs p-0","icon-sm":"size-8 rounded-sm p-0"}},defaultVariants:{size:"xs"}});function x4({className:e,type:t="button",variant:a="ghost",size:o="xs",...c}){return s.jsx(se,{type:t,"data-size":o,variant:a,className:Ue(g4({size:o}),e),...c})}function Ei({className:e,...t}){return s.jsx(Fe,{"data-slot":"input-group-control",className:Ue("flex-1 rounded-none border-0 bg-transparent shadow-none focus:border-0 focus:shadow-none",e),...t})}function b4(e){return yt(e.defaultTagName??"div",e,e)}const v4=Fc("inline-flex w-fit shrink-0 items-center justify-center gap-[5px] overflow-hidden whitespace-nowrap border font-semibold",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-destructive-bd bg-destructive-soft text-destructive",outline:"border-control-border bg-control text-subtle",ghost:"border-transparent bg-transparent text-muted-foreground",link:"border-transparent bg-transparent text-primary underline-offset-4 hover:underline",success:"border-success-bd bg-success-soft text-success",warning:"border-warning-bd bg-warning-soft text-warning",info:"border-info-bd bg-info-soft text-info",brand:"border-primary-bd bg-primary-soft text-primary-fg",cn:"border-cn-bd bg-cn-soft text-cn",intl:"border-intl-bd bg-intl-soft text-intl",sensitive:"border-sensitive-bd bg-sensitive-soft text-sensitive"},shape:{pill:"min-h-[21px] rounded-pill px-[9px] py-px text-[11.5px]",tag:"min-h-[19px] rounded-xs px-2 py-0 text-[11px]"}},defaultVariants:{variant:"default",shape:"pill"}});function ze({className:e,variant:t,shape:a,render:o,...c}){return b4({render:o,defaultTagName:"span",props:Wr({"data-slot":"badge"},c,{className:Ue(v4({variant:t,shape:a}),e)})})}function uy({className:e,...t}){return s.jsx("span",{className:Ue("size-1.5 flex-none rounded-full bg-current",e),...t})}function xo(e,t){if(typeof window>"u")return e;const a=window.wbI18n;return a?a.t(e,t)??e:e}function ef({className:e,...t}){return s.jsx("svg",{"data-slot":"spinner",role:"status","aria-label":xo("加载中"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:Ue("size-4 animate-spin [animation-duration:0.7s]",e),...t,children:s.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function Je({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:Ue("flex items-center gap-[6px] text-[11.5px] text-muted-foreground",e),...t})}const E1={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ai={...E1,position:"fixed",top:0,left:0},Wc={...E1,position:"absolute"},A1=x.createContext(void 0);function y4(){const e=x.useContext(A1);if(e===void 0)throw new Error(on(63));return e}const j4="data-checked",w4="data-unchecked",R1={...ji,checked(e){return e?{[j4]:""}:{[w4]:""}}},S4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d,"aria-labelledby":f,form:p,id:h,inputRef:v,name:y,nativeButton:b=!1,onCheckedChange:j,readOnly:w=!1,required:k=!1,disabled:S=!1,render:N,uncheckedValue:T,value:D,style:C,...A}=t,{clearErrors:R}=$c(),{state:I,setTouched:P,setDirty:O,validityData:_,setFilled:L,setFocused:H,validationMode:B,disabled:z,name:Q,validation:K}=Sa(),{labelId:X}=vl(),q=z||S,$=Q??y,Y=x.useRef(null),F=ea(Y,v,K.inputRef),G=x.useRef(null),W=Na(),le=oo({id:h}),M=b?void 0:le,[U,Z]=Ga({controlled:o,default:!!d,name:"Switch",state:"checked"});Xc(G,W,U,void 0,!q,y),De(()=>{L(U)},[U,L]),aa(U,()=>{R($),O(U!==_.initialValue),K.change(U)});const{getButtonProps:ae,buttonRef:ce}=Jr({disabled:q,native:b}),J=Bv(f,X,Y,!b,M),ie={id:b?le:W,role:"switch","aria-checked":U,"aria-readonly":w||void 0,"aria-required":k||void 0,"aria-labelledby":J,onFocus(){q||H(!0)},onBlur(){const te=Y.current;!te||q||(P(!0),H(!1),B==="onBlur"&&K.commit(te.checked))},onClick(te){if(w||q)return;te.preventDefault();const Ce=Y.current;Ce&&Vc(Ce,te)}},ge={...K.getValidationProps(q),checked:U,disabled:q,form:p,id:M,name:$,required:k,style:$?Wc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(te){if(te.nativeEvent.defaultPrevented)return;if(w){te.preventDefault();return}const Ce=te.currentTarget.checked,re=$e(Yn,te.nativeEvent);j?.(Ce,re),!re.isCanceled&&Z(Ce)},onClick(te){te.stopPropagation()},onFocus(){G.current?.focus()},...D!==void 0?{value:D}:fn},ee=x.useMemo(()=>({...I,checked:U,disabled:q,readOnly:w,required:k}),[I,U,q,w,k]),fe=yt("span",t,{state:ee,ref:[a,G,ce],props:[ie,A,ae,te=>K.getValidationProps(q,te)],stateAttributesMapping:R1});return s.jsxs(A1.Provider,{value:ee,children:[fe,!U&&$&&T!==void 0&&s.jsx("input",{type:"hidden",form:p,name:$,value:T,disabled:q}),s.jsx("input",{...ge,suppressHydrationWarning:!0})]})}),N4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=y4();return yt("span",t,{state:p,ref:a,stateAttributesMapping:R1,props:f})});function us({className:e,size:t="default",...a}){const o=t==="sm";return s.jsx(S4,{"data-slot":"switch",className:Ue("relative inline-flex flex-none cursor-pointer items-center rounded-pill border-0 bg-border-strong p-0","transition-colors duration-[180ms] ease-out","data-checked:bg-primary","focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:opacity-50",o?"h-[14px] w-6":"h-[21px] w-9",e),...a,children:s.jsx(N4,{"data-slot":"switch-thumb",className:Ue("block rounded-full bg-primary-on shadow-1","transition-transform duration-[180ms] [transition-timing-function:cubic-bezier(.3,1.4,.6,1)]",o?"size-[10px] translate-x-0.5 data-checked:translate-x-[10px]":"size-[17px] translate-x-0.5 data-checked:translate-x-[15px]")})})}function k4(e){if(!e)return null;for(const t of e.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const o=t;if(o.type==="submit")return o}}return null}const C4="data-checked",T4="data-unchecked";function O1(e){return{checked(t){return e.indeterminate?{}:t?{[C4]:""}:{[T4]:""}},...ji}}const E4=x.createContext(void 0);function A4(){return x.useContext(E4)}const M1=x.createContext(void 0);function R4(){const e=x.useContext(M1);if(e===void 0)throw new Error(on(14));return e}const O4="data-parent",M4=x.forwardRef(function(t,a){const{checked:o,className:c,defaultChecked:d=!1,"aria-labelledby":f,disabled:p=!1,form:h,id:v,indeterminate:y=!1,inputRef:b,name:j,onCheckedChange:w,parent:k=!1,readOnly:S=!1,render:N,required:T=!1,uncheckedValue:D,value:C,nativeButton:A=!1,style:R,...I}=t,{clearErrors:P}=$c(),{disabled:O,name:_,setDirty:L,setFilled:H,setFocused:B,setTouched:z,state:Q,validationMode:K,validityData:X,validation:q}=Sa(),$=y1(),{labelId:Y,registerControlId:F,getDescriptionProps:G}=vl(),W=A4(),le=W?.allValues===void 0?void 0:W.parent,M=le!==void 0,U=O||$.disabled||W?.disabled||p,Z=_??j,ae=C??Z,ce=Na(),J=W?.registerControlId!==F,ie=oo({id:v||void 0,enabled:J}),ge=A?ie:ce;let ee={};M&&(k?ee=le.getParentProps():ae!==void 0&&(ee=le.getChildProps(ae)));const{checked:fe=o,indeterminate:te=y,onCheckedChange:Ce,...re}=ee,de=W?.value,ke=x.useRef(null),{getButtonProps:Ee,buttonRef:ve}=Jr({disabled:U,native:A}),he=W?.validation??q,[ye,we]=Ga({controlled:ae!==void 0&&de!==void 0&&!k?de.includes(ae):fe,default:d,name:"Checkbox",state:"checked"}),xe=M?!!fe:ye,Te=M&&te||y;Xc(ke,ce,ye,void 0,!W&&!U,j);const Oe=le?.registerChildId,Ne=x.useRef(null),Le=he.registerInput,Ye=W?ae:void 0,kt=x.useCallback(it=>Le(it,{controlRef:ke,value:Ye}),[Le,Ye]),Ct=ea(b,Ne,k?void 0:kt),Rt=Bv(f,Y,Ne,!A,ie);De(()=>{Ne.current&&(Ne.current.indeterminate=Te),W||H(ye)},[ye,Te,W,H]),aa(ye,()=>{W||(P(Z),L(ye!==X.initialValue),he.change(ye))});const ot=Wr({checked:ye,disabled:U,form:h,name:k?void 0:Z,id:A?void 0:ie,required:T,ref:Ct,style:Z?Wc:Ai,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(it){if(it.nativeEvent.defaultPrevented)return;if(S){it.preventDefault();return}const Vt=it.currentTarget.checked,Hn=$e(Yn,it.nativeEvent);if(w?.(Vt,Hn),!Hn.isCanceled&&(Ce?.(Vt,Hn),!Hn.isCanceled&&(we(Vt),ae!==void 0&&W!==void 0&&!k&&!M))){const tn=Vt?[...W.value,ae]:W.value.filter(nt=>nt!==ae);W.setValue(tn,Hn)}},onClick(it){it.stopPropagation()},onFocus(){ke.current?.focus()}},C!==void 0?{value:(W?ye&&C:C)||""}:fn,G,it=>he.getValidationProps(U,it));x.useEffect(()=>{if(!le||ae===void 0)return;const it=le.disabledStatesRef.current;return it.set(ae,U),()=>{it.delete(ae)}},[le,U,ae]);const qn=x.useMemo(()=>({...Q,checked:xe,disabled:U,readOnly:S,required:T,indeterminate:Te}),[Q,xe,U,S,T,Te]),ps=O1(qn),Gn=yt("span",t,{state:qn,ref:[ve,ke,a],props:[{id:ge,role:"checkbox","aria-checked":Te?"mixed":xe,"aria-readonly":S||void 0,"aria-required":T||void 0,"aria-labelledby":Rt,[O4]:k?"":void 0,onFocus(){U||B(!0)},onBlur(){const it=Ne.current;it&&(z(!0),B(!1),K==="onBlur"&&he.commit(W?de:it.checked))},onKeyDown(it){if(it.key!=="Enter"||(it.preventBaseUIHandler(),it.defaultPrevented))return;const Vt=Ne.current?.form??null,Hn=it.currentTarget,tn=it.nativeEvent,nt=it.preventDefault,Ot=tn.preventDefault;let Ft=!1;it.preventDefault=()=>{Ft=!0,nt.call(it)},tn.preventDefault=()=>{Ft=!0,Ot.call(tn)},Ot.call(tn),Sn(Hn).queueMicrotask(()=>{it.preventDefault=nt,tn.preventDefault=Ot,Ft||k4(Vt)?.click()})},onClick(it){if(S||U)return;it.preventDefault();const Vt=Ne.current;Vt&&Vc(Vt,it)}},I,re,Ee,G,it=>he.getValidationProps(U,it)],stateAttributesMapping:ps}),bs=Gn.props.id;return De(()=>{if(!(!Oe||k||ae===void 0||bs===void 0))return Oe(ae,bs)},[Oe,k,ae,bs]),s.jsxs(M1.Provider,{value:qn,children:[Gn,!ye&&!W&&Z&&!k&&D!==void 0&&s.jsx("input",{type:"hidden",form:h,name:Z,value:D,disabled:U}),s.jsx("input",{...ot,suppressHydrationWarning:!0})]})}),D4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=R4(),v=h.checked||h.indeterminate,{mounted:y,transitionStatus:b,setMounted:j}=ki(v),w=x.useRef(null),k={...h,transitionStatus:b};ra({batch:!0,enabled:!v,open:v,ref:w,onComplete(){v||j(!1)}});const N={...O1(h),...io},T=f||y,D=yt("span",t,{ref:[a,w],state:k,stateAttributesMapping:N,props:p});return T?D:null});function Dr({className:e,...t}){return s.jsx(M4,{"data-slot":"checkbox",className:Ue("group/checkbox relative inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(D4,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-primary-foreground data-unchecked:hidden",children:s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-2.5","aria-hidden":"true",children:[s.jsx("path",{d:"M2 6h8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none",className:"hidden group-aria-[checked=indeterminate]/checkbox:block"}),s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:"group-aria-[checked=indeterminate]/checkbox:hidden"})]})})})}function dy(e){return Array.isArray(e)?e.map(t=>dy(t)).join(","):e==null?"":String(e)}const D1=new Map;function I4(e,t){const a=JSON.stringify({locale:dy(e),options:t}),o=D1.get(a);if(o)return o;const c=new Intl.NumberFormat(e,t);return D1.set(a,c),c}function I1(e,t,a){return e==null?"":I4(t,a).format(e)}function Ri(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}function P4(e,t,a){return(e-t)*100/(a-t)}const P1=x.createContext(void 0);function _1(){const e=x.useContext(P1);if(e===void 0)throw new Error(on(51));return e}const _4="data-complete",L4="data-indeterminate",z4="data-progressing",fy={status(e){return e==="progressing"?{[z4]:""}:e==="complete"?{[_4]:""}:e==="indeterminate"?{[L4]:""}:null}},B4=x.forwardRef(function(t,a){const{format:o,getAriaValueText:c,locale:d,max:f=100,min:p=0,value:h,render:v,className:y,children:b,style:j,...w}=t,[k,S]=x.useState();let N="indeterminate",T=null,D=null,C="",A="indeterminate progress";if(h!=null&&Number.isFinite(h)){const _=P4(h,p,f);T=Ri(Number.isNaN(_)?0:_,0,100),D=Ri(h,p,f),N=D===f?"complete":"progressing",C=o?I1(D,d,o):I1(T/100,d,{style:"percent"}),A=C}const R=x.useMemo(()=>({status:N}),[N]),I={"aria-labelledby":k,"aria-valuemax":f,"aria-valuemin":p,"aria-valuenow":D??void 0,"aria-valuetext":c?c(C,h):A,role:"progressbar",children:s.jsxs(x.Fragment,{children:[b,s.jsx("span",{role:"presentation",style:Ai,children:"x"})]})},P=x.useMemo(()=>({formattedValue:C,percentageValue:T,setLabelId:S,state:R,value:h}),[C,T,S,R,h]),O=yt("div",t,{state:R,ref:a,props:[I,w],stateAttributesMapping:fy});return s.jsx(P1.Provider,{value:P,children:O})}),H4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{state:p}=_1();return yt("div",t,{state:p,ref:a,props:f,stateAttributesMapping:fy})}),U4=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,{percentageValue:p,state:h}=_1(),v=p==null?{}:{insetInlineStart:0,height:"inherit",width:`${p}%`};return yt("div",t,{state:h,ref:a,props:[{style:v},f],stateAttributesMapping:fy})});function tf({className:e,children:t,value:a,...o}){return s.jsxs(B4,{value:a,"data-slot":"progress",className:Ue("flex w-full flex-wrap items-center gap-3",e),...o,children:[t,s.jsx(V4,{children:s.jsx(F4,{})})]})}function V4({className:e,...t}){return s.jsx(H4,{"data-slot":"progress-track",className:Ue("relative flex h-1.5 w-full items-center overflow-x-hidden overflow-y-hidden rounded-pill bg-surface-3",e),...t})}function F4({className:e,...t}){return s.jsx(U4,{"data-slot":"progress-indicator",className:Ue("h-full rounded-[inherit] bg-primary transition-[width] duration-300 ease-out",e),...t})}const py=[];let my;function $4(){return my}function q4(e){py.push(e)}function rh(e){const t=(a,o)=>{const c=Ds(G4).current;let d;try{my=c;for(const f of py)f.before(c);d=e(a,o);for(const f of py)f.after(c);c.didInitialize=!0}finally{my=void 0}return d};return t.displayName=e.displayName||e.name,t}function L1(e){return x.forwardRef(rh(e))}function G4(){return{didInitialize:!1}}const z1=x.createContext(void 0);function nf(e){const t=x.useContext(z1);if(t===void 0&&!e)throw new Error(on(72));return t}function K4(e,t){return t!=null&&!uo(t)?0:typeof e=="function"?e():e}function Oi(e,t,a){const o=K4(e,a);return typeof o=="number"?o:o?.[t]}function B1(e){return typeof e=="function"?e():e}function H1(e,t){return t||e==="click"||e==="mousedown"}function Y4(e){return e?.includes("mouse")&&e!=="mousedown"}const U1=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new sa,currentIdRef:{current:null},currentContextRef:{current:null}});function X4(e,t){e.current=t.current}function Q4(e){const{children:t,delay:a,timeoutMs:o=0}=e,c=x.useRef(a),d=x.useRef(a),f=x.useRef(null),p=x.useRef(null),h=Zs();return De(()=>{if(d.current=a,!f.current){c.current=a;return}c.current={open:Oi(c.current,"open"),close:Oi(a,"close")}},[a,f,c,d]),s.jsx(U1.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:c,initialDelayRef:d,currentIdRef:f,timeoutMs:o,currentContextRef:p,timeout:h}),[o,h]),children:t})}function Z4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,c=o.useState("floatingId"),d=x.useContext(U1),{currentIdRef:f,delayRef:p,timeoutMs:h,initialDelayRef:v,currentContextRef:y,hasProvider:b,timeout:j}=d,[w,k]=x.useState(!1),S=x.useRef(a);return De(()=>{S.current=a},[a]),De(()=>{function N(){y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,p.current=v.current,j.clear()}if(f.current&&!a&&f.current===c){if(k(!1),h){const T=c;return j.start(h,()=>{o.select("open")||f.current&&f.current!==T||N()}),()=>{(S.current||f.current!==T)&&j.clear()}}N()}},[a,c,f,p,h,v,y,j,o]),De(()=>{if(!a)return;const N=y.current,T=f.current;j.clear(),y.current={onOpenChange:o.setOpen,setIsInstantPhase:k},f.current=c,p.current={open:0,close:Oi(v.current,"close")},T!==null&&T!==c?(k(!0),N?.setIsInstantPhase(!0),N?.onOpenChange(!1,$e(Yn))):(k(!1),N?.setIsInstantPhase(!1))},[a,c,o,f,p,v,y,j]),De(()=>()=>{if(f.current===c){if(y.current=null,!S.current)return;f.current=null,X4(p,v),j.clear()}},[y,f,p,c,v,j]),x.useMemo(()=>({activeIdRef:f,hasProvider:b,delayRef:p,isInstantPhase:w}),[f,b,p,w])}function St(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function Ya(...e){return()=>{for(let t=0;t{t.current=t.next}};return t}const Jc=x.forwardRef(function(t,a){const[o,c]=x.useState();De(()=>{wB&&yl&&c("button")},[]);const d={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Ai,"aria-hidden":o?void 0:!0,...d,"data-base-ui-focus-guard":""})});function sf(e){return`data-base-ui-${e}`}let ah=0;function lh(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:c}=t;cancelAnimationFrame(ah);function d(){c&&!c()||e?.focus({preventScroll:a})}if(o)return d(),qt;const f=requestAnimationFrame(d);return ah=f,()=>{ah===f&&(cancelAnimationFrame(f),ah=0)}}const hy={inert:new WeakMap,"aria-hidden":new WeakMap},V1="data-base-ui-inert",gy={inert:new WeakSet,"aria-hidden":new WeakSet};let rf=new WeakMap,xy=0;function J4(e){return gy[e]}function F1(e){return e?Hc(e)?e.host:F1(e.parentNode):null}const $1=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=F1(a);return e.contains(o)?o:null}).filter(a=>a!=null),q1=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},G1=(e,t,a)=>{const o=[],c=d=>{!d||a.has(d)||Array.from(d.children).forEach(f=>{Hs(f)!=="script"&&(t.has(f)?c(f):o.push(f))})};return c(e),o};function eH(e,t,a,o,{mark:c=!0}){let d=null;o?d="inert":a&&(d="aria-hidden");let f=null,p=null;const h=$1(t,e),v=c?G1(t,q1(h),new Set(h)):[],y=[],b=[];if(d){const j=hy[d],w=J4(d);p=w,f=j;const k=$1(t,Array.from(t.querySelectorAll("[aria-live]"))),S=h.concat(k);G1(t,q1(S),new Set(S)).forEach(T=>{const D=T.getAttribute(d),C=D!==null&&D!=="false",A=(j.get(T)||0)+1;j.set(T,A),y.push(T),A===1&&C&&w.add(T),C||T.setAttribute(d,d==="inert"?"":"true")})}return c&&v.forEach(j=>{const w=(rf.get(j)||0)+1;rf.set(j,w),b.push(j),w===1&&j.setAttribute(V1,"")}),xy+=1,()=>{f&&y.forEach(j=>{const k=(f.get(j)||0)-1;f.set(j,k),k||(!p?.has(j)&&d&&j.removeAttribute(d),p?.delete(j))}),c&&b.forEach(j=>{const w=(rf.get(j)||0)-1;rf.set(j,w),w||j.removeAttribute(V1)}),xy-=1,xy||(hy.inert=new WeakMap,hy["aria-hidden"]=new WeakMap,gy.inert=new WeakSet,gy["aria-hidden"]=new WeakSet,rf=new WeakMap)}}function K1(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:c=!0}=t,d=$t(e[0]).body;return eH(e,d,a,o,{mark:c})}const tH=500,nH={style:{transition:"none"}},Y1="data-base-ui-click-trigger",X1={fallbackAxisSide:"none"},Q1={fallbackAxisSide:"end"},sH={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Z1=x.createContext(null),W1=()=>x.useContext(Z1),rH=sf("portal");function J1(e={}){const{ref:t,container:a,componentProps:o=fn,elementProps:c}=e,d=Gd(),p=W1()?.portalNode,[h,v]=x.useState(null),[y,b]=x.useState(null),j=Ie(N=>{N!==null&&b(N)}),w=x.useRef(null);De(()=>{if(a===null){w.current&&(w.current=null,b(null),v(null));return}const N=(a&&(Sv(a)?a:a.current))??p??document.body;if(N==null){w.current&&(w.current=null,b(null),v(null));return}w.current!==N&&(w.current=N,b(null),v(N))},[a,p]);const k=yt("div",o,{ref:[t,j],props:[{id:d,[rH]:""},c]}),S=h&&k?Cs.createPortal(k,h):null;return{node:y,nodeId:x.isValidElement(k)?k.props.id:void 0,subtree:S}}const oh=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,container:p,portalOwnerRole:h,...v}=t,{node:y,nodeId:b,subtree:j}=J1({container:p,ref:a,componentProps:t,elementProps:v}),w=x.useRef(null),k=x.useRef(null),S=x.useRef(null),N=x.useRef(null),[T,D]=x.useState(null),C=x.useRef(!1),A=T?.modal,R=T?.open,I=!!T&&!T.modal&&T.open&&!!y;x.useEffect(()=>{if(!y||A)return;function O(_){y&&_.relatedTarget&&Kc(_)&&(_.type==="focusin"?C.current&&(v1(y),C.current=!1):(s4(y),C.current=!0))}return Ya(St(y,"focusin",O,!0),St(y,"focusout",O,!0))},[y,A]),De(()=>{!y||R!==!0||!C.current||(v1(y),C.current=!1)},[R,y]);const P=x.useMemo(()=>({beforeOutsideRef:w,afterOutsideRef:k,beforeInsideRef:S,afterInsideRef:N,portalNode:y,setFocusManagerState:D}),[y]);return s.jsxs(x.Fragment,{children:[j,s.jsxs(Z1.Provider,{value:P,children:[I&&y&&s.jsx(Jc,{"data-type":"outside",ref:w,onFocus:O=>{if(Kc(O,y))S.current?.focus();else{const _=T?T.domReference:null;x1(_)?.focus()}}}),I&&y&&s.jsx("span",{role:h,"aria-owns":b,style:sH}),y&&Cs.createPortal(f,y),I&&y&&s.jsx(Jc,{"data-type":"outside",ref:k,onFocus:O=>{if(Kc(O,y))N.current?.focus();else{const _=T?T.domReference:null;ry(_)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,$e(go,O.nativeEvent))}}})]})]})});function eT(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class aH{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",eT())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const tT=x.createContext(null),nT=x.createContext(null),eu=()=>x.useContext(tT)?.id||null,Mi=e=>{const t=x.useContext(nT);return e??t};function lH(e){const t=Gd(),a=Mi(e),o=eu();return De(()=>{if(!t)return;const c={id:t,parentId:o};return a?.addNode(c),()=>{a?.removeNode(c)}},[a,t,o]),t}function oH(e){const{children:t,id:a}=e,o=eu();return s.jsx(tT.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function iH(e){const{children:t,externalTree:a}=e,o=Ds(()=>a??new aH).current;return s.jsx(nT.Provider,{value:o,children:t})}function cH(e,t){const a=Sn(cs(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const sT=20;let bo=[];function by(){bo=bo.filter(e=>e.deref()?.isConnected)}function rT(e){by(),e&&Hs(e)!=="body"&&(bo.push(new WeakRef(e)),bo.length>sT&&(bo=bo.slice(-sT)))}function aT(){return by(),bo[bo.length-1]?.deref()}function uH(e){return e?sy(e)?e:Qd(e)[0]||e:null}function lT(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=h1(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return sy(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ih(e){const{context:t,children:a,disabled:o=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:v="",nextFocusableElement:y,previousFocusableElement:b,beforeContentFocusGuardRef:j,externalTree:w,getInsideElements:k}=e,S="rootStore"in t?t.rootStore:t,N=S.useState("open"),T=S.useState("domReferenceElement"),D=S.useState("floatingElement"),{events:C,dataRef:A}=S.context,R=Ie(()=>A.current.floatingContext?.nodeId),I=c===!1,P=Yv(T)&&I,O=Xn(c),_=Xn(d),L=Xn(v),H=Xn(N),B=Mi(w),z=W1(),Q=x.useRef(!1),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef(null),$=x.useRef(""),Y=x.useRef(""),F=x.useRef(null),G=x.useRef(null),W=ea(F,j,z?.beforeInsideRef),le=ea(G,z?.afterInsideRef),M=Zs(),U=Zs(),Z=Yc(),ae=z!=null,ce=Gm(D),J=Ie((ee=ce)=>ee?Qd(ee):[]),ie=Ie(()=>k?.().filter(ee=>ee!=null)??[]);x.useEffect(()=>{if(o||!p)return;function ee(te){te.key==="Tab"&&Qe(ce,or($t(ce)))&&J().length===0&&!P&&ks(te)}const fe=$t(ce);return St(fe,"keydown",ee)},[o,ce,p,P,J]),x.useEffect(()=>{if(o||!N)return;const ee=$t(ce);function fe(){X.current=!1}function te(re){const de=cs(re),ke=ie(),Ee=Qe(D,de)||Qe(T,de)||Qe(z?.portalNode,de)||ke.some(ve=>ve===de||Qe(ve,de));X.current=!Ee,Y.current=re.pointerType||"keyboard",de?.closest(`[${Y1}]`)&&(K.current=!0,U.start(0,()=>{K.current=!1}))}function Ce(){Y.current="keyboard"}return Ya(St(ee,"pointerdown",te,!0),St(ee,"pointerup",fe,!0),St(ee,"pointercancel",fe,!0),St(ee,"keydown",Ce,!0),fe)},[o,D,T,ce,N,z,U,ie]),x.useEffect(()=>{if(o||!h)return;const ee=$t(ce);function fe(){K.current=!0,U.start(0,()=>{K.current=!1})}function te(ke){const Ee=cs(ke);sy(Ee)&&(q.current=Ee)}function Ce(ke){const Ee=ke.relatedTarget,ve=ke.currentTarget,he=cs(ke);p&&Ee==null&&he!=null&&Qe(D,he)&&rT(he),queueMicrotask(()=>{const ye=R(),we=S.context.triggerElements,xe=ie(),Te=Ee?.hasAttribute(sf("focus-guard"))&&[F.current,G.current,z?.beforeInsideRef.current,z?.afterInsideRef.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,Nl(b),Nl(y)].includes(Ee),Oe=!(Qe(T,Ee)||Qe(D,Ee)||Qe(Ee,D)||Qe(z?.portalNode,Ee)||xe.some(Ne=>Ne===Ee||Qe(Ne,Ee))||we.hasMatchingElement(Ne=>Qe(Ne,Ee))||Te||B&&(co(B.nodesRef.current,ye).find(Ne=>Qe(Ne.context?.elements.floating,Ee)||Qe(Ne.context?.elements.domReference,Ee))||r1(B.nodesRef.current,ye).find(Ne=>[Ne.context?.elements.floating,Gm(Ne.context?.elements.floating)].includes(Ee)||Ne.context?.elements.domReference===Ee)));if(ve===T&&ce&&lT(ce),f&&ve!==T&&!Wm(he)&&or(ee)===ee.body){if(dn(ce)&&(ce.focus(),f==="popup")){Z.request(()=>{ce.focus()});return}const Ne=J(),Le=q.current,Ye=(Le&&Ne.includes(Le)?Le:null)||Ne[Ne.length-1]||ce;dn(Ye)&&Ye.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(P||!p)&&Ee&&Oe&&!K.current&&(P||Ee!==aT())&&(Q.current=!0,S.setOpen(!1,$e(go,ke)))})}function re(){X.current||(A.current.insideReactTree=!0,M.start(0,()=>{A.current.insideReactTree=!1}))}const de=dn(T)?T:null;if(!(!D&&!de))return Ya(de&&St(de,"focusout",Ce),de&&St(de,"pointerdown",fe),D&&St(D,"focusin",te),D&&St(D,"focusout",Ce),D&&z&&St(D,"focusout",re,!0))},[o,T,D,ce,p,B,z,S,h,f,J,P,R,A,M,U,Z,y,b,ie]),x.useEffect(()=>{if(o||!D||!N)return;const ee=Array.from(z?.portalNode?.querySelectorAll(`[${sf("portal")}]`)||[]),te=(B?r1(B.nodesRef.current,R()):[]).find(ve=>Yv(ve.context?.elements.domReference||null))?.context?.elements.domReference,re=[...[D,...ee,F.current,G.current,z?.beforeOutsideRef.current,z?.afterOutsideRef.current,...ie()],te,Nl(b),Nl(y),P?T:null].filter(ve=>ve!=null),de=K1(re,{ariaHidden:p||P,mark:!1}),ke=[D,...ee].filter(ve=>ve!=null),Ee=K1(ke);return()=>{Ee(),de()}},[N,o,T,D,p,z,P,B,R,y,b,ie]),De(()=>{if(!N||o||!dn(ce))return;$.current="",Y.current="";const ee=$t(ce),fe=or(ee);queueMicrotask(()=>{const te=O.current,Ce=typeof te=="function"?te(L.current||""):te;if(Ce===void 0||Ce===!1||Qe(ce,fe))return;let de=null;const ke=()=>(de==null&&(de=J(ce)),de[0]||ce);let Ee;Ce===!0||Ce===null?Ee=ke():Ee=Nl(Ce),Ee=Ee||ke();const ve=Qe(ce,or(ee));lh(Ee,{preventScroll:Ee===ce,shouldFocus(){if(!H.current)return!1;if(ve)return!0;const he=or(ee);return!(he!==Ee&&Qe(ce,he))}})})},[o,N,ce,J,O,L,H]),De(()=>{if(o||!ce)return;const ee=$t(ce),fe=or(ee),te=L.current==null;rT(fe);function Ce(de){if(de.open||($.current=cH(de.nativeEvent,Y.current)),de.reason===Vs&&de.nativeEvent.type==="mouseleave"&&(Q.current=!0),de.reason===sh)if(de.nested)Q.current=!1;else if(Km(de.nativeEvent)||Xv(de.nativeEvent))Q.current=!1;else{let ke=!1;$t(ce).createElement("div").focus({get preventScroll(){return ke=!0,!1}}),ke?Q.current=!1:Q.current=!0}}C.on("openchange",Ce);function re(de){const ke=_.current;let Ee=typeof ke=="function"?ke(de):ke;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const ve=T?.isConnected?T:null,he=fe?.isConnected&&Hs(fe)!=="body"?fe:null;let ye=te?he||ve:ve||he;return ye||(ye=aT()||null),typeof Ee=="boolean"?ye:Nl(Ee)||ye||null}return()=>{C.off("openchange",Ce);const de=or(ee),ke=ie(),Ee=Qe(D,de)||ke.some(we=>we===de||Qe(we,de))||B&&co(B.nodesRef.current,R(),!1).some(we=>Qe(we.context?.elements.floating,de)),ve=_.current,he=$.current,ye=re(he);queueMicrotask(()=>{const we=uH(ye),xe=typeof ve!="boolean";if(ve&&!Q.current&&dn(we)&&(!(!xe&&we!==de&&de!==ee.body)||Ee)){const Te={preventScroll:!0};he==="keyboard"&&(Te.focusVisible=!0),we.focus(Te)}Q.current=!1})}},[o,D,ce,_,L,C,B,T,R,ie]),De(()=>{if(!yl||N||!D)return;const ee=or($t(D));!dn(ee)||!qm(ee)||Qe(D,ee)&&ee.blur()},[N,D]),De(()=>{if(!(o||!z))return z.setFocusManagerState({modal:p,closeOnFocusOut:h,open:N,onOpenChange:S.setOpen,domReference:T}),()=>{z.setFocusManagerState(null)}},[o,z,p,N,S,h,T]),De(()=>{if(!(o||!ce))return lT(ce),()=>{queueMicrotask(by)}},[o,ce]);const ge=!o&&(p?!P:!0)&&(ae||p);return s.jsxs(x.Fragment,{children:[ge&&s.jsx(Jc,{"data-type":"inside",ref:W,onFocus:ee=>{if(p){const fe=J();lh(fe[fe.length-1])}else z?.portalNode&&(Q.current=!1,Kc(ee,z.portalNode)?ry(T)?.focus():Nl(b??z.beforeOutsideRef)?.focus())}}),a,ge&&s.jsx(Jc,{"data-type":"inside",ref:le,onFocus:ee=>{p?lh(J()[0]):z?.portalNode&&(h&&(Q.current=!0),Kc(ee,z.portalNode)?x1(T)?.focus():Nl(y??z.afterOutsideRef)?.focus())}})]})}function ch(e,t={}){const{enabled:a=!0,event:o="click",toggle:c=!0,ignoreMouse:d=!1,stickIfOpen:f=!0,touchOpenDelay:p=0,reason:h=ho}=t,v="rootStore"in e?e.rootStore:e,y=v.context.dataRef,b=x.useRef(void 0),j=Yc(),w=Zs(),k=x.useMemo(()=>{function S(T,D,C,A){const R=$e(h,D,C);T&&A==="touch"&&p>0?w.start(p,()=>{v.setOpen(!0,R)}):v.setOpen(T,R)}function N(T,D,C){const A=y.current.openEvent,R=v.select("domReferenceElement")!==D;return T&&R||!T||!c?!0:A&&f?!C(A.type):!1}return{onPointerDown(T){b.current=uo(T.pointerType,!0)&&Xv(T.nativeEvent)?"virtual":T.pointerType},onMouseDown(T){const D=b.current,C=T.nativeEvent,A=v.select("open");if(T.button!==0||o==="click"||uo(D,!0)&&d)return;const R=N(A,T.currentTarget,O=>O==="click"||O==="mousedown"),I=cs(C);if(qm(I)){S(R,C,I,D);return}const P=T.currentTarget;j.request(()=>{S(R,C,P,D)})},onClick(T){if(o==="mousedown-only")return;const D=b.current;if(o==="mousedown"&&D){b.current=void 0;return}if(uo(D,!0)&&d)return;const C=v.select("open"),A=N(C,T.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");S(A,T.nativeEvent,T.currentTarget,D)},onKeyDown(){b.current=void 0}}},[y,o,d,h,v,f,c,j,w,p]);return x.useMemo(()=>a?{reference:k}:fn,[a,k])}function dH(e,t){let a=null,o=null,c=!1;return{contextElement:e||void 0,getBoundingClientRect(){const d=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",h=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let v=d.width,y=d.height,b=d.x,j=d.y;return a==null&&t.x&&f&&(a=d.x-t.x),o==null&&t.y&&p&&(o=d.y-t.y),b-=a||0,j-=o||0,v=0,y=0,!c||h?(v=t.axis==="y"?d.width:0,y=t.axis==="x"?d.height:0,b=f&&t.x!=null?t.x:b,j=p&&t.y!=null?t.y:j):c&&!h&&(y=t.axis==="x"?d.height:y,v=t.axis==="y"?d.width:v),c=!0,{width:v,height:y,x:b,y:j,top:j,right:b+v,bottom:j+y,left:b}}}}function oT(e){return e!=null&&e.clientX!=null}function fH(e,t={}){const{enabled:a=!0,axis:o="both"}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),h=c.context.dataRef,v=x.useRef(!1),y=x.useRef(null),[b,j]=x.useState(),[w,k]=x.useState([]),S=Ie(A=>{c.set("positionReference",A)}),N=Ie((A,R,I)=>{v.current||h.current.openEvent&&!oT(h.current.openEvent)||c.set("positionReference",dH(I??p,{x:A,y:R,axis:o,dataRef:h,pointerType:b}))}),T=Ie(A=>{d?y.current||(N(A.clientX,A.clientY,A.currentTarget),k([])):N(A.clientX,A.clientY,A.currentTarget)}),D=uo(b)?f:d;x.useEffect(()=>{if(!a){S(p);return}if(!D)return;function A(){y.current?.(),y.current=null}const R=Sn(f);function I(P){const O=cs(P);Qe(f,O)?A():N(P.clientX,P.clientY)}return!h.current.openEvent||oT(h.current.openEvent)?y.current=St(R,"mousemove",I):S(p),A},[D,a,f,h,p,c,N,S,w]),x.useEffect(()=>()=>{c.set("positionReference",null)},[c]),x.useEffect(()=>{a&&!f&&(v.current=!1)},[a,f]),x.useEffect(()=>{!a&&d&&(v.current=!0)},[a,d]);const C=x.useMemo(()=>{function A(R){j(R.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:T,onMouseEnter:T}},[T]);return x.useMemo(()=>a?{reference:C,trigger:C}:{},[a,C])}function pH(){return!1}function mH(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function af(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:f=pH,bubbles:p,externalTree:h}=t,v="rootStore"in e?e.rootStore:e,y=v.useState("open"),b=v.useState("floatingElement"),{dataRef:j,events:w}=v.context,k=Mi(h),S=Ie(typeof c=="function"?c:()=>!1),N=typeof c=="function"?S:c,T=N!==!1,D=Ie(()=>d),{escapeKey:C,outsidePress:A}=mH(p),R=x.useRef(!1),I=x.useRef(!1),P=x.useRef(!1),O=x.useRef(!1),_=x.useRef(!1),L=x.useRef(""),H=x.useRef(null),B=Zs(),z=Zs(),Q=Ie(()=>{z.clear(),j.current.insideReactTree=!1}),K=Ie(M=>{const U=j.current.floatingContext?.nodeId;return(k?co(k.nodesRef.current,U):[]).some(ae=>ae.context?.open&&!ae.context.dataRef.current[M])}),X=Ie(M=>Kv(M,v.select("floatingElement"))||Kv(M,v.select("domReferenceElement"))),q=Ie(M=>{f()&&v.setOpen(!1,$e(ho,M.nativeEvent))}),$=Ie(M=>{if(!y||!a||!o||M.key!=="Escape"||_.current||!C&&K("__escapeKeyBubbles"))return;const U=zB(M)?M.nativeEvent:M,Z=$e(Qc,U);v.setOpen(!1,Z),Z.isCanceled||M.preventDefault(),!C&&!Z.isPropagationAllowed&&M.stopPropagation()}),Y=Ie(()=>{j.current.insideReactTree=!0,z.start(0,Q)}),F=Ie(M=>{if(!y||!a||M.button!==0)return;const U=cs(M.nativeEvent);Qe(v.select("floatingElement"),U)&&(R.current||(R.current=!0,I.current=!1))}),G=Ie(M=>{!y||!a||(M.defaultPrevented||M.nativeEvent.defaultPrevented)&&R.current&&(I.current=!0)});x.useEffect(()=>{function M(U){U.open||(O.current=!1)}return w.on("openchange",M),()=>{w.off("openchange",M)}},[w]),x.useEffect(()=>{if(!y||!a)return y||(O.current=!1),Q;j.current.__escapeKeyBubbles=C,j.current.__outsidePressBubbles=A;const M=new sa,U=new sa,Z=$t(b);function ae(){M.clear(),_.current=!0}function ce(){M.start(yl?5:0,()=>{_.current=!1})}function J(){P.current=!0,U.start(0,()=>{P.current=!1})}function ie(){R.current=!1,I.current=!1}function ge(){const Oe=L.current,Ne=Oe==="pen"||!Oe?"mouse":Oe,Le=D(),Ye=typeof Le=="function"?Le():Le;return typeof Ye=="string"?Ye:Ye[Ne]}function ee(Oe){const Ne=ge();return Ne==="intentional"&&Oe.type!=="click"||Ne==="sloppy"&&Oe.type==="click"}function fe(Oe){const Ne=j.current.floatingContext?.nodeId,Le=k&&co(k.nodesRef.current,Ne).some(Ye=>Kv(Oe,Ye.context?.elements.floating));return X(Oe)||Le}function te(Oe){if(ee(Oe)){Oe.type!=="click"&&!X(Oe)&&(U.clear(),P.current=!1),Q();return}if(j.current.insideReactTree){Q();return}const Ne=cs(Oe),Le=`[${sf("inert")}]`,Ye=At(Ne)?Ne.getRootNode():null,kt=Array.from((Hc(Ye)?Ye:$t(v.select("floatingElement"))).querySelectorAll(Le)),Ct=v.context.triggerElements;if(Ne&&(Ct.hasElement(Ne)||Ct.hasMatchingElement(ot=>Qe(ot,Ne))))return;let Rt=At(Ne)?Ne:null;for(;Rt&&!so(Rt);){const ot=ro(Rt);if(so(ot)||!At(ot))break;Rt=ot}if(!(kt.length&&At(Ne)&&!PB(Ne)&&!Qe(Ne,v.select("floatingElement"))&&kt.every(ot=>!Qe(Rt,ot)))){if(dn(Ne)&&!("touches"in Oe)){const ot=so(Ne),qn=br(Ne),ps=/auto|scroll/,Gn=ot||ps.test(qn.overflowX),bs=ot||ps.test(qn.overflowY),it=Gn&&Ne.clientWidth>0&&Ne.scrollWidth>Ne.clientWidth,Vt=bs&&Ne.clientHeight>0&&Ne.scrollHeight>Ne.clientHeight,Hn=qn.direction==="rtl",tn=Vt&&(Hn?Oe.offsetX<=Ne.offsetWidth-Ne.clientWidth:Oe.offsetX>Ne.clientWidth),nt=it&&Oe.offsetY>Ne.clientHeight;if(tn||nt)return}if(!fe(Oe)){if(ge()==="intentional"){if(Oe.detail!==0&&!Km(Oe)&&!O.current)return;if(P.current){U.clear(),P.current=!1;return}}typeof N=="function"&&!N(Oe)||K("__outsidePressBubbles")||(v.setOpen(!1,$e(sh,Oe)),Q())}}}function Ce(Oe){ge()!=="sloppy"||Oe.pointerType==="touch"||!v.select("open")||!a||X(Oe)||te(Oe)}function re(Oe){if(ge()!=="sloppy"||!v.select("open")||!a||X(Oe))return;const Ne=Oe.touches[0];Ne&&(H.current={startTime:Date.now(),startX:Ne.clientX,startY:Ne.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},B.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function de(Oe,Ne){const Le=cs(Oe);if(!Le)return;const Ye=St(Le,Oe.type,()=>{Ne(Oe),Ye()})}function ke(Oe){L.current="touch",de(Oe,re)}function Ee(Oe){B.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),L.current=Oe.pointerType),!(Oe.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&de(Oe,Ne=>{Ne.type==="pointerdown"?Ce(Ne):te(Ne)})}function ve(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!R.current)return;const Ne=I.current;if(ie(),ge()==="intentional"){if(Oe.type==="pointercancel"){Ne&&J();return}if(!fe(Oe)){if(Ne){J();return}typeof N=="function"&&!N(Oe)||(U.clear(),P.current=!0,Q())}}}function he(Oe){if(ge()!=="sloppy"||!H.current||X(Oe))return;const Ne=Oe.touches[0];if(!Ne)return;const Le=Math.abs(Ne.clientX-H.current.startX),Ye=Math.abs(Ne.clientY-H.current.startY),kt=Math.sqrt(Le*Le+Ye*Ye);kt>5&&(H.current.dismissOnTouchEnd=!0),kt>10&&(te(Oe),B.clear(),H.current=null)}function ye(Oe){de(Oe,he)}function we(Oe){ge()!=="sloppy"||!H.current||X(Oe)||(H.current.dismissOnTouchEnd&&te(Oe),B.clear(),H.current=null)}function xe(Oe){de(Oe,we)}const Te=Ya(o&&Ya(St(Z,"keydown",$),St(Z,"compositionstart",ae),St(Z,"compositionend",ce)),T&&Ya(St(Z,"click",Ee,!0),St(Z,"pointerdown",Ee,!0),St(Z,"pointerup",ve,!0),St(Z,"pointercancel",ve,!0),St(Z,"mousedown",Ee,!0),St(Z,"mouseup",ve,!0),St(Z,"touchstart",ke,{capture:!0,passive:!0}),St(Z,"touchmove",ye,{capture:!0,passive:!0}),St(Z,"touchend",xe,{capture:!0,passive:!0})));return()=>{Te(),M.clear(),U.clear(),ie(),P.current=!1,Q()}},[j,b,o,T,N,y,a,C,A,$,Q,D,K,X,k,v,B]);const W=x.useMemo(()=>({onKeyDown:$,onPointerDown:q,onClick:q}),[$,q]),le=x.useMemo(()=>({onKeyDown:$,onPointerDown:G,onMouseDown:G,onClickCapture:Y,onMouseDownCapture(M){Y(),F(M)},onPointerDownCapture(M){Y(),F(M)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[$,Y,F,G]);return x.useMemo(()=>a?{reference:W,floating:le,trigger:W}:{},[a,W,le])}function iT(e,t,a){let{reference:o,floating:c}=e;const d=na(t),f=Wv(t),p=Zv(f),h=ta(t),v=d==="y",y=o.x+o.width/2-c.width/2,b=o.y+o.height/2-c.height/2,j=o[p]/2-c[p]/2;let w;switch(h){case"top":w={x:y,y:o.y-c.height};break;case"bottom":w={x:y,y:o.y+o.height};break;case"right":w={x:o.x+o.width,y:b};break;case"left":w={x:o.x-c.width,y:b};break;default:w={x:o.x,y:o.y}}const k=Sl(t);return k&&(w[f]+=j*(k==="end"?1:-1)*(a&&v?-1:1)),w}async function hH(e,t){var a;t===void 0&&(t={});const{x:o,y:c,platform:d,rects:f,elements:p,strategy:h}=e,{boundary:v="clippingAncestors",rootBoundary:y="viewport",elementContext:b="floating",altBoundary:j=!1,padding:w=0}=fo(t,e),k=i1(w),N=p[j?b==="floating"?"reference":"floating":b],T=Xd(await d.getClippingRect({element:(a=await(d.isElement==null?void 0:d.isElement(N)))==null||a?N:N.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(p.floating)),boundary:v,rootBoundary:y,strategy:h})),D=b==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,C=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p.floating)),A=await(d.isElement==null?void 0:d.isElement(C))&&await(d.getScale==null?void 0:d.getScale(C))||{x:1,y:1},R=Xd(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:D,offsetParent:C,strategy:h}):D);return{top:(T.top-R.top+k.top)/A.y,bottom:(R.bottom-T.bottom+k.bottom)/A.y,left:(T.left-R.left+k.left)/A.x,right:(R.right-T.right+k.right)/A.x}}const gH=50,xH=async(e,t,a)=>{const{placement:o="bottom",strategy:c="absolute",middleware:d=[],platform:f}=a,p=f.detectOverflow?f:{...f,detectOverflow:hH},h=await(f.isRTL==null?void 0:f.isRTL(t));let v=await f.getElementRects({reference:e,floating:t,strategy:c}),{x:y,y:b}=iT(v,o,h),j=o,w=0;const k={};for(let S=0;SQ<=0)){var H,B;const Q=(((H=d.flip)==null?void 0:H.index)||0)+1,K=P[Q];if(K&&(!(b==="alignment"?D!==na(K):!1)||L.every($=>na($.placement)===D?$.overflows[0]>0:!0)))return{data:{index:Q,overflows:L},reset:{placement:K}};let X=(B=L.filter(q=>q.overflows[0]<=0).sort((q,$)=>q.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!X)switch(w){case"bestFit":{var z;const q=(z=L.filter($=>{if(I){const Y=na($.placement);return Y===D||Y==="y"}return!0}).map($=>[$.placement,$.overflows.filter(Y=>Y>0).reduce((Y,F)=>Y+F,0)]).sort(($,Y)=>$[1]-Y[1])[0])==null?void 0:z[0];q&&(X=q);break}case"initialPlacement":X=p;break}if(c!==X)return{reset:{placement:X}}}return{}}}},cT=new Set(["left","top"]);async function vH(e,t){const{placement:a,platform:o,elements:c}=e,d=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=ta(a),p=Sl(a),h=na(a)==="y",v=cT.has(f)?-1:1,y=d&&h?-1:1,b=fo(t,e);let{mainAxis:j,crossAxis:w,alignmentAxis:k}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return p&&typeof k=="number"&&(w=p==="end"?k*-1:k),h?{x:w*y,y:j*v}:{x:j*v,y:w*y}}const yH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:c,y:d,placement:f,middlewareData:p}=t,h=await vH(t,e);return f===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+h.x,y:d+h.y,data:{...h,placement:f}}}}},jH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:c,platform:d}=t,{mainAxis:f=!0,crossAxis:p=!1,limiter:h={fn:D=>{let{x:C,y:A}=D;return{x:C,y:A}}},...v}=fo(e,t),y={x:a,y:o},b=await d.detectOverflow(t,v),j=na(c),w=Qv(j);let k=y[w],S=y[j];const N=(D,C)=>a1(C+b[D==="y"?"top":"left"],C,C-b[D==="y"?"bottom":"right"]);f&&(k=N(w,k)),p&&(S=N(j,S));const T=h.fn({...t,[w]:k,[j]:S});return{...T,data:{x:T.x-a,y:T.y-o,enabled:{[w]:f,[j]:p}}}}}},wH=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,o;const{x:c,y:d,placement:f,rects:p,middlewareData:h}=t,{offset:v=0,mainAxis:y=!0,crossAxis:b=!0}=fo(e,t),j={x:c,y:d},w=na(f),k=Qv(w);let S=j[k],N=j[w];const T=fo(v,t),D=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(a=T.mainAxis)!=null?a:0,crossAxis:(o=T.crossAxis)!=null?o:0};if(y){const R=k==="y"?"height":"width",I=p.reference[k]-p.floating[R]+D.mainAxis,P=p.reference[k]+p.reference[R]-D.mainAxis;SP&&(S=P)}if(b){var C,A;const R=k==="y"?"width":"height",I=cT.has(ta(f)),P=p.reference[w]-p.floating[R]+(I&&((C=h.offset)==null?void 0:C[w])||0)+(I?0:D.crossAxis),O=p.reference[w]+p.reference[R]+(I?0:((A=h.offset)==null?void 0:A[w])||0)-(I?D.crossAxis:0);NO&&(N=O)}return{[k]:S,[w]:N}}}},SH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:o,platform:c,elements:d}=t,{apply:f=()=>{},...p}=fo(e,t),h=await c.detectOverflow(t,p),v=ta(a),y=Sl(a),b=na(a)==="y",{width:j,height:w}=o.floating;let k,S;v==="top"||v==="bottom"?(k=v,S=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(S=v,k=y==="end"?"top":"bottom");const N=w-h.top-h.bottom,T=j-h.left-h.right,D=Gc(w-h[k],N),C=Gc(j-h[S],T),A=t.middlewareData.shift,R=!A;let I=D,P=C;A!=null&&A.enabled.x&&(P=T),A!=null&&A.enabled.y&&(I=N),R&&!y&&(b?P=j-2*jl(h.left,h.right):I=w-2*jl(h.top,h.bottom)),await f({...t,availableWidth:P,availableHeight:I});const O=await c.getDimensions(d.floating);return j!==O.width||w!==O.height?{reset:{rects:!0}}:{}}}};function uT(e){const t=br(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const c=dn(e),d=c?e.offsetWidth:a,f=c?e.offsetHeight:o,p=Ym(a)!==d||Ym(o)!==f;return p&&(a=d,o=f),{width:a,height:o,$:p}}function vy(e){return At(e)?e:e.contextElement}function tu(e){const t=vy(e);if(!dn(t))return wl(1);const a=t.getBoundingClientRect(),{width:o,height:c,$:d}=uT(t);let f=(d?Ym(a.width):a.width)/o,p=(d?Ym(a.height):a.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const NH=wl(0);function dT(e){const t=Sn(e);return!Cv()||!t.visualViewport?NH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Sn(e)}function Di(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const c=e.getBoundingClientRect(),d=vy(e);let f=wl(1);t&&(o?At(o)&&(f=tu(o)):f=tu(e));const p=kH(d,a,o)?dT(d):wl(0);let h=(c.left+p.x)/f.x,v=(c.top+p.y)/f.y,y=c.width/f.x,b=c.height/f.y;if(d&&o){const j=Sn(d),w=At(o)?Sn(o):o;let k=j,S=Tv(k);for(;S&&w!==k;){const N=tu(S),T=S.getBoundingClientRect(),D=br(S),C=T.left+(S.clientLeft+parseFloat(D.paddingLeft))*N.x,A=T.top+(S.clientTop+parseFloat(D.paddingTop))*N.y;h*=N.x,v*=N.y,y*=N.x,b*=N.y,h+=C,v+=A,k=Sn(S),S=Tv(k)}}return Xd({width:y,height:b,x:h,y:v})}function uh(e,t){const a=Pm(e).scrollLeft;return t?t.left+a:Di(xl(e)).left+a}function fT(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-uh(e,a),c=a.top+t.scrollTop;return{x:o,y:c}}function CH(e){let{elements:t,rect:a,offsetParent:o,strategy:c}=e;const d=c==="fixed",f=xl(o),p=t?Im(t.floating):!1;if(o===f||p&&d)return a;let h={scrollLeft:0,scrollTop:0},v=wl(1);const y=wl(0),b=dn(o);if((b||!d)&&((Hs(o)!=="body"||Fd(f))&&(h=Pm(o)),b)){const w=Di(o);v=tu(o),y.x=w.x+o.clientLeft,y.y=w.y+o.clientTop}const j=f&&!b&&!d?fT(f,h):wl(0);return{width:a.width*v.x,height:a.height*v.y,x:a.x*v.x-h.scrollLeft*v.x+y.x+j.x,y:a.y*v.y-h.scrollTop*v.y+y.y+j.y}}function TH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function EH(e){const t=Pm(e),a=e.ownerDocument.body,o=jl(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=jl(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-t.scrollLeft+uh(e);const f=-t.scrollTop;return br(a).direction==="rtl"&&(d+=jl(e.clientWidth,a.clientWidth)-o),{width:o,height:c,x:d,y:f}}const AH=25;function RH(e,t,a){a===void 0&&(a="viewport");const o=a==="layoutViewport",c=Sn(e),d=xl(e),f=c.visualViewport;let p=d.clientWidth,h=d.clientHeight,v=0,y=0;if(f){const j=!Cv()||t==="fixed";o?j||(v=-f.offsetLeft,y=-f.offsetTop):(p=f.width,h=f.height,j&&(v=f.offsetLeft,y=f.offsetTop))}if(uh(d)<=0){const j=d.ownerDocument,w=j.body,k=getComputedStyle(w),S=j.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,N=Math.abs(d.clientWidth-w.clientWidth-S),T=getComputedStyle(d).scrollbarGutter==="stable both-edges"?N/2:N;T<=AH&&(p-=T)}return{width:p,height:h,x:v,y}}function OH(e,t){const a=Di(e,!0,t==="fixed"),o=a.top+e.clientTop,c=a.left+e.clientLeft,d=tu(e),f=e.clientWidth*d.x,p=e.clientHeight*d.y,h=c*d.x,v=o*d.y;return{width:f,height:p,x:h,y:v}}function pT(e,t,a){let o;if(t==="viewport"||t==="layoutViewport")o=RH(e,a,t);else if(t==="document")o=EH(xl(e));else if(At(t))o=OH(t,a);else{const c=dT(e);o={x:t.x-c.x,y:t.y-c.y,width:t.width,height:t.height}}return Xd(o)}function MH(e,t){const a=t.get(e);if(a)return a;let o=Uc(e,[],!1).filter(p=>At(p)&&Hs(p)!=="body"),c=null;const d=br(e).position==="fixed";let f=d?ro(e):e;for(;At(f)&&!so(f);){const p=br(f),h=kv(f),v=c?c.position:d?"fixed":"";!h&&(v==="fixed"||v==="absolute"&&p.position==="static")?o=o.filter(b=>b!==f):c=p,f=ro(f)}return t.set(e,o),o}function DH(e){let{element:t,boundary:a,rootBoundary:o,strategy:c}=e;const f=[...a==="clippingAncestors"?Im(t)?[]:MH(t,this._c):[].concat(a),o],p=pT(t,f[0],c);let h=p.top,v=p.right,y=p.bottom,b=p.left;for(let j=1;j{p(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(O,{...I,root:d.ownerDocument})}catch{o=new IntersectionObserver(O,I)}o.observe(e)}const h=Sn(e),v=()=>p(a);return h.addEventListener("resize",v),p(!0),()=>{h.removeEventListener("resize",v),f()}}function bT(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,v=vy(e),y=c||d?[...v?Uc(v):[],...t?Uc(t):[]]:[];y.forEach(T=>{c&&T.addEventListener("scroll",a),d&&T.addEventListener("resize",a)});const b=v&&p?zH(v,a,d):null;let j=-1,w=null;f&&(w=new ResizeObserver(T=>{let[D]=T;D&&D.target===v&&w&&t&&(w.unobserve(t),cancelAnimationFrame(j),j=requestAnimationFrame(()=>{var C;(C=w)==null||C.observe(t)})),a()}),v&&!h&&w.observe(v),t&&w.observe(t));let k,S=h?Di(e):null;h&&N();function N(){const T=Di(e);S&&!xT(S,T)&&a(),S=T,k=requestAnimationFrame(N)}return a(),()=>{var T;y.forEach(D=>{c&&D.removeEventListener("scroll",a),d&&D.removeEventListener("resize",a)}),b?.(),(T=w)==null||T.disconnect(),w=null,h&&cancelAnimationFrame(k)}}const BH=yH,HH=jH,UH=bH,VH=SH,FH=wH,$H=(e,t,a)=>{const o=new Map,c=a??{},d={...gT,...c.platform,_c:o};return xH(e,t,{...c,platform:d})};var qH=typeof document<"u",GH=function(){},dh=qH?x.useLayoutEffect:GH;function fh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,c;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!fh(e[o],t[o]))return!1;return!0}if(c=Object.keys(e),a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,c[o]))return!1;for(o=a;o--!==0;){const d=c[o];if(!(d==="_owner"&&e.$$typeof)&&!fh(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function vT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yT(e,t){const a=vT(e);return Math.round(t*a)/a}function jy(e){const t=x.useRef(e);return dh(()=>{t.current=e}),t}function KH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:c,elements:{reference:d,floating:f}={},transform:p=!0,whileElementsMounted:h,open:v}=e,[y,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[j,w]=x.useState(o);fh(j,o)||w(o);const[k,S]=x.useState(null),[N,T]=x.useState(null),D=x.useCallback($=>{$!==I.current&&(I.current=$,S($))},[]),C=x.useCallback($=>{$!==P.current&&(P.current=$,T($))},[]),A=d||k,R=f||N,I=x.useRef(null),P=x.useRef(null),O=x.useRef(y),_=h!=null,L=jy(h),H=jy(c),B=jy(v),z=x.useCallback(()=>{if(!I.current||!P.current)return;const $={placement:t,strategy:a,middleware:j};H.current&&($.platform=H.current),$H(I.current,P.current,$).then(Y=>{const F={...Y,isPositioned:B.current!==!1};Q.current&&!fh(O.current,F)&&(O.current=F,Cs.flushSync(()=>{b(F)}))})},[j,t,a,H,B]);dh(()=>{v===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,b($=>({...$,isPositioned:!1})))},[v]);const Q=x.useRef(!1);dh(()=>(Q.current=!0,()=>{Q.current=!1}),[]),dh(()=>{if(A&&(I.current=A),R&&(P.current=R),A&&R){if(L.current)return L.current(A,R,z);z()}},[A,R,z,L,_]);const K=x.useMemo(()=>({reference:I,floating:P,setReference:D,setFloating:C}),[D,C]),X=x.useMemo(()=>({reference:A,floating:R}),[A,R]),q=x.useMemo(()=>{const $={position:a,left:0,top:0};if(!X.floating)return $;const Y=yT(X.floating,y.x),F=yT(X.floating,y.y);return p?{...$,transform:"translate("+Y+"px, "+F+"px)",...vT(X.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Y,top:F}},[a,p,X.floating,y.x,y.y]);return x.useMemo(()=>({...y,update:z,refs:K,elements:X,floatingStyles:q}),[y,z,K,X,q])}const YH=(e,t)=>{const a=BH(e);return{name:a.name,fn:a.fn,options:[e,t]}},XH=(e,t)=>{const a=HH(e);return{name:a.name,fn:a.fn,options:[e,t]}},QH=(e,t)=>({fn:FH(e).fn,options:[e,t]}),ZH=(e,t)=>{const a=UH(e);return{name:a.name,fn:a.fn,options:[e,t]}},WH=(e,t)=>{const a=VH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var wy={exports:{}},Sy={};var jT;function JH(){if(jT)return Sy;jT=1;var e=Vd();function t(b,j){return b===j&&(b!==0||1/b===1/j)||b!==b&&j!==j}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,c=e.useEffect,d=e.useLayoutEffect,f=e.useDebugValue;function p(b,j){var w=j(),k=o({inst:{value:w,getSnapshot:j}}),S=k[0].inst,N=k[1];return d(function(){S.value=w,S.getSnapshot=j,h(S)&&N({inst:S})},[b,w,j]),c(function(){return h(S)&&N({inst:S}),b(function(){h(S)&&N({inst:S})})},[b]),f(w),w}function h(b){var j=b.getSnapshot;b=b.value;try{var w=j();return!a(b,w)}catch{return!0}}function v(b,j){return j()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:p;return Sy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sy}var wT;function ST(){return wT||(wT=1,wy.exports=JH()),wy.exports}var Ny=ST(),ky={exports:{}},Cy={};var NT;function eU(){if(NT)return Cy;NT=1;var e=Vd(),t=ST();function a(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var o=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,d=e.useRef,f=e.useEffect,p=e.useMemo,h=e.useDebugValue;return Cy.useSyncExternalStoreWithSelector=function(v,y,b,j,w){var k=d(null);if(k.current===null){var S={hasValue:!1,value:null};k.current=S}else S=k.current;k=p(function(){function T(I){if(!D){if(D=!0,C=I,I=j(I),w!==void 0&&S.hasValue){var P=S.value;if(w(P,I))return A=P}return A=I}if(P=A,o(C,I))return P;var O=j(I);return w!==void 0&&w(P,O)?(C=I,P):(C=I,A=O)}var D=!1,C,A,R=b===void 0?null:b;return[function(){return T(y())},R===null?void 0:function(){return T(R())}]},[y,b,j,w]);var N=c(v,k[0],k[1]);return f(function(){S.hasValue=!0,S.value=N},[N]),h(N),N},Cy}var kT;function tU(){return kT||(kT=1,ky.exports=eU()),ky.exports}var nU=tU();const sU=Iv(19)?aU:lU;function CT(e,t,a,o,c){return sU(e,t,a,o,c)}function rU(e,t,a,o,c){const d=x.useCallback(()=>t(e.getSnapshot(),a,o,c),[e,t,a,o,c]);return Ny.useSyncExternalStore(e.subscribe,d,d)}q4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const c of e.syncHooks)a.add(c.store);const o=[];for(const c of a)o.push(c.subscribe(t));return()=>{for(const c of o)c()}}),Ny.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function aU(e,t,a,o,c){const d=$4();if(!d)return rU(e,t,a,o,c);const f=d.syncIndex;d.syncIndex+=1;let p;return d.didInitialize?(p=d.syncHooks[f],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,c))&&(p.store!==e&&(d.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=c,p.value=t(e.getSnapshot(),a,o,c))):(p={store:e,selector:t,a1:a,a2:o,a3:c,value:t(e.getSnapshot(),a,o,c)},d.syncHooks.push(p)),p.value}function lU(e,t,a,o,c){return nU.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,d=>t(d,a,o,c))}class oU{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,c){return CT(this,t,a,o,c)}}class nu extends oU{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;De(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;De(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);De(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,c=a!==void 0;De(()=>{c&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,c])}select(t,a,o,c){const d=this.selectors[t];return d(this.state,a,o,c)}useState(t,a,o,c){return x.useDebugValue(t),CT(this,this.selectors[t],a,o,c)}useContextCallback(t,a){x.useDebugValue(t);const o=Ie(a??qt);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let c=o(this.state);return a(c,c,this),this.subscribe(d=>{const f=o(d);if(!Object.is(c,f)){const p=c;c=f,a(f,p,this)}})}}const iU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Ty extends nu{constructor(a){const{syncOnly:o,nested:c,onOpenChange:d,triggerElements:f,...p}=a;super({...p,positionReference:p.referenceElement,domReferenceElement:p.referenceElement},{onOpenChange:d,dataRef:{current:{}},events:eT(),nested:c,triggerElements:f},iU);ln(this,"syncOpenEvent",(a,o)=>{(!a||!this.state.open||o!=null&&BB(o))&&(this.context.dataRef.current.openEvent=a?o:void 0)});ln(this,"dispatchOpenChange",(a,o)=>{this.syncOpenEvent(a,o.event);const c={open:a,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",c)});ln(this,"setOpen",(a,o)=>{if(this.syncOnly){this.context.onOpenChange?.(a,o);return}this.dispatchOpenChange(a,o),this.context.onOpenChange?.(a,o)});this.syncOnly=o}}function cU(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:c,nested:d,onOpenChange:f}=e,p=t.useState("open"),h=t.useState("activeTriggerElement"),v=t.useState(a?"popupElement":"positionerElement"),y=t.context.triggerElements,b=f,j=x.useRef(null);o===void 0&&j.current===null&&(j.current=new Ty({open:p,transitionStatus:void 0,referenceElement:h,floatingElement:v,triggerElements:y,onOpenChange:b,floatingId:c,syncOnly:!0,nested:d}));const w=o??j.current;return t.useSyncedValue("floatingId",c),De(()=>{const k={open:p,floatingId:c,referenceElement:h,floatingElement:v};At(h)&&(k.domReferenceElement=h),w.state.positionReference===w.state.referenceElement&&(k.positionReference=h),w.update(k)},[p,c,h,v,w]),w.context.onOpenChange=b,w.context.nested=d,w}const lf={tabIndex:-1,[Uv]:""};function TT(e){return t=>t==="touch"?e.current:!0}function Ey(e,t=!1){const a=Gd(),o=eu()!=null,c=Ds(()=>e(a,o)).current;return cU({popupStore:c,treatPopupAsFloatingElement:t,floatingRootContext:c.state.floatingRootContext,floatingId:a,nested:o,onOpenChange:c.setOpen}),c}function Ay({handle:e,store:t}){return De(()=>e.attachStore(t),[e,t]),null}function ET(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function uU(e,t){const a=x.useRef(null);return Ie(o=>{const c=a.current;if(c!==null){if(c.element===o&&c.store===t&&c.id===e)return;a.current=null;const d=c.store;d.context.triggerElements.getById(c.id)===c.element&&(d.context.triggerElements.delete(c.id),ET(d))}o!==null&&e!==void 0&&(a.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),ET(t))})}function Ry(e,t,a,o=!1){let c=e.preventUnmountingOnClose;t?c=!1:o&&(c=!0);const d=a?.id??null;let f=e.activeTriggerId,p=e.activeTriggerElement;return(d||t)&&(f=d,p=a??null),{open:t,preventUnmountingOnClose:c,activeTriggerId:f,activeTriggerElement:p}}function AT(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function dU(e,t,a,o={}){const c=a.reason,d=c===Vs,f=t&&c===nh,p=!t&&(c===ho||c===Qc),h=AT(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const v=()=>{const y=Ry(e.state,t,a.trigger,h()),b={...o.extraState,...y};f?b.instantType="focus":p?b.instantType="dismiss":d&&(b.instantType=void 0),e.update(b)};d?Cs.flushSync(v):v()}function RT(e,t,a,o){const c=a.useState("isMountedByTrigger",e),d=uU(e,a),f=Ie(h=>{const v=a.select("open"),y=a.select("activeTriggerId");if(y===e){const b={activeTriggerElement:h,...v?o:null};a.update(b);return}if(y==null&&v){const b={activeTriggerId:e??null,activeTriggerElement:h,...o};a.update(b)}}),p=Ie(h=>{d(h),h&&f(h)});return De(()=>(p(t.current),()=>p(null)),[p,t,a,e]),De(()=>{if(c){const h={activeTriggerElement:t.current,...o};a.update(h)}},[c,a,t,...Object.values(o)]),{registerTrigger:p,isMountedByThisTrigger:c}}function Oy(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=x.useRef(null),c=e.useState("open"),d=e.useState("triggerCount"),f=e.useState("activeTriggerId"),p=e.useState("activeTriggerElement");De(()=>{if(!c){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const h=e.context.triggerElements.size,v={};e.state.triggerCount!==h&&(v.triggerCount=h);const y=e.select("activeTriggerId");let b=null;if(y){const j=e.context.triggerElements.getById(y);if(j)o.current=y,j!==e.state.activeTriggerElement&&(v.activeTriggerElement=j);else{for(const[w,k]of e.context.triggerElements.entries())if(k===e.state.activeTriggerElement){v.activeTriggerId=w,v.activeTriggerElement=k,o.current=w;break}v.activeTriggerId===void 0&&(o.current===y?b=y:o.current=null)}}else o.current=null;if(!b&&!y&&h===1){const j=e.context.triggerElements.entries().next();if(!j.done){const[w,k]=j.value;v.activeTriggerId=w,v.activeTriggerElement=k,o.current=w}}(v.triggerCount!==void 0||v.activeTriggerId!==void 0||v.activeTriggerElement!==void 0)&&e.update(v),b&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===b&&!e.context.triggerElements.getById(b)){const j=$e(Yn);e.setOpen(!1,j),j.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[c,e,d,f,p,a])}function My(e,t,a,o){const{mounted:c,setMounted:d,transitionStatus:f}=ki(e,!1,!1,o),p=t.useState("preventUnmountingOnClose"),h=e?!1:p;t.useSyncedValues({mounted:c,transitionStatus:f,preventUnmountingOnClose:h});const v=Ie(()=>{d(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ra({enabled:c&&!e&&!h,open:e,ref:t.context.popupRef,onComplete(){e||v()}}),{forceUnmount:v,transitionStatus:f}}function Dy(e,t){e.useSyncedValues(t),De(()=>()=>{e.update({activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn})},[e])}function OT(e,t){De(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),De(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class ph{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Iy(e,t,a=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ty({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:fn,inactiveTriggerProps:fn,popupProps:fn}}const of=e=>e.triggerIdProp??e.activeTriggerId,Py=e=>e.openProp??e.open,MT=e=>(e.popupElement?.id??e.floatingId)||void 0;function DT(e,t){return t!==void 0&&Py(e)&&of(e)===t}function fU(e,t){return DT(e,t)?!0:t!==void 0&&Py(e)&&of(e)==null&&e.triggerCount===1}const _y={open:Py,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:of,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:MT,isTriggerActive:(e,t)=>t!==void 0&&of(e)===t,isOpenedByTrigger:(e,t)=>DT(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&of(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>fU(e,t)?MT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function IT(e){const t=x.useCallback(o=>e===void 0?qt:e.subscribeStore(o),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ny.useSyncExternalStore(t,a,()=>e?.serverStore)}function PT(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,c=Gd(),d=eu()!=null,f=Ds(()=>new Ty({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new ph,floatingId:c,syncOnly:!1,nested:d})).current;return De(()=>{const p={open:t,floatingId:c};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=At(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),f.update(p)},[t,c,o.reference,o.floating,f]),f.context.onOpenChange=a,f.context.nested=d,f}function pU(e){return mU(e,e.rootContext)}function mU(e,t){const{nodeId:a,externalTree:o}=e,c=t.useState("referenceElement"),d=t.useState("floatingElement"),f=t.useState("domReferenceElement"),p=t.useState("open"),h=t.useState("floatingId"),[v,y]=x.useState(null),[b,j]=x.useState(void 0),[w,k]=x.useState(void 0),S=x.useRef(null),N=Mi(o),T=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),D=KH({...e,elements:{...T,...v&&{reference:v}}}),C=At(b)?b:null,A=w===void 0?t.state.floatingElement:w;t.useSyncedValue("referenceElement",b??null),t.useSyncedValue("domReferenceElement",b===void 0?f:C),t.useSyncedValue("floatingElement",A);const R=x.useCallback(H=>{const B=At(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;y(B),D.refs.setReference(B)},[D.refs]),I=x.useCallback(H=>{(At(H)||H===null)&&(S.current=H,j(H)),(At(D.refs.reference.current)||D.refs.reference.current===null||H!==null&&!At(H))&&D.refs.setReference(H)},[D.refs,j]),P=x.useCallback(H=>{k(H),D.refs.setFloating(H)},[D.refs]),O=x.useMemo(()=>({...D.refs,setReference:I,setFloating:P,setPositionReference:R,domReference:S}),[D.refs,I,P,R]),_=x.useMemo(()=>({...D.elements,domReference:f}),[D.elements,f]),L=x.useMemo(()=>({...D,dataRef:t.context.dataRef,open:p,onOpenChange:t.setOpen,events:t.context.events,floatingId:h,refs:O,elements:_,nodeId:a,rootStore:t}),[D,O,_,a,t,p,h]);return De(()=>{f&&(S.current=f)},[f]),De(()=>{t.context.dataRef.current.floatingContext=L;const H=N?.nodesRef.current.find(B=>B.id===a);H&&(H.context=L)}),x.useMemo(()=>({...D,context:L,refs:O,elements:_,rootStore:t}),[D,O,_,L,t])}const Ly=JC&&yl;function hU(e,t={}){const{enabled:a=!0,delay:o}=t,c="rootStore"in e?e.rootStore:e,{events:d,dataRef:f}=c.context,p=x.useRef(!1),h=x.useRef(null),v=x.useRef(!0),y=Zs();x.useEffect(()=>{const j=c.select("domReferenceElement");if(!a)return;const w=Sn(j);function k(){const T=c.select("domReferenceElement");!c.select("open")&&dn(T)&&T===or($t(T))&&(p.current=!0,h.current=T)}function S(){v.current=!0}function N(){v.current=!1}return Ya(St(w,"blur",k),Ly&&St(w,"keydown",S,!0),Ly&&St(w,"pointerdown",N,!0))},[c,a]),x.useEffect(()=>{if(!a)return;function j(w){if(w.reason===ho||w.reason===Qc){const k=c.select("domReferenceElement");At(k)&&(h.current=k,p.current=!0)}}return d.on("openchange",j),()=>{d.off("openchange",j)}},[d,a,c]);const b=x.useMemo(()=>{function j(){p.current=!1,h.current=null}return{onMouseLeave(){j()},onFocus(w){const k=w.currentTarget;if(p.current){if(h.current===k)return;j()}const S=cs(w.nativeEvent);if(At(S)){if(Ly&&!w.relatedTarget){if(!v.current&&!qm(S))return}else if(!LB(S))return}const N=$m(w.relatedTarget,c.context.triggerElements),{nativeEvent:T,currentTarget:D}=w,C=typeof o=="function"?o():o;if(c.select("open")&&N||C===0||C===void 0){c.setOpen(!0,$e(nh,T,D));return}y.start(C,()=>{p.current||c.setOpen(!0,$e(nh,T,D))})},onBlur(w){j();const k=w.relatedTarget,S=w.nativeEvent,N=At(k)&&k.hasAttribute(sf("focus-guard"))&&k.getAttribute("data-type")==="outside";y.start(0,()=>{const T=c.select("domReferenceElement"),D=or($t(T));!k&&D===T||Qe(f.current.floatingContext?.refs.floating.current,D)||Qe(T,D)||N||$m(k??D,c.context.triggerElements)||c.setOpen(!1,$e(nh,S))})}}},[f,o,c,y]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class zy{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new sa,this.restTimeout=new sa,this.handleCloseOptions=void 0}static create(){return new zy}}const mh=new WeakMap;function hh(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&mh.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),mh.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _T(e,t){const{scopeElement:a,referenceElement:o,floatingElement:c}=t,d=mh.get(a);d&&d!==e&&hh(d),hh(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=c,mh.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",c.style.pointerEvents="auto"}function By(e){const t=e.context.dataRef.current,a=Ds(()=>t.hoverInteractionState??zy.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),ay(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function LT(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:c}=t,d="rootStore"in e?e.rootStore:e,f=d.useState("open"),p=d.useState("floatingElement"),h=d.useState("domReferenceElement"),{dataRef:v}=d.context,y=Mi(),b=eu(),j=By(d),w=Zs(),k=Ie(()=>H1(v.current.openEvent?.type,j.interactedInside)),S=Ie(()=>Y4(v.current.openEvent?.type)),N=Ie(()=>{hh(j)});De(()=>{f||(j.pointerType=void 0,j.restTimeoutPending=!1,j.interactedInside=!1,N())},[f,j,N]),x.useEffect(()=>N,[N]),De(()=>{if(a&&f&&j.handleCloseOptions?.blockPointerEvents&&S()&&At(h)&&p){const T=h,D=p,C=$t(p),A=y?.nodesRef.current.find(O=>O.id===b)?.context?.elements.floating;A&&(A.style.pointerEvents="");const R=j.pointerEventsScopeElement!==D?j.pointerEventsScopeElement:null,I=A!==D?A:null,P=j.handleCloseOptions?.getScope?.()??R??I??T.closest("[data-rootownerid]")??C.body;return _T(j,{scopeElement:P,referenceElement:T,floatingElement:D}),()=>{N()}}},[a,f,h,p,j,S,y,b,N]),x.useEffect(()=>{if(!a)return;function T(){return!!(y&&b&&co(y.nodesRef.current,b).length>0)}function D(O){const _=Oi(o,"close",j.pointerType),L=()=>{d.setOpen(!1,$e(Vs,O)),y?.events.emit("floating.closed",O)};_?j.openChangeTimeout.start(_,L):(j.openChangeTimeout.clear(),L())}function C(O){const _=cs(O);if(!_B(_)){j.interactedInside=!1;return}j.interactedInside=_?.closest("[aria-haspopup]")!=null}function A(){j.openChangeTimeout.clear(),w.clear(),y?.events.off("floating.closed",I),N()}function R(O){if(T()&&y){y.events.on("floating.closed",I);return}if($m(O.relatedTarget,d.context.triggerElements))return;const _=v.current.floatingContext?.nodeId??c,L=O.relatedTarget;if(!(y&&_&&At(L)&&co(y.nodesRef.current,_,!1).some(B=>Qe(B.context?.elements.floating,L)))){if(j.handler){j.handler(O);return}N(),S()&&!k()&&D(O)}}function I(O){!y||!b||T()||w.start(0,()=>{y.events.off("floating.closed",I),d.setOpen(!1,$e(Vs,O)),y.events.emit("floating.closed",O)})}const P=p;return Ya(P&&St(P,"mouseenter",A),P&&St(P,"mouseleave",R),P&&St(P,"pointerdown",C,!0),()=>{y?.events.off("floating.closed",I)})},[a,p,d,v,o,c,S,k,N,j,y,b,w])}const gU={current:null};function zT(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:c=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElementRef:h=gU,externalTree:v,isActiveTrigger:y=!0,getHandleCloseContext:b,isClosing:j,shouldOpen:w,guardStaleOpen:k=!1}=t,S="rootStore"in e?e.rootStore:e,{dataRef:N,events:T}=S.context,D=Mi(v),C=By(S),A=x.useRef(!1),R=Xn(c),I=Xn(o),P=Xn(f),O=Xn(a),_=Xn(w),L=Xn(j),H=Ie(()=>H1(N.current.openEvent?.type,C.interactedInside)),B=Ie(()=>_.current?.()!==!1),z=Ie((X,q,$)=>{const Y=S.context.triggerElements;if(Y.hasElement(q))return!X||!Qe(X,q);if(!At($))return!1;const F=$;return Y.hasMatchingElement(G=>Qe(G,F))&&(!X||!Qe(X,F))}),Q=Ie(()=>{if(!C.handler)return;$t(S.select("domReferenceElement")).removeEventListener("mousemove",C.handler),C.handler=void 0}),K=Ie(()=>{hh(C)});return y&&(C.handleCloseOptions=c?.__options),x.useEffect(()=>Q,[Q]),x.useEffect(()=>{if(!a)return;function X(q){q.open?A.current=!1:(A.current=q.reason===Vs,Q(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return T.on("openchange",X),()=>{T.off("openchange",X)}},[a,T,C,Q]),x.useEffect(()=>{if(!a)return;function X(W,le=!0){const M=Oi(I.current,"close",C.pointerType);M?C.openChangeTimeout.start(M,()=>{S.setOpen(!1,$e(Vs,W)),D?.events.emit("floating.closed",W)}):le&&(C.openChangeTimeout.clear(),S.setOpen(!1,$e(Vs,W)),D?.events.emit("floating.closed",W))}const q=h.current??(y?S.select("domReferenceElement"):null);if(!At(q))return;function $(W){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,d&&!uo(C.pointerType))return;const le=B1(P.current),M=Oi(I.current,"open",C.pointerType),U=cs(W),Z=W.currentTarget??null,ae=S.select("domReferenceElement");let ce=Z;if(At(U)&&!S.context.triggerElements.hasElement(U)){for(const de of S.context.triggerElements.elements())if(Qe(de,U)){ce=de;break}}At(Z)&&At(ae)&&!S.context.triggerElements.hasElement(Z)&&Qe(Z,ae)&&(ce=ae);const J=ce==null?!1:z(ae,ce,U),ie=S.select("open"),ge=L.current?.()??S.select("transitionStatus")==="ending",ee=!ie&&ge&&A.current,fe=!J&&At(ce)&&At(ae)&&Qe(ae,ce)&&ee,te=le>0&&!M,Ce=J&&(ie||ee)||fe,re=!ie||J;if(Ce){B()&&S.setOpen(!0,$e(Vs,W,ce));return}te||(M?C.openChangeTimeout.start(M,()=>{re&&B()&&S.setOpen(!0,$e(Vs,W,ce))}):re&&B()&&S.setOpen(!0,$e(Vs,W,ce)))}function Y(W){if(H()){K();return}Q();const le=S.select("domReferenceElement"),M=$t(le);C.restTimeout.clear(),C.restTimeoutPending=!1;const U=N.current.floatingContext??b?.();if($m(W.relatedTarget,S.context.triggerElements))return;if(R.current&&U){S.select("open")||C.openChangeTimeout.clear();const ae=h.current;C.handler=R.current({...U,tree:D,x:W.clientX,y:W.clientY,onClose(){K(),Q(),O.current&&!H()&&ae===S.select("domReferenceElement")&&X(W,!0)}}),M.addEventListener("mousemove",C.handler),C.handler(W);return}(C.pointerType!=="touch"||!Qe(S.select("floatingElement"),W.relatedTarget))&&X(W)}function F(W){Qe(q,W.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}const G=k?St(q,"mouseout",F):void 0;return p?Ya(St(q,"mousemove",$,{once:!0}),St(q,"mouseenter",$),St(q,"mouseleave",Y),G):Ya(St(q,"mouseenter",$),St(q,"mouseleave",Y),G)},[Q,K,N,I,S,a,R,C,y,z,H,d,p,P,h,D,O,b,L,B,k]),x.useMemo(()=>{if(!a)return;function X(q){C.pointerType=q.pointerType}return{onPointerDown:X,onPointerEnter:X,onMouseMove(q){const{nativeEvent:$}=q,Y=q.currentTarget,F=S.select("domReferenceElement"),G=S.select("open"),W=z(F,Y,q.target);if(d&&!uo(C.pointerType))return;if(G&&W&&C.handleCloseOptions?.blockPointerEvents){const U=S.select("floatingElement");if(U){const Z=C.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;_T(C,{scopeElement:Z,referenceElement:Y,floatingElement:U})}}const le=B1(P.current);if(G&&!W||le===0||!W&&C.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;C.restTimeout.clear();function M(){if(C.restTimeoutPending=!1,H())return;const U=S.select("open");!C.blockMouseMove&&(!U||W)&&B()&&S.setOpen(!0,$e(Vs,$,Y))}C.pointerType==="touch"?Cs.flushSync(()=>{M()}):W&&G?M():(C.restTimeoutPending=!0,C.restTimeout.start(le,M))}}},[a,C,H,z,d,S,P,B])}const xU="Escape";function BT(e){return yl&&e.movementX===0&&e.movementY===0}function gh(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function xh(e,t){return gh(t,e===Vv||e===Fm,e===wi||e===Si)}function Hy(e,t,a){return gh(t,e===Fm,a?e===wi:e===Si)||e==="Enter"||e===" "||e===""}function bU(e,t,a){return gh(t,a?e===wi:e===Si,e===Fm)}function vU(e,t,a,o){const c=a?e===Si:e===wi,d=e===Vv;return t==="both"||t==="horizontal"&&o?e===xU:gh(t,c,d)}function HT(e,t){const{listRef:a,activeIndex:o,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:h=!1,nested:v=!1,rtl:y=!1,virtual:b=!1,focusItemOnOpen:j="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:k=!0,disabledIndices:S=void 0,orientation:N="vertical",parentOrientation:T,id:D,resetOnPointerLeave:C=!0,externalTree:A,grid:R}=t,I=R!=null,P="rootStore"in e?e.rootStore:e,O=P.useState("open"),_=P.useState("floatingElement"),L=P.useState("domReferenceElement"),H=P.context.dataRef,B=Gm(_),z=Yv(L),Q=Xn(B),K=eu(),X=Mi(A),q=x.useRef(j),$=x.useRef(f??-1),Y=x.useRef(null),F=x.useRef(!0),G=Ie(xe=>{c($.current===-1?null:$.current,xe)}),W=x.useRef(!!_),le=x.useRef(O),M=x.useRef(!1),U=x.useRef(!1),Z=x.useRef(null),ae=Xn(S),ce=Xn(O),J=Xn(f),ie=Xn(C),ge=Yc(),ee=Yc(),fe=Ie(()=>{function xe(Le){b?X?.events.emit("virtualfocus",Le):Z.current=lh(Le,{sync:M.current,preventScroll:!0})}const Te=a.current[$.current],Oe=U.current;Te&&xe(Te),(M.current?Le=>Le():Le=>ge.request(Le))(()=>{const Le=a.current[$.current]||Te;if(!Le)return;Te||xe(Le),Ee&&(Oe||!F.current)&&Le.scrollIntoView?.({block:"nearest",inline:"nearest"})})});De(()=>{H.current.orientation=N},[H,N]),De(()=>{d&&(O&&_?($.current=f??-1,q.current&&f!=null&&(U.current=!0,G())):W.current&&($.current=-1,G()))},[d,O,_,f,G]),De(()=>{if(d){if(!O){M.current=!1;return}if(_)if(o==null){if(M.current=!1,J.current!=null)return;if(W.current&&($.current=-1,fe()),(!le.current||!W.current)&&q.current&&(Y.current!=null||q.current===!0&&Y.current==null)){let xe=0;const Te=()=>{a.current[0]==null?(xe<2&&(xe?Ne=>ee.request(Ne):queueMicrotask)(Te),xe+=1):($.current=Y.current==null||Hy(Y.current,N,y)||v?Zm(a):ey(a),Y.current=null,G())};Te()}}else po(a.current,o)||($.current=o,fe(),U.current=!1)}},[d,O,_,o,J,v,a,N,y,G,fe,ee]),De(()=>{if(!d||_||!X||b||!W.current)return;const xe=X.nodesRef.current,Te=xe.find(Le=>Le.id===K)?.context?.elements.floating,Oe=or($t(L??Te??null)),Ne=xe.some(Le=>Le.context&&Qe(Le.context.elements.floating,Oe));Te&&!Ne&&F.current&&Te.focus({preventScroll:!0})},[d,_,L,X,K,b]),De(()=>{le.current=O,W.current=!!_}),De(()=>{O||(Y.current=null,q.current=j)},[O,j]);const te=o!=null,Ce=Ie(xe=>{if(!ce.current)return;const Te=a.current.indexOf(xe.currentTarget);Te!==-1&&($.current!==Te||o!==Te)&&($.current=Te,G(xe))}),re=Ie(()=>T??X?.nodesRef.current.find(xe=>xe.id===K)?.context?.dataRef?.current.orientation),de=Ie(()=>Zm(a,ae.current)),ke=Ie(xe=>{if(F.current=!1,M.current=!0,xe.which===229||!ce.current&&xe.currentTarget===Q.current)return;if(v&&vU(xe.key,N,y,I)){xh(xe.key,re())||ks(xe),P.setOpen(!1,$e(iy,xe.nativeEvent)),dn(L)&&(b?X?.events.emit("virtualfocus",L):L.focus());return}const Te=$.current,Oe=Zm(a,S),Ne=ey(a,S);if(z||(xe.key==="Home"&&(ks(xe),$.current=Oe,G(xe)),xe.key==="End"&&(ks(xe),$.current=Ne,G(xe))),R!=null){const Le=R(xe,$.current,a,N,h,y,S,Oe,Ne);if(Le!=null&&($.current=Le,G(xe)),N==="both")return}if(xh(xe.key,N)){if(ks(xe),O&&!b&&or(xe.currentTarget.ownerDocument)===xe.currentTarget){$.current=Hy(xe.key,N,y)?Oe:Ne,G(xe);return}Hy(xe.key,N,y)?h?Te>=Ne?p&&Te!==a.current.length?$.current=-1:(M.current=!1,$.current=Oe):$.current=Is(a.current,{startingIndex:Te,disabledIndices:S}):$.current=Math.min(Ne,Is(a.current,{startingIndex:Te,disabledIndices:S})):h?Te<=Oe?p&&Te!==-1?$.current=a.current.length:(M.current=!1,$.current=Ne):$.current=Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:S}):$.current=Math.max(Oe,Is(a.current,{startingIndex:Te,decrement:!0,disabledIndices:S})),po(a.current,$.current)&&($.current=-1),G(xe)}}),Ee=x.useMemo(()=>({onFocus(Te){M.current=!0,Ce(Te)},onClick:({currentTarget:Te})=>Te.focus({preventScroll:!0}),onMouseMove(Te){BT(Te)||(M.current=!0,U.current=!1,w&&Ce(Te))},onPointerLeave(Te){if(!ce.current||!F.current||Te.pointerType==="touch")return;M.current=!0;const Oe=Te.relatedTarget;if(!(!w||a.current.includes(Oe))&&ie.current&&(Z.current?.(),Z.current=null,$.current=-1,G(Te),!b)){const Ne=Q.current,Le=or($t(Ne));Ne&&Qe(Ne,Le)&&Ne.focus({preventScroll:!0})}}}),[Ce,ce,Q,w,a,G,ie,b]),ve=x.useMemo(()=>b&&O&&te&&{"aria-activedescendant":`${D}-${o}`},[b,O,te,D,o]),he=x.useMemo(()=>({...z?{}:ve,onKeyDown(xe){if(xe.key==="Tab"&&xe.shiftKey&&O&&!b){const Te=cs(xe.nativeEvent);if(Te&&!Qe(Q.current,Te))return;ks(xe),P.setOpen(!1,$e(go,xe.nativeEvent)),dn(L)&&L.focus();return}ke(xe)},onPointerMove(xe){BT(xe)||(F.current=!0)}}),[ve,ke,Q,z,P,O,b,L]),ye=x.useMemo(()=>{function xe(Ne){P.setOpen(!0,$e(iy,Ne.nativeEvent,Ne.currentTarget))}function Te(Ne){j==="auto"&&Km(Ne.nativeEvent)&&(q.current=!b)}function Oe(Ne){q.current=j,j==="auto"&&Xv(Ne.nativeEvent)&&(q.current=!0)}return{onKeyDown(Ne){const Le=P.select("open");F.current=!1;const Ye=Ne.key.startsWith("Arrow"),kt=bU(Ne.key,re(),y),Ct=xh(Ne.key,N),Rt=(v?kt:Ct)||Ne.key==="Enter"||Ne.key.trim()==="";if(b&&Le)return ke(Ne);if(!(!Le&&!k&&Ye)){if(Rt){const ot=xh(Ne.key,re());Y.current=v&&ot?null:Ne.key}if(v){kt&&(ks(Ne),Le?($.current=de(),G(Ne)):xe(Ne));return}Ct&&(J.current!=null&&($.current=J.current),ks(Ne),!Le&&k?xe(Ne):ke(Ne),Le&&G(Ne))}},onFocus(Ne){P.select("open")&&!b&&($.current=-1,G(Ne))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Te,onClick:Te}},[ke,j,de,v,G,P,k,N,re,y,J,b]),we=x.useMemo(()=>({...ve,...ye}),[ve,ye]);return x.useMemo(()=>d?{reference:we,floating:he,item:Ee,trigger:ye}:{},[d,we,he,ye,Ee])}function UT(e,t){const{listRef:a,elementsRef:o,activeIndex:c,onMatch:d,disabledIndices:f,onTyping:p,enabled:h=!0,resetMs:v=750,selectedIndex:y=null}=t,b="rootStore"in e?e.rootStore:e,j=b.useState("open"),w=Zs(),k=x.useRef(""),S=x.useRef(y??c??-1),N=x.useRef(null),T=Ie(A=>{function R(Q){return o?.current[Q]}function I(Q){const K=R(Q);return K&&!Wm(K)||K?.matches(":disabled")?!1:f==null||!mo(Mr,Q,f)}function P(Q,K,X=0){if(Q.length===0)return-1;const q=(X%Q.length+Q.length)%Q.length,$=K.toLowerCase();for(let Y=0;Y0&&A.key===" "&&(ks(A),p?.(!0)),k.current.length>0&&k.current[0]!==" "&&P(O,k.current)===-1&&A.key!==" "&&p?.(!1),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;j&&A.key!==" "&&(ks(A),p?.(!0));const _=k.current==="";_&&(S.current=y??c??-1),O.every((Q,K)=>Q&&I(K)?Q[0]?.toLowerCase()!==Q[1]?.toLowerCase():!0)&&k.current===A.key&&(k.current="",S.current=N.current),k.current+=A.key,w.start(v,()=>{k.current="",S.current=N.current,p?.(!1)});const B=((_?y??c??-1:S.current)??0)+1,z=P(O,k.current,B);z!==-1?(d?.(z),N.current=z):A.key!==" "&&(k.current="",p?.(!1))}),D=Ie(A=>{const R=A.relatedTarget,I=b.select("domReferenceElement"),P=b.select("floatingElement");Qe(I,R)||Qe(P,R)||(w.clear(),k.current="",S.current=N.current,p?.(!1))});De(()=>{!j&&y!==null||(w.clear(),N.current=null,k.current!==""&&(k.current=""))},[j,y,w]);const C=x.useMemo(()=>({onKeyDown:T,onBlur:D}),[T,D]);return x.useMemo(()=>h?{reference:C,floating:C}:{},[h,C])}const VT=.1,yU=VT*VT,bn=.5;function bh(e,t,a,o,c,d){return o>=t!=d>=t&&e<=(c-a)*(t-o)/(d-o)+a}function vh(e,t,a,o,c,d,f,p,h,v){let y=!1;return bh(e,t,a,o,c,d)&&(y=!y),bh(e,t,c,d,f,p)&&(y=!y),bh(e,t,f,p,h,v)&&(y=!y),bh(e,t,h,v,a,o)&&(y=!y),y}function jU(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function yh(e,t,a,o,c,d){const f=Math.min(a,c),p=Math.max(a,c),h=Math.min(o,d),v=Math.max(o,d);return e>=f&&e<=p&&t>=h&&t<=v}function FT(e={}){const{blockPointerEvents:t=!1}=e,a=new sa,o=({x:c,y:d,placement:f,elements:p,onClose:h,nodeId:v,tree:y})=>{const b=f?.split("-")[0];let j=!1,w=null,k=null,S=typeof performance<"u"?performance.now():0;function N(D,C){const A=performance.now(),R=A-S;if(w===null||k===null||R===0)return w=D,k=C,S=A,!1;const I=D-w,P=C-k,O=I*I+P*P,_=R*R*yU;return w=D,k=C,S=A,O<_}function T(){a.clear(),h()}return function(C){a.clear();const A=p.domReference,R=p.floating;if(!A||!R||b==null||c==null||d==null)return;const{clientX:I,clientY:P}=C,O=cs(C),_=C.type==="mouseleave",L=Qe(R,O),H=Qe(A,O);if(L&&(j=!0,!_))return;if(H&&(j=!1,!_)){j=!0;return}if(_&&At(C.relatedTarget)&&Qe(R,C.relatedTarget))return;function B(){return!!(y&&co(y.nodesRef.current,v).length>0)}function z(){B()||T()}if(B())return;const Q=A.getBoundingClientRect(),K=R.getBoundingClientRect(),X=c>K.right-K.width/2,q=d>K.bottom-K.height/2,$=K.width>Q.width,Y=K.height>Q.height,F=($?Q:K).left,G=($?Q:K).right,W=(Y?Q:K).top,le=(Y?Q:K).bottom;if(b==="top"&&d>=Q.bottom-1||b==="bottom"&&d<=Q.top+1||b==="left"&&c>=Q.right-1||b==="right"&&c<=Q.left+1){z();return}let M=!1;switch(b){case"top":M=yh(I,P,F,Q.top+1,G,K.bottom-1);break;case"bottom":M=yh(I,P,F,K.top+1,G,Q.bottom-1);break;case"left":M=yh(I,P,K.right-1,le,Q.left+1,W);break;case"right":M=yh(I,P,Q.right-1,le,K.left+1,W);break}if(M)return;if(j&&!jU(I,P,Q)){z();return}if(!_&&N(I,P)){z();return}let U=!1;switch(b){case"top":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d+bn+1,ie=X||$?K.bottom-bn:K.top,ge=X?$?K.bottom-bn:K.top:K.bottom-bn;U=vh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"bottom":{const Z=$?bn/2:bn*4,ae=$||X?c+Z:c-Z,ce=$?c-Z:X?c+Z:c-Z,J=d-bn,ie=X||$?K.top+bn:K.bottom,ge=X?$?K.top+bn:K.bottom:K.top+bn;U=vh(I,P,ae,J,ce,J,K.left,ie,K.right,ge);break}case"left":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c+bn+1,ie=q||Y?K.right-bn:K.left,ge=q?Y?K.right-bn:K.left:K.right-bn;U=vh(I,P,ie,K.top,ge,K.bottom,J,ae,J,ce);break}case"right":{const Z=Y?bn/2:bn*4,ae=Y||q?d+Z:d-Z,ce=Y?d-Z:q?d+Z:d-Z,J=c-bn,ie=q||Y?K.left+bn:K.right,ge=q?Y?K.left+bn:K.right:K.left+bn;U=vh(I,P,J,ae,J,ce,ie,K.top,ge,K.bottom);break}}U?j||a.start(40,z):z()}};return o.__options={...e,blockPointerEvents:t},o}const wU={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class SU extends nu{constructor(a,o,c){const d=new ph;super(NU(a,d,o,c),kU(d),wU);ln(this,"setOpen",(a,o)=>{dU(this,a,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(a){this.state.floatingRootContext.dispatchOpenChange(!1,$e(ho,a))}}function NU(e,t,a,o=!1){return{...Iy(t,a,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function kU(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const CU=rh(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:c,disableHoverablePopup:d=!1,trackCursorAxis:f="none",actionsRef:p,onOpenChange:h,onOpenChangeComplete:v,handle:y,triggerId:b,defaultTriggerId:j=null,children:w}=t,k=Ey((H,B)=>new SU({open:o,openProp:c,activeTriggerId:j,triggerIdProp:b},H,B));k.useControlledProp("openProp",c),k.useControlledProp("triggerIdProp",b),k.useContextCallback("onOpenChange",h),k.useContextCallback("onOpenChangeComplete",v);const S=k.useState("open"),N=!a&&S,T=k.useState("activeTriggerId"),D=k.useState("mounted"),C=k.useState("payload");k.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:d,disabled:a}),Oy(k,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:R}=My(N,k),I=k.useState("isInstantPhase"),P=k.useState("instantType"),O=k.useState("lastOpenChangeReason"),_=x.useRef(null);De(()=>{S&&a&&k.setOpen(!1,$e(u4))},[S,a,k]),De(()=>{R==="ending"&&O===Yn||R!=="ending"&&I?(P!=="delay"&&(_.current=P),k.set("instantType","delay")):_.current!==null&&(k.set("instantType",_.current),_.current=null)},[R,I,O,P,k]),De(()=>{N&&T==null&&k.set("payload",void 0)},[k,T,N]),x.useImperativeHandle(p,()=>({unmount:A,close:()=>k.setOpen(!1,$e(cy))}),[A,k]);const L=N||D||!a&&f!=="none";return s.jsxs(z1.Provider,{value:k,children:[y&&s.jsx(Ay,{handle:y,store:k}),L&&s.jsx(TU,{store:k,disabled:a,trackCursorAxis:f}),typeof w=="function"?w({payload:C}):w]})});function TU({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),c=af(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),d=fH(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),f=x.useMemo(()=>Wr(d.reference,c.reference),[d.reference,c.reference]);return Dy(e,{activeTriggerProps:f,inactiveTriggerProps:f,popupProps:c.floating??fn}),null}const $T=x.createContext(void 0);function EU(){return x.useContext($T)}const AU=600,qT="data-base-ui-tooltip-trigger";function GT(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;oN.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ae=hU(A,{enabled:!X}).reference,ce=fe=>{const te=F.current,Ce=GT(fe),re=U(Ce),de=R.current,ke=de&&Ce&&Qe(de,Ce);if(re&&N.select("open")&&N.select("lastOpenChangeReason")===Vs){N.setOpen(!1,$e(Vs,fe));return}if(te&&!re&&ke&&!q.current&&!N.select("open")&&de&&uo(W.current)){const Ee=()=>{!F.current&&!q.current&&!N.select("open")&&N.setOpen(!0,$e(Vs,fe,de))},ve=le();ve===0?(G.clear(),Ee()):G.start(ve,Ee)}},J=N.useState("triggerProps",O);return yt("button",t,{state:{open:C},ref:[a,P,R],props:[Z,ae,O||$!=="none"?J:void 0,{onMouseOver(fe){ce(fe.nativeEvent)},onFocus(fe){M(GT(fe.nativeEvent))&&fe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,G.clear(),W.current=void 0},onPointerEnter(fe){W.current=fe.pointerType},onPointerDown(fe){W.current=fe.pointerType,N.set("closeOnClick",y),y&&!N.select("open")&&N.cancelPendingOpen(fe.nativeEvent)},onClick(fe){y&&!N.select("open")&&N.cancelPendingOpen(fe.nativeEvent)},id:T,[Gv]:X?"":void 0,[qT]:X?void 0:""},w],stateAttributesMapping:Fv})}),KT=x.createContext(void 0);function MU(){const e=x.useContext(KT);if(e===void 0)throw new Error(on(70));return e}const DU=x.forwardRef(function(t,a){const{children:o,container:c,className:d,render:f,style:p,...h}=t,{node:v,subtree:y}=J1({container:c,ref:a,componentProps:t,elementProps:h});return!y&&!v?null:s.jsxs(x.Fragment,{children:[y,v&&Cs.createPortal(o,v)]})}),IU=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return nf().useState("mounted")||o?s.jsx(KT.Provider,{value:o,children:s.jsx(DU,{ref:a,...c})}):null}),YT=x.createContext(void 0);function XT(){const e=x.useContext(YT);if(e===void 0)throw new Error(on(71));return e}const PU=x.createContext(void 0);function cf(){return x.useContext(PU)?.direction??"ltr"}const _U=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:c,rects:d,platform:f,elements:p,middlewareData:h}=t,{element:v,padding:y=0,offsetParent:b="real"}=fo(e,t)||{};if(v==null)return{};const j=i1(y),w={x:a,y:o},k=Wv(c),S=Zv(k),N=await f.getDimensions(v),T=k==="y",D=T?"top":"left",C=T?"bottom":"right",A=T?"clientHeight":"clientWidth",R=d.reference[S]+d.reference[k]-w[k]-d.floating[S],I=w[k]-d.reference[k],P=b==="real"?await f.getOffsetParent?.(v):p.floating;let O=p.floating[A]||d.floating[S];(!O||!await f.isElement?.(P))&&(O=p.floating[A]||d.floating[S]);const _=R/2-I/2,L=O/2-N[S]/2-1,H=Math.min(j[D],L),B=Math.min(j[C],L),z=H,Q=O-N[S]-B,K=O/2-N[S]/2+_,X=a1(z,K,Q),q=!h.arrow&&Sl(c)!=null&&K!==X&&d.reference[S]/2-(K{const{name:a,fn:o}=_U(e);return{name:a,fn:o,options:[e,t]}},zU={name:"hide",async fn(e){const{width:t,height:a,x:o,y:c}=e.rects.reference,d=t===0&&a===0&&o===0&&c===0,f=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:f.top-a>=0||f.right-t>=0||f.bottom-a>=0||f.left-t>=0||d}}}},BU={sideX:"left",sideY:"top"},HU="--available-width",UU="--available-height",VU="--anchor-width",FU="--anchor-height",$U="--transform-origin",QT=HU,ZT=UU;function WT(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function JT(e,t,a){const{rects:o,placement:c}=e;return{side:WT(t,ta(c),a),align:Sl(c)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function jh(e){return qU(e,pU)}function qU(e,t){const{anchor:a,positionMethod:o="absolute",side:c="bottom",sideOffset:d=0,align:f="center",alignOffset:p=0,collisionBoundary:h,collisionPadding:v=5,sticky:y=!1,arrowPadding:b=5,disableAnchorTracking:j=!1,inline:w,keepMounted:k=!1,floatingRootContext:S,mounted:N,collisionAvoidance:T,shift:D,nodeId:C,adaptiveOrigin:A,lazyFlip:R=!1,externalTree:I}=e,[P,O]=x.useState(null);!N&&P!==null&&O(null);const _=T.side||"flip",L=T.align||"flip",H=T.fallbackAxisSide||"end",B=D?.crossAxis??!1,z=D?.rootBoundary,Q=typeof a=="function"?a:void 0,K=Ie(Q),X=Q?K:a,q=Xn(a),$=Xn(N),F=cf()==="rtl",G=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[c],W=f==="center"?G:`${G}-${f}`;let le=v;typeof le=="number"?le={top:le,right:le,bottom:le,left:le}:le&&(le={top:le.top||0,right:le.right||0,bottom:le.bottom||0,left:le.left||0});const M=1,U=c==="bottom"?M:0,Z=c==="top"?M:0,ae=c==="right"?M:0,ce=c==="left"?M:0,J={boundary:h==="clipping-ancestors"?"clippingAncestors":h,padding:le},ie=x.useRef(null),ge=Xn(d),ee=Xn(p),fe=typeof d!="function"?d:0,te=typeof p!="function"?p:0,Ce=[];w&&Ce.push(w),Ce.push(YH(nt=>{const Ot=JT(nt,c,F),Ft=typeof ge.current=="function"?ge.current(Ot):ge.current,Zn=typeof ee.current=="function"?ee.current(Ot):ee.current;return{mainAxis:Ft,crossAxis:Zn,alignmentAxis:Zn}},[fe,te,F,c]));const re=L==="none"&&_!=="shift",de=!re&&(y||B||_==="shift"),ke=_==="none"?null:ZH({...J,padding:{top:le.top+M+U,right:le.right+M+ce,bottom:le.bottom+M+Z,left:le.left+M+ae},mainAxis:!B&&_==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Ee=re?null:XH({...J,rootBoundary:z,mainAxis:L!=="none",crossAxis:de,limiter:y||B?void 0:QH(nt=>{if(!ie.current)return{};const{width:Ot,height:Ft}=ie.current.getBoundingClientRect(),Zn=na(ta(nt.placement)),Un=Zn==="y"?Ot:Ft,Vn=Zn==="y"?le.left+le.right:le.top+le.bottom;return{offset:Un/2+Vn/2}})},[J,y,B,z,le,L]);_==="shift"||L==="shift"||f==="center"?Ce.push(Ee,ke):Ce.push(ke,Ee),Ce.push(WH({...J,apply({elements:{floating:nt},availableWidth:Ot,availableHeight:Ft,rects:Zn}){if(!$.current)return;const Un=nt.style;Un.setProperty(QT,`${Ot}px`),Un.setProperty(ZT,`${Ft}px`);const Vn=Sn(nt).devicePixelRatio||1,{x:Rn,y:Jt,width:ls,height:Tt}=Zn.reference,xt=(Math.round((Rn+ls)*Vn)-Math.round(Rn*Vn))/Vn,jt=(Math.round((Jt+Tt)*Vn)-Math.round(Jt*Vn))/Vn;Un.setProperty(VU,`${xt}px`),Un.setProperty(FU,`${jt}px`)}}),LU(nt=>({element:ie.current||$t(nt.elements.floating).createElement("div"),padding:ie.current?b:0,offsetParent:"floating"}),[b]),{name:"transformOrigin",fn(nt){const{elements:{floating:Ot},middlewareData:Ft,placement:Zn,platform:Un,rects:Vn,y:Rn}=nt,Jt=ta(Zn),ls=Sl(Zn),Tt=na(Jt)==="y",xt=ie.current,jt=typeof d=="function"?d(JT(nt,c,F)):d;let wt;if(!xt&&ls&&Math.abs(Tt?Ft.shift?.x||0:Ft.shift?.y||0)<=1)wt=ls==="start"===(Tt&&Un.isRTL?.(Ot)===!0)?"100%":"0%";else{const rr=Tt?Ft.arrow?.x||0:Ft.arrow?.y||0,Hr=Tt?xt?.clientWidth||0:xt?.clientHeight||0;wt=`${rr+Hr/2}px`}let kr=Jt==="top"||Jt==="left"?`calc(100% + ${jt}px)`:`${-jt}px`;return de&&Tt&&Math.abs(Ft.shift?.y||0)>jt&&(kr=`${Vn.reference.y+Vn.reference.height/2-Rn}px`),Ot.style.setProperty($U,Tt?`${wt} ${kr}`:`${kr} ${wt}`),{}}},zU,A),De(()=>{!N&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[N,S]);const ve=x.useMemo(()=>({ancestorScroll:!j,elementResize:!j&&typeof ResizeObserver<"u",layoutShift:!j&&typeof IntersectionObserver<"u"}),[j]),{refs:he,elements:ye,x:we,y:xe,middlewareData:Te,update:Oe,placement:Ne,context:Le,isPositioned:Ye,floatingStyles:kt}=t({rootContext:S,open:k?N:void 0,placement:W,middleware:Ce,strategy:o,whileElementsMounted:k?void 0:(...nt)=>bT(...nt,ve),nodeId:C,externalTree:I}),{sideX:Ct,sideY:Rt}=Te.adaptiveOrigin||BU,ot=Ye?o:"fixed",qn=x.useMemo(()=>{let nt;return Ye?A?nt={position:ot,[Ct]:we,[Rt]:xe}:nt={...kt,position:ot}:nt={position:ot,top:0,left:0},nt[QT]="100vw",nt[ZT]="100vh",Ye||(nt.opacity=0),nt},[A,ot,Ct,we,Rt,xe,kt,Ye]),ps=x.useRef(null);De(()=>{if(!N)return;const nt=q.current,Ot=typeof nt=="function"?nt():nt,Zn=(eE(Ot)?Ot.current:Ot)||null||null;Zn!==ps.current&&(he.setPositionReference(Zn),ps.current=Zn)},[N,he,X,q]),x.useEffect(()=>{if(!N)return;const nt=q.current;typeof nt!="function"&&eE(nt)&&nt.current!==ps.current&&(he.setPositionReference(nt.current),ps.current=nt.current)},[N,he,X,q]),x.useEffect(()=>{if(k&&N&&ye.reference&&ye.floating)return bT(ye.reference,ye.floating,Oe,ve)},[k,N,ye,Oe,ve]);const Gn=ta(Ne),bs=WT(c,Gn,F),it=Sl(Ne)||"center",Vt=!!Te.hide?.referenceHidden;De(()=>{R&&N&&Ye&&Gn!==G&&O(Gn)},[R,N,Ye,Gn,G]);const Hn=x.useMemo(()=>({position:"absolute",top:Te.arrow?.y,left:Te.arrow?.x}),[Te.arrow]),tn=Te.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:qn,arrowStyles:Hn,arrowRef:ie,arrowUncentered:tn,side:bs,align:it,physicalSide:Gn,anchorHidden:Vt,refs:he,context:Le,isPositioned:Ye,update:Oe}),[qn,Hn,ie,tn,bs,it,Gn,Vt,he,Le,Ye,Oe])}function eE(e){return e!=null&&"current"in e}function uf(e){return e==="starting"?nH:fn}function wh(e,t,{styles:a,transitionStatus:o,props:c,refs:d,hidden:f,inert:p=!1}){const h={...a};return p&&(h.pointerEvents="none"),yt("div",e,{state:t,ref:d,props:[{role:"presentation",hidden:f,style:h},uf(o),c],stateAttributesMapping:qc})}const GU=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f="absolute",side:p="top",align:h="center",sideOffset:v=0,alignOffset:y=0,collisionBoundary:b="clipping-ancestors",collisionPadding:j=5,arrowPadding:w=5,sticky:k=!1,disableAnchorTracking:S=!1,collisionAvoidance:N=Q1,style:T,...D}=t,C=nf(),A=MU(),R=C.useState("open"),I=C.useState("mounted"),P=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),_=C.useState("floatingRootContext"),L=C.useState("instantType"),H=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),z=jh({anchor:d,positionMethod:f,floatingRootContext:_,mounted:I,side:p,sideOffset:v,align:h,alignOffset:y,collisionBoundary:b,collisionPadding:j,sticky:k,arrowPadding:w,disableAnchorTracking:S,keepMounted:A,collisionAvoidance:N,adaptiveOrigin:B}),Q=x.useMemo(()=>({open:R,side:z.side,align:z.align,anchorHidden:z.anchorHidden,instant:P!=="none"?"tracking-cursor":L}),[R,z.side,z.align,z.anchorHidden,P,L]),K=wh(t,Q,{styles:z.positionerStyles,transitionStatus:H,props:D,refs:[a,C.useStateSetter("positionerElement")],hidden:!I,inert:!R||P==="both"||O});return s.jsx(YT.Provider,{value:z,children:K})}),KU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{side:h,align:v}=XT(),y=p.useState("open"),b=p.useState("instantType"),j=p.useState("transitionStatus"),w=p.useState("popupProps"),k=p.useState("floatingRootContext"),S=p.useState("disabled"),N=p.useState("closeDelay");ra({open:y,ref:p.context.popupRef,onComplete(){y&&p.context.onOpenChangeComplete?.(!0)}}),LT(k,{enabled:!S,closeDelay:N});const T=p.useStateSetter("popupElement");return yt("div",t,{state:{open:y,side:h,align:v,instant:b,transitionStatus:j},ref:[a,p.context.popupRef,T],props:[lf,w,uf(j),f],stateAttributesMapping:qv})}),YU=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,p=nf(),{arrowRef:h,side:v,align:y,arrowUncentered:b,arrowStyles:j}=XT(),w=p.useState("open"),k=p.useState("instantType");return yt("div",t,{state:{open:w,side:v,align:y,uncentered:b,instant:k},ref:[a,h],props:[{style:j,"aria-hidden":!0},f],stateAttributesMapping:qc})}),XU=function(t){const{delay:a,closeDelay:o,timeout:c=400}=t,d=x.useMemo(()=>({open:a,close:o}),[a,o]);return s.jsx($T.Provider,{value:a,children:s.jsx(Q4,{delay:d,timeoutMs:c,children:t.children})})};function Sh(e){return Iv(19)?e:e?"true":void 0}function QU(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function ZU(e){return s.jsx(XU,{"data-slot":"tooltip-provider",...e})}function Ii(e){return s.jsx(CU,{"data-slot":"tooltip",...e})}function Pi(e){return s.jsx(OU,{"data-slot":"tooltip-trigger",...e})}function _i({className:e,sideOffset:t=8,side:a="top",children:o,...c}){return s.jsx(IU,{children:s.jsx(GU,{sideOffset:t,side:a,className:"z-[35]",children:s.jsx(KU,{"data-slot":"tooltip-content",className:Ue("max-w-[288px] rounded-md bg-primary px-2.5 py-2 text-[11.5px] leading-[1.55] text-primary-on shadow-3","break-words outline-none","transition-[opacity,transform] duration-150 ease-out","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:o})})})}function WU({className:e,...t}){return s.jsx(YU,{className:Ue("size-2 rotate-45 rounded-[1px] bg-primary","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1",e),...t})}const tE=x.createContext(void 0);function su(e){const t=x.useContext(tE);if(!e&&t===void 0)throw new Error(on(27));return t}const nE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,forceRender:f=!1,...p}=t,h=su(),v=h.useState("open"),y=h.useState("nested"),b=h.useState("mounted"),j=h.useState("transitionStatus");return yt("div",t,{state:{open:v,transitionStatus:j},ref:[h.context.backdropRef,a],stateAttributesMapping:qv,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:f||!y})}),sE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,...h}=t,v=su(),y=v.useState("open"),{getButtonProps:b,buttonRef:j}=Jr({disabled:f,native:p}),w={disabled:f};function k(S){y&&v.setOpen(!1,$e(oy,S.nativeEvent))}return yt("button",t,{state:w,ref:[a,j],props:[{onClick:k},h,b]})}),rE=x.createContext(void 0);function JU(){const e=x.useContext(rE);if(e===void 0)throw new Error(on(26));return e}const Uy="ArrowUp",Vy="ArrowDown",Fy="ArrowLeft",$y="ArrowRight",qy="Home",Gy="End",Nh=new Set([Uy,Vy,Fy,$y,qy,Gy]),aE="Shift",eV=[aE,"Control","Alt","Meta"];function tV(e){return dn(e)&&e.tagName==="INPUT"}function lE(e){return!!(tV(e)&&e.selectionStart!=null||dn(e)&&e.tagName==="TEXTAREA")}function oE(e,t,a,o){if(!e||!t||!t.scrollTo)return;let c=e.scrollLeft,d=e.scrollTop;const f=e.clientWidthe.scrollLeft+e.clientWidth-v.scrollPaddingRight?c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+v.scrollPaddingRight:h-y.scrollMarginLefte.scrollLeft+e.clientWidth-v.scrollPaddingRight&&(c=h+t.offsetWidth+y.scrollMarginRight-e.clientWidth+v.scrollPaddingRight))}if(p&&o!=="horizontal"){const h=iE(e,t,"top"),v=kh(e),y=kh(t);h-y.scrollMarginTope.scrollTop+e.clientHeight-v.scrollPaddingBottom&&(d=h+t.offsetHeight+y.scrollMarginBottom-e.clientHeight+v.scrollPaddingBottom)}e.scrollTo({left:c,top:d,behavior:"auto"})}function iE(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let c=0;for(;t.offsetParent&&(c+=t[o],t.offsetParent!==e);)t=t.offsetParent;return c}function kh(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const nV="--nested-dialogs",sV="data-nested-dialog-open",rV={...qc,...io,nestedDialogOpen(e){return e?{[sV]:""}:null}},cE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,initialFocus:p,...h}=t,v=su(),y=v.useState("descriptionElementId"),b=v.useState("disablePointerDismissal"),j=v.useState("floatingRootContext"),w=v.useState("popupProps"),k=v.useState("modal"),S=v.useState("mounted"),N=v.useState("nested"),T=v.useState("nestedOpenDialogCount"),D=v.useState("open"),C=v.useState("openMethod"),A=v.useState("titleElementId"),R=v.useState("transitionStatus"),I=v.useState("role"),P=j.useState("floatingId");JU(),ra({open:D,ref:v.context.popupRef,onComplete(){D&&v.context.onOpenChangeComplete?.(!0)}});const O=p===void 0?TT(v.context.popupRef):p,_=T>0,L=v.useStateSetter("popupElement"),B=yt("div",t,{state:{open:D,nested:N,transitionStatus:R,nestedDialogOpen:_},props:[w,{id:P,"aria-labelledby":A,"aria-describedby":y,role:I,...lf,hidden:!S,onKeyDown(z){Nh.has(z.key)&&z.stopPropagation()},style:{[nV]:T}},h],ref:[a,v.context.popupRef,L],stateAttributesMapping:rV});return s.jsx(ih,{context:j,openInteractionType:C,disabled:!S,closeOnFocusOut:!b,initialFocus:O,returnFocus:f,modal:k!==!1,restoreFocus:"popup",children:B})}),Ch=x.forwardRef(function(t,a){const{cutout:o,...c}=t;let d;if(o){const f=o.getBoundingClientRect();d=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${f.left}px ${f.top}px,${f.left}px ${f.bottom}px,${f.right}px ${f.bottom}px,${f.right}px ${f.top}px,${f.left}px ${f.top}px)`}return s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...c,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:d}})}),uE=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=su(),f=d.useState("mounted"),p=d.useState("modal"),h=d.useState("open");return f||o?s.jsx(rE.Provider,{value:o,children:s.jsxs(oh,{ref:a,...c,children:[f&&p===!0&&s.jsx(Ch,{ref:d.context.internalBackdropRef,inert:Sh(!h)}),t.children]})}):null});let dE={},fE={},pE="";function Th(e,t){return Fd(e)?e:t}function mE(e,t,a){return/hidden|clip/.test(e.getComputedStyle(Th(t,a)).overflowY)}function aV(e){if(typeof document>"u")return!1;const t=$t(e);return Sn(t).innerWidth-t.documentElement.clientWidth>0}function lV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=$t(e),o=a.documentElement,c=a.body,d=Th(o,c),f=d.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",d.style.overflowY="scroll";const h=d.offsetWidth;d.style.overflowY="hidden";const v=d.offsetWidth;return d.style.overflowY=f,o.style.scrollbarGutter=p,h===v}function oV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Th(a,o),d={overflowY:c.style.overflowY,overflowX:c.style.overflowX};return Object.assign(c.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(c.style,d)}}function iV(e){const t=$t(e),a=t.documentElement,o=t.body,c=Sn(a);let d=0,f=0,p=!1;const h=qa.create();if(yl&&(c.visualViewport?.scale??1)!==1)return()=>{};function v(){const w=c.getComputedStyle(a),k=c.getComputedStyle(o),T=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";d=a.scrollTop,f=a.scrollLeft,dE={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},pE=a.style.scrollBehavior,fE={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const D=a.scrollHeight>a.clientHeight,C=a.scrollWidth>a.clientWidth,A=w.overflowY==="scroll"||k.overflowY==="scroll",R=w.overflowX==="scroll"||k.overflowX==="scroll",I=Math.max(0,c.innerWidth-o.clientWidth),P=Math.max(0,c.innerHeight-o.clientHeight),O=parseFloat(k.marginTop)+parseFloat(k.marginBottom),_=parseFloat(k.marginLeft)+parseFloat(k.marginRight),L=Th(a,o);if(p=lV(e),p){a.style.scrollbarGutter=T,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(D||A)&&(a.style.overflowY="scroll"),(C||R)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:O||P?`calc(100dvh - ${O+P}px)`:"100dvh",width:_||I?`calc(100vw - ${_+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=d,o.scrollLeft=f,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,dE),Object.assign(o.style,fE),p||(a.scrollTop=d,a.scrollLeft=f,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=pE)}function b(){y(),h.request(v)}v();const j=St(c,"resize",b);return()=>{h.cancel(),y(),typeof c.removeEventListener=="function"&&j()}}class cV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",sa.create());ln(this,"timeoutUnlock",sa.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const a=$t(t),o=a.documentElement,c=a.body,d=Sn(o);if(mE(d,o,c)){const p=new d.MutationObserver(()=>{mE(d,o,c)||(p.disconnect(),this.restore=null,this.lock(t))}),h={attributes:!0};p.observe(o,h),p.observe(c,h),this.restore=()=>p.disconnect();return}const f=Yd||!aV(t);this.restore=f?oV(t):iV(t)}}const uV=new cV;function hE(e=!0,t=null){De(()=>{if(e)return uV.acquire(t)},[e,t])}function dV({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[h,v]=x.useState(0),[y,b]=x.useState(0),j=h===0,w=af(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(k){if(!e.context.outsidePressEnabledRef.current||"button"in k&&k.button!==0)return!1;if("touches"in k){if(k.type==="touchend"){if(k.changedTouches.length!==1||k.touches.length!==0)return!1}else if(k.touches.length!==1)return!1}const S=cs(k);if(j&&!c){if(d){const N=e.context.internalBackdropRef.current,T=e.context.backdropRef.current;return N||T?N===S||T===S||Qe(S,f)&&!S?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:j});return hE(o&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(k,S)=>{v(k),b(S)}),De(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(h+1,y+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[a,o,h,y,t]),Dy(e,{activeTriggerProps:w.reference,inactiveTriggerProps:w.trigger,popupProps:w.floating,nestedOpenDialogCount:h,nestedOpenDrawerCount:y}),null}const fV={..._y,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class pV extends nu{constructor(a,o,c){const d=new ph,f=mV(a,d,o,c);super(f,hV(d),fV);ln(this,"setOpen",(a,o)=>{o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(a,o),this.update(Ry(this.state,a,o.trigger)))})}}function mV(e,t,a,o=!1){return{...Iy(t,a,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function hV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gE(e,t){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,disablePointerDismissal:p=!1,modal:h=!0,actionsRef:v,handle:y,triggerId:b,defaultTriggerId:j=null}=t,w=e==="drawer",k=e==="alert-dialog",S=k?!0:h,N=k||p,T=k?"alertdialog":"dialog",D=su(!0),C=D!=null,A={modal:S,disablePointerDismissal:N,nested:C,role:T},R=Ey((H,B)=>new pV({open:c,openProp:o,activeTriggerId:j,triggerIdProp:b,...A},H,B),!0);R.useControlledProp("openProp",o),R.useControlledProp("triggerIdProp",b),R.useSyncedValues(A),R.useContextCallback("onOpenChange",d),R.useContextCallback("onOpenChangeComplete",f);const I=R.useState("open"),P=R.useState("mounted"),O=R.useState("payload");OT(R,I),Oy(R);const{forceUnmount:_}=My(I,R);x.useImperativeHandle(v,()=>({unmount:_,close:()=>R.setOpen(!1,$e(cy))}),[_,R]);const L=I||P;return s.jsxs(tE.Provider,{value:R,children:[y&&s.jsx(Ay,{handle:y,store:R}),L&&s.jsx(dV,{store:R,parentContext:D?.context,isDrawer:w}),typeof a=="function"?a({payload:O}):a]})}const gV=rh(function(t){return gE("dialog",t)}),xE=x.forwardRef(function(t,a){const{render:o,className:c,style:d,id:f,...p}=t,h=su(),v=Na(f);return h.useSyncedValueWithCleanup("titleElementId",v),yt("h2",t,{ref:a,props:[{id:v},p]})});function xV(e){const t=x.useRef(""),a=x.useCallback(c=>{c.defaultPrevented||(t.current=c.pointerType,e(c,c.pointerType))},[e]);return{onClick:x.useCallback(c=>{if(c.detail===0){e(c,"keyboard");return}"pointerType"in c?e(c,c.pointerType):e(c,t.current),t.current=""},[e]),onPointerDown:a}}function bE(e,t){const a=Ie((d,f)=>{(typeof e=="function"?e():e)||t(f||(Yd?"touch":""))}),{onClick:o,onPointerDown:c}=xV(a);return x.useMemo(()=>({onClick:o,onPointerDown:c}),[o,c])}function vE(e){const[t,a]=x.useState(null),o=bE(e,a);return aa(e,c=>{c&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Qt(e){return s.jsx(gV,{"data-slot":"dialog",...e})}function bV(e){return s.jsx(uE,{"data-slot":"dialog-portal",...e})}const Gt=e=>s.jsx(xE,{"data-slot":"dialog-title",...e});function vV({className:e,...t}){return s.jsx(nE,{"data-slot":"dialog-overlay",className:Ue("fixed inset-0 isolate z-30 bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function Zt({className:e,children:t,showCloseButton:a=!0,keepMounted:o=!1,overlayForceRender:c=!1,...d}){return s.jsxs(bV,{keepMounted:o,children:[s.jsx(vV,{forceRender:c}),s.jsxs(cE,{"data-slot":"dialog-content",className:Ue("fixed top-1/2 left-1/2 z-30 flex max-h-[calc(100vh-48px)] w-[min(620px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...d,children:[t,a&&s.jsxs(sE,{"data-slot":"dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:xo("关闭")})]})]})]})}function Kt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px] pr-10","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function Bt({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function zn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-section",className:Ue("flex flex-col gap-2.5 rounded-md border border-border bg-surface-inset p-3.5","[&_h3]:text-[12.5px] [&_h3]:font-semibold","[&_p]:text-xs [&_p]:leading-[1.65] [&_p]:text-subtle",e),...t})}function yV(e){return gE("alert-dialog",e)}const jV=yV,wV=uE,SV=e=>s.jsx(xE,{"data-slot":"alert-dialog-title",...e});function NV({className:e,...t}){return s.jsx(nE,{"data-slot":"alert-dialog-overlay",className:Ue("fixed inset-0 isolate z-[38] bg-mask backdrop-blur-[3px]","transition-opacity duration-150","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...t})}function kV({className:e,children:t,showCloseButton:a=!1,...o}){return s.jsxs(wV,{children:[s.jsx(NV,{}),s.jsxs(cE,{"data-slot":"alert-dialog-content",className:Ue("fixed top-1/2 left-1/2 z-[38] flex max-h-[calc(100vh-48px)] w-[min(440px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 flex-col","overflow-hidden rounded-lg border border-border bg-surface shadow-3 outline-none","transition-[opacity,transform] duration-200 [transition-timing-function:cubic-bezier(.2,.9,.3,1)]","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-[.985] data-open:slide-in-from-bottom-2.5","data-closed:animate-out data-closed:fade-out-0 data-closed:fill-mode-forwards",e),...o,children:[t,a&&s.jsxs(sE,{"data-slot":"alert-dialog-close",render:s.jsx(se,{variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3"}),children:[s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 2.5l7 7M9.5 2.5l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})}),s.jsx("span",{className:"sr-only",children:xo("关闭")})]})]})]})}function CV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("flex items-center gap-2.5 border-b border-hairline px-5 py-[15px]","[&_h2]:flex-1 [&_h2]:text-[14.5px] [&_h2]:font-semibold",e),...t})}function TV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-body",className:Ue("flex flex-col gap-4 overflow-y-auto px-5 py-[18px]",e),...t})}function EV({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("flex items-center gap-2 border-t border-hairline bg-surface-2 px-5 py-[13px]",e),...t})}function AV({className:e,tone:t="danger",...a}){return s.jsx("div",{"data-slot":"alert-dialog-banner","data-tone":t,className:Ue("rounded-md border px-3.5 py-3 text-xs leading-[1.65] text-subtle","[&_strong]:font-semibold",t==="danger"?"border-destructive-bd bg-destructive-soft [&_strong]:text-destructive":"border-border bg-surface-inset [&_strong]:text-foreground",e),...a})}function Ky({className:e,containerClassName:t,...a}){return s.jsx("div",{"data-slot":"table-container",className:Ue("relative w-full overflow-auto",t),children:s.jsx("table",{"data-slot":"table",className:Ue("w-full caption-bottom border-collapse text-[12.5px]",e),...a})})}function yE({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:Ue(e),...t})}function Yy({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:Ue(e),...t})}function kl({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:Ue("transition-colors duration-100 hover:[&>td]:bg-control-hover",e),...t})}function jE({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:Ue("sticky top-0 z-[2] whitespace-nowrap border-b border-border bg-surface-2 px-3.5 py-2","text-left text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground",e),...t})}function Nn({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:Ue("border-b border-hairline px-3.5 py-2 align-middle",e),...t})}const RV="data-checked",OV="data-unchecked",Xy={checked(e){return e?{[RV]:""}:{[OV]:""}},...io,...ji},Qy="data-composite-item-active",wE=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function MV(){return x.useContext(wE)}function Zy(e={}){const{guess:t,label:a,metadata:o,textRef:c,index:d}=e,{register:f,unregister:p,subscribeMapChange:h,nextIndexRef:v}=MV(),y=x.useRef(-1),[b,j]=x.useState(d==null&&t?()=>{if(y.current===-1){const N=v.current;v.current+=1,y.current=N}return y.current}:-1),w=d??b,k=x.useRef(null),S=x.useCallback(N=>{const T=k.current;T&&p(T),k.current=N,N&&f(N,{metadata:o??null,index:d??null,label:a,textRef:c})},[d,f,p,o,a,c]);return De(()=>{if(d==null)return h(N=>{const T=k.current?N.get(k.current)?.index:null;T!=null&&j(T)})},[d,h]),{ref:S,index:w}}function DV(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=vC(),{ref:c,index:d}=Zy(e),f=a===d,p=x.useRef(null),h=ea(c,p);return{compositeProps:{tabIndex:f?0:-1,onFocus(){o(d)},onMouseMove(){const y=p.current;if(!t||!y)return;const b=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!b&&y.focus()}},compositeRef:h,index:d}}function SE(e){const{render:t,className:a,style:o,state:c=fn,props:d=Mr,refs:f=Mr,metadata:p,stateAttributesMapping:h,tag:v="div",...y}=e,{compositeProps:b,compositeRef:j}=DV({metadata:p});return yt(v,e,{state:c,ref:[j,...f],props:[b,...d,y],stateAttributesMapping:h})}const NE=x.createContext(void 0);function IV(){return x.useContext(NE)}function Eh(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const kE=x.createContext(void 0);function PV(){const e=x.useContext(kE);if(e===void 0)throw new Error(on(52));return e}const CE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,readOnly:f=!1,required:p=!1,"aria-labelledby":h,value:v,inputRef:y,nativeButton:b=!1,id:j,style:w,...k}=t,S=IV(),{disabled:N,readOnly:T,required:D,form:C,checkedValue:A,touched:R=!1,validation:I,name:P,setCheckedValue:O=qt,setTouched:_=qt,registerInputRef:L=qt}=S??{},{setTouched:H,setFilled:B,state:z,disabled:Q}=Sa(),K=y1(),{labelId:X,getDescriptionProps:q}=vl(),$=Q||K.disabled||N||d,Y=T||f,F=D||p,G=C,W=S?A===v:v==="",le=x.useRef(null),M=x.useRef(null),U=I?.registerInput,Z=x.useCallback(ye=>U?.(ye,{controlRef:le,value:void 0}),[U]),ae=ea(y,M,L,Z);De(()=>{M.current?.checked&&B(!0)},[B]),De(()=>{if(M.current){if($&&W){L(null);return}L(M.current)}},[W,$,L]);const ce=Na(),J=oo({id:j}),ie=b?void 0:J,ge=Bv(h,X,M,!b,ie),ee={role:"radio","aria-checked":W,"aria-labelledby":ge,[Qy]:W?"":void 0,id:b?J:ce,onKeyDown(ye){ye.key==="Enter"&&ye.preventDefault()},onClick(ye){if(ye.defaultPrevented||$||Y)return;ye.preventDefault();const we=M.current;we&&Vc(we,ye)},onFocus(ye){ye.defaultPrevented||$||Y||!R||(M.current?.click(),_(!1))}},{getButtonProps:fe,buttonRef:te}=Jr({disabled:$,native:b,composite:!1}),Ce={type:"radio",ref:ae,form:G,id:ie,name:P,tabIndex:-1,style:P?Wc:Ai,"aria-hidden":!0,...v!==void 0?{value:Eh(v)}:fn,disabled:$,checked:W,required:F,readOnly:Y,onChange(ye){if(ye.nativeEvent.defaultPrevented||$||Y||v===void 0)return;const we=$e(Yn,ye.nativeEvent);O(v,we),!we.isCanceled&&H(!0)},onClick(ye){ye.stopPropagation()},onFocus(){le.current?.focus()}},re=x.useMemo(()=>({...z,required:F,disabled:$,readOnly:Y,checked:W}),[z,$,Y,W,F]),de=re,ke=S!==void 0,Ee=[a,le,te],ve=[ee,k,fe,q,I?ye=>I.getValidationProps($,ye):fn],he=yt("span",t,{enabled:!ke,state:re,ref:Ee,props:ve,stateAttributesMapping:Xy});return s.jsxs(kE.Provider,{value:de,children:[ke?s.jsx(SE,{tag:"span",render:o,className:c,style:w,state:re,refs:Ee,props:ve,stateAttributesMapping:Xy}):he,s.jsx("input",{...Ce,suppressHydrationWarning:!0})]})}),_V=x.forwardRef(function(t,a){const{render:o,className:c,style:d,keepMounted:f=!1,...p}=t,h=PV(),v=h.checked,{mounted:y,transitionStatus:b,setMounted:j}=ki(v),w={...h,transitionStatus:b},k=x.useRef(null),S=f||y,N=yt("span",t,{ref:[a,k],state:w,props:p,stateAttributesMapping:Xy});return ra({batch:!0,enabled:!v,open:v,ref:k,onComplete(){v||j(!1)}}),S?N:null});function Wy(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:c}=e,d=Ie(c),[,f]=x.useState(!1),p=Ds(zV).current,h=Ds(LV).current,v=x.useRef(0),y=x.useRef(!0),b=x.useRef(null),j=x.useRef(null),w=Ie(()=>{y.current||(y.current=!0,f(R=>!R))}),k=Ie((R,I)=>{h.set(R,I),w()}),S=Ie(R=>{h.delete(R),w()}),N=Ie(R=>{const I=new Map;return a.current.length=0,o&&(o.current.length=0),R.forEach(P=>{I.set(P.element,{...P.registration.metadata??{},index:P.index}),a.current[P.index]=P.element,o&&(o.current[P.index]=P.registration.label!==void 0?P.registration.label:P.registration.textRef?.current?.textContent??P.element.textContent)}),v.current=a.current.length,I});function T(R){if(j.current?.disconnect(),j.current=null,typeof MutationObserver!="function"||R.length<2)return;const I=new MutationObserver(O=>{if(!UV(O))return;let _=null;for(const L of R)if(L.isConnected){if(_&&TE(_,L)>0){I.disconnect(),w();return}_=L}});j.current=I;const P=new Set;for(let O=1;OI.observe(O,{childList:!0}))}const D=Ie(()=>{const[R,I]=BV(h),P=N(R),O=b.current,_=!O||O.length!==R.length||R.some((L,H)=>{const B=O[H];return L.index!==B.index||L.element!==B.element||L.registration.index!==B.registration.index||L.registration.metadata!==B.registration.metadata});T(I),b.current=R,y.current=!1,_&&(p.forEach(L=>L(P)),d(P))});De(()=>(!y.current&&b.current&&N(b.current),()=>{a.current=[],o&&(o.current=[])}),[a,o,N]),De(()=>{y.current&&D()}),De(()=>()=>{j.current?.disconnect(),y.current=!0},[]);const C=Ie(R=>(p.add(R),()=>{p.delete(R)})),A=x.useMemo(()=>({register:k,unregister:S,subscribeMapChange:C,nextIndexRef:v}),[k,S,C,v]);return s.jsx(wE.Provider,{value:A,children:t})}function LV(){return new Map}function zV(){return new Set}function BV(e){const t=new Set,a=[],o=[];e.forEach((d,f)=>{if(!f.isConnected)return;const p=d.index,h={index:p??-1,element:f,registration:d};p===null?o.push(h):p>=0&&(t.add(p),a.push(h))});let c=0;return o.sort((d,f)=>TE(d.element,f.element)),o.forEach(d=>{for(;t.has(c);)c+=1;d.index=c,a.push(d),c+=1}),t.size>0&&a.sort((d,f)=>d.index-f.index),[a,o.map(d=>d.element)]}function HV(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function UV(e){for(const t of e)for(let a=0;a{if(A.current=D.current[H]??null,(p??k)(H),B){const z=D.current[H];oE(N.current,z,d,a)}}),P=Ie(H=>{if(H.size===0)return;if(C.current){const K=D.current,X=K.indexOf(A.current);if(X===-1){const q=K[R];!q||mo(K,R,b)?I(FV(K,b)):A.current=q}else X!==R&&I(X);return}C.current=!0;const B=Array.from(H.keys()),z=B.find(K=>K?.hasAttribute(Qy))??null,Q=z?H.get(z)?.index??-1:-1;if(Q!==-1)I(Q);else if(mo(B,R,b)){const K=Is(B,{disabledIndices:b});po(B,K)||I(K)}oE(N.current,z,d,a)});De(()=>{if(b==null||f!=null||!C.current)return;const H=D.current;if(mo(H,R,b)){const B=Is(H,{disabledIndices:b});po(H,B)||I(B)}},[b,f,R,D,I]);const O=Ie((H,B,z)=>c?c(H,B,z,D):z),_=Ie(H=>{const B=H.key===qy||H.key===Gy;if(!Nh.has(H.key)||!v&&B||$V(H,j)||!N.current)return;const Q=d==="rtl",K=Q?Fy:$y,X=Q?$y:Fy,q=a==="vertical"?Vy:K,$=a==="vertical"?Uy:X,Y=cs(H.nativeEvent);if(Y!=null&&lE(Y)&&!EE(Y)){const U=Y.selectionStart,Z=Y.selectionEnd,ae=Y.value;if(U==null||H.shiftKey||U!==Z||H.key!==$&&U0)return}let F=R;const G=Zm(D,b),W=ey(D,b);o!=null&&(F=o({disabledIndices:b,elementsRef:D,event:H,highlightedIndex:R,loopFocus:t,maxIndex:W,minIndex:G,onLoop:O,orientation:a,rtl:Q}));const le=a!=="vertical"&&H.key===K||a!=="horizontal"&&H.key===Vy,M=a!=="vertical"&&H.key===X||a!=="horizontal"&&H.key===Uy;v&&(H.key===qy?F=G:H.key===Gy&&(F=W)),F===R&&(le||M)&&(t&&F===W&&le?(F=G,c&&(F=c(H,R,F,D))):t&&F===G&&M?(F=W,c&&(F=c(H,R,F,D))):F=Is(D.current,{startingIndex:F,decrement:M,disabledIndices:b})),F!==R&&!po(D.current,F)&&(y&&H.stopPropagation(),(S||B||le||M)&&H.preventDefault(),I(F,!0),queueMicrotask(()=>{D.current[F]?.focus()}))});return{props:{ref:T,onFocus(H){const B=N.current,z=cs(H.nativeEvent);!B||z==null||!lE(z)||z.setSelectionRange(0,z.value.length)},onKeyDown:_},highlightedIndex:R,onHighlightedIndexChange:I,elementsRef:D,onMapChange:P,relayKeyboardEvent:_}}function FV(e,t){let a=-1;for(let o=0;o({highlightedIndex:_,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:z}),[_,L,A,z]);return s.jsx(bC.Provider,{value:K,children:s.jsx(Wy,{elementsRef:H,onMapChange:X=>{S?.(X),B(X)},children:Q})})}const GV=[aE],AE=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d,readOnly:f,required:p,onValueChange:h,value:v,defaultValue:y,form:b,name:j,inputRef:w,id:k,style:S,...N}=t,{setTouched:T,setFocused:D,validationMode:C,name:A,disabled:R,state:I,validation:P,setDirty:O,setFilled:_,validityData:L}=Sa(),{labelId:H}=vl(),{clearErrors:B,elementRef:z}=$c(),Q=dB(!0),K=R||d,X=A??j,q=Na(k),[$,Y]=Ga({controlled:v,default:y,name:"RadioGroup",state:"value"}),[F,G]=x.useState(!1),W=Ie((te,Ce)=>{h?.(te,Ce),!Ce.isCanceled&&Y(te)}),le=P.getInputControl,M=x.useMemo(()=>({get current(){return le()}}),[le]),U=x.useRef(null),Z=x.useRef(null);function ae(te){let Ce;return w&&(typeof w=="function"?Ce=w(te):w.current=te),U.current=te,Ce}const ce=Ie(te=>{if(!te||te.disabled)return;Z.current||(Z.current=te);const Ce=U.current,re=te.checked||Ce==null||Ce.disabled?ae(te):void 0;return()=>{Z.current===te&&(Z.current=null),U.current===te?re?(re(),U.current=null):ae(null):re?.()}}),J=Ie(()=>{const te=z.current;if(!te)return $??null;for(const Ce of P.registeredInputs.keys())if(Ce.checked&&r4(Ce,te))return $??null;return null});Xc(M,q,$??null,J,!K,j),aa($,()=>{B(X),O($!==L.initialValue),_($!=null),P.change($);const te=Z.current;$==null&&te&&!te.disabled&&ae(te)});const ie=H??Q?.legendId,ge={...I,disabled:K??!1,required:p??!1,readOnly:f??!1},ee=x.useMemo(()=>({checkedValue:$,disabled:K,form:b,validation:P,name:X,readOnly:f,registerInputRef:ce,required:p,setCheckedValue:W,setTouched:G,touched:F}),[$,K,b,P,X,f,ce,p,W,G,F]),fe={id:k,role:"radiogroup","aria-required":p||void 0,"aria-disabled":K||void 0,"aria-readonly":f||void 0,"aria-labelledby":ie,onFocus(){D(!0)},onBlur(te){Qe(te.currentTarget,te.relatedTarget)||(T(!0),D(!1),C==="onBlur"&&P.commit($))},onKeyDownCapture(te){te.key.startsWith("Arrow")&&(G(!0),D(!0))}};return s.jsx(NE.Provider,{value:ee,children:s.jsx(qV,{render:o,className:c,style:S,state:ge,props:[fe,N,te=>P.getValidationProps(K??!1,te)],refs:[a],stateAttributesMapping:ji,enableHomeAndEndKeys:!1,modifierKeys:GV})})});function Ah({className:e,...t}){return s.jsx(AE,{"data-slot":"radio-group",className:Ue("flex flex-col gap-2",e),...t})}function vo({className:e,...t}){return s.jsx(CE,{"data-slot":"radio-group-item",className:Ue("relative inline-flex size-3.5 flex-none cursor-pointer items-center justify-center rounded-full border border-control-border bg-control","outline-none transition-colors duration-150 ease-out","hover:border-control-border-hover","data-checked:border-primary data-checked:bg-primary","focus-visible:shadow-focus","data-disabled:cursor-not-allowed data-disabled:opacity-45",e),...t,children:s.jsx(_V,{"data-slot":"radio-group-indicator",className:"grid place-content-center data-unchecked:hidden",children:s.jsx("span",{className:"block size-[5px] rounded-full bg-primary-foreground"})})})}function RE(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const OE=x.createContext(void 0),ME=x.createContext(void 0),DE=x.createContext(void 0);function yo(){const e=x.useContext(OE);if(e===void 0)throw new Error(on(60));return e}function Jy(){const e=x.useContext(ME);if(e===void 0)throw new Error(on(101));return e}function IE(){const e=x.useContext(DE);if(e===void 0)throw new Error(on(61));return e}function KV(e,t,a=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let c=0;cObject.is(e,t);function la(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function PE(e,t,a){return Array.isArray(e)&&Array.isArray(t)?!KV(e,t,(o,c)=>la(o,c,a)):e!==t}function Oh(e,t,a){return e?e.some(o=>o===void 0?!1:la(t,o,a)):!1}function ru(e,t,a){return e?e.findIndex(o=>o===void 0?!1:la(o,t,a)):-1}function YV(e,t){if(t!==Rh)return o=>Oh(e,o,t);const a=new Set(e);return a.delete(void 0),o=>a.has(o)&&(o!==0||e.some(c=>Object.is(o,c)))}function df(e,t,a,o){const c=o&&Array.isArray(t)?e.findIndex(YV(t,a)):ru(e,t,a);return c===-1?null:c}function _E(e,t,a,o,c,d){return Oh(o,t,c)?d!=null&&e>d&&Oh(o,a[d],c)?d:e:e===d?df(a,o,c,!0):d}function LE(e,t,a){return e.filter(o=>!la(t,o,a))}function XV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function ej(e){return XV(e?.[0])}function Mh(e){return ej(e)?e.flatMap(t=>t.items):e}function zE(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(ej(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function jo(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Eh(e)}function ka(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Eh(e.value):Eh(e)}function BE(e,t,a){function o(){return jo(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const d=Mh(t);if(e==null||typeof e!="object"){const f=d.find(p=>p.value===e);return f&&f.label!=null?f.label:o()}if("value"in e){const f=d.find(p=>p&&p.value===e.value);if(f&&f.label!=null)return f.label}}return o()}function QV(e,t,a){return e.reduce((o,c,d)=>(d>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:BE(c,t,a)},d)),o),[])}const ZV={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:ka(t,o)!==""},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(c=>la(t,c,a)):la(t,o,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Cl=1;function HE(e,t){return Math.max(0,e-t)}function WV(e,t){if(t<=0)return 0;const a=Ri(e,0,t),o=a,c=t-a,d=o<=Cl,f=c<=Cl;return d&&f?o<=c?0:t:d?0:f?t:a}function JV(e){const{id:t,value:a,defaultValue:o=null,onValueChange:c,open:d,defaultOpen:f=!1,onOpenChange:p,name:h,form:v,autoComplete:y,disabled:b=!1,readOnly:j=!1,required:w=!1,modal:k=!0,actionsRef:S,inputRef:N,onOpenChangeComplete:T,items:D,multiple:C=!1,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I=Rh,highlightItemOnHover:P=!0,children:O}=e,{clearErrors:_}=$c(),{setDirty:L,setTouched:H,setFocused:B,validityData:z,setFilled:Q,name:K,disabled:X,validation:q,validationMode:$}=Sa(),Y=oo({id:t}),F=X||b,G=K??h,[W,le]=Ga({controlled:a,default:C?o??Mr:o,name:"Select",state:"value"}),[M,U]=Ga({controlled:d,default:f,name:"Select",state:"open"}),Z=x.useRef([]),ae=x.useRef([]),ce=x.useRef(null),J=x.useRef(null),ie=x.useRef(0),ge=x.useRef(null),ee=x.useRef([]),fe=x.useRef(!1),te=x.useRef(null),Ce=x.useRef(null),re=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=x.useRef(!1),ke=x.useRef(W),{mounted:Ee,setMounted:ve,transitionStatus:he}=ki(M),{openMethod:ye,triggerProps:we}=vE(M),xe=Ds(()=>new nu({id:Y,labelId:void 0,modal:k,multiple:C,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,value:W,open:M,mounted:Ee,transitionStatus:he,items:D,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:fn,triggerProps:fn,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qt,setOpen:qt,handleScrollArrowVisibility:qt,onOpenChangeComplete:qt,listRef:Z,popupRef:ce,scrollHandlerRef:J,scrollArrowsMountedCountRef:ie,valueRef:ge,valuesRef:ee,labelsRef:ae,typingRef:fe,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:Ce,alignItemWithTriggerActiveRef:de,initialValueRef:ke},ZV)).current,Te=xe.useState("activeIndex"),Oe=xe.useState("selectedIndex"),Ne=xe.useState("triggerElement"),Le=xe.useState("positionerElement"),Ye=QU(ye),kt=ye??Ye,Ct=x.useMemo(()=>C?"":ka(W,R),[C,W,R]),Rt=x.useMemo(()=>C&&Array.isArray(W)?W.map(xt=>ka(xt,R)):ka(W,R),[C,W,R]),ot=Xn(Ne),qn=Ie(()=>Rt);Xc(ot,Y,W,qn,!F,h);const ps=C?Array.isArray(W)&&W.length>0:W!=null&&Ct!=="";De(()=>{Q(ps)},[ps,Q]),De(function(){const jt=df(ee.current,W,I,C);jt===null&&(Ce.current=null),!M&&xe.set("selectedIndex",jt)},[C,M,W,I,xe]),aa(W,()=>{_(G),L(PE(W,z.initialValue,I)),q.change(W)});const Gn=Ie((xt,jt)=>{p?.(xt,jt),!jt.isCanceled&&(U(xt),!xt&&(jt.reason===go||jt.reason===sh)&&(H(!0),B(!1),$==="onBlur"&&q.commit(W)))}),bs=Ie(()=>{ve(!1),xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),T?.(!1)});ra({enabled:!S,open:M,ref:ce,onComplete(){M||bs()}}),x.useImperativeHandle(S,()=>({unmount:bs}),[bs]);const it=Ie((xt,jt)=>{c?.(xt,jt),!jt.isCanceled&&le(xt)}),Vt=Ie(xt=>{const jt=HE(xt.scrollHeight,xt.clientHeight),wt=WV(xt.scrollTop,jt),kr=wt>0,rr=wtEE(Z.current[xt]),onMatch(xt){M?xe.set("activeIndex",xt):it(ee.current[xt],$e(Yn))},onTyping(xt){fe.current=xt}}),Zn=x.useMemo(()=>Wr(Ft.reference,Ot.reference,nt.reference,tn.reference,we),[tn.reference,Ft.reference,Ot.reference,nt.reference,we]),Un=x.useMemo(()=>Wr(lf,Ft.floating,Ot.floating,nt.floating),[Ft.floating,Ot.floating,nt.floating]),Vn=Ot.item??fn;xe.useContextCallback("setValue",it),xe.useContextCallback("setOpen",Gn),xe.useContextCallback("handleScrollArrowVisibility",Vt),xe.useContextCallback("onOpenChangeComplete",T),RE(()=>{xe.update({popupProps:Un,triggerProps:Zn})}),xe.useSyncedValues({id:Y,modal:k,multiple:C,value:W,open:M,mounted:Ee,transitionStatus:he,popupProps:Un,triggerProps:Zn,items:D,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:I,openMethod:kt});const Rn=x.useMemo(()=>({disabled:F,readOnly:j,required:w,multiple:C,highlightItemOnHover:P,itemProps:Vn}),[F,j,w,C,P,Vn]),Jt=ea(N,q.inputRef),ls=C?void 0:G,Tt=x.useMemo(()=>!C||!Array.isArray(W)||!G?null:W.map(xt=>{const jt=ka(xt,R);return s.jsx("input",{type:"hidden",form:v,name:G,value:jt,disabled:F},jt)}),[C,W,v,G,R,F]);return s.jsxs(OE.Provider,{value:xe,children:[s.jsx(ME.Provider,{value:Rn,children:s.jsx(DE.Provider,{value:Hn,children:O})}),s.jsx("input",{...q.getValidationProps(F,{onFocus(){xe.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented||F||j)return;const jt=xt.currentTarget.value,wt=$e(Yn,xt.nativeEvent);function kr(){if(C)return;const rr=jt.toLowerCase();let Hr=ee.current.findIndex(rl=>ka(rl,R).toLowerCase()===rr||jo(rl,A).toLowerCase()===rr);Hr===-1&&(Hr=ee.current.findIndex((rl,rn)=>{const cc=ae.current[rn];return cc!=null&&cc.toLowerCase()===rr}));const jn=ee.current[Hr];jn!=null&&it(jn,wt)}xe.set("forceMount",!0),queueMicrotask(kr)}}),id:Y&&ls==null?`${Y}-hidden-input`:void 0,form:v,name:ls,autoComplete:y,value:Ct,disabled:F,required:w&&!(C&&ps),readOnly:j,ref:Jt,style:G?Wc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Tt]})}function UE(e,t){return e??t}const Dh=5;function VE(e,t){const a=e6(t);return e.clientX>=a.left-Dh&&e.clientX<=a.right+Dh&&e.clientY>=a.top-Dh&&e.clientY<=a.bottom+Dh}function e6(e){const t=e.getBoundingClientRect(),a=Sn(e);if(Hv)return t;const o=a.getComputedStyle(e,"::before"),c=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const f=parseFloat(o.width)||0,p=parseFloat(o.height)||0,h=parseFloat(c.width)||0,v=parseFloat(c.height)||0,y=Math.max(t.width,f,h),b=Math.max(t.height,p,v),j=y-t.width,w=b-t.height;return{left:t.left-j/2,right:t.right+j/2,top:t.top-w/2,bottom:t.bottom+w/2}}const t6="data-popup-side",n6=400,s6={...$v,...ji,popupSide:e=>e?{[t6]:e}:null,value:()=>null},r6=x.forwardRef(function(t,a){const{render:o,className:c,id:d,disabled:f=!1,nativeButton:p=!0,style:h,...v}=t,{setTouched:y,setFocused:b,validationMode:j,validation:w,state:k,disabled:S}=Sa(),{labelId:N}=vl(),T=yo(),{readOnly:D,required:C,disabled:A}=Jy(),R=S||A||f,I=T.useState("open"),P=T.useState("mounted"),O=T.useState("value"),_=T.useState("triggerProps"),L=T.useState("positionerElement"),H=T.useState("listElement"),B=T.useState("popupSide"),z=T.useState("id"),Q=T.useState("labelId"),K=T.useState("hasSelectedValue"),X=P&&L?B:null,q=d??z,$=UE(N,Q);oo({id:d});const Y=Xn(L),F=x.useRef(null),{getButtonProps:G,buttonRef:W}=Jr({disabled:R,native:p}),le=T.useStateSetter("triggerElement"),M=Zs(),U=Zs(),Z=Zs();x.useEffect(()=>{if(I)return Z.start(n6,()=>{T.context.selectionRef.current.allowUnselectedMouseUp=!0,T.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Z.clear()};T.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[I,T,U,Z]);const ae=Wr(_,{id:q,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-controls":I?H?.id??Gm(L)?.id:void 0,"aria-labelledby":$,"aria-readonly":D||void 0,"aria-required":C||void 0,tabIndex:R?-1:0,onFocus(ie){b(!0),I&&T.context.alignItemWithTriggerActiveRef.current&&T.context.setOpen(!1,$e(Yn,ie.nativeEvent)),M.start(0,()=>{T.set("forceMount",!0)})},onBlur(ie){Qe(L,ie.relatedTarget)||(y(!0),b(!1),j==="onBlur"&&w.commit(O))},onMouseDown(ie){if(I)return;const ge=$t(ie.currentTarget);function ee(fe){if(!F.current)return;const te=fe.target;Qe(F.current,te)||Qe(Y.current,te)||VE(fe,F.current)||T.context.setOpen(!1,$e(T1,fe))}U.start(0,()=>{ge.addEventListener("mouseup",ee,{once:!0})})}},v,G),ce=w.getValidationProps(R,ae);ce.role="combobox";const J={...k,open:I,disabled:R,value:O,readOnly:D,popupSide:X,placeholder:!K};return yt("button",t,{ref:[a,F,W,le],state:J,stateAttributesMapping:s6,props:ce})}),a6={value:()=>null},l6=x.forwardRef(function(t,a){const{className:o,render:c,children:d,placeholder:f,style:p,...h}=t,v=yo(),y=v.useState("value"),b=v.useState("items"),j=v.useState("itemToStringLabel"),w=v.useState("hasSelectedValue"),k=!w&&f!=null&&d==null,S=v.useState("hasNullItemLabel",k),N={value:y,placeholder:!w};let T=null;return typeof d=="function"?T=d(y):d!=null?T=d:k&&!S?T=f:Array.isArray(y)?T=QV(y,b,j):T=BE(y,b,j),yt("span",t,{state:N,ref:[a,v.context.valueRef],props:[{children:T},h],stateAttributesMapping:a6})}),o6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t,v={open:yo().useState("open")};return yt("span",t,{state:v,ref:a,props:[{"aria-hidden":!0,children:"▼"},f],stateAttributesMapping:Fv})}),i6=x.forwardRef(function(t,a){const o=yo(),c=o.useState("mounted"),d=o.useState("forceMount");return c||d?s.jsx(oh,{ref:a,...t}):null}),FE=x.createContext(void 0);function c6(){const e=x.useContext(FE);if(!e)throw new Error(on(59));return e}function Ih(e,t){e&&Object.assign(e.style,t)}const u6={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},d6=20;function tj(e,t,a,o){const[c,d]=x.useState(!1);De(()=>{if(!e||!t||a==null){d(!1);return}const f=$t(a).documentElement.clientWidth,p=a.offsetWidth;d(f>0&&p>0&&p>=f-d6)},[e,t,a]),hE(e&&(!t||c),o)}const f6={position:"fixed"},p6=x.forwardRef(function(t,a){const{anchor:o,className:c,render:d,positionMethod:f,side:p,align:h,sideOffset:v,alignOffset:y,collisionBoundary:b="clipping-ancestors",collisionPadding:j,arrowPadding:w,sticky:k,disableAnchorTracking:S,alignItemWithTrigger:N=!0,collisionAvoidance:T=X1,style:D,...C}=t,A=yo(),R=IE(),I=A.useState("open"),P=A.useState("mounted"),O=A.useState("modal"),_=A.useState("value"),L=A.useState("openMethod"),H=A.useState("positionerElement"),B=A.useState("triggerElement"),z=A.useState("isItemEqualToValue"),Q=A.useState("transitionStatus"),K=x.useRef(null),X=x.useRef(null),[q,$]=x.useState(N),Y=P&&q&&L!=="touch";!P&&q!==N&&$(N),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>Y),tj((Y||O)&&I,L==="touch",H,B);const F=jh({anchor:o,floatingRootContext:R,positionMethod:f,mounted:P,side:p,sideOffset:v,align:h,alignOffset:y,arrowPadding:w,collisionBoundary:b,collisionPadding:j,sticky:k,disableAnchorTracking:S??Y,collisionAvoidance:T,keepMounted:!0}),G=Y?"none":F.side,W=Y?f6:F.positionerStyles,le={open:I,side:G,align:F.align,anchorHidden:F.anchorHidden};De(()=>{A.set("popupSide",F.side)},[A,F.side]);const M=A.useStateSetter("positionerElement"),U=wh(t,le,{styles:W,transitionStatus:Q,props:C,refs:[a,M],hidden:!P,inert:!I}),Z=x.useRef(0),ae=Ie(J=>{if(A.context.valuesRef.current.length===0)return;const ie=Z.current;Z.current=J.size;const ge=$e(Yn);if(ie!==0&&!A.state.multiple&&_!==null&&ru(A.context.valuesRef.current,_,z)===-1){const fe=A.context.initialValueRef.current,Ce=fe!=null&&ru(A.context.valuesRef.current,fe,z)!==-1?fe:null;A.context.setValue(Ce,ge),Ce===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ie!==0&&A.state.multiple&&Array.isArray(_)){const ee=_.filter(fe=>ru(A.context.valuesRef.current,fe,z)!==-1);ee.length!==_.length&&(A.context.setValue(ee,ge),ee.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(I&&Y){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ee={height:""};Ih(H,ee),Ih(A.context.popupRef.current,ee)}}),ce=x.useMemo(()=>({...F,side:G,alignItemWithTriggerActive:Y,setControlledAlignItemWithTrigger:$,scrollUpArrowRef:K,scrollDownArrowRef:X}),[F,G,Y,$]);return s.jsx(Wy,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:ae,children:s.jsxs(FE.Provider,{value:ce,children:[P&&O&&s.jsx(Ch,{inert:Sh(!I),cutout:B}),U]})})}),Ph="base-ui-disable-scrollbar",$E={className:Ph,getElement(e){return s.jsx("style",{nonce:e,href:Ph,precedence:"base-ui:low",children:`.${Ph}{scrollbar-width:none}.${Ph}::-webkit-scrollbar{display:none}`})}},m6=x.createContext(void 0);function qE(e){return x.useContext(m6)}const h6=x.createContext(void 0),g6={disableStyleElements:!1};function x6(){return x.useContext(h6)??g6}const GE="--transform-origin",b6={...qc,...io},v6=x.forwardRef(function(t,a){const{render:o,className:c,style:d,finalFocus:f,...p}=t,h=yo(),{multiple:v,readOnly:y,highlightItemOnHover:b}=Jy(),j=IE(),{side:w,align:k,alignItemWithTriggerActive:S,isPositioned:N,setControlledAlignItemWithTrigger:T}=c6(),D=qE()!=null,C=cf(),{nonce:A,disableStyleElements:R}=x6(),I=h.useState("id"),P=h.useState("open"),O=h.useState("openMethod"),_=h.useState("mounted"),L=h.useState("popupProps"),H=h.useState("transitionStatus"),B=h.useState("triggerElement"),z=h.useState("positionerElement"),Q=h.useState("listElement"),K=x.useRef(!1),X=x.useRef(!1),q=x.useRef({}),$=Yc(),Y=Ie(le=>{if(!z||!h.context.popupRef.current||!X.current)return;const M=z.style.top==="0px",U=z.style.bottom==="0px";if(K.current||!S||!M&&!U){h.context.handleScrollArrowVisibility(le);return}const Z=YE(z),ae=ff(z.getBoundingClientRect().height,"y",Z),ce=$t(z),J=Sn(z),ie=J.getComputedStyle(z),ge=parseFloat(ie.marginTop),ee=parseFloat(ie.marginBottom),fe=KE(J.getComputedStyle(h.context.popupRef.current)),te=Math.min(ce.documentElement.clientHeight-ge-ee,fe),Ce=le.scrollTop,re=_h(le);let de=null;const ke=ye=>{z.style.height=`${ye}px`},Ee=M?re-Ce:Ce,ve=Math.min(ae+Ee,te);if(Ee<=Cl){const ye=Ri(Ee,0,te-ae);ye>0&&ke(ae+ye),le.scrollTop=M?re:0,te-(ae+ye)<=Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le);return}if(te-ve>Cl)de=M?1/0:0;else if(U&&CeCl&&(le.scrollTop=ye)}he>=te-Cl&&(K.current=!0),h.context.handleScrollArrowVisibility(le)});x.useImperativeHandle(h.context.scrollHandlerRef,()=>Y,[Y]),ra({open:P,ref:h.context.popupRef,onComplete(){P&&h.context.onOpenChangeComplete(!0)}});const F={open:P,transitionStatus:H,side:w,align:k};De(()=>{!z||!h.context.popupRef.current||Object.keys(q.current).length||(q.current={top:z.style.top||"0",left:z.style.left||"0",right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[h,z]),De(()=>{P||S||(X.current=!1,K.current=!1,Ih(z,q.current))},[P,S,z]),De(()=>{const le=h.context.popupRef.current;if(!P||!B||!z||!le||S&&!N||h.state.transitionStatus==="ending")return;if(X.current=!0,le.style.removeProperty(GE),!S){$.request(()=>h.context.handleScrollArrowVisibility(Q||le));return}const M=y6(le);try{let U=h.context.selectedItemTextRef.current;U?.isConnected||(U=!h.select("hasSelectedValue")&&h.context.firstItemTextRef.current?.isConnected?h.context.firstItemTextRef.current:null);const Z=h.context.valueRef.current,ae=Sn(z),ce=ae.getComputedStyle(z),J=ae.getComputedStyle(le),ie=$t(B),ge=YE(B),ee=Lh(B.getBoundingClientRect(),ge),fe=Lh(z.getBoundingClientRect(),ge),te=ee.height,Ce=Q||le,re=Ce.scrollHeight,de=parseFloat(J.borderBottomWidth),ke=parseFloat(ce.marginTop)||10,Ee=parseFloat(ce.marginBottom)||10,ve=parseFloat(ce.minHeight)||100,he=KE(J),ye=5,we=5,xe=20,Te=ie.documentElement.clientHeight-ke-Ee,Oe=ie.documentElement.clientWidth,Ne=Te-ee.bottom+te;let Le,Ye=C==="rtl"?ee.right-fe.width:ee.left,kt=0;if(U&&Z){const tn=Lh(Z.getBoundingClientRect(),ge);Le=Lh(U.getBoundingClientRect(),ge),Ye=fe.left+(C==="rtl"?tn.right-Le.right:tn.left-Le.left);const nt=tn.top-ee.top+tn.height/2;kt=Le.top-fe.top+Le.height/2-nt}const Ct=Ne+kt+Ee+de;let Rt=Math.min(Te,Ct);const ot=Te-ke-Ee,qn=Ct-Rt,ps=Oe-we;z.style.left=`${Ri(Ye,ye,ps-fe.width)}px`,z.style.height=`${Rt}px`,z.style.maxHeight="none",z.style.marginTop=`${ke}px`,z.style.marginBottom=`${Ee}px`,le.style.height="100%";const Gn=_h(Ce),bs=qn>=Gn-Cl;bs&&(Rt=Math.min(Te,fe.height)-(qn-Gn));const it=ee.topTe-xe||Math.ceil(Rt)+Cl=ot?"0":`${tn}px`,z.style.height=`${Rt}px`,Ce.scrollTop=_h(Ce)}else z.style.bottom="0",Ce.scrollTop=qn;if(Le){const tn=fe.top,nt=fe.height,Ot=Le.top+Le.height/2,Ft=Ri(nt>0?(Ot-tn)/nt*100:50,0,100);le.style.setProperty(GE,`50% ${Ft}%`)}(Hn===Te||Rt>=he)&&(K.current=!0),h.context.handleScrollArrowVisibility(Ce),b&&h.state.selectedIndex===null&&h.state.activeIndex===null&&h.context.listRef.current[0]!=null&&h.set("activeIndex",0)}finally{M()}},[h,P,z,B,S,T,$,Q,b,C,N]),x.useEffect(()=>{if(!S||!z||!P)return;const le=Sn(z);function M(U){h.context.setOpen(!1,$e(d4,U))}return St(le,"resize",M)},[h,S,z,P]);const G={...Q?{role:"presentation"}:{role:"listbox","aria-multiselectable":v||void 0,"aria-readonly":y||void 0,id:`${I}-list`},onKeyDown(le){D&&Nh.has(le.key)&&le.stopPropagation()},onScroll(le){Q||Y(le.currentTarget)},...S&&{style:Q?{height:"100%"}:u6},className:!Q&&S?$E.className:void 0},W=yt("div",t,{ref:[a,h.context.popupRef],state:F,stateAttributesMapping:b6,props:[L,G,uf(H),p]});return s.jsxs(x.Fragment,{children:[!R&&$E.getElement(A),s.jsx(ih,{context:j,modal:!1,disabled:!_,openInteractionType:O,returnFocus:f,restoreFocus:!0,children:W})]})});function KE(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function _h(e){return HE(e.scrollHeight,e.clientHeight)}function YE(e){return gT.getScale(e)}function ff(e,t,a){return e/a[t]}function Lh(e,t){return Xd({x:ff(e.x,"x",t),y:ff(e.y,"y",t),width:ff(e.width,"x",t),height:ff(e.height,"y",t)})}const XE=[["transform","none"],["scale","1"],["translate","0 0"]];function y6(e){const{style:t}=e,a={};for(const[o,c]of XE)a[o]=t.getPropertyValue(o),t.setProperty(o,c,"important");return()=>{for(const[o]of XE){const c=a[o];c?t.setProperty(o,c):t.removeProperty(o)}}}const QE=x.createContext(void 0);function nj(){const e=x.useContext(QE);if(!e)throw new Error(on(57));return e}const j6=x.memo(x.forwardRef(function(t,a){const{render:o,className:c,style:d,value:f=null,label:p,disabled:h=!1,nativeButton:v=!1,...y}=t,b=x.useRef(null),j=Zy({guess:!0,label:p,textRef:b}),w=yo(),{itemProps:k,multiple:S,disabled:N,readOnly:T}=Jy(),D=N||h,C=w.useState("isActive",j.index),A=w.useState("open"),R=w.useState("isSelected",f),I=w.useState("isSelectedByFocus",j.index),P=w.useState("isItemEqualToValue"),O=j.index,_=x.useRef(null);De(()=>{const F=w.context.valuesRef.current;return F[O]=f,()=>{delete F[O]}},[O,f,w]),De(()=>{const F=w.state.value,G=w.state.selectedIndex;let W=G,le;S&&Array.isArray(F)?(W=_E(O,f,w.context.valuesRef.current,F,P,G),le=W===O,O===G&&!le&&(w.context.selectedItemTextRef.current=null)):(le=F!==void 0&&la(f,F,P),le&&(W=O)),w.set("selectedIndex",W),le&&b.current&&(w.context.selectedItemTextRef.current=b.current)},[O,S,P,w,f]);const L=x.useRef("mouse"),H=x.useRef(!1),{getButtonProps:B,buttonRef:z}=Jr({disabled:D,focusableWhenDisabled:!0,native:v,composite:!0}),Q={disabled:D,selected:R,highlighted:C};function K(F){if(N||T)return;const G=w.state.value;if(S){const W=Array.isArray(G)?G:[],le=R?LE(W,f,P):[...W,f];w.context.setValue(le,$e(Wd,F))}else w.context.setValue(f,$e(Wd,F)),w.context.setOpen(!1,$e(Wd,F))}function X(){w.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":R,tabIndex:A&&C?0:-1,onKeyDown(F){w.set("activeIndex",O),F.key===" "&&w.context.typingRef.current&&F.preventDefault()},onClick(F){const G=L.current!=="touch",W=F.nativeEvent.pointerType,le=G&&Km(F.nativeEvent)&&(W!==void 0||C),M=G&&!le&&!H.current;H.current=!1,!(D||M)&&K(F.nativeEvent)},onPointerEnter(F){L.current=F.pointerType},onPointerMove(F){if(F.pointerType==="mouse"&&F.buttons===1){const G=w.context.selectionRef.current;G.dragY+=F.movementY,G.dragY**2>=64&&(G.allowUnselectedMouseUp=!0)}},onPointerDown(F){L.current=F.pointerType,H.current=!0,X()},onMouseUp(){if(X(),D||L.current==="touch"||H.current)return;const F=!w.context.selectionRef.current.allowSelectedMouseUp&&R,G=!w.context.selectionRef.current.allowUnselectedMouseUp&&!R;F||G||(H.current=!0,_.current?.click(),H.current=!1)}},$=yt("div",t,{ref:[z,a,j.ref,_],state:Q,props:[k,q,y,B]}),Y=x.useMemo(()=>({selected:R,index:O,textRef:b,selectedByFocus:I}),[R,O,b,I]);return s.jsx(QE.Provider,{value:Y,children:$})})),w6=x.forwardRef(function(t,a){const{selected:o}=nj();return t.keepMounted||o?s.jsx(S6,{...t,ref:a}):null}),S6=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=nj(),h=x.useRef(null),{transitionStatus:v,setMounted:y}=ki(p),j=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:v},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:io});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),j})),N6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:c,selectedByFocus:d}=nj(),f=yo(),{render:p,className:h,style:v,...y}=t,b=x.useCallback(w=>{w&&(o===0&&(f.context.firstItemTextRef.current=w),d&&(f.context.selectedItemTextRef.current=w))},[f,o,d]);return yt("div",t,{ref:[b,a,c],props:y})})),ft=JV,pt=l6;function mt({className:e,children:t,...a}){return s.jsxs(r6,{"data-slot":"select-trigger",className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","[&>span]:min-w-0 [&>span]:truncate","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",e),...a,children:[t,s.jsx(o6,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function ht({className:e,sideOffset:t=4,children:a,...o}){return s.jsx(i6,{children:s.jsx(p6,{sideOffset:t,alignItemWithTrigger:!1,className:"z-[35]",children:s.jsx(v6,{"data-slot":"select-content",className:Ue("max-h-[260px] min-w-[var(--anchor-width)] overflow-y-auto overscroll-contain rounded-lg border border-border-strong bg-raised p-[5px] shadow-3","outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0",e),...o,children:a})})})}function qe({className:e,children:t,...a}){return s.jsxs(j6,{"data-slot":"select-item",className:Ue("flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-[9px] text-[12.5px] leading-[1.4] text-foreground select-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:font-normal data-disabled:text-muted-foreground",e),...a,children:[s.jsx(N6,{className:"min-w-0 flex-1 truncate",children:t}),s.jsx(w6,{className:"flex flex-none text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function In({options:e,value:t,onValueChange:a,disabled:o=!1,className:c,...d}){const f=x.useRef(null),p=x.useRef(new Map),[h,v]=x.useState({left:0,width:0,ready:!1}),[y,b]=x.useState(!1),j=x.useCallback(()=>{const w=f.current,k=p.current.get(t);if(!w||!k){v(C=>C.ready?{...C,ready:!1}:C);return}const S=w.getBoundingClientRect(),N=k.getBoundingClientRect(),T=N.left-S.left-w.clientLeft,D=N.width;v(C=>C.ready&&C.left===T&&C.width===D?C:{left:T,width:D,ready:!0})},[t]);return x.useLayoutEffect(()=>{j();const w=f.current;if(!w||typeof ResizeObserver>"u")return;const k=new ResizeObserver(()=>j());k.observe(w);for(const S of p.current.values())k.observe(S);return()=>k.disconnect()},[j,e]),x.useEffect(()=>{if(!h.ready||y)return;const w=requestAnimationFrame(()=>b(!0));return()=>cancelAnimationFrame(w)},[h.ready,y]),s.jsxs(AE,{ref:f,"data-slot":"segmented-control",className:Ue("relative inline-flex gap-0.5 rounded-md border border-control-border bg-control p-0.5",c),value:t,disabled:o,onValueChange:w=>a(w),...d,children:[s.jsx("span",{"aria-hidden":"true","data-slot":"segmented-thumb","data-ready":h.ready?"true":"false","data-animate":y?"true":"false",className:Ue("pointer-events-none absolute top-0.5 bottom-0.5 left-0 rounded-sm bg-primary-soft","data-[ready=false]:opacity-0","data-[animate=true]:transition-[transform,width] data-[animate=true]:duration-200 data-[animate=true]:ease-in-out"),style:{transform:`translateX(${h.left}px)`,width:h.width}}),e.map(w=>s.jsxs(CE,{value:w.value,"data-slot":"segmented-item",disabled:w.disabled,"data-zero":w.count===0?"true":void 0,className:Ue("group/seg relative z-[1] inline-flex h-6 items-center gap-[5px] rounded-sm border-0 bg-transparent px-2.5","text-xs font-medium whitespace-nowrap text-subtle select-none","transition-[background-color,color] duration-150 ease-out","hover:bg-nav-hover hover:text-foreground","data-checked:bg-transparent data-checked:text-primary-fg data-checked:hover:bg-transparent","data-disabled:cursor-not-allowed data-disabled:opacity-40","data-[zero=true]:data-unchecked:opacity-45"),ref:k=>{k?p.current.set(w.value,k):p.current.delete(w.value)},children:[w.label,w.count!==void 0&&s.jsx("span",{className:Ue("min-w-4 rounded-pill bg-surface-3 px-[5px] text-center text-[10.5px] font-semibold tabular-nums text-muted-foreground","group-data-checked/seg:bg-primary-tint group-data-checked/seg:text-primary-fg"),children:w.count})]},w.value))]})}const k6=x.createContext(void 0);function C6(){return x.useContext(k6)}const T6=x.forwardRef(function(t,a){const{className:o,defaultPressed:c=!1,disabled:d=!1,form:f,onPressedChange:p,pressed:h,render:v,type:y,value:b,nativeButton:j=!0,style:w,...k}=t,S=Na(b||void 0),N=C6(),T=N?.value??[],D=(d||N?.disabled)??!1,[C,A]=Ga({controlled:N?S!==void 0&&T.indexOf(S)>-1:h,default:c,name:"Toggle",state:"pressed"}),{getButtonProps:R,buttonRef:I}=Jr({disabled:D,native:j}),P={disabled:D,pressed:C},O=[I,a],_=[{"aria-pressed":C,onClick(B){const z=!C,Q=$e(Yn,B.nativeEvent);p?.(z,Q),!Q.isCanceled&&(S&&N?.setGroupValue?.(S,z,Q),!Q.isCanceled&&A(z))}},k,R],L=yt("button",t,{enabled:!N,state:P,ref:O,props:_}),H=x.useMemo(()=>({disabled:D,focusableWhenDisabled:!1}),[D]);return N?s.jsx(SE,{tag:"button",render:v,className:o,style:w,metadata:H,state:P,refs:O,props:_}):L}),E6=Fc(["inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border","font-medium transition-[background-color,border-color,color] duration-150 ease-out","outline-none select-none disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0","data-pressed:border-primary-bd data-pressed:bg-primary-soft data-pressed:font-semibold data-pressed:text-primary-fg","data-pressed:hover:bg-primary-tint"],{variants:{variant:{default:"border-transparent bg-transparent text-subtle hover:bg-nav-hover hover:text-foreground",outline:"border-control-border bg-control text-foreground shadow-1 hover:border-control-border-hover hover:bg-control-hover"},size:{default:"h-[30px] rounded-md px-3 text-[12.5px]",xs:"h-6 rounded-sm px-2 text-[11.5px]",sm:"h-[26px] rounded-sm px-2.5 text-[12px]",lg:"h-9 rounded-md px-4 text-[13px]"}},defaultVariants:{variant:"default",size:"default"}});function A6({className:e,variant:t,size:a,...o}){return s.jsx(T6,{"data-slot":"toggle",className:Ue(E6({variant:t,size:a}),e),...o})}function R6(e,t,a,o,c,d,f,p,h,v=2){const y=YB(a.current,{event:e,orientation:o,loopFocus:c,rtl:d,cols:v,disabledIndices:f,minIndex:p,maxIndex:h,prevIndex:t>h?p:t,stopEvent:!0});return po(a.current,y)?void 0:y}const ZE=x.createContext(void 0),WE=x.createContext(void 0),JE=x.createContext(void 0),eA=x.createContext(!1),tA=x.createContext("");function Ca(){const e=x.useContext(ZE);if(!e)throw new Error(on(22));return e}function zh(){const e=x.useContext(WE);if(!e)throw new Error(on(23));return e}function pf(){const e=x.useContext(JE);if(!e)throw new Error(on(24));return e}function nA(){return x.useContext(tA)}function O6(){return x.useContext(eA)}const M6={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{const{selectedValue:t,selectionMode:a}=e;return t==null?!1:a==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?zE(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.selectedValue;return Array.isArray(o)?o.some(c=>la(t,c,a)):la(t,o,a)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function sA(e){return e==null?void 0:`${e}-popup`}function D6(e,t){return(a,o)=>a==null?!1:e.contains(a,o,t)}const rA=new Map;function I6(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},a=`${dy(e.locale)}|${JSON.stringify(t)}`,o=rA.get(a);if(o)return o;const c=new Intl.Collator(e.locale,t),d={contains(f,p,h){if(!p)return!0;const v=jo(f,h);for(let y=0;y<=v.length-p.length;y+=1)if(c.compare(v.slice(y,y+p.length),p)===0)return!0;return!1},startsWith(f,p,h){if(!p)return!0;const v=jo(f,h);return c.compare(v.slice(0,p.length),p)===0},endsWith(f,p,h){if(!p)return!0;const v=jo(f,h),y=p.length;return v.length>=y&&c.compare(v.slice(v.length-y),p)===0}};return rA.set(a,d),d}const P6=I6;function _6(e,t=!1){const{overflowY:a}=br(e);return a!=="auto"&&a!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const aA=Symbol("none"),sj={value:aA,index:-1};function L6(e,t,a){const o=e.get(t);if(o!==void 0||a===Rh)return o;for(const[c,d]of e)if(la(c,t,a))return d}function z6(e){const{id:t,onOpenChangeComplete:a,defaultSelectedValue:o=null,selectedValue:c,onSelectedValueChange:d,defaultInputValue:f,inputValue:p,open:h,defaultOpen:v=!1,selectionMode:y,onItemHighlighted:b,name:j,form:w,disabled:k=!1,readOnly:S=!1,required:N=!1,inputRef:T,grid:D=!1,items:C,filteredItems:A,filter:R,filterQuery:I,openOnInputClick:P=!0,autoHighlight:O=!1,keepHighlight:_=!1,highlightItemOnHover:L=!0,loopFocus:H=!0,itemToStringLabel:B,itemToStringValue:z,isItemEqualToValue:Q=Rh,virtualized:K=!1,inline:X=!1,fillInputOnItemPress:q=!0,modal:$=!1,limit:Y=-1,autoComplete:F="list",formAutoComplete:G,locale:W,submitOnItemClick:le=!1}=e,{clearErrors:M}=$c(),{setDirty:U,validityData:Z,setFilled:ae,name:ce,disabled:J,setTouched:ie,setFocused:ge,validationMode:ee,validation:fe}=Sa(),te=cf(),Ce=oo({id:t}),re=P6({locale:W}),de=Array.isArray(C)?null:C;if(de&&typeof de.label!="function")throw new Error(on(100));const ke=de?de.data:C,Ee=de?.value,ve=Ee?void 0:ke,he=x.useMemo(()=>{if(!A||!Ee)return;const Me=Mh(A),Be=Me.map(Ee);let lt;return{values:Be,findItem(Yt,On){if(!lt){lt=new Map;for(let mn=0;mnde?Me=>de.label(Me,Q,Be=>{const lt=he?.findItem(Be,Q);return lt!=null?de.itemLabel(lt):jo(Be,B)}):B,[de,B,he,Q]),we=x.useMemo(()=>de?Object.assign(Me=>de.itemLabel(Me),{selected:Me=>jo(Me,ye)}):B,[de,ye,B]);function xe(Me){return jo(Me,ye)}const[Te,Oe]=x.useState(!1),[Ne,Le]=x.useState(null),Ye=x.useRef(Ne),kt=x.useRef([]),Ct=x.useRef([]),Rt=x.useRef(null),ot=x.useRef(null),qn=x.useRef(null),ps=x.useRef(null),Gn=x.useRef(null),bs=x.useRef(!0),it=x.useRef(!1),Vt=x.useRef(null),Hn=x.useRef(null),tn=x.useRef(null),nt=x.useRef(sj),Ot=x.useRef(null),Ft=x.useRef([]),Zn=x.useRef(null),Un=J||k,Vn=ce??j,Rn=y==="multiple",Jt=y==="single",ls=p!==void 0||f!==void 0,Tt=ke!==void 0,xt=A!==void 0;let jt;O==="always"?jt="always":jt=O?"input-change":!1;const[wt,kr]=Ga({controlled:c,default:Rn?o??Mr:o,name:"Combobox",state:"selectedValue"}),rr=x.useMemo(()=>R===null?()=>!0:R!==void 0?R:D6(re,we),[R,re,we]),Hr=Ds(()=>ls?f??"":Jt?xe(wt):"").current,[jn,rl]=Ga({controlled:p,default:Hr,name:"Combobox",state:"inputValue"}),[rn,cc]=Ga({controlled:h,default:v,name:"Combobox",state:"open"}),Jx=ej(ke),fr=!rn&&Ne!==null?Ne:String(jn).trim(),Ia=Jt?xe(wt):"",Ho=Jt&&!Te&&fr!==""&&Ia.length===fr.length&&re.contains(Ia,fr),Uo=Ho?"":I??fr,Lp=Tt&&xt&&Ho&&(!de||de.hasValue(wt,Q)),uc=x.useMemo(()=>ke?Mh(ke):Mr,[ke]),Vo=x.useMemo(()=>{if(A&&!Lp)return A;if(!ke)return Mr;if(Jx){const Be=ke,lt=[];let Yt=0;for(const On of Be){if(Y>-1&&Yt>=Y)break;const mn=Y>-1?Y-Yt:1/0,Mn=Uo===""?On.items.slice(0,mn):[];if(Uo!=="")for(const ms of On.items){if(Mn.length>=mn)break;rr(ms,Uo,we)&&Mn.push(ms)}if(Mn.length>0){const ms={...On,items:Mn};lt.push(ms),Yt+=Mn.length}}return lt}if(Uo==="")return Y>-1?uc.slice(0,Y):uc;const Me=[];for(const Be of uc){if(Y>-1&&Me.length>=Y)break;rr(Be,Uo,we)&&Me.push(Be)}return Me},[A,Lp,ke,Jx,Uo,Y,rr,we,uc]),As=x.useMemo(()=>{if(he&&Vo===A)return he.values;const Me=Mh(Vo);return Ee?Me.map(Be=>Ee(Be)):Me},[Vo,A,he,Ee]),et=Ds(()=>{let Me=null;return X&&rn&&Tt&&y!=="none"&&(Me=df(As,wt,Q,Rn)),new nu({id:Ce,labelId:void 0,selectedValue:wt,open:rn,items:ve,selectionMode:y,name:Vn,form:w,disabled:Un,readOnly:S,required:N,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,isItemEqualToValue:Q,modal:$,autoHighlight:jt,submitOnItemClick:le,hasInputValue:ls,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:X,activeIndex:null,selectedIndex:Me,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:fn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:y==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:kt,labelsRef:Ct,popupRef:Rt,emptyRef:Gn,inputRef:ot,startDismissRef:qn,endDismissRef:ps,keyboardActiveRef:bs,chipsContainerRef:Vt,clearRef:Hn,valuesRef:Ft,pointerDownItemRef:Zn,selectionEventRef:tn},M6)}).current,Ll=y==="none"?jn:wt,eb=x.useMemo(()=>y==="none"?Ll:Array.isArray(wt)?wt.map(Me=>ka(Me,z)):ka(wt,z),[Ll,z,y,wt]),Pa=Ie(b),Rs=Ie(a),qs=et.useState("activeIndex"),Fo=et.useState("selectedIndex"),dc=et.useState("positionerElement"),tb=et.useState("listElement"),fc=et.useState("triggerElement"),pc=et.useState("inputElement"),mc=et.useState("inputGroupElement"),Os=et.useState("inline"),ar=et.useState("inputInsidePopup"),zl=et.useState("inputOwnsFormValue"),Bl=Jt&&!ar&&jn===Ia,hc=Xn(fc),{mounted:$o,setMounted:vs,transitionStatus:zp}=ki(rn),{openMethod:nb,triggerProps:Bp}=vE(rn),Hl=Ie(()=>eb);Xc(ar?hc:ot,Ce,Ll,Hl,!Un,j);const Ul=Ie(()=>{ke?Ct.current=As.map(xe):et.set("forceMounted",!0)}),qo=Ie((Me,Be,lt)=>{if(Be===-1){if(nt.current===sj)return;nt.current=sj}else nt.current={value:Me,index:Be};Pa(Me,f4(lt,void 0,{index:Be}))}),Ur=Ie(Me=>{const Be={};Me.activeIndex!==void 0&&(Be.activeIndex=Me.activeIndex),Me.selectedIndex!==void 0&&(Be.selectedIndex=Me.selectedIndex),et.update(Be);const lt=Me.activeIndex;if(lt===void 0)return;const Yt=Me.type||Yn;lt===null?qo(void 0,-1,Yt):qo(Ft.current[lt],lt,Yt)}),Vr=Ie((Me,Be)=>{if(e.onInputValueChange?.(Me,Be),!Be.isCanceled){if(it.current=Be.reason===Ka,Be.reason===Jd){rn&&Ne!==null&&Le(null);const lt=Be.event,Yt=lt.inputType;if(lt.type==="compositionend"||Yt!=null&&Yt!==""&&Yt!=="insertReplacementText"){const mn=Me.trim()!=="";mn&&Oe(!0),Ot.current={hasQuery:mn};const Mn=et.state.listElement;if(!et.state.virtualized&&Mn){const ms=Rt.current;for(const Cr of Uc(Mn.firstElementChild??Mn)){if(!dn(Cr)||(ms?!Qe(ms,Cr):Cr.getAttribute("role")==="dialog"))break;if(_6(Cr)){Cr.scrollTop=0;break}}}mn&&jt&&et.state.activeIndex==null&&(rn||Os)&&et.set("activeIndex",0)}}else Be.reason===Ka&&Me===""&&et.state.inputInsidePopup&&(Ot.current={hasQuery:!1,selection:!0});rl(Me)}}),sb=Ie(Me=>{const Be=!Me&&ar&&!Os&&jn!==""&&(String(jn).trim()===Ne||jn===Ia);!Me&&(Be||jn===""||Bl)&&Oe(!1),Le(null),Be&&Vr("",$e(Ka))}),Mt=Ie((Me,Be)=>{if(rn!==Me&&(Be.reason===Qc&&Tt&&As.length===0&&!Gn.current&&Be.allowPropagation(),e.onOpenChange?.(Me,Be),!Be.isCanceled&&(Me&&Ne!==null&&sb(Be.reason===Jd),!Me&&Te&&(Jt?(Os||Le(fr),fr===""&&Oe(!1)):Rn&&(Os||Le(fr),ar&&Ur({activeIndex:null}),(!ar||Os)&&Vr("",$e(Ka,Be.event,void 0,{isItemPress:Be.reason===Wd})))),cc(Me),!Me&&ar&&(Be.reason===go||Be.reason===sh)&&(ie(!0),ge(!1),ee==="onBlur")))){const lt=y==="none"?jn:wt;fe.commit(lt)}}),gc=Ie((Me,Be)=>{if(d?.(Me,Be),Be.isCanceled)return;kr(Me),(y==="none"&&Rt.current&&q||Jt&&!et.state.inputInsidePopup)&&Vr(xe(Me),$e(Be.reason,Be.event))}),ed=Ie((Me,Be)=>{const lt=cs(Me),Yt=tn.current??Me;tn.current=null;const On=$e(Wd,Yt),mn=lt?.closest("a")?.getAttribute("href");if(mn){mn.startsWith("#")&&Mt(!1,On);return}if(Rn){const Mn=Array.isArray(wt)?wt:[],ms=Oh(Mn,Be,Q),Cr=ms?LE(Mn,Be,Q):[...Mn,Be];if(gc(Cr,On),On.isCanceled||!(ot.current?ot.current.value.trim()!=="":!1))return;if(et.state.inputInsidePopup){Vr("",$e(Ka,On.event,void 0,{isItemPress:!0}));const $r=Ot.current;$r&&!ms&&($r.toggledValue=Be)}else Mt(!1,On)}else{if(gc(Be,On),On.isCanceled)return;Mt(!1,On)}}),td=Ie(()=>{const Me=fe.inputRef.current?.form??et.state.inputElement?.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),Fr=Ie(()=>{if(vs(!1),Rs?.(!1),Oe(!1),Le(null),Ur(y==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Rn&&ot.current&&ot.current.value!==""&&!it.current&&Vr("",$e(Ka)),Jt)if(et.state.inputInsidePopup)ot.current&&ot.current.value!==""&&Vr("",$e(Ka));else{const Me=xe(wt);ot.current&&ot.current.value!==Me&&Vr(Me,$e(Me===""?Ka:Yn))}}),pr=x.useMemo(()=>Os&&dc?{current:dc.closest('[role="dialog"]')}:Rt,[Os,dc]);ra({enabled:!e.actionsRef,open:rn,ref:pr,onComplete(){rn||Fr()}}),x.useImperativeHandle(e.actionsRef,()=>({unmount:Fr}),[Fr]),De(function(){const Be=Ye.current!==null&&Ne===null;if(Ye.current=Ne,rn&&(!Be||!Tt)||(rn||(Zn.current=null),y==="none"))return;const lt=Tt?As:Ft.current;Ur({selectedIndex:df(lt,wt,Q,Rn)})},[rn,Ne,wt,y,Rn,Tt,As,Q,Ur]),De(()=>{ke&&(Ft.current=As,kt.current.length=As.length)},[ke,As]),De(()=>{const Me=Ot.current;if(Me){const ms=rn||Os||et.state.positionerElement?.hidden===!1;if(Me.hasQuery)jt&&ms&&et.set("activeIndex",0),Ot.current=null;else if(String(jn).trim()===""&&(Ot.current=null,ms)){const Cr=Me.selection;jt==="always"&&!Cr&&et.state.selectionMode==="none"&&et.set("activeIndex",0),queueMicrotask(()=>{if(!et.state.open&&!et.state.inline||ot.current&&ot.current.value.trim()!=="")return;const ma=et.state.selectedValue,$r=et.state.selectionMode==="multiple";if($r&&Array.isArray(ma)?ma.length>0:et.state.selectionMode!=="none"&&ma!=null){const _s=Tt||xt?As:Ft.current,La=ru(_s,Me.toggledValue,et.state.isItemEqualToValue);et.set("activeIndex",La!==-1?La:df(_s,ma,et.state.isItemEqualToValue,$r))}else Cr?et.set("activeIndex",null):jt==="always"&&et.set("activeIndex",0)})}}if(!rn&&!Os)return;const lt=Tt||xt?As:Ft.current,Yt=et.state.activeIndex;if(Yt==null){if(jt==="always"&<.length>0){et.set("activeIndex",0);return}qo(void 0,-1,Yn);return}if(Yt>=lt.length){qo(void 0,-1,Yn),et.set("activeIndex",null);return}const On=lt[Yt],mn=nt.current.value,Mn=mn!==aA&&la(On,mn,et.state.isItemEqualToValue);(nt.current.index!==Yt||!Mn)&&qo(On,Yt,Yn)},[qs,jt,qo,xt,Tt,As,Os,rn,et,jn]),De(()=>{if(y==="none"){ae(String(jn)!=="");return}ae(Rn?Array.isArray(wt)&&wt.length>0:wt!=null)},[ae,y,jn,wt,Rn]),x.useEffect(()=>{Tt&&jt&&As.length===0&&Ur({activeIndex:null})},[Tt,jt,As.length,Ur]);function rb(){rn&&fr!==""&&fr!==String(Hr)&&!Bl&&Oe(!0)}function FS(){rn&&Ne!==null&&sb(!1)}let nd=!1;function Hp(){!nd&&jn!==Ia&&(nd=!0,Vr(Ia,$e(Yn)))}function $S(){y!=="none"&&(M(Vn),U(PE(wt,Z.initialValue,Q)),fe.change(wt),Jt&&!ls&&!ar&&Hp())}function mr(){Jt&&!ls&&!ar&&!Te&&Hp()}function Up(){y==="none"&&(M(Vn),U(jn!==Z.initialValue),fe.change(jn))}aa(fr,rb),aa(rn,FS),aa(wt,$S),aa(Ia,mr),aa(ke,mr),aa(jn,Up);const xc=PT({open:Os?!0:rn,onOpenChange:Mt,elements:{reference:ar?fc:pc,floating:dc}}),sd=D?"grid":"listbox",_a=rn||Os,Vp=_a?"true":"false",bc=x.useMemo(()=>{const Me=pc?.tagName==="INPUT",Be=pc==null||Me,lt=Be||_a,Yt=Be?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return lt&&(Yt.role="combobox",Yt["aria-expanded"]=Vp,Yt["aria-haspopup"]=sd,Yt["aria-controls"]=_a?tb?.id:void 0,Yt["aria-autocomplete"]=S?"none":F),{reference:Yt,floating:{role:"presentation"}}},[pc,_a,Vp,sd,tb?.id,F,S]),Vl=ch(xc,{enabled:!Un&&P,event:"mousedown-only",toggle:!1,touchOpenDelay:ar?0:100,reason:c4}),rd=af(xc,{enabled:!Un&&!Os,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Os?!0:void 0,outsidePress(Me){const Be=cs(Me);return!Qe(fc,Be)&&!Qe(Hn.current,Be)&&!Qe(Vt.current,Be)&&!Qe(mc,Be)}}),Fl=HT(xc,{enabled:!Un,id:Ce,listRef:kt,activeIndex:qs,selectedIndex:Fo,virtual:!0,loopFocus:H,allowEscape:H&&!jt,focusItemOnOpen:Te||y==="none"&&!jt?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!_,orientation:D?"horizontal":void 0,rtl:te==="rtl",disabledIndices:Mr,grid:D?R6:void 0,onNavigate(Me,Be){!Be&&!rn||zp==="ending"||Ur(Be?{activeIndex:Me,type:bs.current?k1:C1}:{activeIndex:Me})}}),Fp=x.useMemo(()=>Wr(Fl.reference,{onKeyDown(Me){D&&et.state.activeIndex==null&&(Me.key==="ArrowLeft"||Me.key==="ArrowRight")&&Me.preventBaseUIHandler()}},rd.reference,Vl.reference,bc.reference),[Fl.reference,rd.reference,Vl.reference,bc.reference,D,et]),ad=x.useMemo(()=>Wr(lf,rd.floating),[rd.floating]),ab=x.useMemo(()=>Wr(Fl.floating,bc.floating),[Fl.floating,bc.floating]),lb=x.useMemo(()=>{const Me=Fl.item;return Me?{...Me,onFocus:void 0}:fn},[Fl.item]);et.useContextCallback("setOpen",Mt),et.useContextCallback("setInputValue",Vr),et.useContextCallback("setSelectedValue",gc),et.useContextCallback("setIndices",Ur),et.useContextCallback("handleSelection",ed),et.useContextCallback("forceMount",Ul),et.useContextCallback("requestSubmit",td),et.useContextCallback("onOpenChangeComplete",a),RE(()=>{et.update({inline:X,popupProps:ad,listProps:ab,inputProps:Fp,triggerProps:Bp,itemProps:lb})});const vc={id:Ce,selectedValue:wt,open:rn,mounted:$o,transitionStatus:zp,items:ve,inline:X,popupProps:ad,listProps:ab,inputProps:Fp,triggerProps:Bp,itemProps:lb,openMethod:nb,selectionMode:y,name:Vn,form:w,disabled:Un,readOnly:S,required:N,grid:D,virtualized:K,openOnInputClick:P,itemToStringLabel:ye,modal:$,autoHighlight:jt,isItemEqualToValue:Q,submitOnItemClick:le,hasInputValue:ls};De(()=>{et.update({...vc,inputOwnsFormValue:y==="none"&&(X||!et.state.inputInsidePopup)})},[et,...Object.values(vc)]);const pa=ea(T,fe.inputRef),$p=x.useMemo(()=>({query:fr,hasItems:Tt,filteredItems:Vo,flatFilteredValues:As}),[fr,Tt,Vo,As]),qp=x.useMemo(()=>Array.isArray(Ll)?"":ka(Ll,z),[Ll,z]),Go=Rn&&Array.isArray(wt)&&wt.length>0,al=Rn||y==="none"&&zl?void 0:Vn,ob=x.useMemo(()=>!Rn||!Array.isArray(wt)||!Vn?null:wt.map(Me=>{const Be=ka(Me,z);return s.jsx("input",{type:"hidden",form:w,name:Vn,value:Be,disabled:Un},Be)}),[Rn,wt,w,Vn,z,Un]),Gp=s.jsxs(x.Fragment,{children:[e.children,s.jsx("input",{...fe.getValidationProps(Un,{onFocus(){if(ar){fc?.focus();return}(ot.current||fc)?.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented||Un||S)return;const Be=Me.currentTarget.value,lt=Be.toLowerCase(),Yt=$e(Yn,Me.nativeEvent),On=()=>Ft.current.findIndex(Mn=>ka(Mn,z).toLowerCase()===lt||xe(Mn).toLowerCase()===lt);function mn(){if(Rn)return;if(y==="none"){Vr(Be,Yt);return}let Mn=On();Mn===-1&&(Mn=Ft.current.findIndex((Cr,ma)=>{const $r=Ct.current[ma];return $r!=null&&$r.toLowerCase()===lt}));const ms=Mn===-1?void 0:Ft.current[Mn];ms!=null&&gc?.(ms,Yt)}Jt&&(Ul(),ke&&On()===-1&&et.set("forceMounted",!0)),queueMicrotask(mn)}}),id:Ce&&al==null?`${Ce}-hidden-input`:void 0,form:w,name:al,autoComplete:G,disabled:Un,required:N&&!Go,readOnly:S,value:qp,ref:pa,style:al?Wc:Ai,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ob]});return s.jsx(ZE.Provider,{value:et,children:s.jsx(WE.Provider,{value:xc,children:s.jsx(eA.Provider,{value:Tt,children:s.jsx(JE.Provider,{value:$p,children:s.jsx(tA.Provider,{value:jn,children:Gp})})})})})}function B6(e){const{multiple:t=!1,defaultValue:a,value:o,onValueChange:c,autoComplete:d,...f}=e;return s.jsx(z6,{...f,selectionMode:t?"multiple":"single",selectedValue:o,defaultSelectedValue:a,onSelectedValueChange:c,formAutoComplete:d})}const H6="data-popup-side",U6="data-list-empty",lA={...$v,...ji,popupSide:e=>e?{[H6]:e}:null,listEmpty:e=>e?{[U6]:""}:null},V6=x.createContext(void 0);function F6(){return x.useContext(V6)}const oA=x.createContext(void 0);function rj(e){const t=x.useContext(oA);if(t===void 0&&!e)throw new Error(on(21));return t}const iA=x.forwardRef(function(t,a){const o=Ca(),{buttonRef:c,getButtonProps:d}=Jr({native:!1}),f=ea(a,c);function p(v){o.context.setOpen(!1,$e(oy,v.nativeEvent,v.currentTarget))}const h=d({onClick:p});return s.jsx("span",{ref:f,...h,"aria-label":"Dismiss",tabIndex:void 0,style:Wc})});function cA(e){const t=e.useState("mounted"),a=e.useState("popupSide"),o=e.useState("positionerElement");return t&&o?a:null}function Bh(){return pf().filteredItems.length===0}function $6(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function q6(e,t){const a=e>=t-1?t-2:e;return a>=0?a:void 0}function uA(e,t,a){const o=e.context.listRef.current[t];o&&(e.context.selectionEventRef.current=a,o.click(),e.context.selectionEventRef.current=null)}const G6=x.forwardRef(function(t,a){const{render:o,className:c,disabled:d=!1,id:f,style:p,...h}=t,{state:v,disabled:y,setTouched:b,setFocused:j,validationMode:w,validation:k}=Sa(),{labelId:S}=vl(),N=F6(),D=!!rj(!0),C=Ca(),A=nA(),R=cf(),I=C.useState("required"),P=C.useState("disabled"),O=C.useState("readOnly"),_=C.useState("name"),L=C.useState("form"),H=C.useState("selectionMode"),B=C.useState("autoHighlight"),z=C.useState("inputProps"),Q=C.useState("triggerProps"),K=C.useState("open"),X=C.useState("mounted"),q=C.useState("selectedValue"),$=C.useState("id"),Y=C.useState("inline"),F=C.useState("modal"),G=!!B,W=cA(C),le=y||P||d,M=Bh(),U=D||Y,Z=!U||F,ae=Na(f??(U?void 0:$)),ce=D?KC:v,[J,ie]=x.useState(null),ge=x.useRef(!1),ee=x.useRef(null),fe=x.useRef(!1),te=H==="none"&&!D,Ce=Ie(we=>{const xe=D||C.state.inline;xe&&!C.state.hasInputValue&&C.context.setInputValue("",$e(Yn)),C.update({inputElement:we,inputInsidePopup:xe,inputOwnsFormValue:te})}),re=D?h:k.getValidationProps(le,h);function de(){C.context.setIndices({activeIndex:null,selectedIndex:null,type:C.context.keyboardActiveRef.current?k1:C1})}function ke(){C.context.keyboardActiveRef.current=!1}const Ee={...ce,open:K,disabled:le,readOnly:O,popupSide:W,listEmpty:M};function ve(we){if(!N)return;let xe;const{highlightedChipIndex:Te}=N,Oe=N.chipsRef.current.length,[Ne,Le]=$6(R);return Te!==void 0?(we.key===Ne?(we.preventDefault(),Te>0?xe=Te-1:xe=void 0):we.key===Le?(we.preventDefault(),Te0&&(we.preventDefault(),xe=Oe>0?Oe-1:void 0),xe)}const he=yt("input",t,{state:Ee,ref:[a,C.context.inputRef,Ce],props:[z,Q,{value:J??A,"aria-readonly":O||void 0,"aria-required":I||void 0,"aria-labelledby":S,disabled:le,readOnly:O,required:H==="none"?I:void 0,form:L,...te&&_&&{name:_},id:ae,onFocus(){if(j(!0),!Y||!fe.current)return;fe.current=!1;const we=ee.current;we==null||!Object.hasOwn(C.context.valuesRef.current,we)||C.context.setIndices({activeIndex:we})},onBlur(){b(!0),j(!1);const we=C.state.activeIndex;if(Y&&we!==null&&B!=="always"&&(ee.current=we,fe.current=!0,C.context.setIndices({activeIndex:null})),w==="onBlur"){const xe=H==="none"?A:q;k.commit(xe)}},onCompositionStart(we){Vm||(ge.current=!0,ie(we.currentTarget.value))},onCompositionEnd(we){ge.current=!1;const xe=we.currentTarget.value;ie(null),C.context.setInputValue(xe,$e(Jd,we.nativeEvent))},onChange(we){const xe=we.nativeEvent,Te=xe.inputType,Oe=!Te||Te==="insertReplacementText",Ne=ge.current||!Oe;function Le(Rt){O||le||!Rt||!Ne||(C.context.setOpen(!0,$e(Jd,xe)),G||de())}if(ge.current){const Rt=we.currentTarget.value;ie(Rt),Rt===""&&!C.state.openOnInputClick&&!C.state.inputInsidePopup&&C.context.setOpen(!1,$e(Ka,xe));const ot=Rt.trim(),qn=G&&ot!=="";Le(ot),K&&C.state.activeIndex!==null&&!qn&&de();return}const Ye=$e(Jd,xe);if(C.context.setInputValue(we.currentTarget.value,Ye),Ye.isCanceled)return;const kt=we.currentTarget.value==="",Ct=$e(Ka,xe);kt&&!C.state.inputInsidePopup&&(H==="single"&&C.context.setSelectedValue(null,Ct),C.state.openOnInputClick||C.context.setOpen(!1,Ct)),Le(we.currentTarget.value.trim()),K&&C.state.activeIndex!==null&&!G&&de()},onKeyDown(we){if(we.ctrlKey||we.shiftKey||we.altKey||we.metaKey)return;if(C.context.keyboardActiveRef.current=!0,le||O){O&&we.key==="Enter"&&K&&C.state.activeIndex!==null&&ks(we);return}const xe=we.currentTarget,Te=xe.scrollWidth-xe.clientWidth,Oe=R==="rtl";if(we.key==="Home"){ks(we);const Ye=e1&&Oe?xe.value.length:0;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=0;return}if(we.key==="End"){ks(we);const Ye=e1&&Oe?0:xe.value.length;xe.setSelectionRange(Ye,Ye),xe.scrollLeft=Oe?-Te:Te;return}if(!X&&we.key==="Escape"){const Ye=H==="multiple"&&Array.isArray(q)?q.length===0:q===null,kt=$e(Qc,we.nativeEvent),Ct=H==="multiple"?[]:null;C.context.setInputValue("",kt),C.context.setSelectedValue(Ct,kt),!Ye&&!C.state.inline&&!kt.isPropagationAllowed&&we.stopPropagation();return}if(N&&we.key==="Backspace"&&xe.value===""&&N.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ye=N.chipsRef.current.length,kt=Ye>0?Ye-1:q.length-1,Ct=q.filter((Rt,ot)=>ot!==kt);de(),C.context.setSelectedValue(Ct,$e(Yn,we.nativeEvent));return}const Ne=N?.highlightedChipIndex!==void 0,Le=ve(we);if(N?.setHighlightedChipIndex(Le),Le!==void 0?N?.chipsRef.current[Le]?.focus():Ne&&C.context.inputRef.current?.focus(),we.which!==229&&we.key==="Enter"&&K){const Ye=C.state.activeIndex,kt=we.nativeEvent;if(Ye===null){if(Y)return;C.context.setOpen(!1,$e(Yn,kt));return}ks(we),uA(C,Ye,kt)}},onPointerMove:ke,onPointerDown:ke},re],stateAttributesMapping:lA}),ye=D?s.jsx(XC.Provider,{value:YC,children:he}):he;return s.jsxs(x.Fragment,{children:[K&&Z&&s.jsx(iA,{ref:C.context.startDismissRef}),ye]})}),K6=x.forwardRef(function(t,a){const{render:o,className:c,nativeButton:d=!0,disabled:f=!1,id:p,style:h,...v}=t,{state:y,disabled:b,setTouched:j,setFocused:w,validationMode:k,validation:S}=Sa(),{labelId:N}=vl(),T=Ca(),D=T.useState("selectionMode"),C=T.useState("disabled"),A=T.useState("readOnly"),R=T.useState("required"),I=T.useState("positionerElement"),P=T.useState("listElement"),O=T.useState("popupId"),_=T.useState("triggerProps"),L=T.useState("inputInsidePopup"),H=T.useState("id"),B=T.useState("labelId"),z=T.useState("open"),Q=T.useState("selectedValue"),K=T.useState("activeIndex"),X=T.useState("selectedIndex"),q=T.useState("hasSelectedValue"),$=zh(),Y=nA(),F=Zs(),G=b||C||f,W=Bh(),le=cA(T);oo({id:L?p:void 0});const M=L?p??H:p,U=UE(N,B);let Z;z&&L?Z=O??sA(H):z&&(Z=P?.id);const ae=x.useRef("");function ce(re){ae.current=re.pointerType}const{reference:J}=UT($,{enabled:!z&&!A&&!C&&D==="single",listRef:T.context.labelsRef,activeIndex:K,selectedIndex:X,onMatch(re){const de=T.context.valuesRef.current[re];de!==void 0&&T.context.setSelectedValue(de,$e(Yn))}}),{reference:ie}=ch($,{enabled:!C,event:"mousedown"}),{buttonRef:ge,getButtonProps:ee}=Jr({native:d,disabled:G}),fe={...y,readOnly:A,open:z,disabled:G,popupSide:le,listEmpty:W,placeholder:D==="none"?!1:!q},te=Ie(re=>{T.set("triggerElement",re)});return yt("button",t,{ref:[a,ge,te],state:fe,props:[_,ie,J,{id:M,tabIndex:L?0:-1,role:L?"combobox":void 0,"aria-expanded":z,"aria-haspopup":L?"dialog":"listbox","aria-controls":Z,"aria-required":L&&R||void 0,"aria-readonly":L&&A||void 0,"aria-labelledby":U,onPointerDown:ce,onPointerEnter:ce,onFocus(){w(!0),!G&&F.start(0,T.context.forceMount)},onBlur(re){if(!Qe(I,re.relatedTarget)&&(j(!0),w(!1),k==="onBlur")){const de=D==="none"?Y:Q;S.commit(de)}},onMouseDown(re){if(G||(L||$.set("domReferenceElement",re.currentTarget),T.context.forceMount(),ae.current!=="touch"&&(T.context.inputRef.current?.focus(),L||re.preventDefault()),z))return;const de=$t(re.currentTarget);function ke(Ee){const ve=T.state.triggerElement;if(!ve)return;const he=cs(Ee),ye=T.state.positionerElement,we=T.state.listElement;Qe(ve,he)||Qe(ye,he)||Qe(we,he)||VE(Ee,ve)||T.context.setOpen(!1,$e(T1,Ee))}L&&de.addEventListener("mouseup",ke,{once:!0})},onKeyDown(re){(re.key==="ArrowDown"||re.key==="ArrowUp")&&(ks(re),T.context.setOpen(!0,$e(iy,re.nativeEvent)),T.context.inputRef.current?.focus())}},S.getValidationProps(G,v),ee],stateAttributesMapping:lA})}),Y6=x.createContext(null);function X6(){return x.useContext(Y6)}function Q6(e){const{children:t}=e,{filteredItems:a}=pf(),o=X6(),c=o?o.items:a;return s.jsx(x.Fragment,{children:c.map(t)})}const Z6=x.forwardRef(function(t,a){var o;const{render:c,className:d,style:f,children:p,...h}=t,v=Ca(),y=zh(),b=!!rj(!0),{filteredItems:j,hasItems:w}=pf(),k=v.useState("selectionMode"),S=v.useState("grid"),N=v.useState("readOnly"),T=v.useState("listProps"),D=v.useState("virtualized"),C=v.useState("forceMounted"),A=k==="multiple",R=j.length===0,I=Ie(z=>{v.set("positionerElement",z)}),P=Ie(z=>{v.set("listElement",z)}),O=x.useMemo(()=>typeof p=="function"?o||(o=s.jsx(Q6,{children:p})):p,[p]),_={empty:R},L=y.useState("floatingId"),H=yt("div",t,{state:_,ref:[a,P,b?null:I],props:[T,{children:O,tabIndex:-1,id:L,role:S?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!S&&N?!0:void 0,onKeyDown(z){if(!(v.state.disabled||v.state.readOnly)&&z.key==="Enter"){const Q=v.state.activeIndex;if(Q==null)return;ks(z),uA(v,Q,z.nativeEvent)}},onKeyDownCapture(){v.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){v.context.keyboardActiveRef.current=!1}},h]});if(D)return H;const B=w&&!C?void 0:v.context.labelsRef;return s.jsx(Wy,{elementsRef:v.context.listRef,labelsRef:B,children:H})}),W6="⁠",J6=200;function eF(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let a=null;for(;t.nextNode();){const o=t.currentNode;o.nodeValue!==""&&(a=o)}return a}function tF(){const e=Zs(),t=x.useRef(null);return x.useEffect(()=>{if(Yd)return;const a=t.current;if(a==null)return;const o=eF(a);if(o==null)return;const c=o.data,d=`${c}${W6}`;return o.nodeValue=d,e.start(J6,()=>{o.nodeValue===d&&(o.nodeValue=c)}),()=>{e.clear(),o.nodeValue===d&&(o.nodeValue=c)}},[t,e]),t}const dA=x.createContext(void 0);function nF(){const e=x.useContext(dA);if(e===void 0)throw new Error(on(20));return e}const sF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t,d=Ca(),f=d.useState("mounted"),p=d.useState("forceMounted");return f||o||p?s.jsx(dA.Provider,{value:o,children:s.jsx(oh,{ref:a,...c})}):null}),rF=x.forwardRef(function(t,a){const{render:o,className:c,anchor:d,positionMethod:f,side:p,align:h,sideOffset:v,alignOffset:y,collisionBoundary:b="clipping-ancestors",collisionPadding:j,arrowPadding:w,sticky:k,disableAnchorTracking:S=!1,collisionAvoidance:N=X1,style:T,...D}=t,C=Ca(),A=zh(),R=nF(),I=C.useState("modal"),P=C.useState("open"),O=C.useState("mounted"),_=C.useState("openMethod"),L=C.useState("positionerElement"),H=C.useState("triggerElement"),B=C.useState("inputElement"),z=C.useState("inputGroupElement"),Q=C.useState("inputInsidePopup"),K=C.useState("transitionStatus"),X=Bh(),$=jh({anchor:d??(Q?H:z??B),floatingRootContext:A,positionMethod:f,mounted:O,side:p,sideOffset:v,align:h,alignOffset:y,arrowPadding:w,collisionBoundary:b,collisionPadding:j,sticky:k,disableAnchorTracking:S,keepMounted:R,collisionAvoidance:N,lazyFlip:!0});tj(P&&I,_==="touch",L,H);const Y={open:P,side:$.side,align:$.align,anchorHidden:$.anchorHidden,empty:X};De(()=>{C.set("popupSide",$.side)},[C,$.side]);const F=Ie(W=>{C.set("positionerElement",W)}),G=wh(t,Y,{styles:$.positionerStyles,transitionStatus:K,props:D,refs:[a,F],hidden:!O,inert:!P});return s.jsxs(oA.Provider,{value:$,children:[O&&I&&s.jsx(Ch,{inert:Sh(!P),cutout:z??B??H}),G]})}),aF={...qc,...io},lF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,v=Ca(),y=rj(),b=zh(),j=v.useState("mounted"),w=v.useState("open"),k=v.useState("openMethod"),S=v.useState("popupProps"),N=v.useState("transitionStatus"),T=v.useState("inputInsidePopup"),D=v.useState("inputElement"),C=v.useState("modal"),A=v.useState("id"),R=Bh(),I=h.id??(T?sA(A):void 0);De(()=>(v.set("popupId",v.context.popupRef.current?.id||I),()=>{v.set("popupId",void 0)}),[v,I]),ra({open:w,ref:v.context.popupRef,onComplete(){w&&v.context.onOpenChangeComplete(!0)}});const P={open:w,side:y.side,align:y.align,anchorHidden:y.anchorHidden,transitionStatus:N,empty:R},O=yt("div",t,{state:P,ref:[a,v.context.popupRef],props:[S,{id:I,role:T?"dialog":"presentation",onFocus(z){const Q=cs(z.nativeEvent);k!=="touch"&&(Qe(v.state.listElement,Q)||Q===z.currentTarget)&&v.context.inputRef.current?.focus()}},uf(N),h],stateAttributesMapping:aF}),L=f===void 0?T?z=>z==="touch"?v.context.popupRef.current:D:!1:f;let H;p!=null?H=p:H=T?void 0:!1;const B=!T||C;return s.jsx(ih,{context:b,disabled:!j,modal:B,openInteractionType:k,initialFocus:L,returnFocus:H,getInsideElements:()=>[v.context.startDismissRef.current,v.context.endDismissRef.current],children:s.jsxs(x.Fragment,{children:[O,B&&s.jsx(iA,{ref:v.context.endDismissRef})]})})}),oF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,...f}=t;return yt("span",t,{ref:a,props:[{"aria-hidden":!0,children:"▼"},f]})}),fA=x.createContext(void 0);function pA(){const e=x.useContext(fA);if(!e)throw new Error(on(19));return e}const iF=x.createContext(!1);function cF(){return x.useContext(iF)}function mA(e){const{componentProps:t,forwardedRef:a,virtualized:o,indexFromFilter:c}=e,{render:d,className:f,style:p,value:h=null,index:v,disabled:y=!1,nativeButton:b=!1,...j}=t,w=x.useRef(null),k=Zy({guess:!0,index:v,textRef:w}),S=Ca(),N=cF(),T=O6(),D=S.useState("selectionMode"),C=S.useState("disabled"),A=S.useState("readOnly"),R=S.useState("isItemEqualToValue"),I=C||y,P=D!=="none",O=v??c??k.index,_=O!==-1,L=S.useState("id"),H=S.useState("isActive",O),B=S.useState("isSelected",h),z=S.useState("itemProps"),Q=x.useRef(null),K=L!=null&&_?`${L}-${O}`:void 0,X=B&&P;De(()=>{if(!(_&&(o||v!=null)))return;const U=S.context.listRef.current;return U[O]=Q.current,()=>{delete U[O]}},[_,o,O,v,S]),De(()=>{if(!_||T)return;const M=S.context.valuesRef.current;return M[O]=h,()=>{delete M[O]}},[_,T,O,h,S]),De(()=>{if(!_||T)return;const M=S.state.selectedValue;let U=S.state.selectedIndex;S.state.selectionMode==="multiple"&&Array.isArray(M)?U=_E(O,h,S.context.valuesRef.current,M,R,U):la(h,M,R)&&(U=O),S.set("selectedIndex",U)},[_,T,S,O,h,R]);const{getButtonProps:q,buttonRef:$}=Jr({disabled:I,focusableWhenDisabled:!0,native:b,composite:!0}),Y={disabled:I,selected:X,highlighted:H};function F(M){function U(){S.context.handleSelection(M,h)}S.state.submitOnItemClick?(Cs.flushSync(U),S.context.requestSubmit()):U()}const G={id:K,role:N?"gridcell":"option","aria-selected":P?X:void 0,tabIndex:void 0,onPointerDownCapture(M){M.isPrimary&&(S.context.pointerDownItemRef.current=M.currentTarget),M.preventDefault()},onMouseDown(M){M.preventDefault()},onClick(M){I||A||F(M.nativeEvent)},onMouseUp(M){const U=S.context.pointerDownItemRef.current===M.currentTarget;S.context.pointerDownItemRef.current=null,!(I||A||M.button!==0||U||!H)&&F(M.nativeEvent)}},W=yt("div",t,{ref:[$,a,k.ref,Q],state:Y,props:[z,G,j,q]}),le=x.useMemo(()=>({selected:X,textRef:w}),[X,w]);return s.jsx(fA.Provider,{value:le,children:W})}function uF(e){const{componentProps:t,forwardedRef:a}=e,c=Ca().useState("isItemEqualToValue"),{flatFilteredValues:d}=pf(),f=t.value??null,p=ru(d,f,c);return s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:!0,indexFromFilter:p})}const dF=x.memo(x.forwardRef(function(t,a){const c=Ca().useState("virtualized");return c&&t.index==null?s.jsx(uF,{componentProps:t,forwardedRef:a}):s.jsx(mA,{componentProps:t,forwardedRef:a,virtualized:c,indexFromFilter:void 0})})),fF=x.forwardRef(function(t,a){const{selected:o}=pA();return t.keepMounted||o?s.jsx(pF,{...t,ref:a}):null}),pF=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:c,keepMounted:d,...f}=e,{selected:p}=pA(),h=x.useRef(null),{transitionStatus:v,setMounted:y}=ki(p),j=yt("span",e,{ref:[t,h],state:{selected:p,transitionStatus:v},props:[{"aria-hidden":!0,children:"✔️"},f],stateAttributesMapping:io});return ra({batch:!0,enabled:!p,open:p,ref:h,onComplete(){p||y(!1)}}),j})),mF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,children:f,...p}=t,{filteredItems:h}=pf(),v=Ca(),y=tF(),b=h.length===0?f:null;return yt("div",t,{ref:[a,v.context.emptyRef,y],props:[{children:b,role:"status","aria-live":"polite","aria-atomic":!0},p]})}),hF="、";function Hh({value:e,onValueChange:t,options:a,placeholder:o="",emptyHint:c=xo("没有匹配的选项"),searchPlaceholder:d=xo("搜索…"),disabled:f=!1,className:p,id:h,title:v,...y}){const b=x.useMemo(()=>a.filter(w=>e.includes(w.value)),[a,e]),j=b.length?b.map(w=>w.label).join(hF):o;return s.jsxs(B6,{items:a,multiple:!0,value:b,onValueChange:w=>t(w.map(k=>k.value)),isItemEqualToValue:(w,k)=>w?.value===k?.value,disabled:f,children:[s.jsxs(K6,{"data-slot":"multi-select-trigger",id:h,title:v,"aria-label":y["aria-label"],className:Ue("inline-flex h-[30px] min-w-0 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-control-border bg-control px-2.5","text-[12.5px] font-normal text-foreground","transition-colors duration-150 ease-out","hover:border-control-border-hover hover:bg-control-hover","focus-visible:border-primary focus-visible:shadow-focus focus-visible:outline-none","data-disabled:cursor-not-allowed data-disabled:bg-control data-disabled:text-muted-foreground data-disabled:opacity-60",p),children:[s.jsx("span",{"data-slot":"multi-select-value",className:"min-w-0 flex-1 truncate text-left data-[placeholder]:text-muted-foreground","data-placeholder":b.length?void 0:"",title:j,children:j}),s.jsx(oF,{className:"flex flex-none text-muted-foreground transition-transform duration-[180ms] data-popup-open:rotate-180",children:s.jsx("svg",{viewBox:"0 0 10 6",className:"size-2.5","aria-hidden":"true",children:s.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),s.jsx(sF,{children:s.jsx(rF,{sideOffset:4,className:"z-[35]",children:s.jsxs(lF,{"data-slot":"multi-select-content",className:Ue("flex max-h-[280px] w-[max(var(--anchor-width),220px)] flex-col overflow-hidden","rounded-lg border border-border-strong bg-raised shadow-3 outline-none","data-open:animate-in data-open:fade-in-0","data-closed:animate-out data-closed:fade-out-0"),children:[s.jsxs("div",{className:"flex flex-none items-center gap-1.5 border-b border-hairline px-2.5 py-1.5",children:[s.jsxs("svg",{viewBox:"0 0 12 12",className:"size-3 flex-none text-muted-foreground","aria-hidden":"true",children:[s.jsx("circle",{cx:"5",cy:"5",r:"3.4",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),s.jsx("path",{d:"M7.6 7.6 10.5 10.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),s.jsx(G6,{placeholder:d,className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-[12.5px] text-foreground outline-none placeholder:text-muted-foreground"})]}),s.jsx(mF,{children:s.jsx("div",{className:"px-2.5 py-3 text-[11.5px] leading-[1.5] text-muted-foreground",children:c})}),s.jsx(Z6,{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-[5px]",children:w=>s.jsxs(dF,{value:w,className:Ue("grid cursor-pointer grid-cols-[14px_minmax(0,1fr)] items-center gap-2 rounded-sm px-[9px] py-[5px]","text-[12.5px] leading-[1.4] text-foreground select-none outline-none","transition-colors duration-[120ms] ease-out","data-[highlighted]:bg-nav-hover","data-[selected]:bg-primary-soft data-[selected]:font-semibold data-[selected]:text-primary-fg","data-[highlighted]:data-[selected]:bg-primary-tint","data-disabled:pointer-events-none data-disabled:text-muted-foreground"),children:[s.jsx(fF,{className:"col-start-1 flex text-primary",children:s.jsx("svg",{viewBox:"0 0 12 12",className:"size-3","aria-hidden":"true",children:s.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",stroke:"currentColor",strokeWidth:"1.8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("span",{className:"col-start-2 min-w-0 truncate",children:w.label})]},w.value)})]})})})]})}const hA=x.createContext(void 0);function mf(e){const t=x.useContext(hA);if(t===void 0&&!e)throw new Error(on(47));return t}const gF={..._y,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class xF extends nu{constructor(a,o,c){const d=new ph;super(bF(a,d,o,c),vF(d),gF);ln(this,"setOpen",(a,o)=>{const c=o.reason===Vs,d=o.reason===ho&&o.event.detail===0,f=!a&&(o.reason===Qc||o.reason==null),p=AT(o),h=this.select("activeTriggerId");if(!a&&o.reason===oy&&o.trigger==null&&h!=null&&(o.trigger=this.context.triggerElements.getById(h)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(a,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,o);const v=()=>{const b=Ry(this.state,a,o.trigger,p());b.openChangeReason=o.reason,this.update(b)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(tH,()=>{this.set("stickIfOpen",!1)}),Cs.flushSync(v)):v();let y;d?y="click":f?y="dismiss":o.reason===go&&(y="focus"),this.set("instantType",y)})}}function bF(e,t,a,o=!1){const c={...Iy(t,a,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return c.open&&e?.mounted===void 0&&(c.mounted=!0),c}function vF(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new sa,triggerElements:e}}const gA=rh(function({props:t}){const{children:a,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:f,modal:p=!1,handle:h,triggerId:v,defaultTriggerId:y=null}=t,b=jF(h,{modal:p,open:c,openProp:o,activeTriggerId:y,triggerIdProp:v});b.useControlledProp("openProp",o),b.useControlledProp("triggerIdProp",v);const j=b.useState("open"),w=b.useState("mounted"),k=b.useState("payload");b.useContextCallback("onOpenChange",d),b.useContextCallback("onOpenChangeComplete",f),OT(b,j),Oy(b);const{forceUnmount:S}=My(j,b,()=>{b.update({stickIfOpen:!0,openChangeReason:null})});b.useSyncedValues({modal:p}),x.useEffect(()=>{j||b.context.stickIfOpenTimeout.clear()},[b,j]),x.useImperativeHandle(t.actionsRef,()=>({unmount:S,close:()=>b.setOpen(!1,$e(cy))}),[S,b]);const N=j||w;return s.jsxs(hA.Provider,{value:b,children:[h&&s.jsx(Ay,{handle:h,store:b}),N&&s.jsx(wF,{store:b,modal:p}),typeof a=="function"?a({payload:k}):a]})});function yF(e){return mf(!0)?s.jsx(gA,{props:e}):s.jsx(iH,{children:s.jsx(gA,{props:e})})}function jF(e,t){const a=Ey((o,c)=>new xF(t,o,c));return x.useEffect(()=>a.context.stickIfOpenTimeout.disposeEffect(),[a]),a}function wF({store:e,modal:t}){const a=e.useState("floatingRootContext"),o=af(a,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),c=o.reference,d=o.floating;return Dy(e,{activeTriggerProps:c,inactiveTriggerProps:c,popupProps:d}),null}const SF=300;function NF(e,t){const a=x.useRef(null);function o(d){Cs.flushSync(()=>{e.setOpen(!1,$e(go,d.nativeEvent,d.currentTarget))}),n4(a.current)?.focus()}function c(d){const f=e.select("positionerElement");if(f&&Kc(d,f))e.context.beforeContentFocusGuardRef.current?.focus();else{Cs.flushSync(()=>{e.setOpen(!1,$e(go,d.nativeEvent,d.currentTarget))});let p=t4(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(f,p);){const h=p;if(p=ry(p),p===h)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}const kF=L1(function(t,a){const{render:o,className:c,style:d,disabled:f=!1,nativeButton:p=!0,handle:h,payload:v,openOnHover:y=!1,delay:b=SF,closeDelay:j=0,id:w,...k}=t,S=mf(!0),T=IT(h)??S;if(!T)throw new Error(on(74));const D=Na(w),C=T.useState("isTriggerActive",D),A=T.useState("floatingRootContext"),R=T.useState("isOpenedByTrigger",D),I=T.useState("triggerPopupId",D),P=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:_}=RT(D,P,T,{payload:v,disabled:f,openOnHover:y,closeDelay:j}),L=T.useState("openChangeReason"),H=T.useState("stickIfOpen"),B=T.useState("openMethod"),z=T.useState("focusManagerModal"),Q=zT(A,{enabled:!f&&y&&(B!=="touch"||L!==ho),mouseOnly:!0,move:!1,handleClose:FT(),restMs:b,delay:{close:j},triggerElementRef:P,isActiveTrigger:C,isClosing:()=>T.select("transitionStatus")==="ending"}),K=ch(A,{stickIfOpen:H}),X=bE(()=>T.select("open"),ae=>{T.set("openMethod",ae)}),q=T.useState("triggerProps",_),{getButtonProps:$,buttonRef:Y}=Jr({disabled:f,native:p}),F={open(ae){return ae&&L===ho?$v.open(ae):Fv.open(ae)}},{preFocusGuardRef:G,handlePreFocusGuardFocus:W,handleFocusTargetFocus:le}=NF(T,P),U=yt("button",t,{state:{disabled:f,open:R},ref:[Y,a,O,P],props:[K.reference,Q,q,X,{[Y1]:"",id:D,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":I},k,$],stateAttributesMapping:F}),Z=s.jsx(x.Fragment,{children:U},D);return _&&!z?s.jsxs(x.Fragment,{children:[s.jsx(Jc,{ref:G,onFocus:W}),Z,s.jsx(Jc,{ref:T.context.triggerFocusTargetRef,onFocus:le})]}):Z}),xA=x.createContext(void 0);function CF(){const e=x.useContext(xA);if(e===void 0)throw new Error(on(45));return e}const TF=x.forwardRef(function(t,a){const{keepMounted:o=!1,...c}=t;return mf().useState("mounted")||o?s.jsx(xA.Provider,{value:o,children:s.jsx(oh,{ref:a,...c})}):null}),bA=x.createContext(void 0);function EF(){const e=x.useContext(bA);if(!e)throw new Error(on(46));return e}const AF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,anchor:f,positionMethod:p,side:h,align:v,sideOffset:y,alignOffset:b,collisionBoundary:j="clipping-ancestors",collisionPadding:w,arrowPadding:k,sticky:S,disableAnchorTracking:N=!1,collisionAvoidance:T=Q1,...D}=t,C=mf(),A=CF(),R=lH(),I=C.useState("floatingRootContext"),P=C.useState("mounted"),O=C.useState("open"),_=C.useState("openChangeReason"),L=C.useState("activeTriggerElement"),H=C.useState("modal"),B=C.useState("openMethod"),z=C.useState("positionerElement"),Q=C.useState("instantType"),K=C.useState("transitionStatus"),X=C.useState("adaptiveOrigin"),q=x.useRef(null),$=N1(z),Y=jh({anchor:f,floatingRootContext:I,positionMethod:p,mounted:P,side:h,sideOffset:y,align:v,alignOffset:b,arrowPadding:k,collisionBoundary:j,collisionPadding:w,sticky:S,disableAnchorTracking:N,keepMounted:A,nodeId:R,collisionAvoidance:T,adaptiveOrigin:X}),F=I.useState("domReferenceElement");De(()=>{const U=F,Z=q.current;if(U&&(q.current=U),Z&&U&&U!==Z){C.set("instantType",void 0);const ae=new AbortController;return $(()=>{C.set("instantType","trigger-change")},ae.signal),()=>{ae.abort()}}},[F,$,C]);const G=H===!0&&_!==Vs;tj(O&&G,B==="touch",z,L);const W=C.useStateSetter("positionerElement"),le={open:O,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,instant:Q},M=wh(t,le,{styles:Y.positionerStyles,transitionStatus:K,props:D,refs:[a,W],hidden:!P,inert:!O});return s.jsxs(bA.Provider,{value:Y,children:[P&&G&&s.jsx(Ch,{inert:Sh(!O),cutout:L}),s.jsx(oH,{id:R,children:M})]})}),RF=x.createContext(void 0);function OF(){const[e,t]=x.useState(0),a=Ie(()=>(t(c=>c+1),()=>{t(c=>Math.max(0,c-1))}));return{context:x.useMemo(()=>({register:a}),[a]),hasClosePart:e>0}}const MF=x.forwardRef(function(t,a){const{render:o,className:c,style:d,initialFocus:f,finalFocus:p,...h}=t,v=mf(),y=EF(),b=qE()!=null,{context:j,hasClosePart:w}=OF(),k=v.useState("open"),S=v.useState("openMethod"),N=v.useState("instantType"),T=v.useState("transitionStatus"),D=v.useState("popupProps"),C=v.useState("titleElementId"),A=v.useState("descriptionElementId"),R=v.useState("modal"),I=v.useState("mounted"),P=v.useState("openChangeReason"),O=v.useState("activeTriggerElement"),_=v.useState("floatingRootContext"),L=_.useState("floatingId"),H=v.useState("disabled"),B=v.useState("openOnHover"),z=v.useState("closeDelay");ra({open:k,ref:v.context.popupRef,onComplete(){k&&v.context.onOpenChangeComplete?.(!0)}}),LT(_,{enabled:B&&!H,closeDelay:z});const Q=f===void 0?TT(v.context.popupRef):f,K=R!==!1&&w;v.useSyncedValue("focusManagerModal",K);const X=v.useStateSetter("popupElement"),q={open:k,side:y.side,align:y.align,instant:N,transitionStatus:T},$=yt("div",t,{state:q,ref:[a,v.context.popupRef,X],props:[D,{id:L,role:"dialog",...lf,"aria-labelledby":C,"aria-describedby":A,onKeyDown(Y){b&&Nh.has(Y.key)&&Y.stopPropagation()}},uf(T),h],stateAttributesMapping:qv});return s.jsx(ih,{context:_,openInteractionType:S,modal:K,disabled:!I||P===Vs,initialFocus:Q,returnFocus:p,restoreFocus:"popup",previousFocusableElement:dn(O)?O:void 0,nextFocusableElement:v.context.triggerFocusTargetRef,beforeContentFocusGuardRef:v.context.beforeContentFocusGuardRef,children:s.jsx(RF.Provider,{value:j,children:$})})});function hf(e){return s.jsx(yF,{"data-slot":"popover",...e})}function Uh(e){return s.jsx(kF,{"data-slot":"popover-trigger",...e})}function gf({className:e,sideOffset:t=6,align:a="start",side:o,alignOffset:c,collisionPadding:d=8,anchor:f,children:p,...h}){return s.jsx(TF,{children:s.jsx(AF,{className:"z-[35] outline-none",sideOffset:t,align:a,side:o,alignOffset:c,collisionPadding:d,anchor:f,children:s.jsx(MF,{"data-slot":"popover-content",className:Ue("flex max-h-[min(70vh,560px)] flex-col overflow-hidden rounded-lg border border-border-strong bg-raised text-foreground shadow-3","outline-none","data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-top-1","data-closed:animate-out data-closed:fade-out-0",e),...h,children:p})})})}function DF({page:e,pageCount:t,onPageChange:a,disabled:o=!1,className:c,infoFirst:d=!1}){const f=Math.max(1,Number(t)||1),p=Math.min(Math.max(1,Number(e)||1),f),h=s.jsx("span",{"data-slot":"pager-info",className:"text-[11.5px] text-subtle [font-variant-numeric:tabular-nums]",children:xo("第 {current} / {total} 页",{current:p,total:f})});return s.jsxs("div",{"data-slot":"pager",className:Ue("flex items-center gap-2",c),children:[d&&h,s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p<=1,onClick:()=>a(p-1),children:xo("上一页")}),s.jsx(se,{type:"button",variant:"outline",size:"sm",disabled:o||p>=f,onClick:()=>a(p+1),children:xo("下一页")}),!d&&h]})}const IF=Fc(["relative flex w-full items-center gap-2.5 text-left","border border-transparent rounded-sm","shadow-none","transition-[background-color,border-color,color] duration-150 ease-out","outline-none focus-visible:shadow-focus","disabled:pointer-events-none disabled:opacity-45","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:["cursor-pointer px-2.5 py-2","text-[12.5px] font-medium text-sidebar-fg","hover:bg-nav-hover hover:text-foreground","data-[active]:border-nav-selected-border data-[active]:bg-nav-selected-bg data-[active]:font-semibold data-[active]:text-nav-selected-fg"],add:["cursor-pointer justify-center px-2 py-1.5","border-dashed border-border-strong bg-transparent","text-[11.5px] text-muted-foreground","hover:border-primary hover:text-primary-fg"]}},defaultVariants:{variant:"default"}});function au({className:e,variant:t,active:a=!1,count:o,icon:c,trailing:d,children:f,...p}){return s.jsxs("button",{type:"button","data-slot":"nav-item","data-active":a?"":void 0,"aria-current":a?"true":void 0,className:Ue(IF({variant:t}),e),...p,children:[c,s.jsx("span",{"data-slot":"nav-item-label",className:"min-w-0 flex-1 truncate",children:f}),d,o!=null&&s.jsx("span",{"data-slot":"nav-item-count",className:Ue("flex-none text-[10.5px] text-sidebar-muted [font-variant-numeric:tabular-nums]",a&&"text-inherit"),children:o})]})}function r(e,t){const a=typeof window<"u"?window.wbI18n:void 0;return a&&typeof a.t=="function"?a.t(e,t):e}function Vh(e){if(e.source==="subscription"&&(e.port===null||e.port===void 0))return r("未分配端口");const t=e.resolved;return t?.protocol&&t.host&&t.port?`${String(t.protocol).toUpperCase()} ${t.host}:${t.port}`:t?.label||""}function lu(e){const t=e.name||e.id,o=[e.resolveError?r("解析失败"):Vh(e),e.enabled===!1?r("已禁用"):""].filter(Boolean);return o.length?r("{name}({parts})",{name:t,parts:o.join(" · ")}):t}const Xa="pool:";function Pe(){return window}function _e(e,t){Pe().wbApp?.toast?.(e,t)}function Qa(e){const t=Pe().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function Fs(e){const t=Pe().wbApp?.formatTime;if(t)return t(e);const a=Number(e);return!Number.isFinite(a)||a<=0?"":new Date(a).toLocaleString("zh-CN")}function ut(e){return e instanceof Error?e.message:String(e)}function ou(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function aj(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const a=o=>String(o).padStart(2,"0");return`${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}`}function PF(e){return e==="积分"?r("积分"):e==="额度"?r("额度"):e}function _F(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e,a=Array.isArray(t.credits)?t.credits:[],o=Date.now();return a.map(c=>{const d=String(c?.name||"").trim()||r("积分包"),f=String(c?.unit||"").trim(),p=ou(c?.total),h=ou(c?.used),v=ou(c?.remain),y=c?.unlimited===!0,b=ou(c?.grantAt),j=ou(c?.startAt),w=ou(c?.expireAt),k=c?.daily===!0,S=String(c?.grantReason||"").trim(),N=w!==null&&w>0&&w<=o,T=p!==null&&p>0,D=y?r("不限"):v!==null?T?r("剩 {remaining} / {total}",{remaining:v,total:p}):r("剩 {remaining}",{remaining:v}):h!==null?r("已用 {used}",{used:h}):"—",C=!y&&f&&D!=="—"?`${D} ${PF(f)}`:D,A=T&&v!==null?Math.max(0,Math.min(100,v/p*100)):null,R=v!==null&&v<=0||v===null&&h!==null&&T&&h>=p,I=!y&&!k&&(R||N),P=[];b!==null&&b>0?P.push(r("{time} 领取",{time:aj(b)})):j!==null&&j>0&&P.push(r("{time} 生效",{time:aj(j)})),k?P.push(r("每日重置")):w!==null&&w>0&&P.push(N?r("已过期"):r("{time} 到期",{time:aj(w)})),S&&P.push(S);const O=N||v===0?"muted":A!==null&&A<20?"warn":v===null&&h===null&&!y?"muted":"ok",_=[d,C,b!==null&&b>0?r("领取 {time}",{time:Fs(b)}):j!==null&&j>0?r("生效 {time}",{time:Fs(j)}):"",w!==null&&w>0?N?r("已过期({time})",{time:Fs(w)}):r("到期 {time}",{time:Fs(w)}):"",k?r("每日重置(额度按周期回满,不是作废)"):"",S,A===null&&v!==null?r("上游未给总量,画不出剩余比例"):"",h!==null&&p!==null?r("已用 {used} / 共 {total}",{used:h,total:p}):""].filter(Boolean).join(" · ");return{name:d,view:C,tone:O,percent:A,window:P.length?P.join(" · "):null,title:_,spent:I}})}function vA({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.window?s.jsx("div",{className:"usage-pop-window",children:e.window}):null,e.percent!==null?s.jsx("span",{className:"usage-pop-track",children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function yA({rows:e,subscriptionLine:t,variant:a,kind:o,title:c,children:d}){const[f,p]=x.useState(!1),[h,v]=x.useState(!1),y=e.filter(N=>!N.spent),b=e.filter(N=>N.spent),j=a==="pool"?`usage-toggle usage-pool-line ${o}`:`usage-toggle ${o}`,w=x.useRef(null),k=x.useCallback(N=>{w.current=N,N&&(N.scrollTop=0)},[]),S=x.useCallback(()=>w.current??null,[]);return x.useLayoutEffect(()=>{if(!h)return;const N=w.current?.querySelector(".usage-pop-spent .usage-pop-row");N instanceof HTMLElement&&N.scrollIntoView({block:"nearest"})},[h]),s.jsxs(hf,{open:f,onOpenChange:p,children:[s.jsxs(Uh,{render:s.jsx("button",{type:"button",className:j,title:c,"aria-label":r("积分明细")}),children:[a==="pool"?d:s.jsx("span",{className:"val",children:d}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsx(gf,{align:"end",sideOffset:6,className:"w-[320px]",initialFocus:S,children:s.jsxs("div",{className:"usage-pop-credit",ref:k,tabIndex:-1,children:[t?s.jsx("div",{className:"usage-pop-sub",children:t}):null,s.jsx("div",{className:"usage-pop-group",children:r("积分明细")}),y.map((N,T)=>s.jsx(vA,{row:N},`${N.name}-${T}`)),b.length>0?s.jsxs("div",{className:"usage-pop-spent",children:[s.jsxs("button",{type:"button",className:"usage-pop-spent-head","aria-expanded":h,title:r("展开或收起(默认收起)"),onClick:()=>v(N=>!N),children:[s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"}),s.jsx("span",{children:r("已用完 / 已过期")}),s.jsx("span",{className:"n",children:r("{count} 份",{count:b.length})})]}),h?b.map((N,T)=>s.jsx(vA,{row:N},`spent-${N.name}-${T}`)):null]}):null]})})]})}const iu="workbuddy",LF="raccoon",zF={workbuddy:{usage:!0,creditDetail:!0,edition:!0,identifier:"uid",expiry:"expiresAt"},"workbuddy-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},raccoon:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},catpaw:{usage:!0,edition:!1,identifier:"uid",expiry:"tokenExpiresAt"},autoclaw:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt"},"autoclaw-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!0},qoder:{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"qoder-intl":{usage:!0,creditDetail:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"cline-free":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},"cline-pass":{usage:!0,edition:!1,identifier:"account",expiry:"expiresAt"},accio:{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},"accio-cn":{usage:!0,edition:!0,identifier:"userId",expiry:"expiresAt",emailAsName:!0},zcode:{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},"zcode-intl":{usage:!0,creditDetail:!0,claim:!0,planChannel:!0,edition:!0,identifier:"userId",expiry:"expiresAt"},codearts:{usage:!0,usageDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt",concurrencyDefault:3},trae:{usage:!0,creditDetail:!0,edition:!1,identifier:"uid",expiry:"expiresAt"},loomy:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:"expiresAt"},kuku:{usage:!0,edition:!1,identifier:"uid",expiry:""},officeace:{usage:!0,creditDetail:!0,edition:!1,identifier:"id",expiry:"expiresAt"},antigravity:{usage:!0,edition:!1,identifier:"userId",expiry:""},modelscope:{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""},"modelscope-intl":{usage:!0,creditDetail:!0,edition:!1,identifier:"userId",expiry:""}},BF={usage:!1,edition:!1,identifier:"userId",expiry:"tokenExpiresAt",emailAsName:!1};function kn(e){const t=e?.provider;return typeof t=="string"&&t?t:iu}function ir(e){return e&&zF[e]||BF}const HF="opencode",UF="https://opencode.ai/zen/go/v1";function jA(e,t){if(!e||e.clientEmulation!==HF)return!1;const o=((typeof t=="string"?t.trim():"")||String(e.baseUrl||"")).trim().replace(/\/+$/,"").toLowerCase();return o?o!==UF:!1}function VF(e){const t=e?kn(e):"";return t.startsWith("custom-")&&(Pe().wbProviders?.customList?.()||[]).find(o=>o?.id===t)||null}function FF(e){return e?jA(VF(e),e.baseUrl):!1}function wA(e){const t=Array.isArray(e?.providers)?e.providers:[],a=Array.isArray(e?.accounts)?e.accounts:[],o=new Map;a.forEach(d=>{const f=kn(d);o.set(f,(o.get(f)||0)+1)});const c=new Map;return t.forEach(d=>{d?.id&&c.set(String(d.id),{id:String(d.id),label:String(d.label||d.id),count:Number(d.count)||0})}),o.forEach((d,f)=>{c.has(f)||c.set(f,{id:f,label:Pe().wbProviders?.labelOf?.(f)||f,count:d})}),c.size||c.set(iu,{id:iu,label:Pe().wbProviders?.labelOf?.(iu)||"WorkBuddy 国内版",count:0}),[...c.values()]}function Fh(e){const t=ir(kn(e)).identifier;return String(e?.[t]||"")}function SA(e){const t=Number(e)||0;return t<=0?0:t<1e11?t*1e3:t}function $F(e){const t=ir(kn(e)).expiry;return SA(e?.[t])}function Ta(e){const t=kn(e);return t.startsWith("custom-")?!!e?.balanceQuery?.scheme:ir(t).usage}const lj=30,NA=86400,kA=60,CA=1800,TA=86400,EA=1,qF=95e5;function GF(e){return e==="codearts"?[{type:"token",action:"skip",threshold:qF,reset:"daily",enabled:!0}]:e==="cline-free"?[]:[{type:"balance",action:"skip",threshold:EA,enabled:!0}]}function AA(e){const t=e?.usageQuery;if(!t||typeof t!="object")return{enabled:!0,interval:kA};const a=t.enabled===void 0?!0:t.enabled===!0,o=Number(t.interval)||0,c=o>=lj&&o<=NA;return{enabled:a,interval:a&&!c?kA:o}}function KF(e){if(!e||typeof e!="object")return!1;const t=e;if(t.type!=="balance"&&t.type!=="token"||t.action!=="skip"&&t.action!=="disable")return!1;const a=Number(t.threshold);if(!Number.isFinite(a)||a<=0)return!1;if(t.type==="token"&&t.reset!=="daily"){const o=Number(t.period);if(!Number.isInteger(o)||oTA)return!1}return!0}function YF(e){const t=e?.lowBalance;if(!t||typeof t!="object"||!t.mode)return GF(kn(e));const a=Number(t.threshold),o=Number.isFinite(a)&&a>0?a:EA;return t.mode!=="skip"&&t.mode!=="disable"?[]:[{type:"balance",action:t.mode,threshold:o,enabled:!0}]}function cu(e){const t=e?.limiters;return Array.isArray(t)?t.filter(KF):YF(e)}function XF(e){return cu(e).filter(t=>t.type==="token")}function QF(e,t){const a=t*1e3;return e-e%a}function RA(e){return e.reset==="daily"?0:e.period??0}function oj(e,t=Date.now()){if(e===0){const a=new Date(t);return a.setHours(0,0,0,0),a.getTime()}return QF(t,e)}function xf(e,t,a=Date.now()){if(e.type!=="token")return null;const o=RA(e),c=(t||[]).find(d=>Number(d.kind)===o);return c&&Number(c.windowStart)===oj(o,a)?c:null}function $h(e,t){const a=cu(e).filter(f=>f.type==="balance"&&f.action==="skip"&&f.enabled!==!1&&f.threshold>0);if(!a.length||!t||typeof t!="object")return!1;const o=t;if(o.unlimited)return!1;const c=o.totalLeft??o.available;if(c==null||c==="")return!1;const d=Number(c);return Number.isFinite(d)&&a.some(f=>dc.type==="token"&&c.action==="skip"&&c.enabled!==!1);if(!a.length||!t?.length)return!1;const o=Date.now();return a.some(c=>{const d=xf(c,t,o);return d!==null&&Number(d.used)>=c.threshold})}function ZF(e,t){return cu(e).some(a=>{if(a.type!=="token"||a.action!=="disable"||a.enabled===!1)return!1;const o=xf(a,t);return o!==null&&Number(o.used)>=a.threshold})}function cj(e,t=Date.now()){const a=RA(e),o=oj(a,t),c=a===0?Math.max(0,oj(0,o+864e5+36e5)-t):Math.max(0,o+a*1e3-t);return{kind:a,startMs:o,remainingMs:c,daily:a===0}}function qh(e,t){if(e<=0)return"";const a=Math.ceil(e/6e4);if(t){const o=Math.ceil(e/36e5);return o>=1?r("今日剩 {n} 小时",{n:o}):r("今日剩 {n} 分钟",{n:a})}return a>=1?r("剩 {n} 分钟",{n:a}):r("剩不到 1 分钟")}function Tl(e){const t=Number(e);if(!Number.isFinite(t))return"—";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(Math.round(t))}function OA(e){return e>0&&e%3600===0?r("{n} 小时",{n:e/3600}):e>0&&e%60===0?r("{n} 分钟",{n:e/60}):r("{n} 秒",{n:e})}function bf(e){return e?.desktop===!0}function MA(e){return e?.chatSupported!==!1}function WF(e){return typeof e=="string"&&e.startsWith("custom-")}function JF(e){return r(e==="enterprise"?"企业":e==="ultimate"?"旗舰":"个人")}function Gh(e,t){const a=Number(e?.priority??100)-Number(t?.priority??100);return a!==0?a:(Number(e?.addedAt)||0)-(Number(t?.addedAt)||0)}function cr(e){return e?.enabled!==!1}function vf(e,t=""){const a=e?.rateLimits||{},o=Date.now();return t?Number(a[t]?.resetAt)>o:Object.values(a).some(c=>Number(c?.resetAt)>o)}function DA(e){return e?.edition==="intl"?"intl":"cn"}function IA(e){return ir(kn(e)).claim?e?.canClaim!==!1:!1}const PA="coding-plan",wo="start-plan";function Kh(e){return!!ir(kn(e)).planChannel}function uj(e){return Kh(e)?String(e?.zcodePlan||"").trim()===wo?wo:PA:""}function e$(e){return r(e===wo?"活动套餐(Start Plan)":"编码套餐(Coding Plan)")}function _A(e){switch(String(e??"").trim()){case"pending":return r("待生效");case"active":return r("生效中");case"expired":return r("已过期");case"unknown":return r("状态未知");default:return String(e??"")}}function Yh(e){const t=e?.claimPlans;if(!t||typeof t!="object"||Array.isArray(t))return[];const a=dj();return Object.entries(t).filter(([,o])=>Number(o)>0&&dj(Number(o))===a).map(([o])=>o)}function t$(e){return Yh(e).length>0}function n$(e){const t=Yh(e),a=t.length?r("({plans})",{plans:t.join(r("、"))}):"";return r("今天(北京时间 {day})已领取 {n} 份{names};还有其他可领套餐时,点这里可以继续领;活动按自然日发新套餐,明天可再领",{day:dj(),n:t.length,names:a})}function s$(e){return!!ir(kn(e)).usageDetail}function LA(e){return!!ir(kn(e)).creditDetail}function zA(e){return/^free$/i.test(String(e??"").trim())}function r$(e){const t=String(e??"").trim();return/^trial$/i.test(t)?r("试用版"):zA(t)?r("免费版"):t}function dj(e=Date.now()){return new Date(e+8*3600*1e3).toISOString().slice(0,10)}function yf(e,t,a){return vf(e)||$h(e,t)||ij(e,a)}function BA(e,t){const a=String(t.q||"").trim().toLowerCase();return a?[uu(e),e?.name,e?.nickname,e?.email,Fh(e),e?.id].some(c=>String(c||"").toLowerCase().includes(a)):!0}function HA(e,t){return t.provider==="all"||kn(e)===t.provider}function fj(e,t){return t.enabled==="all"?!0:t.enabled==="enabled"?cr(e):!cr(e)}function UA(e,t,a,o){if(t.limit==="all")return!0;if(!cr(e))return!1;const c=yf(e,a?.(e),o?.(e));return t.limit==="limited"?c:!c}function VA(e,t,a,o){return HA(e,t)&&fj(e,t)&&UA(e,t,a,o)&&BA(e,t)}function a$(e,t,a,o){return(e||[]).filter(c=>VA(c,t,a,o))}function FA(e,t,a,o){const c=e||[],d=h=>c.filter(v=>HA(v,t)&&(h==="enabled"||fj(v,t))&&BA(v,t)),f=d("enabled"),p=d("limit");return{enabledAll:f.length,enabled:f.filter(cr).length,disabled:f.filter(h=>!cr(h)).length,limitAll:p.length,normal:p.filter(h=>cr(h)&&!yf(h,a?.(h),o?.(h))).length,limited:p.filter(h=>cr(h)&&yf(h,a?.(h),o?.(h))).length}}function pj(e){const t=e?.rateLimits;if(!t||typeof t!="object")return[];const a=Date.now();return Object.entries(t).map(([o,c])=>({model:o,...c&&typeof c=="object"?c:{}})).filter(o=>Number(o.resetAt)>a).sort((o,c)=>Number(o.resetAt)-Number(c.resetAt))}function mj(e){const t=(e||[]).slice().sort(Gh),a=new Map;return t.forEach((o,c)=>a.set(o.id,{position:c+1,total:t.length})),a}function l$(e,t,a,o){const c=(e||[]).slice().sort(Gh),d=[],f=new Map;for(const p of c){const h=kn(p);f.has(h)||(f.set(h,[]),d.push(h)),f.get(h).push(p)}return d.map((p,h)=>{const v=f.get(p)||[];return{provider:p,label:Pe().wbProviders?.labelOf?.(p)||p,rank:h+1,members:v,accounts:t?v.filter(t):v,enabled:v.filter(cr).length,disabled:v.filter(y=>!cr(y)).length,limited:v.filter(y=>cr(y)&&yf(y,a?.(y),o?.(y))).length}})}function uu(e){if(!e)return"";const t=String(e.name||"").trim();if(e.nameCustom===!0&&t)return t;const a=String(e.email||"").trim();return ir(kn(e)).emailAsName&&a?a:e?.nickname||t||Fh(e)||e?.id||""}const hj="已限流",$A=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function gj(e){const t=Number(e);if(!Number.isFinite(t)||t<=0||t<=Date.now())return hj;const a=new Date(t),o=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",hour12:!1}),c=Math.round(($A(a)-$A(new Date))/864e5);return c===0?r("今天 {clock}",{clock:o}):c===1?r("明天 {clock}",{clock:o}):r("{month}月{day}日 {clock}",{month:a.getMonth()+1,day:a.getDate(),clock:o})}function o$(e){const t=kn(e);if(!ir(t).edition)return"";const a=DA(e),o=e?.editionLabel,c=o||(a==="intl"?"国际版":"国内版");return(Pe().wbProviders?.labelOf?.(t)||"").includes(c)?"":o||r(a==="intl"?"国际版":"国内版")}function i$(e){return[MA(e)?null:{text:r("仅账号管理"),kind:"plain",title:r("该提供商的推理转发尚未接入,账号不参与转发")},WF(kn(e))&&e.hasCredentials===!1?{text:r("未配置凭证"),kind:"bad",title:r("这条自定义账号既没有 API Key,也没有勾选「无需鉴权」:转发时会被跳过,该提供商下的模型也不会出现在模型列表里。去账号「设置」里补上 Key,或勾选「该上游无需鉴权」")}:null,e.proxy?.error?{text:r("代理异常"),kind:"bad",title:r("{error}(转发时会回退直连)",{error:e.proxy.error})}:null,uj(e)===wo?{text:r("活动套餐"),kind:"plain",title:r("转发走活动套餐通道(zcode.z.ai 的 Anthropic 端点,用账号里领到的额度);在账号设置里可切回编码套餐")}:null].filter(t=>t!==null)}const qA="workbuddy-desktop-accounts-filters",GA="workbuddy-desktop-accounts-collapsed",KA="workbuddy-desktop-accounts-names-hidden";function c$(){const e={provider:"all",enabled:"all",limit:"all",q:""},t=Pe().wbFilterMemory?.load(qA,e)||e;return{provider:String(t.provider||"all"),enabled:String(t.enabled||"all"),limit:String(t.limit||"all"),q:""}}function u$(){try{const e=JSON.parse(localStorage.getItem(GA)||"[]");return new Set(Array.isArray(e)?e.map(t=>String(t)).filter(Boolean):[])}catch{return new Set}}function d$(){try{return localStorage.getItem(KA)==="1"}catch{return!1}}let pn={version:0,filter:c$(),collapsed:u$(),selected:new Set,panels:new Map,connections:new Map,clash:null,dialog:null,namesHidden:d$(),usageBusy:!1,usageInflight:new Set};const xj=new Set;function YA(e){return xj.add(e),()=>{xj.delete(e)}}function Ws(){return pn}function Cn(e){pn={...pn,...e,version:pn.version+1},xj.forEach(t=>t())}function vr(){Cn({})}function bj(){return Pe().wbApp?.getState?.()?.accounts}function El(){const e=bj()?.accounts;return Array.isArray(e)?e:[]}function Ea(e){return El().find(t=>t.id===e)||null}function f$(e,t){const a=l$(El(),c=>VA(c,pn.filter,e,t),e,t);return{groups:a.filter(c=>c.accounts.length>0),allGroups:a}}function XA(){return wA(bj())}function p$(e,t){return FA(El(),pn.filter,e,t)}function m$(){return mj(El())}function Xh(){Pe().wbFilterMemory?.save(qA,{provider:pn.filter.provider,enabled:pn.filter.enabled,limit:pn.filter.limit})}function h$(e){pn.filter.q!==e&&Cn({filter:{...pn.filter,q:e}})}function g$(e){const t=e||"all";pn.filter.provider!==t&&(Cn({filter:{...pn.filter,provider:t}}),Xh())}function QA(e,t){const a={...pn.filter,[e]:t};a.enabled==="disabled"&&a.limit!=="all"&&(a.limit="all"),Cn({filter:a}),Xh()}function Qh(){return pn.filter.provider!=="all"||pn.filter.enabled!=="all"||pn.filter.limit!=="all"||pn.filter.q.trim()!==""}function ZA(){Cn({filter:{provider:"all",enabled:"all",limit:"all",q:""}}),Xh()}function x$(){const e=pn.filter.provider;e!=="all"&&(XA().some(t=>t.id===e)||(Cn({filter:{...pn.filter,provider:"all"}}),Xh()))}function WA(e){try{localStorage.setItem(GA,JSON.stringify([...e]))}catch{}}function JA(e){const t=new Set(pn.collapsed);t.has(e)?t.delete(e):t.add(e),WA(t),Cn({collapsed:t})}function b$(e,t){const a=new Set(pn.collapsed);for(const o of e)t?a.add(o):a.delete(o);WA(a),Cn({collapsed:a})}function v$(e){return pn.selected.has(e)}function y$(e,t){const a=new Set(pn.selected);t?a.add(e):a.delete(e),Cn({selected:a})}function eR(e,t){const a=new Set(pn.selected);for(const o of e)t?a.add(o):a.delete(o);Cn({selected:a})}function j$(){Cn({selected:new Set})}function tR(e,t){return pn.panels.get(e)?.has(t)===!0}function nR(e,t,a){if(!e)return;const o=new Map(pn.panels),c=new Set(o.get(e)||[]);a?c.add(t):c.delete(t),c.size?o.set(e,c):o.delete(e),Cn({panels:o})}function w$(e,t){const a=new Map(pn.panels);for(const o of e){const c=new Set(a.get(o)||[]);c.add(t),a.set(o,c)}Cn({panels:a})}function S$(){const e=!pn.namesHidden;try{localStorage.setItem(KA,e?"1":"0")}catch{}Cn({namesHidden:e})}function N$(e){return"*".repeat(Math.min(Math.max(e.length,4),12))}const sR="usage_not_configured",So=new Map,jf=new Map;function oa(e,t,a){So.set(e,t),t!=null&&du(t)?jf.set(e,a):jf.delete(e)}function Za(e){const t=So.get(e.id);if(t===void 0)return;if(!du(t))return t;const a=Math.max(Number(e.addedAt)||0,Number(e.updatedAt)||0);return(jf.get(e.id)||0)>=a?t:void 0}const wf=new Map;let rR=0;function Al(e){return e?wf.get(e.id)||[]:[]}function k$(e){const t=Number(e?.tokenAt)||0;if(!t||t===rR)return!1;const a=e?.tokenUsage;if(!a||typeof a!="object")return!1;rR=t;const o=new Map;for(const[d,f]of Object.entries(a)){if(!Array.isArray(f))continue;const p=[];for(const h of f){if(!h||typeof h!="object")continue;const v=Number(h.kind),y=Number(h.windowStart),b=Number(h.used);!Number.isFinite(v)||v<0||!Number.isFinite(y)||y<=0||!Number.isFinite(b)||b<0||p.push({kind:v,windowStart:y,used:b})}o.set(d,p)}const c=o.size!==wf.size||[...o].some(([d,f])=>{const p=wf.get(d);return!p||p.length!==f.length||f.some((h,v)=>h.used!==p[v]?.used||h.windowStart!==p[v]?.windowStart)});wf.clear();for(const[d,f]of o)wf.set(d,f);return c}let Zh=null;async function aR(e={}){const t=Ws().clash;if(!e.force&&t)return t;Zh||(Zh=(async()=>{try{const o=await Pe().workbuddyDesktop?.getProxies?.();if(!o||typeof o!="object"||!o.clash)throw new Error(r("代理列表响应异常({type})",{type:typeof o}));return o.clash}finally{Zh=null}})());const a=await Zh;return Cn({clash:a}),a}function C$(){Cn({clash:null})}let Sf=null,Wh=null;function T$(){return Sf}async function lR(e={}){if(!e.force&&Sf)return Sf;Wh||(Wh=(async()=>{try{const a=await Pe().workbuddyDesktop?.getProxyPool?.();if(!a||typeof a!="object"||!Array.isArray(a.items))throw new Error(r("代理池响应异常({type})",{type:typeof a}));return a.items}finally{Wh=null}})());const t=await Wh;return Sf=t,t}let vj=null;function E$(){return vj}let Jh=0,oR=!1;function A$(){if(!(Sf||Date.now(){Jh=0,vj=null,vr()}).catch(e=>{vj=ut(e),vr()})}}function eg(e){if(!Ea(e)){_e(r("账号不存在,请刷新后重试"),"err");return}Cn({dialog:{kind:"settings",id:e}})}function tg(){Cn({dialog:null})}function yj(e,t="enable"){const a=(Array.isArray(e)?e:[]).filter(o=>Ea(o));if(!a.length){_e(r("请先勾选要操作的账号"),"err");return}Cn({dialog:{kind:"batch",ids:a,action:t}})}function R$(e){let t=!1;for(const f of[...So.keys()])e.has(f)||(So.delete(f),t=!0);for(const f of[...jf.keys()])e.has(f)||jf.delete(f);const a=new Map(Ws().panels);for(const f of[...a.keys()])e.has(f)||(a.delete(f),t=!0);const o=new Map(Ws().connections);for(const f of[...o.keys()])e.has(f)||(o.delete(f),t=!0);const c=new Set(Ws().usageInflight);for(const f of[...c])e.has(f)||(c.delete(f),t=!0);const d=new Set(Ws().selected);for(const f of[...d])e.has(f)||(d.delete(f),t=!0);t&&Cn({panels:a,connections:o,usageInflight:c,selected:d})}const O$=2e3;function iR(e){return Ws().connections.get(e)||0}async function cR(){try{const e=await Pe().workbuddyDesktop?.getAccountConnections?.(),t=e?.counts&&typeof e.counts=="object"?e.counts:{},a=new Map;for(const[o,c]of Object.entries(t)){const d=Number(c)||0;d>0&&a.set(o,d)}return Cn({connections:a}),!0}catch{return!1}}let uR=null;function M$(){uR||(uR=setInterval(()=>{document.hidden||Pe().wbApp?.currentPage!=="accounts"||cR()},O$))}function jj(){return El().filter(e=>Ta(e)&&e.available!==!1)}function du(e){if(e==null)return null;if(typeof e=="string")return{message:e,notConfigured:!1};if(typeof e!="object")return null;const t=e.error;return t?{message:String(t),notConfigured:e.code===sR}:null}function dR(e){return e.usage?e.usage:{error:e.error?String(e.error):r("余额响应为空"),code:e.code}}function fR(e){const t=Array.isArray(e?.results)?e.results:[],a=Number(e?.at)||Date.now();let o=0;for(const c of t)c?.id&&(oa(String(c.id),dR(c),Number(c.at)||a),o++);return o&&(vr(),Pe().wbApp?.renderTopbarStatus?.()),o}let pR=!1;function D$(e){if(!LA(e))return!1;const t=Za(e);return!t||typeof t!="object"||Array.isArray(t)||du(t)?!1:!Array.isArray(t.credits)}async function I$(){if(!pR){pR=!0;for(const e of El().filter(D$)){const t=So.get(e.id);try{await Nf(e.id)}catch{}const a=So.get(e.id);t!==void 0&&(!a||du(a))&&oa(e.id,t,Date.now()),vr()}}}let mR=0;async function P$(){try{const e=await Pe().workbuddyDesktop?.getBalancesSnapshot?.(),t=k$(e);t&&(vr(),Pe().wbApp?.renderTopbarStatus?.());const a=Number(e?.at)||0;return!a||a===mR||(mR=a,!fR(e))?t:(I$(),!0)}catch{return!1}}async function Nf(e){const t=await Pe().workbuddyDesktop?.getAllBalances?.(e||void 0),a=Array.isArray(t?.results)?t.results:[],o=Date.now(),c=new Set;for(const d of a){if(!d?.id)continue;const f=String(d.id);e&&f!==e||(c.add(f),oa(f,dR(d),o))}if(e)return c.has(e)||oa(e,r("未返回余额数据"),o),vr(),t;for(const d of jj())c.has(d.id)||oa(d.id,r("未返回余额数据"),o);return vr(),t}async function hR(){if(Ws().usageBusy)return;const e=jj();if(!e.length){_e(r("暂无可查询余额的账号"),"err");return}Cn({usageBusy:!0}),e.forEach(t=>oa(t.id,null,Date.now())),vr();try{const t=(await Nf(null))?.results||[],a=t.filter(f=>f.usage).length,o=t.filter(f=>f.code===sR).length,c=o?r("({n} 个未配置查询凭证)",{n:o}):"",d=t.length-a-o;_e(a+o===t.length?r("✅ 已更新 {n} 个账号的余额{suffix}",{n:a,suffix:c}):r("已更新 {ok}/{total} 个账号,{failed} 个失败",{ok:a,total:t.length,failed:d}),d?"err":"ok")}catch(t){const a=ut(t);e.forEach(o=>oa(o.id,r("查询失败:{message}",{message:a}),Date.now())),vr(),_e(r("余额查询失败:{message}",{message:a}),"err")}finally{Cn({usageBusy:!1})}}async function gR(e){if(Ws().usageInflight.has(e))return;const t=new Set(Ws().usageInflight);t.add(e),oa(e,null,Date.now()),Cn({usageInflight:t});try{await Nf(e)}finally{const a=new Set(Ws().usageInflight);a.delete(e),Cn({usageInflight:a})}}async function _$(e){if(!Ws().usageInflight.has(e))try{await gR(e);const t=du(So.get(e));t?.notConfigured?_e(t.message,"ok"):t?_e(r("余额查询失败:{message}",{message:t.message}),"err"):_e(r("✅ 已更新余额"))}catch(t){oa(e,r("查询失败:{message}",{message:ut(t)}),Date.now()),vr(),_e(r("余额查询失败:{message}",{message:ut(t)}),"err")}}async function ng(e){if(e){const a=Ea(e);if(!a||!Ta(a))return;try{await gR(e)}catch(o){oa(e,r("查询失败:{message}",{message:ut(o)}),Date.now()),vr()}return}if(Ws().usageBusy)return;const t=jj();if(t.length){Cn({usageBusy:!0}),t.forEach(a=>oa(a.id,null,Date.now())),vr();try{await Nf(null)}catch(a){const o=ut(a);t.forEach(c=>oa(c.id,r("查询失败:{message}",{message:o}),Date.now())),vr()}finally{Cn({usageBusy:!1})}}}async function xR(e,t){try{await Pe().workbuddyDesktop?.updateAccount?.(e,{enabled:t}),await Pe().wbApp?.refresh?.(),_e(r(t?"✅ 已启用":"✅ 已禁用"))}catch(a){_e(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function bR(e,t){if(!e.length)return!1;try{return await Pe().workbuddyDesktop?.reorderAccounts?.(e),_e(t?r("✅ 已保存:{note}",{note:t}):r("✅ 顺序已保存")),await Pe().wbApp?.refresh?.(),!0}catch(a){return _e(r("顺序未保存:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.(),!1}}async function vR(e,t){if(e.length)try{await Pe().workbuddyDesktop?.batchAccounts?.({action:t?"enable":"disable",ids:e}),_e(t?r("✅ 已启用 {n} 个账号",{n:e.length}):r("✅ 已禁用 {n} 个账号",{n:e.length})),await Pe().wbApp?.refresh?.()}catch(a){_e(r("操作失败:{message}",{message:ut(a)}),"err"),Pe().wbApp?.refresh?.()}}async function L$(e,t){try{await Pe().workbuddyDesktop?.clearRateLimits?.(e,t||null),_e(t?r("✅ 已清除 {model} 的限流标记",{model:t}):r("✅ 已清除该账号全部限流标记")),await Pe().wbApp?.refresh?.()}catch(a){_e(r("清除失败:{message}",{message:ut(a)}),"err")}}async function z$(e,t,a){if(t===yR){eg(e);return}if(t!==sg&&t!==a)try{const o=t===""?null:{source:"pool",proxyId:t.slice(Xa.length)},d=(await Pe().workbuddyDesktop?.updateAccount?.(e,{proxy:o}))?.changes,f=Array.isArray(d)&&d.length?d[0]:r("代理已更新");_e(`✅ ${f}`)}catch(o){_e(r("保存失败:{message}",{message:ut(o)}),"err")}finally{await Pe().wbApp?.refresh?.()}}const sg="__proxy_custom__",yR="__proxy_custom_edit__";function jR(e,t){const a=Ea(e);if(!a){_e(r("账号不存在,请刷新后重试"),"err");return}const o=Pe().wbZcodePlans;if(!o?.open){_e(r("套餐明细弹窗未加载,请重启应用后重试"),"err");return}o.open({id:e,name:t||a.name})}function B$(e,t,a=1){return{seat:t.get(e.id)||{position:1,total:1},rank:a,picked:v$(e.id),usageEntry:So.get(e.id),limitsOpen:tR(e.id,"limits"),connections:iR(e.id)}}const H$={DEFAULT_PROVIDER_ID:iu,RACCOON_PROVIDER_ID:LF,providerOf:kn,providerFeatures:ir,providerSummaries:wA,identifierOf:Fh,tokenExpiryOf:$F,supportsUsage:Ta,isDesktopAccount:bf,supportsChat:MA,byPriorityOrder:Gh,typeLabel:JF,isEnabled:cr,isRateLimited:vf,isLimited:e=>yf(e,e?Za(e):void 0,Al(e)),accountEdition:DA,supportsClaim:IA,matchEnabled:fj,matchLimit:UA,visibleAccounts:a$,filterCounts:FA,positionMap:mj,activeLimits:pj,editionSuffix:o$,formatResetText:gj};function U$(){window.wbAccountsView={render:()=>vr(),refreshCaches:R$,openPanels:w$,syncConnections:cR,applyBalances:fR,syncBalancesSnapshot:P$,queryUsageFor:Nf,queryAllUsage:hR,refreshUsageAfterCheckin:ng,supportsUsage:Ta,isDesktopAccount:bf,isEnabled:cr,isRateLimited:vf},window.wbAccountsModel=H$,window.wbAccountPanel={open:eg,close:tg,openBatch:yj,closeBatch:tg,syncAddProvider:()=>Pe().wbAccountAddForms?.syncAddProvider?.(),invalidate:C$}}function V$(e){return e.type==="balance"?r("余额 < {threshold}",{threshold:e.threshold}):e.reset==="daily"?r("每日消耗 ≥ {count} Token(每天 0 点重置)",{count:Tl(e.threshold)}):r("每 {period}消耗 ≥ {count} Token",{period:OA(e.period??0),count:Tl(e.threshold)})}function F$(e){return e.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(自动恢复)")}function $$(e){return`${Math.round(e.threshold).toLocaleString("en-US")} Token`}function q$(e,t){if(t.enabled===!1)return{text:r("已停用"),kind:"off"};if(t.type==="balance"){const v=Za(e),y=$h(e,v),b=v&&typeof v=="object"?v:null,j=b?b.totalLeft??b.available:void 0,w=j==null||j===""||b?.unlimited?"":r(" · 当前 {n}",{n:Number(j)});return y?{text:r("已跳过{current}",{current:w}),kind:"warn",title:r("余额低于阈值,转发时会跳过该账号(余额回升自动恢复)")}:{text:r("未触发{current}",{current:w}),kind:"ok"}}const a=Al(e),o=xf(t,a),c=o?o.used:0,d=Tl(t.threshold),f=t.reset==="daily"?r(" · 今日 {used} / {quota}",{used:Tl(c),quota:d}):r(" · 本周期 {used} / {quota}",{used:Tl(c),quota:d}),p=o?` · ${qh(cj(t).remainingMs,t.reset==="daily")}`:"";return o!==null&&c>=t.threshold?t.action==="disable"?e.enabled===!1?{text:r("已触发 · 账号已禁用"),kind:"danger",title:r("重置也不恢复,需手动启用")}:{text:r("已达上限{usage}",{usage:f}),kind:"warn",title:r("稍后由后台判定自动禁用")}:{text:r("已跳过{usage}{countdown}",{usage:f,countdown:p}),kind:"warn",title:r("窗口内已用 {used} / {limit} Token,转发时会跳过该账号(重置后自动恢复)",{used:Math.round(c).toLocaleString("en-US"),limit:Math.round(t.threshold).toLocaleString("en-US")})}:{text:r("未触发{usage}{countdown}",{usage:f,countdown:p}),kind:"ok",title:$$(t)}}function G$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:{value:"1",unit:"hours"}}function wR(e){const t={type:"balance",action:"skip",thresholdInput:"",tokenUnit:"wan",reset:"fixed",periodInput:"1",periodUnit:"hours"};if(!e)return t;if(e.type==="balance")return{...t,type:"balance",action:e.action,thresholdInput:String(e.threshold)};if(e.reset==="daily")return{...t,type:"token",action:e.action,reset:"daily",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit"};const a=G$(e.period??0);return{...t,type:"token",action:e.action,reset:"fixed",thresholdInput:String(e.threshold%1e4===0?e.threshold/1e4:e.threshold),tokenUnit:e.threshold%1e4===0?"wan":"unit",periodInput:a.value,periodUnit:a.unit}}function SR(e){const t=Number(e.thresholdInput);if(!Number.isFinite(t)||t<=0)return{error:r("限制阈值必须是大于 0 的数字")};if(e.type==="balance")return{rule:{type:"balance",action:e.action,threshold:t,enabled:!0}};const a=Math.round(e.tokenUnit==="wan"?t*1e4:t);if(e.reset==="daily")return{rule:{type:"token",action:e.action,threshold:a,reset:"daily",enabled:!0}};const o=Number(e.periodInput)*(e.periodUnit==="hours"?3600:60);if(!Number.isFinite(o)||o<=0)return{error:r("请填写重置周期")};const c=Math.round(o);return cTA?{error:r("重置周期必须是 30 分钟 ~ 24 小时")}:{rule:{type:"token",action:e.action,threshold:a,period:c,reset:"fixed",enabled:!0}}}function K$({account:e,target:t,onClose:a,onSave:o}){const[c,d]=x.useState(""),[f,p]=x.useState(t?.draft??null);if(x.useEffect(()=>{p(t?.draft??null),d("")},[t]),!t||!f)return null;const h=b=>{d(""),p({...f,...b})},v=()=>{const b=SR(f);if("error"in b){d(b.error);return}o(b.rule,t.index)},y=()=>{if(f.type==="balance"){const D=Za(e);if(D&&typeof D=="object"){const C=D;if(C.unlimited)return r("当前可用 ∞(不参与余额不足判定)");const A=C.totalLeft??C.available;if(A!=null&&A!=="")return r("当前余额 {n};与余额列同一数字口径,严格小于才触发(等于阈值仍可用)",{n:Number(A)})}return r("读数来自自动余额查询;与余额列同一数字口径,严格小于才触发(等于阈值仍可用)")}const b=SR(f);if(!("rule"in b))return"";const j=b.rule,w=xf(j,Al(e));if(!w)return j.reset==="daily"?r("窗口 = 今天 0 点起(本地时区),0 点重置即清零恢复;按账号在 requests 表聚合"):r("窗口对齐自然时间(整点 / 整 N 分钟一轮回),重置即清零恢复;按账号在 requests 表聚合");const k=cj(j),S=Tl(w.used),N=Tl(j.threshold),T=j.reset==="daily"?r("今日已用"):r("本周期已用");return r("{scope} {used} / {quota} Token,{countdown}重置",{scope:T,used:S,quota:N,countdown:qh(k.remainingMs,k.daily)})};return s.jsx(Qt,{open:!0,onOpenChange:b=>{b||a()},children:s.jsxs(Zt,{className:"w-[min(580px,calc(100vw-48px))]",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t.index>=0?r("编辑限制"):r("添加限制")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("限制类型")}),s.jsxs(ft,{value:f.type,onValueChange:b=>h({type:b,thresholdInput:""}),children:[s.jsx(mt,{className:"w-[150px]","aria-label":r("限制类型"),children:s.jsx(pt,{children:f.type==="balance"?r("余额"):r("Token 消耗")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"balance",children:r("余额")}),s.jsx(qe,{value:"token",children:r("Token 消耗")})]})]}),s.jsx("span",{className:"detail",children:r("余额沿用现有口径;Token 按重置方式内的累计消耗判定(切换类型会清空阈值)")})]}),f.type==="balance"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("余额低于")}),s.jsx(Fe,{type:"number",min:0,step:1,className:"max-w-[120px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:b=>h({thresholdInput:b.currentTarget.value})}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("时")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:b=>h({action:b}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(余额回升自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(余额回升自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("重置方式")}),s.jsxs(ft,{value:f.reset,onValueChange:b=>h({reset:b}),children:[s.jsx(mt,{className:"w-[190px]","aria-label":r("重置方式"),children:s.jsx(pt,{children:f.reset==="daily"?r("自然日(每天 0 点)"):r("固定周期")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"fixed",children:r("固定周期")}),s.jsx(qe,{value:"daily",children:r("自然日(每天 0 点)")})]})]}),s.jsx("span",{className:"detail",children:r("有的账号过了 0 点额度就回来 —— 选「自然日」")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发条件")}),f.reset==="daily"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每日消耗 ≥")}),s.jsx(Fe,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:b=>h({thresholdInput:b.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:b=>h({tokenUnit:b}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"detail",style:{fontSize:13},children:r("每")}),s.jsx(Fe,{type:"number",min:1,step:1,className:"max-w-[90px]",placeholder:r("周期"),value:f.periodInput,onChange:b=>h({periodInput:b.currentTarget.value})}),s.jsxs(ft,{value:f.periodUnit,onValueChange:b=>h({periodUnit:b}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("周期单位"),children:s.jsx(pt,{children:f.periodUnit==="hours"?r("小时"):r("分钟")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("内消耗 ≥")}),s.jsx(Fe,{type:"number",min:0,step:1,className:"max-w-[110px]",placeholder:r("阈值"),value:f.thresholdInput,onChange:b=>h({thresholdInput:b.currentTarget.value})}),s.jsxs(ft,{value:f.tokenUnit,onValueChange:b=>h({tokenUnit:b}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("Token 单位"),children:s.jsx(pt,{children:f.tokenUnit==="wan"?r("万"):r("个")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"wan",children:r("万")}),s.jsx(qe,{value:"unit",children:r("个")})]})]}),s.jsx("span",{className:"detail",style:{fontSize:13},children:r("Token 时")})]})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("触发后")}),s.jsxs(ft,{value:f.action,onValueChange:b=>h({action:b}),children:[s.jsx(mt,{className:"min-w-[280px]","aria-label":r("触发动作"),children:s.jsx(pt,{children:f.action==="disable"?r("禁用该账号(需手动重新启用)"):r("跳过该账号(重置后自动恢复)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"skip",children:r("跳过该账号(重置后自动恢复)")}),s.jsx(qe,{value:"disable",children:r("禁用该账号(需手动重新启用)")})]})]})]})]}),s.jsx("p",{className:"detail limiter-hint",children:y()}),c?s.jsx("p",{className:"detail text-destructive",children:c}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:v,children:t.index>=0?r("保存规则"):r("添加规则")})]})]})})}function Y$({account:e,draft:t,onChange:a}){const[o,c]=x.useState(null),d=()=>c({index:-1,draft:wR(null)}),f=y=>c({index:y,draft:wR(t[y])}),p=(y,b)=>{const j=[...t];b>=0?j[b]=y:j.push(y),a(j),c(null)},h=y=>{a(t.filter((b,j)=>j!==y)),o&&c(null)},v=(y,b)=>{const j=[...t];j[y]={...j[y],enabled:b},a(j)};return s.jsxs(s.Fragment,{children:[t.length?s.jsx("div",{className:"limiter-rules mt-2.5",children:t.map((y,b)=>{const j=q$(e,y);return s.jsxs("div",{className:"limiter-rule","data-off":y.enabled===!1||void 0,children:[s.jsx(us,{checked:y.enabled!==!1,"aria-label":r("启用该规则"),onCheckedChange:w=>v(b,w===!0)}),s.jsx("div",{className:"limiter-rule-main",children:s.jsxs("span",{className:"limiter-rule-cond",children:[s.jsx(ze,{variant:"secondary",shape:"tag",children:y.type==="balance"?r("余额"):"Token"})," ",r("{cond} 时 → {action}",{cond:V$(y),action:F$(y)})]})}),s.jsx(ze,{variant:j.kind==="ok"?"success":j.kind==="warn"?"warning":j.kind==="danger"?"destructive":"secondary",shape:"tag",title:j.title,children:j.text}),s.jsxs("div",{className:"limiter-rule-ops",children:[s.jsx(se,{variant:"ghost",onClick:()=>f(b),children:r("编辑")}),s.jsx(se,{variant:"ghost",onClick:()=>h(b),children:r("删除")})]})]},b)})}):s.jsx("p",{className:"detail mt-2.5",children:r("还没有限制规则:账号照常参与转发,余额与 Token 消耗都不设上限。")}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx(se,{variant:"outline",onClick:d,children:r("+ 添加限制")}),s.jsx("span",{className:"detail",children:r("可添加多条;同类规则也允许并存(例如一条按余额、两条不同重置方式的 Token)")})]}),s.jsx(K$,{account:e,target:o,onClose:()=>c(null),onSave:p})]})}function X$(e,t){const a=cu(e);return JSON.stringify(t)===JSON.stringify(a)?null:{patch:{limiters:t}}}function Q$(e){return cu(e).map(t=>({...t}))}const Z$={seconds:1,minutes:60,hours:3600};function W$(e){return e>0&&e%3600===0?{value:String(e/3600),unit:"hours"}:e>0&&e%60===0?{value:String(e/60),unit:"minutes"}:e>0?{value:String(e),unit:"seconds"}:{value:"5",unit:"minutes"}}function J$(e){const{enabled:t,interval:a}=AA(e),o=W$(t?a:0);return{enabled:t,intervalInput:o.value,unit:o.unit}}function e8(e,t){const a=Math.round(Number(t.intervalInput)*Z$[t.unit]);if(t.enabled){if(!Number.isFinite(Number(t.intervalInput))||Number(t.intervalInput)<=0)return{error:r("请填写查询间隔")};if(aNA)return{error:r("查询间隔必须是 {min} 秒 ~ 24 小时",{min:lj})}}const o={},c=AA(e);return(t.enabled!==c.enabled||t.enabled&&a!==c.interval)&&(o.usageQuery={enabled:t.enabled,interval:t.enabled?a:c.interval}),o.usageQuery?{patch:o}:null}function t8({account:e,draft:t,onChange:a}){const o=c=>a({...t,...c});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(us,{checked:t.enabled,onCheckedChange:c=>o({enabled:c===!0}),"aria-label":r("自动查询余额")}),s.jsx("span",{className:"text-xs text-subtle",children:r("自动查询余额(按下面的间隔自动刷新余额列的读数)")})]})}),t.enabled?s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-usage-interval",children:r("查询间隔")}),s.jsx(Fe,{id:"account-usage-interval",type:"number",min:1,step:1,className:"max-w-[110px]",value:t.intervalInput,onChange:c=>o({intervalInput:c.currentTarget.value})}),s.jsxs(ft,{value:t.unit,onValueChange:c=>o({unit:c}),children:[s.jsx(mt,{className:"w-[92px]","aria-label":r("间隔单位"),children:s.jsx(pt,{children:t.unit==="hours"?r("小时"):t.unit==="minutes"?r("分钟"):r("秒")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"seconds",children:r("秒")}),s.jsx(qe,{value:"minutes",children:r("分钟")}),s.jsx(qe,{value:"hours",children:r("小时")})]})]}),s.jsx("span",{className:"detail",children:r("30 秒 ~ 24 小时;手动查询会顺延下一轮")})]}):null]})}const n8={sub2api:{label:"Sub2API",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},new_api:{label:"NewAPI",endpoint:"{base}/api/user/self + /api/status",note:r("用 NewAPI 站点的个人访问令牌查询账户余额(不是这条账号的上游 API Key)。令牌在站点的「个人设置」里生成,只有旧版 / 定制站点才需要额外填用户 ID。"),fields:[{key:"accessToken",label:r("NewAPI 个人访问令牌"),secret:!0,placeholder:r("在 NewAPI 站点「个人设置」里生成的访问令牌"),hint:r("必填;留空 = 不修改,清除用右边的按钮")},{key:"userId",label:r("NewAPI 用户 ID"),placeholder:r("旧版 / 定制站点才需要,新版可留空"),hint:r("可留空:新版请求头只认令牌;旧版会把用户 ID 放进 New-Api-User 头")}]},deepseek:{label:"DeepSeek",endpoint:"{base}/user/balance",note:r("用这条账号的 API Key 查询,不需要额外配置。"),fields:[]},opencode:{label:"OpenCode Go",endpoint:"{base}/v1/usage",note:r("用这条账号的 API Key 查询订阅用量,不需要额外配置;读数展开成 5 小时 / 每周 / 每月三个窗口。"),fields:[]},sensenova:{label:"商汤日日新",endpoint:"platform.sensenova.cn 控制台",note:r("用商汤日日新控制台的账号密码查询(与推理用的 API Key 不是同一套)。网关会自动换取登录票并缓存,过期后自动重登,不需要手动维护。"),fields:[{key:"username",label:r("账号"),placeholder:r("商汤日日新控制台的登录账号"),hint:r("必填")},{key:"password",label:r("密码"),secret:!0,placeholder:r("商汤日日新控制台的登录密码"),hint:r("留空 = 不修改,清除用右边的按钮")}]},zhipu:{label:"智谱",endpoint:"bigmodel.cn 控制台",note:r("用 bigmodel.cn 控制台的访问令牌查询账户余额(人民币元)。令牌是登录后浏览器 Cookie `bigmodel_token_production` 的值:开发者工具 → 应用(Application)→ Cookie 里复制。"),fields:[{key:"token",label:r("访问令牌"),secret:!0,placeholder:r("bigmodel_token_production 的值"),hint:r("必填;留空 = 不修改,清除用右边的按钮")}]},zhipu_zai:{label:"智谱(z.ai 国际)",endpoint:"api.z.ai 控制台",note:r("用这条账号的 API Key 生成签名后查询账户余额(美元),不需要额外配置。要求 API Key 是 z.ai 的「id.secret」形态(控制台生成的 Key 就是)。"),fields:[]}};function kf(e){return e?n8[e]??null:null}function s8(e,t){return t.secret?t.key==="accessToken"?e?.hasAccessToken===!0:t.key==="password"?e?.hasPassword===!0:t.key==="token"?e?.hasToken===!0:!1:!1}function r8(e){const t=String(e?.scheme||"");return t==="new_api"?e?.hasAccessToken===!0:t==="sensenova"?String(e?.username||"").trim()!==""&&e?.hasPassword===!0:t==="zhipu"?e?.hasToken===!0:!0}function a8(e){return{userId:String(e?.userId||""),username:String(e?.username||""),accessToken:"",password:"",token:""}}function l8(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=String(t[c.key]??"").trim();if(c.secret){d&&(o[c.key]=d);continue}o[c.key]=d}return Object.keys(o).length?o:null}function o8({field:e,value:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){const p=`${f}-${e.key}`;return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:p,children:e.label}),s.jsx(Fe,{id:p,className:"min-w-[220px]",type:e.secret?"password":"text",autoComplete:e.secret?"new-password":"off",placeholder:a?r("已配置,留空则不修改"):e.placeholder,title:e.hint,value:t,onChange:h=>o(h.currentTarget.value)}),a&&c?s.jsx(se,{variant:"outline",size:"sm",disabled:d===!0,onClick:c,title:r("清除已配置的 {label}",{label:e.label}),children:r("清除")}):null]})}function i8({spec:e,values:t,configured:a,onValue:o,onClear:c,clearBusy:d,idPrefix:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"detail mt-2.5",children:[r("余额查询方案:{label}",{label:e.label}),s.jsx("span",{className:"ml-1 text-subtle",children:e.endpoint})," — ",e.note]}),e.fields.map(p=>s.jsx(o8,{field:p,idPrefix:f,value:t[p.key]||"",configured:a[p.key]===!0,onValue:h=>o(p.key,h),onClear:c?()=>c(p.key):void 0,clearBusy:d},p.key))]})}const NR=64;function c8(e,t){const a=kn(e);return t.filter(o=>o.id!==e.id&&kn(o)===a)}const Rl=999,kR=8;function rg(e){return uu(e)||e?.id||""}function CR(e){const t=e?.config?.source||e?.source,a=e?.config||null,o=t==="rotate";return{mode:t==="pool"?"pool":o?"rotate":t==="clash"?"clash":t==="custom"?"custom":"none",proxyId:t==="pool"?String(a?.proxyId||""):"",rotateAll:o?a?.all!==!1:!0,rotateIds:o&&Array.isArray(a?.proxyIds)?a.proxyIds.map(String):[],listenerUid:a?.source==="clash"||t==="clash"?String(a?.listenerUid||""):"",protocol:a?.protocol==="socks5"?"socks5":"http",host:a?.host||"",port:a?.port===void 0||a?.port===null?"":String(a.port),username:a?.username||"",password:a?.password||""}}function wj(e){if(e.mode==="none")return null;if(e.mode==="pool"){if(!e.proxyId)throw new Error(r("请先选择已保存的代理"));return{source:"pool",proxyId:e.proxyId}}if(e.mode==="rotate"){if(e.rotateAll)return{source:"rotate",all:!0};if(!e.rotateIds.length)throw new Error(r("轮询至少要选择一条代理(或改选「全部」)"));return{source:"rotate",all:!1,proxyIds:[...e.rotateIds]}}if(e.mode==="clash"){if(!e.listenerUid)throw new Error(r("请先选择 Clash Verge 出口"));return{source:"clash",listenerUid:e.listenerUid}}const t=e.host.trim(),a=Number(e.port);if(!t)throw new Error(r("请填写代理主机地址"));if(!Number.isInteger(a)||a<1||a>65535)throw new Error(r("代理端口必须是 1-65535 的整数"));return{source:"custom",protocol:e.protocol==="socks5"?"socks5":"http",host:t,port:a,username:e.username.trim(),password:e.password}}function TR(e){const t=e.profileActive===!1?r("(其他订阅,可能未生效)"):"",a=e.enabled===!1?r("(已在 Clash 中禁用)"):"";return`${e.name} :${e.port}${t}${a}`}function ER({draft:e,onChange:t,idPrefix:a,allowRotate:o=!1}){const d=Ws().clash,f=Array.isArray(d?.options)?d.options:[],p=e.mode==="clash",[h,v]=x.useState(!1),[y,b]=x.useState(null),[j,w]=x.useState(null),[k,S]=x.useState(""),N=A=>t({...e,...A});x.useEffect(()=>{p&&aR().catch(()=>{})},[p]);const T=x.useCallback((A=!1)=>{S(""),lR({force:A}).then(R=>w(R)).catch(R=>{w([]),S(ut(R))})},[]);x.useEffect(()=>{(e.mode==="pool"||e.mode==="rotate")&&j===null&&T()},[e.mode,j,T]);function D(){return e.rotateAll?(j??[]).filter(A=>A.enabled!==!1).map(A=>A.id):[...e.rotateIds]}async function C(){if(h)return;if(e.mode==="rotate"){const R=D();if(!R.length){_e(r("轮询至少要选择一条代理(或改选「全部」)"),"err");return}const I=R.slice(0,kR);v(!0),b(r("正在连接上游…"));let P=0;const O=[];for(const H of I){const B=j?.find(z=>z.id===H)?.name||H;try{const z=await Pe().workbuddyDesktop?.testProxyPoolItem?.(H);z?.success?P+=1:O.push(`${B}(${z?.error||r("连接失败")})`)}catch(z){O.push(`${B}(${ut(z)})`)}}const _=R.length-I.length,L=r("✅ {ok}/{total} 个出口可用",{ok:P,total:I.length})+(_>0?r("(只测了前 {limit} 个,还有 {rest} 个未测)",{limit:kR,rest:_}):"");b(s.jsxs("span",{className:O.length?"text-destructive":"text-success",children:[L,O.length?` ${Qa(O.join(r(";")))}`:""]})),v(!1);return}if(e.mode==="pool"){if(!e.proxyId){_e(r("请先选择已保存的代理"),"err");return}v(!0),b(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxyPoolItem?.(e.proxyId);b(R?.success?s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]}):s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){b(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{v(!1)}return}let A;try{A=wj(e)}catch(R){_e(ut(R),"err");return}v(!0),b(r("正在连接上游…"));try{const R=await Pe().workbuddyDesktop?.testProxy?.({proxy:A});R?.success?b(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),R.status!==void 0&&R.status!==""?` HTTP ${Qa(String(R.status))}`:"",R.ip?r(" 出口 IP {ip}",{ip:Qa(R.ip)}):"",R.durationMs!==void 0&&R.durationMs!==""?` ${Qa(String(R.durationMs))}ms`:""]})):b(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(R?.error||r("连接失败"))]}))}catch(R){b(s.jsxs("span",{className:"text-destructive",children:["❌ ",Qa(ut(R))]}))}finally{v(!1)}}return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(Ah,{value:e.mode,onValueChange:A=>N({mode:A}),className:"flex-row flex-wrap items-center gap-5","aria-label":r("代理方式"),children:[s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:"none"}),r("无代理(直连)")]}),s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:"pool"}),r("已保存的代理")]}),o?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",title:r("逐请求轮换出口(换 IP):OpenCode Zen 免费档按 IP 限流,单个 IP 的额度用完会对它一律 429"),children:[s.jsx(vo,{value:"rotate"}),r("轮询(换 IP)")]}):null,p?s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:"clash"}),"Clash Verge"]}):null,s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:"custom"}),r("自定义")]})]}),e.mode==="pool"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-pool-exit`,children:r("代理")}),s.jsxs(ft,{value:e.proxyId,disabled:!j?.length,onValueChange:A=>N({proxyId:String(A)}),children:[s.jsx(mt,{id:`${a}-pool-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:j?.find(A=>A.id===e.proxyId)?lu(j.find(A=>A.id===e.proxyId)):j===null?r("正在读取…"):j.length?r("请选择代理"):r("还没有保存的代理")})}),s.jsx(ht,{children:(j??[]).map(A=>s.jsx(qe,{value:A.id,children:lu(A)},A.id))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:k?r("读取失败:{error}",{error:k}):j===null?r("正在读取代理列表…"):j.length?r("地址与端口由「网络代理」页管理:那边改一次、测一次,所有引用它的账号一起生效"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="rotate"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[s.jsx(Dr,{id:`${a}-rotate-all`,checked:e.rotateAll,"aria-label":r("轮询全部代理节点"),onCheckedChange:A=>N({rotateAll:A===!0})}),s.jsx("label",{htmlFor:`${a}-rotate-all`,className:"cursor-pointer text-xs text-subtle",children:r("全部代理节点(推荐)")}),s.jsx("span",{className:"detail",children:r("「网络代理」页里每个启用的出口轮流使用;之后新加的出口自动加入")})]}),e.rotateAll?null:s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-rotate-exits`,children:r("轮询的代理")}),s.jsx(Hh,{id:`${a}-rotate-exits`,value:e.rotateIds,onValueChange:A=>N({rotateIds:A.map(String)}),options:(j??[]).map(A=>({value:A.id,label:lu(A)})),placeholder:r("选择要轮询的代理(可多选)"),"aria-label":r("轮询的代理")}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:k?r("读取失败:{error}",{error:k}):j===null?r("正在读取代理列表…"):j.length?r("每条请求换一个出口(按顺序轮流),上游看到的 IP 因此是变化的;出口的地址与端口由「网络代理」页管理"):r("「网络代理」页还没有出口 —— 去那里新增,或点「同步 Clash Verge」把 Clash 的出口导进来")})]}):null,e.mode==="clash"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-clash-exit`,children:r("出口")}),s.jsxs(ft,{value:e.listenerUid,disabled:!f.length,onValueChange:A=>N({listenerUid:String(A)}),children:[s.jsx(mt,{id:`${a}-clash-exit`,className:"min-w-[220px]",children:s.jsx(pt,{children:f.find(A=>String(A.uid)===e.listenerUid)?TR(f.find(A=>String(A.uid)===e.listenerUid)):d?.available===!1?r("未检测到 Clash Verge"):f.length?r("请选择出口"):r("没有可用出口")})}),s.jsx(ht,{children:f.map(A=>s.jsx(qe,{value:String(A.uid),children:TR(A)},String(A.uid)))})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{aR({force:!0}).then(()=>_e(r("✅ 已重新读取 Clash Verge 配置"))).catch(A=>_e(r("读取失败:{error}",{error:ut(A)}),"err"))},children:r("重新读取")})]}),s.jsx("div",{className:"detail mt-1.5",children:d===null?r("正在读取 Clash Verge 配置…"):d.available===!1?d.error?r("不可用:{error}",{error:d.error}):r("未检测到 Clash Verge 配置"):f.length?r("读取自 {dir};端口由 Clash Verge 管理,这里实时同步",{dir:d.dir||"Clash Verge"}):r("Clash Verge 里还没有配置混合监听器或节点端口")}),s.jsxs("p",{className:"detail mt-1.5",children:[r("这是既有配置(直接引用 Clash 出口,不经过代理池)。推荐改用上面的"),s.jsx("b",{children:r("「已保存的代理」")}),r(":到「网络代理」页点「同步 Clash Verge」把出口导进池后即可选 —— 那样能集中测试、也能被多个账号共用。")]})]}):null,e.mode==="custom"?s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:`${a}-protocol`,children:r("协议")}),s.jsxs(ft,{value:e.protocol,onValueChange:A=>N({protocol:A}),children:[s.jsx(mt,{id:`${a}-protocol`,className:"min-w-[110px]",children:s.jsx(pt,{children:e.protocol==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]}),s.jsx("label",{htmlFor:`${a}-host`,className:"ml-2",children:r("主机")}),s.jsx(Fe,{id:`${a}-host`,className:"min-w-[140px]",placeholder:"127.0.0.1",value:e.host,onChange:A=>N({host:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-port`,children:r("端口")}),s.jsx(Fe,{id:`${a}-port`,type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:e.port,onChange:A=>N({port:A.currentTarget.value})})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:`${a}-user`,children:r("用户名")}),s.jsx(Fe,{id:`${a}-user`,placeholder:r("可选"),autoComplete:"off",value:e.username,onChange:A=>N({username:A.currentTarget.value})}),s.jsx("label",{htmlFor:`${a}-pass`,children:r("密码")}),s.jsx(Fe,{id:`${a}-pass`,type:"password",placeholder:r("可选"),autoComplete:"new-password",value:e.password,onChange:A=>N({password:A.currentTarget.value})})]})]}):null,s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{C()},children:r(h?"测试中…":"测试出口")}),s.jsx("span",{className:"detail",children:y})]})]})}function u8({plan:e,hasJwt:t,onChange:a}){const o=e$(e),[c,d]=x.useState(null);return x.useEffect(()=>{if(e!==wo)return()=>{};let f=!0;const p=()=>{Promise.resolve(Pe().workbuddyDesktop?.zcodeCaptchaStats?.()).then(v=>{f&&v&&d({ready:Number(v.ready)||0,target:Number(v.target)||0})}).catch(()=>{})};p();const h=window.setInterval(p,5e3);return()=>{f=!1,window.clearInterval(h)}},[e]),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-plan-channel",children:r("使用套餐")}),s.jsxs(ft,{value:e,onValueChange:f=>a(String(f)),children:[s.jsx(mt,{id:"account-plan-channel",className:"min-w-[220px]",children:s.jsx(pt,{children:o})}),s.jsxs(ht,{children:[s.jsx(qe,{value:PA,children:r("编码套餐(Coding Plan)— 走开放平台端点,用自己订阅的额度")}),s.jsx(qe,{value:wo,children:r("活动套餐(Start Plan)— 走官方活动端点,用活动里领到的额度")})]})]}),e===wo&&!t?s.jsx("span",{className:"detail text-destructive",children:r("该账号没有套餐登录态(jwt),活动套餐会失败:请重新登录该账号")}):null,e===wo?s.jsxs("span",{className:"detail",title:r("活动套餐的推理端点要求每条请求带一个阿里云验证码令牌;令牌由本应用在后台静默铸造,界面关闭时无法铸造"),children:[r("验证码令牌:{counts}",{counts:c?`${c.ready} / ${c.target||3}`:r("读取中…")}),c&&c.ready===0?r("(库存为空,正在补;补不上时转发会失败)"):""]}):null]})}function d8({configured:e,value:t,onChange:a,onClear:o,clearBusy:c}){return s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-balance-token-input",children:r("余额查询凭证")}),s.jsx(Fe,{id:"account-balance-token-input",className:"min-w-[220px]",placeholder:r(e?"已配置,留空则不修改":"一般不用填"),title:r("积分查询已复用转发用的登录凭证,这里通常留空即可。只有旧版本填过、或从旧代理导入过凭证时才有值"),value:t,onChange:d=>a(d.currentTarget.value)}),e?s.jsx(se,{variant:"outline",size:"sm",disabled:c,onClick:o,title:r("清除已配置的余额查询凭证"),children:r("清除")}):null]})}function f8({hasApiKey:e,noAuth:t,value:a,onValue:o,onToggleNoAuth:c,onClear:d,clearBusy:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-api-key-input",children:r("API Key")}),s.jsx(Fe,{id:"account-api-key-input",type:"password",autoComplete:"new-password",className:"min-w-[220px]",disabled:t,placeholder:e?r("已配置,留空则不修改"):"sk-…",title:r("上游的 API Key。留空 = 不修改(改凭证不会换账号 id);要清掉已配的凭证用右边的「清除」"),value:a,onChange:p=>o(p.currentTarget.value)}),e&&!t?s.jsx(se,{variant:"outline",size:"sm",disabled:f,onClick:d,title:r("清除已配置的 API Key(转发时会因缺少凭证被跳过)"),children:r("清除")}):null]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Dr,{checked:t,"aria-label":r("该上游无需鉴权"),onCheckedChange:p=>c(p===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(转发与拉取模型都不发送鉴权头)")})]})}),s.jsxs("p",{className:"detail",children:[r("上游本来不要凭证时(本地 Ollama、OpenCode Zen 的免费档)勾上这一项:账号会被正常选路;只把 Key 留空"),s.jsx("strong",{children:r("又不勾")}),r("会被当成「未配置凭证」而跳过。")]})]})}function p8({provider:e,name:t,protocol:a,baseUrl:o,count:c,emulation:d,onName:f,onProtocol:p,onBaseUrl:h,onEmulation:v,onRemove:y}){const b=Pe().wbProviders?.PROTOCOL_OPTIONS||[{value:"openai",label:r("OpenAI 兼容")},{value:"anthropic",label:"Anthropic"}],j=b.find(w=>w.value===a)?.label||a;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("提供商")}),s.jsxs("p",{children:[r("这一栏改的是"),s.jsx("strong",{children:r("「{name}」本身",{name:e.name||e.id})}),r("(名下 {count} 个账号共用)",{count:c}),r("改协议 / Base URL 会改变它们的转发方式,正在进行的请求可能失败;模型清单与映射在「模型管理」页。")]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-provider-name",children:r("名称")}),s.jsx(Fe,{id:"account-provider-name",maxLength:NR,className:"min-w-[220px]",placeholder:r("提供商显示名,1~{max} 个字符",{max:NR}),value:t,onChange:w=>f(w.currentTarget.value)})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-protocol",children:r("协议")}),s.jsxs(ft,{value:a,onValueChange:w=>p(String(w)),children:[s.jsx(mt,{id:"account-provider-protocol",className:"min-w-[180px]",children:s.jsx(pt,{children:j})}),s.jsx(ht,{children:b.map(w=>s.jsx(qe,{value:w.value,children:w.label},w.value))})]})]}),s.jsxs("div",{className:"field-row mt-2.5",children:[s.jsx("label",{htmlFor:"account-provider-baseurl",children:r("Base URL")}),s.jsx(Fe,{id:"account-provider-baseurl",className:"min-w-[260px]",placeholder:r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),value:o,onChange:w=>h(w.currentTarget.value)})]}),s.jsx("div",{className:"field-row mt-2.5",children:s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2.5 font-normal",children:[s.jsx(Dr,{checked:d==="opencode","aria-label":r("伪装 OpenCode 官方客户端"),onCheckedChange:w=>v(w===!0?"opencode":"")}),s.jsx("span",{className:"text-xs text-subtle",children:r("伪装 OpenCode 官方客户端(OpenCode Zen 免费档要它才放行)")})]})}),s.jsxs("p",{className:"detail",children:[r("开启后,网关按 OpenCode 官方 CLI 的形状发请求:没填 Key 的账号用匿名凭证"),s.jsx("code",{children:"public"}),r("、补官方会话头、请求体补两个占位工具(上游免费档的三道校验)。"),s.jsx("strong",{children:r("它会改写请求体")}),r(",只对 OpenCode Zen 这类上游有意义,别的家请关掉。")]}),s.jsxs("div",{className:"field-row mt-3",children:[s.jsx(se,{variant:"destructive",onClick:y,children:r("删除提供商")}),s.jsx("span",{className:"detail",children:r("级联删除名下全部账号,不可恢复")})]})]})}function m8({id:e,onClose:t}){const a=Ea(e),[o,c]=x.useState(a?.enabled!==!1),[d,f]=x.useState(a?.name||""),[p,h]=x.useState(()=>CR(a?.proxy)),[v,y]=x.useState(""),[b,j]=x.useState(()=>uj(a)),[w,k]=x.useState(!1),[S,N]=x.useState(""),[T,D]=x.useState(null),[C,A]=x.useState(""),[R,I]=x.useState("chat_completions"),[P,O]=x.useState(""),[_,L]=x.useState(""),[H,B]=x.useState(""),[z,Q]=x.useState(a?.noAuth===!0),[K,X]=x.useState(()=>J$(a)),[q,$]=x.useState(()=>a8(a?.balanceQuery)),[Y,F]=x.useState(()=>Q$(a)),[G,W]=x.useState("basic"),[le,M]=x.useState(()=>String(Number(a?.maxConcurrent)||0));if(x.useEffect(()=>{let he=!0;D(null);const ye=Ea(e);return ye?(Promise.resolve(Pe().wbCustomProvidersUi?.find?.(kn(ye))).then(we=>{!he||!we||(D(we),A(we.name||""),I(we.protocol||"chat_completions"),O(we.baseUrl||""),L(typeof we.clientEmulation=="string"?we.clientEmulation:""))}).catch(()=>{}),()=>{he=!1}):()=>{he=!1}},[e]),!a)return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置")})}),s.jsx(Bt,{children:s.jsx("p",{className:"detail",children:r("账号不存在,请刷新后重试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const U=a,Z=c8(U,El()),ae=kn(U)==="catpaw",ce=kn(U).startsWith("custom-"),J=jA(T,U.baseUrl)||p.mode==="rotate",ie=kf(U.balanceQuery?.scheme),ge={};for(const he of ie?.fields??[])ge[he.key]=s8(U.balanceQuery,he);const ee=!!(ie&&ie.fields.length)&&!r8(U.balanceQuery);async function fe(){if(!w){k(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceToken:null}),y(""),_e(r("✅ 已清除余额查询凭证")),await Pe().wbApp?.refresh?.()}catch(he){_e(r("清除失败:{error}",{error:ut(he)}),"err")}finally{k(!1)}}}async function te(){if(!w){k(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{apiKey:null}),B(""),_e(r("✅ 已清除 API Key(该账号现在没有凭证,转发会被跳过)")),await Pe().wbApp?.refresh?.()}catch(he){_e(r("清除失败:{error}",{error:ut(he)}),"err")}finally{k(!1)}}}async function Ce(he){if(!w){k(!0);try{await Pe().workbuddyDesktop?.updateAccount?.(e,{balanceQuery:{[he]:null}}),$(ye=>({...ye,[he]:""})),_e(r("✅ 已清除查询凭证")),await Pe().wbApp?.refresh?.()}catch(ye){_e(r("清除失败:{error}",{error:ut(ye)}),"err")}finally{k(!1)}}}function re(){if(!ce)return null;const he=H.trim(),ye={};return he?ye.apiKey=he:z!==(U.noAuth===!0)&&(ye.noAuth=z),Object.keys(ye).length?ye:null}function de(){if(!T)return null;const he=C.trim(),ye=P.trim();if(!he)return{error:r("请填写提供商名称")};if(!ye)return{error:r("请填写提供商的 Base URL")};const we=typeof T.clientEmulation=="string"?T.clientEmulation:"";return T.name===he&&T.protocol===R&&T.baseUrl===ye&&we===_?null:{id:T.id,name:he,protocol:R,baseUrl:ye,clientEmulation:_}}async function ke(){if(w)return;let he;try{he=wj(p)}catch(Ct){_e(ut(Ct),"err");return}const ye=de();if(ye&&"error"in ye){N(s.jsx("span",{className:"text-destructive",children:ye.error}));return}const we=Ta(U)?e8(U,K):null;if(we&&"error"in we){N(s.jsx("span",{className:"text-destructive",children:we.error}));return}const xe=X$(U,Y),Te=l8(U.balanceQuery?.scheme,q),Oe=re()||{},Ne=Number(le);if(!Number.isFinite(Ne)||Ne<0){_e(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}const Le=Math.min(Rl,Math.round(Ne)),Ye=Number(U.maxConcurrent)||0,kt=Le!==Ye?{maxConcurrent:Le}:{};k(!0);try{const Ct=ae&&v.trim()?{balanceToken:v.trim()}:{},Rt=Kh(U)&&b!==uj(U)?{zcodePlan:b}:{};if(await Pe().workbuddyDesktop?.updateAccount?.(e,{name:d.trim()||U.name,enabled:o,proxy:he,...Ct,...Rt,...Oe,...kt,...Te?{balanceQuery:Te}:{},...we&&"patch"in we?we.patch:{},...xe&&"patch"in xe?xe.patch:{}}),ye)try{await Pe().wbCustomProvidersUi?.update?.(ye)}catch(ot){N(s.jsx("span",{className:"text-destructive",children:r("账号已保存,但提供商未更新:{error}",{error:ut(ot)})})),await Pe().wbApp?.refresh?.(),k(!1);return}t(),_e(r("✅ 账号设置已保存"));try{await Pe().wbApp?.refresh?.()}catch{}}catch(Ct){N(s.jsx("span",{className:"text-destructive",children:ut(Ct)})),_e(r("保存失败:{error}",{error:ut(Ct)}),"err")}finally{k(!1)}}const Ee=Number(ir(kn(U)).concurrencyDefault)||0,ve=ae||ce||Kh(U);return s.jsx(Qt,{open:!0,onOpenChange:he=>{he||w||t()},children:s.jsxs(Zt,{className:"w-[min(900px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("账号设置 · {name}",{name:rg(a)})})}),s.jsx(Bt,{className:"p-0",children:s.jsxs("div",{className:"acct-dlg",children:[s.jsx("aside",{className:"prov-rail acct-dlg-rail","aria-label":r("账号设置分组"),children:s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("账号设置")}),[["basic",r("基本")],...ve?[["credential",r("凭证与套餐")]]:[],...Ta(U)?[["query",r("查询设置")],["limiter",r("限制器")]]:[],["network",r("网络")]].map(([he,ye])=>s.jsx(au,{active:G===he,title:ye,className:"shadow-none",onClick:()=>W(he),children:ye},he))]})}),s.jsxs("div",{className:"acct-dlg-main",children:[G==="basic"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("基本")}),s.jsx("p",{children:r("这条账号是谁、排第几、能不能接请求。")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("启用")}),s.jsx(us,{checked:o,onCheckedChange:c,"aria-label":r("启用该账号")}),s.jsx("span",{className:"detail",children:r("关闭则不参与转发(余额查询照常,见「查询设置」)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-name-input",children:r("备注名")}),s.jsx(Fe,{id:"account-name-input",maxLength:100,placeholder:r("账号显示名称"),className:"max-w-[280px]",value:d,onChange:he=>f(he.currentTarget.value)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{children:r("转发顺序")}),s.jsx("span",{className:"detail",children:r("在列表里拖:拖分组带调整整组顺位,拖行首把手调整组内先后(顺序由拖拽表达,不再填数字)")})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"account-conc-input",children:r("并发上限")}),s.jsx(Fe,{id:"account-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",value:le,onChange:he=>M(he.currentTarget.value)}),s.jsx("span",{className:"detail",children:Ee>0?r("0 = 按本家默认 {default}",{default:Ee}):r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:Ee>0?r("并发上限 受上游硬顶约束,达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)"):r("并发上限 0~{max};达到上限的账号跳过、请求转给其他账号(原列表 ⋯ 菜单的「并发上限」入口已并入这里)",{max:Rl})})]}):null,G==="credential"&&ve?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("凭证与套餐")}),s.jsx("p",{children:r("这一段按提供商出现:有什么配什么。")})]}),ae?s.jsx(d8,{configured:a.hasBalanceToken===!0,value:v,onChange:y,clearBusy:w,onClear:()=>{fe()}}):null,ce?s.jsx(f8,{hasApiKey:U.hasApiKey===!0,noAuth:z,value:H,onValue:B,onToggleNoAuth:Q,onClear:()=>{te()},clearBusy:w}):null,Kh(U)?s.jsx(u8,{plan:b,hasJwt:a.canClaim===!0,onChange:j}):null,T?s.jsx(p8,{provider:T,count:Z.length+1,name:C,protocol:R,baseUrl:P,emulation:_,onName:A,onProtocol:I,onBaseUrl:O,onEmulation:L,onRemove:()=>{w||Promise.resolve(Pe().wbCustomProvidersUi?.remove?.(T.id)).then(he=>{he&&t()})}}):null]}):null,G==="query"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("查询设置")}),s.jsx("p",{children:r("余额列读数的自动刷新;也是「限制器」余额规则的数据来源。")})]}),ie?s.jsx(i8,{spec:ie,values:q,configured:ge,onValue:(he,ye)=>$(we=>({...we,[he]:ye})),onClear:he=>{Ce(he)},clearBusy:w,idPrefix:"account-balance-query"}):null,ee?s.jsx("p",{className:"detail mt-2.5 text-subtle",children:r("查询凭证还没配齐:填好后余额列才有读数,在此之前会显示「未配置」。")}):null,s.jsx(t8,{account:U,draft:K,onChange:X})]}):null,G==="limiter"&&Ta(U)?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("限制器")}),s.jsx("p",{children:r("按规则限制该账号参与转发:没有规则(或全部停用)= 不限制;跳过档自动恢复,禁用档需手动启用。")})]}),s.jsx(Y$,{account:U,draft:Y,onChange:F})]}):null,G==="network"?s.jsxs("div",{children:[s.jsxs("div",{className:"acct-dlg-pane-head",children:[s.jsx("h3",{children:r("网络")}),s.jsx("p",{children:r("这条账号访问上游走哪条线路。")})]}),s.jsx(ER,{draft:p,onChange:h,idPrefix:"account-proxy",allowRotate:J}),a.proxy?.error?s.jsx("p",{className:"detail text-destructive",children:r("当前代理不可用:{error}(转发时会回退直连)",{error:a.proxy.error})}):null]}):null]})]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"detail mr-auto",style:{minHeight:18},children:S}),s.jsx(se,{variant:"outline",disabled:w,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:w,onClick:()=>{ke()},children:r(w?"保存中…":"保存")})]})]})})}const h8=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"proxy",label:r("修改代理")},{value:"concurrency",label:r("设置并发上限")},{value:"remove",label:r("删除")}];function g8({ids:e,action:t,onClose:a}){const[o,c]=x.useState(t),[d,f]=x.useState(()=>CR(null)),[p,h]=x.useState(""),[v,y]=x.useState(!1),[b,j]=x.useState(""),w=e.map(C=>Ea(C)).filter(C=>C!==null),k=w.reduce((C,A)=>Math.max(C,Number(ir(kn(A)).concurrencyDefault)||0),0),S=w.length>0&&w.every(C=>FF(C));function N(C){return Promise.resolve(Pe().wbConfirm?.ask?.({title:r("删除选中的账号"),html:r("确定删除选中的 {count} 个账号?此操作不可恢复,账号的登录态会一并移除。",{count:C}),okText:r("删除"),okClass:"danger"})??!1)}async function T(){if(v)return;if(!e.length){_e(r("没有选中的账号"),"err");return}let C;if(o==="proxy")try{C=wj(d)}catch(R){_e(ut(R),"err");return}let A;if(o==="concurrency"){const R=Number(p.trim());if(!p.trim()||!Number.isFinite(R)||R<0){_e(r("并发上限必须是 0~{max} 的整数",{max:Rl}),"err");return}A=Math.min(Rl,Math.round(R))}if(!(o==="remove"&&!await N(e.length))){if(o==="disable"||o==="remove"){const R=new Set(e);if(!El().filter(P=>P.enabled!==!1&&!R.has(P.id)).length){const P=r(o==="remove"?"删除":"禁用");if(!await Promise.resolve(Pe().wbConfirm?.ask?.({title:r("全部启用中的账号将被{what}",{what:P}),html:r("这会{what}所有启用中的账号,转发将不可用。确定继续?",{what:P}),okText:P,okClass:o==="remove"?"danger":"primary"})??!1))return}}y(!0),j("");try{const R={action:o,ids:e};o==="proxy"&&(R.proxy=C),o==="concurrency"&&(R.maxConcurrent=A);const I=await Pe().workbuddyDesktop?.batchAccounts?.(R),P=(I?.ok||[]).filter(B=>B.changes?.length).length,O=(I?.removed||[]).length,_=I?.failed||[],L=o==="remove"?O:P,H={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;if(_.length){const B=_.slice(0,3).map(z=>rg(Ea(String(z.id)))||z.id).join(r("、"));_e(r("{verb}完成:成功 {ok} 个,失败 {fail} 个({detail}{more})",{verb:H,ok:L,fail:_.length,detail:B,more:_.length>3?r(" 等"):""}),"err"),j(s.jsxs("span",{className:"text-destructive",children:[r("失败 {count} 个:",{count:_.length}),_.map(z=>`${rg(Ea(String(z.id)))||z.id}(${z.error})`).join(r(";"))]}))}else _e(r("✅ {verb}完成:共 {count} 个账号",{verb:H,count:L})),a();await Pe().wbApp?.refresh?.()}catch(R){j(s.jsx("span",{className:"text-destructive",children:ut(R)})),_e(r("批量操作失败:{error}",{error:ut(R)}),"err")}finally{y(!1)}}}const D={enable:r("启用"),disable:r("禁用"),proxy:r("修改代理"),concurrency:r("设置并发上限"),remove:r("删除")}[o]||o;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||v||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {count} 个账号",{count:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下账号")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:w.map(C=>rg(C)).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Ah,{value:o,onValueChange:c,className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:h8.map(C=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:C.value}),C.label]},C.value))}),o==="proxy"?s.jsx("div",{className:"mt-2.5",children:s.jsx(ER,{draft:d,onChange:f,idPrefix:"batch-proxy",allowRotate:S})}):null,o==="concurrency"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-conc-input",children:r("并发上限")}),s.jsx(Fe,{id:"batch-conc-input",type:"number",min:0,max:Rl,step:1,className:"max-w-[110px]",placeholder:r("不限"),value:p,onChange:C=>h(C.currentTarget.value)}),s.jsx("span",{className:"detail",children:r("0 = 不限")})]}),s.jsx("p",{className:"detail acct-dlg-hint",children:k>0?r("并发上限 0~{max};有上游硬顶的家(如 CodeArts)以它的硬顶为准;达到上限的账号会被跳过、请求转给其他账号",{max:Rl}):r("并发上限 0~{max};达到上限的账号会被跳过、请求转给其他账号",{max:Rl})})]}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:v,onClick:a,children:r("取消")}),s.jsx(se,{variant:o==="remove"?"destructive":"default",disabled:v,onClick:()=>{T()},children:v?r("执行中…"):r("执行({action})",{action:D})})]})]})})}function x8(){const e=Ws();return e.dialog?e.dialog.kind==="settings"?s.jsx(m8,{id:e.dialog.id,onClose:tg},e.dialog.id):s.jsx(g8,{ids:e.dialog.ids,action:e.dialog.action,onClose:tg},e.dialog.ids.join(",")):null}var Sj={exports:{}},Cf={},Nj={exports:{}},kj={};var AR;function b8(){return AR||(AR=1,(function(e){function t(X,q){var $=X.length;X.push(q);e:for(;0<$;){var Y=$-1>>>1,F=X[Y];if(0>>1;Yc(le,$))Mc(U,le)?(X[Y]=U,X[M]=$,Y=M):(X[Y]=le,X[W]=$,Y=W);else if(Mc(U,$))X[Y]=U,X[M]=$,Y=M;else break e}}return q}function c(X,q){var $=X.sortIndex-q.sortIndex;return $!==0?$:X.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();e.unstable_now=function(){return f.now()-p}}var h=[],v=[],y=1,b=null,j=3,w=!1,k=!1,S=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function A(X){for(var q=a(v);q!==null;){if(q.callback===null)o(v);else if(q.startTime<=X)o(v),q.sortIndex=q.expirationTime,t(h,q);else break;q=a(v)}}function R(X){if(S=!1,A(X),!k)if(a(h)!==null)k=!0,I||(I=!0,B());else{var q=a(v);q!==null&&K(R,q.startTime-X)}}var I=!1,P=-1,O=5,_=-1;function L(){return N?!0:!(e.unstable_now()-_X&&L());){var Y=b.callback;if(typeof Y=="function"){b.callback=null,j=b.priorityLevel;var F=Y(b.expirationTime<=X);if(X=e.unstable_now(),typeof F=="function"){b.callback=F,A(X),q=!0;break t}b===a(h)&&o(h),A(X)}else o(h);b=a(h)}if(b!==null)q=!0;else{var G=a(v);G!==null&&K(R,G.startTime-X),q=!1}}break e}finally{b=null,j=$,w=!1}q=void 0}}finally{q?B():I=!1}}}var B;if(typeof C=="function")B=function(){C(H)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,Q=z.port2;z.port1.onmessage=H,B=function(){Q.postMessage(null)}}else B=function(){T(H,0)};function K(X,q){P=T(function(){X(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_forceFrameRate=function(X){0>X||125Y?(X.sortIndex=$,t(v,X),a(h)===null&&X===a(v)&&(S?(D(P),P=-1):S=!0,K(R,$-Y))):(X.sortIndex=F,t(h,X),k||w||(k=!0,I||(I=!0,B()))),X},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(X){var q=j;return function(){var $=j;j=q;try{return X.apply(this,arguments)}finally{j=$}}}})(kj)),kj}var RR;function v8(){return RR||(RR=1,Nj.exports=b8()),Nj.exports}var OR;function y8(){if(OR)return Cf;OR=1;var e=v8(),t=Vd(),a=S1();function o(n){var l="https://react.dev/errors/"+n;if(1Ce||(n.current=te[Ce],te[Ce]=null,Ce--)}function ke(n,l){Ce++,te[Ce]=n.current,n.current=l}var Ee=re(null),ve=re(null),he=re(null),ye=re(null);function we(n,l){switch(ke(he,l),ke(ve,n),ke(Ee,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?G3(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=G3(l),n=K3(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}de(Ee),ke(Ee,n)}function xe(){de(Ee),de(ve),de(he)}function Te(n){var l=n.memoizedState;l!==null&&(zd._currentValue=l.memoizedState,ke(ye,n)),l=Ee.current;var i=K3(l,n.type);l!==i&&(ke(ve,n),ke(Ee,i))}function Oe(n){ve.current===n&&(de(Ee),de(ve)),ye.current===n&&(de(ye),zd._currentValue=fe)}var Ne,Le;function Ye(n){if(Ne===void 0)try{throw Error()}catch(i){var l=i.stack.trim().match(/\n( *(at )?)/);Ne=l&&l[1]||"",Le=-1)":-1m||ne[u]!==me[m]){var Se=` `+ne[u].replace(" at new "," at ");return n.displayName&&Se.includes("")&&(Se=Se.replace("",n.displayName)),Se}while(1<=u&&0<=m);break}}}finally{kt=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ye(i):""}function Rt(n,l){switch(n.tag){case 26:case 27:case 5:return Ye(n.type);case 16:return Ye("Lazy");case 13:return n.child!==l&&l!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return Ct(n.type,!1);case 11:return Ct(n.type.render,!1);case 1:return Ct(n.type,!0);case 31:return Ye("Activity");case 30:return Ye("ViewTransition");default:return""}}function ot(n){try{var l="",i=null;do l+=Rt(n,i),i=n,n=n.return;while(n);return l}catch(u){return` Error generating stack: `+u.message+` -`+u.stack}}var qn=Object.prototype.hasOwnProperty,fs=e.unstable_scheduleCallback,Gn=e.unstable_cancelCallback,bs=e.unstable_shouldYield,it=e.unstable_requestPaint,Vt=e.unstable_now,Hn=e.unstable_getCurrentPriorityLevel,tn=e.unstable_ImmediatePriority,nt=e.unstable_UserBlockingPriority,Ot=e.unstable_NormalPriority,Ft=e.unstable_LowPriority,Zn=e.unstable_IdlePriority,Un=e.log,Vn=e.unstable_setDisableYieldValue,Rn=null,Jt=null;function ls(n){if(typeof Un=="function"&&Vn(n),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Rn,n)}catch{}}var Tt=Math.clz32?Math.clz32:jt,xt=Math.log,wt=Math.LN2;function jt(n){return n>>>=0,n===0?32:31-(xt(n)/wt|0)|0}var Nr=256,rr=262144,Hr=4194304;function wn(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function rl(n,l,i){var u=n.pendingLanes;if(u===0)return 0;var m=0,g=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var V=u&134217727;return V!==0?(u=V&~g,u!==0?m=wn(u):(E&=V,E!==0?m=wn(E):i||(i=V&~n,i!==0&&(m=wn(i))))):(V=u&~g,V!==0?m=wn(V):E!==0?m=wn(E):i||(i=u&~n,i!==0&&(m=wn(i)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,i=l&-l,g>=i||g===32&&(i&4194048)!==0)?l:m}function rn(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function ic(n,l){(l&8)!==0&&(l|=l&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=l;0i;i++)l.push(n);return l}function Ho(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Uo(n,l,i,u,m,g){var E=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var V=n.entanglements,ne=n.expirationTimes,me=n.hiddenUpdates;for(i=E&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yt=!1;if(lt)try{var On={};Object.defineProperty(On,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{Yt=!1}var mn=null,Mn=null,ps=null;function kr(){if(ps)return ps;var n,l=Mn,i=l.length,u,m="value"in mn?mn.value:mn.textContent,g=m.length;for(n=0;n=Yp),KP=" ",YP=!1;function XP(n,l){switch(n){case"keyup":return Mte.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function QP(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ld=!1;function Ite(n,l){switch(n){case"compositionend":return QP(l);case"keypress":return l.which!==32?null:(YP=!0,KP);case"textInput":return n=l.data,n===KP&&YP?null:n;default:return null}}function Pte(n,l){if(ld)return n==="compositionend"||!QS&&XP(n,l)?(n=kr(),ps=Mn=mn=null,ld=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function r_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function a_(n,l){var i=r_(n);n=0;for(var u;i;){if(i.nodeType===3){if(u=n+i.textContent.length,n<=l&&u>=l)return{node:i,offset:l-n};n=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=r_(i)}}function l_(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?l_(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function o_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=JS(n.document);l instanceof n.HTMLIFrameElement;){try{var i=typeof l.contentWindow.location.href=="string"}catch{i=!1}if(i)n=l.contentWindow;else break;l=JS(n.document)}return l}function eN(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Fte=lt&&"documentMode"in document&&11>=document.documentMode,od=null,tN=null,Wp=null,nN=!1;function i_(n,l,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;nN||od==null||od!==JS(u)||(u=od,"selectionStart"in u&&eN(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Wp&&Zp(Wp,u)||(Wp=u,u=uv(tN,"onSelect"),0>=E,m-=E,ll=1<<32-Tt(l)+m|i<rt?(Ss=st,st=null):Ss=st.sibling;var Xt=ue(pe,st,be[rt],Ae);if(Xt===null){st===null&&(st=Ss);break}n&&st&&Xt.alternate===null&&l(pe,st),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt,st=Ss}if(rt===be.length)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;rtrt?(Ss=st,st=null):Ss=st.sibling;var gi=ue(pe,st,Xt.value,Ae);if(gi===null){st===null&&(st=Ss);break}n&&st&&gi.alternate===null&&l(pe,st),oe=g(gi,oe,rt),zt===null?Ge=gi:zt.sibling=gi,zt=gi,st=Ss}if(Xt.done)return i(pe,st),Et&&Gl(pe,rt),Ge;if(st===null){for(;!Xt.done;rt++,Xt=be.next())Xt=Re(pe,Xt.value,Ae),Xt!==null&&(oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return Et&&Gl(pe,rt),Ge}for(st=u(st);!Xt.done;rt++,Xt=be.next())Xt=we(st,pe,rt,Xt.value,Ae),Xt!==null&&(n&&(Ss=Xt.alternate,Ss!==null&&st.delete(Ss.key===null?rt:Ss.key)),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return n&&st.forEach(function(Ise){return l(pe,Ise)}),Et&&Gl(pe,rt),Ge}function vt(pe,oe,be,Ae){if(typeof be=="object"&&be!==null&&be.type===H&&be.key===null&&be.props.ref===void 0&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case _:e:{for(var Ge=be.key;oe!==null;){if(oe.key===Ge){if(Ge=be.type,Ge===H){if(oe.tag===7){i(pe,oe.sibling),Ae=m(oe,be.props.children),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}}else if(oe.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&Ac(Ge)===oe.type){i(pe,oe.sibling),Ae=m(oe,be.props),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}i(pe,oe);break}else l(pe,oe);oe=oe.sibling}be.type===H?(Ae=jc(be.props.children,pe.mode,Ae,be.key),Zo(Ae,be),Ae.return=pe,pe=Ae):(Ae=hb(be.type,be.key,be.props,null,pe.mode,Ae),Zo(Ae,be),Ae.return=pe,pe=Ae)}return E(pe);case L:e:{for(Ge=be.key;oe!==null;){if(oe.key===Ge)if(oe.tag===4&&oe.stateNode.containerInfo===be.containerInfo&&oe.stateNode.implementation===be.implementation){i(pe,oe.sibling),Ae=m(oe,be.children||[]),Ae.return=pe,pe=Ae;break e}else{i(pe,oe);break}else l(pe,oe);oe=oe.sibling}Ae=cN(be,pe.mode,Ae),Ae.return=pe,pe=Ae}return E(pe);case F:return be=Ac(be),vt(pe,oe,be,Ae)}if(ie(be))return He(pe,oe,be,Ae);if(ae(be)){if(Ge=ae(be),typeof Ge!="function")throw Error(o(150));return be=Ge.call(be),We(pe,oe,be,Ae)}if(typeof be.then=="function")return vt(pe,oe,kb(be),Ae);if(be.$$typeof===K)return vt(pe,oe,wb(pe,be),Ae);Cb(pe,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,oe!==null&&oe.tag===6?(i(pe,oe.sibling),Ae=m(oe,be),Ae.return=pe,pe=Ae):(i(pe,oe),Ae=iN(be,pe.mode,Ae),Ae.return=pe,pe=Ae),E(pe)):i(pe,oe)}return function(pe,oe,be,Ae){try{rm=0;var Ge=vt(pe,oe,be,Ae);return gd=null,Ge}catch(st){if(st===hd||st===Sb)throw st;var zt=Cr(29,st,null,pe.mode);return zt.lanes=Ae,zt.return=pe,zt}}}var Oc=M_(!0),D_=M_(!1),Wo=!1;function vN(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yN(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Jo(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ei(n,l,i){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(an&2)!==0){var m=u.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),u.pending=l,l=mb(n),g_(n,null,i),l}return pb(n,u,l,i),mb(n)}function am(n,l,i){if(l=l.updateQueue,l!==null&&(l=l.shared,(i&4194048)!==0)){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}function wN(n,l){var i=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var m=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var E={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?m=g=E:g=g.next=E,i=i.next}while(i!==null);g===null?m=g=l:g=g.next=l}else m=g=l;i={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=l:n.next=l,i.lastBaseUpdate=l}var jN=!1;function lm(){if(jN){var n=md;if(n!==null)throw n}}function om(n,l,i,u){jN=!1;var m=n.updateQueue;Wo=!1;var g=m.firstBaseUpdate,E=m.lastBaseUpdate,V=m.shared.pending;if(V!==null){m.shared.pending=null;var ne=V,me=ne.next;ne.next=null,E===null?g=me:E.next=me,E=ne;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,V=Se.lastBaseUpdate,V!==E&&(V===null?Se.firstBaseUpdate=me:V.next=me,Se.lastBaseUpdate=ne))}if(g!==null){var Re=m.baseState;E=0,Se=me=ne=null,V=g;do{var ue=V.lane&-536870913,we=ue!==V.lane;if(we?(Lt&ue)===ue:(u&ue)===ue){ue!==0&&ue===Tc&&(jN=!0),Se!==null&&(Se=Se.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var He=n,We=V;ue=l;var vt=i;switch(We.tag){case 1:if(He=We.payload,typeof He=="function"){Re=He.call(vt,Re,ue);break e}Re=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=We.payload,ue=typeof He=="function"?He.call(vt,Re,ue):He,ue==null)break e;Re=P({},Re,ue);break e;case 2:Wo=!0}}ue=V.callback,ue!==null&&(n.flags|=64,we&&(n.flags|=8192),we=m.callbacks,we===null?m.callbacks=[ue]:we.push(ue))}else we={lane:ue,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Se===null?(me=Se=we,ne=Re):Se=Se.next=we,E|=ue;if(V=V.next,V===null){if(V=m.shared.pending,V===null)break;we=V,V=we.next,we.next=null,m.lastBaseUpdate=we,m.shared.pending=null}}while(!0);Se===null&&(ne=Re),m.baseState=ne,m.firstBaseUpdate=me,m.lastBaseUpdate=Se,g===null&&(m.shared.lanes=0),oi|=E,n.lanes=E,n.memoizedState=Re}}function I_(n,l){if(typeof n!="function")throw Error(o(191,n));n.call(l)}function P_(n,l){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;ng?g:8;var E=ge.T,V={};V.types=E!==null?E.types:null,ge.T=V,VN(n,!1,l,i);try{var ne=m(),me=ge.S;if(me!==null&&me(V,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Se=ene(ne,u);dm(n,l,Se,Qr(n))}else dm(n,l,u,Qr(n))}catch(Re){dm(n,l,{then:function(){},status:"rejected",reason:Re},Qr())}finally{ee.p=g,E!==null&&V.types!==null&&(E.types=V.types),ge.T=E}}function lne(){}function HN(n,l,i,u){if(n.tag!==5)throw Error(o(476));var m=pL(n).queue;fL(n,m,l,fe,i===null?lne:function(){return mL(n),i(u)})}function pL(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:fe},next:null};var i={};return l.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ql,lastRenderedState:i},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function mL(n){var l=pL(n);l.next===null&&(l=n.alternate.memoizedState),dm(n,l.next.queue,{},Qr())}function UN(){return Gs(zd)}function hL(){return ms().memoizedState}function gL(){return ms().memoizedState}function one(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var i=Qr();n=Jo(i);var u=ei(l,n,i);u!==null&&(Rr(u,l,i),am(u,l,i)),l={cache:hN()},n.payload=l;return}l=l.return}}function ine(n,l,i){var u=Qr();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_b(n)?bL(l,i):(i=lN(n,l,i,u),i!==null&&(Rr(i,n,u),vL(i,l,u)))}function xL(n,l,i){var u=Qr();dm(n,l,i,u)}function dm(n,l,i,u){var m={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(_b(n))bL(l,m);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var E=l.lastRenderedState,V=g(E,i);if(m.hasEagerState=!0,m.eagerState=V,qr(V,E))return pb(n,l,m,0),Dn===null&&fb(),!1}catch{}if(i=lN(n,l,m,u),i!==null)return Rr(i,n,u),vL(i,l,u),!0}return!1}function VN(n,l,i,u){if(u={lane:2,revertLane:Mk(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_b(n)){if(l)throw Error(o(479))}else l=lN(n,i,u,2),l!==null&&Rr(l,n,2)}function _b(n){var l=n.alternate;return n===bt||l!==null&&l===bt}function bL(n,l){xd=Ab=!0;var i=n.pending;i===null?l.next=l:(l.next=i.next,i.next=l),n.pending=l}function vL(n,l,i){if((i&4194048)!==0){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,cc(n,i)}}var Lb={readContext:Gs,use:Mb,useCallback:os,useContext:os,useEffect:os,useImperativeHandle:os,useLayoutEffect:os,useInsertionEffect:os,useMemo:os,useReducer:os,useRef:os,useState:os,useDebugValue:os,useDeferredValue:os,useTransition:os,useSyncExternalStore:os,useId:os,useHostTransitionStatus:os,useFormState:os,useActionState:os,useOptimistic:os,useMemoCache:os,useCacheRefresh:os,useEffectEvent:os},yL={readContext:Gs,use:Mb,useCallback:function(n,l){return mr().memoizedState=[n,l===void 0?null:l],n},useContext:Gs,useEffect:sL,useImperativeHandle:function(n,l,i){i=i!=null?i.concat([n]):null,Ib(4194308,4,oL.bind(null,l,n),i)},useLayoutEffect:function(n,l){return Ib(4194308,4,n,l)},useInsertionEffect:function(n,l){Ib(4,2,n,l)},useMemo:function(n,l){var i=mr();l=l===void 0?null:l;var u=n();if(Mc){ls(!0);try{n()}finally{ls(!1)}}return i.memoizedState=[u,l],u},useReducer:function(n,l,i){var u=mr();if(i!==void 0){var m=i(l);if(Mc){ls(!0);try{i(l)}finally{ls(!1)}}}else m=l;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=ine.bind(null,bt,n),[u.memoizedState,n]},useRef:function(n){var l=mr();return n={current:n},l.memoizedState=n},useState:function(n){n=PN(n);var l=n.queue,i=xL.bind(null,bt,l);return l.dispatch=i,[n.memoizedState,i]},useDebugValue:zN,useDeferredValue:function(n,l){var i=mr();return BN(i,n,l)},useTransition:function(){var n=PN(!1);return n=fL.bind(null,bt,n.queue,!0,!1),mr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,i){var u=bt,m=mr();if(Et){if(i===void 0)throw Error(o(407));i=i()}else{if(i=l(),Dn===null)throw Error(o(349));(Lt&127)!==0||U_(u,l,i)}m.memoizedState=i;var g={value:i,getSnapshot:l};return m.queue=g,sL(F_.bind(null,u,g,n),[n]),u.flags|=2048,vd(9,{destroy:void 0},V_.bind(null,u,g,i,l),null),i},useId:function(){var n=mr(),l=Dn.identifierPrefix;if(Et){var i=ol,u=ll;i=(u&~(1<<32-Tt(u)-1)).toString(32)+i,l="_"+l+"R_"+i,i=Rb++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}g[Rs]=l,g[qs]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)g.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=g;e:switch(Qs(g,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Wl(l)}}return Ln(l),l.subtreeFlags&=-33554433,tk(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,i),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==u&&Wl(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(o(166));if(n=he.current,pd(l)){if(n=l.stateNode,i=l.memoizedProps,u=null,m=Ls,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[Rs]=l,n=!!(n.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||F3(n.nodeValue,i)),n||Xo(l,!0)}else n=Nm(n).createTextNode(u),n[Rs]=l,l.stateNode=n}return Ln(l),null;case 31:if(i=l.memoizedState,n===null||n.memoizedState!==null){if(u=pd(l),i!==null){if(n===null){if(!u)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),n=!1}else i=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return l.flags&256?(Gr(l),l):(Gr(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ln(l),null;case 13:if(u=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=pd(l),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(o(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));m[Rs]=l}else Sc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),m=!1}else m=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Gr(l),l):(Gr(l),null)}return Gr(l),(l.flags&128)!==0?(l.lanes=i,l):(i=u!==null,n=n!==null&&n.memoizedState!==null,i&&(u=l.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==m&&(u.flags|=2048)),i!==n&&i&&(l.child.flags|=8192),Fb(l,l.updateQueue),Ln(l),null);case 4:return xe(),n===null&&_k(l.stateNode.containerInfo),l.flags|=67108864,Ln(l),null;case 10:return Yl(l.type),Ln(l),null;case 19:if(CN(l),u=l.memoizedState,u===null)return Ln(l),null;if(m=(l.flags&128)!==0,g=u.rendering,g===null)if(m)pm(u,!1);else{if(is!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(g=Eb(n),g!==null){for(l.flags|=128,pm(u,!1),n=g.updateQueue,l.updateQueue=n,Fb(l,n),l.subtreeFlags=0,n=i,i=l.child;i!==null;)x_(i,n),i=i.sibling;return im(l,Ys.current&1|2),Et&&Gl(l,u.treeForkCount),l.child}n=n.sibling}u.tail!==null&&Vt()>tv&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304)}else{if(!m)if(n=Eb(g),n!==null){if(l.flags|=128,m=!0,n=n.updateQueue,l.updateQueue=n,Fb(l,n),pm(u,!0),u.tail===null&&u.tailMode!=="collapsed"&&u.tailMode!=="visible"&&!g.alternate&&!Et)return Ln(l),null}else 2*Vt()-u.renderingStartTime>tv&&i!==536870912&&(l.flags|=128,m=!0,pm(u,!1),l.lanes=4194304);u.isBackwards?(g.sibling=l.child,l.child=g):(n=u.last,n!==null?n.sibling=g:l.child=g,u.last=g)}if(u.tail!==null){n=u.tail;e:{for(i=n;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Vt(),n.sibling=null,g=Ys.current,g=m?g&1|2:g&1,u.tailMode==="visible"||u.tailMode==="collapsed"||!i||Et?im(l,g):(i=g,ke(Ks,l),ke(Ys,i),lr===null&&(lr=l)),Et&&Gl(l,u.treeForkCount),n}return Ln(l),null;case 22:case 23:return Gr(l),NN(),u=l.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(i&536870912)!==0&&(l.flags&128)===0&&(Ln(l),l.subtreeFlags&6&&(l.flags|=8192)):Ln(l),i=l.updateQueue,i!==null&&Fb(l,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==i&&(l.flags|=2048),n!==null&&de(Ec),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),l.memoizedState.cache!==i&&(l.flags|=2048),Yl(ys),Ln(l),null;case 25:return null;case 30:return l.flags|=33554432,Ln(l),null}throw Error(o(156,l.tag))}function hne(n,l){switch(uN(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Yl(ys),xe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return Oe(l),null;case 31:if(l.memoizedState!==null){if(Gr(l),l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Gr(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Sc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return CN(l),n=l.flags,n&65536?(l.flags=n&-65537|128,n=l.memoizedState,n!==null&&(n.rendering=null,n.tail=null),l.flags|=4,l):null;case 4:return xe(),null;case 10:return Yl(l.type),null;case 22:case 23:return Gr(l),NN(),n!==null&&de(Ec),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Yl(ys),null;case 25:return null;default:return null}}function qL(n,l){switch(uN(l),l.tag){case 3:Yl(ys),xe();break;case 26:case 27:case 5:Oe(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Gr(l);break;case 13:Gr(l);break;case 19:CN(l);break;case 10:Yl(l.type);break;case 22:case 23:Gr(l),NN(),n!==null&&de(Ec);break;case 24:Yl(ys)}}function mm(n,l){try{var i=l.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&n)===n){u=void 0;var g=i.create,E=i.inst;u=g(),E.destroy=u}i=i.next}while(i!==m)}}catch(V){gn(l,l.return,V)}}function ri(n,l,i){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var g=m.next;u=g;do{if((u.tag&n)===n){var E=u.inst,V=E.destroy;if(V!==void 0){E.destroy=void 0,m=l;var ne=i,me=V;try{me()}catch(Se){gn(m,ne,Se)}}}u=u.next}while(u!==g)}}catch(Se){gn(l,l.return,Se)}}function GL(n){var l=n.updateQueue;if(l!==null){var i=n.stateNode;try{P_(l,i)}catch(u){gn(n,n.return,u)}}}function KL(n,l,i){i.props=Dc(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(u){gn(n,l,u)}}function il(n,l){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:var m=n.stateNode,g=Fl(n.memoizedProps,m);(m.ref===null||m.ref.name!==g)&&(m.ref=e5(g)),u=m.ref;break;case 7:if(n.stateNode===null){var E=new Zr(n);v(n.child,!1,ase,E,void 0,void 0),n.stateNode=E}u=n.stateNode;break;default:u=n.stateNode}typeof i=="function"?n.refCleanup=i(u):i.current=u}}catch(V){gn(n,l,V)}}function Xs(n,l){var i=n.ref,u=n.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(m){gn(n,l,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(m){gn(n,l,m)}else i.current=null}function $b(n,l){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&l!==null)for(var i=0;i title"))),Qs(u,l,i),u[Rs]=n,vs(u),l=u;break e;case"link":if(g=x5("link","href",m).get(l+(i.href||""))){for(E=0;Evt&&(E=vt,vt=We,We=E);var pe=a_(V,We),oe=a_(V,vt);if(pe&&oe&&(we.rangeCount!==1||we.anchorNode!==pe.node||we.anchorOffset!==pe.offset||we.focusNode!==oe.node||we.focusOffset!==oe.offset)){var be=Re.createRange();be.setStart(pe.node,pe.offset),we.removeAllRanges(),We>vt?(we.addRange(be),we.extend(oe.node,oe.offset)):(be.setEnd(oe.node,oe.offset),we.addRange(be))}}}}for(Re=[],we=V;we=we.parentNode;)we.nodeType===1&&Re.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;Vi?32:i,ge.T=null,i=jk,jk=null;var g=Va,E=ml;if(Wn=0,Lc=Va=null,ml=0,(an&6)!==0)throw Error(o(331));var V=an;if(an|=4,g3(g.current),p3(g,g.current,E,i),an=V,wm(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Rn,g)}catch{}return!0}finally{ee.p=m,ge.T=u,O3(n,l)}}function M3(n,l,i){l=ga(i,l),l=qN(n.stateNode,l,2),n=ei(n,l,2),n!==null&&(Ho(n,2),hl(n))}function gn(n,l,i){if(n.tag===3)M3(n,n,i);else for(;l!==null;){if(l.tag===3){M3(l,n,i);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ii===null||!ii.has(u))){n=ga(i,n),i=EL(2),u=ei(l,i,2),u!==null&&(AL(i,u,l,n),Ho(u,2),hl(u));break}}l=l.return}}function Ak(n,l,i){var u=n.pingCache;if(u===null){u=n.pingCache=new vne;var m=new Set;u.set(l,m)}else m=u.get(l),m===void 0&&(m=new Set,u.set(l,m));m.has(i)||(vk=!0,m.add(i),n=Tne.bind(null,n,l,i),l.then(n,n))}function Tne(n,l,i){var u=n.pingCache;u!==null&&u.delete(l),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Dn===n&&(Lt&i)===i&&((is===4||is===3&&(Lt&62914560)===Lt&&300>Vt()-ev)&&(an&2)===0?Rd(n,0):Jb|=i,kd===Lt&&(kd=0)),hl(n)}function D3(n,l){l===0&&(l=dr()),n=wc(n,l),n!==null&&(Ho(n,l),hl(n))}function Ene(n){var l=n.memoizedState,i=0;l!==null&&(i=l.retryLane),D3(n,i)}function Ane(n,l){var i=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(i=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(l),D3(n,i)}function Rne(n,l){return fs(n,l)}var Md=null,Dd=null,Rk=!1,iv=!1,Ok=!1,ui=0;function hl(n){n!==Dd&&n.next===null&&(Dd===null?Md=Dd=n:Dd=Dd.next=n),iv=!0,Rk||(Rk=!0,Mne())}function wm(n,l){if(!Ok&&iv){Ok=!0;do for(var i=!1,u=Md;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var g=0;else{var E=u.suspendedLanes,V=u.pingedLanes;g=(1<<31-Tt(42|n)+1)-1,g&=m&~(E&~V),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,L3(u,g))}else g=Lt,g=rl(u,u===Dn?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||rn(u,g)||(i=!0,L3(u,g));u=u.next}while(i);Ok=!1}}function One(){I3()}function I3(){iv=Rk=!1;var n=0;ui!==0&&Fne()&&(n=ui);for(var l=Vt(),i=null,u=Md;u!==null;){var m=u.next,g=P3(u,l);g===0?(u.next=null,i===null?Md=m:i.next=m,m===null&&(Dd=i)):(i=u,(n!==0||(g&3)!==0)&&(iv=!0)),u=m}Wn!==0&&Wn!==5||wm(n),ui!==0&&(ui=0)}function P3(n,l){for(var i=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,g=n.pendingLanes&-62914561;0V)break;var Se=ne.transferSize,Re=ne.initiatorType;Se&&$3(Re)&&(ne=ne.responseEnd,E+=Se*(nepv){We.length=He;break}be=new Promise(Xne.bind(be)),We.push(be)}}}if(0"u"?null:document;function p5(n,l,i){var u=Pd;if(u&&typeof l=="string"&&l){var m=pr(l);m='link[rel="'+n+'"][href="'+m+'"]',typeof i=="string"&&(m+='[crossorigin="'+i+'"]'),f5.has(m)||(f5.add(m),n={rel:n,crossOrigin:i,href:l},u.querySelector(m)===null&&(l=u.createElement("link"),Qs(l,"link",n),vs(l),u.head.appendChild(l)))}}function mse(n){eo.D(n),p5("dns-prefetch",n,null)}function hse(n,l){eo.C(n,l),p5("preconnect",n,l)}function gse(n,l,i){eo.L(n,l,i);var u=Pd;if(u&&n&&l){var m='link[rel="preload"][as="'+pr(l)+'"]';l==="image"&&i&&i.imageSrcSet?(m+='[imagesrcset="'+pr(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(m+='[imagesizes="'+pr(i.imageSizes)+'"]')):m+='[href="'+pr(n)+'"]';var g=m;switch(l){case"style":g=_d(n);break;case"script":g=Ld(n)}if(!(ja.has(g)||(n=P({rel:"preload",href:l==="image"&&i&&i.imageSrcSet?void 0:n,as:l},i),ja.set(g,n),u.querySelector(m)!==null||l==="style"&&u.querySelector(Cm(g))||l==="script"&&u.querySelector(Tm(g))))){var E=u.createElement("link");Qs(E,"link",n),l==="style"&&(E[Os]=!0,E.onload=E.onerror=function(){Lp(E)}),vs(E),u.head.appendChild(E)}}}function xse(n,l){eo.m(n,l);var i=Pd;if(i&&n){var u=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+pr(u)+'"][href="'+pr(n)+'"]',g=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Ld(n)}if(!ja.has(g)&&(n=P({rel:"modulepreload",href:n},l),ja.set(g,n),i.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Tm(g)))return}u=i.createElement("link"),Qs(u,"link",n),vs(u),i.head.appendChild(u)}}}function bse(n,l,i){eo.S(n,l,i);var u=Pd;if(u&&n){var m=$o(u).hoistableStyles,g=_d(n);l=l||"default";var E=m.get(g);if(!E){var V={loading:0,preload:null};if(E=u.querySelector(Cm(g)))V.loading=5;else{n=P({rel:"stylesheet",href:n,"data-precedence":l},i),(i=ja.get(g))&&Wk(n,i);var ne=E=u.createElement("link");vs(ne),Qs(ne,"link",n),ne._p=new Promise(function(me,Se){ne.onload=me,ne.onerror=Se}),ne.addEventListener("load",function(){V.loading|=1}),ne.addEventListener("error",function(){V.loading|=2}),V.loading|=4,dv(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:V},m.set(g,E)}}}function vse(n,l){eo.X(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function yse(n,l){eo.M(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Tm(m)),g||(n=P({src:n,async:!0,type:"module"},l),(l=ja.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function m5(n,l,i,u){var m=(m=he.current)?km(m):null;if(!m)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=_d(i.href),l=$o(m).hoistableStyles,u=l.get(i),u||(u={type:"style",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=_d(i.href);var g=$o(m).hoistableStyles,E=g.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,E),(g=m.querySelector(Cm(n)))?g._p||(E.instance=g,E.state.loading=5):(g=ja.get(n),g||(g={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ja.set(n,g)),wse(m,n,g,E.state))),l&&u===null)throw Error(o(528,""));return E}if(l&&u!==null)throw Error(o(529,""));return null;case"script":return l=i.async,i=i.src,typeof i=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(i=Ld(i),l=$o(m).hoistableScripts,u=l.get(i),u||(u={type:"script",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function _d(n){return'href="'+pr(n)+'"'}function Cm(n){return'link[rel="stylesheet"]['+n+"]"}function h5(n){return P({},n,{"data-precedence":n.precedence,precedence:null})}function wse(n,l,i,u){if(l=n.querySelector('link[rel="preload"][as="style"]['+l+"]")){if(l[Os]!==!0){u.loading=1;return}}else l=n.createElement("link"),l[Os]=!0,l.onload=l.onerror=Lp.bind(null,l),Qs(l,"link",i),vs(l),n.head.appendChild(l);u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2})}function Ld(n){return'[src="'+pr(n)+'"]'}function Tm(n){return"script[async]"+n}function g5(n,l,i){if(l.count++,l.instance===null)switch(l.type){case"style":var u=n.querySelector('style[data-href~="'+pr(i.href)+'"]');if(u)return l.instance=u,vs(u),u;var m=P({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),vs(u),Qs(u,"style",m),dv(u,i.precedence,n),l.instance=u;case"stylesheet":m=_d(i.href);var g=n.querySelector(Cm(m));if(g)return l.state.loading|=4,l.instance=g,vs(g),g;u=h5(i),(m=ja.get(m))&&Wk(u,m),g=(n.ownerDocument||n).createElement("link"),vs(g);var E=g;return E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),l.state.loading|=4,dv(g,i.precedence,n),l.instance=g;case"script":return g=Ld(i.src),(m=n.querySelector(Tm(g)))?(l.instance=m,vs(m),m):(u=i,(m=ja.get(g))&&(u=P({},i),Jk(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),vs(m),Qs(m,"link",u),n.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,dv(u,i.precedence,n));return l.instance}function dv(n,l,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,g=m,E=0;E title"):null)}function jse(n,l,i){if(i===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(n=l.disabled,typeof l.precedence=="string"&&n==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function b5(n,l){return n==="img"&&l.src!=null&&l.src!==""&&l.onLoad==null&&l.loading!=="lazy"}function v5(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function y5(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function w5(n,l){typeof l.decode=="function"&&(n.imgCount++,l.complete||(n.imgBytes+=y5(l),n.suspenseyImages.push(l)),n=kse.bind(n),l.decode().then(n,n))}function Sse(n,l,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var m=_d(u.href),g=l.querySelector(Cm(m));if(g){l=g._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Em.bind(n),l.then(n,n)),i.state.loading|=4,i.instance=g,vs(g);return}g=l.ownerDocument||l,u=h5(u),(m=ja.get(m))&&Wk(u,m),g=g.createElement("link"),vs(g);var E=g;E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),i.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,l),(l=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Em.bind(n),l.addEventListener("load",i),l.addEventListener("error",i))}}var pv=0;function Nse(n,l){return n.stylesheets&&n.count===0&&hv(n,n.stylesheets),0pv?50:800)+l);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function j5(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)hv(n,n.stylesheets);else if(n.unsuspend){var l=n.unsuspend;n.unsuspend=null,l()}}}function Em(){this.count--,j5(this)}function kse(){this.imgCount--,j5(this)}var mv=null;function hv(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,mv=new Map,l.forEach(Cse,n),mv=null,Em.call(n))}function Cse(n,l){if(!(l.state.loading&4)){var i=mv.get(n);if(i)var u=i.get(null);else{i=new Map,mv.set(n,i);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sw.exports=v8(),Sw.exports}var vn=y8();const rg=[20,50,100,200],ag=[20,50,100,200,"all"],du=50,DR="workbuddy-desktop-table-size:";function IR(e){return e==="all"?r("全部"):String(e)}function lg(e,t=ag,a=du){t.includes(a)||(a=t.includes(du)?du:t[0]);let o=null;try{o=localStorage.getItem(DR+e)}catch{return a}if(o===null||o.trim()==="")return a;if(o==="all")return t.includes("all")?"all":a;const c=Number(o);return Number.isFinite(c)&&t.includes(c)?c:a}function og(e,t){try{localStorage.setItem(DR+e,String(t))}catch{}}function ig(e,t,a={}){const o=a.sizes??ag,c=a.defaultSize??du,[d,f]=x.useState(()=>lg(t,o,c)),[p,h]=x.useState(1),b=Math.max(1,d==="all"?1:Math.ceil(e/d)),y=Math.min(Math.max(1,p),b);x.useEffect(()=>{y!==p&&h(y)},[y,p]);const v=x.useCallback(k=>{f(k),og(t,k),h(1)},[t]),w=x.useCallback(k=>{h(Math.min(Math.max(1,Math.round(k)||1),b))},[b]),j=d==="all"?0:(y-1)*d,S=d==="all"?e:Math.min(e,j+d),N=x.useCallback(k=>d==="all"?k.slice():k.slice(j,S),[d,j,S]);return{size:d,page:y,pageCount:b,rangeStart:e?j+1:0,rangeEnd:e?S:0,paged:d!=="all",setSize:v,goto:w,slice:N}}function Li({total:e,page:t,pageCount:a,size:o,sizes:c=ag,onSizeChange:d,onPageChange:f,range:p=null,disabled:h=!1,leading:b,className:y}){const[v,w]=x.useState(String(t));x.useEffect(()=>w(String(t)),[t]);const j=()=>{const k=v.trim();if(!k){w(String(t));return}const T=Number(k);if(!Number.isFinite(T)){w(String(t));return}const D=Math.min(Math.max(1,Math.round(T)),a);w(String(D)),D!==t&&f(D)},S=a<=1,N=e===0?r("共 0 条"):p?r("共 {total} 条 · 当前第 {start}–{end} 条",{total:e,start:p.start,end:p.end}):r("共 {total} 条(全部显示)",{total:e});return s.jsxs("div",{className:y?`panel-foot table-foot-bar ${y}`:"panel-foot table-foot-bar",children:[b,s.jsx("div",{className:"spacer"}),s.jsxs("div",{className:"table-foot-ctl",children:[s.jsx("span",{className:"table-foot-count",children:N}),s.jsxs("span",{className:"table-foot-size",children:[r("每页"),s.jsxs(ft,{value:String(o),onValueChange:k=>d(k==="all"?"all":Number(k)),children:[s.jsx(mt,{className:"h-[26px] w-[86px]",disabled:h,"aria-label":r("每页条数"),children:s.jsx(pt,{children:IR(o)})}),s.jsx(ht,{children:c.map(k=>s.jsx(qe,{value:String(k),children:IR(k)},String(k)))})]}),r("条")]}),s.jsxs("span",{className:"table-foot-jump",children:[r("跳至"),s.jsx($e,{className:"h-[26px] w-[52px] px-1 text-center",value:v,disabled:h||S,"aria-label":r("跳转到指定页"),title:S?r("当前只有一页"):r("跳转到第 1–{pageCount} 页",{pageCount:a}),inputMode:"numeric",onChange:k=>w(k.target.value),onKeyDown:k=>{k.key==="Enter"?(k.preventDefault(),j()):k.key==="Escape"&&w(String(t))},onBlur:j}),r("页")]}),s.jsx(MF,{page:t,pageCount:a,onPageChange:f,disabled:h})]})]})}const Cw=[{key:"pick",label:r("选择"),align:"center",legacyAlign:"left"},{key:"order",label:r("顺序"),title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),align:"center",legacyAlign:"left"},{key:"account",label:r("账号"),align:"center",legacyAlign:"left"},{key:"proxy",label:r("代理"),title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),align:"center"},{key:"connections",label:r("连接数"),title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),align:"center"},{key:"status",label:r("状态"),align:"center",legacyAlign:"left"},{key:"limits",label:r("限流"),title:r("该账号当前限流中的模型;点徽章看明细"),align:"center",legacyAlign:"left"},{key:"expiry",label:r("有效期"),align:"center",legacyAlign:"left"},{key:"usage",label:r("余额"),align:"center",legacyAlign:"left"},{key:"actions",label:r("操作"),align:"right"}],PR="agent2api-accounts-col-widths",Tf={pick:47,order:84,proxy:186,connections:56,status:80,limits:148,expiry:80,usage:132,actions:200},Tw=new Set(["account"]),w8=300,Ew=56,j8=new Set([...Object.keys(Tf),...Tw]),fu=(()=>{try{const e=JSON.parse(localStorage.getItem(PR)||"{}"),t={};for(const[a,o]of Object.entries(e||{})){const c=Number(o);j8.has(a)&&Number.isFinite(c)&&c>=Ew&&(t[a]=Math.round(c))}return t}catch{return{}}})();function _R(){try{localStorage.setItem(PR,JSON.stringify(fu))}catch{}}function S8(){return{...Tf,...fu}}function N8(e){let t=0;for(const a of e){const o=fu[a];o?t+=o:Tw.has(a)?t+=w8:Tf[a]?t+=Tf[a]:t+=Ew}return Math.round(t)}function LR(e,t){const a=e?.querySelector(`thead th:nth-child(${t+1})`),o=a?.getAttribute("data-col")||a?.className.match(/cell-([a-z]+)/)?.[1];if(!o)return null;const c=e?.querySelector(`colgroup col[data-col="${CSS.escape(o)}"]`)||e?.querySelectorAll("colgroup col")[t];return c?{key:o,col:c}:null}function k8(e,t,a){const o=Math.max(Ew,Math.round(a));e.style.width=o+"px",Tw.has(t)||o!==Tf[t]?fu[t]=o:delete fu[t]}let Aw=()=>{};function C8(e,t){if(Aw=t,!e)return;let a=null;e.addEventListener("pointerdown",o=>{if(o.button!==0)return;const c=o.target?.closest?.(".col-grip");if(!c)return;o.preventDefault();const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);if(!h)return;const b=o.clientX,y=h.col.getBoundingClientRect().width;c.classList.add("active"),document.body.classList.add("col-resizing");try{c.setPointerCapture(o.pointerId)}catch{}a={...h,startX:b,startWidth:y,grip:c,pointerId:o.pointerId},window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w),window.addEventListener("blur",w);function v(j){if(a){if(j.buttons===0){w();return}k8(a.col,a.key,a.startWidth+j.clientX-a.startX)}}function w(){if(!a)return;const{grip:j,pointerId:S}=a;a=null,j.classList.remove("active"),document.body.classList.remove("col-resizing");try{j.releasePointerCapture(S)}catch{}window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),window.removeEventListener("blur",w),_R(),Aw()}}),e.addEventListener("dblclick",o=>{const c=o.target?.closest?.(".col-grip");if(!c)return;const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);h&&(delete fu[h.key],_R(),Aw())})}function gt(){return window}function Jn(e,t){gt().wbApp?.toast?.(e,t)}function pu(e){return e instanceof Error&&e.message?e.message:String(e??"").trim()||r("未知错误")}function Rw(e){return(gt().wbApp?.getState?.()?.accounts?.accounts||[]).filter(a=>(a?.provider||"workbuddy")===e).length}function zR(e){const t=e?.name||"";if(t)return(gt().wbProviders?.customList?.()||[]).find(a=>(a.name||"")===t)}function T8(e){const t=e?.name||"";return t?(gt().wbPresetProviders?.list||[]).some(a=>a.name===t):!1}async function cg(e){const t=gt().__TAURI_INTERNALS__;if(!t||typeof t.invoke!="function")throw new Error(r("桌面运行时不可用(Tauri 未初始化)"));return t.invoke("api_request",{request:{method:"POST",path:"/api/accounts",body:e}})}function ug(e){return e?.name||e?.uid||e?.userId||""}function Ow(){gt().wbAddAccountModal?.close?.()}async function mu(e,t){Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ {label}账号已添加{name}",{label:t,name:e?`:${e}`:""}))}const hu=new Map;function Aa(e){return{defaultValue:hu.get(e)??"",onChange:t=>{const a=t.currentTarget.value;a?hu.set(e,a):hu.delete(e)}}}function So(e,t){t?hu.set(e,t):hu.delete(e);const a=document.getElementById(e);(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&(a.value=t)}function vr(e){const t=document.getElementById(e);return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value.trim():(hu.get(e)??"").trim()}function Mw(e){for(const t of e)So(t,"")}const zi={edition:"cn",loginMode:"embedded",socialRestore:!1},E8=100,A8=256,R8=e=>e.key==="name"?E8:A8,O8={provider:"raccoon",label:"小浣熊",addButton:r("添加小浣熊账号"),webLogin:{noteHtml:r("在内嵌窗口里完成官方登录,成功后自动加入账号列表。"),button:r("打开网页登录"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待"),busyText:r("等待小浣熊登录完成…")},manualTitle:r("粘贴 token / refreshToken"),manualNoteHtml:r('refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。'),fields:[{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用凭证里的账号名")},{key:"token",label:"token",rows:3,placeholder:r("粘贴 access_token(一长串 JWT)")},{key:"refreshToken",inputKey:"refresh",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。")},M8={provider:"catpaw",label:"CatPaw",webLogin:{noteHtml:r("用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。"),button:r("打开 CatPaw 网页登录"),busyText:r("等待 CatPaw 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的美团账号);完成后自动加入列表")}]},manualNote:r("token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。"),fields:[{key:"token",label:"token",rows:3,placeholder:r("CatPaw 的 X-Passport-Token(登录态 Cookie)")},{key:"uid",label:"uid",placeholder:r("必填,CatPaw 账号标识")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用登录名或 uid")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。"),desktopHint:r("读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录")},D8={provider:"autoclaw",label:r("AutoClaw 国内版"),manualNote:r("token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。"),smsLogin:{noteHtml:r("用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。")},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0},I8={provider:"autoclaw-intl",label:r("AutoClaw 国际版"),manualNote:r("国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。"),oauthLogin:{title:r("网页登录(Zai / Google)"),noteHtml:r("点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表")}]},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT(国际版账号的 access token)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0};function BR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开官方授权页完成设备码授权,登录的是{label}({site})的账号。",{label:a,site:o}),button:r("打开 Qoder 网页登录"),busyText:r("等待 Qoder 授权完成…"),edition:t==="qoder"?"cn":"global",modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口用全新环境,多账号互不影响;关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录账号);完成后自动加入列表")}]},manualTitle:r("使用个人访问令牌(PAT)"),manualNote:r("在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。",{label:a}),fields:[{key:"pat",label:"Qoder PAT",rows:3,placeholder:r("粘贴 Qoder 个人访问令牌(pt-…)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}const P8=BR({provider:"qoder",label:r("中国版"),siteNote:"qoder.com.cn"}),_8=BR({provider:"qoder-intl",label:r("国际版"),siteNote:"qoder.com"});function HR(e){const{provider:t,label:a,poolNote:o}=e;return{provider:t,label:a,desktop:!0,webLogin:{noteHtml:r("打开授权页完成确认,账号自动加入 {label}{note}",{label:a,note:o}),button:r("打开 Cline 授权页"),busyText:r("等待 Cline 授权确认…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表")}]},manualTitle:r("填写凭证"),manualNote:r("refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。",{label:a}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 workos:… 开头的令牌(不带前缀也会自动补上)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号姓名、邮箱或令牌指纹")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。",{label:a}),desktopHint:r("读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录")}}function UR(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,webLogin:{noteHtml:r("打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。",{label:a,site:o}),button:r("打开 Accio {label}登录页",{label:a}),busyText:r("等待 Accio {label}登录完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)",{label:a,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 Accio 的 accessToken")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}function VR(e){const{provider:t,label:a,site:o,planNote:c}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。",{label:a}),button:r("打开 ZCode {label}授权页",{label:a}),busyText:r("等待 ZCode {label}授权完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)",{site:o,label:a,plan:c}),fields:[{key:"accessToken",label:r("编码套餐 API Key"),rows:3,optional:!0,placeholder:r("用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)")},{key:"jwt",label:"Coding Plan JWT",inputKey:"jwt",rows:3,optional:!0,placeholder:r("用于领取套餐与查询余额;不填则这个账号不能领取与查余额")},{key:"userId",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于生成账号 id 与展示名")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动生成")}]}}const L8={provider:"codearts",label:"CodeArts",desktop:!1,webLogin:{noteHtml:r("打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。"),button:r("打开 CodeArts 授权页"),busyText:r("等待 CodeArts 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板")}]},manualTitle:r("粘贴登录凭据"),manualNoteHtml:r('整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {"codearts_provider_credential":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。'),fields:[{key:"credentialJson",label:r("凭据 JSON"),rows:8,jsonExpand:!0,placeholder:'{"codearts_provider_credential":{"access_key_id":"HSTA…","secret_access_key":"…","security_token":"…","expires_at":"2026-09-27T16:17:00.327Z","domain_id":"…","user_id":"…","user_name":"…","refresh_token":"eyJ…","oauth_context":{…}}}'},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用凭据里的 user_name")}]},z8={provider:"trae",label:"Trae",desktop:!1,webLogin:{noteHtml:r("打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。"),button:r("打开 Trae 授权页"),busyText:r("等待 Trae 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("Cloud-IDE-JWT(三段点分)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选;填了才能到期自动续期")},{key:"uid",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于去重与展示名(留空时网关会问一次上游)")},{key:"machineId",label:"machineId",optional:!0,placeholder:r("可选;UUID 形态,与凭据同生共死")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选;纯数字串(上游只收 8–24 位数字)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动用昵称")}]},B8={provider:"loomy",label:"Loomy",smsLogin:{noteHtml:r("用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。")},manualNote:r("粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。"),fields:[{key:"session",label:"session",rows:3,placeholder:r("登录 session(一长串)")},{key:"userId",label:"userId",optional:!0,placeholder:r("可选,讯飞侧 userid")},{key:"phone",label:r("手机号"),optional:!0,placeholder:r("可选,展示用")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用脱敏手机号或 userId")}],desktop:!1},H8={provider:"kuku",label:"KukuAI",webLogin:{noteHtml:r("在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。"),button:r("打开网页登录"),busyText:r("等待 KukuAI 登录完成…")},manualTitle:r("粘贴 Cookie"),manualNote:r("BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。"),fields:[{key:"cookie",label:"Cookie",rows:3,placeholder:r("BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号 uk")}],desktop:!0,desktopHint:r("读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录"),desktopNote:r("读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。")};function FR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 session cookie"),manualNoteHtml:r("粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。",{siteNote:o}),fields:[{key:"session",label:"session",rows:3,placeholder:r("monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)")},{key:"imageId",label:r("任务镜像 id"),optional:!0,placeholder:r("可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游返回的账号名或账号 id")}]}}const U8=FR({provider:"monkeycode",label:r("MonkeyCode"),siteNote:r("这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。")}),V8=FR({provider:"monkeycode-intl",label:r("MonkeyCode 国际版"),siteNote:r("这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。")}),F8={provider:"commandcode",label:r("Command Code"),desktop:!1,manualTitle:r("粘贴 API Key"),manualNote:r("粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。"),fields:[{key:"apiKey",label:"apiKey",rows:3,placeholder:r("user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 key 尾号")}]},$8={provider:"antigravity",label:r("Antigravity"),desktop:!1,webLogin:{noteHtml:r("在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。"),button:r("打开 Antigravity 网页登录"),busyText:r("等待 Google 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表")}]},manualTitle:r("粘贴 Google refresh token"),manualNoteHtml:r("粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。"),fields:[{key:"refreshToken",label:"refreshToken",rows:2,placeholder:r("1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)")},{key:"projectId",label:"projectId",optional:!0,placeholder:r("可选(cloudaicompanionProject):留空由网关自动发现")},{key:"email",label:"email",optional:!0,placeholder:r("可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用邮箱或令牌尾号")}]},q8={provider:"officeace",label:r("OfficeAce 果办"),desktop:!1,webLogin:{noteHtml:r("打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。"),button:r("打开授权页"),busyText:r("等待 OfficeAce 登录完成…")},manualTitle:r("粘贴网关凭据"),manualNoteHtml:r("从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。"),fields:[{key:"baseUrl",label:r("模型网关基址"),placeholder:"https://modelgw-…huaweicloud-agentarts.com/v2"},{key:"modelAppKey",label:r("网关 Key"),placeholder:"model_app_key"},{key:"modelAppSecret",label:r("网关 Secret"),placeholder:"model_app_secret"},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空用「OfficeAce 果办」")}]},G8={provider:"orcaterm",label:"OrcaTerm",desktop:!0,desktopHint:r("读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录"),desktopNote:r("读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。"),manualTitle:r("粘贴 accessToken"),manualNoteHtml:r("粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号昵称或 userId")}]};function $R(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 API 令牌"),manualNoteHtml:r("粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。",{site:o,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("ms- 开头的 API 令牌")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游账号昵称")}]}}const K8=$R({provider:"modelscope",label:r("ModelScope 国内版"),site:"modelscope.cn",siteNote:r("这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。")}),Y8=$R({provider:"modelscope-intl",label:r("ModelScope 国际版"),site:"modelscope.ai",siteNote:r("这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。")}),qR=[O8,M8,D8,I8,P8,_8,HR({provider:"cline-free",label:"Cline Free",poolNote:r("(免费额度池,模型名带 cline-free/ 前缀)。")}),HR({provider:"cline-pass",label:"Cline Pass",poolNote:r("(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。")}),UR({provider:"accio",label:r("国际版"),site:"www.accio.com",siteNote:r("国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。")}),UR({provider:"accio-cn",label:r("国内版"),site:"www.accio-ai.com",siteNote:r("国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。")}),VR({provider:"zcode",label:r("国内版"),site:"open.bigmodel.cn",planNote:r("国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。")}),VR({provider:"zcode-intl",label:r("国际版"),site:"api.z.ai",planNote:r("国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。")}),L8,z8,B8,H8,U8,V8,F8,$8,q8,G8,K8,Y8],Bi="workbuddy",gu="custom",Dw="WorkBuddy";function X8(e){return qR.find(t=>t.provider===e)}const GR=[{id:"oauth",label:r("网页登录(Zai / Google)")},{id:"sms",label:r("手机验证码登录")},{id:"web",label:r("网页登录")},{id:"manual",label:r("填写凭证")},{id:"desktop",label:r("导入桌面端登录态")}],Iw=()=>gt().workbuddyDesktop?.platform||"";function KR(e){return!(e.desktop===!1||Iw()==="web"||e.desktopWindowsOnly&&Iw()==="macos")}function YR(e,t){return GR.filter(a=>a.id==="oauth"?!!e.oauthLogin:a.id==="sms"?!!e.smsLogin:a.id==="web"?!!e.webLogin&&(!e.webLogin?.region||t===e.webLogin.region):a.id==="desktop"?KR(e):!0).map(a=>a.id)}const Q8=e=>e.manualTitle||r("填写凭证添加"),Z8=e=>e.manualNoteHtml?{html:e.manualNoteHtml}:{text:e.manualNote||""},W8=e=>e.addButton||r("添加 {name} 账号",{name:e.label}),Pw=(e,t)=>`${e.provider}-${t.inputKey||t.key}-input`,Ef="max-w-full flex-wrap [&_[data-slot=segmented-item]]:h-7 [&_[data-slot=segmented-item]]:px-3 [&_[data-slot=segmented-item]]:text-[12.5px]",J8=r("登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)");let _w=!1;async function dg(e,t){if(!_w){_w=!0,e(!0);try{await t()}finally{_w=!1,e(!1)}}}function Af({html:e,text:t}){return e?s.jsx("p",{dangerouslySetInnerHTML:{__html:e}}):s.jsx("p",{children:t||""})}function eq(e,t,a){let o;try{o=JSON.parse(t)}catch(c){return Jn(r("{name} 不是合法 JSON:{reason}",{name:e.label,reason:pu(c)}),"err"),!1}return!o||typeof o!="object"||Array.isArray(o)?(Jn(r("{name}要粘一个 JSON 对象(形如 {sample})",{name:e.label,sample:'{"codearts_provider_credential":{…}}'}),"err"),!1):(Object.assign(a,o),!0)}function tq({config:e,region:t,visible:a}){const o=e.provider,[c,d]=x.useState(!1),[f,p]=x.useState(""),h=Z8(e),b=e.fields.map(v=>Pw(e,v));async function y(){const v={provider:e.provider};e.regionOptions?.length&&(v.mode=t);for(const w of e.fields){const j=vr(Pw(e,w));if(!w.optional&&!j){Jn(r("请填写 {label}",{label:w.label}),"err");return}if(j){if(w.jsonExpand){if(!eq(w,j,v))return;continue}v[w.key]=j}}await dg(d,async()=>{try{const w=await cg(v);Mw(b),p(""),await mu(ug(w?.account),e.label)}catch(w){Jn(r("添加失败:{reason}",{reason:pu(w)}),"err")}})}return s.jsxs(zn,{hidden:!a,onClick:v=>{v.target.closest("[data-raccoon-hint]")&&(v.preventDefault(),p(J8))},children:[s.jsx("h3",{children:Q8(e)}),s.jsx(Af,{...h}),e.fields.map(v=>{const w=Pw(e,v),j=v.optional?"":r("(必填)");return s.jsxs("div",{className:`field-row${v.rows?" stack":""}`,children:[s.jsxs("label",{htmlFor:w,children:[v.label,j]}),v.rows?s.jsx(Qc,{id:w,rows:v.rows,placeholder:v.placeholder,...Aa(w)}):s.jsx($e,{id:w,type:"text",maxLength:R8(v),placeholder:v.placeholder,...Aa(w)})]},w)}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${o}-add-button`,onClick:()=>{y()},disabled:c,children:c?r("添加中…"):W8(e)}),s.jsx("span",{className:"detail",id:`${o}-add-hint`,children:f})]})]})}function nq({config:e,visible:t}){const a=e.provider,[o,c]=x.useState(!1);if(!KR(e)||!e.desktopNote)return null;async function d(){await dg(c,async()=>{try{const f=await cg({provider:e.provider,importDesktop:!0});await mu(f?.account?.name||"",e.label)}catch(f){Jn(r("导入失败:{reason}",{reason:pu(f)}),"err")}})}return s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("从本机导入桌面端登录态")}),s.jsx("p",{children:e.desktopNote}),s.jsx("div",{className:"field-row",children:s.jsx(se,{id:`${a}-desktop-button`,title:e.desktopHint,onClick:()=>{d()},disabled:o,children:r(o?"导入中…":"从本机导入桌面端登录态")})})]})}function sq({config:e,mode:t,onModeChange:a,region:o,visible:c}){const d=e.webLogin,f=e.provider,p=x.useRef(t),h=x.useRef(o),b=x.useRef(null);return p.current=t,h.current=o,x.useEffect(()=>{const y=gt().wbWebLogin;if(!y||!d)return;const v=d.modes;b.current=y.create({provider:f,buttonId:`${f}-web-button`,cancelId:`${f}-web-cancel`,hintId:`${f}-web-hint`,busyText:d.busyText,texts:()=>{const w=v?.find(j=>j.value===p.current);return{button:d.button,hint:w?.hint||d.hint||""}},start:()=>gt().workbuddyDesktop?.startLogin(d.edition||h.current||"cn",p.current||"embedded",f),onSuccess:async w=>{Ow(),await gt().wbApp?.refresh?.();const j=w?.payload?.warning;j?Jn(r("账号已添加,但请留意:{warning}",{warning:j}),"err"):Jn(r("✅ {label}账号已添加",{label:e.label}))}})??null},[]),x.useEffect(()=>{b.current?.syncTexts()},[t]),d?s.jsxs(zn,{hidden:!c,children:[s.jsx("h3",{children:r("网页登录")}),s.jsx(Af,{html:d.noteHtml}),d.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:d.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${f}-web-button`,onClick:()=>b.current?.start(),children:d.button}),s.jsx(se,{id:`${f}-web-cancel`,variant:"outline",hidden:!0,onClick:()=>b.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:`${f}-web-hint`,children:d.hint||d.modes?.[0]?.hint||""})]})]}):null}function rq({config:e,visible:t}){const a=e.smsLogin,o=e.provider;return x.useEffect(()=>{a&>().wbSmsLogin?.create({provider:o,onSuccess:c=>mu(ug(c?.account),e.label)})},[]),a?s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("手机验证码登录")}),s.jsx(Af,{html:a.noteHtml,text:r("用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。")}),s.jsxs("div",{className:"sms-form",children:[s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-phone`,children:[r("手机号"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs(Ci,{children:[s.jsx(Ei,{id:`${o}-sms-phone`,type:"text",maxLength:11,placeholder:r("11 位大陆手机号"),...Aa(`${o}-sms-phone`)}),s.jsx(Ti,{align:"inline-end",children:s.jsx(g4,{id:`${o}-sms-send`,className:"text-primary-fg",children:r("获取验证码")})})]})]}),s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-code`,children:[r("验证码"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs("div",{className:"sms-pair",children:[s.jsx($e,{id:`${o}-sms-code`,className:"sms-code",type:"text",maxLength:6,placeholder:r("6 位数字")}),s.jsx("label",{className:"lb-inline",htmlFor:`${o}-sms-name`,children:r("备注名")}),s.jsx($e,{id:`${o}-sms-name`,className:"sms-name",type:"text",placeholder:r("可选,留空则用脱敏手机号"),...Aa(`${o}-sms-name`)})]})]}),s.jsxs("div",{className:"sms-foot",children:[s.jsx(se,{id:`${o}-sms-submit`,children:r("登录并添加")}),s.jsx("span",{className:"detail sms-hint",id:`${o}-sms-hint`})]})]})]}):null}function aq({config:e,mode:t,onModeChange:a,visible:o}){const c=e.oauthLogin,d=e.provider,f=x.useRef(t),p=x.useRef(null);f.current=t;const h=()=>c?.modes?.find(b=>b.value===f.current)?.hint||c?.hint||"";return x.useEffect(()=>{const b=gt().wbAutoclawOauth;!b||!c||(p.current=b.create({provider:d,mode:()=>f.current||"embedded",hint:h,cancelId:`${d}-oauth-cancel`,onSuccess:()=>mu("",e.label)})??null)},[]),x.useEffect(()=>{p.current?.syncTexts()},[t]),c?s.jsxs(zn,{hidden:!o,children:[s.jsx("h3",{children:c.title||r("网页登录")}),s.jsx(Af,{html:c.noteHtml}),c.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:c.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${d}-oauth-zai`,children:r("使用 Zai 账号登录")}),s.jsx(se,{id:`${d}-oauth-google`,variant:"outline",children:r("使用 Google 账号登录")}),s.jsx(se,{id:`${d}-oauth-cancel`,variant:"outline",hidden:!0,children:r("取消")})]}),s.jsx("div",{className:"field-row",children:s.jsx("span",{className:"detail",id:`${d}-oauth-hint`,children:c.modes?.[0]?.hint||c.hint||""})})]}):null}function lq({config:e,active:t}){const a=e.regionOptions?.[0]?.value??"",[o,c]=x.useState(a),[d,f]=x.useState(()=>YR(e,a)[0]),[p,h]=x.useState(e.webLogin?.modes?.[0]?.value??""),[b,y]=x.useState(e.oauthLogin?.modes?.[0]?.value??""),v=YR(e,o),w=v.includes(d)?d:v[0],j=x.useMemo(()=>GR.filter(S=>v.includes(S.id)).map(S=>({value:S.id,label:S.label})),[v.join(",")]);return s.jsxs("div",{className:"add-provider-block",hidden:!t,children:[e.regionOptions?.length?s.jsxs(zn,{children:[s.jsx("h3",{children:r("地区")}),s.jsx(In,{"aria-label":r("{label} 账号地区",{label:e.label}),className:Ef,options:e.regionOptions,value:o,onValueChange:c})]}):null,s.jsxs(zn,{children:[s.jsx("h3",{children:r("添加方式")}),s.jsx(In,{"aria-label":r("{label} 账号的添加方式",{label:e.label}),className:Ef,options:j,value:w,onValueChange:S=>f(S)})]}),s.jsx(aq,{config:e,mode:b,onModeChange:y,visible:w==="oauth"}),s.jsx(rq,{config:e,visible:w==="sms"}),s.jsx(sq,{config:e,mode:p,onModeChange:h,region:o,visible:w==="web"}),s.jsx(tq,{config:e,region:o,visible:w==="manual"}),s.jsx(nq,{config:e,visible:w==="desktop"})]})}const oq=r("官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth"),fg="workbuddy-file-name";function Lw(e,t,a){const o=e[a],c=[];o&&typeof o=="object"&&!Array.isArray(o)&&c.push(o),c.push(e);for(const d of c)for(const f of t){const p=d[f];if(typeof p=="string"&&p.trim())return p.trim()}return""}function iq(e){const t=Lw(e,["domain"],"auth");return/workbuddy\.ai/i.test(t)?"intl":/workbuddy\.cn|codebuddy\.cn/i.test(t)?"cn":null}function cq({edition:e}){const[t,a]=x.useState(!1),[o,c]=x.useState(""),d=x.useRef(null);async function f(h){await dg(a,async()=>{try{let b;try{b=JSON.parse(await h.text())}catch{Jn(r("选择的文件不是合法 JSON"),"err");return}if(!b||typeof b!="object"||Array.isArray(b)){Jn(r("不是有效的凭证文件:内容要是一个 JSON 对象"),"err");return}const y=b,v=Lw(y,["accessToken","token","access_token"],"auth"),w=Lw(y,["uid"],"account");if(!v||!w){Jn(r("不是有效的凭证文件:需要包含 accessToken 与 uid"),"err");return}const j=iq(y),S=j??e;j&&j!==e&&Jn(r("文件是{edition}凭证,已按该版本导入",{edition:r(j==="intl"?"国际版":"国内版")}),"warn");const N=vr(fg),k={...y,provider:pg(S)};N&&(k.name=N);const T=await cg(k);c(""),await mu(ug(T?.account),S==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(b){Jn(r("导入失败:{reason}",{reason:pu(b)}),"err")}})}async function p(){await dg(a,async()=>{try{const h=await cg({provider:pg(e),importDesktop:!0});await mu(ug(h?.account),e==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(h){Jn(r("导入失败:{reason}",{reason:pu(h)}),"err")}})}return s.jsxs(zn,{children:[s.jsx("h3",{children:r("导入凭证文件")}),s.jsx(Af,{text:r("选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。")}),s.jsx("p",{className:"detail",children:s.jsx("a",{href:"#",onClick:h=>{h.preventDefault(),c(oq)},children:r("凭证文件在哪?")})}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"lb-inline",htmlFor:fg,children:r("备注名")}),s.jsx($e,{id:fg,type:"text",maxLength:100,placeholder:r("可选,留空则用文件里的昵称"),...Aa(fg)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("input",{ref:d,type:"file",accept:".info,.json,application/json",hidden:!0,onChange:h=>{const b=h.target.files?.[0];h.target.value="",b&&f(b)}}),s.jsx(se,{onClick:()=>d.current?.click(),disabled:t,children:r(t?"导入中…":"选择凭证文件导入")}),Iw()!=="web"?s.jsx(se,{variant:"outline",onClick:()=>{p()},disabled:t,children:r("从本机导入桌面端登录态")}):null,s.jsx("span",{className:"detail",children:o})]})]})}function pg(e){return e==="intl"?"workbuddy-intl":"workbuddy"}function uq({active:e}){const[t,a]=x.useState(zi.edition),[o,c]=x.useState(zi.loginMode),[d,f]=x.useState(zi.socialRestore),p=x.useRef(t),h=x.useRef(o),b=x.useRef(d),y=x.useRef(null);p.current=t,h.current=o,b.current=d,x.useEffect(()=>{const T=gt().wbWebLogin;T&&(y.current=T.create({get provider(){return pg(p.current)},buttonId:"web-login-button",cancelId:"web-login-cancel",hintId:"web-login-hint",busyText:r("等待网页登录…"),texts:()=>{const D=h.current==="external";return{button:r(D?"在浏览器中打开登录页":"打开网页登录"),hint:r(D?"系统浏览器打开(复用已登录账号);完成后自动加入列表":"内嵌窗口打开;完成后自动加入列表,关窗即取消等待")}},start:()=>gt().workbuddyDesktop?.startLogin(p.current,h.current,pg(p.current),b.current),onSuccess:async()=>{const D=p.current==="intl"?r("国际版"):r("国内版");Ow(),await gt().wbApp?.refresh?.(),Jn(r("✅ 登录成功,{edition}账号已加入列表",{edition:D}))}})??null)},[]),x.useEffect(()=>{y.current?.syncTexts()},[t,o]);function v(T){const D=T==="intl"?"external":"embedded";a(T),zi.edition=T,c(D),zi.loginMode=D}function w(T){const D=T==="external"?"external":"embedded";c(D),zi.loginMode=D}const j=t==="intl",N=j&&o==="embedded",k=r(N?"国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口":j?"只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页":"国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)");return s.jsxs("div",{className:"add-provider-block",hidden:!e,children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("账号版本")}),s.jsx("p",{children:r("两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。")}),s.jsx(In,{"aria-label":r("账号版本"),className:Ef,options:[{value:"cn",label:r("国内版(WorkBuddy)")},{value:"intl",label:r("国际版(WorkBuddy AI)")}],value:t,onValueChange:T=>v(T)})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("网页登录")}),s.jsx("p",{children:r("完成登录后自动加入账号列表,昵称取自上游。")}),s.jsxs("div",{className:"field-row",children:[s.jsx("span",{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("网页登录的打开方式"),className:Ef,options:[{value:"embedded",label:r("内嵌窗口")},{value:"external",label:r("系统默认浏览器")}],value:o,onValueChange:w}),s.jsxs("label",{className:"flex items-center gap-2",title:k,children:[s.jsx(hs,{checked:d,disabled:!N,onCheckedChange:T=>{f(T),zi.socialRestore=T}}),s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("恢复 Google / GitHub 入口")})]})]}),s.jsx("p",{children:r("系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。")}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:"web-login-button",onClick:()=>y.current?.start(),children:r("打开网页登录")}),s.jsx(se,{id:"web-login-cancel",variant:"outline",hidden:!0,onClick:()=>y.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:"web-login-hint",children:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")})]})]}),s.jsx(cq,{edition:t})]})}const zw="proxy",Bw="preset",mg="custom",dq="import",Rf="preset:",Hw="__new__";function fq(e){return e===Bw||e===mg?e:zw}const hg={workbuddy:"assets/providers/workbuddy.png","workbuddy-intl":"assets/providers/workbuddy.png",raccoon:"assets/providers/raccoon.png",catpaw:"assets/providers/catpaw.png",autoclaw:"assets/providers/autoclaw.png","autoclaw-intl":"assets/providers/autoclaw.png",qoder:"assets/providers/qoder.png","qoder-intl":"assets/providers/qoder.png","cline-free":"assets/providers/cline.png","cline-pass":"assets/providers/cline.png",accio:"assets/providers/accio.png","accio-cn":"assets/providers/accio.png",zcode:"assets/providers/zcode.png","zcode-intl":"assets/providers/zcode.png",codearts:"assets/providers/codearts.png",trae:"assets/providers/trae.png",loomy:"assets/providers/loomy.png",kuku:"assets/providers/kuku.png",monkeycode:"assets/providers/monkeycode.png","monkeycode-intl":"assets/providers/monkeycode.png",commandcode:"assets/providers/commandcode.png",antigravity:"assets/providers/antigravity.png",officeace:"assets/providers/officeace.png",orcaterm:"assets/providers/orcaterm.png",modelscope:"assets/providers/modelscope.png","modelscope-intl":"assets/providers/modelscope.png"},pq=new Set(["monkeycode","monkeycode-intl","commandcode","antigravity"]);function mq(e){const t=gt().wbProviders;if(e===Bw)return(gt().wbPresetProviders?.list||[]).map(h=>{const b=zR(h);return{id:Rf+h.key,label:h.name,count:b?Rw(b.id):0,preset:!0,builtId:b?.id||""}});if(e===mg)return(t?.customList?.()||[]).filter(h=>!T8(h)).map(h=>({id:h.id,label:h.name||h.id,count:Rw(h.id),custom:!0}));const a=t?.all?.()||[],o=(h,b)=>h===Bi?Dw:gt().wbProviders?.labelOf?.(h)||b,d=(a.length?a.map(h=>{const b=String(h.id||"");return{id:b,label:o(b,String(h.label||h.id||"")),count:Number(h.count)||0,beta:pq.has(b)}}):[{id:Bi,label:Dw,count:Rw(Bi)}]).filter(h=>h.id!=="workbuddy-intl"),f=d.findIndex(h=>h.id==="autoclaw-intl"),p=d.findIndex(h=>h.id==="autoclaw");return p>=0&&f>p&&d.splice(p+1,0,d.splice(f,1)[0]),d}function hq({item:e}){const t=e.id.startsWith(Rf)?gt().wbPresetProviders?.iconOf?.(e.id.slice(Rf.length))||"":hg[e.id];if(t)return s.jsx("span",{className:"add-provider-logo has-icon",children:s.jsx("img",{src:t,alt:"",loading:"lazy"})});const a=String(e.label||"?").trim().slice(0,1).toUpperCase()||"?";return s.jsx("span",{className:"add-provider-logo",children:a})}function gq(e){return e.preset?e.builtId?e.count?r("已建过 · {n} 个账号,点击继续添加",{n:e.count}):r("已建过,点击继续添加账号"):r("点开即预填,填 Key 接入"):e.custom?e.count?r("{n} 个账号,点击添加",{n:e.count}):r("点击添加账号"):e.count?r("{n} 个账号",{n:e.count}):r("还没有账号")}function xq({item:e,onPick:t}){return s.jsxs("button",{type:"button",className:"add-provider-card","data-provider":e.id,role:"option",onClick:()=>t(e.id),children:[s.jsx(hq,{item:e}),s.jsxs("span",{className:"add-provider-info",children:[s.jsxs("span",{className:"add-provider-name",children:[e.label,e.beta?s.jsx("span",{className:"add-provider-beta",children:"(beta)"}):null]}),s.jsx("span",{className:"add-provider-meta",children:gq(e)})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function bq({onPick:e}){return s.jsxs("button",{type:"button",className:"add-provider-card is-new","data-provider":Hw,role:"option",onClick:()=>e(Hw),children:[s.jsx("span",{className:"add-provider-logo is-new",children:"+"}),s.jsxs("span",{className:"add-provider-info",children:[s.jsx("span",{className:"add-provider-name",children:r("新建自定义提供商")}),s.jsx("span",{className:"add-provider-meta",children:r("接入一个兼容上游")})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function vq({accountType:e,onAccountTypeChange:t,search:a,onSearchChange:o,onPick:c,version:d,importing:f,importPanel:p}){const h=x.useMemo(()=>mq(e),[e,d]),b=a.trim().toLowerCase(),y=h.filter(w=>!b||w.label.toLowerCase().includes(b)),v=e===mg&&!b;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("选择提供商")}),s.jsxs("div",{className:"add-pick-row",style:f?{display:"none"}:void 0,children:[s.jsx(In,{"aria-label":r("账号类型"),className:Ef,options:[{value:zw,label:"Agent"},{value:Bw,label:r("预置 API")},{value:mg,label:r("自定义")}],value:e,onValueChange:w=>t(fq(w))}),s.jsx("span",{id:"add-search-wrap",className:"add-provider-search ml-auto max-w-[340px] min-w-0 flex-[1_1_200px]",children:s.jsxs(Ci,{children:[s.jsx(Ti,{children:"⌕"}),s.jsx(Ei,{id:"add-provider-search",type:"search",placeholder:r("搜索提供商…"),autoComplete:"off","aria-label":r("搜索提供商"),value:a,onChange:w=>o(w.currentTarget.value)})]})})]}),p,s.jsxs("div",{className:"add-provider-grid",id:"add-provider-grid",role:"listbox","aria-label":r("选择要添加账号的提供商"),style:f?{display:"none"}:void 0,children:[v?s.jsx(bq,{onPick:c}):null,y.map(w=>s.jsx(xq,{item:w,onPick:c},w.id)),!y.length&&b?s.jsx("div",{className:"add-provider-empty",children:r("没有匹配「{keyword}」的提供商",{keyword:a.trim()})}):null]})]})}function gg(e,t){return Pe().wbIcons?.icon?.(e,t)||""}function yq({account:e,rank:t}){const a=r("组内第 {rank} 位",{rank:t});return s.jsxs("div",{className:"order-cell",children:[s.jsx("span",{className:"order-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整组内顺序"),title:r("按住拖动,调整这个账号在本组内的顺序"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"order-rank",title:a,children:`#${t}`})]})}function wq({group:e,ids:t,collapsed:a}){const[o,c]=x.useState(!1),d="w-full justify-start px-2 font-normal";return s.jsxs(hf,{open:o,onOpenChange:c,children:[s.jsx(Hh,{render:s.jsx("button",{type:"button",className:"grp-iconbtn",title:r("本组操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[196px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("启用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!0)},children:r("全部启用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("禁用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!1)},children:r("全部禁用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("打开批量操作弹窗,并预选这一组的账号(改代理等动作在弹窗里挑参数)"),onClick:()=>{c(!1),yw(t,"proxy")},children:r("批量操作本组")}),s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:d,onClick:()=>{c(!1),JA(e.provider)},children:r(a?"展开这一组":"折叠这一组")})]})})]})}function jq({group:e,collapsed:t,colSpan:a}){const o=hg[e.provider];return s.jsx("tr",{className:"grp-band","data-provider":e.provider,children:s.jsx("td",{colSpan:a,children:s.jsxs("div",{className:"grp-band-inner",children:[s.jsx("span",{className:"queue-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整整组顺序"),title:r("按住拖动,调整这一家的组顺位(整组一起动)"),dangerouslySetInnerHTML:{__html:gg("gripVertical",14)}}),s.jsx("span",{className:"grp-rank",title:r("组顺位:越小越先用(拖动分组带调整)"),children:r("第 {rank} 顺位",{rank:e.rank})}),s.jsx("span",{className:"grp-logo",children:o?s.jsx("img",{src:o,alt:"",loading:"lazy"}):s.jsx("span",{className:"grp-logo-txt",children:String(e.label||"?").trim().slice(0,1).toUpperCase()})}),s.jsx("span",{className:"grp-name",children:e.label}),s.jsx("span",{className:"grp-stat",children:r("{total} 个账号 · 启用 {enabled} · 禁用 {disabled}{limited}",{total:e.members.length,enabled:e.enabled,disabled:e.disabled,limited:e.limited>0?r(" · 限流 {n}",{n:e.limited}):""})}),s.jsx("span",{className:"grp-spacer"}),s.jsx("button",{type:"button",className:"grp-iconbtn grp-fold","aria-expanded":!t,title:r(t?"展开这一组":"折叠这一组"),onClick:()=>JA(e.provider),dangerouslySetInnerHTML:{__html:gg("chevronDown",14)}}),s.jsx(wq,{group:e,ids:e.accounts.map(c=>c.id),collapsed:t})]})})})}function Sq({account:e}){const t=cr(e),a=o$(e);!t&&QF(e,Al(e))&&a.push({text:r("Token 限额 · 已禁用"),kind:"bad",title:r("本周期 Token 消耗达到限制器的上限,账号已被自动禁用(窗口重置也不恢复,需手动启用)")});const o=cu(e)||e.id;return s.jsxs(s.Fragment,{children:[s.jsx(hs,{checked:t,"aria-label":r("{action}{who}",{action:r(t?"禁用":"启用"),who:o}),title:r(t?"已启用,点击禁用(不参与转发)":"已禁用,点击启用"),onCheckedChange:c=>{xR(e.id,c)}}),a.length?s.jsx("div",{className:"status-tags",children:a.map(c=>s.jsx(ze,{shape:"tag",variant:c.kind==="bad"?"destructive":"secondary",title:c.title,children:c.text},c.text))}):null]})}function Nq({account:e,open:t}){const a=pw(e);if(!a.length)return Fh(e,Za(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额")}):s.jsxs(ze,{variant:"success",shape:"tag",title:r("当前没有任何模型处于限流中"),children:[s.jsx(uy,{}),r("正常")]});const o=gw(a[0].resetAt);return s.jsxs(s.Fragment,{children:[s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:t?"ring-2 ring-warning-soft":void 0,title:r("点击{action}各模型的限流明细",{action:r(t?"收起":"查看")}),onClick:()=>nR(e.id,"limits",!t),children:r("{n} 个模型 ▾",{n:a.length})}),s.jsx("span",{className:"lim-sub",title:r("最早恢复"),children:r("最早 {soonest} 恢复",{soonest:o===hw?r("待定"):o})})]})}function kq({account:e}){const t=ir(kn(e)),a=SA(t.edition?e.expiresAt:e[t.expiry]);if(!a)return s.jsx("span",{className:"muted",title:r("记录里没有过期时间"),children:"—"});const o=a-Date.now();if(o<=0)return s.jsx(ze,{variant:"destructive",shape:"tag",title:r("凭证已过期,转发时会先刷新"),children:r("已过期")});const c=o<36e5?r("{n} 分钟后",{n:Math.max(1,Math.round(o/6e4))}):o<48*36e5?r("{n} 小时后",{n:(o/36e5).toFixed(1)}):r("{n} 天后",{n:Math.floor(o/24/36e5)}),d=Fs(a);return s.jsx("span",{title:d?r("{text}过期({full})",{text:c,full:d}):r("{text}过期",{text:c}),children:c})}function Cq({account:e}){const t=iR(e.id);return t<=0?null:s.jsx("span",{className:"conn-count",title:r("{n} 个请求正在使用该账号(含还在下发内容的流式请求)",{n:t}),children:t})}function yr(e){if(e==null||e==="")return"—";const t=Number(e);return Number.isFinite(t)?String(t):String(e)}function Tq(e){return!e||typeof e!="object"||Array.isArray(e)?"":XR(e.subscription)}function XR(e){if(!e||typeof e!="object")return"";const t=e,a=[];t.planName&&a.push(r("套餐 {name}",{name:String(t.planName)})),t.status&&a.push(r("状态 {status}",{status:String(t.status)})),t.state&&String(t.state)!=="active"&&a.push(_A(t.state));const o=t.expireAt;if(o!=null&&o!==""){const c=Number(o),d=Number.isFinite(c)&&c>1e11?Fs(c):String(o);d&&a.push(r("到期 {time}",{time:d}))}return Number.isFinite(Number(t.remainQuota))&&a.push(r("余量 {value}",{value:yr(t.remainQuota)})),Number.isFinite(Number(t.totalQuota))&&a.push(r("总量 {value}",{value:yr(t.totalQuota)})),a.join(" ")}function Eq(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e.plans;return Array.isArray(t)?t.filter(a=>a&&typeof a=="object"&&String(a.state||"")==="pending"):[]}function Aq(e){const t=e.map(a=>{const o=String(a.name||a.planId||r("套餐")),c=Number(a.pendingUntil??a.startsAt);return Number.isFinite(c)&&c>0?r("{name}({time} 起生效)",{name:o,time:Fs(c*1e3)}):o});return r(`已领到、还没到生效时间的套餐(生效后余额列会按它显示): +`+u.stack}}var qn=Object.prototype.hasOwnProperty,ps=e.unstable_scheduleCallback,Gn=e.unstable_cancelCallback,bs=e.unstable_shouldYield,it=e.unstable_requestPaint,Vt=e.unstable_now,Hn=e.unstable_getCurrentPriorityLevel,tn=e.unstable_ImmediatePriority,nt=e.unstable_UserBlockingPriority,Ot=e.unstable_NormalPriority,Ft=e.unstable_LowPriority,Zn=e.unstable_IdlePriority,Un=e.log,Vn=e.unstable_setDisableYieldValue,Rn=null,Jt=null;function ls(n){if(typeof Un=="function"&&Vn(n),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Rn,n)}catch{}}var Tt=Math.clz32?Math.clz32:wt,xt=Math.log,jt=Math.LN2;function wt(n){return n>>>=0,n===0?32:31-(xt(n)/jt|0)|0}var kr=256,rr=262144,Hr=4194304;function jn(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function rl(n,l,i){var u=n.pendingLanes;if(u===0)return 0;var m=0,g=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var V=u&134217727;return V!==0?(u=V&~g,u!==0?m=jn(u):(E&=V,E!==0?m=jn(E):i||(i=V&~n,i!==0&&(m=jn(i))))):(V=u&~g,V!==0?m=jn(V):E!==0?m=jn(E):i||(i=u&~n,i!==0&&(m=jn(i)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,i=l&-l,g>=i||g===32&&(i&4194048)!==0)?l:m}function rn(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function cc(n,l){(l&8)!==0&&(l|=l&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=l;0i;i++)l.push(n);return l}function Ho(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Uo(n,l,i,u,m,g){var E=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var V=n.entanglements,ne=n.expirationTimes,me=n.hiddenUpdates;for(i=E&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yt=!1;if(lt)try{var On={};Object.defineProperty(On,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{Yt=!1}var mn=null,Mn=null,ms=null;function Cr(){if(ms)return ms;var n,l=Mn,i=l.length,u,m="value"in mn?mn.value:mn.textContent,g=m.length;for(n=0;n=Xp),YP=" ",XP=!1;function QP(n,l){switch(n){case"keyup":return Dte.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ZP(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ld=!1;function Pte(n,l){switch(n){case"compositionend":return ZP(l);case"keypress":return l.which!==32?null:(XP=!0,YP);case"textInput":return n=l.data,n===YP&&XP?null:n;default:return null}}function _te(n,l){if(ld)return n==="compositionend"||!QS&&QP(n,l)?(n=Cr(),ms=Mn=mn=null,ld=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function a_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function l_(n,l){var i=a_(n);n=0;for(var u;i;){if(i.nodeType===3){if(u=n+i.textContent.length,n<=l&&u>=l)return{node:i,offset:l-n};n=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=a_(i)}}function o_(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?o_(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function i_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=JS(n.document);l instanceof n.HTMLIFrameElement;){try{var i=typeof l.contentWindow.location.href=="string"}catch{i=!1}if(i)n=l.contentWindow;else break;l=JS(n.document)}return l}function eN(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var $te=lt&&"documentMode"in document&&11>=document.documentMode,od=null,tN=null,Jp=null,nN=!1;function c_(n,l,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;nN||od==null||od!==JS(u)||(u=od,"selectionStart"in u&&eN(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Jp&&Wp(Jp,u)||(Jp=u,u=uv(tN,"onSelect"),0>=E,m-=E,ll=1<<32-Tt(l)+m|i<rt?(Ss=st,st=null):Ss=st.sibling;var Xt=ue(pe,st,be[rt],Ae);if(Xt===null){st===null&&(st=Ss);break}n&&st&&Xt.alternate===null&&l(pe,st),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt,st=Ss}if(rt===be.length)return i(pe,st),Et&&Kl(pe,rt),Ge;if(st===null){for(;rtrt?(Ss=st,st=null):Ss=st.sibling;var gi=ue(pe,st,Xt.value,Ae);if(gi===null){st===null&&(st=Ss);break}n&&st&&gi.alternate===null&&l(pe,st),oe=g(gi,oe,rt),zt===null?Ge=gi:zt.sibling=gi,zt=gi,st=Ss}if(Xt.done)return i(pe,st),Et&&Kl(pe,rt),Ge;if(st===null){for(;!Xt.done;rt++,Xt=be.next())Xt=Re(pe,Xt.value,Ae),Xt!==null&&(oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return Et&&Kl(pe,rt),Ge}for(st=u(st);!Xt.done;rt++,Xt=be.next())Xt=je(st,pe,rt,Xt.value,Ae),Xt!==null&&(n&&(Ss=Xt.alternate,Ss!==null&&st.delete(Ss.key===null?rt:Ss.key)),oe=g(Xt,oe,rt),zt===null?Ge=Xt:zt.sibling=Xt,zt=Xt);return n&&st.forEach(function(Pse){return l(pe,Pse)}),Et&&Kl(pe,rt),Ge}function vt(pe,oe,be,Ae){if(typeof be=="object"&&be!==null&&be.type===H&&be.key===null&&be.props.ref===void 0&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case _:e:{for(var Ge=be.key;oe!==null;){if(oe.key===Ge){if(Ge=be.type,Ge===H){if(oe.tag===7){i(pe,oe.sibling),Ae=m(oe,be.props.children),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}}else if(oe.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&Rc(Ge)===oe.type){i(pe,oe.sibling),Ae=m(oe,be.props),Zo(Ae,be),Ae.return=pe,pe=Ae;break e}i(pe,oe);break}else l(pe,oe);oe=oe.sibling}be.type===H?(Ae=Sc(be.props.children,pe.mode,Ae,be.key),Zo(Ae,be),Ae.return=pe,pe=Ae):(Ae=hb(be.type,be.key,be.props,null,pe.mode,Ae),Zo(Ae,be),Ae.return=pe,pe=Ae)}return E(pe);case L:e:{for(Ge=be.key;oe!==null;){if(oe.key===Ge)if(oe.tag===4&&oe.stateNode.containerInfo===be.containerInfo&&oe.stateNode.implementation===be.implementation){i(pe,oe.sibling),Ae=m(oe,be.children||[]),Ae.return=pe,pe=Ae;break e}else{i(pe,oe);break}else l(pe,oe);oe=oe.sibling}Ae=cN(be,pe.mode,Ae),Ae.return=pe,pe=Ae}return E(pe);case F:return be=Rc(be),vt(pe,oe,be,Ae)}if(ie(be))return He(pe,oe,be,Ae);if(ae(be)){if(Ge=ae(be),typeof Ge!="function")throw Error(o(150));return be=Ge.call(be),We(pe,oe,be,Ae)}if(typeof be.then=="function")return vt(pe,oe,kb(be),Ae);if(be.$$typeof===K)return vt(pe,oe,jb(pe,be),Ae);Cb(pe,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,oe!==null&&oe.tag===6?(i(pe,oe.sibling),Ae=m(oe,be),Ae.return=pe,pe=Ae):(i(pe,oe),Ae=iN(be,pe.mode,Ae),Ae.return=pe,pe=Ae),E(pe)):i(pe,oe)}return function(pe,oe,be,Ae){try{am=0;var Ge=vt(pe,oe,be,Ae);return gd=null,Ge}catch(st){if(st===hd||st===Sb)throw st;var zt=Tr(29,st,null,pe.mode);return zt.lanes=Ae,zt.return=pe,zt}}}var Mc=D_(!0),I_=D_(!1),Wo=!1;function vN(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yN(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Jo(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ei(n,l,i){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(an&2)!==0){var m=u.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),u.pending=l,l=mb(n),x_(n,null,i),l}return pb(n,u,l,i),mb(n)}function lm(n,l,i){if(l=l.updateQueue,l!==null&&(l=l.shared,(i&4194048)!==0)){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,uc(n,i)}}function jN(n,l){var i=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var m=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var E={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?m=g=E:g=g.next=E,i=i.next}while(i!==null);g===null?m=g=l:g=g.next=l}else m=g=l;i={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=l:n.next=l,i.lastBaseUpdate=l}var wN=!1;function om(){if(wN){var n=md;if(n!==null)throw n}}function im(n,l,i,u){wN=!1;var m=n.updateQueue;Wo=!1;var g=m.firstBaseUpdate,E=m.lastBaseUpdate,V=m.shared.pending;if(V!==null){m.shared.pending=null;var ne=V,me=ne.next;ne.next=null,E===null?g=me:E.next=me,E=ne;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,V=Se.lastBaseUpdate,V!==E&&(V===null?Se.firstBaseUpdate=me:V.next=me,Se.lastBaseUpdate=ne))}if(g!==null){var Re=m.baseState;E=0,Se=me=ne=null,V=g;do{var ue=V.lane&-536870913,je=ue!==V.lane;if(je?(Lt&ue)===ue:(u&ue)===ue){ue!==0&&ue===Ec&&(wN=!0),Se!==null&&(Se=Se.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var He=n,We=V;ue=l;var vt=i;switch(We.tag){case 1:if(He=We.payload,typeof He=="function"){Re=He.call(vt,Re,ue);break e}Re=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=We.payload,ue=typeof He=="function"?He.call(vt,Re,ue):He,ue==null)break e;Re=P({},Re,ue);break e;case 2:Wo=!0}}ue=V.callback,ue!==null&&(n.flags|=64,je&&(n.flags|=8192),je=m.callbacks,je===null?m.callbacks=[ue]:je.push(ue))}else je={lane:ue,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Se===null?(me=Se=je,ne=Re):Se=Se.next=je,E|=ue;if(V=V.next,V===null){if(V=m.shared.pending,V===null)break;je=V,V=je.next,je.next=null,m.lastBaseUpdate=je,m.shared.pending=null}}while(!0);Se===null&&(ne=Re),m.baseState=ne,m.firstBaseUpdate=me,m.lastBaseUpdate=Se,g===null&&(m.shared.lanes=0),oi|=E,n.lanes=E,n.memoizedState=Re}}function P_(n,l){if(typeof n!="function")throw Error(o(191,n));n.call(l)}function __(n,l){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;ng?g:8;var E=ge.T,V={};V.types=E!==null?E.types:null,ge.T=V,VN(n,!1,l,i);try{var ne=m(),me=ge.S;if(me!==null&&me(V,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Se=tne(ne,u);fm(n,l,Se,Qr(n))}else fm(n,l,u,Qr(n))}catch(Re){fm(n,l,{then:function(){},status:"rejected",reason:Re},Qr())}finally{ee.p=g,E!==null&&V.types!==null&&(E.types=V.types),ge.T=E}}function one(){}function HN(n,l,i,u){if(n.tag!==5)throw Error(o(476));var m=mL(n).queue;pL(n,m,l,fe,i===null?one:function(){return hL(n),i(u)})}function mL(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zl,lastRenderedState:fe},next:null};var i={};return l.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zl,lastRenderedState:i},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function hL(n){var l=mL(n);l.next===null&&(l=n.alternate.memoizedState),fm(n,l.next.queue,{},Qr())}function UN(){return Gs(zd)}function gL(){return hs().memoizedState}function xL(){return hs().memoizedState}function ine(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var i=Qr();n=Jo(i);var u=ei(l,n,i);u!==null&&(Or(u,l,i),lm(u,l,i)),l={cache:hN()},n.payload=l;return}l=l.return}}function cne(n,l,i){var u=Qr();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_b(n)?vL(l,i):(i=lN(n,l,i,u),i!==null&&(Or(i,n,u),yL(i,l,u)))}function bL(n,l,i){var u=Qr();fm(n,l,i,u)}function fm(n,l,i,u){var m={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(_b(n))vL(l,m);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var E=l.lastRenderedState,V=g(E,i);if(m.hasEagerState=!0,m.eagerState=V,qr(V,E))return pb(n,l,m,0),Dn===null&&fb(),!1}catch{}if(i=lN(n,l,m,u),i!==null)return Or(i,n,u),yL(i,l,u),!0}return!1}function VN(n,l,i,u){if(u={lane:2,revertLane:Mk(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_b(n)){if(l)throw Error(o(479))}else l=lN(n,i,u,2),l!==null&&Or(l,n,2)}function _b(n){var l=n.alternate;return n===bt||l!==null&&l===bt}function vL(n,l){xd=Ab=!0;var i=n.pending;i===null?l.next=l:(l.next=i.next,i.next=l),n.pending=l}function yL(n,l,i){if((i&4194048)!==0){var u=l.lanes;u&=n.pendingLanes,i|=u,l.lanes=i,uc(n,i)}}var Lb={readContext:Gs,use:Mb,useCallback:os,useContext:os,useEffect:os,useImperativeHandle:os,useLayoutEffect:os,useInsertionEffect:os,useMemo:os,useReducer:os,useRef:os,useState:os,useDebugValue:os,useDeferredValue:os,useTransition:os,useSyncExternalStore:os,useId:os,useHostTransitionStatus:os,useFormState:os,useActionState:os,useOptimistic:os,useMemoCache:os,useCacheRefresh:os,useEffectEvent:os},jL={readContext:Gs,use:Mb,useCallback:function(n,l){return hr().memoizedState=[n,l===void 0?null:l],n},useContext:Gs,useEffect:rL,useImperativeHandle:function(n,l,i){i=i!=null?i.concat([n]):null,Ib(4194308,4,iL.bind(null,l,n),i)},useLayoutEffect:function(n,l){return Ib(4194308,4,n,l)},useInsertionEffect:function(n,l){Ib(4,2,n,l)},useMemo:function(n,l){var i=hr();l=l===void 0?null:l;var u=n();if(Dc){ls(!0);try{n()}finally{ls(!1)}}return i.memoizedState=[u,l],u},useReducer:function(n,l,i){var u=hr();if(i!==void 0){var m=i(l);if(Dc){ls(!0);try{i(l)}finally{ls(!1)}}}else m=l;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=cne.bind(null,bt,n),[u.memoizedState,n]},useRef:function(n){var l=hr();return n={current:n},l.memoizedState=n},useState:function(n){n=PN(n);var l=n.queue,i=bL.bind(null,bt,l);return l.dispatch=i,[n.memoizedState,i]},useDebugValue:zN,useDeferredValue:function(n,l){var i=hr();return BN(i,n,l)},useTransition:function(){var n=PN(!1);return n=pL.bind(null,bt,n.queue,!0,!1),hr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,i){var u=bt,m=hr();if(Et){if(i===void 0)throw Error(o(407));i=i()}else{if(i=l(),Dn===null)throw Error(o(349));(Lt&127)!==0||V_(u,l,i)}m.memoizedState=i;var g={value:i,getSnapshot:l};return m.queue=g,rL($_.bind(null,u,g,n),[n]),u.flags|=2048,vd(9,{destroy:void 0},F_.bind(null,u,g,i,l),null),i},useId:function(){var n=hr(),l=Dn.identifierPrefix;if(Et){var i=ol,u=ll;i=(u&~(1<<32-Tt(u)-1)).toString(32)+i,l="_"+l+"R_"+i,i=Rb++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}g[Rs]=l,g[qs]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)g.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=g;e:switch(Qs(g,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Jl(l)}}return Ln(l),l.subtreeFlags&=-33554433,tk(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,i),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==u&&Jl(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(o(166));if(n=he.current,pd(l)){if(n=l.stateNode,i=l.memoizedProps,u=null,m=Ls,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[Rs]=l,n=!!(n.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||$3(n.nodeValue,i)),n||Xo(l,!0)}else n=km(n).createTextNode(u),n[Rs]=l,l.stateNode=n}return Ln(l),null;case 31:if(i=l.memoizedState,n===null||n.memoizedState!==null){if(u=pd(l),i!==null){if(n===null){if(!u)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Rs]=l}else Nc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),n=!1}else i=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return l.flags&256?(Gr(l),l):(Gr(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ln(l),null;case 13:if(u=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=pd(l),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(o(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));m[Rs]=l}else Nc(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ln(l),m=!1}else m=fN(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Gr(l),l):(Gr(l),null)}return Gr(l),(l.flags&128)!==0?(l.lanes=i,l):(i=u!==null,n=n!==null&&n.memoizedState!==null,i&&(u=l.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==m&&(u.flags|=2048)),i!==n&&i&&(l.child.flags|=8192),Fb(l,l.updateQueue),Ln(l),null);case 4:return xe(),n===null&&_k(l.stateNode.containerInfo),l.flags|=67108864,Ln(l),null;case 10:return Xl(l.type),Ln(l),null;case 19:if(CN(l),u=l.memoizedState,u===null)return Ln(l),null;if(m=(l.flags&128)!==0,g=u.rendering,g===null)if(m)mm(u,!1);else{if(is!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(g=Eb(n),g!==null){for(l.flags|=128,mm(u,!1),n=g.updateQueue,l.updateQueue=n,Fb(l,n),l.subtreeFlags=0,n=i,i=l.child;i!==null;)b_(i,n),i=i.sibling;return cm(l,Ys.current&1|2),Et&&Kl(l,u.treeForkCount),l.child}n=n.sibling}u.tail!==null&&Vt()>tv&&(l.flags|=128,m=!0,mm(u,!1),l.lanes=4194304)}else{if(!m)if(n=Eb(g),n!==null){if(l.flags|=128,m=!0,n=n.updateQueue,l.updateQueue=n,Fb(l,n),mm(u,!0),u.tail===null&&u.tailMode!=="collapsed"&&u.tailMode!=="visible"&&!g.alternate&&!Et)return Ln(l),null}else 2*Vt()-u.renderingStartTime>tv&&i!==536870912&&(l.flags|=128,m=!0,mm(u,!1),l.lanes=4194304);u.isBackwards?(g.sibling=l.child,l.child=g):(n=u.last,n!==null?n.sibling=g:l.child=g,u.last=g)}if(u.tail!==null){n=u.tail;e:{for(i=n;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Vt(),n.sibling=null,g=Ys.current,g=m?g&1|2:g&1,u.tailMode==="visible"||u.tailMode==="collapsed"||!i||Et?cm(l,g):(i=g,ke(Ks,l),ke(Ys,i),lr===null&&(lr=l)),Et&&Kl(l,u.treeForkCount),n}return Ln(l),null;case 22:case 23:return Gr(l),NN(),u=l.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(i&536870912)!==0&&(l.flags&128)===0&&(Ln(l),l.subtreeFlags&6&&(l.flags|=8192)):Ln(l),i=l.updateQueue,i!==null&&Fb(l,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==i&&(l.flags|=2048),n!==null&&de(Ac),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),l.memoizedState.cache!==i&&(l.flags|=2048),Xl(ys),Ln(l),null;case 25:return null;case 30:return l.flags|=33554432,Ln(l),null}throw Error(o(156,l.tag))}function gne(n,l){switch(uN(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Xl(ys),xe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return Oe(l),null;case 31:if(l.memoizedState!==null){if(Gr(l),l.alternate===null)throw Error(o(340));Nc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Gr(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Nc()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return CN(l),n=l.flags,n&65536?(l.flags=n&-65537|128,n=l.memoizedState,n!==null&&(n.rendering=null,n.tail=null),l.flags|=4,l):null;case 4:return xe(),null;case 10:return Xl(l.type),null;case 22:case 23:return Gr(l),NN(),n!==null&&de(Ac),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return Xl(ys),null;case 25:return null;default:return null}}function GL(n,l){switch(uN(l),l.tag){case 3:Xl(ys),xe();break;case 26:case 27:case 5:Oe(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Gr(l);break;case 13:Gr(l);break;case 19:CN(l);break;case 10:Xl(l.type);break;case 22:case 23:Gr(l),NN(),n!==null&&de(Ac);break;case 24:Xl(ys)}}function hm(n,l){try{var i=l.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&n)===n){u=void 0;var g=i.create,E=i.inst;u=g(),E.destroy=u}i=i.next}while(i!==m)}}catch(V){gn(l,l.return,V)}}function ri(n,l,i){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var g=m.next;u=g;do{if((u.tag&n)===n){var E=u.inst,V=E.destroy;if(V!==void 0){E.destroy=void 0,m=l;var ne=i,me=V;try{me()}catch(Se){gn(m,ne,Se)}}}u=u.next}while(u!==g)}}catch(Se){gn(l,l.return,Se)}}function KL(n){var l=n.updateQueue;if(l!==null){var i=n.stateNode;try{__(l,i)}catch(u){gn(n,n.return,u)}}}function YL(n,l,i){i.props=Ic(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(u){gn(n,l,u)}}function il(n,l){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:var m=n.stateNode,g=$l(n.memoizedProps,m);(m.ref===null||m.ref.name!==g)&&(m.ref=t5(g)),u=m.ref;break;case 7:if(n.stateNode===null){var E=new Zr(n);b(n.child,!1,lse,E,void 0,void 0),n.stateNode=E}u=n.stateNode;break;default:u=n.stateNode}typeof i=="function"?n.refCleanup=i(u):i.current=u}}catch(V){gn(n,l,V)}}function Xs(n,l){var i=n.ref,u=n.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(m){gn(n,l,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(m){gn(n,l,m)}else i.current=null}function $b(n,l){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&l!==null)for(var i=0;i title"))),Qs(u,l,i),u[Rs]=n,vs(u),l=u;break e;case"link":if(g=b5("link","href",m).get(l+(i.href||""))){for(E=0;Evt&&(E=vt,vt=We,We=E);var pe=l_(V,We),oe=l_(V,vt);if(pe&&oe&&(je.rangeCount!==1||je.anchorNode!==pe.node||je.anchorOffset!==pe.offset||je.focusNode!==oe.node||je.focusOffset!==oe.offset)){var be=Re.createRange();be.setStart(pe.node,pe.offset),je.removeAllRanges(),We>vt?(je.addRange(be),je.extend(oe.node,oe.offset)):(be.setEnd(oe.node,oe.offset),je.addRange(be))}}}}for(Re=[],je=V;je=je.parentNode;)je.nodeType===1&&Re.push({element:je,left:je.scrollLeft,top:je.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;Vi?32:i,ge.T=null,i=wk,wk=null;var g=Va,E=ml;if(Wn=0,zc=Va=null,ml=0,(an&6)!==0)throw Error(o(331));var V=an;if(an|=4,x3(g.current),m3(g,g.current,E,i),an=V,wm(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Rn,g)}catch{}return!0}finally{ee.p=m,ge.T=u,M3(n,l)}}function D3(n,l,i){l=ga(i,l),l=qN(n.stateNode,l,2),n=ei(n,l,2),n!==null&&(Ho(n,2),hl(n))}function gn(n,l,i){if(n.tag===3)D3(n,n,i);else for(;l!==null;){if(l.tag===3){D3(l,n,i);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ii===null||!ii.has(u))){n=ga(i,n),i=AL(2),u=ei(l,i,2),u!==null&&(RL(i,u,l,n),Ho(u,2),hl(u));break}}l=l.return}}function Ak(n,l,i){var u=n.pingCache;if(u===null){u=n.pingCache=new yne;var m=new Set;u.set(l,m)}else m=u.get(l),m===void 0&&(m=new Set,u.set(l,m));m.has(i)||(vk=!0,m.add(i),n=Ene.bind(null,n,l,i),l.then(n,n))}function Ene(n,l,i){var u=n.pingCache;u!==null&&u.delete(l),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Dn===n&&(Lt&i)===i&&((is===4||is===3&&(Lt&62914560)===Lt&&300>Vt()-ev)&&(an&2)===0?Rd(n,0):Jb|=i,kd===Lt&&(kd=0)),hl(n)}function I3(n,l){l===0&&(l=fr()),n=wc(n,l),n!==null&&(Ho(n,l),hl(n))}function Ane(n){var l=n.memoizedState,i=0;l!==null&&(i=l.retryLane),I3(n,i)}function Rne(n,l){var i=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(i=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(l),I3(n,i)}function One(n,l){return ps(n,l)}var Md=null,Dd=null,Rk=!1,iv=!1,Ok=!1,ui=0;function hl(n){n!==Dd&&n.next===null&&(Dd===null?Md=Dd=n:Dd=Dd.next=n),iv=!0,Rk||(Rk=!0,Dne())}function wm(n,l){if(!Ok&&iv){Ok=!0;do for(var i=!1,u=Md;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var g=0;else{var E=u.suspendedLanes,V=u.pingedLanes;g=(1<<31-Tt(42|n)+1)-1,g&=m&~(E&~V),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,z3(u,g))}else g=Lt,g=rl(u,u===Dn?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||rn(u,g)||(i=!0,z3(u,g));u=u.next}while(i);Ok=!1}}function Mne(){P3()}function P3(){iv=Rk=!1;var n=0;ui!==0&&$ne()&&(n=ui);for(var l=Vt(),i=null,u=Md;u!==null;){var m=u.next,g=_3(u,l);g===0?(u.next=null,i===null?Md=m:i.next=m,m===null&&(Dd=i)):(i=u,(n!==0||(g&3)!==0)&&(iv=!0)),u=m}Wn!==0&&Wn!==5||wm(n),ui!==0&&(ui=0)}function _3(n,l){for(var i=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,g=n.pendingLanes&-62914561;0V)break;var Se=ne.transferSize,Re=ne.initiatorType;Se&&q3(Re)&&(ne=ne.responseEnd,E+=Se*(nepv){We.length=He;break}be=new Promise(Qne.bind(be)),We.push(be)}}}if(0"u"?null:document;function m5(n,l,i){var u=Pd;if(u&&typeof l=="string"&&l){var m=mr(l);m='link[rel="'+n+'"][href="'+m+'"]',typeof i=="string"&&(m+='[crossorigin="'+i+'"]'),p5.has(m)||(p5.add(m),n={rel:n,crossOrigin:i,href:l},u.querySelector(m)===null&&(l=u.createElement("link"),Qs(l,"link",n),vs(l),u.head.appendChild(l)))}}function hse(n){to.D(n),m5("dns-prefetch",n,null)}function gse(n,l){to.C(n,l),m5("preconnect",n,l)}function xse(n,l,i){to.L(n,l,i);var u=Pd;if(u&&n&&l){var m='link[rel="preload"][as="'+mr(l)+'"]';l==="image"&&i&&i.imageSrcSet?(m+='[imagesrcset="'+mr(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(m+='[imagesizes="'+mr(i.imageSizes)+'"]')):m+='[href="'+mr(n)+'"]';var g=m;switch(l){case"style":g=_d(n);break;case"script":g=Ld(n)}if(!(wa.has(g)||(n=P({rel:"preload",href:l==="image"&&i&&i.imageSrcSet?void 0:n,as:l},i),wa.set(g,n),u.querySelector(m)!==null||l==="style"&&u.querySelector(Tm(g))||l==="script"&&u.querySelector(Em(g))))){var E=u.createElement("link");Qs(E,"link",n),l==="style"&&(E[Os]=!0,E.onload=E.onerror=function(){zp(E)}),vs(E),u.head.appendChild(E)}}}function bse(n,l){to.m(n,l);var i=Pd;if(i&&n){var u=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+mr(u)+'"][href="'+mr(n)+'"]',g=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Ld(n)}if(!wa.has(g)&&(n=P({rel:"modulepreload",href:n},l),wa.set(g,n),i.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Em(g)))return}u=i.createElement("link"),Qs(u,"link",n),vs(u),i.head.appendChild(u)}}}function vse(n,l,i){to.S(n,l,i);var u=Pd;if(u&&n){var m=$o(u).hoistableStyles,g=_d(n);l=l||"default";var E=m.get(g);if(!E){var V={loading:0,preload:null};if(E=u.querySelector(Tm(g)))V.loading=5;else{n=P({rel:"stylesheet",href:n,"data-precedence":l},i),(i=wa.get(g))&&Wk(n,i);var ne=E=u.createElement("link");vs(ne),Qs(ne,"link",n),ne._p=new Promise(function(me,Se){ne.onload=me,ne.onerror=Se}),ne.addEventListener("load",function(){V.loading|=1}),ne.addEventListener("error",function(){V.loading|=2}),V.loading|=4,dv(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:V},m.set(g,E)}}}function yse(n,l){to.X(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Em(m)),g||(n=P({src:n,async:!0},l),(l=wa.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function jse(n,l){to.M(n,l);var i=Pd;if(i&&n){var u=$o(i).hoistableScripts,m=Ld(n),g=u.get(m);g||(g=i.querySelector(Em(m)),g||(n=P({src:n,async:!0,type:"module"},l),(l=wa.get(m))&&Jk(n,l),g=i.createElement("script"),vs(g),Qs(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(m,g))}}function h5(n,l,i,u){var m=(m=he.current)?Cm(m):null;if(!m)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=_d(i.href),l=$o(m).hoistableStyles,u=l.get(i),u||(u={type:"style",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=_d(i.href);var g=$o(m).hoistableStyles,E=g.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,E),(g=m.querySelector(Tm(n)))?g._p||(E.instance=g,E.state.loading=5):(g=wa.get(n),g||(g={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},wa.set(n,g)),wse(m,n,g,E.state))),l&&u===null)throw Error(o(528,""));return E}if(l&&u!==null)throw Error(o(529,""));return null;case"script":return l=i.async,i=i.src,typeof i=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(i=Ld(i),l=$o(m).hoistableScripts,u=l.get(i),u||(u={type:"script",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function _d(n){return'href="'+mr(n)+'"'}function Tm(n){return'link[rel="stylesheet"]['+n+"]"}function g5(n){return P({},n,{"data-precedence":n.precedence,precedence:null})}function wse(n,l,i,u){if(l=n.querySelector('link[rel="preload"][as="style"]['+l+"]")){if(l[Os]!==!0){u.loading=1;return}}else l=n.createElement("link"),l[Os]=!0,l.onload=l.onerror=zp.bind(null,l),Qs(l,"link",i),vs(l),n.head.appendChild(l);u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2})}function Ld(n){return'[src="'+mr(n)+'"]'}function Em(n){return"script[async]"+n}function x5(n,l,i){if(l.count++,l.instance===null)switch(l.type){case"style":var u=n.querySelector('style[data-href~="'+mr(i.href)+'"]');if(u)return l.instance=u,vs(u),u;var m=P({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),vs(u),Qs(u,"style",m),dv(u,i.precedence,n),l.instance=u;case"stylesheet":m=_d(i.href);var g=n.querySelector(Tm(m));if(g)return l.state.loading|=4,l.instance=g,vs(g),g;u=g5(i),(m=wa.get(m))&&Wk(u,m),g=(n.ownerDocument||n).createElement("link"),vs(g);var E=g;return E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),l.state.loading|=4,dv(g,i.precedence,n),l.instance=g;case"script":return g=Ld(i.src),(m=n.querySelector(Em(g)))?(l.instance=m,vs(m),m):(u=i,(m=wa.get(g))&&(u=P({},i),Jk(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),vs(m),Qs(m,"link",u),n.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,dv(u,i.precedence,n));return l.instance}function dv(n,l,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,g=m,E=0;E title"):null)}function Sse(n,l,i){if(i===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(n=l.disabled,typeof l.precedence=="string"&&n==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function v5(n,l){return n==="img"&&l.src!=null&&l.src!==""&&l.onLoad==null&&l.loading!=="lazy"}function y5(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function j5(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function w5(n,l){typeof l.decode=="function"&&(n.imgCount++,l.complete||(n.imgBytes+=j5(l),n.suspenseyImages.push(l)),n=Cse.bind(n),l.decode().then(n,n))}function Nse(n,l,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var m=_d(u.href),g=l.querySelector(Tm(m));if(g){l=g._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Am.bind(n),l.then(n,n)),i.state.loading|=4,i.instance=g,vs(g);return}g=l.ownerDocument||l,u=g5(u),(m=wa.get(m))&&Wk(u,m),g=g.createElement("link"),vs(g);var E=g;E._p=new Promise(function(V,ne){E.onload=V,E.onerror=ne}),Qs(g,"link",u),i.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,l),(l=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Am.bind(n),l.addEventListener("load",i),l.addEventListener("error",i))}}var pv=0;function kse(n,l){return n.stylesheets&&n.count===0&&hv(n,n.stylesheets),0pv?50:800)+l);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function S5(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)hv(n,n.stylesheets);else if(n.unsuspend){var l=n.unsuspend;n.unsuspend=null,l()}}}function Am(){this.count--,S5(this)}function Cse(){this.imgCount--,S5(this)}var mv=null;function hv(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,mv=new Map,l.forEach(Tse,n),mv=null,Am.call(n))}function Tse(n,l){if(!(l.state.loading&4)){var i=mv.get(n);if(i)var u=i.get(null);else{i=new Map,mv.set(n,i);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sj.exports=y8(),Sj.exports}var vn=j8();const ag=[20,50,100,200],lg=[20,50,100,200,"all"],fu=50,DR="workbuddy-desktop-table-size:";function IR(e){return e==="all"?r("全部"):String(e)}function og(e,t=lg,a=fu){t.includes(a)||(a=t.includes(fu)?fu:t[0]);let o=null;try{o=localStorage.getItem(DR+e)}catch{return a}if(o===null||o.trim()==="")return a;if(o==="all")return t.includes("all")?"all":a;const c=Number(o);return Number.isFinite(c)&&t.includes(c)?c:a}function ig(e,t){try{localStorage.setItem(DR+e,String(t))}catch{}}function cg(e,t,a={}){const o=a.sizes??lg,c=a.defaultSize??fu,[d,f]=x.useState(()=>og(t,o,c)),[p,h]=x.useState(1),v=Math.max(1,d==="all"?1:Math.ceil(e/d)),y=Math.min(Math.max(1,p),v);x.useEffect(()=>{y!==p&&h(y)},[y,p]);const b=x.useCallback(N=>{f(N),ig(t,N),h(1)},[t]),j=x.useCallback(N=>{h(Math.min(Math.max(1,Math.round(N)||1),v))},[v]),w=d==="all"?0:(y-1)*d,k=d==="all"?e:Math.min(e,w+d),S=x.useCallback(N=>d==="all"?N.slice():N.slice(w,k),[d,w,k]);return{size:d,page:y,pageCount:v,rangeStart:e?w+1:0,rangeEnd:e?k:0,paged:d!=="all",setSize:b,goto:j,slice:S}}function Li({total:e,page:t,pageCount:a,size:o,sizes:c=lg,onSizeChange:d,onPageChange:f,range:p=null,disabled:h=!1,leading:v,className:y}){const[b,j]=x.useState(String(t));x.useEffect(()=>j(String(t)),[t]);const w=()=>{const N=b.trim();if(!N){j(String(t));return}const T=Number(N);if(!Number.isFinite(T)){j(String(t));return}const D=Math.min(Math.max(1,Math.round(T)),a);j(String(D)),D!==t&&f(D)},k=a<=1,S=e===0?r("共 0 条"):p?r("共 {total} 条 · 当前第 {start}–{end} 条",{total:e,start:p.start,end:p.end}):r("共 {total} 条(全部显示)",{total:e});return s.jsxs("div",{className:y?`panel-foot table-foot-bar ${y}`:"panel-foot table-foot-bar",children:[v,s.jsx("div",{className:"spacer"}),s.jsxs("div",{className:"table-foot-ctl",children:[s.jsx("span",{className:"table-foot-count",children:S}),s.jsxs("span",{className:"table-foot-size",children:[r("每页"),s.jsxs(ft,{value:String(o),onValueChange:N=>d(N==="all"?"all":Number(N)),children:[s.jsx(mt,{className:"h-[26px] w-[86px]",disabled:h,"aria-label":r("每页条数"),children:s.jsx(pt,{children:IR(o)})}),s.jsx(ht,{children:c.map(N=>s.jsx(qe,{value:String(N),children:IR(N)},String(N)))})]}),r("条")]}),s.jsxs("span",{className:"table-foot-jump",children:[r("跳至"),s.jsx(Fe,{className:"h-[26px] w-[52px] px-1 text-center",value:b,disabled:h||k,"aria-label":r("跳转到指定页"),title:k?r("当前只有一页"):r("跳转到第 1–{pageCount} 页",{pageCount:a}),inputMode:"numeric",onChange:N=>j(N.target.value),onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),w()):N.key==="Escape"&&j(String(t))},onBlur:w}),r("页")]}),s.jsx(DF,{page:t,pageCount:a,onPageChange:f,disabled:h})]})]})}const Cj=[{key:"pick",label:r("选择"),align:"center",legacyAlign:"left"},{key:"order",label:r("顺序"),title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),align:"center",legacyAlign:"left"},{key:"account",label:r("账号"),align:"center",legacyAlign:"left"},{key:"proxy",label:r("代理"),title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),align:"center"},{key:"connections",label:r("连接数"),title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),align:"center"},{key:"status",label:r("状态"),align:"center",legacyAlign:"left"},{key:"limits",label:r("限流"),title:r("该账号当前限流中的模型;点徽章看明细"),align:"center",legacyAlign:"left"},{key:"expiry",label:r("有效期"),align:"center",legacyAlign:"left"},{key:"usage",label:r("余额"),align:"center",legacyAlign:"left"},{key:"actions",label:r("操作"),align:"right"}],PR="agent2api-accounts-col-widths",Tf={pick:47,order:84,proxy:186,connections:56,status:80,limits:148,expiry:80,usage:132,actions:200},Tj=new Set(["account"]),w8=300,Ej=56,S8=new Set([...Object.keys(Tf),...Tj]),pu=(()=>{try{const e=JSON.parse(localStorage.getItem(PR)||"{}"),t={};for(const[a,o]of Object.entries(e||{})){const c=Number(o);S8.has(a)&&Number.isFinite(c)&&c>=Ej&&(t[a]=Math.round(c))}return t}catch{return{}}})();function _R(){try{localStorage.setItem(PR,JSON.stringify(pu))}catch{}}function N8(){return{...Tf,...pu}}function k8(e){let t=0;for(const a of e){const o=pu[a];o?t+=o:Tj.has(a)?t+=w8:Tf[a]?t+=Tf[a]:t+=Ej}return Math.round(t)}function LR(e,t){const a=e?.querySelector(`thead th:nth-child(${t+1})`),o=a?.getAttribute("data-col")||a?.className.match(/cell-([a-z]+)/)?.[1];if(!o)return null;const c=e?.querySelector(`colgroup col[data-col="${CSS.escape(o)}"]`)||e?.querySelectorAll("colgroup col")[t];return c?{key:o,col:c}:null}function C8(e,t,a){const o=Math.max(Ej,Math.round(a));e.style.width=o+"px",Tj.has(t)||o!==Tf[t]?pu[t]=o:delete pu[t]}let Aj=()=>{};function T8(e,t){if(Aj=t,!e)return;let a=null;e.addEventListener("pointerdown",o=>{if(o.button!==0)return;const c=o.target?.closest?.(".col-grip");if(!c)return;o.preventDefault();const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);if(!h)return;const v=o.clientX,y=h.col.getBoundingClientRect().width;c.classList.add("active"),document.body.classList.add("col-resizing");try{c.setPointerCapture(o.pointerId)}catch{}a={...h,startX:v,startWidth:y,grip:c,pointerId:o.pointerId},window.addEventListener("pointermove",b),window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),window.addEventListener("blur",j);function b(w){if(a){if(w.buttons===0){j();return}C8(a.col,a.key,a.startWidth+w.clientX-a.startX)}}function j(){if(!a)return;const{grip:w,pointerId:k}=a;a=null,w.classList.remove("active"),document.body.classList.remove("col-resizing");try{w.releasePointerCapture(k)}catch{}window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",j),_R(),Aj()}}),e.addEventListener("dblclick",o=>{const c=o.target?.closest?.(".col-grip");if(!c)return;const d=c.closest("th"),f=d?.closest("table")||null,p=d?.parentElement?[...d.parentElement.children].indexOf(d):-1,h=LR(f,p);h&&(delete pu[h.key],_R(),Aj())})}function gt(){return window}function Jn(e,t){gt().wbApp?.toast?.(e,t)}function mu(e){return e instanceof Error&&e.message?e.message:String(e??"").trim()||r("未知错误")}function Rj(e){return(gt().wbApp?.getState?.()?.accounts?.accounts||[]).filter(a=>(a?.provider||"workbuddy")===e).length}function zR(e){const t=e?.name||"";if(t)return(gt().wbProviders?.customList?.()||[]).find(a=>(a.name||"")===t)}function E8(e){const t=e?.name||"";return t?(gt().wbPresetProviders?.list||[]).some(a=>a.name===t):!1}async function ug(e){const t=gt().__TAURI_INTERNALS__;if(!t||typeof t.invoke!="function")throw new Error(r("桌面运行时不可用(Tauri 未初始化)"));return t.invoke("api_request",{request:{method:"POST",path:"/api/accounts",body:e}})}function dg(e){return e?.name||e?.uid||e?.userId||""}function Oj(){gt().wbAddAccountModal?.close?.()}async function hu(e,t){Oj(),await gt().wbApp?.refresh?.(),Jn(r("✅ {label}账号已添加{name}",{label:t,name:e?`:${e}`:""}))}const gu=new Map;function Aa(e){return{defaultValue:gu.get(e)??"",onChange:t=>{const a=t.currentTarget.value;a?gu.set(e,a):gu.delete(e)}}}function No(e,t){t?gu.set(e,t):gu.delete(e);const a=document.getElementById(e);(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&(a.value=t)}function yr(e){const t=document.getElementById(e);return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value.trim():(gu.get(e)??"").trim()}function Mj(e){for(const t of e)No(t,"")}const zi={edition:"cn",loginMode:"embedded",socialRestore:!1},A8=100,R8=256,O8=e=>e.key==="name"?A8:R8,M8={provider:"raccoon",label:"小浣熊",addButton:r("添加小浣熊账号"),webLogin:{noteHtml:r("在内嵌窗口里完成官方登录,成功后自动加入账号列表。"),button:r("打开网页登录"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待"),busyText:r("等待小浣熊登录完成…")},manualTitle:r("粘贴 token / refreshToken"),manualNoteHtml:r('refreshToken 可选,填了到期可自动续期;两者都能从小浣熊客户端登录态文件里取到。'),fields:[{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用凭证里的账号名")},{key:"token",label:"token",rows:3,placeholder:r("粘贴 access_token(一长串 JWT)")},{key:"refreshToken",inputKey:"refresh",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后点「刷新 Token」同步。")},D8={provider:"catpaw",label:"CatPaw",webLogin:{noteHtml:r("用 CatPaw 账号完成登录(美团 passport),成功后自动加入账号列表。"),button:r("打开 CatPaw 网页登录"),busyText:r("等待 CatPaw 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的美团账号);完成后自动加入列表")}]},manualNote:r("token 是登录态 Cookie;CatPaw 没有刷新机制,过期后需在客户端重新登录。"),fields:[{key:"token",label:"token",rows:3,placeholder:r("CatPaw 的 X-Passport-Token(登录态 Cookie)")},{key:"uid",label:"uid",placeholder:r("必填,CatPaw 账号标识")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用登录名或 uid")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。客户端重新登录后重新导入即可。"),desktopHint:r("读取 ~/.meituan-catpaw/auth.json,需已在 CatPaw 客户端登录")},I8={provider:"autoclaw",label:r("AutoClaw 国内版"),manualNote:r("token 支持 enc: 前缀(Windows 上自动解密)。未填 refreshToken 无法自动续期。"),smsLogin:{noteHtml:r("用绑定的手机号登录:点「获取验证码」后填入即可。这是国内版官方唯一的登录方式。")},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT 或 auth.json 里的 enc: 加密值(自动解密)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0},P8={provider:"autoclaw-intl",label:r("AutoClaw 国际版"),manualNote:r("国际版与国内版账号体系独立,请填国际版的凭证。未填 refreshToken 无法自动续期。"),oauthLogin:{title:r("网页登录(Zai / Google)"),noteHtml:r("点按钮后先过一次滑块验证(官方风控),随后打开登录页,登录完成即自动添加账号。
    这是国际版官方唯一的登录方式;已在客户端登录过的,用「导入桌面端登录态」更快。"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;关窗即取消等待(Google 账号被拒时改用系统浏览器)")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Zai / Google 账号);完成后自动加入列表")}]},fields:[{key:"token",label:"token",rows:3,placeholder:r("明文 JWT(国际版账号的 access token)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("没有则无法自动续期")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选,续期时带上")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 userId")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。用 Zai / Google 登录客户端的用户走这一条。"),desktopHint:r("读取 %APPDATA%/AutoClaw/auth.json 并解密,仅 Windows"),desktopWindowsOnly:!0};function BR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开官方授权页完成设备码授权,登录的是{label}({site})的账号。",{label:a,site:o}),button:r("打开 Qoder 网页登录"),busyText:r("等待 Qoder 授权完成…"),edition:t==="qoder"?"cn":"global",modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口用全新环境,多账号互不影响;关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录账号);完成后自动加入列表")}]},manualTitle:r("使用个人访问令牌(PAT)"),manualNote:r("在{label}的 Qoder 账号设置 → Integrations 生成 PAT(别填 Google / GitHub 的令牌)。两个地区的账号与凭证不通用。",{label:a}),fields:[{key:"pat",label:"Qoder PAT",rows:3,placeholder:r("粘贴 Qoder 个人访问令牌(pt-…)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}const _8=BR({provider:"qoder",label:r("中国版"),siteNote:"qoder.com.cn"}),L8=BR({provider:"qoder-intl",label:r("国际版"),siteNote:"qoder.com"});function HR(e){const{provider:t,label:a,poolNote:o}=e;return{provider:t,label:a,desktop:!0,webLogin:{noteHtml:r("打开授权页完成确认,账号自动加入 {label}{note}",{label:a,note:o}),button:r("打开 Cline 授权页"),busyText:r("等待 Cline 授权确认…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Cline 账号);完成后自动加入列表")}]},manualTitle:r("填写凭证"),manualNote:r("refreshToken 可选,填了可自动续期;两者都能从客户端登录态文件取到。同一个 Cline 账号两个池都能用,这里归入 {label}。",{label:a}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 workos:… 开头的令牌(不带前缀也会自动补上)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号姓名、邮箱或令牌指纹")}],desktopNote:r("读本机客户端当前登录态,每次实时读取(删掉这条记录不影响客户端登录态)。这一条归入 {label}。",{label:a}),desktopHint:r("读取 ~/.cline/data/settings/providers.json,需已在 Cline 客户端登录")}}function UR(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,webLogin:{noteHtml:r("打开 Accio {label}的官方登录页({site})并用你的 Accio 账号登录:登录成功后官方页面会跳回本机;同机自动完成,Docker / 远程面板按提示粘贴回调地址即可(授权码只在本机传给网关,界面不显示明文 token)。",{label:a,site:o}),button:r("打开 Accio {label}登录页",{label:a}),busyText:r("等待 Accio {label}登录完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开登录页(会复用浏览器里已登录的 Accio 账号);完成登录后自动加入账号列表,关掉弹窗即取消等待")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Accio 的登录凭证(一长串不透明 token,不是 JWT);refreshToken 可选,填了之后到期能自动续期。请填写 {label}账号的凭证 —— {siteNote}(最容易拿到的办法:直接用上方的「网页登录」,不需要手工找 token。)",{label:a,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("粘贴 Accio 的 accessToken")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选,没有则无法自动续期")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用账号昵称或邮箱")}]}}function VR(e){const{provider:t,label:a,site:o,planNote:c}=e;return{provider:t,label:a,desktop:!1,webLogin:{noteHtml:r("打开 ZCode {label}的官方授权页并用你的账号登录。授权结果由 ZCode 服务端记录,网关在后台自动取回凭证并加入账号列表。",{label:a}),button:r("打开 ZCode {label}授权页",{label:a}),busyText:r("等待 ZCode {label}授权完成…",{label:a}),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。关掉窗口即取消等待。授权页最后可能提示无法打开 zcode:// 链接,这是正常的 —— 结果已由服务端记下")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 ZCode 账号);授权完成后自动加入账号列表。页面最后可能提示无法打开 zcode:// 链接,属正常现象")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("本家有两个**互不替代**的凭证,按你要用的功能填,至少填一个:编码套餐 API Key 用于转发推理(打 {site})与查询窗口限额(每 N 小时 / 每周的剩余比例);jwt 用于领取套餐与查询余额(打 zcode.z.ai 的 billing 网关,官方叫 Coding Plan JWT,是一串三段点分的字符串)。余额两把都能查、但读到的东西不同:jwt 读到余额桶与套餐到期,API Key 读到窗口限额;而领取只认 jwt、转发只认 API Key。请填写 {label}账号的凭证 —— {plan}(最容易拿到的办法:直接用上方的「网页登录」—— 它会替你把这个 API Key 换好,两个凭证一起拿到。)",{site:o,label:a,plan:c}),fields:[{key:"accessToken",label:r("编码套餐 API Key"),rows:3,optional:!0,placeholder:r("用于转发;形如 apiKey.secret 两段点分(不填则这个账号不能转发)")},{key:"jwt",label:"Coding Plan JWT",inputKey:"jwt",rows:3,optional:!0,placeholder:r("用于领取套餐与查询余额;不填则这个账号不能领取与查余额")},{key:"userId",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于生成账号 id 与展示名")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动生成")}]}}const z8={provider:"codearts",label:"CodeArts",desktop:!1,webLogin:{noteHtml:r("打开华为云 CodeArts 的官方授权页登录:登录完成后官方页面会把浏览器带回网关自己的 /oauth/callback,网关用一次性授权码换取临时凭据并加入账号列表。
    网关跑在另一台机器上时,网页端会提示把地址栏中的最终回调地址直接粘贴回面板。"),button:r("打开 CodeArts 授权页"),busyText:r("等待 CodeArts 登录完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;登录完成后自动加入账号列表。关掉窗口即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的华为云账号);浏览器与网关不在同一台机器时,按上方说明把最终回调地址粘贴回面板")}]},manualTitle:r("粘贴登录凭据"),manualNoteHtml:r('整份粘贴官方插件 / CLIProxyAPI 落盘的凭据 JSON(形如 {"codearts_provider_credential":{…}},铺平的也行)。
    必填:access_key_id、secret_access_key、security_token。要能自动续期,必须连 refresh_token 与 oauth_context 一起粘 —— 临时凭据约一小时到期,缺这半块就续不回来,只能重新登录。'),fields:[{key:"credentialJson",label:r("凭据 JSON"),rows:8,jsonExpand:!0,placeholder:'{"codearts_provider_credential":{"access_key_id":"HSTA…","secret_access_key":"…","security_token":"…","expires_at":"2026-09-27T16:17:00.327Z","domain_id":"…","user_id":"…","user_name":"…","refresh_token":"eyJ…","oauth_context":{…}}}'},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空使用凭据里的 user_name")}]},B8={provider:"trae",label:"Trae",desktop:!1,webLogin:{noteHtml:r("打开 Trae SOLO 的官方授权页(trae.cn)并用你的 Trae 账号登录:授权完成后官方页面会跳回本机的一个临时端口;同机部署自动接收,Docker / 远程面板请按提示复制地址栏回调地址。"),button:r("打开 Trae 授权页"),busyText:r("等待 Trae 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("将打开内嵌窗口;授权完成后自动加入账号列表。远程面板可粘贴回调地址。关掉窗口即取消等待。链接 5 分钟内有效,超时或未点就会作废(可重新发起)")},{value:"external",label:r("系统浏览器"),hint:r("将用系统默认浏览器打开授权页(会复用浏览器里已登录的 Trae 账号);同机完成后自动加入,Docker / 远程面板按提示粘贴地址栏回调地址。")}]},manualTitle:r("填写凭证"),manualNoteHtml:r("accessToken 是 Trae 的 Cloud-IDE-JWT(三段点分),refreshToken 用于到期自动续期(本家 refreshToken 一次一换:换发一次旧的即作废,所以两份程序别同时刷同一个账号)。
    手工粘贴时请连 machineId / deviceId 一起填:上游把它们与登录时上传的设备公钥绑在一起判设备,凭空换一对会撞 2xxxx 那族设备绑定拒绝。
    没有这三样时的正路是用上方的「网页登录」;容器 / 远程部署形态按提示粘贴地址栏回调地址即可。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("Cloud-IDE-JWT(三段点分)")},{key:"refreshToken",label:"refreshToken",rows:2,optional:!0,placeholder:r("可选;填了才能到期自动续期")},{key:"uid",label:r("用户 ID"),optional:!0,placeholder:r("可选;用于去重与展示名(留空时网关会问一次上游)")},{key:"machineId",label:"machineId",optional:!0,placeholder:r("可选;UUID 形态,与凭据同生共死")},{key:"deviceId",label:"deviceId",optional:!0,placeholder:r("可选;纯数字串(上游只收 8–24 位数字)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空自动用昵称")}]},H8={provider:"loomy",label:"Loomy",smsLogin:{noteHtml:r("用 Loomy 账号绑定的手机号登录:点「获取验证码」后填入即可。这是本家最省事的入口。")},manualNote:r("粘贴的是登录 session(同时是模型网关的 token)。Loomy 没有续期接口,session 有效期约 14 天,过期后重新登录即可。"),fields:[{key:"session",label:"session",rows:3,placeholder:r("登录 session(一长串)")},{key:"userId",label:"userId",optional:!0,placeholder:r("可选,讯飞侧 userid")},{key:"phone",label:r("手机号"),optional:!0,placeholder:r("可选,展示用")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用脱敏手机号或 userId")}],desktop:!1},U8={provider:"kuku",label:"KukuAI",webLogin:{noteHtml:r("在打开的窗口里用百度账号登录 KukuAI 主站(手机验证码 / 扫码均可),登录成功后自动加入账号列表。网关会向百度换发 KukuAI 业务会话令牌(依赖本机已安装库库AI 客户端)。"),button:r("打开网页登录"),busyText:r("等待 KukuAI 登录完成…")},manualTitle:r("粘贴 Cookie"),manualNote:r("BDUSS 必填;请粘贴**完整 Cookie**(Cookie 编辑器一键导出即可)—— 其中 **PTOKEN 必须保留**,网关要用它向百度换发 KukuAI 业务会话令牌,缺了它模型刷新会报「未登录」。支持整段 Cookie 头、Cookie 编辑器导出的 JSON 数组,或 {BDUSS, STOKEN} 对象。KukuAI 没有刷新机制,登录态过期后重新粘贴即可。"),fields:[{key:"cookie",label:"Cookie",rows:3,placeholder:r("BDUSS=…; STOKEN=…(或 Cookie 编辑器导出的 JSON)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号 uk")}],desktop:!0,desktopHint:r("读取本机 KukuAI 客户端登录态(%APPDATA%\\baidugenflowpro\\Network\\Cookies),需已在 KukuAI 客户端登录"),desktopNote:r("读本机客户端当前登录态(明文 Cookie,无需解密)。客户端运行时 Cookies 文件被独占占用,导入前请先关闭 KukuAI 客户端。")};function FR(e){const{provider:t,label:a,siteNote:o}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 session cookie"),manualNoteHtml:r("粘贴网页登录态 cookie monkeycode_ai_session 的值(在浏览器里复制整段 Cookie 直接粘贴也行,网关会自己剥出值)。
    {siteNote}
    MonkeyCode 没有续期接口:session 有效期约 30 天(硬限制),过期后重新登录网页、再粘贴一次即可。",{siteNote:o}),fields:[{key:"session",label:"session",rows:3,placeholder:r("monkeycode_ai_session 的值(也可直接粘贴整段 Cookie)")},{key:"imageId",label:r("任务镜像 id"),optional:!0,placeholder:r("可选:发起对话必需,留空则由网关从该账号已有任务里自动发现,发现不到时之后手动补")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游返回的账号名或账号 id")}]}}const V8=FR({provider:"monkeycode",label:r("MonkeyCode"),siteNote:r("这里填国内站(monkeycode-ai.com)的账号:请粘贴国内站的 session。国际站(monkeycode-ai.net)是另一家 provider、另一套账号,两边的凭证不通用。")}),F8=FR({provider:"monkeycode-intl",label:r("MonkeyCode 国际版"),siteNote:r("这里填国际站(monkeycode-ai.net)的账号:请粘贴国际站的 session。国内站(monkeycode-ai.com)是另一家 provider、另一套账号,两边的凭证不通用。")}),$8={provider:"commandcode",label:r("Command Code"),desktop:!1,manualTitle:r("粘贴 API Key"),manualNote:r("粘贴 Command Code 的 API Key(user_ 开头;从官方 CLI 的 ~/.commandcode/auth.json 或网页 studio 获取)。整行 / 带引号 / 带 Bearer 前缀地粘都行,网关会自己剥成裸 key。key 不过期、也没有续期接口,失效后重新获取即可;添加时网关会做一次轻量探活,失败不影响添加。"),fields:[{key:"apiKey",label:"apiKey",rows:3,placeholder:r("user_ 开头的 API Key(也可直接粘贴 Authorization: Bearer … 整行)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用 key 尾号")}]},q8={provider:"antigravity",label:r("Antigravity"),desktop:!1,webLogin:{noteHtml:r("在打开的窗口里登录 Google 账号(Antigravity 的授权页),授权完成后自动加入账号列表。"),button:r("打开 Antigravity 网页登录"),busyText:r("等待 Google 授权完成…"),modes:[{value:"embedded",label:r("内嵌窗口(推荐)"),hint:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")},{value:"external",label:r("系统浏览器"),hint:r("系统浏览器打开(复用已登录的 Google 账号);完成后自动加入列表")}]},manualTitle:r("粘贴 Google refresh token"),manualNoteHtml:r("粘贴 Antigravity 的 Google refresh token(以 1// 开头;直接粘贴含 refresh_token= 的整行也行)。
    这是网页登录之外的手工入口(例如从已登录的官方 IDE 里导出)。refresh token 不会过期,access token 到期由网关自动续期;令牌丢了只能重新走 Google 授权,请妥善保存。"),fields:[{key:"refreshToken",label:"refreshToken",rows:2,placeholder:r("1// 开头的 Google refresh token(也可直接粘贴 refresh_token=… 整行)")},{key:"projectId",label:"projectId",optional:!0,placeholder:r("可选(cloudaicompanionProject):留空由网关自动发现")},{key:"email",label:"email",optional:!0,placeholder:r("可选:账号邮箱,用于展示与身份识别(换新令牌也能认回同一账号)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用邮箱或令牌尾号")}]},G8={provider:"officeace",label:r("OfficeAce 果办"),desktop:!1,webLogin:{noteHtml:r("打开华为云授权页登录:登录完成后网关会自动轮询云端取回授权码并加入账号列表(不需要装 OfficeAce 桌面端,也无需手工回填回调地址)。"),button:r("打开授权页"),busyText:r("等待 OfficeAce 登录完成…")},manualTitle:r("粘贴网关凭据"),manualNoteHtml:r("从别的机器(或 OfficeAce 桌面端 models.json)取三项贴进来:模型网关基址(baseUrl,形如 https://modelgw-…/v2)与 modelAppKey / modelAppSecret。这三项就能转发(网关凭据不过期);控制面临时凭据(accessKeyId 等)可选,留空则额度/自动续期不可用,但不影响转发。"),fields:[{key:"baseUrl",label:r("模型网关基址"),placeholder:"https://modelgw-…huaweicloud-agentarts.com/v2"},{key:"modelAppKey",label:r("网关 Key"),placeholder:"model_app_key"},{key:"modelAppSecret",label:r("网关 Secret"),placeholder:"model_app_secret"},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空用「OfficeAce 果办」")}]},K8={provider:"orcaterm",label:"OrcaTerm",desktop:!0,desktopHint:r("读取本机 OrcaTerm 客户端登录态(%APPDATA%\\com.orcaterm-desktop.app\\data.bin),需已在 OrcaTerm 客户端登录"),desktopNote:r("读本机客户端当前登录的 OAuth 令牌(明文 JSON,无需解密)。导入后由网关自动续期,无需跟随客户端的 2 小时时效手动换令牌。"),manualTitle:r("粘贴 accessToken"),manualNoteHtml:r("粘贴 OrcaTerm 的 OAuth accessToken(JWT,三段点分;从桌面客户端 data.bin 或 Web 版 Cookie ot_session 获取)。直接粘贴含 Bearer / ot_session= 的整行也行,网关会自己剥成裸 token。添加后由网关自动续期(上游有续期接口),无需跟随 2 小时时效手动更换。"),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("JWT(三段点分;也可直接粘贴 Bearer 整行或 data.bin 内容)")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用账号昵称或 userId")}]};function $R(e){const{provider:t,label:a,site:o,siteNote:c}=e;return{provider:t,label:a,desktop:!1,manualTitle:r("粘贴 API 令牌"),manualNoteHtml:r("粘贴 ModelScope 的 API 令牌(ms- 开头,在 {site} 的「访问令牌」页获取)。
    {siteNote}
    这枚令牌两用:网关既用它调推理,也用它读账号身份、魔粒余额与每日签到。令牌长期有效、没有续期接口,失效后重新获取再粘一次即可。",{site:o,siteNote:c}),fields:[{key:"accessToken",label:"accessToken",rows:3,placeholder:r("ms- 开头的 API 令牌")},{key:"name",label:r("备注名"),optional:!0,placeholder:r("可选,留空则用上游账号昵称")}]}}const Y8=$R({provider:"modelscope",label:r("ModelScope 国内版"),site:"modelscope.cn",siteNote:r("这里填国内站(modelscope.cn)的账号:请粘贴国内站的令牌。国际站(modelscope.ai)是另一家 provider、另一套账号,两边的令牌不通用。")}),X8=$R({provider:"modelscope-intl",label:r("ModelScope 国际版"),site:"modelscope.ai",siteNote:r("这里填国际站(modelscope.ai)的账号:请粘贴国际站的令牌。国内站(modelscope.cn)是另一家 provider、另一套账号,两边的令牌不通用。")}),qR=[M8,D8,I8,P8,_8,L8,HR({provider:"cline-free",label:"Cline Free",poolNote:r("(免费额度池,模型名带 cline-free/ 前缀)。")}),HR({provider:"cline-pass",label:"Cline Pass",poolNote:r("(订阅池,模型名带 cline-pass/ 前缀,需要账号有对应订阅)。")}),UR({provider:"accio",label:r("国际版"),site:"www.accio.com",siteNote:r("国际版与国内版是**两套独立的账号**(同一账号体系的两个站点),凭证不通用。")}),UR({provider:"accio-cn",label:r("国内版"),site:"www.accio-ai.com",siteNote:r("国内版的登录站点是 www.accio-ai.com,与国际版不是同一站。")}),VR({provider:"zcode",label:r("国内版"),site:"open.bigmodel.cn",planNote:r("国内版与**国际版是两套独立的账号与套餐**,凭证与领取的套餐都不通用。")}),VR({provider:"zcode-intl",label:r("国际版"),site:"api.z.ai",planNote:r("国际版的推理站点是 api.z.ai,与国内版不是同一站;套餐也各自独立。")}),z8,B8,H8,U8,V8,F8,$8,q8,G8,K8,Y8,X8],Bi="workbuddy",xu="custom",Dj="WorkBuddy";function Q8(e){return qR.find(t=>t.provider===e)}const GR=[{id:"oauth",label:r("网页登录(Zai / Google)")},{id:"sms",label:r("手机验证码登录")},{id:"web",label:r("网页登录")},{id:"manual",label:r("填写凭证")},{id:"desktop",label:r("导入桌面端登录态")}],Ij=()=>gt().workbuddyDesktop?.platform||"";function KR(e){return!(e.desktop===!1||Ij()==="web"||e.desktopWindowsOnly&&Ij()==="macos")}function YR(e,t){return GR.filter(a=>a.id==="oauth"?!!e.oauthLogin:a.id==="sms"?!!e.smsLogin:a.id==="web"?!!e.webLogin&&(!e.webLogin?.region||t===e.webLogin.region):a.id==="desktop"?KR(e):!0).map(a=>a.id)}const Z8=e=>e.manualTitle||r("填写凭证添加"),W8=e=>e.manualNoteHtml?{html:e.manualNoteHtml}:{text:e.manualNote||""},J8=e=>e.addButton||r("添加 {name} 账号",{name:e.label}),Pj=(e,t)=>`${e.provider}-${t.inputKey||t.key}-input`,Ef="max-w-full flex-wrap [&_[data-slot=segmented-item]]:h-7 [&_[data-slot=segmented-item]]:px-3 [&_[data-slot=segmented-item]]:text-[12.5px]",eq=r("登录态文件路径:~/.box-agent/config/auth.json(Windows:C:\\Users\\<你的用户名>\\.box-agent\\config\\auth.json)");let _j=!1;async function fg(e,t){if(!_j){_j=!0,e(!0);try{await t()}finally{_j=!1,e(!1)}}}function Af({html:e,text:t}){return e?s.jsx("p",{dangerouslySetInnerHTML:{__html:e}}):s.jsx("p",{children:t||""})}function tq(e,t,a){let o;try{o=JSON.parse(t)}catch(c){return Jn(r("{name} 不是合法 JSON:{reason}",{name:e.label,reason:mu(c)}),"err"),!1}return!o||typeof o!="object"||Array.isArray(o)?(Jn(r("{name}要粘一个 JSON 对象(形如 {sample})",{name:e.label,sample:'{"codearts_provider_credential":{…}}'}),"err"),!1):(Object.assign(a,o),!0)}function nq({config:e,region:t,visible:a}){const o=e.provider,[c,d]=x.useState(!1),[f,p]=x.useState(""),h=W8(e),v=e.fields.map(b=>Pj(e,b));async function y(){const b={provider:e.provider};e.regionOptions?.length&&(b.mode=t);for(const j of e.fields){const w=yr(Pj(e,j));if(!j.optional&&!w){Jn(r("请填写 {label}",{label:j.label}),"err");return}if(w){if(j.jsonExpand){if(!tq(j,w,b))return;continue}b[j.key]=w}}await fg(d,async()=>{try{const j=await ug(b);Mj(v),p(""),await hu(dg(j?.account),e.label)}catch(j){Jn(r("添加失败:{reason}",{reason:mu(j)}),"err")}})}return s.jsxs(zn,{hidden:!a,onClick:b=>{b.target.closest("[data-raccoon-hint]")&&(b.preventDefault(),p(eq))},children:[s.jsx("h3",{children:Z8(e)}),s.jsx(Af,{...h}),e.fields.map(b=>{const j=Pj(e,b),w=b.optional?"":r("(必填)");return s.jsxs("div",{className:`field-row${b.rows?" stack":""}`,children:[s.jsxs("label",{htmlFor:j,children:[b.label,w]}),b.rows?s.jsx(Zc,{id:j,rows:b.rows,placeholder:b.placeholder,...Aa(j)}):s.jsx(Fe,{id:j,type:"text",maxLength:O8(b),placeholder:b.placeholder,...Aa(j)})]},j)}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${o}-add-button`,onClick:()=>{y()},disabled:c,children:c?r("添加中…"):J8(e)}),s.jsx("span",{className:"detail",id:`${o}-add-hint`,children:f})]})]})}function sq({config:e,visible:t}){const a=e.provider,[o,c]=x.useState(!1);if(!KR(e)||!e.desktopNote)return null;async function d(){await fg(c,async()=>{try{const f=await ug({provider:e.provider,importDesktop:!0});await hu(f?.account?.name||"",e.label)}catch(f){Jn(r("导入失败:{reason}",{reason:mu(f)}),"err")}})}return s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("从本机导入桌面端登录态")}),s.jsx("p",{children:e.desktopNote}),s.jsx("div",{className:"field-row",children:s.jsx(se,{id:`${a}-desktop-button`,title:e.desktopHint,onClick:()=>{d()},disabled:o,children:r(o?"导入中…":"从本机导入桌面端登录态")})})]})}function rq({config:e,mode:t,onModeChange:a,region:o,visible:c}){const d=e.webLogin,f=e.provider,p=x.useRef(t),h=x.useRef(o),v=x.useRef(null);return p.current=t,h.current=o,x.useEffect(()=>{const y=gt().wbWebLogin;if(!y||!d)return;const b=d.modes;v.current=y.create({provider:f,buttonId:`${f}-web-button`,cancelId:`${f}-web-cancel`,hintId:`${f}-web-hint`,busyText:d.busyText,texts:()=>{const j=b?.find(w=>w.value===p.current);return{button:d.button,hint:j?.hint||d.hint||""}},start:()=>gt().workbuddyDesktop?.startLogin(d.edition||h.current||"cn",p.current||"embedded",f),onSuccess:async j=>{Oj(),await gt().wbApp?.refresh?.();const w=j?.payload?.warning;w?Jn(r("账号已添加,但请留意:{warning}",{warning:w}),"err"):Jn(r("✅ {label}账号已添加",{label:e.label}))}})??null},[]),x.useEffect(()=>{v.current?.syncTexts()},[t]),d?s.jsxs(zn,{hidden:!c,children:[s.jsx("h3",{children:r("网页登录")}),s.jsx(Af,{html:d.noteHtml}),d.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:d.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${f}-web-button`,onClick:()=>v.current?.start(),children:d.button}),s.jsx(se,{id:`${f}-web-cancel`,variant:"outline",hidden:!0,onClick:()=>v.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:`${f}-web-hint`,children:d.hint||d.modes?.[0]?.hint||""})]})]}):null}function aq({config:e,visible:t}){const a=e.smsLogin,o=e.provider;return x.useEffect(()=>{a&>().wbSmsLogin?.create({provider:o,onSuccess:c=>hu(dg(c?.account),e.label)})},[]),a?s.jsxs(zn,{hidden:!t,children:[s.jsx("h3",{children:r("手机验证码登录")}),s.jsx(Af,{html:a.noteHtml,text:r("用 AutoClaw 账号绑定的手机号登录:点击「获取验证码」,收到短信后填入下方并登录。验证码由本机直接提交给官方接口,界面不显示 token。")}),s.jsxs("div",{className:"sms-form",children:[s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-phone`,children:[r("手机号"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs(Ci,{children:[s.jsx(Ei,{id:`${o}-sms-phone`,type:"text",maxLength:11,placeholder:r("11 位大陆手机号"),...Aa(`${o}-sms-phone`)}),s.jsx(Ti,{align:"inline-end",children:s.jsx(x4,{id:`${o}-sms-send`,className:"text-primary-fg",children:r("获取验证码")})})]})]}),s.jsxs("div",{className:"sms-field",children:[s.jsxs("label",{className:"lb",htmlFor:`${o}-sms-code`,children:[r("验证码"),s.jsx("i",{className:"req",children:"*"})]}),s.jsxs("div",{className:"sms-pair",children:[s.jsx(Fe,{id:`${o}-sms-code`,className:"sms-code",type:"text",maxLength:6,placeholder:r("6 位数字")}),s.jsx("label",{className:"lb-inline",htmlFor:`${o}-sms-name`,children:r("备注名")}),s.jsx(Fe,{id:`${o}-sms-name`,className:"sms-name",type:"text",placeholder:r("可选,留空则用脱敏手机号"),...Aa(`${o}-sms-name`)})]})]}),s.jsxs("div",{className:"sms-foot",children:[s.jsx(se,{id:`${o}-sms-submit`,children:r("登录并添加")}),s.jsx("span",{className:"detail sms-hint",id:`${o}-sms-hint`})]})]})]}):null}function lq({config:e,mode:t,onModeChange:a,visible:o}){const c=e.oauthLogin,d=e.provider,f=x.useRef(t),p=x.useRef(null);f.current=t;const h=()=>c?.modes?.find(v=>v.value===f.current)?.hint||c?.hint||"";return x.useEffect(()=>{const v=gt().wbAutoclawOauth;!v||!c||(p.current=v.create({provider:d,mode:()=>f.current||"embedded",hint:h,cancelId:`${d}-oauth-cancel`,onSuccess:()=>hu("",e.label)})??null)},[]),x.useEffect(()=>{p.current?.syncTexts()},[t]),c?s.jsxs(zn,{hidden:!o,children:[s.jsx("h3",{children:c.title||r("网页登录")}),s.jsx(Af,{html:c.noteHtml}),c.modes?.length?s.jsxs("div",{className:"flex flex-col gap-2.5 border-l-2 border-border pl-[11px]",children:[s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("{label} 网页登录的打开方式",{label:e.label}),options:c.modes,value:t,onValueChange:a})]}):null,s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:`${d}-oauth-zai`,children:r("使用 Zai 账号登录")}),s.jsx(se,{id:`${d}-oauth-google`,variant:"outline",children:r("使用 Google 账号登录")}),s.jsx(se,{id:`${d}-oauth-cancel`,variant:"outline",hidden:!0,children:r("取消")})]}),s.jsx("div",{className:"field-row",children:s.jsx("span",{className:"detail",id:`${d}-oauth-hint`,children:c.modes?.[0]?.hint||c.hint||""})})]}):null}function oq({config:e,active:t}){const a=e.regionOptions?.[0]?.value??"",[o,c]=x.useState(a),[d,f]=x.useState(()=>YR(e,a)[0]),[p,h]=x.useState(e.webLogin?.modes?.[0]?.value??""),[v,y]=x.useState(e.oauthLogin?.modes?.[0]?.value??""),b=YR(e,o),j=b.includes(d)?d:b[0],w=x.useMemo(()=>GR.filter(k=>b.includes(k.id)).map(k=>({value:k.id,label:k.label})),[b.join(",")]);return s.jsxs("div",{className:"add-provider-block",hidden:!t,children:[e.regionOptions?.length?s.jsxs(zn,{children:[s.jsx("h3",{children:r("地区")}),s.jsx(In,{"aria-label":r("{label} 账号地区",{label:e.label}),className:Ef,options:e.regionOptions,value:o,onValueChange:c})]}):null,s.jsxs(zn,{children:[s.jsx("h3",{children:r("添加方式")}),s.jsx(In,{"aria-label":r("{label} 账号的添加方式",{label:e.label}),className:Ef,options:w,value:j,onValueChange:k=>f(k)})]}),s.jsx(lq,{config:e,mode:v,onModeChange:y,visible:j==="oauth"}),s.jsx(aq,{config:e,visible:j==="sms"}),s.jsx(rq,{config:e,mode:p,onModeChange:h,region:o,visible:j==="web"}),s.jsx(nq,{config:e,region:o,visible:j==="manual"}),s.jsx(sq,{config:e,visible:j==="desktop"})]})}const iq=r("官方客户端凭证目录:Windows 是 C:\\Users\\<你的用户名>\\AppData\\Local\\CodeBuddyExtension\\Data\\Public\\auth,macOS 是 ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth"),pg="workbuddy-file-name";function Lj(e,t,a){const o=e[a],c=[];o&&typeof o=="object"&&!Array.isArray(o)&&c.push(o),c.push(e);for(const d of c)for(const f of t){const p=d[f];if(typeof p=="string"&&p.trim())return p.trim()}return""}function cq(e){const t=Lj(e,["domain"],"auth");return/workbuddy\.ai/i.test(t)?"intl":/workbuddy\.cn|codebuddy\.cn/i.test(t)?"cn":null}function uq({edition:e}){const[t,a]=x.useState(!1),[o,c]=x.useState(""),d=x.useRef(null);async function f(h){await fg(a,async()=>{try{let v;try{v=JSON.parse(await h.text())}catch{Jn(r("选择的文件不是合法 JSON"),"err");return}if(!v||typeof v!="object"||Array.isArray(v)){Jn(r("不是有效的凭证文件:内容要是一个 JSON 对象"),"err");return}const y=v,b=Lj(y,["accessToken","token","access_token"],"auth"),j=Lj(y,["uid"],"account");if(!b||!j){Jn(r("不是有效的凭证文件:需要包含 accessToken 与 uid"),"err");return}const w=cq(y),k=w??e;w&&w!==e&&Jn(r("文件是{edition}凭证,已按该版本导入",{edition:r(w==="intl"?"国际版":"国内版")}),"warn");const S=yr(pg),N={...y,provider:mg(k)};S&&(N.name=S);const T=await ug(N);c(""),await hu(dg(T?.account),k==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(v){Jn(r("导入失败:{reason}",{reason:mu(v)}),"err")}})}async function p(){await fg(a,async()=>{try{const h=await ug({provider:mg(e),importDesktop:!0});await hu(dg(h?.account),e==="intl"?"WorkBuddy AI":"WorkBuddy")}catch(h){Jn(r("导入失败:{reason}",{reason:mu(h)}),"err")}})}return s.jsxs(zn,{children:[s.jsx("h3",{children:r("导入凭证文件")}),s.jsx(Af,{text:r("选择官方客户端的登录态凭证文件(workbuddy-desktop.info / workbuddy-desktop-ai.info)或 wb2api 导出的账号 JSON(嵌套 / 扁平形均可),也可以直接从本机官方客户端读取。")}),s.jsx("p",{className:"detail",children:s.jsx("a",{href:"#",onClick:h=>{h.preventDefault(),c(iq)},children:r("凭证文件在哪?")})}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"lb-inline",htmlFor:pg,children:r("备注名")}),s.jsx(Fe,{id:pg,type:"text",maxLength:100,placeholder:r("可选,留空则用文件里的昵称"),...Aa(pg)})]}),s.jsxs("div",{className:"field-row",children:[s.jsx("input",{ref:d,type:"file",accept:".info,.json,application/json",hidden:!0,onChange:h=>{const v=h.target.files?.[0];h.target.value="",v&&f(v)}}),s.jsx(se,{onClick:()=>d.current?.click(),disabled:t,children:r(t?"导入中…":"选择凭证文件导入")}),Ij()!=="web"?s.jsx(se,{variant:"outline",onClick:()=>{p()},disabled:t,children:r("从本机导入桌面端登录态")}):null,s.jsx("span",{className:"detail",children:o})]})]})}function mg(e){return e==="intl"?"workbuddy-intl":"workbuddy"}function dq({active:e}){const[t,a]=x.useState(zi.edition),[o,c]=x.useState(zi.loginMode),[d,f]=x.useState(zi.socialRestore),p=x.useRef(t),h=x.useRef(o),v=x.useRef(d),y=x.useRef(null);p.current=t,h.current=o,v.current=d,x.useEffect(()=>{const T=gt().wbWebLogin;T&&(y.current=T.create({get provider(){return mg(p.current)},buttonId:"web-login-button",cancelId:"web-login-cancel",hintId:"web-login-hint",busyText:r("等待网页登录…"),texts:()=>{const D=h.current==="external";return{button:r(D?"在浏览器中打开登录页":"打开网页登录"),hint:r(D?"系统浏览器打开(复用已登录账号);完成后自动加入列表":"内嵌窗口打开;完成后自动加入列表,关窗即取消等待")}},start:()=>gt().workbuddyDesktop?.startLogin(p.current,h.current,mg(p.current),v.current),onSuccess:async()=>{const D=p.current==="intl"?r("国际版"):r("国内版");Oj(),await gt().wbApp?.refresh?.(),Jn(r("✅ 登录成功,{edition}账号已加入列表",{edition:D}))}})??null)},[]),x.useEffect(()=>{y.current?.syncTexts()},[t,o]);function b(T){const D=T==="intl"?"external":"embedded";a(T),zi.edition=T,c(D),zi.loginMode=D}function j(T){const D=T==="external"?"external":"embedded";c(D),zi.loginMode=D}const w=t==="intl",S=w&&o==="embedded",N=r(S?"国际版登录页默认只显示邮箱登录,勾选后恢复 Google / GitHub / X 入口":w?"只有「内嵌窗口」能恢复第三方入口:系统浏览器里我们无法改动登录页":"国内版登录页没有 Google / GitHub 入口(它用微信 / 手机号 / 邮箱登录)");return s.jsxs("div",{className:"add-provider-block",hidden:!e,children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("账号版本")}),s.jsx("p",{children:r("两版账号可同时保存,各自一份模型清单(国内版与国际版是两家提供商,可分别启用与映射)。")}),s.jsx(In,{"aria-label":r("账号版本"),className:Ef,options:[{value:"cn",label:r("国内版(WorkBuddy)")},{value:"intl",label:r("国际版(WorkBuddy AI)")}],value:t,onValueChange:T=>b(T)})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("网页登录")}),s.jsx("p",{children:r("完成登录后自动加入账号列表,昵称取自上游。")}),s.jsxs("div",{className:"field-row",children:[s.jsx("span",{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("打开方式")}),s.jsx(In,{"aria-label":r("网页登录的打开方式"),className:Ef,options:[{value:"embedded",label:r("内嵌窗口")},{value:"external",label:r("系统默认浏览器")}],value:o,onValueChange:j}),s.jsxs("label",{className:"flex items-center gap-2",title:N,children:[s.jsx(us,{checked:d,disabled:!S,onCheckedChange:T=>{f(T),zi.socialRestore=T}}),s.jsx("span",{className:"text-[12.5px] text-subtle",children:r("恢复 Google / GitHub 入口")})]})]}),s.jsx("p",{children:r("系统浏览器可复用已有登录态(国际版推荐);内嵌窗口更干净。")}),s.jsxs("div",{className:"field-row",children:[s.jsx(se,{id:"web-login-button",onClick:()=>y.current?.start(),children:r("打开网页登录")}),s.jsx(se,{id:"web-login-cancel",variant:"outline",hidden:!0,onClick:()=>y.current?.cancel(),children:r("取消等待")}),s.jsx("span",{className:"detail",id:"web-login-hint",children:r("内嵌窗口打开;完成后自动加入列表,关窗即取消等待")})]})]}),s.jsx(uq,{edition:t})]})}const zj="proxy",Bj="preset",hg="custom",fq="import",Rf="preset:",Hj="__new__";function pq(e){return e===Bj||e===hg?e:zj}const gg={workbuddy:"assets/providers/workbuddy.png","workbuddy-intl":"assets/providers/workbuddy.png",raccoon:"assets/providers/raccoon.png",catpaw:"assets/providers/catpaw.png",autoclaw:"assets/providers/autoclaw.png","autoclaw-intl":"assets/providers/autoclaw.png",qoder:"assets/providers/qoder.png","qoder-intl":"assets/providers/qoder.png","cline-free":"assets/providers/cline.png","cline-pass":"assets/providers/cline.png",accio:"assets/providers/accio.png","accio-cn":"assets/providers/accio.png",zcode:"assets/providers/zcode.png","zcode-intl":"assets/providers/zcode.png",codearts:"assets/providers/codearts.png",trae:"assets/providers/trae.png",loomy:"assets/providers/loomy.png",kuku:"assets/providers/kuku.png",monkeycode:"assets/providers/monkeycode.png","monkeycode-intl":"assets/providers/monkeycode.png",commandcode:"assets/providers/commandcode.png",antigravity:"assets/providers/antigravity.png",officeace:"assets/providers/officeace.png",orcaterm:"assets/providers/orcaterm.png",modelscope:"assets/providers/modelscope.png","modelscope-intl":"assets/providers/modelscope.png"},mq=new Set(["monkeycode","monkeycode-intl","commandcode","antigravity"]);function hq(e){const t=gt().wbProviders;if(e===Bj)return(gt().wbPresetProviders?.list||[]).map(h=>{const v=zR(h);return{id:Rf+h.key,label:h.name,count:v?Rj(v.id):0,preset:!0,builtId:v?.id||""}});if(e===hg)return(t?.customList?.()||[]).filter(h=>!E8(h)).map(h=>({id:h.id,label:h.name||h.id,count:Rj(h.id),custom:!0}));const a=t?.all?.()||[],o=(h,v)=>h===Bi?Dj:gt().wbProviders?.labelOf?.(h)||v,d=(a.length?a.map(h=>{const v=String(h.id||"");return{id:v,label:o(v,String(h.label||h.id||"")),count:Number(h.count)||0,beta:mq.has(v)}}):[{id:Bi,label:Dj,count:Rj(Bi)}]).filter(h=>h.id!=="workbuddy-intl"),f=d.findIndex(h=>h.id==="autoclaw-intl"),p=d.findIndex(h=>h.id==="autoclaw");return p>=0&&f>p&&d.splice(p+1,0,d.splice(f,1)[0]),d}function gq({item:e}){const t=e.id.startsWith(Rf)?gt().wbPresetProviders?.iconOf?.(e.id.slice(Rf.length))||"":gg[e.id];if(t)return s.jsx("span",{className:"add-provider-logo has-icon",children:s.jsx("img",{src:t,alt:"",loading:"lazy"})});const a=String(e.label||"?").trim().slice(0,1).toUpperCase()||"?";return s.jsx("span",{className:"add-provider-logo",children:a})}function xq(e){return e.preset?e.builtId?e.count?r("已建过 · {n} 个账号,点击继续添加",{n:e.count}):r("已建过,点击继续添加账号"):r("点开即预填,填 Key 接入"):e.custom?e.count?r("{n} 个账号,点击添加",{n:e.count}):r("点击添加账号"):e.count?r("{n} 个账号",{n:e.count}):r("还没有账号")}function bq({item:e,onPick:t}){return s.jsxs("button",{type:"button",className:"add-provider-card","data-provider":e.id,role:"option",onClick:()=>t(e.id),children:[s.jsx(gq,{item:e}),s.jsxs("span",{className:"add-provider-info",children:[s.jsxs("span",{className:"add-provider-name",children:[e.label,e.beta?s.jsx("span",{className:"add-provider-beta",children:"(beta)"}):null]}),s.jsx("span",{className:"add-provider-meta",children:xq(e)})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function vq({onPick:e}){return s.jsxs("button",{type:"button",className:"add-provider-card is-new","data-provider":Hj,role:"option",onClick:()=>e(Hj),children:[s.jsx("span",{className:"add-provider-logo is-new",children:"+"}),s.jsxs("span",{className:"add-provider-info",children:[s.jsx("span",{className:"add-provider-name",children:r("新建自定义提供商")}),s.jsx("span",{className:"add-provider-meta",children:r("接入一个兼容上游")})]}),s.jsx("span",{className:"add-provider-go",children:"›"})]})}function yq({accountType:e,onAccountTypeChange:t,search:a,onSearchChange:o,onPick:c,version:d,importing:f,importPanel:p}){const h=x.useMemo(()=>hq(e),[e,d]),v=a.trim().toLowerCase(),y=h.filter(j=>!v||j.label.toLowerCase().includes(v)),b=e===hg&&!v;return s.jsxs(zn,{children:[s.jsx("h3",{children:r("选择提供商")}),s.jsxs("div",{className:"add-pick-row",style:f?{display:"none"}:void 0,children:[s.jsx(In,{"aria-label":r("账号类型"),className:Ef,options:[{value:zj,label:"Agent"},{value:Bj,label:r("预置 API")},{value:hg,label:r("自定义")}],value:e,onValueChange:j=>t(pq(j))}),s.jsx("span",{id:"add-search-wrap",className:"add-provider-search ml-auto max-w-[340px] min-w-0 flex-[1_1_200px]",children:s.jsxs(Ci,{children:[s.jsx(Ti,{children:"⌕"}),s.jsx(Ei,{id:"add-provider-search",type:"search",placeholder:r("搜索提供商…"),autoComplete:"off","aria-label":r("搜索提供商"),value:a,onChange:j=>o(j.currentTarget.value)})]})})]}),p,s.jsxs("div",{className:"add-provider-grid",id:"add-provider-grid",role:"listbox","aria-label":r("选择要添加账号的提供商"),style:f?{display:"none"}:void 0,children:[b?s.jsx(vq,{onPick:c}):null,y.map(j=>s.jsx(bq,{item:j,onPick:c},j.id)),!y.length&&v?s.jsx("div",{className:"add-provider-empty",children:r("没有匹配「{keyword}」的提供商",{keyword:a.trim()})}):null]})]})}function xg(e,t){return Pe().wbIcons?.icon?.(e,t)||""}function jq({account:e,rank:t}){const a=r("组内第 {rank} 位",{rank:t});return s.jsxs("div",{className:"order-cell",children:[s.jsx("span",{className:"order-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整组内顺序"),title:r("按住拖动,调整这个账号在本组内的顺序"),dangerouslySetInnerHTML:{__html:xg("gripVertical",14)}}),s.jsx("span",{className:"order-rank",title:a,children:`#${t}`})]})}function wq({group:e,ids:t,collapsed:a}){const[o,c]=x.useState(!1),d="w-full justify-start px-2 font-normal";return s.jsxs(hf,{open:o,onOpenChange:c,children:[s.jsx(Uh,{render:s.jsx("button",{type:"button",className:"grp-iconbtn",title:r("本组操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[196px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("启用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!0)},children:r("全部启用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("禁用这一组里的全部账号(含被筛选隐藏的)"),onClick:()=>{c(!1),vR(t,!1)},children:r("全部禁用({n})",{n:t.length})}),s.jsx(se,{variant:"ghost",size:"sm",className:d,title:r("打开批量操作弹窗,并预选这一组的账号(改代理等动作在弹窗里挑参数)"),onClick:()=>{c(!1),yj(t,"proxy")},children:r("批量操作本组")}),s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:d,onClick:()=>{c(!1),JA(e.provider)},children:r(a?"展开这一组":"折叠这一组")})]})})]})}function Sq({group:e,collapsed:t,colSpan:a}){const o=gg[e.provider];return s.jsx("tr",{className:"grp-band","data-provider":e.provider,children:s.jsx("td",{colSpan:a,children:s.jsxs("div",{className:"grp-band-inner",children:[s.jsx("span",{className:"queue-grip",role:"button",tabIndex:-1,"aria-label":r("拖动调整整组顺序"),title:r("按住拖动,调整这一家的组顺位(整组一起动)"),dangerouslySetInnerHTML:{__html:xg("gripVertical",14)}}),s.jsx("span",{className:"grp-rank",title:r("组顺位:越小越先用(拖动分组带调整)"),children:r("第 {rank} 顺位",{rank:e.rank})}),s.jsx("span",{className:"grp-logo",children:o?s.jsx("img",{src:o,alt:"",loading:"lazy"}):s.jsx("span",{className:"grp-logo-txt",children:String(e.label||"?").trim().slice(0,1).toUpperCase()})}),s.jsx("span",{className:"grp-name",children:e.label}),s.jsx("span",{className:"grp-stat",children:r("{total} 个账号 · 启用 {enabled} · 禁用 {disabled}{limited}",{total:e.members.length,enabled:e.enabled,disabled:e.disabled,limited:e.limited>0?r(" · 限流 {n}",{n:e.limited}):""})}),s.jsx("span",{className:"grp-spacer"}),s.jsx("button",{type:"button",className:"grp-iconbtn grp-fold","aria-expanded":!t,title:r(t?"展开这一组":"折叠这一组"),onClick:()=>JA(e.provider),dangerouslySetInnerHTML:{__html:xg("chevronDown",14)}}),s.jsx(wq,{group:e,ids:e.accounts.map(c=>c.id),collapsed:t})]})})})}function Nq({account:e}){const t=cr(e),a=i$(e);!t&&ZF(e,Al(e))&&a.push({text:r("Token 限额 · 已禁用"),kind:"bad",title:r("本周期 Token 消耗达到限制器的上限,账号已被自动禁用(窗口重置也不恢复,需手动启用)")});const o=uu(e)||e.id;return s.jsxs(s.Fragment,{children:[s.jsx(us,{checked:t,"aria-label":r("{action}{who}",{action:r(t?"禁用":"启用"),who:o}),title:r(t?"已启用,点击禁用(不参与转发)":"已禁用,点击启用"),onCheckedChange:c=>{xR(e.id,c)}}),a.length?s.jsx("div",{className:"status-tags",children:a.map(c=>s.jsx(ze,{shape:"tag",variant:c.kind==="bad"?"destructive":"secondary",title:c.title,children:c.text},c.text))}):null]})}function kq({account:e,open:t}){const a=pj(e);if(!a.length)return $h(e,Za(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足")}):ij(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额")}):s.jsxs(ze,{variant:"success",shape:"tag",title:r("当前没有任何模型处于限流中"),children:[s.jsx(uy,{}),r("正常")]});const o=gj(a[0].resetAt);return s.jsxs(s.Fragment,{children:[s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:t?"ring-2 ring-warning-soft":void 0,title:r("点击{action}各模型的限流明细",{action:r(t?"收起":"查看")}),onClick:()=>nR(e.id,"limits",!t),children:r("{n} 个模型 ▾",{n:a.length})}),s.jsx("span",{className:"lim-sub",title:r("最早恢复"),children:r("最早 {soonest} 恢复",{soonest:o===hj?r("待定"):o})})]})}function Cq({account:e}){const t=ir(kn(e)),a=SA(t.edition?e.expiresAt:e[t.expiry]);if(!a)return s.jsx("span",{className:"muted",title:r("记录里没有过期时间"),children:"—"});const o=a-Date.now();if(o<=0)return s.jsx(ze,{variant:"destructive",shape:"tag",title:r("凭证已过期,转发时会先刷新"),children:r("已过期")});const c=o<36e5?r("{n} 分钟后",{n:Math.max(1,Math.round(o/6e4))}):o<48*36e5?r("{n} 小时后",{n:(o/36e5).toFixed(1)}):r("{n} 天后",{n:Math.floor(o/24/36e5)}),d=Fs(a);return s.jsx("span",{title:d?r("{text}过期({full})",{text:c,full:d}):r("{text}过期",{text:c}),children:c})}function Tq({account:e}){const t=iR(e.id);return t<=0?null:s.jsx("span",{className:"conn-count",title:r("{n} 个请求正在使用该账号(含还在下发内容的流式请求)",{n:t}),children:t})}function jr(e){if(e==null||e==="")return"—";const t=Number(e);return Number.isFinite(t)?String(t):String(e)}function Eq(e){return!e||typeof e!="object"||Array.isArray(e)?"":XR(e.subscription)}function XR(e){if(!e||typeof e!="object")return"";const t=e,a=[];t.planName&&a.push(r("套餐 {name}",{name:String(t.planName)})),t.status&&a.push(r("状态 {status}",{status:String(t.status)})),t.state&&String(t.state)!=="active"&&a.push(_A(t.state));const o=t.expireAt;if(o!=null&&o!==""){const c=Number(o),d=Number.isFinite(c)&&c>1e11?Fs(c):String(o);d&&a.push(r("到期 {time}",{time:d}))}return Number.isFinite(Number(t.remainQuota))&&a.push(r("余量 {value}",{value:jr(t.remainQuota)})),Number.isFinite(Number(t.totalQuota))&&a.push(r("总量 {value}",{value:jr(t.totalQuota)})),a.join(" ")}function Aq(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e.plans;return Array.isArray(t)?t.filter(a=>a&&typeof a=="object"&&String(a.state||"")==="pending"):[]}function Rq(e){const t=e.map(a=>{const o=String(a.name||a.planId||r("套餐")),c=Number(a.pendingUntil??a.startsAt);return Number.isFinite(c)&&c>0?r("{name}({time} 起生效)",{name:o,time:Fs(c*1e3)}):o});return r(`已领到、还没到生效时间的套餐(生效后余额列会按它显示): {lines}`,{lines:t.join(` -`)})}function Rq(e){if(e===void 0)return{text:r("未查询"),kind:"muted",title:r("尚未查询该账号的余额")};if(e===null)return{text:r("查询中…"),kind:"muted",title:r("正在查询")};const t=uu(e);if(t)return t.notConfigured?{text:r("未配置"),kind:"muted",title:r("{message}(去该账号的「设置」里填上查询凭证即可)",{message:t.message})}:{text:r("查询失败"),kind:"bad",title:t.message};if(typeof e!="object"||e===null)return{text:r("无数据"),kind:"muted",title:String(e)};const a=e;if(Object.prototype.hasOwnProperty.call(a,"totalLeft")){const o=a.unlimited?"∞":yr(a.totalLeft);return{text:r("可用 {total}",{total:o}),kind:"ok",title:r("总剩余 {total} · 套餐 {plan} · 奖励 {bonus}",{total:o,plan:yr(a.planLeft),bonus:yr(a.bonusLeft)})}}if(Object.prototype.hasOwnProperty.call(a,"available")||Array.isArray(a.wallets)){const o=String(a.unit||r("积分")),c=Array.isArray(a.wallets)?a.wallets:[],d=c.map(w=>`${w?.displayName||w?.type||r("明细")} ${w?.balanceView?String(w.balanceView):yr(w?.balance)}`).join(" · "),f=XR(a.subscription),p=[];if(c.length===0&&Array.isArray(a.plans)&&a.plans.length>0){const w=QR(a);p.push(w&&ZR(w)?r("读数里没有额度桶,这里按套餐权益里的已用 / 总量显示(上游给的数)"):r("上游的余额读数里没有这个套餐的额度桶,剩余量读不到;余额列显示的是套餐发放的权益额度,不是剩余量"))}String(a.walletsFrom||"")==="monitor"&&p.push(r("额度窗口读数来自开放平台监控通道(套餐 JWT 那条通道没有额度桶):读的是每 N 小时 / 每周窗口的剩余比例"));const h=a.available==null?c.find(w=>w?.balance!=null):void 0,b=a.availableView?String(a.availableView):h?r("可用 {value} {unit}",{value:yr(h.balance),unit:String(h.unit||o)}):r("可用 {value} {unit}",{value:yr(a.available),unit:o}),y=[a.statisticsError?r("订阅统计未读到:{error}",{error:String(a.statisticsError)}):"",a.benefitError?r("福利网关未读到:{error}",{error:String(a.benefitError)}):""].filter(Boolean),v=a.benefitAbsent?[r("该账号没有福利模型额度(福利按活动下发,不是每个账号都有)")]:[];return{text:b+(y.length?" ⚠":""),kind:y.length?"warn":"ok",title:[b,d,f,...p,...v,...y].filter(Boolean).join(" · ")}}return{text:r("无数据"),kind:"muted",title:r("未返回可识别的余额数据")}}function QR(e){const t=Array.isArray(e.plans)?e.plans:[],a=o=>String(o?.state||"");return t.find(o=>a(o)==="active")||t.find(o=>a(o)==="pending")||t[0]||null}function Oq(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];let a=null;for(const o of t){const c=Number(o?.grantUnits);if(!Number.isFinite(c)||c<=0)continue;const d=String(o?.unitType||"").trim();(!a||c>a.units)&&(a={units:c,unit:d})}return a}function ZR(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];for(const a of t){const o=Dr(a?.totalUnits);if(o===null||o<=0)continue;const c=Dr(a?.usedUnits),d=Dr(a?.remainingUnits),f=c===null?d===null?null:Math.max(0,o-d):c;if(f!==null)return{used:f,total:o,unit:String(a?.unitType||"").trim()}}return null}function Mq(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,a=Array.isArray(t.wallets)?t.wallets:[];let o=null;for(const p of a){const h=Number(p?.total);!Number.isFinite(h)||h<=0||(!o||h>Number(o.total))&&(o=p)}const c=t.subscription&&typeof t.subscription=="object"?t.subscription:{};if(!o){let p=null;for(const w of a){const j=Dr(w?.remainingPercent);j!==null&&(!p||j0,N=S?Math.max(0,Math.min(100,y/v*100)):null;c.push({name:b,view:S?r("剩 {remaining} / {total}",{remaining:yr(y),total:yr(v)}):r("剩 {remaining}",{remaining:yr(y)}),tone:y<=0?"muted":N!==null&&N<20?"warn":"ok",percent:N,over:!1,title:S?void 0:r("上游未给总量,画不出剩余比例")});continue}if(j!==null||Dr(h.allowanceTokens)!==null){const S=Dr(h.usedTokens)??0,N=Dr(h.allowanceTokens),k=N!==null&&N>1,T=k&&S>N,D=h.unlimited===!0,C=k?Math.max(0,Math.min(100,(1-S/N)*100)):null,A=D?r("无上限 · 已用 {used}",{used:No(S)}):k?r("剩 {remaining} / {total}",{remaining:No(Math.max(0,N-S)),total:No(N)}):S>0?r("已用 {used}",{used:No(S)}):r("未使用");d.push({name:Iq(b),view:A,tone:T?"bad":!k&&!D?"muted":C!==null&&C<20?"warn":"ok",percent:C,over:T,title:[w,D?r("无上限按日计(上游到达上限后仍继续计数,超额如实显示)"):null].filter(Boolean).join(" · ")});continue}d.push({name:b,view:w,tone:"muted",percent:null,over:!1,title:w})}const f=t.subscription&&typeof t.subscription=="object"?t.subscription:{},p=[t.statisticsError?r("订阅统计未读到:{error}",{error:String(t.statisticsError)}):"",t.benefitError?r("福利网关未读到:{error}",{error:String(t.benefitError)}):""].filter(Boolean);return{credit:c,token:d,total:Dr(t.available),unit:o,plan:s$(f.planName),free:zA(f.planName),resetDate:String(f.resetDate||""),missing:p,benefitAbsent:t.benefitAbsent===!0}}function _q(e){const t=Al(e);let a=null;for(const v of YF(e)){if(v.enabled===!1)continue;const w=xf(v,t);if(!w)continue;const j=v.threshold>0?w.used/v.threshold:0;if(j>=1){a={rule:v,reading:w,ratio:j};break}(!a||j>a.ratio)&&(a={rule:v,reading:w,ratio:j})}if(!a)return null;const{rule:o,reading:c}=a,d=c.used>=o.threshold,f=cw(o),p=d?"":` · ${$h(f.remainingMs,f.daily)}`,h=f.daily?r("今日已用"):r("周期 Token"),b=o.reset==="daily"?r("今天(本地 0 点重置)"):r("{period}窗口",{period:OA(o.period??0)}),y=r("限制器:{window}已用 {used} / {threshold} Token",{window:b,used:Math.round(c.used).toLocaleString("en-US"),threshold:Math.round(o.threshold).toLocaleString("en-US")})+(d?r(",已达到上限"):r(",{countdown}重置",{countdown:$h(f.remainingMs,f.daily)}));return s.jsxs("span",{className:"usage-token-sub",title:y,children:[h," ",s.jsx("span",{className:d?"hit":void 0,children:Tl(c.used)})," ","/ ",Tl(o.threshold),p]})}function Lq({account:e}){if(!Ta(e))return s.jsx("span",{className:"muted",title:r("该提供商没有余额查询"),children:"—"});const t=Za(e),a=Rq(t),o=Fh(e,t)?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足 · 已跳过")}):iw(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额 · 已跳过")}):null,c=_q(e),d=a.kind==="ok"||a.kind==="warn"?Eq(t):[],f=d.length?s.jsx(ze,{variant:"warning",shape:"tag",title:Aq(d),children:r("待生效 {n} 份",{n:d.length})}):null,p=a.kind==="ok"||a.kind==="warn"?PF(t):[],h=LA(e)&&p.length?{rows:p,subscriptionLine:Tq(t),kind:a.kind,title:a.title}:null,b=a.kind==="ok"||a.kind==="warn"?Dq(t):[];if(b.length)return s.jsxs("span",{className:"usage-cell",title:a.title,children:[b.map(w=>s.jsx(WR,{row:w},w.name)),o,f,c]});if(n$(e)){const j=a.kind==="ok"||a.kind==="warn"?Pq(t):null;return j?s.jsx(zq,{summary:a,detail:j,blockedBadge:o,tokenSub:c}):s.jsxs("span",{className:"usage-sum-wrap",children:[s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]})}const y=a.kind==="ok"||a.kind==="warn"?Mq(t):null;if(!y)return s.jsxs("span",{className:"usage-sum-wrap",children:[h?s.jsx(yA,{variant:"sum",...h,children:a.text}):s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]});const v=s.jsxs(s.Fragment,{children:[y.percent!==null?s.jsx(tf,{value:y.percent,className:"usage-pool-bar"}):null,s.jsx("span",{className:`usage-pool-view ${a.kind}`,children:y.text})]});return s.jsxs("span",{className:"usage-pool",title:a.title,children:[y.planName?s.jsx("span",{className:"usage-pool-name",children:y.planName}):null,h?s.jsx(yA,{variant:"pool",...h,children:v}):s.jsx("span",{className:"usage-pool-line",children:v}),o,f,c]})}function zq({summary:e,detail:t,blockedBadge:a,tokenSub:o}){const[c,d]=x.useState(!1),f=e.kind==="ok"||e.kind==="warn";return s.jsxs("span",{className:c?"usage-cell open":"usage-cell",children:[s.jsxs("span",{className:"usage-plan",children:[t.plan?s.jsx("span",{className:`plan-chip${t.free?" free":""}`,children:t.plan}):null,t.resetDate?s.jsx("span",{className:"plan-sub",title:r("套餐积分的重置日期"),children:r("重置 {date}",{date:t.resetDate})}):null]}),s.jsxs(hf,{open:c,onOpenChange:d,children:[s.jsxs(Hh,{render:s.jsx("button",{type:"button",className:`usage-toggle ${e.kind}`,title:e.title,"aria-label":r("积分明细")}),children:[s.jsx("span",{className:"val",children:e.text}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsxs(gf,{align:"end",sideOffset:6,className:"usage-pop w-[288px]",children:[f&&t.missing.length?t.missing.map(p=>s.jsx("div",{className:"usage-pop-missing",title:p,children:p},p)):null,t.credit.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"usage-pop-group",children:r("积分")}),t.credit.map(p=>s.jsx(Bq,{row:p},p.name))]}):null,t.total!==null?s.jsxs("div",{className:"usage-pop-total",children:[s.jsx("span",{className:"k",children:r("可用合计")}),s.jsxs("span",{className:"v",children:[yr(t.total)," ",s.jsx("small",{children:t.unit})]})]}):null,!t.credit.length&&t.total===null?s.jsx("div",{className:"usage-pop-empty",title:r("该账号的额度只有福利 token 池(见余额格那两行),订阅统计没有积分类计量表"),children:r("该账号没有积分类读数(额度只有福利 token 池)")}):null]})]}),t.token.map(p=>s.jsx(WR,{row:p},p.name)),t.benefitAbsent?s.jsxs("span",{className:"usage-flat-line",title:r("福利按限时活动下发,不是每个账号都有 —— 正常状态,不是查询失败"),children:[s.jsx("span",{className:"usage-flat-name",children:r("福利日额度")}),s.jsx("span",{className:"usage-flat-view muted",children:r("无福利额度")})]}):null,a,o]})}function Bq({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.percent!==null?s.jsx("span",{className:`usage-pop-track${e.over?" over":""}`,children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function Hq({account:e,namesHidden:t}){const a=Vh(e),o=ir(kn(e)),c=cu(e)||r("未命名账号"),d=String(e.email||"").trim(),f=String(e.nickname||"").trim(),p=String(e.name||"").trim(),h=j=>t?S$(j):j,b=[d&&d!==c?r("邮箱 {email}",{email:h(d)}):"",a?`${o.identifier} ${a}`:"",!e.nameCustom&&p&&p!==d&&p!==f?r("备注名 {name}",{name:h(p)}):"",f&&f!==c&&f!==d?r("昵称 {name}",{name:h(f)}):"",bf(e)?r("桌面端实时登录态(凭证每次从客户端登录态文件读取)"):"",e.updatedAt?r("更新于 {time}",{time:Fs(e.updatedAt)}):"",e.source?r("来源 {source}",{source:e.source==="imported"?r("旧数据导入"):r("手动添加")}):""].filter(Boolean),y=d&&d!==c,v=e.proxy?.error,w=b.length?s.jsx(QU,{delay:0,children:s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("div",{className:"acct-name"}),children:s.jsx("span",{className:"name",children:h(c)})}),s.jsxs(_i,{children:[s.jsx(ZU,{}),b.map((j,S)=>s.jsx("div",{children:j},S))]})]})}):s.jsx("div",{className:"acct-name",children:s.jsx("span",{className:"name",children:h(c)})});return s.jsxs(s.Fragment,{children:[w,y?s.jsx("div",{className:"acct-sub",children:s.jsx("span",{className:"acct-email",title:r("账号邮箱"),children:h(d)})}):null,v?s.jsx("div",{className:"acct-note bad",title:r("代理不可用:{error}",{error:v}),children:r("代理不可用:{error}",{error:v})}):null]})}function Uq({account:e}){const t=e.proxy,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=t?.error,d=C$(),f=Array.isArray(d)?d:[];let p="";a==="pool"&&t?.config?.proxyId?p=`${Xa}${t.config.proxyId}`:t&&(p=ng);const h=[{value:"",label:r("直连")}];for(const v of f)h.push({value:`${Xa}${v.id}`,label:au(v)});if(d===null?h.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):f.length||h.push({value:"__hint_pool__",label:T$()?r("代理列表读取失败(重试中)"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),p===ng){const v=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";h.push({value:ng,label:`${v}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!f.some(v=>`${Xa}${v.id}`===p)&&h.push({value:p,label:`${o}${c?r("(不可用)"):""}`});h.push({value:yR,label:r("自定义代理…")});const b=c?r("代理不可用:{error}(转发时会回退直连);选「自定义代理…」去修改",{error:c}):a==="rotate"?r("当前:{label}(每条请求换一个出口);「自定义代理…」打开完整设置",{label:o}):a==="clash"||a==="custom"?r("当前:{label}(未经过代理池 —— 可在「网络代理」页把出口同步进池后来这里改选)",{label:o}):r("当前:{label};选项来自「网络代理」页;「自定义代理…」打开完整设置",{label:t?o:r("直连")}),y=h.find(v=>v.value===p);return s.jsxs(ft,{value:p,onValueChange:v=>{L$(e.id,String(v),p)},children:[s.jsx(mt,{className:Ue("w-full",c&&"border-destructive-bd"),title:b,"aria-label":r("出网代理"),children:s.jsx(pt,{children:y?.label||r("直连")})}),s.jsx(ht,{children:h.map(v=>s.jsx(qe,{value:v.value,disabled:v.disabled,children:v.label},v.value))})]})}function Vq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=Ta(e),d=IA(e);return s.jsxs("div",{className:"acct-actions",children:[d?s.jsx(se,{variant:"outline",size:"xs",title:e$(e)?t$(e):r("查看可领取的套餐与名下已有的套餐(每天一期,领取需过一次人机验证)"),onClick:()=>wR(e.id),children:r("领套餐")}):null,c?s.jsx(se,{variant:"outline",size:"xs",disabled:a,title:r("查询该账号剩余余额(读数显示在余额列)"),onClick:()=>{o(!0),P$(e.id).finally(()=>o(!1))},children:r("余额")}):null,s.jsx(se,{variant:"outline",size:"xs",title:r("备注名 / 启用 / 代理"),onClick:()=>Jh(e.id),children:r("设置")}),s.jsx(Fq,{account:e,atFront:t})]})}function Fq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=cr(e),d=Number(e.maxConcurrent)||0,f="w-full justify-start px-2 font-normal",p=`${f} text-destructive hover:text-destructive`;return s.jsxs(hf,{open:a,onOpenChange:o,children:[s.jsx(Hh,{render:s.jsx(se,{variant:"outline",size:"xs",title:r("更多操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[172px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:p,onClick:()=>{o(!1),xR(e.id,!c)},children:r(c?"禁用":"启用")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,disabled:t,title:r(t?"已在全局队列第一位":"仅将优先级调整到全局第一位,不改变启用状态"),onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("switch",e.id)},children:r("设为首选")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,title:r("在账号设置的「基本」分组里设置该账号同时最多处理的请求数"),onClick:()=>{o(!1),Jh(e.id)},children:r("并发上限:{value}",{value:d>0?d:r("不限")})}),e.hasRefreshToken?s.jsx(se,{variant:"ghost",size:"sm",className:f,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("refresh",e.id)},children:r("刷新 Token")}):null,s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:p,title:bf(e)?r("删除这条账号记录(不会影响客户端自己的登录态;之后可再点「导入桌面端登录态」加回来)"):void 0,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("remove",e.id)},children:r("删除账号")})]})})]})}function $q({account:e,onClose:t,onClear:a}){const o=pw(e),c=s.jsx(se,{variant:"ghost",size:"icon-xs",className:"panel-close",title:r("收起"),onClick:t,children:"✕"});return o.length?s.jsxs("div",{className:"row-panel limit-panel",children:[c,s.jsxs("div",{className:"lp-head",children:[s.jsx("b",{children:cu(e)}),s.jsx("span",{className:"muted",children:r("{n} 个模型限流中 · 记录来自上游 429 / 限额码,到恢复时间自动解除",{n:o.length})}),s.jsx(se,{variant:"outline",size:"xs",title:r("清掉该账号全部模型的限流标记"),onClick:()=>a(""),children:r("全部清除")})]}),o.map(d=>{const f=gw(d.resetAt),p=d.message||(d.status?r("上游返回 {status}",{status:d.status}):"");return s.jsxs("div",{className:"lp-row",children:[s.jsx("span",{className:"lp-model",title:d.model,children:d.model}),s.jsx(ze,{variant:"warning",shape:"tag",children:r("限流中")}),s.jsx("span",{className:"lp-reset",title:r("到恢复时间后自动解除,无需手动操作"),children:f===hw?r("恢复时间未知"):r("{time} 恢复",{time:f})}),s.jsx("span",{className:"lp-reason",title:p,children:p}),s.jsx(se,{variant:"outline",size:"2xs",title:r("清掉本机的限流标记,立刻重新尝试该模型(上游若仍在限流会再次被标记)"),onClick:()=>a(d.model),children:r("清除标记")})]},d.model)})]}):s.jsxs("div",{className:"row-panel limit-panel",children:[r("当前没有限流中的模型。"),c]})}function qq({account:e,colSpan:t,limitsOpen:a,onClear:o}){return a?s.jsx("tr",{className:"acct-panels","data-panels-for":e.id,children:s.jsx("td",{colSpan:t,children:s.jsx($q,{account:e,onClose:()=>nR(e.id,"limits",!1),onClear:c=>o(e.id,c)})})}):null}function Gq({namesHidden:e,allPicked:t,somePicked:a,disabled:o,onToggleAll:c}){const d=s.jsx("span",{className:"col-grip",title:r("拖动调整列宽(双击还原)")});return s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"cell-pick","data-col":"pick",children:s.jsx(Mr,{id:"acct-select-all",checked:t,indeterminate:!t&&a,disabled:o,"aria-label":r("全选当前筛选结果"),title:r("全选 / 取消全选当前筛选结果(与批量栏同一个选择)"),onCheckedChange:f=>c(f)})}),s.jsxs("th",{className:"cell-order","data-col":"order",children:[s.jsx("span",{className:"th-label",title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),children:r("顺序")}),d]}),s.jsxs("th",{className:"cell-account","data-col":"account",children:[s.jsxs("span",{className:"th-label",children:[r("账号"),s.jsx(Kq,{hidden:e})]}),d]}),s.jsxs("th",{className:"cell-proxy","data-col":"proxy",children:[s.jsx("span",{className:"th-label",title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),children:r("代理")}),d]}),s.jsxs("th",{className:"cell-connections","data-col":"connections",children:[s.jsx("span",{className:"th-label",title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),children:r("连接数")}),d]}),s.jsxs("th",{className:"cell-status","data-col":"status",children:[s.jsx("span",{className:"th-label",children:r("状态")}),d]}),s.jsxs("th",{className:"cell-limits","data-col":"limits",children:[s.jsx("span",{className:"th-label",title:r("该账号当前限流中的模型;点徽章看明细"),children:r("限流")}),d]}),s.jsxs("th",{className:"cell-expiry","data-col":"expiry",children:[s.jsx("span",{className:"th-label",children:r("有效期")}),d]}),s.jsxs("th",{className:"cell-usage","data-col":"usage",children:[s.jsx("span",{className:"th-label",children:r("余额")}),d]}),s.jsx("th",{className:"cell-actions","data-col":"actions",children:s.jsx("span",{className:"th-label",children:r("操作")})})]})})}function Kq({hidden:e}){const t=r(e?"显示账号名":"隐藏账号名(名字显示为星号)");return s.jsx("button",{type:"button",className:`name-eye${e?" on":""}`,title:t,"aria-label":t,"aria-pressed":e,onClick:()=>j$(),dangerouslySetInnerHTML:{__html:gg(e?"eyeOff":"eye",13)}})}const JR="dragging",Of=["drop-before","drop-after"];let Wa=null;function eO(e){e.querySelectorAll(`.${Of[0]}, .${Of[1]}`).forEach(t=>{t.classList.remove(...Of)})}function Yq(e,t){if(t==="group"){const o=e.parentElement;return o?[...o.children].filter(c=>c.classList.contains("acct-group")):[]}const a=e.parentElement;return a?[...a.children].filter(o=>o.classList.contains("acct-row")):[]}function tO(e,t){for(let a=0;aa!==e.item);eO(e.container),t.length&&(e.index>=t.length?t[t.length-1].classList.add(Of[1]):t[e.index].classList.add(Of[0]))}function nO(e){if(!Wa)return;if(e.buttons===0){xg(!1);return}const t=Wa.items.filter(o=>o!==Wa.item),a=tO(t,e.clientY);a!==Wa.index&&(Wa.index=a,Xq(Wa))}function xg(e){const t=Wa;t&&(Wa=null,window.removeEventListener("pointermove",nO),window.removeEventListener("pointerup",sO),window.removeEventListener("pointercancel",rO),window.removeEventListener("keydown",aO),document.body.classList.remove("queue-dragging"),t.item.classList.remove(JR),eO(t.container),e&&(t.kind==="group"?Uw?.onDrop({kind:"group",provider:t.provider,index:t.index}):Uw?.onDrop({kind:"row",provider:t.provider,accountId:t.accountId,index:t.index})))}function sO(){xg(!0)}function rO(){xg(!1)}function aO(e){e.key==="Escape"&&xg(!1)}let Uw=null;function Qq(e,t){Uw=t,e&&e.dataset.queueDragBound!=="1"&&(e.dataset.queueDragBound="1",e.addEventListener("pointerdown",a=>{if(a.button!==0||Wa)return;const o=a.target,c=o?.closest?.(".queue-grip"),d=o?.closest?.(".order-grip");if(!c&&!d)return;if(a.preventDefault(),c&&t.isLocked()){t.onLockedAttempt();return}const f=(c??d).closest("tbody.acct-group, tr.acct-row");if(!f)return;const p=c?"group":"row",h=f.dataset.provider||f.closest("tbody.acct-group")?.dataset.provider||"",b=f.dataset.id||"";if(p==="row"&&!b)return;const y=Yq(f,p);if(y.length<2)return;const v=y.filter(w=>w!==f);Wa={kind:p,provider:h,accountId:b,item:f,container:f.parentElement||e,items:y,index:tO(v,a.clientY)},f.classList.add(JR),document.body.classList.add("queue-dragging"),window.addEventListener("pointermove",nO),window.addEventListener("pointerup",sO),window.addEventListener("pointercancel",rO),window.addEventListener("keydown",aO)}))}let bg=null,lO=!1,Vw=0,vg=null,oO="";function iO(){return bg?bg.apply(Cw):Cw}function cO(){window.wbAccountsView?.render?.()}function Zq(){const e=iO(),t=`${vg?"T":"F"}|${e.map(o=>`${o.key}:${o.align}`).join("|")}`;if(t===oO)return;oO=t,Pe().wbColSettings?.syncStaticHead("accounts",vg);const a=[...vg?.querySelectorAll("thead th")||[]];a.forEach((o,c)=>{const d=o.querySelector(".col-grip");d&&(d.style.display=c===a.length-1?"none":"")})}function Wq(){const e=x.useSyncExternalStore(YA,Ws),t=x.useRef(null),[,a]=x.useReducer(B=>B+1,0),o=!!bw(),c=El(),{groups:d,allGroups:f}=d$(Za,Al),p=f$(Za,Al),h=[{value:"all",label:r("全部({n})",{n:c.length})}].concat(XA().map(B=>({value:B.id,label:r("{label}({count})",{label:B.label,count:B.count})}))),b=d.flatMap(B=>B.accounts),y=p$(),v=iO(),w=ig(b.length,"accounts",{defaultSize:"all"}),j=w.paged?w.slice(b):b,S=Xh()||w.paged,N=Xh()?r("清除筛选"):r("把每页调回「全部」");x.useEffect(()=>{E$()}),x.useEffect(()=>{g$()},[e.version]),x.useLayoutEffect(()=>{if(!lO){if(!Pe().wbColSettings?.register){window.clearTimeout(Vw),Vw=window.setTimeout(()=>k(B=>B+1),50);return}lO=!0,bg=Pe().wbColSettings?.register({id:"accounts",label:r("账号表"),columns:Cw.map(B=>({key:B.key,label:B.label,align:B.align,legacyAlign:B.legacyAlign})),mount:()=>document.querySelector("#batch-bar .batch-actions"),onChange:cO})||null,bg&&a();return}Zq()});const[,k]=x.useState(0);x.useEffect(()=>()=>window.clearTimeout(Vw),[]),x.useEffect(()=>{C8(t.current,cO)},[]);const T=b.map(B=>B.id),D=T.length>0&&T.every(B=>e.selected.has(B)),C=T.some(B=>e.selected.has(B)),A=[...e.selected].filter(B=>!T.includes(B)).length,R=e.selected.size>0,I=f.length>0&&f.every(B=>e.collapsed.has(B.provider)),P=new Map;for(const B of d)P.set(B.provider,j.filter(z=>kn(z)===B.provider).map(z=>z.id));const O=x.useRef({displayed:d,all:f,renderedRows:P});x.useEffect(()=>{O.current={displayed:d,all:f,renderedRows:P}});const _=x.useRef({locked:!1,lockReason:"",onDrop:B=>{}}),L=x.useCallback(B=>{const{displayed:z,all:Q}=O.current;if(B.kind==="group"){const Z=Q.findIndex(te=>te.provider===B.provider);if(Z<0)return;const ae=Q[Z],ce=Q.filter((te,Ce)=>Ce!==Z),J=B.indexte.provider===J),ge=J===null||ie<0?ce.length:ie;if(ge===Z)return;const fe=[...ce.slice(0,ge),ae,...ce.slice(ge)].flatMap(te=>te.members.map(Ce=>Ce.id));bR(fe,r("{name} 移到第 {rank} 顺位",{name:ae.label,rank:ge+1}));return}const K=Q.find(Z=>Z.provider===B.provider);if(!K)return;const X=K.members.findIndex(Z=>Z.id===B.accountId);if(X<0)return;const q=K.members[X],$=K.members.filter((Z,ae)=>ae!==X),Y=O.current.renderedRows.get(B.provider)||[],F=B.indexZ.id===F),W=F===null||G<0?$.length:G;if(W===X)return;const le=[...$.slice(0,W),q,...$.slice(W)],U=Q.map(Z=>Z.provider===B.provider?{...Z,members:le}:Z).flatMap(Z=>Z.members.map(ae=>ae.id));bR(U,r("{name} 移到 {group} 组内第 {rank} 位",{name:String(q.name||q.id),group:K.label,rank:W+1}))},[]);x.useEffect(()=>{_.current={locked:S,lockReason:N,onDrop:L}}),x.useEffect(()=>{Qq(t.current,{isLocked:()=>_.current.locked,onLockedAttempt:()=>Le(r("当前视图不能调整组顺位:{reason} 之后再拖动",{reason:_.current.lockReason}),"err"),onDrop:B=>_.current.onDrop(B)})},[]);function H(B,z,Q){switch(B){case"pick":return s.jsx(Mr,{checked:Q.picked,"data-pick":z.id,title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:K=>v$(z.id,K)});case"order":return s.jsx(yq,{account:z,rank:Q.rank});case"account":return s.jsx(Hq,{account:z,namesHidden:e.namesHidden});case"proxy":return s.jsx(Uq,{account:z});case"connections":return s.jsx(Cq,{account:z});case"status":return s.jsx(Sq,{account:z});case"limits":return s.jsx(Nq,{account:z,open:Q.limitsOpen});case"expiry":return s.jsx(kq,{account:z});case"usage":return s.jsx(Lq,{account:z});case"actions":return s.jsx(Vq,{account:z,atFront:Q.seat.position<=1});default:return null}}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel account-table",children:[s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"group","data-provider-group":"1",children:[s.jsx("span",{className:"label",children:r("提供商")}),s.jsxs(ft,{value:e.filter.provider,onValueChange:B=>h$(String(B)),children:[s.jsx(mt,{className:"max-w-none min-w-0 w-full min-[768px]:max-w-[200px] min-[768px]:min-w-[130px] min-[768px]:w-auto","aria-label":r("按提供商筛选账号"),children:s.jsx(pt,{children:h.find(B=>B.value===e.filter.provider)?.label||r("全部")})}),s.jsx(ht,{children:h.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsx("div",{className:"divider","data-provider-divider":"1"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("搜索")}),s.jsx($e,{className:"acct-search",type:"search",value:e.filter.q,placeholder:r("账号名 / 邮箱 / 备注"),"aria-label":r("搜索账号"),onChange:B=>m$(B.currentTarget.value)})]}),s.jsx("div",{className:"divider"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("状态")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.enabledAll??0},{value:"enabled",label:r("启用"),count:p.enabled??0},{value:"disabled",label:r("禁用"),count:p.disabled??0}],value:e.filter.enabled,onValueChange:B=>QA("enabled",B),"aria-label":r("启用状态")})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("限额")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.limitAll??0},{value:"normal",label:r("正常"),count:p.normal??0,disabled:e.filter.enabled==="disabled"},{value:"limited",label:r("已限流"),count:p.limited??0,disabled:e.filter.enabled==="disabled"}],value:e.filter.limit,onValueChange:B=>QA("limit",B),"aria-label":r("限额状态")})]}),s.jsxs("div",{className:"actions",children:[s.jsx(se,{id:"btn-fold-groups",variant:"outline",disabled:!f.length,title:r(I?"展开全部分组":"折叠全部分组(只留组头)"),onClick:()=>x$(f.map(B=>B.provider),!I),children:r(I?"展开全部":"折叠全部")}),s.jsx(se,{id:"btn-add-account-2",variant:"default",title:r("登录 / 导入一个新账号"),onClick:()=>{Pe().wbAddAccountModal?.open?.(),Pe().wbAccountAddForms?.syncAddProvider?.()},children:r("添加账号")}),s.jsx(se,{id:"btn-query-usage",variant:"outline",disabled:e.usageBusy||!c.some(Ta),title:r("查询全部账号的余额(含已禁用账号 —— 禁用只表示不参与转发)"),onClick:()=>{hR()},children:e.usageBusy?r("查询中…"):r("查询余额")})]})]}),s.jsxs("div",{className:Ue("batch-bar",R&&"active"),id:"batch-bar",children:[s.jsxs("label",{className:"batch-select-all",children:[s.jsx(Mr,{id:"batch-select-all",checked:D,indeterminate:!D&&C,disabled:!T.length,"aria-label":r("全选当前筛选结果"),onCheckedChange:B=>eR(T,B)}),s.jsx("span",{id:"batch-select-label",children:T.length?r("全选当前筛选结果({n} 个)",{n:T.length}):r("没有可全选的账号")})]}),s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{id:"batch-count",children:e.selected.size})," ",r("个 · 共")," ",s.jsx("b",{id:"accounts-count",children:c.length})," ",r("个")]}),s.jsx("span",{className:"batch-summary",id:"accounts-group-summary",children:d.length?r("{groups} 家 · 显示 {rows} 行",{groups:d.length,rows:T.length}):""}),S?s.jsx("span",{className:"batch-hidden",title:r("筛选 / 搜索 / 分页生效时组顺位不可拖动(别家的组整组不可见,落点没法定位)"),children:r("组顺位已锁定")}):null,Xh()?s.jsx(se,{id:"btn-clear-filter",variant:"ghost",size:"xs",title:r("清空搜索与三个筛选档位,回到全部账号"),onClick:()=>ZA(),children:r("清除筛选")}):null,A?s.jsx("span",{className:"batch-hidden",id:"batch-hidden-hint",children:r("另有 {n} 个已勾选账号被当前筛选隐藏,仍会参与操作",{n:A})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{id:"btn-batch-open",variant:"outline",disabled:!R,onClick:()=>yw([...e.selected],"enable"),children:r("批量操作")}),s.jsx(se,{id:"btn-batch-clear",variant:"outline",disabled:!R,onClick:()=>y$(),children:r("取消选择")})]})]}),s.jsx("div",{className:"acct-scroll",id:"account-list",ref:t,children:o?c.length?b.length?s.jsxs("table",{className:"acct-table",ref:Jq,style:{minWidth:`${N8(v.map(B=>B.key))}px`},children:[s.jsx(eG,{}),s.jsx(Gq,{namesHidden:e.namesHidden,allPicked:D,somePicked:C,disabled:!T.length,onToggleAll:B=>eR(T,B)}),d.map(B=>{const z=e.collapsed.has(B.provider),Q=j.filter(K=>kn(K)===B.provider);return s.jsxs("tbody",{className:"acct-group","data-provider":B.provider,children:[s.jsx(jq,{group:B,collapsed:z,colSpan:v.length}),z?null:Q.map(K=>{const X=B.members.findIndex($=>$.id===K.id)+1,q=z$(K,y,X>0?X:1);return s.jsxs(x.Fragment,{children:[s.jsx("tr",{className:Ue("acct-row",!cr(K)&&"disabled",q.picked&&"selected"),"data-id":K.id,"data-provider":B.provider,"data-desktop":bf(K)?"1":void 0,children:v.map($=>s.jsx("td",{className:`cell-${$.key} ta-${$.align}`,children:H($.key,K,q)},$.key))}),s.jsx(qq,{account:K,colSpan:v.length,limitsOpen:tR(K.id,"limits"),onClear:($,Y)=>{_$($,Y)}})]},K.id)})]},B.provider)})]}):s.jsxs("div",{className:"empty",children:[r("当前筛选条件下没有账号"),Xh()?s.jsx("button",{type:"button",className:"link-btn",onClick:()=>ZA(),children:r("清除筛选")}):null]}):s.jsx("div",{className:"empty",children:r("暂无账号,请点击右上角「添加账号」")}):s.jsxs("div",{className:"empty",children:[s.jsx("span",{className:"spinner"}),r("正在加载…")]})}),s.jsx(Li,{total:b.length,range:w.paged?{start:w.rangeStart,end:w.rangeEnd}:null,page:w.page,pageCount:w.pageCount,size:w.size,onSizeChange:w.setSize,onPageChange:w.goto})]}),s.jsx(g8,{})]})}function Jq(e){vg=e}function eG(){const e=S8(),t=a=>s.jsx("col",{"data-col":a,style:e[a]?{width:`${e[a]}px`}:void 0},a);return s.jsxs("colgroup",{children:[t("pick"),t("order"),t("account"),t("proxy"),t("connections"),t("status"),t("limits"),t("expiry"),t("usage"),t("actions")]})}const uO='.page[data-page="accounts"]';let Fw=null;function dO(){if(Fw)return;const e=document.querySelector(uO);e&&(e.replaceChildren(),Fw=vn.createRoot(e),Cs.flushSync(()=>{Fw.render(s.jsx(Wq,{}))}))}H$(),O$(),document.querySelector(uO)?dO():document.addEventListener("DOMContentLoaded",dO,{once:!0});const tG=64,nG=100,sG=r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),rG=r("Anthropic 协议填根地址,不要带 /v1"),aG="https://open.bigmodel.cn/api/paas/v4",lG="https://api.anthropic.com",oG=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],xu="custom-protocol-select",bu="custom-name-input",vu="custom-baseurl-input",Mf="custom-apikey-input",Df="custom-noauth-check",yu="custom-existing-select",If="custom-existing-apikey-input",Pf="custom-existing-noauth-check",_f="custom-existing-name-input",iG="custom-create-button",cG="custom-existing-button",uG="custom-existing-remove";let $w=!1;const fO=()=>gt().wbProviders?.PROTOCOL_OPTIONS||oG,qw=()=>gt().wbProviders?.customList?.()||[],Gw="custom-balance",Kw="custom-existing-balance",Lf=(e,t)=>`${e}-${t}-input`;function pO(e){if(!e)return"";const t=gt().wbPresetProviders?.presetOf?.(e);return String(t?.balance?.scheme||"")}function mO(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=vr(Lf(t,c.key));d&&(o[c.key]=d)}return Object.keys(o).length?o:null}function hO(e,t){const a=kf(e);if(a)for(const o of a.fields)So(Lf(t,o.key),"")}function gO({scheme:e,prefix:t}){const a=kf(e);return a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("余额查询")}),s.jsxs("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:[s.jsx("span",{className:"text-xs text-subtle",children:r("方案:{label}",{label:a.label})}),s.jsx("span",{className:"ml-1.5 text-xs text-subtle",children:a.endpoint})]}),s.jsx("span",{className:"hint",children:a.note})]}),a.fields.map(o=>s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Lf(t,o.key),children:o.label}),s.jsx($e,{id:Lf(t,o.key),type:o.secret?"password":"text",autoComplete:o.secret?"new-password":"off",placeholder:o.placeholder,...Aa(Lf(t,o.key))}),s.jsx("span",{className:"hint",children:o.hint})]},o.key))]}):null}async function Yw(e,t){if(!$w){$w=!0,e(!0);try{await t()}finally{$w=!1,e(!1)}}}async function xO(e){gt().wbAddAccountModal?.close?.(),gt().wbProviders?.refreshCustom?.(),await gt().wbApp?.refresh?.(),Jn(e)}function zf(e,t){So(e,t?"1":"")}function yg(e){return vr(e)==="1"}function bO({checked:e,note:t,onChange:a}){return s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("鉴权")}),s.jsx("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:s.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2.5",children:[s.jsx(Mr,{checked:e,"aria-label":r("该上游无需鉴权"),onCheckedChange:o=>a(o===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(不发送鉴权头)")})]})}),s.jsx("span",{className:"hint",children:t})]})}function dG({mode:e,providerHint:t,presetKey:a,showToken:o,version:c}){const d=fO(),[f,p]=x.useState(()=>vr(xu)||d[0].value),[h,b]=x.useState(""),[y,v]=x.useState(""),[w,j]=x.useState(()=>vr(yu)),[S,N]=x.useState(()=>yg(Df)),[k,T]=x.useState(()=>yg(Pf)),D=x.useMemo(()=>qw(),[c]),A=(t&&D.some(B=>B.id===t)?t:"")||(D.some(B=>B.id===w)?w:D[0]?.id||""),R=D.find(B=>B.id===A)?.name||r("该提供商");x.useEffect(()=>{So(yu,A)},[A]),x.useEffect(()=>{if(!a)return;const B=gt().wbPresetProviders?.presetOf?.(a);if(!B)return;const z=B.account?.noAuth===!0;if(e!=="create"){T(z),zf(Pf,z);return}So(bu,B.name||""),So(vu,B.baseUrl||""),B.protocol&&(p(B.protocol),So(xu,B.protocol)),N(z),zf(Df,z),b(B.hint||""),v(B.placeholder||"")},[e,a,t,o]);const I=f==="anthropic",P=h||(I?rG:sG),O=y||(I?lG:aG),_=e==="create"?pO(a):"",L=e==="existing"?String(D.find(B=>B.id===A)?.balanceScheme||""):"",H=(B,z)=>Q=>{z(Q),zf(B,Q)};return s.jsxs(s.Fragment,{children:[s.jsxs(zn,{hidden:e!=="create",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("上游信息")}),s.jsx("span",{children:r("创建这个提供商,并同时建立它的第一个账号。")})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:bu,children:[r("名称"),s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:bu,type:"text",maxLength:tG,"aria-required":"true",placeholder:r("如:智谱 GLM"),...Aa(bu)}),s.jsx("span",{className:"hint",children:r("1~64 个字符,账号列表里按它分组显示")})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:xu,children:r("协议")}),s.jsxs(ft,{value:f,onValueChange:B=>{const z=String(B);p(z),So(xu,z),b("")},children:[s.jsx(mt,{id:xu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:d.find(B=>B.value===f)?.label||f})}),s.jsx(ht,{children:d.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:vu,children:["Base URL",s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx($e,{id:vu,type:"text","aria-required":"true",placeholder:O,...Aa(vu)}),s.jsx("span",{className:"hint",id:"custom-baseurl-hint",children:P})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Mf,children:"API Key"}),s.jsx($e,{id:Mf,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:S,...Aa(Mf)}),s.jsx("span",{className:"hint",children:r(S?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:S,note:r(S?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用"),onChange:H(Df,N)}),s.jsx(gO,{scheme:_,prefix:Gw})]})]}),s.jsxs(zn,{hidden:e!=="existing",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("账号信息")}),s.jsxs("span",{children:[r("添加到 "),s.jsx("b",{children:R}),r(" 同一家可以放多把 key,按优先级轮换。")]})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:yu,children:r("提供商")}),s.jsxs(ft,{value:A,onValueChange:B=>j(String(B)),children:[s.jsx(mt,{id:yu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:R})}),s.jsx(ht,{children:D.map(B=>s.jsx(qe,{value:B.id,children:B.name||B.id},B.id))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:If,children:"API Key"}),s.jsx($e,{id:If,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:k,...Aa(If)}),s.jsx("span",{className:"hint",children:r(k?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:k,note:r(k?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走"),onChange:H(Pf,T)}),s.jsx(gO,{scheme:L,prefix:Kw}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:_f,children:r("备注名")}),s.jsx($e,{id:_f,type:"text",maxLength:nG,placeholder:r("可选"),...Aa(_f)}),s.jsx("span",{className:"hint",children:r("留空则用提供商名称")})]})]})]})]})}function vO(e,t){const a=pu(t);Jn(r("添加失败:{reason}",{reason:a}),"err"),e.setHint(a)}async function fG(e){const t=vr(bu),a=vr(xu)||fO()[0].value,o=vr(vu),c=vr(Mf),d=yg(Df);if(!t){Jn(r("请填写名称"),"err");return}if(!o){Jn(r("请填写 Base URL"),"err");return}await Yw(e.setBusy,async()=>{const f={name:t,protocol:a,baseUrl:o},p=e.presetKey?gt().wbPresetProviders?.presetOf?.(e.presetKey):null,h=p?.quirks||{};h.urlSuffix&&(f.urlSuffix=h.urlSuffix),h.headers&&Object.keys(h.headers).length&&(f.headers={...h.headers}),h.anthropicToolType&&(f.anthropicToolType=h.anthropicToolType),p?.clientEmulation&&(f.clientEmulation=p.clientEmulation);const b=pO(e.presetKey);b&&(f.balanceScheme=b);const y=mO(b,Gw);y&&(f.balanceQuery=y),d?f.noAuth=!0:c&&(f.apiKey=c),e.setHint("");try{const v=await gt().wbProviders?.customRequest?.("POST","/api/custom-providers",f);Mw([bu,vu,Mf]),hO(b,Gw),zf(Df,!1);const w=v?.provider?.name||t;await xO(r("✅ 已创建自定义提供商「{name}」并添加账号",{name:w}))}catch(v){vO(e,v)}})}async function pG(e){const t=vr(yu);if(!t){Jn(r("请先选择一个自定义提供商"),"err");return}const a=vr(If),o=yg(Pf),c=vr(_f),d=String(qw().find(f=>f.id===t)?.balanceScheme||"");await Yw(e.setBusy,async()=>{const f={provider:t};o?f.noAuth=!0:a&&(f.apiKey=a),c&&(f.name=c);const p=mO(d,Kw);p&&(f.balanceQuery=p),e.setHint("");try{const h=await gt().wbProviders?.customRequest?.("POST","/api/accounts",f);Mw([If,_f]),hO(d,Kw),zf(Pf,!1);const b=h?.account?.name||qw().find(y=>y.id===t)?.name||"";await xO(r("✅ {label}账号已添加{name}",{label:"",name:b?`:${b}`:""}))}catch(h){vO(e,h)}})}async function mG(){const e=vr(yu);if(!e){Jn(r("请先选择一个自定义提供商"),"err");return}const t=gt().wbCustomProvidersUi?.remove;if(typeof t!="function"){Jn(r("删除功能不可用(脚本未就绪)"),"err");return}await Yw(()=>{},async()=>{await t(e)&>().wbAddAccountModal?.close?.()})}function hG({mode:e,presetKey:t}){const[a,o]=x.useState(!1),[c,d]=x.useState(""),f={presetKey:t,setBusy:o,setHint:d};return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`add-foot-hint${c?" err":""}`,id:"add-form-foot-hint",children:c}),s.jsxs("span",{className:"add-foot-actions",id:"add-form-foot-actions",children:[e==="existing"?s.jsx(se,{id:uG,variant:"destructive",title:r("级联删除名下全部账号,不可恢复"),onClick:()=>{mG()},children:r("删除此提供商")}):null,s.jsx(se,{id:iG,hidden:e!=="create",disabled:a,onClick:()=>{fG(f)},children:r(a&&e==="create"?"提交中…":"创建并添加账号")}),s.jsx(se,{id:cG,hidden:e!=="existing",disabled:a,onClick:()=>{pG(f)},children:r(a&&e==="existing"?"提交中…":"添加账号")})]})]})}const Xw={step:"pick",accountType:zw,search:"",provider:Bi,providerHint:"",presetKey:"",showToken:0},yO=()=>gt().wbProviders?.customList?.()||[];function gG({onClose:e,onReady:t}){const[a,o]=x.useState(Xw),[c,d]=x.useState(0),f=x.useCallback(()=>d(C=>C+1),[]),p=x.useCallback(()=>{o(Xw);const C=gt().wbProviders;(C?.all?.()||[]).length||C?.load?.().then(f),C?.refreshCustom?.().then(f)},[f]),h=x.useCallback(()=>{p(),o({...Xw,step:"form",provider:gu})},[p]);x.useEffect(()=>(t({reset:p,openNewCustomForm:h}),()=>t(null)),[t,p,h]),x.useEffect(()=>{gt().wbWebLogin?.refresh?.()},[]),x.useEffect(()=>{gt().wbProviders?.refreshCustom?.().then(f)},[f]),x.useEffect(()=>{a.step!=="form"||a.provider!==gu||gt().wbProviders?.refreshCustom?.().then(f)},[a.step,a.provider,a.showToken,f]);const b=X8(a.provider),y=a.provider===gu,v=a.provider===Bi||y||!!b,w=a.providerHint?"existing":"create",j=a.providerHint?yO().find(C=>C.id===a.providerHint)?.name||"":a.presetKey&>().wbPresetProviders?.presetOf?.(a.presetKey)?.name||"",S=a.provider===Bi?Dw:gt().wbProviders?.labelOf?.(a.provider)||a.provider,N=y?a.providerHint||a.presetKey?r("登录 / 添加 {name} 账号",{name:j||r("自定义提供商")}):r("新建自定义提供商"):r("登录 / 添加 {name} 账号",{name:S});function k(C){if(!C)return;const A={step:"form",showToken:a.showToken+1};if(C===Hw)o(R=>({...R,...A,provider:gu,providerHint:"",presetKey:""}));else if(C.startsWith(Rf)){const R=C.slice(Rf.length),I=zR(gt().wbPresetProviders?.presetOf?.(R));o(P=>({...P,...A,provider:gu,providerHint:I?.id||"",presetKey:R}))}else yO().some(R=>R.id===C)?o(R=>({...R,...A,provider:gu,providerHint:C,presetKey:""})):o(R=>({...R,...A,provider:C,providerHint:"",presetKey:""}))}const T=()=>o(C=>({...C,step:"pick"})),D=a.accountType===dq;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||e()},children:s.jsxs(Zt,{className:"w-[min(1100px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加账号")})}),s.jsx(Bt,{children:s.jsx(vq,{accountType:a.accountType,onAccountTypeChange:C=>o(A=>({...A,accountType:C})),search:a.search,onSearchChange:C=>o(A=>({...A,search:C})),onPick:k,version:c,importing:D,importPanel:void 0})}),null,s.jsx(Qt,{open:a.step==="form",onOpenChange:C=>{C||T()},children:s.jsxs(Zt,{keepMounted:!0,overlayForceRender:!0,className:"w-[min(620px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:N})}),s.jsxs(Bt,{children:[s.jsx(uq,{active:a.provider===Bi}),qR.map(C=>s.jsx(lq,{config:C,active:a.provider===C.provider},C.provider)),s.jsx("div",{className:"add-provider-block",style:y?void 0:{display:"none"},children:s.jsx(dG,{mode:w,providerHint:a.providerHint,presetKey:a.presetKey,showToken:a.showToken,version:c})}),v?null:s.jsx("div",{className:"add-provider-block",children:s.jsxs(zn,{children:[s.jsx("h3",{children:r("该提供商账号添加功能即将上线")}),s.jsx("p",{children:r("「{name}」的账号添加功能还在开发中,敬请期待。",{name:S})})]})})]}),y?s.jsx(nn,{children:s.jsx(hG,{mode:w,presetKey:a.presetKey})}):null]})})]})})}let ko=null,wu=null,Hi=null,wg=null;function xG(){ko&&(ko.unmount(),ko=null),wu&&(wu.remove(),wu=null),Hi=null}function wO(){wu=document.createElement("div"),document.body.append(wu),ko=vn.createRoot(wu),ko.render(s.jsx(gG,{onClose:jO,onReady:e=>{if(Hi=e,!e)return;const t=wg;wg=null,t?.()}}))}function jO(){gt().wbWebLogin?.cancelIfActive?.(""),gt().wbAutoclawOauth?.cancel?.(),xG()}function Qw(){if(ko){Hi?.reset();return}wg=()=>Hi?.reset(),wO()}function bG(){if(ko){Hi?.openNewCustomForm();return}wg=()=>Hi?.openNewCustomForm(),wO()}for(const e of["btn-add-account","btn-add-account-2"])document.getElementById(e)?.addEventListener("click",Qw);const SO=window;SO.wbAddAccountModal={open:Qw,close:jO},SO.wbAccountAddForms={syncAddProvider:()=>{ko?Hi?.reset():Qw()},openNewCustomForm:bG};const vG=3065;let ju=null;function yG(){return window.workbuddyDesktop}const NO="same-origin";async function Zw(e=!1){if(ju&&!e)return ju;const t=yG();if(t?.platform==="web"){const o=typeof window>"u"?"":window.location?.origin;if(o&&o!=="null")return ju=o,ju}let a=0;try{const o=await t?.getBackendStatus?.(),c=Number(o?.port);Number.isFinite(c)&&c>0&&(a=c)}catch{}return a>0?(ju=`http://127.0.0.1:${a}`,ju):`http://127.0.0.1:${vG}`}async function wG(){const t=await window.workbuddyDesktop?.getModelManage?.(),a=Array.isArray(t?.models)?t.models:[],o=Array.isArray(t?.mappings)?t.mappings:[],c=new Set,d=[],f=new Set;for(const p of a){if(p.enabled!==!0)continue;const h=String(p.provider??""),b=String(p.id??"");!h||!b||(c.add(`${h}${b}`),f.has(b)||(f.add(b),d.push(b)))}for(const p of o){if(p.enabled!==!0||p.isDefault===!0)continue;const h=String(p.provider??""),b=String(p.target??""),y=String(p.alias??"");(!y||!f.has(y)&&c.has(`${h}${b}`))&&(f.add(y),d.push(y))}return d}function kO(e,t){if(typeof e=="string"&&e.trim())return e.trim();if(e&&typeof e=="object"){const a=e.message;if(typeof a=="string"&&a.trim())return a.trim();try{return JSON.stringify(e)}catch{}}return`HTTP ${t}`}function CO(e,t){const a=e instanceof Error?e.message:String(e);return new Error(`连接网关失败(${t}):${a}`)}async function TO(e,t,a){const o=await Zw();let c;try{c=await fetch(o+t,{method:e,headers:a===void 0?void 0:{"Content-Type":"application/json"},body:a===void 0?void 0:JSON.stringify(a),credentials:NO})}catch(b){throw CO(b,o)}const d=await c.text();let f=null;try{f=d?JSON.parse(d):null}catch{f=null}const p=f;if(!c.ok||p?.success===!1){const b=p?.error??f?.error,y=kO(b,c.status);throw c.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${y}`):new Error(y)}return p&&typeof p=="object"&&"data"in p?p.data:f}async function jG(){const t=(await TO("GET","/api/assistant/config"))?.config;if(!t||typeof t!="object")throw new Error("配置响应不完整");const a=typeof t.model=="string"?t.model:t.model?.id;return{model:typeof a=="string"&&a.trim()?a:null,systemPromptEnabled:t.systemPromptEnabled!==!1,systemPrompt:typeof t.systemPrompt=="string"?t.systemPrompt:"",tools:t.tools&&typeof t.tools=="object"?t.tools:{}}}async function SG(e){const t=await TO("PUT","/api/assistant/config",{config:e});return t?.config&&typeof t.config=="object"?t.config:e}function NG(e){return e.map(t=>{if(t.role==="tool")return{role:"tool",tool_call_id:t.toolCallId,content:t.content};if(t.role==="assistant"){const a={role:"assistant",content:t.content||""};return t.toolCalls?.length&&(a.tool_calls=t.toolCalls.map(o=>({id:o.id,type:"function",function:{name:o.name,arguments:o.arguments}}))),a}return{role:"user",content:t.content}})}async function kG(e){const t=await Zw(),a={messages:NG(e.messages)};e.tools.length&&(a.tools=e.tools);let o;try{o=await fetch(t+"/api/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),signal:e.signal,credentials:NO})}catch(v){throw e.signal?.aborted?v:CO(v,t)}if(!o.ok||!o.body){const v=await o.text().catch(()=>"");let w=null;try{w=v?JSON.parse(v):null}catch{}const j=w?.error,S=kO(j,o.status);throw o.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${S}`):new Error(S)}const c=o.body.getReader(),d=new TextDecoder;let f="";const p=new Map;let h="";const b=v=>{for(const w of v.split(` -`)){const j=w.trimEnd();if(!j.startsWith("data:"))continue;const S=j.slice(5).trim();if(!S)continue;if(S==="[DONE]")return!0;let N;try{N=JSON.parse(S)}catch{continue}const k=Array.isArray(N.choices)?N.choices[0]:void 0,T=k?.delta||{},D=typeof T.content=="string"?T.content:"";if(D&&e.onEvent({type:"delta",text:D}),Array.isArray(T.tool_calls))for(const C of T.tool_calls){const A=Number(C.index??0),R=p.get(A)||{id:"",name:"",arguments:""};typeof C.id=="string"&&C.id&&(R.id=C.id);const I=C.function||{};typeof I.name=="string"&&I.name&&(R.name=I.name),typeof I.arguments=="string"&&(R.arguments+=I.arguments),p.set(A,R)}typeof k?.finish_reason=="string"&&(h=k.finish_reason)}return!1};for(;;){const{done:v,value:w}=await c.read();if(v)break;f+=d.decode(w,{stream:!0});let j=f.indexOf(` +`)})}function Oq(e){if(e===void 0)return{text:r("未查询"),kind:"muted",title:r("尚未查询该账号的余额")};if(e===null)return{text:r("查询中…"),kind:"muted",title:r("正在查询")};const t=du(e);if(t)return t.notConfigured?{text:r("未配置"),kind:"muted",title:r("{message}(去该账号的「设置」里填上查询凭证即可)",{message:t.message})}:{text:r("查询失败"),kind:"bad",title:t.message};if(typeof e!="object"||e===null)return{text:r("无数据"),kind:"muted",title:String(e)};const a=e;if(Object.prototype.hasOwnProperty.call(a,"totalLeft")){const o=a.unlimited?"∞":jr(a.totalLeft);return{text:r("可用 {total}",{total:o}),kind:"ok",title:r("总剩余 {total} · 套餐 {plan} · 奖励 {bonus}",{total:o,plan:jr(a.planLeft),bonus:jr(a.bonusLeft)})}}if(Object.prototype.hasOwnProperty.call(a,"available")||Array.isArray(a.wallets)){const o=String(a.unit||r("积分")),c=Array.isArray(a.wallets)?a.wallets:[],d=c.map(j=>`${j?.displayName||j?.type||r("明细")} ${j?.balanceView?String(j.balanceView):jr(j?.balance)}`).join(" · "),f=XR(a.subscription),p=[];if(c.length===0&&Array.isArray(a.plans)&&a.plans.length>0){const j=QR(a);p.push(j&&ZR(j)?r("读数里没有额度桶,这里按套餐权益里的已用 / 总量显示(上游给的数)"):r("上游的余额读数里没有这个套餐的额度桶,剩余量读不到;余额列显示的是套餐发放的权益额度,不是剩余量"))}String(a.walletsFrom||"")==="monitor"&&p.push(r("额度窗口读数来自开放平台监控通道(套餐 JWT 那条通道没有额度桶):读的是每 N 小时 / 每周窗口的剩余比例"));const h=a.available==null?c.find(j=>j?.balance!=null):void 0,v=a.availableView?String(a.availableView):h?r("可用 {value} {unit}",{value:jr(h.balance),unit:String(h.unit||o)}):r("可用 {value} {unit}",{value:jr(a.available),unit:o}),y=[a.statisticsError?r("订阅统计未读到:{error}",{error:String(a.statisticsError)}):"",a.benefitError?r("福利网关未读到:{error}",{error:String(a.benefitError)}):""].filter(Boolean),b=a.benefitAbsent?[r("该账号没有福利模型额度(福利按活动下发,不是每个账号都有)")]:[];return{text:v+(y.length?" ⚠":""),kind:y.length?"warn":"ok",title:[v,d,f,...p,...b,...y].filter(Boolean).join(" · ")}}return{text:r("无数据"),kind:"muted",title:r("未返回可识别的余额数据")}}function QR(e){const t=Array.isArray(e.plans)?e.plans:[],a=o=>String(o?.state||"");return t.find(o=>a(o)==="active")||t.find(o=>a(o)==="pending")||t[0]||null}function Mq(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];let a=null;for(const o of t){const c=Number(o?.grantUnits);if(!Number.isFinite(c)||c<=0)continue;const d=String(o?.unitType||"").trim();(!a||c>a.units)&&(a={units:c,unit:d})}return a}function ZR(e){const t=Array.isArray(e.entitlements)?e.entitlements:[];for(const a of t){const o=Ir(a?.totalUnits);if(o===null||o<=0)continue;const c=Ir(a?.usedUnits),d=Ir(a?.remainingUnits),f=c===null?d===null?null:Math.max(0,o-d):c;if(f!==null)return{used:f,total:o,unit:String(a?.unitType||"").trim()}}return null}function Dq(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,a=Array.isArray(t.wallets)?t.wallets:[];let o=null;for(const p of a){const h=Number(p?.total);!Number.isFinite(h)||h<=0||(!o||h>Number(o.total))&&(o=p)}const c=t.subscription&&typeof t.subscription=="object"?t.subscription:{};if(!o){let p=null;for(const j of a){const w=Ir(j?.remainingPercent);w!==null&&(!p||w0,S=k?Math.max(0,Math.min(100,y/b*100)):null;c.push({name:v,view:k?r("剩 {remaining} / {total}",{remaining:jr(y),total:jr(b)}):r("剩 {remaining}",{remaining:jr(y)}),tone:y<=0?"muted":S!==null&&S<20?"warn":"ok",percent:S,over:!1,title:k?void 0:r("上游未给总量,画不出剩余比例")});continue}if(w!==null||Ir(h.allowanceTokens)!==null){const k=Ir(h.usedTokens)??0,S=Ir(h.allowanceTokens),N=S!==null&&S>1,T=N&&k>S,D=h.unlimited===!0,C=N?Math.max(0,Math.min(100,(1-k/S)*100)):null,A=D?r("无上限 · 已用 {used}",{used:ko(k)}):N?r("剩 {remaining} / {total}",{remaining:ko(Math.max(0,S-k)),total:ko(S)}):k>0?r("已用 {used}",{used:ko(k)}):r("未使用");d.push({name:Pq(v),view:A,tone:T?"bad":!N&&!D?"muted":C!==null&&C<20?"warn":"ok",percent:C,over:T,title:[j,D?r("无上限按日计(上游到达上限后仍继续计数,超额如实显示)"):null].filter(Boolean).join(" · ")});continue}d.push({name:v,view:j,tone:"muted",percent:null,over:!1,title:j})}const f=t.subscription&&typeof t.subscription=="object"?t.subscription:{},p=[t.statisticsError?r("订阅统计未读到:{error}",{error:String(t.statisticsError)}):"",t.benefitError?r("福利网关未读到:{error}",{error:String(t.benefitError)}):""].filter(Boolean);return{credit:c,token:d,total:Ir(t.available),unit:o,plan:r$(f.planName),free:zA(f.planName),resetDate:String(f.resetDate||""),missing:p,benefitAbsent:t.benefitAbsent===!0}}function Lq(e){const t=Al(e);let a=null;for(const b of XF(e)){if(b.enabled===!1)continue;const j=xf(b,t);if(!j)continue;const w=b.threshold>0?j.used/b.threshold:0;if(w>=1){a={rule:b,reading:j,ratio:w};break}(!a||w>a.ratio)&&(a={rule:b,reading:j,ratio:w})}if(!a)return null;const{rule:o,reading:c}=a,d=c.used>=o.threshold,f=cj(o),p=d?"":` · ${qh(f.remainingMs,f.daily)}`,h=f.daily?r("今日已用"):r("周期 Token"),v=o.reset==="daily"?r("今天(本地 0 点重置)"):r("{period}窗口",{period:OA(o.period??0)}),y=r("限制器:{window}已用 {used} / {threshold} Token",{window:v,used:Math.round(c.used).toLocaleString("en-US"),threshold:Math.round(o.threshold).toLocaleString("en-US")})+(d?r(",已达到上限"):r(",{countdown}重置",{countdown:qh(f.remainingMs,f.daily)}));return s.jsxs("span",{className:"usage-token-sub",title:y,children:[h," ",s.jsx("span",{className:d?"hit":void 0,children:Tl(c.used)})," ","/ ",Tl(o.threshold),p]})}function zq({account:e}){if(!Ta(e))return s.jsx("span",{className:"muted",title:r("该提供商没有余额查询"),children:"—"});const t=Za(e),a=Oq(t),o=$h(e,t)?s.jsx(ze,{variant:"warning",shape:"tag",title:r("余额低于限制器的阈值,转发时会跳过该账号(余额回升自动恢复)"),children:r("余额不足 · 已跳过")}):ij(e,Al(e))?s.jsx(ze,{variant:"warning",shape:"tag",title:r("本周期 Token 消耗达到限制器的上限,转发时会跳过该账号(窗口重置自动恢复)"),children:r("Token 限额 · 已跳过")}):null,c=Lq(e),d=a.kind==="ok"||a.kind==="warn"?Aq(t):[],f=d.length?s.jsx(ze,{variant:"warning",shape:"tag",title:Rq(d),children:r("待生效 {n} 份",{n:d.length})}):null,p=a.kind==="ok"||a.kind==="warn"?_F(t):[],h=LA(e)&&p.length?{rows:p,subscriptionLine:Eq(t),kind:a.kind,title:a.title}:null,v=a.kind==="ok"||a.kind==="warn"?Iq(t):[];if(v.length)return s.jsxs("span",{className:"usage-cell",title:a.title,children:[v.map(j=>s.jsx(WR,{row:j},j.name)),o,f,c]});if(s$(e)){const w=a.kind==="ok"||a.kind==="warn"?_q(t):null;return w?s.jsx(Bq,{summary:a,detail:w,blockedBadge:o,tokenSub:c}):s.jsxs("span",{className:"usage-sum-wrap",children:[s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]})}const y=a.kind==="ok"||a.kind==="warn"?Dq(t):null;if(!y)return s.jsxs("span",{className:"usage-sum-wrap",children:[h?s.jsx(yA,{variant:"sum",...h,children:a.text}):s.jsx("span",{className:`usage-sum ${a.kind}`,title:a.title,children:a.text}),o,f,c]});const b=s.jsxs(s.Fragment,{children:[y.percent!==null?s.jsx(tf,{value:y.percent,className:"usage-pool-bar"}):null,s.jsx("span",{className:`usage-pool-view ${a.kind}`,children:y.text})]});return s.jsxs("span",{className:"usage-pool",title:a.title,children:[y.planName?s.jsx("span",{className:"usage-pool-name",children:y.planName}):null,h?s.jsx(yA,{variant:"pool",...h,children:b}):s.jsx("span",{className:"usage-pool-line",children:b}),o,f,c]})}function Bq({summary:e,detail:t,blockedBadge:a,tokenSub:o}){const[c,d]=x.useState(!1),f=e.kind==="ok"||e.kind==="warn";return s.jsxs("span",{className:c?"usage-cell open":"usage-cell",children:[s.jsxs("span",{className:"usage-plan",children:[t.plan?s.jsx("span",{className:`plan-chip${t.free?" free":""}`,children:t.plan}):null,t.resetDate?s.jsx("span",{className:"plan-sub",title:r("套餐积分的重置日期"),children:r("重置 {date}",{date:t.resetDate})}):null]}),s.jsxs(hf,{open:c,onOpenChange:d,children:[s.jsxs(Uh,{render:s.jsx("button",{type:"button",className:`usage-toggle ${e.kind}`,title:e.title,"aria-label":r("积分明细")}),children:[s.jsx("span",{className:"val",children:e.text}),s.jsx("span",{className:"caret","aria-hidden":!0,children:"▾"})]}),s.jsxs(gf,{align:"end",sideOffset:6,className:"usage-pop w-[288px]",children:[f&&t.missing.length?t.missing.map(p=>s.jsx("div",{className:"usage-pop-missing",title:p,children:p},p)):null,t.credit.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"usage-pop-group",children:r("积分")}),t.credit.map(p=>s.jsx(Hq,{row:p},p.name))]}):null,t.total!==null?s.jsxs("div",{className:"usage-pop-total",children:[s.jsx("span",{className:"k",children:r("可用合计")}),s.jsxs("span",{className:"v",children:[jr(t.total)," ",s.jsx("small",{children:t.unit})]})]}):null,!t.credit.length&&t.total===null?s.jsx("div",{className:"usage-pop-empty",title:r("该账号的额度只有福利 token 池(见余额格那两行),订阅统计没有积分类计量表"),children:r("该账号没有积分类读数(额度只有福利 token 池)")}):null]})]}),t.token.map(p=>s.jsx(WR,{row:p},p.name)),t.benefitAbsent?s.jsxs("span",{className:"usage-flat-line",title:r("福利按限时活动下发,不是每个账号都有 —— 正常状态,不是查询失败"),children:[s.jsx("span",{className:"usage-flat-name",children:r("福利日额度")}),s.jsx("span",{className:"usage-flat-view muted",children:r("无福利额度")})]}):null,a,o]})}function Hq({row:e}){return s.jsxs("div",{className:"usage-pop-row",title:e.title,children:[s.jsxs("div",{className:"usage-pop-line",children:[s.jsx("span",{className:"usage-pop-name",children:e.name}),s.jsx("span",{className:`usage-pop-view ${e.tone}`,children:e.view})]}),e.percent!==null?s.jsx("span",{className:`usage-pop-track${e.over?" over":""}`,children:s.jsx("i",{style:{width:`${e.percent}%`},"aria-label":r("剩余 {percent}%",{percent:Math.round(e.percent)})})}):null]})}function Uq({account:e,namesHidden:t}){const a=Fh(e),o=ir(kn(e)),c=uu(e)||r("未命名账号"),d=String(e.email||"").trim(),f=String(e.nickname||"").trim(),p=String(e.name||"").trim(),h=w=>t?N$(w):w,v=[d&&d!==c?r("邮箱 {email}",{email:h(d)}):"",a?`${o.identifier} ${a}`:"",!e.nameCustom&&p&&p!==d&&p!==f?r("备注名 {name}",{name:h(p)}):"",f&&f!==c&&f!==d?r("昵称 {name}",{name:h(f)}):"",bf(e)?r("桌面端实时登录态(凭证每次从客户端登录态文件读取)"):"",e.updatedAt?r("更新于 {time}",{time:Fs(e.updatedAt)}):"",e.source?r("来源 {source}",{source:e.source==="imported"?r("旧数据导入"):r("手动添加")}):""].filter(Boolean),y=d&&d!==c,b=e.proxy?.error,j=v.length?s.jsx(ZU,{delay:0,children:s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("div",{className:"acct-name"}),children:s.jsx("span",{className:"name",children:h(c)})}),s.jsxs(_i,{children:[s.jsx(WU,{}),v.map((w,k)=>s.jsx("div",{children:w},k))]})]})}):s.jsx("div",{className:"acct-name",children:s.jsx("span",{className:"name",children:h(c)})});return s.jsxs(s.Fragment,{children:[j,y?s.jsx("div",{className:"acct-sub",children:s.jsx("span",{className:"acct-email",title:r("账号邮箱"),children:h(d)})}):null,b?s.jsx("div",{className:"acct-note bad",title:r("代理不可用:{error}",{error:b}),children:r("代理不可用:{error}",{error:b})}):null]})}function Vq({account:e}){const t=e.proxy,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=t?.error,d=T$(),f=Array.isArray(d)?d:[];let p="";a==="pool"&&t?.config?.proxyId?p=`${Xa}${t.config.proxyId}`:t&&(p=sg);const h=[{value:"",label:r("直连")}];for(const b of f)h.push({value:`${Xa}${b.id}`,label:lu(b)});if(d===null?h.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):f.length||h.push({value:"__hint_pool__",label:E$()?r("代理列表读取失败(重试中)"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),p===sg){const b=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";h.push({value:sg,label:`${b}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!f.some(b=>`${Xa}${b.id}`===p)&&h.push({value:p,label:`${o}${c?r("(不可用)"):""}`});h.push({value:yR,label:r("自定义代理…")});const v=c?r("代理不可用:{error}(转发时会回退直连);选「自定义代理…」去修改",{error:c}):a==="rotate"?r("当前:{label}(每条请求换一个出口);「自定义代理…」打开完整设置",{label:o}):a==="clash"||a==="custom"?r("当前:{label}(未经过代理池 —— 可在「网络代理」页把出口同步进池后来这里改选)",{label:o}):r("当前:{label};选项来自「网络代理」页;「自定义代理…」打开完整设置",{label:t?o:r("直连")}),y=h.find(b=>b.value===p);return s.jsxs(ft,{value:p,onValueChange:b=>{z$(e.id,String(b),p)},children:[s.jsx(mt,{className:Ue("w-full",c&&"border-destructive-bd"),title:v,"aria-label":r("出网代理"),children:s.jsx(pt,{children:y?.label||r("直连")})}),s.jsx(ht,{children:h.map(b=>s.jsx(qe,{value:b.value,disabled:b.disabled,children:b.label},b.value))})]})}function Fq({account:e,atFront:t}){const[a,o]=x.useState(!1),c=Ta(e),d=IA(e);return s.jsxs("div",{className:"acct-actions",children:[d?s.jsx(se,{variant:"outline",size:"xs",title:t$(e)?n$(e):r("查看可领取的套餐与名下已有的套餐(每天一期,领取需过一次人机验证)"),onClick:()=>jR(e.id),children:r("领套餐")}):null,c?s.jsx(se,{variant:"outline",size:"xs",disabled:a,title:r("查询该账号剩余余额(读数显示在余额列)"),onClick:()=>{o(!0),_$(e.id).finally(()=>o(!1))},children:r("余额")}):null,s.jsx(se,{variant:"outline",size:"xs",title:r("备注名 / 启用 / 代理"),onClick:()=>eg(e.id),children:r("设置")}),s.jsx($q,{account:e,atFront:t})]})}function $q({account:e,atFront:t}){const[a,o]=x.useState(!1),c=cr(e),d=Number(e.maxConcurrent)||0,f="w-full justify-start px-2 font-normal",p=`${f} text-destructive hover:text-destructive`;return s.jsxs(hf,{open:a,onOpenChange:o,children:[s.jsx(Uh,{render:s.jsx(se,{variant:"outline",size:"xs",title:r("更多操作")}),children:"⋯"}),s.jsx(gf,{align:"end",sideOffset:4,className:"w-[172px] p-1.5",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(se,{variant:"ghost",size:"sm",className:p,onClick:()=>{o(!1),xR(e.id,!c)},children:r(c?"禁用":"启用")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,disabled:t,title:r(t?"已在全局队列第一位":"仅将优先级调整到全局第一位,不改变启用状态"),onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("switch",e.id)},children:r("设为首选")}),s.jsx(se,{variant:"ghost",size:"sm",className:f,title:r("在账号设置的「基本」分组里设置该账号同时最多处理的请求数"),onClick:()=>{o(!1),eg(e.id)},children:r("并发上限:{value}",{value:d>0?d:r("不限")})}),e.hasRefreshToken?s.jsx(se,{variant:"ghost",size:"sm",className:f,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("refresh",e.id)},children:r("刷新 Token")}):null,s.jsx("div",{className:"my-1 h-px bg-hairline"}),s.jsx(se,{variant:"ghost",size:"sm",className:p,title:bf(e)?r("删除这条账号记录(不会影响客户端自己的登录态;之后可再点「导入桌面端登录态」加回来)"):void 0,onClick:()=>{o(!1),Pe().wbApp?.runAccountAction?.("remove",e.id)},children:r("删除账号")})]})})]})}function qq({account:e,onClose:t,onClear:a}){const o=pj(e),c=s.jsx(se,{variant:"ghost",size:"icon-xs",className:"panel-close",title:r("收起"),onClick:t,children:"✕"});return o.length?s.jsxs("div",{className:"row-panel limit-panel",children:[c,s.jsxs("div",{className:"lp-head",children:[s.jsx("b",{children:uu(e)}),s.jsx("span",{className:"muted",children:r("{n} 个模型限流中 · 记录来自上游 429 / 限额码,到恢复时间自动解除",{n:o.length})}),s.jsx(se,{variant:"outline",size:"xs",title:r("清掉该账号全部模型的限流标记"),onClick:()=>a(""),children:r("全部清除")})]}),o.map(d=>{const f=gj(d.resetAt),p=d.message||(d.status?r("上游返回 {status}",{status:d.status}):"");return s.jsxs("div",{className:"lp-row",children:[s.jsx("span",{className:"lp-model",title:d.model,children:d.model}),s.jsx(ze,{variant:"warning",shape:"tag",children:r("限流中")}),s.jsx("span",{className:"lp-reset",title:r("到恢复时间后自动解除,无需手动操作"),children:f===hj?r("恢复时间未知"):r("{time} 恢复",{time:f})}),s.jsx("span",{className:"lp-reason",title:p,children:p}),s.jsx(se,{variant:"outline",size:"2xs",title:r("清掉本机的限流标记,立刻重新尝试该模型(上游若仍在限流会再次被标记)"),onClick:()=>a(d.model),children:r("清除标记")})]},d.model)})]}):s.jsxs("div",{className:"row-panel limit-panel",children:[r("当前没有限流中的模型。"),c]})}function Gq({account:e,colSpan:t,limitsOpen:a,onClear:o}){return a?s.jsx("tr",{className:"acct-panels","data-panels-for":e.id,children:s.jsx("td",{colSpan:t,children:s.jsx(qq,{account:e,onClose:()=>nR(e.id,"limits",!1),onClear:c=>o(e.id,c)})})}):null}function Kq({namesHidden:e,allPicked:t,somePicked:a,disabled:o,onToggleAll:c}){const d=s.jsx("span",{className:"col-grip",title:r("拖动调整列宽(双击还原)")});return s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"cell-pick","data-col":"pick",children:s.jsx(Dr,{id:"acct-select-all",checked:t,indeterminate:!t&&a,disabled:o,"aria-label":r("全选当前筛选结果"),title:r("全选 / 取消全选当前筛选结果(与批量栏同一个选择)"),onCheckedChange:f=>c(f)})}),s.jsxs("th",{className:"cell-order","data-col":"order",children:[s.jsx("span",{className:"th-label",title:r("组内先后:按住左边的把手上下拖动即可调整;整组的先后拖分组带的把手"),children:r("顺序")}),d]}),s.jsxs("th",{className:"cell-account","data-col":"account",children:[s.jsxs("span",{className:"th-label",children:[r("账号"),s.jsx(Yq,{hidden:e})]}),d]}),s.jsxs("th",{className:"cell-proxy","data-col":"proxy",children:[s.jsx("span",{className:"th-label",title:r("该账号出网走的代理(Clash 出口 / 自定义 / 直连);点击可修改"),children:r("代理")}),d]}),s.jsxs("th",{className:"cell-connections","data-col":"connections",children:[s.jsx("span",{className:"th-label",title:r("此刻正在使用这个账号的请求数(含还在下发内容的流式请求);为 0 时不显示"),children:r("连接数")}),d]}),s.jsxs("th",{className:"cell-status","data-col":"status",children:[s.jsx("span",{className:"th-label",children:r("状态")}),d]}),s.jsxs("th",{className:"cell-limits","data-col":"limits",children:[s.jsx("span",{className:"th-label",title:r("该账号当前限流中的模型;点徽章看明细"),children:r("限流")}),d]}),s.jsxs("th",{className:"cell-expiry","data-col":"expiry",children:[s.jsx("span",{className:"th-label",children:r("有效期")}),d]}),s.jsxs("th",{className:"cell-usage","data-col":"usage",children:[s.jsx("span",{className:"th-label",children:r("余额")}),d]}),s.jsx("th",{className:"cell-actions","data-col":"actions",children:s.jsx("span",{className:"th-label",children:r("操作")})})]})})}function Yq({hidden:e}){const t=r(e?"显示账号名":"隐藏账号名(名字显示为星号)");return s.jsx("button",{type:"button",className:`name-eye${e?" on":""}`,title:t,"aria-label":t,"aria-pressed":e,onClick:()=>S$(),dangerouslySetInnerHTML:{__html:xg(e?"eyeOff":"eye",13)}})}const JR="dragging",Of=["drop-before","drop-after"];let Wa=null;function eO(e){e.querySelectorAll(`.${Of[0]}, .${Of[1]}`).forEach(t=>{t.classList.remove(...Of)})}function Xq(e,t){if(t==="group"){const o=e.parentElement;return o?[...o.children].filter(c=>c.classList.contains("acct-group")):[]}const a=e.parentElement;return a?[...a.children].filter(o=>o.classList.contains("acct-row")):[]}function tO(e,t){for(let a=0;aa!==e.item);eO(e.container),t.length&&(e.index>=t.length?t[t.length-1].classList.add(Of[1]):t[e.index].classList.add(Of[0]))}function nO(e){if(!Wa)return;if(e.buttons===0){bg(!1);return}const t=Wa.items.filter(o=>o!==Wa.item),a=tO(t,e.clientY);a!==Wa.index&&(Wa.index=a,Qq(Wa))}function bg(e){const t=Wa;t&&(Wa=null,window.removeEventListener("pointermove",nO),window.removeEventListener("pointerup",sO),window.removeEventListener("pointercancel",rO),window.removeEventListener("keydown",aO),document.body.classList.remove("queue-dragging"),t.item.classList.remove(JR),eO(t.container),e&&(t.kind==="group"?Uj?.onDrop({kind:"group",provider:t.provider,index:t.index}):Uj?.onDrop({kind:"row",provider:t.provider,accountId:t.accountId,index:t.index})))}function sO(){bg(!0)}function rO(){bg(!1)}function aO(e){e.key==="Escape"&&bg(!1)}let Uj=null;function Zq(e,t){Uj=t,e&&e.dataset.queueDragBound!=="1"&&(e.dataset.queueDragBound="1",e.addEventListener("pointerdown",a=>{if(a.button!==0||Wa)return;const o=a.target,c=o?.closest?.(".queue-grip"),d=o?.closest?.(".order-grip");if(!c&&!d)return;if(a.preventDefault(),c&&t.isLocked()){t.onLockedAttempt();return}const f=(c??d).closest("tbody.acct-group, tr.acct-row");if(!f)return;const p=c?"group":"row",h=f.dataset.provider||f.closest("tbody.acct-group")?.dataset.provider||"",v=f.dataset.id||"";if(p==="row"&&!v)return;const y=Xq(f,p);if(y.length<2)return;const b=y.filter(j=>j!==f);Wa={kind:p,provider:h,accountId:v,item:f,container:f.parentElement||e,items:y,index:tO(b,a.clientY)},f.classList.add(JR),document.body.classList.add("queue-dragging"),window.addEventListener("pointermove",nO),window.addEventListener("pointerup",sO),window.addEventListener("pointercancel",rO),window.addEventListener("keydown",aO)}))}let vg=null,lO=!1,Vj=0,yg=null,oO="";function iO(){return vg?vg.apply(Cj):Cj}function cO(){window.wbAccountsView?.render?.()}function Wq(){const e=iO(),t=`${yg?"T":"F"}|${e.map(o=>`${o.key}:${o.align}`).join("|")}`;if(t===oO)return;oO=t,Pe().wbColSettings?.syncStaticHead("accounts",yg);const a=[...yg?.querySelectorAll("thead th")||[]];a.forEach((o,c)=>{const d=o.querySelector(".col-grip");d&&(d.style.display=c===a.length-1?"none":"")})}function Jq(){const e=x.useSyncExternalStore(YA,Ws),t=x.useRef(null),[,a]=x.useReducer(B=>B+1,0),o=!!bj(),c=El(),{groups:d,allGroups:f}=f$(Za,Al),p=p$(Za,Al),h=[{value:"all",label:r("全部({n})",{n:c.length})}].concat(XA().map(B=>({value:B.id,label:r("{label}({count})",{label:B.label,count:B.count})}))),v=d.flatMap(B=>B.accounts),y=m$(),b=iO(),j=cg(v.length,"accounts",{defaultSize:"all"}),w=j.paged?j.slice(v):v,k=Qh()||j.paged,S=Qh()?r("清除筛选"):r("把每页调回「全部」");x.useEffect(()=>{A$()}),x.useEffect(()=>{x$()},[e.version]),x.useLayoutEffect(()=>{if(!lO){if(!Pe().wbColSettings?.register){window.clearTimeout(Vj),Vj=window.setTimeout(()=>N(B=>B+1),50);return}lO=!0,vg=Pe().wbColSettings?.register({id:"accounts",label:r("账号表"),columns:Cj.map(B=>({key:B.key,label:B.label,align:B.align,legacyAlign:B.legacyAlign})),mount:()=>document.querySelector("#batch-bar .batch-actions"),onChange:cO})||null,vg&&a();return}Wq()});const[,N]=x.useState(0);x.useEffect(()=>()=>window.clearTimeout(Vj),[]),x.useEffect(()=>{T8(t.current,cO)},[]);const T=v.map(B=>B.id),D=T.length>0&&T.every(B=>e.selected.has(B)),C=T.some(B=>e.selected.has(B)),A=[...e.selected].filter(B=>!T.includes(B)).length,R=e.selected.size>0,I=f.length>0&&f.every(B=>e.collapsed.has(B.provider)),P=new Map;for(const B of d)P.set(B.provider,w.filter(z=>kn(z)===B.provider).map(z=>z.id));const O=x.useRef({displayed:d,all:f,renderedRows:P});x.useEffect(()=>{O.current={displayed:d,all:f,renderedRows:P}});const _=x.useRef({locked:!1,lockReason:"",onDrop:B=>{}}),L=x.useCallback(B=>{const{displayed:z,all:Q}=O.current;if(B.kind==="group"){const Z=Q.findIndex(te=>te.provider===B.provider);if(Z<0)return;const ae=Q[Z],ce=Q.filter((te,Ce)=>Ce!==Z),J=B.indexte.provider===J),ge=J===null||ie<0?ce.length:ie;if(ge===Z)return;const fe=[...ce.slice(0,ge),ae,...ce.slice(ge)].flatMap(te=>te.members.map(Ce=>Ce.id));bR(fe,r("{name} 移到第 {rank} 顺位",{name:ae.label,rank:ge+1}));return}const K=Q.find(Z=>Z.provider===B.provider);if(!K)return;const X=K.members.findIndex(Z=>Z.id===B.accountId);if(X<0)return;const q=K.members[X],$=K.members.filter((Z,ae)=>ae!==X),Y=O.current.renderedRows.get(B.provider)||[],F=B.indexZ.id===F),W=F===null||G<0?$.length:G;if(W===X)return;const le=[...$.slice(0,W),q,...$.slice(W)],U=Q.map(Z=>Z.provider===B.provider?{...Z,members:le}:Z).flatMap(Z=>Z.members.map(ae=>ae.id));bR(U,r("{name} 移到 {group} 组内第 {rank} 位",{name:String(q.name||q.id),group:K.label,rank:W+1}))},[]);x.useEffect(()=>{_.current={locked:k,lockReason:S,onDrop:L}}),x.useEffect(()=>{Zq(t.current,{isLocked:()=>_.current.locked,onLockedAttempt:()=>_e(r("当前视图不能调整组顺位:{reason} 之后再拖动",{reason:_.current.lockReason}),"err"),onDrop:B=>_.current.onDrop(B)})},[]);function H(B,z,Q){switch(B){case"pick":return s.jsx(Dr,{checked:Q.picked,"data-pick":z.id,title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:K=>y$(z.id,K)});case"order":return s.jsx(jq,{account:z,rank:Q.rank});case"account":return s.jsx(Uq,{account:z,namesHidden:e.namesHidden});case"proxy":return s.jsx(Vq,{account:z});case"connections":return s.jsx(Tq,{account:z});case"status":return s.jsx(Nq,{account:z});case"limits":return s.jsx(kq,{account:z,open:Q.limitsOpen});case"expiry":return s.jsx(Cq,{account:z});case"usage":return s.jsx(zq,{account:z});case"actions":return s.jsx(Fq,{account:z,atFront:Q.seat.position<=1});default:return null}}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel account-table",children:[s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"group","data-provider-group":"1",children:[s.jsx("span",{className:"label",children:r("提供商")}),s.jsxs(ft,{value:e.filter.provider,onValueChange:B=>g$(String(B)),children:[s.jsx(mt,{className:"max-w-none min-w-0 w-full min-[768px]:max-w-[200px] min-[768px]:min-w-[130px] min-[768px]:w-auto","aria-label":r("按提供商筛选账号"),children:s.jsx(pt,{children:h.find(B=>B.value===e.filter.provider)?.label||r("全部")})}),s.jsx(ht,{children:h.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsx("div",{className:"divider","data-provider-divider":"1"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("搜索")}),s.jsx(Fe,{className:"acct-search",type:"search",value:e.filter.q,placeholder:r("账号名 / 邮箱 / 备注"),"aria-label":r("搜索账号"),onChange:B=>h$(B.currentTarget.value)})]}),s.jsx("div",{className:"divider"}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("状态")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.enabledAll??0},{value:"enabled",label:r("启用"),count:p.enabled??0},{value:"disabled",label:r("禁用"),count:p.disabled??0}],value:e.filter.enabled,onValueChange:B=>QA("enabled",B),"aria-label":r("启用状态")})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"label",children:r("限额")}),s.jsx(In,{options:[{value:"all",label:r("全部"),count:p.limitAll??0},{value:"normal",label:r("正常"),count:p.normal??0,disabled:e.filter.enabled==="disabled"},{value:"limited",label:r("已限流"),count:p.limited??0,disabled:e.filter.enabled==="disabled"}],value:e.filter.limit,onValueChange:B=>QA("limit",B),"aria-label":r("限额状态")})]}),s.jsxs("div",{className:"actions",children:[s.jsx(se,{id:"btn-fold-groups",variant:"outline",disabled:!f.length,title:r(I?"展开全部分组":"折叠全部分组(只留组头)"),onClick:()=>b$(f.map(B=>B.provider),!I),children:r(I?"展开全部":"折叠全部")}),s.jsx(se,{id:"btn-add-account-2",variant:"default",title:r("登录 / 导入一个新账号"),onClick:()=>{Pe().wbAddAccountModal?.open?.(),Pe().wbAccountAddForms?.syncAddProvider?.()},children:r("添加账号")}),s.jsx(se,{id:"btn-query-usage",variant:"outline",disabled:e.usageBusy||!c.some(Ta),title:r("查询全部账号的余额(含已禁用账号 —— 禁用只表示不参与转发)"),onClick:()=>{hR()},children:e.usageBusy?r("查询中…"):r("查询余额")})]})]}),s.jsxs("div",{className:Ue("batch-bar",R&&"active"),id:"batch-bar",children:[s.jsxs("label",{className:"batch-select-all",children:[s.jsx(Dr,{id:"batch-select-all",checked:D,indeterminate:!D&&C,disabled:!T.length,"aria-label":r("全选当前筛选结果"),onCheckedChange:B=>eR(T,B)}),s.jsx("span",{id:"batch-select-label",children:T.length?r("全选当前筛选结果({n} 个)",{n:T.length}):r("没有可全选的账号")})]}),s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{id:"batch-count",children:e.selected.size})," ",r("个 · 共")," ",s.jsx("b",{id:"accounts-count",children:c.length})," ",r("个")]}),s.jsx("span",{className:"batch-summary",id:"accounts-group-summary",children:d.length?r("{groups} 家 · 显示 {rows} 行",{groups:d.length,rows:T.length}):""}),k?s.jsx("span",{className:"batch-hidden",title:r("筛选 / 搜索 / 分页生效时组顺位不可拖动(别家的组整组不可见,落点没法定位)"),children:r("组顺位已锁定")}):null,Qh()?s.jsx(se,{id:"btn-clear-filter",variant:"ghost",size:"xs",title:r("清空搜索与三个筛选档位,回到全部账号"),onClick:()=>ZA(),children:r("清除筛选")}):null,A?s.jsx("span",{className:"batch-hidden",id:"batch-hidden-hint",children:r("另有 {n} 个已勾选账号被当前筛选隐藏,仍会参与操作",{n:A})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{id:"btn-batch-open",variant:"outline",disabled:!R,onClick:()=>yj([...e.selected],"enable"),children:r("批量操作")}),s.jsx(se,{id:"btn-batch-clear",variant:"outline",disabled:!R,onClick:()=>j$(),children:r("取消选择")})]})]}),s.jsx("div",{className:"acct-scroll",id:"account-list",ref:t,children:o?c.length?v.length?s.jsxs("table",{className:"acct-table",ref:eG,style:{minWidth:`${k8(b.map(B=>B.key))}px`},children:[s.jsx(tG,{}),s.jsx(Kq,{namesHidden:e.namesHidden,allPicked:D,somePicked:C,disabled:!T.length,onToggleAll:B=>eR(T,B)}),d.map(B=>{const z=e.collapsed.has(B.provider),Q=w.filter(K=>kn(K)===B.provider);return s.jsxs("tbody",{className:"acct-group","data-provider":B.provider,children:[s.jsx(Sq,{group:B,collapsed:z,colSpan:b.length}),z?null:Q.map(K=>{const X=B.members.findIndex($=>$.id===K.id)+1,q=B$(K,y,X>0?X:1);return s.jsxs(x.Fragment,{children:[s.jsx("tr",{className:Ue("acct-row",!cr(K)&&"disabled",q.picked&&"selected"),"data-id":K.id,"data-provider":B.provider,"data-desktop":bf(K)?"1":void 0,children:b.map($=>s.jsx("td",{className:`cell-${$.key} ta-${$.align}`,children:H($.key,K,q)},$.key))}),s.jsx(Gq,{account:K,colSpan:b.length,limitsOpen:tR(K.id,"limits"),onClear:($,Y)=>{L$($,Y)}})]},K.id)})]},B.provider)})]}):s.jsxs("div",{className:"empty",children:[r("当前筛选条件下没有账号"),Qh()?s.jsx("button",{type:"button",className:"link-btn",onClick:()=>ZA(),children:r("清除筛选")}):null]}):s.jsx("div",{className:"empty",children:r("暂无账号,请点击右上角「添加账号」")}):s.jsxs("div",{className:"empty",children:[s.jsx("span",{className:"spinner"}),r("正在加载…")]})}),s.jsx(Li,{total:v.length,range:j.paged?{start:j.rangeStart,end:j.rangeEnd}:null,page:j.page,pageCount:j.pageCount,size:j.size,onSizeChange:j.setSize,onPageChange:j.goto})]}),s.jsx(x8,{})]})}function eG(e){yg=e}function tG(){const e=N8(),t=a=>s.jsx("col",{"data-col":a,style:e[a]?{width:`${e[a]}px`}:void 0},a);return s.jsxs("colgroup",{children:[t("pick"),t("order"),t("account"),t("proxy"),t("connections"),t("status"),t("limits"),t("expiry"),t("usage"),t("actions")]})}const uO='.page[data-page="accounts"]';let Fj=null;function dO(){if(Fj)return;const e=document.querySelector(uO);e&&(e.replaceChildren(),Fj=vn.createRoot(e),Cs.flushSync(()=>{Fj.render(s.jsx(Jq,{}))}))}U$(),M$(),document.querySelector(uO)?dO():document.addEventListener("DOMContentLoaded",dO,{once:!0});const nG=64,sG=100,rG=r("OpenAI 兼容填到 /v1;Anthropic 填根地址"),aG=r("Anthropic 协议填根地址,不要带 /v1"),lG="https://open.bigmodel.cn/api/paas/v4",oG="https://api.anthropic.com",iG=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],bu="custom-protocol-select",vu="custom-name-input",yu="custom-baseurl-input",Mf="custom-apikey-input",Df="custom-noauth-check",ju="custom-existing-select",If="custom-existing-apikey-input",Pf="custom-existing-noauth-check",_f="custom-existing-name-input",cG="custom-create-button",uG="custom-existing-button",dG="custom-existing-remove";let $j=!1;const fO=()=>gt().wbProviders?.PROTOCOL_OPTIONS||iG,qj=()=>gt().wbProviders?.customList?.()||[],Gj="custom-balance",Kj="custom-existing-balance",Lf=(e,t)=>`${e}-${t}-input`;function pO(e){if(!e)return"";const t=gt().wbPresetProviders?.presetOf?.(e);return String(t?.balance?.scheme||"")}function mO(e,t){const a=kf(e);if(!a||!a.fields.length)return null;const o={};for(const c of a.fields){const d=yr(Lf(t,c.key));d&&(o[c.key]=d)}return Object.keys(o).length?o:null}function hO(e,t){const a=kf(e);if(a)for(const o of a.fields)No(Lf(t,o.key),"")}function gO({scheme:e,prefix:t}){const a=kf(e);return a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("余额查询")}),s.jsxs("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:[s.jsx("span",{className:"text-xs text-subtle",children:r("方案:{label}",{label:a.label})}),s.jsx("span",{className:"ml-1.5 text-xs text-subtle",children:a.endpoint})]}),s.jsx("span",{className:"hint",children:a.note})]}),a.fields.map(o=>s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Lf(t,o.key),children:o.label}),s.jsx(Fe,{id:Lf(t,o.key),type:o.secret?"password":"text",autoComplete:o.secret?"new-password":"off",placeholder:o.placeholder,...Aa(Lf(t,o.key))}),s.jsx("span",{className:"hint",children:o.hint})]},o.key))]}):null}async function Yj(e,t){if(!$j){$j=!0,e(!0);try{await t()}finally{$j=!1,e(!1)}}}async function xO(e){gt().wbAddAccountModal?.close?.(),gt().wbProviders?.refreshCustom?.(),await gt().wbApp?.refresh?.(),Jn(e)}function zf(e,t){No(e,t?"1":"")}function jg(e){return yr(e)==="1"}function bO({checked:e,note:t,onChange:a}){return s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{children:r("鉴权")}),s.jsx("div",{className:"col-start-2 row-start-1 flex h-[30px] items-center",children:s.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2.5",children:[s.jsx(Dr,{checked:e,"aria-label":r("该上游无需鉴权"),onCheckedChange:o=>a(o===!0)}),s.jsx("span",{className:"text-xs text-subtle",children:r("该上游无需鉴权(不发送鉴权头)")})]})}),s.jsx("span",{className:"hint",children:t})]})}function fG({mode:e,providerHint:t,presetKey:a,showToken:o,version:c}){const d=fO(),[f,p]=x.useState(()=>yr(bu)||d[0].value),[h,v]=x.useState(""),[y,b]=x.useState(""),[j,w]=x.useState(()=>yr(ju)),[k,S]=x.useState(()=>jg(Df)),[N,T]=x.useState(()=>jg(Pf)),D=x.useMemo(()=>qj(),[c]),A=(t&&D.some(B=>B.id===t)?t:"")||(D.some(B=>B.id===j)?j:D[0]?.id||""),R=D.find(B=>B.id===A)?.name||r("该提供商");x.useEffect(()=>{No(ju,A)},[A]),x.useEffect(()=>{if(!a)return;const B=gt().wbPresetProviders?.presetOf?.(a);if(!B)return;const z=B.account?.noAuth===!0;if(e!=="create"){T(z),zf(Pf,z);return}No(vu,B.name||""),No(yu,B.baseUrl||""),B.protocol&&(p(B.protocol),No(bu,B.protocol)),S(z),zf(Df,z),v(B.hint||""),b(B.placeholder||"")},[e,a,t,o]);const I=f==="anthropic",P=h||(I?aG:rG),O=y||(I?oG:lG),_=e==="create"?pO(a):"",L=e==="existing"?String(D.find(B=>B.id===A)?.balanceScheme||""):"",H=(B,z)=>Q=>{z(Q),zf(B,Q)};return s.jsxs(s.Fragment,{children:[s.jsxs(zn,{hidden:e!=="create",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("上游信息")}),s.jsx("span",{children:r("创建这个提供商,并同时建立它的第一个账号。")})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:vu,children:[r("名称"),s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx(Fe,{id:vu,type:"text",maxLength:nG,"aria-required":"true",placeholder:r("如:智谱 GLM"),...Aa(vu)}),s.jsx("span",{className:"hint",children:r("1~64 个字符,账号列表里按它分组显示")})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:bu,children:r("协议")}),s.jsxs(ft,{value:f,onValueChange:B=>{const z=String(B);p(z),No(bu,z),v("")},children:[s.jsx(mt,{id:bu,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:d.find(B=>B.value===f)?.label||f})}),s.jsx(ht,{children:d.map(B=>s.jsx(qe,{value:B.value,children:B.label},B.value))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsxs(Je,{htmlFor:yu,children:["Base URL",s.jsx("i",{className:"req","aria-hidden":"true",children:"*"})]}),s.jsx(Fe,{id:yu,type:"text","aria-required":"true",placeholder:O,...Aa(yu)}),s.jsx("span",{className:"hint",id:"custom-baseurl-hint",children:P})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:Mf,children:"API Key"}),s.jsx(Fe,{id:Mf,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:k,...Aa(Mf)}),s.jsx("span",{className:"hint",children:r(k?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:k,note:r(k?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"本地 Ollama、OpenCode Zen 免费档这类上游要勾上,否则账号不可用"),onChange:H(Df,S)}),s.jsx(gO,{scheme:_,prefix:Gj})]})]}),s.jsxs(zn,{hidden:e!=="existing",children:[s.jsxs("div",{className:"add-panel-head",children:[s.jsx("h3",{children:r("账号信息")}),s.jsxs("span",{children:[r("添加到 "),s.jsx("b",{children:R}),r(" 同一家可以放多把 key,按优先级轮换。")]})]}),s.jsxs("div",{className:"add-form",children:[s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:ju,children:r("提供商")}),s.jsxs(ft,{value:A,onValueChange:B=>w(String(B)),children:[s.jsx(mt,{id:ju,className:"col-start-2 row-start-1 w-full",children:s.jsx(pt,{children:R})}),s.jsx(ht,{children:D.map(B=>s.jsx(qe,{value:B.id,children:B.name||B.id},B.id))})]})]}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:If,children:"API Key"}),s.jsx(Fe,{id:If,type:"password",autoComplete:"new-password",placeholder:"sk-…",disabled:N,...Aa(If)}),s.jsx("span",{className:"hint",children:r(N?"不需要 Key:转发与拉取模型都不发送鉴权头":"上游不要鉴权时留空,并勾选下面一项(留空又不勾会被当成未配置凭证)")})]}),s.jsx(bO,{checked:N,note:r(N?"已声明无需鉴权:账号会被正常选路,出网时不带任何鉴权头":"同一家可以混着放:有 Key 的账号与无鉴权账号各按各的规则走"),onChange:H(Pf,T)}),s.jsx(gO,{scheme:L,prefix:Kj}),s.jsxs("div",{className:"add-field",children:[s.jsx(Je,{htmlFor:_f,children:r("备注名")}),s.jsx(Fe,{id:_f,type:"text",maxLength:sG,placeholder:r("可选"),...Aa(_f)}),s.jsx("span",{className:"hint",children:r("留空则用提供商名称")})]})]})]})]})}function vO(e,t){const a=mu(t);Jn(r("添加失败:{reason}",{reason:a}),"err"),e.setHint(a)}async function pG(e){const t=yr(vu),a=yr(bu)||fO()[0].value,o=yr(yu),c=yr(Mf),d=jg(Df);if(!t){Jn(r("请填写名称"),"err");return}if(!o){Jn(r("请填写 Base URL"),"err");return}await Yj(e.setBusy,async()=>{const f={name:t,protocol:a,baseUrl:o},p=e.presetKey?gt().wbPresetProviders?.presetOf?.(e.presetKey):null,h=p?.quirks||{};h.urlSuffix&&(f.urlSuffix=h.urlSuffix),h.headers&&Object.keys(h.headers).length&&(f.headers={...h.headers}),h.anthropicToolType&&(f.anthropicToolType=h.anthropicToolType),p?.clientEmulation&&(f.clientEmulation=p.clientEmulation);const v=pO(e.presetKey);v&&(f.balanceScheme=v);const y=mO(v,Gj);y&&(f.balanceQuery=y),d?f.noAuth=!0:c&&(f.apiKey=c),e.setHint("");try{const b=await gt().wbProviders?.customRequest?.("POST","/api/custom-providers",f);Mj([vu,yu,Mf]),hO(v,Gj),zf(Df,!1);const j=b?.provider?.name||t;await xO(r("✅ 已创建自定义提供商「{name}」并添加账号",{name:j}))}catch(b){vO(e,b)}})}async function mG(e){const t=yr(ju);if(!t){Jn(r("请先选择一个自定义提供商"),"err");return}const a=yr(If),o=jg(Pf),c=yr(_f),d=String(qj().find(f=>f.id===t)?.balanceScheme||"");await Yj(e.setBusy,async()=>{const f={provider:t};o?f.noAuth=!0:a&&(f.apiKey=a),c&&(f.name=c);const p=mO(d,Kj);p&&(f.balanceQuery=p),e.setHint("");try{const h=await gt().wbProviders?.customRequest?.("POST","/api/accounts",f);Mj([If,_f]),hO(d,Kj),zf(Pf,!1);const v=h?.account?.name||qj().find(y=>y.id===t)?.name||"";await xO(r("✅ {label}账号已添加{name}",{label:"",name:v?`:${v}`:""}))}catch(h){vO(e,h)}})}async function hG(){const e=yr(ju);if(!e){Jn(r("请先选择一个自定义提供商"),"err");return}const t=gt().wbCustomProvidersUi?.remove;if(typeof t!="function"){Jn(r("删除功能不可用(脚本未就绪)"),"err");return}await Yj(()=>{},async()=>{await t(e)&>().wbAddAccountModal?.close?.()})}function gG({mode:e,presetKey:t}){const[a,o]=x.useState(!1),[c,d]=x.useState(""),f={presetKey:t,setBusy:o,setHint:d};return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`add-foot-hint${c?" err":""}`,id:"add-form-foot-hint",children:c}),s.jsxs("span",{className:"add-foot-actions",id:"add-form-foot-actions",children:[e==="existing"?s.jsx(se,{id:dG,variant:"destructive",title:r("级联删除名下全部账号,不可恢复"),onClick:()=>{hG()},children:r("删除此提供商")}):null,s.jsx(se,{id:cG,hidden:e!=="create",disabled:a,onClick:()=>{pG(f)},children:r(a&&e==="create"?"提交中…":"创建并添加账号")}),s.jsx(se,{id:uG,hidden:e!=="existing",disabled:a,onClick:()=>{mG(f)},children:r(a&&e==="existing"?"提交中…":"添加账号")})]})]})}const Xj={step:"pick",accountType:zj,search:"",provider:Bi,providerHint:"",presetKey:"",showToken:0},yO=()=>gt().wbProviders?.customList?.()||[];function xG({onClose:e,onReady:t}){const[a,o]=x.useState(Xj),[c,d]=x.useState(0),f=x.useCallback(()=>d(C=>C+1),[]),p=x.useCallback(()=>{o(Xj);const C=gt().wbProviders;(C?.all?.()||[]).length||C?.load?.().then(f),C?.refreshCustom?.().then(f)},[f]),h=x.useCallback(()=>{p(),o({...Xj,step:"form",provider:xu})},[p]);x.useEffect(()=>(t({reset:p,openNewCustomForm:h}),()=>t(null)),[t,p,h]),x.useEffect(()=>{gt().wbWebLogin?.refresh?.()},[]),x.useEffect(()=>{gt().wbProviders?.refreshCustom?.().then(f)},[f]),x.useEffect(()=>{a.step!=="form"||a.provider!==xu||gt().wbProviders?.refreshCustom?.().then(f)},[a.step,a.provider,a.showToken,f]);const v=Q8(a.provider),y=a.provider===xu,b=a.provider===Bi||y||!!v,j=a.providerHint?"existing":"create",w=a.providerHint?yO().find(C=>C.id===a.providerHint)?.name||"":a.presetKey&>().wbPresetProviders?.presetOf?.(a.presetKey)?.name||"",k=a.provider===Bi?Dj:gt().wbProviders?.labelOf?.(a.provider)||a.provider,S=y?a.providerHint||a.presetKey?r("登录 / 添加 {name} 账号",{name:w||r("自定义提供商")}):r("新建自定义提供商"):r("登录 / 添加 {name} 账号",{name:k});function N(C){if(!C)return;const A={step:"form",showToken:a.showToken+1};if(C===Hj)o(R=>({...R,...A,provider:xu,providerHint:"",presetKey:""}));else if(C.startsWith(Rf)){const R=C.slice(Rf.length),I=zR(gt().wbPresetProviders?.presetOf?.(R));o(P=>({...P,...A,provider:xu,providerHint:I?.id||"",presetKey:R}))}else yO().some(R=>R.id===C)?o(R=>({...R,...A,provider:xu,providerHint:C,presetKey:""})):o(R=>({...R,...A,provider:C,providerHint:"",presetKey:""}))}const T=()=>o(C=>({...C,step:"pick"})),D=a.accountType===fq;return s.jsx(Qt,{open:!0,onOpenChange:C=>{C||e()},children:s.jsxs(Zt,{className:"w-[min(1100px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加账号")})}),s.jsx(Bt,{children:s.jsx(yq,{accountType:a.accountType,onAccountTypeChange:C=>o(A=>({...A,accountType:C})),search:a.search,onSearchChange:C=>o(A=>({...A,search:C})),onPick:N,version:c,importing:D,importPanel:void 0})}),null,s.jsx(Qt,{open:a.step==="form",onOpenChange:C=>{C||T()},children:s.jsxs(Zt,{keepMounted:!0,overlayForceRender:!0,className:"w-[min(620px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:S})}),s.jsxs(Bt,{children:[s.jsx(dq,{active:a.provider===Bi}),qR.map(C=>s.jsx(oq,{config:C,active:a.provider===C.provider},C.provider)),s.jsx("div",{className:"add-provider-block",style:y?void 0:{display:"none"},children:s.jsx(fG,{mode:j,providerHint:a.providerHint,presetKey:a.presetKey,showToken:a.showToken,version:c})}),b?null:s.jsx("div",{className:"add-provider-block",children:s.jsxs(zn,{children:[s.jsx("h3",{children:r("该提供商账号添加功能即将上线")}),s.jsx("p",{children:r("「{name}」的账号添加功能还在开发中,敬请期待。",{name:k})})]})})]}),y?s.jsx(nn,{children:s.jsx(gG,{mode:j,presetKey:a.presetKey})}):null]})})]})})}let Co=null,wu=null,Hi=null,wg=null;function bG(){Co&&(Co.unmount(),Co=null),wu&&(wu.remove(),wu=null),Hi=null}function jO(){wu=document.createElement("div"),document.body.append(wu),Co=vn.createRoot(wu),Co.render(s.jsx(xG,{onClose:wO,onReady:e=>{if(Hi=e,!e)return;const t=wg;wg=null,t?.()}}))}function wO(){gt().wbWebLogin?.cancelIfActive?.(""),gt().wbAutoclawOauth?.cancel?.(),bG()}function Qj(){if(Co){Hi?.reset();return}wg=()=>Hi?.reset(),jO()}function vG(){if(Co){Hi?.openNewCustomForm();return}wg=()=>Hi?.openNewCustomForm(),jO()}for(const e of["btn-add-account","btn-add-account-2"])document.getElementById(e)?.addEventListener("click",Qj);const SO=window;SO.wbAddAccountModal={open:Qj,close:wO},SO.wbAccountAddForms={syncAddProvider:()=>{Co?Hi?.reset():Qj()},openNewCustomForm:vG};const yG=3065;let Su=null;function jG(){return window.workbuddyDesktop}const NO="same-origin";async function Zj(e=!1){if(Su&&!e)return Su;const t=jG();if(t?.platform==="web"){const o=typeof window>"u"?"":window.location?.origin;if(o&&o!=="null")return Su=o,Su}let a=0;try{const o=await t?.getBackendStatus?.(),c=Number(o?.port);Number.isFinite(c)&&c>0&&(a=c)}catch{}return a>0?(Su=`http://127.0.0.1:${a}`,Su):`http://127.0.0.1:${yG}`}async function wG(){const t=await window.workbuddyDesktop?.getModelManage?.(),a=Array.isArray(t?.models)?t.models:[],o=Array.isArray(t?.mappings)?t.mappings:[],c=new Set,d=[],f=new Set;for(const p of a){if(p.enabled!==!0)continue;const h=String(p.provider??""),v=String(p.id??"");!h||!v||(c.add(`${h}${v}`),f.has(v)||(f.add(v),d.push(v)))}for(const p of o){if(p.enabled!==!0||p.isDefault===!0)continue;const h=String(p.provider??""),v=String(p.target??""),y=String(p.alias??"");(!y||!f.has(y)&&c.has(`${h}${v}`))&&(f.add(y),d.push(y))}return d}function kO(e,t){if(typeof e=="string"&&e.trim())return e.trim();if(e&&typeof e=="object"){const a=e.message;if(typeof a=="string"&&a.trim())return a.trim();try{return JSON.stringify(e)}catch{}}return`HTTP ${t}`}function CO(e,t){const a=e instanceof Error?e.message:String(e);return new Error(`连接网关失败(${t}):${a}`)}async function TO(e,t,a){const o=await Zj();let c;try{c=await fetch(o+t,{method:e,headers:a===void 0?void 0:{"Content-Type":"application/json"},body:a===void 0?void 0:JSON.stringify(a),credentials:NO})}catch(v){throw CO(v,o)}const d=await c.text();let f=null;try{f=d?JSON.parse(d):null}catch{f=null}const p=f;if(!c.ok||p?.success===!1){const v=p?.error??f?.error,y=kO(v,c.status);throw c.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${y}`):new Error(y)}return p&&typeof p=="object"&&"data"in p?p.data:f}async function SG(){const t=(await TO("GET","/api/assistant/config"))?.config;if(!t||typeof t!="object")throw new Error("配置响应不完整");const a=typeof t.model=="string"?t.model:t.model?.id;return{model:typeof a=="string"&&a.trim()?a:null,systemPromptEnabled:t.systemPromptEnabled!==!1,systemPrompt:typeof t.systemPrompt=="string"?t.systemPrompt:"",tools:t.tools&&typeof t.tools=="object"?t.tools:{}}}async function NG(e){const t=await TO("PUT","/api/assistant/config",{config:e});return t?.config&&typeof t.config=="object"?t.config:e}function kG(e){return e.map(t=>{if(t.role==="tool")return{role:"tool",tool_call_id:t.toolCallId,content:t.content};if(t.role==="assistant"){const a={role:"assistant",content:t.content||""};return t.toolCalls?.length&&(a.tool_calls=t.toolCalls.map(o=>({id:o.id,type:"function",function:{name:o.name,arguments:o.arguments}}))),a}return{role:"user",content:t.content}})}async function CG(e){const t=await Zj(),a={messages:kG(e.messages)};e.tools.length&&(a.tools=e.tools);let o;try{o=await fetch(t+"/api/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),signal:e.signal,credentials:NO})}catch(b){throw e.signal?.aborted?b:CO(b,t)}if(!o.ok||!o.body){const b=await o.text().catch(()=>"");let j=null;try{j=b?JSON.parse(b):null}catch{}const w=j?.error,k=kO(w,o.status);throw o.status===404?new Error(`这一版网关还没有 AI 助手接口(HTTP 404):后端还是旧的,重新编译 / 重启客户端后再试。${k}`):new Error(k)}const c=o.body.getReader(),d=new TextDecoder;let f="";const p=new Map;let h="";const v=b=>{for(const j of b.split(` +`)){const w=j.trimEnd();if(!w.startsWith("data:"))continue;const k=w.slice(5).trim();if(!k)continue;if(k==="[DONE]")return!0;let S;try{S=JSON.parse(k)}catch{continue}const N=Array.isArray(S.choices)?S.choices[0]:void 0,T=N?.delta||{},D=typeof T.content=="string"?T.content:"";if(D&&e.onEvent({type:"delta",text:D}),Array.isArray(T.tool_calls))for(const C of T.tool_calls){const A=Number(C.index??0),R=p.get(A)||{id:"",name:"",arguments:""};typeof C.id=="string"&&C.id&&(R.id=C.id);const I=C.function||{};typeof I.name=="string"&&I.name&&(R.name=I.name),typeof I.arguments=="string"&&(R.arguments+=I.arguments),p.set(A,R)}typeof N?.finish_reason=="string"&&(h=N.finish_reason)}return!1};for(;;){const{done:b,value:j}=await c.read();if(b)break;f+=d.decode(j,{stream:!0});let w=f.indexOf(` -`);for(;j>=0;){const S=f.slice(0,j);if(f=f.slice(j+2),b(S)){await c.cancel().catch(()=>{}),f="",j=-1;break}j=f.indexOf(` +`);for(;w>=0;){const k=f.slice(0,w);if(f=f.slice(w+2),v(k)){await c.cancel().catch(()=>{}),f="",w=-1;break}w=f.indexOf(` -`)}}const y=[...p.entries()].sort((v,w)=>v[0]-w[0]).map(([,v])=>v);y.length&&e.onEvent({type:"toolCalls",calls:y}),e.onEvent({type:"done",finishReason:h})}function Ww(e){const t=String(e||"").trim();if(!t)return{};try{const a=JSON.parse(t);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Ja(){const e=window.workbuddyDesktop;if(!e)throw new Error(r("桌面桥不可用(本页需要在 Agent2API 客户端里打开)"));return e}function Su(){window.wbApp?.refresh?.()}function at(e,t=256){return typeof e=="string"?e.trim().slice(0,t):""}function Ui(e){return typeof e=="boolean"?e:void 0}function Bf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Nu(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"):[]}function ku(e){return(e instanceof Error?e.message:String(e)).replace(/^Error:\s*/,"")}async function jg(){const e=await Ja().getState?.();return(Array.isArray(e?.accounts)?e.accounts:[]).slice().sort((a,o)=>Number(a.priority??0)-Number(o.priority??0))}function Hf(e){return at(e.name)||at(e.nickname)||at(e.id)||"(未命名账号)"}function Jw(e,t){const a=t.trim();if(!a)throw new Error(r("没给账号名"));const o=e.find(p=>at(p.id)===a);if(o)return o;const c=e.filter(p=>Hf(p)===a);if(c.length===1)return c[0];const d=e.filter(p=>Hf(p).includes(a));if(d.length===1)return d[0];const f=(c.length?c:d).map(Hf).slice(0,6);throw f.length?new Error(r("「{name}」匹配到多个账号:{list},请用完整账号名重试",{name:a,list:f.join("、")})):new Error(r("没有找到账号「{name}」",{name:a}))}const CG={id:"list_models",label:r("获取模型列表"),kind:"read",desc:"读取各提供商的模型清单(模型 ID、所属提供商、是否启用、已挂的映射名)以及全部映射。回答「有哪些模型」「哪些模型在多家重复」「某个名字挂在哪」这类问题之前先调用它。",params:{type:"object",properties:{provider:{type:"string",description:"只看某一家(提供商 id,如 codearts / workbuddy);不填 = 全部"},keyword:{type:"string",description:"按模型 ID 或映射名做子串过滤;不填 = 不过滤"},enabledOnly:{type:"boolean",description:"true = 只看已启用的模型"}}},run:async e=>{const t=at(e.provider,64).toLowerCase(),a=at(e.keyword,128).toLowerCase(),o=Ui(e.enabledOnly)===!0,c=await Ja().getModelManage?.(),f=(Array.isArray(c?.models)?c.models:[]).filter(p=>!(t&&at(p.provider).toLowerCase()!==t||o&&p.enabled!==!0||a&&![at(p.id),at(p.name),...Array.isArray(p.aliases)?p.aliases.map(b=>at(b)):[]].join(" ").toLowerCase().includes(a))).map(p=>({provider:at(p.provider),id:at(p.id),enabled:p.enabled===!0,aliases:Array.isArray(p.aliases)?p.aliases.map(h=>at(h)):[]}));return{text:JSON.stringify({total:f.length,models:f.slice(0,400)}),summary:r("{n} 个模型",{n:f.length})}}},TG={id:"list_account_balance",label:r("查询账号余额"),kind:"read",desc:"查询各账号的余额 / 剩余额度(会向各上游发起真实的余额查询)。回答「还剩多少」「哪个账号快用完了」这类问题之前先调用它。",params:{type:"object",properties:{account:{type:"string",description:"只查某个账号(账号名或 id);不填 = 全部账号"}}},run:async e=>{const t=at(e.account,128),a=t?at(Jw(await jg(),t).id):"",o=await Ja().getAllBalances?.(a||void 0),c=Array.isArray(o?.results)?o.results:o,d=Array.isArray(c)?c:[];return{text:JSON.stringify({accounts:d.slice(0,60)}).slice(0,12e3),summary:r("{n} 个账号",{n:d.length})}}},EG={id:"set_model_enabled",label:r("启用 / 禁用模型"),kind:"write",desc:"开启或关闭某几个模型在网关上的可用性(粒度是「提供商 × 模型」)。禁用后下游请求不再路由到它。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的模型列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["provider","id","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items);return{lead:r("将修改 {n} 个模型的启停状态:",{n:t.length}),table:{head:[r("提供商"),r("模型"),r("改成")],rows:t.map(a=>[at(a.provider),at(a.id),Ui(a.enabled)===!1?r("禁用"):r("启用")])},note:r("改动立即生效;禁用后指向它的请求会落到下一个候选。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=Ui(c.enabled);if(!d||!f||p===void 0)throw new Error(r("参数不完整(需要 provider / id / enabled)"));await t.setModelState?.({provider:d,id:f,enabled:p}),o.push(`${p?"启用":"禁用"} ${d}/${f}`)}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已修改 {n} 个模型",{n:o.length})}}},AG={id:"set_model_mapping",label:r("设置模型映射 ID"),kind:"write",desc:"给模型新增或删除映射名(对外名)。同一对外名可以在多个提供商各挂一条:下游用同一个名字请求,网关按账号优先级主备切换;也可以给不同家的同名模型各加前缀(如 ca/claude-sonnet-4.5)来精确指定某一家。一次可以改多条。删掉的映射名只是不再对外可用,不删任何模型。",params:{type:"object",properties:{items:{type:"array",description:"要改的映射列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"上游模型 ID"},alias:{type:"string",description:"要新增 / 删除的映射名(对外名)"},action:{type:"string",enum:["add","remove"],description:"add = 新增映射,remove = 删除映射"}},required:["provider","id","alias","action"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(d=>at(d.action)!=="remove").length,o=t.length-a,c=[];return a&&c.push(r("新增 {n} 条",{n:a})),o&&c.push(r("删除 {n} 条",{n:o})),{lead:r("将改动 {n} 条映射({parts}):",{n:t.length,parts:c.join("、")}),table:{head:[r("提供商"),r("上游模型"),r("操作"),r("映射名")],rows:t.map(d=>[at(d.provider),at(d.id),at(d.action)==="remove"?r("删除"):r("新增"),at(d.alias)])},note:r("只改映射名,不动上游模型 ID;映射立即生效(新对话即可用)。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=at(c.alias,128);if(!d||!f||!p)throw new Error(r("参数不完整(需要 provider / id / alias)"));at(c.action)==="remove"?(await t.removeModelMapping?.(p,f,d),o.push(`删除 ${p} → ${d}/${f}`)):(await t.addModelMapping?.(p,f,d),o.push(`新增 ${p} → ${d}/${f}`))}return Su(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已改动 {n} 条映射",{n:o.length})}}},EO=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],ej={maxInputTokens:"上下文窗口",maxOutputTokens:"最大输出 Token",supportsToolCall:"工具调用",supportsImages:"图片识别",supportsVideo:"视频识别",supportsReasoning:"深度推理"},RG={id:"set_model_capability",label:r("修改模型能力"),kind:"write",desc:"修改某个模型对下游声明的能力位:上下文窗口、最大输出 Token、工具调用 / 图片 / 视频 / 深度推理四个布尔位。只传要改的键;布尔位给 null 表示恢复上游原值。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},capabilities:{type:"object",description:"要改的能力位(只写要改的键)",properties:{maxInputTokens:{type:["number","null"],description:"上下文窗口(token 数)"},maxOutputTokens:{type:["number","null"],description:"最大输出 token 数"},supportsToolCall:{type:["boolean","null"],description:"是否支持工具调用;null = 恢复上游原值"},supportsImages:{type:["boolean","null"],description:"是否支持图片识别;null = 恢复上游原值"},supportsVideo:{type:["boolean","null"],description:"是否支持视频识别;null = 恢复上游原值"},supportsReasoning:{type:["boolean","null"],description:"是否支持深度推理;null = 恢复上游原值"}}}},required:["provider","id","capabilities"]},plan:e=>{const t=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},a=EO.filter(o=>o in t);return{lead:r("将修改 {model} 的 {n} 项能力:",{model:`${at(e.provider)} / ${at(e.id)}`,n:a.length}),table:{head:[r("能力"),r("改成")],rows:a.map(o=>{const c=t[o],d=c===null?r("恢复上游原值"):typeof c=="boolean"?r(c?"支持":"不支持"):String(c);return[ej[o]||o,d]})},note:r("能力位决定下游看到的声明(能不能贴图、能塞多少上下文),不改上游的真实行为。")}},run:async e=>{const t=at(e.provider),a=at(e.id),o=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},c={};for(const d of EO){if(!(d in o))continue;const f=o[d];if(f===null){c[d]=null;continue}if(d==="maxInputTokens"||d==="maxOutputTokens"){const p=Bf(f);if(p===void 0)throw new Error(r("{key} 需要数字",{key:ej[d]}));c[d]=Math.round(p)}else{const p=Ui(f);if(p===void 0)throw new Error(r("{key} 需要 true / false / null",{key:ej[d]}));c[d]=p}}if(!t||!a||!Object.keys(c).length)throw new Error(r("参数不完整(需要 provider / id / capabilities)"));return await Ja().setModelCapabilities?.(t,a,c),Su(),{text:JSON.stringify({ok:!0,provider:t,id:a,capabilities:c}),summary:r("已修改 {n} 项能力",{n:Object.keys(c).length})}}},OG={id:"test_model",label:r("发起模型测试"),kind:"run",desc:"对某个模型发一次真实的对话请求,回报连通性、耗时与首字延迟。会消耗该账号的额度。回答「这个模型通不通 / 快不快」时用它。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},prompt:{type:"string",description:"测试用的用户提示词;不填 = 默认一句问候(最小请求)"}},required:["provider","id"]},plan:e=>({lead:r("将对 {model} 发起一次真实请求:",{model:`${at(e.provider)} / ${at(e.id)}`}),table:{head:[r("项"),r("值")],rows:[[r("提示词"),at(e.prompt)||r("(默认问候)")],[r("代价"),r("消耗该账号额度")]]},note:r("这是真实的上游请求,与生产走同一条链路(会记账,报表排除)。")}),run:async e=>{const t={provider:at(e.provider),model:at(e.id)},a=at(e.prompt,4e3);a&&(t.prompt=a);const o=await Ja().testModel?.(t),c=String(o?.status??""),d=o?.success===!0,f={ok:d,status:c,error:o?.error??null,reply:String(o?.reply??"").slice(0,1500),duration_ms:o?.duration_ms??null,ttfb_ms:o?.ttfb_ms??null,account:o?.account_name??null};return{text:JSON.stringify(f).slice(0,6e3),summary:d?r("连通 · {ms}ms",{ms:String(f.duration_ms??"")}):r("失败 · {status}",{status:c||"—"})}}},MG={id:"set_provider_order",label:r("调整提供商顺位"),kind:"write",desc:"调整某个提供商在账号全局队列里的**整组顺位**(第几组),决定路由时先试哪一家。这一家的所有账号会作为一整块移动。位置从 1 开始数。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},position:{type:"number",description:"目标组顺位(1 = 最前)"}},required:["provider","position"]},plan:e=>({lead:r("将把「{provider}」整组移到第 {position} 顺位:",{provider:at(e.provider)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交(后端按新顺序重编优先级),移动会连带调整其它组的相对次序。")}),run:async e=>{const t=at(e.provider).toLowerCase(),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 provider / position)"));const o=await jg(),c=[];for(const h of o){const b=at(h.id),y=at(h.provider).toLowerCase();if(!b)continue;const v=c[c.length-1];v&&v.provider===y?v.ids.push(b):c.push({provider:y,ids:[b]})}const d=c.findIndex(h=>h.provider===t);if(d<0)throw new Error(r("没有找到提供商「{provider}」的账号",{provider:t}));const f=Math.max(0,Math.min(c.length-1,Math.round(a)-1)),[p]=c.splice(d,1);return c.splice(f,0,p),await Ja().reorderAccounts?.(c.flatMap(h=>h.ids)),Su(),{text:JSON.stringify({ok:!0,provider:t,from:d+1,to:f+1,moved:p.ids.length}),summary:r("已移到第 {n} 顺位",{n:f+1})}}},DG={id:"set_account_order",label:r("调整账号优先级"),kind:"write",desc:"把某个账号移动到账号全局队列的第 N 顺位(1 = 最前)。位置决定主备与切换顺序:越靠前越先被使用。",params:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},position:{type:"number",description:"目标顺位(1 = 最前)"}},required:["account","position"]},plan:e=>({lead:r("将把账号「{account}」移到第 {position} 顺位:",{account:at(e.account)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交;位置越靠前,路由时越先被选中。")}),run:async e=>{const t=at(e.account,128),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 account / position)"));const o=await jg(),c=Jw(o,t),d=at(c.id),f=o.map(b=>at(b.id)).filter(Boolean),p=f.indexOf(d);if(p<0)throw new Error(r("账号不在当前队列里"));f.splice(p,1);const h=Math.max(0,Math.min(f.length,Math.round(a)-1));return f.splice(h,0,d),await Ja().reorderAccounts?.(f),Su(),{text:JSON.stringify({ok:!0,account:Hf(c),from:p+1,to:h+1}),summary:r("已移到第 {n} 顺位",{n:h+1})}}},IG={id:"set_account_enabled",label:r("启用 / 禁用账号"),kind:"write",desc:"开启或关闭某几个账号的转发资格。禁用只是把它移出队列(余额仍可查),但**如果某条线路只剩它**,禁用会直接断供。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的账号列表",items:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["account","enabled"]}}},required:["items"]},plan:e=>{const t=Nu(e.items),a=t.filter(o=>Ui(o.enabled)===!1).length;return{lead:r("将修改 {n} 个账号的启用状态(其中禁用 {k} 个):",{n:t.length,k:a}),table:{head:[r("账号"),r("改成")],rows:t.map(o=>[at(o.account),Ui(o.enabled)===!1?r("禁用"):r("启用")])},note:r("禁用会把账号移出转发队列;若这条线路没有别的可用账号,请求会直接失败。")}},run:async e=>{const t=Ja(),a=Nu(e.items),o=await jg(),c=[];for(const d of a){const f=Ui(d.enabled);if(f===void 0)throw new Error(r("参数不完整(需要 account / enabled)"));const p=Jw(o,at(d.account,128));await t.updateAccount?.(at(p.id),{enabled:f}),c.push(`${f?"启用":"禁用"} ${Hf(p)}`)}return Su(),{text:JSON.stringify({ok:!0,changed:c}),summary:r("已修改 {n} 个账号",{n:c.length})}}},Sg=[CG,TG,EG,AG,RG,OG,MG,DG,IG];function tj(e){return Sg.find(t=>t.id===e)}function PG(e){return Sg.filter(t=>e[t.id]).map(t=>({type:"function",function:{name:t.id,description:t.desc,parameters:t.params}}))}r("获取模型列表"),r("读各提供商的模型清单、映射名与启用状态。"),r("查询账号余额"),r("读各账号的额度 / 剩余用量。"),r("启用 / 禁用模型"),r("开关模型的对外可用性,不改其它属性。"),r("设置模型映射 ID"),r("新增 / 删除映射名,支持批量加前缀与同名合并到多家。"),r("修改模型能力"),r("改上下文窗口 / 最大输出 Token / 工具调用等能力位。"),r("发起模型测试"),r("对指定模型发一次真实请求,回报连通性与耗时。"),r("调整提供商顺位"),r("改某一家的整组顺位(先试哪一家)。"),r("调整账号优先级"),r("改账号在全局队列里的名次,决定主备与切换顺序。"),r("启用 / 禁用账号"),r("禁用会把账号移出转发队列,线路可能因此断供。");const AO=12;function Uf(e,t){return window.wbIcons?.icon?.(e,t)||""}function _G(e){const t=window.wbMarkdown;return t?.render?t.render(e):e.replace(/[&<>]/g,a=>({"&":"&","<":"<",">":">"})[a]||a)}function LG({tone:e}){return e==="plain"?s.jsx("span",{className:"asst-tc-ico",dangerouslySetInnerHTML:{__html:Uf("spark",13)}}):s.jsx("span",{className:Ue("asst-tc-ico",e),children:e==="warn"?"!":"✕"})}function zG({item:e,onConfirm:t}){const a=tj(e.call.name),o=a?.label||e.call.name,c=Ww(e.call.arguments),d=Object.keys(c).length?JSON.stringify(c,null,2):"";return s.jsxs("div",{className:Ue("asst-tool-card",e.state==="confirm"&&"confirm",e.state==="confirm"&&a?.kind==="run"&&"danger",e.state==="failed"&&"failed",e.state==="running"&&"running"),children:[s.jsxs("div",{className:"asst-tc-head",children:[e.state==="running"?s.jsx("span",{className:"asst-tc-ico",children:s.jsx("span",{className:"spin"})}):s.jsx(LG,{tone:e.state==="failed"?"bad":e.state==="confirm"?"warn":"plain"}),s.jsx("span",{className:"asst-tc-name",children:o}),e.state==="confirm"&&s.jsx("span",{className:"badge tag warn",children:r("待确认")}),e.state==="done"&&s.jsxs("span",{className:"asst-tc-state",children:["✓ ",e.summary||r("完成")]}),e.state==="failed"&&s.jsx("span",{className:"asst-tc-state bad",children:r("失败")}),e.state==="cancelled"&&s.jsx("span",{className:"asst-tc-state plain",children:r("已取消")})]}),e.state==="confirm"&&e.plan&&s.jsxs("div",{className:"asst-tc-plan",children:[e.plan.lead,e.plan.table&&s.jsxs("table",{className:"asst-mini-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.plan.table.head.map((f,p)=>s.jsx("th",{children:f},p))})}),s.jsx("tbody",{children:e.plan.table.rows.slice(0,20).map((f,p)=>s.jsx("tr",{children:f.map((h,b)=>s.jsx("td",{className:b===f.length-1?"mono hl":"",children:h},b))},p))})]}),e.plan.table&&e.plan.table.rows.length>20&&s.jsx("div",{className:"hint",children:r("(仅显示前 20 条,共 {n} 条)",{n:e.plan.table.rows.length})}),e.plan.note&&s.jsx("div",{className:"hint",children:e.plan.note})]}),e.state==="failed"&&e.error&&s.jsx("div",{className:"asst-tc-error",children:e.error}),e.state==="done"&&e.detail&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看结果")}),s.jsx("pre",{className:"asst-tc-json",children:e.detail})]}),e.state!=="confirm"&&d&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看参数")}),s.jsx("pre",{className:"asst-tc-json",children:d})]}),e.state==="confirm"&&s.jsxs("div",{className:"asst-tc-foot",children:[s.jsx("span",{className:Ue("hint",a?.kind==="run"&&"danger"),children:a?.kind==="run"?r("这会真实发起上游请求并消耗额度"):r("确认后立即生效")}),s.jsx(se,{size:"sm",variant:a?.kind==="run"?"destructive":"default",onClick:()=>t(!0),children:r("执行")}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(!1),children:r("取消")})]})]})}function BG(){const[e,t]=x.useState(null),[a,o]=x.useState([]),[c,d]=x.useState([]),[f,p]=x.useState(!1),[h,b]=x.useState(!1),[y,v]=x.useState(""),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=x.useRef([]),T=x.useRef([]),D=x.useRef(null),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useRef(0),P=x.useRef(null),O=x.useRef(0),_=x.useCallback(()=>{d(k.current.slice())},[]);x.useEffect(()=>{const M=A.current;if(!M)return;M.scrollHeight-M.scrollTop-M.clientHeight<160&&(M.scrollTop=M.scrollHeight)},[c]);const L=x.useCallback(async()=>{if(!R.current){R.current=!0;try{const M=await jG();t(M),N(!1),I.current=0}catch(M){N(!0),j(r("加载助手设置失败:{message}",{message:ku(M)})),I.current<3&&(I.current+=1,R.current=!1,setTimeout(()=>{L()},4e3))}try{o(await wG())}catch(M){j(U=>U||r("读取模型清单失败:{message}",{message:ku(M)}))}}},[]);x.useEffect(()=>{const M=window;return M.wbAssistant={activate:()=>{L()}},L(),()=>{delete M.wbAssistant}},[L]);const H=x.useMemo(()=>{const M={};for(const U of Sg)M[U.id]=e?.tools?.[U.id]??!1;return M},[e]),B=x.useMemo(()=>PG(H),[H]),z=Object.values(H).filter(Boolean).length,Q=e?.model??null,K=x.useCallback(async(M,U,Z)=>{for(let ae=U;ae{if(O.current>=AO){k.current.push({kind:"notice",text:r("这一轮来回已达 {n} 次上限,我先停下等你指示(可以换个说法,或拆成几步让我做)。",{n:AO}),bad:!0}),_();return}O.current+=1,p(!0),j("");const M=new AbortController;C.current=M;const U=k.current.push({kind:"bot",text:"",streaming:!0})-1;_();let Z=[],ae=!1;try{await kG({messages:T.current,tools:B,signal:M.signal,onEvent:ie=>{if(ie.type==="delta"){const ge=k.current[U];ge&&ge.kind==="bot"&&(k.current[U]={...ge,text:ge.text+ie.text},_())}ie.type==="toolCalls"&&(Z=ie.calls)}})}catch(ie){ae=!0;const ge=ku(ie),ee=k.current[U],fe=ee&&ee.kind==="bot"?ee.text:"";fe?k.current[U]={kind:"bot",text:fe}:k.current.splice(U,1);const te=M.signal.aborted;k.current.push({kind:"notice",text:te?r("已停止这次回答。"):r("请求失败:{message}",{message:ge}),bad:!te}),_()}finally{C.current=null}if(ae){p(!1);return}const ce=k.current[U];ce&&ce.kind==="bot"&&(k.current[U]={...ce,streaming:!1});const J=ce&&ce.kind==="bot"?ce.text:"";if(T.current.push({role:"assistant",content:J,toolCalls:Z.length?Z:void 0}),_(),!Z.length){p(!1);return}await K(Z,0,[])},[B,K,_]);P.current=X;const q=x.useCallback(async M=>{const U=D.current;if(!U)return;D.current=null,b(!1);const Z=U.calls[U.index],ae=tj(Z.name),ce=Ww(Z.arguments);if(!M||!ae)k.current[U.cardIndex]={kind:"tool",call:Z,state:"cancelled"},U.collected.push({toolCallId:Z.id,content:"用户取消了这次操作,没有做任何改动。"}),_();else{k.current[U.cardIndex]={kind:"tool",call:Z,state:"running"},p(!0),_();try{const J=await ae.run(ce);k.current[U.cardIndex]={kind:"tool",call:Z,state:"done",summary:J.summary,detail:J.text},U.collected.push({toolCallId:Z.id,content:J.text})}catch(J){const ie=ku(J);k.current[U.cardIndex]={kind:"tool",call:Z,state:"failed",error:ie},U.collected.push({toolCallId:Z.id,content:`工具执行失败:${ie}`})}_()}await K(U.calls,U.index+1,U.collected)},[K,_]),$=x.useCallback(async M=>{const U=M.trim();if(!(!U||f||h)){if(O.current=0,k.current.push({kind:"user",text:U}),T.current.push({role:"user",content:U}),v(""),_(),!e){k.current.push({kind:"notice",text:r("助手设置没读出来,现在还不能发消息 —— 看输入框下方的提示。"),bad:!0}),_();return}if(!e.model){k.current.push({kind:"notice",text:r("还没有选择对话模型:先在下方选一个(或去「设置 → AI 助手」里选)。"),bad:!0}),_();return}await X()}},[h,f,e,X,_]),Y=x.useCallback(()=>{C.current?.abort()},[]),F=x.useCallback(()=>{C.current?.abort(),D.current=null,k.current=[],T.current=[],b(!1),p(!1),j(""),_()},[_]),G=x.useCallback(async M=>{if(!M)return;if(!e){j(r("助手设置没读出来,暂时存不了对话模型 —— 看输入框下方的提示。"));return}const U={...e,model:M};t(U);try{await SG(U)}catch(Z){j(r("保存对话模型失败:{message}",{message:ku(Z)}))}},[e]),W=f||h,le=x.useRef(null);return s.jsxs("div",{className:"asst-layout",children:[s.jsxs("div",{className:"asst-top",children:[s.jsxs(ft,{value:Q??"",onValueChange:M=>{G(String(M))},children:[s.jsx(mt,{className:"asst-model-pick","aria-label":r("对话模型"),children:s.jsx(pt,{children:Q?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:Ue("dot","ok")}),s.jsx("span",{className:"mono",children:Q})]}):r("选择模型…")})}),s.jsxs(ht,{children:[a.length===0&&s.jsx(qe,{value:"none",disabled:!0,children:r("没有可用的模型")}),a.map(M=>s.jsx(qe,{value:M,children:M},M))]})]}),s.jsx("span",{className:"asst-top-hint",children:r("助手走本地网关,消耗所选账号的额度")}),s.jsx("span",{className:"spacer"}),s.jsx(se,{variant:"ghost",size:"sm",onClick:F,disabled:f||h||!c.length,children:r("新对话")})]}),s.jsxs("div",{className:"asst-scroll",ref:A,children:[c.length===0&&s.jsxs("div",{className:"asst-empty",children:[s.jsx("div",{className:"empty-logo",dangerouslySetInnerHTML:{__html:Uf("spark",26)||""}}),s.jsx("h3",{children:r("AI 助手")}),s.jsxs("p",{children:[r("用一句话让我查或改本机的模型转发配置。"),s.jsx("br",{}),r("我会在动手前把改动列给你确认。")]}),s.jsx("div",{className:"asst-suggests",children:[r("看看哪些模型在多家重复了"),r("测一下当前最快的模型通不通"),r("CodeArts 的账号余额还剩多少?"),r("把重复的模型加上家名前缀区分开")].map(M=>s.jsxs("button",{type:"button",onClick:()=>{$(M)},children:["“",M,"”"]},M))}),e!==null&&z===0&&s.jsx("div",{className:"asst-empty-warn",children:r("当前一个工具都没勾选,助手只能纯聊天。去「设置 → AI 助手 → 工具」里勾上需要的工具。")}),S&&s.jsx("div",{className:"asst-empty-warn bad",children:w||r("助手设置读取失败,工具可能已过时。")})]}),c.map((M,U)=>M.kind==="user"?s.jsx("div",{className:"asst-msg user",children:s.jsx("div",{className:"bubble",children:M.text})},U):M.kind==="bot"?!M.text&&M.streaming?s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsx("div",{className:"body",children:s.jsx("span",{className:"spin"})})]},U):s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsxs("div",{className:"body",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:_G(M.text)}}),M.streaming&&s.jsx("span",{className:"asst-caret"})]})]},U):M.kind==="notice"?s.jsx("div",{className:"asst-msg bot",children:s.jsx("div",{className:Ue("asst-empty-warn",M.bad&&"bad"),style:{margin:0},children:M.text})},U):s.jsx(zG,{item:M,onConfirm:Z=>{q(Z)}},U))]}),s.jsxs("div",{className:"asst-composer",children:[s.jsxs("div",{className:"asst-ta-wrap",children:[s.jsx(Qc,{ref:le,rows:1,value:y,placeholder:r(W?"等这一轮跑完…":"直接说要改什么 / 查什么…(Enter 发送,Shift+Enter 换行)"),disabled:W,onChange:M=>{v(M.currentTarget.value);const U=M.currentTarget;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,132)}px`},onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing&&(M.preventDefault(),$(y))}}),f?s.jsx("button",{type:"button",className:"asst-send stop",title:r("停止"),onClick:Y,children:"■"}):s.jsx("button",{type:"button",className:"asst-send",title:r("发送"),disabled:W||!y.trim(),onClick:()=>{$(y)},children:"➤"})]}),s.jsxs("div",{className:"asst-composer-foot",children:[s.jsxs("span",{className:"tools-state",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("settings",12)||""}}),r("已注入 {n} / {total} 个工具 · 系统提示词:{state}",{n:z,total:Sg.length,state:e?.systemPromptEnabled?r("开"):r("关")})]}),s.jsx("span",{className:"spacer"}),w?s.jsxs("span",{className:"hint",children:[w,S&&s.jsx("button",{type:"button",className:"asst-tc-more",onClick:()=>{L()},children:r("重试")})]}):Q?s.jsx("span",{className:"hint",children:r("回复由 {model} 生成 · 走本地网关",{model:Q})}):null]})]})]})}const RO='.page[data-page="assistant"]';let nj=null;function OO(){if(nj)return;const e=document.querySelector(RO);e&&(e.replaceChildren(),nj=vn.createRoot(e),nj.render(s.jsx(BG,{})))}document.querySelector(RO)?OO():document.addEventListener("DOMContentLoaded",OO,{once:!0}),Zw().catch(()=>{});function Ir(){return Pe().workbuddyDesktop??{}}function MO(){return window}const DO="workbuddy-desktop-checkin-tab",HG=["center","schedule","records"];function UG(){try{const e=localStorage.getItem(DO);return HG.includes(e)?e:"center"}catch{return"center"}}function IO(e){if(e!==gs.tab){try{localStorage.setItem(DO,e)}catch{}Js({tab:e})}}async function Ng(e){IO(e),gs.loaded||await Ol()}let gs={version:0,tab:UG(),snapshot:null,loaded:!1,loadError:"",expanded:new Set,runningAll:!1,autoSaving:!1,autoTimeDraft:null,keepaliveSaving:!1,keepaliveDraft:null,signing:new Set,onboarding:new Map,growth:new Map};const sj=new Set;function VG(){for(const e of sj)e()}function Js(e){gs={...gs,...e,version:gs.version+1},VG()}function ur(){return gs}function PO(e){return sj.add(e),()=>sj.delete(e)}function FG(e){const t=typeof e?.key=="string"?e.key:"";return t?{key:t,title:typeof e.title=="string"&&e.title?e.title:t,group:typeof e.group=="string"&&e.group?e.group:"",points:Number(e.points)||0,done:e.done===!0,blocked:e.blocked===!0}:null}function rj(e){return(Array.isArray(e)?e:[]).map(FG).filter(a=>a!==null)}function us(e){return Number(e)||0}async function Ol(){try{const e=await Ir().getCheckinCenter?.();if(!e)throw new Error(r("后端未返回签到中心数据"));Js({snapshot:e,loaded:!0,loadError:"",autoTimeDraft:null,keepaliveDraft:null}),$G(e.extras?.onboarding??[])}catch(e){Js({loaded:!0,loadError:ut(e)})}}function $G(e){for(const t of e){const a=t.settled;if(!a||typeof a!="object")continue;const o=gs.onboarding.get(t.id);if(o?.status==="loaded"&&o.unclaimed>0)continue;const c=rj(a.tasks),d=us(a.at);Co(t.id,{status:"loaded",error:void 0,checkedAt:void 0,settled:!0,settledAt:d>0?d:void 0,tasks:c,unclaimed:0,earned:us(a.earned),total:us(a.total)})}}function _O(e){const t=new Set(gs.expanded);t.has(e)?t.delete(e):t.add(e),Js({expanded:t})}function aj(e){const t=`onb:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}function LO(e){return gs.expanded.has(`onb:${e}`)}async function qG(){if(!gs.runningAll){Js({runningAll:!0});try{const e=await Ir().runAutoCheckinNow?.();if(e){const t=us(e.succeeded),a=us(e.active),o=us(e.total),c=us(e.failedCount),d=a>0?r(",日活保活 {n} 个",{n:a}):"";c>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:t,total:o,active:d,failed:c}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:t,total:o,active:d})),MO().wbAccountsView?.refreshUsageAfterCheckin?.(null)}}catch(e){Le(r("签到失败:{error}",{error:ut(e)}),"err")}finally{Js({runningAll:!1}),await Ol(),zO(ur().snapshot?.extras.onboarding??[]),Pe().wbApp?.refresh?.()}}}async function kg(e,t="checkin"){const a=`${e}:${t}`;if(gs.signing.has(a))return;const o=new Set(gs.signing);o.add(a),Js({signing:o});try{let c;t==="checkin"?c=(await Ir().checkinAllAccounts?.(e))?.results?.[0]:c=await Ir().runCheckinActivity?.(e,t)??void 0;const d=c?.claim,f=c?.activity,p=f?.report?.succeeded===!0,h=f?.webConversation?.succeeded===!0;c?.error?Le(r("签到失败:{error}",{error:String(c.error)}),"err"):t==="keepalive"?f?.pokeSucceeded===!0||h||p?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成")})):Le(d?.msg||r("活跃保活失败"),"err"):d?.success===!0?Le(r("✅ {message}",{message:d.msg||r("签到成功")})):d?.alreadyCompleted===!0?Le(d?.msg||r("今日已领取"),"err"):p?Le(r("✅ {message}",{message:d?.msg||r("活跃上报完成,但活动未开启")})):f?.pokeSucceeded===!0||h?Le(r("✅ {message}",{message:d?.msg||r("活跃保活完成,但活动未开启")})):Le(d?.msg||r("未领取"),"err"),MO().wbAccountsView?.refreshUsageAfterCheckin?.(e)}catch(c){Le(r("签到失败:{error}",{error:ut(c)}),"err")}finally{const c=new Set(ur().signing);c.delete(a),Js({signing:c}),await Ol();const d=(ur().snapshot?.extras.onboarding??[]).filter(f=>f.id===e);zO(d),Pe().wbApp?.refresh?.()}}function Cg(e){Js({keepaliveDraft:e.map(t=>t.trim()).filter(Boolean)})}async function GG(e){const t=e.map(a=>a.trim()).filter(Boolean);if(!ur().keepaliveSaving){Js({keepaliveSaving:!0});try{const a=await Ir().saveCheckinKeepalive?.(t);if(a){const o=ur().snapshot;Js({snapshot:o&&{...o,keepalive:a},keepaliveDraft:null}),Le(r("已保存:保活模型链"))}}catch(a){Le(r("保存失败:{error}",{error:ut(a)}),"err")}finally{Js({keepaliveSaving:!1})}}}async function zO(e){for(const t of e)KG(t.id)||await lj(t.id);for(const t of e){const a=ur().onboarding.get(t.id);a?.status!=="loaded"||a.claiming||a.settled||(t.provider==="officeace"||a.unclaimed>0)&&await BO(t.id)}}function KG(e){return gs.onboarding.get(e)?.settled===!0}function Cu(e){return gs.onboarding.get(e)??{status:"idle",tasks:[],unclaimed:0,earned:0,total:0,claiming:!1}}function Co(e,t){const a=new Map(gs.onboarding);a.set(e,{...Cu(e),...t}),Js({onboarding:a})}async function lj(e,t){const a=Cu(e);if(!(a.status==="loading"||a.claiming)){Co(e,{status:"loading",error:void 0,settled:!1});try{const o=await Ir().getOnboardingTasks?.(e,t?.refresh===!0),c=rj(o?.tasks),d=o?.settled===!0;Co(e,{status:"loaded",checkedAt:Date.now(),tasks:c,unclaimed:c.filter(f=>!f.done&&!f.blocked).length,earned:us(o?.earned),total:us(o?.total),settled:d,settledAt:d&&us(o?.settledAt)||void 0}),t?.expand===!0&&c.length>0&&!LO(e)&&aj(e)}catch(o){Co(e,{status:"error",error:ut(o),settled:!1})}}}async function BO(e){const t=Cu(e);if(!(t.claiming||t.status!=="loaded")){Co(e,{claiming:!0});try{Co(e,{tasks:Cu(e).tasks.map(v=>v.done?v:{...v,claiming:!0,error:void 0})});const a=await Ir().claimOnboardingTasks?.(e),o=new Map,c=Array.isArray(a?.results)?a.results:[];for(const v of c){const w=typeof v?.key=="string"?v.key:"";w&&v?.ok!==!0&&o.set(w,String(v?.error||r("领取失败")))}const d=rj(a?.tasks),f=(d.length?d:Cu(e).tasks).map(v=>({...v,claiming:!1,error:o.get(v.key)})),p=f.filter(v=>v.done&&!o.has(v.key)).length,h=a?.settled===!0;Co(e,{claiming:!1,checkedAt:Date.now(),tasks:f,unclaimed:f.filter(v=>!v.done&&!v.blocked).length,earned:us(a?.earned),total:us(a?.total),settled:h,settledAt:h&&us(a?.settledAt)||void 0});const b=f.filter(v=>v.error&&!v.done).length,y=typeof a?.message=="string"?a.message.trim():"";b?Le(r("新手福利有 {n} 项领取失败,可重试",{n:b}),"err"):y?Le(y,"ok"):p&&Le(r("✅ 新手福利领取完成,累计 {n} 积分",{n:us(a?.earned)}))}catch(a){const o=ut(a);Co(e,{claiming:!1,tasks:Cu(e).tasks.map(c=>({...c,claiming:!1,error:c.done?void 0:o}))}),Le(r("领取失败:{error}",{error:o}),"err")}finally{await Ol()}}}function HO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,title:typeof o.title=="string"&&o.title?o.title:c,description:typeof o.description=="string"?o.description:"",status:typeof o.status=="string"?o.status:"",current:us(o.current),target:us(o.target),locked:o.locked===!0,unlockAt:o.unlockAt,supported:o.supported===!0,unforgeable:o.unforgeable===!0,unforgeableReason:typeof o.unforgeableReason=="string"?o.unforgeableReason:"",kind:typeof o.kind=="string"?o.kind:"",source:typeof o.source=="string"?o.source:""}:null}).filter(a=>a!==null)}function UO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,outcome:typeof o.outcome=="string"?o.outcome:"failed",message:typeof o.message=="string"?o.message:"",credit:us(o.credit),energy:us(o.energy)}:null}).filter(a=>a!==null)}function Vi(e){return gs.growth.get(e)??{status:"idle",energy:null,streak:null,tasks:[],travel:null,school:null,running:!1,runningSchool:!1,runningTravel:!1}}function Pr(e,t){const a=new Map(gs.growth);a.set(e,{...Vi(e),...t}),Js({growth:a})}function YG(e){return gs.expanded.has(`growth:${e}`)}function VO(e){const t=`growth:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}async function Tg(e){const t=Vi(e);if(!(t.status==="loading"||t.running)){Pr(e,{status:"loading",error:void 0});try{const a=await Ir().getGrowthStatus?.(e),o=a?.tasks??{},c=a?.travel??null,d=a?.school??null;Pr(e,{status:"loaded",checkedAt:Date.now(),energy:a?.energy===null||a?.energy===void 0?null:us(a.energy),streak:a?.streak===null||a?.streak===void 0?null:us(a.streak),tasks:HO(o.tasks),travel:c,school:d?{...d,tasks:HO(d.tasks)}:null,error:typeof o.error=="string"?o.error:void 0})}catch(a){Pr(e,{status:"error",error:ut(a)})}}}async function FO(e,t){const a=Vi(e);if(a.running)return;const o=(a.tasks??[]).filter(h=>!h.supported||h.unforgeable===!0||h.locked===!0?!1:t==="claim"?h.status==="completed"||h.current>=h.target&&h.status!=="claimed":h.status!=="claimed");if(o.length===0){Le(r("没有需要执行的任务"));return}Pr(e,{running:!0,results:[],error:void 0});let c=0,d=0,f=0,p=0;for(const h of o)try{const b=await Ir().runGrowthTask?.(e,h.code,t),y=UO([b])[0];y&&(Pr(e,{results:[...Vi(e).results??[],y]}),c+=y.credit??0,d+=y.energy??0,(y.outcome==="done"||y.outcome==="already")&&(f+=1),y.outcome==="failed"&&(p+=1))}catch(b){p+=1,Pr(e,{results:[...Vi(e).results??[],{code:h.code,outcome:"failed",message:ut(b),credit:0,energy:0}]})}Pr(e,{running:!1}),p>0?Le(r("成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}",{done:f,failed:p,credit:c,energy:d}),"err"):Le(r("✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}",{credit:c,energy:d})),await Tg(e)}async function XG(e,t){if(!Vi(e).runningSchool){Pr(e,{runningSchool:!0,error:void 0});try{const o=await Ir().runGrowthSchool?.(e,t),c=UO(o?.results),d=o?.lottery??null;Pr(e,{runningSchool:!1,results:c,schoolText:c.length?c.map(f=>`${f.code}:${f.message}`).join(";"):void 0,lotteryText:d?String(d.message??r("已抽 {n} 次",{n:us(d.drawn)})):void 0,checkedAt:Date.now()}),Le(d?r("开学季执行完成:{message}",{message:String(d.message??"")}):r("✅ 开学季任务执行完成")),await Tg(e)}catch(o){Pr(e,{runningSchool:!1,error:ut(o)}),Le(r("开学季执行失败:{error}",{error:ut(o)}),"err")}}}async function QG(e){if(!Vi(e).runningTravel){Pr(e,{runningTravel:!0,error:void 0});try{const a=await Ir().runGrowthTravel?.(e),o=String(a?.message??""),c=String(a?.outcome??"");Pr(e,{runningTravel:!1,checkedAt:Date.now()}),c==="failed"?Le(r("猫猫旅行失败:{message}",{message:o}),"err"):Le(r("猫猫旅行:{message}",{message:o})),await Tg(e)}catch(a){Pr(e,{runningTravel:!1,error:ut(a)}),Le(r("猫猫旅行失败:{error}",{error:ut(a)}),"err")}}}function ZG(e){return e.totalCount?e.doneCount>=e.totalCount?"done":e.doneCount>0?"part":"todo":"none"}function WG(e){const a=(Array.isArray(e?.schedules)?e.schedules:[]).filter(o=>o.enabled===!0).map(o=>Number(o.nextRunAt)).filter(o=>Number.isFinite(o)&&o>0);return a.length?Math.min(...a):null}let To={version:0,data:null,loaded:!1,loadError:"",saving:!1,runningId:null,editingId:null};const oj=new Set;function JG(){for(const e of oj)e()}function _r(e){To={...To,...e,version:To.version+1},JG()}function $O(){return To}function e7(e){return oj.add(e),()=>oj.delete(e)}function Tu(){return Pe().workbuddyDesktop??{}}async function qO(){try{const e=await Tu().getCheckinSchedules?.();if(!e)throw new Error(r("后端未返回定时签到数据"));_r({data:e,loaded:!0,loadError:""})}catch(e){_r({loaded:!0,loadError:ut(e)})}}function Eg(e){e&&_r({data:e,loadError:""}),Ol()}async function t7(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveAutoCheckin?.({enabled:e});Eg(t),Le(r(e?"✅ 定时签到已开启":"定时签到已关闭"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function GO(e){if(!To.saving){_r({saving:!0});try{const t=await Tu().saveCheckinSchedule?.(e);Eg(t),_r({editingId:null}),Le(r("已保存:定时条目"))}catch(t){Le(r("保存失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function n7(e,t){await GO({id:e.id,label:e.label??"",enabled:t,time:e.time??"",providers:Array.isArray(e.providers)?e.providers:[]})}async function s7(e){if(!To.saving){_r({saving:!0});try{await Tu().deleteCheckinSchedule?.(e),Eg(await Tu().getCheckinSchedules?.()),Le(r("已删除定时条目"))}catch(t){Le(r("删除失败:{error}",{error:ut(t)}),"err")}finally{_r({saving:!1})}}}async function r7(e){if(!To.runningId){_r({runningId:e});try{const t=await Tu().runCheckinSchedule?.(e)??void 0,a=o=>Number(o)||0;if(t){const o=a(t.succeeded),c=a(t.active),d=a(t.total),f=a(t.failedCount),p=c>0?r(",日活保活 {n} 个",{n:c}):"";f>0?Le(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:o,total:d,active:p,failed:f}),"err"):Le(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:o,total:d,active:p})),Eg(t)}}catch(t){Le(r("执行失败:{error}",{error:ut(t)}),"err")}finally{_r({runningId:null}),await Ol()}}}function ij(e){_r({editingId:e})}const a7=r("到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。错过时点开机后会自动补签,不会因为当时没开机而漏掉。各家签到接口都是幂等的,重复执行不会重复领取。");function l7(){const[e,t]=x.useState($O());return x.useEffect(()=>e7(()=>t($O())),[]),e}function o7(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function KO(e,t){const a=Array.isArray(e.providers)?e.providers:[];return t.filter(o=>a.includes(o.id)).map(o=>o.label)}function i7(e,t){const a=KO(e,t);return a.length?t.length>0&&a.length>=t.length?r("全部 {n} 家",{n:t.length}):a.join(r("、")):r("未勾选提供商")}function c7(e,t){const a=KO(e,t);return a.length?a.join(r("、")):r("未勾选提供商")}function u7(e){const t=e.lastResult;if(!t)return r("还没执行过");const a=f=>Number(f)||0,o=[r("成功 {n}",{n:a(t.succeeded)})],c=a(t.active);c>0&&o.push(r("保活 {n}",{n:c}));const d=a(t.failedCount);return d>0&&o.push(r("失败 {n}",{n:d})),`${t.at?Fs(t.at):"—"}${t.reason?` · ${t.reason}`:""} —— ${o.join(r(" · "))}`}function YO({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=e===null,[c,d]=x.useState(e?.label??""),[f,p]=x.useState(e?.time??"00:01"),[h,b]=x.useState(new Set(o?a.map(S=>S.id):e?.providers??[]));x.useEffect(()=>{o&&a.length>0&&b(new Set(a.map(S=>S.id)))},[]);const y=f.trim()!==""&&h.size>0,v=()=>b(new Set(a.map(S=>S.id))),w=()=>b(new Set),j=async()=>{await GO({id:e?.id,label:c.trim(),enabled:e?.enabled??!0,time:f.trim(),providers:a.map(S=>S.id).filter(S=>h.has(S))})};return s.jsxs("div",{className:"ck-sched-editor",children:[s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("名称")}),s.jsx("span",{className:"ck-set-v",children:s.jsx($e,{type:"text",className:"max-w-[220px]",placeholder:r("可选 · 缺省显示时刻"),value:c,disabled:t.saving,onChange:S=>d(S.currentTarget.value)})})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("每天时刻")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx($e,{type:"time",className:"w-[96px] max-w-[96px] font-mono tabular-nums",value:f,disabled:t.saving,onChange:S=>p(S.currentTarget.value)}),s.jsx("span",{className:"text-subtle text-xs",children:r("北京时间 · 错过时点开机后会自动补签")})]})]}),s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("签到范围")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("到点时逐个签到,已勾 {n} / {total} 家",{n:h.size,total:a.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving,onClick:v,children:r("全选")}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving||h.size===0,onClick:w,children:r("清空")})]}),s.jsx("div",{className:"ck-range",children:a.map(S=>s.jsxs("label",{className:"ck-range-item",children:[s.jsx(Mr,{checked:h.has(S.id),disabled:t.saving,onCheckedChange:N=>{const k=new Set(h);N===!0?k.add(S.id):k.delete(S.id),b(k)}}),s.jsx("span",{className:"ck-range-name",title:S.label,children:S.label})]},S.id))}),h.size===0?s.jsx("div",{className:"ck-mini-warn",children:r("至少勾一家才能保存(不勾等于这条条目不签到)")}):null]})]}),s.jsxs("div",{className:"ck-sched-actions",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.saving,onClick:()=>ij(null),children:r("取消")}),s.jsx(se,{size:"sm",variant:"default",disabled:!y||t.saving,onClick:()=>{j()},children:t.saving?r("保存中…"):r("保存")})]})]})}function d7({store:e}){return s.jsxs("div",{className:"ck-sched-row open ck-sched-row-new",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx("span",{className:"ck-new-dot","aria-hidden":!0,children:"+"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:r("新建定时条目")}),s.jsx("div",{className:"ck-prov-desc",children:r("填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)")})]})]}),s.jsx(YO,{entry:null,store:e})]})}function f7({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=t.editingId===e.id,c=t.runningId===e.id,d=t.data?.enabled===!0,f=Number(e.nextRunAt),p=async()=>{const h=Pe().wbConfirm?.ask;if(!h)return;const y=(e.displayLabel||e.time||e.id).replace(/&/g,"&").replace(//g,">");await h({title:r("删除定时条目"),html:r("确定删除「{name}」?删除后到点不再执行。",{name:y}),okText:r("删除"),okClass:"danger"})&&await s7(e.id)};return s.jsxs("div",{className:o?"ck-sched-row open":"ck-sched-row",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx(hs,{checked:e.enabled===!0,disabled:t.saving,onCheckedChange:h=>{n7(e,h===!0)}}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.displayLabel||e.time||e.id,e.enabled===!0?null:s.jsx(ze,{variant:"outline",shape:"tag",children:r("已停用")})]}),s.jsx("div",{className:"ck-prov-desc ck-sched-scope",title:c7(e,a),children:r("每天 {time} · {scope}",{time:e.time??"—",scope:i7(e,a)})}),s.jsx("div",{className:"ck-prov-desc",children:r("上次执行:{line}",{line:u7(e)})})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-sched-next",children:d&&e.enabled===!0&&Number.isFinite(f)&&f>0?r("下次 {date}",{date:Fs(f)}):"—"}),s.jsx(se,{size:"sm",variant:"ghost",disabled:c||t.runningId!==null,onClick:()=>{r7(e.id)},children:r(c?"执行中…":"立即执行")}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>ij(o?null:e.id),children:r(o?"收起":"编辑")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",disabled:t.saving,onClick:()=>{p()},children:r("删除")})]})]}),o?s.jsx(YO,{entry:e,store:t}):null]})}function p7(e,t){return e.length===t.length&&e.every((a,o)=>a===t[o])}let Vf=null;function m7(e,t){for(let a=0;ah!==t.row),d=m7(c,e.clientY);if(d===t.from)return;const f=[...t.list],[p]=f.splice(t.from,1);f.splice(d,0,p),t.list=f,t.from=d,t.onChange(f)}function Ff(){const e=Vf;Vf=null,window.removeEventListener("pointermove",XO),window.removeEventListener("pointerup",Ff),window.removeEventListener("pointercancel",Ff),document.body.classList.remove("ck-chain-dragging"),e?.row.classList.remove("dragging")}function h7(e,t,a,o){if(e.button!==0||Vf||a.length<2)return;const c=e.currentTarget.closest(".ck-chain-row");c&&(e.preventDefault(),Vf={list:[...a],from:t,row:c,onChange:o},c.classList.add("dragging"),document.body.classList.add("ck-chain-dragging"),window.addEventListener("pointermove",XO),window.addEventListener("pointerup",Ff),window.addEventListener("pointercancel",Ff))}function g7({models:e,defaultModels:t,dirty:a,saving:o}){const[c,d]=x.useState(""),f=()=>{const p=c.trim();if(p){if(e.includes(p)){Le(r("清单里已经有「{name}」",{name:p}),"err");return}Cg([...e,p]),d("")}};return s.jsxs("section",{className:"panel ck-chain-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("保活模型链")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:!a||o,onClick:()=>{GG(e)},children:r(o?"保存中…":"保存")})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("模型清单")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("按序逐个尝试,共 {n} 个",{n:e.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:o||t.length===0,title:r("把缺省链填进清单,再点「保存」生效"),onClick:()=>Cg([...t]),children:r("填入缺省链")})]}),s.jsxs("div",{className:"ck-chain",children:[e.map((p,h)=>s.jsxs("div",{className:"ck-chain-row",children:[s.jsx("span",{className:"ck-chain-grip",role:"button",tabIndex:-1,"aria-label":r("按住拖动调整顺序"),title:r("按住拖动,调整这个模型在链里的顺序"),onPointerDown:b=>h7(b,h,e,Cg),dangerouslySetInnerHTML:{__html:Pe().wbIcons?.icon?.("gripVertical",14)||""}}),s.jsx("span",{className:"ck-chain-name",title:p,children:p}),s.jsxs("span",{className:"ck-chain-index",children:["#",h+1]}),s.jsx("button",{type:"button",className:"ck-chain-del",disabled:o,"aria-label":r("移除 {name}",{name:p}),title:r("从清单里移除"),onClick:()=>Cg(e.filter((b,y)=>y!==h)),children:"×"})]},p)),e.length===0?s.jsx("div",{className:"ck-chain-empty",children:r("清单为空 —— 保存后恢复缺省链")}):null]}),s.jsxs("div",{className:"ck-chain-add",children:[s.jsx($e,{type:"text",className:"max-w-[260px] font-mono text-xs",placeholder:r("WorkBuddy 国际版保活模型,按顺序回退"),value:c,disabled:o,onChange:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}}),s.jsx(se,{size:"sm",variant:"outline",disabled:o||c.trim()==="",onClick:f,children:r("添加模型")}),a?s.jsx("span",{className:"ck-chain-dirty",children:r("有未保存的改动")}):null]})]})]}),s.jsx("div",{className:"ck-note",children:r("「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。",{defaults:t.join(r("、"))})})]})]})}function x7(){const e=l7(),t=o7();if(x.useEffect(()=>{qO()},[]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取定时签到数据…")})]});const a=e.data,o=a?.enabled===!0,c=Array.isArray(a?.schedules)?a.schedules:[],d=t.snapshot?.keepalive,f=Array.isArray(d?.models)?d.models:[],p=Array.isArray(d?.defaultModels)?d.defaultModels:[],h=t.keepaliveDraft,b=h??f,y=h!==null&&!p7(h,f);return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取定时签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{qO()},children:r("重试")})]}):null,s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("定时签到")}),s.jsx("span",{className:"tip-q","data-tip":a7}),s.jsx("span",{className:"panel-sub",children:r("每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签")}),s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto flex-none",disabled:e.saving,onClick:()=>ij(e.editingId==="new"?null:"new"),children:e.editingId==="new"?r("收起新建"):r("添加条目")})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("总开关")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(hs,{checked:o,disabled:e.saving,onCheckedChange:v=>{t7(v===!0)}}),s.jsx("span",{className:"text-subtle text-xs",children:r(o?"开着:启用的条目按各自时刻执行":"关着:所有条目都不执行")})]})]})}),s.jsxs("div",{children:[e.editingId==="new"?s.jsx(d7,{store:e}):null,c.map(v=>s.jsx(f7,{entry:v,store:e},v.id)),c.length===0?s.jsx("div",{className:"ck-empty",children:r("还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。")}):null]})]}),s.jsx(g7,{models:b,defaultModels:p,dirty:y,saving:t.keepaliveSaving})]})}const Ag="checkin-records",QO=["today","7","30","month","all"],Eu="all",b7=[{value:"today",label:r("今天")},{value:"7",label:r("7 天")},{value:"30",label:r("30 天")},{value:"month",label:r("本月")},{value:"all",label:r("全部")}],ZO="workbuddy-desktop-checkin-records-range";function Rg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function WO(e){const t=new Date;switch(e){case"today":return Rg(t);case"7":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Rg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function v7(){try{const e=localStorage.getItem(ZO);return e!==null&&QO.includes(e)?e:Eu}catch{return Eu}}function JO(e){try{localStorage.setItem(ZO,e)}catch{}}function eM(e){return typeof e=="number"&&e>0?e:du}const cj={success:{label:"成功领取",variant:"success"},already:{label:"今日已领",variant:"brand"},pending:{label:"等待窗口",variant:"warning"},failed:{label:"失败",variant:"destructive"}},y7={schedule:"定时",startup:"补签",manual:"手动",single:"单签",activity:"活动"},uj=[{key:"time",label:r("时间")},{key:"account",label:r("账号")},{key:"provider",label:r("提供商")},{key:"source",label:r("来源")},{key:"outcome",label:r("结果")},{key:"detail",label:r("说明")}];let dj=null;function tM(){return dj?dj.apply([...uj]):uj.map(e=>({...e,align:e.align??"left"}))}function nM(){window.wbTableColumns?.repaint?.(Ag)}function sM(e){return(ur().snapshot?.auto?.providerOptions??[]).find(a=>a.id===e)?.label??e}function w7(e,t){const a=`ck-col-${t.key} ta-${t.align}`;switch(t.key){case"time":return s.jsxs("td",{className:a,children:[e.ts?Fs(e.ts):"—",s.jsx("span",{className:"ck-record-date",children:e.date||""})]},t.key);case"account":return s.jsx("td",{className:a,children:e.accountName||e.accountId||"—"},t.key);case"provider":return s.jsx("td",{className:a,children:e.provider?sM(e.provider):"—"},t.key);case"source":return s.jsxs("td",{className:a,children:[s.jsx("span",{className:"ck-record-source",children:y7[e.source??""]??e.source??"—"}),e.reason?s.jsx("span",{className:"ck-record-reason",children:e.reason}):null]},t.key);case"outcome":{const o=cj[e.outcome??""]??{label:e.outcome||"—",variant:"outline"};return s.jsxs("td",{className:a,children:[s.jsx(ze,{variant:o.variant,shape:"tag",children:o.label}),e.keptActive?s.jsx(ze,{variant:"outline",shape:"tag",className:"ml-1",children:r("保活")}):null]},t.key)}case"detail":return s.jsx("td",{className:e.error?`${a} ck-record-detail-fail`:a,children:e.error||e.message||"—"},t.key);default:return null}}function j7(){const[e,t]=x.useState([]),[a,o]=x.useState(0),[c,d]=x.useState(1),[f,p]=x.useState(()=>v7()),[h,b]=x.useState(()=>eM(lg(Ag,rg))),[y,v]=x.useState({outcome:"",provider:"",keyword:""}),[w,j]=x.useState(""),[S,N]=x.useState(!1),[k,T]=x.useState(""),[D,C]=x.useState(0),A=x.useRef(null),R=x.useRef(0),[,I]=x.useReducer(Y=>Y+1,0),P=ur().snapshot?.auto?.providerOptions??[],O=tM(),_=Math.max(1,Math.ceil(a/h)),L=Math.min(c,_),H=y.outcome!==""||y.provider!==""||y.keyword!==""||f!==Eu,B=a?{start:(L-1)*h+1,end:Math.min(a,L*h)}:null,z=x.useCallback(async Y=>{const F=R.current+1;R.current=F,N(!0),T("");try{const W=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:Y.size,offset:(Y.page-1)*Y.size,outcome:Y.filters.outcome,provider:Y.filters.provider,keyword:Y.filters.keyword,start:WO(Y.range)});if(F!==R.current)return;t(Array.isArray(W?.records)?W.records:[]),o(Number(W?.total)||0)}catch(G){if(F!==R.current)return;T(G instanceof Error?G.message:String(G))}finally{F===R.current&&N(!1)}},[]);x.useEffect(()=>{z({page:c,size:h,range:f,filters:y})},[z,c,h,f,y]),x.useEffect(()=>{c>_&&d(_)},[c,_]),x.useLayoutEffect(()=>{const Y=Pe().wbColSettings;if(!Y?.register){const F=window.setTimeout(()=>C(G=>G+1),50);return()=>window.clearTimeout(F)}dj=Y.register({id:Ag,label:r("签到记录表"),columns:uj.map(F=>({key:F.key,label:F.label,align:F.align??"left"})),mount:()=>A.current,onChange:()=>{Cs.flushSync(()=>I()),nM()}}),I()},[D]),x.useLayoutEffect(()=>{nM()}),x.useEffect(()=>()=>{Pe().wbColSettings?.close()},[]);const Q=Y=>{v(Y),d(1)},K=Y=>{const F=QO.includes(Y)?Y:Eu;F!==f&&(JO(F),p(F),d(1))},X=Y=>{b(eM(Y)),og(Ag,Y),d(1)},q=()=>{j(""),JO(Eu),p(Eu),Q({outcome:"",provider:"",keyword:""})},$=async()=>{const Y=Pe().wbConfirm?.ask;if(!Y)return;const F=r(H?"确定清空当前筛选出的签到记录?清空后无法恢复。":"确定清空全部签到记录?清空后无法恢复。");if(await Y({title:r("清空签到记录"),html:F,okText:r("清空"),okClass:"danger"}))try{await Pe().workbuddyDesktop?.clearCheckinRecords?.(H?{outcome:y.outcome,provider:y.provider,keyword:y.keyword,start:WO(f)}:{all:"1"}),rM("签到记录已清空"),await z({page:1,size:h,range:f,filters:y}),d(1)}catch(G){rM(r("清空失败:{error}",{error:G instanceof Error?G.message:String(G)}),"err")}};return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("签到记录")}),s.jsx("span",{className:"panel-sub",children:r("每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准")}),s.jsxs("div",{ref:A,className:"ml-auto flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:S,onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r(S?"刷新中…":"刷新")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{$()},children:r("清空")})]})]}),s.jsxs("div",{className:"ck-records-filters",children:[s.jsx(In,{options:b7,value:f,onValueChange:K,"aria-label":r("签到记录时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:y.outcome,onValueChange:Y=>Q({...y,outcome:Y??""}),children:[s.jsx(mt,{className:"w-[128px] shrink-0","aria-label":r("按结果筛选"),children:s.jsx(pt,{children:y.outcome?cj[y.outcome]?.label??y.outcome:r("全部结果")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部结果")}),Object.entries(cj).map(([Y,F])=>s.jsx(qe,{value:Y,children:F.label},Y))]})]}),s.jsxs(ft,{value:y.provider,onValueChange:Y=>Q({...y,provider:Y??""}),children:[s.jsx(mt,{className:"w-[148px] shrink-0","aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:y.provider?sM(y.provider):r("全部提供商")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部提供商")}),P.map(Y=>s.jsx(qe,{value:Y.id,children:Y.label},Y.id))]})]}),s.jsx("div",{className:"spacer"}),s.jsx($e,{type:"search",className:"ck-records-search w-[200px] basis-[200px] min-w-[150px] grow-0 shrink",placeholder:r("搜账号 / 收益 / 错误 / 触发原因"),value:w,onChange:Y=>j(Y.currentTarget.value),onBlur:()=>{w!==y.keyword&&Q({...y,keyword:w.trim()})},onKeyDown:Y=>{Y.key==="Enter"&&Y.currentTarget.blur(),Y.key==="Escape"&&(j(y.keyword),Y.currentTarget.blur())}}),H?s.jsx(se,{size:"sm",variant:"ghost",onClick:q,children:r("清除筛选")}):null,s.jsx("span",{className:"panel-sub",children:S?r("读取中…"):r("{n} 条",{n:a})})]}),k?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到记录失败:{error}",{error:k})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r("重试")})]}):null,e.length===0&&!S?s.jsx("div",{className:"ck-empty",children:r(H?"没有符合筛选条件的签到记录":"还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。")}):s.jsx("div",{className:"ck-records-scroll",children:s.jsxs("table",{className:"ck-table ck-records-table",children:[s.jsx("colgroup",{children:O.map(Y=>s.jsx("col",{"data-col":Y.key,className:`ck-col-${Y.key}`},Y.key))}),s.jsx("thead",{children:s.jsx("tr",{children:O.map(Y=>s.jsx("th",{"data-col":Y.key,className:`ck-col-${Y.key} ta-${Y.align}`,children:Y.label},Y.key))})}),s.jsx("tbody",{children:e.map(Y=>s.jsx("tr",{children:O.map(F=>w7(Y,F))},Y.rowId))})]})}),s.jsx(Li,{total:a,range:B,page:L,pageCount:_,size:h,sizes:rg,onSizeChange:X,onPageChange:d,disabled:S})]})}function rM(e,t){Pe().wbApp?.toast?.(e,t)}window.wbCheckinRecords={visibleColumns:()=>tM().map(e=>({key:e.key}))};const aM={workbuddy:r("腾讯每日签到接口 · 仅国内版"),"workbuddy-intl":r("每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行"),raccoon:r("桌面端每日积分链路"),autoclaw:r("官方客户端的每日签到任务"),"autoclaw-intl":r("与国内版同一套任务接口 · 站点不同"),qoder:r("活动(campaign)领取 · 每天 10:00 刷新"),"qoder-intl":r("带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件"),trae:r("SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新"),loomy:r("无独立签到接口 · 每天替账号打一次首次登录积分"),kuku:r("「免费领积分」的每日任务 · 逐个领取"),officeace:r("一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证"),codearts:r("每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置"),modelscope:r("无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)"),"modelscope-intl":r("与国内版同一套链路 · 站点不同、令牌不通用")},S7=[{value:"center",label:r("签到中心")},{value:"schedule",label:r("定时签到")},{value:"records",label:r("签到记录")}];function N7(e){return e==="raccoon"?"小浣熊":e==="loomy"?"Loomy":e==="codearts"?"CodeArts":e==="officeace"?"OfficeAce 果办":e}function k7(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function C7({group:e}){const t=ZG(e);return t==="none"?s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")}):t==="done"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):t==="part"?s.jsx(ze,{variant:"warning",shape:"tag",children:r("部分")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}function $f({id:e,label:t}){const a=hg[e==="workbuddy-intl"?"workbuddy":e];return s.jsx("span",{className:"ck-prov-logo",children:a?s.jsx("img",{src:a,alt:""}):t.slice(0,1)||"·"})}function T7({group:e}){const t=ur().signing,a=(o,c)=>t.has(`${o}:${c}`);return s.jsxs("table",{className:"ck-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("账号")}),s.jsx("th",{children:r("今日签到")}),s.jsx("th",{children:r("上次签到时间")}),s.jsx("th",{"aria-label":r("操作")})]})}),s.jsx("tbody",{children:e.accounts.map(o=>{const c=e.id==="workbuddy-intl";return s.jsxs("tr",{children:[s.jsx("td",{children:o.name||o.id}),s.jsx("td",{children:o.checkedInToday?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}),s.jsx("td",{className:"text-subtle",children:o.checkinAt?Fs(o.checkinAt):"—"}),s.jsx("td",{className:"text-right",children:c?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"keepalive"),title:r("用免费模型与网页会话维持账号活跃 · 不领取奖励"),onClick:()=>{kg(o.id,"keepalive")},children:a(o.id,"keepalive")?r("保活中…"):r("保活")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"claim"),title:r("探测活动并领取日活奖励 · 不做保活"),onClick:()=>{kg(o.id,"claim")},children:a(o.id,"claim")?r("领取中…"):r("领取")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"full"),title:r("探测 + 领取 + 保活 · 与定时签到同一套组合"),onClick:()=>{kg(o.id,"full")},children:a(o.id,"full")?r("执行中…"):r("保活+领取")})]}):s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"checkin"),onClick:()=>{kg(o.id)},children:a(o.id,"checkin")?r("签到中…"):o.checkedInToday?r("重签"):r("签到")})})]},o.id)})})]})}function E7({group:e,expanded:t}){const a=e.totalCount>0;return s.jsxs("div",{className:t?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:()=>a&&_O(e.id),onKeyDown:o=>{a&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),_O(e.id))},role:a?"button":void 0,tabIndex:a?0:-1,"aria-expanded":a?t:void 0,children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:aM[e.id]??""})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-prov-count",children:a?r("{total} 账号 · {done} 已签",{total:e.totalCount,done:e.doneCount}):"—"}),s.jsx(C7,{group:e}),a?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),e.id==="qoder-intl"?s.jsx(lM,{}):null,t?s.jsx("div",{className:"ck-prov-detail",children:s.jsx(T7,{group:e})}):null]})}function lM(){const[e,t]=x.useState(null),a=x.useCallback(async()=>{try{t(await Ir().getQoderUmid?.()??null)}catch{}},[]);x.useEffect(()=>{a()},[a]);const o=e?.installing===!0&&e.available!==!0;if(x.useEffect(()=>{if(!o)return;const d=window.setInterval(()=>{a()},3e3);return()=>{window.clearInterval(d)}},[o,a]),!e||e.available)return null;const c=async()=>{try{t(d=>d&&{...d,installing:!0}),await Ir().installQoderUmid?.(),Pe().wbApp?.toast?.(r("✅ UMID 组件已安装,下轮签到即可领取国际版积分"))}catch(d){Pe().wbApp?.toast?.(r("UMID 组件安装失败:{error}",{error:d instanceof Error?d.message:String(d)}),"err")}finally{a()}};return s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-2.5 pl-[58px] pr-4 text-[12px] text-muted-foreground",children:[s.jsx("span",{children:r("国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。")}),e.installSupported?s.jsx(se,{variant:"outline",size:"sm",disabled:e.installing===!0,onClick:()=>{c()},children:e.installing?r("安装中…"):r("一键安装组件")}):s.jsx("span",{children:r("安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。")})]})}function A7({row:e}){const t=e.provider??"loomy",a=ur().onboarding.get(e.id),o=a?.tasks??[],c=a?.unclaimed??0,d=a?.status==="loaded"&&o.length>0,f=d&&LO(e.id);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>aj(e.id):void 0,onKeyDown:p=>{d&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),aj(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:t,label:N7(t)}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[a?.status==="loaded"?r("已领 {claimed}/{total} · 累计 {earned} 积分",{claimed:o.length-c,total:o.length,earned:a.total?`${a.earned} / ${a.total}`:a.earned}):r("尚未查询任务状态"),a?.settled&&a.settledAt?` · ${r("结算于 {time}",{time:Fs(a.settledAt)})}`:a?.checkedAt?` · ${r("查询于 {time}",{time:Fs(a.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:p=>p.stopPropagation(),children:[a?.status==="loaded"&&c>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项待领",{n:c})}):a?.status==="loaded"?s.jsx(ze,{variant:"success",shape:"tag",children:r("全部领取")}):a?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status==="loading"||a?.claiming===!0,onClick:()=>{lj(e.id,{expand:!0,refresh:!0})},children:a?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status!=="loaded"||t!=="officeace"&&c===0||a?.claiming===!0,onClick:()=>{BO(e.id)},children:a?.claiming?r("领取中…"):c>0?r("一键领取({n})",{n:c}):r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),a?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:a.error??""})}):null,f?s.jsx("div",{className:"ck-prov-detail",children:o.map(p=>s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:p.done?"ck-task-tick done":"ck-task-tick",children:p.done?"✓":"·"}),s.jsx("span",{children:p.title}),s.jsxs("span",{className:"ck-task-pts",children:["+",p.points]}),s.jsx("span",{className:"ck-task-st",children:p.claiming?s.jsx(ze,{variant:"warning",shape:"tag",children:r("领取中")}):p.done?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):p.blocked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不可领")}):p.error?s.jsx(ze,{variant:"destructive",shape:"tag",children:p.error}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")})})]},p.key))}):null]})}function R7({row:e}){const t=Kh({claimPlans:e.claimPlans}),a=t.length>0;return s.jsxs("div",{className:"ck-welfare-row",children:[s.jsx($f,{id:"zcode",label:"ZCode"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.name||e.id,a?s.jsx(ze,{variant:"success",shape:"tag",title:r("本地台账里今天(北京时间)领过的套餐:{plans}",{plans:t.join(r("、"))}),children:r("今天已领 {n} 份",{n:t.length})}):s.jsx(ze,{variant:"outline",shape:"tag",title:r("本地台账里今天还没领过;活动期内每天发一份新套餐"),children:r("今天未领")})]}),s.jsx("div",{className:"ck-prov-desc",children:a?r("点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领"):e.claimAt?r("上次领取 {time} · 领取需通过滑块验证码",{time:Fs(e.claimAt)}):r("限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码")})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(se,{size:"sm",variant:"outline",onClick:()=>wR(e.id,e.name),children:r(a?"套餐明细":"去领取")})})]})}function O7({row:e}){const t=ur().growth.get(e.id),a=t?.tasks??[],o=a.filter(v=>v.supported&&!v.unforgeable),c=o.filter(v=>v.status!=="claimed"&&v.current0,f=d&&YG(e.id),p=t?.travel,h=t?.school,b=t?.results??[],y=v=>b.find(w=>w.code===v);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>VO(e.id):void 0,onKeyDown:v=>{d&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),VO(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx($f,{id:"workbuddy",label:"WorkBuddy"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[t?.status==="loaded"?r("{total} 项任务 · {pending} 项可完成",{total:o.length,pending:c.length}):r("查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)"),t?.checkedAt?` · ${r("查询于 {time}",{time:Fs(t.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:v=>v.stopPropagation(),children:[t?.status==="loaded"?c.length>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项可完成",{n:c.length})}):s.jsx(ze,{variant:"success",shape:"tag",children:r("全部完成")}):t?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status==="loading"||t?.running===!0,onClick:()=>{Tg(e.id)},children:t?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status!=="loaded"||t?.running===!0,title:r("接单 + 点亮 + 领奖(只处理已实测沉淀的任务)"),onClick:()=>{FO(e.id,"full")},children:t?.running?r("执行中…"):r("一键完成")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.status!=="loaded"||t?.running===!0,title:r("只领取已完成任务的奖励(幂等,重复点不会重复入账)"),onClick:()=>{FO(e.id,"claim")},children:r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),t?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:t.error??""})}):null,f?s.jsxs("div",{className:"ck-prov-detail",children:[s.jsxs("div",{className:"ck-fold-note",children:[t?.energy!==null&&t?.energy!==void 0?r("能量 {n}",{n:t.energy}):"",t?.streak!==null&&t?.streak!==void 0?` · ${r("连登 {n} 天",{n:t.streak})}`:"",t?.energy===null&&t?.streak===null?r("(能量 / 连登读数本次未取到)"):""]}),a.map(v=>{const w=y(v.code);return s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:v.status==="claimed"?"ck-task-tick done":"ck-task-tick",children:v.status==="claimed"?"✓":"·"}),s.jsxs("span",{title:v.description||v.source||v.code,children:[v.title||v.code,v.target>1?` (${v.current}/${v.target})`:""]}),w?s.jsx("span",{className:"ck-task-pts",children:w.message}):null,s.jsx("span",{className:"ck-task-st",children:v.unforgeable?s.jsx(ze,{variant:"outline",shape:"tag",children:r("需真实操作")}):v.supported?v.status==="claimed"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):v.status==="completed"?s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")}):v.locked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("未解锁")}):s.jsx(ze,{variant:"warning",shape:"tag",children:r("可完成")}):s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不支持")})})]},v.code)}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🐾"}),s.jsxs("span",{children:[r("猫猫旅行"),p&&p.hasBuddy===!0?`:${p.buddyName||r("已领养")} · ${p.state==="traveling"?r("在途"):p.state==="arrived"?r("可领奖"):p.state==="idle"?p.dailyLimitReached?r("今日已派出"):r("可派出"):p.state??""}`:p&&p.hasBuddy===!1?`:${r("未领养(领养需先完成当日对话量)")}`:":"+(p?.error?String(p.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningTravel===!0||t?.status!=="loaded",onClick:()=>{QG(e.id)},children:t?.runningTravel?r("执行中…"):r("巡检一次")})})]}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🎓"}),s.jsxs("span",{children:[r("开学季活动"),h&&h.inPeriod===!0?`:${r("进行中")}${h.lottery?.balance!==void 0&&h.lottery?.balance!==null?` · ${r("抽奖机会 {n} 次",{n:h.lottery.balance})}`:""}`:h&&h.inPeriod===!1?`:${r("非活动期")}`:":"+(h?.error?String(h.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningSchool===!0||t?.status!=="loaded",title:r("执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)"),onClick:()=>{XG(e.id,!0)},children:t?.runningSchool?r("执行中…"):r("执行并抽奖")})})]}),t?.schoolText?s.jsx("div",{className:"ck-fold-note",children:t.schoolText}):null,t?.lotteryText?s.jsx("div",{className:"ck-fold-note",children:t.lotteryText}):null]}):null]})}function M7({group:e}){return s.jsxs("div",{className:"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",style:{cursor:"default"},children:[s.jsx($f,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:aM[e.id]??""})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")})})]}),e.id==="qoder-intl"?s.jsx(lM,{}):null]})}function D7({store:e}){const t=e.snapshot,[a,o]=x.useState(null);x.useEffect(()=>{let N=!0;return(async()=>{try{const T=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:1});N&&o(Number(T?.total)||0)}catch{}})(),()=>{N=!1}},[e.version]);const c=t?.daily,d=t?.auto,f=(c?.outOfScope??[]).reduce((N,k)=>N+(Number(k.count)||0),0),p=t?.extras.onboarding??[],h=p.filter(N=>e.onboarding.get(N.id)?.status==="loaded"),b=p.reduce((N,k)=>N+(e.onboarding.get(k.id)?.unclaimed??0),0),y=t?.extras.plans??[],v=t?.extras.growth??[],w=Array.isArray(d?.schedules)?d.schedules:[],j=w.filter(N=>N.enabled===!0).length,S=WG(d);return s.jsxs("div",{children:[s.jsxs("div",{className:"ck-stats",children:[s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("今日签到进度")}),s.jsx("div",{className:"ck-stat-value",children:c?s.jsxs(s.Fragment,{children:[" ",c.todayDone,s.jsxs("small",{children:[" / ",c.todayEligible]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx(tf,{className:"ck-stat-bar",value:c&&c.todayEligible>0?c.todayDone/c.todayEligible*100:0}),s.jsx("div",{className:"ck-stat-foot",children:f>0?r("另有 {n} 个账号不参与每日签到",{n:f}):r("全部账号均可签到")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("schedule")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("schedule")},children:[s.jsx("div",{className:"ck-stat-label",children:r("定时签到")}),s.jsx("div",{className:"ck-stat-value",children:d?s.jsxs(s.Fragment,{children:[j,s.jsxs("small",{children:[" / ",w.length," ",r("条启用")]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx("div",{className:"ck-stat-foot",children:d?.enabled!==!0?r("总开关已关闭 · 在「定时签到」页打开"):S?r("下次 {date} · 点此管理条目",{date:Fs(S)}):r("暂无启用的条目 · 点此添加")})]}),s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("待领新手福利")}),s.jsx("div",{className:"ck-stat-value",children:p.length?s.jsxs(s.Fragment,{children:[b,s.jsxs("small",{children:[" ",r("项")]})]}):s.jsx("span",{className:"ck-pending",children:r("无")})}),s.jsx("div",{className:"ck-stat-foot",children:p.length?r("已有结果 {checked} / 共 {total} 个账号",{checked:h.length,total:p.length}):r("没有支持新手福利的账号")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{Ng("records")},role:"button",tabIndex:0,onKeyDown:N=>{N.key==="Enter"&&Ng("records")},children:[s.jsx("div",{className:"ck-stat-label",children:r("累计签到记录")}),s.jsx("div",{className:"ck-stat-value",children:a===null?s.jsx("span",{className:"ck-pending",children:"—"}):a}),s.jsx("div",{className:"ck-stat-foot",children:r("每账号一条明细 · 点此查看「签到记录」")})]})]}),s.jsxs("div",{className:"ck-main",children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("每日签到")}),s.jsx("span",{className:"panel-sub",children:r("点击行展开账号明细 · 单账号签到不受范围限制")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:e.runningAll||d?.running===!0,onClick:()=>{qG()},children:e.runningAll||d?.running===!0?r("签到中…"):r("立即全部签到")})]}),s.jsxs("div",{children:[(c?.providers??[]).map(N=>N.totalCount>0?s.jsx(E7,{group:N,expanded:e.expanded.has(N.id)},N.id):s.jsx(M7,{group:N},N.id)),(c?.outOfScope??[]).length>0?s.jsx("div",{className:"ck-fold-note",children:r("不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。",{list:c.outOfScope.map(N=>r("{label} ×{count}({reason})",{label:N.label,count:N.count,reason:N.reason})).join(r(";"))})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("新手福利")}),s.jsx("span",{className:"panel-sub",children:r("一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单")}),p.length>0?s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>{for(const N of p)N.settled&&typeof N.settled=="object"||lj(N.id)},children:r("全部查询")}):null]}),p.length?s.jsx("div",{children:p.map(N=>s.jsx(A7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活动福利")}),s.jsx("span",{className:"panel-sub",children:r("限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取")})]}),y.length>0?s.jsx("div",{children:y.map(N=>s.jsx(R7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有可领套餐的账号(ZCode 未添加)。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("成长任务")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细")})]}),v.length>0?s.jsx("div",{children:v.map(N=>s.jsx(O7,{row:N},N.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持成长任务的账号(需要 WorkBuddy 国内版)。")})]})]})]})}function I7(){const e=k7(),t=e.snapshot;if(x.useEffect(()=>{Ol()},[]),x.useEffect(()=>{window.wbApp?.renderTopbarStatus?.()},[e.version]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取签到数据…")})]});const a=t?.auto,o=a?.enabled===!0;return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{Ol()},children:r("重试")})]}):null,s.jsxs("div",{className:"ck-tabs",children:[s.jsx(In,{options:S7,value:e.tab,onValueChange:c=>IO(c),"aria-label":r("签到中心分区")}),s.jsx(ze,{id:"checkin-badge",className:"ml-auto",variant:a?o?"success":"outline":"destructive","data-tone":a?o?"ok":"":"bad",children:a?o?a?.lastFiredToday?r("今日已执行"):r("已开启"):r("已关闭"):r("不可用")})]}),e.tab==="center"?s.jsx(D7,{store:e}):null,e.tab==="schedule"?s.jsx(x7,{}):null,e.tab==="records"?s.jsx(j7,{}):null]})}const oM='.page[data-page="checkin"]';let iM=!1;function cM(){if(iM)return;const e=document.querySelector(oM);e&&(iM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(I7,{})))}const uM=()=>Ol();window.wbCheckinPanel={load:uM},document.querySelector(oM)?cM():document.addEventListener("DOMContentLoaded",cM,{once:!0}),Pe().wbApp?.currentPage==="checkin"&&uM();function P7(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _7({options:e,onSettle:t}){const{title:a="确认操作",html:o="",text:c="",okText:d="确定",okClass:f="primary",bodyClass:p="danger-zone",cancelText:h="取消"}=e,b=x.useRef(null);return x.useEffect(()=>{function y(v){v.key==="Escape"&&t(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t]),x.useEffect(()=>{function y(v){v.target?.dataset.slot==="alert-dialog-overlay"&&t(!1)}return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[t]),s.jsx(yV,{open:!0,onOpenChange:y=>{y||t(!1)},children:s.jsxs(NV,{initialFocus:b,showCloseButton:!0,children:[s.jsx(kV,{className:"pr-10",children:s.jsx(jV,{children:a})}),s.jsx(CV,{children:s.jsx(EV,{tone:p==="danger-zone"?"danger":"neutral",dangerouslySetInnerHTML:{__html:o||P7(c).replace(/\n/g,"
    ")}})}),s.jsxs(TV,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:b,variant:"outline",onClick:()=>t(!1),children:h}),s.jsx(se,{variant:f==="danger"?"destructive":"default",onClick:()=>t(!0),children:d})]})]})})}let qf=null,Au=null,Og=null;function L7(){qf&&(qf.unmount(),qf=null),Au&&(Au.remove(),Au=null)}function dM(e){const t=Og;Og=null,L7(),t?.(e)}function z7(e={}){return new Promise(t=>{Og&&dM(!1),Og=t,Au=document.createElement("div"),document.body.append(Au),qf=vn.createRoot(Au),qf.render(s.jsx(_7,{options:e,onSettle:dM}))})}window.wbConfirm={ask:z7};const B7=r("Base URL 填进客户端的「API 地址 / Base URL」栏;对话协议按客户端支持的类型三选一(Chat Completions / Responses / Anthropic Messages),三者共用同一套模型与账号池,可随时切换;鉴权用「网关 Key」页里任一启用 Key。");function Gf({id:e,name:t,note:a}){return s.jsxs("div",{className:"ep-row",children:[s.jsxs("div",{className:"ep-head",children:[s.jsx("span",{className:"ep-name",children:t}),s.jsx("span",{className:"ep-note",children:a})]}),s.jsxs("div",{className:"ep-line",children:[s.jsx("code",{className:"ep-value",id:e,children:"—"}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)]","data-copy-from":e,title:r("复制地址"),children:"⧉"})]})]})}function H7(){return s.jsxs("section",{className:"panel ep-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("接口地址")}),s.jsx("span",{className:"tip-q","data-tip":B7})]}),s.jsxs("div",{className:"ep-list",children:[s.jsx(Gf,{id:"api-base",name:"Base URL",note:r("填进客户端的「API 地址 / Base URL」")}),s.jsx("div",{className:"ep-group",children:r("对话协议(按客户端支持的类型选一行)")}),s.jsx(Gf,{id:"api-chat",name:"OpenAI Chat Completions",note:r("多数 OpenAI 兼容客户端的默认协议")}),s.jsx(Gf,{id:"api-responses",name:"OpenAI Responses",note:r("OpenAI 新协议(Codex、新版 SDK)")}),s.jsx(Gf,{id:"api-messages",name:"Anthropic Messages",note:r("Claude Code / Anthropic SDK(token 计数:/v1/messages/count_tokens)")}),s.jsx("div",{className:"ep-group",children:r("模型清单")}),s.jsx(Gf,{id:"api-models",name:r("模型列表"),note:r("客户端自动拉取可用模型;不受鉴权限制,配 Key 之前就能拉")})]}),s.jsx("div",{className:"panel-foot",children:s.jsxs("span",{children:[r("鉴权用「网关 Key」页里任一"),s.jsx("b",{children:r("启用")}),r("的 Key:请求带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("。一把启用的 Key 都没有时不鉴权(默认网关只监听 127.0.0.1;在设置页开启「局域网访问」后监听所有网卡,鉴权与安全闸门随之启用)。")]})})]})}const fM='.page[data-page="docs"]';let pM=!1;function mM(){if(pM)return;const e=document.querySelector(fM);e&&(pM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(H7,{})))}document.querySelector(fM)?mM():document.addEventListener("DOMContentLoaded",mM,{once:!0});function ia(){return window}function fj(e){return e instanceof Error?e.message:String(e)}function Kf(e,t){ia().wbApp?.toast?.(e,t)}function U7(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const pj=[{key:"name",label:r("名称")},{key:"key",label:"Key"},{key:"time",label:r("创建时间")},{key:"state",label:r("启用")},{key:"act",label:r("操作"),align:"right"}],V7={name:"cell-name",key:"cell-key",time:"cell-time",state:"cell-state state",act:"cell-act r"},hM='.page[data-page="keys"]';let Mg=null,mj=null;function gM(){return Mg?Mg.apply([...pj]):pj.map(e=>({...e,align:e.align??"left"}))}function xM(){ia().wbColSettings?.syncStaticHead?.("keys",document.querySelector("table.keys-table"))}function F7(){if(Mg)return;const e=ia().wbColSettings?.register({id:"keys",label:r("网关 Key 表"),columns:pj,mount:()=>document.querySelector('.page[data-page="keys"] .panel-head .head-actions'),onChange:()=>{xM(),mj?.()}});e&&(Mg=e,xM())}function $7(e){return Array.isArray(e?.keys)?e.keys:[]}function q7(e){return Array.isArray(e?.providers)?e.providers:[]}function G7(e){const t=e?.modelsByProvider;return t&&typeof t=="object"?t:{}}function hj(e){return ia().wbProviders?.labelOf?.(e)||e}function K7(e,t,a){const o=new Map,c=f=>{const p=String(f??"").trim();if(!p)return;const h=p.toLowerCase();o.has(h)||o.set(h,p)};t.forEach(f=>{const p=e[f]??e[String(f).toLowerCase()];Array.isArray(p)&&p.forEach(c)}),a.forEach(c);const d=[...o.values()].map(f=>({value:f,label:r(f)}));return d.sort((f,p)=>f.value.toLowerCase()String(t)):[]}function vM(e,t){const a=new Map(t.map(c=>[c.value.toLowerCase(),c.value])),o=new Set;return e.forEach(c=>{const d=a.get(String(c).toLowerCase());d&&o.add(d)}),t.filter(c=>o.has(c.value)).map(c=>c.value)}function Z7({target:e,providers:t,modelsByProvider:a,onClose:o,onSaved:c}){const d=e?.id??null,f=!!d,[p,h]=x.useState(e?.name??""),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(!1),N=x.useRef(!1),[k,T]=x.useState(()=>bM(e?.allowedProviders)),[D,C]=x.useState(()=>bM(e?.allowedModels)),A=x.useMemo(()=>t.map(H=>({value:String(H.id),label:r(String(H.label??H.id))})),[t]),R=x.useMemo(()=>vM(k,A),[k,A]),I=x.useMemo(()=>K7(a,R,D),[a,R,D]),P=x.useMemo(()=>vM(D,I),[D,I]),O=I.length?r("没有匹配的选项"):R.length?r("这几家当前没有可用模型(账号未登录或清单为空)"):r("请先在上面选择可用提供商");function _(){N.current=!1,S(!1)}async function L(){if(!N.current){N.current=!0,S(!0),w(r("保存中…"));try{const H=ia().workbuddyDesktop;if(!H)throw new Error(r("后端桥不可用"));if(d){const Q=await H.updateKey(d,{allowedProviders:R,allowedModels:P});_(),c(Q),o(),Kf(r("✅ 可用范围已保存"));return}const B=b.trim();if(B&&B.length<8){w(r("Key 至少需要 8 个字符"));return}const z=await H.createKey({name:p.trim(),key:B||void 0,allowedProviders:R,allowedModels:P});_(),c(z,z?.created?.id),o(),Kf(r("✅ Key 已创建,记得复制给客户端"))}catch(H){w(r("保存失败:{reason}",{reason:fj(H)}))}finally{_()}}}return s.jsx(Qt,{open:!0,onOpenChange:(H,B)=>{if(!H){if(N.current){B.cancel();return}o()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:f?r("可用范围 · {name}",{name:e?.name||r("未命名")}):r("新建 API Key")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-name",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("名称")}),s.jsx($e,{id:"key-name",type:"text",maxLength:60,placeholder:r("例如 Cursor / 公司电脑"),autoComplete:"off",value:p,disabled:f,onChange:H=>h(H.currentTarget.value)})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-value",className:"text-[12.5px] whitespace-nowrap text-subtle",children:"Key"}),s.jsx($e,{id:"key-value",type:"text",placeholder:r("留空自动生成;手填至少 8 个字符"),autoComplete:"off",spellCheck:!1,value:b,onChange:H=>y(H.currentTarget.value),onKeyDown:H=>{H.key==="Enter"&&L()}})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用提供商")}),s.jsx(Bh,{value:R,onValueChange:T,options:A,placeholder:r("留空 = 不限制"),searchPlaceholder:r("搜索提供商…"),"aria-label":r("可用提供商"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用模型")}),s.jsx(Bh,{value:P,onValueChange:C,options:I,placeholder:r("留空 = 不限制"),emptyHint:O,searchPlaceholder:r("搜索模型…"),"aria-label":r("可用模型"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsx("p",{children:r("留空表示不限制;同时设置时请求需同时满足两个条件(模型在白名单内且路由到允许的提供商)。 「可用模型」的候选跟着上面勾选的提供商走:没勾提供商时它是空的(还没有约束范围), 勾了几家就列出这几家能收的全部对外名。")}),s.jsx("p",{id:"key-restrict-summary",children:Q7(R,P)})]}),s.jsx("div",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:o,disabled:j,children:r("取消")}),s.jsx(se,{variant:"default",disabled:j,onClick:()=>{L()},children:r(f?"保存范围":"创建")})]})]})})}let Dg=null;async function W7(){await Dg?.load()}function J7(){Dg?.render()}function e9(){const[e,t]=x.useState(null),[a,o]=x.useState(()=>new Set),[c,d]=x.useState(()=>new Set),[f,p]=x.useState(null),[,h]=x.useState(0),b=x.useRef(new Set),y=x.useRef(!1),v=x.useCallback(L=>{t(L)},[]),w=x.useCallback(L=>{L&&Array.isArray(L.keys)&&v(L)},[v]),j=x.useCallback(async()=>{if(!y.current){y.current=!0;try{const L=ia().workbuddyDesktop;if(!L)throw new Error(r("后端桥不可用"));v(await L.getKeys()??null)}catch(L){Kf(r("读取 Key 列表失败:{reason}",{reason:fj(L)}),"err")}finally{y.current=!1}}},[v]);async function S(L,H,B){if(!b.current.has(L)){b.current.add(L),d(new Set(b.current));try{w(await H()),B&&Kf(B)}catch(z){Kf(r("操作失败:{reason}",{reason:fj(z)}),"err")}finally{b.current.delete(L),d(new Set(b.current))}}}function N(L){o(H=>{const B=new Set(H);return B.has(L)?B.delete(L):B.add(L),B})}async function k(L){const H=ia().workbuddyDesktop,B=ia().wbConfirm?.ask;if(!H||!B)return;const z=U7(L.name||L.masked||L.id);await B({title:r("删除网关 Key"),html:r("确定删除 Key「{name}」?使用它的客户端会立刻无法访问。",{name:z}),okText:r("删除"),okClass:"danger"})&&S(L.id,()=>H.deleteKey(L.id),r("Key 已删除"))}function T(L,H){const B=ia().workbuddyDesktop;B&&S(L.id,()=>B.updateKey(L.id,{enabled:H}),r(H?"Key 已启用":"Key 已停用"))}x.useLayoutEffect(()=>(Dg={load:j,render:()=>h(L=>L+1)},mj=()=>h(L=>L+1),F7(),h(L=>L+1),()=>{Dg=null,mj=null}),[j]),x.useEffect(()=>{ia().wbApp?.currentPage==="keys"&&j()},[j]),x.useEffect(()=>{ia().wbApp?.renderTopbarStatus?.()},[e]);const D=$7(e),C=ig(D.length,"keys"),A=C.paged?C.slice(D):D,R=gM(),I=e?.authRequired===!0,P=A.filter(L=>L.enabled).length,O=I?r("已启用鉴权 · {n} 把 Key 生效",{n:P}):r("未启用鉴权");function _(L,H,B){switch(L){case"name":return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t",children:H.name||r("未命名")})}),s.jsx("div",{className:"mname",title:X7(H),children:Y7(H)})]});case"key":{const z=a.has(H.id);return s.jsxs("div",{className:"keycell",children:[s.jsx("code",{className:"kv",children:z?H.key:H.masked}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>N(H.id),children:r(z?"隐藏":"显示")}),s.jsx(se,{size:"sm",variant:"ghost","data-copy":H.key,title:r("复制 Key"),children:r("复制")})]})}case"time":return s.jsx("span",{className:"muted",children:H.createdAt?ia().wbApp?.formatTime?.(H.createdAt):"—"});case"state":return s.jsx(hs,{checked:H.enabled===!0,disabled:B,"aria-label":r("启用「{name}」",{name:H.name||r("未命名")}),onCheckedChange:z=>T(H,z)});case"act":return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:B,onClick:()=>p({key:H}),children:r("可用范围")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:B,onClick:()=>{k(H)},children:r("删除")})]});default:return null}}return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("API Key 列表")}),s.jsx(ze,{id:"keys-status",variant:I?"success":"warning","data-tone":I?"ok":"warn",children:O}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"default",onClick:()=>p({key:null}),children:r("+ 新建 Key")})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table keys-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"k-name","data-col":"name"}),s.jsx("col",{className:"k-key","data-col":"key"}),s.jsx("col",{className:"k-time","data-col":"time"}),s.jsx("col",{className:"k-state","data-col":"state"}),s.jsx("col",{className:"k-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"name",children:r("名称")}),s.jsx("th",{"data-col":"key",children:"Key"}),s.jsx("th",{"data-col":"time",children:r("创建时间")}),s.jsx("th",{"data-col":"state",children:r("启用")}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{children:A.length?A.map(L=>{const H=c.has(L.id);return s.jsx("tr",{className:L.enabled?"":"off","data-id":L.id,children:R.map(B=>s.jsx("td",{className:`${V7[B.key]??""} ta-${B.align}`,children:_(B.key,L,H)},B.key))},L.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:R.length,className:"empty",children:r(e?"还没有 Key,当前不鉴权":"加载中…")})})})]})}),s.jsx(Li,{leading:s.jsxs("span",{children:[r("客户端请求需带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("; 修改后立即生效,本程序自身会自动使用第一把启用的 Key。每把 Key 可单独限制"),s.jsx("b",{children:r("可用提供商")}),r("与"),s.jsx("b",{children:r("可用模型")}),r("(行内「可用范围」):留空 = 不限制,两个都设时 按交集生效 —— 被限制的模型对这把 Key 表现为「不存在」(拉 /v1/models 也看不到它), 提供它的家不在可用列表里时请求同样被拒。")]}),total:D.length,range:C.paged?{start:C.rangeStart,end:C.rangeEnd}:null,page:C.page,pageCount:C.pageCount,size:C.size,onSizeChange:C.setSize,onPageChange:C.goto}),f?s.jsx(Z7,{target:f.key,providers:q7(e),modelsByProvider:G7(e),onClose:()=>p(null),onSaved:(L,H)=>{H&&o(B=>new Set(B).add(H)),w(L)}}):null]})}let yM=!1;function wM(){if(yM)return;const e=document.querySelector(hM);e&&(yM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(e9,{})))}document.querySelector(hM)?wM():document.addEventListener("DOMContentLoaded",wM,{once:!0}),window.wbKeysPanel={load:W7,render:J7,visibleColumns:gM};const t9="login-app",n9=x.createElement("panel-captcha",{id:"captcha"});function s9(){return s.jsxs("div",{className:"w-[min(400px,100%)] rounded-lg border border-border bg-card p-[36px_34px_30px] shadow-3",children:[s.jsxs("div",{className:"mb-[26px] flex flex-col items-center gap-3 text-center",children:[s.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Agent2API",className:"size-[52px] rounded-[12px] shadow-[0_6px_18px_rgba(0,122,255,0.35)]",children:[s.jsx("rect",{width:"24",height:"24",rx:"5.4",fill:"#007AFF"}),s.jsxs("g",{fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M5.23 9.24h10.71"}),s.jsx("path",{d:"M15.94 6.72 18.77 9.24 15.94 11.76"}),s.jsx("path",{d:"M18.77 14.76H8.06"}),s.jsx("path",{d:"M8.06 12.24 5.23 14.76 8.06 17.28"})]})]}),s.jsxs("div",{children:[s.jsx("h1",{className:"m-0 text-[21px] font-bold tracking-[0.2px]",children:"Agent2API"}),s.jsx("div",{className:"text-[12.5px] text-muted-foreground",children:r("OpenAI 兼容网关 · 管理面板")})]})]}),s.jsx("div",{id:"mode-tip",className:"mb-[18px] text-center text-[13px] text-muted-foreground"}),s.jsxs("form",{id:"form",autoComplete:"on",children:[s.jsx(Je,{htmlFor:"username",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("账号")}),s.jsx($e,{id:"username",autoComplete:"username",placeholder:r("管理员账号")}),s.jsx(Je,{htmlFor:"password",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("密码")}),s.jsx($e,{id:"password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位")}),n9,s.jsx(se,{id:"submit",type:"submit",size:"lg",className:"w-full",children:r("继续")}),s.jsx("div",{id:"error",className:"mt-3 min-h-5 text-center text-[13px] whitespace-pre-wrap text-destructive"})]}),s.jsx("div",{className:"mt-[22px] text-center text-[12px] text-muted-foreground",children:r("登录后可在「网关 Key」页为 API 客户端创建密钥")})]})}function r9(){const e=document.getElementById(t9);e&&Cs.flushSync(()=>{vn.createRoot(e).render(s.jsx(s9,{}))})}r9();function Lr(){return window}function gj(e){return e instanceof Error?e.message:String(e)}function Ig(e,t){Lr().wbApp?.toast?.(e,t)}const jM=1e3,a9=ag,l9=500,SM="workbuddy-desktop-logs-range",xj="workbuddy-desktop-logs-filters",o9=300,i9="~/.agent2api/logs.jsonl",bj=["today","7","30","month","all"],vj="all",c9={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},u9=bj.map(e=>({value:e,label:c9[e]})),yj=[{value:"",label:r("全部级别")},{value:"debug",label:r("debug 及以上")},{value:"info",label:r("info 及以上")},{value:"warn",label:r("warn 及以上")},{value:"error",label:r("仅 error")}],d9=r("全部级别"),NM=r("全部分类"),f9={debug:r("调试"),info:r("信息"),warn:r("警告"),error:r("错误")};let Pg=jM,_g=!0,wj=!1,jj=!1,Sj=!1,Nj=null,Eo=null,kj=null,Lg=null,Cj=!1,Tj=!1;const Ej={level:"",category:"",keyword:""};function p9(){const e=Lr().wbFilterMemory;if(!e)return{...Ej};Cj=!0;const t=e.load(xj,{...Ej});return{level:yj.some(a=>a.value===t.level)?t.level:"",category:t.category,keyword:t.keyword}}function zg(e){Lr().wbFilterMemory?.save(xj,{level:e.level||"",category:e.category||"",keyword:e.keyword.trim()||""})}function m9(){try{const e=localStorage.getItem(SM);return e!==null&&bj.includes(e)?e:vj}catch{return vj}}function h9(e){try{localStorage.setItem(SM,e)}catch{}}function Bg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function g9(e){const t=new Date;switch(e){case"today":return Bg(t);case"7":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Bg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function x9(e){if(!e)return"—";const t=new Date(e),a=d=>String(d).padStart(2,"0"),o=`${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`,c=`${a(t.getMonth()+1)}-${a(t.getDate())}`;return t.getFullYear()===new Date().getFullYear()?`${c} ${o}`:`${t.getFullYear()}-${c} ${o}`}function b9(e){const t=e.data;if(!t)return"";const a=[];return(t.from||t.to)&&a.push([t.from,t.to].filter(Boolean).join(" → ")),t.model&&a.push(r("模型 {model}",{model:t.model})),t.resetAtText?a.push(r("{time} 恢复",{time:t.resetAtText})):t.status&&!t.from&&!t.to&&a.push(`HTTP ${t.status}`),a.length?a.join(" · "):""}function Aj(e){return Array.isArray(e?.entries)?e.entries:[]}function Hg(e,t,a){const o=Math.max(1,a==="all"?1:Math.ceil(t.length/a));return Math.min(Math.max(1,e),o)}function Rj(e,t){return Object.hasOwn(e,t)}function v9(e){const t={};if(e&&typeof e=="object")for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function kM(e,t){const a=new URLSearchParams,o=e.keyword.trim(),c=g9(t);return e.level&&a.set("level",e.level),e.category&&a.set("category",e.category),o&&a.set("keyword",o),c!==null&&a.set("start",String(c)),a}function y9(e,t){const a=kM(e,t);return a.set("limit",String(l9)),a.toString()}function w9(e,t){return kM(e,t).toString()}function j9(e){Nj=e||null,Lr().wbApp?.updateLogsBadge?.(Nj)}async function S9(){if(!wj)try{const e=await Lr().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="logsAutoRefresh");Oj(t||null),wj=Array.isArray(e?.tasks)}catch(e){console.warn("读取日志自动刷新间隔失败,按默认 10 秒:",gj(e)),Oj(null)}}function Oj(e){wj=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(_g=e.enabled!==!1,Pg=e.unit==="minutes"?t*6e4:t*1e3):(_g=!0,Pg=jM),Eo?.applyAutoConfig(Pg,_g)}async function N9(e={}){await Eo?.load(e)}function k9(e){if(!Eo){Lg={data:e??null};return}Eo.render(e)}function C9(){return Nj}async function T9(e){if(!Eo){kj=e;return}await Eo.showCategory(e)}const E9={entries:[],total:0,matched:0,file:i9,categories:{},loaded:!1};function Mj(e,t){return{entries:Aj(e),total:Number(e?.total)||0,matched:Number(e?.matched)||0,file:e?.file||t.file,categories:Object.keys(t.categories).length?t.categories:v9(e?.categories),loaded:!0}}function A9(e){return e.loaded?e.total?r("没有符合筛选条件的日志"):r("暂无日志"):r("正在加载日志…")}function R9(){const[e,t]=x.useState(E9),[a,o]=x.useState(p9),[c,d]=x.useState(m9),[f,p]=x.useState(1),[h,b]=x.useState(()=>lg("logs")),[y,v]=x.useState(null),[w,j]=x.useState(()=>({ms:Pg,enabled:_g})),S=x.useRef(null),N=x.useRef(null),k=x.useRef(null),T=x.useRef(null),D=x.useRef(a),C=x.useRef(c),A=x.useRef(f),R=x.useRef(h),I=x.useRef(e),P=x.useCallback(re=>{const de={...D.current,...re};return D.current=de,o(de),de},[]),O=x.useCallback(re=>{C.current=re,d(re)},[]),_=x.useCallback(re=>{A.current=re,p(re)},[]),L=x.useCallback(re=>{R.current=re,b(re),og("logs",re)},[]),H=x.useCallback(re=>{I.current=re,t(re)},[]),B=x.useCallback(()=>{if(Cj)return;const re=Lr().wbFilterMemory;if(!re||(Cj=!0,Tj))return;const de=re.load(xj,{...Ej});P({level:de.level,category:de.category,keyword:de.keyword})},[P]),z=x.useCallback(async(re={})=>{const{silent:de=!1,resetPage:ke=!1}=re;ke&&_(1),S9(),B();const Ee=y9(D.current,C.current),ve=A.current;try{const he=Lr().workbuddyDesktop;if(!he)throw new Error(r("后端桥不可用"));const[ye,je]=await Promise.all([he.getLogs(Ee),he.getLogStats()]),xe=ke?0:S.current?.scrollTop??0,Te=Mj(ye,I.current);H(Te),_(Hg(A.current,Aj(ye),R.current)),N.current=A.current===ve?xe:0,j9(je),Object.keys(Te.categories).length&&D.current.category&&!Rj(Te.categories,D.current.category)&&(zg(P({category:""})),z({resetPage:!0}))}catch(he){de||(console.warn("读取运行日志失败:",gj(he)),H(Mj(null,I.current)),_(Hg(A.current,[],R.current)))}},[H,_,B]),Q=x.useCallback(re=>{re!==void 0&&(H(Mj(re,I.current)),_(Hg(A.current,Aj(re),R.current)))},[H,_]),K=x.useCallback(async re=>{if(Rj(I.current.categories,re)||await z({silent:!0}),!Rj(I.current.categories,re))return;const de=P({category:re});zg(de),_(1),await z({resetPage:!0}),Lr().wbApp?.showPage?.("logs",{persist:!0})},[P,_,z]);x.useEffect(()=>{if(Eo={load:z,render:Q,showCategory:K,applyAutoConfig:(de,ke)=>j({ms:de,enabled:ke})},Lg){const de=Lg;Lg=null,Q(de.data)}const re=kj;return re!==null?(kj=null,K(re)):z({silent:!0}),()=>{Eo=null,k.current!==null&&window.clearTimeout(k.current),k.current=null}},[z,Q,K]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const re=window.setInterval(()=>{document.hidden||Lr().wbApp?.currentPage!=="logs"||jj||(jj=!0,z({silent:!0}).finally(()=>{jj=!1}))},w.ms);return()=>{window.clearInterval(re)}},[w,z]),x.useLayoutEffect(()=>{const re=N.current;if(re===null)return;N.current=null;const de=S.current;de&&(de.scrollTop=re)});async function X(re,de,ke){if(!Sj){Sj=!0,v({which:re,label:de});try{await ke()}catch(Ee){Ig(r("操作失败:{error}",{error:gj(Ee)}),"err")}finally{Sj=!1,v(null)}}}async function q(){const re=w9(D.current,C.current),de=re.length>0,ke=de?r("确定清空当前筛选出的 {count} 条日志?清空后无法恢复。",{count:Number(I.current.matched)||0}):r("确定清空全部运行日志?清空后无法恢复。"),Ee=Lr().wbConfirm?.ask;Ee&&await Ee({title:r("清空运行日志"),html:ke,okText:r("清空"),okClass:"danger"})&&await X("clear",r("清空中…"),async()=>{const ve=Lr().workbuddyDesktop;if(!ve)throw new Error(r("后端桥不可用"));await ve.clearLogs(de?re:"all=1"),await z({resetPage:!0}),Ig(r("运行日志已清空"))})}async function $(){await X("export",r("导出中…"),async()=>{const re=Lr().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.exportLogs();if(!(!de||de.canceled)){if(de.count===0){Ig(r("暂无日志可导出"),"err");return}Ig(r("✅ 已导出 {count} 条日志到 {file}",{count:String(de.count),file:String(de.file)}))}})}function Y(re){const de=Hg(re,I.current.entries,R.current);de!==A.current&&(_(de),N.current=0)}function F(re){if(re===R.current)return;const de=I.current.entries.length,ke=de?(A.current-1)*(R.current==="all"?de:R.current):0;L(re),_(re==="all"?1:Math.floor(ke/re)+1),N.current=0}function G(re){Tj=!0,zg(P(re)),z({resetPage:!0})}function W(re){Tj=!0,P({keyword:re}),k.current!==null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,zg(D.current),z({resetPage:!0})},o9)}function le(re){const de=bj.includes(re)?re:vj;de!==C.current&&(O(de),h9(de),z({resetPage:!0}))}const M=e.entries,U=h!=="all",Z=Math.max(1,U?Math.ceil(M.length/h):1),ae=Math.min(Math.max(1,f),Z),ce=U?M.slice((ae-1)*h,ae*h):M,J=M.length?U?(ae-1)*h+1:1:0,ie=M.length?U?J+ce.length-1:M.length:0,ge=e.categories,ee=e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total});x.useEffect(()=>{const re=e.loaded?ee:"—";T.current!==re&&(T.current=re,Lr().wbApp?.renderTopbarStatus?.())},[e.loaded,ee]);function fe(re,de){const ke=re.level||"",Ee=b9(re);return s.jsxs("div",{className:`log-row ${ke}`,children:[s.jsx("span",{className:"log-rail",children:s.jsx("span",{className:`log-dot ${ke}`})}),s.jsxs("div",{className:"log-main",children:[s.jsxs("div",{className:"log-line",children:[s.jsx("span",{className:"log-cat",children:ge[re.category||""]||re.category}),s.jsx("span",{className:`log-lvl ${ke}`,children:f9[ke]||re.level}),s.jsx("span",{className:"msg",children:re.message})]}),Ee?s.jsx("div",{className:"log-extra-wrap",children:s.jsx("span",{className:"extra",children:Ee})}):null]}),s.jsx("span",{className:"time",children:x9(re.ts)})]},re.id??de)}const te=y?.which==="export",Ce=y?.which==="clear";return s.jsxs("section",{className:"panel",id:"logs-panel-events",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("系统事件")}),s.jsx(ze,{id:"logs-badge",variant:"outline","data-tone":"",children:e.loaded?ee:"—"}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-logs-export",variant:"outline",disabled:y!==null,onClick:()=>{$()},children:te?y?.label:r("导出")}),s.jsx(se,{id:"btn-logs-clear",variant:"destructive",disabled:y!==null,onClick:()=>{q()},children:Ce?y?.label:r("清空")})]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:u9,value:c,onValueChange:le,"aria-label":r("事件日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.level,onValueChange:re=>G({level:String(re??"")}),children:[s.jsx(mt,{id:"logs-level",className:"min-w-[120px]",title:r("按最低级别筛选"),"aria-label":r("按最低级别筛选"),children:s.jsx(pt,{children:yj.find(re=>re.value===a.level)?.label??d9})}),s.jsx(ht,{children:yj.map(re=>s.jsx(qe,{value:re.value,children:re.label},re.value))})]}),s.jsxs(ft,{value:a.category,onValueChange:re=>G({category:String(re??"")}),children:[s.jsx(mt,{id:"logs-category",className:"min-w-[120px]",title:r("按分类筛选"),"aria-label":r("按分类筛选"),children:s.jsx(pt,{children:a.category?ge[a.category]||a.category:NM})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:NM}),Object.entries(ge).map(([re,de])=>s.jsx(qe,{value:re,children:de},re))]})]}),s.jsxs(Ci,{className:"w-auto flex-auto",children:[s.jsx(Ei,{id:"logs-keyword",type:"search",placeholder:r("搜索消息关键词…"),autoComplete:"off","aria-label":r("搜索消息关键词"),value:a.keyword,onChange:re=>W(re.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]})]}),s.jsx("div",{className:"log-list",id:"log-list",ref:S,children:ce.length?ce.map((re,de)=>fe(re,de)):s.jsx("div",{className:"log-empty",children:A9(e)})})]}),s.jsx(Li,{total:M.length,range:U?{start:J,end:ie}:null,page:ae,pageCount:Z,size:h,sizes:a9,onSizeChange:F,onPageChange:Y})]})}const CM='.page[data-page="logs"]';let TM=!1;function EM(){if(TM)return;const e=document.querySelector(CM);e&&(TM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(R9,{})))}document.querySelector(CM)?EM():document.addEventListener("DOMContentLoaded",EM,{once:!0}),window.wbLogsPanel={load:N9,render:k9,lastStats:C9,applyAutoRefresh:Oj,showCategory:T9};const Ru=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Yf=["maxInputTokens","maxOutputTokens"],AM=["supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Ou={maxInputTokens:r("上下文窗口"),maxOutputTokens:r("最大输出 Token"),supportsToolCall:r("工具调用"),supportsImages:r("图片识别"),supportsVideo:r("视频识别"),supportsReasoning:r("支持思考")};r("工具"),r("图片"),r("视频"),r("思考");const O9=1e8;function Dj(e){return Yf.includes(e)}function Ij(e,t){if(Dj(e)){const a=typeof t=="number"?t:Number(t);return!Number.isFinite(a)||a<1||a>O9?null:Math.trunc(a)}return typeof t=="boolean"?t:null}function RM(e){const t={};if(!e||typeof e!="object")return t;const a=e;for(const o of Ru){const c=Ij(o,a[o]);c!==null&&(t[o]=c)}return t}function Pj(e){return Array.isArray(e)?Ru.filter(t=>e.some(a=>a===t)):[]}function _j(e){return RM(e?.capabilities)}function OM(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"—";const a=o=>o.toFixed(1).replace(/\.0$/,"");return t>=1e6?`${a(t/1e6)}M`:t>=1e3?`${a(t/1e3)}K`:String(Math.round(t))}function Xf(e){const t=Number(e);return!Number.isFinite(t)||t<=0?r("未声明"):Math.round(t).toLocaleString("en-US")}function Lj(e){return e===!0?"on":e===!1?"off":"unset"}function M9(e){const t=e?.reasoningLevels;if(!Array.isArray(t))return null;const a=t.filter(c=>typeof c=="string"&&c.trim()!=="");if(!a.length)return null;const o=e?.reasoningDefaultLevel;return{levels:a,defaultLevel:typeof o=="string"?o.trim():""}}function D9(e,t,a,o=""){const c=Ou[e],d=a?r("(已被手动覆盖,弹窗里可恢复继承)"):"",f=I9(o);if(Dj(e))return t==null?r("{label}:上游未声明{suffix}",{label:c,suffix:d}):r("{label}:{value}(对下游声明的精确值){origin}{suffix}",{label:c,value:Xf(t),origin:f,suffix:d});const p=Lj(t);return p==="on"?r("{label}:支持{origin}{suffix}",{label:c,origin:f,suffix:d}):p==="off"?r("{label}:不支持{origin}{suffix}",{label:c,origin:f,suffix:d}):r("{label}:上游未声明(下游会按不支持处理){suffix}",{label:c,suffix:d})}function Mu(e,t){const a=e?.capSources?.[t];return a==="upstream"||a==="modelsdev"||a==="user"?a:""}function I9(e){return e==="modelsdev"?r("(由 models.dev 补齐)"):e==="user"?r("(手动设定)"):""}function P9(e){const t={};for(const a of Ru){const o=e[a];Dj(a)?t[a]=Ij(a,o.trim()):t[a]=o==="on"?!0:o==="off"?!1:null}return t}function Qf(){return window}const MM=e=>String(e??"").trim().toLowerCase(),$s=(e,t)=>MM(e)===MM(t);function es(e){return typeof e=="string"&&e.startsWith("custom-")}function Fi(){return(Qf().wbProviders?.customList?.()||[]).filter(e=>es(e?.id))}function DM(){return Qf().wbProviders?.customList?.()||[]}function Ao(e){return Fi().find(t=>t.id===e)||null}function _9(e){const t=RM(e),a={};for(const o of Ru){const c=t[o];(typeof c=="number"||typeof c=="boolean")&&(a[o]=c)}return Object.keys(a).length?a:void 0}function IM(e){const t=(Array.isArray(e?.models)?e.models:[]).map(c=>{const d={id:String(c?.id??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""};return d.capabilities=_9(c?.capabilities),d}).filter(c=>c.id),a=(Array.isArray(e?.mappings)?e.mappings:[]).map(c=>({alias:String(c?.alias??"").trim(),target:String(c?.target??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""})).filter(c=>c.alias&&c.target);for(const c of t){const d=a.find(f=>$s(f.alias,c.id)&&$s(f.target,c.id));d&&(c.enabled=c.enabled&&d.enabled,c.reasoning=d.reasoning||c.reasoning)}const o=a.filter(c=>!($s(c.alias,c.target)&&t.some(d=>$s(d.id,c.target))));return{models:t,mappings:o}}function PM(e){const t=Ao(e);if(!t)return null;const a=IM(t),o=t.name||e,c=[],d=[];for(const f of a.models)c.push({id:f.id,name:"",provider:e,providerLabel:o,source:"",enabled:f.enabled,aliases:[],capabilities:f.capabilities||{},capOverrides:[]}),d.push({alias:f.id,target:f.id,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!0,dangling:!1,carried:!0});for(const f of a.mappings){const p=c.find(h=>$s(h.id,f.target));d.push({alias:f.alias,target:f.target,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!1,dangling:!p,carried:!!p}),p&&p.aliases.push(f.alias)}return{models:c,mappings:d}}async function $i(e,t){const a=Qf().wbProviders;if(!a?.customRequest)throw new Error(r("目录模块未就绪"));const o=Ao(e);if(!o)throw new Error(r("该自定义提供商已不存在(可能已被删除),请刷新后重试"));const c=IM(o),d=t(c);return await a.customRequest("POST","/api/custom-providers/models",{providerId:e,models:c.models,mappings:c.mappings}),await a.refreshCustom?.(),d}async function _M(e,t,a,o={}){const{enabled:c,reasoning:d}=o;await $i(e,f=>{if($s(t,a)){const h=f.models.find(b=>$s(b.id,a));if(!h)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:a}));return c!==void 0&&(h.enabled=!!c),d!==void 0&&(h.reasoning=String(d??"")),null}const p=f.mappings.find(h=>$s(h.alias,t)&&$s(h.target,a));if(p)return c!==void 0&&(p.enabled=!!c),d!==void 0&&(p.reasoning=String(d??"")),null;if(c===!1)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return f.mappings.push({alias:t,target:a,enabled:c??!0,reasoning:String(d??"")}),null})}async function LM(e,t,a){await $i(e,o=>{const c=o.mappings.length;if(o.mappings=o.mappings.filter(d=>!($s(d.alias,t)&&$s(d.target,a))),o.mappings.length===c)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return null})}async function zM(e,t){const a=String(t??"").trim();if(!a)throw new Error(r("请填写模型 ID"));await $i(e,o=>{if(o.models.some(c=>$s(c.id,a)))throw new Error(r("模型「{name}」已存在(忽略大小写判重)",{name:a}));return o.models.push({id:a,enabled:!0,reasoning:""}),null})}async function L9(e,t){const a=(Array.isArray(t)?t:[]).map(o=>String(o??"").trim()).filter(Boolean);if(!a.length)throw new Error(r("没有选中任何模型"));return $i(e,o=>{let c=0;for(const d of a)o.models.some(f=>$s(f.id,d))||(o.models.push({id:d,enabled:!0,reasoning:""}),c++);return c})}async function BM(e,t,a){await $i(e,o=>{const c=o.models.find(f=>$s(f.id,t));if(!c)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:t}));const d={...c.capabilities||{}};for(const[f,p]of Object.entries(a))p==null?delete d[f]:d[f]=p;return c.capabilities=Object.keys(d).length?d:void 0,null})}async function HM(e,t){return $i(e,a=>{const o=a.mappings.length;a.mappings=a.mappings.filter(d=>!$s(d.target,t));const c=o-a.mappings.length;return a.models=a.models.filter(d=>!$s(d.id,t)),{removedMappings:c}})}async function z9(e){const t=Qf().wbProviders;if(!t?.customRequest)throw new Error(r("目录模块未就绪"));const a=await t.customRequest("POST","/api/custom-providers/fetch-models",{providerId:e}),o=(Array.isArray(a?.models)?a.models:[]).map(d=>String(d??"").trim()).filter(Boolean),c=await $i(e,d=>{let f=0;for(const p of o)d.models.some(h=>$s(h.id,p))||(d.models.push({id:p,enabled:!0,reasoning:""}),f++);return f});return{total:o.length,added:Number(c)||0}}Qf().wbModelsCustom={isCustom:es,list:Fi,listSource:DM,record:Ao,buildView:PM,setBinding:_M,removeMapping:LM,addModel:zM,addModels:L9,removeModel:HM,setCapabilities:BM,fetchModels:z9};const ca="__custom__",B9=["off","none","minimal","low","medium","high","xhigh","max"];function Zf(e,t){const a=UM(t);if(a.length)return a;const o=e?.reasoningLevels;return Array.isArray(o)&&o.length?o.filter(c=>typeof c=="string"):[...B9]}function UM(e){const t=e?.reasoningLevels;return Array.isArray(t)?t.filter(a=>typeof a=="string"&&a.trim()!==""):[]}function H9(e,t){const a=t.map(UM).filter(f=>f.length>0);if(!a.length||a.length!==t.length)return Zf(e);const[o,...c]=a,d=o.filter(f=>c.every(p=>p.includes(f)));return d.length?d:Zf(e)}function VM(e,t,a){return`${String(e??"").trim().toLowerCase()}${String(t??"").trim().toLowerCase()}${String(a??"").trim().toLowerCase()}`}function U9(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=typeof a?.reasoning=="string"?a.reasoning.trim():"";o&&t.set(VM(a.alias,a.target,a.provider),o)}return(a,o,c)=>t.get(VM(a,o,c))||""}function Wt(){return window}function Ro(e){return e instanceof Error?e.message:String(e)}function wr(e,t){Wt().wbApp?.toast?.(e,t)}function zj(e){const t=Wt().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function V9(e){const t=Wt().formatTime??Wt().wbApp?.formatTime;return String(t?.(e)??"")}const FM=e=>String(e??"").trim().toLowerCase(),Oo=(e,t)=>FM(e)===FM(t),$M=8,qM="workbuddy-desktop-models-filters",Bj=["all","enabled","disabled","mapped"],F9={all:r("全部"),enabled:r("已启用"),disabled:r("已禁用"),mapped:r("有映射")},$9=Bj.map(e=>({value:e,label:F9[e]})),Hj=["default","rate-asc","rate-desc"],q9={default:r("默认"),"rate-asc":r("倍率升序"),"rate-desc":r("倍率降序")},G9=Hj.map(e=>({value:e,label:q9[e]})),Uj=[{key:"check",label:r("选择"),align:"center"},{key:"model",label:r("上游模型")},{key:"rate",label:r("倍率")},{key:"source",label:r("来源")},{key:"budget",label:r("上下文 / 输出")},{key:"caps",label:r("能力")},{key:"alias",label:r("模型映射")},{key:"act",label:r("操作"),align:"right"}],GM=new Set(["rate","source"]),Wf="custom-all",Vj={models:[],mappings:[]},KM={provider:"all",state:"all",search:"",sort:"default"};function YM(){const e=Wt().wbFilterMemory;if(!e)return{...KM};const t=e.load(qM,{...KM});return{provider:String(t.provider||"all"),state:Bj.includes(t.state)?t.state:"all",search:String(t.search||""),sort:Hj.includes(t.sort)?t.sort:"default"}}const Ug=YM();let XM=!!Wt().wbFilterMemory,Vg=!1,ts={provider:Ug.provider,stateFilter:Ug.state,search:Ug.search,sort:Ug.sort,data:null,expanded:new Set,pending:new Set,mapping:null,customModel:null,capability:null};const Fj=new Set;function Jf(){return ts}function K9(e){return Fj.add(e),()=>{Fj.delete(e)}}function Ps(e){const t={...ts,...e},a=$g(t),o=$g(ts)!==a;ts=a===t.provider?t:{...t,provider:a},X9(),o&&qg();for(const c of Fj)c()}function Fg(e){Wt().wbFilterMemory?.save(qM,e)}function QM(){if(XM||Vg||!Wt().wbFilterMemory)return;XM=!0;const e=YM();(e.provider!==ts.provider||e.state!==ts.stateFilter||e.search!==ts.search||e.sort!==ts.sort)&&Ps(e)}function $g(e){const t=e.provider;return t==="all"||t===Wf||Fi().some(a=>a.id===t)||Array.isArray(e.data?.models)&&e.data.models.some(a=>(a.provider||"")===t)||!e.data||!$j()?t:"all"}function Du(){return $g(ts)}function $j(){return!!Wt().wbProviders}function Iu(){return Du()===Wf}function ZM(){return Iu()||es(Du())}let ep=null;function qj(e){const t=Ao(e);return(!ep||ep.id!==e||ep.record!==t)&&(ep={id:e,record:t,view:PM(e)||Vj}),ep.view}let tp=null;function Y9(){const e=DM();if(tp&&tp.directory===e)return tp.view;const t=[],a=[];for(const o of Fi()){const c=qj(String(o.id||""));t.push(...c.models||[]),a.push(...c.mappings||[])}return tp={directory:e,view:t.length||a.length?{models:t,mappings:a}:Vj},tp.view}function Gj(){const e=Du();return es(e)?qj(e):e===Wf?Y9():ts.data||Vj}function np(){const e=Gj();return Array.isArray(e.models)?e.models:[]}function WM(){const e=Gj();return Array.isArray(e.mappings)?e.mappings:[]}let JM=(e,t,a)=>"";function X9(){JM=U9(WM())}function Kj(){const e=new Map,t=Array.isArray(ts.data?.models)?ts.data.models:[];for(const a of t){const o=a.provider||"";if(!o)continue;const c=e.get(o)||{label:a.providerLabel||o,n:0};c.n++,e.set(o,c)}return e}function Q9(){const e=new Map;for(const t of Fi()){const a=String(t.id||"");if(!a)continue;const o=qj(a);e.set(a,{label:String(t.name||a),n:(o.models||[]).length})}return e}function Z9(){return[...Kj().keys()]}function W9(e){const a=(Array.isArray(ts.data?.models)?ts.data.models:[]).find(o=>o.provider===e);return Number(a?.refreshedAt)||0}function Yj(){const e=new Map;for(const t of np()){const a=t.provider||"";a&&!e.has(a)&&e.set(a,t.providerLabel||a)}return[...e].map(([t,a])=>({id:t,label:a}))}function e2(e){return e?np().filter(t=>(t.provider||"")===e).sort((t,a)=>+(t.enabled===!1)-+(a.enabled===!1)).map(t=>({id:t.id,label:t.name&&t.name!==t.id?r("{id}({name})",{id:t.id,name:t.name}):t.id,off:t.enabled===!1})):[]}function J9(){const e=[],t=Wt().wbProviders?.all?.();if(Array.isArray(t))for(const a of t){const o=String(a?.id||"");o&&e.push({id:o,label:String(a?.label||o)})}for(const a of Fi()){const o=String(a.id||"");o&&e.push({id:o,label:String(a.name||o)})}return e.length?e:Yj()}let sp=null,Xj=null;function t2(){const e=sp?sp.apply(Uj):Uj;return ZM()?e.filter(t=>!GM.has(t.key)):e}function qg(){Wt().wbColSettings?.syncStaticHead("models",Xj,ZM()?GM:null)}function eK(){if(sp)return;sp=Wt().wbColSettings?.register({id:"models",label:r("模型管理表"),columns:Uj,mount:()=>document.querySelector('.page[data-page="gateway"] .panel-head .head-actions'),buttonPlacement:"last",onChange:()=>{qg(),qi()}})||null,sp&&qi()}let Gg=0,Qj=!1;async function Kg({force:e=!1}={}){if(Qj&&!e)return;const t=++Gg;Qj=!0,QM();try{const a=await Wt().workbuddyDesktop?.getModelManage();if(t!==Gg)return;Ps({data:a&&Array.isArray(a.models)?a:null})}catch(a){if(t!==Gg)return;qi(),wr(r("读取模型清单失败:{message}",{message:Ro(a)}),"err")}finally{t===Gg&&(Qj=!1)}}async function n2(){try{await Wt().wbProviders?.refreshCustom?.()}catch{}await Kg({force:!0})}function qi(){Ps({})}function Gi(e){const t=e;if(t&&Array.isArray(t.models)){Ps({data:t});return}qi()}async function Yg(e,t,a,o){if(es(e))return _M(e,t,a,o);const c=Wt().workbuddyDesktop;if(!c)throw new Error(r("后端桥不可用"));return c.addModelMapping(t,a,e,o.reasoning,o.enabled)}async function tK(e,t,a){if(es(e))return LM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.removeModelMapping(t,a,e)}async function nK(e,t){if(es(e))return zM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.addCustomModel(e,t)}async function s2(e,t){if(es(e))return HM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.removeCustomModel(e,t)}async function sK(e,t,a){if(es(e))return BM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.setModelCapabilities(e,t,a)}async function Zj(e,t,a){if(!ts.pending.has(e)){Ps({pending:new Set(ts.pending).add(e)});try{Gi(await t()),a&&wr(a)}catch(o){wr(r("操作失败:{message}",{message:Ro(o)}),"err")}finally{const o=new Set(ts.pending);o.delete(e),Ps({pending:o})}}}function rp(e){return Pu(e).some(t=>t.enabled!==!1)}function Pu(e){const t=e.provider||"",a=WM().filter(p=>Oo(p.target,e.id)&&(!p.provider||Oo(p.provider,t))),o=new Map;for(const p of a){const h=String(p.alias).toLowerCase();(!o.has(h)||p.provider)&&o.set(h,p)}const c=String(e.id).toLowerCase(),d=o.get(c);o.delete(c);const f=[{alias:e.id,target:e.id,provider:t,enabled:e.enabled!==!1&&d?.enabled!==!1,isDefault:!0}];return f.push(...o.values()),f}const Ki=e=>`${e.provider||""}:${e.id}`,Wj=(e,t,a)=>`${e}:${t}:${a||""}`;function rK(e){Ps({expanded:new Set(ts.expanded).add(e)})}function aK(e){const t=new Set(ts.expanded);t.delete(e),Ps({expanded:t})}function lK(e){const t=Bj.includes(e)?e:"all";t!==ts.stateFilter&&(Vg=!0,Ps({stateFilter:t}),Fg({state:t}))}function oK(e){const t=Hj.includes(e)?e:"default";t!==ts.sort&&(Vg=!0,Ps({sort:t}),Fg({sort:t}))}function iK(e){Vg=!0,Ps({search:e}),Fg({search:e})}function ap(e){Ps({provider:String(e??"").trim()||"all"}),Fg({provider:ts.provider}),qg()}async function cK(e){const t=Wt().wbCustomProvidersUi;if(!t?.remove){wr(r("删除入口未就绪,请重试或重启应用"),"err");return}await t.remove(e)&&await Kg({force:!0})}function uK(){Wt().wbAccountAddForms?.openNewCustomForm?.()}function r2(e){Ps({mapping:e})}function dK(){Ps({mapping:null})}function fK(){const e=Du(),t=es(e);Ps({customModel:{provider:t||e!=="all"&&e!==Wf?e:"",locked:t}})}function pK(){Ps({customModel:null})}function a2(e,t){Ps({capability:{provider:e,id:t}})}function mK(){Ps({capability:null})}function l2(e,t){return np().find(a=>(a.provider||"")===e&&Oo(a.id,t))||null}function Jj(e){if(es(e)){const t=Ao(e)?.name;return typeof t=="string"&&t||e}return Wt().wbProviders?.labelOf?.(e)||e}function o2(){const e=Du(),t=es(e),a=t?Ao(e)?.name||e:r("内置提供商");Wt().wbModelsFetchModal?.open({providerId:e===Wf?"":e,custom:t,name:a,onDone:()=>qi(),onRefreshed:()=>{Kg({force:!0})}})}window.wbModelsPanel={render:qi,load:Kg,refreshAll:n2,refreshModels:o2,visibleColumns:t2,selectProvider:ap,builtinProviders:Z9,providerRefreshedAt:W9};function e0(e,t,a){return JM(e,t,a)}function hK(e){Xj=e}function gK(){const e=Xj;if(!e)return;const t=o=>Object.keys(o).some(c=>c.startsWith("__reactFiber$")||c.startsWith("__reactInternalInstance$"));for(const o of[...e.children])o.tagName==="TBODY"?o.id!=="models"&&o.remove():o.tagName==="TR"&&!t(o)&&o.remove();const a=e.querySelector("tbody#models");if(a)for(const o of[...a.children])t(o)||o.remove()}const xK=e=>[{value:"inherit",label:e},{value:"on",label:r("支持")},{value:"off",label:r("不支持")}];function bK(e){const t=Lj(e);return r(t==="on"?"支持":t==="off"?"不支持":"未声明")}function i2(e,t,a,o,c=""){const d=t!=null,f=Yf.includes(e)?Xf(t):bK(t);return a?o?r("已填写:对下游声明 {value}",{value:f}):r("已覆盖:对下游声明 {value}",{value:f}):o?r("未填写(下游按未声明处理)"):d?c==="modelsdev"?r("models.dev 补齐:对下游声明 {value}",{value:f}):r("继承上游:{value}",{value:f}):r("上游未声明(下游会按不支持处理)")}function vK(e,t,a){return a?Ru.filter(o=>{const c=e[o];return c!=null}):t}function yK(e,t){const a={};for(const o of Ru){const c=t.includes(o),d=e[o];Yf.includes(o)?a[o]=c&&typeof d=="number"?String(d):"":a[o]=c?d===!0?"on":"off":"inherit"}return a}function wK({context:e,onClose:t}){const a=es(e.provider),o=l2(e.provider,e.id),c=M9(o),d=_j(o),f=vK(d,Pj(o?.capOverrides),a),[p,h]=x.useState(()=>yK(d,f)),[b,y]=x.useState(""),[v,w]=x.useState(!1);if(!o)return s.jsx(Qt,{open:!0,onOpenChange:R=>{R||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const j=o.id,S=o.providerLabel||Jj(e.provider),N=r(a?"未声明":"继承上游"),k=r(a?"清除":"恢复继承");function T(R){const I=d[R];return D(R)?"":a?r("未填写"):typeof I=="number"?r("继承上游 {value}",{value:Xf(I)}):r("上游未声明")}function D(R){return f.includes(R)}function C(R,I){h(P=>({...P,[R]:I}))}async function A(){if(!v){for(const R of Yf){const I=p[R].trim();if(I&&Ij(R,I)===null){y(r("{label}要填 1 ~ 1 亿之间的整数(留空 = {inherit})",{label:Ou[R],inherit:N}));return}}w(!0),y(r("保存中…"));try{Gi(await sK(e.provider,e.id,P9(p))),t(),wr(r("✅ 已保存 {id} 的能力位({provider})",{id:j,provider:S}))}catch(R){y(r("保存失败:{message}",{message:Ro(R)})),w(!1)}}}return s.jsx(Qt,{open:!0,onOpenChange:(R,I)=>{if(!R){if(v){I.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[s.jsx("b",{className:"text-primary-fg",children:o.id}),r("({provider})",{provider:S})]}),Yf.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:`cap-${R}`,children:Ou[R]}),D(R)?s.jsx(se,{variant:"ghost",size:"2xs",disabled:v,title:r(a?"清除这一项(回到未声明)":"清除覆盖,回到上游声明值"),onClick:()=>C(R,""),children:k}):null]}),s.jsx($e,{id:`cap-${R}`,inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:T(R),disabled:v,value:p[R],onChange:I=>C(R,I.currentTarget.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A())}}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:i2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),AM.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:Ou[R]}),s.jsx(In,{options:xK(N),value:p[R],"aria-label":Ou[R],className:"self-start",onValueChange:I=>C(R,String(I))}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:i2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),c?s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 text-xs leading-[1.7] text-subtle",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{children:r("可配思考档位")}),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.levels.join(" / ")}),c.defaultLevel?s.jsxs("span",{children:[r("(默认 "),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.defaultLevel}),r(")")]}):null]}),s.jsx("div",{className:"mt-1",children:r("这是模型自己能配的档位(来自上游目录),只读;要改某一档请到映射弹窗里选。")})]}):null,s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("这几项是给"),s.jsx("b",{children:r("下游客户端")}),r("看的能力声明("),s.jsx("code",{children:"/v1/models"}),r(" 里的 "),s.jsx("code",{children:"max_input_tokens"})," / ",s.jsx("code",{children:"supports_*"}),r(" 与 "),s.jsx("code",{children:"input_modalities"}),r("),下游按它们决定发不发图片、按多大的窗口堆历史。"),s.jsx("b",{children:r("不影响网关的转发与路由")}),r("。上游清单给的值不准时,在这里改;"),r(a?"这家的清单是你自己登记的,不填的项下游按未声明处理。":"「恢复继承」会把这一项交还给上游清单的值。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:v,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{A()},children:r("保存")})]})]})})}function lp(){return window}const jK="你好",c2=4e3,SK=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],NK={chat_completions:"Chat Completions",responses:"Responses",anthropic:"Anthropic Messages"},kK="direct",CK={remote:r("远程目录"),builtin:r("内置清单"),manual:r("手动登记")},TK=[{test:e=>e===429,hint:r("该账号对这个模型正在限额冷却,等一会儿自己会好;也可以先测别的账号。")},{test:e=>e===401||e===403,hint:r("上游拒绝了这条登录态:重新登录一次,或把这条账号删掉。")},{test:e=>e===404,hint:r("上游不认识这个模型名:先点「获取模型」刷新清单,或核对默认绑定指向的上游模型。")},{test:e=>e===504,hint:r("上游没在预算内给完回答。可以只勾一个账号再测一次,看是普遍慢还是某一个账号慢。")},{test:e=>e>=500,hint:r("多半是上游自己的问题,过一会儿再试。同一个错误出现在所有账号上时,先查模型目录与映射。")}];function u2(){return lp().wbApp?.getState?.()?.accounts?.accounts||[]}function d2(e){return u2().filter(t=>(t.provider||ou)===e&&t.available!==!1&&t.enabled!==!1).sort(qh)}function f2(e){const t=String(e.email||"").trim();return t&&ir(e.provider).emailAsName?t:cu(e)||t||r("未命名账号")}function EK(){const e=globalThis.crypto?.randomUUID?.();if(e)return e;const t=a=>Array.from({length:a},()=>Math.floor(Math.random()*16).toString(16)).join("");return`${t(8)}-${t(4)}-4${t(3)}-a${t(3)}-${t(12)}`}function t0(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"—":t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function AK(e,t){return d2(e).length?"":r("该提供商没有可用账号(要在账号页启用一个、且凭证完整),一行都发不出去")}function p2({children:e,plain:t=!1}){return s.jsxs("p",{className:t?"flex items-center gap-2 text-xs leading-[1.6] text-subtle":"flex gap-2 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs leading-[1.65] text-subtle",children:[s.jsx("span",{"aria-hidden":"true",className:t?"size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]":"mt-px size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]",children:"i"}),s.jsx("span",{children:e})]})}function RK({open:e,label:t,text:a,onToggle:o}){return s.jsxs("div",{className:"overflow-hidden rounded-sm border border-border",children:[s.jsxs(se,{variant:"ghost",size:"xs",className:"w-full","aria-expanded":e,onClick:o,children:[s.jsx("span",{className:"truncate",children:t}),s.jsx("span",{"aria-hidden":"true",className:"ml-auto text-[10px]",children:e?"▴":"▾"})]}),e?s.jsx("div",{className:"border-t border-hairline bg-surface px-2.5 py-2",children:s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-[1.65] text-subtle",children:a})}):null]})}function OK(e){const[t,a]=x.useState(()=>Date.now());return x.useEffect(()=>{if(!e)return;a(Date.now());const o=window.setInterval(()=>a(Date.now()),400);return()=>window.clearInterval(o)},[e]),t}function m2(e){if(e.transport||!e.result||e.result.error)return!1;const t=Number(e.result.status)||0;return t>=200&&t<300}function MK({target:e,onClose:t}){const a=e.provider,o=l2(a,e.id),c=d2(a),d=mw(u2()),[f,p]=x.useState(""),[h,b]=x.useState(jK),[y,v]=x.useState("chat_completions"),[w,j]=x.useState(""),[S,N]=x.useState(null),[k,T]=x.useState(""),[D,C]=x.useState(""),[A,R]=x.useState(!0),[I,P]=x.useState(()=>{const te=c.find(Ce=>!vf(Ce,e.id))||c[0];return te?[te.id]:[]}),[O,_]=x.useState([]),[L,H]=x.useState(()=>new Set),B=x.useRef(0),z=x.useRef([]);z.current=O;const Q=O.some(te=>te.state==="running"),K=OK(Q);x.useEffect(()=>{let te=!0;return(async()=>{try{const Ce=lp().workbuddyDesktop?.getProxyPool;if(typeof Ce!="function")throw new Error(r("当前环境不支持代理池"));const re=await Ce();if(!te)return;if(!re||typeof re!="object"||!Array.isArray(re.items))throw new Error(r("代理池响应异常"));N(re.items),T("")}catch(Ce){if(!te)return;N([]),T(Ro(Ce))}})(),()=>{te=!1}},[]);const X=x.useCallback((te=!1)=>{const Ce=z.current.filter(re=>re.state==="running");B.current+=1;for(const re of Ce)lp().workbuddyDesktop?.terminateStatsRequest?.(re.testId)?.catch(()=>{});_([]),Ce.length&&!te&&wr(r("已中止在途测试({n} 个账号)",{n:Ce.length}))},[]);x.useEffect(()=>()=>{X(!0)},[X]);async function q(te,Ce){const re={provider:a,model:e.id,account_id:te.accountId,prompt:h.trim(),system_prompt:f.trim(),reasoning:D,stream:A,protocol:y,...w?{proxy:w}:{},test_id:te.testId},de=ke=>{B.current===Ce&&_(Ee=>Ee.map(ve=>ve.testId===te.testId?{...ve,...ke}:ve))};try{const ke=await lp().workbuddyDesktop?.testModel(re);if(!ke){de({state:"done",transport:r("桥接调用返回空(本机网关没有响应这次测试)")});return}de({state:"done",result:ke})}catch(ke){de({state:"done",transport:Ro(ke)})}}function $(){const te=c.filter(ke=>I.includes(ke.id));if(!te.length){wr(r("至少选一个测试账号"),"err");return}const Ce=B.current+1;B.current=Ce;const re=Date.now(),de=te.map(ke=>({accountId:ke.id,label:f2(ke),position:d.get(ke.id)?.position||0,testId:EK(),startedAt:re,state:"running"}));H(new Set),_(de);for(const ke of de)q(ke,Ce)}function Y(){Q?X():_([])}const F=s.jsx("span",{className:"ml-2 font-mono text-[12px] font-normal text-subtle",children:e.id});if(!o)return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("测试模型")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const G=Pu(o).find(te=>te.isDefault)?.enabled===!1,W=e0(o.id,o.id,a),le=Pu(o).filter(te=>!te.isDefault).map(te=>te.alias),M=Zf(Jf().data,o).filter(te=>te!=="off"&&te!=="none"),U=G?r("跟随映射(该行未启用,本次不注入)"):W?r("跟随映射(当前 {level})",{level:W}):r("跟随映射(未绑定等级)"),Z=[r("以模型本名直发"),le.length?r("另有 {n} 条别名映射({aliases}),别名不参与本次",{n:le.length,aliases:le.join(r("、"))}):"",G?r("该行当前未启用:测试照常按本名直发(「先测通、再决定要不要启用」正是这颗按钮的用法),但本行的思考等级绑定不参与本次,生产路由也要等绑定打开后才会放行"):W?r("映射上绑定的思考等级是 {level},「跟随映射」按它注入",{level:W}):r("映射上未绑定思考等级,「跟随映射」等于这次不注入")].filter(Boolean).join(r(";"))+r("。"),ae=lp().wbProviders?.PROTOCOL_OPTIONS||SK,ce=ae.find(te=>te.value===y)?.label||y,J=[{value:"",label:r("跟随账号配置")},{value:kK,label:r("直连(不使用代理)")},...(S??[]).map(te=>({value:`${Xa}${te.id}`,label:au(te)}))];S===null?J.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):S.length||J.push({value:"__hint_pool__",label:r(k?"代理列表读取失败":"还没有代理(去「网络代理」页添加)"),disabled:!0});const ie=J.find(te=>te.value===w)?.label||r("跟随账号配置"),ge=c.map(te=>({value:te.id,label:`#${d.get(te.id)?.position||0} ${f2(te)}`+(vf(te,e.id)?r(" · 限额中"):"")}));function ee(te){const Ce=(he,ye)=>s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-hairline px-3 py-2",children:[he,s.jsx("b",{className:"min-w-0 truncate text-[12.5px] text-foreground",title:te.label,children:te.label}),te.position?s.jsxs("span",{className:"flex-none text-xs text-subtle",children:["#",te.position]}):null,s.jsx("span",{className:"ml-auto flex-none font-mono text-[11.5px] tabular-nums text-subtle",children:ye})]},"head");if(te.state==="running"){const he=(K-te.startedAt)/1e3;return s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs text-subtle",children:[s.jsx(ef,{className:"flex-none"}),s.jsxs("span",{className:"min-w-0 truncate",children:[r("账号 "),s.jsx("b",{className:"text-foreground",children:te.label}),r(" 已发出,等待上游首帧…")]}),s.jsx("span",{className:"ml-auto flex-none font-mono tabular-nums",children:r("已等待 {seconds}s",{seconds:he.toFixed(1)})})]},te.testId)}const re=te.result;if(!m2(te)){const he=Number(re?.status)||0,ye=TK.find(je=>je.test(he))?.hint??(te.transport?r("确认桌面端还在运行,再重试一次。"):"");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"destructive",className:"flex-none",children:he||r("失败")}),r("用时 {time}",{time:t0(re?.duration_ms)})),s.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2.5",children:[s.jsxs("div",{className:"text-[12.5px] leading-[1.7]",children:[te.transport?s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("本机网关没有返回结论")}),r(":"),te.transport]}):s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("测试未通过")}),r(":"),re?.error||r("上游没有给出可读的错误说明")]}),Number(re?.attempts)>1?r("(中间共尝试 {n} 次)",{n:Number(re?.attempts)}):""]}),ye?s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:ye}):null]})]},te.testId)}const de=String(re?.reply??""),ke=String(re?.reasoning??""),Ee=`think-${te.testId}`,ve=[re?.upstream_model&&re.upstream_model!==e.id?r("上游 {model}",{model:re.upstream_model}):"",re?.upstream_reasoning?r("思考等级 {level}",{level:re.upstream_reasoning}):"",re?.protocol&&re.protocol!=="chat_completions"?NK[re.protocol]||re.protocol:"",re?.proxy?r("节点 {proxy}",{proxy:re.proxy}):"",Number(re?.attempts)>1?r("尝试 {n} 次",{n:Number(re?.attempts)}):""].filter(Boolean).join(" · ");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"success",className:"flex-none",children:Number(re?.status)||200}),r("用时 {time} · 首字 {ttfb}",{time:t0(re?.duration_ms),ttfb:t0(re?.ttfb_ms)})),s.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-subtle",children:[s.jsx("span",{className:"flex-none",children:r("回复")}),ve?s.jsx("span",{className:"min-w-0 truncate",title:ve,children:ve}):null,s.jsx(se,{variant:"ghost",size:"2xs",className:"ml-auto flex-none","data-copy":de,children:r("复制")})]}),s.jsx("div",{className:"max-h-[220px] overflow-y-auto whitespace-pre-wrap rounded-sm border border-border bg-surface px-3 py-2 text-[12.5px] leading-[1.7]",children:de||s.jsx("span",{className:"text-subtle",children:r("(上游这一次返回了空正文)")})}),ke?s.jsx(RK,{open:L.has(Ee),label:r("思考过程({n} 字)",{n:ke.length}),text:ke,onToggle:()=>H(he=>{const ye=new Set(he);return ye.has(Ee)?ye.delete(Ee):ye.add(Ee),ye})}):null]})]},te.testId)}function fe(){if(Q){const Ce=O.length-O.filter(re=>re.state==="running").length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[r("正在测 "),s.jsx("b",{className:"text-foreground",children:O.length}),r(" 个账号"),Ce?s.jsxs(s.Fragment,{children:[r(",已完成 "),s.jsx("b",{className:"text-foreground",children:Ce})]}):null,r("。")]}):null,O.map(re=>ee(re))]})}const te=O.filter(m2).length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[s.jsx("b",{className:te?"text-success":"text-foreground",children:te}),r(" 成功 ·"),s.jsxs("b",{className:O.length-te?"text-destructive":"text-foreground",children:[" ",O.length-te]}),r(" 失败")]}):null,O.map(Ce=>ee(Ce)),te===0?s.jsxs(p2,{children:[r("两边原因不一样时各自处理。如果"),s.jsx("b",{className:"text-foreground",children:r("同一条错误出现在所有账号上")}),r(",通常就不是账号问题了:先确认这个模型还在上游目录里(「获取模型」刷一次),再看默认绑定指向的上游模型对不对。")]}):null]})}return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r("测试模型"),F]})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-inset px-3 py-2.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12.5px] font-semibold text-primary-fg",title:o.id,children:o.id}),s.jsx(ze,{shape:"tag",variant:"brand",children:Jj(a)}),s.jsx(ze,{shape:"tag",variant:"outline",children:es(a)?r("自定义家"):CK[o.source]||r("来源未知")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("本次测试的发送口径")}),children:"?"}),s.jsx(_i,{children:Z})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-system",children:r("系统提示词")}),s.jsx(Qc,{id:"model-test-system",rows:2,maxLength:c2,placeholder:r("留空则不携带;设置页的提示词模式照常生效"),value:f,onChange:te=>p(te.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-prompt",children:r("用户提示词")}),s.jsx(Qc,{id:"model-test-prompt",rows:2,maxLength:c2,placeholder:r("留空用默认问候「你好」"),value:h,onChange:te=>b(te.currentTarget.value)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-protocol",children:r("对话协议")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("对话协议的说明")}),children:"?"}),s.jsx(_i,{children:r("按所选网关对话协议组装请求并校验响应转换(Chat Completions / Responses / Anthropic Messages)。")})]})]}),s.jsxs(ft,{value:y,onValueChange:te=>v(String(te)),children:[s.jsx(mt,{id:"model-test-protocol",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ce})}),s.jsx(ht,{children:ae.map(te=>s.jsx(qe,{value:te.value,children:te.label},te.value))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-proxy",children:r("测试节点")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试节点的说明")}),children:"?"}),s.jsx(_i,{children:r("仅本次测试临时生效,不修改账号保存的代理配置。可选「网络代理」页里的节点或强制直连。")})]})]}),s.jsxs(ft,{value:w,onValueChange:te=>j(String(te)),children:[s.jsx(mt,{id:"model-test-proxy",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ie})}),s.jsx(ht,{children:J.map(te=>s.jsx(qe,{value:te.value,disabled:te.disabled,children:te.label},te.value))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:D,onValueChange:te=>C(String(te)),children:[s.jsx(mt,{id:"model-test-reasoning",className:"w-full",children:s.jsx(pt,{children:D?r("{level}(本次指定)",{level:D}):U})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:U}),M.map(te=>s.jsx(qe,{value:te,children:r("{level}(本次指定)",{level:te})},te))]})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-stream",children:r("流式请求")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("流式请求的说明")}),children:"?"}),s.jsx(_i,{children:r("默认开,与真实请求一致:可同时验证 SSE 链路与首字延迟。")})]})]}),s.jsx(hs,{id:"model-test-stream",checked:A,onCheckedChange:te=>R(!!te)})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Je,{htmlFor:"model-test-accounts",children:r("测试账号")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试账号的说明")}),children:"?"}),s.jsx(_i,{children:r("勾几个就并行测几次;默认选队列里最靠前的一个。")})]}),s.jsx(se,{variant:"ghost",size:"xs",className:"ml-auto",disabled:!c.length||I.length===c.length,onClick:()=>P(c.map(te=>te.id)),children:r("全选({n})",{n:c.length})})]}),s.jsx(Bh,{id:"model-test-accounts",value:I,onValueChange:P,options:ge,placeholder:r("选一个账号(至少一个)"),searchPlaceholder:r("搜索账号…"),emptyHint:r("这家没有可用账号(要在账号页启用一个、且凭证完整)")})]}),s.jsx(p2,{plain:!0,children:r("真实链路 · 消耗少量额度 · 日志带「测试」标记,不计报表")})]}),s.jsxs(nn,{className:"justify-end",children:[s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:!I.length||!c.length,onClick:$,children:r("开始测试")})]}),s.jsx(Qt,{open:O.length>0,onOpenChange:te=>{te||Y()},children:s.jsxs(Zt,{overlayForceRender:!0,className:"w-[min(680px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r(Q?"测试中…":"测试结果"),F]})}),s.jsx(Bt,{children:fe()}),s.jsx(nn,{className:"justify-end",children:Q?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-xs text-subtle",children:r("关闭即中止")}),s.jsx(se,{variant:"outline",onClick:()=>X(),children:r("中止测试")}),s.jsx(se,{variant:"default",disabled:!0,children:r("测试中…")})]}):s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"outline",onClick:Y,children:r("关闭")}),s.jsx(se,{variant:"default",onClick:$,children:r("再测一次")})]})})]})})]})})}const h2=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"reasoning",label:r("设置思考等级")},{value:"delete",label:r("删除")}];function g2(e){return e.source==="manual"||es(e.provider)}function DK(e){return(e.name&&e.name!==e.id?r("{name}({id})",{name:e.name,id:e.id}):e.id)||e.id}function IK({models:e,onClose:t,onDone:a}){const[o,c]=x.useState("enable"),d=H9(Jf().data,e),[f,p]=x.useState(()=>({select:d[0]||"",custom:""})),[h,b]=x.useState(!1),[y,v]=x.useState(""),w=f.select===ca?f.custom.trim():f.select,j=e.filter(g2).length,S=h2.find(T=>T.value===o)?.label||r("操作");async function N(T){return Promise.resolve(Wt().wbConfirm?.ask?.({title:r("删除选中的模型"),html:r("确定删除选中的 {count} 个模型登记?删除后 /v1/models 不再广告它们、请求也会被拒。",{count:T})+(e.length>T?"
    "+r("另有 {n} 个非手动登记的模型将被跳过。",{n:e.length-T}):""),okText:r("删除"),okClass:"danger"})??!1)}async function k(){if(h)return;if(!e.length){wr(r("没有选中的模型"),"err");return}if(o==="reasoning"&&f.select===ca&&!w){v(s.jsx("span",{className:"text-destructive",children:r("请填写自定义思考等级,或改选候选档 / 「清除」")}));return}if(o==="delete"){if(j===0){v(s.jsx("span",{className:"text-destructive",children:r("选中的模型都不是手动登记,无法删除(开关映射才是它们的手段)")}));return}if(!await N(j))return}b(!0),v("");let T=0,D=0,C=0,A="";for(const R of e){const I=R.provider||"";try{if(o==="delete"){if(!g2(R)){D+=1;continue}Gi(await s2(I,R.id))}else if(o==="enable"||o==="disable"){const P=o==="enable";for(const O of Pu(R))Gi(await Yg(I,O.alias,R.id,{enabled:P}))}else for(const P of Pu(R))Gi(await Yg(I,P.alias,R.id,{reasoning:w}));T+=1}catch(P){C+=1,A||(A=Ro(P)),v(s.jsx("span",{className:"text-destructive",children:r("失败 {n} 个 · 首个失败:{error}",{n:C,error:A})}))}}C===0?(wr(D?r("✅ 批量{action}完成:共 {n} 个模型(跳过不可删除的 {skipped} 个)",{action:S,n:T,skipped:D}):r("✅ 批量{action}完成:共 {n} 个模型",{action:S,n:T})),a()):(wr(r("批量{action}完成:成功 {ok} 个,失败 {failed} 个",{action:S,ok:T,failed:C}),"err"),v(s.jsxs("span",{className:"text-destructive",children:[r("成功 {ok} 个,失败 {failed} 个",{ok:T,failed:C}),D?r(",跳过 {n} 个",{n:D}):"",A?r(";首个失败:{error}",{error:A}):""]}))),b(!1)}return s.jsx(Qt,{open:!0,onOpenChange:T=>{T||h||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {n} 个模型",{n:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下模型")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:e.map(DK).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Eh,{value:o,onValueChange:T=>c(T),className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:h2.map(T=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(bo,{value:T.value}),T.label]},T.value))}),o==="reasoning"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-model-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:f.select,onValueChange:T=>p(D=>({...D,select:String(T)})),children:[s.jsx(mt,{id:"batch-model-reasoning",className:"min-w-[220px]",children:s.jsx(pt,{children:f.select===ca?r("自定义等级…"):f.select||r("清除(不覆盖)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("清除(不覆盖)")}),d.map(T=>s.jsx(qe,{value:T,children:T},T)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]})]}),f.select===ca?s.jsxs("div",{className:"field-row mt-2",children:[s.jsx("label",{htmlFor:"batch-model-reasoning-custom",children:r("自定义等级")}),s.jsx($e,{id:"batch-model-reasoning-custom",maxLength:32,value:f.custom,onChange:T=>p(D=>({...D,custom:T.currentTarget.value}))})]}):null,s.jsxs("p",{className:"detail mt-1.5",children:[r("设置 / 清除会应用到选中模型的"),s.jsx("b",{children:r("全部映射")}),r("(默认绑定与别名 chips);「清除」= 不给这些映射指定等级(选「不覆盖」的口径与映射弹窗一致)")]})]}):null,o==="delete"?s.jsx("p",{className:"detail mt-2",children:j===0?r("选中的都不是手动登记的模型,删除不可用(上游目录带回来的行由清单决定存在性)"):r("可删除 {n} 个(手动登记 / 自定义家);",{n:j})+(e.length>j?r("其余 {n} 个会被跳过。",{n:e.length-j}):"")}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:y})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:h,onClick:t,children:r("关闭")}),s.jsx(se,{variant:o==="delete"?"destructive":"default",disabled:h,onClick:()=>{k()},children:h?r("执行中…"):r("执行{action}",{action:S})})]})]})})}function er(){return window}const x2={intl:"fm-table-intl",custom:"fm-table-custom"},b2={intl:"fetch-models",custom:"fetch-models-custom"},n0=["provider","source","state","count","note","updated","op"],s0=["pick","model","state"],PK={provider:"w-[13%]",source:"w-[21%]",state:"w-[9%]",count:"w-[6%]",note:"w-[20%]",updated:"w-[16%]",op:"w-[15%]"},_K={pick:"w-[8%]",model:"w-[74%]",state:"w-[18%]"},LK={pick:"",provider:r("提供商"),source:r("模型来源"),state:r("状态"),count:r("模型数"),note:r("说明"),updated:r("更新日期"),model:r("上游模型"),op:r("操作")},zK={refreshed:{variant:"brand",label:r("已刷新")},failed:{variant:"destructive",label:r("失败")},skipped:{variant:"outline",label:r("跳过")}},v2=new Set(["cline-free","cline-pass"]),y2="workbuddy-desktop-fetch-model-source";function op(e){return String(e??"").trim().toLowerCase()}function r0(e,t){er().wbApp?.toast?.(e,t)}function a0(e){return e instanceof Error?e.message:String(e)}function w2(e){const t=er().formatTime??er().wbApp?.formatTime;return String(t?.(e)??"")}function j2(){return er().wbApp?.getState?.()?.accounts?.accounts||[]}function BK(e){const a=(er().wbProviders?.customList?.()||[]).find(o=>o.id===e)?.models;return new Set((Array.isArray(a)?a:[]).map(o=>op(o?.id)).filter(Boolean))}function S2(e){if(e?.nameCustom===!0&&e?.name)return e.name;const t=String(e?.email||"").trim();return er().wbAccountsModel?.providerFeatures?.(e?.provider)?.emailAsName&&t?t:String(e?.nickname||e?.name||t||e?.id||"").trim()||r("未命名账号")}function HK(e){if(v2.has(e))return[];const t=er().wbAccountsModel?.byPriorityOrder,a=j2().filter(o=>(o?.provider||"workbuddy")===e&&o?.available!==!1&&o?.enabled!==!1);return t?a.sort(t):a}function N2(){const e=new Set(er().wbModelsPanel?.builtinProviders?.()||[]);for(const t of j2())t?.available===!1||t?.enabled===!1||e.add(t?.provider||"workbuddy");return[...e]}function UK(){const e=new Set(N2());return(er().wbProviders?.all?.()||[]).filter(t=>e.has(t?.id??""))}function VK(e){return w2(Number(e.refreshedAt)||0)||"—"}function FK(e){return zK[String(e.status)]??{variant:"outline",label:String(e.status||r("未知"))}}function $K(){try{const e=JSON.parse(localStorage.getItem(y2)||"{}");if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&o&&(t[a]=o);return t}catch{return{}}}function qK(e){er().wbFilterMemory?.save?.(y2,e)}function GK({options:e,onClose:t}){const a=e.providerId,o=!!e.custom,c=e.name||a,{onDone:d,onRefreshed:f}=e,[p,h]=x.useState("idle"),[b,y]=x.useState(""),[v,w]=x.useState(""),[j,S]=x.useState(null),[N,k]=x.useState(""),T=j!==null,[D,C]=x.useState(!1),[A,R]=x.useState([]),[I,P]=x.useState(()=>new Set),[O,_]=x.useState(()=>new Set),[L,H]=x.useState([]),[B,z]=x.useState(""),[Q,K]=x.useState($K);x.useEffect(()=>{er().wbTableColumns?.repaint?.(o?b2.custom:b2.intl)},[o]);const X=o?[]:UK(),q=o?[]:G(),$=B.trim().toLowerCase(),Y=A.filter(ve=>!$||ve.toLowerCase().includes($)),F=o?D?r("已选 {picked} 个 · 上游共 {upstream} 个 · 清单已有 {managed} 个",{picked:O.size,upstream:A.length,managed:I.size}):r("尚未获取"):W(q);function G(){const ve=new Map(L.map(je=>[String(je.provider||""),je])),he=X.map(je=>{const xe=String(je.id||"");return{provider:xe,label:String(je.label||xe),item:ve.get(xe)}}),ye=new Set(he.map(je=>je.provider));for(const je of L){const xe=String(je.provider||"");ye.has(xe)||he.push({provider:xe,label:String(je.providerLabel||xe),item:je})}return he}function W(ve){if(p==="loading")return r("正在刷新…");if(p==="error")return"";const he=ve.map(xe=>xe.item).filter(xe=>!!xe);if(!he.length)return D?r("刷新完成,但没有得到任何结果"):ve.length?r("共 {n} 家 · 点「获取模型」开始",{n:ve.length}):r("0 家");const ye=he.filter(xe=>xe.status==="refreshed").length,je=he.filter(xe=>xe.status==="failed").length;return je?r("{total} 家 · 成功 {done} · 失败 {failed}",{total:ve.length,done:ye,failed:je}):r("{total} 家 · 成功 {done}",{total:ve.length,done:ye})}function le(ve,he){const ye=HK(ve);if(!ye.length)return{list:ye,selected:""};const je=String(Q[ve]||""),xe=String(he||""),Te=Oe=>ye.some(Ne=>String(Ne.id)===Oe);return{list:ye,selected:Te(je)?je:Te(xe)?xe:String(ye[0].id)}}function M(ve){const he={};for(const[ye,je]of Object.entries(Q))je&&(he[ye]=je);for(const ye of ve){const{selected:je}=le(ye.provider,ye.reported);je&&(he[ye.provider]=je)}return he}const U=q.map(ve=>({provider:ve.provider,reported:ve.item?.accountId}));function Z(ve,he){K(ye=>({...ye,[ve]:he})),qK({[ve]:he})}async function ae(){if(!T){S("load"),w(""),y(""),h("loading");try{if(o){const he=await er().wbProviders?.customRequest?.("POST","/api/custom-providers/fetch-models",{providerId:a}),ye=new Set,je=(Array.isArray(he?.models)?he.models:[]).map(Te=>String(Te??"").trim()).filter(Te=>{const Oe=op(Te);return!Te||ye.has(Oe)?!1:(ye.add(Oe),!0)}),xe=BK(a);R(je),P(xe),_(new Set(je.filter(Te=>!xe.has(op(Te))))),C(!0),h("ready");return}const ve=await er().workbuddyDesktop?.refreshModels({accounts:M(U),providers:N2()});H(Array.isArray(ve?.results)?ve.results:[]),C(!0),h("ready"),Number(ve?.refreshed)>0&&f?.()}catch(ve){const he=a0(ve);y(he),h("error"),w(he)}finally{S(null)}}}async function ce(ve){if(!(T||!ve.provider)){S("row"),k(ve.provider),w("");try{const he=await er().workbuddyDesktop?.refreshModels({accounts:M([{provider:ve.provider,reported:ve.item?.accountId}]),providers:[ve.provider]});H(ye=>J(ye,Array.isArray(he?.results)?he.results:[])),C(!0),h("ready"),Number(he?.refreshed)>0&&f?.()}catch(he){const ye=a0(he);w(ye),r0(r("获取失败:{message}",{message:ye}),"err")}finally{S(null),k("")}}}function J(ve,he){const ye=new Map(he.map(Te=>[String(Te.provider||""),Te])),je=ve.map(Te=>ye.get(String(Te.provider||""))??Te),xe=new Set(je.map(Te=>String(Te.provider||"")));for(const Te of he)xe.has(String(Te.provider||""))||je.push(Te);return je}async function ie(){if(!o||T||!O.size)return;const ve=[...O];S("import"),w("");try{const he=Number(await er().wbModelsCustom?.addModels?.(a,ve))||0;r0(r("✅ 已导入 {added} 个模型({skipped} 个已存在,跳过)",{added:he,skipped:ve.length-he})),S(null),t(),d?.()}catch(he){const ye=a0(he);r0(r("导入失败:{message}",{message:ye}),"err"),w(ye),S(null)}}function ge(){T||t()}function ee(){const ve=new Set(O);for(const he of A)I.has(op(he))||ve.add(he);_(ve)}function fe(ve){return s.jsx(kl,{children:s.jsx(Nn,{colSpan:o?s0.length:n0.length,className:"py-[26px] text-center text-muted-foreground",children:ve})})}function te(ve){return s.jsx("span",{className:"font-mono text-[11.5px] tabular-nums text-muted-foreground",children:ve})}function Ce(ve){return s.jsx("div",{className:"truncate font-mono text-[12px] font-semibold",children:ve})}function re(ve,he){const{list:ye,selected:je}=le(ve,he);if(!ye.length){const Te=v2.has(ve)?r("这家的模型清单是全局的,不跟账号走"):r("这家还没有可用账号,刷新会使用默认登录态");return s.jsx("span",{className:"text-[11.5px] text-muted-foreground",title:Te,children:"—"})}const xe=ye.find(Te=>String(Te.id)===je);return s.jsxs(ft,{value:je,onValueChange:Te=>Z(ve,String(Te)),children:[s.jsx(mt,{className:"w-full",title:r("用哪个账号去拉这家的模型清单"),"aria-label":r("模型来源"),children:s.jsx(pt,{children:xe?S2(xe):"—"})}),s.jsx(ht,{children:ye.map(Te=>s.jsx(qe,{value:String(Te.id),children:S2(Te)},String(Te.id)))})]})}function de(){return p==="idle"?fe(r("点右侧「获取模型」从上游拉取这家的模型清单")):p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):Y.length?Y.map(ve=>{const he=I.has(op(ve));return s.jsxs(kl,{className:he?"opacity-50":void 0,children:[s.jsx(Nn,{children:s.jsx(Mr,{checked:O.has(ve),disabled:he,"aria-label":ve,onCheckedChange:ye=>_(je=>{const xe=new Set(je);return ye?xe.add(ve):xe.delete(ve),xe})})}),s.jsx(Nn,{children:Ce(ve)}),s.jsx(Nn,{children:he?s.jsx(ze,{variant:"brand",title:r("这个模型已经在这家的清单里,不重复导入"),children:r("已添加")}):s.jsx(ze,{variant:"outline",title:r("勾上它,导入后即进入这家的清单"),children:r("未添加")})})]},ve)}):fe(A.length?r("没有匹配「{keyword}」的模型",{keyword:$}):r("上游没有返回任何模型"))}function ke(ve){const he=j==="row"&&N===ve.provider;return s.jsx(se,{variant:"outline",size:"sm",className:"w-full",disabled:T,title:r("只刷新这一家的模型清单"),onClick:()=>{ce(ve)},children:he?r("获取中…"):ve.item?r("重新获取"):r("获取")})}function Ee(){return p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:b})):q.length?q.map(ve=>{const he=ve.item;if(!he){const Te=w2(Number(er().wbModelsPanel?.providerRefreshedAt?.(ve.provider))||0);return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider)}),s.jsx(Nn,{children:s.jsx(ze,{variant:"outline",children:r("待获取")})}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te(Te||"—")}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}const ye=FK(he),je=Number(he.count),xe=he.status==="refreshed"?r("远程目录已更新,「来源」列会显示为「远程」"):he.message||(he.fixed?r("这家用固定模型清单,无可刷新"):r("本次没有取到新内容"));return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider,he.accountId)}),s.jsx(Nn,{children:s.jsx(ze,{variant:ye.variant,children:ye.label})}),s.jsx(Nn,{children:te(je?r("{n} 个",{n:je}):"—")}),s.jsx(Nn,{children:s.jsx("span",{className:"text-[11.5px] leading-[1.5] text-muted-foreground",children:xe})}),s.jsx(Nn,{children:te(VK(he))}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}):fe(r("还没有可刷新的提供商:先在账号页添加一个账号"))}return s.jsx(Qt,{open:!0,onOpenChange:(ve,he)=>{if(!ve){if(T){he.cancel();return}t()}},children:s.jsxs(Zt,{className:o?"w-[min(552px,calc(100vw-48px))]":"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("获取模型 — {name}",{name:c})})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:F}),o&&s.jsxs(Ci,{className:"w-[240px] flex-none",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID…"),autoComplete:"off",value:B,onChange:ve=>z(ve.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),s.jsx("div",{className:"mr-auto"}),o&&s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",size:"sm",onClick:ee,children:r("全选未添加")}),s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_(new Set),children:r("清空")})]}),s.jsx(se,{variant:"outline",size:"sm",title:r("刷新全部家(逐家打上游)"),disabled:T,onClick:()=>{ae()},children:r(j==="load"?"获取中…":D?"重新获取":"获取模型")})]}),s.jsxs(Ky,{id:o?x2.custom:x2.intl,className:"table-fixed",containerClassName:"max-h-[min(48vh,460px)]",children:[s.jsx("colgroup",{children:(o?s0:n0).map(ve=>s.jsx("col",{"data-col":ve,className:o?_K[ve]:PK[ve]},ve))}),s.jsx(yE,{children:s.jsx(kl,{children:(o?s0:n0).map(ve=>s.jsx(wE,{"data-col":ve,children:LK[ve]},ve))})}),s.jsx(Yy,{className:"[&_tr:last-child>td]:border-b-0",children:o?de():Ee()})]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:v}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:ge,children:r(o?"取消":"完成")}),o&&s.jsx(se,{variant:"default",disabled:!O.size||T,onClick:()=>{ie()},children:j==="import"?r("导入中…"):O.size?r("导入选中的 {n} 个模型",{n:O.size}):r("导入")})]})]})})}let ip=null,_u=null;function k2(){ip&&(ip.unmount(),ip=null),_u&&(_u.remove(),_u=null)}function KK(e){e?.providerId&&(k2(),_u=document.createElement("div"),document.body.append(_u),ip=vn.createRoot(_u),ip.render(s.jsx(GK,{options:e,onClose:k2})))}window.wbModelsFetchModal={open:KK};const Mo=(e,t)=>t?`${e} ta-${t}`:e;function C2(e,t){const a=(t||"").trim();if(a)return np().find(o=>Oo(o.provider,e)&&Oo(o.id,a))}const YK="[.pv-row:hover_&_[data-slot=nav-item-count]]:invisible";function XK(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));return t?`${t[1]}x`:String(e||"")}function T2(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));if(!t)return null;const a=Number(t[1]);return Number.isFinite(a)?a:null}const QK={workbuddy:250,"workbuddy-intl":295,raccoon:60,catpaw:85,autoclaw:250,"autoclaw-intl":295,qoder:330,"qoder-intl":350,"cline-free":200,"cline-pass":200,codearts:210,loomy:155,kuku:15,accio:320,"accio-intl":335,trae:170,zcode:285};function ZK(e){const t=QK[e];if(t!==void 0)return t;let a=0;for(let o=0;o>>0;return a%360}function WK(e){const t=String(e||"").trim();if(!t)return"?";const a=t.match(/[A-Za-z]/);return(a?a[0]:t[t.length-1]).toUpperCase()}const JK=e=>({"--av-h":String(ZK(e))}),l0=s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"})]})});function eY(e){if(!e)return"";const t=Wt().wbPresetProviders?.list;if(!Array.isArray(t))return"";const a=t.find(o=>o.name===e);return a&&Wt().wbPresetProviders?.iconOf?.(String(a.key||""))||""}function tY(e,t){return es(e)?eY(t):hg[e==="workbuddy-intl"?"workbuddy":e]||""}function Lu(e,t,a){const o=a?"":tY(e,t),c=e==="all"||e==="custom-all";return s.jsx("span",{className:Ue("pv-ico",c&&"mute",o&&"img"),style:o?void 0:JK(e),"aria-hidden":"true",children:o?s.jsx("img",{src:o,alt:""}):a??WK(t)})}const nY={supportsToolCall:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),supportsImages:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),supportsVideo:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M10 8.5l6 3.5-6 3.5z"})]})}),supportsReasoning:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),s.jsx("path",{d:"M9 18h6M10 22h4"})]})})};function sY(e,t,a,o){return o==="enabled"&&!rp(e)||o==="disabled"&&rp(e)||o==="mapped"&&!(e.aliases||[]).length||a!=="all"&&(e.provider||"")!==a?!1:t?[e.id,e.name,...e.aliases||[]].join(" ").toLowerCase().includes(t):!0}function rY(){const e=x.useSyncExternalStore(K9,Jf),t=$g(e),a=es(t)||t==="custom-all",[o,c]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(new Set),b=a&&!Iu()&&$j()&&!Ao(t);x.useEffect(()=>{eK(),qg(),QM(),Wt().wbApp?.currentPage==="gateway"&&n2().then(()=>Wt().wbProviders?.refreshCustom?.()).then(()=>{qi()})},[]),x.useEffect(()=>{gK()});const y=Gj(),v=Array.isArray(y.models)?y.models:[],w=e.search.trim().toLowerCase(),j=v.filter(G=>sY(G,w,t,e.stateFilter)),S=e.sort,N=t2(),k=N.length,T=t==="all"?r("全部"):t==="custom-all"?r("自定义 · 全部"):a?String(Ao(t)?.name||t):Kj().get(t)?.label||Jj(t),D=v.filter(rp).length,C=v.filter(G=>(G.aliases||[]).length>0).length,A=ig(j.length,"models"),R=v.filter(G=>p.has(Ki(G))),I=(G,W)=>{const le=new Set(p);W?le.add(G):le.delete(G),h(le)},P=j.map(Ki),O=P.length>0&&P.every(G=>p.has(G)),_=P.some(G=>p.has(G)),L=s.jsx(Mr,{checked:O,indeterminate:!O&&_,disabled:!P.length,"aria-label":r("全选当前筛选结果"),title:r("全选当前筛选出的模型(跨分页);再点取消"),onCheckedChange:G=>{const W=new Set(p);for(const le of P)G===!0?W.add(le):W.delete(le);h(W)}});function H(){const G=Kj(),W=Fi(),le=Q9(),M=[...G.values()].reduce((ce,J)=>ce+J.n,0),U=r("全部({n} 家)",{n:G.size}),Z=[...le.values()].reduce((ce,J)=>ce+J.n,0),ae=r("全部({n} 家)",{n:[...le.values()].filter(ce=>ce.n>0).length});return s.jsxs("aside",{className:"prov-rail",id:"prov-rail","aria-label":r("按提供商选择"),children:[s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("内置提供商")}),s.jsx(ru,{active:t==="all","data-provider":"all",title:U,count:M,icon:Lu("all","",l0),className:"shadow-none",onClick:()=>ap("all"),children:U}),[...G].map(([ce,J])=>s.jsx(ru,{active:t===ce,"data-provider":ce,title:J.label,count:J.n,icon:Lu(ce,J.label),className:"shadow-none",onClick:()=>ap(ce),children:J.label},ce)),s.jsx("div",{className:"rail-label",children:r("自定义提供商")}),W.length?[...Z>0?[s.jsx(ru,{active:Iu(),"data-provider":"custom-all",title:ae,count:Z,icon:Lu("custom-all","",l0),className:"shadow-none",onClick:()=>ap("custom-all"),children:ae},"custom-all")]:[],...W.map(ce=>{const J=String(ce.id||""),ie=String(ce.name||J);return s.jsxs("div",{className:"pv-row",children:[s.jsx(ru,{active:t===J,"data-provider":J,title:ie,count:le.get(J)?.n??0,icon:Lu(J,ie),className:Ue("shadow-none",YK),onClick:()=>ap(J),children:ie}),s.jsx("button",{type:"button",className:"pv-del","aria-label":r("删除自定义提供商"),title:r("删除这个自定义提供商(连同名下账号)"),onClick:()=>{cK(J)},children:"×"})]},J)})]:s.jsx("div",{className:"rail-empty",children:r("还没有自定义提供商")})]}),s.jsx("div",{className:"rail-foot",children:s.jsx(ru,{variant:"add",id:"rail-add-custom",title:r("新建一个自定义提供商(同时创建它的第一个账号)"),onClick:()=>uK(),children:r("+ 新建自定义提供商")})})]})}function B(G,W,le,M){const U=e0(G,W,le);return s.jsx(se,{variant:U?"secondary":"dashed",size:"2xs",disabled:M,className:"font-mono font-bold shadow-none",title:U?r("思考等级 {level}(点击修改)",{level:U}):r("设置思考等级(当前未绑定)"),onClick:()=>r2({alias:G,target:W,provider:le}),children:U||r("+等级")})}function z(G){const W=G.provider||"",le=Pu(G),[M,...U]=le;async function Z(ce){await Wt().wbConfirm?.ask?.({title:r("删除映射"),html:r("确定删除映射「{alias} → {target}」?",{alias:zj(ce),target:zj(G.id)}),okText:r("删除"),okClass:"danger"})&&Zj(Wj(ce,G.id,W),()=>tK(W,ce,G.id),r("映射已删除"))}const ae=ce=>{const J=ce.alias,ie=ce.enabled!==!1,ge=e.pending.has(Wj(J,G.id,W));return s.jsxs("span",{className:Ue("alias",!ie&&"map-off"),children:[s.jsx(hs,{size:"sm",checked:ie,disabled:ge,title:r(ie?"映射已启用,点击关闭":"映射已关闭,点击启用"),"aria-label":r("{action}映射 {alias}",{action:r(ie?"关闭":"启用"),alias:J}),onCheckedChange:ee=>{Zj(Wj(J,G.id,W),()=>Yg(W,J,G.id,{enabled:ee}),r(ee?"映射已启用":"映射已关闭"))}}),s.jsx("span",{className:"t","data-copy":J,title:r("点击复制:{name}",{name:J}),children:J}),ce.isDefault?s.jsx("span",{className:"binding-default",children:r("默认")}):null,B(J,G.id,W,ge),ce.isDefault?null:s.jsx(se,{variant:"ghost",size:"icon-2xs",className:"text-[12px] leading-none",disabled:ge,title:r("删除映射 {alias}",{alias:J}),onClick:()=>{Z(J)},children:"×"})]},`${J}${ce.isDefault?"d":"m"}`)};return s.jsxs("div",{className:"aliases",children:[s.jsxs("div",{className:"alias-row",children:[M?ae(M):null,s.jsx(se,{variant:"dashed",size:"xs",onClick:()=>r2({target:G.id,provider:W}),children:r("+ 映射")})]}),U.map(ae)]})}function Q(G){if(G.source==="manual")return s.jsxs("span",{className:"src manual",title:r("手动登记的上游模型;移除它会直接删掉这条登记"),children:[s.jsx("i",{"aria-hidden":"true"}),r("手动")]});if(!G.source&&es(G.provider))return s.jsxs("span",{className:"src manual",title:r("用户登记的自定义模型;整份清单只属于这一家"),children:[s.jsx("i",{"aria-hidden":"true"}),r("自定义")]});if(G.source!=="remote"&&G.source!=="builtin")return s.jsx("span",{className:"rate",children:"—"});const W=G.source==="remote",le=V9(Number(G.refreshedAt)||0),M=W?le?r("来自上游目录接口,清单拉取于 {at};刷新失败时保留上一份成功结果",{at:le}):r("来自上游目录接口;刷新失败时保留上一份成功结果"):r("上游目录尚未拉到,用的是内置静态清单;点「刷新模型清单」可重试");return s.jsxs("span",{className:Ue("src",W?"remote":"builtin"),title:M,children:[s.jsx("i",{"aria-hidden":"true"}),r(W?"远程":"内置")]})}function K(G){const W=_j(G),le=Pj(G.capOverrides),M=typeof W.maxInputTokens=="number"?W.maxInputTokens:null,U=typeof W.maxOutputTokens=="number"?W.maxOutputTokens:null,Z=r("上下文窗口 {input} / 最大输出 Token {output} —— 点击修改模型能力",{input:Xf(M),output:Xf(U)})+X(G);return s.jsxs("button",{type:"button",className:"caps-open",title:Z,onClick:()=>a2(G.provider||"",G.id),children:[s.jsxs("span",{className:Ue("cap-num",M===null&&"unset",Mu(G,"maxInputTokens")==="modelsdev"&&"filled"),children:[OM(M),le.includes("maxInputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]}),s.jsx("span",{className:"cap-sep",children:"/"}),s.jsxs("span",{className:Ue("cap-num",U===null&&"unset",Mu(G,"maxOutputTokens")==="modelsdev"&&"filled"),children:[OM(U),le.includes("maxOutputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]})]})}function X(G){const W=["maxInputTokens","maxOutputTokens"].filter(le=>Mu(G,le)==="modelsdev").map(le=>Ou[le]);return W.length?r(";其中 {keys} 由 models.dev 补齐",{keys:W.join(r("、"))}):""}function q(G){const W=_j(G),le=Pj(G.capOverrides);return s.jsx("button",{type:"button",className:"caps-open caps-badges",title:r("对下游声明的能力(工具调用 / 图片识别 / 视频识别 / 支持思考)—— 点击修改"),onClick:()=>a2(G.provider||"",G.id),children:AM.map(M=>{const U=W[M]??null,Z=Lj(U),ae=le.includes(M),ce=Mu(G,M);return s.jsxs("span",{className:Ue("cap-dot",Z,ce==="modelsdev"&&"filled",ae&&"marked"),title:D9(M,U,ae,ce),children:[nY[M],ae?s.jsx("i",{className:"cap-mark"}):null]},M)})})}function $(G,W,le){async function M(){await Wt().wbConfirm?.ask?.({title:r("移除自定义模型"),html:r("确定移除自定义模型「{id}」?这条登记会被直接移除,之后 /v1/models 不再广告它、请求它也会被拒。",{id:zj(W.id)}),okText:r("移除"),okClass:"danger"})&&Zj(Ki(W),()=>s2(W.provider||"",W.id),es(W.provider||"")?r("模型已移除"):r("自定义模型已移除"))}switch(G.key){case"check":return s.jsx("td",{className:Mo("cell-check",G.align),children:s.jsx(Mr,{checked:p.has(Ki(W)),title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:U=>I(Ki(W),U===!0)})});case"model":return s.jsxs("td",{className:Mo("cell-model",G.align),children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t","data-copy":W.id,title:r("点击复制:{name}",{name:W.id}),children:W.id})}),W.name&&W.name!==W.id?s.jsx("div",{className:"mname",children:W.name}):null]});case"rate":return s.jsx("td",{className:Mo("cell-rate",G.align),children:s.jsx("span",{className:"rate",children:W.credits?XK(W.credits):"—"})});case"source":return s.jsx("td",{className:Mo("cell-source",G.align),children:Q(W)});case"budget":return s.jsx("td",{className:Mo("cell-budget",G.align),children:K(W)});case"caps":return s.jsx("td",{className:Mo("cell-caps",G.align),children:q(W)});case"alias":return s.jsx("td",{className:Mo("cell-alias",G.align),children:z(W)});case"act":{const U=AK(W.provider||""),Z=W.source==="manual"||es(W.provider||"");return s.jsx("td",{className:Mo("cell-act r",G.align),children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{variant:"ghost",size:"sm",disabled:!!U,title:U||r("以这个上游模型发一次最小请求,走真实转发链路"),onClick:()=>c({provider:W.provider||"",id:W.id}),children:r("测试")}),Z?s.jsx(se,{variant:"ghost",size:"sm",className:"text-destructive",disabled:le,onClick:()=>{M()},children:r("移除")}):null]})})}default:return null}}function Y(G){const W=e.pending.has(Ki(G)),le=p.has(Ki(G));return s.jsx("tr",{className:Ue(le&&"sel"),children:N.map(M=>s.jsx(x.Fragment,{children:$(M,G,W)},M.key))},`${G.provider||""}${G.id}`)}function F(){if(!v.length){const Z=a?$j()?Iu()?r("自定义提供商还没有模型:先在左栏选一家,点「添加模型」登记,或「获取上游模型」从上游拉取"):r(b?"该提供商已不存在(可能已被删除),请刷新列表":"这家还没有模型:点「添加模型」登记,或「获取上游模型」从上游拉取"):r("加载中…"):e.data?r("暂无模型(请先添加账号)"):r("加载中…");return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:Z})})}if(!j.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:k,className:"empty",children:w?r("没有匹配「{keyword}」的模型",{keyword:w}):r("没有匹配当前筛选的模型")})});const G=t==="all"||Iu(),W=G&&!w&&e.stateFilter==="all"&&!A.paged,le=new Map;for(const Z of j){const ae=Z.provider||"";le.has(ae)||le.set(ae,{label:Z.providerLabel||ae||r("未知"),items:[]}),le.get(ae)?.items.push(Z)}const M=[];let U=0;for(const[Z,ae]of le){ae.items.sort((te,Ce)=>{const re=+!rp(te)-+!rp(Ce);if(re!==0||S==="default")return re;const de=T2(te.credits),ke=T2(Ce.credits);return de===null||ke===null?de===ke?0:de===null?1:-1:S==="rate-asc"?de-ke:ke-de});const ce=e.expanded.has(Z)||!W,J=ce?ae.items:ae.items.slice(0,$M),ie=ae.items.length-J.length,ge=A.paged?Math.max(0,A.rangeStart-1-U):0,ee=A.paged?Math.min(J.length,A.rangeEnd-U):J.length,fe=ge0?r("(续)"):"",r("{n} 个模型",{n:ae.items.length})]})},`group:${Z}`));for(const te of fe)M.push(Y(te));U+=J.length,ie>0?M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>rK(Z),children:r("展开其余 {n} 个模型 ▾",{n:ie})})})},`more:${Z}`)):ce&&W&&ae.items.length>$M&&M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:k,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>aK(Z),children:r("收起 ▴")})})},`collapse:${Z}`))}return M}return s.jsxs(s.Fragment,{children:[s.jsx("section",{className:"panel",children:s.jsxs("div",{className:"mm",children:[H(),s.jsxs("div",{className:"mm-main",children:[s.jsxs("div",{className:"panel-head",children:[s.jsxs("div",{className:"mm-titlebar",children:[s.jsxs("div",{className:"mm-title",children:[t==="all"||t==="custom-all"?Lu(t,"",l0):Lu(t,T),s.jsx("h2",{children:T}),s.jsxs("span",{className:"mm-meta",children:[s.jsx("b",{children:v.length}),r(" 个模型 · 已启用 "),s.jsx("b",{children:D}),r(" · 有映射 "),s.jsx("b",{children:C})]})]}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-refresh-models",title:es(t)?r("从这一家的上游拉一份模型清单,勾选要哪些再导入(已添加的不会重复导入)"):r("刷新模型管理页里各提供商的远程模型目录,逐家结果列在弹窗里"),onClick:()=>o2(),children:r("获取模型")}),s.jsx(se,{id:"btn-add-custom-model",variant:"outline",size:"sm",onClick:()=>fK(),children:r("+ 添加模型")})]})]}),s.jsxs("div",{className:"mm-filters",children:[s.jsx(In,{options:$9,value:e.stateFilter,onValueChange:lK,"aria-label":r("按状态筛选"),className:"shrink-0"}),s.jsx(In,{options:G9,value:e.sort,onValueChange:oK,"aria-label":r("按倍率排序"),className:"shrink-0"}),s.jsxs(Ci,{className:"w-full min-[768px]:w-[240px] flex-none min-[768px]:flex-none",id:"models-search",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID / 名称 / 映射名…"),"aria-label":r("搜索模型"),autoComplete:"off",value:e.search,onChange:G=>iK(G.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),R.length>0?s.jsxs("span",{className:"batch-chip",children:[r("已选 "),s.jsx("b",{children:R.length}),r(" 个"),s.jsx(se,{id:"btn-batch-models",variant:"outline",size:"xs",title:r("对选中的 {n} 个模型执行批量操作",{n:R.length}),onClick:()=>f(!0),children:r("批量操作")})]}):null]})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",ref:G=>hK(G),children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"c-check","data-col":"check"}),s.jsx("col",{className:"c-model","data-col":"model"}),s.jsx("col",{className:"c-rate","data-col":"rate"}),s.jsx("col",{className:"c-source","data-col":"source"}),s.jsx("col",{className:"c-budget","data-col":"budget"}),s.jsx("col",{className:"c-caps","data-col":"caps"}),s.jsx("col",{className:"c-alias","data-col":"alias"}),s.jsx("col",{className:"c-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"check",children:L}),s.jsx("th",{"data-col":"model",children:r("上游模型")}),s.jsx("th",{"data-col":"rate",children:r("倍率")}),s.jsx("th",{"data-col":"source",children:r("来源")}),s.jsxs("th",{"data-col":"budget",children:[r("上下文 / 输出"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("数字带虚线底 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;— = 未声明。点任意一格可改。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"caps",children:[r("能力"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("圆点带内侧描边 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;虚线圈 = 未声明。悬停某一枚可看逐项出处。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"alias",children:[r("模型映射"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("每条映射 = 对外名 → 上游模型;原始 ID 与别名有独立开关,默认绑定永远存在(没有映射时是合成的那条)。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{id:"models",children:F()})]})}),s.jsx(Li,{className:"models-panel-foot",leading:Iu()?s.jsxs(s.Fragment,{children:[r("这里是"),s.jsx("b",{children:r("全部自定义提供商")}),r("的模型合集:每家的清单互相独立,别名也只在自己那家内生效;要改名称 / 协议 / Base URL,到账号页该家账号的「设置」→ 提供商一栏。")]}):a?s.jsxs(s.Fragment,{children:[r("自定义提供商的清单"),s.jsx("b",{children:r("只属于这一家")}),r(":这里的模型不会出现在其他家,别名也只在这一家内生效。改名称 / 协议 / Base URL 在账号页该家账号的「设置」→ 提供商一栏;整家不要了,鼠标移到左栏这家上点 × 删除(连同名下账号)。")]}):void 0,total:j.length,range:A.paged?{start:A.rangeStart,end:A.rangeEnd}:null,page:A.page,pageCount:A.pageCount,size:A.size,onSizeChange:A.setSize,onPageChange:A.goto})]})]})}),e.mapping?s.jsx(lY,{context:e.mapping,onClose:dK}):null,e.customModel?s.jsx(oY,{initial:e.customModel,onClose:pK}):null,e.capability?s.jsx(wK,{context:e.capability,onClose:mK}):null,o?s.jsx(MK,{target:o,onClose:()=>c(null)}):null,d?s.jsx(IK,{models:R,onClose:()=>f(!1),onDone:()=>{h(new Set),f(!1)}}):null]})}const aY=r("绑定在「对外名 → 上游模型」这一条映射上的思考等级(列表照抄 OmniProxy 的手动绑定),选「不覆盖」表示不给这条映射指定等级。它会跟着这条映射注入转发,由承载的那家翻译成自己的档位字段(CatPaw 归并成 low/high/max,Qoder 按模型声明的档位归一)。以下几种情况故意不注入:① off / none(关闭思考)—— 本项目没有安全的表达方式;② 表外的自定义等级(各家能力范围不同,无法判断上游收不收);③ 客户端请求体里已经自己指定了档位(那是更明确的意图,绑定不覆盖);④ 这家上游不认识档位字段(如 WorkBuddy / 小浣熊 / AutoClaw / Cline)。注入与跳过都会写进详细日志。");function E2(e,t,a){const o=e2(e),c=(t||"").trim(),d=o.find(f=>f.id.toLowerCase()===c.toLowerCase());return d?d.id:c||o[0]?.id||""}function lY({context:e,onClose:t}){const a=!!e.alias,[o,c]=x.useState(()=>e.provider||Yj()[0]?.id||""),[d,f]=x.useState(e.alias||""),[p,h]=x.useState(()=>E2(o,e.target)),[b,y]=x.useState(""),[v,w]=x.useState(!1),[j,S]=x.useState(()=>{const _=Zf(Jf().data,C2(o,p)),L=a?e0(e.alias,e.target,e.provider):"";return L&&_.includes(L)?{select:L,custom:""}:{select:L?ca:"",custom:L}}),N=Zf(Jf().data,C2(o,p)),k=(()=>{const _=Yj();for(const L of[e.provider,o])L&&!_.some(H=>H.id===L)&&_.push({id:L,label:Wt().wbProviders?.labelOf?.(L)||L});return _})(),T=(()=>{const _=e2(o),L=(p||"").trim();return L&&!_.some(H=>H.id.toLowerCase()===L.toLowerCase())&&_.unshift({id:L,label:r("{name}(不在该家当前清单里)",{name:L}),off:!0}),_})(),D=k.find(_=>_.id===o)?.label||o||r("(全局)"),C=j.select&&j.select!==ca&&!N.includes(j.select)?{select:ca,custom:j.custom||j.select}:j,A=C.select===ca?C.custom.trim():C.select,R=C.select===ca;function I(_){c(_),h(E2(_,p))}async function P(){if(v)return;const _=a?e.alias||"":d.trim(),L=p;if(!_){y(r("请填写对外映射名"));return}if(!L){y(r("该提供商当前没有可选的上游模型"));return}if(!o){y(r("请选择提供商"));return}if(!a&&Oo(_,L)&&np().some(H=>Oo(H.id,L)&&Oo(H.provider,o))){y(r("原始 ID 已作为默认绑定,请直接使用该绑定的开关或等级按钮"));return}w(!0),y(r("保存中…"));try{Gi(await Yg(o,_,L,{reasoning:A})),w(!1),t();const H=A?r(" · 思考等级 {level}",{level:A}):"",B=Wt().wbProviders?.labelOf?.(o)||o;wr(a?r("✅ 已更新 {name} 的思考等级",{name:_}):r("✅ 已添加映射 {name} → {target}({label}){suffix}",{name:_,target:L,label:B,suffix:H}))}catch(H){y(r("保存失败:{message}",{message:Ro(H)})),w(!1)}}const O=_=>{_.key==="Enter"&&(_.preventDefault(),P())};return s.jsx(Qt,{open:!0,onOpenChange:(_,L)=>{if(!_){if(v){L.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"设置思考等级":"添加模型映射")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-provider",children:r("提供商")}),s.jsxs(ft,{value:o,disabled:!0,onValueChange:_=>I(String(_)),children:[s.jsx(mt,{id:"mapping-provider",className:"w-full",children:s.jsx(pt,{children:k.find(_=>_.id===o)?.label||o})}),s.jsx(ht,{children:k.map(_=>s.jsx(qe,{value:_.id,children:_.label},_.id))})]})]}),s.jsxs("div",{className:"grid grid-cols-[1fr_24px_1fr] items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-alias",children:r("对外映射名(下游请求时用)")}),s.jsx($e,{id:"mapping-alias",maxLength:128,placeholder:r("例如 gpt-4o"),autoComplete:"off",autoFocus:!a,value:d,disabled:a,onChange:_=>f(_.currentTarget.value),onKeyDown:O})]}),s.jsx("div",{className:"pb-2 text-center text-muted-foreground",children:"→"}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-upstream",children:r("转发到上游模型")}),s.jsxs(ft,{value:p,disabled:!0,onValueChange:_=>h(String(_)),children:[s.jsx(mt,{id:"mapping-upstream",className:"w-full",children:s.jsx(pt,{children:T.find(_=>_.id===p)?.label||p})}),s.jsx(ht,{children:T.map(_=>s.jsxs(qe,{value:_.id,children:[_.label,_.off?r("(已禁用)"):""]},_.id))})]})]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("下游请求 "),s.jsx("b",{className:"text-primary-fg",children:d.trim()||r("<对外名>")}),r(" → 转发")," ",s.jsx("b",{className:"text-primary-fg",children:p||r("<上游模型>")}),r("({label})",{label:D}),A?s.jsxs(s.Fragment,{children:[r(" · 思考等级 "),s.jsx("b",{className:"text-primary-fg",children:A})]}):null]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:"mapping-reasoning",children:r("思考等级")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("思考等级的注入规则")}),children:"?"}),s.jsx(_i,{children:aY})]})]}),s.jsxs(ft,{value:C.select,onValueChange:_=>{const L=String(_);S(H=>({...H,select:L}))},children:[s.jsx(mt,{id:"mapping-reasoning",className:"w-full",autoFocus:a,children:s.jsx(pt,{children:C.select===ca?r("自定义等级…"):C.select||r("不覆盖")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("不覆盖")}),N.map(_=>s.jsx(qe,{value:_,children:_},_)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]}),R?s.jsx($e,{id:"mapping-reasoning-custom",maxLength:32,autoFocus:!0,placeholder:r("自定义等级(例如 custom-high)"),autoComplete:"off",disabled:v,value:C.custom,onChange:_=>S(L=>({...L,custom:_.currentTarget.value})),onKeyDown:O}):null]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("对外名可自由命名,允许与上游模型 ID 同名(同名时该上游的原生路由优先,映射作兜底); 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。同一对外名可在多个提供商各添加一条: 下游用同一个名字请求,网关按账号优先级主备切换,失败自动落到下一个提供商。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v,onClick:()=>{P()},children:r(a?"保存等级":"保存映射")})]})]})})}function oY({initial:e,onClose:t}){const[a,o]=x.useState(e.provider),[c,d]=x.useState(""),[f,p]=x.useState(""),[h,b]=x.useState(!1),y=(()=>{const N=J9();return a&&!N.some(k=>k.id===a)&&N.push({id:a,label:Wt().wbProviders?.labelOf?.(a)||a}),N})(),v=y.some(N=>N.id===a)?a:y[0]?.id||"",w=y.find(N=>N.id===v)?.label||v||r("(未选)");async function j(){if(h)return;const N=c.trim();if(!v){p(r("请选择提供商"));return}if(!N){p(r("请填写上游模型 ID"));return}b(!0),p(r("保存中…"));try{const k=await nK(v,N);Gi(k),b(!1),t();const T=y.find(D=>D.id===v)?.label||v;if(es(Du()))wr(r("✅ 已登记模型 {name}({label})",{name:N,label:T}));else{const D=k;Array.isArray(D?.models)&&D.models.some(A=>A.id===N&&(A.provider||"")===v)?wr(r("✅ 已登记自定义模型 {name}({label})",{name:N,label:T})):wr(r("✅ 已登记 {name}({label}),但该提供商还没有可用账号,这一行要加上账号后才会显示",{name:N,label:T}),"err")}}catch(k){p(r("保存失败:{message}",{message:Ro(k)})),b(!1)}}const S=N=>{N.key==="Enter"&&(N.preventDefault(),j())};return s.jsx(Qt,{open:!0,onOpenChange:(N,k)=>{if(!N){if(h){k.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加自定义模型")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-provider",children:r("提供商")}),s.jsxs(ft,{value:v,disabled:e.locked,onValueChange:N=>o(String(N)),children:[s.jsx(mt,{id:"custom-model-provider",className:"w-full",children:s.jsx(pt,{children:w})}),s.jsx(ht,{children:y.map(N=>s.jsx(qe,{value:N.id,children:N.label},N.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-id",children:r("上游模型 ID")}),s.jsx($e,{id:"custom-model-id",maxLength:128,placeholder:r("例如 gpt-5.5-preview"),autoComplete:"off",spellCheck:!1,autoFocus:!0,value:c,onChange:N=>d(N.currentTarget.value),onKeyDown:S})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("在 "),s.jsx("b",{className:"text-primary-fg",children:w}),r(" 上登记上游模型")," ",s.jsx("b",{className:"text-primary-fg",children:c.trim()||r("<上游模型 ID>")}),r("(登记后即可用这个名字请求)")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("填上游真正认识的那个模型 ID(不是给下游用的名字)。登记后它会进入该家的模型清单: 表格里出现这一行、"),s.jsx("code",{children:"/v1/models"}),r(" 会广告它、请求它也会被转发到这家。 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("「来源」列会标成"),s.jsx("b",{children:r("手动")}),r(",与远程目录 / 内置清单区分开。删除自定义模型是"),s.jsx("b",{children:r("直接移除")}),r("这条登记(不像内置模型那样只是隐藏),因为它的存在完全由这次登记决定。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:f})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:h,onClick:()=>{j()},children:r("保存")})]})]})})}const A2='.page[data-page="gateway"]';let o0=null;function R2(){if(o0)return;const e=document.querySelector(A2);e&&(e.replaceChildren(),o0=vn.createRoot(e),o0.render(s.jsx(rY,{})))}document.querySelector(A2)?R2():document.addEventListener("DOMContentLoaded",R2,{once:!0});const O2=3065;function iY(){if(el().workbuddyDesktop?.platform!=="web")return null;const e=typeof window>"u"?"":window.location?.origin;return e&&e!=="null"?e:null}function M2(e,t){return iY()??(e?`http://127.0.0.1:${e}`:t)}function el(){return window}function Xg(e){return e instanceof Error?e.message:String(e)}function zu(e,t){el().wbApp?.toast?.(e,t)}let cp={backend:null,gatewayBase:M2(0,`http://127.0.0.1:${O2}`)};const i0=new Set;function c0(){return cp}function cY(e){return i0.add(e),()=>{i0.delete(e)}}function uY(e){cp=e;for(const t of i0)t()}function D2(){return cp.gatewayBase.replace(/^https?:\/\//,"")}function dY(){return cp.backend?.ready===!0}function I2(e){const t=(a,o)=>{const c=document.getElementById(a);c&&(c.textContent=o)};t("api-base",`${e}/v1`),t("api-chat",`POST ${e}/v1/chat/completions`),t("api-responses",`POST ${e}/v1/responses`),t("api-messages",`POST ${e}/v1/messages`),t("api-models",`GET ${e}/v1/models`)}let u0=!1;async function Bu(){if(!u0){u0=!0;try{const e=el().workbuddyDesktop;if(!e)throw new Error("后端桥不可用");const t=await e.getBackendStatus(),a=Number(t?.port)||0,o=c0(),c={backend:t??null,gatewayBase:M2(a,o.gatewayBase)};c.gatewayBase!==o.gatewayBase&&I2(c.gatewayBase),uY(c),el().wbApp?.renderTopbarStatus?.()}catch(e){console.warn("读取后端状态失败:",Xg(e))}finally{u0=!1}}}function fY(){I2(cp.gatewayBase),Bu()}async function P2(e){zu(e||r("正在重启…"));try{await el().workbuddyDesktop?.restartApp()}catch(t){zu(r("重启失败:{reason}",{reason:Xg(t)}),"err")}}const pY={idle:r("结束占用进程"),querying:r("查询中…"),ending:r("结束中…")};function mY({container:e}){const{backend:t,gatewayBase:a}=x.useSyncExternalStore(cY,c0),[o,c]=x.useState("idle"),d=t?.failure||null,f=D2(),p=t?.ready;let h="live off",b=r("正在检查… · {port}",{port:f});p===!0?(h="live pulse",b=r("网关运行中 · {port}",{port:f})):d?(h="live bad",b=r("{label} · {port}",{label:d.label||r("网关启动失败"),port:f})):p===!1&&(b=r("网关启动中… · {port}",{port:f}));const y=d?d.message??"":p===!0?r("本地网关正在监听 {url},可直接调用 OpenAI 兼容接口",{url:a}):r("正在确认网关是否已就绪");x.useEffect(()=>{Bu()},[]),x.useEffect(()=>{const w=el().workbuddyDesktop?.onBackendError?.(()=>{Bu()});return typeof w=="function"?w:void 0},[]),x.useEffect(()=>{e.title=y},[e,y]);async function v(){if(o!=="idle")return;const w=el().workbuddyDesktop;if(w){c("querying");try{const j=await w.getPortOccupant(),S=j?.occupant;if(!S){zu(r("端口 {port} 上没有查到监听进程,请改用「更换端口」",{port:j?.port??""}),"err");return}const N=[r("即将结束以下进程:"),"",r("进程名:{name}",{name:String(S.name)}),r("PID:{pid}",{pid:String(S.pid)}),r("路径:{path}",{path:S.path||r("(未知)")}),"",r("结束它会强制退出该程序未保存的数据。确认继续?")],k=el().wbConfirm?.ask;if(!k||!await k({title:r("结束占用端口的进程"),text:N.join(` -`),okText:r("结束进程"),okClass:"danger"}))return;c("ending"),(await w.endPortOccupant())?.released?(zu(r("已结束进程 {name}(PID {pid}),端口已释放",{name:String(S.name),pid:String(S.pid)})),await k({title:r("重启程序"),text:r("端口已释放。现在重启程序让网关用这个端口启动?"),okText:r("重启")})?await P2(r("重启中…")):await Bu()):(zu(r("进程已结束,但端口仍被占用,建议改用「更换端口」"),"err"),await Bu())}catch(j){zu(r("结束失败:{reason}",{reason:Xg(j)}),"err")}finally{c("idle")}}}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-line",children:[s.jsx("span",{className:h}),s.jsx("span",{className:"txt",children:b})]}),d?.conflict?s.jsxs("div",{className:"status-actions",children:[d.canEndOccupant===!0?s.jsx(se,{size:"sm",disabled:o!=="idle",onClick:()=>{v()},children:pY[o]}):null,s.jsx(se,{size:"sm",onClick:()=>{xY()},children:r("更换端口")})]}):null]})}let d0=null;function _2(){if(d0)return;const e=document.getElementById("sidebar-status");e&&(e.replaceChildren(),d0=vn.createRoot(e),d0.render(s.jsx(mY,{container:e})))}const hY={idle:r("保存并重启"),checking:r("校验中…"),saving:r("保存中…")};function gY({status:e,onClose:t}){const a=Number(e?.port)||O2,[o,c]=x.useState(()=>a<65535?String(a+1):String(a-1)),[d,f]=x.useState("idle"),[p,h]=x.useState(""),[b,y]=x.useState(""),v=x.useRef(!0),w=Number(o)||0,j=e?.failure?.message||r("当前端口 {port},网关运行正常。",{port:a});async function S(){if(d!=="idle")return;const N=el().workbuddyDesktop;if(!N)return;const k=Number(o)||0;if(!k||k<1024||k>65535){y(r("端口需在 1024-65535 之间"));return}f("checking"),y(""),h("");try{const T=await N.checkPort(k);if(!T?.ok){h(T?.message||r("该端口不可用"));return}if(T.same){h(T.message??"");return}if(f("saving"),(await N.changePort(k))?.changed===!1){h(r("与当前端口相同,无需重启"));return}t(),await P2(r("端口已改为 {port},正在重启…",{port:k}))}catch(T){y(Xg(T))}finally{f("idle")}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更换网关端口")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("当前状态")}),s.jsx("p",{children:j})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("新端口")}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"port-input",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("端口号")}),s.jsx($e,{id:"port-input",type:"number",min:1024,max:65535,step:1,placeholder:r("例如 3066"),autoComplete:"off",className:"max-w-[130px]",value:o,onChange:N=>{c(N.currentTarget.value)},onKeyDown:N=>{N.key==="Enter"&&S()},autoFocus:!0,onFocus:N=>{v.current&&(v.current=!1,N.currentTarget.select())}})]}),p?s.jsx("p",{children:p}):null,s.jsx("p",{children:r("端口需在 1024-65535 之间。1023 及以下是系统保留范围,普通程序无法监听。")})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("换端口后要改的地方")}),s.jsxs("p",{children:[r("网关地址会变成 "),s.jsx("code",{children:`http://127.0.0.1:${w||"—"}`}),r("。已经把这个地址填进其它工具(Claude Code、Cherry Studio 等)的,需要一并改成新地址,否则那些工具会连不上。")]})]}),s.jsx("p",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:d!=="idle",onClick:()=>{S()},children:hY[d]})]})]})})}let up=null,Hu=null;function L2(){up&&(up.unmount(),up=null),Hu&&(Hu.remove(),Hu=null)}async function xY(){let e=c0().backend;e||(e=await el().workbuddyDesktop?.getBackendStatus().catch(()=>null)??null),L2(),Hu=document.createElement("div"),document.body.append(Hu),up=vn.createRoot(Hu),up.render(s.jsx(gY,{status:e,onClose:L2}))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",_2,{once:!0}):_2(),window.wbPortPanel={render:fY,sync:Bu,portLabel:D2,isReady:dY};function bY(e){return e.source==="subscription"&&(e.port===null||e.port===void 0)}function tr(){return window}function Fn(e,t){tr().wbApp?.toast?.(e,t)}function Ra(e){return e instanceof Error?e.message:String(e)}function z2(e){return tr().wbApp?.formatTime?.(e)||""}function f0(e){const t=Number(e);return!Number.isFinite(t)||t<0?"":t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}function p0(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]||t)}function Uu(e){return String(e?.name||e?.id||"")}function B2(e){return e.source==="clash"}function dp(e){return e.source==="subscription"}function Qg(e){return B2(e)||dp(e)}function vY(e){return e.localDisabled===!0||e.enabled===!1}function H2(e){return Qg(e)&&e.enabled===!1&&e.localDisabled!==!0}function yY(e){return dp(e)&&vY(e)}function Zg(e){return dp(e)&&e.orphan===!0}function U2(e){return!Qg(e)||Zg(e)}const wY=r("来自 Clash Verge 同步(名称、端口跟随 Clash),请到 Clash Verge 中修改;启用可在本页关闭"),jY=r("该节点来自订阅(名称、端口跟随订阅与内核),请在「订阅管理」里修改;启用可在本页关闭"),V2=r("该节点所属订阅已删除,不会再被同步更新,可手动删除清理");function F2(e){return Zg(e)?V2:dp(e)?jY:wY}const SY=r("禁用后本端不再用它(引用它的账号回退直连);端口在 Clash Verge 侧,不受影响"),NY=r("禁用后本端不再用它(引用它的账号回退直连),并会关掉它的本地监听端口"),kY=r("已在本页禁用(打开开关即恢复)"),CY=r("这条在 Clash Verge 里是停用的,本页启用不生效 —— 到 Clash Verge 里打开它");function TY(e){if(Zg(e))return V2;if(e.localDisabled===!0)return kY;if(H2(e))return CY;if(dp(e))return NY;if(B2(e))return SY}let xs={data:null,loading:!1,error:"",testing:null,pending:new Set,syncing:!1,batchBusy:!1,batchProgress:null,selected:new Set};const m0=new Set;function EY(e){return m0.add(e),()=>{m0.delete(e)}}function AY(){return xs}function ns(e){xs={...xs,...e},m0.forEach(t=>t())}function Wg(){return xs.data?.items??[]}function RY(e){return xs.selected.has(e)}function OY(e,t){const a=new Set(xs.selected);t?a.add(e):a.delete(e),ns({selected:a})}function MY(e,t){const a=new Set(xs.selected);for(const o of e)t?a.add(o):a.delete(o);ns({selected:a})}function DY(){ns({selected:new Set})}function Do(e){if(!e||typeof e!="object"||!Array.isArray(e.items))return;const t=new Set(e.items.map(o=>o.id)),a=new Set([...xs.selected].filter(o=>t.has(o)));ns({data:e,error:"",selected:a})}async function fp(e=!1){const t=tr().workbuddyDesktop;if(typeof t?.getProxyPool!="function"){ns({error:r("当前环境不支持代理池(桥接方法缺失)")});return}e||ns({loading:!0});try{Do(await t.getProxyPool())}catch(a){ns({error:Ra(a)}),e||Fn(r("代理列表加载失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({loading:!1})}}async function IY(){const e=tr().workbuddyDesktop;if(typeof e?.syncClashToProxyPool!="function"){Fn(r("当前环境不支持同步(桥接方法缺失)"),"err");return}if(!xs.syncing){ns({syncing:!0});try{const t=await e.syncClashToProxyPool();Do(t),t?.syncError?Fn(r("没能同步:{reason}",{reason:t.syncError}),"err"):t?.changes?Fn(r("✅ 已同步 Clash Verge 出口({n} 项变更)",{n:t.changes})):Fn(r("已是最新,没有需要同步的变更"))}catch(t){Fn(r("同步失败:{reason}",{reason:Ra(t)}),"err")}finally{ns({syncing:!1})}}}async function PY(e){const t=tr().workbuddyDesktop;if(typeof t?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(!xs.testing){ns({testing:e.id});try{const a=await t.testProxyPoolItem(e.id);if(a?.items&&Do({items:a.items}),a?.success){const o=f0(a.durationMs);Fn(r("✅ 「{name}」出口可用{ip}{took}",{name:Uu(e),ip:a.ip?r(" 出口 IP {ip}",{ip:a.ip}):"",took:o?` ${o}`:""}))}else Fn(r("❌ 「{name}」{error}",{name:Uu(e),error:a?.error||r("连接失败")}),"err");a?.saveError&&Fn(r("测试结果没能记下:{reason}",{reason:a.saveError}),"err")}catch(a){Fn(r("测试失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({testing:null})}}}async function _Y(e,t){const a=tr().workbuddyDesktop;if(typeof a?.setProxyPoolItemEnabled!="function"){Fn(r("当前环境不支持启停(桥接方法缺失)"),"err");return}const o=new Set(xs.pending);o.add(e.id),ns({pending:o});try{const c=await a.setProxyPoolItemEnabled({id:e.id,enabled:t});Do(c);const d=Uu(e),f=c?.listener??"none";Fn(t?f==="opening"?r("已启用「{name}」,正在补建监听端口(内核重建中)",{name:d}):r("已启用「{name}」",{name:d}):f==="closing"?r("已禁用「{name}」,监听端口正在关闭(内核重建中)",{name:d}):r("已禁用「{name}」",{name:d})),(f==="closing"||f==="opening")&&LY(e.id,f)}catch(c){Fn(r("保存失败:{reason}",{reason:Ra(c)}),"err")}finally{const c=new Set(xs.pending);c.delete(e.id),ns({pending:c})}}async function LY(e,t){for(let a=0;a<12;a+=1){await new Promise(d=>setTimeout(d,1500)),await fp(!0);const o=Wg().find(d=>d.id===e);if(!o)return;const c=o.port!==null&&o.port!==void 0;if(t==="closing"?!c:c)return}}async function $2(e){const t=tr().workbuddyDesktop;if(typeof t?.removeProxyPoolItem!="function")return;if(!U2(e)){Fn(F2(e),"err");return}const a=e.usedBy||[],o=a.length?`

    ${r("有 {n} 个账号正在使用它({names})—— 删除后这些账号会回退直连。",{n:a.length,names:a.map(f=>p0(String(f.name||f.id||""))).join(r("、"))})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("删除代理"),html:r("确定删除「{name}」?{used}",{name:p0(Uu(e)),used:o}),okText:r("删除"),okClass:"danger"}))return;const d=new Set(xs.pending);d.add(e.id),ns({pending:d});try{const f=await t.removeProxyPoolItem(e.id);Do(f),Fn(r("已删除「{name}」",{name:Uu(e)}))}catch(f){Fn(r("删除失败:{reason}",{reason:Ra(f)}),"err")}finally{const f=new Set(xs.pending);f.delete(e.id),ns({pending:f})}}async function zY(){const e=tr().workbuddyDesktop;if(typeof e?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(xs.batchBusy||xs.testing)return;const t=Wg().filter(f=>xs.selected.has(f.id));if(!t.length)return;ns({batchBusy:!0,batchProgress:{done:0,total:t.length}});let a=0,o=0,c="";for(const[f,p]of t.entries()){ns({testing:p.id,batchProgress:{done:f,total:t.length}});try{const h=await e.testProxyPoolItem(p.id);h?.items&&Do({items:h.items}),h?.success?a+=1:o+=1,h?.saveError&&!c&&(c=h.saveError)}catch{o+=1}}ns({testing:null,batchBusy:!1,batchProgress:null});const d=o?r("批量测试完成:{ok} 个可用、{failed} 个失败(共 {total} 个)",{ok:a,failed:o,total:t.length}):r("批量测试完成:{ok} 个可用(共 {total} 个)",{ok:a,total:t.length});Fn(o?d:`✅ ${d}`,o?"err":"ok"),c&&Fn(r("部分测试结果没能记下:{reason}",{reason:c}),"err")}async function BY(){const e=tr().workbuddyDesktop;if(typeof e?.removeProxyPoolItem!="function"||xs.batchBusy||xs.testing)return;const t=Wg().filter(S=>xs.selected.has(S.id)),a=t.filter(S=>U2(S)),o=t.length-a.length;if(!a.length){Fn(o?r("选中的 {n} 条都是同步来的只读条目(Clash / 订阅),不能删除",{n:o}):r("没有可删除的条目"),"err");return}const c=a.slice(0,8).map(S=>p0(Uu(S))).join(r("、")),d=a.length>8?r("{names} 等 {n} 条",{names:c,n:a.length}):c,f=a.filter(S=>(S.usedBy||[]).length).length,p=f?`

    ${r("其中 {n} 条正被账号使用 —— 删除后那些账号会回退直连。",{n:f})}

    `:"",h=o?`

    ${r("另有 {n} 条是同步来的只读条目(Clash / 订阅),将跳过。",{n:o})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("批量删除代理"),html:`${r("确定删除选中的 {n} 个代理?",{n:a.length})}

    ${d}

    ${p}${h}`,okText:r("删除"),okClass:"danger"}))return;ns({batchBusy:!0,batchProgress:{done:0,total:a.length}});let y=0,v=0,w="";for(const[S,N]of a.entries()){ns({batchProgress:{done:S,total:a.length}});try{const k=await e.removeProxyPoolItem(N.id);Do(k),y+=1}catch(k){v+=1,w||(w=Ra(k))}}ns({batchBusy:!1,batchProgress:null});const j=[r("已删除 {n} 个代理",{n:y})];o&&j.push(r("跳过 {n} 个(同步只读条目)",{n:o})),v&&j.push(r("失败 {n} 个({reason})",{n:v,reason:w})),Fn(v?j.join(r(",")):`✅ ${j.join(r(","))}`,v?"err":"ok")}async function HY(e,t){const a=tr().workbuddyDesktop,o=e?{...t,id:e.id}:t,c=e?await a?.updateProxyPoolItem?.(o):await a?.createProxyPoolItem?.(o);return Do(c),c}async function q2(){const e=tr().workbuddyDesktop;if(typeof e?.getProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const t=await e.getProxySettings();if(!t||typeof t!="object")throw new Error(r("代理设置响应异常"));return t}async function UY(e){const t=tr().workbuddyDesktop;if(typeof t?.saveProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const a=await t.saveProxySettings(e);if(!a||typeof a!="object")throw new Error(r("代理设置响应异常"));return a}function VY({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.name||""),[d,f]=x.useState(e?.protocol==="socks5"?"socks5":"http"),[p,h]=x.useState(e?.host||""),[b,y]=x.useState(e?.port?String(e.port):""),[v,w]=x.useState(e?.username||""),[j,S]=x.useState(e?.password||""),[N,k]=x.useState(e?e.enabled:!0),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null);function P(){const L=o.trim();if(!L)return{error:r("请填写代理名称")};const H=p.trim();if(!H)return{error:r("请填写代理主机地址")};const B=Number(b);return!Number.isInteger(B)||B<1||B>65535?{error:r("代理端口必须是 1-65535 的整数")}:{payload:{name:L,source:"manual",protocol:d,host:H,port:B,username:v.trim(),password:j,enabled:N}}}async function O(){if(C)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}const H=L.payload,B={source:"custom",protocol:H.protocol,host:H.host,port:H.port,username:H.username,password:H.password};A(!0),I(r("正在连接上游…"));try{const z=await tr().workbuddyDesktop?.testProxy?.({proxy:B});if(z?.success){const Q=f0(z.durationMs);I(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),z.ip?r(" 出口 IP {ip}",{ip:z.ip}):"",Q?` ${Q}`:""]}))}else I(s.jsxs("span",{className:"text-destructive",children:["❌ ",z?.error||r("连接失败")]}))}catch(z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(z)]}))}finally{A(!1)}}async function _(){if(T)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}D(!0),I(null);try{await HY(e,L.payload),Fn(a?r("已保存「{name}」",{name:o.trim()}):r("已新增「{name}」",{name:o.trim()})),t()}catch(H){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(H)]})),D(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:L=>{!L&&!T&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑代理":"新增代理")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-name",children:r("名称")}),s.jsx($e,{id:"proxy-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:香港 HTTP 出口"),value:o,onChange:L=>c(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-protocol",children:r("协议")}),s.jsxs(ft,{value:d,onValueChange:L=>f(L),children:[s.jsx(mt,{id:"proxy-protocol",className:"min-w-[110px]",children:s.jsx(pt,{children:d==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-host",children:r("主机")}),s.jsx($e,{id:"proxy-host",placeholder:"127.0.0.1",autoComplete:"off",spellCheck:!1,value:p,onChange:L=>h(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-port",children:r("端口")}),s.jsx($e,{id:"proxy-port",type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:b,onChange:L=>y(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-user",children:r("用户名")}),s.jsx($e,{id:"proxy-user",placeholder:r("可选"),autoComplete:"off",value:v,onChange:L=>w(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-pass",children:r("密码")}),s.jsx($e,{id:"proxy-pass",placeholder:r("可选"),autoComplete:"off",value:j,onChange:L=>S(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:N,onCheckedChange:k,"aria-label":r("启用这条代理")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的条目不会被账号使用,被引用时账号回退直连;仍可测试)")})]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("想要 Clash Verge 的出口?那类条目由工具条的"),s.jsx("b",{children:r("「同步 Clash Verge」")}),r("整体 镜像进来(进本页时也会自动同步一次),名称与端口跟随 Clash、因此是只读的 —— 不必(也不能)在这里手工填。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",disabled:C||T,onClick:()=>{O()},children:r(C?"测试中…":"测试出口")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:T,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:T,onClick:()=>{_()},children:r(T?"保存中…":"保存")})]})]})})}function FY({onClose:e}){const[t,a]=x.useState(!0),[o,c]=x.useState(!1),[d,f]=x.useState(""),[p,h]=x.useState(""),[b,y]=x.useState(""),[v,w]=x.useState({}),[j,S]=x.useState(""),[N,k]=x.useState(!1);x.useEffect(()=>{let A=!0;return(async()=>{try{const R=await q2();if(!A||R===null)return;f(String(R.listenerPortBase??"")),h(String(R.listenerPortEnd??"")),y(String(R.testUrl??"")),w(R.defaults??{}),a(!1)}catch(R){if(!A)return;S(Ra(R)),a(!1)}})(),()=>{A=!1}},[]);function T(){const A=Number(d),R=Number(p);if(!Number.isInteger(A)||A<1||A>65535||!Number.isInteger(R)||R<1||R>65535)return S(r("端口范围必须是 1-65535 的整数")),null;if(A>R)return S(r("起始端口不能大于结束端口")),null;const I=b.trim();return I&&!I.startsWith("http://")&&!I.startsWith("https://")?(S(r("测试网址要以 http:// 或 https:// 开头")),null):(S(""),{listenerPortBase:A,listenerPortEnd:R,testUrl:I})}async function D(){if(o||t)return;const A=T();if(A){c(!0);try{await UY(A),k(!0)}catch(R){S(Ra(R))}finally{c(!1)}}}function C(){f(String(v.listenerPortBase??"")),h(String(v.listenerPortEnd??"")),y(String(v.testUrl??"")),k(!1),S("")}return s.jsx(Qt,{open:!0,onOpenChange:A=>{!A&&!o&&e()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("代理设置")})}),s.jsx(Bt,{className:"flex flex-col gap-3.5",children:t?s.jsx("p",{className:"text-xs text-subtle",children:r("加载中…")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-base",children:r("节点端口范围(起始)")}),s.jsx($e,{id:"proxy-settings-base",type:"number",min:1,max:65535,placeholder:String(v.listenerPortBase??""),autoComplete:"off",value:d,onChange:A=>{f(A.currentTarget.value),k(!1)}})]}),s.jsx("span",{"aria-hidden":"true",className:"flex-none pb-[7px] text-subtle",children:"—"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-end",children:r("节点端口范围(结束)")}),s.jsx($e,{id:"proxy-settings-end",type:"number",min:1,max:65535,placeholder:String(v.listenerPortEnd??""),autoComplete:"off",value:p,onChange:A=>{h(A.currentTarget.value),k(!1)}})]})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅节点会在本机各占一个监听端口,从该范围里挑空闲的分配;节点多的大订阅把默认范围({base}-{end})用尽时会报「没有可用的节点端口」,这时把范围调大再重启内核。已分配出去的端口不会因改范围而失效。",{base:v.listenerPortBase??"",end:v.listenerPortEnd??""})}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-url",children:r("出口测试网址")}),s.jsx($e,{id:"proxy-settings-url",placeholder:v.testUrl||"",autoComplete:"off",spellCheck:!1,className:"font-mono text-[12px]",value:b,onChange:A=>{y(A.currentTarget.value),k(!1)}})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("「测试」与「批量测试」访问的目标;留空用默认(打 WorkBuddy 上游)。判据是能否拿到 HTTP 响应,不用考虑该网址返回什么内容。")}),s.jsxs("div",{className:"min-h-[18px] text-xs",children:[j?s.jsxs("span",{className:"text-destructive",children:["❌ ",j]}):null,!j&&N?s.jsxs("span",{className:"text-success",children:["✅ ",r("已保存。重启内核后,新分配的节点端口才会按新范围来。")]}):null]})]})}),s.jsxs(nn,{children:[s.jsx(se,{variant:"ghost",disabled:t||o,onClick:C,children:r("恢复默认")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:o,onClick:e,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:t||o,onClick:()=>{D()},children:r(o?"保存中…":"保存")})]})]})})}function Pn(){return window}function nr(e,t){Pn().wbApp?.toast?.(e,t)}function zr(e){return e instanceof Error?e.message:String(e)}function G2(e){const t=String(e||"").trim();return/^https?:\/\//i.test(t)?t:""}async function K2(e){const t=G2(e);if(!t){nr(r("链接地址不受支持"),"err");return}try{await Pn().workbuddyDesktop?.openReleasePage(t)}catch(a){nr(r("打开链接失败:{error}",{error:zr(a)}),"err")}}const Jg="1127656296",$Y=`assets/qq-group/${Jg}.jpg`;function Y2(e){return Pn().wbMarkdown?.render?.(e)||""}function X2(e){const a=e.target?.closest?.("[data-external]");a&&(e.preventDefault(),K2(a.dataset.external||""))}const pp="__proxy_other__",Q2={proxyChoice:null,pool:null,poolError:""};async function qY(){const e=Pn().workbuddyDesktop,t={...Q2};if(!e?.getUpdateProxy)return t;try{t.proxyChoice=(await e.getUpdateProxy())?.proxy??null}catch{}try{if(typeof e.getProxyPool!="function")throw new Error("桥未提供代理池方法");const a=(await e.getProxyPool())?.items;if(!Array.isArray(a))throw new Error("代理池响应异常");t.pool=a}catch(a){t.pool=[],t.poolError=zr(a)}return t}async function GY(e){if(e===pp)return null;const t=Pn().workbuddyDesktop;if(!t?.setUpdateProxy)return null;const a=e===""?null:{source:"pool",proxyId:e.slice(Xa.length)};try{const o=await t.setUpdateProxy({proxy:a}),c=o?.proxy??null,d=o?.saved!==!1;return d?nr(c?r("✅ 更新出网已切换为 {label}",{label:c.label||r("指定代理")}):r("✅ 更新出网已切换为直连")):nr(r("出网线路已切换,但写入磁盘失败(重启后会恢复原线路)"),"err"),{choice:c,saved:d}}catch(o){return nr(r("保存失败:{error}",{error:zr(o)}),"err"),null}}function Z2(e){const t=e.proxyChoice,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=!!t?.error,d=Array.isArray(e.pool)?e.pool:[];let f="";a==="pool"&&t?.config?.proxyId?f=`${Xa}${t.config.proxyId}`:t&&(f=pp);const p=[{value:"",label:r("直连")}];for(const h of d)p.push({value:`${Xa}${h.id}`,label:au(h)});if(e.pool===null?p.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):d.length||p.push({value:"__hint_pool__",label:e.poolError?r("代理列表读取失败"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),f===pp){const h=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";p.push({value:pp,label:`${h}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!d.some(h=>`${Xa}${h.id}`===f)&&p.push({value:f,label:`${o}${c?r("(不可用)"):""}`});return{current:f,items:p,selected:p.find(h=>h.value===f),broken:c,title:c?r("当前线路不可用:{error};请重新选择代理或切回直连",{error:String(t?.error||"")}):r("检查更新与下载安装包走哪条线路(当前:{current});选择即保存。选项来自「网络代理」页;直连失败时会自动借 Clash 混合端口重试一次,选定指定代理后只走它",{current:t?o:r("直连")})}}function sr(){return window}function sn(e,t){sr().wbApp?.toast?.(e,t)}function jr(e){return e instanceof Error?e.message:String(e)}let Ht={data:null,loading:!1,error:"",pending:!1,refreshing:null};const h0=new Set;function ex(e){return h0.add(e),()=>{h0.delete(e)}}function tx(){return Ht}function yn(e){Ht={...Ht,...e},h0.forEach(t=>t())}function KY(){return Ht.data?.items??[]}function Vu(){return Ht.data?.kernel??null}function Yi(e){!e||typeof e!="object"||!Array.isArray(e.items)||yn({data:e,error:""})}function Io(){fp(!0)}async function Ml(e=!1){const t=sr().workbuddyDesktop;if(typeof t?.getSubscriptions!="function"){yn({error:r("当前环境不支持订阅(桥接方法缺失)")});return}e||yn({loading:!0});try{Yi(await t.getSubscriptions())}catch(a){yn({error:jr(a)})}finally{e||yn({loading:!1})}}const YY=20;function XY(e){const t=e.kernel;if(!t||t.download.state==="downloading")return!1;if(!t.installed||t.lastError&&!t.running)return!0;const a=t.providerSync??{};return(e.items??[]).filter(o=>o.enabled!==!1).every(o=>!!a[o.id])}async function Xi(){const e=sr().workbuddyDesktop;if(typeof e?.getSubscriptions=="function")for(let t=0;tsetTimeout(o,1500)),Io();let a;try{a=await e.getSubscriptions()}catch{return}if(Yi(a),t>=1&&a&&Array.isArray(a.items)&&XY(a))return}}async function W2(e){const a=await sr().workbuddyDesktop?.addSubscription?.({enabled:!0,kind:"url",url:"",...e});return Yi(a),sn(r("已新增订阅「{name}」,内核正在同步节点…",{name:e.name.trim()})),Io(),Xi(),a??null}async function J2(e,t){const o=await sr().workbuddyDesktop?.saveSubscription?.({id:e.id,...t});Yi(o),sn(r("已保存「{name}」",{name:t.name.trim()})),Io(),Xi()}async function QY(e,t){const a=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const o=await a?.saveSubscription?.({id:e.id,name:e.name,url:e.url,kind:e.kind,enabled:t});Yi(o),sn(t?r("已启用「{name}」",{name:e.name}):r("已禁用「{name}」",{name:e.name})),Io(),Xi()}catch(o){sn(r("保存失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function ZY(e){const t=sr().workbuddyDesktop;if(!(Ht.refreshing||Ht.pending)){yn({refreshing:e.id});try{const a=await t?.refreshSubscription?.(e.id);Yi(a),sn(r("已刷新「{name}」,正在同步节点…",{name:e.name})),Io(),Xi()}catch(a){sn(r("刷新失败:{reason}",{reason:jr(a)}),"err")}finally{yn({refreshing:null})}}}async function WY(e){const t=sr().workbuddyDesktop;if(await window.wbConfirm?.ask?.({title:r("删除订阅"),html:r("确定删除「{name}」?它在代理池里的节点会一并移除,引用这些节点的账号会回退直连。",{name:e.name||e.id}),okText:r("删除"),okClass:"danger"})&&!Ht.pending){yn({pending:!0});try{const o=await t?.removeSubscription?.(e.id);Yi(o),sn(r("已删除「{name}」",{name:e.name||e.id})),Io(),Xi()}catch(o){sn(r("删除失败:{reason}",{reason:jr(o)}),"err")}finally{yn({pending:!1})}}}async function JY(e){const t=sr().workbuddyDesktop;if(typeof t?.downloadKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const a=await t.downloadKernel(e);a&&Ht.data&&yn({data:{...Ht.data,kernel:a}}),a?.saved===!1&&sn(r("下载线路 / 存放目录没能写进配置(本次下载已按新设置走,重启后会恢复原值)"),"err");for(let c=0;c<300;c+=1){await new Promise(f=>setTimeout(f,1e3));const d=await t.getKernelStatus?.();if(d&&Ht.data&&yn({data:{...Ht.data,kernel:d}}),!d||d.download.state!=="downloading")break}const o=Ht.data?.kernel;o?.download.state==="error"?sn(r("内核下载失败:{reason}",{reason:o.download.error||r("未知错误")}),"err"):o?.download.state==="canceled"?sn(r("已停止下载内核(未下载完的临时文件已删除)")):o?.download.state==="done"&&(sn(r("✅ 内核下载完成,正在启动…")),Xi())}catch(a){sn(r("内核下载失败:{reason}",{reason:jr(a)}),"err")}finally{yn({pending:!1})}}}async function eX(){const e=sr().workbuddyDesktop;if(typeof e?.cancelKernelDownload!="function")return"none";try{const t=await e.cancelKernelDownload();if(t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),t?.canceled===!1)return"none";for(let o=0;o<20;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.download.state!=="downloading")break;await new Promise(d=>setTimeout(d,250))}const a=Ht.data?.kernel?.download.state;return a==="canceled"?"canceled":a==="done"?"done":"stalled"}catch(t){return sn(r("停止下载失败:{reason}",{reason:jr(t)}),"err"),"none"}}async function tX(){const e=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const t=await e?.restartKernel?.();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),sn(r("内核正在启动…")),Io(),Xi()}catch(t){sn(r("内核启动失败:{reason}",{reason:jr(t)}),"err")}finally{yn({pending:!1})}}}async function nX(){const e=sr().workbuddyDesktop;if(typeof e?.stopKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const t=await e.stopKernel();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}});for(let o=0;o<10;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.running===!1)break;await new Promise(d=>setTimeout(d,500))}const a=Ht.data?.kernel;if(a?.running===!1)sn(r("内核已关闭(订阅与端口注册表保留,「启动内核」后原位恢复)"));else{const o=a?.lastError||r("内核没有在超时内停下来");sn(r("关闭内核失败:{reason}",{reason:o}),"err")}Ml(!0)}catch(t){sn(r("关闭内核失败:{reason}",{reason:jr(t)}),"err"),Ml(!0)}finally{yn({pending:!1})}}}async function sX(){const e=sr().workbuddyDesktop;if(typeof e?.removeKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}const t=Vu()?.version;if(!await window.wbConfirm?.ask?.({title:r("删除内核"),html:r("确定删除已下载的内核{version}?内核文件与端口映射会被移除,订阅节点会变成「未分配端口」,引用它们的账号会暂时回退直连;订阅本身保留,重新下载内核后会重新分配端口。",{version:t?`(${t})`:""}),okText:r("删除内核"),okClass:"danger"})||Ht.pending)return;yn({pending:!0});const o=Vu()?.lastError||"";try{const c=await e.removeKernel();c&&Ht.data&&yn({data:{...Ht.data,kernel:c}});for(let f=0;f<20;f+=1){const p=await e.getKernelStatus?.();if(p&&Ht.data&&yn({data:{...Ht.data,kernel:p}}),p&&p.installed===!1||p?.lastError&&p.lastError!==o)break;await new Promise(h=>setTimeout(h,500))}const d=Ht.data?.kernel;if(d?.installed===!1)sn(r("已删除内核(订阅与账号引用保留,重新下载后会重新分配端口)")),Io();else{const f=d?.lastError&&d.lastError!==o?d.lastError:r("内核目录没能删掉(可能仍被进程占用),稍后重试一次");sn(r("删除内核失败:{reason}",{reason:f}),"err")}Ml(!0)}catch(c){sn(r("删除内核失败:{reason}",{reason:jr(c)}),"err"),Ml(!0)}finally{yn({pending:!1})}}async function rX(e){const t=sr().workbuddyDesktop;if(typeof t?.decodeQrImage!="function")throw new Error(r("当前环境不支持订阅(桥接方法缺失)"));const a=await new Promise((d,f)=>{const p=new FileReader;p.onload=()=>d(String(p.result||"")),p.onerror=()=>f(new Error(r("图片读取失败"))),p.readAsDataURL(e)}),c=(await t.decodeQrImage({imageBase64:a}))?.url;if(!c)throw new Error(r("二维码里没有订阅链接"));return c}function aX(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result||"")),o.onerror=()=>a(new Error(r("文件读取失败"))),o.readAsDataURL(e)})}function eD(e){return(Math.max(0,Number(e)||0)/1024/1024).toFixed(1)}function lX(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")}function oX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),o=a?.download,c=o?.state==="downloading",d=c&&o&&o.total>0?Math.round(o.received/o.total*100):null,[f,p]=x.useState(null),[h,b]=x.useState(""),[y,v]=x.useState(null),[w,j]=x.useState(a?.kernelDir||""),[S,N]=x.useState(!1),[k,T]=x.useState(!1),[D,C]=x.useState("");x.useEffect(()=>{let H=!0;return(async()=>{try{const B=(await sr().workbuddyDesktop?.getProxyPool?.())?.items;if(!Array.isArray(B))throw new Error(r("代理池响应异常"));H&&p(B)}catch(B){if(!H)return;p([]),b(jr(B))}})(),()=>{H=!1}},[]),x.useEffect(()=>{a?.installed&&e()},[a?.installed]);const A=Z2({proxyChoice:a?.downloadProxy??null,pool:f,poolError:h}),R=y??A.current,I=A.items.find(H=>H.value===R)??A.selected,P=a?.kernelDirDefault||"";async function O(){if(S)return;const H=w.trim();if(H&&!lX(H)){C(r("存放位置要填绝对路径,例如 D:\\proxy-kernel"));return}C(""),N(!0);try{const B={dir:H};R!==pp&&(B.proxy=R===""?null:{source:"pool",proxyId:R.slice(Xa.length)}),JY(B)}finally{N(!1)}}async function _(){if(!k){T(!0);try{const H=await eX();H==="done"?sn(r("下载已经完成,停止没赶上(内核已安装)")):H==="none"?sn(r("当前没有正在进行的下载"),"err"):H==="stalled"&&sn(r("停止请求已发出,但下载还没收手,稍后再看一次进度"),"err")}finally{T(!1)}}}async function L(){const H=sr().workbuddyDesktop;if(typeof H?.pickFolder!="function"){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}try{const B=await H.pickFolder(w.trim()||P||null);if(B?.unsupported){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}if(B?.canceled||!B?.path)return;j(B.path)}catch(B){sn(r("打开文件夹选择框失败:{reason}",{reason:jr(B)}),"err")}}return s.jsx(Qt,{open:!0,onOpenChange:H=>{H||e()},children:s.jsxs(Zt,{className:"w-[min(520px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r(c?"正在下载内核":"下载内核")}),s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("内核 {version}({asset})",{version:a?.version||"—",asset:a?.asset||"—"})})]}),c?s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tf,{value:d??null}),s.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[s.jsx("span",{className:"text-text-2",children:d!==null?r("{percent}%({received} / {total} MB)",{percent:d,received:eD(o?.received),total:eD(o?.total)}):r("正在连接 GitHub…")}),s.jsx("span",{className:"text-subtle",children:r("存放位置 {dir}",{dir:a?.kernelDir||"—"})})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("关掉这个窗口不会中断下载(它在后台继续跑)—— 要停下就点下面的「停止下载」,未下载完的临时文件会被删除。")})]}):s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-proxy",children:r("下载线路")}),s.jsxs(ft,{value:R,onValueChange:H=>v(String(H)),children:[s.jsx(mt,{id:"kernel-proxy",className:Ue("w-full",A.broken&&"border-destructive-bd"),children:s.jsx(pt,{className:"min-w-0 truncate",children:I?.label||r("直连")})}),s.jsx(ht,{children:A.items.map(H=>s.jsx(qe,{value:H.value,disabled:H.disabled,children:H.label},H.value))})]}),s.jsx("div",{className:"text-[12px] text-subtle",children:A.broken?r("当前线路不可用:{error};重新选一条或切回直连",{error:String(a?.downloadProxy?.error||"")}):r("选项来自「网络代理」页(Clash Verge 同步的出口在这里可用;订阅节点要等内核起来才有端口)。选「直连」时连不上会自动借 Clash 混合端口重试一次;选定某条线路后只走它。")})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-dir",children:r("存放位置")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{id:"kernel-dir",className:"min-w-0 flex-1 font-mono text-[12px]",autoComplete:"off",spellCheck:!1,value:w,placeholder:P,onChange:H=>j(H.currentTarget.value)}),s.jsx(se,{variant:"outline",size:"sm",className:"flex-none",onClick:()=>{L()},children:r("选择目录…")}),P&&w.trim()!==P?s.jsx(se,{variant:"ghost",size:"sm",className:"flex-none",title:P,onClick:()=>j(P),children:r("恢复默认")}):null]}),s.jsx("div",{className:"text-[12px] text-subtle",children:r("内核二进制 / 配置 / 端口映射都会放在这里,默认 {dir};目录不存在会在下载开始时自动创建。",{dir:P||"—"})})]}),o?.state==="error"&&o.error?s.jsx("span",{className:"text-[12px] text-destructive",children:r("上次下载失败:{reason}",{reason:o.error})}):null,o?.state==="canceled"?s.jsx("span",{className:"text-[12px] text-subtle",children:r("上次下载已停止,未下载完的临时文件已删除")}):null,D?s.jsx("span",{className:"text-[12px] text-destructive",children:D}):null]}),s.jsx(nn,{children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("后台继续")}),s.jsx(se,{variant:"destructive",disabled:k,onClick:()=>{_()},children:r(k?"正在停止…":"停止下载")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("取消")}),s.jsx(se,{variant:"default",disabled:S||t.pending,onClick:()=>{O()},children:r(S?"正在开始…":"下载")})]})})]})})}function tD({showPortRange:e=!1}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),[o,c]=x.useState(null),[d,f]=x.useState(!1);x.useEffect(()=>{let b=!0;return(async()=>{try{const y=await q2();if(!b||!y)return;const v=Number(y.listenerPortBase),w=Number(y.listenerPortEnd);Number.isFinite(v)&&Number.isFinite(w)&&v>0&&w>0&&c({base:v,end:w})}catch{}})(),()=>{b=!1}},[]);const p=a?.download.state==="downloading",h=p&&a.download.total>0?Math.round(a.download.received/a.download.total*100):null;return s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ze,{variant:a?.running?"default":"secondary",children:a?.running?r("内核运行中"):a?.installed?a.halted?r("内核已手动关闭"):r("内核已停止"):r("内核未安装")}),s.jsxs("span",{className:"text-[12.5px] text-text-2",children:[a?.installed?r("内核 {version}",{version:a.version})+" · ":"",a?.running?r("控制端口 {port} · {n} 个节点监听器",{port:a?.controllerPort??"—",n:a?.listenerCount??0}):a?.installed?a.halted?r("内核已手动关闭(点「启动内核」拉起)"):r("内核已停止,点「启动内核」拉起"):r("按需下载(约 20-40MB)")]}),e&&o?s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("节点端口范围 {base}–{end}",{base:o.base,end:o.end})}):null,s.jsx("div",{className:"ml-auto flex items-center gap-2",children:a?.installed?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{tX()},children:a?.running?r("重启内核"):r("启动内核")}),a?.running?s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{nX()},children:r("关闭内核")}):null,s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending||p,onClick:()=>{sX()},children:r("删除内核")})]}):s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending&&!p,onClick:()=>f(!0),children:r(p?"下载中…":"下载内核")})})]}),p?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tf,{className:"min-w-[200px] flex-1",value:h??null}),s.jsx("span",{className:"text-[11px] text-subtle",children:h!==null?r("{percent}%({received} / {total} MB)",{percent:h,received:nD(a.download.received),total:nD(a.download.total)}):r("下载中…")})]}):null,a?.lastError?s.jsx("span",{className:"text-[12px] text-destructive",children:a.lastError}):null,d?s.jsx(oX,{onClose:()=>f(!1)}):null]})}function iX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=KY(),o=t.data!==null,[c,d]=x.useState(null);return x.useEffect(()=>{Ml()},[]),s.jsxs(Qt,{open:!0,onOpenChange:f=>{f||e()},children:[s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r("订阅管理")}),s.jsxs("span",{className:"text-[11.5px] text-subtle",children:[o?r("{n} 条订阅",{n:a.length}):r("加载中…")," · ",r("节点由内核起成本地监听器,镜像进代理池")]})]}),s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tD,{}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-[18%]"}),s.jsx("col",{className:"w-[31%]"}),s.jsx("col",{className:"w-[9%]"}),s.jsx("col",{className:"w-[14%]"}),s.jsx("col",{className:"w-[8%]"}),s.jsx("col",{className:"w-[20%]"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("名称")}),s.jsx("th",{children:r("订阅来源")}),s.jsx("th",{className:"ta-center",children:r("节点")}),s.jsx("th",{children:r("上次同步")}),s.jsx("th",{className:"ta-center",children:r("启用")}),s.jsx("th",{className:"ta-right",children:r("操作")})]})}),s.jsx("tbody",{children:a.length?a.map(f=>{const p=Vu()?.providerSync?.[f.id];return s.jsxs("tr",{className:f.enabled?"":"off",children:[s.jsx("td",{children:s.jsx("b",{children:f.name||r("未命名")})}),s.jsx("td",{className:"group",children:s.jsx("div",{className:"flex min-w-0 items-center gap-1",children:f.kind==="local"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.fileName,children:f.fileName||r("本地 YAML 文件")}),s.jsx(ze,{variant:"secondary",children:r("本地文件")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.url,children:cX(f.url)}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)] opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","data-copy":f.url,title:r("复制订阅链接"),children:"⧉"})]})})}),s.jsx("td",{className:"ta-center",children:sD(p,f)>0?s.jsx(ze,{variant:"secondary",children:r("{n} 个",{n:sD(p,f)})}):s.jsx("span",{className:"text-subtle",children:r("—")})}),s.jsx("td",{children:p?.at?s.jsx("span",{className:"text-[12px] text-text-2",children:z2(p.at)}):s.jsx("span",{className:"text-subtle",children:r("未同步")})}),s.jsx("td",{className:"ta-center",children:s.jsx(hs,{checked:f.enabled,disabled:t.pending,"aria-label":r("启用订阅「{name}」",{name:f.name||r("未命名")}),onCheckedChange:h=>{QY(f,h)}})}),s.jsx("td",{children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending||t.refreshing!==null||f.kind==="local",title:f.kind==="local"?r("本地文件订阅无需更新(要换内容请编辑后重新选择文件)"):void 0,onClick:()=>{ZY(f)},children:t.refreshing===f.id?r("更新中…"):r("立即更新")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending,onClick:()=>d({item:f}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending,onClick:()=>{WY(f)},children:r("删除")})]})})]},f.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"empty",children:o?s.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[s.jsx("span",{children:r("还没有订阅:粘贴订阅链接、导入本地 YAML 文件,或从图片识别二维码。")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅里的节点会自动同步进代理池,账号即可引用。")})]}):r("加载中…")})})})]})}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅里的节点会被内核起成本地监听器,镜像到代理池(账号按 id 引用,与本页其它出口同一用法)。内核只在用到订阅时按需下载(约 20-40MB),不随安装包分发。")}),t.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:t.error})}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"default",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("完成")})]})]}),c?s.jsx(uX,{item:c.item,onClose:()=>d(null)}):null]})}function nD(e){return!Number.isFinite(e)||e<=0?"—":(e/1e3/1e3).toFixed(1)}function cX(e){try{const t=new URL(e);return t.host+(t.pathname!=="/"?"/…":"")}catch{return e.slice(0,60)}}function sD(e,t){return e?.count??t.nodeCount}function uX({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.kind==="local"?"local":"url"),[d,f]=x.useState(e?.name||""),[p,h]=x.useState(e?.url||""),[b,y]=x.useState(e?.fileName||""),[v,w]=x.useState(""),[j,S]=x.useState(e?e.enabled:!0),[N,k]=x.useState(!1),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null),P=x.useRef(null);async function O(){if(N)return;const z=d.trim();if(!z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请填写订阅名称")]}));return}const Q=p.trim();if(o==="url"&&!(Q.startsWith("http://")||Q.startsWith("https://"))){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("订阅链接必须是 http:// 或 https:// 开头")]}));return}if(!a&&o==="local"&&!v){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请选择要导入的 YAML 文件")]}));return}k(!0);try{a&&o==="local"?await J2(e,{name:z,enabled:j,kind:"local",fileName:b||void 0,...v?{contentB64:v}:{}}):a?await J2(e,{name:z,url:Q,enabled:j,kind:"url"}):o==="local"?await W2({name:z,kind:"local",fileName:b||void 0,contentB64:v}):await W2({name:z,kind:"url",url:Q}),t()}catch(K){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(K)]})),k(!1)}}async function _(z){if(!T){D(!0),I(r("正在识别二维码…"));try{const Q=await rX(z);h(Q),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已识别订阅链接")]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{D(!1)}}}async function L(z){if(!C){A(!0),I(null);try{const Q=await aX(z);w(Q),y(z.name),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已选择「{name}」,保存后导入",{name:z.name})]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",jr(Q)]}))}finally{A(!1)}}}function H(z){if(o!=="url")return;const K=Array.from(z.clipboardData?.files||[]).find(X=>X.type.startsWith("image/"));K&&(z.preventDefault(),_(K))}function B(z){z!==o&&(c(z),I(null))}return s.jsx(Qt,{open:!0,onOpenChange:z=>{!z&&!N&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",overlayForceRender:!0,onPaste:H,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑订阅":"新增订阅")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-name",children:r("名称")}),s.jsx($e,{id:"sub-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:我的机场"),value:d,onChange:z=>f(z.currentTarget.value)})]}),a?null:s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:r("订阅来源")}),s.jsx(In,{options:[{value:"url",label:r("订阅链接")},{value:"local",label:r("本地 YAML 文件")}],value:o,onValueChange:B,"aria-label":r("订阅来源")})]}),o==="url"?s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-url",children:r("订阅链接")}),s.jsx($e,{id:"sub-url",autoComplete:"off",spellCheck:!1,placeholder:"https://…",value:p,onChange:z=>h(z.currentTarget.value)}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:T,onClick:()=>P.current?.click(),children:r(T?"识别中…":"从图片识别二维码")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("也可以把二维码截图直接粘贴到弹窗里(Ctrl+V)")}),s.jsx("input",{ref:P,type:"file",accept:"image/*",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&_(Q),z.currentTarget.value=""}})]})]}):s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-file",children:r("YAML 文件")}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:C,className:"shrink-0",onClick:()=>P.current?.click(),children:r(C?"读取中…":a?"重新选择文件…":"选择 YAML 文件…")}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:b||void 0,children:b||r(a?"保持原文件":"未选择文件")})]}),a?s.jsx("span",{className:"text-[11px] text-subtle",children:r("本地文件不会自动更新:要更新节点,重新选择文件后保存;不重选则内容保持不变。")}):null,s.jsx("input",{ref:P,type:"file",accept:".yaml,.yml,text/yaml,application/yaml,text/plain",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&L(Q),z.currentTarget.value=""}})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(hs,{checked:j,onCheckedChange:S,"aria-label":r("启用这条订阅")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的订阅不参与内核同步,它的节点会从代理池移除)")})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r(o==="url"?"订阅内容由内核定时刷新(每 24 小时);节点数与同步状态在保存后由轮询刷新,稍等几秒。":"本地文件订阅的内容在导入时固定:节点会由内核起成本地监听器并镜像进代理池,节点数稍等几秒由轮询刷新。")}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:N,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:N||T||C,onClick:()=>{O()},children:r(N?"保存中…":"保存")})]})]})})}const g0=[{key:"pick",label:r("选择"),align:"center"},{key:"name",label:r("节点")},{key:"addr",label:r("地址")},{key:"state",label:r("启用"),align:"center"},{key:"test",label:r("连通性")},{key:"act",label:r("操作"),align:"right"}],dX={pick:"p-pick",name:"",addr:"p-addr",state:"p-state",test:"p-test",act:"p-act"},rD="proxies";function x0(){return window}let nx=null,aD=null;function lD(){return nx?nx.apply([...g0]):g0.map(e=>({...e,align:e.align??"left"}))}function fX(){x0().wbTableColumns?.repaint?.(rD)}function pX(e){if(aD=e,nx)return!0;const t=x0().wbColSettings;return t?.register?(nx=t.register({id:rD,label:r("代理池表"),columns:g0.map(a=>({key:a.key,label:a.label,align:a.align??"left"})),mount:()=>document.querySelector('.page[data-page="proxies"] .panel-head .head-actions'),onChange:()=>aD?.()}),!0):!1}function mX(){x0().wbColSettings?.close?.()}function hX(){const e=x.useSyncExternalStore(EY,AY),t=x.useSyncExternalStore(ex,tx).data?.items??[],[a,o]=x.useState(null),[c,d]=x.useState(!1),[f,p]=x.useState(!1),[h,b]=x.useState(""),[y,v]=x.useState("all"),[w,j]=x.useState("all"),[S,N]=x.useState("all"),[k,T]=x.useState(0),[,D]=x.useReducer(J=>J+1,0),C=Wg(),A=e.data!==null,R=e.selected.size,I=C.filter(J=>e.selected.has(J.id)&&Qg(J)).length,P=e.batchProgress;x.useEffect(()=>{Ml()},[]),x.useLayoutEffect(()=>{if(!pX(()=>D())){const J=window.setTimeout(()=>T(ie=>ie+1),50);return()=>window.clearTimeout(J)}D()},[k]),x.useLayoutEffect(()=>{fX()}),x.useEffect(()=>()=>{mX()},[]);const O=h.trim().toLowerCase(),_=bX(C,t);function L(J){return w==="all"?!0:w==="manual"||w==="clash"||w==="subscription"?tl(J)===w:w===cD?!!J.orphan:J.source==="subscription"&&!J.orphan&&J.providerId===w}function H(J){return!(y!=="all"&&tl(J)!==y||!L(J)||S!=="all"&&iD(J)!==S||O&&![J.name,Uh(J),J.host,J.protocol,String(J.port??"")].join(" ").toLowerCase().includes(O))}function B(J){const ie=J??"all";j(ie),v(ie==="all"?"all":ie==="manual"||ie==="clash"?ie:"subscription")}function z(J){v(J),j("all")}const Q=C.filter(H),K=Q.map(J=>J.id),X=K.length>0&&K.every(J=>e.selected.has(J)),q=K.some(J=>e.selected.has(J))&&!X,$=lD(),Y=[];for(const J of oD())Y.push(...Q.filter(ie=>tl(ie)===J.key));const F=ig(Q.length,"proxies"),G=F.paged?F.slice(Y):Y,W=new Map;for(const J of Q)W.set(tl(J),(W.get(tl(J))??0)+1);x.useEffect(()=>{F.goto(1)},[O,y,w,S]);function le(J){const ie=J.lastTest;if(!ie||!ie.at)return s.jsx("span",{className:"text-subtle",children:r("未测试")});const ge=f0(ie.durationMs);return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsxs("span",{className:ie.success?"text-success":"text-destructive",children:[ie.success?r("✅ {ip}",{ip:ie.ip||r("连接成功")}):r("❌ 连接失败"),ge?` ${ge}`:"",s.jsxs("span",{className:"text-[11px] text-subtle",children:[" ",z2(ie.at)]})]}),ie.success?null:s.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-subtle",title:String(ie.error||r("连接失败")),children:String(ie.error||r("连接失败"))})]})}function M(J){const ie=J.usedBy||[],ge=[];return J.protocol&&ge.push(J.protocol),ie.length&&ge.push(s.jsx("span",{className:"text-warn",title:ie.map(ee=>String(ee.name||ee.id||"")).join(r("、")),children:r("{n} 个账号在用",{n:ie.length})})),ge.length?s.jsx("span",{className:"text-[11px] text-subtle",children:ge.map((ee,fe)=>s.jsxs(x.Fragment,{children:[fe?" · ":"",ee]},fe))}):null}function U(J){if(yY(J)&&(J.port===null||J.port===void 0))return s.jsx("span",{className:"text-subtle",children:r("已禁用(未开监听端口)")});if(J.resolveError){const ge=J.source==="subscription"&&(J.port===null||J.port===void 0);return s.jsx("span",{className:ge?"text-subtle":"text-destructive",title:J.resolveError,children:r(ge?"未分配端口":"解析失败")})}if(bY(J)){const ge=Vu()?.installed===!1;return s.jsx("span",{className:"text-subtle",title:r(ge?"代理内核未安装(在「订阅管理」里下载内核后,节点会自动分配监听端口)":"还没有监听端口(还没有账号引用它 —— 在账号里选它并保存后,内核会自动开端口)"),children:Uh(J)||r("未分配端口")})}const ie=Uh(J);return s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx("span",{className:"min-w-0 flex-1 font-mono text-[12px] leading-[1.45] text-text-2 break-all",title:ie||void 0,children:ie||"—"}),ie?s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn flex-none","data-copy":ie,title:r("复制地址"),children:"⧉"}):null]})}function Z(J,ie,ge,ee){const fe=ge||e.batchBusy;switch(J){case"pick":return s.jsx(Mr,{checked:ee,title:r("勾选后可批量操作"),"aria-label":r("勾选「{name}」",{name:ie.name||r("未命名")}),onCheckedChange:te=>OY(ie.id,te)});case"name":return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsx("b",{children:ie.name||r("未命名")}),M(ie)]});case"addr":return U(ie);case"state":{const te=H2(ie);return s.jsx(hs,{checked:ie.enabled!==!1,disabled:fe||te,"aria-label":r("启用「{name}」",{name:ie.name||r("未命名")}),title:TY(ie),onCheckedChange:Ce=>{_Y(ie,Ce)}})}case"test":return le(ie);case"act":{const te=Zg(ie);Qg(ie);const Ce=F2(ie),re=e.testing===ie.id;return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe||e.testing!==null,onClick:()=>{PY(ie)},children:r(re?"测试中…":"测试")}),ie.source!=="clash"&&ie.source!=="subscription"?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe,onClick:()=>o({item:ie}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,onClick:()=>{$2(ie)},children:r("删除")})]}):null,te?s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,title:Ce,onClick:()=>{$2(ie)},children:r("删除")}):null]})}default:return null}}function ae(J){const ie=e.pending.has(J.id),ge=RY(J.id);return s.jsx("tr",{className:Ue(J.enabled?"":"off",ge&&"bg-primary-soft"),"data-id":J.id,children:$.map(ee=>s.jsx("td",{className:`ta-${ee.align}`,children:Z(ee.key,J,ie,ge)},ee.key))},J.id)}function ce(){if(!C.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:r(A?"还没有代理。点右上角「+ 新增代理」手填一个,点「同步 Clash Verge」把 Clash 的出口导进来,或在「订阅管理」里导入订阅节点。":"加载中…")})});if(!Q.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:O?r("没有匹配「{kw}」的出口",{kw:h.trim()}):r("没有匹配当前筛选的出口")})});const J=[];let ie="";for(const ge of G){const ee=tl(ge);if(ee!==ie){ie=ee;const fe=oD().find(te=>te.key===ee);J.push(s.jsx("tr",{className:"tr-group",children:s.jsxs("td",{colSpan:$.length,children:[s.jsx("span",{className:"prov-tag",children:fe?.label??ee}),r("{n} 个",{n:W.get(ee)??0}),fe?.note?s.jsxs("span",{className:"font-normal",children:[" · ",fe.note]}):null]})},`group:${ee}:${J.length}`))}J.push(ae(ge))}return s.jsx(s.Fragment,{children:J})}return s.jsx(s.Fragment,{children:s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("代理池")}),s.jsx("span",{className:"panel-sub",children:A?r("{n} 个出口",{n:C.length}):r("加载中…")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅与 Clash 的出口自动镜像进来")}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>d(!0),children:r("设置")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>p(!0),children:t.length?r("订阅管理({n})",{n:t.length}):r("订阅管理")}),s.jsx(se,{variant:"outline",disabled:e.syncing||e.batchBusy,onClick:()=>{IY()},children:e.syncing?r("同步中…"):r("同步 Clash Verge")}),s.jsx(se,{variant:"outline",disabled:e.loading||e.batchBusy,onClick:()=>{fp(),Ml()},children:e.loading?r("刷新中…"):r("刷新")}),s.jsx(se,{variant:"default",disabled:e.batchBusy,onClick:()=>o({item:null}),children:r("+ 新增代理")})]})]}),s.jsx("div",{className:"px-3 pt-3",children:s.jsx(tD,{showPortRange:!0})}),R>0?s.jsxs("div",{className:"batch-bar active",children:[s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{children:R})," ",r("个 · 共")," ",s.jsx("b",{children:Q.length})," ",r("个")]}),I?s.jsx("span",{className:"batch-hidden",children:r("其中 {n} 条是同步来的只读条目(Clash / 订阅):可参与批量测试,删除会跳过",{n:I})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>{zY()},children:P?r("测试中 {done}/{total}",{done:P.done,total:P.total}):r("批量测试")}),s.jsx(se,{variant:"destructive",disabled:e.batchBusy,onClick:()=>{BY()},children:r("批量删除")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>DY(),children:r("取消选择")})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 border-b border-border px-4 py-[10px]",children:[s.jsxs(Ci,{className:"w-[clamp(150px,22vw,220px)]",children:[s.jsx(Ei,{type:"search",value:h,"aria-label":r("搜索节点"),placeholder:r("搜索名称 / 地址 / 端口"),onChange:J=>b(J.currentTarget.value)}),s.jsx(Ti,{align:"inline-start","aria-hidden":"true",children:s.jsx(vX,{})})]}),s.jsxs(ft,{value:w,onValueChange:B,children:[s.jsx(mt,{className:"w-[clamp(150px,18vw,210px)]","aria-label":r("按提供方筛选"),children:s.jsx(pt,{children:_.find(J=>J.value===w)?.label??r("全部提供方")})}),s.jsx(ht,{children:_.map(J=>s.jsx(qe,{value:J.value,children:s.jsxs("span",{className:"flex w-full items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate"+(J.count?"":" text-subtle"),children:J.label}),s.jsx("span",{className:"flex-none text-[11px] text-subtle",children:J.count})]})},J.value))})]}),s.jsx(In,{options:gX(C),value:y,onValueChange:z,"aria-label":r("按来源筛选")}),s.jsx(In,{options:xX(C),value:S,onValueChange:N,"aria-label":r("按状态筛选")}),s.jsx("span",{className:"ml-auto text-[11px] text-subtle",children:r("显示 {n} / 共 {total} 个出口",{n:Q.length,total:C.length})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table proxies-table",children:[s.jsx("colgroup",{children:$.map(J=>s.jsx("col",{"data-col":J.key,className:dX[J.key]||void 0},J.key))}),s.jsx("thead",{children:s.jsx("tr",{children:$.map(J=>s.jsx("th",{"data-col":J.key,className:`ta-${J.align}`,children:J.key==="pick"?s.jsx(Mr,{checked:X,indeterminate:q,disabled:!K.length,title:r("全选当前筛选出的出口"),"aria-label":r("全选当前筛选出的出口"),onCheckedChange:ie=>MY(K,ie)}):J.label},J.key))})}),s.jsx("tbody",{children:ce()})]})}),s.jsx(Li,{leading:s.jsxs(s.Fragment,{children:[e.data?.clash&&e.data.clash.available===!1?s.jsx("span",{className:"text-subtle",children:e.data.clash.error?r("未检测到 Clash Verge:{reason}",{reason:e.data.clash.error}):r("未检测到 Clash Verge")}):null,e.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:e.error})}):null]}),total:Q.length,page:F.page,pageCount:F.pageCount,size:F.size,onSizeChange:F.setSize,onPageChange:F.goto,range:F.paged?{start:F.rangeStart,end:F.rangeEnd}:null}),a?s.jsx(VY,{item:a.item,onClose:()=>o(null)}):null,c?s.jsx(FY,{onClose:()=>d(!1)}):null,f?s.jsx(iX,{onClose:()=>p(!1)}):null]})})}function tl(e){return e.source==="clash"?"clash":e.source==="subscription"?"subscription":"manual"}function oD(){return[{key:"manual",label:r("手动"),note:r("本页可编辑、可删除")},{key:"clash",label:"Clash Verge",note:r("名字与端口在 Clash Verge 里改;启用可在本页关闭")},{key:"subscription",label:r("订阅"),note:r("名字与端口跟随订阅与内核;启用可在本页关闭")}]}function gX(e){const t=a=>e.filter(o=>tl(o)===a).length;return[{value:"all",label:r("全部"),count:e.length},{value:"manual",label:r("手动"),count:t("manual")},{value:"clash",label:"Clash",count:t("clash")},{value:"subscription",label:r("订阅"),count:t("subscription")}]}function iD(e){return e.enabled===!1?"off":e.port===null||e.port===void 0?"wait":e.lastTest?.at?e.lastTest.success?"ok":"fail":"none"}function xX(e){const t=a=>e.filter(o=>iD(o)===a).length;return[{value:"all",label:r("全部状态"),count:e.length},{value:"ok",label:r("可用"),count:t("ok")},{value:"fail",label:r("失败"),count:t("fail")},{value:"wait",label:r("未就绪"),count:t("wait")},{value:"off",label:r("已禁用"),count:t("off")}]}const cD="__orphan";function bX(e,t){const a=e.filter(d=>tl(d)==="subscription"),o=t.map(d=>({value:d.id,label:d.name||d.id,count:a.filter(f=>!f.orphan&&f.providerId===d.id).length})).sort((d,f)=>f.count-d.count||d.label.localeCompare(f.label)),c=a.filter(d=>d.orphan).length;return[{value:"all",label:r("全部提供方"),count:e.length},{value:"manual",label:r("手动"),count:e.filter(d=>tl(d)==="manual").length},{value:"clash",label:"Clash Verge",count:e.filter(d=>tl(d)==="clash").length},{value:"subscription",label:r("全部订阅"),count:a.length},...o,...c?[{value:cD,label:r("已移除的订阅"),count:c}]:[]]}function vX(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]})}window.wbProxiesPanel={load:async()=>{await fp(),await Ml()},visibleColumns:()=>lD().map(e=>({key:e.key}))};const uD='.page[data-page="proxies"]';function dD(){const e=document.querySelector(uD);!e||e.dataset.mounted==="1"||(e.dataset.mounted="1",e.replaceChildren(),vn.createRoot(e).render(s.jsx(hX,{})),tr().wbApp?.currentPage==="proxies"&&(fp(),Ml()))}document.querySelector(uD)?dD():document.addEventListener("DOMContentLoaded",dD,{once:!0});const sx=["today","7","30","month","all","custom"],b0="7",v0="custom",fD="workbuddy-desktop-report-range",pD="workbuddy-desktop-report-custom-range",mD={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部"),custom:r("自定义区间")},yX={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部"),custom:r("自定义")};function wX(){try{const e=localStorage.getItem(fD);return e!==null&&sx.includes(e)?e:b0}catch{return b0}}function y0(e){const t=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function jX(){const e=new Date;return{start:y0(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),end:y0(e)}}const rx=/^\d{4}-\d{2}-\d{2}$/;function SX(){try{const e=localStorage.getItem(pD);if(e){const t=JSON.parse(e),a=typeof t?.start=="string"?t.start:"",o=typeof t?.end=="string"?t.end:"";if(rx.test(a)&&rx.test(o)&&a<=o)return{start:a,end:o}}}catch{}return jX()}function NX(e){try{localStorage.setItem(pD,JSON.stringify(e))}catch{}}const kX=[[0,r("一")],[2,r("三")],[4,r("五")]],hD=400;function Qi(e){const t=w0();return t.formatInt?t.formatInt(e):(Number(e)||0).toLocaleString("zh-CN")}function w0(){return window.wbUnits||{}}function ss(e){const t=w0();return t.formatTokens?t.formatTokens(e):String(Number(e)||0)}function gD(e,t){const a=w0();return a.formatAxis?a.formatAxis(e,t):String(e)}function Zi(e){return`${((Number(e)||0)*100).toFixed(1)}%`}function Pt(e){return Math.round(e*10)/10}function ax(e){return[...e].reduce((t,a)=>t+(/[\u2e80-\u9fff]/.test(a)?9.7:5.4),0)}function lx(e){const[t,a,o]=String(e||"").split("-").map(Number);return new Date(t||1970,(a||1)-1,o||1)}const CX=[r("日"),r("一"),r("二"),r("三"),r("四"),r("五"),r("六")];function ox(e){const t=lx(e);return r("{m}月{d}日 周{wd}",{m:t.getMonth()+1,d:t.getDate(),wd:CX[t.getDay()]})}function xD(e){const t=String(e||"").slice(11,13);return t?`${t}:00`:"—"}const TX=8;function bD(e,t){const a=(Array.isArray(e)?e:[]).map(d=>({name:String(d?.label??d?.model??"").trim()||r("未知模型"),tokens:Number(d?.tokens)||0})).filter(d=>d.tokens>0);if(!a.length)return[];const o=a.slice(0,TX),c=o.map(d=>`${t?`[${t(d.name)}]`:""}${r("{model}:{tokens} tokens",{model:d.name,tokens:ss(d.tokens)})}`);return a.length>o.length&&c.push(r("…还有 {n} 个模型",{n:a.length-o.length})),c}function vD(e,t){return[ox(e.date),r("总 Token:{tokens}({n} 次请求)",{tokens:ss(e.tokens),n:Qi(e.requests)}),...bD(e.models,t)].join(` -`)}function EX(e,t){return[`${ox(String(e.hour).slice(0,10))} ${xD(e.hour)}`,r("命中率 {rate}(命中 {hit} / 输入 {input})",{rate:Zi(e.rate),hit:ss(e.hitTokens),input:ss(e.inputTokens)}),r("总 Token:{tokens}",{tokens:ss(e.totalTokens)}),...bD(e.models,t)].join(` -`)}const AX=[1,1.5,2,2.5,3,4,5,6,8,10];function RX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;return(AX.find(c=>c>=a-1e-9)??10)*t}function j0(e){return RX(e/4)*4}function OX(e,t,a){const o=e||{},c=o.topModel,d=Number(o.requests)||0,f=Number(o.successful)||0,p=d?`${(f/d*100).toFixed(1)}%`:"—",h=[{key:"requests",label:r("总请求数"),value:Qi(d),sub:mD[t]||"",mono:!1},{key:"successful",label:r("成功请求数"),value:Qi(f),sub:r("成功率 {rate}",{rate:p}),mono:!1},{key:"tokens",label:r("总 Token"),value:ss(o.tokens),sub:r("输入 + 输出"),mono:!1},{key:"activeDays",label:r("活跃天数"),value:Qi(o.activeDays),sub:r("区间共 {n} 天",{n:a}),mono:!1},{key:"streak",label:r("当前连续天数"),value:Qi(o.streak),sub:r("含今天在内往前数"),mono:!1}];return h.push(c?{key:"topModel",label:r("Top 模型"),value:String(c.model??""),sub:r("{tokens} tokens · 占 {pct}",{tokens:ss(c.tokens),pct:Zi(c.percentage)}),mono:!0}:{key:"topModel",label:r("Top 模型"),value:"—",sub:r("所选范围内还没有模型用量"),mono:!1}),h}function yD(e){if(!Array.isArray(e))return null;const t=e.map(c=>({id:String(c?.id??"").trim(),label:String(c?.label??"").trim(),tokens:Number(c?.totalTokens??c?.tokens)||0})).filter(c=>c.tokens>0);if(!t.length)return[];const a=t.reduce((c,d)=>c+d.tokens,0),o=c=>a?c/a*100:0;return[...t].sort((c,d)=>d.tokens-c.tokens).map((c,d)=>{const f=o(c.tokens),p=ss(c.tokens),h=c.label||c.id||r("未知"),b=c.id?r("{name}({id})",{name:h,id:c.id}):h;return{key:`${d}-${c.id||h}`,id:c.id,name:h,full:b,tip:r("{name}:{tokens} tokens · 占 {pct}%",{name:b,tokens:p,pct:f.toFixed(1)}),tokensText:p,percentText:`${f.toFixed(1)}%`,barWidth:`${f.toFixed(1)}%`}})}function wD(e){return`${ss(e.reduce((t,a)=>t+(Number(a?.totalTokens??a?.tokens)||0),0))} tokens`}const ix=["#f73b00","#f7bb07","#4aaa4d","#1872cb","#3444a3","#13c2c2","#722ed1","#eb2f96","#a0d911","#34d399","#d946ef","#ff85c0","#b37feb","#9d174d","#ffa39e","#69b1ff"],MX={size:220,inner:.62,outer:.88,padAngle:2};function DX(e,t,a,o,c,d){const f=D=>(D-90)*Math.PI/180,p=(D,C)=>[Pt(e+D*Math.cos(f(C))),Pt(t+D*Math.sin(f(C)))],h=d-c;if(h>=359.999){const[D,C]=p(a,0),[A,R]=p(a,180),[I,P]=p(o,0),[O,_]=p(o,180);return`M ${D} ${C} A ${a} ${a} 0 1 1 ${A} ${R} A ${a} ${a} 0 1 1 ${D} ${C} Z M ${I} ${P} A ${o} ${o} 0 1 0 ${O} ${_} A ${o} ${o} 0 1 0 ${I} ${P} Z`}const[b,y]=p(a,c),[v,w]=p(a,d),[j,S]=p(o,d),[N,k]=p(o,c),T=h>180?1:0;return`M ${b} ${y} A ${a} ${a} 0 ${T} 1 ${v} ${w} L ${j} ${S} A ${o} ${o} 0 ${T} 0 ${N} ${k} Z`}const IX="#9aa0a6";function jD(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=String(a?.label??a?.model??a?.id??"").trim();!o||t.has(o)||(Number(a?.totalTokens??a?.tokens)||0)>0&&t.set(o,ix[t.size%ix.length])}return t}function SD(e,t){const a=(Array.isArray(e)?e:[]).map(k=>({label:String(k?.label??k?.model??k?.id??"").trim()||t,tokens:Number(k?.totalTokens??k?.tokens)||0,requests:Number(k?.requests)||0})).filter(k=>k.tokens>0);if(!a.length)return null;const o=a.reduce((k,T)=>k+T.tokens,0);if(!o)return null;const c=jD(e),{size:d,inner:f,outer:p,padAngle:h}=MX,b=d/2,y=d/2,v=d/2*p,w=d/2*f;let j=0;const S=[],N=[];return a.forEach((k,T)=>{const D=k.tokens/o,C=D*360,A=a.length>1?Math.min(h/2,C/4):0,R=j+A,I=j+C-A;j+=C;const P=c.get(k.label)??ix[T%ix.length];let O=null;if(D>=.03){const _=(R+I)/2,L=w+(v-w)*.6,H=(_-90)*Math.PI/180;O={x:Pt(b+L*Math.cos(H)),y:Pt(y+L*Math.sin(H)),text:`${Math.round(D*100)}%`}}I>R&&S.push({key:`${T}-${k.label}`,d:DX(b,y,v,w,R,I),fill:P,evenOdd:C>=359.999,label:O,tip:`${k.label} · ${ss(k.tokens)} tokens · ${Zi(D)}`}),N.push({key:`${T}-${k.label}`,fill:P,name:k.label,tokensText:ss(k.tokens),percentText:Zi(D),tip:r("{name} · {tokens} tokens · {n} 次请求 · {pct}",{name:k.label,tokens:ss(k.tokens),n:Qi(k.requests),pct:Zi(D)})})}),{size:d,slices:S,legend:N,totalText:ss(o)}}const PX=[1,1.25,1.5,2,2.5,3,4,5,6,8,10];function _X(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;let o=1;for(const c of PX)c<=a+1e-9&&(o=c);return o*t}function LX(e){const t=Number(e)||0;if(t<=0)return[0,1,2,3,1/0];const a=Math.max(1,_X(t/4));return[0,a,a*2,a*3,1/0]}function zX(e,t){if(e===0)return"0";const a=t[e-1],o=t[e];return Number.isFinite(o)?a===0?`≤${ss(o)}`:`${ss(a)}–${ss(o)}`:`>${ss(a)}`}function ND(e){const t=Array.isArray(e)?e:[];return LX(t.reduce((a,o)=>Math.max(a,Number(o?.tokens)||0),0))}function BX(e,t){const a=Array.isArray(e)?e:[];if(!a.length)return null;const o=(lx(a[0].date).getDay()+6)%7,c=new Array(o).fill(null).concat(a),d=Math.ceil(c.length/7),f=3,p=20,h=t-p,b=Math.floor((h-f*(d-1))/d),y=Math.max(7,Math.min(26,b)),v=y+3,w=y+f,j=p+d*w-f,S=Math.max(0,Math.round((t-j)/2)),N=v+7*w-f+2,k=Math.max(j,Math.round(t)),T=ND(a),D=O=>T.findIndex(_=>Number(O)<=_),C=[];for(let O=0;O({key:_,x:S+p-6,y:Pt(v+O*w+y/2),text:_})),R=[];let I=-1,P=-9;for(let O=0;O({level:t,text:zX(t,e)}))}function UX(e){const t=e||{};return[["last10m",r("近 10 分钟")],["last1h",r("近 1 小时")],["last24h",r("近 24 小时")],["last7d",r("近 7 天")]].map(([o,c])=>{const d=t[o]||{},f=Number(d.inputTokens)||0;return{key:o,label:c,value:f?Zi(d.rate):"—",sub:r("命中 {hit} / 输入 {input}",{hit:ss(d.hitTokens),input:ss(f)})}})}function VX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=230,d={left:44,right:56,top:26,bottom:24},f=Math.max(40,t-d.left-d.right),p=c-d.top-d.bottom,h=o.map(q=>Number(q.rate)||0),b=o.map(q=>Number(q.totalTokens)||0),y=Math.max(1,j0(Math.max(...h))),v=Math.max(...b),w=j0(v),j=v>0,S=q=>d.left+(o.length>1?f*q/(o.length-1):f/2),N=q=>d.top+p-p*q/y,k=q=>d.top+p-p*q/w,T=[],D=[],C=[];for(let q=0;q<=4;q+=1){const $=y*q/4,Y=Pt(N($)),F=$*100;T.push({key:`g${q}`,y:Y}),D.push({key:`r${q}`,x:d.left-8,y:Y,anchor:"end",text:`${Number.isInteger(F)?F:F.toFixed(1)}%`}),j&&C.push({key:`t${q}`,x:Pt(d.left+f+8),y:Y,anchor:"start",text:gD(w*q/4,w)})}const A=o.length===1?4.5:2.5,R=(q,$)=>({points:q.map((Y,F)=>`${Pt(S(F))},${Pt($(Y))}`).join(" "),dots:q.map((Y,F)=>({key:`d${F}`,cx:Pt(S(F)),cy:Pt($(Y))}))}),I=[],P=(q,$,Y,F)=>{const G=ax(Y),W=F==="middle"?q-G/2:F==="end"?q-G:q,le={left:W,right:W+G,top:$-8.5,bottom:$+2.5};return I.some(M=>le.leftM.left-2&&le.topM.top-1)?null:(I.push(le),{key:`${Y}-${q}-${$}`,x:Pt(q),y:Pt($),text:Y,anchor:F})},O=(q,$)=>{const Y=ax($)/2;return q-Yd.left+f+6?"end":"middle"},_=[];j&&o.forEach((q,$)=>{if(!(Number(q.totalTokens)>0))return;const Y=k(b[$]),F=Y-12>=d.top-10,G=ss(b[$]),W=P(S($),F?Y-12:Y+13,G,O(S($),G));W&&_.push({...W,key:`tl${$}`})});const L=[];o.forEach((q,$)=>{if(!((Number(q.inputTokens)||0)+(Number(q.hitTokens)||0)>0))return;const F=N(h[$]),G=F+15<=d.top+p+8,W=Zi(h[$]),le=P(S($),G?F+13:F-7,W,O(S($),W));le&&L.push({...le,key:`rl${$}`})});const H=o.length>1?f/(o.length-1):f,B=d.left,z=d.left+f,Q=o.length<=hD?o.map((q,$)=>{const Y=Math.max(B,S($)-H/2),F=Math.min(z,S($)+H/2);return{key:`h${$}`,x:Pt(Y),width:Pt(F-Y),tip:EX(q,a)}}):null,K=Math.max(1,Math.ceil(o.length/8)),X=[];for(let q=0;q=o.length;X.push({key:`x${q}`,x:Pt(S(q)),y:c-8,anchor:q===0?"start":$?"end":"middle",text:xD(o[q].hour)})}return{width:t,height:c,plotLeft:B,plotW:f,plotH:p,plotTop:d.top,grid:T,rateTicks:D,tokenTicks:C,rateLine:R(h,N),tokenLine:j?R(b,k):null,dotR:A,rateLabels:L,tokenLabels:_,hourTicks:X,hits:Q}}const FX=13;function $X(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=240,d={left:50,right:14,top:26,bottom:26},f=Math.max(40,t-d.left-d.right),p=f/o.length,h=o.map(K=>Number(K.tokens)>0?ss(K.tokens):""),b=Math.max(0,...h.map(ax)),y=h.every(K=>!K)||b+4<=p,v=!y&&p>=FX;v&&(d.top=10+Math.ceil(b*1.25));const w=c-d.top-d.bottom,j=o.map(K=>Number(K.tokens)||0),S=Math.max(...j),N=j0(S),k=Math.max(1,Math.min(28,p*.68)),T=d.top+w,D=K=>d.top+w-w*K/N,C=o.length<=hD,A=S<=0,R=[],I=[];if(!A)for(let K=0;K<=4;K+=1){const X=N*K/4,q=Pt(D(X));R.push({key:`g${K}`,x1:d.left,y:q,x2:Pt(d.left+f)}),I.push({key:`v${K}`,x:d.left-8,y:q,anchor:"end",text:gD(X,N)})}const P=[];o.forEach((K,X)=>{const q=Number(K.tokens)||0;if(q<=0)return;const $=D(q);P.push({key:String(K.date??X),x:Pt(d.left+p*X+(p-k)/2),y:Pt($),width:Pt(k),height:Pt(Math.max(1,T-$)),rx:k>4?2:1,tip:vD(K),nativeTip:!C})});const O=[],_=[],L=(K,X)=>{const q=h[K],$=D(Number(o[K].tokens)||0),Y=Pt(d.left+p*K+p/2);if(v)return{key:`b${K}`,x:Y,y:Pt($-6),anchor:"start",text:q,rotate:!0};const F=$-6,G=F-9M.leftU.left-2&&M.topU.top-1))return null;_.push(M)}return{key:`b${K}`,x:Y,y:W,anchor:"middle",text:q}};if(y||v)h.forEach((K,X)=>{if(!K)return;const q=L(X,!1);q&&O.push(q)});else{const K=o.map((X,q)=>({index:q,value:Number(X.tokens)||0})).filter(X=>X.value>0).sort((X,q)=>q.value-X.value);for(const X of K){if(O.length>=8)break;const q=L(X.index,!0);q&&O.push(q)}}const H=C?o.map((K,X)=>({key:`h${X}`,x:Pt(d.left+p*X),width:Pt(p),tip:vD(K,a)})):null,B=Math.max(1,Math.ceil(o.length/6)),z=[];for(let K=0;K{const X=o.length===1,q=!X&&K===o.length-1,$=lx(o[K].date);return{key:`d${K}`,x:X?d.left+f/2:q?d.left+f:Pt(d.left+p*K+p/2),y:c-8,anchor:X?"middle":q?"end":K===0?"start":"middle",text:`${$.getMonth()+1}/${$.getDate()}`}});return{width:t,height:c,plotLeft:d.left,plotW:f,plotH:w,plotTop:d.top,grid:R,valueTicks:I,bars:P,barLabels:O,dateTicks:Q,hits:H,blank:A}}function Wi(){return window}const kD=1e3,qX=sx.map(e=>({value:e,label:yX[e]})),GX=r("所选范围内每个账号各消耗了多少 Token,按 Token 用量从多到少排。账号是比提供商更细的一维:同一家可以挂多个账号,转发时按优先级在候选链上依次尝试,所以这里反映的是「具体哪个登录态在出力」。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知账号」是指那批请求没有账号身份:走默认登录态转发(未配置账号列表)时会这样;这一维上线前写出的旧聚合行也没有账号明细,但它们会在升级导入旧数据时按明细自动补算回来 —— 只有明细已被手动清理掉的那几天补不回来,仍留在「未知账号」里,那是确实无从恢复的部分。"),KX=r("所选范围内每个提供商各消耗了多少 Token,按 Token 用量从多到少排。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了(请求体非法、模型不存在、没有可用账号)。这一维与账号那一维不同:旧明细里根本没有「哪家承载」的信息(早期版本只有单一上游,但那是配置事实而非逐条记录),所以无法回算,旧数据会一直留在「未知」里;此后新产生的请求都会记上具体的提供商。"),YX=r("所选范围内每个模型各消耗了多少 Token,按用量从多到少排,扇区角度即占比。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该模型的 Token 用量与百分比。扇区内的百分比只在 ≥3% 时标出,更小的会挤成一团 —— 完整读数在右侧列表与悬停气泡里。颜色按用量排名分配:最大的那段是红色,依次往后;同一份报表里换个维度看,配色口径不变。"),XX=r("所选范围内每个提供商各消耗了多少 Token,按用量从多到少排,扇区角度即占比。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该提供商的 Token 用量与百分比。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了。"),QX=r("命中率 = 缓存读取 Token / 输入 Token(promptTokens)。窗口越短越贴近「此刻」:上游把缓存读取与输入分开上报时,该比值合法地可能超过 100%,此处不夹取值、如实展示。"),ZX=r("每天的总 Token 用量(输入 + 输出)。柱顶标出当天的读数;区间很长、柱子挤到放不下时只标最高的那几天,其余悬停柱子即可读到。");let cx=kD,ux=!0,S0=!1,N0=!1,k0=0,Po=null,Ji=null,dx=null;function ec(e,t="empty"){return s.jsx("div",{className:t,style:{padding:"14px 0"},children:e})}function fx({text:e}){return s.jsx("span",{className:"tip-q","data-tip":e})}function WX({accountId:e}){const t=(Wi().wbApp?.getState?.()?.accounts?.accounts||[]).find(f=>f?.id===e),a=typeof t?.provider=="string"?t.provider:"";if(!a)return null;const o=Wi().wbProviders?.labelOf?.(a)||a,c=t&&Wi().wbAccountsModel?.editionSuffix?.(t)||"",d=c?`${o} ${c}`:o;return s.jsx("span",{className:`pbadge p-${a}`,title:r("提供商:{text}",{text:d}),children:d})}function JX({summary:e,range:t}){const a=Array.isArray(e.dailyTrend)?e.dailyTrend:[];return s.jsx(s.Fragment,{children:OX(e.overview,t,a.length).map(o=>s.jsxs("div",{className:"field",children:[s.jsx("div",{className:"label",children:o.label}),s.jsxs("div",{className:o.mono?"value mono":"value",children:[o.value,o.sub?s.jsx("div",{className:"sub",children:o.sub}):null]})]},o.key))})}function CD({panelId:e,listId:t,labelId:a,title:o,tip:c,rows:d,totalText:f,withBadge:p,emptyText:h}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:o}),s.jsx(fx,{text:c}),s.jsx("span",{className:"panel-sub",id:a,children:f})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"rank-shares",id:t,children:d.length?d.map(b=>s.jsxs("div",{className:"rank-row","data-tip":b.tip,children:[s.jsxs("span",{className:"name",title:b.full,children:[p?s.jsx(WX,{accountId:b.id}):null,b.name]}),s.jsx("span",{className:"track",children:s.jsx("span",{className:"bar",style:{width:b.barWidth}})}),s.jsx("span",{className:"num",title:`${b.tokensText} tokens`,children:b.tokensText}),s.jsx("span",{className:"pct",children:b.percentText})]},b.key)):ec(h)})})]})}function TD({panelId:e,listId:t,title:a,tip:o,ariaLabel:c,view:d,emptyText:f}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:a}),s.jsx(fx,{text:o})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{id:t,children:d?s.jsxs("div",{className:"donut-layout",children:[s.jsxs("div",{className:"donut-wrap",children:[s.jsx("svg",{className:"donut-svg",width:d.size,height:d.size,viewBox:`0 0 ${d.size} ${d.size}`,role:"img","aria-label":c,children:d.slices.map(p=>s.jsxs(x.Fragment,{children:[s.jsx("path",{className:"donut-slice",d:p.d,fill:p.fill,fillRule:p.evenOdd?"evenodd":void 0,tabIndex:-1,"data-tip":p.tip}),p.label?s.jsx("text",{className:"donut-label",x:p.label.x,y:p.label.y,textAnchor:"middle",dominantBaseline:"central",children:p.label.text}):null]},p.key))}),s.jsxs("div",{className:"donut-center",children:[s.jsx("div",{className:"donut-center-value",children:d.totalText}),s.jsx("div",{className:"donut-center-label",children:r("总 Token")})]})]}),s.jsx("div",{className:"donut-legend",children:d.legend.map(p=>s.jsxs("div",{className:"donut-legend-row","data-tip":p.tip,children:[s.jsx("span",{className:"donut-dot",style:{background:p.fill}}),s.jsx("span",{className:"donut-legend-name",title:p.name,children:p.name}),s.jsx("span",{className:"donut-legend-tokens",children:p.tokensText}),s.jsx("span",{className:"donut-legend-percent",children:p.percentText})]},p.key))})]}):ec(f)})})]})}function eQ({view:e}){return s.jsxs("svg",{className:"report-svg",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,role:"img","aria-label":r("近 365 天活跃热力图"),children:[e.months.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:10,children:t.text},t.key)),e.weekdays.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:t.y,textAnchor:"end",dominantBaseline:"middle",children:t.text},t.key)),e.cells.map(t=>s.jsx("rect",{className:`hm-cell l${t.level}`,x:t.x,y:t.y,width:t.size,height:t.size,rx:2,tabIndex:-1,"data-tip":t.tip},t.key))]})}function ED({line:e,cls:t,radius:a}){return s.jsxs(s.Fragment,{children:[s.jsx("polyline",{className:`chart-line ${t}`,points:e.points}),e.dots.map(o=>s.jsx("circle",{className:`chart-dot ${t}`,cx:o.cx,cy:o.cy,r:a},o.key))]})}function C0({items:e,cls:t}){return s.jsx(s.Fragment,{children:e.map(a=>s.jsx("text",{className:`chart-label ${t}`,x:a.x,y:a.y,textAnchor:a.anchor,transform:a.rotate?`rotate(-90 ${a.x} ${a.y})`:void 0,dominantBaseline:a.rotate?"central":void 0,children:a.text},a.key))})}function tQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("近 24 小时缓存命中率与总 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:o,y1:p.y,x2:Pt(o+c),y2:p.y},p.key)),e.rateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenLine?s.jsx(ED,{line:e.tokenLine,cls:"tokens",radius:e.dotR}):null,s.jsx(ED,{line:e.rateLine,cls:"rate",radius:e.dotR}),s.jsx(C0,{items:e.tokenLabels,cls:"tokens"}),s.jsx(C0,{items:e.rateLabels,cls:"rate"}),e.hourTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key))]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}function nQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("按天 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:p.x1,y1:p.y,x2:p.x2,y2:p.y},p.key)),e.valueTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.bars.map(p=>p.nativeTip?s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx,children:s.jsx("title",{children:p.tip})},p.key):s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx},p.key)),s.jsx(C0,{items:e.barLabels,cls:"tokens"}),e.dateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key)),e.blank?s.jsx("text",{className:"chart-empty",x:Pt(o+c/2),y:Pt(d+f/2),textAnchor:"middle",children:r("所选范围内暂无请求")}):null]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}const sQ=680;function T0(){const e=x.useRef(null),[t,a]=x.useState(0);return x.useLayoutEffect(()=>{const o=e.current;if(!o)return;let c=o.clientWidth;if(c&&a(c),typeof ResizeObserver!="function")return;const d=new ResizeObserver(()=>{const f=o.clientWidth;!f||f===c||(c=f,a(f))});return d.observe(o),()=>d.disconnect()},[]),[e,t||sQ]}async function AD(){if(!S0)try{const e=await Wi().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="reportAutoRefresh");E0(t||null),S0=Array.isArray(e?.tasks)}catch(e){console.warn("读取报表自动刷新间隔失败,按默认 1 秒:",e instanceof Error?e.message:e),E0(null)}}function E0(e){S0=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(ux=e.enabled!==!1,cx=e.unit==="minutes"?t*6e4:t*1e3):(ux=!0,cx=kD),Ji?.applyAutoConfig(cx,ux)}const rQ={summary:null,error:null};function aQ(){const[e,t]=x.useState(rQ),[a,o]=x.useState(wX),[c,d]=x.useState(SX),[f,p]=x.useState(()=>({ms:cx,enabled:ux})),[,h]=x.useState(0),b=x.useRef(a),y=x.useRef(c),v=x.useCallback(G=>{t(G)},[]),w=x.useCallback(async(G={})=>{AD();const W=++k0,le=b.current,M=le===v0?y.current:void 0;try{const U=Wi().workbuddyDesktop;if(!U)throw new Error("后端桥不可用");const Z=await U.getStatsSummary(le,M);if(W!==k0)return Po;if(!Z||typeof Z!="object")throw new Error("后端未返回报表数据");return Po=Z,v({summary:Z,error:null}),Po}catch(U){if(W!==k0)return Po;const Z=U instanceof Error?U.message:"";return Po=null,G.silent||console.warn("读取报表数据失败:",Z),v({summary:null,error:Z||r("未知错误")}),null}},[v]),j=x.useCallback(G=>{G!==void 0&&(Po=G||null,G&&v({summary:G,error:null}))},[v]),S=x.useCallback(G=>{const W=sx.includes(G)?G:b0;if(W!==b.current){b.current=W,o(W);try{localStorage.setItem(fD,W)}catch{}w()}},[w]),N=x.useCallback(G=>{const W={...y.current,...G};if(!rx.test(W.start)||!rx.test(W.end))return;const le=W.start<=W.end?W:G.start?{start:W.start,end:W.start}:{start:W.end,end:W.end};y.current=le,d(le),NX(le),b.current===v0&&w()},[w]);x.useEffect(()=>{if(Ji={load:w,render:j,applyAutoConfig:(G,W)=>p({ms:G,enabled:W})},dx){const G=dx;dx=null,j(G.data)}return Wi().wbApp?.currentPage==="overview"&&w({silent:!0}),()=>{Ji=null}},[w,j]),x.useEffect(()=>{if(!f.enabled||f.ms<=0)return;const G=window.setInterval(()=>{document.hidden||Wi().wbApp?.currentPage!=="overview"||N0||(N0=!0,w({silent:!0}).finally(()=>{N0=!1}))},f.ms);return()=>{window.clearInterval(G)}},[f,w]),x.useEffect(()=>{const G=()=>h(W=>W+1);return window.addEventListener("wb-units-changed",G),()=>window.removeEventListener("wb-units-changed",G)},[]);const k=T0(),T=T0(),D=T0(),{summary:C,error:A}=e,R=C&&sx.includes(C.range??"")?C.range:a,I=C&&Array.isArray(C.heatmap)?C.heatmap:[],P=C&&Array.isArray(C.cacheTrend24h)?C.cacheTrend24h:[],O=C&&Array.isArray(C.dailyTrend)?C.dailyTrend:[],_=C&&Array.isArray(C.providers)?C.providers:null,L=C&&Array.isArray(C.accounts)?C.accounts:null,H=C&&Array.isArray(C.models)?C.models:null,B=A?ec(r("读取报表失败:{error}",{error:A}),"empty report-error"):null,z=ec(r("正在加载…")),Q=B??z,K=x.useMemo(()=>jD(H||[]),[H]),X=x.useCallback(G=>K.get(G)||IX,[K]),q=C?BX(I,k[1]):null,$=C?VX(P,T[1],X):null,Y=C?$X(O,D[1],X):null,F=y0(new Date);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("统计概览")}),s.jsx("span",{className:"panel-sub",id:"report-range-label",children:mD[R]||""}),s.jsxs("div",{className:"head-actions",children:[s.jsx(In,{options:qX,value:a,onValueChange:S,"aria-label":r("报表时间范围")}),a===v0?s.jsxs("span",{className:"report-date-range",children:[s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.start,max:c.end||F,"aria-label":r("开始日期"),title:r("起始日期(含当天)"),onChange:G=>N({start:G.target.value})}),s.jsx("span",{className:"report-date-sep","aria-hidden":"true",children:"~"}),s.jsx($e,{type:"date",className:"report-date-input w-[132px]",value:c.end,min:c.start||void 0,max:F,"aria-label":r("结束日期"),title:r("结束日期(含当天)"),onChange:G=>N({end:G.target.value})})]}):null]})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-overview",children:C?s.jsx(JX,{summary:C,range:R}):Q})})]}),s.jsxs("div",{className:"report-rank-grid",children:[L?s.jsx(CD,{panelId:"report-accounts-panel",listId:"report-accounts",labelId:"report-accounts-label",title:r("Top 账号"),tip:GX,rows:yD(L)||[],totalText:wD(L),withBadge:!0,emptyText:r("所选范围内还没有账号用量")}):null,_?s.jsx(CD,{panelId:"report-providers-panel",listId:"report-providers",labelId:"report-providers-label",title:r("Top 提供商"),tip:KX,rows:yD(_)||[],totalText:wD(_),withBadge:!1,emptyText:r("所选范围内还没有请求记录")}):null]}),s.jsxs("div",{className:"report-donut-grid",children:[H?s.jsx(TD,{panelId:"report-models-panel",listId:"report-models-donut",title:r("模型用量"),tip:YX,ariaLabel:r("模型用量占比"),view:SD(H,r("未知模型")),emptyText:r("所选范围内还没有模型用量")}):null,_?s.jsx(TD,{panelId:"report-providers-pie-panel",listId:"report-providers-donut",title:r("提供商用"),tip:XX,ariaLabel:r("提供商用占比"),view:SD(_,r("未知")),emptyText:r("所选范围内还没有提供商用量")}):null]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活跃热力图")}),s.jsx("span",{className:"panel-sub",children:r("近 365 天,按天 Token 用量着色(档位按本窗口峰值自动定)")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"heat-wrap",id:"report-heatmap",ref:k[0],children:C?q?s.jsx(eQ,{view:q}):ec(r("暂无热力图数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsx("span",{className:"heat-scale-label",children:r("Token")}),s.jsx("span",{className:"heat-legend",id:"report-heat-legend",children:C?HX(ND(I)).map(G=>s.jsxs("span",{className:"heat-legend-item",children:[s.jsx("span",{className:`l${G.level}`}),G.text]},G.level)):null}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("方格为本地自然日,无请求显示为空槽")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("缓存命中率")}),s.jsx(fx,{text:QX})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-cache-rates",children:C?UX(C.cacheRates).map(G=>s.jsxs("div",{className:"field rate",children:[s.jsx("div",{className:"label",children:G.label}),s.jsxs("div",{className:"value big",children:[G.value,s.jsx("div",{className:"sub",children:G.sub})]})]},G.key)):Q})})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("近 24 小时缓存命中率趋势")}),s.jsx("span",{className:"panel-sub",children:r("按本地整点,无请求的整点不标注")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap",id:"report-cache-trend",ref:T[0],children:C?$?s.jsx(tQ,{view:$}):ec(r("暂无缓存趋势数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch rate"}),r("缓存命中率"),s.jsx("span",{className:"axis-hint",children:r("左轴")})]}),s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch tokens"}),r("总 Token"),s.jsx("span",{className:"axis-hint",children:r("右轴")})]}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("无请求的整点按 0% 计,但不写读数")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("按天 Token 趋势")}),s.jsx(fx,{text:ZX}),s.jsx("span",{className:"panel-sub",id:"report-trend-label",children:C?`${C.startDate||"—"} ~ ${C.endDate||"—"}`:"—"})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap tall",id:"report-daily-trend",ref:D[0],children:C?Y?s.jsx(nQ,{view:Y}):ec(r("暂无趋势数据")):Q})})]})]})}async function lQ(e={}){return Ji?Ji.load(e):Po}function oQ(e){if(e!==void 0){if(!Ji){dx={data:e??null};return}Ji.render(e)}}function iQ(){return Po}window.wbReport={load:lQ,render:oQ,lastSummary:iQ,applyAutoRefresh:E0};const RD='.page[data-page="overview"]';let OD=!1;function MD(){if(OD)return;const e=document.querySelector(RD);e&&(OD=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(aQ,{})))}document.querySelector(RD)?MD():document.addEventListener("DOMContentLoaded",MD,{once:!0}),AD();const A0={all:{title:r("全部删除"),desc:r("删除日志记录本身。当前有筛选时只删命中的条目,按天聚合报表不受影响;无筛选时清空全部并重置报表。此方式无法恢复。")},raw:{title:r("仅清空报文原文"),desc:r("保留统计行与报表,只抹掉请求 / 响应正文。清理后详情弹窗的「预览对话」将无原文可看,统计数字分毫不动。")}},cQ=["all","raw"],uQ=3e3;function Dl(){return window}let mp=!1;function hp(e,t){Dl().wbApp?.toast?.(e,t)}function dQ(e){const t=Math.max(0,Number(e)||0);if(t<1024)return`${Math.round(t)} B`;const a=t/1024;if(a<1024)return`${a.toFixed(1)} KB`;const o=a/1024;return o<1024?`${o.toFixed(1)} MB`:`${(o/1024).toFixed(2)} GB`}function R0(){const e=Dl().wbRequestsPanel?.clearParams?.();return typeof e=="string"?e:""}function DD(e){return{all:Number(e?.all)||0,raw:Number(e?.raw)||0,dbBytes:Number(e?.dbBytes)||0,vacuumRunning:e?.vacuumRunning===!0}}function O0(e){return e instanceof Error?e.message:String(e)}function ID(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}function fQ({onClose:e}){const[t,a]=x.useState("all"),[o,c]=x.useState({status:"loading"}),[d,f]=x.useState(""),[p,h]=x.useState(!1),[b,y]=x.useState(!1),v=x.useRef(!0),w=x.useRef(null),j=x.useCallback(I=>{mp=I,y(I)},[]),S=x.useCallback(()=>{w.current!==null&&(window.clearInterval(w.current),w.current=null)},[]),N=x.useCallback(I=>{c({status:"ready",all:I.all,raw:I.raw,dbBytes:I.dbBytes}),h(I.vacuumRunning)},[]),k=x.useCallback(async()=>{const I=Dl().workbuddyDesktop;if(!I)return;let P;try{P=await I.getStatsClearPreview(R0())}catch{return}if(!v.current)return;const O=DD(P);N(O),!O.vacuumRunning&&(S(),f(""),hp(r("✅ 压缩完成")),Dl().wbRequestsPanel?.load?.({silent:!0}))},[N,S]),T=x.useCallback(()=>{w.current===null&&(h(!0),w.current=window.setInterval(()=>{k()},uQ))},[k]);async function D(){c({status:"loading"});try{const I=Dl().workbuddyDesktop;if(!I)throw new Error(r("后端桥不可用"));const P=await I.getStatsClearPreview(R0());if(!v.current)return;const O=DD(P);N(O),O.vacuumRunning&&T()}catch(I){if(!v.current)return;c({status:"failed"}),f(r("预览读取失败:{error}",{error:O0(I)}))}}x.useEffect(()=>(v.current=!0,D(),()=>{v.current=!1,S(),mp=!1}),[]);async function C(){const I=Dl().workbuddyDesktop;if(I){h(!0);try{await I.compactStatsDb(),f(r("压缩已在后台开始,完成后会自动提示")),T()}catch(P){const O=O0(P);if(/409|正在进行/.test(O)){hp(r("压缩已在进行中")),f(r("压缩已在进行中,接上它的进度等待完成")),T();return}h(!1),f(r("压缩失败:{message}",{message:O})),hp(r("压缩失败:{message}",{message:O}),"err")}}}async function A(){if(mp)return;const I=Dl().workbuddyDesktop,P=Dl().wbConfirm?.ask;if(!I||!P)return;const O=A0[t].title,_=R0(),L=_.length>0,H=o.status==="ready"?t==="raw"?o.raw:o.all:0;if(await P({title:r("清理请求日志"),html:L?r("确定按当前筛选执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:ID(O),count:H}):r("确定对全部请求日志执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:ID(O),count:H}),okText:r(t==="raw"?"抹掉原文":"删除"),okClass:"danger"})){j(!0);try{const z=L?`mode=${t}&${_}`:`mode=${t}&all=1`,Q=await I.clearStatsRequests(z),K=Number(Q?.deleted)||0;hp(t==="raw"?r("已抹掉 {count} 条报文原文",{count:K}):r("已删除 {count} 条",{count:K})),j(!1),e(),Dl().wbRequestsPanel?.notifyCleared?.()}catch(z){const Q=O0(z);f(r("清理失败:{message}",{message:Q})),hp(r("清理失败:{message}",{message:Q}),"err"),j(!1)}}}const R=o.status==="ready"?r("将删除 {count} 条日志 · 其中 {raw} 条仍带报文原文 · 数据库占用 {db}",{count:o.all,raw:o.raw,db:dQ(o.dbBytes)}):o.status==="failed"?r("预览读取失败"):r("正在统计…");return s.jsx(Qt,{open:!0,onOpenChange:(I,P)=>{if(!I){if(mp){P.cancel();return}e()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("清理请求日志")})}),s.jsxs(Bt,{children:[s.jsx(Eh,{"aria-label":r("清理方式"),value:t,onValueChange:I=>a(I==="raw"?"raw":"all"),children:cQ.map(I=>{const P=t===I;return s.jsxs("label",{"data-checked":P?"":void 0,className:"group/card grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2.5 gap-y-0.5 rounded-md border border-border px-3 py-2.5 transition-colors duration-150 ease-out hover:border-border-strong data-checked:border-primary data-checked:bg-primary-soft",children:[s.jsx(bo,{value:I,className:"row-span-2 self-center"}),s.jsx("span",{className:"text-[13px] font-semibold text-foreground group-data-checked/card:text-primary-fg",children:A0[I].title}),s.jsx("span",{className:"text-[11.5px] leading-[1.55] text-subtle",children:A0[I].desc})]},I)})}),s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:R})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:d}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{C()},disabled:p,title:r(p?"压缩正在后台执行,完成后自动恢复":"回收已删除数据占用的磁盘空间(checkpoint + VACUUM,后台执行)"),children:r(p?"压缩中…":"压缩数据库")}),s.jsx(se,{variant:"outline",onClick:e,disabled:b,children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>{A()},disabled:b,children:r(b?"清理中…":"执行清理")})]})]})})}let gp=null,Fu=null;function PD(){gp&&(gp.unmount(),gp=null),Fu&&(Fu.remove(),Fu=null)}function pQ(){mp||PD()}function mQ(){PD(),Fu=document.createElement("div"),document.body.append(Fu),gp=vn.createRoot(Fu),gp.render(s.jsx(fQ,{onClose:pQ}))}window.wbRequestClearModal={open:mQ};const _D=[{value:"detail",label:r("请求详情")},{value:"preview",label:r("预览对话")},{value:"raw",label:r("原始报文")}],hQ="detail",LD="border-b border-hairline px-2.5 py-[7px] align-top",_o="border border-hairline px-2 py-1 align-top",gQ="border border-hairline bg-surface-2 px-2 py-1 text-[11.5px] tracking-normal",px="hover:[&>td]:bg-transparent";function $u(){return window}function M0(){const e=$u().workbuddyDesktop;if(!e)throw new Error(r("后端桥不可用"));return e}let D0=0;function xQ(e){if(!e)return"—";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`}function zD(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}function bQ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":zD(t)}const vQ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计");function yQ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=500&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function mx(e){return $u().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function wQ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function jQ(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function hx(e){return(Number(e?.status)||0)===0&&!e?.error}function BD(e){const t=String(e.provider??"").trim();return String(e.providerLabel??"").trim()||(t?$u().wbProviders?.labelOf?.(t)||t:"")}function xp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I0(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return""}}function P0(e){return e instanceof Error?e.message:String(e)}const HD=[{label:r("请求头"),pick:e=>I0(e.requestHeaders)},{label:r("请求体"),pick:e=>I0(e.requestBody)},{label:r("响应头"),pick:e=>I0(e.responseHeaders)},{label:r("响应体"),pick:e=>e.responseBody?String(e.responseBody):""}];function gx({text:e,loading:t=!1}){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-center text-[12.5px] text-muted-foreground",children:[t?s.jsx(ef,{className:"size-3.5"}):null,e]})}function ua({label:e,children:t}){return s.jsxs(kl,{className:px,children:[s.jsx("th",{scope:"row",className:`w-[76px] whitespace-nowrap text-left text-[12.5px] font-semibold text-muted-foreground ${LD}`,children:e}),s.jsx(Nn,{className:LD,children:t})]})}function SQ({row:e}){if(hx(e)){const c=$u().wbRequestPhase;if(!c?.badgeHtml)return s.jsxs(ze,{variant:"info",shape:"tag",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot"}),r("进行中")]});const d=c.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:c.badgeHtml(e)}}),d?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",dangerouslySetInnerHTML:{__html:d}}):null]})}const t=Number(e.status)||0,a=jQ(e),o=!a&&t>=200&&t<300?r("HTTP {status},但响应体阶段出错",{status:t}):"";return s.jsx(ze,{variant:a?"success":"destructive",shape:"tag",title:o||void 0,children:t||r("失败")})}function NQ({row:e}){const t=String(e.clientModel??"").trim(),a=String(e.upstreamModel??"").trim(),o=String(e.model??"").trim(),c=String(e.clientReasoning??"").trim(),d=String(e.upstreamReasoning??"").trim(),f=(b,y)=>y?`${b}(${y})`:b;if(!t||!a||a.toLowerCase()===t.toLowerCase())return s.jsx(s.Fragment,{children:f(o,d||c)||"—"});const p=f(a,d),h=f(t,c);return s.jsxs("span",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{title:r("转发到上游的模型:{model}",{model:p}),children:["⬆️ ",p]}),s.jsxs("span",{className:"text-muted-foreground",title:r("下游请求的模型:{model}",{model:h}),children:["⬇️ ",h]})]})}function kQ(e){const t=Number(e?.status),a=e?.status!==null&&e?.status!==void 0&&Number.isFinite(t),o=e?.error?String(e.error):"";if(o){const c=a?r("失败({status}):{error}",{status:String(t),error:o}):r("失败:{error}",{error:o});return s.jsx("span",{className:"break-words text-destructive",children:c})}return a?s.jsx("span",{className:"text-success",children:r("成功({status})",{status:String(t)})}):s.jsx("span",{className:"text-muted-foreground",children:r("无结果记录")})}function CQ({row:e}){const t=Array.isArray(e.attemptDetails)?e.attemptDetails:[];if(!t.length)return s.jsx(s.Fragment,{children:"-"});const a=Number(e.attempts)||1;return s.jsxs(Ky,{className:"text-[11.5px]",children:[s.jsx(yE,{children:s.jsx(kl,{className:px,children:[r("轮次"),r("提供商"),r("账号"),r("结果"),r("体积"),r("内部重试"),r("提示")].map(o=>s.jsx(wE,{className:gQ,children:o},o))})}),s.jsxs(Yy,{children:[t.map((o,c)=>{const d=Array.isArray(o?.retries)?o.retries:[],f=d.map(v=>{const w=Number(v?.delayMs),j=Number.isFinite(w)&&w>0?w>=1e3?r(",{n}秒后重试",{n:Math.round(w/1e3)}):r(",{n}毫秒后重试",{n:Math.round(w)}):"";return`${String(v?.reason||r("未知原因"))}${j}`}).join(` -`),p=String(o?.notice??"").trim(),h=Number(o?.bodyBytes),b=Number.isFinite(h)&&h>0?h>=1024*1024?`${(h/1024/1024).toFixed(1)} MB`:h>=1024?`${Math.round(h/1024)} KB`:`${h} B`:"—",y=Number.isFinite(h)&&h>0?r("实际发给上游 {bytes} 字节",{bytes:h.toLocaleString()}):void 0;return s.jsxs(kl,{className:px,children:[s.jsx(Nn,{className:_o,children:c+1}),s.jsx(Nn,{className:_o,children:BD(o)||(o?.provider?String(o.provider):r("未知"))}),s.jsx(Nn,{className:_o,children:o?.account?String(o.account):"—"}),s.jsx(Nn,{className:_o,children:kQ(o)}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:y,children:b}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:f||void 0,children:d.length?r("↻ {n} 次",{n:d.length}):"-"}),s.jsx(Nn,{className:_o,children:p||"—"})]},c)}),t.lengths.jsxs("li",{className:"py-0.5",children:[s.jsxs("b",{children:[y+1,". ",String(b.name||b.id||"—")]}),s.jsxs("span",{className:"text-muted-foreground",children:[" ",String(b.reason||"")]})]},String(b.id??y)))}):null,p.length?s.jsxs("div",{className:"mt-1 text-muted-foreground",children:[r("被跳过:"),p.map(b=>String(b.name||b.id||"")).join("、")]}):null,h?s.jsx("div",{className:"mt-1",children:r("最终承载:{picked}",{picked:h})}):null]})}function EQ({row:e}){if(!e)return s.jsx(gx,{text:r("列表数据已刷新,请重试(关闭后重新打开这条详情)")});const t=String(e.accountName??"").trim(),a=yQ(e);return s.jsx(Ky,{className:"text-[12.5px] text-subtle [&_tr:last-child>td]:border-b-0 [&_tr:last-child>th]:border-b-0",children:s.jsxs(Yy,{children:[s.jsx(ua,{label:r("时间"),children:xQ(e.ts)}),s.jsx(ua,{label:r("状态"),children:s.jsx(SQ,{row:e})}),s.jsx(ua,{label:r("耗时"),children:hx(e)?s.jsxs(s.Fragment,{children:[wQ(e.ts),s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(请求仍在转发中)")})]}):r("{duration} / 首帧 {first}",{duration:zD(e.durationMs),first:bQ(e.firstResponseMs)})}),s.jsx(ua,{label:r("重试次数"),children:String(Number(e.attempts)||1)}),s.jsx(ua,{label:r("模型"),children:s.jsx(NQ,{row:e})}),s.jsxs(ua,{label:r("提供商"),children:[BD(e)||"—",t?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(账号:{account})",{account:t})}):null]}),s.jsxs(ua,{label:r("令牌"),children:[r("输入 {input} · 输出 {output} · 总计 {total} · 缓存读 {cache}",{input:mx(e.promptTokens),output:mx(e.completionTokens),total:mx(e.totalTokens),cache:mx(e.cacheReadTokens)}),a?s.jsxs("span",{title:vQ,children:[" · ",a]}):null]}),e.isTest?s.jsx(ua,{label:r("来源"),children:s.jsx(ze,{variant:"brand",shape:"tag",title:r("模型管理页操作列那颗「测试」发起的请求:与真实请求同一条转发链路,但不计入报表统计"),children:r("模型测试")})}):null,s.jsx(ua,{label:r("错误"),children:e.error?s.jsx("span",{className:"text-destructive",children:String(e.error)}):"—"}),s.jsx(ua,{label:r("尝试明细"),children:s.jsx(CQ,{row:e})}),e.route?s.jsx(ua,{label:r("路由回放"),children:s.jsx(TQ,{row:e})}):null,s.jsx(ua,{label:r("敏感词"),children:Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length?s.jsx("span",{className:"inline-flex flex-wrap gap-1.5",children:e.sensitiveHits.map((o,c)=>s.jsxs(ze,{variant:"sensitive",shape:"tag",children:[String(o?.word??"")," × ",String(Number(o?.count)||0)]},c))}):"—"})]})})}function AQ({state:e}){if(!e)return s.jsx(gx,{text:r("正在读取…"),loading:!0});const t=e==="gone"?null:e.body,a=t&&$u().wbConversationPreview?.render?.(t.requestBody,t.responseBody)||"";return a?s.jsxs("div",{children:[e!=="gone"&&e.truncated?s.jsx("div",{className:"mb-2 text-[11.5px] text-warning",children:r("正文超过单条上限,可能已被截断")}):null,s.jsx("div",{dangerouslySetInnerHTML:{__html:a}})]}):s.jsx(gx,{text:r("无报文原文(未开启「调试模式」,或已被清理)")})}function RQ({data:e}){const t=e.status===null||e.status===void 0?"-":String(e.status),a=[e.url?`URL: ${e.url}`:"",e.provider?r("提供商: {provider}",{provider:String(e.provider)}):"",r("上游状态码: {status}",{status:t})].filter(Boolean);return s.jsxs("div",{className:"flex flex-col gap-4",children:[a.length?s.jsx("div",{className:"border-b border-hairline pb-2.5 text-xs leading-[1.7] break-all text-subtle",children:a.map((o,c)=>s.jsx("div",{children:o},c))}):null,HD.map(o=>{const c=o.pick(e)||"";return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("h3",{className:"text-[11.5px] font-semibold tracking-[.02em] text-muted-foreground",children:o.label}),c?s.jsx("pre",{className:"max-h-80 overflow-auto rounded-md border border-border bg-surface-2 p-[10px_12px] font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-subtle",children:c}):s.jsx(gx,{text:r("这条请求没有保存这一段报文")})]},o.label)})]})}function OQ({id:e,row:t,token:a,onClose:o}){const[c,d]=x.useState(hQ),[f,p]=x.useState(null),[h,b]=x.useState(null),[y,v]=x.useState("—"),[w,j]=x.useState("idle"),S=x.useRef(!0),N=x.useRef(null),k=x.useRef({detail:0,preview:0,raw:0}),T=x.useCallback(()=>!S.current||a!==D0,[a]);async function D(){try{const O=await M0().getStatsRequestRaw(e);if(T())return;const _=xp(O)?O:null,L=String(_?.requestBody??"").trim()!==""||String(_?.responseBody??"").trim()!=="";p(_&&L?{body:_,truncated:!!_.truncated}:"gone")}catch(O){if(T())return;p("gone"),console.warn("读取原始正文失败(预览对话显示空态):",P0(O))}}async function C(){try{const O=await M0().getDebugTraffic(e);if(T())return;const _=xp(O)?O:{};if(!HD.some(L=>(L.pick(_)||"").trim())){b("gone");return}b({data:_}),v(_.truncated?r("报文超过单条上限,请求体 / 响应体已按上限截断"):r("内容按原样保存,请求头中的凭据字段已替换为 [redacted]"))}catch(O){if(T())return;b("gone"),v(r("在设置 → 通用里开启「调试模式」后,新发生的请求才会保存报文")),console.warn("读取调试报文失败(原始报文标签隐藏):",P0(O))}}x.useEffect(()=>(S.current=!0,D(),C(),()=>{S.current=!1}),[]),x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollTop=k.current[c])},[c]);function A(O){if(O==="raw"&&!xp(h)||O===c)return;const _=N.current;_&&(k.current[c]=_.scrollTop),d(O)}async function R(){if(!e||!hx(t))return;const O=$u().wbConfirm?.ask;if(!(!O||!await O({title:r("终止请求"),html:r("确定终止这条正在转发的请求?
    上游连接会立即断开,明细将记为「请求已被手动终止」。"),okText:r("终止"),okClass:"danger"}))){j("pending");try{if(await M0().terminateStatsRequest(e),!S.current)return;j("accepted"),v(r("已受理终止:上游连接已断开,列表稍后刷新为「请求已被手动终止」"))}catch(L){if(!S.current)return;j("idle"),v(r("终止失败:{error}",{error:P0(L)}))}}}const I=xp(h),P=x.useMemo(()=>I?_D:_D.filter(O=>O.value!=="raw"),[I]);return s.jsx(Qt,{open:!0,onOpenChange:O=>{O||o()},children:s.jsxs(Zt,{className:"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("请求详情")})}),s.jsxs(Bt,{ref:N,className:"gap-3",children:[s.jsx(In,{options:P,value:c,onValueChange:A,"aria-label":r("详情内容"),className:"self-start"}),s.jsx("section",{hidden:c!=="detail",children:s.jsx(EQ,{row:t})}),s.jsx("section",{hidden:c!=="preview",children:s.jsx(AQ,{state:f})}),I?s.jsx("section",{hidden:c!=="raw",children:s.jsx(RQ,{data:h.data})}):null]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:y}),s.jsx("div",{className:"mr-auto"}),hx(t)?s.jsx(se,{variant:"destructive",disabled:w!=="idle",onClick:()=>{R()},title:r("断开上游连接,明细记为「请求已被手动终止」"),children:r("终止请求")}):null,s.jsx(se,{variant:"outline",onClick:o,children:r("关闭")})]})]})})}let bp=null,qu=null;function UD(){bp&&(bp.unmount(),bp=null),qu&&(qu.remove(),qu=null)}function VD(){D0+=1,UD()}function MQ(e,t){const a=String(e??"").trim();if(!a)return;UD();const o=++D0;qu=document.createElement("div"),document.body.append(qu),bp=vn.createRoot(qu),bp.render(s.jsx(OQ,{id:a,row:xp(t)?t:null,token:o,onClose:VD}))}window.wbRequestDetail={open:MQ,close:VD};const DQ=150,IQ=80,tc=8,xx=8,PQ=520,_Q=220,LQ=1.1,zQ=900,_0=12,L0="req-hover-panel",BQ=["fixed z-[35] pointer-events-none","max-h-[min(360px,60vh)] overflow-x-hidden overflow-y-auto","rounded-md p-[10px_12px] text-[12px] leading-[1.6] break-normal","bg-surface-2 text-foreground shadow-3","border-0 dark:border dark:border-border-strong dark:bg-surface-3"].join(" "),vp="rh-row rh-dim min-w-0 break-words text-muted-foreground",HQ="rh-row min-w-0 break-words";function UQ(){return window}function z0(e){return typeof e=="object"&&e!==null?e:null}const FD=e=>Array.isArray(e?.attemptDetails)?e.attemptDetails:[],$D=e=>Array.isArray(e?.retries)?e.retries:[],VQ=e=>Array.isArray(e?.sensitiveHits)?e.sensitiveHits:[];function B0(e){const t=String(e??"").trim();return t?UQ().wbProviders?.labelOf?.(t)||t:""}function FQ(e){const t=z0(e);return(Number(t?.attempts)||1)>1?!0:FD(t).some(a=>$D(a).length>0||!!a?.notice)}function qD(e){return e.dataset.reqHover==="sensitive"?"sensitive":"chain"}function $Q({details:e}){if(e.length<2)return null;const t=e.map(a=>B0(a.provider)||r("未知"));return s.jsxs("div",{className:"rh-chain mb-1.5 border-b border-border pb-1.5 break-words",children:[s.jsx("span",{className:"rh-chain-k font-semibold text-muted-foreground",children:r("切换路径:")}),s.jsx("span",{className:"rh-chain-v font-semibold text-foreground",children:t.join(" → ")})]})}function qQ({item:e}){const t=$D(e);return t.length?s.jsxs("div",{className:"rh-retry mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2",children:[s.jsx("div",{className:"rh-retry-head text-[11.5px] font-semibold text-warning",children:r("↻ 重试 {n} 次",{n:t.length})}),t.map((a,o)=>{const c=String(a?.reason??"").trim(),d=Number(a?.status),f=a?.status!==null&&a?.status!==void 0&&Number.isFinite(d),p=Number(a?.delayMs),h=Number.isFinite(p)&&p>0?p>=1e3?r(",{n}秒后重试",{n:Math.round(p/1e3)}):r(",{n}毫秒后重试",{n:Math.round(p)}):"";return s.jsxs("div",{className:"rh-retry-row min-w-0 break-words",children:[s.jsx("span",{className:"rh-retry-why mr-1 text-subtle [overflow-wrap:anywhere]",children:c||r("未知原因")}),f?s.jsx("span",{className:"rh-retry-status mr-1 text-muted-foreground tabular-nums whitespace-nowrap",children:`HTTP ${String(d)}`}):null,h?s.jsx("span",{className:"rh-dim text-muted-foreground",children:h}):null]},o)})]}):null}function GQ({item:e,index:t,inFlight:a}){const o=B0(e.provider),c=String(e.account??"").trim(),d=Number(e.status),f=e.status!==null&&e.status!==void 0&&Number.isFinite(d),p=e.error?String(e.error):"",h=String(e.notice??"").trim();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:HQ,children:[s.jsx("span",{className:"rh-no mr-1 text-muted-foreground",children:r("尝试 {n} ·",{n:t+1})}),s.jsx("span",{className:"rh-who mr-1 font-semibold text-foreground",children:o||r("未知")}),c?s.jsx("span",{className:"rh-account mr-1 text-muted-foreground [overflow-wrap:anywhere]",children:c}):null,s.jsx("span",{className:"rh-arrow mr-1 text-muted-foreground",children:"→"}),p?s.jsx("span",{className:"rh-bad font-medium text-destructive [overflow-wrap:anywhere]",children:f?r("失败({status}):{error}",{status:String(d),error:p}):r("失败:{error}",{error:p})}):f?s.jsx("span",{className:"rh-ok font-medium text-success",children:r("成功({status})",{status:String(d)})}):a?s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("进行中…")}):s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("无结果记录")})]}),h?s.jsx("div",{className:"rh-notice mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2 text-warning [overflow-wrap:anywhere]",children:`⚠️ ${h}`}):null,s.jsx(qQ,{item:e})]})}function KQ({entry:e}){const t=Number(e.attempts)||1,a=FD(e);if(!a.length){const c=B0(e.provider),d=c?r("共 {n} 次尝试,最终由 {provider} 承载",{n:t,provider:c}):r("共 {n} 次尝试",{n:t});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:vp,children:d}),s.jsx("div",{className:vp,children:r("这条记录的尝试明细未采集(该字段上线前的旧数据,或请求在转发前就失败)")})]})}const o=(Number(e.status)||0)===0&&!e.error;return s.jsxs(s.Fragment,{children:[s.jsx($Q,{details:a}),a.map((c,d)=>s.jsx(GQ,{item:c,index:d,inFlight:o&&d===a.length-1},d)),a.lengths.jsxs("div",{className:"rh-row rh-hit flex items-baseline justify-between gap-2.5",children:[s.jsx("span",{className:"rh-hit-w break-words text-foreground",children:String(a?.word??"")}),s.jsx("span",{className:"rh-hit-c text-muted-foreground tabular-nums whitespace-nowrap",children:`× ${String(Number(a?.count)||0)}`})]},o)),t.length>_0?s.jsx("div",{className:vp,children:r("另有 {n} 个词命中",{n:t.length-_0})}):null]}):s.jsx("div",{className:vp,children:r("这条记录命中了敏感词,但没有留下命中明细")})}function XQ({kind:e,entry:t,panelRef:a}){return s.jsx("div",{ref:a,id:L0,role:"tooltip","data-kind":e,className:BQ,children:e==="sensitive"?s.jsx(YQ,{entry:t}):s.jsx(KQ,{entry:t})})}let Tn=null,Lo=0,yp=0,wp=null,bx=null,H0=null,U0=null,nc=null,sc=null,jp=null,GD="chain";function V0(){window.clearTimeout(Lo),window.clearTimeout(yp),Lo=0,yp=0,wp=null}function QQ(){const e=jp?.current,t=Tn;if(!e||!t)return;const a=t.getBoundingClientRect(),o=window.innerWidth-tc*2;e.style.maxWidth="none",e.style.width="max-content";const c=e.offsetWidth,d=GD==="sensitive",p=Math.max(d?_Q:PQ,c)*(d?LQ:1),h=Math.min(p,o,zQ);e.style.maxWidth=`${h}px`,e.style.width=d?`${h}px`:"auto";const b=e.offsetWidth,y=e.offsetHeight,v=window.innerHeight-a.bottom-xx-tc,w=a.top-xx-tc,j=vv,S=a.left+a.width/2,N=Math.max(tc,Math.min(S-b/2,window.innerWidth-tc-b)),k=j?a.top-xx-y:a.bottom+xx;e.style.left=`${Math.round(N)}px`,e.style.top=`${Math.round(Math.max(tc,Math.min(k,window.innerHeight-tc-y)))}px`}function KD(e){if(!Tn)return;const t=e.target;t instanceof Node&&(t===Tn||Tn.contains(t)||Oa())}function YD(){Oa()}function XD(){Oa()}let vx=!1;function ZQ(){vx||(vx=!0,document.addEventListener("click",KD,!0),window.addEventListener("scroll",YD,!0),window.addEventListener("resize",XD))}function WQ(){vx&&(vx=!1,document.removeEventListener("click",KD,!0),window.removeEventListener("scroll",YD,!0),window.removeEventListener("resize",XD))}function JQ(){WQ(),sc&&(sc.unmount(),sc=null),nc&&(nc.remove(),nc=null),jp=null}function QD(e,t){GD=e,(!nc||!sc||!jp)&&(nc=document.createElement("div"),document.body.append(nc),jp=x.createRef(),sc=vn.createRoot(nc));const a=sc,o=jp;Cs.flushSync(()=>{a.render(s.jsx(XQ,{kind:e,entry:t,panelRef:o}))}),ZQ(),QQ()}function ZD(e){if(!e.isConnected)return;const t=z0(H0?.(e));t&&(V0(),Tn&&Tn!==e&&Oa(),Tn=e,QD(qD(e),t),e.classList.add("active"),e.setAttribute("aria-describedby",L0))}function Oa(){V0(),Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=null),JQ()}function eZ(){if(!Tn)return;const e=String(Tn.dataset.reqHover||""),t=String(Tn.dataset.reqId||"");U0=!!(e&&t)&&Tn.matches(":hover")&&!yp?{action:"move",kind:e,key:t}:{action:"close"}}function tZ(){const e=U0;if(U0=null,!e||!Tn)return;if(e.action==="close"){Oa();return}const t=bx?nZ(bx,e.kind,e.key):null,a=t?z0(H0?.(t)):null;if(!t||!a){Oa();return}t!==Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=t,QD(qD(t),a),t.classList.add("active"),t.setAttribute("aria-describedby",L0))}function nZ(e,t,a){for(const o of e.querySelectorAll("[data-req-hover]"))if(String(o.dataset.reqHover||"")===t&&String(o.dataset.reqId||"")===a)return o;return null}function yx(e){const t=e.target;return t instanceof Element?t.closest("[data-req-hover]"):null}function sZ(e){const t=yx(e);if(!t||!bx?.contains(t)||(V0(),Tn===t&&sc))return;const a=Tn?0:DQ;Tn&&Oa(),wp=t,Lo=window.setTimeout(()=>{Lo=0,wp=null,ZD(t)},a)}function rZ(e){const t=yx(e);if(t){if(wp===t){window.clearTimeout(Lo),Lo=0,wp=null;return}Tn===t&&(window.clearTimeout(Lo),Lo=0,yp=window.setTimeout(()=>{yp=0,Tn===t&&Oa()},IQ))}}function aZ(e){const t=yx(e);t&&ZD(t)}function lZ(e){const t=yx(e);t&&Tn===t&&Oa()}function oZ(e){e.key!=="Escape"||!Tn||Oa()}function iZ(e){const t=e?.host;t&&(bx=t,H0=e?.entryOf??null,t.addEventListener("pointerover",sZ),t.addEventListener("pointerout",rZ),t.addEventListener("focusin",aZ),t.addEventListener("focusout",lZ),t.addEventListener("keydown",oZ))}window.wbRequestHover={bind:iZ,close:Oa,hasProcessFacts:FQ,beforeListRedraw:eZ,afterListRedraw:tZ};function Ts(){return window}function F0(e){return e instanceof Error?e.message:String(e)}function wx(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const jx={connecting:{label:r("连接中"),cls:"phase-connecting"},waiting:{label:r("等待响应"),cls:"phase-waiting"},streaming:{label:r("响应中"),cls:"phase-streaming"},retrying:{label:r("重试中"),cls:"phase-retrying"},queued:{label:r("排队中"),cls:"phase-queued"}},WD=r("进行中"),cZ="running",JD={connecting:r("请求已受理,正在选路、取凭证、建立上游连接"),waiting:r("上游请求已发出,正在等第一个字节到达(模型的思考时间也在这段)"),streaming:r("首帧已到,上游内容正在下发"),retrying:r("本轮尝试失败,正在退避等待或切换到下一个账号"),queued:r("上游模型繁忙,请求已排进上游队列;网关正按上游建议的时长等待后重发(不是登录态或额度问题)"),"":r("请求正在转发中,用时列显示的是已用时")};function $0(e){const t=String(e?.phase??"").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(jx,t)?t:""}function eI(e){const t=$0(e);return t?jx[t].label:WD}function tI(e){if(e==null||e==="")return"";const t=Number(e);if(!Number.isFinite(t)||t<0)return"";const a=Math.max(1,Math.floor(t/1e3));return a<60?r("{n}秒",{n:a}):r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60})}function uZ(e){const t=e?.phaseElapsedMs;if(t!=null&&t!==""){const c=Number(t);if(Number.isFinite(c)&&c>=0)return c}const a=Number(e?.phaseStartedAt);if(!Number.isFinite(a)||a<=0)return null;const o=Date.now()-a;return Number.isFinite(o)?Math.max(0,o):null}function dZ(e){const t=$0(e),a=t?jx[t].label:WD,o=t?jx[t].cls:cZ,c=JD[t]||JD[""];return`${wx(a)}`}function fZ(e){const t=tI(uZ(e));if(!t)return"";const a=eI(e),o=r("进入「{phase}」阶段已持续 {time}",{phase:a,time:t});return`${wx(t)}`}const q0=[{key:"time",label:r("时间"),sel:".req-time",track:"92px"},{key:"target",label:r("提供商 / 账号"),sel:".req-target",track:"minmax(0, 1.1fr)"},{key:"retry",label:r("重试"),sel:".req-retry",track:"52px"},{key:"status",label:r("状态"),sel:".req-status",track:"96px"},{key:"model",label:r("模型"),sel:".req-model",track:"minmax(0, 1.3fr)"},{key:"client",label:r("客户端"),sel:".req-client",track:"110px"},{key:"dur",label:r("用时"),sel:".req-dur",track:"96px",align:"right"},{key:"usage",label:r("用量"),sel:".req-usage",track:"minmax(0, 1.6fr)"},{key:"error",label:r("错误"),sel:".req-error-cell",track:"minmax(0, 1.2fr)"},{key:"detail",label:r("详情"),sel:".req-detail",track:"60px",align:"right"}],nI=1e3,pZ=rg;function sI(e){return typeof e=="number"&&e>0?e:du}const rI="workbuddy-desktop-logs-requests-range",aI="workbuddy-desktop-requests-filters",mZ=3e4,G0=["today","7","30","month","all"],K0="all",hZ={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部")},gZ={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},xZ=G0.map(e=>({value:e,label:gZ[e]})),lI=[{value:"",label:r("全部状态")},{value:"ok",label:r("成功")},{value:"error",label:r("失败")}],bZ=r("全部状态"),oI=r("全部提供商"),iI=r("全部模型"),Sx={status:"",provider:"",model:""};function Nx(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function vZ(e){const t=new Date;switch(e){case"today":return Nx(t);case"7":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Nx(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}const en={filters:{...Sx},range:yZ(),runningOnly:!1,offset:0,size:sI(lg("requests",rg))};let kx={...Sx},Y0=!1,cI=!1,X0=[],Cx=nI,Tx=!0,Q0=!1,Z0=!1,uI=0,W0=0,J0=null,dI=!1,Gu=null;function yZ(){try{const e=localStorage.getItem(rI);return e!==null&&G0.includes(e)?e:K0}catch{return K0}}function wZ(e){try{localStorage.setItem(rI,e)}catch{}}function fI(){const e=Ts().wbFilterMemory;return e?(Y0=!0,kx=e.load(aI,{...Sx}),en.filters={...kx},{...kx}):{...Sx}}function jZ(e){kx={...e},Ts().wbFilterMemory?.save(aI,{status:e.status||"",provider:e.provider||"",model:e.model||""})}function pI(){const e=new URLSearchParams,t=vZ(en.range);t!==null&&e.set("start",String(t));const a=en.runningOnly?"running":en.filters.status;return a&&e.set("status",a),en.filters.provider&&e.set("provider",en.filters.provider),en.filters.model&&e.set("model",en.filters.model),e}function SZ(){const e=pI();return e.set("offset",String(en.offset)),e.set("limit",String(en.size)),e.toString()}function eS(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}const NZ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计"),kZ=500;function CZ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=kZ&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function TZ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":eS(t)}function Ex(e){return Ts().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function EZ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function AZ(e){const t=Number(e.promptTokens)||0;return t<=0?"-":`${((Number(e.cacheReadTokens)||0)/t*100).toFixed(2)}%`}function tS(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function Sp(e){return(Number(e?.status)||0)===0&&!e?.error}const mI=e=>String(e?.id||e?.ts||"");function RZ(e){return(Array.isArray(e?.attemptDetails)?e.attemptDetails:[]).reduce((a,o)=>{const c=o?.retries;return a+(Array.isArray(c)?c.length:0)},0)}function hI(e){return Ts().wbProviders?.labelOf?.(e)||e}function OZ(e){const t=new Set;return e.map((a,o)=>{const c=mI(a)||`i${o}`;let d=c,f=1;for(;t.has(d);)d=`${c}#${f++}`;return t.add(d),d})}async function gI(){if(!(Date.now()-W0({value:String(o?.id||""),label:String(o?.label||o?.id||"")})).filter(o=>o.value),a=(Array.isArray(e?.models)?e.models:[]).map(o=>String(o||"")).filter(Boolean);Gu?.setFilterOptions(t,a)}catch(e){console.warn("读取请求日志筛选清单失败,筛选项退化为「全部」:",F0(e))}}}async function MZ(){if(!Q0)try{const e=await Ts().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="requestsAutoRefresh");nS(t||null),Q0=Array.isArray(e?.tasks)}catch(e){console.warn("读取请求日志自动刷新间隔失败,按默认 1 秒:",F0(e)),nS(null)}}function nS(e){Q0=!0;const t=Number(e?.interval),a=e?.unit;!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(a==="seconds"||a==="minutes")?(Tx=e.enabled!==!1,Cx=a==="minutes"?t*6e4:t*1e3):(Tx=!0,Cx=nI),Gu?.setAuto({ms:Cx,enabled:Tx})}function DZ(){if(dI)return;const e=Ts().wbColSettings;e&&(dI=!0,J0=e.register({id:"requests",label:r("请求日志表"),columns:q0.map(({key:t,label:a,align:o})=>({key:t,label:a,align:o})),mount:()=>document.querySelector('.page[data-page="requests"] .panel-head .head-actions'),onChange:()=>{Cs.flushSync(()=>Gu?.repaint()),Ts().wbTableColumns?.repaint?.("requests")}}))}function sS(){return(J0?J0.apply(q0):q0).map(t=>({...t,align:t.align||"left"}))}const IZ={entries:[],total:0,matched:0,running:0,loaded:!1,error:""};function PZ(e){return e.loaded?e.total?r("没有符合筛选条件的请求"):r("暂无请求日志,网关还没有转发过请求"):r("正在加载请求日志…")}function _Z(e){const t=Number(e.firstResponseMs);return!Number.isFinite(t)||t<=0?null:s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时(请求仍在转发中)"),children:r("首响 {time}",{time:eS(t)})})}function LZ(e,t){const{align:a,key:o}=t,c=t.sel.slice(1)+(o==="dur"?" req-num":""),d=`${c} ta-${a}`;switch(o){case"time":{if(!e.ts)return s.jsx("span",{className:d,children:"—"},o);const f=new Date(e.ts),p=h=>String(h).padStart(2,"0");return s.jsxs("span",{className:d,children:[s.jsx("span",{children:`${f.getFullYear()}-${p(f.getMonth()+1)}-${p(f.getDate())}`}),s.jsx("span",{children:`${p(f.getHours())}:${p(f.getMinutes())}:${p(f.getSeconds())}`})]},o)}case"target":{const f=String(e.provider??"").trim(),h=String(e.providerLabel??"").trim()||(f?hI(f):"");return s.jsxs("span",{className:d,children:[h?s.jsx("span",{className:"req-provider",title:f&&f!==h?r("{name}({id})",{name:h,id:f}):h,children:h}):s.jsx("span",{className:"req-provider is-empty",title:r("这条明细没有记录提供商(旧数据或请求未走到转发)"),children:"—"}),e.accountName?s.jsx("span",{className:"req-acct",title:e.accountId||e.accountName,children:e.accountName}):s.jsx("span",{className:"req-acct is-empty",title:r("请求在任何账号接手之前就失败了"),children:"—"})]},o)}case"retry":{const f=Number(e.attempts)||1,p=mI(e),h=[];if(e.isTest&&h.push(s.jsx(ze,{variant:"brand",shape:"tag",title:r("这条明细是一次模型测试(人工发起):走的是真实转发链路,但不计入报表统计"),children:r("测试")},"test")),Ts().wbRequestHover?.hasProcessFacts?.(e)??f>1){const y=f>1?f:RZ(e);h.push(s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"chain","data-req-id":p,children:y>1?r("重试 {n}",{n:y}):r("重试")},"chain"))}return Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length&&h.push(s.jsx(ze,{variant:"sensitive",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"sensitive","data-req-id":p,"aria-label":r("命中了敏感词"),children:r("敏")},"sensitive")),h.length?s.jsx("span",{className:d,children:h},o):s.jsx("span",{className:`req-none ta-${a}`,children:"-"},o)}case"status":{if(Sp(e)){const b=window.wbRequestPhase;if(!b?.badgeHtml)return s.jsx("span",{className:d,children:s.jsx("span",{className:"req-status-badge",children:s.jsxs(ze,{shape:"tag",variant:"info",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot","aria-hidden":"true"}),r("进行中")]})})},o);const y=b.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-status-badge",dangerouslySetInnerHTML:{__html:b.badgeHtml(e)}}),y?s.jsx("span",{className:"req-status-line",dangerouslySetInnerHTML:{__html:y}}):null]},o)}const f=Number(e.status)||0,p=tS(e),h=!p&&f>=200&&f<300?r("HTTP {status},但响应体阶段出错:见错误列",{status:f}):void 0;return s.jsx("span",{className:d,children:s.jsx(ze,{shape:"tag",variant:p?"success":"destructive",title:h,children:f||r("失败")})},o)}case"model":{const f=String(e.clientModel??"").trim(),p=String(e.upstreamModel??"").trim(),h=String(e.model??"").trim(),b=String(e.clientReasoning??"").trim(),y=String(e.upstreamReasoning??"").trim(),v=(S,N)=>N?`${S}(${N})`:S;if(!f||!p||p.toLowerCase()===f.toLowerCase()){const S=v(h,y||b);return s.jsx("span",{className:d,title:S,children:S||"—"},o)}const w=v(p,y),j=v(f,b);return s.jsxs("span",{className:`${d} req-model-split`,children:[s.jsxs("span",{className:"req-model-line",title:r("转发到上游的模型:{model}",{model:w}),children:["⬆️ ",w]}),s.jsxs("span",{className:"req-model-line sub",title:r("下游请求的模型:{model}",{model:j}),children:["⬇️ ",j]})]},o)}case"client":{const f=String(e.client??"").trim();if(!f)return s.jsx("span",{className:`${d} is-empty`,title:r("这条明细没有记录来源客户端(旧数据、模型测试,或请求未带 User-Agent)"),children:"—"},o);const p=f==="other"?r("其它"):f;return s.jsx("span",{className:d,title:f==="other"?r("识别到 User-Agent,但不属于已知的客户端类型:{ua}",{ua:f}):r("来源客户端:{client}",{client:p}),children:p},o)}case"dur":return Sp(e)?s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",title:r("已用时(请求仍在转发中)"),children:EZ(e.ts)}),_Z(e)]},o):s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",children:eS(e.durationMs)}),s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时"),children:r("首响 {time}",{time:TZ(e.firstResponseMs)})})]},o);case"usage":{if(Sp(e))return s.jsx("span",{className:d},o);if(!tS(e))return s.jsxs("span",{className:d,title:r("失败请求不记录用量"),children:[s.jsx("span",{className:"req-usage-line",children:"in: - / out: - / all: -"}),s.jsx("span",{className:"req-usage-line sub",children:r("缓存读取: - / 命中率: -")})]},o);const f=`in: ${Ex(e.promptTokens)} / out: ${Ex(e.completionTokens)} / all: ${Ex(e.totalTokens)}`,p=r("缓存读取: {cache} / 命中率: {rate}",{cache:Ex(e.cacheReadTokens),rate:AZ(e)}),h=CZ(e),b=h?`${p} · ${h}`:p;return s.jsxs("span",{className:d,title:[f,b].filter(Boolean).join(` -`),children:[s.jsx("span",{className:"req-usage-line",children:f}),s.jsxs("span",{className:"req-usage-line sub",children:[p,h?s.jsxs("span",{title:NZ,children:[" · ",h]}):null]})]},o)}case"error":return Sp(e)?s.jsx("span",{className:d},o):e.error?s.jsx("span",{className:d,title:String(e.error),children:String(e.error)},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o);case"detail":{const f=e.id?String(e.id):"";return f?s.jsx("span",{className:d,children:s.jsx(se,{size:"sm",variant:"outline",className:"req-detail-btn",title:r("查看该请求的上游原始报文"),onClick:()=>{Ts().wbRequestDetail?.open?.(f,e)},children:r("详情")})},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o)}default:return null}}function zZ(e){return s.jsx("div",{className:"req-head",children:e.map(t=>s.jsx("span",{"data-col":t.key,className:`${t.sel.slice(1)}${t.key==="dur"?" req-num":""} ta-${t.align}`,children:t.label},t.key))},"__head")}function BZ(){const[e,t]=x.useState(IZ),[a,o]=x.useState(()=>fI()),[c,d]=x.useState(()=>en.range),[f,p]=x.useState(!1),[h,b]=x.useState(0),[y,v]=x.useState(()=>en.size),[w,j]=x.useState(()=>({ms:Cx,enabled:Tx})),[S,N]=x.useState([]),[k,T]=x.useState([]),[,D]=x.useState(0),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useCallback(ee=>(en.filters={...en.filters,...ee},o({...en.filters}),en.filters),[]),P=x.useCallback(ee=>{en.range=ee,d(ee)},[]),O=x.useCallback(ee=>{en.offset=ee,b(ee)},[]),_=x.useCallback(ee=>{en.runningOnly=ee,p(ee)},[]),L=x.useCallback(()=>{Y0||!Ts().wbFilterMemory||(Y0=!0,!cI&&I(fI()))},[I]),H=x.useCallback((ee,fe)=>{Ts().wbRequestHover?.beforeListRedraw?.(),fe&&(X0=fe),R.current=!0,t(ee)},[]),B=x.useCallback(ee=>{Ts().wbRequestHover?.beforeListRedraw?.(),R.current=!0,t(fe=>({...fe,error:ee}))},[]),z=x.useCallback(async(ee={})=>{const{silent:fe=!1,resetPage:te=!1}=ee;te&&O(0),MZ(),L(),fe||gI();const Ce=++uI;try{const re=Ts().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.getStatsRequests(SZ());if(Ce!==uI)return;const ke={entries:Array.isArray(de?.entries)?de.entries:[],total:Number(de?.total)||0,matched:Number(de?.matched)||0,running:Number(de?.running)||0,loaded:!0,error:""},Ee=Math.max(0,(Math.ceil(ke.matched/en.size)-1)*en.size);if(en.offset>Ee)return O(Ee),z({silent:fe});te&&(A.current=0),H(ke,ke.entries)}catch(re){fe||(console.warn("读取请求日志失败:",F0(re)),B(r("读取请求日志失败,详见控制台")))}},[O,H,B,L]);x.useEffect(()=>(Gu={load:z,setAuto:ee=>j(ee),setFilterOptions:(ee,fe)=>{N(ee),T(fe)},repaint:()=>D(ee=>ee+1)},Ts().wbRequestHover?.bind?.({host:C.current,entryOf:ee=>{const fe=ee?.dataset?.reqId||"";return fe&&(X0.find(te=>String(te?.id||"")===fe)||X0.find(te=>String(te?.ts||"")===fe))||null}}),z({silent:!0}),gI(),()=>{Gu=null}),[z]),x.useLayoutEffect(()=>{DZ(),D(ee=>ee+1)},[]);const Q=e.error||!e.entries.length?"":sS().map(ee=>ee.key).join("|");x.useLayoutEffect(()=>{Q&&Ts().wbTableColumns?.repaint?.("requests")},[Q]),x.useEffect(()=>{if(!w.enabled||w.ms<=0)return;const ee=window.setInterval(()=>{document.hidden||Ts().wbApp?.currentPage!=="requests"||Z0||(Z0=!0,z({silent:!0}).finally(()=>{Z0=!1}))},w.ms);return()=>{window.clearInterval(ee)}},[w,z]),x.useLayoutEffect(()=>{R.current&&(R.current=!1,Ts().wbRequestHover?.afterListRedraw?.());const ee=A.current;if(ee===null)return;A.current=null;const fe=C.current;fe&&(fe.scrollTop=ee)});function K(ee){const fe=Math.max(1,Math.ceil(e.matched/en.size)),Ce=(Math.min(Math.max(1,ee),fe)-1)*en.size;Ce!==en.offset&&(O(Ce),A.current=0,z())}function X(ee){const fe=sI(ee);if(fe===en.size)return;en.size=fe,v(fe),og("requests",fe);const te=en.offset+1;O(Math.max(0,Math.floor((te-1)/fe)*fe)),A.current=0,z()}function q(ee){cI=!0,jZ(I(ee)),z({resetPage:!0})}function $(ee){const fe=G0.includes(ee)?ee:K0;fe!==en.range&&(P(fe),wZ(fe),z({resetPage:!0}))}function Y(ee){ee!==en.runningOnly&&(_(ee),z({resetPage:!0}))}const F=sS(),G=Math.max(1,Math.ceil(e.matched/en.size)),W=Math.min(G,Math.floor(h/en.size)+1),le=e.matched?h+1:0,M=e.matched?h+e.entries.length:0,U=e.error?"—":e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total}),Z=!f&&e.running>0?r(" · {n} 进行中",{n:e.running}):"",ae=[hZ[c]||r("全部")];f?ae.push(r("只看进行中")):a.status==="ok"?ae.push(r("只看成功")):a.status==="error"&&ae.push(r("只看失败")),a.provider&&ae.push(hI(a.provider)),a.model&&ae.push(a.model);const ce=x.useMemo(()=>!a.provider||S.some(ee=>ee.value===a.provider)?S:[{value:a.provider,label:a.provider},...S],[a.provider,S]),J=x.useMemo(()=>!a.model||k.includes(a.model)?k:[a.model,...k],[a.model,k]),ie=OZ(e.entries),ge=e.entries.map((ee,fe)=>s.jsx("div",{className:`req-row${Sp(ee)?" running":tS(ee)?"":" failed"}`,children:F.map(te=>LZ(ee,te))},ie[fe]));return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("请求日志列表")}),s.jsx(ze,{id:"req-badge",variant:"outline","data-tone":"",children:U+Z}),s.jsx("span",{className:"panel-sub",children:r("按时间倒序,全量保留")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{id:"btn-req-clear",variant:"destructive",onClick:()=>{Ts().wbRequestClearModal?.open?.()},children:r("清理")})})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:xZ,value:c,onValueChange:$,"aria-label":r("请求日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.status,disabled:f,onValueChange:ee=>q({status:String(ee??"")}),children:[s.jsx(mt,{id:"req-status",className:"min-w-[120px]",title:r(f?"「仅看进行中」开启时,状态固定为进行中":"按请求结果筛选"),"aria-label":r("按请求结果筛选"),children:s.jsx(pt,{children:lI.find(ee=>ee.value===a.status)?.label??bZ})}),s.jsx(ht,{children:lI.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))})]}),s.jsxs(ft,{value:a.provider,onValueChange:ee=>q({provider:String(ee??"")}),children:[s.jsx(mt,{id:"req-provider",className:"min-w-[120px]",title:r("按提供商筛选(只列日志里出现过的)"),"aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:a.provider?ce.find(ee=>ee.value===a.provider)?.label||a.provider:oI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:oI}),ce.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))]})]}),s.jsxs(ft,{value:a.model,onValueChange:ee=>q({model:String(ee??"")}),children:[s.jsx(mt,{id:"req-model",className:"min-w-[120px]",title:r("按模型筛选(只列日志里出现过的;精确匹配模型名)"),"aria-label":r("按模型筛选"),children:s.jsx(pt,{children:a.model||iI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:iI}),J.map(ee=>s.jsx(qe,{value:ee,children:ee},ee))]})]}),s.jsx(E6,{id:"btn-req-running",variant:"outline",size:"default",pressed:f,onPressedChange:Y,title:r("只显示正在转发中的请求(状态列按阶段显示:连接中 / 等待响应 / 响应中 / 重试中,用时列显示已用时)"),children:r("仅看进行中")}),s.jsx("div",{className:"spacer"}),s.jsx("span",{className:"panel-sub",id:"req-summary",children:ae.join(" · ")})]}),s.jsx("div",{className:"log-list",id:"req-list",ref:C,children:e.error?s.jsx("div",{className:"log-empty",children:e.error}):e.entries.length?[zZ(F),...ge]:s.jsx("div",{className:"log-empty",children:PZ(e)})})]}),s.jsx(Li,{total:e.matched,range:{start:le,end:M},page:W,pageCount:G,size:y,sizes:pZ,onSizeChange:X,onPageChange:K,disabled:!e.loaded&&!e.error})]})}async function xI(e={}){await Gu?.load(e)}function HZ(){return pI().toString()}function UZ(){return W0=0,xI({resetPage:!0})}const bI='.page[data-page="requests"]';let vI=!1;function yI(){if(vI)return;const e=document.querySelector(bI);e&&(vI=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(BZ,{})))}document.querySelector(bI)?yI():document.addEventListener("DOMContentLoaded",yI,{once:!0}),window.wbRequestsPanel={load:xI,applyAutoRefresh:nS,visibleColumns:sS,clearParams:HZ,notifyCleared:UZ},window.wbRequestPhase={labelOf:eI,badgeHtml:dZ,elapsedLineHtml:fZ,elapsedText:tI,phaseOf:$0};function VZ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.modelsDevUnavailable;const t=e.source==="builtin"?Ut.modelsDevSourceBuiltin:e.source==="cache"?Ut.modelsDevSourceCache:e.source==="network"?Ut.modelsDevSourceNetwork:e.source,a=e.updatedAt>0?String(tt().wbApp?.formatTime?.(e.updatedAt)??""):"";if(!t&&!a&&!e.count)return Ut.modelsDevEmpty;const o=a?r(",{time}",{time:a}):"",c=e.enabled?r("正在联网更新"):r("仅用现有数据、不联网刷新");return r("{count} 条 · 来自{origin}{at} · {mode}",{count:Number(e.count).toLocaleString("zh-CN"),origin:t||r("未知来源"),at:o,mode:c})}function tt(){return window}function _t(e){return e instanceof Error?e.message:String(e)}function Ve(e,t){tt().wbApp?.toast?.(e,t)}async function FZ(e){try{await tt().workbuddyDesktop?.openReleasePage?.(e)}catch(t){Ve(r("打开链接失败:{error}",{error:_t(t)}),"err")}}const Ax=[{id:"general",label:r("通用"),icon:"sliders"},{id:"display",label:r("显示"),icon:"display"},{id:"gateway",label:r("网关"),icon:"traffic"},{id:"routing",label:r("路由"),icon:"route"},{id:"retry",label:r("重试"),icon:"refresh"},{id:"timeout",label:r("超时"),icon:"timer"},{id:"security",label:r("安全"),icon:"shield"},{id:"data",label:r("数据"),icon:"database"},{id:"feedback",label:r("反馈与需求"),icon:"feedback"},{id:"about",label:r("更新"),icon:"download"}],wI="workbuddy-desktop-settings-cat",$Z="workbuddy-desktop-theme",qZ="workbuddy-desktop-zoom",jI="wb:theme",SI="wb:zoom",rS=80,NI=130,Rx=5,GZ=Array.from({length:(NI-rS)/Rx+1},(e,t)=>rS+t*Rx),KZ=[{value:"system",label:r("跟随系统")},{value:"light",label:r("浅色")},{value:"dark",label:r("深色")}];function YZ(){try{const e=localStorage.getItem($Z);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function XZ(){try{const e=localStorage.getItem(qZ);if(e===null||e.trim()==="")return 100;const t=Number(e);if(!Number.isFinite(t))return 100;const a=Math.round(t/Rx)*Rx;return Math.min(NI,Math.max(rS,a))}catch{return 100}}const aS=1,lS=99999,oS=[{key:"logRetentionDays",id:"settings-retention-log",label:r("事件日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("登录 / 账号切换 / 429 切换等系统事件,可填 1–99999 天。")},{key:"requestLogRetentionDays",id:"settings-retention-request",label:r("请求日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("「请求日志」页的逐条请求记录,默认 99999 天(近似全量保留),可填 1–99999 天。")},{key:"dailyAggregateRetentionDays",id:"settings-retention-daily",label:r("按天聚合保留天数"),unit:r("天"),min:aS,max:lS,hint:r("报表页的热力图与按天趋势,默认 99999 天(近似全量保留),可填 1–99999 天。")}],kI=[{key:"retryCount",id:"settings-retry-count",label:r("同一账号重试次数"),unit:r("次"),min:0,max:10,hint:r("在同一个账号上原地重发几次(不含首发;整条请求共用一份,用完后换来的账号只发一次就继续换)。可填 0–10,0 表示失败立即换号。")},{key:"retryCrossProviderCount",id:"settings-retry-cross-provider-count",label:r("切换账号重试次数"),unit:r("次"),min:0,max:10,hint:r("失败后最多再换几个账号试(填 N = 最多换 N 个,首发那个不算)。换到同一家名下另一个账号、或换到另一家,都各算一次;换满仍失败就返回错误。可填 0–10,0 表示失败立即报错。")},{key:"retryIntervalSeconds",id:"settings-retry-interval",label:r("重试间隔"),unit:r("秒"),min:0,max:300,hint:r("两次重试之间的等待时间,两项共用,可填 0–300 秒。")}],CI=[{key:"connectTimeoutSeconds",id:"settings-timeout-connect",label:r("连接中超时"),unit:r("秒"),min:1,max:3600,hint:r("建立上游 TCP/TLS 连接或代理隧道的最大等待时间(秒),默认 30 秒,范围 1~3600。")},{key:"headersTimeoutSeconds",id:"settings-timeout-headers",label:r("等待响应超时"),unit:r("秒"),min:1,max:3600,hint:r("请求发出后等待上游响应头的最大时间(秒),默认 300 秒,范围 1~3600。")},{key:"streamIdleTimeoutSeconds",id:"settings-timeout-stream-idle",label:r("流式响应空闲超时"),unit:r("秒"),min:1,max:3600,hint:r("流式响应相邻数据之间允许的最大空闲时间(秒),收到新数据后重新计时,默认 300 秒,范围 1~3600。")},{key:"bodyTimeoutSeconds",id:"settings-timeout-body",label:r("非流式响应超时"),unit:r("秒"),min:1,max:3600,hint:r("读取完整非流式响应体允许的最大时间(秒),默认 300 秒,范围 1~3600。")}],TI=[{key:"queueMaxWaits",id:"settings-queue-max-waits",label:r("排队等待次数"),unit:r("次"),min:0,max:10,hint:r("上游模型繁忙时会先排队(回一句「建议 N 秒后再来」,Qoder 免费模型就是这样):网关等一会儿再发同一请求,最多等几次。默认 2 次,可填 0–10;填 0 表示不等待,排队直接返回 503 并说明「不是登录态或额度问题」。")},{key:"queueWaitSeconds",id:"settings-queue-wait-seconds",label:r("排队等待秒数"),unit:r("秒"),min:0,max:120,hint:r("每次等待的时长,默认 0 = 跟随上游建议(实测 9~30 秒,上游没给建议时用 15 秒)。可填 0–120 秒强制一个固定时长。")}],EI="noRetryStatusCodes",iS=100,cS=599,AI=50,zo=[{value:"passthrough",optionLabel:r("透传客户端 system(默认)"),toastLabel:r("透传客户端 system")},{value:"custom",optionLabel:r("替换为网关提示词"),toastLabel:r("替换为网关提示词")},{value:"append",optionLabel:r("追加网关提示词"),toastLabel:r("追加网关提示词")}];function RI(e,t,a,o){const c=String(e??"").trim();if(!c)return{ok:!1,message:r("{noun}不能为空(可填 {min}–{max})",{noun:o,min:t,max:a})};if(!/^\d+$/.test(c))return{ok:!1,message:r("{noun}必须是整数",{noun:o})};const d=Number(c);return da?{ok:!1,message:r("{noun}必须在 {min}–{max} 之间(当前填的是 {text})",{noun:o,min:t,max:a,text:c})}:{ok:!0,value:d}}function QZ(e,t){const a={...t};if(e&&typeof e=="object"){const o=e;typeof o.closeToTray=="boolean"&&(a.closeToTray=o.closeToTray),typeof o.autostart=="boolean"&&(a.autostart=o.autostart),typeof o.lanAccess=="boolean"&&(a.lanAccess=o.lanAccess),typeof o.lanPanel=="boolean"&&(a.lanPanel=o.lanPanel),typeof o.lightweightMode=="boolean"&&(a.lightweightMode=o.lightweightMode)}return a}function OI(e,t,a){if(!t||typeof t!="object")return null;const o=t,c={...a||{}};for(const d of e){const f=Number(o[d.key]);Number.isInteger(f)&&f>=d.min&&f<=d.max&&(c[d.key]=f)}return e.some(d=>Number.isInteger(c[d.key]))?c:null}function MI(e){if(!Number.isFinite(e)||e<=0)return"0 B";if(e<1024)return`${e} B`;const t=e/1024;if(t<1024)return`${t.toFixed(1)} KB`;const a=t/1024;return a<1024?`${a.toFixed(1)} MB`:`${(a/1024).toFixed(2)} GB`}function ZZ(e){const t=Number(e);return!Number.isFinite(t)||t<0?"—":t.toLocaleString("zh-CN")}const rs={displayTheme:r("控制界面的深浅色,与左侧边栏底部的三个主题按钮是同一个设置(改哪一处,另一处立刻跟上)。「跟随系统」会随操作系统当前的浅色 / 深色自动切换,并在系统主题变化时即时跟上;选「浅色」或「深色」则把界面固定在该模式,不再随系统变化。窗口标题栏的深浅色会一并同步,不会出现深色界面配一条浅色标题栏的情况。"),displayZoom:r("等比放大或缩小整个界面(文字、控件、间距一起变),效果与浏览器按 Ctrl +/- 相同:80%–130%、5% 一档。窗口本身不缩放,变的是页面内容的显示比例,设置立即生效并记住,下次启动直接按这个比例打开。放得越大可视范围越小,窗口较窄或表格较宽时不建议调得太大。"),displayLanguage:r("界面语言。可选简体中文、繁體中文、English、日本語、한국어、Português (Brasil),或「跟随系统」(按浏览器 / 系统的语言列表自动选)。切换后整页立即刷新;该偏好只存在本机(localStorage),不影响账号、密钥与转发。"),tray:r("默认关闭窗口不会退出程序,而是把窗口缩到系统托盘,转发继续在后台运行(OpenAI 客户端不受影响);要彻底退出程序,请在托盘图标上右键选「退出」。关掉这个开关后,点关闭按钮即退出程序、转发随之中断。「开机自动启动」开启后,登录系统时会自动启动本程序(通常直接驻留托盘),不需要手动打开。"),lightweight:r("开启后,关闭窗口不只是隐藏,而是把界面窗口整个销毁:底层的 WebView2 六个常驻进程(约 200MB 内存)随之退出,网关转发、定时签到、余额查询都在后台进程里继续,不受影响;需要界面时点托盘图标重新打开(WebView 冷启动约 1 秒)。注意:界面销毁期间「ZCode 活动套餐」通道的验证码令牌由界面铸造,无法补充 —— 走该通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。此开关只在「关闭窗口时最小化到托盘」开启时有意义,最小化窗口不受影响。"),lan:r("默认网关只监听 127.0.0.1,只有本机能访问。开启后网关改听所有网卡,同一局域网内的设备可以把 API 地址指向本机 IP 一起使用。出于安全考虑,开启前必须先注册一个面板管理员:管理接口从此要求管理员会话或网关 Key,模型额度不会对局域网裸奔;一把启用的网关 Key 都没有时,转发接口也会拒绝服务,直到创建第一把。改动需要重启应用生效。「同时开放网页管理面板」把管理界面也出给局域网(其他设备的浏览器打开本机 IP 即可管理),默认关闭 —— 桌面端的面板仍只由本程序自己出。"),units:r("控制报表与请求日志里 Token 读数的写法:开启后按中文量级显示(1.2亿 / 8400万),关闭则用 k / M 缩写(与上游文档、接口字段的写法一致)。这只影响显示口径,不改变任何统计与存储的数值。"),queue:r("只对「排队制」的上游生效(目前是 Qoder 的免费模型):模型繁忙时上游不报错,只回一句「建议 N 秒后再来」(业务码 10605),网关按建议时长等一会儿再发同一请求,等满次数仍排不上才把「排队中」作为错误返回(HTTP 503,文案会说明这不是登录态或额度问题)。等待发生在首个字节之前,吃的是「等待响应超时」那份预算 —— 两项设置一起决定一次请求最多卡多久;排队不会标记账号限额、也不会换账号(换谁都一样在排队)。保存后对下一个请求立即生效,不用重启。"),captchaPool:r("ZCode「活动套餐」通道的每条推理请求都要附一个当次铸造的阿里云无痕验证令牌(一次性、约 2 分钟过期):令牌由界面里的铸造守卫静默铸好、推给网关入池,转发时逐条取用。这里的三个值管的是补货节奏:①「库存目标」= 库存低于它守卫才补铸、补到它为止,默认 3 个;②「轮询间隔」= 守卫多久看一次库存,默认 2500 毫秒,只影响反应速度(库存够用时不会多铸);③「单轮铸造上限」= 发现缺货时一轮最多铸几个,默认 1 个(连铸之间固定隔 500 毫秒)。请求密集、请求日志里连续出现「需要人机验证令牌」的 503 时,把目标与单轮上限适当调大、轮询调快,能让池子跟得上消耗 —— 代价是上游(阿里云)对铸造频率有风控,铸得越多越快越容易触发限流,且用不掉的令牌 2 分钟即过期作废、等于白烧配额,所以建议小步调。保存后对下一轮补货立即生效,不用重启。"),timeouts:r("上游请求四个阶段各自的等待上限(秒,1~3600):①「连接中超时」= 建立 TCP/TLS 连接或代理隧道的最大等待,默认 30 秒;②「等待响应超时」= 请求发出后等上游响应头的最大时间,默认 300 秒 —— 网关请求上游恒带 stream,响应头在 SSE 建立时就到达,与模型思考多久无关;③「流式响应空闲超时」= 流式响应相邻两块数据之间允许的最大空闲,收到新数据即重新计时,默认 300 秒 —— 上游长时间不吐数据即判定连接僵死并断开;④「非流式响应超时」= 读完整份非流式响应体的总预算(一次性计时、不重置),默认 300 秒。四项都是「等待上限」,只要数据还在来,正常的流式回答就一直往下传。保存后对下一个请求立即生效,不用重启。"),retry:r("请求转发到上游失败时(服务器瞬时错误、连接失败,以及 WorkBuddy 的 11-128 敏感词拦截),网关会等一段间隔后再发一次。次数分两档,管的是两件事:①「同一账号重试次数」在同一账号上原地重发几次 —— 一般是提示词被上游拦截、或链路瞬时抖动,等一会儿重发往往就好了;②「切换账号重试次数」这份请求最多再换几个账号试 —— 首发的那个账号不算,每换一个扣一次,不分是不是同一家(换到同一家的下一个账号也算一次),换满还失败就把错误返回给客户端。两项都设为 0 表示失败不重试、直接报错。注意账号级限额(429)不占这里的换号次数 —— 那类失败走「冷却该账号并换下一个账号」的降级,与这里的重试是两条路。另有「指定错误码直接换号」名单(默认 402):命中名单的上游状态码不在同一账号重发,直接按队列换下一个账号继续试(换号也占「切换账号重试次数」),换满仍失败才把错误返回给客户端。"),routing:r("转发一个请求时按什么顺序挑账号:①「路由策略」决定排队规则 —— 顺序优先是排第 1 的接走所有请求、直到它不能答(限流 / 故障 / 额度尽)才轮到下一位;负载均衡是每条请求换下一位,把负载摊到各个账号上。②「会话粘性」让同一会话(相同的模型 + 相同的开头消息)尽量跟住同一个账号 —— 多轮对话的上下文缓存能复用、少换号少浪费;自动档粘 5 分钟、会话内档粘 6 小时、每轮与关闭都不粘。账号的排队位次(账号表的第一列)在所有策略下都是地基,策略在它之上再排。此外路由还有三层自愈保护:转发失败的账号退避休息一会儿(15 分钟起步翻倍、封顶 1 小时)、被 429 的账号垫底排到队尾 30 分钟、余额不足 / Token 周期用量到顶的账号由限制器拦下 —— 前两层可以在下面按需开关,限制器由账号的「限制器」设置管。"),sanitize:r("上游用「逐字精确匹配」的方式审核请求体(不是语义审核):客户端注入的固定模板句、计费头字段名、以及某些裸错误码出现在报文里就会整单拦截,返回 400。开启本项后,网关在每次转发前改写这些指纹 —— 表头键值整段删除,承载语义的模板句只换一个词(如 official CLI for Claude → official CLI tool for Claude),对话内容与语义都不受影响。规则集是内置的,不需要也无法维护词表。关掉本项后客户端模板会原样发往上游,可能重新出现模板句被误拦的报错。"),clineHeaders:r("Cline 上游按请求头判定「调用方是不是 Cline 自家产品」:X-CLIENT-TYPE: cline-sdk 是硬门槛(缺了它免费池模型一律 403),版本号与平台标识让请求更贴近官方客户端的形态。这里列出的是网关默认会发的头:改某一行的值 = 覆盖默认值(也可以新增默认清单之外的自定义头);把值清空保存 = 这个头不发送;在界面删掉被改过的行 = 回落默认值。改完点「保存」,下一个 Cline 请求立即生效。不懂某一行的含义就不要动它 —— 伪装头的价值在「与官方客户端逐字一致」。"),cors:r("网关面(/v1/*)默认不应答浏览器跨源请求:页面直连会被预检拦下,只报「无法连接 API」。注意来源是 * —— 未配「网关 Key」时任何网页都能借本机网关打上游,故默认关闭;只给自己用的话,让页面与网关同源(本地反代 /v1)更稳妥。面板接口(/api/*)不受影响。"),prompt:r("客户端(Claude Code / Codex 等 CLI)会在 system 提示词里注入几十句固定模板,上游按逐字匹配审核,命中就整单拦截(HTTP 400)。指纹脱敏能改写实测命中过的那几句,但换一个客户端版本就可能冒出新的。这里可以把 system 整段换成网关自己那份:①「透传」= 不动客户端 system(默认,行为与之前完全一致);②「替换」= 删掉客户端所有 system / developer 消息,换成网关的提示词(客户端项目规范随之消失);③「追加」= 在开头连续 system 块之后插入一条网关提示词,既有消息逐字不动(客户端规范与网关提示词并用)。那份提示词有两个来源:提示词文件(留空用内置默认),或直接在界面上编辑正文 —— 编辑过就以那份正文为准(优先于文件),清空则回到文件 / 内置默认。另外,透传 / 追加模式下撞了内容拦截(多半是指纹误报)时,网关会自动换一段最小中性提示词重试一次,并把「降级期」开到次日 00:00 —— 期间所有请求直接带中性提示词出门,不再先撞一次 400;这里能看见并提前解除它。上面几项是**默认值**:想给某个提供商单独配,用下面的「按提供商」加一行(带「网关自带」的家默认就列在那里)—— 不同的上游对这些内容的接受程度不一样。"),debug:r("开启后,网关会把每次转发**发给上游的请求**(请求头 + 请求体)与**上游返回的响应**(状态码 + 响应头 + 响应体)完整保存到本地,供请求日志页的「详情」查看。请求头里的 Authorization、Cookie、API Key 等凭据字段一律替换成 [redacted],不会明文落盘;请求体与响应体按原样保存(可能包含你的对话内容)。报文只保留最近 500 条,超出后丢弃最旧的。这是排障用的临时开关,不需要时建议关闭。"),io:r("导出会把全部账号与自定义提供商定义写入一个 JSON 文件,可以拷到另一台机器上导入后继续使用。导入采用合并策略:同提供商下按业务身份(UID / userId / apiKey 等)去重 —— 已存在的账号只更新凭证,保留本机原有的优先级顺序;新账号追加到转发顺序末尾,不会抢占当前正在使用的账号;自定义提供商定义按 id 合并,本机缺失时自动补建。"),backup:r("把整份数据库(账号、网关配置、事件日志、请求统计、调试报文与桌面设置)导出成一个 SQL 文件,恢复时整体替换本机全部数据 —— 与上面「账号导入 / 导出」的逐条合并是两种语义:恢复会连配置、日志与当前启用状态一起换成备份那台机器的状态。导出默认包含日志与调试报文(文件可能很大),不需要时可以取消勾选只备业务数据。恢复前会自动把当前数据备份到配置目录的 backups/ 下,恢复后需要重新登录管理面板。"),retention:r("三档数据各自独立计时,超出保留天数的部分会被删除:事件日志是登录、账号切换、429 切换这类系统事件;请求日志是网关每次转发到上游的逐条记录;按天聚合供报表页的热力图与按天趋势使用。请求日志与按天聚合默认 99999 天(约 274 年,效果上等于全量保留),事件日志默认 30 天。把某一档改小(例如 30 天改成 7 天)保存后会立即删除超出的历史数据,此操作不可恢复;改大或保持不变不会删除任何数据。三档的可填范围均为 1–99999 天。"),storage:r("全部数据(账号、事件日志、请求记录、调试报文、设置)统一保存在配置目录下的 agent2api.db 这一个 SQLite 数据库里。备份时只需拷贝这个文件;更换保存位置请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),modelsDev:r("models.dev 是一个开源的模型资料库(社区维护),这里用它补齐「上游没告诉我们」的模型能力:上下文窗口、最大输出、工具调用、图片、视频、是否支持思考,以及这个模型认识哪些思考档位。优先级是:你在「模型能力」里手工改的值 > 上游清单自己声明的值 > models.dev 的值 —— 它只填上游没声明的空位,从不推翻上游已声明的。网关随包内嵌了一份快照,所以离线、首次启动、访问不通时也有数据;开启时会按「模型目录刷新」任务的间隔联网更新(同一轮里一并刷新,也可在这里立即刷新)。关闭只停联网刷新,已经拿到的数据继续用。")},$n={timeouts:r("保存后立即生效,不用重启;超时按上游失败处理(计入请求日志的「错误」列,并按「请求重试」的设置决定是否重试)。"),queue:r("等待期间请求日志的状态列会显示「排队中」阶段,详情弹窗的「内部重试」里能逐次看到等待时长;等待用尽后返回 HTTP 503(不是 401/429:既不会刷新凭证,也不会把账号标成限额)。"),captchaPool:r("保存后对下一轮补货立即生效,不用重启。守卫跑在应用界面里:轻量模式关窗销毁界面期间无法铸造,走活动套餐通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。"),retry:r("保存后立即生效,不用重启;次数用尽仍失败时,错误原样返回给客户端。"),routing:r("保存后立即生效,不用重启:策略与粘性作用于**下一次**转发的选路,进行中的请求不受影响。"),retryCodes:r("命中这些上游状态码的失败不在同一账号重发,直接换下一个账号继续试(换号占用「切换账号重试次数」,换满仍失败才把错误原样返回给客户端)。输入 100–599 的状态码后回车添加,点 × 或退格删除;默认 402(积分不足)。清空全部表示任何错误都照常重试。"),sanitize:r("默认开启。命中明细会记进请求日志的「敏」标签(悬停可看命中了哪几条规则)。本项只改发给上游的副本,客户端看到的响应内容不变。"),clineHeaders:r("值与默认值相同的行不占覆盖(存的是「改过的键」,不是全量配置);值留空保存表示这个头不发送,删除改过的行表示回落默认值。改完立即生效,不用重启。"),cors:r("默认关闭。改动立即生效,不用重启;关闭期间的跨源请求会被预检拦下。"),debug:r("开启后新发生的请求才会被记录(已经过去的请求补不回来)。报文统一存放在本地数据库里,只保留最近 500 条(超出后丢弃最旧的),条数见左侧「数据 → 数据存储」的「调试报文」。"),promptMode:r("替换 = 客户端 system / developer 消息全部删掉,换成网关的提示词;追加 = 保留客户端内容,只在开头 system 块之后多插一条。两者都只改发给上游的副本,客户端看到的响应不变。"),promptFile:r("UTF-8 文本文件路径,留空用内置默认提示词(通用编码助手提示词,不含任何会被上游拦截的模板句)。只在「替换 / 追加」模式下生效,透传模式不读它。"),promptText:r("在这里直接编辑提示词正文:保存后以这份文本为准(优先于上面的提示词文件),清空则回到文件 / 内置默认。改一个字不必再去编辑器里开文件。"),promptGatewayText:r("上游按「结构」校验身份:三段必须各自成块,所以这里分开编辑三段(不能合成一段)。动态段里的运行值写成占位符,发请求时才替换:{cwd} 工作目录、{platform} 平台、{shell} shell、{os_version} 系统版本、{git} 是否 git 仓库、{provider} 提供方标识、{model} 模型名。清空某一段 = 那一段恢复官方原文。第三段发出时前面会自带一个空行(官方形状)。"),prompt:r("改完立即生效,不用重启(下一个请求就用新模式)。降级是自动的临时状态,解除后本模式自己的提示词立刻恢复。"),promptProviders:r("「用哪份提示词」本来是按上游分别决定的事,所以每家可以有自己的模式、提示词文件与正文:不在这里列出的提供商一律沿用上面那份默认设置,「跟随默认」把这一家取消、回到默认。带「网关自带」那一行的家(目前是 ZCode 两家)默认就列在这里 —— 那一段是网关自己装上去的文本,不来自客户端也不来自提示词文件,默认开启、可以关掉,也可以改它的正文(改过的那一段以你的文本为准);关掉后还能不能通过上游校验,取决于上游当下的口径,行内说明了实测依据。「模式 / 提示词文件 / 正文」管的是客户端自己的 system 怎么处理,与那个开关是两件事。"),modelsDev:r("「模型管理」里每个能力的来源标记(上游 / models.dev / 已覆盖)读的就是这份数据;映射弹窗的思考档位下拉也按这里的数据只列该模型真实认识的档位。"),retention:r("保存后立即生效:改小保留天数会立刻删除超出的历史数据,且不可恢复。"),storageFile:r("配置目录下的 agent2api.db(账号、日志、请求记录、调试报文与设置都在里面)。"),storageSize:r("库主文件的大小(不含运行期间的 WAL 临时文件,退出时已自动并回)。"),storage:r("数据统一保存在配置目录下的 agent2api.db;如需更换位置,请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),captcha:r("开启后,登录页在浏览器后台自动完成验证(对真人无感),而脚本每次尝试都要先算一道题 —— 暴力破解与抢注的成本显著上升。仅影响面板的登录 / 注册,与 API 客户端的 API Key 无关。"),panelLogin:r("当前浏览器以管理员身份登录着本面板。「退出登录」会撤销这台设备的登录会话(30 天内的自动续期一并失效),需要重新输入账号密码;其他已登录的设备不受影响。"),exportDanger:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义,可直接用于登录。请妥善保管,不要外传或上传到公共位置。"),backupDanger:r("备份文件内含全部账号凭证、网关 API Key 与面板管理员凭据,可直接用于登录。请妥善保管,不要外传或上传到公共位置。")},Ut={appLoading:"—",appUnavailable:r("主进程未返回启动设置,请更新桌面端后重试"),appTrayOn:r("关闭窗口时程序不退出,转发继续在后台运行;退出请用托盘菜单"),appTrayOff:r("关闭窗口即退出程序,后台转发随之中断"),appLightOn:r("轻量模式已开启:关窗即销毁界面进程(释放约 200MB 内存),网关在后台继续;界面销毁期间 ZCode 活动套餐通道不可用,相关请求会在请求日志里注明原因"),appLightOff:r("未开启轻量模式:关窗仅隐藏窗口,界面进程常驻内存,随时打开不等待"),unitsOn:r("当前显示为「1.2亿 / 8400万」这类中文量级。"),unitsOff:r("当前显示为「1.20M / 8.4k」这类英文缩写。"),debugUnavailable:r("未能读取调试模式设置,请稍后重试"),debugOn:r("正在保存上游原始报文:"),debugOff:r("未开启,转发时不保存任何原始报文。"),sanitizeUnavailable:r("未能读取指纹脱敏设置,请稍后重试"),sanitizeOn:r("正在剥离出站请求里的审核指纹:表头键值整段删除,模板句最小改写。"),sanitizeOff:r("未开启,客户端 system 模板会原样发往上游,可能被内容审核误拦(400)。"),corsUnavailable:r("未能读取网关跨域访问设置,请稍后重试"),corsOn:r("正在应答跨源请求:浏览器跨域请求可直连 /v1/*。"),corsOff:r("未开启,浏览器跨域无法直连网关。"),modelsDevUnavailable:r("未能读取 models.dev 元数据状态,请稍后重试"),modelsDevSourceBuiltin:r("随包内嵌的快照(发版时的那份)"),modelsDevSourceCache:r("上次成功刷新的结果(存在本机数据库里)"),modelsDevSourceNetwork:r("刚刚从 models.dev 拉到的最新数据"),modelsDevEmpty:r("还没有装载任何数据。"),promptUnavailable:r("未能读取系统提示词设置,请稍后重试"),degradeUntilFallback:r("次日 00:00"),themeSystem:r("当前跟随操作系统的深浅色设置,系统切换时界面会自动跟上。"),themeLight:r("当前固定为浅色模式,不随系统变化。"),themeDark:r("当前固定为深色模式,不随系统变化。"),zoomWeb:r("网页端的界面缩放由浏览器自己控制(Ctrl + / Ctrl -,或浏览器菜单里的缩放),此项不可调。"),zoomDefault:r("当前按 100% 显示(默认比例)。"),languageHint:r("界面语言只保存在本机(localStorage)。切换后整页立即刷新,不影响账号、密钥与转发。")},Ox=[{value:"order",label:r("顺序优先"),tip:r("排第 1 的接走所有请求,直到它不能答(限流 / 故障 / 额度尽)才轮到下一位 —— 就是「从上往下」的现状行为。")},{value:"rotate",label:r("负载均衡"),tip:r("每条请求轮换到下一个可用账号;新会话交给当前最闲的那位。适合想把手里的号摊开用、不让某一个一直扛。")},{value:"provider",label:r("家内轮询"),tip:r("家之间仍按优先级,只有同一家内部轮流用各账号 —— 想优先用某几家、又不愿把某一家的某个账号焊死时用它。")}],Mx=[{value:"auto",label:r("自动"),tip:r("同一会话在 5 分钟内尽量跟住同一个账号;停了 5 分钟再发就算新会话。多数场景用它 —— 多轮对话少换号,也不至于把账号焊死。")},{value:"session",label:r("会话内"),tip:r("同一会话在 6 小时内跟住同一个账号;适合一坐几个小时的长会话,上游的上下文缓存能吃到更多。")},{value:"turn",label:r("每轮"),tip:r("每条请求都重新按策略选路 —— 行为与「关闭」一致,仅保留会话识别的记录。")},{value:"off",label:r("关闭"),tip:r("不做会话识别,每条请求都重新按策略选路。")}],WZ=[{key:"routingFailoverBackoff",label:r("失败退避"),defaultOn:!0,tip:r("转发失败的账号休息一会儿再回来:15 分钟起步,连续失败翻倍,封顶 1 小时;成功一次立即恢复。目的是「让这次失败先凉一会儿」,免得一条条地反复撞同一个坏账号。")},{key:"routingSink",label:r("限流垫底"),defaultOn:!0,tip:r("还有额度时被 429 的账号排到队尾,30 分钟后自动回到队列(成功转发一次也会立即回来)。它标记的是「疑似共享池被别人抢」,不是「这个账号本身有问题」。⚠️ 注意它与路由策略的配合:在「家内轮询」下,队尾意味着这一家整体被往后排 —— 如果某个提供商的账号被批量限流,它们会集体沉到队尾,那个家可能长时间轮不到。这时可以关掉本项,让 429 过的账号只受冷却约束(冷却到点自动回来)。")},{key:"routingBreakerEnabled",label:r("熔断"),defaultOn:!1,tip:r("连续失败到阈值后把这个账号整个打开(默认关)。与失败退避的分工:退避管「单次失败先凉一会儿」,惩罚轻、自动恢复;熔断管「这个账号现在整体不对劲,别再一条条地试」,要连续成功若干次才关。打开期间该账号被跳过,除非全场只剩它 —— 那时仍放行试一次。")}],DI=[{key:"zcodeCaptchaPoolTarget",id:"settings-captcha-pool-target",label:r("库存目标"),unit:r("个"),min:1,max:10,hint:r("ZCode 活动套餐通道每条请求都要消耗一个当次铸造的人机验证令牌(一次性,2 分钟过期),库存低于该值时界面自动补铸到它。默认 3 个。调大能吸收突发并发,但用不掉的令牌 2 分钟就过期作废,烧的是上游风控配额。可填 1–10。")},{key:"zcodeCaptchaPoolPollMs",id:"settings-captcha-pool-poll-ms",label:r("轮询间隔"),unit:r("毫秒"),min:1e3,max:3e4,hint:r("铸造守卫每隔多久看一次库存(毫秒)。只影响发现缺货的反应速度 —— 库存够用时轮询不会铸造任何令牌。默认 2500 毫秒,可填 1000–30000。")},{key:"zcodeCaptchaPoolMaxPerRound",id:"settings-captcha-pool-max-per-round",label:r("单轮铸造上限"),unit:r("个"),min:1,max:5,hint:r("发现缺货时一轮最多铸几个(连铸之间固定隔 500 毫秒)。默认 1 个:SDK 同一实例连铸容易互相干扰。调大补货更快,但单轮连铸越多越容易触发上游风控。可填 1–5。")}];function II(){return tt().workbuddyDesktop?.platform==="web"}let dt={...{category:Ax[0].id,scrollReset:0,busy:null,app:{status:"loading",closeToTray:!1,autostart:!1,lanAccess:!1,lanPanel:!1,lightweightMode:!1,lanIp:null,port:0,adminRegistered:null},unitsChinese:!0,retention:{status:"loading",values:null},retry:{status:"loading",values:null},retryCodes:null,timeouts:{status:"loading",values:null},queue:{status:"loading",values:null},captchaPool:{status:"loading",values:null},routing:{status:"loading",strategy:"order",sticky:"auto",failoverBackoff:!0,sink:!0,breakerEnabled:!1},debug:{status:"loading",on:!1,count:null,limit:null},sanitize:{status:"loading",on:!1},clineHeaders:{status:"loading",defaults:{},overrides:{},effective:{}},cors:{status:"loading",on:!1},prompt:{status:"loading",mode:"passthrough",file:"",text:"",source:"",lines:0,fileError:"",degradeActive:!1,degradeUntilText:"",providers:[],gateway:{},gatewayText:{},options:[]},storage:{status:"loading",available:!0,file:"",bytes:0,accounts:null,logs:null,requests:null,dailyDays:null,debug:null},captcha:{available:!0,enabled:!1},modelsDev:{status:"loading",enabled:!0,source:"",updatedAt:0,count:0},ioFailure:null,retentionConfirm:null,dbIncludeLogs:!0,dbBackupConfirm:null,dbWarning:null,lanConfirm:null,lanRegister:null,panelLogin:!1},panelLogin:II()};const uS=new Set;function JZ(e){return uS.add(e),()=>{uS.delete(e)}}function eW(){return dt}function tW(){return x.useSyncExternalStore(JZ,eW)}function Ze(e){dt={...dt,...e};for(const t of uS)t()}function Ma(e){Ze({app:{...dt.app,...e}})}function nl(){Ze({})}let En=null;function ds(e){En=e,Ze({busy:e})}function as(){En=null,Ze({busy:null})}function dS(e){const t=Ax.some(a=>a.id===e)?String(e):Ax[0].id;Ze({category:t,scrollReset:dt.scrollReset+1})}function nW(e){dS(e);try{localStorage.setItem(wI,e)}catch{}}function PI(){let e=null;try{e=localStorage.getItem(wI)}catch{e=null}dS(e)}function _I(){Ze({unitsChinese:tt().wbUnits?.isChinese?.()!==!1})}function sW(e){tt().wbUnits?.setChinese?.(e),_I(),Ve(r(e?"✅ 已改用本地量级词(万 / 亿式)":"✅ 已改用 k / M 缩写"))}function fS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ma({status:"unavailable"});return}const t=e;Ma({status:"ready",closeToTray:t.closeToTray===!0,autostart:t.autostart===!0,lanAccess:t.lanAccess===!0,lanPanel:t.lanPanel===!0,lightweightMode:t.lightweightMode===!0})}async function LI(){try{fS(await tt().workbuddyDesktop?.getAppSettings())}catch(e){console.warn("读取应用设置失败:",_t(e)),fS(null)}}async function rW(){const e=tt().workbuddyDesktop;if(e?.localIp){try{Ma({lanIp:await e.localIp()||null})}catch{}try{const t=Number((await e.getBackendStatus?.())?.port)||0;t&&Ma({port:t})}catch{}try{const t=(await e.panelAdminStatus?.())?.registered===!0;Ma({adminRegistered:t})}catch{}}}async function pS(e,t){if(En){nl();return}const a=dt.app,o={closeToTray:e==="tray"?t:a.closeToTray,autostart:e==="autostart"?t:a.autostart,lanAccess:a.lanAccess,lanPanel:a.lanPanel,lightweightMode:e==="lightweight"?t:a.lightweightMode};ds("app"),Ma(o);const c=r(e==="autostart"?"开机自动启动":e==="lightweight"?"轻量模式":"关闭窗口时最小化到托盘");try{const d=tt().workbuddyDesktop;if(!d)throw new Error(r("主进程桥不可用"));const f=await d.saveAppSettings(o);Ma({status:"ready",...QZ(f,o)}),Ve(r("✅ 已更新「{label}」",{label:c}))}catch(d){Ma(a),Ve(r("保存失败:{message}",{message:_t(d)}),"err")}finally{as()}}function aW(e){if(En){nl();return}Ze({lanConfirm:{mode:e?"enable":"disable",panel:dt.app.lanPanel}})}function lW(e){if(En){nl();return}Ze({lanConfirm:{mode:"panel",panel:e}})}function mS(e){const t=dt.lanConfirm;if(Ze({lanConfirm:null}),!(!t||!e)){if(t.mode==="disable"){Dx(!1,!1);return}if(t.mode==="panel"){Dx(!0,t.panel);return}oW()}}async function oW(){const e=tt().workbuddyDesktop;if(!e?.panelAdminStatus){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan");let t;try{t=(await e.panelAdminStatus())?.registered===!0}catch(a){as(),Ve(r("查询管理员状态失败:{message}",{message:_t(a)}),"err");return}if(as(),Ma({adminRegistered:t}),t){await Dx(!0,dt.app.lanPanel);return}Ze({lanRegister:{busy:!1,error:""}})}async function iW(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.panelRegister)return;const o=e.trim();if(!o||o.length>64){Ze({lanRegister:{busy:!1,error:r("请填写管理员账号(64 字符以内)")}});return}if(t.length<8){Ze({lanRegister:{busy:!1,error:r("密码至少 8 位")}});return}Ze({lanRegister:{busy:!0,error:""}});try{if(await a.panelRegister(o,t),dt.lanRegister===null)return;Ze({lanRegister:null}),Ma({adminRegistered:!0}),await Dx(!0,dt.app.lanPanel)}catch(c){Ze({lanRegister:{busy:!1,error:_t(c)}})}}function zI(){Ze({lanRegister:null})}async function Dx(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.changeLanAccess){Ve(r("当前环境不支持局域网访问设置"),"err");return}ds("lan"),Ma({lanAccess:e,lanPanel:t});try{(await a.changeLanAccess(e,t))?.createdKey&&Ve(r("✅ 已自动创建网关 Key「默认」(可在「网关 Key」页查看)")),Ve(r("✅ 设置已保存,应用正在重启…"))}catch(o){Ve(r("保存失败:{message}",{message:_t(o)}),"err"),await LI()}finally{as()}}async function cW(){if(!En){Ze({ioFailure:null}),ds("export");try{const e=await tt().workbuddyDesktop?.exportAccounts();if(e?.canceled){Ve(r("已取消导出"));return}const t=Number(e?.count)||0,a=Number(e?.customProviders)||0;if(!t&&!a){Ve(r("没有可导出的账号"),"err");return}const o=a?r("、{n} 个自定义提供商",{n:a}):"",c=e?.file?r(" 到 {file}",{file:e.file}):"";Ve(r("✅ 已导出 {count} 个账号{note}{file}",{count:t,note:o,file:c}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}async function uW(){if(!En){Ze({ioFailure:null}),ds("import");try{const e=await tt().workbuddyDesktop?.importAccounts();if(e?.canceled){Ve(r("已取消导入"));return}const t=Number(e?.added)||0,a=Number(e?.updated)||0,o=Number(e?.skipped)||0,c=Number(e?.failed)||0,d=Array.isArray(e?.errors)?e.errors:[],f=e?.customProviders??{},p=Number(f.added)||0,h=Number(f.updated)||0,b=[];o&&b.push(r("跳过 {n} 个",{n:o})),c&&b.push(r("失败 {n} 个",{n:c}));const y=b.length?r(",{items}",{items:b.join(r("、"))}):"",v=p||h?r(",自定义提供商新增 {added} 个、更新 {updated} 个",{added:p,updated:h}):"",w=r("新增 {added} 个、更新 {updated} 个{suffix}{note}",{added:t,updated:a,suffix:y,note:v});if(c){Ve(r("导入完成:{summary}",{summary:w}),"err");const j=d.slice(0,3).map(S=>{const N=S?.customProvider?r("自定义提供商 {id}",{id:S?.id||r("(无 id)")}):S?.id??r("未知账号"),k=S?.message??r("未知原因");return r("{label}({message})",{label:N,message:k})}).join(r(";"));Ze({ioFailure:{failed:c,detail:j,more:d.length>3}})}else Ve(r("✅ 导入完成:{summary}",{summary:w}));(t||a||p||h)&&await tt().wbApp?.refresh?.()}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function dW(e){Ze({dbIncludeLogs:e})}async function fW(){if(!En){ds("dbExport");try{const e=tt().workbuddyDesktop;if(!e?.exportDatabase){Ve(r("当前环境不支持整库备份(仅桌面端可用)"),"err");return}const t=await e.exportDatabase(dt.dbIncludeLogs);if(t?.canceled){Ve(r("已取消导出"));return}const a=Number(t?.bytes)||0,o=Array.isArray(t?.tables)?t.tables.length:0;Ve(r("✅ 已备份 {n} 张表({size})到 {file}",{n:o,size:MI(a),file:t?.file||""}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function pW(){En||Ze({dbBackupConfirm:{includeLogs:dt.dbIncludeLogs}})}function hS(e){Ze({dbBackupConfirm:null}),e&&mW()}async function mW(){if(En)return;const e=tt().workbuddyDesktop;if(!e?.importDatabase){Ve(r("当前环境不支持整库恢复(仅桌面端可用)"),"err");return}ds("dbImport"),Ze({dbWarning:null});try{const t=await e.importDatabase(),a=Array.isArray(t?.tables)?t.tables.length:0,o=t?.safetyBackup?r(",替换前的数据已备份为 {name}",{name:t.safetyBackup}):"";Ve(r("✅ 已恢复 {n} 张表{note}",{n:a,note:o}));const c=typeof t?.warning=="string"?t.warning.trim():"";c&&Ze({dbWarning:c}),await ES(),await tt().wbApp?.refresh?.()}catch(t){Ve(r("恢复失败:{message}",{message:_t(t)}),"err")}finally{as()}}function Ix(e){if(e===void 0)return;const t=OI(oS,e,dt.retention.values);Ze({retention:{status:t===null?"unavailable":"ready",values:t}})}async function Px(){try{Ix(await tt().workbuddyDesktop?.getRetention())}catch(e){console.warn("读取数据保留设置失败:",_t(e)),Ix(null)}}let _x=null;function Lx(e){const t=_x;_x=null,Ze({retentionConfirm:null}),t?.(e)}function hW(e){return new Promise(t=>{_x&&Lx(!1),_x=t,Ze({retentionConfirm:{head:e}})})}function gW(e,t,a){return t===null?r("没能读到「{label}」的当前值,改为 {days} 天可能会删除超出的历史数据。",{label:e.label,days:a}):r("「{label}」将从 {previous} 天改为 {days} 天。",{label:e.label,previous:t,days:a})}async function xW(e,t){if(En||dt.retentionConfirm)return;const a=RI(t,e.min,e.max,r("天数"));if(!a.ok){Ve(a.message,"err");return}const o=dt.retention.values?.[e.key],c=typeof o=="number"&&Number.isInteger(o)?o:null;if(c!==null&&a.value===c)return;const d=c===null||a.valueNumber.isInteger(d?.[f.key]))){const f=d?.[e.key]??t;Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:f}):r("✅ 已保留 {days} 天",{days:f}));return}await Px(),Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:t}):r("✅ 已保留 {days} 天",{days:t}))}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await Px()}finally{as()}}function Np(e,t){if(t===void 0)return;const a=OI(e.fields,t,e.read().values);e.write({status:a===null?"unavailable":"ready",values:a}),e.syncExtras?.(a===null?null:t)}async function Ku(e){try{Np(e,await e.get())}catch(t){console.warn(`${e.consoleLabel}失败:`,_t(t)),Np(e,null)}}async function zx(e,t,a){if(En)return;const o=RI(a,t.min,t.max,t.label);if(!o.ok){Ve(o.message,"err");return}const c=e.read().values?.[t.key];if(Number.isInteger(c)&&o.value===c)return;ds(e.scope);const d=e.read().values;d&&e.write({status:"ready",values:{...d,[t.key]:o.value}});try{const f=await e.save({[t.key]:o.value});Np(e,f);const p=e.read().values?.[t.key],h=Number.isInteger(p)?p:o.value;Ve(r("✅ 已保存:{label} {value}",{label:t.label,value:String(h)}))}catch(f){Ve(r("保存失败:{message}",{message:_t(f)}),"err"),await Ku(e)}finally{as()}}const BI={scope:"queue",fields:TI,consoleLabel:"读取排队等待设置",get:()=>tt().workbuddyDesktop?.getQueue(),save:e=>tt().workbuddyDesktop?.saveQueue(e),read:()=>dt.queue,write:e=>Ze({queue:e})};async function HI(){await Ku(BI)}async function vW(e,t){await zx(BI,e,t)}const UI={scope:"captchaPool",fields:DI,consoleLabel:"读取验证码令牌池设置",get:()=>tt().workbuddyDesktop?.getCaptchaPool(),save:e=>tt().workbuddyDesktop?.saveCaptchaPool(e),read:()=>dt.captchaPool,write:e=>Ze({captchaPool:e})};async function VI(){await Ku(UI)}async function yW(e,t){await zx(UI,e,t)}const FI="routingStrategy",$I="routingSticky",wW="routingFailoverBackoff",jW="routingSink",SW="routingBreakerEnabled",NW={[FI]:new Set(Ox.map(e=>e.value)),[$I]:new Set(Mx.map(e=>e.value))};function qI(e){const t=e&&typeof e=="object"?e:{},a=(c,d)=>{const f=t[c];return typeof f=="string"&&NW[c].has(f)?f:d},o=(c,d)=>{const f=t[c];return typeof f=="boolean"?f:d};return{strategy:a(FI,"order"),sticky:a($I,"auto"),failoverBackoff:o(wW,!0),sink:o(jW,!0),breakerEnabled:o(SW,!1)}}async function Bx(){try{const e=await tt().workbuddyDesktop?.getRoutingConfig();if(e===void 0){Ze({routing:{...dt.routing,status:"unavailable"}});return}Ze({routing:{status:"ready",...qI(e)}})}catch(e){console.warn("读取路由设置失败:",_t(e)),Ze({routing:{...dt.routing,status:"unavailable"}})}}async function gS(e){if(En)return;const t=tt().workbuddyDesktop;if(!t?.setRoutingConfig){Ve(r("桌面运行时不可用,暂时无法保存"),"err");return}ds("routing");try{const a=await t.setRoutingConfig(e);a!==void 0?Ze({routing:{status:"ready",...qI(a)}}):await Bx(),Ve(r("✅ 路由设置已保存"))}catch(a){Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await Bx()}finally{as()}}const kp={scope:"retry",fields:kI,consoleLabel:"读取请求重试设置",get:()=>tt().workbuddyDesktop?.getRetry(),save:e=>tt().workbuddyDesktop?.saveRetry(e),read:()=>dt.retry,write:e=>Ze({retry:e}),syncExtras:e=>{if(e===null){Ze({retryCodes:null});return}const t=e[EI];if(!Array.isArray(t))return;Ze({retryCodes:t.filter(o=>typeof o=="number"&&Number.isInteger(o)&&o>=iS&&o<=cS)})}};function kW(e){Np(kp,e)}async function GI(){await Ku(kp)}async function CW(e,t){await zx(kp,e,t)}async function xS(e){if(!En){Ze({retryCodes:e}),ds("codes");try{const t=await tt().workbuddyDesktop?.saveRetry({[EI]:e});Np(kp,t),Ve(r("✅ 已保存:指定错误码直接换号"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await Ku(kp)}finally{as()}}}async function TW(e){const t=dt.retryCodes;if(t===null)return;const a=String(e??"").trim();if(!a)return;if(!/^\d+$/.test(a)||Number(a)cS){Ve(r("状态码必须是 {min}–{max} 的整数(收到: {text})",{min:iS,max:cS,text:a}),"err");return}const o=Number(a);if(t.includes(o)){Ve(r("状态码 {code} 已在名单里",{code:o}));return}if(t.length>=AI){Ve(r("名单最多 {max} 个状态码",{max:AI}),"err");return}await xS([...t,o])}async function EW(e){const t=dt.retryCodes;!t||!t.includes(e)||await xS(t.filter(a=>a!==e))}async function AW(){const e=dt.retryCodes;e?.length&&await xS(e.slice(0,-1))}const KI={scope:"timeouts",fields:CI,consoleLabel:"读取请求超时设置",get:()=>tt().workbuddyDesktop?.getTimeouts(),save:e=>tt().workbuddyDesktop?.saveTimeouts(e),read:()=>dt.timeouts,write:e=>Ze({timeouts:e})};async function YI(){await Ku(KI)}async function RW(e,t){await zx(KI,e,t)}function Hx(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({debug:{status:"unavailable",on:!1,count:null,limit:null}});return}const t=e,a=Number(t.count),o=Number(t.limit);Ze({debug:{status:"ready",on:t.debugMode===!0,count:Number.isInteger(a)?a:null,limit:Number.isInteger(o)?o:null}})}async function bS(){try{Hx(await tt().workbuddyDesktop?.getDebug())}catch(e){console.warn("读取调试模式设置失败:",_t(e)),Hx(null)}}async function OW(e){if(En){nl();return}ds("debug"),Ze({debug:{...dt.debug,on:e}});try{const t=await tt().workbuddyDesktop?.saveDebug(e);Hx(t),Ve(r(e?"✅ 调试模式已开启":"✅ 调试模式已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await bS()}finally{as()}}function Ux(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({sanitize:{status:"unavailable",on:!1}});return}Ze({sanitize:{status:"ready",on:e.sanitizeBlacklistFingerprints===!0}})}async function vS(){try{Ux(await tt().workbuddyDesktop?.getSanitize())}catch(e){console.warn("读取出站指纹脱敏设置失败:",_t(e)),Ux(null)}}async function MW(e){if(En){nl();return}ds("sanitize"),Ze({sanitize:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveSanitize(e);Ux(t),Ve(r(e?"✅ 出站指纹脱敏已开启":"已关闭出站指纹脱敏"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await vS()}finally{as()}}function yS(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function wS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({clineHeaders:{status:"unavailable",defaults:{},overrides:{},effective:{}}});return}const t=e;Ze({clineHeaders:{status:"ready",defaults:yS(t.defaults),overrides:yS(t.overrides),effective:yS(t.effective)}})}async function jS(){try{wS(await tt().workbuddyDesktop?.getClineHeaders())}catch(e){console.warn("读取 Cline 伪装头失败:",_t(e)),wS(null)}}async function DW(){await jS(),Ve(r("Cline 伪装头已刷新"))}async function XI(e){if(En){nl();return}ds("clineHeaders");try{const t=await tt().workbuddyDesktop?.saveClineHeaders(e);wS(t),Ve(r("✅ Cline 伪装头已保存"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await jS()}finally{as()}}function SS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({cors:{status:"unavailable",on:!1}});return}Ze({cors:{status:"ready",on:e.corsEnabled===!0}})}async function NS(){try{SS(await tt().workbuddyDesktop?.getCors())}catch(e){console.warn("读取网关跨域访问设置失败:",_t(e)),SS(null)}}async function IW(e){if(En){nl();return}ds("cors"),Ze({cors:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveCors(e);SS(t),Ve(r(e?"网关跨域访问已开启":"已关闭网关跨域访问"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await NS()}finally{as()}}async function QI(){try{const e=await tt().workbuddyDesktop?.getCaptchaSetting();Ze({captcha:{available:!0,enabled:e?.captchaEnabled===!0}})}catch(e){Ze({captcha:{available:!1,enabled:!1}}),console.warn("读取机器人校验设置失败:",_t(e))}}async function PW(e){if(En){nl();return}ds("captcha"),Ze({captcha:{...dt.captcha,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveCaptchaSetting(e);Ze({captcha:{available:!0,enabled:t?.captchaEnabled===!0}}),Ve(r(e?"✅ 机器人校验已开启":"⚠️ 机器人校验已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await QI()}finally{as()}}function kS(e){return!e||typeof e!="object"?{status:"unavailable",enabled:!0,source:"",updatedAt:0,count:0}:{status:"ready",enabled:e.modelsDevEnabled!==!1,source:typeof e.source=="string"?e.source:"",updatedAt:Number(e.updatedAt)||0,count:Number(e.count)||0}}async function CS(){try{const e=await tt().workbuddyDesktop?.getModelsDev?.();Ze({modelsDev:kS(e)})}catch(e){Ze({modelsDev:{...dt.modelsDev,status:"unavailable"}}),console.warn("读取 models.dev 元数据设置失败:",_t(e))}}async function _W(e){if(En){nl();return}ds("modelsDev"),Ze({modelsDev:{...dt.modelsDev,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveModelsDev?.(e);Ze({modelsDev:kS(t)}),Ve(r(e?"✅ models.dev 模型元数据已开启":"已关闭 models.dev 联网刷新"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await CS()}finally{as()}}async function LW(){if(En){nl();return}ds("modelsDevRefresh");try{const e=await tt().workbuddyDesktop?.refreshModelsDev?.();Ze({modelsDev:kS(e?.status)});const t=e?.result,a=String(t?.status||"");a==="refreshed"?Ve(r("models.dev 元数据已更新({count} 条)",{count:Number(t?.count)||0})):a==="failed"?Ve(r("刷新失败:{message}",{message:String(t?.message||"")}),"err"):Ve(String(t?.message||r("本次无需刷新")))}catch(e){Ve(r("刷新失败:{message}",{message:_t(e)}),"err"),await CS()}finally{as()}}function Yu(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({prompt:{...dt.prompt,status:"unavailable"}});return}const t=e,a=HW(t.promptGateway);Ze({prompt:{status:"ready",mode:String(t.promptMode||"passthrough"),file:String(t.promptFile||""),text:String(t.promptText||""),source:String(t.promptSource||""),lines:Number(t.promptLines)||0,fileError:String(t.promptFileError||""),degradeActive:t.degradeActive===!0,degradeUntilText:String(t.degradeUntilText||""),providers:zW(t.promptProviders,a),gateway:a,gatewayText:UW(t.promptGatewayText),options:BW(t.promptProviderOptions)}})}function zW(e,t){return!e||typeof e!="object"?[]:Object.entries(e).filter(([a,o])=>!!a&&!!o&&typeof o=="object").map(([a,o])=>{const c=o;return{id:a,mode:String(c.promptMode||"passthrough"),file:String(c.promptFile||""),text:String(c.promptText||""),source:String(c.promptSource||""),lines:Number(c.promptLines)||0,fileError:String(c.promptFileError||""),gateway:t[a]??!0,configured:!0}}).sort((a,o)=>a.id.localeCompare(o.id))}function BW(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&String(t.id||"")).map(t=>{const a=t;return{id:String(a.id),label:String(a.label||a.id),gatewayNote:String(a.gatewayNote||""),gatewayChars:Number(a.gatewayChars)||0,gatewayBlocks:VW(a.gatewayBlocks)}}):[]}function HW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();!c||typeof o!="boolean"||(t[c]=o)}return t}function UW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();if(!c||!o||typeof o!="object")continue;const d=o,f={identity:"",stable:"",dynamic:""};let p=!1;for(const h of["identity","stable","dynamic"]){const b=String(d[h]||"");f[h]=b,b.trim()&&(p=!0)}p&&(t[c]=f)}return t}function VW(e){if(!e||typeof e!="object")return null;const t=e,a={identity:String(t.identity||""),stable:String(t.stable||""),dynamic:String(t.dynamic||"")};return!a.identity.trim()&&!a.stable.trim()&&!a.dynamic.trim()?null:a}async function rc(){try{Yu(await tt().workbuddyDesktop?.getPrompt())}catch(e){console.warn("读取系统提示词设置失败:",_t(e)),Yu(null)}}async function Cp(e,t){if(En)return await rc(),!1;ds("prompt");try{const a=await tt().workbuddyDesktop?.savePrompt(t);return Yu(a),Ve(r("✅ 已保存:{label}",{label:e})),!0}catch(a){return Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await rc(),!1}finally{as()}}async function FW(e){const t=zo.find(a=>a.value===e);await Cp(r("模式改为「{mode}」",{mode:t?.toastLabel??e}),{promptMode:e})}async function $W(e){await Cp(e.trim()?r("提示词文件已更新"):r("已改回内置默认提示词"),{promptFile:e})}async function qW(e){const t=!e.trim();return Cp(r(t?"已清掉界面编辑的提示词(回落文件 / 内置默认)":"提示词正文已更新"),{promptText:t?"":e})}function Bo(e,t){return e.options.find(a=>a.id===t)?.label||t}function ac(e){const t=e==null?"":String(e).trim();return t&&dt.prompt.options.some(a=>a.id===t)?t:""}async function Tp(e,t,a){return Cp(e,{promptProviders:{[t]:a}})}function Vx(e,t){const a=!t.configured;return{promptMode:t.mode,promptFile:t.file,promptText:a&&e.source==="inline"?e.text:""}}async function GW(e){const t=ac(e);if(!t)return;const a=dt.prompt;await Tp(r("已为「{label}」单独配置提示词",{label:Bo(a,t)}),t,Vx(a,{mode:a.mode,file:a.file,text:a.text,source:a.source,lines:a.lines,fileError:a.fileError,gateway:a.gateway[t]??!0,configured:!1}))}async function KW(e,t){const a=ac(e.id);if(!a||!zo.some(c=>c.value===t))return;const o=zo.find(c=>c.value===t);await Tp(r("「{label}」的模式改为「{mode}」",{label:Bo(dt.prompt,a),mode:o?.toastLabel??t}),a,{...Vx(dt.prompt,e),promptMode:t})}async function YW(e,t){const a=ac(e.id);a&&await Tp(t.trim()?r("「{label}」的提示词文件已更新",{label:Bo(dt.prompt,a)}):r("「{label}」改用内置默认提示词",{label:Bo(dt.prompt,a)}),a,{...Vx(dt.prompt,e),promptFile:t})}async function XW(e,t){const a=ac(e.id);if(!a)return!1;const o=!t.trim(),c=Bo(dt.prompt,a);return Tp(o?r("已清掉「{label}」界面编辑的正文",{label:c}):r("「{label}」的提示词正文已更新",{label:c}),a,{...Vx(dt.prompt,e),promptText:o?"":t})}async function QW(e){const t=ac(e);t&&await Tp(r("已取消「{label}」的单独配置",{label:Bo(dt.prompt,t)}),t,null)}async function ZW(e,t){const a=ac(e);if(!a)return;const o=Bo(dt.prompt,a);if(En){await rc();return}ds("prompt");try{const c=await tt().workbuddyDesktop?.savePrompt({promptGateway:{[a]:t}});Yu(c),Ve(t?r("✅ 已为「{label}」装上网关自带提示词",{label:o}):r("已关闭「{label}」的网关自带提示词:能否通过上游校验取决于上游当前口径",{label:o}),t?"ok":"err")}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await rc()}finally{as()}}async function WW(e,t){const a=ac(e);if(!a)return!1;const o=Bo(dt.prompt,a),c=!t||!(t.identity.trim()||t.stable.trim()||t.dynamic.trim());return Cp(c?r("「{label}」的网关自带提示词已改回官方原文",{label:o}):r("「{label}」的网关自带提示词正文已更新",{label:o}),{promptGatewayText:{[a]:c?null:t}})}async function JW(){if(!En){ds("prompt");try{const e=await tt().workbuddyDesktop?.savePrompt({clearDegrade:!0});Yu(e),Ve(r("✅ 已解除内容拦截降级"))}catch(e){Ve(r("解除失败:{message}",{message:_t(e)}),"err"),await rc()}finally{as()}}}function Ep(e){const t=Number(e);return Number.isFinite(t)?t:null}function TS(e){if(e===void 0)return;const t=e&&typeof e=="object"?e.database:null;if(!t||typeof t!="object"){Ze({storage:{...dt.storage,status:"unavailable"}});return}const a=t;Ze({storage:{status:"ready",available:a.available!==!1,file:String(a.file||""),bytes:Number(a.bytes)||0,accounts:Ep(a.accounts),logs:Ep(a.logs),requests:Ep(a.requests),dailyDays:Ep(a.dailyDays),debug:Ep(a.debug)}})}async function ZI(){try{TS(await tt().workbuddyDesktop?.getStorage())}catch(e){console.warn("读取数据存储概况失败:",_t(e)),TS(null)}}async function eJ(){try{return await tt().workbuddyDesktop?.panelLogout(),window.location.href="/login",!0}catch(e){return Ve(r("退出失败:{message}",{message:_t(e)}),"err"),!1}}async function ES(){PI(),_I(),Ze({panelLogin:II()}),await Promise.all([LI(),rW(),Px(),GI(),YI(),HI(),VI(),Bx(),bS(),vS(),jS(),NS(),rc(),ZI(),QI(),CS(),tt().wbUpdatePanel?.load?.()])}async function tJ(){await Px(),Ve(r("保留天数已刷新"))}async function nJ(){await GI(),Ve(r("重试设置已刷新"))}async function sJ(){await YI(),Ve(r("超时设置已刷新"))}async function rJ(){await HI(),Ve(r("排队等待设置已刷新"))}async function aJ(){await VI(),Ve(r("验证码令牌池设置已刷新"))}async function lJ(){await Bx(),Ve(r("路由设置已刷新"))}async function oJ(){await bS(),Ve(r("调试模式设置已刷新"))}async function iJ(){await vS(),Ve(r("指纹脱敏设置已刷新"))}async function cJ(){await NS(),Ve(r("网关跨域访问设置已刷新"))}async function uJ(){await rc(),Ve(r("系统提示词设置已刷新"))}async function dJ(){await ZI(),Ve(r("存储概况已刷新"))}const Fx=[{key:"identity",label:r("第一段(身份句)"),short:r("第一段"),hint:r("官方原文只有一句:声明自己是 ZCode。")},{key:"stable",label:r("第二段(稳定段)"),short:r("第二段"),hint:r("工具用法与环境说明那一大段。")},{key:"dynamic",label:r("第三段(动态段)"),short:r("第三段"),hint:r("沟通方式 / 上下文管理 + Environment 段。")}];function fJ(e){return r(e==="inline"?"界面里编辑的正文":e==="file"?"提示词文件":e==="builtin"?"内置默认提示词":"(未生效)")}function WI({title:e,text:t,source:a,file:o,disabled:c,save:d,onClose:f}){const[p,h]=x.useState(t),[b,y]=x.useState(!1),v=b||c,w=p!==t;async function j(S){y(!0);try{await d(S)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:S=>{S||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("保存后以这里的文本为准")}),s.jsxs("p",{children:[r("这一份就是「替换 / 追加」模式下网关要发的 system 正文。"),a==="none"?r("当前是透传模式:存下来也不会发出,切成「替换 / 追加」之后才生效。"):r("当前生效的正文来自{source}{file}。保存后这一份会盖过提示词文件与内置默认{note}。",{source:fJ(a),file:o.trim()&&a!=="inline"?r("(文件:{path})",{path:o.trim()}):"",note:a!=="inline"&&o.trim()?r(",文件里后续的改动在清空这里之前不再生效"):""}),r("想回到原来那份,把这里清空再保存即可(不会删掉你配的文件路径)。")]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"settings-prompt-body",children:r("提示词正文")}),s.jsx(Qc,{id:"settings-prompt-body",rows:18,className:"min-h-[320px]",spellCheck:!1,disabled:v,value:p,onChange:S=>h(S.currentTarget.value)}),s.jsx("div",{className:"hint",children:p.trim()?r("{lines} 行、{chars} 字符(按当前草稿计)",{lines:p.split(` -`).length,chars:p.length}):r("空 = 不要这一份,回落提示词文件 / 内置默认提示词。")})]})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||a!=="inline",onClick:()=>{j("")},children:r("清除这里的正文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{j(p)},children:r(b?"保存中…":"保存")})]})]})})}function pJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-prompt-edit-body",variant:"outline",disabled:t||a,onClick:()=>c(!0),children:r("编辑正文")}),o?s.jsx(WI,{title:r("编辑提示词正文 · 全局"),text:e.text,source:e.source,file:e.file,disabled:a,save:qW,onClose:()=>c(!1)}):null]})}function mJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-edit-body-${e.id}`,variant:"outline",disabled:a||o,onClick:()=>d(!0),children:r("编辑正文")}),c?s.jsx(WI,{title:r("编辑提示词正文 · {label}",{label:t}),text:e.text,source:e.source,file:e.file,disabled:o,save:f=>XW(e,f),onClose:()=>d(!1)}):null]})}function hJ({id:e,title:t,official:a,over:o,enabled:c,disabled:d,onClose:f}){const[p,h]=x.useState(()=>({identity:o?.identity?.trim()?o.identity:a.identity,stable:o?.stable?.trim()?o.stable:a.stable,dynamic:o?.dynamic?.trim()?o.dynamic:a.dynamic})),[b,y]=x.useState(!1),v=b||d,w=Fx.some(N=>p[N.key]!==a[N.key]),j=Fx.filter(N=>o?.[N.key]?.trim()).map(N=>N.label);async function S(N){y(!0);try{await WW(e,N)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:N=>{N||v||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("三段各自成块,所以分开编辑")}),s.jsxs("p",{children:[r("上游按"),s.jsx("strong",{children:r("结构")}),r("校验身份:这三段必须各自成块排在最前(实测:三段并成一段会被回 405 / 3012)。因此这里按段编辑,不能合成一段。改过的段以你的文本为准,没改的段继续用官方原文;清空某一段 = 那一段恢复官方原文。"),j.length?r("当前已改过:{edited}。",{edited:j.join(r("、"))}):r("当前三段都是官方原文。"),c?"":r("注意:这一家的「网关自带」开关现在是关的,改过的正文要等开关打开才生效。")]}),s.jsx("p",{children:$n.promptGatewayText})]}),Fx.map(N=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs(Je,{htmlFor:`settings-prompt-block-${e}-${N.key}`,children:[N.label,s.jsx("span",{className:"ml-2 font-normal text-subtle",children:p[N.key]===a[N.key]?r("(官方原文)"):r("(已改)")})]}),s.jsx(Qc,{id:`settings-prompt-block-${e}-${N.key}`,rows:N.key==="identity"?2:10,className:N.key==="identity"?"min-h-[64px]":"min-h-[200px]",spellCheck:!1,disabled:v,value:p[N.key],onChange:k=>{const T=k.currentTarget.value;h(D=>({...D,[N.key]:T}))}}),s.jsx("div",{className:"hint",children:N.hint})]},N.key))]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:v||!j.length,onClick:()=>{S(null)},children:r("恢复官方原文")}),s.jsx(se,{variant:"outline",disabled:v,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:v||!w,onClick:()=>{S(p)},children:r(b?"保存中…":"保存")})]})]})})}function gJ({item:e,option:t,over:a,locked:o,busy:c}){const[d,f]=x.useState(!1),p=t.gatewayBlocks;return p?s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-gateway-text-${e.id}`,variant:"outline",disabled:o||c,onClick:()=>f(!0),children:r("编辑正文")}),d?s.jsx(hJ,{id:e.id,title:r("编辑网关自带提示词 · {label}",{label:t.label}),official:p,over:a,enabled:e.gateway,disabled:c,onClose:()=>f(!1)}):null]}):null}function xJ(e){return e?Fx.filter(t=>(e[t.key]||"").trim()).map(t=>t.short).join(r("、")):""}function JI(e,t){return tt().wbIcons?.icon?.(e,t)||""}function cn({tone:e,children:t}){const a=e==="ok"?"success":e==="bad"?"destructive":"outline";return s.jsx(ze,{variant:a,children:t})}function Qn({title:e,tip:t,badge:a,actions:o}){return s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]})}function bJ({title:e,tip:t,badge:a,actions:o,children:c}){function d(f){f.target.closest(".tip-q, .head-actions")&&f.preventDefault()}return s.jsxs("details",{className:"panel panel-fold",children:[s.jsxs("summary",{className:"panel-head",onClick:d,children:[s.jsx("span",{className:"fold-caret","aria-hidden":!0,dangerouslySetInnerHTML:{__html:JI("caretRight",14)}}),s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]}),c]})}function da({id:e,label:t,checked:a,disabled:o,tip:c,onCheckedChange:d}){return s.jsxs("label",{className:"switch",children:[s.jsx(hs,{id:e,checked:a,disabled:o,onCheckedChange:f=>d(f)}),s.jsx("span",{children:t}),c?s.jsx("span",{className:"tip-q","data-tip":c}):null]})}function Ap({field:e,value:t,disabled:a,onCommit:o}){const[c,d]=x.useState(null),f=c!==null?c:t===null?"":String(t);async function p(){const h=c;if(h!==null)try{await o(h)}finally{d(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:e.id,children:e.label}),s.jsxs("span",{className:"retention-input",children:[s.jsx($e,{id:e.id,type:"number",min:e.min,max:e.max,step:1,inputMode:"numeric",className:"w-[92px] max-w-[92px] text-center tabular-nums",value:f,disabled:a||t===null,onChange:h=>d(h.target.value),onFocus:()=>d(String(t??"")),onBlur:()=>{p()},onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}}),s.jsx("span",{className:"unit",children:e.unit})]}),s.jsx("div",{className:"hint",children:e.hint})]})}function Rp(e){return e.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}function Br({id:e,onClick:t}){return s.jsx(se,{id:e,variant:"outline",onClick:t,children:r("刷新")})}function vJ(e){const{lanAccess:t,lanPanel:a,lanIp:o,port:c}=e.app;if(!t)return r("未开启:网关只监听 127.0.0.1,仅本机可以访问。");const d=`http://${o||r("<本机IP>")}${c?`:${c}`:""}`,f=a?r(";网页管理面板已一并开放(浏览器打开同一地址)"):"";return r("已开启:其他设备把 API 地址指向 {url}{panel}。",{url:`${d}/v1`,panel:f})}function yJ({snap:e}){const t=e.app,a=t.status==="unavailable"?Ut.appUnavailable:t.status==="loading"?Ut.appLoading:t.closeToTray?t.lightweightMode?Ut.appLightOn:Ut.appTrayOn:Ut.appTrayOff;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("启动与托盘"),tip:rs.tray,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已应用")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-close-to-tray",label:r("关闭窗口时最小化到托盘"),checked:t.closeToTray,disabled:e.busy==="app",onCheckedChange:o=>{pS("tray",o)}}),s.jsx(da,{id:"settings-lightweight",label:r("轻量模式(关窗释放界面内存)"),tip:rs.lightweight,checked:t.lightweightMode,disabled:e.busy==="app"||!t.closeToTray,onCheckedChange:o=>{pS("lightweight",o)}}),s.jsx(da,{id:"settings-autostart",label:r("开机自动启动"),checked:t.autostart,disabled:e.busy==="app",onCheckedChange:o=>{pS("autostart",o)}})]}),s.jsx("div",{className:"settings-state",children:a})]})]}),!e.panelLogin&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("局域网访问"),tip:rs.lan}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-lan-access",label:r("允许局域网内的设备访问网关"),checked:e.app.lanAccess,disabled:e.busy==="lan",onCheckedChange:aW}),s.jsx(da,{id:"settings-lan-panel",label:r("同时开放网页管理面板"),checked:e.app.lanPanel,disabled:e.busy==="lan"||!e.app.lanAccess,onCheckedChange:lW})]}),s.jsx("div",{className:"settings-state",children:vJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("计量单位"),tip:rs.units}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-chinese-units",label:r("使用中文单位(亿 / 万)"),checked:e.unitsChinese,onCheckedChange:sW})}),s.jsx("div",{className:"settings-state",children:e.unitsChinese?Ut.unitsOn:Ut.unitsOff})]})]})]})}function wJ(e){return e==="light"?Ut.themeLight:e==="dark"?Ut.themeDark:Ut.themeSystem}function jJ(){const[e,t]=x.useState(YZ),[a,o]=x.useState(XZ),c=tt().workbuddyDesktop?.platform==="web";x.useEffect(()=>{const f=h=>t(String(h.detail||"system")),p=h=>o(Number(h.detail)||100);return window.addEventListener(jI,f),window.addEventListener(SI,p),()=>{window.removeEventListener(jI,f),window.removeEventListener(SI,p)}},[]);const d=a===100?r("100%(默认)"):`${a}%`;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("显示模式"),tip:rs.displayTheme}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{children:s.jsx(In,{"aria-label":r("显示模式"),options:KZ,value:e,onValueChange:f=>tt().wbApp?.applyTheme?.(f)})}),s.jsx("div",{className:"settings-state",children:wJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("界面缩放"),tip:rs.displayZoom}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-zoom",children:r("缩放比例")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:String(a),onValueChange:f=>tt().wbApp?.applyZoom?.(Number(f)),children:[s.jsx(mt,{id:"settings-zoom",className:"w-[140px]",disabled:c,"aria-label":r("界面缩放比例"),children:s.jsx(pt,{children:d})}),s.jsx(ht,{children:GZ.map(f=>s.jsx(qe,{value:String(f),children:f===100?r("100%(默认)"):`${f}%`},f))})]})}),s.jsx("div",{className:"hint",children:r("放大或缩小整个界面(文字与控件一起变),效果与浏览器 Ctrl +/- 相同:共 11 档,立即生效并记住。")})]})}),s.jsx("div",{className:"settings-state",children:c?Ut.zoomWeb:a===100?Ut.zoomDefault:r("当前按 {n}% 显示。",{n:a})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("语言设置"),tip:rs.displayLanguage}),s.jsxs("div",{className:"panel-body",children:[s.jsx(SJ,{}),s.jsx("div",{className:"settings-state",children:Ut.languageHint})]})]})]})}function SJ(){const e=window.wbI18n,t=e?.rawLocale?.()??"auto",a=e?.LOCALES??[],o=c=>c==="auto"?r("跟随系统"):a.find(d=>d.code===c)?.label??c;return s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-language",children:r("界面语言")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t,onValueChange:c=>{c&&e?.setLocale(c)},children:[s.jsx(mt,{id:"settings-language",className:"w-[200px]","aria-label":r("界面语言"),children:s.jsx(pt,{children:o(t)})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"auto",children:r("跟随系统")}),a.map(c=>s.jsx(qe,{value:c.code,children:c.label},c.code))]})]})})]})})}function NJ({codes:e,status:t,busy:a}){const[o,c]=x.useState(""),d=x.useRef(null),f=t==="unavailable";return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-retry-no-codes-input",children:r("指定错误码直接换号")}),s.jsx("div",{className:"retention-input",children:s.jsxs("div",{className:f?"tag-input disabled":"tag-input",onClick:()=>d.current?.focus(),children:[(e||[]).map(p=>s.jsxs("span",{className:"tag-chip",children:[s.jsx("span",{className:"v",children:p}),s.jsx(se,{type:"button",variant:"ghost",size:"icon-2xs",className:"tag-x text-muted-foreground hover:bg-destructive-soft hover:text-destructive",title:r("删除 {code}",{code:p}),"aria-label":r("删除状态码 {code}",{code:p}),onClick:h=>{h.stopPropagation(),EW(p)},children:"✕"})]},p)),s.jsx($e,{ref:d,id:"settings-retry-no-codes-input",type:"text",className:"tag-input-field h-auto border-0 bg-transparent px-0 shadow-none focus:shadow-none",placeholder:f?"—":r("输入状态码,回车添加"),inputMode:"numeric",autoComplete:"off",value:o,disabled:f||a,onChange:p=>c(p.target.value),onKeyDown:p=>{if(p.key==="Enter"){p.preventDefault(),TW(o),c("");return}p.key==="Backspace"&&!o&&AW()}})]})}),s.jsx("div",{className:"hint",children:$n.retryCodes})]})}function kJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(null);async function d(){const f=o;if(f!==null)try{await $W(f)}finally{c(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-file",children:r("提示词文件")}),s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:"settings-prompt-file",type:"text",placeholder:r("留空 = 用内置默认提示词"),value:o!==null?o:e.file,disabled:t||a,onChange:f=>c(f.target.value),onFocus:()=>c(e.file),onBlur:()=>{d()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()}})}),s.jsx("div",{className:"hint",children:$n.promptFile})]})}function CJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.promptUnavailable;const t=eP(e.source),a=[];return e.mode==="passthrough"?a.push(r("客户端 system 原样出站(只靠指纹脱敏改写模板句)。")):a.push(r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:t,lines:e.lines?r("({n} 行)",{n:e.lines}):""})),e.fileError&&a.push(`⚠️ ${e.fileError}`),a.join("")}function eP(e){return e==="inline"?r("界面里编辑的正文"):e==="file"?r("提示词文件"):e==="builtin"?r("内置默认提示词"):""}function TJ(e){return r("已自动切换到最小中性提示词(撞了上游内容拦截,多半是 system 指纹误报),到 {until} 自动解除。",{until:e.degradeUntilText||Ut.degradeUntilFallback})+r("期间本模式自己的提示词不会发出;把提示词改好后可以立即解除。")}function EJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(null);async function f(){const p=c;if(p!==null)try{p!==e.file&&await YW(e,p)}finally{d(null)}}return s.jsx("span",{className:"prompt-input",children:s.jsx($e,{id:`settings-prompt-file-${e.id}`,type:"text",placeholder:r("留空 = 用内置默认提示词"),"aria-label":r("{label} 提示词文件",{label:t}),value:c!==null?c:e.file,disabled:a||o,onChange:p=>d(p.target.value),onFocus:()=>d(e.file),onBlur:()=>{f()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})})}function AJ(e,t){if(!t)return r("未单独配置:模式、提示词文件与正文都跟随上面的全局配置(当前「{mode}」)。",{mode:zo.find(o=>o.value===e.mode)?.toastLabel??e.mode});if(e.mode==="passthrough")return r("客户端 system 原样出站。");const a=r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:eP(e.source),lines:e.lines?r("({n} 行)",{n:e.lines}):""});return e.fileError?`${a} ⚠️ ${e.fileError}`:a}function RJ({item:e,option:t,over:a,locked:o,busy:c}){const d=e.gateway,f=t.gatewayChars,p=f?r("约 {n} 字符",{n:f.toLocaleString("zh-CN")}):r("一段内置装配"),h=xJ(a);return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{className:"prompt-gateway-label",children:r("网关自带")}),s.jsxs("span",{className:"prompt-input",children:[s.jsx(da,{id:`settings-prompt-gateway-${e.id}`,label:r("装上{size}的官方身份提示词",{size:p}),checked:d,disabled:o||c,onCheckedChange:b=>{ZW(e.id,b)}}),s.jsx(gJ,{item:e,option:t,over:a,locked:o,busy:c})]}),s.jsxs("div",{className:d?"hint":"hint prompt-gateway-off",children:[d?t.gatewayNote:r("已关闭。{note}",{note:t.gatewayNote}),h?r(" 正文已改:{edited}(其余段用官方原文)。",{edited:h}):""]})]})}function OJ({prompt:e,locked:t,busy:a}){const o=e.options,c=new Map(e.providers.map(j=>[j.id,j])),d=[];for(const j of o)j.gatewayNote&&d.push(c.get(j.id)??{id:j.id,mode:e.mode,file:e.file,text:e.text,source:e.source,lines:e.lines,fileError:e.fileError,gateway:e.gateway[j.id]??!0,configured:!1});for(const j of e.providers)d.some(S=>S.id===j.id)||d.push({...j,gateway:e.gateway[j.id]??!0,configured:!0});const f=new Set(d.map(j=>j.id)),p=o.filter(j=>!j.gatewayNote&&!f.has(j.id)),[h,b]=x.useState(""),y=j=>o.find(S=>S.id===j)?.label||j,v=j=>o.find(S=>S.id===j),w=j=>v(j)?.gatewayNote||"";return s.jsxs(s.Fragment,{children:[d.map(j=>{const S=y(j.id),N=zo.find(D=>D.value===j.mode)?.optionLabel??j.mode,k=w(j.id),T=v(j.id);return s.jsxs(x.Fragment,{children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:`settings-prompt-mode-${j.id}`,children:S}),s.jsxs("span",{className:"prompt-input",children:[s.jsxs(ft,{value:j.mode,onValueChange:D=>{D!=null&&String(D)&&KW(j,String(D))},children:[s.jsx(mt,{id:`settings-prompt-mode-${j.id}`,className:"w-[240px]",disabled:t||a,"aria-label":r("{label} 的提示词模式",{label:S}),children:s.jsx(pt,{children:N})}),s.jsx(ht,{children:zo.map(D=>s.jsx(qe,{value:D.value,children:D.optionLabel},D.value))})]}),s.jsx(EJ,{item:j,label:S,locked:t,busy:a}),s.jsx(mJ,{item:j,label:S,locked:t,busy:a}),j.configured?s.jsx(se,{variant:"outline",disabled:t||a,onClick:()=>{QW(j.id)},children:r("跟随默认")}):null]}),s.jsx("div",{className:"hint",children:AJ(j,j.configured)})]}),T&&k?s.jsx(RJ,{item:j,option:T,over:e.gatewayText[j.id],locked:t,busy:a}):null]},j.id)}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-provider-add",children:r("添加提供商")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:h,onValueChange:j=>{b("");const S=j==null?"":String(j);S&&GW(S)},children:[s.jsx(mt,{id:"settings-prompt-provider-add",className:"w-[240px]",disabled:t||a||p.length===0,"aria-label":r("添加要单独配置的提供商"),children:s.jsx(pt,{children:h?y(h):p.length?r("添加提供商…"):r("全部已配置")})}),s.jsx(ht,{children:p.map(j=>s.jsx(qe,{value:j.id,children:j.label},j.id))})]})}),s.jsx("div",{className:"hint",children:$n.promptProviders})]})]})}function MJ({snap:e}){const t=e.prompt,a=t.status!=="ready",o=e.busy==="prompt",c=zo.find(d=>d.value===t.mode)?.optionLabel??t.mode;return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("系统提示词"),tip:rs.prompt,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:t.mode==="passthrough"?r("透传"):r("已接管")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-prompt-refresh",onClick:()=>{uJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"prompt-group",children:[r("全局配置"),s.jsx("span",{className:"note",children:r("所有未单独配置的提供商都用这一份")})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-mode",children:r("模式")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t.mode,onValueChange:d=>{d!=null&&String(d)&&FW(String(d))},children:[s.jsx(mt,{id:"settings-prompt-mode",className:"w-[240px]",disabled:a||o,"aria-label":r("系统提示词模式"),children:s.jsx(pt,{children:c})}),s.jsx(ht,{children:zo.map(d=>s.jsx(qe,{value:d.value,children:d.optionLabel},d.value))})]})}),s.jsx("div",{className:"hint",children:$n.promptMode})]}),s.jsx(kJ,{prompt:t,locked:a,busy:o}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"btn-prompt-edit-body",children:r("提示词正文")}),s.jsx("span",{className:"prompt-input",children:s.jsx(pJ,{prompt:t,locked:a,busy:o})}),s.jsxs("div",{className:"hint",children:[$n.promptText,t.source==="inline"?r("(当前生效的就是这一份,{n} 行)",{n:t.lines}):t.text.trim()?r("(已存一份正文,{n} 行;切成「替换 / 追加」后生效)",{n:t.lines}):""]})]}),s.jsxs("div",{className:"prompt-group",children:[r("按提供商配置"),s.jsx("span",{className:"note",children:r("只列单独配置过的家,其余沿用上面的全局配置")})]}),s.jsx(OJ,{prompt:t,locked:a,busy:o}),t.status==="ready"&&t.degradeActive?s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("内容拦截降级")}),s.jsx("span",{className:"prompt-input",children:s.jsx(se,{id:"btn-prompt-clear-degrade",variant:"outline",disabled:o,onClick:()=>{JW()},children:r("立即解除")})}),s.jsx("div",{className:"hint",children:TJ(t)})]}):null]}),s.jsx("div",{className:"settings-state",children:CJ(t)}),s.jsx("div",{className:"hint retention-note",children:$n.prompt})]})]})}function DJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.debugUnavailable;const t=e.count!==null&&e.limit!==null?r("已保存 {count} / {limit} 条报文(超出后丢弃最旧的)。",{count:e.count,limit:e.limit}):"";return e.on?`${Ut.debugOn}${t}${r("凭据类请求头已脱敏。")}`:Ut.debugOff}function IJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求超时"),tip:rs.timeouts,badge:Rp(e.timeouts),actions:s.jsx(Br,{id:"btn-timeouts-refresh",onClick:()=>{sJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:CI.map(t=>s.jsx(Ap,{field:t,value:e.timeouts.values?.[t.key]??null,disabled:e.busy==="timeouts",onCommit:a=>RW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.timeouts})]})]})}function PJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求重试"),tip:rs.retry,badge:Rp(e.retry),actions:s.jsx(Br,{id:"btn-retry-refresh",onClick:()=>{nJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[kI.map(t=>s.jsx(Ap,{field:t,value:e.retry.values?.[t.key]??null,disabled:e.busy==="retry",onCommit:a=>CW(t,a)},t.key)),s.jsx(NJ,{codes:e.retryCodes,status:e.retry.status,busy:e.busy==="codes"||e.busy==="retry"})]}),s.jsx("div",{className:"hint retention-note",children:$n.retry})]})]})}const _J={routingFailoverBackoff:"failoverBackoff",routingSink:"sink",routingBreakerEnabled:"breakerEnabled"};function LJ({snap:e}){const t=e.routing,a=e.busy==="routing"||t.status!=="ready",o=Ox.find(d=>d.value===t.strategy)?.value??"order",c=Mx.find(d=>d.value===t.sticky)?.value??"auto";return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号路由"),tip:rs.routing,badge:t.status==="ready"?void 0:t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-routing-refresh",onClick:()=>{lJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsx("div",{className:"prompt-group",children:r("选路规则")}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("路由策略")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Ox.find(d=>d.value===o)?.tip}),s.jsx(In,{options:Ox.map(d=>({value:d.value,label:d.label})),value:o,disabled:a,"aria-label":r("路由策略"),onValueChange:d=>{gS({routingStrategy:String(d)})}})]})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("会话粘性")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Mx.find(d=>d.value===c)?.tip}),s.jsx(In,{options:Mx.map(d=>({value:d.value,label:d.label})),value:c,disabled:a,"aria-label":r("会话粘性"),onValueChange:d=>{gS({routingSticky:String(d)})}})]})]}),s.jsxs("div",{className:"prompt-group",children:[r("自愈保护"),s.jsx("span",{className:"note",children:r("默认值通常够用,出问题时才需要调")})]}),WZ.map(d=>{const f=`route-protection-${d.key}`;return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:f,children:d.label}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":d.tip}),s.jsx(hs,{id:f,checked:t[_J[d.key]],disabled:a,onCheckedChange:p=>{gS({[d.key]:p})}})]})]},d.key)})]}),s.jsx("div",{className:"hint retention-note",children:$n.routing})]})]})}function zJ({snap:e}){return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("排队等待"),tip:rs.queue,badge:Rp(e.queue),actions:s.jsx(Br,{id:"btn-queue-refresh",onClick:()=>{rJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:TI.map(t=>s.jsx(Ap,{field:t,value:e.queue.values?.[t.key]??null,disabled:e.busy==="queue",onCommit:a=>vW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.queue})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("验证码令牌池"),tip:rs.captchaPool,badge:Rp(e.captchaPool),actions:s.jsx(Br,{id:"btn-captcha-pool-refresh",onClick:()=>{aJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:DI.map(t=>s.jsx(Ap,{field:t,value:e.captchaPool.values?.[t.key]??null,disabled:e.busy==="captchaPool",onCommit:a=>yW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.captchaPool})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("models.dev 模型元数据"),tip:rs.modelsDev,badge:e.modelsDev.status==="ready"?s.jsx(cn,{tone:"ok",children:r("{count} 条",{count:Number(e.modelsDev.count).toLocaleString("zh-CN")})}):e.modelsDev.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-modelsdev-refresh",onClick:()=>{LW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-modelsdev",label:r("用 models.dev 补齐上游没声明的模型能力与思考档位(联网刷新,内嵌快照始终生效)"),checked:e.modelsDev.enabled,disabled:e.modelsDev.status!=="ready"||e.busy==="modelsDev",onCheckedChange:t=>{_W(t)}}),s.jsx("div",{className:"settings-state",children:VZ(e.modelsDev)}),s.jsx("div",{className:"hint retention-note",children:$n.modelsDev})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("指纹脱敏"),tip:rs.sanitize,badge:e.sanitize.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.sanitize.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-sanitize-refresh",onClick:()=>{iJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-sanitize",label:r("剥离上游审核黑名单指纹(改写请求体里的模板句与表头)"),checked:e.sanitize.on,disabled:e.sanitize.status!=="ready"||e.busy==="sanitize",onCheckedChange:t=>{MW(t)}})}),s.jsx("div",{className:"settings-state",children:e.sanitize.status==="loading"?Ut.appLoading:e.sanitize.status==="unavailable"?Ut.sanitizeUnavailable:e.sanitize.on?Ut.sanitizeOn:Ut.sanitizeOff}),s.jsx("div",{className:"hint retention-note",children:$n.sanitize})]})]}),s.jsx(HJ,{snap:e}),s.jsx(MJ,{snap:e}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("调试模式"),tip:rs.debug,badge:e.debug.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.debug.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-debug-refresh",onClick:()=>{oJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-debug-mode",label:r("保存上游原始报文(请求头、请求体、响应头、响应体)"),checked:e.debug.on,disabled:e.debug.status!=="ready"||e.busy==="debug",onCheckedChange:t=>{OW(t)}})}),s.jsx("div",{className:"settings-state",children:DJ(e.debug)}),s.jsx("div",{className:"hint retention-note",children:$n.debug})]})]})]})}function tP(e){const t=Object.entries(e.defaults).map(([a,o])=>({key:a,value:a in e.overrides?e.overrides[a]:o,isDefault:!0}));for(const[a,o]of Object.entries(e.overrides))a in e.defaults||t.push({key:a,value:o,isDefault:!1});return t}function BJ(e,t){const a=Object.keys(e);return a.length!==Object.keys(t).length?!1:a.every(o=>e[o]===t[o])}function HJ({snap:e}){const t=e.clineHeaders,[a,o]=x.useState(()=>tP(t));x.useEffect(()=>{o(tP(t))},[t]);const c=e.busy==="clineHeaders",d=t.status==="ready";function f(b,y){o(v=>v.map((w,j)=>j===b?{...w,...y}:w))}function p(){const b={};for(const y of a){const v=y.key.trim();v&&(y.isDefault?y.value!==(t.defaults[v]??"")&&(b[v]=y.value):y.value!==""&&(b[v]=y.value))}return b}const h=d&&!BJ(p(),t.overrides);return s.jsx(bJ,{title:r("Cline 伪装头"),tip:rs.clineHeaders,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cline-headers-refresh",onClick:()=>{DW()}}),children:s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[d?a.map((b,y)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-[190px] shrink-0 font-mono text-[13px]",value:b.key,readOnly:b.isDefault,disabled:c,placeholder:"X-Custom-Header",onChange:v=>f(y,{key:v.target.value})}),s.jsx($e,{className:"flex-1 font-mono text-[13px]",value:b.value,disabled:c,placeholder:b.isDefault?r("值(留空 = 不发送)"):r("值"),onChange:v=>f(y,{value:v.target.value})}),s.jsx(se,{variant:"ghost",disabled:c,onClick:()=>{b.isDefault?f(y,{value:t.defaults[b.key]??""}):o(v=>v.filter((w,j)=>j!==y))},children:b.isDefault?r("还原"):r("删除")})]},String(y))):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:"outline",disabled:c||!d,onClick:()=>o(b=>[...b,{key:"",value:"",isDefault:!1}]),children:r("添加自定义头")}),s.jsx("div",{className:"flex-1"}),s.jsx(se,{variant:"ghost",disabled:c||!d||Object.keys(t.overrides).length===0,onClick:()=>{XI({})},children:r("恢复默认")}),s.jsx(se,{disabled:c||!d||!h,onClick:()=>{XI(p())},children:r("保存")})]})]}),s.jsx("div",{className:"settings-state",children:t.status==="loading"?Ut.appLoading:t.status==="unavailable"?r("未能读取 Cline 伪装头设置,请稍后重试"):h?r("有未保存的修改"):r("{n} 个头将随每个 Cline 请求发送",{n:Object.keys(t.effective).length})+(Object.keys(t.overrides).length>0?r("({n} 项被覆盖)",{n:Object.keys(t.overrides).length}):r("(全部为默认值)"))}),s.jsx("div",{className:"hint retention-note",children:$n.clineHeaders})]})})}function UJ({snap:e}){const[t,a]=x.useState(!1);async function o(){a(!0),await eJ()||a(!1)}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("网关跨域访问(CORS)"),tip:rs.cors,badge:e.cors.status==="ready"?e.cors.on?s.jsx(cn,{tone:"bad",children:r("已开启")}):s.jsx(cn,{tone:"ok",children:r("已关闭")}):e.cors.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cors-refresh",onClick:()=>{cJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-cors",label:r("允许浏览器里的页面跨来源调用网关(/v1/*)"),checked:e.cors.on,disabled:e.cors.status!=="ready"||e.busy==="cors",onCheckedChange:c=>{IW(c)}})}),s.jsx("div",{className:"settings-state",children:e.cors.status==="loading"?Ut.appLoading:e.cors.status==="unavailable"?Ut.corsUnavailable:e.cors.on?Ut.corsOn:Ut.corsOff}),s.jsx("div",{className:"hint retention-note",children:$n.cors})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("机器人校验")}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-captcha",label:r("登录 / 注册需要通过 ALTCHA 人机验证(工作量证明)"),checked:e.captcha.enabled,disabled:!e.captcha.available||e.busy==="captcha",onCheckedChange:c=>{PW(c)}}),s.jsx("div",{className:"hint",children:$n.captcha})]})]}),e.panelLogin?s.jsxs("section",{className:"panel",id:"panel-login-section",children:[s.jsx(Qn,{title:r("面板登录")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:$n.panelLogin}),s.jsx("div",{className:"mt-2.5",children:s.jsx(se,{id:"btn-panel-logout",variant:"outline",disabled:t,onClick:()=>{o()},children:r("退出登录")})})]})]}):null]})}function Op({label:e,value:t}){return s.jsxs("div",{className:"storage-count",children:[s.jsx("span",{className:"k",children:e}),s.jsx("span",{className:"v",children:t})]})}function VJ(e){return e.status==="loading"?s.jsx(cn,{tone:"idle",children:r("检测中…")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:e.available?"ok":"bad",children:e.available?r("已生效"):r("数据库不可用")})}function FJ({snap:e}){const t=e.busy,a=e.storage,o=tt().workbuddyDesktop?.platform==="web",c=a.status==="ready",d=c&&a.available,f=c&&a.file?a.file:"—",p=h=>d&&h!==null?ZZ(h):"—";return s.jsxs(s.Fragment,{children:[!o&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("整库备份 / 恢复"),tip:rs.backup,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-db-export",variant:"outline",disabled:t==="dbExport"||t==="dbImport",onClick:()=>{fW()},children:r(t==="dbExport"?"备份中…":"备份整库")}),s.jsx(se,{id:"btn-settings-db-restore",variant:"destructive",disabled:t==="dbExport"||t==="dbImport",onClick:()=>pW(),children:r(t==="dbImport"?"恢复中…":"恢复整库")})]})}),s.jsxs("div",{className:"panel-body",children:[e.dbWarning?s.jsxs("div",{className:"danger-zone",id:"settings-db-warning",children:[s.jsx("strong",{children:r("⚠️ 密钥警告")}),s.jsx("br",{}),e.dbWarning]}):null,s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-db-include-logs",children:r("包含日志与调试报文")}),s.jsx(hs,{id:"settings-db-include-logs",checked:e.dbIncludeLogs,disabled:t!==null,onCheckedChange:dW}),s.jsx("div",{className:"hint",children:r("取消勾选后只备份业务数据(账号、配置与余额记录),文件显著变小;事件日志、请求统计与调试报文不会进备份文件。")})]}),s.jsx("div",{className:"danger-zone",children:s.jsx("strong",{children:$n.backupDanger})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号导入 / 导出"),tip:rs.io,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-export",variant:"outline",disabled:t==="export",onClick:()=>{cW()},children:r(t==="export"?"导出中…":"导出账号")}),s.jsx(se,{id:"btn-settings-import",variant:"default",disabled:t==="import",onClick:()=>{uW()},children:r(t==="import"?"导入中…":"导入账号")})]})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"danger-zone",children:[s.jsx("strong",{children:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义")}),r(",可直接用于登录。请妥善保管,不要外传或上传到公共位置。")]}),e.ioFailure?s.jsx("div",{className:"io-result",children:s.jsxs("span",{className:"text-destructive",children:[r("失败 {n} 个:{detail}",{n:e.ioFailure.failed,detail:e.ioFailure.detail}),e.ioFailure.more?r(" 等"):""]})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据保留"),tip:rs.retention,badge:Rp(e.retention),actions:s.jsx(Br,{id:"btn-retention-refresh",onClick:()=>{tJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:oS.map(h=>s.jsx(Ap,{field:h,value:e.retention.values?.[h.key]??null,disabled:e.busy==="retention",onCommit:b=>xW(h,b)},h.key))}),s.jsx("div",{className:"hint retention-note",children:$n.retention})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据存储"),tip:rs.storage,badge:VJ(a),actions:s.jsx(Br,{id:"btn-storage-refresh",onClick:()=>{dJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-path",children:r("数据库文件")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-path",title:f,children:f})}),s.jsx("div",{className:"hint",children:$n.storageFile})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-size",children:r("占用大小")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-size",children:d?MI(a.bytes):"—"})}),s.jsx("div",{className:"hint",children:$n.storageSize})]})]}),s.jsxs("div",{className:"retention-list storage-counts",children:[s.jsx(Op,{label:r("账号"),value:p(a.accounts)}),s.jsx(Op,{label:r("事件日志"),value:p(a.logs)}),s.jsx(Op,{label:r("请求记录"),value:p(a.requests)}),s.jsx(Op,{label:r("报表天数"),value:p(a.dailyDays)}),s.jsx(Op,{label:r("调试报文"),value:p(a.debug)})]}),s.jsx("div",{className:"hint retention-note",children:$n.storage})]})]})]})}const $J=[{title:r("问题反馈"),desc:r("遇到 Bug、报错或异常行为"),cta:r("去反馈"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=bug_report.yml"},{title:r("功能建议"),desc:r("想要的新功能或改进想法"),cta:r("提建议"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=feature_request.yml"},{title:r("请求提供商 / 模型支持"),desc:r("希望接入新的提供商或模型"),cta:r("去申请"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=provider_request.yml"}];function qJ(){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("反馈与需求")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:r("点下面的入口会用系统默认浏览器打开 GitHub 的对应表单(需要 GitHub 账号,模板已预设好,填完直接提交即可)。")}),s.jsx("div",{className:"mt-3 flex flex-col gap-2",children:$J.map(e=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-hairline bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12.5px] text-foreground",children:e.title}),s.jsx("div",{className:"mt-0.5 text-[12px] text-subtle",children:e.desc})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{FZ(e.url)},children:e.cta})]},e.url))})]})]})}function GJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||Lx(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("确认缩短保留天数")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[e?.head,s.jsx("br",{}),s.jsx("strong",{children:r("超出的历史数据会被立即删除,且不可恢复。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>Lx(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>Lx(!0),children:r("继续并清理")})]})]})})}const AS={enable:{title:r("开启局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("为了安全,开启前需要先注册一个"),s.jsx("b",{children:r("面板管理员账号")}),r("(已注册过会跳过这一步,直接生效)。"),s.jsx("br",{}),r("开启后网关将监听所有网卡,同一局域网内的设备即可把 API 地址指向本机 IP 一起使用;管理接口从此要求管理员会话或网关 Key,转发接口在没有一把启用的 Key 时也会拒绝服务(届时会自动创建一把名为「默认」的 Key)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("继续")},disable:{title:r("关闭局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("关闭后网关回到只监听 127.0.0.1,局域网内的设备将无法继续访问;已配置的网关 Key 与账号都不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("关闭并重启")},panel:{title:r("变更网页管理面板"),body:e=>e?s.jsxs(s.Fragment,{children:[r("开放后,局域网内其他设备的浏览器打开本机 IP 即可进入管理面板(需管理员账号登录)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}):s.jsxs(s.Fragment,{children:[r("关闭后,管理界面不再从局域网提供,只有本机的桌面程序可以管理;已开启的 API 转发不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("保存并重启")}};function KJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||hS(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("恢复整库备份")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[r("本机的全部数据(账号、网关配置、日志统计与桌面设置)将被所选备份文件"),s.jsx("strong",{children:r("整体替换")}),r(",包括恢复后需要重新登录管理面板。"),s.jsx("br",{}),s.jsx("strong",{children:r("替换前会自动把当前数据备份到配置目录的 backups/ 文件夹。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>hS(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>hS(!0),children:r("选择备份文件并恢复")})]})]})})}function YJ({confirm:e,register:t}){const a=x.useRef(null),o=x.useRef(null),c=x.useRef(null),d=e!==null||t!==null,f=()=>{t!==null?zI():mS(!1)},p=()=>{iW(o.current?.value??"",c.current?.value??"")};return s.jsx(Qt,{open:d,onOpenChange:h=>{h||f()},children:s.jsx(Zt,{className:"w-[min(480px,calc(100vw-48px))]",initialFocus:a,children:t!==null?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("注册管理员账号")})}),s.jsxs(Bt,{children:[s.jsx("div",{children:r("局域网开放后,管理接口要求登录。请设置管理员账号与密码,注册完成会直接继续开启流程。")}),s.jsxs("form",{onSubmit:h=>{h.preventDefault(),t.busy||p()},children:[s.jsx(Je,{htmlFor:"lan-admin-name",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("账号")}),s.jsx($e,{ref:o,id:"lan-admin-name",autoComplete:"username",placeholder:r("管理员账号"),disabled:t.busy}),s.jsx(Je,{htmlFor:"lan-admin-password",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("密码")}),s.jsx($e,{ref:c,id:"lan-admin-password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位"),disabled:t.busy})]}),s.jsx("div",{className:"mt-3 min-h-5 text-[13px] whitespace-pre-wrap text-destructive",children:t.error})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:zI,disabled:t.busy,children:r("取消")}),s.jsx(se,{onClick:p,disabled:t.busy,children:t.busy?r("正在注册…"):r("注册并开启")})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e?AS[e.mode].title:""})}),s.jsx(Bt,{children:s.jsx("div",{children:e?AS[e.mode].body(e.panel):null})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:()=>mS(!1),children:r("取消")}),s.jsx(se,{onClick:()=>mS(!0),children:e?AS[e.mode].label:r("继续")})]})]})})})}function XJ(){const e=tW(),t=x.useRef(null);x.useEffect(()=>{const o=t.current;o&&(o.scrollTop=0)},[e.scrollReset]);const a=o=>e.category===o?"settings-pane active":"settings-pane";return s.jsxs("div",{className:"settings-layout",children:[s.jsx("nav",{className:"settings-nav",id:"settings-nav",children:Ax.map(o=>s.jsxs("button",{type:"button",className:e.category===o.id?"settings-nav-item active":"settings-nav-item","data-cat":o.id,onClick:()=>nW(o.id),children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:JI(o.icon,17)}}),o.label]},o.id))}),s.jsxs("div",{className:"settings-panes",ref:t,children:[s.jsx("div",{className:a("general"),"data-cat":"general",children:s.jsx(yJ,{snap:e})}),s.jsx("div",{className:a("display"),"data-cat":"display",children:s.jsx(jJ,{})}),s.jsx("div",{className:a("gateway"),"data-cat":"gateway",children:s.jsx(zJ,{snap:e})}),s.jsx("div",{className:a("routing"),"data-cat":"routing",children:s.jsx(LJ,{snap:e})}),s.jsx("div",{className:a("retry"),"data-cat":"retry",children:s.jsx(PJ,{snap:e})}),s.jsx("div",{className:a("timeout"),"data-cat":"timeout",children:s.jsx(IJ,{snap:e})}),s.jsx("div",{className:a("security"),"data-cat":"security",children:s.jsx(UJ,{snap:e})}),s.jsx("div",{className:a("data"),"data-cat":"data",children:s.jsx(FJ,{snap:e})}),s.jsx("div",{className:a("feedback"),"data-cat":"feedback",children:s.jsx(qJ,{})}),s.jsx("div",{className:a("about"),"data-cat":"about"})]}),s.jsx(GJ,{confirm:e.retentionConfirm}),s.jsx(KJ,{confirm:e.dbBackupConfirm}),s.jsx(YJ,{confirm:e.lanConfirm,register:e.lanRegister})]})}const nP='.page[data-page="settings"]';let RS=null;function sP(){if(RS)return;const e=document.querySelector(nP);e&&(e.replaceChildren(),RS=vn.createRoot(e),Cs.flushSync(()=>{RS?.render(s.jsx(XJ,{}))}))}PI(),document.querySelector(nP)?sP():document.addEventListener("DOMContentLoaded",sP,{once:!0}),window.wbSettingsPanel={load:ES,render:fS,renderRetention:Ix,renderRetry:kW,renderDebug:Hx,renderSanitize:Ux,renderPrompt:Yu,renderStorage:TS,showCategory:dS},tt().wbApp?.currentPage==="settings"&&ES();const rP="agent2api-col-config:",OS=[{value:"left",label:r("左")},{value:"center",label:r("中")},{value:"right",label:r("右")}],QJ=e=>OS.some(t=>t.value===e),ZJ=OS.map(e=>`ta-${e.value}`),aP="colset-dragging",lP="open";let MS=null;const oP="grid grid-cols-[18px_minmax(78px,1fr)_44px_minmax(106px,auto)] items-center gap-2";function iP(){return window}const $x=new Map;function DS(e){return e.columns.map(t=>({key:t.key,visible:t.visible!==!1,align:t.align||"left"}))}function WJ(e,t){const a=Array.isArray(t),o=!a&&t&&typeof t=="object"?t:null,c=a?t:Array.isArray(o?.items)?o.items:[],d=o?.defaults&&typeof o.defaults=="object"?o.defaults:null,f=new Map(e.columns.map(y=>[y.key,y])),p=new Map(DS(e).map(y=>[y.key,y])),h=[],b=new Set;for(const y of c){const v=y&&typeof y=="object"?y:{},w=String(v.key||"");if(!f.has(w)||b.has(w))continue;b.add(w);const j=f.get(w),S=j.align||"left",N=d?d[w]??S:j.legacyAlign??S,k=QJ(v.align)?v.align:null;h.push({key:w,visible:v.visible!==!1,align:k&&k!==N?k:S})}for(const y of e.columns)b.has(y.key)||JJ(h,e,{...p.get(y.key)});return h}function JJ(e,t,a){const o=t.columns.findIndex(c=>c.key===a.key);for(let c=o-1;c>=0;c-=1){const d=e.findIndex(f=>f.key===t.columns[c].key);if(d>=0){e.splice(d+1,0,a);return}}e.unshift(a)}function eee(e){try{const t=localStorage.getItem(rP+e.id);return WJ(e,t?JSON.parse(t):[])}catch{return DS(e)}}function tee(e){try{const t={};for(const a of e.columns)t[a.key]=a.align||"left";localStorage.setItem(rP+e.id,JSON.stringify({v:2,defaults:t,items:e.config}))}catch{}}const nee=e=>$x.get(e)?.config||null,see=(e,t)=>e.columns.find(a=>a.key===t)?.label||t;function cP(e,t){const a=$x.get(e);if(!a)return t;const o=new Map(t.map(c=>[c.key,c]));return a.config.filter(c=>c.visible&&o.has(c.key)).map(c=>({...o.get(c.key),align:c.align}))}function Mp(e,{silent:t=!1}={}){tee(e),t||e.onChange?.(e.config),Il&&Il.id===e.id&&Il.repaint()}let Il=null;function qx(){if(!Il)return;const e=Il;Il=null,e.destroy()}function ree(e,t){qx();const a=document.createElement("div");document.body.append(a);const o=vn.createRoot(a),c={current:null};Il={id:e.id,spec:e,repaint:()=>c.current?.(),destroy:()=>{o.unmount(),a.remove()}},o.render(s.jsx(cee,{spec:e,anchor:t,repaintRef:c,onClose:qx}))}function aee(e,t){Il&&Il.id===e.id?qx():ree(e,t)}function lee(e,t,a){const o=[...e],[c]=o.splice(t,1);return o.splice(a,0,c),o}function oee(e,t,a,o){const c=document.elementFromPoint(e,t)?.closest?.("[data-col-key]");if(!c||!a||!a.contains(c))return"";const d=c.getAttribute("data-col-key")||"";return o.some(f=>f.key===d)?d:""}const iee=s.jsxs("svg",{viewBox:"0 0 24 24",width:13,height:13,fill:"currentColor","aria-hidden":"true",className:"block",children:[s.jsx("circle",{cx:"9",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"18",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"18",r:"1.6"})]});function cee({spec:e,anchor:t,repaintRef:a,onClose:o}){const c=t,d=x.useRef(null),[f,p]=x.useState(null),h=x.useRef(null),[,b]=x.useState(0),y=x.useCallback(()=>b(N=>N+1),[]);x.useLayoutEffect(()=>(a.current=y,()=>{a.current=null}),[y,a]),x.useEffect(()=>(c.classList.add(lP),c.setAttribute("aria-expanded","true"),()=>{c.classList.remove(lP),c.setAttribute("aria-expanded","false")}),[c]),x.useEffect(()=>{const N=()=>{const k=c.getBoundingClientRect();(!c.isConnected||!k.width||k.bottom<=0||k.top>=window.innerHeight)&&o()};return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[c,o]),x.useEffect(()=>()=>{const N=h.current;N&&(N.teardown(),Mp(e))},[e]);function v(N,k){const T=e.config.find(D=>D.key===N);T&&(!k&&e.config.filter(D=>D.visible).length<=1||(T.visible=k,Mp(e)))}function w(N,k){const T=e.config.find(D=>D.key===N);!T||T.align===k||(T.align=k,Mp(e))}function j(){e.config=DS(e),Mp(e)}function S(N,k){k.preventDefault(),h.current?.teardown(),p(N),document.body.classList.add(aP);const T=d.current;function D(){window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",A),document.body.classList.remove(aP),h.current=null,p(null)}function C(R){const I=oee(R.clientX,R.clientY,T,e.config);if(!I||I===N)return;const P=e.config.findIndex(_=>_.key===N),O=e.config.findIndex(_=>_.key===I);P<0||O<0||(e.config=lee(e.config,P,O),y())}function A(){D(),Mp(e)}h.current={teardown:D},window.addEventListener("pointermove",C),window.addEventListener("pointerup",A)}return s.jsx(hf,{open:!0,modal:!1,onOpenChange:(N,k)=>{N||(k?.reason==="outside-press"&&(MS=k.event??null),o())},children:s.jsxs(gf,{anchor:c,side:"bottom",align:"end",sideOffset:6,collisionPadding:8,className:"w-[336px]","aria-label":r("{name}的列设置",{name:e.label||e.id}),children:[s.jsxs("div",{className:Ue(oP,"border-b border-hairline px-3 pt-[9px] pb-[7px]","text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground"),children:[s.jsx("span",{}),s.jsx("span",{className:"text-center",children:r("列")}),s.jsx("span",{className:"text-center",children:r("显示")}),s.jsx("span",{className:"text-center",children:r("对齐")})]}),s.jsx("div",{ref:d,className:"min-h-0 flex-1 overflow-y-auto px-3 py-1",children:e.config.map(N=>{const k=see(e,N.key),T=f===N.key;return s.jsxs("div",{"data-col-key":N.key,className:Ue(oP,"rounded-sm py-[5px] hover:bg-nav-hover",T&&"opacity-50"),children:[s.jsx("span",{className:"flex cursor-grab items-center justify-center text-muted-foreground opacity-50 hover:opacity-100",title:r("按住拖动调整列顺序"),onPointerDown:D=>S(N.key,D),children:iee}),s.jsx("span",{className:"min-w-0 truncate text-xs text-foreground",title:k,children:k}),s.jsx(hs,{className:"justify-self-center",checked:N.visible,onCheckedChange:D=>v(N.key,D),"aria-label":r("显示「{label}」列",{label:k}),title:N.visible?r("这一列正在显示"):r("这一列已隐藏")}),s.jsx(In,{className:"w-full justify-center",options:OS,value:N.align,onValueChange:D=>w(N.key,D),"aria-label":r("「{label}」列的对齐",{label:k})})]},N.key)})}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 pt-2 pb-[9px]",children:[s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:r("拖动 ⋮⋮ 调整顺序")}),s.jsx(se,{variant:"outline",size:"sm",onClick:j,children:r("恢复默认")})]})]})})}function uee(e,t){e&&(e.classList.remove(...ZJ),e.classList.add(`ta-${t}`))}const uP=new Map;function dee(e,t){const a=uP.get(e);if(a&&a.table===t&&a.row.isConnected)return a;const o=t?.querySelector("thead tr");if(!o)return null;const c=t?.querySelector("colgroup")??null,d={table:t,row:o,group:c,ths:new Map([...o.querySelectorAll("th[data-col]")].map(f=>[f.getAttribute("data-col")||"",f])),cols:new Map([...c?.querySelectorAll("col[data-col]")||[]].map(f=>[f.getAttribute("data-col")||"",f]))};return uP.set(e,d),d}function fee(e,t,a){const o=$x.get(e);if(!o||!t)return;const c=dee(e,t);if(!c)return;const{row:d,group:f,ths:p,cols:h}=c;for(const b of o.config){const y=p.get(b.key);if(!y)continue;const v=h.get(b.key);if(!b.visible||a?.has(b.key)){y.remove(),v?.remove();continue}uee(y,b.align),d.appendChild(y),v&&f&&f.appendChild(v)}iP().wbTableColumns?.repaint?.(e)}function pee(e){const t=document.createElement("button");return t.type="button",t.className=`sm colset-btn${e.buttonClass?` ${e.buttonClass}`:""}`,t.id=`btn-colset-${e.id}`,t.title=r("调整「{name}」的列:显示 / 隐藏、顺序、对齐",{name:e.label||e.id}),t.innerHTML=`${iP().wbIcons?.icon?.("settings",14)||""}${r("列设置")}`,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.addEventListener("click",a=>{if(MS===a){MS=null;return}aee(e,t)}),t}function mee(e){return(typeof e.mount=="function"?e.mount():e.mount?document.querySelector(e.mount):null)||null}function hee(e){const t={...e,config:eee(e)};$x.set(e.id,t);const a=mee(e),o=pee(t);return a&&(e.buttonPlacement==="last"?a.appendChild(o):a.insertBefore(o,a.firstChild)),{apply:c=>cP(e.id,c),config:()=>t.config}}window.wbColSettings={register:hee,apply:cP,configOf:nee,syncStaticHead:fee,close:qx};function sl(){return window}const gee=new Set(["updateCheck"]);function dP(e){return(Array.isArray(e?.tasks)?e.tasks:[]).filter(a=>!gee.has(a.id))}const xee=2e4,fP=1,bee=" · ";function Xu(e,t){sl().wbApp?.toast?.(e,t)}function Gx(e){return e instanceof Error?e.message:String(e)}function pP(e){return r(e==="seconds"?"秒":"分钟")}function mP(e){const t=Number(e)||0;return t?new Date(t).toLocaleTimeString("zh-CN",{hour12:!1}):""}function hP(e){const t=Number(e)||0;if(!t)return"";const a=t-Date.now();if(a<=0)return r("即将执行");const o=Math.round(a/1e3);if(o<60)return r("{n} 秒后",{n:o});const c=Math.round(o/60);if(c<60)return r("{n} 分钟后",{n:c});const d=Math.round(c/60);return d<24?r("{n} 小时后",{n:d}):r("{n} 天后",{n:Math.round(d/24)})}function vee(e){const t=e.runner==="backend",a=[];if(e.lastRunAt){const o=mP(e.lastRunAt);a.push(e.lastResult?r("上次执行 {time}({result})",{time:o,result:e.lastResult}):r("上次执行 {time}",{time:o}))}else a.push(r(t?"还没有执行记录":"由页面按间隔自动刷新"));return t&&e.enabled&&e.nextRunAt&&a.push(r("下次执行 {time}({relative})",{time:mP(e.nextRunAt),relative:hP(e.nextRunAt)})),t&&e.retryAt&&e.retryAt>Date.now()&&a.push(r("冷却中,{relative}重试",{relative:hP(e.retryAt)})),a.join(bee)}function yee(e,t){const a=String(t??"").trim(),o=pP(e.unit);if(!a)return{ok:!1,message:r("间隔不能为空(可填 {min}–{max} {unit})",{min:e.min,max:e.max,unit:o})};if(!/^\d+$/.test(a))return{ok:!1,message:r("间隔必须是整数")};const c=Number(a);return ce.max?{ok:!1,message:r("间隔必须在 {min}–{max} {unit} 之间(当前填的是 {value})",{min:e.min,max:e.max,unit:o,value:a})}:{ok:!0,value:c}}function wee(e){const t=sl();e.id==="logsAutoRefresh"?t.wbLogsPanel?.applyAutoRefresh?.(e):e.id==="requestsAutoRefresh"?t.wbRequestsPanel?.applyAutoRefresh?.(e):e.id==="reportAutoRefresh"&&t.wbReport?.applyAutoRefresh?.(e)}let lc=!1,Kx=null,IS=!1;async function gP(){if(!Kx){IS=!0;return}await Kx()}function jee(){const[e,t]=x.useState([]),[a,o]=x.useState(!1),[c,d]=x.useState(null),[f,p]=x.useState({});function h(I){p(P=>{if(!(I in P))return P;const O={...P};return delete O[I],O})}const b=x.useCallback(async()=>{const I=sl().workbuddyDesktop;try{if(!I)throw new Error(r("后端桥不可用"));const P=await I.getScheduledTasks();t(dP(P)),o(!0)}catch(P){console.warn("读取定时任务失败:",Gx(P)),t([]),o(!0)}},[]),y=x.useCallback(async()=>{if(lc||document.hidden||sl().wbApp?.currentPage!=="tasks")return;const I=sl().workbuddyDesktop;if(I)try{const P=await I.getScheduledTasks();t(dP(P))}catch(P){console.warn("同步定时任务状态失败:",Gx(P))}},[]);x.useEffect(()=>{const I=window.setInterval(()=>{y()},xee);return()=>{window.clearInterval(I)}},[y]),x.useEffect(()=>{sl().wbApp?.renderTopbarStatus?.()},[e,a]),x.useEffect(()=>(Kx=b,IS&&(IS=!1,b()),()=>{Kx=null}),[b]);async function v(I,P,O){if(lc)return;const _=sl().workbuddyDesktop;if(_){lc=!0;try{const L=await _.saveScheduledTask(I,P);t(H=>H.map(B=>B.id===I?L:B)),wee(L),Xu(r("✅ 已更新「{label}」",{label:O}))}catch(L){Xu(r("保存失败:{reason}",{reason:Gx(L)}),"err"),await b()}finally{lc=!1}}}async function w(I,P){const O=yee(I,P);if(!O.ok){Xu(O.message,"err"),h(I.id);return}if(O.value===I.interval){h(I.id);return}await v(I.id,{interval:O.value},r("{name}间隔",{name:r(I.label)})),h(I.id)}async function j(I){if(lc)return;const P=sl().workbuddyDesktop;if(P){lc=!0,d(I.id);try{const O=await P.runScheduledTask(I.id);if(O?.task){const _=O.task;t(L=>L.map(H=>H.id===I.id?_:H))}Xu(r("✅ {task}:{summary}",{task:r(I.label),summary:O?.summary||r("已执行")})),I.id==="credentialMaintenance"&&await sl().wbApp?.refresh?.()}catch(O){Xu(r("执行失败:{reason}",{reason:Gx(O)}),"err"),await b()}finally{lc=!1,d(null)}}}function S(I){const P=pP(I.unit),O=c===I.id;return s.jsxs("div",{className:"task-item","data-task":I.id,children:[s.jsxs("div",{className:"task-main",children:[s.jsxs("div",{className:"task-title",children:[s.jsxs("label",{className:"switch",children:[s.jsx(hs,{checked:I.enabled===!0,onCheckedChange:_=>{v(I.id,{enabled:_},r("{name}开关",{name:r(I.label)}))}}),s.jsx("span",{className:"task-name",children:r(I.label)})]}),s.jsx("span",{className:"tip-q","data-tip":r(I.description)}),s.jsx(ze,{className:"task-badge",variant:I.enabled?"success":"outline",children:I.enabled?r("已开启"):r("已关闭")}),I.running?s.jsx(ze,{className:"task-badge",variant:"warning",children:r("执行中…")}):null]}),s.jsx("div",{className:"task-state",children:vee(I)})]}),s.jsxs("div",{className:"task-actions",children:[s.jsxs("span",{className:"task-interval",children:[s.jsx("span",{className:"task-interval-label",children:r("每")}),s.jsx($e,{type:"number",inputMode:"numeric",min:I.min,max:I.max,step:1,className:"w-[74px] max-w-[74px] text-center tabular-nums",value:f[I.id]??String(I.interval),title:r("可填 {min}–{max} {unit}(默认 {def} {unit})",{min:I.min,max:I.max,unit:P,def:I.defaultInterval}),onChange:_=>{const L=_.currentTarget.value;p(H=>({...H,[I.id]:L}))},onBlur:_=>{w(I,_.currentTarget.value)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}}),s.jsx("span",{className:"task-interval-unit",children:P})]}),I.canRun===!0?s.jsx(se,{size:"sm",variant:"outline",disabled:O||I.running===!0,onClick:()=>{j(I)},children:r(O?"执行中…":"立即执行")}):null]})]},I.id)}const N=e.length===0,k=e.filter(I=>I.enabled).length,T=N?a?r("不可用"):"—":r("{enabled} / {total} 个已开启",{enabled:k,total:e.length}),D=N?a?"destructive":"outline":k?"success":"outline",C=D==="destructive"?"bad":D==="success"?"ok":"",A=e.map(I=>S(I)),R=A.slice(fP);return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("任务清单")}),s.jsx(ze,{id:"tasks-badge",variant:D,"data-tone":C,children:T}),s.jsx("span",{className:"panel-sub",children:r("状态每 20 秒自动同步")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"outline",onClick:()=>{b().then(()=>Xu(r("定时任务已刷新")))},children:r("刷新")})})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"task-list",children:N?s.jsx("div",{className:"log-empty",children:r(a?"没有可显示的定时任务。后端未返回任务清单,请确认网关正在运行。":"正在加载定时任务…")}):s.jsxs(s.Fragment,{children:[A.slice(0,fP),R.length?s.jsx("div",{className:"task-grid",children:R}):null]})})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{children:[r("任务配置保存在 "),s.jsx("code",{children:"~/.agent2api/config.json"}),r(" 的 "),s.jsx("code",{children:"scheduledTasks"}),r(" 字段")]}),s.jsx("span",{children:r("改动立即生效,不需要重启程序")})]})]})}const xP='.page[data-page="tasks"]';let bP=!1;function vP(){if(bP)return;const e=document.querySelector(xP);e&&(bP=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(jee,{})))}document.querySelector(xP)?vP():document.addEventListener("DOMContentLoaded",vP,{once:!0}),window.wbTasksPanel={load:gP},sl().wbApp?.currentPage==="tasks"&&gP();const yP="workbuddy-desktop-update-skip";function See(){try{return localStorage.getItem(yP)||""}catch{return""}}function Nee(e){try{localStorage.setItem(yP,e)}catch{}}let wP="";function Yx(e,t){if(!e||e.hasUpdate!==!0||e.pendingRestart===!0)return;const a=String(e.latestVersion||"").trim();a&&Pn().wbApp?.currentPage!=="settings"&&(a===See()||a===wP||(wP=a,jP(),Qu=document.createElement("div"),document.body.append(Qu),Dp=vn.createRoot(Qu),Dp.render(s.jsx(kee,{info:e,onGoUpdate:t,onClose:jP}))))}function kee({info:e,onGoUpdate:t,onClose:a}){const o=String(e.latestVersion||""),c=String(e.notes||"").trim(),d=c?Y2(c):"";function f(){Nee(o),a()}function p(){a();const h=Pn();h.wbApp?.showPage?.("settings"),h.wbSettingsPanel?.showCategory?.("about"),t(e)}return s.jsx(Qt,{open:!0,onOpenChange:h=>{h||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("检测到更新")})}),s.jsxs(Bt,{children:[s.jsxs("p",{className:"text-[12.5px] leading-[1.6] text-subtle",children:[r("新版本 "),s.jsx("strong",{className:"text-foreground",children:o}),r(" 已发布(当前 {current}),更新日志如下:",{current:e.currentVersion||r("未知")})]}),s.jsx("div",{className:"max-h-[46vh] overflow-y-auto overscroll-contain pr-1.5",onClick:X2,children:d?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:d}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})})})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",size:"sm",onClick:f,children:r("跳过此次更新")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:p,children:r("去更新")})]})]})})}let Dp=null,Qu=null;function jP(){Dp&&(Dp.unmount(),Dp=null),Qu&&(Qu.remove(),Qu=null)}const SP="updateCheck",Zu=1,Xx=1440,Cee="https://github.com/settings/tokens/new?description="+encodeURIComponent("Agent2API 更新检查");function Tee(e){return e?e.error?{badge:s.jsx(ze,{shape:"tag",variant:"destructive",title:e.error,children:r("无法解密")}),hint:r("重新粘贴保存一次即可自愈")}:e.filled&&e.origin==="stored"?{badge:s.jsx(ze,{shape:"tag",variant:"success",children:r("已填写")}),hint:r("已加密存储在本地,不显示具体值;粘贴新令牌可覆盖")}:e.filled?{badge:s.jsx(ze,{shape:"tag",variant:"secondary",children:r("环境变量")}),hint:r("已配置 GITHUB_TOKEN 环境变量,界面保存的令牌优先于它")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("未填写")}),hint:r("填写后检查限额 60 → 5000 次/小时(创建令牌无需勾选任何权限)")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("读取中")}),hint:""}}function Eee({open:e,onClose:t}){const[a,o]=x.useState(Q2),[c,d]=x.useState(null),[f,p]=x.useState(""),[h,b]=x.useState(!1),[y,v]=x.useState(null),[w,j]=x.useState(""),[S,N]=x.useState(!1),k=Z2(a);x.useEffect(()=>{e&&(p(""),qY().then(o),(async()=>{try{d(await Pn().workbuddyDesktop?.getUpdateToken()??null)}catch{}})(),(async()=>{try{const L=((await Pn().workbuddyDesktop?.getScheduledTasks?.())?.tasks??[]).find(z=>z.id===SP),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B))}catch{}})())},[e]);async function T(_){if(!S){N(!0);try{const L=await Pn().workbuddyDesktop?.saveScheduledTask?.(SP,_),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));v({enabled:H,interval:B}),j(String(B)),nr(r("✅ 自动检查更新已保存"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{N(!1)}}}async function D(){const _=Math.round(Number(w));if(!Number.isFinite(_)||_Xx){nr(r("检查间隔必须是 {min} ~ {max} 分钟",{min:Zu,max:Xx}),"err");return}y&&_===y.interval||await T({interval:_})}async function C(_){const L=await GY(_);L&&o(H=>({...H,proxyChoice:L.choice}))}async function A(){const _=f.trim();if(!_){nr(r("请先粘贴 GitHub 令牌"),"err");return}b(!0);try{const L=await Pn().workbuddyDesktop?.setUpdateToken({token:_});d(L??null),p(""),L?.saved===!1?nr(r("令牌已生效,但写入磁盘失败(重启后会丢失)"),"err"):nr(r("✅ GitHub 令牌已保存(加密存储,界面不再显示)"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{b(!1)}}async function R(){b(!0);try{const _=await Pn().workbuddyDesktop?.setUpdateToken({token:null});d(_??null),nr(r("✅ 已清除界面保存的 GitHub 令牌(环境变量若配置过则继续生效)"))}catch(_){nr(r("清除失败:{error}",{error:zr(_)}),"err")}finally{b(!1)}}const I=Tee(c),P=!!c?.error||c?.origin==="stored",O=c?.filled&&c?.origin!=="env"?r("已填写(粘贴新令牌可覆盖)"):r("粘贴 GitHub 令牌(ghp_… / github_pat_…)");return s.jsx(Qt,{open:e,onOpenChange:_=>{_||t()},children:s.jsxs(Zt,{className:"w-[min(460px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更新设置")})}),s.jsxs(Bt,{className:"gap-3.5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("自动检查更新")}),s.jsx(hs,{checked:y?.enabled===!0,disabled:S||!y,onCheckedChange:_=>{T({enabled:_===!0})},"aria-label":r("自动检查更新")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsx($e,{type:"number",min:Zu,max:Xx,step:1,className:"w-[110px]",disabled:S||!y||y.enabled!==!0,value:w,onChange:_=>j(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),D())},"aria-label":r("检查间隔(分钟)")}),s.jsx("span",{className:"text-[12px] text-subtle",children:r("分钟({min} ~ {max})",{min:Zu,max:Xx})}),s.jsx(se,{variant:"outline",size:"sm",disabled:S||!y||Math.round(Number(w))===y.interval,onClick:()=>{D()},children:r("保存")})]}),s.jsx("div",{className:"mt-1.5 text-[12px] text-subtle",children:r("到点自动向 GitHub 查询新版本,查到就走「检测到更新」弹窗;关闭后「检查更新」按钮仍可手动触发")})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("出网代理")}),s.jsx("div",{className:"mt-1.5",children:s.jsxs(ft,{value:k.current,onValueChange:_=>{C(String(_))},children:[s.jsx(mt,{className:Ue("w-full",k.broken&&"border-destructive-bd"),title:k.title,"aria-label":r("更新出网代理"),children:s.jsx(pt,{className:"min-w-0 truncate",children:k.selected?.label||r("直连")})}),s.jsx(ht,{children:k.items.map(_=>s.jsx(qe,{value:_.value,disabled:_.disabled,children:_.label},_.value))})]})})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("GitHub 令牌")}),s.jsx(se,{variant:"outline",size:"xs",title:r("在默认浏览器中打开 GitHub 的令牌创建页(备注已预设,无需勾选任何权限,直接点 Generate token)"),onClick:()=>{K2(Cee)},children:r("打开 GitHub 令牌页面")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[I.badge,s.jsx("span",{className:"text-[12px] text-subtle",children:I.hint})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[s.jsx($e,{type:"password",className:"flex-1",placeholder:O,autoComplete:"new-password",spellCheck:!1,value:f,onChange:_=>p(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),A())}}),s.jsx(se,{variant:"default",size:"sm",disabled:h||!f.trim(),onClick:()=>{A()},children:r("保存")}),P?s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{R()},children:r("清除")}):null]})]})]})]})})}function Aee({open:e,onClose:t}){return s.jsx(Qt,{open:e,onOpenChange:a=>{a||t()},children:s.jsxs(Zt,{className:"w-[min(320px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("加入 QQ 群")})}),s.jsxs(Bt,{className:"items-center gap-3 text-center",children:[s.jsx("img",{className:"qq-qr",src:$Y,alt:r("QQ 群二维码")}),s.jsxs("div",{className:"qq-no",children:[s.jsx("span",{className:"k",children:r("群号")}),s.jsx("code",{children:Jg}),s.jsx(se,{type:"button",size:"sm",variant:"ghost","data-copy":Jg,children:r("复制")})]}),s.jsx("p",{className:"qq-hint",children:r("用手机 QQ 扫上面的二维码,或在 QQ 里搜索群号加入。")})]})]})})}const Ree=1e3,NP=8,Oee=10,Mee=1e3,Dee={"":"outline",ok:"success",warn:"warning",bad:"destructive"},Iee={info:null,checkedAt:0,repository:"",badgeText:r("未检查"),badgeTone:"",stateText:r("点击「检查更新」查询最新发布版本。"),stateError:!1,percent:0,phase:"idle",readyPath:"",checking:!1,actionBusy:!1,restartSeconds:0};function Pl(e){return String(e).padStart(2,"0")}function Pee(e){const t=new Date(String(e??""));return!e||Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${Pl(t.getHours())}:${Pl(t.getMinutes())}`}function kP(e){const t=new Date(e);if(!e||Number.isNaN(t.getTime()))return"";const a=new Date,o=t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate(),c=`${Pl(t.getHours())}:${Pl(t.getMinutes())}:${Pl(t.getSeconds())}`;return o?c:`${Pl(t.getMonth()+1)}-${Pl(t.getDate())} ${c}`}function Qx(e){return e?.installerKind?e.installerKind==="dmg":/Mac|iPhone|iPad/.test(navigator.userAgent||"")}function Da(e){return e?.selfUpdate===!0}function CP(e){return e?Da(e)?e.serverAsset??null:e.asset??null:null}function _ee(e){return Da(e)?r("正在下载服务端更新包…(下载完成后由面板完成替换,重启容器内的服务后生效)"):Qx(e)?r("正在下载安装包…(下载完成后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装)"):r("正在下载安装包…(下载完成后启动安装程序需要管理员权限,会弹出 UAC 确认框)")}function TP(e,t){return Da(e)?r("更新包已就绪:{name}。点「安装并重启」后,面板会校验并替换容器内的程序与界面文件,然后重启服务(页面会自动刷新)。",{name:t}):Qx(e)?r("安装包已就绪:{name}。点击「打开安装包」后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装。",{name:t}):r("安装包已就绪:{name}。点击「安装并重启」后需要管理员权限,会弹出 UAC 确认框。",{name:t})}function Lee(e){return Da(e)?r("安装并重启"):Qx(e)?r("打开安装包"):r("安装并重启")}let fa=Iee;const PS=new Set;function _S(){return fa}function zee(e){return PS.add(e),()=>{PS.delete(e)}}function Bn(e){fa={...fa,...e};for(const t of PS)t()}let Sr=!1,LS=null,Zx=null;function Wu(){Zx!==null&&(window.clearInterval(Zx),Zx=null)}function Es(e,t=""){Bn({badgeText:e,badgeTone:t})}function An(e,t=!1){Bn({stateText:e,stateError:t})}function Wx(){const{info:e,checkedAt:t}=fa;if(!e)return;const a=t?r("(检查于 {time})",{time:kP(t)}):"";if(e.pendingRestart===!0){Es(r("待重启"),"warn"),An(r("更新已应用到容器内,重启服务后生效。{at}",{at:a}));return}if(e.hasUpdate===!0){if(Es(r("有新版本"),"warn"),Da(e)&&!e.serverAsset){An(r("发现新版本 {latest}(当前 {current}),但该版本没有提供容器内更新包;请在宿主机执行 docker compose pull && docker compose up -d 升级。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}));return}An(r("发现新版本 {latest}(当前 {current})。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}))}else e.hasUpdate===!1?(Es(r("已是最新"),"ok"),An(r("当前已是最新版本({current})。{at}",{current:String(e.currentVersion||""),at:a}))):(Es(r("无法比较"),"warn"),An(e.latestVersion?r("最新发布版本为 {latest},但当前版本号「{current}」无法解析,未做新旧判断。{at}",{latest:e.latestVersion,current:e.currentVersion||r("未知"),at:a}):r("仓库暂无发布版本。{at}",{at:a})))}function EP(e){!e||e.checked===!1||(Bn({info:e,checkedAt:Number(e.checkedAt)||0}),e.repository&&zS(e.repository),fa.phase==="idle"&&Wx())}function zS(e){const t=String(e||"").trim();/^[\w.-]+\/[\w.-]+$/.test(t)&&Bn({repository:t})}function BS(e){if(!e)return!1;if(e.active){const t=Math.max(0,Math.min(100,Number(e.percent)||0)),a=(Number(e.received)||0)/1024/1024,o=(Number(e.total)||0)/1024/1024;return Bn({phase:"downloading",percent:t}),Es(r("下载中"),"warn"),An(r("正在下载 {name}:{percent}%({received} / {total} MB)",{name:e.filename||r("安装包"),percent:t,received:a.toFixed(1),total:o.toFixed(1)})),!0}if(Wu(),Bn({percent:0}),e.error)return Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:e.error}),!0),Bn({phase:"failed"}),!0;if(e.canceled)return Es(r("已取消"),"warn"),An(Da(fa.info)?r("下载已取消,可重新点击「下载并更新」。"):r("下载已取消,可重新点击「下载并安装」。")),Bn({phase:"idle"}),!0;if(e.done&&e.path){const t=e.path,a=e.filename||t;return Es(r("可安装"),"ok"),Bn({phase:"ready",readyPath:t}),Da(fa.info)?(An(TP(fa.info,a)),!0):(t!==LS?(LS=t,An(Qx(fa.info)?r("安装包已下载完成,正在挂载磁盘映像…"):r("安装包已下载完成,正在启动安装程序(需要管理员权限,会弹出 UAC 确认框)…")),RP(t)):An(TP(fa.info,a)),!0)}return!1}async function Bee(){try{const e=await Pn().workbuddyDesktop?.updateProgress();if(!e){Wu();return}BS(e)}catch(e){Wu(),An(r("读取下载进度失败:{error}",{error:zr(e)}),!0)}}function AP(){Wu(),Zx=window.setInterval(()=>{Bee()},Ree)}async function RP(e){const t=Pn().workbuddyDesktop;if(t)try{const o=(await t.runInstaller(e,!0))?.restart!==!1;An(r(o?"安装程序已启动,本程序将退出以便完成覆盖安装。安装程序需要管理员权限,会弹出 UAC 确认框,请选择「是」。":"安装包已挂载,请在弹出的窗口里把应用拖进「应用程序」完成安装。安装完成后重新打开本程序即可。"))}catch(a){Es(r("启动失败"),"bad"),An(r("启动安装程序失败:{error}",{error:zr(a)}),!0)}}async function Hee(){const e=Pn().workbuddyDesktop;if(e?.installUpdate)try{Es(r("安装中"),"warn"),An(r("正在校验并替换容器内的程序与界面文件…"));const t=await e.installUpdate(),a=String(t?.version||"").trim();An(a?r("已替换为 {version},正在重启服务…",{version:a}):r("替换完成,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS(a)}catch(t){Es(r("安装失败"),"bad"),An(r("安装失败:{error}",{error:zr(t)}),!0)}}async function Uee(){const e=Pn().workbuddyDesktop;if(!(!e?.rollbackUpdate||Sr)){Sr=!0,Bn({actionBusy:!0});try{Es(r("回滚中"),"warn"),An(r("正在回滚到上一版本…")),await e.rollbackUpdate(),An(r("已还原上一版本,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS("")}catch(t){Es(r("回滚失败"),"bad"),An(r("回滚失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}function HS(e){Wu(),Bn({phase:"restarting",restartSeconds:NP,readyPath:""}),Es(r("重启中"),"warn");let t=NP;const a=()=>{if(An(e?r("{version} 已就位,服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{version:e,seconds:Math.max(0,t)}):r("服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{seconds:Math.max(0,t)})),t<=0){window.clearInterval(o),Vee();return}t-=1,Bn({restartSeconds:t})},o=window.setInterval(a,1e3);a()}async function Vee(){for(let e=0;e{window.setTimeout(t,Mee)})}window.location.reload()}async function OP(){if(Sr)return null;Sr=!0,Bn({checking:!0}),Es(r("检查中"),"warn"),An(r("正在查询 GitHub 上的最新发布版本…"));let e=null;try{const t=Pn().workbuddyDesktop;if(!t)throw new Error(r("后端桥不可用"));e=await t.checkUpdate()??null,Bn({info:e,checkedAt:Number(e?.checkedAt)||Date.now()}),e?.repository&&zS(e.repository),Wx()}catch(t){e=null,Bn({info:null,checkedAt:0}),Es(r("检查失败"),"bad"),An(r("检查更新失败:{error}",{error:zr(t)}),!0)}finally{Sr=!1,Bn({checking:!1})}return Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip),e}async function MP(){let e=null;try{e=await Pn().workbuddyDesktop?.getUpdateStatus()??null}catch{}if(e&&e.checked!==!1){EP(e),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip);return}fa.info||(Es(r("未检查")),An(r("点击「检查更新」查询 GitHub 上的最新发布版本。")))}async function US(){if(Sr)return;const e=_S();if(e.info?.pendingRestart===!0&&e.phase!=="downloading"){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.restartService?.().catch(()=>{}),HS("")}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase!=="downloading"&&e.readyPath){Sr=!0,Bn({actionBusy:!0});try{Da(e.info)?await Hee():await RP(e.readyPath)}finally{Sr=!1,Bn({actionBusy:!1})}return}if(e.phase==="downloading"){try{await Pn().workbuddyDesktop?.cancelUpdate(),An(r("正在取消下载…"))}catch(a){nr(r("取消失败:{error}",{error:zr(a)}),"err")}return}const t=CP(e.info);if(!t?.url){nr(Da(e.info)?r("这一版没有提供容器内更新包"):r("没有可下载的安装包"),"err");return}if(IP(e)){Sr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.downloadUpdate({url:t.url,name:t.name}),LS=null,Bn({phase:"downloading",readyPath:"",percent:0}),Es(r("下载中"),"warn"),An(_ee(e.info)),AP()}catch(a){Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:zr(a)}),!0)}finally{Sr=!1,Bn({actionBusy:!1})}}}async function DP(){Wx(),await MP();try{const e=await Pn().workbuddyDesktop?.updateProgress();if(e?.active){BS(e),AP();return}if(e?.done&&e.path){BS(e);return}}catch{}}async function Ip(e){if(e?.pendingRestart===!0){await US();return}e?.hasUpdate===!0&&(Bn({info:e,checkedAt:Number(e.checkedAt)||fa.checkedAt}),e.repository&&zS(e.repository),Wx(),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Ip)),await DP();const t=_S();if(!(t.phase==="downloading"||t.readyPath)&&t.info?.hasUpdate)for(let a=0;a<3;a+=1){if(Sr){await new Promise(o=>{window.setTimeout(o,400)});continue}await US();return}}function IP(e){return e.phase==="restarting"?null:e.info?.pendingRestart===!0&&e.phase==="idle"?{label:r("立即重启"),disabled:e.actionBusy}:!(e.info?.hasUpdate===!0&&!!CP(e.info)?.url)&&e.phase!=="downloading"&&e.phase!=="ready"?null:{label:e.phase==="downloading"?r("取消下载"):e.phase==="failed"?r("重试下载"):e.phase==="ready"?Lee(e.info):Da(e.info)?r("下载并更新"):r("下载并安装"),disabled:e.actionBusy}}function Fee(e,t){const a=e.info,o=String(a?.notes||"").trim();if(!o)return s.jsx("div",{className:"update-log-hint",children:r(a?"这个版本没有填写发布说明。":"点击「检查更新」后,这里会显示最新版本的更新说明。")});const c=Y2(o),d=G2(a?.pageUrl),f=Pee(a?.publishedAt);return s.jsxs("div",{className:"rel-note",children:[s.jsxs("div",{className:"rel-note-head",children:[s.jsx("span",{className:"rel-tag",children:String(a?.latestVersion||r("最新版本"))}),a?.prerelease===!0?s.jsx(ze,{shape:"tag",variant:"warning",children:r("预发布")}):null,f?s.jsx("span",{className:"rel-date",children:f}):null]}),s.jsxs("div",{className:"rel-note-body",children:[c?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:c}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})}),s.jsxs("div",{className:"rel-foot",children:[d?s.jsx("a",{href:d,"data-external":d,target:"_blank",rel:"noopener",children:r("在 GitHub 查看完整说明")}):null,s.jsx(se,{type:"button",variant:"link",size:"sm",className:"h-auto border-0 px-0 text-[11.5px] font-semibold text-primary-fg underline-offset-auto",title:r("群号:{group}",{group:Jg}),onClick:t,children:r("加入 QQ 群")})]})]})]})}function $ee(){const e=x.useSyncExternalStore(zee,_S),t=IP(e),[a,o]=x.useState(!1),[c,d]=x.useState(!1);x.useEffect(()=>()=>{Wu()},[]);const f=e.repository?`https://github.com/${e.repository}`:"",p=e.repository?`https://github.com/${e.repository.split("/")[0]}`:"",h=Da(e.info),b=h&&e.info?.backupAvailable===!0&&e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="restarting",y=e.info?.latestVersion?e.info.prerelease?r("{version}(预发布)",{version:e.info.latestVersion}):e.info.latestVersion:"—",v=String(e.info?.latestVersion||"").trim(),w=v?`${v}${e.checkedAt?r(" · 检查于 {time}",{time:kP(e.checkedAt)}):""}`:"";return s.jsxs("section",{className:"panel",onClick:X2,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("软件更新")}),s.jsx("span",{className:"tip-q","data-tip":r(h?"容器内更新:更新包从 GitHub 发布页下载,校验 sha256 后由面板替换容器内的程序与界面文件,再重启服务(容器由 restart 策略拉起,页面会自动刷新)。更新的是容器里的文件,compose 里的镜像标签不变 —— 之后执行 docker compose pull && up -d 会回到镜像里的版本;更新失败可一键回滚到上一版本。检查更新与下载的出网线路、GitHub 令牌都在「更新设置」里。":"更新包从 GitHub 发布页下载,下载完成后可直接启动安装程序并自动重启本程序。安装包会先校验来源域名与文件完整性。检查更新与下载安装包的出网线路、GitHub 令牌都在「更新设置」里:线路默认直连(直连失败时自动借 Clash Verge 的混合端口重试一次),选定指定出口后只走该出口;填写 GitHub 令牌可把检查限额从 60 次/小时提高到 5000 次/小时。")}),s.jsx(ze,{id:"update-badge",variant:Dee[e.badgeTone],"data-tone":e.badgeTone,children:e.badgeText}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-update-settings",variant:"outline",title:r("出网线路与 GitHub 令牌设置"),onClick:()=>o(!0),children:r("更新设置")}),s.jsx(se,{id:"btn-update-check",variant:"outline",disabled:e.checking||e.phase==="restarting",onClick:()=>{OP()},children:e.checking?r("检查中…"):r("检查更新")}),b?s.jsx(se,{id:"btn-update-rollback",variant:"outline",disabled:e.actionBusy,title:r("把容器内的程序与界面文件还原到更新前的版本,并重启服务"),onClick:()=>{Uee()},children:r("回滚到上一版本")}):null,t?s.jsx(se,{id:"btn-update-download",variant:"default",disabled:t.disabled,onClick:()=>{US()},children:t.label}):null]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"update-version",children:[s.jsxs("span",{className:"version-pill",children:[s.jsx("span",{className:"k",children:r("当前版本")}),s.jsx("span",{className:"v",id:"update-current",children:e.info?.currentVersion||"—"})]}),s.jsx("span",{className:"version-arrow",children:"→"}),s.jsxs("span",{className:"version-pill new",children:[s.jsx("span",{className:"k",children:r("最新版本")}),s.jsx("span",{className:"v",id:"update-latest",children:y})]})]}),s.jsx("div",{className:"detail",id:"update-state",style:e.stateError?{color:"var(--danger)"}:void 0,children:e.stateText}),e.phase==="downloading"&&e.percent>0&&e.percent<100?s.jsx(tf,{value:e.percent}):null,p&&f?s.jsxs("div",{className:"update-author",id:"update-author",children:[s.jsxs("div",{className:"update-author-text",children:[s.jsx("strong",{children:r("关于作者")}),s.jsxs("span",{children:[r("本工具由")," ",s.jsx("a",{id:"update-author-link",href:p,"data-external":p,target:"_blank",rel:"noopener",children:e.repository.split("/")[0]})," ",r("个人开发并开源维护,免费使用、不带广告,也不会收集你的账号数据。如果它帮到了你,欢迎到项目仓库点个 Star 支持一下。")]})]}),s.jsx("div",{className:"update-author-actions",children:s.jsx(se,{id:"btn-update-favorite",type:"button",size:"sm",variant:"outline","data-external":f,title:r("在浏览器中打开项目仓库,点 Star 支持作者"),children:r("收藏项目")})})]}):null,s.jsxs("div",{className:"update-log",id:"update-notes",children:[s.jsxs("div",{className:"update-log-head",children:[s.jsx("span",{className:"update-log-title",children:r("更新日志")}),s.jsx("span",{className:"update-log-meta",id:"update-log-meta",children:w})]}),s.jsx("div",{className:"update-log-body",id:"update-log-body",children:Fee(e,()=>d(!0))})]})]}),a?s.jsx(Eee,{open:!0,onClose:()=>o(!1)}):null,c?s.jsx(Aee,{open:!0,onClose:()=>d(!1)}):null]})}const PP='.settings-pane[data-cat="about"]';let VS=null;function _P(){if(VS)return;const e=document.querySelector(PP);e&&(e.replaceChildren(),VS=vn.createRoot(e),VS.render(s.jsx($ee,{})))}document.querySelector(PP)?_P():document.addEventListener("DOMContentLoaded",_P,{once:!0}),window.wbUpdatePanel={load:DP,check:OP,syncFromCache:MP,openAndDownload:Ip,applyStatus:EP,showUpdateModal:e=>Yx(e,Ip)};const qee="zcode.z.ai/billing",Gee={active:"success",pending:"warning",expired:"ghost",unknown:"outline"};function Kee(e){const t=String(e||"").trim().toLowerCase();return t==="daily"?r("每日"):t==="weekly"?r("每周"):t==="monthly"?r("每月"):""}function Yee(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(t)}function oc(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"":Pe().wbApp?.formatTime?.(t*1e3)||new Date(t*1e3).toLocaleString()}function Xee(e){const t=Yee(e.grantUnits),a=String(e.unitType||"").trim(),o=t?[t,a].filter(Boolean).join(" "):"",c=Kee(e.period),d=[String(e.showName||"").trim(),o].filter(Boolean).join(" ");return d?c?r("{body}({period})",{body:d,period:c}):d:""}function LP(e){return(e.entitlements||[]).map(Xee).filter(Boolean).join(r("、"))}function Qee(e){const t=oc(e.startsAt),a=oc(e.endsAt);return t&&a?`${t} → ${a}`:a?r("到期 {time}",{time:a}):t?r("开始 {time}",{time:t}):""}function Zee(e){const t=new Date(e*1e3);if(Number.isNaN(t.getTime()))return"";const a=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`,o=d=>Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/864e5),c=o(t)-o(new Date);return c===0?r("今天 {time}",{time:a}):c===1?r("明天 {time}",{time:a}):oc(e)}function Wee(e){const t=[],a=Number(e.pendingUntil);if(Number.isFinite(a)&&a>0){const c=Zee(a);c&&t.push(r("待生效 {time}",{time:c}))}const o=oc(e.endsAt);if(o&&t.push(r("到期 {time}",{time:o})),t.length===0){const c=oc(e.startsAt);c&&t.push(r("开始 {time}",{time:c}))}return t.join(" · ")}function Jee({options:e,onClose:t}){const a=e.id,[,o]=x.useState(0);x.useEffect(()=>YA(()=>o(P=>P+1)),[]);const[c,d]=x.useState([]),[f,p]=x.useState({status:"loading"}),[h,b]=x.useState(""),y=Ea(a),v=String(y?.name||e.name||a),w=Kh(y),j=[...new Set([...w,...c])],S=y?.claimPlans&&typeof y.claimPlans=="object"&&!Array.isArray(y.claimPlans)?y.claimPlans:{},N=y?Za(y):void 0,k=N&&typeof N=="object"&&!Array.isArray(N)?N:null,T=k&&Array.isArray(k.plans)?k.plans:[],D=j.filter(P=>P&&!T.some(O=>String(O.planId||"")===P)),C=Ws().usageInflight.has(a),A=Pe().wbZcodeClaim,R=x.useCallback(async()=>{if(!A?.preview){p({status:"error",message:r("当前环境不支持领取(桥接方法缺失)")});return}p({status:"loading"});try{const P=await A.preview(a);p({status:"ready",result:P||{}})}catch(P){p({status:"error",message:ut(P)})}},[A,a]);x.useEffect(()=>{R();const P=Ea(a);P&&Za(P)===void 0&&tg(a)},[a,R]);async function I(P){if(!(!A?.claim||h)){b(P);try{const O=await A.claim(a,P);if(O?.ok||O?.failure==="already_claimed"){const _=O.planId||P;_&&d(L=>L.includes(_)?L:[...L,_]),tg(a),Pe().wbApp?.refresh?.(),R()}}finally{b("")}}}return s.jsx(Qt,{open:!0,onOpenChange:(P,O)=>{if(!P){if(h){O.cancel();return}t()}},children:s.jsxs(Zt,{className:"w-[min(560px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("ZCode 套餐明细 — {name}",{name:v})})}),s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("可领取的套餐"),s.jsx(ze,{variant:"outline",shape:"tag",children:r("官方限时活动")})]}),f.status==="loading"?s.jsxs("div",{className:"flex items-center gap-2 py-2 text-[12.5px] text-muted-foreground",children:[s.jsx(ef,{className:"size-3"}),r("正在探测可领取的套餐…")]}):f.status==="error"?s.jsxs("div",{className:"py-1 text-[12.5px] text-destructive",children:[r("探测失败:{message}",{message:f.message}),s.jsx(se,{variant:"outline",size:"xs",className:"ml-2",onClick:()=>{R()},children:r("重试")})]}):f.result.deployed?(f.result.plans||[]).length===0?s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动期内每天发一份,明天可再领)")}):s.jsx("ul",{className:"m-0 list-none p-0",children:(f.result.plans||[]).map(P=>{const O=String(P.planId||""),_=j.includes(O),L=LP(P),H=Qee(P);return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),_?s.jsx(ze,{variant:"success",shape:"tag",children:r("今日已领")}):null]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null,P.description?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:P.description}):null]}),s.jsx(se,{variant:"outline",size:"xs",className:"flex-none",title:_?r("这一份今天已经领过了(重复领取上游会回「已领取过」)"):void 0,disabled:h!=="",onClick:()=>{I(O)},children:r(h===O?"领取中…":_?"再领一次":"领取")})]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动尚未开始)")}),s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("活动期内每天发一份新套餐;同一份当天重复领取会提示「已领取过」,次日可再领。领取要走一次人机验证(滑块)。")}),f.status==="ready"&&f.result.activationError?s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:r("(激活事件补报失败,可能影响领取资格:{message})",{message:f.result.activationError})}):null]}),s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("我的套餐"),Array.isArray(k?.wallets)&&k.wallets.length>0&&k.availableView?s.jsx(ze,{variant:"outline",shape:"tag",children:String(k.walletsFrom||"")==="monitor"?String(k.availableView):r("可用 {value}",{value:String(k.availableView)})}):null,s.jsx("div",{className:"ml-auto",children:s.jsx(se,{variant:"outline",size:"xs",disabled:C,title:r("重新读取该账号的余额与套餐(走余额查询那条链)"),onClick:()=>{tg(a)},children:r(C?"查询中…":"查询余额")})})]}),T.length>0?s.jsx("ul",{className:"m-0 list-none p-0",children:T.map(P=>{const O=String(P.planId||""),_=String(P.state||"unknown"),L=LP(P),H=Wee(P),B=O&&y?.claimPlans&&Number(y.claimPlans[O])||0;return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),s.jsx(ze,{variant:Gee[_]||"outline",shape:"tag",children:_A(_)})]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null]}),B>0?s.jsx("span",{className:"flex-none text-[11.5px] text-muted-foreground",children:r("本地领取于 {time}",{time:oc(B/1e3)})}):null]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:N===void 0?r("还没有余额读数(已自动查询一次,稍候;也可以点右上角「查询余额」重读)"):k&&k.source&&k.source!==qee?r("这个账号的余额走窗口限额通道(只配了编码套餐 API Key):只有每 N 小时的剩余比例,读不到套餐清单"):r("读数里没有套餐清单(免费账号、或套餐的上游状态还没刷新;可点右上角「查询余额」重读)")}),D.length>0?s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("本地台账里今天还领过这些,但上面的读数里还没有:{plans}(读数刷新可能有延迟)",{plans:D.map(P=>{const O=Number(S[P])||0,_=O>0?oc(O/1e3):"";return _?r("{plan}({time} 领取)",{plan:P,time:_}):P}).join(r("、"))})}):null]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:j.length>0?r("今天(北京时间)已领取 {n} 份:{plans}",{n:j.length,plans:j.join(r("、"))}):r("今天还没有领过:上面「可领取的套餐」里逐份点「领取」即可")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})})}let Pp=null,Ju=null;function zP(){Pp&&(Pp.unmount(),Pp=null),Ju&&(Ju.remove(),Ju=null)}function ete(e){e?.id&&(zP(),Ju=document.createElement("div"),document.body.append(Ju),Pp=vn.createRoot(Ju),Pp.render(s.jsx(Jee,{options:e,onClose:zP})))}window.wbZcodePlans={open:ete};const BP="w-auto flex-auto";function HP({onInput:e,domRef:t,icon:a,className:o,inputClassName:c,...d}){const f=h=>{t.current=h},p=h=>{e?.(h.currentTarget.value)};return a?s.jsxs(Ci,{className:Ue(BP,o),children:[s.jsx(Ei,{ref:f,className:c,onInput:p,...d}),s.jsx(Ti,{"aria-hidden":"true",children:a})]}):s.jsx($e,{ref:f,className:Ue(BP,c),onInput:p,...d})}function tte(e,t){const a=vn.createRoot(e),o={current:null};return a.render(s.jsx(HP,{domRef:o,defaultValue:t.value,placeholder:t.placeholder,type:t.type??"search",icon:t.icon,"aria-label":t.ariaLabel,onInput:t.onInput})),{setValue(c){const d=o.current;d&&d.value!==c&&(d.value=c)},getValue(){return o.current?.value??""},focus(){o.current?.focus()},unmount(){a.unmount()}}}const nte=[["id","id"],["type","type"],["name","name"],["title","title"],["placeholder","placeholder"],["min","min"],["max","max"],["step","step"],["autocomplete","autoComplete"]];function ste(e){const t={defaultValue:e.value||void 0,inputClassName:e.className||void 0};for(const[f,p]of nte){const h=e.getAttribute(f);h!=null&&(t[p]=h)}const a=e.getAttribute("maxlength");a!=null&&(t.maxLength=Number(a));const o=e.getAttribute("inputmode");o!=null&&(t.inputMode=o),e.hasAttribute("spellcheck")&&(t.spellCheck=e.spellcheck),e.disabled&&(t.disabled=!0),e.readOnly&&(t.readOnly=!0),e.hidden&&(t.hidden=!0);const c=e.getAttribute("aria-label");c!=null&&(t["aria-label"]=c);for(const f of e.getAttributeNames())!f.startsWith("data-")||f.startsWith("data-island-")||(t[f]=e.getAttribute(f)??"");const d=e.getAttribute("data-island-icon");return d!=null&&(t.icon=d),t}function UP(e){if(e.dataset.islandUpgraded)return;e.dataset.islandUpgraded="1";const t=ste(e),a=e.parentElement?.classList.contains("input-affix")?e.parentElement:null;let o;a?(a.className=a.className.replace(/\binput-affix\b/,"").trim(),a.style.display="flex",a.style.alignItems="center",o=a):(o=document.createElement("span"),o.style.display="contents",e.replaceWith(o));const c={current:null},d=vn.createRoot(o);Cs.flushSync(()=>{d.render(s.jsx(HP,{...t,domRef:c}))})}function VP(e=document){if(e instanceof HTMLInputElement&&e.matches("[data-island-input]")){UP(e);return}e.querySelectorAll("input[data-island-input]").forEach(UP)}function rte(){VP();const e=new MutationObserver(t=>{for(const a of t)for(const o of a.addedNodes)o instanceof Element&&VP(o)});return e.observe(document.body,{childList:!0,subtree:!0}),e}function ate(e,t){const a=vn.createRoot(e);let o={options:t.options,value:t.value,ariaLabel:t.ariaLabel,className:t.className};const c=()=>{a.render(s.jsx(In,{options:o.options,value:o.value,onValueChange:t.onChange,"aria-label":o.ariaLabel,className:o.className}))};return c(),{setValue(d){d!==o.value&&(o={...o,value:d},c())},setOptions(d){o={...o,options:d},c()},unmount(){a.unmount()}}}window.wbSegmented={mount:ate},window.wbInput={mount:tte},rte()})(); +`)}}const y=[...p.entries()].sort((b,j)=>b[0]-j[0]).map(([,b])=>b);y.length&&e.onEvent({type:"toolCalls",calls:y}),e.onEvent({type:"done",finishReason:h})}function Wj(e){const t=String(e||"").trim();if(!t)return{};try{const a=JSON.parse(t);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Ja(){const e=window.workbuddyDesktop;if(!e)throw new Error(r("桌面桥不可用(本页需要在 Agent2API 客户端里打开)"));return e}function Nu(){window.wbApp?.refresh?.()}function at(e,t=256){return typeof e=="string"?e.trim().slice(0,t):""}function Ui(e){return typeof e=="boolean"?e:void 0}function Bf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function ku(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"):[]}function Cu(e){return(e instanceof Error?e.message:String(e)).replace(/^Error:\s*/,"")}async function Sg(){const e=await Ja().getState?.();return(Array.isArray(e?.accounts)?e.accounts:[]).slice().sort((a,o)=>Number(a.priority??0)-Number(o.priority??0))}function Hf(e){return at(e.name)||at(e.nickname)||at(e.id)||"(未命名账号)"}function Jj(e,t){const a=t.trim();if(!a)throw new Error(r("没给账号名"));const o=e.find(p=>at(p.id)===a);if(o)return o;const c=e.filter(p=>Hf(p)===a);if(c.length===1)return c[0];const d=e.filter(p=>Hf(p).includes(a));if(d.length===1)return d[0];const f=(c.length?c:d).map(Hf).slice(0,6);throw f.length?new Error(r("「{name}」匹配到多个账号:{list},请用完整账号名重试",{name:a,list:f.join("、")})):new Error(r("没有找到账号「{name}」",{name:a}))}const TG={id:"list_models",label:r("获取模型列表"),kind:"read",desc:"读取各提供商的模型清单(模型 ID、所属提供商、是否启用、已挂的映射名)以及全部映射。回答「有哪些模型」「哪些模型在多家重复」「某个名字挂在哪」这类问题之前先调用它。",params:{type:"object",properties:{provider:{type:"string",description:"只看某一家(提供商 id,如 codearts / workbuddy);不填 = 全部"},keyword:{type:"string",description:"按模型 ID 或映射名做子串过滤;不填 = 不过滤"},enabledOnly:{type:"boolean",description:"true = 只看已启用的模型"}}},run:async e=>{const t=at(e.provider,64).toLowerCase(),a=at(e.keyword,128).toLowerCase(),o=Ui(e.enabledOnly)===!0,c=await Ja().getModelManage?.(),f=(Array.isArray(c?.models)?c.models:[]).filter(p=>!(t&&at(p.provider).toLowerCase()!==t||o&&p.enabled!==!0||a&&![at(p.id),at(p.name),...Array.isArray(p.aliases)?p.aliases.map(v=>at(v)):[]].join(" ").toLowerCase().includes(a))).map(p=>({provider:at(p.provider),id:at(p.id),enabled:p.enabled===!0,aliases:Array.isArray(p.aliases)?p.aliases.map(h=>at(h)):[]}));return{text:JSON.stringify({total:f.length,models:f.slice(0,400)}),summary:r("{n} 个模型",{n:f.length})}}},EG={id:"list_account_balance",label:r("查询账号余额"),kind:"read",desc:"查询各账号的余额 / 剩余额度(会向各上游发起真实的余额查询)。回答「还剩多少」「哪个账号快用完了」这类问题之前先调用它。",params:{type:"object",properties:{account:{type:"string",description:"只查某个账号(账号名或 id);不填 = 全部账号"}}},run:async e=>{const t=at(e.account,128),a=t?at(Jj(await Sg(),t).id):"",o=await Ja().getAllBalances?.(a||void 0),c=Array.isArray(o?.results)?o.results:o,d=Array.isArray(c)?c:[];return{text:JSON.stringify({accounts:d.slice(0,60)}).slice(0,12e3),summary:r("{n} 个账号",{n:d.length})}}},AG={id:"set_model_enabled",label:r("启用 / 禁用模型"),kind:"write",desc:"开启或关闭某几个模型在网关上的可用性(粒度是「提供商 × 模型」)。禁用后下游请求不再路由到它。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的模型列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["provider","id","enabled"]}}},required:["items"]},plan:e=>{const t=ku(e.items);return{lead:r("将修改 {n} 个模型的启停状态:",{n:t.length}),table:{head:[r("提供商"),r("模型"),r("改成")],rows:t.map(a=>[at(a.provider),at(a.id),Ui(a.enabled)===!1?r("禁用"):r("启用")])},note:r("改动立即生效;禁用后指向它的请求会落到下一个候选。")}},run:async e=>{const t=Ja(),a=ku(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=Ui(c.enabled);if(!d||!f||p===void 0)throw new Error(r("参数不完整(需要 provider / id / enabled)"));await t.setModelState?.({provider:d,id:f,enabled:p}),o.push(`${p?"启用":"禁用"} ${d}/${f}`)}return Nu(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已修改 {n} 个模型",{n:o.length})}}},RG={id:"set_model_mapping",label:r("设置模型映射 ID"),kind:"write",desc:"给模型新增或删除映射名(对外名)。同一对外名可以在多个提供商各挂一条:下游用同一个名字请求,网关按账号优先级主备切换;也可以给不同家的同名模型各加前缀(如 ca/claude-sonnet-4.5)来精确指定某一家。一次可以改多条。删掉的映射名只是不再对外可用,不删任何模型。",params:{type:"object",properties:{items:{type:"array",description:"要改的映射列表",items:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"上游模型 ID"},alias:{type:"string",description:"要新增 / 删除的映射名(对外名)"},action:{type:"string",enum:["add","remove"],description:"add = 新增映射,remove = 删除映射"}},required:["provider","id","alias","action"]}}},required:["items"]},plan:e=>{const t=ku(e.items),a=t.filter(d=>at(d.action)!=="remove").length,o=t.length-a,c=[];return a&&c.push(r("新增 {n} 条",{n:a})),o&&c.push(r("删除 {n} 条",{n:o})),{lead:r("将改动 {n} 条映射({parts}):",{n:t.length,parts:c.join("、")}),table:{head:[r("提供商"),r("上游模型"),r("操作"),r("映射名")],rows:t.map(d=>[at(d.provider),at(d.id),at(d.action)==="remove"?r("删除"):r("新增"),at(d.alias)])},note:r("只改映射名,不动上游模型 ID;映射立即生效(新对话即可用)。")}},run:async e=>{const t=Ja(),a=ku(e.items),o=[];for(const c of a){const d=at(c.provider),f=at(c.id),p=at(c.alias,128);if(!d||!f||!p)throw new Error(r("参数不完整(需要 provider / id / alias)"));at(c.action)==="remove"?(await t.removeModelMapping?.(p,f,d),o.push(`删除 ${p} → ${d}/${f}`)):(await t.addModelMapping?.(p,f,d),o.push(`新增 ${p} → ${d}/${f}`))}return Nu(),{text:JSON.stringify({ok:!0,changed:o}),summary:r("已改动 {n} 条映射",{n:o.length})}}},EO=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],ew={maxInputTokens:"上下文窗口",maxOutputTokens:"最大输出 Token",supportsToolCall:"工具调用",supportsImages:"图片识别",supportsVideo:"视频识别",supportsReasoning:"深度推理"},OG={id:"set_model_capability",label:r("修改模型能力"),kind:"write",desc:"修改某个模型对下游声明的能力位:上下文窗口、最大输出 Token、工具调用 / 图片 / 视频 / 深度推理四个布尔位。只传要改的键;布尔位给 null 表示恢复上游原值。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},capabilities:{type:"object",description:"要改的能力位(只写要改的键)",properties:{maxInputTokens:{type:["number","null"],description:"上下文窗口(token 数)"},maxOutputTokens:{type:["number","null"],description:"最大输出 token 数"},supportsToolCall:{type:["boolean","null"],description:"是否支持工具调用;null = 恢复上游原值"},supportsImages:{type:["boolean","null"],description:"是否支持图片识别;null = 恢复上游原值"},supportsVideo:{type:["boolean","null"],description:"是否支持视频识别;null = 恢复上游原值"},supportsReasoning:{type:["boolean","null"],description:"是否支持深度推理;null = 恢复上游原值"}}}},required:["provider","id","capabilities"]},plan:e=>{const t=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},a=EO.filter(o=>o in t);return{lead:r("将修改 {model} 的 {n} 项能力:",{model:`${at(e.provider)} / ${at(e.id)}`,n:a.length}),table:{head:[r("能力"),r("改成")],rows:a.map(o=>{const c=t[o],d=c===null?r("恢复上游原值"):typeof c=="boolean"?r(c?"支持":"不支持"):String(c);return[ew[o]||o,d]})},note:r("能力位决定下游看到的声明(能不能贴图、能塞多少上下文),不改上游的真实行为。")}},run:async e=>{const t=at(e.provider),a=at(e.id),o=e.capabilities&&typeof e.capabilities=="object"?e.capabilities:{},c={};for(const d of EO){if(!(d in o))continue;const f=o[d];if(f===null){c[d]=null;continue}if(d==="maxInputTokens"||d==="maxOutputTokens"){const p=Bf(f);if(p===void 0)throw new Error(r("{key} 需要数字",{key:ew[d]}));c[d]=Math.round(p)}else{const p=Ui(f);if(p===void 0)throw new Error(r("{key} 需要 true / false / null",{key:ew[d]}));c[d]=p}}if(!t||!a||!Object.keys(c).length)throw new Error(r("参数不完整(需要 provider / id / capabilities)"));return await Ja().setModelCapabilities?.(t,a,c),Nu(),{text:JSON.stringify({ok:!0,provider:t,id:a,capabilities:c}),summary:r("已修改 {n} 项能力",{n:Object.keys(c).length})}}},MG={id:"test_model",label:r("发起模型测试"),kind:"run",desc:"对某个模型发一次真实的对话请求,回报连通性、耗时与首字延迟。会消耗该账号的额度。回答「这个模型通不通 / 快不快」时用它。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},id:{type:"string",description:"模型 ID"},prompt:{type:"string",description:"测试用的用户提示词;不填 = 默认一句问候(最小请求)"}},required:["provider","id"]},plan:e=>({lead:r("将对 {model} 发起一次真实请求:",{model:`${at(e.provider)} / ${at(e.id)}`}),table:{head:[r("项"),r("值")],rows:[[r("提示词"),at(e.prompt)||r("(默认问候)")],[r("代价"),r("消耗该账号额度")]]},note:r("这是真实的上游请求,与生产走同一条链路(会记账,报表排除)。")}),run:async e=>{const t={provider:at(e.provider),model:at(e.id)},a=at(e.prompt,4e3);a&&(t.prompt=a);const o=await Ja().testModel?.(t),c=String(o?.status??""),d=o?.success===!0,f={ok:d,status:c,error:o?.error??null,reply:String(o?.reply??"").slice(0,1500),duration_ms:o?.duration_ms??null,ttfb_ms:o?.ttfb_ms??null,account:o?.account_name??null};return{text:JSON.stringify(f).slice(0,6e3),summary:d?r("连通 · {ms}ms",{ms:String(f.duration_ms??"")}):r("失败 · {status}",{status:c||"—"})}}},DG={id:"set_provider_order",label:r("调整提供商顺位"),kind:"write",desc:"调整某个提供商在账号全局队列里的**整组顺位**(第几组),决定路由时先试哪一家。这一家的所有账号会作为一整块移动。位置从 1 开始数。",params:{type:"object",properties:{provider:{type:"string",description:"提供商 id"},position:{type:"number",description:"目标组顺位(1 = 最前)"}},required:["provider","position"]},plan:e=>({lead:r("将把「{provider}」整组移到第 {position} 顺位:",{provider:at(e.provider)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交(后端按新顺序重编优先级),移动会连带调整其它组的相对次序。")}),run:async e=>{const t=at(e.provider).toLowerCase(),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 provider / position)"));const o=await Sg(),c=[];for(const h of o){const v=at(h.id),y=at(h.provider).toLowerCase();if(!v)continue;const b=c[c.length-1];b&&b.provider===y?b.ids.push(v):c.push({provider:y,ids:[v]})}const d=c.findIndex(h=>h.provider===t);if(d<0)throw new Error(r("没有找到提供商「{provider}」的账号",{provider:t}));const f=Math.max(0,Math.min(c.length-1,Math.round(a)-1)),[p]=c.splice(d,1);return c.splice(f,0,p),await Ja().reorderAccounts?.(c.flatMap(h=>h.ids)),Nu(),{text:JSON.stringify({ok:!0,provider:t,from:d+1,to:f+1,moved:p.ids.length}),summary:r("已移到第 {n} 顺位",{n:f+1})}}},IG={id:"set_account_order",label:r("调整账号优先级"),kind:"write",desc:"把某个账号移动到账号全局队列的第 N 顺位(1 = 最前)。位置决定主备与切换顺序:越靠前越先被使用。",params:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},position:{type:"number",description:"目标顺位(1 = 最前)"}},required:["account","position"]},plan:e=>({lead:r("将把账号「{account}」移到第 {position} 顺位:",{account:at(e.account)||r("(未指定)"),position:String(Bf(e.position)??"?")}),note:r("队列是一次性整表提交;位置越靠前,路由时越先被选中。")}),run:async e=>{const t=at(e.account,128),a=Bf(e.position);if(!t||a===void 0)throw new Error(r("参数不完整(需要 account / position)"));const o=await Sg(),c=Jj(o,t),d=at(c.id),f=o.map(v=>at(v.id)).filter(Boolean),p=f.indexOf(d);if(p<0)throw new Error(r("账号不在当前队列里"));f.splice(p,1);const h=Math.max(0,Math.min(f.length,Math.round(a)-1));return f.splice(h,0,d),await Ja().reorderAccounts?.(f),Nu(),{text:JSON.stringify({ok:!0,account:Hf(c),from:p+1,to:h+1}),summary:r("已移到第 {n} 顺位",{n:h+1})}}},PG={id:"set_account_enabled",label:r("启用 / 禁用账号"),kind:"write",desc:"开启或关闭某几个账号的转发资格。禁用只是把它移出队列(余额仍可查),但**如果某条线路只剩它**,禁用会直接断供。一次可以改多个。",params:{type:"object",properties:{items:{type:"array",description:"要改的账号列表",items:{type:"object",properties:{account:{type:"string",description:"账号名或账号 id"},enabled:{type:"boolean",description:"true = 启用,false = 禁用"}},required:["account","enabled"]}}},required:["items"]},plan:e=>{const t=ku(e.items),a=t.filter(o=>Ui(o.enabled)===!1).length;return{lead:r("将修改 {n} 个账号的启用状态(其中禁用 {k} 个):",{n:t.length,k:a}),table:{head:[r("账号"),r("改成")],rows:t.map(o=>[at(o.account),Ui(o.enabled)===!1?r("禁用"):r("启用")])},note:r("禁用会把账号移出转发队列;若这条线路没有别的可用账号,请求会直接失败。")}},run:async e=>{const t=Ja(),a=ku(e.items),o=await Sg(),c=[];for(const d of a){const f=Ui(d.enabled);if(f===void 0)throw new Error(r("参数不完整(需要 account / enabled)"));const p=Jj(o,at(d.account,128));await t.updateAccount?.(at(p.id),{enabled:f}),c.push(`${f?"启用":"禁用"} ${Hf(p)}`)}return Nu(),{text:JSON.stringify({ok:!0,changed:c}),summary:r("已修改 {n} 个账号",{n:c.length})}}},Ng=[TG,EG,AG,RG,OG,MG,DG,IG,PG];function tw(e){return Ng.find(t=>t.id===e)}function _G(e){return Ng.filter(t=>e[t.id]).map(t=>({type:"function",function:{name:t.id,description:t.desc,parameters:t.params}}))}r("获取模型列表"),r("读各提供商的模型清单、映射名与启用状态。"),r("查询账号余额"),r("读各账号的额度 / 剩余用量。"),r("启用 / 禁用模型"),r("开关模型的对外可用性,不改其它属性。"),r("设置模型映射 ID"),r("新增 / 删除映射名,支持批量加前缀与同名合并到多家。"),r("修改模型能力"),r("改上下文窗口 / 最大输出 Token / 工具调用等能力位。"),r("发起模型测试"),r("对指定模型发一次真实请求,回报连通性与耗时。"),r("调整提供商顺位"),r("改某一家的整组顺位(先试哪一家)。"),r("调整账号优先级"),r("改账号在全局队列里的名次,决定主备与切换顺序。"),r("启用 / 禁用账号"),r("禁用会把账号移出转发队列,线路可能因此断供。");const AO=12;function Uf(e,t){return window.wbIcons?.icon?.(e,t)||""}function LG(e){const t=window.wbMarkdown;return t?.render?t.render(e):e.replace(/[&<>]/g,a=>({"&":"&","<":"<",">":">"})[a]||a)}function zG({tone:e}){return e==="plain"?s.jsx("span",{className:"asst-tc-ico",dangerouslySetInnerHTML:{__html:Uf("spark",13)}}):s.jsx("span",{className:Ue("asst-tc-ico",e),children:e==="warn"?"!":"✕"})}function BG({item:e,onConfirm:t}){const a=tw(e.call.name),o=a?.label||e.call.name,c=Wj(e.call.arguments),d=Object.keys(c).length?JSON.stringify(c,null,2):"";return s.jsxs("div",{className:Ue("asst-tool-card",e.state==="confirm"&&"confirm",e.state==="confirm"&&a?.kind==="run"&&"danger",e.state==="failed"&&"failed",e.state==="running"&&"running"),children:[s.jsxs("div",{className:"asst-tc-head",children:[e.state==="running"?s.jsx("span",{className:"asst-tc-ico",children:s.jsx("span",{className:"spin"})}):s.jsx(zG,{tone:e.state==="failed"?"bad":e.state==="confirm"?"warn":"plain"}),s.jsx("span",{className:"asst-tc-name",children:o}),e.state==="confirm"&&s.jsx("span",{className:"badge tag warn",children:r("待确认")}),e.state==="done"&&s.jsxs("span",{className:"asst-tc-state",children:["✓ ",e.summary||r("完成")]}),e.state==="failed"&&s.jsx("span",{className:"asst-tc-state bad",children:r("失败")}),e.state==="cancelled"&&s.jsx("span",{className:"asst-tc-state plain",children:r("已取消")})]}),e.state==="confirm"&&e.plan&&s.jsxs("div",{className:"asst-tc-plan",children:[e.plan.lead,e.plan.table&&s.jsxs("table",{className:"asst-mini-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.plan.table.head.map((f,p)=>s.jsx("th",{children:f},p))})}),s.jsx("tbody",{children:e.plan.table.rows.slice(0,20).map((f,p)=>s.jsx("tr",{children:f.map((h,v)=>s.jsx("td",{className:v===f.length-1?"mono hl":"",children:h},v))},p))})]}),e.plan.table&&e.plan.table.rows.length>20&&s.jsx("div",{className:"hint",children:r("(仅显示前 20 条,共 {n} 条)",{n:e.plan.table.rows.length})}),e.plan.note&&s.jsx("div",{className:"hint",children:e.plan.note})]}),e.state==="failed"&&e.error&&s.jsx("div",{className:"asst-tc-error",children:e.error}),e.state==="done"&&e.detail&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看结果")}),s.jsx("pre",{className:"asst-tc-json",children:e.detail})]}),e.state!=="confirm"&&d&&s.jsxs("details",{children:[s.jsx("summary",{className:"asst-tc-result",style:{cursor:"pointer"},children:r("查看参数")}),s.jsx("pre",{className:"asst-tc-json",children:d})]}),e.state==="confirm"&&s.jsxs("div",{className:"asst-tc-foot",children:[s.jsx("span",{className:Ue("hint",a?.kind==="run"&&"danger"),children:a?.kind==="run"?r("这会真实发起上游请求并消耗额度"):r("确认后立即生效")}),s.jsx(se,{size:"sm",variant:a?.kind==="run"?"destructive":"default",onClick:()=>t(!0),children:r("执行")}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(!1),children:r("取消")})]})]})}function HG(){const[e,t]=x.useState(null),[a,o]=x.useState([]),[c,d]=x.useState([]),[f,p]=x.useState(!1),[h,v]=x.useState(!1),[y,b]=x.useState(""),[j,w]=x.useState(""),[k,S]=x.useState(!1),N=x.useRef([]),T=x.useRef([]),D=x.useRef(null),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useRef(0),P=x.useRef(null),O=x.useRef(0),_=x.useCallback(()=>{d(N.current.slice())},[]);x.useEffect(()=>{const M=A.current;if(!M)return;M.scrollHeight-M.scrollTop-M.clientHeight<160&&(M.scrollTop=M.scrollHeight)},[c]);const L=x.useCallback(async()=>{if(!R.current){R.current=!0;try{const M=await SG();t(M),S(!1),I.current=0}catch(M){S(!0),w(r("加载助手设置失败:{message}",{message:Cu(M)})),I.current<3&&(I.current+=1,R.current=!1,setTimeout(()=>{L()},4e3))}try{o(await wG())}catch(M){w(U=>U||r("读取模型清单失败:{message}",{message:Cu(M)}))}}},[]);x.useEffect(()=>{const M=window;return M.wbAssistant={activate:()=>{L()}},L(),()=>{delete M.wbAssistant}},[L]);const H=x.useMemo(()=>{const M={};for(const U of Ng)M[U.id]=e?.tools?.[U.id]??!1;return M},[e]),B=x.useMemo(()=>_G(H),[H]),z=Object.values(H).filter(Boolean).length,Q=e?.model??null,K=x.useCallback(async(M,U,Z)=>{for(let ae=U;ae{if(O.current>=AO){N.current.push({kind:"notice",text:r("这一轮来回已达 {n} 次上限,我先停下等你指示(可以换个说法,或拆成几步让我做)。",{n:AO}),bad:!0}),_();return}O.current+=1,p(!0),w("");const M=new AbortController;C.current=M;const U=N.current.push({kind:"bot",text:"",streaming:!0})-1;_();let Z=[],ae=!1;try{await CG({messages:T.current,tools:B,signal:M.signal,onEvent:ie=>{if(ie.type==="delta"){const ge=N.current[U];ge&&ge.kind==="bot"&&(N.current[U]={...ge,text:ge.text+ie.text},_())}ie.type==="toolCalls"&&(Z=ie.calls)}})}catch(ie){ae=!0;const ge=Cu(ie),ee=N.current[U],fe=ee&&ee.kind==="bot"?ee.text:"";fe?N.current[U]={kind:"bot",text:fe}:N.current.splice(U,1);const te=M.signal.aborted;N.current.push({kind:"notice",text:te?r("已停止这次回答。"):r("请求失败:{message}",{message:ge}),bad:!te}),_()}finally{C.current=null}if(ae){p(!1);return}const ce=N.current[U];ce&&ce.kind==="bot"&&(N.current[U]={...ce,streaming:!1});const J=ce&&ce.kind==="bot"?ce.text:"";if(T.current.push({role:"assistant",content:J,toolCalls:Z.length?Z:void 0}),_(),!Z.length){p(!1);return}await K(Z,0,[])},[B,K,_]);P.current=X;const q=x.useCallback(async M=>{const U=D.current;if(!U)return;D.current=null,v(!1);const Z=U.calls[U.index],ae=tw(Z.name),ce=Wj(Z.arguments);if(!M||!ae)N.current[U.cardIndex]={kind:"tool",call:Z,state:"cancelled"},U.collected.push({toolCallId:Z.id,content:"用户取消了这次操作,没有做任何改动。"}),_();else{N.current[U.cardIndex]={kind:"tool",call:Z,state:"running"},p(!0),_();try{const J=await ae.run(ce);N.current[U.cardIndex]={kind:"tool",call:Z,state:"done",summary:J.summary,detail:J.text},U.collected.push({toolCallId:Z.id,content:J.text})}catch(J){const ie=Cu(J);N.current[U.cardIndex]={kind:"tool",call:Z,state:"failed",error:ie},U.collected.push({toolCallId:Z.id,content:`工具执行失败:${ie}`})}_()}await K(U.calls,U.index+1,U.collected)},[K,_]),$=x.useCallback(async M=>{const U=M.trim();if(!(!U||f||h)){if(O.current=0,N.current.push({kind:"user",text:U}),T.current.push({role:"user",content:U}),b(""),_(),!e){N.current.push({kind:"notice",text:r("助手设置没读出来,现在还不能发消息 —— 看输入框下方的提示。"),bad:!0}),_();return}if(!e.model){N.current.push({kind:"notice",text:r("还没有选择对话模型:先在下方选一个(或去「设置 → AI 助手」里选)。"),bad:!0}),_();return}await X()}},[h,f,e,X,_]),Y=x.useCallback(()=>{C.current?.abort()},[]),F=x.useCallback(()=>{C.current?.abort(),D.current=null,N.current=[],T.current=[],v(!1),p(!1),w(""),_()},[_]),G=x.useCallback(async M=>{if(!M)return;if(!e){w(r("助手设置没读出来,暂时存不了对话模型 —— 看输入框下方的提示。"));return}const U={...e,model:M};t(U);try{await NG(U)}catch(Z){w(r("保存对话模型失败:{message}",{message:Cu(Z)}))}},[e]),W=f||h,le=x.useRef(null);return s.jsxs("div",{className:"asst-layout",children:[s.jsxs("div",{className:"asst-top",children:[s.jsxs(ft,{value:Q??"",onValueChange:M=>{G(String(M))},children:[s.jsx(mt,{className:"asst-model-pick","aria-label":r("对话模型"),children:s.jsx(pt,{children:Q?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:Ue("dot","ok")}),s.jsx("span",{className:"mono",children:Q})]}):r("选择模型…")})}),s.jsxs(ht,{children:[a.length===0&&s.jsx(qe,{value:"none",disabled:!0,children:r("没有可用的模型")}),a.map(M=>s.jsx(qe,{value:M,children:M},M))]})]}),s.jsx("span",{className:"asst-top-hint",children:r("助手走本地网关,消耗所选账号的额度")}),s.jsx("span",{className:"spacer"}),s.jsx(se,{variant:"ghost",size:"sm",onClick:F,disabled:f||h||!c.length,children:r("新对话")})]}),s.jsxs("div",{className:"asst-scroll",ref:A,children:[c.length===0&&s.jsxs("div",{className:"asst-empty",children:[s.jsx("div",{className:"empty-logo",dangerouslySetInnerHTML:{__html:Uf("spark",26)||""}}),s.jsx("h3",{children:r("AI 助手")}),s.jsxs("p",{children:[r("用一句话让我查或改本机的模型转发配置。"),s.jsx("br",{}),r("我会在动手前把改动列给你确认。")]}),s.jsx("div",{className:"asst-suggests",children:[r("看看哪些模型在多家重复了"),r("测一下当前最快的模型通不通"),r("CodeArts 的账号余额还剩多少?"),r("把重复的模型加上家名前缀区分开")].map(M=>s.jsxs("button",{type:"button",onClick:()=>{$(M)},children:["“",M,"”"]},M))}),e!==null&&z===0&&s.jsx("div",{className:"asst-empty-warn",children:r("当前一个工具都没勾选,助手只能纯聊天。去「设置 → AI 助手 → 工具」里勾上需要的工具。")}),k&&s.jsx("div",{className:"asst-empty-warn bad",children:j||r("助手设置读取失败,工具可能已过时。")})]}),c.map((M,U)=>M.kind==="user"?s.jsx("div",{className:"asst-msg user",children:s.jsx("div",{className:"bubble",children:M.text})},U):M.kind==="bot"?!M.text&&M.streaming?s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsx("div",{className:"body",children:s.jsx("span",{className:"spin"})})]},U):s.jsxs("div",{className:"asst-msg bot",children:[s.jsxs("div",{className:"who",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("spark",14)||""}})," ",r("助手")]}),s.jsxs("div",{className:"body",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:LG(M.text)}}),M.streaming&&s.jsx("span",{className:"asst-caret"})]})]},U):M.kind==="notice"?s.jsx("div",{className:"asst-msg bot",children:s.jsx("div",{className:Ue("asst-empty-warn",M.bad&&"bad"),style:{margin:0},children:M.text})},U):s.jsx(BG,{item:M,onConfirm:Z=>{q(Z)}},U))]}),s.jsxs("div",{className:"asst-composer",children:[s.jsxs("div",{className:"asst-ta-wrap",children:[s.jsx(Zc,{ref:le,rows:1,value:y,placeholder:r(W?"等这一轮跑完…":"直接说要改什么 / 查什么…(Enter 发送,Shift+Enter 换行)"),disabled:W,onChange:M=>{b(M.currentTarget.value);const U=M.currentTarget;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,132)}px`},onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing&&(M.preventDefault(),$(y))}}),f?s.jsx("button",{type:"button",className:"asst-send stop",title:r("停止"),onClick:Y,children:"■"}):s.jsx("button",{type:"button",className:"asst-send",title:r("发送"),disabled:W||!y.trim(),onClick:()=>{$(y)},children:"➤"})]}),s.jsxs("div",{className:"asst-composer-foot",children:[s.jsxs("span",{className:"tools-state",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Uf("settings",12)||""}}),r("已注入 {n} / {total} 个工具 · 系统提示词:{state}",{n:z,total:Ng.length,state:e?.systemPromptEnabled?r("开"):r("关")})]}),s.jsx("span",{className:"spacer"}),j?s.jsxs("span",{className:"hint",children:[j,k&&s.jsx("button",{type:"button",className:"asst-tc-more",onClick:()=>{L()},children:r("重试")})]}):Q?s.jsx("span",{className:"hint",children:r("回复由 {model} 生成 · 走本地网关",{model:Q})}):null]})]})]})}const RO='.page[data-page="assistant"]';let nw=null;function OO(){if(nw)return;const e=document.querySelector(RO);e&&(e.replaceChildren(),nw=vn.createRoot(e),nw.render(s.jsx(HG,{})))}document.querySelector(RO)?OO():document.addEventListener("DOMContentLoaded",OO,{once:!0}),Zj().catch(()=>{});function Pr(){return Pe().workbuddyDesktop??{}}function MO(){return window}const DO="workbuddy-desktop-checkin-tab",UG=["center","schedule","records"];function VG(){try{const e=localStorage.getItem(DO);return UG.includes(e)?e:"center"}catch{return"center"}}function IO(e){if(e!==gs.tab){try{localStorage.setItem(DO,e)}catch{}Js({tab:e})}}async function kg(e){IO(e),gs.loaded||await Ol()}let gs={version:0,tab:VG(),snapshot:null,loaded:!1,loadError:"",expanded:new Set,runningAll:!1,autoSaving:!1,autoTimeDraft:null,keepaliveSaving:!1,keepaliveDraft:null,signing:new Set,onboarding:new Map,growth:new Map};const sw=new Set;function FG(){for(const e of sw)e()}function Js(e){gs={...gs,...e,version:gs.version+1},FG()}function ur(){return gs}function PO(e){return sw.add(e),()=>sw.delete(e)}function $G(e){const t=typeof e?.key=="string"?e.key:"";return t?{key:t,title:typeof e.title=="string"&&e.title?e.title:t,group:typeof e.group=="string"&&e.group?e.group:"",points:Number(e.points)||0,done:e.done===!0,blocked:e.blocked===!0}:null}function rw(e){return(Array.isArray(e)?e:[]).map($G).filter(a=>a!==null)}function ds(e){return Number(e)||0}async function Ol(){try{const e=await Pr().getCheckinCenter?.();if(!e)throw new Error(r("后端未返回签到中心数据"));Js({snapshot:e,loaded:!0,loadError:"",autoTimeDraft:null,keepaliveDraft:null}),qG(e.extras?.onboarding??[])}catch(e){Js({loaded:!0,loadError:ut(e)})}}function qG(e){for(const t of e){const a=t.settled;if(!a||typeof a!="object")continue;const o=gs.onboarding.get(t.id);if(o?.status==="loaded"&&o.unclaimed>0)continue;const c=rw(a.tasks),d=ds(a.at);To(t.id,{status:"loaded",error:void 0,checkedAt:void 0,settled:!0,settledAt:d>0?d:void 0,tasks:c,unclaimed:0,earned:ds(a.earned),total:ds(a.total)})}}function _O(e){const t=new Set(gs.expanded);t.has(e)?t.delete(e):t.add(e),Js({expanded:t})}function aw(e){const t=`onb:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}function LO(e){return gs.expanded.has(`onb:${e}`)}async function GG(){if(!gs.runningAll){Js({runningAll:!0});try{const e=await Pr().runAutoCheckinNow?.();if(e){const t=ds(e.succeeded),a=ds(e.active),o=ds(e.total),c=ds(e.failedCount),d=a>0?r(",日活保活 {n} 个",{n:a}):"";c>0?_e(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:t,total:o,active:d,failed:c}),"err"):_e(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:t,total:o,active:d})),MO().wbAccountsView?.refreshUsageAfterCheckin?.(null)}}catch(e){_e(r("签到失败:{error}",{error:ut(e)}),"err")}finally{Js({runningAll:!1}),await Ol(),zO(ur().snapshot?.extras.onboarding??[]),Pe().wbApp?.refresh?.()}}}async function Cg(e,t="checkin"){const a=`${e}:${t}`;if(gs.signing.has(a))return;const o=new Set(gs.signing);o.add(a),Js({signing:o});try{let c;t==="checkin"?c=(await Pr().checkinAllAccounts?.(e))?.results?.[0]:c=await Pr().runCheckinActivity?.(e,t)??void 0;const d=c?.claim,f=c?.activity,p=f?.report?.succeeded===!0,h=f?.webConversation?.succeeded===!0;c?.error?_e(r("签到失败:{error}",{error:String(c.error)}),"err"):t==="keepalive"?f?.pokeSucceeded===!0||h||p?_e(r("✅ {message}",{message:d?.msg||r("活跃保活完成")})):_e(d?.msg||r("活跃保活失败"),"err"):d?.success===!0?_e(r("✅ {message}",{message:d.msg||r("签到成功")})):d?.alreadyCompleted===!0?_e(d?.msg||r("今日已领取"),"err"):p?_e(r("✅ {message}",{message:d?.msg||r("活跃上报完成,但活动未开启")})):f?.pokeSucceeded===!0||h?_e(r("✅ {message}",{message:d?.msg||r("活跃保活完成,但活动未开启")})):_e(d?.msg||r("未领取"),"err"),MO().wbAccountsView?.refreshUsageAfterCheckin?.(e)}catch(c){_e(r("签到失败:{error}",{error:ut(c)}),"err")}finally{const c=new Set(ur().signing);c.delete(a),Js({signing:c}),await Ol();const d=(ur().snapshot?.extras.onboarding??[]).filter(f=>f.id===e);zO(d),Pe().wbApp?.refresh?.()}}function Tg(e){Js({keepaliveDraft:e.map(t=>t.trim()).filter(Boolean)})}async function KG(e){const t=e.map(a=>a.trim()).filter(Boolean);if(!ur().keepaliveSaving){Js({keepaliveSaving:!0});try{const a=await Pr().saveCheckinKeepalive?.(t);if(a){const o=ur().snapshot;Js({snapshot:o&&{...o,keepalive:a},keepaliveDraft:null}),_e(r("已保存:保活模型链"))}}catch(a){_e(r("保存失败:{error}",{error:ut(a)}),"err")}finally{Js({keepaliveSaving:!1})}}}async function zO(e){for(const t of e)YG(t.id)||await lw(t.id);for(const t of e){const a=ur().onboarding.get(t.id);a?.status!=="loaded"||a.claiming||a.settled||(t.provider==="officeace"||a.unclaimed>0)&&await BO(t.id)}}function YG(e){return gs.onboarding.get(e)?.settled===!0}function Tu(e){return gs.onboarding.get(e)??{status:"idle",tasks:[],unclaimed:0,earned:0,total:0,claiming:!1}}function To(e,t){const a=new Map(gs.onboarding);a.set(e,{...Tu(e),...t}),Js({onboarding:a})}async function lw(e,t){const a=Tu(e);if(!(a.status==="loading"||a.claiming)){To(e,{status:"loading",error:void 0,settled:!1});try{const o=await Pr().getOnboardingTasks?.(e,t?.refresh===!0),c=rw(o?.tasks),d=o?.settled===!0;To(e,{status:"loaded",checkedAt:Date.now(),tasks:c,unclaimed:c.filter(f=>!f.done&&!f.blocked).length,earned:ds(o?.earned),total:ds(o?.total),settled:d,settledAt:d&&ds(o?.settledAt)||void 0}),t?.expand===!0&&c.length>0&&!LO(e)&&aw(e)}catch(o){To(e,{status:"error",error:ut(o),settled:!1})}}}async function BO(e){const t=Tu(e);if(!(t.claiming||t.status!=="loaded")){To(e,{claiming:!0});try{To(e,{tasks:Tu(e).tasks.map(b=>b.done?b:{...b,claiming:!0,error:void 0})});const a=await Pr().claimOnboardingTasks?.(e),o=new Map,c=Array.isArray(a?.results)?a.results:[];for(const b of c){const j=typeof b?.key=="string"?b.key:"";j&&b?.ok!==!0&&o.set(j,String(b?.error||r("领取失败")))}const d=rw(a?.tasks),f=(d.length?d:Tu(e).tasks).map(b=>({...b,claiming:!1,error:o.get(b.key)})),p=f.filter(b=>b.done&&!o.has(b.key)).length,h=a?.settled===!0;To(e,{claiming:!1,checkedAt:Date.now(),tasks:f,unclaimed:f.filter(b=>!b.done&&!b.blocked).length,earned:ds(a?.earned),total:ds(a?.total),settled:h,settledAt:h&&ds(a?.settledAt)||void 0});const v=f.filter(b=>b.error&&!b.done).length,y=typeof a?.message=="string"?a.message.trim():"";v?_e(r("新手福利有 {n} 项领取失败,可重试",{n:v}),"err"):y?_e(y,"ok"):p&&_e(r("✅ 新手福利领取完成,累计 {n} 积分",{n:ds(a?.earned)}))}catch(a){const o=ut(a);To(e,{claiming:!1,tasks:Tu(e).tasks.map(c=>({...c,claiming:!1,error:c.done?void 0:o}))}),_e(r("领取失败:{error}",{error:o}),"err")}finally{await Ol()}}}function HO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,title:typeof o.title=="string"&&o.title?o.title:c,description:typeof o.description=="string"?o.description:"",status:typeof o.status=="string"?o.status:"",current:ds(o.current),target:ds(o.target),locked:o.locked===!0,unlockAt:o.unlockAt,supported:o.supported===!0,unforgeable:o.unforgeable===!0,unforgeableReason:typeof o.unforgeableReason=="string"?o.unforgeableReason:"",kind:typeof o.kind=="string"?o.kind:"",source:typeof o.source=="string"?o.source:""}:null}).filter(a=>a!==null)}function UO(e){return(Array.isArray(e)?e:[]).map(a=>{const o=a??{},c=typeof o.code=="string"?o.code:"";return c?{code:c,outcome:typeof o.outcome=="string"?o.outcome:"failed",message:typeof o.message=="string"?o.message:"",credit:ds(o.credit),energy:ds(o.energy)}:null}).filter(a=>a!==null)}function Vi(e){return gs.growth.get(e)??{status:"idle",energy:null,streak:null,tasks:[],travel:null,school:null,running:!1,runningSchool:!1,runningTravel:!1}}function _r(e,t){const a=new Map(gs.growth);a.set(e,{...Vi(e),...t}),Js({growth:a})}function XG(e){return gs.expanded.has(`growth:${e}`)}function VO(e){const t=`growth:${e}`,a=new Set(gs.expanded);a.has(t)?a.delete(t):a.add(t),Js({expanded:a})}async function Eg(e){const t=Vi(e);if(!(t.status==="loading"||t.running)){_r(e,{status:"loading",error:void 0});try{const a=await Pr().getGrowthStatus?.(e),o=a?.tasks??{},c=a?.travel??null,d=a?.school??null;_r(e,{status:"loaded",checkedAt:Date.now(),energy:a?.energy===null||a?.energy===void 0?null:ds(a.energy),streak:a?.streak===null||a?.streak===void 0?null:ds(a.streak),tasks:HO(o.tasks),travel:c,school:d?{...d,tasks:HO(d.tasks)}:null,error:typeof o.error=="string"?o.error:void 0})}catch(a){_r(e,{status:"error",error:ut(a)})}}}async function FO(e,t){const a=Vi(e);if(a.running)return;const o=(a.tasks??[]).filter(h=>!h.supported||h.unforgeable===!0||h.locked===!0?!1:t==="claim"?h.status==="completed"||h.current>=h.target&&h.status!=="claimed":h.status!=="claimed");if(o.length===0){_e(r("没有需要执行的任务"));return}_r(e,{running:!0,results:[],error:void 0});let c=0,d=0,f=0,p=0;for(const h of o)try{const v=await Pr().runGrowthTask?.(e,h.code,t),y=UO([v])[0];y&&(_r(e,{results:[...Vi(e).results??[],y]}),c+=y.credit??0,d+=y.energy??0,(y.outcome==="done"||y.outcome==="already")&&(f+=1),y.outcome==="failed"&&(p+=1))}catch(v){p+=1,_r(e,{results:[...Vi(e).results??[],{code:h.code,outcome:"failed",message:ut(v),credit:0,energy:0}]})}_r(e,{running:!1}),p>0?_e(r("成长任务完成({done} 项成功、{failed} 项失败),积分 +{credit} 能量 +{energy}",{done:f,failed:p,credit:c,energy:d}),"err"):_e(r("✅ 成长任务执行完成:积分 +{credit} 能量 +{energy}",{credit:c,energy:d})),await Eg(e)}async function QG(e,t){if(!Vi(e).runningSchool){_r(e,{runningSchool:!0,error:void 0});try{const o=await Pr().runGrowthSchool?.(e,t),c=UO(o?.results),d=o?.lottery??null;_r(e,{runningSchool:!1,results:c,schoolText:c.length?c.map(f=>`${f.code}:${f.message}`).join(";"):void 0,lotteryText:d?String(d.message??r("已抽 {n} 次",{n:ds(d.drawn)})):void 0,checkedAt:Date.now()}),_e(d?r("开学季执行完成:{message}",{message:String(d.message??"")}):r("✅ 开学季任务执行完成")),await Eg(e)}catch(o){_r(e,{runningSchool:!1,error:ut(o)}),_e(r("开学季执行失败:{error}",{error:ut(o)}),"err")}}}async function ZG(e){if(!Vi(e).runningTravel){_r(e,{runningTravel:!0,error:void 0});try{const a=await Pr().runGrowthTravel?.(e),o=String(a?.message??""),c=String(a?.outcome??"");_r(e,{runningTravel:!1,checkedAt:Date.now()}),c==="failed"?_e(r("猫猫旅行失败:{message}",{message:o}),"err"):_e(r("猫猫旅行:{message}",{message:o})),await Eg(e)}catch(a){_r(e,{runningTravel:!1,error:ut(a)}),_e(r("猫猫旅行失败:{error}",{error:ut(a)}),"err")}}}function WG(e){return e.totalCount?e.doneCount>=e.totalCount?"done":e.doneCount>0?"part":"todo":"none"}function JG(e){const a=(Array.isArray(e?.schedules)?e.schedules:[]).filter(o=>o.enabled===!0).map(o=>Number(o.nextRunAt)).filter(o=>Number.isFinite(o)&&o>0);return a.length?Math.min(...a):null}let Ml={version:0,data:null,loaded:!1,loadError:"",saving:!1,runningId:null,editingId:null};const ow=new Set;function e9(){for(const e of ow)e()}function dr(e){Ml={...Ml,...e,version:Ml.version+1},e9()}function $O(){return Ml}function t9(e){return ow.add(e),()=>ow.delete(e)}function Fi(){return Pe().workbuddyDesktop??{}}async function qO(){try{const e=await Fi().getCheckinSchedules?.();if(!e)throw new Error(r("后端未返回定时签到数据"));dr({data:e,loaded:!0,loadError:""})}catch(e){dr({loaded:!0,loadError:ut(e)})}}function Vf(e){e&&dr({data:e,loadError:""}),Ol()}async function n9(e){if(!Ml.saving){dr({saving:!0});try{const t=await Fi().saveAutoCheckin?.({enabled:e});Vf(t),_e(r(e?"✅ 定时签到已开启":"定时签到已关闭"))}catch(t){_e(r("保存失败:{error}",{error:ut(t)}),"err")}finally{dr({saving:!1})}}}async function GO(e){if(!Ml.saving){dr({saving:!0});try{const t=await Fi().saveCheckinSchedule?.(e);Vf(t),dr({editingId:null}),_e(r("已保存:定时条目"))}catch(t){_e(r("保存失败:{error}",{error:ut(t)}),"err")}finally{dr({saving:!1})}}}async function s9(e,t){await GO({id:e.id,label:e.label??"",enabled:t,time:e.time??"",jitterMinutes:Number(e.jitterMinutes)||0,providers:Array.isArray(e.providers)?e.providers:[]})}async function r9(e){if(!Ml.saving){dr({saving:!0});try{const t=await Fi().saveAutoCheckin?.({startupCatchUp:e});Vf(t),_e(r(e?"启动补签已开启":"启动补签已关闭"))}catch(t){_e(r("保存失败:{error}",{error:ut(t)}),"err")}finally{dr({saving:!1})}}}async function a9(e){if(!Ml.saving){dr({saving:!0});try{await Fi().deleteCheckinSchedule?.(e),Vf(await Fi().getCheckinSchedules?.()),_e(r("已删除定时条目"))}catch(t){_e(r("删除失败:{error}",{error:ut(t)}),"err")}finally{dr({saving:!1})}}}async function l9(e){if(!Ml.runningId){dr({runningId:e});try{const t=await Fi().runCheckinSchedule?.(e)??void 0,a=o=>Number(o)||0;if(t){const o=a(t.succeeded),c=a(t.active),d=a(t.total),f=a(t.failedCount),p=c>0?r(",日活保活 {n} 个",{n:c}):"";f>0?_e(r("签到完成:{succeeded}/{total} 成功{active},{failed} 个失败",{succeeded:o,total:d,active:p,failed:f}),"err"):_e(r("✅ 签到完成:{succeeded}/{total} 个账号成功领取{active}",{succeeded:o,total:d,active:p})),Vf(t)}}catch(t){_e(r("执行失败:{error}",{error:ut(t)}),"err")}finally{dr({runningId:null}),await Ol()}}}function iw(e){dr({editingId:e})}const o9=r("到点后自动签到勾选提供商的可用账号(WorkBuddy 国内版走每日签到接口,国际版走每日活跃任务:探测活动、领日活奖励、再用免费模型保活并在网页通道建会话点亮日活;小浣熊走桌面端每日积分链路;AutoClaw 走官方客户端的每日签到任务;Qoder 中国版走活动领取,没被下发活动的账号会得到中性提示;Qoder 国际版要先带设备风控身份(本机 Qoder 客户端 / qodercli 的 UMID 组件生成)才能看到「每日 100 Credits」活动,缺组件时会得到明确的说明而不是报错;Trae 领 SOLO 的每日签到积分(按自然日 0 点重置),上游没对该账号开活动、或凭据里没有设备号时得到的是「未领取 + 具体原因」而不是报错;Loomy 每天替账号打一次首次登录积分;KukuAI 领「免费领积分」的每日任务;CodeArts 领当日的运营福利(领取 → 确认 → 回读核实,自动执行受每天 6 次 / 间隔 10 分钟的写请求限流);OfficeAce 果办一次领当天全部奖励(每日签到 + 新人礼))。设了「随机前后 N 分钟」时,本轮账号在各自窗口内分散执行(窗口夹在当天 0 点到 23:59 之间),不再全部挤在同一分钟;窗口已过则立即全部执行。错过时点开机后会自动补签,不会因为当时没开机而漏掉(可在「启动补签」关掉,改为等到窗口起点)。各家签到接口都是幂等的,重复执行不会重复领取。");function i9(){const[e,t]=x.useState($O());return x.useEffect(()=>t9(()=>t($O())),[]),e}function c9(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function KO(e,t){const a=Array.isArray(e.providers)?e.providers:[];return t.filter(o=>a.includes(o.id)).map(o=>o.label)}function YO(e,t){const a=KO(e,t);return a.length?t.length>0&&a.length>=t.length?r("全部 {n} 家",{n:t.length}):a.join(r("、")):r("未勾选提供商")}function u9(e,t){const a=KO(e,t);return a.length?a.join(r("、")):r("未勾选提供商")}function d9(e){const t=e.lastResult;if(!t)return r("还没执行过");const a=f=>Number(f)||0,o=[r("成功 {n}",{n:a(t.succeeded)})],c=a(t.active);c>0&&o.push(r("保活 {n}",{n:c}));const d=a(t.failedCount);return d>0&&o.push(r("失败 {n}",{n:d})),`${t.at?Fs(t.at):"—"}${t.reason?` · ${t.reason}`:""} —— ${o.join(r(" · "))}`}function XO({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=e===null,[c,d]=x.useState(e?.label??""),[f,p]=x.useState(e?.time??"00:01"),[h,v]=x.useState(String(e?.jitterMinutes??0)),[y,b]=x.useState(new Set(o?a.map(C=>C.id):e?.providers??[]));x.useEffect(()=>{o&&a.length>0&&b(new Set(a.map(C=>C.id)))},[]);const j=h.trim(),w=j===""?0:Number(j),k=(j===""||/^\d+$/.test(j))&&Number.isInteger(w)&&w>=0&&w<=120,S=f.trim()!==""&&y.size>0&&k,N=()=>b(new Set(a.map(C=>C.id))),T=()=>b(new Set),D=async()=>{S&&await GO({id:e?.id,label:c.trim(),enabled:e?.enabled??!0,time:f.trim(),jitterMinutes:w,providers:a.map(C=>C.id).filter(C=>y.has(C))})};return s.jsxs("div",{className:"ck-sched-editor",children:[s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("名称")}),s.jsx("span",{className:"ck-set-v",children:s.jsx(Fe,{type:"text",className:"max-w-[220px]",placeholder:r("可选 · 缺省显示时刻"),value:c,disabled:t.saving,onChange:C=>d(C.currentTarget.value)})})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("每天时刻")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(Fe,{type:"time",className:"w-[96px] max-w-[96px] font-mono tabular-nums",value:f,disabled:t.saving,onChange:C=>p(C.currentTarget.value)}),s.jsx("span",{className:"text-subtle text-xs",children:r("北京时间 · 错过时点开机后会自动补签")})]})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("随机前后")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(Fe,{type:"number",min:0,max:120,step:1,inputMode:"numeric",className:"w-[96px] max-w-[96px] text-center font-mono tabular-nums",value:h,disabled:t.saving,onChange:C=>v(C.currentTarget.value)}),s.jsx("span",{className:"text-subtle text-xs",children:r("分钟 · 窗口内逐个账号随机执行,0 = 到点立即执行")})]})]}),s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("签到范围")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("到点时逐个签到,已勾 {n} / {total} 家",{n:y.size,total:a.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving,onClick:N,children:r("全选")}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:t.saving||y.size===0,onClick:T,children:r("清空")})]}),s.jsx("div",{className:"ck-range",children:a.map(C=>s.jsxs("label",{className:"ck-range-item",children:[s.jsx(Dr,{checked:y.has(C.id),disabled:t.saving,onCheckedChange:A=>{const R=new Set(y);A===!0?R.add(C.id):R.delete(C.id),b(R)}}),s.jsx("span",{className:"ck-range-name",title:C.label,children:C.label})]},C.id))}),y.size===0?s.jsx("div",{className:"ck-mini-warn",children:r("至少勾一家才能保存(不勾等于这条条目不签到)")}):null]})]}),s.jsxs("div",{className:"ck-sched-actions",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.saving,onClick:()=>iw(null),children:r("取消")}),s.jsx(se,{size:"sm",variant:"default",disabled:!S||t.saving,onClick:()=>{D()},children:t.saving?r("保存中…"):r("保存")})]})]})}function f9({store:e}){return s.jsxs("div",{className:"ck-sched-row open ck-sched-row-new",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx("span",{className:"ck-new-dot","aria-hidden":!0,children:"+"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:r("新建定时条目")}),s.jsx("div",{className:"ck-prov-desc",children:r("填好时刻与签到范围后点「保存」;名称可以留空(界面显示时刻)")})]})]}),s.jsx(XO,{entry:null,store:e})]})}function p9({entry:e,store:t}){const a=Array.isArray(t.data?.providerOptions)?t.data.providerOptions:[],o=t.editingId===e.id,c=t.runningId===e.id,d=t.data?.enabled===!0,f=Number(e.nextRunAt),p=async()=>{const h=Pe().wbConfirm?.ask;if(!h)return;const y=(e.displayLabel||e.time||e.id).replace(/&/g,"&").replace(//g,">");await h({title:r("删除定时条目"),html:r("确定删除「{name}」?删除后到点不再执行。",{name:y}),okText:r("删除"),okClass:"danger"})&&await a9(e.id)};return s.jsxs("div",{className:o?"ck-sched-row open":"ck-sched-row",children:[s.jsxs("div",{className:"ck-sched-main",children:[s.jsx(us,{checked:e.enabled===!0,disabled:t.saving,onCheckedChange:h=>{s9(e,h===!0)}}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.displayLabel||e.time||e.id,e.enabled===!0?null:s.jsx(ze,{variant:"outline",shape:"tag",children:r("已停用")})]}),s.jsx("div",{className:"ck-prov-desc ck-sched-scope",title:u9(e,a),children:Number(e.jitterMinutes)>0?r("每天 {time} · 随机前后 {n} 分钟 · {scope}",{time:e.time??"—",n:Number(e.jitterMinutes),scope:YO(e,a)}):r("每天 {time} · {scope}",{time:e.time??"—",scope:YO(e,a)})}),s.jsx("div",{className:"ck-prov-desc",children:r("上次执行:{line}",{line:d9(e)})})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-sched-next",children:d&&e.enabled===!0&&Number.isFinite(f)&&f>0?r("下次 {date}",{date:Fs(f)}):"—"}),s.jsx(se,{size:"sm",variant:"ghost",disabled:c||t.runningId!==null,onClick:()=>{l9(e.id)},children:r(c?"执行中…":"立即执行")}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>iw(o?null:e.id),children:r(o?"收起":"编辑")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",disabled:t.saving,onClick:()=>{p()},children:r("删除")})]})]}),o?s.jsx(XO,{entry:e,store:t}):null]})}function m9(e,t){return e.length===t.length&&e.every((a,o)=>a===t[o])}let Ff=null;function h9(e,t){for(let a=0;ah!==t.row),d=h9(c,e.clientY);if(d===t.from)return;const f=[...t.list],[p]=f.splice(t.from,1);f.splice(d,0,p),t.list=f,t.from=d,t.onChange(f)}function $f(){const e=Ff;Ff=null,window.removeEventListener("pointermove",QO),window.removeEventListener("pointerup",$f),window.removeEventListener("pointercancel",$f),document.body.classList.remove("ck-chain-dragging"),e?.row.classList.remove("dragging")}function g9(e,t,a,o){if(e.button!==0||Ff||a.length<2)return;const c=e.currentTarget.closest(".ck-chain-row");c&&(e.preventDefault(),Ff={list:[...a],from:t,row:c,onChange:o},c.classList.add("dragging"),document.body.classList.add("ck-chain-dragging"),window.addEventListener("pointermove",QO),window.addEventListener("pointerup",$f),window.addEventListener("pointercancel",$f))}function x9({models:e,defaultModels:t,dirty:a,saving:o}){const[c,d]=x.useState(""),f=()=>{const p=c.trim();if(p){if(e.includes(p)){_e(r("清单里已经有「{name}」",{name:p}),"err");return}Tg([...e,p]),d("")}};return s.jsxs("section",{className:"panel ck-chain-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("保活模型链")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国际版日活任务的免费模型 · 全局一份,与条目无关")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:!a||o,onClick:()=>{KG(e)},children:r(o?"保存中…":"保存")})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"ck-set-line ck-set-line-top",children:[s.jsx("span",{className:"ck-set-k",children:r("模型清单")}),s.jsxs("span",{className:"ck-set-v",children:[s.jsxs("div",{className:"ck-mini-row",children:[s.jsx("span",{className:"ck-mini-note",children:r("按序逐个尝试,共 {n} 个",{n:e.length})}),s.jsx("button",{type:"button",className:"ck-mini-btn",disabled:o||t.length===0,title:r("把缺省链填进清单,再点「保存」生效"),onClick:()=>Tg([...t]),children:r("填入缺省链")})]}),s.jsxs("div",{className:"ck-chain",children:[e.map((p,h)=>s.jsxs("div",{className:"ck-chain-row",children:[s.jsx("span",{className:"ck-chain-grip",role:"button",tabIndex:-1,"aria-label":r("按住拖动调整顺序"),title:r("按住拖动,调整这个模型在链里的顺序"),onPointerDown:v=>g9(v,h,e,Tg),dangerouslySetInnerHTML:{__html:Pe().wbIcons?.icon?.("gripVertical",14)||""}}),s.jsx("span",{className:"ck-chain-name",title:p,children:p}),s.jsxs("span",{className:"ck-chain-index",children:["#",h+1]}),s.jsx("button",{type:"button",className:"ck-chain-del",disabled:o,"aria-label":r("移除 {name}",{name:p}),title:r("从清单里移除"),onClick:()=>Tg(e.filter((v,y)=>y!==h)),children:"×"})]},p)),e.length===0?s.jsx("div",{className:"ck-chain-empty",children:r("清单为空 —— 保存后恢复缺省链")}):null]}),s.jsxs("div",{className:"ck-chain-add",children:[s.jsx(Fe,{type:"text",className:"max-w-[260px] font-mono text-xs",placeholder:r("WorkBuddy 国际版保活模型,按顺序回退"),value:c,disabled:o,onChange:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}}),s.jsx(se,{size:"sm",variant:"outline",disabled:o||c.trim()==="",onClick:f,children:r("添加模型")}),a?s.jsx("span",{className:"ck-chain-dirty",children:r("有未保存的改动")}):null]})]})]}),s.jsx("div",{className:"ck-note",children:r("「保活模型链」是 WorkBuddy 国际版领日活时用来保活的免费模型,按顺序逐个尝试、 第一个成功即止;清空清单并保存 = 恢复缺省链(当前缺省:{defaults})。 当天去重 + 幂等领取:重复执行只会拿到「已领取」,不会重复加分。",{defaults:t.join(r("、"))})})]})]})}function b9(){const e=i9(),t=c9();if(x.useEffect(()=>{qO()},[]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取定时签到数据…")})]});const a=e.data,o=a?.enabled===!0,c=a?.startupCatchUp!==!1,d=Array.isArray(a?.schedules)?a.schedules:[],f=t.snapshot?.keepalive,p=Array.isArray(f?.models)?f.models:[],h=Array.isArray(f?.defaultModels)?f.defaultModels:[],v=t.keepaliveDraft,y=v??p,b=v!==null&&!m9(v,p);return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取定时签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{qO()},children:r("重试")})]}):null,s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("定时签到")}),s.jsx("span",{className:"tip-q","data-tip":o9}),s.jsx("span",{className:"panel-sub",children:r("每条条目各有时刻与范围 · 各自当天去重 · 错过时点开机自动补签")}),s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto flex-none",disabled:e.saving,onClick:()=>iw(e.editingId==="new"?null:"new"),children:e.editingId==="new"?r("收起新建"):r("添加条目")})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("总开关")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(us,{checked:o,disabled:e.saving,onCheckedChange:j=>{n9(j===!0)}}),s.jsx("span",{className:"text-subtle text-xs",children:r(o?"开着:启用的条目按各自时刻执行":"关着:所有条目都不执行")})]})]}),s.jsxs("div",{className:"ck-set-line",children:[s.jsx("span",{className:"ck-set-k",children:r("启动补签")}),s.jsxs("span",{className:"ck-set-v flex items-center gap-2",children:[s.jsx(us,{checked:c,disabled:e.saving,onCheckedChange:j=>{r9(j===!0)}}),s.jsx("span",{className:"text-subtle text-xs",children:r(c?"开着:开机后今天没签过的条目立刻补签,不看随机窗口":"关着:开机后等到窗口起点再签,随机窗口当天生效")})]})]})]}),s.jsxs("div",{children:[e.editingId==="new"?s.jsx(f9,{store:e}):null,d.map(j=>s.jsx(p9,{entry:j,store:e},j.id)),d.length===0?s.jsx("div",{className:"ck-empty",children:r("还没有定时条目 —— 点「添加条目」建一条,或到「签到中心」手动签到。")}):null]})]}),s.jsx(x9,{models:y,defaultModels:h,dirty:b,saving:t.keepaliveSaving})]})}const Ag="checkin-records",ZO=["today","7","30","month","all"],Eu="all",v9=[{value:"today",label:r("今天")},{value:"7",label:r("7 天")},{value:"30",label:r("30 天")},{value:"month",label:r("本月")},{value:"all",label:r("全部")}],WO="workbuddy-desktop-checkin-records-range";function Rg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function JO(e){const t=new Date;switch(e){case"today":return Rg(t);case"7":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Rg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Rg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function y9(){try{const e=localStorage.getItem(WO);return e!==null&&ZO.includes(e)?e:Eu}catch{return Eu}}function eM(e){try{localStorage.setItem(WO,e)}catch{}}function tM(e){return typeof e=="number"&&e>0?e:fu}const cw={success:{label:"成功领取",variant:"success"},already:{label:"今日已领",variant:"brand"},pending:{label:"等待窗口",variant:"warning"},failed:{label:"失败",variant:"destructive"}},j9={schedule:"定时",startup:"补签",manual:"手动",single:"单签",activity:"活动"},uw=[{key:"time",label:r("时间")},{key:"account",label:r("账号")},{key:"provider",label:r("提供商")},{key:"source",label:r("来源")},{key:"outcome",label:r("结果")},{key:"detail",label:r("说明")}];let dw=null;function nM(){return dw?dw.apply([...uw]):uw.map(e=>({...e,align:e.align??"left"}))}function sM(){window.wbTableColumns?.repaint?.(Ag)}function rM(e){return(ur().snapshot?.auto?.providerOptions??[]).find(a=>a.id===e)?.label??e}function w9(e,t){const a=`ck-col-${t.key} ta-${t.align}`;switch(t.key){case"time":return s.jsxs("td",{className:a,children:[e.ts?Fs(e.ts):"—",s.jsx("span",{className:"ck-record-date",children:e.date||""})]},t.key);case"account":return s.jsx("td",{className:a,children:e.accountName||e.accountId||"—"},t.key);case"provider":return s.jsx("td",{className:a,children:e.provider?rM(e.provider):"—"},t.key);case"source":return s.jsxs("td",{className:a,children:[s.jsx("span",{className:"ck-record-source",children:j9[e.source??""]??e.source??"—"}),e.reason?s.jsx("span",{className:"ck-record-reason",children:e.reason}):null]},t.key);case"outcome":{const o=cw[e.outcome??""]??{label:e.outcome||"—",variant:"outline"};return s.jsxs("td",{className:a,children:[s.jsx(ze,{variant:o.variant,shape:"tag",children:o.label}),e.keptActive?s.jsx(ze,{variant:"outline",shape:"tag",className:"ml-1",children:r("保活")}):null]},t.key)}case"detail":return s.jsx("td",{className:e.error?`${a} ck-record-detail-fail`:a,children:e.error||e.message||"—"},t.key);default:return null}}function S9(){const[e,t]=x.useState([]),[a,o]=x.useState(0),[c,d]=x.useState(1),[f,p]=x.useState(()=>y9()),[h,v]=x.useState(()=>tM(og(Ag,ag))),[y,b]=x.useState({outcome:"",provider:"",keyword:""}),[j,w]=x.useState(""),[k,S]=x.useState(!1),[N,T]=x.useState(""),[D,C]=x.useState(0),A=x.useRef(null),R=x.useRef(0),[,I]=x.useReducer(Y=>Y+1,0),P=ur().snapshot?.auto?.providerOptions??[],O=nM(),_=Math.max(1,Math.ceil(a/h)),L=Math.min(c,_),H=y.outcome!==""||y.provider!==""||y.keyword!==""||f!==Eu,B=a?{start:(L-1)*h+1,end:Math.min(a,L*h)}:null,z=x.useCallback(async Y=>{const F=R.current+1;R.current=F,S(!0),T("");try{const W=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:Y.size,offset:(Y.page-1)*Y.size,outcome:Y.filters.outcome,provider:Y.filters.provider,keyword:Y.filters.keyword,start:JO(Y.range)});if(F!==R.current)return;t(Array.isArray(W?.records)?W.records:[]),o(Number(W?.total)||0)}catch(G){if(F!==R.current)return;T(G instanceof Error?G.message:String(G))}finally{F===R.current&&S(!1)}},[]);x.useEffect(()=>{z({page:c,size:h,range:f,filters:y})},[z,c,h,f,y]),x.useEffect(()=>{c>_&&d(_)},[c,_]),x.useLayoutEffect(()=>{const Y=Pe().wbColSettings;if(!Y?.register){const F=window.setTimeout(()=>C(G=>G+1),50);return()=>window.clearTimeout(F)}dw=Y.register({id:Ag,label:r("签到记录表"),columns:uw.map(F=>({key:F.key,label:F.label,align:F.align??"left"})),mount:()=>A.current,onChange:()=>{Cs.flushSync(()=>I()),sM()}}),I()},[D]),x.useLayoutEffect(()=>{sM()}),x.useEffect(()=>()=>{Pe().wbColSettings?.close()},[]);const Q=Y=>{b(Y),d(1)},K=Y=>{const F=ZO.includes(Y)?Y:Eu;F!==f&&(eM(F),p(F),d(1))},X=Y=>{v(tM(Y)),ig(Ag,Y),d(1)},q=()=>{w(""),eM(Eu),p(Eu),Q({outcome:"",provider:"",keyword:""})},$=async()=>{const Y=Pe().wbConfirm?.ask;if(!Y)return;const F=r(H?"确定清空当前筛选出的签到记录?清空后无法恢复。":"确定清空全部签到记录?清空后无法恢复。");if(await Y({title:r("清空签到记录"),html:F,okText:r("清空"),okClass:"danger"}))try{await Pe().workbuddyDesktop?.clearCheckinRecords?.(H?{outcome:y.outcome,provider:y.provider,keyword:y.keyword,start:JO(f)}:{all:"1"}),aM("签到记录已清空"),await z({page:1,size:h,range:f,filters:y}),d(1)}catch(G){aM(r("清空失败:{error}",{error:G instanceof Error?G.message:String(G)}),"err")}};return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("签到记录")}),s.jsx("span",{className:"panel-sub",children:r("每执行一次签到 · 每个账号一条明细 · 结果与收益以后端落账为准")}),s.jsxs("div",{ref:A,className:"ml-auto flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:k,onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r(k?"刷新中…":"刷新")}),s.jsx(se,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{$()},children:r("清空")})]})]}),s.jsxs("div",{className:"ck-records-filters",children:[s.jsx(In,{options:v9,value:f,onValueChange:K,"aria-label":r("签到记录时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:y.outcome,onValueChange:Y=>Q({...y,outcome:Y??""}),children:[s.jsx(mt,{className:"w-[128px] shrink-0","aria-label":r("按结果筛选"),children:s.jsx(pt,{children:y.outcome?cw[y.outcome]?.label??y.outcome:r("全部结果")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部结果")}),Object.entries(cw).map(([Y,F])=>s.jsx(qe,{value:Y,children:F.label},Y))]})]}),s.jsxs(ft,{value:y.provider,onValueChange:Y=>Q({...y,provider:Y??""}),children:[s.jsx(mt,{className:"w-[148px] shrink-0","aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:y.provider?rM(y.provider):r("全部提供商")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("全部提供商")}),P.map(Y=>s.jsx(qe,{value:Y.id,children:Y.label},Y.id))]})]}),s.jsx("div",{className:"spacer"}),s.jsx(Fe,{type:"search",className:"ck-records-search w-[200px] basis-[200px] min-w-[150px] grow-0 shrink",placeholder:r("搜账号 / 收益 / 错误 / 触发原因"),value:j,onChange:Y=>w(Y.currentTarget.value),onBlur:()=>{j!==y.keyword&&Q({...y,keyword:j.trim()})},onKeyDown:Y=>{Y.key==="Enter"&&Y.currentTarget.blur(),Y.key==="Escape"&&(w(y.keyword),Y.currentTarget.blur())}}),H?s.jsx(se,{size:"sm",variant:"ghost",onClick:q,children:r("清除筛选")}):null,s.jsx("span",{className:"panel-sub",children:k?r("读取中…"):r("{n} 条",{n:a})})]}),N?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到记录失败:{error}",{error:N})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{z({page:c,size:h,range:f,filters:y})},children:r("重试")})]}):null,e.length===0&&!k?s.jsx("div",{className:"ck-empty",children:r(H?"没有符合筛选条件的签到记录":"还没有签到记录 —— 手动签到或等定时条目执行后,明细会出现在这里。")}):s.jsx("div",{className:"ck-records-scroll",children:s.jsxs("table",{className:"ck-table ck-records-table",children:[s.jsx("colgroup",{children:O.map(Y=>s.jsx("col",{"data-col":Y.key,className:`ck-col-${Y.key}`},Y.key))}),s.jsx("thead",{children:s.jsx("tr",{children:O.map(Y=>s.jsx("th",{"data-col":Y.key,className:`ck-col-${Y.key} ta-${Y.align}`,children:Y.label},Y.key))})}),s.jsx("tbody",{children:e.map(Y=>s.jsx("tr",{children:O.map(F=>w9(Y,F))},Y.rowId))})]})}),s.jsx(Li,{total:a,range:B,page:L,pageCount:_,size:h,sizes:ag,onSizeChange:X,onPageChange:d,disabled:k})]})}function aM(e,t){Pe().wbApp?.toast?.(e,t)}window.wbCheckinRecords={visibleColumns:()=>nM().map(e=>({key:e.key}))};const lM={workbuddy:r("腾讯每日签到接口 · 仅国内版"),"workbuddy-intl":r("每日活跃任务 · 网页会话保活点亮日活,领取才加积分 · 两者可分开执行"),raccoon:r("桌面端每日积分链路"),autoclaw:r("官方客户端的每日签到任务"),"autoclaw-intl":r("与国内版同一套任务接口 · 站点不同"),qoder:r("活动(campaign)领取 · 每天 10:00 刷新"),"qoder-intl":r("带设备风控身份领取「每日 100 Credits」 · 需要 UMID 组件"),trae:r("SOLO 的 checkin_credits 领取 · 按自然日 0 点刷新"),loomy:r("无独立签到接口 · 每天替账号打一次首次登录积分"),kuku:r("「免费领积分」的每日任务 · 逐个领取"),officeace:r("一次领当天全部奖励(每日签到 + 新人礼) · 幂等由上游保证"),codearts:r("每日福利 · 领取 → 确认 → 回读核实 · 按北京时间自然日重置"),modelscope:r("无独立签到接口 · 每天替账号打一次登录信息(即当日魔粒)"),"modelscope-intl":r("与国内版同一套链路 · 站点不同、令牌不通用")},N9=[{value:"center",label:r("签到中心")},{value:"schedule",label:r("定时签到")},{value:"records",label:r("签到记录")}];function k9(e){return e==="raccoon"?"小浣熊":e==="loomy"?"Loomy":e==="codearts"?"CodeArts":e==="officeace"?"OfficeAce 果办":e}function C9(){const[e,t]=x.useState(ur());return x.useEffect(()=>PO(()=>t(ur())),[]),e}function T9({group:e}){const t=WG(e);return t==="none"?s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")}):t==="done"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):t==="part"?s.jsx(ze,{variant:"warning",shape:"tag",children:r("部分")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}function qf({id:e,label:t}){const a=gg[e==="workbuddy-intl"?"workbuddy":e];return s.jsx("span",{className:"ck-prov-logo",children:a?s.jsx("img",{src:a,alt:""}):t.slice(0,1)||"·"})}function E9({group:e}){const t=ur().signing,a=(o,c)=>t.has(`${o}:${c}`);return s.jsxs("table",{className:"ck-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("账号")}),s.jsx("th",{children:r("今日签到")}),s.jsx("th",{children:r("上次签到时间")}),s.jsx("th",{"aria-label":r("操作")})]})}),s.jsx("tbody",{children:e.accounts.map(o=>{const c=e.id==="workbuddy-intl";return s.jsxs("tr",{children:[s.jsx("td",{children:o.name||o.id}),s.jsx("td",{children:o.checkedInToday?s.jsx(ze,{variant:"success",shape:"tag",children:r("已签")}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("待签")})}),s.jsx("td",{className:"text-subtle",children:o.checkinAt?Fs(o.checkinAt):"—"}),s.jsx("td",{className:"text-right",children:c?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"keepalive"),title:r("用免费模型与网页会话维持账号活跃 · 不领取奖励"),onClick:()=>{Cg(o.id,"keepalive")},children:a(o.id,"keepalive")?r("保活中…"):r("保活")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"claim"),title:r("探测活动并领取日活奖励 · 不做保活"),onClick:()=>{Cg(o.id,"claim")},children:a(o.id,"claim")?r("领取中…"):r("领取")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"full"),title:r("探测 + 领取 + 保活 · 与定时签到同一套组合"),onClick:()=>{Cg(o.id,"full")},children:a(o.id,"full")?r("执行中…"):r("保活+领取")})]}):s.jsx(se,{size:"sm",variant:"ghost",disabled:a(o.id,"checkin"),onClick:()=>{Cg(o.id)},children:a(o.id,"checkin")?r("签到中…"):o.checkedInToday?r("重签"):r("签到")})})]},o.id)})})]})}function A9({group:e,expanded:t}){const a=e.totalCount>0;return s.jsxs("div",{className:t?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:()=>a&&_O(e.id),onKeyDown:o=>{a&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),_O(e.id))},role:a?"button":void 0,tabIndex:a?0:-1,"aria-expanded":a?t:void 0,children:[s.jsx(qf,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:lM[e.id]??""})]}),s.jsxs("div",{className:"ck-prov-right",children:[s.jsx("span",{className:"ck-prov-count",children:a?r("{total} 账号 · {done} 已签",{total:e.totalCount,done:e.doneCount}):"—"}),s.jsx(T9,{group:e}),a?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),e.id==="qoder-intl"?s.jsx(oM,{}):null,t?s.jsx("div",{className:"ck-prov-detail",children:s.jsx(E9,{group:e})}):null]})}function oM(){const[e,t]=x.useState(null),a=x.useCallback(async()=>{try{t(await Pr().getQoderUmid?.()??null)}catch{}},[]);x.useEffect(()=>{a()},[a]);const o=e?.installing===!0&&e.available!==!0;if(x.useEffect(()=>{if(!o)return;const d=window.setInterval(()=>{a()},3e3);return()=>{window.clearInterval(d)}},[o,a]),!e||e.available)return null;const c=async()=>{try{t(d=>d&&{...d,installing:!0}),await Pr().installQoderUmid?.(),Pe().wbApp?.toast?.(r("✅ UMID 组件已安装,下轮签到即可领取国际版积分"))}catch(d){Pe().wbApp?.toast?.(r("UMID 组件安装失败:{error}",{error:d instanceof Error?d.message:String(d)}),"err")}finally{a()}};return s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-2.5 pl-[58px] pr-4 text-[12px] text-muted-foreground",children:[s.jsx("span",{children:r("国际版签到需要 UMID 组件生成设备风控身份(本机未检测到)。")}),e.installSupported?s.jsx(se,{variant:"outline",size:"sm",disabled:e.installing===!0,onClick:()=>{c()},children:e.installing?r("安装中…"):r("一键安装组件")}):s.jsx("span",{children:r("安装 Qoder 客户端或 qodercli 后即可(无需重启网关)。")})]})}function R9({row:e}){const t=e.provider??"loomy",a=ur().onboarding.get(e.id),o=a?.tasks??[],c=a?.unclaimed??0,d=a?.status==="loaded"&&o.length>0,f=d&&LO(e.id);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>aw(e.id):void 0,onKeyDown:p=>{d&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),aw(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx(qf,{id:t,label:k9(t)}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[a?.status==="loaded"?r("已领 {claimed}/{total} · 累计 {earned} 积分",{claimed:o.length-c,total:o.length,earned:a.total?`${a.earned} / ${a.total}`:a.earned}):r("尚未查询任务状态"),a?.settled&&a.settledAt?` · ${r("结算于 {time}",{time:Fs(a.settledAt)})}`:a?.checkedAt?` · ${r("查询于 {time}",{time:Fs(a.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:p=>p.stopPropagation(),children:[a?.status==="loaded"&&c>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项待领",{n:c})}):a?.status==="loaded"?s.jsx(ze,{variant:"success",shape:"tag",children:r("全部领取")}):a?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status==="loading"||a?.claiming===!0,onClick:()=>{lw(e.id,{expand:!0,refresh:!0})},children:a?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:a?.status!=="loaded"||t!=="officeace"&&c===0||a?.claiming===!0,onClick:()=>{BO(e.id)},children:a?.claiming?r("领取中…"):c>0?r("一键领取({n})",{n:c}):r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),a?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:a.error??""})}):null,f?s.jsx("div",{className:"ck-prov-detail",children:o.map(p=>s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:p.done?"ck-task-tick done":"ck-task-tick",children:p.done?"✓":"·"}),s.jsx("span",{children:p.title}),s.jsxs("span",{className:"ck-task-pts",children:["+",p.points]}),s.jsx("span",{className:"ck-task-st",children:p.claiming?s.jsx(ze,{variant:"warning",shape:"tag",children:r("领取中")}):p.done?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):p.blocked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不可领")}):p.error?s.jsx(ze,{variant:"destructive",shape:"tag",children:p.error}):s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")})})]},p.key))}):null]})}function O9({row:e}){const t=Yh({claimPlans:e.claimPlans}),a=t.length>0;return s.jsxs("div",{className:"ck-welfare-row",children:[s.jsx(qf,{id:"zcode",label:"ZCode"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsxs("div",{className:"ck-prov-name",children:[e.name||e.id,a?s.jsx(ze,{variant:"success",shape:"tag",title:r("本地台账里今天(北京时间)领过的套餐:{plans}",{plans:t.join(r("、"))}),children:r("今天已领 {n} 份",{n:t.length})}):s.jsx(ze,{variant:"outline",shape:"tag",title:r("本地台账里今天还没领过;活动期内每天发一份新套餐"),children:r("今天未领")})]}),s.jsx("div",{className:"ck-prov-desc",children:a?r("点「套餐明细」看领到了哪几份、什么时候生效;活动期内每天可再领"):e.claimAt?r("上次领取 {time} · 领取需通过滑块验证码",{time:Fs(e.claimAt)}):r("限时体验套餐(start-plan),活动期内每天一份 · 领取需滑块验证码")})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(se,{size:"sm",variant:"outline",onClick:()=>jR(e.id,e.name),children:r(a?"套餐明细":"去领取")})})]})}function M9({row:e}){const t=ur().growth.get(e.id),a=t?.tasks??[],o=a.filter(b=>b.supported&&!b.unforgeable),c=o.filter(b=>b.status!=="claimed"&&b.current0,f=d&&XG(e.id),p=t?.travel,h=t?.school,v=t?.results??[],y=b=>v.find(j=>j.code===b);return s.jsxs("div",{className:f?"ck-prov-row open":"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",onClick:d?()=>VO(e.id):void 0,onKeyDown:b=>{d&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),VO(e.id))},role:d?"button":void 0,tabIndex:d?0:-1,"aria-expanded":d?f:void 0,children:[s.jsx(qf,{id:"workbuddy",label:"WorkBuddy"}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.name||e.id}),s.jsxs("div",{className:"ck-prov-desc",children:[t?.status==="loaded"?r("{total} 项任务 · {pending} 项可完成",{total:o.length,pending:c.length}):r("查询任务树并一键点亮 / 领奖(含开学季与猫猫旅行)"),t?.checkedAt?` · ${r("查询于 {time}",{time:Fs(t.checkedAt)})}`:""]})]}),s.jsxs("div",{className:"ck-prov-right",onClick:b=>b.stopPropagation(),children:[t?.status==="loaded"?c.length>0?s.jsx(ze,{variant:"warning",shape:"tag",children:r("{n} 项可完成",{n:c.length})}):s.jsx(ze,{variant:"success",shape:"tag",children:r("全部完成")}):t?.status==="error"?s.jsx(ze,{variant:"destructive",shape:"tag",children:r("查询失败")}):null,s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status==="loading"||t?.running===!0,onClick:()=>{Eg(e.id)},children:t?.status==="loading"?r("查询中…"):r("查询任务")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t?.status!=="loaded"||t?.running===!0,title:r("接单 + 点亮 + 领奖(只处理已实测沉淀的任务)"),onClick:()=>{FO(e.id,"full")},children:t?.running?r("执行中…"):r("一键完成")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.status!=="loaded"||t?.running===!0,title:r("只领取已完成任务的奖励(幂等,重复点不会重复入账)"),onClick:()=>{FO(e.id,"claim")},children:r("领取")}),d?s.jsx("span",{className:"ck-chev","aria-hidden":!0,children:"›"}):null]})]}),t?.status==="error"?s.jsx("div",{className:"ck-fold-note",children:r("查询失败:{error}",{error:t.error??""})}):null,f?s.jsxs("div",{className:"ck-prov-detail",children:[s.jsxs("div",{className:"ck-fold-note",children:[t?.energy!==null&&t?.energy!==void 0?r("能量 {n}",{n:t.energy}):"",t?.streak!==null&&t?.streak!==void 0?` · ${r("连登 {n} 天",{n:t.streak})}`:"",t?.energy===null&&t?.streak===null?r("(能量 / 连登读数本次未取到)"):""]}),a.map(b=>{const j=y(b.code);return s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:b.status==="claimed"?"ck-task-tick done":"ck-task-tick",children:b.status==="claimed"?"✓":"·"}),s.jsxs("span",{title:b.description||b.source||b.code,children:[b.title||b.code,b.target>1?` (${b.current}/${b.target})`:""]}),j?s.jsx("span",{className:"ck-task-pts",children:j.message}):null,s.jsx("span",{className:"ck-task-st",children:b.unforgeable?s.jsx(ze,{variant:"outline",shape:"tag",children:r("需真实操作")}):b.supported?b.status==="claimed"?s.jsx(ze,{variant:"success",shape:"tag",children:r("已领取")}):b.status==="completed"?s.jsx(ze,{variant:"brand",shape:"tag",children:r("可领取")}):b.locked?s.jsx(ze,{variant:"outline",shape:"tag",children:r("未解锁")}):s.jsx(ze,{variant:"warning",shape:"tag",children:r("可完成")}):s.jsx(ze,{variant:"outline",shape:"tag",children:r("暂不支持")})})]},b.code)}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🐾"}),s.jsxs("span",{children:[r("猫猫旅行"),p&&p.hasBuddy===!0?`:${p.buddyName||r("已领养")} · ${p.state==="traveling"?r("在途"):p.state==="arrived"?r("可领奖"):p.state==="idle"?p.dailyLimitReached?r("今日已派出"):r("可派出"):p.state??""}`:p&&p.hasBuddy===!1?`:${r("未领养(领养需先完成当日对话量)")}`:":"+(p?.error?String(p.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningTravel===!0||t?.status!=="loaded",onClick:()=>{ZG(e.id)},children:t?.runningTravel?r("执行中…"):r("巡检一次")})})]}),s.jsxs("div",{className:"ck-task-line",children:[s.jsx("span",{className:"ck-task-tick",children:"🎓"}),s.jsxs("span",{children:[r("开学季活动"),h&&h.inPeriod===!0?`:${r("进行中")}${h.lottery?.balance!==void 0&&h.lottery?.balance!==null?` · ${r("抽奖机会 {n} 次",{n:h.lottery.balance})}`:""}`:h&&h.inPeriod===!1?`:${r("非活动期")}`:":"+(h?.error?String(h.error):r("尚未查询"))]}),s.jsx("span",{className:"ck-task-st",children:s.jsx(se,{size:"sm",variant:"ghost",disabled:t?.runningSchool===!0||t?.status!=="loaded",title:r("执行开学季任务并抽空抽奖机会(分享 / 对话 / 专家事件)"),onClick:()=>{QG(e.id,!0)},children:t?.runningSchool?r("执行中…"):r("执行并抽奖")})})]}),t?.schoolText?s.jsx("div",{className:"ck-fold-note",children:t.schoolText}):null,t?.lotteryText?s.jsx("div",{className:"ck-fold-note",children:t.lotteryText}):null]}):null]})}function D9({group:e}){return s.jsxs("div",{className:"ck-prov-row",children:[s.jsxs("div",{className:"ck-prov-main",style:{cursor:"default"},children:[s.jsx(qf,{id:e.id,label:e.label}),s.jsxs("div",{className:"ck-prov-info",children:[s.jsx("div",{className:"ck-prov-name",children:e.label}),s.jsx("div",{className:"ck-prov-desc",children:lM[e.id]??""})]}),s.jsx("div",{className:"ck-prov-right",children:s.jsx(ze,{variant:"outline",shape:"tag",children:r("无账号")})})]}),e.id==="qoder-intl"?s.jsx(oM,{}):null]})}function I9({store:e}){const t=e.snapshot,[a,o]=x.useState(null);x.useEffect(()=>{let S=!0;return(async()=>{try{const T=await Pe().workbuddyDesktop?.getCheckinRecords?.({limit:1});S&&o(Number(T?.total)||0)}catch{}})(),()=>{S=!1}},[e.version]);const c=t?.daily,d=t?.auto,f=(c?.outOfScope??[]).reduce((S,N)=>S+(Number(N.count)||0),0),p=t?.extras.onboarding??[],h=p.filter(S=>e.onboarding.get(S.id)?.status==="loaded"),v=p.reduce((S,N)=>S+(e.onboarding.get(N.id)?.unclaimed??0),0),y=t?.extras.plans??[],b=t?.extras.growth??[],j=Array.isArray(d?.schedules)?d.schedules:[],w=j.filter(S=>S.enabled===!0).length,k=JG(d);return s.jsxs("div",{children:[s.jsxs("div",{className:"ck-stats",children:[s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("今日签到进度")}),s.jsx("div",{className:"ck-stat-value",children:c?s.jsxs(s.Fragment,{children:[" ",c.todayDone,s.jsxs("small",{children:[" / ",c.todayEligible]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx(tf,{className:"ck-stat-bar",value:c&&c.todayEligible>0?c.todayDone/c.todayEligible*100:0}),s.jsx("div",{className:"ck-stat-foot",children:f>0?r("另有 {n} 个账号不参与每日签到",{n:f}):r("全部账号均可签到")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{kg("schedule")},role:"button",tabIndex:0,onKeyDown:S=>{S.key==="Enter"&&kg("schedule")},children:[s.jsx("div",{className:"ck-stat-label",children:r("定时签到")}),s.jsx("div",{className:"ck-stat-value",children:d?s.jsxs(s.Fragment,{children:[w,s.jsxs("small",{children:[" / ",j.length," ",r("条启用")]})]}):s.jsx("span",{className:"ck-pending",children:"—"})}),s.jsx("div",{className:"ck-stat-foot",children:d?.enabled!==!0?r("总开关已关闭 · 在「定时签到」页打开"):k?r("下次 {date} · 点此管理条目",{date:Fs(k)}):r("暂无启用的条目 · 点此添加")})]}),s.jsxs("div",{className:"ck-stat",children:[s.jsx("div",{className:"ck-stat-label",children:r("待领新手福利")}),s.jsx("div",{className:"ck-stat-value",children:p.length?s.jsxs(s.Fragment,{children:[v,s.jsxs("small",{children:[" ",r("项")]})]}):s.jsx("span",{className:"ck-pending",children:r("无")})}),s.jsx("div",{className:"ck-stat-foot",children:p.length?r("已有结果 {checked} / 共 {total} 个账号",{checked:h.length,total:p.length}):r("没有支持新手福利的账号")})]}),s.jsxs("div",{className:"ck-stat ck-stat-link",onClick:()=>{kg("records")},role:"button",tabIndex:0,onKeyDown:S=>{S.key==="Enter"&&kg("records")},children:[s.jsx("div",{className:"ck-stat-label",children:r("累计签到记录")}),s.jsx("div",{className:"ck-stat-value",children:a===null?s.jsx("span",{className:"ck-pending",children:"—"}):a}),s.jsx("div",{className:"ck-stat-foot",children:r("每账号一条明细 · 点此查看「签到记录」")})]})]}),s.jsxs("div",{className:"ck-main",children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("每日签到")}),s.jsx("span",{className:"panel-sub",children:r("点击行展开账号明细 · 单账号签到不受范围限制")}),s.jsx(se,{size:"sm",variant:"default",className:"ml-auto",disabled:e.runningAll||d?.running===!0,onClick:()=>{GG()},children:e.runningAll||d?.running===!0?r("签到中…"):r("立即全部签到")})]}),s.jsxs("div",{children:[(c?.providers??[]).map(S=>S.totalCount>0?s.jsx(A9,{group:S,expanded:e.expanded.has(S.id)},S.id):s.jsx(D9,{group:S},S.id)),(c?.outOfScope??[]).length>0?s.jsx("div",{className:"ck-fold-note",children:r("不参与每日签到:{list}。CodeArts 的一次性奖励在下方「新手福利」,它的每日福利就在上方「每日签到」里;ZCode 的套餐领取见「活动福利」。",{list:c.outOfScope.map(S=>r("{label} ×{count}({reason})",{label:S.label,count:S.count,reason:S.reason})).join(r(";"))})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("新手福利")}),s.jsx("span",{className:"panel-sub",children:r("一次性福利 · 签到后自动查询并领取,领完记在本机不再查上游 · 点击行展开任务清单")}),p.length>0?s.jsx(se,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>{for(const S of p)S.settled&&typeof S.settled=="object"||lw(S.id)},children:r("全部查询")}):null]}),p.length?s.jsx("div",{children:p.map(S=>s.jsx(R9,{row:S},S.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持新手福利的账号 —— 目前有 Loomy、小浣熊、CodeArts 三家。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活动福利")}),s.jsx("span",{className:"panel-sub",children:r("限时体验套餐 · 领取需滑块验证码 · 逐份查看与领取")})]}),y.length>0?s.jsx("div",{children:y.map(S=>s.jsx(O9,{row:S},S.id))}):s.jsx("div",{className:"ck-empty",children:r("没有可领套餐的账号(ZCode 未添加)。")})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("成长任务")}),s.jsx("span",{className:"panel-sub",children:r("WorkBuddy 国内版 · 查询任务树后一键点亮 / 领奖 · 含开学季与猫猫旅行 · 点击行展开明细")})]}),b.length>0?s.jsx("div",{children:b.map(S=>s.jsx(M9,{row:S},S.id))}):s.jsx("div",{className:"ck-empty",children:r("没有支持成长任务的账号(需要 WorkBuddy 国内版)。")})]})]})]})}function P9(){const e=C9(),t=e.snapshot;if(x.useEffect(()=>{Ol()},[]),x.useEffect(()=>{window.wbApp?.renderTopbarStatus?.()},[e.version]),!e.loaded)return s.jsxs("div",{className:"ck-loading",children:[s.jsx(ef,{className:"size-5"}),s.jsx("span",{children:r("正在读取签到数据…")})]});const a=t?.auto,o=a?.enabled===!0;return s.jsxs("div",{children:[e.loadError?s.jsxs("div",{className:"ck-page-error",children:[s.jsx("span",{children:r("读取签到数据失败:{error}",{error:e.loadError})}),s.jsx(se,{size:"sm",variant:"outline",onClick:()=>{Ol()},children:r("重试")})]}):null,s.jsxs("div",{className:"ck-tabs",children:[s.jsx(In,{options:N9,value:e.tab,onValueChange:c=>IO(c),"aria-label":r("签到中心分区")}),s.jsx(ze,{id:"checkin-badge",className:"ml-auto",variant:a?o?"success":"outline":"destructive","data-tone":a?o?"ok":"":"bad",children:a?o?a?.lastFiredToday?r("今日已执行"):r("已开启"):r("已关闭"):r("不可用")})]}),e.tab==="center"?s.jsx(I9,{store:e}):null,e.tab==="schedule"?s.jsx(b9,{}):null,e.tab==="records"?s.jsx(S9,{}):null]})}const iM='.page[data-page="checkin"]';let cM=!1;function uM(){if(cM)return;const e=document.querySelector(iM);e&&(cM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(P9,{})))}const dM=()=>Ol();window.wbCheckinPanel={load:dM},document.querySelector(iM)?uM():document.addEventListener("DOMContentLoaded",uM,{once:!0}),Pe().wbApp?.currentPage==="checkin"&&dM();function _9(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function L9({options:e,onSettle:t}){const{title:a="确认操作",html:o="",text:c="",okText:d="确定",okClass:f="primary",bodyClass:p="danger-zone",cancelText:h="取消"}=e,v=x.useRef(null);return x.useEffect(()=>{function y(b){b.key==="Escape"&&t(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t]),x.useEffect(()=>{function y(b){b.target?.dataset.slot==="alert-dialog-overlay"&&t(!1)}return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[t]),s.jsx(jV,{open:!0,onOpenChange:y=>{y||t(!1)},children:s.jsxs(kV,{initialFocus:v,showCloseButton:!0,children:[s.jsx(CV,{className:"pr-10",children:s.jsx(SV,{children:a})}),s.jsx(TV,{children:s.jsx(AV,{tone:p==="danger-zone"?"danger":"neutral",dangerouslySetInnerHTML:{__html:o||_9(c).replace(/\n/g,"
    ")}})}),s.jsxs(EV,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:v,variant:"outline",onClick:()=>t(!1),children:h}),s.jsx(se,{variant:f==="danger"?"destructive":"default",onClick:()=>t(!0),children:d})]})]})})}let Gf=null,Au=null,Og=null;function z9(){Gf&&(Gf.unmount(),Gf=null),Au&&(Au.remove(),Au=null)}function fM(e){const t=Og;Og=null,z9(),t?.(e)}function B9(e={}){return new Promise(t=>{Og&&fM(!1),Og=t,Au=document.createElement("div"),document.body.append(Au),Gf=vn.createRoot(Au),Gf.render(s.jsx(L9,{options:e,onSettle:fM}))})}window.wbConfirm={ask:B9};const H9=r("Base URL 填进客户端的「API 地址 / Base URL」栏;对话协议按客户端支持的类型三选一(Chat Completions / Responses / Anthropic Messages),三者共用同一套模型与账号池,可随时切换;鉴权用「网关 Key」页里任一启用 Key。");function Kf({id:e,name:t,note:a}){return s.jsxs("div",{className:"ep-row",children:[s.jsxs("div",{className:"ep-head",children:[s.jsx("span",{className:"ep-name",children:t}),s.jsx("span",{className:"ep-note",children:a})]}),s.jsxs("div",{className:"ep-line",children:[s.jsx("code",{className:"ep-value",id:e,children:"—"}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)]","data-copy-from":e,title:r("复制地址"),children:"⧉"})]})]})}function U9(){return s.jsxs("section",{className:"panel ep-panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("接口地址")}),s.jsx("span",{className:"tip-q","data-tip":H9})]}),s.jsxs("div",{className:"ep-list",children:[s.jsx(Kf,{id:"api-base",name:"Base URL",note:r("填进客户端的「API 地址 / Base URL」")}),s.jsx("div",{className:"ep-group",children:r("对话协议(按客户端支持的类型选一行)")}),s.jsx(Kf,{id:"api-chat",name:"OpenAI Chat Completions",note:r("多数 OpenAI 兼容客户端的默认协议")}),s.jsx(Kf,{id:"api-responses",name:"OpenAI Responses",note:r("OpenAI 新协议(Codex、新版 SDK)")}),s.jsx(Kf,{id:"api-messages",name:"Anthropic Messages",note:r("Claude Code / Anthropic SDK(token 计数:/v1/messages/count_tokens)")}),s.jsx("div",{className:"ep-group",children:r("模型清单")}),s.jsx(Kf,{id:"api-models",name:r("模型列表"),note:r("客户端自动拉取可用模型;不受鉴权限制,配 Key 之前就能拉")})]}),s.jsx("div",{className:"panel-foot",children:s.jsxs("span",{children:[r("鉴权用「网关 Key」页里任一"),s.jsx("b",{children:r("启用")}),r("的 Key:请求带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("。一把启用的 Key 都没有时不鉴权(默认网关只监听 127.0.0.1;在设置页开启「局域网访问」后监听所有网卡,鉴权与安全闸门随之启用)。")]})})]})}const pM='.page[data-page="docs"]';let mM=!1;function hM(){if(mM)return;const e=document.querySelector(pM);e&&(mM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(U9,{})))}document.querySelector(pM)?hM():document.addEventListener("DOMContentLoaded",hM,{once:!0});function ia(){return window}function fw(e){return e instanceof Error?e.message:String(e)}function Yf(e,t){ia().wbApp?.toast?.(e,t)}function V9(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const pw=[{key:"name",label:r("名称")},{key:"key",label:"Key"},{key:"time",label:r("创建时间")},{key:"state",label:r("启用")},{key:"act",label:r("操作"),align:"right"}],F9={name:"cell-name",key:"cell-key",time:"cell-time",state:"cell-state state",act:"cell-act r"},gM='.page[data-page="keys"]';let Mg=null,mw=null;function xM(){return Mg?Mg.apply([...pw]):pw.map(e=>({...e,align:e.align??"left"}))}function bM(){ia().wbColSettings?.syncStaticHead?.("keys",document.querySelector("table.keys-table"))}function $9(){if(Mg)return;const e=ia().wbColSettings?.register({id:"keys",label:r("网关 Key 表"),columns:pw,mount:()=>document.querySelector('.page[data-page="keys"] .panel-head .head-actions'),onChange:()=>{bM(),mw?.()}});e&&(Mg=e,bM())}function q9(e){return Array.isArray(e?.keys)?e.keys:[]}function G9(e){return Array.isArray(e?.providers)?e.providers:[]}function K9(e){const t=e?.modelsByProvider;return t&&typeof t=="object"?t:{}}function hw(e){return ia().wbProviders?.labelOf?.(e)||e}function Y9(e,t,a){const o=new Map,c=f=>{const p=String(f??"").trim();if(!p)return;const h=p.toLowerCase();o.has(h)||o.set(h,p)};t.forEach(f=>{const p=e[f]??e[String(f).toLowerCase()];Array.isArray(p)&&p.forEach(c)}),a.forEach(c);const d=[...o.values()].map(f=>({value:f,label:r(f)}));return d.sort((f,p)=>f.value.toLowerCase()String(t)):[]}function yM(e,t){const a=new Map(t.map(c=>[c.value.toLowerCase(),c.value])),o=new Set;return e.forEach(c=>{const d=a.get(String(c).toLowerCase());d&&o.add(d)}),t.filter(c=>o.has(c.value)).map(c=>c.value)}function W9({target:e,providers:t,modelsByProvider:a,onClose:o,onSaved:c}){const d=e?.id??null,f=!!d,[p,h]=x.useState(e?.name??""),[v,y]=x.useState(""),[b,j]=x.useState(""),[w,k]=x.useState(!1),S=x.useRef(!1),[N,T]=x.useState(()=>vM(e?.allowedProviders)),[D,C]=x.useState(()=>vM(e?.allowedModels)),A=x.useMemo(()=>t.map(H=>({value:String(H.id),label:r(String(H.label??H.id))})),[t]),R=x.useMemo(()=>yM(N,A),[N,A]),I=x.useMemo(()=>Y9(a,R,D),[a,R,D]),P=x.useMemo(()=>yM(D,I),[D,I]),O=I.length?r("没有匹配的选项"):R.length?r("这几家当前没有可用模型(账号未登录或清单为空)"):r("请先在上面选择可用提供商");function _(){S.current=!1,k(!1)}async function L(){if(!S.current){S.current=!0,k(!0),j(r("保存中…"));try{const H=ia().workbuddyDesktop;if(!H)throw new Error(r("后端桥不可用"));if(d){const Q=await H.updateKey(d,{allowedProviders:R,allowedModels:P});_(),c(Q),o(),Yf(r("✅ 可用范围已保存"));return}const B=v.trim();if(B&&B.length<8){j(r("Key 至少需要 8 个字符"));return}const z=await H.createKey({name:p.trim(),key:B||void 0,allowedProviders:R,allowedModels:P});_(),c(z,z?.created?.id),o(),Yf(r("✅ Key 已创建,记得复制给客户端"))}catch(H){j(r("保存失败:{reason}",{reason:fw(H)}))}finally{_()}}}return s.jsx(Qt,{open:!0,onOpenChange:(H,B)=>{if(!H){if(S.current){B.cancel();return}o()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:f?r("可用范围 · {name}",{name:e?.name||r("未命名")}):r("新建 API Key")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-name",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("名称")}),s.jsx(Fe,{id:"key-name",type:"text",maxLength:60,placeholder:r("例如 Cursor / 公司电脑"),autoComplete:"off",value:p,disabled:f,onChange:H=>h(H.currentTarget.value)})]}),!f&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"key-value",className:"text-[12.5px] whitespace-nowrap text-subtle",children:"Key"}),s.jsx(Fe,{id:"key-value",type:"text",placeholder:r("留空自动生成;手填至少 8 个字符"),autoComplete:"off",spellCheck:!1,value:v,onChange:H=>y(H.currentTarget.value),onKeyDown:H=>{H.key==="Enter"&&L()}})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用提供商")}),s.jsx(Hh,{value:R,onValueChange:T,options:A,placeholder:r("留空 = 不限制"),searchPlaceholder:r("搜索提供商…"),"aria-label":r("可用提供商"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("可用模型")}),s.jsx(Hh,{value:P,onValueChange:C,options:I,placeholder:r("留空 = 不限制"),emptyHint:O,searchPlaceholder:r("搜索模型…"),"aria-label":r("可用模型"),className:"flex-auto min-w-[180px] max-w-[260px]"})]}),s.jsx("p",{children:r("留空表示不限制;同时设置时请求需同时满足两个条件(模型在白名单内且路由到允许的提供商)。 「可用模型」的候选跟着上面勾选的提供商走:没勾提供商时它是空的(还没有约束范围), 勾了几家就列出这几家能收的全部对外名。")}),s.jsx("p",{id:"key-restrict-summary",children:Z9(R,P)})]}),s.jsx("div",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:b})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:o,disabled:w,children:r("取消")}),s.jsx(se,{variant:"default",disabled:w,onClick:()=>{L()},children:r(f?"保存范围":"创建")})]})]})})}let Dg=null;async function J9(){await Dg?.load()}function e7(){Dg?.render()}function t7(){const[e,t]=x.useState(null),[a,o]=x.useState(()=>new Set),[c,d]=x.useState(()=>new Set),[f,p]=x.useState(null),[,h]=x.useState(0),v=x.useRef(new Set),y=x.useRef(!1),b=x.useCallback(L=>{t(L)},[]),j=x.useCallback(L=>{L&&Array.isArray(L.keys)&&b(L)},[b]),w=x.useCallback(async()=>{if(!y.current){y.current=!0;try{const L=ia().workbuddyDesktop;if(!L)throw new Error(r("后端桥不可用"));b(await L.getKeys()??null)}catch(L){Yf(r("读取 Key 列表失败:{reason}",{reason:fw(L)}),"err")}finally{y.current=!1}}},[b]);async function k(L,H,B){if(!v.current.has(L)){v.current.add(L),d(new Set(v.current));try{j(await H()),B&&Yf(B)}catch(z){Yf(r("操作失败:{reason}",{reason:fw(z)}),"err")}finally{v.current.delete(L),d(new Set(v.current))}}}function S(L){o(H=>{const B=new Set(H);return B.has(L)?B.delete(L):B.add(L),B})}async function N(L){const H=ia().workbuddyDesktop,B=ia().wbConfirm?.ask;if(!H||!B)return;const z=V9(L.name||L.masked||L.id);await B({title:r("删除网关 Key"),html:r("确定删除 Key「{name}」?使用它的客户端会立刻无法访问。",{name:z}),okText:r("删除"),okClass:"danger"})&&k(L.id,()=>H.deleteKey(L.id),r("Key 已删除"))}function T(L,H){const B=ia().workbuddyDesktop;B&&k(L.id,()=>B.updateKey(L.id,{enabled:H}),r(H?"Key 已启用":"Key 已停用"))}x.useLayoutEffect(()=>(Dg={load:w,render:()=>h(L=>L+1)},mw=()=>h(L=>L+1),$9(),h(L=>L+1),()=>{Dg=null,mw=null}),[w]),x.useEffect(()=>{ia().wbApp?.currentPage==="keys"&&w()},[w]),x.useEffect(()=>{ia().wbApp?.renderTopbarStatus?.()},[e]);const D=q9(e),C=cg(D.length,"keys"),A=C.paged?C.slice(D):D,R=xM(),I=e?.authRequired===!0,P=A.filter(L=>L.enabled).length,O=I?r("已启用鉴权 · {n} 把 Key 生效",{n:P}):r("未启用鉴权");function _(L,H,B){switch(L){case"name":return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t",children:H.name||r("未命名")})}),s.jsx("div",{className:"mname",title:Q9(H),children:X9(H)})]});case"key":{const z=a.has(H.id);return s.jsxs("div",{className:"keycell",children:[s.jsx("code",{className:"kv",children:z?H.key:H.masked}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>S(H.id),children:r(z?"隐藏":"显示")}),s.jsx(se,{size:"sm",variant:"ghost","data-copy":H.key,title:r("复制 Key"),children:r("复制")})]})}case"time":return s.jsx("span",{className:"muted",children:H.createdAt?ia().wbApp?.formatTime?.(H.createdAt):"—"});case"state":return s.jsx(us,{checked:H.enabled===!0,disabled:B,"aria-label":r("启用「{name}」",{name:H.name||r("未命名")}),onCheckedChange:z=>T(H,z)});case"act":return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:B,onClick:()=>p({key:H}),children:r("可用范围")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:B,onClick:()=>{N(H)},children:r("删除")})]});default:return null}}return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("API Key 列表")}),s.jsx(ze,{id:"keys-status",variant:I?"success":"warning","data-tone":I?"ok":"warn",children:O}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"default",onClick:()=>p({key:null}),children:r("+ 新建 Key")})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table keys-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"k-name","data-col":"name"}),s.jsx("col",{className:"k-key","data-col":"key"}),s.jsx("col",{className:"k-time","data-col":"time"}),s.jsx("col",{className:"k-state","data-col":"state"}),s.jsx("col",{className:"k-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"name",children:r("名称")}),s.jsx("th",{"data-col":"key",children:"Key"}),s.jsx("th",{"data-col":"time",children:r("创建时间")}),s.jsx("th",{"data-col":"state",children:r("启用")}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{children:A.length?A.map(L=>{const H=c.has(L.id);return s.jsx("tr",{className:L.enabled?"":"off","data-id":L.id,children:R.map(B=>s.jsx("td",{className:`${F9[B.key]??""} ta-${B.align}`,children:_(B.key,L,H)},B.key))},L.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:R.length,className:"empty",children:r(e?"还没有 Key,当前不鉴权":"加载中…")})})})]})}),s.jsx(Li,{leading:s.jsxs("span",{children:[r("客户端请求需带 "),s.jsx("code",{children:"Authorization: Bearer "}),r(" 或 "),s.jsx("code",{children:"x-api-key: "}),r("; 修改后立即生效,本程序自身会自动使用第一把启用的 Key。每把 Key 可单独限制"),s.jsx("b",{children:r("可用提供商")}),r("与"),s.jsx("b",{children:r("可用模型")}),r("(行内「可用范围」):留空 = 不限制,两个都设时 按交集生效 —— 被限制的模型对这把 Key 表现为「不存在」(拉 /v1/models 也看不到它), 提供它的家不在可用列表里时请求同样被拒。")]}),total:D.length,range:C.paged?{start:C.rangeStart,end:C.rangeEnd}:null,page:C.page,pageCount:C.pageCount,size:C.size,onSizeChange:C.setSize,onPageChange:C.goto}),f?s.jsx(W9,{target:f.key,providers:G9(e),modelsByProvider:K9(e),onClose:()=>p(null),onSaved:(L,H)=>{H&&o(B=>new Set(B).add(H)),j(L)}}):null]})}let jM=!1;function wM(){if(jM)return;const e=document.querySelector(gM);e&&(jM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(t7,{})))}document.querySelector(gM)?wM():document.addEventListener("DOMContentLoaded",wM,{once:!0}),window.wbKeysPanel={load:J9,render:e7,visibleColumns:xM};const n7="login-app",s7=x.createElement("panel-captcha",{id:"captcha"});function r7(){return s.jsxs("div",{className:"w-[min(400px,100%)] rounded-lg border border-border bg-card p-[36px_34px_30px] shadow-3",children:[s.jsxs("div",{className:"mb-[26px] flex flex-col items-center gap-3 text-center",children:[s.jsxs("svg",{viewBox:"0 0 24 24",role:"img","aria-label":"Agent2API",className:"size-[52px] rounded-[12px] shadow-[0_6px_18px_rgba(0,122,255,0.35)]",children:[s.jsx("rect",{width:"24",height:"24",rx:"5.4",fill:"#007AFF"}),s.jsxs("g",{fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M5.23 9.24h10.71"}),s.jsx("path",{d:"M15.94 6.72 18.77 9.24 15.94 11.76"}),s.jsx("path",{d:"M18.77 14.76H8.06"}),s.jsx("path",{d:"M8.06 12.24 5.23 14.76 8.06 17.28"})]})]}),s.jsxs("div",{children:[s.jsx("h1",{className:"m-0 text-[21px] font-bold tracking-[0.2px]",children:"Agent2API"}),s.jsx("div",{className:"text-[12.5px] text-muted-foreground",children:r("OpenAI 兼容网关 · 管理面板")})]})]}),s.jsx("div",{id:"mode-tip",className:"mb-[18px] text-center text-[13px] text-muted-foreground"}),s.jsxs("form",{id:"form",autoComplete:"on",children:[s.jsx(Je,{htmlFor:"username",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("账号")}),s.jsx(Fe,{id:"username",autoComplete:"username",placeholder:r("管理员账号")}),s.jsx(Je,{htmlFor:"password",className:"mt-3.5 mb-[5px] text-[12.5px]",children:r("密码")}),s.jsx(Fe,{id:"password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位")}),s7,s.jsx(se,{id:"submit",type:"submit",size:"lg",className:"w-full",children:r("继续")}),s.jsx("div",{id:"error",className:"mt-3 min-h-5 text-center text-[13px] whitespace-pre-wrap text-destructive"})]}),s.jsx("div",{className:"mt-[22px] text-center text-[12px] text-muted-foreground",children:r("登录后可在「网关 Key」页为 API 客户端创建密钥")})]})}function a7(){const e=document.getElementById(n7);e&&Cs.flushSync(()=>{vn.createRoot(e).render(s.jsx(r7,{}))})}a7();function Lr(){return window}function gw(e){return e instanceof Error?e.message:String(e)}function Ig(e,t){Lr().wbApp?.toast?.(e,t)}const SM=1e3,l7=lg,o7=500,NM="workbuddy-desktop-logs-range",xw="workbuddy-desktop-logs-filters",i7=300,c7="~/.agent2api/logs.jsonl",bw=["today","7","30","month","all"],vw="all",u7={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},d7=bw.map(e=>({value:e,label:u7[e]})),yw=[{value:"",label:r("全部级别")},{value:"debug",label:r("debug 及以上")},{value:"info",label:r("info 及以上")},{value:"warn",label:r("warn 及以上")},{value:"error",label:r("仅 error")}],f7=r("全部级别"),kM=r("全部分类"),p7={debug:r("调试"),info:r("信息"),warn:r("警告"),error:r("错误")};let Pg=SM,_g=!0,jw=!1,ww=!1,Sw=!1,Nw=null,Eo=null,kw=null,Lg=null,Cw=!1,Tw=!1;const Ew={level:"",category:"",keyword:""};function m7(){const e=Lr().wbFilterMemory;if(!e)return{...Ew};Cw=!0;const t=e.load(xw,{...Ew});return{level:yw.some(a=>a.value===t.level)?t.level:"",category:t.category,keyword:t.keyword}}function zg(e){Lr().wbFilterMemory?.save(xw,{level:e.level||"",category:e.category||"",keyword:e.keyword.trim()||""})}function h7(){try{const e=localStorage.getItem(NM);return e!==null&&bw.includes(e)?e:vw}catch{return vw}}function g7(e){try{localStorage.setItem(NM,e)}catch{}}function Bg(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function x7(e){const t=new Date;switch(e){case"today":return Bg(t);case"7":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Bg(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Bg(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}function b7(e){if(!e)return"—";const t=new Date(e),a=d=>String(d).padStart(2,"0"),o=`${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`,c=`${a(t.getMonth()+1)}-${a(t.getDate())}`;return t.getFullYear()===new Date().getFullYear()?`${c} ${o}`:`${t.getFullYear()}-${c} ${o}`}function v7(e){const t=e.data;if(!t)return"";const a=[];return(t.from||t.to)&&a.push([t.from,t.to].filter(Boolean).join(" → ")),t.model&&a.push(r("模型 {model}",{model:t.model})),t.resetAtText?a.push(r("{time} 恢复",{time:t.resetAtText})):t.status&&!t.from&&!t.to&&a.push(`HTTP ${t.status}`),a.length?a.join(" · "):""}function Aw(e){return Array.isArray(e?.entries)?e.entries:[]}function Hg(e,t,a){const o=Math.max(1,a==="all"?1:Math.ceil(t.length/a));return Math.min(Math.max(1,e),o)}function Rw(e,t){return Object.hasOwn(e,t)}function y7(e){const t={};if(e&&typeof e=="object")for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function CM(e,t){const a=new URLSearchParams,o=e.keyword.trim(),c=x7(t);return e.level&&a.set("level",e.level),e.category&&a.set("category",e.category),o&&a.set("keyword",o),c!==null&&a.set("start",String(c)),a}function j7(e,t){const a=CM(e,t);return a.set("limit",String(o7)),a.toString()}function w7(e,t){return CM(e,t).toString()}function S7(e){Nw=e||null,Lr().wbApp?.updateLogsBadge?.(Nw)}async function N7(){if(!jw)try{const e=await Lr().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="logsAutoRefresh");Ow(t||null),jw=Array.isArray(e?.tasks)}catch(e){console.warn("读取日志自动刷新间隔失败,按默认 10 秒:",gw(e)),Ow(null)}}function Ow(e){jw=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(_g=e.enabled!==!1,Pg=e.unit==="minutes"?t*6e4:t*1e3):(_g=!0,Pg=SM),Eo?.applyAutoConfig(Pg,_g)}async function k7(e={}){await Eo?.load(e)}function C7(e){if(!Eo){Lg={data:e??null};return}Eo.render(e)}function T7(){return Nw}async function E7(e){if(!Eo){kw=e;return}await Eo.showCategory(e)}const A7={entries:[],total:0,matched:0,file:c7,categories:{},loaded:!1};function Mw(e,t){return{entries:Aw(e),total:Number(e?.total)||0,matched:Number(e?.matched)||0,file:e?.file||t.file,categories:Object.keys(t.categories).length?t.categories:y7(e?.categories),loaded:!0}}function R7(e){return e.loaded?e.total?r("没有符合筛选条件的日志"):r("暂无日志"):r("正在加载日志…")}function O7(){const[e,t]=x.useState(A7),[a,o]=x.useState(m7),[c,d]=x.useState(h7),[f,p]=x.useState(1),[h,v]=x.useState(()=>og("logs")),[y,b]=x.useState(null),[j,w]=x.useState(()=>({ms:Pg,enabled:_g})),k=x.useRef(null),S=x.useRef(null),N=x.useRef(null),T=x.useRef(null),D=x.useRef(a),C=x.useRef(c),A=x.useRef(f),R=x.useRef(h),I=x.useRef(e),P=x.useCallback(re=>{const de={...D.current,...re};return D.current=de,o(de),de},[]),O=x.useCallback(re=>{C.current=re,d(re)},[]),_=x.useCallback(re=>{A.current=re,p(re)},[]),L=x.useCallback(re=>{R.current=re,v(re),ig("logs",re)},[]),H=x.useCallback(re=>{I.current=re,t(re)},[]),B=x.useCallback(()=>{if(Cw)return;const re=Lr().wbFilterMemory;if(!re||(Cw=!0,Tw))return;const de=re.load(xw,{...Ew});P({level:de.level,category:de.category,keyword:de.keyword})},[P]),z=x.useCallback(async(re={})=>{const{silent:de=!1,resetPage:ke=!1}=re;ke&&_(1),N7(),B();const Ee=j7(D.current,C.current),ve=A.current;try{const he=Lr().workbuddyDesktop;if(!he)throw new Error(r("后端桥不可用"));const[ye,we]=await Promise.all([he.getLogs(Ee),he.getLogStats()]),xe=ke?0:k.current?.scrollTop??0,Te=Mw(ye,I.current);H(Te),_(Hg(A.current,Aw(ye),R.current)),S.current=A.current===ve?xe:0,S7(we),Object.keys(Te.categories).length&&D.current.category&&!Rw(Te.categories,D.current.category)&&(zg(P({category:""})),z({resetPage:!0}))}catch(he){de||(console.warn("读取运行日志失败:",gw(he)),H(Mw(null,I.current)),_(Hg(A.current,[],R.current)))}},[H,_,B]),Q=x.useCallback(re=>{re!==void 0&&(H(Mw(re,I.current)),_(Hg(A.current,Aw(re),R.current)))},[H,_]),K=x.useCallback(async re=>{if(Rw(I.current.categories,re)||await z({silent:!0}),!Rw(I.current.categories,re))return;const de=P({category:re});zg(de),_(1),await z({resetPage:!0}),Lr().wbApp?.showPage?.("logs",{persist:!0})},[P,_,z]);x.useEffect(()=>{if(Eo={load:z,render:Q,showCategory:K,applyAutoConfig:(de,ke)=>w({ms:de,enabled:ke})},Lg){const de=Lg;Lg=null,Q(de.data)}const re=kw;return re!==null?(kw=null,K(re)):z({silent:!0}),()=>{Eo=null,N.current!==null&&window.clearTimeout(N.current),N.current=null}},[z,Q,K]),x.useEffect(()=>{if(!j.enabled||j.ms<=0)return;const re=window.setInterval(()=>{document.hidden||Lr().wbApp?.currentPage!=="logs"||ww||(ww=!0,z({silent:!0}).finally(()=>{ww=!1}))},j.ms);return()=>{window.clearInterval(re)}},[j,z]),x.useLayoutEffect(()=>{const re=S.current;if(re===null)return;S.current=null;const de=k.current;de&&(de.scrollTop=re)});async function X(re,de,ke){if(!Sw){Sw=!0,b({which:re,label:de});try{await ke()}catch(Ee){Ig(r("操作失败:{error}",{error:gw(Ee)}),"err")}finally{Sw=!1,b(null)}}}async function q(){const re=w7(D.current,C.current),de=re.length>0,ke=de?r("确定清空当前筛选出的 {count} 条日志?清空后无法恢复。",{count:Number(I.current.matched)||0}):r("确定清空全部运行日志?清空后无法恢复。"),Ee=Lr().wbConfirm?.ask;Ee&&await Ee({title:r("清空运行日志"),html:ke,okText:r("清空"),okClass:"danger"})&&await X("clear",r("清空中…"),async()=>{const ve=Lr().workbuddyDesktop;if(!ve)throw new Error(r("后端桥不可用"));await ve.clearLogs(de?re:"all=1"),await z({resetPage:!0}),Ig(r("运行日志已清空"))})}async function $(){await X("export",r("导出中…"),async()=>{const re=Lr().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.exportLogs();if(!(!de||de.canceled)){if(de.count===0){Ig(r("暂无日志可导出"),"err");return}Ig(r("✅ 已导出 {count} 条日志到 {file}",{count:String(de.count),file:String(de.file)}))}})}function Y(re){const de=Hg(re,I.current.entries,R.current);de!==A.current&&(_(de),S.current=0)}function F(re){if(re===R.current)return;const de=I.current.entries.length,ke=de?(A.current-1)*(R.current==="all"?de:R.current):0;L(re),_(re==="all"?1:Math.floor(ke/re)+1),S.current=0}function G(re){Tw=!0,zg(P(re)),z({resetPage:!0})}function W(re){Tw=!0,P({keyword:re}),N.current!==null&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,zg(D.current),z({resetPage:!0})},i7)}function le(re){const de=bw.includes(re)?re:vw;de!==C.current&&(O(de),g7(de),z({resetPage:!0}))}const M=e.entries,U=h!=="all",Z=Math.max(1,U?Math.ceil(M.length/h):1),ae=Math.min(Math.max(1,f),Z),ce=U?M.slice((ae-1)*h,ae*h):M,J=M.length?U?(ae-1)*h+1:1:0,ie=M.length?U?J+ce.length-1:M.length:0,ge=e.categories,ee=e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total});x.useEffect(()=>{const re=e.loaded?ee:"—";T.current!==re&&(T.current=re,Lr().wbApp?.renderTopbarStatus?.())},[e.loaded,ee]);function fe(re,de){const ke=re.level||"",Ee=v7(re);return s.jsxs("div",{className:`log-row ${ke}`,children:[s.jsx("span",{className:"log-rail",children:s.jsx("span",{className:`log-dot ${ke}`})}),s.jsxs("div",{className:"log-main",children:[s.jsxs("div",{className:"log-line",children:[s.jsx("span",{className:"log-cat",children:ge[re.category||""]||re.category}),s.jsx("span",{className:`log-lvl ${ke}`,children:p7[ke]||re.level}),s.jsx("span",{className:"msg",children:re.message})]}),Ee?s.jsx("div",{className:"log-extra-wrap",children:s.jsx("span",{className:"extra",children:Ee})}):null]}),s.jsx("span",{className:"time",children:b7(re.ts)})]},re.id??de)}const te=y?.which==="export",Ce=y?.which==="clear";return s.jsxs("section",{className:"panel",id:"logs-panel-events",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("系统事件")}),s.jsx(ze,{id:"logs-badge",variant:"outline","data-tone":"",children:e.loaded?ee:"—"}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-logs-export",variant:"outline",disabled:y!==null,onClick:()=>{$()},children:te?y?.label:r("导出")}),s.jsx(se,{id:"btn-logs-clear",variant:"destructive",disabled:y!==null,onClick:()=>{q()},children:Ce?y?.label:r("清空")})]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:d7,value:c,onValueChange:le,"aria-label":r("事件日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.level,onValueChange:re=>G({level:String(re??"")}),children:[s.jsx(mt,{id:"logs-level",className:"min-w-[120px]",title:r("按最低级别筛选"),"aria-label":r("按最低级别筛选"),children:s.jsx(pt,{children:yw.find(re=>re.value===a.level)?.label??f7})}),s.jsx(ht,{children:yw.map(re=>s.jsx(qe,{value:re.value,children:re.label},re.value))})]}),s.jsxs(ft,{value:a.category,onValueChange:re=>G({category:String(re??"")}),children:[s.jsx(mt,{id:"logs-category",className:"min-w-[120px]",title:r("按分类筛选"),"aria-label":r("按分类筛选"),children:s.jsx(pt,{children:a.category?ge[a.category]||a.category:kM})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:kM}),Object.entries(ge).map(([re,de])=>s.jsx(qe,{value:re,children:de},re))]})]}),s.jsxs(Ci,{className:"w-auto flex-auto",children:[s.jsx(Ei,{id:"logs-keyword",type:"search",placeholder:r("搜索消息关键词…"),autoComplete:"off","aria-label":r("搜索消息关键词"),value:a.keyword,onChange:re=>W(re.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]})]}),s.jsx("div",{className:"log-list",id:"log-list",ref:k,children:ce.length?ce.map((re,de)=>fe(re,de)):s.jsx("div",{className:"log-empty",children:R7(e)})})]}),s.jsx(Li,{total:M.length,range:U?{start:J,end:ie}:null,page:ae,pageCount:Z,size:h,sizes:l7,onSizeChange:F,onPageChange:Y})]})}const TM='.page[data-page="logs"]';let EM=!1;function AM(){if(EM)return;const e=document.querySelector(TM);e&&(EM=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(O7,{})))}document.querySelector(TM)?AM():document.addEventListener("DOMContentLoaded",AM,{once:!0}),window.wbLogsPanel={load:k7,render:C7,lastStats:T7,applyAutoRefresh:Ow,showCategory:E7};const Ru=["maxInputTokens","maxOutputTokens","supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Xf=["maxInputTokens","maxOutputTokens"],RM=["supportsToolCall","supportsImages","supportsVideo","supportsReasoning"],Ou={maxInputTokens:r("上下文窗口"),maxOutputTokens:r("最大输出 Token"),supportsToolCall:r("工具调用"),supportsImages:r("图片识别"),supportsVideo:r("视频识别"),supportsReasoning:r("支持思考")};r("工具"),r("图片"),r("视频"),r("思考");const M7=1e8;function Dw(e){return Xf.includes(e)}function Iw(e,t){if(Dw(e)){const a=typeof t=="number"?t:Number(t);return!Number.isFinite(a)||a<1||a>M7?null:Math.trunc(a)}return typeof t=="boolean"?t:null}function OM(e){const t={};if(!e||typeof e!="object")return t;const a=e;for(const o of Ru){const c=Iw(o,a[o]);c!==null&&(t[o]=c)}return t}function Pw(e){return Array.isArray(e)?Ru.filter(t=>e.some(a=>a===t)):[]}function _w(e){return OM(e?.capabilities)}function MM(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"—";const a=o=>o.toFixed(1).replace(/\.0$/,"");return t>=1e6?`${a(t/1e6)}M`:t>=1e3?`${a(t/1e3)}K`:String(Math.round(t))}function Qf(e){const t=Number(e);return!Number.isFinite(t)||t<=0?r("未声明"):Math.round(t).toLocaleString("en-US")}function Lw(e){return e===!0?"on":e===!1?"off":"unset"}function D7(e){const t=e?.reasoningLevels;if(!Array.isArray(t))return null;const a=t.filter(c=>typeof c=="string"&&c.trim()!=="");if(!a.length)return null;const o=e?.reasoningDefaultLevel;return{levels:a,defaultLevel:typeof o=="string"?o.trim():""}}function I7(e,t,a,o=""){const c=Ou[e],d=a?r("(已被手动覆盖,弹窗里可恢复继承)"):"",f=P7(o);if(Dw(e))return t==null?r("{label}:上游未声明{suffix}",{label:c,suffix:d}):r("{label}:{value}(对下游声明的精确值){origin}{suffix}",{label:c,value:Qf(t),origin:f,suffix:d});const p=Lw(t);return p==="on"?r("{label}:支持{origin}{suffix}",{label:c,origin:f,suffix:d}):p==="off"?r("{label}:不支持{origin}{suffix}",{label:c,origin:f,suffix:d}):r("{label}:上游未声明(下游会按不支持处理){suffix}",{label:c,suffix:d})}function Mu(e,t){const a=e?.capSources?.[t];return a==="upstream"||a==="modelsdev"||a==="user"?a:""}function P7(e){return e==="modelsdev"?r("(由 models.dev 补齐)"):e==="user"?r("(手动设定)"):""}function _7(e){const t={};for(const a of Ru){const o=e[a];Dw(a)?t[a]=Iw(a,o.trim()):t[a]=o==="on"?!0:o==="off"?!1:null}return t}function Zf(){return window}const DM=e=>String(e??"").trim().toLowerCase(),$s=(e,t)=>DM(e)===DM(t);function es(e){return typeof e=="string"&&e.startsWith("custom-")}function $i(){return(Zf().wbProviders?.customList?.()||[]).filter(e=>es(e?.id))}function IM(){return Zf().wbProviders?.customList?.()||[]}function Ao(e){return $i().find(t=>t.id===e)||null}function L7(e){const t=OM(e),a={};for(const o of Ru){const c=t[o];(typeof c=="number"||typeof c=="boolean")&&(a[o]=c)}return Object.keys(a).length?a:void 0}function PM(e){const t=(Array.isArray(e?.models)?e.models:[]).map(c=>{const d={id:String(c?.id??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""};return d.capabilities=L7(c?.capabilities),d}).filter(c=>c.id),a=(Array.isArray(e?.mappings)?e.mappings:[]).map(c=>({alias:String(c?.alias??"").trim(),target:String(c?.target??"").trim(),enabled:c?.enabled!==!1,reasoning:typeof c?.reasoning=="string"?c.reasoning:""})).filter(c=>c.alias&&c.target);for(const c of t){const d=a.find(f=>$s(f.alias,c.id)&&$s(f.target,c.id));d&&(c.enabled=c.enabled&&d.enabled,c.reasoning=d.reasoning||c.reasoning)}const o=a.filter(c=>!($s(c.alias,c.target)&&t.some(d=>$s(d.id,c.target))));return{models:t,mappings:o}}function _M(e){const t=Ao(e);if(!t)return null;const a=PM(t),o=t.name||e,c=[],d=[];for(const f of a.models)c.push({id:f.id,name:"",provider:e,providerLabel:o,source:"",enabled:f.enabled,aliases:[],capabilities:f.capabilities||{},capOverrides:[]}),d.push({alias:f.id,target:f.id,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!0,dangling:!1,carried:!0});for(const f of a.mappings){const p=c.find(h=>$s(h.id,f.target));d.push({alias:f.alias,target:f.target,provider:e,enabled:f.enabled,reasoning:f.reasoning,isDefault:!1,dangling:!p,carried:!!p}),p&&p.aliases.push(f.alias)}return{models:c,mappings:d}}async function qi(e,t){const a=Zf().wbProviders;if(!a?.customRequest)throw new Error(r("目录模块未就绪"));const o=Ao(e);if(!o)throw new Error(r("该自定义提供商已不存在(可能已被删除),请刷新后重试"));const c=PM(o),d=t(c);return await a.customRequest("POST","/api/custom-providers/models",{providerId:e,models:c.models,mappings:c.mappings}),await a.refreshCustom?.(),d}async function LM(e,t,a,o={}){const{enabled:c,reasoning:d}=o;await qi(e,f=>{if($s(t,a)){const h=f.models.find(v=>$s(v.id,a));if(!h)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:a}));return c!==void 0&&(h.enabled=!!c),d!==void 0&&(h.reasoning=String(d??"")),null}const p=f.mappings.find(h=>$s(h.alias,t)&&$s(h.target,a));if(p)return c!==void 0&&(p.enabled=!!c),d!==void 0&&(p.reasoning=String(d??"")),null;if(c===!1)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return f.mappings.push({alias:t,target:a,enabled:c??!0,reasoning:String(d??"")}),null})}async function zM(e,t,a){await qi(e,o=>{const c=o.mappings.length;if(o.mappings=o.mappings.filter(d=>!($s(d.alias,t)&&$s(d.target,a))),o.mappings.length===c)throw new Error(r("映射「{alias} → {target}」不存在",{alias:t,target:a}));return null})}async function BM(e,t){const a=String(t??"").trim();if(!a)throw new Error(r("请填写模型 ID"));await qi(e,o=>{if(o.models.some(c=>$s(c.id,a)))throw new Error(r("模型「{name}」已存在(忽略大小写判重)",{name:a}));return o.models.push({id:a,enabled:!0,reasoning:""}),null})}async function z7(e,t){const a=(Array.isArray(t)?t:[]).map(o=>String(o??"").trim()).filter(Boolean);if(!a.length)throw new Error(r("没有选中任何模型"));return qi(e,o=>{let c=0;for(const d of a)o.models.some(f=>$s(f.id,d))||(o.models.push({id:d,enabled:!0,reasoning:""}),c++);return c})}async function HM(e,t,a){await qi(e,o=>{const c=o.models.find(f=>$s(f.id,t));if(!c)throw new Error(r("该提供商的清单里没有模型「{name}」",{name:t}));const d={...c.capabilities||{}};for(const[f,p]of Object.entries(a))p==null?delete d[f]:d[f]=p;return c.capabilities=Object.keys(d).length?d:void 0,null})}async function UM(e,t){return qi(e,a=>{const o=a.mappings.length;a.mappings=a.mappings.filter(d=>!$s(d.target,t));const c=o-a.mappings.length;return a.models=a.models.filter(d=>!$s(d.id,t)),{removedMappings:c}})}async function B7(e){const t=Zf().wbProviders;if(!t?.customRequest)throw new Error(r("目录模块未就绪"));const a=await t.customRequest("POST","/api/custom-providers/fetch-models",{providerId:e}),o=(Array.isArray(a?.models)?a.models:[]).map(d=>String(d??"").trim()).filter(Boolean),c=await qi(e,d=>{let f=0;for(const p of o)d.models.some(h=>$s(h.id,p))||(d.models.push({id:p,enabled:!0,reasoning:""}),f++);return f});return{total:o.length,added:Number(c)||0}}Zf().wbModelsCustom={isCustom:es,list:$i,listSource:IM,record:Ao,buildView:_M,setBinding:LM,removeMapping:zM,addModel:BM,addModels:z7,removeModel:UM,setCapabilities:HM,fetchModels:B7};const ca="__custom__",H7=["off","none","minimal","low","medium","high","xhigh","max"];function Wf(e,t){const a=VM(t);if(a.length)return a;const o=e?.reasoningLevels;return Array.isArray(o)&&o.length?o.filter(c=>typeof c=="string"):[...H7]}function VM(e){const t=e?.reasoningLevels;return Array.isArray(t)?t.filter(a=>typeof a=="string"&&a.trim()!==""):[]}function U7(e,t){const a=t.map(VM).filter(f=>f.length>0);if(!a.length||a.length!==t.length)return Wf(e);const[o,...c]=a,d=o.filter(f=>c.every(p=>p.includes(f)));return d.length?d:Wf(e)}function FM(e,t,a){return`${String(e??"").trim().toLowerCase()}${String(t??"").trim().toLowerCase()}${String(a??"").trim().toLowerCase()}`}function V7(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=typeof a?.reasoning=="string"?a.reasoning.trim():"";o&&t.set(FM(a.alias,a.target,a.provider),o)}return(a,o,c)=>t.get(FM(a,o,c))||""}function Wt(){return window}function Ro(e){return e instanceof Error?e.message:String(e)}function wr(e,t){Wt().wbApp?.toast?.(e,t)}function zw(e){const t=Wt().wbApp?.esc;return t?t(e):String(e??"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a]||a)}function F7(e){const t=Wt().formatTime??Wt().wbApp?.formatTime;return String(t?.(e)??"")}const $M=e=>String(e??"").trim().toLowerCase(),Oo=(e,t)=>$M(e)===$M(t),qM=8,GM="workbuddy-desktop-models-filters",Bw=["all","enabled","disabled","mapped"],$7={all:r("全部"),enabled:r("已启用"),disabled:r("已禁用"),mapped:r("有映射")},q7=Bw.map(e=>({value:e,label:$7[e]})),Hw=["default","rate-asc","rate-desc"],G7={default:r("默认"),"rate-asc":r("倍率升序"),"rate-desc":r("倍率降序")},K7=Hw.map(e=>({value:e,label:G7[e]})),Uw=[{key:"check",label:r("选择"),align:"center"},{key:"model",label:r("上游模型")},{key:"rate",label:r("倍率")},{key:"source",label:r("来源")},{key:"budget",label:r("上下文 / 输出")},{key:"caps",label:r("能力")},{key:"alias",label:r("模型映射")},{key:"act",label:r("操作"),align:"right"}],KM=new Set(["rate","source"]),Jf="custom-all",Vw={models:[],mappings:[]},YM={provider:"all",state:"all",search:"",sort:"default"};function XM(){const e=Wt().wbFilterMemory;if(!e)return{...YM};const t=e.load(GM,{...YM});return{provider:String(t.provider||"all"),state:Bw.includes(t.state)?t.state:"all",search:String(t.search||""),sort:Hw.includes(t.sort)?t.sort:"default"}}const Ug=XM();let QM=!!Wt().wbFilterMemory,Vg=!1,ts={provider:Ug.provider,stateFilter:Ug.state,search:Ug.search,sort:Ug.sort,data:null,expanded:new Set,pending:new Set,mapping:null,customModel:null,capability:null};const Fw=new Set;function ep(){return ts}function Y7(e){return Fw.add(e),()=>{Fw.delete(e)}}function Ps(e){const t={...ts,...e},a=$g(t),o=$g(ts)!==a;ts=a===t.provider?t:{...t,provider:a},Q7(),o&&qg();for(const c of Fw)c()}function Fg(e){Wt().wbFilterMemory?.save(GM,e)}function ZM(){if(QM||Vg||!Wt().wbFilterMemory)return;QM=!0;const e=XM();(e.provider!==ts.provider||e.state!==ts.stateFilter||e.search!==ts.search||e.sort!==ts.sort)&&Ps(e)}function $g(e){const t=e.provider;return t==="all"||t===Jf||$i().some(a=>a.id===t)||Array.isArray(e.data?.models)&&e.data.models.some(a=>(a.provider||"")===t)||!e.data||!$w()?t:"all"}function Du(){return $g(ts)}function $w(){return!!Wt().wbProviders}function Iu(){return Du()===Jf}function WM(){return Iu()||es(Du())}let tp=null;function qw(e){const t=Ao(e);return(!tp||tp.id!==e||tp.record!==t)&&(tp={id:e,record:t,view:_M(e)||Vw}),tp.view}let np=null;function X7(){const e=IM();if(np&&np.directory===e)return np.view;const t=[],a=[];for(const o of $i()){const c=qw(String(o.id||""));t.push(...c.models||[]),a.push(...c.mappings||[])}return np={directory:e,view:t.length||a.length?{models:t,mappings:a}:Vw},np.view}function Gw(){const e=Du();return es(e)?qw(e):e===Jf?X7():ts.data||Vw}function sp(){const e=Gw();return Array.isArray(e.models)?e.models:[]}function JM(){const e=Gw();return Array.isArray(e.mappings)?e.mappings:[]}let e2=(e,t,a)=>"";function Q7(){e2=V7(JM())}function Kw(){const e=new Map,t=Array.isArray(ts.data?.models)?ts.data.models:[];for(const a of t){const o=a.provider||"";if(!o)continue;const c=e.get(o)||{label:a.providerLabel||o,n:0};c.n++,e.set(o,c)}return e}function Z7(){const e=new Map;for(const t of $i()){const a=String(t.id||"");if(!a)continue;const o=qw(a);e.set(a,{label:String(t.name||a),n:(o.models||[]).length})}return e}function W7(){return[...Kw().keys()]}function J7(e){const a=(Array.isArray(ts.data?.models)?ts.data.models:[]).find(o=>o.provider===e);return Number(a?.refreshedAt)||0}function Yw(){const e=new Map;for(const t of sp()){const a=t.provider||"";a&&!e.has(a)&&e.set(a,t.providerLabel||a)}return[...e].map(([t,a])=>({id:t,label:a}))}function t2(e){return e?sp().filter(t=>(t.provider||"")===e).sort((t,a)=>+(t.enabled===!1)-+(a.enabled===!1)).map(t=>({id:t.id,label:t.name&&t.name!==t.id?r("{id}({name})",{id:t.id,name:t.name}):t.id,off:t.enabled===!1})):[]}function eK(){const e=[],t=Wt().wbProviders?.all?.();if(Array.isArray(t))for(const a of t){const o=String(a?.id||"");o&&e.push({id:o,label:String(a?.label||o)})}for(const a of $i()){const o=String(a.id||"");o&&e.push({id:o,label:String(a.name||o)})}return e.length?e:Yw()}let rp=null,Xw=null;function n2(){const e=rp?rp.apply(Uw):Uw;return WM()?e.filter(t=>!KM.has(t.key)):e}function qg(){Wt().wbColSettings?.syncStaticHead("models",Xw,WM()?KM:null)}function tK(){if(rp)return;rp=Wt().wbColSettings?.register({id:"models",label:r("模型管理表"),columns:Uw,mount:()=>document.querySelector('.page[data-page="gateway"] .panel-head .head-actions'),buttonPlacement:"last",onChange:()=>{qg(),Gi()}})||null,rp&&Gi()}let Gg=0,Qw=!1;async function Kg({force:e=!1}={}){if(Qw&&!e)return;const t=++Gg;Qw=!0,ZM();try{const a=await Wt().workbuddyDesktop?.getModelManage();if(t!==Gg)return;Ps({data:a&&Array.isArray(a.models)?a:null})}catch(a){if(t!==Gg)return;Gi(),wr(r("读取模型清单失败:{message}",{message:Ro(a)}),"err")}finally{t===Gg&&(Qw=!1)}}async function s2(){try{await Wt().wbProviders?.refreshCustom?.()}catch{}await Kg({force:!0})}function Gi(){Ps({})}function Ki(e){const t=e;if(t&&Array.isArray(t.models)){Ps({data:t});return}Gi()}async function Yg(e,t,a,o){if(es(e))return LM(e,t,a,o);const c=Wt().workbuddyDesktop;if(!c)throw new Error(r("后端桥不可用"));return c.addModelMapping(t,a,e,o.reasoning,o.enabled)}async function nK(e,t,a){if(es(e))return zM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.removeModelMapping(t,a,e)}async function sK(e,t){if(es(e))return BM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.addCustomModel(e,t)}async function r2(e,t){if(es(e))return UM(e,t);const a=Wt().workbuddyDesktop;if(!a)throw new Error(r("后端桥不可用"));return a.removeCustomModel(e,t)}async function rK(e,t,a){if(es(e))return HM(e,t,a);const o=Wt().workbuddyDesktop;if(!o)throw new Error(r("后端桥不可用"));return o.setModelCapabilities(e,t,a)}async function Zw(e,t,a){if(!ts.pending.has(e)){Ps({pending:new Set(ts.pending).add(e)});try{Ki(await t()),a&&wr(a)}catch(o){wr(r("操作失败:{message}",{message:Ro(o)}),"err")}finally{const o=new Set(ts.pending);o.delete(e),Ps({pending:o})}}}function ap(e){return Pu(e).some(t=>t.enabled!==!1)}function Pu(e){const t=e.provider||"",a=JM().filter(p=>Oo(p.target,e.id)&&(!p.provider||Oo(p.provider,t))),o=new Map;for(const p of a){const h=String(p.alias).toLowerCase();(!o.has(h)||p.provider)&&o.set(h,p)}const c=String(e.id).toLowerCase(),d=o.get(c);o.delete(c);const f=[{alias:e.id,target:e.id,provider:t,enabled:e.enabled!==!1&&d?.enabled!==!1,isDefault:!0}];return f.push(...o.values()),f}const Yi=e=>`${e.provider||""}:${e.id}`,Ww=(e,t,a)=>`${e}:${t}:${a||""}`;function aK(e){Ps({expanded:new Set(ts.expanded).add(e)})}function lK(e){const t=new Set(ts.expanded);t.delete(e),Ps({expanded:t})}function oK(e){const t=Bw.includes(e)?e:"all";t!==ts.stateFilter&&(Vg=!0,Ps({stateFilter:t}),Fg({state:t}))}function iK(e){const t=Hw.includes(e)?e:"default";t!==ts.sort&&(Vg=!0,Ps({sort:t}),Fg({sort:t}))}function cK(e){Vg=!0,Ps({search:e}),Fg({search:e})}function lp(e){Ps({provider:String(e??"").trim()||"all"}),Fg({provider:ts.provider}),qg()}async function uK(e){const t=Wt().wbCustomProvidersUi;if(!t?.remove){wr(r("删除入口未就绪,请重试或重启应用"),"err");return}await t.remove(e)&&await Kg({force:!0})}function dK(){Wt().wbAccountAddForms?.openNewCustomForm?.()}function a2(e){Ps({mapping:e})}function fK(){Ps({mapping:null})}function pK(){const e=Du(),t=es(e);Ps({customModel:{provider:t||e!=="all"&&e!==Jf?e:"",locked:t}})}function mK(){Ps({customModel:null})}function l2(e,t){Ps({capability:{provider:e,id:t}})}function hK(){Ps({capability:null})}function o2(e,t){return sp().find(a=>(a.provider||"")===e&&Oo(a.id,t))||null}function Jw(e){if(es(e)){const t=Ao(e)?.name;return typeof t=="string"&&t||e}return Wt().wbProviders?.labelOf?.(e)||e}function i2(){const e=Du(),t=es(e),a=t?Ao(e)?.name||e:r("内置提供商");Wt().wbModelsFetchModal?.open({providerId:e===Jf?"":e,custom:t,name:a,onDone:()=>Gi(),onRefreshed:()=>{Kg({force:!0})}})}window.wbModelsPanel={render:Gi,load:Kg,refreshAll:s2,refreshModels:i2,visibleColumns:n2,selectProvider:lp,builtinProviders:W7,providerRefreshedAt:J7};function e0(e,t,a){return e2(e,t,a)}function gK(e){Xw=e}function xK(){const e=Xw;if(!e)return;const t=o=>Object.keys(o).some(c=>c.startsWith("__reactFiber$")||c.startsWith("__reactInternalInstance$"));for(const o of[...e.children])o.tagName==="TBODY"?o.id!=="models"&&o.remove():o.tagName==="TR"&&!t(o)&&o.remove();const a=e.querySelector("tbody#models");if(a)for(const o of[...a.children])t(o)||o.remove()}const bK=e=>[{value:"inherit",label:e},{value:"on",label:r("支持")},{value:"off",label:r("不支持")}];function vK(e){const t=Lw(e);return r(t==="on"?"支持":t==="off"?"不支持":"未声明")}function c2(e,t,a,o,c=""){const d=t!=null,f=Xf.includes(e)?Qf(t):vK(t);return a?o?r("已填写:对下游声明 {value}",{value:f}):r("已覆盖:对下游声明 {value}",{value:f}):o?r("未填写(下游按未声明处理)"):d?c==="modelsdev"?r("models.dev 补齐:对下游声明 {value}",{value:f}):r("继承上游:{value}",{value:f}):r("上游未声明(下游会按不支持处理)")}function yK(e,t,a){return a?Ru.filter(o=>{const c=e[o];return c!=null}):t}function jK(e,t){const a={};for(const o of Ru){const c=t.includes(o),d=e[o];Xf.includes(o)?a[o]=c&&typeof d=="number"?String(d):"":a[o]=c?d===!0?"on":"off":"inherit"}return a}function wK({context:e,onClose:t}){const a=es(e.provider),o=o2(e.provider,e.id),c=D7(o),d=_w(o),f=yK(d,Pw(o?.capOverrides),a),[p,h]=x.useState(()=>jK(d,f)),[v,y]=x.useState(""),[b,j]=x.useState(!1);if(!o)return s.jsx(Qt,{open:!0,onOpenChange:R=>{R||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const w=o.id,k=o.providerLabel||Jw(e.provider),S=r(a?"未声明":"继承上游"),N=r(a?"清除":"恢复继承");function T(R){const I=d[R];return D(R)?"":a?r("未填写"):typeof I=="number"?r("继承上游 {value}",{value:Qf(I)}):r("上游未声明")}function D(R){return f.includes(R)}function C(R,I){h(P=>({...P,[R]:I}))}async function A(){if(!b){for(const R of Xf){const I=p[R].trim();if(I&&Iw(R,I)===null){y(r("{label}要填 1 ~ 1 亿之间的整数(留空 = {inherit})",{label:Ou[R],inherit:S}));return}}j(!0),y(r("保存中…"));try{Ki(await rK(e.provider,e.id,_7(p))),t(),wr(r("✅ 已保存 {id} 的能力位({provider})",{id:w,provider:k}))}catch(R){y(r("保存失败:{message}",{message:Ro(R)})),j(!1)}}}return s.jsx(Qt,{open:!0,onOpenChange:(R,I)=>{if(!R){if(b){I.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("模型能力")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[s.jsx("b",{className:"text-primary-fg",children:o.id}),r("({provider})",{provider:k})]}),Xf.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:`cap-${R}`,children:Ou[R]}),D(R)?s.jsx(se,{variant:"ghost",size:"2xs",disabled:b,title:r(a?"清除这一项(回到未声明)":"清除覆盖,回到上游声明值"),onClick:()=>C(R,""),children:N}):null]}),s.jsx(Fe,{id:`cap-${R}`,inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:T(R),disabled:b,value:p[R],onChange:I=>C(R,I.currentTarget.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A())}}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:c2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),RM.map(R=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:Ou[R]}),s.jsx(In,{options:bK(S),value:p[R],"aria-label":Ou[R],className:"self-start",onValueChange:I=>C(R,String(I))}),s.jsx("p",{className:"text-xs leading-[1.6] text-subtle",children:c2(R,d[R]??null,D(R),a,Mu(o,R))})]},R)),c?s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 text-xs leading-[1.7] text-subtle",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{children:r("可配思考档位")}),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.levels.join(" / ")}),c.defaultLevel?s.jsxs("span",{children:[r("(默认 "),s.jsx("span",{className:"font-mono text-[12px] text-primary-fg",children:c.defaultLevel}),r(")")]}):null]}),s.jsx("div",{className:"mt-1",children:r("这是模型自己能配的档位(来自上游目录),只读;要改某一档请到映射弹窗里选。")})]}):null,s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("这几项是给"),s.jsx("b",{children:r("下游客户端")}),r("看的能力声明("),s.jsx("code",{children:"/v1/models"}),r(" 里的 "),s.jsx("code",{children:"max_input_tokens"})," / ",s.jsx("code",{children:"supports_*"}),r(" 与 "),s.jsx("code",{children:"input_modalities"}),r("),下游按它们决定发不发图片、按多大的窗口堆历史。"),s.jsx("b",{children:r("不影响网关的转发与路由")}),r("。上游清单给的值不准时,在这里改;"),r(a?"这家的清单是你自己登记的,不填的项下游按未声明处理。":"「恢复继承」会把这一项交还给上游清单的值。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:b,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:b,onClick:()=>{A()},children:r("保存")})]})]})})}function op(){return window}const SK="你好",u2=4e3,NK=[{value:"chat_completions",label:"OpenAI - Chat Completions"},{value:"responses",label:"OpenAI - Responses"},{value:"anthropic",label:"Anthropic - Messages"}],kK={chat_completions:"Chat Completions",responses:"Responses",anthropic:"Anthropic Messages"},CK="direct",TK={remote:r("远程目录"),builtin:r("内置清单"),manual:r("手动登记")},EK=[{test:e=>e===429,hint:r("该账号对这个模型正在限额冷却,等一会儿自己会好;也可以先测别的账号。")},{test:e=>e===401||e===403,hint:r("上游拒绝了这条登录态:重新登录一次,或把这条账号删掉。")},{test:e=>e===404,hint:r("上游不认识这个模型名:先点「获取模型」刷新清单,或核对默认绑定指向的上游模型。")},{test:e=>e===504,hint:r("上游没在预算内给完回答。可以只勾一个账号再测一次,看是普遍慢还是某一个账号慢。")},{test:e=>e>=500,hint:r("多半是上游自己的问题,过一会儿再试。同一个错误出现在所有账号上时,先查模型目录与映射。")}];function d2(){return op().wbApp?.getState?.()?.accounts?.accounts||[]}function f2(e){return d2().filter(t=>(t.provider||iu)===e&&t.available!==!1&&t.enabled!==!1).sort(Gh)}function p2(e){const t=String(e.email||"").trim();return t&&ir(e.provider).emailAsName?t:uu(e)||t||r("未命名账号")}function AK(){const e=globalThis.crypto?.randomUUID?.();if(e)return e;const t=a=>Array.from({length:a},()=>Math.floor(Math.random()*16).toString(16)).join("");return`${t(8)}-${t(4)}-4${t(3)}-a${t(3)}-${t(12)}`}function t0(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"—":t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function RK(e,t){return f2(e).length?"":r("该提供商没有可用账号(要在账号页启用一个、且凭证完整),一行都发不出去")}function m2({children:e,plain:t=!1}){return s.jsxs("p",{className:t?"flex items-center gap-2 text-xs leading-[1.6] text-subtle":"flex gap-2 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs leading-[1.65] text-subtle",children:[s.jsx("span",{"aria-hidden":"true",className:t?"size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]":"mt-px size-4 flex-none rounded-full border border-border-strong text-center text-[10px] leading-[14px]",children:"i"}),s.jsx("span",{children:e})]})}function OK({open:e,label:t,text:a,onToggle:o}){return s.jsxs("div",{className:"overflow-hidden rounded-sm border border-border",children:[s.jsxs(se,{variant:"ghost",size:"xs",className:"w-full","aria-expanded":e,onClick:o,children:[s.jsx("span",{className:"truncate",children:t}),s.jsx("span",{"aria-hidden":"true",className:"ml-auto text-[10px]",children:e?"▴":"▾"})]}),e?s.jsx("div",{className:"border-t border-hairline bg-surface px-2.5 py-2",children:s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-[1.65] text-subtle",children:a})}):null]})}function MK(e){const[t,a]=x.useState(()=>Date.now());return x.useEffect(()=>{if(!e)return;a(Date.now());const o=window.setInterval(()=>a(Date.now()),400);return()=>window.clearInterval(o)},[e]),t}function h2(e){if(e.transport||!e.result||e.result.error)return!1;const t=Number(e.result.status)||0;return t>=200&&t<300}function DK({target:e,onClose:t}){const a=e.provider,o=o2(a,e.id),c=f2(a),d=mj(d2()),[f,p]=x.useState(""),[h,v]=x.useState(SK),[y,b]=x.useState("chat_completions"),[j,w]=x.useState(""),[k,S]=x.useState(null),[N,T]=x.useState(""),[D,C]=x.useState(""),[A,R]=x.useState(!0),[I,P]=x.useState(()=>{const te=c.find(Ce=>!vf(Ce,e.id))||c[0];return te?[te.id]:[]}),[O,_]=x.useState([]),[L,H]=x.useState(()=>new Set),B=x.useRef(0),z=x.useRef([]);z.current=O;const Q=O.some(te=>te.state==="running"),K=MK(Q);x.useEffect(()=>{let te=!0;return(async()=>{try{const Ce=op().workbuddyDesktop?.getProxyPool;if(typeof Ce!="function")throw new Error(r("当前环境不支持代理池"));const re=await Ce();if(!te)return;if(!re||typeof re!="object"||!Array.isArray(re.items))throw new Error(r("代理池响应异常"));S(re.items),T("")}catch(Ce){if(!te)return;S([]),T(Ro(Ce))}})(),()=>{te=!1}},[]);const X=x.useCallback((te=!1)=>{const Ce=z.current.filter(re=>re.state==="running");B.current+=1;for(const re of Ce)op().workbuddyDesktop?.terminateStatsRequest?.(re.testId)?.catch(()=>{});_([]),Ce.length&&!te&&wr(r("已中止在途测试({n} 个账号)",{n:Ce.length}))},[]);x.useEffect(()=>()=>{X(!0)},[X]);async function q(te,Ce){const re={provider:a,model:e.id,account_id:te.accountId,prompt:h.trim(),system_prompt:f.trim(),reasoning:D,stream:A,protocol:y,...j?{proxy:j}:{},test_id:te.testId},de=ke=>{B.current===Ce&&_(Ee=>Ee.map(ve=>ve.testId===te.testId?{...ve,...ke}:ve))};try{const ke=await op().workbuddyDesktop?.testModel(re);if(!ke){de({state:"done",transport:r("桥接调用返回空(本机网关没有响应这次测试)")});return}de({state:"done",result:ke})}catch(ke){de({state:"done",transport:Ro(ke)})}}function $(){const te=c.filter(ke=>I.includes(ke.id));if(!te.length){wr(r("至少选一个测试账号"),"err");return}const Ce=B.current+1;B.current=Ce;const re=Date.now(),de=te.map(ke=>({accountId:ke.id,label:p2(ke),position:d.get(ke.id)?.position||0,testId:AK(),startedAt:re,state:"running"}));H(new Set),_(de);for(const ke of de)q(ke,Ce)}function Y(){Q?X():_([])}const F=s.jsx("span",{className:"ml-2 font-mono text-[12px] font-normal text-subtle",children:e.id});if(!o)return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("测试模型")})}),s.jsx(Bt,{children:s.jsx("p",{className:"text-sm leading-[1.7] text-subtle",children:r("这一行已不在当前清单里(模型被移除、或目录刷新后上游不再提供它)。关闭后刷新列表再试。")})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})});const G=Pu(o).find(te=>te.isDefault)?.enabled===!1,W=e0(o.id,o.id,a),le=Pu(o).filter(te=>!te.isDefault).map(te=>te.alias),M=Wf(ep().data,o).filter(te=>te!=="off"&&te!=="none"),U=G?r("跟随映射(该行未启用,本次不注入)"):W?r("跟随映射(当前 {level})",{level:W}):r("跟随映射(未绑定等级)"),Z=[r("以模型本名直发"),le.length?r("另有 {n} 条别名映射({aliases}),别名不参与本次",{n:le.length,aliases:le.join(r("、"))}):"",G?r("该行当前未启用:测试照常按本名直发(「先测通、再决定要不要启用」正是这颗按钮的用法),但本行的思考等级绑定不参与本次,生产路由也要等绑定打开后才会放行"):W?r("映射上绑定的思考等级是 {level},「跟随映射」按它注入",{level:W}):r("映射上未绑定思考等级,「跟随映射」等于这次不注入")].filter(Boolean).join(r(";"))+r("。"),ae=op().wbProviders?.PROTOCOL_OPTIONS||NK,ce=ae.find(te=>te.value===y)?.label||y,J=[{value:"",label:r("跟随账号配置")},{value:CK,label:r("直连(不使用代理)")},...(k??[]).map(te=>({value:`${Xa}${te.id}`,label:lu(te)}))];k===null?J.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):k.length||J.push({value:"__hint_pool__",label:r(N?"代理列表读取失败":"还没有代理(去「网络代理」页添加)"),disabled:!0});const ie=J.find(te=>te.value===j)?.label||r("跟随账号配置"),ge=c.map(te=>({value:te.id,label:`#${d.get(te.id)?.position||0} ${p2(te)}`+(vf(te,e.id)?r(" · 限额中"):"")}));function ee(te){const Ce=(he,ye)=>s.jsxs("div",{className:"flex items-center gap-2.5 border-b border-hairline px-3 py-2",children:[he,s.jsx("b",{className:"min-w-0 truncate text-[12.5px] text-foreground",title:te.label,children:te.label}),te.position?s.jsxs("span",{className:"flex-none text-xs text-subtle",children:["#",te.position]}):null,s.jsx("span",{className:"ml-auto flex-none font-mono text-[11.5px] tabular-nums text-subtle",children:ye})]},"head");if(te.state==="running"){const he=(K-te.startedAt)/1e3;return s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-border bg-surface-2 px-3 py-2.5 text-xs text-subtle",children:[s.jsx(ef,{className:"flex-none"}),s.jsxs("span",{className:"min-w-0 truncate",children:[r("账号 "),s.jsx("b",{className:"text-foreground",children:te.label}),r(" 已发出,等待上游首帧…")]}),s.jsx("span",{className:"ml-auto flex-none font-mono tabular-nums",children:r("已等待 {seconds}s",{seconds:he.toFixed(1)})})]},te.testId)}const re=te.result;if(!h2(te)){const he=Number(re?.status)||0,ye=EK.find(we=>we.test(he))?.hint??(te.transport?r("确认桌面端还在运行,再重试一次。"):"");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"destructive",className:"flex-none",children:he||r("失败")}),r("用时 {time}",{time:t0(re?.duration_ms)})),s.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2.5",children:[s.jsxs("div",{className:"text-[12.5px] leading-[1.7]",children:[te.transport?s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("本机网关没有返回结论")}),r(":"),te.transport]}):s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"text-destructive",children:r("测试未通过")}),r(":"),re?.error||r("上游没有给出可读的错误说明")]}),Number(re?.attempts)>1?r("(中间共尝试 {n} 次)",{n:Number(re?.attempts)}):""]}),ye?s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:ye}):null]})]},te.testId)}const de=String(re?.reply??""),ke=String(re?.reasoning??""),Ee=`think-${te.testId}`,ve=[re?.upstream_model&&re.upstream_model!==e.id?r("上游 {model}",{model:re.upstream_model}):"",re?.upstream_reasoning?r("思考等级 {level}",{level:re.upstream_reasoning}):"",re?.protocol&&re.protocol!=="chat_completions"?kK[re.protocol]||re.protocol:"",re?.proxy?r("节点 {proxy}",{proxy:re.proxy}):"",Number(re?.attempts)>1?r("尝试 {n} 次",{n:Number(re?.attempts)}):""].filter(Boolean).join(" · ");return s.jsxs("div",{className:"rounded-md border border-border bg-surface-2",children:[Ce(s.jsx(ze,{shape:"tag",variant:"success",className:"flex-none",children:Number(re?.status)||200}),r("用时 {time} · 首字 {ttfb}",{time:t0(re?.duration_ms),ttfb:t0(re?.ttfb_ms)})),s.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-subtle",children:[s.jsx("span",{className:"flex-none",children:r("回复")}),ve?s.jsx("span",{className:"min-w-0 truncate",title:ve,children:ve}):null,s.jsx(se,{variant:"ghost",size:"2xs",className:"ml-auto flex-none","data-copy":de,children:r("复制")})]}),s.jsx("div",{className:"max-h-[220px] overflow-y-auto whitespace-pre-wrap rounded-sm border border-border bg-surface px-3 py-2 text-[12.5px] leading-[1.7]",children:de||s.jsx("span",{className:"text-subtle",children:r("(上游这一次返回了空正文)")})}),ke?s.jsx(OK,{open:L.has(Ee),label:r("思考过程({n} 字)",{n:ke.length}),text:ke,onToggle:()=>H(he=>{const ye=new Set(he);return ye.has(Ee)?ye.delete(Ee):ye.add(Ee),ye})}):null]})]},te.testId)}function fe(){if(Q){const Ce=O.length-O.filter(re=>re.state==="running").length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[r("正在测 "),s.jsx("b",{className:"text-foreground",children:O.length}),r(" 个账号"),Ce?s.jsxs(s.Fragment,{children:[r(",已完成 "),s.jsx("b",{className:"text-foreground",children:Ce})]}):null,r("。")]}):null,O.map(re=>ee(re))]})}const te=O.filter(h2).length;return s.jsxs(s.Fragment,{children:[O.length>1?s.jsxs("p",{className:"text-xs text-subtle",children:[s.jsx("b",{className:te?"text-success":"text-foreground",children:te}),r(" 成功 ·"),s.jsxs("b",{className:O.length-te?"text-destructive":"text-foreground",children:[" ",O.length-te]}),r(" 失败")]}):null,O.map(Ce=>ee(Ce)),te===0?s.jsxs(m2,{children:[r("两边原因不一样时各自处理。如果"),s.jsx("b",{className:"text-foreground",children:r("同一条错误出现在所有账号上")}),r(",通常就不是账号问题了:先确认这个模型还在上游目录里(「获取模型」刷一次),再看默认绑定指向的上游模型对不对。")]}):null]})}return s.jsx(Qt,{open:!0,onOpenChange:te=>{te||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r("测试模型"),F]})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-inset px-3 py-2.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12.5px] font-semibold text-primary-fg",title:o.id,children:o.id}),s.jsx(ze,{shape:"tag",variant:"brand",children:Jw(a)}),s.jsx(ze,{shape:"tag",variant:"outline",children:es(a)?r("自定义家"):TK[o.source]||r("来源未知")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("本次测试的发送口径")}),children:"?"}),s.jsx(_i,{children:Z})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-system",children:r("系统提示词")}),s.jsx(Zc,{id:"model-test-system",rows:2,maxLength:u2,placeholder:r("留空则不携带;设置页的提示词模式照常生效"),value:f,onChange:te=>p(te.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-prompt",children:r("用户提示词")}),s.jsx(Zc,{id:"model-test-prompt",rows:2,maxLength:u2,placeholder:r("留空用默认问候「你好」"),value:h,onChange:te=>v(te.currentTarget.value)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-protocol",children:r("对话协议")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("对话协议的说明")}),children:"?"}),s.jsx(_i,{children:r("按所选网关对话协议组装请求并校验响应转换(Chat Completions / Responses / Anthropic Messages)。")})]})]}),s.jsxs(ft,{value:y,onValueChange:te=>b(String(te)),children:[s.jsx(mt,{id:"model-test-protocol",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ce})}),s.jsx(ht,{children:ae.map(te=>s.jsx(qe,{value:te.value,children:te.label},te.value))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-proxy",children:r("测试节点")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试节点的说明")}),children:"?"}),s.jsx(_i,{children:r("仅本次测试临时生效,不修改账号保存的代理配置。可选「网络代理」页里的节点或强制直连。")})]})]}),s.jsxs(ft,{value:j,onValueChange:te=>w(String(te)),children:[s.jsx(mt,{id:"model-test-proxy",className:"w-full",children:s.jsx(pt,{className:"min-w-0 truncate",children:ie})}),s.jsx(ht,{children:J.map(te=>s.jsx(qe,{value:te.value,disabled:te.disabled,children:te.label},te.value))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:D,onValueChange:te=>C(String(te)),children:[s.jsx(mt,{id:"model-test-reasoning",className:"w-full",children:s.jsx(pt,{children:D?r("{level}(本次指定)",{level:D}):U})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:U}),M.map(te=>s.jsx(qe,{value:te,children:r("{level}(本次指定)",{level:te})},te))]})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Je,{htmlFor:"model-test-stream",children:r("流式请求")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("流式请求的说明")}),children:"?"}),s.jsx(_i,{children:r("默认开,与真实请求一致:可同时验证 SSE 链路与首字延迟。")})]})]}),s.jsx(us,{id:"model-test-stream",checked:A,onCheckedChange:te=>R(!!te)})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Je,{htmlFor:"model-test-accounts",children:r("测试账号")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("测试账号的说明")}),children:"?"}),s.jsx(_i,{children:r("勾几个就并行测几次;默认选队列里最靠前的一个。")})]}),s.jsx(se,{variant:"ghost",size:"xs",className:"ml-auto",disabled:!c.length||I.length===c.length,onClick:()=>P(c.map(te=>te.id)),children:r("全选({n})",{n:c.length})})]}),s.jsx(Hh,{id:"model-test-accounts",value:I,onValueChange:P,options:ge,placeholder:r("选一个账号(至少一个)"),searchPlaceholder:r("搜索账号…"),emptyHint:r("这家没有可用账号(要在账号页启用一个、且凭证完整)")})]}),s.jsx(m2,{plain:!0,children:r("真实链路 · 消耗少量额度 · 日志带「测试」标记,不计报表")})]}),s.jsxs(nn,{className:"justify-end",children:[s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:!I.length||!c.length,onClick:$,children:r("开始测试")})]}),s.jsx(Qt,{open:O.length>0,onOpenChange:te=>{te||Y()},children:s.jsxs(Zt,{overlayForceRender:!0,className:"w-[min(680px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsxs(Gt,{children:[r(Q?"测试中…":"测试结果"),F]})}),s.jsx(Bt,{children:fe()}),s.jsx(nn,{className:"justify-end",children:Q?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-xs text-subtle",children:r("关闭即中止")}),s.jsx(se,{variant:"outline",onClick:()=>X(),children:r("中止测试")}),s.jsx(se,{variant:"default",disabled:!0,children:r("测试中…")})]}):s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"outline",onClick:Y,children:r("关闭")}),s.jsx(se,{variant:"default",onClick:$,children:r("再测一次")})]})})]})})]})})}const g2=[{value:"enable",label:r("启用")},{value:"disable",label:r("禁用")},{value:"reasoning",label:r("设置思考等级")},{value:"delete",label:r("删除")}];function x2(e){return e.source==="manual"||es(e.provider)}function IK(e){return(e.name&&e.name!==e.id?r("{name}({id})",{name:e.name,id:e.id}):e.id)||e.id}function PK({models:e,onClose:t,onDone:a}){const[o,c]=x.useState("enable"),d=U7(ep().data,e),[f,p]=x.useState(()=>({select:d[0]||"",custom:""})),[h,v]=x.useState(!1),[y,b]=x.useState(""),j=f.select===ca?f.custom.trim():f.select,w=e.filter(x2).length,k=g2.find(T=>T.value===o)?.label||r("操作");async function S(T){return Promise.resolve(Wt().wbConfirm?.ask?.({title:r("删除选中的模型"),html:r("确定删除选中的 {count} 个模型登记?删除后 /v1/models 不再广告它们、请求也会被拒。",{count:T})+(e.length>T?"
    "+r("另有 {n} 个非手动登记的模型将被跳过。",{n:e.length-T}):""),okText:r("删除"),okClass:"danger"})??!1)}async function N(){if(h)return;if(!e.length){wr(r("没有选中的模型"),"err");return}if(o==="reasoning"&&f.select===ca&&!j){b(s.jsx("span",{className:"text-destructive",children:r("请填写自定义思考等级,或改选候选档 / 「清除」")}));return}if(o==="delete"){if(w===0){b(s.jsx("span",{className:"text-destructive",children:r("选中的模型都不是手动登记,无法删除(开关映射才是它们的手段)")}));return}if(!await S(w))return}v(!0),b("");let T=0,D=0,C=0,A="";for(const R of e){const I=R.provider||"";try{if(o==="delete"){if(!x2(R)){D+=1;continue}Ki(await r2(I,R.id))}else if(o==="enable"||o==="disable"){const P=o==="enable";for(const O of Pu(R))Ki(await Yg(I,O.alias,R.id,{enabled:P}))}else for(const P of Pu(R))Ki(await Yg(I,P.alias,R.id,{reasoning:j}));T+=1}catch(P){C+=1,A||(A=Ro(P)),b(s.jsx("span",{className:"text-destructive",children:r("失败 {n} 个 · 首个失败:{error}",{n:C,error:A})}))}}C===0?(wr(D?r("✅ 批量{action}完成:共 {n} 个模型(跳过不可删除的 {skipped} 个)",{action:k,n:T,skipped:D}):r("✅ 批量{action}完成:共 {n} 个模型",{action:k,n:T})),a()):(wr(r("批量{action}完成:成功 {ok} 个,失败 {failed} 个",{action:k,ok:T,failed:C}),"err"),b(s.jsxs("span",{className:"text-destructive",children:[r("成功 {ok} 个,失败 {failed} 个",{ok:T,failed:C}),D?r(",跳过 {n} 个",{n:D}):"",A?r(";首个失败:{error}",{error:A}):""]}))),v(!1)}return s.jsx(Qt,{open:!0,onOpenChange:T=>{T||h||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("批量操作 · 已选 {n} 个模型",{n:e.length})})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("将作用于以下模型")}),s.jsx("p",{style:{maxHeight:84,overflowY:"auto"},children:e.map(IK).join(r("、"))})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("操作")}),s.jsx(Ah,{value:o,onValueChange:T=>c(T),className:"flex-row flex-wrap items-center gap-5","aria-label":r("批量动作"),children:g2.map(T=>s.jsxs(Je,{className:"inline-flex cursor-pointer items-center gap-2 font-normal",children:[s.jsx(vo,{value:T.value}),T.label]},T.value))}),o==="reasoning"?s.jsxs("div",{className:"mt-2.5",children:[s.jsxs("div",{className:"field-row",children:[s.jsx("label",{htmlFor:"batch-model-reasoning",children:r("思考等级")}),s.jsxs(ft,{value:f.select,onValueChange:T=>p(D=>({...D,select:String(T)})),children:[s.jsx(mt,{id:"batch-model-reasoning",className:"min-w-[220px]",children:s.jsx(pt,{children:f.select===ca?r("自定义等级…"):f.select||r("清除(不覆盖)")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("清除(不覆盖)")}),d.map(T=>s.jsx(qe,{value:T,children:T},T)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]})]}),f.select===ca?s.jsxs("div",{className:"field-row mt-2",children:[s.jsx("label",{htmlFor:"batch-model-reasoning-custom",children:r("自定义等级")}),s.jsx(Fe,{id:"batch-model-reasoning-custom",maxLength:32,value:f.custom,onChange:T=>p(D=>({...D,custom:T.currentTarget.value}))})]}):null,s.jsxs("p",{className:"detail mt-1.5",children:[r("设置 / 清除会应用到选中模型的"),s.jsx("b",{children:r("全部映射")}),r("(默认绑定与别名 chips);「清除」= 不给这些映射指定等级(选「不覆盖」的口径与映射弹窗一致)")]})]}):null,o==="delete"?s.jsx("p",{className:"detail mt-2",children:w===0?r("选中的都不是手动登记的模型,删除不可用(上游目录带回来的行由清单决定存在性)"):r("可删除 {n} 个(手动登记 / 自定义家);",{n:w})+(e.length>w?r("其余 {n} 个会被跳过。",{n:e.length-w}):"")}):null]}),s.jsx("div",{className:"detail",style:{minHeight:18},children:y})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:h,onClick:t,children:r("关闭")}),s.jsx(se,{variant:o==="delete"?"destructive":"default",disabled:h,onClick:()=>{N()},children:h?r("执行中…"):r("执行{action}",{action:k})})]})]})})}function er(){return window}const b2={intl:"fm-table-intl",custom:"fm-table-custom"},v2={intl:"fetch-models",custom:"fetch-models-custom"},n0=["provider","source","state","count","note","updated","op"],s0=["pick","model","state"],_K={provider:"w-[13%]",source:"w-[21%]",state:"w-[9%]",count:"w-[6%]",note:"w-[20%]",updated:"w-[16%]",op:"w-[15%]"},LK={pick:"w-[8%]",model:"w-[74%]",state:"w-[18%]"},zK={pick:"",provider:r("提供商"),source:r("模型来源"),state:r("状态"),count:r("模型数"),note:r("说明"),updated:r("更新日期"),model:r("上游模型"),op:r("操作")},BK={refreshed:{variant:"brand",label:r("已刷新")},failed:{variant:"destructive",label:r("失败")},skipped:{variant:"outline",label:r("跳过")}},y2=new Set(["cline-free","cline-pass"]),j2="workbuddy-desktop-fetch-model-source";function ip(e){return String(e??"").trim().toLowerCase()}function r0(e,t){er().wbApp?.toast?.(e,t)}function a0(e){return e instanceof Error?e.message:String(e)}function w2(e){const t=er().formatTime??er().wbApp?.formatTime;return String(t?.(e)??"")}function S2(){return er().wbApp?.getState?.()?.accounts?.accounts||[]}function HK(e){const a=(er().wbProviders?.customList?.()||[]).find(o=>o.id===e)?.models;return new Set((Array.isArray(a)?a:[]).map(o=>ip(o?.id)).filter(Boolean))}function N2(e){if(e?.nameCustom===!0&&e?.name)return e.name;const t=String(e?.email||"").trim();return er().wbAccountsModel?.providerFeatures?.(e?.provider)?.emailAsName&&t?t:String(e?.nickname||e?.name||t||e?.id||"").trim()||r("未命名账号")}function UK(e){if(y2.has(e))return[];const t=er().wbAccountsModel?.byPriorityOrder,a=S2().filter(o=>(o?.provider||"workbuddy")===e&&o?.available!==!1&&o?.enabled!==!1);return t?a.sort(t):a}function k2(){const e=new Set(er().wbModelsPanel?.builtinProviders?.()||[]);for(const t of S2())t?.available===!1||t?.enabled===!1||e.add(t?.provider||"workbuddy");return[...e]}function VK(){const e=new Set(k2());return(er().wbProviders?.all?.()||[]).filter(t=>e.has(t?.id??""))}function FK(e){return w2(Number(e.refreshedAt)||0)||"—"}function $K(e){return BK[String(e.status)]??{variant:"outline",label:String(e.status||r("未知"))}}function qK(){try{const e=JSON.parse(localStorage.getItem(j2)||"{}");if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&o&&(t[a]=o);return t}catch{return{}}}function GK(e){er().wbFilterMemory?.save?.(j2,e)}function KK({options:e,onClose:t}){const a=e.providerId,o=!!e.custom,c=e.name||a,{onDone:d,onRefreshed:f}=e,[p,h]=x.useState("idle"),[v,y]=x.useState(""),[b,j]=x.useState(""),[w,k]=x.useState(null),[S,N]=x.useState(""),T=w!==null,[D,C]=x.useState(!1),[A,R]=x.useState([]),[I,P]=x.useState(()=>new Set),[O,_]=x.useState(()=>new Set),[L,H]=x.useState([]),[B,z]=x.useState(""),[Q,K]=x.useState(qK);x.useEffect(()=>{er().wbTableColumns?.repaint?.(o?v2.custom:v2.intl)},[o]);const X=o?[]:VK(),q=o?[]:G(),$=B.trim().toLowerCase(),Y=A.filter(ve=>!$||ve.toLowerCase().includes($)),F=o?D?r("已选 {picked} 个 · 上游共 {upstream} 个 · 清单已有 {managed} 个",{picked:O.size,upstream:A.length,managed:I.size}):r("尚未获取"):W(q);function G(){const ve=new Map(L.map(we=>[String(we.provider||""),we])),he=X.map(we=>{const xe=String(we.id||"");return{provider:xe,label:String(we.label||xe),item:ve.get(xe)}}),ye=new Set(he.map(we=>we.provider));for(const we of L){const xe=String(we.provider||"");ye.has(xe)||he.push({provider:xe,label:String(we.providerLabel||xe),item:we})}return he}function W(ve){if(p==="loading")return r("正在刷新…");if(p==="error")return"";const he=ve.map(xe=>xe.item).filter(xe=>!!xe);if(!he.length)return D?r("刷新完成,但没有得到任何结果"):ve.length?r("共 {n} 家 · 点「获取模型」开始",{n:ve.length}):r("0 家");const ye=he.filter(xe=>xe.status==="refreshed").length,we=he.filter(xe=>xe.status==="failed").length;return we?r("{total} 家 · 成功 {done} · 失败 {failed}",{total:ve.length,done:ye,failed:we}):r("{total} 家 · 成功 {done}",{total:ve.length,done:ye})}function le(ve,he){const ye=UK(ve);if(!ye.length)return{list:ye,selected:""};const we=String(Q[ve]||""),xe=String(he||""),Te=Oe=>ye.some(Ne=>String(Ne.id)===Oe);return{list:ye,selected:Te(we)?we:Te(xe)?xe:String(ye[0].id)}}function M(ve){const he={};for(const[ye,we]of Object.entries(Q))we&&(he[ye]=we);for(const ye of ve){const{selected:we}=le(ye.provider,ye.reported);we&&(he[ye.provider]=we)}return he}const U=q.map(ve=>({provider:ve.provider,reported:ve.item?.accountId}));function Z(ve,he){K(ye=>({...ye,[ve]:he})),GK({[ve]:he})}async function ae(){if(!T){k("load"),j(""),y(""),h("loading");try{if(o){const he=await er().wbProviders?.customRequest?.("POST","/api/custom-providers/fetch-models",{providerId:a}),ye=new Set,we=(Array.isArray(he?.models)?he.models:[]).map(Te=>String(Te??"").trim()).filter(Te=>{const Oe=ip(Te);return!Te||ye.has(Oe)?!1:(ye.add(Oe),!0)}),xe=HK(a);R(we),P(xe),_(new Set(we.filter(Te=>!xe.has(ip(Te))))),C(!0),h("ready");return}const ve=await er().workbuddyDesktop?.refreshModels({accounts:M(U),providers:k2()});H(Array.isArray(ve?.results)?ve.results:[]),C(!0),h("ready"),Number(ve?.refreshed)>0&&f?.()}catch(ve){const he=a0(ve);y(he),h("error"),j(he)}finally{k(null)}}}async function ce(ve){if(!(T||!ve.provider)){k("row"),N(ve.provider),j("");try{const he=await er().workbuddyDesktop?.refreshModels({accounts:M([{provider:ve.provider,reported:ve.item?.accountId}]),providers:[ve.provider]});H(ye=>J(ye,Array.isArray(he?.results)?he.results:[])),C(!0),h("ready"),Number(he?.refreshed)>0&&f?.()}catch(he){const ye=a0(he);j(ye),r0(r("获取失败:{message}",{message:ye}),"err")}finally{k(null),N("")}}}function J(ve,he){const ye=new Map(he.map(Te=>[String(Te.provider||""),Te])),we=ve.map(Te=>ye.get(String(Te.provider||""))??Te),xe=new Set(we.map(Te=>String(Te.provider||"")));for(const Te of he)xe.has(String(Te.provider||""))||we.push(Te);return we}async function ie(){if(!o||T||!O.size)return;const ve=[...O];k("import"),j("");try{const he=Number(await er().wbModelsCustom?.addModels?.(a,ve))||0;r0(r("✅ 已导入 {added} 个模型({skipped} 个已存在,跳过)",{added:he,skipped:ve.length-he})),k(null),t(),d?.()}catch(he){const ye=a0(he);r0(r("导入失败:{message}",{message:ye}),"err"),j(ye),k(null)}}function ge(){T||t()}function ee(){const ve=new Set(O);for(const he of A)I.has(ip(he))||ve.add(he);_(ve)}function fe(ve){return s.jsx(kl,{children:s.jsx(Nn,{colSpan:o?s0.length:n0.length,className:"py-[26px] text-center text-muted-foreground",children:ve})})}function te(ve){return s.jsx("span",{className:"font-mono text-[11.5px] tabular-nums text-muted-foreground",children:ve})}function Ce(ve){return s.jsx("div",{className:"truncate font-mono text-[12px] font-semibold",children:ve})}function re(ve,he){const{list:ye,selected:we}=le(ve,he);if(!ye.length){const Te=y2.has(ve)?r("这家的模型清单是全局的,不跟账号走"):r("这家还没有可用账号,刷新会使用默认登录态");return s.jsx("span",{className:"text-[11.5px] text-muted-foreground",title:Te,children:"—"})}const xe=ye.find(Te=>String(Te.id)===we);return s.jsxs(ft,{value:we,onValueChange:Te=>Z(ve,String(Te)),children:[s.jsx(mt,{className:"w-full",title:r("用哪个账号去拉这家的模型清单"),"aria-label":r("模型来源"),children:s.jsx(pt,{children:xe?N2(xe):"—"})}),s.jsx(ht,{children:ye.map(Te=>s.jsx(qe,{value:String(Te.id),children:N2(Te)},String(Te.id)))})]})}function de(){return p==="idle"?fe(r("点右侧「获取模型」从上游拉取这家的模型清单")):p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:v})):Y.length?Y.map(ve=>{const he=I.has(ip(ve));return s.jsxs(kl,{className:he?"opacity-50":void 0,children:[s.jsx(Nn,{children:s.jsx(Dr,{checked:O.has(ve),disabled:he,"aria-label":ve,onCheckedChange:ye=>_(we=>{const xe=new Set(we);return ye?xe.add(ve):xe.delete(ve),xe})})}),s.jsx(Nn,{children:Ce(ve)}),s.jsx(Nn,{children:he?s.jsx(ze,{variant:"brand",title:r("这个模型已经在这家的清单里,不重复导入"),children:r("已添加")}):s.jsx(ze,{variant:"outline",title:r("勾上它,导入后即进入这家的清单"),children:r("未添加")})})]},ve)}):fe(A.length?r("没有匹配「{keyword}」的模型",{keyword:$}):r("上游没有返回任何模型"))}function ke(ve){const he=w==="row"&&S===ve.provider;return s.jsx(se,{variant:"outline",size:"sm",className:"w-full",disabled:T,title:r("只刷新这一家的模型清单"),onClick:()=>{ce(ve)},children:he?r("获取中…"):ve.item?r("重新获取"):r("获取")})}function Ee(){return p==="loading"?fe(r("正在获取…")):p==="error"?fe(r("获取失败:{message}",{message:v})):q.length?q.map(ve=>{const he=ve.item;if(!he){const Te=w2(Number(er().wbModelsPanel?.providerRefreshedAt?.(ve.provider))||0);return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider)}),s.jsx(Nn,{children:s.jsx(ze,{variant:"outline",children:r("待获取")})}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te("—")}),s.jsx(Nn,{children:te(Te||"—")}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}const ye=$K(he),we=Number(he.count),xe=he.status==="refreshed"?r("远程目录已更新,「来源」列会显示为「远程」"):he.message||(he.fixed?r("这家用固定模型清单,无可刷新"):r("本次没有取到新内容"));return s.jsxs(kl,{children:[s.jsx(Nn,{children:Ce(ve.label)}),s.jsx(Nn,{children:re(ve.provider,he.accountId)}),s.jsx(Nn,{children:s.jsx(ze,{variant:ye.variant,children:ye.label})}),s.jsx(Nn,{children:te(we?r("{n} 个",{n:we}):"—")}),s.jsx(Nn,{children:s.jsx("span",{className:"text-[11.5px] leading-[1.5] text-muted-foreground",children:xe})}),s.jsx(Nn,{children:te(FK(he))}),s.jsx(Nn,{children:ke(ve)})]},ve.provider)}):fe(r("还没有可刷新的提供商:先在账号页添加一个账号"))}return s.jsx(Qt,{open:!0,onOpenChange:(ve,he)=>{if(!ve){if(T){he.cancel();return}t()}},children:s.jsxs(Zt,{className:o?"w-[min(552px,calc(100vw-48px))]":"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("获取模型 — {name}",{name:c})})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:F}),o&&s.jsxs(Ci,{className:"w-[240px] flex-none",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID…"),autoComplete:"off",value:B,onChange:ve=>z(ve.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),s.jsx("div",{className:"mr-auto"}),o&&s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",size:"sm",onClick:ee,children:r("全选未添加")}),s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_(new Set),children:r("清空")})]}),s.jsx(se,{variant:"outline",size:"sm",title:r("刷新全部家(逐家打上游)"),disabled:T,onClick:()=>{ae()},children:r(w==="load"?"获取中…":D?"重新获取":"获取模型")})]}),s.jsxs(Ky,{id:o?b2.custom:b2.intl,className:"table-fixed",containerClassName:"max-h-[min(48vh,460px)]",children:[s.jsx("colgroup",{children:(o?s0:n0).map(ve=>s.jsx("col",{"data-col":ve,className:o?LK[ve]:_K[ve]},ve))}),s.jsx(yE,{children:s.jsx(kl,{children:(o?s0:n0).map(ve=>s.jsx(jE,{"data-col":ve,children:zK[ve]},ve))})}),s.jsx(Yy,{className:"[&_tr:last-child>td]:border-b-0",children:o?de():Ee()})]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:b}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:ge,children:r(o?"取消":"完成")}),o&&s.jsx(se,{variant:"default",disabled:!O.size||T,onClick:()=>{ie()},children:w==="import"?r("导入中…"):O.size?r("导入选中的 {n} 个模型",{n:O.size}):r("导入")})]})]})})}let cp=null,_u=null;function C2(){cp&&(cp.unmount(),cp=null),_u&&(_u.remove(),_u=null)}function YK(e){e?.providerId&&(C2(),_u=document.createElement("div"),document.body.append(_u),cp=vn.createRoot(_u),cp.render(s.jsx(KK,{options:e,onClose:C2})))}window.wbModelsFetchModal={open:YK};const Mo=(e,t)=>t?`${e} ta-${t}`:e;function T2(e,t){const a=(t||"").trim();if(a)return sp().find(o=>Oo(o.provider,e)&&Oo(o.id,a))}const XK="[.pv-row:hover_&_[data-slot=nav-item-count]]:invisible";function QK(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));return t?`${t[1]}x`:String(e||"")}function E2(e){const t=/x\s*([\d.]+)/i.exec(String(e||""));if(!t)return null;const a=Number(t[1]);return Number.isFinite(a)?a:null}const ZK={workbuddy:250,"workbuddy-intl":295,raccoon:60,catpaw:85,autoclaw:250,"autoclaw-intl":295,qoder:330,"qoder-intl":350,"cline-free":200,"cline-pass":200,codearts:210,loomy:155,kuku:15,accio:320,"accio-intl":335,trae:170,zcode:285};function WK(e){const t=ZK[e];if(t!==void 0)return t;let a=0;for(let o=0;o>>0;return a%360}function JK(e){const t=String(e||"").trim();if(!t)return"?";const a=t.match(/[A-Za-z]/);return(a?a[0]:t[t.length-1]).toUpperCase()}const eY=e=>({"--av-h":String(WK(e))}),l0=s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"})]})});function tY(e){if(!e)return"";const t=Wt().wbPresetProviders?.list;if(!Array.isArray(t))return"";const a=t.find(o=>o.name===e);return a&&Wt().wbPresetProviders?.iconOf?.(String(a.key||""))||""}function nY(e,t){return es(e)?tY(t):gg[e==="workbuddy-intl"?"workbuddy":e]||""}function Lu(e,t,a){const o=a?"":nY(e,t),c=e==="all"||e==="custom-all";return s.jsx("span",{className:Ue("pv-ico",c&&"mute",o&&"img"),style:o?void 0:eY(e),"aria-hidden":"true",children:o?s.jsx("img",{src:o,alt:""}):a??JK(t)})}const sY={supportsToolCall:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),supportsImages:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),supportsVideo:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M10 8.5l6 3.5-6 3.5z"})]})}),supportsReasoning:s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),s.jsx("path",{d:"M9 18h6M10 22h4"})]})})};function rY(e,t,a,o){return o==="enabled"&&!ap(e)||o==="disabled"&&ap(e)||o==="mapped"&&!(e.aliases||[]).length||a!=="all"&&(e.provider||"")!==a?!1:t?[e.id,e.name,...e.aliases||[]].join(" ").toLowerCase().includes(t):!0}function aY(){const e=x.useSyncExternalStore(Y7,ep),t=$g(e),a=es(t)||t==="custom-all",[o,c]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(new Set),v=a&&!Iu()&&$w()&&!Ao(t);x.useEffect(()=>{tK(),qg(),ZM(),Wt().wbApp?.currentPage==="gateway"&&s2().then(()=>Wt().wbProviders?.refreshCustom?.()).then(()=>{Gi()})},[]),x.useEffect(()=>{xK()});const y=Gw(),b=Array.isArray(y.models)?y.models:[],j=e.search.trim().toLowerCase(),w=b.filter(G=>rY(G,j,t,e.stateFilter)),k=e.sort,S=n2(),N=S.length,T=t==="all"?r("全部"):t==="custom-all"?r("自定义 · 全部"):a?String(Ao(t)?.name||t):Kw().get(t)?.label||Jw(t),D=b.filter(ap).length,C=b.filter(G=>(G.aliases||[]).length>0).length,A=cg(w.length,"models"),R=b.filter(G=>p.has(Yi(G))),I=(G,W)=>{const le=new Set(p);W?le.add(G):le.delete(G),h(le)},P=w.map(Yi),O=P.length>0&&P.every(G=>p.has(G)),_=P.some(G=>p.has(G)),L=s.jsx(Dr,{checked:O,indeterminate:!O&&_,disabled:!P.length,"aria-label":r("全选当前筛选结果"),title:r("全选当前筛选出的模型(跨分页);再点取消"),onCheckedChange:G=>{const W=new Set(p);for(const le of P)G===!0?W.add(le):W.delete(le);h(W)}});function H(){const G=Kw(),W=$i(),le=Z7(),M=[...G.values()].reduce((ce,J)=>ce+J.n,0),U=r("全部({n} 家)",{n:G.size}),Z=[...le.values()].reduce((ce,J)=>ce+J.n,0),ae=r("全部({n} 家)",{n:[...le.values()].filter(ce=>ce.n>0).length});return s.jsxs("aside",{className:"prov-rail",id:"prov-rail","aria-label":r("按提供商选择"),children:[s.jsxs("div",{className:"rail-scroll",children:[s.jsx("div",{className:"rail-label",children:r("内置提供商")}),s.jsx(au,{active:t==="all","data-provider":"all",title:U,count:M,icon:Lu("all","",l0),className:"shadow-none",onClick:()=>lp("all"),children:U}),[...G].map(([ce,J])=>s.jsx(au,{active:t===ce,"data-provider":ce,title:J.label,count:J.n,icon:Lu(ce,J.label),className:"shadow-none",onClick:()=>lp(ce),children:J.label},ce)),s.jsx("div",{className:"rail-label",children:r("自定义提供商")}),W.length?[...Z>0?[s.jsx(au,{active:Iu(),"data-provider":"custom-all",title:ae,count:Z,icon:Lu("custom-all","",l0),className:"shadow-none",onClick:()=>lp("custom-all"),children:ae},"custom-all")]:[],...W.map(ce=>{const J=String(ce.id||""),ie=String(ce.name||J);return s.jsxs("div",{className:"pv-row",children:[s.jsx(au,{active:t===J,"data-provider":J,title:ie,count:le.get(J)?.n??0,icon:Lu(J,ie),className:Ue("shadow-none",XK),onClick:()=>lp(J),children:ie}),s.jsx("button",{type:"button",className:"pv-del","aria-label":r("删除自定义提供商"),title:r("删除这个自定义提供商(连同名下账号)"),onClick:()=>{uK(J)},children:"×"})]},J)})]:s.jsx("div",{className:"rail-empty",children:r("还没有自定义提供商")})]}),s.jsx("div",{className:"rail-foot",children:s.jsx(au,{variant:"add",id:"rail-add-custom",title:r("新建一个自定义提供商(同时创建它的第一个账号)"),onClick:()=>dK(),children:r("+ 新建自定义提供商")})})]})}function B(G,W,le,M){const U=e0(G,W,le);return s.jsx(se,{variant:U?"secondary":"dashed",size:"2xs",disabled:M,className:"font-mono font-bold shadow-none",title:U?r("思考等级 {level}(点击修改)",{level:U}):r("设置思考等级(当前未绑定)"),onClick:()=>a2({alias:G,target:W,provider:le}),children:U||r("+等级")})}function z(G){const W=G.provider||"",le=Pu(G),[M,...U]=le;async function Z(ce){await Wt().wbConfirm?.ask?.({title:r("删除映射"),html:r("确定删除映射「{alias} → {target}」?",{alias:zw(ce),target:zw(G.id)}),okText:r("删除"),okClass:"danger"})&&Zw(Ww(ce,G.id,W),()=>nK(W,ce,G.id),r("映射已删除"))}const ae=ce=>{const J=ce.alias,ie=ce.enabled!==!1,ge=e.pending.has(Ww(J,G.id,W));return s.jsxs("span",{className:Ue("alias",!ie&&"map-off"),children:[s.jsx(us,{size:"sm",checked:ie,disabled:ge,title:r(ie?"映射已启用,点击关闭":"映射已关闭,点击启用"),"aria-label":r("{action}映射 {alias}",{action:r(ie?"关闭":"启用"),alias:J}),onCheckedChange:ee=>{Zw(Ww(J,G.id,W),()=>Yg(W,J,G.id,{enabled:ee}),r(ee?"映射已启用":"映射已关闭"))}}),s.jsx("span",{className:"t","data-copy":J,title:r("点击复制:{name}",{name:J}),children:J}),ce.isDefault?s.jsx("span",{className:"binding-default",children:r("默认")}):null,B(J,G.id,W,ge),ce.isDefault?null:s.jsx(se,{variant:"ghost",size:"icon-2xs",className:"text-[12px] leading-none",disabled:ge,title:r("删除映射 {alias}",{alias:J}),onClick:()=>{Z(J)},children:"×"})]},`${J}${ce.isDefault?"d":"m"}`)};return s.jsxs("div",{className:"aliases",children:[s.jsxs("div",{className:"alias-row",children:[M?ae(M):null,s.jsx(se,{variant:"dashed",size:"xs",onClick:()=>a2({target:G.id,provider:W}),children:r("+ 映射")})]}),U.map(ae)]})}function Q(G){if(G.source==="manual")return s.jsxs("span",{className:"src manual",title:r("手动登记的上游模型;移除它会直接删掉这条登记"),children:[s.jsx("i",{"aria-hidden":"true"}),r("手动")]});if(!G.source&&es(G.provider))return s.jsxs("span",{className:"src manual",title:r("用户登记的自定义模型;整份清单只属于这一家"),children:[s.jsx("i",{"aria-hidden":"true"}),r("自定义")]});if(G.source!=="remote"&&G.source!=="builtin")return s.jsx("span",{className:"rate",children:"—"});const W=G.source==="remote",le=F7(Number(G.refreshedAt)||0),M=W?le?r("来自上游目录接口,清单拉取于 {at};刷新失败时保留上一份成功结果",{at:le}):r("来自上游目录接口;刷新失败时保留上一份成功结果"):r("上游目录尚未拉到,用的是内置静态清单;点「刷新模型清单」可重试");return s.jsxs("span",{className:Ue("src",W?"remote":"builtin"),title:M,children:[s.jsx("i",{"aria-hidden":"true"}),r(W?"远程":"内置")]})}function K(G){const W=_w(G),le=Pw(G.capOverrides),M=typeof W.maxInputTokens=="number"?W.maxInputTokens:null,U=typeof W.maxOutputTokens=="number"?W.maxOutputTokens:null,Z=r("上下文窗口 {input} / 最大输出 Token {output} —— 点击修改模型能力",{input:Qf(M),output:Qf(U)})+X(G);return s.jsxs("button",{type:"button",className:"caps-open",title:Z,onClick:()=>l2(G.provider||"",G.id),children:[s.jsxs("span",{className:Ue("cap-num",M===null&&"unset",Mu(G,"maxInputTokens")==="modelsdev"&&"filled"),children:[MM(M),le.includes("maxInputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]}),s.jsx("span",{className:"cap-sep",children:"/"}),s.jsxs("span",{className:Ue("cap-num",U===null&&"unset",Mu(G,"maxOutputTokens")==="modelsdev"&&"filled"),children:[MM(U),le.includes("maxOutputTokens")?s.jsx("i",{className:"cap-mark",title:r("已覆盖上游值")}):null]})]})}function X(G){const W=["maxInputTokens","maxOutputTokens"].filter(le=>Mu(G,le)==="modelsdev").map(le=>Ou[le]);return W.length?r(";其中 {keys} 由 models.dev 补齐",{keys:W.join(r("、"))}):""}function q(G){const W=_w(G),le=Pw(G.capOverrides);return s.jsx("button",{type:"button",className:"caps-open caps-badges",title:r("对下游声明的能力(工具调用 / 图片识别 / 视频识别 / 支持思考)—— 点击修改"),onClick:()=>l2(G.provider||"",G.id),children:RM.map(M=>{const U=W[M]??null,Z=Lw(U),ae=le.includes(M),ce=Mu(G,M);return s.jsxs("span",{className:Ue("cap-dot",Z,ce==="modelsdev"&&"filled",ae&&"marked"),title:I7(M,U,ae,ce),children:[sY[M],ae?s.jsx("i",{className:"cap-mark"}):null]},M)})})}function $(G,W,le){async function M(){await Wt().wbConfirm?.ask?.({title:r("移除自定义模型"),html:r("确定移除自定义模型「{id}」?这条登记会被直接移除,之后 /v1/models 不再广告它、请求它也会被拒。",{id:zw(W.id)}),okText:r("移除"),okClass:"danger"})&&Zw(Yi(W),()=>r2(W.provider||"",W.id),es(W.provider||"")?r("模型已移除"):r("自定义模型已移除"))}switch(G.key){case"check":return s.jsx("td",{className:Mo("cell-check",G.align),children:s.jsx(Dr,{checked:p.has(Yi(W)),title:r("勾选后可批量操作"),"aria-label":r("勾选后可批量操作"),onCheckedChange:U=>I(Yi(W),U===!0)})});case"model":return s.jsxs("td",{className:Mo("cell-model",G.align),children:[s.jsx("div",{className:"mid",children:s.jsx("span",{className:"t","data-copy":W.id,title:r("点击复制:{name}",{name:W.id}),children:W.id})}),W.name&&W.name!==W.id?s.jsx("div",{className:"mname",children:W.name}):null]});case"rate":return s.jsx("td",{className:Mo("cell-rate",G.align),children:s.jsx("span",{className:"rate",children:W.credits?QK(W.credits):"—"})});case"source":return s.jsx("td",{className:Mo("cell-source",G.align),children:Q(W)});case"budget":return s.jsx("td",{className:Mo("cell-budget",G.align),children:K(W)});case"caps":return s.jsx("td",{className:Mo("cell-caps",G.align),children:q(W)});case"alias":return s.jsx("td",{className:Mo("cell-alias",G.align),children:z(W)});case"act":{const U=RK(W.provider||""),Z=W.source==="manual"||es(W.provider||"");return s.jsx("td",{className:Mo("cell-act r",G.align),children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{variant:"ghost",size:"sm",disabled:!!U,title:U||r("以这个上游模型发一次最小请求,走真实转发链路"),onClick:()=>c({provider:W.provider||"",id:W.id}),children:r("测试")}),Z?s.jsx(se,{variant:"ghost",size:"sm",className:"text-destructive",disabled:le,onClick:()=>{M()},children:r("移除")}):null]})})}default:return null}}function Y(G){const W=e.pending.has(Yi(G)),le=p.has(Yi(G));return s.jsx("tr",{className:Ue(le&&"sel"),children:S.map(M=>s.jsx(x.Fragment,{children:$(M,G,W)},M.key))},`${G.provider||""}${G.id}`)}function F(){if(!b.length){const Z=a?$w()?Iu()?r("自定义提供商还没有模型:先在左栏选一家,点「添加模型」登记,或「获取上游模型」从上游拉取"):r(v?"该提供商已不存在(可能已被删除),请刷新列表":"这家还没有模型:点「添加模型」登记,或「获取上游模型」从上游拉取"):r("加载中…"):e.data?r("暂无模型(请先添加账号)"):r("加载中…");return s.jsx("tr",{children:s.jsx("td",{colSpan:N,className:"empty",children:Z})})}if(!w.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:N,className:"empty",children:j?r("没有匹配「{keyword}」的模型",{keyword:j}):r("没有匹配当前筛选的模型")})});const G=t==="all"||Iu(),W=G&&!j&&e.stateFilter==="all"&&!A.paged,le=new Map;for(const Z of w){const ae=Z.provider||"";le.has(ae)||le.set(ae,{label:Z.providerLabel||ae||r("未知"),items:[]}),le.get(ae)?.items.push(Z)}const M=[];let U=0;for(const[Z,ae]of le){ae.items.sort((te,Ce)=>{const re=+!ap(te)-+!ap(Ce);if(re!==0||k==="default")return re;const de=E2(te.credits),ke=E2(Ce.credits);return de===null||ke===null?de===ke?0:de===null?1:-1:k==="rate-asc"?de-ke:ke-de});const ce=e.expanded.has(Z)||!W,J=ce?ae.items:ae.items.slice(0,qM),ie=ae.items.length-J.length,ge=A.paged?Math.max(0,A.rangeStart-1-U):0,ee=A.paged?Math.min(J.length,A.rangeEnd-U):J.length,fe=ge0?r("(续)"):"",r("{n} 个模型",{n:ae.items.length})]})},`group:${Z}`));for(const te of fe)M.push(Y(te));U+=J.length,ie>0?M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:N,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>aK(Z),children:r("展开其余 {n} 个模型 ▾",{n:ie})})})},`more:${Z}`)):ce&&W&&ae.items.length>qM&&M.push(s.jsx("tr",{className:"tr-more",children:s.jsx("td",{colSpan:N,children:s.jsx(se,{variant:"ghost",size:"sm",onClick:()=>lK(Z),children:r("收起 ▴")})})},`collapse:${Z}`))}return M}return s.jsxs(s.Fragment,{children:[s.jsx("section",{className:"panel",children:s.jsxs("div",{className:"mm",children:[H(),s.jsxs("div",{className:"mm-main",children:[s.jsxs("div",{className:"panel-head",children:[s.jsxs("div",{className:"mm-titlebar",children:[s.jsxs("div",{className:"mm-title",children:[t==="all"||t==="custom-all"?Lu(t,"",l0):Lu(t,T),s.jsx("h2",{children:T}),s.jsxs("span",{className:"mm-meta",children:[s.jsx("b",{children:b.length}),r(" 个模型 · 已启用 "),s.jsx("b",{children:D}),r(" · 有映射 "),s.jsx("b",{children:C})]})]}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-refresh-models",title:es(t)?r("从这一家的上游拉一份模型清单,勾选要哪些再导入(已添加的不会重复导入)"):r("刷新模型管理页里各提供商的远程模型目录,逐家结果列在弹窗里"),onClick:()=>i2(),children:r("获取模型")}),s.jsx(se,{id:"btn-add-custom-model",variant:"outline",size:"sm",onClick:()=>pK(),children:r("+ 添加模型")})]})]}),s.jsxs("div",{className:"mm-filters",children:[s.jsx(In,{options:q7,value:e.stateFilter,onValueChange:oK,"aria-label":r("按状态筛选"),className:"shrink-0"}),s.jsx(In,{options:K7,value:e.sort,onValueChange:iK,"aria-label":r("按倍率排序"),className:"shrink-0"}),s.jsxs(Ci,{className:"w-full min-[768px]:w-[240px] flex-none min-[768px]:flex-none",id:"models-search",children:[s.jsx(Ei,{type:"search",placeholder:r("搜索模型 ID / 名称 / 映射名…"),"aria-label":r("搜索模型"),autoComplete:"off",value:e.search,onChange:G=>cK(G.currentTarget.value)}),s.jsx(Ti,{"aria-hidden":"true",children:"⌕"})]}),R.length>0?s.jsxs("span",{className:"batch-chip",children:[r("已选 "),s.jsx("b",{children:R.length}),r(" 个"),s.jsx(se,{id:"btn-batch-models",variant:"outline",size:"xs",title:r("对选中的 {n} 个模型执行批量操作",{n:R.length}),onClick:()=>f(!0),children:r("批量操作")})]}):null]})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",ref:G=>gK(G),children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"c-check","data-col":"check"}),s.jsx("col",{className:"c-model","data-col":"model"}),s.jsx("col",{className:"c-rate","data-col":"rate"}),s.jsx("col",{className:"c-source","data-col":"source"}),s.jsx("col",{className:"c-budget","data-col":"budget"}),s.jsx("col",{className:"c-caps","data-col":"caps"}),s.jsx("col",{className:"c-alias","data-col":"alias"}),s.jsx("col",{className:"c-act","data-col":"act"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{"data-col":"check",children:L}),s.jsx("th",{"data-col":"model",children:r("上游模型")}),s.jsx("th",{"data-col":"rate",children:r("倍率")}),s.jsx("th",{"data-col":"source",children:r("来源")}),s.jsxs("th",{"data-col":"budget",children:[r("上下文 / 输出"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("数字带虚线底 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;— = 未声明。点任意一格可改。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"caps",children:[r("能力"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("圆点带内侧描边 = 由 models.dev 补齐;右上角小点 = 你手动覆盖过;虚线圈 = 未声明。悬停某一枚可看逐项出处。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsxs("th",{"data-col":"alias",children:[r("模型映射"),s.jsx("span",{className:"th-help","aria-hidden":"true",title:r("每条映射 = 对外名 → 上游模型;原始 ID 与别名有独立开关,默认绑定永远存在(没有映射时是合成的那条)。"),children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 16v-4"}),s.jsx("path",{d:"M12 8h.01"})]})})})]}),s.jsx("th",{className:"r","data-col":"act",children:r("操作")})]})}),s.jsx("tbody",{id:"models",children:F()})]})}),s.jsx(Li,{className:"models-panel-foot",leading:Iu()?s.jsxs(s.Fragment,{children:[r("这里是"),s.jsx("b",{children:r("全部自定义提供商")}),r("的模型合集:每家的清单互相独立,别名也只在自己那家内生效;要改名称 / 协议 / Base URL,到账号页该家账号的「设置」→ 提供商一栏。")]}):a?s.jsxs(s.Fragment,{children:[r("自定义提供商的清单"),s.jsx("b",{children:r("只属于这一家")}),r(":这里的模型不会出现在其他家,别名也只在这一家内生效。改名称 / 协议 / Base URL 在账号页该家账号的「设置」→ 提供商一栏;整家不要了,鼠标移到左栏这家上点 × 删除(连同名下账号)。")]}):void 0,total:w.length,range:A.paged?{start:A.rangeStart,end:A.rangeEnd}:null,page:A.page,pageCount:A.pageCount,size:A.size,onSizeChange:A.setSize,onPageChange:A.goto})]})]})}),e.mapping?s.jsx(oY,{context:e.mapping,onClose:fK}):null,e.customModel?s.jsx(iY,{initial:e.customModel,onClose:mK}):null,e.capability?s.jsx(wK,{context:e.capability,onClose:hK}):null,o?s.jsx(DK,{target:o,onClose:()=>c(null)}):null,d?s.jsx(PK,{models:R,onClose:()=>f(!1),onDone:()=>{h(new Set),f(!1)}}):null]})}const lY=r("绑定在「对外名 → 上游模型」这一条映射上的思考等级(列表照抄 OmniProxy 的手动绑定),选「不覆盖」表示不给这条映射指定等级。它会跟着这条映射注入转发,由承载的那家翻译成自己的档位字段(CatPaw 归并成 low/high/max,Qoder 按模型声明的档位归一)。以下几种情况故意不注入:① off / none(关闭思考)—— 本项目没有安全的表达方式;② 表外的自定义等级(各家能力范围不同,无法判断上游收不收);③ 客户端请求体里已经自己指定了档位(那是更明确的意图,绑定不覆盖);④ 这家上游不认识档位字段(如 WorkBuddy / 小浣熊 / AutoClaw / Cline)。注入与跳过都会写进详细日志。");function A2(e,t,a){const o=t2(e),c=(t||"").trim(),d=o.find(f=>f.id.toLowerCase()===c.toLowerCase());return d?d.id:c||o[0]?.id||""}function oY({context:e,onClose:t}){const a=!!e.alias,[o,c]=x.useState(()=>e.provider||Yw()[0]?.id||""),[d,f]=x.useState(e.alias||""),[p,h]=x.useState(()=>A2(o,e.target)),[v,y]=x.useState(""),[b,j]=x.useState(!1),[w,k]=x.useState(()=>{const _=Wf(ep().data,T2(o,p)),L=a?e0(e.alias,e.target,e.provider):"";return L&&_.includes(L)?{select:L,custom:""}:{select:L?ca:"",custom:L}}),S=Wf(ep().data,T2(o,p)),N=(()=>{const _=Yw();for(const L of[e.provider,o])L&&!_.some(H=>H.id===L)&&_.push({id:L,label:Wt().wbProviders?.labelOf?.(L)||L});return _})(),T=(()=>{const _=t2(o),L=(p||"").trim();return L&&!_.some(H=>H.id.toLowerCase()===L.toLowerCase())&&_.unshift({id:L,label:r("{name}(不在该家当前清单里)",{name:L}),off:!0}),_})(),D=N.find(_=>_.id===o)?.label||o||r("(全局)"),C=w.select&&w.select!==ca&&!S.includes(w.select)?{select:ca,custom:w.custom||w.select}:w,A=C.select===ca?C.custom.trim():C.select,R=C.select===ca;function I(_){c(_),h(A2(_,p))}async function P(){if(b)return;const _=a?e.alias||"":d.trim(),L=p;if(!_){y(r("请填写对外映射名"));return}if(!L){y(r("该提供商当前没有可选的上游模型"));return}if(!o){y(r("请选择提供商"));return}if(!a&&Oo(_,L)&&sp().some(H=>Oo(H.id,L)&&Oo(H.provider,o))){y(r("原始 ID 已作为默认绑定,请直接使用该绑定的开关或等级按钮"));return}j(!0),y(r("保存中…"));try{Ki(await Yg(o,_,L,{reasoning:A})),j(!1),t();const H=A?r(" · 思考等级 {level}",{level:A}):"",B=Wt().wbProviders?.labelOf?.(o)||o;wr(a?r("✅ 已更新 {name} 的思考等级",{name:_}):r("✅ 已添加映射 {name} → {target}({label}){suffix}",{name:_,target:L,label:B,suffix:H}))}catch(H){y(r("保存失败:{message}",{message:Ro(H)})),j(!1)}}const O=_=>{_.key==="Enter"&&(_.preventDefault(),P())};return s.jsx(Qt,{open:!0,onOpenChange:(_,L)=>{if(!_){if(b){L.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"设置思考等级":"添加模型映射")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-provider",children:r("提供商")}),s.jsxs(ft,{value:o,disabled:!0,onValueChange:_=>I(String(_)),children:[s.jsx(mt,{id:"mapping-provider",className:"w-full",children:s.jsx(pt,{children:N.find(_=>_.id===o)?.label||o})}),s.jsx(ht,{children:N.map(_=>s.jsx(qe,{value:_.id,children:_.label},_.id))})]})]}),s.jsxs("div",{className:"grid grid-cols-[1fr_24px_1fr] items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-alias",children:r("对外映射名(下游请求时用)")}),s.jsx(Fe,{id:"mapping-alias",maxLength:128,placeholder:r("例如 gpt-4o"),autoComplete:"off",autoFocus:!a,value:d,disabled:a,onChange:_=>f(_.currentTarget.value),onKeyDown:O})]}),s.jsx("div",{className:"pb-2 text-center text-muted-foreground",children:"→"}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"mapping-upstream",children:r("转发到上游模型")}),s.jsxs(ft,{value:p,disabled:!0,onValueChange:_=>h(String(_)),children:[s.jsx(mt,{id:"mapping-upstream",className:"w-full",children:s.jsx(pt,{children:T.find(_=>_.id===p)?.label||p})}),s.jsx(ht,{children:T.map(_=>s.jsxs(qe,{value:_.id,children:[_.label,_.off?r("(已禁用)"):""]},_.id))})]})]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("下游请求 "),s.jsx("b",{className:"text-primary-fg",children:d.trim()||r("<对外名>")}),r(" → 转发")," ",s.jsx("b",{className:"text-primary-fg",children:p||r("<上游模型>")}),r("({label})",{label:D}),A?s.jsxs(s.Fragment,{children:[r(" · 思考等级 "),s.jsx("b",{className:"text-primary-fg",children:A})]}):null]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-[7px]",children:[s.jsx(Je,{htmlFor:"mapping-reasoning",children:r("思考等级")}),s.jsxs(Ii,{children:[s.jsx(Pi,{render:s.jsx("span",{className:"tip-q",tabIndex:0,"aria-label":r("思考等级的注入规则")}),children:"?"}),s.jsx(_i,{children:lY})]})]}),s.jsxs(ft,{value:C.select,onValueChange:_=>{const L=String(_);k(H=>({...H,select:L}))},children:[s.jsx(mt,{id:"mapping-reasoning",className:"w-full",autoFocus:a,children:s.jsx(pt,{children:C.select===ca?r("自定义等级…"):C.select||r("不覆盖")})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:r("不覆盖")}),S.map(_=>s.jsx(qe,{value:_,children:_},_)),s.jsx(qe,{value:ca,children:r("自定义等级…")})]})]}),R?s.jsx(Fe,{id:"mapping-reasoning-custom",maxLength:32,autoFocus:!0,placeholder:r("自定义等级(例如 custom-high)"),autoComplete:"off",disabled:b,value:C.custom,onChange:_=>k(L=>({...L,custom:_.currentTarget.value})),onKeyDown:O}):null]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("对外名可自由命名,允许与上游模型 ID 同名(同名时该上游的原生路由优先,映射作兜底); 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。同一对外名可在多个提供商各添加一条: 下游用同一个名字请求,网关按账号优先级主备切换,失败自动落到下一个提供商。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:b,onClick:()=>{P()},children:r(a?"保存等级":"保存映射")})]})]})})}function iY({initial:e,onClose:t}){const[a,o]=x.useState(e.provider),[c,d]=x.useState(""),[f,p]=x.useState(""),[h,v]=x.useState(!1),y=(()=>{const S=eK();return a&&!S.some(N=>N.id===a)&&S.push({id:a,label:Wt().wbProviders?.labelOf?.(a)||a}),S})(),b=y.some(S=>S.id===a)?a:y[0]?.id||"",j=y.find(S=>S.id===b)?.label||b||r("(未选)");async function w(){if(h)return;const S=c.trim();if(!b){p(r("请选择提供商"));return}if(!S){p(r("请填写上游模型 ID"));return}v(!0),p(r("保存中…"));try{const N=await sK(b,S);Ki(N),v(!1),t();const T=y.find(D=>D.id===b)?.label||b;if(es(Du()))wr(r("✅ 已登记模型 {name}({label})",{name:S,label:T}));else{const D=N;Array.isArray(D?.models)&&D.models.some(A=>A.id===S&&(A.provider||"")===b)?wr(r("✅ 已登记自定义模型 {name}({label})",{name:S,label:T})):wr(r("✅ 已登记 {name}({label}),但该提供商还没有可用账号,这一行要加上账号后才会显示",{name:S,label:T}),"err")}}catch(N){p(r("保存失败:{message}",{message:Ro(N)})),v(!1)}}const k=S=>{S.key==="Enter"&&(S.preventDefault(),w())};return s.jsx(Qt,{open:!0,onOpenChange:(S,N)=>{if(!S){if(h){N.cancel();return}t()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("添加自定义模型")})}),s.jsxs(Bt,{children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-provider",children:r("提供商")}),s.jsxs(ft,{value:b,disabled:e.locked,onValueChange:S=>o(String(S)),children:[s.jsx(mt,{id:"custom-model-provider",className:"w-full",children:s.jsx(pt,{children:j})}),s.jsx(ht,{children:y.map(S=>s.jsx(qe,{value:S.id,children:S.label},S.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"custom-model-id",children:r("上游模型 ID")}),s.jsx(Fe,{id:"custom-model-id",maxLength:128,placeholder:r("例如 gpt-5.5-preview"),autoComplete:"off",spellCheck:!1,autoFocus:!0,value:c,onChange:S=>d(S.currentTarget.value),onKeyDown:k})]}),s.jsxs("div",{className:"rounded-md border border-border bg-surface-inset px-3 py-2.5 font-mono text-[12px] text-subtle",children:[r("在 "),s.jsx("b",{className:"text-primary-fg",children:j}),r(" 上登记上游模型")," ",s.jsx("b",{className:"text-primary-fg",children:c.trim()||r("<上游模型 ID>")}),r("(登记后即可用这个名字请求)")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("填上游真正认识的那个模型 ID(不是给下游用的名字)。登记后它会进入该家的模型清单: 表格里出现这一行、"),s.jsx("code",{children:"/v1/models"}),r(" 会广告它、请求它也会被转发到这家。 支持字母、数字与 "),s.jsx("code",{children:"- _ . / :"}),r("。")]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("「来源」列会标成"),s.jsx("b",{children:r("手动")}),r(",与远程目录 / 内置清单区分开。删除自定义模型是"),s.jsx("b",{children:r("直接移除")}),r("这条登记(不像内置模型那样只是隐藏),因为它的存在完全由这次登记决定。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:f})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:h,onClick:()=>{w()},children:r("保存")})]})]})})}const R2='.page[data-page="gateway"]';let o0=null;function O2(){if(o0)return;const e=document.querySelector(R2);e&&(e.replaceChildren(),o0=vn.createRoot(e),o0.render(s.jsx(aY,{})))}document.querySelector(R2)?O2():document.addEventListener("DOMContentLoaded",O2,{once:!0});const M2=3065;function cY(){if(el().workbuddyDesktop?.platform!=="web")return null;const e=typeof window>"u"?"":window.location?.origin;return e&&e!=="null"?e:null}function D2(e,t){return cY()??(e?`http://127.0.0.1:${e}`:t)}function el(){return window}function Xg(e){return e instanceof Error?e.message:String(e)}function zu(e,t){el().wbApp?.toast?.(e,t)}let up={backend:null,gatewayBase:D2(0,`http://127.0.0.1:${M2}`)};const i0=new Set;function c0(){return up}function uY(e){return i0.add(e),()=>{i0.delete(e)}}function dY(e){up=e;for(const t of i0)t()}function I2(){return up.gatewayBase.replace(/^https?:\/\//,"")}function fY(){return up.backend?.ready===!0}function P2(e){const t=(a,o)=>{const c=document.getElementById(a);c&&(c.textContent=o)};t("api-base",`${e}/v1`),t("api-chat",`POST ${e}/v1/chat/completions`),t("api-responses",`POST ${e}/v1/responses`),t("api-messages",`POST ${e}/v1/messages`),t("api-models",`GET ${e}/v1/models`)}let u0=!1;async function Bu(){if(!u0){u0=!0;try{const e=el().workbuddyDesktop;if(!e)throw new Error("后端桥不可用");const t=await e.getBackendStatus(),a=Number(t?.port)||0,o=c0(),c={backend:t??null,gatewayBase:D2(a,o.gatewayBase)};c.gatewayBase!==o.gatewayBase&&P2(c.gatewayBase),dY(c),el().wbApp?.renderTopbarStatus?.()}catch(e){console.warn("读取后端状态失败:",Xg(e))}finally{u0=!1}}}function pY(){P2(up.gatewayBase),Bu()}async function _2(e){zu(e||r("正在重启…"));try{await el().workbuddyDesktop?.restartApp()}catch(t){zu(r("重启失败:{reason}",{reason:Xg(t)}),"err")}}const mY={idle:r("结束占用进程"),querying:r("查询中…"),ending:r("结束中…")};function hY({container:e}){const{backend:t,gatewayBase:a}=x.useSyncExternalStore(uY,c0),[o,c]=x.useState("idle"),d=t?.failure||null,f=I2(),p=t?.ready;let h="live off",v=r("正在检查… · {port}",{port:f});p===!0?(h="live pulse",v=r("网关运行中 · {port}",{port:f})):d?(h="live bad",v=r("{label} · {port}",{label:d.label||r("网关启动失败"),port:f})):p===!1&&(v=r("网关启动中… · {port}",{port:f}));const y=d?d.message??"":p===!0?r("本地网关正在监听 {url},可直接调用 OpenAI 兼容接口",{url:a}):r("正在确认网关是否已就绪");x.useEffect(()=>{Bu()},[]),x.useEffect(()=>{const j=el().workbuddyDesktop?.onBackendError?.(()=>{Bu()});return typeof j=="function"?j:void 0},[]),x.useEffect(()=>{e.title=y},[e,y]);async function b(){if(o!=="idle")return;const j=el().workbuddyDesktop;if(j){c("querying");try{const w=await j.getPortOccupant(),k=w?.occupant;if(!k){zu(r("端口 {port} 上没有查到监听进程,请改用「更换端口」",{port:w?.port??""}),"err");return}const S=[r("即将结束以下进程:"),"",r("进程名:{name}",{name:String(k.name)}),r("PID:{pid}",{pid:String(k.pid)}),r("路径:{path}",{path:k.path||r("(未知)")}),"",r("结束它会强制退出该程序未保存的数据。确认继续?")],N=el().wbConfirm?.ask;if(!N||!await N({title:r("结束占用端口的进程"),text:S.join(` +`),okText:r("结束进程"),okClass:"danger"}))return;c("ending"),(await j.endPortOccupant())?.released?(zu(r("已结束进程 {name}(PID {pid}),端口已释放",{name:String(k.name),pid:String(k.pid)})),await N({title:r("重启程序"),text:r("端口已释放。现在重启程序让网关用这个端口启动?"),okText:r("重启")})?await _2(r("重启中…")):await Bu()):(zu(r("进程已结束,但端口仍被占用,建议改用「更换端口」"),"err"),await Bu())}catch(w){zu(r("结束失败:{reason}",{reason:Xg(w)}),"err")}finally{c("idle")}}}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-line",children:[s.jsx("span",{className:h}),s.jsx("span",{className:"txt",children:v})]}),d?.conflict?s.jsxs("div",{className:"status-actions",children:[d.canEndOccupant===!0?s.jsx(se,{size:"sm",disabled:o!=="idle",onClick:()=>{b()},children:mY[o]}):null,s.jsx(se,{size:"sm",onClick:()=>{bY()},children:r("更换端口")})]}):null]})}let d0=null;function L2(){if(d0)return;const e=document.getElementById("sidebar-status");e&&(e.replaceChildren(),d0=vn.createRoot(e),d0.render(s.jsx(hY,{container:e})))}const gY={idle:r("保存并重启"),checking:r("校验中…"),saving:r("保存中…")};function xY({status:e,onClose:t}){const a=Number(e?.port)||M2,[o,c]=x.useState(()=>a<65535?String(a+1):String(a-1)),[d,f]=x.useState("idle"),[p,h]=x.useState(""),[v,y]=x.useState(""),b=x.useRef(!0),j=Number(o)||0,w=e?.failure?.message||r("当前端口 {port},网关运行正常。",{port:a});async function k(){if(d!=="idle")return;const S=el().workbuddyDesktop;if(!S)return;const N=Number(o)||0;if(!N||N<1024||N>65535){y(r("端口需在 1024-65535 之间"));return}f("checking"),y(""),h("");try{const T=await S.checkPort(N);if(!T?.ok){h(T?.message||r("该端口不可用"));return}if(T.same){h(T.message??"");return}if(f("saving"),(await S.changePort(N))?.changed===!1){h(r("与当前端口相同,无需重启"));return}t(),await _2(r("端口已改为 {port},正在重启…",{port:N}))}catch(T){y(Xg(T))}finally{f("idle")}}return s.jsx(Qt,{open:!0,onOpenChange:S=>{S||t()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更换网关端口")})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("当前状态")}),s.jsx("p",{children:w})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("新端口")}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsx(Je,{htmlFor:"port-input",className:"text-[12.5px] whitespace-nowrap text-subtle",children:r("端口号")}),s.jsx(Fe,{id:"port-input",type:"number",min:1024,max:65535,step:1,placeholder:r("例如 3066"),autoComplete:"off",className:"max-w-[130px]",value:o,onChange:S=>{c(S.currentTarget.value)},onKeyDown:S=>{S.key==="Enter"&&k()},autoFocus:!0,onFocus:S=>{b.current&&(b.current=!1,S.currentTarget.select())}})]}),p?s.jsx("p",{children:p}):null,s.jsx("p",{children:r("端口需在 1024-65535 之间。1023 及以下是系统保留范围,普通程序无法监听。")})]}),s.jsxs(zn,{children:[s.jsx("h3",{children:r("换端口后要改的地方")}),s.jsxs("p",{children:[r("网关地址会变成 "),s.jsx("code",{children:`http://127.0.0.1:${j||"—"}`}),r("。已经把这个地址填进其它工具(Claude Code、Cherry Studio 等)的,需要一并改成新地址,否则那些工具会连不上。")]})]}),s.jsx("p",{className:"min-h-[18px] text-[11.5px] text-muted-foreground",children:v})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:d!=="idle",onClick:()=>{k()},children:gY[d]})]})]})})}let dp=null,Hu=null;function z2(){dp&&(dp.unmount(),dp=null),Hu&&(Hu.remove(),Hu=null)}async function bY(){let e=c0().backend;e||(e=await el().workbuddyDesktop?.getBackendStatus().catch(()=>null)??null),z2(),Hu=document.createElement("div"),document.body.append(Hu),dp=vn.createRoot(Hu),dp.render(s.jsx(xY,{status:e,onClose:z2}))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",L2,{once:!0}):L2(),window.wbPortPanel={render:pY,sync:Bu,portLabel:I2,isReady:fY};function vY(e){return e.source==="subscription"&&(e.port===null||e.port===void 0)}function tr(){return window}function Fn(e,t){tr().wbApp?.toast?.(e,t)}function Ra(e){return e instanceof Error?e.message:String(e)}function B2(e){return tr().wbApp?.formatTime?.(e)||""}function f0(e){const t=Number(e);return!Number.isFinite(t)||t<0?"":t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}function p0(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]||t)}function Uu(e){return String(e?.name||e?.id||"")}function H2(e){return e.source==="clash"}function fp(e){return e.source==="subscription"}function Qg(e){return H2(e)||fp(e)}function yY(e){return e.localDisabled===!0||e.enabled===!1}function U2(e){return Qg(e)&&e.enabled===!1&&e.localDisabled!==!0}function jY(e){return fp(e)&&yY(e)}function Zg(e){return fp(e)&&e.orphan===!0}function V2(e){return!Qg(e)||Zg(e)}const wY=r("来自 Clash Verge 同步(名称、端口跟随 Clash),请到 Clash Verge 中修改;启用可在本页关闭"),SY=r("该节点来自订阅(名称、端口跟随订阅与内核),请在「订阅管理」里修改;启用可在本页关闭"),F2=r("该节点所属订阅已删除,不会再被同步更新,可手动删除清理");function $2(e){return Zg(e)?F2:fp(e)?SY:wY}const NY=r("禁用后本端不再用它(引用它的账号回退直连);端口在 Clash Verge 侧,不受影响"),kY=r("禁用后本端不再用它(引用它的账号回退直连),并会关掉它的本地监听端口"),CY=r("已在本页禁用(打开开关即恢复)"),TY=r("这条在 Clash Verge 里是停用的,本页启用不生效 —— 到 Clash Verge 里打开它");function EY(e){if(Zg(e))return F2;if(e.localDisabled===!0)return CY;if(U2(e))return TY;if(fp(e))return kY;if(H2(e))return NY}let xs={data:null,loading:!1,error:"",testing:null,pending:new Set,syncing:!1,batchBusy:!1,batchProgress:null,selected:new Set};const m0=new Set;function AY(e){return m0.add(e),()=>{m0.delete(e)}}function RY(){return xs}function ns(e){xs={...xs,...e},m0.forEach(t=>t())}function Wg(){return xs.data?.items??[]}function OY(e){return xs.selected.has(e)}function MY(e,t){const a=new Set(xs.selected);t?a.add(e):a.delete(e),ns({selected:a})}function DY(e,t){const a=new Set(xs.selected);for(const o of e)t?a.add(o):a.delete(o);ns({selected:a})}function IY(){ns({selected:new Set})}function Do(e){if(!e||typeof e!="object"||!Array.isArray(e.items))return;const t=new Set(e.items.map(o=>o.id)),a=new Set([...xs.selected].filter(o=>t.has(o)));ns({data:e,error:"",selected:a})}async function pp(e=!1){const t=tr().workbuddyDesktop;if(typeof t?.getProxyPool!="function"){ns({error:r("当前环境不支持代理池(桥接方法缺失)")});return}e||ns({loading:!0});try{Do(await t.getProxyPool())}catch(a){ns({error:Ra(a)}),e||Fn(r("代理列表加载失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({loading:!1})}}async function PY(){const e=tr().workbuddyDesktop;if(typeof e?.syncClashToProxyPool!="function"){Fn(r("当前环境不支持同步(桥接方法缺失)"),"err");return}if(!xs.syncing){ns({syncing:!0});try{const t=await e.syncClashToProxyPool();Do(t),t?.syncError?Fn(r("没能同步:{reason}",{reason:t.syncError}),"err"):t?.changes?Fn(r("✅ 已同步 Clash Verge 出口({n} 项变更)",{n:t.changes})):Fn(r("已是最新,没有需要同步的变更"))}catch(t){Fn(r("同步失败:{reason}",{reason:Ra(t)}),"err")}finally{ns({syncing:!1})}}}async function _Y(e){const t=tr().workbuddyDesktop;if(typeof t?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(!xs.testing){ns({testing:e.id});try{const a=await t.testProxyPoolItem(e.id);if(a?.items&&Do({items:a.items}),a?.success){const o=f0(a.durationMs);Fn(r("✅ 「{name}」出口可用{ip}{took}",{name:Uu(e),ip:a.ip?r(" 出口 IP {ip}",{ip:a.ip}):"",took:o?` ${o}`:""}))}else Fn(r("❌ 「{name}」{error}",{name:Uu(e),error:a?.error||r("连接失败")}),"err");a?.saveError&&Fn(r("测试结果没能记下:{reason}",{reason:a.saveError}),"err")}catch(a){Fn(r("测试失败:{reason}",{reason:Ra(a)}),"err")}finally{ns({testing:null})}}}async function LY(e,t){const a=tr().workbuddyDesktop;if(typeof a?.setProxyPoolItemEnabled!="function"){Fn(r("当前环境不支持启停(桥接方法缺失)"),"err");return}const o=new Set(xs.pending);o.add(e.id),ns({pending:o});try{const c=await a.setProxyPoolItemEnabled({id:e.id,enabled:t});Do(c);const d=Uu(e),f=c?.listener??"none";Fn(t?f==="opening"?r("已启用「{name}」,正在补建监听端口(内核重建中)",{name:d}):r("已启用「{name}」",{name:d}):f==="closing"?r("已禁用「{name}」,监听端口正在关闭(内核重建中)",{name:d}):r("已禁用「{name}」",{name:d})),(f==="closing"||f==="opening")&&zY(e.id,f)}catch(c){Fn(r("保存失败:{reason}",{reason:Ra(c)}),"err")}finally{const c=new Set(xs.pending);c.delete(e.id),ns({pending:c})}}async function zY(e,t){for(let a=0;a<12;a+=1){await new Promise(d=>setTimeout(d,1500)),await pp(!0);const o=Wg().find(d=>d.id===e);if(!o)return;const c=o.port!==null&&o.port!==void 0;if(t==="closing"?!c:c)return}}async function q2(e){const t=tr().workbuddyDesktop;if(typeof t?.removeProxyPoolItem!="function")return;if(!V2(e)){Fn($2(e),"err");return}const a=e.usedBy||[],o=a.length?`

    ${r("有 {n} 个账号正在使用它({names})—— 删除后这些账号会回退直连。",{n:a.length,names:a.map(f=>p0(String(f.name||f.id||""))).join(r("、"))})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("删除代理"),html:r("确定删除「{name}」?{used}",{name:p0(Uu(e)),used:o}),okText:r("删除"),okClass:"danger"}))return;const d=new Set(xs.pending);d.add(e.id),ns({pending:d});try{const f=await t.removeProxyPoolItem(e.id);Do(f),Fn(r("已删除「{name}」",{name:Uu(e)}))}catch(f){Fn(r("删除失败:{reason}",{reason:Ra(f)}),"err")}finally{const f=new Set(xs.pending);f.delete(e.id),ns({pending:f})}}async function BY(){const e=tr().workbuddyDesktop;if(typeof e?.testProxyPoolItem!="function"){Fn(r("当前环境不支持代理测试(桥接方法缺失)"),"err");return}if(xs.batchBusy||xs.testing)return;const t=Wg().filter(f=>xs.selected.has(f.id));if(!t.length)return;ns({batchBusy:!0,batchProgress:{done:0,total:t.length}});let a=0,o=0,c="";for(const[f,p]of t.entries()){ns({testing:p.id,batchProgress:{done:f,total:t.length}});try{const h=await e.testProxyPoolItem(p.id);h?.items&&Do({items:h.items}),h?.success?a+=1:o+=1,h?.saveError&&!c&&(c=h.saveError)}catch{o+=1}}ns({testing:null,batchBusy:!1,batchProgress:null});const d=o?r("批量测试完成:{ok} 个可用、{failed} 个失败(共 {total} 个)",{ok:a,failed:o,total:t.length}):r("批量测试完成:{ok} 个可用(共 {total} 个)",{ok:a,total:t.length});Fn(o?d:`✅ ${d}`,o?"err":"ok"),c&&Fn(r("部分测试结果没能记下:{reason}",{reason:c}),"err")}async function HY(){const e=tr().workbuddyDesktop;if(typeof e?.removeProxyPoolItem!="function"||xs.batchBusy||xs.testing)return;const t=Wg().filter(k=>xs.selected.has(k.id)),a=t.filter(k=>V2(k)),o=t.length-a.length;if(!a.length){Fn(o?r("选中的 {n} 条都是同步来的只读条目(Clash / 订阅),不能删除",{n:o}):r("没有可删除的条目"),"err");return}const c=a.slice(0,8).map(k=>p0(Uu(k))).join(r("、")),d=a.length>8?r("{names} 等 {n} 条",{names:c,n:a.length}):c,f=a.filter(k=>(k.usedBy||[]).length).length,p=f?`

    ${r("其中 {n} 条正被账号使用 —— 删除后那些账号会回退直连。",{n:f})}

    `:"",h=o?`

    ${r("另有 {n} 条是同步来的只读条目(Clash / 订阅),将跳过。",{n:o})}

    `:"";if(!await tr().wbConfirm?.ask?.({title:r("批量删除代理"),html:`${r("确定删除选中的 {n} 个代理?",{n:a.length})}

    ${d}

    ${p}${h}`,okText:r("删除"),okClass:"danger"}))return;ns({batchBusy:!0,batchProgress:{done:0,total:a.length}});let y=0,b=0,j="";for(const[k,S]of a.entries()){ns({batchProgress:{done:k,total:a.length}});try{const N=await e.removeProxyPoolItem(S.id);Do(N),y+=1}catch(N){b+=1,j||(j=Ra(N))}}ns({batchBusy:!1,batchProgress:null});const w=[r("已删除 {n} 个代理",{n:y})];o&&w.push(r("跳过 {n} 个(同步只读条目)",{n:o})),b&&w.push(r("失败 {n} 个({reason})",{n:b,reason:j})),Fn(b?w.join(r(",")):`✅ ${w.join(r(","))}`,b?"err":"ok")}async function UY(e,t){const a=tr().workbuddyDesktop,o=e?{...t,id:e.id}:t,c=e?await a?.updateProxyPoolItem?.(o):await a?.createProxyPoolItem?.(o);return Do(c),c}async function G2(){const e=tr().workbuddyDesktop;if(typeof e?.getProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const t=await e.getProxySettings();if(!t||typeof t!="object")throw new Error(r("代理设置响应异常"));return t}async function VY(e){const t=tr().workbuddyDesktop;if(typeof t?.saveProxySettings!="function")throw new Error(r("当前环境不支持代理设置(桥接方法缺失)"));const a=await t.saveProxySettings(e);if(!a||typeof a!="object")throw new Error(r("代理设置响应异常"));return a}function FY({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.name||""),[d,f]=x.useState(e?.protocol==="socks5"?"socks5":"http"),[p,h]=x.useState(e?.host||""),[v,y]=x.useState(e?.port?String(e.port):""),[b,j]=x.useState(e?.username||""),[w,k]=x.useState(e?.password||""),[S,N]=x.useState(e?e.enabled:!0),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null);function P(){const L=o.trim();if(!L)return{error:r("请填写代理名称")};const H=p.trim();if(!H)return{error:r("请填写代理主机地址")};const B=Number(v);return!Number.isInteger(B)||B<1||B>65535?{error:r("代理端口必须是 1-65535 的整数")}:{payload:{name:L,source:"manual",protocol:d,host:H,port:B,username:b.trim(),password:w,enabled:S}}}async function O(){if(C)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}const H=L.payload,B={source:"custom",protocol:H.protocol,host:H.host,port:H.port,username:H.username,password:H.password};A(!0),I(r("正在连接上游…"));try{const z=await tr().workbuddyDesktop?.testProxy?.({proxy:B});if(z?.success){const Q=f0(z.durationMs);I(s.jsxs("span",{className:"text-success",children:[r("✅ 出口可用"),z.ip?r(" 出口 IP {ip}",{ip:z.ip}):"",Q?` ${Q}`:""]}))}else I(s.jsxs("span",{className:"text-destructive",children:["❌ ",z?.error||r("连接失败")]}))}catch(z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(z)]}))}finally{A(!1)}}async function _(){if(T)return;const L=P();if("error"in L){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",L.error]}));return}D(!0),I(null);try{await UY(e,L.payload),Fn(a?r("已保存「{name}」",{name:o.trim()}):r("已新增「{name}」",{name:o.trim()})),t()}catch(H){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Ra(H)]})),D(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:L=>{!L&&!T&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑代理":"新增代理")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-name",children:r("名称")}),s.jsx(Fe,{id:"proxy-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:香港 HTTP 出口"),value:o,onChange:L=>c(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-protocol",children:r("协议")}),s.jsxs(ft,{value:d,onValueChange:L=>f(L),children:[s.jsx(mt,{id:"proxy-protocol",className:"min-w-[110px]",children:s.jsx(pt,{children:d==="socks5"?"SOCKS5":"HTTP"})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"http",children:"HTTP"}),s.jsx(qe,{value:"socks5",children:"SOCKS5"})]})]})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-host",children:r("主机")}),s.jsx(Fe,{id:"proxy-host",placeholder:"127.0.0.1",autoComplete:"off",spellCheck:!1,value:p,onChange:L=>h(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-port",children:r("端口")}),s.jsx(Fe,{id:"proxy-port",type:"number",min:1,max:65535,className:"max-w-[110px]",placeholder:"7890",value:v,onChange:L=>y(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-user",children:r("用户名")}),s.jsx(Fe,{id:"proxy-user",placeholder:r("可选"),autoComplete:"off",value:b,onChange:L=>j(L.currentTarget.value)})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-pass",children:r("密码")}),s.jsx(Fe,{id:"proxy-pass",placeholder:r("可选"),autoComplete:"off",value:w,onChange:L=>k(L.currentTarget.value)})]})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(us,{checked:S,onCheckedChange:N,"aria-label":r("启用这条代理")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的条目不会被账号使用,被引用时账号回退直连;仍可测试)")})]}),s.jsxs("p",{className:"text-xs leading-[1.65] text-subtle",children:[r("想要 Clash Verge 的出口?那类条目由工具条的"),s.jsx("b",{children:r("「同步 Clash Verge」")}),r("整体 镜像进来(进本页时也会自动同步一次),名称与端口跟随 Clash、因此是只读的 —— 不必(也不能)在这里手工填。")]}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",disabled:C||T,onClick:()=>{O()},children:r(C?"测试中…":"测试出口")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:T,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:T,onClick:()=>{_()},children:r(T?"保存中…":"保存")})]})]})})}function $Y({onClose:e}){const[t,a]=x.useState(!0),[o,c]=x.useState(!1),[d,f]=x.useState(""),[p,h]=x.useState(""),[v,y]=x.useState(""),[b,j]=x.useState({}),[w,k]=x.useState(""),[S,N]=x.useState(!1);x.useEffect(()=>{let A=!0;return(async()=>{try{const R=await G2();if(!A||R===null)return;f(String(R.listenerPortBase??"")),h(String(R.listenerPortEnd??"")),y(String(R.testUrl??"")),j(R.defaults??{}),a(!1)}catch(R){if(!A)return;k(Ra(R)),a(!1)}})(),()=>{A=!1}},[]);function T(){const A=Number(d),R=Number(p);if(!Number.isInteger(A)||A<1||A>65535||!Number.isInteger(R)||R<1||R>65535)return k(r("端口范围必须是 1-65535 的整数")),null;if(A>R)return k(r("起始端口不能大于结束端口")),null;const I=v.trim();return I&&!I.startsWith("http://")&&!I.startsWith("https://")?(k(r("测试网址要以 http:// 或 https:// 开头")),null):(k(""),{listenerPortBase:A,listenerPortEnd:R,testUrl:I})}async function D(){if(o||t)return;const A=T();if(A){c(!0);try{await VY(A),N(!0)}catch(R){k(Ra(R))}finally{c(!1)}}}function C(){f(String(b.listenerPortBase??"")),h(String(b.listenerPortEnd??"")),y(String(b.testUrl??"")),N(!1),k("")}return s.jsx(Qt,{open:!0,onOpenChange:A=>{!A&&!o&&e()},children:s.jsxs(Zt,{className:"max-w-[560px]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("代理设置")})}),s.jsx(Bt,{className:"flex flex-col gap-3.5",children:t?s.jsx("p",{className:"text-xs text-subtle",children:r("加载中…")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row items-end gap-2.5",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-base",children:r("节点端口范围(起始)")}),s.jsx(Fe,{id:"proxy-settings-base",type:"number",min:1,max:65535,placeholder:String(b.listenerPortBase??""),autoComplete:"off",value:d,onChange:A=>{f(A.currentTarget.value),N(!1)}})]}),s.jsx("span",{"aria-hidden":"true",className:"flex-none pb-[7px] text-subtle",children:"—"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-end",children:r("节点端口范围(结束)")}),s.jsx(Fe,{id:"proxy-settings-end",type:"number",min:1,max:65535,placeholder:String(b.listenerPortEnd??""),autoComplete:"off",value:p,onChange:A=>{h(A.currentTarget.value),N(!1)}})]})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅节点会在本机各占一个监听端口,从该范围里挑空闲的分配;节点多的大订阅把默认范围({base}-{end})用尽时会报「没有可用的节点端口」,这时把范围调大再重启内核。已分配出去的端口不会因改范围而失效。",{base:b.listenerPortBase??"",end:b.listenerPortEnd??""})}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"proxy-settings-url",children:r("出口测试网址")}),s.jsx(Fe,{id:"proxy-settings-url",placeholder:b.testUrl||"",autoComplete:"off",spellCheck:!1,className:"font-mono text-[12px]",value:v,onChange:A=>{y(A.currentTarget.value),N(!1)}})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("「测试」与「批量测试」访问的目标;留空用默认(打 WorkBuddy 上游)。判据是能否拿到 HTTP 响应,不用考虑该网址返回什么内容。")}),s.jsxs("div",{className:"min-h-[18px] text-xs",children:[w?s.jsxs("span",{className:"text-destructive",children:["❌ ",w]}):null,!w&&S?s.jsxs("span",{className:"text-success",children:["✅ ",r("已保存。重启内核后,新分配的节点端口才会按新范围来。")]}):null]})]})}),s.jsxs(nn,{children:[s.jsx(se,{variant:"ghost",disabled:t||o,onClick:C,children:r("恢复默认")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:o,onClick:e,children:r("关闭")}),s.jsx(se,{variant:"default",disabled:t||o,onClick:()=>{D()},children:r(o?"保存中…":"保存")})]})]})})}function Pn(){return window}function nr(e,t){Pn().wbApp?.toast?.(e,t)}function zr(e){return e instanceof Error?e.message:String(e)}function K2(e){const t=String(e||"").trim();return/^https?:\/\//i.test(t)?t:""}async function Y2(e){const t=K2(e);if(!t){nr(r("链接地址不受支持"),"err");return}try{await Pn().workbuddyDesktop?.openReleasePage(t)}catch(a){nr(r("打开链接失败:{error}",{error:zr(a)}),"err")}}const Jg="1127656296",qY=`assets/qq-group/${Jg}.jpg`;function X2(e){return Pn().wbMarkdown?.render?.(e)||""}function Q2(e){const a=e.target?.closest?.("[data-external]");a&&(e.preventDefault(),Y2(a.dataset.external||""))}const mp="__proxy_other__",Z2={proxyChoice:null,pool:null,poolError:""};async function GY(){const e=Pn().workbuddyDesktop,t={...Z2};if(!e?.getUpdateProxy)return t;try{t.proxyChoice=(await e.getUpdateProxy())?.proxy??null}catch{}try{if(typeof e.getProxyPool!="function")throw new Error("桥未提供代理池方法");const a=(await e.getProxyPool())?.items;if(!Array.isArray(a))throw new Error("代理池响应异常");t.pool=a}catch(a){t.pool=[],t.poolError=zr(a)}return t}async function KY(e){if(e===mp)return null;const t=Pn().workbuddyDesktop;if(!t?.setUpdateProxy)return null;const a=e===""?null:{source:"pool",proxyId:e.slice(Xa.length)};try{const o=await t.setUpdateProxy({proxy:a}),c=o?.proxy??null,d=o?.saved!==!1;return d?nr(c?r("✅ 更新出网已切换为 {label}",{label:c.label||r("指定代理")}):r("✅ 更新出网已切换为直连")):nr(r("出网线路已切换,但写入磁盘失败(重启后会恢复原线路)"),"err"),{choice:c,saved:d}}catch(o){return nr(r("保存失败:{error}",{error:zr(o)}),"err"),null}}function W2(e){const t=e.proxyChoice,a=t?.config?.source||t?.source,o=t?.label||r(a==="custom"?"自定义代理":"已设置"),c=!!t?.error,d=Array.isArray(e.pool)?e.pool:[];let f="";a==="pool"&&t?.config?.proxyId?f=`${Xa}${t.config.proxyId}`:t&&(f=mp);const p=[{value:"",label:r("直连")}];for(const h of d)p.push({value:`${Xa}${h.id}`,label:lu(h)});if(e.pool===null?p.push({value:"__hint_pool__",label:r("正在读取代理列表…"),disabled:!0}):d.length||p.push({value:"__hint_pool__",label:e.poolError?r("代理列表读取失败"):r("还没有代理(去「网络代理」页添加)"),disabled:!0}),f===mp){const h=a==="clash"?r("Clash 出口:"):a==="custom"?r("自定义:"):"";p.push({value:mp,label:`${h}${o}${c?r("(不可用)"):""}`})}else a==="pool"&&!d.some(h=>`${Xa}${h.id}`===f)&&p.push({value:f,label:`${o}${c?r("(不可用)"):""}`});return{current:f,items:p,selected:p.find(h=>h.value===f),broken:c,title:c?r("当前线路不可用:{error};请重新选择代理或切回直连",{error:String(t?.error||"")}):r("检查更新与下载安装包走哪条线路(当前:{current});选择即保存。选项来自「网络代理」页;直连失败时会自动借 Clash 混合端口重试一次,选定指定代理后只走它",{current:t?o:r("直连")})}}function sr(){return window}function sn(e,t){sr().wbApp?.toast?.(e,t)}function Sr(e){return e instanceof Error?e.message:String(e)}let Ht={data:null,loading:!1,error:"",pending:!1,refreshing:null};const h0=new Set;function ex(e){return h0.add(e),()=>{h0.delete(e)}}function tx(){return Ht}function yn(e){Ht={...Ht,...e},h0.forEach(t=>t())}function YY(){return Ht.data?.items??[]}function Vu(){return Ht.data?.kernel??null}function Xi(e){!e||typeof e!="object"||!Array.isArray(e.items)||yn({data:e,error:""})}function Io(){pp(!0)}async function Dl(e=!1){const t=sr().workbuddyDesktop;if(typeof t?.getSubscriptions!="function"){yn({error:r("当前环境不支持订阅(桥接方法缺失)")});return}e||yn({loading:!0});try{Xi(await t.getSubscriptions())}catch(a){yn({error:Sr(a)})}finally{e||yn({loading:!1})}}const XY=20;function QY(e){const t=e.kernel;if(!t||t.download.state==="downloading")return!1;if(!t.installed||t.lastError&&!t.running)return!0;const a=t.providerSync??{};return(e.items??[]).filter(o=>o.enabled!==!1).every(o=>!!a[o.id])}async function Qi(){const e=sr().workbuddyDesktop;if(typeof e?.getSubscriptions=="function")for(let t=0;tsetTimeout(o,1500)),Io();let a;try{a=await e.getSubscriptions()}catch{return}if(Xi(a),t>=1&&a&&Array.isArray(a.items)&&QY(a))return}}async function J2(e){const a=await sr().workbuddyDesktop?.addSubscription?.({enabled:!0,kind:"url",url:"",...e});return Xi(a),sn(r("已新增订阅「{name}」,内核正在同步节点…",{name:e.name.trim()})),Io(),Qi(),a??null}async function eD(e,t){const o=await sr().workbuddyDesktop?.saveSubscription?.({id:e.id,...t});Xi(o),sn(r("已保存「{name}」",{name:t.name.trim()})),Io(),Qi()}async function ZY(e,t){const a=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const o=await a?.saveSubscription?.({id:e.id,name:e.name,url:e.url,kind:e.kind,enabled:t});Xi(o),sn(t?r("已启用「{name}」",{name:e.name}):r("已禁用「{name}」",{name:e.name})),Io(),Qi()}catch(o){sn(r("保存失败:{reason}",{reason:Sr(o)}),"err")}finally{yn({pending:!1})}}}async function WY(e){const t=sr().workbuddyDesktop;if(!(Ht.refreshing||Ht.pending)){yn({refreshing:e.id});try{const a=await t?.refreshSubscription?.(e.id);Xi(a),sn(r("已刷新「{name}」,正在同步节点…",{name:e.name})),Io(),Qi()}catch(a){sn(r("刷新失败:{reason}",{reason:Sr(a)}),"err")}finally{yn({refreshing:null})}}}async function JY(e){const t=sr().workbuddyDesktop;if(await window.wbConfirm?.ask?.({title:r("删除订阅"),html:r("确定删除「{name}」?它在代理池里的节点会一并移除,引用这些节点的账号会回退直连。",{name:e.name||e.id}),okText:r("删除"),okClass:"danger"})&&!Ht.pending){yn({pending:!0});try{const o=await t?.removeSubscription?.(e.id);Xi(o),sn(r("已删除「{name}」",{name:e.name||e.id})),Io(),Qi()}catch(o){sn(r("删除失败:{reason}",{reason:Sr(o)}),"err")}finally{yn({pending:!1})}}}async function eX(e){const t=sr().workbuddyDesktop;if(typeof t?.downloadKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const a=await t.downloadKernel(e);a&&Ht.data&&yn({data:{...Ht.data,kernel:a}}),a?.saved===!1&&sn(r("下载线路 / 存放目录没能写进配置(本次下载已按新设置走,重启后会恢复原值)"),"err");for(let c=0;c<300;c+=1){await new Promise(f=>setTimeout(f,1e3));const d=await t.getKernelStatus?.();if(d&&Ht.data&&yn({data:{...Ht.data,kernel:d}}),!d||d.download.state!=="downloading")break}const o=Ht.data?.kernel;o?.download.state==="error"?sn(r("内核下载失败:{reason}",{reason:o.download.error||r("未知错误")}),"err"):o?.download.state==="canceled"?sn(r("已停止下载内核(未下载完的临时文件已删除)")):o?.download.state==="done"&&(sn(r("✅ 内核下载完成,正在启动…")),Qi())}catch(a){sn(r("内核下载失败:{reason}",{reason:Sr(a)}),"err")}finally{yn({pending:!1})}}}async function tX(){const e=sr().workbuddyDesktop;if(typeof e?.cancelKernelDownload!="function")return"none";try{const t=await e.cancelKernelDownload();if(t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),t?.canceled===!1)return"none";for(let o=0;o<20;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.download.state!=="downloading")break;await new Promise(d=>setTimeout(d,250))}const a=Ht.data?.kernel?.download.state;return a==="canceled"?"canceled":a==="done"?"done":"stalled"}catch(t){return sn(r("停止下载失败:{reason}",{reason:Sr(t)}),"err"),"none"}}async function nX(){const e=sr().workbuddyDesktop;if(!Ht.pending){yn({pending:!0});try{const t=await e?.restartKernel?.();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}}),sn(r("内核正在启动…")),Io(),Qi()}catch(t){sn(r("内核启动失败:{reason}",{reason:Sr(t)}),"err")}finally{yn({pending:!1})}}}async function sX(){const e=sr().workbuddyDesktop;if(typeof e?.stopKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}if(!Ht.pending){yn({pending:!0});try{const t=await e.stopKernel();t&&Ht.data&&yn({data:{...Ht.data,kernel:t}});for(let o=0;o<10;o+=1){const c=await e.getKernelStatus?.();if(c&&Ht.data&&yn({data:{...Ht.data,kernel:c}}),c&&c.running===!1)break;await new Promise(d=>setTimeout(d,500))}const a=Ht.data?.kernel;if(a?.running===!1)sn(r("内核已关闭(订阅与端口注册表保留,「启动内核」后原位恢复)"));else{const o=a?.lastError||r("内核没有在超时内停下来");sn(r("关闭内核失败:{reason}",{reason:o}),"err")}Dl(!0)}catch(t){sn(r("关闭内核失败:{reason}",{reason:Sr(t)}),"err"),Dl(!0)}finally{yn({pending:!1})}}}async function rX(){const e=sr().workbuddyDesktop;if(typeof e?.removeKernel!="function"){sn(r("当前环境不支持订阅(桥接方法缺失)"),"err");return}const t=Vu()?.version;if(!await window.wbConfirm?.ask?.({title:r("删除内核"),html:r("确定删除已下载的内核{version}?内核文件与端口映射会被移除,订阅节点会变成「未分配端口」,引用它们的账号会暂时回退直连;订阅本身保留,重新下载内核后会重新分配端口。",{version:t?`(${t})`:""}),okText:r("删除内核"),okClass:"danger"})||Ht.pending)return;yn({pending:!0});const o=Vu()?.lastError||"";try{const c=await e.removeKernel();c&&Ht.data&&yn({data:{...Ht.data,kernel:c}});for(let f=0;f<20;f+=1){const p=await e.getKernelStatus?.();if(p&&Ht.data&&yn({data:{...Ht.data,kernel:p}}),p&&p.installed===!1||p?.lastError&&p.lastError!==o)break;await new Promise(h=>setTimeout(h,500))}const d=Ht.data?.kernel;if(d?.installed===!1)sn(r("已删除内核(订阅与账号引用保留,重新下载后会重新分配端口)")),Io();else{const f=d?.lastError&&d.lastError!==o?d.lastError:r("内核目录没能删掉(可能仍被进程占用),稍后重试一次");sn(r("删除内核失败:{reason}",{reason:f}),"err")}Dl(!0)}catch(c){sn(r("删除内核失败:{reason}",{reason:Sr(c)}),"err"),Dl(!0)}finally{yn({pending:!1})}}async function aX(e){const t=sr().workbuddyDesktop;if(typeof t?.decodeQrImage!="function")throw new Error(r("当前环境不支持订阅(桥接方法缺失)"));const a=await new Promise((d,f)=>{const p=new FileReader;p.onload=()=>d(String(p.result||"")),p.onerror=()=>f(new Error(r("图片读取失败"))),p.readAsDataURL(e)}),c=(await t.decodeQrImage({imageBase64:a}))?.url;if(!c)throw new Error(r("二维码里没有订阅链接"));return c}function lX(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result||"")),o.onerror=()=>a(new Error(r("文件读取失败"))),o.readAsDataURL(e)})}function tD(e){return(Math.max(0,Number(e)||0)/1024/1024).toFixed(1)}function oX(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")}function iX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),o=a?.download,c=o?.state==="downloading",d=c&&o&&o.total>0?Math.round(o.received/o.total*100):null,[f,p]=x.useState(null),[h,v]=x.useState(""),[y,b]=x.useState(null),[j,w]=x.useState(a?.kernelDir||""),[k,S]=x.useState(!1),[N,T]=x.useState(!1),[D,C]=x.useState("");x.useEffect(()=>{let H=!0;return(async()=>{try{const B=(await sr().workbuddyDesktop?.getProxyPool?.())?.items;if(!Array.isArray(B))throw new Error(r("代理池响应异常"));H&&p(B)}catch(B){if(!H)return;p([]),v(Sr(B))}})(),()=>{H=!1}},[]),x.useEffect(()=>{a?.installed&&e()},[a?.installed]);const A=W2({proxyChoice:a?.downloadProxy??null,pool:f,poolError:h}),R=y??A.current,I=A.items.find(H=>H.value===R)??A.selected,P=a?.kernelDirDefault||"";async function O(){if(k)return;const H=j.trim();if(H&&!oX(H)){C(r("存放位置要填绝对路径,例如 D:\\proxy-kernel"));return}C(""),S(!0);try{const B={dir:H};R!==mp&&(B.proxy=R===""?null:{source:"pool",proxyId:R.slice(Xa.length)}),eX(B)}finally{S(!1)}}async function _(){if(!N){T(!0);try{const H=await tX();H==="done"?sn(r("下载已经完成,停止没赶上(内核已安装)")):H==="none"?sn(r("当前没有正在进行的下载"),"err"):H==="stalled"&&sn(r("停止请求已发出,但下载还没收手,稍后再看一次进度"),"err")}finally{T(!1)}}}async function L(){const H=sr().workbuddyDesktop;if(typeof H?.pickFolder!="function"){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}try{const B=await H.pickFolder(j.trim()||P||null);if(B?.unsupported){sn(r("当前环境不支持选择文件夹,直接填写绝对路径即可"),"err");return}if(B?.canceled||!B?.path)return;w(B.path)}catch(B){sn(r("打开文件夹选择框失败:{reason}",{reason:Sr(B)}),"err")}}return s.jsx(Qt,{open:!0,onOpenChange:H=>{H||e()},children:s.jsxs(Zt,{className:"w-[min(520px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r(c?"正在下载内核":"下载内核")}),s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("内核 {version}({asset})",{version:a?.version||"—",asset:a?.asset||"—"})})]}),c?s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(tf,{value:d??null}),s.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[s.jsx("span",{className:"text-text-2",children:d!==null?r("{percent}%({received} / {total} MB)",{percent:d,received:tD(o?.received),total:tD(o?.total)}):r("正在连接 GitHub…")}),s.jsx("span",{className:"text-subtle",children:r("存放位置 {dir}",{dir:a?.kernelDir||"—"})})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("关掉这个窗口不会中断下载(它在后台继续跑)—— 要停下就点下面的「停止下载」,未下载完的临时文件会被删除。")})]}):s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-proxy",children:r("下载线路")}),s.jsxs(ft,{value:R,onValueChange:H=>b(String(H)),children:[s.jsx(mt,{id:"kernel-proxy",className:Ue("w-full",A.broken&&"border-destructive-bd"),children:s.jsx(pt,{className:"min-w-0 truncate",children:I?.label||r("直连")})}),s.jsx(ht,{children:A.items.map(H=>s.jsx(qe,{value:H.value,disabled:H.disabled,children:H.label},H.value))})]}),s.jsx("div",{className:"text-[12px] text-subtle",children:A.broken?r("当前线路不可用:{error};重新选一条或切回直连",{error:String(a?.downloadProxy?.error||"")}):r("选项来自「网络代理」页(Clash Verge 同步的出口在这里可用;订阅节点要等内核起来才有端口)。选「直连」时连不上会自动借 Clash 混合端口重试一次;选定某条线路后只走它。")})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"kernel-dir",children:r("存放位置")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fe,{id:"kernel-dir",className:"min-w-0 flex-1 font-mono text-[12px]",autoComplete:"off",spellCheck:!1,value:j,placeholder:P,onChange:H=>w(H.currentTarget.value)}),s.jsx(se,{variant:"outline",size:"sm",className:"flex-none",onClick:()=>{L()},children:r("选择目录…")}),P&&j.trim()!==P?s.jsx(se,{variant:"ghost",size:"sm",className:"flex-none",title:P,onClick:()=>w(P),children:r("恢复默认")}):null]}),s.jsx("div",{className:"text-[12px] text-subtle",children:r("内核二进制 / 配置 / 端口映射都会放在这里,默认 {dir};目录不存在会在下载开始时自动创建。",{dir:P||"—"})})]}),o?.state==="error"&&o.error?s.jsx("span",{className:"text-[12px] text-destructive",children:r("上次下载失败:{reason}",{reason:o.error})}):null,o?.state==="canceled"?s.jsx("span",{className:"text-[12px] text-subtle",children:r("上次下载已停止,未下载完的临时文件已删除")}):null,D?s.jsx("span",{className:"text-[12px] text-destructive",children:D}):null]}),s.jsx(nn,{children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("后台继续")}),s.jsx(se,{variant:"destructive",disabled:N,onClick:()=>{_()},children:r(N?"正在停止…":"停止下载")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("取消")}),s.jsx(se,{variant:"default",disabled:k||t.pending,onClick:()=>{O()},children:r(k?"正在开始…":"下载")})]})})]})})}function nD({showPortRange:e=!1}){const t=x.useSyncExternalStore(ex,tx),a=Vu(),[o,c]=x.useState(null),[d,f]=x.useState(!1);x.useEffect(()=>{let v=!0;return(async()=>{try{const y=await G2();if(!v||!y)return;const b=Number(y.listenerPortBase),j=Number(y.listenerPortEnd);Number.isFinite(b)&&Number.isFinite(j)&&b>0&&j>0&&c({base:b,end:j})}catch{}})(),()=>{v=!1}},[]);const p=a?.download.state==="downloading",h=p&&a.download.total>0?Math.round(a.download.received/a.download.total*100):null;return s.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ze,{variant:a?.running?"default":"secondary",children:a?.running?r("内核运行中"):a?.installed?a.halted?r("内核已手动关闭"):r("内核已停止"):r("内核未安装")}),s.jsxs("span",{className:"text-[12.5px] text-text-2",children:[a?.installed?r("内核 {version}",{version:a.version})+" · ":"",a?.running?r("控制端口 {port} · {n} 个节点监听器",{port:a?.controllerPort??"—",n:a?.listenerCount??0}):a?.installed?a.halted?r("内核已手动关闭(点「启动内核」拉起)"):r("内核已停止,点「启动内核」拉起"):r("按需下载(约 20-40MB)")]}),e&&o?s.jsx("span",{className:"text-[11.5px] text-subtle",children:r("节点端口范围 {base}–{end}",{base:o.base,end:o.end})}):null,s.jsx("div",{className:"ml-auto flex items-center gap-2",children:a?.installed?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{nX()},children:a?.running?r("重启内核"):r("启动内核")}),a?.running?s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending||p,onClick:()=>{sX()},children:r("关闭内核")}):null,s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending||p,onClick:()=>{rX()},children:r("删除内核")})]}):s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending&&!p,onClick:()=>f(!0),children:r(p?"下载中…":"下载内核")})})]}),p?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tf,{className:"min-w-[200px] flex-1",value:h??null}),s.jsx("span",{className:"text-[11px] text-subtle",children:h!==null?r("{percent}%({received} / {total} MB)",{percent:h,received:sD(a.download.received),total:sD(a.download.total)}):r("下载中…")})]}):null,a?.lastError?s.jsx("span",{className:"text-[12px] text-destructive",children:a.lastError}):null,d?s.jsx(iX,{onClose:()=>f(!1)}):null]})}function cX({onClose:e}){const t=x.useSyncExternalStore(ex,tx),a=YY(),o=t.data!==null,[c,d]=x.useState(null);return x.useEffect(()=>{Dl()},[]),s.jsxs(Qt,{open:!0,onOpenChange:f=>{f||e()},children:[s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsxs(Kt,{children:[s.jsx(Gt,{children:r("订阅管理")}),s.jsxs("span",{className:"text-[11.5px] text-subtle",children:[o?r("{n} 条订阅",{n:a.length}):r("加载中…")," · ",r("节点由内核起成本地监听器,镜像进代理池")]})]}),s.jsxs(Bt,{className:"flex flex-col gap-3",children:[s.jsx(nD,{}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-[18%]"}),s.jsx("col",{className:"w-[31%]"}),s.jsx("col",{className:"w-[9%]"}),s.jsx("col",{className:"w-[14%]"}),s.jsx("col",{className:"w-[8%]"}),s.jsx("col",{className:"w-[20%]"})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:r("名称")}),s.jsx("th",{children:r("订阅来源")}),s.jsx("th",{className:"ta-center",children:r("节点")}),s.jsx("th",{children:r("上次同步")}),s.jsx("th",{className:"ta-center",children:r("启用")}),s.jsx("th",{className:"ta-right",children:r("操作")})]})}),s.jsx("tbody",{children:a.length?a.map(f=>{const p=Vu()?.providerSync?.[f.id];return s.jsxs("tr",{className:f.enabled?"":"off",children:[s.jsx("td",{children:s.jsx("b",{children:f.name||r("未命名")})}),s.jsx("td",{className:"group",children:s.jsx("div",{className:"flex min-w-0 items-center gap-1",children:f.kind==="local"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.fileName,children:f.fileName||r("本地 YAML 文件")}),s.jsx(ze,{variant:"secondary",children:r("本地文件")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:f.url,children:uX(f.url)}),s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn size-[21px] rounded-[var(--r-xs)] opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","data-copy":f.url,title:r("复制订阅链接"),children:"⧉"})]})})}),s.jsx("td",{className:"ta-center",children:rD(p,f)>0?s.jsx(ze,{variant:"secondary",children:r("{n} 个",{n:rD(p,f)})}):s.jsx("span",{className:"text-subtle",children:r("—")})}),s.jsx("td",{children:p?.at?s.jsx("span",{className:"text-[12px] text-text-2",children:B2(p.at)}):s.jsx("span",{className:"text-subtle",children:r("未同步")})}),s.jsx("td",{className:"ta-center",children:s.jsx(us,{checked:f.enabled,disabled:t.pending,"aria-label":r("启用订阅「{name}」",{name:f.name||r("未命名")}),onCheckedChange:h=>{ZY(f,h)}})}),s.jsx("td",{children:s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending||t.refreshing!==null||f.kind==="local",title:f.kind==="local"?r("本地文件订阅无需更新(要换内容请编辑后重新选择文件)"):void 0,onClick:()=>{WY(f)},children:t.refreshing===f.id?r("更新中…"):r("立即更新")}),s.jsx(se,{size:"sm",variant:"ghost",disabled:t.pending,onClick:()=>d({item:f}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:t.pending,onClick:()=>{JY(f)},children:r("删除")})]})})]},f.id)}):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"empty",children:o?s.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[s.jsx("span",{children:r("还没有订阅:粘贴订阅链接、导入本地 YAML 文件,或从图片识别二维码。")}),s.jsx(se,{size:"sm",variant:"outline",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅里的节点会自动同步进代理池,账号即可引用。")})]}):r("加载中…")})})})]})}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r("订阅里的节点会被内核起成本地监听器,镜像到代理池(账号按 id 引用,与本页其它出口同一用法)。内核只在用到订阅时按需下载(约 20-40MB),不随安装包分发。")}),t.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:t.error})}):null]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"default",disabled:t.pending,onClick:()=>d({item:null}),children:r("+ 新增订阅")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:e,children:r("完成")})]})]}),c?s.jsx(dX,{item:c.item,onClose:()=>d(null)}):null]})}function sD(e){return!Number.isFinite(e)||e<=0?"—":(e/1e3/1e3).toFixed(1)}function uX(e){try{const t=new URL(e);return t.host+(t.pathname!=="/"?"/…":"")}catch{return e.slice(0,60)}}function rD(e,t){return e?.count??t.nodeCount}function dX({item:e,onClose:t}){const a=e!==null,[o,c]=x.useState(e?.kind==="local"?"local":"url"),[d,f]=x.useState(e?.name||""),[p,h]=x.useState(e?.url||""),[v,y]=x.useState(e?.fileName||""),[b,j]=x.useState(""),[w,k]=x.useState(e?e.enabled:!0),[S,N]=x.useState(!1),[T,D]=x.useState(!1),[C,A]=x.useState(!1),[R,I]=x.useState(null),P=x.useRef(null);async function O(){if(S)return;const z=d.trim();if(!z){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请填写订阅名称")]}));return}const Q=p.trim();if(o==="url"&&!(Q.startsWith("http://")||Q.startsWith("https://"))){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("订阅链接必须是 http:// 或 https:// 开头")]}));return}if(!a&&o==="local"&&!b){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",r("请选择要导入的 YAML 文件")]}));return}N(!0);try{a&&o==="local"?await eD(e,{name:z,enabled:w,kind:"local",fileName:v||void 0,...b?{contentB64:b}:{}}):a?await eD(e,{name:z,url:Q,enabled:w,kind:"url"}):o==="local"?await J2({name:z,kind:"local",fileName:v||void 0,contentB64:b}):await J2({name:z,kind:"url",url:Q}),t()}catch(K){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Sr(K)]})),N(!1)}}async function _(z){if(!T){D(!0),I(r("正在识别二维码…"));try{const Q=await aX(z);h(Q),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已识别订阅链接")]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Sr(Q)]}))}finally{D(!1)}}}async function L(z){if(!C){A(!0),I(null);try{const Q=await lX(z);j(Q),y(z.name),I(s.jsxs("span",{className:"text-success",children:["✅ ",r("已选择「{name}」,保存后导入",{name:z.name})]}))}catch(Q){I(s.jsxs("span",{className:"text-destructive",children:["❌ ",Sr(Q)]}))}finally{A(!1)}}}function H(z){if(o!=="url")return;const K=Array.from(z.clipboardData?.files||[]).find(X=>X.type.startsWith("image/"));K&&(z.preventDefault(),_(K))}function B(z){z!==o&&(c(z),I(null))}return s.jsx(Qt,{open:!0,onOpenChange:z=>{!z&&!S&&t()},children:s.jsxs(Zt,{className:"max-w-[560px]",overlayForceRender:!0,onPaste:H,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r(a?"编辑订阅":"新增订阅")})}),s.jsxs(Bt,{className:"flex flex-col gap-3.5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-name",children:r("名称")}),s.jsx(Fe,{id:"sub-name",maxLength:60,autoComplete:"off",spellCheck:!1,placeholder:r("例如:我的机场"),value:d,onChange:z=>f(z.currentTarget.value)})]}),a?null:s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{children:r("订阅来源")}),s.jsx(In,{options:[{value:"url",label:r("订阅链接")},{value:"local",label:r("本地 YAML 文件")}],value:o,onValueChange:B,"aria-label":r("订阅来源")})]}),o==="url"?s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-url",children:r("订阅链接")}),s.jsx(Fe,{id:"sub-url",autoComplete:"off",spellCheck:!1,placeholder:"https://…",value:p,onChange:z=>h(z.currentTarget.value)}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:T,onClick:()=>P.current?.click(),children:r(T?"识别中…":"从图片识别二维码")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("也可以把二维码截图直接粘贴到弹窗里(Ctrl+V)")}),s.jsx("input",{ref:P,type:"file",accept:"image/*",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&_(Q),z.currentTarget.value=""}})]})]}):s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"sub-file",children:r("YAML 文件")}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:"sm",variant:"outline",disabled:C,className:"shrink-0",onClick:()=>P.current?.click(),children:r(C?"读取中…":a?"重新选择文件…":"选择 YAML 文件…")}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-text-2",title:v||void 0,children:v||r(a?"保持原文件":"未选择文件")})]}),a?s.jsx("span",{className:"text-[11px] text-subtle",children:r("本地文件不会自动更新:要更新节点,重新选择文件后保存;不重选则内容保持不变。")}):null,s.jsx("input",{ref:P,type:"file",accept:".yaml,.yml,text/yaml,application/yaml,text/plain",className:"hidden",onChange:z=>{const Q=z.currentTarget.files?.[0];Q&&L(Q),z.currentTarget.value=""}})]}),s.jsxs("div",{className:"flex flex-row items-center gap-2.5",children:[s.jsx(us,{checked:w,onCheckedChange:k,"aria-label":r("启用这条订阅")}),s.jsx("span",{className:"text-[12.5px]",children:r("启用(禁用的订阅不参与内核同步,它的节点会从代理池移除)")})]}),s.jsx("p",{className:"text-xs leading-[1.65] text-subtle",children:r(o==="url"?"订阅内容由内核定时刷新(每 24 小时);节点数与同步状态在保存后由轮询刷新,稍等几秒。":"本地文件订阅的内容在导入时固定:节点会由内核起成本地监听器并镜像进代理池,节点数稍等几秒由轮询刷新。")}),s.jsx("div",{className:"min-h-[18px] text-xs text-subtle",children:R})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",disabled:S,onClick:t,children:r("取消")}),s.jsx(se,{variant:"default",disabled:S||T||C,onClick:()=>{O()},children:r(S?"保存中…":"保存")})]})]})})}const g0=[{key:"pick",label:r("选择"),align:"center"},{key:"name",label:r("节点")},{key:"addr",label:r("地址")},{key:"state",label:r("启用"),align:"center"},{key:"test",label:r("连通性")},{key:"act",label:r("操作"),align:"right"}],fX={pick:"p-pick",name:"",addr:"p-addr",state:"p-state",test:"p-test",act:"p-act"},aD="proxies";function x0(){return window}let nx=null,lD=null;function oD(){return nx?nx.apply([...g0]):g0.map(e=>({...e,align:e.align??"left"}))}function pX(){x0().wbTableColumns?.repaint?.(aD)}function mX(e){if(lD=e,nx)return!0;const t=x0().wbColSettings;return t?.register?(nx=t.register({id:aD,label:r("代理池表"),columns:g0.map(a=>({key:a.key,label:a.label,align:a.align??"left"})),mount:()=>document.querySelector('.page[data-page="proxies"] .panel-head .head-actions'),onChange:()=>lD?.()}),!0):!1}function hX(){x0().wbColSettings?.close?.()}function gX(){const e=x.useSyncExternalStore(AY,RY),t=x.useSyncExternalStore(ex,tx).data?.items??[],[a,o]=x.useState(null),[c,d]=x.useState(!1),[f,p]=x.useState(!1),[h,v]=x.useState(""),[y,b]=x.useState("all"),[j,w]=x.useState("all"),[k,S]=x.useState("all"),[N,T]=x.useState(0),[,D]=x.useReducer(J=>J+1,0),C=Wg(),A=e.data!==null,R=e.selected.size,I=C.filter(J=>e.selected.has(J.id)&&Qg(J)).length,P=e.batchProgress;x.useEffect(()=>{Dl()},[]),x.useLayoutEffect(()=>{if(!mX(()=>D())){const J=window.setTimeout(()=>T(ie=>ie+1),50);return()=>window.clearTimeout(J)}D()},[N]),x.useLayoutEffect(()=>{pX()}),x.useEffect(()=>()=>{hX()},[]);const O=h.trim().toLowerCase(),_=vX(C,t);function L(J){return j==="all"?!0:j==="manual"||j==="clash"||j==="subscription"?tl(J)===j:j===uD?!!J.orphan:J.source==="subscription"&&!J.orphan&&J.providerId===j}function H(J){return!(y!=="all"&&tl(J)!==y||!L(J)||k!=="all"&&cD(J)!==k||O&&![J.name,Vh(J),J.host,J.protocol,String(J.port??"")].join(" ").toLowerCase().includes(O))}function B(J){const ie=J??"all";w(ie),b(ie==="all"?"all":ie==="manual"||ie==="clash"?ie:"subscription")}function z(J){b(J),w("all")}const Q=C.filter(H),K=Q.map(J=>J.id),X=K.length>0&&K.every(J=>e.selected.has(J)),q=K.some(J=>e.selected.has(J))&&!X,$=oD(),Y=[];for(const J of iD())Y.push(...Q.filter(ie=>tl(ie)===J.key));const F=cg(Q.length,"proxies"),G=F.paged?F.slice(Y):Y,W=new Map;for(const J of Q)W.set(tl(J),(W.get(tl(J))??0)+1);x.useEffect(()=>{F.goto(1)},[O,y,j,k]);function le(J){const ie=J.lastTest;if(!ie||!ie.at)return s.jsx("span",{className:"text-subtle",children:r("未测试")});const ge=f0(ie.durationMs);return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsxs("span",{className:ie.success?"text-success":"text-destructive",children:[ie.success?r("✅ {ip}",{ip:ie.ip||r("连接成功")}):r("❌ 连接失败"),ge?` ${ge}`:"",s.jsxs("span",{className:"text-[11px] text-subtle",children:[" ",B2(ie.at)]})]}),ie.success?null:s.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-subtle",title:String(ie.error||r("连接失败")),children:String(ie.error||r("连接失败"))})]})}function M(J){const ie=J.usedBy||[],ge=[];return J.protocol&&ge.push(J.protocol),ie.length&&ge.push(s.jsx("span",{className:"text-warn",title:ie.map(ee=>String(ee.name||ee.id||"")).join(r("、")),children:r("{n} 个账号在用",{n:ie.length})})),ge.length?s.jsx("span",{className:"text-[11px] text-subtle",children:ge.map((ee,fe)=>s.jsxs(x.Fragment,{children:[fe?" · ":"",ee]},fe))}):null}function U(J){if(jY(J)&&(J.port===null||J.port===void 0))return s.jsx("span",{className:"text-subtle",children:r("已禁用(未开监听端口)")});if(J.resolveError){const ge=J.source==="subscription"&&(J.port===null||J.port===void 0);return s.jsx("span",{className:ge?"text-subtle":"text-destructive",title:J.resolveError,children:r(ge?"未分配端口":"解析失败")})}if(vY(J)){const ge=Vu()?.installed===!1;return s.jsx("span",{className:"text-subtle",title:r(ge?"代理内核未安装(在「订阅管理」里下载内核后,节点会自动分配监听端口)":"还没有监听端口(还没有账号引用它 —— 在账号里选它并保存后,内核会自动开端口)"),children:Vh(J)||r("未分配端口")})}const ie=Vh(J);return s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx("span",{className:"min-w-0 flex-1 font-mono text-[12px] leading-[1.45] text-text-2 break-all",title:ie||void 0,children:ie||"—"}),ie?s.jsx(se,{variant:"ghost",size:"icon-xs",className:"copy-btn flex-none","data-copy":ie,title:r("复制地址"),children:"⧉"}):null]})}function Z(J,ie,ge,ee){const fe=ge||e.batchBusy;switch(J){case"pick":return s.jsx(Dr,{checked:ee,title:r("勾选后可批量操作"),"aria-label":r("勾选「{name}」",{name:ie.name||r("未命名")}),onCheckedChange:te=>MY(ie.id,te)});case"name":return s.jsxs("div",{className:"flex flex-col gap-0.5 leading-[1.5] min-w-0",children:[s.jsx("b",{children:ie.name||r("未命名")}),M(ie)]});case"addr":return U(ie);case"state":{const te=U2(ie);return s.jsx(us,{checked:ie.enabled!==!1,disabled:fe||te,"aria-label":r("启用「{name}」",{name:ie.name||r("未命名")}),title:EY(ie),onCheckedChange:Ce=>{LY(ie,Ce)}})}case"test":return le(ie);case"act":{const te=Zg(ie);Qg(ie);const Ce=$2(ie),re=e.testing===ie.id;return s.jsxs("div",{className:"row-actions",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe||e.testing!==null,onClick:()=>{_Y(ie)},children:r(re?"测试中…":"测试")}),ie.source!=="clash"&&ie.source!=="subscription"?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:fe,onClick:()=>o({item:ie}),children:r("编辑")}),s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,onClick:()=>{q2(ie)},children:r("删除")})]}):null,te?s.jsx(se,{size:"sm",variant:"destructive",disabled:fe,title:Ce,onClick:()=>{q2(ie)},children:r("删除")}):null]})}default:return null}}function ae(J){const ie=e.pending.has(J.id),ge=OY(J.id);return s.jsx("tr",{className:Ue(J.enabled?"":"off",ge&&"bg-primary-soft"),"data-id":J.id,children:$.map(ee=>s.jsx("td",{className:`ta-${ee.align}`,children:Z(ee.key,J,ie,ge)},ee.key))},J.id)}function ce(){if(!C.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:r(A?"还没有代理。点右上角「+ 新增代理」手填一个,点「同步 Clash Verge」把 Clash 的出口导进来,或在「订阅管理」里导入订阅节点。":"加载中…")})});if(!Q.length)return s.jsx("tr",{children:s.jsx("td",{colSpan:$.length,className:"empty",children:O?r("没有匹配「{kw}」的出口",{kw:h.trim()}):r("没有匹配当前筛选的出口")})});const J=[];let ie="";for(const ge of G){const ee=tl(ge);if(ee!==ie){ie=ee;const fe=iD().find(te=>te.key===ee);J.push(s.jsx("tr",{className:"tr-group",children:s.jsxs("td",{colSpan:$.length,children:[s.jsx("span",{className:"prov-tag",children:fe?.label??ee}),r("{n} 个",{n:W.get(ee)??0}),fe?.note?s.jsxs("span",{className:"font-normal",children:[" · ",fe.note]}):null]})},`group:${ee}:${J.length}`))}J.push(ae(ge))}return s.jsx(s.Fragment,{children:J})}return s.jsx(s.Fragment,{children:s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("代理池")}),s.jsx("span",{className:"panel-sub",children:A?r("{n} 个出口",{n:C.length}):r("加载中…")}),s.jsx("span",{className:"text-[11px] text-subtle",children:r("订阅与 Clash 的出口自动镜像进来")}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>d(!0),children:r("设置")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>p(!0),children:t.length?r("订阅管理({n})",{n:t.length}):r("订阅管理")}),s.jsx(se,{variant:"outline",disabled:e.syncing||e.batchBusy,onClick:()=>{PY()},children:e.syncing?r("同步中…"):r("同步 Clash Verge")}),s.jsx(se,{variant:"outline",disabled:e.loading||e.batchBusy,onClick:()=>{pp(),Dl()},children:e.loading?r("刷新中…"):r("刷新")}),s.jsx(se,{variant:"default",disabled:e.batchBusy,onClick:()=>o({item:null}),children:r("+ 新增代理")})]})]}),s.jsx("div",{className:"px-3 pt-3",children:s.jsx(nD,{showPortRange:!0})}),R>0?s.jsxs("div",{className:"batch-bar active",children:[s.jsxs("span",{className:"batch-count",children:[r("已选")," ",s.jsx("b",{children:R})," ",r("个 · 共")," ",s.jsx("b",{children:Q.length})," ",r("个")]}),I?s.jsx("span",{className:"batch-hidden",children:r("其中 {n} 条是同步来的只读条目(Clash / 订阅):可参与批量测试,删除会跳过",{n:I})}):null,s.jsxs("div",{className:"batch-actions",children:[s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>{BY()},children:P?r("测试中 {done}/{total}",{done:P.done,total:P.total}):r("批量测试")}),s.jsx(se,{variant:"destructive",disabled:e.batchBusy,onClick:()=>{HY()},children:r("批量删除")}),s.jsx(se,{variant:"outline",disabled:e.batchBusy,onClick:()=>IY(),children:r("取消选择")})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 border-b border-border px-4 py-[10px]",children:[s.jsxs(Ci,{className:"w-[clamp(150px,22vw,220px)]",children:[s.jsx(Ei,{type:"search",value:h,"aria-label":r("搜索节点"),placeholder:r("搜索名称 / 地址 / 端口"),onChange:J=>v(J.currentTarget.value)}),s.jsx(Ti,{align:"inline-start","aria-hidden":"true",children:s.jsx(yX,{})})]}),s.jsxs(ft,{value:j,onValueChange:B,children:[s.jsx(mt,{className:"w-[clamp(150px,18vw,210px)]","aria-label":r("按提供方筛选"),children:s.jsx(pt,{children:_.find(J=>J.value===j)?.label??r("全部提供方")})}),s.jsx(ht,{children:_.map(J=>s.jsx(qe,{value:J.value,children:s.jsxs("span",{className:"flex w-full items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate"+(J.count?"":" text-subtle"),children:J.label}),s.jsx("span",{className:"flex-none text-[11px] text-subtle",children:J.count})]})},J.value))})]}),s.jsx(In,{options:xX(C),value:y,onValueChange:z,"aria-label":r("按来源筛选")}),s.jsx(In,{options:bX(C),value:k,onValueChange:S,"aria-label":r("按状态筛选")}),s.jsx("span",{className:"ml-auto text-[11px] text-subtle",children:r("显示 {n} / 共 {total} 个出口",{n:Q.length,total:C.length})})]}),s.jsx("div",{className:"models-table-wrap",children:s.jsxs("table",{className:"models-table proxies-table",children:[s.jsx("colgroup",{children:$.map(J=>s.jsx("col",{"data-col":J.key,className:fX[J.key]||void 0},J.key))}),s.jsx("thead",{children:s.jsx("tr",{children:$.map(J=>s.jsx("th",{"data-col":J.key,className:`ta-${J.align}`,children:J.key==="pick"?s.jsx(Dr,{checked:X,indeterminate:q,disabled:!K.length,title:r("全选当前筛选出的出口"),"aria-label":r("全选当前筛选出的出口"),onCheckedChange:ie=>DY(K,ie)}):J.label},J.key))})}),s.jsx("tbody",{children:ce()})]})}),s.jsx(Li,{leading:s.jsxs(s.Fragment,{children:[e.data?.clash&&e.data.clash.available===!1?s.jsx("span",{className:"text-subtle",children:e.data.clash.error?r("未检测到 Clash Verge:{reason}",{reason:e.data.clash.error}):r("未检测到 Clash Verge")}):null,e.error?s.jsx("span",{className:"text-destructive",children:r("读取失败:{reason}",{reason:e.error})}):null]}),total:Q.length,page:F.page,pageCount:F.pageCount,size:F.size,onSizeChange:F.setSize,onPageChange:F.goto,range:F.paged?{start:F.rangeStart,end:F.rangeEnd}:null}),a?s.jsx(FY,{item:a.item,onClose:()=>o(null)}):null,c?s.jsx($Y,{onClose:()=>d(!1)}):null,f?s.jsx(cX,{onClose:()=>p(!1)}):null]})})}function tl(e){return e.source==="clash"?"clash":e.source==="subscription"?"subscription":"manual"}function iD(){return[{key:"manual",label:r("手动"),note:r("本页可编辑、可删除")},{key:"clash",label:"Clash Verge",note:r("名字与端口在 Clash Verge 里改;启用可在本页关闭")},{key:"subscription",label:r("订阅"),note:r("名字与端口跟随订阅与内核;启用可在本页关闭")}]}function xX(e){const t=a=>e.filter(o=>tl(o)===a).length;return[{value:"all",label:r("全部"),count:e.length},{value:"manual",label:r("手动"),count:t("manual")},{value:"clash",label:"Clash",count:t("clash")},{value:"subscription",label:r("订阅"),count:t("subscription")}]}function cD(e){return e.enabled===!1?"off":e.port===null||e.port===void 0?"wait":e.lastTest?.at?e.lastTest.success?"ok":"fail":"none"}function bX(e){const t=a=>e.filter(o=>cD(o)===a).length;return[{value:"all",label:r("全部状态"),count:e.length},{value:"ok",label:r("可用"),count:t("ok")},{value:"fail",label:r("失败"),count:t("fail")},{value:"wait",label:r("未就绪"),count:t("wait")},{value:"off",label:r("已禁用"),count:t("off")}]}const uD="__orphan";function vX(e,t){const a=e.filter(d=>tl(d)==="subscription"),o=t.map(d=>({value:d.id,label:d.name||d.id,count:a.filter(f=>!f.orphan&&f.providerId===d.id).length})).sort((d,f)=>f.count-d.count||d.label.localeCompare(f.label)),c=a.filter(d=>d.orphan).length;return[{value:"all",label:r("全部提供方"),count:e.length},{value:"manual",label:r("手动"),count:e.filter(d=>tl(d)==="manual").length},{value:"clash",label:"Clash Verge",count:e.filter(d=>tl(d)==="clash").length},{value:"subscription",label:r("全部订阅"),count:a.length},...o,...c?[{value:uD,label:r("已移除的订阅"),count:c}]:[]]}function yX(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]})}window.wbProxiesPanel={load:async()=>{await pp(),await Dl()},visibleColumns:()=>oD().map(e=>({key:e.key}))};const dD='.page[data-page="proxies"]';function fD(){const e=document.querySelector(dD);!e||e.dataset.mounted==="1"||(e.dataset.mounted="1",e.replaceChildren(),vn.createRoot(e).render(s.jsx(gX,{})),tr().wbApp?.currentPage==="proxies"&&(pp(),Dl()))}document.querySelector(dD)?fD():document.addEventListener("DOMContentLoaded",fD,{once:!0});const sx=["today","7","30","month","all","custom"],b0="7",v0="custom",pD="workbuddy-desktop-report-range",mD="workbuddy-desktop-report-custom-range",hD={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部"),custom:r("自定义区间")},jX={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部"),custom:r("自定义")};function wX(){try{const e=localStorage.getItem(pD);return e!==null&&sx.includes(e)?e:b0}catch{return b0}}function y0(e){const t=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function SX(){const e=new Date;return{start:y0(new Date(e.getFullYear(),e.getMonth(),e.getDate()-6)),end:y0(e)}}const rx=/^\d{4}-\d{2}-\d{2}$/;function NX(){try{const e=localStorage.getItem(mD);if(e){const t=JSON.parse(e),a=typeof t?.start=="string"?t.start:"",o=typeof t?.end=="string"?t.end:"";if(rx.test(a)&&rx.test(o)&&a<=o)return{start:a,end:o}}}catch{}return SX()}function kX(e){try{localStorage.setItem(mD,JSON.stringify(e))}catch{}}const CX=[[0,r("一")],[2,r("三")],[4,r("五")]],gD=400;function Zi(e){const t=j0();return t.formatInt?t.formatInt(e):(Number(e)||0).toLocaleString("zh-CN")}function j0(){return window.wbUnits||{}}function ss(e){const t=j0();return t.formatTokens?t.formatTokens(e):String(Number(e)||0)}function xD(e,t){const a=j0();return a.formatAxis?a.formatAxis(e,t):String(e)}function Wi(e){return`${((Number(e)||0)*100).toFixed(1)}%`}function Pt(e){return Math.round(e*10)/10}function ax(e){return[...e].reduce((t,a)=>t+(/[\u2e80-\u9fff]/.test(a)?9.7:5.4),0)}function lx(e){const[t,a,o]=String(e||"").split("-").map(Number);return new Date(t||1970,(a||1)-1,o||1)}const TX=[r("日"),r("一"),r("二"),r("三"),r("四"),r("五"),r("六")];function ox(e){const t=lx(e);return r("{m}月{d}日 周{wd}",{m:t.getMonth()+1,d:t.getDate(),wd:TX[t.getDay()]})}function bD(e){const t=String(e||"").slice(11,13);return t?`${t}:00`:"—"}const EX=8;function vD(e,t){const a=(Array.isArray(e)?e:[]).map(d=>({name:String(d?.label??d?.model??"").trim()||r("未知模型"),tokens:Number(d?.tokens)||0})).filter(d=>d.tokens>0);if(!a.length)return[];const o=a.slice(0,EX),c=o.map(d=>`${t?`[${t(d.name)}]`:""}${r("{model}:{tokens} tokens",{model:d.name,tokens:ss(d.tokens)})}`);return a.length>o.length&&c.push(r("…还有 {n} 个模型",{n:a.length-o.length})),c}function yD(e,t){return[ox(e.date),r("总 Token:{tokens}({n} 次请求)",{tokens:ss(e.tokens),n:Zi(e.requests)}),...vD(e.models,t)].join(` +`)}function AX(e,t){return[`${ox(String(e.hour).slice(0,10))} ${bD(e.hour)}`,r("命中率 {rate}(命中 {hit} / 输入 {input})",{rate:Wi(e.rate),hit:ss(e.hitTokens),input:ss(e.inputTokens)}),r("总 Token:{tokens}",{tokens:ss(e.totalTokens)}),...vD(e.models,t)].join(` +`)}const RX=[1,1.5,2,2.5,3,4,5,6,8,10];function OX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;return(RX.find(c=>c>=a-1e-9)??10)*t}function w0(e){return OX(e/4)*4}function MX(e,t,a){const o=e||{},c=o.topModel,d=Number(o.requests)||0,f=Number(o.successful)||0,p=d?`${(f/d*100).toFixed(1)}%`:"—",h=[{key:"requests",label:r("总请求数"),value:Zi(d),sub:hD[t]||"",mono:!1},{key:"successful",label:r("成功请求数"),value:Zi(f),sub:r("成功率 {rate}",{rate:p}),mono:!1},{key:"tokens",label:r("总 Token"),value:ss(o.tokens),sub:r("输入 + 输出"),mono:!1},{key:"activeDays",label:r("活跃天数"),value:Zi(o.activeDays),sub:r("区间共 {n} 天",{n:a}),mono:!1},{key:"streak",label:r("当前连续天数"),value:Zi(o.streak),sub:r("含今天在内往前数"),mono:!1}];return h.push(c?{key:"topModel",label:r("Top 模型"),value:String(c.model??""),sub:r("{tokens} tokens · 占 {pct}",{tokens:ss(c.tokens),pct:Wi(c.percentage)}),mono:!0}:{key:"topModel",label:r("Top 模型"),value:"—",sub:r("所选范围内还没有模型用量"),mono:!1}),h}function jD(e){if(!Array.isArray(e))return null;const t=e.map(c=>({id:String(c?.id??"").trim(),label:String(c?.label??"").trim(),tokens:Number(c?.totalTokens??c?.tokens)||0})).filter(c=>c.tokens>0);if(!t.length)return[];const a=t.reduce((c,d)=>c+d.tokens,0),o=c=>a?c/a*100:0;return[...t].sort((c,d)=>d.tokens-c.tokens).map((c,d)=>{const f=o(c.tokens),p=ss(c.tokens),h=c.label||c.id||r("未知"),v=c.id?r("{name}({id})",{name:h,id:c.id}):h;return{key:`${d}-${c.id||h}`,id:c.id,name:h,full:v,tip:r("{name}:{tokens} tokens · 占 {pct}%",{name:v,tokens:p,pct:f.toFixed(1)}),tokensText:p,percentText:`${f.toFixed(1)}%`,barWidth:`${f.toFixed(1)}%`}})}function wD(e){return`${ss(e.reduce((t,a)=>t+(Number(a?.totalTokens??a?.tokens)||0),0))} tokens`}const ix=["#f73b00","#f7bb07","#4aaa4d","#1872cb","#3444a3","#13c2c2","#722ed1","#eb2f96","#a0d911","#34d399","#d946ef","#ff85c0","#b37feb","#9d174d","#ffa39e","#69b1ff"],DX={size:220,inner:.62,outer:.88,padAngle:2};function IX(e,t,a,o,c,d){const f=D=>(D-90)*Math.PI/180,p=(D,C)=>[Pt(e+D*Math.cos(f(C))),Pt(t+D*Math.sin(f(C)))],h=d-c;if(h>=359.999){const[D,C]=p(a,0),[A,R]=p(a,180),[I,P]=p(o,0),[O,_]=p(o,180);return`M ${D} ${C} A ${a} ${a} 0 1 1 ${A} ${R} A ${a} ${a} 0 1 1 ${D} ${C} Z M ${I} ${P} A ${o} ${o} 0 1 0 ${O} ${_} A ${o} ${o} 0 1 0 ${I} ${P} Z`}const[v,y]=p(a,c),[b,j]=p(a,d),[w,k]=p(o,d),[S,N]=p(o,c),T=h>180?1:0;return`M ${v} ${y} A ${a} ${a} 0 ${T} 1 ${b} ${j} L ${w} ${k} A ${o} ${o} 0 ${T} 0 ${S} ${N} Z`}const PX="#9aa0a6";function SD(e){const t=new Map;for(const a of Array.isArray(e)?e:[]){const o=String(a?.label??a?.model??a?.id??"").trim();!o||t.has(o)||(Number(a?.totalTokens??a?.tokens)||0)>0&&t.set(o,ix[t.size%ix.length])}return t}function ND(e,t){const a=(Array.isArray(e)?e:[]).map(N=>({label:String(N?.label??N?.model??N?.id??"").trim()||t,tokens:Number(N?.totalTokens??N?.tokens)||0,requests:Number(N?.requests)||0})).filter(N=>N.tokens>0);if(!a.length)return null;const o=a.reduce((N,T)=>N+T.tokens,0);if(!o)return null;const c=SD(e),{size:d,inner:f,outer:p,padAngle:h}=DX,v=d/2,y=d/2,b=d/2*p,j=d/2*f;let w=0;const k=[],S=[];return a.forEach((N,T)=>{const D=N.tokens/o,C=D*360,A=a.length>1?Math.min(h/2,C/4):0,R=w+A,I=w+C-A;w+=C;const P=c.get(N.label)??ix[T%ix.length];let O=null;if(D>=.03){const _=(R+I)/2,L=j+(b-j)*.6,H=(_-90)*Math.PI/180;O={x:Pt(v+L*Math.cos(H)),y:Pt(y+L*Math.sin(H)),text:`${Math.round(D*100)}%`}}I>R&&k.push({key:`${T}-${N.label}`,d:IX(v,y,b,j,R,I),fill:P,evenOdd:C>=359.999,label:O,tip:`${N.label} · ${ss(N.tokens)} tokens · ${Wi(D)}`}),S.push({key:`${T}-${N.label}`,fill:P,name:N.label,tokensText:ss(N.tokens),percentText:Wi(D),tip:r("{name} · {tokens} tokens · {n} 次请求 · {pct}",{name:N.label,tokens:ss(N.tokens),n:Zi(N.requests),pct:Wi(D)})})}),{size:d,slices:k,legend:S,totalText:ss(o)}}const _X=[1,1.25,1.5,2,2.5,3,4,5,6,8,10];function LX(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e)),a=e/t;let o=1;for(const c of _X)c<=a+1e-9&&(o=c);return o*t}function zX(e){const t=Number(e)||0;if(t<=0)return[0,1,2,3,1/0];const a=Math.max(1,LX(t/4));return[0,a,a*2,a*3,1/0]}function BX(e,t){if(e===0)return"0";const a=t[e-1],o=t[e];return Number.isFinite(o)?a===0?`≤${ss(o)}`:`${ss(a)}–${ss(o)}`:`>${ss(a)}`}function kD(e){const t=Array.isArray(e)?e:[];return zX(t.reduce((a,o)=>Math.max(a,Number(o?.tokens)||0),0))}function HX(e,t){const a=Array.isArray(e)?e:[];if(!a.length)return null;const o=(lx(a[0].date).getDay()+6)%7,c=new Array(o).fill(null).concat(a),d=Math.ceil(c.length/7),f=3,p=20,h=t-p,v=Math.floor((h-f*(d-1))/d),y=Math.max(7,Math.min(26,v)),b=y+3,j=y+f,w=p+d*j-f,k=Math.max(0,Math.round((t-w)/2)),S=b+7*j-f+2,N=Math.max(w,Math.round(t)),T=kD(a),D=O=>T.findIndex(_=>Number(O)<=_),C=[];for(let O=0;O({key:_,x:k+p-6,y:Pt(b+O*j+y/2),text:_})),R=[];let I=-1,P=-9;for(let O=0;O({level:t,text:BX(t,e)}))}function VX(e){const t=e||{};return[["last10m",r("近 10 分钟")],["last1h",r("近 1 小时")],["last24h",r("近 24 小时")],["last7d",r("近 7 天")]].map(([o,c])=>{const d=t[o]||{},f=Number(d.inputTokens)||0;return{key:o,label:c,value:f?Wi(d.rate):"—",sub:r("命中 {hit} / 输入 {input}",{hit:ss(d.hitTokens),input:ss(f)})}})}function FX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=230,d={left:44,right:56,top:26,bottom:24},f=Math.max(40,t-d.left-d.right),p=c-d.top-d.bottom,h=o.map(q=>Number(q.rate)||0),v=o.map(q=>Number(q.totalTokens)||0),y=Math.max(1,w0(Math.max(...h))),b=Math.max(...v),j=w0(b),w=b>0,k=q=>d.left+(o.length>1?f*q/(o.length-1):f/2),S=q=>d.top+p-p*q/y,N=q=>d.top+p-p*q/j,T=[],D=[],C=[];for(let q=0;q<=4;q+=1){const $=y*q/4,Y=Pt(S($)),F=$*100;T.push({key:`g${q}`,y:Y}),D.push({key:`r${q}`,x:d.left-8,y:Y,anchor:"end",text:`${Number.isInteger(F)?F:F.toFixed(1)}%`}),w&&C.push({key:`t${q}`,x:Pt(d.left+f+8),y:Y,anchor:"start",text:xD(j*q/4,j)})}const A=o.length===1?4.5:2.5,R=(q,$)=>({points:q.map((Y,F)=>`${Pt(k(F))},${Pt($(Y))}`).join(" "),dots:q.map((Y,F)=>({key:`d${F}`,cx:Pt(k(F)),cy:Pt($(Y))}))}),I=[],P=(q,$,Y,F)=>{const G=ax(Y),W=F==="middle"?q-G/2:F==="end"?q-G:q,le={left:W,right:W+G,top:$-8.5,bottom:$+2.5};return I.some(M=>le.leftM.left-2&&le.topM.top-1)?null:(I.push(le),{key:`${Y}-${q}-${$}`,x:Pt(q),y:Pt($),text:Y,anchor:F})},O=(q,$)=>{const Y=ax($)/2;return q-Yd.left+f+6?"end":"middle"},_=[];w&&o.forEach((q,$)=>{if(!(Number(q.totalTokens)>0))return;const Y=N(v[$]),F=Y-12>=d.top-10,G=ss(v[$]),W=P(k($),F?Y-12:Y+13,G,O(k($),G));W&&_.push({...W,key:`tl${$}`})});const L=[];o.forEach((q,$)=>{if(!((Number(q.inputTokens)||0)+(Number(q.hitTokens)||0)>0))return;const F=S(h[$]),G=F+15<=d.top+p+8,W=Wi(h[$]),le=P(k($),G?F+13:F-7,W,O(k($),W));le&&L.push({...le,key:`rl${$}`})});const H=o.length>1?f/(o.length-1):f,B=d.left,z=d.left+f,Q=o.length<=gD?o.map((q,$)=>{const Y=Math.max(B,k($)-H/2),F=Math.min(z,k($)+H/2);return{key:`h${$}`,x:Pt(Y),width:Pt(F-Y),tip:AX(q,a)}}):null,K=Math.max(1,Math.ceil(o.length/8)),X=[];for(let q=0;q=o.length;X.push({key:`x${q}`,x:Pt(k(q)),y:c-8,anchor:q===0?"start":$?"end":"middle",text:bD(o[q].hour)})}return{width:t,height:c,plotLeft:B,plotW:f,plotH:p,plotTop:d.top,grid:T,rateTicks:D,tokenTicks:C,rateLine:R(h,S),tokenLine:w?R(v,N):null,dotR:A,rateLabels:L,tokenLabels:_,hourTicks:X,hits:Q}}const $X=13;function qX(e,t,a){const o=Array.isArray(e)?e:[];if(!o.length)return null;const c=240,d={left:50,right:14,top:26,bottom:26},f=Math.max(40,t-d.left-d.right),p=f/o.length,h=o.map(K=>Number(K.tokens)>0?ss(K.tokens):""),v=Math.max(0,...h.map(ax)),y=h.every(K=>!K)||v+4<=p,b=!y&&p>=$X;b&&(d.top=10+Math.ceil(v*1.25));const j=c-d.top-d.bottom,w=o.map(K=>Number(K.tokens)||0),k=Math.max(...w),S=w0(k),N=Math.max(1,Math.min(28,p*.68)),T=d.top+j,D=K=>d.top+j-j*K/S,C=o.length<=gD,A=k<=0,R=[],I=[];if(!A)for(let K=0;K<=4;K+=1){const X=S*K/4,q=Pt(D(X));R.push({key:`g${K}`,x1:d.left,y:q,x2:Pt(d.left+f)}),I.push({key:`v${K}`,x:d.left-8,y:q,anchor:"end",text:xD(X,S)})}const P=[];o.forEach((K,X)=>{const q=Number(K.tokens)||0;if(q<=0)return;const $=D(q);P.push({key:String(K.date??X),x:Pt(d.left+p*X+(p-N)/2),y:Pt($),width:Pt(N),height:Pt(Math.max(1,T-$)),rx:N>4?2:1,tip:yD(K),nativeTip:!C})});const O=[],_=[],L=(K,X)=>{const q=h[K],$=D(Number(o[K].tokens)||0),Y=Pt(d.left+p*K+p/2);if(b)return{key:`b${K}`,x:Y,y:Pt($-6),anchor:"start",text:q,rotate:!0};const F=$-6,G=F-9M.leftU.left-2&&M.topU.top-1))return null;_.push(M)}return{key:`b${K}`,x:Y,y:W,anchor:"middle",text:q}};if(y||b)h.forEach((K,X)=>{if(!K)return;const q=L(X,!1);q&&O.push(q)});else{const K=o.map((X,q)=>({index:q,value:Number(X.tokens)||0})).filter(X=>X.value>0).sort((X,q)=>q.value-X.value);for(const X of K){if(O.length>=8)break;const q=L(X.index,!0);q&&O.push(q)}}const H=C?o.map((K,X)=>({key:`h${X}`,x:Pt(d.left+p*X),width:Pt(p),tip:yD(K,a)})):null,B=Math.max(1,Math.ceil(o.length/6)),z=[];for(let K=0;K{const X=o.length===1,q=!X&&K===o.length-1,$=lx(o[K].date);return{key:`d${K}`,x:X?d.left+f/2:q?d.left+f:Pt(d.left+p*K+p/2),y:c-8,anchor:X?"middle":q?"end":K===0?"start":"middle",text:`${$.getMonth()+1}/${$.getDate()}`}});return{width:t,height:c,plotLeft:d.left,plotW:f,plotH:j,plotTop:d.top,grid:R,valueTicks:I,bars:P,barLabels:O,dateTicks:Q,hits:H,blank:A}}function Ji(){return window}const CD=1e3,GX=sx.map(e=>({value:e,label:jX[e]})),KX=r("所选范围内每个账号各消耗了多少 Token,按 Token 用量从多到少排。账号是比提供商更细的一维:同一家可以挂多个账号,转发时按优先级在候选链上依次尝试,所以这里反映的是「具体哪个登录态在出力」。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知账号」是指那批请求没有账号身份:走默认登录态转发(未配置账号列表)时会这样;这一维上线前写出的旧聚合行也没有账号明细,但它们会在升级导入旧数据时按明细自动补算回来 —— 只有明细已被手动清理掉的那几天补不回来,仍留在「未知账号」里,那是确实无从恢复的部分。"),YX=r("所选范围内每个提供商各消耗了多少 Token,按 Token 用量从多到少排。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。百分比按本区间的总 Token 数算(这一块只看用量,请求次数与成功率在概览卡片里)。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了(请求体非法、模型不存在、没有可用账号)。这一维与账号那一维不同:旧明细里根本没有「哪家承载」的信息(早期版本只有单一上游,但那是配置事实而非逐条记录),所以无法回算,旧数据会一直留在「未知」里;此后新产生的请求都会记上具体的提供商。"),XX=r("所选范围内每个模型各消耗了多少 Token,按用量从多到少排,扇区角度即占比。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该模型的 Token 用量与百分比。扇区内的百分比只在 ≥3% 时标出,更小的会挤成一团 —— 完整读数在右侧列表与悬停气泡里。颜色按用量排名分配:最大的那段是红色,依次往后;同一份报表里换个维度看,配色口径不变。"),QX=r("所选范围内每个提供商各消耗了多少 Token,按用量从多到少排,扇区角度即占比。同一个模型名可能有多家都能提供,网关按设置页「转发路由」的优先级依次尝试,所以占比也反映了实际落到谁身上。中心是这一维的合计(等于概览里的总 Token),右侧每行给出该提供商的 Token 用量与百分比。「未知」是指那批请求没记下承载它的提供商 —— 主要是记录提供商这个功能上线之前的旧明细,其次是请求在选定上游之前就失败了。"),ZX=r("命中率 = 缓存读取 Token / 输入 Token(promptTokens)。窗口越短越贴近「此刻」:上游把缓存读取与输入分开上报时,该比值合法地可能超过 100%,此处不夹取值、如实展示。"),WX=r("每天的总 Token 用量(输入 + 输出)。柱顶标出当天的读数;区间很长、柱子挤到放不下时只标最高的那几天,其余悬停柱子即可读到。");let cx=CD,ux=!0,S0=!1,N0=!1,k0=0,Po=null,ec=null,dx=null;function tc(e,t="empty"){return s.jsx("div",{className:t,style:{padding:"14px 0"},children:e})}function fx({text:e}){return s.jsx("span",{className:"tip-q","data-tip":e})}function JX({accountId:e}){const t=(Ji().wbApp?.getState?.()?.accounts?.accounts||[]).find(f=>f?.id===e),a=typeof t?.provider=="string"?t.provider:"";if(!a)return null;const o=Ji().wbProviders?.labelOf?.(a)||a,c=t&&Ji().wbAccountsModel?.editionSuffix?.(t)||"",d=c?`${o} ${c}`:o;return s.jsx("span",{className:`pbadge p-${a}`,title:r("提供商:{text}",{text:d}),children:d})}function eQ({summary:e,range:t}){const a=Array.isArray(e.dailyTrend)?e.dailyTrend:[];return s.jsx(s.Fragment,{children:MX(e.overview,t,a.length).map(o=>s.jsxs("div",{className:"field",children:[s.jsx("div",{className:"label",children:o.label}),s.jsxs("div",{className:o.mono?"value mono":"value",children:[o.value,o.sub?s.jsx("div",{className:"sub",children:o.sub}):null]})]},o.key))})}function TD({panelId:e,listId:t,labelId:a,title:o,tip:c,rows:d,totalText:f,withBadge:p,emptyText:h}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:o}),s.jsx(fx,{text:c}),s.jsx("span",{className:"panel-sub",id:a,children:f})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"rank-shares",id:t,children:d.length?d.map(v=>s.jsxs("div",{className:"rank-row","data-tip":v.tip,children:[s.jsxs("span",{className:"name",title:v.full,children:[p?s.jsx(JX,{accountId:v.id}):null,v.name]}),s.jsx("span",{className:"track",children:s.jsx("span",{className:"bar",style:{width:v.barWidth}})}),s.jsx("span",{className:"num",title:`${v.tokensText} tokens`,children:v.tokensText}),s.jsx("span",{className:"pct",children:v.percentText})]},v.key)):tc(h)})})]})}function ED({panelId:e,listId:t,title:a,tip:o,ariaLabel:c,view:d,emptyText:f}){return s.jsxs("section",{className:"panel",id:e,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:a}),s.jsx(fx,{text:o})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{id:t,children:d?s.jsxs("div",{className:"donut-layout",children:[s.jsxs("div",{className:"donut-wrap",children:[s.jsx("svg",{className:"donut-svg",width:d.size,height:d.size,viewBox:`0 0 ${d.size} ${d.size}`,role:"img","aria-label":c,children:d.slices.map(p=>s.jsxs(x.Fragment,{children:[s.jsx("path",{className:"donut-slice",d:p.d,fill:p.fill,fillRule:p.evenOdd?"evenodd":void 0,tabIndex:-1,"data-tip":p.tip}),p.label?s.jsx("text",{className:"donut-label",x:p.label.x,y:p.label.y,textAnchor:"middle",dominantBaseline:"central",children:p.label.text}):null]},p.key))}),s.jsxs("div",{className:"donut-center",children:[s.jsx("div",{className:"donut-center-value",children:d.totalText}),s.jsx("div",{className:"donut-center-label",children:r("总 Token")})]})]}),s.jsx("div",{className:"donut-legend",children:d.legend.map(p=>s.jsxs("div",{className:"donut-legend-row","data-tip":p.tip,children:[s.jsx("span",{className:"donut-dot",style:{background:p.fill}}),s.jsx("span",{className:"donut-legend-name",title:p.name,children:p.name}),s.jsx("span",{className:"donut-legend-tokens",children:p.tokensText}),s.jsx("span",{className:"donut-legend-percent",children:p.percentText})]},p.key))})]}):tc(f)})})]})}function tQ({view:e}){return s.jsxs("svg",{className:"report-svg",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,role:"img","aria-label":r("近 365 天活跃热力图"),children:[e.months.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:10,children:t.text},t.key)),e.weekdays.map(t=>s.jsx("text",{className:"hm-axis",x:t.x,y:t.y,textAnchor:"end",dominantBaseline:"middle",children:t.text},t.key)),e.cells.map(t=>s.jsx("rect",{className:`hm-cell l${t.level}`,x:t.x,y:t.y,width:t.size,height:t.size,rx:2,tabIndex:-1,"data-tip":t.tip},t.key))]})}function AD({line:e,cls:t,radius:a}){return s.jsxs(s.Fragment,{children:[s.jsx("polyline",{className:`chart-line ${t}`,points:e.points}),e.dots.map(o=>s.jsx("circle",{className:`chart-dot ${t}`,cx:o.cx,cy:o.cy,r:a},o.key))]})}function C0({items:e,cls:t}){return s.jsx(s.Fragment,{children:e.map(a=>s.jsx("text",{className:`chart-label ${t}`,x:a.x,y:a.y,textAnchor:a.anchor,transform:a.rotate?`rotate(-90 ${a.x} ${a.y})`:void 0,dominantBaseline:a.rotate?"central":void 0,children:a.text},a.key))})}function nQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("近 24 小时缓存命中率与总 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:o,y1:p.y,x2:Pt(o+c),y2:p.y},p.key)),e.rateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.tokenLine?s.jsx(AD,{line:e.tokenLine,cls:"tokens",radius:e.dotR}):null,s.jsx(AD,{line:e.rateLine,cls:"rate",radius:e.dotR}),s.jsx(C0,{items:e.tokenLabels,cls:"tokens"}),s.jsx(C0,{items:e.rateLabels,cls:"rate"}),e.hourTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key))]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}function sQ({view:e}){const{width:t,height:a,plotLeft:o,plotW:c,plotTop:d,plotH:f}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("svg",{className:"report-svg",width:t,height:a,viewBox:`0 0 ${t} ${a}`,role:"img","aria-label":r("按天 Token 趋势"),children:[e.grid.map(p=>s.jsx("line",{className:"chart-grid",x1:p.x1,y1:p.y,x2:p.x2,y2:p.y},p.key)),e.valueTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,dominantBaseline:"middle",children:p.text},p.key)),e.bars.map(p=>p.nativeTip?s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx,children:s.jsx("title",{children:p.tip})},p.key):s.jsx("rect",{className:"bar",x:p.x,y:p.y,width:p.width,height:p.height,rx:p.rx},p.key)),s.jsx(C0,{items:e.barLabels,cls:"tokens"}),e.dateTicks.map(p=>s.jsx("text",{className:"chart-axis",x:p.x,y:p.y,textAnchor:p.anchor,children:p.text},p.key)),e.blank?s.jsx("text",{className:"chart-empty",x:Pt(o+c/2),y:Pt(d+f/2),textAnchor:"middle",children:r("所选范围内暂无请求")}):null]}),e.hits?s.jsx("svg",{className:"report-svg chart-hit-layer",width:t,height:a,viewBox:`0 0 ${t} ${a}`,"aria-hidden":"true",children:e.hits.map(p=>s.jsx("rect",{className:"chart-hit",x:p.x,y:d,width:p.width,height:Pt(f),tabIndex:-1,"data-tip":p.tip,"data-tip-variant":"plain"},p.key))}):null]})}const rQ=680;function T0(){const e=x.useRef(null),[t,a]=x.useState(0);return x.useLayoutEffect(()=>{const o=e.current;if(!o)return;let c=o.clientWidth;if(c&&a(c),typeof ResizeObserver!="function")return;const d=new ResizeObserver(()=>{const f=o.clientWidth;!f||f===c||(c=f,a(f))});return d.observe(o),()=>d.disconnect()},[]),[e,t||rQ]}async function RD(){if(!S0)try{const e=await Ji().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="reportAutoRefresh");E0(t||null),S0=Array.isArray(e?.tasks)}catch(e){console.warn("读取报表自动刷新间隔失败,按默认 1 秒:",e instanceof Error?e.message:e),E0(null)}}function E0(e){S0=!0;const t=Number(e?.interval);!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(e.unit==="seconds"||e.unit==="minutes")?(ux=e.enabled!==!1,cx=e.unit==="minutes"?t*6e4:t*1e3):(ux=!0,cx=CD),ec?.applyAutoConfig(cx,ux)}const aQ={summary:null,error:null};function lQ(){const[e,t]=x.useState(aQ),[a,o]=x.useState(wX),[c,d]=x.useState(NX),[f,p]=x.useState(()=>({ms:cx,enabled:ux})),[,h]=x.useState(0),v=x.useRef(a),y=x.useRef(c),b=x.useCallback(G=>{t(G)},[]),j=x.useCallback(async(G={})=>{RD();const W=++k0,le=v.current,M=le===v0?y.current:void 0;try{const U=Ji().workbuddyDesktop;if(!U)throw new Error("后端桥不可用");const Z=await U.getStatsSummary(le,M);if(W!==k0)return Po;if(!Z||typeof Z!="object")throw new Error("后端未返回报表数据");return Po=Z,b({summary:Z,error:null}),Po}catch(U){if(W!==k0)return Po;const Z=U instanceof Error?U.message:"";return Po=null,G.silent||console.warn("读取报表数据失败:",Z),b({summary:null,error:Z||r("未知错误")}),null}},[b]),w=x.useCallback(G=>{G!==void 0&&(Po=G||null,G&&b({summary:G,error:null}))},[b]),k=x.useCallback(G=>{const W=sx.includes(G)?G:b0;if(W!==v.current){v.current=W,o(W);try{localStorage.setItem(pD,W)}catch{}j()}},[j]),S=x.useCallback(G=>{const W={...y.current,...G};if(!rx.test(W.start)||!rx.test(W.end))return;const le=W.start<=W.end?W:G.start?{start:W.start,end:W.start}:{start:W.end,end:W.end};y.current=le,d(le),kX(le),v.current===v0&&j()},[j]);x.useEffect(()=>{if(ec={load:j,render:w,applyAutoConfig:(G,W)=>p({ms:G,enabled:W})},dx){const G=dx;dx=null,w(G.data)}return Ji().wbApp?.currentPage==="overview"&&j({silent:!0}),()=>{ec=null}},[j,w]),x.useEffect(()=>{if(!f.enabled||f.ms<=0)return;const G=window.setInterval(()=>{document.hidden||Ji().wbApp?.currentPage!=="overview"||N0||(N0=!0,j({silent:!0}).finally(()=>{N0=!1}))},f.ms);return()=>{window.clearInterval(G)}},[f,j]),x.useEffect(()=>{const G=()=>h(W=>W+1);return window.addEventListener("wb-units-changed",G),()=>window.removeEventListener("wb-units-changed",G)},[]);const N=T0(),T=T0(),D=T0(),{summary:C,error:A}=e,R=C&&sx.includes(C.range??"")?C.range:a,I=C&&Array.isArray(C.heatmap)?C.heatmap:[],P=C&&Array.isArray(C.cacheTrend24h)?C.cacheTrend24h:[],O=C&&Array.isArray(C.dailyTrend)?C.dailyTrend:[],_=C&&Array.isArray(C.providers)?C.providers:null,L=C&&Array.isArray(C.accounts)?C.accounts:null,H=C&&Array.isArray(C.models)?C.models:null,B=A?tc(r("读取报表失败:{error}",{error:A}),"empty report-error"):null,z=tc(r("正在加载…")),Q=B??z,K=x.useMemo(()=>SD(H||[]),[H]),X=x.useCallback(G=>K.get(G)||PX,[K]),q=C?HX(I,N[1]):null,$=C?FX(P,T[1],X):null,Y=C?qX(O,D[1],X):null,F=y0(new Date);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("统计概览")}),s.jsx("span",{className:"panel-sub",id:"report-range-label",children:hD[R]||""}),s.jsxs("div",{className:"head-actions",children:[s.jsx(In,{options:GX,value:a,onValueChange:k,"aria-label":r("报表时间范围")}),a===v0?s.jsxs("span",{className:"report-date-range",children:[s.jsx(Fe,{type:"date",className:"report-date-input w-[132px]",value:c.start,max:c.end||F,"aria-label":r("开始日期"),title:r("起始日期(含当天)"),onChange:G=>S({start:G.target.value})}),s.jsx("span",{className:"report-date-sep","aria-hidden":"true",children:"~"}),s.jsx(Fe,{type:"date",className:"report-date-input w-[132px]",value:c.end,min:c.start||void 0,max:F,"aria-label":r("结束日期"),title:r("结束日期(含当天)"),onChange:G=>S({end:G.target.value})})]}):null]})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-overview",children:C?s.jsx(eQ,{summary:C,range:R}):Q})})]}),s.jsxs("div",{className:"report-rank-grid",children:[L?s.jsx(TD,{panelId:"report-accounts-panel",listId:"report-accounts",labelId:"report-accounts-label",title:r("Top 账号"),tip:KX,rows:jD(L)||[],totalText:wD(L),withBadge:!0,emptyText:r("所选范围内还没有账号用量")}):null,_?s.jsx(TD,{panelId:"report-providers-panel",listId:"report-providers",labelId:"report-providers-label",title:r("Top 提供商"),tip:YX,rows:jD(_)||[],totalText:wD(_),withBadge:!1,emptyText:r("所选范围内还没有请求记录")}):null]}),s.jsxs("div",{className:"report-donut-grid",children:[H?s.jsx(ED,{panelId:"report-models-panel",listId:"report-models-donut",title:r("模型用量"),tip:XX,ariaLabel:r("模型用量占比"),view:ND(H,r("未知模型")),emptyText:r("所选范围内还没有模型用量")}):null,_?s.jsx(ED,{panelId:"report-providers-pie-panel",listId:"report-providers-donut",title:r("提供商用"),tip:QX,ariaLabel:r("提供商用占比"),view:ND(_,r("未知")),emptyText:r("所选范围内还没有提供商用量")}):null]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("活跃热力图")}),s.jsx("span",{className:"panel-sub",children:r("近 365 天,按天 Token 用量着色(档位按本窗口峰值自动定)")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"heat-wrap",id:"report-heatmap",ref:N[0],children:C?q?s.jsx(tQ,{view:q}):tc(r("暂无热力图数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsx("span",{className:"heat-scale-label",children:r("Token")}),s.jsx("span",{className:"heat-legend",id:"report-heat-legend",children:C?UX(kD(I)).map(G=>s.jsxs("span",{className:"heat-legend-item",children:[s.jsx("span",{className:`l${G.level}`}),G.text]},G.level)):null}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("方格为本地自然日,无请求显示为空槽")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("缓存命中率")}),s.jsx(fx,{text:ZX})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"field-grid",id:"report-cache-rates",children:C?VX(C.cacheRates).map(G=>s.jsxs("div",{className:"field rate",children:[s.jsx("div",{className:"label",children:G.label}),s.jsxs("div",{className:"value big",children:[G.value,s.jsx("div",{className:"sub",children:G.sub})]})]},G.key)):Q})})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("近 24 小时缓存命中率趋势")}),s.jsx("span",{className:"panel-sub",children:r("按本地整点,无请求的整点不标注")})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap",id:"report-cache-trend",ref:T[0],children:C?$?s.jsx(nQ,{view:$}):tc(r("暂无缓存趋势数据")):Q})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch rate"}),r("缓存命中率"),s.jsx("span",{className:"axis-hint",children:r("左轴")})]}),s.jsxs("span",{className:"chart-legend",children:[s.jsx("span",{className:"swatch tokens"}),r("总 Token"),s.jsx("span",{className:"axis-hint",children:r("右轴")})]}),s.jsx("div",{className:"spacer"}),s.jsx("span",{children:r("无请求的整点按 0% 计,但不写读数")})]})]}),s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("按天 Token 趋势")}),s.jsx(fx,{text:WX}),s.jsx("span",{className:"panel-sub",id:"report-trend-label",children:C?`${C.startDate||"—"} ~ ${C.endDate||"—"}`:"—"})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"chart-wrap tall",id:"report-daily-trend",ref:D[0],children:C?Y?s.jsx(sQ,{view:Y}):tc(r("暂无趋势数据")):Q})})]})]})}async function oQ(e={}){return ec?ec.load(e):Po}function iQ(e){if(e!==void 0){if(!ec){dx={data:e??null};return}ec.render(e)}}function cQ(){return Po}window.wbReport={load:oQ,render:iQ,lastSummary:cQ,applyAutoRefresh:E0};const OD='.page[data-page="overview"]';let MD=!1;function DD(){if(MD)return;const e=document.querySelector(OD);e&&(MD=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(lQ,{})))}document.querySelector(OD)?DD():document.addEventListener("DOMContentLoaded",DD,{once:!0}),RD();const A0={all:{title:r("全部删除"),desc:r("删除日志记录本身。当前有筛选时只删命中的条目,按天聚合报表不受影响;无筛选时清空全部并重置报表。此方式无法恢复。")},raw:{title:r("仅清空报文原文"),desc:r("保留统计行与报表,只抹掉请求 / 响应正文。清理后详情弹窗的「预览对话」将无原文可看,统计数字分毫不动。")}},uQ=["all","raw"],dQ=3e3;function Il(){return window}let hp=!1;function gp(e,t){Il().wbApp?.toast?.(e,t)}function fQ(e){const t=Math.max(0,Number(e)||0);if(t<1024)return`${Math.round(t)} B`;const a=t/1024;if(a<1024)return`${a.toFixed(1)} KB`;const o=a/1024;return o<1024?`${o.toFixed(1)} MB`:`${(o/1024).toFixed(2)} GB`}function R0(){const e=Il().wbRequestsPanel?.clearParams?.();return typeof e=="string"?e:""}function ID(e){return{all:Number(e?.all)||0,raw:Number(e?.raw)||0,dbBytes:Number(e?.dbBytes)||0,vacuumRunning:e?.vacuumRunning===!0}}function O0(e){return e instanceof Error?e.message:String(e)}function PD(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}function pQ({onClose:e}){const[t,a]=x.useState("all"),[o,c]=x.useState({status:"loading"}),[d,f]=x.useState(""),[p,h]=x.useState(!1),[v,y]=x.useState(!1),b=x.useRef(!0),j=x.useRef(null),w=x.useCallback(I=>{hp=I,y(I)},[]),k=x.useCallback(()=>{j.current!==null&&(window.clearInterval(j.current),j.current=null)},[]),S=x.useCallback(I=>{c({status:"ready",all:I.all,raw:I.raw,dbBytes:I.dbBytes}),h(I.vacuumRunning)},[]),N=x.useCallback(async()=>{const I=Il().workbuddyDesktop;if(!I)return;let P;try{P=await I.getStatsClearPreview(R0())}catch{return}if(!b.current)return;const O=ID(P);S(O),!O.vacuumRunning&&(k(),f(""),gp(r("✅ 压缩完成")),Il().wbRequestsPanel?.load?.({silent:!0}))},[S,k]),T=x.useCallback(()=>{j.current===null&&(h(!0),j.current=window.setInterval(()=>{N()},dQ))},[N]);async function D(){c({status:"loading"});try{const I=Il().workbuddyDesktop;if(!I)throw new Error(r("后端桥不可用"));const P=await I.getStatsClearPreview(R0());if(!b.current)return;const O=ID(P);S(O),O.vacuumRunning&&T()}catch(I){if(!b.current)return;c({status:"failed"}),f(r("预览读取失败:{error}",{error:O0(I)}))}}x.useEffect(()=>(b.current=!0,D(),()=>{b.current=!1,k(),hp=!1}),[]);async function C(){const I=Il().workbuddyDesktop;if(I){h(!0);try{await I.compactStatsDb(),f(r("压缩已在后台开始,完成后会自动提示")),T()}catch(P){const O=O0(P);if(/409|正在进行/.test(O)){gp(r("压缩已在进行中")),f(r("压缩已在进行中,接上它的进度等待完成")),T();return}h(!1),f(r("压缩失败:{message}",{message:O})),gp(r("压缩失败:{message}",{message:O}),"err")}}}async function A(){if(hp)return;const I=Il().workbuddyDesktop,P=Il().wbConfirm?.ask;if(!I||!P)return;const O=A0[t].title,_=R0(),L=_.length>0,H=o.status==="ready"?t==="raw"?o.raw:o.all:0;if(await P({title:r("清理请求日志"),html:L?r("确定按当前筛选执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:PD(O),count:H}):r("确定对全部请求日志执行「{label}」?将处理 {count} 条,此操作无法恢复。",{label:PD(O),count:H}),okText:r(t==="raw"?"抹掉原文":"删除"),okClass:"danger"})){w(!0);try{const z=L?`mode=${t}&${_}`:`mode=${t}&all=1`,Q=await I.clearStatsRequests(z),K=Number(Q?.deleted)||0;gp(t==="raw"?r("已抹掉 {count} 条报文原文",{count:K}):r("已删除 {count} 条",{count:K})),w(!1),e(),Il().wbRequestsPanel?.notifyCleared?.()}catch(z){const Q=O0(z);f(r("清理失败:{message}",{message:Q})),gp(r("清理失败:{message}",{message:Q}),"err"),w(!1)}}}const R=o.status==="ready"?r("将删除 {count} 条日志 · 其中 {raw} 条仍带报文原文 · 数据库占用 {db}",{count:o.all,raw:o.raw,db:fQ(o.dbBytes)}):o.status==="failed"?r("预览读取失败"):r("正在统计…");return s.jsx(Qt,{open:!0,onOpenChange:(I,P)=>{if(!I){if(hp){P.cancel();return}e()}},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("清理请求日志")})}),s.jsxs(Bt,{children:[s.jsx(Ah,{"aria-label":r("清理方式"),value:t,onValueChange:I=>a(I==="raw"?"raw":"all"),children:uQ.map(I=>{const P=t===I;return s.jsxs("label",{"data-checked":P?"":void 0,className:"group/card grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2.5 gap-y-0.5 rounded-md border border-border px-3 py-2.5 transition-colors duration-150 ease-out hover:border-border-strong data-checked:border-primary data-checked:bg-primary-soft",children:[s.jsx(vo,{value:I,className:"row-span-2 self-center"}),s.jsx("span",{className:"text-[13px] font-semibold text-foreground group-data-checked/card:text-primary-fg",children:A0[I].title}),s.jsx("span",{className:"text-[11.5px] leading-[1.55] text-subtle",children:A0[I].desc})]},I)})}),s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:R})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:d}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{C()},disabled:p,title:r(p?"压缩正在后台执行,完成后自动恢复":"回收已删除数据占用的磁盘空间(checkpoint + VACUUM,后台执行)"),children:r(p?"压缩中…":"压缩数据库")}),s.jsx(se,{variant:"outline",onClick:e,disabled:v,children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>{A()},disabled:v,children:r(v?"清理中…":"执行清理")})]})]})})}let xp=null,Fu=null;function _D(){xp&&(xp.unmount(),xp=null),Fu&&(Fu.remove(),Fu=null)}function mQ(){hp||_D()}function hQ(){_D(),Fu=document.createElement("div"),document.body.append(Fu),xp=vn.createRoot(Fu),xp.render(s.jsx(pQ,{onClose:mQ}))}window.wbRequestClearModal={open:hQ};const LD=[{value:"detail",label:r("请求详情")},{value:"preview",label:r("预览对话")},{value:"raw",label:r("原始报文")}],gQ="detail",zD="border-b border-hairline px-2.5 py-[7px] align-top",_o="border border-hairline px-2 py-1 align-top",xQ="border border-hairline bg-surface-2 px-2 py-1 text-[11.5px] tracking-normal",px="hover:[&>td]:bg-transparent";function $u(){return window}function M0(){const e=$u().workbuddyDesktop;if(!e)throw new Error(r("后端桥不可用"));return e}let D0=0;function bQ(e){if(!e)return"—";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`}function BD(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}function vQ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":BD(t)}const yQ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计");function jQ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=500&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function mx(e){return $u().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function wQ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function SQ(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function hx(e){return(Number(e?.status)||0)===0&&!e?.error}function HD(e){const t=String(e.provider??"").trim();return String(e.providerLabel??"").trim()||(t?$u().wbProviders?.labelOf?.(t)||t:"")}function bp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I0(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return""}}function P0(e){return e instanceof Error?e.message:String(e)}const UD=[{label:r("请求头"),pick:e=>I0(e.requestHeaders)},{label:r("请求体"),pick:e=>I0(e.requestBody)},{label:r("响应头"),pick:e=>I0(e.responseHeaders)},{label:r("响应体"),pick:e=>e.responseBody?String(e.responseBody):""}];function gx({text:e,loading:t=!1}){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-center text-[12.5px] text-muted-foreground",children:[t?s.jsx(ef,{className:"size-3.5"}):null,e]})}function ua({label:e,children:t}){return s.jsxs(kl,{className:px,children:[s.jsx("th",{scope:"row",className:`w-[76px] whitespace-nowrap text-left text-[12.5px] font-semibold text-muted-foreground ${zD}`,children:e}),s.jsx(Nn,{className:zD,children:t})]})}function NQ({row:e}){if(hx(e)){const c=$u().wbRequestPhase;if(!c?.badgeHtml)return s.jsxs(ze,{variant:"info",shape:"tag",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot"}),r("进行中")]});const d=c.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:c.badgeHtml(e)}}),d?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",dangerouslySetInnerHTML:{__html:d}}):null]})}const t=Number(e.status)||0,a=SQ(e),o=!a&&t>=200&&t<300?r("HTTP {status},但响应体阶段出错",{status:t}):"";return s.jsx(ze,{variant:a?"success":"destructive",shape:"tag",title:o||void 0,children:t||r("失败")})}function kQ({row:e}){const t=String(e.clientModel??"").trim(),a=String(e.upstreamModel??"").trim(),o=String(e.model??"").trim(),c=String(e.clientReasoning??"").trim(),d=String(e.upstreamReasoning??"").trim(),f=(v,y)=>y?`${v}(${y})`:v;if(!t||!a||a.toLowerCase()===t.toLowerCase())return s.jsx(s.Fragment,{children:f(o,d||c)||"—"});const p=f(a,d),h=f(t,c);return s.jsxs("span",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{title:r("转发到上游的模型:{model}",{model:p}),children:["⬆️ ",p]}),s.jsxs("span",{className:"text-muted-foreground",title:r("下游请求的模型:{model}",{model:h}),children:["⬇️ ",h]})]})}function CQ(e){const t=Number(e?.status),a=e?.status!==null&&e?.status!==void 0&&Number.isFinite(t),o=e?.error?String(e.error):"";if(o){const c=a?r("失败({status}):{error}",{status:String(t),error:o}):r("失败:{error}",{error:o});return s.jsx("span",{className:"break-words text-destructive",children:c})}return a?s.jsx("span",{className:"text-success",children:r("成功({status})",{status:String(t)})}):s.jsx("span",{className:"text-muted-foreground",children:r("无结果记录")})}function TQ({row:e}){const t=Array.isArray(e.attemptDetails)?e.attemptDetails:[];if(!t.length)return s.jsx(s.Fragment,{children:"-"});const a=Number(e.attempts)||1;return s.jsxs(Ky,{className:"text-[11.5px]",children:[s.jsx(yE,{children:s.jsx(kl,{className:px,children:[r("轮次"),r("提供商"),r("账号"),r("结果"),r("体积"),r("内部重试"),r("提示")].map(o=>s.jsx(jE,{className:xQ,children:o},o))})}),s.jsxs(Yy,{children:[t.map((o,c)=>{const d=Array.isArray(o?.retries)?o.retries:[],f=d.map(b=>{const j=Number(b?.delayMs),w=Number.isFinite(j)&&j>0?j>=1e3?r(",{n}秒后重试",{n:Math.round(j/1e3)}):r(",{n}毫秒后重试",{n:Math.round(j)}):"";return`${String(b?.reason||r("未知原因"))}${w}`}).join(` +`),p=String(o?.notice??"").trim(),h=Number(o?.bodyBytes),v=Number.isFinite(h)&&h>0?h>=1024*1024?`${(h/1024/1024).toFixed(1)} MB`:h>=1024?`${Math.round(h/1024)} KB`:`${h} B`:"—",y=Number.isFinite(h)&&h>0?r("实际发给上游 {bytes} 字节",{bytes:h.toLocaleString()}):void 0;return s.jsxs(kl,{className:px,children:[s.jsx(Nn,{className:_o,children:c+1}),s.jsx(Nn,{className:_o,children:HD(o)||(o?.provider?String(o.provider):r("未知"))}),s.jsx(Nn,{className:_o,children:o?.account?String(o.account):"—"}),s.jsx(Nn,{className:_o,children:CQ(o)}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:y,children:v}),s.jsx(Nn,{className:`${_o} whitespace-nowrap`,title:f||void 0,children:d.length?r("↻ {n} 次",{n:d.length}):"-"}),s.jsx(Nn,{className:_o,children:p||"—"})]},c)}),t.lengths.jsxs("li",{className:"py-0.5",children:[s.jsxs("b",{children:[y+1,". ",String(v.name||v.id||"—")]}),s.jsxs("span",{className:"text-muted-foreground",children:[" ",String(v.reason||"")]})]},String(v.id??y)))}):null,p.length?s.jsxs("div",{className:"mt-1 text-muted-foreground",children:[r("被跳过:"),p.map(v=>String(v.name||v.id||"")).join("、")]}):null,h?s.jsx("div",{className:"mt-1",children:r("最终承载:{picked}",{picked:h})}):null]})}function AQ({row:e}){if(!e)return s.jsx(gx,{text:r("列表数据已刷新,请重试(关闭后重新打开这条详情)")});const t=String(e.accountName??"").trim(),a=jQ(e);return s.jsx(Ky,{className:"text-[12.5px] text-subtle [&_tr:last-child>td]:border-b-0 [&_tr:last-child>th]:border-b-0",children:s.jsxs(Yy,{children:[s.jsx(ua,{label:r("时间"),children:bQ(e.ts)}),s.jsx(ua,{label:r("状态"),children:s.jsx(NQ,{row:e})}),s.jsx(ua,{label:r("耗时"),children:hx(e)?s.jsxs(s.Fragment,{children:[wQ(e.ts),s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(请求仍在转发中)")})]}):r("{duration} / 首帧 {first}",{duration:BD(e.durationMs),first:vQ(e.firstResponseMs)})}),s.jsx(ua,{label:r("重试次数"),children:String(Number(e.attempts)||1)}),s.jsx(ua,{label:r("模型"),children:s.jsx(kQ,{row:e})}),s.jsxs(ua,{label:r("提供商"),children:[HD(e)||"—",t?s.jsx("span",{className:"text-[11.5px] text-muted-foreground",children:r("(账号:{account})",{account:t})}):null]}),s.jsxs(ua,{label:r("令牌"),children:[r("输入 {input} · 输出 {output} · 总计 {total} · 缓存读 {cache}",{input:mx(e.promptTokens),output:mx(e.completionTokens),total:mx(e.totalTokens),cache:mx(e.cacheReadTokens)}),a?s.jsxs("span",{title:yQ,children:[" · ",a]}):null]}),e.isTest?s.jsx(ua,{label:r("来源"),children:s.jsx(ze,{variant:"brand",shape:"tag",title:r("模型管理页操作列那颗「测试」发起的请求:与真实请求同一条转发链路,但不计入报表统计"),children:r("模型测试")})}):null,s.jsx(ua,{label:r("错误"),children:e.error?s.jsx("span",{className:"text-destructive",children:String(e.error)}):"—"}),s.jsx(ua,{label:r("尝试明细"),children:s.jsx(TQ,{row:e})}),e.route?s.jsx(ua,{label:r("路由回放"),children:s.jsx(EQ,{row:e})}):null,s.jsx(ua,{label:r("敏感词"),children:Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length?s.jsx("span",{className:"inline-flex flex-wrap gap-1.5",children:e.sensitiveHits.map((o,c)=>s.jsxs(ze,{variant:"sensitive",shape:"tag",children:[String(o?.word??"")," × ",String(Number(o?.count)||0)]},c))}):"—"})]})})}function RQ({state:e}){if(!e)return s.jsx(gx,{text:r("正在读取…"),loading:!0});const t=e==="gone"?null:e.body,a=t&&$u().wbConversationPreview?.render?.(t.requestBody,t.responseBody)||"";return a?s.jsxs("div",{children:[e!=="gone"&&e.truncated?s.jsx("div",{className:"mb-2 text-[11.5px] text-warning",children:r("正文超过单条上限,可能已被截断")}):null,s.jsx("div",{dangerouslySetInnerHTML:{__html:a}})]}):s.jsx(gx,{text:r("无报文原文(未开启「调试模式」,或已被清理)")})}function OQ({data:e}){const t=e.status===null||e.status===void 0?"-":String(e.status),a=[e.url?`URL: ${e.url}`:"",e.provider?r("提供商: {provider}",{provider:String(e.provider)}):"",r("上游状态码: {status}",{status:t})].filter(Boolean);return s.jsxs("div",{className:"flex flex-col gap-4",children:[a.length?s.jsx("div",{className:"border-b border-hairline pb-2.5 text-xs leading-[1.7] break-all text-subtle",children:a.map((o,c)=>s.jsx("div",{children:o},c))}):null,UD.map(o=>{const c=o.pick(e)||"";return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("h3",{className:"text-[11.5px] font-semibold tracking-[.02em] text-muted-foreground",children:o.label}),c?s.jsx("pre",{className:"max-h-80 overflow-auto rounded-md border border-border bg-surface-2 p-[10px_12px] font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-subtle",children:c}):s.jsx(gx,{text:r("这条请求没有保存这一段报文")})]},o.label)})]})}function MQ({id:e,row:t,token:a,onClose:o}){const[c,d]=x.useState(gQ),[f,p]=x.useState(null),[h,v]=x.useState(null),[y,b]=x.useState("—"),[j,w]=x.useState("idle"),k=x.useRef(!0),S=x.useRef(null),N=x.useRef({detail:0,preview:0,raw:0}),T=x.useCallback(()=>!k.current||a!==D0,[a]);async function D(){try{const O=await M0().getStatsRequestRaw(e);if(T())return;const _=bp(O)?O:null,L=String(_?.requestBody??"").trim()!==""||String(_?.responseBody??"").trim()!=="";p(_&&L?{body:_,truncated:!!_.truncated}:"gone")}catch(O){if(T())return;p("gone"),console.warn("读取原始正文失败(预览对话显示空态):",P0(O))}}async function C(){try{const O=await M0().getDebugTraffic(e);if(T())return;const _=bp(O)?O:{};if(!UD.some(L=>(L.pick(_)||"").trim())){v("gone");return}v({data:_}),b(_.truncated?r("报文超过单条上限,请求体 / 响应体已按上限截断"):r("内容按原样保存,请求头中的凭据字段已替换为 [redacted]"))}catch(O){if(T())return;v("gone"),b(r("在设置 → 通用里开启「调试模式」后,新发生的请求才会保存报文")),console.warn("读取调试报文失败(原始报文标签隐藏):",P0(O))}}x.useEffect(()=>(k.current=!0,D(),C(),()=>{k.current=!1}),[]),x.useLayoutEffect(()=>{const O=S.current;O&&(O.scrollTop=N.current[c])},[c]);function A(O){if(O==="raw"&&!bp(h)||O===c)return;const _=S.current;_&&(N.current[c]=_.scrollTop),d(O)}async function R(){if(!e||!hx(t))return;const O=$u().wbConfirm?.ask;if(!(!O||!await O({title:r("终止请求"),html:r("确定终止这条正在转发的请求?
    上游连接会立即断开,明细将记为「请求已被手动终止」。"),okText:r("终止"),okClass:"danger"}))){w("pending");try{if(await M0().terminateStatsRequest(e),!k.current)return;w("accepted"),b(r("已受理终止:上游连接已断开,列表稍后刷新为「请求已被手动终止」"))}catch(L){if(!k.current)return;w("idle"),b(r("终止失败:{error}",{error:P0(L)}))}}}const I=bp(h),P=x.useMemo(()=>I?LD:LD.filter(O=>O.value!=="raw"),[I]);return s.jsx(Qt,{open:!0,onOpenChange:O=>{O||o()},children:s.jsxs(Zt,{className:"w-[min(920px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("请求详情")})}),s.jsxs(Bt,{ref:S,className:"gap-3",children:[s.jsx(In,{options:P,value:c,onValueChange:A,"aria-label":r("详情内容"),className:"self-start"}),s.jsx("section",{hidden:c!=="detail",children:s.jsx(AQ,{row:t})}),s.jsx("section",{hidden:c!=="preview",children:s.jsx(RQ,{state:f})}),I?s.jsx("section",{hidden:c!=="raw",children:s.jsx(OQ,{data:h.data})}):null]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:y}),s.jsx("div",{className:"mr-auto"}),hx(t)?s.jsx(se,{variant:"destructive",disabled:j!=="idle",onClick:()=>{R()},title:r("断开上游连接,明细记为「请求已被手动终止」"),children:r("终止请求")}):null,s.jsx(se,{variant:"outline",onClick:o,children:r("关闭")})]})]})})}let vp=null,qu=null;function VD(){vp&&(vp.unmount(),vp=null),qu&&(qu.remove(),qu=null)}function FD(){D0+=1,VD()}function DQ(e,t){const a=String(e??"").trim();if(!a)return;VD();const o=++D0;qu=document.createElement("div"),document.body.append(qu),vp=vn.createRoot(qu),vp.render(s.jsx(MQ,{id:a,row:bp(t)?t:null,token:o,onClose:FD}))}window.wbRequestDetail={open:DQ,close:FD};const IQ=150,PQ=80,nc=8,xx=8,_Q=520,LQ=220,zQ=1.1,BQ=900,_0=12,L0="req-hover-panel",HQ=["fixed z-[35] pointer-events-none","max-h-[min(360px,60vh)] overflow-x-hidden overflow-y-auto","rounded-md p-[10px_12px] text-[12px] leading-[1.6] break-normal","bg-surface-2 text-foreground shadow-3","border-0 dark:border dark:border-border-strong dark:bg-surface-3"].join(" "),yp="rh-row rh-dim min-w-0 break-words text-muted-foreground",UQ="rh-row min-w-0 break-words";function VQ(){return window}function z0(e){return typeof e=="object"&&e!==null?e:null}const $D=e=>Array.isArray(e?.attemptDetails)?e.attemptDetails:[],qD=e=>Array.isArray(e?.retries)?e.retries:[],FQ=e=>Array.isArray(e?.sensitiveHits)?e.sensitiveHits:[];function B0(e){const t=String(e??"").trim();return t?VQ().wbProviders?.labelOf?.(t)||t:""}function $Q(e){const t=z0(e);return(Number(t?.attempts)||1)>1?!0:$D(t).some(a=>qD(a).length>0||!!a?.notice)}function GD(e){return e.dataset.reqHover==="sensitive"?"sensitive":"chain"}function qQ({details:e}){if(e.length<2)return null;const t=e.map(a=>B0(a.provider)||r("未知"));return s.jsxs("div",{className:"rh-chain mb-1.5 border-b border-border pb-1.5 break-words",children:[s.jsx("span",{className:"rh-chain-k font-semibold text-muted-foreground",children:r("切换路径:")}),s.jsx("span",{className:"rh-chain-v font-semibold text-foreground",children:t.join(" → ")})]})}function GQ({item:e}){const t=qD(e);return t.length?s.jsxs("div",{className:"rh-retry mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2",children:[s.jsx("div",{className:"rh-retry-head text-[11.5px] font-semibold text-warning",children:r("↻ 重试 {n} 次",{n:t.length})}),t.map((a,o)=>{const c=String(a?.reason??"").trim(),d=Number(a?.status),f=a?.status!==null&&a?.status!==void 0&&Number.isFinite(d),p=Number(a?.delayMs),h=Number.isFinite(p)&&p>0?p>=1e3?r(",{n}秒后重试",{n:Math.round(p/1e3)}):r(",{n}毫秒后重试",{n:Math.round(p)}):"";return s.jsxs("div",{className:"rh-retry-row min-w-0 break-words",children:[s.jsx("span",{className:"rh-retry-why mr-1 text-subtle [overflow-wrap:anywhere]",children:c||r("未知原因")}),f?s.jsx("span",{className:"rh-retry-status mr-1 text-muted-foreground tabular-nums whitespace-nowrap",children:`HTTP ${String(d)}`}):null,h?s.jsx("span",{className:"rh-dim text-muted-foreground",children:h}):null]},o)})]}):null}function KQ({item:e,index:t,inFlight:a}){const o=B0(e.provider),c=String(e.account??"").trim(),d=Number(e.status),f=e.status!==null&&e.status!==void 0&&Number.isFinite(d),p=e.error?String(e.error):"",h=String(e.notice??"").trim();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:UQ,children:[s.jsx("span",{className:"rh-no mr-1 text-muted-foreground",children:r("尝试 {n} ·",{n:t+1})}),s.jsx("span",{className:"rh-who mr-1 font-semibold text-foreground",children:o||r("未知")}),c?s.jsx("span",{className:"rh-account mr-1 text-muted-foreground [overflow-wrap:anywhere]",children:c}):null,s.jsx("span",{className:"rh-arrow mr-1 text-muted-foreground",children:"→"}),p?s.jsx("span",{className:"rh-bad font-medium text-destructive [overflow-wrap:anywhere]",children:f?r("失败({status}):{error}",{status:String(d),error:p}):r("失败:{error}",{error:p})}):f?s.jsx("span",{className:"rh-ok font-medium text-success",children:r("成功({status})",{status:String(d)})}):a?s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("进行中…")}):s.jsx("span",{className:"rh-dim text-muted-foreground",children:r("无结果记录")})]}),h?s.jsx("div",{className:"rh-notice mt-0.5 mb-1 ml-2.5 border-l-2 border-border-strong pl-2 text-warning [overflow-wrap:anywhere]",children:`⚠️ ${h}`}):null,s.jsx(GQ,{item:e})]})}function YQ({entry:e}){const t=Number(e.attempts)||1,a=$D(e);if(!a.length){const c=B0(e.provider),d=c?r("共 {n} 次尝试,最终由 {provider} 承载",{n:t,provider:c}):r("共 {n} 次尝试",{n:t});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:yp,children:d}),s.jsx("div",{className:yp,children:r("这条记录的尝试明细未采集(该字段上线前的旧数据,或请求在转发前就失败)")})]})}const o=(Number(e.status)||0)===0&&!e.error;return s.jsxs(s.Fragment,{children:[s.jsx(qQ,{details:a}),a.map((c,d)=>s.jsx(KQ,{item:c,index:d,inFlight:o&&d===a.length-1},d)),a.lengths.jsxs("div",{className:"rh-row rh-hit flex items-baseline justify-between gap-2.5",children:[s.jsx("span",{className:"rh-hit-w break-words text-foreground",children:String(a?.word??"")}),s.jsx("span",{className:"rh-hit-c text-muted-foreground tabular-nums whitespace-nowrap",children:`× ${String(Number(a?.count)||0)}`})]},o)),t.length>_0?s.jsx("div",{className:yp,children:r("另有 {n} 个词命中",{n:t.length-_0})}):null]}):s.jsx("div",{className:yp,children:r("这条记录命中了敏感词,但没有留下命中明细")})}function QQ({kind:e,entry:t,panelRef:a}){return s.jsx("div",{ref:a,id:L0,role:"tooltip","data-kind":e,className:HQ,children:e==="sensitive"?s.jsx(XQ,{entry:t}):s.jsx(YQ,{entry:t})})}let Tn=null,Lo=0,jp=0,wp=null,bx=null,H0=null,U0=null,sc=null,rc=null,Sp=null,KD="chain";function V0(){window.clearTimeout(Lo),window.clearTimeout(jp),Lo=0,jp=0,wp=null}function ZQ(){const e=Sp?.current,t=Tn;if(!e||!t)return;const a=t.getBoundingClientRect(),o=window.innerWidth-nc*2;e.style.maxWidth="none",e.style.width="max-content";const c=e.offsetWidth,d=KD==="sensitive",p=Math.max(d?LQ:_Q,c)*(d?zQ:1),h=Math.min(p,o,BQ);e.style.maxWidth=`${h}px`,e.style.width=d?`${h}px`:"auto";const v=e.offsetWidth,y=e.offsetHeight,b=window.innerHeight-a.bottom-xx-nc,j=a.top-xx-nc,w=bb,k=a.left+a.width/2,S=Math.max(nc,Math.min(k-v/2,window.innerWidth-nc-v)),N=w?a.top-xx-y:a.bottom+xx;e.style.left=`${Math.round(S)}px`,e.style.top=`${Math.round(Math.max(nc,Math.min(N,window.innerHeight-nc-y)))}px`}function YD(e){if(!Tn)return;const t=e.target;t instanceof Node&&(t===Tn||Tn.contains(t)||Oa())}function XD(){Oa()}function QD(){Oa()}let vx=!1;function WQ(){vx||(vx=!0,document.addEventListener("click",YD,!0),window.addEventListener("scroll",XD,!0),window.addEventListener("resize",QD))}function JQ(){vx&&(vx=!1,document.removeEventListener("click",YD,!0),window.removeEventListener("scroll",XD,!0),window.removeEventListener("resize",QD))}function eZ(){JQ(),rc&&(rc.unmount(),rc=null),sc&&(sc.remove(),sc=null),Sp=null}function ZD(e,t){KD=e,(!sc||!rc||!Sp)&&(sc=document.createElement("div"),document.body.append(sc),Sp=x.createRef(),rc=vn.createRoot(sc));const a=rc,o=Sp;Cs.flushSync(()=>{a.render(s.jsx(QQ,{kind:e,entry:t,panelRef:o}))}),WQ(),ZQ()}function WD(e){if(!e.isConnected)return;const t=z0(H0?.(e));t&&(V0(),Tn&&Tn!==e&&Oa(),Tn=e,ZD(GD(e),t),e.classList.add("active"),e.setAttribute("aria-describedby",L0))}function Oa(){V0(),Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=null),eZ()}function tZ(){if(!Tn)return;const e=String(Tn.dataset.reqHover||""),t=String(Tn.dataset.reqId||"");U0=!!(e&&t)&&Tn.matches(":hover")&&!jp?{action:"move",kind:e,key:t}:{action:"close"}}function nZ(){const e=U0;if(U0=null,!e||!Tn)return;if(e.action==="close"){Oa();return}const t=bx?sZ(bx,e.kind,e.key):null,a=t?z0(H0?.(t)):null;if(!t||!a){Oa();return}t!==Tn&&(Tn.classList.remove("active"),Tn.removeAttribute("aria-describedby"),Tn=t,ZD(GD(t),a),t.classList.add("active"),t.setAttribute("aria-describedby",L0))}function sZ(e,t,a){for(const o of e.querySelectorAll("[data-req-hover]"))if(String(o.dataset.reqHover||"")===t&&String(o.dataset.reqId||"")===a)return o;return null}function yx(e){const t=e.target;return t instanceof Element?t.closest("[data-req-hover]"):null}function rZ(e){const t=yx(e);if(!t||!bx?.contains(t)||(V0(),Tn===t&&rc))return;const a=Tn?0:IQ;Tn&&Oa(),wp=t,Lo=window.setTimeout(()=>{Lo=0,wp=null,WD(t)},a)}function aZ(e){const t=yx(e);if(t){if(wp===t){window.clearTimeout(Lo),Lo=0,wp=null;return}Tn===t&&(window.clearTimeout(Lo),Lo=0,jp=window.setTimeout(()=>{jp=0,Tn===t&&Oa()},PQ))}}function lZ(e){const t=yx(e);t&&WD(t)}function oZ(e){const t=yx(e);t&&Tn===t&&Oa()}function iZ(e){e.key!=="Escape"||!Tn||Oa()}function cZ(e){const t=e?.host;t&&(bx=t,H0=e?.entryOf??null,t.addEventListener("pointerover",rZ),t.addEventListener("pointerout",aZ),t.addEventListener("focusin",lZ),t.addEventListener("focusout",oZ),t.addEventListener("keydown",iZ))}window.wbRequestHover={bind:cZ,close:Oa,hasProcessFacts:$Q,beforeListRedraw:tZ,afterListRedraw:nZ};function Ts(){return window}function F0(e){return e instanceof Error?e.message:String(e)}function jx(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}const wx={connecting:{label:r("连接中"),cls:"phase-connecting"},waiting:{label:r("等待响应"),cls:"phase-waiting"},streaming:{label:r("响应中"),cls:"phase-streaming"},retrying:{label:r("重试中"),cls:"phase-retrying"},queued:{label:r("排队中"),cls:"phase-queued"}},JD=r("进行中"),uZ="running",eI={connecting:r("请求已受理,正在选路、取凭证、建立上游连接"),waiting:r("上游请求已发出,正在等第一个字节到达(模型的思考时间也在这段)"),streaming:r("首帧已到,上游内容正在下发"),retrying:r("本轮尝试失败,正在退避等待或切换到下一个账号"),queued:r("上游模型繁忙,请求已排进上游队列;网关正按上游建议的时长等待后重发(不是登录态或额度问题)"),"":r("请求正在转发中,用时列显示的是已用时")};function $0(e){const t=String(e?.phase??"").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(wx,t)?t:""}function tI(e){const t=$0(e);return t?wx[t].label:JD}function nI(e){if(e==null||e==="")return"";const t=Number(e);if(!Number.isFinite(t)||t<0)return"";const a=Math.max(1,Math.floor(t/1e3));return a<60?r("{n}秒",{n:a}):r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60})}function dZ(e){const t=e?.phaseElapsedMs;if(t!=null&&t!==""){const c=Number(t);if(Number.isFinite(c)&&c>=0)return c}const a=Number(e?.phaseStartedAt);if(!Number.isFinite(a)||a<=0)return null;const o=Date.now()-a;return Number.isFinite(o)?Math.max(0,o):null}function fZ(e){const t=$0(e),a=t?wx[t].label:JD,o=t?wx[t].cls:uZ,c=eI[t]||eI[""];return`${jx(a)}`}function pZ(e){const t=nI(dZ(e));if(!t)return"";const a=tI(e),o=r("进入「{phase}」阶段已持续 {time}",{phase:a,time:t});return`${jx(t)}`}const q0=[{key:"time",label:r("时间"),sel:".req-time",track:"92px"},{key:"target",label:r("提供商 / 账号"),sel:".req-target",track:"minmax(0, 1.1fr)"},{key:"retry",label:r("重试"),sel:".req-retry",track:"52px"},{key:"status",label:r("状态"),sel:".req-status",track:"96px"},{key:"model",label:r("模型"),sel:".req-model",track:"minmax(0, 1.3fr)"},{key:"client",label:r("客户端"),sel:".req-client",track:"110px"},{key:"dur",label:r("用时"),sel:".req-dur",track:"96px",align:"right"},{key:"usage",label:r("用量"),sel:".req-usage",track:"minmax(0, 1.6fr)"},{key:"error",label:r("错误"),sel:".req-error-cell",track:"minmax(0, 1.2fr)"},{key:"detail",label:r("详情"),sel:".req-detail",track:"60px",align:"right"}],sI=1e3,mZ=ag;function rI(e){return typeof e=="number"&&e>0?e:fu}const aI="workbuddy-desktop-logs-requests-range",lI="workbuddy-desktop-requests-filters",hZ=3e4,G0=["today","7","30","month","all"],K0="all",gZ={today:r("今天"),7:r("近 7 天"),30:r("近 30 天"),month:r("本月"),all:r("全部")},xZ={today:r("今天"),7:r("7 天"),30:r("30 天"),month:r("本月"),all:r("全部")},bZ=G0.map(e=>({value:e,label:xZ[e]})),oI=[{value:"",label:r("全部状态")},{value:"ok",label:r("成功")},{value:"error",label:r("失败")}],vZ=r("全部状态"),iI=r("全部提供商"),cI=r("全部模型"),Sx={status:"",provider:"",model:""};function Nx(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function yZ(e){const t=new Date;switch(e){case"today":return Nx(t);case"7":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-6));case"30":return Nx(new Date(t.getFullYear(),t.getMonth(),t.getDate()-29));case"month":return Nx(new Date(t.getFullYear(),t.getMonth(),1));default:return null}}const en={filters:{...Sx},range:jZ(),runningOnly:!1,offset:0,size:rI(og("requests",ag))};let kx={...Sx},Y0=!1,uI=!1,X0=[],Cx=sI,Tx=!0,Q0=!1,Z0=!1,dI=0,W0=0,J0=null,fI=!1,Gu=null;function jZ(){try{const e=localStorage.getItem(aI);return e!==null&&G0.includes(e)?e:K0}catch{return K0}}function wZ(e){try{localStorage.setItem(aI,e)}catch{}}function pI(){const e=Ts().wbFilterMemory;return e?(Y0=!0,kx=e.load(lI,{...Sx}),en.filters={...kx},{...kx}):{...Sx}}function SZ(e){kx={...e},Ts().wbFilterMemory?.save(lI,{status:e.status||"",provider:e.provider||"",model:e.model||""})}function mI(){const e=new URLSearchParams,t=yZ(en.range);t!==null&&e.set("start",String(t));const a=en.runningOnly?"running":en.filters.status;return a&&e.set("status",a),en.filters.provider&&e.set("provider",en.filters.provider),en.filters.model&&e.set("model",en.filters.model),e}function NZ(){const e=mI();return e.set("offset",String(en.offset)),e.set("limit",String(en.size)),e.toString()}function eS(e){const t=Math.round(Number(e)||0);if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a>=60)return r("{m}分{s}秒",{m:Math.floor(a/60),s:a%60});const o=t%1e3;return o>0?r("{s}秒{ms}ms",{s:a,ms:o}):r("{n}秒",{n:a})}const kZ=r("生成速度:输出 token ÷ 流式段用时(总用时 − 首响);流式段不足总用时一半时按总用时计"),CZ=500;function TZ(e){const t=Number(e.completionTokens)||0,a=Number(e.durationMs)||0;if(t<=0||a<=0)return"";const o=Number(e.firstResponseMs),c=Number.isFinite(o)&&o>0&&o=CZ&&c*2>=a,f=t/((d?c:a)/1e3);return`${f>=100?Math.round(f):f.toFixed(1)} tok/s`}function EZ(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":eS(t)}function Ex(e){return Ts().wbUnits?.formatTokens?.(e)??(Number(e)||0).toLocaleString("zh-CN")}function AZ(e){const t=Math.max(0,Date.now()-(Number(e)||0));return r("{n}秒",{n:Math.max(1,Math.floor(t/1e3))})}function RZ(e){const t=Number(e.promptTokens)||0;return t<=0?"-":`${((Number(e.cacheReadTokens)||0)/t*100).toFixed(2)}%`}function tS(e){const t=Number(e.status)||0;return t>=200&&t<300&&!e.error}function Np(e){return(Number(e?.status)||0)===0&&!e?.error}const hI=e=>String(e?.id||e?.ts||"");function OZ(e){return(Array.isArray(e?.attemptDetails)?e.attemptDetails:[]).reduce((a,o)=>{const c=o?.retries;return a+(Array.isArray(c)?c.length:0)},0)}function gI(e){return Ts().wbProviders?.labelOf?.(e)||e}function MZ(e){const t=new Set;return e.map((a,o)=>{const c=hI(a)||`i${o}`;let d=c,f=1;for(;t.has(d);)d=`${c}#${f++}`;return t.add(d),d})}async function xI(){if(!(Date.now()-W0({value:String(o?.id||""),label:String(o?.label||o?.id||"")})).filter(o=>o.value),a=(Array.isArray(e?.models)?e.models:[]).map(o=>String(o||"")).filter(Boolean);Gu?.setFilterOptions(t,a)}catch(e){console.warn("读取请求日志筛选清单失败,筛选项退化为「全部」:",F0(e))}}}async function DZ(){if(!Q0)try{const e=await Ts().workbuddyDesktop?.getScheduledTasks(),t=(e?.tasks||[]).find(a=>a.id==="requestsAutoRefresh");nS(t||null),Q0=Array.isArray(e?.tasks)}catch(e){console.warn("读取请求日志自动刷新间隔失败,按默认 1 秒:",F0(e)),nS(null)}}function nS(e){Q0=!0;const t=Number(e?.interval),a=e?.unit;!!e&&typeof e=="object"&&Number.isFinite(t)&&t>0&&(a==="seconds"||a==="minutes")?(Tx=e.enabled!==!1,Cx=a==="minutes"?t*6e4:t*1e3):(Tx=!0,Cx=sI),Gu?.setAuto({ms:Cx,enabled:Tx})}function IZ(){if(fI)return;const e=Ts().wbColSettings;e&&(fI=!0,J0=e.register({id:"requests",label:r("请求日志表"),columns:q0.map(({key:t,label:a,align:o})=>({key:t,label:a,align:o})),mount:()=>document.querySelector('.page[data-page="requests"] .panel-head .head-actions'),onChange:()=>{Cs.flushSync(()=>Gu?.repaint()),Ts().wbTableColumns?.repaint?.("requests")}}))}function sS(){return(J0?J0.apply(q0):q0).map(t=>({...t,align:t.align||"left"}))}const PZ={entries:[],total:0,matched:0,running:0,loaded:!1,error:""};function _Z(e){return e.loaded?e.total?r("没有符合筛选条件的请求"):r("暂无请求日志,网关还没有转发过请求"):r("正在加载请求日志…")}function LZ(e){const t=Number(e.firstResponseMs);return!Number.isFinite(t)||t<=0?null:s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时(请求仍在转发中)"),children:r("首响 {time}",{time:eS(t)})})}function zZ(e,t){const{align:a,key:o}=t,c=t.sel.slice(1)+(o==="dur"?" req-num":""),d=`${c} ta-${a}`;switch(o){case"time":{if(!e.ts)return s.jsx("span",{className:d,children:"—"},o);const f=new Date(e.ts),p=h=>String(h).padStart(2,"0");return s.jsxs("span",{className:d,children:[s.jsx("span",{children:`${f.getFullYear()}-${p(f.getMonth()+1)}-${p(f.getDate())}`}),s.jsx("span",{children:`${p(f.getHours())}:${p(f.getMinutes())}:${p(f.getSeconds())}`})]},o)}case"target":{const f=String(e.provider??"").trim(),h=String(e.providerLabel??"").trim()||(f?gI(f):"");return s.jsxs("span",{className:d,children:[h?s.jsx("span",{className:"req-provider",title:f&&f!==h?r("{name}({id})",{name:h,id:f}):h,children:h}):s.jsx("span",{className:"req-provider is-empty",title:r("这条明细没有记录提供商(旧数据或请求未走到转发)"),children:"—"}),e.accountName?s.jsx("span",{className:"req-acct",title:e.accountId||e.accountName,children:e.accountName}):s.jsx("span",{className:"req-acct is-empty",title:r("请求在任何账号接手之前就失败了"),children:"—"})]},o)}case"retry":{const f=Number(e.attempts)||1,p=hI(e),h=[];if(e.isTest&&h.push(s.jsx(ze,{variant:"brand",shape:"tag",title:r("这条明细是一次模型测试(人工发起):走的是真实转发链路,但不计入报表统计"),children:r("测试")},"test")),Ts().wbRequestHover?.hasProcessFacts?.(e)??f>1){const y=f>1?f:OZ(e);h.push(s.jsx(ze,{variant:"warning",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"chain","data-req-id":p,children:y>1?r("重试 {n}",{n:y}):r("重试")},"chain"))}return Array.isArray(e.sensitiveHits)&&e.sensitiveHits.length&&h.push(s.jsx(ze,{variant:"sensitive",shape:"tag",render:s.jsx("button",{type:"button"}),className:"req-hover-tag","data-req-hover":"sensitive","data-req-id":p,"aria-label":r("命中了敏感词"),children:r("敏")},"sensitive")),h.length?s.jsx("span",{className:d,children:h},o):s.jsx("span",{className:`req-none ta-${a}`,children:"-"},o)}case"status":{if(Np(e)){const v=window.wbRequestPhase;if(!v?.badgeHtml)return s.jsx("span",{className:d,children:s.jsx("span",{className:"req-status-badge",children:s.jsxs(ze,{shape:"tag",variant:"info",title:r("请求正在转发中,用时列显示的是已用时"),children:[s.jsx(uy,{className:"req-live-dot","aria-hidden":"true"}),r("进行中")]})})},o);const y=v.elapsedLineHtml?.(e)??"";return s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-status-badge",dangerouslySetInnerHTML:{__html:v.badgeHtml(e)}}),y?s.jsx("span",{className:"req-status-line",dangerouslySetInnerHTML:{__html:y}}):null]},o)}const f=Number(e.status)||0,p=tS(e),h=!p&&f>=200&&f<300?r("HTTP {status},但响应体阶段出错:见错误列",{status:f}):void 0;return s.jsx("span",{className:d,children:s.jsx(ze,{shape:"tag",variant:p?"success":"destructive",title:h,children:f||r("失败")})},o)}case"model":{const f=String(e.clientModel??"").trim(),p=String(e.upstreamModel??"").trim(),h=String(e.model??"").trim(),v=String(e.clientReasoning??"").trim(),y=String(e.upstreamReasoning??"").trim(),b=(k,S)=>S?`${k}(${S})`:k;if(!f||!p||p.toLowerCase()===f.toLowerCase()){const k=b(h,y||v);return s.jsx("span",{className:d,title:k,children:k||"—"},o)}const j=b(p,y),w=b(f,v);return s.jsxs("span",{className:`${d} req-model-split`,children:[s.jsxs("span",{className:"req-model-line",title:r("转发到上游的模型:{model}",{model:j}),children:["⬆️ ",j]}),s.jsxs("span",{className:"req-model-line sub",title:r("下游请求的模型:{model}",{model:w}),children:["⬇️ ",w]})]},o)}case"client":{const f=String(e.client??"").trim();if(!f)return s.jsx("span",{className:`${d} is-empty`,title:r("这条明细没有记录来源客户端(旧数据、模型测试,或请求未带 User-Agent)"),children:"—"},o);const p=f==="other"?r("其它"):f;return s.jsx("span",{className:d,title:f==="other"?r("识别到 User-Agent,但不属于已知的客户端类型:{ua}",{ua:f}):r("来源客户端:{client}",{client:p}),children:p},o)}case"dur":return Np(e)?s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",title:r("已用时(请求仍在转发中)"),children:AZ(e.ts)}),LZ(e)]},o):s.jsxs("span",{className:d,children:[s.jsx("span",{className:"req-dur-line",children:eS(e.durationMs)}),s.jsx("span",{className:"req-dur-line sub",title:r("首响:上游首帧到达的耗时"),children:r("首响 {time}",{time:EZ(e.firstResponseMs)})})]},o);case"usage":{if(Np(e))return s.jsx("span",{className:d},o);if(!tS(e))return s.jsxs("span",{className:d,title:r("失败请求不记录用量"),children:[s.jsx("span",{className:"req-usage-line",children:"in: - / out: - / all: -"}),s.jsx("span",{className:"req-usage-line sub",children:r("缓存读取: - / 命中率: -")})]},o);const f=`in: ${Ex(e.promptTokens)} / out: ${Ex(e.completionTokens)} / all: ${Ex(e.totalTokens)}`,p=r("缓存读取: {cache} / 命中率: {rate}",{cache:Ex(e.cacheReadTokens),rate:RZ(e)}),h=TZ(e),v=h?`${p} · ${h}`:p;return s.jsxs("span",{className:d,title:[f,v].filter(Boolean).join(` +`),children:[s.jsx("span",{className:"req-usage-line",children:f}),s.jsxs("span",{className:"req-usage-line sub",children:[p,h?s.jsxs("span",{title:kZ,children:[" · ",h]}):null]})]},o)}case"error":return Np(e)?s.jsx("span",{className:d},o):e.error?s.jsx("span",{className:d,title:String(e.error),children:String(e.error)},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o);case"detail":{const f=e.id?String(e.id):"";return f?s.jsx("span",{className:d,children:s.jsx(se,{size:"sm",variant:"outline",className:"req-detail-btn",title:r("查看该请求的上游原始报文"),onClick:()=>{Ts().wbRequestDetail?.open?.(f,e)},children:r("详情")})},o):s.jsx("span",{className:`req-none ${c} ta-${a}`,children:"-"},o)}default:return null}}function BZ(e){return s.jsx("div",{className:"req-head",children:e.map(t=>s.jsx("span",{"data-col":t.key,className:`${t.sel.slice(1)}${t.key==="dur"?" req-num":""} ta-${t.align}`,children:t.label},t.key))},"__head")}function HZ(){const[e,t]=x.useState(PZ),[a,o]=x.useState(()=>pI()),[c,d]=x.useState(()=>en.range),[f,p]=x.useState(!1),[h,v]=x.useState(0),[y,b]=x.useState(()=>en.size),[j,w]=x.useState(()=>({ms:Cx,enabled:Tx})),[k,S]=x.useState([]),[N,T]=x.useState([]),[,D]=x.useState(0),C=x.useRef(null),A=x.useRef(null),R=x.useRef(!1),I=x.useCallback(ee=>(en.filters={...en.filters,...ee},o({...en.filters}),en.filters),[]),P=x.useCallback(ee=>{en.range=ee,d(ee)},[]),O=x.useCallback(ee=>{en.offset=ee,v(ee)},[]),_=x.useCallback(ee=>{en.runningOnly=ee,p(ee)},[]),L=x.useCallback(()=>{Y0||!Ts().wbFilterMemory||(Y0=!0,!uI&&I(pI()))},[I]),H=x.useCallback((ee,fe)=>{Ts().wbRequestHover?.beforeListRedraw?.(),fe&&(X0=fe),R.current=!0,t(ee)},[]),B=x.useCallback(ee=>{Ts().wbRequestHover?.beforeListRedraw?.(),R.current=!0,t(fe=>({...fe,error:ee}))},[]),z=x.useCallback(async(ee={})=>{const{silent:fe=!1,resetPage:te=!1}=ee;te&&O(0),DZ(),L(),fe||xI();const Ce=++dI;try{const re=Ts().workbuddyDesktop;if(!re)throw new Error(r("后端桥不可用"));const de=await re.getStatsRequests(NZ());if(Ce!==dI)return;const ke={entries:Array.isArray(de?.entries)?de.entries:[],total:Number(de?.total)||0,matched:Number(de?.matched)||0,running:Number(de?.running)||0,loaded:!0,error:""},Ee=Math.max(0,(Math.ceil(ke.matched/en.size)-1)*en.size);if(en.offset>Ee)return O(Ee),z({silent:fe});te&&(A.current=0),H(ke,ke.entries)}catch(re){fe||(console.warn("读取请求日志失败:",F0(re)),B(r("读取请求日志失败,详见控制台")))}},[O,H,B,L]);x.useEffect(()=>(Gu={load:z,setAuto:ee=>w(ee),setFilterOptions:(ee,fe)=>{S(ee),T(fe)},repaint:()=>D(ee=>ee+1)},Ts().wbRequestHover?.bind?.({host:C.current,entryOf:ee=>{const fe=ee?.dataset?.reqId||"";return fe&&(X0.find(te=>String(te?.id||"")===fe)||X0.find(te=>String(te?.ts||"")===fe))||null}}),z({silent:!0}),xI(),()=>{Gu=null}),[z]),x.useLayoutEffect(()=>{IZ(),D(ee=>ee+1)},[]);const Q=e.error||!e.entries.length?"":sS().map(ee=>ee.key).join("|");x.useLayoutEffect(()=>{Q&&Ts().wbTableColumns?.repaint?.("requests")},[Q]),x.useEffect(()=>{if(!j.enabled||j.ms<=0)return;const ee=window.setInterval(()=>{document.hidden||Ts().wbApp?.currentPage!=="requests"||Z0||(Z0=!0,z({silent:!0}).finally(()=>{Z0=!1}))},j.ms);return()=>{window.clearInterval(ee)}},[j,z]),x.useLayoutEffect(()=>{R.current&&(R.current=!1,Ts().wbRequestHover?.afterListRedraw?.());const ee=A.current;if(ee===null)return;A.current=null;const fe=C.current;fe&&(fe.scrollTop=ee)});function K(ee){const fe=Math.max(1,Math.ceil(e.matched/en.size)),Ce=(Math.min(Math.max(1,ee),fe)-1)*en.size;Ce!==en.offset&&(O(Ce),A.current=0,z())}function X(ee){const fe=rI(ee);if(fe===en.size)return;en.size=fe,b(fe),ig("requests",fe);const te=en.offset+1;O(Math.max(0,Math.floor((te-1)/fe)*fe)),A.current=0,z()}function q(ee){uI=!0,SZ(I(ee)),z({resetPage:!0})}function $(ee){const fe=G0.includes(ee)?ee:K0;fe!==en.range&&(P(fe),wZ(fe),z({resetPage:!0}))}function Y(ee){ee!==en.runningOnly&&(_(ee),z({resetPage:!0}))}const F=sS(),G=Math.max(1,Math.ceil(e.matched/en.size)),W=Math.min(G,Math.floor(h/en.size)+1),le=e.matched?h+1:0,M=e.matched?h+e.entries.length:0,U=e.error?"—":e.matched===e.total?r("{n} 条",{n:e.total}):r("{matched} / {total} 条",{matched:e.matched,total:e.total}),Z=!f&&e.running>0?r(" · {n} 进行中",{n:e.running}):"",ae=[gZ[c]||r("全部")];f?ae.push(r("只看进行中")):a.status==="ok"?ae.push(r("只看成功")):a.status==="error"&&ae.push(r("只看失败")),a.provider&&ae.push(gI(a.provider)),a.model&&ae.push(a.model);const ce=x.useMemo(()=>!a.provider||k.some(ee=>ee.value===a.provider)?k:[{value:a.provider,label:a.provider},...k],[a.provider,k]),J=x.useMemo(()=>!a.model||N.includes(a.model)?N:[a.model,...N],[a.model,N]),ie=MZ(e.entries),ge=e.entries.map((ee,fe)=>s.jsx("div",{className:`req-row${Np(ee)?" running":tS(ee)?"":" failed"}`,children:F.map(te=>zZ(ee,te))},ie[fe]));return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("请求日志列表")}),s.jsx(ze,{id:"req-badge",variant:"outline","data-tone":"",children:U+Z}),s.jsx("span",{className:"panel-sub",children:r("按时间倒序,全量保留")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{id:"btn-req-clear",variant:"destructive",onClick:()=>{Ts().wbRequestClearModal?.open?.()},children:r("清理")})})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"log-filters",children:[s.jsx(In,{options:bZ,value:c,onValueChange:$,"aria-label":r("请求日志时间范围"),className:"shrink-0"}),s.jsxs(ft,{value:a.status,disabled:f,onValueChange:ee=>q({status:String(ee??"")}),children:[s.jsx(mt,{id:"req-status",className:"min-w-[120px]",title:r(f?"「仅看进行中」开启时,状态固定为进行中":"按请求结果筛选"),"aria-label":r("按请求结果筛选"),children:s.jsx(pt,{children:oI.find(ee=>ee.value===a.status)?.label??vZ})}),s.jsx(ht,{children:oI.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))})]}),s.jsxs(ft,{value:a.provider,onValueChange:ee=>q({provider:String(ee??"")}),children:[s.jsx(mt,{id:"req-provider",className:"min-w-[120px]",title:r("按提供商筛选(只列日志里出现过的)"),"aria-label":r("按提供商筛选"),children:s.jsx(pt,{children:a.provider?ce.find(ee=>ee.value===a.provider)?.label||a.provider:iI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:iI}),ce.map(ee=>s.jsx(qe,{value:ee.value,children:ee.label},ee.value))]})]}),s.jsxs(ft,{value:a.model,onValueChange:ee=>q({model:String(ee??"")}),children:[s.jsx(mt,{id:"req-model",className:"min-w-[120px]",title:r("按模型筛选(只列日志里出现过的;精确匹配模型名)"),"aria-label":r("按模型筛选"),children:s.jsx(pt,{children:a.model||cI})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"",children:cI}),J.map(ee=>s.jsx(qe,{value:ee,children:ee},ee))]})]}),s.jsx(A6,{id:"btn-req-running",variant:"outline",size:"default",pressed:f,onPressedChange:Y,title:r("只显示正在转发中的请求(状态列按阶段显示:连接中 / 等待响应 / 响应中 / 重试中,用时列显示已用时)"),children:r("仅看进行中")}),s.jsx("div",{className:"spacer"}),s.jsx("span",{className:"panel-sub",id:"req-summary",children:ae.join(" · ")})]}),s.jsx("div",{className:"log-list",id:"req-list",ref:C,children:e.error?s.jsx("div",{className:"log-empty",children:e.error}):e.entries.length?[BZ(F),...ge]:s.jsx("div",{className:"log-empty",children:_Z(e)})})]}),s.jsx(Li,{total:e.matched,range:{start:le,end:M},page:W,pageCount:G,size:y,sizes:mZ,onSizeChange:X,onPageChange:K,disabled:!e.loaded&&!e.error})]})}async function bI(e={}){await Gu?.load(e)}function UZ(){return mI().toString()}function VZ(){return W0=0,bI({resetPage:!0})}const vI='.page[data-page="requests"]';let yI=!1;function jI(){if(yI)return;const e=document.querySelector(vI);e&&(yI=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(HZ,{})))}document.querySelector(vI)?jI():document.addEventListener("DOMContentLoaded",jI,{once:!0}),window.wbRequestsPanel={load:bI,applyAutoRefresh:nS,visibleColumns:sS,clearParams:UZ,notifyCleared:VZ},window.wbRequestPhase={labelOf:tI,badgeHtml:fZ,elapsedLineHtml:pZ,elapsedText:nI,phaseOf:$0};function FZ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.modelsDevUnavailable;const t=e.source==="builtin"?Ut.modelsDevSourceBuiltin:e.source==="cache"?Ut.modelsDevSourceCache:e.source==="network"?Ut.modelsDevSourceNetwork:e.source,a=e.updatedAt>0?String(tt().wbApp?.formatTime?.(e.updatedAt)??""):"";if(!t&&!a&&!e.count)return Ut.modelsDevEmpty;const o=a?r(",{time}",{time:a}):"",c=e.enabled?r("正在联网更新"):r("仅用现有数据、不联网刷新");return r("{count} 条 · 来自{origin}{at} · {mode}",{count:Number(e.count).toLocaleString("zh-CN"),origin:t||r("未知来源"),at:o,mode:c})}function tt(){return window}function _t(e){return e instanceof Error?e.message:String(e)}function Ve(e,t){tt().wbApp?.toast?.(e,t)}async function $Z(e){try{await tt().workbuddyDesktop?.openReleasePage?.(e)}catch(t){Ve(r("打开链接失败:{error}",{error:_t(t)}),"err")}}const Ax=[{id:"general",label:r("通用"),icon:"sliders"},{id:"display",label:r("显示"),icon:"display"},{id:"gateway",label:r("网关"),icon:"traffic"},{id:"routing",label:r("路由"),icon:"route"},{id:"retry",label:r("重试"),icon:"refresh"},{id:"timeout",label:r("超时"),icon:"timer"},{id:"security",label:r("安全"),icon:"shield"},{id:"data",label:r("数据"),icon:"database"},{id:"feedback",label:r("反馈与需求"),icon:"feedback"},{id:"about",label:r("更新"),icon:"download"}],wI="workbuddy-desktop-settings-cat",qZ="workbuddy-desktop-theme",GZ="workbuddy-desktop-zoom",SI="wb:theme",NI="wb:zoom",rS=80,kI=130,Rx=5,KZ=Array.from({length:(kI-rS)/Rx+1},(e,t)=>rS+t*Rx),YZ=[{value:"system",label:r("跟随系统")},{value:"light",label:r("浅色")},{value:"dark",label:r("深色")}];function XZ(){try{const e=localStorage.getItem(qZ);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function QZ(){try{const e=localStorage.getItem(GZ);if(e===null||e.trim()==="")return 100;const t=Number(e);if(!Number.isFinite(t))return 100;const a=Math.round(t/Rx)*Rx;return Math.min(kI,Math.max(rS,a))}catch{return 100}}const aS=1,lS=99999,oS=[{key:"logRetentionDays",id:"settings-retention-log",label:r("事件日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("登录 / 账号切换 / 429 切换等系统事件,可填 1–99999 天。")},{key:"requestLogRetentionDays",id:"settings-retention-request",label:r("请求日志保留天数"),unit:r("天"),min:aS,max:lS,hint:r("「请求日志」页的逐条请求记录,默认 99999 天(近似全量保留),可填 1–99999 天。")},{key:"dailyAggregateRetentionDays",id:"settings-retention-daily",label:r("按天聚合保留天数"),unit:r("天"),min:aS,max:lS,hint:r("报表页的热力图与按天趋势,默认 99999 天(近似全量保留),可填 1–99999 天。")}],CI=[{key:"retryCount",id:"settings-retry-count",label:r("同一账号重试次数"),unit:r("次"),min:0,max:10,hint:r("在同一个账号上原地重发几次(不含首发;整条请求共用一份,用完后换来的账号只发一次就继续换)。可填 0–10,0 表示失败立即换号。")},{key:"retryCrossProviderCount",id:"settings-retry-cross-provider-count",label:r("切换账号重试次数"),unit:r("次"),min:0,max:10,hint:r("失败后最多再换几个账号试(填 N = 最多换 N 个,首发那个不算)。换到同一家名下另一个账号、或换到另一家,都各算一次;换满仍失败就返回错误。可填 0–10,0 表示失败立即报错。")},{key:"retryIntervalSeconds",id:"settings-retry-interval",label:r("重试间隔"),unit:r("秒"),min:0,max:300,hint:r("两次重试之间的等待时间,两项共用,可填 0–300 秒。")}],TI=[{key:"connectTimeoutSeconds",id:"settings-timeout-connect",label:r("连接中超时"),unit:r("秒"),min:1,max:3600,hint:r("建立上游 TCP/TLS 连接或代理隧道的最大等待时间(秒),默认 30 秒,范围 1~3600。")},{key:"headersTimeoutSeconds",id:"settings-timeout-headers",label:r("等待响应超时"),unit:r("秒"),min:1,max:3600,hint:r("请求发出后等待上游响应头的最大时间(秒),默认 300 秒,范围 1~3600。")},{key:"streamIdleTimeoutSeconds",id:"settings-timeout-stream-idle",label:r("流式响应空闲超时"),unit:r("秒"),min:1,max:3600,hint:r("流式响应相邻数据之间允许的最大空闲时间(秒),收到新数据后重新计时,默认 300 秒,范围 1~3600。")},{key:"bodyTimeoutSeconds",id:"settings-timeout-body",label:r("非流式响应超时"),unit:r("秒"),min:1,max:3600,hint:r("读取完整非流式响应体允许的最大时间(秒),默认 300 秒,范围 1~3600。")}],EI=[{key:"queueMaxWaits",id:"settings-queue-max-waits",label:r("排队等待次数"),unit:r("次"),min:0,max:10,hint:r("上游模型繁忙时会先排队(回一句「建议 N 秒后再来」,Qoder 免费模型就是这样):网关等一会儿再发同一请求,最多等几次。默认 2 次,可填 0–10;填 0 表示不等待,排队直接返回 503 并说明「不是登录态或额度问题」。")},{key:"queueWaitSeconds",id:"settings-queue-wait-seconds",label:r("排队等待秒数"),unit:r("秒"),min:0,max:120,hint:r("每次等待的时长,默认 0 = 跟随上游建议(实测 9~30 秒,上游没给建议时用 15 秒)。可填 0–120 秒强制一个固定时长。")}],AI="noRetryStatusCodes",iS=100,cS=599,RI=50,zo=[{value:"passthrough",optionLabel:r("透传客户端 system(默认)"),toastLabel:r("透传客户端 system")},{value:"custom",optionLabel:r("替换为网关提示词"),toastLabel:r("替换为网关提示词")},{value:"append",optionLabel:r("追加网关提示词"),toastLabel:r("追加网关提示词")}];function OI(e,t,a,o){const c=String(e??"").trim();if(!c)return{ok:!1,message:r("{noun}不能为空(可填 {min}–{max})",{noun:o,min:t,max:a})};if(!/^\d+$/.test(c))return{ok:!1,message:r("{noun}必须是整数",{noun:o})};const d=Number(c);return da?{ok:!1,message:r("{noun}必须在 {min}–{max} 之间(当前填的是 {text})",{noun:o,min:t,max:a,text:c})}:{ok:!0,value:d}}function ZZ(e,t){const a={...t};if(e&&typeof e=="object"){const o=e;typeof o.closeToTray=="boolean"&&(a.closeToTray=o.closeToTray),typeof o.autostart=="boolean"&&(a.autostart=o.autostart),typeof o.lanAccess=="boolean"&&(a.lanAccess=o.lanAccess),typeof o.lanPanel=="boolean"&&(a.lanPanel=o.lanPanel),typeof o.lightweightMode=="boolean"&&(a.lightweightMode=o.lightweightMode)}return a}function MI(e,t,a){if(!t||typeof t!="object")return null;const o=t,c={...a||{}};for(const d of e){const f=Number(o[d.key]);Number.isInteger(f)&&f>=d.min&&f<=d.max&&(c[d.key]=f)}return e.some(d=>Number.isInteger(c[d.key]))?c:null}function DI(e){if(!Number.isFinite(e)||e<=0)return"0 B";if(e<1024)return`${e} B`;const t=e/1024;if(t<1024)return`${t.toFixed(1)} KB`;const a=t/1024;return a<1024?`${a.toFixed(1)} MB`:`${(a/1024).toFixed(2)} GB`}function WZ(e){const t=Number(e);return!Number.isFinite(t)||t<0?"—":t.toLocaleString("zh-CN")}const rs={displayTheme:r("控制界面的深浅色,与左侧边栏底部的三个主题按钮是同一个设置(改哪一处,另一处立刻跟上)。「跟随系统」会随操作系统当前的浅色 / 深色自动切换,并在系统主题变化时即时跟上;选「浅色」或「深色」则把界面固定在该模式,不再随系统变化。窗口标题栏的深浅色会一并同步,不会出现深色界面配一条浅色标题栏的情况。"),displayZoom:r("等比放大或缩小整个界面(文字、控件、间距一起变),效果与浏览器按 Ctrl +/- 相同:80%–130%、5% 一档。窗口本身不缩放,变的是页面内容的显示比例,设置立即生效并记住,下次启动直接按这个比例打开。放得越大可视范围越小,窗口较窄或表格较宽时不建议调得太大。"),displayLanguage:r("界面语言。可选简体中文、繁體中文、English、日本語、한국어、Português (Brasil),或「跟随系统」(按浏览器 / 系统的语言列表自动选)。切换后整页立即刷新;该偏好只存在本机(localStorage),不影响账号、密钥与转发。"),tray:r("默认关闭窗口不会退出程序,而是把窗口缩到系统托盘,转发继续在后台运行(OpenAI 客户端不受影响);要彻底退出程序,请在托盘图标上右键选「退出」。关掉这个开关后,点关闭按钮即退出程序、转发随之中断。「开机自动启动」开启后,登录系统时会自动启动本程序(通常直接驻留托盘),不需要手动打开。"),lightweight:r("开启后,关闭窗口不只是隐藏,而是把界面窗口整个销毁:底层的 WebView2 六个常驻进程(约 200MB 内存)随之退出,网关转发、定时签到、余额查询都在后台进程里继续,不受影响;需要界面时点托盘图标重新打开(WebView 冷启动约 1 秒)。注意:界面销毁期间「ZCode 活动套餐」通道的验证码令牌由界面铸造,无法补充 —— 走该通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。此开关只在「关闭窗口时最小化到托盘」开启时有意义,最小化窗口不受影响。"),lan:r("默认网关只监听 127.0.0.1,只有本机能访问。开启后网关改听所有网卡,同一局域网内的设备可以把 API 地址指向本机 IP 一起使用。出于安全考虑,开启前必须先注册一个面板管理员:管理接口从此要求管理员会话或网关 Key,模型额度不会对局域网裸奔;一把启用的网关 Key 都没有时,转发接口也会拒绝服务,直到创建第一把。改动需要重启应用生效。「同时开放网页管理面板」把管理界面也出给局域网(其他设备的浏览器打开本机 IP 即可管理),默认关闭 —— 桌面端的面板仍只由本程序自己出。"),units:r("控制报表与请求日志里 Token 读数的写法:开启后按中文量级显示(1.2亿 / 8400万),关闭则用 k / M 缩写(与上游文档、接口字段的写法一致)。这只影响显示口径,不改变任何统计与存储的数值。"),queue:r("只对「排队制」的上游生效(目前是 Qoder 的免费模型):模型繁忙时上游不报错,只回一句「建议 N 秒后再来」(业务码 10605),网关按建议时长等一会儿再发同一请求,等满次数仍排不上才把「排队中」作为错误返回(HTTP 503,文案会说明这不是登录态或额度问题)。等待发生在首个字节之前,吃的是「等待响应超时」那份预算 —— 两项设置一起决定一次请求最多卡多久;排队不会标记账号限额、也不会换账号(换谁都一样在排队)。保存后对下一个请求立即生效,不用重启。"),captchaPool:r("ZCode「活动套餐」通道的每条推理请求都要附一个当次铸造的阿里云无痕验证令牌(一次性、约 2 分钟过期):令牌由界面里的铸造守卫静默铸好、推给网关入池,转发时逐条取用。这里的三个值管的是补货节奏:①「库存目标」= 库存低于它守卫才补铸、补到它为止,默认 3 个;②「轮询间隔」= 守卫多久看一次库存,默认 2500 毫秒,只影响反应速度(库存够用时不会多铸);③「单轮铸造上限」= 发现缺货时一轮最多铸几个,默认 1 个(连铸之间固定隔 500 毫秒)。请求密集、请求日志里连续出现「需要人机验证令牌」的 503 时,把目标与单轮上限适当调大、轮询调快,能让池子跟得上消耗 —— 代价是上游(阿里云)对铸造频率有风控,铸得越多越快越容易触发限流,且用不掉的令牌 2 分钟即过期作废、等于白烧配额,所以建议小步调。保存后对下一轮补货立即生效,不用重启。"),timeouts:r("上游请求四个阶段各自的等待上限(秒,1~3600):①「连接中超时」= 建立 TCP/TLS 连接或代理隧道的最大等待,默认 30 秒;②「等待响应超时」= 请求发出后等上游响应头的最大时间,默认 300 秒 —— 网关请求上游恒带 stream,响应头在 SSE 建立时就到达,与模型思考多久无关;③「流式响应空闲超时」= 流式响应相邻两块数据之间允许的最大空闲,收到新数据即重新计时,默认 300 秒 —— 上游长时间不吐数据即判定连接僵死并断开;④「非流式响应超时」= 读完整份非流式响应体的总预算(一次性计时、不重置),默认 300 秒。四项都是「等待上限」,只要数据还在来,正常的流式回答就一直往下传。保存后对下一个请求立即生效,不用重启。"),retry:r("请求转发到上游失败时(服务器瞬时错误、连接失败,以及 WorkBuddy 的 11-128 敏感词拦截),网关会等一段间隔后再发一次。次数分两档,管的是两件事:①「同一账号重试次数」在同一账号上原地重发几次 —— 一般是提示词被上游拦截、或链路瞬时抖动,等一会儿重发往往就好了;②「切换账号重试次数」这份请求最多再换几个账号试 —— 首发的那个账号不算,每换一个扣一次,不分是不是同一家(换到同一家的下一个账号也算一次),换满还失败就把错误返回给客户端。两项都设为 0 表示失败不重试、直接报错。注意账号级限额(429)不占这里的换号次数 —— 那类失败走「冷却该账号并换下一个账号」的降级,与这里的重试是两条路。另有「指定错误码直接换号」名单(默认 402):命中名单的上游状态码不在同一账号重发,直接按队列换下一个账号继续试(换号也占「切换账号重试次数」),换满仍失败才把错误返回给客户端。"),routing:r("转发一个请求时按什么顺序挑账号:①「路由策略」决定排队规则 —— 顺序优先是排第 1 的接走所有请求、直到它不能答(限流 / 故障 / 额度尽)才轮到下一位;负载均衡是每条请求换下一位,把负载摊到各个账号上。②「会话粘性」让同一会话(相同的模型 + 相同的开头消息)尽量跟住同一个账号 —— 多轮对话的上下文缓存能复用、少换号少浪费;自动档粘 5 分钟、会话内档粘 6 小时、每轮与关闭都不粘。账号的排队位次(账号表的第一列)在所有策略下都是地基,策略在它之上再排。此外路由还有三层自愈保护:转发失败的账号退避休息一会儿(15 分钟起步翻倍、封顶 1 小时)、被 429 的账号垫底排到队尾 30 分钟、余额不足 / Token 周期用量到顶的账号由限制器拦下 —— 前两层可以在下面按需开关,限制器由账号的「限制器」设置管。"),sanitize:r("上游用「逐字精确匹配」的方式审核请求体(不是语义审核):客户端注入的固定模板句、计费头字段名、以及某些裸错误码出现在报文里就会整单拦截,返回 400。开启本项后,网关在每次转发前改写这些指纹 —— 表头键值整段删除,承载语义的模板句只换一个词(如 official CLI for Claude → official CLI tool for Claude),对话内容与语义都不受影响。规则集是内置的,不需要也无法维护词表。关掉本项后客户端模板会原样发往上游,可能重新出现模板句被误拦的报错。"),clineHeaders:r("Cline 上游按请求头判定「调用方是不是 Cline 自家产品」:X-CLIENT-TYPE: cline-sdk 是硬门槛(缺了它免费池模型一律 403),版本号与平台标识让请求更贴近官方客户端的形态。这里列出的是网关默认会发的头:改某一行的值 = 覆盖默认值(也可以新增默认清单之外的自定义头);把值清空保存 = 这个头不发送;在界面删掉被改过的行 = 回落默认值。改完点「保存」,下一个 Cline 请求立即生效。不懂某一行的含义就不要动它 —— 伪装头的价值在「与官方客户端逐字一致」。"),cors:r("网关面(/v1/*)默认不应答浏览器跨源请求:页面直连会被预检拦下,只报「无法连接 API」。注意来源是 * —— 未配「网关 Key」时任何网页都能借本机网关打上游,故默认关闭;只给自己用的话,让页面与网关同源(本地反代 /v1)更稳妥。面板接口(/api/*)不受影响。"),prompt:r("客户端(Claude Code / Codex 等 CLI)会在 system 提示词里注入几十句固定模板,上游按逐字匹配审核,命中就整单拦截(HTTP 400)。指纹脱敏能改写实测命中过的那几句,但换一个客户端版本就可能冒出新的。这里可以把 system 整段换成网关自己那份:①「透传」= 不动客户端 system(默认,行为与之前完全一致);②「替换」= 删掉客户端所有 system / developer 消息,换成网关的提示词(客户端项目规范随之消失);③「追加」= 在开头连续 system 块之后插入一条网关提示词,既有消息逐字不动(客户端规范与网关提示词并用)。那份提示词有两个来源:提示词文件(留空用内置默认),或直接在界面上编辑正文 —— 编辑过就以那份正文为准(优先于文件),清空则回到文件 / 内置默认。另外,透传 / 追加模式下撞了内容拦截(多半是指纹误报)时,网关会自动换一段最小中性提示词重试一次,并把「降级期」开到次日 00:00 —— 期间所有请求直接带中性提示词出门,不再先撞一次 400;这里能看见并提前解除它。上面几项是**默认值**:想给某个提供商单独配,用下面的「按提供商」加一行(带「网关自带」的家默认就列在那里)—— 不同的上游对这些内容的接受程度不一样。"),debug:r("开启后,网关会把每次转发**发给上游的请求**(请求头 + 请求体)与**上游返回的响应**(状态码 + 响应头 + 响应体)完整保存到本地,供请求日志页的「详情」查看。请求头里的 Authorization、Cookie、API Key 等凭据字段一律替换成 [redacted],不会明文落盘;请求体与响应体按原样保存(可能包含你的对话内容)。报文只保留最近 500 条,超出后丢弃最旧的。这是排障用的临时开关,不需要时建议关闭。"),io:r("导出会把全部账号与自定义提供商定义写入一个 JSON 文件,可以拷到另一台机器上导入后继续使用。导入采用合并策略:同提供商下按业务身份(UID / userId / apiKey 等)去重 —— 已存在的账号只更新凭证,保留本机原有的优先级顺序;新账号追加到转发顺序末尾,不会抢占当前正在使用的账号;自定义提供商定义按 id 合并,本机缺失时自动补建。"),backup:r("把整份数据库(账号、网关配置、事件日志、请求统计、调试报文与桌面设置)导出成一个 SQL 文件,恢复时整体替换本机全部数据 —— 与上面「账号导入 / 导出」的逐条合并是两种语义:恢复会连配置、日志与当前启用状态一起换成备份那台机器的状态。导出默认包含日志与调试报文(文件可能很大),不需要时可以取消勾选只备业务数据。恢复前会自动把当前数据备份到配置目录的 backups/ 下,恢复后需要重新登录管理面板。"),retention:r("三档数据各自独立计时,超出保留天数的部分会被删除:事件日志是登录、账号切换、429 切换这类系统事件;请求日志是网关每次转发到上游的逐条记录;按天聚合供报表页的热力图与按天趋势使用。请求日志与按天聚合默认 99999 天(约 274 年,效果上等于全量保留),事件日志默认 30 天。把某一档改小(例如 30 天改成 7 天)保存后会立即删除超出的历史数据,此操作不可恢复;改大或保持不变不会删除任何数据。三档的可填范围均为 1–99999 天。"),storage:r("全部数据(账号、事件日志、请求记录、调试报文、设置)统一保存在配置目录下的 agent2api.db 这一个 SQLite 数据库里。备份时只需拷贝这个文件;更换保存位置请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),modelsDev:r("models.dev 是一个开源的模型资料库(社区维护),这里用它补齐「上游没告诉我们」的模型能力:上下文窗口、最大输出、工具调用、图片、视频、是否支持思考,以及这个模型认识哪些思考档位。优先级是:你在「模型能力」里手工改的值 > 上游清单自己声明的值 > models.dev 的值 —— 它只填上游没声明的空位,从不推翻上游已声明的。网关随包内嵌了一份快照,所以离线、首次启动、访问不通时也有数据;开启时会按「模型目录刷新」任务的间隔联网更新(同一轮里一并刷新,也可在这里立即刷新)。关闭只停联网刷新,已经拿到的数据继续用。")},$n={timeouts:r("保存后立即生效,不用重启;超时按上游失败处理(计入请求日志的「错误」列,并按「请求重试」的设置决定是否重试)。"),queue:r("等待期间请求日志的状态列会显示「排队中」阶段,详情弹窗的「内部重试」里能逐次看到等待时长;等待用尽后返回 HTTP 503(不是 401/429:既不会刷新凭证,也不会把账号标成限额)。"),captchaPool:r("保存后对下一轮补货立即生效,不用重启。守卫跑在应用界面里:轻量模式关窗销毁界面期间无法铸造,走活动套餐通道的请求会以 503 落进请求日志(写明原因),重新打开界面即自动恢复。"),retry:r("保存后立即生效,不用重启;次数用尽仍失败时,错误原样返回给客户端。"),routing:r("保存后立即生效,不用重启:策略与粘性作用于**下一次**转发的选路,进行中的请求不受影响。"),retryCodes:r("命中这些上游状态码的失败不在同一账号重发,直接换下一个账号继续试(换号占用「切换账号重试次数」,换满仍失败才把错误原样返回给客户端)。输入 100–599 的状态码后回车添加,点 × 或退格删除;默认 402(积分不足)。清空全部表示任何错误都照常重试。"),sanitize:r("默认开启。命中明细会记进请求日志的「敏」标签(悬停可看命中了哪几条规则)。本项只改发给上游的副本,客户端看到的响应内容不变。"),clineHeaders:r("值与默认值相同的行不占覆盖(存的是「改过的键」,不是全量配置);值留空保存表示这个头不发送,删除改过的行表示回落默认值。改完立即生效,不用重启。"),cors:r("默认关闭。改动立即生效,不用重启;关闭期间的跨源请求会被预检拦下。"),debug:r("开启后新发生的请求才会被记录(已经过去的请求补不回来)。报文统一存放在本地数据库里,只保留最近 500 条(超出后丢弃最旧的),条数见左侧「数据 → 数据存储」的「调试报文」。"),promptMode:r("替换 = 客户端 system / developer 消息全部删掉,换成网关的提示词;追加 = 保留客户端内容,只在开头 system 块之后多插一条。两者都只改发给上游的副本,客户端看到的响应不变。"),promptFile:r("UTF-8 文本文件路径,留空用内置默认提示词(通用编码助手提示词,不含任何会被上游拦截的模板句)。只在「替换 / 追加」模式下生效,透传模式不读它。"),promptText:r("在这里直接编辑提示词正文:保存后以这份文本为准(优先于上面的提示词文件),清空则回到文件 / 内置默认。改一个字不必再去编辑器里开文件。"),promptGatewayText:r("上游按「结构」校验身份:三段必须各自成块,所以这里分开编辑三段(不能合成一段)。动态段里的运行值写成占位符,发请求时才替换:{cwd} 工作目录、{platform} 平台、{shell} shell、{os_version} 系统版本、{git} 是否 git 仓库、{provider} 提供方标识、{model} 模型名。清空某一段 = 那一段恢复官方原文。第三段发出时前面会自带一个空行(官方形状)。"),prompt:r("改完立即生效,不用重启(下一个请求就用新模式)。降级是自动的临时状态,解除后本模式自己的提示词立刻恢复。"),promptProviders:r("「用哪份提示词」本来是按上游分别决定的事,所以每家可以有自己的模式、提示词文件与正文:不在这里列出的提供商一律沿用上面那份默认设置,「跟随默认」把这一家取消、回到默认。带「网关自带」那一行的家(目前是 ZCode 两家)默认就列在这里 —— 那一段是网关自己装上去的文本,不来自客户端也不来自提示词文件,默认开启、可以关掉,也可以改它的正文(改过的那一段以你的文本为准);关掉后还能不能通过上游校验,取决于上游当下的口径,行内说明了实测依据。「模式 / 提示词文件 / 正文」管的是客户端自己的 system 怎么处理,与那个开关是两件事。"),modelsDev:r("「模型管理」里每个能力的来源标记(上游 / models.dev / 已覆盖)读的就是这份数据;映射弹窗的思考档位下拉也按这里的数据只列该模型真实认识的档位。"),retention:r("保存后立即生效:改小保留天数会立刻删除超出的历史数据,且不可恢复。"),storageFile:r("配置目录下的 agent2api.db(账号、日志、请求记录、调试报文与设置都在里面)。"),storageSize:r("库主文件的大小(不含运行期间的 WAL 临时文件,退出时已自动并回)。"),storage:r("数据统一保存在配置目录下的 agent2api.db;如需更换位置,请设置环境变量 AGENT2API_PROXY_HOME 后重启程序。"),captcha:r("开启后,登录页在浏览器后台自动完成验证(对真人无感),而脚本每次尝试都要先算一道题 —— 暴力破解与抢注的成本显著上升。仅影响面板的登录 / 注册,与 API 客户端的 API Key 无关。"),panelLogin:r("当前浏览器以管理员身份登录着本面板。「退出登录」会撤销这台设备的登录会话(30 天内的自动续期一并失效),需要重新输入账号密码;其他已登录的设备不受影响。"),exportDanger:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义,可直接用于登录。请妥善保管,不要外传或上传到公共位置。"),backupDanger:r("备份文件内含全部账号凭证、网关 API Key 与面板管理员凭据,可直接用于登录。请妥善保管,不要外传或上传到公共位置。")},Ut={appLoading:"—",appUnavailable:r("主进程未返回启动设置,请更新桌面端后重试"),appTrayOn:r("关闭窗口时程序不退出,转发继续在后台运行;退出请用托盘菜单"),appTrayOff:r("关闭窗口即退出程序,后台转发随之中断"),appLightOn:r("轻量模式已开启:关窗即销毁界面进程(释放约 200MB 内存),网关在后台继续;界面销毁期间 ZCode 活动套餐通道不可用,相关请求会在请求日志里注明原因"),appLightOff:r("未开启轻量模式:关窗仅隐藏窗口,界面进程常驻内存,随时打开不等待"),unitsOn:r("当前显示为「1.2亿 / 8400万」这类中文量级。"),unitsOff:r("当前显示为「1.20M / 8.4k」这类英文缩写。"),debugUnavailable:r("未能读取调试模式设置,请稍后重试"),debugOn:r("正在保存上游原始报文:"),debugOff:r("未开启,转发时不保存任何原始报文。"),sanitizeUnavailable:r("未能读取指纹脱敏设置,请稍后重试"),sanitizeOn:r("正在剥离出站请求里的审核指纹:表头键值整段删除,模板句最小改写。"),sanitizeOff:r("未开启,客户端 system 模板会原样发往上游,可能被内容审核误拦(400)。"),corsUnavailable:r("未能读取网关跨域访问设置,请稍后重试"),corsOn:r("正在应答跨源请求:浏览器跨域请求可直连 /v1/*。"),corsOff:r("未开启,浏览器跨域无法直连网关。"),modelsDevUnavailable:r("未能读取 models.dev 元数据状态,请稍后重试"),modelsDevSourceBuiltin:r("随包内嵌的快照(发版时的那份)"),modelsDevSourceCache:r("上次成功刷新的结果(存在本机数据库里)"),modelsDevSourceNetwork:r("刚刚从 models.dev 拉到的最新数据"),modelsDevEmpty:r("还没有装载任何数据。"),promptUnavailable:r("未能读取系统提示词设置,请稍后重试"),degradeUntilFallback:r("次日 00:00"),themeSystem:r("当前跟随操作系统的深浅色设置,系统切换时界面会自动跟上。"),themeLight:r("当前固定为浅色模式,不随系统变化。"),themeDark:r("当前固定为深色模式,不随系统变化。"),zoomWeb:r("网页端的界面缩放由浏览器自己控制(Ctrl + / Ctrl -,或浏览器菜单里的缩放),此项不可调。"),zoomDefault:r("当前按 100% 显示(默认比例)。"),languageHint:r("界面语言只保存在本机(localStorage)。切换后整页立即刷新,不影响账号、密钥与转发。")},Ox=[{value:"order",label:r("顺序优先"),tip:r("排第 1 的接走所有请求,直到它不能答(限流 / 故障 / 额度尽)才轮到下一位 —— 就是「从上往下」的现状行为。")},{value:"rotate",label:r("负载均衡"),tip:r("每条请求轮换到下一个可用账号;新会话交给当前最闲的那位。适合想把手里的号摊开用、不让某一个一直扛。")},{value:"provider",label:r("家内轮询"),tip:r("家之间仍按优先级,只有同一家内部轮流用各账号 —— 想优先用某几家、又不愿把某一家的某个账号焊死时用它。")}],Mx=[{value:"auto",label:r("自动"),tip:r("同一会话在 5 分钟内尽量跟住同一个账号;停了 5 分钟再发就算新会话。多数场景用它 —— 多轮对话少换号,也不至于把账号焊死。")},{value:"session",label:r("会话内"),tip:r("同一会话在 6 小时内跟住同一个账号;适合一坐几个小时的长会话,上游的上下文缓存能吃到更多。")},{value:"turn",label:r("每轮"),tip:r("每条请求都重新按策略选路 —— 行为与「关闭」一致,仅保留会话识别的记录。")},{value:"off",label:r("关闭"),tip:r("不做会话识别,每条请求都重新按策略选路。")}],JZ=[{key:"routingFailoverBackoff",label:r("失败退避"),defaultOn:!0,tip:r("转发失败的账号休息一会儿再回来:15 分钟起步,连续失败翻倍,封顶 1 小时;成功一次立即恢复。目的是「让这次失败先凉一会儿」,免得一条条地反复撞同一个坏账号。")},{key:"routingSink",label:r("限流垫底"),defaultOn:!0,tip:r("还有额度时被 429 的账号排到队尾,30 分钟后自动回到队列(成功转发一次也会立即回来)。它标记的是「疑似共享池被别人抢」,不是「这个账号本身有问题」。⚠️ 注意它与路由策略的配合:在「家内轮询」下,队尾意味着这一家整体被往后排 —— 如果某个提供商的账号被批量限流,它们会集体沉到队尾,那个家可能长时间轮不到。这时可以关掉本项,让 429 过的账号只受冷却约束(冷却到点自动回来)。")},{key:"routingBreakerEnabled",label:r("熔断"),defaultOn:!1,tip:r("连续失败到阈值后把这个账号整个打开(默认关)。与失败退避的分工:退避管「单次失败先凉一会儿」,惩罚轻、自动恢复;熔断管「这个账号现在整体不对劲,别再一条条地试」,要连续成功若干次才关。打开期间该账号被跳过,除非全场只剩它 —— 那时仍放行试一次。")}],II=[{key:"zcodeCaptchaPoolTarget",id:"settings-captcha-pool-target",label:r("库存目标"),unit:r("个"),min:1,max:10,hint:r("ZCode 活动套餐通道每条请求都要消耗一个当次铸造的人机验证令牌(一次性,2 分钟过期),库存低于该值时界面自动补铸到它。默认 3 个。调大能吸收突发并发,但用不掉的令牌 2 分钟就过期作废,烧的是上游风控配额。可填 1–10。")},{key:"zcodeCaptchaPoolPollMs",id:"settings-captcha-pool-poll-ms",label:r("轮询间隔"),unit:r("毫秒"),min:1e3,max:3e4,hint:r("铸造守卫每隔多久看一次库存(毫秒)。只影响发现缺货的反应速度 —— 库存够用时轮询不会铸造任何令牌。默认 2500 毫秒,可填 1000–30000。")},{key:"zcodeCaptchaPoolMaxPerRound",id:"settings-captcha-pool-max-per-round",label:r("单轮铸造上限"),unit:r("个"),min:1,max:5,hint:r("发现缺货时一轮最多铸几个(连铸之间固定隔 500 毫秒)。默认 1 个:SDK 同一实例连铸容易互相干扰。调大补货更快,但单轮连铸越多越容易触发上游风控。可填 1–5。")}];function PI(){return tt().workbuddyDesktop?.platform==="web"}let dt={...{category:Ax[0].id,scrollReset:0,busy:null,app:{status:"loading",closeToTray:!1,autostart:!1,lanAccess:!1,lanPanel:!1,lightweightMode:!1,lanIp:null,port:0,adminRegistered:null},unitsChinese:!0,retention:{status:"loading",values:null},retry:{status:"loading",values:null},retryCodes:null,timeouts:{status:"loading",values:null},queue:{status:"loading",values:null},captchaPool:{status:"loading",values:null},routing:{status:"loading",strategy:"order",sticky:"auto",failoverBackoff:!0,sink:!0,breakerEnabled:!1},debug:{status:"loading",on:!1,count:null,limit:null},sanitize:{status:"loading",on:!1},clineHeaders:{status:"loading",defaults:{},overrides:{},effective:{}},cors:{status:"loading",on:!1},prompt:{status:"loading",mode:"passthrough",file:"",text:"",source:"",lines:0,fileError:"",degradeActive:!1,degradeUntilText:"",providers:[],gateway:{},gatewayText:{},options:[]},storage:{status:"loading",available:!0,file:"",bytes:0,accounts:null,logs:null,requests:null,dailyDays:null,debug:null},captcha:{available:!0,enabled:!1},modelsDev:{status:"loading",enabled:!0,source:"",updatedAt:0,count:0},ioFailure:null,retentionConfirm:null,dbIncludeLogs:!0,dbBackupConfirm:null,dbWarning:null,lanConfirm:null,lanRegister:null,panelLogin:!1},panelLogin:PI()};const uS=new Set;function eW(e){return uS.add(e),()=>{uS.delete(e)}}function tW(){return dt}function nW(){return x.useSyncExternalStore(eW,tW)}function Ze(e){dt={...dt,...e};for(const t of uS)t()}function Ma(e){Ze({app:{...dt.app,...e}})}function nl(){Ze({})}let En=null;function fs(e){En=e,Ze({busy:e})}function as(){En=null,Ze({busy:null})}function dS(e){const t=Ax.some(a=>a.id===e)?String(e):Ax[0].id;Ze({category:t,scrollReset:dt.scrollReset+1})}function sW(e){dS(e);try{localStorage.setItem(wI,e)}catch{}}function _I(){let e=null;try{e=localStorage.getItem(wI)}catch{e=null}dS(e)}function LI(){Ze({unitsChinese:tt().wbUnits?.isChinese?.()!==!1})}function rW(e){tt().wbUnits?.setChinese?.(e),LI(),Ve(r(e?"✅ 已改用本地量级词(万 / 亿式)":"✅ 已改用 k / M 缩写"))}function fS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ma({status:"unavailable"});return}const t=e;Ma({status:"ready",closeToTray:t.closeToTray===!0,autostart:t.autostart===!0,lanAccess:t.lanAccess===!0,lanPanel:t.lanPanel===!0,lightweightMode:t.lightweightMode===!0})}async function zI(){try{fS(await tt().workbuddyDesktop?.getAppSettings())}catch(e){console.warn("读取应用设置失败:",_t(e)),fS(null)}}async function aW(){const e=tt().workbuddyDesktop;if(e?.localIp){try{Ma({lanIp:await e.localIp()||null})}catch{}try{const t=Number((await e.getBackendStatus?.())?.port)||0;t&&Ma({port:t})}catch{}try{const t=(await e.panelAdminStatus?.())?.registered===!0;Ma({adminRegistered:t})}catch{}}}async function pS(e,t){if(En){nl();return}const a=dt.app,o={closeToTray:e==="tray"?t:a.closeToTray,autostart:e==="autostart"?t:a.autostart,lanAccess:a.lanAccess,lanPanel:a.lanPanel,lightweightMode:e==="lightweight"?t:a.lightweightMode};fs("app"),Ma(o);const c=r(e==="autostart"?"开机自动启动":e==="lightweight"?"轻量模式":"关闭窗口时最小化到托盘");try{const d=tt().workbuddyDesktop;if(!d)throw new Error(r("主进程桥不可用"));const f=await d.saveAppSettings(o);Ma({status:"ready",...ZZ(f,o)}),Ve(r("✅ 已更新「{label}」",{label:c}))}catch(d){Ma(a),Ve(r("保存失败:{message}",{message:_t(d)}),"err")}finally{as()}}function lW(e){if(En){nl();return}Ze({lanConfirm:{mode:e?"enable":"disable",panel:dt.app.lanPanel}})}function oW(e){if(En){nl();return}Ze({lanConfirm:{mode:"panel",panel:e}})}function mS(e){const t=dt.lanConfirm;if(Ze({lanConfirm:null}),!(!t||!e)){if(t.mode==="disable"){Dx(!1,!1);return}if(t.mode==="panel"){Dx(!0,t.panel);return}iW()}}async function iW(){const e=tt().workbuddyDesktop;if(!e?.panelAdminStatus){Ve(r("当前环境不支持局域网访问设置"),"err");return}fs("lan");let t;try{t=(await e.panelAdminStatus())?.registered===!0}catch(a){as(),Ve(r("查询管理员状态失败:{message}",{message:_t(a)}),"err");return}if(as(),Ma({adminRegistered:t}),t){await Dx(!0,dt.app.lanPanel);return}Ze({lanRegister:{busy:!1,error:""}})}async function cW(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.panelRegister)return;const o=e.trim();if(!o||o.length>64){Ze({lanRegister:{busy:!1,error:r("请填写管理员账号(64 字符以内)")}});return}if(t.length<8){Ze({lanRegister:{busy:!1,error:r("密码至少 8 位")}});return}Ze({lanRegister:{busy:!0,error:""}});try{if(await a.panelRegister(o,t),dt.lanRegister===null)return;Ze({lanRegister:null}),Ma({adminRegistered:!0}),await Dx(!0,dt.app.lanPanel)}catch(c){Ze({lanRegister:{busy:!1,error:_t(c)}})}}function BI(){Ze({lanRegister:null})}async function Dx(e,t){if(En)return;const a=tt().workbuddyDesktop;if(!a?.changeLanAccess){Ve(r("当前环境不支持局域网访问设置"),"err");return}fs("lan"),Ma({lanAccess:e,lanPanel:t});try{(await a.changeLanAccess(e,t))?.createdKey&&Ve(r("✅ 已自动创建网关 Key「默认」(可在「网关 Key」页查看)")),Ve(r("✅ 设置已保存,应用正在重启…"))}catch(o){Ve(r("保存失败:{message}",{message:_t(o)}),"err"),await zI()}finally{as()}}async function uW(){if(!En){Ze({ioFailure:null}),fs("export");try{const e=await tt().workbuddyDesktop?.exportAccounts();if(e?.canceled){Ve(r("已取消导出"));return}const t=Number(e?.count)||0,a=Number(e?.customProviders)||0;if(!t&&!a){Ve(r("没有可导出的账号"),"err");return}const o=a?r("、{n} 个自定义提供商",{n:a}):"",c=e?.file?r(" 到 {file}",{file:e.file}):"";Ve(r("✅ 已导出 {count} 个账号{note}{file}",{count:t,note:o,file:c}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}async function dW(){if(!En){Ze({ioFailure:null}),fs("import");try{const e=await tt().workbuddyDesktop?.importAccounts();if(e?.canceled){Ve(r("已取消导入"));return}const t=Number(e?.added)||0,a=Number(e?.updated)||0,o=Number(e?.skipped)||0,c=Number(e?.failed)||0,d=Array.isArray(e?.errors)?e.errors:[],f=e?.customProviders??{},p=Number(f.added)||0,h=Number(f.updated)||0,v=[];o&&v.push(r("跳过 {n} 个",{n:o})),c&&v.push(r("失败 {n} 个",{n:c}));const y=v.length?r(",{items}",{items:v.join(r("、"))}):"",b=p||h?r(",自定义提供商新增 {added} 个、更新 {updated} 个",{added:p,updated:h}):"",j=r("新增 {added} 个、更新 {updated} 个{suffix}{note}",{added:t,updated:a,suffix:y,note:b});if(c){Ve(r("导入完成:{summary}",{summary:j}),"err");const w=d.slice(0,3).map(k=>{const S=k?.customProvider?r("自定义提供商 {id}",{id:k?.id||r("(无 id)")}):k?.id??r("未知账号"),N=k?.message??r("未知原因");return r("{label}({message})",{label:S,message:N})}).join(r(";"));Ze({ioFailure:{failed:c,detail:w,more:d.length>3}})}else Ve(r("✅ 导入完成:{summary}",{summary:j}));(t||a||p||h)&&await tt().wbApp?.refresh?.()}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function fW(e){Ze({dbIncludeLogs:e})}async function pW(){if(!En){fs("dbExport");try{const e=tt().workbuddyDesktop;if(!e?.exportDatabase){Ve(r("当前环境不支持整库备份(仅桌面端可用)"),"err");return}const t=await e.exportDatabase(dt.dbIncludeLogs);if(t?.canceled){Ve(r("已取消导出"));return}const a=Number(t?.bytes)||0,o=Array.isArray(t?.tables)?t.tables.length:0;Ve(r("✅ 已备份 {n} 张表({size})到 {file}",{n:o,size:DI(a),file:t?.file||""}))}catch(e){Ve(r("操作失败:{message}",{message:_t(e)}),"err")}finally{as()}}}function mW(){En||Ze({dbBackupConfirm:{includeLogs:dt.dbIncludeLogs}})}function hS(e){Ze({dbBackupConfirm:null}),e&&hW()}async function hW(){if(En)return;const e=tt().workbuddyDesktop;if(!e?.importDatabase){Ve(r("当前环境不支持整库恢复(仅桌面端可用)"),"err");return}fs("dbImport"),Ze({dbWarning:null});try{const t=await e.importDatabase(),a=Array.isArray(t?.tables)?t.tables.length:0,o=t?.safetyBackup?r(",替换前的数据已备份为 {name}",{name:t.safetyBackup}):"";Ve(r("✅ 已恢复 {n} 张表{note}",{n:a,note:o}));const c=typeof t?.warning=="string"?t.warning.trim():"";c&&Ze({dbWarning:c}),await ES(),await tt().wbApp?.refresh?.()}catch(t){Ve(r("恢复失败:{message}",{message:_t(t)}),"err")}finally{as()}}function Ix(e){if(e===void 0)return;const t=MI(oS,e,dt.retention.values);Ze({retention:{status:t===null?"unavailable":"ready",values:t}})}async function Px(){try{Ix(await tt().workbuddyDesktop?.getRetention())}catch(e){console.warn("读取数据保留设置失败:",_t(e)),Ix(null)}}let _x=null;function Lx(e){const t=_x;_x=null,Ze({retentionConfirm:null}),t?.(e)}function gW(e){return new Promise(t=>{_x&&Lx(!1),_x=t,Ze({retentionConfirm:{head:e}})})}function xW(e,t,a){return t===null?r("没能读到「{label}」的当前值,改为 {days} 天可能会删除超出的历史数据。",{label:e.label,days:a}):r("「{label}」将从 {previous} 天改为 {days} 天。",{label:e.label,previous:t,days:a})}async function bW(e,t){if(En||dt.retentionConfirm)return;const a=OI(t,e.min,e.max,r("天数"));if(!a.ok){Ve(a.message,"err");return}const o=dt.retention.values?.[e.key],c=typeof o=="number"&&Number.isInteger(o)?o:null;if(c!==null&&a.value===c)return;const d=c===null||a.valueNumber.isInteger(d?.[f.key]))){const f=d?.[e.key]??t;Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:f}):r("✅ 已保留 {days} 天",{days:f}));return}await Px(),Ve(a?r("✅ 已保留 {days} 天,超出部分已清理",{days:t}):r("✅ 已保留 {days} 天",{days:t}))}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await Px()}finally{as()}}function kp(e,t){if(t===void 0)return;const a=MI(e.fields,t,e.read().values);e.write({status:a===null?"unavailable":"ready",values:a}),e.syncExtras?.(a===null?null:t)}async function Ku(e){try{kp(e,await e.get())}catch(t){console.warn(`${e.consoleLabel}失败:`,_t(t)),kp(e,null)}}async function zx(e,t,a){if(En)return;const o=OI(a,t.min,t.max,t.label);if(!o.ok){Ve(o.message,"err");return}const c=e.read().values?.[t.key];if(Number.isInteger(c)&&o.value===c)return;fs(e.scope);const d=e.read().values;d&&e.write({status:"ready",values:{...d,[t.key]:o.value}});try{const f=await e.save({[t.key]:o.value});kp(e,f);const p=e.read().values?.[t.key],h=Number.isInteger(p)?p:o.value;Ve(r("✅ 已保存:{label} {value}",{label:t.label,value:String(h)}))}catch(f){Ve(r("保存失败:{message}",{message:_t(f)}),"err"),await Ku(e)}finally{as()}}const HI={scope:"queue",fields:EI,consoleLabel:"读取排队等待设置",get:()=>tt().workbuddyDesktop?.getQueue(),save:e=>tt().workbuddyDesktop?.saveQueue(e),read:()=>dt.queue,write:e=>Ze({queue:e})};async function UI(){await Ku(HI)}async function yW(e,t){await zx(HI,e,t)}const VI={scope:"captchaPool",fields:II,consoleLabel:"读取验证码令牌池设置",get:()=>tt().workbuddyDesktop?.getCaptchaPool(),save:e=>tt().workbuddyDesktop?.saveCaptchaPool(e),read:()=>dt.captchaPool,write:e=>Ze({captchaPool:e})};async function FI(){await Ku(VI)}async function jW(e,t){await zx(VI,e,t)}const $I="routingStrategy",qI="routingSticky",wW="routingFailoverBackoff",SW="routingSink",NW="routingBreakerEnabled",kW={[$I]:new Set(Ox.map(e=>e.value)),[qI]:new Set(Mx.map(e=>e.value))};function GI(e){const t=e&&typeof e=="object"?e:{},a=(c,d)=>{const f=t[c];return typeof f=="string"&&kW[c].has(f)?f:d},o=(c,d)=>{const f=t[c];return typeof f=="boolean"?f:d};return{strategy:a($I,"order"),sticky:a(qI,"auto"),failoverBackoff:o(wW,!0),sink:o(SW,!0),breakerEnabled:o(NW,!1)}}async function Bx(){try{const e=await tt().workbuddyDesktop?.getRoutingConfig();if(e===void 0){Ze({routing:{...dt.routing,status:"unavailable"}});return}Ze({routing:{status:"ready",...GI(e)}})}catch(e){console.warn("读取路由设置失败:",_t(e)),Ze({routing:{...dt.routing,status:"unavailable"}})}}async function gS(e){if(En)return;const t=tt().workbuddyDesktop;if(!t?.setRoutingConfig){Ve(r("桌面运行时不可用,暂时无法保存"),"err");return}fs("routing");try{const a=await t.setRoutingConfig(e);a!==void 0?Ze({routing:{status:"ready",...GI(a)}}):await Bx(),Ve(r("✅ 路由设置已保存"))}catch(a){Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await Bx()}finally{as()}}const Cp={scope:"retry",fields:CI,consoleLabel:"读取请求重试设置",get:()=>tt().workbuddyDesktop?.getRetry(),save:e=>tt().workbuddyDesktop?.saveRetry(e),read:()=>dt.retry,write:e=>Ze({retry:e}),syncExtras:e=>{if(e===null){Ze({retryCodes:null});return}const t=e[AI];if(!Array.isArray(t))return;Ze({retryCodes:t.filter(o=>typeof o=="number"&&Number.isInteger(o)&&o>=iS&&o<=cS)})}};function CW(e){kp(Cp,e)}async function KI(){await Ku(Cp)}async function TW(e,t){await zx(Cp,e,t)}async function xS(e){if(!En){Ze({retryCodes:e}),fs("codes");try{const t=await tt().workbuddyDesktop?.saveRetry({[AI]:e});kp(Cp,t),Ve(r("✅ 已保存:指定错误码直接换号"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await Ku(Cp)}finally{as()}}}async function EW(e){const t=dt.retryCodes;if(t===null)return;const a=String(e??"").trim();if(!a)return;if(!/^\d+$/.test(a)||Number(a)cS){Ve(r("状态码必须是 {min}–{max} 的整数(收到: {text})",{min:iS,max:cS,text:a}),"err");return}const o=Number(a);if(t.includes(o)){Ve(r("状态码 {code} 已在名单里",{code:o}));return}if(t.length>=RI){Ve(r("名单最多 {max} 个状态码",{max:RI}),"err");return}await xS([...t,o])}async function AW(e){const t=dt.retryCodes;!t||!t.includes(e)||await xS(t.filter(a=>a!==e))}async function RW(){const e=dt.retryCodes;e?.length&&await xS(e.slice(0,-1))}const YI={scope:"timeouts",fields:TI,consoleLabel:"读取请求超时设置",get:()=>tt().workbuddyDesktop?.getTimeouts(),save:e=>tt().workbuddyDesktop?.saveTimeouts(e),read:()=>dt.timeouts,write:e=>Ze({timeouts:e})};async function XI(){await Ku(YI)}async function OW(e,t){await zx(YI,e,t)}function Hx(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({debug:{status:"unavailable",on:!1,count:null,limit:null}});return}const t=e,a=Number(t.count),o=Number(t.limit);Ze({debug:{status:"ready",on:t.debugMode===!0,count:Number.isInteger(a)?a:null,limit:Number.isInteger(o)?o:null}})}async function bS(){try{Hx(await tt().workbuddyDesktop?.getDebug())}catch(e){console.warn("读取调试模式设置失败:",_t(e)),Hx(null)}}async function MW(e){if(En){nl();return}fs("debug"),Ze({debug:{...dt.debug,on:e}});try{const t=await tt().workbuddyDesktop?.saveDebug(e);Hx(t),Ve(r(e?"✅ 调试模式已开启":"✅ 调试模式已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await bS()}finally{as()}}function Ux(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({sanitize:{status:"unavailable",on:!1}});return}Ze({sanitize:{status:"ready",on:e.sanitizeBlacklistFingerprints===!0}})}async function vS(){try{Ux(await tt().workbuddyDesktop?.getSanitize())}catch(e){console.warn("读取出站指纹脱敏设置失败:",_t(e)),Ux(null)}}async function DW(e){if(En){nl();return}fs("sanitize"),Ze({sanitize:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveSanitize(e);Ux(t),Ve(r(e?"✅ 出站指纹脱敏已开启":"已关闭出站指纹脱敏"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await vS()}finally{as()}}function yS(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e))typeof o=="string"&&(t[a]=o);return t}function jS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({clineHeaders:{status:"unavailable",defaults:{},overrides:{},effective:{}}});return}const t=e;Ze({clineHeaders:{status:"ready",defaults:yS(t.defaults),overrides:yS(t.overrides),effective:yS(t.effective)}})}async function wS(){try{jS(await tt().workbuddyDesktop?.getClineHeaders())}catch(e){console.warn("读取 Cline 伪装头失败:",_t(e)),jS(null)}}async function IW(){await wS(),Ve(r("Cline 伪装头已刷新"))}async function QI(e){if(En){nl();return}fs("clineHeaders");try{const t=await tt().workbuddyDesktop?.saveClineHeaders(e);jS(t),Ve(r("✅ Cline 伪装头已保存"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await wS()}finally{as()}}function SS(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({cors:{status:"unavailable",on:!1}});return}Ze({cors:{status:"ready",on:e.corsEnabled===!0}})}async function NS(){try{SS(await tt().workbuddyDesktop?.getCors())}catch(e){console.warn("读取网关跨域访问设置失败:",_t(e)),SS(null)}}async function PW(e){if(En){nl();return}fs("cors"),Ze({cors:{status:"ready",on:e}});try{const t=await tt().workbuddyDesktop?.saveCors(e);SS(t),Ve(r(e?"网关跨域访问已开启":"已关闭网关跨域访问"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await NS()}finally{as()}}async function ZI(){try{const e=await tt().workbuddyDesktop?.getCaptchaSetting();Ze({captcha:{available:!0,enabled:e?.captchaEnabled===!0}})}catch(e){Ze({captcha:{available:!1,enabled:!1}}),console.warn("读取机器人校验设置失败:",_t(e))}}async function _W(e){if(En){nl();return}fs("captcha"),Ze({captcha:{...dt.captcha,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveCaptchaSetting(e);Ze({captcha:{available:!0,enabled:t?.captchaEnabled===!0}}),Ve(r(e?"✅ 机器人校验已开启":"⚠️ 机器人校验已关闭"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await ZI()}finally{as()}}function kS(e){return!e||typeof e!="object"?{status:"unavailable",enabled:!0,source:"",updatedAt:0,count:0}:{status:"ready",enabled:e.modelsDevEnabled!==!1,source:typeof e.source=="string"?e.source:"",updatedAt:Number(e.updatedAt)||0,count:Number(e.count)||0}}async function CS(){try{const e=await tt().workbuddyDesktop?.getModelsDev?.();Ze({modelsDev:kS(e)})}catch(e){Ze({modelsDev:{...dt.modelsDev,status:"unavailable"}}),console.warn("读取 models.dev 元数据设置失败:",_t(e))}}async function LW(e){if(En){nl();return}fs("modelsDev"),Ze({modelsDev:{...dt.modelsDev,enabled:e}});try{const t=await tt().workbuddyDesktop?.saveModelsDev?.(e);Ze({modelsDev:kS(t)}),Ve(r(e?"✅ models.dev 模型元数据已开启":"已关闭 models.dev 联网刷新"))}catch(t){Ve(r("保存失败:{message}",{message:_t(t)}),"err"),await CS()}finally{as()}}async function zW(){if(En){nl();return}fs("modelsDevRefresh");try{const e=await tt().workbuddyDesktop?.refreshModelsDev?.();Ze({modelsDev:kS(e?.status)});const t=e?.result,a=String(t?.status||"");a==="refreshed"?Ve(r("models.dev 元数据已更新({count} 条)",{count:Number(t?.count)||0})):a==="failed"?Ve(r("刷新失败:{message}",{message:String(t?.message||"")}),"err"):Ve(String(t?.message||r("本次无需刷新")))}catch(e){Ve(r("刷新失败:{message}",{message:_t(e)}),"err"),await CS()}finally{as()}}function Yu(e){if(e===void 0)return;if(!e||typeof e!="object"){Ze({prompt:{...dt.prompt,status:"unavailable"}});return}const t=e,a=UW(t.promptGateway);Ze({prompt:{status:"ready",mode:String(t.promptMode||"passthrough"),file:String(t.promptFile||""),text:String(t.promptText||""),source:String(t.promptSource||""),lines:Number(t.promptLines)||0,fileError:String(t.promptFileError||""),degradeActive:t.degradeActive===!0,degradeUntilText:String(t.degradeUntilText||""),providers:BW(t.promptProviders,a),gateway:a,gatewayText:VW(t.promptGatewayText),options:HW(t.promptProviderOptions)}})}function BW(e,t){return!e||typeof e!="object"?[]:Object.entries(e).filter(([a,o])=>!!a&&!!o&&typeof o=="object").map(([a,o])=>{const c=o;return{id:a,mode:String(c.promptMode||"passthrough"),file:String(c.promptFile||""),text:String(c.promptText||""),source:String(c.promptSource||""),lines:Number(c.promptLines)||0,fileError:String(c.promptFileError||""),gateway:t[a]??!0,configured:!0}}).sort((a,o)=>a.id.localeCompare(o.id))}function HW(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&String(t.id||"")).map(t=>{const a=t;return{id:String(a.id),label:String(a.label||a.id),gatewayNote:String(a.gatewayNote||""),gatewayChars:Number(a.gatewayChars)||0,gatewayBlocks:FW(a.gatewayBlocks)}}):[]}function UW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();!c||typeof o!="boolean"||(t[c]=o)}return t}function VW(e){if(!e||typeof e!="object")return{};const t={};for(const[a,o]of Object.entries(e)){const c=String(a||"").trim();if(!c||!o||typeof o!="object")continue;const d=o,f={identity:"",stable:"",dynamic:""};let p=!1;for(const h of["identity","stable","dynamic"]){const v=String(d[h]||"");f[h]=v,v.trim()&&(p=!0)}p&&(t[c]=f)}return t}function FW(e){if(!e||typeof e!="object")return null;const t=e,a={identity:String(t.identity||""),stable:String(t.stable||""),dynamic:String(t.dynamic||"")};return!a.identity.trim()&&!a.stable.trim()&&!a.dynamic.trim()?null:a}async function ac(){try{Yu(await tt().workbuddyDesktop?.getPrompt())}catch(e){console.warn("读取系统提示词设置失败:",_t(e)),Yu(null)}}async function Tp(e,t){if(En)return await ac(),!1;fs("prompt");try{const a=await tt().workbuddyDesktop?.savePrompt(t);return Yu(a),Ve(r("✅ 已保存:{label}",{label:e})),!0}catch(a){return Ve(r("保存失败:{message}",{message:_t(a)}),"err"),await ac(),!1}finally{as()}}async function $W(e){const t=zo.find(a=>a.value===e);await Tp(r("模式改为「{mode}」",{mode:t?.toastLabel??e}),{promptMode:e})}async function qW(e){await Tp(e.trim()?r("提示词文件已更新"):r("已改回内置默认提示词"),{promptFile:e})}async function GW(e){const t=!e.trim();return Tp(r(t?"已清掉界面编辑的提示词(回落文件 / 内置默认)":"提示词正文已更新"),{promptText:t?"":e})}function Bo(e,t){return e.options.find(a=>a.id===t)?.label||t}function lc(e){const t=e==null?"":String(e).trim();return t&&dt.prompt.options.some(a=>a.id===t)?t:""}async function Ep(e,t,a){return Tp(e,{promptProviders:{[t]:a}})}function Vx(e,t){const a=!t.configured;return{promptMode:t.mode,promptFile:t.file,promptText:a&&e.source==="inline"?e.text:""}}async function KW(e){const t=lc(e);if(!t)return;const a=dt.prompt;await Ep(r("已为「{label}」单独配置提示词",{label:Bo(a,t)}),t,Vx(a,{mode:a.mode,file:a.file,text:a.text,source:a.source,lines:a.lines,fileError:a.fileError,gateway:a.gateway[t]??!0,configured:!1}))}async function YW(e,t){const a=lc(e.id);if(!a||!zo.some(c=>c.value===t))return;const o=zo.find(c=>c.value===t);await Ep(r("「{label}」的模式改为「{mode}」",{label:Bo(dt.prompt,a),mode:o?.toastLabel??t}),a,{...Vx(dt.prompt,e),promptMode:t})}async function XW(e,t){const a=lc(e.id);a&&await Ep(t.trim()?r("「{label}」的提示词文件已更新",{label:Bo(dt.prompt,a)}):r("「{label}」改用内置默认提示词",{label:Bo(dt.prompt,a)}),a,{...Vx(dt.prompt,e),promptFile:t})}async function QW(e,t){const a=lc(e.id);if(!a)return!1;const o=!t.trim(),c=Bo(dt.prompt,a);return Ep(o?r("已清掉「{label}」界面编辑的正文",{label:c}):r("「{label}」的提示词正文已更新",{label:c}),a,{...Vx(dt.prompt,e),promptText:o?"":t})}async function ZW(e){const t=lc(e);t&&await Ep(r("已取消「{label}」的单独配置",{label:Bo(dt.prompt,t)}),t,null)}async function WW(e,t){const a=lc(e);if(!a)return;const o=Bo(dt.prompt,a);if(En){await ac();return}fs("prompt");try{const c=await tt().workbuddyDesktop?.savePrompt({promptGateway:{[a]:t}});Yu(c),Ve(t?r("✅ 已为「{label}」装上网关自带提示词",{label:o}):r("已关闭「{label}」的网关自带提示词:能否通过上游校验取决于上游当前口径",{label:o}),t?"ok":"err")}catch(c){Ve(r("保存失败:{message}",{message:_t(c)}),"err"),await ac()}finally{as()}}async function JW(e,t){const a=lc(e);if(!a)return!1;const o=Bo(dt.prompt,a),c=!t||!(t.identity.trim()||t.stable.trim()||t.dynamic.trim());return Tp(c?r("「{label}」的网关自带提示词已改回官方原文",{label:o}):r("「{label}」的网关自带提示词正文已更新",{label:o}),{promptGatewayText:{[a]:c?null:t}})}async function eJ(){if(!En){fs("prompt");try{const e=await tt().workbuddyDesktop?.savePrompt({clearDegrade:!0});Yu(e),Ve(r("✅ 已解除内容拦截降级"))}catch(e){Ve(r("解除失败:{message}",{message:_t(e)}),"err"),await ac()}finally{as()}}}function Ap(e){const t=Number(e);return Number.isFinite(t)?t:null}function TS(e){if(e===void 0)return;const t=e&&typeof e=="object"?e.database:null;if(!t||typeof t!="object"){Ze({storage:{...dt.storage,status:"unavailable"}});return}const a=t;Ze({storage:{status:"ready",available:a.available!==!1,file:String(a.file||""),bytes:Number(a.bytes)||0,accounts:Ap(a.accounts),logs:Ap(a.logs),requests:Ap(a.requests),dailyDays:Ap(a.dailyDays),debug:Ap(a.debug)}})}async function WI(){try{TS(await tt().workbuddyDesktop?.getStorage())}catch(e){console.warn("读取数据存储概况失败:",_t(e)),TS(null)}}async function tJ(){try{return await tt().workbuddyDesktop?.panelLogout(),window.location.href="/login",!0}catch(e){return Ve(r("退出失败:{message}",{message:_t(e)}),"err"),!1}}async function ES(){_I(),LI(),Ze({panelLogin:PI()}),await Promise.all([zI(),aW(),Px(),KI(),XI(),UI(),FI(),Bx(),bS(),vS(),wS(),NS(),ac(),WI(),ZI(),CS(),tt().wbUpdatePanel?.load?.()])}async function nJ(){await Px(),Ve(r("保留天数已刷新"))}async function sJ(){await KI(),Ve(r("重试设置已刷新"))}async function rJ(){await XI(),Ve(r("超时设置已刷新"))}async function aJ(){await UI(),Ve(r("排队等待设置已刷新"))}async function lJ(){await FI(),Ve(r("验证码令牌池设置已刷新"))}async function oJ(){await Bx(),Ve(r("路由设置已刷新"))}async function iJ(){await bS(),Ve(r("调试模式设置已刷新"))}async function cJ(){await vS(),Ve(r("指纹脱敏设置已刷新"))}async function uJ(){await NS(),Ve(r("网关跨域访问设置已刷新"))}async function dJ(){await ac(),Ve(r("系统提示词设置已刷新"))}async function fJ(){await WI(),Ve(r("存储概况已刷新"))}const Fx=[{key:"identity",label:r("第一段(身份句)"),short:r("第一段"),hint:r("官方原文只有一句:声明自己是 ZCode。")},{key:"stable",label:r("第二段(稳定段)"),short:r("第二段"),hint:r("工具用法与环境说明那一大段。")},{key:"dynamic",label:r("第三段(动态段)"),short:r("第三段"),hint:r("沟通方式 / 上下文管理 + Environment 段。")}];function pJ(e){return r(e==="inline"?"界面里编辑的正文":e==="file"?"提示词文件":e==="builtin"?"内置默认提示词":"(未生效)")}function JI({title:e,text:t,source:a,file:o,disabled:c,save:d,onClose:f}){const[p,h]=x.useState(t),[v,y]=x.useState(!1),b=v||c,j=p!==t;async function w(k){y(!0);try{await d(k)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:k=>{k||b||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("保存后以这里的文本为准")}),s.jsxs("p",{children:[r("这一份就是「替换 / 追加」模式下网关要发的 system 正文。"),a==="none"?r("当前是透传模式:存下来也不会发出,切成「替换 / 追加」之后才生效。"):r("当前生效的正文来自{source}{file}。保存后这一份会盖过提示词文件与内置默认{note}。",{source:pJ(a),file:o.trim()&&a!=="inline"?r("(文件:{path})",{path:o.trim()}):"",note:a!=="inline"&&o.trim()?r(",文件里后续的改动在清空这里之前不再生效"):""}),r("想回到原来那份,把这里清空再保存即可(不会删掉你配的文件路径)。")]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Je,{htmlFor:"settings-prompt-body",children:r("提示词正文")}),s.jsx(Zc,{id:"settings-prompt-body",rows:18,className:"min-h-[320px]",spellCheck:!1,disabled:b,value:p,onChange:k=>h(k.currentTarget.value)}),s.jsx("div",{className:"hint",children:p.trim()?r("{lines} 行、{chars} 字符(按当前草稿计)",{lines:p.split(` +`).length,chars:p.length}):r("空 = 不要这一份,回落提示词文件 / 内置默认提示词。")})]})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:b||a!=="inline",onClick:()=>{w("")},children:r("清除这里的正文")}),s.jsx(se,{variant:"outline",disabled:b,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:b||!j,onClick:()=>{w(p)},children:r(v?"保存中…":"保存")})]})]})})}function mJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-prompt-edit-body",variant:"outline",disabled:t||a,onClick:()=>c(!0),children:r("编辑正文")}),o?s.jsx(JI,{title:r("编辑提示词正文 · 全局"),text:e.text,source:e.source,file:e.file,disabled:a,save:GW,onClose:()=>c(!1)}):null]})}function hJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-edit-body-${e.id}`,variant:"outline",disabled:a||o,onClick:()=>d(!0),children:r("编辑正文")}),c?s.jsx(JI,{title:r("编辑提示词正文 · {label}",{label:t}),text:e.text,source:e.source,file:e.file,disabled:o,save:f=>QW(e,f),onClose:()=>d(!1)}):null]})}function gJ({id:e,title:t,official:a,over:o,enabled:c,disabled:d,onClose:f}){const[p,h]=x.useState(()=>({identity:o?.identity?.trim()?o.identity:a.identity,stable:o?.stable?.trim()?o.stable:a.stable,dynamic:o?.dynamic?.trim()?o.dynamic:a.dynamic})),[v,y]=x.useState(!1),b=v||d,j=Fx.some(S=>p[S.key]!==a[S.key]),w=Fx.filter(S=>o?.[S.key]?.trim()).map(S=>S.label);async function k(S){y(!0);try{await JW(e,S)&&f()}finally{y(!1)}}return s.jsx(Qt,{open:!0,onOpenChange:S=>{S||b||f()},children:s.jsxs(Zt,{className:"w-[min(880px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:t})}),s.jsxs(Bt,{children:[s.jsxs(zn,{children:[s.jsx("h3",{children:r("三段各自成块,所以分开编辑")}),s.jsxs("p",{children:[r("上游按"),s.jsx("strong",{children:r("结构")}),r("校验身份:这三段必须各自成块排在最前(实测:三段并成一段会被回 405 / 3012)。因此这里按段编辑,不能合成一段。改过的段以你的文本为准,没改的段继续用官方原文;清空某一段 = 那一段恢复官方原文。"),w.length?r("当前已改过:{edited}。",{edited:w.join(r("、"))}):r("当前三段都是官方原文。"),c?"":r("注意:这一家的「网关自带」开关现在是关的,改过的正文要等开关打开才生效。")]}),s.jsx("p",{children:$n.promptGatewayText})]}),Fx.map(S=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs(Je,{htmlFor:`settings-prompt-block-${e}-${S.key}`,children:[S.label,s.jsx("span",{className:"ml-2 font-normal text-subtle",children:p[S.key]===a[S.key]?r("(官方原文)"):r("(已改)")})]}),s.jsx(Zc,{id:`settings-prompt-block-${e}-${S.key}`,rows:S.key==="identity"?2:10,className:S.key==="identity"?"min-h-[64px]":"min-h-[200px]",spellCheck:!1,disabled:b,value:p[S.key],onChange:N=>{const T=N.currentTarget.value;h(D=>({...D,[S.key]:T}))}}),s.jsx("div",{className:"hint",children:S.hint})]},S.key))]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",className:"mr-auto",disabled:b||!w.length,onClick:()=>{k(null)},children:r("恢复官方原文")}),s.jsx(se,{variant:"outline",disabled:b,onClick:f,children:r("取消")}),s.jsx(se,{variant:"default",disabled:b||!j,onClick:()=>{k(p)},children:r(v?"保存中…":"保存")})]})]})})}function xJ({item:e,option:t,over:a,locked:o,busy:c}){const[d,f]=x.useState(!1),p=t.gatewayBlocks;return p?s.jsxs(s.Fragment,{children:[s.jsx(se,{id:`btn-prompt-gateway-text-${e.id}`,variant:"outline",disabled:o||c,onClick:()=>f(!0),children:r("编辑正文")}),d?s.jsx(gJ,{id:e.id,title:r("编辑网关自带提示词 · {label}",{label:t.label}),official:p,over:a,enabled:e.gateway,disabled:c,onClose:()=>f(!1)}):null]}):null}function bJ(e){return e?Fx.filter(t=>(e[t.key]||"").trim()).map(t=>t.short).join(r("、")):""}function eP(e,t){return tt().wbIcons?.icon?.(e,t)||""}function cn({tone:e,children:t}){const a=e==="ok"?"success":e==="bad"?"destructive":"outline";return s.jsx(ze,{variant:a,children:t})}function Qn({title:e,tip:t,badge:a,actions:o}){return s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]})}function vJ({title:e,tip:t,badge:a,actions:o,children:c}){function d(f){f.target.closest(".tip-q, .head-actions")&&f.preventDefault()}return s.jsxs("details",{className:"panel panel-fold",children:[s.jsxs("summary",{className:"panel-head",onClick:d,children:[s.jsx("span",{className:"fold-caret","aria-hidden":!0,dangerouslySetInnerHTML:{__html:eP("caretRight",14)}}),s.jsx("h2",{children:e}),t?s.jsx("span",{className:"tip-q","data-tip":t}):null,a,o?s.jsx("div",{className:"head-actions",children:o}):null]}),c]})}function da({id:e,label:t,checked:a,disabled:o,tip:c,onCheckedChange:d}){return s.jsxs("label",{className:"switch",children:[s.jsx(us,{id:e,checked:a,disabled:o,onCheckedChange:f=>d(f)}),s.jsx("span",{children:t}),c?s.jsx("span",{className:"tip-q","data-tip":c}):null]})}function Rp({field:e,value:t,disabled:a,onCommit:o}){const[c,d]=x.useState(null),f=c!==null?c:t===null?"":String(t);async function p(){const h=c;if(h!==null)try{await o(h)}finally{d(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:e.id,children:e.label}),s.jsxs("span",{className:"retention-input",children:[s.jsx(Fe,{id:e.id,type:"number",min:e.min,max:e.max,step:1,inputMode:"numeric",className:"w-[92px] max-w-[92px] text-center tabular-nums",value:f,disabled:a||t===null,onChange:h=>d(h.target.value),onFocus:()=>d(String(t??"")),onBlur:()=>{p()},onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}}),s.jsx("span",{className:"unit",children:e.unit})]}),s.jsx("div",{className:"hint",children:e.hint})]})}function Op(e){return e.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}function Br({id:e,onClick:t}){return s.jsx(se,{id:e,variant:"outline",onClick:t,children:r("刷新")})}function yJ(e){const{lanAccess:t,lanPanel:a,lanIp:o,port:c}=e.app;if(!t)return r("未开启:网关只监听 127.0.0.1,仅本机可以访问。");const d=`http://${o||r("<本机IP>")}${c?`:${c}`:""}`,f=a?r(";网页管理面板已一并开放(浏览器打开同一地址)"):"";return r("已开启:其他设备把 API 地址指向 {url}{panel}。",{url:`${d}/v1`,panel:f})}function jJ({snap:e}){const t=e.app,a=t.status==="unavailable"?Ut.appUnavailable:t.status==="loading"?Ut.appLoading:t.closeToTray?t.lightweightMode?Ut.appLightOn:Ut.appTrayOn:Ut.appTrayOff;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("启动与托盘"),tip:rs.tray,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已应用")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-close-to-tray",label:r("关闭窗口时最小化到托盘"),checked:t.closeToTray,disabled:e.busy==="app",onCheckedChange:o=>{pS("tray",o)}}),s.jsx(da,{id:"settings-lightweight",label:r("轻量模式(关窗释放界面内存)"),tip:rs.lightweight,checked:t.lightweightMode,disabled:e.busy==="app"||!t.closeToTray,onCheckedChange:o=>{pS("lightweight",o)}}),s.jsx(da,{id:"settings-autostart",label:r("开机自动启动"),checked:t.autostart,disabled:e.busy==="app",onCheckedChange:o=>{pS("autostart",o)}})]}),s.jsx("div",{className:"settings-state",children:a})]})]}),!e.panelLogin&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("局域网访问"),tip:rs.lan}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"settings-switches",children:[s.jsx(da,{id:"settings-lan-access",label:r("允许局域网内的设备访问网关"),checked:e.app.lanAccess,disabled:e.busy==="lan",onCheckedChange:lW}),s.jsx(da,{id:"settings-lan-panel",label:r("同时开放网页管理面板"),checked:e.app.lanPanel,disabled:e.busy==="lan"||!e.app.lanAccess,onCheckedChange:oW})]}),s.jsx("div",{className:"settings-state",children:yJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("计量单位"),tip:rs.units}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-chinese-units",label:r("使用中文单位(亿 / 万)"),checked:e.unitsChinese,onCheckedChange:rW})}),s.jsx("div",{className:"settings-state",children:e.unitsChinese?Ut.unitsOn:Ut.unitsOff})]})]})]})}function wJ(e){return e==="light"?Ut.themeLight:e==="dark"?Ut.themeDark:Ut.themeSystem}function SJ(){const[e,t]=x.useState(XZ),[a,o]=x.useState(QZ),c=tt().workbuddyDesktop?.platform==="web";x.useEffect(()=>{const f=h=>t(String(h.detail||"system")),p=h=>o(Number(h.detail)||100);return window.addEventListener(SI,f),window.addEventListener(NI,p),()=>{window.removeEventListener(SI,f),window.removeEventListener(NI,p)}},[]);const d=a===100?r("100%(默认)"):`${a}%`;return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("显示模式"),tip:rs.displayTheme}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{children:s.jsx(In,{"aria-label":r("显示模式"),options:YZ,value:e,onValueChange:f=>tt().wbApp?.applyTheme?.(f)})}),s.jsx("div",{className:"settings-state",children:wJ(e)})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("界面缩放"),tip:rs.displayZoom}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-zoom",children:r("缩放比例")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:String(a),onValueChange:f=>tt().wbApp?.applyZoom?.(Number(f)),children:[s.jsx(mt,{id:"settings-zoom",className:"w-[140px]",disabled:c,"aria-label":r("界面缩放比例"),children:s.jsx(pt,{children:d})}),s.jsx(ht,{children:KZ.map(f=>s.jsx(qe,{value:String(f),children:f===100?r("100%(默认)"):`${f}%`},f))})]})}),s.jsx("div",{className:"hint",children:r("放大或缩小整个界面(文字与控件一起变),效果与浏览器 Ctrl +/- 相同:共 11 档,立即生效并记住。")})]})}),s.jsx("div",{className:"settings-state",children:c?Ut.zoomWeb:a===100?Ut.zoomDefault:r("当前按 {n}% 显示。",{n:a})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("语言设置"),tip:rs.displayLanguage}),s.jsxs("div",{className:"panel-body",children:[s.jsx(NJ,{}),s.jsx("div",{className:"settings-state",children:Ut.languageHint})]})]})]})}function NJ(){const e=window.wbI18n,t=e?.rawLocale?.()??"auto",a=e?.LOCALES??[],o=c=>c==="auto"?r("跟随系统"):a.find(d=>d.code===c)?.label??c;return s.jsx("div",{className:"retention-list",children:s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-language",children:r("界面语言")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t,onValueChange:c=>{c&&e?.setLocale(c)},children:[s.jsx(mt,{id:"settings-language",className:"w-[200px]","aria-label":r("界面语言"),children:s.jsx(pt,{children:o(t)})}),s.jsxs(ht,{children:[s.jsx(qe,{value:"auto",children:r("跟随系统")}),a.map(c=>s.jsx(qe,{value:c.code,children:c.label},c.code))]})]})})]})})}function kJ({codes:e,status:t,busy:a}){const[o,c]=x.useState(""),d=x.useRef(null),f=t==="unavailable";return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-retry-no-codes-input",children:r("指定错误码直接换号")}),s.jsx("div",{className:"retention-input",children:s.jsxs("div",{className:f?"tag-input disabled":"tag-input",onClick:()=>d.current?.focus(),children:[(e||[]).map(p=>s.jsxs("span",{className:"tag-chip",children:[s.jsx("span",{className:"v",children:p}),s.jsx(se,{type:"button",variant:"ghost",size:"icon-2xs",className:"tag-x text-muted-foreground hover:bg-destructive-soft hover:text-destructive",title:r("删除 {code}",{code:p}),"aria-label":r("删除状态码 {code}",{code:p}),onClick:h=>{h.stopPropagation(),AW(p)},children:"✕"})]},p)),s.jsx(Fe,{ref:d,id:"settings-retry-no-codes-input",type:"text",className:"tag-input-field h-auto border-0 bg-transparent px-0 shadow-none focus:shadow-none",placeholder:f?"—":r("输入状态码,回车添加"),inputMode:"numeric",autoComplete:"off",value:o,disabled:f||a,onChange:p=>c(p.target.value),onKeyDown:p=>{if(p.key==="Enter"){p.preventDefault(),EW(o),c("");return}p.key==="Backspace"&&!o&&RW()}})]})}),s.jsx("div",{className:"hint",children:$n.retryCodes})]})}function CJ({prompt:e,locked:t,busy:a}){const[o,c]=x.useState(null);async function d(){const f=o;if(f!==null)try{await qW(f)}finally{c(null)}}return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-file",children:r("提示词文件")}),s.jsx("span",{className:"prompt-input",children:s.jsx(Fe,{id:"settings-prompt-file",type:"text",placeholder:r("留空 = 用内置默认提示词"),value:o!==null?o:e.file,disabled:t||a,onChange:f=>c(f.target.value),onFocus:()=>c(e.file),onBlur:()=>{d()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()}})}),s.jsx("div",{className:"hint",children:$n.promptFile})]})}function TJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.promptUnavailable;const t=tP(e.source),a=[];return e.mode==="passthrough"?a.push(r("客户端 system 原样出站(只靠指纹脱敏改写模板句)。")):a.push(r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:t,lines:e.lines?r("({n} 行)",{n:e.lines}):""})),e.fileError&&a.push(`⚠️ ${e.fileError}`),a.join("")}function tP(e){return e==="inline"?r("界面里编辑的正文"):e==="file"?r("提示词文件"):e==="builtin"?r("内置默认提示词"):""}function EJ(e){return r("已自动切换到最小中性提示词(撞了上游内容拦截,多半是 system 指纹误报),到 {until} 自动解除。",{until:e.degradeUntilText||Ut.degradeUntilFallback})+r("期间本模式自己的提示词不会发出;把提示词改好后可以立即解除。")}function AJ({item:e,label:t,locked:a,busy:o}){const[c,d]=x.useState(null);async function f(){const p=c;if(p!==null)try{p!==e.file&&await XW(e,p)}finally{d(null)}}return s.jsx("span",{className:"prompt-input",children:s.jsx(Fe,{id:`settings-prompt-file-${e.id}`,type:"text",placeholder:r("留空 = 用内置默认提示词"),"aria-label":r("{label} 提示词文件",{label:t}),value:c!==null?c:e.file,disabled:a||o,onChange:p=>d(p.target.value),onFocus:()=>d(e.file),onBlur:()=>{f()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})})}function RJ(e,t){if(!t)return r("未单独配置:模式、提示词文件与正文都跟随上面的全局配置(当前「{mode}」)。",{mode:zo.find(o=>o.value===e.mode)?.toastLabel??e.mode});if(e.mode==="passthrough")return r("客户端 system 原样出站。");const a=r("{mode}生效:上游收到的 system 来自{source}{lines}。",{mode:e.mode==="custom"?r("替换"):r("追加"),source:tP(e.source),lines:e.lines?r("({n} 行)",{n:e.lines}):""});return e.fileError?`${a} ⚠️ ${e.fileError}`:a}function OJ({item:e,option:t,over:a,locked:o,busy:c}){const d=e.gateway,f=t.gatewayChars,p=f?r("约 {n} 字符",{n:f.toLocaleString("zh-CN")}):r("一段内置装配"),h=bJ(a);return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{className:"prompt-gateway-label",children:r("网关自带")}),s.jsxs("span",{className:"prompt-input",children:[s.jsx(da,{id:`settings-prompt-gateway-${e.id}`,label:r("装上{size}的官方身份提示词",{size:p}),checked:d,disabled:o||c,onCheckedChange:v=>{WW(e.id,v)}}),s.jsx(xJ,{item:e,option:t,over:a,locked:o,busy:c})]}),s.jsxs("div",{className:d?"hint":"hint prompt-gateway-off",children:[d?t.gatewayNote:r("已关闭。{note}",{note:t.gatewayNote}),h?r(" 正文已改:{edited}(其余段用官方原文)。",{edited:h}):""]})]})}function MJ({prompt:e,locked:t,busy:a}){const o=e.options,c=new Map(e.providers.map(w=>[w.id,w])),d=[];for(const w of o)w.gatewayNote&&d.push(c.get(w.id)??{id:w.id,mode:e.mode,file:e.file,text:e.text,source:e.source,lines:e.lines,fileError:e.fileError,gateway:e.gateway[w.id]??!0,configured:!1});for(const w of e.providers)d.some(k=>k.id===w.id)||d.push({...w,gateway:e.gateway[w.id]??!0,configured:!0});const f=new Set(d.map(w=>w.id)),p=o.filter(w=>!w.gatewayNote&&!f.has(w.id)),[h,v]=x.useState(""),y=w=>o.find(k=>k.id===w)?.label||w,b=w=>o.find(k=>k.id===w),j=w=>b(w)?.gatewayNote||"";return s.jsxs(s.Fragment,{children:[d.map(w=>{const k=y(w.id),S=zo.find(D=>D.value===w.mode)?.optionLabel??w.mode,N=j(w.id),T=b(w.id);return s.jsxs(x.Fragment,{children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:`settings-prompt-mode-${w.id}`,children:k}),s.jsxs("span",{className:"prompt-input",children:[s.jsxs(ft,{value:w.mode,onValueChange:D=>{D!=null&&String(D)&&YW(w,String(D))},children:[s.jsx(mt,{id:`settings-prompt-mode-${w.id}`,className:"w-[240px]",disabled:t||a,"aria-label":r("{label} 的提示词模式",{label:k}),children:s.jsx(pt,{children:S})}),s.jsx(ht,{children:zo.map(D=>s.jsx(qe,{value:D.value,children:D.optionLabel},D.value))})]}),s.jsx(AJ,{item:w,label:k,locked:t,busy:a}),s.jsx(hJ,{item:w,label:k,locked:t,busy:a}),w.configured?s.jsx(se,{variant:"outline",disabled:t||a,onClick:()=>{ZW(w.id)},children:r("跟随默认")}):null]}),s.jsx("div",{className:"hint",children:RJ(w,w.configured)})]}),T&&N?s.jsx(OJ,{item:w,option:T,over:e.gatewayText[w.id],locked:t,busy:a}):null]},w.id)}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-provider-add",children:r("添加提供商")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:h,onValueChange:w=>{v("");const k=w==null?"":String(w);k&&KW(k)},children:[s.jsx(mt,{id:"settings-prompt-provider-add",className:"w-[240px]",disabled:t||a||p.length===0,"aria-label":r("添加要单独配置的提供商"),children:s.jsx(pt,{children:h?y(h):p.length?r("添加提供商…"):r("全部已配置")})}),s.jsx(ht,{children:p.map(w=>s.jsx(qe,{value:w.id,children:w.label},w.id))})]})}),s.jsx("div",{className:"hint",children:$n.promptProviders})]})]})}function DJ({snap:e}){const t=e.prompt,a=t.status!=="ready",o=e.busy==="prompt",c=zo.find(d=>d.value===t.mode)?.optionLabel??t.mode;return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("系统提示词"),tip:rs.prompt,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:t.mode==="passthrough"?r("透传"):r("已接管")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-prompt-refresh",onClick:()=>{dJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"prompt-group",children:[r("全局配置"),s.jsx("span",{className:"note",children:r("所有未单独配置的提供商都用这一份")})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-prompt-mode",children:r("模式")}),s.jsx("span",{className:"prompt-input",children:s.jsxs(ft,{value:t.mode,onValueChange:d=>{d!=null&&String(d)&&$W(String(d))},children:[s.jsx(mt,{id:"settings-prompt-mode",className:"w-[240px]",disabled:a||o,"aria-label":r("系统提示词模式"),children:s.jsx(pt,{children:c})}),s.jsx(ht,{children:zo.map(d=>s.jsx(qe,{value:d.value,children:d.optionLabel},d.value))})]})}),s.jsx("div",{className:"hint",children:$n.promptMode})]}),s.jsx(CJ,{prompt:t,locked:a,busy:o}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"btn-prompt-edit-body",children:r("提示词正文")}),s.jsx("span",{className:"prompt-input",children:s.jsx(mJ,{prompt:t,locked:a,busy:o})}),s.jsxs("div",{className:"hint",children:[$n.promptText,t.source==="inline"?r("(当前生效的就是这一份,{n} 行)",{n:t.lines}):t.text.trim()?r("(已存一份正文,{n} 行;切成「替换 / 追加」后生效)",{n:t.lines}):""]})]}),s.jsxs("div",{className:"prompt-group",children:[r("按提供商配置"),s.jsx("span",{className:"note",children:r("只列单独配置过的家,其余沿用上面的全局配置")})]}),s.jsx(MJ,{prompt:t,locked:a,busy:o}),t.status==="ready"&&t.degradeActive?s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("内容拦截降级")}),s.jsx("span",{className:"prompt-input",children:s.jsx(se,{id:"btn-prompt-clear-degrade",variant:"outline",disabled:o,onClick:()=>{eJ()},children:r("立即解除")})}),s.jsx("div",{className:"hint",children:EJ(t)})]}):null]}),s.jsx("div",{className:"settings-state",children:TJ(t)}),s.jsx("div",{className:"hint retention-note",children:$n.prompt})]})]})}function IJ(e){if(e.status==="loading")return Ut.appLoading;if(e.status==="unavailable")return Ut.debugUnavailable;const t=e.count!==null&&e.limit!==null?r("已保存 {count} / {limit} 条报文(超出后丢弃最旧的)。",{count:e.count,limit:e.limit}):"";return e.on?`${Ut.debugOn}${t}${r("凭据类请求头已脱敏。")}`:Ut.debugOff}function PJ({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求超时"),tip:rs.timeouts,badge:Op(e.timeouts),actions:s.jsx(Br,{id:"btn-timeouts-refresh",onClick:()=>{rJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:TI.map(t=>s.jsx(Rp,{field:t,value:e.timeouts.values?.[t.key]??null,disabled:e.busy==="timeouts",onCommit:a=>OW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.timeouts})]})]})}function _J({snap:e}){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("请求重试"),tip:rs.retry,badge:Op(e.retry),actions:s.jsx(Br,{id:"btn-retry-refresh",onClick:()=>{sJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[CI.map(t=>s.jsx(Rp,{field:t,value:e.retry.values?.[t.key]??null,disabled:e.busy==="retry",onCommit:a=>TW(t,a)},t.key)),s.jsx(kJ,{codes:e.retryCodes,status:e.retry.status,busy:e.busy==="codes"||e.busy==="retry"})]}),s.jsx("div",{className:"hint retention-note",children:$n.retry})]})]})}const LJ={routingFailoverBackoff:"failoverBackoff",routingSink:"sink",routingBreakerEnabled:"breakerEnabled"};function zJ({snap:e}){const t=e.routing,a=e.busy==="routing"||t.status!=="ready",o=Ox.find(d=>d.value===t.strategy)?.value??"order",c=Mx.find(d=>d.value===t.sticky)?.value??"auto";return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号路由"),tip:rs.routing,badge:t.status==="ready"?void 0:t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-routing-refresh",onClick:()=>{oJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsx("div",{className:"prompt-group",children:r("选路规则")}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("路由策略")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Ox.find(d=>d.value===o)?.tip}),s.jsx(In,{options:Ox.map(d=>({value:d.value,label:d.label})),value:o,disabled:a,"aria-label":r("路由策略"),onValueChange:d=>{gS({routingStrategy:String(d)})}})]})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{children:r("会话粘性")}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":Mx.find(d=>d.value===c)?.tip}),s.jsx(In,{options:Mx.map(d=>({value:d.value,label:d.label})),value:c,disabled:a,"aria-label":r("会话粘性"),onValueChange:d=>{gS({routingSticky:String(d)})}})]})]}),s.jsxs("div",{className:"prompt-group",children:[r("自愈保护"),s.jsx("span",{className:"note",children:r("默认值通常够用,出问题时才需要调")})]}),JZ.map(d=>{const f=`route-protection-${d.key}`;return s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:f,children:d.label}),s.jsxs("div",{className:"routing-row",children:[s.jsx("span",{className:"tip-q","data-tip":d.tip}),s.jsx(us,{id:f,checked:t[LJ[d.key]],disabled:a,onCheckedChange:p=>{gS({[d.key]:p})}})]})]},d.key)})]}),s.jsx("div",{className:"hint retention-note",children:$n.routing})]})]})}function BJ({snap:e}){return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("排队等待"),tip:rs.queue,badge:Op(e.queue),actions:s.jsx(Br,{id:"btn-queue-refresh",onClick:()=>{aJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:EI.map(t=>s.jsx(Rp,{field:t,value:e.queue.values?.[t.key]??null,disabled:e.busy==="queue",onCommit:a=>yW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.queue})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("验证码令牌池"),tip:rs.captchaPool,badge:Op(e.captchaPool),actions:s.jsx(Br,{id:"btn-captcha-pool-refresh",onClick:()=>{lJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:II.map(t=>s.jsx(Rp,{field:t,value:e.captchaPool.values?.[t.key]??null,disabled:e.busy==="captchaPool",onCommit:a=>jW(t,a)},t.key))}),s.jsx("div",{className:"hint retention-note",children:$n.captchaPool})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("models.dev 模型元数据"),tip:rs.modelsDev,badge:e.modelsDev.status==="ready"?s.jsx(cn,{tone:"ok",children:r("{count} 条",{count:Number(e.modelsDev.count).toLocaleString("zh-CN")})}):e.modelsDev.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-modelsdev-refresh",onClick:()=>{zW()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-modelsdev",label:r("用 models.dev 补齐上游没声明的模型能力与思考档位(联网刷新,内嵌快照始终生效)"),checked:e.modelsDev.enabled,disabled:e.modelsDev.status!=="ready"||e.busy==="modelsDev",onCheckedChange:t=>{LW(t)}}),s.jsx("div",{className:"settings-state",children:FZ(e.modelsDev)}),s.jsx("div",{className:"hint retention-note",children:$n.modelsDev})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("指纹脱敏"),tip:rs.sanitize,badge:e.sanitize.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.sanitize.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-sanitize-refresh",onClick:()=>{cJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-sanitize",label:r("剥离上游审核黑名单指纹(改写请求体里的模板句与表头)"),checked:e.sanitize.on,disabled:e.sanitize.status!=="ready"||e.busy==="sanitize",onCheckedChange:t=>{DW(t)}})}),s.jsx("div",{className:"settings-state",children:e.sanitize.status==="loading"?Ut.appLoading:e.sanitize.status==="unavailable"?Ut.sanitizeUnavailable:e.sanitize.on?Ut.sanitizeOn:Ut.sanitizeOff}),s.jsx("div",{className:"hint retention-note",children:$n.sanitize})]})]}),s.jsx(UJ,{snap:e}),s.jsx(DJ,{snap:e}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("调试模式"),tip:rs.debug,badge:e.debug.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):e.debug.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-debug-refresh",onClick:()=>{iJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-debug-mode",label:r("保存上游原始报文(请求头、请求体、响应头、响应体)"),checked:e.debug.on,disabled:e.debug.status!=="ready"||e.busy==="debug",onCheckedChange:t=>{MW(t)}})}),s.jsx("div",{className:"settings-state",children:IJ(e.debug)}),s.jsx("div",{className:"hint retention-note",children:$n.debug})]})]})]})}function nP(e){const t=Object.entries(e.defaults).map(([a,o])=>({key:a,value:a in e.overrides?e.overrides[a]:o,isDefault:!0}));for(const[a,o]of Object.entries(e.overrides))a in e.defaults||t.push({key:a,value:o,isDefault:!1});return t}function HJ(e,t){const a=Object.keys(e);return a.length!==Object.keys(t).length?!1:a.every(o=>e[o]===t[o])}function UJ({snap:e}){const t=e.clineHeaders,[a,o]=x.useState(()=>nP(t));x.useEffect(()=>{o(nP(t))},[t]);const c=e.busy==="clineHeaders",d=t.status==="ready";function f(v,y){o(b=>b.map((j,w)=>w===v?{...j,...y}:j))}function p(){const v={};for(const y of a){const b=y.key.trim();b&&(y.isDefault?y.value!==(t.defaults[b]??"")&&(v[b]=y.value):y.value!==""&&(v[b]=y.value))}return v}const h=d&&!HJ(p(),t.overrides);return s.jsx(vJ,{title:r("Cline 伪装头"),tip:rs.clineHeaders,badge:t.status==="ready"?s.jsx(cn,{tone:"ok",children:r("已生效")}):t.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cline-headers-refresh",onClick:()=>{IW()}}),children:s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[d?a.map((v,y)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fe,{className:"w-[190px] shrink-0 font-mono text-[13px]",value:v.key,readOnly:v.isDefault,disabled:c,placeholder:"X-Custom-Header",onChange:b=>f(y,{key:b.target.value})}),s.jsx(Fe,{className:"flex-1 font-mono text-[13px]",value:v.value,disabled:c,placeholder:v.isDefault?r("值(留空 = 不发送)"):r("值"),onChange:b=>f(y,{value:b.target.value})}),s.jsx(se,{variant:"ghost",disabled:c,onClick:()=>{v.isDefault?f(y,{value:t.defaults[v.key]??""}):o(b=>b.filter((j,w)=>w!==y))},children:v.isDefault?r("还原"):r("删除")})]},String(y))):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:"outline",disabled:c||!d,onClick:()=>o(v=>[...v,{key:"",value:"",isDefault:!1}]),children:r("添加自定义头")}),s.jsx("div",{className:"flex-1"}),s.jsx(se,{variant:"ghost",disabled:c||!d||Object.keys(t.overrides).length===0,onClick:()=>{QI({})},children:r("恢复默认")}),s.jsx(se,{disabled:c||!d||!h,onClick:()=>{QI(p())},children:r("保存")})]})]}),s.jsx("div",{className:"settings-state",children:t.status==="loading"?Ut.appLoading:t.status==="unavailable"?r("未能读取 Cline 伪装头设置,请稍后重试"):h?r("有未保存的修改"):r("{n} 个头将随每个 Cline 请求发送",{n:Object.keys(t.effective).length})+(Object.keys(t.overrides).length>0?r("({n} 项被覆盖)",{n:Object.keys(t.overrides).length}):r("(全部为默认值)"))}),s.jsx("div",{className:"hint retention-note",children:$n.clineHeaders})]})})}function VJ({snap:e}){const[t,a]=x.useState(!1);async function o(){a(!0),await tJ()||a(!1)}return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("网关跨域访问(CORS)"),tip:rs.cors,badge:e.cors.status==="ready"?e.cors.on?s.jsx(cn,{tone:"bad",children:r("已开启")}):s.jsx(cn,{tone:"ok",children:r("已关闭")}):e.cors.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:"idle",children:r("检测中…")}),actions:s.jsx(Br,{id:"btn-cors-refresh",onClick:()=>{uJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"settings-switches",children:s.jsx(da,{id:"settings-cors",label:r("允许浏览器里的页面跨来源调用网关(/v1/*)"),checked:e.cors.on,disabled:e.cors.status!=="ready"||e.busy==="cors",onCheckedChange:c=>{PW(c)}})}),s.jsx("div",{className:"settings-state",children:e.cors.status==="loading"?Ut.appLoading:e.cors.status==="unavailable"?Ut.corsUnavailable:e.cors.on?Ut.corsOn:Ut.corsOff}),s.jsx("div",{className:"hint retention-note",children:$n.cors})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("机器人校验")}),s.jsxs("div",{className:"panel-body",children:[s.jsx(da,{id:"settings-captcha",label:r("登录 / 注册需要通过 ALTCHA 人机验证(工作量证明)"),checked:e.captcha.enabled,disabled:!e.captcha.available||e.busy==="captcha",onCheckedChange:c=>{_W(c)}}),s.jsx("div",{className:"hint",children:$n.captcha})]})]}),e.panelLogin?s.jsxs("section",{className:"panel",id:"panel-login-section",children:[s.jsx(Qn,{title:r("面板登录")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:$n.panelLogin}),s.jsx("div",{className:"mt-2.5",children:s.jsx(se,{id:"btn-panel-logout",variant:"outline",disabled:t,onClick:()=>{o()},children:r("退出登录")})})]})]}):null]})}function Mp({label:e,value:t}){return s.jsxs("div",{className:"storage-count",children:[s.jsx("span",{className:"k",children:e}),s.jsx("span",{className:"v",children:t})]})}function FJ(e){return e.status==="loading"?s.jsx(cn,{tone:"idle",children:r("检测中…")}):e.status==="unavailable"?s.jsx(cn,{tone:"bad",children:r("不可用")}):s.jsx(cn,{tone:e.available?"ok":"bad",children:e.available?r("已生效"):r("数据库不可用")})}function $J({snap:e}){const t=e.busy,a=e.storage,o=tt().workbuddyDesktop?.platform==="web",c=a.status==="ready",d=c&&a.available,f=c&&a.file?a.file:"—",p=h=>d&&h!==null?WZ(h):"—";return s.jsxs(s.Fragment,{children:[!o&&s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("整库备份 / 恢复"),tip:rs.backup,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-db-export",variant:"outline",disabled:t==="dbExport"||t==="dbImport",onClick:()=>{pW()},children:r(t==="dbExport"?"备份中…":"备份整库")}),s.jsx(se,{id:"btn-settings-db-restore",variant:"destructive",disabled:t==="dbExport"||t==="dbImport",onClick:()=>mW(),children:r(t==="dbImport"?"恢复中…":"恢复整库")})]})}),s.jsxs("div",{className:"panel-body",children:[e.dbWarning?s.jsxs("div",{className:"danger-zone",id:"settings-db-warning",children:[s.jsx("strong",{children:r("⚠️ 密钥警告")}),s.jsx("br",{}),e.dbWarning]}):null,s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"settings-db-include-logs",children:r("包含日志与调试报文")}),s.jsx(us,{id:"settings-db-include-logs",checked:e.dbIncludeLogs,disabled:t!==null,onCheckedChange:fW}),s.jsx("div",{className:"hint",children:r("取消勾选后只备份业务数据(账号、配置与余额记录),文件显著变小;事件日志、请求统计与调试报文不会进备份文件。")})]}),s.jsx("div",{className:"danger-zone",children:s.jsx("strong",{children:$n.backupDanger})})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("账号导入 / 导出"),tip:rs.io,actions:s.jsxs(s.Fragment,{children:[s.jsx(se,{id:"btn-settings-export",variant:"outline",disabled:t==="export",onClick:()=>{uW()},children:r(t==="export"?"导出中…":"导出账号")}),s.jsx(se,{id:"btn-settings-import",variant:"default",disabled:t==="import",onClick:()=>{dW()},children:r(t==="import"?"导入中…":"导入账号")})]})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"danger-zone",children:[s.jsx("strong",{children:r("导出文件内含 accessToken / refreshToken / apiKey 等凭证与自定义提供商定义")}),r(",可直接用于登录。请妥善保管,不要外传或上传到公共位置。")]}),e.ioFailure?s.jsx("div",{className:"io-result",children:s.jsxs("span",{className:"text-destructive",children:[r("失败 {n} 个:{detail}",{n:e.ioFailure.failed,detail:e.ioFailure.detail}),e.ioFailure.more?r(" 等"):""]})}):null]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据保留"),tip:rs.retention,badge:Op(e.retention),actions:s.jsx(Br,{id:"btn-retention-refresh",onClick:()=>{nJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"retention-list",children:oS.map(h=>s.jsx(Rp,{field:h,value:e.retention.values?.[h.key]??null,disabled:e.busy==="retention",onCommit:v=>bW(h,v)},h.key))}),s.jsx("div",{className:"hint retention-note",children:$n.retention})]})]}),s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("数据存储"),tip:rs.storage,badge:FJ(a),actions:s.jsx(Br,{id:"btn-storage-refresh",onClick:()=>{fJ()}})}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"retention-list",children:[s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-path",children:r("数据库文件")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-path",title:f,children:f})}),s.jsx("div",{className:"hint",children:$n.storageFile})]}),s.jsxs("div",{className:"retention-row",children:[s.jsx("label",{htmlFor:"storage-db-size",children:r("占用大小")}),s.jsx("span",{className:"storage-line",children:s.jsx("span",{className:"storage-path",id:"storage-db-size",children:d?DI(a.bytes):"—"})}),s.jsx("div",{className:"hint",children:$n.storageSize})]})]}),s.jsxs("div",{className:"retention-list storage-counts",children:[s.jsx(Mp,{label:r("账号"),value:p(a.accounts)}),s.jsx(Mp,{label:r("事件日志"),value:p(a.logs)}),s.jsx(Mp,{label:r("请求记录"),value:p(a.requests)}),s.jsx(Mp,{label:r("报表天数"),value:p(a.dailyDays)}),s.jsx(Mp,{label:r("调试报文"),value:p(a.debug)})]}),s.jsx("div",{className:"hint retention-note",children:$n.storage})]})]})]})}const qJ=[{title:r("问题反馈"),desc:r("遇到 Bug、报错或异常行为"),cta:r("去反馈"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=bug_report.yml"},{title:r("功能建议"),desc:r("想要的新功能或改进想法"),cta:r("提建议"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=feature_request.yml"},{title:r("请求提供商 / 模型支持"),desc:r("希望接入新的提供商或模型"),cta:r("去申请"),url:"https://github.com/aimod-cc/agent2api/issues/new?template=provider_request.yml"}];function GJ(){return s.jsxs("section",{className:"panel",children:[s.jsx(Qn,{title:r("反馈与需求")}),s.jsxs("div",{className:"panel-body",children:[s.jsx("div",{className:"hint",children:r("点下面的入口会用系统默认浏览器打开 GitHub 的对应表单(需要 GitHub 账号,模板已预设好,填完直接提交即可)。")}),s.jsx("div",{className:"mt-3 flex flex-col gap-2",children:qJ.map(e=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-hairline bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12.5px] text-foreground",children:e.title}),s.jsx("div",{className:"mt-0.5 text-[12px] text-subtle",children:e.desc})]}),s.jsx(se,{variant:"outline",size:"sm",onClick:()=>{$Z(e.url)},children:e.cta})]},e.url))})]})]})}function KJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||Lx(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("确认缩短保留天数")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[e?.head,s.jsx("br",{}),s.jsx("strong",{children:r("超出的历史数据会被立即删除,且不可恢复。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>Lx(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>Lx(!0),children:r("继续并清理")})]})]})})}const AS={enable:{title:r("开启局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("为了安全,开启前需要先注册一个"),s.jsx("b",{children:r("面板管理员账号")}),r("(已注册过会跳过这一步,直接生效)。"),s.jsx("br",{}),r("开启后网关将监听所有网卡,同一局域网内的设备即可把 API 地址指向本机 IP 一起使用;管理接口从此要求管理员会话或网关 Key,转发接口在没有一把启用的 Key 时也会拒绝服务(届时会自动创建一把名为「默认」的 Key)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("继续")},disable:{title:r("关闭局域网访问"),body:()=>s.jsxs(s.Fragment,{children:[r("关闭后网关回到只监听 127.0.0.1,局域网内的设备将无法继续访问;已配置的网关 Key 与账号都不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("关闭并重启")},panel:{title:r("变更网页管理面板"),body:e=>e?s.jsxs(s.Fragment,{children:[r("开放后,局域网内其他设备的浏览器打开本机 IP 即可进入管理面板(需管理员账号登录)。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}):s.jsxs(s.Fragment,{children:[r("关闭后,管理界面不再从局域网提供,只有本机的桌面程序可以管理;已开启的 API 转发不受影响。"),s.jsx("br",{}),s.jsx("strong",{children:r("保存后应用将重启以生效。")}),r("确定继续?")]}),label:r("保存并重启")}};function YJ({confirm:e}){const t=x.useRef(null);return s.jsx(Qt,{open:e!==null,onOpenChange:a=>{a||hS(!1)},children:s.jsxs(Zt,{className:"w-[min(440px,calc(100vw-48px))]",initialFocus:t,children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("恢复整库备份")})}),s.jsx(Bt,{children:s.jsxs("div",{className:"danger-zone",children:[r("本机的全部数据(账号、网关配置、日志统计与桌面设置)将被所选备份文件"),s.jsx("strong",{children:r("整体替换")}),r(",包括恢复后需要重新登录管理面板。"),s.jsx("br",{}),s.jsx("strong",{children:r("替换前会自动把当前数据备份到配置目录的 backups/ 文件夹。")}),r("确定继续?")]})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:t,variant:"outline",onClick:()=>hS(!1),children:r("取消")}),s.jsx(se,{variant:"destructive",onClick:()=>hS(!0),children:r("选择备份文件并恢复")})]})]})})}function XJ({confirm:e,register:t}){const a=x.useRef(null),o=x.useRef(null),c=x.useRef(null),d=e!==null||t!==null,f=()=>{t!==null?BI():mS(!1)},p=()=>{cW(o.current?.value??"",c.current?.value??"")};return s.jsx(Qt,{open:d,onOpenChange:h=>{h||f()},children:s.jsx(Zt,{className:"w-[min(480px,calc(100vw-48px))]",initialFocus:a,children:t!==null?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("注册管理员账号")})}),s.jsxs(Bt,{children:[s.jsx("div",{children:r("局域网开放后,管理接口要求登录。请设置管理员账号与密码,注册完成会直接继续开启流程。")}),s.jsxs("form",{onSubmit:h=>{h.preventDefault(),t.busy||p()},children:[s.jsx(Je,{htmlFor:"lan-admin-name",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("账号")}),s.jsx(Fe,{ref:o,id:"lan-admin-name",autoComplete:"username",placeholder:r("管理员账号"),disabled:t.busy}),s.jsx(Je,{htmlFor:"lan-admin-password",className:"mt-3.5 mb-[5px] block text-[12.5px]",children:r("密码")}),s.jsx(Fe,{ref:c,id:"lan-admin-password",type:"password",autoComplete:"new-password",placeholder:r("至少 8 位"),disabled:t.busy})]}),s.jsx("div",{className:"mt-3 min-h-5 text-[13px] whitespace-pre-wrap text-destructive",children:t.error})]}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:BI,disabled:t.busy,children:r("取消")}),s.jsx(se,{onClick:p,disabled:t.busy,children:t.busy?r("正在注册…"):r("注册并开启")})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:e?AS[e.mode].title:""})}),s.jsx(Bt,{children:s.jsx("div",{children:e?AS[e.mode].body(e.panel):null})}),s.jsxs(nn,{children:[s.jsx("div",{className:"mr-auto"}),s.jsx(se,{ref:a,variant:"outline",onClick:()=>mS(!1),children:r("取消")}),s.jsx(se,{onClick:()=>mS(!0),children:e?AS[e.mode].label:r("继续")})]})]})})})}function QJ(){const e=nW(),t=x.useRef(null);x.useEffect(()=>{const o=t.current;o&&(o.scrollTop=0)},[e.scrollReset]);const a=o=>e.category===o?"settings-pane active":"settings-pane";return s.jsxs("div",{className:"settings-layout",children:[s.jsx("nav",{className:"settings-nav",id:"settings-nav",children:Ax.map(o=>s.jsxs("button",{type:"button",className:e.category===o.id?"settings-nav-item active":"settings-nav-item","data-cat":o.id,onClick:()=>sW(o.id),children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:eP(o.icon,17)}}),o.label]},o.id))}),s.jsxs("div",{className:"settings-panes",ref:t,children:[s.jsx("div",{className:a("general"),"data-cat":"general",children:s.jsx(jJ,{snap:e})}),s.jsx("div",{className:a("display"),"data-cat":"display",children:s.jsx(SJ,{})}),s.jsx("div",{className:a("gateway"),"data-cat":"gateway",children:s.jsx(BJ,{snap:e})}),s.jsx("div",{className:a("routing"),"data-cat":"routing",children:s.jsx(zJ,{snap:e})}),s.jsx("div",{className:a("retry"),"data-cat":"retry",children:s.jsx(_J,{snap:e})}),s.jsx("div",{className:a("timeout"),"data-cat":"timeout",children:s.jsx(PJ,{snap:e})}),s.jsx("div",{className:a("security"),"data-cat":"security",children:s.jsx(VJ,{snap:e})}),s.jsx("div",{className:a("data"),"data-cat":"data",children:s.jsx($J,{snap:e})}),s.jsx("div",{className:a("feedback"),"data-cat":"feedback",children:s.jsx(GJ,{})}),s.jsx("div",{className:a("about"),"data-cat":"about"})]}),s.jsx(KJ,{confirm:e.retentionConfirm}),s.jsx(YJ,{confirm:e.dbBackupConfirm}),s.jsx(XJ,{confirm:e.lanConfirm,register:e.lanRegister})]})}const sP='.page[data-page="settings"]';let RS=null;function rP(){if(RS)return;const e=document.querySelector(sP);e&&(e.replaceChildren(),RS=vn.createRoot(e),Cs.flushSync(()=>{RS?.render(s.jsx(QJ,{}))}))}_I(),document.querySelector(sP)?rP():document.addEventListener("DOMContentLoaded",rP,{once:!0}),window.wbSettingsPanel={load:ES,render:fS,renderRetention:Ix,renderRetry:CW,renderDebug:Hx,renderSanitize:Ux,renderPrompt:Yu,renderStorage:TS,showCategory:dS},tt().wbApp?.currentPage==="settings"&&ES();const aP="agent2api-col-config:",OS=[{value:"left",label:r("左")},{value:"center",label:r("中")},{value:"right",label:r("右")}],ZJ=e=>OS.some(t=>t.value===e),WJ=OS.map(e=>`ta-${e.value}`),lP="colset-dragging",oP="open";let MS=null;const iP="grid grid-cols-[18px_minmax(78px,1fr)_44px_minmax(106px,auto)] items-center gap-2";function cP(){return window}const $x=new Map;function DS(e){return e.columns.map(t=>({key:t.key,visible:t.visible!==!1,align:t.align||"left"}))}function JJ(e,t){const a=Array.isArray(t),o=!a&&t&&typeof t=="object"?t:null,c=a?t:Array.isArray(o?.items)?o.items:[],d=o?.defaults&&typeof o.defaults=="object"?o.defaults:null,f=new Map(e.columns.map(y=>[y.key,y])),p=new Map(DS(e).map(y=>[y.key,y])),h=[],v=new Set;for(const y of c){const b=y&&typeof y=="object"?y:{},j=String(b.key||"");if(!f.has(j)||v.has(j))continue;v.add(j);const w=f.get(j),k=w.align||"left",S=d?d[j]??k:w.legacyAlign??k,N=ZJ(b.align)?b.align:null;h.push({key:j,visible:b.visible!==!1,align:N&&N!==S?N:k})}for(const y of e.columns)v.has(y.key)||eee(h,e,{...p.get(y.key)});return h}function eee(e,t,a){const o=t.columns.findIndex(c=>c.key===a.key);for(let c=o-1;c>=0;c-=1){const d=e.findIndex(f=>f.key===t.columns[c].key);if(d>=0){e.splice(d+1,0,a);return}}e.unshift(a)}function tee(e){try{const t=localStorage.getItem(aP+e.id);return JJ(e,t?JSON.parse(t):[])}catch{return DS(e)}}function nee(e){try{const t={};for(const a of e.columns)t[a.key]=a.align||"left";localStorage.setItem(aP+e.id,JSON.stringify({v:2,defaults:t,items:e.config}))}catch{}}const see=e=>$x.get(e)?.config||null,ree=(e,t)=>e.columns.find(a=>a.key===t)?.label||t;function uP(e,t){const a=$x.get(e);if(!a)return t;const o=new Map(t.map(c=>[c.key,c]));return a.config.filter(c=>c.visible&&o.has(c.key)).map(c=>({...o.get(c.key),align:c.align}))}function Dp(e,{silent:t=!1}={}){nee(e),t||e.onChange?.(e.config),Pl&&Pl.id===e.id&&Pl.repaint()}let Pl=null;function qx(){if(!Pl)return;const e=Pl;Pl=null,e.destroy()}function aee(e,t){qx();const a=document.createElement("div");document.body.append(a);const o=vn.createRoot(a),c={current:null};Pl={id:e.id,spec:e,repaint:()=>c.current?.(),destroy:()=>{o.unmount(),a.remove()}},o.render(s.jsx(uee,{spec:e,anchor:t,repaintRef:c,onClose:qx}))}function lee(e,t){Pl&&Pl.id===e.id?qx():aee(e,t)}function oee(e,t,a){const o=[...e],[c]=o.splice(t,1);return o.splice(a,0,c),o}function iee(e,t,a,o){const c=document.elementFromPoint(e,t)?.closest?.("[data-col-key]");if(!c||!a||!a.contains(c))return"";const d=c.getAttribute("data-col-key")||"";return o.some(f=>f.key===d)?d:""}const cee=s.jsxs("svg",{viewBox:"0 0 24 24",width:13,height:13,fill:"currentColor","aria-hidden":"true",className:"block",children:[s.jsx("circle",{cx:"9",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"6",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"9",cy:"18",r:"1.6"}),s.jsx("circle",{cx:"15",cy:"18",r:"1.6"})]});function uee({spec:e,anchor:t,repaintRef:a,onClose:o}){const c=t,d=x.useRef(null),[f,p]=x.useState(null),h=x.useRef(null),[,v]=x.useState(0),y=x.useCallback(()=>v(S=>S+1),[]);x.useLayoutEffect(()=>(a.current=y,()=>{a.current=null}),[y,a]),x.useEffect(()=>(c.classList.add(oP),c.setAttribute("aria-expanded","true"),()=>{c.classList.remove(oP),c.setAttribute("aria-expanded","false")}),[c]),x.useEffect(()=>{const S=()=>{const N=c.getBoundingClientRect();(!c.isConnected||!N.width||N.bottom<=0||N.top>=window.innerHeight)&&o()};return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[c,o]),x.useEffect(()=>()=>{const S=h.current;S&&(S.teardown(),Dp(e))},[e]);function b(S,N){const T=e.config.find(D=>D.key===S);T&&(!N&&e.config.filter(D=>D.visible).length<=1||(T.visible=N,Dp(e)))}function j(S,N){const T=e.config.find(D=>D.key===S);!T||T.align===N||(T.align=N,Dp(e))}function w(){e.config=DS(e),Dp(e)}function k(S,N){N.preventDefault(),h.current?.teardown(),p(S),document.body.classList.add(lP);const T=d.current;function D(){window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",A),document.body.classList.remove(lP),h.current=null,p(null)}function C(R){const I=iee(R.clientX,R.clientY,T,e.config);if(!I||I===S)return;const P=e.config.findIndex(_=>_.key===S),O=e.config.findIndex(_=>_.key===I);P<0||O<0||(e.config=oee(e.config,P,O),y())}function A(){D(),Dp(e)}h.current={teardown:D},window.addEventListener("pointermove",C),window.addEventListener("pointerup",A)}return s.jsx(hf,{open:!0,modal:!1,onOpenChange:(S,N)=>{S||(N?.reason==="outside-press"&&(MS=N.event??null),o())},children:s.jsxs(gf,{anchor:c,side:"bottom",align:"end",sideOffset:6,collisionPadding:8,className:"w-[336px]","aria-label":r("{name}的列设置",{name:e.label||e.id}),children:[s.jsxs("div",{className:Ue(iP,"border-b border-hairline px-3 pt-[9px] pb-[7px]","text-[10.5px] font-semibold tracking-[.05em] text-muted-foreground"),children:[s.jsx("span",{}),s.jsx("span",{className:"text-center",children:r("列")}),s.jsx("span",{className:"text-center",children:r("显示")}),s.jsx("span",{className:"text-center",children:r("对齐")})]}),s.jsx("div",{ref:d,className:"min-h-0 flex-1 overflow-y-auto px-3 py-1",children:e.config.map(S=>{const N=ree(e,S.key),T=f===S.key;return s.jsxs("div",{"data-col-key":S.key,className:Ue(iP,"rounded-sm py-[5px] hover:bg-nav-hover",T&&"opacity-50"),children:[s.jsx("span",{className:"flex cursor-grab items-center justify-center text-muted-foreground opacity-50 hover:opacity-100",title:r("按住拖动调整列顺序"),onPointerDown:D=>k(S.key,D),children:cee}),s.jsx("span",{className:"min-w-0 truncate text-xs text-foreground",title:N,children:N}),s.jsx(us,{className:"justify-self-center",checked:S.visible,onCheckedChange:D=>b(S.key,D),"aria-label":r("显示「{label}」列",{label:N}),title:S.visible?r("这一列正在显示"):r("这一列已隐藏")}),s.jsx(In,{className:"w-full justify-center",options:OS,value:S.align,onValueChange:D=>j(S.key,D),"aria-label":r("「{label}」列的对齐",{label:N})})]},S.key)})}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 pt-2 pb-[9px]",children:[s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:r("拖动 ⋮⋮ 调整顺序")}),s.jsx(se,{variant:"outline",size:"sm",onClick:w,children:r("恢复默认")})]})]})})}function dee(e,t){e&&(e.classList.remove(...WJ),e.classList.add(`ta-${t}`))}const dP=new Map;function fee(e,t){const a=dP.get(e);if(a&&a.table===t&&a.row.isConnected)return a;const o=t?.querySelector("thead tr");if(!o)return null;const c=t?.querySelector("colgroup")??null,d={table:t,row:o,group:c,ths:new Map([...o.querySelectorAll("th[data-col]")].map(f=>[f.getAttribute("data-col")||"",f])),cols:new Map([...c?.querySelectorAll("col[data-col]")||[]].map(f=>[f.getAttribute("data-col")||"",f]))};return dP.set(e,d),d}function pee(e,t,a){const o=$x.get(e);if(!o||!t)return;const c=fee(e,t);if(!c)return;const{row:d,group:f,ths:p,cols:h}=c;for(const v of o.config){const y=p.get(v.key);if(!y)continue;const b=h.get(v.key);if(!v.visible||a?.has(v.key)){y.remove(),b?.remove();continue}dee(y,v.align),d.appendChild(y),b&&f&&f.appendChild(b)}cP().wbTableColumns?.repaint?.(e)}function mee(e){const t=document.createElement("button");return t.type="button",t.className=`sm colset-btn${e.buttonClass?` ${e.buttonClass}`:""}`,t.id=`btn-colset-${e.id}`,t.title=r("调整「{name}」的列:显示 / 隐藏、顺序、对齐",{name:e.label||e.id}),t.innerHTML=`${cP().wbIcons?.icon?.("settings",14)||""}${r("列设置")}`,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.addEventListener("click",a=>{if(MS===a){MS=null;return}lee(e,t)}),t}function hee(e){return(typeof e.mount=="function"?e.mount():e.mount?document.querySelector(e.mount):null)||null}function gee(e){const t={...e,config:tee(e)};$x.set(e.id,t);const a=hee(e),o=mee(t);return a&&(e.buttonPlacement==="last"?a.appendChild(o):a.insertBefore(o,a.firstChild)),{apply:c=>uP(e.id,c),config:()=>t.config}}window.wbColSettings={register:gee,apply:uP,configOf:see,syncStaticHead:pee,close:qx};function sl(){return window}const xee=new Set(["updateCheck"]);function fP(e){return(Array.isArray(e?.tasks)?e.tasks:[]).filter(a=>!xee.has(a.id))}const bee=2e4,pP=1,vee=" · ";function Xu(e,t){sl().wbApp?.toast?.(e,t)}function Gx(e){return e instanceof Error?e.message:String(e)}function mP(e){return r(e==="seconds"?"秒":"分钟")}function hP(e){const t=Number(e)||0;return t?new Date(t).toLocaleTimeString("zh-CN",{hour12:!1}):""}function gP(e){const t=Number(e)||0;if(!t)return"";const a=t-Date.now();if(a<=0)return r("即将执行");const o=Math.round(a/1e3);if(o<60)return r("{n} 秒后",{n:o});const c=Math.round(o/60);if(c<60)return r("{n} 分钟后",{n:c});const d=Math.round(c/60);return d<24?r("{n} 小时后",{n:d}):r("{n} 天后",{n:Math.round(d/24)})}function yee(e){const t=e.runner==="backend",a=[];if(e.lastRunAt){const o=hP(e.lastRunAt);a.push(e.lastResult?r("上次执行 {time}({result})",{time:o,result:e.lastResult}):r("上次执行 {time}",{time:o}))}else a.push(r(t?"还没有执行记录":"由页面按间隔自动刷新"));return t&&e.enabled&&e.nextRunAt&&a.push(r("下次执行 {time}({relative})",{time:hP(e.nextRunAt),relative:gP(e.nextRunAt)})),t&&e.retryAt&&e.retryAt>Date.now()&&a.push(r("冷却中,{relative}重试",{relative:gP(e.retryAt)})),a.join(vee)}function jee(e,t){const a=String(t??"").trim(),o=mP(e.unit);if(!a)return{ok:!1,message:r("间隔不能为空(可填 {min}–{max} {unit})",{min:e.min,max:e.max,unit:o})};if(!/^\d+$/.test(a))return{ok:!1,message:r("间隔必须是整数")};const c=Number(a);return ce.max?{ok:!1,message:r("间隔必须在 {min}–{max} {unit} 之间(当前填的是 {value})",{min:e.min,max:e.max,unit:o,value:a})}:{ok:!0,value:c}}function wee(e){const t=sl();e.id==="logsAutoRefresh"?t.wbLogsPanel?.applyAutoRefresh?.(e):e.id==="requestsAutoRefresh"?t.wbRequestsPanel?.applyAutoRefresh?.(e):e.id==="reportAutoRefresh"&&t.wbReport?.applyAutoRefresh?.(e)}let oc=!1,Kx=null,IS=!1;async function xP(){if(!Kx){IS=!0;return}await Kx()}function See(){const[e,t]=x.useState([]),[a,o]=x.useState(!1),[c,d]=x.useState(null),[f,p]=x.useState({});function h(I){p(P=>{if(!(I in P))return P;const O={...P};return delete O[I],O})}const v=x.useCallback(async()=>{const I=sl().workbuddyDesktop;try{if(!I)throw new Error(r("后端桥不可用"));const P=await I.getScheduledTasks();t(fP(P)),o(!0)}catch(P){console.warn("读取定时任务失败:",Gx(P)),t([]),o(!0)}},[]),y=x.useCallback(async()=>{if(oc||document.hidden||sl().wbApp?.currentPage!=="tasks")return;const I=sl().workbuddyDesktop;if(I)try{const P=await I.getScheduledTasks();t(fP(P))}catch(P){console.warn("同步定时任务状态失败:",Gx(P))}},[]);x.useEffect(()=>{const I=window.setInterval(()=>{y()},bee);return()=>{window.clearInterval(I)}},[y]),x.useEffect(()=>{sl().wbApp?.renderTopbarStatus?.()},[e,a]),x.useEffect(()=>(Kx=v,IS&&(IS=!1,v()),()=>{Kx=null}),[v]);async function b(I,P,O){if(oc)return;const _=sl().workbuddyDesktop;if(_){oc=!0;try{const L=await _.saveScheduledTask(I,P);t(H=>H.map(B=>B.id===I?L:B)),wee(L),Xu(r("✅ 已更新「{label}」",{label:O}))}catch(L){Xu(r("保存失败:{reason}",{reason:Gx(L)}),"err"),await v()}finally{oc=!1}}}async function j(I,P){const O=jee(I,P);if(!O.ok){Xu(O.message,"err"),h(I.id);return}if(O.value===I.interval){h(I.id);return}await b(I.id,{interval:O.value},r("{name}间隔",{name:r(I.label)})),h(I.id)}async function w(I){if(oc)return;const P=sl().workbuddyDesktop;if(P){oc=!0,d(I.id);try{const O=await P.runScheduledTask(I.id);if(O?.task){const _=O.task;t(L=>L.map(H=>H.id===I.id?_:H))}Xu(r("✅ {task}:{summary}",{task:r(I.label),summary:O?.summary||r("已执行")})),I.id==="credentialMaintenance"&&await sl().wbApp?.refresh?.()}catch(O){Xu(r("执行失败:{reason}",{reason:Gx(O)}),"err"),await v()}finally{oc=!1,d(null)}}}function k(I){const P=mP(I.unit),O=c===I.id;return s.jsxs("div",{className:"task-item","data-task":I.id,children:[s.jsxs("div",{className:"task-main",children:[s.jsxs("div",{className:"task-title",children:[s.jsxs("label",{className:"switch",children:[s.jsx(us,{checked:I.enabled===!0,onCheckedChange:_=>{b(I.id,{enabled:_},r("{name}开关",{name:r(I.label)}))}}),s.jsx("span",{className:"task-name",children:r(I.label)})]}),s.jsx("span",{className:"tip-q","data-tip":r(I.description)}),s.jsx(ze,{className:"task-badge",variant:I.enabled?"success":"outline",children:I.enabled?r("已开启"):r("已关闭")}),I.running?s.jsx(ze,{className:"task-badge",variant:"warning",children:r("执行中…")}):null]}),s.jsx("div",{className:"task-state",children:yee(I)})]}),s.jsxs("div",{className:"task-actions",children:[s.jsxs("span",{className:"task-interval",children:[s.jsx("span",{className:"task-interval-label",children:r("每")}),s.jsx(Fe,{type:"number",inputMode:"numeric",min:I.min,max:I.max,step:1,className:"w-[74px] max-w-[74px] text-center tabular-nums",value:f[I.id]??String(I.interval),title:r("可填 {min}–{max} {unit}(默认 {def} {unit})",{min:I.min,max:I.max,unit:P,def:I.defaultInterval}),onChange:_=>{const L=_.currentTarget.value;p(H=>({...H,[I.id]:L}))},onBlur:_=>{j(I,_.currentTarget.value)},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()}}),s.jsx("span",{className:"task-interval-unit",children:P})]}),I.canRun===!0?s.jsx(se,{size:"sm",variant:"outline",disabled:O||I.running===!0,onClick:()=>{w(I)},children:r(O?"执行中…":"立即执行")}):null]})]},I.id)}const S=e.length===0,N=e.filter(I=>I.enabled).length,T=S?a?r("不可用"):"—":r("{enabled} / {total} 个已开启",{enabled:N,total:e.length}),D=S?a?"destructive":"outline":N?"success":"outline",C=D==="destructive"?"bad":D==="success"?"ok":"",A=e.map(I=>k(I)),R=A.slice(pP);return s.jsxs("section",{className:"panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("任务清单")}),s.jsx(ze,{id:"tasks-badge",variant:D,"data-tone":C,children:T}),s.jsx("span",{className:"panel-sub",children:r("状态每 20 秒自动同步")}),s.jsx("div",{className:"head-actions",children:s.jsx(se,{variant:"outline",onClick:()=>{v().then(()=>Xu(r("定时任务已刷新")))},children:r("刷新")})})]}),s.jsx("div",{className:"panel-body",children:s.jsx("div",{className:"task-list",children:S?s.jsx("div",{className:"log-empty",children:r(a?"没有可显示的定时任务。后端未返回任务清单,请确认网关正在运行。":"正在加载定时任务…")}):s.jsxs(s.Fragment,{children:[A.slice(0,pP),R.length?s.jsx("div",{className:"task-grid",children:R}):null]})})}),s.jsxs("div",{className:"panel-foot",children:[s.jsxs("span",{children:[r("任务配置保存在 "),s.jsx("code",{children:"~/.agent2api/config.json"}),r(" 的 "),s.jsx("code",{children:"scheduledTasks"}),r(" 字段")]}),s.jsx("span",{children:r("改动立即生效,不需要重启程序")})]})]})}const bP='.page[data-page="tasks"]';let vP=!1;function yP(){if(vP)return;const e=document.querySelector(bP);e&&(vP=!0,e.replaceChildren(),vn.createRoot(e).render(s.jsx(See,{})))}document.querySelector(bP)?yP():document.addEventListener("DOMContentLoaded",yP,{once:!0}),window.wbTasksPanel={load:xP},sl().wbApp?.currentPage==="tasks"&&xP();const jP="workbuddy-desktop-update-skip";function Nee(){try{return localStorage.getItem(jP)||""}catch{return""}}function kee(e){try{localStorage.setItem(jP,e)}catch{}}let wP="";function Yx(e,t){if(!e||e.hasUpdate!==!0||e.pendingRestart===!0)return;const a=String(e.latestVersion||"").trim();a&&Pn().wbApp?.currentPage!=="settings"&&(a===Nee()||a===wP||(wP=a,SP(),Qu=document.createElement("div"),document.body.append(Qu),Ip=vn.createRoot(Qu),Ip.render(s.jsx(Cee,{info:e,onGoUpdate:t,onClose:SP}))))}function Cee({info:e,onGoUpdate:t,onClose:a}){const o=String(e.latestVersion||""),c=String(e.notes||"").trim(),d=c?X2(c):"";function f(){kee(o),a()}function p(){a();const h=Pn();h.wbApp?.showPage?.("settings"),h.wbSettingsPanel?.showCategory?.("about"),t(e)}return s.jsx(Qt,{open:!0,onOpenChange:h=>{h||a()},children:s.jsxs(Zt,{children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("检测到更新")})}),s.jsxs(Bt,{children:[s.jsxs("p",{className:"text-[12.5px] leading-[1.6] text-subtle",children:[r("新版本 "),s.jsx("strong",{className:"text-foreground",children:o}),r(" 已发布(当前 {current}),更新日志如下:",{current:e.currentVersion||r("未知")})]}),s.jsx("div",{className:"max-h-[46vh] overflow-y-auto overscroll-contain pr-1.5",onClick:Q2,children:d?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:d}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})})})]}),s.jsxs(nn,{children:[s.jsx(se,{variant:"outline",size:"sm",onClick:f,children:r("跳过此次更新")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:a,children:r("取消")}),s.jsx(se,{variant:"default",onClick:p,children:r("去更新")})]})]})})}let Ip=null,Qu=null;function SP(){Ip&&(Ip.unmount(),Ip=null),Qu&&(Qu.remove(),Qu=null)}const NP="updateCheck",Zu=1,Xx=1440,Tee="https://github.com/settings/tokens/new?description="+encodeURIComponent("Agent2API 更新检查");function Eee(e){return e?e.error?{badge:s.jsx(ze,{shape:"tag",variant:"destructive",title:e.error,children:r("无法解密")}),hint:r("重新粘贴保存一次即可自愈")}:e.filled&&e.origin==="stored"?{badge:s.jsx(ze,{shape:"tag",variant:"success",children:r("已填写")}),hint:r("已加密存储在本地,不显示具体值;粘贴新令牌可覆盖")}:e.filled?{badge:s.jsx(ze,{shape:"tag",variant:"secondary",children:r("环境变量")}),hint:r("已配置 GITHUB_TOKEN 环境变量,界面保存的令牌优先于它")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("未填写")}),hint:r("填写后检查限额 60 → 5000 次/小时(创建令牌无需勾选任何权限)")}:{badge:s.jsx(ze,{shape:"tag",variant:"outline",children:r("读取中")}),hint:""}}function Aee({open:e,onClose:t}){const[a,o]=x.useState(Z2),[c,d]=x.useState(null),[f,p]=x.useState(""),[h,v]=x.useState(!1),[y,b]=x.useState(null),[j,w]=x.useState(""),[k,S]=x.useState(!1),N=W2(a);x.useEffect(()=>{e&&(p(""),GY().then(o),(async()=>{try{d(await Pn().workbuddyDesktop?.getUpdateToken()??null)}catch{}})(),(async()=>{try{const L=((await Pn().workbuddyDesktop?.getScheduledTasks?.())?.tasks??[]).find(z=>z.id===NP),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));b({enabled:H,interval:B}),w(String(B))}catch{}})())},[e]);async function T(_){if(!k){S(!0);try{const L=await Pn().workbuddyDesktop?.saveScheduledTask?.(NP,_),H=L?.enabled===!0,B=Math.max(Zu,Math.round(Number(L?.interval)||0));b({enabled:H,interval:B}),w(String(B)),nr(r("✅ 自动检查更新已保存"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{S(!1)}}}async function D(){const _=Math.round(Number(j));if(!Number.isFinite(_)||_Xx){nr(r("检查间隔必须是 {min} ~ {max} 分钟",{min:Zu,max:Xx}),"err");return}y&&_===y.interval||await T({interval:_})}async function C(_){const L=await KY(_);L&&o(H=>({...H,proxyChoice:L.choice}))}async function A(){const _=f.trim();if(!_){nr(r("请先粘贴 GitHub 令牌"),"err");return}v(!0);try{const L=await Pn().workbuddyDesktop?.setUpdateToken({token:_});d(L??null),p(""),L?.saved===!1?nr(r("令牌已生效,但写入磁盘失败(重启后会丢失)"),"err"):nr(r("✅ GitHub 令牌已保存(加密存储,界面不再显示)"))}catch(L){nr(r("保存失败:{error}",{error:zr(L)}),"err")}finally{v(!1)}}async function R(){v(!0);try{const _=await Pn().workbuddyDesktop?.setUpdateToken({token:null});d(_??null),nr(r("✅ 已清除界面保存的 GitHub 令牌(环境变量若配置过则继续生效)"))}catch(_){nr(r("清除失败:{error}",{error:zr(_)}),"err")}finally{v(!1)}}const I=Eee(c),P=!!c?.error||c?.origin==="stored",O=c?.filled&&c?.origin!=="env"?r("已填写(粘贴新令牌可覆盖)"):r("粘贴 GitHub 令牌(ghp_… / github_pat_…)");return s.jsx(Qt,{open:e,onOpenChange:_=>{_||t()},children:s.jsxs(Zt,{className:"w-[min(460px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("更新设置")})}),s.jsxs(Bt,{className:"gap-3.5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("自动检查更新")}),s.jsx(us,{checked:y?.enabled===!0,disabled:k||!y,onCheckedChange:_=>{T({enabled:_===!0})},"aria-label":r("自动检查更新")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsx(Fe,{type:"number",min:Zu,max:Xx,step:1,className:"w-[110px]",disabled:k||!y||y.enabled!==!0,value:j,onChange:_=>w(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),D())},"aria-label":r("检查间隔(分钟)")}),s.jsx("span",{className:"text-[12px] text-subtle",children:r("分钟({min} ~ {max})",{min:Zu,max:Xx})}),s.jsx(se,{variant:"outline",size:"sm",disabled:k||!y||Math.round(Number(j))===y.interval,onClick:()=>{D()},children:r("保存")})]}),s.jsx("div",{className:"mt-1.5 text-[12px] text-subtle",children:r("到点自动向 GitHub 查询新版本,查到就走「检测到更新」弹窗;关闭后「检查更新」按钮仍可手动触发")})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("出网代理")}),s.jsx("div",{className:"mt-1.5",children:s.jsxs(ft,{value:N.current,onValueChange:_=>{C(String(_))},children:[s.jsx(mt,{className:Ue("w-full",N.broken&&"border-destructive-bd"),title:N.title,"aria-label":r("更新出网代理"),children:s.jsx(pt,{className:"min-w-0 truncate",children:N.selected?.label||r("直连")})}),s.jsx(ht,{children:N.items.map(_=>s.jsx(qe,{value:_.value,disabled:_.disabled,children:_.label},_.value))})]})})]}),s.jsx("div",{className:"h-px bg-hairline"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:r("GitHub 令牌")}),s.jsx(se,{variant:"outline",size:"xs",title:r("在默认浏览器中打开 GitHub 的令牌创建页(备注已预设,无需勾选任何权限,直接点 Generate token)"),onClick:()=>{Y2(Tee)},children:r("打开 GitHub 令牌页面")})]}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[I.badge,s.jsx("span",{className:"text-[12px] text-subtle",children:I.hint})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[s.jsx(Fe,{type:"password",className:"flex-1",placeholder:O,autoComplete:"new-password",spellCheck:!1,value:f,onChange:_=>p(_.currentTarget.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),A())}}),s.jsx(se,{variant:"default",size:"sm",disabled:h||!f.trim(),onClick:()=>{A()},children:r("保存")}),P?s.jsx(se,{variant:"outline",size:"sm",disabled:h,onClick:()=>{R()},children:r("清除")}):null]})]})]})]})})}function Ree({open:e,onClose:t}){return s.jsx(Qt,{open:e,onOpenChange:a=>{a||t()},children:s.jsxs(Zt,{className:"w-[min(320px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("加入 QQ 群")})}),s.jsxs(Bt,{className:"items-center gap-3 text-center",children:[s.jsx("img",{className:"qq-qr",src:qY,alt:r("QQ 群二维码")}),s.jsxs("div",{className:"qq-no",children:[s.jsx("span",{className:"k",children:r("群号")}),s.jsx("code",{children:Jg}),s.jsx(se,{type:"button",size:"sm",variant:"ghost","data-copy":Jg,children:r("复制")})]}),s.jsx("p",{className:"qq-hint",children:r("用手机 QQ 扫上面的二维码,或在 QQ 里搜索群号加入。")})]})]})})}const Oee=1e3,kP=8,Mee=10,Dee=1e3,Iee={"":"outline",ok:"success",warn:"warning",bad:"destructive"},Pee={info:null,checkedAt:0,repository:"",badgeText:r("未检查"),badgeTone:"",stateText:r("点击「检查更新」查询最新发布版本。"),stateError:!1,percent:0,phase:"idle",readyPath:"",checking:!1,actionBusy:!1,restartSeconds:0};function _l(e){return String(e).padStart(2,"0")}function _ee(e){const t=new Date(String(e??""));return!e||Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${_l(t.getMonth()+1)}-${_l(t.getDate())} ${_l(t.getHours())}:${_l(t.getMinutes())}`}function CP(e){const t=new Date(e);if(!e||Number.isNaN(t.getTime()))return"";const a=new Date,o=t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate(),c=`${_l(t.getHours())}:${_l(t.getMinutes())}:${_l(t.getSeconds())}`;return o?c:`${_l(t.getMonth()+1)}-${_l(t.getDate())} ${c}`}function Qx(e){return e?.installerKind?e.installerKind==="dmg":/Mac|iPhone|iPad/.test(navigator.userAgent||"")}function Da(e){return e?.selfUpdate===!0}function TP(e){return e?Da(e)?e.serverAsset??null:e.asset??null:null}function Lee(e){return Da(e)?r("正在下载服务端更新包…(下载完成后由面板完成替换,重启容器内的服务后生效)"):Qx(e)?r("正在下载安装包…(下载完成后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装)"):r("正在下载安装包…(下载完成后启动安装程序需要管理员权限,会弹出 UAC 确认框)")}function EP(e,t){return Da(e)?r("更新包已就绪:{name}。点「安装并重启」后,面板会校验并替换容器内的程序与界面文件,然后重启服务(页面会自动刷新)。",{name:t}):Qx(e)?r("安装包已就绪:{name}。点击「打开安装包」后会挂载磁盘映像,把应用拖进「应用程序」即可完成安装。",{name:t}):r("安装包已就绪:{name}。点击「安装并重启」后需要管理员权限,会弹出 UAC 确认框。",{name:t})}function zee(e){return Da(e)?r("安装并重启"):Qx(e)?r("打开安装包"):r("安装并重启")}let fa=Pee;const PS=new Set;function _S(){return fa}function Bee(e){return PS.add(e),()=>{PS.delete(e)}}function Bn(e){fa={...fa,...e};for(const t of PS)t()}let Nr=!1,LS=null,Zx=null;function Wu(){Zx!==null&&(window.clearInterval(Zx),Zx=null)}function Es(e,t=""){Bn({badgeText:e,badgeTone:t})}function An(e,t=!1){Bn({stateText:e,stateError:t})}function Wx(){const{info:e,checkedAt:t}=fa;if(!e)return;const a=t?r("(检查于 {time})",{time:CP(t)}):"";if(e.pendingRestart===!0){Es(r("待重启"),"warn"),An(r("更新已应用到容器内,重启服务后生效。{at}",{at:a}));return}if(e.hasUpdate===!0){if(Es(r("有新版本"),"warn"),Da(e)&&!e.serverAsset){An(r("发现新版本 {latest}(当前 {current}),但该版本没有提供容器内更新包;请在宿主机执行 docker compose pull && docker compose up -d 升级。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}));return}An(r("发现新版本 {latest}(当前 {current})。{at}",{latest:String(e.latestVersion||""),current:String(e.currentVersion||""),at:a}))}else e.hasUpdate===!1?(Es(r("已是最新"),"ok"),An(r("当前已是最新版本({current})。{at}",{current:String(e.currentVersion||""),at:a}))):(Es(r("无法比较"),"warn"),An(e.latestVersion?r("最新发布版本为 {latest},但当前版本号「{current}」无法解析,未做新旧判断。{at}",{latest:e.latestVersion,current:e.currentVersion||r("未知"),at:a}):r("仓库暂无发布版本。{at}",{at:a})))}function AP(e){!e||e.checked===!1||(Bn({info:e,checkedAt:Number(e.checkedAt)||0}),e.repository&&zS(e.repository),fa.phase==="idle"&&Wx())}function zS(e){const t=String(e||"").trim();/^[\w.-]+\/[\w.-]+$/.test(t)&&Bn({repository:t})}function BS(e){if(!e)return!1;if(e.active){const t=Math.max(0,Math.min(100,Number(e.percent)||0)),a=(Number(e.received)||0)/1024/1024,o=(Number(e.total)||0)/1024/1024;return Bn({phase:"downloading",percent:t}),Es(r("下载中"),"warn"),An(r("正在下载 {name}:{percent}%({received} / {total} MB)",{name:e.filename||r("安装包"),percent:t,received:a.toFixed(1),total:o.toFixed(1)})),!0}if(Wu(),Bn({percent:0}),e.error)return Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:e.error}),!0),Bn({phase:"failed"}),!0;if(e.canceled)return Es(r("已取消"),"warn"),An(Da(fa.info)?r("下载已取消,可重新点击「下载并更新」。"):r("下载已取消,可重新点击「下载并安装」。")),Bn({phase:"idle"}),!0;if(e.done&&e.path){const t=e.path,a=e.filename||t;return Es(r("可安装"),"ok"),Bn({phase:"ready",readyPath:t}),Da(fa.info)?(An(EP(fa.info,a)),!0):(t!==LS?(LS=t,An(Qx(fa.info)?r("安装包已下载完成,正在挂载磁盘映像…"):r("安装包已下载完成,正在启动安装程序(需要管理员权限,会弹出 UAC 确认框)…")),OP(t)):An(EP(fa.info,a)),!0)}return!1}async function Hee(){try{const e=await Pn().workbuddyDesktop?.updateProgress();if(!e){Wu();return}BS(e)}catch(e){Wu(),An(r("读取下载进度失败:{error}",{error:zr(e)}),!0)}}function RP(){Wu(),Zx=window.setInterval(()=>{Hee()},Oee)}async function OP(e){const t=Pn().workbuddyDesktop;if(t)try{const o=(await t.runInstaller(e,!0))?.restart!==!1;An(r(o?"安装程序已启动,本程序将退出以便完成覆盖安装。安装程序需要管理员权限,会弹出 UAC 确认框,请选择「是」。":"安装包已挂载,请在弹出的窗口里把应用拖进「应用程序」完成安装。安装完成后重新打开本程序即可。"))}catch(a){Es(r("启动失败"),"bad"),An(r("启动安装程序失败:{error}",{error:zr(a)}),!0)}}async function Uee(){const e=Pn().workbuddyDesktop;if(e?.installUpdate)try{Es(r("安装中"),"warn"),An(r("正在校验并替换容器内的程序与界面文件…"));const t=await e.installUpdate(),a=String(t?.version||"").trim();An(a?r("已替换为 {version},正在重启服务…",{version:a}):r("替换完成,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS(a)}catch(t){Es(r("安装失败"),"bad"),An(r("安装失败:{error}",{error:zr(t)}),!0)}}async function Vee(){const e=Pn().workbuddyDesktop;if(!(!e?.rollbackUpdate||Nr)){Nr=!0,Bn({actionBusy:!0});try{Es(r("回滚中"),"warn"),An(r("正在回滚到上一版本…")),await e.rollbackUpdate(),An(r("已还原上一版本,正在重启服务…")),await e.restartService?.().catch(()=>{}),HS("")}catch(t){Es(r("回滚失败"),"bad"),An(r("回滚失败:{error}",{error:zr(t)}),!0)}finally{Nr=!1,Bn({actionBusy:!1})}}}function HS(e){Wu(),Bn({phase:"restarting",restartSeconds:kP,readyPath:""}),Es(r("重启中"),"warn");let t=kP;const a=()=>{if(An(e?r("{version} 已就位,服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{version:e,seconds:Math.max(0,t)}):r("服务正在重启,页面会在恢复后自动刷新…({seconds}s)",{seconds:Math.max(0,t)})),t<=0){window.clearInterval(o),Fee();return}t-=1,Bn({restartSeconds:t})},o=window.setInterval(a,1e3);a()}async function Fee(){for(let e=0;e{window.setTimeout(t,Dee)})}window.location.reload()}async function MP(){if(Nr)return null;Nr=!0,Bn({checking:!0}),Es(r("检查中"),"warn"),An(r("正在查询 GitHub 上的最新发布版本…"));let e=null;try{const t=Pn().workbuddyDesktop;if(!t)throw new Error(r("后端桥不可用"));e=await t.checkUpdate()??null,Bn({info:e,checkedAt:Number(e?.checkedAt)||Date.now()}),e?.repository&&zS(e.repository),Wx()}catch(t){e=null,Bn({info:null,checkedAt:0}),Es(r("检查失败"),"bad"),An(r("检查更新失败:{error}",{error:zr(t)}),!0)}finally{Nr=!1,Bn({checking:!1})}return Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Pp),e}async function DP(){let e=null;try{e=await Pn().workbuddyDesktop?.getUpdateStatus()??null}catch{}if(e&&e.checked!==!1){AP(e),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Pp);return}fa.info||(Es(r("未检查")),An(r("点击「检查更新」查询 GitHub 上的最新发布版本。")))}async function US(){if(Nr)return;const e=_S();if(e.info?.pendingRestart===!0&&e.phase!=="downloading"){Nr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.restartService?.().catch(()=>{}),HS("")}finally{Nr=!1,Bn({actionBusy:!1})}return}if(e.phase!=="downloading"&&e.readyPath){Nr=!0,Bn({actionBusy:!0});try{Da(e.info)?await Uee():await OP(e.readyPath)}finally{Nr=!1,Bn({actionBusy:!1})}return}if(e.phase==="downloading"){try{await Pn().workbuddyDesktop?.cancelUpdate(),An(r("正在取消下载…"))}catch(a){nr(r("取消失败:{error}",{error:zr(a)}),"err")}return}const t=TP(e.info);if(!t?.url){nr(Da(e.info)?r("这一版没有提供容器内更新包"):r("没有可下载的安装包"),"err");return}if(PP(e)){Nr=!0,Bn({actionBusy:!0});try{await Pn().workbuddyDesktop?.downloadUpdate({url:t.url,name:t.name}),LS=null,Bn({phase:"downloading",readyPath:"",percent:0}),Es(r("下载中"),"warn"),An(Lee(e.info)),RP()}catch(a){Es(r("下载失败"),"bad"),An(r("下载失败:{error}",{error:zr(a)}),!0)}finally{Nr=!1,Bn({actionBusy:!1})}}}async function IP(){Wx(),await DP();try{const e=await Pn().workbuddyDesktop?.updateProgress();if(e?.active){BS(e),RP();return}if(e?.done&&e.path){BS(e);return}}catch{}}async function Pp(e){if(e?.pendingRestart===!0){await US();return}e?.hasUpdate===!0&&(Bn({info:e,checkedAt:Number(e.checkedAt)||fa.checkedAt}),e.repository&&zS(e.repository),Wx(),Pn().wbApp?.updateUpdateBadge?.(e),Yx(e,Pp)),await IP();const t=_S();if(!(t.phase==="downloading"||t.readyPath)&&t.info?.hasUpdate)for(let a=0;a<3;a+=1){if(Nr){await new Promise(o=>{window.setTimeout(o,400)});continue}await US();return}}function PP(e){return e.phase==="restarting"?null:e.info?.pendingRestart===!0&&e.phase==="idle"?{label:r("立即重启"),disabled:e.actionBusy}:!(e.info?.hasUpdate===!0&&!!TP(e.info)?.url)&&e.phase!=="downloading"&&e.phase!=="ready"?null:{label:e.phase==="downloading"?r("取消下载"):e.phase==="failed"?r("重试下载"):e.phase==="ready"?zee(e.info):Da(e.info)?r("下载并更新"):r("下载并安装"),disabled:e.actionBusy}}function $ee(e,t){const a=e.info,o=String(a?.notes||"").trim();if(!o)return s.jsx("div",{className:"update-log-hint",children:r(a?"这个版本没有填写发布说明。":"点击「检查更新」后,这里会显示最新版本的更新说明。")});const c=X2(o),d=K2(a?.pageUrl),f=_ee(a?.publishedAt);return s.jsxs("div",{className:"rel-note",children:[s.jsxs("div",{className:"rel-note-head",children:[s.jsx("span",{className:"rel-tag",children:String(a?.latestVersion||r("最新版本"))}),a?.prerelease===!0?s.jsx(ze,{shape:"tag",variant:"warning",children:r("预发布")}):null,f?s.jsx("span",{className:"rel-date",children:f}):null]}),s.jsxs("div",{className:"rel-note-body",children:[c?s.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:c}}):s.jsx("div",{className:"md-body",children:s.jsx("p",{className:"md-body-empty",children:r("这个版本没有填写发布说明。")})}),s.jsxs("div",{className:"rel-foot",children:[d?s.jsx("a",{href:d,"data-external":d,target:"_blank",rel:"noopener",children:r("在 GitHub 查看完整说明")}):null,s.jsx(se,{type:"button",variant:"link",size:"sm",className:"h-auto border-0 px-0 text-[11.5px] font-semibold text-primary-fg underline-offset-auto",title:r("群号:{group}",{group:Jg}),onClick:t,children:r("加入 QQ 群")})]})]})]})}function qee(){const e=x.useSyncExternalStore(Bee,_S),t=PP(e),[a,o]=x.useState(!1),[c,d]=x.useState(!1);x.useEffect(()=>()=>{Wu()},[]);const f=e.repository?`https://github.com/${e.repository}`:"",p=e.repository?`https://github.com/${e.repository.split("/")[0]}`:"",h=Da(e.info),v=h&&e.info?.backupAvailable===!0&&e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="restarting",y=e.info?.latestVersion?e.info.prerelease?r("{version}(预发布)",{version:e.info.latestVersion}):e.info.latestVersion:"—",b=String(e.info?.latestVersion||"").trim(),j=b?`${b}${e.checkedAt?r(" · 检查于 {time}",{time:CP(e.checkedAt)}):""}`:"";return s.jsxs("section",{className:"panel",onClick:Q2,children:[s.jsxs("div",{className:"panel-head",children:[s.jsx("h2",{children:r("软件更新")}),s.jsx("span",{className:"tip-q","data-tip":r(h?"容器内更新:更新包从 GitHub 发布页下载,校验 sha256 后由面板替换容器内的程序与界面文件,再重启服务(容器由 restart 策略拉起,页面会自动刷新)。更新的是容器里的文件,compose 里的镜像标签不变 —— 之后执行 docker compose pull && up -d 会回到镜像里的版本;更新失败可一键回滚到上一版本。检查更新与下载的出网线路、GitHub 令牌都在「更新设置」里。":"更新包从 GitHub 发布页下载,下载完成后可直接启动安装程序并自动重启本程序。安装包会先校验来源域名与文件完整性。检查更新与下载安装包的出网线路、GitHub 令牌都在「更新设置」里:线路默认直连(直连失败时自动借 Clash Verge 的混合端口重试一次),选定指定出口后只走该出口;填写 GitHub 令牌可把检查限额从 60 次/小时提高到 5000 次/小时。")}),s.jsx(ze,{id:"update-badge",variant:Iee[e.badgeTone],"data-tone":e.badgeTone,children:e.badgeText}),s.jsxs("div",{className:"head-actions",children:[s.jsx(se,{id:"btn-update-settings",variant:"outline",title:r("出网线路与 GitHub 令牌设置"),onClick:()=>o(!0),children:r("更新设置")}),s.jsx(se,{id:"btn-update-check",variant:"outline",disabled:e.checking||e.phase==="restarting",onClick:()=>{MP()},children:e.checking?r("检查中…"):r("检查更新")}),v?s.jsx(se,{id:"btn-update-rollback",variant:"outline",disabled:e.actionBusy,title:r("把容器内的程序与界面文件还原到更新前的版本,并重启服务"),onClick:()=>{Vee()},children:r("回滚到上一版本")}):null,t?s.jsx(se,{id:"btn-update-download",variant:"default",disabled:t.disabled,onClick:()=>{US()},children:t.label}):null]})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"update-version",children:[s.jsxs("span",{className:"version-pill",children:[s.jsx("span",{className:"k",children:r("当前版本")}),s.jsx("span",{className:"v",id:"update-current",children:e.info?.currentVersion||"—"})]}),s.jsx("span",{className:"version-arrow",children:"→"}),s.jsxs("span",{className:"version-pill new",children:[s.jsx("span",{className:"k",children:r("最新版本")}),s.jsx("span",{className:"v",id:"update-latest",children:y})]})]}),s.jsx("div",{className:"detail",id:"update-state",style:e.stateError?{color:"var(--danger)"}:void 0,children:e.stateText}),e.phase==="downloading"&&e.percent>0&&e.percent<100?s.jsx(tf,{value:e.percent}):null,p&&f?s.jsxs("div",{className:"update-author",id:"update-author",children:[s.jsxs("div",{className:"update-author-text",children:[s.jsx("strong",{children:r("关于作者")}),s.jsxs("span",{children:[r("本工具由")," ",s.jsx("a",{id:"update-author-link",href:p,"data-external":p,target:"_blank",rel:"noopener",children:e.repository.split("/")[0]})," ",r("个人开发并开源维护,免费使用、不带广告,也不会收集你的账号数据。如果它帮到了你,欢迎到项目仓库点个 Star 支持一下。")]})]}),s.jsx("div",{className:"update-author-actions",children:s.jsx(se,{id:"btn-update-favorite",type:"button",size:"sm",variant:"outline","data-external":f,title:r("在浏览器中打开项目仓库,点 Star 支持作者"),children:r("收藏项目")})})]}):null,s.jsxs("div",{className:"update-log",id:"update-notes",children:[s.jsxs("div",{className:"update-log-head",children:[s.jsx("span",{className:"update-log-title",children:r("更新日志")}),s.jsx("span",{className:"update-log-meta",id:"update-log-meta",children:j})]}),s.jsx("div",{className:"update-log-body",id:"update-log-body",children:$ee(e,()=>d(!0))})]})]}),a?s.jsx(Aee,{open:!0,onClose:()=>o(!1)}):null,c?s.jsx(Ree,{open:!0,onClose:()=>d(!1)}):null]})}const _P='.settings-pane[data-cat="about"]';let VS=null;function LP(){if(VS)return;const e=document.querySelector(_P);e&&(e.replaceChildren(),VS=vn.createRoot(e),VS.render(s.jsx(qee,{})))}document.querySelector(_P)?LP():document.addEventListener("DOMContentLoaded",LP,{once:!0}),window.wbUpdatePanel={load:IP,check:MP,syncFromCache:DP,openAndDownload:Pp,applyStatus:AP,showUpdateModal:e=>Yx(e,Pp)};const Gee="zcode.z.ai/billing",Kee={active:"success",pending:"warning",expired:"ghost",unknown:"outline"};function Yee(e){const t=String(e||"").trim().toLowerCase();return t==="daily"?r("每日"):t==="weekly"?r("每周"):t==="monthly"?r("每月"):""}function Xee(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"";const a=window.wbUnits;return a?.formatTokens?a.formatTokens(t):String(t)}function ic(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"":Pe().wbApp?.formatTime?.(t*1e3)||new Date(t*1e3).toLocaleString()}function Qee(e){const t=Xee(e.grantUnits),a=String(e.unitType||"").trim(),o=t?[t,a].filter(Boolean).join(" "):"",c=Yee(e.period),d=[String(e.showName||"").trim(),o].filter(Boolean).join(" ");return d?c?r("{body}({period})",{body:d,period:c}):d:""}function zP(e){return(e.entitlements||[]).map(Qee).filter(Boolean).join(r("、"))}function Zee(e){const t=ic(e.startsAt),a=ic(e.endsAt);return t&&a?`${t} → ${a}`:a?r("到期 {time}",{time:a}):t?r("开始 {time}",{time:t}):""}function Wee(e){const t=new Date(e*1e3);if(Number.isNaN(t.getTime()))return"";const a=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`,o=d=>Math.floor(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate())/864e5),c=o(t)-o(new Date);return c===0?r("今天 {time}",{time:a}):c===1?r("明天 {time}",{time:a}):ic(e)}function Jee(e){const t=[],a=Number(e.pendingUntil);if(Number.isFinite(a)&&a>0){const c=Wee(a);c&&t.push(r("待生效 {time}",{time:c}))}const o=ic(e.endsAt);if(o&&t.push(r("到期 {time}",{time:o})),t.length===0){const c=ic(e.startsAt);c&&t.push(r("开始 {time}",{time:c}))}return t.join(" · ")}function ete({options:e,onClose:t}){const a=e.id,[,o]=x.useState(0);x.useEffect(()=>YA(()=>o(P=>P+1)),[]);const[c,d]=x.useState([]),[f,p]=x.useState({status:"loading"}),[h,v]=x.useState(""),y=Ea(a),b=String(y?.name||e.name||a),j=Yh(y),w=[...new Set([...j,...c])],k=y?.claimPlans&&typeof y.claimPlans=="object"&&!Array.isArray(y.claimPlans)?y.claimPlans:{},S=y?Za(y):void 0,N=S&&typeof S=="object"&&!Array.isArray(S)?S:null,T=N&&Array.isArray(N.plans)?N.plans:[],D=w.filter(P=>P&&!T.some(O=>String(O.planId||"")===P)),C=Ws().usageInflight.has(a),A=Pe().wbZcodeClaim,R=x.useCallback(async()=>{if(!A?.preview){p({status:"error",message:r("当前环境不支持领取(桥接方法缺失)")});return}p({status:"loading"});try{const P=await A.preview(a);p({status:"ready",result:P||{}})}catch(P){p({status:"error",message:ut(P)})}},[A,a]);x.useEffect(()=>{R();const P=Ea(a);P&&Za(P)===void 0&&ng(a)},[a,R]);async function I(P){if(!(!A?.claim||h)){v(P);try{const O=await A.claim(a,P);if(O?.ok||O?.failure==="already_claimed"){const _=O.planId||P;_&&d(L=>L.includes(_)?L:[...L,_]),ng(a),Pe().wbApp?.refresh?.(),R()}}finally{v("")}}}return s.jsx(Qt,{open:!0,onOpenChange:(P,O)=>{if(!P){if(h){O.cancel();return}t()}},children:s.jsxs(Zt,{className:"w-[min(560px,calc(100vw-48px))]",children:[s.jsx(Kt,{children:s.jsx(Gt,{children:r("ZCode 套餐明细 — {name}",{name:b})})}),s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("可领取的套餐"),s.jsx(ze,{variant:"outline",shape:"tag",children:r("官方限时活动")})]}),f.status==="loading"?s.jsxs("div",{className:"flex items-center gap-2 py-2 text-[12.5px] text-muted-foreground",children:[s.jsx(ef,{className:"size-3"}),r("正在探测可领取的套餐…")]}):f.status==="error"?s.jsxs("div",{className:"py-1 text-[12.5px] text-destructive",children:[r("探测失败:{message}",{message:f.message}),s.jsx(se,{variant:"outline",size:"xs",className:"ml-2",onClick:()=>{R()},children:r("重试")})]}):f.result.deployed?(f.result.plans||[]).length===0?s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动期内每天发一份,明天可再领)")}):s.jsx("ul",{className:"m-0 list-none p-0",children:(f.result.plans||[]).map(P=>{const O=String(P.planId||""),_=w.includes(O),L=zP(P),H=Zee(P);return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),_?s.jsx(ze,{variant:"success",shape:"tag",children:r("今日已领")}):null]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null,P.description?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:P.description}):null]}),s.jsx(se,{variant:"outline",size:"xs",className:"flex-none",title:_?r("这一份今天已经领过了(重复领取上游会回「已领取过」)"):void 0,disabled:h!=="",onClick:()=>{I(O)},children:r(h===O?"领取中…":_?"再领一次":"领取")})]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:r("当前没有可领取的套餐(活动尚未开始)")}),s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("活动期内每天发一份新套餐;同一份当天重复领取会提示「已领取过」,次日可再领。领取要走一次人机验证(滑块)。")}),f.status==="ready"&&f.result.activationError?s.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:r("(激活事件补报失败,可能影响领取资格:{message})",{message:f.result.activationError})}):null]}),s.jsxs("section",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[12px] font-semibold text-muted-foreground",children:[r("我的套餐"),Array.isArray(N?.wallets)&&N.wallets.length>0&&N.availableView?s.jsx(ze,{variant:"outline",shape:"tag",children:String(N.walletsFrom||"")==="monitor"?String(N.availableView):r("可用 {value}",{value:String(N.availableView)})}):null,s.jsx("div",{className:"ml-auto",children:s.jsx(se,{variant:"outline",size:"xs",disabled:C,title:r("重新读取该账号的余额与套餐(走余额查询那条链)"),onClick:()=>{ng(a)},children:r(C?"查询中…":"查询余额")})})]}),T.length>0?s.jsx("ul",{className:"m-0 list-none p-0",children:T.map(P=>{const O=String(P.planId||""),_=String(P.state||"unknown"),L=zP(P),H=Jee(P),B=O&&y?.claimPlans&&Number(y.claimPlans[O])||0;return s.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-hairline py-2 last:border-b-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium",children:[s.jsx("span",{className:"truncate",children:P.name||O||r("套餐")}),s.jsx(ze,{variant:Kee[_]||"outline",shape:"tag",children:_A(_)})]}),H?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:H}):null,L?s.jsx("div",{className:"text-[12px] text-muted-foreground",children:L}):null]}),B>0?s.jsx("span",{className:"flex-none text-[11.5px] text-muted-foreground",children:r("本地领取于 {time}",{time:ic(B/1e3)})}):null]},O||P.name)})}):s.jsx("p",{className:"py-1 text-[12.5px] text-muted-foreground",children:S===void 0?r("还没有余额读数(已自动查询一次,稍候;也可以点右上角「查询余额」重读)"):N&&N.source&&N.source!==Gee?r("这个账号的余额走窗口限额通道(只配了编码套餐 API Key):只有每 N 小时的剩余比例,读不到套餐清单"):r("读数里没有套餐清单(免费账号、或套餐的上游状态还没刷新;可点右上角「查询余额」重读)")}),D.length>0?s.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:r("本地台账里今天还领过这些,但上面的读数里还没有:{plans}(读数刷新可能有延迟)",{plans:D.map(P=>{const O=Number(k[P])||0,_=O>0?ic(O/1e3):"";return _?r("{plan}({time} 领取)",{plan:P,time:_}):P}).join(r("、"))})}):null]})]}),s.jsxs(nn,{children:[s.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:w.length>0?r("今天(北京时间)已领取 {n} 份:{plans}",{n:w.length,plans:w.join(r("、"))}):r("今天还没有领过:上面「可领取的套餐」里逐份点「领取」即可")}),s.jsx("div",{className:"mr-auto"}),s.jsx(se,{variant:"outline",onClick:t,children:r("关闭")})]})]})})}let _p=null,Ju=null;function BP(){_p&&(_p.unmount(),_p=null),Ju&&(Ju.remove(),Ju=null)}function tte(e){e?.id&&(BP(),Ju=document.createElement("div"),document.body.append(Ju),_p=vn.createRoot(Ju),_p.render(s.jsx(ete,{options:e,onClose:BP})))}window.wbZcodePlans={open:tte};const HP="w-auto flex-auto";function UP({onInput:e,domRef:t,icon:a,className:o,inputClassName:c,...d}){const f=h=>{t.current=h},p=h=>{e?.(h.currentTarget.value)};return a?s.jsxs(Ci,{className:Ue(HP,o),children:[s.jsx(Ei,{ref:f,className:c,onInput:p,...d}),s.jsx(Ti,{"aria-hidden":"true",children:a})]}):s.jsx(Fe,{ref:f,className:Ue(HP,c),onInput:p,...d})}function nte(e,t){const a=vn.createRoot(e),o={current:null};return a.render(s.jsx(UP,{domRef:o,defaultValue:t.value,placeholder:t.placeholder,type:t.type??"search",icon:t.icon,"aria-label":t.ariaLabel,onInput:t.onInput})),{setValue(c){const d=o.current;d&&d.value!==c&&(d.value=c)},getValue(){return o.current?.value??""},focus(){o.current?.focus()},unmount(){a.unmount()}}}const ste=[["id","id"],["type","type"],["name","name"],["title","title"],["placeholder","placeholder"],["min","min"],["max","max"],["step","step"],["autocomplete","autoComplete"]];function rte(e){const t={defaultValue:e.value||void 0,inputClassName:e.className||void 0};for(const[f,p]of ste){const h=e.getAttribute(f);h!=null&&(t[p]=h)}const a=e.getAttribute("maxlength");a!=null&&(t.maxLength=Number(a));const o=e.getAttribute("inputmode");o!=null&&(t.inputMode=o),e.hasAttribute("spellcheck")&&(t.spellCheck=e.spellcheck),e.disabled&&(t.disabled=!0),e.readOnly&&(t.readOnly=!0),e.hidden&&(t.hidden=!0);const c=e.getAttribute("aria-label");c!=null&&(t["aria-label"]=c);for(const f of e.getAttributeNames())!f.startsWith("data-")||f.startsWith("data-island-")||(t[f]=e.getAttribute(f)??"");const d=e.getAttribute("data-island-icon");return d!=null&&(t.icon=d),t}function VP(e){if(e.dataset.islandUpgraded)return;e.dataset.islandUpgraded="1";const t=rte(e),a=e.parentElement?.classList.contains("input-affix")?e.parentElement:null;let o;a?(a.className=a.className.replace(/\binput-affix\b/,"").trim(),a.style.display="flex",a.style.alignItems="center",o=a):(o=document.createElement("span"),o.style.display="contents",e.replaceWith(o));const c={current:null},d=vn.createRoot(o);Cs.flushSync(()=>{d.render(s.jsx(UP,{...t,domRef:c}))})}function FP(e=document){if(e instanceof HTMLInputElement&&e.matches("[data-island-input]")){VP(e);return}e.querySelectorAll("input[data-island-input]").forEach(VP)}function ate(){FP();const e=new MutationObserver(t=>{for(const a of t)for(const o of a.addedNodes)o instanceof Element&&FP(o)});return e.observe(document.body,{childList:!0,subtree:!0}),e}function lte(e,t){const a=vn.createRoot(e);let o={options:t.options,value:t.value,ariaLabel:t.ariaLabel,className:t.className};const c=()=>{a.render(s.jsx(In,{options:o.options,value:o.value,onValueChange:t.onChange,"aria-label":o.ariaLabel,className:o.className}))};return c(),{setValue(d){d!==o.value&&(o={...o,value:d},c())},setOptions(d){o={...o,options:d},c()},unmount(){a.unmount()}}}window.wbSegmented={mount:lte},window.wbInput={mount:nte},ate()})();