@pi-oxide/extension-js 0.13.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var or = Object.defineProperty;
2
- var ir = (e, r, n) => r in e ? or(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
- var j = (e, r, n) => ir(e, typeof r != "symbol" ? r + "" : r, n);
1
+ var sr = Object.defineProperty;
2
+ var cr = (e, r, n) => r in e ? sr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
+ var L = (e, r, n) => cr(e, typeof r != "symbol" ? r + "" : r, n);
4
4
  import { z as t } from "zod";
5
- import { collectDocument as sr, formatSnapshot as rt, init as cr } from "@pi-oxide/dom-semantic-tree";
5
+ import { collectDocument as lr, formatSnapshot as nt, init as dr } from "@pi-oxide/dom-semantic-tree";
6
6
  const Ne = {
7
7
  trace: 0,
8
8
  debug: 1,
@@ -11,14 +11,14 @@ const Ne = {
11
11
  error: 4,
12
12
  none: 5
13
13
  };
14
- let nt = "trace";
15
- function lr(e) {
16
- nt = e;
14
+ let at = "trace";
15
+ function ur(e) {
16
+ at = e;
17
17
  }
18
- function dr(e) {
19
- return Ne[e] >= Ne[nt];
18
+ function pr(e) {
19
+ return Ne[e] >= Ne[at];
20
20
  }
21
- function at(e, r = "info") {
21
+ function ot(e, r = "info") {
22
22
  var n;
23
23
  if (e === null) return "null";
24
24
  if (e === void 0) return "undefined";
@@ -41,15 +41,15 @@ function at(e, r = "info") {
41
41
  }
42
42
  return String(e);
43
43
  }
44
- function ur(e) {
44
+ function mr(e) {
45
45
  return `[extension-js][${e}]`;
46
46
  }
47
- function pr(e, r) {
47
+ function br(e, r) {
48
48
  if (!e) return "";
49
49
  const n = [];
50
50
  try {
51
51
  for (const [a, o] of Object.entries(e))
52
- n.push(`${a}=${at(o, r)}`);
52
+ n.push(`${a}=${ot(o, r)}`);
53
53
  } catch {
54
54
  return " metadata=[unreadable]";
55
55
  }
@@ -58,17 +58,17 @@ function pr(e, r) {
58
58
  function ie(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
- metadata: { _args: r.map((n) => at(n)).join(" ") }
61
+ metadata: { _args: r.map((n) => ot(n)).join(" ") }
62
62
  };
63
63
  }
64
- class Me {
64
+ class De {
65
65
  constructor(r = "root") {
66
66
  this.namespace = r;
67
67
  }
68
68
  log(r, n, a) {
69
69
  try {
70
- if (!dr(r)) return;
71
- const o = ur(this.namespace), i = pr(a, r), s = `${o} ${n}${i}`;
70
+ if (!pr(r)) return;
71
+ const o = mr(this.namespace), i = br(a, r), s = `${o} ${n}${i}`;
72
72
  switch (r) {
73
73
  case "trace":
74
74
  case "debug":
@@ -112,7 +112,7 @@ class Me {
112
112
  this.log("error", a, o);
113
113
  }
114
114
  child(r) {
115
- return new Me(`${this.namespace}.${r}`);
115
+ return new De(`${this.namespace}.${r}`);
116
116
  }
117
117
  timer(r, n, a = "info") {
118
118
  const o = typeof performance < "u" && performance.now, i = o ? performance.now() : Date.now();
@@ -129,12 +129,12 @@ class Me {
129
129
  };
130
130
  }
131
131
  }
132
- const f = new Me("root"), ot = /* @__PURE__ */ new Set();
133
- function mr(e) {
134
- ot.add(e);
132
+ const f = new De("root"), it = /* @__PURE__ */ new Set();
133
+ function hr(e) {
134
+ it.add(e);
135
135
  }
136
- function it(e) {
137
- return ot.has(e);
136
+ function st(e) {
137
+ return it.has(e);
138
138
  }
139
139
  function le(e) {
140
140
  return e == null ? {} : e instanceof Map ? Object.fromEntries(
@@ -144,8 +144,8 @@ function le(e) {
144
144
  ])
145
145
  ) : Array.isArray(e) ? e.map(le) : e;
146
146
  }
147
- const br = "Content script is not connected on this tab. This tab was likely open before the extension loaded (MV3 does not retro-inject).";
148
- function hr(e) {
147
+ const fr = "Content script is not connected on this tab. This tab was likely open before the extension loaded (MV3 does not retro-inject).";
148
+ function gr(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 ge(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: br,
160
- recovery: hr(r)
159
+ hint: fr,
160
+ recovery: gr(r)
161
161
  };
162
162
  return e !== void 0 && (a.details = { tabId: e, url: n }), a;
163
163
  }
164
- function fr(e) {
164
+ function yr(e) {
165
165
  return {
166
166
  message: `No active tab resolved for ${e}.`,
167
167
  code: "E_NO_TAB",
@@ -172,7 +172,7 @@ function fr(e) {
172
172
  ]
173
173
  };
174
174
  }
175
- function gr(e, r) {
175
+ function _r(e, r) {
176
176
  var c, l;
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}"` : ""}`;
@@ -197,14 +197,14 @@ function gr(e, r) {
197
197
  };
198
198
  return (l = r == null ? void 0 : r.candidates) != null && l.length && (s.details = { ...s.details, candidates: r.candidates }), i && (s.details = { ...s.details, snapshot: r.snapshot }), s;
199
199
  }
200
- function yr(e) {
200
+ function wr(e) {
201
201
  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");
202
202
  }
203
203
  function me(e) {
204
204
  const r = new Error(e.message);
205
205
  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;
206
206
  }
207
- function _r(e, r, n) {
207
+ function kr(e, r, n) {
208
208
  let a = `Element not found by label "${e}"`;
209
209
  if (r !== void 0) {
210
210
  const i = r.map((s) => s.name || s.refId).filter(Boolean).slice(0, 5);
@@ -225,7 +225,7 @@ function _r(e, r, n) {
225
225
  }
226
226
  };
227
227
  }
228
- function wr(e) {
228
+ function Ir(e) {
229
229
  if (!(e instanceof Error)) return {};
230
230
  const r = e.name !== "Error" ? e.name : void 0, n = e.stack;
231
231
  let a;
@@ -235,13 +235,13 @@ function wr(e) {
235
235
  }
236
236
  return { name: r, stack: n, line: a };
237
237
  }
238
- function st(e, r) {
238
+ function ct(e, r) {
239
239
  if (typeof e == "object" && e !== null && "code" in e && typeof e.code == "string" && "message" in e && typeof e.message == "string") {
240
240
  const c = e;
241
241
  return c.hint || c.recovery ? c : c.code === "E_CONTENT_SCRIPT" ? ge(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url) : c;
242
242
  }
243
- const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } = wr(e);
244
- if (yr(n))
243
+ const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } = Ir(e);
244
+ if (wr(n))
245
245
  return ge(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url);
246
246
  if (n.includes("permission") || n.includes("Permission")) {
247
247
  const c = {
@@ -301,7 +301,7 @@ function T(e, r = 0, n = 2) {
301
301
  }
302
302
  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";
303
303
  }
304
- function kr(e) {
304
+ function vr(e) {
305
305
  const r = Z(e);
306
306
  if (!(r instanceof t.ZodObject))
307
307
  return [];
@@ -353,33 +353,33 @@ function kr(e) {
353
353
  };
354
354
  });
355
355
  }
356
- function ct(e) {
356
+ function lt(e) {
357
357
  return T(e, 0, 3);
358
358
  }
359
- function Ir(e) {
359
+ function Er(e) {
360
360
  return e === null ? "null" : e === void 0 ? "undefined" : Array.isArray(e) ? "array" : typeof e;
361
361
  }
362
- function vr(e, r, n, a) {
362
+ function xr(e, r, n, a) {
363
363
  const o = n.filter((c) => c.path.length === 0), i = n.filter((c) => c.path.length > 0);
364
364
  if (o.length > 0 && i.length === 0) {
365
365
  const c = o.some((d) => d.code === "custom"), l = o.some(
366
366
  (d) => d.code !== "invalid_type" && d.code !== "invalid_literal" && d.code !== "invalid_union"
367
367
  );
368
368
  if (!c && !l) {
369
- const d = T(r), u = Ir(a);
369
+ const d = T(r), u = Er(a);
370
370
  return `Invalid parameters for ${e}: expected ${d}${d === "{ }" ? " or no args" : ""}, received ${u}`;
371
371
  }
372
372
  }
373
373
  const s = n.map((c) => `at '${c.path.length > 0 ? c.path.join(".") : "root"}': ${c.message}`);
374
374
  return `Invalid parameters for ${e}: ${s.join("; ")}`;
375
375
  }
376
- async function Er(e, r, n, a, o) {
376
+ async function Sr(e, r, n, a, o) {
377
377
  const i = e.safeParse(le(a));
378
378
  if (!i.success)
379
379
  return {
380
380
  ok: !1,
381
381
  error: {
382
- message: vr(
382
+ message: xr(
383
383
  o,
384
384
  e,
385
385
  i.error.issues,
@@ -407,7 +407,7 @@ async function Er(e, r, n, a, o) {
407
407
  }
408
408
  return { ok: !0, value: c.data };
409
409
  } catch (s) {
410
- const c = st(s), l = c.code === "E_EXTENSION" && (typeof s != "object" || s === null || !("code" in s));
410
+ const c = ct(s), l = c.code === "E_EXTENSION" && (typeof s != "object" || s === null || !("code" in s));
411
411
  return {
412
412
  ok: !1,
413
413
  error: {
@@ -418,12 +418,12 @@ async function Er(e, r, n, a, o) {
418
418
  };
419
419
  }
420
420
  }
421
- function xr(e, r) {
422
- return r !== "main-thread" ? r : it(e) ? "content-script" : r;
421
+ function Tr(e, r) {
422
+ return r !== "main-thread" ? r : st(e) ? "content-script" : r;
423
423
  }
424
424
  const Ce = f.child("tool-registry"), qe = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new Map();
425
- let lt = !1, he = null;
426
- function De(e) {
425
+ let dt = !1, he = null;
426
+ function Me(e) {
427
427
  he = e;
428
428
  }
429
429
  function Oe() {
@@ -434,7 +434,7 @@ function ee() {
434
434
  if (e != null && e.aborted)
435
435
  throw new Error("Runner aborted: ExtensionSession stopped");
436
436
  }
437
- function dt(e) {
437
+ function ut(e) {
438
438
  m({
439
439
  ...e,
440
440
  owner: "content-script",
@@ -444,7 +444,7 @@ function dt(e) {
444
444
  });
445
445
  }
446
446
  function m(e) {
447
- if (lt)
447
+ if (dt)
448
448
  throw new Error(`JS registry is frozen; cannot register "${e.action}"`);
449
449
  if (be.has(e.action))
450
450
  throw new Error(`Tool "${e.action}" is already registered`);
@@ -459,7 +459,7 @@ function m(e) {
459
459
  throw new Error(
460
460
  `Duplicate public name "${r}" for action "${e.action}" (already registered by "${a}")`
461
461
  );
462
- const o = xr(e.action, e.owner), i = {
462
+ const o = Tr(e.action, e.owner), i = {
463
463
  ...e,
464
464
  owner: o
465
465
  };
@@ -472,16 +472,16 @@ function m(e) {
472
472
  params: e.params,
473
473
  returns: e.returns,
474
474
  handler: async (c, l, d, u) => {
475
- const h = {
475
+ const b = {
476
476
  action: i.action,
477
477
  callId: l,
478
478
  runId: d,
479
479
  signal: u
480
480
  };
481
- return i.handler(c, h);
481
+ return i.handler(c, b);
482
482
  },
483
483
  paramTypes: e.paramTypes ?? [],
484
- returnType: e.returnType ?? ct(e.returns),
484
+ returnType: e.returnType ?? lt(e.returns),
485
485
  returnDoc: e.returnDoc ?? "Result",
486
486
  errorCode: e.errorCode,
487
487
  errorCategory: e.errorCategory,
@@ -492,11 +492,11 @@ function m(e) {
492
492
  function Pe(e) {
493
493
  return qe.get(e);
494
494
  }
495
- function Sr() {
496
- lt = !0;
497
- const e = ut(), r = [];
495
+ function Cr() {
496
+ dt = !0;
497
+ const e = pt(), r = [];
498
498
  for (const n of e)
499
- n.owner === "main-thread" ? Pe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? it(n.action) || r.push(
499
+ n.owner === "main-thread" ? Pe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? st(n.action) || r.push(
500
500
  `${n.action} (content-script: missing from content-script action set)`
501
501
  ) : r.push(`${n.action} (unknown owner: ${n.owner})`);
502
502
  if (r.length > 0)
@@ -506,13 +506,13 @@ function Sr() {
506
506
  `)
507
507
  );
508
508
  }
509
- function ut() {
509
+ function pt() {
510
510
  var r, n, a, o, i;
511
511
  const e = [];
512
512
  for (const [s, c] of be) {
513
513
  if (c.owner === "rust") continue;
514
- const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : kr(c.params), d = {
515
- type: c.returnType ?? ct(c.returns),
514
+ const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : vr(c.params), d = {
515
+ type: c.returnType ?? lt(c.returns),
516
516
  description: c.returnDoc ?? "Result"
517
517
  };
518
518
  e.push({
@@ -555,7 +555,7 @@ async function x(e, r, n, a, o) {
555
555
  }
556
556
  };
557
557
  ee();
558
- const s = await Er(
558
+ const s = await Sr(
559
559
  i.params,
560
560
  i.returns,
561
561
  async (c) => i.handler(c, n, a, o),
@@ -579,42 +579,42 @@ async function x(e, r, n, a, o) {
579
579
  }
580
580
  } : s);
581
581
  }
582
- const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
582
+ const Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
583
583
  __proto__: null,
584
584
  coerceWasmParams: le,
585
585
  dispatchTool: x,
586
- freezeJsRegistry: Sr,
586
+ freezeJsRegistry: Cr,
587
587
  getRunnerSignal: Oe,
588
- getSerializableJsManifest: ut,
588
+ getSerializableJsManifest: pt,
589
589
  getTool: Pe,
590
- registerContentScriptJsCall: dt,
590
+ registerContentScriptJsCall: ut,
591
591
  registerJsCall: m,
592
- setRunnerAbortController: De,
592
+ setRunnerAbortController: Me,
593
593
  throwIfAborted: ee
594
594
  }, Symbol.toStringTag, { value: "Module" }));
595
595
  let $ = null, ye = !1;
596
- const pt = ({ tabId: e }) => {
596
+ const mt = ({ tabId: e }) => {
597
597
  $ = e;
598
- }, mt = (e, r) => {
598
+ }, bt = (e, r) => {
599
599
  var a;
600
600
  const n = window.chrome;
601
601
  (a = n == null ? void 0 : n.runtime) != null && a.id && r.status === "complete" && ($ = e, n.tabs.sendMessage(e, { action: "ping" }).catch(() => {
602
602
  }));
603
603
  };
604
- function Tr(e) {
604
+ function Rr(e) {
605
605
  var r;
606
- ye || (r = e == null ? void 0 : e.runtime) != null && r.id && (ye = !0, e.tabs.onActivated.addListener(pt), e.tabs.onUpdated.addListener(mt), e.tabs.query({ active: !0, lastFocusedWindow: !0 }).then((n) => {
606
+ ye || (r = e == null ? void 0 : e.runtime) != null && r.id && (ye = !0, e.tabs.onActivated.addListener(mt), e.tabs.onUpdated.addListener(bt), e.tabs.query({ active: !0, lastFocusedWindow: !0 }).then((n) => {
607
607
  const a = n[0];
608
608
  (a == null ? void 0 : a.id) !== void 0 && ($ = a.id);
609
609
  }).catch(() => {
610
610
  }));
611
611
  }
612
- function Cr() {
612
+ function Ar() {
613
613
  var r;
614
614
  const e = window.chrome;
615
- !((r = e == null ? void 0 : e.runtime) != null && r.id) || !ye || (e.tabs.onActivated.removeListener(pt), e.tabs.onUpdated.removeListener(mt), ye = !1);
615
+ !((r = e == null ? void 0 : e.runtime) != null && r.id) || !ye || (e.tabs.onActivated.removeListener(mt), e.tabs.onUpdated.removeListener(bt), ye = !1);
616
616
  }
617
- async function bt() {
617
+ async function ht() {
618
618
  var n;
619
619
  const e = f.child("tab-context");
620
620
  if (e.debug("resolveActiveTabId_start", { activeTabId: $ }), $ !== null)
@@ -633,7 +633,7 @@ async function bt() {
633
633
  }
634
634
  return e.warn("resolveActiveTabId_result", { tabId: null, reason: "not_found" }), null;
635
635
  }
636
- function Rr(e) {
636
+ function Nr(e) {
637
637
  if (typeof e == "number" && Number.isFinite(e))
638
638
  return e;
639
639
  if (typeof e == "bigint") {
@@ -642,8 +642,8 @@ function Rr(e) {
642
642
  }
643
643
  return null;
644
644
  }
645
- function Ar(e, r) {
646
- const n = r.tabId ?? r.tab_id, a = Rr(n);
645
+ function Mr(e, r) {
646
+ const n = r.tabId ?? r.tab_id, a = Nr(n);
647
647
  if (a !== null)
648
648
  return a;
649
649
  if (n != null)
@@ -658,7 +658,7 @@ function y(e, r, n, a) {
658
658
  const o = new Error(e);
659
659
  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;
660
660
  }
661
- function Nr(e) {
661
+ function Dr(e) {
662
662
  throw y(e.message, e.code, e.category, {
663
663
  hint: e.hint,
664
664
  recovery: e.recovery,
@@ -696,7 +696,7 @@ const _e = {
696
696
  tts: "tts",
697
697
  windows: "windows"
698
698
  };
699
- async function ht() {
699
+ async function ft() {
700
700
  var e, r, n, a;
701
701
  if (typeof chrome < "u" && ((e = chrome.runtime) != null && e.id))
702
702
  try {
@@ -709,10 +709,10 @@ async function ht() {
709
709
  else
710
710
  ce = null;
711
711
  }
712
- async function ft() {
713
- await ht();
712
+ async function gt() {
713
+ await ft();
714
714
  }
715
- function gt(e) {
715
+ function yt(e) {
716
716
  if (e.length === 0) return null;
717
717
  const r = e[0];
718
718
  if (r === "system" && e.length >= 2) {
@@ -722,32 +722,32 @@ function gt(e) {
722
722
  }
723
723
  return r in _e ? _e[r] : r;
724
724
  }
725
- function yt(e) {
725
+ function _t(e) {
726
726
  const r = e.match(/^chrome_([a-zA-Z0-9]+)_/);
727
727
  if (!r) return null;
728
728
  const n = r[1];
729
729
  return n in _e ? _e[n] : n;
730
730
  }
731
- function _t(e) {
731
+ function wt(e) {
732
732
  return e === null ? !0 : ce === null ? !1 : ce.has(e);
733
733
  }
734
- function je(e, r) {
735
- if (r !== null && !_t(r))
734
+ function Le(e, r) {
735
+ if (r !== null && !wt(r))
736
736
  throw y(
737
737
  `Permission denied: ${r} required for ${e}`,
738
738
  "E_PERMISSION",
739
739
  "permission"
740
740
  );
741
741
  }
742
- const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
742
+ const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
743
743
  __proto__: null,
744
- checkPermission: je,
745
- hasPermission: _t,
746
- initCapabilities: ht,
747
- manifestPermissionForApiPath: gt,
748
- permissionFromChromeAction: yt,
749
- refreshCapabilities: ft
750
- }, Symbol.toStringTag, { value: "Module" })), Mr = /* @__PURE__ */ new Set([
744
+ checkPermission: Le,
745
+ hasPermission: wt,
746
+ initCapabilities: ft,
747
+ manifestPermissionForApiPath: yt,
748
+ permissionFromChromeAction: _t,
749
+ refreshCapabilities: gt
750
+ }, Symbol.toStringTag, { value: "Module" })), Or = /* @__PURE__ */ new Set([
751
751
  "bookmarks_search",
752
752
  "bookmarks_create",
753
753
  "bookmarks_delete",
@@ -760,13 +760,13 @@ const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
760
760
  "notifications_create",
761
761
  "notifications_clear"
762
762
  ]);
763
- function wt(e) {
764
- return e.startsWith("chrome_") || Mr.has(e);
763
+ function kt(e) {
764
+ return e.startsWith("chrome_") || Or.has(e);
765
765
  }
766
- function kt(e, r) {
766
+ function It(e, r) {
767
767
  return e(...r);
768
768
  }
769
- const qr = /* @__PURE__ */ new Set([
769
+ const Pr = /* @__PURE__ */ new Set([
770
770
  "chrome_bookmarks_search",
771
771
  "bookmarks_search",
772
772
  "chrome_history_search",
@@ -775,10 +775,10 @@ const qr = /* @__PURE__ */ new Set([
775
775
  "chrome_tabs_query",
776
776
  "tab_query"
777
777
  ]);
778
- function Ue(e, r) {
779
- return r.length > 0 ? r : qr.has(e) ? [{}] : r;
778
+ function je(e, r) {
779
+ return r.length > 0 ? r : Pr.has(e) ? [{}] : r;
780
780
  }
781
- function Le(e, r) {
781
+ function He(e, r) {
782
782
  if (!Array.isArray(e))
783
783
  throw y(
784
784
  `Native-parity action ${r} requires an argument array`,
@@ -787,7 +787,7 @@ function Le(e, r) {
787
787
  );
788
788
  return e;
789
789
  }
790
- function It(e, r, n) {
790
+ function vt(e, r, n) {
791
791
  let a = e;
792
792
  for (let i = 0; i < r.length; i++) {
793
793
  const s = r[i];
@@ -843,34 +843,34 @@ function fe(e) {
843
843
  return r;
844
844
  }
845
845
  function p(e, r, n, a, o, i, s, c = [], l, d) {
846
- const u = Or(e), h = a.length > 0 ? `chrome.${a.join(".")}` : r, b = gt(a);
846
+ const u = Lr(e), b = a.length > 0 ? `chrome.${a.join(".")}` : r, h = yt(a);
847
847
  m({
848
848
  action: e,
849
- namespace: h,
849
+ namespace: b,
850
850
  name: u,
851
851
  description: n,
852
852
  params: t.unknown(),
853
853
  returns: o,
854
854
  owner: "main-thread",
855
- permission: b ?? void 0,
855
+ permission: h ?? void 0,
856
856
  returnType: d ?? void 0,
857
857
  handler: async (S, I) => {
858
858
  var R;
859
- const A = f.child("chrome"), M = window.chrome;
860
- if (!((R = M == null ? void 0 : M.runtime) != null && R.id))
859
+ const A = f.child("chrome"), D = window.chrome;
860
+ if (!((R = D == null ? void 0 : D.runtime) != null && R.id))
861
861
  throw y(
862
862
  `${e} is only available in a browser extension context`,
863
863
  "E_NO_EXTENSION",
864
864
  "permission"
865
865
  );
866
- je(e, b);
867
- const Y = Ue(
866
+ Le(e, h);
867
+ const Y = je(
868
868
  e,
869
- Le(S, e)
870
- ), W = It(M, a, u);
869
+ He(S, e)
870
+ ), W = vt(D, a, u);
871
871
  A.debug("chrome_passthrough", { action: e, argCount: Y.length });
872
872
  try {
873
- const _ = await kt(W, Y);
873
+ const _ = await It(W, Y);
874
874
  A.debug("chrome_passthrough_ok", { action: e });
875
875
  const G = fe(_);
876
876
  return G === void 0 ? null : G;
@@ -895,20 +895,20 @@ function p(e, r, n, a, o, i, s, c = [], l, d) {
895
895
  example: l
896
896
  });
897
897
  }
898
- function Or(e) {
898
+ function Lr(e) {
899
899
  const r = e.split("_").at(-1);
900
900
  if (!r)
901
901
  throw new Error(`Cannot derive Chrome method name from action "${e}"`);
902
902
  return r;
903
903
  }
904
904
  const Ie = {};
905
- function qi(e, r) {
905
+ function Ki(e, r) {
906
906
  Ie[e] = r;
907
907
  }
908
- function Oi(e) {
908
+ function Vi(e) {
909
909
  Object.assign(Ie, e);
910
910
  }
911
- function vt(e) {
911
+ function Et(e) {
912
912
  var r;
913
913
  if (Pe(e)) return !0;
914
914
  if (e.startsWith("host_")) {
@@ -917,7 +917,7 @@ function vt(e) {
917
917
  }
918
918
  return !1;
919
919
  }
920
- async function Et(e, r) {
920
+ async function xt(e, r) {
921
921
  var o;
922
922
  const n = f.child("runner");
923
923
  n.debug("handleHostCallAction_start", { action: e });
@@ -954,8 +954,8 @@ async function Et(e, r) {
954
954
  };
955
955
  }
956
956
  }
957
- const Q = 3e4, xt = 300, Pr = 100, jr = 500, St = 500, Tt = 500;
958
- function L(e) {
957
+ const Q = 3e4, St = 300, jr = 100, Hr = 500, Tt = 500, Ct = 500;
958
+ function H(e) {
959
959
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : {};
960
960
  }
961
961
  function z(e) {
@@ -971,12 +971,12 @@ function te(e) {
971
971
  if (Array.isArray(e)) {
972
972
  const a = e[0], o = z(a);
973
973
  if (o !== null) return o;
974
- const i = L(a);
974
+ const i = H(a);
975
975
  return z(i.id) ?? z(i.tabId) ?? z(i.tab_id);
976
976
  }
977
977
  const r = z(e);
978
978
  if (r !== null) return r;
979
- const n = L(e);
979
+ const n = H(e);
980
980
  return z(n.id) ?? z(n.tabId) ?? z(n.tab_id);
981
981
  }
982
982
  const Ur = /* @__PURE__ */ new Map([
@@ -985,12 +985,12 @@ const Ur = /* @__PURE__ */ new Map([
985
985
  ["tab_wait_for_load", (e) => ({ tabId: e })],
986
986
  ["tab_scroll", (e) => ({ tabId: e })],
987
987
  ["sidepanel_wait", (e) => ({ duration: e })]
988
- ]), Lr = /* @__PURE__ */ new Map([
988
+ ]), Fr = /* @__PURE__ */ new Map([
989
989
  ["tab_create", (e) => ({ url: e })],
990
990
  ["page_new_tab", (e) => ({ url: e })],
991
991
  ["page_find", (e) => ({ selector: e })],
992
992
  ["sidepanel_press", (e) => ({ key: e })]
993
- ]), Hr = /* @__PURE__ */ new Map([
993
+ ]), Wr = /* @__PURE__ */ new Map([
994
994
  ["tab_press", (e) => ({ tabId: e[0], key: e[1] })],
995
995
  ["tab_unhover", (e) => ({ tabId: e[0] })],
996
996
  [
@@ -998,7 +998,7 @@ const Ur = /* @__PURE__ */ new Map([
998
998
  (e) => ({
999
999
  tabId: e[0],
1000
1000
  direction: e[1] ?? "down",
1001
- amount: e[2] ?? xt
1001
+ amount: e[2] ?? St
1002
1002
  })
1003
1003
  ],
1004
1004
  ["tab_back", (e) => ({ tabId: e[0] })],
@@ -1019,9 +1019,9 @@ const Ur = /* @__PURE__ */ new Map([
1019
1019
  ["storage_get_many", (e) => ({ keys: e })],
1020
1020
  ["storage_delete_many", (e) => ({ keys: e })]
1021
1021
  ]);
1022
- function Fr(e, r) {
1022
+ function $r(e, r) {
1023
1023
  if (r = le(r), typeof r == "string") {
1024
- const n = Lr.get(e);
1024
+ const n = Fr.get(e);
1025
1025
  if (n) return n(r);
1026
1026
  }
1027
1027
  if (typeof r == "number" || typeof r == "bigint") {
@@ -1029,7 +1029,7 @@ function Fr(e, r) {
1029
1029
  if (n) return n(r);
1030
1030
  }
1031
1031
  if (Array.isArray(r)) {
1032
- const n = Hr.get(e);
1032
+ const n = Wr.get(e);
1033
1033
  if (n) return n(r);
1034
1034
  }
1035
1035
  return r;
@@ -1043,32 +1043,32 @@ function v(e) {
1043
1043
  );
1044
1044
  return e.value;
1045
1045
  }
1046
- function Wr(e, r) {
1047
- if (!wt(e)) return r;
1046
+ function Gr(e, r) {
1047
+ if (!kt(e)) return r;
1048
1048
  const n = Array.isArray(r) ? r : [];
1049
- return Ue(e, n);
1049
+ return je(e, n);
1050
1050
  }
1051
- function $r(e) {
1051
+ function Br(e) {
1052
1052
  return {
1053
1053
  ok: !1,
1054
1054
  error: { message: `Unknown action: ${e}`, code: "E_UNKNOWN" }
1055
1055
  };
1056
1056
  }
1057
- function Gr(e) {
1057
+ function Kr(e) {
1058
1058
  const r = e ?? Oe();
1059
1059
  if (r != null && r.aborted)
1060
1060
  throw new Error("Runner aborted: ExtensionSession stopped");
1061
1061
  return r ?? new AbortController().signal;
1062
1062
  }
1063
- async function Br(e, r) {
1064
- if (!vt(e.action))
1065
- return { response: $r(e.action) };
1063
+ async function Vr(e, r) {
1064
+ if (!Et(e.action))
1065
+ return { response: Br(e.action) };
1066
1066
  if (e.action.startsWith("host_"))
1067
- return { response: await Et(
1067
+ return { response: await xt(
1068
1068
  e.action.slice(5),
1069
1069
  e.params
1070
1070
  ), handler: "host" };
1071
- const n = wt(e.action) ? Wr(e.action, e.params) : Fr(e.action, e.params);
1071
+ const n = kt(e.action) ? Gr(e.action, e.params) : $r(e.action, e.params);
1072
1072
  return { response: await x(
1073
1073
  e.action,
1074
1074
  n,
@@ -1077,23 +1077,23 @@ async function Br(e, r) {
1077
1077
  r
1078
1078
  ) };
1079
1079
  }
1080
- function Kr(e) {
1080
+ function Zr(e) {
1081
1081
  return f.child("runner").timer("command_dispatch", {
1082
1082
  action: e.action,
1083
1083
  commandId: e.call_id,
1084
1084
  runId: e.runId
1085
1085
  });
1086
1086
  }
1087
- async function Vr(e, r) {
1088
- const n = Kr(e), { response: a, handler: o } = await Br(
1087
+ async function zr(e, r) {
1088
+ const n = Zr(e), { response: a, handler: o } = await Vr(
1089
1089
  e,
1090
- Gr(r)
1090
+ Kr(r)
1091
1091
  );
1092
1092
  return n({ ok: a.ok, ...o ? { handler: o } : {} }), a;
1093
1093
  }
1094
- const Zr = /^e\d+$/;
1095
- let Ct = 0;
1096
- function zr() {
1094
+ const Xr = /^e\d+$/;
1095
+ let Rt = 0;
1096
+ function Qr() {
1097
1097
  let e = 0;
1098
1098
  for (const r of document.querySelectorAll("[data-ref-id]")) {
1099
1099
  const n = r.getAttribute("data-ref-id");
@@ -1101,15 +1101,93 @@ function zr() {
1101
1101
  const a = parseInt(n.replace(/^e/, ""), 10);
1102
1102
  !Number.isNaN(a) && a > e && (e = a);
1103
1103
  }
1104
- Ct = e;
1104
+ Rt = e;
1105
1105
  }
1106
- function Rt(e) {
1106
+ function At(e) {
1107
1107
  const r = e.getAttribute("data-ref-id");
1108
- if (r && Zr.test(r)) return r;
1109
- const n = `e${++Ct}`;
1108
+ if (r && Xr.test(r)) return r;
1109
+ const n = `e${++Rt}`;
1110
1110
  return e.setAttribute("data-ref-id", n), n;
1111
1111
  }
1112
- const He = 'input, textarea, select, button, a, [role="button"], [role="link"]', Xr = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), At = /* @__PURE__ */ new Set([
1112
+ const Jr = /* @__PURE__ */ new Set([
1113
+ "button",
1114
+ "tab",
1115
+ "link",
1116
+ "checkbox",
1117
+ "menuitem",
1118
+ "menuitemcheckbox",
1119
+ "menuitemradio",
1120
+ "radio",
1121
+ "textbox"
1122
+ ]);
1123
+ function Yr(e) {
1124
+ let r = e;
1125
+ for (; r; ) {
1126
+ if (r.hidden || r.getAttribute("aria-hidden") === "true" || r.inert) return !0;
1127
+ const n = window.getComputedStyle(r);
1128
+ if (n.display === "none" || n.visibility === "hidden") return !0;
1129
+ r = r.parentElement;
1130
+ }
1131
+ return !1;
1132
+ }
1133
+ function en(e) {
1134
+ var n, a;
1135
+ const r = e.getAttribute("jsaction");
1136
+ if (!r) return !1;
1137
+ for (const o of r.split(";")) {
1138
+ const i = o.trim();
1139
+ if (!i) continue;
1140
+ const s = i.split(":"), c = s.length === 1 ? "click" : (n = s[0]) == null ? void 0 : n.trim(), l = ((a = s.length === 1 ? s[0] : s[1]) == null ? void 0 : a.trim()) ?? "";
1141
+ if (c === "click" && !(!l || l.startsWith("none.") || l.endsWith("._")) && l.includes("."))
1142
+ return !0;
1143
+ }
1144
+ return !1;
1145
+ }
1146
+ function tn(e) {
1147
+ var n;
1148
+ const r = (n = e.getAttribute("class")) == null ? void 0 : n.toLowerCase();
1149
+ return (r == null ? void 0 : r.includes("button")) === !0 || (r == null ? void 0 : r.includes("btn")) === !0;
1150
+ }
1151
+ function rn(e) {
1152
+ return e instanceof HTMLButtonElement || e instanceof HTMLSelectElement ? !e.disabled : e instanceof HTMLTextAreaElement ? !e.disabled && !e.readOnly : e instanceof HTMLInputElement ? e.type !== "hidden" && !e.disabled : e instanceof HTMLAnchorElement ? e.hasAttribute("href") : !1;
1153
+ }
1154
+ function nn(e) {
1155
+ const r = e.getAttribute("contenteditable");
1156
+ return r !== null && (r === "" || r.toLowerCase() === "true" || r.toLowerCase() === "contenteditable");
1157
+ }
1158
+ function an(e) {
1159
+ const r = e.getAttribute("tabindex");
1160
+ if (r === null) return !1;
1161
+ const n = Number.parseInt(r, 10);
1162
+ return Number.isFinite(n) && n >= 0;
1163
+ }
1164
+ function Nt(e) {
1165
+ if (Yr(e)) return { clickable: !1, confidence: "low" };
1166
+ if (e.getAttribute("aria-disabled") === "true")
1167
+ return { clickable: !1, confidence: "low" };
1168
+ let r = { clickable: !1, confidence: "low" };
1169
+ const n = e.getAttribute("role");
1170
+ return n && Jr.has(n.toLowerCase()) ? r = { clickable: !0, confidence: "high", reason: "role" } : e.getAttribute("onclick") || e.onclick ? r = { clickable: !0, confidence: "high", reason: "onclick" } : en(e) ? r = { clickable: !0, confidence: "high", reason: "jsaction" } : nn(e) ? r = { clickable: !0, confidence: "high", reason: "contenteditable" } : an(e) ? r = { clickable: !0, confidence: "high", reason: "tabindex" } : rn(e) ? r = { clickable: !0, confidence: "high", reason: "native" } : tn(e) && (r = { clickable: !0, confidence: "low", reason: "buttonClass" }), r.clickable && e.tagName.toLowerCase() === "span" && (r = { clickable: !0, confidence: "low", reason: "span" }), r;
1171
+ }
1172
+ function on(e) {
1173
+ const r = [1, 2, 3], n = 6, a = /* @__PURE__ */ new Set();
1174
+ for (let o = 0; o < e.length; o++) {
1175
+ const i = e[o];
1176
+ if (i.confidence !== "low") continue;
1177
+ const s = Math.min(e.length, o + 1 + n);
1178
+ for (let c = o + 1; c < s; c++) {
1179
+ let l = e[c].el;
1180
+ for (const d of r)
1181
+ if (l = (l == null ? void 0 : l.parentElement) ?? null, l === i.el) {
1182
+ a.add(i.el);
1183
+ break;
1184
+ }
1185
+ if (a.has(i.el)) break;
1186
+ }
1187
+ }
1188
+ return a;
1189
+ }
1190
+ const Ue = 'input, textarea, select, button, a, [role="button"], [role="link"]', sn = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), Mt = /* @__PURE__ */ new Set([
1113
1191
  "p",
1114
1192
  "span",
1115
1193
  "label",
@@ -1137,7 +1215,7 @@ const He = 'input, textarea, select, button, a, [role="button"], [role="link"]',
1137
1215
  "sub",
1138
1216
  "sup"
1139
1217
  ]);
1140
- function Qr(e) {
1218
+ function cn(e) {
1141
1219
  const r = {};
1142
1220
  if (e instanceof HTMLInputElement)
1143
1221
  e.type !== "password" && e.type !== "hidden" && (r.value = e.value), (e.type === "checkbox" || e.type === "radio") && (r.checked = e.checked), r.disabled = e.disabled, r.readOnly = e.readOnly, Re(e, r);
@@ -1158,10 +1236,10 @@ function Qr(e) {
1158
1236
  function Re(e, r) {
1159
1237
  const n = e.required || e.getAttribute("aria-required") === "true", o = !(e.getAttribute("aria-invalid") === "true") && e.checkValidity();
1160
1238
  n && (r.required = !0), r.valid = o, r.invalid = !o;
1161
- const i = Jr(e);
1239
+ const i = ln(e);
1162
1240
  i && (r.errorMessage = i), !o && e.validationMessage && (r.validationMessage = e.validationMessage);
1163
1241
  }
1164
- function Jr(e) {
1242
+ function ln(e) {
1165
1243
  var n;
1166
1244
  const r = [
1167
1245
  ...(e.getAttribute("aria-errormessage") || "").split(/\s+/),
@@ -1176,26 +1254,26 @@ function Jr(e) {
1176
1254
  if (s === "alert" || c && c !== "off" || /error|required|select|please|invalid/i.test(i)) return i;
1177
1255
  }
1178
1256
  }
1179
- function Yr(e, r) {
1257
+ function dn(e, r) {
1180
1258
  const n = e.tagName.toLowerCase();
1181
- n !== "input" && n !== "textarea" && n !== "select" && n !== "option" || Object.assign(r, Qr(e));
1259
+ n !== "input" && n !== "textarea" && n !== "select" && n !== "option" || Object.assign(r, cn(e));
1182
1260
  }
1183
- const en = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
1261
+ const un = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
1184
1262
  function ve(e) {
1185
1263
  if (e)
1186
1264
  try {
1187
1265
  const r = new URL(e, window.location.href);
1188
- return en.has(r.protocol) ? r.href : void 0;
1266
+ return un.has(r.protocol) ? r.href : void 0;
1189
1267
  } catch {
1190
1268
  return;
1191
1269
  }
1192
1270
  }
1193
- function tn(e) {
1271
+ function pn(e) {
1194
1272
  const r = e.closest("article[data-post-id], [data-post-id]");
1195
1273
  if (r)
1196
- return Rt(r);
1274
+ return At(r);
1197
1275
  }
1198
- function rn(e) {
1276
+ function mn(e) {
1199
1277
  const r = e.querySelector(
1200
1278
  ":scope > h2 a[href], a[data-permalink], a[rel='permalink']"
1201
1279
  );
@@ -1217,16 +1295,16 @@ function X(e) {
1217
1295
  if (a === "radio") return "radio";
1218
1296
  if (a === "submit" || a === "button") return "button";
1219
1297
  }
1220
- 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";
1298
+ 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" : "generic";
1221
1299
  }
1222
- function nn(e) {
1300
+ function bn(e) {
1223
1301
  var r;
1224
1302
  for (const n of e.childNodes)
1225
1303
  if (n.nodeType === Node.TEXT_NODE && ((r = n.textContent) == null ? void 0 : r.trim()))
1226
1304
  return !0;
1227
1305
  return !1;
1228
1306
  }
1229
- function Nt(e, r = 60) {
1307
+ function Dt(e, r = 60) {
1230
1308
  var o, i;
1231
1309
  const n = [];
1232
1310
  for (const s of e.childNodes)
@@ -1239,7 +1317,7 @@ function Nt(e, r = 60) {
1239
1317
  const a = (i = e.textContent) == null ? void 0 : i.trim();
1240
1318
  return a ? a.slice(0, r) : "";
1241
1319
  }
1242
- function an(e) {
1320
+ function hn(e) {
1243
1321
  let r = e;
1244
1322
  for (; r; ) {
1245
1323
  if (r.hidden || r.getAttribute("aria-hidden") === "true" || r.inert) return !0;
@@ -1249,19 +1327,19 @@ function an(e) {
1249
1327
  }
1250
1328
  return !1;
1251
1329
  }
1252
- function on(e) {
1253
- return an(e);
1330
+ function fn(e) {
1331
+ return hn(e);
1254
1332
  }
1255
- function Dt(e) {
1333
+ function qt(e) {
1256
1334
  var c;
1257
1335
  const r = e.tagName.toLowerCase();
1258
- if (Xr.has(r) || on(e)) return !1;
1336
+ if (sn.has(r) || fn(e)) return !1;
1259
1337
  const n = X(e);
1260
1338
  if (n !== "generic" && !(n === "presentation" || n === "none")) return !0;
1261
1339
  const o = e.getAttribute("aria-live");
1262
1340
  if (o && o !== "off") return !0;
1263
1341
  const i = e.getAttribute("role");
1264
- return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(At.has(r) || nn(e)) : !1;
1342
+ return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(Mt.has(r) || bn(e)) : !1;
1265
1343
  }
1266
1344
  function Ee(e) {
1267
1345
  var s, c, l;
@@ -1281,33 +1359,63 @@ function Ee(e) {
1281
1359
  const i = X(e);
1282
1360
  if (i !== "generic" && i !== "list" && i !== "table" && i !== "row" && i !== "region" && i !== "navigation" && i !== "main")
1283
1361
  return ((c = e.textContent) == null ? void 0 : c.trim().slice(0, 60)) || "";
1284
- if (i === "generic" && Dt(e)) {
1285
- const d = Nt(e);
1362
+ if (i === "generic" && qt(e)) {
1363
+ const d = Dt(e);
1286
1364
  if (d) return d;
1287
1365
  const u = e.tagName.toLowerCase();
1288
- if (At.has(u) || e.childElementCount === 0)
1366
+ if (Mt.has(u) || e.childElementCount === 0)
1289
1367
  return ((l = e.textContent) == null ? void 0 : l.trim().slice(0, 60)) || "";
1290
1368
  }
1291
1369
  return "";
1292
1370
  }
1293
- function sn(e) {
1294
- return e instanceof HTMLInputElement && e.type === "file" || cn(e) || Mt(e) ? !0 : Dt(e);
1371
+ function gn(e) {
1372
+ return e instanceof HTMLInputElement && e.type === "file" || _n(e) || Ot(e) || Fe(e) ? !0 : qt(e);
1295
1373
  }
1296
- function cn(e) {
1374
+ function Fe(e) {
1375
+ return Nt(e).clickable;
1376
+ }
1377
+ function yn(e) {
1378
+ if (!Fe(e)) return !1;
1379
+ const r = e.ownerDocument;
1380
+ if (typeof r.elementFromPoint != "function") return !0;
1381
+ const n = r.defaultView, a = Array.from(e.getClientRects()).filter(
1382
+ (i) => i.width > 0 && i.height > 0
1383
+ );
1384
+ if (a.length === 0) return !0;
1385
+ let o = !1;
1386
+ for (const i of a) {
1387
+ const s = [
1388
+ [i.left + i.width / 2, i.top + i.height / 2],
1389
+ [i.left + 0.1, i.top + 0.1],
1390
+ [i.right - 0.1, i.top + 0.1],
1391
+ [i.left + 0.1, i.bottom - 0.1],
1392
+ [i.right - 0.1, i.bottom - 0.1]
1393
+ ];
1394
+ for (const [c, l] of s) {
1395
+ if (n && (c < 0 || l < 0 || c > n.innerWidth || l > n.innerHeight))
1396
+ continue;
1397
+ o = !0;
1398
+ const d = r.elementFromPoint(c, l);
1399
+ if (d && (e.contains(d) || d.contains(e))) return !0;
1400
+ }
1401
+ }
1402
+ return !o;
1403
+ }
1404
+ function _n(e) {
1297
1405
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !e.checkValidity() || e.getAttribute("aria-invalid") === "true" : !1;
1298
1406
  }
1299
- function Mt(e) {
1407
+ function Ot(e) {
1300
1408
  return !(e instanceof HTMLInputElement) || e.closest('[role="combobox"]') === null || !(e.type === "hidden" || e.getAttribute("aria-hidden") === "true" || e.tabIndex === -1) ? !1 : e.required || e.getAttribute("aria-required") === "true" || (e.getAttribute("aria-describedby") || "").length > 0;
1301
1409
  }
1302
- function ln(e) {
1410
+ function wn(e) {
1303
1411
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1304
1412
  }
1305
- function dn(e, r) {
1413
+ function kn(e, r) {
1306
1414
  var n, a, o, i;
1307
1415
  if (e) {
1308
1416
  const s = e.getAttribute("id");
1309
1417
  if (s) {
1310
- const u = document.querySelector(`label[for="${ln(s)}"]`);
1418
+ const u = document.querySelector(`label[for="${wn(s)}"]`);
1311
1419
  if ((n = u == null ? void 0 : u.textContent) != null && n.trim()) return u.textContent.trim();
1312
1420
  }
1313
1421
  const c = e.closest("label");
@@ -1324,63 +1432,66 @@ function dn(e, r) {
1324
1432
  }
1325
1433
  return r;
1326
1434
  }
1327
- const un = {
1435
+ const In = {
1328
1436
  script: !0,
1329
1437
  style: !0,
1330
1438
  noscript: !0,
1331
1439
  template: !0
1332
- }, pn = (e, r) => Yr(e, r), mn = (e, r) => {
1440
+ }, vn = (e, r) => dn(e, r), En = (e, r) => {
1333
1441
  var a;
1334
- if (!Mt(e)) return;
1442
+ if (!Ot(e)) return;
1335
1443
  r.controlType = "validation-proxy", r.actionable = !1;
1336
1444
  const n = (a = e.closest('[role="combobox"]')) == null ? void 0 : a.getAttribute("data-ref-id");
1337
1445
  n && (r.forControl = n);
1338
- }, bn = (e, r) => {
1446
+ }, xn = (e, r) => {
1339
1447
  if (r.controlType === "validation-proxy" || r.role !== "combobox" && r.tag !== "select") return;
1340
1448
  r.controlType = "dropdown", r.recommendedAction = "select_option", r.controls = e.getAttribute("aria-controls") || e.getAttribute("aria-owns") || void 0;
1341
1449
  const n = e.getAttribute("aria-expanded");
1342
1450
  r.expanded = n === "true" ? !0 : n === "false" ? !1 : void 0;
1343
- }, hn = (e, r) => {
1451
+ }, Sn = (e, r) => {
1452
+ r.controlType || Fe(e) && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || yn(e) && (r.actionable = !0, r.recommendedAction = "click", r.confidence = Nt(e).confidence));
1453
+ }, Tn = (e, r) => {
1344
1454
  r.tag === "a" && (r.href = ve(e.getAttribute("href")));
1345
- }, fn = (e, r) => {
1455
+ }, Cn = (e, r) => {
1346
1456
  r.tag === "img" && (r.src = ve(e.getAttribute("src")), r.alt = e.getAttribute("alt") || "");
1347
- }, gn = (e, r) => {
1457
+ }, Rn = (e, r) => {
1348
1458
  var a;
1349
1459
  if (r.tag !== "input") return;
1350
1460
  const n = e;
1351
1461
  r.title = e.getAttribute("title") || void 0, n.type === "file" && (r.accept = n.getAttribute("accept") || void 0, r.filesCount = ((a = n.files) == null ? void 0 : a.length) ?? 0);
1352
- }, yn = (e, r) => {
1353
- r.tag !== "img" && r.tag !== "a" || (r.parentRefId = tn(e) || r.parentRefId);
1354
- }, _n = (e, r) => {
1462
+ }, An = (e, r) => {
1463
+ r.tag !== "img" && r.tag !== "a" || (r.parentRefId = pn(e) || r.parentRefId);
1464
+ }, Nn = (e, r) => {
1355
1465
  r.postId = e.getAttribute("data-post-id") || void 0;
1356
- }, wn = (e, r) => {
1466
+ }, Mn = (e, r) => {
1357
1467
  if (r.tag === "a") return;
1358
- const n = rn(e);
1468
+ const n = mn(e);
1359
1469
  n && (r.permalink = ve(n.getAttribute("href")));
1360
- }, kn = (e, r) => {
1470
+ }, Dn = (e, r) => {
1361
1471
  if (r.tag === "img") return;
1362
1472
  const n = Array.from(e.querySelectorAll("img")).map((a) => ve(a.getAttribute("src"))).filter((a) => !!a);
1363
1473
  n.length > 0 && (r.imageUrls = n);
1364
- }, In = (e, r) => [
1365
- pn,
1366
- mn,
1367
- bn,
1368
- hn,
1369
- fn,
1370
- gn,
1371
- yn,
1372
- _n,
1373
- wn,
1374
- kn
1375
- ].forEach((n) => n(e, r)), vn = (e, r, n) => {
1474
+ }, qn = (e, r) => [
1475
+ vn,
1476
+ En,
1477
+ xn,
1478
+ Sn,
1479
+ Tn,
1480
+ Cn,
1481
+ Rn,
1482
+ An,
1483
+ Nn,
1484
+ Mn,
1485
+ Dn
1486
+ ].forEach((n) => n(e, r)), On = (e, r, n) => {
1376
1487
  const a = {
1377
- refId: Rt(e),
1488
+ refId: At(e),
1378
1489
  role: X(e),
1379
1490
  tag: e.tagName.toLowerCase(),
1380
- text: Nt(e, 100)
1491
+ text: Dt(e, 100)
1381
1492
  }, o = Ee(e);
1382
- return o && (a.name = o), (a.tag === "img" || a.tag === "a") && n && (a.parentRefId = n), In(e, a), a;
1383
- }, En = (e, r) => {
1493
+ return o && (a.name = o), (a.tag === "img" || a.tag === "a") && n && (a.parentRefId = n), qn(e, a), a;
1494
+ }, Pn = (e, r) => {
1384
1495
  var o, i, s, c, l, d;
1385
1496
  const n = e.controlType === "dropdown" ? "dropdown" : e.controlType === "validation-proxy" ? "validation-proxy" : e.role, a = [
1386
1497
  [e.name, `"${(o = e.name) == null ? void 0 : o.replace(/"/g, '\\"')}"`],
@@ -1395,6 +1506,7 @@ const un = {
1395
1506
  [e.expanded !== void 0, `expanded=${e.expanded}`],
1396
1507
  [e.controls, `opens="${(c = e.controls) == null ? void 0 : c.replace(/"/g, '\\"')}"`],
1397
1508
  [e.recommendedAction, `use="${e.recommendedAction}"`],
1509
+ [e.confidence === "low", "confidence=low"],
1398
1510
  [e.actionable === !1, "actionable=false"],
1399
1511
  [e.forControl, `forControl="${e.forControl}"`],
1400
1512
  [e.errorMessage, `error="${(l = e.errorMessage) == null ? void 0 : l.replace(/"/g, '\\"')}"`],
@@ -1407,30 +1519,29 @@ const un = {
1407
1519
  `${" ".repeat(r)}- ${n}`,
1408
1520
  ...a.filter(([u]) => u).map(([, u]) => u)
1409
1521
  ].join(" ");
1410
- }, xn = (e) => e.filter(
1522
+ }, Ln = (e) => e.filter(
1411
1523
  (r) => (r.invalid || r.errorMessage !== void 0 || r.validationMessage !== void 0) && r.controlType !== "validation-proxy"
1412
1524
  ).map((r) => ({
1413
- field: dn(
1525
+ field: kn(
1414
1526
  document.querySelector(`[data-ref-id="${r.refId}"]`),
1415
1527
  r.name || r.refId
1416
1528
  ),
1417
1529
  error: r.errorMessage || r.validationMessage || "",
1418
1530
  refId: r.refId
1419
- })), Sn = (...e) => (r) => e.reduce(
1531
+ })), jn = (...e) => (r) => e.reduce(
1420
1532
  (n, a) => n.kind === "reject" ? n : a(n),
1421
1533
  r
1422
- ), Tn = (e) => un[e.el.tagName.toLowerCase()] ? { kind: "reject", el: e.el, depth: e.depth } : e, Cn = (e) => sn(e.el) ? e : { kind: "reject", el: e.el, depth: e.depth }, Rn = (e, r) => (n) => e >= r ? { kind: "reject", el: n.el, depth: n.depth } : n, An = (e) => {
1423
- const r = vn(e.el, e.depth, e.parentRefId);
1534
+ ), Hn = (e) => In[e.el.tagName.toLowerCase()] ? { kind: "reject", el: e.el, depth: e.depth } : e, Un = (e) => gn(e.el) ? e : { kind: "reject", el: e.el, depth: e.depth }, Fn = (e, r) => (n) => e >= r ? { kind: "reject", el: n.el, depth: n.depth } : n, Wn = (e) => {
1535
+ const r = On(e.el, e.depth, e.parentRefId);
1424
1536
  return {
1425
1537
  kind: "emit",
1426
1538
  node: r,
1427
- line: En(r, e.depth),
1428
1539
  children: Array.from(e.el.children),
1429
1540
  childDepth: e.depth + 1,
1430
1541
  childRefId: r.refId
1431
1542
  };
1432
- }, Nn = (e) => e.kind === "emit" ? {
1433
- emitted: { node: e.node, line: e.line },
1543
+ }, $n = (e) => e.kind === "emit" ? {
1544
+ emitted: { node: e.node },
1434
1545
  children: e.children,
1435
1546
  childDepth: e.childDepth,
1436
1547
  childRefId: e.childRefId
@@ -1439,24 +1550,24 @@ const un = {
1439
1550
  children: Array.from(e.el.children),
1440
1551
  childDepth: e.depth,
1441
1552
  childRefId: ""
1442
- }, Dn = (e, r) => {
1443
- const n = [], a = [], o = (i, s, c) => {
1444
- const d = Sn(
1445
- Tn,
1446
- Cn,
1447
- Rn(n.length, r)
1448
- )({ kind: "enter", el: i, depth: s, parentRefId: c }), u = Nn(
1449
- d.kind === "reject" ? d : An(d)
1553
+ }, Gn = (e, r) => {
1554
+ const n = [], a = [], o = [], i = (s, c, l) => {
1555
+ const u = jn(
1556
+ Hn,
1557
+ Un,
1558
+ Fn(n.length, r)
1559
+ )({ kind: "enter", el: s, depth: c, parentRefId: l }), b = $n(
1560
+ u.kind === "reject" ? u : Wn(u)
1450
1561
  );
1451
- u.emitted && (n.push(u.emitted.node), a.push(u.emitted.line));
1452
- for (const h of u.children) {
1562
+ b.emitted && (n.push(b.emitted.node), a.push(s), o.push(c));
1563
+ for (const h of b.children) {
1453
1564
  if (n.length >= r) break;
1454
- o(h, u.childDepth, u.childRefId);
1565
+ i(h, b.childDepth, b.childRefId);
1455
1566
  }
1456
1567
  };
1457
- return o(e, 0, ""), { nodes: n, lines: a };
1568
+ return i(e, 0, ""), { nodes: n, els: a, depths: o };
1458
1569
  };
1459
- function Mn(e) {
1570
+ function Bn(e) {
1460
1571
  let r = !1;
1461
1572
  const n = typeof MutationObserver < "u" && document.body ? new MutationObserver(() => {
1462
1573
  r = !0;
@@ -1478,19 +1589,28 @@ function Mn(e) {
1478
1589
  });
1479
1590
  }
1480
1591
  }
1481
- function qn(e) {
1482
- return zr(), Mn(() => {
1483
- const { nodes: r, lines: n } = document.body ? Dn(document.body, e) : { nodes: [], lines: [] };
1592
+ function Kn(e) {
1593
+ return Qr(), Bn(() => {
1594
+ const { nodes: r, els: n, depths: a } = document.body ? Gn(document.body, e) : { nodes: [], els: [], depths: [] }, o = [];
1595
+ for (let c = 0; c < r.length; c++)
1596
+ r[c].actionable && o.push({
1597
+ el: n[c],
1598
+ confidence: r[c].confidence ?? "high"
1599
+ });
1600
+ const i = on(o);
1601
+ for (let c = 0; c < r.length; c++)
1602
+ r[c].actionable && i.has(n[c]) && (r[c].actionable = !1, delete r[c].recommendedAction, delete r[c].confidence);
1603
+ const s = r.map((c, l) => Pn(c, a[l]));
1484
1604
  return {
1485
1605
  text: [
1486
1606
  `URL: ${window.location.href}`,
1487
1607
  `Title: ${document.title}`,
1488
1608
  "",
1489
- ...n
1609
+ ...s
1490
1610
  ].join(`
1491
1611
  `),
1492
1612
  nodes: r,
1493
- formErrors: xn(r),
1613
+ formErrors: Ln(r),
1494
1614
  url: window.location.href,
1495
1615
  title: document.title,
1496
1616
  viewport: { width: window.innerWidth, height: window.innerHeight }
@@ -1498,8 +1618,8 @@ function qn(e) {
1498
1618
  });
1499
1619
  }
1500
1620
  let Ae = null;
1501
- function qt() {
1502
- return Ae || (Ae = cr()), Ae ?? Promise.resolve();
1621
+ function Pt() {
1622
+ return Ae || (Ae = dr()), Ae ?? Promise.resolve();
1503
1623
  }
1504
1624
  async function xe(e) {
1505
1625
  const r = f.child("runner");
@@ -1508,7 +1628,7 @@ async function xe(e) {
1508
1628
  max_nodes: e == null ? void 0 : e.max_nodes
1509
1629
  });
1510
1630
  try {
1511
- if (await qt(), typeof document > "u" || !document.body)
1631
+ if (await Pt(), typeof document > "u" || !document.body)
1512
1632
  return {
1513
1633
  ok: !1,
1514
1634
  error: {
@@ -1519,7 +1639,7 @@ async function xe(e) {
1519
1639
  };
1520
1640
  const n = {};
1521
1641
  e && (e.max_nodes != null && (n.maxNodes = Number(e.max_nodes)), e.interactive_only != null && (n.interactiveOnly = e.interactive_only));
1522
- const a = sr(n), o = rt(a, "compact-text");
1642
+ const a = lr(n), o = nt(a, "compact-text");
1523
1643
  return r.debug("handleDomSnapshot_result", { status: "ok" }), {
1524
1644
  ok: !0,
1525
1645
  value: { data: a, text: o }
@@ -1535,12 +1655,12 @@ async function xe(e) {
1535
1655
  };
1536
1656
  }
1537
1657
  }
1538
- async function On(e) {
1658
+ async function Vn(e) {
1539
1659
  const r = f.child("runner");
1540
1660
  r.debug("handleDomFormat_start", { format: e.format });
1541
1661
  try {
1542
- await qt();
1543
- const { snapshot: n, format: a } = e, o = rt(n, a);
1662
+ await Pt();
1663
+ const { snapshot: n, format: a } = e, o = nt(n, a);
1544
1664
  return r.debug("handleDomFormat_result", { status: "ok" }), { ok: !0, value: o };
1545
1665
  } catch (n) {
1546
1666
  const a = n instanceof Error ? n.message : String(n);
@@ -1553,47 +1673,47 @@ async function On(e) {
1553
1673
  };
1554
1674
  }
1555
1675
  }
1556
- const Xe = 8 * 1024;
1557
- function Pn(e) {
1676
+ const Qe = 8 * 1024;
1677
+ function Zn(e) {
1558
1678
  let r = "";
1559
- for (let n = 0; n < e.length; n += Xe) {
1560
- const a = e.subarray(n, n + Xe);
1679
+ for (let n = 0; n < e.length; n += Qe) {
1680
+ const a = e.subarray(n, n + Qe);
1561
1681
  for (let o = 0; o < a.length; o++)
1562
1682
  r += String.fromCharCode(a[o]);
1563
1683
  }
1564
1684
  return btoa(r);
1565
1685
  }
1566
- function jn(e) {
1686
+ function zn(e) {
1567
1687
  return e.toLowerCase().split(";")[0].trim();
1568
1688
  }
1569
- function Un(e) {
1689
+ function Xn(e) {
1570
1690
  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.");
1571
1691
  }
1572
- function Ln(e) {
1692
+ function Qn(e) {
1573
1693
  for (let r = 0; r < e.length; r++)
1574
1694
  if (e[r] === 0) return !0;
1575
1695
  return !1;
1576
1696
  }
1577
- function Ot(e) {
1697
+ function Lt(e) {
1578
1698
  return Object.fromEntries(e.headers.entries());
1579
1699
  }
1580
- function Qe(e, r, n) {
1700
+ function Je(e, r, n) {
1581
1701
  return {
1582
1702
  status: e.status,
1583
1703
  ok: e.ok,
1584
- headers: Ot(e),
1585
- body: Pn(r),
1704
+ headers: Lt(e),
1705
+ body: Zn(r),
1586
1706
  bodyEncoding: "base64",
1587
1707
  byteLength: r.length,
1588
1708
  contentType: n,
1589
1709
  finalUrl: e.url
1590
1710
  };
1591
1711
  }
1592
- function Je(e, r, n) {
1712
+ function Ye(e, r, n) {
1593
1713
  return {
1594
1714
  status: e.status,
1595
1715
  ok: e.ok,
1596
- headers: Ot(e),
1716
+ headers: Lt(e),
1597
1717
  body: r,
1598
1718
  bodyEncoding: "text",
1599
1719
  byteLength: new TextEncoder().encode(r).length,
@@ -1601,23 +1721,23 @@ function Je(e, r, n) {
1601
1721
  finalUrl: e.url
1602
1722
  };
1603
1723
  }
1604
- async function Hn(e) {
1605
- const r = e.headers.get("content-type") || "", n = jn(r);
1606
- if (Un(n)) {
1724
+ async function Jn(e) {
1725
+ const r = e.headers.get("content-type") || "", n = zn(r);
1726
+ if (Xn(n)) {
1607
1727
  const o = new Uint8Array(await e.arrayBuffer());
1608
- return Qe(e, o, r);
1728
+ return Je(e, o, r);
1609
1729
  }
1610
1730
  if (!n || n.startsWith("text/")) {
1611
1731
  const o = new Uint8Array(await e.arrayBuffer());
1612
- if (Ln(o))
1613
- return Qe(e, o, r);
1732
+ if (Qn(o))
1733
+ return Je(e, o, r);
1614
1734
  const i = new TextDecoder().decode(o);
1615
- return Je(e, i, r);
1735
+ return Ye(e, i, r);
1616
1736
  }
1617
1737
  const a = await e.text();
1618
- return Je(e, a, r);
1738
+ return Ye(e, a, r);
1619
1739
  }
1620
- async function Fn(e) {
1740
+ async function Yn(e) {
1621
1741
  ee();
1622
1742
  const { url: r, method: n, headers: a, body: o, timeout: i } = e;
1623
1743
  try {
@@ -1631,7 +1751,7 @@ async function Fn(e) {
1631
1751
  };
1632
1752
  o != null && (l.body = typeof o == "string" ? o : String(o));
1633
1753
  const d = await fetch(r, l);
1634
- return clearTimeout(c), { ok: !0, value: await Hn(d) };
1754
+ return clearTimeout(c), { ok: !0, value: await Jn(d) };
1635
1755
  } catch (s) {
1636
1756
  return s instanceof Error && s.name === "AbortError" ? {
1637
1757
  ok: !1,
@@ -1658,7 +1778,7 @@ t.union([
1658
1778
  t.number(),
1659
1779
  t.record(t.unknown())
1660
1780
  ]);
1661
- const Wn = t.union([
1781
+ const ea = t.union([
1662
1782
  t.number(),
1663
1783
  t.record(t.unknown())
1664
1784
  ]);
@@ -1760,14 +1880,14 @@ t.union([
1760
1880
  t.record(t.unknown());
1761
1881
  t.record(t.unknown());
1762
1882
  t.record(t.unknown());
1763
- const $n = t.object({}), Gn = t.union([
1883
+ const ta = t.object({}), ra = t.union([
1764
1884
  t.tuple([t.union([t.object({ text: t.string() }), t.string()])]),
1765
1885
  t.object({ text: t.string().optional(), value: t.string().optional() })
1766
- ]), P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), q = () => t.string().regex(/^(?:f\d+_)?e\d+$/), Bn = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', Fe = (e, r) => {
1886
+ ]), P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), q = () => t.string().regex(/^(?:f\d+_)?e\d+$/), na = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', We = (e, r) => {
1767
1887
  if (e.__invalidPositional !== void 0) {
1768
1888
  r.addIssue({
1769
1889
  code: t.ZodIssueCode.custom,
1770
- message: Bn
1890
+ message: na
1771
1891
  });
1772
1892
  return;
1773
1893
  }
@@ -1775,8 +1895,8 @@ const $n = t.object({}), Gn = t.union([
1775
1895
  code: t.ZodIssueCode.custom,
1776
1896
  message: "Either refId or label is required"
1777
1897
  });
1778
- }, Pt = (e, r) => {
1779
- e.x !== void 0 || e.y !== void 0 || Fe(e, r);
1898
+ }, jt = (e, r) => {
1899
+ e.x !== void 0 || e.y !== void 0 || We(e, r);
1780
1900
  }, C = (e) => t.preprocess(
1781
1901
  (r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
1782
1902
  t.object({
@@ -1784,10 +1904,10 @@ const $n = t.object({}), Gn = t.union([
1784
1904
  refId: q().optional().describe("Element reference ID (e.g. e2)"),
1785
1905
  label: t.string().optional().describe("Human-readable element label"),
1786
1906
  ...e
1787
- }).superRefine(Fe)
1907
+ }).superRefine(We)
1788
1908
  ), re = {
1789
1909
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
1790
- }, H = (e) => t.preprocess(
1910
+ }, U = (e) => t.preprocess(
1791
1911
  (r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
1792
1912
  t.object({
1793
1913
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
@@ -1795,7 +1915,7 @@ const $n = t.object({}), Gn = t.union([
1795
1915
  refId: q().optional().describe("Element reference ID (e.g. e2)"),
1796
1916
  label: t.string().optional().describe("Human-readable element label"),
1797
1917
  ...e
1798
- }).superRefine(Fe)
1918
+ }).superRefine(We)
1799
1919
  );
1800
1920
  t.object({
1801
1921
  path: t.string().describe("File or directory path")
@@ -1822,17 +1942,17 @@ t.object({
1822
1942
  path: t.string().describe("File path to hash"),
1823
1943
  algo: t.string().default("sha256").describe("Hash algorithm (e.g. sha256, md5)")
1824
1944
  });
1825
- const Kn = t.object({
1945
+ const aa = t.object({
1826
1946
  action: t.string().describe("Host action name"),
1827
1947
  params: t.object({}).passthrough().optional().describe("Parameters for the host action")
1828
- }).passthrough(), jt = t.union([
1948
+ }).passthrough(), Ht = t.union([
1829
1949
  t.string(),
1830
1950
  t.number(),
1831
1951
  t.boolean(),
1832
1952
  t.null(),
1833
1953
  t.array(t.unknown()),
1834
1954
  t.record(t.unknown())
1835
- ]), Vn = jt, Ut = t.object({
1955
+ ]), oa = Ht, Ut = t.object({
1836
1956
  url: t.string().describe("URL to fetch"),
1837
1957
  method: t.string().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),
1838
1958
  headers: t.record(t.string()).default({}).describe("Request headers as key-value pairs"),
@@ -1842,30 +1962,30 @@ const Kn = t.object({
1842
1962
  "When true, store binary responses as a handle instead of returning body bytes"
1843
1963
  ),
1844
1964
  options: t.object({}).passthrough().optional().describe("Fetch options")
1845
- }).passthrough(), Zn = t.object({
1965
+ }).passthrough(), ia = t.object({
1846
1966
  duration: P().describe("Duration to sleep in milliseconds")
1847
- }), zn = t.object({}), Xn = t.object({}), Qn = t.object({
1967
+ }), sa = t.object({}), ca = t.object({}), la = t.object({
1848
1968
  url: t.string().describe("URL to navigate to"),
1849
1969
  timeout: P().optional().describe("Navigation timeout in milliseconds"),
1850
1970
  waitUntil: t.enum(["load", "networkidle"]).optional().describe(
1851
1971
  "When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)"
1852
1972
  )
1853
- }), Jn = t.object({}), Yn = t.object({}), ea = t.object({}), ta = t.object({
1973
+ }), da = t.object({}), ua = t.object({}), pa = t.object({}), ma = t.object({
1854
1974
  duration: P().default(1000n).describe("Duration to wait in milliseconds")
1855
- }), ra = C(), na = (e, r) => {
1975
+ }), ba = C(), ha = (e, r) => {
1856
1976
  [e.url, e.path, e.handle].filter(
1857
1977
  (a) => typeof a == "string" && a.length > 0
1858
1978
  ).length !== 1 && r.addIssue({
1859
1979
  code: t.ZodIssueCode.custom,
1860
1980
  message: "Each file entry requires exactly one of url, path, or handle"
1861
1981
  });
1862
- }, Lt = t.object({
1982
+ }, Ft = t.object({
1863
1983
  name: t.string().optional().describe("File name including extension"),
1864
1984
  mimeType: t.string().optional().describe("MIME type (defaults to application/octet-stream)"),
1865
1985
  url: t.string().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
1866
1986
  path: t.string().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
1867
1987
  handle: t.string().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
1868
- }).superRefine(na), Ht = t.discriminatedUnion("kind", [
1988
+ }).superRefine(ha), Wt = t.discriminatedUnion("kind", [
1869
1989
  t.object({
1870
1990
  kind: t.literal("bytes"),
1871
1991
  name: t.string().min(1),
@@ -1878,44 +1998,44 @@ const Kn = t.object({
1878
1998
  name: t.string().min(1),
1879
1999
  mimeType: t.string().optional()
1880
2000
  })
1881
- ]), aa = C({
2001
+ ]), fa = C({
1882
2002
  value: t.string().describe("Value to fill into the element")
1883
- }), oa = C({
1884
- files: t.array(Lt).min(1).describe("Files to attach to the input")
2003
+ }), ga = C({
2004
+ files: t.array(Ft).min(1).describe("Files to attach to the input")
1885
2005
  });
1886
2006
  C({
1887
- files: t.array(Ht).min(1).describe("Resolved files for content-script application")
2007
+ files: t.array(Wt).min(1).describe("Resolved files for content-script application")
1888
2008
  });
1889
- const ia = C({
2009
+ const ya = C({
1890
2010
  text: t.string().describe("Text to type into the element")
1891
- }), sa = C({
2011
+ }), _a = C({
1892
2012
  text: t.string().describe("Text to append into the element")
1893
- }), ca = t.object({
2013
+ }), wa = t.object({
1894
2014
  refId: q().optional().describe(
1895
2015
  "Element reference ID to dispatch the key on (e.g. e2). Omit to dispatch on document."
1896
2016
  ),
1897
2017
  label: t.string().optional().describe("Human-readable element label. Omit to dispatch on document."),
1898
2018
  key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
1899
- }), la = C({
2019
+ }), ka = C({
1900
2020
  value: t.union([
1901
2021
  t.string().describe("Value to select in the dropdown"),
1902
2022
  t.array(t.string()).describe(
1903
2023
  "Values to select in a multiple dropdown (empty array clears selection)"
1904
2024
  )
1905
2025
  ]).describe("Value (string) or values (array) to select in the dropdown")
1906
- }), da = C({
2026
+ }), Ia = C({
1907
2027
  value: t.string().describe(
1908
2028
  "Visible text of the option to select (matched case-insensitively)"
1909
2029
  )
1910
- }), ua = C({
2030
+ }), va = C({
1911
2031
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
1912
- }), pa = t.object({
2032
+ }), Ea = t.object({
1913
2033
  name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
1914
2034
  value: t.string().describe("The `value` of the radio option to check")
1915
- }), ma = C(), ba = t.object({}), ha = C(), fa = t.object({
2035
+ }), xa = C(), Sa = t.object({}), Ta = C(), Ca = t.object({
1916
2036
  direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
1917
2037
  amount: t.number().default(300).describe("Pixels to scroll")
1918
- }), ga = t.preprocess(
2038
+ }), Ra = t.preprocess(
1919
2039
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
1920
2040
  t.object({
1921
2041
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
@@ -1923,28 +2043,28 @@ const ia = C({
1923
2043
  label: t.string().optional().describe("Human-readable element label"),
1924
2044
  x: t.number().optional().describe("X coordinate to scroll to"),
1925
2045
  y: t.number().optional().describe("Y coordinate to scroll to")
1926
- }).superRefine(Pt)
1927
- ), ya = C(), _a = t.object({
2046
+ }).superRefine(jt)
2047
+ ), Aa = C(), Na = t.object({
1928
2048
  selector: t.string().describe("CSS selector to find elements")
1929
- }), wa = t.object({
2049
+ }), Ma = t.object({
1930
2050
  selector: t.string().describe("CSS selector for the root element(s) to introspect"),
1931
2051
  depth: t.number().int().min(0).max(10).default(2).describe("How many descendant levels to include (0 = root only)"),
1932
2052
  includeHidden: t.boolean().default(!0).describe(
1933
2053
  "Include elements hidden by CSS/aria (default true — this tool's purpose is to see what the curated snapshot filters out)"
1934
2054
  )
1935
- }), ka = t.object({
2055
+ }), Da = t.object({
1936
2056
  selector: t.string().describe("CSS selector to wait for"),
1937
2057
  timeout: P().default(30000n).describe("Timeout in milliseconds")
1938
- }), Ia = t.object({
2058
+ }), qa = t.object({
1939
2059
  fields: t.array(t.string()).describe("Array of field names to extract")
1940
- }), va = t.preprocess(
2060
+ }), Oa = t.preprocess(
1941
2061
  (e) => Array.isArray(e) ? { fields: e } : e,
1942
- Ia
1943
- ), Ea = t.union([
2062
+ qa
2063
+ ), Pa = t.union([
1944
2064
  t.number(),
1945
2065
  t.array(t.object({}).passthrough()),
1946
2066
  t.object({}).passthrough()
1947
- ]), xa = t.object({}), g = t.object({
2067
+ ]), La = t.object({}), g = t.object({
1948
2068
  ok: t.literal(!0).describe("Whether the action succeeded"),
1949
2069
  action: t.string().describe("Action identifier (e.g. 'page_fill')"),
1950
2070
  refId: q().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
@@ -1994,7 +2114,7 @@ const ia = C({
1994
2114
  )
1995
2115
  });
1996
2116
  t.union([g, t.null()]);
1997
- const We = t.object({
2117
+ const $e = t.object({
1998
2118
  status: t.number().describe("HTTP response status code"),
1999
2119
  ok: t.boolean().describe("Whether the response status is 2xx"),
2000
2120
  headers: t.record(t.string()).describe("Response headers as key-value pairs"),
@@ -2004,10 +2124,10 @@ const We = t.object({
2004
2124
  byteLength: t.number().describe("Length of the body in bytes"),
2005
2125
  contentType: t.string().describe("Response Content-Type header"),
2006
2126
  finalUrl: t.string().describe("Final URL after redirects")
2007
- }), Ft = t.object({
2127
+ }), $t = t.object({
2008
2128
  data: t.object({}).passthrough().describe("Structured snapshot data"),
2009
2129
  text: t.string().describe("Plain text representation of the snapshot")
2010
- }), Sa = t.object({}), Ta = t.object({
2130
+ }), ja = t.object({}), Ha = t.object({
2011
2131
  tabId: t.number(),
2012
2132
  url: t.string(),
2013
2133
  title: t.string(),
@@ -2016,7 +2136,7 @@ const We = t.object({
2016
2136
  mutationsReady: t.boolean(),
2017
2137
  hint: t.string().optional(),
2018
2138
  recovery: t.array(t.string()).optional()
2019
- }), Ca = jt, Ra = t.object({
2139
+ }), Ua = Ht, Fa = t.object({
2020
2140
  refId: q().describe("Element reference ID (e.g. e2)"),
2021
2141
  role: t.string().describe("ARIA role of the element"),
2022
2142
  tag: t.string().describe("HTML tag name"),
@@ -2052,7 +2172,7 @@ const We = t.object({
2052
2172
  text: t.string().describe(
2053
2173
  "Broad text-first representation of the page, including visible text, form values, and validation/error text"
2054
2174
  ),
2055
- nodes: t.array(Ra).describe(
2175
+ nodes: t.array(Fa).describe(
2056
2176
  "Broad snapshot nodes with refIds where possible; not limited to interactive elements"
2057
2177
  ),
2058
2178
  formErrors: t.array(
@@ -2071,7 +2191,7 @@ const We = t.object({
2071
2191
  observationId: t.string().optional().describe(
2072
2192
  "Opaque ID of the observation lease granted by this snapshot. Pass to subsequent actions to prove they act on fresh observations."
2073
2193
  )
2074
- }), Wt = t.object({
2194
+ }), Gt = t.object({
2075
2195
  refId: q().optional(),
2076
2196
  tag: t.string(),
2077
2197
  role: t.string().optional(),
@@ -2101,9 +2221,9 @@ const We = t.object({
2101
2221
  recommendedAction: t.string().optional(),
2102
2222
  controls: t.string().optional(),
2103
2223
  expanded: t.boolean().optional(),
2104
- children: t.array(t.lazy(() => Wt)).optional().describe("Nested descendants up to `depth`")
2105
- }), Aa = t.object({
2106
- nodes: t.array(Wt),
2224
+ children: t.array(t.lazy(() => Gt)).optional().describe("Nested descendants up to `depth`")
2225
+ }), Wa = t.object({
2226
+ nodes: t.array(Gt),
2107
2227
  url: t.string(),
2108
2228
  title: t.string()
2109
2229
  }), N = t.object({
@@ -2142,7 +2262,7 @@ const We = t.object({
2142
2262
  state: t.string().optional().describe("Window state"),
2143
2263
  alwaysOnTop: t.boolean().optional().describe("Whether the window is always on top"),
2144
2264
  sessionId: t.string().optional().describe("Session ID")
2145
- }).passthrough(), Na = t.array(de), ue = t.object({
2265
+ }).passthrough(), $a = t.array(de), ue = t.object({
2146
2266
  name: t.string().describe("Cookie name"),
2147
2267
  value: t.string().describe("Cookie value"),
2148
2268
  domain: t.string().optional().describe("Cookie domain"),
@@ -2154,9 +2274,9 @@ const We = t.object({
2154
2274
  session: t.boolean().optional().describe("Whether the cookie is a session cookie"),
2155
2275
  expirationDate: t.number().optional().describe("Expiration date as Unix timestamp"),
2156
2276
  storeId: t.string().optional().describe("Store ID")
2157
- }).nullable(), $t = t.array(
2277
+ }).nullable(), Bt = t.array(
2158
2278
  ue.nullable().unwrap()
2159
- ), Da = t.object({
2279
+ ), Ga = t.object({
2160
2280
  id: t.string().describe("Bookmark ID"),
2161
2281
  parentId: t.string().optional().describe("Parent folder ID"),
2162
2282
  index: t.number().optional().describe("Bookmark index"),
@@ -2165,30 +2285,30 @@ const We = t.object({
2165
2285
  dateAdded: t.number().optional().describe("Date added"),
2166
2286
  dateGroupModified: t.number().optional().describe("Date group modified"),
2167
2287
  children: t.array(t.object({ id: t.string() }).passthrough()).optional().describe("Child bookmarks")
2168
- }).passthrough(), pe = t.array(Da), Ma = t.object({
2288
+ }).passthrough(), pe = t.array(Ga), Ba = t.object({
2169
2289
  id: t.string().describe("History item ID"),
2170
2290
  url: t.string().optional().describe("URL"),
2171
2291
  title: t.string().optional().describe("Title"),
2172
2292
  lastVisitTime: t.number().optional().describe("Last visit time"),
2173
2293
  visitCount: t.number().optional().describe("Visit count"),
2174
2294
  typedCount: t.number().optional().describe("Typed count")
2175
- }).passthrough(), $e = t.array(Ma), qa = t.object({
2295
+ }).passthrough(), Ge = t.array(Ba), Ka = t.object({
2176
2296
  frameId: t.number().describe("Frame ID"),
2177
2297
  result: t.unknown().optional().describe("Script result")
2178
- }), Oa = t.array(qa), Gt = t.string(), Bt = t.boolean(), Pa = t.union([t.string(), t.number()]), ja = t.boolean(), Se = t.object({
2298
+ }), Va = t.array(Ka), Kt = t.string(), Vt = t.boolean(), Za = t.union([t.string(), t.number()]), za = t.boolean(), Se = t.object({
2179
2299
  id: t.number().optional().describe("Group ID"),
2180
2300
  collapsed: t.boolean().optional().describe("Whether the group is collapsed"),
2181
2301
  color: t.string().optional().describe("Group color"),
2182
2302
  title: t.string().optional().describe("Group title"),
2183
2303
  windowId: t.number().optional().describe("Window ID")
2184
- }).passthrough(), Ua = t.array(Se), La = t.object({
2304
+ }).passthrough(), Xa = t.array(Se), Qa = t.object({
2185
2305
  lastModified: t.number().optional().describe("Last modified time"),
2186
2306
  tab: N.optional().describe("Tab info"),
2187
2307
  window: de.optional().describe("Window info")
2188
- }).passthrough(), Ge = t.array(La), Ha = t.object({
2308
+ }).passthrough(), Be = t.array(Qa), Ja = t.object({
2189
2309
  deviceName: t.string().optional().describe("Device name"),
2190
- sessions: Ge.optional().describe("Sessions")
2191
- }).passthrough(), Fa = t.array(Ha), Wa = t.object({
2310
+ sessions: Be.optional().describe("Sessions")
2311
+ }).passthrough(), Ya = t.array(Ja), eo = t.object({
2192
2312
  id: t.number().optional().describe("Download ID"),
2193
2313
  url: t.string().optional().describe("Download URL"),
2194
2314
  filename: t.string().optional().describe("Filename"),
@@ -2206,63 +2326,63 @@ const We = t.object({
2206
2326
  referrer: t.string().optional().describe("Referrer URL"),
2207
2327
  byExtensionId: t.string().optional().describe("Extension ID"),
2208
2328
  byExtensionName: t.string().optional().describe("Extension name")
2209
- }).passthrough(), Kt = t.array(Wa), $a = t.number(), Ga = t.object({
2329
+ }).passthrough(), Zt = t.array(eo), to = t.number(), ro = t.object({
2210
2330
  archName: t.string().describe("CPU architecture"),
2211
2331
  modelName: t.string().describe("CPU model"),
2212
2332
  numOfProcessors: t.number().describe("Number of processors"),
2213
2333
  features: t.array(t.string()).describe("CPU features")
2214
- }), Ba = t.object({
2334
+ }), no = t.object({
2215
2335
  capacity: t.number().describe("Total memory capacity"),
2216
2336
  availableCapacity: t.number().describe("Available memory capacity")
2217
- }), Ka = t.array(
2337
+ }), ao = t.array(
2218
2338
  t.object({
2219
2339
  id: t.string().describe("Storage ID"),
2220
2340
  name: t.string().describe("Storage name"),
2221
2341
  type: t.string().describe("Storage type"),
2222
2342
  capacity: t.number().describe("Storage capacity")
2223
2343
  })
2224
- ), Va = C(), Za = C(), za = C({
2344
+ ), oo = C(), io = C(), so = C({
2225
2345
  value: t.string().optional().describe("Value to fill into the element")
2226
- }), Xa = C({
2346
+ }), co = C({
2227
2347
  text: t.string().optional().describe("Text to type into the element")
2228
- }), Qa = t.object({
2348
+ }), lo = t.object({
2229
2349
  key: t.string().optional().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
2230
- }), Ja = C({
2350
+ }), uo = C({
2231
2351
  value: t.string().optional().describe("Value to select in the dropdown")
2232
- }), Ya = C({
2352
+ }), po = C({
2233
2353
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
2234
- }), eo = C(), to = t.object({}), ro = t.object({
2354
+ }), mo = C(), bo = t.object({}), ho = t.object({
2235
2355
  direction: t.string().optional().describe("Scroll direction: up, down, left, or right"),
2236
2356
  amount: t.number().optional().describe("Pixels to scroll")
2237
- }), no = C(), ao = C({
2357
+ }), fo = C(), go = C({
2238
2358
  text: t.string().optional().describe("Text to append into the element")
2239
- }), oo = t.object({}), io = t.object({}), so = t.object({
2359
+ }), yo = t.object({}), _o = t.object({}), wo = t.object({
2240
2360
  duration: P().default(1000n).describe("Duration to wait in milliseconds")
2241
- }), co = t.object({
2361
+ }), ko = t.object({
2242
2362
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
2243
2363
  max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
2244
- }), lo = t.object({
2364
+ }), Io = t.object({
2245
2365
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
2246
2366
  max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
2247
- }), uo = t.object({
2367
+ }), vo = t.object({
2248
2368
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
2249
2369
  max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
2250
- }), po = t.object({
2370
+ }), Eo = t.object({
2251
2371
  interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
2252
2372
  max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
2253
- }), mo = t.object({
2373
+ }), xo = t.object({
2254
2374
  snapshot: t.object({}).passthrough().describe("Raw DOM snapshot data to format"),
2255
2375
  format: t.string().optional().describe("Output format (e.g. markdown, html)")
2256
- }), bo = t.object({
2376
+ }), So = t.object({
2257
2377
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2258
2378
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2259
- }).passthrough(), ho = t.object({
2379
+ }).passthrough(), To = t.object({
2260
2380
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2261
2381
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2262
- }).passthrough(), fo = t.object({
2382
+ }).passthrough(), Co = t.object({
2263
2383
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2264
2384
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2265
- }).passthrough(), go = t.object({
2385
+ }).passthrough(), Ro = t.object({
2266
2386
  role: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by ARIA role"),
2267
2387
  tag: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by HTML tag"),
2268
2388
  text: t.string().optional().describe("Filter by text content (case-insensitive substring)"),
@@ -2271,45 +2391,45 @@ const We = t.object({
2271
2391
  href: t.string().optional().describe("Filter by href pattern (case-insensitive substring)"),
2272
2392
  src: t.string().optional().describe("Filter by src pattern (case-insensitive substring)"),
2273
2393
  limit: t.number().positive().optional().describe("Maximum filtered nodes to return")
2274
- }).passthrough(), Vt = t.object({
2275
- filter: go.optional().describe(
2394
+ }).passthrough(), zt = t.object({
2395
+ filter: Ro.optional().describe(
2276
2396
  "Semantic filter criteria"
2277
2397
  ),
2278
2398
  max_nodes: t.number().optional().describe("Maximum nodes to collect before filtering")
2279
- }).passthrough(), yo = Vt.extend({
2399
+ }).passthrough(), Ao = zt.extend({
2280
2400
  tabId: t.number().describe("Tab ID")
2281
- }), _o = t.object({
2401
+ }), No = t.object({
2282
2402
  key: t.string().describe("Storage key to retrieve")
2283
- }), wo = t.object({
2403
+ }), Mo = t.object({
2284
2404
  key: t.string().describe("Storage key to set"),
2285
2405
  value: t.string().describe("Value to store")
2286
- }), ko = t.object({
2406
+ }), Do = t.object({
2287
2407
  key: t.string().describe("Storage key to delete")
2288
- }), Io = t.object({}), vo = t.object({
2408
+ }), qo = t.object({}), Oo = t.object({
2289
2409
  items: t.record(t.string()).describe("Record of key-value string pairs to store")
2290
- }), Eo = t.preprocess((e) => e !== null && typeof e == "object" && !Array.isArray(e) && !("items" in e) ? { items: e } : e, vo), xo = t.object({
2410
+ }), Po = t.preprocess((e) => e !== null && typeof e == "object" && !Array.isArray(e) && !("items" in e) ? { items: e } : e, Oo), Lo = t.object({
2291
2411
  keys: t.array(t.string()).describe("Array of storage keys to retrieve"),
2292
2412
  defaults: t.record(t.string()).optional().describe("Default string values for missing keys")
2293
- }), So = t.preprocess(
2413
+ }), jo = t.preprocess(
2294
2414
  (e) => Array.isArray(e) ? { keys: e } : e,
2295
- xo
2296
- ), To = t.object({}), Co = t.object({
2415
+ Lo
2416
+ ), Ho = t.object({}), Uo = t.object({
2297
2417
  keys: t.array(t.string()).describe("Array of storage keys to delete")
2298
- }), Ro = t.preprocess(
2418
+ }), Fo = t.preprocess(
2299
2419
  (e) => Array.isArray(e) ? { keys: e } : e,
2300
- Co
2301
- ), Ao = t.object({}), No = t.object({
2420
+ Uo
2421
+ ), Wo = t.object({}), $o = t.object({
2302
2422
  active: t.boolean().optional().describe("Whether the tabs are active"),
2303
2423
  currentWindow: t.boolean().optional().describe("Whether the tabs are in the current window"),
2304
2424
  url: t.string().optional().describe("URL pattern to match tabs against")
2305
- }).passthrough(), Be = No, Zt = t.preprocess(
2425
+ }).passthrough(), Ke = $o, Xt = t.preprocess(
2306
2426
  (e) => typeof e == "string" ? { url: e } : e,
2307
2427
  t.object({
2308
2428
  url: t.string().optional().describe("URL to open in the new tab"),
2309
2429
  active: t.boolean().optional().describe("Whether to focus the new tab"),
2310
2430
  waitForReady: t.boolean().optional().describe("Wait for page load and content-script readiness")
2311
2431
  })
2312
- ), zt = t.union([
2432
+ ), Qt = t.union([
2313
2433
  t.number(),
2314
2434
  t.array(
2315
2435
  t.object({
@@ -2323,15 +2443,15 @@ const We = t.object({
2323
2443
  tabId: t.number().optional(),
2324
2444
  tab_id: t.number().optional()
2325
2445
  }).passthrough()
2326
- ]), Xt = zt, Do = zt, Mo = H(), qo = H({
2446
+ ]), Jt = Qt, Go = Qt, Bo = U(), Ko = U({
2327
2447
  value: t.string().describe("Value to fill into the element")
2328
- }), Oo = H({
2329
- files: t.array(Lt).min(1).describe("Files to attach to the input")
2448
+ }), Vo = U({
2449
+ files: t.array(Ft).min(1).describe("Files to attach to the input")
2330
2450
  });
2331
- H({
2332
- files: t.array(Ht).min(1).describe("Resolved files for content-script application")
2451
+ U({
2452
+ files: t.array(Wt).min(1).describe("Resolved files for content-script application")
2333
2453
  });
2334
- const Po = t.preprocess(
2454
+ const Zo = t.preprocess(
2335
2455
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
2336
2456
  t.object({
2337
2457
  __invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
@@ -2340,59 +2460,59 @@ const Po = t.preprocess(
2340
2460
  label: t.string().optional().describe("Human-readable element label"),
2341
2461
  x: t.number().optional().describe("X coordinate to scroll to"),
2342
2462
  y: t.number().optional().describe("Y coordinate to scroll to")
2343
- }).superRefine(Pt)
2344
- ), jo = H({
2463
+ }).superRefine(jt)
2464
+ ), zo = U({
2345
2465
  text: t.string().describe("Text to type into the element")
2346
- }), Uo = t.object({
2466
+ }), Xo = t.object({
2347
2467
  ...re,
2348
2468
  key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
2349
- }), Lo = H({
2469
+ }), Qo = U({
2350
2470
  value: t.string().describe("Value to select in the dropdown")
2351
- }), Ho = H({
2471
+ }), Jo = U({
2352
2472
  value: t.string().describe(
2353
2473
  "Visible text of the option to select (matched case-insensitively)"
2354
2474
  )
2355
- }), Fo = H({
2475
+ }), Yo = U({
2356
2476
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
2357
- }), Wo = H(), $o = H(), Go = t.object({
2477
+ }), ei = U(), ti = U(), ri = t.object({
2358
2478
  ...re,
2359
2479
  name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
2360
2480
  value: t.string().describe("The `value` of the radio option to check")
2361
- }), Bo = t.object({
2481
+ }), ni = t.object({
2362
2482
  ...re
2363
- }), Ko = t.object({
2483
+ }), ai = t.object({
2364
2484
  ...re,
2365
2485
  direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
2366
2486
  amount: t.number().default(300).describe("Pixels to scroll")
2367
- }), Vo = H(), Zo = t.object({
2487
+ }), oi = U(), ii = t.object({
2368
2488
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2369
2489
  script: t.string().optional().describe("Script to evaluate"),
2370
2490
  code: t.string().optional().describe("Alternative script code"),
2371
2491
  js: t.string().optional().describe("Alternative JS code")
2372
- }).passthrough(), zo = t.object({
2492
+ }).passthrough(), si = t.object({
2373
2493
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
2374
- }).passthrough(), Xo = t.object({
2494
+ }).passthrough(), ci = t.object({
2375
2495
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
2376
- }).passthrough(), Qo = t.object({
2496
+ }).passthrough(), li = t.object({
2377
2497
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2378
2498
  timeout: t.number().optional().describe("Timeout in milliseconds")
2379
- }).passthrough(), Jo = t.object({
2499
+ }).passthrough(), di = t.object({
2380
2500
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2381
2501
  url: t.string().optional().describe("URL to fetch"),
2382
2502
  options: t.object({}).passthrough().optional().describe("Fetch options")
2383
- }).passthrough(), Yo = t.object({
2503
+ }).passthrough(), ui = t.object({
2384
2504
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2385
2505
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2386
2506
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2387
- }).passthrough(), ei = t.object({
2507
+ }).passthrough(), pi = t.object({
2388
2508
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2389
2509
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2390
2510
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2391
- }).passthrough(), ti = t.object({
2511
+ }).passthrough(), mi = t.object({
2392
2512
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
2393
2513
  max_nodes: t.number().optional().describe("Maximum nodes to include"),
2394
2514
  options: t.object({}).passthrough().optional().describe("Snapshot options")
2395
- }).passthrough(), ri = t.object({
2515
+ }).passthrough(), bi = t.object({
2396
2516
  ...re,
2397
2517
  url: t.string().describe("URL to navigate the tab to"),
2398
2518
  timeout: P().optional().describe("Navigation timeout in milliseconds"),
@@ -2403,19 +2523,19 @@ const Po = t.preprocess(
2403
2523
  function B(e) {
2404
2524
  return document.querySelector(`[data-ref-id='${CSS.escape(e)}']`);
2405
2525
  }
2406
- function ni(e) {
2526
+ function hi(e) {
2407
2527
  if (typeof e == "string")
2408
2528
  return q().safeParse(e).success ? e : void 0;
2409
- const r = L(e), n = typeof r.refId == "string" ? r.refId : typeof r.ref_id == "string" ? r.ref_id : void 0;
2529
+ const r = H(e), n = typeof r.refId == "string" ? r.refId : typeof r.ref_id == "string" ? r.ref_id : void 0;
2410
2530
  if (!(n && !q().safeParse(n).success))
2411
2531
  return n;
2412
2532
  }
2413
- const ai = {
2533
+ const fi = {
2414
2534
  message: "Content script error",
2415
2535
  code: "E_CONTENT_SCRIPT",
2416
2536
  category: "resource"
2417
2537
  };
2418
- function oi(e, r = ai) {
2538
+ function gi(e, r = fi) {
2419
2539
  if (typeof e == "string")
2420
2540
  return {
2421
2541
  message: e || r.message,
@@ -2435,13 +2555,13 @@ function oi(e, r = ai) {
2435
2555
  }
2436
2556
  return { ...r };
2437
2557
  }
2438
- function Ke(e) {
2558
+ function Ve(e) {
2439
2559
  return e && typeof e == "object" && e.ok === !1 ? {
2440
2560
  ok: !1,
2441
- error: oi(e.error)
2561
+ error: gi(e.error)
2442
2562
  } : { ok: !0, value: e && typeof e == "object" && "value" in e ? e.value : e };
2443
2563
  }
2444
- const se = f.child("runner"), ii = [
2564
+ const se = f.child("runner"), yi = [
2445
2565
  "main_frame",
2446
2566
  "sub_frame",
2447
2567
  "stylesheet",
@@ -2451,12 +2571,12 @@ const se = f.child("runner"), ii = [
2451
2571
  "media",
2452
2572
  "other"
2453
2573
  ];
2454
- class si {
2574
+ class _i {
2455
2575
  constructor(r) {
2456
- j(this, "inFlight", /* @__PURE__ */ new Map());
2457
- j(this, "onBeforeRequest", null);
2458
- j(this, "onCompleted", null);
2459
- j(this, "onErrorOccurred", null);
2576
+ L(this, "inFlight", /* @__PURE__ */ new Map());
2577
+ L(this, "onBeforeRequest", null);
2578
+ L(this, "onCompleted", null);
2579
+ L(this, "onErrorOccurred", null);
2460
2580
  this.tabId = r;
2461
2581
  }
2462
2582
  start() {
@@ -2469,7 +2589,7 @@ class si {
2469
2589
  const n = {
2470
2590
  tabId: this.tabId,
2471
2591
  urls: ["<all_urls>"],
2472
- types: ii
2592
+ types: yi
2473
2593
  };
2474
2594
  this.onBeforeRequest = (o) => {
2475
2595
  o.tabId === this.tabId && this.inFlight.set(o.requestId, Date.now());
@@ -2488,7 +2608,7 @@ class si {
2488
2608
  for (; Date.now() < a; ) {
2489
2609
  if (this.inFlight.size === 0) {
2490
2610
  if (await new Promise(
2491
- (s) => setTimeout(s, Tt)
2611
+ (s) => setTimeout(s, Ct)
2492
2612
  ), this.inFlight.size === 0) {
2493
2613
  se.debug("networkTracker_idle", { tabId: this.tabId, traceId: n });
2494
2614
  return;
@@ -2512,10 +2632,10 @@ class si {
2512
2632
  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(), se.debug("networkTracker_disposed", { tabId: this.tabId }));
2513
2633
  }
2514
2634
  }
2515
- function ci(e) {
2635
+ function wi(e) {
2516
2636
  return new Promise((r) => setTimeout(r, e));
2517
2637
  }
2518
- async function Qt(e) {
2638
+ async function Yt(e) {
2519
2639
  var n;
2520
2640
  ee();
2521
2641
  const r = window.chrome;
@@ -2559,12 +2679,12 @@ async function Te(e, r = 3e3) {
2559
2679
  const d = await Promise.race([
2560
2680
  a.tabs.sendMessage(e, { action: "ping" }),
2561
2681
  new Promise(
2562
- (h, b) => setTimeout(
2563
- () => b(new Error("Timeout waiting for content-script ping")),
2682
+ (b, h) => setTimeout(
2683
+ () => h(new Error("Timeout waiting for content-script ping")),
2564
2684
  l
2565
2685
  )
2566
2686
  )
2567
- ]), u = Ke(d);
2687
+ ]), u = Ve(d);
2568
2688
  return u.ok ? (n.debug("pingTabContentScript_success", { tabId: e, result: d }), { ok: !0, value: { ok: !0 } }) : (n.debug("pingTabContentScript_rejected", {
2569
2689
  tabId: e,
2570
2690
  error: u.error
@@ -2572,7 +2692,7 @@ async function Te(e, r = 3e3) {
2572
2692
  } catch (d) {
2573
2693
  const u = (d instanceof Error ? d.message : String(d)) || "";
2574
2694
  if (i = u, n.debug("pingTabContentScript_retry", { tabId: e, error: u }), u.includes("Could not establish connection") || u.includes("Receiving end does not exist") || u.includes("message port closed before a response was received")) {
2575
- await ci(Math.min(Pr, o - Date.now()));
2695
+ await wi(Math.min(jr, o - Date.now()));
2576
2696
  continue;
2577
2697
  }
2578
2698
  if (u.includes("Timeout waiting for content-script ping"))
@@ -2591,8 +2711,8 @@ async function Te(e, r = 3e3) {
2591
2711
  error: ge(e, s)
2592
2712
  };
2593
2713
  }
2594
- async function Jt(e, r = 3e4, n) {
2595
- var h;
2714
+ async function er(e, r = 3e4, n) {
2715
+ var b;
2596
2716
  ee();
2597
2717
  const a = f.child("runner"), o = typeof e == "number" ? e : null, i = n == null ? void 0 : n.preNavigationUrl, s = n == null ? void 0 : n.getNavSawLoading;
2598
2718
  a.debug("waitForTabLoad_start", {
@@ -2602,7 +2722,7 @@ async function Jt(e, r = 3e4, n) {
2602
2722
  runId: n == null ? void 0 : n.runId
2603
2723
  });
2604
2724
  const c = window.chrome;
2605
- if (!((h = c == null ? void 0 : c.runtime) != null && h.id))
2725
+ if (!((b = c == null ? void 0 : c.runtime) != null && b.id))
2606
2726
  return {
2607
2727
  ok: !1,
2608
2728
  error: {
@@ -2619,41 +2739,41 @@ async function Jt(e, r = 3e4, n) {
2619
2739
  code: "E_MISSING_PARAM"
2620
2740
  }
2621
2741
  };
2622
- const l = (b, S) => {
2623
- if (b.status !== "complete") return !1;
2742
+ const l = (h, S) => {
2743
+ if (h.status !== "complete") return !1;
2624
2744
  if (i === void 0) return !0;
2625
- const I = b.url !== i;
2745
+ const I = h.url !== i;
2626
2746
  return S || I;
2627
- }, d = (b) => i !== void 0 && typeof b == "string" && b.length > 0 && b !== i, u = (n == null ? void 0 : n.loadGraceMs) ?? 5e3;
2747
+ }, d = (h) => i !== void 0 && typeof h == "string" && h.length > 0 && h !== i, u = (n == null ? void 0 : n.loadGraceMs) ?? 5e3;
2628
2748
  try {
2629
- return await new Promise((b, S) => {
2630
- let I = !1, A = (s == null ? void 0 : s()) ?? !1, M = null;
2749
+ return await new Promise((h, S) => {
2750
+ let I = !1, A = (s == null ? void 0 : s()) ?? !1, D = null;
2631
2751
  const Y = () => {
2632
2752
  try {
2633
- c.tabs.onUpdated.removeListener(Ze);
2753
+ c.tabs.onUpdated.removeListener(ze);
2634
2754
  } catch {
2635
2755
  }
2636
- M && clearTimeout(M);
2637
- }, W = (D) => {
2638
- I || (I = !0, Y(), D());
2756
+ D && clearTimeout(D);
2757
+ }, W = (M) => {
2758
+ I || (I = !0, Y(), M());
2639
2759
  }, R = () => {
2640
2760
  s != null && s() && (A = !0);
2641
- }, _ = (D) => {
2642
- M || I || d(D) && (M = setTimeout(() => {
2761
+ }, _ = (M) => {
2762
+ D || I || d(M) && (D = setTimeout(() => {
2643
2763
  a.debug("waitForTabLoad_grace_settle", {
2644
2764
  tabId: o,
2645
- url: D,
2765
+ url: M,
2646
2766
  graceMs: u,
2647
2767
  runId: n == null ? void 0 : n.runId
2648
- }), W(b);
2768
+ }), W(h);
2649
2769
  }, u));
2650
2770
  }, G = () => {
2651
- R(), c.tabs.get(o).then((D) => {
2652
- l(D, A) ? W(b) : _(D.url);
2771
+ R(), c.tabs.get(o).then((M) => {
2772
+ l(M, A) ? W(h) : _(M.url);
2653
2773
  }).catch(() => {
2654
2774
  });
2655
- }, Ze = (D, oe) => {
2656
- D === o && (oe.status === "loading" && (A = !0, a.debug("waitForTabLoad_status", {
2775
+ }, ze = (M, oe) => {
2776
+ M === o && (oe.status === "loading" && (A = !0, a.debug("waitForTabLoad_status", {
2657
2777
  tabId: o,
2658
2778
  status: "loading",
2659
2779
  runId: n == null ? void 0 : n.runId
@@ -2663,15 +2783,15 @@ async function Jt(e, r = 3e4, n) {
2663
2783
  runId: n == null ? void 0 : n.runId
2664
2784
  }), _(oe.url)), oe.status === "complete" && G());
2665
2785
  };
2666
- c.tabs.onUpdated.addListener(Ze), c.tabs.get(o).then((D) => {
2667
- R(), D.status === "loading" && (A = !0), a.debug("waitForTabLoad_initial_status", {
2786
+ c.tabs.onUpdated.addListener(ze), c.tabs.get(o).then((M) => {
2787
+ R(), M.status === "loading" && (A = !0), a.debug("waitForTabLoad_initial_status", {
2668
2788
  tabId: o,
2669
- status: D.status,
2670
- url: D.url,
2789
+ status: M.status,
2790
+ url: M.url,
2671
2791
  runId: n == null ? void 0 : n.runId
2672
- }), l(D, A) ? W(b) : _(D.url);
2673
- }).catch((D) => {
2674
- W(() => S(D));
2792
+ }), l(M, A) ? W(h) : _(M.url);
2793
+ }).catch((M) => {
2794
+ W(() => S(M));
2675
2795
  }), setTimeout(() => {
2676
2796
  W(() => S(new Error("Timeout waiting for tab load")));
2677
2797
  }, r);
@@ -2680,8 +2800,8 @@ async function Jt(e, r = 3e4, n) {
2680
2800
  status: "complete",
2681
2801
  runId: n == null ? void 0 : n.runId
2682
2802
  }), { ok: !0, value: !0 };
2683
- } catch (b) {
2684
- if (b instanceof Error && b.message === "Timeout waiting for tab load") {
2803
+ } catch (h) {
2804
+ if (h instanceof Error && h.message === "Timeout waiting for tab load") {
2685
2805
  let S = "";
2686
2806
  try {
2687
2807
  S = (await c.tabs.get(o)).url || "";
@@ -2702,11 +2822,11 @@ async function Jt(e, r = 3e4, n) {
2702
2822
  }
2703
2823
  };
2704
2824
  }
2705
- return ke(b);
2825
+ return ke(h);
2706
2826
  }
2707
2827
  }
2708
- async function Ve(e) {
2709
- var A, M, Y, W;
2828
+ async function Ze(e) {
2829
+ var A, D, Y, W;
2710
2830
  const {
2711
2831
  tabId: r,
2712
2832
  url: n,
@@ -2720,7 +2840,7 @@ async function Ve(e) {
2720
2840
  const u = (R, _) => {
2721
2841
  R === r && _.status === "loading" && (d = !0);
2722
2842
  };
2723
- (M = (A = l == null ? void 0 : l.tabs) == null ? void 0 : A.onUpdated) == null || M.addListener(u);
2843
+ (D = (A = l == null ? void 0 : l.tabs) == null ? void 0 : A.onUpdated) == null || D.addListener(u);
2724
2844
  try {
2725
2845
  const R = await x("chrome_tabs_update", [
2726
2846
  r,
@@ -2728,7 +2848,7 @@ async function Ve(e) {
2728
2848
  ]);
2729
2849
  if (!R.ok)
2730
2850
  return v(R);
2731
- const _ = await Jt(r, i, {
2851
+ const _ = await er(r, i, {
2732
2852
  preNavigationUrl: a,
2733
2853
  getNavSawLoading: () => d,
2734
2854
  runId: s
@@ -2739,9 +2859,9 @@ async function Ve(e) {
2739
2859
  } finally {
2740
2860
  (W = (Y = l == null ? void 0 : l.tabs) == null ? void 0 : Y.onUpdated) == null || W.removeListener(u);
2741
2861
  }
2742
- const h = await x("chrome_tabs_get", [r]);
2743
- if (h.ok && h.value) {
2744
- const R = N.safeParse(h.value);
2862
+ const b = await x("chrome_tabs_get", [r]);
2863
+ if (b.ok && b.value) {
2864
+ const R = N.safeParse(b.value);
2745
2865
  if (R.success) {
2746
2866
  const _ = R.data.url ?? "";
2747
2867
  if (_ && !_.startsWith("http:") && !_.startsWith("https:"))
@@ -2759,10 +2879,10 @@ async function Ve(e) {
2759
2879
  }
2760
2880
  }
2761
2881
  if (o === "networkidle") {
2762
- const R = new si(r);
2882
+ const R = new _i(r);
2763
2883
  try {
2764
2884
  f.debug(`${c}_network_idle_start`, { traceId: s, tabId: r }), R.start();
2765
- const _ = Math.max(Tt * 2, i);
2885
+ const _ = Math.max(Ct * 2, i);
2766
2886
  await R.waitForIdle(_, s);
2767
2887
  } catch (_) {
2768
2888
  throw f.debug(`${c}_network_idle_timeout`, {
@@ -2778,10 +2898,10 @@ async function Ve(e) {
2778
2898
  R.dispose(), f.debug(`${c}_network_idle_done`, { traceId: s, tabId: r });
2779
2899
  }
2780
2900
  }
2781
- const b = await Te(r, i);
2782
- if (!b.ok)
2783
- return v(b);
2784
- await new Promise((R) => setTimeout(R, jr));
2901
+ const h = await Te(r, i);
2902
+ if (!h.ok)
2903
+ return v(h);
2904
+ await new Promise((R) => setTimeout(R, Hr));
2785
2905
  const S = await x("chrome_tabs_get", [r]), I = N.safeParse(v(S));
2786
2906
  if (!I.success)
2787
2907
  throw y(
@@ -2796,7 +2916,7 @@ m({
2796
2916
  namespace: "storage",
2797
2917
  name: "get",
2798
2918
  description: "Get a value from localStorage",
2799
- params: _o,
2919
+ params: No,
2800
2920
  returns: t.string().nullable(),
2801
2921
  fields: ["key"],
2802
2922
  aliases: [{ namespace: "web.storage", name: "get", fields: ["key"] }],
@@ -2820,7 +2940,7 @@ m({
2820
2940
  namespace: "storage",
2821
2941
  name: "set",
2822
2942
  description: "Set a value in localStorage",
2823
- params: wo,
2943
+ params: Mo,
2824
2944
  returns: t.null(),
2825
2945
  fields: ["key", "value"],
2826
2946
  aliases: [
@@ -2852,7 +2972,7 @@ m({
2852
2972
  namespace: "storage",
2853
2973
  name: "delete",
2854
2974
  description: "Delete a key from localStorage",
2855
- params: ko,
2975
+ params: Do,
2856
2976
  returns: t.null(),
2857
2977
  fields: ["key"],
2858
2978
  aliases: [{ namespace: "web.storage", name: "delete", fields: ["key"] }],
@@ -2876,7 +2996,7 @@ m({
2876
2996
  namespace: "storage",
2877
2997
  name: "list",
2878
2998
  description: "List all localStorage keys",
2879
- params: Io,
2999
+ params: qo,
2880
3000
  returns: t.array(t.string()),
2881
3001
  aliases: [{ namespace: "web.storage", name: "list" }],
2882
3002
  owner: "main-thread",
@@ -2899,11 +3019,11 @@ m({
2899
3019
  namespace: "storage",
2900
3020
  name: "set_many",
2901
3021
  description: "Set multiple values in localStorage",
2902
- params: Eo,
3022
+ params: Po,
2903
3023
  returns: t.null(),
2904
3024
  owner: "main-thread",
2905
3025
  handler: async (e, r) => {
2906
- const n = L(e.items);
3026
+ const n = H(e.items);
2907
3027
  for (const a of Object.keys(n)) {
2908
3028
  const o = n[a];
2909
3029
  localStorage.setItem(
@@ -2931,11 +3051,11 @@ m({
2931
3051
  namespace: "storage",
2932
3052
  name: "get_many",
2933
3053
  description: "Get multiple values from localStorage",
2934
- params: So,
3054
+ params: jo,
2935
3055
  returns: t.record(t.string().nullable()),
2936
3056
  owner: "main-thread",
2937
3057
  handler: async (e, r) => {
2938
- const n = e.keys, a = L(e.defaults ?? {}), o = {};
3058
+ const n = e.keys, a = H(e.defaults ?? {}), o = {};
2939
3059
  for (const i of n) {
2940
3060
  const s = localStorage.getItem(`__csl__:${String(i)}`);
2941
3061
  o[String(i)] = s !== null ? s : a[String(i)] ?? null;
@@ -2966,7 +3086,7 @@ m({
2966
3086
  namespace: "storage",
2967
3087
  name: "get_all",
2968
3088
  description: "Get all __csl__ values from localStorage",
2969
- params: To,
3089
+ params: Ho,
2970
3090
  returns: t.record(t.string().nullable()),
2971
3091
  owner: "main-thread",
2972
3092
  handler: async (e, r) => {
@@ -2991,7 +3111,7 @@ m({
2991
3111
  namespace: "storage",
2992
3112
  name: "delete_many",
2993
3113
  description: "Delete multiple keys from localStorage",
2994
- params: Ro,
3114
+ params: Fo,
2995
3115
  returns: t.null(),
2996
3116
  owner: "main-thread",
2997
3117
  handler: async (e, r) => {
@@ -3018,7 +3138,7 @@ m({
3018
3138
  namespace: "storage",
3019
3139
  name: "clear",
3020
3140
  description: "Clear all __csl__ keys from localStorage",
3021
- params: Ao,
3141
+ params: Wo,
3022
3142
  returns: t.null(),
3023
3143
  owner: "main-thread",
3024
3144
  handler: async (e, r) => {
@@ -3037,7 +3157,7 @@ m({
3037
3157
  errorCategory: "storage",
3038
3158
  example: "storage.clear()"
3039
3159
  });
3040
- const Yt = t.record(t.unknown());
3160
+ const tr = t.record(t.unknown());
3041
3161
  p(
3042
3162
  "chrome_storage_local_set",
3043
3163
  "chrome",
@@ -3054,7 +3174,7 @@ p(
3054
3174
  "chrome",
3055
3175
  "Get extension local storage values",
3056
3176
  ["storage", "local"],
3057
- Yt,
3177
+ tr,
3058
3178
  "ECHROME",
3059
3179
  "extension",
3060
3180
  [],
@@ -3098,7 +3218,7 @@ p(
3098
3218
  "chrome",
3099
3219
  "Get extension sync storage values",
3100
3220
  ["storage", "sync"],
3101
- Yt,
3221
+ tr,
3102
3222
  "ECHROME",
3103
3223
  "extension",
3104
3224
  [],
@@ -3131,7 +3251,7 @@ m({
3131
3251
  namespace: "clipboard",
3132
3252
  name: "read",
3133
3253
  description: "Read text from clipboard",
3134
- params: $n,
3254
+ params: ta,
3135
3255
  returns: t.string(),
3136
3256
  aliases: [{ namespace: "web.clipboard", name: "read" }],
3137
3257
  owner: "main-thread",
@@ -3147,7 +3267,7 @@ m({
3147
3267
  namespace: "clipboard",
3148
3268
  name: "write",
3149
3269
  description: "Write text to clipboard",
3150
- params: Gn,
3270
+ params: ra,
3151
3271
  returns: t.null(),
3152
3272
  aliases: [{ namespace: "web.clipboard", name: "write", fields: ["text"] }],
3153
3273
  owner: "main-thread",
@@ -3157,7 +3277,7 @@ m({
3157
3277
  const a = e[0];
3158
3278
  typeof a == "object" && a !== null ? n = String(a.text ?? a) : n = String(a);
3159
3279
  } else {
3160
- const a = L(e);
3280
+ const a = H(e);
3161
3281
  n = a.text || a.value || "";
3162
3282
  }
3163
3283
  return await navigator.clipboard.writeText(n), null;
@@ -3187,12 +3307,12 @@ m({
3187
3307
  name: "fetch",
3188
3308
  description: "Make an HTTP request",
3189
3309
  params: Ut,
3190
- returns: We,
3310
+ returns: $e,
3191
3311
  fields: ["url"],
3192
3312
  aliases: [{ namespace: "web", name: "fetch", fields: ["url"] }],
3193
3313
  owner: "main-thread",
3194
3314
  handler: async (e, r) => {
3195
- const n = await Fn(e);
3315
+ const n = await Yn(e);
3196
3316
  return v(n);
3197
3317
  },
3198
3318
  paramTypes: [
@@ -3237,7 +3357,7 @@ m({
3237
3357
  namespace: "util",
3238
3358
  name: "sleep",
3239
3359
  description: "Sleep for a duration",
3240
- params: Zn,
3360
+ params: ia,
3241
3361
  returns: t.null(),
3242
3362
  fields: ["duration"],
3243
3363
  aliases: [{ namespace: "web", name: "sleep", fields: ["duration"] }],
@@ -3281,13 +3401,13 @@ m({
3281
3401
  errorCode: "E_UNKNOWN",
3282
3402
  example: 'util.mock_async({ tabId: 123, script: "document.title" })'
3283
3403
  });
3284
- const O = "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.", li = [
3404
+ const O = "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.", ki = [
3285
3405
  {
3286
3406
  action: "page_back",
3287
3407
  namespace: "page",
3288
3408
  name: "back",
3289
3409
  description: "Go back in the active tab",
3290
- params: Jn,
3410
+ params: da,
3291
3411
  returns: g,
3292
3412
  paramTypes: [],
3293
3413
  returnDoc: "Navigation result",
@@ -3300,7 +3420,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3300
3420
  namespace: "page",
3301
3421
  name: "click",
3302
3422
  description: "Click an element in the active tab",
3303
- params: ra,
3423
+ params: ba,
3304
3424
  returns: g,
3305
3425
  paramTypes: [
3306
3426
  {
@@ -3338,7 +3458,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3338
3458
  namespace: "page",
3339
3459
  name: "fill",
3340
3460
  description: "Fill an element in the active tab",
3341
- params: aa,
3461
+ params: fa,
3342
3462
  returns: g,
3343
3463
  paramTypes: [
3344
3464
  {
@@ -3382,7 +3502,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3382
3502
  namespace: "page",
3383
3503
  name: "setFiles",
3384
3504
  description: "Attach files to a file input in the active tab",
3385
- params: oa,
3505
+ params: ga,
3386
3506
  returns: g,
3387
3507
  paramTypes: [
3388
3508
  {
@@ -3428,7 +3548,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3428
3548
  namespace: "page",
3429
3549
  name: "type",
3430
3550
  description: "Type into an element in the active tab",
3431
- params: ia,
3551
+ params: ya,
3432
3552
  returns: g,
3433
3553
  paramTypes: [
3434
3554
  {
@@ -3472,7 +3592,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3472
3592
  namespace: "page",
3473
3593
  name: "append",
3474
3594
  description: "Append text to an element in the active tab",
3475
- params: sa,
3595
+ params: _a,
3476
3596
  returns: g,
3477
3597
  paramTypes: [
3478
3598
  {
@@ -3514,7 +3634,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3514
3634
  namespace: "page",
3515
3635
  name: "press",
3516
3636
  description: "Press a key in the active tab",
3517
- params: ca,
3637
+ params: wa,
3518
3638
  returns: g,
3519
3639
  fields: ["key"],
3520
3640
  paramTypes: [
@@ -3546,7 +3666,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3546
3666
  namespace: "page",
3547
3667
  name: "select",
3548
3668
  description: "Select an option in the active tab",
3549
- params: la,
3669
+ params: ka,
3550
3670
  returns: g,
3551
3671
  paramTypes: [
3552
3672
  {
@@ -3589,7 +3709,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3589
3709
  namespace: "page",
3590
3710
  name: "select_option",
3591
3711
  description: "Select a value from a dropdown/combobox (native select, react-select, ARIA listbox) by clicking the option whose visible text matches value",
3592
- params: da,
3712
+ params: Ia,
3593
3713
  returns: g,
3594
3714
  paramTypes: [
3595
3715
  {
@@ -3635,7 +3755,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3635
3755
  namespace: "page",
3636
3756
  name: "check",
3637
3757
  description: "Check/uncheck an element in the active tab",
3638
- params: ua,
3758
+ params: va,
3639
3759
  returns: g,
3640
3760
  paramTypes: [
3641
3761
  {
@@ -3678,7 +3798,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3678
3798
  namespace: "page",
3679
3799
  name: "hover",
3680
3800
  description: "Hover over an element in the active tab",
3681
- params: ma,
3801
+ params: xa,
3682
3802
  returns: g,
3683
3803
  paramTypes: [
3684
3804
  {
@@ -3715,7 +3835,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3715
3835
  namespace: "page",
3716
3836
  name: "unhover",
3717
3837
  description: "Unhover in the active tab",
3718
- params: ba,
3838
+ params: Sa,
3719
3839
  returns: g,
3720
3840
  paramTypes: [],
3721
3841
  returnDoc: "{ ok: true, action: 'unhover' }",
@@ -3739,7 +3859,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3739
3859
  namespace: "page",
3740
3860
  name: "submit",
3741
3861
  description: "Submit a form in the active tab (calls form.requestSubmit())",
3742
- params: ha,
3862
+ params: Ta,
3743
3863
  returns: g,
3744
3864
  paramTypes: [
3745
3865
  {
@@ -3777,7 +3897,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3777
3897
  namespace: "page",
3778
3898
  name: "checkRadio",
3779
3899
  description: "Check a radio option by group name and value in the active tab",
3780
- params: pa,
3900
+ params: Ea,
3781
3901
  returns: g,
3782
3902
  paramTypes: [
3783
3903
  {
@@ -3815,7 +3935,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3815
3935
  namespace: "page",
3816
3936
  name: "scroll",
3817
3937
  description: "Scroll the active tab",
3818
- params: fa,
3938
+ params: Ca,
3819
3939
  returns: g,
3820
3940
  fields: ["direction", "amount"],
3821
3941
  paramTypes: [
@@ -3842,7 +3962,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3842
3962
  namespace: "page",
3843
3963
  name: "scroll_to",
3844
3964
  description: "Scroll to an element in the active tab",
3845
- params: ga,
3965
+ params: Ra,
3846
3966
  returns: g,
3847
3967
  paramTypes: [
3848
3968
  {
@@ -3868,7 +3988,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3868
3988
  namespace: "page",
3869
3989
  name: "dblclick",
3870
3990
  description: "Double-click an element in the active tab",
3871
- params: ya,
3991
+ params: Aa,
3872
3992
  returns: g,
3873
3993
  paramTypes: [
3874
3994
  {
@@ -3905,7 +4025,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3905
4025
  namespace: "page",
3906
4026
  name: "forward",
3907
4027
  description: "Go forward in the active tab",
3908
- params: Yn,
4028
+ params: ua,
3909
4029
  returns: g,
3910
4030
  paramTypes: [],
3911
4031
  returnDoc: "Navigation result",
@@ -3918,7 +4038,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3918
4038
  namespace: "page",
3919
4039
  name: "snapshot",
3920
4040
  description: "Capture a broad, text-first page snapshot. Default behavior is intentionally generous: visible text, form values, required/invalid state, and linked field error text are included with actionable refIds where possible.",
3921
- params: bo,
4041
+ params: So,
3922
4042
  returns: t.string(),
3923
4043
  paramTypes: [
3924
4044
  {
@@ -3954,7 +4074,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3954
4074
  namespace: "page",
3955
4075
  name: "snapshot_text",
3956
4076
  description: "Capture a broad text-first DOM snapshot and return only its text representation",
3957
- params: ho,
4077
+ params: To,
3958
4078
  returns: t.string(),
3959
4079
  paramTypes: [
3960
4080
  {
@@ -3974,7 +4094,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
3974
4094
  namespace: "page",
3975
4095
  name: "snapshot_data",
3976
4096
  description: "Get broad page snapshot data. Includes visible text, form values, required/invalid state, linked error text, and actionable refIds where possible.",
3977
- params: fo,
4097
+ params: Co,
3978
4098
  returns: we,
3979
4099
  paramTypes: [
3980
4100
  {
@@ -4005,7 +4125,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4005
4125
  namespace: "page",
4006
4126
  name: "snapshot_query",
4007
4127
  description: "Opt-in filtered snapshot query by role, tag, text, name, etc. Use this only when you intentionally want less than the default broad snapshot.",
4008
- params: Vt,
4128
+ params: zt,
4009
4129
  returns: we,
4010
4130
  paramTypes: [
4011
4131
  {
@@ -4041,7 +4161,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4041
4161
  namespace: "page",
4042
4162
  name: "find",
4043
4163
  description: "Find elements in the active tab using a CSS selector",
4044
- params: _a,
4164
+ params: Na,
4045
4165
  returns: t.array(
4046
4166
  t.object({
4047
4167
  refId: q(),
@@ -4088,8 +4208,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4088
4208
  namespace: "page",
4089
4209
  name: "dom",
4090
4210
  description: "Introspect raw DOM subtree by CSS selector. Read-only. Use this whenever snapshot/find do not expose enough data: hidden inputs, validation shims, raw attributes, dropdown/listbox ownership, shadowed widgets, aria-hidden regions, or exact DOM structure.",
4091
- params: wa,
4092
- returns: Aa,
4211
+ params: Ma,
4212
+ returns: Wa,
4093
4213
  paramTypes: [
4094
4214
  {
4095
4215
  name: "selector",
@@ -4133,7 +4253,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4133
4253
  namespace: "page",
4134
4254
  name: "wait_for",
4135
4255
  description: "Wait for a selector in the active tab",
4136
- params: ka,
4256
+ params: Da,
4137
4257
  returns: t.boolean(),
4138
4258
  fields: ["selector", "timeout"],
4139
4259
  paramTypes: [
@@ -4165,7 +4285,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4165
4285
  namespace: "page",
4166
4286
  name: "extract",
4167
4287
  description: "Extract data from the active tab",
4168
- params: va,
4288
+ params: Oa,
4169
4289
  returns: t.object({
4170
4290
  title: t.string().optional(),
4171
4291
  url: t.string().optional(),
@@ -4197,7 +4317,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4197
4317
  name: "fetch",
4198
4318
  description: "Fetch in the active tab",
4199
4319
  params: Ut,
4200
- returns: We,
4320
+ returns: $e,
4201
4321
  fields: ["url", "options"],
4202
4322
  paramTypes: [
4203
4323
  {
@@ -4226,13 +4346,13 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4226
4346
  },
4227
4347
  handlerKey: "fetch"
4228
4348
  }
4229
- ], di = [
4349
+ ], Ii = [
4230
4350
  {
4231
4351
  action: "tab_click",
4232
4352
  namespace: "web.tab",
4233
4353
  name: "click",
4234
4354
  description: "Click in a tab",
4235
- params: Mo,
4355
+ params: Bo,
4236
4356
  returns: g,
4237
4357
  paramTypes: [
4238
4358
  {
@@ -4272,7 +4392,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4272
4392
  namespace: "web.tab",
4273
4393
  name: "fill",
4274
4394
  description: "Fill in a tab",
4275
- params: qo,
4395
+ params: Ko,
4276
4396
  returns: g,
4277
4397
  paramTypes: [
4278
4398
  {
@@ -4318,7 +4438,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4318
4438
  namespace: "web.tab",
4319
4439
  name: "setFiles",
4320
4440
  description: "Attach files to a file input in a tab",
4321
- params: Oo,
4441
+ params: Vo,
4322
4442
  returns: g,
4323
4443
  paramTypes: [
4324
4444
  {
@@ -4364,7 +4484,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4364
4484
  namespace: "web.tab",
4365
4485
  name: "scroll_to",
4366
4486
  description: "Scroll to position in a tab",
4367
- params: Po,
4487
+ params: Zo,
4368
4488
  returns: g,
4369
4489
  paramTypes: [
4370
4490
  {
@@ -4408,7 +4528,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4408
4528
  namespace: "web.tab",
4409
4529
  name: "type",
4410
4530
  description: "Type in a tab",
4411
- params: jo,
4531
+ params: zo,
4412
4532
  returns: g,
4413
4533
  paramTypes: [
4414
4534
  {
@@ -4454,7 +4574,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4454
4574
  namespace: "web.tab",
4455
4575
  name: "press",
4456
4576
  description: "Press a key in a tab",
4457
- params: Uo,
4577
+ params: Xo,
4458
4578
  returns: g,
4459
4579
  paramTypes: [
4460
4580
  {
@@ -4488,7 +4608,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4488
4608
  namespace: "web.tab",
4489
4609
  name: "select",
4490
4610
  description: "Select an option in a tab",
4491
- params: Lo,
4611
+ params: Qo,
4492
4612
  returns: g,
4493
4613
  paramTypes: [
4494
4614
  {
@@ -4534,7 +4654,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4534
4654
  namespace: "web.tab",
4535
4655
  name: "select_option",
4536
4656
  description: "Open a combobox (react-select/listbox) in a tab and click the option whose text matches value",
4537
- params: Ho,
4657
+ params: Jo,
4538
4658
  returns: g,
4539
4659
  paramTypes: [
4540
4660
  {
@@ -4583,7 +4703,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4583
4703
  namespace: "web.tab",
4584
4704
  name: "check",
4585
4705
  description: "Check/uncheck in a tab",
4586
- params: Fo,
4706
+ params: Yo,
4587
4707
  returns: g,
4588
4708
  paramTypes: [
4589
4709
  {
@@ -4629,7 +4749,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4629
4749
  namespace: "web.tab",
4630
4750
  name: "submit",
4631
4751
  description: "Submit a form in a tab (calls form.requestSubmit())",
4632
- params: $o,
4752
+ params: ti,
4633
4753
  returns: g,
4634
4754
  paramTypes: [
4635
4755
  {
@@ -4669,7 +4789,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4669
4789
  namespace: "web.tab",
4670
4790
  name: "checkRadio",
4671
4791
  description: "Check a radio option by group name and value in a tab",
4672
- params: Go,
4792
+ params: ri,
4673
4793
  returns: g,
4674
4794
  paramTypes: [
4675
4795
  {
@@ -4709,7 +4829,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4709
4829
  namespace: "web.tab",
4710
4830
  name: "hover",
4711
4831
  description: "Hover in a tab",
4712
- params: Wo,
4832
+ params: ei,
4713
4833
  returns: g,
4714
4834
  paramTypes: [
4715
4835
  {
@@ -4749,7 +4869,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4749
4869
  namespace: "web.tab",
4750
4870
  name: "unhover",
4751
4871
  description: "Unhover in a tab",
4752
- params: Bo,
4872
+ params: ni,
4753
4873
  returns: g,
4754
4874
  paramTypes: [
4755
4875
  {
@@ -4777,7 +4897,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4777
4897
  namespace: "web.tab",
4778
4898
  name: "scroll",
4779
4899
  description: "Scroll in a tab",
4780
- params: Ko,
4900
+ params: ai,
4781
4901
  returns: g,
4782
4902
  paramTypes: [
4783
4903
  {
@@ -4809,7 +4929,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4809
4929
  namespace: "web.tab",
4810
4930
  name: "dblclick",
4811
4931
  description: "Double-click in a tab",
4812
- params: Vo,
4932
+ params: oi,
4813
4933
  returns: g,
4814
4934
  paramTypes: [
4815
4935
  {
@@ -4849,7 +4969,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4849
4969
  namespace: "web.tab",
4850
4970
  name: "back",
4851
4971
  description: "Go back in a tab",
4852
- params: zo,
4972
+ params: si,
4853
4973
  returns: g,
4854
4974
  paramTypes: [
4855
4975
  {
@@ -4869,7 +4989,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4869
4989
  namespace: "web.tab",
4870
4990
  name: "forward",
4871
4991
  description: "Go forward in a tab",
4872
- params: Xo,
4992
+ params: ci,
4873
4993
  returns: g,
4874
4994
  paramTypes: [
4875
4995
  {
@@ -4889,7 +5009,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4889
5009
  namespace: "web.tab",
4890
5010
  name: "snapshot",
4891
5011
  description: "Get a broad, text-first tab snapshot. Includes visible text, form values, validation/error text, and actionable refIds where possible.",
4892
- params: Yo,
5012
+ params: ui,
4893
5013
  returns: t.string(),
4894
5014
  fields: ["tabId"],
4895
5015
  paramTypes: [
@@ -4924,7 +5044,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4924
5044
  namespace: "web.tab",
4925
5045
  name: "snapshot_text",
4926
5046
  description: "Get broad, text-first tab snapshot text",
4927
- params: ei,
5047
+ params: pi,
4928
5048
  returns: t.string(),
4929
5049
  fields: ["tabId"],
4930
5050
  paramTypes: [
@@ -4945,7 +5065,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4945
5065
  namespace: "web.tab",
4946
5066
  name: "snapshot_data",
4947
5067
  description: "Get broad tab snapshot data. Includes visible text, form values, validation/error text, and actionable refIds where possible.",
4948
- params: ti,
5068
+ params: mi,
4949
5069
  returns: we,
4950
5070
  fields: ["tabId"],
4951
5071
  paramTypes: [
@@ -4975,7 +5095,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4975
5095
  namespace: "web.tab",
4976
5096
  name: "snapshot_query",
4977
5097
  description: "Query tab snapshot with semantic filtering by role, tag, text, name, etc.",
4978
- params: yo,
5098
+ params: Ao,
4979
5099
  returns: we,
4980
5100
  fields: ["tabId"],
4981
5101
  paramTypes: [
@@ -5016,8 +5136,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
5016
5136
  namespace: "web.tab",
5017
5137
  name: "fetch",
5018
5138
  description: "Fetch in a tab",
5019
- params: Jo,
5020
- returns: We,
5139
+ params: di,
5140
+ returns: $e,
5021
5141
  fields: ["tabId", "url", "options"],
5022
5142
  paramTypes: [
5023
5143
  {
@@ -5043,8 +5163,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
5043
5163
  namespace: "web.tab",
5044
5164
  name: "evaluate",
5045
5165
  description: "Evaluate script in a tab (content-script context)",
5046
- params: Zo,
5047
- returns: Ca,
5166
+ params: ii,
5167
+ returns: Ua,
5048
5168
  fields: ["tabId", "script"],
5049
5169
  paramTypes: [
5050
5170
  {
@@ -5072,24 +5192,24 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
5072
5192
  },
5073
5193
  handlerKey: "evaluate"
5074
5194
  }
5075
- ], er = [
5076
- ...li,
5077
- ...di
5195
+ ], rr = [
5196
+ ...ki,
5197
+ ...Ii
5078
5198
  ];
5079
- function tr(e) {
5199
+ function nr(e) {
5080
5200
  const { handlerKey: r, ...n } = e;
5081
- dt(n), mr(e.action);
5201
+ ut(n), hr(e.action);
5082
5202
  }
5083
5203
  async function ae(e) {
5084
- const r = await bt();
5085
- return r === null && Nr(fr(e)), r;
5204
+ const r = await ht();
5205
+ return r === null && Dr(yr(e)), r;
5086
5206
  }
5087
5207
  m({
5088
5208
  action: "page_url",
5089
5209
  namespace: "page",
5090
5210
  name: "url",
5091
5211
  description: "Get the URL of the active tab",
5092
- params: zn,
5212
+ params: sa,
5093
5213
  returns: t.string(),
5094
5214
  owner: "main-thread",
5095
5215
  handler: async (e, r) => {
@@ -5108,7 +5228,7 @@ m({
5108
5228
  namespace: "page",
5109
5229
  name: "title",
5110
5230
  description: "Get the title of the active tab",
5111
- params: Xn,
5231
+ params: ca,
5112
5232
  returns: t.string(),
5113
5233
  owner: "main-thread",
5114
5234
  handler: async (e, r) => {
@@ -5122,16 +5242,16 @@ m({
5122
5242
  errorCode: "E_NO_TAB",
5123
5243
  example: "page.title()"
5124
5244
  });
5125
- for (const e of er.filter(
5245
+ for (const e of rr.filter(
5126
5246
  (r) => r.namespace === "page"
5127
5247
  ))
5128
- tr(e);
5248
+ nr(e);
5129
5249
  m({
5130
5250
  action: "page_goto",
5131
5251
  namespace: "page",
5132
5252
  name: "goto",
5133
5253
  description: "Navigate the active tab to a URL",
5134
- params: Qn,
5254
+ params: la,
5135
5255
  returns: N,
5136
5256
  fields: ["url"],
5137
5257
  owner: "main-thread",
@@ -5156,7 +5276,7 @@ m({
5156
5276
  "navigation"
5157
5277
  );
5158
5278
  const c = Number(e.timeout) || Q;
5159
- return Ve({
5279
+ return Ze({
5160
5280
  tabId: n,
5161
5281
  url: e.url,
5162
5282
  preNavigationUrl: s,
@@ -5190,13 +5310,13 @@ m({
5190
5310
  namespace: "page",
5191
5311
  name: "health",
5192
5312
  description: "Report tab readiness for mutations vs read-only snapshot APIs",
5193
- params: Sa,
5194
- returns: Ta,
5313
+ params: ja,
5314
+ returns: Ha,
5195
5315
  owner: "main-thread",
5196
5316
  handler: async (e, r) => {
5197
5317
  const n = await ae("page.health()"), a = v(
5198
5318
  await x("chrome_tabs_get", [n])
5199
- ), o = a.url ?? "", i = a.title ?? "", s = await Qt(n), c = s && !s.ok ? "blocked" : "ok", d = (await Te(n, St)).ok ? "connected" : "missing", u = c === "ok" && d === "connected", h = {
5319
+ ), o = a.url ?? "", i = a.title ?? "", s = await Yt(n), c = s && !s.ok ? "blocked" : "ok", d = (await Te(n, Tt)).ok ? "connected" : "missing", u = c === "ok" && d === "connected", b = {
5200
5320
  tabId: n,
5201
5321
  url: o,
5202
5322
  title: i,
@@ -5206,14 +5326,14 @@ m({
5206
5326
  };
5207
5327
  if (!u)
5208
5328
  if (c === "blocked")
5209
- h.hint = "This tab URL does not support DOM APIs. Only http(s) pages support page.* and web.tab.* DOM operations.", h.recovery = [
5329
+ b.hint = "This tab URL does not support DOM APIs. Only http(s) pages support page.* and web.tab.* DOM operations.", b.recovery = [
5210
5330
  "Navigate to an http(s) URL with await page.goto(url)"
5211
5331
  ];
5212
5332
  else {
5213
- const b = ge(n, o);
5214
- h.hint = b.hint, h.recovery = b.recovery;
5333
+ const h = ge(n, o);
5334
+ b.hint = h.hint, b.recovery = h.recovery;
5215
5335
  }
5216
- return h;
5336
+ return b;
5217
5337
  },
5218
5338
  paramTypes: [],
5219
5339
  returnDoc: "Tab health: contentScript connection and http(s) domApis readiness",
@@ -5225,7 +5345,7 @@ m({
5225
5345
  namespace: "page",
5226
5346
  name: "reload",
5227
5347
  description: "Reload the active tab",
5228
- params: ea,
5348
+ params: pa,
5229
5349
  returns: t.null(),
5230
5350
  owner: "main-thread",
5231
5351
  handler: async (e, r) => {
@@ -5242,7 +5362,7 @@ m({
5242
5362
  namespace: "page",
5243
5363
  name: "wait",
5244
5364
  description: "Wait for a duration",
5245
- params: ta,
5365
+ params: ma,
5246
5366
  returns: t.boolean(),
5247
5367
  fields: ["duration"],
5248
5368
  owner: "main-thread",
@@ -5266,7 +5386,7 @@ m({
5266
5386
  namespace: "page",
5267
5387
  name: "close",
5268
5388
  description: "Close a tab",
5269
- params: Ea,
5389
+ params: Pa,
5270
5390
  returns: t.null(),
5271
5391
  owner: "main-thread",
5272
5392
  handler: async (e, r) => {
@@ -5292,7 +5412,7 @@ m({
5292
5412
  namespace: "page",
5293
5413
  name: "tabs",
5294
5414
  description: "Query tabs",
5295
- params: Be,
5415
+ params: Ke,
5296
5416
  returns: ne,
5297
5417
  owner: "main-thread",
5298
5418
  handler: async (e, r) => {
@@ -5322,7 +5442,7 @@ m({
5322
5442
  namespace: "page",
5323
5443
  name: "switch",
5324
5444
  description: "Switch to a tab",
5325
- params: Xt,
5445
+ params: Jt,
5326
5446
  returns: N,
5327
5447
  owner: "main-thread",
5328
5448
  handler: async (e, r) => {
@@ -5350,7 +5470,7 @@ m({
5350
5470
  namespace: "page",
5351
5471
  name: "new_tab",
5352
5472
  description: "Open a new tab",
5353
- params: Zt,
5473
+ params: Xt,
5354
5474
  returns: N,
5355
5475
  fields: ["url"],
5356
5476
  owner: "main-thread",
@@ -5379,7 +5499,7 @@ m({
5379
5499
  namespace: "page",
5380
5500
  name: "active_tab",
5381
5501
  description: "Get the active tab",
5382
- params: xa,
5502
+ params: La,
5383
5503
  returns: N,
5384
5504
  owner: "main-thread",
5385
5505
  handler: async (e, r) => {
@@ -5393,42 +5513,42 @@ m({
5393
5513
  errorCode: "E_NO_TAB",
5394
5514
  example: "page.active_tab()"
5395
5515
  });
5396
- function ui(e) {
5516
+ function vi(e) {
5397
5517
  return {
5398
5518
  tag: e.tagName.toLowerCase(),
5399
5519
  role: X(e),
5400
5520
  name: Ee(e)
5401
5521
  };
5402
5522
  }
5403
- let Ye = 0, et, tt = /* @__PURE__ */ new Map();
5404
- function pi(e = []) {
5405
- Ye += 1, et = `obs${Ye}`, tt = /* @__PURE__ */ new Map();
5523
+ let et = 0, tt, rt = /* @__PURE__ */ new Map();
5524
+ function Ei(e = []) {
5525
+ et += 1, tt = `obs${et}`, rt = /* @__PURE__ */ new Map();
5406
5526
  for (const r of e)
5407
- tt.set(r.refId, {
5527
+ rt.set(r.refId, {
5408
5528
  element: r.element,
5409
- fingerprint: ui(r.element)
5529
+ fingerprint: vi(r.element)
5410
5530
  });
5411
- return et;
5531
+ return tt;
5412
5532
  }
5413
- function mi(e) {
5533
+ function xi(e) {
5414
5534
  return document.querySelector(
5415
5535
  `[data-ref-id='${CSS.escape(e)}']`
5416
5536
  );
5417
5537
  }
5418
- function bi(e) {
5419
- const r = qn(e), n = r.nodes.map((o) => {
5420
- const i = mi(o.refId);
5538
+ function Si(e) {
5539
+ const r = Kn(e), n = r.nodes.map((o) => {
5540
+ const i = xi(o.refId);
5421
5541
  return i ? { refId: o.refId, element: i } : null;
5422
5542
  }).filter(
5423
5543
  (o) => o !== null
5424
- ), a = pi(n);
5544
+ ), a = Ei(n);
5425
5545
  return { ...r, observationId: a };
5426
5546
  }
5427
5547
  function K(e) {
5428
5548
  var a, o, i;
5429
5549
  const r = e.toLowerCase().trim();
5430
5550
  if (!r) return null;
5431
- const n = Array.from(document.querySelectorAll(He));
5551
+ const n = Array.from(document.querySelectorAll(Ue));
5432
5552
  for (const s of n) {
5433
5553
  const c = s.getAttribute("aria-label");
5434
5554
  if (c && c.toLowerCase().trim() === r) return s;
@@ -5437,8 +5557,8 @@ function K(e) {
5437
5557
  return s;
5438
5558
  const d = s.id;
5439
5559
  if (d) {
5440
- const b = document.querySelector(`label[for='${CSS.escape(d)}']`);
5441
- if (b && ((a = b.textContent) == null ? void 0 : a.trim().toLowerCase()) === r)
5560
+ const h = document.querySelector(`label[for='${CSS.escape(d)}']`);
5561
+ if (h && ((a = h.textContent) == null ? void 0 : a.trim().toLowerCase()) === r)
5442
5562
  return s;
5443
5563
  }
5444
5564
  const u = s.closest("label");
@@ -5446,16 +5566,16 @@ function K(e) {
5446
5566
  }
5447
5567
  return null;
5448
5568
  }
5449
- function hi(e) {
5569
+ function Ti(e) {
5450
5570
  var o;
5451
5571
  const r = e.toLowerCase().trim();
5452
5572
  if (!r) return [];
5453
- const n = Array.from(document.querySelectorAll(He)), a = [];
5573
+ const n = Array.from(document.querySelectorAll(Ue)), a = [];
5454
5574
  for (const i of n) {
5455
5575
  const s = i.getAttribute("aria-label"), c = i.placeholder, l = ((o = i.textContent) == null ? void 0 : o.trim()) || "";
5456
5576
  if (![s, c, l].filter(
5457
5577
  Boolean
5458
- ).some((h) => h.toLowerCase().includes(r)))
5578
+ ).some((b) => b.toLowerCase().includes(r)))
5459
5579
  continue;
5460
5580
  const u = i.getAttribute("data-ref-id");
5461
5581
  if (u && (a.push({
@@ -5467,13 +5587,13 @@ function hi(e) {
5467
5587
  }
5468
5588
  return a;
5469
5589
  }
5470
- function fi(e) {
5590
+ function Ci(e) {
5471
5591
  const r = document.querySelector(
5472
5592
  `[data-ref-id='${CSS.escape(e)}']`
5473
5593
  );
5474
5594
  let n, a;
5475
5595
  r && (n = r.tagName.toLowerCase(), a = X(r));
5476
- const o = Array.from(document.querySelectorAll(He)), i = [];
5596
+ const o = Array.from(document.querySelectorAll(Ue)), i = [];
5477
5597
  for (const s of o) {
5478
5598
  const c = s.getAttribute("data-ref-id");
5479
5599
  if (c) {
@@ -5491,24 +5611,24 @@ function fi(e) {
5491
5611
  }
5492
5612
  return i;
5493
5613
  }
5494
- function gi() {
5614
+ function Ri() {
5495
5615
  try {
5496
- return bi(Number.MAX_SAFE_INTEGER);
5616
+ return Si(Number.MAX_SAFE_INTEGER);
5497
5617
  } catch {
5498
5618
  return;
5499
5619
  }
5500
5620
  }
5501
5621
  function V(e, r, n = !1) {
5502
- const a = gi();
5622
+ const a = Ri();
5503
5623
  if (e) {
5504
- const o = n ? fi(e) : [];
5624
+ const o = n ? Ci(e) : [];
5505
5625
  me(
5506
- gr(e, { candidates: o, snapshot: a })
5626
+ _r(e, { candidates: o, snapshot: a })
5507
5627
  );
5508
5628
  }
5509
5629
  if (r) {
5510
- const o = n ? hi(r) : [];
5511
- me(_r(r, o));
5630
+ const o = n ? Ti(r) : [];
5631
+ me(kr(r, o));
5512
5632
  }
5513
5633
  me({
5514
5634
  message: "Element not found",
@@ -5516,7 +5636,7 @@ function V(e, r, n = !1) {
5516
5636
  category: "resource"
5517
5637
  });
5518
5638
  }
5519
- const yi = /* @__PURE__ */ new Map([
5639
+ const Ai = /* @__PURE__ */ new Map([
5520
5640
  [
5521
5641
  "sidepanel_click",
5522
5642
  (e, r) => {
@@ -5640,7 +5760,7 @@ const yi = /* @__PURE__ */ new Map([
5640
5760
  [
5641
5761
  "sidepanel_scroll",
5642
5762
  (e, r) => {
5643
- const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount : xt;
5763
+ const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount : St;
5644
5764
  return window.scrollBy({
5645
5765
  top: n === "up" ? -a : a,
5646
5766
  behavior: "smooth"
@@ -5656,10 +5776,10 @@ const yi = /* @__PURE__ */ new Map([
5656
5776
  }
5657
5777
  ]
5658
5778
  ]);
5659
- function U(e, r) {
5660
- const n = f.child("runner"), a = ni(r);
5779
+ function j(e, r) {
5780
+ const n = f.child("runner"), a = hi(r);
5661
5781
  n.debug("dispatchSidepanelEvent_start", { action: e, refId: a });
5662
- const o = L(r), i = yi.get(e);
5782
+ const o = H(r), i = Ai.get(e);
5663
5783
  if (!i)
5664
5784
  throw n.error("dispatchSidepanelEvent_no_handler", { action: e }), y(`Unknown sidepanel action: ${e}`, "E_UNKNOWN");
5665
5785
  return i(a, o);
@@ -5669,10 +5789,10 @@ m({
5669
5789
  namespace: "sidepanel",
5670
5790
  name: "click",
5671
5791
  description: "Click an element in the sidepanel",
5672
- params: Va,
5792
+ params: oo,
5673
5793
  returns: t.null(),
5674
5794
  owner: "main-thread",
5675
- handler: async (e, r) => U("sidepanel_click", e),
5795
+ handler: async (e, r) => j("sidepanel_click", e),
5676
5796
  paramTypes: [
5677
5797
  {
5678
5798
  name: "refId",
@@ -5696,10 +5816,10 @@ m({
5696
5816
  namespace: "sidepanel",
5697
5817
  name: "dblclick",
5698
5818
  description: "Double-click an element in the sidepanel",
5699
- params: Za,
5819
+ params: io,
5700
5820
  returns: t.null(),
5701
5821
  owner: "main-thread",
5702
- handler: async (e, r) => U("sidepanel_dblclick", e),
5822
+ handler: async (e, r) => j("sidepanel_dblclick", e),
5703
5823
  paramTypes: [
5704
5824
  {
5705
5825
  name: "refId",
@@ -5723,10 +5843,10 @@ m({
5723
5843
  namespace: "sidepanel",
5724
5844
  name: "fill",
5725
5845
  description: "Fill an element in the sidepanel",
5726
- params: za,
5846
+ params: so,
5727
5847
  returns: t.null(),
5728
5848
  owner: "main-thread",
5729
- handler: async (e, r) => U("sidepanel_fill", e),
5849
+ handler: async (e, r) => j("sidepanel_fill", e),
5730
5850
  paramTypes: [
5731
5851
  {
5732
5852
  name: "refId",
@@ -5756,10 +5876,10 @@ m({
5756
5876
  namespace: "sidepanel",
5757
5877
  name: "type",
5758
5878
  description: "Type into an element in the sidepanel",
5759
- params: Xa,
5879
+ params: co,
5760
5880
  returns: t.null(),
5761
5881
  owner: "main-thread",
5762
- handler: async (e, r) => U("sidepanel_type", e),
5882
+ handler: async (e, r) => j("sidepanel_type", e),
5763
5883
  paramTypes: [
5764
5884
  {
5765
5885
  name: "refId",
@@ -5789,11 +5909,11 @@ m({
5789
5909
  namespace: "sidepanel",
5790
5910
  name: "press",
5791
5911
  description: "Press a key in the sidepanel",
5792
- params: Qa,
5912
+ params: lo,
5793
5913
  returns: t.null(),
5794
5914
  fields: ["key"],
5795
5915
  owner: "main-thread",
5796
- handler: async (e, r) => U("sidepanel_press", e),
5916
+ handler: async (e, r) => j("sidepanel_press", e),
5797
5917
  paramTypes: [
5798
5918
  {
5799
5919
  name: "key",
@@ -5811,10 +5931,10 @@ m({
5811
5931
  namespace: "sidepanel",
5812
5932
  name: "select",
5813
5933
  description: "Select an option in the sidepanel",
5814
- params: Ja,
5934
+ params: uo,
5815
5935
  returns: t.null(),
5816
5936
  owner: "main-thread",
5817
- handler: async (e, r) => U("sidepanel_select", e),
5937
+ handler: async (e, r) => j("sidepanel_select", e),
5818
5938
  paramTypes: [
5819
5939
  {
5820
5940
  name: "refId",
@@ -5844,10 +5964,10 @@ m({
5844
5964
  namespace: "sidepanel",
5845
5965
  name: "check",
5846
5966
  description: "Check/uncheck an element in the sidepanel",
5847
- params: Ya,
5967
+ params: po,
5848
5968
  returns: t.null(),
5849
5969
  owner: "main-thread",
5850
- handler: async (e, r) => U("sidepanel_check", e),
5970
+ handler: async (e, r) => j("sidepanel_check", e),
5851
5971
  paramTypes: [
5852
5972
  {
5853
5973
  name: "refId",
@@ -5877,10 +5997,10 @@ m({
5877
5997
  namespace: "sidepanel",
5878
5998
  name: "hover",
5879
5999
  description: "Hover over an element in the sidepanel",
5880
- params: eo,
6000
+ params: mo,
5881
6001
  returns: t.null(),
5882
6002
  owner: "main-thread",
5883
- handler: async (e, r) => U("sidepanel_hover", e),
6003
+ handler: async (e, r) => j("sidepanel_hover", e),
5884
6004
  paramTypes: [
5885
6005
  {
5886
6006
  name: "refId",
@@ -5904,10 +6024,10 @@ m({
5904
6024
  namespace: "sidepanel",
5905
6025
  name: "unhover",
5906
6026
  description: "Unhover in the sidepanel",
5907
- params: to,
6027
+ params: bo,
5908
6028
  returns: t.null(),
5909
6029
  owner: "main-thread",
5910
- handler: async (e, r) => U("sidepanel_unhover", e),
6030
+ handler: async (e, r) => j("sidepanel_unhover", e),
5911
6031
  paramTypes: [],
5912
6032
  returnDoc: "null",
5913
6033
  errorCode: "E_UNKNOWN",
@@ -5918,10 +6038,10 @@ m({
5918
6038
  namespace: "sidepanel",
5919
6039
  name: "scroll",
5920
6040
  description: "Scroll the sidepanel",
5921
- params: ro,
6041
+ params: ho,
5922
6042
  returns: t.null(),
5923
6043
  owner: "main-thread",
5924
- handler: async (e, r) => U("sidepanel_scroll", e),
6044
+ handler: async (e, r) => j("sidepanel_scroll", e),
5925
6045
  paramTypes: [
5926
6046
  {
5927
6047
  name: "direction",
@@ -5945,10 +6065,10 @@ m({
5945
6065
  namespace: "sidepanel",
5946
6066
  name: "scroll_to",
5947
6067
  description: "Scroll to an element in the sidepanel",
5948
- params: no,
6068
+ params: fo,
5949
6069
  returns: t.null(),
5950
6070
  owner: "main-thread",
5951
- handler: async (e, r) => U("sidepanel_scroll_to", e),
6071
+ handler: async (e, r) => j("sidepanel_scroll_to", e),
5952
6072
  paramTypes: [
5953
6073
  {
5954
6074
  name: "refId",
@@ -5972,10 +6092,10 @@ m({
5972
6092
  namespace: "sidepanel",
5973
6093
  name: "append",
5974
6094
  description: "Append text to an element in the sidepanel",
5975
- params: ao,
6095
+ params: go,
5976
6096
  returns: t.null(),
5977
6097
  owner: "main-thread",
5978
- handler: async (e, r) => U("sidepanel_append", e),
6098
+ handler: async (e, r) => j("sidepanel_append", e),
5979
6099
  paramTypes: [
5980
6100
  {
5981
6101
  name: "refId",
@@ -6005,7 +6125,7 @@ m({
6005
6125
  namespace: "sidepanel",
6006
6126
  name: "url",
6007
6127
  description: "Get the sidepanel URL",
6008
- params: oo,
6128
+ params: yo,
6009
6129
  returns: t.string(),
6010
6130
  owner: "main-thread",
6011
6131
  handler: async (e, r) => window.location.href,
@@ -6019,7 +6139,7 @@ m({
6019
6139
  namespace: "sidepanel",
6020
6140
  name: "title",
6021
6141
  description: "Get the sidepanel title",
6022
- params: io,
6142
+ params: _o,
6023
6143
  returns: t.string(),
6024
6144
  owner: "main-thread",
6025
6145
  handler: async (e, r) => document.title,
@@ -6033,7 +6153,7 @@ m({
6033
6153
  namespace: "sidepanel",
6034
6154
  name: "wait",
6035
6155
  description: "Wait in the sidepanel",
6036
- params: so,
6156
+ params: wo,
6037
6157
  returns: t.boolean(),
6038
6158
  fields: ["duration"],
6039
6159
  owner: "main-thread",
@@ -6057,7 +6177,7 @@ m({
6057
6177
  namespace: "sidepanel",
6058
6178
  name: "snapshot",
6059
6179
  description: "Capture sidepanel DOM snapshot",
6060
- params: co,
6180
+ params: ko,
6061
6181
  returns: t.string(),
6062
6182
  owner: "main-thread",
6063
6183
  handler: async (e, r) => {
@@ -6095,7 +6215,7 @@ m({
6095
6215
  namespace: "sidepanel",
6096
6216
  name: "snapshot_text",
6097
6217
  description: "Capture sidepanel DOM snapshot and return text representation",
6098
- params: lo,
6218
+ params: Io,
6099
6219
  returns: t.string(),
6100
6220
  owner: "main-thread",
6101
6221
  handler: async (e, r) => {
@@ -6133,8 +6253,8 @@ m({
6133
6253
  namespace: "sidepanel",
6134
6254
  name: "snapshot_data",
6135
6255
  description: "Get sidepanel snapshot data",
6136
- params: uo,
6137
- returns: Ft,
6256
+ params: vo,
6257
+ returns: $t,
6138
6258
  owner: "main-thread",
6139
6259
  handler: async (e, r) => {
6140
6260
  const n = await xe(e);
@@ -6169,8 +6289,8 @@ m({
6169
6289
  namespace: "dom",
6170
6290
  name: "snapshot",
6171
6291
  description: "Take a DOM snapshot",
6172
- params: po,
6173
- returns: Ft,
6292
+ params: Eo,
6293
+ returns: $t,
6174
6294
  owner: "main-thread",
6175
6295
  handler: async (e, r) => {
6176
6296
  const n = await xe(e);
@@ -6205,10 +6325,10 @@ m({
6205
6325
  namespace: "dom",
6206
6326
  name: "format",
6207
6327
  description: "Format a DOM snapshot",
6208
- params: mo,
6328
+ params: xo,
6209
6329
  returns: t.string(),
6210
6330
  owner: "main-thread",
6211
- handler: async (e, r) => v(await On(e)),
6331
+ handler: async (e, r) => v(await Vn(e)),
6212
6332
  paramTypes: [
6213
6333
  {
6214
6334
  name: "snapshot",
@@ -6232,7 +6352,7 @@ m({
6232
6352
  namespace: "web.tab",
6233
6353
  name: "query",
6234
6354
  description: "Query tabs",
6235
- params: Be,
6355
+ params: Ke,
6236
6356
  returns: ne,
6237
6357
  owner: "main-thread",
6238
6358
  handler: async (e, r) => {
@@ -6271,7 +6391,7 @@ m({
6271
6391
  aliases: [{ namespace: "tab", name: "current" }],
6272
6392
  owner: "main-thread",
6273
6393
  handler: async (e, r) => {
6274
- const n = await bt();
6394
+ const n = await ht();
6275
6395
  if (n === null)
6276
6396
  throw new Error("No active tab available");
6277
6397
  const a = v(
@@ -6290,13 +6410,13 @@ m({
6290
6410
  namespace: "web.tab",
6291
6411
  name: "get",
6292
6412
  description: "Get a tab by id",
6293
- params: Wn,
6413
+ params: ea,
6294
6414
  returns: N,
6295
6415
  fields: ["tabId"],
6296
6416
  aliases: [{ namespace: "tab", name: "get", fields: ["tabId"] }],
6297
6417
  owner: "main-thread",
6298
6418
  handler: async (e, r) => {
6299
- const n = te(L(e));
6419
+ const n = te(H(e));
6300
6420
  return v(await x("chrome_tabs_get", [n]));
6301
6421
  },
6302
6422
  paramTypes: [
@@ -6317,7 +6437,7 @@ m({
6317
6437
  namespace: "web.tab",
6318
6438
  name: "find",
6319
6439
  description: "Find tabs matching a query",
6320
- params: Be,
6440
+ params: Ke,
6321
6441
  returns: ne,
6322
6442
  aliases: [{ namespace: "tab", name: "find" }],
6323
6443
  owner: "main-thread",
@@ -6356,7 +6476,7 @@ m({
6356
6476
  namespace: "web.tab",
6357
6477
  name: "create",
6358
6478
  description: "Create a tab",
6359
- params: Zt,
6479
+ params: Xt,
6360
6480
  returns: N,
6361
6481
  fields: ["url"],
6362
6482
  aliases: [{ namespace: "tab", name: "create", fields: ["url"] }],
@@ -6365,7 +6485,7 @@ m({
6365
6485
  const n = e, { waitForReady: a, ...o } = n, i = v(
6366
6486
  await x("chrome_tabs_create", [o])
6367
6487
  ), s = i.tabId ?? i.id;
6368
- return typeof s == "number" && n.url && n.waitForReady !== !1 && (n.url.startsWith("http:") || n.url.startsWith("https:")) ? Ve({
6488
+ return typeof s == "number" && n.url && n.waitForReady !== !1 && (n.url.startsWith("http:") || n.url.startsWith("https:")) ? Ze({
6369
6489
  tabId: s,
6370
6490
  url: n.url,
6371
6491
  preNavigationUrl: i.url,
@@ -6410,7 +6530,7 @@ m({
6410
6530
  namespace: "web.tab",
6411
6531
  name: "activate",
6412
6532
  description: "Activate a tab",
6413
- params: Xt,
6533
+ params: Jt,
6414
6534
  returns: N,
6415
6535
  owner: "main-thread",
6416
6536
  handler: async (e, r) => {
@@ -6438,7 +6558,7 @@ m({
6438
6558
  namespace: "web.tab",
6439
6559
  name: "close",
6440
6560
  description: "Close a tab",
6441
- params: Do,
6561
+ params: Go,
6442
6562
  returns: t.null(),
6443
6563
  owner: "main-thread",
6444
6564
  handler: async (e, r) => {
@@ -6459,23 +6579,23 @@ m({
6459
6579
  errorCode: "E_MISSING_PARAM",
6460
6580
  example: "web.tab.close(123)"
6461
6581
  });
6462
- for (const e of er.filter(
6582
+ for (const e of rr.filter(
6463
6583
  (r) => r.namespace === "web.tab"
6464
6584
  ))
6465
- tr(e);
6585
+ nr(e);
6466
6586
  m({
6467
6587
  action: "tab_wait_for_load",
6468
6588
  namespace: "web.tab",
6469
6589
  name: "wait_for_load",
6470
6590
  description: "Wait for tab to load",
6471
- params: Qo,
6591
+ params: li,
6472
6592
  returns: t.boolean(),
6473
6593
  owner: "main-thread",
6474
6594
  handler: async (e, r) => {
6475
- const n = L(e), a = te(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
6595
+ const n = H(e), a = te(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
6476
6596
  if (a === null)
6477
6597
  throw y("tab_wait_for_load requires a tabId", "E_MISSING_PARAM");
6478
- return v(await Jt(a, o)), v(await Te(a, o)), !0;
6598
+ return v(await er(a, o)), v(await Te(a, o)), !0;
6479
6599
  },
6480
6600
  paramTypes: [
6481
6601
  {
@@ -6500,12 +6620,12 @@ m({
6500
6620
  namespace: "web.tab",
6501
6621
  name: "goto",
6502
6622
  description: "Navigate a specific tab to a URL (tab-scoped; avoids active-tab global state)",
6503
- params: ri,
6623
+ params: bi,
6504
6624
  returns: N,
6505
6625
  fields: ["url"],
6506
6626
  owner: "main-thread",
6507
6627
  handler: async (e, r) => {
6508
- const n = te(L(e));
6628
+ const n = te(H(e));
6509
6629
  if (n === null)
6510
6630
  throw y("tab_goto requires a tabId", "E_MISSING_PARAM");
6511
6631
  const a = r.runId ?? "?";
@@ -6543,7 +6663,7 @@ m({
6543
6663
  "navigation"
6544
6664
  );
6545
6665
  const c = Number(e.timeout) || Q;
6546
- return Ve({
6666
+ return Ze({
6547
6667
  tabId: n,
6548
6668
  url: e.url,
6549
6669
  preNavigationUrl: s,
@@ -6699,7 +6819,7 @@ p(
6699
6819
  "chrome",
6700
6820
  "Clear an alarm",
6701
6821
  ["alarms"],
6702
- ja,
6822
+ za,
6703
6823
  "ECHROME",
6704
6824
  "extension",
6705
6825
  [
@@ -6907,7 +7027,7 @@ p(
6907
7027
  "chrome",
6908
7028
  "Create a context menu",
6909
7029
  ["contextMenus"],
6910
- Pa,
7030
+ Za,
6911
7031
  "ECHROME",
6912
7032
  "extension",
6913
7033
  [],
@@ -6991,7 +7111,7 @@ p(
6991
7111
  "chrome",
6992
7112
  "Get all cookies",
6993
7113
  ["cookies"],
6994
- $t,
7114
+ Bt,
6995
7115
  "ECHROME",
6996
7116
  "extension",
6997
7117
  [],
@@ -7066,7 +7186,7 @@ p(
7066
7186
  "chrome",
7067
7187
  "Download a file",
7068
7188
  ["downloads"],
7069
- $a,
7189
+ to,
7070
7190
  "ECHROME",
7071
7191
  "extension",
7072
7192
  [],
@@ -7077,7 +7197,7 @@ p(
7077
7197
  "chrome",
7078
7198
  "Search downloads",
7079
7199
  ["downloads"],
7080
- Kt,
7200
+ Zt,
7081
7201
  "ECHROME",
7082
7202
  "extension",
7083
7203
  [],
@@ -7088,7 +7208,7 @@ p(
7088
7208
  "chrome",
7089
7209
  "Erase downloads",
7090
7210
  ["downloads"],
7091
- Kt,
7211
+ Zt,
7092
7212
  "ECHROME",
7093
7213
  "extension",
7094
7214
  [],
@@ -7165,7 +7285,7 @@ p(
7165
7285
  "chrome",
7166
7286
  "Search history",
7167
7287
  ["history"],
7168
- $e,
7288
+ Ge,
7169
7289
  "ECHROME",
7170
7290
  "extension",
7171
7291
  [],
@@ -7227,7 +7347,7 @@ p(
7227
7347
  "chrome",
7228
7348
  "Get visits for URL",
7229
7349
  ["history"],
7230
- $e,
7350
+ Ge,
7231
7351
  "ECHROME",
7232
7352
  "extension",
7233
7353
  [],
@@ -7302,7 +7422,7 @@ p(
7302
7422
  "chrome",
7303
7423
  "Create a notification",
7304
7424
  ["notifications"],
7305
- Gt,
7425
+ Kt,
7306
7426
  "ECHROME",
7307
7427
  "extension",
7308
7428
  [
@@ -7326,7 +7446,7 @@ p(
7326
7446
  "chrome",
7327
7447
  "Clear a notification",
7328
7448
  ["notifications"],
7329
- Bt,
7449
+ Vt,
7330
7450
  "ECHROME",
7331
7451
  "extension",
7332
7452
  [
@@ -7386,7 +7506,7 @@ w(
7386
7506
  "chrome.pageCapture.saveAsMHTML({ tabId: 123 })",
7387
7507
  "Blob"
7388
7508
  );
7389
- async function rr(e, r, n, a) {
7509
+ async function ar(e, r, n, a) {
7390
7510
  var l;
7391
7511
  const o = window.chrome;
7392
7512
  if (!((l = o == null ? void 0 : o.runtime) != null && l.id))
@@ -7395,11 +7515,11 @@ async function rr(e, r, n, a) {
7395
7515
  "E_NO_EXTENSION",
7396
7516
  "permission"
7397
7517
  );
7398
- const i = Ue(
7518
+ const i = je(
7399
7519
  e,
7400
- Le(a, e)
7401
- ), s = It(o, r, n), c = await Promise.resolve(kt(s, i));
7402
- return await ft(), c;
7520
+ He(a, e)
7521
+ ), s = vt(o, r, n), c = await Promise.resolve(It(s, i));
7522
+ return await gt(), c;
7403
7523
  }
7404
7524
  w(
7405
7525
  "chrome_permissions_contains",
@@ -7426,7 +7546,7 @@ m({
7426
7546
  returns: J,
7427
7547
  owner: "main-thread",
7428
7548
  returnType: "boolean",
7429
- handler: async (e) => rr(
7549
+ handler: async (e) => ar(
7430
7550
  "chrome_permissions_remove",
7431
7551
  ["permissions"],
7432
7552
  "remove",
@@ -7446,7 +7566,7 @@ m({
7446
7566
  returns: J,
7447
7567
  owner: "main-thread",
7448
7568
  returnType: "boolean",
7449
- handler: async (e) => rr(
7569
+ handler: async (e) => ar(
7450
7570
  "chrome_permissions_request",
7451
7571
  ["permissions"],
7452
7572
  "request",
@@ -7509,7 +7629,7 @@ p(
7509
7629
  "chrome",
7510
7630
  "Execute a script",
7511
7631
  ["scripting"],
7512
- Oa,
7632
+ Va,
7513
7633
  "ECHROME",
7514
7634
  "extension",
7515
7635
  [],
@@ -7544,7 +7664,7 @@ p(
7544
7664
  "chrome",
7545
7665
  "Get recently closed sessions",
7546
7666
  ["sessions"],
7547
- Ge,
7667
+ Be,
7548
7668
  "ECHROME",
7549
7669
  "extension",
7550
7670
  [],
@@ -7555,7 +7675,7 @@ p(
7555
7675
  "chrome",
7556
7676
  "Restore a session",
7557
7677
  ["sessions"],
7558
- Ge,
7678
+ Be,
7559
7679
  "ECHROME",
7560
7680
  "extension",
7561
7681
  [
@@ -7573,7 +7693,7 @@ p(
7573
7693
  "chrome",
7574
7694
  "Get synced devices",
7575
7695
  ["sessions"],
7576
- Fa,
7696
+ Ya,
7577
7697
  "ECHROME",
7578
7698
  "extension",
7579
7699
  [],
@@ -7606,7 +7726,7 @@ p(
7606
7726
  "chrome",
7607
7727
  "Get CPU info",
7608
7728
  ["system", "cpu"],
7609
- Ga,
7729
+ ro,
7610
7730
  "ECHROME",
7611
7731
  "extension",
7612
7732
  [],
@@ -7617,7 +7737,7 @@ p(
7617
7737
  "chrome",
7618
7738
  "Get memory info",
7619
7739
  ["system", "memory"],
7620
- Ba,
7740
+ no,
7621
7741
  "ECHROME",
7622
7742
  "extension",
7623
7743
  [],
@@ -7628,7 +7748,7 @@ p(
7628
7748
  "chrome",
7629
7749
  "Get storage info",
7630
7750
  ["system", "storage"],
7631
- Ka,
7751
+ ao,
7632
7752
  "ECHROME",
7633
7753
  "extension",
7634
7754
  [],
@@ -7639,7 +7759,7 @@ p(
7639
7759
  "chrome",
7640
7760
  "Query tab groups",
7641
7761
  ["tabGroups"],
7642
- Ua,
7762
+ Xa,
7643
7763
  "ECHROME",
7644
7764
  "extension",
7645
7765
  [],
@@ -7879,7 +7999,7 @@ p(
7879
7999
  "chrome",
7880
8000
  "Get all windows",
7881
8001
  ["windows"],
7882
- Na,
8002
+ $a,
7883
8003
  "ECHROME",
7884
8004
  "extension",
7885
8005
  [],
@@ -7925,7 +8045,7 @@ p(
7925
8045
  ],
7926
8046
  "chrome.windows.remove(1)"
7927
8047
  );
7928
- function _i(e, r) {
8048
+ function Ni(e, r) {
7929
8049
  if (r.length === 1 && typeof r[0] == "string")
7930
8050
  switch (e) {
7931
8051
  case "history_delete":
@@ -7944,7 +8064,7 @@ function _i(e, r) {
7944
8064
  return [...r];
7945
8065
  }
7946
8066
  function F(e, r, n, a, o = [], i) {
7947
- const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u = yt(r);
8067
+ const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u = _t(r);
7948
8068
  m({
7949
8069
  action: e,
7950
8070
  namespace: d,
@@ -7954,12 +8074,12 @@ function F(e, r, n, a, o = [], i) {
7954
8074
  returns: a,
7955
8075
  owner: "main-thread",
7956
8076
  permission: u ?? void 0,
7957
- handler: async (h, b) => {
8077
+ handler: async (b, h) => {
7958
8078
  const S = f.child("alias");
7959
- je(e, u);
7960
- const I = _i(
8079
+ Le(e, u);
8080
+ const I = Ni(
7961
8081
  e,
7962
- Le(h, e)
8082
+ He(b, e)
7963
8083
  );
7964
8084
  return S.debug("alias_dispatch", { action: e, target: r, argCount: I.length }), v(await x(r, I));
7965
8085
  },
@@ -8043,7 +8163,7 @@ F(
8043
8163
  "cookies_list",
8044
8164
  "chrome_cookies_getAll",
8045
8165
  "Get all cookies",
8046
- $t,
8166
+ Bt,
8047
8167
  [
8048
8168
  {
8049
8169
  name: "url",
@@ -8058,7 +8178,7 @@ F(
8058
8178
  "history_search",
8059
8179
  "chrome_history_search",
8060
8180
  "Search history",
8061
- $e,
8181
+ Ge,
8062
8182
  [
8063
8183
  {
8064
8184
  name: "text",
@@ -8151,7 +8271,7 @@ F(
8151
8271
  "notifications_create",
8152
8272
  "chrome_notifications_create",
8153
8273
  "Create a notification",
8154
- Gt,
8274
+ Kt,
8155
8275
  [
8156
8276
  {
8157
8277
  name: "id",
@@ -8172,7 +8292,7 @@ F(
8172
8292
  "notifications_clear",
8173
8293
  "chrome_notifications_clear",
8174
8294
  "Clear a notification",
8175
- Bt,
8295
+ Vt,
8176
8296
  [
8177
8297
  {
8178
8298
  name: "id",
@@ -8188,13 +8308,13 @@ m({
8188
8308
  namespace: "host",
8189
8309
  name: "call",
8190
8310
  description: "Call a host handler",
8191
- params: Kn,
8192
- returns: Vn,
8311
+ params: aa,
8312
+ returns: oa,
8193
8313
  fields: ["action", "params"],
8194
8314
  owner: "main-thread",
8195
8315
  handler: async (e, r) => {
8196
- const n = L(e), a = n.action, o = n.params;
8197
- return v(await Et(a, o));
8316
+ const n = H(e), a = n.action, o = n.params;
8317
+ return v(await xt(a, o));
8198
8318
  },
8199
8319
  paramTypes: [
8200
8320
  {
@@ -8215,19 +8335,19 @@ m({
8215
8335
  errorCategory: "host",
8216
8336
  example: 'host.call(["title", "url"])'
8217
8337
  });
8218
- const wi = /* @__PURE__ */ new Set([
8338
+ const Mi = /* @__PURE__ */ new Set([
8219
8339
  "page_snapshot_text",
8220
8340
  "page_snapshot_data",
8221
8341
  "page_snapshot",
8222
8342
  "page_snapshot_query"
8223
8343
  ]);
8224
- function ki(e) {
8225
- return wi.has(e);
8344
+ function Di(e) {
8345
+ return Mi.has(e);
8226
8346
  }
8227
- function Ii(e) {
8347
+ function qi(e) {
8228
8348
  return e === "page_snapshot_text" || e === "page_snapshot";
8229
8349
  }
8230
- async function vi(e) {
8350
+ async function Oi(e) {
8231
8351
  const r = window.chrome;
8232
8352
  try {
8233
8353
  const n = await new Promise((a, o) => {
@@ -8241,7 +8361,7 @@ async function vi(e) {
8241
8361
  }
8242
8362
  return [{ frameId: 0, url: "" }];
8243
8363
  }
8244
- async function Ei(e, r, n, a) {
8364
+ async function Pi(e, r, n, a) {
8245
8365
  const o = window.chrome;
8246
8366
  return Promise.all(
8247
8367
  e.map(async (i) => {
@@ -8258,7 +8378,7 @@ async function Ei(e, r, n, a) {
8258
8378
  runId: r.runId
8259
8379
  },
8260
8380
  c
8261
- ), d = Ke(l);
8381
+ ), d = Ve(l);
8262
8382
  return d.ok ? typeof d.value == "string" ? {
8263
8383
  frameId: i.frameId,
8264
8384
  url: i.url,
@@ -8286,10 +8406,10 @@ async function Ei(e, r, n, a) {
8286
8406
  })
8287
8407
  );
8288
8408
  }
8289
- function nr(e, r) {
8409
+ function or(e, r) {
8290
8410
  return r === 0 ? e : e.replace(/\[e(\d+)\]/g, (n, a) => `[f${r}_e${a}]`);
8291
8411
  }
8292
- function xi(e, r) {
8412
+ function Li(e, r) {
8293
8413
  if (r === 0) return e;
8294
8414
  const n = `f${r}_`;
8295
8415
  return e.map((a) => ({
@@ -8298,7 +8418,7 @@ function xi(e, r) {
8298
8418
  parentRefId: a.parentRefId ? n + a.parentRefId : void 0
8299
8419
  }));
8300
8420
  }
8301
- function Si(e) {
8421
+ function ji(e) {
8302
8422
  const r = [];
8303
8423
  for (const n of e) {
8304
8424
  if (!n.ok) {
@@ -8307,7 +8427,7 @@ function Si(e) {
8307
8427
  );
8308
8428
  continue;
8309
8429
  }
8310
- const a = nr(n.text ?? "", n.frameId);
8430
+ const a = or(n.text ?? "", n.frameId);
8311
8431
  n.frameId === 0 ? r.push(a) : r.push(`--- Frame ${n.frameId}: ${n.url} ---
8312
8432
  ${a}`);
8313
8433
  }
@@ -8315,7 +8435,7 @@ ${a}`);
8315
8435
 
8316
8436
  `);
8317
8437
  }
8318
- function Ti(e) {
8438
+ function Hi(e) {
8319
8439
  const r = [], n = [];
8320
8440
  let a = "", o = "", i = { width: 0, height: 0 }, s;
8321
8441
  for (const l of e) {
@@ -8325,7 +8445,7 @@ function Ti(e) {
8325
8445
  );
8326
8446
  continue;
8327
8447
  }
8328
- const d = nr(String(l.data.text ?? ""), l.frameId), u = xi(
8448
+ const d = or(String(l.data.text ?? ""), l.frameId), u = Li(
8329
8449
  Array.isArray(l.data.nodes) ? l.data.nodes : [],
8330
8450
  l.frameId
8331
8451
  );
@@ -8343,26 +8463,26 @@ ${d}`), n.push(...u);
8343
8463
  };
8344
8464
  return s && (c.observationId = s), c;
8345
8465
  }
8346
- async function Ci(e, r, n) {
8347
- const a = await vi(r), o = await Ei(a, e, r, n);
8348
- return Ii(e.action) ? { ok: !0, value: Si(o) } : { ok: !0, value: Ti(o) };
8466
+ async function Ui(e, r, n) {
8467
+ const a = await Oi(r), o = await Pi(a, e, r, n);
8468
+ return qi(e.action) ? { ok: !0, value: ji(o) } : { ok: !0, value: Hi(o) };
8349
8469
  }
8350
- const Ri = /^f(\d+)_(e\d+)$/;
8351
- function Ai(e) {
8470
+ const Fi = /^f(\d+)_(e\d+)$/;
8471
+ function Wi(e) {
8352
8472
  const r = typeof e.refId == "string" ? e.refId : void 0;
8353
8473
  if (!r) return null;
8354
- const n = r.match(Ri);
8474
+ const n = r.match(Fi);
8355
8475
  return n ? { frameId: Number.parseInt(n[1], 10), localRefId: n[2] } : null;
8356
8476
  }
8357
- class ar {
8477
+ class ir {
8358
8478
  constructor() {
8359
- j(this, "worker", null);
8360
- j(this, "pendingCalls", /* @__PURE__ */ new Map());
8361
- j(this, "inFlightRelays", /* @__PURE__ */ new Map());
8362
- j(this, "disposed", !1);
8363
- j(this, "onCleanupComplete", null);
8364
- j(this, "abortController", null);
8365
- j(this, "runQueue", Promise.resolve());
8479
+ L(this, "worker", null);
8480
+ L(this, "pendingCalls", /* @__PURE__ */ new Map());
8481
+ L(this, "inFlightRelays", /* @__PURE__ */ new Map());
8482
+ L(this, "disposed", !1);
8483
+ L(this, "onCleanupComplete", null);
8484
+ L(this, "abortController", null);
8485
+ L(this, "runQueue", Promise.resolve());
8366
8486
  }
8367
8487
  /**
8368
8488
  * Initialize the extension-js runtime.
@@ -8377,21 +8497,21 @@ class ar {
8377
8497
  */
8378
8498
  static async init() {
8379
8499
  var c;
8380
- if (f.trace("init_start"), De(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
8381
- Tr(chrome);
8382
- const { initCapabilities: l } = await Promise.resolve().then(() => Dr);
8500
+ if (f.trace("init_start"), Me(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
8501
+ Rr(chrome);
8502
+ const { initCapabilities: l } = await Promise.resolve().then(() => qr);
8383
8503
  await l();
8384
8504
  }
8385
- const { freezeJsRegistry: r } = await Promise.resolve().then(() => ze);
8505
+ const { freezeJsRegistry: r } = await Promise.resolve().then(() => Xe);
8386
8506
  r();
8387
- const { getSerializableJsManifest: n } = await Promise.resolve().then(() => ze), a = n(), o = new ar(), [i, s] = o.startWorker(a);
8507
+ const { getSerializableJsManifest: n } = await Promise.resolve().then(() => Xe), a = n(), o = new ir(), [i, s] = o.startWorker(a);
8388
8508
  return await i, f.trace("init_ready"), [o, s];
8389
8509
  }
8390
8510
  startWorker(r) {
8391
8511
  var d;
8392
8512
  let n, a;
8393
- const o = new Promise((u, h) => {
8394
- n = u, a = h;
8513
+ const o = new Promise((u, b) => {
8514
+ n = u, a = b;
8395
8515
  });
8396
8516
  let i = () => {
8397
8517
  };
@@ -8411,15 +8531,15 @@ class ar {
8411
8531
  }, c.onmessageerror = (u) => {
8412
8532
  a(new Error(`Worker message deserialization error: ${u.data}`));
8413
8533
  }, c.onmessage = async (u) => {
8414
- var b;
8415
- const h = u.data;
8416
- switch (h.type) {
8534
+ var h;
8535
+ const b = u.data;
8536
+ switch (b.type) {
8417
8537
  case "ready": {
8418
8538
  c.onmessage = this.handleWorkerMessage.bind(this), n();
8419
8539
  break;
8420
8540
  }
8421
8541
  case "error": {
8422
- const S = typeof h.error == "string" ? h.error : ((b = h.error) == null ? void 0 : b.message) || "Worker init error";
8542
+ const S = typeof b.error == "string" ? b.error : ((h = b.error) == null ? void 0 : h.message) || "Worker init error";
8423
8543
  a(new Error(S));
8424
8544
  break;
8425
8545
  }
@@ -8496,27 +8616,27 @@ class ar {
8496
8616
  runId: n.runId,
8497
8617
  tabPolicy: l
8498
8618
  });
8499
- const h = i;
8500
- h.runId = n.runId, this.executeContextCommand(
8619
+ const b = i;
8620
+ b.runId = n.runId, this.executeContextCommand(
8501
8621
  c,
8502
- h,
8622
+ b,
8503
8623
  l,
8504
8624
  d,
8505
8625
  u.signal
8506
- ).then((b) => {
8626
+ ).then((h) => {
8507
8627
  var S;
8508
- if (!(u.signal.aborted && !(typeof b == "object" && b !== null && "ok" in b && b.ok === !0))) {
8628
+ if (!(u.signal.aborted && !(typeof h == "object" && h !== null && "ok" in h && h.ok === !0))) {
8509
8629
  f.trace("asyncRelayResult", {
8510
8630
  action: s,
8511
8631
  id: d,
8512
- resultType: typeof b
8632
+ resultType: typeof h
8513
8633
  });
8514
8634
  try {
8515
8635
  (S = this.worker) == null || S.postMessage({
8516
8636
  type: "asyncRelayResult",
8517
8637
  id: d,
8518
- result: b,
8519
- callId: h.call_id
8638
+ result: h,
8639
+ callId: b.call_id
8520
8640
  });
8521
8641
  } catch (I) {
8522
8642
  const A = I instanceof Error ? I.message : String(I);
@@ -8527,11 +8647,11 @@ class ar {
8527
8647
  });
8528
8648
  }
8529
8649
  }
8530
- }).catch((b) => {
8650
+ }).catch((h) => {
8531
8651
  var I;
8532
8652
  if (u.signal.aborted)
8533
8653
  return;
8534
- const S = b instanceof Error ? b.message : String(b);
8654
+ const S = h instanceof Error ? h.message : String(h);
8535
8655
  f.error("asyncRelay_error", {
8536
8656
  action: s,
8537
8657
  id: d,
@@ -8545,14 +8665,14 @@ class ar {
8545
8665
  ok: !1,
8546
8666
  error: { message: S, code: "E_RUNNER" }
8547
8667
  },
8548
- callId: h.call_id
8668
+ callId: b.call_id
8549
8669
  });
8550
8670
  } catch (A) {
8551
- const M = A instanceof Error ? A.message : String(A);
8671
+ const D = A instanceof Error ? A.message : String(A);
8552
8672
  f.error("asyncRelayResult_post_failed", {
8553
8673
  action: s,
8554
8674
  id: d,
8555
- error: M
8675
+ error: D
8556
8676
  });
8557
8677
  }
8558
8678
  }).finally(() => {
@@ -8579,8 +8699,8 @@ class ar {
8579
8699
  }), i != null && i.aborted ? Promise.resolve({
8580
8700
  ok: !1,
8581
8701
  error: { message: "Relay aborted", code: "E_ABORT" }
8582
- }) : r === "main-thread" ? vt(n.action) ? this.withMainThreadTimeout(
8583
- Vr(n, i),
8702
+ }) : r === "main-thread" ? Et(n.action) ? this.withMainThreadTimeout(
8703
+ zr(n, i),
8584
8704
  n.action
8585
8705
  ) : Promise.resolve({
8586
8706
  ok: !1,
@@ -8648,7 +8768,7 @@ class ar {
8648
8768
  const s = typeof r.params == "object" && r.params !== null ? r.params : {};
8649
8769
  let c;
8650
8770
  try {
8651
- c = Ar(n, s);
8771
+ c = Mr(n, s);
8652
8772
  } catch (I) {
8653
8773
  return {
8654
8774
  ok: !1,
@@ -8664,18 +8784,18 @@ class ar {
8664
8784
  l = (await i.tabs.get(c)).url ?? "";
8665
8785
  } catch {
8666
8786
  }
8667
- const d = await Qt(c);
8787
+ const d = await Yt(c);
8668
8788
  if (d && !d.ok) return d;
8669
- const u = await Te(c, St);
8789
+ const u = await Te(c, Tt);
8670
8790
  if (!u.ok) return u;
8671
- if (ki(r.action))
8672
- return Ci(r, c, a);
8673
- const h = Ai(s), b = h ? { ...r, params: { ...s, refId: h.localRefId } } : r;
8791
+ if (Di(r.action))
8792
+ return Ui(r, c, a);
8793
+ const b = Wi(s), h = b ? { ...r, params: { ...s, refId: b.localRefId } } : r;
8674
8794
  return this.sendToFrame(
8675
8795
  i,
8676
- b,
8796
+ h,
8677
8797
  c,
8678
- (h == null ? void 0 : h.frameId) ?? 0,
8798
+ (b == null ? void 0 : b.frameId) ?? 0,
8679
8799
  a,
8680
8800
  o,
8681
8801
  l
@@ -8692,7 +8812,7 @@ class ar {
8692
8812
  };
8693
8813
  s == null || s.addEventListener("abort", u, { once: !0 });
8694
8814
  try {
8695
- const h = await r.tabs.sendMessage(
8815
+ const b = await r.tabs.sendMessage(
8696
8816
  a,
8697
8817
  {
8698
8818
  type: "registryCall",
@@ -8703,18 +8823,18 @@ class ar {
8703
8823
  runId: n.runId
8704
8824
  },
8705
8825
  { frameId: o }
8706
- ), b = Ke(h);
8707
- return l && b.ok ? b : l ? {
8826
+ ), h = Ve(b);
8827
+ return l && h.ok ? h : l ? {
8708
8828
  ok: !1,
8709
8829
  error: { message: "Relay aborted", code: "E_ABORT" }
8710
- } : b;
8711
- } catch (h) {
8830
+ } : h;
8831
+ } catch (b) {
8712
8832
  return l || s != null && s.aborted ? {
8713
8833
  ok: !1,
8714
8834
  error: { message: "Relay aborted", code: "E_ABORT" }
8715
8835
  } : {
8716
8836
  ok: !1,
8717
- error: st(h, {
8837
+ error: ct(b, {
8718
8838
  tabId: a,
8719
8839
  url: c,
8720
8840
  action: n.action
@@ -8773,7 +8893,7 @@ class ar {
8773
8893
  ), s;
8774
8894
  }
8775
8895
  setLogLevel(r) {
8776
- f.trace("setLogLevel", { level: r }), lr(r), !(!this.worker || this.disposed) && this.worker.postMessage({
8896
+ f.trace("setLogLevel", { level: r }), ur(r), !(!this.worker || this.disposed) && this.worker.postMessage({
8777
8897
  type: "setLogLevel",
8778
8898
  level: Ne[r]
8779
8899
  });
@@ -8917,10 +9037,10 @@ class ar {
8917
9037
  */
8918
9038
  async stopWith(r) {
8919
9039
  if (!this.disposed) {
8920
- this.disposed = !0, this.abortController = new AbortController(), De(this.abortController), this.abortController.abort();
9040
+ this.disposed = !0, this.abortController = new AbortController(), Me(this.abortController), this.abortController.abort();
8921
9041
  for (const [, n] of this.inFlightRelays)
8922
9042
  n.abort();
8923
- this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }), Cr(), await new Promise((n) => setTimeout(n, 50)), this.worker && (this.worker.terminate(), this.worker = null);
9043
+ this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }), Ar(), await new Promise((n) => setTimeout(n, 50)), this.worker && (this.worker.terminate(), this.worker = null);
8924
9044
  for (const [, n] of this.pendingCalls)
8925
9045
  n.reject(new Error("ExtensionSession stopped"));
8926
9046
  this.pendingCalls.clear(), this.onCleanupComplete && (this.onCleanupComplete(), this.onCleanupComplete = null);
@@ -8935,14 +9055,14 @@ class ar {
8935
9055
  return Math.random().toString(36).slice(2) + Date.now().toString(36);
8936
9056
  }
8937
9057
  }
8938
- function Pi(e, r, n) {
9058
+ function Zi(e, r, n) {
8939
9059
  e.registerWorkerRelayPort(r, n);
8940
9060
  }
8941
9061
  export {
8942
- ar as ExtensionSession,
9062
+ ir as ExtensionSession,
8943
9063
  Ne as LOG_LEVEL_NUMERIC,
8944
- qi as registerHostHandler,
8945
- Oi as registerHostHandlers,
8946
- Pi as registerWorkerRelayPort,
8947
- lr as setLogLevel
9064
+ Ki as registerHostHandler,
9065
+ Vi as registerHostHandlers,
9066
+ Zi as registerWorkerRelayPort,
9067
+ ur as setLogLevel
8948
9068
  };