@ikyyofc/gemini-cli 5.0.4 โ 5.0.6
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/README.md +97 -63
- package/package.json +1 -1
- package/src/agent.js +92 -22
- package/src/gemini.js +180 -1
- package/src/tools.js +218 -28
- package/src/utils/proxy.js +187 -1
package/README.md
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# Gemini CLI ๐ค
|
|
2
2
|
|
|
3
|
-
> AI Agent CLI โ native function calling ยท
|
|
3
|
+
> AI Agent CLI โ native function calling ยท GEMINI.md context ยท extension system
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
โโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโ
|
|
7
|
+
โโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโ
|
|
8
|
+
โโโ โโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโ
|
|
9
|
+
โโโ โโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
10
|
+
โโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโ โโโโโโโโโ
|
|
11
|
+
โโโโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโ
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
Gemini CLI adalah asisten terminal bertenaga AI yang menggunakan model Gemini dari Google. CLI ini bukan sekadar antarmuka chat biasa, melainkan sebuah **AI Agent** yang dapat berinteraksi langsung dengan sistem file, menjalankan perintah shell, dan menggunakan *skills* pihak ketiga secara mandiri (*native function calling*).
|
|
12
|
-
|
|
13
14
|
---
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## Instalasi
|
|
16
17
|
|
|
17
18
|
```bash
|
|
18
19
|
npm install
|
|
@@ -22,69 +23,103 @@ npm link # optional: pakai sebagai `gemini` di terminal
|
|
|
22
23
|
|
|
23
24
|
---
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
Anda dapat menggunakan Gemini CLI dalam mode interaktif (REPL) atau mode *one-shot* langsung dari terminal.
|
|
26
|
+
## Penggunaan
|
|
28
27
|
|
|
29
28
|
```bash
|
|
30
|
-
gemini
|
|
31
|
-
gemini "buatkan REST API di ./api"
|
|
32
|
-
gemini --system "Kamu senior backend engineer"
|
|
33
|
-
gemini --file ./app.js "jelaskan kode ini"
|
|
34
|
-
gemini --yolo "refactor semua file di src/"
|
|
35
|
-
gemini --chat
|
|
29
|
+
gemini # interactive agent
|
|
30
|
+
gemini "buatkan REST API di ./api" # one-shot
|
|
31
|
+
gemini --system "Kamu senior backend engineer"
|
|
32
|
+
gemini --file ./app.js "jelaskan kode ini"
|
|
33
|
+
gemini --yolo "refactor semua file di src/"
|
|
34
|
+
gemini --chat # plain chat tanpa tools
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/
|
|
52
|
-
/
|
|
53
|
-
/cd <path> โ Change working directory
|
|
54
|
-
/cwd โ Show current working directory
|
|
55
|
-
/new /clear โ Reset conversation
|
|
56
|
-
/model โ Show model & config
|
|
57
|
-
/help โ Show help
|
|
58
|
-
/exit /quit โ Exit
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## GEMINI.md โ Context Files
|
|
40
|
+
|
|
41
|
+
Buat `GEMINI.md` di lokasi berikut (dimuat hierarki, seperti Gemini CLI asli):
|
|
42
|
+
|
|
43
|
+
| Lokasi | Scope |
|
|
44
|
+
|--------|-------|
|
|
45
|
+
| `~/.gemini/GEMINI.md` | Global semua project |
|
|
46
|
+
| `./GEMINI.md` | Project root (sampai `.git`) |
|
|
47
|
+
|
|
48
|
+
Support import antar file:
|
|
49
|
+
```md
|
|
50
|
+
@./components/style.md
|
|
51
|
+
@../shared/conventions.md
|
|
59
52
|
```
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
**Commands:**
|
|
55
|
+
```
|
|
56
|
+
/memory show โ tampilkan semua context yang dimuat
|
|
57
|
+
/memory reload โ reload dari disk
|
|
58
|
+
/memory add <text> โ append ke ~/.gemini/GEMINI.md
|
|
59
|
+
```
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
---
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
## Extensions
|
|
64
|
+
|
|
65
|
+
Manifest: `~/.gemini/extensions/<name>/gemini-extension.json`
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"name": "my-ext",
|
|
70
|
+
"version": "1.0.0",
|
|
71
|
+
"description": "...",
|
|
72
|
+
"contextFileName": "GEMINI.md",
|
|
73
|
+
"enabled": true,
|
|
74
|
+
"commands": {
|
|
75
|
+
"do-thing": {
|
|
76
|
+
"description": "Does a thing",
|
|
77
|
+
"prompt": "Do this: {{args}}"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
**Commands:**
|
|
84
|
+
```
|
|
85
|
+
/ext list
|
|
86
|
+
/ext install /path/to/ext
|
|
87
|
+
/ext install https://github.com/user/repo
|
|
88
|
+
/ext uninstall <name>
|
|
89
|
+
/ext enable / disable <name>
|
|
90
|
+
/ext update <name>
|
|
91
|
+
```
|
|
71
92
|
|
|
72
|
-
|
|
73
|
-
Berikan instruksi spesifik proyek atau global menggunakan file `GEMINI.md`. Agent akan memuat konteks ini secara otomatis. Gunakan `/memory` untuk mengatur teks konteks di memori secara dinamis selama sesi berlangsung.
|
|
93
|
+
Custom commands dipanggil: `/code-reviewer:review ./src/app.js`
|
|
74
94
|
|
|
75
|
-
|
|
76
|
-
Perluas kemampuan CLI dengan membuat ekstensi yang berisi custom commands dan konteks tambahan. Kelola menggunakan perintah `/ext`.
|
|
95
|
+
---
|
|
77
96
|
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
## Tools (Native Function Calling)
|
|
98
|
+
|
|
99
|
+
| Tool | Aksi |
|
|
100
|
+
|------|------|
|
|
101
|
+
| `read_file` | Baca file |
|
|
102
|
+
| `write_file` | Tulis/overwrite file |
|
|
103
|
+
| `patch_file` | Edit bagian spesifik |
|
|
104
|
+
| `append_file` | Append ke file |
|
|
105
|
+
| `list_dir` | List direktori |
|
|
106
|
+
| `find_files` | Cari file (glob) |
|
|
107
|
+
| `search_in_files` | Grep dalam file |
|
|
108
|
+
| `run_shell` | Jalankan shell command |
|
|
109
|
+
| `create_dir` | Buat direktori |
|
|
110
|
+
| `delete_file` | Hapus file |
|
|
111
|
+
| `move_file` | Pindah/rename |
|
|
112
|
+
| `get_env` | Info environment |
|
|
113
|
+
| `read_url` | Fetch URL / API |
|
|
80
114
|
|
|
81
115
|
---
|
|
82
116
|
|
|
83
|
-
##
|
|
117
|
+
## Struktur
|
|
84
118
|
|
|
85
|
-
```
|
|
119
|
+
```
|
|
86
120
|
gemini-cli/
|
|
87
121
|
โโโ index.js โ CLI entry + REPL + commands
|
|
122
|
+
โโโ GEMINI.md โ Project context (auto-loaded)
|
|
88
123
|
โโโ package.json
|
|
89
124
|
โโโ src/
|
|
90
125
|
โ โโโ gemini.js โ API client (native function calling)
|
|
@@ -92,15 +127,14 @@ gemini-cli/
|
|
|
92
127
|
โ โโโ agent.js โ ReAct loop
|
|
93
128
|
โ โโโ memory.js โ GEMINI.md hierarchy loader
|
|
94
129
|
โ โโโ extensions.js โ Extension manager
|
|
95
|
-
โ
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
โโโ
|
|
104
|
-
|
|
105
|
-
โโโ commands/ โ Global custom commands
|
|
130
|
+
โ โโโ renderer.js โ Terminal UI + markdown
|
|
131
|
+
โโโ extensions/
|
|
132
|
+
โโโ code-reviewer/
|
|
133
|
+
โโโ gemini-extension.json
|
|
134
|
+
โโโ GEMINI.md
|
|
135
|
+
|
|
136
|
+
~/.gemini/ โ Global config dir
|
|
137
|
+
โโโ GEMINI.md
|
|
138
|
+
โโโ extensions/
|
|
139
|
+
โโโ commands/
|
|
106
140
|
```
|
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
// src/agent.js โ ReAct agent loop with
|
|
2
|
-
import chalk
|
|
1
|
+
// src/agent.js โ ReAct agent loop with planning + confirmation phase
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import readline from "readline";
|
|
3
4
|
import { callGemini } from "./gemini.js";
|
|
4
5
|
import { GEMINI_TOOLS, FUNCTION_DECLARATIONS, executeTool } from "./tools.js";
|
|
5
6
|
import { Spinner } from "./utils/spinner.js";
|
|
6
|
-
import { loadSkills
|
|
7
|
+
import { loadSkills } from "./skills.js";
|
|
7
8
|
import {
|
|
8
|
-
printAssistant, printError, printWarning,
|
|
9
|
+
printAssistant, printError, printWarning, printInfo,
|
|
9
10
|
printToolCall, printToolResult,
|
|
10
11
|
printStepHeader, printStepFooter, bw,
|
|
11
12
|
} from "./renderer.js";
|
|
@@ -22,30 +23,21 @@ function buildSystemPrompt(extra = "") {
|
|
|
22
23
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
23
24
|
const datetime = now.toLocaleString("id-ID", { timeZone: tz, dateStyle: "full", timeStyle: "long" });
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
?
|
|
27
|
-
Skills contain expert instructions. Before starting any task:
|
|
28
|
-
1. Review the list below
|
|
29
|
-
2. Identify which skill(s) apply
|
|
30
|
-
3. Read them with read_file BEFORE doing anything else
|
|
31
|
-
4. Follow the skill instructions exactly
|
|
32
|
-
|
|
33
|
-
${skills.map(s =>
|
|
34
|
-
`- **${s.slug}**: ${s.description}\n โ read_file("${SKILLS_DIR}/${s.slug}/SKILL.md")`
|
|
35
|
-
).join("\n")}`
|
|
26
|
+
const skillHint = skills.length
|
|
27
|
+
? "\n## SKILLS\nALWAYS call get_skills() first before starting any task."
|
|
36
28
|
: "";
|
|
37
29
|
|
|
38
30
|
return `You are an autonomous AI coding agent running in the user's terminal.
|
|
39
31
|
|
|
40
32
|
## CURRENT TIME
|
|
41
33
|
${datetime} (${tz})
|
|
42
|
-
${
|
|
34
|
+
${skillHint}
|
|
43
35
|
|
|
44
|
-
## CORE RULE โ NEVER ASK, ALWAYS ACT
|
|
45
|
-
|
|
36
|
+
## CORE RULE โ NEVER ASK, ALWAYS ACT (during execution)
|
|
37
|
+
Once a plan is approved, use tools to complete the task fully. Never instruct the user to do anything themselves.
|
|
46
38
|
|
|
47
39
|
## WORKFLOW
|
|
48
|
-
1.
|
|
40
|
+
1. CALL get_skills() โ always check for expert skill instructions first
|
|
49
41
|
2. EXPLORE โ understand the project structure
|
|
50
42
|
3. ACT โ complete the task fully using tools
|
|
51
43
|
4. VERIFY โ test after changes
|
|
@@ -77,6 +69,60 @@ function printThinkBlock(text) {
|
|
|
77
69
|
process.stdout.write(chalk.hex("#2A2A40")(" โฐ" + "โ".repeat(bw() + 1)) + "\n\n");
|
|
78
70
|
}
|
|
79
71
|
|
|
72
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
73
|
+
// Ask user for plan confirmation
|
|
74
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
75
|
+
function askUser(question) {
|
|
76
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
77
|
+
return new Promise(res => {
|
|
78
|
+
rl.question(
|
|
79
|
+
"\n" + chalk.hex("#4A9EFF")(" โฏ ") + chalk.white(question) +
|
|
80
|
+
chalk.hex("#555566")(" [y / n / type changes] โบ "),
|
|
81
|
+
ans => { rl.close(); res(ans.trim()); }
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
87
|
+
// Planning phase
|
|
88
|
+
// Agent explains its understanding + plan BEFORE touching any tool.
|
|
89
|
+
// User can approve, reject, or request changes.
|
|
90
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
91
|
+
async function planningPhase(userMessage, fullSystem) {
|
|
92
|
+
const planningPrompt = `${fullSystem}
|
|
93
|
+
|
|
94
|
+
## PLANNING MODE โ ACTIVE
|
|
95
|
+
The user just sent a request. Do NOT call any tools yet.
|
|
96
|
+
Respond with ONLY:
|
|
97
|
+
1. A one-line restatement of what you understood
|
|
98
|
+
2. A short numbered plan (3-6 steps) of what you will do
|
|
99
|
+
3. Any clarifying question if something is ambiguous
|
|
100
|
+
|
|
101
|
+
Be concise โ a few lines, not an essay. The user will approve or adjust this plan before you proceed.`;
|
|
102
|
+
|
|
103
|
+
const spinner = new Spinner();
|
|
104
|
+
spinner.start("planningโฆ", "#C586FF");
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const { parts } = await callGemini({
|
|
108
|
+
messages: [{ role: "user", content: userMessage }],
|
|
109
|
+
systemInstruction: planningPrompt,
|
|
110
|
+
});
|
|
111
|
+
spinner.stop();
|
|
112
|
+
|
|
113
|
+
const thought = parts.filter(p => p.thought && p.text).map(p => p.text).join("").trim();
|
|
114
|
+
const plan = parts.filter(p => p.text && !p.thought).map(p => p.text).join("").trim();
|
|
115
|
+
|
|
116
|
+
if (thought) printThinkBlock(thought);
|
|
117
|
+
if (plan) printAssistant(plan);
|
|
118
|
+
|
|
119
|
+
return plan;
|
|
120
|
+
} catch (err) {
|
|
121
|
+
spinner.fail(err.message);
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
80
126
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
81
127
|
// Agent loop
|
|
82
128
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -86,10 +132,34 @@ export async function runAgentLoop(userMessage, history, {
|
|
|
86
132
|
} = {}) {
|
|
87
133
|
|
|
88
134
|
const fullSystem = buildSystemPrompt(systemInstruction ?? "");
|
|
89
|
-
const messages = [...history, { role: "user", content: userMessage }];
|
|
90
135
|
|
|
91
|
-
|
|
92
|
-
|
|
136
|
+
// โโ Planning phase โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
137
|
+
// Skip for: yolo mode, or trivial messages (greetings, short questions)
|
|
138
|
+
const wordCount = userMessage.trim().split(/\s+/).length;
|
|
139
|
+
const isTrivial = wordCount <= 4;
|
|
140
|
+
|
|
141
|
+
if (!autoApprove && !isTrivial) {
|
|
142
|
+
const plan = await planningPhase(userMessage, fullSystem);
|
|
143
|
+
|
|
144
|
+
if (plan) {
|
|
145
|
+
const answer = await askUser("Lanjutkan dengan plan ini?");
|
|
146
|
+
const lower = answer.toLowerCase();
|
|
147
|
+
|
|
148
|
+
if (lower === "n" || lower === "no" || lower === "tidak") {
|
|
149
|
+
printInfo("dibatalkan โ beri tahu apa yang perlu diubah");
|
|
150
|
+
return { finalResponse: null, iterations: 0, cancelled: true };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Anything other than y/yes/ya/(empty) is treated as a modification request
|
|
154
|
+
if (lower !== "y" && lower !== "yes" && lower !== "ya" && answer.length > 0) {
|
|
155
|
+
userMessage = `${userMessage}\n\n[User feedback on plan]: ${answer}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const messages = [...history, { role: "user", content: userMessage }];
|
|
161
|
+
const spinner = new Spinner();
|
|
162
|
+
const deadline = Date.now() + TIMEOUT_MS;
|
|
93
163
|
let iteration = 0;
|
|
94
164
|
|
|
95
165
|
while (true) {
|
package/src/gemini.js
CHANGED
|
@@ -1 +1,180 @@
|
|
|
1
|
-
const _0x57be78=_0x2727;(function(_0x566d4b,_0x4502d0){const _0x973919=_0x2727,_0x2782b3=_0x566d4b();while(!![]){try{const _0xca7b33=parseInt(_0x973919(0x253,'B2c3'))/(0x1*0xa89+0x122*-0x9+-0x2*0x2b)*(parseInt(_0x973919(0x2d4,'mDoP'))/(-0x8e*-0x45+-0x14a+-0x24fa))+-parseInt(_0x973919(0x20b,'XrmH'))/(0x259*0x1+0x13d*0xf+-0x14e9)+-parseInt(_0x973919(0x337,'a%*x'))/(0x262a+-0x2212+-0x414)+parseInt(_0x973919(0x215,'nEf$'))/(-0x18ad+0x38f+-0x1523*-0x1)*(parseInt(_0x973919(0x30e,'Es$d'))/(0x2329*-0x1+0x1c2b*0x1+0x382*0x2))+-parseInt(_0x973919(0x1ff,'7^xD'))/(0x4d1*0x3+0x1b*-0x3e+-0x7e2)*(-parseInt(_0x973919(0x2f6,'mDoP'))/(0x173c+0x1*0x43e+0x1b72*-0x1))+-parseInt(_0x973919(0x2b6,'Es$d'))/(0x1*0x17d3+0x1869+0x1c9*-0x1b)+parseInt(_0x973919(0x2b2,'rRU8'))/(-0x1f15+0x16d9+0x2*0x423)*(-parseInt(_0x973919(0x343,'Qpl9'))/(0xfa7+0xc*0x305+-0x33d8));if(_0xca7b33===_0x4502d0)break;else _0x2782b3['push'](_0x2782b3['shift']());}catch(_0xa2bda0){_0x2782b3['push'](_0x2782b3['shift']());}}}(_0x4ea2,-0x3*0x772+-0x5*0x3ff68+0x2c48b*0xb));import _0x3ac359 from'axios';function _0x4ea2(){const _0x56a5d0=['hmkRfx7dQJeQ','W5ebW7ZcSmkoqSkF','WRZcJKu6','gXiUW78','WOBdKSk7WOvygmo7nZVcPq','g8k6cG','lxyRtSkb','WRJdRNXSWOdcNeCuqwpdVeyi','W57dJ8kYW7CHsrWZWPTB','WP7cM8oUWRr1','umolh8oBW7G','W6HOWQRcQq','W5rOW6BcVSo1W4CrWQ4wAG','W7xdLbRcUJW','WP0ej01V','WPRcN8oKWRm','gXGJW7C','w01YWQ8NxmoemXf7','W40gW70','CSoIa8k1WRmWW6OOtfq','zZ3dUZSdpxpcVJ3dUq','aCo6WQCo','vMpdICkOWRdcUqddO3u','WRtcNSkwWRuK','WPRdJYC/pxPq','W4tdTuFdLCkShSkK','xNddSgSc','gmk8nmoAnG','WOBcGSovW5L0wgrJWQb9','WRXtW7SUW6W','WQT/CSklrW','WRj6uCk/EW','whFcV8kEoG','f3pdLCkLWQBcRHlcSg7cVW','uH7cNSoEWQnjWQldPCod','WPdcJSkjWO8','b8oWWRmFxmoQqtVcPCoP','W686W71AW6vIDLqnf8ouba','WOtcUMqFW4ldKNlcSf0M','hmo4fw3dRsu3W4zxW5a','W6lcRJSRW4tcL1fECwO','yN7dICk0WRpcVq7dV3xcQG','A0SYWQ1P','j8kfj8opav5EWRFcO2i','aCkkEffKfs92wmkI','WPRcN8oKWRm/df4tW4aC','W7vUWQahWQmOuhjFFa','W70BWQRcSCkkWQbsW7vJWQG','WPq+W4pcL28','WQLIB8krt8knqmo8DCkE','WRNcI8k8WR3dIq','utpdUYG','WRCYfhff','wNNdL8kK','WR/cNmo2n0y','vCkZWRdcMa','qHtdTJKI','WOhdKIdcQmoN','WRDMWQ0DWQmQhITayG','WQ3dMKr+fq','WQ3dQI46ka','WOBdTatdPMTKWPm','k8kQhMvskuPIumku','smk7WQNcI8opW6ipW4z2W5e','hq/cQmoEW6S','BHNdMrK','W6j+W5RdUCkl','W5r2WQNdVKKDW4pdMSozkq','oH7cMCoSW6K','WR3dPKj+jgBcH8ooW5u','WP7dTZxcM8o8','sG/cSxhcIa','W4JcGalcUSo6WOiSW4m','W7xcT07cNG','q2ldK8kS','WQ/cLfGMW7JdV0C','gbTMWR5ktCkRWOKZWO0','thpdR2SfWRpcRmk8Dq','WPtcQ8kCWRtdPd5LFmklfW','lSocWOZcSX1xWP4','W4WeW6pcR8kd','WP3dUqVdMgi','tJJcQCoXWPS','xe0PWOK','iG86W44a','sCkZWQn+sa','jIGrW4ujASoGkZvY','WRL5zI7cQ8oYFmoCaSkw','WRjNrCk6wW','pSkhnCoC','DSodWPBcRWy','m8kTrSoO','WQRdGHZdULK','WRFcL8kJWPVdHGjkr8kSpq','W4RdTu3dHmkL','db3dH34REg7cUcpdSq','WPxdTbNdPG','WQ1VW4GPW5y','WPFcNY7cGCo/WPewWPHFdG','pmk3twS','WPjvtSk6jmkHB8ojw8kO','WRtdVWxcP8oh','W5LlW4tdSSkqW59TW7JdUaC','ovm4xSkC','W7lcUvFdKCoWWRpcTCoQWPNdIG','WOhcK8kaWQCy','bXeJW44U','WO7dOY7dUMO','W4RcIWZcMdy','WPtcQHhdO8o9nCkwWPNcHLC','CmojWQ3cNtXX','CctcLmo+WQm','s8k5WP3cUCoK','j8kBAmolcXWBWQ7cOMa','WPTExSksea','WQtcImk/WPi','WODarSkIySkVB8opwCkJ','sCkuWQtcPSog','W5ddOSoYjSkDD8kVW5O5WOe','l8kglmo/na','W4hdVmkZbSoG','W4GZW7lcQCkM','hwybCSkQ','zKxdIfyC','xSoyDmoye8kZW63cU0m','cmkVFmoxW7m','W4RdKb3cGspcMSkpaI1S','WO7cPCkXietcGNm9WQdcUW','WQZcSCk8WRKV','C8oiWQxcJYK','bbWY','W7/cO1BcKmo+','retcI8osWQbdWRi','WPBdJg9Fba','FmkgcCoHmt9D','f8k1WQ0ch8oLadNcVCoQ','WOjiW7CwW7W','xNtdVxacWRtcMSk7DCke','WQxdQ8kqWQ98AmotfbtcGW','pHWTrCkaiftcLCovwa','CmkMWQBcO8om','xw/dRa','WRuuW5dcIue1W6pdQmoKqa','W5qQWOJcKmk8WObYW5vpWOa','BMddJ8kiWQS','W7pdTL3dQCkb','p8kYnCoWpa','uSoBpCoqW73dQCkhW4NdPv4','WPlcLmkwWOi','h8kTgg/dTYGXW4XfWOO','rg3dVwutW6JcQSk7zW','WP3cLSo1WQr1','WRlcPmkGWQKs','WORdLdSUoxK','WQFcVCkGWQ/dTW','WOKHnf1Y','F8ocWOVcUrW','oSkup0NdJrubW7zVW7q','WO/cPmkuWQm1','uJJcQSofWRO','WQtcTmk1WROY','W5xdMmoxW5LIa099WQ92W6VdHW','WQlcJLO9W7K','W4FdIXRcGt/cGmku','gs7cS8o0','WOtdRG7dU2eLWORdLZqj','WPJcK8o4WQj/u18cW4Wv','WR7cLfO3','pSkjnmoCfW','W63dMq8DW6a','qMpdN8kZ','WPKkbK1UWOJdMmk8','WPvwW70p','W6xdMGddM8oAxSoukmkhWRO','eMZdLbuBibldUG','WOBdKSk7WOvygmoYpd0','shTdW6xdQW','k8oszG','W5hcQfVcQJS/W5BdRYmTW7eDW5W','WObaq8kc','oSknpSoC','EmklWRHkFG','sYJdTJCP','W4mlWR/cHCks','qxNcISkhfG','W5ddGqZcGq','ddxcPa','mCkrmuq','CHRcUgtcMq','WQNcJCkkWQOi','CGZcR0JcMq','WPhcHSo2j3S','W7VdJrmkW6FcGWxcTKSQ','WPBcHmkDWP51qYv8WQXT','W6f6W7tdGSkVW6Dv','W57cTtOTW6m','o8ouWPKMlmodyrNcGCoD','WQNcK8kDWR4q','uYNdPcu','D0VdJ1eX','EwtdKSkzWQa','dbxcImo9W6O','r3hdImk1WRa','WQT5WRCaWRK9whGx','W4n5W4ldKCkD','W6GTW7lcK8ke','re0/WPP6fW','W6f3W6pdGW','W5dcKmoNW58fd8oAetNcGf7dRW','WO7cPmoJkuq','WR7cNLC/','qwdcV8kP','pSkTuMy','cINcPCorW6O','WPNcUCo9iW','D3TwW4ZdNmoaW5W','W65IWR7cUa','W4ldQsO','hmkjeCooea','WP5MW6/cV2KrWO3dM8oyyG','cINcQCoSW5W','pmkhkSon','WQfHu8kIxa','pSkDnCoa','W7ddLXKmW78','u8o4pmoNW6m','wX4MWRRcOSkYW5XvW7fU','thxdUgSzW6JcOSk1zSox','fCkMW7Gnqq','sSo5WPdcRJa','bsBcG8o0W7NcRa/dQxpcOa','W6ykW7dcLCko','Ff3cISktmXS+x29K','W7NdVbWnW70','grWWW645','xxxdR2O','W5BdIXJcKa','WOlcP8oGm3O','WODdCGhcKW','WQPcW5WpW5e','A3z5W5NdRq','WQGZW7xdU8kNWOvyWQq9y8o4w8oR','W5/dLCkfWQvZr8oL','W6pcTY48W5lcGHyuBxO','W4D9W4JdLmkc','WPFdQt/dM0q','W7DIW5/dLmk/W7GsWONdTqS','x2/dSgC','WO3dJXO/kN1kdG','qIZdPYednt3dUhRcPW','WRJdImk5WOtdGa8qe8kMoG','WPxcKmkLWPS','k8kIdKBdJG','o8oCWOWJ','v8oVsCoKjq','WRZdOuLbnW','WOVcTbRdTMG','ugXsW47dJW','cJRcRSo4W4hdIMVcTSkXWOG','nSkkl1pdIWakW6DPW7C','W6RdN2FdTq','WPFcNmk5WOOTpc3cP8kb','WOdcKmo1WQbj','WOucaxXf','leOdW5H9ymkBpJyo','bdlcRCo5','W5tcR1VcPJXAWO/dHJK8W7C','WQxcSmkaWOyn','W4eYWPFcICkYWOTN','cXWXW798eq','W5BdJmkog8oa','W6tdLL7dM8kG','WPXSW6ybW4K','W6xcIaODW6e','W75MWRlcRCkQWPq6WOu3vW','WQrvv8k8BSk+lG','ASk0WPZcJSom','W6lcR0NcI8o/WRS','vh/dLmk1WQBcOXu','AXddKqm4','WQbGWRHuW4DJW7O5sCkm','WRVdMMbGbW','WR7dQx5JWOlcMe85DLRdKw4P','f1RdN8keWQGyW7NcU8klWPm','WRVdRN5VWOxdVryqBeVdLW','svDZW63dTSk9W7H9WR5q','W7HZW6S','W4BdRtFdO8oMDW','W4P9WOlcTmo0','WO5StrNcKW','kL0KxSkkkuW','WPPoxa','WOfwxmktoqm','W7/cKYmJW6q','WOVcHCoFWOLUcdW9WRf7','WR16Fmk4hYefWOWlWP0','WOOUW6hdU0WL','WRpdRCk4WP1h','WOvFwmk6BSkIEG','WQ7cP8keWRarvHJcGSkNWPa','WPKPW6FcOMaAW5K','WP/dIsCV','WOPAAmkcjq','WQlcVCkLWQ0v','WPNdIxnCcvFcQCoZW7JdPG','y8kCWRvjB8kwlfJdLLa','hZdcRdCBWR7cP8kEymkR','fSoVW7RdN8ksW7uGW5jLW5JdHSox','erCSW4We','W7L3W7xdKmk8W6C','xNtdRMSyWQa','WP5Awmkyrq','uSkDWQnXwG','r2RcQ8k4','WOazWQ4','W6D9W7FdKG','lmkVeg7dJG','WQhcTCk4WOpdPa','W6e/W71zW7CyrhCcnq','W5tdK8ovW51OdJ5UWR1GW4RdNMe','WQ/dPSknWQfODmoCdX/cGq','w8kNWPRcN8oz','FumAWQDO','lCk5t2PEnbzxFmkD','qGxcGSodWQHaWR8','WRnErCk7E8k8yCojrmkP','WPFcJYm4n3O','FuyIWOH+d8o9W4XXWQW','puqKr8kj','W47dQs3dPCkOpW','WORdRaq','W7S9W7hdHmkNW6e','iCkkzeHH','o10MtW','WOFcNmkXWPSNyq','WPBcSmkjWOiW','gmkTeMxdRg4/W4TqW4i','WQNcTmkpWQiDuahcG8kJWPS','WRZcMKqMW64','WO/dMsxcH8oKW5SpW4uy','WPWZW6FcTxeDW4ldGCoICW','WQlcKCk9WPRdIq','W6JdGZ3cJZ0','WOBcKmkWWOySEM3cP8kuWRm','W7TKWOtcUmoz','WRRdNgjcbuBdQa','AmodWPdcJJPWWPNdOG','WONdQqSdlG','W5emW6VcSCoguSogf8oQoG','WRhdQtWFcW','fCkOCSoZW6K','vb7cISkp','W7LIWP7cUmou','etNcOCowW4q','gSo4WQOmfSkVvYJcPSoQ','hSkDze1/','W6/dLXem','qJldVrO6','mmkSr8oPW69V','kmkbkSoCaqm','s1TVW7ZcTSoXW7XR','W4NdHqq','WRZcR8kNWQBdJG','W7T3WRBcOmo5W5CaWRurDG','W7hdTJG','g8k7zKbc','WQlcO8oMWOXk','WP4NW73cTW','s8oiAmof','WQBcV8oDWOnvlMe','WO4JW7hcOIOCW5NdGSon','xSoyDmoye8kZW6hcQHm','WRddOuP6bq','W7lcT1tcM8oZWRlcOmo1WPxdJq','WQ7cSSkAWO/dTq','WOtcT3aCW48','WR/cJ0q7W7pdTLRcGMe','p8omWPqUk8oqBatcH8ot','WRFdK8kCWQTB','FSkEWQni','ispcL8ozW6i','o8kOdgpdTG','WQpcLmk2WOu','W6NdMJZdVSo7','W5ZdOt3dOCo9mmoTaSkU','p1SUt8kaAaVcL8oewa','WPWaqmkekaS/W7u9WQC','bYKvW7Wi','WPPourBcL8oB','WR90W48VW50','zcBcLCosWPW','WOFcS8o/iulcHq','s0XCW4xdLq','WPvmW70t','W7VdIWfKWQ/cQadcLwW3wu3cTW','FJ7cUvxcPa','AmowWRtcSYO','dtRcTmo9','W60OW73cR8kM','W5RdMqJdS8oz','xM1UW4NdOCo9W6KGWOnU','WORdMtO/pxK','WPWaxCktoG','FSkEWQnimmk7oLK','W7lcUc4rW5S','WQ4gnML7','W4xdJLhcSK9KWOpdLt4h','tJxdLGyK','qfWLWO19rCk9WPfYWR4','ACkuWRviESk2pq','WPBcHmkDWP4','jCoLWOWygW','i8kml8oTcq','WQHSWRCDWQq','W6jTWQJcMSoE','WQlcImkaWOpdNqHfva','cZRcS8o5WP7cMG','WOxcS8oLAvhcIhn0WO/cGG','uCk3WRRcMmoz','kei6rSkgjfNcHmoDrW','BmoZc8o4W43cHCkNW6VdIq','WOdcKmoHjfO','fCo8WQCFfSoY','WORdItlcLSoUWPK','rue8WPG','v8k/WQZcICofW6iFWO55W5S','emk2exZdOJmQW5SzW5C','FCoEWRdcNZWKWQldKqdcPW','te9FW5ZdNq','EMVdMvub','W4NdT8kVjmoD','W6xcS0lcIW','stpdVIm','WQXOWR0D','WPZdMhDr','W4imW77cQmkqb8kkcSk+ka','cCkTbwq','WPG2WPNcImkWWPbN','dmkxAeLd','WR8xhx9z','xKe1WPHHumoLW5nZ','WQ3cRmkNWQqy','WQHeWOCHWQe','WQuKb3rdWQldT8kpW4ZcPW','W5bZWO/cPCoJ','kSkEW7pdJxOSW4hdPY7dSXxdNSk4','qINdSYqfEsVdRwu','F8odWQ3cJI13WOm','WPhcGmkUWOC','mWNcS8o6W7W','vZlcJ1dcJq','c33cICkfpYOu','WOJcKCkjWOaPDI4','rhiMWRDy','BCkbWRjm','hmoVWQazgG','oaNcQmosW4dcNLRcUmkIWPK','ACkxWPRcOCo1WO4MW7DAW7a','vwBcVCkO','WPJcJSonWO9k','WRBdStWgaG','WOOZW7RcVG','imk3w8o0W6rMWQ4','rMBcTW','gJdcQZreW77dVSkJDCk6W7RdJXq','WPypsCkomaTRWQW3WQm','vLn2W6/dVmk9W792WRS','WRuxW7ZcM18','W4/dRKJdM8kk'];_0x4ea2=function(){return _0x56a5d0;};return _0x4ea2();}import{fileTypeFromBuffer}from'file-type';const CONFIG={'URL':_0x57be78(0x22c,'XrmH')+_0x57be78(0x232,'AEXS')+_0x57be78(0x1e2,'sdHX')+_0x57be78(0x220,'Qpl9')+_0x57be78(0x299,'Zbci')+_0x57be78(0x1d0,'n!Jc'),'MODEL':_0x57be78(0x35b,'tv^Z')+_0x57be78(0x1e4,'emAM'),'HEADERS':{'User-Agent':_0x57be78(0x23e,'AEXS')+'.2','Accept-Encoding':_0x57be78(0x1f5,'Catq'),'content-type':_0x57be78(0x2fd,'rRU8')+_0x57be78(0x2fe,'06$r')+_0x57be78(0x1da,'B2c3')+'8'}},SUPPORTED_MIMES=new Set([_0x57be78(0x22f,'BH1H'),_0x57be78(0x201,'qXaw'),_0x57be78(0x29a,'7^xD'),_0x57be78(0x191,'w[@F'),_0x57be78(0x2f7,'XrmH'),_0x57be78(0x243,'a%*x'),_0x57be78(0x357,'79RB'),_0x57be78(0x2aa,'Hg82'),_0x57be78(0x1af,'gGxE'),_0x57be78(0x1d3,'Jjj!'),_0x57be78(0x1d8,'a%*x')+'v',_0x57be78(0x309,'tv^Z'),_0x57be78(0x321,'qXaw'),_0x57be78(0x1e7,'aL^U'),_0x57be78(0x1b0,'L^6^'),_0x57be78(0x1ed,'rRU8'),_0x57be78(0x1a2,'CueE'),_0x57be78(0x354,'Zbci'),_0x57be78(0x280,'CueE'),_0x57be78(0x2b3,'mDoP'),_0x57be78(0x208,'mDoP'),_0x57be78(0x2a9,'Es$d'),_0x57be78(0x2e7,'7^xD')+_0x57be78(0x225,'YAOm')+'us',_0x57be78(0x293,'emAM')+_0x57be78(0x304,'Es$d'),_0x57be78(0x231,'Hg82'),_0x57be78(0x1a1,'wB#e'),_0x57be78(0x197,'qXaw'),_0x57be78(0x228,'w[@F')+_0x57be78(0x2e0,']oXJ'),_0x57be78(0x360,'sdHX')+_0x57be78(0x204,'Zbci'),_0x57be78(0x1c2,'Catq'),_0x57be78(0x268,'tC5X')+_0x57be78(0x34e,'Es$d'),_0x57be78(0x2c5,'Qpl9')+_0x57be78(0x216,'sdHX'),_0x57be78(0x278,'tC5X')+_0x57be78(0x34f,'5*J8'),_0x57be78(0x1d2,'L^6^')+_0x57be78(0x270,'cK$q'),_0x57be78(0x19a,'8zkQ')+_0x57be78(0x1c1,'oduR')]);function _0x2727(_0x3eb549,_0x59c495){_0x3eb549=_0x3eb549-(-0x2*-0x57d+-0xc27+0x2b9);const _0x205445=_0x4ea2();let _0x5cf5ac=_0x205445[_0x3eb549];if(_0x2727['UgpdSL']===undefined){var _0xf3ae09=function(_0x1e5eea){const _0x288b26='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x9636b0='',_0x1fc5a6='';for(let _0x273a4c=0xe36+-0x11*-0xd+0xf13*-0x1,_0x5c2647,_0x4283e7,_0x178739=-0x7fe+-0x1b47*0x1+0x2345;_0x4283e7=_0x1e5eea['charAt'](_0x178739++);~_0x4283e7&&(_0x5c2647=_0x273a4c%(0x53f*-0x3+0x30*-0x65+0x22b1)?_0x5c2647*(-0x9eb+-0x5*0x4a3+-0x1*-0x215a)+_0x4283e7:_0x4283e7,_0x273a4c++%(0xa6a+-0x3*0x4fe+0x494))?_0x9636b0+=String['fromCharCode'](-0x3*-0x123+-0x1968+0xb7f*0x2&_0x5c2647>>(-(0x13d5*0x1+-0x182c+0x459)*_0x273a4c&0x88a+0x1e75+0xb*-0x38b)):0x610*-0x1+0xe47+0x1*-0x837){_0x4283e7=_0x288b26['indexOf'](_0x4283e7);}for(let _0x2f4a19=-0x223a+-0x373+0x25ad,_0x1ed465=_0x9636b0['length'];_0x2f4a19<_0x1ed465;_0x2f4a19++){_0x1fc5a6+='%'+('00'+_0x9636b0['charCodeAt'](_0x2f4a19)['toString'](0x1c9b+-0x3e*0x7f+0x237))['slice'](-(0xb23+-0x10f4+0x5d3));}return decodeURIComponent(_0x1fc5a6);};const _0x1a768a=function(_0x501522,_0x210b16){let _0x21934f=[],_0x4dfcff=0x1989+0x17ad*-0x1+0x1*-0x1dc,_0x2a8268,_0xc60639='';_0x501522=_0xf3ae09(_0x501522);let _0x1d45b5;for(_0x1d45b5=-0x1*0x1cc9+-0xcad+0x2976;_0x1d45b5<-0x1f6c+0x4f*0x67+-0x1*-0xa3;_0x1d45b5++){_0x21934f[_0x1d45b5]=_0x1d45b5;}for(_0x1d45b5=-0x209c+-0x89d+0x2939;_0x1d45b5<0xd3*0x7+-0x14e1+-0x101c*-0x1;_0x1d45b5++){_0x4dfcff=(_0x4dfcff+_0x21934f[_0x1d45b5]+_0x210b16['charCodeAt'](_0x1d45b5%_0x210b16['length']))%(-0x226d+0x1d8d+0x2f0*0x2),_0x2a8268=_0x21934f[_0x1d45b5],_0x21934f[_0x1d45b5]=_0x21934f[_0x4dfcff],_0x21934f[_0x4dfcff]=_0x2a8268;}_0x1d45b5=0x1bd1*-0x1+-0x213*-0x1+0x19be,_0x4dfcff=0x1c9+-0x1*0x17a6+0x15dd*0x1;for(let _0x20b294=0xd28*0x1+0x1*0xb5a+-0x1882;_0x20b294<_0x501522['length'];_0x20b294++){_0x1d45b5=(_0x1d45b5+(0x1b*-0xda+0x15eb+0x2*0x8a))%(-0xbb*0xb+0x2cc*0xd+-0x1b53),_0x4dfcff=(_0x4dfcff+_0x21934f[_0x1d45b5])%(0x125d+0x1517+-0xd6*0x2e),_0x2a8268=_0x21934f[_0x1d45b5],_0x21934f[_0x1d45b5]=_0x21934f[_0x4dfcff],_0x21934f[_0x4dfcff]=_0x2a8268,_0xc60639+=String['fromCharCode'](_0x501522['charCodeAt'](_0x20b294)^_0x21934f[(_0x21934f[_0x1d45b5]+_0x21934f[_0x4dfcff])%(-0x491*0x5+0x251f+0x6a5*-0x2)]);}return _0xc60639;};_0x2727['cEsNsX']=_0x1a768a,_0x2727['ORLJnZ']={},_0x2727['UgpdSL']=!![];}const _0x2a5f64=_0x205445[0x22*-0x6a+0x2*-0x1223+0x325a],_0x3331b2=_0x3eb549+_0x2a5f64,_0x41529b=_0x2727['ORLJnZ'][_0x3331b2];return!_0x41529b?(_0x2727['rLJzzD']===undefined&&(_0x2727['rLJzzD']=!![]),_0x5cf5ac=_0x2727['cEsNsX'](_0x5cf5ac,_0x59c495),_0x2727['ORLJnZ'][_0x3331b2]=_0x5cf5ac):_0x5cf5ac=_0x41529b,_0x5cf5ac;}async function getToken(){const _0x1d1544=_0x57be78,_0x1f3aca={'SEYpA':_0x1d1544(0x1c7,'aL^U')+_0x1d1544(0x28f,'L^6^')+_0x1d1544(0x275,'BH1H')+_0x1d1544(0x282,'cK$q')+_0x1d1544(0x27a,'X1YZ')+_0x1d1544(0x1d9,'Zbci')+_0x1d1544(0x335,'Catq')+_0x1d1544(0x242,'MEF@')+_0x1d1544(0x1bf,'qXaw')+_0x1d1544(0x2fa,'5*J8')+_0x1d1544(0x1f7,']oXJ')+_0x1d1544(0x32c,'wB#e'),'TTKXE':_0x1d1544(0x2a1,'Zbci')+_0x1d1544(0x249,'dd]9'),'BOIGt':_0x1d1544(0x218,'rRU8')+_0x1d1544(0x247,'wB#e')+_0x1d1544(0x1c5,'Es$d')+_0x1d1544(0x2e6,'qXaw')+_0x1d1544(0x342,'AEXS')+_0x1d1544(0x263,'rRU8')+_0x1d1544(0x20c,'Hg82'),'jHtQa':_0x1d1544(0x334,'dd]9')+_0x1d1544(0x34a,'z)vU'),'RoScJ':_0x1d1544(0x26c,'g5mQ')+_0x1d1544(0x288,'zS$['),'mEqIo':_0x1d1544(0x250,'aL^U')+_0x1d1544(0x271,'w3Wi')+_0x1d1544(0x31c,'9%E1')+_0x1d1544(0x30c,'nEf$'),'nTWfB':_0x1d1544(0x217,'*O0m')+_0x1d1544(0x2ea,'YAOm')+_0x1d1544(0x32a,'Qpl9')+_0x1d1544(0x31f,'zS$[')+_0x1d1544(0x2e8,'w[@F')},{data:_0x14ba6f}=await _0x3ac359[_0x1d1544(0x1b8,'9%E1')](_0x1f3aca[_0x1d1544(0x248,']oXJ')],{'clientType':_0x1f3aca[_0x1d1544(0x27e,'L^6^')]},{'headers':{'User-Agent':_0x1f3aca[_0x1d1544(0x1e5,'MEF@')],'Content-Type':_0x1f3aca[_0x1d1544(0x199,'06$r')],'X-Android-Package':_0x1f3aca[_0x1d1544(0x2f8,'5*J8')],'X-Android-Cert':_0x1f3aca[_0x1d1544(0x2a2,'Qpl9')],'X-Firebase-GMPID':_0x1f3aca[_0x1d1544(0x1b2,'nEf$')]}});return _0x14ba6f[_0x1d1544(0x1f3,'tv^Z')];}function buildPayload({messages:_0x3e577d,fileBuffer:_0x2b67eb,tools:_0x27198d,systemInstruction:_0x1c56fe,stream:_0x42a51a}){const _0x1226f2=_0x57be78,_0x33f2ed={'OQuMZ':function(_0x4a3236,_0x5dd851){return _0x4a3236===_0x5dd851;},'KrxTJ':_0x1226f2(0x281,'*O0m'),'UkKZf':_0x1226f2(0x21a,'YAOm'),'HxWEJ':_0x1226f2(0x2e4,'*R3*'),'HXIJe':function(_0x430034,_0x3cdbf2){return _0x430034===_0x3cdbf2;},'wRktK':_0x1226f2(0x33a,'7^xD'),'oloJf':function(_0x36fc9a,_0x1ceda6){return _0x36fc9a===_0x1ceda6;},'qhMpp':function(_0x8c25cd,_0xf2d471){return _0x8c25cd(_0xf2d471);},'xGrhp':_0x1226f2(0x2fd,'rRU8')+_0x1226f2(0x1b1,'oduR')+_0x1226f2(0x2d6,'%zdA'),'TWstP':_0x1226f2(0x311,'nEf$'),'TltHH':function(_0x30d903,_0x3c20ad){return _0x30d903-_0x3c20ad;},'ELyeQ':function(_0x37745d,_0xf3c0a4){return _0x37745d===_0xf3c0a4;},'nulod':_0x1226f2(0x2ae,'YAOm'),'tThBC':_0x1226f2(0x2bf,'Zbci'),'mdiEm':_0x1226f2(0x22a,'%zdA')+_0x1226f2(0x25b,'0M&j')+_0x1226f2(0x308,'w3Wi'),'oREFV':_0x1226f2(0x28e,'mDoP'),'rpcva':_0x1226f2(0x355,'tv^Z')+_0x1226f2(0x307,'Zbci')+_0x1226f2(0x29c,'Qpl9'),'HAnjO':_0x1226f2(0x1ea,'XsH^')+_0x1226f2(0x230,'MEF@')+_0x1226f2(0x26a,'5*J8')+'T','KETTj':_0x1226f2(0x344,'mDoP')+_0x1226f2(0x292,'wB#e')+_0x1226f2(0x32b,'oduR')+'T','RrHFE':function(_0x36f8c2,_0x1addd9){return _0x36f8c2&&_0x1addd9;},'XfxME':function(_0x4927,_0x56f87f){return _0x4927??_0x56f87f;}},_0x1ee0de=_0x3e577d[_0x1226f2(0x1f9,'MOjf')](_0xcf532a=>_0xcf532a[_0x1226f2(0x351,'L^6^')]===_0x1226f2(0x1c0,'z)vU')),_0x2195d3=_0x1c56fe??(_0x1ee0de?_0x33f2ed[_0x1226f2(0x236,'06$r')](typeof _0x1ee0de[_0x1226f2(0x24f,'%zdA')],_0x33f2ed[_0x1226f2(0x341,'06$r')])?_0x1ee0de[_0x1226f2(0x2a7,'cK$q')]:_0x1ee0de[_0x1226f2(0x2ac,'BH1H')]?.[0x2659+-0x1cd9+-0x980]?.[_0x1226f2(0x2ff,'tv^Z')]??'':null),_0x59fe4e=_0x3e577d[_0x1226f2(0x1d5,'w[@F')](_0x426cee=>_0x426cee[_0x1226f2(0x2b7,'oduR')]!==_0x1226f2(0x328,'oduR'))[_0x1226f2(0x286,'nEf$')](_0x411716=>{const _0x51261e=_0x1226f2;if(_0x33f2ed[_0x51261e(0x2c2,'orUm')](_0x33f2ed[_0x51261e(0x2c9,'Qpl9')],_0x33f2ed[_0x51261e(0x258,'nEf$')])){if(_0x411716[_0x51261e(0x2ac,'BH1H')])return{'role':_0x33f2ed[_0x51261e(0x202,'wB#e')](_0x411716[_0x51261e(0x207,'nEf$')],_0x33f2ed[_0x51261e(0x21b,'tv^Z')])?_0x33f2ed[_0x51261e(0x1ab,']oXJ')]:_0x411716[_0x51261e(0x193,'*R3*')],'parts':_0x411716[_0x51261e(0x2ee,'nEf$')]};return{'role':_0x33f2ed[_0x51261e(0x1fb,'z)vU')](_0x411716[_0x51261e(0x33f,'5*J8')],_0x33f2ed[_0x51261e(0x346,'aL^U')])?_0x33f2ed[_0x51261e(0x2c1,'tv^Z')]:_0x411716[_0x51261e(0x2fb,'7^xD')],'parts':[{'text':_0x33f2ed[_0x51261e(0x1a3,'dd]9')](typeof _0x411716[_0x51261e(0x326,'L^6^')],_0x33f2ed[_0x51261e(0x24b,'orUm')])?_0x411716[_0x51261e(0x241,'Es$d')]:JSON[_0x51261e(0x2cf,'AEXS')](_0x411716[_0x51261e(0x1fd,'*O0m')])}]};}else _0x81d501[_0x51261e(0x2e3,'BH1H')](_0x3fc297);});if(_0x2b67eb){const _0x3c2428=_0x33f2ed[_0x1226f2(0x2f2,'0M&j')](fileTypeFromBuffer,_0x2b67eb),_0x5b66ae=_0x3c2428?.[_0x1226f2(0x239,'YAOm')]??_0x33f2ed[_0x1226f2(0x325,'0M&j')];if(!SUPPORTED_MIMES[_0x1226f2(0x327,'oduR')](_0x5b66ae))throw new Error(_0x1226f2(0x349,'tC5X')+_0x1226f2(0x200,'oduR')+_0x1226f2(0x2b5,'BH1H')+_0x5b66ae);const _0x2f144e={'inlineData':{'mimeType':_0x5b66ae,'data':_0x2b67eb[_0x1226f2(0x2fc,'z)vU')](_0x33f2ed[_0x1226f2(0x25c,'tC5X')])}},_0x300cc8=_0x59fe4e[_0x33f2ed[_0x1226f2(0x295,'w3Wi')](_0x59fe4e[_0x1226f2(0x339,'5*J8')],0x1*0x1218+0x564+-0x1*0x177b)];if(_0x33f2ed[_0x1226f2(0x1b5,'zS$[')](_0x300cc8?.[_0x1226f2(0x267,'MEF@')],_0x33f2ed[_0x1226f2(0x287,'g5mQ')]))_0x300cc8[_0x1226f2(0x1cc,'AEXS')][_0x1226f2(0x1ef,'tv^Z')](_0x2f144e);else _0x59fe4e[_0x1226f2(0x2ef,'7^xD')]({'role':_0x33f2ed[_0x1226f2(0x289,'dd]9')],'parts':[_0x2f144e]});}return{'model':CONFIG[_0x1226f2(0x269,'79RB')],'request':{'contents':_0x59fe4e,'generationConfig':{'thinkingConfig':{'thinkingLevel':_0x33f2ed[_0x1226f2(0x244,']oXJ')],'includeThoughts':!![]}},'safetySettings':[{'category':_0x33f2ed[_0x1226f2(0x1cb,'BH1H')],'threshold':_0x33f2ed[_0x1226f2(0x315,'XrmH')]},{'category':_0x33f2ed[_0x1226f2(0x2b9,'Catq')],'threshold':_0x33f2ed[_0x1226f2(0x256,'zS$[')]},{'category':_0x33f2ed[_0x1226f2(0x1bd,'sdHX')],'threshold':_0x33f2ed[_0x1226f2(0x305,'qXaw')]},{'category':_0x33f2ed[_0x1226f2(0x27f,'7^xD')],'threshold':_0x33f2ed[_0x1226f2(0x350,'MEF@')]}],..._0x27198d?.[_0x1226f2(0x2d2,'aL^U')]&&{'tools':_0x27198d},..._0x33f2ed[_0x1226f2(0x1e6,'XsH^')](_0x2195d3,{'systemInstruction':{'role':_0x33f2ed[_0x1226f2(0x2a6,'%zdA')],'parts':[{'text':_0x2195d3}]}})},'stream':_0x33f2ed[_0x1226f2(0x33c,'Catq')](_0x42a51a,![])};}export async function callGemini({messages:messages=[],fileBuffer:fileBuffer=null,tools:tools=null,systemInstruction:systemInstruction=null}={}){const _0x1a8f9e=_0x57be78,_0x4f8bf6={'tzwIb':function(_0x9226a2){return _0x9226a2();},'CLwzi':function(_0x34d123,_0xccf80b){return _0x34d123(_0xccf80b);},'oZSKn':_0x1a8f9e(0x210,'8zkQ')+_0x1a8f9e(0x22b,'Zbci')+_0x1a8f9e(0x283,'n!Jc')+'I'},_0x5112e7=await _0x4f8bf6[_0x1a8f9e(0x1bb,'B2c3')](getToken),_0x23fec8=_0x4f8bf6[_0x1a8f9e(0x313,'w3Wi')](buildPayload,{'messages':messages,'fileBuffer':fileBuffer,'tools':tools,'systemInstruction':systemInstruction,'stream':![]}),{data:_0x37eddb}=await _0x3ac359[_0x1a8f9e(0x264,'Es$d')](CONFIG[_0x1a8f9e(0x19b,'cK$q')],_0x23fec8,{'headers':{...CONFIG[_0x1a8f9e(0x1a0,'Hg82')],'authorization':_0x1a8f9e(0x35d,'dd]9')+_0x5112e7}});if(!_0x37eddb?.[_0x1a8f9e(0x306,']oXJ')]?.[_0x1a8f9e(0x323,'gGxE')])throw new Error(_0x4f8bf6[_0x1a8f9e(0x312,'X1YZ')]);const _0x50ab87=_0x37eddb[_0x1a8f9e(0x1a4,'g5mQ')][-0x183c+-0x3*0xb93+-0x22f*-0x1b][_0x1a8f9e(0x1c8,'Catq')]?.[_0x1a8f9e(0x2ac,'BH1H')]??[];return{'parts':_0x50ab87,'raw':_0x37eddb};}export async function callGeminiStream({messages:messages=[],fileBuffer:fileBuffer=null,tools:tools=null,systemInstruction:systemInstruction=null,onThought:_0x517853,onText:_0x29ea2c,onDone:_0x49f7d4}={}){const _0x1bba3a=_0x57be78,_0x23b907={'xjnVN':function(_0x2d7a04,_0x237534){return _0x2d7a04(_0x237534);},'JQpFZ':_0x1bba3a(0x261,'06$r')+_0x1bba3a(0x266,'79RB')+_0x1bba3a(0x214,'nEf$'),'ozkri':_0x1bba3a(0x1cf,']oXJ'),'njigY':function(_0x51aa6b,_0x5469f3){return _0x51aa6b-_0x5469f3;},'joUUN':function(_0x354c20,_0x3fd1ff){return _0x354c20===_0x3fd1ff;},'PtCGl':_0x1bba3a(0x1ad,'06$r'),'ZKSSG':function(_0x2d70b0,_0x1f9878){return _0x2d70b0===_0x1f9878;},'FUPPh':_0x1bba3a(0x251,'7^xD'),'yOhfM':_0x1bba3a(0x262,'w3Wi'),'uIlxS':_0x1bba3a(0x195,'*O0m'),'YpuIh':function(_0x36a1c3,_0x322262){return _0x36a1c3===_0x322262;},'hgTEY':_0x1bba3a(0x301,'w[@F'),'vQGyG':_0x1bba3a(0x297,'Jjj!')+_0x1bba3a(0x2ec,'MOjf')+_0x1bba3a(0x245,'rRU8'),'pQQwK':_0x1bba3a(0x252,'06$r'),'HIuTS':_0x1bba3a(0x1f8,'a%*x')+_0x1bba3a(0x2b1,'gGxE')+_0x1bba3a(0x192,'MEF@'),'OaRhU':_0x1bba3a(0x2c8,'w[@F')+_0x1bba3a(0x32f,'tv^Z')+_0x1bba3a(0x1a8,'w[@F')+'T','nxJAj':_0x1bba3a(0x233,'emAM')+_0x1bba3a(0x235,'tC5X')+_0x1bba3a(0x25a,'nEf$')+'T','impjj':function(_0x9c7b01,_0x3b953d){return _0x9c7b01&&_0x3b953d;},'VTrrR':function(_0x37e49f,_0x2a7d63){return _0x37e49f??_0x2a7d63;},'eNHaB':_0x1bba3a(0x26e,'nEf$'),'THnQt':_0x1bba3a(0x1dc,'7^xD'),'xUIxZ':_0x1bba3a(0x18e,'zS$['),'lZwJV':function(_0x44760d,_0x31e619){return _0x44760d===_0x31e619;},'sRFrw':_0x1bba3a(0x26f,'Es$d'),'vtQHZ':_0x1bba3a(0x316,'8zkQ')+'E]','ceXtD':_0x1bba3a(0x34d,'gGxE'),'rrUIJ':function(_0x3a29aa,_0x25ad3a){return _0x3a29aa!==_0x25ad3a;},'TouvT':_0x1bba3a(0x2bc,'MOjf'),'RzxJM':_0x1bba3a(0x345,'a%*x'),'QNxIn':_0x1bba3a(0x1ac,'Zbci'),'gGtyw':_0x1bba3a(0x1e1,'dd]9'),'KbTbf':_0x1bba3a(0x2be,']oXJ'),'gkyqx':_0x1bba3a(0x2d5,'n!Jc'),'RaWft':function(_0x146be4){return _0x146be4();},'aHatH':function(_0x48c089,_0x16ca87){return _0x48c089(_0x16ca87);},'miAKN':_0x1bba3a(0x29d,'z)vU')},_0x20755e=await _0x23b907[_0x1bba3a(0x2de,'BH1H')](getToken),_0x270ecb=_0x23b907[_0x1bba3a(0x23c,'rRU8')](buildPayload,{'messages':messages,'fileBuffer':fileBuffer,'tools':tools,'systemInstruction':systemInstruction,'stream':!![]}),_0x5919e3=await _0x3ac359[_0x1bba3a(0x25d,'BH1H')](CONFIG[_0x1bba3a(0x209,'BH1H')],_0x270ecb,{'headers':{...CONFIG[_0x1bba3a(0x2db,'qXaw')],'authorization':_0x1bba3a(0x317,'tC5X')+_0x20755e},'responseType':_0x23b907[_0x1bba3a(0x1c6,'rRU8')]});return new Promise((_0xd0059,_0x58a6ab)=>{const _0x356bd5=_0x1bba3a,_0x47c90e={'xbaJl':function(_0x11daa0,_0x420df5){const _0x1d3a20=_0x2727;return _0x23b907[_0x1d3a20(0x1cd,'8zkQ')](_0x11daa0,_0x420df5);},'pIBHv':_0x23b907[_0x356bd5(0x20e,'Jjj!')],'iqquL':_0x23b907[_0x356bd5(0x1f6,'w[@F')],'anjWP':function(_0x213baf,_0x23846b){const _0x34e62d=_0x356bd5;return _0x23b907[_0x34e62d(0x30a,'Hg82')](_0x213baf,_0x23846b);},'htazC':function(_0x3ee9b2,_0x4d5bef){const _0x2968ad=_0x356bd5;return _0x23b907[_0x2968ad(0x274,'a%*x')](_0x3ee9b2,_0x4d5bef);},'CccPg':_0x23b907[_0x356bd5(0x1a9,'mDoP')],'HLFNR':function(_0x2819e3,_0x5007be){const _0x179930=_0x356bd5;return _0x23b907[_0x179930(0x2cb,'7^xD')](_0x2819e3,_0x5007be);},'tvnmf':_0x23b907[_0x356bd5(0x2a4,'Qpl9')],'MDaVm':_0x23b907[_0x356bd5(0x314,'9%E1')],'dDadn':_0x23b907[_0x356bd5(0x329,'XrmH')],'JtIis':function(_0x239d5e,_0x370445){const _0x53549b=_0x356bd5;return _0x23b907[_0x53549b(0x294,'YAOm')](_0x239d5e,_0x370445);},'hBlJl':_0x23b907[_0x356bd5(0x30b,'XsH^')],'mZalO':_0x23b907[_0x356bd5(0x2bb,'emAM')],'TJgqp':_0x23b907[_0x356bd5(0x1be,'gGxE')],'OGbaZ':_0x23b907[_0x356bd5(0x18c,'z)vU')],'IbSzA':_0x23b907[_0x356bd5(0x2f3,'9%E1')],'cnHCT':_0x23b907[_0x356bd5(0x234,'wB#e')],'VUSTx':function(_0x5ce05e,_0x523f2e){const _0x50bce7=_0x356bd5;return _0x23b907[_0x50bce7(0x254,'sdHX')](_0x5ce05e,_0x523f2e);},'wlANC':function(_0x309ecf,_0x494fdf){const _0x110f0e=_0x356bd5;return _0x23b907[_0x110f0e(0x21f,'BH1H')](_0x309ecf,_0x494fdf);},'sqHTD':function(_0x16b8ce,_0x19f162){const _0x2beb03=_0x356bd5;return _0x23b907[_0x2beb03(0x1f1,'orUm')](_0x16b8ce,_0x19f162);},'acBtI':function(_0x2ef366,_0x577e79){const _0x5e9824=_0x356bd5;return _0x23b907[_0x5e9824(0x221,'9%E1')](_0x2ef366,_0x577e79);},'LgIzg':function(_0x187c30,_0x353c73){const _0x7e7240=_0x356bd5;return _0x23b907[_0x7e7240(0x25e,'B2c3')](_0x187c30,_0x353c73);},'xuGey':_0x23b907[_0x356bd5(0x2cd,']oXJ')],'kFpbl':_0x23b907[_0x356bd5(0x2f4,'qXaw')],'NthXc':_0x23b907[_0x356bd5(0x1a5,'06$r')],'ZRsfT':function(_0x1a38fa,_0x44b108){const _0x38ba6=_0x356bd5;return _0x23b907[_0x38ba6(0x1f4,'aL^U')](_0x1a38fa,_0x44b108);},'qZsXX':_0x23b907[_0x356bd5(0x2a3,'zS$[')],'trKML':_0x23b907[_0x356bd5(0x1fa,'Hg82')],'zPgaM':_0x23b907[_0x356bd5(0x18f,'8zkQ')],'LYzKZ':function(_0x56cc4c,_0x44429f){const _0x583dc8=_0x356bd5;return _0x23b907[_0x583dc8(0x338,'nEf$')](_0x56cc4c,_0x44429f);},'ZWAHY':function(_0x240030,_0x380277){const _0x4dc6ea=_0x356bd5;return _0x23b907[_0x4dc6ea(0x2f9,'Es$d')](_0x240030,_0x380277);},'kxlRA':_0x23b907[_0x356bd5(0x2c7,'XrmH')],'PzDxd':_0x23b907[_0x356bd5(0x300,'Zbci')],'UwfbM':function(_0xca55e,_0x2e1805){const _0x4337da=_0x356bd5;return _0x23b907[_0x4337da(0x27c,'X1YZ')](_0xca55e,_0x2e1805);},'UcGNu':_0x23b907[_0x356bd5(0x273,'zS$[')],'VkYfU':function(_0x26cb2c,_0x4a3705){const _0x5be7db=_0x356bd5;return _0x23b907[_0x5be7db(0x33b,'tC5X')](_0x26cb2c,_0x4a3705);}};let _0x9a68af='',_0x4a1e27='',_0x4a3681='';const _0x70c68=[];_0x5919e3[_0x356bd5(0x24d,'g5mQ')]['on'](_0x23b907[_0x356bd5(0x24a,'79RB')],_0x598a76=>{const _0x2a0b7e=_0x356bd5,_0x1021f6={'CHxBW':function(_0xcdad9f,_0x13051e){const _0x48bcf7=_0x2727;return _0x47c90e[_0x48bcf7(0x1db,'qXaw')](_0xcdad9f,_0x13051e);},'creMB':_0x47c90e[_0x2a0b7e(0x34c,'L^6^')],'wETmr':_0x47c90e[_0x2a0b7e(0x284,'tv^Z')],'DXJqW':function(_0x254ade,_0x2f3ff2){const _0x29d04a=_0x2a0b7e;return _0x47c90e[_0x29d04a(0x35c,'8zkQ')](_0x254ade,_0x2f3ff2);},'OYvhW':_0x47c90e[_0x2a0b7e(0x29f,'XsH^')]};if(_0x47c90e[_0x2a0b7e(0x35a,'cK$q')](_0x47c90e[_0x2a0b7e(0x332,'oduR')],_0x47c90e[_0x2a0b7e(0x1d4,'n!Jc')])){if(_0x36f565[_0x2a0b7e(0x356,'%zdA')])return{'role':fGcNMP[_0x2a0b7e(0x259,'Catq')](_0x5e9a09[_0x2a0b7e(0x2e1,'BH1H')],fGcNMP[_0x2a0b7e(0x26d,'Qpl9')])?fGcNMP[_0x2a0b7e(0x2b4,'qXaw')]:_0x2b7a3a[_0x2a0b7e(0x2f0,'cK$q')],'parts':_0x36135f[_0x2a0b7e(0x1dd,'X1YZ')]};return{'role':fGcNMP[_0x2a0b7e(0x303,'dd]9')](_0x27f1e5[_0x2a0b7e(0x207,'nEf$')],fGcNMP[_0x2a0b7e(0x2d9,']oXJ')])?fGcNMP[_0x2a0b7e(0x353,'tv^Z')]:_0x11abea[_0x2a0b7e(0x2d7,'MOjf')],'parts':[{'text':fGcNMP[_0x2a0b7e(0x333,'tv^Z')](typeof _0x529a4b[_0x2a0b7e(0x32e,'tC5X')],fGcNMP[_0x2a0b7e(0x260,'Es$d')])?_0xa25979[_0x2a0b7e(0x1fd,'*O0m')]:_0x9fb40e[_0x2a0b7e(0x1a7,'%zdA')](_0x3cd996[_0x2a0b7e(0x330,'wB#e')])}]};}else{_0x9a68af+=_0x598a76[_0x2a0b7e(0x1ce,'06$r')](_0x47c90e[_0x2a0b7e(0x2cc,'YAOm')]);const _0x66a3e9=_0x9a68af[_0x2a0b7e(0x21e,'7^xD')]('\x0a');_0x9a68af=_0x66a3e9[_0x2a0b7e(0x291,'7^xD')]();for(const _0x4b3fc9 of _0x66a3e9){if(_0x47c90e[_0x2a0b7e(0x1f0,']oXJ')](_0x47c90e[_0x2a0b7e(0x29e,'06$r')],_0x47c90e[_0x2a0b7e(0x296,'BH1H')])){const _0x410e58=_0x4b3fc9[_0x2a0b7e(0x24e,'YAOm')]();if(!_0x410e58||_0x47c90e[_0x2a0b7e(0x31b,'rRU8')](_0x410e58,_0x47c90e[_0x2a0b7e(0x1b7,'qXaw')]))continue;const _0x5ed59f=_0x410e58[_0x2a0b7e(0x28d,'7^xD')](_0x47c90e[_0x2a0b7e(0x2c3,'n!Jc')])?_0x410e58[_0x2a0b7e(0x29b,'Hg82')](0x3f1+0x13e+0x529*-0x1):_0x410e58;try{const _0xfb8ef7=JSON[_0x2a0b7e(0x20d,'Hg82')](_0x5ed59f),_0x1e9797=_0xfb8ef7[_0x2a0b7e(0x347,'MEF@')]?.[0x1f7*-0xd+-0x206+0x1b91]?.[_0x2a0b7e(0x21c,'z)vU')]?.[_0x2a0b7e(0x26b,'L^6^')]??[];for(const _0x210d18 of _0x1e9797){if(_0x210d18[_0x2a0b7e(0x205,'sdHX')]&&_0x210d18[_0x2a0b7e(0x213,'Hg82')])_0x4a1e27+=_0x210d18[_0x2a0b7e(0x257,'aL^U')],_0x47c90e[_0x2a0b7e(0x23d,'79RB')](_0x517853,_0x210d18[_0x2a0b7e(0x1c9,'Qpl9')]);else{if(_0x210d18[_0x2a0b7e(0x23b,'a%*x')])_0x4a3681+=_0x210d18[_0x2a0b7e(0x1e0,'AEXS')],_0x47c90e[_0x2a0b7e(0x1e8,'tv^Z')](_0x29ea2c,_0x210d18[_0x2a0b7e(0x19f,'CueE')]);else{if(_0x210d18[_0x2a0b7e(0x358,'wB#e')+'ll']){if(_0x47c90e[_0x2a0b7e(0x238,'XsH^')](_0x47c90e[_0x2a0b7e(0x224,'MOjf')],_0x47c90e[_0x2a0b7e(0x324,'8zkQ')]))_0x70c68[_0x2a0b7e(0x1fc,'wB#e')](_0x210d18);else{const _0x2d6e0b=GPcDhP[_0x2a0b7e(0x190,']oXJ')](_0x12ca21,_0x151022),_0x18b903=_0x2d6e0b?.[_0x2a0b7e(0x1d7,'aL^U')]??GPcDhP[_0x2a0b7e(0x1e9,'AEXS')];if(!_0x5139b5[_0x2a0b7e(0x2dd,'gGxE')](_0x18b903))throw new _0x5ee0f6(_0x2a0b7e(0x22d,'YAOm')+_0x2a0b7e(0x2df,'wB#e')+_0x2a0b7e(0x1fe,'rRU8')+_0x18b903);const _0x4d1ec3={'inlineData':{'mimeType':_0x18b903,'data':_0x35fc2f[_0x2a0b7e(0x35e,'B2c3')](GPcDhP[_0x2a0b7e(0x276,'oduR')])}},_0x41648f=_0x3178e2[GPcDhP[_0x2a0b7e(0x27b,'BH1H')](_0xc8dab6[_0x2a0b7e(0x1b6,'n!Jc')],-0xf17*0x2+-0x6ee*0x2+0x2c0b)];if(GPcDhP[_0x2a0b7e(0x2ba,'rRU8')](_0x41648f?.[_0x2a0b7e(0x2f0,'cK$q')],GPcDhP[_0x2a0b7e(0x31d,'dd]9')]))_0x41648f[_0x2a0b7e(0x212,'XsH^')][_0x2a0b7e(0x2a8,']oXJ')](_0x4d1ec3);else _0x20373e[_0x2a0b7e(0x298,'Qpl9')]({'role':GPcDhP[_0x2a0b7e(0x1ba,'orUm')],'parts':[_0x4d1ec3]});}}}}}}catch{}}else{const _0x1edc98={'QpnOf':function(_0x197701,_0x323096){const _0x12c6ad=_0x2a0b7e;return GPcDhP[_0x12c6ad(0x265,'9%E1')](_0x197701,_0x323096);},'GQelW':GPcDhP[_0x2a0b7e(0x359,'06$r')],'VpGsh':GPcDhP[_0x2a0b7e(0x2d1,'sdHX')],'CRezi':function(_0x517175,_0x3e4944){const _0x2369f9=_0x2a0b7e;return GPcDhP[_0x2369f9(0x1a6,'%zdA')](_0x517175,_0x3e4944);},'hBYUY':GPcDhP[_0x2a0b7e(0x20a,'L^6^')]},_0x187ae0=_0x453ecc[_0x2a0b7e(0x331,'z)vU')](_0x24eb43=>_0x24eb43[_0x2a0b7e(0x2da,'n!Jc')]===_0x2a0b7e(0x1d6,'79RB')),_0x4a8e3d=_0x5f5900??(_0x187ae0?GPcDhP[_0x2a0b7e(0x1eb,'8zkQ')](typeof _0x187ae0[_0x2a0b7e(0x348,'zS$[')],GPcDhP[_0x2a0b7e(0x2ed,'*R3*')])?_0x187ae0[_0x2a0b7e(0x1ee,'B2c3')]:_0x187ae0[_0x2a0b7e(0x2ad,'*R3*')]?.[0xd99*-0x1+0x3*-0x51a+-0x1ce7*-0x1]?.[_0x2a0b7e(0x213,'Hg82')]??'':null),_0x124529=_0x2395da[_0x2a0b7e(0x196,'BH1H')](_0x28927c=>_0x28927c[_0x2a0b7e(0x219,'w[@F')]!==_0x2a0b7e(0x319,'g5mQ'))[_0x2a0b7e(0x198,'cK$q')](_0x563da4=>{const _0x46337d=_0x2a0b7e;if(_0x563da4[_0x46337d(0x1d1,'a%*x')])return{'role':_0x1edc98[_0x46337d(0x290,'a%*x')](_0x563da4[_0x46337d(0x20f,'8zkQ')],_0x1edc98[_0x46337d(0x2e2,'tC5X')])?_0x1edc98[_0x46337d(0x18d,'*O0m')]:_0x563da4[_0x46337d(0x227,'Qpl9')],'parts':_0x563da4[_0x46337d(0x2ac,'BH1H')]};return{'role':_0x1edc98[_0x46337d(0x211,'cK$q')](_0x563da4[_0x46337d(0x237,'rRU8')],_0x1edc98[_0x46337d(0x30f,'Qpl9')])?_0x1edc98[_0x46337d(0x1ca,'w[@F')]:_0x563da4[_0x46337d(0x277,'06$r')],'parts':[{'text':_0x1edc98[_0x46337d(0x1ae,'gGxE')](typeof _0x563da4[_0x46337d(0x31a,'YAOm')],_0x1edc98[_0x46337d(0x302,'CueE')])?_0x563da4[_0x46337d(0x21d,'w3Wi')]:_0x29c397[_0x46337d(0x226,'zS$[')](_0x563da4[_0x46337d(0x2a7,'cK$q')])}]};});if(_0x160fbb){const _0x569755=GPcDhP[_0x2a0b7e(0x1c3,'XrmH')](_0x33da54,_0x10ae30),_0x233d72=_0x569755?.[_0x2a0b7e(0x30d,']oXJ')]??GPcDhP[_0x2a0b7e(0x35f,'z)vU')];if(!_0x564b9b[_0x2a0b7e(0x327,'oduR')](_0x233d72))throw new _0x243caf(_0x2a0b7e(0x34b,'aL^U')+_0x2a0b7e(0x28b,'w[@F')+_0x2a0b7e(0x33e,'9%E1')+_0x233d72);const _0x114c77={'inlineData':{'mimeType':_0x233d72,'data':_0x1a9174[_0x2a0b7e(0x2af,'XsH^')](GPcDhP[_0x2a0b7e(0x2f1,'n!Jc')])}},_0x3a25e8=_0x124529[GPcDhP[_0x2a0b7e(0x194,'rRU8')](_0x124529[_0x2a0b7e(0x1b3,'0M&j')],-0x7*0x186+0x91*-0x25+0x7e8*0x4)];if(GPcDhP[_0x2a0b7e(0x203,'w3Wi')](_0x3a25e8?.[_0x2a0b7e(0x2ab,'%zdA')],GPcDhP[_0x2a0b7e(0x2eb,'sdHX')]))_0x3a25e8[_0x2a0b7e(0x2ce,'YAOm')][_0x2a0b7e(0x206,'%zdA')](_0x114c77);else _0x124529[_0x2a0b7e(0x1e3,'Zbci')]({'role':GPcDhP[_0x2a0b7e(0x1c4,'XsH^')],'parts':[_0x114c77]});}return{'model':_0x1d68d6[_0x2a0b7e(0x222,'tC5X')],'request':{'contents':_0x124529,'generationConfig':{'thinkingConfig':{'thinkingLevel':GPcDhP[_0x2a0b7e(0x279,'a%*x')],'includeThoughts':!![]}},'safetySettings':[{'category':GPcDhP[_0x2a0b7e(0x27d,'sdHX')],'threshold':GPcDhP[_0x2a0b7e(0x240,'z)vU')]},{'category':GPcDhP[_0x2a0b7e(0x2c0,'orUm')],'threshold':GPcDhP[_0x2a0b7e(0x223,'tC5X')]},{'category':GPcDhP[_0x2a0b7e(0x2e5,'Jjj!')],'threshold':GPcDhP[_0x2a0b7e(0x23a,'n!Jc')]},{'category':GPcDhP[_0x2a0b7e(0x2a0,'B2c3')],'threshold':GPcDhP[_0x2a0b7e(0x32d,'mDoP')]}],..._0x2467b0?.[_0x2a0b7e(0x272,'B2c3')]&&{'tools':_0x4c7f84},...GPcDhP[_0x2a0b7e(0x2e9,'B2c3')](_0x4a8e3d,{'systemInstruction':{'role':GPcDhP[_0x2a0b7e(0x22e,'aL^U')],'parts':[{'text':_0x4a8e3d}]}})},'stream':GPcDhP[_0x2a0b7e(0x246,'5*J8')](_0x28b557,![])};}}}}),_0x5919e3[_0x356bd5(0x1bc,']oXJ')]['on'](_0x23b907[_0x356bd5(0x318,'a%*x')],()=>{const _0x163092=_0x356bd5;if(_0x47c90e[_0x163092(0x1b4,'9%E1')](_0x47c90e[_0x163092(0x23f,'dd]9')],_0x47c90e[_0x163092(0x19c,'MEF@')])){if(_0x3b14e6[_0x163092(0x310,'emAM')]&&_0x481091[_0x163092(0x1aa,'Catq')])_0x51cfdb+=_0x500681[_0x163092(0x1de,'g5mQ')],_0x47c90e[_0x163092(0x340,'Zbci')](_0x291011,_0x5d5fc[_0x163092(0x33d,'MOjf')]);else{if(_0x53c1e8[_0x163092(0x2d3,'5*J8')])_0x31de2a+=_0x12d305[_0x163092(0x2dc,'8zkQ')],_0x47c90e[_0x163092(0x255,'Es$d')](_0x1aa77f,_0x300ab8[_0x163092(0x2b8,'BH1H')]);else _0xdbd16c[_0x163092(0x2c4,'*R3*')+'ll']&&_0x2ae46a[_0x163092(0x2b0,'9%E1')](_0x32a37b);}}else{const _0x4b9855=[];if(_0x4a1e27)_0x4b9855[_0x163092(0x2d8,'MEF@')]({'text':_0x4a1e27,'thought':!![]});if(_0x4a3681)_0x4b9855[_0x163092(0x25f,'*O0m')]({'text':_0x4a3681});_0x4b9855[_0x163092(0x2ca,'rRU8')](..._0x70c68),_0x47c90e[_0x163092(0x19d,'Hg82')](_0x49f7d4,_0x4b9855),_0x47c90e[_0x163092(0x2d0,'5*J8')](_0xd0059,{'parts':_0x4b9855});}}),_0x5919e3[_0x356bd5(0x19e,'wB#e')]['on'](_0x23b907[_0x356bd5(0x28c,'9%E1')],_0x58a6ab);});}export async function chat(_0x563a18=[],_0x434c59=null){const _0x1d7714=_0x57be78,_0x19eef9={'odfua':function(_0x7ea0fb,_0x3472dd){return _0x7ea0fb(_0x3472dd);}},{parts:_0x433838}=await _0x19eef9[_0x1d7714(0x285,'B2c3')](callGemini,{'messages':_0x563a18,'fileBuffer':_0x434c59});return _0x433838[_0x1d7714(0x352,'tv^Z')](_0x58dfa5=>!_0x58dfa5[_0x1d7714(0x2c6,'5*J8')])[_0x1d7714(0x322,'5*J8')](_0x4029cb=>_0x4029cb[_0x1d7714(0x2bd,'cK$q')]??'')[_0x1d7714(0x1df,'rRU8')]('');}
|
|
1
|
+
// src/gemini.js โ Gemini API client: non-streaming + streaming
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { fileTypeFromBuffer } from "file-type";
|
|
4
|
+
|
|
5
|
+
const CONFIG = {
|
|
6
|
+
URL: "https://us-central1-gemmy-ai-bdc03.cloudfunctions.net/gemini",
|
|
7
|
+
MODEL: "gemini-pro-latest",
|
|
8
|
+
HEADERS: {
|
|
9
|
+
"User-Agent": "okhttp/5.3.2",
|
|
10
|
+
"Accept-Encoding": "gzip",
|
|
11
|
+
"content-type": "application/json; charset=UTF-8"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const SUPPORTED_MIMES = new Set([
|
|
16
|
+
"image/jpeg","image/png","image/gif","image/webp","image/heic","image/heif",
|
|
17
|
+
"video/mp4","video/mpeg","video/mov","video/avi","video/x-flv","video/mpg",
|
|
18
|
+
"video/webm","video/wmv","video/3gpp",
|
|
19
|
+
"audio/wav","audio/mp3","audio/aiff","audio/aac","audio/ogg","audio/flac",
|
|
20
|
+
"audio/mpeg","audio/ogg; codecs=opus",
|
|
21
|
+
"application/pdf","text/plain","text/html","text/css","text/javascript",
|
|
22
|
+
"text/x-typescript","text/csv","text/markdown","text/x-python",
|
|
23
|
+
"application/json","application/xml","application/rtf"
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
async function getToken() {
|
|
27
|
+
const { data } = await axios.post(
|
|
28
|
+
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=AIzaSyAxof8_SbpDcww38NEQRhNh0Pzvbphh-IQ",
|
|
29
|
+
{ clientType: "CLIENT_TYPE_ANDROID" },
|
|
30
|
+
{ headers: {
|
|
31
|
+
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 12; SM-S9280 Build/AP3A.240905.015.A2)",
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
"X-Android-Package": "com.jetkite.gemmy",
|
|
34
|
+
"X-Android-Cert": "037CD2976D308B4EFD63EC63C48DC6E7AB7E5AF2",
|
|
35
|
+
"X-Firebase-GMPID": "1:652803432695:android:c4341db6033e62814f33f2"
|
|
36
|
+
}}
|
|
37
|
+
);
|
|
38
|
+
return data.idToken;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
42
|
+
// Shared payload builder
|
|
43
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
44
|
+
function buildPayload({ messages, fileBuffer, tools, systemInstruction, stream }) {
|
|
45
|
+
const sysMsg = messages.find(m => m.role === "system");
|
|
46
|
+
const sysText = systemInstruction
|
|
47
|
+
?? (sysMsg
|
|
48
|
+
? typeof sysMsg.content === "string" ? sysMsg.content : sysMsg.parts?.[0]?.text ?? ""
|
|
49
|
+
: null);
|
|
50
|
+
|
|
51
|
+
const contents = messages
|
|
52
|
+
.filter(m => m.role !== "system")
|
|
53
|
+
.map(m => {
|
|
54
|
+
if (m.parts) return { role: m.role === "assistant" ? "model" : m.role, parts: m.parts };
|
|
55
|
+
return {
|
|
56
|
+
role: m.role === "assistant" ? "model" : m.role,
|
|
57
|
+
parts: [{ text: typeof m.content === "string" ? m.content : JSON.stringify(m.content) }]
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (fileBuffer) {
|
|
62
|
+
const result = fileTypeFromBuffer(fileBuffer);
|
|
63
|
+
const mimeType = result?.mime ?? "application/octet-stream";
|
|
64
|
+
if (!SUPPORTED_MIMES.has(mimeType)) throw new Error(`Unsupported file type: ${mimeType}`);
|
|
65
|
+
const filePart = { inlineData: { mimeType, data: fileBuffer.toString("base64") } };
|
|
66
|
+
const last = contents[contents.length - 1];
|
|
67
|
+
if (last?.role === "user") last.parts.push(filePart);
|
|
68
|
+
else contents.push({ role: "user", parts: [filePart] });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
model: CONFIG.MODEL,
|
|
73
|
+
request: {
|
|
74
|
+
contents,
|
|
75
|
+
generationConfig: {
|
|
76
|
+
thinkingConfig: { thinkingLevel: "HIGH", includeThoughts: true },
|
|
77
|
+
temperature: 0
|
|
78
|
+
},
|
|
79
|
+
safetySettings: [
|
|
80
|
+
{ category: "HARM_CATEGORY_HARASSMENT", threshold: "BLOCK_NONE" },
|
|
81
|
+
{ category: "HARM_CATEGORY_HATE_SPEECH", threshold: "BLOCK_NONE" },
|
|
82
|
+
{ category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", threshold: "BLOCK_NONE" },
|
|
83
|
+
{ category: "HARM_CATEGORY_DANGEROUS_CONTENT", threshold: "BLOCK_NONE" }
|
|
84
|
+
],
|
|
85
|
+
...(tools?.length && { tools }),
|
|
86
|
+
...(sysText && { systemInstruction: { role: "user", parts: [{ text: sysText }] } })
|
|
87
|
+
},
|
|
88
|
+
stream: stream ?? false
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
93
|
+
// Non-streaming โ for tool-calling iterations
|
|
94
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
95
|
+
export async function callGemini({ messages = [], fileBuffer = null, tools = null, systemInstruction = null } = {}) {
|
|
96
|
+
const token = await getToken();
|
|
97
|
+
const payload = buildPayload({ messages, fileBuffer, tools, systemInstruction, stream: false });
|
|
98
|
+
|
|
99
|
+
const { data } = await axios.post(CONFIG.URL, payload, {
|
|
100
|
+
headers: { ...CONFIG.HEADERS, authorization: `Bearer ${token}` }
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (!data?.candidates?.length) throw new Error("No response candidates from API");
|
|
104
|
+
const parts = data.candidates[0].content?.parts ?? [];
|
|
105
|
+
return { parts, raw: data };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
109
|
+
// Streaming โ for final answers (chat mode + agent final response)
|
|
110
|
+
//
|
|
111
|
+
// Callbacks:
|
|
112
|
+
// onThought(chunk) โ thinking chunks (thought: true)
|
|
113
|
+
// onText(chunk) โ response text chunks
|
|
114
|
+
// onDone(allParts) โ called once when stream ends
|
|
115
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
116
|
+
export async function callGeminiStream({
|
|
117
|
+
messages = [], fileBuffer = null, tools = null, systemInstruction = null,
|
|
118
|
+
onThought, onText, onDone
|
|
119
|
+
} = {}) {
|
|
120
|
+
const token = await getToken();
|
|
121
|
+
const payload = buildPayload({ messages, fileBuffer, tools, systemInstruction, stream: true });
|
|
122
|
+
|
|
123
|
+
const response = await axios.post(CONFIG.URL, payload, {
|
|
124
|
+
headers: { ...CONFIG.HEADERS, authorization: `Bearer ${token}` },
|
|
125
|
+
responseType: "stream",
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
let buf = "";
|
|
130
|
+
let thinkAcc = "";
|
|
131
|
+
let textAcc = "";
|
|
132
|
+
const callParts = [];
|
|
133
|
+
|
|
134
|
+
response.data.on("data", chunk => {
|
|
135
|
+
buf += chunk.toString("utf8");
|
|
136
|
+
const lines = buf.split("\n");
|
|
137
|
+
buf = lines.pop();
|
|
138
|
+
|
|
139
|
+
for (const line of lines) {
|
|
140
|
+
const raw = line.trim();
|
|
141
|
+
if (!raw || raw === "data: [DONE]") continue;
|
|
142
|
+
const json = raw.startsWith("data: ") ? raw.slice(6) : raw;
|
|
143
|
+
try {
|
|
144
|
+
const obj = JSON.parse(json);
|
|
145
|
+
const parts = obj.candidates?.[0]?.content?.parts ?? [];
|
|
146
|
+
for (const p of parts) {
|
|
147
|
+
if (p.thought && p.text) {
|
|
148
|
+
thinkAcc += p.text;
|
|
149
|
+
onThought?.(p.text);
|
|
150
|
+
} else if (p.text) {
|
|
151
|
+
textAcc += p.text;
|
|
152
|
+
onText?.(p.text);
|
|
153
|
+
} else if (p.functionCall) {
|
|
154
|
+
callParts.push(p);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch {}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
response.data.on("end", () => {
|
|
162
|
+
const finalParts = [];
|
|
163
|
+
if (thinkAcc) finalParts.push({ text: thinkAcc, thought: true });
|
|
164
|
+
if (textAcc) finalParts.push({ text: textAcc });
|
|
165
|
+
finalParts.push(...callParts);
|
|
166
|
+
onDone?.(finalParts);
|
|
167
|
+
resolve({ parts: finalParts });
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
response.data.on("error", reject);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
175
|
+
// Convenience: plain non-streaming text chat
|
|
176
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
177
|
+
export async function chat(messages = [], fileBuffer = null) {
|
|
178
|
+
const { parts } = await callGemini({ messages, fileBuffer });
|
|
179
|
+
return parts.filter(p => !p.thought).map(p => p.text ?? "").join("");
|
|
180
|
+
}
|
package/src/tools.js
CHANGED
|
@@ -197,17 +197,39 @@ export const FUNCTION_DECLARATIONS = [
|
|
|
197
197
|
// โโ Execute โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
198
198
|
{
|
|
199
199
|
name: "run_shell",
|
|
200
|
-
description: "Execute any shell command and
|
|
200
|
+
description: "Execute any shell command and stream output live. Use for: npm/pip install, tests, builds, git, system commands, file operations. Uses an IDLE timeout โ only killed if it stops producing output, not based on total duration. For servers/watchers that run forever, set background=true.",
|
|
201
201
|
parameters: {
|
|
202
202
|
type: "OBJECT",
|
|
203
203
|
properties: {
|
|
204
|
-
command:
|
|
205
|
-
cwd:
|
|
206
|
-
timeout:
|
|
204
|
+
command: { type: "STRING", description: "Shell command to run" },
|
|
205
|
+
cwd: { type: "STRING", description: "Working directory (default: current)" },
|
|
206
|
+
timeout: { type: "NUMBER", description: "Idle timeout in ms โ killed only if no output for this long (default: 60000)" },
|
|
207
|
+
background: { type: "BOOLEAN", description: "Run in background and return immediately (for dev servers, watchers, daemons that never exit). Use check_background to view output later." }
|
|
207
208
|
},
|
|
208
209
|
required: ["command"]
|
|
209
210
|
}
|
|
210
211
|
},
|
|
212
|
+
{
|
|
213
|
+
name: "check_background",
|
|
214
|
+
description: "Check status and recent output of background processes started with run_shell(background=true). Call without id to list all background processes.",
|
|
215
|
+
parameters: {
|
|
216
|
+
type: "OBJECT",
|
|
217
|
+
properties: {
|
|
218
|
+
id: { type: "STRING", description: "Background process id (e.g. 'bg-1'). Leave empty to list all." }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: "stop_background",
|
|
224
|
+
description: "Stop a background process started with run_shell(background=true).",
|
|
225
|
+
parameters: {
|
|
226
|
+
type: "OBJECT",
|
|
227
|
+
properties: {
|
|
228
|
+
id: { type: "STRING", description: "Background process id to stop (e.g. 'bg-1')" }
|
|
229
|
+
},
|
|
230
|
+
required: ["id"]
|
|
231
|
+
}
|
|
232
|
+
},
|
|
211
233
|
|
|
212
234
|
// โโ Git โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
213
235
|
{
|
|
@@ -273,6 +295,16 @@ export const FUNCTION_DECLARATIONS = [
|
|
|
273
295
|
description: "Get current environment info: working directory, platform, Node.js version, git branch, shell, home directory.",
|
|
274
296
|
parameters: { type: "OBJECT", properties: {} }
|
|
275
297
|
},
|
|
298
|
+
{
|
|
299
|
+
name: "get_skills",
|
|
300
|
+
description: "ALWAYS call this at the start of every task. Returns available skills โ each skill contains expert instructions for specific task types. If a relevant skill exists, call get_skills again with its slug to read the full instructions before proceeding.",
|
|
301
|
+
parameters: {
|
|
302
|
+
type: "OBJECT",
|
|
303
|
+
properties: {
|
|
304
|
+
slug: { type: "STRING", description: "Skill slug to read full content. Leave empty to list all available skills." }
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
276
308
|
|
|
277
309
|
// โโ Real-time โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
278
310
|
{
|
|
@@ -352,7 +384,7 @@ export const GEMINI_TOOLS = [{ functionDeclarations: FUNCTION_DECLARATIONS }];
|
|
|
352
384
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
353
385
|
// Confirmation for destructive actions
|
|
354
386
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
355
|
-
const DESTRUCTIVE = new Set(["write_file","patch_file","append_file","run_shell","create_dir","delete_file","move_file","download_file"]);
|
|
387
|
+
const DESTRUCTIVE = new Set(["write_file","patch_file","append_file","run_shell","create_dir","delete_file","move_file","download_file","stop_background"]);
|
|
356
388
|
|
|
357
389
|
export async function askConfirm(label, autoApprove) {
|
|
358
390
|
if (autoApprove) return true;
|
|
@@ -368,6 +400,43 @@ export async function askConfirm(label, autoApprove) {
|
|
|
368
400
|
});
|
|
369
401
|
}
|
|
370
402
|
|
|
403
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
404
|
+
// Shell execution helpers
|
|
405
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
406
|
+
|
|
407
|
+
// Background process registry: id -> { proc, command, cwd, startedAt, output, exited, exitCode }
|
|
408
|
+
const bgProcesses = new Map();
|
|
409
|
+
let bgCounter = 0;
|
|
410
|
+
|
|
411
|
+
/** Pick the most compatible shell available */
|
|
412
|
+
function resolveShell() {
|
|
413
|
+
const candidates = [process.env.SHELL, "/bin/bash", "/usr/bin/bash", "/bin/sh"];
|
|
414
|
+
for (const c of candidates) {
|
|
415
|
+
if (c && fs.existsSync(c)) return c;
|
|
416
|
+
}
|
|
417
|
+
return "sh";
|
|
418
|
+
}
|
|
419
|
+
const SHELL_BIN = resolveShell();
|
|
420
|
+
|
|
421
|
+
/** Env flags that make common CLIs non-interactive (avoids hangs on prompts) */
|
|
422
|
+
function nonInteractiveEnv() {
|
|
423
|
+
return {
|
|
424
|
+
...process.env,
|
|
425
|
+
CI: "1",
|
|
426
|
+
DEBIAN_FRONTEND: "noninteractive",
|
|
427
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
428
|
+
PIP_NO_INPUT: "1",
|
|
429
|
+
npm_config_yes: "true",
|
|
430
|
+
NO_COLOR: "1",
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Kill a process AND its full process group (descendants included) */
|
|
435
|
+
function killGroup(proc, signal = "SIGTERM") {
|
|
436
|
+
try { process.kill(-proc.pid, signal); }
|
|
437
|
+
catch { try { proc.kill(signal); } catch {} }
|
|
438
|
+
}
|
|
439
|
+
|
|
371
440
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
372
441
|
// Tool executor
|
|
373
442
|
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -544,19 +613,51 @@ export async function executeTool(name, args = {}, { autoApprove = false } = {})
|
|
|
544
613
|
|
|
545
614
|
// โโ Execute โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
546
615
|
case "run_shell": {
|
|
547
|
-
const cwd
|
|
548
|
-
|
|
549
|
-
|
|
616
|
+
const cwd = args.cwd ? path.resolve(args.cwd) : process.cwd();
|
|
617
|
+
|
|
618
|
+
// โโ Background mode โ fire and forget, return immediately โโ
|
|
619
|
+
if (args.background) {
|
|
620
|
+
const id = `bg-${++bgCounter}`;
|
|
621
|
+
const proc = spawn(SHELL_BIN, ["-c", args.command], {
|
|
622
|
+
cwd,
|
|
623
|
+
env: nonInteractiveEnv(),
|
|
624
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
625
|
+
detached: true,
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
const entry = {
|
|
629
|
+
proc, command: args.command, cwd,
|
|
630
|
+
startedAt: Date.now(), output: "",
|
|
631
|
+
exited: false, exitCode: null,
|
|
632
|
+
};
|
|
633
|
+
bgProcesses.set(id, entry);
|
|
634
|
+
|
|
635
|
+
proc.stdout.on("data", c => { entry.output += c.toString(); });
|
|
636
|
+
proc.stderr.on("data", c => { entry.output += c.toString(); });
|
|
637
|
+
proc.on("exit", code => { entry.exited = true; entry.exitCode = code; });
|
|
638
|
+
proc.unref();
|
|
639
|
+
|
|
640
|
+
return { result: `Started in background as ${id}\nCommand: ${args.command}\nUse check_background(id="${id}") to view output.` };
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// โโ Foreground mode โ stream output, idle-based timeout โโ
|
|
644
|
+
const idleTimeout = args.timeout || 60000; // killed only if silent this long
|
|
645
|
+
const maxDuration = 15 * 60 * 1000; // absolute safety ceiling
|
|
646
|
+
const border = chalk.hex("#32323E")("โ ");
|
|
647
|
+
const heartbeatMs = 10000; // show "still running" every 10s of silence
|
|
550
648
|
|
|
551
649
|
return new Promise((resolve) => {
|
|
552
|
-
const proc
|
|
650
|
+
const proc = spawn(SHELL_BIN, ["-c", args.command], {
|
|
553
651
|
cwd,
|
|
554
|
-
env:
|
|
652
|
+
env: nonInteractiveEnv(),
|
|
653
|
+
stdio: ["ignore", "pipe", "pipe"], // ignore stdin โ no hangs waiting for input
|
|
654
|
+
detached: true, // own process group โ can kill all descendants
|
|
555
655
|
});
|
|
556
656
|
|
|
557
|
-
let
|
|
558
|
-
let
|
|
559
|
-
let
|
|
657
|
+
let stdout = "", stderr = "", linesBuf = "";
|
|
658
|
+
let resolved = false, killedReason = null;
|
|
659
|
+
let idleTimer, maxTimer, heartbeatTimer;
|
|
660
|
+
let lastOutputAt = Date.now();
|
|
560
661
|
|
|
561
662
|
const printLine = (line, isErr) => {
|
|
562
663
|
const color = isErr ? chalk.hex("#FF9060") : chalk.hex("#7A7A9A");
|
|
@@ -566,44 +667,113 @@ export async function executeTool(name, args = {}, { autoApprove = false } = {})
|
|
|
566
667
|
const flushLines = (text, isErr) => {
|
|
567
668
|
linesBuf += text;
|
|
568
669
|
const lines = linesBuf.split("\n");
|
|
569
|
-
linesBuf = lines.pop();
|
|
670
|
+
linesBuf = lines.pop();
|
|
570
671
|
lines.forEach(l => printLine(l, isErr));
|
|
571
672
|
};
|
|
572
673
|
|
|
674
|
+
const resetIdleTimer = () => {
|
|
675
|
+
lastOutputAt = Date.now();
|
|
676
|
+
clearTimeout(idleTimer);
|
|
677
|
+
idleTimer = setTimeout(() => {
|
|
678
|
+
killedReason = `idle timeout โ no output for ${idleTimeout/1000}s`;
|
|
679
|
+
killGroup(proc, "SIGTERM");
|
|
680
|
+
setTimeout(() => killGroup(proc, "SIGKILL"), 3000);
|
|
681
|
+
}, idleTimeout);
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
const finalize = (code) => {
|
|
685
|
+
if (resolved) return;
|
|
686
|
+
resolved = true;
|
|
687
|
+
clearTimeout(idleTimer);
|
|
688
|
+
clearTimeout(maxTimer);
|
|
689
|
+
clearInterval(heartbeatTimer);
|
|
690
|
+
if (linesBuf) printLine(linesBuf, false);
|
|
691
|
+
|
|
692
|
+
const out = (stdout + stderr).trim() || "(no output)";
|
|
693
|
+
const tag = killedReason ? `\n[killed: ${killedReason}]` : "";
|
|
694
|
+
resolve({ result: out + tag, exitCode: code ?? (killedReason ? -1 : 0), streamed: true });
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// Absolute safety ceiling โ protects against truly runaway commands
|
|
698
|
+
maxTimer = setTimeout(() => {
|
|
699
|
+
killedReason = `max duration exceeded (${maxDuration/60000} min)`;
|
|
700
|
+
killGroup(proc, "SIGTERM");
|
|
701
|
+
setTimeout(() => killGroup(proc, "SIGKILL"), 3000);
|
|
702
|
+
}, maxDuration);
|
|
703
|
+
|
|
704
|
+
// Heartbeat โ shows the process is alive during quiet phases
|
|
705
|
+
heartbeatTimer = setInterval(() => {
|
|
706
|
+
const idleFor = Date.now() - lastOutputAt;
|
|
707
|
+
if (idleFor > heartbeatMs && !resolved) {
|
|
708
|
+
process.stdout.write(
|
|
709
|
+
chalk.hex("#3A3A4E")(` โฏ still running (${Math.floor(idleFor/1000)}s no output)\n`)
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}, heartbeatMs);
|
|
713
|
+
|
|
714
|
+
resetIdleTimer();
|
|
715
|
+
|
|
573
716
|
proc.stdout.on("data", chunk => {
|
|
574
717
|
const text = chunk.toString();
|
|
575
718
|
stdout += text;
|
|
576
719
|
flushLines(text, false);
|
|
720
|
+
resetIdleTimer();
|
|
577
721
|
});
|
|
578
722
|
|
|
579
723
|
proc.stderr.on("data", chunk => {
|
|
580
724
|
const text = chunk.toString();
|
|
581
725
|
stderr += text;
|
|
582
726
|
flushLines(text, true);
|
|
727
|
+
resetIdleTimer();
|
|
583
728
|
});
|
|
584
729
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
proc.on("close", code => {
|
|
593
|
-
clearTimeout(timer);
|
|
594
|
-
// flush remaining buffer
|
|
595
|
-
if (linesBuf) printLine(linesBuf, false);
|
|
596
|
-
const out = (stdout + (stderr ? stderr : "")).trim() || "(no output)";
|
|
597
|
-
resolve({ result: out, exitCode: code ?? 0, streamed: true });
|
|
730
|
+
// 'exit' fires when the process itself exits, but stdio
|
|
731
|
+
// streams might stay open briefly if a descendant still
|
|
732
|
+
// holds the fd. Give it a short grace period, then
|
|
733
|
+
// finalize regardless so we never hang forever.
|
|
734
|
+
proc.on("exit", code => {
|
|
735
|
+
setTimeout(() => finalize(code), 1500);
|
|
598
736
|
});
|
|
599
737
|
|
|
738
|
+
proc.on("close", code => finalize(code));
|
|
739
|
+
|
|
600
740
|
proc.on("error", err => {
|
|
601
|
-
|
|
741
|
+
resolved = true;
|
|
742
|
+
clearTimeout(idleTimer);
|
|
743
|
+
clearTimeout(maxTimer);
|
|
744
|
+
clearInterval(heartbeatTimer);
|
|
602
745
|
resolve({ error: err.message, exitCode: -1, streamed: true });
|
|
603
746
|
});
|
|
604
747
|
});
|
|
605
748
|
}
|
|
606
749
|
|
|
750
|
+
case "check_background": {
|
|
751
|
+
if (!args.id) {
|
|
752
|
+
if (bgProcesses.size === 0) return { result: "No background processes running." };
|
|
753
|
+
const list = [...bgProcesses.entries()].map(([id, e]) => {
|
|
754
|
+
const status = e.exited ? `exited (${e.exitCode})` : "running";
|
|
755
|
+
const uptime = Math.floor((Date.now() - e.startedAt) / 1000);
|
|
756
|
+
return `${id} [${status}] ${uptime}s ${e.command}`;
|
|
757
|
+
}).join("\n");
|
|
758
|
+
return { result: list };
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const entry = bgProcesses.get(args.id);
|
|
762
|
+
if (!entry) return { error: `Background process "${args.id}" not found.` };
|
|
763
|
+
const status = entry.exited ? `exited (code ${entry.exitCode})` : "still running";
|
|
764
|
+
const tail = entry.output.split("\n").slice(-50).join("\n");
|
|
765
|
+
return { result: `Status: ${status}\nCommand: ${entry.command}\n\nOutput (last 50 lines):\n${tail}` };
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
case "stop_background": {
|
|
769
|
+
const entry = bgProcesses.get(args.id);
|
|
770
|
+
if (!entry) return { error: `Background process "${args.id}" not found.` };
|
|
771
|
+
killGroup(entry.proc, "SIGTERM");
|
|
772
|
+
setTimeout(() => killGroup(entry.proc, "SIGKILL"), 3000);
|
|
773
|
+
bgProcesses.delete(args.id);
|
|
774
|
+
return { result: `Stopped ${args.id}` };
|
|
775
|
+
}
|
|
776
|
+
|
|
607
777
|
// โโ Git โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
608
778
|
case "git": {
|
|
609
779
|
const cwd = args.cwd ? path.resolve(args.cwd) : process.cwd();
|
|
@@ -694,6 +864,25 @@ export async function executeTool(name, args = {}, { autoApprove = false } = {})
|
|
|
694
864
|
};
|
|
695
865
|
}
|
|
696
866
|
|
|
867
|
+
case "get_skills": {
|
|
868
|
+
const { loadSkills, SKILLS_DIR } = await import("./skills.js");
|
|
869
|
+
const skills = loadSkills();
|
|
870
|
+
|
|
871
|
+
// No slug โ list all available skills
|
|
872
|
+
if (!args.slug) {
|
|
873
|
+
if (!skills.length) return { result: "No skills installed." };
|
|
874
|
+
const list = skills.map(s =>
|
|
875
|
+
`${s.slug}\n description: ${s.description}`
|
|
876
|
+
).join("\n\n");
|
|
877
|
+
return { result: `Available skills:\n\n${list}\n\nTo read a skill: call get_skills with slug="<slug>"` };
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// Slug provided โ return full SKILL.md content
|
|
881
|
+
const skill = skills.find(s => s.slug === args.slug);
|
|
882
|
+
if (!skill) return { error: `Skill "${args.slug}" not found. Call get_skills without slug to see available skills.` };
|
|
883
|
+
return { result: skill.content };
|
|
884
|
+
}
|
|
885
|
+
|
|
697
886
|
// โโ Real-time โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
698
887
|
case "get_weather": {
|
|
699
888
|
const loc = encodeURIComponent(args.location);
|
|
@@ -841,6 +1030,7 @@ function confirmLabel(name, args) {
|
|
|
841
1030
|
delete_file: () => `${chalk.red("DELETE")}: ${chalk.yellow(args.path)}`,
|
|
842
1031
|
move_file: () => `Move: ${chalk.yellow(args.from)} โ ${chalk.yellow(args.to)}`,
|
|
843
1032
|
download_file: () => `Download: ${chalk.cyan(args.url)} โ ${chalk.yellow(args.dest)}`,
|
|
1033
|
+
stop_background: () => `Stop bg process: ${chalk.yellow(args.id)}`,
|
|
844
1034
|
};
|
|
845
1035
|
return labels[name]?.() ?? `Execute: ${name}`;
|
|
846
1036
|
}
|
package/src/utils/proxy.js
CHANGED
|
@@ -1 +1,187 @@
|
|
|
1
|
-
const _0x151091=_0x2d16;(function(_0x2eb3d3,_0x230410){const _0x8ab202=_0x2d16,_0x3914de=_0x2eb3d3();while(!![]){try{const _0x3ff89a=parseInt(_0x8ab202(0xf6,'CvX]'))/(-0x1f4*0x13+-0x80d*0x4+0x4551)*(parseInt(_0x8ab202(0xe3,'AOE0'))/(-0x1a2f*-0x1+-0x3a*0x3b+0xccf*-0x1))+-parseInt(_0x8ab202(0x1dd,'kwXB'))/(0x1238+0x12*-0x20b+0x1291)*(parseInt(_0x8ab202(0x25e,'e1Uy'))/(0x12d*-0x16+-0x3*-0x9d9+-0x1*0x3a9))+parseInt(_0x8ab202(0x25a,'uD[m'))/(0x6*-0x62b+-0x120*0x2+-0x5*-0x7db)*(parseInt(_0x8ab202(0xff,'tI1!'))/(-0x988+-0x4*-0x439+-0x3*0x272))+-parseInt(_0x8ab202(0x274,'oe4y'))/(-0x1946+0x131d+0x630)+-parseInt(_0x8ab202(0xd4,'K!Q4'))/(0xc1*0xa+0x718+-0xe9a)*(parseInt(_0x8ab202(0xda,'dRM@'))/(0x14d1+0x1*-0x2627+0x1*0x115f))+-parseInt(_0x8ab202(0x16e,'x#JC'))/(0xac2+0x1d7b+0x2833*-0x1)*(parseInt(_0x8ab202(0x249,'6Qji'))/(0x907+-0x1c12+0x2*0x98b))+parseInt(_0x8ab202(0x1f6,'bt3h'))/(0x5d1*-0x5+0x40*-0x27+0x10d*0x25)*(parseInt(_0x8ab202(0x1a3,'qz6q'))/(0x1c6e+-0x2004+0x3a3));if(_0x3ff89a===_0x230410)break;else _0x3914de['push'](_0x3914de['shift']());}catch(_0x2f4aca){_0x3914de['push'](_0x3914de['shift']());}}}(_0x2f5b,-0x1*-0x848b+-0x3ee*-0x1a8+-0x93b3));import _0x36e9ba from'axios';const proxyPool=[{'name':_0x151091(0x203,'bt3h'),'host':_0x151091(0x1d8,'!Zn!')+_0x151091(0x1b4,'PRVm')+_0x151091(0x1ad,'6]Ix')},{'name':'eu','host':_0x151091(0x153,'Oklf')+_0x151091(0xd8,'AOE0')},{'name':_0x151091(0x226,'6]Ix'),'host':_0x151091(0x132,'&[rl')+_0x151091(0x1ac,'8Q%c')+_0x151091(0x11b,']BLJ')+_0x151091(0x25b,'ru01')},{'name':_0x151091(0x23c,'e1Uy'),'host':_0x151091(0xf2,'6Qji')+_0x151091(0x145,'&[rl')+_0x151091(0xe2,'0fYZ')+_0x151091(0x1c3,'$y8&')+'v/'},{'name':_0x151091(0x16c,'qz6q'),'host':_0x151091(0x1da,'uW^q')+_0x151091(0x1db,'NL8r')+_0x151091(0x21a,'e1Uy')+_0x151091(0x1bf,'bt3h')+'v/'},{'name':_0x151091(0x243,'$eyi'),'host':_0x151091(0x16f,'JW#7')+_0x151091(0x135,']BLJ')+_0x151091(0x1a9,']BLJ')+_0x151091(0x15f,'8Q%c')+_0x151091(0x1a7,'pwNl')},{'name':_0x151091(0x1ca,'Oklf'),'host':_0x151091(0xe0,'&6Qp')+_0x151091(0x17c,'8Q%c')+_0x151091(0x25c,'Oklf')+'/'},{'name':_0x151091(0x259,'Oklf'),'host':_0x151091(0x26e,'[)yR')+_0x151091(0x24c,'*ebI')+_0x151091(0x204,'dRM@')+_0x151091(0xfe,'bt3h')+_0x151091(0x218,'N2YF')},{'name':_0x151091(0x1c1,'&6Qp'),'host':_0x151091(0x254,'&[rl')+_0x151091(0x253,'t8Os')+_0x151091(0x177,']BLJ')+_0x151091(0x18e,'AOE0')},{'name':_0x151091(0x230,'xn!^'),'host':_0x151091(0x21e,'PRVm')+_0x151091(0xcf,'[)yR')+_0x151091(0x17a,'!Zn!')},{'name':_0x151091(0x1d2,'NL8r')+_0x151091(0x1f0,'bt3h'),'host':_0x151091(0x256,'dRM@')+_0x151091(0x22b,'6]Ix')+_0x151091(0x10b,'!n1R')+_0x151091(0x15c,'6]Ix')},{'name':_0x151091(0x1c0,'xn!^')+_0x151091(0x157,'CvX]'),'host':_0x151091(0x26b,'pwNl')+_0x151091(0x1e2,'6Qji')+_0x151091(0x1dc,'GwV2')+_0x151091(0x1ab,'U^9v')+_0x151091(0xcc,'Fqws')+_0x151091(0x129,'uW^q')+_0x151091(0x15a,'uD[m')}],userAgents=[_0x151091(0xf4,'YjD$')+_0x151091(0x205,'&6Qp')+_0x151091(0x1f7,'uW^q')+_0x151091(0x26d,'[)yR')+_0x151091(0xf0,'[fXe')+_0x151091(0x26c,'pwNl')+_0x151091(0x187,'tI1!')+_0x151091(0xe6,'#V5)')+_0x151091(0x113,'*ebI')+_0x151091(0xeb,'e1Uy')+_0x151091(0x150,'GwV2')+'6',_0x151091(0x1ba,'%%]l')+_0x151091(0x120,'bt3h')+_0x151091(0x106,'&[rl')+_0x151091(0x18f,'CvX]')+_0x151091(0x111,'dRM@')+_0x151091(0x1bd,'aEH8')+_0x151091(0x1d5,'&6Qp')+_0x151091(0xf7,'!Zn!')+_0x151091(0x123,'qz6q')+_0x151091(0x18b,'PRVm')+_0x151091(0x231,'JW#7')+'6',_0x151091(0x1f3,'ZWgO')+_0x151091(0x24a,'bt3h')+_0x151091(0x110,'uD[m')+_0x151091(0x1fd,'6Qji')+_0x151091(0x1fa,']BLJ')+_0x151091(0x268,'kwXB')+_0x151091(0x232,'uW^q')+_0x151091(0x171,'uW^q')+_0x151091(0x247,'Fqws')+_0x151091(0x255,'t8Os')+_0x151091(0x1d9,'!n1R')+_0x151091(0x128,'PRVm'),_0x151091(0x1b3,'uW^q')+_0x151091(0x20e,'YjD$')+_0x151091(0xf8,'e1Uy')+_0x151091(0x174,'uW^q')+_0x151091(0x26f,'bt3h')+_0x151091(0x202,'Oklf')+_0x151091(0x1c4,')ObG')+_0x151091(0x229,'bt3h')+_0x151091(0x168,'N2YF')+_0x151091(0x169,'aEH8')+'6',_0x151091(0xea,'$y8&')+_0x151091(0x143,'CvX]')+_0x151091(0xf9,'PRVm')+_0x151091(0x1d7,')ObG')+_0x151091(0x163,'dRM@')+_0x151091(0x266,'uD[m')+_0x151091(0x124,'ru01')+_0x151091(0x178,'aEH8'),_0x151091(0x20c,'x#JC')+_0x151091(0x17e,'!Zn!')+_0x151091(0x11e,'N2YF')+_0x151091(0x136,'*ebI')+_0x151091(0x12e,'Fqws')+_0x151091(0x13d,'dRM@')+_0x151091(0x184,'8Q%c')+_0x151091(0x1ea,'!n1R')+_0x151091(0x212,'pwNl')+_0x151091(0x197,'K!Q4')+_0x151091(0x1a8,'pwNl')+_0x151091(0x11d,'NL8r'),_0x151091(0x17b,'GwV2')+_0x151091(0xe1,'K!Q4')+_0x151091(0x105,'[)yR')+_0x151091(0x1f2,'GwV2')+_0x151091(0x262,'8Q%c')+_0x151091(0x165,'UpvV')+_0x151091(0x107,'t8Os')+_0x151091(0x10a,'NL8r')+_0x151091(0x12c,'e1Uy')+_0x151091(0x1fe,')ObG')+_0x151091(0xd2,'6Qji')+_0x151091(0x19c,'&[rl')+_0x151091(0xdb,'$y8&'),_0x151091(0x1c2,'vwn4')+_0x151091(0x1bc,'pwNl')+_0x151091(0x144,'vwn4')+_0x151091(0x10e,'kwXB')+_0x151091(0x1a4,'tI1!')+_0x151091(0x158,'Oklf')+_0x151091(0x21f,'bt3h')+_0x151091(0x1b1,'xn!^')+_0x151091(0x269,'%%]l')+_0x151091(0x1aa,'!Zn!')+_0x151091(0x21c,'U^9v')+_0x151091(0xdd,'%%]l'),_0x151091(0x21d,'NL8r')+_0x151091(0x224,'JW#7')+_0x151091(0x211,'&[rl')+_0x151091(0x100,'[fXe')+_0x151091(0x126,'aEH8')+_0x151091(0x137,'!Zn!')+_0x151091(0x248,'GwV2')+_0x151091(0x1ef,')ObG')+_0x151091(0x26a,'ru01')+_0x151091(0xec,'qz6q')+_0x151091(0x235,'Oklf')+_0x151091(0x214,'PRVm')+_0x151091(0x185,'!Zn!')+_0x151091(0x20b,'&6Qp'),_0x151091(0x1a2,'NL8r')+_0x151091(0x1a1,'&[rl')+_0x151091(0x173,'JW#7')+_0x151091(0x13c,'vwn4')+_0x151091(0x11a,'!Zn!')+_0x151091(0x18d,'&6Qp')+_0x151091(0x192,'[fXe'),_0x151091(0x138,'&[rl')+_0x151091(0xee,'x#JC'),_0x151091(0x223,'bt3h')+'.2'],failedProxies=new Map(),COOLDOWN_MS=(0x5d9+0x2658+-0x1*0x2c22)*(0x1bd4+0xe3c+-0x29d4)*(-0x18fa+-0x25b3+0x4295),MAX_RETRIES=0x2299+0x2243+0x7*-0x9d6,SKIP_PATTERNS=[_0x151091(0x162,'uD[m'),_0x151091(0x166,'qz6q'),_0x151091(0x1e9,'&6Qp'),'::'];let _enabled=!![],_verbose=![];export function setProxyVerbose(_0x559919){_verbose=_0x559919;}export function setProxyEnabled(_0x5bd54a){_enabled=_0x5bd54a;}function log(_0x46bbe3){const _0x902b34=_0x151091,_0x6b4db3={'gwJte':function(_0x4c000,_0x4a4a9c){return _0x4c000+_0x4a4a9c;},'qZPZo':_0x902b34(0x1cf,'kwXB')};if(_verbose)process[_0x902b34(0x151,'ru01')][_0x902b34(0x25d,'qz6q')](_0x6b4db3[_0x902b34(0x210,'Fqws')](_0x6b4db3[_0x902b34(0x11f,'AOE0')](_0x6b4db3[_0x902b34(0x139,'xk5^')],_0x46bbe3),'\x0a'));}function warn(_0x425a55){const _0x45b0e4=_0x151091,_0xeff904={'cRHxP':function(_0x1caa4c,_0x32e0d5){return _0x1caa4c+_0x32e0d5;},'hivBD':function(_0x3c7e66,_0x4636eb){return _0x3c7e66+_0x4636eb;},'krvta':_0x45b0e4(0x12f,'vwn4')};process[_0x45b0e4(0x155,'UpvV')][_0x45b0e4(0x175,'uD[m')](_0xeff904[_0x45b0e4(0x17f,'i0zM')](_0xeff904[_0x45b0e4(0x109,'UpvV')](_0xeff904[_0x45b0e4(0x186,'PRVm')],_0x425a55),'\x0a'));}function flushCooldowns(){const _0x2ff1ab=_0x151091,_0x139762={'dRqdw':function(_0x177437,_0x19c6ed){return _0x177437>_0x19c6ed;},'otPZu':function(_0x53dcf8,_0x1c3f8e){return _0x53dcf8-_0x1c3f8e;},'IdLvd':function(_0x277a9b,_0x276f71){return _0x277a9b(_0x276f71);}},_0x1cc3c0=Date[_0x2ff1ab(0x239,'ZWgO')]();for(const [_0x20317a,_0x561eb4]of failedProxies){_0x139762[_0x2ff1ab(0xd6,'e1Uy')](_0x139762[_0x2ff1ab(0x1eb,'Oklf')](_0x1cc3c0,_0x561eb4),COOLDOWN_MS)&&(failedProxies[_0x2ff1ab(0x116,'GwV2')](_0x20317a),_0x139762[_0x2ff1ab(0x176,'%%]l')](log,_0x20317a+(_0x2ff1ab(0x225,'uW^q')+_0x2ff1ab(0x23e,'[)yR')+_0x2ff1ab(0x182,'[)yR')+_0x2ff1ab(0x207,'uD[m'))));}}function pickProxy(){const _0x4bc962=_0x151091,_0x146888={'JFtAq':function(_0x3664dc){return _0x3664dc();},'dOmPc':function(_0x345826,_0x24df07){return _0x345826===_0x24df07;},'uJFLi':function(_0x32366a,_0xc5bf1f){return _0x32366a===_0xc5bf1f;},'jQivv':_0x4bc962(0x198,'oe4y'),'lFdzk':_0x4bc962(0xdf,'!Zn!'),'rSjmd':function(_0x4c5d0e,_0x5bdfe4){return _0x4c5d0e(_0x5bdfe4);},'MFISd':_0x4bc962(0x160,'NL8r')+_0x4bc962(0x1e1,'8Q%c')+_0x4bc962(0x1b5,'$y8&')+'a','bfEql':function(_0x9cab50,_0x37bb7c){return _0x9cab50*_0x37bb7c;}};_0x146888[_0x4bc962(0x19f,'xn!^')](flushCooldowns);const _0x158252=proxyPool[_0x4bc962(0x1a5,'kwXB')](_0x5d5f26=>!failedProxies[_0x4bc962(0x121,'aEH8')](_0x5d5f26[_0x4bc962(0x21b,'ZWgO')]));if(_0x146888[_0x4bc962(0x1e8,'#V5)')](_0x158252[_0x4bc962(0x242,'K!Q4')],-0xd95+-0x72+0x4ad*0x3)){if(_0x146888[_0x4bc962(0x1e0,'!Zn!')](_0x146888[_0x4bc962(0x24e,']BLJ')],_0x146888[_0x4bc962(0x18a,'kwXB')]))_0x2974ca=_0x5d4ea0;else return _0x146888[_0x4bc962(0x16d,'x#JC')](warn,_0x146888[_0x4bc962(0x1f1,'pwNl')]),failedProxies[_0x4bc962(0x13a,'xn!^')](),proxyPool[Math[_0x4bc962(0x133,']BLJ')](_0x146888[_0x4bc962(0x180,'*ebI')](Math[_0x4bc962(0x10c,'oe4y')](),proxyPool[_0x4bc962(0x1bb,'6Qji')]))];}return _0x158252[Math[_0x4bc962(0x199,'uW^q')](_0x146888[_0x4bc962(0x209,'N2YF')](Math[_0x4bc962(0x240,'&[rl')](),_0x158252[_0x4bc962(0x236,'oe4y')]))];}function pickUA(){const _0x2c6b0c=_0x151091,_0x54c0f8={'IOYRl':function(_0x37a311,_0x2be96c){return _0x37a311*_0x2be96c;}};return userAgents[Math[_0x2c6b0c(0x1b9,'vwn4')](_0x54c0f8[_0x2c6b0c(0x122,'dRM@')](Math[_0x2c6b0c(0x14c,'%%]l')](),userAgents[_0x2c6b0c(0x1f4,'*ebI')]))];}function wrapUrl(_0x552212,_0x47e4f0){const _0x156f9e=_0x151091,_0x9166={'gzMZm':function(_0x3db49b,_0x2a73f5){return _0x3db49b+_0x2a73f5;},'KTvZf':function(_0x249ec4,_0x30a57d){return _0x249ec4(_0x30a57d);}};if(_0x552212[_0x156f9e(0x1c5,'*ebI')][_0x156f9e(0x234,'!Zn!')]('=')||_0x552212[_0x156f9e(0x188,'ZWgO')][_0x156f9e(0x167,'Fqws')]('?'))return _0x9166[_0x156f9e(0x24d,'x#JC')](_0x552212[_0x156f9e(0x1cb,'uW^q')],_0x9166[_0x156f9e(0x1ae,'GwV2')](encodeURIComponent,_0x47e4f0));return _0x9166[_0x156f9e(0xce,'e1Uy')](_0x552212[_0x156f9e(0x257,'$y8&')],_0x47e4f0);}function shouldSkip(_0x45223d){const _0x146f0a=_0x151091;if(!_0x45223d)return!![];if(!_enabled)return!![];return SKIP_PATTERNS[_0x146f0a(0x15b,'6Qji')](_0x3493e5=>_0x45223d[_0x146f0a(0xe9,'N2YF')](_0x3493e5));}function isAlreadyProxied(_0x173ba7){const _0x12085c=_0x151091;return proxyPool[_0x12085c(0x272,'e1Uy')](_0x464577=>_0x173ba7[_0x12085c(0x131,']BLJ')](_0x464577[_0x12085c(0x140,'!Zn!')]));}let _installed=![];function _0x2d16(_0x449651,_0x22b179){_0x449651=_0x449651-(-0x436+-0x13b0+0x81*0x31);const _0x50b932=_0x2f5b();let _0x5a7b98=_0x50b932[_0x449651];if(_0x2d16['MxvYPd']===undefined){var _0xf71691=function(_0x1fc849){const _0x5135ac='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x19df5f='',_0x36dfbc='';for(let _0x584e48=-0x2*0x2e9+-0x33*-0x63+-0xde7,_0x588a42,_0x4eab03,_0x51c7e0=0x107e+-0x25ce+0x8*0x2aa;_0x4eab03=_0x1fc849['charAt'](_0x51c7e0++);~_0x4eab03&&(_0x588a42=_0x584e48%(0x35e*0x1+-0x3*-0x1b+-0x139*0x3)?_0x588a42*(-0x478+0x2e7*-0x7+0x1909*0x1)+_0x4eab03:_0x4eab03,_0x584e48++%(-0x1379*0x1+-0x1099+-0x95*-0x3e))?_0x19df5f+=String['fromCharCode'](0x300+0x1355+-0x1556&_0x588a42>>(-(-0x149e*-0x1+0x81a+-0x1cb6)*_0x584e48&0xc94+-0x3b0+-0x5*0x1c6)):0x108b+-0x1f48+0xebd){_0x4eab03=_0x5135ac['indexOf'](_0x4eab03);}for(let _0x5477f1=0x19fd+0x1*-0x16ee+-0x30f,_0x3cbab2=_0x19df5f['length'];_0x5477f1<_0x3cbab2;_0x5477f1++){_0x36dfbc+='%'+('00'+_0x19df5f['charCodeAt'](_0x5477f1)['toString'](-0x15b4+-0x7ed*0x1+0x1db1))['slice'](-(0xdb8+0x1e4c+-0x2c02));}return decodeURIComponent(_0x36dfbc);};const _0x342ff4=function(_0x5d056d,_0x551cf5){let _0x879b37=[],_0x33ebc8=0x1e7a+0x34b+-0x21c5,_0x1aae34,_0x3fdbdf='';_0x5d056d=_0xf71691(_0x5d056d);let _0x511a9e;for(_0x511a9e=0x304+-0xdc1*0x1+0xabd;_0x511a9e<0x2128+-0x5cf+-0x1a59;_0x511a9e++){_0x879b37[_0x511a9e]=_0x511a9e;}for(_0x511a9e=-0x202b+-0x285+0x5*0x6f0;_0x511a9e<-0x127b*-0x2+-0x2*-0x125+-0x2640;_0x511a9e++){_0x33ebc8=(_0x33ebc8+_0x879b37[_0x511a9e]+_0x551cf5['charCodeAt'](_0x511a9e%_0x551cf5['length']))%(0x1f72+-0x1*-0x1e9+-0xb*0x2f1),_0x1aae34=_0x879b37[_0x511a9e],_0x879b37[_0x511a9e]=_0x879b37[_0x33ebc8],_0x879b37[_0x33ebc8]=_0x1aae34;}_0x511a9e=0xb12+0x1*0xd01+-0x1813,_0x33ebc8=-0x3*-0xa61+-0x1851+-0x6d2;for(let _0x1225a0=0x1*0x19ca+0x1*0xffd+-0x29c7;_0x1225a0<_0x5d056d['length'];_0x1225a0++){_0x511a9e=(_0x511a9e+(-0x120e+-0x8ea+-0x5*-0x565))%(0x3ef+-0x8*0x2d4+-0x1*-0x13b1),_0x33ebc8=(_0x33ebc8+_0x879b37[_0x511a9e])%(0x81*-0x1+-0x1540+0x16c1),_0x1aae34=_0x879b37[_0x511a9e],_0x879b37[_0x511a9e]=_0x879b37[_0x33ebc8],_0x879b37[_0x33ebc8]=_0x1aae34,_0x3fdbdf+=String['fromCharCode'](_0x5d056d['charCodeAt'](_0x1225a0)^_0x879b37[(_0x879b37[_0x511a9e]+_0x879b37[_0x33ebc8])%(0x15*-0xff+0x56b*-0x3+0x1316*0x2)]);}return _0x3fdbdf;};_0x2d16['JZvkKj']=_0x342ff4,_0x2d16['tUtCPV']={},_0x2d16['MxvYPd']=!![];}const _0x31bee3=_0x50b932[0x4*-0x44f+-0x2582+0x8f*0x62],_0x3d6b58=_0x449651+_0x31bee3,_0x1b7e9f=_0x2d16['tUtCPV'][_0x3d6b58];return!_0x1b7e9f?(_0x2d16['QHEgNo']===undefined&&(_0x2d16['QHEgNo']=!![]),_0x5a7b98=_0x2d16['JZvkKj'](_0x5a7b98,_0x22b179),_0x2d16['tUtCPV'][_0x3d6b58]=_0x5a7b98):_0x5a7b98=_0x1b7e9f,_0x5a7b98;}function _0x2f5b(){const _0xa62bd5=['WQDAWQbhW44','W6hdRCkOW6JdMZtcH8k1','hIy6W4VcJq','e8onBmoWW4RdIJit4OcIBq','W6ZcTKBdKCoaWOa0W7ldI0m','W7pIH6Gb','WOr/uCkeWRhcUKndW6S','W6BIHyLZ','vexdMmkeha','e37cOSk7WRe','lehdOSkxfG','l2VcIvDKW4fi','bmoOWO7cTtHrWOP3WOBdGa','WRWoCCkCW6e','ySoVW6XQWOTkW6qZWPSVySo1WQa','C1HT','W7NcRSk1n8kSp8omqvRdLa','B8onWRZdTeZdM2/cUfZdQq','ELzl','W7dcMZuxW7S','W5TZxmkUWRNdNbtdT8oRxG','WPtcOSkGmCkSn8ocgqhdMG','pSktnMnPW5i','BKG6WQG','oqTnaWldLenm','W6TeWQm3WPDCW6BcRYldUW','W6ldHqmyW4O','af7dRSkmhG','w8oNlmklgSkcxCkIW5vH','xaFdSreD','qmkLW53dQCop','W47cOKhcL8oJWRjMW4/dHHe','A8owWQldQ1ldHgRcUcFdGW','W6/cS0DTEXqA','dctdN8kfiHddSLO','W7NcQSk7p8kHn8kdhG','W7nsASkoW4ddI8oege7dVG','A1HumcBdLq','WPFdI23cNx5gj1BdOaq','l2xcKs49WOeCfLuy','wg0MWRPa','W6ZdPs8','umkyWRCrC8kUW5q0nq','tbnpW4vg','g8ocW7TEzCkpW5OuorBcMW','FJFdKfzIW59mvXm','BGOJabZcUhOJp8oZ','f2FdVmkxbY4pW5BcGvm','WQ3dKHVcGKNdHJjcWOtdTa','evPqW7BcN1a','W5X7fSkUfq','WQtdKMiFWPZdSCotgsq1','WP3cMHKNW7qtWR7dVCkifW','W43cRXm8W6yYW7BcSmk7','WRpdPXnsFrmagCoIW6G','p8oQCCoWdq','WODOwSkvWQK','WR0XW7FcJqW','rrb4W4CecL/cSei','cLfoW7BcJKFcQLfhWQy','uZhcK8oyWQb6BSoLW67dKq','WRFcRmk3pq','y8kTW5xcISomiSocnCo5W5i','WQ8ZW6JcKahdGmoBWQWqW4u','W7xcOKDVyuTgwSoTWQ4','ihjWdrVdSt8BW64G','AKBdOmkFhG','W4LPkmkOgCkWW7C','nd4aW7zLWOL1xKhcVq','z1jqlsldJtWoWQX6','F2ZcKhuejtZdU8kxW7K','W6TPWPH4W4OiWQFdQhFdUW','WRVdKCkrta','W6RcOvFdNmonW4eTW7lcI0i','WOzOsSkoWQhcKve','khPqkZNdKhyuWRn7','sw7dMSkwlG','WRNdKmoqvwinoq8Rja','WRLVWOrNW4KcWRVdUG','W75/rSoQW7tdHW','c0lcKmk/WRS','WPz5ESkmWR0','WPnlC1tdRGS','ks3dINv7EgdcOSoCW7e','W745W4a5WPvAW6JcT1lcKW','W55soq','dGiyW7tcS8k9xCkC','WQejsmkPW7RcQCk5a0dcPG','AK5MWOxcQSkB','W79YDSoava','kvD/W5ZcVG','WRFcOSkT','WQNcM8oFB3WCWOq','de1tW7tcLuRcRK1MWRS','fwxcGmkt','W4JcRXa','mmk8shBdLxJcSmoxkby','pCkemwn0W5tdTsRdNYi','W7BdSfWUW5pdTq','jgldQ8kn','WQ3cM8oqBg0g','zeqN','evPoW6hcLuhcVa','rIeEpIq','WP7cL8onw2SbWO/dTrzU','W7XPp8kXh8o8WQtcOmkftW','W6b/zCo9W6/cRf3dU8oYxa','WRhdSvJdLSoCWRmHW4q','obKqfdFdNNPvW7yM','kgZcS8k5WOm','imkFnMmWW5tdVshdOIq','rb8umX0','aCoPDmoimW','CrX5W6ryaulcRWGk','iSk9ASoAW4y','W4/cUbyHW7Wi','dUkhPYO','qCkxumofWOvjWQFcMNFdSa','W6ZdPuy6W4/cOSkSxIG0','xmkjg8kzW50bW7ldLIVcUW','W5lcII7cJdXso0ZcT1S','uxpdHSkA','W6xdRcCUW4pdQ1q','WQaku8kVW7RdOq','WRJdSqCsW6ldNh4','W7hdPGf8rCkRdG','WRWisSkJW6BdTCkMuaVdPa','o3/dSCknja','wJdcUmkrWOvnBmoY','WQxdGSktuq','WOf1WQ4gW6S','tWa3dGtcVa','q8onsSoHW53dHZTKuY8','pINdKh8X','k1lcNSk5WRm','W4y9c8opW77dHXjOW5RdQCk2c2G','WQtcQqeVW4xdSKJdR8kXWPS','dvbn','e1nFW4tcMuBcHeHhW6y','WO0nW7S2WQW9WQRdJMPd','W4VdGwjudmo9tCo8bmo/','W5xcQqG0W6XgWRJdSSk9hG','W7BcTaHRWQPpWQddS8oTra','fmkWsIxcKIldUCkdpKy','k8kTugpdLspdTSouEWi','q1bmDMpcJIqvWRf/','BYZdSdaX','hmkWv0pdLhBcOCksBry','ewVcM8kt','tSkNWPG4oW','nbO+W5VdQSofWR5hW7qPqCooWQO','FuTu','W5POm8kTe8kGW6BcHSodsG','W7DhuComtZFdNGNdP8kf','bx7cU8kSWQW','iSkQtgBcIcJcRSkszLW','sHbMW5fEcW','FxlcVa','W6xcOLddNSkdW5r1WQddIbm','BZFdLGeTWQezfeC','W7NdH8kmo2OAWRtdNYjO','mCk8vwBdG2RcRq','bLBcH8ksWRy','WRZcU3z8W5ddMfBcTCoeW6i','WRbeW4GlW5FdI8kZW7ddQSke','W7dcQLJdKG','WOVdJgRdIJKPzrBcK30','ctlcHCoazW','f8kpWO4Wf8khW6W','W6fqWRPUW69RWRm','WPJcJmk3W7xdHG','mr8xW73cHq','DZhdJqKNW5vxvKee','W7hdNSkwxhaaWPpdSWr5','WPi4wmosWQNcHeTDWR/cJq','W7aeW55xWPRcLmkiW7ddG8oktG','W55dlgxcTqu','wXbkW7VdLSkOhCkivvG','iwxdQSoNmIquW5tcIX4','WR7dKCks','W7FdOv4JW4G','rXTPW5HFcL/cTq','DhpdJ8khoZFdUZb2aa','vIRdHSoyW7eKn8k2WO7cNG','BeRdVCkAkKLKWOpcTGG','fKXF','euTP','W6xcHgiOlwOTWRO','qNCYW5zNWOPOyehcUW','uhldGCkljtJdV283qq','W6VcT1BdH8oFW5TPWRJcLKW','fK1w','W5dcNuNcSXtcM2HnW73cSW','WRavt8kGW73dOq','zmoIWRiYW4G3WROE','aGCzWQFcO8kXsSkFcW0','dhhcJSowWRKYmCojW6VdIW','WR3cMgC/i0fhrCk8W6C','WQZcV8k2','WROuvCkJW6BdPCoTrbRdVq','W47cUaG','BIFdKt4v','pW0oAwdcJJ1mW607','W6RdRmosWRZcQuxdMSk5omooW4ZcQ8kp','dNC8W7u3W5C6AbdcHG','bCoxAG','WQRcNSkZg8kK','nMxIGQ1zn8kagHGcgW','hH4q','y8kxCdpcLYNdT8olm1i','WQtdN2zQWO3cQmkTqxb7','e8omnCo+WRH+WORdLdVdUq','W5FcKu7dUCoK','WQ7cSIvwWPS','WOS3W7FdMsRdICozW6HkW4i','lCosWQFcI3ScW4HPWOldLW','DePMWOBcSCkE','kmo0xSoyaq','wb9QW7RcHehcOWelW6a','WOxdPe50W6WiW5tcNSkpea','W77dOx1QW6/dT1pcPCoVWOS','WPpdNHVcJd8eCttcSvy','v33dMmkl','CSk1mhzYW5FdSwNcU2i','W7ZdRc4PW4m','iqFdN10SWRzZWQtcUGq','W6H/xSo9W7NcGG','ELXmkZ/dMga','jaddTwyD','WPtcQComsfC','b0XlWQFcPSkHqmkyaaS','aCoxB8osA8ocg8oWW790','imktmMf+W44','W5rSWQFdL1ZcGSklWRy','xr0XWPrJae7cOWfo','WQvaWQWAW4C','obKqdJ/dK3DuW7u6','W7/cGgi','W7pcSqpcRIm','Be7dSmkllKSOWOZdKv8','WRlcPr8PemoSaCotbSoO','FcRdLX89WOG','WQBdGx0Xkwf+WPjRWQ4','W7RcKCklBKqqdbu','WRldOWaOpejF','WQr4WPXYW5qFW6BdU3ZcRq','WOVcLSoNrvS','W4NcJJBcLtS','qKFcNSkeWQ5NySk5W6ZdJq','W7GzWR0','WO9tAmkfqCo8WQtcOSkDtq','ECkhWR0hk8k7W6H9','g8okCSogpmo7fCoVW7e','gmomFmommCogi8oRW6b5','W6ZdPuy6W4/cOSkSxJSP','dCouCSornW','WPtdVEkbQgtdVbpdTCk8W74c','eSkvCmorn8oBhCoSW7m8','h8kxoYrsW6NcTb7cQMe','sYmVWQFcVmo9cCk1ffq','W6VdULO+W4JdQmkSrwvQ','W6LVAmoXsq','WPPoD0BdTa','W6/cS0bVFr8Aea','rSoxW75BAmoIW6u0iYq','W5BcMW3cMs0JFrFdUWi','Cd8mgdK','W7NcVSkhW6JdVH/dJmo5','aWmpW7m','vxNdM8kjiZm','WOVcM8kYhCk0','yCo6W7aoW5qsWRy0WOql','y8kzWQSApmkRW5f9ANu','W6xdUfXNW4VdUCo1fgzT','FrRcGuq','WOXrDW','WQ/cL8k7dSkl','W63cGfZcOGhdL2qdWQBdVa','W6NcJXakW5C','WOr/uCkeWRe','WRWeW6C9WQ41','avRdUSksbW','tSksWQepj8kQ','W6lcK30','W6P7qmoXWQldKGFcUmoZwq','W7ddOuT9uSkV','W6fjgCo/WQZdT8oCrIddS8k1','WRSovCk2W6FcVmkNgW3dVq','c2FdTmkGfq','WRxcRZDXWQ0G','WOBcPmkPcmkYnmoBx1hcKa','jSk5WQ07W5G','WROodSoZWQFcSCkMb1JcSG','p8oiWQlcJwec','WQlcTJm4W4RcPa','W7dcRe/dKG','WQddHSkmrZ4DorrTAa','W6JcMvJcTre','gdiFW4nKWODKgWtcVq','rmkAzmoJW4BdJIXagcK','WPe5W7/cJaZcJmokW7fkWPm','sIWVhX0','W6hdPIuRW4RdSuJcS8o3','WOhdNIJcINvzjLBdUGq','gtOOW6hcSG','WO3cSIC7W6PHWP8cW5Gx','Ft/cR8oxCqH9WO3dKq','W55IomkPj8k8W7dcIW','gLS6WPOAqaRdPJ4p','W7hcGgmXBtfTW6GKW74','WRSxW6u','CrHVW4bl','jgtdTmkv','utyZbbq','evvSwKBdPYTkxSkxWPTZFW','jZJdJgWND3ZcUSkBWQe','iWCsW618','WP9hWRS7WOyaWQhdThZdUW','uqaTgWNdTa','BXNcGZWviZFdP8kDWQS','W6iQWRzNW5yaWQ3dIhZcUq','W7RdUY8+W4m','WOCbW4uVWQu','rCopCSomlSoqbSoXWRP1','W7lcH34GBtvSW6OKW70','WRtcJmos','dHLsW6JcLSkZbG','W4f1smoXW6hcI1xcOmoOra','gmkEjCo3W4ZdKsXAgdO','mMRcNCkBWRG','w0XuW4RcHCk3qmkAeeS','CcNcPfLn','mmkqhxvX','W6JcGvy','kSk7uxJdHZNcSSkEzra','qCkbd8odWOLaWRi','wSoyjCkGWOpcMMSthGy','wLK5WRBdKmoScCkNbui','W7BcPevRCW','W7NdSCkTW4FdIZ7cOmo9Cmo1','WRhcOSkPla','W43dHuCFW44','d3LEW6NcLW','WQ7dUamXiL9zvCouWQy','WQJdJmkAuq','sXtcIJH6W51lsrTB','WQDbW4K','bSkZWRzVWOLhW7iJW4vm','i8kIpgfl','W5tcNZFcMq','wNLdWPyMW48','amkvW7FcSqm','WRhcP1v5umkprSog','WQFcTZO','WRSFqmkIW7hdTmo7','WRpcJCoxzhDbW4BcQ10+','vg5kWQVcIq','WQ1MWPH4W5q','W6VdK8kmw2GaFbyNjq','EJ/cUCo+qxDgW6RcQxtcVhvx','WRlcSxCUW5VcT8kYq391','WQPsWOCkW4FcL8kV','uqaTgXNcSwG','WRnKzMBdTW','W6JcK1tcJGe','WQRcOrjIW7ddSCoTbdnG','WQy9W77cJWtdH8kvWRelW5O','DdxcQmomCHD7W5tcGIevWOu6','W7NcMmkwW7/dSXBcU8k0mSos','bvzwW6FcMvy','W4JcMYNcJcagzWy','W5JcQ1m','WPpdRfWxW74AW7BcR8k3xq','xmkkEmkmA8oubmoRW6CJ','rvXsWRFdISoKcCk5c0y','EmkKWP7dMCoQm8objSo4W5m','bCkvjCkJWPVdIsXgqYm','WQBdMSoqxxrw','W4DormocW6S','iwddU8kIbYisW4/cKfG','WRqZsmk8W7C','WPjhmMddOX1yBwxdQq','WP8CW6WDWOm','WOzLWO1+W4OaWQNcScZdTq','W6/cPr18CX0abCoVW6K','s3NdHSkli3VdQN4Oxq','AKiSW61ssCkHsmoZgq','WPLeWPvfW6S','WQtIHims','rmkBWQahiq','WOmkW7mWWQ00W6tdKg1z','W6/cPKZdKmoyWOK','WO3dVvqiW7ysW6lcPCoLuG','W5ZcIgv3DZDPW7e5W7S','CWSYbaK','F1zkmJpdJ2avW6yS','WOPxyKldTa1ByYJcPG','BcZdGXG2WOmD','B8kyWRubp8kUW5rYBM8','tNpdH8kfmINdQteNsW','nSktW7FdPsxcJZNdSXVcIW','oSkzk3a','WQ3cSSkdW4NdIa','eghcNmktWQj+','W55ig8knja','tCkfWQypoSkSW5qXdJm','WRuBw8k0W70','WQnLWOrJ','W4DyxCoFrW','W5PdC8oEW7S','DmkeW7pdJcDaW5bPWO/dQxFcMSoo','oe9iW7ZcHf3cKGe','WQVcOSkIiCoGn8ocx1O','WPpcSCkJW4ddNq','WOmUW6BcNaddHCojW6jlWO8','zLzp','W6vNlfRcQW','p23dSJeaWQi0vqih','DJLJW7nW','cmkrW7ZdS1BdKxRdOelcLG','aXGiW7FcL8oUbSoBb0S','FmksW7pdMuCqWOb/WP/dJa','WQn+WOnNW5vwW6FcSgdcTa','WPCYW7xdLaxdHCowW68iW5m','W6nOqCk1W6ZcIu3dUmk1dW','wGOoWQxdIMNcOgHrWP53'];_0x2f5b=function(){return _0xa62bd5;};return _0x2f5b();}export function setupGlobalProxy(){const _0x454f23=_0x151091,_0x537897={'HPaKk':function(_0x59512d,_0x1352e3){return _0x59512d(_0x1352e3);},'TRlNH':function(_0x355460,_0x4d630a){return _0x355460(_0x4d630a);},'SZUqI':function(_0x4adfeb){return _0x4adfeb();},'qTdeV':function(_0x3de817){return _0x3de817();},'lPWPh':function(_0x4b01f0,_0x39225d,_0x13e2c8){return _0x4b01f0(_0x39225d,_0x13e2c8);},'CBHhI':function(_0x50e13c,_0x62b494){return _0x50e13c(_0x62b494);},'qehce':function(_0x60e084,_0xff5036){return _0x60e084+_0xff5036;},'CLCfD':function(_0x3d6d7d,_0x25e42c){return _0x3d6d7d+_0x25e42c;},'Pnkmy':_0x454f23(0x149,'YjD$')+_0x454f23(0x1b6,'$eyi')+'โ\x20','eDGWT':_0x454f23(0x19a,'6]Ix')+_0x454f23(0x216,'0fYZ'),'piIIe':function(_0x2ce609,_0x509537){return _0x2ce609<_0x509537;},'iFfIz':_0x454f23(0xe5,'!Zn!')+_0x454f23(0xd1,'#V5)'),'kLMzI':function(_0x6fc377,_0x1fc918){return _0x6fc377!==_0x1fc918;},'ITuUr':_0x454f23(0x15d,'YjD$'),'VYAFv':function(_0x23fccf){return _0x23fccf();},'qzTMp':function(_0x4ff763,_0xee9989){return _0x4ff763(_0xee9989);},'GjlYT':function(_0x432033,_0x466162){return _0x432033>_0x466162;},'gGNkr':function(_0x224dae,_0x3e953f){return _0x224dae-_0x3e953f;},'QyeDB':function(_0x2d0625,_0x443ccf){return _0x2d0625(_0x443ccf);},'IVhOr':function(_0x2e46cf,_0x246ac7){return _0x2e46cf<_0x246ac7;},'AUQzY':function(_0x43a971,_0x60b9df){return _0x43a971!==_0x60b9df;},'tkeFW':_0x454f23(0x164,'!Zn!'),'RNbRM':_0x454f23(0x22f,'0fYZ'),'UWrCN':_0x454f23(0x115,'i0zM')+_0x454f23(0x12d,'%%]l'),'oLERl':function(_0x2fdc1b,_0x49d564){return _0x2fdc1b(_0x49d564);},'UJxws':function(_0x483663,_0x58ec06){return _0x483663(_0x58ec06);},'JdmCP':function(_0x21b65f,_0x2ac397){return _0x21b65f+_0x2ac397;}};if(_installed)return;_installed=!![],_0x36e9ba[_0x454f23(0xf1,'$y8&')+'rs'][_0x454f23(0x183,'t8Os')][_0x454f23(0x1ed,'oe4y')](_0x3107fe=>{const _0x427f0f=_0x454f23,_0x522195={'JhYNB':function(_0x7d09b8,_0x26711f){const _0x144d96=_0x2d16;return _0x537897[_0x144d96(0x270,'&6Qp')](_0x7d09b8,_0x26711f);},'uagTy':_0x537897[_0x427f0f(0x22e,'e1Uy')],'JhEOB':function(_0x218155,_0x467f8c){const _0x399ac1=_0x427f0f;return _0x537897[_0x399ac1(0x260,'AOE0')](_0x218155,_0x467f8c);}};if(_0x537897[_0x427f0f(0x118,'JW#7')](_0x537897[_0x427f0f(0x14d,'#V5)')],_0x537897[_0x427f0f(0x189,'&[rl')])){const _0x1aceba={'RVhEt':function(_0x5a25c3,_0x396743){const _0x245f29=_0x427f0f;return _0x537897[_0x245f29(0x250,'8Q%c')](_0x5a25c3,_0x396743);},'sSiCd':function(_0x113c01,_0x441bf1){const _0x5e5b35=_0x427f0f;return _0x537897[_0x5e5b35(0x215,']BLJ')](_0x113c01,_0x441bf1);},'vZaVK':function(_0x10ed3f){const _0xa9e41d=_0x427f0f;return _0x537897[_0xa9e41d(0x13e,'x#JC')](_0x10ed3f);},'mYmjK':function(_0xa32657){const _0x1488cf=_0x427f0f;return _0x537897[_0x1488cf(0x190,'*ebI')](_0xa32657);},'gIizc':function(_0x48ad88,_0x10e844,_0x4a2460){const _0x3f9edf=_0x427f0f;return _0x537897[_0x3f9edf(0x273,'vwn4')](_0x48ad88,_0x10e844,_0x4a2460);},'qbhGA':function(_0x24189a,_0x48ecf2){const _0x32328a=_0x427f0f;return _0x537897[_0x32328a(0x170,'[fXe')](_0x24189a,_0x48ecf2);}};if(_0x3cbab2)return;_0x5d056d=!![],_0x551cf5[_0x427f0f(0x219,'kwXB')+'rs'][_0x427f0f(0xd5,'[)yR')][_0x427f0f(0x181,'YjD$')](_0x337329=>{const _0x9b531e=_0x427f0f;if(_0x337329[_0x9b531e(0x24f,'N2YF')])return _0x337329;if(_0x1aceba[_0x9b531e(0x142,'ZWgO')](_0xe153a9,_0x337329[_0x9b531e(0xe7,'6]Ix')]))return _0x337329;if(_0x1aceba[_0x9b531e(0x102,'ZWgO')](_0x552d6a,_0x337329[_0x9b531e(0xfa,'ZWgO')]))return _0x337329;const _0xa9987=_0x1aceba[_0x9b531e(0x148,'ZWgO')](_0x41a27e),_0x3b687e=_0x1aceba[_0x9b531e(0x1e6,'$y8&')](_0x4d873c),_0x46f5e3=_0x337329[_0x9b531e(0x16a,'%%]l')];return _0x337329[_0x9b531e(0x16a,'%%]l')]=_0x1aceba[_0x9b531e(0x1b0,'Oklf')](_0x44b0d0,_0xa9987,_0x46f5e3),_0x337329[_0x9b531e(0x22a,'$y8&')]=![],_0x337329[_0x9b531e(0x258,'uD[m')]=_0x337329[_0x9b531e(0x196,'Oklf')]??{},_0x337329[_0x9b531e(0x1cc,'xk5^')]={'proxyName':_0xa9987[_0x9b531e(0x191,'dRM@')],'proxyHost':_0xa9987[_0x9b531e(0x241,'qz6q')],'originalUrl':_0x46f5e3,'retries':0x0},_0x337329[_0x9b531e(0x246,'K!Q4')]=!![],_0x1aceba[_0x9b531e(0xfd,'&6Qp')](_0x12b103,_0xa9987[_0x9b531e(0x146,'i0zM')]+_0x9b531e(0x1e3,'Oklf')+_0x46f5e3),_0x337329;},_0x467a5b=>_0x8eebf5[_0x427f0f(0x11c,'*ebI')](_0x467a5b)),_0x5d85ce[_0x427f0f(0x1af,'#V5)')+'rs'][_0x427f0f(0x1a6,'dRM@')][_0x427f0f(0x147,'xn!^')](_0x29c1aa=>_0x29c1aa,async _0x345869=>{const _0x5a1743=_0x427f0f,_0x3dc0ab=_0x345869[_0x5a1743(0x125,'&6Qp')],_0x34b8ed=_0x3dc0ab?.[_0x5a1743(0x193,')ObG')];if(_0x34b8ed&&_0x522195[_0x5a1743(0x12a,'K!Q4')](_0x34b8ed[_0x5a1743(0x1ff,'PRVm')],_0x3a9a77)){const _0x4644ad=_0x522195[_0x5a1743(0x1a0,'YjD$')][_0x5a1743(0x12b,'dRM@')]('|');let _0xd5f5e4=0x25d0+-0xdf2+-0x17de;while(!![]){switch(_0x4644ad[_0xd5f5e4++]){case'0':_0x430feb[_0x5a1743(0x233,'h2M3')](_0x34b8ed[_0x5a1743(0x213,'pwNl')],_0x55648f[_0x5a1743(0x1d3,'bt3h')]());continue;case'1':_0x3dc0ab[_0x5a1743(0x14f,'aEH8')]=_0x34b8ed[_0x5a1743(0x23b,'kwXB')+'l'];continue;case'2':_0x34b8ed[_0x5a1743(0x228,'0fYZ')]+=-0x6f*0x34+-0x12a6+-0x2933*-0x1;continue;case'3':return _0x522195[_0x5a1743(0x238,'kwXB')](_0x207dca,_0x3dc0ab);case'4':_0x3dc0ab[_0x5a1743(0x20d,'#V5)')]=![];continue;case'5':_0x522195[_0x5a1743(0x1d1,'tI1!')](_0x533314,_0x5a1743(0x22d,'GwV2')+_0x34b8ed[_0x5a1743(0x244,'kwXB')]+'/'+_0x2742a8+_0x5a1743(0x252,'N2YF')+_0x34b8ed[_0x5a1743(0x23f,'*ebI')+'l']);continue;case'6':_0x522195[_0x5a1743(0x24b,'e1Uy')](_0x1c0cdb,_0x34b8ed[_0x5a1743(0x130,']BLJ')]+_0x5a1743(0x201,'ZWgO')+(_0x345869[_0x5a1743(0x22c,'uW^q')]?.[_0x5a1743(0xe4,'h2M3')]??_0x345869[_0x5a1743(0x18c,'6]Ix')])+(_0x5a1743(0x134,'pwNl')+_0x5a1743(0x1d0,'ZWgO')));continue;}break;}}return _0xd41dbb[_0x5a1743(0x20f,'kwXB')](_0x345869);}),_0x537897[_0x427f0f(0x1fb,'&6Qp')](_0x4f9d3c,_0x537897[_0x427f0f(0x114,'uD[m')](_0x537897[_0x427f0f(0x10d,']BLJ')](_0x537897[_0x427f0f(0x17d,'e1Uy')],_0x16124c[_0x427f0f(0x261,'x#JC')]),_0x537897[_0x427f0f(0x1c8,'Fqws')]));}else{if(_0x3107fe[_0x427f0f(0x156,'ZWgO')])return _0x3107fe;if(_0x537897[_0x427f0f(0x14a,'pwNl')](shouldSkip,_0x3107fe[_0x427f0f(0x23d,'pwNl')]))return _0x3107fe;if(_0x537897[_0x427f0f(0x1f9,'#V5)')](isAlreadyProxied,_0x3107fe[_0x427f0f(0x104,'!Zn!')]))return _0x3107fe;const _0x1068e2=_0x537897[_0x427f0f(0x220,'$y8&')](pickProxy),_0x5d93eb=_0x537897[_0x427f0f(0x1cd,'GwV2')](pickUA),_0x9fbb75=_0x3107fe[_0x427f0f(0x179,'K!Q4')];return _0x3107fe[_0x427f0f(0xcb,'bt3h')]=_0x537897[_0x427f0f(0x1de,'uW^q')](wrapUrl,_0x1068e2,_0x9fbb75),_0x3107fe[_0x427f0f(0x14b,'0fYZ')]=![],_0x3107fe[_0x427f0f(0x19d,'AOE0')]=_0x3107fe[_0x427f0f(0x23a,'K!Q4')]??{},_0x3107fe[_0x427f0f(0x16b,'N2YF')]={'proxyName':_0x1068e2[_0x427f0f(0x112,'$y8&')],'proxyHost':_0x1068e2[_0x427f0f(0x140,'!Zn!')],'originalUrl':_0x9fbb75,'retries':0x0},_0x3107fe[_0x427f0f(0x222,'[fXe')]=!![],_0x537897[_0x427f0f(0x1e7,'e1Uy')](log,_0x1068e2[_0x427f0f(0x25f,'6]Ix')]+_0x427f0f(0x1b8,'&[rl')+_0x9fbb75),_0x3107fe;}},_0x133876=>Promise[_0x454f23(0x1c7,'e1Uy')](_0x133876)),_0x36e9ba[_0x454f23(0xfb,'Oklf')+'rs'][_0x454f23(0x13b,'PRVm')][_0x454f23(0xed,'kwXB')](_0x333797=>_0x333797,async _0x1fd4e3=>{const _0x369821=_0x454f23,_0x327418=_0x1fd4e3[_0x369821(0xf5,'Oklf')],_0x10d256=_0x327418?.[_0x369821(0x217,'NL8r')];if(_0x10d256&&_0x537897[_0x369821(0x264,'e1Uy')](_0x10d256[_0x369821(0x221,'Fqws')],MAX_RETRIES)){if(_0x537897[_0x369821(0xde,'tI1!')](_0x537897[_0x369821(0x1c6,'tI1!')],_0x537897[_0x369821(0x1b7,'uW^q')])){const _0x1992f6=_0x537897[_0x369821(0x119,'K!Q4')][_0x369821(0xe8,'&[rl')]('|');let _0x54c4b3=0x10dc+0x1*0x1065+-0x2141;while(!![]){switch(_0x1992f6[_0x54c4b3++]){case'0':_0x327418[_0x369821(0x271,'[)yR')]=![];continue;case'1':_0x10d256[_0x369821(0x19e,'x#JC')]+=0x19f7+0x1a*-0x39+-0x142c;continue;case'2':failedProxies[_0x369821(0xfc,'pwNl')](_0x10d256[_0x369821(0xd3,'&6Qp')],Date[_0x369821(0x267,'kwXB')]());continue;case'3':_0x537897[_0x369821(0x1d4,'h2M3')](warn,_0x10d256[_0x369821(0x1e4,'0fYZ')]+_0x369821(0x13f,'tI1!')+(_0x1fd4e3[_0x369821(0xef,'aEH8')]?.[_0x369821(0x159,'!n1R')]??_0x1fd4e3[_0x369821(0x1f5,'$eyi')])+(_0x369821(0x103,'&6Qp')+_0x369821(0x208,'vwn4')));continue;case'4':return _0x537897[_0x369821(0x108,'6Qji')](_0x36e9ba,_0x327418);case'5':_0x327418[_0x369821(0xf3,'kwXB')]=_0x10d256[_0x369821(0xcd,'xk5^')+'l'];continue;case'6':_0x537897[_0x369821(0x1f8,'uD[m')](log,_0x369821(0x172,'x#JC')+_0x10d256[_0x369821(0x117,'bt3h')]+'/'+MAX_RETRIES+_0x369821(0x1e5,'UpvV')+_0x10d256[_0x369821(0x1c9,'vwn4')+'l']);continue;}break;}}else{const _0x2fab0c=_0x59ed46[_0x369821(0x101,']BLJ')]();for(const [_0x373c2f,_0x3d5249]of _0x282564){hsihyU[_0x369821(0x154,'qz6q')](hsihyU[_0x369821(0x237,'xk5^')](_0x2fab0c,_0x3d5249),_0x474891)&&(_0x1b7c36[_0x369821(0xd0,'N2YF')](_0x373c2f),hsihyU[_0x369821(0x1b2,'%%]l')](_0x48d9ad,_0x373c2f+(_0x369821(0x1ee,'ZWgO')+_0x369821(0x15e,'[fXe')+_0x369821(0x227,'6Qji')+_0x369821(0x195,'UpvV'))));}}}return Promise[_0x369821(0x251,'pwNl')](_0x1fd4e3);}),_0x537897[_0x454f23(0x206,'$eyi')](log,_0x537897[_0x454f23(0x1fc,'U^9v')](_0x537897[_0x454f23(0x263,'JW#7')](_0x537897[_0x454f23(0x1be,'x#JC')],proxyPool[_0x454f23(0x141,'$y8&')]),_0x537897[_0x454f23(0x245,'x#JC')]));}export function proxyStatus(){const _0x56f047=_0x151091,_0x2ac51c={'XLiGZ':function(_0x5f2054){return _0x5f2054();},'iIvvm':function(_0x1ecd84,_0x4b25ff){return _0x1ecd84-_0x4b25ff;}};_0x2ac51c[_0x56f047(0x1d6,'N2YF')](flushCooldowns);const _0x8c9575=proxyPool[_0x56f047(0x14e,'vwn4')],_0x58a0a9=failedProxies[_0x56f047(0xd9,'6Qji')],_0x5dcb4f=_0x2ac51c[_0x56f047(0x161,'x#JC')](_0x8c9575,_0x58a0a9);return{'total':_0x8c9575,'blocked':_0x58a0a9,'available':_0x5dcb4f,'enabled':_enabled};}
|
|
1
|
+
// src/utils/proxy.js โ CORS proxy rotation untuk menghindari rate-limit & spam detection
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
|
|
4
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
5
|
+
// Proxy pool โ rotasi otomatis tiap request
|
|
6
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
7
|
+
const proxyPool = [
|
|
8
|
+
{ name: "caliph", host: "https://cors.caliph.my.id/" },
|
|
9
|
+
{ name: "eu", host: "https://cors.eu.org/" },
|
|
10
|
+
{ name: "prox", host: "https://prox.26bruunjorl.workers.dev/" },
|
|
11
|
+
{ name: "wave", host: "https://plain-wave-6f5f.apis1.workers.dev/" },
|
|
12
|
+
{ name: "hill", host: "https://young-hill-815e.apis3.workers.dev/" },
|
|
13
|
+
{ name: "icy", host: "https://icy-morning-72e2.apis2.workers.dev/" },
|
|
14
|
+
{ name: "fazri", host: "https://cors.fazri.workers.dev/" },
|
|
15
|
+
{ name: "spring", host: "https://spring-night-57a1.3540746063.workers.dev/" },
|
|
16
|
+
{ name: "sizable", host: "https://cors.sizable.workers.dev/" },
|
|
17
|
+
{ name: "jiashu", host: "https://jiashu.1win.eu.org/" },
|
|
18
|
+
{ name: "artemisandros", host: "https://cors.artemisandros.workers.dev/?" },
|
|
19
|
+
{ name: "supershadowcube", host: "https://cloudflare-cors-anywhere.supershadowcube.workers.dev/?url=" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
// User-Agent pool โ rotate agar tidak terdeteksi sebagai bot
|
|
23
|
+
const userAgents = [
|
|
24
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
|
|
25
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
|
26
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
|
|
27
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
|
|
28
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0",
|
|
29
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15",
|
|
30
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0",
|
|
31
|
+
"Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36",
|
|
32
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1",
|
|
33
|
+
"Dalvik/2.1.0 (Linux; U; Android 13; Pixel 7 Build/TQ3A.230901.001)",
|
|
34
|
+
"okhttp/4.12.0",
|
|
35
|
+
"okhttp/5.3.2",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
39
|
+
// State โ proxy blacklist dengan cooldown
|
|
40
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
41
|
+
const failedProxies = new Map(); // name โ timestamp gagal
|
|
42
|
+
const COOLDOWN_MS = 15 * 60 * 1000; // 15 menit
|
|
43
|
+
const MAX_RETRIES = 2;
|
|
44
|
+
|
|
45
|
+
// URLs yang tidak boleh diproxy (internal / lokal)
|
|
46
|
+
const SKIP_PATTERNS = [
|
|
47
|
+
"localhost",
|
|
48
|
+
"127.0.0.1",
|
|
49
|
+
"0.0.0.0",
|
|
50
|
+
"::",
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
let _enabled = true;
|
|
54
|
+
let _verbose = false;
|
|
55
|
+
|
|
56
|
+
export function setProxyVerbose(v) { _verbose = v; }
|
|
57
|
+
export function setProxyEnabled(v) { _enabled = v; }
|
|
58
|
+
|
|
59
|
+
function log(msg) { if (_verbose) process.stderr.write("[proxy] " + msg + "\n"); }
|
|
60
|
+
function warn(msg) { process.stderr.write("[proxy] " + msg + "\n"); }
|
|
61
|
+
|
|
62
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
63
|
+
// Proxy selection
|
|
64
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
65
|
+
function flushCooldowns() {
|
|
66
|
+
const now = Date.now();
|
|
67
|
+
for (const [name, ts] of failedProxies) {
|
|
68
|
+
if (now - ts > COOLDOWN_MS) {
|
|
69
|
+
failedProxies.delete(name);
|
|
70
|
+
log(`${name} cooldown selesai, dibuka kembali`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function pickProxy() {
|
|
76
|
+
flushCooldowns();
|
|
77
|
+
const available = proxyPool.filter(p => !failedProxies.has(p.name));
|
|
78
|
+
|
|
79
|
+
if (available.length === 0) {
|
|
80
|
+
warn("semua proxy gagal โ reset paksa");
|
|
81
|
+
failedProxies.clear();
|
|
82
|
+
return proxyPool[Math.floor(Math.random() * proxyPool.length)];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return available[Math.floor(Math.random() * available.length)];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function pickUA() {
|
|
89
|
+
return userAgents[Math.floor(Math.random() * userAgents.length)];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function wrapUrl(proxy, originalUrl) {
|
|
93
|
+
// Proxy yang pakai ?url= atau ?= di akhir โ encode URL
|
|
94
|
+
if (proxy.host.endsWith("=") || proxy.host.endsWith("?")) {
|
|
95
|
+
return proxy.host + encodeURIComponent(originalUrl);
|
|
96
|
+
}
|
|
97
|
+
return proxy.host + originalUrl;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function shouldSkip(url) {
|
|
101
|
+
if (!url) return true;
|
|
102
|
+
if (!_enabled) return true;
|
|
103
|
+
return SKIP_PATTERNS.some(p => url.includes(p));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isAlreadyProxied(url) {
|
|
107
|
+
return proxyPool.some(p => url.startsWith(p.host));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
111
|
+
// Setup axios interceptors โ call once at startup
|
|
112
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
113
|
+
let _installed = false;
|
|
114
|
+
|
|
115
|
+
export function setupGlobalProxy() {
|
|
116
|
+
if (_installed) return;
|
|
117
|
+
_installed = true;
|
|
118
|
+
|
|
119
|
+
// REQUEST โ wrap URL dengan proxy
|
|
120
|
+
axios.interceptors.request.use(
|
|
121
|
+
config => {
|
|
122
|
+
// Skip jika sudah diproxy atau internal
|
|
123
|
+
if (config._isProxied) return config;
|
|
124
|
+
if (shouldSkip(config.url)) return config;
|
|
125
|
+
if (isAlreadyProxied(config.url)) return config;
|
|
126
|
+
|
|
127
|
+
const proxy = pickProxy();
|
|
128
|
+
const ua = pickUA();
|
|
129
|
+
const original = config.url;
|
|
130
|
+
|
|
131
|
+
config.url = wrapUrl(proxy, original);
|
|
132
|
+
config.proxy = false; // nonaktifkan proxy system-level Node.js
|
|
133
|
+
config.headers = config.headers ?? {};
|
|
134
|
+
|
|
135
|
+
// Simpan metadata untuk retry
|
|
136
|
+
config._meta = {
|
|
137
|
+
proxyName: proxy.name,
|
|
138
|
+
proxyHost: proxy.host,
|
|
139
|
+
originalUrl: original,
|
|
140
|
+
retries: 0,
|
|
141
|
+
};
|
|
142
|
+
config._isProxied = true;
|
|
143
|
+
|
|
144
|
+
log(`${proxy.name} โ ${original}`);
|
|
145
|
+
return config;
|
|
146
|
+
},
|
|
147
|
+
err => Promise.reject(err)
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// RESPONSE โ auto-retry dengan proxy berbeda jika gagal
|
|
151
|
+
axios.interceptors.response.use(
|
|
152
|
+
res => res,
|
|
153
|
+
async err => {
|
|
154
|
+
const config = err.config;
|
|
155
|
+
const meta = config?._meta;
|
|
156
|
+
|
|
157
|
+
// Hanya retry jika ini request yang sudah diproxy dan belum melebihi batas
|
|
158
|
+
if (meta && meta.retries < MAX_RETRIES) {
|
|
159
|
+
// Tandai proxy ini gagal
|
|
160
|
+
failedProxies.set(meta.proxyName, Date.now());
|
|
161
|
+
warn(`${meta.proxyName} gagal (${err.response?.status ?? err.code}) โ coba proxy lain`);
|
|
162
|
+
|
|
163
|
+
meta.retries += 1;
|
|
164
|
+
config._isProxied = false; // reset agar dicegat ulang
|
|
165
|
+
config.url = meta.originalUrl; // kembalikan URL asli
|
|
166
|
+
|
|
167
|
+
log(`retry ${meta.retries}/${MAX_RETRIES} โ ${meta.originalUrl}`);
|
|
168
|
+
return axios(config);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return Promise.reject(err);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
log("proxy manager aktif โ " + proxyPool.length + " proxy tersedia");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
179
|
+
// Status info (untuk /model command)
|
|
180
|
+
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
181
|
+
export function proxyStatus() {
|
|
182
|
+
flushCooldowns();
|
|
183
|
+
const total = proxyPool.length;
|
|
184
|
+
const blocked = failedProxies.size;
|
|
185
|
+
const available = total - blocked;
|
|
186
|
+
return { total, blocked, available, enabled: _enabled };
|
|
187
|
+
}
|