@pi-oxide/extension-js 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2,8 +2,8 @@ var or = Object.defineProperty;
2
2
  var ir = (e, r, n) => r in e ? or(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
3
  var j = (e, r, n) => ir(e, typeof r != "symbol" ? r + "" : r, n);
4
4
  import { z as t } from "zod";
5
- import { collectDocument as sr, formatSnapshot as tt, init as cr } from "@pi-oxide/dom-semantic-tree";
6
- const Ae = {
5
+ import { collectDocument as sr, formatSnapshot as rt, init as cr } from "@pi-oxide/dom-semantic-tree";
6
+ const Ne = {
7
7
  trace: 0,
8
8
  debug: 1,
9
9
  info: 2,
@@ -11,14 +11,14 @@ const Ae = {
11
11
  error: 4,
12
12
  none: 5
13
13
  };
14
- let rt = "trace";
14
+ let nt = "trace";
15
15
  function lr(e) {
16
- rt = e;
16
+ nt = e;
17
17
  }
18
18
  function dr(e) {
19
- return Ae[e] >= Ae[rt];
19
+ return Ne[e] >= Ne[nt];
20
20
  }
21
- function nt(e, r = "info") {
21
+ function at(e, r = "info") {
22
22
  var n;
23
23
  if (e === null) return "null";
24
24
  if (e === void 0) return "undefined";
@@ -49,7 +49,7 @@ function pr(e, r) {
49
49
  const n = [];
50
50
  try {
51
51
  for (const [a, o] of Object.entries(e))
52
- n.push(`${a}=${nt(o, r)}`);
52
+ n.push(`${a}=${at(o, r)}`);
53
53
  } catch {
54
54
  return " metadata=[unreadable]";
55
55
  }
@@ -58,10 +58,10 @@ 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) => nt(n)).join(" ") }
61
+ metadata: { _args: r.map((n) => at(n)).join(" ") }
62
62
  };
63
63
  }
64
- class De {
64
+ class Me {
65
65
  constructor(r = "root") {
66
66
  this.namespace = r;
67
67
  }
@@ -112,7 +112,7 @@ class De {
112
112
  this.log("error", a, o);
113
113
  }
114
114
  child(r) {
115
- return new De(`${this.namespace}.${r}`);
115
+ return new Me(`${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 De {
129
129
  };
130
130
  }
131
131
  }
132
- const f = new De("root"), at = /* @__PURE__ */ new Set();
132
+ const f = new Me("root"), ot = /* @__PURE__ */ new Set();
133
133
  function mr(e) {
134
- at.add(e);
134
+ ot.add(e);
135
135
  }
136
- function ot(e) {
137
- return at.has(e);
136
+ function it(e) {
137
+ return ot.has(e);
138
138
  }
139
139
  function le(e) {
140
140
  return e == null ? {} : e instanceof Map ? Object.fromEntries(
@@ -235,7 +235,7 @@ function wr(e) {
235
235
  }
236
236
  return { name: r, stack: n, line: a };
237
237
  }
238
- function it(e, r) {
238
+ function st(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;
@@ -353,7 +353,7 @@ function kr(e) {
353
353
  };
354
354
  });
355
355
  }
356
- function st(e) {
356
+ function ct(e) {
357
357
  return T(e, 0, 3);
358
358
  }
359
359
  function Ir(e) {
@@ -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 = it(s), l = c.code === "E_EXTENSION" && (typeof s != "object" || s === null || !("code" in s));
410
+ const c = st(s), l = c.code === "E_EXTENSION" && (typeof s != "object" || s === null || !("code" in s));
411
411
  return {
412
412
  ok: !1,
413
413
  error: {
@@ -419,22 +419,22 @@ async function Er(e, r, n, a, o) {
419
419
  }
420
420
  }
421
421
  function xr(e, r) {
422
- return r !== "main-thread" ? r : ot(e) ? "content-script" : r;
422
+ return r !== "main-thread" ? r : it(e) ? "content-script" : r;
423
423
  }
424
- const Te = f.child("tool-registry"), Me = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new Map();
425
- let ct = !1, he = null;
426
- function Ne(e) {
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) {
427
427
  he = e;
428
428
  }
429
- function qe() {
429
+ function Oe() {
430
430
  return he == null ? void 0 : he.signal;
431
431
  }
432
- function Y() {
433
- const e = qe();
432
+ function ee() {
433
+ const e = Oe();
434
434
  if (e != null && e.aborted)
435
435
  throw new Error("Runner aborted: ExtensionSession stopped");
436
436
  }
437
- function lt(e) {
437
+ function dt(e) {
438
438
  m({
439
439
  ...e,
440
440
  owner: "content-script",
@@ -444,7 +444,7 @@ function lt(e) {
444
444
  });
445
445
  }
446
446
  function m(e) {
447
- if (ct)
447
+ if (lt)
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`);
@@ -481,22 +481,22 @@ function m(e) {
481
481
  return i.handler(c, h);
482
482
  },
483
483
  paramTypes: e.paramTypes ?? [],
484
- returnType: e.returnType ?? st(e.returns),
484
+ returnType: e.returnType ?? ct(e.returns),
485
485
  returnDoc: e.returnDoc ?? "Result",
486
486
  errorCode: e.errorCode,
487
487
  errorCategory: e.errorCategory,
488
488
  example: e.example
489
489
  };
490
- Me.set(e.action, s);
490
+ qe.set(e.action, s);
491
491
  }
492
- function Oe(e) {
493
- return Me.get(e);
492
+ function Pe(e) {
493
+ return qe.get(e);
494
494
  }
495
495
  function Sr() {
496
- ct = !0;
497
- const e = dt(), r = [];
496
+ lt = !0;
497
+ const e = ut(), r = [];
498
498
  for (const n of e)
499
- n.owner === "main-thread" ? Oe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? ot(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" ? it(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 dt() {
509
+ function ut() {
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
514
  const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : kr(c.params), d = {
515
- type: c.returnType ?? st(c.returns),
515
+ type: c.returnType ?? ct(c.returns),
516
516
  description: c.returnDoc ?? "Result"
517
517
  };
518
518
  e.push({
@@ -543,8 +543,8 @@ function dt() {
543
543
  return e;
544
544
  }
545
545
  async function x(e, r, n, a, o) {
546
- Te.debug("dispatch_start", { action: e, callId: n, runId: a });
547
- const i = Me.get(e);
546
+ Ce.debug("dispatch_start", { action: e, callId: n, runId: a });
547
+ const i = qe.get(e);
548
548
  if (!i)
549
549
  return {
550
550
  ok: !1,
@@ -554,7 +554,7 @@ async function x(e, r, n, a, o) {
554
554
  category: "unknown"
555
555
  }
556
556
  };
557
- Y();
557
+ ee();
558
558
  const s = await Er(
559
559
  i.params,
560
560
  i.returns,
@@ -562,11 +562,11 @@ async function x(e, r, n, a, o) {
562
562
  r,
563
563
  e
564
564
  );
565
- return s.ok ? (Te.debug("dispatch_done", {
565
+ return s.ok ? (Ce.debug("dispatch_done", {
566
566
  action: e,
567
567
  ok: !0,
568
568
  resultType: typeof s.value
569
- }), s) : (Te.warn("dispatch_error", {
569
+ }), s) : (Ce.warn("dispatch_error", {
570
570
  action: e,
571
571
  error: s.error.message,
572
572
  code: s.error.code
@@ -579,46 +579,46 @@ 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 ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
583
583
  __proto__: null,
584
584
  coerceWasmParams: le,
585
585
  dispatchTool: x,
586
586
  freezeJsRegistry: Sr,
587
- getRunnerSignal: qe,
588
- getSerializableJsManifest: dt,
589
- getTool: Oe,
590
- registerContentScriptJsCall: lt,
587
+ getRunnerSignal: Oe,
588
+ getSerializableJsManifest: ut,
589
+ getTool: Pe,
590
+ registerContentScriptJsCall: dt,
591
591
  registerJsCall: m,
592
- setRunnerAbortController: Ne,
593
- throwIfAborted: Y
592
+ setRunnerAbortController: De,
593
+ throwIfAborted: ee
594
594
  }, Symbol.toStringTag, { value: "Module" }));
595
- let W = null, ye = !1;
596
- const ut = ({ tabId: e }) => {
597
- W = e;
598
- }, pt = (e, r) => {
595
+ let $ = null, ye = !1;
596
+ const pt = ({ tabId: e }) => {
597
+ $ = e;
598
+ }, mt = (e, r) => {
599
599
  var a;
600
600
  const n = window.chrome;
601
- (a = n == null ? void 0 : n.runtime) != null && a.id && r.status === "complete" && (W = e, n.tabs.sendMessage(e, { action: "ping" }).catch(() => {
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
604
  function Tr(e) {
605
605
  var r;
606
- ye || (r = e == null ? void 0 : e.runtime) != null && r.id && (ye = !0, e.tabs.onActivated.addListener(ut), e.tabs.onUpdated.addListener(pt), 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(pt), e.tabs.onUpdated.addListener(mt), e.tabs.query({ active: !0, lastFocusedWindow: !0 }).then((n) => {
607
607
  const a = n[0];
608
- (a == null ? void 0 : a.id) !== void 0 && (W = a.id);
608
+ (a == null ? void 0 : a.id) !== void 0 && ($ = a.id);
609
609
  }).catch(() => {
610
610
  }));
611
611
  }
612
612
  function Cr() {
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(ut), e.tabs.onUpdated.removeListener(pt), ye = !1);
615
+ !((r = e == null ? void 0 : e.runtime) != null && r.id) || !ye || (e.tabs.onActivated.removeListener(pt), e.tabs.onUpdated.removeListener(mt), ye = !1);
616
616
  }
617
- async function mt() {
617
+ async function bt() {
618
618
  var n;
619
619
  const e = f.child("tab-context");
620
- if (e.debug("resolveActiveTabId_start", { activeTabId: W }), W !== null)
621
- return e.debug("resolveActiveTabId_result", { tabId: W }), W;
620
+ if (e.debug("resolveActiveTabId_start", { activeTabId: $ }), $ !== null)
621
+ return e.debug("resolveActiveTabId_result", { tabId: $ }), $;
622
622
  const r = window.chrome;
623
623
  if (!((n = r == null ? void 0 : r.runtime) != null && n.id))
624
624
  return e.warn("resolveActiveTabId_result", {
@@ -628,7 +628,7 @@ async function mt() {
628
628
  try {
629
629
  const o = (await r.tabs.query({ active: !0 }))[0];
630
630
  if (o && typeof o.id == "number")
631
- return W = o.id, e.debug("resolveActiveTabId_result", { tabId: o.id }), o.id;
631
+ return $ = o.id, e.debug("resolveActiveTabId_result", { tabId: o.id }), o.id;
632
632
  } catch {
633
633
  }
634
634
  return e.warn("resolveActiveTabId_result", { tabId: null, reason: "not_found" }), null;
@@ -650,8 +650,8 @@ function Ar(e, r) {
650
650
  throw new Error("tabId must be a finite number or safe integer bigint");
651
651
  if (e === "required")
652
652
  throw new Error("tabId is required for this action");
653
- if (W !== null)
654
- return W;
653
+ if ($ !== null)
654
+ return $;
655
655
  throw new Error("No active tab available");
656
656
  }
657
657
  function y(e, r, n, a) {
@@ -696,7 +696,7 @@ const _e = {
696
696
  tts: "tts",
697
697
  windows: "windows"
698
698
  };
699
- async function bt() {
699
+ async function ht() {
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 bt() {
709
709
  else
710
710
  ce = null;
711
711
  }
712
- async function ht() {
713
- await bt();
712
+ async function ft() {
713
+ await ht();
714
714
  }
715
- function ft(e) {
715
+ function gt(e) {
716
716
  if (e.length === 0) return null;
717
717
  const r = e[0];
718
718
  if (r === "system" && e.length >= 2) {
@@ -722,17 +722,17 @@ function ft(e) {
722
722
  }
723
723
  return r in _e ? _e[r] : r;
724
724
  }
725
- function gt(e) {
725
+ function yt(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 yt(e) {
731
+ function _t(e) {
732
732
  return e === null ? !0 : ce === null ? !1 : ce.has(e);
733
733
  }
734
- function Pe(e, r) {
735
- if (r !== null && !yt(r))
734
+ function je(e, r) {
735
+ if (r !== null && !_t(r))
736
736
  throw y(
737
737
  `Permission denied: ${r} required for ${e}`,
738
738
  "E_PERMISSION",
@@ -741,12 +741,12 @@ function Pe(e, r) {
741
741
  }
742
742
  const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
743
743
  __proto__: null,
744
- checkPermission: Pe,
745
- hasPermission: yt,
746
- initCapabilities: bt,
747
- manifestPermissionForApiPath: ft,
748
- permissionFromChromeAction: gt,
749
- refreshCapabilities: ht
744
+ checkPermission: je,
745
+ hasPermission: _t,
746
+ initCapabilities: ht,
747
+ manifestPermissionForApiPath: gt,
748
+ permissionFromChromeAction: yt,
749
+ refreshCapabilities: ft
750
750
  }, Symbol.toStringTag, { value: "Module" })), Mr = /* @__PURE__ */ new Set([
751
751
  "bookmarks_search",
752
752
  "bookmarks_create",
@@ -760,10 +760,10 @@ const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
760
760
  "notifications_create",
761
761
  "notifications_clear"
762
762
  ]);
763
- function _t(e) {
763
+ function wt(e) {
764
764
  return e.startsWith("chrome_") || Mr.has(e);
765
765
  }
766
- function wt(e, r) {
766
+ function kt(e, r) {
767
767
  return e(...r);
768
768
  }
769
769
  const qr = /* @__PURE__ */ new Set([
@@ -775,10 +775,10 @@ const qr = /* @__PURE__ */ new Set([
775
775
  "chrome_tabs_query",
776
776
  "tab_query"
777
777
  ]);
778
- function je(e, r) {
778
+ function Ue(e, r) {
779
779
  return r.length > 0 ? r : qr.has(e) ? [{}] : r;
780
780
  }
781
- function Ue(e, r) {
781
+ function Le(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 Ue(e, r) {
787
787
  );
788
788
  return e;
789
789
  }
790
- function kt(e, r, n) {
790
+ function It(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,7 +843,7 @@ 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 = ft(a);
846
+ const u = Or(e), h = a.length > 0 ? `chrome.${a.join(".")}` : r, b = gt(a);
847
847
  m({
848
848
  action: e,
849
849
  namespace: h,
@@ -863,14 +863,14 @@ function p(e, r, n, a, o, i, s, c = [], l, d) {
863
863
  "E_NO_EXTENSION",
864
864
  "permission"
865
865
  );
866
- Pe(e, b);
867
- const J = je(
866
+ je(e, b);
867
+ const Y = Ue(
868
868
  e,
869
- Ue(S, e)
870
- ), $ = kt(M, a, u);
871
- A.debug("chrome_passthrough", { action: e, argCount: J.length });
869
+ Le(S, e)
870
+ ), W = It(M, a, u);
871
+ A.debug("chrome_passthrough", { action: e, argCount: Y.length });
872
872
  try {
873
- const _ = await wt($, J);
873
+ const _ = await kt(W, Y);
874
874
  A.debug("chrome_passthrough_ok", { action: e });
875
875
  const G = fe(_);
876
876
  return G === void 0 ? null : G;
@@ -908,16 +908,16 @@ function qi(e, r) {
908
908
  function Oi(e) {
909
909
  Object.assign(Ie, e);
910
910
  }
911
- function It(e) {
911
+ function vt(e) {
912
912
  var r;
913
- if (Oe(e)) return !0;
913
+ if (Pe(e)) return !0;
914
914
  if (e.startsWith("host_")) {
915
915
  const n = e.slice(5);
916
916
  return !!Ie[n] || !!((r = window.__hostHandlers) != null && r[n]);
917
917
  }
918
918
  return !1;
919
919
  }
920
- async function vt(e, r) {
920
+ async function Et(e, r) {
921
921
  var o;
922
922
  const n = f.child("runner");
923
923
  n.debug("handleHostCallAction_start", { action: e });
@@ -954,7 +954,7 @@ async function vt(e, r) {
954
954
  };
955
955
  }
956
956
  }
957
- const ee = 3e4, Et = 300, Pr = 100, jr = 500, xt = 500, St = 500;
957
+ const Q = 3e4, xt = 300, Pr = 100, jr = 500, St = 500, Tt = 500;
958
958
  function L(e) {
959
959
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : {};
960
960
  }
@@ -998,13 +998,13 @@ const Ur = /* @__PURE__ */ new Map([
998
998
  (e) => ({
999
999
  tabId: e[0],
1000
1000
  direction: e[1] ?? "down",
1001
- amount: e[2] ?? Et
1001
+ amount: e[2] ?? xt
1002
1002
  })
1003
1003
  ],
1004
1004
  ["tab_back", (e) => ({ tabId: e[0] })],
1005
1005
  [
1006
1006
  "tab_wait_for_load",
1007
- (e) => ({ tabId: e[0], timeout: e[1] ?? BigInt(ee) })
1007
+ (e) => ({ tabId: e[0], timeout: e[1] ?? BigInt(Q) })
1008
1008
  ],
1009
1009
  ["tab_evaluate", (e) => ({ tabId: e[0], script: e[1] })],
1010
1010
  ["tab_fetch", (e) => ({ tabId: e[0], url: e[1], options: e[2] ?? {} })],
@@ -1013,7 +1013,7 @@ const Ur = /* @__PURE__ */ new Map([
1013
1013
  ["tab_snapshot_data", (e) => ({ tabId: e[0], options: e[1] ?? {} })],
1014
1014
  [
1015
1015
  "page_wait_for",
1016
- (e) => ({ selector: e[0], timeout: e[1] ?? BigInt(ee) })
1016
+ (e) => ({ selector: e[0], timeout: e[1] ?? BigInt(Q) })
1017
1017
  ],
1018
1018
  ["page_extract", (e) => ({ fields: e })],
1019
1019
  ["storage_get_many", (e) => ({ keys: e })],
@@ -1034,7 +1034,7 @@ function Fr(e, r) {
1034
1034
  }
1035
1035
  return r;
1036
1036
  }
1037
- function E(e) {
1037
+ function v(e) {
1038
1038
  if (!e.ok)
1039
1039
  throw y(
1040
1040
  e.error.message,
@@ -1043,32 +1043,32 @@ function E(e) {
1043
1043
  );
1044
1044
  return e.value;
1045
1045
  }
1046
- function $r(e, r) {
1047
- if (!_t(e)) return r;
1046
+ function Wr(e, r) {
1047
+ if (!wt(e)) return r;
1048
1048
  const n = Array.isArray(r) ? r : [];
1049
- return je(e, n);
1049
+ return Ue(e, n);
1050
1050
  }
1051
- function Wr(e) {
1051
+ function $r(e) {
1052
1052
  return {
1053
1053
  ok: !1,
1054
1054
  error: { message: `Unknown action: ${e}`, code: "E_UNKNOWN" }
1055
1055
  };
1056
1056
  }
1057
1057
  function Gr(e) {
1058
- const r = e ?? qe();
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
1063
  async function Br(e, r) {
1064
- if (!It(e.action))
1065
- return { response: Wr(e.action) };
1064
+ if (!vt(e.action))
1065
+ return { response: $r(e.action) };
1066
1066
  if (e.action.startsWith("host_"))
1067
- return { response: await vt(
1067
+ return { response: await Et(
1068
1068
  e.action.slice(5),
1069
1069
  e.params
1070
1070
  ), handler: "host" };
1071
- const n = _t(e.action) ? $r(e.action, e.params) : Fr(e.action, e.params);
1071
+ const n = wt(e.action) ? Wr(e.action, e.params) : Fr(e.action, e.params);
1072
1072
  return { response: await x(
1073
1073
  e.action,
1074
1074
  n,
@@ -1092,7 +1092,7 @@ async function Vr(e, r) {
1092
1092
  return n({ ok: a.ok, ...o ? { handler: o } : {} }), a;
1093
1093
  }
1094
1094
  const Zr = /^e\d+$/;
1095
- let Tt = 0;
1095
+ let Ct = 0;
1096
1096
  function zr() {
1097
1097
  let e = 0;
1098
1098
  for (const r of document.querySelectorAll("[data-ref-id]")) {
@@ -1101,15 +1101,15 @@ function zr() {
1101
1101
  const a = parseInt(n.replace(/^e/, ""), 10);
1102
1102
  !Number.isNaN(a) && a > e && (e = a);
1103
1103
  }
1104
- Tt = e;
1104
+ Ct = e;
1105
1105
  }
1106
- function Ct(e) {
1106
+ function Rt(e) {
1107
1107
  const r = e.getAttribute("data-ref-id");
1108
1108
  if (r && Zr.test(r)) return r;
1109
- const n = `e${++Tt}`;
1109
+ const n = `e${++Ct}`;
1110
1110
  return e.setAttribute("data-ref-id", n), n;
1111
1111
  }
1112
- const Le = 'input, textarea, select, button, a, [role="button"], [role="link"]', Xr = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), Rt = /* @__PURE__ */ new Set([
1112
+ const He = 'input, textarea, select, button, a, [role="button"], [role="link"]', Xr = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), At = /* @__PURE__ */ new Set([
1113
1113
  "p",
1114
1114
  "span",
1115
1115
  "label",
@@ -1140,9 +1140,9 @@ const Le = 'input, textarea, select, button, a, [role="button"], [role="link"]',
1140
1140
  function Qr(e) {
1141
1141
  const r = {};
1142
1142
  if (e instanceof HTMLInputElement)
1143
- 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, Ce(e, r);
1143
+ 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);
1144
1144
  else if (e instanceof HTMLTextAreaElement)
1145
- r.value = e.value, r.disabled = e.disabled, r.readOnly = e.readOnly, Ce(e, r);
1145
+ r.value = e.value, r.disabled = e.disabled, r.readOnly = e.readOnly, Re(e, r);
1146
1146
  else if (e instanceof HTMLSelectElement) {
1147
1147
  if (e.multiple) {
1148
1148
  const n = [];
@@ -1151,11 +1151,11 @@ function Qr(e) {
1151
1151
  r.value = n.join(",");
1152
1152
  } else
1153
1153
  r.value = e.value;
1154
- r.disabled = e.disabled, Ce(e, r);
1154
+ r.disabled = e.disabled, Re(e, r);
1155
1155
  } else e instanceof HTMLOptionElement && (r.value = e.value, r.selected = e.selected, r.disabled = e.disabled);
1156
1156
  return r;
1157
1157
  }
1158
- function Ce(e, r) {
1158
+ function Re(e, r) {
1159
1159
  const n = e.required || e.getAttribute("aria-required") === "true", o = !(e.getAttribute("aria-invalid") === "true") && e.checkValidity();
1160
1160
  n && (r.required = !0), r.valid = o, r.invalid = !o;
1161
1161
  const i = Jr(e);
@@ -1193,7 +1193,7 @@ function ve(e) {
1193
1193
  function tn(e) {
1194
1194
  const r = e.closest("article[data-post-id], [data-post-id]");
1195
1195
  if (r)
1196
- return Ct(r);
1196
+ return Rt(r);
1197
1197
  }
1198
1198
  function rn(e) {
1199
1199
  const r = e.querySelector(
@@ -1226,7 +1226,7 @@ function nn(e) {
1226
1226
  return !0;
1227
1227
  return !1;
1228
1228
  }
1229
- function At(e, r = 60) {
1229
+ function Nt(e, r = 60) {
1230
1230
  var o, i;
1231
1231
  const n = [];
1232
1232
  for (const s of e.childNodes)
@@ -1252,7 +1252,7 @@ function an(e) {
1252
1252
  function on(e) {
1253
1253
  return an(e);
1254
1254
  }
1255
- function Nt(e) {
1255
+ function Dt(e) {
1256
1256
  var c;
1257
1257
  const r = e.tagName.toLowerCase();
1258
1258
  if (Xr.has(r) || on(e)) return !1;
@@ -1261,7 +1261,7 @@ function Nt(e) {
1261
1261
  const o = e.getAttribute("aria-live");
1262
1262
  if (o && o !== "off") return !0;
1263
1263
  const i = e.getAttribute("role");
1264
- return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(Rt.has(r) || nn(e)) : !1;
1264
+ return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(At.has(r) || nn(e)) : !1;
1265
1265
  }
1266
1266
  function Ee(e) {
1267
1267
  var s, c, l;
@@ -1281,22 +1281,22 @@ function Ee(e) {
1281
1281
  const i = X(e);
1282
1282
  if (i !== "generic" && i !== "list" && i !== "table" && i !== "row" && i !== "region" && i !== "navigation" && i !== "main")
1283
1283
  return ((c = e.textContent) == null ? void 0 : c.trim().slice(0, 60)) || "";
1284
- if (i === "generic" && Nt(e)) {
1285
- const d = At(e);
1284
+ if (i === "generic" && Dt(e)) {
1285
+ const d = Nt(e);
1286
1286
  if (d) return d;
1287
1287
  const u = e.tagName.toLowerCase();
1288
- if (Rt.has(u) || e.childElementCount === 0)
1288
+ if (At.has(u) || e.childElementCount === 0)
1289
1289
  return ((l = e.textContent) == null ? void 0 : l.trim().slice(0, 60)) || "";
1290
1290
  }
1291
1291
  return "";
1292
1292
  }
1293
1293
  function sn(e) {
1294
- return e instanceof HTMLInputElement && e.type === "file" || cn(e) || Dt(e) ? !0 : Nt(e);
1294
+ return e instanceof HTMLInputElement && e.type === "file" || cn(e) || Mt(e) ? !0 : Dt(e);
1295
1295
  }
1296
1296
  function cn(e) {
1297
1297
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !e.checkValidity() || e.getAttribute("aria-invalid") === "true" : !1;
1298
1298
  }
1299
- function Dt(e) {
1299
+ function Mt(e) {
1300
1300
  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
1301
  }
1302
1302
  function ln(e) {
@@ -1331,7 +1331,7 @@ const un = {
1331
1331
  template: !0
1332
1332
  }, pn = (e, r) => Yr(e, r), mn = (e, r) => {
1333
1333
  var a;
1334
- if (!Dt(e)) return;
1334
+ if (!Mt(e)) return;
1335
1335
  r.controlType = "validation-proxy", r.actionable = !1;
1336
1336
  const n = (a = e.closest('[role="combobox"]')) == null ? void 0 : a.getAttribute("data-ref-id");
1337
1337
  n && (r.forControl = n);
@@ -1374,10 +1374,10 @@ const un = {
1374
1374
  kn
1375
1375
  ].forEach((n) => n(e, r)), vn = (e, r, n) => {
1376
1376
  const a = {
1377
- refId: Ct(e),
1377
+ refId: Rt(e),
1378
1378
  role: X(e),
1379
1379
  tag: e.tagName.toLowerCase(),
1380
- text: At(e, 100)
1380
+ text: Nt(e, 100)
1381
1381
  }, o = Ee(e);
1382
1382
  return o && (a.name = o), (a.tag === "img" || a.tag === "a") && n && (a.parentRefId = n), In(e, a), a;
1383
1383
  }, En = (e, r) => {
@@ -1497,9 +1497,9 @@ function qn(e) {
1497
1497
  };
1498
1498
  });
1499
1499
  }
1500
- let Re = null;
1501
- function Mt() {
1502
- return Re || (Re = cr()), Re ?? Promise.resolve();
1500
+ let Ae = null;
1501
+ function qt() {
1502
+ return Ae || (Ae = cr()), Ae ?? Promise.resolve();
1503
1503
  }
1504
1504
  async function xe(e) {
1505
1505
  const r = f.child("runner");
@@ -1508,7 +1508,7 @@ async function xe(e) {
1508
1508
  max_nodes: e == null ? void 0 : e.max_nodes
1509
1509
  });
1510
1510
  try {
1511
- if (await Mt(), typeof document > "u" || !document.body)
1511
+ if (await qt(), typeof document > "u" || !document.body)
1512
1512
  return {
1513
1513
  ok: !1,
1514
1514
  error: {
@@ -1519,7 +1519,7 @@ async function xe(e) {
1519
1519
  };
1520
1520
  const n = {};
1521
1521
  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 = tt(a, "compact-text");
1522
+ const a = sr(n), o = rt(a, "compact-text");
1523
1523
  return r.debug("handleDomSnapshot_result", { status: "ok" }), {
1524
1524
  ok: !0,
1525
1525
  value: { data: a, text: o }
@@ -1539,8 +1539,8 @@ async function On(e) {
1539
1539
  const r = f.child("runner");
1540
1540
  r.debug("handleDomFormat_start", { format: e.format });
1541
1541
  try {
1542
- await Mt();
1543
- const { snapshot: n, format: a } = e, o = tt(n, a);
1542
+ await qt();
1543
+ const { snapshot: n, format: a } = e, o = rt(n, a);
1544
1544
  return r.debug("handleDomFormat_result", { status: "ok" }), { ok: !0, value: o };
1545
1545
  } catch (n) {
1546
1546
  const a = n instanceof Error ? n.message : String(n);
@@ -1553,11 +1553,11 @@ async function On(e) {
1553
1553
  };
1554
1554
  }
1555
1555
  }
1556
- const ze = 8 * 1024;
1556
+ const Xe = 8 * 1024;
1557
1557
  function Pn(e) {
1558
1558
  let r = "";
1559
- for (let n = 0; n < e.length; n += ze) {
1560
- const a = e.subarray(n, n + ze);
1559
+ for (let n = 0; n < e.length; n += Xe) {
1560
+ const a = e.subarray(n, n + Xe);
1561
1561
  for (let o = 0; o < a.length; o++)
1562
1562
  r += String.fromCharCode(a[o]);
1563
1563
  }
@@ -1574,14 +1574,14 @@ function Ln(e) {
1574
1574
  if (e[r] === 0) return !0;
1575
1575
  return !1;
1576
1576
  }
1577
- function qt(e) {
1577
+ function Ot(e) {
1578
1578
  return Object.fromEntries(e.headers.entries());
1579
1579
  }
1580
- function Xe(e, r, n) {
1580
+ function Qe(e, r, n) {
1581
1581
  return {
1582
1582
  status: e.status,
1583
1583
  ok: e.ok,
1584
- headers: qt(e),
1584
+ headers: Ot(e),
1585
1585
  body: Pn(r),
1586
1586
  bodyEncoding: "base64",
1587
1587
  byteLength: r.length,
@@ -1589,11 +1589,11 @@ function Xe(e, r, n) {
1589
1589
  finalUrl: e.url
1590
1590
  };
1591
1591
  }
1592
- function Qe(e, r, n) {
1592
+ function Je(e, r, n) {
1593
1593
  return {
1594
1594
  status: e.status,
1595
1595
  ok: e.ok,
1596
- headers: qt(e),
1596
+ headers: Ot(e),
1597
1597
  body: r,
1598
1598
  bodyEncoding: "text",
1599
1599
  byteLength: new TextEncoder().encode(r).length,
@@ -1605,25 +1605,25 @@ async function Hn(e) {
1605
1605
  const r = e.headers.get("content-type") || "", n = jn(r);
1606
1606
  if (Un(n)) {
1607
1607
  const o = new Uint8Array(await e.arrayBuffer());
1608
- return Xe(e, o, r);
1608
+ return Qe(e, o, r);
1609
1609
  }
1610
1610
  if (!n || n.startsWith("text/")) {
1611
1611
  const o = new Uint8Array(await e.arrayBuffer());
1612
1612
  if (Ln(o))
1613
- return Xe(e, o, r);
1613
+ return Qe(e, o, r);
1614
1614
  const i = new TextDecoder().decode(o);
1615
- return Qe(e, i, r);
1615
+ return Je(e, i, r);
1616
1616
  }
1617
1617
  const a = await e.text();
1618
- return Qe(e, a, r);
1618
+ return Je(e, a, r);
1619
1619
  }
1620
1620
  async function Fn(e) {
1621
- Y();
1621
+ ee();
1622
1622
  const { url: r, method: n, headers: a, body: o, timeout: i } = e;
1623
1623
  try {
1624
1624
  const s = new AbortController(), c = setTimeout(
1625
1625
  () => s.abort(),
1626
- Number(i) ?? ee
1626
+ Number(i) ?? Q
1627
1627
  ), l = {
1628
1628
  method: n || "GET",
1629
1629
  headers: typeof a == "object" && a !== null ? a : {},
@@ -1658,7 +1658,7 @@ t.union([
1658
1658
  t.number(),
1659
1659
  t.record(t.unknown())
1660
1660
  ]);
1661
- const $n = t.union([
1661
+ const Wn = t.union([
1662
1662
  t.number(),
1663
1663
  t.record(t.unknown())
1664
1664
  ]);
@@ -1760,10 +1760,10 @@ t.union([
1760
1760
  t.record(t.unknown());
1761
1761
  t.record(t.unknown());
1762
1762
  t.record(t.unknown());
1763
- const Wn = t.object({}), Gn = t.union([
1763
+ const $n = t.object({}), Gn = t.union([
1764
1764
  t.tuple([t.union([t.object({ text: t.string() }), t.string()])]),
1765
1765
  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', He = (e, r) => {
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) => {
1767
1767
  if (e.__invalidPositional !== void 0) {
1768
1768
  r.addIssue({
1769
1769
  code: t.ZodIssueCode.custom,
@@ -1775,8 +1775,8 @@ const Wn = t.object({}), Gn = t.union([
1775
1775
  code: t.ZodIssueCode.custom,
1776
1776
  message: "Either refId or label is required"
1777
1777
  });
1778
- }, Ot = (e, r) => {
1779
- e.x !== void 0 || e.y !== void 0 || He(e, r);
1778
+ }, Pt = (e, r) => {
1779
+ e.x !== void 0 || e.y !== void 0 || Fe(e, r);
1780
1780
  }, C = (e) => t.preprocess(
1781
1781
  (r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
1782
1782
  t.object({
@@ -1784,7 +1784,7 @@ const Wn = t.object({}), Gn = t.union([
1784
1784
  refId: q().optional().describe("Element reference ID (e.g. e2)"),
1785
1785
  label: t.string().optional().describe("Human-readable element label"),
1786
1786
  ...e
1787
- }).superRefine(He)
1787
+ }).superRefine(Fe)
1788
1788
  ), re = {
1789
1789
  tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
1790
1790
  }, H = (e) => t.preprocess(
@@ -1795,7 +1795,7 @@ const Wn = t.object({}), Gn = t.union([
1795
1795
  refId: q().optional().describe("Element reference ID (e.g. e2)"),
1796
1796
  label: t.string().optional().describe("Human-readable element label"),
1797
1797
  ...e
1798
- }).superRefine(He)
1798
+ }).superRefine(Fe)
1799
1799
  );
1800
1800
  t.object({
1801
1801
  path: t.string().describe("File or directory path")
@@ -1825,14 +1825,14 @@ t.object({
1825
1825
  const Kn = t.object({
1826
1826
  action: t.string().describe("Host action name"),
1827
1827
  params: t.object({}).passthrough().optional().describe("Parameters for the host action")
1828
- }).passthrough(), Pt = t.union([
1828
+ }).passthrough(), jt = t.union([
1829
1829
  t.string(),
1830
1830
  t.number(),
1831
1831
  t.boolean(),
1832
1832
  t.null(),
1833
1833
  t.array(t.unknown()),
1834
1834
  t.record(t.unknown())
1835
- ]), Vn = Pt, jt = t.object({
1835
+ ]), Vn = jt, Ut = t.object({
1836
1836
  url: t.string().describe("URL to fetch"),
1837
1837
  method: t.string().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),
1838
1838
  headers: t.record(t.string()).default({}).describe("Request headers as key-value pairs"),
@@ -1859,13 +1859,13 @@ const Kn = t.object({
1859
1859
  code: t.ZodIssueCode.custom,
1860
1860
  message: "Each file entry requires exactly one of url, path, or handle"
1861
1861
  });
1862
- }, Ut = t.object({
1862
+ }, Lt = t.object({
1863
1863
  name: t.string().optional().describe("File name including extension"),
1864
1864
  mimeType: t.string().optional().describe("MIME type (defaults to application/octet-stream)"),
1865
1865
  url: t.string().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
1866
1866
  path: t.string().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
1867
1867
  handle: t.string().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
1868
- }).superRefine(na), Lt = t.discriminatedUnion("kind", [
1868
+ }).superRefine(na), Ht = t.discriminatedUnion("kind", [
1869
1869
  t.object({
1870
1870
  kind: t.literal("bytes"),
1871
1871
  name: t.string().min(1),
@@ -1881,10 +1881,10 @@ const Kn = t.object({
1881
1881
  ]), aa = C({
1882
1882
  value: t.string().describe("Value to fill into the element")
1883
1883
  }), oa = C({
1884
- files: t.array(Ut).min(1).describe("Files to attach to the input")
1884
+ files: t.array(Lt).min(1).describe("Files to attach to the input")
1885
1885
  });
1886
1886
  C({
1887
- files: t.array(Lt).min(1).describe("Resolved files for content-script application")
1887
+ files: t.array(Ht).min(1).describe("Resolved files for content-script application")
1888
1888
  });
1889
1889
  const ia = C({
1890
1890
  text: t.string().describe("Text to type into the element")
@@ -1923,7 +1923,7 @@ const ia = C({
1923
1923
  label: t.string().optional().describe("Human-readable element label"),
1924
1924
  x: t.number().optional().describe("X coordinate to scroll to"),
1925
1925
  y: t.number().optional().describe("Y coordinate to scroll to")
1926
- }).superRefine(Ot)
1926
+ }).superRefine(Pt)
1927
1927
  ), ya = C(), _a = t.object({
1928
1928
  selector: t.string().describe("CSS selector to find elements")
1929
1929
  }), wa = t.object({
@@ -1994,7 +1994,7 @@ const ia = C({
1994
1994
  )
1995
1995
  });
1996
1996
  t.union([g, t.null()]);
1997
- const Fe = t.object({
1997
+ const We = t.object({
1998
1998
  status: t.number().describe("HTTP response status code"),
1999
1999
  ok: t.boolean().describe("Whether the response status is 2xx"),
2000
2000
  headers: t.record(t.string()).describe("Response headers as key-value pairs"),
@@ -2004,7 +2004,7 @@ const Fe = t.object({
2004
2004
  byteLength: t.number().describe("Length of the body in bytes"),
2005
2005
  contentType: t.string().describe("Response Content-Type header"),
2006
2006
  finalUrl: t.string().describe("Final URL after redirects")
2007
- }), Ht = t.object({
2007
+ }), Ft = t.object({
2008
2008
  data: t.object({}).passthrough().describe("Structured snapshot data"),
2009
2009
  text: t.string().describe("Plain text representation of the snapshot")
2010
2010
  }), Sa = t.object({}), Ta = t.object({
@@ -2016,7 +2016,7 @@ const Fe = t.object({
2016
2016
  mutationsReady: t.boolean(),
2017
2017
  hint: t.string().optional(),
2018
2018
  recovery: t.array(t.string()).optional()
2019
- }), Ca = Pt, Ra = t.object({
2019
+ }), Ca = jt, Ra = t.object({
2020
2020
  refId: q().describe("Element reference ID (e.g. e2)"),
2021
2021
  role: t.string().describe("ARIA role of the element"),
2022
2022
  tag: t.string().describe("HTML tag name"),
@@ -2071,7 +2071,7 @@ const Fe = t.object({
2071
2071
  observationId: t.string().optional().describe(
2072
2072
  "Opaque ID of the observation lease granted by this snapshot. Pass to subsequent actions to prove they act on fresh observations."
2073
2073
  )
2074
- }), Ft = t.object({
2074
+ }), Wt = t.object({
2075
2075
  refId: q().optional(),
2076
2076
  tag: t.string(),
2077
2077
  role: t.string().optional(),
@@ -2101,9 +2101,9 @@ const Fe = t.object({
2101
2101
  recommendedAction: t.string().optional(),
2102
2102
  controls: t.string().optional(),
2103
2103
  expanded: t.boolean().optional(),
2104
- children: t.array(t.lazy(() => Ft)).optional().describe("Nested descendants up to `depth`")
2104
+ children: t.array(t.lazy(() => Wt)).optional().describe("Nested descendants up to `depth`")
2105
2105
  }), Aa = t.object({
2106
- nodes: t.array(Ft),
2106
+ nodes: t.array(Wt),
2107
2107
  url: t.string(),
2108
2108
  title: t.string()
2109
2109
  }), N = t.object({
@@ -2175,7 +2175,7 @@ const Fe = t.object({
2175
2175
  }).passthrough(), $e = t.array(Ma), qa = t.object({
2176
2176
  frameId: t.number().describe("Frame ID"),
2177
2177
  result: t.unknown().optional().describe("Script result")
2178
- }), Oa = t.array(qa), Wt = t.string(), Gt = t.boolean(), Pa = t.union([t.string(), t.number()]), ja = t.boolean(), Se = t.object({
2178
+ }), Oa = t.array(qa), Gt = t.string(), Bt = t.boolean(), Pa = t.union([t.string(), t.number()]), ja = t.boolean(), Se = t.object({
2179
2179
  id: t.number().optional().describe("Group ID"),
2180
2180
  collapsed: t.boolean().optional().describe("Whether the group is collapsed"),
2181
2181
  color: t.string().optional().describe("Group color"),
@@ -2185,10 +2185,10 @@ const Fe = t.object({
2185
2185
  lastModified: t.number().optional().describe("Last modified time"),
2186
2186
  tab: N.optional().describe("Tab info"),
2187
2187
  window: de.optional().describe("Window info")
2188
- }).passthrough(), We = t.array(La), Ha = t.object({
2188
+ }).passthrough(), Ge = t.array(La), Ha = t.object({
2189
2189
  deviceName: t.string().optional().describe("Device name"),
2190
- sessions: We.optional().describe("Sessions")
2191
- }).passthrough(), Fa = t.array(Ha), $a = t.object({
2190
+ sessions: Ge.optional().describe("Sessions")
2191
+ }).passthrough(), Fa = t.array(Ha), Wa = t.object({
2192
2192
  id: t.number().optional().describe("Download ID"),
2193
2193
  url: t.string().optional().describe("Download URL"),
2194
2194
  filename: t.string().optional().describe("Filename"),
@@ -2206,7 +2206,7 @@ const Fe = t.object({
2206
2206
  referrer: t.string().optional().describe("Referrer URL"),
2207
2207
  byExtensionId: t.string().optional().describe("Extension ID"),
2208
2208
  byExtensionName: t.string().optional().describe("Extension name")
2209
- }).passthrough(), Bt = t.array($a), Wa = t.number(), Ga = t.object({
2209
+ }).passthrough(), Kt = t.array(Wa), $a = t.number(), Ga = t.object({
2210
2210
  archName: t.string().describe("CPU architecture"),
2211
2211
  modelName: t.string().describe("CPU model"),
2212
2212
  numOfProcessors: t.number().describe("Number of processors"),
@@ -2271,12 +2271,12 @@ const Fe = t.object({
2271
2271
  href: t.string().optional().describe("Filter by href pattern (case-insensitive substring)"),
2272
2272
  src: t.string().optional().describe("Filter by src pattern (case-insensitive substring)"),
2273
2273
  limit: t.number().positive().optional().describe("Maximum filtered nodes to return")
2274
- }).passthrough(), Kt = t.object({
2274
+ }).passthrough(), Vt = t.object({
2275
2275
  filter: go.optional().describe(
2276
2276
  "Semantic filter criteria"
2277
2277
  ),
2278
2278
  max_nodes: t.number().optional().describe("Maximum nodes to collect before filtering")
2279
- }).passthrough(), yo = Kt.extend({
2279
+ }).passthrough(), yo = Vt.extend({
2280
2280
  tabId: t.number().describe("Tab ID")
2281
2281
  }), _o = t.object({
2282
2282
  key: t.string().describe("Storage key to retrieve")
@@ -2302,13 +2302,14 @@ const Fe = t.object({
2302
2302
  active: t.boolean().optional().describe("Whether the tabs are active"),
2303
2303
  currentWindow: t.boolean().optional().describe("Whether the tabs are in the current window"),
2304
2304
  url: t.string().optional().describe("URL pattern to match tabs against")
2305
- }).passthrough(), Ge = No, Vt = t.preprocess(
2305
+ }).passthrough(), Be = No, Zt = t.preprocess(
2306
2306
  (e) => typeof e == "string" ? { url: e } : e,
2307
2307
  t.object({
2308
2308
  url: t.string().optional().describe("URL to open in the new tab"),
2309
- active: t.boolean().optional().describe("Whether to focus the new tab")
2309
+ active: t.boolean().optional().describe("Whether to focus the new tab"),
2310
+ waitForReady: t.boolean().optional().describe("Wait for page load and content-script readiness")
2310
2311
  })
2311
- ), Zt = t.union([
2312
+ ), zt = t.union([
2312
2313
  t.number(),
2313
2314
  t.array(
2314
2315
  t.object({
@@ -2322,13 +2323,13 @@ const Fe = t.object({
2322
2323
  tabId: t.number().optional(),
2323
2324
  tab_id: t.number().optional()
2324
2325
  }).passthrough()
2325
- ]), zt = Zt, Do = Zt, Mo = H(), qo = H({
2326
+ ]), Xt = zt, Do = zt, Mo = H(), qo = H({
2326
2327
  value: t.string().describe("Value to fill into the element")
2327
2328
  }), Oo = H({
2328
- files: t.array(Ut).min(1).describe("Files to attach to the input")
2329
+ files: t.array(Lt).min(1).describe("Files to attach to the input")
2329
2330
  });
2330
2331
  H({
2331
- files: t.array(Lt).min(1).describe("Resolved files for content-script application")
2332
+ files: t.array(Ht).min(1).describe("Resolved files for content-script application")
2332
2333
  });
2333
2334
  const Po = t.preprocess(
2334
2335
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
@@ -2339,7 +2340,7 @@ const Po = t.preprocess(
2339
2340
  label: t.string().optional().describe("Human-readable element label"),
2340
2341
  x: t.number().optional().describe("X coordinate to scroll to"),
2341
2342
  y: t.number().optional().describe("Y coordinate to scroll to")
2342
- }).superRefine(Ot)
2343
+ }).superRefine(Pt)
2343
2344
  ), jo = H({
2344
2345
  text: t.string().describe("Text to type into the element")
2345
2346
  }), Uo = t.object({
@@ -2353,7 +2354,7 @@ const Po = t.preprocess(
2353
2354
  )
2354
2355
  }), Fo = H({
2355
2356
  checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
2356
- }), $o = H(), Wo = H(), Go = t.object({
2357
+ }), Wo = H(), $o = H(), Go = t.object({
2357
2358
  ...re,
2358
2359
  name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
2359
2360
  value: t.string().describe("The `value` of the radio option to check")
@@ -2434,7 +2435,7 @@ function oi(e, r = ai) {
2434
2435
  }
2435
2436
  return { ...r };
2436
2437
  }
2437
- function Be(e) {
2438
+ function Ke(e) {
2438
2439
  return e && typeof e == "object" && e.ok === !1 ? {
2439
2440
  ok: !1,
2440
2441
  error: oi(e.error)
@@ -2487,7 +2488,7 @@ class si {
2487
2488
  for (; Date.now() < a; ) {
2488
2489
  if (this.inFlight.size === 0) {
2489
2490
  if (await new Promise(
2490
- (s) => setTimeout(s, St)
2491
+ (s) => setTimeout(s, Tt)
2491
2492
  ), this.inFlight.size === 0) {
2492
2493
  se.debug("networkTracker_idle", { tabId: this.tabId, traceId: n });
2493
2494
  return;
@@ -2514,9 +2515,9 @@ class si {
2514
2515
  function ci(e) {
2515
2516
  return new Promise((r) => setTimeout(r, e));
2516
2517
  }
2517
- async function Xt(e) {
2518
+ async function Qt(e) {
2518
2519
  var n;
2519
- Y();
2520
+ ee();
2520
2521
  const r = window.chrome;
2521
2522
  if (!((n = r == null ? void 0 : r.tabs) != null && n.get)) return null;
2522
2523
  try {
@@ -2533,9 +2534,9 @@ async function Xt(e) {
2533
2534
  return ke(a);
2534
2535
  }
2535
2536
  }
2536
- async function Ke(e, r = 3e3) {
2537
+ async function Te(e, r = 3e3) {
2537
2538
  var c;
2538
- Y();
2539
+ ee();
2539
2540
  const n = f.child("runner");
2540
2541
  n.debug("pingTabContentScript_start", { tabId: e, timeout: r });
2541
2542
  const a = window.chrome;
@@ -2551,7 +2552,7 @@ async function Ke(e, r = 3e3) {
2551
2552
  const o = Date.now() + r;
2552
2553
  let i = "";
2553
2554
  for (; Date.now() < o; ) {
2554
- Y();
2555
+ ee();
2555
2556
  const l = o - Date.now();
2556
2557
  if (l <= 0) break;
2557
2558
  try {
@@ -2563,7 +2564,7 @@ async function Ke(e, r = 3e3) {
2563
2564
  l
2564
2565
  )
2565
2566
  )
2566
- ]), u = Be(d);
2567
+ ]), u = Ke(d);
2567
2568
  return u.ok ? (n.debug("pingTabContentScript_success", { tabId: e, result: d }), { ok: !0, value: { ok: !0 } }) : (n.debug("pingTabContentScript_rejected", {
2568
2569
  tabId: e,
2569
2570
  error: u.error
@@ -2590,9 +2591,9 @@ async function Ke(e, r = 3e3) {
2590
2591
  error: ge(e, s)
2591
2592
  };
2592
2593
  }
2593
- async function Qt(e, r = 3e4, n) {
2594
+ async function Jt(e, r = 3e4, n) {
2594
2595
  var h;
2595
- Y();
2596
+ ee();
2596
2597
  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;
2597
2598
  a.debug("waitForTabLoad_start", {
2598
2599
  tabId: o,
@@ -2627,14 +2628,14 @@ async function Qt(e, r = 3e4, n) {
2627
2628
  try {
2628
2629
  return await new Promise((b, S) => {
2629
2630
  let I = !1, A = (s == null ? void 0 : s()) ?? !1, M = null;
2630
- const J = () => {
2631
+ const Y = () => {
2631
2632
  try {
2632
- c.tabs.onUpdated.removeListener(Ve);
2633
+ c.tabs.onUpdated.removeListener(Ze);
2633
2634
  } catch {
2634
2635
  }
2635
2636
  M && clearTimeout(M);
2636
- }, $ = (D) => {
2637
- I || (I = !0, J(), D());
2637
+ }, W = (D) => {
2638
+ I || (I = !0, Y(), D());
2638
2639
  }, R = () => {
2639
2640
  s != null && s() && (A = !0);
2640
2641
  }, _ = (D) => {
@@ -2644,14 +2645,14 @@ async function Qt(e, r = 3e4, n) {
2644
2645
  url: D,
2645
2646
  graceMs: u,
2646
2647
  runId: n == null ? void 0 : n.runId
2647
- }), $(b);
2648
+ }), W(b);
2648
2649
  }, u));
2649
2650
  }, G = () => {
2650
2651
  R(), c.tabs.get(o).then((D) => {
2651
- l(D, A) ? $(b) : _(D.url);
2652
+ l(D, A) ? W(b) : _(D.url);
2652
2653
  }).catch(() => {
2653
2654
  });
2654
- }, Ve = (D, oe) => {
2655
+ }, Ze = (D, oe) => {
2655
2656
  D === o && (oe.status === "loading" && (A = !0, a.debug("waitForTabLoad_status", {
2656
2657
  tabId: o,
2657
2658
  status: "loading",
@@ -2662,17 +2663,17 @@ async function Qt(e, r = 3e4, n) {
2662
2663
  runId: n == null ? void 0 : n.runId
2663
2664
  }), _(oe.url)), oe.status === "complete" && G());
2664
2665
  };
2665
- c.tabs.onUpdated.addListener(Ve), c.tabs.get(o).then((D) => {
2666
+ c.tabs.onUpdated.addListener(Ze), c.tabs.get(o).then((D) => {
2666
2667
  R(), D.status === "loading" && (A = !0), a.debug("waitForTabLoad_initial_status", {
2667
2668
  tabId: o,
2668
2669
  status: D.status,
2669
2670
  url: D.url,
2670
2671
  runId: n == null ? void 0 : n.runId
2671
- }), l(D, A) ? $(b) : _(D.url);
2672
+ }), l(D, A) ? W(b) : _(D.url);
2672
2673
  }).catch((D) => {
2673
- $(() => S(D));
2674
+ W(() => S(D));
2674
2675
  }), setTimeout(() => {
2675
- $(() => S(new Error("Timeout waiting for tab load")));
2676
+ W(() => S(new Error("Timeout waiting for tab load")));
2676
2677
  }, r);
2677
2678
  }), a.debug("waitForTabLoad_loaded", {
2678
2679
  tabId: o,
@@ -2704,14 +2705,14 @@ async function Qt(e, r = 3e4, n) {
2704
2705
  return ke(b);
2705
2706
  }
2706
2707
  }
2707
- async function Jt(e) {
2708
- var A, M, J, $;
2708
+ async function Ve(e) {
2709
+ var A, M, Y, W;
2709
2710
  const {
2710
2711
  tabId: r,
2711
2712
  url: n,
2712
2713
  preNavigationUrl: a,
2713
2714
  waitUntil: o,
2714
- timeoutMs: i = ee,
2715
+ timeoutMs: i = Q,
2715
2716
  traceId: s = "?",
2716
2717
  logPrefix: c
2717
2718
  } = e, l = window.chrome;
@@ -2726,17 +2727,17 @@ async function Jt(e) {
2726
2727
  { url: n }
2727
2728
  ]);
2728
2729
  if (!R.ok)
2729
- return E(R);
2730
- const _ = await Qt(r, i, {
2730
+ return v(R);
2731
+ const _ = await Jt(r, i, {
2731
2732
  preNavigationUrl: a,
2732
2733
  getNavSawLoading: () => d,
2733
2734
  runId: s
2734
2735
  });
2735
2736
  if (!_.ok)
2736
- return E(_);
2737
+ return v(_);
2737
2738
  f.debug(`${c}_tab_load_complete`, { traceId: s, tabId: r });
2738
2739
  } finally {
2739
- ($ = (J = l == null ? void 0 : l.tabs) == null ? void 0 : J.onUpdated) == null || $.removeListener(u);
2740
+ (W = (Y = l == null ? void 0 : l.tabs) == null ? void 0 : Y.onUpdated) == null || W.removeListener(u);
2740
2741
  }
2741
2742
  const h = await x("chrome_tabs_get", [r]);
2742
2743
  if (h.ok && h.value) {
@@ -2761,7 +2762,7 @@ async function Jt(e) {
2761
2762
  const R = new si(r);
2762
2763
  try {
2763
2764
  f.debug(`${c}_network_idle_start`, { traceId: s, tabId: r }), R.start();
2764
- const _ = Math.max(St * 2, i);
2765
+ const _ = Math.max(Tt * 2, i);
2765
2766
  await R.waitForIdle(_, s);
2766
2767
  } catch (_) {
2767
2768
  throw f.debug(`${c}_network_idle_timeout`, {
@@ -2777,11 +2778,11 @@ async function Jt(e) {
2777
2778
  R.dispose(), f.debug(`${c}_network_idle_done`, { traceId: s, tabId: r });
2778
2779
  }
2779
2780
  }
2780
- const b = await Ke(r, i);
2781
+ const b = await Te(r, i);
2781
2782
  if (!b.ok)
2782
- return E(b);
2783
+ return v(b);
2783
2784
  await new Promise((R) => setTimeout(R, jr));
2784
- const S = await x("chrome_tabs_get", [r]), I = N.safeParse(E(S));
2785
+ const S = await x("chrome_tabs_get", [r]), I = N.safeParse(v(S));
2785
2786
  if (!I.success)
2786
2787
  throw y(
2787
2788
  `Navigation completed but the resulting tab failed schema validation: ${I.error.message}`,
@@ -3130,7 +3131,7 @@ m({
3130
3131
  namespace: "clipboard",
3131
3132
  name: "read",
3132
3133
  description: "Read text from clipboard",
3133
- params: Wn,
3134
+ params: $n,
3134
3135
  returns: t.string(),
3135
3136
  aliases: [{ namespace: "web.clipboard", name: "read" }],
3136
3137
  owner: "main-thread",
@@ -3185,14 +3186,14 @@ m({
3185
3186
  namespace: "network",
3186
3187
  name: "fetch",
3187
3188
  description: "Make an HTTP request",
3188
- params: jt,
3189
- returns: Fe,
3189
+ params: Ut,
3190
+ returns: We,
3190
3191
  fields: ["url"],
3191
3192
  aliases: [{ namespace: "web", name: "fetch", fields: ["url"] }],
3192
3193
  owner: "main-thread",
3193
3194
  handler: async (e, r) => {
3194
3195
  const n = await Fn(e);
3195
- return E(n);
3196
+ return v(n);
3196
3197
  },
3197
3198
  paramTypes: [
3198
3199
  {
@@ -4004,7 +4005,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4004
4005
  namespace: "page",
4005
4006
  name: "snapshot_query",
4006
4007
  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.",
4007
- params: Kt,
4008
+ params: Vt,
4008
4009
  returns: we,
4009
4010
  paramTypes: [
4010
4011
  {
@@ -4195,8 +4196,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4195
4196
  namespace: "page",
4196
4197
  name: "fetch",
4197
4198
  description: "Fetch in the active tab",
4198
- params: jt,
4199
- returns: Fe,
4199
+ params: Ut,
4200
+ returns: We,
4200
4201
  fields: ["url", "options"],
4201
4202
  paramTypes: [
4202
4203
  {
@@ -4628,7 +4629,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4628
4629
  namespace: "web.tab",
4629
4630
  name: "submit",
4630
4631
  description: "Submit a form in a tab (calls form.requestSubmit())",
4631
- params: Wo,
4632
+ params: $o,
4632
4633
  returns: g,
4633
4634
  paramTypes: [
4634
4635
  {
@@ -4708,7 +4709,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
4708
4709
  namespace: "web.tab",
4709
4710
  name: "hover",
4710
4711
  description: "Hover in a tab",
4711
- params: $o,
4712
+ params: Wo,
4712
4713
  returns: g,
4713
4714
  paramTypes: [
4714
4715
  {
@@ -5016,7 +5017,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
5016
5017
  name: "fetch",
5017
5018
  description: "Fetch in a tab",
5018
5019
  params: Jo,
5019
- returns: Fe,
5020
+ returns: We,
5020
5021
  fields: ["tabId", "url", "options"],
5021
5022
  paramTypes: [
5022
5023
  {
@@ -5077,10 +5078,10 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
5077
5078
  ];
5078
5079
  function tr(e) {
5079
5080
  const { handlerKey: r, ...n } = e;
5080
- lt(n), mr(e.action);
5081
+ dt(n), mr(e.action);
5081
5082
  }
5082
5083
  async function ae(e) {
5083
- const r = await mt();
5084
+ const r = await bt();
5084
5085
  return r === null && Nr(fr(e)), r;
5085
5086
  }
5086
5087
  m({
@@ -5093,7 +5094,7 @@ m({
5093
5094
  owner: "main-thread",
5094
5095
  handler: async (e, r) => {
5095
5096
  const n = await ae("page.url()");
5096
- return E(
5097
+ return v(
5097
5098
  await x("chrome_tabs_get", [n])
5098
5099
  ).url ?? "";
5099
5100
  },
@@ -5112,7 +5113,7 @@ m({
5112
5113
  owner: "main-thread",
5113
5114
  handler: async (e, r) => {
5114
5115
  const n = await ae("page.title()");
5115
- return E(
5116
+ return v(
5116
5117
  await x("chrome_tabs_get", [n])
5117
5118
  ).title ?? "";
5118
5119
  },
@@ -5154,8 +5155,8 @@ m({
5154
5155
  "E_PERMISSION",
5155
5156
  "navigation"
5156
5157
  );
5157
- const c = Number(e.timeout) || ee;
5158
- return Jt({
5158
+ const c = Number(e.timeout) || Q;
5159
+ return Ve({
5159
5160
  tabId: n,
5160
5161
  url: e.url,
5161
5162
  preNavigationUrl: s,
@@ -5193,9 +5194,9 @@ m({
5193
5194
  returns: Ta,
5194
5195
  owner: "main-thread",
5195
5196
  handler: async (e, r) => {
5196
- const n = await ae("page.health()"), a = E(
5197
+ const n = await ae("page.health()"), a = v(
5197
5198
  await x("chrome_tabs_get", [n])
5198
- ), o = a.url ?? "", i = a.title ?? "", s = await Xt(n), c = s && !s.ok ? "blocked" : "ok", d = (await Ke(n, xt)).ok ? "connected" : "missing", u = c === "ok" && d === "connected", h = {
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 = {
5199
5200
  tabId: n,
5200
5201
  url: o,
5201
5202
  title: i,
@@ -5229,7 +5230,7 @@ m({
5229
5230
  owner: "main-thread",
5230
5231
  handler: async (e, r) => {
5231
5232
  const n = await ae("page.reload()");
5232
- return E(await x("chrome_tabs_reload", [n]));
5233
+ return v(await x("chrome_tabs_reload", [n]));
5233
5234
  },
5234
5235
  paramTypes: [],
5235
5236
  returnDoc: "null",
@@ -5272,7 +5273,7 @@ m({
5272
5273
  const n = typeof e == "number" ? e : te(e);
5273
5274
  if (n === null)
5274
5275
  throw y("page_close requires a tabId", "E_MISSING_PARAM");
5275
- return E(await x("chrome_tabs_remove", [n]));
5276
+ return v(await x("chrome_tabs_remove", [n]));
5276
5277
  },
5277
5278
  paramTypes: [
5278
5279
  {
@@ -5291,11 +5292,11 @@ m({
5291
5292
  namespace: "page",
5292
5293
  name: "tabs",
5293
5294
  description: "Query tabs",
5294
- params: Ge,
5295
+ params: Be,
5295
5296
  returns: ne,
5296
5297
  owner: "main-thread",
5297
5298
  handler: async (e, r) => {
5298
- const n = E(
5299
+ const n = v(
5299
5300
  await x("chrome_tabs_query", [e])
5300
5301
  );
5301
5302
  return (Array.isArray(n) ? n : []).map((a) => ({
@@ -5321,14 +5322,14 @@ m({
5321
5322
  namespace: "page",
5322
5323
  name: "switch",
5323
5324
  description: "Switch to a tab",
5324
- params: zt,
5325
+ params: Xt,
5325
5326
  returns: N,
5326
5327
  owner: "main-thread",
5327
5328
  handler: async (e, r) => {
5328
5329
  const n = typeof e == "number" ? e : te(e);
5329
5330
  if (n === null)
5330
5331
  throw y("page_switch requires a tabId", "E_MISSING_PARAM");
5331
- return E(
5332
+ return v(
5332
5333
  await x("chrome_tabs_update", [n, { active: !0 }])
5333
5334
  );
5334
5335
  },
@@ -5349,11 +5350,11 @@ m({
5349
5350
  namespace: "page",
5350
5351
  name: "new_tab",
5351
5352
  description: "Open a new tab",
5352
- params: Vt,
5353
+ params: Zt,
5353
5354
  returns: N,
5354
5355
  fields: ["url"],
5355
5356
  owner: "main-thread",
5356
- handler: async (e, r) => E(await x("chrome_tabs_create", [e])),
5357
+ handler: async (e, r) => v(await x("chrome_tabs_create", [e])),
5357
5358
  paramTypes: [
5358
5359
  {
5359
5360
  name: "url",
@@ -5382,7 +5383,7 @@ m({
5382
5383
  returns: N,
5383
5384
  owner: "main-thread",
5384
5385
  handler: async (e, r) => {
5385
- const n = await ae("page.active_tab()"), a = E(
5386
+ const n = await ae("page.active_tab()"), a = v(
5386
5387
  await x("chrome_tabs_get", [n])
5387
5388
  );
5388
5389
  return { ...a, tabId: typeof a.id == "number" ? a.id : n };
@@ -5399,15 +5400,15 @@ function ui(e) {
5399
5400
  name: Ee(e)
5400
5401
  };
5401
5402
  }
5402
- let Je = 0, Ye, et = /* @__PURE__ */ new Map();
5403
+ let Ye = 0, et, tt = /* @__PURE__ */ new Map();
5403
5404
  function pi(e = []) {
5404
- Je += 1, Ye = `obs${Je}`, et = /* @__PURE__ */ new Map();
5405
+ Ye += 1, et = `obs${Ye}`, tt = /* @__PURE__ */ new Map();
5405
5406
  for (const r of e)
5406
- et.set(r.refId, {
5407
+ tt.set(r.refId, {
5407
5408
  element: r.element,
5408
5409
  fingerprint: ui(r.element)
5409
5410
  });
5410
- return Ye;
5411
+ return et;
5411
5412
  }
5412
5413
  function mi(e) {
5413
5414
  return document.querySelector(
@@ -5427,7 +5428,7 @@ function K(e) {
5427
5428
  var a, o, i;
5428
5429
  const r = e.toLowerCase().trim();
5429
5430
  if (!r) return null;
5430
- const n = Array.from(document.querySelectorAll(Le));
5431
+ const n = Array.from(document.querySelectorAll(He));
5431
5432
  for (const s of n) {
5432
5433
  const c = s.getAttribute("aria-label");
5433
5434
  if (c && c.toLowerCase().trim() === r) return s;
@@ -5449,7 +5450,7 @@ function hi(e) {
5449
5450
  var o;
5450
5451
  const r = e.toLowerCase().trim();
5451
5452
  if (!r) return [];
5452
- const n = Array.from(document.querySelectorAll(Le)), a = [];
5453
+ const n = Array.from(document.querySelectorAll(He)), a = [];
5453
5454
  for (const i of n) {
5454
5455
  const s = i.getAttribute("aria-label"), c = i.placeholder, l = ((o = i.textContent) == null ? void 0 : o.trim()) || "";
5455
5456
  if (![s, c, l].filter(
@@ -5472,7 +5473,7 @@ function fi(e) {
5472
5473
  );
5473
5474
  let n, a;
5474
5475
  r && (n = r.tagName.toLowerCase(), a = X(r));
5475
- const o = Array.from(document.querySelectorAll(Le)), i = [];
5476
+ const o = Array.from(document.querySelectorAll(He)), i = [];
5476
5477
  for (const s of o) {
5477
5478
  const c = s.getAttribute("data-ref-id");
5478
5479
  if (c) {
@@ -5639,7 +5640,7 @@ const yi = /* @__PURE__ */ new Map([
5639
5640
  [
5640
5641
  "sidepanel_scroll",
5641
5642
  (e, r) => {
5642
- const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount : Et;
5643
+ const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount : xt;
5643
5644
  return window.scrollBy({
5644
5645
  top: n === "up" ? -a : a,
5645
5646
  behavior: "smooth"
@@ -6133,7 +6134,7 @@ m({
6133
6134
  name: "snapshot_data",
6134
6135
  description: "Get sidepanel snapshot data",
6135
6136
  params: uo,
6136
- returns: Ht,
6137
+ returns: Ft,
6137
6138
  owner: "main-thread",
6138
6139
  handler: async (e, r) => {
6139
6140
  const n = await xe(e);
@@ -6143,7 +6144,7 @@ m({
6143
6144
  n.error.code,
6144
6145
  n.error.category
6145
6146
  );
6146
- return E(n);
6147
+ return v(n);
6147
6148
  },
6148
6149
  paramTypes: [
6149
6150
  {
@@ -6169,7 +6170,7 @@ m({
6169
6170
  name: "snapshot",
6170
6171
  description: "Take a DOM snapshot",
6171
6172
  params: po,
6172
- returns: Ht,
6173
+ returns: Ft,
6173
6174
  owner: "main-thread",
6174
6175
  handler: async (e, r) => {
6175
6176
  const n = await xe(e);
@@ -6179,7 +6180,7 @@ m({
6179
6180
  n.error.code,
6180
6181
  n.error.category
6181
6182
  );
6182
- return E(n);
6183
+ return v(n);
6183
6184
  },
6184
6185
  paramTypes: [
6185
6186
  {
@@ -6207,7 +6208,7 @@ m({
6207
6208
  params: mo,
6208
6209
  returns: t.string(),
6209
6210
  owner: "main-thread",
6210
- handler: async (e, r) => E(await On(e)),
6211
+ handler: async (e, r) => v(await On(e)),
6211
6212
  paramTypes: [
6212
6213
  {
6213
6214
  name: "snapshot",
@@ -6231,11 +6232,11 @@ m({
6231
6232
  namespace: "web.tab",
6232
6233
  name: "query",
6233
6234
  description: "Query tabs",
6234
- params: Ge,
6235
+ params: Be,
6235
6236
  returns: ne,
6236
6237
  owner: "main-thread",
6237
6238
  handler: async (e, r) => {
6238
- const n = E(
6239
+ const n = v(
6239
6240
  await x("chrome_tabs_query", [e])
6240
6241
  );
6241
6242
  if (n == null) return [];
@@ -6270,10 +6271,10 @@ m({
6270
6271
  aliases: [{ namespace: "tab", name: "current" }],
6271
6272
  owner: "main-thread",
6272
6273
  handler: async (e, r) => {
6273
- const n = await mt();
6274
+ const n = await bt();
6274
6275
  if (n === null)
6275
6276
  throw new Error("No active tab available");
6276
- const a = E(
6277
+ const a = v(
6277
6278
  await x("chrome_tabs_get", [n])
6278
6279
  );
6279
6280
  return { ...a, tabId: typeof a.id == "number" ? a.id : n };
@@ -6289,14 +6290,14 @@ m({
6289
6290
  namespace: "web.tab",
6290
6291
  name: "get",
6291
6292
  description: "Get a tab by id",
6292
- params: $n,
6293
+ params: Wn,
6293
6294
  returns: N,
6294
6295
  fields: ["tabId"],
6295
6296
  aliases: [{ namespace: "tab", name: "get", fields: ["tabId"] }],
6296
6297
  owner: "main-thread",
6297
6298
  handler: async (e, r) => {
6298
6299
  const n = te(L(e));
6299
- return E(await x("chrome_tabs_get", [n]));
6300
+ return v(await x("chrome_tabs_get", [n]));
6300
6301
  },
6301
6302
  paramTypes: [
6302
6303
  {
@@ -6316,11 +6317,11 @@ m({
6316
6317
  namespace: "web.tab",
6317
6318
  name: "find",
6318
6319
  description: "Find tabs matching a query",
6319
- params: Ge,
6320
+ params: Be,
6320
6321
  returns: ne,
6321
6322
  aliases: [{ namespace: "tab", name: "find" }],
6322
6323
  owner: "main-thread",
6323
- handler: async (e, r) => E(await x("chrome_tabs_query", [e])),
6324
+ handler: async (e, r) => v(await x("chrome_tabs_query", [e])),
6324
6325
  paramTypes: [
6325
6326
  {
6326
6327
  name: "query",
@@ -6343,7 +6344,7 @@ m({
6343
6344
  returns: ne,
6344
6345
  aliases: [{ namespace: "tab", name: "list" }],
6345
6346
  owner: "main-thread",
6346
- handler: async (e, r) => E(await x("chrome_tabs_query", [{}])),
6347
+ handler: async (e, r) => v(await x("chrome_tabs_query", [{}])),
6347
6348
  paramTypes: [],
6348
6349
  returnDoc: "All tabs",
6349
6350
  errorCode: "ECHROME",
@@ -6355,12 +6356,24 @@ m({
6355
6356
  namespace: "web.tab",
6356
6357
  name: "create",
6357
6358
  description: "Create a tab",
6358
- params: Vt,
6359
+ params: Zt,
6359
6360
  returns: N,
6360
6361
  fields: ["url"],
6361
6362
  aliases: [{ namespace: "tab", name: "create", fields: ["url"] }],
6362
6363
  owner: "main-thread",
6363
- handler: async (e, r) => E(await x("chrome_tabs_create", [e])),
6364
+ handler: async (e, r) => {
6365
+ const n = e, { waitForReady: a, ...o } = n, i = v(
6366
+ await x("chrome_tabs_create", [o])
6367
+ ), s = i.tabId ?? i.id;
6368
+ return typeof s == "number" && n.url && n.waitForReady !== !1 && (n.url.startsWith("http:") || n.url.startsWith("https:")) ? Ve({
6369
+ tabId: s,
6370
+ url: n.url,
6371
+ preNavigationUrl: i.url,
6372
+ timeoutMs: Q,
6373
+ traceId: r.runId ?? "?",
6374
+ logPrefix: "tab_create"
6375
+ }) : i;
6376
+ },
6364
6377
  paramTypes: [
6365
6378
  {
6366
6379
  name: "url",
@@ -6373,26 +6386,38 @@ m({
6373
6386
  type: "boolean",
6374
6387
  required: !1,
6375
6388
  description: "Whether to focus the new tab (literal)"
6389
+ },
6390
+ {
6391
+ name: "waitForReady",
6392
+ type: "boolean",
6393
+ required: !1,
6394
+ description: "Wait for page load and content-script readiness before returning. Defaults to true for http(s) URLs; set false for raw immediate tab creation."
6376
6395
  }
6377
6396
  ],
6378
6397
  returnDoc: "Created tab",
6379
6398
  errorCode: "ECHROME",
6380
6399
  errorCategory: "extension",
6381
- example: 'web.tab.create("https://example.com")'
6400
+ example: 'web.tab.create("https://example.com")',
6401
+ agentMeta: {
6402
+ notes: [
6403
+ "For http(s) URLs, web.tab.create waits for page load/content-script readiness by default. Set waitForReady: false for raw immediate tab creation; call web.tab.goto({ tabId, url }) before snapshot/click/fill if Chrome has not committed the inactive tab URL."
6404
+ ],
6405
+ relatedApis: ["web.tab.goto", "web.tab.wait_for_load", "web.tab.snapshot"]
6406
+ }
6382
6407
  });
6383
6408
  m({
6384
6409
  action: "tab_activate",
6385
6410
  namespace: "web.tab",
6386
6411
  name: "activate",
6387
6412
  description: "Activate a tab",
6388
- params: zt,
6413
+ params: Xt,
6389
6414
  returns: N,
6390
6415
  owner: "main-thread",
6391
6416
  handler: async (e, r) => {
6392
6417
  const n = typeof e == "number" ? e : te(e);
6393
6418
  if (n === null)
6394
6419
  throw y("tab_activate requires a tabId", "E_MISSING_PARAM");
6395
- return E(
6420
+ return v(
6396
6421
  await x("chrome_tabs_update", [n, { active: !0 }])
6397
6422
  );
6398
6423
  },
@@ -6420,7 +6445,7 @@ m({
6420
6445
  const n = typeof e == "number" ? e : te(e);
6421
6446
  if (n === null)
6422
6447
  throw y("tab_close requires a tabId", "E_MISSING_PARAM");
6423
- return E(await x("chrome_tabs_remove", [n]));
6448
+ return v(await x("chrome_tabs_remove", [n]));
6424
6449
  },
6425
6450
  paramTypes: [
6426
6451
  {
@@ -6448,7 +6473,9 @@ m({
6448
6473
  owner: "main-thread",
6449
6474
  handler: async (e, r) => {
6450
6475
  const n = L(e), a = te(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
6451
- return E(await Qt(a, o));
6476
+ if (a === null)
6477
+ 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;
6452
6479
  },
6453
6480
  paramTypes: [
6454
6481
  {
@@ -6487,7 +6514,7 @@ m({
6487
6514
  tabId: n,
6488
6515
  url: e.url,
6489
6516
  waitUntil: e.waitUntil ?? "load",
6490
- timeoutMs: Number(e.timeout) || ee
6517
+ timeoutMs: Number(e.timeout) || Q
6491
6518
  }), !e.url.startsWith("http:") && !e.url.startsWith("https:"))
6492
6519
  throw y(
6493
6520
  `Navigation blocked: URL scheme not supported (${e.url})`,
@@ -6515,8 +6542,8 @@ m({
6515
6542
  "E_PERMISSION",
6516
6543
  "navigation"
6517
6544
  );
6518
- const c = Number(e.timeout) || ee;
6519
- return Jt({
6545
+ const c = Number(e.timeout) || Q;
6546
+ return Ve({
6520
6547
  tabId: n,
6521
6548
  url: e.url,
6522
6549
  preNavigationUrl: s,
@@ -6551,8 +6578,8 @@ m({
6551
6578
  errorCategory: "navigation",
6552
6579
  example: 'web.tab.goto({ tabId: 42, url: "https://example.com" })'
6553
6580
  });
6554
- const v = t.unknown(), k = t.union([t.null(), t.undefined(), t.boolean()]), Q = k;
6555
- function w(e, r, n, a = v, o, i) {
6581
+ const E = t.unknown(), k = t.union([t.null(), t.undefined(), t.boolean()]), J = k;
6582
+ function w(e, r, n, a = E, o, i) {
6556
6583
  p(
6557
6584
  e,
6558
6585
  "chrome",
@@ -6823,7 +6850,7 @@ w(
6823
6850
  "chrome_browsingData_remove",
6824
6851
  ["browsingData"],
6825
6852
  "Remove browsing data",
6826
- v,
6853
+ E,
6827
6854
  "chrome.browsingData.remove({ since: 0 })",
6828
6855
  "null"
6829
6856
  );
@@ -6831,7 +6858,7 @@ w(
6831
6858
  "chrome_browsingData_removeCache",
6832
6859
  ["browsingData"],
6833
6860
  "Remove cache",
6834
- v,
6861
+ E,
6835
6862
  "chrome.browsingData.removeCache({ since: 0 })",
6836
6863
  "null"
6837
6864
  );
@@ -6839,7 +6866,7 @@ w(
6839
6866
  "chrome_browsingData_removeCookies",
6840
6867
  ["browsingData"],
6841
6868
  "Remove cookies",
6842
- v,
6869
+ E,
6843
6870
  "chrome.browsingData.removeCookies({ since: 0 })",
6844
6871
  "null"
6845
6872
  );
@@ -6847,7 +6874,7 @@ w(
6847
6874
  "chrome_browsingData_removeDownloads",
6848
6875
  ["browsingData"],
6849
6876
  "Remove downloads",
6850
- v,
6877
+ E,
6851
6878
  "chrome.browsingData.removeDownloads({ since: 0 })",
6852
6879
  "null"
6853
6880
  );
@@ -6855,7 +6882,7 @@ w(
6855
6882
  "chrome_browsingData_removeFormData",
6856
6883
  ["browsingData"],
6857
6884
  "Remove form data",
6858
- v,
6885
+ E,
6859
6886
  "chrome.browsingData.removeFormData({ since: 0 })",
6860
6887
  "null"
6861
6888
  );
@@ -6863,7 +6890,7 @@ w(
6863
6890
  "chrome_browsingData_removeHistory",
6864
6891
  ["browsingData"],
6865
6892
  "Remove history",
6866
- v,
6893
+ E,
6867
6894
  "chrome.browsingData.removeHistory({ since: 0 })",
6868
6895
  "null"
6869
6896
  );
@@ -6871,7 +6898,7 @@ w(
6871
6898
  "chrome_browsingData_removePasswords",
6872
6899
  ["browsingData"],
6873
6900
  "Remove passwords",
6874
- Q,
6901
+ J,
6875
6902
  "chrome.browsingData.removePasswords({ since: 0 })",
6876
6903
  "null"
6877
6904
  );
@@ -6974,7 +7001,7 @@ w(
6974
7001
  "chrome_declarativeNetRequest_getDynamicRules",
6975
7002
  ["declarativeNetRequest"],
6976
7003
  "Get dynamic DNR rules",
6977
- v,
7004
+ E,
6978
7005
  "chrome.declarativeNetRequest.getDynamicRules()",
6979
7006
  "Rule[]"
6980
7007
  );
@@ -6982,7 +7009,7 @@ w(
6982
7009
  "chrome_declarativeNetRequest_getEnabledRulesets",
6983
7010
  ["declarativeNetRequest"],
6984
7011
  "Get enabled DNR rulesets",
6985
- v,
7012
+ E,
6986
7013
  "chrome.declarativeNetRequest.getEnabledRulesets()",
6987
7014
  "RulesetInfo[]"
6988
7015
  );
@@ -6990,7 +7017,7 @@ w(
6990
7017
  "chrome_declarativeNetRequest_getSessionRules",
6991
7018
  ["declarativeNetRequest"],
6992
7019
  "Get session DNR rules",
6993
- v,
7020
+ E,
6994
7021
  "chrome.declarativeNetRequest.getSessionRules()",
6995
7022
  "Rule[]"
6996
7023
  );
@@ -6998,7 +7025,7 @@ w(
6998
7025
  "chrome_declarativeNetRequest_updateDynamicRules",
6999
7026
  ["declarativeNetRequest"],
7000
7027
  "Update dynamic DNR rules",
7001
- v,
7028
+ E,
7002
7029
  "chrome.declarativeNetRequest.updateDynamicRules({ addRules: [] })",
7003
7030
  "null"
7004
7031
  );
@@ -7006,7 +7033,7 @@ w(
7006
7033
  "chrome_declarativeNetRequest_updateEnabledRulesets",
7007
7034
  ["declarativeNetRequest"],
7008
7035
  "Update enabled DNR rulesets",
7009
- v,
7036
+ E,
7010
7037
  "chrome.declarativeNetRequest.updateEnabledRulesets({ enableRulesetIds: [] })",
7011
7038
  "null"
7012
7039
  );
@@ -7014,7 +7041,7 @@ w(
7014
7041
  "chrome_declarativeNetRequest_updateSessionRules",
7015
7042
  ["declarativeNetRequest"],
7016
7043
  "Update session DNR rules",
7017
- v,
7044
+ E,
7018
7045
  "chrome.declarativeNetRequest.updateSessionRules({ addRules: [] })",
7019
7046
  "null"
7020
7047
  );
@@ -7022,7 +7049,7 @@ w(
7022
7049
  "chrome_desktopCapture_chooseDesktopMedia",
7023
7050
  ["desktopCapture"],
7024
7051
  "Choose desktop media",
7025
- v,
7052
+ E,
7026
7053
  'chrome.desktopCapture.chooseDesktopMedia(["screen"], (id) => id)',
7027
7054
  "string"
7028
7055
  );
@@ -7030,7 +7057,7 @@ w(
7030
7057
  "chrome_desktopCapture_cancelChooseDesktopMedia",
7031
7058
  ["desktopCapture"],
7032
7059
  "Cancel desktop media picker",
7033
- v,
7060
+ E,
7034
7061
  "chrome.desktopCapture.cancelChooseDesktopMedia(123)",
7035
7062
  "null"
7036
7063
  );
@@ -7039,7 +7066,7 @@ p(
7039
7066
  "chrome",
7040
7067
  "Download a file",
7041
7068
  ["downloads"],
7042
- Wa,
7069
+ $a,
7043
7070
  "ECHROME",
7044
7071
  "extension",
7045
7072
  [],
@@ -7050,7 +7077,7 @@ p(
7050
7077
  "chrome",
7051
7078
  "Search downloads",
7052
7079
  ["downloads"],
7053
- Bt,
7080
+ Kt,
7054
7081
  "ECHROME",
7055
7082
  "extension",
7056
7083
  [],
@@ -7061,7 +7088,7 @@ p(
7061
7088
  "chrome",
7062
7089
  "Erase downloads",
7063
7090
  ["downloads"],
7064
- Bt,
7091
+ Kt,
7065
7092
  "ECHROME",
7066
7093
  "extension",
7067
7094
  [],
@@ -7210,7 +7237,7 @@ w(
7210
7237
  "chrome_identity_getAuthToken",
7211
7238
  ["identity"],
7212
7239
  "Get OAuth auth token",
7213
- v,
7240
+ E,
7214
7241
  "chrome.identity.getAuthToken({ interactive: true })",
7215
7242
  "{ accessToken: string }"
7216
7243
  );
@@ -7218,7 +7245,7 @@ w(
7218
7245
  "chrome_identity_getProfileUserInfo",
7219
7246
  ["identity"],
7220
7247
  "Get profile user info",
7221
- v,
7248
+ E,
7222
7249
  "chrome.identity.getProfileUserInfo()",
7223
7250
  "{ email: string, id: string }"
7224
7251
  );
@@ -7226,7 +7253,7 @@ w(
7226
7253
  "chrome_identity_launchWebAuthFlow",
7227
7254
  ["identity"],
7228
7255
  "Launch web auth flow",
7229
- v,
7256
+ E,
7230
7257
  'chrome.identity.launchWebAuthFlow({ url: "https://example.com/auth" })',
7231
7258
  "string"
7232
7259
  );
@@ -7234,7 +7261,7 @@ w(
7234
7261
  "chrome_idle_queryState",
7235
7262
  ["idle"],
7236
7263
  "Query idle state",
7237
- v,
7264
+ E,
7238
7265
  "chrome.idle.queryState(60)",
7239
7266
  '"active" | "idle" | "locked"'
7240
7267
  );
@@ -7242,7 +7269,7 @@ w(
7242
7269
  "chrome_management_get",
7243
7270
  ["management"],
7244
7271
  "Get extension info",
7245
- v,
7272
+ E,
7246
7273
  'chrome.management.get("extensionId")',
7247
7274
  "ExtensionInfo"
7248
7275
  );
@@ -7250,7 +7277,7 @@ w(
7250
7277
  "chrome_management_getAll",
7251
7278
  ["management"],
7252
7279
  "Get all extensions",
7253
- v,
7280
+ E,
7254
7281
  "chrome.management.getAll()",
7255
7282
  "ExtensionInfo[]"
7256
7283
  );
@@ -7258,7 +7285,7 @@ w(
7258
7285
  "chrome_management_setEnabled",
7259
7286
  ["management"],
7260
7287
  "Enable or disable extension",
7261
- Q,
7288
+ J,
7262
7289
  'chrome.management.setEnabled("extensionId", true)',
7263
7290
  "null"
7264
7291
  );
@@ -7266,7 +7293,7 @@ w(
7266
7293
  "chrome_management_uninstall",
7267
7294
  ["management"],
7268
7295
  "Uninstall extension",
7269
- Q,
7296
+ J,
7270
7297
  'chrome.management.uninstall("extensionId")',
7271
7298
  "null"
7272
7299
  );
@@ -7275,7 +7302,7 @@ p(
7275
7302
  "chrome",
7276
7303
  "Create a notification",
7277
7304
  ["notifications"],
7278
- Wt,
7305
+ Gt,
7279
7306
  "ECHROME",
7280
7307
  "extension",
7281
7308
  [
@@ -7299,7 +7326,7 @@ p(
7299
7326
  "chrome",
7300
7327
  "Clear a notification",
7301
7328
  ["notifications"],
7302
- Gt,
7329
+ Bt,
7303
7330
  "ECHROME",
7304
7331
  "extension",
7305
7332
  [
@@ -7339,7 +7366,7 @@ w(
7339
7366
  "chrome_offscreen_closeDocument",
7340
7367
  ["offscreen"],
7341
7368
  "Close offscreen document",
7342
- Q,
7369
+ J,
7343
7370
  "chrome.offscreen.closeDocument()",
7344
7371
  "null"
7345
7372
  );
@@ -7347,7 +7374,7 @@ w(
7347
7374
  "chrome_offscreen_createDocument",
7348
7375
  ["offscreen"],
7349
7376
  "Create offscreen document",
7350
- v,
7377
+ E,
7351
7378
  'chrome.offscreen.createDocument({ url: "offscreen.html", reasons: ["WORKERS"] })',
7352
7379
  "null"
7353
7380
  );
@@ -7355,7 +7382,7 @@ w(
7355
7382
  "chrome_pageCapture_saveAsMHTML",
7356
7383
  ["pageCapture"],
7357
7384
  "Save page as MHTML",
7358
- v,
7385
+ E,
7359
7386
  "chrome.pageCapture.saveAsMHTML({ tabId: 123 })",
7360
7387
  "Blob"
7361
7388
  );
@@ -7368,17 +7395,17 @@ async function rr(e, r, n, a) {
7368
7395
  "E_NO_EXTENSION",
7369
7396
  "permission"
7370
7397
  );
7371
- const i = je(
7398
+ const i = Ue(
7372
7399
  e,
7373
- Ue(a, e)
7374
- ), s = kt(o, r, n), c = await Promise.resolve(wt(s, i));
7375
- return await ht(), c;
7400
+ Le(a, e)
7401
+ ), s = It(o, r, n), c = await Promise.resolve(kt(s, i));
7402
+ return await ft(), c;
7376
7403
  }
7377
7404
  w(
7378
7405
  "chrome_permissions_contains",
7379
7406
  ["permissions"],
7380
7407
  "Check permission",
7381
- v,
7408
+ E,
7382
7409
  'chrome.permissions.contains({ permissions: ["tabs"] })',
7383
7410
  "boolean"
7384
7411
  );
@@ -7386,7 +7413,7 @@ w(
7386
7413
  "chrome_permissions_getAll",
7387
7414
  ["permissions"],
7388
7415
  "Get all permissions",
7389
- v,
7416
+ E,
7390
7417
  "chrome.permissions.getAll()",
7391
7418
  "{ permissions: string[], origins: string[] }"
7392
7419
  );
@@ -7396,7 +7423,7 @@ m({
7396
7423
  name: "remove",
7397
7424
  description: "Remove permissions",
7398
7425
  params: t.unknown(),
7399
- returns: Q,
7426
+ returns: J,
7400
7427
  owner: "main-thread",
7401
7428
  returnType: "boolean",
7402
7429
  handler: async (e) => rr(
@@ -7416,7 +7443,7 @@ m({
7416
7443
  name: "request",
7417
7444
  description: "Request permissions",
7418
7445
  params: t.unknown(),
7419
- returns: Q,
7446
+ returns: J,
7420
7447
  owner: "main-thread",
7421
7448
  returnType: "boolean",
7422
7449
  handler: async (e) => rr(
@@ -7493,7 +7520,7 @@ p(
7493
7520
  "chrome",
7494
7521
  "Insert CSS into a tab",
7495
7522
  ["scripting"],
7496
- v,
7523
+ E,
7497
7524
  "ECHROME",
7498
7525
  "extension",
7499
7526
  [],
@@ -7505,7 +7532,7 @@ p(
7505
7532
  "chrome",
7506
7533
  "Remove CSS from a tab",
7507
7534
  ["scripting"],
7508
- v,
7535
+ E,
7509
7536
  "ECHROME",
7510
7537
  "extension",
7511
7538
  [],
@@ -7517,7 +7544,7 @@ p(
7517
7544
  "chrome",
7518
7545
  "Get recently closed sessions",
7519
7546
  ["sessions"],
7520
- We,
7547
+ Ge,
7521
7548
  "ECHROME",
7522
7549
  "extension",
7523
7550
  [],
@@ -7528,7 +7555,7 @@ p(
7528
7555
  "chrome",
7529
7556
  "Restore a session",
7530
7557
  ["sessions"],
7531
- We,
7558
+ Ge,
7532
7559
  "ECHROME",
7533
7560
  "extension",
7534
7561
  [
@@ -7801,7 +7828,7 @@ w(
7801
7828
  "chrome_topSites_get",
7802
7829
  ["topSites"],
7803
7830
  "Get top sites",
7804
- v,
7831
+ E,
7805
7832
  "chrome.topSites.get()",
7806
7833
  "MostVisitedURL[]"
7807
7834
  );
@@ -7809,7 +7836,7 @@ w(
7809
7836
  "chrome_tts_getVoices",
7810
7837
  ["tts"],
7811
7838
  "Get TTS voices",
7812
- v,
7839
+ E,
7813
7840
  "chrome.tts.getVoices()",
7814
7841
  "TtsVoice[]"
7815
7842
  );
@@ -7817,7 +7844,7 @@ w(
7817
7844
  "chrome_tts_speak",
7818
7845
  ["tts"],
7819
7846
  "Speak text",
7820
- Q,
7847
+ J,
7821
7848
  'chrome.tts.speak("Hello world")',
7822
7849
  "null"
7823
7850
  );
@@ -7825,7 +7852,7 @@ w(
7825
7852
  "chrome_tts_stop",
7826
7853
  ["tts"],
7827
7854
  "Stop TTS",
7828
- Q,
7855
+ J,
7829
7856
  "chrome.tts.stop()",
7830
7857
  "null"
7831
7858
  );
@@ -7917,7 +7944,7 @@ function _i(e, r) {
7917
7944
  return [...r];
7918
7945
  }
7919
7946
  function F(e, r, n, a, o = [], i) {
7920
- const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u = gt(r);
7947
+ const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u = yt(r);
7921
7948
  m({
7922
7949
  action: e,
7923
7950
  namespace: d,
@@ -7929,12 +7956,12 @@ function F(e, r, n, a, o = [], i) {
7929
7956
  permission: u ?? void 0,
7930
7957
  handler: async (h, b) => {
7931
7958
  const S = f.child("alias");
7932
- Pe(e, u);
7959
+ je(e, u);
7933
7960
  const I = _i(
7934
7961
  e,
7935
- Ue(h, e)
7962
+ Le(h, e)
7936
7963
  );
7937
- return S.debug("alias_dispatch", { action: e, target: r, argCount: I.length }), E(await x(r, I));
7964
+ return S.debug("alias_dispatch", { action: e, target: r, argCount: I.length }), v(await x(r, I));
7938
7965
  },
7939
7966
  paramTypes: o,
7940
7967
  returnDoc: "Alias result",
@@ -8124,7 +8151,7 @@ F(
8124
8151
  "notifications_create",
8125
8152
  "chrome_notifications_create",
8126
8153
  "Create a notification",
8127
- Wt,
8154
+ Gt,
8128
8155
  [
8129
8156
  {
8130
8157
  name: "id",
@@ -8145,7 +8172,7 @@ F(
8145
8172
  "notifications_clear",
8146
8173
  "chrome_notifications_clear",
8147
8174
  "Clear a notification",
8148
- Gt,
8175
+ Bt,
8149
8176
  [
8150
8177
  {
8151
8178
  name: "id",
@@ -8167,7 +8194,7 @@ m({
8167
8194
  owner: "main-thread",
8168
8195
  handler: async (e, r) => {
8169
8196
  const n = L(e), a = n.action, o = n.params;
8170
- return E(await vt(a, o));
8197
+ return v(await Et(a, o));
8171
8198
  },
8172
8199
  paramTypes: [
8173
8200
  {
@@ -8231,7 +8258,7 @@ async function Ei(e, r, n, a) {
8231
8258
  runId: r.runId
8232
8259
  },
8233
8260
  c
8234
- ), d = Be(l);
8261
+ ), d = Ke(l);
8235
8262
  return d.ok ? typeof d.value == "string" ? {
8236
8263
  frameId: i.frameId,
8237
8264
  url: i.url,
@@ -8350,14 +8377,14 @@ class ar {
8350
8377
  */
8351
8378
  static async init() {
8352
8379
  var c;
8353
- if (f.trace("init_start"), Ne(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
8380
+ if (f.trace("init_start"), De(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
8354
8381
  Tr(chrome);
8355
8382
  const { initCapabilities: l } = await Promise.resolve().then(() => Dr);
8356
8383
  await l();
8357
8384
  }
8358
- const { freezeJsRegistry: r } = await Promise.resolve().then(() => Ze);
8385
+ const { freezeJsRegistry: r } = await Promise.resolve().then(() => ze);
8359
8386
  r();
8360
- const { getSerializableJsManifest: n } = await Promise.resolve().then(() => Ze), a = n(), o = new ar(), [i, s] = o.startWorker(a);
8387
+ const { getSerializableJsManifest: n } = await Promise.resolve().then(() => ze), a = n(), o = new ar(), [i, s] = o.startWorker(a);
8361
8388
  return await i, f.trace("init_ready"), [o, s];
8362
8389
  }
8363
8390
  startWorker(r) {
@@ -8552,7 +8579,7 @@ class ar {
8552
8579
  }), i != null && i.aborted ? Promise.resolve({
8553
8580
  ok: !1,
8554
8581
  error: { message: "Relay aborted", code: "E_ABORT" }
8555
- }) : r === "main-thread" ? It(n.action) ? this.withMainThreadTimeout(
8582
+ }) : r === "main-thread" ? vt(n.action) ? this.withMainThreadTimeout(
8556
8583
  Vr(n, i),
8557
8584
  n.action
8558
8585
  ) : Promise.resolve({
@@ -8637,9 +8664,9 @@ class ar {
8637
8664
  l = (await i.tabs.get(c)).url ?? "";
8638
8665
  } catch {
8639
8666
  }
8640
- const d = await Xt(c);
8667
+ const d = await Qt(c);
8641
8668
  if (d && !d.ok) return d;
8642
- const u = await Ke(c, xt);
8669
+ const u = await Te(c, St);
8643
8670
  if (!u.ok) return u;
8644
8671
  if (ki(r.action))
8645
8672
  return Ci(r, c, a);
@@ -8676,7 +8703,7 @@ class ar {
8676
8703
  runId: n.runId
8677
8704
  },
8678
8705
  { frameId: o }
8679
- ), b = Be(h);
8706
+ ), b = Ke(h);
8680
8707
  return l && b.ok ? b : l ? {
8681
8708
  ok: !1,
8682
8709
  error: { message: "Relay aborted", code: "E_ABORT" }
@@ -8687,7 +8714,7 @@ class ar {
8687
8714
  error: { message: "Relay aborted", code: "E_ABORT" }
8688
8715
  } : {
8689
8716
  ok: !1,
8690
- error: it(h, {
8717
+ error: st(h, {
8691
8718
  tabId: a,
8692
8719
  url: c,
8693
8720
  action: n.action
@@ -8748,7 +8775,7 @@ class ar {
8748
8775
  setLogLevel(r) {
8749
8776
  f.trace("setLogLevel", { level: r }), lr(r), !(!this.worker || this.disposed) && this.worker.postMessage({
8750
8777
  type: "setLogLevel",
8751
- level: Ae[r]
8778
+ level: Ne[r]
8752
8779
  });
8753
8780
  }
8754
8781
  reset() {
@@ -8890,7 +8917,7 @@ class ar {
8890
8917
  */
8891
8918
  async stopWith(r) {
8892
8919
  if (!this.disposed) {
8893
- this.disposed = !0, this.abortController = new AbortController(), Ne(this.abortController), this.abortController.abort();
8920
+ this.disposed = !0, this.abortController = new AbortController(), De(this.abortController), this.abortController.abort();
8894
8921
  for (const [, n] of this.inFlightRelays)
8895
8922
  n.abort();
8896
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);
@@ -8913,7 +8940,7 @@ function Pi(e, r, n) {
8913
8940
  }
8914
8941
  export {
8915
8942
  ar as ExtensionSession,
8916
- Ae as LOG_LEVEL_NUMERIC,
8943
+ Ne as LOG_LEVEL_NUMERIC,
8917
8944
  qi as registerHostHandler,
8918
8945
  Oi as registerHostHandlers,
8919
8946
  Pi as registerWorkerRelayPort,