@pi-oxide/extension-js 0.10.2 → 0.11.0

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/index.js CHANGED
@@ -1,9 +1,9 @@
1
- var Kt = Object.defineProperty;
2
- var Zt = (e, r, n) => r in e ? Kt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
- var M = (e, r, n) => Zt(e, typeof r != "symbol" ? r + "" : r, n);
1
+ var Vt = Object.defineProperty;
2
+ var Zt = (e, r, n) => r in e ? Vt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
+ var P = (e, r, n) => Zt(e, typeof r != "symbol" ? r + "" : r, n);
4
4
  import { z as t } from "zod";
5
- import { collectDocument as Vt, formatSnapshot as Ve, init as zt } from "@pi-oxide/dom-semantic-tree";
6
- const Ce = {
5
+ import { collectDocument as zt, formatSnapshot as Ze, init as Qt } from "@pi-oxide/dom-semantic-tree";
6
+ const Te = {
7
7
  trace: 0,
8
8
  debug: 1,
9
9
  info: 2,
@@ -12,11 +12,11 @@ const Ce = {
12
12
  none: 5
13
13
  };
14
14
  let ze = "trace";
15
- function Qt(e) {
15
+ function Xt(e) {
16
16
  ze = e;
17
17
  }
18
- function Xt(e) {
19
- return Ce[e] >= Ce[ze];
18
+ function Jt(e) {
19
+ return Te[e] >= Te[ze];
20
20
  }
21
21
  function Qe(e, r = "info") {
22
22
  var n;
@@ -41,10 +41,10 @@ function Qe(e, r = "info") {
41
41
  }
42
42
  return String(e);
43
43
  }
44
- function Jt(e) {
44
+ function Yt(e) {
45
45
  return `[extension-js][${e}]`;
46
46
  }
47
- function Yt(e, r) {
47
+ function er(e, r) {
48
48
  if (!e) return "";
49
49
  const n = [];
50
50
  try {
@@ -55,7 +55,7 @@ function Yt(e, r) {
55
55
  }
56
56
  return n.length > 0 ? ` ${n.join(" ")}` : "";
57
57
  }
58
- function ae(e, r) {
58
+ function oe(e, r) {
59
59
  return r.length === 0 ? { event: e } : r.length === 1 && typeof r[0] == "object" && r[0] !== null && !Array.isArray(r[0]) ? { event: e, metadata: r[0] } : {
60
60
  event: e,
61
61
  metadata: { _args: r.map((n) => Qe(n)).join(" ") }
@@ -67,8 +67,8 @@ class Ae {
67
67
  }
68
68
  log(r, n, a) {
69
69
  try {
70
- if (!Xt(r)) return;
71
- const o = Jt(this.namespace), i = Yt(a, r), s = `${o} ${n}${i}`;
70
+ if (!Jt(r)) return;
71
+ const o = Yt(this.namespace), i = er(a, r), s = `${o} ${n}${i}`;
72
72
  switch (r) {
73
73
  case "trace":
74
74
  case "debug":
@@ -92,23 +92,23 @@ class Ae {
92
92
  }
93
93
  }
94
94
  trace(r, ...n) {
95
- const { event: a, metadata: o } = ae(r, n);
95
+ const { event: a, metadata: o } = oe(r, n);
96
96
  this.log("trace", a, o);
97
97
  }
98
98
  debug(r, ...n) {
99
- const { event: a, metadata: o } = ae(r, n);
99
+ const { event: a, metadata: o } = oe(r, n);
100
100
  this.log("debug", a, o);
101
101
  }
102
102
  info(r, ...n) {
103
- const { event: a, metadata: o } = ae(r, n);
103
+ const { event: a, metadata: o } = oe(r, n);
104
104
  this.log("info", a, o);
105
105
  }
106
106
  warn(r, ...n) {
107
- const { event: a, metadata: o } = ae(r, n);
107
+ const { event: a, metadata: o } = oe(r, n);
108
108
  this.log("warn", a, o);
109
109
  }
110
110
  error(r, ...n) {
111
- const { event: a, metadata: o } = ae(r, n);
111
+ const { event: a, metadata: o } = oe(r, n);
112
112
  this.log("error", a, o);
113
113
  }
114
114
  child(r) {
@@ -130,22 +130,22 @@ class Ae {
130
130
  }
131
131
  }
132
132
  const h = new Ae("root"), Xe = /* @__PURE__ */ new Set();
133
- function er(e) {
133
+ function tr(e) {
134
134
  Xe.add(e);
135
135
  }
136
136
  function Je(e) {
137
137
  return Xe.has(e);
138
138
  }
139
- function se(e) {
139
+ function ce(e) {
140
140
  return e == null ? {} : e instanceof Map ? Object.fromEntries(
141
141
  [...e.entries()].map(([r, n]) => [
142
142
  r,
143
- se(n)
143
+ ce(n)
144
144
  ])
145
- ) : Array.isArray(e) ? e.map(se) : e;
145
+ ) : Array.isArray(e) ? e.map(ce) : e;
146
146
  }
147
- const tr = "Content script is not connected on this tab. This tab was likely open before the extension loaded (MV3 does not retro-inject).";
148
- function rr(e) {
147
+ const rr = "Content script is not connected on this tab. This tab was likely open before the extension loaded (MV3 does not retro-inject).";
148
+ function nr(e) {
149
149
  return [
150
150
  `await page.goto(${JSON.stringify(e || "")})`,
151
151
  "Or ask the user to refresh the target tab, then retry fill/click"
@@ -156,12 +156,12 @@ function fe(e, r) {
156
156
  message: e !== void 0 ? `Content script is not connected on tab ${e} (${n}).` : `Content script is not connected on this tab (${n}).`,
157
157
  code: "E_CONTENT_SCRIPT",
158
158
  category: "content-script",
159
- hint: tr,
160
- recovery: rr(r)
159
+ hint: rr,
160
+ recovery: nr(r)
161
161
  };
162
162
  return e !== void 0 && (a.details = { tabId: e, url: n }), a;
163
163
  }
164
- function nr(e) {
164
+ function ar(e) {
165
165
  return {
166
166
  message: `No active tab resolved for ${e}.`,
167
167
  code: "E_NO_TAB",
@@ -172,7 +172,7 @@ function nr(e) {
172
172
  ]
173
173
  };
174
174
  }
175
- function ar(e, r) {
175
+ function or(e, r) {
176
176
  var s, c;
177
177
  const n = e ? "refId" : r != null && r.label ? "label" : null, a = e || (r == null ? void 0 : r.label) || "";
178
178
  let o = `Element not found${n ? ` by ${n} "${a}"` : ""}`;
@@ -194,21 +194,21 @@ function ar(e, r) {
194
194
  };
195
195
  return (c = r == null ? void 0 : r.candidates) != null && c.length && (i.details = { ...i.details, candidates: r.candidates }), i;
196
196
  }
197
- function or(e) {
197
+ function ir(e) {
198
198
  return e.includes("Could not establish connection") || e.includes("Receiving end does not exist") || e.includes("Timeout waiting for content-script ping") || e.includes("content script not available") || e.includes("message port closed before a response was received");
199
199
  }
200
- function Se(e) {
200
+ function ve(e) {
201
201
  const r = new Error(e.message);
202
202
  throw r.code = e.code, e.category && (r.category = e.category), e.hint && (r.hint = e.hint), e.recovery && (r.recovery = e.recovery), e.details && (r.details = e.details), r;
203
203
  }
204
- function ir(e, r) {
205
- let n = `Element not found by label "${e}"`;
206
- if (r != null && r.length) {
207
- const a = r.map((o) => o.name || o.refId).filter(Boolean).slice(0, 5);
208
- n += a.length > 0 ? `. Candidates: ${a.join(", ")}` : ". Candidates: none";
204
+ function sr(e, r, n) {
205
+ let a = `Element not found by label "${e}"`;
206
+ if (r !== void 0) {
207
+ const i = r.map((s) => s.name || s.refId).filter(Boolean).slice(0, 5);
208
+ a += i.length > 0 ? `. Candidates: ${i.join(", ")}` : ". Candidates: none";
209
209
  }
210
210
  return {
211
- message: n,
211
+ message: a,
212
212
  code: "E_NOT_FOUND",
213
213
  category: "resource",
214
214
  hint: "No element matched this label. Check candidates or snapshot for visible controls.",
@@ -216,10 +216,13 @@ function ir(e, r) {
216
216
  "const d = await page.snapshot_data(); find the target in d.nodes",
217
217
  "Try a more specific label or use refId from snapshot"
218
218
  ],
219
- details: r != null && r.length ? { label: e, candidates: r } : { label: e }
219
+ details: {
220
+ label: e,
221
+ ...r != null && r.length ? { candidates: r } : {}
222
+ }
220
223
  };
221
224
  }
222
- function sr(e) {
225
+ function cr(e) {
223
226
  if (!(e instanceof Error)) return {};
224
227
  const r = e.name !== "Error" ? e.name : void 0, n = e.stack;
225
228
  let a;
@@ -234,8 +237,8 @@ function Ye(e, r) {
234
237
  const c = e;
235
238
  return c.hint || c.recovery ? c : c.code === "E_CONTENT_SCRIPT" ? fe(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url) : c;
236
239
  }
237
- const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } = sr(e);
238
- if (or(n))
240
+ const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } = cr(e);
241
+ if (ir(n))
239
242
  return fe(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url);
240
243
  if (n.includes("permission") || n.includes("Permission")) {
241
244
  const c = {
@@ -263,39 +266,39 @@ function Ye(e, r) {
263
266
  function Z(e) {
264
267
  return e instanceof t.ZodEffects ? Z(e.innerType()) : e instanceof t.ZodDefault ? Z(e.removeDefault()) : e instanceof t.ZodPipeline ? Z(e._def.in) : e instanceof t.ZodOptional || e instanceof t.ZodNullable || e instanceof t.ZodBranded || e instanceof t.ZodReadonly ? Z(e.unwrap()) : e instanceof t.ZodCatch ? Z(e.removeCatch()) : e;
265
268
  }
266
- function T(e, r = 0, n = 2) {
269
+ function C(e, r = 0, n = 2) {
267
270
  if (r > n) return "...";
268
271
  if (e instanceof t.ZodObject) {
269
272
  const a = e.shape, o = Object.keys(a).filter((s) => !s.startsWith("__"));
270
273
  return o.length === 0 ? "{ }" : r >= n - 1 ? "{ ... }" : `{ ${o.map((s) => {
271
- const c = a[s], l = c instanceof t.ZodOptional, u = T(l ? c.unwrap() : c, r + 1, n);
274
+ const c = a[s], l = c instanceof t.ZodOptional, u = C(l ? c.unwrap() : c, r + 1, n);
272
275
  return `${s}${l ? "?" : ""}: ${u}`;
273
276
  }).join(", ")} }`;
274
277
  }
275
278
  if (e instanceof t.ZodUnion)
276
- return e.options.map((a) => T(a, r, n)).join(" or ");
279
+ return e.options.map((a) => C(a, r, n)).join(" or ");
277
280
  if (e instanceof t.ZodString) return "string";
278
281
  if (e instanceof t.ZodNumber) return "number";
279
282
  if (e instanceof t.ZodBoolean) return "boolean";
280
283
  if (e instanceof t.ZodBigInt) return "bigint";
281
284
  if (e instanceof t.ZodNull) return "null";
282
285
  if (e instanceof t.ZodArray) {
283
- const a = T(e.element, r + 1, n);
286
+ const a = C(e.element, r + 1, n);
284
287
  return a === "unknown" || a === "any" ? "array" : `${a}[]`;
285
288
  }
286
289
  if (e instanceof t.ZodTuple)
287
- return `[${e.items.map((a) => T(a, r + 1, n)).join(", ")}]`;
290
+ return `[${e.items.map((a) => C(a, r + 1, n)).join(", ")}]`;
288
291
  if (e instanceof t.ZodRecord) {
289
- const a = T(
292
+ const a = C(
290
293
  e._def.valueType,
291
294
  r + 1,
292
295
  n
293
296
  );
294
297
  return a === "unknown" || a === "any" ? "{ [key: string]: unknown }" : `{ [key: string]: ${a} }`;
295
298
  }
296
- return e instanceof t.ZodOptional ? `${T(e.unwrap(), r, n)}?` : e instanceof t.ZodLiteral ? JSON.stringify(e.value) : e instanceof t.ZodEnum ? e.options.map((a) => `"${a}"`).join(" | ") : e instanceof t.ZodAny ? "any" : e instanceof t.ZodUnknown ? "unknown" : e instanceof t.ZodVoid ? "void" : e instanceof t.ZodUndefined ? "undefined" : e instanceof t.ZodEffects ? T(e.innerType(), r, n) : e instanceof t.ZodDefault ? T(e.removeDefault(), r, n) : e instanceof t.ZodNullable ? `${T(e.unwrap(), r, n)} | null` : e instanceof t.ZodLazy ? "lazy" : e instanceof t.ZodPromise ? `Promise<${T(e.unwrap(), r + 1, n)}>` : e instanceof t.ZodFunction ? "function" : e instanceof t.ZodDate ? "Date" : e instanceof t.ZodMap ? "Map" : e instanceof t.ZodSet ? "Set" : e instanceof t.ZodIntersection ? `${T(e._def.left, r, n)} & ${T(e._def.right, r, n)}` : e instanceof t.ZodDiscriminatedUnion ? e.options.map((a) => T(a, r, n)).join(" or ") : e instanceof t.ZodBranded ? T(e.unwrap(), r, n) : e instanceof t.ZodNaN ? "NaN" : e instanceof t.ZodCatch ? T(e.removeCatch(), r, n) : e instanceof t.ZodPipeline ? T(e._def.in, r, n) : e instanceof t.ZodReadonly ? `readonly ${T(e.unwrap(), r, n)}` : "unknown";
299
+ return e instanceof t.ZodOptional ? `${C(e.unwrap(), r, n)}?` : e instanceof t.ZodLiteral ? JSON.stringify(e.value) : e instanceof t.ZodEnum ? e.options.map((a) => `"${a}"`).join(" | ") : e instanceof t.ZodAny ? "any" : e instanceof t.ZodUnknown ? "unknown" : e instanceof t.ZodVoid ? "void" : e instanceof t.ZodUndefined ? "undefined" : e instanceof t.ZodEffects ? C(e.innerType(), r, n) : e instanceof t.ZodDefault ? C(e.removeDefault(), r, n) : e instanceof t.ZodNullable ? `${C(e.unwrap(), r, n)} | null` : e instanceof t.ZodLazy ? "lazy" : e instanceof t.ZodPromise ? `Promise<${C(e.unwrap(), r + 1, n)}>` : e instanceof t.ZodFunction ? "function" : e instanceof t.ZodDate ? "Date" : e instanceof t.ZodMap ? "Map" : e instanceof t.ZodSet ? "Set" : e instanceof t.ZodIntersection ? `${C(e._def.left, r, n)} & ${C(e._def.right, r, n)}` : e instanceof t.ZodDiscriminatedUnion ? e.options.map((a) => C(a, r, n)).join(" or ") : e instanceof t.ZodBranded ? C(e.unwrap(), r, n) : e instanceof t.ZodNaN ? "NaN" : e instanceof t.ZodCatch ? C(e.removeCatch(), r, n) : e instanceof t.ZodPipeline ? C(e._def.in, r, n) : e instanceof t.ZodReadonly ? `readonly ${C(e.unwrap(), r, n)}` : "unknown";
297
300
  }
298
- function cr(e) {
301
+ function lr(e) {
299
302
  const r = Z(e);
300
303
  if (!(r instanceof t.ZodObject))
301
304
  return [];
@@ -338,7 +341,7 @@ function cr(e) {
338
341
  }
339
342
  break;
340
343
  }
341
- const u = T(l, 1, 3) + (c ? " | null" : ""), m = i.description ?? l.description ?? "";
344
+ const u = C(l, 1, 3) + (c ? " | null" : ""), m = i.description ?? l.description ?? "";
342
345
  return {
343
346
  name: o,
344
347
  type: u,
@@ -348,32 +351,32 @@ function cr(e) {
348
351
  });
349
352
  }
350
353
  function et(e) {
351
- return T(e, 0, 3);
354
+ return C(e, 0, 3);
352
355
  }
353
- function lr(e) {
356
+ function dr(e) {
354
357
  return e === null ? "null" : e === void 0 ? "undefined" : Array.isArray(e) ? "array" : typeof e;
355
358
  }
356
- function dr(e, r, n, a) {
359
+ function ur(e, r, n, a) {
357
360
  const o = n.filter((c) => c.path.length === 0), i = n.filter((c) => c.path.length > 0);
358
361
  if (o.length > 0 && i.length === 0) {
359
362
  const c = o.some((u) => u.code === "custom"), l = o.some(
360
363
  (u) => u.code !== "invalid_type" && u.code !== "invalid_literal" && u.code !== "invalid_union"
361
364
  );
362
365
  if (!c && !l) {
363
- const u = T(r), m = lr(a);
366
+ const u = C(r), m = dr(a);
364
367
  return `Invalid parameters for ${e}: expected ${u}${u === "{ }" ? " or no args" : ""}, received ${m}`;
365
368
  }
366
369
  }
367
370
  const s = n.map((c) => `at '${c.path.length > 0 ? c.path.join(".") : "root"}': ${c.message}`);
368
371
  return `Invalid parameters for ${e}: ${s.join("; ")}`;
369
372
  }
370
- async function ur(e, r, n, a, o) {
371
- const i = e.safeParse(se(a));
373
+ async function mr(e, r, n, a, o) {
374
+ const i = e.safeParse(ce(a));
372
375
  if (!i.success)
373
376
  return {
374
377
  ok: !1,
375
378
  error: {
376
- message: dr(
379
+ message: ur(
377
380
  o,
378
381
  e,
379
382
  i.error.issues,
@@ -412,19 +415,19 @@ async function ur(e, r, n, a, o) {
412
415
  };
413
416
  }
414
417
  }
415
- function mr(e, r) {
418
+ function pr(e, r) {
416
419
  return r !== "main-thread" ? r : Je(e) ? "content-script" : r;
417
420
  }
418
- const ve = h.child("tool-registry"), Ne = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map();
421
+ const Se = h.child("tool-registry"), De = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map();
419
422
  let tt = !1, be = null;
420
- function Te(e) {
423
+ function Ce(e) {
421
424
  be = e;
422
425
  }
423
- function De() {
426
+ function Ne() {
424
427
  return be == null ? void 0 : be.signal;
425
428
  }
426
429
  function X() {
427
- const e = De();
430
+ const e = Ne();
428
431
  if (e != null && e.aborted)
429
432
  throw new Error("Runner aborted: ExtensionSession stopped");
430
433
  }
@@ -453,7 +456,7 @@ function p(e) {
453
456
  throw new Error(
454
457
  `Duplicate public name "${r}" for action "${e.action}" (already registered by "${a}")`
455
458
  );
456
- const o = mr(e.action, e.owner), i = {
459
+ const o = pr(e.action, e.owner), i = {
457
460
  ...e,
458
461
  owner: o
459
462
  };
@@ -481,16 +484,16 @@ function p(e) {
481
484
  errorCategory: e.errorCategory,
482
485
  example: e.example
483
486
  };
484
- Ne.set(e.action, s);
487
+ De.set(e.action, s);
485
488
  }
486
- function Oe(e) {
487
- return Ne.get(e);
489
+ function qe(e) {
490
+ return De.get(e);
488
491
  }
489
- function pr() {
492
+ function br() {
490
493
  tt = !0;
491
494
  const e = nt(), r = [];
492
495
  for (const n of e)
493
- n.owner === "main-thread" ? Oe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? Je(n.action) || r.push(
496
+ n.owner === "main-thread" ? qe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? Je(n.action) || r.push(
494
497
  `${n.action} (content-script: missing from content-script action set)`
495
498
  ) : r.push(`${n.action} (unknown owner: ${n.owner})`);
496
499
  if (r.length > 0)
@@ -505,7 +508,7 @@ function nt() {
505
508
  const e = [];
506
509
  for (const [s, c] of pe) {
507
510
  if (c.owner === "rust") continue;
508
- const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : cr(c.params), u = {
511
+ const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : lr(c.params), u = {
509
512
  type: c.returnType ?? et(c.returns),
510
513
  description: c.returnDoc ?? "Result"
511
514
  };
@@ -536,9 +539,9 @@ function nt() {
536
539
  }
537
540
  return e;
538
541
  }
539
- async function C(e, r, n, a, o) {
540
- ve.debug("dispatch_start", { action: e, callId: n, runId: a });
541
- const i = Ne.get(e);
542
+ async function T(e, r, n, a, o) {
543
+ Se.debug("dispatch_start", { action: e, callId: n, runId: a });
544
+ const i = De.get(e);
542
545
  if (!i)
543
546
  return {
544
547
  ok: !1,
@@ -549,18 +552,18 @@ async function C(e, r, n, a, o) {
549
552
  }
550
553
  };
551
554
  X();
552
- const s = await ur(
555
+ const s = await mr(
553
556
  i.params,
554
557
  i.returns,
555
558
  async (c) => i.handler(c, n, a, o),
556
559
  r,
557
560
  e
558
561
  );
559
- return s.ok ? (ve.debug("dispatch_done", {
562
+ return s.ok ? (Se.debug("dispatch_done", {
560
563
  action: e,
561
564
  ok: !0,
562
565
  resultType: typeof s.value
563
- }), s) : (ve.warn("dispatch_error", {
566
+ }), s) : (Se.warn("dispatch_error", {
564
567
  action: e,
565
568
  error: s.error.message,
566
569
  code: s.error.code
@@ -575,15 +578,15 @@ async function C(e, r, n, a, o) {
575
578
  }
576
579
  const Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
577
580
  __proto__: null,
578
- coerceWasmParams: se,
579
- dispatchTool: C,
580
- freezeJsRegistry: pr,
581
- getRunnerSignal: De,
581
+ coerceWasmParams: ce,
582
+ dispatchTool: T,
583
+ freezeJsRegistry: br,
584
+ getRunnerSignal: Ne,
582
585
  getSerializableJsManifest: nt,
583
- getTool: Oe,
586
+ getTool: qe,
584
587
  registerContentScriptJsCall: rt,
585
588
  registerJsCall: p,
586
- setRunnerAbortController: Te,
589
+ setRunnerAbortController: Ce,
587
590
  throwIfAborted: X
588
591
  }, Symbol.toStringTag, { value: "Module" }));
589
592
  let W = null, ge = !1;
@@ -595,7 +598,7 @@ const at = ({ tabId: e }) => {
595
598
  (a = n == null ? void 0 : n.runtime) != null && a.id && r.status === "complete" && (W = e, n.tabs.sendMessage(e, { action: "ping" }).catch(() => {
596
599
  }));
597
600
  };
598
- function br(e) {
601
+ function hr(e) {
599
602
  var r;
600
603
  ge || (r = e == null ? void 0 : e.runtime) != null && r.id && (ge = !0, e.tabs.onActivated.addListener(at), e.tabs.onUpdated.addListener(ot), e.tabs.query({ active: !0, lastFocusedWindow: !0 }).then((n) => {
601
604
  const a = n[0];
@@ -603,7 +606,7 @@ function br(e) {
603
606
  }).catch(() => {
604
607
  }));
605
608
  }
606
- function hr() {
609
+ function fr() {
607
610
  var r;
608
611
  const e = window.chrome;
609
612
  !((r = e == null ? void 0 : e.runtime) != null && r.id) || !ge || (e.tabs.onActivated.removeListener(at), e.tabs.onUpdated.removeListener(ot), ge = !1);
@@ -627,7 +630,7 @@ async function it() {
627
630
  }
628
631
  return e.warn("resolveActiveTabId_result", { tabId: null, reason: "not_found" }), null;
629
632
  }
630
- function fr(e) {
633
+ function gr(e) {
631
634
  if (typeof e == "number" && Number.isFinite(e))
632
635
  return e;
633
636
  if (typeof e == "bigint") {
@@ -636,8 +639,8 @@ function fr(e) {
636
639
  }
637
640
  return null;
638
641
  }
639
- function gr(e, r) {
640
- const n = r.tabId ?? r.tab_id, a = fr(n);
642
+ function yr(e, r) {
643
+ const n = r.tabId ?? r.tab_id, a = gr(n);
641
644
  if (a !== null)
642
645
  return a;
643
646
  if (n != null)
@@ -652,14 +655,14 @@ function I(e, r, n, a) {
652
655
  const o = new Error(e);
653
656
  return o.code = r, n && (o.category = n), a != null && a.hint && (o.hint = a.hint), a != null && a.recovery && (o.recovery = a.recovery), a != null && a.details && (o.details = a.details), o;
654
657
  }
655
- function yr(e) {
658
+ function _r(e) {
656
659
  throw I(e.message, e.code, e.category, {
657
660
  hint: e.hint,
658
661
  recovery: e.recovery,
659
662
  details: e.details
660
663
  });
661
664
  }
662
- let ie = null;
665
+ let se = null;
663
666
  const ye = {
664
667
  action: null,
665
668
  alarms: "alarms",
@@ -696,12 +699,12 @@ async function st() {
696
699
  try {
697
700
  const o = ((n = (r = chrome.runtime).getManifest) == null ? void 0 : n.call(r).permissions) ?? [];
698
701
  let i = [];
699
- (a = chrome.permissions) != null && a.getAll && (i = (await chrome.permissions.getAll()).permissions ?? []), ie = /* @__PURE__ */ new Set([...o, ...i]);
702
+ (a = chrome.permissions) != null && a.getAll && (i = (await chrome.permissions.getAll()).permissions ?? []), se = /* @__PURE__ */ new Set([...o, ...i]);
700
703
  } catch {
701
- ie = null;
704
+ se = null;
702
705
  }
703
706
  else
704
- ie = null;
707
+ se = null;
705
708
  }
706
709
  async function ct() {
707
710
  await st();
@@ -723,9 +726,9 @@ function dt(e) {
723
726
  return n in ye ? ye[n] : n;
724
727
  }
725
728
  function ut(e) {
726
- return e === null ? !0 : ie === null ? !1 : ie.has(e);
729
+ return e === null ? !0 : se === null ? !1 : se.has(e);
727
730
  }
728
- function qe(e, r) {
731
+ function Oe(e, r) {
729
732
  if (r !== null && !ut(r))
730
733
  throw I(
731
734
  `Permission denied: ${r} required for ${e}`,
@@ -733,15 +736,15 @@ function qe(e, r) {
733
736
  "permission"
734
737
  );
735
738
  }
736
- const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
739
+ const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
737
740
  __proto__: null,
738
- checkPermission: qe,
741
+ checkPermission: Oe,
739
742
  hasPermission: ut,
740
743
  initCapabilities: st,
741
744
  manifestPermissionForApiPath: lt,
742
745
  permissionFromChromeAction: dt,
743
746
  refreshCapabilities: ct
744
- }, Symbol.toStringTag, { value: "Module" })), wr = /* @__PURE__ */ new Set([
747
+ }, Symbol.toStringTag, { value: "Module" })), kr = /* @__PURE__ */ new Set([
745
748
  "bookmarks_search",
746
749
  "bookmarks_create",
747
750
  "bookmarks_delete",
@@ -755,12 +758,12 @@ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
755
758
  "notifications_clear"
756
759
  ]);
757
760
  function mt(e) {
758
- return e.startsWith("chrome_") || wr.has(e);
761
+ return e.startsWith("chrome_") || kr.has(e);
759
762
  }
760
763
  function pt(e, r) {
761
764
  return e(...r);
762
765
  }
763
- const kr = /* @__PURE__ */ new Set([
766
+ const Er = /* @__PURE__ */ new Set([
764
767
  "chrome_bookmarks_search",
765
768
  "bookmarks_search",
766
769
  "chrome_history_search",
@@ -770,7 +773,7 @@ const kr = /* @__PURE__ */ new Set([
770
773
  "tab_query"
771
774
  ]);
772
775
  function Me(e, r) {
773
- return r.length > 0 ? r : kr.has(e) ? [{}] : r;
776
+ return r.length > 0 ? r : Er.has(e) ? [{}] : r;
774
777
  }
775
778
  function Pe(e, r) {
776
779
  if (!Array.isArray(e))
@@ -837,7 +840,7 @@ function he(e) {
837
840
  return r;
838
841
  }
839
842
  function d(e, r, n, a, o, i, s, c = [], l, u) {
840
- const m = Er(e), f = a.length > 0 ? `chrome.${a.join(".")}` : r, b = lt(a);
843
+ const m = Ir(e), f = a.length > 0 ? `chrome.${a.join(".")}` : r, b = lt(a);
841
844
  p({
842
845
  action: e,
843
846
  namespace: f,
@@ -848,37 +851,37 @@ function d(e, r, n, a, o, i, s, c = [], l, u) {
848
851
  owner: "main-thread",
849
852
  permission: b ?? void 0,
850
853
  returnType: u ?? void 0,
851
- handler: async (v, g) => {
852
- var re;
853
- const x = h.child("chrome"), D = window.chrome;
854
- if (!((re = D == null ? void 0 : D.runtime) != null && re.id))
854
+ handler: async (S, y) => {
855
+ var ne;
856
+ const x = h.child("chrome"), N = window.chrome;
857
+ if (!((ne = N == null ? void 0 : N.runtime) != null && ne.id))
855
858
  throw I(
856
859
  `${e} is only available in a browser extension context`,
857
860
  "E_NO_EXTENSION",
858
861
  "permission"
859
862
  );
860
- qe(e, b);
863
+ Oe(e, b);
861
864
  const A = Me(
862
865
  e,
863
- Pe(v, e)
864
- ), E = bt(D, a, m);
866
+ Pe(S, e)
867
+ ), E = bt(N, a, m);
865
868
  x.debug("chrome_passthrough", { action: e, argCount: A.length });
866
869
  try {
867
- const q = await pt(E, A);
870
+ const M = await pt(E, A);
868
871
  x.debug("chrome_passthrough_ok", { action: e });
869
- const G = he(q);
870
- return G === void 0 ? null : G;
871
- } catch (q) {
872
- if (typeof q == "object" && q !== null && "code" in q && q.code === "E_INVALID_ARGUMENT_TRANSPORT")
873
- throw q;
874
- const G = we(q);
872
+ const B = he(M);
873
+ return B === void 0 ? null : B;
874
+ } catch (M) {
875
+ if (typeof M == "object" && M !== null && "code" in M && M.code === "E_INVALID_ARGUMENT_TRANSPORT")
876
+ throw M;
877
+ const B = we(M);
875
878
  throw x.debug("chrome_passthrough_err", {
876
879
  action: e,
877
- error: G.error.message
880
+ error: B.error.message
878
881
  }), I(
879
- G.error.message,
880
- G.error.code,
881
- G.error.category
882
+ B.error.message,
883
+ B.error.code,
884
+ B.error.category
882
885
  );
883
886
  }
884
887
  },
@@ -889,22 +892,22 @@ function d(e, r, n, a, o, i, s, c = [], l, u) {
889
892
  example: l
890
893
  });
891
894
  }
892
- function Er(e) {
895
+ function Ir(e) {
893
896
  const r = e.split("_").at(-1);
894
897
  if (!r)
895
898
  throw new Error(`Cannot derive Chrome method name from action "${e}"`);
896
899
  return r;
897
900
  }
898
901
  const ke = {};
899
- function bo(e, r) {
902
+ function Io(e, r) {
900
903
  ke[e] = r;
901
904
  }
902
- function ho(e) {
905
+ function vo(e) {
903
906
  Object.assign(ke, e);
904
907
  }
905
908
  function ht(e) {
906
909
  var r;
907
- if (Oe(e)) return !0;
910
+ if (qe(e)) return !0;
908
911
  if (e.startsWith("host_")) {
909
912
  const n = e.slice(5);
910
913
  return !!ke[n] || !!((r = window.__hostHandlers) != null && r[n]);
@@ -948,8 +951,8 @@ async function ft(e, r) {
948
951
  };
949
952
  }
950
953
  }
951
- const _e = 3e4, gt = 300, Ir = 100, Sr = 500, yt = 500, _t = 500;
952
- function F(e) {
954
+ const _e = 3e4, gt = 300, vr = 100, Sr = 500, yt = 500, _t = 500;
955
+ function G(e) {
953
956
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : {};
954
957
  }
955
958
  function z(e) {
@@ -965,21 +968,21 @@ function Y(e) {
965
968
  if (Array.isArray(e)) {
966
969
  const a = e[0], o = z(a);
967
970
  if (o !== null) return o;
968
- const i = F(a);
971
+ const i = G(a);
969
972
  return z(i.id) ?? z(i.tabId) ?? z(i.tab_id);
970
973
  }
971
974
  const r = z(e);
972
975
  if (r !== null) return r;
973
- const n = F(e);
976
+ const n = G(e);
974
977
  return z(n.id) ?? z(n.tabId) ?? z(n.tab_id);
975
978
  }
976
- const vr = /* @__PURE__ */ new Map([
979
+ const xr = /* @__PURE__ */ new Map([
977
980
  ["tab_back", (e) => ({ tabId: e })],
978
981
  ["tab_unhover", (e) => ({ tabId: e })],
979
982
  ["tab_wait_for_load", (e) => ({ tabId: e })],
980
983
  ["tab_scroll", (e) => ({ tabId: e })],
981
984
  ["sidepanel_wait", (e) => ({ duration: e })]
982
- ]), xr = /* @__PURE__ */ new Map([
985
+ ]), Tr = /* @__PURE__ */ new Map([
983
986
  ["tab_create", (e) => ({ url: e })],
984
987
  ["page_new_tab", (e) => ({ url: e })],
985
988
  ["page_find", (e) => ({ selector: e })],
@@ -1013,13 +1016,13 @@ const vr = /* @__PURE__ */ new Map([
1013
1016
  ["storage_get_many", (e) => ({ keys: e })],
1014
1017
  ["storage_delete_many", (e) => ({ keys: e })]
1015
1018
  ]);
1016
- function Tr(e, r) {
1017
- if (r = se(r), typeof r == "string") {
1018
- const n = xr.get(e);
1019
+ function Rr(e, r) {
1020
+ if (r = ce(r), typeof r == "string") {
1021
+ const n = Tr.get(e);
1019
1022
  if (n) return n(r);
1020
1023
  }
1021
1024
  if (typeof r == "number" || typeof r == "bigint") {
1022
- const n = vr.get(e);
1025
+ const n = xr.get(e);
1023
1026
  if (n) return n(r);
1024
1027
  }
1025
1028
  if (Array.isArray(r)) {
@@ -1028,7 +1031,7 @@ function Tr(e, r) {
1028
1031
  }
1029
1032
  return r;
1030
1033
  }
1031
- function S(e) {
1034
+ function v(e) {
1032
1035
  if (!e.ok)
1033
1036
  throw I(
1034
1037
  e.error.message,
@@ -1037,33 +1040,33 @@ function S(e) {
1037
1040
  );
1038
1041
  return e.value;
1039
1042
  }
1040
- function Rr(e, r) {
1043
+ function Ar(e, r) {
1041
1044
  if (!mt(e)) return r;
1042
1045
  const n = Array.isArray(r) ? r : [];
1043
1046
  return Me(e, n);
1044
1047
  }
1045
- function Ar(e) {
1048
+ function Dr(e) {
1046
1049
  return {
1047
1050
  ok: !1,
1048
1051
  error: { message: `Unknown action: ${e}`, code: "E_UNKNOWN" }
1049
1052
  };
1050
1053
  }
1051
1054
  function Nr(e) {
1052
- const r = e ?? De();
1055
+ const r = e ?? Ne();
1053
1056
  if (r != null && r.aborted)
1054
1057
  throw new Error("Runner aborted: ExtensionSession stopped");
1055
1058
  return r ?? new AbortController().signal;
1056
1059
  }
1057
- async function Dr(e, r) {
1060
+ async function qr(e, r) {
1058
1061
  if (!ht(e.action))
1059
- return { response: Ar(e.action) };
1062
+ return { response: Dr(e.action) };
1060
1063
  if (e.action.startsWith("host_"))
1061
1064
  return { response: await ft(
1062
1065
  e.action.slice(5),
1063
1066
  e.params
1064
1067
  ), handler: "host" };
1065
- const n = mt(e.action) ? Rr(e.action, e.params) : Tr(e.action, e.params);
1066
- return { response: await C(
1068
+ const n = mt(e.action) ? Ar(e.action, e.params) : Rr(e.action, e.params);
1069
+ return { response: await T(
1067
1070
  e.action,
1068
1071
  n,
1069
1072
  e.call_id,
@@ -1078,14 +1081,14 @@ function Or(e) {
1078
1081
  runId: e.runId
1079
1082
  });
1080
1083
  }
1081
- async function qr(e, r) {
1082
- const n = Or(e), { response: a, handler: o } = await Dr(
1084
+ async function Mr(e, r) {
1085
+ const n = Or(e), { response: a, handler: o } = await qr(
1083
1086
  e,
1084
1087
  Nr(r)
1085
1088
  );
1086
1089
  return n({ ok: a.ok, ...o ? { handler: o } : {} }), a;
1087
1090
  }
1088
- const je = 'input, textarea, select, button, a, [role="button"], [role="link"]', Mr = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), wt = /* @__PURE__ */ new Set([
1091
+ const je = 'input, textarea, select, button, a, [role="button"], [role="link"]', Pr = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), wt = /* @__PURE__ */ new Set([
1089
1092
  "p",
1090
1093
  "span",
1091
1094
  "label",
@@ -1129,14 +1132,14 @@ function J(e) {
1129
1132
  }
1130
1133
  return r === "textarea" ? "textbox" : r === "select" ? "combobox" : r === "img" ? "img" : r === "h1" || r === "h2" || r === "h3" || r === "h4" || r === "h5" || r === "h6" ? "heading" : r === "li" ? "listitem" : r === "ul" || r === "ol" ? "list" : r === "table" ? "table" : r === "tr" ? "row" : r === "td" || r === "th" ? "cell" : r === "nav" ? "navigation" : r === "main" ? "main" : r === "article" ? "article" : r === "section" ? "region" : r === "aside" ? "complementary" : r === "form" ? "form" : r === "dialog" || r === "modal" ? "dialog" : r === "figure" ? "figure" : r === "figcaption" ? "caption" : e.getAttribute("onclick") || e.onclick ? "button" : "generic";
1131
1134
  }
1132
- function Pr(e) {
1135
+ function jr(e) {
1133
1136
  var r;
1134
1137
  for (const n of e.childNodes)
1135
1138
  if (n.nodeType === Node.TEXT_NODE && ((r = n.textContent) == null ? void 0 : r.trim()))
1136
1139
  return !0;
1137
1140
  return !1;
1138
1141
  }
1139
- function jr(e, r = 60) {
1142
+ function Hr(e, r = 60) {
1140
1143
  var o, i;
1141
1144
  const n = [];
1142
1145
  for (const s of e.childNodes)
@@ -1149,7 +1152,7 @@ function jr(e, r = 60) {
1149
1152
  const a = (i = e.textContent) == null ? void 0 : i.trim();
1150
1153
  return a ? a.slice(0, r) : "";
1151
1154
  }
1152
- function Hr(e) {
1155
+ function Ur(e) {
1153
1156
  let r = e;
1154
1157
  for (; r; ) {
1155
1158
  if (r.hidden || r.getAttribute("aria-hidden") === "true" || r.inert) return !0;
@@ -1159,20 +1162,20 @@ function Hr(e) {
1159
1162
  }
1160
1163
  return !1;
1161
1164
  }
1162
- function Ur(e) {
1163
- return Hr(e);
1164
- }
1165
1165
  function Lr(e) {
1166
+ return Ur(e);
1167
+ }
1168
+ function Fr(e) {
1166
1169
  var s;
1167
1170
  const r = e.tagName.toLowerCase();
1168
- if (Mr.has(r) || Ur(e)) return !1;
1171
+ if (Pr.has(r) || Lr(e)) return !1;
1169
1172
  const n = J(e);
1170
1173
  if (n === "presentation" || n === "none") return !1;
1171
1174
  if (n !== "generic") return !0;
1172
1175
  const a = e.getAttribute("aria-live");
1173
1176
  if (a && a !== "off") return !0;
1174
1177
  const o = e.getAttribute("role");
1175
- return o === "status" || o === "alert" ? !0 : ((s = e.textContent) == null ? void 0 : s.trim()) || "" ? !!(wt.has(r) || Pr(e)) : !1;
1178
+ return o === "status" || o === "alert" ? !0 : ((s = e.textContent) == null ? void 0 : s.trim()) || "" ? !!(wt.has(r) || jr(e)) : !1;
1176
1179
  }
1177
1180
  function kt(e) {
1178
1181
  var s, c, l;
@@ -1192,8 +1195,8 @@ function kt(e) {
1192
1195
  const i = J(e);
1193
1196
  if (i !== "generic" && i !== "list" && i !== "table" && i !== "row" && i !== "region" && i !== "navigation" && i !== "main")
1194
1197
  return ((c = e.textContent) == null ? void 0 : c.trim().slice(0, 60)) || "";
1195
- if (i === "generic" && Lr(e)) {
1196
- const u = jr(e);
1198
+ if (i === "generic" && Fr(e)) {
1199
+ const u = Hr(e);
1197
1200
  if (u) return u;
1198
1201
  const m = e.tagName.toLowerCase();
1199
1202
  if (wt.has(m) || e.childElementCount === 0)
@@ -1203,7 +1206,7 @@ function kt(e) {
1203
1206
  }
1204
1207
  let xe = null;
1205
1208
  function Et() {
1206
- return xe || (xe = zt()), xe ?? Promise.resolve();
1209
+ return xe || (xe = Qt()), xe ?? Promise.resolve();
1207
1210
  }
1208
1211
  async function Ee(e) {
1209
1212
  const r = h.child("runner");
@@ -1223,7 +1226,7 @@ async function Ee(e) {
1223
1226
  };
1224
1227
  const n = {};
1225
1228
  e && (e.max_nodes != null && (n.maxNodes = Number(e.max_nodes)), e.interactive_only != null && (n.interactiveOnly = e.interactive_only));
1226
- const a = Vt(n), o = Ve(a, "compact-text");
1229
+ const a = zt(n), o = Ze(a, "compact-text");
1227
1230
  return r.debug("handleDomSnapshot_result", { status: "ok" }), {
1228
1231
  ok: !0,
1229
1232
  value: { data: a, text: o }
@@ -1244,7 +1247,7 @@ async function Wr(e) {
1244
1247
  r.debug("handleDomFormat_start", { format: e.format });
1245
1248
  try {
1246
1249
  await Et();
1247
- const { snapshot: n, format: a } = e, o = Ve(n, a);
1250
+ const { snapshot: n, format: a } = e, o = Ze(n, a);
1248
1251
  return r.debug("handleDomFormat_result", { status: "ok" }), { ok: !0, value: o };
1249
1252
  } catch (n) {
1250
1253
  const a = n instanceof Error ? n.message : String(n);
@@ -1258,7 +1261,7 @@ async function Wr(e) {
1258
1261
  }
1259
1262
  }
1260
1263
  const $e = 8 * 1024;
1261
- function Fr(e) {
1264
+ function Gr(e) {
1262
1265
  let r = "";
1263
1266
  for (let n = 0; n < e.length; n += $e) {
1264
1267
  const a = e.subarray(n, n + $e);
@@ -1267,13 +1270,13 @@ function Fr(e) {
1267
1270
  }
1268
1271
  return btoa(r);
1269
1272
  }
1270
- function Gr(e) {
1273
+ function Br(e) {
1271
1274
  return e.toLowerCase().split(";")[0].trim();
1272
1275
  }
1273
- function Br(e) {
1276
+ function $r(e) {
1274
1277
  return e.startsWith("image/") || e.startsWith("audio/") || e.startsWith("video/") || e === "application/octet-stream" || e === "application/pdf" || e === "application/zip" || e === "application/gzip" || e === "application/x-gzip" || e === "application/x-zip-compressed" ? !0 : e.startsWith("application/vnd.");
1275
1278
  }
1276
- function $r(e) {
1279
+ function Kr(e) {
1277
1280
  for (let r = 0; r < e.length; r++)
1278
1281
  if (e[r] === 0) return !0;
1279
1282
  return !1;
@@ -1286,14 +1289,14 @@ function Ke(e, r, n) {
1286
1289
  status: e.status,
1287
1290
  ok: e.ok,
1288
1291
  headers: It(e),
1289
- body: Fr(r),
1292
+ body: Gr(r),
1290
1293
  bodyEncoding: "base64",
1291
1294
  byteLength: r.length,
1292
1295
  contentType: n,
1293
1296
  finalUrl: e.url
1294
1297
  };
1295
1298
  }
1296
- function Ze(e, r, n) {
1299
+ function Ve(e, r, n) {
1297
1300
  return {
1298
1301
  status: e.status,
1299
1302
  ok: e.ok,
@@ -1305,21 +1308,21 @@ function Ze(e, r, n) {
1305
1308
  finalUrl: e.url
1306
1309
  };
1307
1310
  }
1308
- async function Kr(e) {
1309
- const r = e.headers.get("content-type") || "", n = Gr(r);
1310
- if (Br(n)) {
1311
+ async function Vr(e) {
1312
+ const r = e.headers.get("content-type") || "", n = Br(r);
1313
+ if ($r(n)) {
1311
1314
  const o = new Uint8Array(await e.arrayBuffer());
1312
1315
  return Ke(e, o, r);
1313
1316
  }
1314
1317
  if (!n || n.startsWith("text/")) {
1315
1318
  const o = new Uint8Array(await e.arrayBuffer());
1316
- if ($r(o))
1319
+ if (Kr(o))
1317
1320
  return Ke(e, o, r);
1318
1321
  const i = new TextDecoder().decode(o);
1319
- return Ze(e, i, r);
1322
+ return Ve(e, i, r);
1320
1323
  }
1321
1324
  const a = await e.text();
1322
- return Ze(e, a, r);
1325
+ return Ve(e, a, r);
1323
1326
  }
1324
1327
  async function Zr(e) {
1325
1328
  X();
@@ -1335,7 +1338,7 @@ async function Zr(e) {
1335
1338
  };
1336
1339
  o != null && (l.body = typeof o == "string" ? o : String(o));
1337
1340
  const u = await fetch(r, l);
1338
- return clearTimeout(c), { ok: !0, value: await Kr(u) };
1341
+ return clearTimeout(c), { ok: !0, value: await Vr(u) };
1339
1342
  } catch (s) {
1340
1343
  return s instanceof Error && s.name === "AbortError" ? {
1341
1344
  ok: !1,
@@ -1354,46 +1357,46 @@ async function Zr(e) {
1354
1357
  };
1355
1358
  }
1356
1359
  }
1357
- const P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), Vr = t.object({
1360
+ const j = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), zr = t.object({
1358
1361
  key: t.string().describe("Storage key to retrieve")
1359
- }), zr = t.object({
1362
+ }), Qr = t.object({
1360
1363
  key: t.string().describe("Storage key to set"),
1361
1364
  value: t.string().describe("Value to store")
1362
- }), Qr = t.object({
1365
+ }), Xr = t.object({
1363
1366
  key: t.string().describe("Storage key to delete")
1364
- }), Xr = t.object({}), Jr = t.object({
1367
+ }), Jr = t.object({}), Yr = t.object({
1365
1368
  items: t.record(t.string()).describe("Record of key-value string pairs to store")
1366
- }), Yr = t.preprocess((e) => e !== null && typeof e == "object" && !Array.isArray(e) && !("items" in e) ? { items: e } : e, Jr), en = t.object({
1369
+ }), en = t.preprocess((e) => e !== null && typeof e == "object" && !Array.isArray(e) && !("items" in e) ? { items: e } : e, Yr), tn = t.object({
1367
1370
  keys: t.array(t.string()).describe("Array of storage keys to retrieve"),
1368
1371
  defaults: t.record(t.string()).optional().describe("Default string values for missing keys")
1369
- }), tn = t.preprocess(
1372
+ }), rn = t.preprocess(
1370
1373
  (e) => Array.isArray(e) ? { keys: e } : e,
1371
- en
1372
- ), rn = t.object({}), nn = t.object({
1374
+ tn
1375
+ ), nn = t.object({}), an = t.object({
1373
1376
  keys: t.array(t.string()).describe("Array of storage keys to delete")
1374
- }), an = t.preprocess(
1377
+ }), on = t.preprocess(
1375
1378
  (e) => Array.isArray(e) ? { keys: e } : e,
1376
- nn
1377
- ), on = t.object({}), sn = t.object({}), cn = t.union([
1379
+ an
1380
+ ), sn = t.object({}), cn = t.object({}), ln = t.union([
1378
1381
  t.tuple([t.union([t.object({ text: t.string() }), t.string()])]),
1379
1382
  t.object({ text: t.string().optional(), value: t.string().optional() })
1380
- ]), St = t.object({
1383
+ ]), vt = t.object({
1381
1384
  url: t.string().describe("URL to fetch"),
1382
1385
  method: t.string().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),
1383
1386
  headers: t.record(t.string()).default({}).describe("Request headers as key-value pairs"),
1384
1387
  body: t.string().nullable().default(null).describe("Request body string"),
1385
- timeout: P().default(30000n).describe("Timeout in milliseconds"),
1388
+ timeout: j().default(30000n).describe("Timeout in milliseconds"),
1386
1389
  store: t.boolean().optional().describe(
1387
1390
  "When true, store binary responses as a handle instead of returning body bytes"
1388
1391
  ),
1389
1392
  options: t.object({}).passthrough().optional().describe("Fetch options")
1390
- }).passthrough(), ln = t.object({
1391
- duration: P().describe("Duration to sleep in milliseconds")
1392
- }), H = () => t.string().regex(/^e\d+$/), dn = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', He = (e, r) => {
1393
+ }).passthrough(), dn = t.object({
1394
+ duration: j().describe("Duration to sleep in milliseconds")
1395
+ }), q = () => t.string().regex(/^e\d+$/), un = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', He = (e, r) => {
1393
1396
  if (e.__invalidPositional !== void 0) {
1394
1397
  r.addIssue({
1395
1398
  code: t.ZodIssueCode.custom,
1396
- message: dn
1399
+ message: un
1397
1400
  });
1398
1401
  return;
1399
1402
  }
@@ -1401,36 +1404,36 @@ const P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigI
1401
1404
  code: t.ZodIssueCode.custom,
1402
1405
  message: "Either refId or label is required"
1403
1406
  });
1404
- }, vt = (e, r) => {
1407
+ }, St = (e, r) => {
1405
1408
  e.x !== void 0 || e.y !== void 0 || He(e, r);
1406
1409
  }, R = (e) => t.preprocess(
1407
1410
  (r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
1408
1411
  t.object({
1409
1412
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
1410
- refId: H().optional().describe("Element reference ID (e.g. e2)"),
1413
+ refId: q().optional().describe("Element reference ID (e.g. e2)"),
1411
1414
  label: t.string().optional().describe("Human-readable element label"),
1412
1415
  ...e
1413
1416
  }).superRefine(He)
1414
- ), ce = {
1417
+ ), ee = {
1415
1418
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
1416
- }, V = (e) => t.preprocess(
1419
+ }, L = (e) => t.preprocess(
1417
1420
  (r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
1418
1421
  t.object({
1419
1422
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
1420
- ...ce,
1421
- refId: H().optional().describe("Element reference ID (e.g. e2)"),
1423
+ ...ee,
1424
+ refId: q().optional().describe("Element reference ID (e.g. e2)"),
1422
1425
  label: t.string().optional().describe("Human-readable element label"),
1423
1426
  ...e
1424
1427
  }).superRefine(He)
1425
- ), un = t.object({}), mn = t.object({}), pn = t.object({
1428
+ ), mn = t.object({}), pn = t.object({}), bn = t.object({
1426
1429
  url: t.string().describe("URL to navigate to"),
1427
- timeout: P().optional().describe("Navigation timeout in milliseconds"),
1430
+ timeout: j().optional().describe("Navigation timeout in milliseconds"),
1428
1431
  waitUntil: t.enum(["load", "networkidle"]).optional().describe(
1429
1432
  "When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)"
1430
1433
  )
1431
- }), bn = t.object({}), hn = t.object({}), fn = t.object({}), gn = t.object({
1432
- duration: P().default(1000n).describe("Duration to wait in milliseconds")
1433
- }), yn = R(), _n = (e, r) => {
1434
+ }), hn = t.object({}), fn = t.object({}), gn = t.object({}), yn = t.object({
1435
+ duration: j().default(1000n).describe("Duration to wait in milliseconds")
1436
+ }), _n = R(), wn = (e, r) => {
1434
1437
  [e.url, e.path, e.handle].filter(
1435
1438
  (a) => typeof a == "string" && a.length > 0
1436
1439
  ).length !== 1 && r.addIssue({
@@ -1443,7 +1446,7 @@ const P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigI
1443
1446
  url: t.string().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
1444
1447
  path: t.string().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
1445
1448
  handle: t.string().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
1446
- }).superRefine(_n), Ct = t.discriminatedUnion("kind", [
1449
+ }).superRefine(wn), Tt = t.discriminatedUnion("kind", [
1447
1450
  t.object({
1448
1451
  kind: t.literal("bytes"),
1449
1452
  name: t.string().min(1),
@@ -1456,55 +1459,71 @@ const P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigI
1456
1459
  name: t.string().min(1),
1457
1460
  mimeType: t.string().optional()
1458
1461
  })
1459
- ]), wn = R({
1462
+ ]), kn = R({
1460
1463
  value: t.string().describe("Value to fill into the element")
1461
- }), kn = R({
1464
+ }), En = R({
1462
1465
  files: t.array(xt).min(1).describe("Files to attach to the input")
1463
1466
  });
1464
1467
  R({
1465
- files: t.array(Ct).min(1).describe("Resolved files for content-script application")
1468
+ files: t.array(Tt).min(1).describe("Resolved files for content-script application")
1466
1469
  });
1467
- const En = R({
1470
+ const In = R({
1468
1471
  text: t.string().describe("Text to type into the element")
1469
- }), In = R({
1472
+ }), vn = R({
1470
1473
  text: t.string().describe("Text to append into the element")
1471
1474
  }), Sn = t.object({
1475
+ refId: q().optional().describe("Element reference ID to dispatch the key on (e.g. e2). Omit to dispatch on document."),
1476
+ label: t.string().optional().describe("Human-readable element label. Omit to dispatch on document."),
1472
1477
  key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
1473
- }), vn = R({
1474
- value: t.string().describe("Value to select in the dropdown")
1475
1478
  }), xn = R({
1479
+ value: t.union([
1480
+ t.string().describe("Value to select in the dropdown"),
1481
+ t.array(t.string()).describe("Values to select in a multiple dropdown (empty array clears selection)")
1482
+ ]).describe("Value (string) or values (array) to select in the dropdown")
1483
+ }), Tn = R({
1484
+ value: t.string().describe("Visible text of the option to select (matched case-insensitively)")
1485
+ }), Cn = R({
1476
1486
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
1477
- }), Cn = R(), Tn = t.object({}), Rn = t.object({
1487
+ }), Rn = t.object({
1488
+ name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
1489
+ value: t.string().describe("The `value` of the radio option to check")
1490
+ }), An = R(), Dn = t.object({}), Nn = R(), qn = t.object({
1478
1491
  direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
1479
1492
  amount: t.number().default(300).describe("Pixels to scroll")
1480
- }), An = t.preprocess(
1493
+ }), On = t.preprocess(
1481
1494
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
1482
1495
  t.object({
1483
1496
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
1484
- refId: H().optional().describe("Element reference ID (e.g. e2)"),
1497
+ refId: q().optional().describe("Element reference ID (e.g. e2)"),
1485
1498
  label: t.string().optional().describe("Human-readable element label"),
1486
1499
  x: t.number().optional().describe("X coordinate to scroll to"),
1487
1500
  y: t.number().optional().describe("Y coordinate to scroll to")
1488
- }).superRefine(vt)
1489
- ), Nn = R(), Dn = t.object({
1501
+ }).superRefine(St)
1502
+ ), Mn = R(), Pn = t.object({
1490
1503
  selector: t.string().describe("CSS selector to find elements")
1491
- }), On = t.object({
1504
+ }), jn = t.object({
1505
+ selector: t.string().describe("CSS selector for the root element(s) to introspect"),
1506
+ depth: t.number().int().min(0).max(10).default(2).describe("How many descendant levels to include (0 = root only)"),
1507
+ includeHidden: t.boolean().default(!0).describe(
1508
+ "Include elements hidden by CSS/aria (default true — this tool's purpose is to see what the curated snapshot filters out)"
1509
+ )
1510
+ }), Hn = t.object({
1492
1511
  selector: t.string().describe("CSS selector to wait for"),
1493
- timeout: P().default(30000n).describe("Timeout in milliseconds")
1494
- }), qn = t.object({
1512
+ timeout: j().default(30000n).describe("Timeout in milliseconds")
1513
+ }), Un = t.object({
1495
1514
  fields: t.array(t.string()).describe("Array of field names to extract")
1496
- }), Mn = t.preprocess(
1515
+ }), Ln = t.preprocess(
1497
1516
  (e) => Array.isArray(e) ? { fields: e } : e,
1498
- qn
1499
- ), Pn = t.union([
1517
+ Un
1518
+ ), Fn = t.union([
1500
1519
  t.number(),
1501
1520
  t.array(t.object({}).passthrough()),
1502
1521
  t.object({}).passthrough()
1503
- ]), jn = t.object({}), Hn = t.object({
1522
+ ]), Wn = t.object({}), Gn = t.object({
1504
1523
  active: t.boolean().optional().describe("Whether the tabs are active"),
1505
1524
  currentWindow: t.boolean().optional().describe("Whether the tabs are in the current window"),
1506
1525
  url: t.string().optional().describe("URL pattern to match tabs against")
1507
- }).passthrough(), Ue = Hn, Tt = t.preprocess(
1526
+ }).passthrough(), Ue = Gn, Ct = t.preprocess(
1508
1527
  (e) => typeof e == "string" ? { url: e } : e,
1509
1528
  t.object({
1510
1529
  url: t.string().optional().describe("URL to open in the new tab"),
@@ -1524,109 +1543,115 @@ const En = R({
1524
1543
  tabId: t.number().optional(),
1525
1544
  tab_id: t.number().optional()
1526
1545
  }).passthrough()
1527
- ]), At = Rt, Un = Rt, Ln = V(), Wn = V({
1546
+ ]), At = Rt, Bn = Rt, $n = L(), Kn = L({
1528
1547
  value: t.string().describe("Value to fill into the element")
1529
- }), Fn = V({
1548
+ }), Vn = L({
1530
1549
  files: t.array(xt).min(1).describe("Files to attach to the input")
1531
1550
  });
1532
- V({
1533
- files: t.array(Ct).min(1).describe("Resolved files for content-script application")
1551
+ L({
1552
+ files: t.array(Tt).min(1).describe("Resolved files for content-script application")
1534
1553
  });
1535
- const Gn = t.preprocess(
1554
+ const Zn = t.preprocess(
1536
1555
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
1537
1556
  t.object({
1538
1557
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
1539
- ...ce,
1540
- refId: H().optional().describe("Element reference ID (e.g. e2)"),
1558
+ ...ee,
1559
+ refId: q().optional().describe("Element reference ID (e.g. e2)"),
1541
1560
  label: t.string().optional().describe("Human-readable element label"),
1542
1561
  x: t.number().optional().describe("X coordinate to scroll to"),
1543
1562
  y: t.number().optional().describe("Y coordinate to scroll to")
1544
- }).superRefine(vt)
1545
- ), Bn = V({
1563
+ }).superRefine(St)
1564
+ ), zn = L({
1546
1565
  text: t.string().describe("Text to type into the element")
1547
- }), $n = t.object({
1548
- ...ce,
1566
+ }), Qn = t.object({
1567
+ ...ee,
1549
1568
  key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
1550
- }), Kn = V({
1569
+ }), Xn = L({
1551
1570
  value: t.string().describe("Value to select in the dropdown")
1552
- }), Zn = V({
1571
+ }), Jn = L({
1572
+ value: t.string().describe("Visible text of the option to select (matched case-insensitively)")
1573
+ }), Yn = L({
1553
1574
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
1554
- }), Vn = V(), zn = t.object({
1555
- ...ce
1556
- }), Qn = t.object({
1557
- ...ce,
1575
+ }), ea = L(), ta = L(), ra = t.object({
1576
+ ...ee,
1577
+ name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
1578
+ value: t.string().describe("The `value` of the radio option to check")
1579
+ }), na = t.object({
1580
+ ...ee
1581
+ }), aa = t.object({
1582
+ ...ee,
1558
1583
  direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
1559
1584
  amount: t.number().default(300).describe("Pixels to scroll")
1560
- }), Xn = V(), Jn = t.object({
1585
+ }), oa = L(), ia = t.object({
1561
1586
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1562
1587
  script: t.string().optional().describe("Script to evaluate"),
1563
1588
  code: t.string().optional().describe("Alternative script code"),
1564
1589
  js: t.string().optional().describe("Alternative JS code")
1565
- }).passthrough(), Yn = t.object({
1590
+ }).passthrough(), sa = t.object({
1566
1591
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
1567
- }).passthrough(), ea = t.object({
1592
+ }).passthrough(), ca = t.object({
1568
1593
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
1569
- }).passthrough(), ta = t.object({
1594
+ }).passthrough(), la = t.object({
1570
1595
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1571
1596
  timeout: t.number().optional().describe("Timeout in milliseconds")
1572
- }).passthrough(), ra = t.object({
1597
+ }).passthrough(), da = t.object({
1573
1598
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1574
1599
  url: t.string().optional().describe("URL to fetch"),
1575
1600
  options: t.object({}).passthrough().optional().describe("Fetch options")
1576
- }).passthrough(), na = t.object({
1601
+ }).passthrough(), ua = t.object({
1577
1602
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1578
1603
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1579
1604
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1580
- }).passthrough(), aa = t.object({
1605
+ }).passthrough(), ma = t.object({
1581
1606
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1582
1607
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1583
1608
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1584
- }).passthrough(), oa = t.object({
1609
+ }).passthrough(), pa = t.object({
1585
1610
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
1586
1611
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1587
1612
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1588
- }).passthrough(), ia = R(), sa = R(), ca = R({
1613
+ }).passthrough(), ba = R(), ha = R(), fa = R({
1589
1614
  value: t.string().optional().describe("Value to fill into the element")
1590
- }), la = R({
1615
+ }), ga = R({
1591
1616
  text: t.string().optional().describe("Text to type into the element")
1592
- }), da = t.object({
1617
+ }), ya = t.object({
1593
1618
  key: t.string().optional().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
1594
- }), ua = R({
1619
+ }), _a = R({
1595
1620
  value: t.string().optional().describe("Value to select in the dropdown")
1596
- }), ma = R({
1621
+ }), wa = R({
1597
1622
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
1598
- }), pa = R(), ba = t.object({}), ha = t.object({
1623
+ }), ka = R(), Ea = t.object({}), Ia = t.object({
1599
1624
  direction: t.string().optional().describe("Scroll direction: up, down, left, or right"),
1600
1625
  amount: t.number().optional().describe("Pixels to scroll")
1601
- }), fa = R(), ga = R({
1626
+ }), va = R(), Sa = R({
1602
1627
  text: t.string().optional().describe("Text to append into the element")
1603
- }), ya = t.object({}), _a = t.object({}), wa = t.object({
1604
- duration: P().default(1000n).describe("Duration to wait in milliseconds")
1605
- }), ka = t.object({
1628
+ }), xa = t.object({}), Ta = t.object({}), Ca = t.object({
1629
+ duration: j().default(1000n).describe("Duration to wait in milliseconds")
1630
+ }), Ra = t.object({
1606
1631
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
1607
- max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
1608
- }), Ea = t.object({
1632
+ max_nodes: j().default(500n).describe("Maximum number of nodes to include in snapshot")
1633
+ }), Aa = t.object({
1609
1634
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
1610
- max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
1611
- }), Ia = t.object({
1635
+ max_nodes: j().default(500n).describe("Maximum number of nodes to include in snapshot")
1636
+ }), Da = t.object({
1612
1637
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
1613
- max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
1614
- }), Sa = t.object({
1638
+ max_nodes: j().default(500n).describe("Maximum number of nodes to include in snapshot")
1639
+ }), Na = t.object({
1615
1640
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
1616
- max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
1617
- }), va = t.object({
1641
+ max_nodes: j().default(500n).describe("Maximum number of nodes to include in snapshot")
1642
+ }), qa = t.object({
1618
1643
  snapshot: t.object({}).passthrough().describe("Raw DOM snapshot data to format"),
1619
1644
  format: t.string().optional().describe("Output format (e.g. markdown, html)")
1620
- }), xa = t.object({
1645
+ }), Oa = t.object({
1621
1646
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1622
1647
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1623
- }).passthrough(), Ca = t.object({
1648
+ }).passthrough(), Ma = t.object({
1624
1649
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1625
1650
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1626
- }).passthrough(), Ta = t.object({
1651
+ }).passthrough(), Pa = t.object({
1627
1652
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
1628
1653
  options: t.object({}).passthrough().optional().describe("Snapshot options")
1629
- }).passthrough(), Ra = t.object({
1654
+ }).passthrough(), ja = t.object({
1630
1655
  role: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by ARIA role"),
1631
1656
  tag: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by HTML tag"),
1632
1657
  text: t.string().optional().describe("Filter by text content (case-insensitive substring)"),
@@ -1635,12 +1660,12 @@ const Gn = t.preprocess(
1635
1660
  href: t.string().optional().describe("Filter by href pattern (case-insensitive substring)"),
1636
1661
  src: t.string().optional().describe("Filter by src pattern (case-insensitive substring)"),
1637
1662
  limit: t.number().positive().optional().describe("Maximum filtered nodes to return")
1638
- }).passthrough(), Nt = t.object({
1639
- filter: Ra.optional().describe(
1663
+ }).passthrough(), Dt = t.object({
1664
+ filter: ja.optional().describe(
1640
1665
  "Semantic filter criteria"
1641
1666
  ),
1642
1667
  max_nodes: t.number().optional().describe("Maximum nodes to collect before filtering")
1643
- }).passthrough(), Aa = Nt.extend({
1668
+ }).passthrough(), Ha = Dt.extend({
1644
1669
  tabId: t.number().describe("Tab ID")
1645
1670
  });
1646
1671
  t.object({
@@ -1656,12 +1681,12 @@ t.object({
1656
1681
  });
1657
1682
  t.object({
1658
1683
  path: t.string().describe("File path to read from"),
1659
- offset: P().describe("Byte offset to start reading"),
1684
+ offset: j().describe("Byte offset to start reading"),
1660
1685
  len: t.number().describe("Number of bytes to read")
1661
1686
  });
1662
1687
  t.object({
1663
1688
  path: t.string().describe("File path to update"),
1664
- offset: P().describe("Byte offset to start writing"),
1689
+ offset: j().describe("Byte offset to start writing"),
1665
1690
  data: t.string().describe("Data to write")
1666
1691
  });
1667
1692
  t.object({
@@ -1676,7 +1701,7 @@ t.union([
1676
1701
  t.number(),
1677
1702
  t.record(t.unknown())
1678
1703
  ]);
1679
- const Na = t.union([
1704
+ const Ua = t.union([
1680
1705
  t.number(),
1681
1706
  t.record(t.unknown())
1682
1707
  ]);
@@ -1778,24 +1803,24 @@ t.union([
1778
1803
  t.record(t.unknown());
1779
1804
  t.record(t.unknown());
1780
1805
  t.record(t.unknown());
1781
- const Da = t.object({
1806
+ const La = t.object({
1782
1807
  action: t.string().describe("Host action name"),
1783
1808
  params: t.object({}).passthrough().optional().describe("Parameters for the host action")
1784
- }).passthrough(), Dt = t.union([
1809
+ }).passthrough(), Nt = t.union([
1785
1810
  t.string(),
1786
1811
  t.number(),
1787
1812
  t.boolean(),
1788
1813
  t.null(),
1789
1814
  t.array(t.unknown()),
1790
1815
  t.record(t.unknown())
1791
- ]), Oa = Dt, _ = t.object({
1816
+ ]), Fa = Nt, g = t.object({
1792
1817
  ok: t.literal(!0).describe("Whether the action succeeded"),
1793
1818
  action: t.string().describe("Action identifier (e.g. 'page_fill')"),
1794
- refId: H().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
1819
+ refId: q().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
1795
1820
  tag: t.string().optional().describe("HTML tag name of the element"),
1796
1821
  role: t.string().optional().describe("ARIA role of the element"),
1797
1822
  name: t.string().optional().describe("Accessible name of the element"),
1798
- value: t.string().optional().describe("Final value of the element after the action"),
1823
+ value: t.union([t.string(), t.array(t.string())]).optional().describe("Final value of the element after the action (string, or string[] for multi-select)"),
1799
1824
  checked: t.boolean().optional().describe("Checked state after the action"),
1800
1825
  disabled: t.boolean().optional().describe("Whether the element is disabled"),
1801
1826
  readOnly: t.boolean().optional().describe("Whether the element is read-only"),
@@ -1815,7 +1840,7 @@ const Da = t.object({
1815
1840
  "Always 'required': a fresh observation is required to verify the effect."
1816
1841
  )
1817
1842
  });
1818
- t.union([_, t.null()]);
1843
+ t.union([g, t.null()]);
1819
1844
  const Re = t.object({
1820
1845
  status: t.number().describe("HTTP response status code"),
1821
1846
  ok: t.boolean().describe("Whether the response status is 2xx"),
@@ -1826,10 +1851,10 @@ const Re = t.object({
1826
1851
  byteLength: t.number().describe("Length of the body in bytes"),
1827
1852
  contentType: t.string().describe("Response Content-Type header"),
1828
1853
  finalUrl: t.string().describe("Final URL after redirects")
1829
- }), Ot = t.object({
1854
+ }), qt = t.object({
1830
1855
  data: t.object({}).passthrough().describe("Structured snapshot data"),
1831
1856
  text: t.string().describe("Plain text representation of the snapshot")
1832
- }), qa = t.object({}), Ma = t.object({
1857
+ }), Wa = t.object({}), Ga = t.object({
1833
1858
  tabId: t.number(),
1834
1859
  url: t.string(),
1835
1860
  title: t.string(),
@@ -1838,8 +1863,8 @@ const Re = t.object({
1838
1863
  mutationsReady: t.boolean(),
1839
1864
  hint: t.string().optional(),
1840
1865
  recovery: t.array(t.string()).optional()
1841
- }), Pa = Dt, ja = t.object({
1842
- refId: H().describe("Element reference ID (e.g. e2)"),
1866
+ }), Ba = Nt, $a = t.object({
1867
+ refId: q().describe("Element reference ID (e.g. e2)"),
1843
1868
  role: t.string().describe("ARIA role of the element"),
1844
1869
  tag: t.string().describe("HTML tag name"),
1845
1870
  name: t.string().optional().describe("Accessible name of the element"),
@@ -1848,17 +1873,18 @@ const Re = t.object({
1848
1873
  checked: t.boolean().optional().describe("Checked state"),
1849
1874
  disabled: t.boolean().optional().describe("Whether the element is disabled"),
1850
1875
  readOnly: t.boolean().optional().describe("Whether the element is read-only"),
1876
+ selected: t.boolean().optional().describe("For <option>: selected state"),
1851
1877
  href: t.string().optional().describe("Absolute URL for link elements"),
1852
1878
  src: t.string().optional().describe("Absolute URL for image elements"),
1853
1879
  alt: t.string().optional().describe("Alternative text for image elements"),
1854
1880
  title: t.string().optional().describe("Title attribute"),
1855
- parentRefId: H().optional().describe("Reference ID of the parent container element"),
1881
+ parentRefId: q().optional().describe("Reference ID of the parent container element"),
1856
1882
  postId: t.string().optional().describe("Stable post identifier from data-post-id attribute"),
1857
1883
  permalink: t.string().optional().describe("Stable permalink URL from anchor element"),
1858
1884
  imageUrls: t.array(t.string()).optional().describe("Image URLs contained within this element")
1859
1885
  }), me = t.object({
1860
1886
  text: t.string().describe("Plain text representation of the page"),
1861
- nodes: t.array(ja).describe("Array of interactive nodes"),
1887
+ nodes: t.array($a).describe("Array of interactive nodes"),
1862
1888
  url: t.string().describe("Current page URL"),
1863
1889
  title: t.string().describe("Current page title"),
1864
1890
  viewport: t.object({
@@ -1868,6 +1894,37 @@ const Re = t.object({
1868
1894
  observationId: t.string().optional().describe(
1869
1895
  "Opaque ID of the observation lease granted by this snapshot. Pass to subsequent actions to prove they act on fresh observations."
1870
1896
  )
1897
+ }), Ot = t.object({
1898
+ refId: q().optional(),
1899
+ tag: t.string(),
1900
+ role: t.string().optional(),
1901
+ name: t.string().optional(),
1902
+ text: t.string().optional(),
1903
+ attributes: t.record(t.string()).optional().describe("All HTML attributes (raw)"),
1904
+ hidden: t.boolean().optional(),
1905
+ hiddenReason: t.enum([
1906
+ "display-none",
1907
+ "visibility-hidden",
1908
+ "aria-hidden",
1909
+ "opacity-zero",
1910
+ "hidden-attr",
1911
+ "inert"
1912
+ ]).optional(),
1913
+ value: t.string().optional(),
1914
+ checked: t.boolean().optional(),
1915
+ disabled: t.boolean().optional(),
1916
+ readOnly: t.boolean().optional(),
1917
+ selected: t.boolean().optional().describe("For <option>: selected state"),
1918
+ href: t.string().optional(),
1919
+ src: t.string().optional(),
1920
+ alt: t.string().optional(),
1921
+ accept: t.string().optional().describe("For input[type=file]: accepted MIME/extensions"),
1922
+ filesCount: t.number().optional().describe("For input[type=file]: selected file count"),
1923
+ children: t.array(t.lazy(() => Ot)).optional().describe("Nested descendants up to `depth`")
1924
+ }), Ka = t.object({
1925
+ nodes: t.array(Ot),
1926
+ url: t.string(),
1927
+ title: t.string()
1871
1928
  }), O = t.object({
1872
1929
  id: t.number().optional().describe("Tab ID"),
1873
1930
  tabId: t.number().optional().describe("Tab ID (added by runner)"),
@@ -1889,14 +1946,14 @@ const Re = t.object({
1889
1946
  width: t.number().optional().describe("Tab width"),
1890
1947
  height: t.number().optional().describe("Tab height"),
1891
1948
  sessionId: t.string().optional().describe("Session ID")
1892
- }).passthrough(), ee = t.array(O), le = t.object({
1949
+ }).passthrough(), te = t.array(O), le = t.object({
1893
1950
  id: t.number().optional().describe("Window ID"),
1894
1951
  focused: t.boolean().optional().describe("Whether the window is focused"),
1895
1952
  top: t.number().optional().describe("Window top position"),
1896
1953
  left: t.number().optional().describe("Window left position"),
1897
1954
  width: t.number().optional().describe("Window width"),
1898
1955
  height: t.number().optional().describe("Window height"),
1899
- tabs: ee.optional().describe(
1956
+ tabs: te.optional().describe(
1900
1957
  "Array of tabs in the window"
1901
1958
  ),
1902
1959
  incognito: t.boolean().optional().describe("Whether the window is incognito"),
@@ -1904,7 +1961,7 @@ const Re = t.object({
1904
1961
  state: t.string().optional().describe("Window state"),
1905
1962
  alwaysOnTop: t.boolean().optional().describe("Whether the window is always on top"),
1906
1963
  sessionId: t.string().optional().describe("Session ID")
1907
- }).passthrough(), Ha = t.array(le), de = t.object({
1964
+ }).passthrough(), Va = t.array(le), de = t.object({
1908
1965
  name: t.string().describe("Cookie name"),
1909
1966
  value: t.string().describe("Cookie value"),
1910
1967
  domain: t.string().optional().describe("Cookie domain"),
@@ -1916,9 +1973,9 @@ const Re = t.object({
1916
1973
  session: t.boolean().optional().describe("Whether the cookie is a session cookie"),
1917
1974
  expirationDate: t.number().optional().describe("Expiration date as Unix timestamp"),
1918
1975
  storeId: t.string().optional().describe("Store ID")
1919
- }).nullable(), qt = t.array(
1976
+ }).nullable(), Mt = t.array(
1920
1977
  de.nullable().unwrap()
1921
- ), Ua = t.object({
1978
+ ), Za = t.object({
1922
1979
  id: t.string().describe("Bookmark ID"),
1923
1980
  parentId: t.string().optional().describe("Parent folder ID"),
1924
1981
  index: t.number().optional().describe("Bookmark index"),
@@ -1927,30 +1984,30 @@ const Re = t.object({
1927
1984
  dateAdded: t.number().optional().describe("Date added"),
1928
1985
  dateGroupModified: t.number().optional().describe("Date group modified"),
1929
1986
  children: t.array(t.object({ id: t.string() }).passthrough()).optional().describe("Child bookmarks")
1930
- }).passthrough(), ue = t.array(Ua), La = t.object({
1987
+ }).passthrough(), ue = t.array(Za), za = t.object({
1931
1988
  id: t.string().describe("History item ID"),
1932
1989
  url: t.string().optional().describe("URL"),
1933
1990
  title: t.string().optional().describe("Title"),
1934
1991
  lastVisitTime: t.number().optional().describe("Last visit time"),
1935
1992
  visitCount: t.number().optional().describe("Visit count"),
1936
1993
  typedCount: t.number().optional().describe("Typed count")
1937
- }).passthrough(), Le = t.array(La), Wa = t.object({
1994
+ }).passthrough(), Le = t.array(za), Qa = t.object({
1938
1995
  frameId: t.number().describe("Frame ID"),
1939
1996
  result: t.unknown().optional().describe("Script result")
1940
- }), Fa = t.array(Wa), Mt = t.string(), Pt = t.boolean(), Ga = t.union([t.string(), t.number()]), Ba = t.boolean(), Ie = t.object({
1997
+ }), Xa = t.array(Qa), Pt = t.string(), jt = t.boolean(), Ja = t.union([t.string(), t.number()]), Ya = t.boolean(), Ie = t.object({
1941
1998
  id: t.number().optional().describe("Group ID"),
1942
1999
  collapsed: t.boolean().optional().describe("Whether the group is collapsed"),
1943
2000
  color: t.string().optional().describe("Group color"),
1944
2001
  title: t.string().optional().describe("Group title"),
1945
2002
  windowId: t.number().optional().describe("Window ID")
1946
- }).passthrough(), $a = t.array(Ie), Ka = t.object({
2003
+ }).passthrough(), eo = t.array(Ie), to = t.object({
1947
2004
  lastModified: t.number().optional().describe("Last modified time"),
1948
2005
  tab: O.optional().describe("Tab info"),
1949
2006
  window: le.optional().describe("Window info")
1950
- }).passthrough(), We = t.array(Ka), Za = t.object({
2007
+ }).passthrough(), Fe = t.array(to), ro = t.object({
1951
2008
  deviceName: t.string().optional().describe("Device name"),
1952
- sessions: We.optional().describe("Sessions")
1953
- }).passthrough(), Va = t.array(Za), za = t.object({
2009
+ sessions: Fe.optional().describe("Sessions")
2010
+ }).passthrough(), no = t.array(ro), ao = t.object({
1954
2011
  id: t.number().optional().describe("Download ID"),
1955
2012
  url: t.string().optional().describe("Download URL"),
1956
2013
  filename: t.string().optional().describe("Filename"),
@@ -1968,15 +2025,15 @@ const Re = t.object({
1968
2025
  referrer: t.string().optional().describe("Referrer URL"),
1969
2026
  byExtensionId: t.string().optional().describe("Extension ID"),
1970
2027
  byExtensionName: t.string().optional().describe("Extension name")
1971
- }).passthrough(), jt = t.array(za), Qa = t.number(), Xa = t.object({
2028
+ }).passthrough(), Ht = t.array(ao), oo = t.number(), io = t.object({
1972
2029
  archName: t.string().describe("CPU architecture"),
1973
2030
  modelName: t.string().describe("CPU model"),
1974
2031
  numOfProcessors: t.number().describe("Number of processors"),
1975
2032
  features: t.array(t.string()).describe("CPU features")
1976
- }), Ja = t.object({
2033
+ }), so = t.object({
1977
2034
  capacity: t.number().describe("Total memory capacity"),
1978
2035
  availableCapacity: t.number().describe("Available memory capacity")
1979
- }), Ya = t.array(
2036
+ }), co = t.array(
1980
2037
  t.object({
1981
2038
  id: t.string().describe("Storage ID"),
1982
2039
  name: t.string().describe("Storage name"),
@@ -1984,22 +2041,22 @@ const Re = t.object({
1984
2041
  capacity: t.number().describe("Storage capacity")
1985
2042
  })
1986
2043
  );
1987
- function B(e) {
2044
+ function $(e) {
1988
2045
  return document.querySelector(`[data-ref-id='${CSS.escape(e)}']`);
1989
2046
  }
1990
- function eo(e) {
2047
+ function lo(e) {
1991
2048
  if (typeof e == "string")
1992
- return H().safeParse(e).success ? e : void 0;
1993
- const r = F(e), n = typeof r.refId == "string" ? r.refId : typeof r.ref_id == "string" ? r.ref_id : void 0;
1994
- if (!(n && !H().safeParse(n).success))
2049
+ return q().safeParse(e).success ? e : void 0;
2050
+ const r = G(e), n = typeof r.refId == "string" ? r.refId : typeof r.ref_id == "string" ? r.ref_id : void 0;
2051
+ if (!(n && !q().safeParse(n).success))
1995
2052
  return n;
1996
2053
  }
1997
- const to = {
2054
+ const uo = {
1998
2055
  message: "Content script error",
1999
2056
  code: "E_CONTENT_SCRIPT",
2000
2057
  category: "resource"
2001
2058
  };
2002
- function ro(e, r = to) {
2059
+ function mo(e, r = uo) {
2003
2060
  if (typeof e == "string")
2004
2061
  return {
2005
2062
  message: e || r.message,
@@ -2019,16 +2076,16 @@ function ro(e, r = to) {
2019
2076
  }
2020
2077
  return { ...r };
2021
2078
  }
2022
- function Ht(e) {
2079
+ function Ut(e) {
2023
2080
  return e && typeof e == "object" && e.ok === !1 ? {
2024
2081
  ok: !1,
2025
- error: ro(e.error)
2082
+ error: mo(e.error)
2026
2083
  } : { ok: !0, value: e && typeof e == "object" && "value" in e ? e.value : e };
2027
2084
  }
2028
- function no(e) {
2085
+ function po(e) {
2029
2086
  return new Promise((r) => setTimeout(r, e));
2030
2087
  }
2031
- async function Ut(e) {
2088
+ async function Lt(e) {
2032
2089
  var n;
2033
2090
  X();
2034
2091
  const r = window.chrome;
@@ -2047,7 +2104,7 @@ async function Ut(e) {
2047
2104
  return we(a);
2048
2105
  }
2049
2106
  }
2050
- async function Fe(e, r = 3e3) {
2107
+ async function We(e, r = 3e3) {
2051
2108
  var c;
2052
2109
  X();
2053
2110
  const n = h.child("runner");
@@ -2077,7 +2134,7 @@ async function Fe(e, r = 3e3) {
2077
2134
  l
2078
2135
  )
2079
2136
  )
2080
- ]), m = Ht(u);
2137
+ ]), m = Ut(u);
2081
2138
  return m.ok ? (n.debug("pingTabContentScript_success", { tabId: e, result: u }), { ok: !0, value: { ok: !0 } }) : (n.debug("pingTabContentScript_rejected", {
2082
2139
  tabId: e,
2083
2140
  error: m.error
@@ -2085,7 +2142,7 @@ async function Fe(e, r = 3e3) {
2085
2142
  } catch (u) {
2086
2143
  const m = (u instanceof Error ? u.message : String(u)) || "";
2087
2144
  if (i = m, n.debug("pingTabContentScript_retry", { tabId: e, error: m }), m.includes("Could not establish connection") || m.includes("Receiving end does not exist") || m.includes("message port closed before a response was received")) {
2088
- await no(Math.min(Ir, o - Date.now()));
2145
+ await po(Math.min(vr, o - Date.now()));
2089
2146
  continue;
2090
2147
  }
2091
2148
  if (m.includes("Timeout waiting for content-script ping"))
@@ -2104,7 +2161,7 @@ async function Fe(e, r = 3e3) {
2104
2161
  error: fe(e, s)
2105
2162
  };
2106
2163
  }
2107
- async function Lt(e, r = 3e4, n) {
2164
+ async function Ft(e, r = 3e4, n) {
2108
2165
  var f;
2109
2166
  X();
2110
2167
  const a = h.child("runner"), o = typeof e == "number" ? e : null, i = n == null ? void 0 : n.preNavigationUrl, s = n == null ? void 0 : n.getNavSawLoading;
@@ -2132,61 +2189,61 @@ async function Lt(e, r = 3e4, n) {
2132
2189
  code: "E_MISSING_PARAM"
2133
2190
  }
2134
2191
  };
2135
- const l = (b, v) => {
2192
+ const l = (b, S) => {
2136
2193
  if (b.status !== "complete") return !1;
2137
2194
  if (i === void 0) return !0;
2138
- const g = b.url !== i;
2139
- return v || g;
2195
+ const y = b.url !== i;
2196
+ return S || y;
2140
2197
  }, u = (b) => i !== void 0 && typeof b == "string" && b.length > 0 && b !== i, m = (n == null ? void 0 : n.loadGraceMs) ?? 5e3;
2141
2198
  try {
2142
- return await new Promise((b, v) => {
2143
- let g = !1, x = (s == null ? void 0 : s()) ?? !1, D = null;
2199
+ return await new Promise((b, S) => {
2200
+ let y = !1, x = (s == null ? void 0 : s()) ?? !1, N = null;
2144
2201
  const A = () => {
2145
2202
  try {
2146
2203
  c.tabs.onUpdated.removeListener(Ge);
2147
2204
  } catch {
2148
2205
  }
2149
- D && clearTimeout(D);
2150
- }, E = (N) => {
2151
- g || (g = !0, A(), N());
2152
- }, re = () => {
2206
+ N && clearTimeout(N);
2207
+ }, E = (D) => {
2208
+ y || (y = !0, A(), D());
2209
+ }, ne = () => {
2153
2210
  s != null && s() && (x = !0);
2154
- }, q = (N) => {
2155
- D || g || u(N) && (D = setTimeout(() => {
2211
+ }, M = (D) => {
2212
+ N || y || u(D) && (N = setTimeout(() => {
2156
2213
  a.debug("waitForTabLoad_grace_settle", {
2157
2214
  tabId: o,
2158
- url: N,
2215
+ url: D,
2159
2216
  graceMs: m,
2160
2217
  runId: n == null ? void 0 : n.runId
2161
2218
  }), E(b);
2162
2219
  }, m));
2163
- }, G = () => {
2164
- re(), c.tabs.get(o).then((N) => {
2165
- l(N, x) ? E(b) : q(N.url);
2220
+ }, B = () => {
2221
+ ne(), c.tabs.get(o).then((D) => {
2222
+ l(D, x) ? E(b) : M(D.url);
2166
2223
  }).catch(() => {
2167
2224
  });
2168
- }, Ge = (N, ne) => {
2169
- N === o && (ne.status === "loading" && (x = !0, a.debug("waitForTabLoad_status", {
2225
+ }, Ge = (D, ae) => {
2226
+ D === o && (ae.status === "loading" && (x = !0, a.debug("waitForTabLoad_status", {
2170
2227
  tabId: o,
2171
2228
  status: "loading",
2172
2229
  runId: n == null ? void 0 : n.runId
2173
- })), ne.url && (a.debug("waitForTabLoad_status", {
2230
+ })), ae.url && (a.debug("waitForTabLoad_status", {
2174
2231
  tabId: o,
2175
- url: ne.url,
2232
+ url: ae.url,
2176
2233
  runId: n == null ? void 0 : n.runId
2177
- }), q(ne.url)), ne.status === "complete" && G());
2234
+ }), M(ae.url)), ae.status === "complete" && B());
2178
2235
  };
2179
- c.tabs.onUpdated.addListener(Ge), c.tabs.get(o).then((N) => {
2180
- re(), N.status === "loading" && (x = !0), a.debug("waitForTabLoad_initial_status", {
2236
+ c.tabs.onUpdated.addListener(Ge), c.tabs.get(o).then((D) => {
2237
+ ne(), D.status === "loading" && (x = !0), a.debug("waitForTabLoad_initial_status", {
2181
2238
  tabId: o,
2182
- status: N.status,
2183
- url: N.url,
2239
+ status: D.status,
2240
+ url: D.url,
2184
2241
  runId: n == null ? void 0 : n.runId
2185
- }), l(N, x) ? E(b) : q(N.url);
2186
- }).catch((N) => {
2187
- E(() => v(N));
2242
+ }), l(D, x) ? E(b) : M(D.url);
2243
+ }).catch((D) => {
2244
+ E(() => S(D));
2188
2245
  }), setTimeout(() => {
2189
- E(() => v(new Error("Timeout waiting for tab load")));
2246
+ E(() => S(new Error("Timeout waiting for tab load")));
2190
2247
  }, r);
2191
2248
  }), a.debug("waitForTabLoad_loaded", {
2192
2249
  tabId: o,
@@ -2195,21 +2252,21 @@ async function Lt(e, r = 3e4, n) {
2195
2252
  }), { ok: !0, value: !0 };
2196
2253
  } catch (b) {
2197
2254
  if (b instanceof Error && b.message === "Timeout waiting for tab load") {
2198
- let v = "";
2255
+ let S = "";
2199
2256
  try {
2200
- v = (await c.tabs.get(o)).url || "";
2257
+ S = (await c.tabs.get(o)).url || "";
2201
2258
  } catch {
2202
2259
  }
2203
- const g = v || i || "unknown url";
2260
+ const y = S || i || "unknown url";
2204
2261
  return a.warn("waitForTabLoad_timeout", {
2205
2262
  tabId: o,
2206
2263
  timeout: r,
2207
- url: g,
2264
+ url: y,
2208
2265
  runId: n == null ? void 0 : n.runId
2209
2266
  }), {
2210
2267
  ok: !1,
2211
2268
  error: {
2212
- message: `Navigation timeout waiting for tab ${o} (${g}) to load`,
2269
+ message: `Navigation timeout waiting for tab ${o} (${y}) to load`,
2213
2270
  code: "E_NAVIGATION",
2214
2271
  category: "navigation"
2215
2272
  }
@@ -2223,7 +2280,7 @@ p({
2223
2280
  namespace: "storage",
2224
2281
  name: "get",
2225
2282
  description: "Get a value from localStorage",
2226
- params: Vr,
2283
+ params: zr,
2227
2284
  returns: t.string().nullable(),
2228
2285
  fields: ["key"],
2229
2286
  aliases: [{ namespace: "web.storage", name: "get", fields: ["key"] }],
@@ -2247,7 +2304,7 @@ p({
2247
2304
  namespace: "storage",
2248
2305
  name: "set",
2249
2306
  description: "Set a value in localStorage",
2250
- params: zr,
2307
+ params: Qr,
2251
2308
  returns: t.null(),
2252
2309
  fields: ["key", "value"],
2253
2310
  aliases: [
@@ -2279,7 +2336,7 @@ p({
2279
2336
  namespace: "storage",
2280
2337
  name: "delete",
2281
2338
  description: "Delete a key from localStorage",
2282
- params: Qr,
2339
+ params: Xr,
2283
2340
  returns: t.null(),
2284
2341
  fields: ["key"],
2285
2342
  aliases: [{ namespace: "web.storage", name: "delete", fields: ["key"] }],
@@ -2303,7 +2360,7 @@ p({
2303
2360
  namespace: "storage",
2304
2361
  name: "list",
2305
2362
  description: "List all localStorage keys",
2306
- params: Xr,
2363
+ params: Jr,
2307
2364
  returns: t.array(t.string()),
2308
2365
  aliases: [{ namespace: "web.storage", name: "list" }],
2309
2366
  owner: "main-thread",
@@ -2326,11 +2383,11 @@ p({
2326
2383
  namespace: "storage",
2327
2384
  name: "set_many",
2328
2385
  description: "Set multiple values in localStorage",
2329
- params: Yr,
2386
+ params: en,
2330
2387
  returns: t.null(),
2331
2388
  owner: "main-thread",
2332
2389
  handler: async (e, r) => {
2333
- const n = F(e.items);
2390
+ const n = G(e.items);
2334
2391
  for (const a of Object.keys(n)) {
2335
2392
  const o = n[a];
2336
2393
  localStorage.setItem(
@@ -2358,11 +2415,11 @@ p({
2358
2415
  namespace: "storage",
2359
2416
  name: "get_many",
2360
2417
  description: "Get multiple values from localStorage",
2361
- params: tn,
2418
+ params: rn,
2362
2419
  returns: t.record(t.string().nullable()),
2363
2420
  owner: "main-thread",
2364
2421
  handler: async (e, r) => {
2365
- const n = e.keys, a = F(e.defaults ?? {}), o = {};
2422
+ const n = e.keys, a = G(e.defaults ?? {}), o = {};
2366
2423
  for (const i of n) {
2367
2424
  const s = localStorage.getItem(`__csl__:${String(i)}`);
2368
2425
  o[String(i)] = s !== null ? s : a[String(i)] ?? null;
@@ -2393,7 +2450,7 @@ p({
2393
2450
  namespace: "storage",
2394
2451
  name: "get_all",
2395
2452
  description: "Get all __csl__ values from localStorage",
2396
- params: rn,
2453
+ params: nn,
2397
2454
  returns: t.record(t.string().nullable()),
2398
2455
  owner: "main-thread",
2399
2456
  handler: async (e, r) => {
@@ -2418,7 +2475,7 @@ p({
2418
2475
  namespace: "storage",
2419
2476
  name: "delete_many",
2420
2477
  description: "Delete multiple keys from localStorage",
2421
- params: an,
2478
+ params: on,
2422
2479
  returns: t.null(),
2423
2480
  owner: "main-thread",
2424
2481
  handler: async (e, r) => {
@@ -2445,7 +2502,7 @@ p({
2445
2502
  namespace: "storage",
2446
2503
  name: "clear",
2447
2504
  description: "Clear all __csl__ keys from localStorage",
2448
- params: on,
2505
+ params: sn,
2449
2506
  returns: t.null(),
2450
2507
  owner: "main-thread",
2451
2508
  handler: async (e, r) => {
@@ -2558,7 +2615,7 @@ p({
2558
2615
  namespace: "clipboard",
2559
2616
  name: "read",
2560
2617
  description: "Read text from clipboard",
2561
- params: sn,
2618
+ params: cn,
2562
2619
  returns: t.string(),
2563
2620
  aliases: [{ namespace: "web.clipboard", name: "read" }],
2564
2621
  owner: "main-thread",
@@ -2574,7 +2631,7 @@ p({
2574
2631
  namespace: "clipboard",
2575
2632
  name: "write",
2576
2633
  description: "Write text to clipboard",
2577
- params: cn,
2634
+ params: ln,
2578
2635
  returns: t.null(),
2579
2636
  aliases: [{ namespace: "web.clipboard", name: "write", fields: ["text"] }],
2580
2637
  owner: "main-thread",
@@ -2584,7 +2641,7 @@ p({
2584
2641
  const a = e[0];
2585
2642
  typeof a == "object" && a !== null ? n = String(a.text ?? a) : n = String(a);
2586
2643
  } else {
2587
- const a = F(e);
2644
+ const a = G(e);
2588
2645
  n = a.text || a.value || "";
2589
2646
  }
2590
2647
  return await navigator.clipboard.writeText(n), null;
@@ -2613,14 +2670,14 @@ p({
2613
2670
  namespace: "network",
2614
2671
  name: "fetch",
2615
2672
  description: "Make an HTTP request",
2616
- params: St,
2673
+ params: vt,
2617
2674
  returns: Re,
2618
2675
  fields: ["url"],
2619
2676
  aliases: [{ namespace: "web", name: "fetch", fields: ["url"] }],
2620
2677
  owner: "main-thread",
2621
2678
  handler: async (e, r) => {
2622
2679
  const n = await Zr(e);
2623
- return S(n);
2680
+ return v(n);
2624
2681
  },
2625
2682
  paramTypes: [
2626
2683
  {
@@ -2664,7 +2721,7 @@ p({
2664
2721
  namespace: "util",
2665
2722
  name: "sleep",
2666
2723
  description: "Sleep for a duration",
2667
- params: ln,
2724
+ params: dn,
2668
2725
  returns: t.null(),
2669
2726
  fields: ["duration"],
2670
2727
  aliases: [{ namespace: "web", name: "sleep", fields: ["duration"] }],
@@ -2708,14 +2765,14 @@ p({
2708
2765
  errorCode: "E_UNKNOWN",
2709
2766
  example: 'util.mock_async({ tabId: 123, script: "document.title" })'
2710
2767
  });
2711
- const L = "Returns a Promise; await before reading the result. For a cell's last line, use `page.snapshot()` without a leading await so the cell returns the settled value.", Ft = [
2768
+ const U = "Returns a Promise; await before reading the result. For a cell's last line, use `page.snapshot()` without a leading await so the cell returns the settled value.", Gt = [
2712
2769
  {
2713
2770
  action: "page_back",
2714
2771
  namespace: "page",
2715
2772
  name: "back",
2716
2773
  description: "Go back in the active tab",
2717
- params: bn,
2718
- returns: _,
2774
+ params: hn,
2775
+ returns: g,
2719
2776
  paramTypes: [],
2720
2777
  returnDoc: "Navigation result",
2721
2778
  errorCode: "E_NO_TAB",
@@ -2727,8 +2784,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2727
2784
  namespace: "page",
2728
2785
  name: "click",
2729
2786
  description: "Click an element in the active tab",
2730
- params: yn,
2731
- returns: _,
2787
+ params: _n,
2788
+ returns: g,
2732
2789
  paramTypes: [
2733
2790
  {
2734
2791
  name: "refId",
@@ -2751,7 +2808,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2751
2808
  "Ensure the target tab is active and the content script is ready before mutating"
2752
2809
  ],
2753
2810
  notes: [
2754
- L,
2811
+ U,
2755
2812
  "Same content-script path as web.tab.*",
2756
2813
  "Always operates on the active tab; use web.tab.* if you need to target a specific tabId"
2757
2814
  ],
@@ -2765,8 +2822,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2765
2822
  namespace: "page",
2766
2823
  name: "fill",
2767
2824
  description: "Fill an element in the active tab",
2768
- params: wn,
2769
- returns: _,
2825
+ params: kn,
2826
+ returns: g,
2770
2827
  paramTypes: [
2771
2828
  {
2772
2829
  name: "refId",
@@ -2795,7 +2852,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2795
2852
  "Ensure the target tab is active and the content script is ready before mutating"
2796
2853
  ],
2797
2854
  notes: [
2798
- L,
2855
+ U,
2799
2856
  "Same content-script path as web.tab.*",
2800
2857
  "Always operates on the active tab; use web.tab.* if you need to target a specific tabId"
2801
2858
  ],
@@ -2809,8 +2866,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2809
2866
  namespace: "page",
2810
2867
  name: "setFiles",
2811
2868
  description: "Attach files to a file input in the active tab",
2812
- params: kn,
2813
- returns: _,
2869
+ params: En,
2870
+ returns: g,
2814
2871
  paramTypes: [
2815
2872
  {
2816
2873
  name: "refId",
@@ -2839,7 +2896,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2839
2896
  "Ensure the target tab is active and the content script is ready before mutating"
2840
2897
  ],
2841
2898
  notes: [
2842
- L,
2899
+ U,
2843
2900
  "Target must be input[type=file]; prefer url, vfs path, or fetch handle — bytes are not passed through QuickJS",
2844
2901
  "Use page.fetch({ url, store: true }) then setFiles({ files: [{ handle }] }) for downloaded binaries",
2845
2902
  "Same content-script path as web.tab.*",
@@ -2855,8 +2912,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2855
2912
  namespace: "page",
2856
2913
  name: "type",
2857
2914
  description: "Type into an element in the active tab",
2858
- params: En,
2859
- returns: _,
2915
+ params: In,
2916
+ returns: g,
2860
2917
  paramTypes: [
2861
2918
  {
2862
2919
  name: "refId",
@@ -2885,7 +2942,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2885
2942
  "Ensure the target tab is active and the content script is ready before mutating"
2886
2943
  ],
2887
2944
  notes: [
2888
- L,
2945
+ U,
2889
2946
  "Same content-script path as web.tab.*",
2890
2947
  "Always operates on the active tab; use web.tab.* if you need to target a specific tabId"
2891
2948
  ],
@@ -2899,8 +2956,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2899
2956
  namespace: "page",
2900
2957
  name: "append",
2901
2958
  description: "Append text to an element in the active tab",
2902
- params: In,
2903
- returns: _,
2959
+ params: vn,
2960
+ returns: g,
2904
2961
  paramTypes: [
2905
2962
  {
2906
2963
  name: "refId",
@@ -2942,7 +2999,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2942
2999
  name: "press",
2943
3000
  description: "Press a key in the active tab",
2944
3001
  params: Sn,
2945
- returns: _,
3002
+ returns: g,
2946
3003
  fields: ["key"],
2947
3004
  paramTypes: [
2948
3005
  {
@@ -2973,8 +3030,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
2973
3030
  namespace: "page",
2974
3031
  name: "select",
2975
3032
  description: "Select an option in the active tab",
2976
- params: vn,
2977
- returns: _,
3033
+ params: xn,
3034
+ returns: g,
2978
3035
  paramTypes: [
2979
3036
  {
2980
3037
  name: "refId",
@@ -3011,13 +3068,57 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3011
3068
  },
3012
3069
  handlerKey: "select"
3013
3070
  },
3071
+ {
3072
+ action: "page_select_option",
3073
+ namespace: "page",
3074
+ name: "select_option",
3075
+ description: "Open a combobox (react-select/listbox) and click the option whose text matches value",
3076
+ params: Tn,
3077
+ returns: g,
3078
+ paramTypes: [
3079
+ {
3080
+ name: "refId",
3081
+ type: "string",
3082
+ required: !1,
3083
+ description: "Element reference ID (refId)"
3084
+ },
3085
+ {
3086
+ name: "label",
3087
+ type: "string",
3088
+ required: !1,
3089
+ description: "Element label (label)"
3090
+ },
3091
+ {
3092
+ name: "value",
3093
+ type: "string",
3094
+ required: !1,
3095
+ description: "Visible text of the option to select (matched case-insensitively)"
3096
+ }
3097
+ ],
3098
+ returnDoc: "{ ok: true, action: 'select_option', refId?, value? }",
3099
+ errorCode: "E_NOT_FOUND",
3100
+ example: 'page.select_option({ refId: "e2", value: "Canada" })',
3101
+ agentMeta: {
3102
+ prerequisites: [
3103
+ "Ensure the target tab is active and the content script is ready before mutating"
3104
+ ],
3105
+ notes: [
3106
+ "Same content-script path as web.tab.*",
3107
+ "Always operates on the active tab; use web.tab.* if you need to target a specific tabId",
3108
+ "Drives react-select and other ARIA combobox patterns: clicks the control to open, then clicks the matching [role='option']"
3109
+ ],
3110
+ tags: ["mutation", "write"],
3111
+ relatedApis: ["web.tab.select_option"]
3112
+ },
3113
+ handlerKey: "select_option"
3114
+ },
3014
3115
  {
3015
3116
  action: "page_check",
3016
3117
  namespace: "page",
3017
3118
  name: "check",
3018
3119
  description: "Check/uncheck an element in the active tab",
3019
- params: xn,
3020
- returns: _,
3120
+ params: Cn,
3121
+ returns: g,
3021
3122
  paramTypes: [
3022
3123
  {
3023
3124
  name: "refId",
@@ -3059,8 +3160,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3059
3160
  namespace: "page",
3060
3161
  name: "hover",
3061
3162
  description: "Hover over an element in the active tab",
3062
- params: Cn,
3063
- returns: _,
3163
+ params: An,
3164
+ returns: g,
3064
3165
  paramTypes: [
3065
3166
  {
3066
3167
  name: "refId",
@@ -3096,8 +3197,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3096
3197
  namespace: "page",
3097
3198
  name: "unhover",
3098
3199
  description: "Unhover in the active tab",
3099
- params: Tn,
3100
- returns: _,
3200
+ params: Dn,
3201
+ returns: g,
3101
3202
  paramTypes: [],
3102
3203
  returnDoc: "{ ok: true, action: 'unhover' }",
3103
3204
  errorCode: "E_NO_TAB",
@@ -3115,13 +3216,89 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3115
3216
  },
3116
3217
  handlerKey: "unhover"
3117
3218
  },
3219
+ {
3220
+ action: "page_submit",
3221
+ namespace: "page",
3222
+ name: "submit",
3223
+ description: "Submit a form in the active tab (calls form.requestSubmit())",
3224
+ params: Nn,
3225
+ returns: g,
3226
+ paramTypes: [
3227
+ {
3228
+ name: "refId",
3229
+ type: "string",
3230
+ required: !1,
3231
+ description: "Element reference ID of the form or any element inside it (refId)"
3232
+ },
3233
+ {
3234
+ name: "label",
3235
+ type: "string",
3236
+ required: !1,
3237
+ description: "Element label (label)"
3238
+ }
3239
+ ],
3240
+ returnDoc: "{ ok: true, action: 'submit', refId?, dispatched: true }",
3241
+ errorCode: "E_MISSING_PARAM",
3242
+ example: 'page.submit({ refId: "e2" })',
3243
+ agentMeta: {
3244
+ prerequisites: [
3245
+ "Ensure the target tab is active and the content script is ready before mutating"
3246
+ ],
3247
+ notes: [
3248
+ "Target a <form> element or any descendant; resolves to the owning form",
3249
+ "Uses form.requestSubmit() so submit event listeners fire and validation runs",
3250
+ "Same content-script path as web.tab.*"
3251
+ ],
3252
+ tags: ["mutation", "write"],
3253
+ relatedApis: ["web.tab.submit", "page.click"]
3254
+ },
3255
+ handlerKey: "submit"
3256
+ },
3257
+ {
3258
+ action: "page_check_radio",
3259
+ namespace: "page",
3260
+ name: "checkRadio",
3261
+ description: "Check a radio option by group name and value in the active tab",
3262
+ params: Rn,
3263
+ returns: g,
3264
+ paramTypes: [
3265
+ {
3266
+ name: "name",
3267
+ type: "string",
3268
+ required: !0,
3269
+ description: "The name attribute of the radio group"
3270
+ },
3271
+ {
3272
+ name: "value",
3273
+ type: "string",
3274
+ required: !0,
3275
+ description: "The value of the radio option to check"
3276
+ }
3277
+ ],
3278
+ returnDoc: "{ ok: true, action: 'check_radio', refId?, checked: true, value }",
3279
+ errorCode: "E_MISSING_PARAM",
3280
+ example: 'page.checkRadio({ name: "radio-grp", value: "opt2" })',
3281
+ agentMeta: {
3282
+ prerequisites: [
3283
+ "Ensure the target tab is active and the content script is ready before mutating"
3284
+ ],
3285
+ notes: [
3286
+ "Picks a radio by group name + value — no refId needed",
3287
+ "Use page.snapshot_data to discover radio values from the DOM",
3288
+ "Same content-script path as web.tab.*"
3289
+ ],
3290
+ tags: ["mutation", "write"],
3291
+ relatedApis: ["web.tab.checkRadio", "page.check", "page.snapshot_data"]
3292
+ },
3293
+ handlerKey: "check_radio"
3294
+ },
3118
3295
  {
3119
3296
  action: "page_scroll",
3120
3297
  namespace: "page",
3121
3298
  name: "scroll",
3122
3299
  description: "Scroll the active tab",
3123
- params: Rn,
3124
- returns: _,
3300
+ params: qn,
3301
+ returns: g,
3125
3302
  fields: ["direction", "amount"],
3126
3303
  paramTypes: [
3127
3304
  {
@@ -3147,8 +3324,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3147
3324
  namespace: "page",
3148
3325
  name: "scroll_to",
3149
3326
  description: "Scroll to an element in the active tab",
3150
- params: An,
3151
- returns: _,
3327
+ params: On,
3328
+ returns: g,
3152
3329
  paramTypes: [
3153
3330
  {
3154
3331
  name: "refId",
@@ -3173,8 +3350,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3173
3350
  namespace: "page",
3174
3351
  name: "dblclick",
3175
3352
  description: "Double-click an element in the active tab",
3176
- params: Nn,
3177
- returns: _,
3353
+ params: Mn,
3354
+ returns: g,
3178
3355
  paramTypes: [
3179
3356
  {
3180
3357
  name: "refId",
@@ -3210,8 +3387,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3210
3387
  namespace: "web.tab",
3211
3388
  name: "click",
3212
3389
  description: "Click in a tab",
3213
- params: Ln,
3214
- returns: _,
3390
+ params: $n,
3391
+ returns: g,
3215
3392
  paramTypes: [
3216
3393
  {
3217
3394
  name: "tabId",
@@ -3250,8 +3427,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3250
3427
  namespace: "web.tab",
3251
3428
  name: "fill",
3252
3429
  description: "Fill in a tab",
3253
- params: Wn,
3254
- returns: _,
3430
+ params: Kn,
3431
+ returns: g,
3255
3432
  paramTypes: [
3256
3433
  {
3257
3434
  name: "tabId",
@@ -3296,8 +3473,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3296
3473
  namespace: "web.tab",
3297
3474
  name: "setFiles",
3298
3475
  description: "Attach files to a file input in a tab",
3299
- params: Fn,
3300
- returns: _,
3476
+ params: Vn,
3477
+ returns: g,
3301
3478
  paramTypes: [
3302
3479
  {
3303
3480
  name: "tabId",
@@ -3342,8 +3519,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3342
3519
  namespace: "web.tab",
3343
3520
  name: "scroll_to",
3344
3521
  description: "Scroll to position in a tab",
3345
- params: Gn,
3346
- returns: _,
3522
+ params: Zn,
3523
+ returns: g,
3347
3524
  paramTypes: [
3348
3525
  {
3349
3526
  name: "tabId",
@@ -3386,8 +3563,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3386
3563
  namespace: "web.tab",
3387
3564
  name: "type",
3388
3565
  description: "Type in a tab",
3389
- params: Bn,
3390
- returns: _,
3566
+ params: zn,
3567
+ returns: g,
3391
3568
  paramTypes: [
3392
3569
  {
3393
3570
  name: "tabId",
@@ -3432,8 +3609,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3432
3609
  namespace: "web.tab",
3433
3610
  name: "press",
3434
3611
  description: "Press a key in a tab",
3435
- params: $n,
3436
- returns: _,
3612
+ params: Qn,
3613
+ returns: g,
3437
3614
  paramTypes: [
3438
3615
  {
3439
3616
  name: "tabId",
@@ -3466,8 +3643,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3466
3643
  namespace: "web.tab",
3467
3644
  name: "select",
3468
3645
  description: "Select an option in a tab",
3469
- params: Kn,
3470
- returns: _,
3646
+ params: Xn,
3647
+ returns: g,
3471
3648
  paramTypes: [
3472
3649
  {
3473
3650
  name: "tabId",
@@ -3507,13 +3684,62 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3507
3684
  },
3508
3685
  handlerKey: "select"
3509
3686
  },
3687
+ {
3688
+ action: "tab_select_option",
3689
+ namespace: "web.tab",
3690
+ name: "select_option",
3691
+ description: "Open a combobox (react-select/listbox) in a tab and click the option whose text matches value",
3692
+ params: Jn,
3693
+ returns: g,
3694
+ paramTypes: [
3695
+ {
3696
+ name: "tabId",
3697
+ type: "number",
3698
+ required: !0,
3699
+ description: "Tab ID (literal)"
3700
+ },
3701
+ {
3702
+ name: "refId",
3703
+ type: "string",
3704
+ required: !1,
3705
+ description: "Element reference ID (refId)"
3706
+ },
3707
+ {
3708
+ name: "label",
3709
+ type: "string",
3710
+ required: !1,
3711
+ description: "Element label (label)"
3712
+ },
3713
+ {
3714
+ name: "value",
3715
+ type: "string",
3716
+ required: !1,
3717
+ description: "Visible text of the option to select (matched case-insensitively)"
3718
+ }
3719
+ ],
3720
+ returnDoc: "{ ok: true, action: 'select_option', refId?, value? }",
3721
+ errorCode: "E_NO_TAB",
3722
+ example: 'web.tab.select_option({ tabId: 123, refId: "e2", value: "Canada" })',
3723
+ agentMeta: {
3724
+ prerequisites: [
3725
+ "Ensure the target tab exists and the content script is ready before mutating"
3726
+ ],
3727
+ notes: [
3728
+ "Explicit tabId required; same handlers as page.*",
3729
+ "Drives react-select and other ARIA combobox patterns: clicks the control to open, then clicks the matching [role='option']"
3730
+ ],
3731
+ tags: ["mutation", "write"],
3732
+ relatedApis: ["page.select_option"]
3733
+ },
3734
+ handlerKey: "select_option"
3735
+ },
3510
3736
  {
3511
3737
  action: "tab_check",
3512
3738
  namespace: "web.tab",
3513
3739
  name: "check",
3514
3740
  description: "Check/uncheck in a tab",
3515
- params: Zn,
3516
- returns: _,
3741
+ params: Yn,
3742
+ returns: g,
3517
3743
  paramTypes: [
3518
3744
  {
3519
3745
  name: "tabId",
@@ -3553,13 +3779,93 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3553
3779
  },
3554
3780
  handlerKey: "check"
3555
3781
  },
3782
+ {
3783
+ action: "tab_submit",
3784
+ namespace: "web.tab",
3785
+ name: "submit",
3786
+ description: "Submit a form in a tab (calls form.requestSubmit())",
3787
+ params: ta,
3788
+ returns: g,
3789
+ paramTypes: [
3790
+ {
3791
+ name: "tabId",
3792
+ type: "number",
3793
+ required: !0,
3794
+ description: "Tab ID (literal)"
3795
+ },
3796
+ {
3797
+ name: "refId",
3798
+ type: "string",
3799
+ required: !1,
3800
+ description: "Element reference ID of the form or any element inside it (refId)"
3801
+ },
3802
+ {
3803
+ name: "label",
3804
+ type: "string",
3805
+ required: !1,
3806
+ description: "Element label (label)"
3807
+ }
3808
+ ],
3809
+ returnDoc: "{ ok: true, action: 'submit', refId?, dispatched: true }",
3810
+ errorCode: "E_NO_TAB",
3811
+ example: 'web.tab.submit({ tabId: 123, refId: "e2" })',
3812
+ agentMeta: {
3813
+ prerequisites: [
3814
+ "Ensure the target tab exists and the content script is ready before mutating"
3815
+ ],
3816
+ notes: ["Explicit tabId required; same handler as page.submit"],
3817
+ tags: ["mutation", "write"],
3818
+ relatedApis: ["page.submit"]
3819
+ },
3820
+ handlerKey: "submit"
3821
+ },
3822
+ {
3823
+ action: "tab_check_radio",
3824
+ namespace: "web.tab",
3825
+ name: "checkRadio",
3826
+ description: "Check a radio option by group name and value in a tab",
3827
+ params: ra,
3828
+ returns: g,
3829
+ paramTypes: [
3830
+ {
3831
+ name: "tabId",
3832
+ type: "number",
3833
+ required: !0,
3834
+ description: "Tab ID (literal)"
3835
+ },
3836
+ {
3837
+ name: "name",
3838
+ type: "string",
3839
+ required: !0,
3840
+ description: "The name attribute of the radio group"
3841
+ },
3842
+ {
3843
+ name: "value",
3844
+ type: "string",
3845
+ required: !0,
3846
+ description: "The value of the radio option to check"
3847
+ }
3848
+ ],
3849
+ returnDoc: "{ ok: true, action: 'check_radio', refId?, checked: true, value }",
3850
+ errorCode: "E_NO_TAB",
3851
+ example: 'web.tab.checkRadio({ tabId: 123, name: "radio-grp", value: "opt2" })',
3852
+ agentMeta: {
3853
+ prerequisites: [
3854
+ "Ensure the target tab exists and the content script is ready before mutating"
3855
+ ],
3856
+ notes: ["Explicit tabId required; same handler as page.checkRadio"],
3857
+ tags: ["mutation", "write"],
3858
+ relatedApis: ["page.checkRadio"]
3859
+ },
3860
+ handlerKey: "check_radio"
3861
+ },
3556
3862
  {
3557
3863
  action: "tab_hover",
3558
3864
  namespace: "web.tab",
3559
3865
  name: "hover",
3560
3866
  description: "Hover in a tab",
3561
- params: Vn,
3562
- returns: _,
3867
+ params: ea,
3868
+ returns: g,
3563
3869
  paramTypes: [
3564
3870
  {
3565
3871
  name: "tabId",
@@ -3598,8 +3904,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3598
3904
  namespace: "web.tab",
3599
3905
  name: "unhover",
3600
3906
  description: "Unhover in a tab",
3601
- params: zn,
3602
- returns: _,
3907
+ params: na,
3908
+ returns: g,
3603
3909
  paramTypes: [
3604
3910
  {
3605
3911
  name: "tabId",
@@ -3626,8 +3932,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3626
3932
  namespace: "web.tab",
3627
3933
  name: "scroll",
3628
3934
  description: "Scroll in a tab",
3629
- params: Qn,
3630
- returns: _,
3935
+ params: aa,
3936
+ returns: g,
3631
3937
  paramTypes: [
3632
3938
  {
3633
3939
  name: "tabId",
@@ -3658,8 +3964,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3658
3964
  namespace: "web.tab",
3659
3965
  name: "dblclick",
3660
3966
  description: "Double-click in a tab",
3661
- params: Xn,
3662
- returns: _,
3967
+ params: oa,
3968
+ returns: g,
3663
3969
  paramTypes: [
3664
3970
  {
3665
3971
  name: "tabId",
@@ -3698,8 +4004,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3698
4004
  namespace: "web.tab",
3699
4005
  name: "back",
3700
4006
  description: "Go back in a tab",
3701
- params: Yn,
3702
- returns: _,
4007
+ params: sa,
4008
+ returns: g,
3703
4009
  paramTypes: [
3704
4010
  {
3705
4011
  name: "tabId",
@@ -3718,8 +4024,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3718
4024
  namespace: "page",
3719
4025
  name: "forward",
3720
4026
  description: "Go forward in the active tab",
3721
- params: hn,
3722
- returns: _,
4027
+ params: fn,
4028
+ returns: g,
3723
4029
  paramTypes: [],
3724
4030
  returnDoc: "Navigation result",
3725
4031
  errorCode: "E_NO_TAB",
@@ -3731,7 +4037,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3731
4037
  namespace: "page",
3732
4038
  name: "snapshot",
3733
4039
  description: "Capture full DOM snapshot",
3734
- params: xa,
4040
+ params: Oa,
3735
4041
  returns: t.string(),
3736
4042
  paramTypes: [
3737
4043
  {
@@ -3752,7 +4058,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3752
4058
  example: "page.snapshot()",
3753
4059
  agentMeta: {
3754
4060
  notes: [
3755
- L,
4061
+ U,
3756
4062
  "Content-script path; same refIds as mutations"
3757
4063
  ],
3758
4064
  tags: ["snapshot", "read"],
@@ -3765,7 +4071,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3765
4071
  namespace: "page",
3766
4072
  name: "snapshot_text",
3767
4073
  description: "Capture DOM snapshot and return text representation",
3768
- params: Ca,
4074
+ params: Ma,
3769
4075
  returns: t.string(),
3770
4076
  paramTypes: [
3771
4077
  {
@@ -3785,7 +4091,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3785
4091
  namespace: "page",
3786
4092
  name: "snapshot_data",
3787
4093
  description: "Get page snapshot data",
3788
- params: Ta,
4094
+ params: Pa,
3789
4095
  returns: me,
3790
4096
  paramTypes: [
3791
4097
  {
@@ -3800,7 +4106,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3800
4106
  example: "page.snapshot_data()",
3801
4107
  agentMeta: {
3802
4108
  notes: [
3803
- L,
4109
+ U,
3804
4110
  "Content-script path; nodes include refId for targeting",
3805
4111
  "After mutations, call snapshot_data() again to verify state"
3806
4112
  ],
@@ -3814,7 +4120,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3814
4120
  namespace: "page",
3815
4121
  name: "snapshot_query",
3816
4122
  description: "Query page snapshot with semantic filtering by role, tag, text, name, etc.",
3817
- params: Nt,
4123
+ params: Dt,
3818
4124
  returns: me,
3819
4125
  paramTypes: [
3820
4126
  {
@@ -3835,7 +4141,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3835
4141
  example: 'page.snapshot_query({ filter: { role: "button" } })',
3836
4142
  agentMeta: {
3837
4143
  notes: [
3838
- L,
4144
+ U,
3839
4145
  "Content-script path; filters nodes by role, tag, text, name, interactiveOnly, href, src",
3840
4146
  "More efficient than page.snapshot_data() when only specific elements are needed"
3841
4147
  ],
@@ -3849,10 +4155,10 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3849
4155
  namespace: "page",
3850
4156
  name: "find",
3851
4157
  description: "Find elements in the active tab using a CSS selector",
3852
- params: Dn,
4158
+ params: Pn,
3853
4159
  returns: t.array(
3854
4160
  t.object({
3855
- refId: H(),
4161
+ refId: q(),
3856
4162
  role: t.string(),
3857
4163
  tag: t.string(),
3858
4164
  name: t.string().optional(),
@@ -3865,7 +4171,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3865
4171
  src: t.string().optional(),
3866
4172
  alt: t.string().optional(),
3867
4173
  title: t.string().optional(),
3868
- parentRefId: H().optional()
4174
+ parentRefId: q().optional()
3869
4175
  })
3870
4176
  ),
3871
4177
  aliases: [{ namespace: "page", name: "query" }],
@@ -3889,12 +4195,56 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3889
4195
  },
3890
4196
  handlerKey: "find"
3891
4197
  },
4198
+ {
4199
+ action: "page_dom",
4200
+ namespace: "page",
4201
+ name: "dom",
4202
+ description: "Introspect raw DOM subtree by CSS selector — bypasses the curated snapshot's visibility filter. Read-only. Use when page.snapshot/find hide the element you need (e.g. hidden file inputs, shadowed widgets, aria-hidden regions).",
4203
+ params: jn,
4204
+ returns: Ka,
4205
+ paramTypes: [
4206
+ {
4207
+ name: "selector",
4208
+ type: "string",
4209
+ required: !0,
4210
+ description: "CSS selector for root element(s)"
4211
+ },
4212
+ {
4213
+ name: "depth",
4214
+ type: "number",
4215
+ required: !1,
4216
+ description: "Descendant levels (default 2, max 10)"
4217
+ },
4218
+ {
4219
+ name: "includeHidden",
4220
+ type: "boolean",
4221
+ required: !1,
4222
+ description: "Include hidden elements (default true)"
4223
+ }
4224
+ ],
4225
+ returnDoc: "{ nodes: [{ refId?, tag, role?, name?, attributes?, hidden?, hiddenReason?, accept?, filesCount?, children? }], url, title }",
4226
+ errorCode: "E_NO_TAB",
4227
+ example: 'page.dom({ selector: "input[type=file]", depth: 0 })',
4228
+ agentMeta: {
4229
+ prerequisites: ["Active tab with content script ready"],
4230
+ notes: [
4231
+ U,
4232
+ "Read-only: returns DOM structure, never executes code or mutates the page",
4233
+ "Bypasses the snapshot visibility filter — use to find hidden/filtered elements the curated snapshot omits",
4234
+ "Assigns refIds to returned elements so subsequent page.setFiles/click/fill can target them",
4235
+ "Prefer page.snapshot for normal navigation; use page.dom only when the snapshot is insufficient"
4236
+ ],
4237
+ tags: ["read"],
4238
+ relatedApis: ["page.find", "page.snapshot_data", "page.setFiles"]
4239
+ },
4240
+ handlerKey: "dom"
4241
+ },
3892
4242
  {
3893
4243
  action: "page_wait_for",
3894
4244
  namespace: "page",
3895
4245
  name: "wait_for",
3896
4246
  description: "Wait for a selector in the active tab",
3897
- params: On,
4247
+ params: Hn,
3898
4248
  returns: t.boolean(),
3899
4249
  fields: ["selector", "timeout"],
3900
4250
  paramTypes: [
@@ -3916,7 +4266,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3916
4266
  errorCategory: "timeout",
3917
4267
  example: 'page.wait_for("#submit", 5000)',
3918
4268
  agentMeta: {
3919
- notes: [L],
4269
+ notes: [U],
3920
4270
  tags: ["read"]
3921
4271
  },
3922
4272
  handlerKey: "wait_for"
@@ -3926,7 +4276,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3926
4276
  namespace: "page",
3927
4277
  name: "extract",
3928
4278
  description: "Extract data from the active tab",
3929
- params: Mn,
4279
+ params: Ln,
3930
4280
  returns: t.object({
3931
4281
  title: t.string().optional(),
3932
4282
  url: t.string().optional(),
@@ -3947,7 +4297,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3947
4297
  errorCode: "E_NO_TAB",
3948
4298
  example: 'page.extract(["title", "url"])',
3949
4299
  agentMeta: {
3950
- notes: [L],
4300
+ notes: [U],
3951
4301
  tags: ["read"]
3952
4302
  },
3953
4303
  handlerKey: "extract"
@@ -3957,7 +4307,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3957
4307
  namespace: "page",
3958
4308
  name: "fetch",
3959
4309
  description: "Fetch in the active tab",
3960
- params: St,
4310
+ params: vt,
3961
4311
  returns: Re,
3962
4312
  fields: ["url", "options"],
3963
4313
  paramTypes: [
@@ -3979,7 +4329,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3979
4329
  example: 'page.fetch({ url: "https://api.example.com/data" })',
3980
4330
  agentMeta: {
3981
4331
  notes: [
3982
- L,
4332
+ U,
3983
4333
  "Runtime binary globals available: Uint8Array, ArrayBuffer, TextEncoder, TextDecoder, atob, btoa",
3984
4334
  "For binary responses bodyEncoding is 'base64'; use atob() or fs.writeBase64 to handle bytes"
3985
4335
  ],
@@ -3992,8 +4342,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
3992
4342
  namespace: "web.tab",
3993
4343
  name: "forward",
3994
4344
  description: "Go forward in a tab",
3995
- params: ea,
3996
- returns: _,
4345
+ params: ca,
4346
+ returns: g,
3997
4347
  paramTypes: [
3998
4348
  {
3999
4349
  name: "tabId",
@@ -4012,7 +4362,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4012
4362
  namespace: "web.tab",
4013
4363
  name: "snapshot",
4014
4364
  description: "Get tab snapshot",
4015
- params: na,
4365
+ params: ua,
4016
4366
  returns: t.string(),
4017
4367
  fields: ["tabId"],
4018
4368
  paramTypes: [
@@ -4039,7 +4389,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4039
4389
  namespace: "web.tab",
4040
4390
  name: "snapshot_text",
4041
4391
  description: "Get tab snapshot text",
4042
- params: aa,
4392
+ params: ma,
4043
4393
  returns: t.string(),
4044
4394
  fields: ["tabId"],
4045
4395
  paramTypes: [
@@ -4060,7 +4410,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4060
4410
  namespace: "web.tab",
4061
4411
  name: "snapshot_data",
4062
4412
  description: "Get tab snapshot data",
4063
- params: oa,
4413
+ params: pa,
4064
4414
  returns: me,
4065
4415
  fields: ["tabId"],
4066
4416
  paramTypes: [
@@ -4081,7 +4431,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4081
4431
  namespace: "web.tab",
4082
4432
  name: "snapshot_query",
4083
4433
  description: "Query tab snapshot with semantic filtering by role, tag, text, name, etc.",
4084
- params: Aa,
4434
+ params: Ha,
4085
4435
  returns: me,
4086
4436
  fields: ["tabId"],
4087
4437
  paramTypes: [
@@ -4122,7 +4472,7 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4122
4472
  namespace: "web.tab",
4123
4473
  name: "fetch",
4124
4474
  description: "Fetch in a tab",
4125
- params: ra,
4475
+ params: da,
4126
4476
  returns: Re,
4127
4477
  fields: ["tabId", "url", "options"],
4128
4478
  paramTypes: [
@@ -4149,8 +4499,8 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4149
4499
  namespace: "web.tab",
4150
4500
  name: "evaluate",
4151
4501
  description: "Evaluate script in a tab (content-script context)",
4152
- params: Jn,
4153
- returns: Pa,
4502
+ params: ia,
4503
+ returns: Ba,
4154
4504
  fields: ["tabId", "script"],
4155
4505
  paramTypes: [
4156
4506
  {
@@ -4179,11 +4529,11 @@ const L = "Returns a Promise; await before reading the result. For a cell's last
4179
4529
  handlerKey: "evaluate"
4180
4530
  }
4181
4531
  ];
4182
- function Gt(e) {
4532
+ function Bt(e) {
4183
4533
  const { handlerKey: r, ...n } = e;
4184
- rt(n), er(e.action);
4534
+ rt(n), tr(e.action);
4185
4535
  }
4186
- const oe = h.child("runner"), ao = [
4536
+ const ie = h.child("runner"), bo = [
4187
4537
  "main_frame",
4188
4538
  "sub_frame",
4189
4539
  "stylesheet",
@@ -4193,25 +4543,25 @@ const oe = h.child("runner"), ao = [
4193
4543
  "media",
4194
4544
  "other"
4195
4545
  ];
4196
- class oo {
4546
+ class ho {
4197
4547
  constructor(r) {
4198
- M(this, "inFlight", /* @__PURE__ */ new Map());
4199
- M(this, "onBeforeRequest", null);
4200
- M(this, "onCompleted", null);
4201
- M(this, "onErrorOccurred", null);
4548
+ P(this, "inFlight", /* @__PURE__ */ new Map());
4549
+ P(this, "onBeforeRequest", null);
4550
+ P(this, "onCompleted", null);
4551
+ P(this, "onErrorOccurred", null);
4202
4552
  this.tabId = r;
4203
4553
  }
4204
4554
  start() {
4205
4555
  var a;
4206
4556
  const r = (a = globalThis.chrome) == null ? void 0 : a.webRequest;
4207
4557
  if (!r) {
4208
- oe.warn("networkTracker_unavailable", { tabId: this.tabId });
4558
+ ie.warn("networkTracker_unavailable", { tabId: this.tabId });
4209
4559
  return;
4210
4560
  }
4211
4561
  const n = {
4212
4562
  tabId: this.tabId,
4213
4563
  urls: ["<all_urls>"],
4214
- types: ao
4564
+ types: bo
4215
4565
  };
4216
4566
  this.onBeforeRequest = (o) => {
4217
4567
  o.tabId === this.tabId && this.inFlight.set(o.requestId, Date.now());
@@ -4219,7 +4569,7 @@ class oo {
4219
4569
  o.tabId === this.tabId && this.inFlight.delete(o.requestId);
4220
4570
  }, this.onErrorOccurred = (o) => {
4221
4571
  o.tabId === this.tabId && this.inFlight.delete(o.requestId);
4222
- }, r.onBeforeRequest.addListener(this.onBeforeRequest, n), r.onCompleted.addListener(this.onCompleted, n), r.onErrorOccurred.addListener(this.onErrorOccurred, n), oe.debug("networkTracker_started", { tabId: this.tabId });
4572
+ }, r.onBeforeRequest.addListener(this.onBeforeRequest, n), r.onCompleted.addListener(this.onCompleted, n), r.onErrorOccurred.addListener(this.onErrorOccurred, n), ie.debug("networkTracker_started", { tabId: this.tabId });
4223
4573
  }
4224
4574
  get pendingCount() {
4225
4575
  return this.inFlight.size;
@@ -4232,13 +4582,13 @@ class oo {
4232
4582
  if (await new Promise(
4233
4583
  (s) => setTimeout(s, _t)
4234
4584
  ), this.inFlight.size === 0) {
4235
- oe.debug("networkTracker_idle", { tabId: this.tabId, traceId: n });
4585
+ ie.debug("networkTracker_idle", { tabId: this.tabId, traceId: n });
4236
4586
  return;
4237
4587
  }
4238
4588
  continue;
4239
4589
  }
4240
4590
  const i = Date.now();
4241
- i - o >= 1e3 && (o = i, oe.debug("networkTracker_idle_wait", {
4591
+ i - o >= 1e3 && (o = i, ie.debug("networkTracker_idle_wait", {
4242
4592
  tabId: this.tabId,
4243
4593
  traceId: n,
4244
4594
  inFlight: this.inFlight.size
@@ -4251,25 +4601,25 @@ class oo {
4251
4601
  dispose() {
4252
4602
  var n;
4253
4603
  const r = (n = globalThis.chrome) == null ? void 0 : n.webRequest;
4254
- r && (this.onBeforeRequest && r.onBeforeRequest.removeListener(this.onBeforeRequest), this.onCompleted && r.onCompleted.removeListener(this.onCompleted), this.onErrorOccurred && r.onErrorOccurred.removeListener(this.onErrorOccurred), this.onBeforeRequest = null, this.onCompleted = null, this.onErrorOccurred = null, this.inFlight.clear(), oe.debug("networkTracker_disposed", { tabId: this.tabId }));
4604
+ r && (this.onBeforeRequest && r.onBeforeRequest.removeListener(this.onBeforeRequest), this.onCompleted && r.onCompleted.removeListener(this.onCompleted), this.onErrorOccurred && r.onErrorOccurred.removeListener(this.onErrorOccurred), this.onBeforeRequest = null, this.onCompleted = null, this.onErrorOccurred = null, this.inFlight.clear(), ie.debug("networkTracker_disposed", { tabId: this.tabId }));
4255
4605
  }
4256
4606
  }
4257
- async function te(e) {
4607
+ async function re(e) {
4258
4608
  const r = await it();
4259
- return r === null && yr(nr(e)), r;
4609
+ return r === null && _r(ar(e)), r;
4260
4610
  }
4261
4611
  p({
4262
4612
  action: "page_url",
4263
4613
  namespace: "page",
4264
4614
  name: "url",
4265
4615
  description: "Get the URL of the active tab",
4266
- params: un,
4616
+ params: mn,
4267
4617
  returns: t.string(),
4268
4618
  owner: "main-thread",
4269
4619
  handler: async (e, r) => {
4270
- const n = await te("page.url()");
4271
- return S(
4272
- await C("chrome_tabs_get", [n])
4620
+ const n = await re("page.url()");
4621
+ return v(
4622
+ await T("chrome_tabs_get", [n])
4273
4623
  ).url ?? "";
4274
4624
  },
4275
4625
  paramTypes: [],
@@ -4282,13 +4632,13 @@ p({
4282
4632
  namespace: "page",
4283
4633
  name: "title",
4284
4634
  description: "Get the title of the active tab",
4285
- params: mn,
4635
+ params: pn,
4286
4636
  returns: t.string(),
4287
4637
  owner: "main-thread",
4288
4638
  handler: async (e, r) => {
4289
- const n = await te("page.title()");
4290
- return S(
4291
- await C("chrome_tabs_get", [n])
4639
+ const n = await re("page.title()");
4640
+ return v(
4641
+ await T("chrome_tabs_get", [n])
4292
4642
  ).title ?? "";
4293
4643
  },
4294
4644
  paramTypes: [],
@@ -4296,22 +4646,22 @@ p({
4296
4646
  errorCode: "E_NO_TAB",
4297
4647
  example: "page.title()"
4298
4648
  });
4299
- for (const e of Ft.filter(
4649
+ for (const e of Gt.filter(
4300
4650
  (r) => r.namespace === "page"
4301
4651
  ))
4302
- Gt(e);
4652
+ Bt(e);
4303
4653
  p({
4304
4654
  action: "page_goto",
4305
4655
  namespace: "page",
4306
4656
  name: "goto",
4307
4657
  description: "Navigate the active tab to a URL",
4308
- params: pn,
4658
+ params: bn,
4309
4659
  returns: O,
4310
4660
  fields: ["url"],
4311
4661
  owner: "main-thread",
4312
4662
  handler: async (e, r) => {
4313
- var v, g, x, D;
4314
- const n = await te("page.goto()"), a = r.runId ?? "?";
4663
+ var S, y, x, N;
4664
+ const n = await re("page.goto()"), a = r.runId ?? "?";
4315
4665
  if (h.debug("page_goto_start", {
4316
4666
  traceId: a,
4317
4667
  url: e.url,
@@ -4323,7 +4673,7 @@ p({
4323
4673
  "E_NAVIGATION",
4324
4674
  "navigation"
4325
4675
  );
4326
- const o = await C("chrome_tabs_get", [n]), i = o.ok && o.value ? o.value.url : void 0;
4676
+ const o = await T("chrome_tabs_get", [n]), i = o.ok && o.value ? o.value.url : void 0;
4327
4677
  if (i && (i.startsWith("chrome-extension://") || i.startsWith("chrome://")))
4328
4678
  throw I(
4329
4679
  `Refusing to navigate the active tab (${i}) — it is a chrome-extension:// or chrome:// page. Use web.tab.list() to find an http(s) tab, then web.tab.activate(tabId) before calling page.goto().`,
@@ -4335,26 +4685,26 @@ p({
4335
4685
  const l = (A, E) => {
4336
4686
  A === n && E.status === "loading" && (c = !0);
4337
4687
  }, u = Number(e.timeout) || _e;
4338
- (g = (v = s == null ? void 0 : s.tabs) == null ? void 0 : v.onUpdated) == null || g.addListener(l);
4688
+ (y = (S = s == null ? void 0 : s.tabs) == null ? void 0 : S.onUpdated) == null || y.addListener(l);
4339
4689
  try {
4340
- const A = await C("chrome_tabs_update", [
4690
+ const A = await T("chrome_tabs_update", [
4341
4691
  n,
4342
4692
  { url: e.url }
4343
4693
  ]);
4344
4694
  if (!A.ok)
4345
- return S(A);
4346
- const E = await Lt(n, u, {
4695
+ return v(A);
4696
+ const E = await Ft(n, u, {
4347
4697
  preNavigationUrl: i,
4348
4698
  getNavSawLoading: () => c,
4349
4699
  runId: a
4350
4700
  });
4351
4701
  if (!E.ok)
4352
- return S(E);
4702
+ return v(E);
4353
4703
  h.debug("page_goto_tab_load_complete", { traceId: a });
4354
4704
  } finally {
4355
- (D = (x = s == null ? void 0 : s.tabs) == null ? void 0 : x.onUpdated) == null || D.removeListener(l);
4705
+ (N = (x = s == null ? void 0 : s.tabs) == null ? void 0 : x.onUpdated) == null || N.removeListener(l);
4356
4706
  }
4357
- const m = await C("chrome_tabs_get", [n]);
4707
+ const m = await T("chrome_tabs_get", [n]);
4358
4708
  if (m.ok && m.value) {
4359
4709
  const A = m.value, E = A.url ?? "";
4360
4710
  if (E && !E.startsWith("http:") && !E.startsWith("https:"))
@@ -4371,7 +4721,7 @@ p({
4371
4721
  );
4372
4722
  }
4373
4723
  if (e.waitUntil === "networkidle") {
4374
- const A = new oo(n);
4724
+ const A = new ho(n);
4375
4725
  try {
4376
4726
  h.debug("page_goto_network_idle_start", { traceId: a }), A.start();
4377
4727
  const E = Math.max(_t * 2, u);
@@ -4389,14 +4739,14 @@ p({
4389
4739
  A.dispose(), h.debug("page_goto_network_idle_done", { traceId: a });
4390
4740
  }
4391
4741
  }
4392
- const f = await Fe(n, u);
4742
+ const f = await We(n, u);
4393
4743
  if (!f.ok)
4394
- return S(f);
4744
+ return v(f);
4395
4745
  await new Promise(
4396
4746
  (A) => setTimeout(A, Sr)
4397
4747
  );
4398
- const b = await C("chrome_tabs_get", [n]);
4399
- return S(b);
4748
+ const b = await T("chrome_tabs_get", [n]);
4749
+ return v(b);
4400
4750
  },
4401
4751
  paramTypes: [
4402
4752
  {
@@ -4422,13 +4772,13 @@ p({
4422
4772
  namespace: "page",
4423
4773
  name: "health",
4424
4774
  description: "Report tab readiness for mutations vs read-only snapshot APIs",
4425
- params: qa,
4426
- returns: Ma,
4775
+ params: Wa,
4776
+ returns: Ga,
4427
4777
  owner: "main-thread",
4428
4778
  handler: async (e, r) => {
4429
- const n = await te("page.health()"), a = S(
4430
- await C("chrome_tabs_get", [n])
4431
- ), o = a.url ?? "", i = a.title ?? "", s = await Ut(n), c = s && !s.ok ? "blocked" : "ok", u = (await Fe(n, yt)).ok ? "connected" : "missing", m = c === "ok" && u === "connected", f = {
4779
+ const n = await re("page.health()"), a = v(
4780
+ await T("chrome_tabs_get", [n])
4781
+ ), o = a.url ?? "", i = a.title ?? "", s = await Lt(n), c = s && !s.ok ? "blocked" : "ok", u = (await We(n, yt)).ok ? "connected" : "missing", m = c === "ok" && u === "connected", f = {
4432
4782
  tabId: n,
4433
4783
  url: o,
4434
4784
  title: i,
@@ -4457,12 +4807,12 @@ p({
4457
4807
  namespace: "page",
4458
4808
  name: "reload",
4459
4809
  description: "Reload the active tab",
4460
- params: fn,
4810
+ params: gn,
4461
4811
  returns: t.null(),
4462
4812
  owner: "main-thread",
4463
4813
  handler: async (e, r) => {
4464
- const n = await te("page.reload()");
4465
- return S(await C("chrome_tabs_reload", [n]));
4814
+ const n = await re("page.reload()");
4815
+ return v(await T("chrome_tabs_reload", [n]));
4466
4816
  },
4467
4817
  paramTypes: [],
4468
4818
  returnDoc: "null",
@@ -4474,7 +4824,7 @@ p({
4474
4824
  namespace: "page",
4475
4825
  name: "wait",
4476
4826
  description: "Wait for a duration",
4477
- params: gn,
4827
+ params: yn,
4478
4828
  returns: t.boolean(),
4479
4829
  fields: ["duration"],
4480
4830
  owner: "main-thread",
@@ -4498,14 +4848,14 @@ p({
4498
4848
  namespace: "page",
4499
4849
  name: "close",
4500
4850
  description: "Close a tab",
4501
- params: Pn,
4851
+ params: Fn,
4502
4852
  returns: t.null(),
4503
4853
  owner: "main-thread",
4504
4854
  handler: async (e, r) => {
4505
4855
  const n = typeof e == "number" ? e : Y(e);
4506
4856
  if (n === null)
4507
4857
  throw I("page_close requires a tabId", "E_MISSING_PARAM");
4508
- return S(await C("chrome_tabs_remove", [n]));
4858
+ return v(await T("chrome_tabs_remove", [n]));
4509
4859
  },
4510
4860
  paramTypes: [
4511
4861
  {
@@ -4525,10 +4875,10 @@ p({
4525
4875
  name: "tabs",
4526
4876
  description: "Query tabs",
4527
4877
  params: Ue,
4528
- returns: ee,
4878
+ returns: te,
4529
4879
  owner: "main-thread",
4530
4880
  handler: async (e, r) => {
4531
- const n = S(await C("chrome_tabs_query", [e]));
4881
+ const n = v(await T("chrome_tabs_query", [e]));
4532
4882
  return (Array.isArray(n) ? n : []).map((a) => ({
4533
4883
  ...a,
4534
4884
  tabId: a == null ? void 0 : a.id
@@ -4559,8 +4909,8 @@ p({
4559
4909
  const n = typeof e == "number" ? e : Y(e);
4560
4910
  if (n === null)
4561
4911
  throw I("page_switch requires a tabId", "E_MISSING_PARAM");
4562
- return S(
4563
- await C("chrome_tabs_update", [n, { active: !0 }])
4912
+ return v(
4913
+ await T("chrome_tabs_update", [n, { active: !0 }])
4564
4914
  );
4565
4915
  },
4566
4916
  paramTypes: [
@@ -4580,11 +4930,11 @@ p({
4580
4930
  namespace: "page",
4581
4931
  name: "new_tab",
4582
4932
  description: "Open a new tab",
4583
- params: Tt,
4933
+ params: Ct,
4584
4934
  returns: O,
4585
4935
  fields: ["url"],
4586
4936
  owner: "main-thread",
4587
- handler: async (e, r) => S(await C("chrome_tabs_create", [e])),
4937
+ handler: async (e, r) => v(await T("chrome_tabs_create", [e])),
4588
4938
  paramTypes: [
4589
4939
  {
4590
4940
  name: "url",
@@ -4609,12 +4959,12 @@ p({
4609
4959
  namespace: "page",
4610
4960
  name: "active_tab",
4611
4961
  description: "Get the active tab",
4612
- params: jn,
4962
+ params: Wn,
4613
4963
  returns: O,
4614
4964
  owner: "main-thread",
4615
4965
  handler: async (e, r) => {
4616
- const n = await te("page.active_tab()"), a = S(
4617
- await C("chrome_tabs_get", [n])
4966
+ const n = await re("page.active_tab()"), a = v(
4967
+ await T("chrome_tabs_get", [n])
4618
4968
  );
4619
4969
  return { ...a, tabId: typeof a.id == "number" ? a.id : n };
4620
4970
  },
@@ -4623,7 +4973,7 @@ p({
4623
4973
  errorCode: "E_NO_TAB",
4624
4974
  example: "page.active_tab()"
4625
4975
  });
4626
- function $(e) {
4976
+ function K(e) {
4627
4977
  var a, o, i;
4628
4978
  const r = e.toLowerCase().trim();
4629
4979
  if (!r) return null;
@@ -4645,7 +4995,7 @@ function $(e) {
4645
4995
  }
4646
4996
  return null;
4647
4997
  }
4648
- function io(e) {
4998
+ function fo(e) {
4649
4999
  var o;
4650
5000
  const r = e.toLowerCase().trim();
4651
5001
  if (!r) return [];
@@ -4666,7 +5016,7 @@ function io(e) {
4666
5016
  }
4667
5017
  return a;
4668
5018
  }
4669
- function so(e) {
5019
+ function go(e) {
4670
5020
  const r = document.querySelector(
4671
5021
  `[data-ref-id='${CSS.escape(e)}']`
4672
5022
  );
@@ -4690,36 +5040,36 @@ function so(e) {
4690
5040
  }
4691
5041
  return i;
4692
5042
  }
4693
- function K(e, r, n = !1) {
5043
+ function V(e, r, n = !1) {
4694
5044
  if (e) {
4695
- const a = n ? so(e) : [];
4696
- Se(ar(e, { candidates: a }));
5045
+ const a = n ? go(e) : [];
5046
+ ve(or(e, { candidates: a }));
4697
5047
  }
4698
5048
  if (r) {
4699
- const a = n ? io(r) : [];
4700
- Se(ir(r, a));
5049
+ const a = n ? fo(r) : [];
5050
+ ve(sr(r, a));
4701
5051
  }
4702
- Se({
5052
+ ve({
4703
5053
  message: "Element not found",
4704
5054
  code: "E_NOT_FOUND",
4705
5055
  category: "resource"
4706
5056
  });
4707
5057
  }
4708
- const co = /* @__PURE__ */ new Map([
5058
+ const yo = /* @__PURE__ */ new Map([
4709
5059
  [
4710
5060
  "sidepanel_click",
4711
5061
  (e, r) => {
4712
5062
  const n = typeof r.label == "string" ? r.label : "";
4713
- let a = e ? B(e) : null;
4714
- return !a && n && (a = $(n)), a || K(e, n, !1), a.click(), null;
5063
+ let a = e ? $(e) : null;
5064
+ return !a && n && (a = K(n)), a || V(e, n, !1), a.click(), null;
4715
5065
  }
4716
5066
  ],
4717
5067
  [
4718
5068
  "sidepanel_dblclick",
4719
5069
  (e, r) => {
4720
5070
  const n = typeof r.label == "string" ? r.label : "";
4721
- let a = e ? B(e) : null;
4722
- !a && n && (a = $(n)), a || K(e, n, !1);
5071
+ let a = e ? $(e) : null;
5072
+ !a && n && (a = K(n)), a || V(e, n, !1);
4723
5073
  const o = new MouseEvent("dblclick", { bubbles: !0 });
4724
5074
  return a.dispatchEvent(o), null;
4725
5075
  }
@@ -4728,8 +5078,8 @@ const co = /* @__PURE__ */ new Map([
4728
5078
  "sidepanel_fill",
4729
5079
  (e, r) => {
4730
5080
  const n = typeof r.label == "string" ? r.label : "";
4731
- let a = e ? B(e) : null;
4732
- !a && n && (a = $(n)), a || K(e, n, !1);
5081
+ let a = e ? $(e) : null;
5082
+ !a && n && (a = K(n)), a || V(e, n, !1);
4733
5083
  const o = r.value ?? "";
4734
5084
  return "value" in a && (a.value = String(o)), null;
4735
5085
  }
@@ -4738,8 +5088,8 @@ const co = /* @__PURE__ */ new Map([
4738
5088
  "sidepanel_type",
4739
5089
  (e, r) => {
4740
5090
  const n = typeof r.label == "string" ? r.label : "";
4741
- let a = e ? B(e) : null;
4742
- !a && n && (a = $(n)), a || K(e, n, !1);
5091
+ let a = e ? $(e) : null;
5092
+ !a && n && (a = K(n)), a || V(e, n, !1);
4743
5093
  const o = r.text ?? "";
4744
5094
  if ("value" in a) {
4745
5095
  const i = a;
@@ -4752,8 +5102,8 @@ const co = /* @__PURE__ */ new Map([
4752
5102
  "sidepanel_append",
4753
5103
  (e, r) => {
4754
5104
  const n = typeof r.label == "string" ? r.label : "";
4755
- let a = e ? B(e) : null;
4756
- !a && n && (a = $(n)), a || K(e, n, !1);
5105
+ let a = e ? $(e) : null;
5106
+ !a && n && (a = K(n)), a || V(e, n, !1);
4757
5107
  const o = r.text ?? "";
4758
5108
  if ("value" in a) {
4759
5109
  const i = a;
@@ -4783,8 +5133,8 @@ const co = /* @__PURE__ */ new Map([
4783
5133
  "sidepanel_select",
4784
5134
  (e, r) => {
4785
5135
  const n = typeof r.label == "string" ? r.label : "";
4786
- let a = e ? B(e) : null;
4787
- !a && n && (a = $(n)), a || K(e, n, !1);
5136
+ let a = e ? $(e) : null;
5137
+ !a && n && (a = K(n)), a || V(e, n, !1);
4788
5138
  const o = r.value ?? "";
4789
5139
  if ("value" in a) {
4790
5140
  const i = a;
@@ -4797,8 +5147,8 @@ const co = /* @__PURE__ */ new Map([
4797
5147
  "sidepanel_check",
4798
5148
  (e, r) => {
4799
5149
  const n = typeof r.label == "string" ? r.label : "";
4800
- let a = e ? B(e) : null;
4801
- !a && n && (a = $(n)), a || K(e, n, !1);
5150
+ let a = e ? $(e) : null;
5151
+ !a && n && (a = K(n)), a || V(e, n, !1);
4802
5152
  const o = typeof r.checked == "boolean" ? r.checked : !0;
4803
5153
  if ("checked" in a) {
4804
5154
  const i = a;
@@ -4811,8 +5161,8 @@ const co = /* @__PURE__ */ new Map([
4811
5161
  "sidepanel_hover",
4812
5162
  (e, r) => {
4813
5163
  const n = typeof r.label == "string" ? r.label : "";
4814
- let a = e ? B(e) : null;
4815
- !a && n && (a = $(n)), a || K(e, n, !1);
5164
+ let a = e ? $(e) : null;
5165
+ !a && n && (a = K(n)), a || V(e, n, !1);
4816
5166
  const o = new MouseEvent("mouseenter", { bubbles: !0 });
4817
5167
  return a.dispatchEvent(o), null;
4818
5168
  }
@@ -4840,15 +5190,15 @@ const co = /* @__PURE__ */ new Map([
4840
5190
  "sidepanel_scroll_to",
4841
5191
  (e, r) => {
4842
5192
  const n = typeof r.label == "string" ? r.label : "";
4843
- let a = e ? B(e) : null;
4844
- return !a && n && (a = $(n)), a || K(e, n, !1), a.scrollIntoView({ behavior: "smooth", block: "center" }), null;
5193
+ let a = e ? $(e) : null;
5194
+ return !a && n && (a = K(n)), a || V(e, n, !1), a.scrollIntoView({ behavior: "smooth", block: "center" }), null;
4845
5195
  }
4846
5196
  ]
4847
5197
  ]);
4848
- function j(e, r) {
4849
- const n = h.child("runner"), a = eo(r);
5198
+ function H(e, r) {
5199
+ const n = h.child("runner"), a = lo(r);
4850
5200
  n.debug("dispatchSidepanelEvent_start", { action: e, refId: a });
4851
- const o = F(r), i = co.get(e);
5201
+ const o = G(r), i = yo.get(e);
4852
5202
  if (!i)
4853
5203
  throw n.error("dispatchSidepanelEvent_no_handler", { action: e }), I(`Unknown sidepanel action: ${e}`, "E_UNKNOWN");
4854
5204
  return i(a, o);
@@ -4858,10 +5208,10 @@ p({
4858
5208
  namespace: "sidepanel",
4859
5209
  name: "click",
4860
5210
  description: "Click an element in the sidepanel",
4861
- params: ia,
5211
+ params: ba,
4862
5212
  returns: t.null(),
4863
5213
  owner: "main-thread",
4864
- handler: async (e, r) => j("sidepanel_click", e),
5214
+ handler: async (e, r) => H("sidepanel_click", e),
4865
5215
  paramTypes: [
4866
5216
  {
4867
5217
  name: "refId",
@@ -4885,10 +5235,10 @@ p({
4885
5235
  namespace: "sidepanel",
4886
5236
  name: "dblclick",
4887
5237
  description: "Double-click an element in the sidepanel",
4888
- params: sa,
5238
+ params: ha,
4889
5239
  returns: t.null(),
4890
5240
  owner: "main-thread",
4891
- handler: async (e, r) => j("sidepanel_dblclick", e),
5241
+ handler: async (e, r) => H("sidepanel_dblclick", e),
4892
5242
  paramTypes: [
4893
5243
  {
4894
5244
  name: "refId",
@@ -4912,10 +5262,10 @@ p({
4912
5262
  namespace: "sidepanel",
4913
5263
  name: "fill",
4914
5264
  description: "Fill an element in the sidepanel",
4915
- params: ca,
5265
+ params: fa,
4916
5266
  returns: t.null(),
4917
5267
  owner: "main-thread",
4918
- handler: async (e, r) => j("sidepanel_fill", e),
5268
+ handler: async (e, r) => H("sidepanel_fill", e),
4919
5269
  paramTypes: [
4920
5270
  {
4921
5271
  name: "refId",
@@ -4945,10 +5295,10 @@ p({
4945
5295
  namespace: "sidepanel",
4946
5296
  name: "type",
4947
5297
  description: "Type into an element in the sidepanel",
4948
- params: la,
5298
+ params: ga,
4949
5299
  returns: t.null(),
4950
5300
  owner: "main-thread",
4951
- handler: async (e, r) => j("sidepanel_type", e),
5301
+ handler: async (e, r) => H("sidepanel_type", e),
4952
5302
  paramTypes: [
4953
5303
  {
4954
5304
  name: "refId",
@@ -4978,11 +5328,11 @@ p({
4978
5328
  namespace: "sidepanel",
4979
5329
  name: "press",
4980
5330
  description: "Press a key in the sidepanel",
4981
- params: da,
5331
+ params: ya,
4982
5332
  returns: t.null(),
4983
5333
  fields: ["key"],
4984
5334
  owner: "main-thread",
4985
- handler: async (e, r) => j("sidepanel_press", e),
5335
+ handler: async (e, r) => H("sidepanel_press", e),
4986
5336
  paramTypes: [
4987
5337
  {
4988
5338
  name: "key",
@@ -5000,10 +5350,10 @@ p({
5000
5350
  namespace: "sidepanel",
5001
5351
  name: "select",
5002
5352
  description: "Select an option in the sidepanel",
5003
- params: ua,
5353
+ params: _a,
5004
5354
  returns: t.null(),
5005
5355
  owner: "main-thread",
5006
- handler: async (e, r) => j("sidepanel_select", e),
5356
+ handler: async (e, r) => H("sidepanel_select", e),
5007
5357
  paramTypes: [
5008
5358
  {
5009
5359
  name: "refId",
@@ -5033,10 +5383,10 @@ p({
5033
5383
  namespace: "sidepanel",
5034
5384
  name: "check",
5035
5385
  description: "Check/uncheck an element in the sidepanel",
5036
- params: ma,
5386
+ params: wa,
5037
5387
  returns: t.null(),
5038
5388
  owner: "main-thread",
5039
- handler: async (e, r) => j("sidepanel_check", e),
5389
+ handler: async (e, r) => H("sidepanel_check", e),
5040
5390
  paramTypes: [
5041
5391
  {
5042
5392
  name: "refId",
@@ -5066,10 +5416,10 @@ p({
5066
5416
  namespace: "sidepanel",
5067
5417
  name: "hover",
5068
5418
  description: "Hover over an element in the sidepanel",
5069
- params: pa,
5419
+ params: ka,
5070
5420
  returns: t.null(),
5071
5421
  owner: "main-thread",
5072
- handler: async (e, r) => j("sidepanel_hover", e),
5422
+ handler: async (e, r) => H("sidepanel_hover", e),
5073
5423
  paramTypes: [
5074
5424
  {
5075
5425
  name: "refId",
@@ -5093,10 +5443,10 @@ p({
5093
5443
  namespace: "sidepanel",
5094
5444
  name: "unhover",
5095
5445
  description: "Unhover in the sidepanel",
5096
- params: ba,
5446
+ params: Ea,
5097
5447
  returns: t.null(),
5098
5448
  owner: "main-thread",
5099
- handler: async (e, r) => j("sidepanel_unhover", e),
5449
+ handler: async (e, r) => H("sidepanel_unhover", e),
5100
5450
  paramTypes: [],
5101
5451
  returnDoc: "null",
5102
5452
  errorCode: "E_UNKNOWN",
@@ -5107,10 +5457,10 @@ p({
5107
5457
  namespace: "sidepanel",
5108
5458
  name: "scroll",
5109
5459
  description: "Scroll the sidepanel",
5110
- params: ha,
5460
+ params: Ia,
5111
5461
  returns: t.null(),
5112
5462
  owner: "main-thread",
5113
- handler: async (e, r) => j("sidepanel_scroll", e),
5463
+ handler: async (e, r) => H("sidepanel_scroll", e),
5114
5464
  paramTypes: [
5115
5465
  {
5116
5466
  name: "direction",
@@ -5134,10 +5484,10 @@ p({
5134
5484
  namespace: "sidepanel",
5135
5485
  name: "scroll_to",
5136
5486
  description: "Scroll to an element in the sidepanel",
5137
- params: fa,
5487
+ params: va,
5138
5488
  returns: t.null(),
5139
5489
  owner: "main-thread",
5140
- handler: async (e, r) => j("sidepanel_scroll_to", e),
5490
+ handler: async (e, r) => H("sidepanel_scroll_to", e),
5141
5491
  paramTypes: [
5142
5492
  {
5143
5493
  name: "refId",
@@ -5161,10 +5511,10 @@ p({
5161
5511
  namespace: "sidepanel",
5162
5512
  name: "append",
5163
5513
  description: "Append text to an element in the sidepanel",
5164
- params: ga,
5514
+ params: Sa,
5165
5515
  returns: t.null(),
5166
5516
  owner: "main-thread",
5167
- handler: async (e, r) => j("sidepanel_append", e),
5517
+ handler: async (e, r) => H("sidepanel_append", e),
5168
5518
  paramTypes: [
5169
5519
  {
5170
5520
  name: "refId",
@@ -5194,7 +5544,7 @@ p({
5194
5544
  namespace: "sidepanel",
5195
5545
  name: "url",
5196
5546
  description: "Get the sidepanel URL",
5197
- params: ya,
5547
+ params: xa,
5198
5548
  returns: t.string(),
5199
5549
  owner: "main-thread",
5200
5550
  handler: async (e, r) => window.location.href,
@@ -5208,7 +5558,7 @@ p({
5208
5558
  namespace: "sidepanel",
5209
5559
  name: "title",
5210
5560
  description: "Get the sidepanel title",
5211
- params: _a,
5561
+ params: Ta,
5212
5562
  returns: t.string(),
5213
5563
  owner: "main-thread",
5214
5564
  handler: async (e, r) => document.title,
@@ -5222,7 +5572,7 @@ p({
5222
5572
  namespace: "sidepanel",
5223
5573
  name: "wait",
5224
5574
  description: "Wait in the sidepanel",
5225
- params: wa,
5575
+ params: Ca,
5226
5576
  returns: t.boolean(),
5227
5577
  fields: ["duration"],
5228
5578
  owner: "main-thread",
@@ -5246,7 +5596,7 @@ p({
5246
5596
  namespace: "sidepanel",
5247
5597
  name: "snapshot",
5248
5598
  description: "Capture sidepanel DOM snapshot",
5249
- params: ka,
5599
+ params: Ra,
5250
5600
  returns: t.string(),
5251
5601
  owner: "main-thread",
5252
5602
  handler: async (e, r) => {
@@ -5284,7 +5634,7 @@ p({
5284
5634
  namespace: "sidepanel",
5285
5635
  name: "snapshot_text",
5286
5636
  description: "Capture sidepanel DOM snapshot and return text representation",
5287
- params: Ea,
5637
+ params: Aa,
5288
5638
  returns: t.string(),
5289
5639
  owner: "main-thread",
5290
5640
  handler: async (e, r) => {
@@ -5322,8 +5672,8 @@ p({
5322
5672
  namespace: "sidepanel",
5323
5673
  name: "snapshot_data",
5324
5674
  description: "Get sidepanel snapshot data",
5325
- params: Ia,
5326
- returns: Ot,
5675
+ params: Da,
5676
+ returns: qt,
5327
5677
  owner: "main-thread",
5328
5678
  handler: async (e, r) => {
5329
5679
  const n = await Ee(e);
@@ -5333,7 +5683,7 @@ p({
5333
5683
  n.error.code,
5334
5684
  n.error.category
5335
5685
  );
5336
- return S(n);
5686
+ return v(n);
5337
5687
  },
5338
5688
  paramTypes: [
5339
5689
  {
@@ -5358,8 +5708,8 @@ p({
5358
5708
  namespace: "dom",
5359
5709
  name: "snapshot",
5360
5710
  description: "Take a DOM snapshot",
5361
- params: Sa,
5362
- returns: Ot,
5711
+ params: Na,
5712
+ returns: qt,
5363
5713
  owner: "main-thread",
5364
5714
  handler: async (e, r) => {
5365
5715
  const n = await Ee(e);
@@ -5369,7 +5719,7 @@ p({
5369
5719
  n.error.code,
5370
5720
  n.error.category
5371
5721
  );
5372
- return S(n);
5722
+ return v(n);
5373
5723
  },
5374
5724
  paramTypes: [
5375
5725
  {
@@ -5394,10 +5744,10 @@ p({
5394
5744
  namespace: "dom",
5395
5745
  name: "format",
5396
5746
  description: "Format a DOM snapshot",
5397
- params: va,
5747
+ params: qa,
5398
5748
  returns: t.string(),
5399
5749
  owner: "main-thread",
5400
- handler: async (e, r) => S(await Wr(e)),
5750
+ handler: async (e, r) => v(await Wr(e)),
5401
5751
  paramTypes: [
5402
5752
  {
5403
5753
  name: "snapshot",
@@ -5422,11 +5772,11 @@ p({
5422
5772
  name: "query",
5423
5773
  description: "Query tabs",
5424
5774
  params: Ue,
5425
- returns: ee,
5775
+ returns: te,
5426
5776
  owner: "main-thread",
5427
5777
  handler: async (e, r) => {
5428
- const n = S(
5429
- await C("chrome_tabs_query", [e])
5778
+ const n = v(
5779
+ await T("chrome_tabs_query", [e])
5430
5780
  );
5431
5781
  if (n == null) return [];
5432
5782
  if (!Array.isArray(n))
@@ -5463,8 +5813,8 @@ p({
5463
5813
  const n = await it();
5464
5814
  if (n === null)
5465
5815
  throw new Error("No active tab available");
5466
- const a = S(
5467
- await C("chrome_tabs_get", [n])
5816
+ const a = v(
5817
+ await T("chrome_tabs_get", [n])
5468
5818
  );
5469
5819
  return { ...a, tabId: typeof a.id == "number" ? a.id : n };
5470
5820
  },
@@ -5479,14 +5829,14 @@ p({
5479
5829
  namespace: "web.tab",
5480
5830
  name: "get",
5481
5831
  description: "Get a tab by id",
5482
- params: Na,
5832
+ params: Ua,
5483
5833
  returns: O,
5484
5834
  fields: ["tabId"],
5485
5835
  aliases: [{ namespace: "tab", name: "get", fields: ["tabId"] }],
5486
5836
  owner: "main-thread",
5487
5837
  handler: async (e, r) => {
5488
- const n = Y(F(e));
5489
- return S(await C("chrome_tabs_get", [n]));
5838
+ const n = Y(G(e));
5839
+ return v(await T("chrome_tabs_get", [n]));
5490
5840
  },
5491
5841
  paramTypes: [
5492
5842
  {
@@ -5507,10 +5857,10 @@ p({
5507
5857
  name: "find",
5508
5858
  description: "Find tabs matching a query",
5509
5859
  params: Ue,
5510
- returns: ee,
5860
+ returns: te,
5511
5861
  aliases: [{ namespace: "tab", name: "find" }],
5512
5862
  owner: "main-thread",
5513
- handler: async (e, r) => S(await C("chrome_tabs_query", [e])),
5863
+ handler: async (e, r) => v(await T("chrome_tabs_query", [e])),
5514
5864
  paramTypes: [
5515
5865
  {
5516
5866
  name: "query",
@@ -5530,10 +5880,10 @@ p({
5530
5880
  name: "list",
5531
5881
  description: "List all tabs",
5532
5882
  params: t.object({}),
5533
- returns: ee,
5883
+ returns: te,
5534
5884
  aliases: [{ namespace: "tab", name: "list" }],
5535
5885
  owner: "main-thread",
5536
- handler: async (e, r) => S(await C("chrome_tabs_query", [{}])),
5886
+ handler: async (e, r) => v(await T("chrome_tabs_query", [{}])),
5537
5887
  paramTypes: [],
5538
5888
  returnDoc: "All tabs",
5539
5889
  errorCode: "ECHROME",
@@ -5545,12 +5895,12 @@ p({
5545
5895
  namespace: "web.tab",
5546
5896
  name: "create",
5547
5897
  description: "Create a tab",
5548
- params: Tt,
5898
+ params: Ct,
5549
5899
  returns: O,
5550
5900
  fields: ["url"],
5551
5901
  aliases: [{ namespace: "tab", name: "create", fields: ["url"] }],
5552
5902
  owner: "main-thread",
5553
- handler: async (e, r) => S(await C("chrome_tabs_create", [e])),
5903
+ handler: async (e, r) => v(await T("chrome_tabs_create", [e])),
5554
5904
  paramTypes: [
5555
5905
  {
5556
5906
  name: "url",
@@ -5582,8 +5932,8 @@ p({
5582
5932
  const n = typeof e == "number" ? e : Y(e);
5583
5933
  if (n === null)
5584
5934
  throw I("tab_activate requires a tabId", "E_MISSING_PARAM");
5585
- return S(
5586
- await C("chrome_tabs_update", [n, { active: !0 }])
5935
+ return v(
5936
+ await T("chrome_tabs_update", [n, { active: !0 }])
5587
5937
  );
5588
5938
  },
5589
5939
  paramTypes: [
@@ -5603,14 +5953,14 @@ p({
5603
5953
  namespace: "web.tab",
5604
5954
  name: "close",
5605
5955
  description: "Close a tab",
5606
- params: Un,
5956
+ params: Bn,
5607
5957
  returns: t.null(),
5608
5958
  owner: "main-thread",
5609
5959
  handler: async (e, r) => {
5610
5960
  const n = typeof e == "number" ? e : Y(e);
5611
5961
  if (n === null)
5612
5962
  throw I("tab_close requires a tabId", "E_MISSING_PARAM");
5613
- return S(await C("chrome_tabs_remove", [n]));
5963
+ return v(await T("chrome_tabs_remove", [n]));
5614
5964
  },
5615
5965
  paramTypes: [
5616
5966
  {
@@ -5624,21 +5974,21 @@ p({
5624
5974
  errorCode: "E_MISSING_PARAM",
5625
5975
  example: "web.tab.close(123)"
5626
5976
  });
5627
- for (const e of Ft.filter(
5977
+ for (const e of Gt.filter(
5628
5978
  (r) => r.namespace === "web.tab"
5629
5979
  ))
5630
- Gt(e);
5980
+ Bt(e);
5631
5981
  p({
5632
5982
  action: "tab_wait_for_load",
5633
5983
  namespace: "web.tab",
5634
5984
  name: "wait_for_load",
5635
5985
  description: "Wait for tab to load",
5636
- params: ta,
5986
+ params: la,
5637
5987
  returns: t.boolean(),
5638
5988
  owner: "main-thread",
5639
5989
  handler: async (e, r) => {
5640
- const n = F(e), a = Y(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
5641
- return S(await Lt(a, o));
5990
+ const n = G(e), a = Y(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
5991
+ return v(await Ft(a, o));
5642
5992
  },
5643
5993
  paramTypes: [
5644
5994
  {
@@ -5659,7 +6009,7 @@ p({
5659
6009
  example: "web.tab.wait_for_load({ tabId: 123, timeout: 5000 })"
5660
6010
  });
5661
6011
  const k = t.unknown(), w = t.union([t.null(), t.undefined(), t.boolean()]), Q = w;
5662
- function y(e, r, n, a = k, o, i) {
6012
+ function _(e, r, n, a = k, o, i) {
5663
6013
  d(
5664
6014
  e,
5665
6015
  "chrome",
@@ -5779,7 +6129,7 @@ d(
5779
6129
  "chrome",
5780
6130
  "Clear an alarm",
5781
6131
  ["alarms"],
5782
- Ba,
6132
+ Ya,
5783
6133
  "ECHROME",
5784
6134
  "extension",
5785
6135
  [
@@ -5926,7 +6276,7 @@ d(
5926
6276
  [],
5927
6277
  'chrome.bookmarks.update("bookmarkId", { title: "New Title" })'
5928
6278
  );
5929
- y(
6279
+ _(
5930
6280
  "chrome_browsingData_remove",
5931
6281
  ["browsingData"],
5932
6282
  "Remove browsing data",
@@ -5934,7 +6284,7 @@ y(
5934
6284
  "chrome.browsingData.remove({ since: 0 })",
5935
6285
  "null"
5936
6286
  );
5937
- y(
6287
+ _(
5938
6288
  "chrome_browsingData_removeCache",
5939
6289
  ["browsingData"],
5940
6290
  "Remove cache",
@@ -5942,7 +6292,7 @@ y(
5942
6292
  "chrome.browsingData.removeCache({ since: 0 })",
5943
6293
  "null"
5944
6294
  );
5945
- y(
6295
+ _(
5946
6296
  "chrome_browsingData_removeCookies",
5947
6297
  ["browsingData"],
5948
6298
  "Remove cookies",
@@ -5950,7 +6300,7 @@ y(
5950
6300
  "chrome.browsingData.removeCookies({ since: 0 })",
5951
6301
  "null"
5952
6302
  );
5953
- y(
6303
+ _(
5954
6304
  "chrome_browsingData_removeDownloads",
5955
6305
  ["browsingData"],
5956
6306
  "Remove downloads",
@@ -5958,7 +6308,7 @@ y(
5958
6308
  "chrome.browsingData.removeDownloads({ since: 0 })",
5959
6309
  "null"
5960
6310
  );
5961
- y(
6311
+ _(
5962
6312
  "chrome_browsingData_removeFormData",
5963
6313
  ["browsingData"],
5964
6314
  "Remove form data",
@@ -5966,7 +6316,7 @@ y(
5966
6316
  "chrome.browsingData.removeFormData({ since: 0 })",
5967
6317
  "null"
5968
6318
  );
5969
- y(
6319
+ _(
5970
6320
  "chrome_browsingData_removeHistory",
5971
6321
  ["browsingData"],
5972
6322
  "Remove history",
@@ -5974,7 +6324,7 @@ y(
5974
6324
  "chrome.browsingData.removeHistory({ since: 0 })",
5975
6325
  "null"
5976
6326
  );
5977
- y(
6327
+ _(
5978
6328
  "chrome_browsingData_removePasswords",
5979
6329
  ["browsingData"],
5980
6330
  "Remove passwords",
@@ -5987,7 +6337,7 @@ d(
5987
6337
  "chrome",
5988
6338
  "Create a context menu",
5989
6339
  ["contextMenus"],
5990
- Ga,
6340
+ Ja,
5991
6341
  "ECHROME",
5992
6342
  "extension",
5993
6343
  [],
@@ -6071,13 +6421,13 @@ d(
6071
6421
  "chrome",
6072
6422
  "Get all cookies",
6073
6423
  ["cookies"],
6074
- qt,
6424
+ Mt,
6075
6425
  "ECHROME",
6076
6426
  "extension",
6077
6427
  [],
6078
6428
  'chrome.cookies.getAll({ url: "https://example.com" })'
6079
6429
  );
6080
- y(
6430
+ _(
6081
6431
  "chrome_declarativeNetRequest_getDynamicRules",
6082
6432
  ["declarativeNetRequest"],
6083
6433
  "Get dynamic DNR rules",
@@ -6085,7 +6435,7 @@ y(
6085
6435
  "chrome.declarativeNetRequest.getDynamicRules()",
6086
6436
  "Rule[]"
6087
6437
  );
6088
- y(
6438
+ _(
6089
6439
  "chrome_declarativeNetRequest_getEnabledRulesets",
6090
6440
  ["declarativeNetRequest"],
6091
6441
  "Get enabled DNR rulesets",
@@ -6093,7 +6443,7 @@ y(
6093
6443
  "chrome.declarativeNetRequest.getEnabledRulesets()",
6094
6444
  "RulesetInfo[]"
6095
6445
  );
6096
- y(
6446
+ _(
6097
6447
  "chrome_declarativeNetRequest_getSessionRules",
6098
6448
  ["declarativeNetRequest"],
6099
6449
  "Get session DNR rules",
@@ -6101,7 +6451,7 @@ y(
6101
6451
  "chrome.declarativeNetRequest.getSessionRules()",
6102
6452
  "Rule[]"
6103
6453
  );
6104
- y(
6454
+ _(
6105
6455
  "chrome_declarativeNetRequest_updateDynamicRules",
6106
6456
  ["declarativeNetRequest"],
6107
6457
  "Update dynamic DNR rules",
@@ -6109,7 +6459,7 @@ y(
6109
6459
  "chrome.declarativeNetRequest.updateDynamicRules({ addRules: [] })",
6110
6460
  "null"
6111
6461
  );
6112
- y(
6462
+ _(
6113
6463
  "chrome_declarativeNetRequest_updateEnabledRulesets",
6114
6464
  ["declarativeNetRequest"],
6115
6465
  "Update enabled DNR rulesets",
@@ -6117,7 +6467,7 @@ y(
6117
6467
  "chrome.declarativeNetRequest.updateEnabledRulesets({ enableRulesetIds: [] })",
6118
6468
  "null"
6119
6469
  );
6120
- y(
6470
+ _(
6121
6471
  "chrome_declarativeNetRequest_updateSessionRules",
6122
6472
  ["declarativeNetRequest"],
6123
6473
  "Update session DNR rules",
@@ -6125,7 +6475,7 @@ y(
6125
6475
  "chrome.declarativeNetRequest.updateSessionRules({ addRules: [] })",
6126
6476
  "null"
6127
6477
  );
6128
- y(
6478
+ _(
6129
6479
  "chrome_desktopCapture_chooseDesktopMedia",
6130
6480
  ["desktopCapture"],
6131
6481
  "Choose desktop media",
@@ -6133,7 +6483,7 @@ y(
6133
6483
  'chrome.desktopCapture.chooseDesktopMedia(["screen"], (id) => id)',
6134
6484
  "string"
6135
6485
  );
6136
- y(
6486
+ _(
6137
6487
  "chrome_desktopCapture_cancelChooseDesktopMedia",
6138
6488
  ["desktopCapture"],
6139
6489
  "Cancel desktop media picker",
@@ -6146,7 +6496,7 @@ d(
6146
6496
  "chrome",
6147
6497
  "Download a file",
6148
6498
  ["downloads"],
6149
- Qa,
6499
+ oo,
6150
6500
  "ECHROME",
6151
6501
  "extension",
6152
6502
  [],
@@ -6157,7 +6507,7 @@ d(
6157
6507
  "chrome",
6158
6508
  "Search downloads",
6159
6509
  ["downloads"],
6160
- jt,
6510
+ Ht,
6161
6511
  "ECHROME",
6162
6512
  "extension",
6163
6513
  [],
@@ -6168,7 +6518,7 @@ d(
6168
6518
  "chrome",
6169
6519
  "Erase downloads",
6170
6520
  ["downloads"],
6171
- jt,
6521
+ Ht,
6172
6522
  "ECHROME",
6173
6523
  "extension",
6174
6524
  [],
@@ -6313,7 +6663,7 @@ d(
6313
6663
  [],
6314
6664
  'chrome.history.getVisits({ url: "https://example.com" })'
6315
6665
  );
6316
- y(
6666
+ _(
6317
6667
  "chrome_identity_getAuthToken",
6318
6668
  ["identity"],
6319
6669
  "Get OAuth auth token",
@@ -6321,7 +6671,7 @@ y(
6321
6671
  "chrome.identity.getAuthToken({ interactive: true })",
6322
6672
  "{ accessToken: string }"
6323
6673
  );
6324
- y(
6674
+ _(
6325
6675
  "chrome_identity_getProfileUserInfo",
6326
6676
  ["identity"],
6327
6677
  "Get profile user info",
@@ -6329,7 +6679,7 @@ y(
6329
6679
  "chrome.identity.getProfileUserInfo()",
6330
6680
  "{ email: string, id: string }"
6331
6681
  );
6332
- y(
6682
+ _(
6333
6683
  "chrome_identity_launchWebAuthFlow",
6334
6684
  ["identity"],
6335
6685
  "Launch web auth flow",
@@ -6337,7 +6687,7 @@ y(
6337
6687
  'chrome.identity.launchWebAuthFlow({ url: "https://example.com/auth" })',
6338
6688
  "string"
6339
6689
  );
6340
- y(
6690
+ _(
6341
6691
  "chrome_idle_queryState",
6342
6692
  ["idle"],
6343
6693
  "Query idle state",
@@ -6345,7 +6695,7 @@ y(
6345
6695
  "chrome.idle.queryState(60)",
6346
6696
  '"active" | "idle" | "locked"'
6347
6697
  );
6348
- y(
6698
+ _(
6349
6699
  "chrome_management_get",
6350
6700
  ["management"],
6351
6701
  "Get extension info",
@@ -6353,7 +6703,7 @@ y(
6353
6703
  'chrome.management.get("extensionId")',
6354
6704
  "ExtensionInfo"
6355
6705
  );
6356
- y(
6706
+ _(
6357
6707
  "chrome_management_getAll",
6358
6708
  ["management"],
6359
6709
  "Get all extensions",
@@ -6361,7 +6711,7 @@ y(
6361
6711
  "chrome.management.getAll()",
6362
6712
  "ExtensionInfo[]"
6363
6713
  );
6364
- y(
6714
+ _(
6365
6715
  "chrome_management_setEnabled",
6366
6716
  ["management"],
6367
6717
  "Enable or disable extension",
@@ -6369,7 +6719,7 @@ y(
6369
6719
  'chrome.management.setEnabled("extensionId", true)',
6370
6720
  "null"
6371
6721
  );
6372
- y(
6722
+ _(
6373
6723
  "chrome_management_uninstall",
6374
6724
  ["management"],
6375
6725
  "Uninstall extension",
@@ -6382,7 +6732,7 @@ d(
6382
6732
  "chrome",
6383
6733
  "Create a notification",
6384
6734
  ["notifications"],
6385
- Mt,
6735
+ Pt,
6386
6736
  "ECHROME",
6387
6737
  "extension",
6388
6738
  [
@@ -6406,7 +6756,7 @@ d(
6406
6756
  "chrome",
6407
6757
  "Clear a notification",
6408
6758
  ["notifications"],
6409
- Pt,
6759
+ jt,
6410
6760
  "ECHROME",
6411
6761
  "extension",
6412
6762
  [
@@ -6442,7 +6792,7 @@ d(
6442
6792
  [],
6443
6793
  'chrome.notifications.update("notificationId", { title: "Updated" })'
6444
6794
  );
6445
- y(
6795
+ _(
6446
6796
  "chrome_offscreen_closeDocument",
6447
6797
  ["offscreen"],
6448
6798
  "Close offscreen document",
@@ -6450,7 +6800,7 @@ y(
6450
6800
  "chrome.offscreen.closeDocument()",
6451
6801
  "null"
6452
6802
  );
6453
- y(
6803
+ _(
6454
6804
  "chrome_offscreen_createDocument",
6455
6805
  ["offscreen"],
6456
6806
  "Create offscreen document",
@@ -6458,7 +6808,7 @@ y(
6458
6808
  'chrome.offscreen.createDocument({ url: "offscreen.html", reasons: ["WORKERS"] })',
6459
6809
  "null"
6460
6810
  );
6461
- y(
6811
+ _(
6462
6812
  "chrome_pageCapture_saveAsMHTML",
6463
6813
  ["pageCapture"],
6464
6814
  "Save page as MHTML",
@@ -6466,7 +6816,7 @@ y(
6466
6816
  "chrome.pageCapture.saveAsMHTML({ tabId: 123 })",
6467
6817
  "Blob"
6468
6818
  );
6469
- async function Bt(e, r, n, a) {
6819
+ async function $t(e, r, n, a) {
6470
6820
  var l;
6471
6821
  const o = window.chrome;
6472
6822
  if (!((l = o == null ? void 0 : o.runtime) != null && l.id))
@@ -6481,7 +6831,7 @@ async function Bt(e, r, n, a) {
6481
6831
  ), s = bt(o, r, n), c = await Promise.resolve(pt(s, i));
6482
6832
  return await ct(), c;
6483
6833
  }
6484
- y(
6834
+ _(
6485
6835
  "chrome_permissions_contains",
6486
6836
  ["permissions"],
6487
6837
  "Check permission",
@@ -6489,7 +6839,7 @@ y(
6489
6839
  'chrome.permissions.contains({ permissions: ["tabs"] })',
6490
6840
  "boolean"
6491
6841
  );
6492
- y(
6842
+ _(
6493
6843
  "chrome_permissions_getAll",
6494
6844
  ["permissions"],
6495
6845
  "Get all permissions",
@@ -6506,7 +6856,7 @@ p({
6506
6856
  returns: Q,
6507
6857
  owner: "main-thread",
6508
6858
  returnType: "boolean",
6509
- handler: async (e) => Bt(
6859
+ handler: async (e) => $t(
6510
6860
  "chrome_permissions_remove",
6511
6861
  ["permissions"],
6512
6862
  "remove",
@@ -6526,7 +6876,7 @@ p({
6526
6876
  returns: Q,
6527
6877
  owner: "main-thread",
6528
6878
  returnType: "boolean",
6529
- handler: async (e) => Bt(
6879
+ handler: async (e) => $t(
6530
6880
  "chrome_permissions_request",
6531
6881
  ["permissions"],
6532
6882
  "request",
@@ -6589,7 +6939,7 @@ d(
6589
6939
  "chrome",
6590
6940
  "Execute a script",
6591
6941
  ["scripting"],
6592
- Fa,
6942
+ Xa,
6593
6943
  "ECHROME",
6594
6944
  "extension",
6595
6945
  [],
@@ -6624,7 +6974,7 @@ d(
6624
6974
  "chrome",
6625
6975
  "Get recently closed sessions",
6626
6976
  ["sessions"],
6627
- We,
6977
+ Fe,
6628
6978
  "ECHROME",
6629
6979
  "extension",
6630
6980
  [],
@@ -6635,7 +6985,7 @@ d(
6635
6985
  "chrome",
6636
6986
  "Restore a session",
6637
6987
  ["sessions"],
6638
- We,
6988
+ Fe,
6639
6989
  "ECHROME",
6640
6990
  "extension",
6641
6991
  [
@@ -6653,7 +7003,7 @@ d(
6653
7003
  "chrome",
6654
7004
  "Get synced devices",
6655
7005
  ["sessions"],
6656
- Va,
7006
+ no,
6657
7007
  "ECHROME",
6658
7008
  "extension",
6659
7009
  [],
@@ -6686,7 +7036,7 @@ d(
6686
7036
  "chrome",
6687
7037
  "Get CPU info",
6688
7038
  ["system", "cpu"],
6689
- Xa,
7039
+ io,
6690
7040
  "ECHROME",
6691
7041
  "extension",
6692
7042
  [],
@@ -6697,7 +7047,7 @@ d(
6697
7047
  "chrome",
6698
7048
  "Get memory info",
6699
7049
  ["system", "memory"],
6700
- Ja,
7050
+ so,
6701
7051
  "ECHROME",
6702
7052
  "extension",
6703
7053
  [],
@@ -6708,7 +7058,7 @@ d(
6708
7058
  "chrome",
6709
7059
  "Get storage info",
6710
7060
  ["system", "storage"],
6711
- Ya,
7061
+ co,
6712
7062
  "ECHROME",
6713
7063
  "extension",
6714
7064
  [],
@@ -6719,7 +7069,7 @@ d(
6719
7069
  "chrome",
6720
7070
  "Query tab groups",
6721
7071
  ["tabGroups"],
6722
- $a,
7072
+ eo,
6723
7073
  "ECHROME",
6724
7074
  "extension",
6725
7075
  [],
@@ -6763,7 +7113,7 @@ d(
6763
7113
  "chrome",
6764
7114
  "Query tabs",
6765
7115
  ["tabs"],
6766
- ee,
7116
+ te,
6767
7117
  "ECHROME",
6768
7118
  "extension",
6769
7119
  [],
@@ -6904,7 +7254,7 @@ d(
6904
7254
  [],
6905
7255
  "chrome.tabs.ungroup([1, 2, 3])"
6906
7256
  );
6907
- y(
7257
+ _(
6908
7258
  "chrome_topSites_get",
6909
7259
  ["topSites"],
6910
7260
  "Get top sites",
@@ -6912,7 +7262,7 @@ y(
6912
7262
  "chrome.topSites.get()",
6913
7263
  "MostVisitedURL[]"
6914
7264
  );
6915
- y(
7265
+ _(
6916
7266
  "chrome_tts_getVoices",
6917
7267
  ["tts"],
6918
7268
  "Get TTS voices",
@@ -6920,7 +7270,7 @@ y(
6920
7270
  "chrome.tts.getVoices()",
6921
7271
  "TtsVoice[]"
6922
7272
  );
6923
- y(
7273
+ _(
6924
7274
  "chrome_tts_speak",
6925
7275
  ["tts"],
6926
7276
  "Speak text",
@@ -6928,7 +7278,7 @@ y(
6928
7278
  'chrome.tts.speak("Hello world")',
6929
7279
  "null"
6930
7280
  );
6931
- y(
7281
+ _(
6932
7282
  "chrome_tts_stop",
6933
7283
  ["tts"],
6934
7284
  "Stop TTS",
@@ -6959,7 +7309,7 @@ d(
6959
7309
  "chrome",
6960
7310
  "Get all windows",
6961
7311
  ["windows"],
6962
- Ha,
7312
+ Va,
6963
7313
  "ECHROME",
6964
7314
  "extension",
6965
7315
  [],
@@ -7005,7 +7355,7 @@ d(
7005
7355
  ],
7006
7356
  "chrome.windows.remove(1)"
7007
7357
  );
7008
- function lo(e, r) {
7358
+ function _o(e, r) {
7009
7359
  if (r.length === 1 && typeof r[0] == "string")
7010
7360
  switch (e) {
7011
7361
  case "history_delete":
@@ -7023,7 +7373,7 @@ function lo(e, r) {
7023
7373
  }
7024
7374
  return [...r];
7025
7375
  }
7026
- function U(e, r, n, a, o = [], i) {
7376
+ function F(e, r, n, a, o = [], i) {
7027
7377
  const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", u = l ? `web.${l}` : "web", m = dt(r);
7028
7378
  p({
7029
7379
  action: e,
@@ -7035,13 +7385,13 @@ function U(e, r, n, a, o = [], i) {
7035
7385
  owner: "main-thread",
7036
7386
  permission: m ?? void 0,
7037
7387
  handler: async (f, b) => {
7038
- const v = h.child("alias");
7039
- qe(e, m);
7040
- const g = lo(
7388
+ const S = h.child("alias");
7389
+ Oe(e, m);
7390
+ const y = _o(
7041
7391
  e,
7042
7392
  Pe(f, e)
7043
7393
  );
7044
- return v.debug("alias_dispatch", { action: e, target: r, argCount: g.length }), S(await C(r, g));
7394
+ return S.debug("alias_dispatch", { action: e, target: r, argCount: y.length }), v(await T(r, y));
7045
7395
  },
7046
7396
  paramTypes: o,
7047
7397
  returnDoc: "Alias result",
@@ -7050,7 +7400,7 @@ function U(e, r, n, a, o = [], i) {
7050
7400
  example: i
7051
7401
  });
7052
7402
  }
7053
- U(
7403
+ F(
7054
7404
  "cookies_get",
7055
7405
  "chrome_cookies_get",
7056
7406
  "Get a cookie",
@@ -7071,7 +7421,7 @@ U(
7071
7421
  ],
7072
7422
  'web.cookies.get({ url: "https://example.com", name: "session" })'
7073
7423
  );
7074
- U(
7424
+ F(
7075
7425
  "cookies_set",
7076
7426
  "chrome_cookies_set",
7077
7427
  "Set a cookie",
@@ -7098,7 +7448,7 @@ U(
7098
7448
  ],
7099
7449
  'web.cookies.set({ url: "https://example.com", name: "session", value: "abc" })'
7100
7450
  );
7101
- U(
7451
+ F(
7102
7452
  "cookies_delete",
7103
7453
  "chrome_cookies_remove",
7104
7454
  "Remove a cookie",
@@ -7119,11 +7469,11 @@ U(
7119
7469
  ],
7120
7470
  'web.cookies.delete({ url: "https://example.com", name: "session" })'
7121
7471
  );
7122
- U(
7472
+ F(
7123
7473
  "cookies_list",
7124
7474
  "chrome_cookies_getAll",
7125
7475
  "Get all cookies",
7126
- qt,
7476
+ Mt,
7127
7477
  [
7128
7478
  {
7129
7479
  name: "url",
@@ -7134,7 +7484,7 @@ U(
7134
7484
  ],
7135
7485
  'web.cookies.list({ url: "https://example.com" })'
7136
7486
  );
7137
- U(
7487
+ F(
7138
7488
  "history_search",
7139
7489
  "chrome_history_search",
7140
7490
  "Search history",
@@ -7155,7 +7505,7 @@ U(
7155
7505
  ],
7156
7506
  'web.history.search({ text: "example", maxResults: 10 })'
7157
7507
  );
7158
- U(
7508
+ F(
7159
7509
  "history_delete",
7160
7510
  "chrome_history_deleteUrl",
7161
7511
  "Delete a URL from history",
@@ -7170,7 +7520,7 @@ U(
7170
7520
  ],
7171
7521
  'web.history.delete("https://example.com")'
7172
7522
  );
7173
- U(
7523
+ F(
7174
7524
  "bookmarks_search",
7175
7525
  "chrome_bookmarks_search",
7176
7526
  "Search bookmarks",
@@ -7185,7 +7535,7 @@ U(
7185
7535
  ],
7186
7536
  'web.bookmarks.search("example")'
7187
7537
  );
7188
- U(
7538
+ F(
7189
7539
  "bookmarks_create",
7190
7540
  "chrome_bookmarks_create",
7191
7541
  "Create a bookmark",
@@ -7212,7 +7562,7 @@ U(
7212
7562
  ],
7213
7563
  'web.bookmarks.create({ title: "Example", url: "https://example.com" })'
7214
7564
  );
7215
- U(
7565
+ F(
7216
7566
  "bookmarks_delete",
7217
7567
  "chrome_bookmarks_remove",
7218
7568
  "Remove a bookmark",
@@ -7227,11 +7577,11 @@ U(
7227
7577
  ],
7228
7578
  'web.bookmarks.delete("bookmarkId")'
7229
7579
  );
7230
- U(
7580
+ F(
7231
7581
  "notifications_create",
7232
7582
  "chrome_notifications_create",
7233
7583
  "Create a notification",
7234
- Mt,
7584
+ Pt,
7235
7585
  [
7236
7586
  {
7237
7587
  name: "id",
@@ -7248,11 +7598,11 @@ U(
7248
7598
  ],
7249
7599
  'web.notifications.create({ id: "test", options: { type: "basic", title: "Hello", message: "World" } })'
7250
7600
  );
7251
- U(
7601
+ F(
7252
7602
  "notifications_clear",
7253
7603
  "chrome_notifications_clear",
7254
7604
  "Clear a notification",
7255
- Pt,
7605
+ jt,
7256
7606
  [
7257
7607
  {
7258
7608
  name: "id",
@@ -7268,13 +7618,13 @@ p({
7268
7618
  namespace: "host",
7269
7619
  name: "call",
7270
7620
  description: "Call a host handler",
7271
- params: Da,
7272
- returns: Oa,
7621
+ params: La,
7622
+ returns: Fa,
7273
7623
  fields: ["action", "params"],
7274
7624
  owner: "main-thread",
7275
7625
  handler: async (e, r) => {
7276
- const n = F(e), a = n.action, o = n.params;
7277
- return S(await ft(a, o));
7626
+ const n = G(e), a = n.action, o = n.params;
7627
+ return v(await ft(a, o));
7278
7628
  },
7279
7629
  paramTypes: [
7280
7630
  {
@@ -7295,15 +7645,15 @@ p({
7295
7645
  errorCategory: "host",
7296
7646
  example: 'host.call(["title", "url"])'
7297
7647
  });
7298
- class $t {
7648
+ class Kt {
7299
7649
  constructor() {
7300
- M(this, "worker", null);
7301
- M(this, "pendingCalls", /* @__PURE__ */ new Map());
7302
- M(this, "inFlightRelays", /* @__PURE__ */ new Map());
7303
- M(this, "disposed", !1);
7304
- M(this, "onCleanupComplete", null);
7305
- M(this, "abortController", null);
7306
- M(this, "runQueue", Promise.resolve());
7650
+ P(this, "worker", null);
7651
+ P(this, "pendingCalls", /* @__PURE__ */ new Map());
7652
+ P(this, "inFlightRelays", /* @__PURE__ */ new Map());
7653
+ P(this, "disposed", !1);
7654
+ P(this, "onCleanupComplete", null);
7655
+ P(this, "abortController", null);
7656
+ P(this, "runQueue", Promise.resolve());
7307
7657
  }
7308
7658
  /**
7309
7659
  * Initialize the extension-js runtime.
@@ -7318,14 +7668,14 @@ class $t {
7318
7668
  */
7319
7669
  static async init() {
7320
7670
  var c;
7321
- if (h.trace("init_start"), Te(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
7322
- br(chrome);
7323
- const { initCapabilities: l } = await Promise.resolve().then(() => _r);
7671
+ if (h.trace("init_start"), Ce(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
7672
+ hr(chrome);
7673
+ const { initCapabilities: l } = await Promise.resolve().then(() => wr);
7324
7674
  await l();
7325
7675
  }
7326
7676
  const { freezeJsRegistry: r } = await Promise.resolve().then(() => Be);
7327
7677
  r();
7328
- const { getSerializableJsManifest: n } = await Promise.resolve().then(() => Be), a = n(), o = new $t(), [i, s] = o.startWorker(a);
7678
+ const { getSerializableJsManifest: n } = await Promise.resolve().then(() => Be), a = n(), o = new Kt(), [i, s] = o.startWorker(a);
7329
7679
  return await i, h.trace("init_ready"), [o, s];
7330
7680
  }
7331
7681
  startWorker(r) {
@@ -7360,8 +7710,8 @@ class $t {
7360
7710
  break;
7361
7711
  }
7362
7712
  case "error": {
7363
- const v = typeof f.error == "string" ? f.error : ((b = f.error) == null ? void 0 : b.message) || "Worker init error";
7364
- a(new Error(v));
7713
+ const S = typeof f.error == "string" ? f.error : ((b = f.error) == null ? void 0 : b.message) || "Worker init error";
7714
+ a(new Error(S));
7365
7715
  break;
7366
7716
  }
7367
7717
  }
@@ -7445,7 +7795,7 @@ class $t {
7445
7795
  u,
7446
7796
  m.signal
7447
7797
  ).then((b) => {
7448
- var v;
7798
+ var S;
7449
7799
  if (!(m.signal.aborted && !(typeof b == "object" && b !== null && "ok" in b && b.ok === !0))) {
7450
7800
  h.trace("asyncRelayResult", {
7451
7801
  action: s,
@@ -7453,14 +7803,14 @@ class $t {
7453
7803
  resultType: typeof b
7454
7804
  });
7455
7805
  try {
7456
- (v = this.worker) == null || v.postMessage({
7806
+ (S = this.worker) == null || S.postMessage({
7457
7807
  type: "asyncRelayResult",
7458
7808
  id: u,
7459
7809
  result: b,
7460
7810
  callId: f.call_id
7461
7811
  });
7462
- } catch (g) {
7463
- const x = g instanceof Error ? g.message : String(g);
7812
+ } catch (y) {
7813
+ const x = y instanceof Error ? y.message : String(y);
7464
7814
  h.error("asyncRelayResult_post_failed", {
7465
7815
  action: s,
7466
7816
  id: u,
@@ -7469,31 +7819,31 @@ class $t {
7469
7819
  }
7470
7820
  }
7471
7821
  }).catch((b) => {
7472
- var g;
7822
+ var y;
7473
7823
  if (m.signal.aborted)
7474
7824
  return;
7475
- const v = b instanceof Error ? b.message : String(b);
7825
+ const S = b instanceof Error ? b.message : String(b);
7476
7826
  h.error("asyncRelay_error", {
7477
7827
  action: s,
7478
7828
  id: u,
7479
- error: v
7829
+ error: S
7480
7830
  });
7481
7831
  try {
7482
- (g = this.worker) == null || g.postMessage({
7832
+ (y = this.worker) == null || y.postMessage({
7483
7833
  type: "asyncRelayResult",
7484
7834
  id: u,
7485
7835
  result: {
7486
7836
  ok: !1,
7487
- error: { message: v, code: "E_RUNNER" }
7837
+ error: { message: S, code: "E_RUNNER" }
7488
7838
  },
7489
7839
  callId: f.call_id
7490
7840
  });
7491
7841
  } catch (x) {
7492
- const D = x instanceof Error ? x.message : String(x);
7842
+ const N = x instanceof Error ? x.message : String(x);
7493
7843
  h.error("asyncRelayResult_post_failed", {
7494
7844
  action: s,
7495
7845
  id: u,
7496
- error: D
7846
+ error: N
7497
7847
  });
7498
7848
  }
7499
7849
  }).finally(() => {
@@ -7521,7 +7871,7 @@ class $t {
7521
7871
  ok: !1,
7522
7872
  error: { message: "Relay aborted", code: "E_ABORT" }
7523
7873
  }) : r === "main-thread" ? ht(n.action) ? this.withMainThreadTimeout(
7524
- qr(n, i),
7874
+ Mr(n, i),
7525
7875
  n.action
7526
7876
  ) : Promise.resolve({
7527
7877
  ok: !1,
@@ -7570,14 +7920,14 @@ class $t {
7570
7920
  this.worker.postMessage({ type: "registerWorkerPort", owner: r }, [n]);
7571
7921
  }
7572
7922
  async executeContentScriptCommand(r, n, a, o) {
7573
- var v;
7923
+ var S;
7574
7924
  if (o != null && o.aborted)
7575
7925
  return {
7576
7926
  ok: !1,
7577
7927
  error: { message: "Relay aborted", code: "E_ABORT" }
7578
7928
  };
7579
7929
  const i = window.chrome;
7580
- if (!((v = i == null ? void 0 : i.runtime) != null && v.id))
7930
+ if (!((S = i == null ? void 0 : i.runtime) != null && S.id))
7581
7931
  return {
7582
7932
  ok: !1,
7583
7933
  error: {
@@ -7589,11 +7939,11 @@ class $t {
7589
7939
  const s = typeof r.params == "object" && r.params !== null ? r.params : {};
7590
7940
  let c;
7591
7941
  try {
7592
- c = gr(n, s);
7593
- } catch (g) {
7942
+ c = yr(n, s);
7943
+ } catch (y) {
7594
7944
  return {
7595
7945
  ok: !1,
7596
- error: { message: g instanceof Error ? g.message : String(g), code: "E_NO_TAB", category: "resource" }
7946
+ error: { message: y instanceof Error ? y.message : String(y), code: "E_NO_TAB", category: "resource" }
7597
7947
  };
7598
7948
  }
7599
7949
  let l = !1;
@@ -7607,32 +7957,32 @@ class $t {
7607
7957
  m = (await i.tabs.get(c)).url ?? "";
7608
7958
  } catch {
7609
7959
  }
7610
- const f = await Ut(c);
7960
+ const f = await Lt(c);
7611
7961
  if (f && !f.ok)
7612
7962
  return f;
7613
- const b = await Fe(c, yt);
7963
+ const b = await We(c, yt);
7614
7964
  if (!b.ok)
7615
7965
  return b;
7616
7966
  try {
7617
- const g = await i.tabs.sendMessage(c, {
7967
+ const y = await i.tabs.sendMessage(c, {
7618
7968
  type: "registryCall",
7619
7969
  id: a,
7620
7970
  action: r.action,
7621
7971
  params: r.params,
7622
7972
  callId: r.call_id,
7623
7973
  runId: r.runId
7624
- }), x = Ht(g);
7974
+ }), x = Ut(y);
7625
7975
  return l && x.ok ? x : l ? {
7626
7976
  ok: !1,
7627
7977
  error: { message: "Relay aborted", code: "E_ABORT" }
7628
7978
  } : x;
7629
- } catch (g) {
7979
+ } catch (y) {
7630
7980
  return l || o != null && o.aborted ? {
7631
7981
  ok: !1,
7632
7982
  error: { message: "Relay aborted", code: "E_ABORT" }
7633
7983
  } : {
7634
7984
  ok: !1,
7635
- error: Ye(g, {
7985
+ error: Ye(y, {
7636
7986
  tabId: c,
7637
7987
  url: m,
7638
7988
  action: r.action
@@ -7691,9 +8041,9 @@ class $t {
7691
8041
  ), s;
7692
8042
  }
7693
8043
  setLogLevel(r) {
7694
- h.trace("setLogLevel", { level: r }), Qt(r), !(!this.worker || this.disposed) && this.worker.postMessage({
8044
+ h.trace("setLogLevel", { level: r }), Xt(r), !(!this.worker || this.disposed) && this.worker.postMessage({
7695
8045
  type: "setLogLevel",
7696
- level: Ce[r]
8046
+ level: Te[r]
7697
8047
  });
7698
8048
  }
7699
8049
  reset() {
@@ -7779,10 +8129,10 @@ class $t {
7779
8129
  */
7780
8130
  async stopWith(r) {
7781
8131
  if (!this.disposed) {
7782
- this.disposed = !0, this.abortController = new AbortController(), Te(this.abortController), this.abortController.abort();
8132
+ this.disposed = !0, this.abortController = new AbortController(), Ce(this.abortController), this.abortController.abort();
7783
8133
  for (const [, n] of this.inFlightRelays)
7784
8134
  n.abort();
7785
- this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }), hr(), await new Promise((n) => setTimeout(n, 50)), this.worker && (this.worker.terminate(), this.worker = null);
8135
+ this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }), fr(), await new Promise((n) => setTimeout(n, 50)), this.worker && (this.worker.terminate(), this.worker = null);
7786
8136
  for (const [, n] of this.pendingCalls)
7787
8137
  n.reject(new Error("ExtensionSession stopped"));
7788
8138
  this.pendingCalls.clear(), this.onCleanupComplete && (this.onCleanupComplete(), this.onCleanupComplete = null);
@@ -7797,14 +8147,14 @@ class $t {
7797
8147
  return Math.random().toString(36).slice(2) + Date.now().toString(36);
7798
8148
  }
7799
8149
  }
7800
- function fo(e, r, n) {
8150
+ function So(e, r, n) {
7801
8151
  e.registerWorkerRelayPort(r, n);
7802
8152
  }
7803
8153
  export {
7804
- $t as ExtensionSession,
7805
- Ce as LOG_LEVEL_NUMERIC,
7806
- bo as registerHostHandler,
7807
- ho as registerHostHandlers,
7808
- fo as registerWorkerRelayPort,
7809
- Qt as setLogLevel
8154
+ Kt as ExtensionSession,
8155
+ Te as LOG_LEVEL_NUMERIC,
8156
+ Io as registerHostHandler,
8157
+ vo as registerHostHandlers,
8158
+ So as registerWorkerRelayPort,
8159
+ Xt as setLogLevel
7810
8160
  };