zevairouter 1.0.110 → 1.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +4 -4
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +4 -4
- package/cli/app/.next-cli-build/server/chunks/3155.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3407.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6896.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8371.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/middleware.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/static/chunks/{3702-75768c44a4c60005.js → 3702-9ca011a83b15d8d8.js} +1 -1
- package/cli/app/CHANGELOG.md +6 -0
- package/cli/app/package.json +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/src/dashboardGuard.js +3 -1
- package/src/lib/oauth/services/codebuddyCnBulkImportManager.js +23 -5
- package/src/lib/oauth/services/codebuddyCnPhoneAutomation.js +19 -3
- /package/cli/app/.next-cli-build/static/{-vY51mS-VaNLvQLi9SSDj → BEit7P9cwXUO_ME79G3cB}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{-vY51mS-VaNLvQLi9SSDj → BEit7P9cwXUO_ME79G3cB}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=8371,exports.ids=[8371],exports.modules={48371:(a,b,c)=>{c.d(b,{xM:()=>W,t9:()=>Z,TK:()=>Y,cO:()=>e.cO,VU:()=>ad});var d=c(55511),e=c(53041),f=c(71998),g=c(89718),h=c(20116),i=c(92990),j=c(39609);let k=globalThis.fetch,l=new Set(["a timeout","is cancelled","is complete","number banned, when number already used"]);class m extends Error{constructor(a,{status:b,body:c}={}){super(a),this.name="FiveSimError",this.status=b,this.body=c}}class n extends m{constructor(a){super(`5sim order ${a} timed out waiting for SMS`),this.name="FiveSimTimeoutError",this.orderId=a}}class o extends m{constructor(a,b){super(`5sim order ${a} cancelled: ${b}`),this.name="FiveSimCancelledError",this.orderId=a}}class p extends m{constructor(a){super(`5sim order ${a} number was already used (banned)`),this.name="FiveSimBannedError",this.orderId=a}}class q{constructor({apiKey:a,proxyOptions:b=null}={}){if(!a||"string"!=typeof a||!a.trim())throw new m("5sim API key is required");this.apiKey=a.trim(),this.proxyOptions=b}_headers(a={}){return{Authorization:`Bearer ${this.apiKey}`,Accept:"application/json",...a}}async _get(a,{headers:b,...c}={}){let d=`https://5sim.net/v1${a}`,e=this.proxyOptions?.enabled?j.proxyAwareFetch:k,f=await e(d,{method:"GET",headers:this._headers(b),...c},this.proxyOptions);if(!f.ok){let b=await f.text().catch(()=>"");throw new m(`5sim request to ${a} failed (HTTP ${f.status}): ${b.slice(0,200)}`,{status:f.status,body:b})}let g=await f.text();try{return JSON.parse(g)}catch{if(g&&!g.startsWith("{"))throw new m(`5sim ${a} returned non-JSON: ${g.slice(0,200)}`,{status:f.status,body:g});return null}}async buyNumber({country:a="hongkong",operator:b="any",product:c="codebuddy",allowProductFallback:d=!1}={}){let e="codebuddy"===c&&d?["codebuddy","other"]:[c],f=null;for(let c of e){let g=`/user/buy/activation/${encodeURIComponent(a)}/${encodeURIComponent(b)}/${encodeURIComponent(c)}`;try{let a=await this._get(g);if(!a||!a.id||!a.phone)throw new m(`5sim buyNumber returned unexpected shape: ${JSON.stringify(a).slice(0,200)}`,{body:a});return a}catch(g){f=g;let a=g?.status,b=String(g?.body||g?.message||"").toLowerCase();if(!(d&&"codebuddy"===c&&e.includes("other")&&(400===a||404===a||b.includes("no free")||b.includes("not enough")||b.includes("no product"))))throw g}}throw f||new m("5sim buyNumber failed for all product candidates")}async checkOrder(a){return this._get(`/user/check/${a}`)}async pollCode(a,{timeoutMs:b=9e5,intervalMs:c=6e3,signal:d}={}){let e=Math.max(5e3,c),f=Date.now()+b,g=0;for(;Date.now()<f;){let b;if(d?.aborted)throw new o(a,"aborted by caller");try{b=await this.checkOrder(a)}catch(a){if(a instanceof m&&a.status>=500){if(++g>5)throw a;await s(e);continue}throw a}if(g=0,Array.isArray(b.sms)&&b.sms.length>0){let a=r(b.sms[b.sms.length-1]);if(a)return a}if(b.status&&l.has(b.status)){if("a timeout"===b.status)throw new n(a);if("number banned, when number already used"===b.status)throw new p(a);if("is cancelled"===b.status)throw new o(a,b.status);if("is complete"===b.status){let c=function(a){if(!Array.isArray(a))return null;for(let b=a.length-1;b>=0;b--){let c=r(a[b]);if(c)return c}return null}(b.sms);if(c)return c;throw new m(`5sim order ${a} completed but no SMS code found`,{body:b})}}await s(e)}throw new n(a)}async finishOrder(a){try{return await this._get(`/user/finish/${a}`),!0}catch(b){return console.warn(`[5sim] finishOrder(${a}) failed (best-effort): ${b.message}`),!1}}async cancelOrder(a){try{return await this._get(`/user/cancel/${a}`),!0}catch(b){return console.warn(`[5sim] cancelOrder(${a}) failed (best-effort): ${b.message}`),!1}}async banOrder(a){try{return await this._get(`/user/ban/${a}`),!0}catch(b){return console.warn(`[5sim] banOrder(${a}) failed (best-effort): ${b.message}`),!1}}async getBalance(){try{let a=await this._get("/user/profile");return{balance:a?.balance??null,rating:a?.rating??null}}catch(a){return console.warn(`[5sim] getBalance failed: ${a.message}`),{balance:null,rating:null}}}}function r(a){return a?a.code&&/\d{4,8}/.test(String(a.code))?String(a.code).match(/\d{4,8}/)[0]:a.text?function(a){if(!a)return null;let b=String(a).match(/\b(\d{4,8})\b/);return b?b[1]:null}(a.text):null:null}function s(a){return new Promise(b=>setTimeout(b,a))}let t=["https://www.codebuddy.cn/login/","https://www.codebuddy.cn/login","https://www.codebuddy.cn/register/","https://copilot.tencent.com/login/"],u=["text=手机号","div:has-text('手机号')","span:has-text('手机号')","[class*='phone']:has-text('手机号')","div.kc-phone-tab:has-text('手机号')"],v=["text=手机号","text=其他登录方式","text=微信","#phone-iframe",".login-phone-box"],w="#phone-iframe",x="#phoneNumber",y=".kc-country-option",z=".kc-country-code-text",A="#code",B=['iframe[src*="captcha"]','iframe[src*="tcaptcha"]',"#tcaptcha","#tcaptcha_transform",".nc_iconfont",".nc_wrapper",'[class*="captcha"]','[id*="captcha"]',"text=滑块","text=拖动"],C=['[class*="avatar"]','[class*="user-info"]','[class*="logout"]',"text=退出登录","text=Logout","text=Sign out"],D=["#input-error",".pf-c-form__helper-text.pf-m-error",".kc-feedback-text"];async function E({page:a,phone:b,resolvePhone:c,pollSmsPromise:d,waitForSms:e,onStep:f,phoneFormatter:g=a=>a,timeouts:h={},signal:i=null,isCancelled:j=null}){let k=h.nav??3e4,l=h.action??15e3,m=h.codeWait??9e5,n=h.postSubmit??1e4,o=(a,b)=>f?.(a,b),p=()=>{if(i?.aborted||"function"==typeof j&&j()){let a=Error("Job cancelled");throw a.code="JOB_CANCELLED",a}};try{var q;let f,h;o("cn_opening_login_page","Opening CodeBuddy CN login page"),p();try{a.setDefaultNavigationTimeout(k),a.setDefaultTimeout(l)}catch{}try{await a.context().route("**/*",a=>{let b=a.request().url();return/googletagmanager|googleadservices|google-analytics|doubleclick|facebook|hotjar|clarity\.ms|hm\.baidu|google\.com\/rmkt/i.test(b)?a.abort():a.continue()})}catch{}let i=null,j=[];for(let b=1;b<=2;b++){p();try{let c=t[(b-1)%t.length];o("cn_nav_attempt",`Navigation attempt ${b}/2 → ${c}`),b>1&&(await a.context().clearCookies().catch(()=>{}),await a.waitForTimeout(800)),await a.goto(c,{waitUntil:"commit",timeout:k}),p(),await a.waitForTimeout(1500),p();let d=await I(a,v,25e3);if(p(),!d){let b=await a.locator("body").innerText().catch(()=>""),d=await a.evaluate(()=>document.documentElement?.outerHTML?.length||0).catch(()=>0),e=a.url();o("cn_spa_not_ready",`SPA not ready after 25s (url=${e}, body=${String(b).slice(0,80)}, html=${d})`),!b&&d<200?(o("cn_proxy_empty_page","Empty page body — proxy may be blocking codebuddy.cn"),j.push({code:"proxy_empty",detail:`empty page via ${c} (html=${d})`})):j.push({code:"spa_timeout",detail:`SPA not ready url=${e} html=${d}`});continue}o("cn_spa_ready","Login SPA ready"),o("cn_selecting_phone_tab","Selecting phone-number tab");let e=await H(a,u,{timeout:12e3});if(e?(await e.click().catch(()=>{}),o("cn_phone_tab_selected","Phone tab selected"),await a.waitForTimeout(800)):o("cn_phone_tab_not_found","Phone tab not found — checking if iframe already present"),o("cn_waiting_for_iframe","Waiting for phone iframe to load"),await a.locator(w).waitFor({state:"attached",timeout:18e3}).catch(()=>{}),i=await F(a)){if(await i.waitForSelector(x,{state:"visible",timeout:15e3}).then(()=>!0).catch(()=>!1)){o("cn_iframe_ready","Phone iframe + #phoneNumber ready");break}o("cn_iframe_empty","Iframe found but #phoneNumber not visible yet"),j.push({code:"iframe_empty",detail:"phone iframe attached but #phoneNumber not visible"}),i=null}else o("cn_iframe_missing",`No #phone-iframe (attempt ${b}/2)`),j.push({code:"iframe_missing",detail:"SPA loaded but #phone-iframe never appeared"})}catch(e){if(e?.code==="JOB_CANCELLED")throw e;let a=String(e?.message||e||"");o("cn_nav_retry",`Navigation attempt ${b}/2 failed: ${a.slice(0,120)}`);let c=/timeout|exceeded|ETIMEDOUT|net::ERR/i.test(a),d=/ERR_PROXY|ERR_TUNNEL|ERR_CONNECTION|NS_ERROR_PROXY|proxy/i.test(a);j.push({code:d?"proxy_network":c?"nav_timeout":"nav_error",detail:a.slice(0,160)})}}if(!i)return{status:"failed",error:function(a=[],b=2){let c=a.map(a=>a.code),d=a[a.length-1],e="Fix: use a live residential CN proxy (proxyPoolMode=single), concurrency 1, then retry. 5sim is not charged until the form loads.";return c.includes("proxy_empty")||c.includes("proxy_network")?`CodeBuddy CN login page empty/blocked via proxy after ${b} attempts (${d?.detail||"proxy blackhole"}). ${e}`:c.includes("nav_timeout")?`CodeBuddy CN navigation timed out after ${b} attempts (${d?.detail||"goto timeout"}). Proxy is too slow or dead. ${e}`:c.includes("spa_timeout")?`CodeBuddy CN SPA did not boot after ${b} attempts (${d?.detail||"no login UI"}). Proxy/CDN may be filtering JS. ${e}`:c.includes("iframe_missing")||c.includes("iframe_empty")?`CodeBuddy CN page opened but phone form iframe never appeared after ${b} attempts (${d?.detail||"no #phone-iframe"}). Site layout change or half-loaded SPA — retry with another CN exit IP. ${e}`:c.includes("nav_error")&&d?.detail?`CodeBuddy CN phone form failed after ${b} attempts: ${d.detail}. ${e}`:`Could not load CodeBuddy CN phone form after ${b} attempts (${d?.code||"unknown"}: ${d?.detail||"proxy/SPA"}). ${e}`}(j,2)};await i.waitForSelector("#kc-form-login",{timeout:l}).catch(()=>{}),await i.waitForSelector(x,{state:"visible",timeout:l}).catch(()=>{});let r=b;if("function"==typeof c&&(o("cn_ordering_after_form","Login form ready — ordering 5sim number now (not before nav)"),r=await c()),!r)return{status:"failed",error:"No phone number available (resolvePhone/phone missing)"};let s=g(r),{countryCode:y,localNumber:z}=(q=s,(!(h=String(q).replace(/[\s\-()]/g,"")).startsWith("+")&&/^\d+$/.test(h)&&(h="+"+h),h.startsWith("+852"))?{countryCode:"+852",localNumber:h.slice(4)}:h.startsWith("+86")?{countryCode:"+86",localNumber:h.slice(3)}:h.startsWith("+1")?{countryCode:"+1",localNumber:h.slice(2)}:{countryCode:"",localNumber:h.replace(/^\+/,"")});o("cn_selecting_country",`Selecting country code ${y} for phone ${s}`),await G(i,y,l,o),o("cn_entering_phone",`Entering phone number: ${z}`);let B=i.locator(x).first();try{await B.waitFor({state:"visible",timeout:l})}catch{return{status:"failed",error:"Could not find the phone number input (#phoneNumber) inside the iframe"}}await J(B,z),o("cn_phone_entered",`Phone number entered: ${z}`);try{let b=a.locator(".t-checkbox").last();await b.isVisible({timeout:3e3}).catch(()=>!1)&&(await b.click().catch(()=>{}),o("cn_agreement_checked","Agreement checkbox checked"))}catch{}o("cn_clicking_send_code","Clicking send SMS code button");let C=i.locator("input.btn-lg.code-btn").first(),D=!1;try{await C.waitFor({state:"visible",timeout:5e3}),D=!0}catch{let a=i.locator(".code-btn").first();try{await a.waitFor({state:"visible",timeout:5e3}),D=!0}catch{D=!1}}if(!D)return{status:"failed",error:"Could not find the send-SMS-code button (.code-btn) inside the iframe"};await C.click().catch(()=>{}),o("cn_send_code_clicked","Send code button clicked"),await i.waitForSelector(A,{state:"visible",timeout:5e3}).catch(()=>{});let E=await R(i);if(E)return{status:"failed",error:`Form error after sending code: ${E}`};o("cn_waiting_for_sms","Waiting for SMS verification code from 5sim (timer starts now)");try{let a;if("function"==typeof e)a=Promise.resolve().then(()=>e());else if(d)a=d;else throw Error("No waitForSms/pollSmsPromise provided");let b=new Promise((a,b)=>setTimeout(()=>b(Error("Timed out waiting for SMS code")),m));f=await Promise.race([a,b])}catch(a){if(a&&"FiveSimTimeoutError"===a.name)throw a;return{status:"failed",error:`Failed to receive SMS code: ${a.message}`}}if(!f)return{status:"failed",error:"Received empty SMS code from 5sim"};o("cn_sms_received",`SMS code received: ${f}`),o("cn_entering_code","Entering SMS verification code");let K=i.locator(A).first();try{await K.waitFor({state:"visible",timeout:l})}catch{return{status:"failed",error:"Could not find the verification code input (#code) inside the iframe"}}await J(K,f),o("cn_code_entered","Verification code entered");let L=Math.max(n,12e3),U=!1;for(let b=0;b<2;b++){o("cn_submitting",`Clicking submit button (attempt ${b+1}/2)`);let c=await F(a);if(!c){let b=await M(a,{timeoutMs:5e3,reportStep:o});if(b.ok)return o("cn_session_cookies",`Keycloak session after iframe detach (${b.cookie})`),{status:"success"};return{status:"failed",error:"Lost phone iframe after submit"}}if(await c.locator(x).first().isVisible({timeout:3e3}).catch(()=>!1)&&b>0){o("cn_re_entering_after_refresh",`Re-entering phone + code after refresh (retry ${b})`),await G(c,y,l,o);let d=c.locator(x).first();await J(d,z);try{let b=a.locator(".t-checkbox").first();await b.isVisible({timeout:2e3}).catch(()=>!1)&&await b.click().catch(()=>{})}catch{}let e=c.locator(A).first();await e.isVisible({timeout:3e3}).catch(()=>!1)&&await J(e,f)}if(await N(c,l),o("cn_submitted",`Registration form submitted (attempt ${b+1})`),await a.waitForLoadState("domcontentloaded",{timeout:5e3}).catch(()=>{}),await a.waitForTimeout(1e3),c=await F(a)||c,await Q(c)){if(b>=1)return{status:"failed",error:"Account restricted (账号访问受限) after submit. Datacenter/VPS IP is usually blocked — use a residential CN proxy pool (proxyPoolMode=single) and retry."};o("cn_account_restricted",`Account restricted (attempt ${b+1}) — refreshing page and retrying`),await a.reload({waitUntil:"commit",timeout:k}).catch(()=>{}),await I(a,v,12e3);let c=await H(a,u,{timeout:8e3});c&&(await c.click().catch(()=>{}),await a.locator(w).waitFor({state:"attached",timeout:8e3}).catch(()=>{}));continue}if(o("cn_checking_captcha","Checking for captcha"),await S(a,c,3e3))return o("cn_captcha_detected","Captcha appeared during registration — manual assist needed"),{status:"needs_manual",error:"A captcha appeared during registration. Please complete it manually in the opened browser window.",captcha:!0};let d=await R(c);if(d)return{status:"failed",error:`Form error after submit: ${d}`};o("cn_waiting_session",`Waiting up to ${Math.round(L/1e3)}s for Keycloak session cookies`);let e=await M(a,{timeoutMs:L,reportStep:o,alsoCheckFrame:()=>F(a)});if(e.ok)return o("cn_session_cookies",`Keycloak session cookies present (${e.cookie}) — registration success`),{status:"success"};if(await O(a)&&b<1){o("cn_submit_no_effect","Login form still visible after submit — retrying");continue}o("cn_session_nudge","No session yet — navigating to home to complete OIDC handoff"),await a.goto("https://www.codebuddy.cn/",{waitUntil:"domcontentloaded",timeout:k}).catch(()=>{}),await a.waitForTimeout(2e3);let g=await M(a,{timeoutMs:1e4,reportStep:o});if(g.ok)return o("cn_session_cookies",`Keycloak session after home nudge (${g.cookie})`),{status:"success"};U=!0;break}if(!U)return o("cn_submit_retries_exhausted","Account restricted after 2 retries — needs manual"),{status:"needs_manual",error:"Account restricted after 2 refresh retries. Please try with a different VPN/proxy or complete manually."};o("cn_confirming_success","Confirming registration success");let V=await M(a,{timeoutMs:5e3});if(V.ok)return o("cn_registration_success",`Phone registration completed (Keycloak session: ${V.cookie})`),{status:"success"};if(await T(a,i,1e4))return o("cn_registration_success","Phone registration completed successfully (UI markers)"),{status:"success"};let W=await P(a);return o("cn_success_unconfirmed",`No Keycloak session after submit — ${W.summary}`),{status:"needs_manual",error:`Login submit finished but no Keycloak session yet (${W.summary}). Complete login in the headed browser or retry with a fresh China proxy.`}}catch(a){if(a&&"FiveSimTimeoutError"===a.name)throw a;return o("cn_automation_error",`Phone registration automation error: ${a.message}`),{status:"failed",error:a.message||"Unexpected error during phone registration"}}}async function F(a){try{await a.locator(w).waitFor({state:"attached",timeout:5e3});let b=await a.locator(w).elementHandle({timeout:2e3});if(b){let a=await b.contentFrame();if(a)return a}}catch{}for(let b of a.frames()){let a=b.url();if(a.includes("codebuddy.cn/auth/realms/copilot")||a.includes("protocol/openid-connect"))return b}return null}async function G(a,b,c,d){if(!b)return;let e=Math.min(Number(c)||15e3,1e4),f=async()=>{let c=a.locator(z).first(),f=String(await c.textContent({timeout:3e3}).catch(()=>"")).trim();if(f===b)return void d?.("cn_country_already_selected",`Country code already ${b}`);d?.("cn_opening_country_dropdown",`Opening country dropdown (current: ${f}, target: ${b})`);let g=a.locator(".kc-country-selector").first();for(let c of(await g.waitFor({state:"visible",timeout:Math.min(e,5e3)}),await g.click({timeout:3e3}).catch(()=>{}),await a.locator(y).first().waitFor({state:"visible",timeout:3e3}).catch(()=>{}),({"+852":["中国香港","香港","Hong Kong","+852"],"+86":["中国大陆","中国","China","+86"],"+853":["中国澳门","澳门","Macau","+853"],"+886":["中国台湾","台湾","Taiwan","+886"]})[b]||[b]))for(let e of[a.locator(`${y}:has-text("${c}")`).first(),a.getByText(c,{exact:!1}).first()]){if(!await e.isVisible({timeout:1500}).catch(()=>!1))continue;let f=await e.textContent({timeout:1500}).catch(()=>c);await e.click({timeout:2e3}).catch(()=>{}),await a.locator(z).filter({hasText:b}).first().waitFor({state:"visible",timeout:2e3}).catch(()=>{}),d?.("cn_country_selected",`Country selected: ${String(f||c).trim()}`);return}d?.("cn_country_not_found",`Country code ${b} not found in dropdown; using default`),await a.locator("body").click({timeout:1e3}).catch(()=>{})};try{await Promise.race([f(),new Promise((a,b)=>{let c=setTimeout(()=>b(Error(`selectCountry timed out after ${e}ms`)),e);"function"==typeof c.unref&&c.unref()})])}catch(a){d?.("cn_country_select_error",`Country selection error: ${a.message}`)}}async function H(a,b,{timeout:c=1e4}={}){for(let d of b)try{let b=a.locator(d).first();return await b.waitFor({state:"visible",timeout:Math.min(c,5e3)}),b}catch{}return null}async function I(a,b,c=15e3){let d=Date.now()+c;for(;Date.now()<d;){for(let c of b)try{let b=a.locator(c).first();if(await b.isVisible().catch(()=>!1))return!0}catch{}await new Promise(a=>setTimeout(a,250))}return!1}async function J(a,b){try{return await a.click(),await a.fill(""),await a.fill(b),!0}catch{try{return await a.click(),await a.press("Control+a"),await a.type(b,{delay:50}),!0}catch{return!1}}}let K=["KEYCLOAK_IDENTITY","KEYCLOAK_SESSION","KEYCLOAK_IDENTITY_LEGACY","KEYCLOAK_SESSION_LEGACY"];function L(a=[]){for(let b of K)if(a.some(a=>a.name===b))return b;let b=a.find(a=>a.name.startsWith("KEYCLOAK_")&&!/locale|theme|restart/i.test(a.name));return b?.name||null}async function M(a,{timeoutMs:b=2e4,reportStep:c,alsoCheckFrame:d}={}){let e=Date.now()+b,f=0;for(;Date.now()<e;){let b=await a.context().cookies().catch(()=>[]),g=L(b);if(g)return{ok:!0,cookie:g,cookies:b};try{let c=a.url();if(c&&!c.includes("/login")&&!c.includes("/auth/realms")){let a=b.find(a=>/^(access_token|cb_token|codebuddy)/i.test(a.name)||"token"===a.name&&a.domain?.includes("codebuddy"));if(a)return{ok:!0,cookie:a.name,cookies:b}}}catch{}if(d){let a=await d().catch(()=>null);if(a){if(await Q(a))return{ok:!1,cookies:b,reason:"restricted"};let c=await R(a);if(c)return{ok:!1,cookies:b,reason:`form_error:${c}`}}}if(c&&Date.now()-f>4e3){f=Date.now();let a=Math.max(0,Math.round((e-Date.now())/1e3));c("cn_waiting_session",`Still waiting for Keycloak session… ${a}s left`)}await a.waitForTimeout(500)}return{ok:!1,cookies:await a.context().cookies().catch(()=>[])}}async function N(a,b=15e3){let c=a.locator("#kc-login").first();try{await c.waitFor({state:"visible",timeout:b}),await c.click({timeout:5e3}).catch(()=>{})}catch{}try{await a.evaluate(()=>{let a=document.querySelector("#kc-form-login")||document.querySelector("form");if(a)if("function"==typeof a.requestSubmit){let b=a.querySelector("#kc-login")||a.querySelector('[type="submit"]');b?a.requestSubmit(b):a.requestSubmit()}else a.submit()})}catch{await a.locator(A).first().press("Enter").catch(()=>{})}}async function O(a){let b=await F(a);return!!b&&b.locator(x).first().isVisible({timeout:1500}).catch(()=>!1)}async function P(a){let b="";try{b=a.url()}catch{b="(unknown)"}let c=(await a.context().cookies().catch(()=>[])).map(a=>a.name).slice(0,20).join(",")||"(none)",d="";try{d=await a.evaluate(()=>(document.body?.innerText||"").replace(/\s+/g," ").trim().slice(0,120))}catch{d=""}let e=await F(a),f="no-iframe";if(e)try{f=(await e.url()).slice(0,80)}catch{f="iframe-detached"}return{summary:`url=${b.slice(0,60)} cookies=[${c}] frame=${f}${d?` text="${d}"`:""}`,url:b,cookieNames:c,bodySnippet:d}}async function Q(a){try{let b=await a.evaluate(()=>document.body?.innerText||"");if(b.includes("账号访问受限")||b.includes("安全策略限制")||b.includes("访问受限"))return!0}catch{}return!1}async function R(a){for(let b of D)try{let c=a.locator(b).first();if(await c.isVisible({timeout:1500}).catch(()=>!1)){let a=await c.textContent().catch(()=>""),b=String(a).trim();if(b&&b.length>1)return b}}catch{}try{let b=await a.evaluate(()=>(document.body?.innerText||"").replace(/\s+/g," ").trim());for(let a of["验证码错误","验证码已过期","验证码无效","请输入正确的验证码","手机号格式","发送过于频繁","Invalid","incorrect"])if(b.includes(a)){let c=b.indexOf(a);return b.slice(Math.max(0,c-10),c+a.length+40).trim()}}catch{}return null}async function S(a,b,c=5e3){for(let b of B)try{let d=a.locator(b).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}if(b)for(let a of B)try{let d=b.locator(a).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}return!1}async function T(a,b,c=15e3){try{let b=await a.context().cookies().catch(()=>[]);if(L(b))return!0}catch{}for(let b of C)try{let d=a.locator(b).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}try{let b=a.url(),c=await a.context().cookies().catch(()=>[]),d=new Set(c.map(a=>a.name));if(b&&!b.includes("/login")&&!b.includes("/auth/realms")&&(d.has("qcloud_uid")||d.has("qcmainCSRFToken"))&&!d.has("login_risk_state")&&!await O(a).catch(()=>!1))return!0}catch{}return!1}var U=c(40891),V=c(75949);let W=200,X=Number.parseInt(process.env.ZEVAI_CN_ACCOUNT_TIMEOUT_MS||"",10)||72e4,Y=new Set(["hongkong","china","any"]),Z="hongkong";function $(a){return String(a||"").trim()}async function _({apiKey:a,phone:b,region:d,fiveSimOrderId:e,account:f}){let{createProviderConnection:g}=await Promise.resolve().then(c.bind(c,71998)),h={provider:"codebuddy-cn",authType:"apikey",apiKey:a,accessToken:a,name:b||`5sim-${e}`,email:b||`5sim-${e}`,providerSpecificData:{domain:"www.codebuddy.cn",phoneNumber:b,fiveSimOrderId:e,region:d,automation:"5sim-phone-bulk"},testStatus:"active"};return{connection:await g(h)}}class aa extends e.Q6{constructor({browserLauncher:a,requestDeviceCodeFn:b=U.cT,pollToken:d=U.ZV,fetchLoginAccountFn:e=U.w8,saveConnection:f=_,fiveSimClientFactory:g=ab,phoneAutomation:h=E,phoneFormatter:j=$,pollIntervalMs:k=i.ne.pollInterval,storageName:l="codebuddy-cn-bulk-import"}={}){super({browserLauncher:a||(async a=>{let{launchBulkImportBrowser:b}=await Promise.resolve().then(c.bind(c,75949)),d=Array.isArray(a?.proxyUrls)&&a.proxyUrls.length?a.proxyUrls[0]:null,e=process.env.ZEVAI_CN_HEADLESS,f="linux"===process.platform;return("0"===e||"false"===e)&&(f=!1),("1"===e||"true"===e)&&(f=!0),b({engine:a?.engine||"camoufox",proxyUrl:d,headless:f,windowSize:{width:900,height:700}})}),storageName:l}),this.requestDeviceCode=b,this.pollToken=d,this.fetchLoginAccount=e,this.saveConnection=f,this.fiveSimClientFactory=g,this.phoneAutomation=h,this.phoneFormatter=j,this.pollIntervalMs=k}async startJob({count:a,concurrency:b,engine:g,proxyPoolMode:i,proxyPoolId:j,region:k}){let l=Number.parseInt(a,10);if(!Number.isFinite(l)||l<1)throw Object.assign(Error("At least one account is required (count >= 1)"),{error:"At least one account is required (count >= 1)"});if(l>W)throw Object.assign(Error(`Count exceeds maximum of ${W}`),{error:`Count exceeds maximum of ${W}`});let m=[...this.jobs.values()].find(a=>a&&("running"===a.status||"queued"===a.status||"needs_manual"===a.status)&&!a.cancelRequested);if(m)throw Object.assign(Error(`Another CodeBuddy CN job is still active (${m.jobId}). Cancel it or wait before starting again.`),{error:`Another CodeBuddy CN job is still active (${m.jobId}). Cancel it or wait before starting again.`});let n=Y.has(k)?k:Z,o=[];if("all"===i)o=(await (0,f.ui)({isActive:!0})).map(a=>a.proxyUrl).filter(Boolean);else if("single"===i&&j){let a=await (0,f.hr)(j);a?.isActive&&a?.proxyUrl&&(o=[a.proxyUrl])}let p=(0,d.randomUUID)(),q=(0,e.kF)(),{normalizeBulkImportEngine:r}=await Promise.resolve().then(c.bind(c,75949)),s=g?r(g):"camoufox",t={jobId:p,status:"running",concurrency:function(a){let b=function(){try{let{totalMemGb:a}=(0,h.si)();return Number.isFinite(a)&&a>0&&a<3}catch{return!1}}()?1:8;if((0,h.uT)(a))return Math.min(b,Math.max(1,(0,h.q)()));let c=Number.parseInt(a,10);return Number.isFinite(c)?Math.min(b,Math.max(1,c)):Math.min(b,1)}(b),engine:s,proxyPoolMode:i||"none",proxyUrls:o,region:n,createdAt:q,startedAt:q,finishedAt:null,error:null,cancelRequested:!1,browser:null,nextIndex:0,manualFollowups:new Set,persistPromise:Promise.resolve(),lastPreview:null,lastPreviewCapturedAt:0,accounts:Array.from({length:l},(a,b)=>({line:b+1,region:n,phone:null,fiveSimOrderId:null,fiveSimActivationId:null,proxyUrl:null,abortController:new AbortController,status:"queued",error:null,connectionId:null,workerId:null,manualSession:null,runtimeSession:null,currentStep:"queued",updatedAt:q,logs:[(0,e.hn)("queued","Queued and waiting for an available worker")]}))};return this.jobs.set(p,t),this.latestJobId=p,await this.persistJobSnapshot(t,{forcePreview:!1}),this.runJob(p),ac(t)}getJob(a){let b=this.jobs.get(a);return b?ac(b):null}async getJobWithPreview(a){let b=this.jobs.get(a);return b?(await this.persistJobSnapshot(b,{forcePreview:!1}),ac(b,{preview:b.lastPreview||null})):null}async processAccount(a,b,c){if(a.cancelRequested||!a.browser)return void this.finalizeAccount(b,"cancelled",{error:"Job cancelled"});let d=null,f=null,h=!1,i=null;try{let c;this.setAccountStep(b,"reading_settings","Reading 5sim API key from settings"),await this.persistJobSnapshot(a,{forcePreview:!0});let j=(await (0,g.mt)()).fiveSimApiKey;if(!j||!j.trim()){this.finalizeAccount(b,"failed",{error:"5sim API key not configured. Set it in the automation modal or dashboard settings.",step:"failed",message:"5sim API key not configured"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}d=this.fiveSimClientFactory({apiKey:j,proxyOptions:null}),this.setAccountStep(b,"creating_browser","Creating browser context (before 5sim order)"),await this.persistJobSnapshot(a,{forcePreview:!0});let k=await (0,e.go)(a.browser,b.proxyUrl);i=k.context;let l=k.page;if(b.runtimeSession={context:i,page:l},a.cancelRequested)throw Error("Job cancelled before ordering phone number");this.setAccountStep(b,"registering","Running phone registration on CodeBuddy CN"),await this.persistJobSnapshot(a,{forcePreview:!0});try{l.setDefaultTimeout(2e4),l.setDefaultNavigationTimeout(45e3)}catch{}let m=null,n=new Promise((a,b)=>{m=setTimeout(()=>{b(Object.assign(Error(`CodeBuddy CN account hard timeout after ${Math.round(X/1e3)}s (browser will be force-closed)`),{code:"CN_ACCOUNT_HARD_TIMEOUT"}))},X),"function"==typeof m.unref&&m.unref()});try{c=await Promise.race([this.phoneAutomation({page:l,signal:b.abortController?.signal,isCancelled:()=>!0===a.cancelRequested,resolvePhone:async()=>{if(a.cancelRequested)throw Error("Job cancelled before ordering phone number");this.setAccountStep(b,"ordering_number",`Form ready — ordering ${a.region} phone from 5sim (single buy)`),await this.persistJobSnapshot(a,{forcePreview:!0});let c=await d.buyNumber({country:a.region,product:"codebuddy",allowProductFallback:!1});return f=c.id,b.phone=c.phone,b.fiveSimOrderId=c.id,b.fiveSimActivationId=c.id,this.setAccountStep(b,"number_ordered",`Phone number ordered: ${c.phone} (1 buy, no re-order)`),await this.persistJobSnapshot(a,{forcePreview:!0}),c.phone},waitForSms:async()=>{if(!f)throw Error("Cannot poll SMS — no 5sim order id");this.setAccountStep(b,"sms_poll_started","SMS poll started (full 90s window after send-code)"),await this.persistJobSnapshot(a,{forcePreview:!1});let c=await d.pollCode(f,{timeoutMs:9e4,signal:b.abortController?.signal});return h=!0,c},onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})},phoneFormatter:this.phoneFormatter}),n])}finally{m&&clearTimeout(m)}if("failed"===c.status){let e=c.error||"Phone registration failed before submit";this.finalizeAccount(b,"failed",{error:e,step:"failed",message:e}),d&&f&&(h?await d.finishOrder(f):await d.cancelOrder(f)),b.runtimeSession=null,await i.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}await this.captureApiKey(a,b,i,l,d,f);return}catch(g){let c=g instanceof n,e=c?"SMS OTP not received within 90s — number banned":g.message||"Unexpected CodeBuddy CN bulk import failure";if(this.finalizeAccount(b,"failed",{error:e,step:c?"sms_timeout":"failed",message:e}),d&&f&&(h?await d.finishOrder(f):c?await d.banOrder(f):await d.cancelOrder(f)),b.runtimeSession=null,i&&await i.close().catch(()=>null),(g?.code==="CN_ACCOUNT_HARD_TIMEOUT"||a.cancelRequested)&&a.browser){let b=a.browser;a.browser=null,await (0,V.forceCloseBrowser)(b).catch(()=>null)}await this.persistJobSnapshot(a,{forcePreview:!0})}}async captureApiKey(a,b,c,d,e,f){let g="personal-edition-user-id",h=async(a,{timeout:b=12e3,interval:c=150}={})=>{let d=Date.now()+b;for(;Date.now()<d;){try{if(await a())return!0}catch{}await new Promise(a=>setTimeout(a,c))}return!1};try{this.setAccountStep(b,"waiting_session","Establishing CodeBuddy console session (probe APIs, not just cookies)"),await this.persistJobSnapshot(a,{forcePreview:!0});let i=async()=>{let a=await c.cookies().catch(()=>[]);return{cookies:a,names:new Set(a.map(a=>a.name)),list:a.map(a=>a.name)}},j=a=>a.has("KEYCLOAK_IDENTITY")||a.has("KEYCLOAK_SESSION")||a.has("KEYCLOAK_IDENTITY_LEGACY")||a.has("KEYCLOAK_SESSION_LEGACY"),k=a=>a.has("AUTH_SESSION_ID")||a.has("session")||a.has("qcloud_uid")||a.has("qcmainCSRFToken")||a.has("x_host_key_access"),l=async()=>d.evaluate(async()=>{try{let a=(window.location.hostname||"www.codebuddy.cn").endsWith("codebuddy.cn")?`${window.location.origin}`:"https://www.codebuddy.cn",b=await fetch(`${a}/console/accounts`,{credentials:"include",headers:{Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":"www.codebuddy.cn","X-Product":"SaaS"}}),c=await b.text().catch(()=>""),d=null;try{d=c?JSON.parse(c):null}catch{d={_raw:String(c||"").slice(0,240),_notJson:!0}}return{status:b.status,data:d,text:String(c||"").slice(0,240)}}catch(a){return{status:0,error:a?.message||String(a)}}}).catch(()=>null),m=a=>{let b=a?.data;if(!b||"object"!=typeof b)return[];for(let a of[b?.data?.accounts,b?.accounts,b?.data?.list,b?.list,b?.data?.result,b?.result,b?.data?.items,b?.items,Array.isArray(b?.data)?b.data:null,Array.isArray(b)?b:null])if(Array.isArray(a)&&a.length>0)return a;return[]},n=async()=>{await Promise.race([d.waitForResponse(a=>/\/console\/accounts/i.test(a.url())&&500>a.status(),{timeout:1e4}).catch(()=>null),d.waitForResponse(a=>/\/console\/api\//i.test(a.url())&&500>a.status(),{timeout:1e4}).catch(()=>null),h(async()=>{let a=await i();return j(a.names)},{timeout:1e4,interval:200}),new Promise(a=>setTimeout(a,2500))])},o=["https://www.codebuddy.cn/","https://www.codebuddy.cn/console","https://www.codebuddy.cn/console/","https://www.codebuddy.cn/profile","https://www.codebuddy.cn/profile/keys","https://www.codebuddy.cn/login/"],p=[],q=null,r=!1,s="";for(let c=0;c<10;c+=1){if(a.cancelRequested)throw Error("Job cancelled while establishing session");let e=await i(),f=j(e.names),g=k(e.names),h=o[Math.min(c,o.length-1)];if(c<3||c%2==0||!g?(this.setAccountStep(b,"waiting_session",`OIDC handoff ${c+1}/10 → ${h.replace("https://www.codebuddy.cn","")} (${f?"KEYCLOAK":g?"soft-session":"weak"})`),await this.persistJobSnapshot(a,{forcePreview:!1}),await d.goto(h,{waitUntil:"domcontentloaded",timeout:25e3}).catch(()=>null),await n()):await new Promise(a=>setTimeout(a,300)),/codebuddy\.cn/i.test(d.url?.()||"")&&(String(d.url()||"").includes("/console")||!(c>=1))||(await d.goto("https://www.codebuddy.cn/console",{waitUntil:"domcontentloaded",timeout:25e3}).catch(()=>null),await n()),q=await l(),p=m(q),s=JSON.stringify(q?.data??q?.text??null).slice(0,180),q?.status===200&&Array.isArray(p)&&p.length>0){r=!0,this.setAccountStep(b,"session_ready",`Console session accepted (HTTP 200, ${p.length} account(s)${f?", KEYCLOAK ok":", soft session"})`),await this.persistJobSnapshot(a,{forcePreview:!0});break}if(g&&q?.status===200&&Array.isArray(p)&&0===p.length&&c>=4){this.setAccountStep(b,"session_soft","Console HTTP 200 but 0 accounts — trying personal API key with soft session (cookies ok)"),await this.persistJobSnapshot(a,{forcePreview:!0}),r=!0;break}this.setAccountStep(b,"resolving_enterprise",`Console not ready (HTTP ${q?.status||0}, accounts=${p.length}) — ${c+1}/10 body=${s.slice(0,80)}`),await this.persistJobSnapshot(a,{forcePreview:!1})}if(!r){let a=await i();throw Error(`Console accounts unavailable after login (HTTP ${q?.status||0}; cookies: ${a.list.slice(0,18).join(",")||"(none)"}; body=${s.slice(0,120)}) — session not accepted for API key`)}let t=g;if(Array.isArray(p)&&p.length>0){let a=p.find(a=>a?.lastLogin)||p[0];a?.type&&"personal"!==a.type&&a.enterpriseId?t=a.enterpriseId:a?.enterpriseId&&a?.type!=="personal"&&(t=a.enterpriseId)}this.setAccountStep(b,"creating_api_key",`Creating API key (enterprise=${t}, accounts=${p.length})`),await this.persistJobSnapshot(a,{forcePreview:!0});let u=async a=>d.evaluate(async({enterpriseId:a})=>{let b=(window.location.hostname||"www.codebuddy.cn").endsWith("codebuddy.cn")?window.location.origin:"https://www.codebuddy.cn",c=await fetch(`${b}/console/api/client/v1/api-keys`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":"www.codebuddy.cn","X-Product":"SaaS"},body:JSON.stringify({name:`zevai-router-${Date.now()}`,expire_in_days:365,user_enterprise_id:a})}),d=await c.text().catch(()=>""),e=null;try{e=d?JSON.parse(d):null}catch{e={_raw:String(d||"").slice(0,200)}}return{ok:c.ok,status:c.status,data:e}},{enterpriseId:a});await d.goto("https://www.codebuddy.cn/profile/keys",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n();let v=await u(t).catch(()=>null);v&&v.ok||t===g||(this.setAccountStep(b,"retrying_api_key","Retrying with personal-edition enterprise id"),await this.persistJobSnapshot(a,{forcePreview:!1}),v=await u(g).catch(()=>null)),v&&v.ok||(this.setAccountStep(b,"retrying_api_key","Retrying API key from /console"),await this.persistJobSnapshot(a,{forcePreview:!0}),await d.goto("https://www.codebuddy.cn/console",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n(),await d.goto("https://www.codebuddy.cn/profile/keys",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n(),v=await u(g).catch(()=>null));let w=v?.status;if(!v?.ok&&(401===w||403===w||0===w||!v)){for(let c of(this.setAccountStep(b,"retrying_api_key","API key 401/403 — re-running OIDC handoff then retry"),await this.persistJobSnapshot(a,{forcePreview:!0}),["https://www.codebuddy.cn/","https://www.codebuddy.cn/console","https://www.codebuddy.cn/profile/keys"]))await d.goto(c,{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n();v=await u(g).catch(()=>null)}let x=v?.data?.code;if(!v||!v.ok||!v.data||0!==x&&200!==x&&void 0!==x)throw Error(`API key creation failed (HTTP ${v?.status??"no-response"}, code=${x??"n/a"}): ${JSON.stringify(v?.data??null).slice(0,200)}`);let y=v.data?.data||v.data,z=y?.apiKey||y?.key||y?.token||y?.secret||y?.api_key||("string"==typeof y?y:null)||v.data.apiKey||v.data.key||v.data.token||v.data.secret;if(!z||"string"!=typeof z)throw Error(`API key response did not contain a key field: ${JSON.stringify(v.data).slice(0,300)}`);this.setAccountStep(b,"api_key_created","API key created successfully"),await this.persistJobSnapshot(a,{forcePreview:!0}),this.setAccountStep(b,"saving_connection","Saving CodeBuddy CN connection"),await this.persistJobSnapshot(a,{forcePreview:!0});let{connection:A}=await this.saveConnection({apiKey:z,phone:b.phone,region:b.region,fiveSimOrderId:f,account:b});await e.finishOrder(f),this.finalizeAccount(b,"success",{connectionId:A.id,step:"connection_saved",message:`CodeBuddy CN connection saved (phone: ${b.phone})`}),b.runtimeSession=null,await c.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(g){this.finalizeAccount(b,"needs_manual",{error:`Registration succeeded but API key capture failed: ${g.message}`,step:"awaiting_manual",message:`Registration done, API key capture failed: ${g.message}`}),await e.finishOrder(f).catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0}),await this.runCnManualFollowup(a,b,b.workerId,c,d,e,f)}}async runCnManualFollowup(a,b,c,d,e,f,g){let h=(async()=>{let c=async()=>{let a=b.manualSession,c=a?.context||d,e=a?.headedBrowser||null;c&&await c.close().catch(()=>null),e&&await e.close().catch(()=>null)};try{this.setAccountStep(b,"manual_waiting","Waiting for operator to complete in headed browser"),await this.persistJobSnapshot(a,{forcePreview:!0});let c=Date.now()+9e5,d=null;for(;Date.now()<c&&!a.cancelRequested;){await new Promise(a=>setTimeout(a,1e4));try{if(!e.url().includes("codebuddy.cn"))continue;let a=await e.evaluate(async()=>{let a=await fetch("/console/api/client/v1/api-keys",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":window.location.hostname||"www.codebuddy.cn","X-Product":"SaaS"},credentials:"include",body:JSON.stringify({name:"zevai-router-manual-"+Date.now(),expire_in_days:365,user_enterprise_id:"personal-edition-user-id"})}),b=await a.json().catch(()=>null);return{ok:a.ok,status:a.status,data:b}});if(a?.ok&&a.data){let b=a.data?.data||a.data;if((d=b?.apiKey||b?.key||b?.token||b?.secret||b?.api_key||("string"==typeof b?b:null))&&"string"==typeof d)break}}catch{}}if(a.cancelRequested){this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}if(!d)throw Error("Manual assist timed out — could not capture API key");this.setAccountStep(b,"saving_connection","Saving CodeBuddy CN connection (manual)"),await this.persistJobSnapshot(a,{forcePreview:!0});let{connection:f}=await this.saveConnection({apiKey:d,phone:b.phone,region:b.region,fiveSimOrderId:g,account:b});this.finalizeAccount(b,"success",{connectionId:f.id,step:"connection_saved",message:`CodeBuddy CN connection saved via manual assist (phone: ${b.phone||"N/A"})`}),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}):this.finalizeAccount(b,"failed",{error:c.message||"Manual assist flow failed",step:"failed",message:c.message||"Manual assist flow failed"}),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{await c(),b.manualSession=null,b.runtimeSession=null,a.manualFollowups.delete(h),await this.persistJobSnapshot(a,{forcePreview:!0})}})();a.manualFollowups.add(h)}cancelJob(a){let b=this.jobs.get(a);if(!b)return null;for(let a of(b.cancelRequested=!0,b.accounts)){a.abortController&&!a.abortController.signal.aborted&&a.abortController.abort();let b=a.runtimeSession?.context;b&&b.close().catch(()=>null),a.runtimeSession=null,a.manualSession=null}if(b.browser){let a=b.browser;b.browser=null,(0,V.forceCloseBrowser)(a).catch(()=>null)}return"queued"===b.status&&(b.status="cancelled",b.finishedAt=(0,e.kF)(),b.accounts.forEach(a=>{"queued"===a.status&&(a.status="cancelled")})),this.persistJobSnapshot(b,{forcePreview:!0}),ac(b)}}function ab({apiKey:a,proxyOptions:b}){return new q({apiKey:a,proxyOptions:b})}function ac(a,b={}){return a?{jobId:a.jobId,status:a.status,summary:function(a=[]){let b={total:a.length,queued:0,running:0,completed:0,success:0,failed:0,needs_manual:0,cancelled:0};for(let c of a){let a=c.status||"queued";"success"===a?(b.success+=1,b.completed+=1):"failed"===a||"failed_exchange"===a?(b.failed+=1,b.completed+=1):"needs_manual"===a?b.needs_manual+=1:"cancelled"===a?(b.cancelled+=1,b.completed+=1):"running"===a?b.running+=1:b.queued+=1}return b}(a.accounts),concurrency:a.concurrency,engine:a.engine,proxyPoolMode:a.proxyPoolMode,region:a.region,createdAt:a.createdAt,startedAt:a.startedAt,finishedAt:a.finishedAt,error:a.error,cancelRequested:a.cancelRequested,accounts:(a.accounts||[]).map(a=>({line:a.line,region:a.region,phone:a.phone,fiveSimOrderId:a.fiveSimOrderId,proxyUrl:a.proxyUrl?function(a){if(!a)return null;try{let b=new URL(a);return b.password&&(b.password="***"),b.toString()}catch{return a}}(a.proxyUrl):null,status:a.status,error:a.error,connectionId:a.connectionId,workerId:a.workerId,manualSessionAvailable:!!a.manualSession,currentStep:a.currentStep,updatedAt:a.updatedAt,logs:a.logs||[]})),preview:void 0!==b.preview?b.preview:a.lastPreview||null,...b}:null}function ad(){return(!globalThis.__codeBuddyCnBulkImportSingleton&&(globalThis.__codeBuddyCnBulkImportSingleton={manager:new aa}),globalThis.__codeBuddyCnBulkImportSingleton).manager}}};
|
|
1
|
+
"use strict";exports.id=8371,exports.ids=[8371],exports.modules={48371:(a,b,c)=>{c.d(b,{xM:()=>X,t9:()=>$,TK:()=>Z,cO:()=>e.cO,VU:()=>ae});var d=c(55511),e=c(53041),f=c(71998),g=c(89718),h=c(20116),i=c(92990),j=c(39609);let k=globalThis.fetch,l=new Set(["a timeout","is cancelled","is complete","number banned, when number already used"]);class m extends Error{constructor(a,{status:b,body:c}={}){super(a),this.name="FiveSimError",this.status=b,this.body=c}}class n extends m{constructor(a){super(`5sim order ${a} timed out waiting for SMS`),this.name="FiveSimTimeoutError",this.orderId=a}}class o extends m{constructor(a,b){super(`5sim order ${a} cancelled: ${b}`),this.name="FiveSimCancelledError",this.orderId=a}}class p extends m{constructor(a){super(`5sim order ${a} number was already used (banned)`),this.name="FiveSimBannedError",this.orderId=a}}class q{constructor({apiKey:a,proxyOptions:b=null}={}){if(!a||"string"!=typeof a||!a.trim())throw new m("5sim API key is required");this.apiKey=a.trim(),this.proxyOptions=b}_headers(a={}){return{Authorization:`Bearer ${this.apiKey}`,Accept:"application/json",...a}}async _get(a,{headers:b,...c}={}){let d=`https://5sim.net/v1${a}`,e=this.proxyOptions?.enabled?j.proxyAwareFetch:k,f=await e(d,{method:"GET",headers:this._headers(b),...c},this.proxyOptions);if(!f.ok){let b=await f.text().catch(()=>"");throw new m(`5sim request to ${a} failed (HTTP ${f.status}): ${b.slice(0,200)}`,{status:f.status,body:b})}let g=await f.text();try{return JSON.parse(g)}catch{if(g&&!g.startsWith("{"))throw new m(`5sim ${a} returned non-JSON: ${g.slice(0,200)}`,{status:f.status,body:g});return null}}async buyNumber({country:a="hongkong",operator:b="any",product:c="codebuddy",allowProductFallback:d=!1}={}){let e="codebuddy"===c&&d?["codebuddy","other"]:[c],f=null;for(let c of e){let g=`/user/buy/activation/${encodeURIComponent(a)}/${encodeURIComponent(b)}/${encodeURIComponent(c)}`;try{let a=await this._get(g);if(!a||!a.id||!a.phone)throw new m(`5sim buyNumber returned unexpected shape: ${JSON.stringify(a).slice(0,200)}`,{body:a});return a}catch(g){f=g;let a=g?.status,b=String(g?.body||g?.message||"").toLowerCase();if(!(d&&"codebuddy"===c&&e.includes("other")&&(400===a||404===a||b.includes("no free")||b.includes("not enough")||b.includes("no product"))))throw g}}throw f||new m("5sim buyNumber failed for all product candidates")}async checkOrder(a){return this._get(`/user/check/${a}`)}async pollCode(a,{timeoutMs:b=9e5,intervalMs:c=6e3,signal:d}={}){let e=Math.max(5e3,c),f=Date.now()+b,g=0;for(;Date.now()<f;){let b;if(d?.aborted)throw new o(a,"aborted by caller");try{b=await this.checkOrder(a)}catch(a){if(a instanceof m&&a.status>=500){if(++g>5)throw a;await s(e);continue}throw a}if(g=0,Array.isArray(b.sms)&&b.sms.length>0){let a=r(b.sms[b.sms.length-1]);if(a)return a}if(b.status&&l.has(b.status)){if("a timeout"===b.status)throw new n(a);if("number banned, when number already used"===b.status)throw new p(a);if("is cancelled"===b.status)throw new o(a,b.status);if("is complete"===b.status){let c=function(a){if(!Array.isArray(a))return null;for(let b=a.length-1;b>=0;b--){let c=r(a[b]);if(c)return c}return null}(b.sms);if(c)return c;throw new m(`5sim order ${a} completed but no SMS code found`,{body:b})}}await s(e)}throw new n(a)}async finishOrder(a){try{return await this._get(`/user/finish/${a}`),!0}catch(b){return console.warn(`[5sim] finishOrder(${a}) failed (best-effort): ${b.message}`),!1}}async cancelOrder(a){try{return await this._get(`/user/cancel/${a}`),!0}catch(b){return console.warn(`[5sim] cancelOrder(${a}) failed (best-effort): ${b.message}`),!1}}async banOrder(a){try{return await this._get(`/user/ban/${a}`),!0}catch(b){return console.warn(`[5sim] banOrder(${a}) failed (best-effort): ${b.message}`),!1}}async getBalance(){try{let a=await this._get("/user/profile");return{balance:a?.balance??null,rating:a?.rating??null}}catch(a){return console.warn(`[5sim] getBalance failed: ${a.message}`),{balance:null,rating:null}}}}function r(a){return a?a.code&&/\d{4,8}/.test(String(a.code))?String(a.code).match(/\d{4,8}/)[0]:a.text?function(a){if(!a)return null;let b=String(a).match(/\b(\d{4,8})\b/);return b?b[1]:null}(a.text):null:null}function s(a){return new Promise(b=>setTimeout(b,a))}let t=["https://www.codebuddy.cn/login/","https://www.codebuddy.cn/login","https://www.codebuddy.cn/register/","https://copilot.tencent.com/login/"],u=["text=手机号","div:has-text('手机号')","span:has-text('手机号')","[class*='phone']:has-text('手机号')","div.kc-phone-tab:has-text('手机号')"],v=["text=手机号","text=其他登录方式","text=微信","#phone-iframe",".login-phone-box"],w=["button:has-text('同意')","text=同意并继续","text=同意"],x="#phone-iframe",y="#phoneNumber",z=".kc-country-option",A=".kc-country-code-text",B="#code",C=['iframe[src*="captcha"]','iframe[src*="tcaptcha"]',"#tcaptcha","#tcaptcha_transform",".nc_iconfont",".nc_wrapper",'[class*="captcha"]','[id*="captcha"]',"text=滑块","text=拖动"],D=['[class*="avatar"]','[class*="user-info"]','[class*="logout"]',"text=退出登录","text=Logout","text=Sign out"],E=["#input-error",".pf-c-form__helper-text.pf-m-error",".kc-feedback-text"];async function F({page:a,phone:b,resolvePhone:c,pollSmsPromise:d,waitForSms:e,onStep:f,phoneFormatter:g=a=>a,timeouts:h={},signal:i=null,isCancelled:j=null}){let k=h.nav??3e4,l=h.action??15e3,m=h.codeWait??9e5,n=h.postSubmit??1e4,o=(a,b)=>f?.(a,b),p=()=>{if(i?.aborted||"function"==typeof j&&j()){let a=Error("Job cancelled");throw a.code="JOB_CANCELLED",a}};try{var q;let f,h;o("cn_opening_login_page","Opening CodeBuddy CN login page"),p();try{a.setDefaultNavigationTimeout(k),a.setDefaultTimeout(l)}catch{}try{await a.context().route("**/*",a=>{let b=a.request().url();return/googletagmanager|googleadservices|google-analytics|doubleclick|facebook|hotjar|clarity\.ms|hm\.baidu|google\.com\/rmkt/i.test(b)?a.abort():a.continue()})}catch{}let i=null,j=[];for(let b=1;b<=2;b++){p();try{let c=t[(b-1)%t.length];o("cn_nav_attempt",`Navigation attempt ${b}/2 → ${c}`),b>1&&(await a.context().clearCookies().catch(()=>{}),await a.waitForTimeout(800)),await a.goto(c,{waitUntil:"commit",timeout:k}),p(),await a.waitForFunction(()=>"loading"!==document.readyState,{timeout:1e4}).catch(()=>{}),p();let d=await I(a,w,{timeout:6e3});d&&(await d.click().catch(()=>{}),o("cn_consent_dismissed","Privacy consent dialog dismissed (同意)"),await a.waitForTimeout(1e3));let e=await J(a,v,25e3);if(p(),!e){let b=await a.locator("body").innerText().catch(()=>""),d=await a.evaluate(()=>document.documentElement?.outerHTML?.length||0).catch(()=>0),e=a.url();o("cn_spa_not_ready",`SPA not ready after 25s (url=${e}, body=${String(b).slice(0,80)}, html=${d})`),!b&&d<200?(o("cn_proxy_empty_page","Empty page body — proxy may be blocking codebuddy.cn"),j.push({code:"proxy_empty",detail:`empty page via ${c} (html=${d})`})):j.push({code:"spa_timeout",detail:`SPA not ready url=${e} html=${d}`});continue}o("cn_spa_ready","Login SPA ready"),o("cn_selecting_phone_tab","Selecting phone-number tab");let f=await I(a,u,{timeout:12e3});if(f?(await f.click().catch(()=>{}),o("cn_phone_tab_selected","Phone tab selected"),await a.waitForTimeout(800)):o("cn_phone_tab_not_found","Phone tab not found — checking if iframe already present"),o("cn_waiting_for_iframe","Waiting for phone iframe to load"),await a.locator(x).waitFor({state:"attached",timeout:18e3}).catch(()=>{}),i=await G(a)){if(await i.waitForSelector(y,{state:"visible",timeout:15e3}).then(()=>!0).catch(()=>!1)){o("cn_iframe_ready","Phone iframe + #phoneNumber ready");break}o("cn_iframe_empty","Iframe found but #phoneNumber not visible yet"),j.push({code:"iframe_empty",detail:"phone iframe attached but #phoneNumber not visible"}),i=null}else o("cn_iframe_missing",`No #phone-iframe (attempt ${b}/2)`),j.push({code:"iframe_missing",detail:"SPA loaded but #phone-iframe never appeared"})}catch(e){if(e?.code==="JOB_CANCELLED")throw e;let a=String(e?.message||e||"");o("cn_nav_retry",`Navigation attempt ${b}/2 failed: ${a.slice(0,120)}`);let c=/timeout|exceeded|ETIMEDOUT|net::ERR/i.test(a),d=/ERR_PROXY|ERR_TUNNEL|ERR_CONNECTION|NS_ERROR_PROXY|proxy/i.test(a);j.push({code:d?"proxy_network":c?"nav_timeout":"nav_error",detail:a.slice(0,160)})}}if(!i)return{status:"failed",error:function(a=[],b=2){let c=a.map(a=>a.code),d=a[a.length-1],e="Fix: use a live residential CN proxy (proxyPoolMode=single), concurrency 1, then retry. 5sim is not charged until the form loads.";return c.includes("proxy_empty")||c.includes("proxy_network")?`CodeBuddy CN login page empty/blocked via proxy after ${b} attempts (${d?.detail||"proxy blackhole"}). ${e}`:c.includes("nav_timeout")?`CodeBuddy CN navigation timed out after ${b} attempts (${d?.detail||"goto timeout"}). Proxy is too slow or dead. ${e}`:c.includes("spa_timeout")?`CodeBuddy CN SPA did not boot after ${b} attempts (${d?.detail||"no login UI"}). Proxy/CDN may be filtering JS. ${e}`:c.includes("iframe_missing")||c.includes("iframe_empty")?`CodeBuddy CN page opened but phone form iframe never appeared after ${b} attempts (${d?.detail||"no #phone-iframe"}). Site layout change or half-loaded SPA — retry with another CN exit IP. ${e}`:c.includes("nav_error")&&d?.detail?`CodeBuddy CN phone form failed after ${b} attempts: ${d.detail}. ${e}`:`Could not load CodeBuddy CN phone form after ${b} attempts (${d?.code||"unknown"}: ${d?.detail||"proxy/SPA"}). ${e}`}(j,2)};await i.waitForSelector("#kc-form-login",{timeout:l}).catch(()=>{}),await i.waitForSelector(y,{state:"visible",timeout:l}).catch(()=>{});let r=b;if("function"==typeof c&&(o("cn_ordering_after_form","Login form ready — ordering 5sim number now (not before nav)"),r=await c()),!r)return{status:"failed",error:"No phone number available (resolvePhone/phone missing)"};let s=g(r),{countryCode:z,localNumber:A}=(q=s,(!(h=String(q).replace(/[\s\-()]/g,"")).startsWith("+")&&/^\d+$/.test(h)&&(h="+"+h),h.startsWith("+852"))?{countryCode:"+852",localNumber:h.slice(4)}:h.startsWith("+86")?{countryCode:"+86",localNumber:h.slice(3)}:h.startsWith("+1")?{countryCode:"+1",localNumber:h.slice(2)}:{countryCode:"",localNumber:h.replace(/^\+/,"")});o("cn_selecting_country",`Selecting country code ${z} for phone ${s}`),await H(i,z,l,o),o("cn_entering_phone",`Entering phone number: ${A}`);let C=i.locator(y).first();try{await C.waitFor({state:"visible",timeout:l})}catch{return{status:"failed",error:"Could not find the phone number input (#phoneNumber) inside the iframe"}}await K(C,A),o("cn_phone_entered",`Phone number entered: ${A}`);try{let b=a.locator(".t-checkbox").last();await b.isVisible({timeout:3e3}).catch(()=>!1)&&(await b.click().catch(()=>{}),o("cn_agreement_checked","Agreement checkbox checked"))}catch{}o("cn_clicking_send_code","Clicking send SMS code button");let D=i.locator("input.btn-lg.code-btn").first(),E=!1;try{await D.waitFor({state:"visible",timeout:5e3}),E=!0}catch{let a=i.locator(".code-btn").first();try{await a.waitFor({state:"visible",timeout:5e3}),E=!0}catch{E=!1}}if(!E)return{status:"failed",error:"Could not find the send-SMS-code button (.code-btn) inside the iframe"};await D.click().catch(()=>{}),o("cn_send_code_clicked","Send code button clicked"),await i.waitForSelector(B,{state:"visible",timeout:5e3}).catch(()=>{});let F=await S(i);if(F)return{status:"failed",error:`Form error after sending code: ${F}`};o("cn_waiting_for_sms","Waiting for SMS verification code from 5sim (timer starts now)");try{let a;if("function"==typeof e)a=Promise.resolve().then(()=>e());else if(d)a=d;else throw Error("No waitForSms/pollSmsPromise provided");let b=new Promise((a,b)=>setTimeout(()=>b(Error("Timed out waiting for SMS code")),m));f=await Promise.race([a,b])}catch(a){if(a&&"FiveSimTimeoutError"===a.name)throw a;return{status:"failed",error:`Failed to receive SMS code: ${a.message}`}}if(!f)return{status:"failed",error:"Received empty SMS code from 5sim"};o("cn_sms_received",`SMS code received: ${f}`),o("cn_entering_code","Entering SMS verification code");let L=i.locator(B).first();try{await L.waitFor({state:"visible",timeout:l})}catch{return{status:"failed",error:"Could not find the verification code input (#code) inside the iframe"}}await K(L,f),o("cn_code_entered","Verification code entered");let M=Math.max(n,12e3),V=!1;for(let b=0;b<2;b++){o("cn_submitting",`Clicking submit button (attempt ${b+1}/2)`);let c=await G(a);if(!c){let b=await N(a,{timeoutMs:5e3,reportStep:o});if(b.ok)return o("cn_session_cookies",`Keycloak session after iframe detach (${b.cookie})`),{status:"success"};return{status:"failed",error:"Lost phone iframe after submit"}}if(await c.locator(y).first().isVisible({timeout:3e3}).catch(()=>!1)&&b>0){o("cn_re_entering_after_refresh",`Re-entering phone + code after refresh (retry ${b})`),await H(c,z,l,o);let d=c.locator(y).first();await K(d,A);try{let b=a.locator(".t-checkbox").first();await b.isVisible({timeout:2e3}).catch(()=>!1)&&await b.click().catch(()=>{})}catch{}let e=c.locator(B).first();await e.isVisible({timeout:3e3}).catch(()=>!1)&&await K(e,f)}if(await O(c,l),o("cn_submitted",`Registration form submitted (attempt ${b+1})`),await a.waitForLoadState("domcontentloaded",{timeout:5e3}).catch(()=>{}),await a.waitForTimeout(1e3),c=await G(a)||c,await R(c)){if(b>=1)return{status:"failed",error:"Account restricted (账号访问受限) after submit. Datacenter/VPS IP is usually blocked — use a residential CN proxy pool (proxyPoolMode=single) and retry."};o("cn_account_restricted",`Account restricted (attempt ${b+1}) — refreshing page and retrying`),await a.reload({waitUntil:"commit",timeout:k}).catch(()=>{}),await J(a,v,12e3);let c=await I(a,u,{timeout:8e3});c&&(await c.click().catch(()=>{}),await a.locator(x).waitFor({state:"attached",timeout:8e3}).catch(()=>{}));continue}if(o("cn_checking_captcha","Checking for captcha"),await T(a,c,3e3))return o("cn_captcha_detected","Captcha appeared during registration — manual assist needed"),{status:"needs_manual",error:"A captcha appeared during registration. Please complete it manually in the opened browser window.",captcha:!0};let d=await S(c);if(d)return{status:"failed",error:`Form error after submit: ${d}`};o("cn_waiting_session",`Waiting up to ${Math.round(M/1e3)}s for Keycloak session cookies`);let e=await N(a,{timeoutMs:M,reportStep:o,alsoCheckFrame:()=>G(a)});if(e.ok)return o("cn_session_cookies",`Keycloak session cookies present (${e.cookie}) — registration success`),{status:"success"};if(await P(a)&&b<1){o("cn_submit_no_effect","Login form still visible after submit — retrying");continue}o("cn_session_nudge","No session yet — navigating to home to complete OIDC handoff"),await a.goto("https://www.codebuddy.cn/",{waitUntil:"domcontentloaded",timeout:k}).catch(()=>{}),await a.waitForTimeout(2e3);let g=await N(a,{timeoutMs:1e4,reportStep:o});if(g.ok)return o("cn_session_cookies",`Keycloak session after home nudge (${g.cookie})`),{status:"success"};V=!0;break}if(!V)return o("cn_submit_retries_exhausted","Account restricted after 2 retries — needs manual"),{status:"needs_manual",error:"Account restricted after 2 refresh retries. Please try with a different VPN/proxy or complete manually."};o("cn_confirming_success","Confirming registration success");let W=await N(a,{timeoutMs:5e3});if(W.ok)return o("cn_registration_success",`Phone registration completed (Keycloak session: ${W.cookie})`),{status:"success"};if(await U(a,i,1e4))return o("cn_registration_success","Phone registration completed successfully (UI markers)"),{status:"success"};let X=await Q(a);return o("cn_success_unconfirmed",`No Keycloak session after submit — ${X.summary}`),{status:"needs_manual",error:`Login submit finished but no Keycloak session yet (${X.summary}). Complete login in the headed browser or retry with a fresh China proxy.`}}catch(a){if(a&&"FiveSimTimeoutError"===a.name)throw a;return o("cn_automation_error",`Phone registration automation error: ${a.message}`),{status:"failed",error:a.message||"Unexpected error during phone registration"}}}async function G(a){try{await a.locator(x).waitFor({state:"attached",timeout:5e3});let b=await a.locator(x).elementHandle({timeout:2e3});if(b){let a=await b.contentFrame();if(a)return a}}catch{}for(let b of a.frames()){let a=b.url();if(a.includes("codebuddy.cn/auth/realms/copilot")||a.includes("protocol/openid-connect"))return b}return null}async function H(a,b,c,d){if(!b)return;let e=Math.min(Number(c)||15e3,1e4),f=async()=>{let c=a.locator(A).first(),f=String(await c.textContent({timeout:3e3}).catch(()=>"")).trim();if(f===b)return void d?.("cn_country_already_selected",`Country code already ${b}`);d?.("cn_opening_country_dropdown",`Opening country dropdown (current: ${f}, target: ${b})`);let g=a.locator(".kc-country-selector").first();for(let c of(await g.waitFor({state:"visible",timeout:Math.min(e,5e3)}),await g.click({timeout:3e3}).catch(()=>{}),await a.locator(z).first().waitFor({state:"visible",timeout:3e3}).catch(()=>{}),({"+852":["中国香港","香港","Hong Kong","+852"],"+86":["中国大陆","中国","China","+86"],"+853":["中国澳门","澳门","Macau","+853"],"+886":["中国台湾","台湾","Taiwan","+886"]})[b]||[b]))for(let e of[a.locator(`${z}:has-text("${c}")`).first(),a.getByText(c,{exact:!1}).first()]){if(!await e.isVisible({timeout:1500}).catch(()=>!1))continue;let f=await e.textContent({timeout:1500}).catch(()=>c);await e.click({timeout:2e3}).catch(()=>{}),await a.locator(A).filter({hasText:b}).first().waitFor({state:"visible",timeout:2e3}).catch(()=>{}),d?.("cn_country_selected",`Country selected: ${String(f||c).trim()}`);return}d?.("cn_country_not_found",`Country code ${b} not found in dropdown; using default`),await a.locator("body").click({timeout:1e3}).catch(()=>{})};try{await Promise.race([f(),new Promise((a,b)=>{let c=setTimeout(()=>b(Error(`selectCountry timed out after ${e}ms`)),e);"function"==typeof c.unref&&c.unref()})])}catch(a){d?.("cn_country_select_error",`Country selection error: ${a.message}`)}}async function I(a,b,{timeout:c=1e4}={}){for(let d of b)try{let b=a.locator(d).first();return await b.waitFor({state:"visible",timeout:Math.min(c,5e3)}),b}catch{}return null}async function J(a,b,c=15e3){let d=Date.now()+c;for(;Date.now()<d;){for(let c of b)try{let b=a.locator(c).first();if(await b.isVisible().catch(()=>!1))return!0}catch{}await new Promise(a=>setTimeout(a,250))}return!1}async function K(a,b){try{return await a.click(),await a.fill(""),await a.fill(b),!0}catch{try{return await a.click(),await a.press("Control+a"),await a.type(b,{delay:50}),!0}catch{return!1}}}let L=["KEYCLOAK_IDENTITY","KEYCLOAK_SESSION","KEYCLOAK_IDENTITY_LEGACY","KEYCLOAK_SESSION_LEGACY"];function M(a=[]){for(let b of L)if(a.some(a=>a.name===b))return b;let b=a.find(a=>a.name.startsWith("KEYCLOAK_")&&!/locale|theme|restart/i.test(a.name));return b?.name||null}async function N(a,{timeoutMs:b=2e4,reportStep:c,alsoCheckFrame:d}={}){let e=Date.now()+b,f=0;for(;Date.now()<e;){let b=await a.context().cookies().catch(()=>[]),g=M(b);if(g)return{ok:!0,cookie:g,cookies:b};try{let c=a.url();if(c&&!c.includes("/login")&&!c.includes("/auth/realms")){let a=b.find(a=>/^(access_token|cb_token|codebuddy)/i.test(a.name)||"token"===a.name&&a.domain?.includes("codebuddy"));if(a)return{ok:!0,cookie:a.name,cookies:b}}}catch{}if(d){let a=await d().catch(()=>null);if(a){if(await R(a))return{ok:!1,cookies:b,reason:"restricted"};let c=await S(a);if(c)return{ok:!1,cookies:b,reason:`form_error:${c}`}}}if(c&&Date.now()-f>4e3){f=Date.now();let a=Math.max(0,Math.round((e-Date.now())/1e3));c("cn_waiting_session",`Still waiting for Keycloak session… ${a}s left`)}await a.waitForTimeout(500)}return{ok:!1,cookies:await a.context().cookies().catch(()=>[])}}async function O(a,b=15e3){let c=a.locator("#kc-login").first();try{await c.waitFor({state:"visible",timeout:b}),await c.click({timeout:5e3}).catch(()=>{})}catch{}try{await a.evaluate(()=>{let a=document.querySelector("#kc-form-login")||document.querySelector("form");if(a)if("function"==typeof a.requestSubmit){let b=a.querySelector("#kc-login")||a.querySelector('[type="submit"]');b?a.requestSubmit(b):a.requestSubmit()}else a.submit()})}catch{await a.locator(B).first().press("Enter").catch(()=>{})}}async function P(a){let b=await G(a);return!!b&&b.locator(y).first().isVisible({timeout:1500}).catch(()=>!1)}async function Q(a){let b="";try{b=a.url()}catch{b="(unknown)"}let c=(await a.context().cookies().catch(()=>[])).map(a=>a.name).slice(0,20).join(",")||"(none)",d="";try{d=await a.evaluate(()=>(document.body?.innerText||"").replace(/\s+/g," ").trim().slice(0,120))}catch{d=""}let e=await G(a),f="no-iframe";if(e)try{f=(await e.url()).slice(0,80)}catch{f="iframe-detached"}return{summary:`url=${b.slice(0,60)} cookies=[${c}] frame=${f}${d?` text="${d}"`:""}`,url:b,cookieNames:c,bodySnippet:d}}async function R(a){try{let b=await a.evaluate(()=>document.body?.innerText||"");if(b.includes("账号访问受限")||b.includes("安全策略限制")||b.includes("访问受限"))return!0}catch{}return!1}async function S(a){for(let b of E)try{let c=a.locator(b).first();if(await c.isVisible({timeout:1500}).catch(()=>!1)){let a=await c.textContent().catch(()=>""),b=String(a).trim();if(b&&b.length>1)return b}}catch{}try{let b=await a.evaluate(()=>(document.body?.innerText||"").replace(/\s+/g," ").trim());for(let a of["验证码错误","验证码已过期","验证码无效","请输入正确的验证码","手机号格式","发送过于频繁","Invalid","incorrect"])if(b.includes(a)){let c=b.indexOf(a);return b.slice(Math.max(0,c-10),c+a.length+40).trim()}}catch{}return null}async function T(a,b,c=5e3){for(let b of C)try{let d=a.locator(b).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}if(b)for(let a of C)try{let d=b.locator(a).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}return!1}async function U(a,b,c=15e3){try{let b=await a.context().cookies().catch(()=>[]);if(M(b))return!0}catch{}for(let b of D)try{let d=a.locator(b).first();if(await d.isVisible({timeout:Math.min(c,2e3)}).catch(()=>!1))return!0}catch{}try{let b=a.url(),c=await a.context().cookies().catch(()=>[]),d=new Set(c.map(a=>a.name));if(b&&!b.includes("/login")&&!b.includes("/auth/realms")&&(d.has("qcloud_uid")||d.has("qcmainCSRFToken"))&&!d.has("login_risk_state")&&!await P(a).catch(()=>!1))return!0}catch{}return!1}var V=c(40891),W=c(75949);let X=200,Y=Number.parseInt(process.env.ZEVAI_CN_ACCOUNT_TIMEOUT_MS||"",10)||72e4,Z=new Set(["hongkong","china","any"]),$="hongkong";function _(a){return String(a||"").trim()}async function aa({apiKey:a,phone:b,region:d,fiveSimOrderId:e,account:f}){let{createProviderConnection:g}=await Promise.resolve().then(c.bind(c,71998)),h={provider:"codebuddy-cn",authType:"apikey",apiKey:a,accessToken:a,name:b||`5sim-${e}`,email:b||`5sim-${e}`,providerSpecificData:{domain:"www.codebuddy.cn",phoneNumber:b,fiveSimOrderId:e,region:d,automation:"5sim-phone-bulk"},testStatus:"active"};return{connection:await g(h)}}class ab extends e.Q6{constructor({browserLauncher:a,requestDeviceCodeFn:b=V.cT,pollToken:d=V.ZV,fetchLoginAccountFn:e=V.w8,saveConnection:f=aa,fiveSimClientFactory:g=ac,phoneAutomation:h=F,phoneFormatter:j=_,pollIntervalMs:k=i.ne.pollInterval,storageName:l="codebuddy-cn-bulk-import"}={}){super({browserLauncher:a||(async a=>{let{launchBulkImportBrowser:b}=await Promise.resolve().then(c.bind(c,75949)),d=Array.isArray(a?.proxyUrls)&&a.proxyUrls.length?a.proxyUrls[0]:null,e=process.env.ZEVAI_CN_HEADLESS,f="linux"===process.platform;return("0"===e||"false"===e)&&(f=!1),("1"===e||"true"===e)&&(f=!0),b({engine:a?.engine||"camoufox",proxyUrl:d,headless:f,windowSize:{width:900,height:700}})}),storageName:l}),this.requestDeviceCode=b,this.pollToken=d,this.fetchLoginAccount=e,this.saveConnection=f,this.fiveSimClientFactory=g,this.phoneAutomation=h,this.phoneFormatter=j,this.pollIntervalMs=k}async startJob({count:a,concurrency:b,engine:g,proxyPoolMode:i,proxyPoolId:j,region:k}){let l=Number.parseInt(a,10);if(!Number.isFinite(l)||l<1)throw Object.assign(Error("At least one account is required (count >= 1)"),{error:"At least one account is required (count >= 1)"});if(l>X)throw Object.assign(Error(`Count exceeds maximum of ${X}`),{error:`Count exceeds maximum of ${X}`});let m=[...this.jobs.values()].find(a=>a&&("running"===a.status||"queued"===a.status||"needs_manual"===a.status)&&!a.cancelRequested);if(m)throw Object.assign(Error(`Another CodeBuddy CN job is still active (${m.jobId}). Cancel it or wait before starting again.`),{error:`Another CodeBuddy CN job is still active (${m.jobId}). Cancel it or wait before starting again.`});let n=Z.has(k)?k:$,o=[];if("all"===i)o=(await (0,f.ui)({isActive:!0})).map(a=>a.proxyUrl).filter(Boolean);else if("single"===i&&j){let a=await (0,f.hr)(j);a?.isActive&&a?.proxyUrl&&(o=[a.proxyUrl])}let p=(0,d.randomUUID)(),q=(0,e.kF)(),{normalizeBulkImportEngine:r}=await Promise.resolve().then(c.bind(c,75949)),s=g?r(g):"camoufox",t={jobId:p,status:"running",concurrency:function(a){let b=function(){try{let{totalMemGb:a}=(0,h.si)();return Number.isFinite(a)&&a>0&&a<3}catch{return!1}}()?1:8;if((0,h.uT)(a))return Math.min(b,Math.max(1,(0,h.q)()));let c=Number.parseInt(a,10);return Number.isFinite(c)?Math.min(b,Math.max(1,c)):Math.min(b,1)}(b),engine:s,proxyPoolMode:i||"none",proxyUrls:o,region:n,createdAt:q,startedAt:q,finishedAt:null,error:null,cancelRequested:!1,browser:null,nextIndex:0,manualFollowups:new Set,persistPromise:Promise.resolve(),lastPreview:null,lastPreviewCapturedAt:0,accounts:Array.from({length:l},(a,b)=>({line:b+1,region:n,phone:null,fiveSimOrderId:null,fiveSimActivationId:null,proxyUrl:null,abortController:new AbortController,status:"queued",error:null,connectionId:null,workerId:null,manualSession:null,runtimeSession:null,currentStep:"queued",updatedAt:q,logs:[(0,e.hn)("queued","Queued and waiting for an available worker")]}))};return this.jobs.set(p,t),this.latestJobId=p,await this.persistJobSnapshot(t,{forcePreview:!1}),this.runJob(p),ad(t)}getJob(a){let b=this.jobs.get(a);return b?ad(b):null}async getJobWithPreview(a){let b=this.jobs.get(a);return b?(await this.persistJobSnapshot(b,{forcePreview:!1}),ad(b,{preview:b.lastPreview||null})):null}async processAccount(a,b,c){if(a.cancelRequested||!a.browser)return void this.finalizeAccount(b,"cancelled",{error:"Job cancelled"});let d=null,f=null,h=!1,i=null;try{let c;this.setAccountStep(b,"reading_settings","Reading 5sim API key from settings"),await this.persistJobSnapshot(a,{forcePreview:!0});let j=(await (0,g.mt)()).fiveSimApiKey;if(!j||!j.trim()){this.finalizeAccount(b,"failed",{error:"5sim API key not configured. Set it in the automation modal or dashboard settings.",step:"failed",message:"5sim API key not configured"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}d=this.fiveSimClientFactory({apiKey:j,proxyOptions:null}),this.setAccountStep(b,"creating_browser","Creating browser context (before 5sim order)"),await this.persistJobSnapshot(a,{forcePreview:!0});let k=await (0,e.go)(a.browser,b.proxyUrl);i=k.context;let l=k.page;if(b.runtimeSession={context:i,page:l},a.cancelRequested)throw Error("Job cancelled before ordering phone number");this.setAccountStep(b,"registering","Running phone registration on CodeBuddy CN"),await this.persistJobSnapshot(a,{forcePreview:!0});try{l.setDefaultTimeout(2e4),l.setDefaultNavigationTimeout(45e3)}catch{}let m=null,n=new Promise((a,b)=>{m=setTimeout(()=>{b(Object.assign(Error(`CodeBuddy CN account hard timeout after ${Math.round(Y/1e3)}s (browser will be force-closed)`),{code:"CN_ACCOUNT_HARD_TIMEOUT"}))},Y),"function"==typeof m.unref&&m.unref()});try{c=await Promise.race([this.phoneAutomation({page:l,signal:b.abortController?.signal,isCancelled:()=>!0===a.cancelRequested,resolvePhone:async()=>{if(a.cancelRequested)throw Error("Job cancelled before ordering phone number");this.setAccountStep(b,"ordering_number",`Form ready — ordering ${a.region} phone from 5sim (single buy)`),await this.persistJobSnapshot(a,{forcePreview:!0});let c=await d.buyNumber({country:a.region,product:"codebuddy",allowProductFallback:!1});return f=c.id,b.phone=c.phone,b.fiveSimOrderId=c.id,b.fiveSimActivationId=c.id,this.setAccountStep(b,"number_ordered",`Phone number ordered: ${c.phone} (1 buy, no re-order)`),await this.persistJobSnapshot(a,{forcePreview:!0}),c.phone},waitForSms:async()=>{if(!f)throw Error("Cannot poll SMS — no 5sim order id");this.setAccountStep(b,"sms_poll_started","SMS poll started (full 90s window after send-code)"),await this.persistJobSnapshot(a,{forcePreview:!1});let c=await d.pollCode(f,{timeoutMs:9e4,signal:b.abortController?.signal});return h=!0,c},onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})},phoneFormatter:this.phoneFormatter}),n])}finally{m&&clearTimeout(m)}if("failed"===c.status){let e=c.error||"Phone registration failed before submit";this.finalizeAccount(b,"failed",{error:e,step:"failed",message:e}),d&&f&&(h?await d.finishOrder(f):await d.cancelOrder(f)),b.runtimeSession=null,await i.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}await this.captureApiKey(a,b,i,l,d,f);return}catch(g){let c=g instanceof n,e=c?"SMS OTP not received within 90s — number banned":g.message||"Unexpected CodeBuddy CN bulk import failure";if(this.finalizeAccount(b,"failed",{error:e,step:c?"sms_timeout":"failed",message:e}),d&&f&&(h?await d.finishOrder(f):c?await d.banOrder(f):await d.cancelOrder(f)),b.runtimeSession=null,i&&await i.close().catch(()=>null),(g?.code==="CN_ACCOUNT_HARD_TIMEOUT"||a.cancelRequested)&&a.browser){let b=a.browser;a.browser=null,await (0,W.forceCloseBrowser)(b).catch(()=>null)}await this.persistJobSnapshot(a,{forcePreview:!0})}}async captureApiKey(a,b,c,d,e,f){let g="personal-edition-user-id",h=async(a,{timeout:b=12e3,interval:c=150}={})=>{let d=Date.now()+b;for(;Date.now()<d;){try{if(await a())return!0}catch{}await new Promise(a=>setTimeout(a,c))}return!1};try{this.setAccountStep(b,"waiting_session","Establishing CodeBuddy console session (probe APIs, not just cookies)"),await this.persistJobSnapshot(a,{forcePreview:!0});let i=async()=>{let a=await c.cookies().catch(()=>[]);return{cookies:a,names:new Set(a.map(a=>a.name)),list:a.map(a=>a.name)}},j=a=>a.has("KEYCLOAK_IDENTITY")||a.has("KEYCLOAK_SESSION")||a.has("KEYCLOAK_IDENTITY_LEGACY")||a.has("KEYCLOAK_SESSION_LEGACY"),k=a=>a.has("AUTH_SESSION_ID")||a.has("session")||a.has("qcloud_uid")||a.has("qcmainCSRFToken")||a.has("x_host_key_access"),l=async()=>d.evaluate(async()=>{try{let a=(window.location.hostname||"www.codebuddy.cn").endsWith("codebuddy.cn")?`${window.location.origin}`:"https://www.codebuddy.cn",b=await fetch(`${a}/console/accounts`,{credentials:"include",headers:{Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":"www.codebuddy.cn","X-Product":"SaaS"}}),c=await b.text().catch(()=>""),d=null;try{d=c?JSON.parse(c):null}catch{d={_raw:String(c||"").slice(0,240),_notJson:!0}}return{status:b.status,data:d,text:String(c||"").slice(0,240)}}catch(a){return{status:0,error:a?.message||String(a)}}}).catch(()=>null),m=a=>{let b=a?.data;if(!b||"object"!=typeof b)return[];for(let a of[b?.data?.accounts,b?.accounts,b?.data?.list,b?.list,b?.data?.result,b?.result,b?.data?.items,b?.items,Array.isArray(b?.data)?b.data:null,Array.isArray(b)?b:null])if(Array.isArray(a)&&a.length>0)return a;return[]},n=async()=>{await Promise.race([d.waitForResponse(a=>/\/console\/accounts/i.test(a.url())&&500>a.status(),{timeout:1e4}).catch(()=>null),d.waitForResponse(a=>/\/console\/api\//i.test(a.url())&&500>a.status(),{timeout:1e4}).catch(()=>null),h(async()=>{let a=await i();return j(a.names)},{timeout:1e4,interval:200}),new Promise(a=>setTimeout(a,2500))])},o=["https://www.codebuddy.cn/","https://www.codebuddy.cn/console","https://www.codebuddy.cn/console/","https://www.codebuddy.cn/profile","https://www.codebuddy.cn/profile/keys","https://www.codebuddy.cn/login/"],p=[],q=null,r=!1,s="";for(let c=0;c<10;c+=1){if(a.cancelRequested)throw Error("Job cancelled while establishing session");let e=await i(),f=j(e.names),g=k(e.names),h=o[Math.min(c,o.length-1)];if(c<3||c%2==0||!g?(this.setAccountStep(b,"waiting_session",`OIDC handoff ${c+1}/10 → ${h.replace("https://www.codebuddy.cn","")} (${f?"KEYCLOAK":g?"soft-session":"weak"})`),await this.persistJobSnapshot(a,{forcePreview:!1}),await d.goto(h,{waitUntil:"domcontentloaded",timeout:25e3}).catch(()=>null),await n()):await new Promise(a=>setTimeout(a,300)),/codebuddy\.cn/i.test(d.url?.()||"")&&(String(d.url()||"").includes("/console")||!(c>=1))||(await d.goto("https://www.codebuddy.cn/console",{waitUntil:"domcontentloaded",timeout:25e3}).catch(()=>null),await n()),q=await l(),p=m(q),s=JSON.stringify(q?.data??q?.text??null).slice(0,180),q?.status===200&&Array.isArray(p)&&p.length>0){r=!0,this.setAccountStep(b,"session_ready",`Console session accepted (HTTP 200, ${p.length} account(s)${f?", KEYCLOAK ok":", soft session"})`),await this.persistJobSnapshot(a,{forcePreview:!0});break}if(g&&q?.status===200&&Array.isArray(p)&&0===p.length&&c>=4){this.setAccountStep(b,"session_soft","Console HTTP 200 but 0 accounts — trying personal API key with soft session (cookies ok)"),await this.persistJobSnapshot(a,{forcePreview:!0}),r=!0;break}this.setAccountStep(b,"resolving_enterprise",`Console not ready (HTTP ${q?.status||0}, accounts=${p.length}) — ${c+1}/10 body=${s.slice(0,80)}`),await this.persistJobSnapshot(a,{forcePreview:!1})}if(!r){let a=await i();throw Error(`Console accounts unavailable after login (HTTP ${q?.status||0}; cookies: ${a.list.slice(0,18).join(",")||"(none)"}; body=${s.slice(0,120)}) — session not accepted for API key`)}let t=g;if(Array.isArray(p)&&p.length>0){let a=p.find(a=>a?.lastLogin)||p[0];a?.type&&"personal"!==a.type&&a.enterpriseId?t=a.enterpriseId:a?.enterpriseId&&a?.type!=="personal"&&(t=a.enterpriseId)}this.setAccountStep(b,"creating_api_key",`Creating API key (enterprise=${t}, accounts=${p.length})`),await this.persistJobSnapshot(a,{forcePreview:!0});let u=async a=>d.evaluate(async({enterpriseId:a})=>{let b=(window.location.hostname||"www.codebuddy.cn").endsWith("codebuddy.cn")?window.location.origin:"https://www.codebuddy.cn",c=await fetch(`${b}/console/api/client/v1/api-keys`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":"www.codebuddy.cn","X-Product":"SaaS"},body:JSON.stringify({name:`zevai-router-${Date.now()}`,expire_in_days:365,user_enterprise_id:a})}),d=await c.text().catch(()=>""),e=null;try{e=d?JSON.parse(d):null}catch{e={_raw:String(d||"").slice(0,200)}}return{ok:c.ok,status:c.status,data:e}},{enterpriseId:a});await d.goto("https://www.codebuddy.cn/profile/keys",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n();let v=await u(t).catch(()=>null);v&&v.ok||t===g||(this.setAccountStep(b,"retrying_api_key","Retrying with personal-edition enterprise id"),await this.persistJobSnapshot(a,{forcePreview:!1}),v=await u(g).catch(()=>null)),v&&v.ok||(this.setAccountStep(b,"retrying_api_key","Retrying API key from /console"),await this.persistJobSnapshot(a,{forcePreview:!0}),await d.goto("https://www.codebuddy.cn/console",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n(),await d.goto("https://www.codebuddy.cn/profile/keys",{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n(),v=await u(g).catch(()=>null));let w=a=>!a?.ok&&(a?.status===401||a?.status===403||a?.status===0||!a);for(let c=1;c<=3&&w(v);c+=1){for(let e of(this.setAccountStep(b,"retrying_api_key",`API key 401/403 — OIDC re-handoff round ${c}/3 (waiting strong session)`),await this.persistJobSnapshot(a,{forcePreview:!0}),["https://www.codebuddy.cn/","https://www.codebuddy.cn/console","https://www.codebuddy.cn/profile/keys"]))await d.goto(e,{waitUntil:"domcontentloaded",timeout:45e3}).catch(()=>null),await n();await h(async()=>{let a=await i();return j(a.names)},{timeout:8e3*c,interval:300}).catch(()=>null),v=await u(g).catch(()=>null)}let x=v?.data?.code;if(!v||!v.ok||!v.data||0!==x&&200!==x&&void 0!==x){let a="string"==typeof v?.data?._raw?v.data._raw.replace(/\s+/g," ").slice(0,120):null,b=a&&/openresty|nginx|Authorization Required/i.test(a)?" [edge proxy blocked — session half-baked]":"";throw Error(`API key creation failed (HTTP ${v?.status??"no-response"}, code=${x??"n/a"})${b}: ${JSON.stringify(v?.data??null).slice(0,200)}`)}let y=v.data?.data||v.data,z=y?.apiKey||y?.key||y?.token||y?.secret||y?.api_key||("string"==typeof y?y:null)||v.data.apiKey||v.data.key||v.data.token||v.data.secret;if(!z||"string"!=typeof z)throw Error(`API key response did not contain a key field: ${JSON.stringify(v.data).slice(0,300)}`);this.setAccountStep(b,"api_key_created","API key created successfully"),await this.persistJobSnapshot(a,{forcePreview:!0}),this.setAccountStep(b,"saving_connection","Saving CodeBuddy CN connection"),await this.persistJobSnapshot(a,{forcePreview:!0});let{connection:A}=await this.saveConnection({apiKey:z,phone:b.phone,region:b.region,fiveSimOrderId:f,account:b});await e.finishOrder(f),this.finalizeAccount(b,"success",{connectionId:A.id,step:"connection_saved",message:`CodeBuddy CN connection saved (phone: ${b.phone})`}),b.runtimeSession=null,await c.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(g){this.finalizeAccount(b,"needs_manual",{error:`Registration succeeded but API key capture failed: ${g.message}`,step:"awaiting_manual",message:`Registration done, API key capture failed: ${g.message}`}),await e.finishOrder(f).catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0}),await this.runCnManualFollowup(a,b,b.workerId,c,d,e,f)}}async runCnManualFollowup(a,b,c,d,e,f,g){let h=(async()=>{let c=async()=>{let a=b.manualSession,c=a?.context||d,e=a?.headedBrowser||null;c&&await c.close().catch(()=>null),e&&await e.close().catch(()=>null)};try{this.setAccountStep(b,"manual_waiting","Waiting for operator to complete in headed browser"),await this.persistJobSnapshot(a,{forcePreview:!0});let c=Date.now()+9e5,d=null;for(;Date.now()<c&&!a.cancelRequested;){await new Promise(a=>setTimeout(a,1e4));try{if(!e.url().includes("codebuddy.cn"))continue;let a=await e.evaluate(async()=>{let a=await fetch("/console/api/client/v1/api-keys",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","X-Domain":window.location.hostname||"www.codebuddy.cn","X-Product":"SaaS"},credentials:"include",body:JSON.stringify({name:"zevai-router-manual-"+Date.now(),expire_in_days:365,user_enterprise_id:"personal-edition-user-id"})}),b=await a.json().catch(()=>null);return{ok:a.ok,status:a.status,data:b}});if(a?.ok&&a.data){let b=a.data?.data||a.data;if((d=b?.apiKey||b?.key||b?.token||b?.secret||b?.api_key||("string"==typeof b?b:null))&&"string"==typeof d)break}}catch{}}if(a.cancelRequested){this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}if(!d)throw Error("Manual assist timed out — could not capture API key");this.setAccountStep(b,"saving_connection","Saving CodeBuddy CN connection (manual)"),await this.persistJobSnapshot(a,{forcePreview:!0});let{connection:f}=await this.saveConnection({apiKey:d,phone:b.phone,region:b.region,fiveSimOrderId:g,account:b});this.finalizeAccount(b,"success",{connectionId:f.id,step:"connection_saved",message:`CodeBuddy CN connection saved via manual assist (phone: ${b.phone||"N/A"})`}),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}):this.finalizeAccount(b,"failed",{error:c.message||"Manual assist flow failed",step:"failed",message:c.message||"Manual assist flow failed"}),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{await c(),b.manualSession=null,b.runtimeSession=null,a.manualFollowups.delete(h),await this.persistJobSnapshot(a,{forcePreview:!0})}})();a.manualFollowups.add(h)}cancelJob(a){let b=this.jobs.get(a);if(!b)return null;for(let a of(b.cancelRequested=!0,b.accounts)){a.abortController&&!a.abortController.signal.aborted&&a.abortController.abort();let b=a.runtimeSession?.context;b&&b.close().catch(()=>null),a.runtimeSession=null,a.manualSession=null}if(b.browser){let a=b.browser;b.browser=null,(0,W.forceCloseBrowser)(a).catch(()=>null)}return"queued"===b.status&&(b.status="cancelled",b.finishedAt=(0,e.kF)(),b.accounts.forEach(a=>{"queued"===a.status&&(a.status="cancelled")})),this.persistJobSnapshot(b,{forcePreview:!0}),ad(b)}}function ac({apiKey:a,proxyOptions:b}){return new q({apiKey:a,proxyOptions:b})}function ad(a,b={}){return a?{jobId:a.jobId,status:a.status,summary:function(a=[]){let b={total:a.length,queued:0,running:0,completed:0,success:0,failed:0,needs_manual:0,cancelled:0};for(let c of a){let a=c.status||"queued";"success"===a?(b.success+=1,b.completed+=1):"failed"===a||"failed_exchange"===a?(b.failed+=1,b.completed+=1):"needs_manual"===a?b.needs_manual+=1:"cancelled"===a?(b.cancelled+=1,b.completed+=1):"running"===a?b.running+=1:b.queued+=1}return b}(a.accounts),concurrency:a.concurrency,engine:a.engine,proxyPoolMode:a.proxyPoolMode,region:a.region,createdAt:a.createdAt,startedAt:a.startedAt,finishedAt:a.finishedAt,error:a.error,cancelRequested:a.cancelRequested,accounts:(a.accounts||[]).map(a=>({line:a.line,region:a.region,phone:a.phone,fiveSimOrderId:a.fiveSimOrderId,proxyUrl:a.proxyUrl?function(a){if(!a)return null;try{let b=new URL(a);return b.password&&(b.password="***"),b.toString()}catch{return a}}(a.proxyUrl):null,status:a.status,error:a.error,connectionId:a.connectionId,workerId:a.workerId,manualSessionAvailable:!!a.manualSession,currentStep:a.currentStep,updatedAt:a.updatedAt,logs:a.logs||[]})),preview:void 0!==b.preview?b.preview:a.lastPreview||null,...b}:null}function ae(){return(!globalThis.__codeBuddyCnBulkImportSingleton&&(globalThis.__codeBuddyCnBulkImportSingleton={manager:new ab}),globalThis.__codeBuddyCnBulkImportSingleton).manager}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/BEit7P9cwXUO_ME79G3cB/_buildManifest.js","static/BEit7P9cwXUO_ME79G3cB/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-948b910ed7afd0b8.js","static/chunks/4bd1b696-e356ca5ba0218e27.js","static/chunks/3794-c66b3d8325973459.js","static/chunks/main-app-5a6578c0256da676.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|