@pi-oxide/extension-js 0.10.2 → 0.10.3

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