@kc-one/smart-fill-sdk 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- var Wt = Object.defineProperty;
2
- var Xt = (e, t, n) => t in e ? Wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var d = (e, t, n) => Xt(e, typeof t != "symbol" ? t + "" : t, n);
4
- const Io = {
1
+ var cn = Object.defineProperty;
2
+ var ln = (e, t, n) => t in e ? cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var d = (e, t, n) => ln(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const Zo = {
5
5
  name: "native",
6
6
  /** 匹配 input / textarea / select 原生控件 */
7
7
  match: (e) => e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement,
@@ -14,7 +14,7 @@ const Io = {
14
14
  const n = e.element;
15
15
  n instanceof HTMLInputElement && n.type === "checkbox" ? n.checked = !!t : (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && (n.value = String(t ?? "")), n == null || n.dispatchEvent(new Event("input", { bubbles: !0 })), n == null || n.dispatchEvent(new Event("change", { bubbles: !0 }));
16
16
  }
17
- }, lt = [
17
+ }, bt = [
18
18
  // Element Plus / Element UI
19
19
  { framework: "element", selectors: ".el-select,.el-select-v2", type: "select", kind: "input" },
20
20
  { framework: "element", selectors: ".el-cascader", type: "cascader", kind: "input" },
@@ -59,7 +59,7 @@ const Io = {
59
59
  { framework: "vant", selectors: ".van-checkbox-group", type: "checkbox", kind: "checkboxGroup", optionSelector: '.van-checkbox,[role="checkbox"],input[type="checkbox"]' },
60
60
  // 通用 ARIA 下拉(无框架 class 或作为内层触发器)
61
61
  { framework: "generic", selectors: '[role="combobox"]', type: "select", kind: "input" }
62
- ], Zt = [
62
+ ], un = [
63
63
  "is-disabled",
64
64
  "ant-select-disabled",
65
65
  "n-select--disabled",
@@ -68,7 +68,7 @@ const Io = {
68
68
  "van-switch--disabled",
69
69
  "van-stepper--disabled",
70
70
  "van-dropdown-menu--disabled"
71
- ], ut = lt.map((e) => e.selectors).join(", "), Jt = [
71
+ ], mt = bt.map((e) => e.selectors).join(", "), dn = [
72
72
  ".form-item",
73
73
  ".ant-form-item",
74
74
  ".el-form-item",
@@ -78,7 +78,7 @@ const Io = {
78
78
  ".van-field",
79
79
  ".field",
80
80
  ".form-row"
81
- ].join(", "), Qt = [
81
+ ].join(", "), fn = [
82
82
  "label",
83
83
  ".ant-form-item-label",
84
84
  ".el-form-item__label",
@@ -86,7 +86,7 @@ const Io = {
86
86
  ".arco-form-item-label",
87
87
  ".van-field__label",
88
88
  ".label"
89
- ].join(", "), ze = [
89
+ ].join(", "), We = [
90
90
  "dialog[open]",
91
91
  "[role='dialog']",
92
92
  "[aria-modal='true']",
@@ -105,7 +105,7 @@ const Io = {
105
105
  ".van-action-sheet",
106
106
  ".popup",
107
107
  ".drawer"
108
- ].join(", "), en = [
108
+ ].join(", "), pn = [
109
109
  "is-checked",
110
110
  "ant-switch-checked",
111
111
  "n-switch--active",
@@ -114,20 +114,20 @@ const Io = {
114
114
  "van-radio--checked",
115
115
  "van-checkbox--checked"
116
116
  ];
117
- function O(e) {
118
- return lt.find((t) => e.matches(t.selectors)) || null;
117
+ function D(e) {
118
+ return bt.find((t) => e.matches(t.selectors)) || null;
119
119
  }
120
- function dt(e) {
121
- return !!O(e);
120
+ function vt(e) {
121
+ return !!D(e);
122
122
  }
123
- function Te(e) {
123
+ function Fe(e) {
124
124
  for (let t = e; t; t = t.parentElement)
125
- if (dt(t)) return t;
125
+ if (vt(t)) return t;
126
126
  return null;
127
127
  }
128
- function ce(e) {
128
+ function ge(e) {
129
129
  var n;
130
- const t = O(e);
130
+ const t = D(e);
131
131
  if (!t) return null;
132
132
  if (e.matches(".van-field")) {
133
133
  if (e.querySelector("textarea")) return "textarea";
@@ -139,36 +139,36 @@ function ce(e) {
139
139
  if (!o || /选择|select/i.test(o)) return "select";
140
140
  }
141
141
  if (e.classList.contains("van-field--clickable")) {
142
- const o = p(((n = e.querySelector(".van-field__control")) == null ? void 0 : n.textContent) || "");
142
+ const o = f(((n = e.querySelector(".van-field__control")) == null ? void 0 : n.textContent) || "");
143
143
  if (!e.querySelector("textarea") && (o === "请选择" || o === ""))
144
144
  return "select";
145
145
  }
146
146
  }
147
147
  return t.type;
148
148
  }
149
- function pt(e) {
150
- const t = O(e);
149
+ function wt(e) {
150
+ const t = D(e);
151
151
  if (t != null && t.optionSelector)
152
- return Array.from(e.querySelectorAll(t.optionSelector)).map((n) => tn(n)).filter((n) => !!(n.label || n.value));
152
+ return Array.from(e.querySelectorAll(t.optionSelector)).map((n) => hn(n)).filter((n) => !!(n.label || n.value));
153
153
  }
154
- function tn(e) {
155
- const t = e instanceof HTMLInputElement ? e : e.querySelector('input[type="radio"],input[type="checkbox"]'), n = p(e.textContent || e.getAttribute("aria-label") || e.getAttribute("title") || ""), r = e.getAttribute("value") || (t == null ? void 0 : t.value) || n;
154
+ function hn(e) {
155
+ const t = e instanceof HTMLInputElement ? e : e.querySelector('input[type="radio"],input[type="checkbox"]'), n = f(e.textContent || e.getAttribute("aria-label") || e.getAttribute("title") || ""), r = e.getAttribute("value") || (t == null ? void 0 : t.value) || n;
156
156
  return { label: n, value: r };
157
157
  }
158
- function U(e) {
159
- return en.some((t) => e.classList.contains(t)) || e.getAttribute("aria-checked") === "true" || !!e.querySelector("input:checked");
158
+ function W(e) {
159
+ return pn.some((t) => e.classList.contains(t)) || e.getAttribute("aria-checked") === "true" || !!e.querySelector("input:checked");
160
160
  }
161
- function F(e) {
161
+ function q(e) {
162
162
  return e.querySelector('input:not([type="hidden"]), textarea');
163
163
  }
164
- function ft(e) {
164
+ function St(e) {
165
165
  var t, n, r;
166
- return e.getAttribute("name") || ((t = F(e)) == null ? void 0 : t.getAttribute("name")) || e.getAttribute("data-smart-fill-key") || ((n = F(e)) == null ? void 0 : n.getAttribute("data-smart-fill-key")) || ((r = e.querySelector("[data-smart-fill-key]")) == null ? void 0 : r.getAttribute("data-smart-fill-key"));
166
+ return e.getAttribute("name") || ((t = q(e)) == null ? void 0 : t.getAttribute("name")) || e.getAttribute("data-smart-fill-key") || ((n = q(e)) == null ? void 0 : n.getAttribute("data-smart-fill-key")) || ((r = e.querySelector("[data-smart-fill-key]")) == null ? void 0 : r.getAttribute("data-smart-fill-key"));
167
167
  }
168
- function p(e) {
168
+ function f(e) {
169
169
  return e.replace(/[*::]/g, "").replace(/\s+/g, " ").trim();
170
170
  }
171
- const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-style", ht = [
171
+ const Oe = "data-smart-fill-hide-dropdown-mode", Xe = "smart-fill-hide-dropdown-style", Et = [
172
172
  "[role='combobox']",
173
173
  "[aria-haspopup='listbox']",
174
174
  ".el-cascader",
@@ -191,7 +191,7 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
191
191
  ".van-dropdown-menu__bar",
192
192
  ".van-field--picker",
193
193
  ".van-field--clickable"
194
- ].join(", "), nn = [
194
+ ].join(", "), gn = [
195
195
  ".ant-select-selection-item",
196
196
  ".el-select__selected-item",
197
197
  ".el-select-v2__selected-item",
@@ -207,7 +207,7 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
207
207
  ".select-value",
208
208
  ".selection-item",
209
209
  ".van-field__control"
210
- ].join(", "), Ie = [
210
+ ].join(", "), qe = [
211
211
  "[role='option']",
212
212
  ".ant-select-item-option",
213
213
  ".el-select-dropdown__item",
@@ -219,8 +219,8 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
219
219
  ".t-select-option",
220
220
  ".van-picker-column__item",
221
221
  ".van-action-sheet__item"
222
- ].join(", "), le = [
223
- Ie,
222
+ ].join(", "), ye = [
223
+ qe,
224
224
  ".van-action-sheet__name",
225
225
  ".van-cascader__option",
226
226
  ".van-dropdown-item__option",
@@ -229,7 +229,7 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
229
229
  ".ant-cascader-menu-item",
230
230
  ".n-cascader-node",
231
231
  ".arco-cascader-option"
232
- ].join(", "), Me = [
232
+ ].join(", "), De = [
233
233
  ".el-select-dropdown",
234
234
  ".el-cascader__dropdown",
235
235
  ".el-cascader-panel",
@@ -253,7 +253,7 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
253
253
  ".van-dropdown-item",
254
254
  ".van-picker",
255
255
  "[role='listbox']"
256
- ].join(", "), gt = [
256
+ ].join(", "), xt = [
257
257
  ".el-select-dropdown",
258
258
  ".el-select__popper",
259
259
  ".el-select-v2__popper",
@@ -270,7 +270,7 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
270
270
  ".van-dropdown-item",
271
271
  ".van-picker",
272
272
  "[role='listbox']"
273
- ].join(", "), yt = [
273
+ ].join(", "), kt = [
274
274
  ".el-cascader__dropdown",
275
275
  ".el-cascader-panel",
276
276
  ".el-popper.el-cascader__dropdown",
@@ -279,11 +279,11 @@ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-
279
279
  ".arco-cascader-panel",
280
280
  ".van-cascader",
281
281
  ".van-cascader__options"
282
- ].join(", "), rn = /(?:省|市|自治区|特别行政区|自治州|地区|盟|县|区)$/, on = /地址|省|市|区|县|地区|籍贯|户籍|居住地|所在地|区域/, sn = /* @__PURE__ */ new Set(["select", "cascader", "date"]);
283
- function C(e) {
284
- return !Ct(e) || wt(e) ? !1 : !!e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
282
+ ].join(", "), yn = /(?:省|市|自治区|特别行政区|自治州|地区|盟|县|区)$/, bn = /地址|省|市|区|县|地区|籍贯|户籍|居住地|所在地|区域/, mn = /* @__PURE__ */ new Set(["select", "cascader", "date"]);
283
+ function T(e) {
284
+ return !Ot(e) || Ct(e) ? !1 : !!e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
285
285
  }
286
- function E(e) {
286
+ function k(e) {
287
287
  var n;
288
288
  if (!e.matches(".van-field")) return !1;
289
289
  if (e.classList.contains("van-field--picker") || e.querySelector(".van-dropdown-menu"))
@@ -294,16 +294,16 @@ function E(e) {
294
294
  if (!r || /选择|select/i.test(r)) return !0;
295
295
  }
296
296
  if (e.classList.contains("van-field--clickable")) {
297
- const r = p(((n = e.querySelector(".van-field__control")) == null ? void 0 : n.textContent) || "");
297
+ const r = f(((n = e.querySelector(".van-field__control")) == null ? void 0 : n.textContent) || "");
298
298
  if (!e.querySelector("textarea") && (r === "请选择" || r === ""))
299
299
  return !0;
300
300
  }
301
301
  return !1;
302
302
  }
303
- function j(e) {
304
- return !Ct(e) || wt(e) || e instanceof HTMLSelectElement || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? !1 : e.matches(ht) || e.getAttribute("role") === "combobox" || e.getAttribute("aria-haspopup") === "listbox" || e.classList.contains("el-select__wrapper") || e.classList.contains("el-select-v2__wrapper") || E(e);
303
+ function X(e) {
304
+ return !Ot(e) || Ct(e) || e instanceof HTMLSelectElement || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? !1 : e.matches(Et) || e.getAttribute("role") === "combobox" || e.getAttribute("aria-haspopup") === "listbox" || e.classList.contains("el-select__wrapper") || e.classList.contains("el-select-v2__wrapper") || k(e);
305
305
  }
306
- function G(e) {
306
+ function Z(e) {
307
307
  const t = e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
308
308
  if (t instanceof HTMLElement) return t;
309
309
  const n = e.closest([
@@ -333,82 +333,82 @@ function G(e) {
333
333
  ".el-select__wrapper",
334
334
  ".el-select-v2__wrapper"
335
335
  ].join(", "));
336
- return n instanceof HTMLElement ? n.matches(".van-field") && !E(n) ? null : n : j(e) ? e : null;
336
+ return n instanceof HTMLElement ? n.matches(".van-field") && !k(n) ? null : n : X(e) ? e : null;
337
337
  }
338
- function Re(e) {
338
+ function Pe(e) {
339
339
  if (e instanceof HTMLSelectElement) return e;
340
- if (C(e))
340
+ if (T(e))
341
341
  return e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
342
- const t = G(e);
343
- return t || (e.matches(".van-field") && E(e) ? e : null);
342
+ const t = Z(e);
343
+ return t || (e.matches(".van-field") && k(e) ? e : null);
344
344
  }
345
- function bt(e) {
346
- if (C(e)) return "cascader";
347
- if (j(e) || E(e)) return "select";
348
- const t = ce(e);
345
+ function _t(e) {
346
+ if (T(e)) return "cascader";
347
+ if (X(e) || k(e)) return "select";
348
+ const t = ge(e);
349
349
  return t || (e instanceof HTMLSelectElement ? "select" : null);
350
350
  }
351
- function Fe(e, t) {
352
- const n = t || bt(e);
353
- return n != null && sn.has(n);
351
+ function He(e, t) {
352
+ const n = t || _t(e);
353
+ return n != null && mn.has(n);
354
354
  }
355
- function an(e) {
355
+ function vn(e) {
356
356
  const t = e.matches(".van-field") ? e : e.closest(".van-field");
357
- if (t instanceof HTMLElement && E(t)) {
357
+ if (t instanceof HTMLElement && k(t)) {
358
358
  const i = t.querySelector(".van-field__control");
359
359
  if (i instanceof HTMLInputElement)
360
- return p(i.value);
361
- const s = p((i == null ? void 0 : i.textContent) || "");
360
+ return f(i.value);
361
+ const s = f((i == null ? void 0 : i.textContent) || "");
362
362
  return s && s !== "请选择" ? s : "";
363
363
  }
364
- const n = e.querySelector(nn);
364
+ const n = e.querySelector(gn);
365
365
  if (n instanceof HTMLInputElement)
366
- return p(n.value);
367
- const r = p((n == null ? void 0 : n.textContent) || "");
366
+ return f(n.value);
367
+ const r = f((n == null ? void 0 : n.textContent) || "");
368
368
  if (r && r !== "请选择") return r;
369
369
  const o = e.querySelector('input:not([type="hidden"])');
370
- return o != null && o.value ? p(o.value) : r;
370
+ return o != null && o.value ? f(o.value) : r;
371
371
  }
372
- function mt(e) {
373
- const t = hn(e);
372
+ function At(e) {
373
+ const t = An(e);
374
374
  if (!t.length) return;
375
- const n = gn(t);
375
+ const n = Cn(t);
376
376
  return n.length ? n : void 0;
377
377
  }
378
- function ne(e) {
378
+ function ie(e) {
379
379
  var t;
380
- return !((t = e.options) != null && t.length) || e.type === "cascader" || on.test(e.label || "") ? !1 : Sn(e.options);
380
+ return !((t = e.options) != null && t.length) || e.type === "cascader" || bn.test(e.label || "") ? !1 : Fn(e.options);
381
381
  }
382
- async function cn(e) {
382
+ async function wn(e) {
383
383
  if (e instanceof HTMLSelectElement)
384
- return Array.from(e.options).map((s) => ({ value: s.value, label: p(s.textContent || s.label) })).filter((s) => s.label || s.value);
385
- const t = mt(e);
384
+ return Array.from(e.options).map((s) => ({ value: s.value, label: f(s.textContent || s.label) })).filter((s) => s.label || s.value);
385
+ const t = At(e);
386
386
  if (t != null && t.length) return t;
387
- const n = G(e) || e;
388
- if (!j(n) && !C(n) && !E(n))
387
+ const n = Z(e) || e;
388
+ if (!X(n) && !T(n) && !k(n))
389
389
  return;
390
- const r = _n(), o = En(), i = new Set(o.getTrackedDropdowns());
390
+ const r = Pn(), o = On(), i = new Set(o.getTrackedDropdowns());
391
391
  try {
392
- if (!(C(n) ? await un(n, o, i) : await ln(n, o, i))) return;
393
- const a = await pn(o, i, n);
392
+ if (!(T(n) ? await En(n, o, i) : await Sn(n, o, i))) return;
393
+ const a = await kn(o, i, n);
394
394
  if (!a.length) return;
395
- const c = dn(a);
395
+ const c = xn(a);
396
396
  return c.length ? c : void 0;
397
397
  } finally {
398
- await kn(n, o), await M(60), o.restore(), r();
398
+ await Dn(n, o), await R(60), o.restore(), r();
399
399
  }
400
400
  }
401
- function wt(e) {
401
+ function Ct(e) {
402
402
  return e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true";
403
403
  }
404
- async function ln(e, t, n) {
405
- const r = Y(e);
404
+ async function Sn(e, t, n) {
405
+ const r = J(e);
406
406
  if (!r.length) return !1;
407
407
  for (const o of r)
408
- if (kt(o), xt(o), await M(160), Ue(e, t, n) || (_t(o), await M(180), Ue(e, t, n))) return !0;
408
+ if (Rt(o), Mt(o), await R(160), Ze(e, t, n) || (Ft(o), await R(180), Ze(e, t, n))) return !0;
409
409
  return !1;
410
410
  }
411
- async function un(e, t, n) {
411
+ async function En(e, t, n) {
412
412
  const r = [
413
413
  e,
414
414
  e.querySelector(".el-input__wrapper"),
@@ -417,18 +417,18 @@ async function un(e, t, n) {
417
417
  e.querySelector("input")
418
418
  ].filter((o) => o instanceof HTMLElement);
419
419
  for (const o of r)
420
- if (kt(o), xt(o), await M(180), ue(t, n, e).length || (_t(o), await M(180), ue(t, n, e).length)) return !0;
420
+ if (Rt(o), Mt(o), await R(180), be(t, n, e).length || (Ft(o), await R(180), be(t, n, e).length)) return !0;
421
421
  return !1;
422
422
  }
423
- function dn(e) {
423
+ function xn(e) {
424
424
  var r;
425
425
  const t = /* @__PURE__ */ new Set(), n = [];
426
426
  for (const o of e) {
427
- const i = o.matches(le) ? [o] : Array.from(o.querySelectorAll(le));
427
+ const i = o.matches(ye) ? [o] : Array.from(o.querySelectorAll(ye));
428
428
  for (const s of i) {
429
429
  if (s.classList.contains("is-disabled") || s.classList.contains("ant-select-item-option-disabled") || s.getAttribute("aria-disabled") === "true")
430
430
  continue;
431
- const a = p(
431
+ const a = f(
432
432
  ((r = s.querySelector(".el-cascader-node__label, .ant-cascader-menu-item-content")) == null ? void 0 : r.textContent) || s.textContent || ""
433
433
  ), c = s.getAttribute("data-value") || s.getAttribute("value") || a;
434
434
  if (!a && !c) continue;
@@ -438,56 +438,56 @@ function dn(e) {
438
438
  }
439
439
  return n;
440
440
  }
441
- async function pn(e, t, n) {
441
+ async function kn(e, t, n) {
442
442
  for (let r = 0; r < 8; r += 1) {
443
- const o = ue(e, t, n);
443
+ const o = be(e, t, n);
444
444
  if (o.length) return o;
445
- await M(r === 0 ? 120 : 80);
445
+ await R(r === 0 ? 120 : 80);
446
446
  }
447
447
  return [];
448
448
  }
449
- function Ue(e, t, n) {
450
- return ue(t, n, e).length > 0 ? !0 : Y(e).some((r) => r.getAttribute("aria-expanded") === "true" || r.classList.contains("is-focus") || r.classList.contains("is-focused"));
449
+ function Ze(e, t, n) {
450
+ return be(t, n, e).length > 0 ? !0 : J(e).some((r) => r.getAttribute("aria-expanded") === "true" || r.classList.contains("is-focus") || r.classList.contains("is-focused"));
451
451
  }
452
- function fn(e, t, n) {
453
- const r = t.filter((c) => Oe(e, c)), o = r.filter((c) => yn(e, c)), i = o.filter((c) => !n.has(c));
452
+ function _n(e, t, n) {
453
+ const r = t.filter((c) => Ne(e, c)), o = r.filter((c) => Tn(e, c)), i = o.filter((c) => !n.has(c));
454
454
  if (i.length)
455
- return i.sort((c, l) => R(l, e) - R(c, e));
456
- const s = vt(e);
455
+ return i.sort((c, l) => O(l, e) - O(c, e));
456
+ const s = Tt(e);
457
457
  if (s.size) {
458
458
  const c = o.filter((l) => l.id && s.has(l.id));
459
459
  if (c.length) return c;
460
460
  }
461
461
  if (o.length)
462
- return o.sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
463
- const a = r.filter((c) => vn(c) && St(e)).sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
462
+ return o.sort((c, l) => O(l, e) - O(c, e)).slice(0, 1);
463
+ const a = r.filter((c) => Rn(c) && Lt(e)).sort((c, l) => O(l, e) - O(c, e)).slice(0, 1);
464
464
  return a.length ? a : [];
465
465
  }
466
- function ue(e, t, n) {
467
- return fn(n, e.getTrackedDropdowns(), t);
466
+ function be(e, t, n) {
467
+ return _n(n, e.getTrackedDropdowns(), t);
468
468
  }
469
- function R(e, t) {
469
+ function O(e, t) {
470
470
  const n = e.getBoundingClientRect(), r = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
471
471
  let o = (Number.isNaN(r) ? 0 : r) * 10 + n.width * n.height;
472
- return t && (o += Et(t, e)), o;
472
+ return t && (o += It(t, e)), o;
473
473
  }
474
- function hn(e) {
475
- const t = C(e) ? yt : gt, n = /* @__PURE__ */ new Set();
474
+ function An(e) {
475
+ const t = T(e) ? kt : xt, n = /* @__PURE__ */ new Set();
476
476
  e.matches(t) && n.add(e);
477
477
  for (const r of e.querySelectorAll(t))
478
- Oe(e, r) && n.add(r);
478
+ Ne(e, r) && n.add(r);
479
479
  for (const r of e.querySelectorAll("[role='listbox']"))
480
- e.contains(r) && Oe(e, r) && n.add(r);
480
+ e.contains(r) && Ne(e, r) && n.add(r);
481
481
  return [...n];
482
482
  }
483
- function gn(e) {
483
+ function Cn(e) {
484
484
  const t = /* @__PURE__ */ new Set(), n = [];
485
485
  for (const r of e) {
486
- const o = r.matches(Ie) ? [r] : Array.from(r.querySelectorAll(Ie));
486
+ const o = r.matches(qe) ? [r] : Array.from(r.querySelectorAll(qe));
487
487
  for (const i of o) {
488
488
  if (i.classList.contains("is-disabled") || i.classList.contains("ant-select-item-option-disabled") || i.getAttribute("aria-disabled") === "true")
489
489
  continue;
490
- const s = p(i.textContent || ""), a = i.getAttribute("data-value") || i.getAttribute("value") || s;
490
+ const s = f(i.textContent || ""), a = i.getAttribute("data-value") || i.getAttribute("value") || s;
491
491
  if (!s && !a) continue;
492
492
  const c = `${s}::${String(a)}`;
493
493
  t.has(c) || (t.add(c), n.push({ label: s, value: a }));
@@ -495,35 +495,35 @@ function gn(e) {
495
495
  }
496
496
  return n;
497
497
  }
498
- function vt(e) {
498
+ function Tt(e) {
499
499
  return new Set(
500
- Y(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
500
+ J(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
501
501
  );
502
502
  }
503
- function yn(e, t) {
504
- const n = vt(e);
505
- return n.size && t.id && n.has(t.id) || e.contains(t) ? !0 : wn(t) ? St(e) : n.size > 0 || Y(e).some((o) => o.getAttribute("aria-controls") || o.getAttribute("aria-owns")) ? !1 : Et(e, t) > 0;
503
+ function Tn(e, t) {
504
+ const n = Tt(e);
505
+ return n.size && t.id && n.has(t.id) || e.contains(t) ? !0 : Mn(t) ? Lt(e) : n.size > 0 || J(e).some((o) => o.getAttribute("aria-controls") || o.getAttribute("aria-owns")) ? !1 : It(e, t) > 0;
506
506
  }
507
- function Oe(e, t) {
508
- const n = C(e), r = bn(t);
509
- return n ? r : r ? !1 : mn(t);
507
+ function Ne(e, t) {
508
+ const n = T(e), r = Ln(t);
509
+ return n ? r : r ? !1 : In(t);
510
510
  }
511
- function bn(e) {
512
- return e.matches(yt) || !!e.querySelector(".el-cascader-node, .ant-cascader-menu-item, .van-cascader__option, .n-cascader-node, .arco-cascader-option");
511
+ function Ln(e) {
512
+ return e.matches(kt) || !!e.querySelector(".el-cascader-node, .ant-cascader-menu-item, .van-cascader__option, .n-cascader-node, .arco-cascader-option");
513
513
  }
514
- function mn(e) {
515
- return e.matches(gt) || !!e.querySelector('.el-select-dropdown__item, .ant-select-item-option, .van-picker-column__item, .van-action-sheet__item, .van-dropdown-item__option, [role="option"]');
514
+ function In(e) {
515
+ return e.matches(xt) || !!e.querySelector('.el-select-dropdown__item, .ant-select-item-option, .van-picker-column__item, .van-action-sheet__item, .van-dropdown-item__option, [role="option"]');
516
516
  }
517
- function wn(e) {
517
+ function Mn(e) {
518
518
  return e.matches(".van-popup, .van-action-sheet, .van-picker, .van-dropdown-item__content, .van-dropdown-item");
519
519
  }
520
- function St(e) {
521
- return Y(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused") || e.contains(document.activeElement));
520
+ function Lt(e) {
521
+ return J(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused") || e.contains(document.activeElement));
522
522
  }
523
- function vn(e) {
524
- return e.matches(le) || !!e.querySelector(le);
523
+ function Rn(e) {
524
+ return e.matches(ye) || !!e.querySelector(ye);
525
525
  }
526
- function Et(e, t) {
526
+ function It(e, t) {
527
527
  const n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
528
528
  if (!n.width || !n.height || !r.width || !r.height)
529
529
  return 0;
@@ -532,11 +532,11 @@ function Et(e, t) {
532
532
  const i = r.top >= n.bottom ? r.top - n.bottom : n.top - r.bottom;
533
533
  return i > 320 ? 0 : Math.max(0, 400 - i) + o;
534
534
  }
535
- function Sn(e) {
536
- const t = e.slice(0, 8).map((r) => p(String(r.label || r.value || ""))).filter(Boolean);
537
- return t.length < 4 ? !1 : t.filter((r) => rn.test(r)).length / t.length >= 0.75;
535
+ function Fn(e) {
536
+ const t = e.slice(0, 8).map((r) => f(String(r.label || r.value || ""))).filter(Boolean);
537
+ return t.length < 4 ? !1 : t.filter((r) => yn.test(r)).length / t.length >= 0.75;
538
538
  }
539
- function Y(e) {
539
+ function J(e) {
540
540
  return [
541
541
  e,
542
542
  e.querySelector(".van-field__control"),
@@ -561,11 +561,11 @@ function Y(e) {
561
561
  e.querySelector(".select__wrapper")
562
562
  ].filter((n) => n instanceof HTMLElement).filter((n, r, o) => o.indexOf(n) === r);
563
563
  }
564
- function En() {
564
+ function On() {
565
565
  const e = /* @__PURE__ */ new Map();
566
- xn(), document.documentElement.setAttribute(Le, "true");
566
+ qn(), document.documentElement.setAttribute(Oe, "true");
567
567
  const t = () => {
568
- for (const r of document.querySelectorAll(Me))
568
+ for (const r of document.querySelectorAll(De))
569
569
  e.has(r) || e.set(r, {
570
570
  display: r.style.display,
571
571
  opacity: r.style.opacity,
@@ -581,19 +581,19 @@ function En() {
581
581
  attributes: !0,
582
582
  attributeFilter: ["class", "style", "aria-hidden"]
583
583
  }), {
584
- getTrackedDropdowns: () => Array.from(document.querySelectorAll(Me)),
584
+ getTrackedDropdowns: () => Array.from(document.querySelectorAll(De)),
585
585
  restore: () => {
586
- n.disconnect(), document.documentElement.removeAttribute(Le);
586
+ n.disconnect(), document.documentElement.removeAttribute(Oe);
587
587
  for (const [r, o] of e)
588
588
  r.style.display = o.display, r.style.opacity = o.opacity, r.style.visibility = o.visibility, r.style.pointerEvents = o.pointerEvents;
589
589
  }
590
590
  };
591
591
  }
592
- function xn() {
593
- if (document.getElementById(Be)) return;
592
+ function qn() {
593
+ if (document.getElementById(Xe)) return;
594
594
  const e = document.createElement("style");
595
- e.id = Be, e.textContent = `
596
- ${Me.split(",").map((t) => `html[${Le}="true"] ${t.trim()}`).join(`,
595
+ e.id = Xe, e.textContent = `
596
+ ${De.split(",").map((t) => `html[${Oe}="true"] ${t.trim()}`).join(`,
597
597
  `)} {
598
598
  opacity: 0 !important;
599
599
  visibility: hidden !important;
@@ -603,27 +603,27 @@ function xn() {
603
603
  }
604
604
  `, document.head.appendChild(e);
605
605
  }
606
- async function kn(e, t) {
607
- e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await M(120);
606
+ async function Dn(e, t) {
607
+ e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await R(120);
608
608
  for (const n of t.getTrackedDropdowns())
609
609
  n.isConnected && (n.style.display = "none", n.setAttribute("aria-hidden", "true"));
610
610
  }
611
- function xt(e) {
611
+ function Mt(e) {
612
612
  window.PointerEvent && (e.dispatchEvent(new PointerEvent("pointerdown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new PointerEvent("pointerup", { bubbles: !0, composed: !0, button: 0 }))), e.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, composed: !0, button: 0 })), e.click();
613
613
  }
614
- function kt(e) {
614
+ function Rt(e) {
615
615
  e.focus({ preventScroll: !0 });
616
616
  const t = e instanceof HTMLInputElement ? e : e.querySelector("input");
617
617
  t instanceof HTMLElement && t.focus({ preventScroll: !0 });
618
618
  }
619
- function _t(e) {
619
+ function Ft(e) {
620
620
  for (const t of [{ key: "ArrowDown", code: "ArrowDown" }, { key: "Enter", code: "Enter" }, { key: " ", code: "Space" }])
621
621
  e.dispatchEvent(new KeyboardEvent("keydown", { ...t, bubbles: !0, composed: !0 })), e.dispatchEvent(new KeyboardEvent("keyup", { ...t, bubbles: !0, composed: !0 }));
622
622
  }
623
- function M(e) {
623
+ function R(e) {
624
624
  return new Promise((t) => window.setTimeout(t, e));
625
625
  }
626
- function _n() {
626
+ function Pn() {
627
627
  const e = /* @__PURE__ */ new Map();
628
628
  e.set(window, { left: window.scrollX, top: window.scrollY });
629
629
  for (const t of document.querySelectorAll("*"))
@@ -633,43 +633,250 @@ function _n() {
633
633
  t === window ? window.scrollTo(n.left, n.top) : t instanceof HTMLElement && (t.scrollLeft = n.left, t.scrollTop = n.top);
634
634
  };
635
635
  }
636
- function Ct(e) {
636
+ function Ot(e) {
637
637
  const t = window.getComputedStyle(e);
638
638
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
639
639
  return !1;
640
640
  const n = e.getBoundingClientRect();
641
641
  return n.width > 0 && n.height > 0;
642
642
  }
643
- function be(e, t) {
644
- const n = me(t);
643
+ const Hn = /(维吾尔自治区|壮族自治区|回族自治区|特别行政区|自治区直辖县级行政区划|自治区|自治州|地区|盟|林区|街道|苏木|社区|省|市|区|县|旗|镇|乡)$/g, Nn = /* @__PURE__ */ new Set(["市辖区", "县", "自治区直辖县级行政区划"]);
644
+ let se = null;
645
+ function m(e) {
646
+ return String(e ?? "").replace(/\s+/g, "").replace(/[,,。.、/\\\-]/g, "").trim().toLowerCase();
647
+ }
648
+ function L(e) {
649
+ return m(e).replace(Hn, "");
650
+ }
651
+ function Be(e) {
652
+ if (e == null) return "";
653
+ if (typeof e == "string" || typeof e == "number")
654
+ return String(e).trim();
655
+ if (Array.isArray(e))
656
+ return e.map((t) => Be(t)).filter(Boolean).join("");
657
+ if (typeof e == "object") {
658
+ const t = [], n = /* @__PURE__ */ new Set(), r = (o) => {
659
+ const i = f(String(o ?? ""));
660
+ !i || n.has(i) || (n.add(i), t.push(i));
661
+ };
662
+ for (const o of [
663
+ "province",
664
+ "provinceName",
665
+ "prov",
666
+ "city",
667
+ "cityName",
668
+ "district",
669
+ "districtName",
670
+ "area",
671
+ "areaName",
672
+ "county",
673
+ "countyName",
674
+ "region",
675
+ "regionName",
676
+ "address",
677
+ "detail",
678
+ "detailAddress",
679
+ "fullAddress",
680
+ "label",
681
+ "text",
682
+ "value",
683
+ "name",
684
+ "answer"
685
+ ])
686
+ r(e[o]);
687
+ return t.join("");
688
+ }
689
+ return f(String(e));
690
+ }
691
+ function Ee(e) {
692
+ const t = [], n = [], r = (s) => {
693
+ const a = f(String(s ?? ""));
694
+ a && t.push(a);
695
+ }, o = (s) => {
696
+ const a = m(s);
697
+ a && (n.push(a), r(s));
698
+ };
699
+ if (Array.isArray(e))
700
+ for (const s of e) o(s);
701
+ else if (typeof e == "object" && e) {
702
+ for (const s of [
703
+ "province",
704
+ "provinceName",
705
+ "prov",
706
+ "city",
707
+ "cityName",
708
+ "district",
709
+ "districtName",
710
+ "area",
711
+ "areaName",
712
+ "county",
713
+ "countyName",
714
+ "region",
715
+ "regionName"
716
+ ])
717
+ o(e[s]);
718
+ for (const s of ["address", "detail", "detailAddress", "fullAddress", "label", "value", "text", "name", "answer"])
719
+ r(e[s]);
720
+ } else
721
+ r(e);
722
+ const i = m(t.join(""));
723
+ return {
724
+ fullText: i,
725
+ looseFullText: L(i),
726
+ structuredParts: n
727
+ };
728
+ }
729
+ function ae(e, t) {
730
+ const n = m(e), r = m(t);
731
+ if (!n || !r) return !1;
732
+ if (n === r || n.includes(r) || r.includes(n))
733
+ return !0;
734
+ const o = L(n), i = L(r);
735
+ return !o || !i ? !1 : o === i || o.includes(i) || i.includes(o);
736
+ }
737
+ function Ue(e, t = Ee(e)) {
738
+ const n = jn();
739
+ if (!n.length) return [];
740
+ let r = null, o = 0;
741
+ for (const i of n) {
742
+ const s = Vn(i, t);
743
+ s > o && (o = s, r = i);
744
+ }
745
+ return o >= 120 ? (r == null ? void 0 : r.labels) || [] : [];
746
+ }
747
+ function $n(e, t, n, r) {
748
+ let o = null, i = 0;
749
+ const s = zn(t, n, r);
750
+ for (const a of e) {
751
+ const c = a.querySelector(".el-cascader-node__label, .ant-cascader-menu-item-content, .n-cascader-node__label, .arco-cascader-option-label"), l = f((c == null ? void 0 : c.textContent) || a.textContent || ""), u = m(l);
752
+ if (!u) continue;
753
+ const p = L(u);
754
+ let y = Kn(u, p, s);
755
+ !y && t.fullText && (t.fullText.includes(u) ? y = 100 + u.length : u.includes(t.fullText) ? y = 70 + t.fullText.length : t.looseFullText.includes(p) && (y = 80 + p.length)), y > i && (i = y, o = a);
756
+ }
757
+ return i >= 75 ? o : null;
758
+ }
759
+ function zn(e, t, n) {
760
+ const r = [], o = /* @__PURE__ */ new Set(), i = (s, a) => {
761
+ const c = m(s);
762
+ !c || o.has(c) || (o.add(c), r.push({
763
+ normalized: c,
764
+ stripped: L(c),
765
+ score: a
766
+ }));
767
+ };
768
+ if (t.length) {
769
+ t[n] && i(t[n], 260);
770
+ for (let s = n + 1; s < t.length; s += 1)
771
+ i(t[s], 215 - (s - n) * 15);
772
+ }
773
+ e.structuredParts[n] && i(e.structuredParts[n], 235);
774
+ for (let s = 0; s < e.structuredParts.length; s += 1)
775
+ s !== n && i(e.structuredParts[s], 180 - Math.abs(s - n) * 20);
776
+ return e.fullText && i(e.fullText, 130), r;
777
+ }
778
+ function Kn(e, t, n) {
779
+ let r = 0;
780
+ for (const o of n) {
781
+ let i = 0;
782
+ o.normalized === e ? i = o.score + 80 : o.stripped && o.stripped === t ? i = o.score + 68 : o.normalized.includes(e) ? i = o.score + 40 + e.length : e.includes(o.normalized) ? i = o.score + 28 + o.normalized.length : o.stripped && t && o.stripped.includes(t) ? i = o.score + 24 + t.length : o.stripped && t && t.includes(o.stripped) && (i = o.score + 20 + o.stripped.length), i > r && (r = i);
783
+ }
784
+ return r;
785
+ }
786
+ function Vn(e, t) {
787
+ let n = 0, r = 0;
788
+ for (let o = 0; o < e.aliasesByLevel.length; o += 1) {
789
+ const i = Bn(
790
+ e.aliasesByLevel[o],
791
+ t.structuredParts[o] || "",
792
+ t.fullText,
793
+ t.looseFullText,
794
+ o
795
+ );
796
+ i > 0 ? (r += 1, n += i) : t.structuredParts[o] && (n -= 30);
797
+ }
798
+ return n += r * 18 + e.labels.length * 4, t.structuredParts.length > e.labels.length && (n -= (t.structuredParts.length - e.labels.length) * 10), n;
799
+ }
800
+ function Bn(e, t, n, r, o) {
801
+ const i = [60, 95, 135, 160][o] || 160;
802
+ let s = 0;
803
+ for (const a of e) {
804
+ let c = 0;
805
+ const l = L(a);
806
+ t && (t === a ? c = Math.max(c, i + 130 + a.length) : t.includes(a) || a.includes(t) ? c = Math.max(c, i + 95 + Math.min(a.length, t.length)) : l && L(t) === l && (c = Math.max(c, i + 80 + l.length))), n && (n.includes(a) ? c = Math.max(c, i + 50 + a.length) : l && r.includes(l) && (c = Math.max(c, i + 35 + l.length))), c > s && (s = c);
807
+ }
808
+ return s;
809
+ }
810
+ function Un(e) {
811
+ const t = f(e), n = m(t);
812
+ if (!n) return [];
813
+ const r = /* @__PURE__ */ new Set([n]), o = L(n);
814
+ o && !Nn.has(t) && r.add(o);
815
+ const i = {
816
+ 内蒙古自治区: "内蒙古",
817
+ 广西壮族自治区: "广西",
818
+ 西藏自治区: "西藏",
819
+ 宁夏回族自治区: "宁夏",
820
+ 新疆维吾尔自治区: "新疆",
821
+ 香港特别行政区: "香港",
822
+ 澳门特别行政区: "澳门"
823
+ };
824
+ return i[t] && r.add(i[t]), Array.from(r).filter(Boolean);
825
+ }
826
+ function jn() {
827
+ if (se) return se;
828
+ const e = globalThis.__SMART_FILL_ADDRESS_MAP__, t = e == null ? void 0 : e.data, n = Array.isArray(t) ? t : Array.isArray(t == null ? void 0 : t.data) ? t.data : [];
829
+ return se = Gn(n), se;
830
+ }
831
+ function Gn(e) {
832
+ const t = [], n = /* @__PURE__ */ new Set(), r = (o) => {
833
+ const i = o.map((a) => f(a)).filter(Boolean);
834
+ if (!i.length) return;
835
+ const s = i.join(">");
836
+ n.has(s) || (n.add(s), t.push({
837
+ labels: i,
838
+ aliasesByLevel: i.map((a) => Un(a))
839
+ }));
840
+ };
841
+ for (const o of e)
842
+ if (o != null && o.label && (r([o.label]), !(!Array.isArray(o.children) || !o.children.length))) {
843
+ for (const i of o.children)
844
+ if (i != null && i.label && (r([o.label, i.label]), !(!Array.isArray(i.children) || !i.children.length)))
845
+ for (const s of i.children)
846
+ s != null && s.label && r([o.label, i.label, s.label]);
847
+ }
848
+ return t;
849
+ }
850
+ function xe(e, t) {
851
+ const n = ke(t);
645
852
  if (!n.length) return null;
646
853
  let r = null, o = 0;
647
854
  for (const i of e) {
648
- const s = w(i.value), a = w(i.label);
855
+ const s = C(i.value), a = C(i.label);
649
856
  for (const c of n) {
650
857
  let l = 0;
651
- c === s || c === a ? l = 120 : s && c.includes(s) || a && c.includes(a) ? l = 100 : s && s.includes(c) || a && a.includes(c) ? l = 90 : (s && re(s) === re(c) || a && re(a) === re(c)) && (l = 80), l > o && (o = l, r = i);
858
+ c === s || c === a ? l = 120 : s && c.includes(s) || a && c.includes(a) ? l = 100 : s && s.includes(c) || a && a.includes(c) ? l = 90 : (s && ce(s) === ce(c) || a && ce(a) === ce(c)) && (l = 80), l > o && (o = l, r = i);
652
859
  }
653
860
  }
654
861
  return o >= 80 ? r : null;
655
862
  }
656
- function me(e) {
863
+ function ke(e) {
657
864
  if (Array.isArray(e))
658
- return e.flatMap((n) => me(n));
865
+ return e.flatMap((n) => ke(n));
659
866
  if (typeof e == "object" && e) {
660
867
  const n = e;
661
- return [n.label, n.value, n.text, n.answer, n.name].filter((r) => r != null).map((r) => w(r)).filter(Boolean);
868
+ return [n.label, n.value, n.text, n.answer, n.name].filter((r) => r != null).map((r) => C(r)).filter(Boolean);
662
869
  }
663
- const t = w(e);
870
+ const t = C(e);
664
871
  return t ? [t] : [];
665
872
  }
666
- function w(e) {
873
+ function C(e) {
667
874
  return String(e ?? "").replace(/\s+/g, "").replace(/[::,,。.、()()\-_/]/g, "").trim().toLowerCase();
668
875
  }
669
- function re(e) {
670
- return w(e).replace(/(请选择|选择|状态|情况|类型|方式|所属|是否)$/g, "");
876
+ function ce(e) {
877
+ return C(e).replace(/(请选择|选择|状态|情况|类型|方式|所属|是否)$/g, "");
671
878
  }
672
- const de = [
879
+ const me = [
673
880
  ".ant-select-item-option",
674
881
  ".el-select-dropdown__item",
675
882
  ".el-select-v2__option",
@@ -686,114 +893,113 @@ const de = [
686
893
  ".van-dropdown-item__option",
687
894
  ".van-radio",
688
895
  "[role='option']"
689
- ].join(", "), Cn = [
896
+ ].join(", "), Yn = [
690
897
  ".el-cascader-panel .el-cascader-menu",
691
898
  ".ant-cascader-menu",
692
899
  ".van-cascader__options",
693
900
  ".n-cascader-menu",
694
901
  ".arco-cascader-list"
695
- ].join(", "), An = [
902
+ ].join(", "), Wn = [
696
903
  ".el-cascader-node",
697
904
  ".ant-cascader-menu-item",
698
905
  ".van-cascader__option",
699
906
  ".n-cascader-node",
700
907
  ".arco-cascader-option"
701
- ].join(", "), Tn = ".van-picker__confirm, .van-picker__toolbar .van-picker__confirm";
702
- async function Ln(e, t, n, r) {
703
- const o = At(t, r);
704
- return e instanceof HTMLSelectElement ? In(e, o) : C(e) || n === "cascader" ? Mn(e, o) : (j(e) || E(e) || n === "select" || n === "date", je(e, o));
908
+ ].join(", "), Xn = ".van-picker__confirm, .van-picker__toolbar .van-picker__confirm";
909
+ async function Zn(e, t, n, r) {
910
+ const o = Dt(t, r);
911
+ return e instanceof HTMLSelectElement ? Jn(e, o) : T(e) || n === "cascader" ? Qn(e, o) : (X(e) || k(e) || n === "select" || n === "date", Je(e, o));
705
912
  }
706
- function $e(e) {
913
+ function qt(e) {
707
914
  if (e instanceof HTMLSelectElement) {
708
915
  const n = e.options[e.selectedIndex];
709
- return p((n == null ? void 0 : n.textContent) || e.value);
916
+ return f((n == null ? void 0 : n.textContent) || e.value);
710
917
  }
711
- if (C(e)) {
918
+ if (T(e)) {
712
919
  const n = e.querySelector("input");
713
- if (n != null && n.value) return p(n.value);
920
+ if (n != null && n.value) return f(n.value);
714
921
  const r = e.querySelector(".el-cascader__tags-text, .el-cascader__label");
715
- return p((r == null ? void 0 : r.textContent) || "");
922
+ return f((r == null ? void 0 : r.textContent) || "");
716
923
  }
717
- if (j(e) || E(e))
718
- return an(e);
924
+ if (X(e) || k(e))
925
+ return vn(e);
719
926
  const t = e.querySelector("input, textarea");
720
- return p((t == null ? void 0 : t.value) || e.textContent || "");
927
+ return f((t == null ? void 0 : t.value) || e.textContent || "");
721
928
  }
722
- async function In(e, t) {
929
+ async function Jn(e, t) {
723
930
  const n = Array.from(e.options).map((o) => ({
724
931
  source: o,
725
932
  value: o.value,
726
933
  label: o.textContent
727
- })), r = be(n, t.searchValue);
934
+ })), r = xe(n, t.searchValue);
728
935
  if ((r == null ? void 0 : r.source) instanceof HTMLOptionElement) {
729
- he(e, r.source.value), _(e);
936
+ G(e, r.source.value), x(e);
730
937
  return;
731
938
  }
732
- if (!V(e, t))
939
+ if (!pe(e, t))
733
940
  throw new Error("原生下拉框中没有匹配到对应选项");
734
941
  }
735
- async function je(e, t) {
736
- const n = G(e) || e;
737
- if (Se(n, t.searchValue)) return;
738
- const r = new Set(W());
942
+ async function Je(e, t) {
943
+ const n = Z(e) || e;
944
+ if (Ae(n, t.searchValue)) return;
945
+ const r = new Set(Q());
739
946
  try {
740
- if (!await Rn(n)) {
741
- if (V(n, t)) return;
947
+ if (!await er(n)) {
948
+ if (pe(n, t)) return;
742
949
  throw new Error("自定义下拉框未能成功展开");
743
950
  }
744
- const i = await Kn(n, r), s = await On(t.searchValue, i, !0);
951
+ const i = await ur(n, r), s = await nr(t.searchValue, i, !0);
745
952
  if (!(s != null && s.source)) {
746
- if (await fe(n), V(n, t)) return;
953
+ if (await ve(n), pe(n, t)) return;
747
954
  throw new Error("自定义下拉框展开后未找到匹配选项");
748
955
  }
749
- if (X(s.source), await y(120), Bn(), _(n), await y(120), Se(n, t.searchValue) || V(n, t) && Se(n, t.searchValue))
956
+ if (F(s.source), await g(120), fr(), x(n), await g(120), Ae(n, t.searchValue) || pe(n, t) && Ae(n, t.searchValue))
750
957
  return;
751
958
  throw new Error("自定义下拉框点击选项后未成功回填");
752
959
  } finally {
753
- await fe(n), await y(80);
960
+ await ve(n), await g(80);
754
961
  }
755
962
  }
756
- async function Mn(e, t) {
963
+ async function Qn(e, t) {
757
964
  const n = e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
758
- if (!ve(n, t.searchValue)) {
965
+ if (!tt(n, t.searchValue)) {
966
+ he(n) && (await Qe(n), await g(120));
759
967
  try {
760
- if (await Fn(n)) {
761
- const o = await Pn(t.searchValue);
762
- if (await y(180), await fe(n), await y(120), o && ve(n, t.searchValue)) {
763
- _(n);
968
+ if (await tr(n)) {
969
+ const o = await ir(t.searchValue);
970
+ if (await g(180), await ve(n), await g(120), o && tt(n, t.searchValue)) {
971
+ x(n);
764
972
  return;
765
973
  }
766
974
  }
767
- if (Hn(n, t.fillValue) && ve(n, t.searchValue))
768
- return;
769
975
  } finally {
770
- await fe(n), await y(80);
976
+ await ve(n), await g(80);
771
977
  }
772
- throw new Error("级联选择框匹配失败");
978
+ throw await Qe(n), new Error("级联选择框匹配失败");
773
979
  }
774
980
  }
775
- function At(e, t) {
981
+ function Dt(e, t) {
776
982
  var s;
777
- const n = (s = t == null ? void 0 : t.options) != null && s.length ? be(
983
+ const n = (s = t == null ? void 0 : t.options) != null && s.length ? xe(
778
984
  t.options.map((a) => ({
779
985
  value: String(a.value),
780
986
  label: a.label
781
987
  })),
782
988
  e
783
- ) : null, r = A(e), o = p(String((n == null ? void 0 : n.label) ?? r ?? "")), i = p(String((n == null ? void 0 : n.value) ?? (n == null ? void 0 : n.label) ?? r ?? ""));
989
+ ) : null, r = P(e), o = f(String((n == null ? void 0 : n.label) ?? r ?? "")), i = f(String((n == null ? void 0 : n.value) ?? (n == null ? void 0 : n.label) ?? r ?? ""));
784
990
  return {
785
991
  searchValue: n ? [e, n.label, n.value] : e,
786
992
  fillValue: i,
787
993
  displayValue: o
788
994
  };
789
995
  }
790
- async function Rn(e) {
791
- const t = Ne(e);
996
+ async function er(e) {
997
+ const t = je(e);
792
998
  for (const n of t)
793
- if (Lt(n), X(n), await y(160), Ge(e) || (It(n), await y(180), Ge(e))) return !0;
999
+ if (zt(n), F(n), await g(160), et(e) || (Kt(n), await g(180), et(e))) return !0;
794
1000
  return !1;
795
1001
  }
796
- async function Fn(e) {
1002
+ async function tr(e) {
797
1003
  const t = [
798
1004
  e,
799
1005
  e.querySelector(".el-input__wrapper"),
@@ -802,123 +1008,167 @@ async function Fn(e) {
802
1008
  e.querySelector("input")
803
1009
  ].filter((n) => n instanceof HTMLElement);
804
1010
  for (const n of t)
805
- if (Lt(n), X(n), await y(180), pe().length || (It(n), await y(180), pe().length)) return !0;
1011
+ if (n.scrollIntoView({ block: "nearest", inline: "nearest" }), zt(n), F(n), await g(180), U().length || (Kt(n), await g(180), U().length)) return !0;
806
1012
  return !1;
807
1013
  }
808
- async function On(e, t, n = !1) {
1014
+ async function nr(e, t, n = !1) {
809
1015
  for (let r = 0; r < 12; r += 1) {
810
- const o = be(
811
- Tt(t, n).map((i) => ({
1016
+ const o = xe(
1017
+ Nt(t, n).map((i) => ({
812
1018
  source: i,
813
- value: qn(i),
814
- label: Dn(i)
1019
+ value: rr(i),
1020
+ label: or(i)
815
1021
  })),
816
1022
  e
817
1023
  );
818
1024
  if (o) return o;
819
- await y(100);
1025
+ await g(100);
820
1026
  }
821
1027
  return null;
822
1028
  }
823
- function qn(e) {
1029
+ function rr(e) {
824
1030
  return e.getAttribute("data-value") || e.getAttribute("data-name") || e.getAttribute("value") || e.getAttribute("name") || e.textContent || "";
825
1031
  }
826
- function Dn(e) {
1032
+ function or(e) {
827
1033
  var t;
828
- return p(
1034
+ return f(
829
1035
  ((t = e.querySelector(".van-action-sheet__name, .el-cascader-node__label, .ant-cascader-menu-item-content, .n-cascader-node__label, .arco-cascader-option-label")) == null ? void 0 : t.textContent) || e.textContent || ""
830
1036
  );
831
1037
  }
832
- async function Pn(e) {
833
- const t = jn(e);
834
- if (!t.length) return !1;
835
- for (let n = 0; n < t.length; n += 1) {
836
- const r = pe();
837
- if (!r.length) return n > 0;
838
- const o = r[r.length - 1], i = Array.from(o.querySelectorAll(An)).filter((a) => !a.classList.contains("is-disabled") && a.getAttribute("aria-disabled") !== "true"), s = be(
839
- i.map((a) => {
840
- var c;
841
- return {
842
- source: a,
843
- value: a.getAttribute("data-value") || a.textContent,
844
- label: ((c = a.querySelector(".el-cascader-node__label")) == null ? void 0 : c.textContent) || a.textContent
845
- };
846
- }),
847
- t[n]
848
- );
849
- if (!(s != null && s.source)) return !1;
850
- X(s.source), await y(220);
1038
+ async function ir(e) {
1039
+ const t = Ee(e), n = Ue(e, t), r = $t(e), o = Math.max(n.length, r.length, 1);
1040
+ if (!t.fullText && !t.structuredParts.length && !r.length)
1041
+ return !1;
1042
+ for (let i = 0; i < o; i += 1) {
1043
+ const s = U();
1044
+ if (!s.length) return i > 0;
1045
+ const a = s[Math.min(i, s.length - 1)], c = Array.from(a.querySelectorAll(Wn)).filter((u) => !u.classList.contains("is-disabled") && u.getAttribute("aria-disabled") !== "true");
1046
+ if (!c.length) return !1;
1047
+ let l = null;
1048
+ if ((n.length || t.structuredParts.length) && (l = $n(c, t, n, i)), !l && r[i]) {
1049
+ const u = xe(
1050
+ c.map((p) => {
1051
+ var y;
1052
+ return {
1053
+ source: p,
1054
+ value: p.getAttribute("data-value") || p.textContent,
1055
+ label: ((y = p.querySelector(".el-cascader-node__label")) == null ? void 0 : y.textContent) || p.textContent
1056
+ };
1057
+ }),
1058
+ r[i]
1059
+ );
1060
+ l = (u == null ? void 0 : u.source) instanceof HTMLElement ? u.source : null;
1061
+ }
1062
+ if (!l) return !1;
1063
+ if (F(l), await g(220), !U().length) return !0;
851
1064
  }
852
- return !pe().length || !0;
1065
+ return !U().length || !0;
853
1066
  }
854
- function V(e, t) {
855
- const n = Vn(t) ? t : At(t), r = n.displayValue || A(t), o = n.fillValue || r;
1067
+ function pe(e, t) {
1068
+ const n = lr(t) ? t : Dt(t), r = n.displayValue || P(t), o = n.fillValue || r;
856
1069
  if (!r && !o) return !1;
857
- const i = G(e) || e;
858
- if (E(i))
859
- return $n(i, r, o);
1070
+ const i = Z(e) || e;
1071
+ if (k(i))
1072
+ return ar(i, r, o);
860
1073
  if (e instanceof HTMLSelectElement) {
861
1074
  let l = Array.from(e.options).find((u) => u.dataset.smartFillFallbackOption === "true");
862
- return l || (l = document.createElement("option"), l.dataset.smartFillFallbackOption = "true", e.appendChild(l)), l.value = o, l.textContent = r || o, l.selected = !0, he(e, o), _(e), !0;
1075
+ return l || (l = document.createElement("option"), l.dataset.smartFillFallbackOption = "true", e.appendChild(l)), l.value = o, l.textContent = r || o, l.selected = !0, G(e, o), x(e), !0;
863
1076
  }
864
1077
  const s = e.querySelector('input:not([type="hidden"])');
865
1078
  if (!(s instanceof HTMLInputElement) || s.disabled) return !1;
866
1079
  const a = s.readOnly, c = s.hasAttribute("readonly");
867
1080
  try {
868
- return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), he(s, r), s.dispatchEvent(new InputEvent("input", {
1081
+ return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), G(s, r), s.dispatchEvent(new InputEvent("input", {
869
1082
  bubbles: !0,
870
1083
  composed: !0,
871
1084
  data: r,
872
1085
  inputType: "insertReplacementText"
873
- })), s.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), _(s), _(e), s.blur(), !0;
1086
+ })), s.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), x(s), x(e), s.blur(), !0;
874
1087
  } catch {
875
1088
  return !1;
876
1089
  } finally {
877
1090
  a && (s.readOnly = !0, c && s.setAttribute("readonly", ""));
878
1091
  }
879
1092
  }
880
- function Hn(e, t) {
881
- const n = e.querySelector("input"), r = A(t);
882
- return !(n instanceof HTMLInputElement) || !r || n.disabled ? !1 : V(e, {
883
- searchValue: t,
884
- fillValue: r,
885
- displayValue: r
886
- });
1093
+ function sr(e) {
1094
+ const t = Ee(e), n = Ue(e, t);
1095
+ if (n.length) return n.join(" / ");
1096
+ const r = $t(e);
1097
+ return r.length ? r.join(" / ") : Be(e);
1098
+ }
1099
+ function Pt(e) {
1100
+ const t = e.querySelector("input");
1101
+ return t instanceof HTMLInputElement ? t : null;
887
1102
  }
888
- function $n(e, t, n) {
889
- Nn(e);
1103
+ function Ht(e) {
1104
+ const t = Pt(e);
1105
+ if (t != null && t.value) return f(t.value);
1106
+ const n = e.querySelector(".el-cascader__tags-text, .el-cascader__label");
1107
+ return f((n == null ? void 0 : n.textContent) || "");
1108
+ }
1109
+ function he(e) {
1110
+ return !!m(Ht(e));
1111
+ }
1112
+ async function Qe(e) {
1113
+ if (!he(e)) return;
1114
+ const t = e.querySelector(".el-input__wrapper, .el-input, .ant-select-selector");
1115
+ t && (t.dispatchEvent(new MouseEvent("mouseenter", { bubbles: !0 })), t.dispatchEvent(new MouseEvent("mouseover", { bubbles: !0 })), await g(80));
1116
+ const n = e.querySelector(
1117
+ ".el-input__clear, .el-icon-circle-close, .ant-select-clear, .ant-cascader-picker-clear, .van-icon-clear"
1118
+ );
1119
+ if (n && (F(n), await g(180), !he(e)))
1120
+ return;
1121
+ const r = Pt(e);
1122
+ if (r && !r.disabled) {
1123
+ const i = r.readOnly, s = r.hasAttribute("readonly");
1124
+ try {
1125
+ i && (r.readOnly = !1, r.removeAttribute("readonly")), G(r, ""), r.dispatchEvent(new InputEvent("input", {
1126
+ bubbles: !0,
1127
+ composed: !0,
1128
+ inputType: "deleteContentBackward"
1129
+ })), r.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), x(r);
1130
+ } finally {
1131
+ i && (r.readOnly = !0, s && r.setAttribute("readonly", ""));
1132
+ }
1133
+ await g(120);
1134
+ }
1135
+ const o = e.querySelector(".el-tag__close, .el-cascader__tags .el-icon-close");
1136
+ o && he(e) && (F(o), await g(120));
1137
+ }
1138
+ function ar(e, t, n) {
1139
+ cr(e);
890
1140
  const r = e.querySelector(".van-field__control"), o = Array.from(e.querySelectorAll('input[type="hidden"]')), i = Array.from(e.querySelectorAll('input:not([type="hidden"])'));
891
- r instanceof HTMLInputElement ? K(r, t || n) : r instanceof HTMLElement && (r.textContent = t || n);
1141
+ r instanceof HTMLInputElement ? B(r, t || n) : r instanceof HTMLElement && (r.textContent = t || n);
892
1142
  for (const s of o)
893
- K(s, n);
1143
+ B(s, n);
894
1144
  for (const s of i)
895
- r !== s && K(s, t || n);
896
- return _(e), !0;
1145
+ r !== s && B(s, t || n);
1146
+ return x(e), !0;
897
1147
  }
898
- function Nn(e) {
1148
+ function cr(e) {
899
1149
  const t = e.querySelector(".van-field__control");
900
- t instanceof HTMLInputElement ? K(t, "") : t instanceof HTMLElement && (t.textContent = "");
1150
+ t instanceof HTMLInputElement ? B(t, "") : t instanceof HTMLElement && (t.textContent = "");
901
1151
  for (const n of e.querySelectorAll("input"))
902
- K(n, "");
1152
+ B(n, "");
903
1153
  }
904
- function K(e, t) {
1154
+ function B(e, t) {
905
1155
  if (e.disabled) return;
906
1156
  const n = e.readOnly, r = e.hasAttribute("readonly");
907
1157
  try {
908
- n && (e.readOnly = !1, e.removeAttribute("readonly")), he(e, t), e.dispatchEvent(new InputEvent("input", {
1158
+ n && (e.readOnly = !1, e.removeAttribute("readonly")), G(e, t), e.dispatchEvent(new InputEvent("input", {
909
1159
  bubbles: !0,
910
1160
  composed: !0,
911
1161
  data: t,
912
1162
  inputType: t ? "insertReplacementText" : "deleteContentBackward"
913
- })), e.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), _(e);
1163
+ })), e.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), x(e);
914
1164
  } finally {
915
1165
  n && (e.readOnly = !0, r && e.setAttribute("readonly", ""));
916
1166
  }
917
1167
  }
918
- function Vn(e) {
1168
+ function lr(e) {
919
1169
  return typeof e == "object" && e != null && "searchValue" in e && "fillValue" in e && "displayValue" in e;
920
1170
  }
921
- function Ne(e) {
1171
+ function je(e) {
922
1172
  return [
923
1173
  e,
924
1174
  e.querySelector(".van-field__control"),
@@ -938,68 +1188,76 @@ function Ne(e) {
938
1188
  e.querySelector(".select__wrapper")
939
1189
  ].filter((n) => n instanceof HTMLElement).filter((n, r, o) => o.indexOf(n) === r);
940
1190
  }
941
- function Tt(e, t) {
942
- return (e.length ? e : W()).flatMap((o) => o.matches(de) ? [o] : Array.from(o.querySelectorAll(de))).filter((o, i, s) => s.indexOf(o) === i).filter((o) => t ? !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true" : D(o) && !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true");
1191
+ function Nt(e, t) {
1192
+ return (e.length ? e : Q()).flatMap((o) => o.matches(me) ? [o] : Array.from(o.querySelectorAll(me))).filter((o, i, s) => s.indexOf(o) === i).filter((o) => t ? !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true" : N(o) && !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true");
943
1193
  }
944
- function pe() {
945
- return Array.from(document.querySelectorAll(Cn)).filter(D);
1194
+ function U() {
1195
+ return Array.from(document.querySelectorAll(Yn)).filter(N);
946
1196
  }
947
- async function Kn(e, t) {
1197
+ async function ur(e, t) {
948
1198
  for (let n = 0; n < 10; n += 1) {
949
- const r = zn(e, t);
1199
+ const r = dr(e, t);
950
1200
  if (r.length) return r;
951
- await y(80);
1201
+ await g(80);
952
1202
  }
953
- return W().filter(D);
1203
+ return Q().filter(N);
954
1204
  }
955
- function zn(e, t) {
956
- const n = W(), r = n.filter((i) => !t.has(i));
1205
+ function dr(e, t) {
1206
+ const n = Q(), r = n.filter((i) => !t.has(i));
957
1207
  if (r.length)
958
- return r.sort((i, s) => oe(s) - oe(i));
1208
+ return r.sort((i, s) => le(s) - le(i));
959
1209
  const o = new Set(
960
- Ne(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
1210
+ je(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
961
1211
  );
962
1212
  if (o.size) {
963
1213
  const i = n.filter((s) => o.has(s.id));
964
1214
  if (i.length) return i;
965
1215
  }
966
- return n.filter((i) => D(i) && (i.querySelector(de) || i.matches(de))).sort((i, s) => oe(s) - oe(i)).slice(0, 1);
967
- }
968
- function Ge(e) {
969
- return Tt(W().filter(D), !1).length > 0 ? !0 : Ne(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused"));
970
- }
971
- function ve(e, t) {
972
- const n = w($e(e)), r = w(A(t));
973
- return !n || !r ? !1 : n === r || n.includes(r) || r.includes(n);
974
- }
975
- function Se(e, t) {
976
- const n = w($e(e));
1216
+ return n.filter((i) => N(i) && (i.querySelector(me) || i.matches(me))).sort((i, s) => le(s) - le(i)).slice(0, 1);
1217
+ }
1218
+ function et(e) {
1219
+ return Nt(Q().filter(N), !1).length > 0 ? !0 : je(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused"));
1220
+ }
1221
+ function tt(e, t) {
1222
+ const n = Ht(e), r = m(n);
1223
+ if (!r) return !1;
1224
+ const o = Be(t), i = m(o);
1225
+ if (ae(r, i)) return !0;
1226
+ const s = Ee(t), a = Ue(t, s), c = m(a.join(""));
1227
+ if (ae(r, c)) return !0;
1228
+ const l = m(sr(t));
1229
+ if (ae(r, l)) return !0;
1230
+ const u = m(s.structuredParts.join(""));
1231
+ return ae(r, u);
1232
+ }
1233
+ function Ae(e, t) {
1234
+ const n = C(qt(e));
977
1235
  if (!n) return !1;
978
- const r = me(t);
1236
+ const r = ke(t);
979
1237
  if (!r.length) {
980
- const o = w(A(t));
1238
+ const o = C(P(t));
981
1239
  return o ? n === o || n.includes(o) || o.includes(n) : !1;
982
1240
  }
983
1241
  return r.some((o) => {
984
- const i = w(o);
1242
+ const i = C(o);
985
1243
  return !!i && (n === i || n.includes(i) || i.includes(n));
986
1244
  });
987
1245
  }
988
- function Bn() {
989
- const e = document.querySelector(Tn);
990
- e && D(e) && X(e);
1246
+ function fr() {
1247
+ const e = document.querySelector(Xn);
1248
+ e && N(e) && F(e);
991
1249
  }
992
- async function fe(e) {
993
- e == null || e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await y(120);
1250
+ async function ve(e) {
1251
+ e == null || e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await g(120);
994
1252
  }
995
- function W() {
996
- return Array.from(document.querySelectorAll(Un()));
1253
+ function Q() {
1254
+ return Array.from(document.querySelectorAll(pr()));
997
1255
  }
998
- function oe(e) {
1256
+ function le(e) {
999
1257
  const t = e.getBoundingClientRect(), n = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
1000
1258
  return (Number.isNaN(n) ? 0 : n) * 10 + t.width * t.height;
1001
1259
  }
1002
- function Un() {
1260
+ function pr() {
1003
1261
  return [
1004
1262
  ".el-select-dropdown",
1005
1263
  ".el-cascader__dropdown",
@@ -1025,162 +1283,162 @@ function Un() {
1025
1283
  "[role='listbox']"
1026
1284
  ].join(", ");
1027
1285
  }
1028
- function A(e) {
1286
+ function P(e) {
1029
1287
  if (e == null) return "";
1030
1288
  if (typeof e == "string" || typeof e == "number" || typeof e == "boolean")
1031
- return p(String(e));
1289
+ return f(String(e));
1032
1290
  if (Array.isArray(e))
1033
- return e.map((t) => A(t)).filter(Boolean).join(" ");
1291
+ return e.map((t) => P(t)).filter(Boolean).join(" ");
1034
1292
  if (typeof e == "object") {
1035
1293
  const t = e;
1036
1294
  for (const n of ["label", "text", "value", "answer", "name"]) {
1037
- const r = A(t[n]);
1295
+ const r = P(t[n]);
1038
1296
  if (r) return r;
1039
1297
  }
1040
1298
  }
1041
- return p(String(e));
1299
+ return f(String(e));
1042
1300
  }
1043
- function jn(e) {
1044
- const t = A(e);
1301
+ function $t(e) {
1302
+ const t = P(e);
1045
1303
  if (!t) return [];
1046
1304
  if (t.includes("/") || t.includes("、"))
1047
1305
  return t.split(/[//、]/).map((r) => r.trim()).filter(Boolean);
1048
- const n = me(e);
1049
- return n.length ? [p(n[0])] : [t];
1306
+ const n = ke(e);
1307
+ return n.length ? [f(n[0])] : [t];
1050
1308
  }
1051
- function he(e, t) {
1309
+ function G(e, t) {
1052
1310
  var o;
1053
1311
  const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value");
1054
1312
  (o = r == null ? void 0 : r.set) == null || o.call(e, t);
1055
1313
  }
1056
- function _(e) {
1314
+ function x(e) {
1057
1315
  e.dispatchEvent(new Event("focus", { bubbles: !0 })), e.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0, data: null, inputType: "insertText" })), e.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), e.dispatchEvent(new Event("blur", { bubbles: !0 }));
1058
1316
  }
1059
- function X(e) {
1317
+ function F(e) {
1060
1318
  window.PointerEvent && (e.dispatchEvent(new PointerEvent("pointerdown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new PointerEvent("pointerup", { bubbles: !0, composed: !0, button: 0 }))), e.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, composed: !0, button: 0 })), e.click();
1061
1319
  }
1062
- function Lt(e) {
1320
+ function zt(e) {
1063
1321
  e.focus({ preventScroll: !0 });
1064
1322
  const t = e instanceof HTMLInputElement ? e : e.querySelector("input");
1065
1323
  t instanceof HTMLElement && t.focus({ preventScroll: !0 });
1066
1324
  }
1067
- function It(e) {
1325
+ function Kt(e) {
1068
1326
  for (const t of [{ key: "ArrowDown", code: "ArrowDown" }, { key: "Enter", code: "Enter" }, { key: " ", code: "Space" }])
1069
1327
  e.dispatchEvent(new KeyboardEvent("keydown", { ...t, bubbles: !0, composed: !0 })), e.dispatchEvent(new KeyboardEvent("keyup", { ...t, bubbles: !0, composed: !0 }));
1070
1328
  }
1071
- function D(e) {
1329
+ function N(e) {
1072
1330
  const t = window.getComputedStyle(e);
1073
1331
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0) return !1;
1074
1332
  const n = e.getBoundingClientRect();
1075
1333
  return n.width > 0 && n.height > 0;
1076
1334
  }
1077
- function y(e) {
1335
+ function g(e) {
1078
1336
  return new Promise((t) => window.setTimeout(t, e));
1079
1337
  }
1080
- const Ye = /* @__PURE__ */ new Set(["select", "cascader", "date"]), Mt = {
1338
+ const nt = /* @__PURE__ */ new Set(["select", "cascader", "date"]), Vt = {
1081
1339
  name: "ui-framework",
1082
- match: (e) => e.matches(ut) || dt(e) || !Gn(e) && Fe(e),
1340
+ match: (e) => e.matches(mt) || vt(e) || !hr(e) && He(e),
1083
1341
  getValue: (e) => {
1084
1342
  var o, i;
1085
1343
  const t = e.element;
1086
1344
  if (!t) return;
1087
- const n = O(t);
1088
- if ((n == null ? void 0 : n.kind) === "switch") return U(t);
1089
- if ((n == null ? void 0 : n.kind) === "radioGroup") return Zn(t);
1090
- if ((n == null ? void 0 : n.kind) === "checkboxGroup") return Jn(t);
1091
- const r = e.type || ce(t) || (n == null ? void 0 : n.type);
1092
- return r && Ye.has(r) ? $e(t) : n ? ((i = F(t)) == null ? void 0 : i.value) || t.textContent || void 0 : (o = F(t)) == null ? void 0 : o.value;
1345
+ const n = D(t);
1346
+ if ((n == null ? void 0 : n.kind) === "switch") return W(t);
1347
+ if ((n == null ? void 0 : n.kind) === "radioGroup") return mr(t);
1348
+ if ((n == null ? void 0 : n.kind) === "checkboxGroup") return vr(t);
1349
+ const r = e.type || ge(t) || (n == null ? void 0 : n.type);
1350
+ return r && nt.has(r) ? qt(t) : n ? ((i = q(t)) == null ? void 0 : i.value) || t.textContent || void 0 : (o = q(t)) == null ? void 0 : o.value;
1093
1351
  },
1094
1352
  setValue: async (e, t) => {
1095
1353
  const n = e.element;
1096
1354
  if (!n) return;
1097
- const r = O(n);
1355
+ const r = D(n);
1098
1356
  if ((r == null ? void 0 : r.kind) === "switch") {
1099
- Yn(n, t);
1357
+ gr(n, t);
1100
1358
  return;
1101
1359
  }
1102
1360
  if ((r == null ? void 0 : r.kind) === "radioGroup") {
1103
- Xn(n, t);
1361
+ br(n, t);
1104
1362
  return;
1105
1363
  }
1106
1364
  if ((r == null ? void 0 : r.kind) === "checkboxGroup") {
1107
- Wn(n, t);
1365
+ yr(n, t);
1108
1366
  return;
1109
1367
  }
1110
- const o = e.type || ce(n) || (r == null ? void 0 : r.type);
1111
- if (o && Ye.has(o) || Fe(n, o || void 0)) {
1112
- await Ln(n, t, o || "select", e);
1368
+ const o = e.type || ge(n) || (r == null ? void 0 : r.type);
1369
+ if (o && nt.has(o) || He(n, o || void 0)) {
1370
+ await Zn(n, t, o || "select", e);
1113
1371
  return;
1114
1372
  }
1115
- const i = F(n);
1373
+ const i = q(n);
1116
1374
  if (i) {
1117
- Qn(i, t);
1375
+ wr(i, t);
1118
1376
  return;
1119
1377
  }
1120
1378
  n.dispatchEvent(new Event("change", { bubbles: !0 }));
1121
1379
  }
1122
- }, Mo = Mt;
1123
- function Gn(e) {
1380
+ }, Jo = Vt;
1381
+ function hr(e) {
1124
1382
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
1125
1383
  }
1126
- function Yn(e, t) {
1127
- U(e) !== er(t) && ge(e);
1384
+ function gr(e, t) {
1385
+ W(e) !== Sr(t) && we(e);
1128
1386
  }
1129
- function Wn(e, t) {
1387
+ function yr(e, t) {
1130
1388
  var o;
1131
- const n = new Set(tr(t).map(k)), r = pt(e) || [];
1132
- for (const i of B(e)) {
1133
- const s = Z(i.textContent || ""), a = i.getAttribute("value") || ((o = i.querySelector("input")) == null ? void 0 : o.value) || s, c = U(i), l = n.has(k(String(a))) || n.has(k(s));
1134
- c !== l && ge(i);
1389
+ const n = new Set(Er(t).map(A)), r = wt(e) || [];
1390
+ for (const i of Y(e)) {
1391
+ const s = ee(i.textContent || ""), a = i.getAttribute("value") || ((o = i.querySelector("input")) == null ? void 0 : o.value) || s, c = W(i), l = n.has(A(String(a))) || n.has(A(s));
1392
+ c !== l && we(i);
1135
1393
  }
1136
- if (!B(e).length && r.length)
1394
+ if (!Y(e).length && r.length)
1137
1395
  for (const i of r)
1138
- (n.has(k(String(i.value))) || n.has(k(i.label))) && ge(e);
1396
+ (n.has(A(String(i.value))) || n.has(A(i.label))) && we(e);
1139
1397
  }
1140
- function Xn(e, t) {
1141
- const n = k(String(t ?? "")), r = B(e).find((o) => {
1398
+ function br(e, t) {
1399
+ const n = A(String(t ?? "")), r = Y(e).find((o) => {
1142
1400
  var a;
1143
- const i = Z(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1144
- return k(String(s)) === n || k(i) === n;
1401
+ const i = ee(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1402
+ return A(String(s)) === n || A(i) === n;
1145
1403
  });
1146
- r && ge(r);
1404
+ r && we(r);
1147
1405
  }
1148
- function Zn(e) {
1406
+ function mr(e) {
1149
1407
  var n;
1150
- const t = B(e).find((r) => U(r));
1408
+ const t = Y(e).find((r) => W(r));
1151
1409
  if (t)
1152
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1410
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || ee(t.textContent || "");
1153
1411
  }
1154
- function Jn(e) {
1155
- return B(e).filter((t) => U(t)).map((t) => {
1412
+ function vr(e) {
1413
+ return Y(e).filter((t) => W(t)).map((t) => {
1156
1414
  var n;
1157
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1415
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || ee(t.textContent || "");
1158
1416
  });
1159
1417
  }
1160
- function B(e) {
1161
- const t = O(e);
1418
+ function Y(e) {
1419
+ const t = D(e);
1162
1420
  return t != null && t.optionSelector ? Array.from(e.querySelectorAll(t.optionSelector)) : [];
1163
1421
  }
1164
- function Qn(e, t) {
1422
+ function wr(e, t) {
1165
1423
  e.value = String(t ?? ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("blur", { bubbles: !0 }));
1166
1424
  }
1167
- function ge(e) {
1425
+ function we(e) {
1168
1426
  e.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window }));
1169
1427
  }
1170
- function er(e) {
1428
+ function Sr(e) {
1171
1429
  return typeof e == "boolean" ? e : ["true", "1", "是", "开启", "启用", "yes", "y"].includes(String(e ?? "").trim().toLowerCase());
1172
1430
  }
1173
- function tr(e) {
1431
+ function Er(e) {
1174
1432
  return Array.isArray(e) ? e.map(String) : String(e ?? "").split(/[,,;;、]/).map((t) => t.trim()).filter(Boolean);
1175
1433
  }
1176
- function k(e) {
1177
- return Z(e).toLowerCase();
1434
+ function A(e) {
1435
+ return ee(e).toLowerCase();
1178
1436
  }
1179
- function Z(e) {
1437
+ function ee(e) {
1180
1438
  return e.replace(/\s+/g, " ").trim();
1181
1439
  }
1182
- const nr = "https://uat.kingdeefin.com";
1183
- class Rt extends Error {
1440
+ const xr = "https://uat.kingdeefin.com";
1441
+ class Bt extends Error {
1184
1442
  constructor(n) {
1185
1443
  super(n.message);
1186
1444
  /** 结构化错误信息,含 code / stage / retryable */
@@ -1188,26 +1446,26 @@ class Rt extends Error {
1188
1446
  this.name = "SmartFillException", this.smartFillError = n;
1189
1447
  }
1190
1448
  }
1191
- function b(e, t, n, r = {}) {
1192
- return new Rt({ code: e, message: t, stage: n, ...r });
1449
+ function v(e, t, n, r = {}) {
1450
+ return new Bt({ code: e, message: t, stage: n, ...r });
1193
1451
  }
1194
- function We(e, t, n = "RECOGNIZE_FAILED") {
1195
- return e instanceof Rt ? e.smartFillError : {
1452
+ function rt(e, t, n = "RECOGNIZE_FAILED") {
1453
+ return e instanceof Bt ? e.smartFillError : {
1196
1454
  code: n,
1197
1455
  message: e instanceof Error ? e.message : String(e || "智能录入异常"),
1198
1456
  stage: t,
1199
1457
  retryable: t === "recognize"
1200
1458
  };
1201
1459
  }
1202
- function ye(e = "sf") {
1460
+ function Se(e = "sf") {
1203
1461
  return `${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
1204
1462
  }
1205
- class rr {
1463
+ class kr {
1206
1464
  constructor(t) {
1207
1465
  /** 会话 accessToken,写入请求头 seToken */
1208
1466
  d(this, "seToken", "");
1209
1467
  /** 网关根地址,见 config/defaults.ts */
1210
- d(this, "baseURL", nr);
1468
+ d(this, "baseURL", xr);
1211
1469
  this.config = t;
1212
1470
  }
1213
1471
  /** 设置会话 token,后续 request 自动携带 seToken 请求头 */
@@ -1220,7 +1478,7 @@ class rr {
1220
1478
  */
1221
1479
  async createSession() {
1222
1480
  if (!/^seKey-[A-Za-z0-9_-]{6,}$/.test(this.config.apiKey))
1223
- throw b("API_KEY_INVALID", "apiKey 格式不正确,应以 seKey- 开头。", "setup");
1481
+ throw v("API_KEY_INVALID", "apiKey 格式不正确,应以 seKey- 开头。", "setup");
1224
1482
  return {
1225
1483
  apiKey: this.config.apiKey,
1226
1484
  rulesVersion: "0.0.1"
@@ -1265,17 +1523,17 @@ class rr {
1265
1523
  // scanToken: payload.scanToken,
1266
1524
  formCode: t.formCode || "",
1267
1525
  configVersion: t.configVersion || "",
1268
- formMsg: t.fields.map(({ fingerprint: c, element: l, localRuleMode: u, scanToken: h, source: T, ...P }) => P),
1526
+ formMsg: t.fields.map(({ fingerprint: c, element: l, localRuleMode: u, scanToken: p, source: y, ...$ }) => $),
1269
1527
  // 将字段描述符转换为后端需要的格式
1270
1528
  userInputMsg: r || ""
1271
1529
  })
1272
1530
  }
1273
- ), i = ir(o, t.fields, t.scanToken);
1531
+ ), i = Ar(o, t.fields, t.scanToken);
1274
1532
  return console.log("suggestions", i), {
1275
1533
  scanToken: t.scanToken,
1276
1534
  suggestions: i,
1277
1535
  trace: o.trace || {
1278
- traceId: ye("trace"),
1536
+ traceId: Se("trace"),
1279
1537
  usedOcr: !!t.usedOcr,
1280
1538
  usedAi: !0,
1281
1539
  durationMs: Math.round(performance.now() - n)
@@ -1294,15 +1552,15 @@ class rr {
1294
1552
  method: "POST",
1295
1553
  body: n
1296
1554
  }
1297
- ), o = ar(r);
1555
+ ), o = Tr(r);
1298
1556
  if (!o)
1299
- throw b("RECOGNIZE_FAILED", "图片识别未提取到文本内容。", "recognize");
1557
+ throw v("RECOGNIZE_FAILED", "图片识别未提取到文本内容。", "recognize");
1300
1558
  return o;
1301
1559
  }
1302
1560
  /** 通用 fetch 封装:超时控制、trace 头、HTTP 错误映射为 SmartFillException */
1303
1561
  async request(t, n) {
1304
1562
  const r = new AbortController(), o = window.setTimeout(() => r.abort(), this.config.requestTimeoutMs ?? 3e4), i = new Headers(n.headers);
1305
- n.body && !(n.body instanceof FormData) && !i.has("Content-Type") && i.set("Content-Type", "application/json"), i.set("x-trace-id", ye("trace")), this.seToken && i.set("seToken", `${this.seToken}`);
1563
+ n.body && !(n.body instanceof FormData) && !i.has("Content-Type") && i.set("Content-Type", "application/json"), i.set("x-trace-id", Se("trace")), this.seToken && i.set("seToken", `${this.seToken}`);
1306
1564
  try {
1307
1565
  const s = await fetch(`${this.baseURL}${t}`, {
1308
1566
  ...n,
@@ -1310,19 +1568,19 @@ class rr {
1310
1568
  signal: r.signal
1311
1569
  });
1312
1570
  if (!s.ok)
1313
- throw b(cr(s.status), await s.text(), t.includes("session") ? "setup" : "recognize", {
1571
+ throw v(Lr(s.status), await s.text(), t.includes("session") ? "setup" : "recognize", {
1314
1572
  retryable: s.status >= 500 || s.status === 429
1315
1573
  });
1316
1574
  return s.json();
1317
1575
  } catch (s) {
1318
- throw s instanceof DOMException && s.name === "AbortError" ? b("RECOGNIZE_TIMEOUT", "识别请求超时,请稍后重试。", "recognize", { retryable: !0 }) : s;
1576
+ throw s instanceof DOMException && s.name === "AbortError" ? v("RECOGNIZE_TIMEOUT", "识别请求超时,请稍后重试。", "recognize", { retryable: !0 }) : s;
1319
1577
  } finally {
1320
1578
  window.clearTimeout(o);
1321
1579
  }
1322
1580
  }
1323
1581
  }
1324
- const or = 0.95;
1325
- function ir(e, t, n) {
1582
+ const _r = 0.95;
1583
+ function Ar(e, t, n) {
1326
1584
  var i;
1327
1585
  const r = new Map(t.map((s) => [s.fieldId, s]));
1328
1586
  return (((i = e.data) == null ? void 0 : i.fieldValues) || []).filter((s) => !!(s != null && s.fieldId)).map((s) => {
@@ -1333,24 +1591,24 @@ function ir(e, t, n) {
1333
1591
  label: s.label || (a == null ? void 0 : a.label) || s.fieldId,
1334
1592
  value: s.value,
1335
1593
  displayValue: s.value == null ? "" : String(s.value),
1336
- confidence: sr(s.confidence),
1594
+ confidence: Cr(s.confidence),
1337
1595
  source: s.source || "ai",
1338
1596
  warnings: s.warnings
1339
1597
  };
1340
1598
  });
1341
1599
  }
1342
- function sr(e) {
1343
- return typeof e != "number" || Number.isNaN(e) ? or : e < 0 ? 0 : e > 1 ? 1 : e;
1600
+ function Cr(e) {
1601
+ return typeof e != "number" || Number.isNaN(e) ? _r : e < 0 ? 0 : e > 1 ? 1 : e;
1344
1602
  }
1345
- function ar(e) {
1603
+ function Tr(e) {
1346
1604
  var n;
1347
1605
  const t = typeof e.data == "string" ? e.data : ((n = e.data) == null ? void 0 : n.text) || e.text || "";
1348
1606
  return String(t || "").trim();
1349
1607
  }
1350
- function cr(e) {
1608
+ function Lr(e) {
1351
1609
  return e === 401 ? "TOKEN_EXPIRED" : e === 403 ? "API_KEY_FORBIDDEN" : e === 404 ? "FORM_CONFIG_NOT_FOUND" : "RECOGNIZE_FAILED";
1352
1610
  }
1353
- class Ft {
1611
+ class Ut {
1354
1612
  constructor() {
1355
1613
  d(this, "handlers", /* @__PURE__ */ new Map());
1356
1614
  }
@@ -1371,7 +1629,7 @@ class Ft {
1371
1629
  this.handlers.clear();
1372
1630
  }
1373
1631
  }
1374
- class lr {
1632
+ class Ir {
1375
1633
  constructor() {
1376
1634
  /** 当前页面所有存活实例 */
1377
1635
  d(this, "instances", /* @__PURE__ */ new Set());
@@ -1395,24 +1653,24 @@ class lr {
1395
1653
  this.instances.forEach((t) => t.destroy()), this.instances.clear(), this.active = null;
1396
1654
  }
1397
1655
  }
1398
- const ur = [
1656
+ const Mr = [
1399
1657
  /^(el|rc|ant|radix|headlessui|mui|chakra)-/i,
1400
1658
  /[0-9a-f]{8,}/i,
1401
1659
  /\d{6,}/
1402
1660
  ];
1403
- function S(e) {
1661
+ function E(e) {
1404
1662
  const t = String(e || "").trim();
1405
- return !t || ur.some((n) => n.test(t)) ? "" : t;
1663
+ return !t || Mr.some((n) => n.test(t)) ? "" : t;
1406
1664
  }
1407
- function z(e) {
1665
+ function j(e) {
1408
1666
  const t = (e.options || []).slice(0, 20).map((n) => `${n.label}:${String(n.value)}`).join("|");
1409
- return q(
1667
+ return H(
1410
1668
  [
1411
1669
  e.fieldId,
1412
1670
  e.tagName,
1413
1671
  e.type,
1414
- S(e.name),
1415
- S(e.id),
1672
+ E(e.name),
1673
+ E(e.id),
1416
1674
  e.label,
1417
1675
  e.placeholder,
1418
1676
  e.section,
@@ -1420,10 +1678,10 @@ function z(e) {
1420
1678
  ].join("::")
1421
1679
  );
1422
1680
  }
1423
- function q(e) {
1681
+ function H(e) {
1424
1682
  return String(e ?? "").replace(/\s+/g, " ").trim().toLowerCase();
1425
1683
  }
1426
- const Xe = "smart-fill-highlight-style", dr = `
1684
+ const ot = "smart-fill-highlight-style", Rr = `
1427
1685
  [data-smart-fill-highlighted="true"] {
1428
1686
  background: #eaf3ff !important;
1429
1687
  box-shadow: 0 0 0 1px #91caff inset !important;
@@ -1451,13 +1709,13 @@ const Xe = "smart-fill-highlight-style", dr = `
1451
1709
  box-shadow: 0 0 0 1px #91caff inset !important;
1452
1710
  }
1453
1711
  `.trim();
1454
- function pr() {
1455
- if (typeof document > "u" || document.getElementById(Xe))
1712
+ function Fr() {
1713
+ if (typeof document > "u" || document.getElementById(ot))
1456
1714
  return;
1457
1715
  const e = document.createElement("style");
1458
- e.id = Xe, e.textContent = dr, document.head.appendChild(e);
1716
+ e.id = ot, e.textContent = Rr, document.head.appendChild(e);
1459
1717
  }
1460
- const Ee = /* @__PURE__ */ new WeakMap(), fr = [
1718
+ const Ce = /* @__PURE__ */ new WeakMap(), Or = [
1461
1719
  'input:not([type="hidden"])',
1462
1720
  "textarea",
1463
1721
  "select",
@@ -1478,7 +1736,7 @@ const Ee = /* @__PURE__ */ new WeakMap(), fr = [
1478
1736
  ".van-field__body",
1479
1737
  "[role='combobox']"
1480
1738
  ].join(", ");
1481
- class Ze {
1739
+ class it {
1482
1740
  constructor(t, n, r = []) {
1483
1741
  this.fields = t, this.schemas = n, this.adapters = r;
1484
1742
  }
@@ -1492,23 +1750,23 @@ class Ze {
1492
1750
  for (const o of t.values) {
1493
1751
  const i = this.fields.find((l) => l.fieldId === o.fieldId);
1494
1752
  if (!i) {
1495
- r.push(se(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1753
+ r.push(de(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1496
1754
  continue;
1497
1755
  }
1498
1756
  if (i.scanToken !== t.scanToken) {
1499
- r.push(se(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1757
+ r.push(de(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1500
1758
  continue;
1501
1759
  }
1502
- const s = wr(this.schemas, o.fieldId), a = s != null && s.transform ? s.transform(o.value) : o.value, c = await this.getValue(i, s);
1760
+ const s = $r(this.schemas, o.fieldId), a = s != null && s.transform ? s.transform(o.value) : o.value, c = await this.getValue(i, s);
1503
1761
  try {
1504
1762
  const l = s != null && s.validate ? await s.validate(a) : !0;
1505
1763
  if (l !== !0) {
1506
- r.push(se(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1764
+ r.push(de(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1507
1765
  continue;
1508
1766
  }
1509
1767
  await this.setValue(i, a, s), n.push({ fieldId: i.fieldId, label: i.label, value: a, previousValue: c });
1510
1768
  } catch (l) {
1511
- r.push(se(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1769
+ r.push(de(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1512
1770
  }
1513
1771
  }
1514
1772
  return {
@@ -1522,7 +1780,7 @@ class Ze {
1522
1780
  if (n != null && n.getValue) return n.getValue();
1523
1781
  const r = this.matchAdapter(t, n);
1524
1782
  if (r != null && r.getValue) return r.getValue(t);
1525
- const o = ie(t, n);
1783
+ const o = ue(t, n);
1526
1784
  if (o)
1527
1785
  return o instanceof HTMLInputElement && o.type === "checkbox" ? o.checked : o instanceof HTMLInputElement && o.type === "radio" ? o.checked ? o.value : void 0 : o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement ? o.value : o.textContent;
1528
1786
  }
@@ -1533,13 +1791,13 @@ class Ze {
1533
1791
  async setValue(t, n, r) {
1534
1792
  if (r != null && r.setValue) {
1535
1793
  await r.setValue(n);
1536
- const s = ie(t, r);
1537
- s && xe(s, t);
1794
+ const s = ue(t, r);
1795
+ s && Te(s, t);
1538
1796
  return;
1539
1797
  }
1540
- const o = ie(t, r);
1798
+ const o = ue(t, r);
1541
1799
  if (!o) throw new Error("页面中未找到对应字段");
1542
- if (t.fingerprint && t.fingerprint !== z({ ...t, tagName: o.tagName.toLowerCase() }))
1800
+ if (t.fingerprint && t.fingerprint !== j({ ...t, tagName: o.tagName.toLowerCase() }))
1543
1801
  throw new Error("字段结构已变化,请重新扫描");
1544
1802
  const i = this.matchAdapter(t, r);
1545
1803
  if (t.disabled || o.hasAttribute("disabled") || o.getAttribute("aria-disabled") === "true")
@@ -1547,24 +1805,24 @@ class Ze {
1547
1805
  if (t.readonly || o.hasAttribute("readonly"))
1548
1806
  throw new Error("字段不可编辑");
1549
1807
  if (i) {
1550
- await i.setValue(t, n), xe(o, t);
1808
+ await i.setValue(t, n), Te(o, t);
1551
1809
  return;
1552
1810
  }
1553
- gr(o, n), xe(o, t);
1811
+ Dr(o, n), Te(o, t);
1554
1812
  }
1555
1813
  /** 匹配第一个适用的组件库适配器 */
1556
1814
  matchAdapter(t, n) {
1557
- const r = ie(t, n);
1815
+ const r = ue(t, n);
1558
1816
  return r ? this.adapters.find((o) => o.match(r, t)) : void 0;
1559
1817
  }
1560
1818
  }
1561
- function ie(e, t) {
1819
+ function ue(e, t) {
1562
1820
  var r;
1563
1821
  if ((r = e.element) != null && r.isConnected) return e.element;
1564
- const n = hr(t == null ? void 0 : t.element);
1565
- return n || document.querySelector(`[data-smart-fill-id="${qe(e.fieldId)}"]`);
1822
+ const n = qr(t == null ? void 0 : t.element);
1823
+ return n || document.querySelector(`[data-smart-fill-id="${$e(e.fieldId)}"]`);
1566
1824
  }
1567
- function hr(e) {
1825
+ function qr(e) {
1568
1826
  if (e instanceof HTMLElement)
1569
1827
  return e.isConnected ? e : null;
1570
1828
  if (typeof e == "string")
@@ -1576,73 +1834,73 @@ function hr(e) {
1576
1834
  }
1577
1835
  return null;
1578
1836
  }
1579
- function gr(e, t) {
1837
+ function Dr(e, t) {
1580
1838
  if (e instanceof HTMLInputElement && e.type === "checkbox")
1581
1839
  e.checked = !!t;
1582
1840
  else if (e instanceof HTMLInputElement && e.type === "radio") {
1583
- const n = document.querySelector(`input[type="radio"][name="${qe(e.name)}"][value="${qe(String(t))}"]`);
1841
+ const n = document.querySelector(`input[type="radio"][name="${$e(e.name)}"][value="${$e(String(t))}"]`);
1584
1842
  (n || e).checked = !0;
1585
1843
  } else e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value = String(t ?? "") : e.isContentEditable && (e.textContent = String(t ?? ""));
1586
1844
  e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
1587
1845
  }
1588
- function xe(e, t) {
1589
- pr();
1590
- const n = yr(e, t), r = () => {
1846
+ function Te(e, t) {
1847
+ Fr();
1848
+ const n = Pr(e, t), r = () => {
1591
1849
  for (const o of n)
1592
- o.isConnected && br(o);
1850
+ o.isConnected && Hr(o);
1593
1851
  };
1594
1852
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => requestAnimationFrame(r)) : r();
1595
1853
  }
1596
- function yr(e, t) {
1854
+ function Pr(e, t) {
1597
1855
  if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)
1598
1856
  return [e];
1599
- const n = Fe(e, t == null ? void 0 : t.type) && G(e) || e, r = mr(
1600
- Array.from(n.querySelectorAll(fr)).filter(Je)
1857
+ const n = He(e, t == null ? void 0 : t.type) && Z(e) || e, r = Nr(
1858
+ Array.from(n.querySelectorAll(Or)).filter(st)
1601
1859
  );
1602
1860
  if (r.length)
1603
1861
  return r;
1604
- const o = F(n);
1605
- return o && Je(o) ? [o] : [n];
1862
+ const o = q(n);
1863
+ return o && st(o) ? [o] : [n];
1606
1864
  }
1607
- function br(e) {
1865
+ function Hr(e) {
1608
1866
  var r;
1609
- e.setAttribute("data-smart-fill-highlighted", "true"), (r = Ee.get(e)) == null || r.abort();
1867
+ e.setAttribute("data-smart-fill-highlighted", "true"), (r = Ce.get(e)) == null || r.abort();
1610
1868
  const t = new AbortController(), n = (o) => {
1611
- o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), Ee.delete(e));
1869
+ o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), Ce.delete(e));
1612
1870
  };
1613
- Ee.set(e, t), e.addEventListener("pointerdown", n, { signal: t.signal }), e.addEventListener("mousedown", n, { signal: t.signal }), e.addEventListener("keydown", n, { signal: t.signal }), e.addEventListener("input", n, { signal: t.signal }), e.addEventListener("change", n, { signal: t.signal });
1871
+ Ce.set(e, t), e.addEventListener("pointerdown", n, { signal: t.signal }), e.addEventListener("mousedown", n, { signal: t.signal }), e.addEventListener("keydown", n, { signal: t.signal }), e.addEventListener("input", n, { signal: t.signal }), e.addEventListener("change", n, { signal: t.signal });
1614
1872
  }
1615
- function mr(e) {
1873
+ function Nr(e) {
1616
1874
  return e.filter((t) => !e.some((n) => n !== t && n.contains(t)));
1617
1875
  }
1618
- function Je(e) {
1876
+ function st(e) {
1619
1877
  const t = window.getComputedStyle(e);
1620
1878
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
1621
1879
  return !1;
1622
1880
  const n = e.getBoundingClientRect();
1623
1881
  return n.width > 0 && n.height > 0;
1624
1882
  }
1625
- function se(e, t, n, r, o) {
1883
+ function de(e, t, n, r, o) {
1626
1884
  return { fieldId: e, label: t, attemptedValue: n, reason: r, reasonCode: o };
1627
1885
  }
1628
- function qe(e) {
1886
+ function $e(e) {
1629
1887
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1630
1888
  }
1631
- function wr(e, t) {
1889
+ function $r(e, t) {
1632
1890
  const n = e.find((o) => o.fieldId === t);
1633
1891
  if (n) return n;
1634
1892
  const r = t.includes(":") ? t.slice(t.lastIndexOf(":") + 1) : "";
1635
1893
  if (r)
1636
1894
  return e.find((o) => o.rowKey != null && String(o.rowKey) === r && `${o.fieldId}:${o.rowKey}` === t);
1637
1895
  }
1638
- const vr = [
1896
+ const zr = [
1639
1897
  { key: "mobile", pattern: new RegExp("(?<!\\d)1[3-9]\\d{9}(?!\\d)", "g"), confidence: 0.98, reason: "手机号正则命中" },
1640
1898
  { key: "idCard", pattern: new RegExp("(?<!\\d)\\d{17}[\\dXx](?!\\d)", "g"), confidence: 0.96, reason: "身份证号正则命中" },
1641
1899
  { key: "email", pattern: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, confidence: 0.95, reason: "邮箱正则命中" },
1642
1900
  { key: "bankCard", pattern: new RegExp("(?<!\\d)\\d{16,19}(?!\\d)", "g"), confidence: 0.9, reason: "银行卡号正则命中" },
1643
1901
  { key: "amount", pattern: /(?:金额|价格|费用|合计|总计)[::\s]*([0-9]+(?:\.[0-9]{1,2})?)/g, confidence: 0.88, reason: "金额关键词命中" },
1644
1902
  { key: "date", pattern: /\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g, confidence: 0.86, reason: "日期格式命中" }
1645
- ], I = {
1903
+ ], M = {
1646
1904
  mobile: [
1647
1905
  "手机",
1648
1906
  "手机号",
@@ -1694,7 +1952,7 @@ const vr = [
1694
1952
  "申请额度"
1695
1953
  ],
1696
1954
  date: ["日期", "时间", "有效期", "date", "申请日期", "申请时间", "受理日期", "进件日期"]
1697
- }, Ot = {
1955
+ }, jt = {
1698
1956
  mobile: "mobile",
1699
1957
  idCard: "idCard",
1700
1958
  email: "email",
@@ -1702,20 +1960,20 @@ const vr = [
1702
1960
  amount: "amount",
1703
1961
  date: "date"
1704
1962
  };
1705
- class Sr {
1963
+ class Kr {
1706
1964
  /**
1707
1965
  * 从文本中提取事实并匹配到 scan 字段。
1708
1966
  * 按 confidence 降序分配,每个 fieldId 仅匹配一次(usedFieldIds 去重)。
1709
1967
  */
1710
1968
  recognize(t, n, r) {
1711
- const o = Ir([...Er(t), ...xr(t)]), i = /* @__PURE__ */ new Set(), s = [];
1969
+ const o = Zr([...Vr(t), ...Br(t)]), i = /* @__PURE__ */ new Set(), s = [];
1712
1970
  for (const a of o.sort((c, l) => l.confidence - c.confidence)) {
1713
- const c = _r(a, n, i);
1971
+ const c = jr(a, n, i);
1714
1972
  c && (s.push({
1715
1973
  fieldId: c.fieldId,
1716
1974
  scanToken: r,
1717
1975
  label: c.label,
1718
- value: Ar(a.value, c),
1976
+ value: Yr(a.value, c),
1719
1977
  displayValue: a.value,
1720
1978
  confidence: a.confidence,
1721
1979
  source: "local_rule",
@@ -1725,76 +1983,76 @@ class Sr {
1725
1983
  return s;
1726
1984
  }
1727
1985
  }
1728
- function Er(e) {
1986
+ function Vr(e) {
1729
1987
  const t = [];
1730
- for (const n of vr)
1988
+ for (const n of zr)
1731
1989
  for (const r of e.matchAll(n.pattern)) {
1732
- const o = qt(r[1] || r[0]);
1990
+ const o = Gt(r[1] || r[0]);
1733
1991
  t.push({
1734
1992
  key: n.key,
1735
1993
  value: o,
1736
1994
  confidence: n.confidence,
1737
1995
  reason: n.reason,
1738
- baseKey: Ot[n.key]
1996
+ baseKey: jt[n.key]
1739
1997
  });
1740
1998
  }
1741
1999
  return t;
1742
2000
  }
1743
- function xr(e) {
2001
+ function Br(e) {
1744
2002
  const t = [], n = e.split(/\r?\n|[;,;]/).map((r) => r.trim()).filter(Boolean);
1745
2003
  for (const r of n) {
1746
2004
  const o = r.match(/^[“"'`]?([^::=]{2,30})[”"'`]?[::=]\s*(.+)$/);
1747
2005
  if (!o) continue;
1748
- const i = Lr(o[1]), s = qt(o[2]);
2006
+ const i = Xr(o[1]), s = Gt(o[2]);
1749
2007
  if (!(!i || !s))
1750
- for (const a of kr(i, s))
2008
+ for (const a of Ur(i, s))
1751
2009
  t.push(a);
1752
2010
  }
1753
2011
  return t;
1754
2012
  }
1755
- function kr(e, t) {
1756
- const n = q(e), r = Tr(t), o = [];
1757
- return (x(n, I.mobile) || r === "mobile") && o.push("mobile"), (x(n, I.idCard) || r === "idCard") && o.push("idCard"), (x(n, I.email) || r === "email") && o.push("email"), (x(n, I.bankCard) || r === "bankCard") && o.push("bankCard"), (x(n, I.amount) || r === "amount") && o.push("amount"), (x(n, I.date) || r === "date") && o.push("date"), Mr(o).map((i, s) => ({
2013
+ function Ur(e, t) {
2014
+ const n = H(e), r = Wr(t), o = [];
2015
+ return (_(n, M.mobile) || r === "mobile") && o.push("mobile"), (_(n, M.idCard) || r === "idCard") && o.push("idCard"), (_(n, M.email) || r === "email") && o.push("email"), (_(n, M.bankCard) || r === "bankCard") && o.push("bankCard"), (_(n, M.amount) || r === "amount") && o.push("amount"), (_(n, M.date) || r === "date") && o.push("date"), Jr(o).map((i, s) => ({
1758
2016
  key: i,
1759
2017
  value: t,
1760
2018
  confidence: Math.max(0.84, 0.96 - s * 0.04),
1761
2019
  reason: `键值对文本命中(${e})`,
1762
- baseKey: Ot[i]
2020
+ baseKey: jt[i]
1763
2021
  }));
1764
2022
  }
1765
- function _r(e, t, n) {
2023
+ function jr(e, t, n) {
1766
2024
  let r = null;
1767
2025
  for (const o of t) {
1768
2026
  if (n.has(o.fieldId)) continue;
1769
- const i = Cr(e, o);
2027
+ const i = Gr(e, o);
1770
2028
  i > ((r == null ? void 0 : r.score) ?? 0) && (r = { field: o, score: i });
1771
2029
  }
1772
2030
  return r && r.score >= 0.45 ? r.field : null;
1773
2031
  }
1774
- function Cr(e, t) {
1775
- const n = q([t.fieldId, t.label, t.placeholder, t.name, t.id, t.section].join(" ")), r = I[e.key] || [e.key];
2032
+ function Gr(e, t) {
2033
+ const n = H([t.fieldId, t.label, t.placeholder, t.name, t.id, t.section].join(" ")), r = M[e.key] || [e.key];
1776
2034
  let o = 0;
1777
- return x(n, r) ? o += 0.95 : x(n, [e.key]) && (o += 0.82), n.includes(q(e.key)) && (o += 0.22), t.required && (o += 0.05), e.baseKey === "amount" && (t.type === "amount" || t.type === "number") && (o += 0.18), e.baseKey === "date" && t.type === "date" && (o += 0.18), ["email", "mobile", "idCard", "bankCard"].includes(e.baseKey) && t.type === "text" && (o += 0.08), Math.min(o, 1);
2035
+ return _(n, r) ? o += 0.95 : _(n, [e.key]) && (o += 0.82), n.includes(H(e.key)) && (o += 0.22), t.required && (o += 0.05), e.baseKey === "amount" && (t.type === "amount" || t.type === "number") && (o += 0.18), e.baseKey === "date" && t.type === "date" && (o += 0.18), ["email", "mobile", "idCard", "bankCard"].includes(e.baseKey) && t.type === "text" && (o += 0.08), Math.min(o, 1);
1778
2036
  }
1779
- function Ar(e, t) {
2037
+ function Yr(e, t) {
1780
2038
  var n;
1781
2039
  return t.type === "date" ? e.replace(/[年月/.]/g, "-").replace(/日/g, "").replace(/--/g, "-") : t.type === "number" || t.type === "amount" ? ((n = e.match(/[0-9]+(?:\.[0-9]+)?/)) == null ? void 0 : n[0]) ?? e : t.name && /mobile|phone|idcard|bankcard/i.test(t.name) || t.id && /mobile|phone|idcard|bankcard/i.test(t.id) || /mobile|phone|idcard|bankcard/i.test(t.fieldId) ? e.replace(/\s+/g, "") : e;
1782
2040
  }
1783
- function Tr(e) {
2041
+ function Wr(e) {
1784
2042
  const t = e.replace(/\s+/g, "");
1785
2043
  return /^1[3-9]\d{9}$/.test(t) ? "mobile" : /^\d{17}[\dXx]$/.test(t) ? "idCard" : /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(e) ? "email" : /^\d{16,19}$/.test(t) ? "bankCard" : /^\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?$/.test(e) ? "date" : /^[0-9]+(?:\.[0-9]{1,2})?$/.test(t) ? "amount" : "unknown";
1786
2044
  }
1787
- function Lr(e) {
2045
+ function Xr(e) {
1788
2046
  return e.replace(/[“”"'`]/g, "").replace(/\s+/g, " ").trim();
1789
2047
  }
1790
- function qt(e) {
2048
+ function Gt(e) {
1791
2049
  return e.replace(/[,。;;]+$/g, "").replace(/^[“”"'`\s]+|[“”"'`\s]+$/g, "").trim();
1792
2050
  }
1793
- function x(e, t) {
1794
- const n = q(e);
1795
- return t.some((r) => n.includes(q(r)));
2051
+ function _(e, t) {
2052
+ const n = H(e);
2053
+ return t.some((r) => n.includes(H(r)));
1796
2054
  }
1797
- function Ir(e) {
2055
+ function Zr(e) {
1798
2056
  const t = /* @__PURE__ */ new Map();
1799
2057
  for (const n of e) {
1800
2058
  const r = `${n.key}::${n.value}`, o = t.get(r);
@@ -1802,16 +2060,16 @@ function Ir(e) {
1802
2060
  }
1803
2061
  return [...t.values()];
1804
2062
  }
1805
- function Mr(e) {
2063
+ function Jr(e) {
1806
2064
  return [...new Set(e)];
1807
2065
  }
1808
- const Qe = [
2066
+ const at = [
1809
2067
  "input",
1810
2068
  "textarea",
1811
2069
  "select",
1812
2070
  "[contenteditable]:not([contenteditable='false'])"
1813
- ].join(", "), Rr = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
1814
- class Fr {
2071
+ ].join(", "), Qr = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
2072
+ class eo {
1815
2073
  constructor(t = document) {
1816
2074
  this.root = t;
1817
2075
  }
@@ -1822,7 +2080,7 @@ class Fr {
1822
2080
  */
1823
2081
  scan(t = {}) {
1824
2082
  var l;
1825
- const n = ye("scan");
2083
+ const n = Se("scan");
1826
2084
  if ((l = t.registered) != null && l.length)
1827
2085
  return {
1828
2086
  scanToken: n,
@@ -1831,7 +2089,7 @@ class Fr {
1831
2089
  const r = this.resolveRoot(t.scanContainer), o = this.collectVisibleFields(r), i = this.detectTopLayerContainer(o), s = o.filter((u) => i.contains(u)), a = (s.length ? s : o).slice(0, t.maxFields ?? 200), c = s.length ? i : r;
1832
2090
  return {
1833
2091
  scanToken: n,
1834
- fields: a.map((u, h) => this.fromElement(u, h, n, c))
2092
+ fields: a.map((u, p) => this.fromElement(u, p, n, c))
1835
2093
  };
1836
2094
  }
1837
2095
  /** 在基础扫描后,按需展开下拉并补充动态选项 */
@@ -1842,18 +2100,18 @@ class Fr {
1842
2100
  return n;
1843
2101
  const r = [];
1844
2102
  for (const s of n.fields) {
1845
- const a = !!((i = s.options) != null && i.length) && !ne(s);
2103
+ const a = !!((i = s.options) != null && i.length) && !ie(s);
1846
2104
  if (!s.element || a || s.type !== "select" && s.type !== "cascader") {
1847
2105
  r.push(s);
1848
2106
  continue;
1849
2107
  }
1850
- const c = await cn(s.element), l = c != null && c.length && !ne({ ...s, options: c }) ? c : void 0;
2108
+ const c = await wn(s.element), l = c != null && c.length && !ie({ ...s, options: c }) ? c : void 0;
1851
2109
  if (!(l != null && l.length)) {
1852
- r.push({ ...s, options: ne(s) ? void 0 : s.options });
2110
+ r.push({ ...s, options: ie(s) ? void 0 : s.options });
1853
2111
  continue;
1854
2112
  }
1855
2113
  const u = { ...s, options: l };
1856
- u.fingerprint = z({
2114
+ u.fingerprint = j({
1857
2115
  ...u,
1858
2116
  tagName: s.element.tagName.toLowerCase()
1859
2117
  }), r.push(u);
@@ -1862,7 +2120,7 @@ class Fr {
1862
2120
  }
1863
2121
  /** FieldSchema → FieldDescriptor,解析 element 并生成 fingerprint */
1864
2122
  fromSchema(t, n) {
1865
- const r = zr(t.element, this.root), o = r ? Re(r) || Te(r) || r : null, i = {
2123
+ const r = uo(t.element, this.root), o = r ? Pe(r) || Fe(r) || r : null, i = {
1866
2124
  fieldId: t.rowKey == null ? t.fieldId : `${t.fieldId}:${t.rowKey}`,
1867
2125
  label: t.label,
1868
2126
  type: t.type,
@@ -1876,32 +2134,32 @@ class Fr {
1876
2134
  element: o || void 0,
1877
2135
  fingerprint: ""
1878
2136
  };
1879
- return i.fingerprint = z({
2137
+ return i.fingerprint = j({
1880
2138
  ...i,
1881
2139
  tagName: o == null ? void 0 : o.tagName.toLowerCase()
1882
2140
  }), i;
1883
2141
  }
1884
2142
  /** DOM 元素 → FieldDescriptor,自动推断 label/type 并写入 data-smart-fill-id */
1885
2143
  fromElement(t, n, r, o = this.root) {
1886
- const i = Or(t, n), s = Pr(t, o), a = {
2144
+ const i = to(t, n), s = oo(t, o), a = {
1887
2145
  fieldId: i,
1888
2146
  fingerprint: "",
1889
2147
  scanToken: r,
1890
- type: qr(t),
2148
+ type: no(t),
1891
2149
  localRuleMode: "inherit",
1892
- label: Dt(t),
1893
- placeholder: Ht(t),
1894
- name: S(ft(t)) || void 0,
1895
- id: S(t.id) || void 0,
1896
- section: Dr(t),
2150
+ label: Yt(t),
2151
+ placeholder: Xt(t),
2152
+ name: E(St(t)) || void 0,
2153
+ id: E(t.id) || void 0,
2154
+ section: ro(t),
1897
2155
  options: s,
1898
- required: Nr(t),
1899
- readonly: $r(t),
1900
- disabled: ke(t),
2156
+ required: ao(t),
2157
+ readonly: so(t),
2158
+ disabled: Le(t),
1901
2159
  source: "form_scan",
1902
2160
  element: t
1903
2161
  };
1904
- return ne(a) && (a.options = void 0), a.fingerprint = z({
2162
+ return ie(a) && (a.options = void 0), a.fingerprint = j({
1905
2163
  ...a,
1906
2164
  tagName: t.tagName.toLowerCase()
1907
2165
  }), a;
@@ -1909,7 +2167,7 @@ class Fr {
1909
2167
  /** 解析扫描根节点,scanContainer 为 CSS 选择器 */
1910
2168
  resolveRoot(t) {
1911
2169
  if (t) {
1912
- const n = $t(this.root, t);
2170
+ const n = Zt(this.root, t);
1913
2171
  if (n)
1914
2172
  return n;
1915
2173
  }
@@ -1917,38 +2175,38 @@ class Fr {
1917
2175
  }
1918
2176
  /** 收集 root 下可见且可编辑的表单控件 */
1919
2177
  collectVisibleFields(t) {
1920
- const n = /* @__PURE__ */ new Set(), r = [Qe, ht, ut, ".van-field"].join(", ");
2178
+ const n = /* @__PURE__ */ new Set(), r = [at, Et, mt, ".van-field"].join(", ");
1921
2179
  for (const s of t.querySelectorAll(r)) {
1922
2180
  if (!(s instanceof HTMLElement)) continue;
1923
- const a = Re(s) || Te(s);
1924
- !a || !De(a) || ke(a) || n.add(a);
2181
+ const a = Pe(s) || Fe(s);
2182
+ !a || !ze(a) || Le(a) || n.add(a);
1925
2183
  }
1926
- const o = [...n], i = Array.from(t.querySelectorAll(Qe)).filter((s) => !(s instanceof HTMLElement) || !De(s) || Vr(s) || s instanceof HTMLInputElement && Rr.has((s.type || "").toLowerCase()) ? !1 : !ke(s) && !s.hasAttribute("readonly"));
1927
- return Kr([...i, ...o]);
2184
+ const o = [...n], i = Array.from(t.querySelectorAll(at)).filter((s) => !(s instanceof HTMLElement) || !ze(s) || co(s) || s instanceof HTMLInputElement && Qr.has((s.type || "").toLowerCase()) ? !1 : !Le(s) && !s.hasAttribute("readonly"));
2185
+ return lo([...i, ...o]);
1928
2186
  }
1929
2187
  /**
1930
2188
  * 检测最应优先扫描的容器。
1931
2189
  * 优先 activeElement 所在弹窗,否则取包含最多字段的弹窗容器。
1932
2190
  */
1933
2191
  detectTopLayerContainer(t) {
1934
- const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(ze);
2192
+ const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(We);
1935
2193
  if (r instanceof HTMLElement && t.some((i) => r.contains(i)))
1936
2194
  return r;
1937
- const o = t.map((i) => i.closest(ze)).filter((i) => i instanceof HTMLElement);
2195
+ const o = t.map((i) => i.closest(We)).filter((i) => i instanceof HTMLElement);
1938
2196
  return o.length ? o.sort((i, s) => t.filter((a) => s.contains(a)).length - t.filter((a) => i.contains(a)).length)[0] : document.body;
1939
2197
  }
1940
2198
  }
1941
- function Or(e, t) {
2199
+ function to(e, t) {
1942
2200
  const n = e.getAttribute("data-smart-fill-id");
1943
2201
  if (n)
1944
2202
  return n;
1945
- const o = S(e.getAttribute("name")) || S(e.getAttribute("data-smart-fill-key")) || S(ft(e)) || S(e.id) || S(Dt(e)) || `smart-fill-${Date.now()}-${t}`;
2203
+ const o = E(e.getAttribute("name")) || E(e.getAttribute("data-smart-fill-key")) || E(St(e)) || E(e.id) || E(Yt(e)) || `smart-fill-${Date.now()}-${t}`;
1946
2204
  return e.setAttribute("data-smart-fill-id", o), o;
1947
2205
  }
1948
- function qr(e) {
1949
- const t = bt(e);
2206
+ function no(e) {
2207
+ const t = _t(e);
1950
2208
  if (t) return t;
1951
- const n = ce(e);
2209
+ const n = ge(e);
1952
2210
  if (n) return n;
1953
2211
  if (e instanceof HTMLTextAreaElement) return "textarea";
1954
2212
  if (e instanceof HTMLSelectElement) return "select";
@@ -1961,92 +2219,92 @@ function qr(e) {
1961
2219
  }
1962
2220
  return "text";
1963
2221
  }
1964
- function Dt(e) {
2222
+ function Yt(e) {
1965
2223
  const t = e.getAttribute("aria-label");
1966
2224
  if (t) return t.trim();
1967
2225
  if (e.id) {
1968
- const i = document.querySelector(`label[for="${Ve(e.id)}"]`);
1969
- if (i != null && i.textContent) return p(i.textContent);
2226
+ const i = document.querySelector(`label[for="${Ge(e.id)}"]`);
2227
+ if (i != null && i.textContent) return f(i.textContent);
1970
2228
  }
1971
- const n = e.closest(Jt), r = n == null ? void 0 : n.querySelector(Qt);
1972
- if (r != null && r.textContent) return p(r.textContent);
2229
+ const n = e.closest(dn), r = n == null ? void 0 : n.querySelector(fn);
2230
+ if (r != null && r.textContent) return f(r.textContent);
1973
2231
  const o = e.closest("label");
1974
2232
  if (o) {
1975
- const i = Pt(o, e);
2233
+ const i = Wt(o, e);
1976
2234
  if (i) return i;
1977
2235
  }
1978
- return Ht(e) || e.getAttribute("name") || e.id || "未命名字段";
2236
+ return Xt(e) || e.getAttribute("name") || e.id || "未命名字段";
1979
2237
  }
1980
- function Pt(e, t) {
2238
+ function Wt(e, t) {
1981
2239
  const n = e.cloneNode(!0);
1982
2240
  for (const o of n.querySelectorAll('input, textarea, select, button, [role="combobox"], [role="listbox"]'))
1983
2241
  o.remove();
1984
- const r = p(n.textContent || "");
2242
+ const r = f(n.textContent || "");
1985
2243
  if (r)
1986
- return t instanceof HTMLInputElement && t.value && r.includes(t.value) ? p(r.replace(t.value, "")) || void 0 : r;
2244
+ return t instanceof HTMLInputElement && t.value && r.includes(t.value) ? f(r.replace(t.value, "")) || void 0 : r;
1987
2245
  }
1988
- function Ht(e) {
2246
+ function Xt(e) {
1989
2247
  var t;
1990
2248
  return e.getAttribute("placeholder") || e.getAttribute("aria-placeholder") || ((t = e.querySelector("[placeholder]")) == null ? void 0 : t.getAttribute("placeholder")) || void 0;
1991
2249
  }
1992
- function Dr(e) {
2250
+ function ro(e) {
1993
2251
  const t = e.closest("fieldset, section, .panel, .card, .form-section"), n = t == null ? void 0 : t.querySelector("legend, h1, h2, h3, .title, .section-title");
1994
- return n != null && n.textContent ? p(n.textContent) : void 0;
2252
+ return n != null && n.textContent ? f(n.textContent) : void 0;
1995
2253
  }
1996
- function Pr(e, t = document) {
1997
- const n = mt(e);
2254
+ function oo(e, t = document) {
2255
+ const n = At(e);
1998
2256
  if (n != null && n.length) return n;
1999
- const r = pt(e);
2257
+ const r = wt(e);
2000
2258
  if (r != null && r.length) return r;
2001
2259
  if (e instanceof HTMLSelectElement)
2002
2260
  return Array.from(e.options).map((o) => ({
2003
- label: p(o.textContent || o.label),
2261
+ label: f(o.textContent || o.label),
2004
2262
  value: o.value
2005
2263
  }));
2006
2264
  if (e instanceof HTMLInputElement && (e.type === "radio" || e.type === "checkbox") && e.name)
2007
- return Array.from(t.querySelectorAll(`input[name="${Ve(e.name)}"]`)).filter((o) => o.type === e.type && De(o)).map((o) => ({
2008
- label: Hr(o),
2265
+ return Array.from(t.querySelectorAll(`input[name="${Ge(e.name)}"]`)).filter((o) => o.type === e.type && ze(o)).map((o) => ({
2266
+ label: io(o),
2009
2267
  value: o.value || !0
2010
2268
  }));
2011
2269
  }
2012
- function Hr(e) {
2270
+ function io(e) {
2013
2271
  if (e.id) {
2014
- const n = document.querySelector(`label[for="${Ve(e.id)}"]`);
2015
- if (n != null && n.textContent) return p(n.textContent);
2272
+ const n = document.querySelector(`label[for="${Ge(e.id)}"]`);
2273
+ if (n != null && n.textContent) return f(n.textContent);
2016
2274
  }
2017
2275
  const t = e.closest("label");
2018
2276
  if (t) {
2019
- const n = Pt(t, e);
2277
+ const n = Wt(t, e);
2020
2278
  if (n) return n;
2021
2279
  }
2022
- return p(e.getAttribute("aria-label") || e.value || "");
2280
+ return f(e.getAttribute("aria-label") || e.value || "");
2023
2281
  }
2024
- function De(e) {
2282
+ function ze(e) {
2025
2283
  const t = window.getComputedStyle(e);
2026
2284
  return t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0 ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
2027
2285
  }
2028
- function ke(e) {
2029
- return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement ? e.disabled || e.getAttribute("aria-disabled") === "true" : e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || Zt.some((t) => e.classList.contains(t));
2286
+ function Le(e) {
2287
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement ? e.disabled || e.getAttribute("aria-disabled") === "true" : e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || un.some((t) => e.classList.contains(t));
2030
2288
  }
2031
- function $r(e) {
2289
+ function so(e) {
2032
2290
  return e.hasAttribute("readonly") || !!e.querySelector("[readonly]");
2033
2291
  }
2034
- function Nr(e) {
2292
+ function ao(e) {
2035
2293
  return e.hasAttribute("required") || e.getAttribute("aria-required") === "true" || !!e.querySelector('[required], [aria-required="true"]');
2036
2294
  }
2037
- function Vr(e) {
2038
- return Re(e) != null || Te(e) != null;
2295
+ function co(e) {
2296
+ return Pe(e) != null || Fe(e) != null;
2039
2297
  }
2040
- function Kr(e) {
2298
+ function lo(e) {
2041
2299
  const t = [];
2042
2300
  for (const n of e)
2043
2301
  t.some((r) => r === n || r.contains(n) || n.contains(r)) || t.push(n);
2044
2302
  return t;
2045
2303
  }
2046
- function zr(e, t) {
2047
- return e instanceof HTMLElement ? e : typeof e == "string" ? $t(t, e) : null;
2304
+ function uo(e, t) {
2305
+ return e instanceof HTMLElement ? e : typeof e == "string" ? Zt(t, e) : null;
2048
2306
  }
2049
- function $t(e, t) {
2307
+ function Zt(e, t) {
2050
2308
  try {
2051
2309
  const n = e.querySelector(t);
2052
2310
  return n instanceof HTMLElement ? n : null;
@@ -2054,11 +2312,11 @@ function $t(e, t) {
2054
2312
  return null;
2055
2313
  }
2056
2314
  }
2057
- function Ve(e) {
2315
+ function Ge(e) {
2058
2316
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
2059
2317
  }
2060
- const _e = 5, Br = 10 * 1024 * 1024, Ur = 50 * 1024 * 1024;
2061
- class jr {
2318
+ const Ie = 5, fo = 10 * 1024 * 1024, po = 50 * 1024 * 1024;
2319
+ class ho {
2062
2320
  constructor(t) {
2063
2321
  /** 面板宿主元素,挂载到 container 下 */
2064
2322
  d(this, "host", null);
@@ -2084,7 +2342,7 @@ class jr {
2084
2342
  if (!this.dragState || !this.host || t.pointerId !== this.dragState.pointerId) return;
2085
2343
  const n = t.clientX - this.dragState.startX, r = t.clientY - this.dragState.startY;
2086
2344
  (Math.abs(n) > 3 || Math.abs(r) > 3) && (this.dragState.moved = !0);
2087
- const o = this.host.getBoundingClientRect(), i = Math.max(8, window.innerWidth - o.width - 8), s = Math.max(8, window.innerHeight - o.height - 8), a = ae(this.dragState.startLeft + n, 8, i), c = ae(this.dragState.startTop + r, 8, s);
2345
+ const o = this.host.getBoundingClientRect(), i = Math.max(8, window.innerWidth - o.width - 8), s = Math.max(8, window.innerHeight - o.height - 8), a = fe(this.dragState.startLeft + n, 8, i), c = fe(this.dragState.startTop + r, 8, s);
2088
2346
  this.host.style.left = `${a}px`, this.host.style.top = `${c}px`;
2089
2347
  });
2090
2348
  d(this, "handleDragEnd", (t) => {
@@ -2094,7 +2352,7 @@ class jr {
2094
2352
  });
2095
2353
  /** 面板聚焦或鼠标悬浮在图片区时接管全局粘贴图片 */
2096
2354
  d(this, "handleDocumentPaste", (t) => {
2097
- const n = Yr(t);
2355
+ const n = yo(t);
2098
2356
  if (!n.length || !this.isOpen || !this.host)
2099
2357
  return;
2100
2358
  const r = document.activeElement, o = this.root instanceof ShadowRoot ? this.root.activeElement : null;
@@ -2147,7 +2405,7 @@ class jr {
2147
2405
  }
2148
2406
  render(t) {
2149
2407
  this.root && (this.root.innerHTML = `
2150
- <style>${Wr}</style>
2408
+ <style>${bo}</style>
2151
2409
  ${this.options.mode === "floating" ? `<button class="sf-float" type="button" data-role="open">${this.t("entry", "智能录入")}</button>` : ""}
2152
2410
  <section class="sf-panel ${t ? "is-open" : ""} ${this.options.mode === "inline" ? "is-inline" : "is-floating"}" aria-label="智能录入面板">
2153
2411
  <header class="sf-header" data-role="close" >
@@ -2157,7 +2415,7 @@ class jr {
2157
2415
  <div class="sf-body ${t ? "is-open" : ""}">
2158
2416
  <div class="sf-entry-grid">
2159
2417
  <div class="sf-textarea-wrap">
2160
- <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${Gr(this.inputText)}</textarea>
2418
+ <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${go(this.inputText)}</textarea>
2161
2419
  <div class="sf-textarea-actions">
2162
2420
  <button class="sf-btn sf-btn-secondary" type="button" data-role="clear">${this.t("clear", "清空")}</button>
2163
2421
  <button class="sf-btn sf-btn-primary" type="button" data-role="recognize">${this.t("recognize", "智能识别")}</button>
@@ -2174,7 +2432,7 @@ class jr {
2174
2432
  <circle cx="10" cy="10.5" r="1" fill="currentColor"/>
2175
2433
  </svg>
2176
2434
  </span>
2177
- <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${_e} 张)`)}</span>
2435
+ <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${Ie} 张)`)}</span>
2178
2436
  </span>
2179
2437
  <span class="sf-upload-btn" data-role="file-label">图片识别</span>
2180
2438
  </label>
@@ -2198,8 +2456,8 @@ class jr {
2198
2456
  }
2199
2457
  this.options.onClose();
2200
2458
  }), (i = this.query('[data-role="file"]')) == null || i.addEventListener("change", (u) => {
2201
- const h = u.target;
2202
- this.handleImages(Array.from(h.files || []));
2459
+ const p = u.target;
2460
+ this.handleImages(Array.from(p.files || []));
2203
2461
  });
2204
2462
  const n = this.query('[data-role="upload"]');
2205
2463
  n == null || n.addEventListener("pointerenter", () => {
@@ -2213,22 +2471,22 @@ class jr {
2213
2471
  }), n == null || n.addEventListener("dragleave", (u) => {
2214
2472
  u.currentTarget.contains(u.relatedTarget) || (this.isUploadHovering = !1, n.removeAttribute("data-dragover"));
2215
2473
  }), n == null || n.addEventListener("drop", (u) => {
2216
- var h;
2217
- u.preventDefault(), this.isUploadHovering = !1, n.removeAttribute("data-dragover"), this.handleImages(Array.from(((h = u.dataTransfer) == null ? void 0 : h.files) || []));
2474
+ var p;
2475
+ u.preventDefault(), this.isUploadHovering = !1, n.removeAttribute("data-dragover"), this.handleImages(Array.from(((p = u.dataTransfer) == null ? void 0 : p.files) || []));
2218
2476
  }), (s = this.query('[data-role="text"]')) == null || s.addEventListener("input", (u) => {
2219
2477
  this.inputText = u.target.value;
2220
2478
  }), (a = this.query('[data-role="local-priority-toggle"]')) == null || a.addEventListener("change", (u) => {
2221
- var h, T;
2222
- this.localPriorityEnabled = u.target.checked, (T = (h = this.options).onLocalPriorityChange) == null || T.call(h, this.localPriorityEnabled);
2479
+ var p, y;
2480
+ this.localPriorityEnabled = u.target.checked, (y = (p = this.options).onLocalPriorityChange) == null || y.call(p, this.localPriorityEnabled);
2223
2481
  }), (c = this.query('[data-role="clear"]')) == null || c.addEventListener("click", () => {
2224
2482
  this.clearFormState();
2225
2483
  }), (l = this.query('[data-role="recognize"]')) == null || l.addEventListener("click", () => {
2226
- const u = this.query('[data-role="text"]'), h = u == null ? void 0 : u.value.trim();
2227
- if (this.inputText = (u == null ? void 0 : u.value) || this.inputText, !h) {
2484
+ const u = this.query('[data-role="text"]'), p = u == null ? void 0 : u.value.trim();
2485
+ if (this.inputText = (u == null ? void 0 : u.value) || this.inputText, !p) {
2228
2486
  this.setError(this.t("emptyInput", "请输入文本内容。"));
2229
2487
  return;
2230
2488
  }
2231
- this.options.onRecognize({ text: h });
2489
+ this.options.onRecognize({ text: p });
2232
2490
  });
2233
2491
  }
2234
2492
  clearFormState() {
@@ -2248,15 +2506,15 @@ class jr {
2248
2506
  this.resetSelectedFiles(), this.setError(this.t("invalidImageError", "请选择图片文件。"));
2249
2507
  return;
2250
2508
  }
2251
- if (n.length > _e) {
2252
- this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${_e} 张图片。`));
2509
+ if (n.length > Ie) {
2510
+ this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${Ie} 张图片。`));
2253
2511
  return;
2254
2512
  }
2255
- if (n.find((i) => i.size > Br)) {
2513
+ if (n.find((i) => i.size > fo)) {
2256
2514
  this.resetSelectedFiles(), this.setError(this.t("maxSingleFileSizeError", "单张图片不能超过 10MB。"));
2257
2515
  return;
2258
2516
  }
2259
- if (n.reduce((i, s) => i + s.size, 0) > Ur) {
2517
+ if (n.reduce((i, s) => i + s.size, 0) > po) {
2260
2518
  this.resetSelectedFiles(), this.setError(this.t("maxTotalFileSizeError", "上传图片总大小不能超过 50MB。"));
2261
2519
  return;
2262
2520
  }
@@ -2282,7 +2540,7 @@ class jr {
2282
2540
  keepHostInViewport() {
2283
2541
  this.options.mode !== "floating" || !this.host || !this.host.style.left || !this.host.style.top || window.requestAnimationFrame(() => {
2284
2542
  if (!this.host) return;
2285
- const t = this.host.getBoundingClientRect(), n = ae(t.left, 8, Math.max(8, window.innerWidth - t.width - 8)), r = ae(t.top, 8, Math.max(8, window.innerHeight - t.height - 8));
2543
+ const t = this.host.getBoundingClientRect(), n = fe(t.left, 8, Math.max(8, window.innerWidth - t.width - 8)), r = fe(t.top, 8, Math.max(8, window.innerHeight - t.height - 8));
2286
2544
  this.host.style.left = `${n}px`, this.host.style.top = `${r}px`;
2287
2545
  });
2288
2546
  }
@@ -2295,7 +2553,7 @@ class jr {
2295
2553
  return ((r = this.options.messages) == null ? void 0 : r[t]) || n;
2296
2554
  }
2297
2555
  }
2298
- function Gr(e) {
2556
+ function go(e) {
2299
2557
  return e.replace(/[&<>"']/g, (t) => ({
2300
2558
  "&": "&amp;",
2301
2559
  "<": "&lt;",
@@ -2304,14 +2562,14 @@ function Gr(e) {
2304
2562
  "'": "&#39;"
2305
2563
  })[t] || t);
2306
2564
  }
2307
- function ae(e, t, n) {
2565
+ function fe(e, t, n) {
2308
2566
  return Math.min(Math.max(e, t), n);
2309
2567
  }
2310
- function Yr(e) {
2568
+ function yo(e) {
2311
2569
  var n;
2312
2570
  return Array.from(((n = e.clipboardData) == null ? void 0 : n.items) || []).filter((r) => r.kind === "file" && r.type.startsWith("image/")).map((r) => r.getAsFile()).filter((r) => !!r);
2313
2571
  }
2314
- const Wr = `
2572
+ const bo = `
2315
2573
  :host, .sf-panel { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
2316
2574
  :host(.sf-sdk-host-floating), .sf-sdk-host-floating { position: fixed; top: 30px; right: 30px; z-index: 2147483647; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; width: min(450px, calc(100vw - 32px)); pointer-events: none; }
2317
2575
  .sf-float { font-size: 15px; align-self: flex-end; border: 0; border-radius: 999px; padding: 10px 30px; color: #fff; background: linear-gradient(to right, #FF7E49, #FFA34E); box-shadow: 0 10px 24px rgba(37,99,235,.3); cursor: move; user-select: none; touch-action: none; pointer-events: auto; }
@@ -2382,23 +2640,23 @@ const Wr = `
2382
2640
  width: min(450px, calc(100vw - 32px))
2383
2641
  }
2384
2642
  }
2385
- `, Xr = 0.75, Zr = 1800, H = /* @__PURE__ */ new Map();
2386
- let $ = 0;
2387
- const Pe = "smart-fill:routechange", Nt = "smart-fill:session-scan:";
2388
- let et = !1;
2389
- const tt = /* @__PURE__ */ new WeakMap();
2390
- let Jr = 0;
2391
- function Vt() {
2392
- H.clear(), Gt(), $ += 1;
2643
+ `, mo = 0.75, vo = 1800, z = /* @__PURE__ */ new Map();
2644
+ let K = 0;
2645
+ const Ke = "smart-fill:routechange", Jt = "smart-fill:session-scan:";
2646
+ let ct = !1;
2647
+ const lt = /* @__PURE__ */ new WeakMap();
2648
+ let wo = 0;
2649
+ function Qt() {
2650
+ z.clear(), sn(), K += 1;
2393
2651
  }
2394
- class Qr {
2652
+ class So {
2395
2653
  constructor(t, n) {
2396
2654
  /** 实例级事件总线,对应 instance.on(...) */
2397
- d(this, "events", new Ft());
2655
+ d(this, "events", new Ut());
2398
2656
  /** 页面字段扫描器,root 来自 SmartFill.create({ root }) */
2399
2657
  d(this, "scanner");
2400
2658
  /** 浏览器端本地规则引擎,用于文本正则/键值对提取 */
2401
- d(this, "ruleEngine", new Sr());
2659
+ d(this, "ruleEngine", new Kr());
2402
2660
  /** Shadow DOM 面板,mount / mountFloatingButton 后可用(指向最后挂载的面板,用于状态展示) */
2403
2661
  d(this, "panel", null);
2404
2662
  /** 已挂载的全部面板(inline / floating 可同时存在),用于本地优先开关广播与销毁 */
@@ -2408,7 +2666,7 @@ class Qr {
2408
2666
  /** 业务方 registerFields 注册的字段;非空时 rescan 仅扫描这些字段 */
2409
2667
  d(this, "registeredFields", []);
2410
2668
  /** 组件库回填适配器链,如 AntD / Element 自定义控件 */
2411
- d(this, "adapters", [Mt]);
2669
+ d(this, "adapters", [Vt]);
2412
2670
  /** 最近一次 rescan 结果;scanToken 用于识别/回填防过期校验 */
2413
2671
  d(this, "scanResult", null);
2414
2672
  /** recognize 完成后生成的自动回填候选,供面板展示与 applyAutoItems 使用 */
@@ -2420,14 +2678,14 @@ class Qr {
2420
2678
  /** 实例是否已 destroy,销毁后所有公开方法抛 INSTANCE_DESTROYED */
2421
2679
  d(this, "destroyed", !1);
2422
2680
  /** 页面扫描缓存代际快照;变化时说明缓存已被全局清空 */
2423
- d(this, "scanCacheVersion", $);
2681
+ d(this, "scanCacheVersion", K);
2424
2682
  /** 悬浮挂载时记录当前路由快照,路由切换后自动销毁实例 */
2425
2683
  d(this, "floatingRouteSnapshot", null);
2426
2684
  /** 悬浮挂载生命周期清理函数:移除路由监听和容器 observer */
2427
2685
  d(this, "floatingLifecycleCleanup", null);
2428
2686
  /** mount 后预扫描定时器 */
2429
2687
  d(this, "preScanTimer", null);
2430
- this.config = t, this.context = n, this.scanner = new Fr(t.root || document), this.localPriorityEnabled = ko(), this.context.manager.add(this);
2688
+ this.config = t, this.context = n, this.scanner = new eo(t.root || document), this.localPriorityEnabled = Uo(), this.context.manager.add(this);
2431
2689
  }
2432
2690
  /** 订阅实例事件,返回取消订阅函数 */
2433
2691
  on(t, n) {
@@ -2448,7 +2706,7 @@ class Qr {
2448
2706
  for (const r of t) {
2449
2707
  const o = r.rowKey == null ? r.fieldId : `${r.fieldId}:${r.rowKey}`;
2450
2708
  if (n.has(o))
2451
- throw b("UNSUPPORTED_PAGE", `字段 ${o} 重复注册。`, "scan");
2709
+ throw v("UNSUPPORTED_PAGE", `字段 ${o} 重复注册。`, "scan");
2452
2710
  n.add(o);
2453
2711
  }
2454
2712
  return this.registeredFields = t, this.scanResult = null, this.schedulePreScan(), this;
@@ -2462,14 +2720,14 @@ class Qr {
2462
2720
  this.assertAlive();
2463
2721
  const n = typeof t == "string" ? document.querySelector(t) : t;
2464
2722
  if (!n)
2465
- throw b("UNSUPPORTED_PAGE", "未找到智能录入挂载点。", "ui");
2466
- const r = it("inline", xo(t, n)), o = st(r, !0);
2723
+ throw v("UNSUPPORTED_PAGE", "未找到智能录入挂载点。", "ui");
2724
+ const r = pt("inline", Bo(t, n)), o = ht(r, !0);
2467
2725
  return this.createPanel("inline", r, o).mount(n), this.schedulePreScan(), this;
2468
2726
  }
2469
2727
  /** 挂载右下角悬浮按钮 + 弹框(floating 模式),优先挂到当前子路由页面顶层容器 */
2470
2728
  mountFloatingButton() {
2471
2729
  this.assertAlive();
2472
- const t = fo(this.config), n = it("floating"), r = st(n, !0);
2730
+ const t = Oo(this.config), n = pt("floating"), r = ht(n, !0);
2473
2731
  return this.createPanel("floating", n, r).mount(t), this.bindFloatingLifecycle(t), this.schedulePreScan(), this;
2474
2732
  }
2475
2733
  /**
@@ -2478,7 +2736,7 @@ class Qr {
2478
2736
  */
2479
2737
  createPanel(t, n, r) {
2480
2738
  let o;
2481
- return o = new jr({
2739
+ return o = new ho({
2482
2740
  mode: t,
2483
2741
  initialOpen: r,
2484
2742
  messages: this.config.messages,
@@ -2491,17 +2749,17 @@ class Qr {
2491
2749
  }
2492
2750
  /** 同步本地优先开关:更新内存态、写入 localStorage,并广播到其他已挂载面板 */
2493
2751
  handleLocalPriorityChange(t, n) {
2494
- this.localPriorityEnabled = t, _o(t);
2752
+ this.localPriorityEnabled = t, jo(t);
2495
2753
  for (const r of this.panels)
2496
2754
  r !== n && r.setLocalPriorityEnabled(t);
2497
2755
  }
2498
2756
  /** 打开面板并触发 rescan,同时激活当前实例(关闭其他实例面板) */
2499
2757
  async open(t = this.panel) {
2500
- this.assertAlive(), this.syncScanCacheVersion(), t && (this.context.manager.activate(this), this.panel = t, t.setOpen(!0), at(this.panelStorageKeys.get(t), !0), this.scanResult || await this.rescan());
2758
+ this.assertAlive(), this.syncScanCacheVersion(), t && (this.context.manager.activate(this), this.panel = t, t.setOpen(!0), gt(this.panelStorageKeys.get(t), !0), this.scanResult || await this.rescan());
2501
2759
  }
2502
2760
  /** 关闭面板(不销毁实例) */
2503
2761
  close(t = this.panel) {
2504
- t && (this.panel = t, t.setOpen(!1), at(this.panelStorageKeys.get(t), !1));
2762
+ t && (this.panel = t, t.setOpen(!1), gt(this.panelStorageKeys.get(t), !1));
2505
2763
  }
2506
2764
  /**
2507
2765
  * 扫描页面可回填字段。
@@ -2527,7 +2785,7 @@ class Qr {
2527
2785
  maxFields: this.config.maxFields
2528
2786
  }));
2529
2787
  if (this.scanResult = i, this.cachePageScanResult(i, t.dynamicOptions), !this.scanResult.fields.length)
2530
- throw b("NO_FIELDS_FOUND", "当前页面未找到可回填字段。", "scan");
2788
+ throw v("NO_FIELDS_FOUND", "当前页面未找到可回填字段。", "scan");
2531
2789
  return t.emitStatus && (this.events.emit("scanCompleted", {
2532
2790
  scanToken: this.scanResult.scanToken,
2533
2791
  fieldCount: this.scanResult.fields.length
@@ -2541,7 +2799,7 @@ class Qr {
2541
2799
  this.destroyed || !this.panels.length || (this.preScanTimer != null && window.clearTimeout(this.preScanTimer), this.preScanTimer = window.setTimeout(() => {
2542
2800
  this.preScanTimer = null, !(this.destroyed || this.scanResult) && this.preScan().catch(() => {
2543
2801
  });
2544
- }, Zr));
2802
+ }, vo));
2545
2803
  }
2546
2804
  cancelPreScan() {
2547
2805
  this.preScanTimer != null && (window.clearTimeout(this.preScanTimer), this.preScanTimer = null);
@@ -2559,74 +2817,74 @@ class Qr {
2559
2817
  async recognize(t) {
2560
2818
  var i, s, a, c, l, u;
2561
2819
  this.assertAlive(), this.syncScanCacheVersion(), (i = this.panel) == null || i.setBusy(!0, "扫描中..."), (s = this.panel) == null || s.setStatus("扫描中...");
2562
- const n = await this.rescan(), r = ye("trace"), o = performance.now();
2820
+ const n = await this.rescan(), r = Se("trace"), o = performance.now();
2563
2821
  this.events.emit("recognizing", { scanToken: n.scanToken, traceId: r }), (a = this.panel) == null || a.setBusy(!0, "识别中...");
2564
2822
  try {
2565
- const h = n.fields.filter((g) => oo(g.localRuleMode, this.localPriorityEnabled)), T = n.fields.filter((g) => g.localRuleMode !== "only"), { text: P, usedOcr: J } = await this.context.client.resolveInputText({
2823
+ const p = n.fields.filter((b) => Ao(b.localRuleMode, this.localPriorityEnabled)), y = n.fields.filter((b) => b.localRuleMode !== "only"), { text: $, usedOcr: te } = await this.context.client.resolveInputText({
2566
2824
  text: t.text,
2567
2825
  images: t.images,
2568
- onStatusChange: (g) => {
2569
- var ee, L, te;
2570
- if (g === "image_uploading") {
2571
- (ee = this.panel) == null || ee.setStatus("图片上传中...");
2826
+ onStatusChange: (b) => {
2827
+ var re, I, oe;
2828
+ if (b === "image_uploading") {
2829
+ (re = this.panel) == null || re.setStatus("图片上传中...");
2572
2830
  return;
2573
2831
  }
2574
- if (g === "image_recognizing") {
2575
- (L = this.panel) == null || L.setStatus("图片识别中...");
2832
+ if (b === "image_recognizing") {
2833
+ (I = this.panel) == null || I.setStatus("图片识别中...");
2576
2834
  return;
2577
2835
  }
2578
- (te = this.panel) == null || te.setStatus("识别中...");
2836
+ (oe = this.panel) == null || oe.setStatus("识别中...");
2579
2837
  }
2580
- }), Q = P ? this.ruleEngine.recognize(P, h, n.scanToken) : [];
2581
- let v;
2582
- if (!T.length)
2583
- v = nt(n.scanToken, r, Q, o, void 0, J);
2838
+ }), ne = $ ? this.ruleEngine.recognize($, p, n.scanToken) : [];
2839
+ let S;
2840
+ if (!y.length)
2841
+ S = ut(n.scanToken, r, ne, o, void 0, te);
2584
2842
  else
2585
2843
  try {
2586
- const g = await this.context.client.recognize({
2844
+ const b = await this.context.client.recognize({
2587
2845
  scanToken: n.scanToken,
2588
2846
  formCode: this.config.formCode,
2589
2847
  configVersion: this.formConfigVersion,
2590
- text: P,
2591
- usedOcr: J,
2592
- fields: T,
2848
+ text: $,
2849
+ usedOcr: te,
2850
+ fields: y,
2593
2851
  onStatusChange: () => {
2594
- var L;
2595
- (L = this.panel) == null || L.setStatus("识别中...");
2852
+ var I;
2853
+ (I = this.panel) == null || I.setStatus("识别中...");
2596
2854
  }
2597
2855
  });
2598
- g.trace.durationMs = g.trace.durationMs || Math.round(performance.now() - o);
2599
- const ee = ro(
2600
- Q,
2601
- g.suggestions.filter((L) => T.some((te) => te.fieldId === L.fieldId))
2856
+ b.trace.durationMs = b.trace.durationMs || Math.round(performance.now() - o);
2857
+ const re = _o(
2858
+ ne,
2859
+ b.suggestions.filter((I) => y.some((oe) => oe.fieldId === I.fieldId))
2602
2860
  );
2603
- v = { ...g, suggestions: ee };
2604
- } catch (g) {
2605
- if (!Q.length)
2606
- throw g;
2607
- v = nt(
2861
+ S = { ...b, suggestions: re };
2862
+ } catch (b) {
2863
+ if (!ne.length)
2864
+ throw b;
2865
+ S = ut(
2608
2866
  n.scanToken,
2609
2867
  r,
2610
- Q,
2868
+ ne,
2611
2869
  o,
2612
- [J ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2613
- J
2870
+ [te ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2871
+ te
2614
2872
  );
2615
2873
  }
2616
- if (this.autoApplyState = to(
2617
- v.scanToken,
2618
- v.trace.traceId,
2619
- v.suggestions,
2874
+ if (this.autoApplyState = xo(
2875
+ S.scanToken,
2876
+ S.trace.traceId,
2877
+ S.suggestions,
2620
2878
  n,
2621
2879
  this.registeredFields
2622
- ), this.events.emit("recognized", v), (c = this.panel) == null || c.setAutoApplyState(this.autoApplyState), this.config.apiEnable) {
2623
- const g = eo(v, this.autoApplyState, n);
2624
- this.config.apiCallback && await Promise.resolve(this.config.apiCallback(g)), (l = this.panel) == null || l.setStatus(`识别完成,已返回 ${g.fields.length} 个字段。`);
2880
+ ), this.events.emit("recognized", S), (c = this.panel) == null || c.setAutoApplyState(this.autoApplyState), this.config.apiEnable) {
2881
+ const b = Eo(S, this.autoApplyState, n);
2882
+ this.config.apiCallback && await Promise.resolve(this.config.apiCallback(b)), (l = this.panel) == null || l.setStatus(`识别完成,已返回 ${b.fields.length} 个字段。`);
2625
2883
  } else
2626
2884
  await this.applyAutoItems(this.autoApplyState);
2627
- return v;
2628
- } catch (h) {
2629
- throw this.clearScanStateOnTokenExpired(h), this.emitError(h, "recognize"), h;
2885
+ return S;
2886
+ } catch (p) {
2887
+ throw this.clearScanStateOnTokenExpired(p), this.emitError(p, "recognize"), p;
2630
2888
  } finally {
2631
2889
  (u = this.panel) == null || u.setBusy(!1);
2632
2890
  }
@@ -2639,9 +2897,9 @@ class Qr {
2639
2897
  async apply(t) {
2640
2898
  var o;
2641
2899
  if (this.assertAlive(), this.syncScanCacheVersion(), !this.scanResult)
2642
- throw b("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2900
+ throw v("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2643
2901
  this.events.emit("applying", { scanToken: t.scanToken, count: t.values.length });
2644
- const r = await new Ze(this.scanResult.fields, this.registeredFields, this.adapters).apply(t);
2902
+ const r = await new it(this.scanResult.fields, this.registeredFields, this.adapters).apply(t);
2645
2903
  return this.events.emit("applied", r), (o = this.panel) == null || o.setApplyResult(r), r;
2646
2904
  }
2647
2905
  /**
@@ -2651,10 +2909,10 @@ class Qr {
2651
2909
  async applyAutoItems(t) {
2652
2910
  var a, c;
2653
2911
  if (!this.scanResult)
2654
- throw b("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2655
- const n = no(t), r = t.items.filter((l) => Kt(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2912
+ throw v("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2913
+ const n = ko(t), r = t.items.filter((l) => en(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2656
2914
  this.events.emit("applying", { scanToken: t.scanToken, count: r.length }), (a = this.panel) == null || a.setStatus("识别完成,正在自动回填...");
2657
- const i = await new Ze(this.scanResult.fields, this.registeredFields, this.adapters).apply({ scanToken: t.scanToken, values: r }), s = {
2915
+ const i = await new it(this.scanResult.fields, this.registeredFields, this.adapters).apply({ scanToken: t.scanToken, values: r }), s = {
2658
2916
  ...i,
2659
2917
  skipped: [...n, ...i.skipped],
2660
2918
  warnings: [
@@ -2674,21 +2932,21 @@ class Qr {
2674
2932
  }
2675
2933
  assertAlive() {
2676
2934
  if (this.destroyed)
2677
- throw b("INSTANCE_DESTROYED", "实例已销毁。", "ui");
2935
+ throw v("INSTANCE_DESTROYED", "实例已销毁。", "ui");
2678
2936
  }
2679
2937
  emitError(t, n) {
2680
2938
  var o;
2681
- const r = We(t, n);
2939
+ const r = rt(t, n);
2682
2940
  this.events.emit("error", r), (o = this.panel) == null || o.setError(r.message);
2683
2941
  }
2684
2942
  getCachedPageScanResult(t) {
2685
2943
  const n = this.getPageScanCacheKey();
2686
2944
  if (!n) return null;
2687
- const r = H.get(n);
2945
+ const r = z.get(n);
2688
2946
  if (r && (!t || r.dynamicOptionsReady)) {
2689
- const i = so(r.scanResult);
2947
+ const i = To(r.scanResult);
2690
2948
  if (!i)
2691
- H.delete(n);
2949
+ z.delete(n);
2692
2950
  else
2693
2951
  return i;
2694
2952
  }
@@ -2698,54 +2956,54 @@ class Qr {
2698
2956
  cachePageScanResult(t, n) {
2699
2957
  const r = this.getPageScanCacheKey();
2700
2958
  if (!r || !t.fields.length) return;
2701
- const o = H.get(r);
2702
- o != null && o.dynamicOptionsReady && !n || (H.set(r, {
2959
+ const o = z.get(r);
2960
+ o != null && o.dynamicOptionsReady && !n || (z.set(r, {
2703
2961
  scanResult: t,
2704
2962
  dynamicOptionsReady: (o == null ? void 0 : o.dynamicOptionsReady) || n
2705
2963
  }), this.persistPageScanResult(t, (o == null ? void 0 : o.dynamicOptionsReady) || n));
2706
2964
  }
2707
2965
  getPageScanCacheKey() {
2708
- return this.registeredFields.length ? null : lo(this.config);
2966
+ return this.registeredFields.length ? null : Mo(this.config);
2709
2967
  }
2710
2968
  getSessionPageScanCacheKey() {
2711
- return this.registeredFields.length || !this.config.formCode ? null : uo(this.config);
2969
+ return this.registeredFields.length || !this.config.formCode ? null : Ro(this.config);
2712
2970
  }
2713
2971
  clearScanStateOnTokenExpired(t) {
2714
- We(t, "recognize").code === "TOKEN_EXPIRED" && (Vt(), this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2972
+ rt(t, "recognize").code === "TOKEN_EXPIRED" && (Qt(), this.scanCacheVersion = K, this.scanResult = null, this.autoApplyState = null);
2715
2973
  }
2716
2974
  syncScanCacheVersion() {
2717
- this.scanCacheVersion !== $ && (this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2975
+ this.scanCacheVersion !== K && (this.scanCacheVersion = K, this.scanResult = null, this.autoApplyState = null);
2718
2976
  }
2719
2977
  getPersistedPageScanResult(t) {
2720
2978
  const n = this.getSessionPageScanCacheKey();
2721
2979
  if (!n) return null;
2722
- const r = So(n);
2980
+ const r = Ko(n);
2723
2981
  if (!r || t && !r.dynamicOptionsReady) return null;
2724
- const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = ao(r, o);
2982
+ const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = Lo(r, o);
2725
2983
  return i ? {
2726
2984
  scanResult: i,
2727
2985
  dynamicOptionsReady: r.dynamicOptionsReady
2728
- } : (Gt(n), null);
2986
+ } : (sn(n), null);
2729
2987
  }
2730
2988
  persistPageScanResult(t, n) {
2731
2989
  const r = this.getSessionPageScanCacheKey();
2732
- !r || !t.fields.length || Eo(r, {
2990
+ !r || !t.fields.length || Vo(r, {
2733
2991
  version: 1,
2734
2992
  dynamicOptionsReady: n,
2735
2993
  fields: t.fields.map(({ element: o, scanToken: i, ...s }) => s)
2736
2994
  });
2737
2995
  }
2738
2996
  bindFloatingLifecycle(t) {
2739
- this.clearFloatingLifecycle(), this.floatingRouteSnapshot = ot(), po();
2997
+ this.clearFloatingLifecycle(), this.floatingRouteSnapshot = ft(), Fo();
2740
2998
  const n = () => {
2741
- this.destroyed || ot() !== this.floatingRouteSnapshot && this.destroy();
2999
+ this.destroyed || ft() !== this.floatingRouteSnapshot && this.destroy();
2742
3000
  };
2743
- window.addEventListener(Pe, n);
3001
+ window.addEventListener(Ke, n);
2744
3002
  const r = new MutationObserver(() => {
2745
3003
  this.destroyed || t !== document.body && !t.isConnected && this.destroy();
2746
3004
  });
2747
3005
  r.observe(document.body, { childList: !0, subtree: !0 }), this.floatingLifecycleCleanup = () => {
2748
- window.removeEventListener(Pe, n), r.disconnect(), this.floatingRouteSnapshot = null, this.floatingLifecycleCleanup = null;
3006
+ window.removeEventListener(Ke, n), r.disconnect(), this.floatingRouteSnapshot = null, this.floatingLifecycleCleanup = null;
2749
3007
  };
2750
3008
  }
2751
3009
  clearFloatingLifecycle() {
@@ -2753,7 +3011,7 @@ class Qr {
2753
3011
  (t = this.floatingLifecycleCleanup) == null || t.call(this);
2754
3012
  }
2755
3013
  }
2756
- function eo(e, t, n) {
3014
+ function Eo(e, t, n) {
2757
3015
  return {
2758
3016
  scanToken: e.scanToken,
2759
3017
  trace: e.trace,
@@ -2774,12 +3032,12 @@ function eo(e, t, n) {
2774
3032
  })
2775
3033
  };
2776
3034
  }
2777
- function to(e, t, n, r, o) {
3035
+ function xo(e, t, n, r, o) {
2778
3036
  return {
2779
3037
  scanToken: e,
2780
3038
  traceId: t,
2781
3039
  items: n.map((i) => {
2782
- const s = r.fields.find((l) => l.fieldId === i.fieldId), a = o.find((l) => l.fieldId === i.fieldId), c = a != null && a.getValue ? a.getValue() : io(s == null ? void 0 : s.element);
3040
+ const s = r.fields.find((l) => l.fieldId === i.fieldId), a = o.find((l) => l.fieldId === i.fieldId), c = a != null && a.getValue ? a.getValue() : Co(s == null ? void 0 : s.element);
2783
3041
  return {
2784
3042
  applyItemId: `${i.fieldId}_${Math.random().toString(36).slice(2, 8)}`,
2785
3043
  fieldId: i.fieldId,
@@ -2797,12 +3055,12 @@ function to(e, t, n, r, o) {
2797
3055
  })
2798
3056
  };
2799
3057
  }
2800
- function Kt(e) {
3058
+ function en(e) {
2801
3059
  var t;
2802
- return e.confidence >= Xr && !((t = e.warnings) != null && t.length);
3060
+ return e.confidence >= mo && !((t = e.warnings) != null && t.length);
2803
3061
  }
2804
- function no(e) {
2805
- return e.items.filter((t) => !Kt(t)).map((t) => {
3062
+ function ko(e) {
3063
+ return e.items.filter((t) => !en(t)).map((t) => {
2806
3064
  var n, r;
2807
3065
  return {
2808
3066
  fieldId: t.fieldId,
@@ -2813,7 +3071,7 @@ function no(e) {
2813
3071
  };
2814
3072
  });
2815
3073
  }
2816
- function ro(e, t) {
3074
+ function _o(e, t) {
2817
3075
  const n = /* @__PURE__ */ new Map();
2818
3076
  for (const r of t)
2819
3077
  n.set(r.fieldId, r);
@@ -2821,10 +3079,10 @@ function ro(e, t) {
2821
3079
  n.has(r.fieldId) || n.set(r.fieldId, r);
2822
3080
  return [...n.values()];
2823
3081
  }
2824
- function oo(e, t) {
3082
+ function Ao(e, t) {
2825
3083
  return e === "only" ? !0 : e === "off" ? !1 : t;
2826
3084
  }
2827
- function nt(e, t, n, r, o, i = !1) {
3085
+ function ut(e, t, n, r, o, i = !1) {
2828
3086
  return {
2829
3087
  scanToken: e,
2830
3088
  suggestions: n,
@@ -2837,15 +3095,15 @@ function nt(e, t, n, r, o, i = !1) {
2837
3095
  }
2838
3096
  };
2839
3097
  }
2840
- function io(e) {
3098
+ function Co(e) {
2841
3099
  if (e)
2842
3100
  return e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked : e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value : e.textContent;
2843
3101
  }
2844
- function so(e) {
3102
+ function To(e) {
2845
3103
  const t = e.fields.map((n) => {
2846
3104
  if (n.source === "registered")
2847
3105
  return n;
2848
- const r = co(n);
3106
+ const r = Io(n);
2849
3107
  return r ? { ...n, element: r } : null;
2850
3108
  });
2851
3109
  return t.some((n) => !n) ? null : {
@@ -2853,7 +3111,7 @@ function so(e) {
2853
3111
  fields: t
2854
3112
  };
2855
3113
  }
2856
- function ao(e, t) {
3114
+ function Lo(e, t) {
2857
3115
  var s, a;
2858
3116
  const n = new Map(t.fields.map((c) => [c.fieldId, c])), r = [], o = /* @__PURE__ */ new Set();
2859
3117
  for (const c of e.fields) {
@@ -2872,7 +3130,7 @@ function ao(e, t) {
2872
3130
  readonly: c.readonly ?? l.readonly,
2873
3131
  disabled: c.disabled ?? l.disabled
2874
3132
  };
2875
- u.fingerprint = z({
3133
+ u.fingerprint = j({
2876
3134
  ...u,
2877
3135
  tagName: (a = u.element) == null ? void 0 : a.tagName.toLowerCase()
2878
3136
  }), r.push(u);
@@ -2885,77 +3143,77 @@ function ao(e, t) {
2885
3143
  fields: [...r, ...i]
2886
3144
  };
2887
3145
  }
2888
- function co(e) {
3146
+ function Io(e) {
2889
3147
  var t;
2890
3148
  if ((t = e.element) != null && t.isConnected) return e.element;
2891
3149
  try {
2892
- return document.querySelector(`[data-smart-fill-id="${Co(e.fieldId)}"]`);
3150
+ return document.querySelector(`[data-smart-fill-id="${Go(e.fieldId)}"]`);
2893
3151
  } catch {
2894
3152
  return null;
2895
3153
  }
2896
3154
  }
2897
- function lo(e) {
2898
- const t = typeof location < "u" ? `${location.origin}${location.pathname}${location.search}` : "unknown-page", n = zt(e.root || document);
3155
+ function Mo(e) {
3156
+ const t = typeof location < "u" ? `${location.origin}${location.pathname}${location.search}` : "unknown-page", n = tn(e.root || document);
2899
3157
  return `smart-fill:${t}:${e.formCode || "default-form"}:${n}:${e.maxFields ?? 200}:scan`;
2900
3158
  }
2901
- function uo(e) {
2902
- const t = zt(e.root || document);
2903
- return `${Nt}${e.formCode || "default-form"}:${t}:${e.maxFields ?? 200}`;
3159
+ function Ro(e) {
3160
+ const t = tn(e.root || document);
3161
+ return `${Jt}${e.formCode || "default-form"}:${t}:${e.maxFields ?? 200}`;
2904
3162
  }
2905
- function zt(e) {
3163
+ function tn(e) {
2906
3164
  if (e === document) return "document";
2907
- const t = tt.get(e);
3165
+ const t = lt.get(e);
2908
3166
  if (t) return t;
2909
- const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++Jr}`;
2910
- return tt.set(e, n), n;
3167
+ const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++wo}`;
3168
+ return lt.set(e, n), n;
2911
3169
  }
2912
- function po() {
2913
- if (et || typeof window > "u") return;
2914
- et = !0;
3170
+ function Fo() {
3171
+ if (ct || typeof window > "u") return;
3172
+ ct = !0;
2915
3173
  const e = () => {
2916
- window.dispatchEvent(new Event(Pe));
3174
+ window.dispatchEvent(new Event(Ke));
2917
3175
  };
2918
- window.addEventListener("popstate", e), window.addEventListener("hashchange", e), rt("pushState", e), rt("replaceState", e);
3176
+ window.addEventListener("popstate", e), window.addEventListener("hashchange", e), dt("pushState", e), dt("replaceState", e);
2919
3177
  }
2920
- function rt(e, t) {
3178
+ function dt(e, t) {
2921
3179
  const n = window.history[e];
2922
3180
  window.history[e] = function(...o) {
2923
3181
  const i = n.apply(this, o);
2924
3182
  return t(), i;
2925
3183
  };
2926
3184
  }
2927
- function ot() {
3185
+ function ft() {
2928
3186
  return typeof location > "u" ? "unknown-route" : `${location.pathname}${location.search}${location.hash}`;
2929
3187
  }
2930
- function fo(e) {
2931
- const t = ho(e.floatingContainer);
3188
+ function Oo(e) {
3189
+ const t = qo(e.floatingContainer);
2932
3190
  if (t)
2933
3191
  return t;
2934
- const n = go(e.routeContainerSelector);
2935
- return n || yo() || document.body;
3192
+ const n = Do(e.routeContainerSelector);
3193
+ return n || Po() || document.body;
2936
3194
  }
2937
- function ho(e) {
2938
- return e ? e instanceof HTMLElement ? e : He(e) : null;
3195
+ function qo(e) {
3196
+ return e ? e instanceof HTMLElement ? e : Ve(e) : null;
2939
3197
  }
2940
- function go(e) {
3198
+ function Do(e) {
2941
3199
  if (!e) return null;
2942
- const t = Bt(), n = t ? He(e, t) : null;
2943
- return n || He(e);
3200
+ const t = nn(), n = t ? Ve(e, t) : null;
3201
+ return n || Ve(e);
2944
3202
  }
2945
- function yo() {
2946
- const e = Bt();
3203
+ function Po() {
3204
+ const e = nn();
2947
3205
  if (!e)
2948
3206
  return null;
2949
- const t = bo(e);
3207
+ const t = Ho(e);
2950
3208
  if (t)
2951
3209
  return t;
2952
- const n = mo(e);
3210
+ const n = No(e);
2953
3211
  if (n)
2954
3212
  return n;
2955
- const r = wo(e);
3213
+ const r = $o(e);
2956
3214
  return r !== e ? r : null;
2957
3215
  }
2958
- function Bt() {
3216
+ function nn() {
2959
3217
  const e = [
2960
3218
  "#app",
2961
3219
  "#root",
@@ -2969,16 +3227,16 @@ function Bt() {
2969
3227
  ];
2970
3228
  for (const t of e) {
2971
3229
  const n = document.querySelector(t);
2972
- if (n && we(n))
3230
+ if (n && _e(n))
2973
3231
  return n;
2974
3232
  }
2975
3233
  return null;
2976
3234
  }
2977
- function bo(e) {
2978
- const t = m(e), n = Ut(e).filter((o) => !Ke(o)).filter((o) => m(o) >= Math.max(t * 0.2, 48e3)), r = n.filter((o) => vo(o));
2979
- return r.length ? r.sort((o, i) => m(i) - m(o))[0] : n.length === 1 ? n[0] : null;
3235
+ function Ho(e) {
3236
+ const t = w(e), n = rn(e).filter((o) => !Ye(o)).filter((o) => w(o) >= Math.max(t * 0.2, 48e3)), r = n.filter((o) => zo(o));
3237
+ return r.length ? r.sort((o, i) => w(i) - w(o))[0] : n.length === 1 ? n[0] : null;
2980
3238
  }
2981
- function mo(e) {
3239
+ function No(e) {
2982
3240
  const t = [
2983
3241
  "[data-route-root]",
2984
3242
  "[data-router-view]",
@@ -2994,63 +3252,63 @@ function mo(e) {
2994
3252
  ".app-content",
2995
3253
  "main",
2996
3254
  '[role="main"]'
2997
- ], n = jt(e), r = m(e);
2998
- return t.flatMap((i) => Array.from(e.querySelectorAll(i))).filter((i) => we(i) && !Ke(i)).filter((i) => Ce(i, n) <= 3).filter((i) => m(i) >= Math.max(r * 0.2, 48e3)).sort((i, s) => Ce(i, n) - Ce(s, n) || m(s) - m(i))[0] || null;
3255
+ ], n = on(e), r = w(e);
3256
+ return t.flatMap((i) => Array.from(e.querySelectorAll(i))).filter((i) => _e(i) && !Ye(i)).filter((i) => Me(i, n) <= 3).filter((i) => w(i) >= Math.max(r * 0.2, 48e3)).sort((i, s) => Me(i, n) - Me(s, n) || w(s) - w(i))[0] || null;
2999
3257
  }
3000
- function wo(e) {
3258
+ function $o(e) {
3001
3259
  let t = e;
3002
3260
  for (; ; ) {
3003
- const n = Ut(t).filter((o) => !Ke(o));
3261
+ const n = rn(t).filter((o) => !Ye(o));
3004
3262
  if (n.length !== 1)
3005
3263
  return t;
3006
3264
  const [r] = n;
3007
- if (m(r) < Math.max(m(t) * 0.25, 48e3))
3265
+ if (w(r) < Math.max(w(t) * 0.25, 48e3))
3008
3266
  return t;
3009
3267
  t = r;
3010
3268
  }
3011
3269
  }
3012
- function Ut(e) {
3013
- return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => we(t));
3270
+ function rn(e) {
3271
+ return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => _e(t));
3014
3272
  }
3015
- function He(e, t = document) {
3273
+ function Ve(e, t = document) {
3016
3274
  try {
3017
3275
  const n = t.querySelector(e);
3018
- return n && we(n) ? n : null;
3276
+ return n && _e(n) ? n : null;
3019
3277
  } catch {
3020
3278
  return null;
3021
3279
  }
3022
3280
  }
3023
- function we(e) {
3281
+ function _e(e) {
3024
3282
  const t = window.getComputedStyle(e);
3025
3283
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
3026
3284
  return !1;
3027
3285
  const n = e.getBoundingClientRect();
3028
3286
  return n.width > 0 && n.height > 0;
3029
3287
  }
3030
- function Ke(e) {
3288
+ function Ye(e) {
3031
3289
  const t = window.getComputedStyle(e);
3032
- return t.position === "fixed" || t.position === "sticky" ? !0 : m(e) < 24e3;
3290
+ return t.position === "fixed" || t.position === "sticky" ? !0 : w(e) < 24e3;
3033
3291
  }
3034
- function vo(e) {
3292
+ function zo(e) {
3035
3293
  if (e.tagName.toLowerCase() === "main" || e.getAttribute("role") === "main")
3036
3294
  return !0;
3037
3295
  const t = e.id || "", n = typeof e.className == "string" ? e.className : "", r = `${t} ${n}`.toLowerCase();
3038
3296
  return /(page|layout|content|container|main|router|route|view)/.test(r);
3039
3297
  }
3040
- function m(e) {
3298
+ function w(e) {
3041
3299
  const t = e.getBoundingClientRect();
3042
3300
  return Math.max(0, t.width) * Math.max(0, t.height);
3043
3301
  }
3044
- function jt(e) {
3302
+ function on(e) {
3045
3303
  let t = 0, n = e;
3046
3304
  for (; n && n !== document.body; )
3047
3305
  t += 1, n = n.parentElement;
3048
3306
  return t;
3049
3307
  }
3050
- function Ce(e, t) {
3051
- return Math.max(0, jt(e) - t);
3308
+ function Me(e, t) {
3309
+ return Math.max(0, on(e) - t);
3052
3310
  }
3053
- function So(e) {
3311
+ function Ko(e) {
3054
3312
  try {
3055
3313
  const t = window.sessionStorage.getItem(e);
3056
3314
  if (!t) return null;
@@ -3060,13 +3318,13 @@ function So(e) {
3060
3318
  return null;
3061
3319
  }
3062
3320
  }
3063
- function Eo(e, t) {
3321
+ function Vo(e, t) {
3064
3322
  try {
3065
3323
  window.sessionStorage.setItem(e, JSON.stringify(t));
3066
3324
  } catch {
3067
3325
  }
3068
3326
  }
3069
- function Gt(e) {
3327
+ function sn(e) {
3070
3328
  try {
3071
3329
  if (e) {
3072
3330
  window.sessionStorage.removeItem(e);
@@ -3075,24 +3333,24 @@ function Gt(e) {
3075
3333
  const t = [];
3076
3334
  for (let n = 0; n < window.sessionStorage.length; n += 1) {
3077
3335
  const r = window.sessionStorage.key(n);
3078
- r != null && r.startsWith(Nt) && t.push(r);
3336
+ r != null && r.startsWith(Jt) && t.push(r);
3079
3337
  }
3080
3338
  for (const n of t)
3081
3339
  window.sessionStorage.removeItem(n);
3082
3340
  } catch {
3083
3341
  }
3084
3342
  }
3085
- function it(e, t = "default") {
3343
+ function pt(e, t = "default") {
3086
3344
  const n = typeof location < "u" ? location.pathname : "unknown-page", r = t.replace(/[^\w-]/g, "_") || "default";
3087
3345
  return `smart-fill:${e}:${n}:${r}:open`;
3088
3346
  }
3089
- function xo(e, t) {
3347
+ function Bo(e, t) {
3090
3348
  if (typeof e == "string") return e;
3091
3349
  if (t.id) return `#${t.id}`;
3092
3350
  const n = typeof t.className == "string" ? t.className.trim().split(/\s+/).filter(Boolean)[0] : "";
3093
3351
  return n ? `.${n}` : t.tagName.toLowerCase();
3094
3352
  }
3095
- function st(e, t) {
3353
+ function ht(e, t) {
3096
3354
  try {
3097
3355
  const n = window.localStorage.getItem(e);
3098
3356
  return n == null ? t : n === "1";
@@ -3100,63 +3358,63 @@ function st(e, t) {
3100
3358
  return t;
3101
3359
  }
3102
3360
  }
3103
- function at(e, t) {
3361
+ function gt(e, t) {
3104
3362
  if (e)
3105
3363
  try {
3106
3364
  window.localStorage.setItem(e, t ? "1" : "0");
3107
3365
  } catch {
3108
3366
  }
3109
3367
  }
3110
- function Yt() {
3368
+ function an() {
3111
3369
  return `smart-fill:${typeof location < "u" ? location.pathname : "unknown-page"}:local-priority`;
3112
3370
  }
3113
- function ko() {
3371
+ function Uo() {
3114
3372
  try {
3115
- return window.localStorage.getItem(Yt()) === "1";
3373
+ return window.localStorage.getItem(an()) === "1";
3116
3374
  } catch {
3117
3375
  return !1;
3118
3376
  }
3119
3377
  }
3120
- function _o(e) {
3378
+ function jo(e) {
3121
3379
  try {
3122
- window.localStorage.setItem(Yt(), e ? "1" : "0");
3380
+ window.localStorage.setItem(an(), e ? "1" : "0");
3123
3381
  } catch {
3124
3382
  }
3125
3383
  }
3126
- function Co(e) {
3384
+ function Go(e) {
3127
3385
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
3128
3386
  }
3129
- const f = { status: "idle" }, Ae = new Ft(), ct = new lr();
3130
- class Ao {
3387
+ const h = { status: "idle" }, Re = new Ut(), yt = new Ir();
3388
+ class Yo {
3131
3389
  /** 初始化 SDK:校验 apiKey、创建会话、获取 accessToken */
3132
3390
  static async setup(t) {
3133
3391
  if (typeof window > "u")
3134
- return f.status = "ready", To();
3135
- if (f.status === "ready" && f.apiKey === t.apiKey && f.session)
3136
- return f.session;
3137
- if (f.status === "loading" && f.apiKey === t.apiKey && f.promise)
3138
- return f.promise;
3139
- f.apiKey && f.apiKey !== t.apiKey && (Vt(), ct.destroyAll());
3140
- const n = new rr(t);
3141
- return f.status = "loading", f.apiKey = t.apiKey, f.client = n, f.promise = n.createSession().then((r) => (console.log("SmartFill session created:", r), n.setAccessToken(r.apiKey), f.status = "ready", f.session = r, Ae.emit("ready", { apiKey: t.apiKey }), r)).catch((r) => {
3142
- throw f.status = "error", r;
3143
- }), f.promise;
3392
+ return h.status = "ready", Wo();
3393
+ if (h.status === "ready" && h.apiKey === t.apiKey && h.session)
3394
+ return h.session;
3395
+ if (h.status === "loading" && h.apiKey === t.apiKey && h.promise)
3396
+ return h.promise;
3397
+ h.apiKey && h.apiKey !== t.apiKey && (Qt(), yt.destroyAll());
3398
+ const n = new kr(t);
3399
+ return h.status = "loading", h.apiKey = t.apiKey, h.client = n, h.promise = n.createSession().then((r) => (console.log("SmartFill session created:", r), n.setAccessToken(r.apiKey), h.status = "ready", h.session = r, Re.emit("ready", { apiKey: t.apiKey }), r)).catch((r) => {
3400
+ throw h.status = "error", r;
3401
+ }), h.promise;
3144
3402
  }
3145
3403
  /** 创建页面实例,必须在 setup ready 后调用 */
3146
3404
  static create(t = {}) {
3147
3405
  if (typeof window > "u")
3148
- return N();
3149
- if (f.status !== "ready" || !f.client)
3150
- throw b("SDK_NOT_READY", "请先 await SmartFill.setup({ apiKey })。", "setup");
3151
- return new Qr(t, {
3152
- client: f.client,
3153
- manager: ct
3406
+ return V();
3407
+ if (h.status !== "ready" || !h.client)
3408
+ throw v("SDK_NOT_READY", "请先 await SmartFill.setup({ apiKey })。", "setup");
3409
+ return new So(t, {
3410
+ client: h.client,
3411
+ manager: yt
3154
3412
  });
3155
3413
  }
3156
3414
  }
3157
3415
  /** 订阅全局事件(目前仅 ready) */
3158
- d(Ao, "on", Ae.on.bind(Ae));
3159
- function To() {
3416
+ d(Yo, "on", Re.on.bind(Re));
3417
+ function Wo() {
3160
3418
  return {
3161
3419
  apiKey: "server-mock",
3162
3420
  accessToken: "server-mock",
@@ -3166,16 +3424,16 @@ function To() {
3166
3424
  rulesVersion: "server"
3167
3425
  };
3168
3426
  }
3169
- function N(e) {
3427
+ function V(e) {
3170
3428
  const t = () => {
3171
3429
  };
3172
3430
  return {
3173
3431
  on: t,
3174
- useAdapter: () => N(),
3175
- registerFields: () => N(),
3432
+ useAdapter: () => V(),
3433
+ registerFields: () => V(),
3176
3434
  unregisterFields: t,
3177
- mount: () => N(),
3178
- mountFloatingButton: () => N(),
3435
+ mount: () => V(),
3436
+ mountFloatingButton: () => V(),
3179
3437
  open: async () => {
3180
3438
  },
3181
3439
  close: t,
@@ -3193,14 +3451,14 @@ function N(e) {
3193
3451
  };
3194
3452
  }
3195
3453
  export {
3196
- nr as DEFAULT_BASE_URL,
3197
- Ze as DomFiller,
3198
- Fr as DomScanner,
3199
- Mo as ElementAdapter,
3200
- Ft as EventBus,
3201
- Sr as LocalRuleEngine,
3202
- Io as NativeAdapter,
3203
- Ao as SmartFill,
3204
- Qr as SmartFillInstance,
3205
- Mt as UiFrameworkAdapter
3454
+ xr as DEFAULT_BASE_URL,
3455
+ it as DomFiller,
3456
+ eo as DomScanner,
3457
+ Jo as ElementAdapter,
3458
+ Ut as EventBus,
3459
+ Kr as LocalRuleEngine,
3460
+ Zo as NativeAdapter,
3461
+ Yo as SmartFill,
3462
+ So as SmartFillInstance,
3463
+ Vt as UiFrameworkAdapter
3206
3464
  };