@weapp-vite/miniprogram-automator 1.5.5-dev.20261117.1 → 1.5.5

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.
@@ -1318,6 +1318,36 @@ function resolveEventBindingPhases(attributes, eventName, includeCapture = true)
1318
1318
  }
1319
1319
  return bindings;
1320
1320
  }
1321
+ // ../../mpcore/packages/simulator/src/view/nativeBoolean.ts
1322
+ const nativeBooleanValues = /* @__PURE__ */ new WeakMap();
1323
+ /** 保留原始布尔属性值,避免 null/undefined 在属性序列化后退化为裸属性。 */
1324
+ function setNativeBooleanValue(node, name, value, valueless = false) {
1325
+ if (name !== "checked" && name !== "disabled") return;
1326
+ let values = nativeBooleanValues.get(node);
1327
+ if (!values) {
1328
+ values = /* @__PURE__ */ new Map();
1329
+ nativeBooleanValues.set(node, values);
1330
+ }
1331
+ values.set(name, {
1332
+ value,
1333
+ valueless
1334
+ });
1335
+ }
1336
+ function getNativeBooleanValue(node, name) {
1337
+ const attributes = node.attribs;
1338
+ if (!attributes || !Object.hasOwn(attributes, name)) return false;
1339
+ const snapshot = node.nativeBooleanValues;
1340
+ const stored = nativeBooleanValues.get(node)?.get(name) ?? snapshot?.get(name);
1341
+ if (stored) {
1342
+ if (stored.valueless) return true;
1343
+ return stored.value !== void 0 && stored.value !== null && stored.value !== false && stored.value !== 0 && stored.value !== "" && stored.value !== "false" && stored.value !== "0";
1344
+ }
1345
+ const value = attributes[name];
1346
+ return value !== "false" && value !== "0";
1347
+ }
1348
+ function getNativeBooleanSnapshot(node) {
1349
+ return nativeBooleanValues.get(node);
1350
+ }
1321
1351
  // ../../mpcore/packages/simulator/src/view/nodeDataset.ts
1322
1352
  const DATASET_NAME_RE = /-([a-z])/g;
