@opentiny/webmcp-cli 0.0.1-alpha.5 → 0.0.2

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.
@@ -2795,11 +2795,11 @@
2795
2795
  jsonPointer = $data;
2796
2796
  data = names_1.default.rootData;
2797
2797
  } else {
2798
- const matches = RELATIVE_JSON_POINTER2.exec($data);
2799
- if (!matches)
2798
+ const matches2 = RELATIVE_JSON_POINTER2.exec($data);
2799
+ if (!matches2)
2800
2800
  throw new Error(`Invalid JSON-pointer: ${$data}`);
2801
- const up = +matches[1];
2802
- jsonPointer = matches[2];
2801
+ const up = +matches2[1];
2802
+ jsonPointer = matches2[2];
2803
2803
  if (jsonPointer === "#") {
2804
2804
  if (up >= dataLevel)
2805
2805
  throw new Error(errorMsg("property/index", up));
@@ -3496,11 +3496,11 @@
3496
3496
  urnComponent.error = "URN can not be parsed";
3497
3497
  return urnComponent;
3498
3498
  }
3499
- const matches = urnComponent.path.match(URN_REG);
3500
- if (matches) {
3499
+ const matches2 = urnComponent.path.match(URN_REG);
3500
+ if (matches2) {
3501
3501
  const scheme = options.scheme || urnComponent.scheme || "urn";
3502
- urnComponent.nid = matches[1].toLowerCase();
3503
- urnComponent.nss = matches[2];
3502
+ urnComponent.nid = matches2[1].toLowerCase();
3503
+ urnComponent.nss = matches2[2];
3504
3504
  const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
3505
3505
  const schemeHandler = getSchemeHandler(urnScheme);
3506
3506
  urnComponent.path = void 0;
@@ -3770,8 +3770,8 @@
3770
3770
  return uriTokens.join("");
3771
3771
  }
3772
3772
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3773
- function getParseError(parsed, matches) {
3774
- if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3773
+ function getParseError(parsed, matches2) {
3774
+ if (matches2[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3775
3775
  return 'URI path must start with "/" when authority is present.';
3776
3776
  }
3777
3777
  if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
@@ -3799,19 +3799,19 @@
3799
3799
  uri2 = "//" + uri2;
3800
3800
  }
3801
3801
  }
3802
- const matches = uri2.match(URI_PARSE);
3803
- if (matches) {
3804
- parsed.scheme = matches[1];
3805
- parsed.userinfo = matches[3];
3806
- parsed.host = matches[4];
3807
- parsed.port = parseInt(matches[5], 10);
3808
- parsed.path = matches[6] || "";
3809
- parsed.query = matches[7];
3810
- parsed.fragment = matches[8];
3802
+ const matches2 = uri2.match(URI_PARSE);
3803
+ if (matches2) {
3804
+ parsed.scheme = matches2[1];
3805
+ parsed.userinfo = matches2[3];
3806
+ parsed.host = matches2[4];
3807
+ parsed.port = parseInt(matches2[5], 10);
3808
+ parsed.path = matches2[6] || "";
3809
+ parsed.query = matches2[7];
3810
+ parsed.fragment = matches2[8];
3811
3811
  if (isNaN(parsed.port)) {
3812
- parsed.port = matches[5];
3812
+ parsed.port = matches2[5];
3813
3813
  }
3814
- const parseError = getParseError(parsed, matches);
3814
+ const parseError = getParseError(parsed, matches2);
3815
3815
  if (parseError !== void 0) {
3816
3816
  parsed.error = parsed.error || parseError;
3817
3817
  malformedAuthorityOrPort = true;
@@ -6651,12 +6651,12 @@
6651
6651
  var DATE2 = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6652
6652
  var DAYS2 = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6653
6653
  function date5(str) {
6654
- const matches = DATE2.exec(str);
6655
- if (!matches)
6654
+ const matches2 = DATE2.exec(str);
6655
+ if (!matches2)
6656
6656
  return false;
6657
- const year = +matches[1];
6658
- const month = +matches[2];
6659
- const day = +matches[3];
6657
+ const year = +matches2[1];
6658
+ const month = +matches2[2];
6659
+ const day = +matches2[3];
6660
6660
  return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear2(year) ? 29 : DAYS2[month]);
6661
6661
  }
6662
6662
  function compareDate(d1, d2) {
@@ -6671,16 +6671,16 @@
6671
6671
  var TIME2 = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6672
6672
  function getTime(strictTimeZone) {
6673
6673
  return function time4(str) {
6674
- const matches = TIME2.exec(str);
6675
- if (!matches)
6674
+ const matches2 = TIME2.exec(str);
6675
+ if (!matches2)
6676
6676
  return false;
6677
- const hr = +matches[1];
6678
- const min = +matches[2];
6679
- const sec = +matches[3];
6680
- const tz = matches[4];
6681
- const tzSign = matches[5] === "-" ? -1 : 1;
6682
- const tzH = +(matches[6] || 0);
6683
- const tzM = +(matches[7] || 0);
6677
+ const hr = +matches2[1];
6678
+ const min = +matches2[2];
6679
+ const sec = +matches2[3];
6680
+ const tz = matches2[4];
6681
+ const tzSign = matches2[5] === "-" ? -1 : 1;
6682
+ const tzH = +(matches2[6] || 0);
6683
+ const tzM = +(matches2[7] || 0);
6684
6684
  if (tzH > 23 || tzM > 59 || strictTimeZone && !tz)
6685
6685
  return false;
6686
6686
  if (hr <= 23 && min <= 59 && sec < 60)
@@ -9569,11 +9569,25 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9569
9569
  }
9570
9570
  });
9571
9571
 
9572
- // ../../node_modules/.pnpm/@page-agent+page-controller@1.8.2/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BbciSmUv.js
9573
- var SimulatorMask_BbciSmUv_exports = {};
9574
- __export(SimulatorMask_BbciSmUv_exports, {
9572
+ // ../../node_modules/.pnpm/@page-agent+page-controller@1.10.0/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BHVXyogh.js
9573
+ var SimulatorMask_BHVXyogh_exports = {};
9574
+ __export(SimulatorMask_BHVXyogh_exports, {
9575
9575
  SimulatorMask: () => SimulatorMask
9576
9576
  });
9577
+ function isPageDark() {
9578
+ try {
9579
+ if (hasDarkModeClass()) return true;
9580
+ if (hasDarkModeDataAttribute()) return true;
9581
+ if (isColorSchemeDark()) return true;
9582
+ if (isBackgroundDark()) return true;
9583
+ if (isMainContentBackgroundDark()) return true;
9584
+ if (isTextColorLight()) return true;
9585
+ return false;
9586
+ } catch (error2) {
9587
+ console.warn("Error determining if page is dark:", error2);
9588
+ return false;
9589
+ }
9590
+ }
9577
9591
  function hasDarkModeClass() {
9578
9592
  const DEFAULT_DARK_MODE_CLASSES = [
9579
9593
  "dark",
@@ -9585,23 +9599,28 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9585
9599
  const htmlElement = document.documentElement;
9586
9600
  const bodyElement = document.body || document.documentElement;
9587
9601
  for (const className of DEFAULT_DARK_MODE_CLASSES) if (htmlElement.classList.contains(className) || bodyElement?.classList.contains(className)) return true;
9588
- if (htmlElement.getAttribute("data-theme")?.toLowerCase().includes("dark")) return true;
9589
9602
  return false;
9590
9603
  }
9591
- function parseRgbColor(colorString) {
9592
- const rgbMatch = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(colorString);
9593
- if (!rgbMatch) return null;
9594
- return {
9595
- r: parseInt(rgbMatch[1]),
9596
- g: parseInt(rgbMatch[2]),
9597
- b: parseInt(rgbMatch[3])
9598
- };
9604
+ function hasDarkModeDataAttribute() {
9605
+ const htmlElement = document.documentElement;
9606
+ const bodyElement = document.body || document.documentElement;
9607
+ for (const attr of [
9608
+ "data-theme",
9609
+ "data-color-mode",
9610
+ "data-bs-theme",
9611
+ "data-mui-color-scheme"
9612
+ ]) {
9613
+ const bodyValue = bodyElement?.getAttribute(attr);
9614
+ const htmlValue = htmlElement.getAttribute(attr);
9615
+ if (bodyValue?.toLowerCase() === "dark" || htmlValue?.toLowerCase() === "dark") return true;
9616
+ }
9617
+ return false;
9599
9618
  }
9600
- function isColorDark(colorString, threshold = 128) {
9601
- if (!colorString || colorString === "transparent" || colorString.startsWith("rgba(0, 0, 0, 0)")) return false;
9602
- const rgb = parseRgbColor(colorString);
9603
- if (!rgb) return false;
9604
- return 0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b < threshold;
9619
+ function isColorSchemeDark() {
9620
+ const metaContent = document.querySelector('meta[name="color-scheme"]')?.content.toLowerCase();
9621
+ if (metaContent === "dark" || metaContent === "only dark") return true;
9622
+ const colorScheme = window.getComputedStyle(document.documentElement).getPropertyValue("color-scheme").trim().toLowerCase();
9623
+ return colorScheme === "dark" || colorScheme === "only dark";
9605
9624
  }
9606
9625
  function isBackgroundDark() {
9607
9626
  const htmlStyle = window.getComputedStyle(document.documentElement);
@@ -9612,19 +9631,49 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9612
9631
  else if (bodyBgColor === "transparent" || bodyBgColor.startsWith("rgba(0, 0, 0, 0)")) return isColorDark(htmlBgColor);
9613
9632
  return false;
9614
9633
  }
9615
- function isPageDark() {
9616
- try {
9617
- if (hasDarkModeClass()) return true;
9618
- if (isBackgroundDark()) return true;
9619
- return false;
9620
- } catch (error2) {
9621
- console.warn("Error determining if page is dark:", error2);
9622
- return false;
9634
+ function isTextColorLight() {
9635
+ const LIGHT_TEXT_LUMINANCE = 200;
9636
+ const luminance = getLuminance(window.getComputedStyle(document.body || document.documentElement).color);
9637
+ return luminance !== null && luminance > LIGHT_TEXT_LUMINANCE;
9638
+ }
9639
+ function isMainContentBackgroundDark() {
9640
+ const { innerWidth: vw, innerHeight: vh } = window;
9641
+ const minArea = vw * vh * 0.5;
9642
+ for (const selector of [
9643
+ "#app",
9644
+ "#root",
9645
+ "#__next"
9646
+ ]) {
9647
+ const el = document.querySelector(selector);
9648
+ if (!el) continue;
9649
+ const rect = el.getBoundingClientRect();
9650
+ if (rect.width * rect.height < minArea) continue;
9651
+ if (isColorDark(window.getComputedStyle(el).backgroundColor)) return true;
9623
9652
  }
9653
+ return false;
9654
+ }
9655
+ function parseRgbColor(colorString) {
9656
+ const rgbMatch = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(colorString);
9657
+ if (!rgbMatch) return null;
9658
+ return {
9659
+ r: parseInt(rgbMatch[1]),
9660
+ g: parseInt(rgbMatch[2]),
9661
+ b: parseInt(rgbMatch[3])
9662
+ };
9663
+ }
9664
+ function getLuminance(colorString) {
9665
+ if (!colorString || colorString === "transparent" || colorString.startsWith("rgba(0, 0, 0, 0)")) return null;
9666
+ const rgb = parseRgbColor(colorString);
9667
+ if (!rgb) return null;
9668
+ return 0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b;
9669
+ }
9670
+ function isColorDark(colorString, threshold = 128) {
9671
+ const luminance = getLuminance(colorString);
9672
+ return luminance !== null && luminance < threshold;
9624
9673
  }
9625
9674
  var SimulatorMask_module_default, cursor_module_default, SimulatorMask;
9626
- var init_SimulatorMask_BbciSmUv = __esm({
9627
- "../../node_modules/.pnpm/@page-agent+page-controller@1.8.2/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BbciSmUv.js"() {
9675
+ var init_SimulatorMask_BHVXyogh = __esm({
9676
+ "../../node_modules/.pnpm/@page-agent+page-controller@1.10.0/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BHVXyogh.js"() {
9628
9677
  init_Motion();
9629
9678
  (function() {
9630
9679
  try {
@@ -9976,7 +10025,6 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9976
10025
  }
9977
10026
  dispose() {
9978
10027
  this.#disposed = true;
9979
- console.log("dispose SimulatorMask");
9980
10028
  this.motion?.dispose();
9981
10029
  this.wrapper.remove();
9982
10030
  this.dispatchEvent(new Event("dispose"));
@@ -10208,22 +10256,22 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
10208
10256
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
10209
10257
  }
10210
10258
  function date(str) {
10211
- const matches = str.match(DATE);
10212
- if (!matches)
10259
+ const matches2 = str.match(DATE);
10260
+ if (!matches2)
10213
10261
  return false;
10214
- const year = +matches[1];
10215
- const month = +matches[2];
10216
- const day = +matches[3];
10262
+ const year = +matches2[1];
10263
+ const month = +matches2[2];
10264
+ const day = +matches2[3];
10217
10265
  return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
10218
10266
  }
10219
10267
  function time(full, str) {
10220
- const matches = str.match(TIME);
10221
- if (!matches)
10268
+ const matches2 = str.match(TIME);
10269
+ if (!matches2)
10222
10270
  return false;
10223
- const hour = +matches[1];
10224
- const minute = +matches[2];
10225
- const second = +matches[3];
10226
- const timeZone = !!matches[5];
10271
+ const hour = +matches2[1];
10272
+ const minute = +matches2[2];
10273
+ const second = +matches2[3];
10274
+ const timeZone = !!matches2[5];
10227
10275
  return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
10228
10276
  }
10229
10277
  var DATE_TIME_SEPARATOR = /t|\s/i;
@@ -10496,7 +10544,7 @@ Known schemas:
10496
10544
  if ($oneOf !== void 0) {
10497
10545
  const keywordLocation = `${schemaLocation}/oneOf`;
10498
10546
  const errorsLength = errors.length;
10499
- const matches = $oneOf.filter((subSchema, i) => {
10547
+ const matches2 = $oneOf.filter((subSchema, i) => {
10500
10548
  const subEvaluated = Object.create(evaluated);
10501
10549
  const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
10502
10550
  errors.push(...result2.errors);
@@ -10505,14 +10553,14 @@ Known schemas:
10505
10553
  }
10506
10554
  return result2.valid;
10507
10555
  }).length;
10508
- if (matches === 1) {
10556
+ if (matches2 === 1) {
10509
10557
  errors.length = errorsLength;
10510
10558
  } else {
10511
10559
  errors.splice(errorsLength, 0, {
10512
10560
  instanceLocation,
10513
10561
  keyword: "oneOf",
10514
10562
  keywordLocation,
10515
- error: `Instance does not match exactly one subschema (${matches} matches).`
10563
+ error: `Instance does not match exactly one subschema (${matches2} matches).`
10516
10564
  });
10517
10565
  }
10518
10566
  }
@@ -11101,15 +11149,15 @@ Known schemas:
11101
11149
  this.notifyToolsChanged();
11102
11150
  }
11103
11151
  registerTool(tool, options) {
11104
- const signal = options?.signal;
11105
- if (signal?.aborted) {
11152
+ const signal2 = options?.signal;
11153
+ if (signal2?.aborted) {
11106
11154
  console.warn(`[WebMCPPolyfill] registerTool("${tool?.name ?? "<unknown>"}") skipped: options.signal was already aborted.`);
11107
11155
  return;
11108
11156
  }
11109
11157
  const normalized = normalizeToolDescriptor(tool, this.tools);
11110
11158
  this.tools.set(normalized.name, normalized);
11111
11159
  this.notifyToolsChanged();
11112
- if (signal) signal.addEventListener("abort", () => {
11160
+ if (signal2) signal2.addEventListener("abort", () => {
11113
11161
  if (this.tools.delete(normalized.name)) this.notifyToolsChanged();
11114
11162
  }, { once: true });
11115
11163
  }
@@ -11486,18 +11534,18 @@ Known schemas:
11486
11534
  throw createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);
11487
11535
  }
11488
11536
  }
11489
- function withAbortSignal(operation, signal) {
11490
- if (!signal) return operation;
11491
- if (signal.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
11537
+ function withAbortSignal(operation, signal2) {
11538
+ if (!signal2) return operation;
11539
+ if (signal2.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
11492
11540
  return new Promise((resolve, reject) => {
11493
11541
  const onAbort = () => {
11494
11542
  cleanup();
11495
11543
  reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
11496
11544
  };
11497
11545
  const cleanup = () => {
11498
- signal.removeEventListener("abort", onAbort);
11546
+ signal2.removeEventListener("abort", onAbort);
11499
11547
  };
11500
- signal.addEventListener("abort", onAbort, { once: true });
11548
+ signal2.addEventListener("abort", onAbort, { once: true });
11501
11549
  operation.then((value) => {
11502
11550
  cleanup();
11503
11551
  resolve(value);
@@ -19503,7 +19551,7 @@ Known schemas:
19503
19551
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
19504
19552
  config(en_default2());
19505
19553
 
19506
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
19554
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
19507
19555
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
19508
19556
  var JSONRPC_VERSION = "2.0";
19509
19557
  var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
@@ -22256,14 +22304,14 @@ Known schemas:
22256
22304
  return combined;
22257
22305
  };
22258
22306
 
22259
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
22307
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
22260
22308
  var import_ajv_formats = __toESM(require_dist(), 1);
22261
22309
 
22262
22310
  // ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
22263
22311
  var crypto2;
22264
22312
  crypto2 = globalThis.crypto;
22265
22313
 
22266
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
22314
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
22267
22315
  var SafeUrlSchema = url().superRefine((val, ctx) => {
22268
22316
  if (!URL.canParse(val)) {
22269
22317
  ctx.addIssue({
@@ -22407,7 +22455,7 @@ Known schemas:
22407
22455
  token_type_hint: string2().optional()
22408
22456
  }).strip();
22409
22457
 
22410
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
22458
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
22411
22459
  var OAuthError = class extends Error {
22412
22460
  constructor(message, errorUri) {
22413
22461
  super(message);
@@ -22502,7 +22550,7 @@ Known schemas:
22502
22550
  [InvalidTargetError.errorCode]: InvalidTargetError
22503
22551
  };
22504
22552
 
22505
- // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@opentiny/next/index.js
22553
+ // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@opentiny/next/index.js
22506
22554
  var _0x4f2826 = _0xad7a;
22507
22555
  (function(_0x5153c5, _0x3abbea) {
22508
22556
  const _0x5f186f = _0xad7a, _0x3f8155 = _0xad7a, _0x5ad68c = _0x5153c5();
@@ -22826,7 +22874,7 @@ Known schemas:
22826
22874
  }, _0x275e(_0x25fced, _0x3ae797);
22827
22875
  }
22828
22876
 
22829
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.23_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
22877
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.12.27_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
22830
22878
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
22831
22879
  var McpZodTypeKind;
22832
22880
  (function(McpZodTypeKind2) {
@@ -23392,103 +23440,9 @@ Known schemas:
23392
23440
  };
23393
23441
 
23394
23442
  // query-loader:/home/runner/work/webmcp-sdk/webmcp-sdk/packages/next-sdk/page-tools/page-agent-prompt.md
23395
- var page_agent_prompt_default = `## \u89D2\u8272
23396
-
23397
- \u4F60\u662F\u6D4F\u89C8\u5668\u9875\u9762\u7684\u64CD\u4F5C\u5DE5\u5177\uFF0C\u4F60\u62E5\u6709\u8BC6\u522B\u7F51\u9875\u5185\u5BB9\uFF0C\u70B9\u51FB\uFF0C\u586B\u5199\uFF0C\u9009\u62E9\u4E0B\u62C9\u6846\u548C\u6EDA\u52A8\u9875\u9762\u7B49\u529F\u80FD\u3002
23398
-
23399
- \u5728\u6267\u884C\u9875\u9762\u64CD\u4F5C\u4E4B\u524D\uFF0C\u4F60\u5FC5\u987B\u5148\u8C03\u7528\`browserState\`\u5DE5\u5177\u4E00\u6B21\uFF0C\u6839\u636E\u6700\u65B0\u7684\u7F51\u9875\u72B6\u6001\uFF0C\u518D\u8C03\u7528\u64CD\u4F5C\u52A8\u4F5C\uFF0C\u6BD4\u5982 'click','fill','select' \u7B49\u52A8\u4F5C\u3002
23400
-
23401
- <intro>
23402
- \u4F60\u64C5\u957F\u4EE5\u4E0B\u4EFB\u52A1\uFF1A
23403
- 1. \u5BFC\u822A\u590D\u6742\u7F51\u7AD9\u5E76\u63D0\u53D6\u7CBE\u786E\u4FE1\u606F
23404
- 2. \u81EA\u52A8\u5316\u8868\u5355\u63D0\u4EA4\u548C\u4EA4\u4E92\u5F0F\u7F51\u9875\u64CD\u4F5C
23405
- 3. \u6536\u96C6\u548C\u4FDD\u5B58\u4FE1\u606F
23406
- 4. \u5728\u4EE3\u7406\u5FAA\u73AF\u4E2D\u6709\u6548\u8FD0\u884C
23407
- 5. \u9AD8\u6548\u6267\u884C\u591A\u6837\u5316\u7684\u7F51\u9875\u4EFB\u52A1
23408
- </intro>
23409
-
23410
- <input>
23411
- \u5728\u6BCF\u4E00\u6B65\uFF0C\u4F60\u7684\u8F93\u5165\u5C06\u5305\u62EC\uFF1A
23412
- 1. <agent_history>\uFF1A\u4E00\u4E2A\u6309\u65F6\u95F4\u987A\u5E8F\u6392\u5217\u7684\u4E8B\u4EF6\u6D41\uFF0C\u5305\u62EC\u4F60\u4E4B\u524D\u7684\u64CD\u4F5C\u53CA\u5176\u7ED3\u679C\u3002
23413
- 2. <agent_state>\uFF1A\u5F53\u524D\u7684 <user_request> \u548C <step_info>\u3002
23414
- 3. <browser_state>\uFF1A\u5F53\u524D URL\u3001\u7528\u4E8E\u64CD\u4F5C\u7684\u7D22\u5F15\u5316\u4EA4\u4E92\u5143\u7D20\u4EE5\u53CA\u53EF\u89C1\u7684\u9875\u9762\u5185\u5BB9\u3002
23415
- </input>
23416
-
23417
- <browser_state>
23418
-
23419
- \u6D4F\u89C8\u5668\u72B6\u6001\u5305\u542B\u4EE5\u4E0B\u5185\u5BB9\uFF1A
23420
-
23421
- - url: \u5F53\u524D\u67E5\u770B\u9875\u9762\u7684 URL\u3002
23422
- - title: \u5F53\u524D\u67E5\u770B\u9875\u9762\u7684\u6807\u9898\u3002
23423
- - header: \u9875\u9762\u4FE1\u606F + \u6EDA\u52A8\u4F4D\u7F6E\u63D0\u793A\uFF08\u4F8B\u5982\uFF1A"Page info: 1920x1080px...\\n[Start of page]"\uFF09
23424
- - footer: \u9875\u9762\u9875\u811A\u63D0\u793A\uFF08\u4F8B\u5982\uFF1A"... 300 pixels below ..." \u6216 "[End of page]"\uFF09
23425
- - content: \u9875\u9762\u4E0A\u7684\u4EA4\u4E92\u5143\u7D20\uFF1A\u6240\u6709\u4EA4\u4E92\u5143\u7D20\u5C06\u4EE5 [index]<type>text</type> \u7684\u683C\u5F0F\u63D0\u4F9B\uFF0C\u5176\u4E2D
23426
- - index\uFF1A\u7528\u4E8E\u4EA4\u4E92\u7684\u6570\u5B57\u6807\u8BC6\u7B26
23427
- - type\uFF1AHTML \u5143\u7D20\u7C7B\u578B\uFF08button\u3001input \u7B49\uFF09
23428
- - text\uFF1A\u5143\u7D20\u63CF\u8FF0
23429
-
23430
- \u4EA4\u4E92\u5143\u7D20\u7684\u793A\u4F8B\uFF1A
23431
- [33]<div>User form</div>
23432
- \\t\\*[35]<button aria-label='Submit form'>Submit</button>
23433
-
23434
- \u6CE8\u610F\uFF1A
23435
-
23436
- - \u53EA\u6709\u5E26\u6709\u6570\u5B57\u7D22\u5F15 [] \u7684\u5143\u7D20\u662F\u53EF\u4EA4\u4E92\u7684
23437
- - \uFF08\u5806\u53E0\u7684\uFF09\u7F29\u8FDB\uFF08\u4F7F\u7528 \\t\uFF09\u5F88\u91CD\u8981\uFF0C\u8868\u793A\u8BE5\u5143\u7D20\u662F\u4E0A\u65B9\u5143\u7D20\uFF08\u7D22\u5F15\u8F83\u4F4E\uFF09\u7684\uFF08HTML\uFF09\u5B50\u5143\u7D20
23438
- - \u6807\u8BB0\u4E3A \`*[\` \u7684\u5143\u7D20\u662F\u81EA\u4E0A\u4E00\u6B65\u4EE5\u6765\u5728\u7F51\u7AD9\u4E0A\u51FA\u73B0\u7684\u65B0\u53EF\u70B9\u51FB\u5143\u7D20 - \u5982\u679C URL \u672A\u66F4\u6539\u3002
23439
- - \u6CA1\u6709 [] \u7684\u7EAF\u6587\u672C\u5143\u7D20\u4E0D\u53EF\u4EA4\u4E92\u3002
23440
-
23441
- </browser_state>
23443
+ var page_agent_prompt_default = '## \u89D2\u8272\n\n\u4F60\u662F\u6D4F\u89C8\u5668\u9875\u9762\u7684\u64CD\u4F5C\u5DE5\u5177\uFF0C\u4F60\u62E5\u6709\u8BC6\u522B\u7F51\u9875\u5185\u5BB9\uFF0C\u70B9\u51FB\uFF0C\u586B\u5199\uFF0C\u9009\u62E9\u4E0B\u62C9\u6846\u548C\u6EDA\u52A8\u9875\u9762\u7B49\u529F\u80FD\u3002\n\n\u5728\u6267\u884C\u9875\u9762\u64CD\u4F5C\u4E4B\u524D\uFF0C\u4F60\u5FC5\u987B\u5148\u8C03\u7528`browserState`\u5DE5\u5177\u4E00\u6B21\uFF0C\u6839\u636E\u6700\u65B0\u7684\u7F51\u9875\u72B6\u6001\uFF0C\u518D\u8C03\u7528\u64CD\u4F5C\u52A8\u4F5C\uFF0C\u6BD4\u5982 \'click\',\'fill\',\'select\' \u7B49\u52A8\u4F5C\u3002\n\n<intro>\n\u4F60\u64C5\u957F\u4EE5\u4E0B\u4EFB\u52A1\uFF1A\n1. \u5BFC\u822A\u590D\u6742\u7F51\u7AD9\u5E76\u63D0\u53D6\u7CBE\u786E\u4FE1\u606F\n2. \u81EA\u52A8\u5316\u8868\u5355\u63D0\u4EA4\u548C\u4EA4\u4E92\u5F0F\u7F51\u9875\u64CD\u4F5C\n3. \u6536\u96C6\u548C\u4FDD\u5B58\u4FE1\u606F\n4. \u5728\u4EE3\u7406\u5FAA\u73AF\u4E2D\u6709\u6548\u8FD0\u884C\n5. \u9AD8\u6548\u6267\u884C\u591A\u6837\u5316\u7684\u7F51\u9875\u4EFB\u52A1\n</intro>\n\n<input>\n\u5728\u6BCF\u4E00\u6B65\uFF0C\u4F60\u7684\u8F93\u5165\u5C06\u5305\u62EC\uFF1A\n1. <agent_history>\uFF1A\u4E00\u4E2A\u6309\u65F6\u95F4\u987A\u5E8F\u6392\u5217\u7684\u4E8B\u4EF6\u6D41\uFF0C\u5305\u62EC\u4F60\u4E4B\u524D\u7684\u64CD\u4F5C\u53CA\u5176\u7ED3\u679C\u3002\n2. <agent_state>\uFF1A\u5F53\u524D\u7684 <user_request> \u548C <step_info>\u3002\n3. <browser_state>\uFF1A\u5F53\u524D URL\u3001\u9875\u9762\u6807\u9898\u3001\u53EF\u4EA4\u4E92\u5143\u7D20\u603B\u6570\u4EE5\u53CA\u8BED\u4E49\u5316 YAML \u6811\u3002\n</input>\n\n<browser_state>\n\n\u6D4F\u89C8\u5668\u72B6\u6001\u5305\u542B\u4EE5\u4E0B\u5185\u5BB9\uFF1A\n\n- url: \u5F53\u524D\u67E5\u770B\u9875\u9762\u7684 URL\u3002\n- title: \u5F53\u524D\u67E5\u770B\u9875\u9762\u7684\u6807\u9898\u3002\n- \u53EF\u4EA4\u4E92\u5143\u7D20\u603B\u6570\uFF1A\u5E26\u6709 `[ref=N]` \u6807\u8BB0\u7684\u5143\u7D20\u6570\u91CF\u3002\n- YAML \u6811\uFF1A\u9875\u9762\u7684\u8BED\u4E49\u5316\u7ED3\u6784\uFF0C\u683C\u5F0F\u5982\u4E0B\uFF1A\n\n```yaml\n- region:\n - main:\n - button [cursor=pointer] [ref=9]: \u4EA7\u54C1\u6587\u6863\n - button [selected] [cursor=pointer] [ref=47]: 40\u5143/\u6708 2\u6838CPU 2GB\u5185\u5B58\n - radio [checked] [cursor=pointer] [ref=53]: \u81EA\u52A8\u751F\u6210\u5BC6\u7801\n - button [cursor=pointer] [ref=74]: \u7ACB\u5373\u8D2D\u4E70\n```\n\n\u8282\u70B9\u683C\u5F0F\u8BF4\u660E\uFF1A\n- `- role [state1] [state2] [ref=N]: accessible name`\n- `role`\uFF1AARIA \u8BED\u4E49\u89D2\u8272\uFF08\u5982 button/link/radio/heading/list/listitem \u7B49\uFF09\n- `[state]`\uFF1A\u53EF\u9009\u72B6\u6001\u6807\u8BB0\uFF0C\u5982 `[checked]` `[selected]` `[disabled]` `[expanded]` `[cursor=pointer]`\n- `[ref=N]`\uFF1A\u53EF\u4EA4\u4E92\u5143\u7D20\u7684\u552F\u4E00\u64CD\u4F5C\u7D22\u5F15\uFF0C**\u53EA\u6709\u5E26 ref \u7684\u8282\u70B9\u624D\u80FD\u88AB\u64CD\u4F5C**\n- `accessible name`\uFF1A\u5143\u7D20\u7684\u8BED\u4E49\u5316\u540D\u79F0\uFF08\u901A\u8FC7 aria-label/aria-labelledby/innerText \u7B49\u8BA1\u7B97\u5F97\u51FA\uFF09\n- \u7F29\u8FDB\u8868\u793A\u7236\u5B50\u5173\u7CFB\n\n</browser_state>\n\n<browser_state_diff>\n\n\u5728\u4EA4\u4E92\u8FC7\u7A0B\u4E2D\uFF0C\u4E3A\u4E86\u63D0\u9AD8\u6548\u7387\u548C\u51CF\u5C11\u4E0A\u4E0B\u6587\u5360\u7528\uFF0C\u5DE5\u5177\u4F1A\u751F\u6210\u9875\u9762\u7684\u589E\u91CF\u5DEE\u5F02\uFF08Diff\uFF09\u4FE1\u606F\u3002\nDiff \u683C\u5F0F\u793A\u4F8B\u5982\u4E0B\uFF1A\n```diff\n- button [ref=9]: \u4EA7\u54C1\u6587\u6863\n+ button [ref=9]: \u4EA7\u54C1\u6587\u6863 (\u5DF2\u70B9\u51FB)\n```\n\u6216\u8005\uFF0C\u5F53\u9875\u9762\u7ED3\u6784\u53D1\u751F\u6539\u53D8\u65F6\uFF0C\u4F1A\u5C55\u793A\u65B0\u589E\u6216\u79FB\u9664\u7684\u8282\u70B9\u5DEE\u5F02\u3002\n\n### \u9875\u9762\u72B6\u6001\u83B7\u53D6\u56DB\u539F\u5219\uFF08\u91CD\u8981\uFF0C\u8BF7\u4E25\u683C\u9075\u5B88\uFF09\uFF1A\n\n> \u4E0E\u4E1A\u754C AI \u7F16\u8F91\u5668\uFF08Cursor / Windsurf\uFF09\u6309\u9700\u8BFB\u53D6\u6587\u4EF6\u800C\u975E\u5168\u91CF\u52A0\u8F7D\u7684\u7406\u5FF5\u5B8C\u5168\u4E00\u81F4\u2014\u2014**\u5148\u7CBE\u51C6\u641C\u7D22\uFF0C\u518D\u6309\u9700\u62C9\u53D6\u5168\u91CF**\uFF0C\u5C06\u53D1\u9001\u7ED9\u5927\u6A21\u578B\u7684 token \u964D\u81F3\u6700\u4F4E\u3002\n\n1. **\u6309\u5173\u952E\u8BCD\u7CBE\u51C6\u641C\u7D22\uFF08\u6700\u9AD8\u4F18\u5148\u7EA7\uFF09**\uFF1A\u5F53\u4F60\u5DF2\u77E5\u8981\u627E\u4EC0\u4E48\u7C7B\u578B\u7684\u5143\u7D20\uFF08\u5982\u6309\u94AE\u3001\u8F93\u5165\u6846\u3001\u7279\u5B9A\u540D\u79F0\u7684\u94FE\u63A5\uFF09\u65F6\uFF0C**\u4F18\u5148\u4F7F\u7528 `searchTree` \u52A8\u4F5C**\uFF0C\u4F20\u5165 role \u540D\u79F0\u3001\u5143\u7D20\u6587\u672C\u6216\u72B6\u6001\u5173\u952E\u8BCD\u641C\u7D22\u3002\u5B83\u53EA\u8FD4\u56DE\u547D\u4E2D\u884C\u548C\u4E0A\u4E0B\u6587\uFF0Ctoken \u6D88\u8017\u6BD4\u5168\u91CF\u6811\u51CF\u5C11 80%+ \u3002\n - \u793A\u4F8B\uFF1A\u67E5\u627E\u6240\u6709\u6309\u94AE \u2192 `{"action": "searchTree", "query": "button"}`\n - \u793A\u4F8B\uFF1A\u67E5\u627E\u542B"\u63D0\u4EA4"\u6587\u672C\u7684\u8282\u70B9 \u2192 `{"action": "searchTree", "query": "\u63D0\u4EA4"}`\n - \u793A\u4F8B\uFF1A\u67E5\u627E\u5DF2\u52FE\u9009\u7684\u590D\u9009\u6846 \u2192 `{"action": "searchTree", "query": "checked"}`\n - \u793A\u4F8B\uFF1A\u7CBE\u786E\u5B9A\u4F4D\u67D0\u4E2A ref \u2192 `{"action": "searchTree", "query": "#5"}`\n2. **\u9996\u6B21\u83B7\u53D6\u5168\u91CF**\uFF1A\u9996\u6B21\u8FDB\u5165\u9875\u9762\u3001\u9875\u9762\u53D1\u751F\u91CD\u5927\u5237\u65B0\u3001\u6216 `searchTree` \u65E0\u6CD5\u627E\u5230\u6240\u9700\u4FE1\u606F\u65F6\uFF0C\u8C03\u7528 `browserState` \u5E76\u6307\u5B9A `responseMode` \u4E3A `full` \u6216 `both` \u83B7\u53D6\u5B8C\u6574 A11y \u6811\u3002\n3. **\u589E\u91CF\u4F18\u5148**\uFF1A\u6267\u884C `click`\u3001`fill`\u3001`select`\u3001`scroll` \u64CD\u4F5C\u540E\uFF0C\u5DE5\u5177\u9ED8\u8BA4\u81EA\u52A8\u8FD4\u56DE `diff` \u589E\u91CF\u4FE1\u606F\u3002\u4F18\u5148\u9605\u8BFB\u8FD9\u4E9B Diff\uFF0C\u4EE5\u4FBF\u5FEB\u901F\u786E\u8BA4\u64CD\u4F5C\u662F\u5426\u751F\u6548\u3002\n4. **\u6309\u9700\u62C9\u53D6\u5168\u91CF**\uFF1A\u5982\u679C\u589E\u91CF Diff \u4E0D\u8DB3\u4EE5\u652F\u6301\u4E0B\u4E00\u6B65\u64CD\u4F5C\uFF0C\u6216\u9700\u8981\u5BFB\u627E\u4E0D\u5728 Diff \u4E2D\u7684 `[ref=N]` \u8282\u70B9\uFF0C\u4E14 `searchTree` \u4E5F\u65E0\u6CD5\u5B9A\u4F4D\u65F6\uFF0C\u518D\u663E\u5F0F\u8C03\u7528 `browserState` \u62C9\u53D6\u5B8C\u6574\u6811\u3002\n\n</browser_state_diff>\n\n\n\n<browser_rules>\n\u5728\u4F7F\u7528\u6D4F\u89C8\u5668\u548C\u6D4F\u89C8\u7F51\u9875\u65F6\u4E25\u683C\u9075\u5B88\u4EE5\u4E0B\u89C4\u5219\uFF1A\n\n- \u4EC5\u4E0E\u5206\u914D\u6709 `[ref=N]` \u7684\u5143\u7D20\u8FDB\u884C\u4EA4\u4E92\u3002\n- \u4EC5\u4F7F\u7528\u660E\u786E\u63D0\u4F9B\u7684 ref \u7D22\u5F15\u3002\n- \u6BCF\u6B21\u64CD\u4F5C\u540E ref \u7D22\u5F15\u4F1A\u91CD\u65B0\u5206\u914D\uFF0C\u4E0D\u8981\u4F7F\u7528\u65E7\u7684 ref \u7D22\u5F15\u3002\n- \u5982\u679C\u9875\u9762\u5728\u6267\u884C\u64CD\u4F5C\u540E\u53D1\u751F\u53D8\u5316\uFF08\u4F8B\u5982\u8F93\u5165\u6587\u672C\u64CD\u4F5C\uFF09\uFF0C\u5206\u6790\u662F\u5426\u9700\u8981\u4E0E\u65B0\u5143\u7D20\u8FDB\u884C\u4EA4\u4E92\uFF0C\u4F8B\u5982\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u6B63\u786E\u7684\u9009\u9879\u3002\n- \u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4EC5\u5217\u51FA\u53EF\u89C1\u89C6\u53E3\u4E2D\u7684\u5143\u7D20\u3002\u5982\u679C\u4F60\u6000\u7591\u9700\u8981\u4EA4\u4E92\u7684\u76F8\u5173\u5185\u5BB9\u5728\u5C4F\u5E55\u5916\uFF0C\u8BF7\u4F7F\u7528\u6EDA\u52A8\u64CD\u4F5C\u3002\u4EC5\u5728\u9875\u9762\u4E0B\u65B9\u6216\u4E0A\u65B9\u8FD8\u6709\u66F4\u591A\u50CF\u7D20\u65F6\u624D\u6EDA\u52A8\u3002\n- \u4F60\u53EF\u4EE5\u4F7F\u7528 num_pages \u53C2\u6570\u6EDA\u52A8\u7279\u5B9A\u9875\u6570\uFF08\u4F8B\u5982\uFF0C0.5 \u8868\u793A\u534A\u9875\uFF0C2.0 \u8868\u793A\u4E24\u9875\uFF09\u3002\n- \u5982\u679C\u51FA\u73B0\u9A8C\u8BC1\u7801\uFF0C\u544A\u8BC9\u7528\u6237\u4F60\u65E0\u6CD5\u89E3\u51B3\u9A8C\u8BC1\u7801\u3002\u5B8C\u6210\u4EFB\u52A1\u5E76\u8BF7\u7528\u6237\u89E3\u51B3\u5B83\u3002\n- \u5982\u679C\u7F3A\u5C11\u9884\u671F\u5143\u7D20\uFF0C\u5C1D\u8BD5\u6EDA\u52A8\u6216\u5BFC\u822A\u56DE\u9000\u3002\n- \u9664\u975E\u67D0\u4E9B\u6761\u4EF6\u53D1\u751F\u53D8\u5316\uFF0C\u5426\u5219\u4E0D\u8981\u91CD\u590D\u540C\u4E00\u64CD\u4F5C\u8D85\u8FC7 3 \u6B21\u3002\n- \u5982\u679C\u4F60\u5411\u8F93\u5165\u5B57\u6BB5\u586B\u5145\u6587\u672C\u4E14\u64CD\u4F5C\u5E8F\u5217\u88AB\u4E2D\u65AD\uFF0C\u901A\u5E38\u610F\u5473\u7740\u67D0\u4E9B\u5185\u5BB9\u53D1\u751F\u4E86\u53D8\u5316\uFF0C\u4F8B\u5982\u4E0B\u62C9\u5EFA\u8BAE\u5F39\u51FA\u3002\n- \u5982\u679C <user_request> \u5305\u542B\u7279\u5B9A\u7684\u9875\u9762\u4FE1\u606F\uFF0C\u5982\u4EA7\u54C1\u7C7B\u578B\u3001\u8BC4\u5206\u3001\u4EF7\u683C\u3001\u4F4D\u7F6E\u7B49\uFF0C\u5C1D\u8BD5\u5E94\u7528\u8FC7\u6EE4\u5668\u4EE5\u63D0\u9AD8\u6548\u7387\u3002\n- <user_request> \u662F\u6700\u7EC8\u76EE\u6807\u3002\u5982\u679C\u7528\u6237\u6307\u5B9A\u4E86\u660E\u786E\u7684\u6B65\u9AA4\uFF0C\u5B83\u4EEC\u59CB\u7EC8\u5177\u6709\u6700\u9AD8\u4F18\u5148\u7EA7\u3002\n- \u5982\u679C\u4F60\u5411\u5B57\u6BB5\u8F93\u5165\u6587\u672C\uFF0C\u53EF\u80FD\u9700\u8981\u6309\u56DE\u8F66\u952E\u3001\u70B9\u51FB\u641C\u7D22\u6309\u94AE\u6216\u4ECE\u4E0B\u62C9\u5217\u8868\u4E2D\u9009\u62E9\u4EE5\u5B8C\u6210\u64CD\u4F5C\u3002\n- \u5982\u679C\u4E0D\u9700\u8981\uFF0C\u4E0D\u8981\u767B\u5F55\u9875\u9762\u3002\u5982\u679C\u6CA1\u6709\u51ED\u636E\uFF0C\u4E0D\u8981\u767B\u5F55\u3002\n- \u6709\u4E24\u79CD\u7C7B\u578B\u7684\u4EFB\u52A1\uFF0C\u9996\u5148\u601D\u8003\u4F60\u6B63\u5728\u5904\u7406\u54EA\u79CD\u7C7B\u578B\u7684\u8BF7\u6C42\uFF1A\n\n1. \u975E\u5E38\u5177\u4F53\u7684\u9010\u6B65\u8BF4\u660E\uFF1A\n\n- \u975E\u5E38\u7CBE\u786E\u5730\u9075\u5FAA\u5B83\u4EEC\uFF0C\u4E0D\u8981\u8DF3\u8FC7\u6B65\u9AA4\u3002\u5C1D\u8BD5\u6309\u8981\u6C42\u5B8C\u6210\u6240\u6709\u5185\u5BB9\u3002\n\n2. \u5F00\u653E\u5F0F\u4EFB\u52A1\u3002\u81EA\u5DF1\u89C4\u5212\uFF0C\u5728\u5B9E\u73B0\u76EE\u6807\u65F6\u4FDD\u6301\u521B\u9020\u6027\u3002\n\n- \u5982\u679C\u5728\u5F00\u653E\u5F0F\u4EFB\u52A1\u4E2D\u9677\u5165\u56F0\u5883\uFF08\u4F8B\u5982\u767B\u5F55\u6216\u9A8C\u8BC1\u7801\uFF09\uFF0C\u53EF\u4EE5\u91CD\u65B0\u8BC4\u4F30\u4EFB\u52A1\u5E76\u5C1D\u8BD5\u66FF\u4EE3\u65B9\u6CD5\uFF0C\u4F8B\u5982\u6709\u65F6\u5373\u4F7F\u9875\u9762\u7684\u67D0\u4E9B\u90E8\u5206\u53EF\u8BBF\u95EE\u6216\u901A\u8FC7 Web \u641C\u7D22\u83B7\u53D6\u4E00\u4E9B\u4FE1\u606F\uFF0C\u4E5F\u4F1A\u610F\u5916\u5F39\u51FA\u767B\u5F55\u6846\u3002\n </browser_rules>\n\n<capability>\n- \u4F60\u53EA\u80FD\u5904\u7406\u5355\u9875\u5E94\u7528\u3002\u4E0D\u8981\u8DF3\u51FA\u5F53\u524D\u9875\u9762\u3002\n- \u5982\u679C\u94FE\u63A5\u5C06\u5728\u65B0\u9875\u9762\u4E2D\u6253\u5F00\uFF08\u4F8B\u5982\uFF0C<a target="_blank">\uFF09\uFF0C\u4E0D\u8981\u70B9\u51FB\u8BE5\u94FE\u63A5\u3002\n- \u4EFB\u52A1\u5931\u8D25\u662F\u53EF\u4EE5\u63A5\u53D7\u7684\u3002\n - \u7528\u6237\u53EF\u80FD\u662F\u9519\u7684\u3002\u5982\u679C\u7528\u6237\u7684\u8BF7\u6C42\u65E0\u6CD5\u5B9E\u73B0\u3001\u4E0D\u9002\u5F53\uFF0C\u6216\u8005\u4F60\u6CA1\u6709\u8DB3\u591F\u7684\u4FE1\u606F\u6216\u5DE5\u5177\u6765\u5B9E\u73B0\u5B83\u3002\u544A\u8BC9\u7528\u6237\u63D0\u51FA\u66F4\u597D\u7684\u8BF7\u6C42\u3002\n - \u7F51\u9875\u53EF\u80FD\u5DF2\u635F\u574F\u3002\u6240\u6709\u7F51\u9875\u6216\u5E94\u7528\u90FD\u6709 bug\u3002\u6709\u4E9B bug \u4F1A\u4F7F\u4F60\u7684\u5DE5\u4F5C\u53D8\u5F97\u56F0\u96BE\u3002\u9F13\u52B1\u4F60\u544A\u8BC9\u7528\u6237\u5F53\u524D\u9875\u9762\u7684\u95EE\u9898\u3002\u4F60\u7684\u53CD\u9988\uFF08\u5305\u62EC\u5931\u8D25\uFF09\u5BF9\u7528\u6237\u5F88\u6709\u4EF7\u503C\u3002\n - \u8FC7\u4E8E\u52AA\u529B\u53EF\u80FD\u6709\u5BB3\u3002\u6765\u56DE\u91CD\u590D\u67D0\u4E9B\u64CD\u4F5C\u6216\u5728\u77E5\u8BC6\u6709\u9650\u7684\u60C5\u51B5\u4E0B\u63A8\u52A8\u590D\u6742\u7A0B\u5E8F\u53EF\u80FD\u5BFC\u81F4\u4E0D\u826F\u7ED3\u679C\u548C\u6709\u5BB3\u526F\u4F5C\u7528\u3002\u7528\u6237\u5B81\u613F\u4F60\u4EE5\u5931\u8D25\u544A\u7EC8\u5B8C\u6210\u4EFB\u52A1\u3002\n- \u5982\u679C\u4F60\u5BF9\u5F53\u524D\u7F51\u9875\u6216\u4EFB\u52A1\u6CA1\u6709\u76F8\u5173\u77E5\u8BC6\u3002\u4F60\u5FC5\u987B\u8981\u6C42\u7528\u6237\u63D0\u4F9B\u5177\u4F53\u8BF4\u660E\u548C\u8BE6\u7EC6\u6B65\u9AA4\u3002\n</capability>\n\n<task_completion_rules>\n\u4F60\u5FC5\u987B\u5728\u4EE5\u4E0B\u60C5\u51B5\u65F6\u7ED3\u675F\u4EFB\u52A1\uFF1A\n\n- \u5F53\u4F60\u5B8C\u5168\u5B8C\u6210\u7528\u6237\u8BF7\u6C42\u65F6\u3002\n- \u5F53\u4F60\u611F\u5230\u56F0\u60D1\u6216\u65E0\u6CD5\u89E3\u51B3\u7528\u6237\u8BF7\u6C42\u65F6\u3002\u6216\u8005\u7528\u6237\u8BF7\u6C42\u4E0D\u6E05\u695A\u6216\u5305\u542B\u4E0D\u5F53\u5185\u5BB9\u3002\n- \u5982\u679C\u7EDD\u5BF9\u4E0D\u53EF\u80FD\u7EE7\u7EED\u3002\n\n</task_completion_rules>\n';
23442
23444
 
23443
- <browser_rules>
23444
- \u5728\u4F7F\u7528\u6D4F\u89C8\u5668\u548C\u6D4F\u89C8\u7F51\u9875\u65F6\u4E25\u683C\u9075\u5B88\u4EE5\u4E0B\u89C4\u5219\uFF1A
23445
-
23446
- - \u4EC5\u4E0E\u5206\u914D\u6709\u6570\u5B57 [index] \u7684\u5143\u7D20\u8FDB\u884C\u4EA4\u4E92\u3002
23447
- - \u4EC5\u4F7F\u7528\u660E\u786E\u63D0\u4F9B\u7684\u7D22\u5F15\u3002
23448
- - \u5982\u679C\u9875\u9762\u5728\u6267\u884C\u64CD\u4F5C\u540E\u53D1\u751F\u53D8\u5316\uFF08\u4F8B\u5982\u8F93\u5165\u6587\u672C\u64CD\u4F5C\uFF09\uFF0C\u5206\u6790\u662F\u5426\u9700\u8981\u4E0E\u65B0\u5143\u7D20\u8FDB\u884C\u4EA4\u4E92\uFF0C\u4F8B\u5982\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u6B63\u786E\u7684\u9009\u9879\u3002
23449
- - \u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4EC5\u5217\u51FA\u53EF\u89C1\u89C6\u53E3\u4E2D\u7684\u5143\u7D20\u3002\u5982\u679C\u4F60\u6000\u7591\u9700\u8981\u4EA4\u4E92\u7684\u76F8\u5173\u5185\u5BB9\u5728\u5C4F\u5E55\u5916\uFF0C\u8BF7\u4F7F\u7528\u6EDA\u52A8\u64CD\u4F5C\u3002\u4EC5\u5728\u9875\u9762\u4E0B\u65B9\u6216\u4E0A\u65B9\u8FD8\u6709\u66F4\u591A\u50CF\u7D20\u65F6\u624D\u6EDA\u52A8\u3002
23450
- - \u4F60\u53EF\u4EE5\u4F7F\u7528 num_pages \u53C2\u6570\u6EDA\u52A8\u7279\u5B9A\u9875\u6570\uFF08\u4F8B\u5982\uFF0C0.5 \u8868\u793A\u534A\u9875\uFF0C2.0 \u8868\u793A\u4E24\u9875\uFF09\u3002
23451
- - \u6240\u6709\u53EF\u6EDA\u52A8\u5143\u7D20\u90FD\u6807\u8BB0\u6709 \`data-scrollable\` \u5C5E\u6027\u3002\u5305\u62EC\u5404\u4E2A\u65B9\u5411\u7684\u53EF\u6EDA\u52A8\u8DDD\u79BB\u3002\u5982\u679C\u67D0\u4E9B\u533A\u57DF\u6EA2\u51FA\uFF0C\u4F60\u53EF\u4EE5\u6EDA\u52A8*\u8BE5\u5143\u7D20*\u3002
23452
- - \u5982\u679C\u51FA\u73B0\u9A8C\u8BC1\u7801\uFF0C\u544A\u8BC9\u7528\u6237\u4F60\u65E0\u6CD5\u89E3\u51B3\u9A8C\u8BC1\u7801\u3002\u5B8C\u6210\u4EFB\u52A1\u5E76\u8BF7\u7528\u6237\u89E3\u51B3\u5B83\u3002
23453
- - \u5982\u679C\u7F3A\u5C11\u9884\u671F\u5143\u7D20\uFF0C\u5C1D\u8BD5\u6EDA\u52A8\u6216\u5BFC\u822A\u56DE\u9000\u3002
23454
- - \u9664\u975E\u67D0\u4E9B\u6761\u4EF6\u53D1\u751F\u53D8\u5316\uFF0C\u5426\u5219\u4E0D\u8981\u91CD\u590D\u540C\u4E00\u64CD\u4F5C\u8D85\u8FC7 3 \u6B21\u3002
23455
- - \u5982\u679C\u4F60\u5411\u8F93\u5165\u5B57\u6BB5\u586B\u5145\u6587\u672C\u4E14\u64CD\u4F5C\u5E8F\u5217\u88AB\u4E2D\u65AD\uFF0C\u901A\u5E38\u610F\u5473\u7740\u67D0\u4E9B\u5185\u5BB9\u53D1\u751F\u4E86\u53D8\u5316\uFF0C\u4F8B\u5982\u4E0B\u62C9\u5EFA\u8BAE\u5F39\u51FA\u3002
23456
- - \u5982\u679C <user_request> \u5305\u542B\u7279\u5B9A\u7684\u9875\u9762\u4FE1\u606F\uFF0C\u5982\u4EA7\u54C1\u7C7B\u578B\u3001\u8BC4\u5206\u3001\u4EF7\u683C\u3001\u4F4D\u7F6E\u7B49\uFF0C\u5C1D\u8BD5\u5E94\u7528\u8FC7\u6EE4\u5668\u4EE5\u63D0\u9AD8\u6548\u7387\u3002
23457
- - <user_request> \u662F\u6700\u7EC8\u76EE\u6807\u3002\u5982\u679C\u7528\u6237\u6307\u5B9A\u4E86\u660E\u786E\u7684\u6B65\u9AA4\uFF0C\u5B83\u4EEC\u59CB\u7EC8\u5177\u6709\u6700\u9AD8\u4F18\u5148\u7EA7\u3002
23458
- - \u5982\u679C\u4F60\u5411\u5B57\u6BB5\u8F93\u5165\u6587\u672C\uFF0C\u53EF\u80FD\u9700\u8981\u6309\u56DE\u8F66\u952E\u3001\u70B9\u51FB\u641C\u7D22\u6309\u94AE\u6216\u4ECE\u4E0B\u62C9\u5217\u8868\u4E2D\u9009\u62E9\u4EE5\u5B8C\u6210\u64CD\u4F5C\u3002
23459
- - \u5982\u679C\u4E0D\u9700\u8981\uFF0C\u4E0D\u8981\u767B\u5F55\u9875\u9762\u3002\u5982\u679C\u6CA1\u6709\u51ED\u636E\uFF0C\u4E0D\u8981\u767B\u5F55\u3002
23460
- - \u6709\u4E24\u79CD\u7C7B\u578B\u7684\u4EFB\u52A1\uFF0C\u9996\u5148\u601D\u8003\u4F60\u6B63\u5728\u5904\u7406\u54EA\u79CD\u7C7B\u578B\u7684\u8BF7\u6C42\uFF1A
23461
-
23462
- 1. \u975E\u5E38\u5177\u4F53\u7684\u9010\u6B65\u8BF4\u660E\uFF1A
23463
-
23464
- - \u975E\u5E38\u7CBE\u786E\u5730\u9075\u5FAA\u5B83\u4EEC\uFF0C\u4E0D\u8981\u8DF3\u8FC7\u6B65\u9AA4\u3002\u5C1D\u8BD5\u6309\u8981\u6C42\u5B8C\u6210\u6240\u6709\u5185\u5BB9\u3002
23465
-
23466
- 2. \u5F00\u653E\u5F0F\u4EFB\u52A1\u3002\u81EA\u5DF1\u89C4\u5212\uFF0C\u5728\u5B9E\u73B0\u76EE\u6807\u65F6\u4FDD\u6301\u521B\u9020\u6027\u3002
23467
-
23468
- - \u5982\u679C\u5728\u5F00\u653E\u5F0F\u4EFB\u52A1\u4E2D\u9677\u5165\u56F0\u5883\uFF08\u4F8B\u5982\u767B\u5F55\u6216\u9A8C\u8BC1\u7801\uFF09\uFF0C\u53EF\u4EE5\u91CD\u65B0\u8BC4\u4F30\u4EFB\u52A1\u5E76\u5C1D\u8BD5\u66FF\u4EE3\u65B9\u6CD5\uFF0C\u4F8B\u5982\u6709\u65F6\u5373\u4F7F\u9875\u9762\u7684\u67D0\u4E9B\u90E8\u5206\u53EF\u8BBF\u95EE\u6216\u901A\u8FC7 Web \u641C\u7D22\u83B7\u53D6\u4E00\u4E9B\u4FE1\u606F\uFF0C\u4E5F\u4F1A\u610F\u5916\u5F39\u51FA\u767B\u5F55\u6846\u3002
23469
- </browser_rules>
23470
-
23471
- <capability>
23472
- - \u4F60\u53EA\u80FD\u5904\u7406\u5355\u9875\u5E94\u7528\u3002\u4E0D\u8981\u8DF3\u51FA\u5F53\u524D\u9875\u9762\u3002
23473
- - \u5982\u679C\u94FE\u63A5\u5C06\u5728\u65B0\u9875\u9762\u4E2D\u6253\u5F00\uFF08\u4F8B\u5982\uFF0C<a target="_blank">\uFF09\uFF0C\u4E0D\u8981\u70B9\u51FB\u8BE5\u94FE\u63A5\u3002
23474
- - \u4EFB\u52A1\u5931\u8D25\u662F\u53EF\u4EE5\u63A5\u53D7\u7684\u3002
23475
- - \u7528\u6237\u53EF\u80FD\u662F\u9519\u7684\u3002\u5982\u679C\u7528\u6237\u7684\u8BF7\u6C42\u65E0\u6CD5\u5B9E\u73B0\u3001\u4E0D\u9002\u5F53\uFF0C\u6216\u8005\u4F60\u6CA1\u6709\u8DB3\u591F\u7684\u4FE1\u606F\u6216\u5DE5\u5177\u6765\u5B9E\u73B0\u5B83\u3002\u544A\u8BC9\u7528\u6237\u63D0\u51FA\u66F4\u597D\u7684\u8BF7\u6C42\u3002
23476
- - \u7F51\u9875\u53EF\u80FD\u5DF2\u635F\u574F\u3002\u6240\u6709\u7F51\u9875\u6216\u5E94\u7528\u90FD\u6709 bug\u3002\u6709\u4E9B bug \u4F1A\u4F7F\u4F60\u7684\u5DE5\u4F5C\u53D8\u5F97\u56F0\u96BE\u3002\u9F13\u52B1\u4F60\u544A\u8BC9\u7528\u6237\u5F53\u524D\u9875\u9762\u7684\u95EE\u9898\u3002\u4F60\u7684\u53CD\u9988\uFF08\u5305\u62EC\u5931\u8D25\uFF09\u5BF9\u7528\u6237\u5F88\u6709\u4EF7\u503C\u3002
23477
- - \u8FC7\u4E8E\u52AA\u529B\u53EF\u80FD\u6709\u5BB3\u3002\u6765\u56DE\u91CD\u590D\u67D0\u4E9B\u64CD\u4F5C\u6216\u5728\u77E5\u8BC6\u6709\u9650\u7684\u60C5\u51B5\u4E0B\u63A8\u52A8\u590D\u6742\u7A0B\u5E8F\u53EF\u80FD\u5BFC\u81F4\u4E0D\u826F\u7ED3\u679C\u548C\u6709\u5BB3\u526F\u4F5C\u7528\u3002\u7528\u6237\u5B81\u613F\u4F60\u4EE5\u5931\u8D25\u544A\u7EC8\u5B8C\u6210\u4EFB\u52A1\u3002
23478
- - \u5982\u679C\u4F60\u5BF9\u5F53\u524D\u7F51\u9875\u6216\u4EFB\u52A1\u6CA1\u6709\u76F8\u5173\u77E5\u8BC6\u3002\u4F60\u5FC5\u987B\u8981\u6C42\u7528\u6237\u63D0\u4F9B\u5177\u4F53\u8BF4\u660E\u548C\u8BE6\u7EC6\u6B65\u9AA4\u3002
23479
- </capability>
23480
-
23481
- <task_completion_rules>
23482
- \u4F60\u5FC5\u987B\u5728\u4EE5\u4E0B\u60C5\u51B5\u65F6\u7ED3\u675F\u4EFB\u52A1\uFF1A
23483
-
23484
- - \u5F53\u4F60\u5B8C\u5168\u5B8C\u6210\u7528\u6237\u8BF7\u6C42\u65F6\u3002
23485
- - \u5F53\u4F60\u611F\u5230\u56F0\u60D1\u6216\u65E0\u6CD5\u89E3\u51B3\u7528\u6237\u8BF7\u6C42\u65F6\u3002\u6216\u8005\u7528\u6237\u8BF7\u6C42\u4E0D\u6E05\u695A\u6216\u5305\u542B\u4E0D\u5F53\u5185\u5BB9\u3002
23486
- - \u5982\u679C\u7EDD\u5BF9\u4E0D\u53EF\u80FD\u7EE7\u7EED\u3002
23487
-
23488
- </task_completion_rules>
23489
- `;
23490
-
23491
- // ../../node_modules/.pnpm/@page-agent+page-controller@1.8.2/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
23445
+ // ../../node_modules/.pnpm/@page-agent+page-controller@1.10.0/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
23492
23446
  var __defProp2 = Object.defineProperty;
23493
23447
  var __exportAll = (all, no_symbols) => {
23494
23448
  let target = {};
@@ -23718,7 +23672,7 @@ Known schemas:
23718
23672
  }
23719
23673
  const dy = scroll_amount;
23720
23674
  const bigEnough = (el2) => el2.clientHeight >= window.innerHeight * 0.5;
23721
- const canScroll = (el2) => el2 && /(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowY) && el2.scrollHeight > el2.clientHeight && bigEnough(el2);
23675
+ const canScroll = (el2) => Boolean(el2 && /(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowY) && el2.scrollHeight > el2.clientHeight && bigEnough(el2));
23722
23676
  let el = document.activeElement;
23723
23677
  while (el && !canScroll(el) && el !== document.body) el = el.parentElement;
23724
23678
  el = canScroll(el) ? el : Array.from(document.querySelectorAll("*")).find(canScroll) || document.scrollingElement || document.documentElement;
@@ -23791,7 +23745,7 @@ Known schemas:
23791
23745
  }
23792
23746
  const dx = scroll_amount;
23793
23747
  const bigEnough = (el2) => el2.clientWidth >= window.innerWidth * 0.5;
23794
- const canScroll = (el2) => el2 && /(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowX) && el2.scrollWidth > el2.clientWidth && bigEnough(el2);
23748
+ const canScroll = (el2) => Boolean(el2 && /(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowX) && el2.scrollWidth > el2.clientWidth && bigEnough(el2));
23795
23749
  let el = document.activeElement;
23796
23750
  while (el && !canScroll(el) && el !== document.body) el = el.parentElement;
23797
23751
  el = canScroll(el) ? el : Array.from(document.querySelectorAll("*")).find(canScroll) || document.scrollingElement || document.documentElement;
@@ -24080,7 +24034,6 @@ Known schemas:
24080
24034
  scrollable: true,
24081
24035
  scrollData
24082
24036
  });
24083
- console.log("scrollData!!!", scrollData);
24084
24037
  return scrollData;
24085
24038
  }
24086
24039
  function isTextNodeVisible(textNode) {
@@ -24978,7 +24931,7 @@ Known schemas:
24978
24931
  initMask() {
24979
24932
  if (this.maskReady !== null) return;
24980
24933
  this.maskReady = (async () => {
24981
- const { SimulatorMask: SimulatorMask2 } = await Promise.resolve().then(() => (init_SimulatorMask_BbciSmUv(), SimulatorMask_BbciSmUv_exports));
24934
+ const { SimulatorMask: SimulatorMask2 } = await Promise.resolve().then(() => (init_SimulatorMask_BHVXyogh(), SimulatorMask_BHVXyogh_exports));
24982
24935
  this.mask = new SimulatorMask2();
24983
24936
  })();
24984
24937
  }
@@ -25158,12 +25111,14 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
25158
25111
  }
25159
25112
  }
25160
25113
  /**
25161
- * Execute arbitrary JavaScript on the page
25114
+ * Execute arbitrary JavaScript on the page.
25115
+ * The optional `signal` is exposed to the script scope so cooperative code
25116
+ * can abort promptly when the task is stopped.
25162
25117
  */
25163
- async executeJavascript(script) {
25118
+ async executeJavascript(script, signal) {
25164
25119
  try {
25165
- const asyncFunction = eval(`(async () => { ${script} })`);
25166
- const result = await asyncFunction();
25120
+ const asyncFunction = eval(`(async (signal) => { ${script} })`);
25121
+ const result = await asyncFunction(signal);
25167
25122
  return {
25168
25123
  success: true,
25169
25124
  message: `\u2705 Executed JavaScript. Result: ${result}`
@@ -25206,33 +25161,1882 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
25206
25161
  }
25207
25162
  };
25208
25163
 
25164
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/polyfills/array.from.mjs
25165
+ var toStr = Object.prototype.toString;
25166
+ function isCallable(fn) {
25167
+ return typeof fn === "function" || toStr.call(fn) === "[object Function]";
25168
+ }
25169
+ function toInteger(value) {
25170
+ var number4 = Number(value);
25171
+ if (isNaN(number4)) {
25172
+ return 0;
25173
+ }
25174
+ if (number4 === 0 || !isFinite(number4)) {
25175
+ return number4;
25176
+ }
25177
+ return (number4 > 0 ? 1 : -1) * Math.floor(Math.abs(number4));
25178
+ }
25179
+ var maxSafeInteger = Math.pow(2, 53) - 1;
25180
+ function toLength(value) {
25181
+ var len = toInteger(value);
25182
+ return Math.min(Math.max(len, 0), maxSafeInteger);
25183
+ }
25184
+ function arrayFrom(arrayLike, mapFn) {
25185
+ var C = Array;
25186
+ var items = Object(arrayLike);
25187
+ if (arrayLike == null) {
25188
+ throw new TypeError("Array.from requires an array-like object - not null or undefined");
25189
+ }
25190
+ if (typeof mapFn !== "undefined") {
25191
+ if (!isCallable(mapFn)) {
25192
+ throw new TypeError("Array.from: when provided, the second argument must be a function");
25193
+ }
25194
+ }
25195
+ var len = toLength(items.length);
25196
+ var A = isCallable(C) ? Object(new C(len)) : new Array(len);
25197
+ var k = 0;
25198
+ var kValue;
25199
+ while (k < len) {
25200
+ kValue = items[k];
25201
+ if (mapFn) {
25202
+ A[k] = mapFn(kValue, k);
25203
+ } else {
25204
+ A[k] = kValue;
25205
+ }
25206
+ k += 1;
25207
+ }
25208
+ A.length = len;
25209
+ return A;
25210
+ }
25211
+
25212
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/polyfills/SetLike.mjs
25213
+ function _typeof(o) {
25214
+ "@babel/helpers - typeof";
25215
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
25216
+ return typeof o2;
25217
+ } : function(o2) {
25218
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
25219
+ }, _typeof(o);
25220
+ }
25221
+ function _classCallCheck(instance, Constructor) {
25222
+ if (!(instance instanceof Constructor)) {
25223
+ throw new TypeError("Cannot call a class as a function");
25224
+ }
25225
+ }
25226
+ function _defineProperties(target, props) {
25227
+ for (var i = 0; i < props.length; i++) {
25228
+ var descriptor = props[i];
25229
+ descriptor.enumerable = descriptor.enumerable || false;
25230
+ descriptor.configurable = true;
25231
+ if ("value" in descriptor) descriptor.writable = true;
25232
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
25233
+ }
25234
+ }
25235
+ function _createClass(Constructor, protoProps, staticProps) {
25236
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25237
+ if (staticProps) _defineProperties(Constructor, staticProps);
25238
+ Object.defineProperty(Constructor, "prototype", { writable: false });
25239
+ return Constructor;
25240
+ }
25241
+ function _defineProperty(obj, key, value) {
25242
+ key = _toPropertyKey(key);
25243
+ if (key in obj) {
25244
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
25245
+ } else {
25246
+ obj[key] = value;
25247
+ }
25248
+ return obj;
25249
+ }
25250
+ function _toPropertyKey(arg) {
25251
+ var key = _toPrimitive(arg, "string");
25252
+ return _typeof(key) === "symbol" ? key : String(key);
25253
+ }
25254
+ function _toPrimitive(input, hint) {
25255
+ if (_typeof(input) !== "object" || input === null) return input;
25256
+ var prim = input[Symbol.toPrimitive];
25257
+ if (prim !== void 0) {
25258
+ var res = prim.call(input, hint || "default");
25259
+ if (_typeof(res) !== "object") return res;
25260
+ throw new TypeError("@@toPrimitive must return a primitive value.");
25261
+ }
25262
+ return (hint === "string" ? String : Number)(input);
25263
+ }
25264
+ var SetLike = /* @__PURE__ */ (function() {
25265
+ function SetLike2() {
25266
+ var items = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
25267
+ _classCallCheck(this, SetLike2);
25268
+ _defineProperty(this, "items", void 0);
25269
+ this.items = items;
25270
+ }
25271
+ _createClass(SetLike2, [{
25272
+ key: "add",
25273
+ value: function add(value) {
25274
+ if (this.has(value) === false) {
25275
+ this.items.push(value);
25276
+ }
25277
+ return this;
25278
+ }
25279
+ }, {
25280
+ key: "clear",
25281
+ value: function clear() {
25282
+ this.items = [];
25283
+ }
25284
+ }, {
25285
+ key: "delete",
25286
+ value: function _delete(value) {
25287
+ var previousLength = this.items.length;
25288
+ this.items = this.items.filter(function(item) {
25289
+ return item !== value;
25290
+ });
25291
+ return previousLength !== this.items.length;
25292
+ }
25293
+ }, {
25294
+ key: "forEach",
25295
+ value: function forEach(callbackfn) {
25296
+ var _this = this;
25297
+ this.items.forEach(function(item) {
25298
+ callbackfn(item, item, _this);
25299
+ });
25300
+ }
25301
+ }, {
25302
+ key: "has",
25303
+ value: function has(value) {
25304
+ return this.items.indexOf(value) !== -1;
25305
+ }
25306
+ }, {
25307
+ key: "size",
25308
+ get: function get() {
25309
+ return this.items.length;
25310
+ }
25311
+ }]);
25312
+ return SetLike2;
25313
+ })();
25314
+ var SetLike_default = typeof Set === "undefined" ? Set : SetLike;
25315
+
25316
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/getRole.mjs
25317
+ function getLocalName(element) {
25318
+ var _element$localName;
25319
+ return (
25320
+ // eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
25321
+ (_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : (
25322
+ // eslint-disable-next-line no-restricted-properties -- required for the fallback
25323
+ element.tagName.toLowerCase()
25324
+ )
25325
+ );
25326
+ }
25327
+ var localNameToRoleMappings = {
25328
+ article: "article",
25329
+ aside: "complementary",
25330
+ button: "button",
25331
+ datalist: "listbox",
25332
+ dd: "definition",
25333
+ details: "group",
25334
+ dialog: "dialog",
25335
+ dt: "term",
25336
+ fieldset: "group",
25337
+ figure: "figure",
25338
+ // WARNING: Only with an accessible name
25339
+ form: "form",
25340
+ footer: "contentinfo",
25341
+ h1: "heading",
25342
+ h2: "heading",
25343
+ h3: "heading",
25344
+ h4: "heading",
25345
+ h5: "heading",
25346
+ h6: "heading",
25347
+ header: "banner",
25348
+ hr: "separator",
25349
+ html: "document",
25350
+ legend: "legend",
25351
+ li: "listitem",
25352
+ math: "math",
25353
+ main: "main",
25354
+ menu: "list",
25355
+ nav: "navigation",
25356
+ ol: "list",
25357
+ optgroup: "group",
25358
+ // WARNING: Only in certain context
25359
+ option: "option",
25360
+ output: "status",
25361
+ progress: "progressbar",
25362
+ // WARNING: Only with an accessible name
25363
+ section: "region",
25364
+ summary: "button",
25365
+ table: "table",
25366
+ tbody: "rowgroup",
25367
+ textarea: "textbox",
25368
+ tfoot: "rowgroup",
25369
+ // WARNING: Only in certain context
25370
+ td: "cell",
25371
+ th: "columnheader",
25372
+ thead: "rowgroup",
25373
+ tr: "row",
25374
+ ul: "list"
25375
+ };
25376
+ var prohibitedAttributes = {
25377
+ caption: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25378
+ code: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25379
+ deletion: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25380
+ emphasis: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25381
+ generic: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby", "aria-roledescription"]),
25382
+ insertion: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25383
+ none: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25384
+ paragraph: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25385
+ presentation: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25386
+ strong: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25387
+ subscript: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
25388
+ superscript: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"])
25389
+ };
25390
+ function hasGlobalAriaAttributes(element, role) {
25391
+ return [
25392
+ "aria-atomic",
25393
+ "aria-busy",
25394
+ "aria-controls",
25395
+ "aria-current",
25396
+ "aria-description",
25397
+ "aria-describedby",
25398
+ "aria-details",
25399
+ // "disabled",
25400
+ "aria-dropeffect",
25401
+ // "errormessage",
25402
+ "aria-flowto",
25403
+ "aria-grabbed",
25404
+ // "haspopup",
25405
+ "aria-hidden",
25406
+ // "invalid",
25407
+ "aria-keyshortcuts",
25408
+ "aria-label",
25409
+ "aria-labelledby",
25410
+ "aria-live",
25411
+ "aria-owns",
25412
+ "aria-relevant",
25413
+ "aria-roledescription"
25414
+ ].some(function(attributeName) {
25415
+ var _prohibitedAttributes;
25416
+ return element.hasAttribute(attributeName) && !((_prohibitedAttributes = prohibitedAttributes[role]) !== null && _prohibitedAttributes !== void 0 && _prohibitedAttributes.has(attributeName));
25417
+ });
25418
+ }
25419
+ function ignorePresentationalRole(element, implicitRole) {
25420
+ return hasGlobalAriaAttributes(element, implicitRole);
25421
+ }
25422
+ function getRole(element) {
25423
+ var explicitRole = getExplicitRole(element);
25424
+ if (explicitRole === null || presentationRoles.indexOf(explicitRole) !== -1) {
25425
+ var implicitRole = getImplicitRole(element);
25426
+ if (presentationRoles.indexOf(explicitRole || "") === -1 || ignorePresentationalRole(element, implicitRole || "")) {
25427
+ return implicitRole;
25428
+ }
25429
+ }
25430
+ return explicitRole;
25431
+ }
25432
+ function getImplicitRole(element) {
25433
+ var mappedByTag = localNameToRoleMappings[getLocalName(element)];
25434
+ if (mappedByTag !== void 0) {
25435
+ return mappedByTag;
25436
+ }
25437
+ switch (getLocalName(element)) {
25438
+ case "a":
25439
+ case "area":
25440
+ case "link":
25441
+ if (element.hasAttribute("href")) {
25442
+ return "link";
25443
+ }
25444
+ break;
25445
+ case "img":
25446
+ if (element.getAttribute("alt") === "" && !ignorePresentationalRole(element, "img")) {
25447
+ return "presentation";
25448
+ }
25449
+ return "img";
25450
+ case "input": {
25451
+ var _ref = element, type = _ref.type;
25452
+ switch (type) {
25453
+ case "button":
25454
+ case "image":
25455
+ case "reset":
25456
+ case "submit":
25457
+ return "button";
25458
+ case "checkbox":
25459
+ case "radio":
25460
+ return type;
25461
+ case "range":
25462
+ return "slider";
25463
+ case "email":
25464
+ case "tel":
25465
+ case "text":
25466
+ case "url":
25467
+ if (element.hasAttribute("list")) {
25468
+ return "combobox";
25469
+ }
25470
+ return "textbox";
25471
+ case "search":
25472
+ if (element.hasAttribute("list")) {
25473
+ return "combobox";
25474
+ }
25475
+ return "searchbox";
25476
+ case "number":
25477
+ return "spinbutton";
25478
+ default:
25479
+ return null;
25480
+ }
25481
+ }
25482
+ case "select":
25483
+ if (element.hasAttribute("multiple") || element.size > 1) {
25484
+ return "listbox";
25485
+ }
25486
+ return "combobox";
25487
+ }
25488
+ return null;
25489
+ }
25490
+ function getExplicitRole(element) {
25491
+ var role = element.getAttribute("role");
25492
+ if (role !== null) {
25493
+ var explicitRole = role.trim().split(" ")[0];
25494
+ if (explicitRole.length > 0) {
25495
+ return explicitRole;
25496
+ }
25497
+ }
25498
+ return null;
25499
+ }
25500
+
25501
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/util.mjs
25502
+ var presentationRoles = ["presentation", "none"];
25503
+ function isElement(node) {
25504
+ return node !== null && node.nodeType === node.ELEMENT_NODE;
25505
+ }
25506
+ function isHTMLTableCaptionElement(node) {
25507
+ return isElement(node) && getLocalName(node) === "caption";
25508
+ }
25509
+ function isHTMLInputElement(node) {
25510
+ return isElement(node) && getLocalName(node) === "input";
25511
+ }
25512
+ function isHTMLOptGroupElement(node) {
25513
+ return isElement(node) && getLocalName(node) === "optgroup";
25514
+ }
25515
+ function isHTMLSelectElement(node) {
25516
+ return isElement(node) && getLocalName(node) === "select";
25517
+ }
25518
+ function isHTMLTableElement(node) {
25519
+ return isElement(node) && getLocalName(node) === "table";
25520
+ }
25521
+ function isHTMLTextAreaElement(node) {
25522
+ return isElement(node) && getLocalName(node) === "textarea";
25523
+ }
25524
+ function safeWindow(node) {
25525
+ var _ref = node.ownerDocument === null ? node : node.ownerDocument, defaultView = _ref.defaultView;
25526
+ if (defaultView === null) {
25527
+ throw new TypeError("no window available");
25528
+ }
25529
+ return defaultView;
25530
+ }
25531
+ function isHTMLFieldSetElement(node) {
25532
+ return isElement(node) && getLocalName(node) === "fieldset";
25533
+ }
25534
+ function isHTMLLegendElement(node) {
25535
+ return isElement(node) && getLocalName(node) === "legend";
25536
+ }
25537
+ function isHTMLSlotElement(node) {
25538
+ return isElement(node) && getLocalName(node) === "slot";
25539
+ }
25540
+ function isSVGElement(node) {
25541
+ return isElement(node) && node.ownerSVGElement !== void 0;
25542
+ }
25543
+ function isSVGSVGElement(node) {
25544
+ return isElement(node) && getLocalName(node) === "svg";
25545
+ }
25546
+ function isSVGTitleElement(node) {
25547
+ return isSVGElement(node) && getLocalName(node) === "title";
25548
+ }
25549
+ function queryIdRefs(node, attributeName) {
25550
+ if (isElement(node) && node.hasAttribute(attributeName)) {
25551
+ var ids = node.getAttribute(attributeName).split(" ");
25552
+ var root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
25553
+ return ids.map(function(id) {
25554
+ return root.getElementById(id);
25555
+ }).filter(
25556
+ function(element) {
25557
+ return element !== null;
25558
+ }
25559
+ // TODO: why does this not narrow?
25560
+ );
25561
+ }
25562
+ return [];
25563
+ }
25564
+ function hasAnyConcreteRoles(node, roles) {
25565
+ if (isElement(node)) {
25566
+ return roles.indexOf(getRole(node)) !== -1;
25567
+ }
25568
+ return false;
25569
+ }
25570
+
25571
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs
25572
+ function asFlatString(s) {
25573
+ return s.trim().replace(/\s\s+/g, " ");
25574
+ }
25575
+ function isHidden(node, getComputedStyleImplementation) {
25576
+ if (!isElement(node)) {
25577
+ return false;
25578
+ }
25579
+ if (node.hasAttribute("hidden") || node.getAttribute("aria-hidden") === "true") {
25580
+ return true;
25581
+ }
25582
+ var style = getComputedStyleImplementation(node);
25583
+ return style.getPropertyValue("display") === "none" || style.getPropertyValue("visibility") === "hidden";
25584
+ }
25585
+ function isControl(node) {
25586
+ return hasAnyConcreteRoles(node, ["button", "combobox", "listbox", "textbox"]) || hasAbstractRole(node, "range");
25587
+ }
25588
+ function hasAbstractRole(node, role) {
25589
+ if (!isElement(node)) {
25590
+ return false;
25591
+ }
25592
+ switch (role) {
25593
+ case "range":
25594
+ return hasAnyConcreteRoles(node, ["meter", "progressbar", "scrollbar", "slider", "spinbutton"]);
25595
+ default:
25596
+ throw new TypeError("No knowledge about abstract role '".concat(role, "'. This is likely a bug :("));
25597
+ }
25598
+ }
25599
+ function querySelectorAllSubtree(element, selectors) {
25600
+ var elements = arrayFrom(element.querySelectorAll(selectors));
25601
+ queryIdRefs(element, "aria-owns").forEach(function(root) {
25602
+ elements.push.apply(elements, arrayFrom(root.querySelectorAll(selectors)));
25603
+ });
25604
+ return elements;
25605
+ }
25606
+ function querySelectedOptions(listbox) {
25607
+ if (isHTMLSelectElement(listbox)) {
25608
+ return listbox.selectedOptions || querySelectorAllSubtree(listbox, "[selected]");
25609
+ }
25610
+ return querySelectorAllSubtree(listbox, '[aria-selected="true"]');
25611
+ }
25612
+ function isMarkedPresentational(node) {
25613
+ return hasAnyConcreteRoles(node, presentationRoles);
25614
+ }
25615
+ function isNativeHostLanguageTextAlternativeElement(node) {
25616
+ return isHTMLTableCaptionElement(node);
25617
+ }
25618
+ function allowsNameFromContent(node) {
25619
+ return hasAnyConcreteRoles(node, ["button", "cell", "checkbox", "columnheader", "gridcell", "heading", "label", "legend", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem"]);
25620
+ }
25621
+ function isDescendantOfNativeHostLanguageTextAlternativeElement(node) {
25622
+ return false;
25623
+ }
25624
+ function getValueOfTextbox(element) {
25625
+ if (isHTMLInputElement(element) || isHTMLTextAreaElement(element)) {
25626
+ return element.value;
25627
+ }
25628
+ return element.textContent || "";
25629
+ }
25630
+ function getTextualContent(declaration) {
25631
+ var content = declaration.getPropertyValue("content");
25632
+ if (/^["'].*["']$/.test(content)) {
25633
+ return content.slice(1, -1);
25634
+ }
25635
+ return "";
25636
+ }
25637
+ function isLabelableElement(element) {
25638
+ var localName = getLocalName(element);
25639
+ return localName === "button" || localName === "input" && element.getAttribute("type") !== "hidden" || localName === "meter" || localName === "output" || localName === "progress" || localName === "select" || localName === "textarea";
25640
+ }
25641
+ function findLabelableElement(element) {
25642
+ if (isLabelableElement(element)) {
25643
+ return element;
25644
+ }
25645
+ var labelableElement = null;
25646
+ element.childNodes.forEach(function(childNode) {
25647
+ if (labelableElement === null && isElement(childNode)) {
25648
+ var descendantLabelableElement = findLabelableElement(childNode);
25649
+ if (descendantLabelableElement !== null) {
25650
+ labelableElement = descendantLabelableElement;
25651
+ }
25652
+ }
25653
+ });
25654
+ return labelableElement;
25655
+ }
25656
+ function getControlOfLabel(label) {
25657
+ if (label.control !== void 0) {
25658
+ return label.control;
25659
+ }
25660
+ var htmlFor = label.getAttribute("for");
25661
+ if (htmlFor !== null) {
25662
+ return label.ownerDocument.getElementById(htmlFor);
25663
+ }
25664
+ return findLabelableElement(label);
25665
+ }
25666
+ function getLabels(element) {
25667
+ var labelsProperty = element.labels;
25668
+ if (labelsProperty === null) {
25669
+ return labelsProperty;
25670
+ }
25671
+ if (labelsProperty !== void 0) {
25672
+ return arrayFrom(labelsProperty);
25673
+ }
25674
+ if (!isLabelableElement(element)) {
25675
+ return null;
25676
+ }
25677
+ var document2 = element.ownerDocument;
25678
+ return arrayFrom(document2.querySelectorAll("label")).filter(function(label) {
25679
+ return getControlOfLabel(label) === element;
25680
+ });
25681
+ }
25682
+ function getSlotContents(slot) {
25683
+ var assignedNodes = slot.assignedNodes();
25684
+ if (assignedNodes.length === 0) {
25685
+ return arrayFrom(slot.childNodes);
25686
+ }
25687
+ return assignedNodes;
25688
+ }
25689
+ function computeTextAlternative(root) {
25690
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
25691
+ var consultedNodes = new SetLike_default();
25692
+ var window2 = safeWindow(root);
25693
+ var _options$compute = options.compute, compute = _options$compute === void 0 ? "name" : _options$compute, _options$computedStyl = options.computedStyleSupportsPseudoElements, computedStyleSupportsPseudoElements = _options$computedStyl === void 0 ? options.getComputedStyle !== void 0 : _options$computedStyl, _options$getComputedS = options.getComputedStyle, getComputedStyle2 = _options$getComputedS === void 0 ? window2.getComputedStyle.bind(window2) : _options$getComputedS, _options$hidden = options.hidden, hidden = _options$hidden === void 0 ? false : _options$hidden;
25694
+ function computeMiscTextAlternative(node, context) {
25695
+ var accumulatedText = "";
25696
+ if (isElement(node) && computedStyleSupportsPseudoElements) {
25697
+ var pseudoBefore = getComputedStyle2(node, "::before");
25698
+ var beforeContent = getTextualContent(pseudoBefore);
25699
+ accumulatedText = "".concat(beforeContent, " ").concat(accumulatedText);
25700
+ }
25701
+ var childNodes = isHTMLSlotElement(node) ? getSlotContents(node) : arrayFrom(node.childNodes).concat(queryIdRefs(node, "aria-owns"));
25702
+ childNodes.forEach(function(child) {
25703
+ var result2 = computeTextAlternative2(child, {
25704
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
25705
+ isReferenced: false,
25706
+ recursion: true
25707
+ });
25708
+ var display = isElement(child) ? getComputedStyle2(child).getPropertyValue("display") : "inline";
25709
+ var separator = display !== "inline" ? " " : "";
25710
+ accumulatedText += "".concat(separator).concat(result2).concat(separator);
25711
+ });
25712
+ if (isElement(node) && computedStyleSupportsPseudoElements) {
25713
+ var pseudoAfter = getComputedStyle2(node, "::after");
25714
+ var afterContent = getTextualContent(pseudoAfter);
25715
+ accumulatedText = "".concat(accumulatedText, " ").concat(afterContent);
25716
+ }
25717
+ return accumulatedText.trim();
25718
+ }
25719
+ function useAttribute(element, attributeName) {
25720
+ var attribute = element.getAttributeNode(attributeName);
25721
+ if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== "") {
25722
+ consultedNodes.add(attribute);
25723
+ return attribute.value;
25724
+ }
25725
+ return null;
25726
+ }
25727
+ function computeTooltipAttributeValue(node) {
25728
+ if (!isElement(node)) {
25729
+ return null;
25730
+ }
25731
+ return useAttribute(node, "title");
25732
+ }
25733
+ function computeElementTextAlternative(node) {
25734
+ if (!isElement(node)) {
25735
+ return null;
25736
+ }
25737
+ if (isHTMLFieldSetElement(node)) {
25738
+ consultedNodes.add(node);
25739
+ var children = arrayFrom(node.childNodes);
25740
+ for (var i = 0; i < children.length; i += 1) {
25741
+ var child = children[i];
25742
+ if (isHTMLLegendElement(child)) {
25743
+ return computeTextAlternative2(child, {
25744
+ isEmbeddedInLabel: false,
25745
+ isReferenced: false,
25746
+ recursion: false
25747
+ });
25748
+ }
25749
+ }
25750
+ } else if (isHTMLTableElement(node)) {
25751
+ consultedNodes.add(node);
25752
+ var _children = arrayFrom(node.childNodes);
25753
+ for (var _i = 0; _i < _children.length; _i += 1) {
25754
+ var _child = _children[_i];
25755
+ if (isHTMLTableCaptionElement(_child)) {
25756
+ return computeTextAlternative2(_child, {
25757
+ isEmbeddedInLabel: false,
25758
+ isReferenced: false,
25759
+ recursion: false
25760
+ });
25761
+ }
25762
+ }
25763
+ } else if (isSVGSVGElement(node)) {
25764
+ consultedNodes.add(node);
25765
+ var _children2 = arrayFrom(node.childNodes);
25766
+ for (var _i2 = 0; _i2 < _children2.length; _i2 += 1) {
25767
+ var _child2 = _children2[_i2];
25768
+ if (isSVGTitleElement(_child2)) {
25769
+ return _child2.textContent;
25770
+ }
25771
+ }
25772
+ return null;
25773
+ } else if (getLocalName(node) === "img" || getLocalName(node) === "area") {
25774
+ var nameFromAlt = useAttribute(node, "alt");
25775
+ if (nameFromAlt !== null) {
25776
+ return nameFromAlt;
25777
+ }
25778
+ } else if (isHTMLOptGroupElement(node)) {
25779
+ var nameFromLabel = useAttribute(node, "label");
25780
+ if (nameFromLabel !== null) {
25781
+ return nameFromLabel;
25782
+ }
25783
+ }
25784
+ if (isHTMLInputElement(node) && (node.type === "button" || node.type === "submit" || node.type === "reset")) {
25785
+ var nameFromValue = useAttribute(node, "value");
25786
+ if (nameFromValue !== null) {
25787
+ return nameFromValue;
25788
+ }
25789
+ if (node.type === "submit") {
25790
+ return "Submit";
25791
+ }
25792
+ if (node.type === "reset") {
25793
+ return "Reset";
25794
+ }
25795
+ }
25796
+ var labels = getLabels(node);
25797
+ if (labels !== null && labels.length !== 0) {
25798
+ consultedNodes.add(node);
25799
+ return arrayFrom(labels).map(function(element) {
25800
+ return computeTextAlternative2(element, {
25801
+ isEmbeddedInLabel: true,
25802
+ isReferenced: false,
25803
+ recursion: true
25804
+ });
25805
+ }).filter(function(label) {
25806
+ return label.length > 0;
25807
+ }).join(" ");
25808
+ }
25809
+ if (isHTMLInputElement(node) && node.type === "image") {
25810
+ var _nameFromAlt = useAttribute(node, "alt");
25811
+ if (_nameFromAlt !== null) {
25812
+ return _nameFromAlt;
25813
+ }
25814
+ var nameFromTitle = useAttribute(node, "title");
25815
+ if (nameFromTitle !== null) {
25816
+ return nameFromTitle;
25817
+ }
25818
+ return "Submit Query";
25819
+ }
25820
+ if (hasAnyConcreteRoles(node, ["button"])) {
25821
+ var nameFromSubTree = computeMiscTextAlternative(node, {
25822
+ isEmbeddedInLabel: false,
25823
+ isReferenced: false
25824
+ });
25825
+ if (nameFromSubTree !== "") {
25826
+ return nameFromSubTree;
25827
+ }
25828
+ }
25829
+ return null;
25830
+ }
25831
+ function computeTextAlternative2(current, context) {
25832
+ if (consultedNodes.has(current)) {
25833
+ return "";
25834
+ }
25835
+ if (!hidden && isHidden(current, getComputedStyle2) && !context.isReferenced) {
25836
+ consultedNodes.add(current);
25837
+ return "";
25838
+ }
25839
+ var labelAttributeNode = isElement(current) ? current.getAttributeNode("aria-labelledby") : null;
25840
+ var labelElements = labelAttributeNode !== null && !consultedNodes.has(labelAttributeNode) ? queryIdRefs(current, "aria-labelledby") : [];
25841
+ if (compute === "name" && !context.isReferenced && labelElements.length > 0) {
25842
+ consultedNodes.add(labelAttributeNode);
25843
+ return labelElements.map(function(element) {
25844
+ return computeTextAlternative2(element, {
25845
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
25846
+ isReferenced: true,
25847
+ // this isn't recursion as specified, otherwise we would skip
25848
+ // `aria-label` in
25849
+ // <input id="myself" aria-label="foo" aria-labelledby="myself"
25850
+ recursion: false
25851
+ });
25852
+ }).join(" ");
25853
+ }
25854
+ var skipToStep2E = context.recursion && isControl(current) && compute === "name";
25855
+ if (!skipToStep2E) {
25856
+ var ariaLabel = (isElement(current) && current.getAttribute("aria-label") || "").trim();
25857
+ if (ariaLabel !== "" && compute === "name") {
25858
+ consultedNodes.add(current);
25859
+ return ariaLabel;
25860
+ }
25861
+ if (!isMarkedPresentational(current)) {
25862
+ var elementTextAlternative = computeElementTextAlternative(current);
25863
+ if (elementTextAlternative !== null) {
25864
+ consultedNodes.add(current);
25865
+ return elementTextAlternative;
25866
+ }
25867
+ }
25868
+ }
25869
+ if (hasAnyConcreteRoles(current, ["menu"])) {
25870
+ consultedNodes.add(current);
25871
+ return "";
25872
+ }
25873
+ if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {
25874
+ if (hasAnyConcreteRoles(current, ["combobox", "listbox"])) {
25875
+ consultedNodes.add(current);
25876
+ var selectedOptions = querySelectedOptions(current);
25877
+ if (selectedOptions.length === 0) {
25878
+ return isHTMLInputElement(current) ? current.value : "";
25879
+ }
25880
+ return arrayFrom(selectedOptions).map(function(selectedOption) {
25881
+ return computeTextAlternative2(selectedOption, {
25882
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
25883
+ isReferenced: false,
25884
+ recursion: true
25885
+ });
25886
+ }).join(" ");
25887
+ }
25888
+ if (hasAbstractRole(current, "range")) {
25889
+ consultedNodes.add(current);
25890
+ if (current.hasAttribute("aria-valuetext")) {
25891
+ return current.getAttribute("aria-valuetext");
25892
+ }
25893
+ if (current.hasAttribute("aria-valuenow")) {
25894
+ return current.getAttribute("aria-valuenow");
25895
+ }
25896
+ return current.getAttribute("value") || "";
25897
+ }
25898
+ if (hasAnyConcreteRoles(current, ["textbox"])) {
25899
+ consultedNodes.add(current);
25900
+ return getValueOfTextbox(current);
25901
+ }
25902
+ }
25903
+ if (allowsNameFromContent(current) || isElement(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement(current)) {
25904
+ var accumulatedText2F = computeMiscTextAlternative(current, {
25905
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
25906
+ isReferenced: false
25907
+ });
25908
+ if (accumulatedText2F !== "") {
25909
+ consultedNodes.add(current);
25910
+ return accumulatedText2F;
25911
+ }
25912
+ }
25913
+ if (current.nodeType === current.TEXT_NODE) {
25914
+ consultedNodes.add(current);
25915
+ return current.textContent || "";
25916
+ }
25917
+ if (context.recursion) {
25918
+ consultedNodes.add(current);
25919
+ return computeMiscTextAlternative(current, {
25920
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
25921
+ isReferenced: false
25922
+ });
25923
+ }
25924
+ var tooltipAttributeValue = computeTooltipAttributeValue(current);
25925
+ if (tooltipAttributeValue !== null) {
25926
+ consultedNodes.add(current);
25927
+ return tooltipAttributeValue;
25928
+ }
25929
+ consultedNodes.add(current);
25930
+ return "";
25931
+ }
25932
+ return asFlatString(computeTextAlternative2(root, {
25933
+ isEmbeddedInLabel: false,
25934
+ // by spec computeAccessibleDescription starts with the referenced elements as roots
25935
+ isReferenced: compute === "description",
25936
+ recursion: false
25937
+ }));
25938
+ }
25939
+
25940
+ // ../../node_modules/.pnpm/dom-accessibility-api@0.6.3/node_modules/dom-accessibility-api/dist/accessible-name.mjs
25941
+ function prohibitsNaming(node) {
25942
+ return hasAnyConcreteRoles(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "none", "paragraph", "presentation", "strong", "subscript", "superscript"]);
25943
+ }
25944
+ function computeAccessibleName(root) {
25945
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
25946
+ if (prohibitsNaming(root)) {
25947
+ return "";
25948
+ }
25949
+ return computeTextAlternative(root, options);
25950
+ }
25951
+
25952
+ // ../../node_modules/.pnpm/tabbable@6.5.0/node_modules/tabbable/dist/index.esm.js
25953
+ var candidateSelectors = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "area[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"];
25954
+ var NoElement = typeof Element === "undefined";
25955
+ var matches = NoElement ? function() {
25956
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
25957
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
25958
+ var _element$getRootNode;
25959
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
25960
+ } : function(element) {
25961
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
25962
+ };
25963
+ var isInput = function isInput2(node) {
25964
+ return node.tagName === "INPUT";
25965
+ };
25966
+ var isHiddenInput = function isHiddenInput2(node) {
25967
+ return isInput(node) && node.type === "hidden";
25968
+ };
25969
+ var isDetailsWithSummary = function isDetailsWithSummary2(node) {
25970
+ var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
25971
+ return child.tagName === "SUMMARY";
25972
+ });
25973
+ return r;
25974
+ };
25975
+ var isNodeAttached = function isNodeAttached2(node) {
25976
+ var _nodeRoot;
25977
+ var nodeRoot = node && getRootNode(node);
25978
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
25979
+ var attached = false;
25980
+ if (nodeRoot && nodeRoot !== node) {
25981
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
25982
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
25983
+ while (!attached && nodeRootHost) {
25984
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
25985
+ nodeRoot = getRootNode(nodeRootHost);
25986
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
25987
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
25988
+ }
25989
+ }
25990
+ return attached;
25991
+ };
25992
+ var isZeroArea = function isZeroArea2(node) {
25993
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
25994
+ return width === 0 && height === 0;
25995
+ };
25996
+ var isHidden2 = function isHidden3(node, _ref) {
25997
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
25998
+ if (displayCheck === "full-native") {
25999
+ if ("checkVisibility" in node) {
26000
+ var visible = node.checkVisibility({
26001
+ // Checking opacity might be desirable for some use cases, but natively,
26002
+ // opacity zero elements _are_ focusable and tabbable.
26003
+ checkOpacity: false,
26004
+ opacityProperty: false,
26005
+ contentVisibilityAuto: true,
26006
+ visibilityProperty: true,
26007
+ // This is an alias for `visibilityProperty`. Contemporary browsers
26008
+ // support both. However, this alias has wider browser support (Chrome
26009
+ // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
26010
+ // we include it anyway.
26011
+ checkVisibilityCSS: true
26012
+ });
26013
+ return !visible;
26014
+ }
26015
+ }
26016
+ var _getComputedStyle = getComputedStyle(node), visibility = _getComputedStyle.visibility;
26017
+ if (visibility === "hidden" || visibility === "collapse") {
26018
+ return true;
26019
+ }
26020
+ var isDirectSummary = matches.call(node, "details>summary:first-of-type");
26021
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
26022
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
26023
+ return true;
26024
+ }
26025
+ if (!displayCheck || displayCheck === "full" || // full-native can run this branch when it falls through in case
26026
+ // Element#checkVisibility is unsupported
26027
+ displayCheck === "full-native" || displayCheck === "legacy-full") {
26028
+ if (typeof getShadowRoot === "function") {
26029
+ var originalNode = node;
26030
+ while (node) {
26031
+ var parentElement = node.parentElement;
26032
+ var rootNode = getRootNode(node);
26033
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
26034
+ return isZeroArea(node);
26035
+ } else if (node.assignedSlot) {
26036
+ node = node.assignedSlot;
26037
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
26038
+ node = rootNode.host;
26039
+ } else {
26040
+ node = parentElement;
26041
+ }
26042
+ }
26043
+ node = originalNode;
26044
+ }
26045
+ if (isNodeAttached(node)) {
26046
+ return !node.getClientRects().length;
26047
+ }
26048
+ if (displayCheck !== "legacy-full") {
26049
+ return true;
26050
+ }
26051
+ } else if (displayCheck === "non-zero-area") {
26052
+ return isZeroArea(node);
26053
+ }
26054
+ return false;
26055
+ };
26056
+ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
26057
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
26058
+ var parentNode = node.parentElement;
26059
+ while (parentNode) {
26060
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
26061
+ for (var i = 0; i < parentNode.children.length; i++) {
26062
+ var child = parentNode.children.item(i);
26063
+ if (child.tagName === "LEGEND") {
26064
+ return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
26065
+ }
26066
+ }
26067
+ return true;
26068
+ }
26069
+ parentNode = parentNode.parentElement;
26070
+ }
26071
+ }
26072
+ return false;
26073
+ };
26074
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
26075
+ if (node.disabled || isHiddenInput(node) || isHidden2(node, options) || // For a details element with a summary, the summary element gets the focus
26076
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
26077
+ return false;
26078
+ }
26079
+ return true;
26080
+ };
26081
+ var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(",");
26082
+ var isFocusable = function isFocusable2(node, options) {
26083
+ options = options || {};
26084
+ if (!node) {
26085
+ throw new Error("No node provided");
26086
+ }
26087
+ if (matches.call(node, focusableCandidateSelector) === false) {
26088
+ return false;
26089
+ }
26090
+ return isNodeMatchingSelectorFocusable(options, node);
26091
+ };
26092
+
26093
+ // ../next-sdk/page-tools/a11y-tree.ts
26094
+ var TAG_ROLE_MAP = {
26095
+ a: "link",
26096
+ article: "article",
26097
+ aside: "complementary",
26098
+ button: "button",
26099
+ caption: "caption",
26100
+ cell: "cell",
26101
+ checkbox: "checkbox",
26102
+ code: "code",
26103
+ columnheader: "columnheader",
26104
+ combobox: "combobox",
26105
+ datalist: "listbox",
26106
+ dd: "definition",
26107
+ details: "group",
26108
+ dialog: "dialog",
26109
+ dt: "term",
26110
+ em: "emphasis",
26111
+ fieldset: "group",
26112
+ figure: "figure",
26113
+ footer: "contentinfo",
26114
+ form: "form",
26115
+ h1: "heading",
26116
+ h2: "heading",
26117
+ h3: "heading",
26118
+ h4: "heading",
26119
+ h5: "heading",
26120
+ h6: "heading",
26121
+ header: "banner",
26122
+ hr: "separator",
26123
+ img: "img",
26124
+ input: "textbox",
26125
+ // 默认,具体 type 下面会覆盖
26126
+ li: "listitem",
26127
+ link: "link",
26128
+ main: "main",
26129
+ mark: "mark",
26130
+ math: "math",
26131
+ menu: "list",
26132
+ menuitem: "menuitem",
26133
+ meter: "meter",
26134
+ nav: "navigation",
26135
+ ol: "list",
26136
+ option: "option",
26137
+ output: "status",
26138
+ p: "paragraph",
26139
+ progress: "progressbar",
26140
+ rowheader: "rowheader",
26141
+ search: "search",
26142
+ section: "region",
26143
+ select: "listbox",
26144
+ strong: "strong",
26145
+ summary: "button",
26146
+ table: "table",
26147
+ tbody: "rowgroup",
26148
+ td: "cell",
26149
+ tfoot: "rowgroup",
26150
+ th: "columnheader",
26151
+ thead: "rowgroup",
26152
+ time: "time",
26153
+ tr: "row",
26154
+ ul: "list"
26155
+ };
26156
+ var INPUT_TYPE_ROLE = {
26157
+ button: "button",
26158
+ checkbox: "checkbox",
26159
+ color: "textbox",
26160
+ email: "textbox",
26161
+ file: "textbox",
26162
+ image: "button",
26163
+ number: "spinbutton",
26164
+ radio: "radio",
26165
+ range: "slider",
26166
+ reset: "button",
26167
+ search: "searchbox",
26168
+ submit: "button",
26169
+ tel: "textbox",
26170
+ text: "textbox",
26171
+ url: "textbox"
26172
+ };
26173
+ function inferRole(el) {
26174
+ const explicit = el.getAttribute("role");
26175
+ if (explicit && explicit !== "presentation" && explicit !== "none") {
26176
+ return explicit;
26177
+ }
26178
+ const tag = el.tagName.toLowerCase();
26179
+ if (tag === "input") {
26180
+ const inputType = el.type?.toLowerCase() ?? "text";
26181
+ return INPUT_TYPE_ROLE[inputType] ?? "textbox";
26182
+ }
26183
+ return TAG_ROLE_MAP[tag] ?? "generic";
26184
+ }
26185
+ function getStateTokens(el) {
26186
+ const tokens = [];
26187
+ const aria = (k) => el.getAttribute(k);
26188
+ const checked = aria("aria-checked");
26189
+ if (checked === "true") tokens.push("checked");
26190
+ else if (checked === "false") tokens.push("unchecked");
26191
+ if (aria("aria-selected") === "true") tokens.push("selected");
26192
+ const disabled = aria("aria-disabled") === "true" || el.disabled;
26193
+ if (disabled) tokens.push("disabled");
26194
+ const hasPopup = aria("aria-haspopup");
26195
+ if (hasPopup && hasPopup !== "false") tokens.push("hasPopup");
26196
+ if (aria("aria-expanded") === "true") tokens.push("expanded");
26197
+ const headingMatch = el.tagName.match(/^H([1-6])$/);
26198
+ if (headingMatch) tokens.push(`level=${headingMatch[1]}`);
26199
+ const ariaLevel = aria("aria-level");
26200
+ if (ariaLevel && !headingMatch) tokens.push(`level=${ariaLevel}`);
26201
+ try {
26202
+ const style = window.getComputedStyle(el);
26203
+ if (style.cursor === "pointer") tokens.push("cursor=pointer");
26204
+ } catch {
26205
+ }
26206
+ const tag = el.tagName.toLowerCase();
26207
+ if (tag === "input" || tag === "textarea" || tag === "select") {
26208
+ const val = el.value;
26209
+ if (val !== void 0 && val !== "") {
26210
+ tokens.push(`value="${val}"`);
26211
+ }
26212
+ }
26213
+ const valuenow = el.getAttribute("aria-valuenow");
26214
+ if (valuenow) {
26215
+ tokens.push(`valuenow="${valuenow}"`);
26216
+ }
26217
+ return tokens;
26218
+ }
26219
+ function isHidden4(el) {
26220
+ if (el.getAttribute("aria-hidden") === "true") return true;
26221
+ if (el.hidden) return true;
26222
+ try {
26223
+ const style = window.getComputedStyle(el);
26224
+ if (style.display === "none" || style.visibility === "hidden") return true;
26225
+ } catch {
26226
+ }
26227
+ return false;
26228
+ }
26229
+ function buildVNode(el, refCounter, refMap, blacklistSet, whitelistSet) {
26230
+ if (isHidden4(el) || blacklistSet.has(el)) return null;
26231
+ const role = inferRole(el);
26232
+ const tokens = getStateTokens(el);
26233
+ const name = computeAccessibleName(el);
26234
+ const isTrulyInteractive = isFocusable(el);
26235
+ const isVisuallyClickable = tokens.includes("cursor=pointer");
26236
+ const isWhitelisted = whitelistSet.has(el);
26237
+ const interactive = isTrulyInteractive || isWhitelisted || isVisuallyClickable && (role !== "generic" || name !== "");
26238
+ let ref;
26239
+ if (interactive) {
26240
+ ref = refCounter.value;
26241
+ refMap.set(ref, el);
26242
+ refCounter.value++;
26243
+ }
26244
+ const children = [];
26245
+ for (const child of Array.from(el.children)) {
26246
+ const childVNode = buildVNode(child, refCounter, refMap, blacklistSet, whitelistSet);
26247
+ if (childVNode) children.push(childVNode);
26248
+ }
26249
+ return { role, name, tokens, ref, el, children };
26250
+ }
26251
+ function hasValue(vnode) {
26252
+ if (vnode.ref !== void 0 || vnode.name.trim() !== "") return true;
26253
+ return vnode.children.some(hasValue);
26254
+ }
26255
+ function shouldPassThrough(vnode, opts) {
26256
+ if (!opts.pruneUnnamed) return false;
26257
+ if (opts.preserveRoles.includes(vnode.role)) return false;
26258
+ if (vnode.ref !== void 0) return false;
26259
+ if (vnode.name.trim() !== "") return false;
26260
+ return true;
26261
+ }
26262
+ function serializeVNode(vnode, depth, opts) {
26263
+ if (shouldPassThrough(vnode, opts)) {
26264
+ return vnode.children.filter((c) => hasValue(c)).flatMap((c) => serializeVNode(c, depth, opts));
26265
+ }
26266
+ const indent = " ".repeat(depth);
26267
+ const refStr = vnode.ref !== void 0 ? ` #${vnode.ref}` : "";
26268
+ const tokenStr = vnode.tokens.length > 0 ? ` [${vnode.tokens.join(" ")}]` : "";
26269
+ const nameStr = vnode.name ? ` "${vnode.name}"` : "";
26270
+ const line = `${indent}- ${vnode.role}${refStr}${tokenStr}${nameStr}`;
26271
+ const childLines = vnode.children.flatMap((c) => serializeVNode(c, depth + 1, opts));
26272
+ return [line, ...childLines];
26273
+ }
26274
+ var DEFAULT_OPTIONS = {
26275
+ pruneUnnamed: true,
26276
+ preserveRoles: []
26277
+ };
26278
+ function buildA11yTree(root = document.body, blacklist = [], whitelist = [], options) {
26279
+ const opts = { ...DEFAULT_OPTIONS, ...options };
26280
+ const refCounter = { value: 0 };
26281
+ const refMap = /* @__PURE__ */ new Map();
26282
+ const blacklistSet = new Set(blacklist);
26283
+ const whitelistSet = new Set(whitelist);
26284
+ const lines = [];
26285
+ for (const child of Array.from(root.children)) {
26286
+ const vnode = buildVNode(child, refCounter, refMap, blacklistSet, whitelistSet);
26287
+ if (vnode) {
26288
+ lines.push(...serializeVNode(vnode, 0, opts));
26289
+ }
26290
+ }
26291
+ const yaml = "```yaml\n" + lines.join("\n") + "\n```";
26292
+ return {
26293
+ yaml,
26294
+ refMap,
26295
+ interactiveCount: refMap.size,
26296
+ lines
26297
+ };
26298
+ }
26299
+ function searchA11yTree(query, root = document.body, blacklist = [], whitelist = [], options) {
26300
+ const {
26301
+ contextLines = 2,
26302
+ caseInsensitive = true,
26303
+ maxMatches = 20,
26304
+ ...treeOptions
26305
+ } = options ?? {};
26306
+ const { lines } = buildA11yTree(root, blacklist, whitelist, treeOptions);
26307
+ const needle = caseInsensitive ? query.toLowerCase() : query;
26308
+ const totalLines = lines.length;
26309
+ const isRefQuery = /^#\d+$/.test(query);
26310
+ const refRegex = isRefQuery ? new RegExp(`\\s${query}(?:\\s|[\\[]|$)`) : null;
26311
+ const hitIndices = [];
26312
+ for (let i = 0; i < lines.length; i++) {
26313
+ let matched = false;
26314
+ if (refRegex) {
26315
+ matched = refRegex.test(lines[i]);
26316
+ } else {
26317
+ const haystack = caseInsensitive ? lines[i].toLowerCase() : lines[i];
26318
+ matched = haystack.includes(needle);
26319
+ }
26320
+ if (matched) {
26321
+ hitIndices.push(i);
26322
+ }
26323
+ }
26324
+ const mergedRanges = [];
26325
+ let isTruncated = false;
26326
+ for (const idx of hitIndices) {
26327
+ const start = Math.max(0, idx - contextLines);
26328
+ const end = Math.min(totalLines - 1, idx + contextLines);
26329
+ const last = mergedRanges[mergedRanges.length - 1];
26330
+ if (last && start <= last.end + 1) {
26331
+ last.end = Math.max(last.end, end);
26332
+ last.hits.push(idx);
26333
+ } else {
26334
+ if (mergedRanges.length >= maxMatches) {
26335
+ isTruncated = true;
26336
+ break;
26337
+ }
26338
+ mergedRanges.push({ start, end, hits: [idx] });
26339
+ }
26340
+ }
26341
+ const matches2 = mergedRanges.map((range) => ({
26342
+ lineNumber: range.hits[0] + 1,
26343
+ line: lines[range.hits[0]],
26344
+ context: Array.from({ length: range.end - range.start + 1 }, (_, k) => ({
26345
+ lineNumber: range.start + k + 1,
26346
+ line: lines[range.start + k]
26347
+ }))
26348
+ }));
26349
+ const textParts = [
26350
+ `\u65E0\u969C\u788D\u6811\u641C\u7D22\u7ED3\u679C \u2014 \u5173\u952E\u8BCD: "${query}" | \u603B\u884C\u6570: ${totalLines} | \u547D\u4E2D: ${hitIndices.length} \u884C | \u8FD4\u56DE\u5206\u7EC4: ${matches2.length}`,
26351
+ ""
26352
+ ];
26353
+ if (matches2.length === 0) {
26354
+ textParts.push("\uFF08\u672A\u627E\u5230\u5339\u914D\u9879\uFF09");
26355
+ } else {
26356
+ matches2.forEach((match, m) => {
26357
+ const range = mergedRanges[m];
26358
+ textParts.push(`\u2500\u2500 \u5206\u7EC4 ${m + 1}\uFF08\u7B2C ${range.start + 1}\u2013${range.end + 1} \u884C\uFF09\u2500\u2500`);
26359
+ match.context.forEach(({ lineNumber, line }) => {
26360
+ const isHit = range.hits.includes(lineNumber - 1);
26361
+ const ln = String(lineNumber).padStart(4);
26362
+ textParts.push(isHit ? `>>>${ln} | ${line}` : ` ${ln} | ${line}`);
26363
+ });
26364
+ textParts.push("");
26365
+ });
26366
+ if (isTruncated) {
26367
+ textParts.push(`\u26A0\uFE0F \u547D\u4E2D\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD\u81F3\u524D ${maxMatches} \u4E2A\u5206\u7EC4\uFF0C\u5EFA\u8BAE\u7F29\u5C0F\u641C\u7D22\u8303\u56F4`);
26368
+ }
26369
+ textParts.push(`\u63D0\u793A\uFF1A\u5982\u9700\u64CD\u4F5C\u547D\u4E2D\u5143\u7D20\uFF0C\u4F7F\u7528\u5176 #N \u7D22\u5F15\uFF1B\u5982\u9700\u67E5\u770B\u5B8C\u6574\u6811\uFF0C\u8BF7\u4F7F\u7528 browserState\u3002`);
26370
+ }
26371
+ return {
26372
+ text: textParts.join("\n"),
26373
+ matches: matches2,
26374
+ totalLines,
26375
+ matchCount: hitIndices.length
26376
+ };
26377
+ }
26378
+
26379
+ // ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.mjs
26380
+ function Diff() {
26381
+ }
26382
+ Diff.prototype = {
26383
+ diff: function diff(oldString, newString) {
26384
+ var _options$timeout;
26385
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
26386
+ var callback = options.callback;
26387
+ if (typeof options === "function") {
26388
+ callback = options;
26389
+ options = {};
26390
+ }
26391
+ var self2 = this;
26392
+ function done(value) {
26393
+ value = self2.postProcess(value, options);
26394
+ if (callback) {
26395
+ setTimeout(function() {
26396
+ callback(value);
26397
+ }, 0);
26398
+ return true;
26399
+ } else {
26400
+ return value;
26401
+ }
26402
+ }
26403
+ oldString = this.castInput(oldString, options);
26404
+ newString = this.castInput(newString, options);
26405
+ oldString = this.removeEmpty(this.tokenize(oldString, options));
26406
+ newString = this.removeEmpty(this.tokenize(newString, options));
26407
+ var newLen = newString.length, oldLen = oldString.length;
26408
+ var editLength = 1;
26409
+ var maxEditLength = newLen + oldLen;
26410
+ if (options.maxEditLength != null) {
26411
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
26412
+ }
26413
+ var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
26414
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
26415
+ var bestPath = [{
26416
+ oldPos: -1,
26417
+ lastComponent: void 0
26418
+ }];
26419
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
26420
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
26421
+ return done(buildValues(self2, bestPath[0].lastComponent, newString, oldString, self2.useLongestToken));
26422
+ }
26423
+ var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
26424
+ function execEditLength() {
26425
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
26426
+ var basePath = void 0;
26427
+ var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
26428
+ if (removePath) {
26429
+ bestPath[diagonalPath - 1] = void 0;
26430
+ }
26431
+ var canAdd = false;
26432
+ if (addPath) {
26433
+ var addPathNewPos = addPath.oldPos - diagonalPath;
26434
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
26435
+ }
26436
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
26437
+ if (!canAdd && !canRemove) {
26438
+ bestPath[diagonalPath] = void 0;
26439
+ continue;
26440
+ }
26441
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
26442
+ basePath = self2.addToPath(addPath, true, false, 0, options);
26443
+ } else {
26444
+ basePath = self2.addToPath(removePath, false, true, 1, options);
26445
+ }
26446
+ newPos = self2.extractCommon(basePath, newString, oldString, diagonalPath, options);
26447
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
26448
+ return done(buildValues(self2, basePath.lastComponent, newString, oldString, self2.useLongestToken));
26449
+ } else {
26450
+ bestPath[diagonalPath] = basePath;
26451
+ if (basePath.oldPos + 1 >= oldLen) {
26452
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
26453
+ }
26454
+ if (newPos + 1 >= newLen) {
26455
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
26456
+ }
26457
+ }
26458
+ }
26459
+ editLength++;
26460
+ }
26461
+ if (callback) {
26462
+ (function exec() {
26463
+ setTimeout(function() {
26464
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
26465
+ return callback();
26466
+ }
26467
+ if (!execEditLength()) {
26468
+ exec();
26469
+ }
26470
+ }, 0);
26471
+ })();
26472
+ } else {
26473
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
26474
+ var ret = execEditLength();
26475
+ if (ret) {
26476
+ return ret;
26477
+ }
26478
+ }
26479
+ }
26480
+ },
26481
+ addToPath: function addToPath(path, added, removed, oldPosInc, options) {
26482
+ var last = path.lastComponent;
26483
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
26484
+ return {
26485
+ oldPos: path.oldPos + oldPosInc,
26486
+ lastComponent: {
26487
+ count: last.count + 1,
26488
+ added,
26489
+ removed,
26490
+ previousComponent: last.previousComponent
26491
+ }
26492
+ };
26493
+ } else {
26494
+ return {
26495
+ oldPos: path.oldPos + oldPosInc,
26496
+ lastComponent: {
26497
+ count: 1,
26498
+ added,
26499
+ removed,
26500
+ previousComponent: last
26501
+ }
26502
+ };
26503
+ }
26504
+ },
26505
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
26506
+ var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
26507
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
26508
+ newPos++;
26509
+ oldPos++;
26510
+ commonCount++;
26511
+ if (options.oneChangePerToken) {
26512
+ basePath.lastComponent = {
26513
+ count: 1,
26514
+ previousComponent: basePath.lastComponent,
26515
+ added: false,
26516
+ removed: false
26517
+ };
26518
+ }
26519
+ }
26520
+ if (commonCount && !options.oneChangePerToken) {
26521
+ basePath.lastComponent = {
26522
+ count: commonCount,
26523
+ previousComponent: basePath.lastComponent,
26524
+ added: false,
26525
+ removed: false
26526
+ };
26527
+ }
26528
+ basePath.oldPos = oldPos;
26529
+ return newPos;
26530
+ },
26531
+ equals: function equals(left, right, options) {
26532
+ if (options.comparator) {
26533
+ return options.comparator(left, right);
26534
+ } else {
26535
+ return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
26536
+ }
26537
+ },
26538
+ removeEmpty: function removeEmpty(array2) {
26539
+ var ret = [];
26540
+ for (var i = 0; i < array2.length; i++) {
26541
+ if (array2[i]) {
26542
+ ret.push(array2[i]);
26543
+ }
26544
+ }
26545
+ return ret;
26546
+ },
26547
+ castInput: function castInput(value) {
26548
+ return value;
26549
+ },
26550
+ tokenize: function tokenize(value) {
26551
+ return Array.from(value);
26552
+ },
26553
+ join: function join(chars) {
26554
+ return chars.join("");
26555
+ },
26556
+ postProcess: function postProcess(changeObjects) {
26557
+ return changeObjects;
26558
+ }
26559
+ };
26560
+ function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
26561
+ var components = [];
26562
+ var nextComponent;
26563
+ while (lastComponent) {
26564
+ components.push(lastComponent);
26565
+ nextComponent = lastComponent.previousComponent;
26566
+ delete lastComponent.previousComponent;
26567
+ lastComponent = nextComponent;
26568
+ }
26569
+ components.reverse();
26570
+ var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
26571
+ for (; componentPos < componentLen; componentPos++) {
26572
+ var component = components[componentPos];
26573
+ if (!component.removed) {
26574
+ if (!component.added && useLongestToken) {
26575
+ var value = newString.slice(newPos, newPos + component.count);
26576
+ value = value.map(function(value2, i) {
26577
+ var oldValue = oldString[oldPos + i];
26578
+ return oldValue.length > value2.length ? oldValue : value2;
26579
+ });
26580
+ component.value = diff2.join(value);
26581
+ } else {
26582
+ component.value = diff2.join(newString.slice(newPos, newPos + component.count));
26583
+ }
26584
+ newPos += component.count;
26585
+ if (!component.added) {
26586
+ oldPos += component.count;
26587
+ }
26588
+ } else {
26589
+ component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
26590
+ oldPos += component.count;
26591
+ }
26592
+ }
26593
+ return components;
26594
+ }
26595
+ var characterDiff = new Diff();
26596
+ function longestCommonPrefix(str1, str2) {
26597
+ var i;
26598
+ for (i = 0; i < str1.length && i < str2.length; i++) {
26599
+ if (str1[i] != str2[i]) {
26600
+ return str1.slice(0, i);
26601
+ }
26602
+ }
26603
+ return str1.slice(0, i);
26604
+ }
26605
+ function longestCommonSuffix(str1, str2) {
26606
+ var i;
26607
+ if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
26608
+ return "";
26609
+ }
26610
+ for (i = 0; i < str1.length && i < str2.length; i++) {
26611
+ if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
26612
+ return str1.slice(-i);
26613
+ }
26614
+ }
26615
+ return str1.slice(-i);
26616
+ }
26617
+ function replacePrefix(string4, oldPrefix, newPrefix) {
26618
+ if (string4.slice(0, oldPrefix.length) != oldPrefix) {
26619
+ throw Error("string ".concat(JSON.stringify(string4), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
26620
+ }
26621
+ return newPrefix + string4.slice(oldPrefix.length);
26622
+ }
26623
+ function replaceSuffix(string4, oldSuffix, newSuffix) {
26624
+ if (!oldSuffix) {
26625
+ return string4 + newSuffix;
26626
+ }
26627
+ if (string4.slice(-oldSuffix.length) != oldSuffix) {
26628
+ throw Error("string ".concat(JSON.stringify(string4), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
26629
+ }
26630
+ return string4.slice(0, -oldSuffix.length) + newSuffix;
26631
+ }
26632
+ function removePrefix(string4, oldPrefix) {
26633
+ return replacePrefix(string4, oldPrefix, "");
26634
+ }
26635
+ function removeSuffix(string4, oldSuffix) {
26636
+ return replaceSuffix(string4, oldSuffix, "");
26637
+ }
26638
+ function maximumOverlap(string1, string22) {
26639
+ return string22.slice(0, overlapCount(string1, string22));
26640
+ }
26641
+ function overlapCount(a, b) {
26642
+ var startA = 0;
26643
+ if (a.length > b.length) {
26644
+ startA = a.length - b.length;
26645
+ }
26646
+ var endB = b.length;
26647
+ if (a.length < b.length) {
26648
+ endB = a.length;
26649
+ }
26650
+ var map = Array(endB);
26651
+ var k = 0;
26652
+ map[0] = 0;
26653
+ for (var j = 1; j < endB; j++) {
26654
+ if (b[j] == b[k]) {
26655
+ map[j] = map[k];
26656
+ } else {
26657
+ map[j] = k;
26658
+ }
26659
+ while (k > 0 && b[j] != b[k]) {
26660
+ k = map[k];
26661
+ }
26662
+ if (b[j] == b[k]) {
26663
+ k++;
26664
+ }
26665
+ }
26666
+ k = 0;
26667
+ for (var i = startA; i < a.length; i++) {
26668
+ while (k > 0 && a[i] != b[k]) {
26669
+ k = map[k];
26670
+ }
26671
+ if (a[i] == b[k]) {
26672
+ k++;
26673
+ }
26674
+ }
26675
+ return k;
26676
+ }
26677
+ var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
26678
+ var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
26679
+ var wordDiff = new Diff();
26680
+ wordDiff.equals = function(left, right, options) {
26681
+ if (options.ignoreCase) {
26682
+ left = left.toLowerCase();
26683
+ right = right.toLowerCase();
26684
+ }
26685
+ return left.trim() === right.trim();
26686
+ };
26687
+ wordDiff.tokenize = function(value) {
26688
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
26689
+ var parts;
26690
+ if (options.intlSegmenter) {
26691
+ if (options.intlSegmenter.resolvedOptions().granularity != "word") {
26692
+ throw new Error('The segmenter passed must have a granularity of "word"');
26693
+ }
26694
+ parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
26695
+ return segment.segment;
26696
+ });
26697
+ } else {
26698
+ parts = value.match(tokenizeIncludingWhitespace) || [];
26699
+ }
26700
+ var tokens = [];
26701
+ var prevPart = null;
26702
+ parts.forEach(function(part) {
26703
+ if (/\s/.test(part)) {
26704
+ if (prevPart == null) {
26705
+ tokens.push(part);
26706
+ } else {
26707
+ tokens.push(tokens.pop() + part);
26708
+ }
26709
+ } else if (/\s/.test(prevPart)) {
26710
+ if (tokens[tokens.length - 1] == prevPart) {
26711
+ tokens.push(tokens.pop() + part);
26712
+ } else {
26713
+ tokens.push(prevPart + part);
26714
+ }
26715
+ } else {
26716
+ tokens.push(part);
26717
+ }
26718
+ prevPart = part;
26719
+ });
26720
+ return tokens;
26721
+ };
26722
+ wordDiff.join = function(tokens) {
26723
+ return tokens.map(function(token, i) {
26724
+ if (i == 0) {
26725
+ return token;
26726
+ } else {
26727
+ return token.replace(/^\s+/, "");
26728
+ }
26729
+ }).join("");
26730
+ };
26731
+ wordDiff.postProcess = function(changes, options) {
26732
+ if (!changes || options.oneChangePerToken) {
26733
+ return changes;
26734
+ }
26735
+ var lastKeep = null;
26736
+ var insertion = null;
26737
+ var deletion = null;
26738
+ changes.forEach(function(change) {
26739
+ if (change.added) {
26740
+ insertion = change;
26741
+ } else if (change.removed) {
26742
+ deletion = change;
26743
+ } else {
26744
+ if (insertion || deletion) {
26745
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
26746
+ }
26747
+ lastKeep = change;
26748
+ insertion = null;
26749
+ deletion = null;
26750
+ }
26751
+ });
26752
+ if (insertion || deletion) {
26753
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
26754
+ }
26755
+ return changes;
26756
+ };
26757
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
26758
+ if (deletion && insertion) {
26759
+ var oldWsPrefix = deletion.value.match(/^\s*/)[0];
26760
+ var oldWsSuffix = deletion.value.match(/\s*$/)[0];
26761
+ var newWsPrefix = insertion.value.match(/^\s*/)[0];
26762
+ var newWsSuffix = insertion.value.match(/\s*$/)[0];
26763
+ if (startKeep) {
26764
+ var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
26765
+ startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
26766
+ deletion.value = removePrefix(deletion.value, commonWsPrefix);
26767
+ insertion.value = removePrefix(insertion.value, commonWsPrefix);
26768
+ }
26769
+ if (endKeep) {
26770
+ var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
26771
+ endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
26772
+ deletion.value = removeSuffix(deletion.value, commonWsSuffix);
26773
+ insertion.value = removeSuffix(insertion.value, commonWsSuffix);
26774
+ }
26775
+ } else if (insertion) {
26776
+ if (startKeep) {
26777
+ insertion.value = insertion.value.replace(/^\s*/, "");
26778
+ }
26779
+ if (endKeep) {
26780
+ endKeep.value = endKeep.value.replace(/^\s*/, "");
26781
+ }
26782
+ } else if (startKeep && endKeep) {
26783
+ var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
26784
+ var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
26785
+ deletion.value = removePrefix(deletion.value, newWsStart);
26786
+ var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
26787
+ deletion.value = removeSuffix(deletion.value, newWsEnd);
26788
+ endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
26789
+ startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
26790
+ } else if (endKeep) {
26791
+ var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
26792
+ var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
26793
+ var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
26794
+ deletion.value = removeSuffix(deletion.value, overlap);
26795
+ } else if (startKeep) {
26796
+ var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
26797
+ var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
26798
+ var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
26799
+ deletion.value = removePrefix(deletion.value, _overlap);
26800
+ }
26801
+ }
26802
+ var wordWithSpaceDiff = new Diff();
26803
+ wordWithSpaceDiff.tokenize = function(value) {
26804
+ var regex2 = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
26805
+ return value.match(regex2) || [];
26806
+ };
26807
+ var lineDiff = new Diff();
26808
+ lineDiff.tokenize = function(value, options) {
26809
+ if (options.stripTrailingCr) {
26810
+ value = value.replace(/\r\n/g, "\n");
26811
+ }
26812
+ var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
26813
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
26814
+ linesAndNewlines.pop();
26815
+ }
26816
+ for (var i = 0; i < linesAndNewlines.length; i++) {
26817
+ var line = linesAndNewlines[i];
26818
+ if (i % 2 && !options.newlineIsToken) {
26819
+ retLines[retLines.length - 1] += line;
26820
+ } else {
26821
+ retLines.push(line);
26822
+ }
26823
+ }
26824
+ return retLines;
26825
+ };
26826
+ lineDiff.equals = function(left, right, options) {
26827
+ if (options.ignoreWhitespace) {
26828
+ if (!options.newlineIsToken || !left.includes("\n")) {
26829
+ left = left.trim();
26830
+ }
26831
+ if (!options.newlineIsToken || !right.includes("\n")) {
26832
+ right = right.trim();
26833
+ }
26834
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
26835
+ if (left.endsWith("\n")) {
26836
+ left = left.slice(0, -1);
26837
+ }
26838
+ if (right.endsWith("\n")) {
26839
+ right = right.slice(0, -1);
26840
+ }
26841
+ }
26842
+ return Diff.prototype.equals.call(this, left, right, options);
26843
+ };
26844
+ function diffLines(oldStr, newStr, callback) {
26845
+ return lineDiff.diff(oldStr, newStr, callback);
26846
+ }
26847
+ var sentenceDiff = new Diff();
26848
+ sentenceDiff.tokenize = function(value) {
26849
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
26850
+ };
26851
+ var cssDiff = new Diff();
26852
+ cssDiff.tokenize = function(value) {
26853
+ return value.split(/([{}:;,]|\s+)/);
26854
+ };
26855
+ function _typeof2(o) {
26856
+ "@babel/helpers - typeof";
26857
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
26858
+ return typeof o2;
26859
+ } : function(o2) {
26860
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
26861
+ }, _typeof2(o);
26862
+ }
26863
+ var jsonDiff = new Diff();
26864
+ jsonDiff.useLongestToken = true;
26865
+ jsonDiff.tokenize = lineDiff.tokenize;
26866
+ jsonDiff.castInput = function(value, options) {
26867
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
26868
+ return typeof v === "undefined" ? undefinedReplacement : v;
26869
+ } : _options$stringifyRep;
26870
+ return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
26871
+ };
26872
+ jsonDiff.equals = function(left, right, options) {
26873
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
26874
+ };
26875
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
26876
+ stack = stack || [];
26877
+ replacementStack = replacementStack || [];
26878
+ if (replacer) {
26879
+ obj = replacer(key, obj);
26880
+ }
26881
+ var i;
26882
+ for (i = 0; i < stack.length; i += 1) {
26883
+ if (stack[i] === obj) {
26884
+ return replacementStack[i];
26885
+ }
26886
+ }
26887
+ var canonicalizedObj;
26888
+ if ("[object Array]" === Object.prototype.toString.call(obj)) {
26889
+ stack.push(obj);
26890
+ canonicalizedObj = new Array(obj.length);
26891
+ replacementStack.push(canonicalizedObj);
26892
+ for (i = 0; i < obj.length; i += 1) {
26893
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
26894
+ }
26895
+ stack.pop();
26896
+ replacementStack.pop();
26897
+ return canonicalizedObj;
26898
+ }
26899
+ if (obj && obj.toJSON) {
26900
+ obj = obj.toJSON();
26901
+ }
26902
+ if (_typeof2(obj) === "object" && obj !== null) {
26903
+ stack.push(obj);
26904
+ canonicalizedObj = {};
26905
+ replacementStack.push(canonicalizedObj);
26906
+ var sortedKeys = [], _key;
26907
+ for (_key in obj) {
26908
+ if (Object.prototype.hasOwnProperty.call(obj, _key)) {
26909
+ sortedKeys.push(_key);
26910
+ }
26911
+ }
26912
+ sortedKeys.sort();
26913
+ for (i = 0; i < sortedKeys.length; i += 1) {
26914
+ _key = sortedKeys[i];
26915
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
26916
+ }
26917
+ stack.pop();
26918
+ replacementStack.pop();
26919
+ } else {
26920
+ canonicalizedObj = obj;
26921
+ }
26922
+ return canonicalizedObj;
26923
+ }
26924
+ var arrayDiff = new Diff();
26925
+ arrayDiff.tokenize = function(value) {
26926
+ return value.slice();
26927
+ };
26928
+ arrayDiff.join = arrayDiff.removeEmpty = function(value) {
26929
+ return value;
26930
+ };
26931
+
26932
+ // ../next-sdk/page-tools/page-state-cache.ts
26933
+ var PageStateCache = class {
26934
+ constructor() {
26935
+ this.prev = null;
26936
+ }
26937
+ /** URL 变化或首次调用时,需要全量输出 */
26938
+ isFullRefresh(currentUrl) {
26939
+ return !this.prev || this.prev.url !== currentUrl;
26940
+ }
26941
+ /**
26942
+ * 更新缓存并返回 diff 结果
26943
+ * @param url 当前页面 URL
26944
+ * @param yaml 当前 YAML 树文本
26945
+ */
26946
+ update(url2, yaml) {
26947
+ const isFullRefresh = this.isFullRefresh(url2);
26948
+ const prevUrl = this.prev?.url ?? "";
26949
+ let addedLines = 0;
26950
+ let removedLines = 0;
26951
+ let diffText = "";
26952
+ if (!isFullRefresh && this.prev) {
26953
+ const changes = diffLines(this.prev.yaml, yaml);
26954
+ const buf = [];
26955
+ changes.forEach((part) => {
26956
+ if (!part.added && !part.removed) return;
26957
+ const lines = part.value.split("\n").filter(Boolean);
26958
+ if (part.added) {
26959
+ addedLines += lines.length;
26960
+ lines.forEach((l) => buf.push(`+ ${l}`));
26961
+ } else {
26962
+ removedLines += lines.length;
26963
+ lines.forEach((l) => buf.push(`- ${l}`));
26964
+ }
26965
+ });
26966
+ diffText = buf.join("\n");
26967
+ }
26968
+ this.prev = { url: url2, yaml };
26969
+ return { isFullRefresh, prevUrl, addedLines, removedLines, diffText };
26970
+ }
26971
+ /** 强制清空缓存(页面刷新 / 手动重置场景) */
26972
+ invalidate() {
26973
+ this.prev = null;
26974
+ }
26975
+ };
26976
+
25209
26977
  // ../next-sdk/page-tools/page-agent-tool.ts
25210
26978
  function registerPageAgentTool() {
25211
26979
  initializeBuiltinWebMCP();
25212
- const pageController = new PageController({ enableMask: true, viewportExpansion: -1 });
26980
+ window.__webmcpcli_interactiveWhitelist = [];
26981
+ window.__webmcpcli_interactiveBlacklist = [];
26982
+ window.__webmcpcli_beforeGetBrowserState = null;
26983
+ const pageController = new PageController({ enableMask: true });
26984
+ const stateCache = new PageStateCache();
26985
+ let currentRefMap = /* @__PURE__ */ new Map();
25213
26986
  const inputSchema = external_exports.object({
25214
- action: external_exports.enum(["browserState", "click", "fill", "select", "scroll", "executeJavascript"]).describe(`\u6267\u884C\u7684\u52A8\u4F5C\u540D\u79F0, \u6BCF\u4E00\u6B21\u6267\u884C 'click', 'fill', 'select'\u52A8\u4F5C\u4E4B\u524D\uFF0C**\u5FC5\u987B**\u8981\u5148\u8C03\u7528 'browserState' \u53BB\u83B7\u53D6\u9875\u9762\u7684\u6700\u65B0\u72B6\u6001\u3002
25215
- browserState: '\u67E5\u8BE2\u6574\u4E2A\u9875\u9762\u7684\u6D4F\u89C8\u5668\u72B6\u6001;\u8FD4\u56DE\u9875\u9762\u7684\u6807\u9898\u3001URL\u3001HTML\u5185\u5BB9',
26987
+ action: external_exports.enum(["browserState", "click", "fill", "select", "scroll", "executeJavascript", "searchTree"]).describe(`\u6267\u884C\u7684\u52A8\u4F5C\u540D\u79F0, \u6BCF\u4E00\u6B21\u6267\u884C 'click', 'fill', 'select'\u52A8\u4F5C\u4E4B\u524D\uFF0C**\u5FC5\u987B**\u8981\u5148\u8C03\u7528 'browserState' \u53BB\u83B7\u53D6\u9875\u9762\u7684\u6700\u65B0\u72B6\u6001\u3002
26988
+ browserState: '\u67E5\u8BE2\u6574\u4E2A\u9875\u9762\u7684\u6D4F\u89C8\u5668\u72B6\u6001;\u8FD4\u56DE\u9875\u9762\u7684\u6807\u9898\u3001URL\u3001YAML\u683C\u5F0F\u7684\u8BED\u4E49\u5316\u9875\u9762\u6811',
25216
26989
  click: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u70B9\u51FB;',
25217
26990
  fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C;';
25218
26991
  select: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u9009\u62E9\u4E0B\u62C9\u6846\u9009\u9879;';
25219
26992
  scroll: '\u6EDA\u52A8\u9875\u9762\u7684\u52A8\u4F5C\uFF0C\u53EF\u4EE5\u6307\u5B9A\u6C34\u5E73\u6EDA\u52A8\u8FD8\u662F\u4E0A\u4E0B\u6EDA\u52A8; \u4E0D\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u6574\u4E2A\u6587\u6863\u3002\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u8BE5\u7D22\u5F15\u5904\u7684\u5BB9\u5668\uFF08\u6216\u5176\u6700\u8FD1\u7684\u53EF\u6EDA\u52A8\u7956\u5148\u5143\u7D20\uFF09'
25220
26993
  executeJavascript: '\u6267\u884Cjavascript\u4EE3\u7801'
26994
+ searchTree: '\u6309\u5173\u952E\u8BCD\u641C\u7D22\u65E0\u969C\u788D\u6811\uFF0C\u8FD4\u56DE\u5E26\u884C\u53F7\u7684\u5339\u914D\u8282\u70B9\u53CA\u4E0A\u4E0B\u6587\uFF0C\u65E0\u9700\u83B7\u53D6\u5168\u91CF\u6811\u3002\u9002\u5408\u5FEB\u901F\u5B9A\u4F4D\u7279\u5B9A\u5143\u7D20\uFF08\u5982\u6240\u6709\u6309\u94AE\u3001\u7279\u5B9A\u540D\u79F0\u7684\u94FE\u63A5\u7B49\uFF09\uFF0C\u663E\u8457\u51CF\u5C11\u4E0A\u4E0B\u6587\u6D88\u8017\u3002\u5FC5\u987B\u63D0\u4F9B query \u53C2\u6570\u3002'
25221
26995
  `),
25222
- index: external_exports.number().min(0).optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u5143\u7D20\u7D22\u5F15, \u52A8\u4F5C\u4E3A click,fill,select\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u5143\u7D20\u7D22\u5F15"),
26996
+ index: external_exports.number().min(0).optional().describe("\u6267\u884C\u52A8\u4F5C of the element index, \u52A8\u4F5C\u4E3A click,fill,select\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u5143\u7D20\u7D22\u5F15"),
25223
26997
  text: external_exports.string().optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u6587\u672C\u5185\u5BB9, \u52A8\u4F5C\u4E3A fill,select \u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u6587\u672C\u5185\u5BB9"),
25224
26998
  down: external_exports.boolean().optional().describe("\u6267\u884C\u4E0A\u4E0B\u6EDA\u52A8\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9Bdown\u53C2\u6570"),
25225
26999
  right: external_exports.boolean().optional().describe("\u6267\u884C\u6C34\u5E73\u6EDA\u52A8\u65B9\u5411, \u5FC5\u987B\u63D0\u4F9Bright\u53C2\u6570"),
25226
27000
  numPages: external_exports.number().optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u6EDA\u52A8\u9875\u6570, \u52A8\u4F5C\u4E3A scroll\u65F6\uFF0C\u53EF\u4EE5\u63D0\u4F9B\u6EDA\u52A8\u9875\u6570\uFF0C\u5EFA\u8BAE\u6BCF\u6B21\u6EDA\u52A80.1\u9875\uFF0C\u8BE5\u503C\u4E0D\u8981\u5927\u4E8E5."),
25227
27001
  pixels: external_exports.number().int().min(0).optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u6EDA\u52A8\u50CF\u7D20\u6570\uFF0C\u52A8\u4F5C\u4E3A scroll\u65F6\uFF0C\u53EF\u4EE5\u63D0\u4F9B\u6EDA\u52A8\u50CF\u7D20\u6570"),
25228
- script: external_exports.string().optional().describe("\u6267\u884C\u7684javascript\u4EE3\u7801\uFF0C\u52A8\u4F5C\u4E3A executeJavascript\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9Bscript\u53C2\u6570")
27002
+ script: external_exports.string().optional().describe("\u6267\u884C\u7684javascript\u4EE3\u7801\uFF0C\u52A8\u4F5C\u4E3A executeJavascript\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9Bscript\u53C2\u6570"),
27003
+ query: external_exports.string().optional().describe("\u641C\u7D22\u5173\u952E\u8BCD\uFF0C\u52A8\u4F5C\u4E3A searchTree \u65F6\u5FC5\u987B\u63D0\u4F9B\u3002\u652F\u6301\u6309 role\uFF08\u5982 button\u3001link\uFF09\u3001\u8282\u70B9\u540D\u79F0\u3001\u72B6\u6001\uFF08\u5982 checked\uFF09\u6216 ref \u7D22\u5F15\uFF08\u5982 #3\uFF09\u641C\u7D22"),
27004
+ contextLines: external_exports.number().int().min(0).max(10).default(2).describe("searchTree \u65F6\u6BCF\u4E2A\u547D\u4E2D\u884C\u524D\u540E\u4FDD\u7559\u7684\u4E0A\u4E0B\u6587\u884C\u6570\uFF0C\u9ED8\u8BA4 2"),
27005
+ maxMatches: external_exports.number().int().min(1).max(50).default(20).describe("searchTree \u65F6\u6700\u5927\u8FD4\u56DE\u5206\u7EC4\u6570\uFF0C\u9ED8\u8BA4 20"),
27006
+ responseMode: external_exports.enum(["full", "diff", "both"]).optional().default("diff").describe("\u8FD4\u56DE\u6D4F\u89C8\u5668\u72B6\u6001\u7684\u6A21\u5F0F\u3002full: \u4EC5\u8FD4\u56DE\u5F53\u524D\u5168\u91CF A11y \u6811\uFF1Bdiff: \u4EC5\u8FD4\u56DE\u4E0E\u4E0A\u4E00\u6B21\u72B6\u6001\u7684\u589E\u91CF\u5DEE\u5F02\uFF1Bboth: \u540C\u65F6\u8FD4\u56DE\u5168\u91CF A11y \u6811\u4E0E\u589E\u91CF\u5DEE\u5F02\u3002\u9ED8\u8BA4\u503C\u4E3A diff\u3002")
25229
27007
  });
25230
- async function buildContent(msg, ret) {
27008
+ async function errContent(msg) {
25231
27009
  await pageController.hideMask();
25232
- await pageController.cleanUpHighlights();
25233
- return {
25234
- content: [{ type: "text", text: `${msg} ${JSON.stringify(ret)}` }]
27010
+ return { content: [{ type: "text", text: msg }] };
27011
+ }
27012
+ async function buildBrowserStateResponse(responseMode = "diff") {
27013
+ const url2 = window.location.href;
27014
+ const title = document.title;
27015
+ const blacklist = window.__webmcpcli_interactiveBlacklist ?? [];
27016
+ const whitelist = window.__webmcpcli_interactiveWhitelist ?? [];
27017
+ const { yaml, refMap } = buildA11yTree(document.body, blacklist, whitelist);
27018
+ currentRefMap = refMap;
27019
+ const diff2 = stateCache.update(url2, yaml);
27020
+ await pageController.hideMask();
27021
+ let displayContent = "";
27022
+ if (responseMode === "full") {
27023
+ displayContent = yaml;
27024
+ } else if (responseMode === "diff") {
27025
+ displayContent = diff2.isFullRefresh ? yaml : diff2.diffText;
27026
+ } else if (responseMode === "both") {
27027
+ displayContent = `\u3010\u5168\u91CF\u9875\u9762\u6811\u3011:
27028
+ ${yaml}
27029
+
27030
+ \u3010\u589E\u91CF\u5DEE\u5F02\u3011:
27031
+ ${diff2.isFullRefresh ? "\uFF08\u9996\u6B21/\u5237\u65B0\uFF0C\u65E0\u589E\u91CF\u5DEE\u5F02\uFF09" : diff2.diffText}`;
27032
+ }
27033
+ const stateObj = {
27034
+ url: url2,
27035
+ title,
27036
+ content: displayContent
25235
27037
  };
27038
+ const text = `\u6D4F\u89C8\u5668\u72B6\u6001: ${JSON.stringify(stateObj)}`;
27039
+ return { content: [{ type: "text", text }] };
25236
27040
  }
25237
27041
  navigator.modelContext.registerTool({
25238
27042
  name: "page-agent-tool",
@@ -25241,39 +27045,86 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
25241
27045
  inputSchema: zodToJsonSchema(inputSchema),
25242
27046
  async execute(args) {
25243
27047
  await pageController.showMask();
27048
+ const mode = args.responseMode ?? "diff";
25244
27049
  try {
25245
27050
  if (args.action === "browserState") {
25246
- const result2 = await pageController.getBrowserState();
25247
- return buildContent("\u6D4F\u89C8\u5668\u72B6\u6001:", result2);
27051
+ if (window.__webmcpcli_beforeGetBrowserState) {
27052
+ window.__webmcpcli_beforeGetBrowserState();
27053
+ }
27054
+ return buildBrowserStateResponse(mode);
25248
27055
  } else if (args.action === "click") {
25249
- if (args.index === void 0) return buildContent("\u70B9\u51FB\u7ED3\u679C:", "\u7F3A\u5C11\u5143\u7D20\u7D22\u5F15");
25250
- const result2 = await pageController.clickElement(args.index);
25251
- return buildContent("\u70B9\u51FB\u7ED3\u679C:", result2);
27056
+ if (args.index === void 0) return errContent("\u70B9\u51FB\u7ED3\u679C: \u7F3A\u5C11\u5143\u7D20\u7D22\u5F15");
27057
+ const el = currentRefMap.get(args.index);
27058
+ if (!el) return errContent(`\u70B9\u51FB\u7ED3\u679C: \u65E0\u6548\u7684 ref \u7D22\u5F15 ${args.index}\uFF0C\u8BF7\u5148\u8C03\u7528 browserState \u5237\u65B0\u9875\u9762\u72B6\u6001`);
27059
+ await clickElement(el);
27060
+ return buildBrowserStateResponse(mode);
25252
27061
  } else if (args.action === "fill") {
25253
- if (args.index === void 0 || !args.text) return buildContent("\u586B\u5199\u7ED3\u679C:", "\u7F3A\u5C11\u5143\u7D20\u7D22\u5F15\u6216\u6587\u672C\u5185\u5BB9");
25254
- const result2 = await pageController.inputText(args.index, args.text);
25255
- return buildContent("\u586B\u5199\u7ED3\u679C:", result2);
27062
+ if (args.index === void 0 || !args.text) return errContent("\u586B\u5199\u7ED3\u679C: \u7F3A\u5C11\u5143\u7D20\u7D22\u5F15\u6216\u6587\u672C\u5185\u5BB9");
27063
+ const el = currentRefMap.get(args.index);
27064
+ if (!el) return errContent(`\u586B\u5199\u7ED3\u679C: \u65E0\u6548\u7684 ref \u7D22\u5F15 ${args.index}\uFF0C\u8BF7\u5148\u8C03\u7528 browserState \u5237\u65B0\u9875\u9762\u72B6\u6001`);
27065
+ let targetEl = el;
27066
+ if (!(targetEl instanceof HTMLInputElement) && !(targetEl instanceof HTMLTextAreaElement)) {
27067
+ const innerInput = el.querySelector("input, textarea");
27068
+ if (innerInput) {
27069
+ targetEl = innerInput;
27070
+ }
27071
+ }
27072
+ if (targetEl instanceof HTMLInputElement && targetEl.readOnly) {
27073
+ targetEl.value = args.text;
27074
+ targetEl.dispatchEvent(new Event("input", { bubbles: true }));
27075
+ targetEl.dispatchEvent(new Event("change", { bubbles: true }));
27076
+ targetEl.dispatchEvent(new Event("blur", { bubbles: true }));
27077
+ } else {
27078
+ await inputTextElement(targetEl, args.text);
27079
+ }
27080
+ return buildBrowserStateResponse(mode);
25256
27081
  } else if (args.action === "select") {
25257
- if (args.index === void 0 || !args.text) return buildContent("\u9009\u62E9\u7ED3\u679C:", "\u7F3A\u5C11\u5143\u7D20\u7D22\u5F15\u6216\u6587\u672C\u5185\u5BB9");
25258
- const result2 = await pageController.selectOption(args.index, args.text);
25259
- return buildContent("\u9009\u62E9\u7ED3\u679C:", result2);
27082
+ if (args.index === void 0 || !args.text) return errContent("\u9009\u62E9\u7ED3\u679C: \u7F3A\u5C11\u5143\u7D20\u7D22\u5F15\u6216\u6587\u672C\u5185\u5BB9");
27083
+ const el = currentRefMap.get(args.index);
27084
+ if (!el) return errContent(`\u9009\u62E9\u7ED3\u679C: \u65E0\u6548\u7684 ref \u7D22\u5F15 ${args.index}\uFF0C\u8BF7\u5148\u8C03\u7528 browserState \u5237\u65B0\u9875\u9762\u72B6\u6001`);
27085
+ await selectOptionElement(el, args.text);
27086
+ return buildBrowserStateResponse(mode);
25260
27087
  } else if (args.action === "scroll") {
25261
- if (!args.down && !args.right) return buildContent("\u6EDA\u52A8\u7ED3\u679C:", "\u7F3A\u5C11\u6EDA\u52A8\u65B9\u5411\u53C2\u6570");
25262
- const input = Object.assign({}, args);
25263
- delete input.action;
27088
+ if (!args.down && !args.right) return errContent("\u6EDA\u52A8\u7ED3\u679C: \u7F3A\u5C11\u6EDA\u52A8\u65B9\u5411\u53C2\u6570");
27089
+ const scrollTarget = args.index !== void 0 ? currentRefMap.get(args.index) ?? window : window;
25264
27090
  if (args.right) {
25265
- delete input.down;
25266
- delete input.numPages;
27091
+ const pixels = args.pixels ?? 300;
27092
+ scrollTarget.scrollBy({ left: args.right ? pixels : -pixels, behavior: "smooth" });
27093
+ } else {
27094
+ const pixels = args.pixels ?? Math.round((args.numPages ?? 1) * window.innerHeight);
27095
+ scrollTarget.scrollBy({ top: args.down ? pixels : -pixels, behavior: "smooth" });
25267
27096
  }
25268
- const result2 = args.right ? await pageController.scrollHorizontally(input) : await pageController.scroll(input);
25269
- return buildContent("\u6EDA\u52A8\u7ED3\u679C:", result2);
27097
+ await new Promise((r) => setTimeout(r, 400));
27098
+ return buildBrowserStateResponse(mode);
25270
27099
  } else if (args.action === "executeJavascript") {
25271
- if (!args.script) return buildContent("\u811A\u672C\u6267\u884C\u5F02\u5E38:", "\u7F3A\u5C11javascript\u4EE3\u7801");
25272
- const result2 = await pageController.executeJavascript(args.script);
25273
- return buildContent("\u811A\u672C\u6267\u884C\u7ED3\u679C:", result2);
27100
+ if (!args.script) return errContent("\u811A\u672C\u6267\u884C\u5F02\u5E38: \u7F3A\u5C11javascript\u4EE3\u7801");
27101
+ const result2 = await new Function(`return (async () => { ${args.script} })()`)();
27102
+ await pageController.hideMask();
27103
+ return {
27104
+ content: [{ type: "text", text: `\u811A\u672C\u6267\u884C\u7ED3\u679C: ${JSON.stringify(result2)}` }]
27105
+ };
27106
+ } else if (args.action === "searchTree") {
27107
+ if (!args.query) return errContent("\u641C\u7D22\u5931\u8D25: \u7F3A\u5C11 query \u53C2\u6570");
27108
+ const blacklist = window.__webmcpcli_interactiveBlacklist ?? [];
27109
+ const whitelist = window.__webmcpcli_interactiveWhitelist ?? [];
27110
+ const { text } = searchA11yTree(
27111
+ args.query,
27112
+ document.body,
27113
+ blacklist,
27114
+ whitelist,
27115
+ {
27116
+ contextLines: args.contextLines,
27117
+ maxMatches: args.maxMatches
27118
+ }
27119
+ );
27120
+ await pageController.hideMask();
27121
+ return {
27122
+ content: [{ type: "text", text }]
27123
+ };
25274
27124
  }
25275
27125
  } catch (error2) {
25276
- return buildContent("\u5F02\u5E38:", error2);
27126
+ await pageController.hideMask();
27127
+ return { content: [{ type: "text", text: `\u5F02\u5E38: ${String(error2)}` }] };
25277
27128
  }
25278
27129
  }
25279
27130
  });
@@ -25314,5 +27165,11 @@ ai-motion/build/Motion.js:
25314
27165
  * @license MIT
25315
27166
  * @repository https://github.com/gaomeng1900/ai-motion
25316
27167
  *)
27168
+
27169
+ tabbable/dist/index.esm.js:
27170
+ (*!
27171
+ * tabbable 6.5.0
27172
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
27173
+ *)
25317
27174
  */
25318
27175
  })();