@kevisual/kv-login 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,68 +1,68 @@
1
- const je = globalThis, le = je.trustedTypes, Ge = le ? le.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, Pt = "$lit$", H = `lit$${Math.random().toFixed(9).slice(2)}$`, qt = "?" + H, rn = `<${qt}>`, W = document, ne = () => W.createComment(""), re = (t) => t === null || typeof t != "object" && typeof t != "function", Ve = Array.isArray, on = (t) => Ve(t) || typeof t?.[Symbol.iterator] == "function", pe = `[
2
- \f\r]`, ee = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ye = /-->/g, Xe = />/g, j = RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`, "g"), Ze = /'/g, et = /"/g, Dt = /^(?:script|style|textarea|title)$/i, sn = (t) => (e, ...r) => ({ _$litType$: t, strings: e, values: r }), L = sn(1), Y = Symbol.for("lit-noChange"), M = Symbol.for("lit-nothing"), tt = /* @__PURE__ */ new WeakMap(), V = W.createTreeWalker(W, 129);
4
- function Nt(t, e) {
5
- if (!Ve(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
6
- return Ge !== void 0 ? Ge.createHTML(e) : e;
7
- }
8
- const an = (t, e) => {
9
- const r = t.length - 1, n = [];
10
- let o, s = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", i = ee;
11
- for (let c = 0; c < r; c++) {
12
- const a = t[c];
1
+ const Je = globalThis, ue = Je.trustedTypes, tt = ue ? ue.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Vt = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, Ot = "?" + j, pn = `<${Ot}>`, W = document, re = () => W.createComment(""), oe = (n) => n === null || typeof n != "object" && typeof n != "function", Qe = Array.isArray, wn = (n) => Qe(n) || typeof n?.[Symbol.iterator] == "function", ve = `[
2
+ \f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, rt = />/g, V = RegExp(`>|${ve}(?:([^\\s"'>=/]+)(${ve}*=${ve}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ot = /'/g, st = /"/g, Wt = /^(?:script|style|textarea|title)$/i, yn = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), I = yn(1), X = Symbol.for("lit-noChange"), B = Symbol.for("lit-nothing"), it = /* @__PURE__ */ new WeakMap(), O = W.createTreeWalker(W, 129);
4
+ function Kt(n, e) {
5
+ if (!Qe(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
6
+ return tt !== void 0 ? tt.createHTML(e) : e;
7
+ }
8
+ const vn = (n, e) => {
9
+ const t = n.length - 1, r = [];
10
+ let o, s = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", i = te;
11
+ for (let c = 0; c < t; c++) {
12
+ const a = n[c];
13
13
  let l, u, h = -1, f = 0;
14
- for (; f < a.length && (i.lastIndex = f, u = i.exec(a), u !== null); ) f = i.lastIndex, i === ee ? u[1] === "!--" ? i = Ye : u[1] !== void 0 ? i = Xe : u[2] !== void 0 ? (Dt.test(u[2]) && (o = RegExp("</" + u[2], "g")), i = j) : u[3] !== void 0 && (i = j) : i === j ? u[0] === ">" ? (i = o ?? ee, h = -1) : u[1] === void 0 ? h = -2 : (h = i.lastIndex - u[2].length, l = u[1], i = u[3] === void 0 ? j : u[3] === '"' ? et : Ze) : i === et || i === Ze ? i = j : i === Ye || i === Xe ? i = ee : (i = j, o = void 0);
15
- const d = i === j && t[c + 1].startsWith("/>") ? " " : "";
16
- s += i === ee ? a + rn : h >= 0 ? (n.push(l), a.slice(0, h) + Pt + a.slice(h) + H + d) : a + H + (h === -2 ? c : d);
14
+ for (; f < a.length && (i.lastIndex = f, u = i.exec(a), u !== null); ) f = i.lastIndex, i === te ? u[1] === "!--" ? i = nt : u[1] !== void 0 ? i = rt : u[2] !== void 0 ? (Wt.test(u[2]) && (o = RegExp("</" + u[2], "g")), i = V) : u[3] !== void 0 && (i = V) : i === V ? u[0] === ">" ? (i = o ?? te, h = -1) : u[1] === void 0 ? h = -2 : (h = i.lastIndex - u[2].length, l = u[1], i = u[3] === void 0 ? V : u[3] === '"' ? st : ot) : i === st || i === ot ? i = V : i === nt || i === rt ? i = te : (i = V, o = void 0);
15
+ const d = i === V && n[c + 1].startsWith("/>") ? " " : "";
16
+ s += i === te ? a + pn : h >= 0 ? (r.push(l), a.slice(0, h) + Vt + a.slice(h) + j + d) : a + j + (h === -2 ? c : d);
17
17
  }
18
- return [Nt(t, s + (t[r] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), n];
18
+ return [Kt(n, s + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), r];
19
19
  };
20
- class oe {
21
- constructor({ strings: e, _$litType$: r }, n) {
20
+ class se {
21
+ constructor({ strings: e, _$litType$: t }, r) {
22
22
  let o;
23
23
  this.parts = [];
24
24
  let s = 0, i = 0;
25
- const c = e.length - 1, a = this.parts, [l, u] = an(e, r);
26
- if (this.el = oe.createElement(l, n), V.currentNode = this.el.content, r === 2 || r === 3) {
25
+ const c = e.length - 1, a = this.parts, [l, u] = vn(e, t);
26
+ if (this.el = se.createElement(l, r), O.currentNode = this.el.content, t === 2 || t === 3) {
27
27
  const h = this.el.content.firstChild;
28
28
  h.replaceWith(...h.childNodes);
29
29
  }
30
- for (; (o = V.nextNode()) !== null && a.length < c; ) {
30
+ for (; (o = O.nextNode()) !== null && a.length < c; ) {
31
31
  if (o.nodeType === 1) {
32
- if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(Pt)) {
33
- const f = u[i++], d = o.getAttribute(h).split(H), w = /([.?@])?(.*)/.exec(f);
34
- a.push({ type: 1, index: s, name: w[2], strings: d, ctor: w[1] === "." ? ln : w[1] === "?" ? un : w[1] === "@" ? hn : ue }), o.removeAttribute(h);
35
- } else h.startsWith(H) && (a.push({ type: 6, index: s }), o.removeAttribute(h));
36
- if (Dt.test(o.tagName)) {
37
- const h = o.textContent.split(H), f = h.length - 1;
32
+ if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(Vt)) {
33
+ const f = u[i++], d = o.getAttribute(h).split(j), g = /([.?@])?(.*)/.exec(f);
34
+ a.push({ type: 1, index: s, name: g[2], strings: d, ctor: g[1] === "." ? Cn : g[1] === "?" ? An : g[1] === "@" ? Tn : ge }), o.removeAttribute(h);
35
+ } else h.startsWith(j) && (a.push({ type: 6, index: s }), o.removeAttribute(h));
36
+ if (Wt.test(o.tagName)) {
37
+ const h = o.textContent.split(j), f = h.length - 1;
38
38
  if (f > 0) {
39
- o.textContent = le ? le.emptyScript : "";
40
- for (let d = 0; d < f; d++) o.append(h[d], ne()), V.nextNode(), a.push({ type: 2, index: ++s });
41
- o.append(h[f], ne());
39
+ o.textContent = ue ? ue.emptyScript : "";
40
+ for (let d = 0; d < f; d++) o.append(h[d], re()), O.nextNode(), a.push({ type: 2, index: ++s });
41
+ o.append(h[f], re());
42
42
  }
43
43
  }
44
- } else if (o.nodeType === 8) if (o.data === qt) a.push({ type: 2, index: s });
44
+ } else if (o.nodeType === 8) if (o.data === Ot) a.push({ type: 2, index: s });
45
45
  else {
46
46
  let h = -1;
47
- for (; (h = o.data.indexOf(H, h + 1)) !== -1; ) a.push({ type: 7, index: s }), h += H.length - 1;
47
+ for (; (h = o.data.indexOf(j, h + 1)) !== -1; ) a.push({ type: 7, index: s }), h += j.length - 1;
48
48
  }
49
49
  s++;
50
50
  }
51
51
  }
52
- static createElement(e, r) {
53
- const n = W.createElement("template");
54
- return n.innerHTML = e, n;
52
+ static createElement(e, t) {
53
+ const r = W.createElement("template");
54
+ return r.innerHTML = e, r;
55
55
  }
56
56
  }
57
- function X(t, e, r = t, n) {
58
- if (e === Y) return e;
59
- let o = n !== void 0 ? r._$Co?.[n] : r._$Cl;
60
- const s = re(e) ? void 0 : e._$litDirective$;
61
- return o?.constructor !== s && (o?._$AO?.(!1), s === void 0 ? o = void 0 : (o = new s(t), o._$AT(t, r, n)), n !== void 0 ? (r._$Co ??= [])[n] = o : r._$Cl = o), o !== void 0 && (e = X(t, o._$AS(t, e.values), o, n)), e;
57
+ function Z(n, e, t = n, r) {
58
+ if (e === X) return e;
59
+ let o = r !== void 0 ? t._$Co?.[r] : t._$Cl;
60
+ const s = oe(e) ? void 0 : e._$litDirective$;
61
+ return o?.constructor !== s && (o?._$AO?.(!1), s === void 0 ? o = void 0 : (o = new s(n), o._$AT(n, t, r)), r !== void 0 ? (t._$Co ??= [])[r] = o : t._$Cl = o), o !== void 0 && (e = Z(n, o._$AS(n, e.values), o, r)), e;
62
62
  }
63
- class cn {
64
- constructor(e, r) {
65
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = r;
63
+ class bn {
64
+ constructor(e, t) {
65
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
66
66
  }
67
67
  get parentNode() {
68
68
  return this._$AM.parentNode;
@@ -71,34 +71,34 @@ class cn {
71
71
  return this._$AM._$AU;
72
72
  }
73
73
  u(e) {
74
- const { el: { content: r }, parts: n } = this._$AD, o = (e?.creationScope ?? W).importNode(r, !0);
75
- V.currentNode = o;
76
- let s = V.nextNode(), i = 0, c = 0, a = n[0];
74
+ const { el: { content: t }, parts: r } = this._$AD, o = (e?.creationScope ?? W).importNode(t, !0);
75
+ O.currentNode = o;
76
+ let s = O.nextNode(), i = 0, c = 0, a = r[0];
77
77
  for (; a !== void 0; ) {
78
78
  if (i === a.index) {
79
79
  let l;
80
- a.type === 2 ? l = new ie(s, s.nextSibling, this, e) : a.type === 1 ? l = new a.ctor(s, a.name, a.strings, this, e) : a.type === 6 && (l = new dn(s, this, e)), this._$AV.push(l), a = n[++c];
80
+ a.type === 2 ? l = new ae(s, s.nextSibling, this, e) : a.type === 1 ? l = new a.ctor(s, a.name, a.strings, this, e) : a.type === 6 && (l = new En(s, this, e)), this._$AV.push(l), a = r[++c];
81
81
  }
82
- i !== a?.index && (s = V.nextNode(), i++);
82
+ i !== a?.index && (s = O.nextNode(), i++);
83
83
  }
84
- return V.currentNode = W, o;
84
+ return O.currentNode = W, o;
85
85
  }
86
86
  p(e) {
87
- let r = 0;
88
- for (const n of this._$AV) n !== void 0 && (n.strings !== void 0 ? (n._$AI(e, n, r), r += n.strings.length - 2) : n._$AI(e[r])), r++;
87
+ let t = 0;
88
+ for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, t), t += r.strings.length - 2) : r._$AI(e[t])), t++;
89
89
  }
90
90
  }
91
- class ie {
91
+ class ae {
92
92
  get _$AU() {
93
93
  return this._$AM?._$AU ?? this._$Cv;
94
94
  }
95
- constructor(e, r, n, o) {
96
- this.type = 2, this._$AH = M, this._$AN = void 0, this._$AA = e, this._$AB = r, this._$AM = n, this.options = o, this._$Cv = o?.isConnected ?? !0;
95
+ constructor(e, t, r, o) {
96
+ this.type = 2, this._$AH = B, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = r, this.options = o, this._$Cv = o?.isConnected ?? !0;
97
97
  }
98
98
  get parentNode() {
99
99
  let e = this._$AA.parentNode;
100
- const r = this._$AM;
101
- return r !== void 0 && e?.nodeType === 11 && (e = r.parentNode), e;
100
+ const t = this._$AM;
101
+ return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
102
102
  }
103
103
  get startNode() {
104
104
  return this._$AA;
@@ -106,8 +106,8 @@ class ie {
106
106
  get endNode() {
107
107
  return this._$AB;
108
108
  }
109
- _$AI(e, r = this) {
110
- e = X(this, e, r), re(e) ? e === M || e == null || e === "" ? (this._$AH !== M && this._$AR(), this._$AH = M) : e !== this._$AH && e !== Y && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : on(e) ? this.k(e) : this._(e);
109
+ _$AI(e, t = this) {
110
+ e = Z(this, e, t), oe(e) ? e === B || e == null || e === "" ? (this._$AH !== B && this._$AR(), this._$AH = B) : e !== this._$AH && e !== X && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : wn(e) ? this.k(e) : this._(e);
111
111
  }
112
112
  O(e) {
113
113
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -116,162 +116,162 @@ class ie {
116
116
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
117
117
  }
118
118
  _(e) {
119
- this._$AH !== M && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(W.createTextNode(e)), this._$AH = e;
119
+ this._$AH !== B && oe(this._$AH) ? this._$AA.nextSibling.data = e : this.T(W.createTextNode(e)), this._$AH = e;
120
120
  }
121
121
  $(e) {
122
- const { values: r, _$litType$: n } = e, o = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = oe.createElement(Nt(n.h, n.h[0]), this.options)), n);
123
- if (this._$AH?._$AD === o) this._$AH.p(r);
122
+ const { values: t, _$litType$: r } = e, o = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = se.createElement(Kt(r.h, r.h[0]), this.options)), r);
123
+ if (this._$AH?._$AD === o) this._$AH.p(t);
124
124
  else {
125
- const s = new cn(o, this), i = s.u(this.options);
126
- s.p(r), this.T(i), this._$AH = s;
125
+ const s = new bn(o, this), i = s.u(this.options);
126
+ s.p(t), this.T(i), this._$AH = s;
127
127
  }
128
128
  }
129
129
  _$AC(e) {
130
- let r = tt.get(e.strings);
131
- return r === void 0 && tt.set(e.strings, r = new oe(e)), r;
130
+ let t = it.get(e.strings);
131
+ return t === void 0 && it.set(e.strings, t = new se(e)), t;
132
132
  }
133
133
  k(e) {
134
- Ve(this._$AH) || (this._$AH = [], this._$AR());
135
- const r = this._$AH;
136
- let n, o = 0;
137
- for (const s of e) o === r.length ? r.push(n = new ie(this.O(ne()), this.O(ne()), this, this.options)) : n = r[o], n._$AI(s), o++;
138
- o < r.length && (this._$AR(n && n._$AB.nextSibling, o), r.length = o);
139
- }
140
- _$AR(e = this._$AA.nextSibling, r) {
141
- for (this._$AP?.(!1, !0, r); e !== this._$AB; ) {
142
- const n = e.nextSibling;
143
- e.remove(), e = n;
134
+ Qe(this._$AH) || (this._$AH = [], this._$AR());
135
+ const t = this._$AH;
136
+ let r, o = 0;
137
+ for (const s of e) o === t.length ? t.push(r = new ae(this.O(re()), this.O(re()), this, this.options)) : r = t[o], r._$AI(s), o++;
138
+ o < t.length && (this._$AR(r && r._$AB.nextSibling, o), t.length = o);
139
+ }
140
+ _$AR(e = this._$AA.nextSibling, t) {
141
+ for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
142
+ const r = e.nextSibling;
143
+ e.remove(), e = r;
144
144
  }
145
145
  }
146
146
  setConnected(e) {
147
147
  this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
148
148
  }
149
149
  }
150
- class ue {
150
+ class ge {
151
151
  get tagName() {
152
152
  return this.element.tagName;
153
153
  }
154
154
  get _$AU() {
155
155
  return this._$AM._$AU;
156
156
  }
157
- constructor(e, r, n, o, s) {
158
- this.type = 1, this._$AH = M, this._$AN = void 0, this.element = e, this.name = r, this._$AM = o, this.options = s, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = M;
157
+ constructor(e, t, r, o, s) {
158
+ this.type = 1, this._$AH = B, this._$AN = void 0, this.element = e, this.name = t, this._$AM = o, this.options = s, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = B;
159
159
  }
160
- _$AI(e, r = this, n, o) {
160
+ _$AI(e, t = this, r, o) {
161
161
  const s = this.strings;
162
162
  let i = !1;
163
- if (s === void 0) e = X(this, e, r, 0), i = !re(e) || e !== this._$AH && e !== Y, i && (this._$AH = e);
163
+ if (s === void 0) e = Z(this, e, t, 0), i = !oe(e) || e !== this._$AH && e !== X, i && (this._$AH = e);
164
164
  else {
165
165
  const c = e;
166
166
  let a, l;
167
- for (e = s[0], a = 0; a < s.length - 1; a++) l = X(this, c[n + a], r, a), l === Y && (l = this._$AH[a]), i ||= !re(l) || l !== this._$AH[a], l === M ? e = M : e !== M && (e += (l ?? "") + s[a + 1]), this._$AH[a] = l;
167
+ for (e = s[0], a = 0; a < s.length - 1; a++) l = Z(this, c[r + a], t, a), l === X && (l = this._$AH[a]), i ||= !oe(l) || l !== this._$AH[a], l === B ? e = B : e !== B && (e += (l ?? "") + s[a + 1]), this._$AH[a] = l;
168
168
  }
169
169
  i && !o && this.j(e);
170
170
  }
171
171
  j(e) {
172
- e === M ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
172
+ e === B ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
173
173
  }
174
174
  }
175
- class ln extends ue {
175
+ class Cn extends ge {
176
176
  constructor() {
177
177
  super(...arguments), this.type = 3;
178
178
  }
179
179
  j(e) {
180
- this.element[this.name] = e === M ? void 0 : e;
180
+ this.element[this.name] = e === B ? void 0 : e;
181
181
  }
182
182
  }
183
- class un extends ue {
183
+ class An extends ge {
184
184
  constructor() {
185
185
  super(...arguments), this.type = 4;
186
186
  }
187
187
  j(e) {
188
- this.element.toggleAttribute(this.name, !!e && e !== M);
188
+ this.element.toggleAttribute(this.name, !!e && e !== B);
189
189
  }
190
190
  }
191
- class hn extends ue {
192
- constructor(e, r, n, o, s) {
193
- super(e, r, n, o, s), this.type = 5;
191
+ class Tn extends ge {
192
+ constructor(e, t, r, o, s) {
193
+ super(e, t, r, o, s), this.type = 5;
194
194
  }
195
- _$AI(e, r = this) {
196
- if ((e = X(this, e, r, 0) ?? M) === Y) return;
197
- const n = this._$AH, o = e === M && n !== M || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, s = e !== M && (n === M || o);
198
- o && this.element.removeEventListener(this.name, this, n), s && this.element.addEventListener(this.name, this, e), this._$AH = e;
195
+ _$AI(e, t = this) {
196
+ if ((e = Z(this, e, t, 0) ?? B) === X) return;
197
+ const r = this._$AH, o = e === B && r !== B || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, s = e !== B && (r === B || o);
198
+ o && this.element.removeEventListener(this.name, this, r), s && this.element.addEventListener(this.name, this, e), this._$AH = e;
199
199
  }
200
200
  handleEvent(e) {
201
201
  typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
202
202
  }
203
203
  }
204
- class dn {
205
- constructor(e, r, n) {
206
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = n;
204
+ class En {
205
+ constructor(e, t, r) {
206
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = r;
207
207
  }
208
208
  get _$AU() {
209
209
  return this._$AM._$AU;
210
210
  }
211
211
  _$AI(e) {
212
- X(this, e);
212
+ Z(this, e);
213
213
  }
214
214
  }
215
- const fn = je.litHtmlPolyfillSupport;
216
- fn?.(oe, ie), (je.litHtmlVersions ??= []).push("3.3.1");
217
- const Ut = (t, e, r) => {
218
- const n = e;
219
- let o = n._$litPart$;
220
- return o === void 0 && (n._$litPart$ = o = new ie(e.insertBefore(ne(), null), null, void 0, {})), o._$AI(t), o;
215
+ const _n = Je.litHtmlPolyfillSupport;
216
+ _n?.(se, ae), (Je.litHtmlVersions ??= []).push("3.3.1");
217
+ const Jt = (n, e, t) => {
218
+ const r = e;
219
+ let o = r._$litPart$;
220
+ return o === void 0 && (r._$litPart$ = o = new ae(e.insertBefore(re(), null), null, void 0, {})), o._$AI(n), o;
221
221
  };
222
- const gn = { CHILD: 2 }, pn = (t) => (...e) => ({ _$litDirective$: t, values: e });
223
- class mn {
222
+ const kn = { CHILD: 2 }, xn = (n) => (...e) => ({ _$litDirective$: n, values: e });
223
+ class Rn {
224
224
  constructor(e) {
225
225
  }
226
226
  get _$AU() {
227
227
  return this._$AM._$AU;
228
228
  }
229
- _$AT(e, r, n) {
230
- this._$Ct = e, this._$AM = r, this._$Ci = n;
229
+ _$AT(e, t, r) {
230
+ this._$Ct = e, this._$AM = t, this._$Ci = r;
231
231
  }
232
- _$AS(e, r) {
233
- return this.update(e, r);
232
+ _$AS(e, t) {
233
+ return this.update(e, t);
234
234
  }
235
- update(e, r) {
236
- return this.render(...r);
235
+ update(e, t) {
236
+ return this.render(...t);
237
237
  }
238
238
  }
239
- class He extends mn {
239
+ class Ke extends Rn {
240
240
  constructor(e) {
241
- if (super(e), this.it = M, e.type !== gn.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
241
+ if (super(e), this.it = B, e.type !== kn.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
242
242
  }
243
243
  render(e) {
244
- if (e === M || e == null) return this._t = void 0, this.it = e;
245
- if (e === Y) return e;
244
+ if (e === B || e == null) return this._t = void 0, this.it = e;
245
+ if (e === X) return e;
246
246
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
247
247
  if (e === this.it) return this._t;
248
248
  this.it = e;
249
- const r = [e];
250
- return r.raw = r, this._t = { _$litType$: this.constructor.resultType, strings: r, values: [] };
249
+ const t = [e];
250
+ return t.raw = t, this._t = { _$litType$: this.constructor.resultType, strings: t, values: [] };
251
251
  }
252
252
  }
253
- He.directiveName = "unsafeHTML", He.resultType = 1;
254
- const nt = pn(He), wn = (t) => t ? ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"].some((r) => t.includes(r)) : !1, rt = async (t = {}, e) => {
255
- const r = new AbortController(), n = r.signal, o = t.isBlob || !1, s = t.isText || !1, i = t.isPostFile || !1, c = t.timeout || 6e4 * 3, a = setTimeout(() => {
256
- r.abort();
253
+ Ke.directiveName = "unsafeHTML", Ke.resultType = 1;
254
+ const at = xn(Ke), Sn = (n) => n ? ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"].some((t) => n.includes(t)) : !1, ct = async (n = {}, e) => {
255
+ const t = new AbortController(), r = t.signal, o = n.isBlob || !1, s = n.isText || !1, i = n.isPostFile || !1, c = n.timeout || 6e4 * 3, a = setTimeout(() => {
256
+ t.abort();
257
257
  }, c);
258
- let l = e?.method || t?.method || "POST", u = { ...t?.headers, ...e?.headers }, h = "", f;
259
- t?.url?.startsWith("http") ? f = new URL(t.url) : (h = window?.location?.origin || "http://localhost:51015", f = new URL(t.url, h));
258
+ let l = e?.method || n?.method || "POST", u = { ...n?.headers, ...e?.headers }, h = "", f;
259
+ n?.url?.startsWith("http") ? f = new URL(n.url) : (h = window?.location?.origin || "http://localhost:51015", f = new URL(n.url, h));
260
260
  const d = l === "GET";
261
- d && (f.search = new URLSearchParams(t.body).toString());
262
- let w;
263
- return d ? w = void 0 : i ? w = t.body : (u = {
261
+ d && (f.search = new URLSearchParams(n.body).toString());
262
+ let g;
263
+ return d ? g = void 0 : i ? g = n.body : (u = {
264
264
  "Content-Type": "application/json",
265
265
  ...u
266
- }, w = JSON.stringify(t.body)), fetch(f, {
266
+ }, g = JSON.stringify(n.body)), fetch(f, {
267
267
  method: l.toUpperCase(),
268
- signal: n,
269
- body: w,
268
+ signal: r,
269
+ body: g,
270
270
  ...e,
271
271
  headers: u
272
272
  }).then(async (p) => {
273
- const B = p.headers.get("Content-Type");
274
- return o ? await p.blob() : B && B.includes("application/json") && !s ? await p.json() : wn(B) ? {
273
+ const m = p.headers.get("Content-Type");
274
+ return o ? await p.blob() : m && m.includes("application/json") && !s ? await p.json() : Sn(m) ? {
275
275
  code: 200,
276
276
  status: p.status,
277
277
  data: await p.text()
@@ -282,17 +282,17 @@ const nt = pn(He), wn = (t) => t ? ["text/", "xml", "html", "javascript", "css",
282
282
  })).finally(() => {
283
283
  clearTimeout(a);
284
284
  });
285
- }, ot = (t) => (t.success = t.code === 200, t.showError = (e) => {
286
- !t.success && !t.noMsg && e?.();
287
- }, t), me = ({ code: t, message: e }) => ({
288
- code: t || 500,
285
+ }, lt = (n) => (n.success = n.code === 200, n.showError = (e) => {
286
+ !n.success && !n.noMsg && e?.();
287
+ }, n), be = ({ code: n, message: e }) => ({
288
+ code: n || 500,
289
289
  success: !1,
290
290
  message: e || "api request error",
291
- showError: (n) => {
291
+ showError: (r) => {
292
292
  },
293
293
  noMsg: !0
294
294
  });
295
- class Ft {
295
+ class Qt {
296
296
  adapter;
297
297
  url;
298
298
  beforeRequest;
@@ -306,7 +306,7 @@ class Ft {
306
306
  // 默认不使用ws
307
307
  qws;
308
308
  constructor(e) {
309
- this.adapter = e?.adapter || rt, this.url = e?.url || "/api/router", this.headers = e?.headers || {
309
+ this.adapter = e?.adapter || ct, this.url = e?.url || "/api/router", this.headers = e?.headers || {
310
310
  "Content-Type": "application/json"
311
311
  }, this.timeout = e?.timeout || 6e4 * 3;
312
312
  }
@@ -327,8 +327,8 @@ class Ft {
327
327
  * @param options 请求配置
328
328
  * @returns 请求结果
329
329
  */
330
- async get(e, r) {
331
- return this.post(e, r);
330
+ async get(e, t) {
331
+ return this.post(e, t);
332
332
  }
333
333
  /**
334
334
  * 发送 post 请求
@@ -338,46 +338,46 @@ class Ft {
338
338
  * @param options 请求配置
339
339
  * @returns 请求结果
340
340
  */
341
- async post(e, r) {
342
- const n = r?.url || this.url, { headers: o, adapter: s, beforeRequest: i, afterResponse: c, timeout: a, ...l } = r || {}, u = { ...this.headers, ...o }, h = s || this.adapter, f = i || this.beforeRequest, d = c || this.afterResponse, w = a || this.timeout, p = {
343
- url: n,
341
+ async post(e, t) {
342
+ const r = t?.url || this.url, { headers: o, adapter: s, beforeRequest: i, afterResponse: c, timeout: a, ...l } = t || {}, u = { ...this.headers, ...o }, h = s || this.adapter, f = i || this.beforeRequest, d = c || this.afterResponse, g = a || this.timeout, p = {
343
+ url: r,
344
344
  headers: u,
345
345
  body: e,
346
- timeout: w,
346
+ timeout: g,
347
347
  ...l
348
348
  };
349
349
  try {
350
350
  if (f && await f(p) === !1)
351
- return me({
351
+ return be({
352
352
  code: 500,
353
353
  message: "request is cancel",
354
354
  // @ts-ignore
355
355
  req: p
356
356
  });
357
- } catch (B) {
358
- return console.error("request beforeFn error", B, p), me({
357
+ } catch (m) {
358
+ return console.error("request beforeFn error", m, p), be({
359
359
  code: 500,
360
360
  message: "api request beforeFn error"
361
361
  });
362
362
  }
363
- if (this.stop && !r?.noStop) {
364
- const B = this;
365
- await new Promise((A) => {
366
- let S = 0;
367
- const k = setInterval(() => {
368
- B.stop || (clearInterval(k), A(!0)), S++, S > 30 && console.error("request stop: timeout", p.url, S);
363
+ if (this.stop && !t?.noStop) {
364
+ const m = this;
365
+ await new Promise((y) => {
366
+ let E = 0;
367
+ const w = setInterval(() => {
368
+ m.stop || (clearInterval(w), y(!0)), E++, E > 30 && console.error("request stop: timeout", p.url, E);
369
369
  }, 1e3);
370
370
  });
371
371
  }
372
- return h(p).then(async (B) => {
372
+ return h(p).then(async (m) => {
373
373
  try {
374
- return ot(B), d ? await d(B, {
374
+ return lt(m), d ? await d(m, {
375
375
  req: p,
376
- res: B,
376
+ res: m,
377
377
  fetch: s
378
- }) : B;
379
- } catch (A) {
380
- return console.error("request afterFn error", A, p), me({
378
+ }) : m;
379
+ } catch (y) {
380
+ return console.error("request afterFn error", y, p), be({
381
381
  code: 500,
382
382
  message: "api request afterFn error"
383
383
  });
@@ -398,21 +398,21 @@ class Ft {
398
398
  after(e) {
399
399
  this.afterResponse = e;
400
400
  }
401
- async fetchText(e, r) {
402
- let n = { ...r };
403
- typeof e == "string" && !n.url && (n.url = e), typeof e == "object" && (n = { ...e, ...n });
404
- const o = await rt({
401
+ async fetchText(e, t) {
402
+ let r = { ...t };
403
+ typeof e == "string" && !r.url && (r.url = e), typeof e == "object" && (r = { ...e, ...r });
404
+ const o = await ct({
405
405
  method: "GET",
406
- ...n,
406
+ ...r,
407
407
  headers: {
408
408
  ...this.headers,
409
- ...n?.headers || {}
409
+ ...r?.headers || {}
410
410
  }
411
411
  });
412
- return ot(o);
412
+ return lt(o);
413
413
  }
414
414
  }
415
- class yn {
415
+ class Mn {
416
416
  query;
417
417
  queryDefine;
418
418
  constructor(e) {
@@ -421,52 +421,52 @@ class yn {
421
421
  get chain() {
422
422
  return this.queryDefine.queryChain;
423
423
  }
424
- post(e, r) {
425
- return this.query.post(e, r);
424
+ post(e, t) {
425
+ return this.query.post(e, t);
426
426
  }
427
- get(e, r) {
428
- return this.query.get(e, r);
427
+ get(e, t) {
428
+ return this.query.get(e, t);
429
429
  }
430
430
  }
431
- const st = (t) => (t.success = t.code === 200, t.showError = (e) => {
432
- !t.success && !t.noMsg && e?.();
433
- }, t);
434
- function $(t) {
435
- return new Promise((e, r) => {
436
- t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error);
431
+ const ut = (n) => (n.success = n.code === 200, n.showError = (e) => {
432
+ !n.success && !n.noMsg && e?.();
433
+ }, n);
434
+ function L(n) {
435
+ return new Promise((e, t) => {
436
+ n.oncomplete = n.onsuccess = () => e(n.result), n.onabort = n.onerror = () => t(n.error);
437
437
  });
438
438
  }
439
- function zt(t, e) {
440
- const r = indexedDB.open(t);
441
- r.onupgradeneeded = () => r.result.createObjectStore(e);
442
- const n = $(r);
443
- return (o, s) => n.then((i) => s(i.transaction(e, o).objectStore(e)));
439
+ function Gt(n, e) {
440
+ const t = indexedDB.open(n);
441
+ t.onupgradeneeded = () => t.result.createObjectStore(e);
442
+ const r = L(t);
443
+ return (o, s) => r.then((i) => s(i.transaction(e, o).objectStore(e)));
444
444
  }
445
- let we;
446
- function I() {
447
- return we || (we = zt("keyval-store", "keyval")), we;
445
+ let Ce;
446
+ function $() {
447
+ return Ce || (Ce = Gt("keyval-store", "keyval")), Ce;
448
448
  }
449
- function Ht(t, e = I()) {
450
- return e("readonly", (r) => $(r.get(t)));
449
+ function Yt(n, e = $()) {
450
+ return e("readonly", (t) => L(t.get(n)));
451
451
  }
452
- function jt(t, e, r = I()) {
453
- return r("readwrite", (n) => (n.put(e, t), $(n.transaction)));
452
+ function Xt(n, e, t = $()) {
453
+ return t("readwrite", (r) => (r.put(e, n), L(r.transaction)));
454
454
  }
455
- function bn(t, e = I()) {
456
- return e("readwrite", (r) => (t.forEach((n) => r.put(n[1], n[0])), $(r.transaction)));
455
+ function Bn(n, e = $()) {
456
+ return e("readwrite", (t) => (n.forEach((r) => t.put(r[1], r[0])), L(t.transaction)));
457
457
  }
458
- function vn(t, e = I()) {
459
- return e("readonly", (r) => Promise.all(t.map((n) => $(r.get(n)))));
458
+ function Ln(n, e = $()) {
459
+ return e("readonly", (t) => Promise.all(n.map((r) => L(t.get(r)))));
460
460
  }
461
- function An(t, e, r = I()) {
462
- return r("readwrite", (n) => (
461
+ function In(n, e, t = $()) {
462
+ return t("readwrite", (r) => (
463
463
  // Need to create the promise manually.
464
464
  // If I try to chain promises, the transaction closes in browsers
465
465
  // that use a promise polyfill (IE10/11).
466
466
  new Promise((o, s) => {
467
- n.get(t).onsuccess = function() {
467
+ r.get(n).onsuccess = function() {
468
468
  try {
469
- n.put(e(this.result), t), o($(n.transaction));
469
+ r.put(e(this.result), n), o(L(r.transaction));
470
470
  } catch (i) {
471
471
  s(i);
472
472
  }
@@ -474,87 +474,87 @@ function An(t, e, r = I()) {
474
474
  })
475
475
  ));
476
476
  }
477
- function Vt(t, e = I()) {
478
- return e("readwrite", (r) => (r.delete(t), $(r.transaction)));
477
+ function Zt(n, e = $()) {
478
+ return e("readwrite", (t) => (t.delete(n), L(t.transaction)));
479
479
  }
480
- function Cn(t, e = I()) {
481
- return e("readwrite", (r) => (t.forEach((n) => r.delete(n)), $(r.transaction)));
480
+ function $n(n, e = $()) {
481
+ return e("readwrite", (t) => (n.forEach((r) => t.delete(r)), L(t.transaction)));
482
482
  }
483
- function Wt(t = I()) {
484
- return t("readwrite", (e) => (e.clear(), $(e.transaction)));
483
+ function en(n = $()) {
484
+ return n("readwrite", (e) => (e.clear(), L(e.transaction)));
485
485
  }
486
- function We(t, e) {
487
- return t.openCursor().onsuccess = function() {
486
+ function Ge(n, e) {
487
+ return n.openCursor().onsuccess = function() {
488
488
  this.result && (e(this.result), this.result.continue());
489
- }, $(t.transaction);
489
+ }, L(n.transaction);
490
490
  }
491
- function Tn(t = I()) {
492
- return t("readonly", (e) => {
491
+ function Pn(n = $()) {
492
+ return n("readonly", (e) => {
493
493
  if (e.getAllKeys)
494
- return $(e.getAllKeys());
495
- const r = [];
496
- return We(e, (n) => r.push(n.key)).then(() => r);
494
+ return L(e.getAllKeys());
495
+ const t = [];
496
+ return Ge(e, (r) => t.push(r.key)).then(() => t);
497
497
  });
498
498
  }
499
- function kn(t = I()) {
500
- return t("readonly", (e) => {
499
+ function qn(n = $()) {
500
+ return n("readonly", (e) => {
501
501
  if (e.getAll)
502
- return $(e.getAll());
503
- const r = [];
504
- return We(e, (n) => r.push(n.value)).then(() => r);
502
+ return L(e.getAll());
503
+ const t = [];
504
+ return Ge(e, (r) => t.push(r.value)).then(() => t);
505
505
  });
506
506
  }
507
- function En(t = I()) {
508
- return t("readonly", (e) => {
507
+ function Nn(n = $()) {
508
+ return n("readonly", (e) => {
509
509
  if (e.getAll && e.getAllKeys)
510
510
  return Promise.all([
511
- $(e.getAllKeys()),
512
- $(e.getAll())
513
- ]).then(([n, o]) => n.map((s, i) => [s, o[i]]));
514
- const r = [];
515
- return t("readonly", (n) => We(n, (o) => r.push([o.key, o.value])).then(() => r));
511
+ L(e.getAllKeys()),
512
+ L(e.getAll())
513
+ ]).then(([r, o]) => r.map((s, i) => [s, o[i]]));
514
+ const t = [];
515
+ return n("readonly", (r) => Ge(r, (o) => t.push([o.key, o.value])).then(() => t));
516
516
  });
517
517
  }
518
- var _n = /* @__PURE__ */ Object.freeze({
518
+ var Dn = /* @__PURE__ */ Object.freeze({
519
519
  __proto__: null,
520
- clear: Wt,
521
- createStore: zt,
522
- del: Vt,
523
- delMany: Cn,
524
- entries: En,
525
- get: Ht,
526
- getMany: vn,
527
- keys: Tn,
528
- promisifyRequest: $,
529
- set: jt,
530
- setMany: bn,
531
- update: An,
532
- values: kn
520
+ clear: en,
521
+ createStore: Gt,
522
+ del: Zt,
523
+ delMany: $n,
524
+ entries: Nn,
525
+ get: Yt,
526
+ getMany: Ln,
527
+ keys: Pn,
528
+ promisifyRequest: L,
529
+ set: Xt,
530
+ setMany: Bn,
531
+ update: In,
532
+ values: qn
533
533
  });
534
- class Rn {
534
+ class Un {
535
535
  storage;
536
536
  data = null;
537
537
  constructor() {
538
- this.storage = _n;
538
+ this.storage = Dn;
539
539
  }
540
540
  async get(e) {
541
- const r = await Ht(e);
542
- return this.data = r, r;
541
+ const t = await Yt(e);
542
+ return this.data = t, t;
543
543
  }
544
- async set(e, r) {
545
- this.data = r, await jt(e, r);
544
+ async set(e, t) {
545
+ this.data = t, await Xt(e, t);
546
546
  }
547
547
  async del(e) {
548
- this.data = null, await Vt(e);
548
+ this.data = null, await Zt(e);
549
549
  }
550
550
  /**
551
551
  * Clear all values in the store.
552
552
  */
553
553
  async clear() {
554
- await Wt();
554
+ await en();
555
555
  }
556
556
  }
557
- class Sn extends Rn {
557
+ class Fn extends Un {
558
558
  name;
559
559
  updatedAt;
560
560
  constructor(e) {
@@ -569,10 +569,10 @@ class Sn extends Rn {
569
569
  * @param data
570
570
  * @param opts
571
571
  */
572
- async setData(e, r) {
573
- const o = Date.now() + (r?.expireTime || 1e3 * 60 * 60 * 24 * 10), s = {
572
+ async setData(e, t) {
573
+ const o = Date.now() + (t?.expireTime || 1e3 * 60 * 60 * 24 * 10), s = {
574
574
  data: e,
575
- updatedAt: r?.updatedAt || Date.now(),
575
+ updatedAt: t?.updatedAt || Date.now(),
576
576
  expireTime: o
577
577
  };
578
578
  await super.set(this.name, s), this.updatedAt = s.updatedAt;
@@ -581,20 +581,20 @@ class Sn extends Rn {
581
581
  await super.del(this.name);
582
582
  }
583
583
  }
584
- var Bn = class {
584
+ var zn = class {
585
585
  cache;
586
586
  name;
587
587
  cacheData;
588
- constructor(t) {
589
- if (!t.cache)
588
+ constructor(n) {
589
+ if (!n.cache)
590
590
  throw new Error("cache is required");
591
- this.cache = t.cache, this.cacheData = {
591
+ this.cache = n.cache, this.cacheData = {
592
592
  loginUsers: [],
593
593
  user: void 0,
594
594
  id: void 0,
595
595
  accessToken: void 0,
596
596
  refreshToken: void 0
597
- }, this.name = t.name;
597
+ }, this.name = n.name;
598
598
  }
599
599
  /**
600
600
  * 设置缓存
@@ -602,8 +602,8 @@ var Bn = class {
602
602
  * @param value
603
603
  * @returns
604
604
  */
605
- async setValue(t) {
606
- return await this.cache.set(this.name, t), this.cacheData = t, t;
605
+ async setValue(n) {
606
+ return await this.cache.set(this.name, n), this.cacheData = n, n;
607
607
  }
608
608
  /**
609
609
  * 删除缓存
@@ -618,7 +618,7 @@ var Bn = class {
618
618
  * 初始化,设置默认值
619
619
  */
620
620
  async init() {
621
- const t = {
621
+ const n = {
622
622
  loginUsers: [],
623
623
  user: null,
624
624
  id: null,
@@ -628,43 +628,43 @@ var Bn = class {
628
628
  if (this.cache.init)
629
629
  try {
630
630
  const e = await this.cache.init();
631
- this.cacheData = e || t;
631
+ this.cacheData = e || n;
632
632
  } catch (e) {
633
633
  console.log("cacheInit error", e);
634
634
  }
635
635
  else
636
- this.cacheData = await this.getValue() || t;
636
+ this.cacheData = await this.getValue() || n;
637
637
  }
638
638
  /**
639
639
  * 设置当前用户
640
640
  * @param user
641
641
  */
642
- async setLoginUser(t) {
643
- this.cacheData.loginUsers.find((r) => r.id === t.id) && (this.cacheData.loginUsers = this.cacheData?.loginUsers?.filter((r) => r?.id && r.id !== t.id)), this.cacheData.loginUsers.push(t), this.cacheData.user = t.user, this.cacheData.id = t.id, this.cacheData.accessToken = t.accessToken, this.cacheData.refreshToken = t.refreshToken, await this.setValue(this.cacheData);
642
+ async setLoginUser(n) {
643
+ this.cacheData.loginUsers.find((t) => t.id === n.id) && (this.cacheData.loginUsers = this.cacheData?.loginUsers?.filter((t) => t?.id && t.id !== n.id)), this.cacheData.loginUsers.push(n), this.cacheData.user = n.user, this.cacheData.id = n.id, this.cacheData.accessToken = n.accessToken, this.cacheData.refreshToken = n.refreshToken, await this.setValue(this.cacheData);
644
644
  }
645
645
  getCurrentUser() {
646
- const t = this.cacheData;
647
- return Promise.resolve(t.user);
646
+ const n = this.cacheData;
647
+ return Promise.resolve(n.user);
648
648
  }
649
649
  getCurrentUserList() {
650
- return Promise.resolve(this.cacheData.loginUsers.filter((t) => t?.id));
650
+ return Promise.resolve(this.cacheData.loginUsers.filter((n) => n?.id));
651
651
  }
652
652
  getRefreshToken() {
653
- const t = this.cacheData;
654
- return Promise.resolve(t.refreshToken || "");
653
+ const n = this.cacheData;
654
+ return Promise.resolve(n.refreshToken || "");
655
655
  }
656
656
  getAccessToken() {
657
- const t = this.cacheData;
658
- return Promise.resolve(t.accessToken || "");
657
+ const n = this.cacheData;
658
+ return Promise.resolve(n.accessToken || "");
659
659
  }
660
660
  async clearCurrentUser() {
661
- const t = await this.getCurrentUser();
662
- this.cacheData.loginUsers.find((r) => r.id === t.id) && (this.cacheData.loginUsers = this.cacheData?.loginUsers?.filter((r) => r?.id && r.id !== t.id)), this.cacheData.user = void 0, this.cacheData.id = void 0, this.cacheData.accessToken = void 0, this.cacheData.refreshToken = void 0, await this.setValue(this.cacheData);
661
+ const n = await this.getCurrentUser();
662
+ this.cacheData.loginUsers.find((t) => t.id === n.id) && (this.cacheData.loginUsers = this.cacheData?.loginUsers?.filter((t) => t?.id && t.id !== n.id)), this.cacheData.user = void 0, this.cacheData.id = void 0, this.cacheData.accessToken = void 0, this.cacheData.refreshToken = void 0, await this.setValue(this.cacheData);
663
663
  }
664
664
  async clearAll() {
665
665
  this.cacheData.loginUsers = [], this.cacheData.user = void 0, this.cacheData.id = void 0, this.cacheData.accessToken = void 0, this.cacheData.refreshToken = void 0, await this.setValue(this.cacheData);
666
666
  }
667
- }, Mn = class extends yn {
667
+ }, Hn = class extends Mn {
668
668
  /**
669
669
  * query login cache, 非实际操作, 一个cache的包裹模块
670
670
  */
@@ -673,22 +673,22 @@ var Bn = class {
673
673
  load;
674
674
  storage;
675
675
  onLoad;
676
- constructor(t) {
676
+ constructor(n) {
677
677
  super({
678
- query: t?.query || new Ft()
679
- }), this.cacheStore = new Bn({ name: "login", cache: t.cache }), this.isBrowser = t?.isBrowser ?? !0, this.init(), this.onLoad = t?.onLoad, this.storage = t?.storage || localStorage;
678
+ query: n?.query || new Qt()
679
+ }), this.cacheStore = new zn({ name: "login", cache: n.cache }), this.isBrowser = n?.isBrowser ?? !0, this.init(), this.onLoad = n?.onLoad, this.storage = n?.storage || localStorage;
680
680
  }
681
- setQuery(t) {
682
- this.query = t;
681
+ setQuery(n) {
682
+ this.query = n;
683
683
  }
684
684
  async init() {
685
685
  await this.cacheStore.init(), this.load = !0, this.onLoad?.();
686
686
  }
687
- async post(t, e) {
687
+ async post(n, e) {
688
688
  try {
689
- return this.query.post({ path: "user", ...t }, e);
690
- } catch (r) {
691
- return console.log("error", r), {
689
+ return this.query.post({ path: "user", ...n }, e);
690
+ } catch (t) {
691
+ return console.log("error", t), {
692
692
  code: 400
693
693
  };
694
694
  }
@@ -698,11 +698,11 @@ var Bn = class {
698
698
  * @param data
699
699
  * @returns
700
700
  */
701
- async login(t) {
702
- const e = await this.post({ key: "login", ...t });
701
+ async login(n) {
702
+ const e = await this.post({ key: "login", ...n });
703
703
  if (e.code === 200) {
704
- const { accessToken: r, refreshToken: n } = e?.data || {};
705
- this.storage.setItem("token", r || ""), await this.beforeSetLoginUser({ accessToken: r, refreshToken: n });
704
+ const { accessToken: t, refreshToken: r } = e?.data || {};
705
+ this.storage.setItem("token", t || ""), await this.beforeSetLoginUser({ accessToken: t, refreshToken: r });
706
706
  }
707
707
  return e;
708
708
  }
@@ -711,11 +711,11 @@ var Bn = class {
711
711
  * @param data
712
712
  * @returns
713
713
  */
714
- async loginByCode(t) {
715
- const e = await this.post({ path: "sms", key: "login", data: t });
714
+ async loginByCode(n) {
715
+ const e = await this.post({ path: "sms", key: "login", data: n });
716
716
  if (e.code === 200) {
717
- const { accessToken: r, refreshToken: n } = e?.data || {};
718
- this.storage.setItem("token", r || ""), await this.beforeSetLoginUser({ accessToken: r, refreshToken: n });
717
+ const { accessToken: t, refreshToken: r } = e?.data || {};
718
+ this.storage.setItem("token", t || ""), await this.beforeSetLoginUser({ accessToken: t, refreshToken: r });
719
719
  }
720
720
  return e;
721
721
  }
@@ -723,15 +723,15 @@ var Bn = class {
723
723
  * 设置token
724
724
  * @param token
725
725
  */
726
- async setLoginToken(t) {
727
- const { accessToken: e, refreshToken: r } = t;
728
- this.storage.setItem("token", e || ""), await this.beforeSetLoginUser({ accessToken: e, refreshToken: r });
726
+ async setLoginToken(n) {
727
+ const { accessToken: e, refreshToken: t } = n;
728
+ this.storage.setItem("token", e || ""), await this.beforeSetLoginUser({ accessToken: e, refreshToken: t });
729
729
  }
730
- async loginByWechat(t) {
731
- const e = await this.post({ path: "wx", key: "open-login", code: t.code });
730
+ async loginByWechat(n) {
731
+ const e = await this.post({ path: "wx", key: "open-login", code: n.code });
732
732
  if (e.code === 200) {
733
- const { accessToken: r, refreshToken: n } = e?.data || {};
734
- this.storage.setItem("token", r || ""), await this.beforeSetLoginUser({ accessToken: r, refreshToken: n });
733
+ const { accessToken: t, refreshToken: r } = e?.data || {};
734
+ this.storage.setItem("token", t || ""), await this.beforeSetLoginUser({ accessToken: t, refreshToken: r });
735
735
  }
736
736
  return e;
737
737
  }
@@ -739,26 +739,26 @@ var Bn = class {
739
739
  * 检测微信登录,登陆成功后,调用onSuccess,否则调用onError
740
740
  * @param param0
741
741
  */
742
- async checkWechat({ onSuccess: t, onError: e }) {
743
- const r = new URL(window.location.href), n = r.searchParams.get("code"), o = r.searchParams.get("state");
744
- if (n && o) {
745
- const s = await this.loginByWechat({ code: n });
746
- s.code === 200 ? t?.(s.data) : e?.(s);
742
+ async checkWechat({ onSuccess: n, onError: e }) {
743
+ const t = new URL(window.location.href), r = t.searchParams.get("code"), o = t.searchParams.get("state");
744
+ if (r && o) {
745
+ const s = await this.loginByWechat({ code: r });
746
+ s.code === 200 ? n?.(s.data) : e?.(s);
747
747
  }
748
748
  }
749
749
  /**
750
750
  * 登陆成功,需要获取用户信息进行缓存
751
751
  * @param param0
752
752
  */
753
- async beforeSetLoginUser({ accessToken: t, refreshToken: e, check401: r }) {
754
- if (t && e) {
755
- const n = await this.getMe(t, r);
756
- if (n.code === 200) {
757
- const o = n.data;
753
+ async beforeSetLoginUser({ accessToken: n, refreshToken: e, check401: t }) {
754
+ if (n && e) {
755
+ const r = await this.getMe(n, t);
756
+ if (r.code === 200) {
757
+ const o = r.data;
758
758
  o ? this.cacheStore.setLoginUser({
759
759
  user: o,
760
760
  id: o.id,
761
- accessToken: t,
761
+ accessToken: n,
762
762
  refreshToken: e
763
763
  }) : console.error("登录失败");
764
764
  }
@@ -769,13 +769,13 @@ var Bn = class {
769
769
  * @param refreshToken
770
770
  * @returns
771
771
  */
772
- async queryRefreshToken(t) {
773
- const e = t || this.cacheStore.getRefreshToken();
774
- let r = { refreshToken: e };
772
+ async queryRefreshToken(n) {
773
+ const e = n || this.cacheStore.getRefreshToken();
774
+ let t = { refreshToken: e };
775
775
  return e ? this.post(
776
- { key: "refreshToken", data: r },
776
+ { key: "refreshToken", data: t },
777
777
  {
778
- afterResponse: async (n, o) => (st(n), n)
778
+ afterResponse: async (r, o) => (ut(r), r)
779
779
  }
780
780
  ) : (await this.cacheStore.clearCurrentUser(), {
781
781
  code: 401,
@@ -791,29 +791,29 @@ var Bn = class {
791
791
  * @param refetch
792
792
  * @returns
793
793
  */
794
- async afterCheck401ToRefreshToken(t, e, r) {
795
- const n = this;
796
- if (t?.code === 401) {
797
- const o = await n.cacheStore.getRefreshToken();
794
+ async afterCheck401ToRefreshToken(n, e, t) {
795
+ const r = this;
796
+ if (n?.code === 401) {
797
+ const o = await r.cacheStore.getRefreshToken();
798
798
  if (o) {
799
- const s = await n.queryRefreshToken(o);
799
+ const s = await r.queryRefreshToken(o);
800
800
  if (s.code === 200) {
801
801
  const { accessToken: i, refreshToken: c } = s?.data || {};
802
- if (n.storage.setItem("token", i || ""), await n.beforeSetLoginUser({ accessToken: i, refreshToken: c, check401: !1 }), r && e && e.req && e.req.url && e.fetch) {
802
+ if (r.storage.setItem("token", i || ""), await r.beforeSetLoginUser({ accessToken: i, refreshToken: c, check401: !1 }), t && e && e.req && e.req.url && e.fetch) {
803
803
  await new Promise((f) => setTimeout(f, 1500));
804
804
  const a = e.req?.url, l = e.req?.body, u = e.req?.headers, h = await e.fetch(a, {
805
805
  method: "POST",
806
806
  body: l,
807
807
  headers: { ...u, Authorization: `Bearer ${i}` }
808
808
  });
809
- return st(h), h;
809
+ return ut(h), h;
810
810
  }
811
811
  } else
812
- n.storage.removeItem("token"), await n.cacheStore.clearCurrentUser();
812
+ r.storage.removeItem("token"), await r.cacheStore.clearCurrentUser();
813
813
  return s;
814
814
  }
815
815
  }
816
- return t;
816
+ return n;
817
817
  }
818
818
  /**
819
819
  * 一个简单的401处理, 如果401,则刷新token, 如果refreshToken不存在,则返回401
@@ -824,29 +824,29 @@ var Bn = class {
824
824
  * @param opts
825
825
  * @returns
826
826
  */
827
- async run401Action(t, e, r) {
828
- const n = this, o = r?.refetch ?? !1;
829
- if (t?.code === 401) {
830
- if (n.query.stop === !0)
827
+ async run401Action(n, e, t) {
828
+ const r = this, o = t?.refetch ?? !1;
829
+ if (n?.code === 401) {
830
+ if (r.query.stop === !0)
831
831
  return { code: 500, success: !1, message: "refresh token loading..." };
832
- n.query.stop = !0;
833
- const s = await n.afterCheck401ToRefreshToken(t, e, o);
834
- return n.query.stop = !1, r?.afterCheck?.(s), s.code === 401 && r?.afterAlso401?.(s), s;
832
+ r.query.stop = !0;
833
+ const s = await r.afterCheck401ToRefreshToken(n, e, o);
834
+ return r.query.stop = !1, t?.afterCheck?.(s), s.code === 401 && t?.afterAlso401?.(s), s;
835
835
  } else
836
- return t;
836
+ return n;
837
837
  }
838
838
  /**
839
839
  * 获取用户信息
840
840
  * @param token
841
841
  * @returns
842
842
  */
843
- async getMe(t, e = !0) {
844
- const r = t || this.storage.getItem("token"), n = this;
845
- return n.post(
843
+ async getMe(n, e = !0) {
844
+ const t = n || this.storage.getItem("token"), r = this;
845
+ return r.post(
846
846
  { key: "me" },
847
847
  {
848
- beforeRequest: async (o) => (o.headers && (o.headers.Authorization = `Bearer ${r}`), o),
849
- afterResponse: async (o, s) => o?.code === 401 && e && !t ? await n.afterCheck401ToRefreshToken(o, s) : o
848
+ beforeRequest: async (o) => (o.headers && (o.headers.Authorization = `Bearer ${t}`), o),
849
+ afterResponse: async (o, s) => o?.code === 401 && e && !n ? await r.afterCheck401ToRefreshToken(o, s) : o
850
850
  }
851
851
  );
852
852
  }
@@ -855,8 +855,8 @@ var Bn = class {
855
855
  * @returns
856
856
  */
857
857
  async checkLocalUser() {
858
- const t = await this.cacheStore.getCurrentUser();
859
- return t || null;
858
+ const n = await this.cacheStore.getCurrentUser();
859
+ return n || null;
860
860
  }
861
861
  /**
862
862
  * 检查本地token是否存在,简单的判断是否已经属于登陆状态
@@ -870,32 +870,32 @@ var Bn = class {
870
870
  * @param username
871
871
  * @returns
872
872
  */
873
- async postSwitchUser(t) {
874
- return this.post({ key: "switchCheck", data: { username: t } });
873
+ async postSwitchUser(n) {
874
+ return this.post({ key: "switchCheck", data: { username: n } });
875
875
  }
876
876
  /**
877
877
  * 切换用户
878
878
  * @param username
879
879
  * @returns
880
880
  */
881
- async switchUser(t) {
882
- const r = (await this.cacheStore.getCurrentUserList()).find((o) => o.user.username === t);
883
- if (r)
884
- return this.storage.setItem("token", r.accessToken || ""), await this.beforeSetLoginUser({ accessToken: r.accessToken, refreshToken: r.refreshToken }), {
881
+ async switchUser(n) {
882
+ const t = (await this.cacheStore.getCurrentUserList()).find((o) => o.user.username === n);
883
+ if (t)
884
+ return this.storage.setItem("token", t.accessToken || ""), await this.beforeSetLoginUser({ accessToken: t.accessToken, refreshToken: t.refreshToken }), {
885
885
  code: 200,
886
886
  data: {
887
- accessToken: r.accessToken,
888
- refreshToken: r.refreshToken
887
+ accessToken: t.accessToken,
888
+ refreshToken: t.refreshToken
889
889
  },
890
890
  success: !0,
891
891
  message: "切换用户成功"
892
892
  };
893
- const n = await this.postSwitchUser(t);
894
- if (n.code === 200) {
895
- const { accessToken: o, refreshToken: s } = n?.data || {};
893
+ const r = await this.postSwitchUser(n);
894
+ if (r.code === 200) {
895
+ const { accessToken: o, refreshToken: s } = r?.data || {};
896
896
  this.storage.setItem("token", o || ""), await this.beforeSetLoginUser({ accessToken: o, refreshToken: s });
897
897
  }
898
- return n;
898
+ return r;
899
899
  }
900
900
  /**
901
901
  * 退出登陆,去掉token, 并删除缓存
@@ -903,7 +903,7 @@ var Bn = class {
903
903
  */
904
904
  async logout() {
905
905
  this.storage.removeItem("token");
906
- const e = (await this.cacheStore.getCurrentUserList()).map((r) => r?.accessToken).filter(Boolean);
906
+ const e = (await this.cacheStore.getCurrentUserList()).map((t) => t?.accessToken).filter(Boolean);
907
907
  return this.cacheStore.delValue(), this.post({ key: "logout", data: { tokens: e } });
908
908
  }
909
909
  /**
@@ -911,18 +911,18 @@ var Bn = class {
911
911
  * @param username
912
912
  * @returns
913
913
  */
914
- async hasUser(t) {
914
+ async hasUser(n) {
915
915
  const e = this;
916
916
  return this.post(
917
917
  {
918
918
  path: "org",
919
919
  key: "hasUser",
920
920
  data: {
921
- username: t
921
+ username: n
922
922
  }
923
923
  },
924
924
  {
925
- afterResponse: async (r, n) => r?.code === 401 ? await e.afterCheck401ToRefreshToken(r, n, !0) : r
925
+ afterResponse: async (t, r) => t?.code === 401 ? await e.afterCheck401ToRefreshToken(t, r, !0) : t
926
926
  }
927
927
  );
928
928
  }
@@ -931,41 +931,41 @@ var Bn = class {
931
931
  * @param token
932
932
  * @returns
933
933
  */
934
- async checkLoginStatus(t) {
934
+ async checkLoginStatus(n) {
935
935
  const e = await this.post({
936
936
  path: "user",
937
937
  key: "checkLoginStatus",
938
- loginToken: t
938
+ loginToken: n
939
939
  });
940
940
  if (e.code === 200) {
941
- const r = e.data?.accessToken;
942
- return this.storage.setItem("token", r || ""), await this.beforeSetLoginUser({ accessToken: r, refreshToken: e.data?.refreshToken }), e;
941
+ const t = e.data?.accessToken;
942
+ return this.storage.setItem("token", t || ""), await this.beforeSetLoginUser({ accessToken: t, refreshToken: e.data?.refreshToken }), e;
943
943
  }
944
944
  return !1;
945
945
  }
946
946
  /**
947
947
  * 使用web登录,创建url地址, 需要MD5和jsonwebtoken
948
948
  */
949
- loginWithWeb(t, { MD5: e, jsonwebtoken: r }) {
950
- const n = Math.random().toString(36).substring(2, 15), o = Date.now(), s = "xiao" + n, i = e(`${s}${o}`).toString(), c = r.sign({ randomId: n, timestamp: o, sign: i }, s, {
949
+ loginWithWeb(n, { MD5: e, jsonwebtoken: t }) {
950
+ const r = Math.random().toString(36).substring(2, 15), o = Date.now(), s = "xiao" + r, i = e(`${s}${o}`).toString(), c = t.sign({ randomId: r, timestamp: o, sign: i }, s, {
951
951
  // 10分钟过期
952
952
  expiresIn: 600
953
953
  // 10分钟
954
954
  });
955
- return { url: `${t}/api/router?path=user&key=webLogin&p&loginToken=${c}&sign=${i}&randomId=${n}`, token: c, tokenSecret: s };
955
+ return { url: `${n}/api/router?path=user&key=webLogin&p&loginToken=${c}&sign=${i}&randomId=${r}`, token: c, tokenSecret: s };
956
956
  }
957
- }, xn = class extends Mn {
958
- constructor(t) {
957
+ }, jn = class extends Hn {
958
+ constructor(n) {
959
959
  super({
960
- ...t,
961
- cache: new Sn("login")
960
+ ...n,
961
+ cache: new Fn("login")
962
962
  });
963
963
  }
964
964
  };
965
- const $n = new Ft(), N = new xn({
966
- query: $n
965
+ const Vn = new Qt(), U = new jn({
966
+ query: Vn
967
967
  });
968
- class Ln extends HTMLElement {
968
+ class On extends HTMLElement {
969
969
  options;
970
970
  timer = null;
971
971
  constructor() {
@@ -983,7 +983,7 @@ class Ln extends HTMLElement {
983
983
  this.options = { ...this.options, ...e }, this.render();
984
984
  }
985
985
  render() {
986
- const { type: e, message: r, closable: n } = this.options, s = L`
986
+ const { type: e, message: t, closable: r } = this.options, s = I`
987
987
  <style>
988
988
  :host {
989
989
  display: block;
@@ -1117,19 +1117,19 @@ class Ln extends HTMLElement {
1117
1117
  case "error":
1118
1118
  return "✕";
1119
1119
  case "loading":
1120
- return L`<div class="loading-spinner"></div>`;
1120
+ return I`<div class="loading-spinner"></div>`;
1121
1121
  default:
1122
1122
  return "";
1123
1123
  }
1124
1124
  })()}
1125
1125
  </div>
1126
- <div class="message-content">${r}</div>
1127
- ${n ? L`
1126
+ <div class="message-content">${t}</div>
1127
+ ${r ? I`
1128
1128
  <button class="message-close" @click=${() => this.remove()}>&times;</button>
1129
1129
  ` : ""}
1130
1130
  </div>
1131
1131
  `;
1132
- Ut(s, this), e !== "loading" && this.options.duration && this.options.duration > 0 && this.setTimer();
1132
+ Jt(s, this), e !== "loading" && this.options.duration && this.options.duration > 0 && this.setTimer();
1133
1133
  }
1134
1134
  setTimer() {
1135
1135
  this.timer && clearTimeout(this.timer), this.timer = window.setTimeout(() => {
@@ -1145,20 +1145,20 @@ class Ln extends HTMLElement {
1145
1145
  this.timer && (clearTimeout(this.timer), this.timer = null);
1146
1146
  }
1147
1147
  }
1148
- customElements.define("kv-message", Ln);
1149
- class G {
1148
+ customElements.define("kv-message", On);
1149
+ class Y {
1150
1150
  static instance;
1151
1151
  container = null;
1152
1152
  defaultPosition = "center";
1153
1153
  static getInstance() {
1154
- return G.instance || (G.instance = new G()), G.instance;
1154
+ return Y.instance || (Y.instance = new Y()), Y.instance;
1155
1155
  }
1156
1156
  setDefaultPosition(e) {
1157
1157
  this.defaultPosition = e;
1158
1158
  }
1159
1159
  getContainer(e) {
1160
- const r = e || this.defaultPosition;
1161
- return this.container || (this.container = document.getElementById("messages"), this.container || (this.container = document.createElement("div"), this.container.id = "messages", r === "center" ? this.container.style.cssText = `
1160
+ const t = e || this.defaultPosition;
1161
+ return this.container || (this.container = document.getElementById("messages"), this.container || (this.container = document.createElement("div"), this.container.id = "messages", t === "center" ? this.container.style.cssText = `
1162
1162
  position: fixed;
1163
1163
  top: 20px;
1164
1164
  left: 50%;
@@ -1182,173 +1182,255 @@ class G {
1182
1182
  `, document.body.appendChild(this.container))), this.container;
1183
1183
  }
1184
1184
  show(e) {
1185
- const r = this.getContainer(e.position), n = document.createElement("kv-message");
1186
- return n.setOptions(e), n.style.cssText = "pointer-events: auto;", r.appendChild(n), n;
1185
+ const t = this.getContainer(e.position), r = document.createElement("kv-message");
1186
+ return r.setOptions(e), r.style.cssText = "pointer-events: auto;", t.appendChild(r), r;
1187
1187
  }
1188
- success(e, r) {
1188
+ success(e, t) {
1189
1189
  return this.show({
1190
1190
  type: "success",
1191
1191
  message: e,
1192
- duration: r?.duration || 2e3,
1193
- position: r?.position,
1194
- closable: r?.closable
1192
+ duration: t?.duration || 2e3,
1193
+ position: t?.position,
1194
+ closable: t?.closable
1195
1195
  });
1196
1196
  }
1197
- error(e, r) {
1197
+ error(e, t) {
1198
1198
  return this.show({
1199
1199
  type: "error",
1200
1200
  message: e,
1201
- duration: r?.duration || 3e3,
1202
- position: r?.position,
1203
- closable: r?.closable
1201
+ duration: t?.duration || 3e3,
1202
+ position: t?.position,
1203
+ closable: t?.closable
1204
1204
  });
1205
1205
  }
1206
- loading(e, r) {
1206
+ loading(e, t) {
1207
1207
  return this.show({
1208
1208
  type: "loading",
1209
1209
  message: e,
1210
1210
  duration: 0,
1211
- position: r?.position,
1212
- closable: r?.closable
1211
+ position: t?.position,
1212
+ closable: t?.closable
1213
1213
  });
1214
1214
  }
1215
1215
  remove(e) {
1216
1216
  e.remove();
1217
1217
  }
1218
1218
  clear() {
1219
- this.getContainer().querySelectorAll("kv-message").forEach((n) => {
1220
- n.remove();
1219
+ this.getContainer().querySelectorAll("kv-message").forEach((r) => {
1220
+ r.remove();
1221
1221
  });
1222
1222
  }
1223
1223
  }
1224
- const Ot = () => G.getInstance();
1225
- window.createMessage = Ot;
1226
- const U = Ot(), se = () => {
1227
- console.log("重定向到首页");
1228
- const t = window.location.href, r = new URL(t).searchParams.get("redirect");
1229
- if (r) {
1230
- const n = decodeURIComponent(r);
1231
- window.open(n, "_self");
1232
- } else
1233
- window.open("/root/home", "_self");
1234
- }, In = async (t) => {
1235
- const { loginMethod: e, data: r } = t;
1224
+ const tn = () => Y.getInstance();
1225
+ window.createMessage = tn;
1226
+ let Wn = class {
1227
+ events = /* @__PURE__ */ new Map();
1228
+ /**
1229
+ * 监听事件
1230
+ * @param type 事件类型
1231
+ * @param handler 事件处理函数
1232
+ */
1233
+ on(e, t) {
1234
+ this.events.has(e) || this.events.set(e, /* @__PURE__ */ new Set()), this.events.get(e).add(t);
1235
+ }
1236
+ /**
1237
+ * 移除事件监听器
1238
+ * @param type 事件类型
1239
+ * @param handler 事件处理函数 (可选,如果不提供则移除该类型的所有监听器)
1240
+ */
1241
+ off(e, t) {
1242
+ this.events.has(e) && (t ? (this.events.get(e).delete(t), this.events.get(e).size === 0 && this.events.delete(e)) : this.events.delete(e));
1243
+ }
1244
+ /**
1245
+ * 触发事件
1246
+ * @param event 事件对象,包含 type 和 data
1247
+ */
1248
+ emit(e) {
1249
+ const { type: t } = e;
1250
+ if (!this.events.has(t))
1251
+ return;
1252
+ this.events.get(t).forEach((o) => {
1253
+ try {
1254
+ o(e);
1255
+ } catch (s) {
1256
+ console.error(`Error in event handler for type "${t}":`, s);
1257
+ }
1258
+ });
1259
+ }
1260
+ /**
1261
+ * 触发事件(简化版本,直接传递type和data)
1262
+ * @param type 事件类型
1263
+ * @param data 事件数据
1264
+ */
1265
+ emitSimple(e, t) {
1266
+ this.emit({ type: e, data: t });
1267
+ }
1268
+ /**
1269
+ * 清空所有事件监听器
1270
+ */
1271
+ clear() {
1272
+ this.events.clear();
1273
+ }
1274
+ /**
1275
+ * 获取指定类型的监听器数量
1276
+ * @param type 事件类型
1277
+ * @returns 监听器数量
1278
+ */
1279
+ listenerCount(e) {
1280
+ return this.events.get(e)?.size || 0;
1281
+ }
1282
+ /**
1283
+ * 获取所有事件类型
1284
+ * @returns 事件类型数组
1285
+ */
1286
+ eventNames() {
1287
+ return Array.from(this.events.keys());
1288
+ }
1289
+ /**
1290
+ * 检查是否有指定类型的监听器
1291
+ * @param type 事件类型
1292
+ * @returns 是否有监听器
1293
+ */
1294
+ hasListeners(e) {
1295
+ return this.events.has(e) && this.events.get(e).size > 0;
1296
+ }
1297
+ /**
1298
+ * 只监听一次事件
1299
+ * @param type 事件类型
1300
+ * @param handler 事件处理函数
1301
+ */
1302
+ once(e, t) {
1303
+ const r = (o) => {
1304
+ t(o), this.off(e, r);
1305
+ };
1306
+ this.on(e, r);
1307
+ }
1308
+ };
1309
+ const nn = new Wn(), Kn = (n) => nn.emit(n), F = tn(), ie = () => {
1310
+ const n = window.location.href, t = new URL(n).searchParams.get("redirect");
1311
+ if (t) {
1312
+ const r = decodeURIComponent(t);
1313
+ window.open(r, "_self");
1314
+ }
1315
+ Kn({ type: "login-success", data: {} });
1316
+ }, Jn = async (n) => {
1317
+ const { loginMethod: e, data: t } = n;
1236
1318
  switch (e) {
1237
1319
  case "password":
1238
- await Pn(r);
1320
+ await Qn(t);
1239
1321
  break;
1240
1322
  case "phone":
1241
- await qn(r);
1323
+ await Gn(t);
1242
1324
  break;
1243
1325
  case "wechat-mp":
1244
- await Nn(r);
1326
+ await Xn(t);
1245
1327
  break;
1246
1328
  case "wechat":
1247
- await Dn(r);
1329
+ await Yn(t);
1248
1330
  break;
1249
1331
  default:
1250
1332
  console.warn("未知的登录方式:", e);
1251
1333
  }
1252
- }, Pn = async (t) => {
1253
- console.log("使用用户名密码登录:", t);
1334
+ }, Qn = async (n) => {
1335
+ console.log("使用用户名密码登录:", n);
1254
1336
  let e = !0;
1255
- if (await N.checkLocalToken() && (await N.checkLocalUser())?.username === t?.username && (await N.getMe()).code === 200 && (e = !1, console.log("已登录,跳过登录步骤"), U.success("已登录")), !e) {
1256
- se();
1337
+ if (await U.checkLocalToken() && (await U.checkLocalUser())?.username === n?.username && (await U.getMe()).code === 200 && (e = !1, console.log("已登录,跳过登录步骤"), F.success("已登录")), !e) {
1338
+ ie();
1257
1339
  return;
1258
1340
  }
1259
- const n = await N.login({
1260
- username: t.username,
1261
- password: t.password
1341
+ const r = await U.login({
1342
+ username: n.username,
1343
+ password: n.password
1262
1344
  });
1263
- n.code === 200 ? (console.log("登录成功"), U.success("登录成功"), se()) : U.error(`登录失败: ${n.message}`);
1264
- }, qn = async (t) => {
1265
- console.log("使用手机号登录:", t);
1266
- }, Dn = async (t) => {
1267
- console.log("使用微信登录:", t);
1268
- }, Nn = async (t) => {
1269
- console.log("使用微信公众号登录:", t);
1270
- }, Un = () => {
1271
- const t = new URL(window.location.href);
1272
- t.searchParams.delete("code"), t.searchParams.delete("state"), window.history.replaceState({}, document.title, t.toString());
1273
- }, Fn = async () => {
1274
- const t = new URL(window.location.href), e = t.searchParams.get("code");
1275
- if (t.searchParams.get("state")?.includes?.("-") || !e)
1345
+ r.code === 200 ? (console.log("登录成功"), F.success("登录成功"), ie()) : F.error(`登录失败: ${r.message}`);
1346
+ }, Gn = async (n) => {
1347
+ console.log("使用手机号登录:", n);
1348
+ }, Yn = async (n) => {
1349
+ console.log("使用微信登录:", n);
1350
+ }, Xn = async (n) => {
1351
+ console.log("使用微信公众号登录:", n);
1352
+ }, Zn = () => {
1353
+ const n = new URL(window.location.href);
1354
+ n.searchParams.delete("code"), n.searchParams.delete("state"), window.history.replaceState({}, document.title, n.toString());
1355
+ }, er = async () => {
1356
+ const n = new URL(window.location.href), e = n.searchParams.get("code");
1357
+ if (n.searchParams.get("state")?.includes?.("-") || !e)
1276
1358
  return;
1277
- const n = await N.loginByWechat({ code: e });
1278
- n.code === 200 ? (U.success("登录成功"), se()) : (U.error(n.message || "登录失败"), Un());
1279
- }, zn = async () => {
1280
- const t = new URL(window.location.href), e = t.searchParams.get("state"), [r, n] = e ? e.split("-") : [null, null];
1281
- if (console.log("检查微信公众号登录流程:", r, n, e), r === "1")
1282
- jn();
1283
- else if (r === "2") {
1284
- const o = t.searchParams.get("code"), s = await N.post({
1359
+ const r = await U.loginByWechat({ code: e });
1360
+ r.code === 200 ? (F.success("登录成功"), ie()) : (F.error(r.message || "登录失败"), Zn());
1361
+ }, tr = async () => {
1362
+ const n = new URL(window.location.href), e = n.searchParams.get("state"), [t, r] = e ? e.split("-") : [null, null];
1363
+ if (console.log("检查微信公众号登录流程:", t, r, e), t === "1")
1364
+ rr();
1365
+ else if (t === "2") {
1366
+ const o = n.searchParams.get("code"), s = await U.post({
1285
1367
  path: "wx",
1286
1368
  key: "mplogin",
1287
- state: n,
1369
+ state: r,
1288
1370
  code: o
1289
1371
  });
1290
- s.code === 200 ? U.success("登录成功") : U.error(s.message || "登录失败"), Jt();
1372
+ s.code === 200 ? F.success("登录成功") : F.error(s.message || "登录失败"), rn();
1291
1373
  }
1292
- }, Hn = () => {
1293
- const t = navigator.userAgent.toLowerCase();
1294
- return /micromessenger/i.test(t);
1295
- }, Jt = (t = 2e3) => {
1296
- if (!Hn()) {
1374
+ }, nr = () => {
1375
+ const n = navigator.userAgent.toLowerCase();
1376
+ return /micromessenger/i.test(n);
1377
+ }, rn = (n = 2e3) => {
1378
+ if (!nr()) {
1297
1379
  setTimeout(() => {
1298
1380
  window.close();
1299
- }, t);
1381
+ }, n);
1300
1382
  return;
1301
1383
  }
1302
1384
  window.WeixinJSBridge ? setTimeout(() => {
1303
1385
  window.WeixinJSBridge.call("closeWindow");
1304
- }, t) : setTimeout(() => {
1386
+ }, n) : setTimeout(() => {
1305
1387
  window.close();
1306
- }, t);
1307
- }, jn = async () => {
1308
- const t = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect", e = Xt, r = new URL(window.location.href), n = r.searchParams.get("state");
1309
- let [o, s] = n ? n.split("-") : [null, null];
1310
- const i = new URL(r.pathname, r.origin);
1388
+ }, n);
1389
+ }, rr = async () => {
1390
+ const n = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect", e = dn, t = new URL(window.location.href), r = t.searchParams.get("state");
1391
+ let [o, s] = r ? r.split("-") : [null, null];
1392
+ const i = new URL(t.pathname, t.origin);
1311
1393
  s = "2-" + s;
1312
1394
  const c = encodeURIComponent(i.toString());
1313
1395
  document.body.innerHTML = "<p>正在准备跳转到微信公众号授权页面...</p>";
1314
1396
  const a = "snsapi_userinfo";
1315
1397
  if (!s) {
1316
- alert("Invalid state. Please try again later."), Jt();
1398
+ alert("Invalid state. Please try again later."), rn();
1317
1399
  return;
1318
1400
  }
1319
- const l = t.replace("APPID", e).replace("REDIRECT_URI", c).replace("SCOPE", a).replace("STATE", s);
1401
+ const l = n.replace("APPID", e).replace("REDIRECT_URI", c).replace("SCOPE", a).replace("STATE", s);
1320
1402
  setTimeout(() => {
1321
1403
  window.location.href = l;
1322
1404
  }, 100);
1323
1405
  };
1324
1406
  setTimeout(() => {
1325
- zn();
1407
+ tr();
1326
1408
  }, 100);
1327
- const Vn = async () => {
1328
- const t = await N.post({
1409
+ const or = async () => {
1410
+ const n = await U.post({
1329
1411
  path: "wx",
1330
1412
  key: "get-qrcode-ticket"
1331
1413
  });
1332
- return t.code !== 200 ? (U.error("获取二维码失败"), null) : t?.data;
1333
- }, Wn = (t) => {
1414
+ return n.code !== 200 ? (F.error("获取二维码失败"), null) : n?.data;
1415
+ }, sr = (n) => {
1334
1416
  let e = !0;
1335
- const r = async () => {
1336
- const s = await N.post({
1417
+ const t = async () => {
1418
+ const s = await U.post({
1337
1419
  path: "wx",
1338
1420
  key: "check-qrcode-login",
1339
- payload: { ticket: t }
1421
+ payload: { ticket: n }
1340
1422
  });
1341
- s.code === 200 ? (U.success("登录成功"), clearTimeout(n), se()) : (s.code === 401 ? console.log("等待扫码登录...") : console.log("扫码登录状态:", s), e && setTimeout(r, 2e3));
1342
- }, n = setTimeout(r, 2e3);
1423
+ s.code === 200 ? (F.success("登录成功"), clearTimeout(r), ie()) : (s.code === 401 ? console.log("等待扫码登录...") : console.log("扫码登录状态:", s), e && setTimeout(t, 2e3));
1424
+ }, r = setTimeout(t, 2e3);
1343
1425
  return () => {
1344
- console.log("停止检测扫码登录状态"), clearTimeout(n), e = !1;
1426
+ console.log("停止检测扫码登录状态"), clearTimeout(r), e = !1;
1345
1427
  };
1346
- }, it = async (t) => {
1347
- let e = t?.redirect_uri;
1348
- const { appid: r } = t || {};
1428
+ }, ht = async (n) => {
1429
+ let e = n?.redirect_uri;
1430
+ const { appid: t } = n || {};
1349
1431
  e || (e = window.location.href);
1350
- const n = new URL(e);
1351
- if (n.searchParams.delete("code"), n.searchParams.delete("state"), e = n.toString(), console.log("redirect_uri", e), !r) {
1432
+ const r = new URL(e);
1433
+ if (r.searchParams.delete("code"), r.searchParams.delete("state"), e = r.toString(), console.log("redirect_uri", e), !t) {
1352
1434
  console.error("appid is not cant be empty");
1353
1435
  return;
1354
1436
  }
@@ -1356,7 +1438,7 @@ const Vn = async () => {
1356
1438
  self_redirect: !1,
1357
1439
  id: "weixinLogin",
1358
1440
  // 需要显示的容器id
1359
- appid: r,
1441
+ appid: t,
1360
1442
  // 微信开放平台appid wx*******
1361
1443
  scope: "snsapi_login",
1362
1444
  // 网页默认即可 snsapi_userinfo
@@ -1375,31 +1457,31 @@ const Vn = async () => {
1375
1457
  }
1376
1458
  return o;
1377
1459
  };
1378
- function On(t) {
1460
+ function ir(n) {
1379
1461
  const e = document.createElement("script");
1380
1462
  if (e.type = "text/javascript", e.src = "//res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js", e.id = "weixinLogin-js", document.getElementById("weixinLogin-js")) {
1381
- it(t);
1463
+ ht(n);
1382
1464
  return;
1383
1465
  }
1384
- const r = document.body.appendChild(e);
1385
- r.onload = function() {
1386
- it(t);
1466
+ const t = document.body.appendChild(e);
1467
+ t.onload = function() {
1468
+ ht(n);
1387
1469
  };
1388
1470
  }
1389
- function Jn(t) {
1390
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1471
+ function ar(n) {
1472
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
1391
1473
  }
1392
- var Q = {}, ye, at;
1393
- function Kn() {
1394
- return at || (at = 1, ye = function() {
1474
+ var G = {}, Ae, dt;
1475
+ function cr() {
1476
+ return dt || (dt = 1, Ae = function() {
1395
1477
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
1396
- }), ye;
1478
+ }), Ae;
1397
1479
  }
1398
- var be = {}, z = {}, ct;
1399
- function O() {
1400
- if (ct) return z;
1401
- ct = 1;
1402
- let t;
1480
+ var Te = {}, H = {}, ft;
1481
+ function K() {
1482
+ if (ft) return H;
1483
+ ft = 1;
1484
+ let n;
1403
1485
  const e = [
1404
1486
  0,
1405
1487
  // Not used
@@ -1444,121 +1526,121 @@ function O() {
1444
1526
  3532,
1445
1527
  3706
1446
1528
  ];
1447
- return z.getSymbolSize = function(n) {
1448
- if (!n) throw new Error('"version" cannot be null or undefined');
1449
- if (n < 1 || n > 40) throw new Error('"version" should be in range from 1 to 40');
1450
- return n * 4 + 17;
1451
- }, z.getSymbolTotalCodewords = function(n) {
1452
- return e[n];
1453
- }, z.getBCHDigit = function(r) {
1454
- let n = 0;
1455
- for (; r !== 0; )
1456
- n++, r >>>= 1;
1457
- return n;
1458
- }, z.setToSJISFunction = function(n) {
1459
- if (typeof n != "function")
1529
+ return H.getSymbolSize = function(r) {
1530
+ if (!r) throw new Error('"version" cannot be null or undefined');
1531
+ if (r < 1 || r > 40) throw new Error('"version" should be in range from 1 to 40');
1532
+ return r * 4 + 17;
1533
+ }, H.getSymbolTotalCodewords = function(r) {
1534
+ return e[r];
1535
+ }, H.getBCHDigit = function(t) {
1536
+ let r = 0;
1537
+ for (; t !== 0; )
1538
+ r++, t >>>= 1;
1539
+ return r;
1540
+ }, H.setToSJISFunction = function(r) {
1541
+ if (typeof r != "function")
1460
1542
  throw new Error('"toSJISFunc" is not a valid function.');
1461
- t = n;
1462
- }, z.isKanjiModeEnabled = function() {
1463
- return typeof t < "u";
1464
- }, z.toSJIS = function(n) {
1465
- return t(n);
1466
- }, z;
1467
- }
1468
- var ve = {}, lt;
1469
- function Oe() {
1470
- return lt || (lt = 1, (function(t) {
1471
- t.L = { bit: 1 }, t.M = { bit: 0 }, t.Q = { bit: 3 }, t.H = { bit: 2 };
1472
- function e(r) {
1473
- if (typeof r != "string")
1543
+ n = r;
1544
+ }, H.isKanjiModeEnabled = function() {
1545
+ return typeof n < "u";
1546
+ }, H.toSJIS = function(r) {
1547
+ return n(r);
1548
+ }, H;
1549
+ }
1550
+ var Ee = {}, gt;
1551
+ function Ye() {
1552
+ return gt || (gt = 1, (function(n) {
1553
+ n.L = { bit: 1 }, n.M = { bit: 0 }, n.Q = { bit: 3 }, n.H = { bit: 2 };
1554
+ function e(t) {
1555
+ if (typeof t != "string")
1474
1556
  throw new Error("Param is not a string");
1475
- switch (r.toLowerCase()) {
1557
+ switch (t.toLowerCase()) {
1476
1558
  case "l":
1477
1559
  case "low":
1478
- return t.L;
1560
+ return n.L;
1479
1561
  case "m":
1480
1562
  case "medium":
1481
- return t.M;
1563
+ return n.M;
1482
1564
  case "q":
1483
1565
  case "quartile":
1484
- return t.Q;
1566
+ return n.Q;
1485
1567
  case "h":
1486
1568
  case "high":
1487
- return t.H;
1569
+ return n.H;
1488
1570
  default:
1489
- throw new Error("Unknown EC Level: " + r);
1571
+ throw new Error("Unknown EC Level: " + t);
1490
1572
  }
1491
1573
  }
1492
- t.isValid = function(n) {
1493
- return n && typeof n.bit < "u" && n.bit >= 0 && n.bit < 4;
1494
- }, t.from = function(n, o) {
1495
- if (t.isValid(n))
1496
- return n;
1574
+ n.isValid = function(r) {
1575
+ return r && typeof r.bit < "u" && r.bit >= 0 && r.bit < 4;
1576
+ }, n.from = function(r, o) {
1577
+ if (n.isValid(r))
1578
+ return r;
1497
1579
  try {
1498
- return e(n);
1580
+ return e(r);
1499
1581
  } catch {
1500
1582
  return o;
1501
1583
  }
1502
1584
  };
1503
- })(ve)), ve;
1585
+ })(Ee)), Ee;
1504
1586
  }
1505
- var Ae, ut;
1506
- function Qn() {
1507
- if (ut) return Ae;
1508
- ut = 1;
1509
- function t() {
1587
+ var _e, mt;
1588
+ function lr() {
1589
+ if (mt) return _e;
1590
+ mt = 1;
1591
+ function n() {
1510
1592
  this.buffer = [], this.length = 0;
1511
1593
  }
1512
- return t.prototype = {
1594
+ return n.prototype = {
1513
1595
  get: function(e) {
1514
- const r = Math.floor(e / 8);
1515
- return (this.buffer[r] >>> 7 - e % 8 & 1) === 1;
1596
+ const t = Math.floor(e / 8);
1597
+ return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
1516
1598
  },
1517
- put: function(e, r) {
1518
- for (let n = 0; n < r; n++)
1519
- this.putBit((e >>> r - n - 1 & 1) === 1);
1599
+ put: function(e, t) {
1600
+ for (let r = 0; r < t; r++)
1601
+ this.putBit((e >>> t - r - 1 & 1) === 1);
1520
1602
  },
1521
1603
  getLengthInBits: function() {
1522
1604
  return this.length;
1523
1605
  },
1524
1606
  putBit: function(e) {
1525
- const r = Math.floor(this.length / 8);
1526
- this.buffer.length <= r && this.buffer.push(0), e && (this.buffer[r] |= 128 >>> this.length % 8), this.length++;
1607
+ const t = Math.floor(this.length / 8);
1608
+ this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
1527
1609
  }
1528
- }, Ae = t, Ae;
1610
+ }, _e = n, _e;
1529
1611
  }
1530
- var Ce, ht;
1531
- function Gn() {
1532
- if (ht) return Ce;
1533
- ht = 1;
1534
- function t(e) {
1612
+ var ke, pt;
1613
+ function ur() {
1614
+ if (pt) return ke;
1615
+ pt = 1;
1616
+ function n(e) {
1535
1617
  if (!e || e < 1)
1536
1618
  throw new Error("BitMatrix size must be defined and greater than 0");
1537
1619
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
1538
1620
  }
1539
- return t.prototype.set = function(e, r, n, o) {
1540
- const s = e * this.size + r;
1541
- this.data[s] = n, o && (this.reservedBit[s] = !0);
1542
- }, t.prototype.get = function(e, r) {
1543
- return this.data[e * this.size + r];
1544
- }, t.prototype.xor = function(e, r, n) {
1545
- this.data[e * this.size + r] ^= n;
1546
- }, t.prototype.isReserved = function(e, r) {
1547
- return this.reservedBit[e * this.size + r];
1548
- }, Ce = t, Ce;
1549
- }
1550
- var Te = {}, dt;
1551
- function Yn() {
1552
- return dt || (dt = 1, (function(t) {
1553
- const e = O().getSymbolSize;
1554
- t.getRowColCoords = function(n) {
1555
- if (n === 1) return [];
1556
- const o = Math.floor(n / 7) + 2, s = e(n), i = s === 145 ? 26 : Math.ceil((s - 13) / (2 * o - 2)) * 2, c = [s - 7];
1621
+ return n.prototype.set = function(e, t, r, o) {
1622
+ const s = e * this.size + t;
1623
+ this.data[s] = r, o && (this.reservedBit[s] = !0);
1624
+ }, n.prototype.get = function(e, t) {
1625
+ return this.data[e * this.size + t];
1626
+ }, n.prototype.xor = function(e, t, r) {
1627
+ this.data[e * this.size + t] ^= r;
1628
+ }, n.prototype.isReserved = function(e, t) {
1629
+ return this.reservedBit[e * this.size + t];
1630
+ }, ke = n, ke;
1631
+ }
1632
+ var xe = {}, wt;
1633
+ function hr() {
1634
+ return wt || (wt = 1, (function(n) {
1635
+ const e = K().getSymbolSize;
1636
+ n.getRowColCoords = function(r) {
1637
+ if (r === 1) return [];
1638
+ const o = Math.floor(r / 7) + 2, s = e(r), i = s === 145 ? 26 : Math.ceil((s - 13) / (2 * o - 2)) * 2, c = [s - 7];
1557
1639
  for (let a = 1; a < o - 1; a++)
1558
1640
  c[a] = c[a - 1] - i;
1559
1641
  return c.push(6), c.reverse();
1560
- }, t.getPositions = function(n) {
1561
- const o = [], s = t.getRowColCoords(n), i = s.length;
1642
+ }, n.getPositions = function(r) {
1643
+ const o = [], s = n.getRowColCoords(r), i = s.length;
1562
1644
  for (let c = 0; c < i; c++)
1563
1645
  for (let a = 0; a < i; a++)
1564
1646
  c === 0 && a === 0 || // top-left
@@ -1566,15 +1648,15 @@ function Yn() {
1566
1648
  c === i - 1 && a === 0 || o.push([s[c], s[a]]);
1567
1649
  return o;
1568
1650
  };
1569
- })(Te)), Te;
1651
+ })(xe)), xe;
1570
1652
  }
1571
- var ke = {}, ft;
1572
- function Xn() {
1573
- if (ft) return ke;
1574
- ft = 1;
1575
- const t = O().getSymbolSize, e = 7;
1576
- return ke.getPositions = function(n) {
1577
- const o = t(n);
1653
+ var Re = {}, yt;
1654
+ function dr() {
1655
+ if (yt) return Re;
1656
+ yt = 1;
1657
+ const n = K().getSymbolSize, e = 7;
1658
+ return Re.getPositions = function(r) {
1659
+ const o = n(r);
1578
1660
  return [
1579
1661
  // top-left
1580
1662
  [0, 0],
@@ -1583,12 +1665,12 @@ function Xn() {
1583
1665
  // bottom-left
1584
1666
  [0, o - e]
1585
1667
  ];
1586
- }, ke;
1668
+ }, Re;
1587
1669
  }
1588
- var Ee = {}, gt;
1589
- function Zn() {
1590
- return gt || (gt = 1, (function(t) {
1591
- t.Patterns = {
1670
+ var Se = {}, vt;
1671
+ function fr() {
1672
+ return vt || (vt = 1, (function(n) {
1673
+ n.Patterns = {
1592
1674
  PATTERN000: 0,
1593
1675
  PATTERN001: 1,
1594
1676
  PATTERN010: 2,
@@ -1604,11 +1686,11 @@ function Zn() {
1604
1686
  N3: 40,
1605
1687
  N4: 10
1606
1688
  };
1607
- t.isValid = function(o) {
1689
+ n.isValid = function(o) {
1608
1690
  return o != null && o !== "" && !isNaN(o) && o >= 0 && o <= 7;
1609
- }, t.from = function(o) {
1610
- return t.isValid(o) ? parseInt(o, 10) : void 0;
1611
- }, t.getPenaltyN1 = function(o) {
1691
+ }, n.from = function(o) {
1692
+ return n.isValid(o) ? parseInt(o, 10) : void 0;
1693
+ }, n.getPenaltyN1 = function(o) {
1612
1694
  const s = o.size;
1613
1695
  let i = 0, c = 0, a = 0, l = null, u = null;
1614
1696
  for (let h = 0; h < s; h++) {
@@ -1620,7 +1702,7 @@ function Zn() {
1620
1702
  c >= 5 && (i += e.N1 + (c - 5)), a >= 5 && (i += e.N1 + (a - 5));
1621
1703
  }
1622
1704
  return i;
1623
- }, t.getPenaltyN2 = function(o) {
1705
+ }, n.getPenaltyN2 = function(o) {
1624
1706
  const s = o.size;
1625
1707
  let i = 0;
1626
1708
  for (let c = 0; c < s - 1; c++)
@@ -1629,7 +1711,7 @@ function Zn() {
1629
1711
  (l === 4 || l === 0) && i++;
1630
1712
  }
1631
1713
  return i * e.N2;
1632
- }, t.getPenaltyN3 = function(o) {
1714
+ }, n.getPenaltyN3 = function(o) {
1633
1715
  const s = o.size;
1634
1716
  let i = 0, c = 0, a = 0;
1635
1717
  for (let l = 0; l < s; l++) {
@@ -1638,56 +1720,56 @@ function Zn() {
1638
1720
  c = c << 1 & 2047 | o.get(l, u), u >= 10 && (c === 1488 || c === 93) && i++, a = a << 1 & 2047 | o.get(u, l), u >= 10 && (a === 1488 || a === 93) && i++;
1639
1721
  }
1640
1722
  return i * e.N3;
1641
- }, t.getPenaltyN4 = function(o) {
1723
+ }, n.getPenaltyN4 = function(o) {
1642
1724
  let s = 0;
1643
1725
  const i = o.data.length;
1644
1726
  for (let a = 0; a < i; a++) s += o.data[a];
1645
1727
  return Math.abs(Math.ceil(s * 100 / i / 5) - 10) * e.N4;
1646
1728
  };
1647
- function r(n, o, s) {
1648
- switch (n) {
1649
- case t.Patterns.PATTERN000:
1729
+ function t(r, o, s) {
1730
+ switch (r) {
1731
+ case n.Patterns.PATTERN000:
1650
1732
  return (o + s) % 2 === 0;
1651
- case t.Patterns.PATTERN001:
1733
+ case n.Patterns.PATTERN001:
1652
1734
  return o % 2 === 0;
1653
- case t.Patterns.PATTERN010:
1735
+ case n.Patterns.PATTERN010:
1654
1736
  return s % 3 === 0;
1655
- case t.Patterns.PATTERN011:
1737
+ case n.Patterns.PATTERN011:
1656
1738
  return (o + s) % 3 === 0;
1657
- case t.Patterns.PATTERN100:
1739
+ case n.Patterns.PATTERN100:
1658
1740
  return (Math.floor(o / 2) + Math.floor(s / 3)) % 2 === 0;
1659
- case t.Patterns.PATTERN101:
1741
+ case n.Patterns.PATTERN101:
1660
1742
  return o * s % 2 + o * s % 3 === 0;
1661
- case t.Patterns.PATTERN110:
1743
+ case n.Patterns.PATTERN110:
1662
1744
  return (o * s % 2 + o * s % 3) % 2 === 0;
1663
- case t.Patterns.PATTERN111:
1745
+ case n.Patterns.PATTERN111:
1664
1746
  return (o * s % 3 + (o + s) % 2) % 2 === 0;
1665
1747
  default:
1666
- throw new Error("bad maskPattern:" + n);
1748
+ throw new Error("bad maskPattern:" + r);
1667
1749
  }
1668
1750
  }
1669
- t.applyMask = function(o, s) {
1751
+ n.applyMask = function(o, s) {
1670
1752
  const i = s.size;
1671
1753
  for (let c = 0; c < i; c++)
1672
1754
  for (let a = 0; a < i; a++)
1673
- s.isReserved(a, c) || s.xor(a, c, r(o, a, c));
1674
- }, t.getBestMask = function(o, s) {
1675
- const i = Object.keys(t.Patterns).length;
1755
+ s.isReserved(a, c) || s.xor(a, c, t(o, a, c));
1756
+ }, n.getBestMask = function(o, s) {
1757
+ const i = Object.keys(n.Patterns).length;
1676
1758
  let c = 0, a = 1 / 0;
1677
1759
  for (let l = 0; l < i; l++) {
1678
- s(l), t.applyMask(l, o);
1679
- const u = t.getPenaltyN1(o) + t.getPenaltyN2(o) + t.getPenaltyN3(o) + t.getPenaltyN4(o);
1680
- t.applyMask(l, o), u < a && (a = u, c = l);
1760
+ s(l), n.applyMask(l, o);
1761
+ const u = n.getPenaltyN1(o) + n.getPenaltyN2(o) + n.getPenaltyN3(o) + n.getPenaltyN4(o);
1762
+ n.applyMask(l, o), u < a && (a = u, c = l);
1681
1763
  }
1682
1764
  return c;
1683
1765
  };
1684
- })(Ee)), Ee;
1766
+ })(Se)), Se;
1685
1767
  }
1686
- var ce = {}, pt;
1687
- function Kt() {
1688
- if (pt) return ce;
1689
- pt = 1;
1690
- const t = Oe(), e = [
1768
+ var le = {}, bt;
1769
+ function on() {
1770
+ if (bt) return le;
1771
+ bt = 1;
1772
+ const n = Ye(), e = [
1691
1773
  // L M Q H
1692
1774
  1,
1693
1775
  1,
@@ -1849,7 +1931,7 @@ function Kt() {
1849
1931
  49,
1850
1932
  68,
1851
1933
  81
1852
- ], r = [
1934
+ ], t = [
1853
1935
  // L M Q H
1854
1936
  7,
1855
1937
  10,
@@ -2012,66 +2094,66 @@ function Kt() {
2012
2094
  2040,
2013
2095
  2430
2014
2096
  ];
2015
- return ce.getBlocksCount = function(o, s) {
2097
+ return le.getBlocksCount = function(o, s) {
2016
2098
  switch (s) {
2017
- case t.L:
2099
+ case n.L:
2018
2100
  return e[(o - 1) * 4 + 0];
2019
- case t.M:
2101
+ case n.M:
2020
2102
  return e[(o - 1) * 4 + 1];
2021
- case t.Q:
2103
+ case n.Q:
2022
2104
  return e[(o - 1) * 4 + 2];
2023
- case t.H:
2105
+ case n.H:
2024
2106
  return e[(o - 1) * 4 + 3];
2025
2107
  default:
2026
2108
  return;
2027
2109
  }
2028
- }, ce.getTotalCodewordsCount = function(o, s) {
2110
+ }, le.getTotalCodewordsCount = function(o, s) {
2029
2111
  switch (s) {
2030
- case t.L:
2031
- return r[(o - 1) * 4 + 0];
2032
- case t.M:
2033
- return r[(o - 1) * 4 + 1];
2034
- case t.Q:
2035
- return r[(o - 1) * 4 + 2];
2036
- case t.H:
2037
- return r[(o - 1) * 4 + 3];
2112
+ case n.L:
2113
+ return t[(o - 1) * 4 + 0];
2114
+ case n.M:
2115
+ return t[(o - 1) * 4 + 1];
2116
+ case n.Q:
2117
+ return t[(o - 1) * 4 + 2];
2118
+ case n.H:
2119
+ return t[(o - 1) * 4 + 3];
2038
2120
  default:
2039
2121
  return;
2040
2122
  }
2041
- }, ce;
2123
+ }, le;
2042
2124
  }
2043
- var _e = {}, te = {}, mt;
2044
- function er() {
2045
- if (mt) return te;
2046
- mt = 1;
2047
- const t = new Uint8Array(512), e = new Uint8Array(256);
2125
+ var Me = {}, ne = {}, Ct;
2126
+ function gr() {
2127
+ if (Ct) return ne;
2128
+ Ct = 1;
2129
+ const n = new Uint8Array(512), e = new Uint8Array(256);
2048
2130
  return (function() {
2049
- let n = 1;
2131
+ let r = 1;
2050
2132
  for (let o = 0; o < 255; o++)
2051
- t[o] = n, e[n] = o, n <<= 1, n & 256 && (n ^= 285);
2133
+ n[o] = r, e[r] = o, r <<= 1, r & 256 && (r ^= 285);
2052
2134
  for (let o = 255; o < 512; o++)
2053
- t[o] = t[o - 255];
2054
- })(), te.log = function(n) {
2055
- if (n < 1) throw new Error("log(" + n + ")");
2056
- return e[n];
2057
- }, te.exp = function(n) {
2058
- return t[n];
2059
- }, te.mul = function(n, o) {
2060
- return n === 0 || o === 0 ? 0 : t[e[n] + e[o]];
2061
- }, te;
2062
- }
2063
- var wt;
2064
- function tr() {
2065
- return wt || (wt = 1, (function(t) {
2066
- const e = er();
2067
- t.mul = function(n, o) {
2068
- const s = new Uint8Array(n.length + o.length - 1);
2069
- for (let i = 0; i < n.length; i++)
2135
+ n[o] = n[o - 255];
2136
+ })(), ne.log = function(r) {
2137
+ if (r < 1) throw new Error("log(" + r + ")");
2138
+ return e[r];
2139
+ }, ne.exp = function(r) {
2140
+ return n[r];
2141
+ }, ne.mul = function(r, o) {
2142
+ return r === 0 || o === 0 ? 0 : n[e[r] + e[o]];
2143
+ }, ne;
2144
+ }
2145
+ var At;
2146
+ function mr() {
2147
+ return At || (At = 1, (function(n) {
2148
+ const e = gr();
2149
+ n.mul = function(r, o) {
2150
+ const s = new Uint8Array(r.length + o.length - 1);
2151
+ for (let i = 0; i < r.length; i++)
2070
2152
  for (let c = 0; c < o.length; c++)
2071
- s[i + c] ^= e.mul(n[i], o[c]);
2153
+ s[i + c] ^= e.mul(r[i], o[c]);
2072
2154
  return s;
2073
- }, t.mod = function(n, o) {
2074
- let s = new Uint8Array(n);
2155
+ }, n.mod = function(r, o) {
2156
+ let s = new Uint8Array(r);
2075
2157
  for (; s.length - o.length >= 0; ) {
2076
2158
  const i = s[0];
2077
2159
  for (let a = 0; a < o.length; a++)
@@ -2081,54 +2163,54 @@ function tr() {
2081
2163
  s = s.slice(c);
2082
2164
  }
2083
2165
  return s;
2084
- }, t.generateECPolynomial = function(n) {
2166
+ }, n.generateECPolynomial = function(r) {
2085
2167
  let o = new Uint8Array([1]);
2086
- for (let s = 0; s < n; s++)
2087
- o = t.mul(o, new Uint8Array([1, e.exp(s)]));
2168
+ for (let s = 0; s < r; s++)
2169
+ o = n.mul(o, new Uint8Array([1, e.exp(s)]));
2088
2170
  return o;
2089
2171
  };
2090
- })(_e)), _e;
2172
+ })(Me)), Me;
2091
2173
  }
2092
- var Re, yt;
2093
- function nr() {
2094
- if (yt) return Re;
2095
- yt = 1;
2096
- const t = tr();
2097
- function e(r) {
2098
- this.genPoly = void 0, this.degree = r, this.degree && this.initialize(this.degree);
2174
+ var Be, Tt;
2175
+ function pr() {
2176
+ if (Tt) return Be;
2177
+ Tt = 1;
2178
+ const n = mr();
2179
+ function e(t) {
2180
+ this.genPoly = void 0, this.degree = t, this.degree && this.initialize(this.degree);
2099
2181
  }
2100
- return e.prototype.initialize = function(n) {
2101
- this.degree = n, this.genPoly = t.generateECPolynomial(this.degree);
2102
- }, e.prototype.encode = function(n) {
2182
+ return e.prototype.initialize = function(r) {
2183
+ this.degree = r, this.genPoly = n.generateECPolynomial(this.degree);
2184
+ }, e.prototype.encode = function(r) {
2103
2185
  if (!this.genPoly)
2104
2186
  throw new Error("Encoder not initialized");
2105
- const o = new Uint8Array(n.length + this.degree);
2106
- o.set(n);
2107
- const s = t.mod(o, this.genPoly), i = this.degree - s.length;
2187
+ const o = new Uint8Array(r.length + this.degree);
2188
+ o.set(r);
2189
+ const s = n.mod(o, this.genPoly), i = this.degree - s.length;
2108
2190
  if (i > 0) {
2109
2191
  const c = new Uint8Array(this.degree);
2110
2192
  return c.set(s, i), c;
2111
2193
  }
2112
2194
  return s;
2113
- }, Re = e, Re;
2195
+ }, Be = e, Be;
2114
2196
  }
2115
- var Se = {}, Be = {}, Me = {}, bt;
2116
- function Qt() {
2117
- return bt || (bt = 1, Me.isValid = function(e) {
2197
+ var Le = {}, Ie = {}, $e = {}, Et;
2198
+ function sn() {
2199
+ return Et || (Et = 1, $e.isValid = function(e) {
2118
2200
  return !isNaN(e) && e >= 1 && e <= 40;
2119
- }), Me;
2120
- }
2121
- var P = {}, vt;
2122
- function Gt() {
2123
- if (vt) return P;
2124
- vt = 1;
2125
- const t = "[0-9]+", e = "[A-Z $%*+\\-./:]+";
2126
- let r = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
2127
- r = r.replace(/u/g, "\\u");
2128
- const n = "(?:(?![A-Z0-9 $%*+\\-./:]|" + r + `)(?:.|[\r
2201
+ }), $e;
2202
+ }
2203
+ var P = {}, _t;
2204
+ function an() {
2205
+ if (_t) return P;
2206
+ _t = 1;
2207
+ const n = "[0-9]+", e = "[A-Z $%*+\\-./:]+";
2208
+ let t = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
2209
+ t = t.replace(/u/g, "\\u");
2210
+ const r = "(?:(?![A-Z0-9 $%*+\\-./:]|" + t + `)(?:.|[\r
2129
2211
  ]))+`;
2130
- P.KANJI = new RegExp(r, "g"), P.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g"), P.BYTE = new RegExp(n, "g"), P.NUMERIC = new RegExp(t, "g"), P.ALPHANUMERIC = new RegExp(e, "g");
2131
- const o = new RegExp("^" + r + "$"), s = new RegExp("^" + t + "$"), i = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
2212
+ P.KANJI = new RegExp(t, "g"), P.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g"), P.BYTE = new RegExp(r, "g"), P.NUMERIC = new RegExp(n, "g"), P.ALPHANUMERIC = new RegExp(e, "g");
2213
+ const o = new RegExp("^" + t + "$"), s = new RegExp("^" + n + "$"), i = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
2132
2214
  return P.testKanji = function(a) {
2133
2215
  return o.test(a);
2134
2216
  }, P.testNumeric = function(a) {
@@ -2137,174 +2219,174 @@ function Gt() {
2137
2219
  return i.test(a);
2138
2220
  }, P;
2139
2221
  }
2140
- var At;
2222
+ var kt;
2141
2223
  function J() {
2142
- return At || (At = 1, (function(t) {
2143
- const e = Qt(), r = Gt();
2144
- t.NUMERIC = {
2224
+ return kt || (kt = 1, (function(n) {
2225
+ const e = sn(), t = an();
2226
+ n.NUMERIC = {
2145
2227
  id: "Numeric",
2146
2228
  bit: 1,
2147
2229
  ccBits: [10, 12, 14]
2148
- }, t.ALPHANUMERIC = {
2230
+ }, n.ALPHANUMERIC = {
2149
2231
  id: "Alphanumeric",
2150
2232
  bit: 2,
2151
2233
  ccBits: [9, 11, 13]
2152
- }, t.BYTE = {
2234
+ }, n.BYTE = {
2153
2235
  id: "Byte",
2154
2236
  bit: 4,
2155
2237
  ccBits: [8, 16, 16]
2156
- }, t.KANJI = {
2238
+ }, n.KANJI = {
2157
2239
  id: "Kanji",
2158
2240
  bit: 8,
2159
2241
  ccBits: [8, 10, 12]
2160
- }, t.MIXED = {
2242
+ }, n.MIXED = {
2161
2243
  bit: -1
2162
- }, t.getCharCountIndicator = function(s, i) {
2244
+ }, n.getCharCountIndicator = function(s, i) {
2163
2245
  if (!s.ccBits) throw new Error("Invalid mode: " + s);
2164
2246
  if (!e.isValid(i))
2165
2247
  throw new Error("Invalid version: " + i);
2166
2248
  return i >= 1 && i < 10 ? s.ccBits[0] : i < 27 ? s.ccBits[1] : s.ccBits[2];
2167
- }, t.getBestModeForData = function(s) {
2168
- return r.testNumeric(s) ? t.NUMERIC : r.testAlphanumeric(s) ? t.ALPHANUMERIC : r.testKanji(s) ? t.KANJI : t.BYTE;
2169
- }, t.toString = function(s) {
2249
+ }, n.getBestModeForData = function(s) {
2250
+ return t.testNumeric(s) ? n.NUMERIC : t.testAlphanumeric(s) ? n.ALPHANUMERIC : t.testKanji(s) ? n.KANJI : n.BYTE;
2251
+ }, n.toString = function(s) {
2170
2252
  if (s && s.id) return s.id;
2171
2253
  throw new Error("Invalid mode");
2172
- }, t.isValid = function(s) {
2254
+ }, n.isValid = function(s) {
2173
2255
  return s && s.bit && s.ccBits;
2174
2256
  };
2175
- function n(o) {
2257
+ function r(o) {
2176
2258
  if (typeof o != "string")
2177
2259
  throw new Error("Param is not a string");
2178
2260
  switch (o.toLowerCase()) {
2179
2261
  case "numeric":
2180
- return t.NUMERIC;
2262
+ return n.NUMERIC;
2181
2263
  case "alphanumeric":
2182
- return t.ALPHANUMERIC;
2264
+ return n.ALPHANUMERIC;
2183
2265
  case "kanji":
2184
- return t.KANJI;
2266
+ return n.KANJI;
2185
2267
  case "byte":
2186
- return t.BYTE;
2268
+ return n.BYTE;
2187
2269
  default:
2188
2270
  throw new Error("Unknown mode: " + o);
2189
2271
  }
2190
2272
  }
2191
- t.from = function(s, i) {
2192
- if (t.isValid(s))
2273
+ n.from = function(s, i) {
2274
+ if (n.isValid(s))
2193
2275
  return s;
2194
2276
  try {
2195
- return n(s);
2277
+ return r(s);
2196
2278
  } catch {
2197
2279
  return i;
2198
2280
  }
2199
2281
  };
2200
- })(Be)), Be;
2282
+ })(Ie)), Ie;
2201
2283
  }
2202
- var Ct;
2203
- function rr() {
2204
- return Ct || (Ct = 1, (function(t) {
2205
- const e = O(), r = Kt(), n = Oe(), o = J(), s = Qt(), i = 7973, c = e.getBCHDigit(i);
2206
- function a(f, d, w) {
2284
+ var xt;
2285
+ function wr() {
2286
+ return xt || (xt = 1, (function(n) {
2287
+ const e = K(), t = on(), r = Ye(), o = J(), s = sn(), i = 7973, c = e.getBCHDigit(i);
2288
+ function a(f, d, g) {
2207
2289
  for (let p = 1; p <= 40; p++)
2208
- if (d <= t.getCapacity(p, w, f))
2290
+ if (d <= n.getCapacity(p, g, f))
2209
2291
  return p;
2210
2292
  }
2211
2293
  function l(f, d) {
2212
2294
  return o.getCharCountIndicator(f, d) + 4;
2213
2295
  }
2214
2296
  function u(f, d) {
2215
- let w = 0;
2297
+ let g = 0;
2216
2298
  return f.forEach(function(p) {
2217
- const B = l(p.mode, d);
2218
- w += B + p.getBitsLength();
2219
- }), w;
2299
+ const m = l(p.mode, d);
2300
+ g += m + p.getBitsLength();
2301
+ }), g;
2220
2302
  }
2221
2303
  function h(f, d) {
2222
- for (let w = 1; w <= 40; w++)
2223
- if (u(f, w) <= t.getCapacity(w, d, o.MIXED))
2224
- return w;
2304
+ for (let g = 1; g <= 40; g++)
2305
+ if (u(f, g) <= n.getCapacity(g, d, o.MIXED))
2306
+ return g;
2225
2307
  }
2226
- t.from = function(d, w) {
2227
- return s.isValid(d) ? parseInt(d, 10) : w;
2228
- }, t.getCapacity = function(d, w, p) {
2308
+ n.from = function(d, g) {
2309
+ return s.isValid(d) ? parseInt(d, 10) : g;
2310
+ }, n.getCapacity = function(d, g, p) {
2229
2311
  if (!s.isValid(d))
2230
2312
  throw new Error("Invalid QR Code version");
2231
2313
  typeof p > "u" && (p = o.BYTE);
2232
- const B = e.getSymbolTotalCodewords(d), A = r.getTotalCodewordsCount(d, w), S = (B - A) * 8;
2233
- if (p === o.MIXED) return S;
2234
- const k = S - l(p, d);
2314
+ const m = e.getSymbolTotalCodewords(d), y = t.getTotalCodewordsCount(d, g), E = (m - y) * 8;
2315
+ if (p === o.MIXED) return E;
2316
+ const w = E - l(p, d);
2235
2317
  switch (p) {
2236
2318
  case o.NUMERIC:
2237
- return Math.floor(k / 10 * 3);
2319
+ return Math.floor(w / 10 * 3);
2238
2320
  case o.ALPHANUMERIC:
2239
- return Math.floor(k / 11 * 2);
2321
+ return Math.floor(w / 11 * 2);
2240
2322
  case o.KANJI:
2241
- return Math.floor(k / 13);
2323
+ return Math.floor(w / 13);
2242
2324
  case o.BYTE:
2243
2325
  default:
2244
- return Math.floor(k / 8);
2326
+ return Math.floor(w / 8);
2245
2327
  }
2246
- }, t.getBestVersionForData = function(d, w) {
2328
+ }, n.getBestVersionForData = function(d, g) {
2247
2329
  let p;
2248
- const B = n.from(w, n.M);
2330
+ const m = r.from(g, r.M);
2249
2331
  if (Array.isArray(d)) {
2250
2332
  if (d.length > 1)
2251
- return h(d, B);
2333
+ return h(d, m);
2252
2334
  if (d.length === 0)
2253
2335
  return 1;
2254
2336
  p = d[0];
2255
2337
  } else
2256
2338
  p = d;
2257
- return a(p.mode, p.getLength(), B);
2258
- }, t.getEncodedBits = function(d) {
2339
+ return a(p.mode, p.getLength(), m);
2340
+ }, n.getEncodedBits = function(d) {
2259
2341
  if (!s.isValid(d) || d < 7)
2260
2342
  throw new Error("Invalid QR Code version");
2261
- let w = d << 12;
2262
- for (; e.getBCHDigit(w) - c >= 0; )
2263
- w ^= i << e.getBCHDigit(w) - c;
2264
- return d << 12 | w;
2343
+ let g = d << 12;
2344
+ for (; e.getBCHDigit(g) - c >= 0; )
2345
+ g ^= i << e.getBCHDigit(g) - c;
2346
+ return d << 12 | g;
2265
2347
  };
2266
- })(Se)), Se;
2348
+ })(Le)), Le;
2267
2349
  }
2268
- var xe = {}, Tt;
2269
- function or() {
2270
- if (Tt) return xe;
2271
- Tt = 1;
2272
- const t = O(), e = 1335, r = 21522, n = t.getBCHDigit(e);
2273
- return xe.getEncodedBits = function(s, i) {
2350
+ var Pe = {}, Rt;
2351
+ function yr() {
2352
+ if (Rt) return Pe;
2353
+ Rt = 1;
2354
+ const n = K(), e = 1335, t = 21522, r = n.getBCHDigit(e);
2355
+ return Pe.getEncodedBits = function(s, i) {
2274
2356
  const c = s.bit << 3 | i;
2275
2357
  let a = c << 10;
2276
- for (; t.getBCHDigit(a) - n >= 0; )
2277
- a ^= e << t.getBCHDigit(a) - n;
2278
- return (c << 10 | a) ^ r;
2279
- }, xe;
2280
- }
2281
- var $e = {}, Le, kt;
2282
- function sr() {
2283
- if (kt) return Le;
2284
- kt = 1;
2285
- const t = J();
2286
- function e(r) {
2287
- this.mode = t.NUMERIC, this.data = r.toString();
2288
- }
2289
- return e.getBitsLength = function(n) {
2290
- return 10 * Math.floor(n / 3) + (n % 3 ? n % 3 * 3 + 1 : 0);
2358
+ for (; n.getBCHDigit(a) - r >= 0; )
2359
+ a ^= e << n.getBCHDigit(a) - r;
2360
+ return (c << 10 | a) ^ t;
2361
+ }, Pe;
2362
+ }
2363
+ var qe = {}, Ne, St;
2364
+ function vr() {
2365
+ if (St) return Ne;
2366
+ St = 1;
2367
+ const n = J();
2368
+ function e(t) {
2369
+ this.mode = n.NUMERIC, this.data = t.toString();
2370
+ }
2371
+ return e.getBitsLength = function(r) {
2372
+ return 10 * Math.floor(r / 3) + (r % 3 ? r % 3 * 3 + 1 : 0);
2291
2373
  }, e.prototype.getLength = function() {
2292
2374
  return this.data.length;
2293
2375
  }, e.prototype.getBitsLength = function() {
2294
2376
  return e.getBitsLength(this.data.length);
2295
- }, e.prototype.write = function(n) {
2377
+ }, e.prototype.write = function(r) {
2296
2378
  let o, s, i;
2297
2379
  for (o = 0; o + 3 <= this.data.length; o += 3)
2298
- s = this.data.substr(o, 3), i = parseInt(s, 10), n.put(i, 10);
2380
+ s = this.data.substr(o, 3), i = parseInt(s, 10), r.put(i, 10);
2299
2381
  const c = this.data.length - o;
2300
- c > 0 && (s = this.data.substr(o), i = parseInt(s, 10), n.put(i, c * 3 + 1));
2301
- }, Le = e, Le;
2302
- }
2303
- var Ie, Et;
2304
- function ir() {
2305
- if (Et) return Ie;
2306
- Et = 1;
2307
- const t = J(), e = [
2382
+ c > 0 && (s = this.data.substr(o), i = parseInt(s, 10), r.put(i, c * 3 + 1));
2383
+ }, Ne = e, Ne;
2384
+ }
2385
+ var De, Mt;
2386
+ function br() {
2387
+ if (Mt) return De;
2388
+ Mt = 1;
2389
+ const n = J(), e = [
2308
2390
  "0",
2309
2391
  "1",
2310
2392
  "2",
@@ -2351,58 +2433,58 @@ function ir() {
2351
2433
  "/",
2352
2434
  ":"
2353
2435
  ];
2354
- function r(n) {
2355
- this.mode = t.ALPHANUMERIC, this.data = n;
2436
+ function t(r) {
2437
+ this.mode = n.ALPHANUMERIC, this.data = r;
2356
2438
  }
2357
- return r.getBitsLength = function(o) {
2439
+ return t.getBitsLength = function(o) {
2358
2440
  return 11 * Math.floor(o / 2) + 6 * (o % 2);
2359
- }, r.prototype.getLength = function() {
2441
+ }, t.prototype.getLength = function() {
2360
2442
  return this.data.length;
2361
- }, r.prototype.getBitsLength = function() {
2362
- return r.getBitsLength(this.data.length);
2363
- }, r.prototype.write = function(o) {
2443
+ }, t.prototype.getBitsLength = function() {
2444
+ return t.getBitsLength(this.data.length);
2445
+ }, t.prototype.write = function(o) {
2364
2446
  let s;
2365
2447
  for (s = 0; s + 2 <= this.data.length; s += 2) {
2366
2448
  let i = e.indexOf(this.data[s]) * 45;
2367
2449
  i += e.indexOf(this.data[s + 1]), o.put(i, 11);
2368
2450
  }
2369
2451
  this.data.length % 2 && o.put(e.indexOf(this.data[s]), 6);
2370
- }, Ie = r, Ie;
2371
- }
2372
- var Pe, _t;
2373
- function ar() {
2374
- if (_t) return Pe;
2375
- _t = 1;
2376
- const t = J();
2377
- function e(r) {
2378
- this.mode = t.BYTE, typeof r == "string" ? this.data = new TextEncoder().encode(r) : this.data = new Uint8Array(r);
2379
- }
2380
- return e.getBitsLength = function(n) {
2381
- return n * 8;
2452
+ }, De = t, De;
2453
+ }
2454
+ var Ue, Bt;
2455
+ function Cr() {
2456
+ if (Bt) return Ue;
2457
+ Bt = 1;
2458
+ const n = J();
2459
+ function e(t) {
2460
+ this.mode = n.BYTE, typeof t == "string" ? this.data = new TextEncoder().encode(t) : this.data = new Uint8Array(t);
2461
+ }
2462
+ return e.getBitsLength = function(r) {
2463
+ return r * 8;
2382
2464
  }, e.prototype.getLength = function() {
2383
2465
  return this.data.length;
2384
2466
  }, e.prototype.getBitsLength = function() {
2385
2467
  return e.getBitsLength(this.data.length);
2386
- }, e.prototype.write = function(r) {
2387
- for (let n = 0, o = this.data.length; n < o; n++)
2388
- r.put(this.data[n], 8);
2389
- }, Pe = e, Pe;
2468
+ }, e.prototype.write = function(t) {
2469
+ for (let r = 0, o = this.data.length; r < o; r++)
2470
+ t.put(this.data[r], 8);
2471
+ }, Ue = e, Ue;
2390
2472
  }
2391
- var qe, Rt;
2392
- function cr() {
2393
- if (Rt) return qe;
2394
- Rt = 1;
2395
- const t = J(), e = O();
2396
- function r(n) {
2397
- this.mode = t.KANJI, this.data = n;
2473
+ var Fe, Lt;
2474
+ function Ar() {
2475
+ if (Lt) return Fe;
2476
+ Lt = 1;
2477
+ const n = J(), e = K();
2478
+ function t(r) {
2479
+ this.mode = n.KANJI, this.data = r;
2398
2480
  }
2399
- return r.getBitsLength = function(o) {
2481
+ return t.getBitsLength = function(o) {
2400
2482
  return o * 13;
2401
- }, r.prototype.getLength = function() {
2483
+ }, t.prototype.getLength = function() {
2402
2484
  return this.data.length;
2403
- }, r.prototype.getBitsLength = function() {
2404
- return r.getBitsLength(this.data.length);
2405
- }, r.prototype.write = function(n) {
2485
+ }, t.prototype.getBitsLength = function() {
2486
+ return t.getBitsLength(this.data.length);
2487
+ }, t.prototype.write = function(r) {
2406
2488
  let o;
2407
2489
  for (o = 0; o < this.data.length; o++) {
2408
2490
  let s = e.toSJIS(this.data[o]);
@@ -2415,37 +2497,37 @@ function cr() {
2415
2497
  "Invalid SJIS character: " + this.data[o] + `
2416
2498
  Make sure your charset is UTF-8`
2417
2499
  );
2418
- s = (s >>> 8 & 255) * 192 + (s & 255), n.put(s, 13);
2500
+ s = (s >>> 8 & 255) * 192 + (s & 255), r.put(s, 13);
2419
2501
  }
2420
- }, qe = r, qe;
2502
+ }, Fe = t, Fe;
2421
2503
  }
2422
- var De = { exports: {} }, St;
2423
- function lr() {
2424
- return St || (St = 1, (function(t) {
2504
+ var ze = { exports: {} }, It;
2505
+ function Tr() {
2506
+ return It || (It = 1, (function(n) {
2425
2507
  var e = {
2426
- single_source_shortest_paths: function(r, n, o) {
2508
+ single_source_shortest_paths: function(t, r, o) {
2427
2509
  var s = {}, i = {};
2428
- i[n] = 0;
2510
+ i[r] = 0;
2429
2511
  var c = e.PriorityQueue.make();
2430
- c.push(n, 0);
2431
- for (var a, l, u, h, f, d, w, p, B; !c.empty(); ) {
2432
- a = c.pop(), l = a.value, h = a.cost, f = r[l] || {};
2512
+ c.push(r, 0);
2513
+ for (var a, l, u, h, f, d, g, p, m; !c.empty(); ) {
2514
+ a = c.pop(), l = a.value, h = a.cost, f = t[l] || {};
2433
2515
  for (u in f)
2434
- f.hasOwnProperty(u) && (d = f[u], w = h + d, p = i[u], B = typeof i[u] > "u", (B || p > w) && (i[u] = w, c.push(u, w), s[u] = l));
2516
+ f.hasOwnProperty(u) && (d = f[u], g = h + d, p = i[u], m = typeof i[u] > "u", (m || p > g) && (i[u] = g, c.push(u, g), s[u] = l));
2435
2517
  }
2436
2518
  if (typeof o < "u" && typeof i[o] > "u") {
2437
- var A = ["Could not find a path from ", n, " to ", o, "."].join("");
2438
- throw new Error(A);
2519
+ var y = ["Could not find a path from ", r, " to ", o, "."].join("");
2520
+ throw new Error(y);
2439
2521
  }
2440
2522
  return s;
2441
2523
  },
2442
- extract_shortest_path_from_predecessor_list: function(r, n) {
2443
- for (var o = [], s = n; s; )
2444
- o.push(s), r[s], s = r[s];
2524
+ extract_shortest_path_from_predecessor_list: function(t, r) {
2525
+ for (var o = [], s = r; s; )
2526
+ o.push(s), t[s], s = t[s];
2445
2527
  return o.reverse(), o;
2446
2528
  },
2447
- find_path: function(r, n, o) {
2448
- var s = e.single_source_shortest_paths(r, n, o);
2529
+ find_path: function(t, r, o) {
2530
+ var s = e.single_source_shortest_paths(t, r, o);
2449
2531
  return e.extract_shortest_path_from_predecessor_list(
2450
2532
  s,
2451
2533
  o
@@ -2455,22 +2537,22 @@ function lr() {
2455
2537
  * A very naive priority queue implementation.
2456
2538
  */
2457
2539
  PriorityQueue: {
2458
- make: function(r) {
2459
- var n = e.PriorityQueue, o = {}, s;
2460
- r = r || {};
2461
- for (s in n)
2462
- n.hasOwnProperty(s) && (o[s] = n[s]);
2463
- return o.queue = [], o.sorter = r.sorter || n.default_sorter, o;
2540
+ make: function(t) {
2541
+ var r = e.PriorityQueue, o = {}, s;
2542
+ t = t || {};
2543
+ for (s in r)
2544
+ r.hasOwnProperty(s) && (o[s] = r[s]);
2545
+ return o.queue = [], o.sorter = t.sorter || r.default_sorter, o;
2464
2546
  },
2465
- default_sorter: function(r, n) {
2466
- return r.cost - n.cost;
2547
+ default_sorter: function(t, r) {
2548
+ return t.cost - r.cost;
2467
2549
  },
2468
2550
  /**
2469
2551
  * Add a new item to the queue and ensure the highest priority element
2470
2552
  * is at the front of the queue.
2471
2553
  */
2472
- push: function(r, n) {
2473
- var o = { value: r, cost: n };
2554
+ push: function(t, r) {
2555
+ var o = { value: t, cost: r };
2474
2556
  this.queue.push(o), this.queue.sort(this.sorter);
2475
2557
  },
2476
2558
  /**
@@ -2484,396 +2566,396 @@ function lr() {
2484
2566
  }
2485
2567
  }
2486
2568
  };
2487
- t.exports = e;
2488
- })(De)), De.exports;
2569
+ n.exports = e;
2570
+ })(ze)), ze.exports;
2489
2571
  }
2490
- var Bt;
2491
- function ur() {
2492
- return Bt || (Bt = 1, (function(t) {
2493
- const e = J(), r = sr(), n = ir(), o = ar(), s = cr(), i = Gt(), c = O(), a = lr();
2494
- function l(A) {
2495
- return unescape(encodeURIComponent(A)).length;
2572
+ var $t;
2573
+ function Er() {
2574
+ return $t || ($t = 1, (function(n) {
2575
+ const e = J(), t = vr(), r = br(), o = Cr(), s = Ar(), i = an(), c = K(), a = Tr();
2576
+ function l(y) {
2577
+ return unescape(encodeURIComponent(y)).length;
2496
2578
  }
2497
- function u(A, S, k) {
2498
- const E = [];
2499
- let x;
2500
- for (; (x = A.exec(k)) !== null; )
2501
- E.push({
2502
- data: x[0],
2503
- index: x.index,
2504
- mode: S,
2505
- length: x[0].length
2579
+ function u(y, E, w) {
2580
+ const x = [];
2581
+ let M;
2582
+ for (; (M = y.exec(w)) !== null; )
2583
+ x.push({
2584
+ data: M[0],
2585
+ index: M.index,
2586
+ mode: E,
2587
+ length: M[0].length
2506
2588
  });
2507
- return E;
2589
+ return x;
2508
2590
  }
2509
- function h(A) {
2510
- const S = u(i.NUMERIC, e.NUMERIC, A), k = u(i.ALPHANUMERIC, e.ALPHANUMERIC, A);
2511
- let E, x;
2512
- return c.isKanjiModeEnabled() ? (E = u(i.BYTE, e.BYTE, A), x = u(i.KANJI, e.KANJI, A)) : (E = u(i.BYTE_KANJI, e.BYTE, A), x = []), S.concat(k, E, x).sort(function(C, v) {
2513
- return C.index - v.index;
2514
- }).map(function(C) {
2591
+ function h(y) {
2592
+ const E = u(i.NUMERIC, e.NUMERIC, y), w = u(i.ALPHANUMERIC, e.ALPHANUMERIC, y);
2593
+ let x, M;
2594
+ return c.isKanjiModeEnabled() ? (x = u(i.BYTE, e.BYTE, y), M = u(i.KANJI, e.KANJI, y)) : (x = u(i.BYTE_KANJI, e.BYTE, y), M = []), E.concat(w, x, M).sort(function(_, T) {
2595
+ return _.index - T.index;
2596
+ }).map(function(_) {
2515
2597
  return {
2516
- data: C.data,
2517
- mode: C.mode,
2518
- length: C.length
2598
+ data: _.data,
2599
+ mode: _.mode,
2600
+ length: _.length
2519
2601
  };
2520
2602
  });
2521
2603
  }
2522
- function f(A, S) {
2523
- switch (S) {
2604
+ function f(y, E) {
2605
+ switch (E) {
2524
2606
  case e.NUMERIC:
2525
- return r.getBitsLength(A);
2607
+ return t.getBitsLength(y);
2526
2608
  case e.ALPHANUMERIC:
2527
- return n.getBitsLength(A);
2609
+ return r.getBitsLength(y);
2528
2610
  case e.KANJI:
2529
- return s.getBitsLength(A);
2611
+ return s.getBitsLength(y);
2530
2612
  case e.BYTE:
2531
- return o.getBitsLength(A);
2613
+ return o.getBitsLength(y);
2532
2614
  }
2533
2615
  }
2534
- function d(A) {
2535
- return A.reduce(function(S, k) {
2536
- const E = S.length - 1 >= 0 ? S[S.length - 1] : null;
2537
- return E && E.mode === k.mode ? (S[S.length - 1].data += k.data, S) : (S.push(k), S);
2616
+ function d(y) {
2617
+ return y.reduce(function(E, w) {
2618
+ const x = E.length - 1 >= 0 ? E[E.length - 1] : null;
2619
+ return x && x.mode === w.mode ? (E[E.length - 1].data += w.data, E) : (E.push(w), E);
2538
2620
  }, []);
2539
2621
  }
2540
- function w(A) {
2541
- const S = [];
2542
- for (let k = 0; k < A.length; k++) {
2543
- const E = A[k];
2544
- switch (E.mode) {
2622
+ function g(y) {
2623
+ const E = [];
2624
+ for (let w = 0; w < y.length; w++) {
2625
+ const x = y[w];
2626
+ switch (x.mode) {
2545
2627
  case e.NUMERIC:
2546
- S.push([
2547
- E,
2548
- { data: E.data, mode: e.ALPHANUMERIC, length: E.length },
2549
- { data: E.data, mode: e.BYTE, length: E.length }
2628
+ E.push([
2629
+ x,
2630
+ { data: x.data, mode: e.ALPHANUMERIC, length: x.length },
2631
+ { data: x.data, mode: e.BYTE, length: x.length }
2550
2632
  ]);
2551
2633
  break;
2552
2634
  case e.ALPHANUMERIC:
2553
- S.push([
2554
- E,
2555
- { data: E.data, mode: e.BYTE, length: E.length }
2635
+ E.push([
2636
+ x,
2637
+ { data: x.data, mode: e.BYTE, length: x.length }
2556
2638
  ]);
2557
2639
  break;
2558
2640
  case e.KANJI:
2559
- S.push([
2560
- E,
2561
- { data: E.data, mode: e.BYTE, length: l(E.data) }
2641
+ E.push([
2642
+ x,
2643
+ { data: x.data, mode: e.BYTE, length: l(x.data) }
2562
2644
  ]);
2563
2645
  break;
2564
2646
  case e.BYTE:
2565
- S.push([
2566
- { data: E.data, mode: e.BYTE, length: l(E.data) }
2647
+ E.push([
2648
+ { data: x.data, mode: e.BYTE, length: l(x.data) }
2567
2649
  ]);
2568
2650
  }
2569
2651
  }
2570
- return S;
2652
+ return E;
2571
2653
  }
2572
- function p(A, S) {
2573
- const k = {}, E = { start: {} };
2574
- let x = ["start"];
2575
- for (let m = 0; m < A.length; m++) {
2576
- const C = A[m], v = [];
2577
- for (let g = 0; g < C.length; g++) {
2578
- const _ = C[g], y = "" + m + g;
2579
- v.push(y), k[y] = { node: _, lastCount: 0 }, E[y] = {};
2580
- for (let T = 0; T < x.length; T++) {
2581
- const b = x[T];
2582
- k[b] && k[b].node.mode === _.mode ? (E[b][y] = f(k[b].lastCount + _.length, _.mode) - f(k[b].lastCount, _.mode), k[b].lastCount += _.length) : (k[b] && (k[b].lastCount = _.length), E[b][y] = f(_.length, _.mode) + 4 + e.getCharCountIndicator(_.mode, S));
2654
+ function p(y, E) {
2655
+ const w = {}, x = { start: {} };
2656
+ let M = ["start"];
2657
+ for (let b = 0; b < y.length; b++) {
2658
+ const _ = y[b], T = [];
2659
+ for (let v = 0; v < _.length; v++) {
2660
+ const R = _[v], C = "" + b + v;
2661
+ T.push(C), w[C] = { node: R, lastCount: 0 }, x[C] = {};
2662
+ for (let k = 0; k < M.length; k++) {
2663
+ const A = M[k];
2664
+ w[A] && w[A].node.mode === R.mode ? (x[A][C] = f(w[A].lastCount + R.length, R.mode) - f(w[A].lastCount, R.mode), w[A].lastCount += R.length) : (w[A] && (w[A].lastCount = R.length), x[A][C] = f(R.length, R.mode) + 4 + e.getCharCountIndicator(R.mode, E));
2583
2665
  }
2584
2666
  }
2585
- x = v;
2667
+ M = T;
2586
2668
  }
2587
- for (let m = 0; m < x.length; m++)
2588
- E[x[m]].end = 0;
2589
- return { map: E, table: k };
2669
+ for (let b = 0; b < M.length; b++)
2670
+ x[M[b]].end = 0;
2671
+ return { map: x, table: w };
2590
2672
  }
2591
- function B(A, S) {
2592
- let k;
2593
- const E = e.getBestModeForData(A);
2594
- if (k = e.from(S, E), k !== e.BYTE && k.bit < E.bit)
2595
- throw new Error('"' + A + '" cannot be encoded with mode ' + e.toString(k) + `.
2596
- Suggested mode is: ` + e.toString(E));
2597
- switch (k === e.KANJI && !c.isKanjiModeEnabled() && (k = e.BYTE), k) {
2673
+ function m(y, E) {
2674
+ let w;
2675
+ const x = e.getBestModeForData(y);
2676
+ if (w = e.from(E, x), w !== e.BYTE && w.bit < x.bit)
2677
+ throw new Error('"' + y + '" cannot be encoded with mode ' + e.toString(w) + `.
2678
+ Suggested mode is: ` + e.toString(x));
2679
+ switch (w === e.KANJI && !c.isKanjiModeEnabled() && (w = e.BYTE), w) {
2598
2680
  case e.NUMERIC:
2599
- return new r(A);
2681
+ return new t(y);
2600
2682
  case e.ALPHANUMERIC:
2601
- return new n(A);
2683
+ return new r(y);
2602
2684
  case e.KANJI:
2603
- return new s(A);
2685
+ return new s(y);
2604
2686
  case e.BYTE:
2605
- return new o(A);
2687
+ return new o(y);
2606
2688
  }
2607
2689
  }
2608
- t.fromArray = function(S) {
2609
- return S.reduce(function(k, E) {
2610
- return typeof E == "string" ? k.push(B(E, null)) : E.data && k.push(B(E.data, E.mode)), k;
2690
+ n.fromArray = function(E) {
2691
+ return E.reduce(function(w, x) {
2692
+ return typeof x == "string" ? w.push(m(x, null)) : x.data && w.push(m(x.data, x.mode)), w;
2611
2693
  }, []);
2612
- }, t.fromString = function(S, k) {
2613
- const E = h(S, c.isKanjiModeEnabled()), x = w(E), m = p(x, k), C = a.find_path(m.map, "start", "end"), v = [];
2614
- for (let g = 1; g < C.length - 1; g++)
2615
- v.push(m.table[C[g]].node);
2616
- return t.fromArray(d(v));
2617
- }, t.rawSplit = function(S) {
2618
- return t.fromArray(
2619
- h(S, c.isKanjiModeEnabled())
2694
+ }, n.fromString = function(E, w) {
2695
+ const x = h(E, c.isKanjiModeEnabled()), M = g(x), b = p(M, w), _ = a.find_path(b.map, "start", "end"), T = [];
2696
+ for (let v = 1; v < _.length - 1; v++)
2697
+ T.push(b.table[_[v]].node);
2698
+ return n.fromArray(d(T));
2699
+ }, n.rawSplit = function(E) {
2700
+ return n.fromArray(
2701
+ h(E, c.isKanjiModeEnabled())
2620
2702
  );
2621
2703
  };
2622
- })($e)), $e;
2623
- }
2624
- var Mt;
2625
- function hr() {
2626
- if (Mt) return be;
2627
- Mt = 1;
2628
- const t = O(), e = Oe(), r = Qn(), n = Gn(), o = Yn(), s = Xn(), i = Zn(), c = Kt(), a = nr(), l = rr(), u = or(), h = J(), f = ur();
2629
- function d(m, C) {
2630
- const v = m.size, g = s.getPositions(C);
2631
- for (let _ = 0; _ < g.length; _++) {
2632
- const y = g[_][0], T = g[_][1];
2633
- for (let b = -1; b <= 7; b++)
2634
- if (!(y + b <= -1 || v <= y + b))
2635
- for (let R = -1; R <= 7; R++)
2636
- T + R <= -1 || v <= T + R || (b >= 0 && b <= 6 && (R === 0 || R === 6) || R >= 0 && R <= 6 && (b === 0 || b === 6) || b >= 2 && b <= 4 && R >= 2 && R <= 4 ? m.set(y + b, T + R, !0, !0) : m.set(y + b, T + R, !1, !0));
2704
+ })(qe)), qe;
2705
+ }
2706
+ var Pt;
2707
+ function _r() {
2708
+ if (Pt) return Te;
2709
+ Pt = 1;
2710
+ const n = K(), e = Ye(), t = lr(), r = ur(), o = hr(), s = dr(), i = fr(), c = on(), a = pr(), l = wr(), u = yr(), h = J(), f = Er();
2711
+ function d(b, _) {
2712
+ const T = b.size, v = s.getPositions(_);
2713
+ for (let R = 0; R < v.length; R++) {
2714
+ const C = v[R][0], k = v[R][1];
2715
+ for (let A = -1; A <= 7; A++)
2716
+ if (!(C + A <= -1 || T <= C + A))
2717
+ for (let S = -1; S <= 7; S++)
2718
+ k + S <= -1 || T <= k + S || (A >= 0 && A <= 6 && (S === 0 || S === 6) || S >= 0 && S <= 6 && (A === 0 || A === 6) || A >= 2 && A <= 4 && S >= 2 && S <= 4 ? b.set(C + A, k + S, !0, !0) : b.set(C + A, k + S, !1, !0));
2637
2719
  }
2638
2720
  }
2639
- function w(m) {
2640
- const C = m.size;
2641
- for (let v = 8; v < C - 8; v++) {
2642
- const g = v % 2 === 0;
2643
- m.set(v, 6, g, !0), m.set(6, v, g, !0);
2721
+ function g(b) {
2722
+ const _ = b.size;
2723
+ for (let T = 8; T < _ - 8; T++) {
2724
+ const v = T % 2 === 0;
2725
+ b.set(T, 6, v, !0), b.set(6, T, v, !0);
2644
2726
  }
2645
2727
  }
2646
- function p(m, C) {
2647
- const v = o.getPositions(C);
2648
- for (let g = 0; g < v.length; g++) {
2649
- const _ = v[g][0], y = v[g][1];
2650
- for (let T = -2; T <= 2; T++)
2651
- for (let b = -2; b <= 2; b++)
2652
- T === -2 || T === 2 || b === -2 || b === 2 || T === 0 && b === 0 ? m.set(_ + T, y + b, !0, !0) : m.set(_ + T, y + b, !1, !0);
2728
+ function p(b, _) {
2729
+ const T = o.getPositions(_);
2730
+ for (let v = 0; v < T.length; v++) {
2731
+ const R = T[v][0], C = T[v][1];
2732
+ for (let k = -2; k <= 2; k++)
2733
+ for (let A = -2; A <= 2; A++)
2734
+ k === -2 || k === 2 || A === -2 || A === 2 || k === 0 && A === 0 ? b.set(R + k, C + A, !0, !0) : b.set(R + k, C + A, !1, !0);
2653
2735
  }
2654
2736
  }
2655
- function B(m, C) {
2656
- const v = m.size, g = l.getEncodedBits(C);
2657
- let _, y, T;
2658
- for (let b = 0; b < 18; b++)
2659
- _ = Math.floor(b / 3), y = b % 3 + v - 8 - 3, T = (g >> b & 1) === 1, m.set(_, y, T, !0), m.set(y, _, T, !0);
2660
- }
2661
- function A(m, C, v) {
2662
- const g = m.size, _ = u.getEncodedBits(C, v);
2663
- let y, T;
2664
- for (y = 0; y < 15; y++)
2665
- T = (_ >> y & 1) === 1, y < 6 ? m.set(y, 8, T, !0) : y < 8 ? m.set(y + 1, 8, T, !0) : m.set(g - 15 + y, 8, T, !0), y < 8 ? m.set(8, g - y - 1, T, !0) : y < 9 ? m.set(8, 15 - y - 1 + 1, T, !0) : m.set(8, 15 - y - 1, T, !0);
2666
- m.set(g - 8, 8, 1, !0);
2667
- }
2668
- function S(m, C) {
2669
- const v = m.size;
2670
- let g = -1, _ = v - 1, y = 7, T = 0;
2671
- for (let b = v - 1; b > 0; b -= 2)
2672
- for (b === 6 && b--; ; ) {
2673
- for (let R = 0; R < 2; R++)
2674
- if (!m.isReserved(_, b - R)) {
2675
- let F = !1;
2676
- T < C.length && (F = (C[T] >>> y & 1) === 1), m.set(_, b - R, F), y--, y === -1 && (T++, y = 7);
2737
+ function m(b, _) {
2738
+ const T = b.size, v = l.getEncodedBits(_);
2739
+ let R, C, k;
2740
+ for (let A = 0; A < 18; A++)
2741
+ R = Math.floor(A / 3), C = A % 3 + T - 8 - 3, k = (v >> A & 1) === 1, b.set(R, C, k, !0), b.set(C, R, k, !0);
2742
+ }
2743
+ function y(b, _, T) {
2744
+ const v = b.size, R = u.getEncodedBits(_, T);
2745
+ let C, k;
2746
+ for (C = 0; C < 15; C++)
2747
+ k = (R >> C & 1) === 1, C < 6 ? b.set(C, 8, k, !0) : C < 8 ? b.set(C + 1, 8, k, !0) : b.set(v - 15 + C, 8, k, !0), C < 8 ? b.set(8, v - C - 1, k, !0) : C < 9 ? b.set(8, 15 - C - 1 + 1, k, !0) : b.set(8, 15 - C - 1, k, !0);
2748
+ b.set(v - 8, 8, 1, !0);
2749
+ }
2750
+ function E(b, _) {
2751
+ const T = b.size;
2752
+ let v = -1, R = T - 1, C = 7, k = 0;
2753
+ for (let A = T - 1; A > 0; A -= 2)
2754
+ for (A === 6 && A--; ; ) {
2755
+ for (let S = 0; S < 2; S++)
2756
+ if (!b.isReserved(R, A - S)) {
2757
+ let z = !1;
2758
+ k < _.length && (z = (_[k] >>> C & 1) === 1), b.set(R, A - S, z), C--, C === -1 && (k++, C = 7);
2677
2759
  }
2678
- if (_ += g, _ < 0 || v <= _) {
2679
- _ -= g, g = -g;
2760
+ if (R += v, R < 0 || T <= R) {
2761
+ R -= v, v = -v;
2680
2762
  break;
2681
2763
  }
2682
2764
  }
2683
2765
  }
2684
- function k(m, C, v) {
2685
- const g = new r();
2686
- v.forEach(function(R) {
2687
- g.put(R.mode.bit, 4), g.put(R.getLength(), h.getCharCountIndicator(R.mode, m)), R.write(g);
2766
+ function w(b, _, T) {
2767
+ const v = new t();
2768
+ T.forEach(function(S) {
2769
+ v.put(S.mode.bit, 4), v.put(S.getLength(), h.getCharCountIndicator(S.mode, b)), S.write(v);
2688
2770
  });
2689
- const _ = t.getSymbolTotalCodewords(m), y = c.getTotalCodewordsCount(m, C), T = (_ - y) * 8;
2690
- for (g.getLengthInBits() + 4 <= T && g.put(0, 4); g.getLengthInBits() % 8 !== 0; )
2691
- g.putBit(0);
2692
- const b = (T - g.getLengthInBits()) / 8;
2693
- for (let R = 0; R < b; R++)
2694
- g.put(R % 2 ? 17 : 236, 8);
2695
- return E(g, m, C);
2696
- }
2697
- function E(m, C, v) {
2698
- const g = t.getSymbolTotalCodewords(C), _ = c.getTotalCodewordsCount(C, v), y = g - _, T = c.getBlocksCount(C, v), b = g % T, R = T - b, F = Math.floor(g / T), Z = Math.floor(y / T), en = Z + 1, Je = F - Z, tn = new a(Je);
2699
- let he = 0;
2700
- const ae = new Array(T), Ke = new Array(T);
2701
- let de = 0;
2702
- const nn = new Uint8Array(m.buffer);
2703
- for (let K = 0; K < T; K++) {
2704
- const ge = K < R ? Z : en;
2705
- ae[K] = nn.slice(he, he + ge), Ke[K] = tn.encode(ae[K]), he += ge, de = Math.max(de, ge);
2771
+ const R = n.getSymbolTotalCodewords(b), C = c.getTotalCodewordsCount(b, _), k = (R - C) * 8;
2772
+ for (v.getLengthInBits() + 4 <= k && v.put(0, 4); v.getLengthInBits() % 8 !== 0; )
2773
+ v.putBit(0);
2774
+ const A = (k - v.getLengthInBits()) / 8;
2775
+ for (let S = 0; S < A; S++)
2776
+ v.put(S % 2 ? 17 : 236, 8);
2777
+ return x(v, b, _);
2778
+ }
2779
+ function x(b, _, T) {
2780
+ const v = n.getSymbolTotalCodewords(_), R = c.getTotalCodewordsCount(_, T), C = v - R, k = c.getBlocksCount(_, T), A = v % k, S = k - A, z = Math.floor(v / k), ee = Math.floor(C / k), fn = ee + 1, Xe = z - ee, gn = new a(Xe);
2781
+ let me = 0;
2782
+ const ce = new Array(k), Ze = new Array(k);
2783
+ let pe = 0;
2784
+ const mn = new Uint8Array(b.buffer);
2785
+ for (let Q = 0; Q < k; Q++) {
2786
+ const ye = Q < S ? ee : fn;
2787
+ ce[Q] = mn.slice(me, me + ye), Ze[Q] = gn.encode(ce[Q]), me += ye, pe = Math.max(pe, ye);
2706
2788
  }
2707
- const fe = new Uint8Array(g);
2708
- let Qe = 0, q, D;
2709
- for (q = 0; q < de; q++)
2710
- for (D = 0; D < T; D++)
2711
- q < ae[D].length && (fe[Qe++] = ae[D][q]);
2712
- for (q = 0; q < Je; q++)
2713
- for (D = 0; D < T; D++)
2714
- fe[Qe++] = Ke[D][q];
2715
- return fe;
2716
- }
2717
- function x(m, C, v, g) {
2718
- let _;
2719
- if (Array.isArray(m))
2720
- _ = f.fromArray(m);
2721
- else if (typeof m == "string") {
2722
- let F = C;
2723
- if (!F) {
2724
- const Z = f.rawSplit(m);
2725
- F = l.getBestVersionForData(Z, v);
2789
+ const we = new Uint8Array(v);
2790
+ let et = 0, q, N;
2791
+ for (q = 0; q < pe; q++)
2792
+ for (N = 0; N < k; N++)
2793
+ q < ce[N].length && (we[et++] = ce[N][q]);
2794
+ for (q = 0; q < Xe; q++)
2795
+ for (N = 0; N < k; N++)
2796
+ we[et++] = Ze[N][q];
2797
+ return we;
2798
+ }
2799
+ function M(b, _, T, v) {
2800
+ let R;
2801
+ if (Array.isArray(b))
2802
+ R = f.fromArray(b);
2803
+ else if (typeof b == "string") {
2804
+ let z = _;
2805
+ if (!z) {
2806
+ const ee = f.rawSplit(b);
2807
+ z = l.getBestVersionForData(ee, T);
2726
2808
  }
2727
- _ = f.fromString(m, F || 40);
2809
+ R = f.fromString(b, z || 40);
2728
2810
  } else
2729
2811
  throw new Error("Invalid data");
2730
- const y = l.getBestVersionForData(_, v);
2731
- if (!y)
2732
- throw new Error("The amount of data is too big to be stored in a QR Code");
2812
+ const C = l.getBestVersionForData(R, T);
2733
2813
  if (!C)
2734
- C = y;
2735
- else if (C < y)
2814
+ throw new Error("The amount of data is too big to be stored in a QR Code");
2815
+ if (!_)
2816
+ _ = C;
2817
+ else if (_ < C)
2736
2818
  throw new Error(
2737
2819
  `
2738
2820
  The chosen QR Code version cannot contain this amount of data.
2739
- Minimum version required to store current data is: ` + y + `.
2821
+ Minimum version required to store current data is: ` + C + `.
2740
2822
  `
2741
2823
  );
2742
- const T = k(C, v, _), b = t.getSymbolSize(C), R = new n(b);
2743
- return d(R, C), w(R), p(R, C), A(R, v, 0), C >= 7 && B(R, C), S(R, T), isNaN(g) && (g = i.getBestMask(
2744
- R,
2745
- A.bind(null, R, v)
2746
- )), i.applyMask(g, R), A(R, v, g), {
2747
- modules: R,
2748
- version: C,
2749
- errorCorrectionLevel: v,
2750
- maskPattern: g,
2751
- segments: _
2824
+ const k = w(_, T, R), A = n.getSymbolSize(_), S = new r(A);
2825
+ return d(S, _), g(S), p(S, _), y(S, T, 0), _ >= 7 && m(S, _), E(S, k), isNaN(v) && (v = i.getBestMask(
2826
+ S,
2827
+ y.bind(null, S, T)
2828
+ )), i.applyMask(v, S), y(S, T, v), {
2829
+ modules: S,
2830
+ version: _,
2831
+ errorCorrectionLevel: T,
2832
+ maskPattern: v,
2833
+ segments: R
2752
2834
  };
2753
2835
  }
2754
- return be.create = function(C, v) {
2755
- if (typeof C > "u" || C === "")
2836
+ return Te.create = function(_, T) {
2837
+ if (typeof _ > "u" || _ === "")
2756
2838
  throw new Error("No input text");
2757
- let g = e.M, _, y;
2758
- return typeof v < "u" && (g = e.from(v.errorCorrectionLevel, e.M), _ = l.from(v.version), y = i.from(v.maskPattern), v.toSJISFunc && t.setToSJISFunction(v.toSJISFunc)), x(C, _, g, y);
2759
- }, be;
2760
- }
2761
- var Ne = {}, Ue = {}, xt;
2762
- function Yt() {
2763
- return xt || (xt = 1, (function(t) {
2764
- function e(r) {
2765
- if (typeof r == "number" && (r = r.toString()), typeof r != "string")
2839
+ let v = e.M, R, C;
2840
+ return typeof T < "u" && (v = e.from(T.errorCorrectionLevel, e.M), R = l.from(T.version), C = i.from(T.maskPattern), T.toSJISFunc && n.setToSJISFunction(T.toSJISFunc)), M(_, R, v, C);
2841
+ }, Te;
2842
+ }
2843
+ var He = {}, je = {}, qt;
2844
+ function cn() {
2845
+ return qt || (qt = 1, (function(n) {
2846
+ function e(t) {
2847
+ if (typeof t == "number" && (t = t.toString()), typeof t != "string")
2766
2848
  throw new Error("Color should be defined as hex string");
2767
- let n = r.slice().replace("#", "").split("");
2768
- if (n.length < 3 || n.length === 5 || n.length > 8)
2769
- throw new Error("Invalid hex color: " + r);
2770
- (n.length === 3 || n.length === 4) && (n = Array.prototype.concat.apply([], n.map(function(s) {
2849
+ let r = t.slice().replace("#", "").split("");
2850
+ if (r.length < 3 || r.length === 5 || r.length > 8)
2851
+ throw new Error("Invalid hex color: " + t);
2852
+ (r.length === 3 || r.length === 4) && (r = Array.prototype.concat.apply([], r.map(function(s) {
2771
2853
  return [s, s];
2772
- }))), n.length === 6 && n.push("F", "F");
2773
- const o = parseInt(n.join(""), 16);
2854
+ }))), r.length === 6 && r.push("F", "F");
2855
+ const o = parseInt(r.join(""), 16);
2774
2856
  return {
2775
2857
  r: o >> 24 & 255,
2776
2858
  g: o >> 16 & 255,
2777
2859
  b: o >> 8 & 255,
2778
2860
  a: o & 255,
2779
- hex: "#" + n.slice(0, 6).join("")
2861
+ hex: "#" + r.slice(0, 6).join("")
2780
2862
  };
2781
2863
  }
2782
- t.getOptions = function(n) {
2783
- n || (n = {}), n.color || (n.color = {});
2784
- const o = typeof n.margin > "u" || n.margin === null || n.margin < 0 ? 4 : n.margin, s = n.width && n.width >= 21 ? n.width : void 0, i = n.scale || 4;
2864
+ n.getOptions = function(r) {
2865
+ r || (r = {}), r.color || (r.color = {});
2866
+ const o = typeof r.margin > "u" || r.margin === null || r.margin < 0 ? 4 : r.margin, s = r.width && r.width >= 21 ? r.width : void 0, i = r.scale || 4;
2785
2867
  return {
2786
2868
  width: s,
2787
2869
  scale: s ? 4 : i,
2788
2870
  margin: o,
2789
2871
  color: {
2790
- dark: e(n.color.dark || "#000000ff"),
2791
- light: e(n.color.light || "#ffffffff")
2872
+ dark: e(r.color.dark || "#000000ff"),
2873
+ light: e(r.color.light || "#ffffffff")
2792
2874
  },
2793
- type: n.type,
2794
- rendererOpts: n.rendererOpts || {}
2875
+ type: r.type,
2876
+ rendererOpts: r.rendererOpts || {}
2795
2877
  };
2796
- }, t.getScale = function(n, o) {
2797
- return o.width && o.width >= n + o.margin * 2 ? o.width / (n + o.margin * 2) : o.scale;
2798
- }, t.getImageWidth = function(n, o) {
2799
- const s = t.getScale(n, o);
2800
- return Math.floor((n + o.margin * 2) * s);
2801
- }, t.qrToImageData = function(n, o, s) {
2802
- const i = o.modules.size, c = o.modules.data, a = t.getScale(i, s), l = Math.floor((i + s.margin * 2) * a), u = s.margin * a, h = [s.color.light, s.color.dark];
2878
+ }, n.getScale = function(r, o) {
2879
+ return o.width && o.width >= r + o.margin * 2 ? o.width / (r + o.margin * 2) : o.scale;
2880
+ }, n.getImageWidth = function(r, o) {
2881
+ const s = n.getScale(r, o);
2882
+ return Math.floor((r + o.margin * 2) * s);
2883
+ }, n.qrToImageData = function(r, o, s) {
2884
+ const i = o.modules.size, c = o.modules.data, a = n.getScale(i, s), l = Math.floor((i + s.margin * 2) * a), u = s.margin * a, h = [s.color.light, s.color.dark];
2803
2885
  for (let f = 0; f < l; f++)
2804
2886
  for (let d = 0; d < l; d++) {
2805
- let w = (f * l + d) * 4, p = s.color.light;
2887
+ let g = (f * l + d) * 4, p = s.color.light;
2806
2888
  if (f >= u && d >= u && f < l - u && d < l - u) {
2807
- const B = Math.floor((f - u) / a), A = Math.floor((d - u) / a);
2808
- p = h[c[B * i + A] ? 1 : 0];
2889
+ const m = Math.floor((f - u) / a), y = Math.floor((d - u) / a);
2890
+ p = h[c[m * i + y] ? 1 : 0];
2809
2891
  }
2810
- n[w++] = p.r, n[w++] = p.g, n[w++] = p.b, n[w] = p.a;
2892
+ r[g++] = p.r, r[g++] = p.g, r[g++] = p.b, r[g] = p.a;
2811
2893
  }
2812
2894
  };
2813
- })(Ue)), Ue;
2895
+ })(je)), je;
2814
2896
  }
2815
- var $t;
2816
- function dr() {
2817
- return $t || ($t = 1, (function(t) {
2818
- const e = Yt();
2819
- function r(o, s, i) {
2897
+ var Nt;
2898
+ function kr() {
2899
+ return Nt || (Nt = 1, (function(n) {
2900
+ const e = cn();
2901
+ function t(o, s, i) {
2820
2902
  o.clearRect(0, 0, s.width, s.height), s.style || (s.style = {}), s.height = i, s.width = i, s.style.height = i + "px", s.style.width = i + "px";
2821
2903
  }
2822
- function n() {
2904
+ function r() {
2823
2905
  try {
2824
2906
  return document.createElement("canvas");
2825
2907
  } catch {
2826
2908
  throw new Error("You need to specify a canvas element");
2827
2909
  }
2828
2910
  }
2829
- t.render = function(s, i, c) {
2911
+ n.render = function(s, i, c) {
2830
2912
  let a = c, l = i;
2831
- typeof a > "u" && (!i || !i.getContext) && (a = i, i = void 0), i || (l = n()), a = e.getOptions(a);
2913
+ typeof a > "u" && (!i || !i.getContext) && (a = i, i = void 0), i || (l = r()), a = e.getOptions(a);
2832
2914
  const u = e.getImageWidth(s.modules.size, a), h = l.getContext("2d"), f = h.createImageData(u, u);
2833
- return e.qrToImageData(f.data, s, a), r(h, l, u), h.putImageData(f, 0, 0), l;
2834
- }, t.renderToDataURL = function(s, i, c) {
2915
+ return e.qrToImageData(f.data, s, a), t(h, l, u), h.putImageData(f, 0, 0), l;
2916
+ }, n.renderToDataURL = function(s, i, c) {
2835
2917
  let a = c;
2836
2918
  typeof a > "u" && (!i || !i.getContext) && (a = i, i = void 0), a || (a = {});
2837
- const l = t.render(s, i, a), u = a.type || "image/png", h = a.rendererOpts || {};
2919
+ const l = n.render(s, i, a), u = a.type || "image/png", h = a.rendererOpts || {};
2838
2920
  return l.toDataURL(u, h.quality);
2839
2921
  };
2840
- })(Ne)), Ne;
2922
+ })(He)), He;
2841
2923
  }
2842
- var Fe = {}, Lt;
2843
- function fr() {
2844
- if (Lt) return Fe;
2845
- Lt = 1;
2846
- const t = Yt();
2924
+ var Ve = {}, Dt;
2925
+ function xr() {
2926
+ if (Dt) return Ve;
2927
+ Dt = 1;
2928
+ const n = cn();
2847
2929
  function e(o, s) {
2848
2930
  const i = o.a / 255, c = s + '="' + o.hex + '"';
2849
2931
  return i < 1 ? c + " " + s + '-opacity="' + i.toFixed(2).slice(1) + '"' : c;
2850
2932
  }
2851
- function r(o, s, i) {
2933
+ function t(o, s, i) {
2852
2934
  let c = o + s;
2853
2935
  return typeof i < "u" && (c += " " + i), c;
2854
2936
  }
2855
- function n(o, s, i) {
2937
+ function r(o, s, i) {
2856
2938
  let c = "", a = 0, l = !1, u = 0;
2857
2939
  for (let h = 0; h < o.length; h++) {
2858
2940
  const f = Math.floor(h % s), d = Math.floor(h / s);
2859
- !f && !l && (l = !0), o[h] ? (u++, h > 0 && f > 0 && o[h - 1] || (c += l ? r("M", f + i, 0.5 + d + i) : r("m", a, 0), a = 0, l = !1), f + 1 < s && o[h + 1] || (c += r("h", u), u = 0)) : a++;
2941
+ !f && !l && (l = !0), o[h] ? (u++, h > 0 && f > 0 && o[h - 1] || (c += l ? t("M", f + i, 0.5 + d + i) : t("m", a, 0), a = 0, l = !1), f + 1 < s && o[h + 1] || (c += t("h", u), u = 0)) : a++;
2860
2942
  }
2861
2943
  return c;
2862
2944
  }
2863
- return Fe.render = function(s, i, c) {
2864
- const a = t.getOptions(i), l = s.modules.size, u = s.modules.data, h = l + a.margin * 2, f = a.color.light.a ? "<path " + e(a.color.light, "fill") + ' d="M0 0h' + h + "v" + h + 'H0z"/>' : "", d = "<path " + e(a.color.dark, "stroke") + ' d="' + n(u, l, a.margin) + '"/>', w = 'viewBox="0 0 ' + h + " " + h + '"', B = '<svg xmlns="http://www.w3.org/2000/svg" ' + (a.width ? 'width="' + a.width + '" height="' + a.width + '" ' : "") + w + ' shape-rendering="crispEdges">' + f + d + `</svg>
2945
+ return Ve.render = function(s, i, c) {
2946
+ const a = n.getOptions(i), l = s.modules.size, u = s.modules.data, h = l + a.margin * 2, f = a.color.light.a ? "<path " + e(a.color.light, "fill") + ' d="M0 0h' + h + "v" + h + 'H0z"/>' : "", d = "<path " + e(a.color.dark, "stroke") + ' d="' + r(u, l, a.margin) + '"/>', g = 'viewBox="0 0 ' + h + " " + h + '"', m = '<svg xmlns="http://www.w3.org/2000/svg" ' + (a.width ? 'width="' + a.width + '" height="' + a.width + '" ' : "") + g + ' shape-rendering="crispEdges">' + f + d + `</svg>
2865
2947
  `;
2866
- return typeof c == "function" && c(null, B), B;
2867
- }, Fe;
2868
- }
2869
- var It;
2870
- function gr() {
2871
- if (It) return Q;
2872
- It = 1;
2873
- const t = Kn(), e = hr(), r = dr(), n = fr();
2948
+ return typeof c == "function" && c(null, m), m;
2949
+ }, Ve;
2950
+ }
2951
+ var Ut;
2952
+ function Rr() {
2953
+ if (Ut) return G;
2954
+ Ut = 1;
2955
+ const n = cr(), e = _r(), t = kr(), r = xr();
2874
2956
  function o(s, i, c, a, l) {
2875
2957
  const u = [].slice.call(arguments, 1), h = u.length, f = typeof u[h - 1] == "function";
2876
- if (!f && !t())
2958
+ if (!f && !n())
2877
2959
  throw new Error("Callback required as last argument");
2878
2960
  if (f) {
2879
2961
  if (h < 2)
@@ -2882,12 +2964,12 @@ function gr() {
2882
2964
  } else {
2883
2965
  if (h < 1)
2884
2966
  throw new Error("Too few arguments provided");
2885
- return h === 1 ? (c = i, i = a = void 0) : h === 2 && !i.getContext && (a = c, c = i, i = void 0), new Promise(function(d, w) {
2967
+ return h === 1 ? (c = i, i = a = void 0) : h === 2 && !i.getContext && (a = c, c = i, i = void 0), new Promise(function(d, g) {
2886
2968
  try {
2887
2969
  const p = e.create(c, a);
2888
2970
  d(s(p, i, a));
2889
2971
  } catch (p) {
2890
- w(p);
2972
+ g(p);
2891
2973
  }
2892
2974
  });
2893
2975
  }
@@ -2898,60 +2980,400 @@ function gr() {
2898
2980
  l(d);
2899
2981
  }
2900
2982
  }
2901
- return Q.create = e.create, Q.toCanvas = o.bind(null, r.render), Q.toDataURL = o.bind(null, r.renderToDataURL), Q.toString = o.bind(null, function(s, i, c) {
2902
- return n.render(s, c);
2903
- }), Q;
2983
+ return G.create = e.create, G.toCanvas = o.bind(null, t.render), G.toDataURL = o.bind(null, t.renderToDataURL), G.toString = o.bind(null, function(s, i, c) {
2984
+ return r.render(s, c);
2985
+ }), G;
2904
2986
  }
2905
- var pr = gr();
2906
- const mr = /* @__PURE__ */ Jn(pr), wr = (t) => {
2987
+ var Sr = Rr();
2988
+ const Mr = /* @__PURE__ */ ar(Sr), Br = (n) => {
2907
2989
  var e = {
2908
2990
  errorCorrectionLevel: "H",
2909
2991
  type: "image/jpeg",
2910
2992
  margin: 1,
2911
2993
  width: 300
2912
2994
  };
2913
- let r = null;
2914
- const n = async (a) => {
2995
+ let t = null;
2996
+ const r = async (a) => {
2915
2997
  const l = new URL(window.location.href), u = new URL(l.pathname, l.origin);
2916
2998
  u.searchParams.set("state", "1-" + a), console.log("生成登录二维码链接:", u.toString());
2917
- var h = t || document.getElementById("qrcode");
2918
- await mr.toDataURL(h, u.toString(), e);
2999
+ var h = n || document.getElementById("qrcode");
3000
+ await Mr.toDataURL(h, u.toString(), e);
2919
3001
  }, o = async (a) => {
2920
3002
  const l = await fetch(`/api/router?path=wx&key=checkLogin&state=${a}`).then((u) => u.json());
2921
3003
  if (l.code === 200) {
2922
3004
  console.log(l);
2923
3005
  const u = l.data;
2924
- u && (localStorage.setItem("token", u.accessToken), await N.setLoginToken(u)), c(), setTimeout(() => {
2925
- se();
3006
+ u && (localStorage.setItem("token", u.accessToken), await U.setLoginToken(u)), c(), setTimeout(() => {
3007
+ ie();
2926
3008
  }, 1e3);
2927
3009
  } else
2928
- r = setTimeout(() => {
3010
+ t = setTimeout(() => {
2929
3011
  o(a), console.log("继续检测登录状态");
2930
3012
  }, 2e3);
2931
3013
  }, s = Math.random().toString(36).substring(2, 15);
2932
- n(s), o(s);
3014
+ r(s), o(s);
2933
3015
  const i = setInterval(() => {
2934
3016
  const a = Math.random().toString(36).substring(2, 15);
2935
- clearTimeout(r), n(a), o(a), console.log("更新二维码");
3017
+ clearTimeout(t), r(a), o(a), console.log("更新二维码");
2936
3018
  }, 9e4), c = () => {
2937
- clearTimeout(r), clearInterval(i), console.log("停止检测登录状态");
3019
+ clearTimeout(t), clearInterval(i), console.log("停止检测登录状态");
2938
3020
  };
2939
- return { createQrcode: n, clear: c };
2940
- }, Xt = "wxff97d569b1db16b6", yr = '<svg t="1764510467010" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1958" width="32" height="32"><path d="M615.904 388.48c8.8 0 17.536 0.64 26.176 1.6-23.52-109.536-140.608-190.912-274.272-190.912C218.4 199.2 96 301.056 96 430.4c0 74.656 40.736 135.936 108.768 183.488l-27.2 81.792 95.04-47.648c33.984 6.72 61.28 13.632 95.2 13.632 8.544 0 16.992-0.416 25.376-1.088a202.496 202.496 0 0 1-8.384-56.96c0-118.752 101.984-215.136 231.104-215.136zM469.76 314.784c20.48 0 34.016 13.472 34.016 33.92 0 20.352-13.536 34.016-34.016 34.016-20.384 0-40.832-13.664-40.832-34.016 0-20.448 20.448-33.92 40.832-33.92zM279.52 382.72c-20.384 0-40.928-13.664-40.928-34.016 0-20.448 20.544-33.92 40.928-33.92 20.352 0 33.92 13.472 33.92 33.92 0 20.384-13.568 34.016-33.92 34.016z" fill="" p-id="1959"></path><path d="M864 600.352c0-108.672-108.736-197.28-230.88-197.28-129.344 0-231.2 88.576-231.2 197.28 0 108.864 101.856 197.248 231.2 197.248 27.072 0 54.368-6.816 81.568-13.632l74.56 40.8-20.448-67.904C823.328 715.936 864 661.664 864 600.352z m-305.856-34.016c-13.536 0-27.2-13.44-27.2-27.2 0-13.568 13.664-27.2 27.2-27.2 20.576 0 34.016 13.632 34.016 27.2 0 13.76-13.44 27.2-34.016 27.2z m149.536 0c-13.44 0-27.008-13.44-27.008-27.2 0-13.568 13.568-27.2 27.008-27.2 20.352 0 34.016 13.632 34.016 27.2 0 13.76-13.664 27.2-34.016 27.2z" fill="" p-id="1960"></path></svg>', br = '<svg t="1764511395617" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3882" width="32" height="32"><path d="M256 259.584c-29.184 0-51.2 14.848-51.2 44.032s29.184 44.032 51.2 44.032c29.184 0 44.032-14.848 44.032-44.032s-22.016-44.032-44.032-44.032zM541.184 303.616c0-29.184-14.848-44.032-44.032-44.032-29.184 0-51.2 14.848-51.2 44.032s29.184 44.032 51.2 44.032c29.696 0 44.032-22.016 44.032-44.032zM614.4 508.416c-14.848 0-36.352 14.848-36.352 36.352 0 14.848 14.848 36.352 36.352 36.352 29.184 0 44.032-14.848 44.032-36.352 0-14.336-14.848-36.352-44.032-36.352z" p-id="3883"></path><path d="M1024 625.152c0-138.752-124.416-256-285.184-270.848-29.184-153.6-189.952-263.168-373.248-263.168C160.768 91.648 0 230.4 0 406.016c0 95.232 44.032 175.616 138.752 241.152L109.568 742.4c0 7.168 0 14.848 7.168 22.016h14.848l117.248-58.368h14.848c36.352 7.168 66.048 14.848 109.568 14.848 14.848 0 44.032-7.168 44.032-7.168C460.8 822.784 578.048 896 716.8 896c36.352 0 73.216-7.168 102.4-14.848l87.552 51.2h14.848c7.168-7.168 7.168-7.168 7.168-14.848l-22.016-87.552c80.896-58.368 117.248-131.584 117.248-204.8z m-621.568 51.2h-36.352c-36.352 0-66.048-7.168-95.232-14.848l-22.016-7.168h-7.168L153.6 698.368l22.016-66.048c0-7.168 0-14.848-7.168-14.848C80.384 559.616 36.352 486.4 36.352 398.848 36.352 245.248 182.784 128 358.4 128c160.768 0 300.032 95.232 329.216 226.816-168.448 0-300.032 117.248-300.032 263.168 7.168 22.016 14.848 44.032 14.848 58.368z m467.968 132.096c-7.168 7.168-7.168 7.168-7.168 14.848l14.848 51.2L819.2 844.8h-14.848c-29.184 7.168-66.048 14.848-95.232 14.848-146.432 0-270.848-102.4-270.848-226.816 0-131.584 124.416-233.984 270.848-233.984s270.848 102.4 270.848 226.816c0 65.536-36.352 123.904-109.568 182.784z" p-id="3884"></path><path d="M804.352 508.416c-14.848 0-36.352 14.848-36.352 36.352 0 14.848 14.848 36.352 36.352 36.352 29.184 0 44.032-14.848 44.032-36.352 0-14.336-14.336-36.352-44.032-36.352z" p-id="3885"></path></svg>', vr = '<svg t="1764511425462" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5097" width="32" height="32"><path d="M820.409449 797.228346q0 25.19685-10.07874 46.866142t-27.716535 38.299213-41.322835 26.204724-50.897638 9.574803l-357.795276 0q-27.212598 0-50.897638-9.574803t-41.322835-26.204724-27.716535-38.299213-10.07874-46.866142l0-675.275591q0-25.19685 10.07874-47.370079t27.716535-38.80315 41.322835-26.204724 50.897638-9.574803l357.795276 0q27.212598 0 50.897638 9.574803t41.322835 26.204724 27.716535 38.80315 10.07874 47.370079l0 675.275591zM738.771654 170.330709l-455.559055 0 0 577.511811 455.559055 0 0-577.511811zM510.992126 776.062992q-21.165354 0-36.787402 15.11811t-15.622047 37.291339q0 21.165354 15.622047 36.787402t36.787402 15.622047q22.173228 0 37.291339-15.622047t15.11811-36.787402q0-22.173228-15.11811-37.291339t-37.291339-15.11811zM591.622047 84.661417q0-8.062992-5.03937-12.598425t-11.086614-4.535433l-128 0q-5.03937 0-10.582677 4.535433t-5.543307 12.598425 5.03937 12.598425 11.086614 4.535433l128 0q6.047244 0 11.086614-4.535433t5.03937-12.598425z" p-id="5098"></path></svg>', Ar = '<svg t="1764511500570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10511" width="32" height="32"><path d="M768.9216 422.72768 372.06016 422.72768C378.88 365.21984 329.37984 131.42016 512.2048 125.72672c173.83424-6.59456 146.78016 213.34016 146.78016 213.34016l85.13536 0.57344c0 0 24.73984-294.4-231.91552-295.8336C232.09984 58.01984 297.82016 377.18016 289.28 422.72768c1.98656 0 4.56704 0 7.29088 0-55.88992 0-101.21216 45.34272-101.21216 101.21216l0 337.38752c0 55.88992 45.34272 101.21216 101.21216 101.21216l472.35072 0c55.88992 0 101.21216-45.34272 101.21216-101.21216L870.13376 523.93984C870.13376 468.0704 824.79104 422.72768 768.9216 422.72768zM566.4768 717.02528l0 76.84096c0 18.57536-15.1552 33.73056-33.73056 33.73056-18.57536 0-33.73056-15.1552-33.73056-33.73056l0-76.84096c-20.09088-11.69408-33.73056-33.21856-33.73056-58.12224 0-37.2736 30.208-67.4816 67.4816-67.4816 37.2736 0 67.4816 30.208 67.4816 67.4816C600.22784 683.80672 586.58816 705.3312 566.4768 717.02528z" fill="#272636" p-id="10512"></path></svg>', ze = {
2941
- pwd: Ar,
2942
- phone: vr,
2943
- wxmpSvg: yr,
2944
- wxOpenSvg: br
2945
- }, Cr = [
3021
+ return { createQrcode: r, clear: c };
3022
+ };
3023
+ function Lr(n) {
3024
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
3025
+ }
3026
+ var Oe = { exports: {} }, Ft;
3027
+ function Ir() {
3028
+ return Ft || (Ft = 1, (function(n) {
3029
+ var e = Object.prototype.hasOwnProperty, t = "~";
3030
+ function r() {
3031
+ }
3032
+ Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
3033
+ function o(a, l, u) {
3034
+ this.fn = a, this.context = l, this.once = u || !1;
3035
+ }
3036
+ function s(a, l, u, h, f) {
3037
+ if (typeof u != "function")
3038
+ throw new TypeError("The listener must be a function");
3039
+ var d = new o(u, h || a, f), g = t ? t + l : l;
3040
+ return a._events[g] ? a._events[g].fn ? a._events[g] = [a._events[g], d] : a._events[g].push(d) : (a._events[g] = d, a._eventsCount++), a;
3041
+ }
3042
+ function i(a, l) {
3043
+ --a._eventsCount === 0 ? a._events = new r() : delete a._events[l];
3044
+ }
3045
+ function c() {
3046
+ this._events = new r(), this._eventsCount = 0;
3047
+ }
3048
+ c.prototype.eventNames = function() {
3049
+ var l = [], u, h;
3050
+ if (this._eventsCount === 0)
3051
+ return l;
3052
+ for (h in u = this._events)
3053
+ e.call(u, h) && l.push(t ? h.slice(1) : h);
3054
+ return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(u)) : l;
3055
+ }, c.prototype.listeners = function(l) {
3056
+ var u = t ? t + l : l, h = this._events[u];
3057
+ if (!h)
3058
+ return [];
3059
+ if (h.fn)
3060
+ return [h.fn];
3061
+ for (var f = 0, d = h.length, g = new Array(d); f < d; f++)
3062
+ g[f] = h[f].fn;
3063
+ return g;
3064
+ }, c.prototype.listenerCount = function(l) {
3065
+ var u = t ? t + l : l, h = this._events[u];
3066
+ return h ? h.fn ? 1 : h.length : 0;
3067
+ }, c.prototype.emit = function(l, u, h, f, d, g) {
3068
+ var p = t ? t + l : l;
3069
+ if (!this._events[p])
3070
+ return !1;
3071
+ var m = this._events[p], y = arguments.length, E, w;
3072
+ if (m.fn) {
3073
+ switch (m.once && this.removeListener(l, m.fn, void 0, !0), y) {
3074
+ case 1:
3075
+ return m.fn.call(m.context), !0;
3076
+ case 2:
3077
+ return m.fn.call(m.context, u), !0;
3078
+ case 3:
3079
+ return m.fn.call(m.context, u, h), !0;
3080
+ case 4:
3081
+ return m.fn.call(m.context, u, h, f), !0;
3082
+ case 5:
3083
+ return m.fn.call(m.context, u, h, f, d), !0;
3084
+ case 6:
3085
+ return m.fn.call(m.context, u, h, f, d, g), !0;
3086
+ }
3087
+ for (w = 1, E = new Array(y - 1); w < y; w++)
3088
+ E[w - 1] = arguments[w];
3089
+ m.fn.apply(m.context, E);
3090
+ } else {
3091
+ var x = m.length, M;
3092
+ for (w = 0; w < x; w++)
3093
+ switch (m[w].once && this.removeListener(l, m[w].fn, void 0, !0), y) {
3094
+ case 1:
3095
+ m[w].fn.call(m[w].context);
3096
+ break;
3097
+ case 2:
3098
+ m[w].fn.call(m[w].context, u);
3099
+ break;
3100
+ case 3:
3101
+ m[w].fn.call(m[w].context, u, h);
3102
+ break;
3103
+ case 4:
3104
+ m[w].fn.call(m[w].context, u, h, f);
3105
+ break;
3106
+ default:
3107
+ if (!E)
3108
+ for (M = 1, E = new Array(y - 1); M < y; M++)
3109
+ E[M - 1] = arguments[M];
3110
+ m[w].fn.apply(m[w].context, E);
3111
+ }
3112
+ }
3113
+ return !0;
3114
+ }, c.prototype.on = function(l, u, h) {
3115
+ return s(this, l, u, h, !1);
3116
+ }, c.prototype.once = function(l, u, h) {
3117
+ return s(this, l, u, h, !0);
3118
+ }, c.prototype.removeListener = function(l, u, h, f) {
3119
+ var d = t ? t + l : l;
3120
+ if (!this._events[d])
3121
+ return this;
3122
+ if (!u)
3123
+ return i(this, d), this;
3124
+ var g = this._events[d];
3125
+ if (g.fn)
3126
+ g.fn === u && (!f || g.once) && (!h || g.context === h) && i(this, d);
3127
+ else {
3128
+ for (var p = 0, m = [], y = g.length; p < y; p++)
3129
+ (g[p].fn !== u || f && !g[p].once || h && g[p].context !== h) && m.push(g[p]);
3130
+ m.length ? this._events[d] = m.length === 1 ? m[0] : m : i(this, d);
3131
+ }
3132
+ return this;
3133
+ }, c.prototype.removeAllListeners = function(l) {
3134
+ var u;
3135
+ return l ? (u = t ? t + l : l, this._events[u] && i(this, u)) : (this._events = new r(), this._eventsCount = 0), this;
3136
+ }, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = t, c.EventEmitter = c, n.exports = c;
3137
+ })(Oe)), Oe.exports;
3138
+ }
3139
+ var $r = Ir(), Pr = /* @__PURE__ */ Lr($r), zt = (n) => {
3140
+ const e = n.timeout || 3e5, t = n.interval || 1e3, r = n?.checkSuccess || (() => !0), o = n.signal;
3141
+ return new Promise(async (s, i) => {
3142
+ let c, a = setTimeout(() => {
3143
+ clearTimeout(c), s({
3144
+ code: 500,
3145
+ message: "timeout"
3146
+ });
3147
+ }, e);
3148
+ const l = n.fn || (() => !0), u = async () => {
3149
+ if (o?.aborted)
3150
+ return clearInterval(c), clearTimeout(a), s({
3151
+ code: 499,
3152
+ message: "operation cancelled"
3153
+ });
3154
+ const h = await l();
3155
+ r(h) ? (clearInterval(c), clearTimeout(a), s({
3156
+ code: 200,
3157
+ data: h
3158
+ })) : setTimeout(() => {
3159
+ u();
3160
+ }, t);
3161
+ };
3162
+ o && o.addEventListener("abort", () => {
3163
+ clearInterval(c), clearTimeout(a), s({
3164
+ code: 499,
3165
+ message: "operation cancelled"
3166
+ });
3167
+ }), u();
3168
+ });
3169
+ };
3170
+ class ln {
3171
+ modules = /* @__PURE__ */ new Map();
3172
+ event;
3173
+ loading;
3174
+ static reRunFn = zt;
3175
+ timeout = 300 * 1e3;
3176
+ constructor() {
3177
+ this.event = new Pr(), this.loading = !1;
3178
+ }
3179
+ listenKey(e, t) {
3180
+ const r = t?.timeout ?? this.timeout;
3181
+ return new Promise((o) => {
3182
+ const s = setTimeout(() => {
3183
+ this.event.removeListener(e, i), o({
3184
+ code: 500,
3185
+ message: "timeout"
3186
+ });
3187
+ }, r), i = (c) => {
3188
+ if (clearTimeout(s), c)
3189
+ return o({
3190
+ code: 500,
3191
+ message: c
3192
+ });
3193
+ const a = this.modules.get(e);
3194
+ a?.loadSuccessClear && this.remove(e), o({
3195
+ code: 200,
3196
+ data: a?.modules
3197
+ });
3198
+ };
3199
+ this.event.once(e, i);
3200
+ });
3201
+ }
3202
+ async hasLoaded(e, t) {
3203
+ if (!e)
3204
+ return {
3205
+ code: 404,
3206
+ message: "key is required"
3207
+ };
3208
+ if (!this.modules.has(e)) {
3209
+ const s = t?.isExist ?? !0, i = t?.timeout ?? this.timeout;
3210
+ return s ? await this.listenKey(e, { timeout: i }) : {
3211
+ code: 404
3212
+ };
3213
+ }
3214
+ const o = this.modules.get(e);
3215
+ return o?.status === "loaded" ? {
3216
+ code: 200,
3217
+ data: o.modules
3218
+ } : o?.status === "loading" ? await this.listenKey(e, { timeout: t?.timeout ?? this.timeout }) : o?.status === "error" ? {
3219
+ code: 500,
3220
+ message: "load error"
3221
+ } : o?.status === "cancel" ? {
3222
+ code: 499,
3223
+ message: "operation cancelled"
3224
+ } : {
3225
+ code: 404
3226
+ };
3227
+ }
3228
+ async loadFn(e, t) {
3229
+ const r = t.key;
3230
+ if (!r)
3231
+ return {
3232
+ code: 404,
3233
+ message: "key is required"
3234
+ };
3235
+ const o = {
3236
+ key: t.key,
3237
+ status: "loading",
3238
+ loading: !0,
3239
+ loadSuccessClear: t.loadSuccessClear ?? !0
3240
+ };
3241
+ let s = "";
3242
+ try {
3243
+ const i = t.isReRun ?? !1;
3244
+ let c;
3245
+ if (!i)
3246
+ this.modules.set(r, o), c = await e();
3247
+ else {
3248
+ o.controller = new AbortController();
3249
+ const a = o.controller.signal;
3250
+ this.modules.set(r, o);
3251
+ const l = await zt({
3252
+ timeout: t.timeout,
3253
+ interval: t.interval,
3254
+ checkSuccess: t.checkSuccess,
3255
+ fn: e,
3256
+ signal: a
3257
+ });
3258
+ if (o.controller = null, l.code === 499)
3259
+ return o.status = "cancel", {
3260
+ code: 499,
3261
+ message: "operation cancelled"
3262
+ };
3263
+ if (l.code !== 200)
3264
+ throw new Error(l.message);
3265
+ c = l.data;
3266
+ }
3267
+ return o.modules = c, o.status = "loaded", {
3268
+ code: 200,
3269
+ data: c
3270
+ };
3271
+ } catch (i) {
3272
+ return s = i.message, o.status = "error", {
3273
+ code: 500,
3274
+ message: i
3275
+ };
3276
+ } finally {
3277
+ o.loading = !1, this.modules.set(t.key, o), s ? this.event.emit(t.key, s) : this.event.emit(t.key);
3278
+ }
3279
+ }
3280
+ async load(e, t) {
3281
+ this.loading = !0;
3282
+ const r = t.key;
3283
+ if (!r)
3284
+ return {
3285
+ code: 404,
3286
+ message: "key is required"
3287
+ };
3288
+ if (t?.force && this.remove(r), this.modules.has(r))
3289
+ return await this.hasLoaded(r);
3290
+ if (typeof e == "function")
3291
+ return this.loadFn(e, t);
3292
+ console.error("loadContent is not a function and not has loaded");
3293
+ }
3294
+ remove(e) {
3295
+ this.modules.has(e) && (this.checkRemoveController(e), this.modules.delete(e));
3296
+ }
3297
+ emitLoaded(e) {
3298
+ this.checkRemoveController(e), this.event.emit(e);
3299
+ }
3300
+ setModule(e, t, r) {
3301
+ const o = {
3302
+ key: e,
3303
+ status: "loaded",
3304
+ loading: !1,
3305
+ modules: t || {},
3306
+ ...r
3307
+ };
3308
+ return this.modules.set(e, o), this.emitLoaded(e), o;
3309
+ }
3310
+ cancel(e) {
3311
+ this.checkRemoveController(e);
3312
+ }
3313
+ checkRemoveController(e) {
3314
+ const t = this.modules.get(e);
3315
+ t?.controller && (t.controller?.abort?.(), delete t.controller, this.modules.set(e, t));
3316
+ }
3317
+ }
3318
+ var D = globalThis || window || self, un = (n, e = "config", t) => {
3319
+ const r = D[e], o = r || n;
3320
+ return r || (o ? D[e] = o : D[e] = {}), D[e];
3321
+ }, he = (n, e, t = "config") => {
3322
+ const r = un({}, t);
3323
+ if (n && typeof r[n] < "u")
3324
+ return r[n];
3325
+ if (n && e) {
3326
+ if (typeof e != "function" && (r[n] = e), typeof e == "function") {
3327
+ const o = e();
3328
+ if (o instanceof Promise)
3329
+ return o.then((s) => (r[n] = s, s));
3330
+ r[n] = o;
3331
+ }
3332
+ return r[n];
3333
+ }
3334
+ if (n) {
3335
+ const o = new ln(), s = async () => r[n];
3336
+ return (async () => (await o.load(s, {
3337
+ key: n,
3338
+ isReRun: !0,
3339
+ checkSuccess: () => r[n],
3340
+ timeout: 3e5,
3341
+ interval: 1e3
3342
+ })).code !== 200 ? (console.error("load key error"), null) : r[n])();
3343
+ }
3344
+ return console.error("key is empty "), null;
3345
+ }, hn = (n, e = "config", t) => {
3346
+ const r = un({}, e);
3347
+ if (n && delete r[n], t?.getNew && t.init)
3348
+ return he(n, t.init, e);
3349
+ if (t?.getNew)
3350
+ return he(n, null, e);
3351
+ }, de = (n, e, t) => t ? hn(n, "context", { getNew: !0, init: e }) : he(n, e, "context"), Ht = de, jt = (n, e, t) => t ? hn(n, "config", { getNew: !0, init: e }) : he(n, e, "config");
3352
+ class fe {
3353
+ static isInit = !1;
3354
+ static init(e) {
3355
+ if (fe.isInit)
3356
+ return;
3357
+ const { load: t = !0, page: r = !1 } = e || {};
3358
+ fe.isInit = !0, D.useConfigKey = jt, D.useContextKey = de, D.use = Ht, D.webEnv = { useConfigKey: jt, useContextKey: de, use: Ht }, t && (D.Load = ln);
3359
+ }
3360
+ }
3361
+ fe.init();
3362
+ const qr = de("login-emitter", nn), dn = "wxff97d569b1db16b6", Nr = '<svg t="1764510467010" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1958" width="32" height="32"><path d="M615.904 388.48c8.8 0 17.536 0.64 26.176 1.6-23.52-109.536-140.608-190.912-274.272-190.912C218.4 199.2 96 301.056 96 430.4c0 74.656 40.736 135.936 108.768 183.488l-27.2 81.792 95.04-47.648c33.984 6.72 61.28 13.632 95.2 13.632 8.544 0 16.992-0.416 25.376-1.088a202.496 202.496 0 0 1-8.384-56.96c0-118.752 101.984-215.136 231.104-215.136zM469.76 314.784c20.48 0 34.016 13.472 34.016 33.92 0 20.352-13.536 34.016-34.016 34.016-20.384 0-40.832-13.664-40.832-34.016 0-20.448 20.448-33.92 40.832-33.92zM279.52 382.72c-20.384 0-40.928-13.664-40.928-34.016 0-20.448 20.544-33.92 40.928-33.92 20.352 0 33.92 13.472 33.92 33.92 0 20.384-13.568 34.016-33.92 34.016z" fill="" p-id="1959"></path><path d="M864 600.352c0-108.672-108.736-197.28-230.88-197.28-129.344 0-231.2 88.576-231.2 197.28 0 108.864 101.856 197.248 231.2 197.248 27.072 0 54.368-6.816 81.568-13.632l74.56 40.8-20.448-67.904C823.328 715.936 864 661.664 864 600.352z m-305.856-34.016c-13.536 0-27.2-13.44-27.2-27.2 0-13.568 13.664-27.2 27.2-27.2 20.576 0 34.016 13.632 34.016 27.2 0 13.76-13.44 27.2-34.016 27.2z m149.536 0c-13.44 0-27.008-13.44-27.008-27.2 0-13.568 13.568-27.2 27.008-27.2 20.352 0 34.016 13.632 34.016 27.2 0 13.76-13.664 27.2-34.016 27.2z" fill="" p-id="1960"></path></svg>', Dr = '<svg t="1764511395617" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3882" width="32" height="32"><path d="M256 259.584c-29.184 0-51.2 14.848-51.2 44.032s29.184 44.032 51.2 44.032c29.184 0 44.032-14.848 44.032-44.032s-22.016-44.032-44.032-44.032zM541.184 303.616c0-29.184-14.848-44.032-44.032-44.032-29.184 0-51.2 14.848-51.2 44.032s29.184 44.032 51.2 44.032c29.696 0 44.032-22.016 44.032-44.032zM614.4 508.416c-14.848 0-36.352 14.848-36.352 36.352 0 14.848 14.848 36.352 36.352 36.352 29.184 0 44.032-14.848 44.032-36.352 0-14.336-14.848-36.352-44.032-36.352z" p-id="3883"></path><path d="M1024 625.152c0-138.752-124.416-256-285.184-270.848-29.184-153.6-189.952-263.168-373.248-263.168C160.768 91.648 0 230.4 0 406.016c0 95.232 44.032 175.616 138.752 241.152L109.568 742.4c0 7.168 0 14.848 7.168 22.016h14.848l117.248-58.368h14.848c36.352 7.168 66.048 14.848 109.568 14.848 14.848 0 44.032-7.168 44.032-7.168C460.8 822.784 578.048 896 716.8 896c36.352 0 73.216-7.168 102.4-14.848l87.552 51.2h14.848c7.168-7.168 7.168-7.168 7.168-14.848l-22.016-87.552c80.896-58.368 117.248-131.584 117.248-204.8z m-621.568 51.2h-36.352c-36.352 0-66.048-7.168-95.232-14.848l-22.016-7.168h-7.168L153.6 698.368l22.016-66.048c0-7.168 0-14.848-7.168-14.848C80.384 559.616 36.352 486.4 36.352 398.848 36.352 245.248 182.784 128 358.4 128c160.768 0 300.032 95.232 329.216 226.816-168.448 0-300.032 117.248-300.032 263.168 7.168 22.016 14.848 44.032 14.848 58.368z m467.968 132.096c-7.168 7.168-7.168 7.168-7.168 14.848l14.848 51.2L819.2 844.8h-14.848c-29.184 7.168-66.048 14.848-95.232 14.848-146.432 0-270.848-102.4-270.848-226.816 0-131.584 124.416-233.984 270.848-233.984s270.848 102.4 270.848 226.816c0 65.536-36.352 123.904-109.568 182.784z" p-id="3884"></path><path d="M804.352 508.416c-14.848 0-36.352 14.848-36.352 36.352 0 14.848 14.848 36.352 36.352 36.352 29.184 0 44.032-14.848 44.032-36.352 0-14.336-14.336-36.352-44.032-36.352z" p-id="3885"></path></svg>', Ur = '<svg t="1764511425462" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5097" width="32" height="32"><path d="M820.409449 797.228346q0 25.19685-10.07874 46.866142t-27.716535 38.299213-41.322835 26.204724-50.897638 9.574803l-357.795276 0q-27.212598 0-50.897638-9.574803t-41.322835-26.204724-27.716535-38.299213-10.07874-46.866142l0-675.275591q0-25.19685 10.07874-47.370079t27.716535-38.80315 41.322835-26.204724 50.897638-9.574803l357.795276 0q27.212598 0 50.897638 9.574803t41.322835 26.204724 27.716535 38.80315 10.07874 47.370079l0 675.275591zM738.771654 170.330709l-455.559055 0 0 577.511811 455.559055 0 0-577.511811zM510.992126 776.062992q-21.165354 0-36.787402 15.11811t-15.622047 37.291339q0 21.165354 15.622047 36.787402t36.787402 15.622047q22.173228 0 37.291339-15.622047t15.11811-36.787402q0-22.173228-15.11811-37.291339t-37.291339-15.11811zM591.622047 84.661417q0-8.062992-5.03937-12.598425t-11.086614-4.535433l-128 0q-5.03937 0-10.582677 4.535433t-5.543307 12.598425 5.03937 12.598425 11.086614 4.535433l128 0q6.047244 0 11.086614-4.535433t5.03937-12.598425z" p-id="5098"></path></svg>', Fr = '<svg t="1764511500570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10511" width="32" height="32"><path d="M768.9216 422.72768 372.06016 422.72768C378.88 365.21984 329.37984 131.42016 512.2048 125.72672c173.83424-6.59456 146.78016 213.34016 146.78016 213.34016l85.13536 0.57344c0 0 24.73984-294.4-231.91552-295.8336C232.09984 58.01984 297.82016 377.18016 289.28 422.72768c1.98656 0 4.56704 0 7.29088 0-55.88992 0-101.21216 45.34272-101.21216 101.21216l0 337.38752c0 55.88992 45.34272 101.21216 101.21216 101.21216l472.35072 0c55.88992 0 101.21216-45.34272 101.21216-101.21216L870.13376 523.93984C870.13376 468.0704 824.79104 422.72768 768.9216 422.72768zM566.4768 717.02528l0 76.84096c0 18.57536-15.1552 33.73056-33.73056 33.73056-18.57536 0-33.73056-15.1552-33.73056-33.73056l0-76.84096c-20.09088-11.69408-33.73056-33.21856-33.73056-58.12224 0-37.2736 30.208-67.4816 67.4816-67.4816 37.2736 0 67.4816 30.208 67.4816 67.4816C600.22784 683.80672 586.58816 705.3312 566.4768 717.02528z" fill="#272636" p-id="10512"></path></svg>', We = {
3363
+ pwd: Fr,
3364
+ phone: Ur,
3365
+ wxmpSvg: Nr,
3366
+ wxOpenSvg: Dr
3367
+ }, zr = [
2946
3368
  { id: "password", name: "密码登录", icon: "pwd" },
2947
3369
  { id: "wechat", name: "微信登录", icon: "wxmpSvg", appid: "wx9378885c8390e09b" },
2948
- { id: "wechat-mp", name: "微信公众号", icon: "wxOpenSvg", appid: Xt },
3370
+ { id: "wechat-mp", name: "微信公众号", icon: "wxOpenSvg", appid: dn },
2949
3371
  { id: "wechat-mp-ticket", name: "微信公众号", icon: "wxOpenSvg" },
2950
3372
  { id: "phone", name: "手机号登录", icon: "phone" }
2951
- ], Zt = () => {
2952
- const t = window.location.hostname;
3373
+ ], Hr = () => {
3374
+ const n = window.location.hostname;
2953
3375
  let e = [];
2954
- switch (t) {
3376
+ switch (n) {
2955
3377
  case "kevisual.xiongxiao.me":
2956
3378
  e = ["password", "wechat-mp"];
2957
3379
  break;
@@ -2962,12 +3384,11 @@ const mr = /* @__PURE__ */ Jn(pr), wr = (t) => {
2962
3384
  e = ["password", "phone", "wechat", "wechat-mp", "wechat-mp-ticket"];
2963
3385
  break;
2964
3386
  }
2965
- return Cr.filter((r) => e.includes(r.id));
3387
+ return zr.filter((t) => e.includes(t.id));
2966
3388
  };
2967
- console.log("可用登录方式:", Zt().map((t) => t.name).join(", "));
2968
- class Tr extends HTMLElement {
3389
+ class jr extends HTMLElement {
2969
3390
  selectedMethod = "password";
2970
- loginMethods = Zt();
3391
+ loginMethods = Hr();
2971
3392
  setLoginMethods(e) {
2972
3393
  this.loginMethods = e, this.render();
2973
3394
  }
@@ -2975,30 +3396,32 @@ class Tr extends HTMLElement {
2975
3396
  super();
2976
3397
  }
2977
3398
  connectedCallback() {
2978
- this.attachShadow({ mode: "open" }), this.render(), this.bindEvents(), Fn();
3399
+ this.attachShadow({ mode: "open" }), this.render(), this.bindEvents(), er();
2979
3400
  }
2980
3401
  #e = null;
2981
3402
  selectLoginMethod(e) {
2982
3403
  this.selectedMethod = e, this.render(), this.#e && (this.#e(), this.#e = null);
2983
3404
  }
2984
3405
  getMethodData(e) {
2985
- return this.loginMethods.find((r) => r.id === e);
3406
+ return this.loginMethods.find((t) => t.id === e);
2986
3407
  }
2987
3408
  bindEvents() {
2988
3409
  this.shadowRoot && (this.shadowRoot.addEventListener("click", (e) => {
2989
- const n = e.target.closest(".login-method");
2990
- if (n) {
2991
- const o = n.getAttribute("data-method");
3410
+ const r = e.target.closest(".login-method");
3411
+ if (r) {
3412
+ const o = r.getAttribute("data-method");
2992
3413
  o && this.selectLoginMethod(o);
2993
3414
  }
2994
3415
  }), this.shadowRoot.addEventListener("submit", (e) => {
2995
- const r = e.target;
2996
- r && r.id === "loginForm" && (e.preventDefault(), this.handleLogin());
3416
+ const t = e.target;
3417
+ t && t.id === "loginForm" && (e.preventDefault(), this.handleLogin());
3418
+ }), qr.on("login-success", () => {
3419
+ console.log("收到登录成功事件,处理后续逻辑");
2997
3420
  }));
2998
3421
  }
2999
3422
  handleLogin() {
3000
3423
  const e = this.getFormData();
3001
- In({
3424
+ Jn({
3002
3425
  loginMethod: this.selectedMethod,
3003
3426
  data: e
3004
3427
  }), this.dispatchEvent(new CustomEvent("login", {
@@ -3013,15 +3436,15 @@ class Tr extends HTMLElement {
3013
3436
  if (!this.shadowRoot) return {};
3014
3437
  switch (this.selectedMethod) {
3015
3438
  case "password":
3016
- const e = this.shadowRoot.querySelector("#username"), r = this.shadowRoot.querySelector("#password");
3439
+ const e = this.shadowRoot.querySelector("#username"), t = this.shadowRoot.querySelector("#password");
3017
3440
  return {
3018
3441
  username: e?.value || "",
3019
- password: r?.value || ""
3442
+ password: t?.value || ""
3020
3443
  };
3021
3444
  case "phone":
3022
- const n = this.shadowRoot.querySelector("#phone"), o = this.shadowRoot.querySelector("#code");
3445
+ const r = this.shadowRoot.querySelector("#phone"), o = this.shadowRoot.querySelector("#code");
3023
3446
  return {
3024
- phone: n?.value || "",
3447
+ phone: r?.value || "",
3025
3448
  code: o?.value || ""
3026
3449
  };
3027
3450
  case "wechat":
@@ -3037,7 +3460,7 @@ class Tr extends HTMLElement {
3037
3460
  }
3038
3461
  }
3039
3462
  renderPasswordForm() {
3040
- return L`
3463
+ return I`
3041
3464
  <form id="loginForm" class="login-form">
3042
3465
  <div class="form-group">
3043
3466
  <input
@@ -3064,7 +3487,7 @@ class Tr extends HTMLElement {
3064
3487
  `;
3065
3488
  }
3066
3489
  renderPhoneForm() {
3067
- return L`
3490
+ return I`
3068
3491
  <form id="loginForm" class="login-form">
3069
3492
  <div class="form-group">
3070
3493
  <input
@@ -3093,7 +3516,7 @@ class Tr extends HTMLElement {
3093
3516
  `;
3094
3517
  }
3095
3518
  renderWechatForm() {
3096
- return L`
3519
+ return I`
3097
3520
  <div class="wechat-login">
3098
3521
  <slot></slot>
3099
3522
  </div>
@@ -3102,9 +3525,9 @@ class Tr extends HTMLElement {
3102
3525
  renderWechatMpForm() {
3103
3526
  const e = this;
3104
3527
  return setTimeout(() => {
3105
- const r = e.shadowRoot.querySelector("#qrcode"), { clear: n } = wr(r);
3106
- e.#e = n;
3107
- }, 0), L`
3528
+ const t = e.shadowRoot.querySelector("#qrcode"), { clear: r } = Br(t);
3529
+ e.#e = r;
3530
+ }, 0), I`
3108
3531
  <div class="wechat-login">
3109
3532
  <div class="qr-container">
3110
3533
  <div class="qr-placeholder">
@@ -3118,15 +3541,15 @@ class Tr extends HTMLElement {
3118
3541
  renderWechatMpTicketForm() {
3119
3542
  const e = this;
3120
3543
  return setTimeout(async () => {
3121
- const r = await Vn();
3122
- if (!r) return;
3123
- const n = e.shadowRoot.querySelector(".qrcode");
3124
- if (r.url) {
3125
- n.src = r.url;
3126
- const o = Wn(r.ticket);
3544
+ const t = await or();
3545
+ if (!t) return;
3546
+ const r = e.shadowRoot.querySelector(".qrcode");
3547
+ if (t.url) {
3548
+ r.src = t.url;
3549
+ const o = sr(t.ticket);
3127
3550
  e.#e = o;
3128
3551
  }
3129
- }, 0), L`
3552
+ }, 0), I`
3130
3553
  <div class="wechat-login">
3131
3554
  <div class="qr-container">
3132
3555
  <div class="qr-placeholder">
@@ -3151,7 +3574,7 @@ class Tr extends HTMLElement {
3151
3574
  case "phone":
3152
3575
  return this.renderPhoneForm();
3153
3576
  case "wechat":
3154
- return On({ appid: e?.appid || "" }), this.renderWechatForm();
3577
+ return ir({ appid: e?.appid || "" }), this.renderWechatForm();
3155
3578
  case "wechat-mp":
3156
3579
  return this.renderWechatMpForm();
3157
3580
  case "wechat-mp-ticket":
@@ -3162,7 +3585,7 @@ class Tr extends HTMLElement {
3162
3585
  }
3163
3586
  render() {
3164
3587
  if (!this.shadowRoot) return;
3165
- const e = (n) => typeof n == "string" && !ze[n] ? L`<span class="method-icon-emoji">${n}</span>` : typeof n == "string" && ze[n] ? L`<span class="method-icon-svg">${nt(ze[n])}</span>` : typeof n == "string" && (n.includes("<svg") || n.includes("<?xml")) ? L`<span class="method-icon-svg">${nt(n)}</span>` : L`<span class="method-icon-emoji">${n}</span>`, r = L`
3588
+ const e = (r) => typeof r == "string" && !We[r] ? I`<span class="method-icon-emoji">${r}</span>` : typeof r == "string" && We[r] ? I`<span class="method-icon-svg">${at(We[r])}</span>` : typeof r == "string" && (r.includes("<svg") || r.includes("<?xml")) ? I`<span class="method-icon-svg">${at(r)}</span>` : I`<span class="method-icon-emoji">${r}</span>`, t = I`
3166
3589
  <style>
3167
3590
  :host {
3168
3591
  display: block;
@@ -3374,13 +3797,13 @@ class Tr extends HTMLElement {
3374
3797
 
3375
3798
  <div class="login-sidebar">
3376
3799
  <div class="login-methods">
3377
- ${this.loginMethods.map((n) => L`
3800
+ ${this.loginMethods.map((r) => I`
3378
3801
  <button
3379
- class="login-method ${this.selectedMethod === n.id ? "active" : ""}"
3380
- data-method="${n.id}"
3802
+ class="login-method ${this.selectedMethod === r.id ? "active" : ""}"
3803
+ data-method="${r.id}"
3381
3804
  >
3382
- ${e(n.icon)}
3383
- <span class="method-name">${n.name}</span>
3805
+ ${e(r.icon)}
3806
+ <span class="method-name">${r.name}</span>
3384
3807
  </button>
3385
3808
  `)}
3386
3809
  </div>
@@ -3390,7 +3813,7 @@ class Tr extends HTMLElement {
3390
3813
  </div>
3391
3814
  </div>
3392
3815
  `;
3393
- Ut(r, this.shadowRoot);
3816
+ Jt(t, this.shadowRoot);
3394
3817
  }
3395
3818
  }
3396
- customElements.define("kv-login", Tr);
3819
+ customElements.define("kv-login", jr);