@kc-one/smart-fill-sdk 0.0.4 → 0.0.6

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 Yt = Object.defineProperty;
2
- var Wt = (e, t, n) => t in e ? Yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var d = (e, t, n) => Wt(e, typeof t != "symbol" ? t + "" : t, n);
4
- const To = {
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 = {
5
5
  name: "native",
6
6
  /** 匹配 input / textarea / select 原生控件 */
7
7
  match: (e) => e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement,
@@ -59,7 +59,7 @@ const To = {
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
- ], Xt = [
62
+ ], Zt = [
63
63
  "is-disabled",
64
64
  "ant-select-disabled",
65
65
  "n-select--disabled",
@@ -68,7 +68,7 @@ const To = {
68
68
  "van-switch--disabled",
69
69
  "van-stepper--disabled",
70
70
  "van-dropdown-menu--disabled"
71
- ], ut = lt.map((e) => e.selectors).join(", "), Zt = [
71
+ ], ut = lt.map((e) => e.selectors).join(", "), Jt = [
72
72
  ".form-item",
73
73
  ".ant-form-item",
74
74
  ".el-form-item",
@@ -78,7 +78,7 @@ const To = {
78
78
  ".van-field",
79
79
  ".field",
80
80
  ".form-row"
81
- ].join(", "), Jt = [
81
+ ].join(", "), Qt = [
82
82
  "label",
83
83
  ".ant-form-item-label",
84
84
  ".el-form-item__label",
@@ -86,7 +86,7 @@ const To = {
86
86
  ".arco-form-item-label",
87
87
  ".van-field__label",
88
88
  ".label"
89
- ].join(", "), Be = [
89
+ ].join(", "), ze = [
90
90
  "dialog[open]",
91
91
  "[role='dialog']",
92
92
  "[aria-modal='true']",
@@ -105,7 +105,7 @@ const To = {
105
105
  ".van-action-sheet",
106
106
  ".popup",
107
107
  ".drawer"
108
- ].join(", "), Qt = [
108
+ ].join(", "), en = [
109
109
  "is-checked",
110
110
  "ant-switch-checked",
111
111
  "n-switch--active",
@@ -114,20 +114,20 @@ const To = {
114
114
  "van-radio--checked",
115
115
  "van-checkbox--checked"
116
116
  ];
117
- function F(e) {
117
+ function O(e) {
118
118
  return lt.find((t) => e.matches(t.selectors)) || null;
119
119
  }
120
120
  function dt(e) {
121
- return !!F(e);
121
+ return !!O(e);
122
122
  }
123
- function Le(e) {
123
+ function Te(e) {
124
124
  for (let t = e; t; t = t.parentElement)
125
125
  if (dt(t)) return t;
126
126
  return null;
127
127
  }
128
- function le(e) {
128
+ function ce(e) {
129
129
  var n;
130
- const t = F(e);
130
+ const t = O(e);
131
131
  if (!t) return null;
132
132
  if (e.matches(".van-field")) {
133
133
  if (e.querySelector("textarea")) return "textarea";
@@ -147,28 +147,28 @@ function le(e) {
147
147
  return t.type;
148
148
  }
149
149
  function pt(e) {
150
- const t = F(e);
150
+ const t = O(e);
151
151
  if (t != null && t.optionSelector)
152
- return Array.from(e.querySelectorAll(t.optionSelector)).map((n) => en(n)).filter((n) => !!(n.label || n.value));
152
+ return Array.from(e.querySelectorAll(t.optionSelector)).map((n) => tn(n)).filter((n) => !!(n.label || n.value));
153
153
  }
154
- function en(e) {
154
+ function tn(e) {
155
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;
156
156
  return { label: n, value: r };
157
157
  }
158
- function j(e) {
159
- return Qt.some((t) => e.classList.contains(t)) || e.getAttribute("aria-checked") === "true" || !!e.querySelector("input:checked");
158
+ function U(e) {
159
+ return en.some((t) => e.classList.contains(t)) || e.getAttribute("aria-checked") === "true" || !!e.querySelector("input:checked");
160
160
  }
161
- function O(e) {
161
+ function F(e) {
162
162
  return e.querySelector('input:not([type="hidden"]), textarea');
163
163
  }
164
164
  function ft(e) {
165
165
  var t, n, r;
166
- return e.getAttribute("name") || ((t = O(e)) == null ? void 0 : t.getAttribute("name")) || e.getAttribute("data-smart-fill-key") || ((n = O(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 = 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"));
167
167
  }
168
168
  function p(e) {
169
169
  return e.replace(/[*::]/g, "").replace(/\s+/g, " ").trim();
170
170
  }
171
- const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-style", ht = [
171
+ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-style", ht = [
172
172
  "[role='combobox']",
173
173
  "[aria-haspopup='listbox']",
174
174
  ".el-cascader",
@@ -191,7 +191,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
191
191
  ".van-dropdown-menu__bar",
192
192
  ".van-field--picker",
193
193
  ".van-field--clickable"
194
- ].join(", "), tn = [
194
+ ].join(", "), nn = [
195
195
  ".ant-select-selection-item",
196
196
  ".el-select__selected-item",
197
197
  ".el-select-v2__selected-item",
@@ -207,7 +207,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
207
207
  ".select-value",
208
208
  ".selection-item",
209
209
  ".van-field__control"
210
- ].join(", "), Me = [
210
+ ].join(", "), Ie = [
211
211
  "[role='option']",
212
212
  ".ant-select-item-option",
213
213
  ".el-select-dropdown__item",
@@ -219,8 +219,8 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
219
219
  ".t-select-option",
220
220
  ".van-picker-column__item",
221
221
  ".van-action-sheet__item"
222
- ].join(", "), ue = [
223
- Me,
222
+ ].join(", "), le = [
223
+ Ie,
224
224
  ".van-action-sheet__name",
225
225
  ".van-cascader__option",
226
226
  ".van-dropdown-item__option",
@@ -229,7 +229,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
229
229
  ".ant-cascader-menu-item",
230
230
  ".n-cascader-node",
231
231
  ".arco-cascader-option"
232
- ].join(", "), Re = [
232
+ ].join(", "), Me = [
233
233
  ".el-select-dropdown",
234
234
  ".el-cascader__dropdown",
235
235
  ".el-cascader-panel",
@@ -279,9 +279,9 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
279
279
  ".arco-cascader-panel",
280
280
  ".van-cascader",
281
281
  ".van-cascader__options"
282
- ].join(", "), nn = /(?:省|市|自治区|特别行政区|自治州|地区|盟|县|区)$/, rn = /地址|省|市|区|县|地区|籍贯|户籍|居住地|所在地|区域/, on = /* @__PURE__ */ new Set(["select", "cascader", "date"]);
282
+ ].join(", "), rn = /(?:省|市|自治区|特别行政区|自治州|地区|盟|县|区)$/, on = /地址|省|市|区|县|地区|籍贯|户籍|居住地|所在地|区域/, sn = /* @__PURE__ */ new Set(["select", "cascader", "date"]);
283
283
  function C(e) {
284
- return !_t(e) || mt(e) ? !1 : !!e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
284
+ return !Ct(e) || wt(e) ? !1 : !!e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
285
285
  }
286
286
  function E(e) {
287
287
  var n;
@@ -300,10 +300,10 @@ function E(e) {
300
300
  }
301
301
  return !1;
302
302
  }
303
- function G(e) {
304
- return !_t(e) || mt(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 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);
305
305
  }
306
- function Y(e) {
306
+ function G(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,27 +333,24 @@ function Y(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 : G(e) ? e : null;
336
+ return n instanceof HTMLElement ? n.matches(".van-field") && !E(n) ? null : n : j(e) ? e : null;
337
337
  }
338
- function Oe(e) {
338
+ function Re(e) {
339
339
  if (e instanceof HTMLSelectElement) return e;
340
340
  if (C(e))
341
341
  return e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
342
- const t = Y(e);
342
+ const t = G(e);
343
343
  return t || (e.matches(".van-field") && E(e) ? e : null);
344
344
  }
345
- function $e(e) {
345
+ function bt(e) {
346
346
  if (C(e)) return "cascader";
347
- if (G(e) || E(e)) return "select";
348
- const t = le(e);
347
+ if (j(e) || E(e)) return "select";
348
+ const t = ce(e);
349
349
  return t || (e instanceof HTMLSelectElement ? "select" : null);
350
350
  }
351
- function B(e, t) {
352
- const n = t || $e(e);
353
- return n != null && on.has(n);
354
- }
355
- function sn(e) {
356
- return B(e, $e(e) || void 0);
351
+ function Fe(e, t) {
352
+ const n = t || bt(e);
353
+ return n != null && sn.has(n);
357
354
  }
358
355
  function an(e) {
359
356
  const t = e.matches(".van-field") ? e : e.closest(".van-field");
@@ -364,7 +361,7 @@ function an(e) {
364
361
  const s = p((i == null ? void 0 : i.textContent) || "");
365
362
  return s && s !== "请选择" ? s : "";
366
363
  }
367
- const n = e.querySelector(tn);
364
+ const n = e.querySelector(nn);
368
365
  if (n instanceof HTMLInputElement)
369
366
  return p(n.value);
370
367
  const r = p((n == null ? void 0 : n.textContent) || "");
@@ -372,23 +369,23 @@ function an(e) {
372
369
  const o = e.querySelector('input:not([type="hidden"])');
373
370
  return o != null && o.value ? p(o.value) : r;
374
371
  }
375
- function bt(e) {
372
+ function mt(e) {
376
373
  const t = hn(e);
377
374
  if (!t.length) return;
378
375
  const n = gn(t);
379
376
  return n.length ? n : void 0;
380
377
  }
381
- function re(e) {
378
+ function ne(e) {
382
379
  var t;
383
- return !((t = e.options) != null && t.length) || e.type === "cascader" || rn.test(e.label || "") ? !1 : Sn(e.options);
380
+ return !((t = e.options) != null && t.length) || e.type === "cascader" || on.test(e.label || "") ? !1 : Sn(e.options);
384
381
  }
385
382
  async function cn(e) {
386
383
  if (e instanceof HTMLSelectElement)
387
384
  return Array.from(e.options).map((s) => ({ value: s.value, label: p(s.textContent || s.label) })).filter((s) => s.label || s.value);
388
- const t = bt(e);
385
+ const t = mt(e);
389
386
  if (t != null && t.length) return t;
390
- const n = Y(e) || e;
391
- if (!G(n) && !C(n) && !E(n))
387
+ const n = G(e) || e;
388
+ if (!j(n) && !C(n) && !E(n))
392
389
  return;
393
390
  const r = _n(), o = En(), i = new Set(o.getTrackedDropdowns());
394
391
  try {
@@ -401,14 +398,14 @@ async function cn(e) {
401
398
  await kn(n, o), await M(60), o.restore(), r();
402
399
  }
403
400
  }
404
- function mt(e) {
401
+ function wt(e) {
405
402
  return e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true";
406
403
  }
407
404
  async function ln(e, t, n) {
408
- const r = W(e);
405
+ const r = Y(e);
409
406
  if (!r.length) return !1;
410
407
  for (const o of r)
411
- if (xt(o), Et(o), await M(160), je(e, t, n) || (kt(o), await M(180), je(e, t, n))) return !0;
408
+ if (kt(o), xt(o), await M(160), Ue(e, t, n) || (_t(o), await M(180), Ue(e, t, n))) return !0;
412
409
  return !1;
413
410
  }
414
411
  async function un(e, t, n) {
@@ -420,14 +417,14 @@ async function un(e, t, n) {
420
417
  e.querySelector("input")
421
418
  ].filter((o) => o instanceof HTMLElement);
422
419
  for (const o of r)
423
- if (xt(o), Et(o), await M(180), de(t, n, e).length || (kt(o), await M(180), de(t, n, e).length)) return !0;
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;
424
421
  return !1;
425
422
  }
426
423
  function dn(e) {
427
424
  var r;
428
425
  const t = /* @__PURE__ */ new Set(), n = [];
429
426
  for (const o of e) {
430
- const i = o.matches(ue) ? [o] : Array.from(o.querySelectorAll(ue));
427
+ const i = o.matches(le) ? [o] : Array.from(o.querySelectorAll(le));
431
428
  for (const s of i) {
432
429
  if (s.classList.contains("is-disabled") || s.classList.contains("ant-select-item-option-disabled") || s.getAttribute("aria-disabled") === "true")
433
430
  continue;
@@ -443,50 +440,50 @@ function dn(e) {
443
440
  }
444
441
  async function pn(e, t, n) {
445
442
  for (let r = 0; r < 8; r += 1) {
446
- const o = de(e, t, n);
443
+ const o = ue(e, t, n);
447
444
  if (o.length) return o;
448
445
  await M(r === 0 ? 120 : 80);
449
446
  }
450
447
  return [];
451
448
  }
452
- function je(e, t, n) {
453
- return de(t, n, e).length > 0 ? !0 : W(e).some((r) => r.getAttribute("aria-expanded") === "true" || r.classList.contains("is-focus") || r.classList.contains("is-focused"));
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"));
454
451
  }
455
452
  function fn(e, t, n) {
456
- const r = t.filter((c) => Fe(e, c)), o = r.filter((c) => yn(e, c)), i = o.filter((c) => !n.has(c));
453
+ const r = t.filter((c) => Oe(e, c)), o = r.filter((c) => yn(e, c)), i = o.filter((c) => !n.has(c));
457
454
  if (i.length)
458
455
  return i.sort((c, l) => R(l, e) - R(c, e));
459
- const s = wt(e);
456
+ const s = vt(e);
460
457
  if (s.size) {
461
458
  const c = o.filter((l) => l.id && s.has(l.id));
462
459
  if (c.length) return c;
463
460
  }
464
461
  if (o.length)
465
462
  return o.sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
466
- const a = r.filter((c) => vn(c) && vt(e)).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);
467
464
  return a.length ? a : [];
468
465
  }
469
- function de(e, t, n) {
466
+ function ue(e, t, n) {
470
467
  return fn(n, e.getTrackedDropdowns(), t);
471
468
  }
472
469
  function R(e, t) {
473
470
  const n = e.getBoundingClientRect(), r = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
474
471
  let o = (Number.isNaN(r) ? 0 : r) * 10 + n.width * n.height;
475
- return t && (o += St(t, e)), o;
472
+ return t && (o += Et(t, e)), o;
476
473
  }
477
474
  function hn(e) {
478
475
  const t = C(e) ? yt : gt, n = /* @__PURE__ */ new Set();
479
476
  e.matches(t) && n.add(e);
480
477
  for (const r of e.querySelectorAll(t))
481
- Fe(e, r) && n.add(r);
478
+ Oe(e, r) && n.add(r);
482
479
  for (const r of e.querySelectorAll("[role='listbox']"))
483
- e.contains(r) && Fe(e, r) && n.add(r);
480
+ e.contains(r) && Oe(e, r) && n.add(r);
484
481
  return [...n];
485
482
  }
486
483
  function gn(e) {
487
484
  const t = /* @__PURE__ */ new Set(), n = [];
488
485
  for (const r of e) {
489
- const o = r.matches(Me) ? [r] : Array.from(r.querySelectorAll(Me));
486
+ const o = r.matches(Ie) ? [r] : Array.from(r.querySelectorAll(Ie));
490
487
  for (const i of o) {
491
488
  if (i.classList.contains("is-disabled") || i.classList.contains("ant-select-item-option-disabled") || i.getAttribute("aria-disabled") === "true")
492
489
  continue;
@@ -498,16 +495,16 @@ function gn(e) {
498
495
  }
499
496
  return n;
500
497
  }
501
- function wt(e) {
498
+ function vt(e) {
502
499
  return new Set(
503
- W(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
500
+ Y(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
504
501
  );
505
502
  }
506
503
  function yn(e, t) {
507
- const n = wt(e);
508
- return n.size && t.id && n.has(t.id) || e.contains(t) ? !0 : wn(t) ? vt(e) : n.size > 0 || W(e).some((o) => o.getAttribute("aria-controls") || o.getAttribute("aria-owns")) ? !1 : St(e, t) > 0;
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;
509
506
  }
510
- function Fe(e, t) {
507
+ function Oe(e, t) {
511
508
  const n = C(e), r = bn(t);
512
509
  return n ? r : r ? !1 : mn(t);
513
510
  }
@@ -520,13 +517,13 @@ function mn(e) {
520
517
  function wn(e) {
521
518
  return e.matches(".van-popup, .van-action-sheet, .van-picker, .van-dropdown-item__content, .van-dropdown-item");
522
519
  }
523
- function vt(e) {
524
- return W(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused") || e.contains(document.activeElement));
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));
525
522
  }
526
523
  function vn(e) {
527
- return e.matches(ue) || !!e.querySelector(ue);
524
+ return e.matches(le) || !!e.querySelector(le);
528
525
  }
529
- function St(e, t) {
526
+ function Et(e, t) {
530
527
  const n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
531
528
  if (!n.width || !n.height || !r.width || !r.height)
532
529
  return 0;
@@ -537,9 +534,9 @@ function St(e, t) {
537
534
  }
538
535
  function Sn(e) {
539
536
  const t = e.slice(0, 8).map((r) => p(String(r.label || r.value || ""))).filter(Boolean);
540
- return t.length < 4 ? !1 : t.filter((r) => nn.test(r)).length / t.length >= 0.75;
537
+ return t.length < 4 ? !1 : t.filter((r) => rn.test(r)).length / t.length >= 0.75;
541
538
  }
542
- function W(e) {
539
+ function Y(e) {
543
540
  return [
544
541
  e,
545
542
  e.querySelector(".van-field__control"),
@@ -566,9 +563,9 @@ function W(e) {
566
563
  }
567
564
  function En() {
568
565
  const e = /* @__PURE__ */ new Map();
569
- xn(), document.documentElement.setAttribute(Ie, "true");
566
+ xn(), document.documentElement.setAttribute(Le, "true");
570
567
  const t = () => {
571
- for (const r of document.querySelectorAll(Re))
568
+ for (const r of document.querySelectorAll(Me))
572
569
  e.has(r) || e.set(r, {
573
570
  display: r.style.display,
574
571
  opacity: r.style.opacity,
@@ -584,19 +581,19 @@ function En() {
584
581
  attributes: !0,
585
582
  attributeFilter: ["class", "style", "aria-hidden"]
586
583
  }), {
587
- getTrackedDropdowns: () => Array.from(document.querySelectorAll(Re)),
584
+ getTrackedDropdowns: () => Array.from(document.querySelectorAll(Me)),
588
585
  restore: () => {
589
- n.disconnect(), document.documentElement.removeAttribute(Ie);
586
+ n.disconnect(), document.documentElement.removeAttribute(Le);
590
587
  for (const [r, o] of e)
591
588
  r.style.display = o.display, r.style.opacity = o.opacity, r.style.visibility = o.visibility, r.style.pointerEvents = o.pointerEvents;
592
589
  }
593
590
  };
594
591
  }
595
592
  function xn() {
596
- if (document.getElementById(Ue)) return;
593
+ if (document.getElementById(Be)) return;
597
594
  const e = document.createElement("style");
598
- e.id = Ue, e.textContent = `
599
- ${Re.split(",").map((t) => `html[${Ie}="true"] ${t.trim()}`).join(`,
595
+ e.id = Be, e.textContent = `
596
+ ${Me.split(",").map((t) => `html[${Le}="true"] ${t.trim()}`).join(`,
600
597
  `)} {
601
598
  opacity: 0 !important;
602
599
  visibility: hidden !important;
@@ -611,15 +608,15 @@ async function kn(e, t) {
611
608
  for (const n of t.getTrackedDropdowns())
612
609
  n.isConnected && (n.style.display = "none", n.setAttribute("aria-hidden", "true"));
613
610
  }
614
- function Et(e) {
611
+ function xt(e) {
615
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();
616
613
  }
617
- function xt(e) {
614
+ function kt(e) {
618
615
  e.focus({ preventScroll: !0 });
619
616
  const t = e instanceof HTMLInputElement ? e : e.querySelector("input");
620
617
  t instanceof HTMLElement && t.focus({ preventScroll: !0 });
621
618
  }
622
- function kt(e) {
619
+ function _t(e) {
623
620
  for (const t of [{ key: "ArrowDown", code: "ArrowDown" }, { key: "Enter", code: "Enter" }, { key: " ", code: "Space" }])
624
621
  e.dispatchEvent(new KeyboardEvent("keydown", { ...t, bubbles: !0, composed: !0 })), e.dispatchEvent(new KeyboardEvent("keyup", { ...t, bubbles: !0, composed: !0 }));
625
622
  }
@@ -636,29 +633,29 @@ function _n() {
636
633
  t === window ? window.scrollTo(n.left, n.top) : t instanceof HTMLElement && (t.scrollLeft = n.left, t.scrollTop = n.top);
637
634
  };
638
635
  }
639
- function _t(e) {
636
+ function Ct(e) {
640
637
  const t = window.getComputedStyle(e);
641
638
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
642
639
  return !1;
643
640
  const n = e.getBoundingClientRect();
644
641
  return n.width > 0 && n.height > 0;
645
642
  }
646
- function me(e, t) {
647
- const n = we(t);
643
+ function be(e, t) {
644
+ const n = me(t);
648
645
  if (!n.length) return null;
649
646
  let r = null, o = 0;
650
647
  for (const i of e) {
651
648
  const s = w(i.value), a = w(i.label);
652
649
  for (const c of n) {
653
650
  let l = 0;
654
- 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 && oe(s) === oe(c) || a && oe(a) === oe(c)) && (l = 80), l > o && (o = l, r = i);
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);
655
652
  }
656
653
  }
657
654
  return o >= 80 ? r : null;
658
655
  }
659
- function we(e) {
656
+ function me(e) {
660
657
  if (Array.isArray(e))
661
- return e.flatMap((n) => we(n));
658
+ return e.flatMap((n) => me(n));
662
659
  if (typeof e == "object" && e) {
663
660
  const n = e;
664
661
  return [n.label, n.value, n.text, n.answer, n.name].filter((r) => r != null).map((r) => w(r)).filter(Boolean);
@@ -669,10 +666,10 @@ function we(e) {
669
666
  function w(e) {
670
667
  return String(e ?? "").replace(/\s+/g, "").replace(/[::,,。.、()()\-_/]/g, "").trim().toLowerCase();
671
668
  }
672
- function oe(e) {
669
+ function re(e) {
673
670
  return w(e).replace(/(请选择|选择|状态|情况|类型|方式|所属|是否)$/g, "");
674
671
  }
675
- const pe = [
672
+ const de = [
676
673
  ".ant-select-item-option",
677
674
  ".el-select-dropdown__item",
678
675
  ".el-select-v2__option",
@@ -703,10 +700,10 @@ const pe = [
703
700
  ".arco-cascader-option"
704
701
  ].join(", "), Tn = ".van-picker__confirm, .van-picker__toolbar .van-picker__confirm";
705
702
  async function Ln(e, t, n, r) {
706
- const o = Ct(t, r);
707
- return e instanceof HTMLSelectElement ? In(e, o) : C(e) || n === "cascader" ? Mn(e, o) : (G(e) || E(e) || n === "select" || n === "date", Ge(e, o));
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));
708
705
  }
709
- function Ne(e) {
706
+ function $e(e) {
710
707
  if (e instanceof HTMLSelectElement) {
711
708
  const n = e.options[e.selectedIndex];
712
709
  return p((n == null ? void 0 : n.textContent) || e.value);
@@ -717,7 +714,7 @@ function Ne(e) {
717
714
  const r = e.querySelector(".el-cascader__tags-text, .el-cascader__label");
718
715
  return p((r == null ? void 0 : r.textContent) || "");
719
716
  }
720
- if (G(e) || E(e))
717
+ if (j(e) || E(e))
721
718
  return an(e);
722
719
  const t = e.querySelector("input, textarea");
723
720
  return p((t == null ? void 0 : t.value) || e.textContent || "");
@@ -727,57 +724,57 @@ async function In(e, t) {
727
724
  source: o,
728
725
  value: o.value,
729
726
  label: o.textContent
730
- })), r = me(n, t.searchValue);
727
+ })), r = be(n, t.searchValue);
731
728
  if ((r == null ? void 0 : r.source) instanceof HTMLOptionElement) {
732
- ge(e, r.source.value), _(e);
729
+ he(e, r.source.value), _(e);
733
730
  return;
734
731
  }
735
732
  if (!V(e, t))
736
733
  throw new Error("原生下拉框中没有匹配到对应选项");
737
734
  }
738
- async function Ge(e, t) {
739
- const n = Y(e) || e;
740
- if (Ee(n, t.searchValue)) return;
741
- const r = new Set(X());
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());
742
739
  try {
743
740
  if (!await Rn(n)) {
744
741
  if (V(n, t)) return;
745
742
  throw new Error("自定义下拉框未能成功展开");
746
743
  }
747
- const i = await Kn(n, r), s = await Fn(t.searchValue, i, !0);
744
+ const i = await Kn(n, r), s = await On(t.searchValue, i, !0);
748
745
  if (!(s != null && s.source)) {
749
- if (await he(n), V(n, t)) return;
746
+ if (await fe(n), V(n, t)) return;
750
747
  throw new Error("自定义下拉框展开后未找到匹配选项");
751
748
  }
752
- if (Z(s.source), await y(120), Bn(), _(n), await y(120), Ee(n, t.searchValue) || V(n, t) && Ee(n, t.searchValue))
749
+ if (X(s.source), await y(120), Bn(), _(n), await y(120), Se(n, t.searchValue) || V(n, t) && Se(n, t.searchValue))
753
750
  return;
754
751
  throw new Error("自定义下拉框点击选项后未成功回填");
755
752
  } finally {
756
- await he(n), await y(80);
753
+ await fe(n), await y(80);
757
754
  }
758
755
  }
759
756
  async function Mn(e, t) {
760
757
  const n = e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
761
- if (!Se(n, t.searchValue)) {
758
+ if (!ve(n, t.searchValue)) {
762
759
  try {
763
- if (await On(n)) {
760
+ if (await Fn(n)) {
764
761
  const o = await Pn(t.searchValue);
765
- if (await y(180), await he(n), await y(120), o && Se(n, t.searchValue)) {
762
+ if (await y(180), await fe(n), await y(120), o && ve(n, t.searchValue)) {
766
763
  _(n);
767
764
  return;
768
765
  }
769
766
  }
770
- if (Hn(n, t.fillValue) && Se(n, t.searchValue))
767
+ if (Hn(n, t.fillValue) && ve(n, t.searchValue))
771
768
  return;
772
769
  } finally {
773
- await he(n), await y(80);
770
+ await fe(n), await y(80);
774
771
  }
775
772
  throw new Error("级联选择框匹配失败");
776
773
  }
777
774
  }
778
- function Ct(e, t) {
775
+ function At(e, t) {
779
776
  var s;
780
- const n = (s = t == null ? void 0 : t.options) != null && s.length ? me(
777
+ const n = (s = t == null ? void 0 : t.options) != null && s.length ? be(
781
778
  t.options.map((a) => ({
782
779
  value: String(a.value),
783
780
  label: a.label
@@ -791,12 +788,12 @@ function Ct(e, t) {
791
788
  };
792
789
  }
793
790
  async function Rn(e) {
794
- const t = Ve(e);
791
+ const t = Ne(e);
795
792
  for (const n of t)
796
- if (Tt(n), Z(n), await y(160), Ye(e) || (Lt(n), await y(180), Ye(e))) return !0;
793
+ if (Lt(n), X(n), await y(160), Ge(e) || (It(n), await y(180), Ge(e))) return !0;
797
794
  return !1;
798
795
  }
799
- async function On(e) {
796
+ async function Fn(e) {
800
797
  const t = [
801
798
  e,
802
799
  e.querySelector(".el-input__wrapper"),
@@ -805,13 +802,13 @@ async function On(e) {
805
802
  e.querySelector("input")
806
803
  ].filter((n) => n instanceof HTMLElement);
807
804
  for (const n of t)
808
- if (Tt(n), Z(n), await y(180), fe().length || (Lt(n), await y(180), fe().length)) return !0;
805
+ if (Lt(n), X(n), await y(180), pe().length || (It(n), await y(180), pe().length)) return !0;
809
806
  return !1;
810
807
  }
811
- async function Fn(e, t, n = !1) {
808
+ async function On(e, t, n = !1) {
812
809
  for (let r = 0; r < 12; r += 1) {
813
- const o = me(
814
- At(t, n).map((i) => ({
810
+ const o = be(
811
+ Tt(t, n).map((i) => ({
815
812
  source: i,
816
813
  value: qn(i),
817
814
  label: Dn(i)
@@ -836,9 +833,9 @@ async function Pn(e) {
836
833
  const t = jn(e);
837
834
  if (!t.length) return !1;
838
835
  for (let n = 0; n < t.length; n += 1) {
839
- const r = fe();
836
+ const r = pe();
840
837
  if (!r.length) return n > 0;
841
- 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 = me(
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(
842
839
  i.map((a) => {
843
840
  var c;
844
841
  return {
@@ -850,25 +847,25 @@ async function Pn(e) {
850
847
  t[n]
851
848
  );
852
849
  if (!(s != null && s.source)) return !1;
853
- Z(s.source), await y(220);
850
+ X(s.source), await y(220);
854
851
  }
855
- return !fe().length || !0;
852
+ return !pe().length || !0;
856
853
  }
857
854
  function V(e, t) {
858
- const n = Vn(t) ? t : Ct(t), r = n.displayValue || A(t), o = n.fillValue || r;
855
+ const n = Vn(t) ? t : At(t), r = n.displayValue || A(t), o = n.fillValue || r;
859
856
  if (!r && !o) return !1;
860
- const i = Y(e) || e;
857
+ const i = G(e) || e;
861
858
  if (E(i))
862
859
  return $n(i, r, o);
863
860
  if (e instanceof HTMLSelectElement) {
864
861
  let l = Array.from(e.options).find((u) => u.dataset.smartFillFallbackOption === "true");
865
- return l || (l = document.createElement("option"), l.dataset.smartFillFallbackOption = "true", e.appendChild(l)), l.value = o, l.textContent = r || o, l.selected = !0, ge(e, o), _(e), !0;
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;
866
863
  }
867
864
  const s = e.querySelector('input:not([type="hidden"])');
868
865
  if (!(s instanceof HTMLInputElement) || s.disabled) return !1;
869
866
  const a = s.readOnly, c = s.hasAttribute("readonly");
870
867
  try {
871
- return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), ge(s, r), s.dispatchEvent(new InputEvent("input", {
868
+ return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), he(s, r), s.dispatchEvent(new InputEvent("input", {
872
869
  bubbles: !0,
873
870
  composed: !0,
874
871
  data: r,
@@ -908,7 +905,7 @@ function K(e, t) {
908
905
  if (e.disabled) return;
909
906
  const n = e.readOnly, r = e.hasAttribute("readonly");
910
907
  try {
911
- n && (e.readOnly = !1, e.removeAttribute("readonly")), ge(e, t), e.dispatchEvent(new InputEvent("input", {
908
+ n && (e.readOnly = !1, e.removeAttribute("readonly")), he(e, t), e.dispatchEvent(new InputEvent("input", {
912
909
  bubbles: !0,
913
910
  composed: !0,
914
911
  data: t,
@@ -921,7 +918,7 @@ function K(e, t) {
921
918
  function Vn(e) {
922
919
  return typeof e == "object" && e != null && "searchValue" in e && "fillValue" in e && "displayValue" in e;
923
920
  }
924
- function Ve(e) {
921
+ function Ne(e) {
925
922
  return [
926
923
  e,
927
924
  e.querySelector(".van-field__control"),
@@ -941,10 +938,10 @@ function Ve(e) {
941
938
  e.querySelector(".select__wrapper")
942
939
  ].filter((n) => n instanceof HTMLElement).filter((n, r, o) => o.indexOf(n) === r);
943
940
  }
944
- function At(e, t) {
945
- return (e.length ? e : X()).flatMap((o) => o.matches(pe) ? [o] : Array.from(o.querySelectorAll(pe))).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");
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");
946
943
  }
947
- function fe() {
944
+ function pe() {
948
945
  return Array.from(document.querySelectorAll(Cn)).filter(D);
949
946
  }
950
947
  async function Kn(e, t) {
@@ -953,32 +950,32 @@ async function Kn(e, t) {
953
950
  if (r.length) return r;
954
951
  await y(80);
955
952
  }
956
- return X().filter(D);
953
+ return W().filter(D);
957
954
  }
958
955
  function zn(e, t) {
959
- const n = X(), r = n.filter((i) => !t.has(i));
956
+ const n = W(), r = n.filter((i) => !t.has(i));
960
957
  if (r.length)
961
- return r.sort((i, s) => ie(s) - ie(i));
958
+ return r.sort((i, s) => oe(s) - oe(i));
962
959
  const o = new Set(
963
- Ve(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
960
+ Ne(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
964
961
  );
965
962
  if (o.size) {
966
963
  const i = n.filter((s) => o.has(s.id));
967
964
  if (i.length) return i;
968
965
  }
969
- return n.filter((i) => D(i) && (i.querySelector(pe) || i.matches(pe))).sort((i, s) => ie(s) - ie(i)).slice(0, 1);
966
+ return n.filter((i) => D(i) && (i.querySelector(de) || i.matches(de))).sort((i, s) => oe(s) - oe(i)).slice(0, 1);
970
967
  }
971
- function Ye(e) {
972
- return At(X().filter(D), !1).length > 0 ? !0 : Ve(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused"));
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"));
973
970
  }
974
- function Se(e, t) {
975
- const n = w(Ne(e)), r = w(A(t));
971
+ function ve(e, t) {
972
+ const n = w($e(e)), r = w(A(t));
976
973
  return !n || !r ? !1 : n === r || n.includes(r) || r.includes(n);
977
974
  }
978
- function Ee(e, t) {
979
- const n = w(Ne(e));
975
+ function Se(e, t) {
976
+ const n = w($e(e));
980
977
  if (!n) return !1;
981
- const r = we(t);
978
+ const r = me(t);
982
979
  if (!r.length) {
983
980
  const o = w(A(t));
984
981
  return o ? n === o || n.includes(o) || o.includes(n) : !1;
@@ -990,15 +987,15 @@ function Ee(e, t) {
990
987
  }
991
988
  function Bn() {
992
989
  const e = document.querySelector(Tn);
993
- e && D(e) && Z(e);
990
+ e && D(e) && X(e);
994
991
  }
995
- async function he(e) {
992
+ async function fe(e) {
996
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);
997
994
  }
998
- function X() {
995
+ function W() {
999
996
  return Array.from(document.querySelectorAll(Un()));
1000
997
  }
1001
- function ie(e) {
998
+ function oe(e) {
1002
999
  const t = e.getBoundingClientRect(), n = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
1003
1000
  return (Number.isNaN(n) ? 0 : n) * 10 + t.width * t.height;
1004
1001
  }
@@ -1048,10 +1045,10 @@ function jn(e) {
1048
1045
  if (!t) return [];
1049
1046
  if (t.includes("/") || t.includes("、"))
1050
1047
  return t.split(/[//、]/).map((r) => r.trim()).filter(Boolean);
1051
- const n = we(e);
1048
+ const n = me(e);
1052
1049
  return n.length ? [p(n[0])] : [t];
1053
1050
  }
1054
- function ge(e, t) {
1051
+ function he(e, t) {
1055
1052
  var o;
1056
1053
  const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value");
1057
1054
  (o = r == null ? void 0 : r.set) == null || o.call(e, t);
@@ -1059,15 +1056,15 @@ function ge(e, t) {
1059
1056
  function _(e) {
1060
1057
  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 }));
1061
1058
  }
1062
- function Z(e) {
1059
+ function X(e) {
1063
1060
  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();
1064
1061
  }
1065
- function Tt(e) {
1062
+ function Lt(e) {
1066
1063
  e.focus({ preventScroll: !0 });
1067
1064
  const t = e instanceof HTMLInputElement ? e : e.querySelector("input");
1068
1065
  t instanceof HTMLElement && t.focus({ preventScroll: !0 });
1069
1066
  }
1070
- function Lt(e) {
1067
+ function It(e) {
1071
1068
  for (const t of [{ key: "ArrowDown", code: "ArrowDown" }, { key: "Enter", code: "Enter" }, { key: " ", code: "Space" }])
1072
1069
  e.dispatchEvent(new KeyboardEvent("keydown", { ...t, bubbles: !0, composed: !0 })), e.dispatchEvent(new KeyboardEvent("keyup", { ...t, bubbles: !0, composed: !0 }));
1073
1070
  }
@@ -1080,24 +1077,24 @@ function D(e) {
1080
1077
  function y(e) {
1081
1078
  return new Promise((t) => window.setTimeout(t, e));
1082
1079
  }
1083
- const We = /* @__PURE__ */ new Set(["select", "cascader", "date"]), It = {
1080
+ const Ye = /* @__PURE__ */ new Set(["select", "cascader", "date"]), Mt = {
1084
1081
  name: "ui-framework",
1085
- match: (e) => e.matches(ut) || dt(e) || !Gn(e) && B(e),
1082
+ match: (e) => e.matches(ut) || dt(e) || !Gn(e) && Fe(e),
1086
1083
  getValue: (e) => {
1087
1084
  var o, i;
1088
1085
  const t = e.element;
1089
1086
  if (!t) return;
1090
- const n = F(t);
1091
- if ((n == null ? void 0 : n.kind) === "switch") return j(t);
1087
+ const n = O(t);
1088
+ if ((n == null ? void 0 : n.kind) === "switch") return U(t);
1092
1089
  if ((n == null ? void 0 : n.kind) === "radioGroup") return Zn(t);
1093
1090
  if ((n == null ? void 0 : n.kind) === "checkboxGroup") return Jn(t);
1094
- const r = e.type || le(t) || (n == null ? void 0 : n.type);
1095
- return r && We.has(r) ? Ne(t) : n ? ((i = O(t)) == null ? void 0 : i.value) || t.textContent || void 0 : (o = O(t)) == null ? void 0 : o.value;
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;
1096
1093
  },
1097
1094
  setValue: async (e, t) => {
1098
1095
  const n = e.element;
1099
1096
  if (!n) return;
1100
- const r = F(n);
1097
+ const r = O(n);
1101
1098
  if ((r == null ? void 0 : r.kind) === "switch") {
1102
1099
  Yn(n, t);
1103
1100
  return;
@@ -1110,64 +1107,64 @@ const We = /* @__PURE__ */ new Set(["select", "cascader", "date"]), It = {
1110
1107
  Wn(n, t);
1111
1108
  return;
1112
1109
  }
1113
- const o = e.type || le(n) || (r == null ? void 0 : r.type);
1114
- if (o && We.has(o) || B(n, o || void 0)) {
1110
+ const o = e.type || ce(n) || (r == null ? void 0 : r.type);
1111
+ if (o && Ye.has(o) || Fe(n, o || void 0)) {
1115
1112
  await Ln(n, t, o || "select", e);
1116
1113
  return;
1117
1114
  }
1118
- const i = O(n);
1115
+ const i = F(n);
1119
1116
  if (i) {
1120
1117
  Qn(i, t);
1121
1118
  return;
1122
1119
  }
1123
1120
  n.dispatchEvent(new Event("change", { bubbles: !0 }));
1124
1121
  }
1125
- }, Lo = It;
1122
+ }, Mo = Mt;
1126
1123
  function Gn(e) {
1127
1124
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
1128
1125
  }
1129
1126
  function Yn(e, t) {
1130
- j(e) !== er(t) && ye(e);
1127
+ U(e) !== er(t) && ge(e);
1131
1128
  }
1132
1129
  function Wn(e, t) {
1133
1130
  var o;
1134
1131
  const n = new Set(tr(t).map(k)), r = pt(e) || [];
1135
- for (const i of U(e)) {
1136
- const s = J(i.textContent || ""), a = i.getAttribute("value") || ((o = i.querySelector("input")) == null ? void 0 : o.value) || s, c = j(i), l = n.has(k(String(a))) || n.has(k(s));
1137
- c !== l && ye(i);
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);
1138
1135
  }
1139
- if (!U(e).length && r.length)
1136
+ if (!B(e).length && r.length)
1140
1137
  for (const i of r)
1141
- (n.has(k(String(i.value))) || n.has(k(i.label))) && ye(e);
1138
+ (n.has(k(String(i.value))) || n.has(k(i.label))) && ge(e);
1142
1139
  }
1143
1140
  function Xn(e, t) {
1144
- const n = k(String(t ?? "")), r = U(e).find((o) => {
1141
+ const n = k(String(t ?? "")), r = B(e).find((o) => {
1145
1142
  var a;
1146
- const i = J(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1143
+ const i = Z(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1147
1144
  return k(String(s)) === n || k(i) === n;
1148
1145
  });
1149
- r && ye(r);
1146
+ r && ge(r);
1150
1147
  }
1151
1148
  function Zn(e) {
1152
1149
  var n;
1153
- const t = U(e).find((r) => j(r));
1150
+ const t = B(e).find((r) => U(r));
1154
1151
  if (t)
1155
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || J(t.textContent || "");
1152
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1156
1153
  }
1157
1154
  function Jn(e) {
1158
- return U(e).filter((t) => j(t)).map((t) => {
1155
+ return B(e).filter((t) => U(t)).map((t) => {
1159
1156
  var n;
1160
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || J(t.textContent || "");
1157
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1161
1158
  });
1162
1159
  }
1163
- function U(e) {
1164
- const t = F(e);
1160
+ function B(e) {
1161
+ const t = O(e);
1165
1162
  return t != null && t.optionSelector ? Array.from(e.querySelectorAll(t.optionSelector)) : [];
1166
1163
  }
1167
1164
  function Qn(e, t) {
1168
1165
  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 }));
1169
1166
  }
1170
- function ye(e) {
1167
+ function ge(e) {
1171
1168
  e.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window }));
1172
1169
  }
1173
1170
  function er(e) {
@@ -1177,13 +1174,13 @@ function tr(e) {
1177
1174
  return Array.isArray(e) ? e.map(String) : String(e ?? "").split(/[,,;;、]/).map((t) => t.trim()).filter(Boolean);
1178
1175
  }
1179
1176
  function k(e) {
1180
- return J(e).toLowerCase();
1177
+ return Z(e).toLowerCase();
1181
1178
  }
1182
- function J(e) {
1179
+ function Z(e) {
1183
1180
  return e.replace(/\s+/g, " ").trim();
1184
1181
  }
1185
1182
  const nr = "https://uat.kingdeefin.com";
1186
- class Mt extends Error {
1183
+ class Rt extends Error {
1187
1184
  constructor(n) {
1188
1185
  super(n.message);
1189
1186
  /** 结构化错误信息,含 code / stage / retryable */
@@ -1192,17 +1189,17 @@ class Mt extends Error {
1192
1189
  }
1193
1190
  }
1194
1191
  function b(e, t, n, r = {}) {
1195
- return new Mt({ code: e, message: t, stage: n, ...r });
1192
+ return new Rt({ code: e, message: t, stage: n, ...r });
1196
1193
  }
1197
- function Xe(e, t, n = "RECOGNIZE_FAILED") {
1198
- return e instanceof Mt ? e.smartFillError : {
1194
+ function We(e, t, n = "RECOGNIZE_FAILED") {
1195
+ return e instanceof Rt ? e.smartFillError : {
1199
1196
  code: n,
1200
1197
  message: e instanceof Error ? e.message : String(e || "智能录入异常"),
1201
1198
  stage: t,
1202
1199
  retryable: t === "recognize"
1203
1200
  };
1204
1201
  }
1205
- function be(e = "sf") {
1202
+ function ye(e = "sf") {
1206
1203
  return `${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
1207
1204
  }
1208
1205
  class rr {
@@ -1278,7 +1275,7 @@ class rr {
1278
1275
  scanToken: t.scanToken,
1279
1276
  suggestions: i,
1280
1277
  trace: o.trace || {
1281
- traceId: be("trace"),
1278
+ traceId: ye("trace"),
1282
1279
  usedOcr: !!t.usedOcr,
1283
1280
  usedAi: !0,
1284
1281
  durationMs: Math.round(performance.now() - n)
@@ -1305,7 +1302,7 @@ class rr {
1305
1302
  /** 通用 fetch 封装:超时控制、trace 头、HTTP 错误映射为 SmartFillException */
1306
1303
  async request(t, n) {
1307
1304
  const r = new AbortController(), o = window.setTimeout(() => r.abort(), this.config.requestTimeoutMs ?? 3e4), i = new Headers(n.headers);
1308
- n.body && !(n.body instanceof FormData) && !i.has("Content-Type") && i.set("Content-Type", "application/json"), i.set("x-trace-id", be("trace")), this.seToken && i.set("seToken", `${this.seToken}`);
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}`);
1309
1306
  try {
1310
1307
  const s = await fetch(`${this.baseURL}${t}`, {
1311
1308
  ...n,
@@ -1353,7 +1350,7 @@ function ar(e) {
1353
1350
  function cr(e) {
1354
1351
  return e === 401 ? "TOKEN_EXPIRED" : e === 403 ? "API_KEY_FORBIDDEN" : e === 404 ? "FORM_CONFIG_NOT_FOUND" : "RECOGNIZE_FAILED";
1355
1352
  }
1356
- class Rt {
1353
+ class Ft {
1357
1354
  constructor() {
1358
1355
  d(this, "handlers", /* @__PURE__ */ new Map());
1359
1356
  }
@@ -1426,7 +1423,41 @@ function z(e) {
1426
1423
  function q(e) {
1427
1424
  return String(e ?? "").replace(/\s+/g, " ").trim().toLowerCase();
1428
1425
  }
1429
- const xe = /* @__PURE__ */ new WeakMap(), dr = [
1426
+ const Xe = "smart-fill-highlight-style", dr = `
1427
+ [data-smart-fill-highlighted="true"] {
1428
+ background: #eaf3ff !important;
1429
+ box-shadow: 0 0 0 1px #91caff inset !important;
1430
+ transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
1431
+ }
1432
+
1433
+ [data-smart-fill-highlighted="true"] input:not([type="hidden"]),
1434
+ [data-smart-fill-highlighted="true"] textarea {
1435
+ background: #eaf3ff !important;
1436
+ }
1437
+
1438
+ [data-smart-fill-highlighted="true"].el-select,
1439
+ [data-smart-fill-highlighted="true"].el-select-v2,
1440
+ [data-smart-fill-highlighted="true"] .el-select__wrapper,
1441
+ [data-smart-fill-highlighted="true"] .el-select-v2__wrapper,
1442
+ [data-smart-fill-highlighted="true"] .el-input__wrapper,
1443
+ [data-smart-fill-highlighted="true"] .el-date-editor,
1444
+ [data-smart-fill-highlighted="true"] .ant-select-selector,
1445
+ [data-smart-fill-highlighted="true"] .ant-picker,
1446
+ [data-smart-fill-highlighted="true"] .n-base-selection,
1447
+ [data-smart-fill-highlighted="true"] .arco-select-view,
1448
+ [data-smart-fill-highlighted="true"] .van-field__body,
1449
+ [data-smart-fill-highlighted="true"] .van-field__control {
1450
+ background: #eaf3ff !important;
1451
+ box-shadow: 0 0 0 1px #91caff inset !important;
1452
+ }
1453
+ `.trim();
1454
+ function pr() {
1455
+ if (typeof document > "u" || document.getElementById(Xe))
1456
+ return;
1457
+ const e = document.createElement("style");
1458
+ e.id = Xe, e.textContent = dr, document.head.appendChild(e);
1459
+ }
1460
+ const Ee = /* @__PURE__ */ new WeakMap(), fr = [
1430
1461
  'input:not([type="hidden"])',
1431
1462
  "textarea",
1432
1463
  "select",
@@ -1461,23 +1492,23 @@ class Ze {
1461
1492
  for (const o of t.values) {
1462
1493
  const i = this.fields.find((l) => l.fieldId === o.fieldId);
1463
1494
  if (!i) {
1464
- r.push(ae(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1495
+ r.push(se(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1465
1496
  continue;
1466
1497
  }
1467
1498
  if (i.scanToken !== t.scanToken) {
1468
- r.push(ae(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1499
+ r.push(se(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1469
1500
  continue;
1470
1501
  }
1471
- const s = br(this.schemas, o.fieldId), a = s != null && s.transform ? s.transform(o.value) : o.value, c = await this.getValue(i, s);
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);
1472
1503
  try {
1473
1504
  const l = s != null && s.validate ? await s.validate(a) : !0;
1474
1505
  if (l !== !0) {
1475
- r.push(ae(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1506
+ r.push(se(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1476
1507
  continue;
1477
1508
  }
1478
1509
  await this.setValue(i, a, s), n.push({ fieldId: i.fieldId, label: i.label, value: a, previousValue: c });
1479
1510
  } catch (l) {
1480
- r.push(ae(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1511
+ r.push(se(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1481
1512
  }
1482
1513
  }
1483
1514
  return {
@@ -1491,7 +1522,7 @@ class Ze {
1491
1522
  if (n != null && n.getValue) return n.getValue();
1492
1523
  const r = this.matchAdapter(t, n);
1493
1524
  if (r != null && r.getValue) return r.getValue(t);
1494
- const o = se(t, n);
1525
+ const o = ie(t, n);
1495
1526
  if (o)
1496
1527
  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;
1497
1528
  }
@@ -1502,38 +1533,38 @@ class Ze {
1502
1533
  async setValue(t, n, r) {
1503
1534
  if (r != null && r.setValue) {
1504
1535
  await r.setValue(n);
1505
- const a = se(t, r);
1506
- a && ke(a, t);
1536
+ const s = ie(t, r);
1537
+ s && xe(s, t);
1507
1538
  return;
1508
1539
  }
1509
- const o = se(t, r);
1540
+ const o = ie(t, r);
1510
1541
  if (!o) throw new Error("页面中未找到对应字段");
1511
1542
  if (t.fingerprint && t.fingerprint !== z({ ...t, tagName: o.tagName.toLowerCase() }))
1512
1543
  throw new Error("字段结构已变化,请重新扫描");
1513
- const i = this.matchAdapter(t, r), s = B(o, t.type);
1544
+ const i = this.matchAdapter(t, r);
1514
1545
  if (t.disabled || o.hasAttribute("disabled") || o.getAttribute("aria-disabled") === "true")
1515
1546
  throw new Error("字段不可编辑");
1516
- if (!s && !i && (t.readonly || o.hasAttribute("readonly")))
1547
+ if (t.readonly || o.hasAttribute("readonly"))
1517
1548
  throw new Error("字段不可编辑");
1518
1549
  if (i) {
1519
- await i.setValue(t, n), ke(o, t);
1550
+ await i.setValue(t, n), xe(o, t);
1520
1551
  return;
1521
1552
  }
1522
- fr(o, n), ke(o, t);
1553
+ gr(o, n), xe(o, t);
1523
1554
  }
1524
1555
  /** 匹配第一个适用的组件库适配器 */
1525
1556
  matchAdapter(t, n) {
1526
- const r = se(t, n);
1557
+ const r = ie(t, n);
1527
1558
  return r ? this.adapters.find((o) => o.match(r, t)) : void 0;
1528
1559
  }
1529
1560
  }
1530
- function se(e, t) {
1561
+ function ie(e, t) {
1531
1562
  var r;
1532
1563
  if ((r = e.element) != null && r.isConnected) return e.element;
1533
- const n = pr(t == null ? void 0 : t.element);
1564
+ const n = hr(t == null ? void 0 : t.element);
1534
1565
  return n || document.querySelector(`[data-smart-fill-id="${qe(e.fieldId)}"]`);
1535
1566
  }
1536
- function pr(e) {
1567
+ function hr(e) {
1537
1568
  if (e instanceof HTMLElement)
1538
1569
  return e.isConnected ? e : null;
1539
1570
  if (typeof e == "string")
@@ -1545,7 +1576,7 @@ function pr(e) {
1545
1576
  }
1546
1577
  return null;
1547
1578
  }
1548
- function fr(e, t) {
1579
+ function gr(e, t) {
1549
1580
  if (e instanceof HTMLInputElement && e.type === "checkbox")
1550
1581
  e.checked = !!t;
1551
1582
  else if (e instanceof HTMLInputElement && e.type === "radio") {
@@ -1554,30 +1585,34 @@ function fr(e, t) {
1554
1585
  } else e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value = String(t ?? "") : e.isContentEditable && (e.textContent = String(t ?? ""));
1555
1586
  e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
1556
1587
  }
1557
- function ke(e, t) {
1558
- for (const n of hr(e, t))
1559
- gr(n);
1588
+ function xe(e, t) {
1589
+ pr();
1590
+ const n = yr(e, t), r = () => {
1591
+ for (const o of n)
1592
+ o.isConnected && br(o);
1593
+ };
1594
+ typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => requestAnimationFrame(r)) : r();
1560
1595
  }
1561
- function hr(e, t) {
1596
+ function yr(e, t) {
1562
1597
  if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)
1563
1598
  return [e];
1564
- const n = B(e, t == null ? void 0 : t.type) && Y(e) || e, r = yr(
1565
- Array.from(n.querySelectorAll(dr)).filter(Je)
1599
+ const n = Fe(e, t == null ? void 0 : t.type) && G(e) || e, r = mr(
1600
+ Array.from(n.querySelectorAll(fr)).filter(Je)
1566
1601
  );
1567
1602
  if (r.length)
1568
1603
  return r;
1569
- const o = O(n);
1604
+ const o = F(n);
1570
1605
  return o && Je(o) ? [o] : [n];
1571
1606
  }
1572
- function gr(e) {
1607
+ function br(e) {
1573
1608
  var r;
1574
- e.setAttribute("data-smart-fill-highlighted", "true"), (r = xe.get(e)) == null || r.abort();
1609
+ e.setAttribute("data-smart-fill-highlighted", "true"), (r = Ee.get(e)) == null || r.abort();
1575
1610
  const t = new AbortController(), n = (o) => {
1576
- o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), xe.delete(e));
1611
+ o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), Ee.delete(e));
1577
1612
  };
1578
- xe.set(e, t), e.addEventListener("focus", n, { signal: t.signal }), e.addEventListener("pointerdown", 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 });
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 });
1579
1614
  }
1580
- function yr(e) {
1615
+ function mr(e) {
1581
1616
  return e.filter((t) => !e.some((n) => n !== t && n.contains(t)));
1582
1617
  }
1583
1618
  function Je(e) {
@@ -1587,20 +1622,20 @@ function Je(e) {
1587
1622
  const n = e.getBoundingClientRect();
1588
1623
  return n.width > 0 && n.height > 0;
1589
1624
  }
1590
- function ae(e, t, n, r, o) {
1625
+ function se(e, t, n, r, o) {
1591
1626
  return { fieldId: e, label: t, attemptedValue: n, reason: r, reasonCode: o };
1592
1627
  }
1593
1628
  function qe(e) {
1594
1629
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1595
1630
  }
1596
- function br(e, t) {
1631
+ function wr(e, t) {
1597
1632
  const n = e.find((o) => o.fieldId === t);
1598
1633
  if (n) return n;
1599
1634
  const r = t.includes(":") ? t.slice(t.lastIndexOf(":") + 1) : "";
1600
1635
  if (r)
1601
1636
  return e.find((o) => o.rowKey != null && String(o.rowKey) === r && `${o.fieldId}:${o.rowKey}` === t);
1602
1637
  }
1603
- const mr = [
1638
+ const vr = [
1604
1639
  { key: "mobile", pattern: new RegExp("(?<!\\d)1[3-9]\\d{9}(?!\\d)", "g"), confidence: 0.98, reason: "手机号正则命中" },
1605
1640
  { key: "idCard", pattern: new RegExp("(?<!\\d)\\d{17}[\\dXx](?!\\d)", "g"), confidence: 0.96, reason: "身份证号正则命中" },
1606
1641
  { key: "email", pattern: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, confidence: 0.95, reason: "邮箱正则命中" },
@@ -1667,20 +1702,20 @@ const mr = [
1667
1702
  amount: "amount",
1668
1703
  date: "date"
1669
1704
  };
1670
- class wr {
1705
+ class Sr {
1671
1706
  /**
1672
1707
  * 从文本中提取事实并匹配到 scan 字段。
1673
1708
  * 按 confidence 降序分配,每个 fieldId 仅匹配一次(usedFieldIds 去重)。
1674
1709
  */
1675
1710
  recognize(t, n, r) {
1676
- const o = Tr([...vr(t), ...Sr(t)]), i = /* @__PURE__ */ new Set(), s = [];
1711
+ const o = Ir([...Er(t), ...xr(t)]), i = /* @__PURE__ */ new Set(), s = [];
1677
1712
  for (const a of o.sort((c, l) => l.confidence - c.confidence)) {
1678
- const c = xr(a, n, i);
1713
+ const c = _r(a, n, i);
1679
1714
  c && (s.push({
1680
1715
  fieldId: c.fieldId,
1681
1716
  scanToken: r,
1682
1717
  label: c.label,
1683
- value: _r(a.value, c),
1718
+ value: Ar(a.value, c),
1684
1719
  displayValue: a.value,
1685
1720
  confidence: a.confidence,
1686
1721
  source: "local_rule",
@@ -1690,11 +1725,11 @@ class wr {
1690
1725
  return s;
1691
1726
  }
1692
1727
  }
1693
- function vr(e) {
1728
+ function Er(e) {
1694
1729
  const t = [];
1695
- for (const n of mr)
1730
+ for (const n of vr)
1696
1731
  for (const r of e.matchAll(n.pattern)) {
1697
- const o = Ft(r[1] || r[0]);
1732
+ const o = qt(r[1] || r[0]);
1698
1733
  t.push({
1699
1734
  key: n.key,
1700
1735
  value: o,
@@ -1705,21 +1740,21 @@ function vr(e) {
1705
1740
  }
1706
1741
  return t;
1707
1742
  }
1708
- function Sr(e) {
1743
+ function xr(e) {
1709
1744
  const t = [], n = e.split(/\r?\n|[;,;]/).map((r) => r.trim()).filter(Boolean);
1710
1745
  for (const r of n) {
1711
1746
  const o = r.match(/^[“"'`]?([^::=]{2,30})[”"'`]?[::=]\s*(.+)$/);
1712
1747
  if (!o) continue;
1713
- const i = Ar(o[1]), s = Ft(o[2]);
1748
+ const i = Lr(o[1]), s = qt(o[2]);
1714
1749
  if (!(!i || !s))
1715
- for (const a of Er(i, s))
1750
+ for (const a of kr(i, s))
1716
1751
  t.push(a);
1717
1752
  }
1718
1753
  return t;
1719
1754
  }
1720
- function Er(e, t) {
1721
- const n = q(e), r = Cr(t), o = [];
1722
- 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"), Lr(o).map((i, s) => ({
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) => ({
1723
1758
  key: i,
1724
1759
  value: t,
1725
1760
  confidence: Math.max(0.84, 0.96 - s * 0.04),
@@ -1727,39 +1762,39 @@ function Er(e, t) {
1727
1762
  baseKey: Ot[i]
1728
1763
  }));
1729
1764
  }
1730
- function xr(e, t, n) {
1765
+ function _r(e, t, n) {
1731
1766
  let r = null;
1732
1767
  for (const o of t) {
1733
1768
  if (n.has(o.fieldId)) continue;
1734
- const i = kr(e, o);
1769
+ const i = Cr(e, o);
1735
1770
  i > ((r == null ? void 0 : r.score) ?? 0) && (r = { field: o, score: i });
1736
1771
  }
1737
1772
  return r && r.score >= 0.45 ? r.field : null;
1738
1773
  }
1739
- function kr(e, t) {
1774
+ function Cr(e, t) {
1740
1775
  const n = q([t.fieldId, t.label, t.placeholder, t.name, t.id, t.section].join(" ")), r = I[e.key] || [e.key];
1741
1776
  let o = 0;
1742
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);
1743
1778
  }
1744
- function _r(e, t) {
1779
+ function Ar(e, t) {
1745
1780
  var n;
1746
1781
  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;
1747
1782
  }
1748
- function Cr(e) {
1783
+ function Tr(e) {
1749
1784
  const t = e.replace(/\s+/g, "");
1750
1785
  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";
1751
1786
  }
1752
- function Ar(e) {
1787
+ function Lr(e) {
1753
1788
  return e.replace(/[“”"'`]/g, "").replace(/\s+/g, " ").trim();
1754
1789
  }
1755
- function Ft(e) {
1790
+ function qt(e) {
1756
1791
  return e.replace(/[,。;;]+$/g, "").replace(/^[“”"'`\s]+|[“”"'`\s]+$/g, "").trim();
1757
1792
  }
1758
1793
  function x(e, t) {
1759
1794
  const n = q(e);
1760
1795
  return t.some((r) => n.includes(q(r)));
1761
1796
  }
1762
- function Tr(e) {
1797
+ function Ir(e) {
1763
1798
  const t = /* @__PURE__ */ new Map();
1764
1799
  for (const n of e) {
1765
1800
  const r = `${n.key}::${n.value}`, o = t.get(r);
@@ -1767,7 +1802,7 @@ function Tr(e) {
1767
1802
  }
1768
1803
  return [...t.values()];
1769
1804
  }
1770
- function Lr(e) {
1805
+ function Mr(e) {
1771
1806
  return [...new Set(e)];
1772
1807
  }
1773
1808
  const Qe = [
@@ -1775,8 +1810,8 @@ const Qe = [
1775
1810
  "textarea",
1776
1811
  "select",
1777
1812
  "[contenteditable]:not([contenteditable='false'])"
1778
- ].join(", "), Ir = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
1779
- class Mr {
1813
+ ].join(", "), Rr = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
1814
+ class Fr {
1780
1815
  constructor(t = document) {
1781
1816
  this.root = t;
1782
1817
  }
@@ -1787,7 +1822,7 @@ class Mr {
1787
1822
  */
1788
1823
  scan(t = {}) {
1789
1824
  var l;
1790
- const n = be("scan");
1825
+ const n = ye("scan");
1791
1826
  if ((l = t.registered) != null && l.length)
1792
1827
  return {
1793
1828
  scanToken: n,
@@ -1807,14 +1842,14 @@ class Mr {
1807
1842
  return n;
1808
1843
  const r = [];
1809
1844
  for (const s of n.fields) {
1810
- const a = !!((i = s.options) != null && i.length) && !re(s);
1845
+ const a = !!((i = s.options) != null && i.length) && !ne(s);
1811
1846
  if (!s.element || a || s.type !== "select" && s.type !== "cascader") {
1812
1847
  r.push(s);
1813
1848
  continue;
1814
1849
  }
1815
- const c = await cn(s.element), l = c != null && c.length && !re({ ...s, options: c }) ? c : void 0;
1850
+ const c = await cn(s.element), l = c != null && c.length && !ne({ ...s, options: c }) ? c : void 0;
1816
1851
  if (!(l != null && l.length)) {
1817
- r.push({ ...s, options: re(s) ? void 0 : s.options });
1852
+ r.push({ ...s, options: ne(s) ? void 0 : s.options });
1818
1853
  continue;
1819
1854
  }
1820
1855
  const u = { ...s, options: l };
@@ -1827,7 +1862,7 @@ class Mr {
1827
1862
  }
1828
1863
  /** FieldSchema → FieldDescriptor,解析 element 并生成 fingerprint */
1829
1864
  fromSchema(t, n) {
1830
- const r = Vr(t.element, this.root), o = r ? Oe(r) || Le(r) || r : null, i = {
1865
+ const r = zr(t.element, this.root), o = r ? Re(r) || Te(r) || r : null, i = {
1831
1866
  fieldId: t.rowKey == null ? t.fieldId : `${t.fieldId}:${t.rowKey}`,
1832
1867
  label: t.label,
1833
1868
  type: t.type,
@@ -1848,25 +1883,25 @@ class Mr {
1848
1883
  }
1849
1884
  /** DOM 元素 → FieldDescriptor,自动推断 label/type 并写入 data-smart-fill-id */
1850
1885
  fromElement(t, n, r, o = this.root) {
1851
- const i = Rr(t, n), s = qr(t, o), a = {
1886
+ const i = Or(t, n), s = Pr(t, o), a = {
1852
1887
  fieldId: i,
1853
1888
  fingerprint: "",
1854
1889
  scanToken: r,
1855
- type: Or(t),
1890
+ type: qr(t),
1856
1891
  localRuleMode: "inherit",
1857
- label: qt(t),
1858
- placeholder: Pt(t),
1892
+ label: Dt(t),
1893
+ placeholder: Ht(t),
1859
1894
  name: S(ft(t)) || void 0,
1860
1895
  id: S(t.id) || void 0,
1861
- section: Fr(t),
1896
+ section: Dr(t),
1862
1897
  options: s,
1863
- required: Hr(t),
1864
- readonly: Pr(t) && !sn(t),
1865
- disabled: _e(t),
1898
+ required: Nr(t),
1899
+ readonly: $r(t),
1900
+ disabled: ke(t),
1866
1901
  source: "form_scan",
1867
1902
  element: t
1868
1903
  };
1869
- return re(a) && (a.options = void 0), a.fingerprint = z({
1904
+ return ne(a) && (a.options = void 0), a.fingerprint = z({
1870
1905
  ...a,
1871
1906
  tagName: t.tagName.toLowerCase()
1872
1907
  }), a;
@@ -1874,7 +1909,7 @@ class Mr {
1874
1909
  /** 解析扫描根节点,scanContainer 为 CSS 选择器 */
1875
1910
  resolveRoot(t) {
1876
1911
  if (t) {
1877
- const n = Ht(this.root, t);
1912
+ const n = $t(this.root, t);
1878
1913
  if (n)
1879
1914
  return n;
1880
1915
  }
@@ -1885,35 +1920,35 @@ class Mr {
1885
1920
  const n = /* @__PURE__ */ new Set(), r = [Qe, ht, ut, ".van-field"].join(", ");
1886
1921
  for (const s of t.querySelectorAll(r)) {
1887
1922
  if (!(s instanceof HTMLElement)) continue;
1888
- const a = Oe(s) || Le(s);
1889
- !a || !De(a) || _e(a) || n.add(a);
1923
+ const a = Re(s) || Te(s);
1924
+ !a || !De(a) || ke(a) || n.add(a);
1890
1925
  }
1891
- const o = [...n], i = Array.from(t.querySelectorAll(Qe)).filter((s) => !(s instanceof HTMLElement) || !De(s) || $r(s) || s instanceof HTMLInputElement && Ir.has((s.type || "").toLowerCase()) ? !1 : !_e(s) && !s.hasAttribute("readonly"));
1892
- return Nr([...i, ...o]);
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]);
1893
1928
  }
1894
1929
  /**
1895
1930
  * 检测最应优先扫描的容器。
1896
1931
  * 优先 activeElement 所在弹窗,否则取包含最多字段的弹窗容器。
1897
1932
  */
1898
1933
  detectTopLayerContainer(t) {
1899
- const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(Be);
1934
+ const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(ze);
1900
1935
  if (r instanceof HTMLElement && t.some((i) => r.contains(i)))
1901
1936
  return r;
1902
- const o = t.map((i) => i.closest(Be)).filter((i) => i instanceof HTMLElement);
1937
+ const o = t.map((i) => i.closest(ze)).filter((i) => i instanceof HTMLElement);
1903
1938
  return o.length ? o.sort((i, s) => t.filter((a) => s.contains(a)).length - t.filter((a) => i.contains(a)).length)[0] : document.body;
1904
1939
  }
1905
1940
  }
1906
- function Rr(e, t) {
1941
+ function Or(e, t) {
1907
1942
  const n = e.getAttribute("data-smart-fill-id");
1908
1943
  if (n)
1909
1944
  return n;
1910
- const o = S(e.getAttribute("name")) || S(e.getAttribute("data-smart-fill-key")) || S(ft(e)) || S(e.id) || S(qt(e)) || `smart-fill-${Date.now()}-${t}`;
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}`;
1911
1946
  return e.setAttribute("data-smart-fill-id", o), o;
1912
1947
  }
1913
- function Or(e) {
1914
- const t = $e(e);
1948
+ function qr(e) {
1949
+ const t = bt(e);
1915
1950
  if (t) return t;
1916
- const n = le(e);
1951
+ const n = ce(e);
1917
1952
  if (n) return n;
1918
1953
  if (e instanceof HTMLTextAreaElement) return "textarea";
1919
1954
  if (e instanceof HTMLSelectElement) return "select";
@@ -1926,23 +1961,23 @@ function Or(e) {
1926
1961
  }
1927
1962
  return "text";
1928
1963
  }
1929
- function qt(e) {
1964
+ function Dt(e) {
1930
1965
  const t = e.getAttribute("aria-label");
1931
1966
  if (t) return t.trim();
1932
1967
  if (e.id) {
1933
- const i = document.querySelector(`label[for="${Ke(e.id)}"]`);
1968
+ const i = document.querySelector(`label[for="${Ve(e.id)}"]`);
1934
1969
  if (i != null && i.textContent) return p(i.textContent);
1935
1970
  }
1936
- const n = e.closest(Zt), r = n == null ? void 0 : n.querySelector(Jt);
1971
+ const n = e.closest(Jt), r = n == null ? void 0 : n.querySelector(Qt);
1937
1972
  if (r != null && r.textContent) return p(r.textContent);
1938
1973
  const o = e.closest("label");
1939
1974
  if (o) {
1940
- const i = Dt(o, e);
1975
+ const i = Pt(o, e);
1941
1976
  if (i) return i;
1942
1977
  }
1943
- return Pt(e) || e.getAttribute("name") || e.id || "未命名字段";
1978
+ return Ht(e) || e.getAttribute("name") || e.id || "未命名字段";
1944
1979
  }
1945
- function Dt(e, t) {
1980
+ function Pt(e, t) {
1946
1981
  const n = e.cloneNode(!0);
1947
1982
  for (const o of n.querySelectorAll('input, textarea, select, button, [role="combobox"], [role="listbox"]'))
1948
1983
  o.remove();
@@ -1950,16 +1985,16 @@ function Dt(e, t) {
1950
1985
  if (r)
1951
1986
  return t instanceof HTMLInputElement && t.value && r.includes(t.value) ? p(r.replace(t.value, "")) || void 0 : r;
1952
1987
  }
1953
- function Pt(e) {
1988
+ function Ht(e) {
1954
1989
  var t;
1955
1990
  return e.getAttribute("placeholder") || e.getAttribute("aria-placeholder") || ((t = e.querySelector("[placeholder]")) == null ? void 0 : t.getAttribute("placeholder")) || void 0;
1956
1991
  }
1957
- function Fr(e) {
1992
+ function Dr(e) {
1958
1993
  const t = e.closest("fieldset, section, .panel, .card, .form-section"), n = t == null ? void 0 : t.querySelector("legend, h1, h2, h3, .title, .section-title");
1959
1994
  return n != null && n.textContent ? p(n.textContent) : void 0;
1960
1995
  }
1961
- function qr(e, t = document) {
1962
- const n = bt(e);
1996
+ function Pr(e, t = document) {
1997
+ const n = mt(e);
1963
1998
  if (n != null && n.length) return n;
1964
1999
  const r = pt(e);
1965
2000
  if (r != null && r.length) return r;
@@ -1969,19 +2004,19 @@ function qr(e, t = document) {
1969
2004
  value: o.value
1970
2005
  }));
1971
2006
  if (e instanceof HTMLInputElement && (e.type === "radio" || e.type === "checkbox") && e.name)
1972
- return Array.from(t.querySelectorAll(`input[name="${Ke(e.name)}"]`)).filter((o) => o.type === e.type && De(o)).map((o) => ({
1973
- label: Dr(o),
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),
1974
2009
  value: o.value || !0
1975
2010
  }));
1976
2011
  }
1977
- function Dr(e) {
2012
+ function Hr(e) {
1978
2013
  if (e.id) {
1979
- const n = document.querySelector(`label[for="${Ke(e.id)}"]`);
2014
+ const n = document.querySelector(`label[for="${Ve(e.id)}"]`);
1980
2015
  if (n != null && n.textContent) return p(n.textContent);
1981
2016
  }
1982
2017
  const t = e.closest("label");
1983
2018
  if (t) {
1984
- const n = Dt(t, e);
2019
+ const n = Pt(t, e);
1985
2020
  if (n) return n;
1986
2021
  }
1987
2022
  return p(e.getAttribute("aria-label") || e.value || "");
@@ -1990,28 +2025,28 @@ function De(e) {
1990
2025
  const t = window.getComputedStyle(e);
1991
2026
  return t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0 ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1992
2027
  }
1993
- function _e(e) {
1994
- 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" || Xt.some((t) => e.classList.contains(t));
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));
1995
2030
  }
1996
- function Pr(e) {
2031
+ function $r(e) {
1997
2032
  return e.hasAttribute("readonly") || !!e.querySelector("[readonly]");
1998
2033
  }
1999
- function Hr(e) {
2034
+ function Nr(e) {
2000
2035
  return e.hasAttribute("required") || e.getAttribute("aria-required") === "true" || !!e.querySelector('[required], [aria-required="true"]');
2001
2036
  }
2002
- function $r(e) {
2003
- return Oe(e) != null || Le(e) != null;
2037
+ function Vr(e) {
2038
+ return Re(e) != null || Te(e) != null;
2004
2039
  }
2005
- function Nr(e) {
2040
+ function Kr(e) {
2006
2041
  const t = [];
2007
2042
  for (const n of e)
2008
2043
  t.some((r) => r === n || r.contains(n) || n.contains(r)) || t.push(n);
2009
2044
  return t;
2010
2045
  }
2011
- function Vr(e, t) {
2012
- return e instanceof HTMLElement ? e : typeof e == "string" ? Ht(t, e) : null;
2046
+ function zr(e, t) {
2047
+ return e instanceof HTMLElement ? e : typeof e == "string" ? $t(t, e) : null;
2013
2048
  }
2014
- function Ht(e, t) {
2049
+ function $t(e, t) {
2015
2050
  try {
2016
2051
  const n = e.querySelector(t);
2017
2052
  return n instanceof HTMLElement ? n : null;
@@ -2019,11 +2054,11 @@ function Ht(e, t) {
2019
2054
  return null;
2020
2055
  }
2021
2056
  }
2022
- function Ke(e) {
2057
+ function Ve(e) {
2023
2058
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
2024
2059
  }
2025
- const Ce = 5, Kr = 10 * 1024 * 1024, zr = 50 * 1024 * 1024;
2026
- class Br {
2060
+ const _e = 5, Br = 10 * 1024 * 1024, Ur = 50 * 1024 * 1024;
2061
+ class jr {
2027
2062
  constructor(t) {
2028
2063
  /** 面板宿主元素,挂载到 container 下 */
2029
2064
  d(this, "host", null);
@@ -2049,7 +2084,7 @@ class Br {
2049
2084
  if (!this.dragState || !this.host || t.pointerId !== this.dragState.pointerId) return;
2050
2085
  const n = t.clientX - this.dragState.startX, r = t.clientY - this.dragState.startY;
2051
2086
  (Math.abs(n) > 3 || Math.abs(r) > 3) && (this.dragState.moved = !0);
2052
- const o = this.host.getBoundingClientRect(), i = Math.max(8, window.innerWidth - o.width - 8), s = Math.max(8, window.innerHeight - o.height - 8), a = ce(this.dragState.startLeft + n, 8, i), c = ce(this.dragState.startTop + r, 8, s);
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);
2053
2088
  this.host.style.left = `${a}px`, this.host.style.top = `${c}px`;
2054
2089
  });
2055
2090
  d(this, "handleDragEnd", (t) => {
@@ -2059,7 +2094,7 @@ class Br {
2059
2094
  });
2060
2095
  /** 面板聚焦或鼠标悬浮在图片区时接管全局粘贴图片 */
2061
2096
  d(this, "handleDocumentPaste", (t) => {
2062
- const n = jr(t);
2097
+ const n = Yr(t);
2063
2098
  if (!n.length || !this.isOpen || !this.host)
2064
2099
  return;
2065
2100
  const r = document.activeElement, o = this.root instanceof ShadowRoot ? this.root.activeElement : null;
@@ -2112,7 +2147,7 @@ class Br {
2112
2147
  }
2113
2148
  render(t) {
2114
2149
  this.root && (this.root.innerHTML = `
2115
- <style>${Gr}</style>
2150
+ <style>${Wr}</style>
2116
2151
  ${this.options.mode === "floating" ? `<button class="sf-float" type="button" data-role="open">${this.t("entry", "智能录入")}</button>` : ""}
2117
2152
  <section class="sf-panel ${t ? "is-open" : ""} ${this.options.mode === "inline" ? "is-inline" : "is-floating"}" aria-label="智能录入面板">
2118
2153
  <header class="sf-header" data-role="close" >
@@ -2129,7 +2164,7 @@ class Br {
2129
2164
  </label>
2130
2165
  <div class="sf-entry-grid">
2131
2166
  <div class="sf-textarea-wrap">
2132
- <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${Ur(this.inputText)}</textarea>
2167
+ <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${Gr(this.inputText)}</textarea>
2133
2168
  <div class="sf-textarea-actions">
2134
2169
  <button class="sf-btn sf-btn-secondary" type="button" data-role="clear">${this.t("clear", "清空")}</button>
2135
2170
  <button class="sf-btn sf-btn-primary" type="button" data-role="recognize">${this.t("recognize", "智能识别")}</button>
@@ -2146,7 +2181,7 @@ class Br {
2146
2181
  <circle cx="10" cy="10.5" r="1" fill="currentColor"/>
2147
2182
  </svg>
2148
2183
  </span>
2149
- <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${Ce} 张)`)}</span>
2184
+ <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${_e} 张)`)}</span>
2150
2185
  </span>
2151
2186
  <span class="sf-upload-btn" data-role="file-label">图片识别</span>
2152
2187
  </label>
@@ -2220,15 +2255,15 @@ class Br {
2220
2255
  this.resetSelectedFiles(), this.setError(this.t("invalidImageError", "请选择图片文件。"));
2221
2256
  return;
2222
2257
  }
2223
- if (n.length > Ce) {
2224
- this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${Ce} 张图片。`));
2258
+ if (n.length > _e) {
2259
+ this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${_e} 张图片。`));
2225
2260
  return;
2226
2261
  }
2227
- if (n.find((i) => i.size > Kr)) {
2262
+ if (n.find((i) => i.size > Br)) {
2228
2263
  this.resetSelectedFiles(), this.setError(this.t("maxSingleFileSizeError", "单张图片不能超过 10MB。"));
2229
2264
  return;
2230
2265
  }
2231
- if (n.reduce((i, s) => i + s.size, 0) > zr) {
2266
+ if (n.reduce((i, s) => i + s.size, 0) > Ur) {
2232
2267
  this.resetSelectedFiles(), this.setError(this.t("maxTotalFileSizeError", "上传图片总大小不能超过 50MB。"));
2233
2268
  return;
2234
2269
  }
@@ -2254,7 +2289,7 @@ class Br {
2254
2289
  keepHostInViewport() {
2255
2290
  this.options.mode !== "floating" || !this.host || !this.host.style.left || !this.host.style.top || window.requestAnimationFrame(() => {
2256
2291
  if (!this.host) return;
2257
- const t = this.host.getBoundingClientRect(), n = ce(t.left, 8, Math.max(8, window.innerWidth - t.width - 8)), r = ce(t.top, 8, Math.max(8, window.innerHeight - t.height - 8));
2292
+ 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));
2258
2293
  this.host.style.left = `${n}px`, this.host.style.top = `${r}px`;
2259
2294
  });
2260
2295
  }
@@ -2267,7 +2302,7 @@ class Br {
2267
2302
  return ((r = this.options.messages) == null ? void 0 : r[t]) || n;
2268
2303
  }
2269
2304
  }
2270
- function Ur(e) {
2305
+ function Gr(e) {
2271
2306
  return e.replace(/[&<>"']/g, (t) => ({
2272
2307
  "&": "&amp;",
2273
2308
  "<": "&lt;",
@@ -2276,14 +2311,14 @@ function Ur(e) {
2276
2311
  "'": "&#39;"
2277
2312
  })[t] || t);
2278
2313
  }
2279
- function ce(e, t, n) {
2314
+ function ae(e, t, n) {
2280
2315
  return Math.min(Math.max(e, t), n);
2281
2316
  }
2282
- function jr(e) {
2317
+ function Yr(e) {
2283
2318
  var n;
2284
2319
  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);
2285
2320
  }
2286
- const Gr = `
2321
+ const Wr = `
2287
2322
  :host, .sf-panel { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
2288
2323
  :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; }
2289
2324
  .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; }
@@ -2353,23 +2388,23 @@ const Gr = `
2353
2388
  width: min(450px, calc(100vw - 32px))
2354
2389
  }
2355
2390
  }
2356
- `, Yr = 0.75, Wr = 1800, H = /* @__PURE__ */ new Map();
2391
+ `, Xr = 0.75, Zr = 1800, H = /* @__PURE__ */ new Map();
2357
2392
  let $ = 0;
2358
- const Pe = "smart-fill:routechange", $t = "smart-fill:session-scan:";
2393
+ const Pe = "smart-fill:routechange", Nt = "smart-fill:session-scan:";
2359
2394
  let et = !1;
2360
2395
  const tt = /* @__PURE__ */ new WeakMap();
2361
- let Xr = 0;
2362
- function Nt() {
2363
- H.clear(), jt(), $ += 1;
2396
+ let Jr = 0;
2397
+ function Vt() {
2398
+ H.clear(), Gt(), $ += 1;
2364
2399
  }
2365
- class Zr {
2400
+ class Qr {
2366
2401
  constructor(t, n) {
2367
2402
  /** 实例级事件总线,对应 instance.on(...) */
2368
- d(this, "events", new Rt());
2403
+ d(this, "events", new Ft());
2369
2404
  /** 页面字段扫描器,root 来自 SmartFill.create({ root }) */
2370
2405
  d(this, "scanner");
2371
2406
  /** 浏览器端本地规则引擎,用于文本正则/键值对提取 */
2372
- d(this, "ruleEngine", new wr());
2407
+ d(this, "ruleEngine", new Sr());
2373
2408
  /** Shadow DOM 面板,mount / mountFloatingButton 后可用(指向最后挂载的面板,用于状态展示) */
2374
2409
  d(this, "panel", null);
2375
2410
  /** 已挂载的全部面板(inline / floating 可同时存在),用于本地优先开关广播与销毁 */
@@ -2379,7 +2414,7 @@ class Zr {
2379
2414
  /** 业务方 registerFields 注册的字段;非空时 rescan 仅扫描这些字段 */
2380
2415
  d(this, "registeredFields", []);
2381
2416
  /** 组件库回填适配器链,如 AntD / Element 自定义控件 */
2382
- d(this, "adapters", [It]);
2417
+ d(this, "adapters", [Mt]);
2383
2418
  /** 最近一次 rescan 结果;scanToken 用于识别/回填防过期校验 */
2384
2419
  d(this, "scanResult", null);
2385
2420
  /** recognize 完成后生成的自动回填候选,供面板展示与 applyAutoItems 使用 */
@@ -2398,7 +2433,7 @@ class Zr {
2398
2433
  d(this, "floatingLifecycleCleanup", null);
2399
2434
  /** mount 后预扫描定时器 */
2400
2435
  d(this, "preScanTimer", null);
2401
- this.config = t, this.context = n, this.scanner = new Mr(t.root || document), this.localPriorityEnabled = Eo(), this.context.manager.add(this);
2436
+ this.config = t, this.context = n, this.scanner = new Fr(t.root || document), this.localPriorityEnabled = ko(), this.context.manager.add(this);
2402
2437
  }
2403
2438
  /** 订阅实例事件,返回取消订阅函数 */
2404
2439
  on(t, n) {
@@ -2434,13 +2469,13 @@ class Zr {
2434
2469
  const n = typeof t == "string" ? document.querySelector(t) : t;
2435
2470
  if (!n)
2436
2471
  throw b("UNSUPPORTED_PAGE", "未找到智能录入挂载点。", "ui");
2437
- const r = it("inline", So(t, n)), o = st(r, !0);
2472
+ const r = it("inline", xo(t, n)), o = st(r, !0);
2438
2473
  return this.createPanel("inline", r, o).mount(n), this.schedulePreScan(), this;
2439
2474
  }
2440
2475
  /** 挂载右下角悬浮按钮 + 弹框(floating 模式),优先挂到当前子路由页面顶层容器 */
2441
2476
  mountFloatingButton() {
2442
2477
  this.assertAlive();
2443
- const t = uo(this.config), n = it("floating"), r = st(n, !1);
2478
+ const t = fo(this.config), n = it("floating"), r = st(n, !1);
2444
2479
  return this.createPanel("floating", n, r).mount(t), this.bindFloatingLifecycle(t), this.schedulePreScan(), this;
2445
2480
  }
2446
2481
  /**
@@ -2449,7 +2484,7 @@ class Zr {
2449
2484
  */
2450
2485
  createPanel(t, n, r) {
2451
2486
  let o;
2452
- return o = new Br({
2487
+ return o = new jr({
2453
2488
  mode: t,
2454
2489
  initialOpen: r,
2455
2490
  messages: this.config.messages,
@@ -2462,7 +2497,7 @@ class Zr {
2462
2497
  }
2463
2498
  /** 同步本地优先开关:更新内存态、写入 localStorage,并广播到其他已挂载面板 */
2464
2499
  handleLocalPriorityChange(t, n) {
2465
- this.localPriorityEnabled = t, xo(t);
2500
+ this.localPriorityEnabled = t, _o(t);
2466
2501
  for (const r of this.panels)
2467
2502
  r !== n && r.setLocalPriorityEnabled(t);
2468
2503
  }
@@ -2512,7 +2547,7 @@ class Zr {
2512
2547
  this.destroyed || !this.panels.length || (this.preScanTimer != null && window.clearTimeout(this.preScanTimer), this.preScanTimer = window.setTimeout(() => {
2513
2548
  this.preScanTimer = null, !(this.destroyed || this.scanResult) && this.preScan().catch(() => {
2514
2549
  });
2515
- }, Wr));
2550
+ }, Zr));
2516
2551
  }
2517
2552
  cancelPreScan() {
2518
2553
  this.preScanTimer != null && (window.clearTimeout(this.preScanTimer), this.preScanTimer = null);
@@ -2530,28 +2565,28 @@ class Zr {
2530
2565
  async recognize(t) {
2531
2566
  var i, s, a, c, l, u;
2532
2567
  this.assertAlive(), this.syncScanCacheVersion(), (i = this.panel) == null || i.setBusy(!0, "扫描中..."), (s = this.panel) == null || s.setStatus("扫描中...");
2533
- const n = await this.rescan(), r = be("trace"), o = performance.now();
2568
+ const n = await this.rescan(), r = ye("trace"), o = performance.now();
2534
2569
  this.events.emit("recognizing", { scanToken: n.scanToken, traceId: r }), (a = this.panel) == null || a.setBusy(!0, "识别中...");
2535
2570
  try {
2536
- const h = n.fields.filter((g) => no(g.localRuleMode, this.localPriorityEnabled)), T = n.fields.filter((g) => g.localRuleMode !== "only"), { text: P, usedOcr: Q } = await this.context.client.resolveInputText({
2571
+ 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({
2537
2572
  text: t.text,
2538
2573
  images: t.images,
2539
2574
  onStatusChange: (g) => {
2540
- var te, L, ne;
2575
+ var ee, L, te;
2541
2576
  if (g === "image_uploading") {
2542
- (te = this.panel) == null || te.setStatus("图片上传中...");
2577
+ (ee = this.panel) == null || ee.setStatus("图片上传中...");
2543
2578
  return;
2544
2579
  }
2545
2580
  if (g === "image_recognizing") {
2546
2581
  (L = this.panel) == null || L.setStatus("图片识别中...");
2547
2582
  return;
2548
2583
  }
2549
- (ne = this.panel) == null || ne.setStatus("识别中...");
2584
+ (te = this.panel) == null || te.setStatus("识别中...");
2550
2585
  }
2551
- }), ee = P ? this.ruleEngine.recognize(P, h, n.scanToken) : [];
2586
+ }), Q = P ? this.ruleEngine.recognize(P, h, n.scanToken) : [];
2552
2587
  let v;
2553
2588
  if (!T.length)
2554
- v = nt(n.scanToken, r, ee, o, void 0, Q);
2589
+ v = nt(n.scanToken, r, Q, o, void 0, J);
2555
2590
  else
2556
2591
  try {
2557
2592
  const g = await this.context.client.recognize({
@@ -2559,7 +2594,7 @@ class Zr {
2559
2594
  formCode: this.config.formCode,
2560
2595
  configVersion: this.formConfigVersion,
2561
2596
  text: P,
2562
- usedOcr: Q,
2597
+ usedOcr: J,
2563
2598
  fields: T,
2564
2599
  onStatusChange: () => {
2565
2600
  var L;
@@ -2567,31 +2602,31 @@ class Zr {
2567
2602
  }
2568
2603
  });
2569
2604
  g.trace.durationMs = g.trace.durationMs || Math.round(performance.now() - o);
2570
- const te = to(
2571
- ee,
2572
- g.suggestions.filter((L) => T.some((ne) => ne.fieldId === L.fieldId))
2605
+ const ee = ro(
2606
+ Q,
2607
+ g.suggestions.filter((L) => T.some((te) => te.fieldId === L.fieldId))
2573
2608
  );
2574
- v = { ...g, suggestions: te };
2609
+ v = { ...g, suggestions: ee };
2575
2610
  } catch (g) {
2576
- if (!ee.length)
2611
+ if (!Q.length)
2577
2612
  throw g;
2578
2613
  v = nt(
2579
2614
  n.scanToken,
2580
2615
  r,
2581
- ee,
2616
+ Q,
2582
2617
  o,
2583
- [Q ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2584
- Q
2618
+ [J ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2619
+ J
2585
2620
  );
2586
2621
  }
2587
- if (this.autoApplyState = Qr(
2622
+ if (this.autoApplyState = to(
2588
2623
  v.scanToken,
2589
2624
  v.trace.traceId,
2590
2625
  v.suggestions,
2591
2626
  n,
2592
2627
  this.registeredFields
2593
2628
  ), this.events.emit("recognized", v), (c = this.panel) == null || c.setAutoApplyState(this.autoApplyState), this.config.apiEnable) {
2594
- const g = Jr(v, this.autoApplyState, n);
2629
+ const g = eo(v, this.autoApplyState, n);
2595
2630
  this.config.apiCallback && await Promise.resolve(this.config.apiCallback(g)), (l = this.panel) == null || l.setStatus(`识别完成,已返回 ${g.fields.length} 个字段。`);
2596
2631
  } else
2597
2632
  await this.applyAutoItems(this.autoApplyState);
@@ -2623,7 +2658,7 @@ class Zr {
2623
2658
  var a, c;
2624
2659
  if (!this.scanResult)
2625
2660
  throw b("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2626
- const n = eo(t), r = t.items.filter((l) => Vt(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2661
+ const n = no(t), r = t.items.filter((l) => Kt(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2627
2662
  this.events.emit("applying", { scanToken: t.scanToken, count: r.length }), (a = this.panel) == null || a.setStatus("识别完成,正在自动回填...");
2628
2663
  const i = await new Ze(this.scanResult.fields, this.registeredFields, this.adapters).apply({ scanToken: t.scanToken, values: r }), s = {
2629
2664
  ...i,
@@ -2649,7 +2684,7 @@ class Zr {
2649
2684
  }
2650
2685
  emitError(t, n) {
2651
2686
  var o;
2652
- const r = Xe(t, n);
2687
+ const r = We(t, n);
2653
2688
  this.events.emit("error", r), (o = this.panel) == null || o.setError(r.message);
2654
2689
  }
2655
2690
  getCachedPageScanResult(t) {
@@ -2657,7 +2692,7 @@ class Zr {
2657
2692
  if (!n) return null;
2658
2693
  const r = H.get(n);
2659
2694
  if (r && (!t || r.dynamicOptionsReady)) {
2660
- const i = oo(r.scanResult);
2695
+ const i = so(r.scanResult);
2661
2696
  if (!i)
2662
2697
  H.delete(n);
2663
2698
  else
@@ -2676,13 +2711,13 @@ class Zr {
2676
2711
  }), this.persistPageScanResult(t, (o == null ? void 0 : o.dynamicOptionsReady) || n));
2677
2712
  }
2678
2713
  getPageScanCacheKey() {
2679
- return this.registeredFields.length ? null : ao(this.config);
2714
+ return this.registeredFields.length ? null : lo(this.config);
2680
2715
  }
2681
2716
  getSessionPageScanCacheKey() {
2682
- return this.registeredFields.length || !this.config.formCode ? null : co(this.config);
2717
+ return this.registeredFields.length || !this.config.formCode ? null : uo(this.config);
2683
2718
  }
2684
2719
  clearScanStateOnTokenExpired(t) {
2685
- Xe(t, "recognize").code === "TOKEN_EXPIRED" && (Nt(), this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2720
+ We(t, "recognize").code === "TOKEN_EXPIRED" && (Vt(), this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2686
2721
  }
2687
2722
  syncScanCacheVersion() {
2688
2723
  this.scanCacheVersion !== $ && (this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
@@ -2690,24 +2725,24 @@ class Zr {
2690
2725
  getPersistedPageScanResult(t) {
2691
2726
  const n = this.getSessionPageScanCacheKey();
2692
2727
  if (!n) return null;
2693
- const r = wo(n);
2728
+ const r = So(n);
2694
2729
  if (!r || t && !r.dynamicOptionsReady) return null;
2695
- const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = io(r, o);
2730
+ const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = ao(r, o);
2696
2731
  return i ? {
2697
2732
  scanResult: i,
2698
2733
  dynamicOptionsReady: r.dynamicOptionsReady
2699
- } : (jt(n), null);
2734
+ } : (Gt(n), null);
2700
2735
  }
2701
2736
  persistPageScanResult(t, n) {
2702
2737
  const r = this.getSessionPageScanCacheKey();
2703
- !r || !t.fields.length || vo(r, {
2738
+ !r || !t.fields.length || Eo(r, {
2704
2739
  version: 1,
2705
2740
  dynamicOptionsReady: n,
2706
2741
  fields: t.fields.map(({ element: o, scanToken: i, ...s }) => s)
2707
2742
  });
2708
2743
  }
2709
2744
  bindFloatingLifecycle(t) {
2710
- this.clearFloatingLifecycle(), this.floatingRouteSnapshot = ot(), lo();
2745
+ this.clearFloatingLifecycle(), this.floatingRouteSnapshot = ot(), po();
2711
2746
  const n = () => {
2712
2747
  this.destroyed || ot() !== this.floatingRouteSnapshot && this.destroy();
2713
2748
  };
@@ -2724,7 +2759,7 @@ class Zr {
2724
2759
  (t = this.floatingLifecycleCleanup) == null || t.call(this);
2725
2760
  }
2726
2761
  }
2727
- function Jr(e, t, n) {
2762
+ function eo(e, t, n) {
2728
2763
  return {
2729
2764
  scanToken: e.scanToken,
2730
2765
  trace: e.trace,
@@ -2745,12 +2780,12 @@ function Jr(e, t, n) {
2745
2780
  })
2746
2781
  };
2747
2782
  }
2748
- function Qr(e, t, n, r, o) {
2783
+ function to(e, t, n, r, o) {
2749
2784
  return {
2750
2785
  scanToken: e,
2751
2786
  traceId: t,
2752
2787
  items: n.map((i) => {
2753
- 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() : ro(s == null ? void 0 : s.element);
2788
+ 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);
2754
2789
  return {
2755
2790
  applyItemId: `${i.fieldId}_${Math.random().toString(36).slice(2, 8)}`,
2756
2791
  fieldId: i.fieldId,
@@ -2768,12 +2803,12 @@ function Qr(e, t, n, r, o) {
2768
2803
  })
2769
2804
  };
2770
2805
  }
2771
- function Vt(e) {
2806
+ function Kt(e) {
2772
2807
  var t;
2773
- return e.confidence >= Yr && !((t = e.warnings) != null && t.length);
2808
+ return e.confidence >= Xr && !((t = e.warnings) != null && t.length);
2774
2809
  }
2775
- function eo(e) {
2776
- return e.items.filter((t) => !Vt(t)).map((t) => {
2810
+ function no(e) {
2811
+ return e.items.filter((t) => !Kt(t)).map((t) => {
2777
2812
  var n, r;
2778
2813
  return {
2779
2814
  fieldId: t.fieldId,
@@ -2784,7 +2819,7 @@ function eo(e) {
2784
2819
  };
2785
2820
  });
2786
2821
  }
2787
- function to(e, t) {
2822
+ function ro(e, t) {
2788
2823
  const n = /* @__PURE__ */ new Map();
2789
2824
  for (const r of t)
2790
2825
  n.set(r.fieldId, r);
@@ -2792,7 +2827,7 @@ function to(e, t) {
2792
2827
  n.has(r.fieldId) || n.set(r.fieldId, r);
2793
2828
  return [...n.values()];
2794
2829
  }
2795
- function no(e, t) {
2830
+ function oo(e, t) {
2796
2831
  return e === "only" ? !0 : e === "off" ? !1 : t;
2797
2832
  }
2798
2833
  function nt(e, t, n, r, o, i = !1) {
@@ -2808,15 +2843,15 @@ function nt(e, t, n, r, o, i = !1) {
2808
2843
  }
2809
2844
  };
2810
2845
  }
2811
- function ro(e) {
2846
+ function io(e) {
2812
2847
  if (e)
2813
2848
  return e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked : e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value : e.textContent;
2814
2849
  }
2815
- function oo(e) {
2850
+ function so(e) {
2816
2851
  const t = e.fields.map((n) => {
2817
2852
  if (n.source === "registered")
2818
2853
  return n;
2819
- const r = so(n);
2854
+ const r = co(n);
2820
2855
  return r ? { ...n, element: r } : null;
2821
2856
  });
2822
2857
  return t.some((n) => !n) ? null : {
@@ -2824,7 +2859,7 @@ function oo(e) {
2824
2859
  fields: t
2825
2860
  };
2826
2861
  }
2827
- function io(e, t) {
2862
+ function ao(e, t) {
2828
2863
  var s, a;
2829
2864
  const n = new Map(t.fields.map((c) => [c.fieldId, c])), r = [], o = /* @__PURE__ */ new Set();
2830
2865
  for (const c of e.fields) {
@@ -2856,31 +2891,31 @@ function io(e, t) {
2856
2891
  fields: [...r, ...i]
2857
2892
  };
2858
2893
  }
2859
- function so(e) {
2894
+ function co(e) {
2860
2895
  var t;
2861
2896
  if ((t = e.element) != null && t.isConnected) return e.element;
2862
2897
  try {
2863
- return document.querySelector(`[data-smart-fill-id="${ko(e.fieldId)}"]`);
2898
+ return document.querySelector(`[data-smart-fill-id="${Co(e.fieldId)}"]`);
2864
2899
  } catch {
2865
2900
  return null;
2866
2901
  }
2867
2902
  }
2868
- function ao(e) {
2869
- const t = typeof location < "u" ? `${location.origin}${location.pathname}${location.search}` : "unknown-page", n = Kt(e.root || document);
2903
+ function lo(e) {
2904
+ const t = typeof location < "u" ? `${location.origin}${location.pathname}${location.search}` : "unknown-page", n = zt(e.root || document);
2870
2905
  return `smart-fill:${t}:${e.formCode || "default-form"}:${n}:${e.maxFields ?? 200}:scan`;
2871
2906
  }
2872
- function co(e) {
2873
- const t = Kt(e.root || document);
2874
- return `${$t}${e.formCode || "default-form"}:${t}:${e.maxFields ?? 200}`;
2907
+ function uo(e) {
2908
+ const t = zt(e.root || document);
2909
+ return `${Nt}${e.formCode || "default-form"}:${t}:${e.maxFields ?? 200}`;
2875
2910
  }
2876
- function Kt(e) {
2911
+ function zt(e) {
2877
2912
  if (e === document) return "document";
2878
2913
  const t = tt.get(e);
2879
2914
  if (t) return t;
2880
- const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++Xr}`;
2915
+ const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++Jr}`;
2881
2916
  return tt.set(e, n), n;
2882
2917
  }
2883
- function lo() {
2918
+ function po() {
2884
2919
  if (et || typeof window > "u") return;
2885
2920
  et = !0;
2886
2921
  const e = () => {
@@ -2898,35 +2933,35 @@ function rt(e, t) {
2898
2933
  function ot() {
2899
2934
  return typeof location > "u" ? "unknown-route" : `${location.pathname}${location.search}${location.hash}`;
2900
2935
  }
2901
- function uo(e) {
2902
- const t = po(e.floatingContainer);
2936
+ function fo(e) {
2937
+ const t = ho(e.floatingContainer);
2903
2938
  if (t)
2904
2939
  return t;
2905
- const n = fo(e.routeContainerSelector);
2906
- return n || ho() || document.body;
2940
+ const n = go(e.routeContainerSelector);
2941
+ return n || yo() || document.body;
2907
2942
  }
2908
- function po(e) {
2943
+ function ho(e) {
2909
2944
  return e ? e instanceof HTMLElement ? e : He(e) : null;
2910
2945
  }
2911
- function fo(e) {
2946
+ function go(e) {
2912
2947
  if (!e) return null;
2913
- const t = zt(), n = t ? He(e, t) : null;
2948
+ const t = Bt(), n = t ? He(e, t) : null;
2914
2949
  return n || He(e);
2915
2950
  }
2916
- function ho() {
2917
- const e = zt();
2951
+ function yo() {
2952
+ const e = Bt();
2918
2953
  if (!e)
2919
2954
  return null;
2920
- const t = go(e);
2955
+ const t = bo(e);
2921
2956
  if (t)
2922
2957
  return t;
2923
- const n = yo(e);
2958
+ const n = mo(e);
2924
2959
  if (n)
2925
2960
  return n;
2926
- const r = bo(e);
2961
+ const r = wo(e);
2927
2962
  return r !== e ? r : null;
2928
2963
  }
2929
- function zt() {
2964
+ function Bt() {
2930
2965
  const e = [
2931
2966
  "#app",
2932
2967
  "#root",
@@ -2940,16 +2975,16 @@ function zt() {
2940
2975
  ];
2941
2976
  for (const t of e) {
2942
2977
  const n = document.querySelector(t);
2943
- if (n && ve(n))
2978
+ if (n && we(n))
2944
2979
  return n;
2945
2980
  }
2946
2981
  return null;
2947
2982
  }
2948
- function go(e) {
2949
- const t = m(e), n = Bt(e).filter((o) => !ze(o)).filter((o) => m(o) >= Math.max(t * 0.2, 48e3)), r = n.filter((o) => mo(o));
2983
+ function bo(e) {
2984
+ 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));
2950
2985
  return r.length ? r.sort((o, i) => m(i) - m(o))[0] : n.length === 1 ? n[0] : null;
2951
2986
  }
2952
- function yo(e) {
2987
+ function mo(e) {
2953
2988
  const t = [
2954
2989
  "[data-route-root]",
2955
2990
  "[data-router-view]",
@@ -2965,13 +3000,13 @@ function yo(e) {
2965
3000
  ".app-content",
2966
3001
  "main",
2967
3002
  '[role="main"]'
2968
- ], n = Ut(e), r = m(e);
2969
- return t.flatMap((i) => Array.from(e.querySelectorAll(i))).filter((i) => ve(i) && !ze(i)).filter((i) => Ae(i, n) <= 3).filter((i) => m(i) >= Math.max(r * 0.2, 48e3)).sort((i, s) => Ae(i, n) - Ae(s, n) || m(s) - m(i))[0] || null;
3003
+ ], n = jt(e), r = m(e);
3004
+ 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;
2970
3005
  }
2971
- function bo(e) {
3006
+ function wo(e) {
2972
3007
  let t = e;
2973
3008
  for (; ; ) {
2974
- const n = Bt(t).filter((o) => !ze(o));
3009
+ const n = Ut(t).filter((o) => !Ke(o));
2975
3010
  if (n.length !== 1)
2976
3011
  return t;
2977
3012
  const [r] = n;
@@ -2980,29 +3015,29 @@ function bo(e) {
2980
3015
  t = r;
2981
3016
  }
2982
3017
  }
2983
- function Bt(e) {
2984
- return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => ve(t));
3018
+ function Ut(e) {
3019
+ return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => we(t));
2985
3020
  }
2986
3021
  function He(e, t = document) {
2987
3022
  try {
2988
3023
  const n = t.querySelector(e);
2989
- return n && ve(n) ? n : null;
3024
+ return n && we(n) ? n : null;
2990
3025
  } catch {
2991
3026
  return null;
2992
3027
  }
2993
3028
  }
2994
- function ve(e) {
3029
+ function we(e) {
2995
3030
  const t = window.getComputedStyle(e);
2996
3031
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
2997
3032
  return !1;
2998
3033
  const n = e.getBoundingClientRect();
2999
3034
  return n.width > 0 && n.height > 0;
3000
3035
  }
3001
- function ze(e) {
3036
+ function Ke(e) {
3002
3037
  const t = window.getComputedStyle(e);
3003
3038
  return t.position === "fixed" || t.position === "sticky" ? !0 : m(e) < 24e3;
3004
3039
  }
3005
- function mo(e) {
3040
+ function vo(e) {
3006
3041
  if (e.tagName.toLowerCase() === "main" || e.getAttribute("role") === "main")
3007
3042
  return !0;
3008
3043
  const t = e.id || "", n = typeof e.className == "string" ? e.className : "", r = `${t} ${n}`.toLowerCase();
@@ -3012,16 +3047,16 @@ function m(e) {
3012
3047
  const t = e.getBoundingClientRect();
3013
3048
  return Math.max(0, t.width) * Math.max(0, t.height);
3014
3049
  }
3015
- function Ut(e) {
3050
+ function jt(e) {
3016
3051
  let t = 0, n = e;
3017
3052
  for (; n && n !== document.body; )
3018
3053
  t += 1, n = n.parentElement;
3019
3054
  return t;
3020
3055
  }
3021
- function Ae(e, t) {
3022
- return Math.max(0, Ut(e) - t);
3056
+ function Ce(e, t) {
3057
+ return Math.max(0, jt(e) - t);
3023
3058
  }
3024
- function wo(e) {
3059
+ function So(e) {
3025
3060
  try {
3026
3061
  const t = window.sessionStorage.getItem(e);
3027
3062
  if (!t) return null;
@@ -3031,13 +3066,13 @@ function wo(e) {
3031
3066
  return null;
3032
3067
  }
3033
3068
  }
3034
- function vo(e, t) {
3069
+ function Eo(e, t) {
3035
3070
  try {
3036
3071
  window.sessionStorage.setItem(e, JSON.stringify(t));
3037
3072
  } catch {
3038
3073
  }
3039
3074
  }
3040
- function jt(e) {
3075
+ function Gt(e) {
3041
3076
  try {
3042
3077
  if (e) {
3043
3078
  window.sessionStorage.removeItem(e);
@@ -3046,7 +3081,7 @@ function jt(e) {
3046
3081
  const t = [];
3047
3082
  for (let n = 0; n < window.sessionStorage.length; n += 1) {
3048
3083
  const r = window.sessionStorage.key(n);
3049
- r != null && r.startsWith($t) && t.push(r);
3084
+ r != null && r.startsWith(Nt) && t.push(r);
3050
3085
  }
3051
3086
  for (const n of t)
3052
3087
  window.sessionStorage.removeItem(n);
@@ -3057,7 +3092,7 @@ function it(e, t = "default") {
3057
3092
  const n = typeof location < "u" ? location.pathname : "unknown-page", r = t.replace(/[^\w-]/g, "_") || "default";
3058
3093
  return `smart-fill:${e}:${n}:${r}:open`;
3059
3094
  }
3060
- function So(e, t) {
3095
+ function xo(e, t) {
3061
3096
  if (typeof e == "string") return e;
3062
3097
  if (t.id) return `#${t.id}`;
3063
3098
  const n = typeof t.className == "string" ? t.className.trim().split(/\s+/).filter(Boolean)[0] : "";
@@ -3078,38 +3113,38 @@ function at(e, t) {
3078
3113
  } catch {
3079
3114
  }
3080
3115
  }
3081
- function Gt() {
3116
+ function Yt() {
3082
3117
  return `smart-fill:${typeof location < "u" ? location.pathname : "unknown-page"}:local-priority`;
3083
3118
  }
3084
- function Eo() {
3119
+ function ko() {
3085
3120
  try {
3086
- return window.localStorage.getItem(Gt()) === "1";
3121
+ return window.localStorage.getItem(Yt()) === "1";
3087
3122
  } catch {
3088
3123
  return !1;
3089
3124
  }
3090
3125
  }
3091
- function xo(e) {
3126
+ function _o(e) {
3092
3127
  try {
3093
- window.localStorage.setItem(Gt(), e ? "1" : "0");
3128
+ window.localStorage.setItem(Yt(), e ? "1" : "0");
3094
3129
  } catch {
3095
3130
  }
3096
3131
  }
3097
- function ko(e) {
3132
+ function Co(e) {
3098
3133
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
3099
3134
  }
3100
- const f = { status: "idle" }, Te = new Rt(), ct = new lr();
3101
- class _o {
3135
+ const f = { status: "idle" }, Ae = new Ft(), ct = new lr();
3136
+ class Ao {
3102
3137
  /** 初始化 SDK:校验 apiKey、创建会话、获取 accessToken */
3103
3138
  static async setup(t) {
3104
3139
  if (typeof window > "u")
3105
- return f.status = "ready", Co();
3140
+ return f.status = "ready", To();
3106
3141
  if (f.status === "ready" && f.apiKey === t.apiKey && f.session)
3107
3142
  return f.session;
3108
3143
  if (f.status === "loading" && f.apiKey === t.apiKey && f.promise)
3109
3144
  return f.promise;
3110
- f.apiKey && f.apiKey !== t.apiKey && (Nt(), ct.destroyAll());
3145
+ f.apiKey && f.apiKey !== t.apiKey && (Vt(), ct.destroyAll());
3111
3146
  const n = new rr(t);
3112
- 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, Te.emit("ready", { apiKey: t.apiKey }), r)).catch((r) => {
3147
+ 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) => {
3113
3148
  throw f.status = "error", r;
3114
3149
  }), f.promise;
3115
3150
  }
@@ -3119,15 +3154,15 @@ class _o {
3119
3154
  return N();
3120
3155
  if (f.status !== "ready" || !f.client)
3121
3156
  throw b("SDK_NOT_READY", "请先 await SmartFill.setup({ apiKey })。", "setup");
3122
- return new Zr(t, {
3157
+ return new Qr(t, {
3123
3158
  client: f.client,
3124
3159
  manager: ct
3125
3160
  });
3126
3161
  }
3127
3162
  }
3128
3163
  /** 订阅全局事件(目前仅 ready) */
3129
- d(_o, "on", Te.on.bind(Te));
3130
- function Co() {
3164
+ d(Ao, "on", Ae.on.bind(Ae));
3165
+ function To() {
3131
3166
  return {
3132
3167
  apiKey: "server-mock",
3133
3168
  accessToken: "server-mock",
@@ -3166,12 +3201,12 @@ function N(e) {
3166
3201
  export {
3167
3202
  nr as DEFAULT_BASE_URL,
3168
3203
  Ze as DomFiller,
3169
- Mr as DomScanner,
3170
- Lo as ElementAdapter,
3171
- Rt as EventBus,
3172
- wr as LocalRuleEngine,
3173
- To as NativeAdapter,
3174
- _o as SmartFill,
3175
- Zr as SmartFillInstance,
3176
- It as UiFrameworkAdapter
3204
+ Fr as DomScanner,
3205
+ Mo as ElementAdapter,
3206
+ Ft as EventBus,
3207
+ Sr as LocalRuleEngine,
3208
+ Io as NativeAdapter,
3209
+ Ao as SmartFill,
3210
+ Qr as SmartFillInstance,
3211
+ Mt as UiFrameworkAdapter
3177
3212
  };