1323
1353
  function isDatasetAttribute(attributeName) {
@@ -1378,7 +1408,8 @@ function mergeComponentEventRoot(root, host) {
1378
1408
  const entry = eventNodes.get(root);
1379
1409
  if (entry.target === root) entry.target = {
1380
1410
  attribs: root.attribs,
1381
- dataset: root.dataset
1411
+ dataset: root.dataset,
1412
+ nativeBooleanValues: getNativeBooleanSnapshot(root)
1382
1413
  };
1383
1414
  entry.hosts ??= [];
1384
1415
  entry.hosts.push(host);
@@ -13996,15 +14027,15 @@ const NUMERIC_CONSUMED_SHIFT = 21;
13996
14027
  const NUMERIC_CODE_POINT_MASK = 2097151;
13997
14028
  const NUMERIC_CONSUMED_OVERFLOW = 2047;
13998
14029
  /** Full length, including `&`, when the packed consumed field overflows. */
13999
- let longNumericConsumed = 0;
14030
+ let longNumericConsumed$1 = 0;
14000
14031
  /**
14001
14032
  * Recover the consumed count before the next numeric parse can overwrite
14002
14033
  * `longNumericConsumed`. This avoids allocating a tuple for each reference.
14003
14034
  * @param packed Packed result of `parseNumericEntity`.
14004
14035
  */
14005
- function unpackConsumed(packed) {
14036
+ function unpackConsumed$1(packed) {
14006
14037
  const consumed = packed >>> NUMERIC_CONSUMED_SHIFT;
14007
- return consumed === NUMERIC_CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
14038
+ return consumed === NUMERIC_CONSUMED_OVERFLOW ? longNumericConsumed$1 : consumed;
14008
14039
  }
14009
14040
  /** ASCII digit values; 0xff marks characters outside the hexadecimal range. */
14010
14041
  const numericDigits = /* #__PURE__ */ (() => {
@@ -14026,7 +14057,7 @@ const numericDigits = /* #__PURE__ */ (() => {
14026
14057
  * @param offset Index right after the `#`.
14027
14058
  * @param isStrict Whether a terminating semicolon is required.
14028
14059
  */
14029
- function parseNumericEntity(input, offset, isStrict) {
14060
+ function parseNumericEntity$1(input, offset, isStrict) {
14030
14061
  const inputLength = input.length;
14031
14062
  let index = offset;
14032
14063
  let codePoint = 0;
@@ -14061,7 +14092,7 @@ function parseNumericEntity(input, offset, isStrict) {
14061
14092
  if (index < inputLength && input.charCodeAt(index) === CHAR_SEMI) consumed += 1;
14062
14093
  else if (isStrict) return 0;
14063
14094
  if (consumed >= NUMERIC_CONSUMED_OVERFLOW) {
14064
- longNumericConsumed = consumed;
14095
+ longNumericConsumed$1 = consumed;
14065
14096
  consumed = NUMERIC_CONSUMED_OVERFLOW;
14066
14097
  }
14067
14098
  return consumed << NUMERIC_CONSUMED_SHIFT | codePoint;
@@ -14084,8 +14115,8 @@ function decodeXML(xmlString) {
14084
14115
  let value = "";
14085
14116
  const c1 = xmlString.charCodeAt(start);
14086
14117
  if (c1 === CHAR_NUM) {
14087
- const packed = parseNumericEntity(xmlString, start + 1, true);
14088
- consumed = unpackConsumed(packed);
14118
+ const packed = parseNumericEntity$1(xmlString, start + 1, true);
14119
+ consumed = unpackConsumed$1(packed);
14089
14120
  if (consumed !== 0) {
14090
14121
  const codePoint = packed & NUMERIC_CODE_POINT_MASK;
14091
14122
  value = codePoint - 1 >>> 0 < 55295 ? String.fromCharCode(codePoint) : String.fromCodePoint(replaceCodePointXML$1(codePoint));
@@ -16094,6 +16125,52 @@ function getNativeBindingCommit(node, previous) {
16094
16125
  }
16095
16126
  };
16096
16127
  }
16128
+ // ../../mpcore/packages/simulator/src/testing/sessionHandle/shared.ts
16129
+ const LEADING_SLASH_RE$4 = /^\/+/;
16130
+ const DEFAULT_WAIT_TIMEOUT$1 = 1e3;
16131
+ const DEFAULT_WAIT_INTERVAL$1 = 10;
16132
+ function normalizeRoute(route) {
16133
+ return route.replace(LEADING_SLASH_RE$4, "");
16134
+ }
16135
+ function resolvePageScopeId$1(scopeId) {
16136
+ const pagePathIndex = scopeId.indexOf("/page/");
16137
+ return pagePathIndex >= 0 ? scopeId.slice(0, pagePathIndex) : scopeId;
16138
+ }
16139
+ function normalizeNonEmptyInput(value, label) {
16140
+ const normalizedValue = value.trim();
16141
+ if (!normalizedValue) throw new Error(`${label} must be a non-empty string in headless testing runtime.`);
16142
+ return normalizedValue;
16143
+ }
16144
+ function cloneProtocolValue(value) {
16145
+ if (!value || typeof value !== "object") return value;
16146
+ return JSON.parse(JSON.stringify(value));
16147
+ }
16148
+ async function waitForDelay(ms = 0) {
16149
+ if (ms <= 0) return;
16150
+ await new Promise((resolve) => setTimeout(resolve, ms));
16151
+ }
16152
+ async function pollUntil$2(check, errorMessage, options = {}) {
16153
+ const timeout = Number.isFinite(options.timeout) ? Math.max(0, Math.trunc(options.timeout ?? DEFAULT_WAIT_TIMEOUT$1)) : DEFAULT_WAIT_TIMEOUT$1;
16154
+ const interval = Number.isFinite(options.interval) ? Math.max(1, Math.trunc(options.interval ?? DEFAULT_WAIT_INTERVAL$1)) : DEFAULT_WAIT_INTERVAL$1;
16155
+ const deadline = Date.now() + timeout;
16156
+ while (true) {
16157
+ const result = await check();
16158
+ if (result != null) return result;
16159
+ if (Date.now() >= deadline) throw new Error(errorMessage);
16160
+ await waitForDelay(interval);
16161
+ }
16162
+ }
16163
+ async function runWithTimeout(operation, timeout, message) {
16164
+ if (!Number.isFinite(timeout) || (timeout ?? 0) <= 0) return await operation();
16165
+ let timer;
16166
+ try {
16167
+ return await Promise.race([Promise.resolve().then(operation), new Promise((_resolve, reject) => {
16168
+ timer = setTimeout(() => reject(new Error(message)), Math.trunc(timeout));
16169
+ })]);
16170
+ } finally {
16171
+ if (timer) clearTimeout(timer);
16172
+ }
16173
+ }
16097
16174
  // ../../mpcore/packages/simulator/src/view/nodeEvents.ts
16098
16175
  /** 正确字段优先;复制触点,避免处理器修改调用者持有的数据。 */
16099
16176
  function readTouchEventPayload(event) {
@@ -16168,9 +16245,33 @@ function participates(scopeId, formScopes, behavior, resolveComponent) {
16168
16245
  }
16169
16246
  return true;
16170
16247
  }
16171
- function checked(attributes, name) {
16172
- const value = attributes?.[name];
16173
- return value !== void 0 && value !== "false" && value !== "0";
16248
+ function participatesFormField(scopeId, formScopes, resolveComponent) {
16249
+ const visited = /* @__PURE__ */ new Set();
16250
+ while (!formScopes.has(scopeId)) {
16251
+ if (!scopeId || visited.has(scopeId)) return false;
16252
+ visited.add(scopeId);
16253
+ const component = resolveComponent?.(scopeId);
16254
+ if (!component || !includesBehavior(component.definition, "wx://form-field") && !includesBehavior(component.definition, "wx://form-field-group")) return false;
16255
+ scopeId = component.ownerScopeId;
16256
+ }
16257
+ return true;
16258
+ }
16259
+ function resolveFormFieldComponent(scopeId, resolveComponent) {
16260
+ const visited = /* @__PURE__ */ new Set();
16261
+ let current = scopeId;
16262
+ while (current && !visited.has(current)) {
16263
+ visited.add(current);
16264
+ const component = resolveComponent?.(current);
16265
+ if (!component) return;
16266
+ if (includesBehavior(component.definition, "wx://form-field")) return {
16267
+ scopeId: current,
16268
+ component
16269
+ };
16270
+ current = component.ownerScopeId;
16271
+ }
16272
+ }
16273
+ function checked(node, name) {
16274
+ return getNativeBooleanValue(node, name);
16174
16275
  }
16175
16276
  function choiceValues(group, pageScope, resolveComponent) {
16176
16277
  const values = [];
@@ -16180,7 +16281,7 @@ function choiceValues(group, pageScope, resolveComponent) {
16180
16281
  if (node.name === "form" || node.name === "radio-group" || node.name === "checkbox-group") return;
16181
16282
  if (node.name === choice) {
16182
16283
  const owner = nativeOwner(node);
16183
- if (checked(owner.target.attribs, "checked") && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) values.push(owner.target.attribs?.value ?? "");
16284
+ if (checked(owner.target, "checked") && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) values.push(owner.target.attribs?.value ?? "");
16184
16285
  }
16185
16286
  for (const child of node.children ?? []) visit(child);
16186
16287
  };
@@ -16193,6 +16294,12 @@ function collectFormValues(form, scopes, pageScope, resolveComponent) {
16193
16294
  if (node.name === "form") return;
16194
16295
  const owner = nativeOwner(node);
16195
16296
  const attributes = owner.target.attribs;
16297
+ const field = resolveFormFieldComponent(owner.scopeId, resolveComponent);
16298
+ const componentName = field?.component.name;
16299
+ if (typeof componentName === "string" && componentName && node.attribs?.["data-sim-component"] && field && participatesFormField(field.scopeId, scopes, resolveComponent)) {
16300
+ values[componentName] = cloneProtocolValue(field.component.value);
16301
+ return;
16302
+ }
16196
16303
  const name = attributes?.name;
16197
16304
  if (attributes && name && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) switch (node.name) {
16198
16305
  case "input":
@@ -16200,7 +16307,7 @@ function collectFormValues(form, scopes, pageScope, resolveComponent) {
16200
16307
  values[name] = attributes.value ?? "";
16201
16308
  break;
16202
16309
  case "switch":
16203
- values[name] = checked(attributes, "checked");
16310
+ values[name] = checked(owner.target, "checked");
16204
16311
  break;
16205
16312
  case "slider":
16206
16313
  values[name] = Number(attributes.value ?? 0);
@@ -16226,7 +16333,7 @@ function collectFormValues(form, scopes, pageScope, resolveComponent) {
16226
16333
  /** 先固定提交目标、字段值和方法所有者,再允许 tap 回调改变组件树。 */
16227
16334
  function prepareNativeFormSubmit(button, pageScope, event, resolveMethod, resolveComponent) {
16228
16335
  const owner = nativeOwner(button);
16229
- if (owner.target.attribs?.["form-type"] !== "submit" || checked(owner.target.attribs, "disabled")) return;
16336
+ if (owner.target.attribs?.["form-type"] !== "submit" || checked(owner.target, "disabled")) return;
16230
16337
  let form = button.parent;
16231
16338
  while (form && form.name !== "form") form = form.parent;
16232
16339
  if (!form) return;
@@ -16242,6 +16349,145 @@ function prepareNativeFormSubmit(button, pageScope, event, resolveMethod, resolv
16242
16349
  })
16243
16350
  };
16244
16351
  }
16352
+ // ../../@weapp-core/shared/dist/rich-text-shared.js
16353
+ const ALLOWED_TAGS = /* @__PURE__ */ new Set([
16354
+ "a",
16355
+ "abbr",
16356
+ "address",
16357
+ "article",
16358
+ "aside",
16359
+ "b",
16360
+ "bdi",
16361
+ "bdo",
16362
+ "big",
16363
+ "blockquote",
16364
+ "br",
16365
+ "caption",
16366
+ "center",
16367
+ "cite",
16368
+ "code",
16369
+ "col",
16370
+ "colgroup",
16371
+ "dd",
16372
+ "del",
16373
+ "div",
16374
+ "dl",
16375
+ "dt",
16376
+ "em",
16377
+ "fieldset",
16378
+ "font",
16379
+ "h1",
16380
+ "h2",
16381
+ "h3",
16382
+ "h4",
16383
+ "h5",
16384
+ "h6",
16385
+ "header",
16386
+ "hr",
16387
+ "i",
16388
+ "img",
16389
+ "ins",
16390
+ "label",
16391
+ "legend",
16392
+ "li",
16393
+ "mark",
16394
+ "ol",
16395
+ "p",
16396
+ "pre",
16397
+ "q",
16398
+ "rt",
16399
+ "ruby",
16400
+ "s",
16401
+ "section",
16402
+ "small",
16403
+ "span",
16404
+ "strong",
16405
+ "sub",
16406
+ "sup",
16407
+ "table",
16408
+ "tbody",
16409
+ "td",
16410
+ "tfoot",
16411
+ "th",
16412
+ "thead",
16413
+ "tr",
16414
+ "tt",
16415
+ "u",
16416
+ "ul"
16417
+ ]);
16418
+ const ALLOWED_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
16419
+ "background",
16420
+ "background-color",
16421
+ "border",
16422
+ "border-bottom",
16423
+ "border-color",
16424
+ "border-left",
16425
+ "border-radius",
16426
+ "border-right",
16427
+ "border-style",
16428
+ "border-top",
16429
+ "border-width",
16430
+ "color",
16431
+ "display",
16432
+ "font-family",
16433
+ "font-size",
16434
+ "font-style",
16435
+ "font-weight",
16436
+ "height",
16437
+ "letter-spacing",
16438
+ "line-height",
16439
+ "margin",
16440
+ "margin-bottom",
16441
+ "margin-left",
16442
+ "margin-right",
16443
+ "margin-top",
16444
+ "max-height",
16445
+ "max-width",
16446
+ "min-height",
16447
+ "min-width",
16448
+ "opacity",
16449
+ "overflow",
16450
+ "padding",
16451
+ "padding-bottom",
16452
+ "padding-left",
16453
+ "padding-right",
16454
+ "padding-top",
16455
+ "text-align",
16456
+ "text-decoration",
16457
+ "text-indent",
16458
+ "text-overflow",
16459
+ "text-transform",
16460
+ "vertical-align",
16461
+ "white-space",
16462
+ "width",
16463
+ "word-break",
16464
+ "word-wrap"
16465
+ ]);
16466
+ function isRecord(value) {
16467
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
16468
+ }
16469
+ function isSafeUrl(value, attribute) {
16470
+ const normalized = Array.from(value).filter((character) => character.charCodeAt(0) > 32).join("").toLowerCase();
16471
+ if (!normalized || normalized.startsWith("#") || normalized.startsWith("/") || normalized.startsWith("./") || normalized.startsWith("../")) return true;
16472
+ if (/^(?:https?:|mailto:|tel:)/.test(normalized)) return true;
16473
+ return attribute === "src" && /^data:image\/(?:gif|jpe?g|png|webp);base64,/.test(normalized);
16474
+ }
16475
+ function isSafeStyleValue(value) {
16476
+ const normalized = value.toLowerCase().replace(/\s+/g, "");
16477
+ return !normalized.includes("url(") && !normalized.includes("expression(") && !normalized.includes("javascript:") && !normalized.includes("behavior:") && !normalized.includes("-moz-binding");
16478
+ }
16479
+ function sanitizeRichTextStyle(value) {
16480
+ const source = isRecord(value) ? Object.entries(value).map(([property, propertyValue]) => `${property}:${String(propertyValue)}`).join(";") : String(value ?? "");
16481
+ const declarations = [];
16482
+ for (const declaration of source.split(";")) {
16483
+ const separator = declaration.indexOf(":");
16484
+ if (separator <= 0) continue;
16485
+ const property = declaration.slice(0, separator).trim().toLowerCase();
16486
+ const propertyValue = declaration.slice(separator + 1).trim();
16487
+ if (ALLOWED_STYLE_PROPERTIES.has(property) && propertyValue && isSafeStyleValue(propertyValue)) declarations.push(`${property}: ${propertyValue}`);
16488
+ }
16489
+ return declarations.join("; ");
16490
+ }
16245
16491
  // ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js
16246
16492
  /**
16247
16493
  * C1 Unicode control character reference replacements (code points 128–159).
@@ -16310,6 +16556,19 @@ function replaceCodePoint(codePoint) {
16310
16556
  function replaceCodePointXML(codePoint) {
16311
16557
  return isInvalidCodePoint(codePoint) ? 65533 : codePoint;
16312
16558
  }
16559
+ /**
16560
+ * Convert the code point of a decoded numeric entity to a string, replacing
16561
+ * invalid values.
16562
+ *
16563
+ * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass
16564
+ * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range
16565
+ * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)
16566
+ * - 0xA0.
16567
+ * @param codePoint Unicode code point to convert.
16568
+ */
16569
+ function codePointToString(codePoint) {
16570
+ return codePoint - 1 >>> 0 < 127 || codePoint - 160 >>> 0 < 55136 ? String.fromCharCode(codePoint) : String.fromCodePoint(replaceCodePoint(codePoint));
16571
+ }
16313
16572
  // ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/decode-shared.js
16314
16573
  const BASE91_INVERSE = /* #__PURE__ */ (() => {
16315
16574
  const table = /* @__PURE__ */ new Uint8Array(127);
@@ -16546,6 +16805,31 @@ var CharCodes$1;
16546
16805
  })(CharCodes$1 || (CharCodes$1 = {}));
16547
16806
  /** Bit that needs to be set to convert an upper case ASCII character to lower case */
16548
16807
  const TO_LOWER_BIT = 32;
16808
+ const CONSUMED_SHIFT = 21;
16809
+ const CODE_POINT_MASK = 2097151;
16810
+ /**
16811
+ * Reserved consumed field for counts of at least 2047 characters after `&`.
16812
+ * The true count is in `longNumericConsumed`.
16813
+ */
16814
+ const CONSUMED_OVERFLOW = 2047;
16815
+ /**
16816
+ * Side channel for numeric entities of at least 2048 characters including
16817
+ * `&`. Set by `parseNumericEntity` when its consumed count reaches the
16818
+ * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.
16819
+ * A module-level slot avoids a tuple allocation on the hot path.
16820
+ */
16821
+ let longNumericConsumed = 0;
16822
+ /**
16823
+ * Extract the consumed count from a `parseNumericEntity` packed result,
16824
+ * recovering the true length from `longNumericConsumed` when the packed
16825
+ * field contains the sentinel. Read it before the next `parseNumericEntity`
16826
+ * call, which may overwrite the side channel. This helper owns that protocol.
16827
+ * @param packed Packed result of `parseNumericEntity`.
16828
+ */
16829
+ function unpackConsumed(packed) {
16830
+ const consumed = packed >>> CONSUMED_SHIFT;
16831
+ return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
16832
+ }
16549
16833
  /**
16550
16834
  * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large
16551
16835
  * values, so a single `<=` covers the entire [lo..hi] range check.
@@ -16958,6 +17242,202 @@ function determineBranch(decodeTree, current, nodeIndex, char) {
16958
17242
  }
16959
17243
  return -1;
16960
17244
  }
17245
+ /**
17246
+ * Read the decoded value from a trie node.
17247
+ * @param decodeTree The trie.
17248
+ * @param nodeIndex The index of the node.
17249
+ * @param valueLength The length of the value (1, 2, or 3).
17250
+ * @returns The decoded string.
17251
+ */
17252
+ function readTrieValue(decodeTree, nodeIndex, valueLength) {
17253
+ if (valueLength === 1) return String.fromCharCode(decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK);
17254
+ if (valueLength === 2) return String.fromCharCode(decodeTree[nodeIndex + 1]);
17255
+ return String.fromCharCode(decodeTree[nodeIndex + 1], decodeTree[nodeIndex + 2]);
17256
+ }
17257
+ /**
17258
+ * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).
17259
+ *
17260
+ * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see
17261
+ * the packing comment at the top of the file; overlong entities spill
17262
+ * their length into `longNumericConsumed`). Returns 0 when no digits were
17263
+ * found.
17264
+ *
17265
+ * This is the sync counterpart of the streaming
17266
+ * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing
17267
+ * matches those methods; only this packed result needs a value clamp.
17268
+ * @param input The input string.
17269
+ * @param numberStart Index of the `#` character.
17270
+ * @param inputLength Cached `input.length`.
17271
+ */
17272
+ function parseNumericEntity(input, numberStart, inputLength) {
17273
+ let offset = numberStart + 1;
17274
+ let cp = 0;
17275
+ let digitStart = offset;
17276
+ if (offset < inputLength && (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes$1.LOWER_X) {
17277
+ offset += 1;
17278
+ digitStart = offset;
17279
+ while (offset < inputLength) {
17280
+ const char = input.charCodeAt(offset);
17281
+ if (isNumber(char)) cp = cp * 16 + (char - CharCodes$1.ZERO);
17282
+ else if (isHexadecimalCharacter(char)) cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes$1.LOWER_A + 10);
17283
+ else break;
17284
+ offset += 1;
17285
+ }
17286
+ } else while (offset < inputLength) {
17287
+ const digit = input.charCodeAt(offset) - CharCodes$1.ZERO;
17288
+ if (digit >>> 0 > 9) break;
17289
+ cp = cp * 10 + digit;
17290
+ offset += 1;
17291
+ }
17292
+ if (offset === digitStart) return 0;
17293
+ if (offset < inputLength && input.charCodeAt(offset) === CharCodes$1.SEMI) offset += 1;
17294
+ if (cp > 1114111) cp = 1114112;
17295
+ let consumed = offset - numberStart;
17296
+ if (consumed >= CONSUMED_OVERFLOW) {
17297
+ longNumericConsumed = consumed;
17298
+ consumed = CONSUMED_OVERFLOW;
17299
+ }
17300
+ return consumed << CONSUMED_SHIFT | cp;
17301
+ }
17302
+ /**
17303
+ * Decode all entities in `input` using the HTML trie.
17304
+ *
17305
+ * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes
17306
+ * the HTML root's jump-table shape, so this must not be generalized to
17307
+ * other tries (the XML trie's dictionary root would silently match no
17308
+ * entities — `decodeXML` has its own hand-coded fast path instead).
17309
+ * @param input The string to decode.
17310
+ * @param isStrict Only match semicolon-terminated entities.
17311
+ * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).
17312
+ * @returns The decoded string.
17313
+ */
17314
+ function decodeWithTrie(input, isStrict, isAttribute) {
17315
+ const decodeTree = htmlDecodeTree;
17316
+ let offset = input.indexOf("&");
17317
+ if (offset < 0) return input;
17318
+ const inputLength = input.length;
17319
+ let chunkStart = 0;
17320
+ let result = "";
17321
+ const root = decodeTree[0];
17322
+ const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;
17323
+ const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;
17324
+ do {
17325
+ const entityStart = offset + 1;
17326
+ const firstChar = input.charCodeAt(entityStart);
17327
+ let consumed;
17328
+ let value;
17329
+ if (firstChar === CharCodes$1.NUM) {
17330
+ const packed = parseNumericEntity(input, entityStart, inputLength);
17331
+ consumed = unpackConsumed(packed);
17332
+ if (isStrict && consumed > 0 && input.charCodeAt(entityStart + consumed - 1) !== CharCodes$1.SEMI) consumed = 0;
17333
+ value = consumed === 0 ? "" : codePointToString(packed & CODE_POINT_MASK);
17334
+ } else if (isAlpha(firstChar)) {
17335
+ consumed = 0;
17336
+ value = "";
17337
+ const rootSlotIndex = firstChar - rootJumpOffset;
17338
+ let nodeIndex;
17339
+ if (rootSlotIndex >>> 0 < rootBranchCount) {
17340
+ const stored = decodeTree[1 + rootSlotIndex];
17341
+ nodeIndex = stored === 0 ? -1 : rootBranchCount + stored & 65535;
17342
+ } else nodeIndex = -1;
17343
+ let bestNodeIndex = 0;
17344
+ let bestValueLength = 0;
17345
+ let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];
17346
+ let index = entityStart + 1;
17347
+ trie: while (index < inputLength) {
17348
+ while ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === 0 && (current & BinTrieFlags.JUMP_TABLE) !== 0) {
17349
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
17350
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
17351
+ if (branchCount === 0) {
17352
+ if (input.charCodeAt(index) !== jumpOffset) break trie;
17353
+ nodeIndex += 1;
17354
+ } else {
17355
+ const slot = input.charCodeAt(index) - jumpOffset;
17356
+ if (slot >>> 0 >= branchCount) break trie;
17357
+ const stored = decodeTree[nodeIndex + 1 + slot];
17358
+ if (stored === 0) break trie;
17359
+ nodeIndex = nodeIndex + branchCount + stored & 65535;
17360
+ }
17361
+ current = decodeTree[nodeIndex];
17362
+ index += 1;
17363
+ if (index >= inputLength) break trie;
17364
+ }
17365
+ if ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === BinTrieFlags.FLAG13) {
17366
+ const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
17367
+ if (input.charCodeAt(index) !== (current & BinTrieFlags.JUMP_TABLE)) break;
17368
+ index += 1;
17369
+ const remaining = runLength - 1;
17370
+ let wordIndex = nodeIndex + 1;
17371
+ let charIndexInPacked = 0;
17372
+ for (; charIndexInPacked + 1 < remaining; charIndexInPacked += 2) {
17373
+ const packed = decodeTree[wordIndex];
17374
+ if (input.charCodeAt(index) !== (packed & 255)) break trie;
17375
+ index += 1;
17376
+ if (input.charCodeAt(index) !== (packed >> 8 & 255)) break trie;
17377
+ index += 1;
17378
+ wordIndex += 1;
17379
+ }
17380
+ if (charIndexInPacked < remaining) {
17381
+ if (input.charCodeAt(index) !== (decodeTree[wordIndex] & 255)) break;
17382
+ index += 1;
17383
+ }
17384
+ nodeIndex += 1 + (runLength >> 1);
17385
+ current = decodeTree[nodeIndex];
17386
+ continue;
17387
+ }
17388
+ const valueLength = current >>> 14;
17389
+ const char = input.charCodeAt(index);
17390
+ if (valueLength !== 0) {
17391
+ if (char === CharCodes$1.SEMI) {
17392
+ consumed = index - entityStart + 1;
17393
+ value = valueLength === 1 ? String.fromCharCode(current & BinTrieFlags.VALUE_MASK) : readTrieValue(decodeTree, nodeIndex, valueLength);
17394
+ break;
17395
+ }
17396
+ if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {
17397
+ consumed = index - entityStart;
17398
+ bestNodeIndex = nodeIndex;
17399
+ bestValueLength = valueLength;
17400
+ }
17401
+ if (valueLength === 1) break;
17402
+ }
17403
+ const next = determineBranch(decodeTree, current, nodeIndex + (valueLength || 1), char);
17404
+ if (next < 0) break;
17405
+ nodeIndex = next;
17406
+ current = decodeTree[nodeIndex];
17407
+ index += 1;
17408
+ }
17409
+ if (value === "") {
17410
+ const finalVL = current >>> 14;
17411
+ if (finalVL !== 0 && !isStrict && (current & BinTrieFlags.FLAG13) === 0) {
17412
+ consumed = index - entityStart;
17413
+ bestNodeIndex = nodeIndex;
17414
+ bestValueLength = finalVL;
17415
+ }
17416
+ if (consumed > 0) value = readTrieValue(decodeTree, bestNodeIndex, bestValueLength);
17417
+ }
17418
+ } else {
17419
+ consumed = 0;
17420
+ value = "";
17421
+ }
17422
+ if (consumed === 0 || isAttribute && firstChar !== CharCodes$1.NUM && input.charCodeAt(entityStart + consumed - 1) !== CharCodes$1.SEMI && entityStart + consumed < inputLength && isEntityInAttributeInvalidEnd(input.charCodeAt(entityStart + consumed))) offset = entityStart;
17423
+ else {
17424
+ if (chunkStart < offset) result += input.slice(chunkStart, offset);
17425
+ result += value;
17426
+ offset = chunkStart = entityStart + consumed;
17427
+ }
17428
+ if (input.charCodeAt(offset) !== CharCodes$1.AMP) offset = input.indexOf("&", offset);
17429
+ } while (offset >= 0);
17430
+ return result + input.slice(chunkStart);
17431
+ }
17432
+ /**
17433
+ * Decodes an HTML string.
17434
+ * @param htmlString The string to decode.
17435
+ * @param mode The decoding mode.
17436
+ * @returns The decoded string.
17437
+ */
17438
+ function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
17439
+ return decodeWithTrie(htmlString, mode === DecodingMode.Strict, mode === DecodingMode.Attribute);
17440
+ }
16961
17441
  // ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Tokenizer.js
16962
17442
  var CharCodes;
16963
17443
  (function(CharCodes) {
@@ -19992,202 +20472,73 @@ function parseDocument(data, options) {
19992
20472
  new Parser(handler, options).end(data);
19993
20473
  return handler.root;
19994
20474
  }
19995
- // ../../@weapp-core/shared/dist/rich-text.js
19996
- const ALLOWED_TAGS = /* @__PURE__ */ new Set([
19997
- "a",
19998
- "abbr",
19999
- "address",
20000
- "article",
20001
- "aside",
20002
- "b",
20003
- "bdi",
20004
- "bdo",
20005
- "big",
20006
- "blockquote",
20007
- "br",
20008
- "caption",
20009
- "center",
20010
- "cite",
20011
- "code",
20012
- "col",
20013
- "colgroup",
20014
- "dd",
20015
- "del",
20016
- "div",
20017
- "dl",
20018
- "dt",
20019
- "em",
20020
- "fieldset",
20021
- "font",
20022
- "h1",
20023
- "h2",
20024
- "h3",
20025
- "h4",
20026
- "h5",
20027
- "h6",
20028
- "header",
20029
- "hr",
20030
- "i",
20031
- "img",
20032
- "ins",
20033
- "label",
20034
- "legend",
20035
- "li",
20036
- "mark",
20037
- "ol",
20038
- "p",
20039
- "pre",
20040
- "q",
20041
- "rt",
20042
- "ruby",
20043
- "s",
20044
- "section",
20045
- "small",
20046
- "span",
20047
- "strong",
20048
- "sub",
20049
- "sup",
20050
- "table",
20051
- "tbody",
20052
- "td",
20053
- "tfoot",
20054
- "th",
20055
- "thead",
20056
- "tr",
20057
- "tt",
20058
- "u",
20059
- "ul"
20060
- ]);
20061
- const ALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set([
20062
- "abbr",
20063
- "align",
20064
- "alt",
20065
- "axis",
20066
- "bgcolor",
20067
- "border",
20068
- "cellpadding",
20069
- "cellspacing",
20070
- "class",
20071
- "colspan",
20072
- "dir",
20073
- "height",
20074
- "href",
20075
- "id",
20076
- "lang",
20077
- "rowspan",
20078
- "scope",
20079
- "span",
20080
- "start",
20081
- "style",
20082
- "summary",
20083
- "target",
20084
- "title",
20085
- "type",
20086
- "valign",
20087
- "width"
20088
- ]);
20089
- const URL_ATTRIBUTES = /* @__PURE__ */ new Set(["href", "src"]);
20090
- const ALLOWED_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
20091
- "background",
20092
- "background-color",
20093
- "border",
20094
- "border-bottom",
20095
- "border-color",
20096
- "border-left",
20097
- "border-radius",
20098
- "border-right",
20099
- "border-style",
20100
- "border-top",
20101
- "border-width",
20102
- "color",
20103
- "display",
20104
- "font-family",
20105
- "font-size",
20106
- "font-style",
20107
- "font-weight",
20108
- "height",
20109
- "letter-spacing",
20110
- "line-height",
20111
- "margin",
20112
- "margin-bottom",
20113
- "margin-left",
20114
- "margin-right",
20115
- "margin-top",
20116
- "max-height",
20117
- "max-width",
20118
- "min-height",
20119
- "min-width",
20120
- "opacity",
20121
- "overflow",
20122
- "padding",
20123
- "padding-bottom",
20124
- "padding-left",
20125
- "padding-right",
20126
- "padding-top",
20127
- "text-align",
20128
- "text-decoration",
20129
- "text-indent",
20130
- "text-overflow",
20131
- "text-transform",
20132
- "vertical-align",
20133
- "white-space",
20134
- "width",
20135
- "word-break",
20136
- "word-wrap"
20475
+ // ../../@weapp-core/shared/dist/rich-text-native.js
20476
+ const NATIVE_ALLOWED_TAGS = /* @__PURE__ */ new Set([
20477
+ ...ALLOWED_TAGS,
20478
+ "footer",
20479
+ "nav"
20137
20480
  ]);
20138
- function isRecord(value) {
20139
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20140
- }
20141
- function isSafeUrl(value, attribute) {
20142
- const normalized = Array.from(value).filter((character) => character.charCodeAt(0) > 32).join("").toLowerCase();
20143
- if (!normalized || normalized.startsWith("#") || normalized.startsWith("/") || normalized.startsWith("./") || normalized.startsWith("../")) return true;
20144
- if (/^(?:https?:|mailto:|tel:)/.test(normalized)) return true;
20145
- return attribute === "src" && /^data:image\/(?:gif|jpe?g|png|webp);base64,/.test(normalized);
20146
- }
20147
- function isSafeStyleValue(value) {
20148
- const normalized = value.toLowerCase().replace(/\s+/g, "");
20149
- return !normalized.includes("url(") && !normalized.includes("expression(") && !normalized.includes("javascript:") && !normalized.includes("behavior:") && !normalized.includes("-moz-binding");
20150
- }
20151
- function sanitizeRichTextStyle(value) {
20152
- const source = isRecord(value) ? Object.entries(value).map(([property, propertyValue]) => `${property}:${String(propertyValue)}`).join(";") : String(value ?? "");
20153
- const declarations = [];
20154
- for (const declaration of source.split(";")) {
20155
- const separator = declaration.indexOf(":");
20156
- if (separator <= 0) continue;
20157
- const property = declaration.slice(0, separator).trim().toLowerCase();
20158
- const propertyValue = declaration.slice(separator + 1).trim();
20159
- if (ALLOWED_STYLE_PROPERTIES.has(property) && propertyValue && isSafeStyleValue(propertyValue)) declarations.push(`${property}: ${propertyValue}`);
20160
- }
20161
- return declarations.join("; ");
20162
- }
20163
- function sanitizeRichTextAttributes(value, tagName) {
20481
+ const NATIVE_TAG_ATTRIBUTES = {
20482
+ bdo: ["dir"],
20483
+ col: ["span", "width"],
20484
+ colgroup: ["span", "width"],
20485
+ img: [
20486
+ "alt",
20487
+ "src",
20488
+ "height",
20489
+ "width"
20490
+ ],
20491
+ ol: ["start", "type"],
20492
+ table: ["width"],
20493
+ td: [
20494
+ "colspan",
20495
+ "height",
20496
+ "rowspan",
20497
+ "width"
20498
+ ],
20499
+ th: [
20500
+ "colspan",
20501
+ "height",
20502
+ "rowspan",
20503
+ "width"
20504
+ ],
20505
+ tr: [
20506
+ "colspan",
20507
+ "height",
20508
+ "rowspan",
20509
+ "width"
20510
+ ]
20511
+ };
20512
+ function sanitizeNativeRichTextAttributes(value, tagName) {
20164
20513
  if (!isRecord(value)) return {};
20165
20514
  const attributes = {};
20515
+ const nativeAttributes = Object.prototype.hasOwnProperty.call(NATIVE_TAG_ATTRIBUTES, tagName) ? NATIVE_TAG_ATTRIBUTES[tagName] : void 0;
20166
20516
  for (const [rawName, rawValue] of Object.entries(value)) {
20167
20517
  const name = rawName.trim().toLowerCase();
20168
20518
  if (name.startsWith("on") || name === "srcdoc") continue;
20169
- if (!ALLOWED_ATTRIBUTES.has(name) && name !== "src" && !name.startsWith("aria-") && !name.startsWith("data-")) continue;
20519
+ if (name !== "class" && name !== "style" && !nativeAttributes?.includes(name)) continue;
20170
20520
  if (name === "src" && tagName !== "img") continue;
20171
20521
  const serialized = name === "style" ? sanitizeRichTextStyle(rawValue) : String(rawValue ?? "");
20172
- if (!serialized || URL_ATTRIBUTES.has(name) && !isSafeUrl(serialized, name)) continue;
20522
+ if (!serialized || name === "src" && !isSafeUrl(serialized, name)) continue;
20523
+ if (name === "src" && !/^(?:https?:)?\/\//i.test(serialized.trim())) continue;
20173
20524
  attributes[name] = serialized;
20174
20525
  }
20175
- if (tagName === "a") attributes.rel = "noopener noreferrer";
20176
20526
  return attributes;
20177
20527
  }
20178
20528
  function convertSourceNode(value) {
20179
20529
  if (!isRecord(value)) return [];
20180
- if (value.type === "text" || !value.name && typeof value.text === "string") return [{
20530
+ if (value.type === "text") return typeof value.text === "string" ? [{
20181
20531
  type: "text",
20182
- text: String(value.text ?? "")
20183
- }];
20532
+ text: decodeHTML(value.text)
20533
+ }] : [];
20534
+ if (value.type !== void 0 && value.type !== "node" || typeof value.name !== "string") return [];
20535
+ const name = value.name.toLowerCase();
20536
+ if (!NATIVE_ALLOWED_TAGS.has(name)) return [];
20184
20537
  const children = Array.isArray(value.children) ? value.children.flatMap(convertSourceNode) : [];
20185
- const name = String(value.name ?? "").toLowerCase();
20186
- if (!ALLOWED_TAGS.has(name)) return children;
20187
20538
  return [{
20188
20539
  type: "element",
20189
20540
  name,
20190
- attrs: sanitizeRichTextAttributes(value.attrs, name),
20541
+ attrs: sanitizeNativeRichTextAttributes(value.attrs, name),
20191
20542
  children
20192
20543
  }];
20193
20544
  }
@@ -20198,17 +20549,17 @@ function convertParsedNode(node) {
20198
20549
  }];
20199
20550
  if (node.type !== "tag") return [];
20200
20551
  const element = node;
20201
- const children = element.children.flatMap(convertParsedNode);
20202
20552
  const name = element.name.toLowerCase();
20203
- if (!ALLOWED_TAGS.has(name)) return children;
20553
+ if (!NATIVE_ALLOWED_TAGS.has(name)) return [];
20554
+ const children = element.children.flatMap(convertParsedNode);
20204
20555
  return [{
20205
20556
  type: "element",
20206
20557
  name,
20207
- attrs: sanitizeRichTextAttributes(element.attribs, name),
20558
+ attrs: sanitizeNativeRichTextAttributes(element.attribs, name),
20208
20559
  children
20209
20560
  }];
20210
20561
  }
20211
- function normalizeRichTextNodes(value) {
20562
+ function normalizeNativeRichTextNodes(value) {
20212
20563
  if (typeof value === "string") return parseDocument(value, {
20213
20564
  decodeEntities: true,
20214
20565
  lowerCaseAttributeNames: true,
@@ -20222,7 +20573,6 @@ function materializeNode(node) {
20222
20573
  type: "text",
20223
20574
  data: node.text
20224
20575
  };
20225
- for (const name of Object.keys(node.attrs)) if (name.startsWith("data-sim-")) delete node.attrs[name];
20226
20576
  return {
20227
20577
  type: "tag",
20228
20578
  name: node.name,
@@ -20232,7 +20582,7 @@ function materializeNode(node) {
20232
20582
  }
20233
20583
  /** 富文本直接成为已渲染节点,不能再进入 WXML 表达式或组件处理流程。 */
20234
20584
  function renderRichTextNodes(value) {
20235
- return normalizeRichTextNodes(value).map(materializeNode);
20585
+ return normalizeNativeRichTextNodes(value).map(materializeNode);
20236
20586
  }
20237
20587
  // ../../mpcore/packages/simulator/src/view/templateIncludes.ts
20238
20588
  /** 展开 include 的可渲染内容,并保留嵌套引用的来源文件。 */
@@ -20330,7 +20680,7 @@ function parseWxsTemplateDocument(templateSource) {
20330
20680
  return parseSharedWxsDocument(templateSource);
20331
20681
  }
20332
20682
  // ../../mpcore/packages/simulator/src/runtime/render/shared.ts
20333
- const LEADING_SLASH_RE$4 = /^\/+/;
20683
+ const LEADING_SLASH_RE$3 = /^\/+/;
20334
20684
  const EVENT_BINDING_ATTRS = [
20335
20685
  "bindtap",
20336
20686
  "bind:tap",
@@ -20439,6 +20789,7 @@ function applyNodeBindings(node, scope, richText = false) {
20439
20789
  continue;
20440
20790
  }
20441
20791
  const resolvedValue = resolveNativeAttributeValue(node, key, scope, (source) => typeof value === "string" ? resolveAttributeValue(value, source) : value);
20792
+ setNativeBooleanValue(node, key, resolvedValue, isValuelessTemplateAttribute(node, key));
20442
20793
  if (key === "value") setNativePickerValue(node, resolvedValue);
20443
20794
  if (richText && key === "nodes") node.children = renderRichTextNodes(resolvedValue);
20444
20795
  node.attribs[key] = String(resolvedValue ?? "");
@@ -20494,7 +20845,7 @@ function resolveOwnerComponent(context, ownerJsonPath, ownerFilePath, alias) {
20494
20845
  if (!usingComponents || typeof usingComponents !== "object" || Array.isArray(usingComponents)) return;
20495
20846
  const rawPath = usingComponents[alias];
20496
20847
  if (typeof rawPath !== "string") return;
20497
- return (resolvePluginRequest(context.project.plugins, rawPath, "publicComponent")?.resourcePath ?? resolveMiniProgramComponent(ownerFilePath, rawPath, context.project.miniprogramRootPath, (candidate) => context.artifactSource.has(candidate))).replace(LEADING_SLASH_RE$4, "");
20848
+ return (resolvePluginRequest(context.project.plugins, rawPath, "publicComponent")?.resourcePath ?? resolveMiniProgramComponent(ownerFilePath, rawPath, context.project.miniprogramRootPath, (candidate) => context.artifactSource.has(candidate))).replace(LEADING_SLASH_RE$3, "");
20498
20849
  } catch {
20499
20850
  return;
20500
20851
  }
@@ -20542,8 +20893,8 @@ function resolveComponentGenerics(context, hostNode, ownerJsonPath, ownerFilePat
20542
20893
  }
20543
20894
  const defaultPath = typeof definition === "object" && definition !== null ? definition.default : void 0;
20544
20895
  if (typeof defaultPath !== "string" || !defaultPath) continue;
20545
- const resolvedDefault = defaultPath.startsWith("/") ? defaultPath.replace(LEADING_SLASH_RE$4, "") : path.posix.normalize(path.posix.join(path.posix.dirname(componentFilePath), defaultPath));
20546
- resolved.set(genericName, resolvedDefault.replace(LEADING_SLASH_RE$4, ""));
20896
+ const resolvedDefault = defaultPath.startsWith("/") ? defaultPath.replace(LEADING_SLASH_RE$3, "") : path.posix.normalize(path.posix.join(path.posix.dirname(componentFilePath), defaultPath));
20897
+ resolved.set(genericName, resolvedDefault.replace(LEADING_SLASH_RE$3, ""));
20547
20898
  }
20548
20899
  return resolved.size > 0 ? resolved : void 0;
20549
20900
  }
@@ -20830,7 +21181,7 @@ function reconcileRuntimePageTree(context, page, bindingsOnly = false) {
20830
21181
  for (;;) {
20831
21182
  bindAttachmentBindingScope(context, page);
20832
21183
  if (page.__lastChangedKeys__) context.changedPageKeys = page.__lastChangedKeys__;
20833
- const route = page.route.replace(LEADING_SLASH_RE$4, "");
21184
+ const route = page.route.replace(LEADING_SLASH_RE$3, "");
20834
21185
  const resourcePath = context.project.routes.find((item) => item.route === route)?.resourcePath ?? route;
20835
21186
  const templatePath = path.resolve(context.project.miniprogramRootPath, `${resourcePath}.wxml`);
20836
21187
  const document = parseTemplateDocument(readTemplateSource(context.artifactSource, templatePath));
@@ -21942,11 +22293,11 @@ var RuntimeRenderQueue = class {
21942
22293
  }
21943
22294
  };
21944
22295
  // ../../mpcore/packages/simulator/src/project/resolveRoutes.ts
21945
- const LEADING_SLASH_RE$3 = /^\/+/;
22296
+ const LEADING_SLASH_RE$2 = /^\/+/;
21946
22297
  const TRAILING_SLASH_RE$1 = /\/+$/;
21947
22298
  const DUPLICATE_SLASH_RE = /\/{2,}/g;
21948
22299
  function normalizeSegment(value) {
21949
- return value.replace(LEADING_SLASH_RE$3, "").replace(TRAILING_SLASH_RE$1, "");
22300
+ return value.replace(LEADING_SLASH_RE$2, "").replace(TRAILING_SLASH_RE$1, "");
21950
22301
  }
21951
22302
  function pushRoute(records, seen, record) {
21952
22303
  if (!record.route || seen.has(record.route)) return;
@@ -41447,7 +41798,7 @@ function createValueEventDetail(value, detail) {
41447
41798
  ...detail ?? {}
41448
41799
  };
41449
41800
  }
41450
- function resolvePageScopeId$1(scopeId) {
41801
+ function resolvePageScopeId(scopeId) {
41451
41802
  if (!scopeId) return null;
41452
41803
  const pagePathIndex = scopeId.indexOf("/page/");
41453
41804
  return pagePathIndex >= 0 ? scopeId.slice(0, pagePathIndex) : scopeId;
@@ -41472,7 +41823,7 @@ var HeadlessTestingNodeHandle = class HeadlessTestingNodeHandle {
41472
41823
  if (!scope || !this.interactions) return nodes;
41473
41824
  return nodes.filter((node) => {
41474
41825
  const nodeScope = node.attribs?.["data-sim-scope"];
41475
- return nodeScope === scope || node.attribs?.["data-sim-component"] && (this.interactions.ownerScopeId(nodeScope ?? null) ?? resolvePageScopeId$1(nodeScope)) === scope;
41826
+ return nodeScope === scope || node.attribs?.["data-sim-component"] && (this.interactions.ownerScopeId(nodeScope ?? null) ?? resolvePageScopeId(nodeScope)) === scope;
41476
41827
  });
41477
41828
  }
41478
41829
  async $(selector) {
@@ -41509,7 +41860,7 @@ var HeadlessTestingNodeHandle = class HeadlessTestingNodeHandle {
41509
41860
  async pageScope() {
41510
41861
  this.assertActive();
41511
41862
  if (!this.interactions) throw new Error("Node interactions are not available for this headless testing node.");
41512
- return this.interactions.createScopeHandle(resolvePageScopeId$1(this.node.attribs?.["data-sim-scope"] ?? null));
41863
+ return this.interactions.createScopeHandle(resolvePageScopeId(this.node.attribs?.["data-sim-scope"] ?? null));
41513
41864
  }
41514
41865
  async page() {
41515
41866
  this.assertActive();
@@ -41602,7 +41953,7 @@ var HeadlessTestingNodeHandle = class HeadlessTestingNodeHandle {
41602
41953
  }
41603
41954
  };
41604
41955
  // ../../mpcore/packages/simulator/src/view/render.ts
41605
- const LEADING_SLASH_RE$2 = /^\/+/;
41956
+ const LEADING_SLASH_RE$1 = /^\/+/;
41606
41957
  const TEMPLATE_INTERPOLATION_RE = /\{\{([^{}]+)\}\}/g;
41607
41958
  function resolveRawValueByPath(source, expression) {
41608
41959
  const normalized = expression.trim();
@@ -41641,6 +41992,7 @@ function interpolateDomTree(root, data) {
41641
41992
  let dataset;
41642
41993
  for (const [key, value] of Object.entries(node.attribs)) {
41643
41994
  const resolvedValue = isMustacheOnly(value) ? resolveRawValueByPath(data, value.trim().slice(2, -2)) : interpolateTemplate(value, data);
41995
+ setNativeBooleanValue(node, key, resolvedValue, isValuelessTemplateAttribute(node, key));
41644
41996
  if (key === "value") setNativePickerValue(node, resolvedValue);
41645
41997
  if (richText && key === "nodes") node.children = renderRichTextNodes(resolvedValue);
41646
41998
  node.attribs[key] = String(resolvedValue ?? "");
@@ -41668,7 +42020,7 @@ function serializeDomNode(node) {
41668
42020
  return `<${tagName}${Object.entries(node.attribs ?? {}).map(([key, value]) => ` ${key}="${escapeAttribute(value)}"`).join("")}>${(node.children ?? []).map(serializeDomNode).join("")}</${tagName}>`;
41669
42021
  }
41670
42022
  function renderPageTree(project, page) {
41671
- const route = page.route.replace(LEADING_SLASH_RE$2, "");
42023
+ const route = page.route.replace(LEADING_SLASH_RE$1, "");
41672
42024
  const templatePath = path.resolve(project.miniprogramRootPath, `${route}.wxml`);
41673
42025
  const templateSource = project.artifactSource.readText(templatePath);
41674
42026
  if (templateSource == null) throw new Error(`Missing template in headless runtime: ${templatePath}`);
@@ -41964,6 +42316,21 @@ function coordinate(value) {
41964
42316
  function nodeKey(node) {
41965
42317
  return node.attribs?.["data-sim-node"] ?? "";
41966
42318
  }
42319
+ /** 按稳定渲染键把保留的测试节点句柄映射到当前树;有键但已移除时返回 undefined。 */
42320
+ function resolveNativeNode(root, node) {
42321
+ const key = nodeKey(node);
42322
+ if (!key) return node;
42323
+ let match;
42324
+ const visit = (current) => {
42325
+ if (current.attribs?.["data-sim-node"] === key) {
42326
+ match = current;
42327
+ return;
42328
+ }
42329
+ for (const child of current.children ?? []) if (!match) visit(child);
42330
+ };
42331
+ visit(root);
42332
+ return match;
42333
+ }
41967
42334
  /** 原生滚动位置独立于绑定值;未改变的绑定不能覆盖用户滚动。 */
41968
42335
  function syncNativeScrollViews(page, root, emit) {
41969
42336
  let states = pageScrollViews.get(page);
@@ -42065,6 +42432,14 @@ function dispatchNativeNodeEvent(page, node, eventName, event, wx, resolveMethod
42065
42432
  const origin = getNativeNodeOwner(node)?.target ?? node;
42066
42433
  let handlers;
42067
42434
  let handled = false;
42435
+ let eligibility = node;
42436
+ while (eligibility) {
42437
+ if (eligibility.name === "button") {
42438
+ if (getNativeBooleanValue(getNativeNodeOwner(eligibility)?.target ?? eligibility, "disabled")) return true;
42439
+ break;
42440
+ }
42441
+ eligibility = eligibility.parent;
42442
+ }
42068
42443
  const collectHandler = (scopeId, target, binding) => {
42069
42444
  if (binding.method) {
42070
42445
  const call = resolveMethod(scopeId, binding.method);
@@ -45685,14 +46060,14 @@ function createHeadlessWxState(scheduler = nativeScheduler, options = {}) {
45685
46060
  };
45686
46061
  }
45687
46062
  // ../../mpcore/packages/simulator/src/runtime/session.ts
45688
- const LEADING_SLASH_RE$1 = /^\/+/;
46063
+ const LEADING_SLASH_RE = /^\/+/;
45689
46064
  const PAGE_STACK_LIMIT = 10;
45690
46065
  const WHITESPACE_RE = /\s+/;
45691
46066
  const DATA_ATTR_SELECTOR_RE = /^\[data-([^=\]]+)="([^"]*)"\]$/;
45692
46067
  const COMPOUND_SELECTOR_PART_RE = /#[\w-]+|\.[\w-]+|\[data-[^=\]]+="[^"]*"\]|[A-Za-z][\w-]*/g;
45693
46068
  const DATASET_KEY_RE = /-([a-z])/g;
45694
46069
  function stripLeadingSlash(route) {
45695
- return route.replace(LEADING_SLASH_RE$1, "");
46070
+ return route.replace(LEADING_SLASH_RE, "");
45696
46071
  }
45697
46072
  function normalizeQuery(queryString) {
45698
46073
  const query = new URLSearchParams(queryString);
@@ -45743,9 +46118,9 @@ function readJsonObject(project, filePath) {
45743
46118
  }
45744
46119
  function resolveNavigationPath(targetPath, baseRoute) {
45745
46120
  if (!targetPath) throw new Error("Navigation url must include a pathname in headless runtime.");
45746
- if (targetPath.startsWith("/")) return path.posix.normalize(targetPath).replace(LEADING_SLASH_RE$1, "");
46121
+ if (targetPath.startsWith("/")) return path.posix.normalize(targetPath).replace(LEADING_SLASH_RE, "");
45747
46122
  if (!baseRoute) throw new Error(`Cannot resolve relative navigation url "${targetPath}" without an active page.`);
45748
- return path.posix.resolve(`/${path.posix.dirname(baseRoute)}`, targetPath).replace(LEADING_SLASH_RE$1, "");
46123
+ return path.posix.resolve(`/${path.posix.dirname(baseRoute)}`, targetPath).replace(LEADING_SLASH_RE, "");
45749
46124
  }
45750
46125
  var HeadlessSession = class {
45751
46126
  project;
@@ -46086,15 +46461,20 @@ var HeadlessSession = class {
46086
46461
  }
46087
46462
  dispatchNativeNodeEvent(node, eventName, event, onHandlerResult) {
46088
46463
  const current = this.requireCurrentPage("dispatchNativeNodeEvent()");
46089
- if (eventName === "tap") this.renderCurrentPage();
46090
- return dispatchNativeNodeEvent(current, node, eventName, event, this.moduleLoader.wx, (scopeId, method) => this.resolveScopeMethod(current, scopeId, method), onHandlerResult, (scopeId) => {
46464
+ const rendered = eventName === "tap" ? this.renderCurrentPage() : void 0;
46465
+ const currentNode = rendered ? resolveNativeNode(rendered.root, node) : node;
46466
+ if (!currentNode) throw new Error("Native testing node is no longer present in the current page.");
46467
+ const handled = dispatchNativeNodeEvent(current, currentNode, eventName, event, this.moduleLoader.wx, (scopeId, method) => this.resolveScopeMethod(current, scopeId, method), onHandlerResult, (scopeId) => {
46091
46468
  const instance = this.componentCache.get(scopeId);
46092
46469
  const scope = this.componentScopes.get(scopeId);
46093
46470
  return instance?.__definition__ && scope ? {
46094
46471
  definition: instance.__definition__,
46095
- ownerScopeId: scope.ownerScopeId ?? null
46472
+ ownerScopeId: scope.ownerScopeId ?? null,
46473
+ name: typeof instance.properties?.name === "string" ? instance.properties.name : void 0,
46474
+ value: instance.properties && Object.hasOwn(instance.properties, "value") ? instance.properties.value : void 0
46096
46475
  } : void 0;
46097
46476
  });
46477
+ return eventName === "tap" && Boolean(node.attribs?.["data-sim-node"]) ? true : handled;
46098
46478
  }
46099
46479
  requestRender(callback) {
46100
46480
  this.assertActive();
@@ -46965,16 +47345,16 @@ function resolveTestingPagePath(route) {
46965
47345
  return route.replace(PRIVATE_PLUGIN_ROUTE_RE, "__plugin__/$1/$2");
46966
47346
  }
46967
47347
  // ../../mpcore/packages/simulator/src/testing/pageWait.ts
46968
- const DEFAULT_WAIT_TIMEOUT$1 = 1e3;
46969
- const DEFAULT_WAIT_INTERVAL$1 = 10;
47348
+ const DEFAULT_WAIT_TIMEOUT = 1e3;
47349
+ const DEFAULT_WAIT_INTERVAL = 10;
46970
47350
  function normalizeInput(value, label) {
46971
47351
  const normalized = value.trim();
46972
47352
  if (!normalized) throw new Error(`${label} must be a non-empty string in headless testing runtime.`);
46973
47353
  return normalized;
46974
47354
  }
46975
- async function pollUntil$2(access, check, errorMessage, options) {
46976
- const timeout = Number.isFinite(options.timeout) ? Math.max(0, Math.trunc(options.timeout ?? DEFAULT_WAIT_TIMEOUT$1)) : DEFAULT_WAIT_TIMEOUT$1;
46977
- const interval = Number.isFinite(options.interval) ? Math.max(1, Math.trunc(options.interval ?? DEFAULT_WAIT_INTERVAL$1)) : DEFAULT_WAIT_INTERVAL$1;
47355
+ async function pollUntil$1(access, check, errorMessage, options) {
47356
+ const timeout = Number.isFinite(options.timeout) ? Math.max(0, Math.trunc(options.timeout ?? DEFAULT_WAIT_TIMEOUT)) : DEFAULT_WAIT_TIMEOUT;
47357
+ const interval = Number.isFinite(options.interval) ? Math.max(1, Math.trunc(options.interval ?? DEFAULT_WAIT_INTERVAL)) : DEFAULT_WAIT_INTERVAL;
46978
47358
  const deadline = Date.now() + timeout;
46979
47359
  while (true) {
46980
47360
  const result = await check();
@@ -46986,34 +47366,34 @@ async function pollUntil$2(access, check, errorMessage, options) {
46986
47366
  async function waitForPageSelector(access, selector, options = {}) {
46987
47367
  const normalizedSelector = normalizeInput(selector, "Selector");
46988
47368
  if (options.state === "detached") {
46989
- await pollUntil$2(access, async () => await access.findOne(normalizedSelector) ? null : true, `Timed out waiting for selector "${normalizedSelector}" to become detached in headless testing runtime.`, options);
47369
+ await pollUntil$1(access, async () => await access.findOne(normalizedSelector) ? null : true, `Timed out waiting for selector "${normalizedSelector}" to become detached in headless testing runtime.`, options);
46990
47370
  return null;
46991
47371
  }
46992
- return await pollUntil$2(access, async () => await access.findOne(normalizedSelector), `Timed out waiting for selector "${normalizedSelector}" to appear in headless testing runtime.`, options);
47372
+ return await pollUntil$1(access, async () => await access.findOne(normalizedSelector), `Timed out waiting for selector "${normalizedSelector}" to appear in headless testing runtime.`, options);
46993
47373
  }
46994
47374
  async function waitForPageComponent(access, selector, options = {}) {
46995
47375
  const normalizedSelector = normalizeInput(selector, "Selector");
46996
- return await pollUntil$2(access, async () => await access.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
47376
+ return await pollUntil$1(access, async () => await access.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
46997
47377
  }
46998
47378
  async function waitForPageComponents(access, selector, count = 1, options = {}) {
46999
47379
  const normalizedSelector = normalizeInput(selector, "Selector");
47000
47380
  const normalizedCount = Number.isFinite(count) ? Math.max(1, Math.trunc(count)) : 1;
47001
- return await pollUntil$2(access, async () => {
47381
+ return await pollUntil$1(access, async () => {
47002
47382
  const components = await access.selectComponents(normalizedSelector);
47003
47383
  return components.length >= normalizedCount ? components : null;
47004
47384
  }, `Timed out waiting for ${normalizedCount} component(s) matching "${normalizedSelector}" in headless testing runtime.`, options);
47005
47385
  }
47006
47386
  async function waitForPageText(access, text, options = {}) {
47007
47387
  const normalizedText = normalizeInput(text, "Text");
47008
- return await pollUntil$2(access, async () => (await access.wxml()).includes(normalizedText) ? normalizedText : null, `Timed out waiting for text "${normalizedText}" in headless testing runtime.`, options);
47388
+ return await pollUntil$1(access, async () => (await access.wxml()).includes(normalizedText) ? normalizedText : null, `Timed out waiting for text "${normalizedText}" in headless testing runtime.`, options);
47009
47389
  }
47010
47390
  async function waitForPageTextGone(access, text, options = {}) {
47011
47391
  const normalizedText = normalizeInput(text, "Text");
47012
- await pollUntil$2(access, async () => (await access.wxml()).includes(normalizedText) ? null : true, `Timed out waiting for text "${normalizedText}" to disappear in headless testing runtime.`, options);
47392
+ await pollUntil$1(access, async () => (await access.wxml()).includes(normalizedText) ? null : true, `Timed out waiting for text "${normalizedText}" to disappear in headless testing runtime.`, options);
47013
47393
  }
47014
47394
  async function waitForPageData(access, path, matcher, hasMatcher, options = {}) {
47015
47395
  const normalizedPath = normalizeInput(path, "Data path");
47016
- return await pollUntil$2(access, async () => {
47396
+ return await pollUntil$1(access, async () => {
47017
47397
  const value = await access.data(normalizedPath);
47018
47398
  if (typeof matcher === "function") return matcher(value) ? value : null;
47019
47399
  if (hasMatcher) return Object.is(value, matcher) ? value : null;
@@ -47033,7 +47413,7 @@ function matchesDataset(node, expected) {
47033
47413
  const dataset = node.dataset ?? {};
47034
47414
  return Object.entries(expected).every(([key, value]) => String(dataset[key] ?? "") === String(value));
47035
47415
  }
47036
- async function pollUntil$1(access, check, errorMessage, options) {
47416
+ async function pollUntil(access, check, errorMessage, options) {
47037
47417
  const timeout = Number.isFinite(options.timeout) ? Math.max(0, Math.trunc(options.timeout ?? DEFAULT_RENDERED_WAIT_TIMEOUT)) : DEFAULT_RENDERED_WAIT_TIMEOUT;
47038
47418
  const interval = Number.isFinite(options.interval) ? Math.max(1, Math.trunc(options.interval ?? DEFAULT_RENDERED_WAIT_INTERVAL)) : DEFAULT_RENDERED_WAIT_INTERVAL;
47039
47419
  const deadline = Date.now() + timeout;
@@ -47072,7 +47452,7 @@ async function waitForRenderedPage(access, options = {}) {
47072
47452
  access.assertActive();
47073
47453
  if (options.selector) {
47074
47454
  const selector = normalizeSelector(options.selector);
47075
- return await pollUntil$1(access, async () => {
47455
+ return await pollUntil(access, async () => {
47076
47456
  const nodes = await readRenderedNodes(access, selector, options);
47077
47457
  return nodes.some((node) => matchesDataset(node, options.dataset)) ? JSON.stringify({
47078
47458
  nodes,
@@ -47080,7 +47460,7 @@ async function waitForRenderedPage(access, options = {}) {
47080
47460
  }) : null;
47081
47461
  }, `Timed out waiting page rendered: selector=${selector} dataset=${JSON.stringify(options.dataset ?? {})}`, options);
47082
47462
  }
47083
- return await pollUntil$1(access, async () => {
47463
+ return await pollUntil(access, async () => {
47084
47464
  const wxml = await access.wxml();
47085
47465
  const normalizedWxml = wxml.trim();
47086
47466
  if (options.predicate?.(wxml)) return wxml;
@@ -47089,52 +47469,6 @@ async function waitForRenderedPage(access, options = {}) {
47089
47469
  return null;
47090
47470
  }, options.text ? `Timed out waiting page rendered: text=${options.text}` : options.predicate ? "Timed out waiting page rendered: predicate=true" : "Timed out waiting page rendered: non-empty wxml", options);
47091
47471
  }
47092
- // ../../mpcore/packages/simulator/src/testing/sessionHandle/shared.ts
47093
- const LEADING_SLASH_RE = /^\/+/;
47094
- const DEFAULT_WAIT_TIMEOUT = 1e3;
47095
- const DEFAULT_WAIT_INTERVAL = 10;
47096
- function normalizeRoute(route) {
47097
- return route.replace(LEADING_SLASH_RE, "");
47098
- }
47099
- function resolvePageScopeId(scopeId) {
47100
- const pagePathIndex = scopeId.indexOf("/page/");
47101
- return pagePathIndex >= 0 ? scopeId.slice(0, pagePathIndex) : scopeId;
47102
- }
47103
- function normalizeNonEmptyInput(value, label) {
47104
- const normalizedValue = value.trim();
47105
- if (!normalizedValue) throw new Error(`${label} must be a non-empty string in headless testing runtime.`);
47106
- return normalizedValue;
47107
- }
47108
- function cloneProtocolValue(value) {
47109
- if (!value || typeof value !== "object") return value;
47110
- return JSON.parse(JSON.stringify(value));
47111
- }
47112
- async function waitForDelay(ms = 0) {
47113
- if (ms <= 0) return;
47114
- await new Promise((resolve) => setTimeout(resolve, ms));
47115
- }
47116
- async function pollUntil(check, errorMessage, options = {}) {
47117
- const timeout = Number.isFinite(options.timeout) ? Math.max(0, Math.trunc(options.timeout ?? DEFAULT_WAIT_TIMEOUT)) : DEFAULT_WAIT_TIMEOUT;
47118
- const interval = Number.isFinite(options.interval) ? Math.max(1, Math.trunc(options.interval ?? DEFAULT_WAIT_INTERVAL)) : DEFAULT_WAIT_INTERVAL;
47119
- const deadline = Date.now() + timeout;
47120
- while (true) {
47121
- const result = await check();
47122
- if (result != null) return result;
47123
- if (Date.now() >= deadline) throw new Error(errorMessage);
47124
- await waitForDelay(interval);
47125
- }
47126
- }
47127
- async function runWithTimeout(operation, timeout, message) {
47128
- if (!Number.isFinite(timeout) || (timeout ?? 0) <= 0) return await operation();
47129
- let timer;
47130
- try {
47131
- return await Promise.race([Promise.resolve().then(operation), new Promise((_resolve, reject) => {
47132
- timer = setTimeout(() => reject(new Error(message)), Math.trunc(timeout));
47133
- })]);
47134
- } finally {
47135
- if (timer) clearTimeout(timer);
47136
- }
47137
- }
47138
47472
  // ../../mpcore/packages/simulator/src/testing/pageHandle.ts
47139
47473
  var HeadlessTestingPageHandle = class {
47140
47474
  project;
@@ -47472,13 +47806,13 @@ var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
47472
47806
  return currentPage ? new HeadlessTestingPageHandle(this.project, currentPage, this.session) : null;
47473
47807
  }
47474
47808
  async pageScope() {
47475
- return new HeadlessTestingScopeHandle(resolvePageScopeId(this.scopeId), this.project, this.session);
47809
+ return new HeadlessTestingScopeHandle(resolvePageScopeId$1(this.scopeId), this.project, this.session);
47476
47810
  }
47477
47811
  async ownerComponent() {
47478
47812
  return this.createScopeHandle(this.session.selectOwnerComponent(this.scopeId));
47479
47813
  }
47480
47814
  async waitForOwnerComponent(options = {}) {
47481
- return await pollUntil(async () => await this.ownerComponent(), "Timed out waiting for owner component in headless testing runtime.", options);
47815
+ return await pollUntil$2(async () => await this.ownerComponent(), "Timed out waiting for owner component in headless testing runtime.", options);
47482
47816
  }
47483
47817
  async selectComponent(selector) {
47484
47818
  const normalizedSelector = normalizeNonEmptyInput(selector, "Selector");
@@ -47491,12 +47825,12 @@ var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
47491
47825
  }
47492
47826
  async waitForComponent(selector, options = {}) {
47493
47827
  const normalizedSelector = normalizeNonEmptyInput(selector, "Selector");
47494
- return await pollUntil(async () => await this.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
47828
+ return await pollUntil$2(async () => await this.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
47495
47829
  }
47496
47830
  async waitForComponents(selector, count = 1, options = {}) {
47497
47831
  const normalizedSelector = normalizeNonEmptyInput(selector, "Selector");
47498
47832
  const normalizedCount = Number.isFinite(count) ? Math.max(1, Math.trunc(count)) : 1;
47499
- return await pollUntil(async () => {
47833
+ return await pollUntil$2(async () => {
47500
47834
  const components = await this.selectAllComponents(normalizedSelector);
47501
47835
  return components.length >= normalizedCount ? components : null;
47502
47836
  }, `Timed out waiting for ${normalizedCount} component(s) matching "${normalizedSelector}" in headless testing runtime.`, options);
@@ -47599,12 +47933,12 @@ var HeadlessTestingSessionHandle = class {
47599
47933
  }
47600
47934
  async waitForComponent(selector, options = {}) {
47601
47935
  const normalizedSelector = normalizeNonEmptyInput(selector, "Selector");
47602
- return await pollUntil(async () => await this.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
47936
+ return await pollUntil$2(async () => await this.selectComponent(normalizedSelector), `Timed out waiting for component "${normalizedSelector}" in headless testing runtime.`, options);
47603
47937
  }
47604
47938
  async waitForComponents(selector, count = 1, options = {}) {
47605
47939
  const normalizedSelector = normalizeNonEmptyInput(selector, "Selector");
47606
47940
  const normalizedCount = Number.isFinite(count) ? Math.max(1, Math.trunc(count)) : 1;
47607
- return await pollUntil(async () => {
47941
+ return await pollUntil$2(async () => {
47608
47942
  const components = await this.selectAllComponents(normalizedSelector);
47609
47943
  return components.length >= normalizedCount ? components : null;
47610
47944
  }, `Timed out waiting for ${normalizedCount} component(s) matching "${normalizedSelector}" in headless testing runtime.`, options);
@@ -47640,7 +47974,7 @@ var HeadlessTestingSessionHandle = class {
47640
47974
  async waitForCurrentPage(route, options = {}) {
47641
47975
  const normalizedRoute = route?.trim();
47642
47976
  if (normalizedRoute != null && !normalizedRoute) throw new Error("Route must be a non-empty string in headless testing runtime.");
47643
- return await pollUntil(async () => {
47977
+ return await pollUntil$2(async () => {
47644
47978
  const currentPageInstance = this.session.getCurrentPages().at(-1);
47645
47979
  if (!currentPageInstance) return null;
47646
47980
  const current = new HeadlessTestingPageHandle(this.project, currentPageInstance, this.session);