@one-payments/web-components 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/images/pay-now.png +0 -0
- package/dist/index.js +847 -815
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +57 -27
- package/dist/one-payment.js.map +1 -1
- package/package.json +3 -2
- package/public/images/pay-now.png +0 -0
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const ye = globalThis, qe = ye.ShadowRoot && (ye.ShadyCSS === void 0 || ye.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ve = Symbol(),
|
|
6
|
+
const ye = globalThis, qe = ye.ShadowRoot && (ye.ShadyCSS === void 0 || ye.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ve = Symbol(), Je = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let ht = class {
|
|
8
|
-
constructor(e,
|
|
9
|
-
if (this._$cssResult$ = !0,
|
|
10
|
-
this.cssText = e, this.t =
|
|
8
|
+
constructor(e, r, n) {
|
|
9
|
+
if (this._$cssResult$ = !0, n !== Ve) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
|
+
this.cssText = e, this.t = r;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let e = this.o;
|
|
14
|
-
const
|
|
14
|
+
const r = this.t;
|
|
15
15
|
if (qe && e === void 0) {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const n = r !== void 0 && r.length === 1;
|
|
17
|
+
n && (e = Je.get(r)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && Je.set(r, e));
|
|
18
18
|
}
|
|
19
19
|
return e;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let ht = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const Ft = (t) => new ht(typeof t == "string" ? t : t + "", void 0, Ve), Lt = (t, ...e) => {
|
|
26
|
+
const r = t.length === 1 ? t[0] : e.reduce((n, i, o) => n + ((s) => {
|
|
27
27
|
if (s._$cssResult$ === !0) return s.cssText;
|
|
28
28
|
if (typeof s == "number") return s;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + s + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(i) + t[o + 1], t[0]);
|
|
31
|
-
return new ht(
|
|
32
|
-
},
|
|
33
|
-
if (qe) t.adoptedStyleSheets = e.map((
|
|
34
|
-
else for (const
|
|
35
|
-
const
|
|
36
|
-
i !== void 0 &&
|
|
31
|
+
return new ht(r, t, Ve);
|
|
32
|
+
}, Bt = (t, e) => {
|
|
33
|
+
if (qe) t.adoptedStyleSheets = e.map((r) => r instanceof CSSStyleSheet ? r : r.styleSheet);
|
|
34
|
+
else for (const r of e) {
|
|
35
|
+
const n = document.createElement("style"), i = ye.litNonce;
|
|
36
|
+
i !== void 0 && n.setAttribute("nonce", i), n.textContent = r.cssText, t.appendChild(n);
|
|
37
37
|
}
|
|
38
38
|
}, We = qe ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
|
|
39
|
-
let
|
|
40
|
-
for (const
|
|
41
|
-
return
|
|
39
|
+
let r = "";
|
|
40
|
+
for (const n of e.cssRules) r += n.cssText;
|
|
41
|
+
return Ft(r);
|
|
42
42
|
})(t) : t;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Ut, defineProperty: Ot, getOwnPropertyDescriptor: zt, getOwnPropertyNames: qt, getOwnPropertySymbols: Vt, getPrototypeOf: Ht } = Object, O = globalThis, Xe = O.trustedTypes,
|
|
48
|
+
const { is: Ut, defineProperty: Ot, getOwnPropertyDescriptor: zt, getOwnPropertyNames: qt, getOwnPropertySymbols: Vt, getPrototypeOf: Ht } = Object, O = globalThis, Xe = O.trustedTypes, jt = Xe ? Xe.emptyScript : "", Ie = O.reactiveElementPolyfillSupport, ie = (t, e) => t, be = { toAttribute(t, e) {
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
t = t ?
|
|
51
|
+
t = t ? jt : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -56,23 +56,23 @@ const { is: Ut, defineProperty: Ot, getOwnPropertyDescriptor: zt, getOwnProperty
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
}, fromAttribute(t, e) {
|
|
59
|
-
let
|
|
59
|
+
let r = t;
|
|
60
60
|
switch (e) {
|
|
61
61
|
case Boolean:
|
|
62
|
-
|
|
62
|
+
r = t !== null;
|
|
63
63
|
break;
|
|
64
64
|
case Number:
|
|
65
|
-
|
|
65
|
+
r = t === null ? null : Number(t);
|
|
66
66
|
break;
|
|
67
67
|
case Object:
|
|
68
68
|
case Array:
|
|
69
69
|
try {
|
|
70
|
-
|
|
70
|
+
r = JSON.parse(t);
|
|
71
71
|
} catch {
|
|
72
|
-
|
|
72
|
+
r = null;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return r;
|
|
76
76
|
} }, He = (t, e) => !Ut(t, e), et = { attribute: !0, type: String, converter: be, reflect: !1, useDefault: !1, hasChanged: He };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), O.litPropertyMetadata ?? (O.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
let Q = class extends HTMLElement {
|
|
@@ -82,21 +82,21 @@ let Q = class extends HTMLElement {
|
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(e,
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
85
|
+
static createProperty(e, r = et) {
|
|
86
|
+
if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(e, r), !r.noAccessor) {
|
|
87
|
+
const n = Symbol(), i = this.getPropertyDescriptor(e, n, r);
|
|
88
88
|
i !== void 0 && Ot(this.prototype, e, i);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
static getPropertyDescriptor(e,
|
|
91
|
+
static getPropertyDescriptor(e, r, n) {
|
|
92
92
|
const { get: i, set: o } = zt(this.prototype, e) ?? { get() {
|
|
93
|
-
return this[
|
|
93
|
+
return this[r];
|
|
94
94
|
}, set(s) {
|
|
95
|
-
this[
|
|
95
|
+
this[r] = s;
|
|
96
96
|
} };
|
|
97
97
|
return { get: i, set(s) {
|
|
98
98
|
const l = i == null ? void 0 : i.call(this);
|
|
99
|
-
o == null || o.call(this, s), this.requestUpdate(e, l,
|
|
99
|
+
o == null || o.call(this, s), this.requestUpdate(e, l, n);
|
|
100
100
|
}, configurable: !0, enumerable: !0 };
|
|
101
101
|
}
|
|
102
102
|
static getPropertyOptions(e) {
|
|
@@ -110,112 +110,112 @@ let Q = class extends HTMLElement {
|
|
|
110
110
|
static finalize() {
|
|
111
111
|
if (this.hasOwnProperty(ie("finalized"))) return;
|
|
112
112
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
|
|
113
|
-
const
|
|
114
|
-
for (const i of
|
|
113
|
+
const r = this.properties, n = [...qt(r), ...Vt(r)];
|
|
114
|
+
for (const i of n) this.createProperty(i, r[i]);
|
|
115
115
|
}
|
|
116
116
|
const e = this[Symbol.metadata];
|
|
117
117
|
if (e !== null) {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
118
|
+
const r = litPropertyMetadata.get(e);
|
|
119
|
+
if (r !== void 0) for (const [n, i] of r) this.elementProperties.set(n, i);
|
|
120
120
|
}
|
|
121
121
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
122
|
-
for (const [
|
|
123
|
-
const i = this._$Eu(
|
|
124
|
-
i !== void 0 && this._$Eh.set(i,
|
|
122
|
+
for (const [r, n] of this.elementProperties) {
|
|
123
|
+
const i = this._$Eu(r, n);
|
|
124
|
+
i !== void 0 && this._$Eh.set(i, r);
|
|
125
125
|
}
|
|
126
126
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
127
127
|
}
|
|
128
128
|
static finalizeStyles(e) {
|
|
129
|
-
const
|
|
129
|
+
const r = [];
|
|
130
130
|
if (Array.isArray(e)) {
|
|
131
|
-
const
|
|
132
|
-
for (const i of
|
|
133
|
-
} else e !== void 0 &&
|
|
134
|
-
return
|
|
131
|
+
const n = new Set(e.flat(1 / 0).reverse());
|
|
132
|
+
for (const i of n) r.unshift(We(i));
|
|
133
|
+
} else e !== void 0 && r.push(We(e));
|
|
134
|
+
return r;
|
|
135
135
|
}
|
|
136
|
-
static _$Eu(e,
|
|
137
|
-
const
|
|
138
|
-
return
|
|
136
|
+
static _$Eu(e, r) {
|
|
137
|
+
const n = r.attribute;
|
|
138
|
+
return n === !1 ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
139
139
|
}
|
|
140
140
|
constructor() {
|
|
141
141
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
142
142
|
}
|
|
143
143
|
_$Ev() {
|
|
144
144
|
var e;
|
|
145
|
-
this._$ES = new Promise((
|
|
145
|
+
this._$ES = new Promise((r) => this.enableUpdating = r), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((r) => r(this));
|
|
146
146
|
}
|
|
147
147
|
addController(e) {
|
|
148
|
-
var
|
|
149
|
-
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((
|
|
148
|
+
var r;
|
|
149
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((r = e.hostConnected) == null || r.call(e));
|
|
150
150
|
}
|
|
151
151
|
removeController(e) {
|
|
152
|
-
var
|
|
153
|
-
(
|
|
152
|
+
var r;
|
|
153
|
+
(r = this._$EO) == null || r.delete(e);
|
|
154
154
|
}
|
|
155
155
|
_$E_() {
|
|
156
|
-
const e = /* @__PURE__ */ new Map(),
|
|
157
|
-
for (const
|
|
156
|
+
const e = /* @__PURE__ */ new Map(), r = this.constructor.elementProperties;
|
|
157
|
+
for (const n of r.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
158
158
|
e.size > 0 && (this._$Ep = e);
|
|
159
159
|
}
|
|
160
160
|
createRenderRoot() {
|
|
161
161
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
162
|
-
return
|
|
162
|
+
return Bt(e, this.constructor.elementStyles), e;
|
|
163
163
|
}
|
|
164
164
|
connectedCallback() {
|
|
165
165
|
var e;
|
|
166
|
-
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((
|
|
167
|
-
var
|
|
168
|
-
return (
|
|
166
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((r) => {
|
|
167
|
+
var n;
|
|
168
|
+
return (n = r.hostConnected) == null ? void 0 : n.call(r);
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
enableUpdating(e) {
|
|
172
172
|
}
|
|
173
173
|
disconnectedCallback() {
|
|
174
174
|
var e;
|
|
175
|
-
(e = this._$EO) == null || e.forEach((
|
|
176
|
-
var
|
|
177
|
-
return (
|
|
175
|
+
(e = this._$EO) == null || e.forEach((r) => {
|
|
176
|
+
var n;
|
|
177
|
+
return (n = r.hostDisconnected) == null ? void 0 : n.call(r);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
attributeChangedCallback(e,
|
|
181
|
-
this._$AK(e,
|
|
180
|
+
attributeChangedCallback(e, r, n) {
|
|
181
|
+
this._$AK(e, n);
|
|
182
182
|
}
|
|
183
|
-
_$ET(e,
|
|
183
|
+
_$ET(e, r) {
|
|
184
184
|
var o;
|
|
185
|
-
const
|
|
186
|
-
if (i !== void 0 &&
|
|
187
|
-
const s = (((o =
|
|
185
|
+
const n = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, n);
|
|
186
|
+
if (i !== void 0 && n.reflect === !0) {
|
|
187
|
+
const s = (((o = n.converter) == null ? void 0 : o.toAttribute) !== void 0 ? n.converter : be).toAttribute(r, n.type);
|
|
188
188
|
this._$Em = e, s == null ? this.removeAttribute(i) : this.setAttribute(i, s), this._$Em = null;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
_$AK(e,
|
|
191
|
+
_$AK(e, r) {
|
|
192
192
|
var o, s;
|
|
193
|
-
const
|
|
193
|
+
const n = this.constructor, i = n._$Eh.get(e);
|
|
194
194
|
if (i !== void 0 && this._$Em !== i) {
|
|
195
|
-
const l =
|
|
195
|
+
const l = n.getPropertyOptions(i), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : be;
|
|
196
196
|
this._$Em = i;
|
|
197
|
-
const d = a.fromAttribute(
|
|
197
|
+
const d = a.fromAttribute(r, l.type);
|
|
198
198
|
this[i] = d ?? ((s = this._$Ej) == null ? void 0 : s.get(i)) ?? d, this._$Em = null;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
requestUpdate(e,
|
|
201
|
+
requestUpdate(e, r, n) {
|
|
202
202
|
var i;
|
|
203
203
|
if (e !== void 0) {
|
|
204
204
|
const o = this.constructor, s = this[e];
|
|
205
|
-
if (
|
|
206
|
-
this.C(e,
|
|
205
|
+
if (n ?? (n = o.getPropertyOptions(e)), !((n.hasChanged ?? He)(s, r) || n.useDefault && n.reflect && s === ((i = this._$Ej) == null ? void 0 : i.get(e)) && !this.hasAttribute(o._$Eu(e, n)))) return;
|
|
206
|
+
this.C(e, r, n);
|
|
207
207
|
}
|
|
208
208
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
209
209
|
}
|
|
210
|
-
C(e,
|
|
211
|
-
|
|
210
|
+
C(e, r, { useDefault: n, reflect: i, wrapped: o }, s) {
|
|
211
|
+
n && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, s ?? r ?? this[e]), o !== !0 || s !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (r = void 0), this._$AL.set(e, r)), i === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
|
|
212
212
|
}
|
|
213
213
|
async _$EP() {
|
|
214
214
|
this.isUpdatePending = !0;
|
|
215
215
|
try {
|
|
216
216
|
await this._$ES;
|
|
217
|
-
} catch (
|
|
218
|
-
Promise.reject(
|
|
217
|
+
} catch (r) {
|
|
218
|
+
Promise.reject(r);
|
|
219
219
|
}
|
|
220
220
|
const e = this.scheduleUpdate();
|
|
221
221
|
return e != null && await e, !this.isUpdatePending;
|
|
@@ -224,7 +224,7 @@ let Q = class extends HTMLElement {
|
|
|
224
224
|
return this.performUpdate();
|
|
225
225
|
}
|
|
226
226
|
performUpdate() {
|
|
227
|
-
var
|
|
227
|
+
var n;
|
|
228
228
|
if (!this.isUpdatePending) return;
|
|
229
229
|
if (!this.hasUpdated) {
|
|
230
230
|
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
@@ -238,24 +238,24 @@ let Q = class extends HTMLElement {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
let e = !1;
|
|
241
|
-
const
|
|
241
|
+
const r = this._$AL;
|
|
242
242
|
try {
|
|
243
|
-
e = this.shouldUpdate(
|
|
243
|
+
e = this.shouldUpdate(r), e ? (this.willUpdate(r), (n = this._$EO) == null || n.forEach((i) => {
|
|
244
244
|
var o;
|
|
245
245
|
return (o = i.hostUpdate) == null ? void 0 : o.call(i);
|
|
246
|
-
}), this.update(
|
|
246
|
+
}), this.update(r)) : this._$EM();
|
|
247
247
|
} catch (i) {
|
|
248
248
|
throw e = !1, this._$EM(), i;
|
|
249
249
|
}
|
|
250
|
-
e && this._$AE(
|
|
250
|
+
e && this._$AE(r);
|
|
251
251
|
}
|
|
252
252
|
willUpdate(e) {
|
|
253
253
|
}
|
|
254
254
|
_$AE(e) {
|
|
255
|
-
var
|
|
256
|
-
(
|
|
255
|
+
var r;
|
|
256
|
+
(r = this._$EO) == null || r.forEach((n) => {
|
|
257
257
|
var i;
|
|
258
|
-
return (i =
|
|
258
|
+
return (i = n.hostUpdated) == null ? void 0 : i.call(n);
|
|
259
259
|
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
260
260
|
}
|
|
261
261
|
_$EM() {
|
|
@@ -271,85 +271,85 @@ let Q = class extends HTMLElement {
|
|
|
271
271
|
return !0;
|
|
272
272
|
}
|
|
273
273
|
update(e) {
|
|
274
|
-
this._$Eq && (this._$Eq = this._$Eq.forEach((
|
|
274
|
+
this._$Eq && (this._$Eq = this._$Eq.forEach((r) => this._$ET(r, this[r]))), this._$EM();
|
|
275
275
|
}
|
|
276
276
|
updated(e) {
|
|
277
277
|
}
|
|
278
278
|
firstUpdated(e) {
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementProperties")] = /* @__PURE__ */ new Map(), Q[ie("finalized")] = /* @__PURE__ */ new Map(),
|
|
281
|
+
Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[ie("elementProperties")] = /* @__PURE__ */ new Map(), Q[ie("finalized")] = /* @__PURE__ */ new Map(), Ie == null || Ie({ ReactiveElement: Q }), (O.reactiveElementVersions ?? (O.reactiveElementVersions = [])).push("2.1.1");
|
|
282
282
|
/**
|
|
283
283
|
* @license
|
|
284
284
|
* Copyright 2017 Google LLC
|
|
285
285
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
286
|
*/
|
|
287
|
-
const oe = globalThis, we = oe.trustedTypes, tt = we ? we.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ft = "$lit$",
|
|
288
|
-
\f\r]`,
|
|
289
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, pt = /^(?:script|style|textarea|title)$/i, Qt = (t) => (e, ...
|
|
287
|
+
const oe = globalThis, we = oe.trustedTypes, tt = we ? we.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ft = "$lit$", B = `lit$${Math.random().toFixed(9).slice(2)}$`, mt = "?" + B, Yt = `<${mt}>`, K = document, le = () => K.createComment(""), de = (t) => t === null || typeof t != "object" && typeof t != "function", je = Array.isArray, Kt = (t) => je(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", _e = `[
|
|
288
|
+
\f\r]`, ne = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rt = /-->/g, nt = />/g, q = RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^
|
|
289
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, ot = /"/g, pt = /^(?:script|style|textarea|title)$/i, Qt = (t) => (e, ...r) => ({ _$litType$: t, strings: e, values: r }), A = Qt(1), G = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), H = K.createTreeWalker(K, 129);
|
|
290
290
|
function gt(t, e) {
|
|
291
|
-
if (!
|
|
291
|
+
if (!je(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
292
292
|
return tt !== void 0 ? tt.createHTML(e) : e;
|
|
293
293
|
}
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
let i, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", s =
|
|
297
|
-
for (let l = 0; l <
|
|
294
|
+
const Zt = (t, e) => {
|
|
295
|
+
const r = t.length - 1, n = [];
|
|
296
|
+
let i, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", s = ne;
|
|
297
|
+
for (let l = 0; l < r; l++) {
|
|
298
298
|
const a = t[l];
|
|
299
299
|
let d, c, h = -1, f = 0;
|
|
300
|
-
for (; f < a.length && (s.lastIndex = f, c = s.exec(a), c !== null); ) f = s.lastIndex, s ===
|
|
300
|
+
for (; f < a.length && (s.lastIndex = f, c = s.exec(a), c !== null); ) f = s.lastIndex, s === ne ? c[1] === "!--" ? s = rt : c[1] !== void 0 ? s = nt : c[2] !== void 0 ? (pt.test(c[2]) && (i = RegExp("</" + c[2], "g")), s = q) : c[3] !== void 0 && (s = q) : s === q ? c[0] === ">" ? (s = i ?? ne, h = -1) : c[1] === void 0 ? h = -2 : (h = s.lastIndex - c[2].length, d = c[1], s = c[3] === void 0 ? q : c[3] === '"' ? ot : it) : s === ot || s === it ? s = q : s === rt || s === nt ? s = ne : (s = q, i = void 0);
|
|
301
301
|
const u = s === q && t[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
-
o += s ===
|
|
302
|
+
o += s === ne ? a + Yt : h >= 0 ? (n.push(d), a.slice(0, h) + ft + a.slice(h) + B + u) : a + B + (h === -2 ? l : u);
|
|
303
303
|
}
|
|
304
|
-
return [gt(t, o + (t[
|
|
304
|
+
return [gt(t, o + (t[r] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), n];
|
|
305
305
|
};
|
|
306
306
|
class ce {
|
|
307
|
-
constructor({ strings: e, _$litType$:
|
|
307
|
+
constructor({ strings: e, _$litType$: r }, n) {
|
|
308
308
|
let i;
|
|
309
309
|
this.parts = [];
|
|
310
310
|
let o = 0, s = 0;
|
|
311
|
-
const l = e.length - 1, a = this.parts, [d, c] =
|
|
312
|
-
if (this.el = ce.createElement(d,
|
|
311
|
+
const l = e.length - 1, a = this.parts, [d, c] = Zt(e, r);
|
|
312
|
+
if (this.el = ce.createElement(d, n), H.currentNode = this.el.content, r === 2 || r === 3) {
|
|
313
313
|
const h = this.el.content.firstChild;
|
|
314
314
|
h.replaceWith(...h.childNodes);
|
|
315
315
|
}
|
|
316
|
-
for (; (i =
|
|
316
|
+
for (; (i = H.nextNode()) !== null && a.length < l; ) {
|
|
317
317
|
if (i.nodeType === 1) {
|
|
318
318
|
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ft)) {
|
|
319
|
-
const f = c[s++], u = i.getAttribute(h).split(
|
|
320
|
-
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ?
|
|
321
|
-
} else h.startsWith(
|
|
319
|
+
const f = c[s++], u = i.getAttribute(h).split(B), m = /([.?@])?(.*)/.exec(f);
|
|
320
|
+
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? Jt : m[1] === "?" ? Wt : m[1] === "@" ? Xt : Se }), i.removeAttribute(h);
|
|
321
|
+
} else h.startsWith(B) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
|
|
322
322
|
if (pt.test(i.tagName)) {
|
|
323
|
-
const h = i.textContent.split(
|
|
323
|
+
const h = i.textContent.split(B), f = h.length - 1;
|
|
324
324
|
if (f > 0) {
|
|
325
325
|
i.textContent = we ? we.emptyScript : "";
|
|
326
|
-
for (let u = 0; u < f; u++) i.append(h[u], le()),
|
|
326
|
+
for (let u = 0; u < f; u++) i.append(h[u], le()), H.nextNode(), a.push({ type: 2, index: ++o });
|
|
327
327
|
i.append(h[f], le());
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
} else if (i.nodeType === 8) if (i.data === mt) a.push({ type: 2, index: o });
|
|
331
331
|
else {
|
|
332
332
|
let h = -1;
|
|
333
|
-
for (; (h = i.data.indexOf(
|
|
333
|
+
for (; (h = i.data.indexOf(B, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += B.length - 1;
|
|
334
334
|
}
|
|
335
335
|
o++;
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
static createElement(e,
|
|
339
|
-
const
|
|
340
|
-
return
|
|
338
|
+
static createElement(e, r) {
|
|
339
|
+
const n = K.createElement("template");
|
|
340
|
+
return n.innerHTML = e, n;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function J(t, e, r = t, n) {
|
|
344
344
|
var s, l;
|
|
345
|
-
if (e ===
|
|
346
|
-
let i =
|
|
345
|
+
if (e === G) return e;
|
|
346
|
+
let i = n !== void 0 ? (s = r._$Co) == null ? void 0 : s[n] : r._$Cl;
|
|
347
347
|
const o = de(e) ? void 0 : e._$litDirective$;
|
|
348
|
-
return (i == null ? void 0 : i.constructor) !== o && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t,
|
|
348
|
+
return (i == null ? void 0 : i.constructor) !== o && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t, r, n)), n !== void 0 ? (r._$Co ?? (r._$Co = []))[n] = i : r._$Cl = i), i !== void 0 && (e = J(t, i._$AS(t, e.values), i, n)), e;
|
|
349
349
|
}
|
|
350
|
-
class
|
|
351
|
-
constructor(e,
|
|
352
|
-
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM =
|
|
350
|
+
class Gt {
|
|
351
|
+
constructor(e, r) {
|
|
352
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = r;
|
|
353
353
|
}
|
|
354
354
|
get parentNode() {
|
|
355
355
|
return this._$AM.parentNode;
|
|
@@ -358,21 +358,21 @@ class Jt {
|
|
|
358
358
|
return this._$AM._$AU;
|
|
359
359
|
}
|
|
360
360
|
u(e) {
|
|
361
|
-
const { el: { content:
|
|
362
|
-
|
|
363
|
-
let o =
|
|
361
|
+
const { el: { content: r }, parts: n } = this._$AD, i = ((e == null ? void 0 : e.creationScope) ?? K).importNode(r, !0);
|
|
362
|
+
H.currentNode = i;
|
|
363
|
+
let o = H.nextNode(), s = 0, l = 0, a = n[0];
|
|
364
364
|
for (; a !== void 0; ) {
|
|
365
365
|
if (s === a.index) {
|
|
366
366
|
let d;
|
|
367
|
-
a.type === 2 ? d = new he(o, o.nextSibling, this, e) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (d = new
|
|
367
|
+
a.type === 2 ? d = new he(o, o.nextSibling, this, e) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (d = new er(o, this, e)), this._$AV.push(d), a = n[++l];
|
|
368
368
|
}
|
|
369
|
-
s !== (a == null ? void 0 : a.index) && (o =
|
|
369
|
+
s !== (a == null ? void 0 : a.index) && (o = H.nextNode(), s++);
|
|
370
370
|
}
|
|
371
|
-
return
|
|
371
|
+
return H.currentNode = K, i;
|
|
372
372
|
}
|
|
373
373
|
p(e) {
|
|
374
|
-
let
|
|
375
|
-
for (const
|
|
374
|
+
let r = 0;
|
|
375
|
+
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++;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
class he {
|
|
@@ -380,13 +380,13 @@ class he {
|
|
|
380
380
|
var e;
|
|
381
381
|
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
382
382
|
}
|
|
383
|
-
constructor(e,
|
|
384
|
-
this.type = 2, this._$AH =
|
|
383
|
+
constructor(e, r, n, i) {
|
|
384
|
+
this.type = 2, this._$AH = I, this._$AN = void 0, this._$AA = e, this._$AB = r, this._$AM = n, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
|
|
385
385
|
}
|
|
386
386
|
get parentNode() {
|
|
387
387
|
let e = this._$AA.parentNode;
|
|
388
|
-
const
|
|
389
|
-
return
|
|
388
|
+
const r = this._$AM;
|
|
389
|
+
return r !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = r.parentNode), e;
|
|
390
390
|
}
|
|
391
391
|
get startNode() {
|
|
392
392
|
return this._$AA;
|
|
@@ -394,8 +394,8 @@ class he {
|
|
|
394
394
|
get endNode() {
|
|
395
395
|
return this._$AB;
|
|
396
396
|
}
|
|
397
|
-
_$AI(e,
|
|
398
|
-
e =
|
|
397
|
+
_$AI(e, r = this) {
|
|
398
|
+
e = J(this, e, r), de(e) ? e === I || e == null || e === "" ? (this._$AH !== I && this._$AR(), this._$AH = I) : e !== this._$AH && e !== G && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Kt(e) ? this.k(e) : this._(e);
|
|
399
399
|
}
|
|
400
400
|
O(e) {
|
|
401
401
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -404,38 +404,38 @@ class he {
|
|
|
404
404
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
405
405
|
}
|
|
406
406
|
_(e) {
|
|
407
|
-
this._$AH !==
|
|
407
|
+
this._$AH !== I && de(this._$AH) ? this._$AA.nextSibling.data = e : this.T(K.createTextNode(e)), this._$AH = e;
|
|
408
408
|
}
|
|
409
409
|
$(e) {
|
|
410
410
|
var o;
|
|
411
|
-
const { values:
|
|
412
|
-
if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(
|
|
411
|
+
const { values: r, _$litType$: n } = e, i = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = ce.createElement(gt(n.h, n.h[0]), this.options)), n);
|
|
412
|
+
if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(r);
|
|
413
413
|
else {
|
|
414
|
-
const s = new
|
|
415
|
-
s.p(
|
|
414
|
+
const s = new Gt(i, this), l = s.u(this.options);
|
|
415
|
+
s.p(r), this.T(l), this._$AH = s;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
_$AC(e) {
|
|
419
|
-
let
|
|
420
|
-
return
|
|
419
|
+
let r = st.get(e.strings);
|
|
420
|
+
return r === void 0 && st.set(e.strings, r = new ce(e)), r;
|
|
421
421
|
}
|
|
422
422
|
k(e) {
|
|
423
|
-
|
|
424
|
-
const
|
|
425
|
-
let
|
|
426
|
-
for (const o of e) i ===
|
|
427
|
-
i <
|
|
423
|
+
je(this._$AH) || (this._$AH = [], this._$AR());
|
|
424
|
+
const r = this._$AH;
|
|
425
|
+
let n, i = 0;
|
|
426
|
+
for (const o of e) i === r.length ? r.push(n = new he(this.O(le()), this.O(le()), this, this.options)) : n = r[i], n._$AI(o), i++;
|
|
427
|
+
i < r.length && (this._$AR(n && n._$AB.nextSibling, i), r.length = i);
|
|
428
428
|
}
|
|
429
|
-
_$AR(e = this._$AA.nextSibling,
|
|
430
|
-
var
|
|
431
|
-
for ((
|
|
429
|
+
_$AR(e = this._$AA.nextSibling, r) {
|
|
430
|
+
var n;
|
|
431
|
+
for ((n = this._$AP) == null ? void 0 : n.call(this, !1, !0, r); e !== this._$AB; ) {
|
|
432
432
|
const i = e.nextSibling;
|
|
433
433
|
e.remove(), e = i;
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
setConnected(e) {
|
|
437
|
-
var
|
|
438
|
-
this._$AM === void 0 && (this._$Cv = e, (
|
|
437
|
+
var r;
|
|
438
|
+
this._$AM === void 0 && (this._$Cv = e, (r = this._$AP) == null || r.call(this, e));
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
class Se {
|
|
@@ -445,30 +445,30 @@ class Se {
|
|
|
445
445
|
get _$AU() {
|
|
446
446
|
return this._$AM._$AU;
|
|
447
447
|
}
|
|
448
|
-
constructor(e,
|
|
449
|
-
this.type = 1, this._$AH =
|
|
448
|
+
constructor(e, r, n, i, o) {
|
|
449
|
+
this.type = 1, this._$AH = I, this._$AN = void 0, this.element = e, this.name = r, this._$AM = i, this.options = o, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = I;
|
|
450
450
|
}
|
|
451
|
-
_$AI(e,
|
|
451
|
+
_$AI(e, r = this, n, i) {
|
|
452
452
|
const o = this.strings;
|
|
453
453
|
let s = !1;
|
|
454
|
-
if (o === void 0) e =
|
|
454
|
+
if (o === void 0) e = J(this, e, r, 0), s = !de(e) || e !== this._$AH && e !== G, s && (this._$AH = e);
|
|
455
455
|
else {
|
|
456
456
|
const l = e;
|
|
457
457
|
let a, d;
|
|
458
|
-
for (e = o[0], a = 0; a < o.length - 1; a++) d =
|
|
458
|
+
for (e = o[0], a = 0; a < o.length - 1; a++) d = J(this, l[n + a], r, a), d === G && (d = this._$AH[a]), s || (s = !de(d) || d !== this._$AH[a]), d === I ? e = I : e !== I && (e += (d ?? "") + o[a + 1]), this._$AH[a] = d;
|
|
459
459
|
}
|
|
460
460
|
s && !i && this.j(e);
|
|
461
461
|
}
|
|
462
462
|
j(e) {
|
|
463
|
-
e ===
|
|
463
|
+
e === I ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class Jt extends Se {
|
|
467
467
|
constructor() {
|
|
468
468
|
super(...arguments), this.type = 3;
|
|
469
469
|
}
|
|
470
470
|
j(e) {
|
|
471
|
-
this.element[this.name] = e ===
|
|
471
|
+
this.element[this.name] = e === I ? void 0 : e;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
class Wt extends Se {
|
|
@@ -476,42 +476,42 @@ class Wt extends Se {
|
|
|
476
476
|
super(...arguments), this.type = 4;
|
|
477
477
|
}
|
|
478
478
|
j(e) {
|
|
479
|
-
this.element.toggleAttribute(this.name, !!e && e !==
|
|
479
|
+
this.element.toggleAttribute(this.name, !!e && e !== I);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
class Xt extends Se {
|
|
483
|
-
constructor(e,
|
|
484
|
-
super(e,
|
|
483
|
+
constructor(e, r, n, i, o) {
|
|
484
|
+
super(e, r, n, i, o), this.type = 5;
|
|
485
485
|
}
|
|
486
|
-
_$AI(e,
|
|
487
|
-
if ((e =
|
|
488
|
-
const
|
|
489
|
-
i && this.element.removeEventListener(this.name, this,
|
|
486
|
+
_$AI(e, r = this) {
|
|
487
|
+
if ((e = J(this, e, r, 0) ?? I) === G) return;
|
|
488
|
+
const n = this._$AH, i = e === I && n !== I || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, o = e !== I && (n === I || i);
|
|
489
|
+
i && this.element.removeEventListener(this.name, this, n), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
490
490
|
}
|
|
491
491
|
handleEvent(e) {
|
|
492
|
-
var
|
|
493
|
-
typeof this._$AH == "function" ? this._$AH.call(((
|
|
492
|
+
var r;
|
|
493
|
+
typeof this._$AH == "function" ? this._$AH.call(((r = this.options) == null ? void 0 : r.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
class
|
|
497
|
-
constructor(e,
|
|
498
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM =
|
|
496
|
+
class er {
|
|
497
|
+
constructor(e, r, n) {
|
|
498
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = n;
|
|
499
499
|
}
|
|
500
500
|
get _$AU() {
|
|
501
501
|
return this._$AM._$AU;
|
|
502
502
|
}
|
|
503
503
|
_$AI(e) {
|
|
504
|
-
|
|
504
|
+
J(this, e);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
let i =
|
|
507
|
+
const Me = oe.litHtmlPolyfillSupport;
|
|
508
|
+
Me == null || Me(ce, he), (oe.litHtmlVersions ?? (oe.litHtmlVersions = [])).push("3.3.1");
|
|
509
|
+
const tr = (t, e, r) => {
|
|
510
|
+
const n = (r == null ? void 0 : r.renderBefore) ?? e;
|
|
511
|
+
let i = n._$litPart$;
|
|
512
512
|
if (i === void 0) {
|
|
513
|
-
const o = (
|
|
514
|
-
|
|
513
|
+
const o = (r == null ? void 0 : r.renderBefore) ?? null;
|
|
514
|
+
n._$litPart$ = i = new he(e.insertBefore(le(), o), o, void 0, r ?? {});
|
|
515
515
|
}
|
|
516
516
|
return i._$AI(t), i;
|
|
517
517
|
};
|
|
@@ -526,13 +526,13 @@ class se extends Q {
|
|
|
526
526
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
527
527
|
}
|
|
528
528
|
createRenderRoot() {
|
|
529
|
-
var
|
|
529
|
+
var r;
|
|
530
530
|
const e = super.createRenderRoot();
|
|
531
|
-
return (
|
|
531
|
+
return (r = this.renderOptions).renderBefore ?? (r.renderBefore = e.firstChild), e;
|
|
532
532
|
}
|
|
533
533
|
update(e) {
|
|
534
|
-
const
|
|
535
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
534
|
+
const r = this.render();
|
|
535
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = tr(r, this.renderRoot, this.renderOptions);
|
|
536
536
|
}
|
|
537
537
|
connectedCallback() {
|
|
538
538
|
var e;
|
|
@@ -543,21 +543,21 @@ class se extends Q {
|
|
|
543
543
|
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
|
|
544
544
|
}
|
|
545
545
|
render() {
|
|
546
|
-
return
|
|
546
|
+
return G;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
var ut;
|
|
550
550
|
se._$litElement$ = !0, se.finalized = !0, (ut = Y.litElementHydrateSupport) == null || ut.call(Y, { LitElement: se });
|
|
551
|
-
const
|
|
552
|
-
|
|
551
|
+
const De = Y.litElementPolyfillSupport;
|
|
552
|
+
De == null || De({ LitElement: se });
|
|
553
553
|
(Y.litElementVersions ?? (Y.litElementVersions = [])).push("4.2.1");
|
|
554
554
|
/**
|
|
555
555
|
* @license
|
|
556
556
|
* Copyright 2017 Google LLC
|
|
557
557
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
558
558
|
*/
|
|
559
|
-
const
|
|
560
|
-
|
|
559
|
+
const rr = (t) => (e, r) => {
|
|
560
|
+
r !== void 0 ? r.addInitializer(() => {
|
|
561
561
|
customElements.define(t, e);
|
|
562
562
|
}) : customElements.define(t, e);
|
|
563
563
|
};
|
|
@@ -566,11 +566,11 @@ const nn = (t) => (e, n) => {
|
|
|
566
566
|
* Copyright 2017 Google LLC
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
|
-
const
|
|
570
|
-
const { kind:
|
|
569
|
+
const nr = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged: He }, ir = (t = nr, e, r) => {
|
|
570
|
+
const { kind: n, metadata: i } = r;
|
|
571
571
|
let o = globalThis.litPropertyMetadata.get(i);
|
|
572
|
-
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()),
|
|
573
|
-
const { name: s } =
|
|
572
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), n === "setter" && ((t = Object.create(t)).wrapped = !0), o.set(r.name, t), n === "accessor") {
|
|
573
|
+
const { name: s } = r;
|
|
574
574
|
return { set(l) {
|
|
575
575
|
const a = e.get.call(this);
|
|
576
576
|
e.set.call(this, l), this.requestUpdate(s, a, t);
|
|
@@ -578,36 +578,36 @@ const rn = { attribute: !0, type: String, converter: be, reflect: !1, hasChanged
|
|
|
578
578
|
return l !== void 0 && this.C(s, void 0, t, l), l;
|
|
579
579
|
} };
|
|
580
580
|
}
|
|
581
|
-
if (
|
|
582
|
-
const { name: s } =
|
|
581
|
+
if (n === "setter") {
|
|
582
|
+
const { name: s } = r;
|
|
583
583
|
return function(l) {
|
|
584
584
|
const a = this[s];
|
|
585
585
|
e.call(this, l), this.requestUpdate(s, a, t);
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
throw Error("Unsupported decorator location: " +
|
|
588
|
+
throw Error("Unsupported decorator location: " + n);
|
|
589
589
|
};
|
|
590
590
|
function $(t) {
|
|
591
|
-
return (e,
|
|
591
|
+
return (e, r) => typeof r == "object" ? ir(t, e, r) : ((n, i, o) => {
|
|
592
592
|
const s = i.hasOwnProperty(o);
|
|
593
|
-
return i.constructor.createProperty(o,
|
|
594
|
-
})(t, e,
|
|
593
|
+
return i.constructor.createProperty(o, n), s ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
594
|
+
})(t, e, r);
|
|
595
595
|
}
|
|
596
596
|
/**
|
|
597
597
|
* @license
|
|
598
598
|
* Copyright 2017 Google LLC
|
|
599
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
600
|
*/
|
|
601
|
-
function
|
|
601
|
+
function _(t) {
|
|
602
602
|
return $({ ...t, state: !0, attribute: !1 });
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function or(t) {
|
|
605
605
|
return t instanceof Error && ("response" in t && typeof t.response == "object" && t.response !== null || "data" in t && typeof t.data == "object" && t.data !== null);
|
|
606
606
|
}
|
|
607
|
-
var
|
|
607
|
+
var V = {
|
|
608
608
|
CARD: "card",
|
|
609
609
|
PAYNOW: "paynow"
|
|
610
|
-
},
|
|
610
|
+
}, D = {
|
|
611
611
|
IDLE: "idle",
|
|
612
612
|
INITIALIZING: "initializing",
|
|
613
613
|
READY: "ready",
|
|
@@ -616,12 +616,12 @@ var K = {
|
|
|
616
616
|
SUCCEEDED: "succeeded",
|
|
617
617
|
FAILED: "failed"
|
|
618
618
|
};
|
|
619
|
-
function
|
|
619
|
+
function sr(t) {
|
|
620
620
|
return t === "paid" ? "succeeded" : t;
|
|
621
621
|
}
|
|
622
|
-
var
|
|
623
|
-
constructor(t, e,
|
|
624
|
-
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = t, this.baseUrl = e, this.token =
|
|
622
|
+
var ar = class {
|
|
623
|
+
constructor(t, e, r, n, i = {}, o) {
|
|
624
|
+
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = t, this.baseUrl = e, this.token = r, this.onStatusUpdate = n, this.onPollStart = o, this.config = {
|
|
625
625
|
interval: i.interval ?? 3e3,
|
|
626
626
|
// 3 seconds default
|
|
627
627
|
maxAttempts: i.maxAttempts ?? 60,
|
|
@@ -707,7 +707,7 @@ var ln = class {
|
|
|
707
707
|
"x-token": this.token
|
|
708
708
|
}
|
|
709
709
|
), e = {
|
|
710
|
-
status:
|
|
710
|
+
status: sr(t.result.status),
|
|
711
711
|
// Map "paid" to "succeeded"
|
|
712
712
|
paymentIntentId: t.result.paymentIntentId || "",
|
|
713
713
|
...t.result.amount !== void 0 && { amount: t.result.amount },
|
|
@@ -743,7 +743,7 @@ var ln = class {
|
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
};
|
|
746
|
-
function
|
|
746
|
+
function lr(t) {
|
|
747
747
|
switch (t) {
|
|
748
748
|
case "prod":
|
|
749
749
|
return "https://public.one.ooo";
|
|
@@ -755,16 +755,16 @@ function dn(t) {
|
|
|
755
755
|
return "https://public.dev.one.ooo";
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
var
|
|
758
|
+
var dr = class {
|
|
759
759
|
// Flag to ignore qrCode after user scans it
|
|
760
760
|
constructor(t, e) {
|
|
761
|
-
this.state = { status:
|
|
761
|
+
this.state = { status: D.IDLE }, this.subscribers = /* @__PURE__ */ new Set(), this.eventListeners = {}, this.paymentToken = null, this.paymentIntentId = null, this.pollingService = null, this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.config = t, this.adapters = e;
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
764
764
|
* Get the API base URL - uses apiBaseUrl if provided, otherwise derives from environment
|
|
765
765
|
*/
|
|
766
766
|
getApiBaseUrl() {
|
|
767
|
-
return this.config.apiBaseUrl ??
|
|
767
|
+
return this.config.apiBaseUrl ?? lr(this.config.environment);
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
770
770
|
* Get the current payment state
|
|
@@ -867,10 +867,10 @@ var cn = class {
|
|
|
867
867
|
*/
|
|
868
868
|
on(t, e) {
|
|
869
869
|
this.eventListeners[t] || (this.eventListeners[t] = []);
|
|
870
|
-
const
|
|
871
|
-
return
|
|
872
|
-
const
|
|
873
|
-
|
|
870
|
+
const r = this.eventListeners[t];
|
|
871
|
+
return r.push(e), () => {
|
|
872
|
+
const n = r.indexOf(e);
|
|
873
|
+
n > -1 && r.splice(n, 1);
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
876
|
/**
|
|
@@ -913,7 +913,7 @@ var cn = class {
|
|
|
913
913
|
* @public
|
|
914
914
|
*/
|
|
915
915
|
async initialize(t) {
|
|
916
|
-
this.setState({ status:
|
|
916
|
+
this.setState({ status: D.INITIALIZING }), this.emit({
|
|
917
917
|
type: "initialize",
|
|
918
918
|
payload: t
|
|
919
919
|
});
|
|
@@ -923,12 +923,12 @@ var cn = class {
|
|
|
923
923
|
currency: t.currency,
|
|
924
924
|
notes: t.notes,
|
|
925
925
|
orderId: t.orderId
|
|
926
|
-
},
|
|
926
|
+
}, r = JSON.stringify(e), n = await this.adapters.crypto.hmacSHA256(this.config.secretKey, r), i = await this.adapters.http.post(
|
|
927
927
|
`${this.getApiBaseUrl()}/payment-intent/create`,
|
|
928
928
|
e,
|
|
929
929
|
{
|
|
930
930
|
"x-api-key": this.config.apiKey,
|
|
931
|
-
"x-signature":
|
|
931
|
+
"x-signature": n
|
|
932
932
|
}
|
|
933
933
|
), s = new URL(i.result.redirectUrl).searchParams.get("token");
|
|
934
934
|
if (!s)
|
|
@@ -948,7 +948,7 @@ var cn = class {
|
|
|
948
948
|
id: this.paymentIntentId,
|
|
949
949
|
amount: l.result.customerAmount || t.amount,
|
|
950
950
|
currency: l.result.currency || t.currency,
|
|
951
|
-
status:
|
|
951
|
+
status: D.READY,
|
|
952
952
|
...t.metadata && { metadata: t.metadata }
|
|
953
953
|
}, c = a.result.paymentMethods.map((h, f) => {
|
|
954
954
|
let u = null;
|
|
@@ -960,7 +960,7 @@ var cn = class {
|
|
|
960
960
|
};
|
|
961
961
|
}).filter((h) => h !== null);
|
|
962
962
|
return this.setState({
|
|
963
|
-
status:
|
|
963
|
+
status: D.READY,
|
|
964
964
|
paymentIntent: d,
|
|
965
965
|
availableMethods: c
|
|
966
966
|
}), this.emit({
|
|
@@ -971,17 +971,17 @@ var cn = class {
|
|
|
971
971
|
}
|
|
972
972
|
}), d;
|
|
973
973
|
} catch (e) {
|
|
974
|
-
const
|
|
974
|
+
const r = {
|
|
975
975
|
code: "INITIALIZATION_FAILED",
|
|
976
976
|
message: e instanceof Error ? e.message : "Unknown error",
|
|
977
977
|
timestamp: this.adapters.timer.now()
|
|
978
978
|
};
|
|
979
979
|
throw this.setState({
|
|
980
|
-
status:
|
|
981
|
-
error:
|
|
980
|
+
status: D.FAILED,
|
|
981
|
+
error: r
|
|
982
982
|
}), this.emit({
|
|
983
983
|
type: "payment_failed",
|
|
984
|
-
payload: { error:
|
|
984
|
+
payload: { error: r }
|
|
985
985
|
}), e;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
@@ -1038,21 +1038,21 @@ var cn = class {
|
|
|
1038
1038
|
* @public
|
|
1039
1039
|
*/
|
|
1040
1040
|
async submitPayment(t, e) {
|
|
1041
|
-
var
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1041
|
+
var n, i, o, s, l;
|
|
1042
|
+
const r = this.state;
|
|
1043
|
+
if (r.status !== "ready")
|
|
1044
1044
|
throw new Error("Cannot submit payment: SDK not in ready state");
|
|
1045
1045
|
if (!this.paymentToken)
|
|
1046
1046
|
throw new Error("Cannot submit payment: No payment token available");
|
|
1047
1047
|
this.ignore3DSInPolling = !1, this.ignoreQRInPolling = !1, this.setState({
|
|
1048
|
-
status:
|
|
1049
|
-
paymentIntent:
|
|
1048
|
+
status: D.PROCESSING,
|
|
1049
|
+
paymentIntent: r.paymentIntent,
|
|
1050
1050
|
selectedMethod: t,
|
|
1051
|
-
availableMethods:
|
|
1051
|
+
availableMethods: r.availableMethods
|
|
1052
1052
|
}), this.emit({
|
|
1053
1053
|
type: "payment_processing",
|
|
1054
1054
|
payload: {
|
|
1055
|
-
paymentIntent:
|
|
1055
|
+
paymentIntent: r.paymentIntent,
|
|
1056
1056
|
methodId: t
|
|
1057
1057
|
}
|
|
1058
1058
|
});
|
|
@@ -1079,16 +1079,16 @@ var cn = class {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
), this.startPolling(), {
|
|
1081
1081
|
id: this.paymentIntentId || "",
|
|
1082
|
-
amount:
|
|
1083
|
-
currency:
|
|
1084
|
-
status:
|
|
1082
|
+
amount: r.paymentIntent.amount,
|
|
1083
|
+
currency: r.paymentIntent.currency,
|
|
1084
|
+
status: D.PROCESSING
|
|
1085
1085
|
};
|
|
1086
1086
|
} catch (a) {
|
|
1087
1087
|
let d = "Unknown error", c = "PAYMENT_FAILED";
|
|
1088
1088
|
if (a instanceof Error)
|
|
1089
1089
|
try {
|
|
1090
|
-
if (
|
|
1091
|
-
const f = (
|
|
1090
|
+
if (or(a)) {
|
|
1091
|
+
const f = (n = a.response) == null ? void 0 : n.data, u = a.data;
|
|
1092
1092
|
f ? (d = f.message || ((i = f.error) == null ? void 0 : i.message) || a.message, c = f.code || ((o = f.error) == null ? void 0 : o.code) || c) : u ? (d = u.message || ((s = u.error) == null ? void 0 : s.message) || a.message, c = u.code || ((l = u.error) == null ? void 0 : l.code) || c) : d = a.message;
|
|
1093
1093
|
} else
|
|
1094
1094
|
d = a.message;
|
|
@@ -1101,14 +1101,14 @@ var cn = class {
|
|
|
1101
1101
|
timestamp: this.adapters.timer.now()
|
|
1102
1102
|
};
|
|
1103
1103
|
throw this.setState({
|
|
1104
|
-
status:
|
|
1104
|
+
status: D.FAILED,
|
|
1105
1105
|
error: h,
|
|
1106
|
-
paymentIntent:
|
|
1106
|
+
paymentIntent: r.paymentIntent
|
|
1107
1107
|
}), this.emit({
|
|
1108
1108
|
type: "payment_failed",
|
|
1109
1109
|
payload: {
|
|
1110
1110
|
error: h,
|
|
1111
|
-
paymentIntent:
|
|
1111
|
+
paymentIntent: r.paymentIntent
|
|
1112
1112
|
}
|
|
1113
1113
|
}), a;
|
|
1114
1114
|
}
|
|
@@ -1193,7 +1193,7 @@ var cn = class {
|
|
|
1193
1193
|
console.warn("Cannot start polling: no payment token available");
|
|
1194
1194
|
return;
|
|
1195
1195
|
}
|
|
1196
|
-
this.stopPolling(), this.pollingService = new
|
|
1196
|
+
this.stopPolling(), this.pollingService = new ar(
|
|
1197
1197
|
this.adapters,
|
|
1198
1198
|
this.getApiBaseUrl(),
|
|
1199
1199
|
this.paymentToken,
|
|
@@ -1265,30 +1265,30 @@ var cn = class {
|
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
1267
|
console.log("[SDK] nextActionUrl detected for 3DS");
|
|
1268
|
-
const
|
|
1268
|
+
const n = {
|
|
1269
1269
|
id: t.paymentIntentId,
|
|
1270
1270
|
amount: t.amount ?? e.paymentIntent.amount,
|
|
1271
1271
|
currency: t.currency ?? e.paymentIntent.currency,
|
|
1272
|
-
status:
|
|
1272
|
+
status: D.REQUIRES_ACTION,
|
|
1273
1273
|
...t.metadata && { metadata: t.metadata }
|
|
1274
1274
|
};
|
|
1275
1275
|
this.setState({
|
|
1276
|
-
status:
|
|
1277
|
-
paymentIntent:
|
|
1276
|
+
status: D.REQUIRES_ACTION,
|
|
1277
|
+
paymentIntent: n,
|
|
1278
1278
|
actionUrl: t.nextActionUrl,
|
|
1279
1279
|
selectedMethod: e.selectedMethod,
|
|
1280
1280
|
availableMethods: e.availableMethods
|
|
1281
1281
|
}), this.emit({
|
|
1282
1282
|
type: "payment_requires_action",
|
|
1283
1283
|
payload: {
|
|
1284
|
-
paymentIntent:
|
|
1284
|
+
paymentIntent: n,
|
|
1285
1285
|
actionUrl: t.nextActionUrl,
|
|
1286
1286
|
methodId: e.selectedMethod
|
|
1287
1287
|
}
|
|
1288
1288
|
});
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
|
-
const
|
|
1291
|
+
const r = {
|
|
1292
1292
|
id: t.paymentIntentId,
|
|
1293
1293
|
amount: t.amount ?? e.paymentIntent.amount,
|
|
1294
1294
|
currency: t.currency ?? e.paymentIntent.currency,
|
|
@@ -1297,13 +1297,13 @@ var cn = class {
|
|
|
1297
1297
|
};
|
|
1298
1298
|
if (t.status === "succeeded")
|
|
1299
1299
|
this.stopPolling(), this.setState({
|
|
1300
|
-
status:
|
|
1301
|
-
paymentIntent:
|
|
1300
|
+
status: D.SUCCEEDED,
|
|
1301
|
+
paymentIntent: r,
|
|
1302
1302
|
selectedMethod: e.selectedMethod
|
|
1303
1303
|
}), this.emit({
|
|
1304
1304
|
type: "payment_succeeded",
|
|
1305
1305
|
payload: {
|
|
1306
|
-
paymentIntent:
|
|
1306
|
+
paymentIntent: r,
|
|
1307
1307
|
methodId: e.selectedMethod
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
@@ -1315,14 +1315,14 @@ var cn = class {
|
|
|
1315
1315
|
timestamp: this.adapters.timer.now()
|
|
1316
1316
|
};
|
|
1317
1317
|
this.setState({
|
|
1318
|
-
status:
|
|
1318
|
+
status: D.FAILED,
|
|
1319
1319
|
error: i,
|
|
1320
|
-
paymentIntent:
|
|
1320
|
+
paymentIntent: r
|
|
1321
1321
|
}), this.emit({
|
|
1322
1322
|
type: "payment_failed",
|
|
1323
1323
|
payload: {
|
|
1324
1324
|
error: i,
|
|
1325
|
-
paymentIntent:
|
|
1325
|
+
paymentIntent: r
|
|
1326
1326
|
}
|
|
1327
1327
|
});
|
|
1328
1328
|
}
|
|
@@ -1332,8 +1332,8 @@ var cn = class {
|
|
|
1332
1332
|
*/
|
|
1333
1333
|
setState(t) {
|
|
1334
1334
|
const e = this.state.status;
|
|
1335
|
-
this.state = t, this.subscribers.forEach((
|
|
1336
|
-
|
|
1335
|
+
this.state = t, this.subscribers.forEach((r) => {
|
|
1336
|
+
r(this.state);
|
|
1337
1337
|
}), e !== t.status && this.emit({
|
|
1338
1338
|
type: "state_changed",
|
|
1339
1339
|
payload: {
|
|
@@ -1347,47 +1347,47 @@ var cn = class {
|
|
|
1347
1347
|
*/
|
|
1348
1348
|
emit(t) {
|
|
1349
1349
|
const e = this.eventListeners[t.type];
|
|
1350
|
-
e !== void 0 && e.forEach((
|
|
1351
|
-
|
|
1350
|
+
e !== void 0 && e.forEach((r) => {
|
|
1351
|
+
r(t);
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
|
-
},
|
|
1354
|
+
}, Z = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, j = function(t, e, r, n, i, o, s, l, a, d) {
|
|
1355
1355
|
var c = this;
|
|
1356
|
-
c.numeralDecimalMark = t || ".", c.numeralIntegerScale = e > 0 ? e : 0, c.numeralDecimalScale =
|
|
1356
|
+
c.numeralDecimalMark = t || ".", c.numeralIntegerScale = e > 0 ? e : 0, c.numeralDecimalScale = r >= 0 ? r : 2, c.numeralThousandsGroupStyle = n || j.groupStyle.thousand, c.numeralPositiveOnly = !!i, c.stripLeadingZeroes = o !== !1, c.prefix = s || s === "" ? s : "", c.signBeforePrefix = !!l, c.tailPrefix = !!a, c.delimiter = d || d === "" ? d : ",", c.delimiterRE = d ? new RegExp("\\" + d, "g") : "";
|
|
1357
1357
|
};
|
|
1358
|
-
|
|
1358
|
+
j.groupStyle = {
|
|
1359
1359
|
thousand: "thousand",
|
|
1360
1360
|
lakh: "lakh",
|
|
1361
1361
|
wan: "wan",
|
|
1362
1362
|
none: "none"
|
|
1363
1363
|
};
|
|
1364
|
-
|
|
1364
|
+
j.prototype = {
|
|
1365
1365
|
getRawValue: function(t) {
|
|
1366
1366
|
return t.replace(this.delimiterRE, "").replace(this.numeralDecimalMark, ".");
|
|
1367
1367
|
},
|
|
1368
1368
|
format: function(t) {
|
|
1369
|
-
var e = this,
|
|
1370
|
-
switch (t = t.replace(/[A-Za-z]/g, "").replace(e.numeralDecimalMark, "M").replace(/[^\dM-]/g, "").replace(/^\-/, "N").replace(/\-/g, "").replace("N", e.numeralPositiveOnly ? "" : "-").replace("M", e.numeralDecimalMark), e.stripLeadingZeroes && (t = t.replace(/^(-)?0+(?=\d)/, "$1")),
|
|
1371
|
-
case
|
|
1369
|
+
var e = this, r, n, i, o, s = "";
|
|
1370
|
+
switch (t = t.replace(/[A-Za-z]/g, "").replace(e.numeralDecimalMark, "M").replace(/[^\dM-]/g, "").replace(/^\-/, "N").replace(/\-/g, "").replace("N", e.numeralPositiveOnly ? "" : "-").replace("M", e.numeralDecimalMark), e.stripLeadingZeroes && (t = t.replace(/^(-)?0+(?=\d)/, "$1")), n = t.slice(0, 1) === "-" ? "-" : "", typeof e.prefix < "u" ? e.signBeforePrefix ? i = n + e.prefix : i = e.prefix + n : i = n, o = t, t.indexOf(e.numeralDecimalMark) >= 0 && (r = t.split(e.numeralDecimalMark), o = r[0], s = e.numeralDecimalMark + r[1].slice(0, e.numeralDecimalScale)), n === "-" && (o = o.slice(1)), e.numeralIntegerScale > 0 && (o = o.slice(0, e.numeralIntegerScale)), e.numeralThousandsGroupStyle) {
|
|
1371
|
+
case j.groupStyle.lakh:
|
|
1372
1372
|
o = o.replace(/(\d)(?=(\d\d)+\d$)/g, "$1" + e.delimiter);
|
|
1373
1373
|
break;
|
|
1374
|
-
case
|
|
1374
|
+
case j.groupStyle.wan:
|
|
1375
1375
|
o = o.replace(/(\d)(?=(\d{4})+$)/g, "$1" + e.delimiter);
|
|
1376
1376
|
break;
|
|
1377
|
-
case
|
|
1377
|
+
case j.groupStyle.thousand:
|
|
1378
1378
|
o = o.replace(/(\d)(?=(\d{3})+$)/g, "$1" + e.delimiter);
|
|
1379
1379
|
break;
|
|
1380
1380
|
}
|
|
1381
|
-
return e.tailPrefix ?
|
|
1381
|
+
return e.tailPrefix ? n + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "") + e.prefix : i + o.toString() + (e.numeralDecimalScale > 0 ? s.toString() : "");
|
|
1382
1382
|
}
|
|
1383
1383
|
};
|
|
1384
|
-
var
|
|
1385
|
-
var
|
|
1386
|
-
|
|
1384
|
+
var cr = j, yt = function(t, e, r) {
|
|
1385
|
+
var n = this;
|
|
1386
|
+
n.date = [], n.blocks = [], n.datePattern = t, n.dateMin = e.split("-").reverse().map(function(i) {
|
|
1387
1387
|
return parseInt(i, 10);
|
|
1388
|
-
}),
|
|
1388
|
+
}), n.dateMin.length === 2 && n.dateMin.unshift(0), n.dateMax = r.split("-").reverse().map(function(i) {
|
|
1389
1389
|
return parseInt(i, 10);
|
|
1390
|
-
}),
|
|
1390
|
+
}), n.dateMax.length === 2 && n.dateMax.unshift(0), n.initBlocks();
|
|
1391
1391
|
};
|
|
1392
1392
|
yt.prototype = {
|
|
1393
1393
|
initBlocks: function() {
|
|
@@ -1404,10 +1404,10 @@ yt.prototype = {
|
|
|
1404
1404
|
return this.blocks;
|
|
1405
1405
|
},
|
|
1406
1406
|
getValidatedDate: function(t) {
|
|
1407
|
-
var e = this,
|
|
1408
|
-
return t = t.replace(/[^\d]/g, ""), e.blocks.forEach(function(
|
|
1407
|
+
var e = this, r = "";
|
|
1408
|
+
return t = t.replace(/[^\d]/g, ""), e.blocks.forEach(function(n, i) {
|
|
1409
1409
|
if (t.length > 0) {
|
|
1410
|
-
var o = t.slice(0,
|
|
1410
|
+
var o = t.slice(0, n), s = o.slice(0, 1), l = t.slice(n);
|
|
1411
1411
|
switch (e.datePattern[i]) {
|
|
1412
1412
|
case "d":
|
|
1413
1413
|
o === "00" ? o = "01" : parseInt(s, 10) > 3 ? o = "0" + s : parseInt(o, 10) > 31 && (o = "31");
|
|
@@ -1416,47 +1416,47 @@ yt.prototype = {
|
|
|
1416
1416
|
o === "00" ? o = "01" : parseInt(s, 10) > 1 ? o = "0" + s : parseInt(o, 10) > 12 && (o = "12");
|
|
1417
1417
|
break;
|
|
1418
1418
|
}
|
|
1419
|
-
|
|
1419
|
+
r += o, t = l;
|
|
1420
1420
|
}
|
|
1421
|
-
}), this.getFixedDateString(
|
|
1421
|
+
}), this.getFixedDateString(r);
|
|
1422
1422
|
},
|
|
1423
1423
|
getFixedDateString: function(t) {
|
|
1424
|
-
var e = this,
|
|
1425
|
-
t.length === 4 &&
|
|
1424
|
+
var e = this, r = e.datePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h, f, u = !1;
|
|
1425
|
+
t.length === 4 && r[0].toLowerCase() !== "y" && r[1].toLowerCase() !== "y" && (l = r[0] === "d" ? 0 : 2, a = 2 - l, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), n = this.getFixedDate(c, h, 0)), t.length === 8 && (r.forEach(function(p, k) {
|
|
1426
1426
|
switch (p) {
|
|
1427
1427
|
case "d":
|
|
1428
|
-
i =
|
|
1428
|
+
i = k;
|
|
1429
1429
|
break;
|
|
1430
1430
|
case "m":
|
|
1431
|
-
o =
|
|
1431
|
+
o = k;
|
|
1432
1432
|
break;
|
|
1433
1433
|
default:
|
|
1434
|
-
s =
|
|
1434
|
+
s = k;
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
|
-
}), d = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 4), 10), u = t.slice(d, d + 4).length === 4,
|
|
1438
|
-
var m =
|
|
1439
|
-
switch (
|
|
1437
|
+
}), d = s * 2, l = i <= s ? i * 2 : i * 2 + 2, a = o <= s ? o * 2 : o * 2 + 2, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 4), 10), u = t.slice(d, d + 4).length === 4, n = this.getFixedDate(c, h, f)), t.length === 4 && (r[0] === "y" || r[1] === "y") && (a = r[0] === "m" ? 0 : 2, d = 2 - a, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), u = t.slice(d, d + 2).length === 2, n = [0, h, f]), t.length === 6 && (r[0] === "Y" || r[1] === "Y") && (a = r[0] === "m" ? 0 : 4, d = 2 - 0.5 * a, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 4), 10), u = t.slice(d, d + 4).length === 4, n = [0, h, f]), n = e.getRangeFixedDate(n), e.date = n;
|
|
1438
|
+
var m = n.length === 0 ? t : r.reduce(function(p, k) {
|
|
1439
|
+
switch (k) {
|
|
1440
1440
|
case "d":
|
|
1441
|
-
return p + (
|
|
1441
|
+
return p + (n[0] === 0 ? "" : e.addLeadingZero(n[0]));
|
|
1442
1442
|
case "m":
|
|
1443
|
-
return p + (
|
|
1443
|
+
return p + (n[1] === 0 ? "" : e.addLeadingZero(n[1]));
|
|
1444
1444
|
case "y":
|
|
1445
|
-
return p + (u ? e.addLeadingZeroForYear(
|
|
1445
|
+
return p + (u ? e.addLeadingZeroForYear(n[2], !1) : "");
|
|
1446
1446
|
case "Y":
|
|
1447
|
-
return p + (u ? e.addLeadingZeroForYear(
|
|
1447
|
+
return p + (u ? e.addLeadingZeroForYear(n[2], !0) : "");
|
|
1448
1448
|
}
|
|
1449
1449
|
}, "");
|
|
1450
1450
|
return m;
|
|
1451
1451
|
},
|
|
1452
1452
|
getRangeFixedDate: function(t) {
|
|
1453
|
-
var e = this,
|
|
1454
|
-
return !t.length ||
|
|
1453
|
+
var e = this, r = e.datePattern, n = e.dateMin || [], i = e.dateMax || [];
|
|
1454
|
+
return !t.length || n.length < 3 && i.length < 3 || r.find(function(o) {
|
|
1455
1455
|
return o.toLowerCase() === "y";
|
|
1456
|
-
}) && t[2] === 0 ? t : i.length && (i[2] < t[2] || i[2] === t[2] && (i[1] < t[1] || i[1] === t[1] && i[0] < t[0])) ? i :
|
|
1456
|
+
}) && t[2] === 0 ? t : i.length && (i[2] < t[2] || i[2] === t[2] && (i[1] < t[1] || i[1] === t[1] && i[0] < t[0])) ? i : n.length && (n[2] > t[2] || n[2] === t[2] && (n[1] > t[1] || n[1] === t[1] && n[0] > t[0])) ? n : t;
|
|
1457
1457
|
},
|
|
1458
|
-
getFixedDate: function(t, e,
|
|
1459
|
-
return t = Math.min(t, 31), e = Math.min(e, 12),
|
|
1458
|
+
getFixedDate: function(t, e, r) {
|
|
1459
|
+
return t = Math.min(t, 31), e = Math.min(e, 12), r = parseInt(r || 0, 10), (e < 7 && e % 2 === 0 || e > 8 && e % 2 === 1) && (t = Math.min(t, e === 2 ? this.isLeapYear(r) ? 29 : 28 : 30)), [t, e, r];
|
|
1460
1460
|
},
|
|
1461
1461
|
isLeapYear: function(t) {
|
|
1462
1462
|
return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;
|
|
@@ -1468,9 +1468,9 @@ yt.prototype = {
|
|
|
1468
1468
|
return e ? (t < 10 ? "000" : t < 100 ? "00" : t < 1e3 ? "0" : "") + t : (t < 10 ? "0" : "") + t;
|
|
1469
1469
|
}
|
|
1470
1470
|
};
|
|
1471
|
-
var
|
|
1472
|
-
var
|
|
1473
|
-
|
|
1471
|
+
var ur = yt, bt = function(t, e) {
|
|
1472
|
+
var r = this;
|
|
1473
|
+
r.time = [], r.blocks = [], r.timePattern = t, r.timeFormat = e, r.initBlocks();
|
|
1474
1474
|
};
|
|
1475
1475
|
bt.prototype = {
|
|
1476
1476
|
initBlocks: function() {
|
|
@@ -1501,28 +1501,28 @@ bt.prototype = {
|
|
|
1501
1501
|
};
|
|
1502
1502
|
},
|
|
1503
1503
|
getValidatedTime: function(t) {
|
|
1504
|
-
var e = this,
|
|
1504
|
+
var e = this, r = "";
|
|
1505
1505
|
t = t.replace(/[^\d]/g, "");
|
|
1506
|
-
var
|
|
1506
|
+
var n = e.getTimeFormatOptions();
|
|
1507
1507
|
return e.blocks.forEach(function(i, o) {
|
|
1508
1508
|
if (t.length > 0) {
|
|
1509
1509
|
var s = t.slice(0, i), l = s.slice(0, 1), a = t.slice(i);
|
|
1510
1510
|
switch (e.timePattern[o]) {
|
|
1511
1511
|
case "h":
|
|
1512
|
-
parseInt(l, 10) >
|
|
1512
|
+
parseInt(l, 10) > n.maxHourFirstDigit ? s = "0" + l : parseInt(s, 10) > n.maxHours && (s = n.maxHours + "");
|
|
1513
1513
|
break;
|
|
1514
1514
|
case "m":
|
|
1515
1515
|
case "s":
|
|
1516
|
-
parseInt(l, 10) >
|
|
1516
|
+
parseInt(l, 10) > n.maxMinutesFirstDigit ? s = "0" + l : parseInt(s, 10) > n.maxMinutes && (s = n.maxMinutes + "");
|
|
1517
1517
|
break;
|
|
1518
1518
|
}
|
|
1519
|
-
|
|
1519
|
+
r += s, t = a;
|
|
1520
1520
|
}
|
|
1521
|
-
}), this.getFixedTimeString(
|
|
1521
|
+
}), this.getFixedTimeString(r);
|
|
1522
1522
|
},
|
|
1523
1523
|
getFixedTimeString: function(t) {
|
|
1524
|
-
var e = this,
|
|
1525
|
-
return t.length === 6 && (
|
|
1524
|
+
var e = this, r = e.timePattern, n = [], i = 0, o = 0, s = 0, l = 0, a = 0, d = 0, c, h, f;
|
|
1525
|
+
return t.length === 6 && (r.forEach(function(u, m) {
|
|
1526
1526
|
switch (u) {
|
|
1527
1527
|
case "s":
|
|
1528
1528
|
i = m * 2;
|
|
@@ -1534,7 +1534,7 @@ bt.prototype = {
|
|
|
1534
1534
|
s = m * 2;
|
|
1535
1535
|
break;
|
|
1536
1536
|
}
|
|
1537
|
-
}), d = s, a = o, l = i, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10),
|
|
1537
|
+
}), d = s, a = o, l = i, c = parseInt(t.slice(l, l + 2), 10), h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), n = this.getFixedTime(f, h, c)), t.length === 4 && e.timePattern.indexOf("s") < 0 && (r.forEach(function(u, m) {
|
|
1538
1538
|
switch (u) {
|
|
1539
1539
|
case "m":
|
|
1540
1540
|
o = m * 2;
|
|
@@ -1543,27 +1543,27 @@ bt.prototype = {
|
|
|
1543
1543
|
s = m * 2;
|
|
1544
1544
|
break;
|
|
1545
1545
|
}
|
|
1546
|
-
}), d = s, a = o, c = 0, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10),
|
|
1546
|
+
}), d = s, a = o, c = 0, h = parseInt(t.slice(a, a + 2), 10), f = parseInt(t.slice(d, d + 2), 10), n = this.getFixedTime(f, h, c)), e.time = n, n.length === 0 ? t : r.reduce(function(u, m) {
|
|
1547
1547
|
switch (m) {
|
|
1548
1548
|
case "s":
|
|
1549
|
-
return u + e.addLeadingZero(
|
|
1549
|
+
return u + e.addLeadingZero(n[2]);
|
|
1550
1550
|
case "m":
|
|
1551
|
-
return u + e.addLeadingZero(
|
|
1551
|
+
return u + e.addLeadingZero(n[1]);
|
|
1552
1552
|
case "h":
|
|
1553
|
-
return u + e.addLeadingZero(
|
|
1553
|
+
return u + e.addLeadingZero(n[0]);
|
|
1554
1554
|
}
|
|
1555
1555
|
}, "");
|
|
1556
1556
|
},
|
|
1557
|
-
getFixedTime: function(t, e,
|
|
1558
|
-
return
|
|
1557
|
+
getFixedTime: function(t, e, r) {
|
|
1558
|
+
return r = Math.min(parseInt(r || 0, 10), 60), e = Math.min(e, 60), t = Math.min(t, 60), [t, e, r];
|
|
1559
1559
|
},
|
|
1560
1560
|
addLeadingZero: function(t) {
|
|
1561
1561
|
return (t < 10 ? "0" : "") + t;
|
|
1562
1562
|
}
|
|
1563
1563
|
};
|
|
1564
|
-
var
|
|
1565
|
-
var
|
|
1566
|
-
|
|
1564
|
+
var hr = bt, wt = function(t, e) {
|
|
1565
|
+
var r = this;
|
|
1566
|
+
r.delimiter = e || e === "" ? e : " ", r.delimiterRE = e ? new RegExp("\\" + e, "g") : "", r.formatter = t;
|
|
1567
1567
|
};
|
|
1568
1568
|
wt.prototype = {
|
|
1569
1569
|
setFormatter: function(t) {
|
|
@@ -1572,12 +1572,12 @@ wt.prototype = {
|
|
|
1572
1572
|
format: function(t) {
|
|
1573
1573
|
var e = this;
|
|
1574
1574
|
e.formatter.clear(), t = t.replace(/[^\d+]/g, ""), t = t.replace(/^\+/, "B").replace(/\+/g, "").replace("B", "+"), t = t.replace(e.delimiterRE, "");
|
|
1575
|
-
for (var
|
|
1576
|
-
|
|
1577
|
-
return
|
|
1575
|
+
for (var r = "", n, i = !1, o = 0, s = t.length; o < s; o++)
|
|
1576
|
+
n = e.formatter.inputDigit(t.charAt(o)), /[\s()-]/g.test(n) ? (r = n, i = !0) : i || (r = n);
|
|
1577
|
+
return r = r.replace(/[()]/g, ""), r = r.replace(/[\s-]/g, e.delimiter), r;
|
|
1578
1578
|
}
|
|
1579
1579
|
};
|
|
1580
|
-
var
|
|
1580
|
+
var fr = wt, Le = {
|
|
1581
1581
|
blocks: {
|
|
1582
1582
|
uatp: [4, 5, 6],
|
|
1583
1583
|
amex: [4, 6, 5],
|
|
@@ -1623,17 +1623,17 @@ var mn = wt, Be = {
|
|
|
1623
1623
|
unionPay: /^(62|81)\d{0,14}/
|
|
1624
1624
|
},
|
|
1625
1625
|
getStrictBlocks: function(t) {
|
|
1626
|
-
var e = t.reduce(function(
|
|
1627
|
-
return
|
|
1626
|
+
var e = t.reduce(function(r, n) {
|
|
1627
|
+
return r + n;
|
|
1628
1628
|
}, 0);
|
|
1629
1629
|
return t.concat(19 - e);
|
|
1630
1630
|
},
|
|
1631
1631
|
getInfo: function(t, e) {
|
|
1632
|
-
var
|
|
1632
|
+
var r = Le.blocks, n = Le.re;
|
|
1633
1633
|
e = !!e;
|
|
1634
|
-
for (var i in
|
|
1635
|
-
if (
|
|
1636
|
-
var o =
|
|
1634
|
+
for (var i in n)
|
|
1635
|
+
if (n[i].test(t)) {
|
|
1636
|
+
var o = r[i];
|
|
1637
1637
|
return {
|
|
1638
1638
|
type: i,
|
|
1639
1639
|
blocks: e ? this.getStrictBlocks(o) : o
|
|
@@ -1641,42 +1641,42 @@ var mn = wt, Be = {
|
|
|
1641
1641
|
}
|
|
1642
1642
|
return {
|
|
1643
1643
|
type: "unknown",
|
|
1644
|
-
blocks: e ? this.getStrictBlocks(
|
|
1644
|
+
blocks: e ? this.getStrictBlocks(r.general) : r.general
|
|
1645
1645
|
};
|
|
1646
1646
|
}
|
|
1647
|
-
},
|
|
1647
|
+
}, mr = Le, pr = {
|
|
1648
1648
|
noop: function() {
|
|
1649
1649
|
},
|
|
1650
1650
|
strip: function(t, e) {
|
|
1651
1651
|
return t.replace(e, "");
|
|
1652
1652
|
},
|
|
1653
|
-
getPostDelimiter: function(t, e,
|
|
1654
|
-
if (
|
|
1653
|
+
getPostDelimiter: function(t, e, r) {
|
|
1654
|
+
if (r.length === 0)
|
|
1655
1655
|
return t.slice(-e.length) === e ? e : "";
|
|
1656
|
-
var
|
|
1657
|
-
return
|
|
1658
|
-
t.slice(-i.length) === i && (
|
|
1659
|
-
}),
|
|
1656
|
+
var n = "";
|
|
1657
|
+
return r.forEach(function(i) {
|
|
1658
|
+
t.slice(-i.length) === i && (n = i);
|
|
1659
|
+
}), n;
|
|
1660
1660
|
},
|
|
1661
1661
|
getDelimiterREByDelimiter: function(t) {
|
|
1662
1662
|
return new RegExp(t.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"), "g");
|
|
1663
1663
|
},
|
|
1664
|
-
getNextCursorPosition: function(t, e,
|
|
1665
|
-
return e.length === t ?
|
|
1664
|
+
getNextCursorPosition: function(t, e, r, n, i) {
|
|
1665
|
+
return e.length === t ? r.length : t + this.getPositionOffset(t, e, r, n, i);
|
|
1666
1666
|
},
|
|
1667
|
-
getPositionOffset: function(t, e,
|
|
1667
|
+
getPositionOffset: function(t, e, r, n, i) {
|
|
1668
1668
|
var o, s, l;
|
|
1669
|
-
return o = this.stripDelimiters(e.slice(0, t),
|
|
1669
|
+
return o = this.stripDelimiters(e.slice(0, t), n, i), s = this.stripDelimiters(r.slice(0, t), n, i), l = o.length - s.length, l !== 0 ? l / Math.abs(l) : 0;
|
|
1670
1670
|
},
|
|
1671
|
-
stripDelimiters: function(t, e,
|
|
1672
|
-
var
|
|
1673
|
-
if (
|
|
1674
|
-
var i = e ?
|
|
1671
|
+
stripDelimiters: function(t, e, r) {
|
|
1672
|
+
var n = this;
|
|
1673
|
+
if (r.length === 0) {
|
|
1674
|
+
var i = e ? n.getDelimiterREByDelimiter(e) : "";
|
|
1675
1675
|
return t.replace(i, "");
|
|
1676
1676
|
}
|
|
1677
|
-
return
|
|
1677
|
+
return r.forEach(function(o) {
|
|
1678
1678
|
o.split("").forEach(function(s) {
|
|
1679
|
-
t = t.replace(
|
|
1679
|
+
t = t.replace(n.getDelimiterREByDelimiter(s), "");
|
|
1680
1680
|
});
|
|
1681
1681
|
}), t;
|
|
1682
1682
|
},
|
|
@@ -1684,8 +1684,8 @@ var mn = wt, Be = {
|
|
|
1684
1684
|
return t.slice(0, e);
|
|
1685
1685
|
},
|
|
1686
1686
|
getMaxLength: function(t) {
|
|
1687
|
-
return t.reduce(function(e,
|
|
1688
|
-
return e +
|
|
1687
|
+
return t.reduce(function(e, r) {
|
|
1688
|
+
return e + r;
|
|
1689
1689
|
}, 0);
|
|
1690
1690
|
},
|
|
1691
1691
|
// strip prefix
|
|
@@ -1694,42 +1694,42 @@ var mn = wt, Be = {
|
|
|
1694
1694
|
// PREFIX-123 | PEFIX-123 | 123
|
|
1695
1695
|
// PREFIX-123 | PREFIX-23 | 23
|
|
1696
1696
|
// PREFIX-123 | PREFIX-1234 | 1234
|
|
1697
|
-
getPrefixStrippedValue: function(t, e,
|
|
1698
|
-
if (
|
|
1697
|
+
getPrefixStrippedValue: function(t, e, r, n, i, o, s, l, a) {
|
|
1698
|
+
if (r === 0)
|
|
1699
1699
|
return t;
|
|
1700
1700
|
if (t === e && t !== "")
|
|
1701
1701
|
return "";
|
|
1702
1702
|
if (a && t.slice(0, 1) == "-") {
|
|
1703
|
-
var d =
|
|
1704
|
-
return "-" + this.getPrefixStrippedValue(t.slice(1), e,
|
|
1705
|
-
}
|
|
1706
|
-
if (
|
|
1707
|
-
return s && !
|
|
1708
|
-
if (
|
|
1709
|
-
return s && !
|
|
1710
|
-
var c = this.stripDelimiters(
|
|
1711
|
-
return t.slice(0,
|
|
1703
|
+
var d = n.slice(0, 1) == "-" ? n.slice(1) : n;
|
|
1704
|
+
return "-" + this.getPrefixStrippedValue(t.slice(1), e, r, d, i, o, s, l, a);
|
|
1705
|
+
}
|
|
1706
|
+
if (n.slice(0, r) !== e && !l)
|
|
1707
|
+
return s && !n && t ? t : "";
|
|
1708
|
+
if (n.slice(-r) !== e && l)
|
|
1709
|
+
return s && !n && t ? t : "";
|
|
1710
|
+
var c = this.stripDelimiters(n, i, o);
|
|
1711
|
+
return t.slice(0, r) !== e && !l ? c.slice(r) : t.slice(-r) !== e && l ? c.slice(0, -r - 1) : l ? t.slice(0, -r) : t.slice(r);
|
|
1712
1712
|
},
|
|
1713
1713
|
getFirstDiffIndex: function(t, e) {
|
|
1714
|
-
for (var
|
|
1715
|
-
if (t.charAt(
|
|
1714
|
+
for (var r = 0; t.charAt(r) === e.charAt(r); )
|
|
1715
|
+
if (t.charAt(r++) === "")
|
|
1716
1716
|
return -1;
|
|
1717
|
-
return
|
|
1717
|
+
return r;
|
|
1718
1718
|
},
|
|
1719
|
-
getFormattedValue: function(t, e,
|
|
1719
|
+
getFormattedValue: function(t, e, r, n, i, o) {
|
|
1720
1720
|
var s = "", l = i.length > 0, a = "";
|
|
1721
|
-
return
|
|
1721
|
+
return r === 0 ? t : (e.forEach(function(d, c) {
|
|
1722
1722
|
if (t.length > 0) {
|
|
1723
1723
|
var h = t.slice(0, d), f = t.slice(d);
|
|
1724
|
-
l ? a = i[o ? c - 1 : c] || a : a =
|
|
1724
|
+
l ? a = i[o ? c - 1 : c] || a : a = n, o ? (c > 0 && (s += a), s += h) : (s += h, h.length === d && c < r - 1 && (s += a)), t = f;
|
|
1725
1725
|
}
|
|
1726
1726
|
}), s);
|
|
1727
1727
|
},
|
|
1728
1728
|
// move cursor to the end
|
|
1729
1729
|
// the first time user focuses on an input with prefix
|
|
1730
|
-
fixPrefixCursor: function(t, e,
|
|
1730
|
+
fixPrefixCursor: function(t, e, r, n) {
|
|
1731
1731
|
if (t) {
|
|
1732
|
-
var i = t.value, o =
|
|
1732
|
+
var i = t.value, o = r || n[0] || " ";
|
|
1733
1733
|
if (!(!t.setSelectionRange || !e || e.length + o.length <= i.length)) {
|
|
1734
1734
|
var s = i.length * 2;
|
|
1735
1735
|
setTimeout(function() {
|
|
@@ -1747,11 +1747,11 @@ var mn = wt, Be = {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
return !1;
|
|
1749
1749
|
},
|
|
1750
|
-
setSelection: function(t, e,
|
|
1751
|
-
if (t === this.getActiveElement(
|
|
1750
|
+
setSelection: function(t, e, r) {
|
|
1751
|
+
if (t === this.getActiveElement(r) && !(t && t.value.length <= e))
|
|
1752
1752
|
if (t.createTextRange) {
|
|
1753
|
-
var
|
|
1754
|
-
|
|
1753
|
+
var n = t.createTextRange();
|
|
1754
|
+
n.move("character", e), n.select();
|
|
1755
1755
|
} else
|
|
1756
1756
|
try {
|
|
1757
1757
|
t.setSelectionRange(e, e);
|
|
@@ -1773,24 +1773,24 @@ var mn = wt, Be = {
|
|
|
1773
1773
|
isAndroidBackspaceKeydown: function(t, e) {
|
|
1774
1774
|
return !this.isAndroid() || !t || !e ? !1 : e === t.slice(0, -1);
|
|
1775
1775
|
}
|
|
1776
|
-
},
|
|
1776
|
+
}, gr = pr, yr = {
|
|
1777
1777
|
// Maybe change to object-assign
|
|
1778
1778
|
// for now just keep it as simple
|
|
1779
1779
|
assign: function(t, e) {
|
|
1780
1780
|
return t = t || {}, e = e || {}, t.creditCard = !!e.creditCard, t.creditCardStrictMode = !!e.creditCardStrictMode, t.creditCardType = "", t.onCreditCardTypeChanged = e.onCreditCardTypeChanged || function() {
|
|
1781
|
-
}, t.phone = !!e.phone, t.phoneRegionCode = e.phoneRegionCode || "AU", t.phoneFormatter = {}, t.time = !!e.time, t.timePattern = e.timePattern || ["h", "m", "s"], t.timeFormat = e.timeFormat || "24", t.timeFormatter = {}, t.date = !!e.date, t.datePattern = e.datePattern || ["d", "m", "Y"], t.dateMin = e.dateMin || "", t.dateMax = e.dateMax || "", t.dateFormatter = {}, t.numeral = !!e.numeral, t.numeralIntegerScale = e.numeralIntegerScale > 0 ? e.numeralIntegerScale : 0, t.numeralDecimalScale = e.numeralDecimalScale >= 0 ? e.numeralDecimalScale : 2, t.numeralDecimalMark = e.numeralDecimalMark || ".", t.numeralThousandsGroupStyle = e.numeralThousandsGroupStyle || "thousand", t.numeralPositiveOnly = !!e.numeralPositiveOnly, t.stripLeadingZeroes = e.stripLeadingZeroes !== !1, t.signBeforePrefix = !!e.signBeforePrefix, t.tailPrefix = !!e.tailPrefix, t.swapHiddenInput = !!e.swapHiddenInput, t.numericOnly = t.creditCard || t.date || !!e.numericOnly, t.uppercase = !!e.uppercase, t.lowercase = !!e.lowercase, t.prefix = t.creditCard || t.date ? "" : e.prefix || "", t.noImmediatePrefix = !!e.noImmediatePrefix, t.prefixLength = t.prefix.length, t.rawValueTrimPrefix = !!e.rawValueTrimPrefix, t.copyDelimiter = !!e.copyDelimiter, t.initValue = e.initValue !== void 0 && e.initValue !== null ? e.initValue.toString() : "", t.delimiter = e.delimiter || e.delimiter === "" ? e.delimiter : e.date ? "/" : e.time ? ":" : e.numeral ? "," : (e.phone, " "), t.delimiterLength = t.delimiter.length, t.delimiterLazyShow = !!e.delimiterLazyShow, t.delimiters = e.delimiters || [], t.blocks = e.blocks || [], t.blocksLength = t.blocks.length, t.root = typeof
|
|
1781
|
+
}, t.phone = !!e.phone, t.phoneRegionCode = e.phoneRegionCode || "AU", t.phoneFormatter = {}, t.time = !!e.time, t.timePattern = e.timePattern || ["h", "m", "s"], t.timeFormat = e.timeFormat || "24", t.timeFormatter = {}, t.date = !!e.date, t.datePattern = e.datePattern || ["d", "m", "Y"], t.dateMin = e.dateMin || "", t.dateMax = e.dateMax || "", t.dateFormatter = {}, t.numeral = !!e.numeral, t.numeralIntegerScale = e.numeralIntegerScale > 0 ? e.numeralIntegerScale : 0, t.numeralDecimalScale = e.numeralDecimalScale >= 0 ? e.numeralDecimalScale : 2, t.numeralDecimalMark = e.numeralDecimalMark || ".", t.numeralThousandsGroupStyle = e.numeralThousandsGroupStyle || "thousand", t.numeralPositiveOnly = !!e.numeralPositiveOnly, t.stripLeadingZeroes = e.stripLeadingZeroes !== !1, t.signBeforePrefix = !!e.signBeforePrefix, t.tailPrefix = !!e.tailPrefix, t.swapHiddenInput = !!e.swapHiddenInput, t.numericOnly = t.creditCard || t.date || !!e.numericOnly, t.uppercase = !!e.uppercase, t.lowercase = !!e.lowercase, t.prefix = t.creditCard || t.date ? "" : e.prefix || "", t.noImmediatePrefix = !!e.noImmediatePrefix, t.prefixLength = t.prefix.length, t.rawValueTrimPrefix = !!e.rawValueTrimPrefix, t.copyDelimiter = !!e.copyDelimiter, t.initValue = e.initValue !== void 0 && e.initValue !== null ? e.initValue.toString() : "", t.delimiter = e.delimiter || e.delimiter === "" ? e.delimiter : e.date ? "/" : e.time ? ":" : e.numeral ? "," : (e.phone, " "), t.delimiterLength = t.delimiter.length, t.delimiterLazyShow = !!e.delimiterLazyShow, t.delimiters = e.delimiters || [], t.blocks = e.blocks || [], t.blocksLength = t.blocks.length, t.root = typeof Z == "object" && Z ? Z : window, t.document = e.document || t.root.document, t.maxLength = 0, t.backspace = !1, t.result = "", t.onValueChanged = e.onValueChanged || function() {
|
|
1782
1782
|
}, t;
|
|
1783
1783
|
}
|
|
1784
|
-
},
|
|
1785
|
-
var
|
|
1786
|
-
if (typeof t == "string" ? (
|
|
1784
|
+
}, br = yr, x = function(t, e) {
|
|
1785
|
+
var r = this, n = !1;
|
|
1786
|
+
if (typeof t == "string" ? (r.element = document.querySelector(t), n = document.querySelectorAll(t).length > 1) : typeof t.length < "u" && t.length > 0 ? (r.element = t[0], n = t.length > 1) : r.element = t, !r.element)
|
|
1787
1787
|
throw new Error("[cleave.js] Please check the element");
|
|
1788
|
-
if (
|
|
1788
|
+
if (n)
|
|
1789
1789
|
try {
|
|
1790
1790
|
console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.");
|
|
1791
1791
|
} catch {
|
|
1792
1792
|
}
|
|
1793
|
-
e.initValue =
|
|
1793
|
+
e.initValue = r.element.value, r.properties = x.DefaultProperties.assign({}, e), r.init();
|
|
1794
1794
|
};
|
|
1795
1795
|
x.prototype = {
|
|
1796
1796
|
init: function() {
|
|
@@ -1804,8 +1804,8 @@ x.prototype = {
|
|
|
1804
1804
|
initSwapHiddenInput: function() {
|
|
1805
1805
|
var t = this, e = t.properties;
|
|
1806
1806
|
if (e.swapHiddenInput) {
|
|
1807
|
-
var
|
|
1808
|
-
t.element.parentNode.insertBefore(
|
|
1807
|
+
var r = t.element.cloneNode(!0);
|
|
1808
|
+
t.element.parentNode.insertBefore(r, t.element), t.elementSwapHidden = t.element, t.elementSwapHidden.type = "hidden", t.element = r, t.element.id = "";
|
|
1809
1809
|
}
|
|
1810
1810
|
},
|
|
1811
1811
|
initNumeralFormatter: function() {
|
|
@@ -1844,14 +1844,14 @@ x.prototype = {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
},
|
|
1846
1846
|
onKeyDown: function(t) {
|
|
1847
|
-
var e = this,
|
|
1848
|
-
e.lastInputValue = e.element.value, e.isBackward =
|
|
1847
|
+
var e = this, r = t.which || t.keyCode;
|
|
1848
|
+
e.lastInputValue = e.element.value, e.isBackward = r === 8;
|
|
1849
1849
|
},
|
|
1850
1850
|
onChange: function(t) {
|
|
1851
|
-
var e = this,
|
|
1851
|
+
var e = this, r = e.properties, n = x.Util;
|
|
1852
1852
|
e.isBackward = e.isBackward || t.inputType === "deleteContentBackward";
|
|
1853
|
-
var i =
|
|
1854
|
-
e.isBackward && i ?
|
|
1853
|
+
var i = n.getPostDelimiter(e.lastInputValue, r.delimiter, r.delimiters);
|
|
1854
|
+
e.isBackward && i ? r.postDelimiterBackspace = i : r.postDelimiterBackspace = !1, this.onInput(this.element.value);
|
|
1855
1855
|
},
|
|
1856
1856
|
onFocus: function() {
|
|
1857
1857
|
var t = this, e = t.properties;
|
|
@@ -1864,51 +1864,51 @@ x.prototype = {
|
|
|
1864
1864
|
x.Util.checkFullSelection(this.element.value) && this.copyClipboardData(t);
|
|
1865
1865
|
},
|
|
1866
1866
|
copyClipboardData: function(t) {
|
|
1867
|
-
var e = this,
|
|
1868
|
-
|
|
1867
|
+
var e = this, r = e.properties, n = x.Util, i = e.element.value, o = "";
|
|
1868
|
+
r.copyDelimiter ? o = i : o = n.stripDelimiters(i, r.delimiter, r.delimiters);
|
|
1869
1869
|
try {
|
|
1870
1870
|
t.clipboardData ? t.clipboardData.setData("Text", o) : window.clipboardData.setData("Text", o), t.preventDefault();
|
|
1871
1871
|
} catch {
|
|
1872
1872
|
}
|
|
1873
1873
|
},
|
|
1874
1874
|
onInput: function(t) {
|
|
1875
|
-
var e = this,
|
|
1876
|
-
if (!
|
|
1877
|
-
|
|
1875
|
+
var e = this, r = e.properties, n = x.Util, i = n.getPostDelimiter(t, r.delimiter, r.delimiters);
|
|
1876
|
+
if (!r.numeral && r.postDelimiterBackspace && !i && (t = n.headStr(t, t.length - r.postDelimiterBackspace.length)), r.phone) {
|
|
1877
|
+
r.prefix && (!r.noImmediatePrefix || t.length) ? r.result = r.prefix + r.phoneFormatter.format(t).slice(r.prefix.length) : r.result = r.phoneFormatter.format(t), e.updateValueState();
|
|
1878
1878
|
return;
|
|
1879
1879
|
}
|
|
1880
|
-
if (
|
|
1881
|
-
|
|
1880
|
+
if (r.numeral) {
|
|
1881
|
+
r.prefix && r.noImmediatePrefix && t.length === 0 ? r.result = "" : r.result = r.numeralFormatter.format(t), e.updateValueState();
|
|
1882
1882
|
return;
|
|
1883
1883
|
}
|
|
1884
|
-
if (
|
|
1885
|
-
|
|
1884
|
+
if (r.date && (t = r.dateFormatter.getValidatedDate(t)), r.time && (t = r.timeFormatter.getValidatedTime(t)), t = n.stripDelimiters(t, r.delimiter, r.delimiters), t = n.getPrefixStrippedValue(t, r.prefix, r.prefixLength, r.result, r.delimiter, r.delimiters, r.noImmediatePrefix, r.tailPrefix, r.signBeforePrefix), t = r.numericOnly ? n.strip(t, /[^\d]/g) : t, t = r.uppercase ? t.toUpperCase() : t, t = r.lowercase ? t.toLowerCase() : t, r.prefix && (r.tailPrefix ? t = t + r.prefix : t = r.prefix + t, r.blocksLength === 0)) {
|
|
1885
|
+
r.result = t, e.updateValueState();
|
|
1886
1886
|
return;
|
|
1887
1887
|
}
|
|
1888
|
-
|
|
1888
|
+
r.creditCard && e.updateCreditCardPropsByValue(t), t = n.headStr(t, r.maxLength), r.result = n.getFormattedValue(
|
|
1889
1889
|
t,
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1890
|
+
r.blocks,
|
|
1891
|
+
r.blocksLength,
|
|
1892
|
+
r.delimiter,
|
|
1893
|
+
r.delimiters,
|
|
1894
|
+
r.delimiterLazyShow
|
|
1895
1895
|
), e.updateValueState();
|
|
1896
1896
|
},
|
|
1897
1897
|
updateCreditCardPropsByValue: function(t) {
|
|
1898
|
-
var e = this,
|
|
1899
|
-
|
|
1898
|
+
var e = this, r = e.properties, n = x.Util, i;
|
|
1899
|
+
n.headStr(r.result, 4) !== n.headStr(t, 4) && (i = x.CreditCardDetector.getInfo(t, r.creditCardStrictMode), r.blocks = i.blocks, r.blocksLength = r.blocks.length, r.maxLength = n.getMaxLength(r.blocks), r.creditCardType !== i.type && (r.creditCardType = i.type, r.onCreditCardTypeChanged.call(e, r.creditCardType)));
|
|
1900
1900
|
},
|
|
1901
1901
|
updateValueState: function() {
|
|
1902
|
-
var t = this, e = x.Util,
|
|
1902
|
+
var t = this, e = x.Util, r = t.properties;
|
|
1903
1903
|
if (t.element) {
|
|
1904
|
-
var
|
|
1905
|
-
if (
|
|
1904
|
+
var n = t.element.selectionEnd, i = t.element.value, o = r.result;
|
|
1905
|
+
if (n = e.getNextCursorPosition(n, i, o, r.delimiter, r.delimiters), t.isAndroid) {
|
|
1906
1906
|
window.setTimeout(function() {
|
|
1907
|
-
t.element.value = o, e.setSelection(t.element,
|
|
1907
|
+
t.element.value = o, e.setSelection(t.element, n, r.document, !1), t.callOnValueChanged();
|
|
1908
1908
|
}, 1);
|
|
1909
1909
|
return;
|
|
1910
1910
|
}
|
|
1911
|
-
t.element.value = o,
|
|
1911
|
+
t.element.value = o, r.swapHiddenInput && (t.elementSwapHidden.value = t.getRawValue()), e.setSelection(t.element, n, r.document, !1), t.callOnValueChanged();
|
|
1912
1912
|
}
|
|
1913
1913
|
},
|
|
1914
1914
|
callOnValueChanged: function() {
|
|
@@ -1922,16 +1922,16 @@ x.prototype = {
|
|
|
1922
1922
|
});
|
|
1923
1923
|
},
|
|
1924
1924
|
setPhoneRegionCode: function(t) {
|
|
1925
|
-
var e = this,
|
|
1926
|
-
|
|
1925
|
+
var e = this, r = e.properties;
|
|
1926
|
+
r.phoneRegionCode = t, e.initPhoneFormatter(), e.onChange();
|
|
1927
1927
|
},
|
|
1928
1928
|
setRawValue: function(t) {
|
|
1929
|
-
var e = this,
|
|
1930
|
-
t = t != null ? t.toString() : "",
|
|
1929
|
+
var e = this, r = e.properties;
|
|
1930
|
+
t = t != null ? t.toString() : "", r.numeral && (t = t.replace(".", r.numeralDecimalMark)), r.postDelimiterBackspace = !1, e.element.value = t, e.onInput(t);
|
|
1931
1931
|
},
|
|
1932
1932
|
getRawValue: function() {
|
|
1933
|
-
var t = this, e = t.properties,
|
|
1934
|
-
return e.rawValueTrimPrefix && (
|
|
1933
|
+
var t = this, e = t.properties, r = x.Util, n = t.element.value;
|
|
1934
|
+
return e.rawValueTrimPrefix && (n = r.getPrefixStrippedValue(n, e.prefix, e.prefixLength, e.result, e.delimiter, e.delimiters, e.noImmediatePrefix, e.tailPrefix, e.signBeforePrefix)), e.numeral ? n = e.numeralFormatter.getRawValue(n) : n = r.stripDelimiters(n, e.delimiter, e.delimiters), n;
|
|
1935
1935
|
},
|
|
1936
1936
|
getISOFormatDate: function() {
|
|
1937
1937
|
var t = this, e = t.properties;
|
|
@@ -1952,19 +1952,19 @@ x.prototype = {
|
|
|
1952
1952
|
return "[Cleave Object]";
|
|
1953
1953
|
}
|
|
1954
1954
|
};
|
|
1955
|
-
x.NumeralFormatter =
|
|
1956
|
-
x.DateFormatter =
|
|
1957
|
-
x.TimeFormatter =
|
|
1958
|
-
x.PhoneFormatter =
|
|
1959
|
-
x.CreditCardDetector =
|
|
1960
|
-
x.Util =
|
|
1961
|
-
x.DefaultProperties =
|
|
1962
|
-
(typeof
|
|
1963
|
-
var at = x, fe = {},
|
|
1955
|
+
x.NumeralFormatter = cr;
|
|
1956
|
+
x.DateFormatter = ur;
|
|
1957
|
+
x.TimeFormatter = hr;
|
|
1958
|
+
x.PhoneFormatter = fr;
|
|
1959
|
+
x.CreditCardDetector = mr;
|
|
1960
|
+
x.Util = gr;
|
|
1961
|
+
x.DefaultProperties = br;
|
|
1962
|
+
(typeof Z == "object" && Z ? Z : window).Cleave = x;
|
|
1963
|
+
var at = x, fe = {}, wr = function() {
|
|
1964
1964
|
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
1965
|
-
}, vt = {},
|
|
1966
|
-
let
|
|
1967
|
-
const
|
|
1965
|
+
}, vt = {}, M = {};
|
|
1966
|
+
let Ye;
|
|
1967
|
+
const vr = [
|
|
1968
1968
|
0,
|
|
1969
1969
|
// Not used
|
|
1970
1970
|
26,
|
|
@@ -2008,38 +2008,38 @@ const xn = [
|
|
|
2008
2008
|
3532,
|
|
2009
2009
|
3706
|
|
2010
2010
|
];
|
|
2011
|
-
|
|
2011
|
+
M.getSymbolSize = function(e) {
|
|
2012
2012
|
if (!e) throw new Error('"version" cannot be null or undefined');
|
|
2013
2013
|
if (e < 1 || e > 40) throw new Error('"version" should be in range from 1 to 40');
|
|
2014
2014
|
return e * 4 + 17;
|
|
2015
2015
|
};
|
|
2016
|
-
|
|
2017
|
-
return
|
|
2016
|
+
M.getSymbolTotalCodewords = function(e) {
|
|
2017
|
+
return vr[e];
|
|
2018
2018
|
};
|
|
2019
|
-
|
|
2019
|
+
M.getBCHDigit = function(t) {
|
|
2020
2020
|
let e = 0;
|
|
2021
2021
|
for (; t !== 0; )
|
|
2022
2022
|
e++, t >>>= 1;
|
|
2023
2023
|
return e;
|
|
2024
2024
|
};
|
|
2025
|
-
|
|
2025
|
+
M.setToSJISFunction = function(e) {
|
|
2026
2026
|
if (typeof e != "function")
|
|
2027
2027
|
throw new Error('"toSJISFunc" is not a valid function.');
|
|
2028
|
-
|
|
2028
|
+
Ye = e;
|
|
2029
2029
|
};
|
|
2030
|
-
|
|
2031
|
-
return typeof
|
|
2030
|
+
M.isKanjiModeEnabled = function() {
|
|
2031
|
+
return typeof Ye < "u";
|
|
2032
2032
|
};
|
|
2033
|
-
|
|
2034
|
-
return
|
|
2033
|
+
M.toSJIS = function(e) {
|
|
2034
|
+
return Ye(e);
|
|
2035
2035
|
};
|
|
2036
2036
|
var Ce = {};
|
|
2037
2037
|
(function(t) {
|
|
2038
2038
|
t.L = { bit: 1 }, t.M = { bit: 0 }, t.Q = { bit: 3 }, t.H = { bit: 2 };
|
|
2039
|
-
function e(
|
|
2040
|
-
if (typeof
|
|
2039
|
+
function e(r) {
|
|
2040
|
+
if (typeof r != "string")
|
|
2041
2041
|
throw new Error("Param is not a string");
|
|
2042
|
-
switch (
|
|
2042
|
+
switch (r.toLowerCase()) {
|
|
2043
2043
|
case "l":
|
|
2044
2044
|
case "low":
|
|
2045
2045
|
return t.L;
|
|
@@ -2053,16 +2053,16 @@ var Ce = {};
|
|
|
2053
2053
|
case "high":
|
|
2054
2054
|
return t.H;
|
|
2055
2055
|
default:
|
|
2056
|
-
throw new Error("Unknown EC Level: " +
|
|
2056
|
+
throw new Error("Unknown EC Level: " + r);
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
|
-
t.isValid = function(
|
|
2060
|
-
return
|
|
2061
|
-
}, t.from = function(
|
|
2062
|
-
if (t.isValid(
|
|
2063
|
-
return
|
|
2059
|
+
t.isValid = function(n) {
|
|
2060
|
+
return n && typeof n.bit < "u" && n.bit >= 0 && n.bit < 4;
|
|
2061
|
+
}, t.from = function(n, i) {
|
|
2062
|
+
if (t.isValid(n))
|
|
2063
|
+
return n;
|
|
2064
2064
|
try {
|
|
2065
|
-
return e(
|
|
2065
|
+
return e(n);
|
|
2066
2066
|
} catch {
|
|
2067
2067
|
return i;
|
|
2068
2068
|
}
|
|
@@ -2077,8 +2077,8 @@ xt.prototype = {
|
|
|
2077
2077
|
return (this.buffer[e] >>> 7 - t % 8 & 1) === 1;
|
|
2078
2078
|
},
|
|
2079
2079
|
put: function(t, e) {
|
|
2080
|
-
for (let
|
|
2081
|
-
this.putBit((t >>> e -
|
|
2080
|
+
for (let r = 0; r < e; r++)
|
|
2081
|
+
this.putBit((t >>> e - r - 1 & 1) === 1);
|
|
2082
2082
|
},
|
|
2083
2083
|
getLengthInBits: function() {
|
|
2084
2084
|
return this.length;
|
|
@@ -2088,36 +2088,36 @@ xt.prototype = {
|
|
|
2088
2088
|
this.buffer.length <= e && this.buffer.push(0), t && (this.buffer[e] |= 128 >>> this.length % 8), this.length++;
|
|
2089
2089
|
}
|
|
2090
2090
|
};
|
|
2091
|
-
var
|
|
2091
|
+
var xr = xt;
|
|
2092
2092
|
function me(t) {
|
|
2093
2093
|
if (!t || t < 1)
|
|
2094
2094
|
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
2095
2095
|
this.size = t, this.data = new Uint8Array(t * t), this.reservedBit = new Uint8Array(t * t);
|
|
2096
2096
|
}
|
|
2097
|
-
me.prototype.set = function(t, e,
|
|
2097
|
+
me.prototype.set = function(t, e, r, n) {
|
|
2098
2098
|
const i = t * this.size + e;
|
|
2099
|
-
this.data[i] =
|
|
2099
|
+
this.data[i] = r, n && (this.reservedBit[i] = !0);
|
|
2100
2100
|
};
|
|
2101
2101
|
me.prototype.get = function(t, e) {
|
|
2102
2102
|
return this.data[t * this.size + e];
|
|
2103
2103
|
};
|
|
2104
|
-
me.prototype.xor = function(t, e,
|
|
2105
|
-
this.data[t * this.size + e] ^=
|
|
2104
|
+
me.prototype.xor = function(t, e, r) {
|
|
2105
|
+
this.data[t * this.size + e] ^= r;
|
|
2106
2106
|
};
|
|
2107
2107
|
me.prototype.isReserved = function(t, e) {
|
|
2108
2108
|
return this.reservedBit[t * this.size + e];
|
|
2109
2109
|
};
|
|
2110
|
-
var
|
|
2110
|
+
var Sr = me, St = {};
|
|
2111
2111
|
(function(t) {
|
|
2112
|
-
const e =
|
|
2113
|
-
t.getRowColCoords = function(
|
|
2114
|
-
if (
|
|
2115
|
-
const i = Math.floor(
|
|
2112
|
+
const e = M.getSymbolSize;
|
|
2113
|
+
t.getRowColCoords = function(n) {
|
|
2114
|
+
if (n === 1) return [];
|
|
2115
|
+
const i = Math.floor(n / 7) + 2, o = e(n), s = o === 145 ? 26 : Math.ceil((o - 13) / (2 * i - 2)) * 2, l = [o - 7];
|
|
2116
2116
|
for (let a = 1; a < i - 1; a++)
|
|
2117
2117
|
l[a] = l[a - 1] - s;
|
|
2118
2118
|
return l.push(6), l.reverse();
|
|
2119
|
-
}, t.getPositions = function(
|
|
2120
|
-
const i = [], o = t.getRowColCoords(
|
|
2119
|
+
}, t.getPositions = function(n) {
|
|
2120
|
+
const i = [], o = t.getRowColCoords(n), s = o.length;
|
|
2121
2121
|
for (let l = 0; l < s; l++)
|
|
2122
2122
|
for (let a = 0; a < s; a++)
|
|
2123
2123
|
l === 0 && a === 0 || // top-left
|
|
@@ -2127,19 +2127,19 @@ var Cn = me, St = {};
|
|
|
2127
2127
|
};
|
|
2128
2128
|
})(St);
|
|
2129
2129
|
var Ct = {};
|
|
2130
|
-
const
|
|
2130
|
+
const Cr = M.getSymbolSize, lt = 7;
|
|
2131
2131
|
Ct.getPositions = function(e) {
|
|
2132
|
-
const
|
|
2132
|
+
const r = Cr(e);
|
|
2133
2133
|
return [
|
|
2134
2134
|
// top-left
|
|
2135
2135
|
[0, 0],
|
|
2136
2136
|
// top-right
|
|
2137
|
-
[
|
|
2137
|
+
[r - lt, 0],
|
|
2138
2138
|
// bottom-left
|
|
2139
|
-
[0,
|
|
2139
|
+
[0, r - lt]
|
|
2140
2140
|
];
|
|
2141
2141
|
};
|
|
2142
|
-
var
|
|
2142
|
+
var kt = {};
|
|
2143
2143
|
(function(t) {
|
|
2144
2144
|
t.Patterns = {
|
|
2145
2145
|
PATTERN000: 0,
|
|
@@ -2197,8 +2197,8 @@ var Et = {};
|
|
|
2197
2197
|
for (let a = 0; a < s; a++) o += i.data[a];
|
|
2198
2198
|
return Math.abs(Math.ceil(o * 100 / s / 5) - 10) * e.N4;
|
|
2199
2199
|
};
|
|
2200
|
-
function n
|
|
2201
|
-
switch (
|
|
2200
|
+
function r(n, i, o) {
|
|
2201
|
+
switch (n) {
|
|
2202
2202
|
case t.Patterns.PATTERN000:
|
|
2203
2203
|
return (i + o) % 2 === 0;
|
|
2204
2204
|
case t.Patterns.PATTERN001:
|
|
@@ -2216,14 +2216,14 @@ var Et = {};
|
|
|
2216
2216
|
case t.Patterns.PATTERN111:
|
|
2217
2217
|
return (i * o % 3 + (i + o) % 2) % 2 === 0;
|
|
2218
2218
|
default:
|
|
2219
|
-
throw new Error("bad maskPattern:" +
|
|
2219
|
+
throw new Error("bad maskPattern:" + n);
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
2222
|
t.applyMask = function(i, o) {
|
|
2223
2223
|
const s = o.size;
|
|
2224
2224
|
for (let l = 0; l < s; l++)
|
|
2225
2225
|
for (let a = 0; a < s; a++)
|
|
2226
|
-
o.isReserved(a, l) || o.xor(a, l,
|
|
2226
|
+
o.isReserved(a, l) || o.xor(a, l, r(i, a, l));
|
|
2227
2227
|
}, t.getBestMask = function(i, o) {
|
|
2228
2228
|
const s = Object.keys(t.Patterns).length;
|
|
2229
2229
|
let l = 0, a = 1 / 0;
|
|
@@ -2234,8 +2234,8 @@ var Et = {};
|
|
|
2234
2234
|
}
|
|
2235
2235
|
return l;
|
|
2236
2236
|
};
|
|
2237
|
-
})(
|
|
2238
|
-
var
|
|
2237
|
+
})(kt);
|
|
2238
|
+
var ke = {};
|
|
2239
2239
|
const U = Ce, pe = [
|
|
2240
2240
|
// L M Q H
|
|
2241
2241
|
1,
|
|
@@ -2561,8 +2561,8 @@ const U = Ce, pe = [
|
|
|
2561
2561
|
2040,
|
|
2562
2562
|
2430
|
|
2563
2563
|
];
|
|
2564
|
-
|
|
2565
|
-
switch (
|
|
2564
|
+
ke.getBlocksCount = function(e, r) {
|
|
2565
|
+
switch (r) {
|
|
2566
2566
|
case U.L:
|
|
2567
2567
|
return pe[(e - 1) * 4 + 0];
|
|
2568
2568
|
case U.M:
|
|
@@ -2575,8 +2575,8 @@ Ee.getBlocksCount = function(e, n) {
|
|
|
2575
2575
|
return;
|
|
2576
2576
|
}
|
|
2577
2577
|
};
|
|
2578
|
-
|
|
2579
|
-
switch (
|
|
2578
|
+
ke.getTotalCodewordsCount = function(e, r) {
|
|
2579
|
+
switch (r) {
|
|
2580
2580
|
case U.L:
|
|
2581
2581
|
return ge[(e - 1) * 4 + 0];
|
|
2582
2582
|
case U.M:
|
|
@@ -2589,35 +2589,35 @@ Ee.getTotalCodewordsCount = function(e, n) {
|
|
|
2589
2589
|
return;
|
|
2590
2590
|
}
|
|
2591
2591
|
};
|
|
2592
|
-
var
|
|
2592
|
+
var Et = {}, Ee = {};
|
|
2593
2593
|
const ae = new Uint8Array(512), ve = new Uint8Array(256);
|
|
2594
2594
|
(function() {
|
|
2595
2595
|
let e = 1;
|
|
2596
|
-
for (let
|
|
2597
|
-
ae[
|
|
2598
|
-
for (let
|
|
2599
|
-
ae[
|
|
2596
|
+
for (let r = 0; r < 255; r++)
|
|
2597
|
+
ae[r] = e, ve[e] = r, e <<= 1, e & 256 && (e ^= 285);
|
|
2598
|
+
for (let r = 255; r < 512; r++)
|
|
2599
|
+
ae[r] = ae[r - 255];
|
|
2600
2600
|
})();
|
|
2601
|
-
|
|
2601
|
+
Ee.log = function(e) {
|
|
2602
2602
|
if (e < 1) throw new Error("log(" + e + ")");
|
|
2603
2603
|
return ve[e];
|
|
2604
2604
|
};
|
|
2605
|
-
|
|
2605
|
+
Ee.exp = function(e) {
|
|
2606
2606
|
return ae[e];
|
|
2607
2607
|
};
|
|
2608
|
-
|
|
2609
|
-
return e === 0 ||
|
|
2608
|
+
Ee.mul = function(e, r) {
|
|
2609
|
+
return e === 0 || r === 0 ? 0 : ae[ve[e] + ve[r]];
|
|
2610
2610
|
};
|
|
2611
2611
|
(function(t) {
|
|
2612
|
-
const e =
|
|
2613
|
-
t.mul = function(
|
|
2614
|
-
const o = new Uint8Array(
|
|
2615
|
-
for (let s = 0; s <
|
|
2612
|
+
const e = Ee;
|
|
2613
|
+
t.mul = function(n, i) {
|
|
2614
|
+
const o = new Uint8Array(n.length + i.length - 1);
|
|
2615
|
+
for (let s = 0; s < n.length; s++)
|
|
2616
2616
|
for (let l = 0; l < i.length; l++)
|
|
2617
|
-
o[s + l] ^= e.mul(
|
|
2617
|
+
o[s + l] ^= e.mul(n[s], i[l]);
|
|
2618
2618
|
return o;
|
|
2619
|
-
}, t.mod = function(
|
|
2620
|
-
let o = new Uint8Array(
|
|
2619
|
+
}, t.mod = function(n, i) {
|
|
2620
|
+
let o = new Uint8Array(n);
|
|
2621
2621
|
for (; o.length - i.length >= 0; ) {
|
|
2622
2622
|
const s = o[0];
|
|
2623
2623
|
for (let a = 0; a < i.length; a++)
|
|
@@ -2627,14 +2627,14 @@ ke.mul = function(e, n) {
|
|
|
2627
2627
|
o = o.slice(l);
|
|
2628
2628
|
}
|
|
2629
2629
|
return o;
|
|
2630
|
-
}, t.generateECPolynomial = function(
|
|
2630
|
+
}, t.generateECPolynomial = function(n) {
|
|
2631
2631
|
let i = new Uint8Array([1]);
|
|
2632
|
-
for (let o = 0; o <
|
|
2632
|
+
for (let o = 0; o < n; o++)
|
|
2633
2633
|
i = t.mul(i, new Uint8Array([1, e.exp(o)]));
|
|
2634
2634
|
return i;
|
|
2635
2635
|
};
|
|
2636
|
-
})(
|
|
2637
|
-
const At =
|
|
2636
|
+
})(Et);
|
|
2637
|
+
const At = Et;
|
|
2638
2638
|
function Ke(t) {
|
|
2639
2639
|
this.genPoly = void 0, this.degree = t, this.degree && this.initialize(this.degree);
|
|
2640
2640
|
}
|
|
@@ -2644,42 +2644,42 @@ Ke.prototype.initialize = function(e) {
|
|
|
2644
2644
|
Ke.prototype.encode = function(e) {
|
|
2645
2645
|
if (!this.genPoly)
|
|
2646
2646
|
throw new Error("Encoder not initialized");
|
|
2647
|
-
const
|
|
2648
|
-
|
|
2649
|
-
const
|
|
2647
|
+
const r = new Uint8Array(e.length + this.degree);
|
|
2648
|
+
r.set(e);
|
|
2649
|
+
const n = At.mod(r, this.genPoly), i = this.degree - n.length;
|
|
2650
2650
|
if (i > 0) {
|
|
2651
2651
|
const o = new Uint8Array(this.degree);
|
|
2652
|
-
return o.set(
|
|
2652
|
+
return o.set(n, i), o;
|
|
2653
2653
|
}
|
|
2654
|
-
return
|
|
2654
|
+
return n;
|
|
2655
2655
|
};
|
|
2656
|
-
var
|
|
2656
|
+
var kr = Ke, Pt = {}, z = {}, Qe = {};
|
|
2657
2657
|
Qe.isValid = function(e) {
|
|
2658
2658
|
return !isNaN(e) && e >= 1 && e <= 40;
|
|
2659
2659
|
};
|
|
2660
2660
|
var R = {};
|
|
2661
|
-
const
|
|
2661
|
+
const It = "[0-9]+", Er = "[A-Z $%*+\\-./:]+";
|
|
2662
2662
|
let ue = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
2663
2663
|
ue = ue.replace(/u/g, "\\u");
|
|
2664
|
-
const
|
|
2664
|
+
const Ar = "(?:(?![A-Z0-9 $%*+\\-./:]|" + ue + `)(?:.|[\r
|
|
2665
2665
|
]))+`;
|
|
2666
2666
|
R.KANJI = new RegExp(ue, "g");
|
|
2667
2667
|
R.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
2668
|
-
R.BYTE = new RegExp(
|
|
2669
|
-
R.NUMERIC = new RegExp(
|
|
2670
|
-
R.ALPHANUMERIC = new RegExp(
|
|
2671
|
-
const
|
|
2668
|
+
R.BYTE = new RegExp(Ar, "g");
|
|
2669
|
+
R.NUMERIC = new RegExp(It, "g");
|
|
2670
|
+
R.ALPHANUMERIC = new RegExp(Er, "g");
|
|
2671
|
+
const Pr = new RegExp("^" + ue + "$"), Ir = new RegExp("^" + It + "$"), _r = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
2672
2672
|
R.testKanji = function(e) {
|
|
2673
|
-
return
|
|
2673
|
+
return Pr.test(e);
|
|
2674
2674
|
};
|
|
2675
2675
|
R.testNumeric = function(e) {
|
|
2676
|
-
return
|
|
2676
|
+
return Ir.test(e);
|
|
2677
2677
|
};
|
|
2678
2678
|
R.testAlphanumeric = function(e) {
|
|
2679
|
-
return
|
|
2679
|
+
return _r.test(e);
|
|
2680
2680
|
};
|
|
2681
2681
|
(function(t) {
|
|
2682
|
-
const e = Qe,
|
|
2682
|
+
const e = Qe, r = R;
|
|
2683
2683
|
t.NUMERIC = {
|
|
2684
2684
|
id: "Numeric",
|
|
2685
2685
|
bit: 1,
|
|
@@ -2704,14 +2704,14 @@ R.testAlphanumeric = function(e) {
|
|
|
2704
2704
|
throw new Error("Invalid version: " + s);
|
|
2705
2705
|
return s >= 1 && s < 10 ? o.ccBits[0] : s < 27 ? o.ccBits[1] : o.ccBits[2];
|
|
2706
2706
|
}, t.getBestModeForData = function(o) {
|
|
2707
|
-
return
|
|
2707
|
+
return r.testNumeric(o) ? t.NUMERIC : r.testAlphanumeric(o) ? t.ALPHANUMERIC : r.testKanji(o) ? t.KANJI : t.BYTE;
|
|
2708
2708
|
}, t.toString = function(o) {
|
|
2709
2709
|
if (o && o.id) return o.id;
|
|
2710
2710
|
throw new Error("Invalid mode");
|
|
2711
2711
|
}, t.isValid = function(o) {
|
|
2712
2712
|
return o && o.bit && o.ccBits;
|
|
2713
2713
|
};
|
|
2714
|
-
function
|
|
2714
|
+
function n(i) {
|
|
2715
2715
|
if (typeof i != "string")
|
|
2716
2716
|
throw new Error("Param is not a string");
|
|
2717
2717
|
switch (i.toLowerCase()) {
|
|
@@ -2731,14 +2731,14 @@ R.testAlphanumeric = function(e) {
|
|
|
2731
2731
|
if (t.isValid(o))
|
|
2732
2732
|
return o;
|
|
2733
2733
|
try {
|
|
2734
|
-
return
|
|
2734
|
+
return n(o);
|
|
2735
2735
|
} catch {
|
|
2736
2736
|
return s;
|
|
2737
2737
|
}
|
|
2738
2738
|
};
|
|
2739
2739
|
})(z);
|
|
2740
2740
|
(function(t) {
|
|
2741
|
-
const e =
|
|
2741
|
+
const e = M, r = ke, n = Ce, i = z, o = Qe, s = 7973, l = e.getBCHDigit(s);
|
|
2742
2742
|
function a(f, u, m) {
|
|
2743
2743
|
for (let p = 1; p <= 40; p++)
|
|
2744
2744
|
if (u <= t.getCapacity(p, m, f))
|
|
@@ -2750,8 +2750,8 @@ R.testAlphanumeric = function(e) {
|
|
|
2750
2750
|
function c(f, u) {
|
|
2751
2751
|
let m = 0;
|
|
2752
2752
|
return f.forEach(function(p) {
|
|
2753
|
-
const
|
|
2754
|
-
m +=
|
|
2753
|
+
const k = d(p.mode, u);
|
|
2754
|
+
m += k + p.getBitsLength();
|
|
2755
2755
|
}), m;
|
|
2756
2756
|
}
|
|
2757
2757
|
function h(f, u) {
|
|
@@ -2765,7 +2765,7 @@ R.testAlphanumeric = function(e) {
|
|
|
2765
2765
|
if (!o.isValid(u))
|
|
2766
2766
|
throw new Error("Invalid QR Code version");
|
|
2767
2767
|
typeof p > "u" && (p = i.BYTE);
|
|
2768
|
-
const
|
|
2768
|
+
const k = e.getSymbolTotalCodewords(u), b = r.getTotalCodewordsCount(u, m), w = (k - b) * 8;
|
|
2769
2769
|
if (p === i.MIXED) return w;
|
|
2770
2770
|
const y = w - d(p, u);
|
|
2771
2771
|
switch (p) {
|
|
@@ -2781,16 +2781,16 @@ R.testAlphanumeric = function(e) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
}, t.getBestVersionForData = function(u, m) {
|
|
2783
2783
|
let p;
|
|
2784
|
-
const
|
|
2784
|
+
const k = n.from(m, n.M);
|
|
2785
2785
|
if (Array.isArray(u)) {
|
|
2786
2786
|
if (u.length > 1)
|
|
2787
|
-
return h(u,
|
|
2787
|
+
return h(u, k);
|
|
2788
2788
|
if (u.length === 0)
|
|
2789
2789
|
return 1;
|
|
2790
2790
|
p = u[0];
|
|
2791
2791
|
} else
|
|
2792
2792
|
p = u;
|
|
2793
|
-
return a(p.mode, p.getLength(),
|
|
2793
|
+
return a(p.mode, p.getLength(), k);
|
|
2794
2794
|
}, t.getEncodedBits = function(u) {
|
|
2795
2795
|
if (!o.isValid(u) || u < 7)
|
|
2796
2796
|
throw new Error("Invalid QR Code version");
|
|
@@ -2799,20 +2799,20 @@ R.testAlphanumeric = function(e) {
|
|
|
2799
2799
|
m ^= s << e.getBCHDigit(m) - l;
|
|
2800
2800
|
return u << 12 | m;
|
|
2801
2801
|
};
|
|
2802
|
-
})(
|
|
2803
|
-
var
|
|
2804
|
-
const
|
|
2805
|
-
|
|
2806
|
-
const
|
|
2807
|
-
let i =
|
|
2808
|
-
for (;
|
|
2809
|
-
i ^=
|
|
2810
|
-
return (
|
|
2802
|
+
})(Pt);
|
|
2803
|
+
var _t = {};
|
|
2804
|
+
const Be = M, Mt = 1335, Mr = 21522, dt = Be.getBCHDigit(Mt);
|
|
2805
|
+
_t.getEncodedBits = function(e, r) {
|
|
2806
|
+
const n = e.bit << 3 | r;
|
|
2807
|
+
let i = n << 10;
|
|
2808
|
+
for (; Be.getBCHDigit(i) - dt >= 0; )
|
|
2809
|
+
i ^= Mt << Be.getBCHDigit(i) - dt;
|
|
2810
|
+
return (n << 10 | i) ^ Mr;
|
|
2811
2811
|
};
|
|
2812
|
-
var
|
|
2813
|
-
const
|
|
2812
|
+
var Dt = {};
|
|
2813
|
+
const Dr = z;
|
|
2814
2814
|
function W(t) {
|
|
2815
|
-
this.mode =
|
|
2815
|
+
this.mode = Dr.NUMERIC, this.data = t.toString();
|
|
2816
2816
|
}
|
|
2817
2817
|
W.getBitsLength = function(e) {
|
|
2818
2818
|
return 10 * Math.floor(e / 3) + (e % 3 ? e % 3 * 3 + 1 : 0);
|
|
@@ -2824,14 +2824,14 @@ W.prototype.getBitsLength = function() {
|
|
|
2824
2824
|
return W.getBitsLength(this.data.length);
|
|
2825
2825
|
};
|
|
2826
2826
|
W.prototype.write = function(e) {
|
|
2827
|
-
let
|
|
2828
|
-
for (
|
|
2829
|
-
|
|
2830
|
-
const o = this.data.length -
|
|
2831
|
-
o > 0 && (
|
|
2827
|
+
let r, n, i;
|
|
2828
|
+
for (r = 0; r + 3 <= this.data.length; r += 3)
|
|
2829
|
+
n = this.data.substr(r, 3), i = parseInt(n, 10), e.put(i, 10);
|
|
2830
|
+
const o = this.data.length - r;
|
|
2831
|
+
o > 0 && (n = this.data.substr(r), i = parseInt(n, 10), e.put(i, o * 3 + 1));
|
|
2832
2832
|
};
|
|
2833
|
-
var
|
|
2834
|
-
const
|
|
2833
|
+
var $r = W;
|
|
2834
|
+
const Tr = z, $e = [
|
|
2835
2835
|
"0",
|
|
2836
2836
|
"1",
|
|
2837
2837
|
"2",
|
|
@@ -2879,7 +2879,7 @@ const Tn = z, $e = [
|
|
|
2879
2879
|
":"
|
|
2880
2880
|
];
|
|
2881
2881
|
function X(t) {
|
|
2882
|
-
this.mode =
|
|
2882
|
+
this.mode = Tr.ALPHANUMERIC, this.data = t;
|
|
2883
2883
|
}
|
|
2884
2884
|
X.getBitsLength = function(e) {
|
|
2885
2885
|
return 11 * Math.floor(e / 2) + 6 * (e % 2);
|
|
@@ -2891,17 +2891,17 @@ X.prototype.getBitsLength = function() {
|
|
|
2891
2891
|
return X.getBitsLength(this.data.length);
|
|
2892
2892
|
};
|
|
2893
2893
|
X.prototype.write = function(e) {
|
|
2894
|
-
let
|
|
2895
|
-
for (
|
|
2896
|
-
let
|
|
2897
|
-
|
|
2894
|
+
let r;
|
|
2895
|
+
for (r = 0; r + 2 <= this.data.length; r += 2) {
|
|
2896
|
+
let n = $e.indexOf(this.data[r]) * 45;
|
|
2897
|
+
n += $e.indexOf(this.data[r + 1]), e.put(n, 11);
|
|
2898
2898
|
}
|
|
2899
|
-
this.data.length % 2 && e.put($e.indexOf(this.data[
|
|
2899
|
+
this.data.length % 2 && e.put($e.indexOf(this.data[r]), 6);
|
|
2900
2900
|
};
|
|
2901
|
-
var
|
|
2902
|
-
const
|
|
2901
|
+
var Nr = X;
|
|
2902
|
+
const Rr = z;
|
|
2903
2903
|
function ee(t) {
|
|
2904
|
-
this.mode =
|
|
2904
|
+
this.mode = Rr.BYTE, typeof t == "string" ? this.data = new TextEncoder().encode(t) : this.data = new Uint8Array(t);
|
|
2905
2905
|
}
|
|
2906
2906
|
ee.getBitsLength = function(e) {
|
|
2907
2907
|
return e * 8;
|
|
@@ -2913,13 +2913,13 @@ ee.prototype.getBitsLength = function() {
|
|
|
2913
2913
|
return ee.getBitsLength(this.data.length);
|
|
2914
2914
|
};
|
|
2915
2915
|
ee.prototype.write = function(t) {
|
|
2916
|
-
for (let e = 0,
|
|
2916
|
+
for (let e = 0, r = this.data.length; e < r; e++)
|
|
2917
2917
|
t.put(this.data[e], 8);
|
|
2918
2918
|
};
|
|
2919
|
-
var
|
|
2920
|
-
const
|
|
2919
|
+
var Fr = ee;
|
|
2920
|
+
const Lr = z, Br = M;
|
|
2921
2921
|
function te(t) {
|
|
2922
|
-
this.mode =
|
|
2922
|
+
this.mode = Lr.KANJI, this.data = t;
|
|
2923
2923
|
}
|
|
2924
2924
|
te.getBitsLength = function(e) {
|
|
2925
2925
|
return e * 13;
|
|
@@ -2933,45 +2933,45 @@ te.prototype.getBitsLength = function() {
|
|
|
2933
2933
|
te.prototype.write = function(t) {
|
|
2934
2934
|
let e;
|
|
2935
2935
|
for (e = 0; e < this.data.length; e++) {
|
|
2936
|
-
let
|
|
2937
|
-
if (
|
|
2938
|
-
|
|
2939
|
-
else if (
|
|
2940
|
-
|
|
2936
|
+
let r = Br.toSJIS(this.data[e]);
|
|
2937
|
+
if (r >= 33088 && r <= 40956)
|
|
2938
|
+
r -= 33088;
|
|
2939
|
+
else if (r >= 57408 && r <= 60351)
|
|
2940
|
+
r -= 49472;
|
|
2941
2941
|
else
|
|
2942
2942
|
throw new Error(
|
|
2943
2943
|
"Invalid SJIS character: " + this.data[e] + `
|
|
2944
2944
|
Make sure your charset is UTF-8`
|
|
2945
2945
|
);
|
|
2946
|
-
|
|
2946
|
+
r = (r >>> 8 & 255) * 192 + (r & 255), t.put(r, 13);
|
|
2947
2947
|
}
|
|
2948
2948
|
};
|
|
2949
|
-
var
|
|
2949
|
+
var Ur = te, $t = { exports: {} };
|
|
2950
2950
|
(function(t) {
|
|
2951
2951
|
var e = {
|
|
2952
|
-
single_source_shortest_paths: function(
|
|
2952
|
+
single_source_shortest_paths: function(r, n, i) {
|
|
2953
2953
|
var o = {}, s = {};
|
|
2954
|
-
s[
|
|
2954
|
+
s[n] = 0;
|
|
2955
2955
|
var l = e.PriorityQueue.make();
|
|
2956
|
-
l.push(
|
|
2957
|
-
for (var a, d, c, h, f, u, m, p,
|
|
2958
|
-
a = l.pop(), d = a.value, h = a.cost, f =
|
|
2956
|
+
l.push(n, 0);
|
|
2957
|
+
for (var a, d, c, h, f, u, m, p, k; !l.empty(); ) {
|
|
2958
|
+
a = l.pop(), d = a.value, h = a.cost, f = r[d] || {};
|
|
2959
2959
|
for (c in f)
|
|
2960
|
-
f.hasOwnProperty(c) && (u = f[c], m = h + u, p = s[c],
|
|
2960
|
+
f.hasOwnProperty(c) && (u = f[c], m = h + u, p = s[c], k = typeof s[c] > "u", (k || p > m) && (s[c] = m, l.push(c, m), o[c] = d));
|
|
2961
2961
|
}
|
|
2962
2962
|
if (typeof i < "u" && typeof s[i] > "u") {
|
|
2963
|
-
var b = ["Could not find a path from ",
|
|
2963
|
+
var b = ["Could not find a path from ", n, " to ", i, "."].join("");
|
|
2964
2964
|
throw new Error(b);
|
|
2965
2965
|
}
|
|
2966
2966
|
return o;
|
|
2967
2967
|
},
|
|
2968
|
-
extract_shortest_path_from_predecessor_list: function(
|
|
2969
|
-
for (var i = [], o =
|
|
2970
|
-
i.push(o),
|
|
2968
|
+
extract_shortest_path_from_predecessor_list: function(r, n) {
|
|
2969
|
+
for (var i = [], o = n; o; )
|
|
2970
|
+
i.push(o), r[o], o = r[o];
|
|
2971
2971
|
return i.reverse(), i;
|
|
2972
2972
|
},
|
|
2973
|
-
find_path: function(
|
|
2974
|
-
var o = e.single_source_shortest_paths(
|
|
2973
|
+
find_path: function(r, n, i) {
|
|
2974
|
+
var o = e.single_source_shortest_paths(r, n, i);
|
|
2975
2975
|
return e.extract_shortest_path_from_predecessor_list(
|
|
2976
2976
|
o,
|
|
2977
2977
|
i
|
|
@@ -2981,22 +2981,22 @@ var On = te, $t = { exports: {} };
|
|
|
2981
2981
|
* A very naive priority queue implementation.
|
|
2982
2982
|
*/
|
|
2983
2983
|
PriorityQueue: {
|
|
2984
|
-
make: function(
|
|
2985
|
-
var
|
|
2986
|
-
|
|
2987
|
-
for (o in
|
|
2988
|
-
|
|
2989
|
-
return i.queue = [], i.sorter =
|
|
2984
|
+
make: function(r) {
|
|
2985
|
+
var n = e.PriorityQueue, i = {}, o;
|
|
2986
|
+
r = r || {};
|
|
2987
|
+
for (o in n)
|
|
2988
|
+
n.hasOwnProperty(o) && (i[o] = n[o]);
|
|
2989
|
+
return i.queue = [], i.sorter = r.sorter || n.default_sorter, i;
|
|
2990
2990
|
},
|
|
2991
|
-
default_sorter: function(
|
|
2992
|
-
return
|
|
2991
|
+
default_sorter: function(r, n) {
|
|
2992
|
+
return r.cost - n.cost;
|
|
2993
2993
|
},
|
|
2994
2994
|
/**
|
|
2995
2995
|
* Add a new item to the queue and ensure the highest priority element
|
|
2996
2996
|
* is at the front of the queue.
|
|
2997
2997
|
*/
|
|
2998
|
-
push: function(
|
|
2999
|
-
var i = { value:
|
|
2998
|
+
push: function(r, n) {
|
|
2999
|
+
var i = { value: r, cost: n };
|
|
3000
3000
|
this.queue.push(i), this.queue.sort(this.sorter);
|
|
3001
3001
|
},
|
|
3002
3002
|
/**
|
|
@@ -3012,9 +3012,9 @@ var On = te, $t = { exports: {} };
|
|
|
3012
3012
|
};
|
|
3013
3013
|
t.exports = e;
|
|
3014
3014
|
})($t);
|
|
3015
|
-
var
|
|
3015
|
+
var Or = $t.exports;
|
|
3016
3016
|
(function(t) {
|
|
3017
|
-
const e = z,
|
|
3017
|
+
const e = z, r = $r, n = Nr, i = Fr, o = Ur, s = R, l = M, a = Or;
|
|
3018
3018
|
function d(b) {
|
|
3019
3019
|
return unescape(encodeURIComponent(b)).length;
|
|
3020
3020
|
}
|
|
@@ -3033,22 +3033,22 @@ var zn = $t.exports;
|
|
|
3033
3033
|
function h(b) {
|
|
3034
3034
|
const w = c(s.NUMERIC, e.NUMERIC, b), y = c(s.ALPHANUMERIC, e.ALPHANUMERIC, b);
|
|
3035
3035
|
let g, C;
|
|
3036
|
-
return l.isKanjiModeEnabled() ? (g = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (g = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, g, C).sort(function(
|
|
3037
|
-
return
|
|
3038
|
-
}).map(function(
|
|
3036
|
+
return l.isKanjiModeEnabled() ? (g = c(s.BYTE, e.BYTE, b), C = c(s.KANJI, e.KANJI, b)) : (g = c(s.BYTE_KANJI, e.BYTE, b), C = []), w.concat(y, g, C).sort(function(P, T) {
|
|
3037
|
+
return P.index - T.index;
|
|
3038
|
+
}).map(function(P) {
|
|
3039
3039
|
return {
|
|
3040
|
-
data:
|
|
3041
|
-
mode:
|
|
3042
|
-
length:
|
|
3040
|
+
data: P.data,
|
|
3041
|
+
mode: P.mode,
|
|
3042
|
+
length: P.length
|
|
3043
3043
|
};
|
|
3044
3044
|
});
|
|
3045
3045
|
}
|
|
3046
3046
|
function f(b, w) {
|
|
3047
3047
|
switch (w) {
|
|
3048
3048
|
case e.NUMERIC:
|
|
3049
|
-
return n.getBitsLength(b);
|
|
3050
|
-
case e.ALPHANUMERIC:
|
|
3051
3049
|
return r.getBitsLength(b);
|
|
3050
|
+
case e.ALPHANUMERIC:
|
|
3051
|
+
return n.getBitsLength(b);
|
|
3052
3052
|
case e.KANJI:
|
|
3053
3053
|
return o.getBitsLength(b);
|
|
3054
3054
|
case e.BYTE:
|
|
@@ -3096,23 +3096,23 @@ var zn = $t.exports;
|
|
|
3096
3096
|
function p(b, w) {
|
|
3097
3097
|
const y = {}, g = { start: {} };
|
|
3098
3098
|
let C = ["start"];
|
|
3099
|
-
for (let
|
|
3100
|
-
const
|
|
3101
|
-
for (let
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3104
|
-
for (let
|
|
3105
|
-
const
|
|
3106
|
-
y[
|
|
3099
|
+
for (let E = 0; E < b.length; E++) {
|
|
3100
|
+
const P = b[E], T = [];
|
|
3101
|
+
for (let L = 0; L < P.length; L++) {
|
|
3102
|
+
const N = P[L], re = "" + E + L;
|
|
3103
|
+
T.push(re), y[re] = { node: N, lastCount: 0 }, g[re] = {};
|
|
3104
|
+
for (let Pe = 0; Pe < C.length; Pe++) {
|
|
3105
|
+
const F = C[Pe];
|
|
3106
|
+
y[F] && y[F].node.mode === N.mode ? (g[F][re] = f(y[F].lastCount + N.length, N.mode) - f(y[F].lastCount, N.mode), y[F].lastCount += N.length) : (y[F] && (y[F].lastCount = N.length), g[F][re] = f(N.length, N.mode) + 4 + e.getCharCountIndicator(N.mode, w));
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
C =
|
|
3109
|
+
C = T;
|
|
3110
3110
|
}
|
|
3111
|
-
for (let
|
|
3112
|
-
g[C[
|
|
3111
|
+
for (let E = 0; E < C.length; E++)
|
|
3112
|
+
g[C[E]].end = 0;
|
|
3113
3113
|
return { map: g, table: y };
|
|
3114
3114
|
}
|
|
3115
|
-
function
|
|
3115
|
+
function k(b, w) {
|
|
3116
3116
|
let y;
|
|
3117
3117
|
const g = e.getBestModeForData(b);
|
|
3118
3118
|
if (y = e.from(w, g), y !== e.BYTE && y.bit < g.bit)
|
|
@@ -3120,9 +3120,9 @@ var zn = $t.exports;
|
|
|
3120
3120
|
Suggested mode is: ` + e.toString(g));
|
|
3121
3121
|
switch (y === e.KANJI && !l.isKanjiModeEnabled() && (y = e.BYTE), y) {
|
|
3122
3122
|
case e.NUMERIC:
|
|
3123
|
-
return new n(b);
|
|
3124
|
-
case e.ALPHANUMERIC:
|
|
3125
3123
|
return new r(b);
|
|
3124
|
+
case e.ALPHANUMERIC:
|
|
3125
|
+
return new n(b);
|
|
3126
3126
|
case e.KANJI:
|
|
3127
3127
|
return new o(b);
|
|
3128
3128
|
case e.BYTE:
|
|
@@ -3131,122 +3131,122 @@ var zn = $t.exports;
|
|
|
3131
3131
|
}
|
|
3132
3132
|
t.fromArray = function(w) {
|
|
3133
3133
|
return w.reduce(function(y, g) {
|
|
3134
|
-
return typeof g == "string" ? y.push(
|
|
3134
|
+
return typeof g == "string" ? y.push(k(g, null)) : g.data && y.push(k(g.data, g.mode)), y;
|
|
3135
3135
|
}, []);
|
|
3136
3136
|
}, t.fromString = function(w, y) {
|
|
3137
|
-
const g = h(w, l.isKanjiModeEnabled()), C = m(g),
|
|
3138
|
-
for (let
|
|
3139
|
-
|
|
3140
|
-
return t.fromArray(u(
|
|
3137
|
+
const g = h(w, l.isKanjiModeEnabled()), C = m(g), E = p(C, y), P = a.find_path(E.map, "start", "end"), T = [];
|
|
3138
|
+
for (let L = 1; L < P.length - 1; L++)
|
|
3139
|
+
T.push(E.table[P[L]].node);
|
|
3140
|
+
return t.fromArray(u(T));
|
|
3141
3141
|
}, t.rawSplit = function(w) {
|
|
3142
3142
|
return t.fromArray(
|
|
3143
3143
|
h(w, l.isKanjiModeEnabled())
|
|
3144
3144
|
);
|
|
3145
3145
|
};
|
|
3146
|
-
})(
|
|
3147
|
-
const Ae =
|
|
3148
|
-
function
|
|
3149
|
-
const
|
|
3150
|
-
for (let i = 0; i <
|
|
3151
|
-
const o =
|
|
3146
|
+
})(Dt);
|
|
3147
|
+
const Ae = M, Te = Ce, zr = xr, qr = Sr, Vr = St, Hr = Ct, Ue = kt, Oe = ke, jr = kr, xe = Pt, Yr = _t, Kr = z, Ne = Dt;
|
|
3148
|
+
function Qr(t, e) {
|
|
3149
|
+
const r = t.size, n = Hr.getPositions(e);
|
|
3150
|
+
for (let i = 0; i < n.length; i++) {
|
|
3151
|
+
const o = n[i][0], s = n[i][1];
|
|
3152
3152
|
for (let l = -1; l <= 7; l++)
|
|
3153
|
-
if (!(o + l <= -1 ||
|
|
3153
|
+
if (!(o + l <= -1 || r <= o + l))
|
|
3154
3154
|
for (let a = -1; a <= 7; a++)
|
|
3155
|
-
s + a <= -1 ||
|
|
3155
|
+
s + a <= -1 || r <= s + a || (l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 2 && l <= 4 && a >= 2 && a <= 4 ? t.set(o + l, s + a, !0, !0) : t.set(o + l, s + a, !1, !0));
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
|
-
function
|
|
3158
|
+
function Zr(t) {
|
|
3159
3159
|
const e = t.size;
|
|
3160
|
-
for (let
|
|
3161
|
-
const
|
|
3162
|
-
t.set(
|
|
3160
|
+
for (let r = 8; r < e - 8; r++) {
|
|
3161
|
+
const n = r % 2 === 0;
|
|
3162
|
+
t.set(r, 6, n, !0), t.set(6, r, n, !0);
|
|
3163
3163
|
}
|
|
3164
3164
|
}
|
|
3165
|
-
function
|
|
3166
|
-
const
|
|
3167
|
-
for (let
|
|
3168
|
-
const i = n
|
|
3165
|
+
function Gr(t, e) {
|
|
3166
|
+
const r = Vr.getPositions(e);
|
|
3167
|
+
for (let n = 0; n < r.length; n++) {
|
|
3168
|
+
const i = r[n][0], o = r[n][1];
|
|
3169
3169
|
for (let s = -2; s <= 2; s++)
|
|
3170
3170
|
for (let l = -2; l <= 2; l++)
|
|
3171
3171
|
s === -2 || s === 2 || l === -2 || l === 2 || s === 0 && l === 0 ? t.set(i + s, o + l, !0, !0) : t.set(i + s, o + l, !1, !0);
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
3174
|
-
function
|
|
3175
|
-
const
|
|
3174
|
+
function Jr(t, e) {
|
|
3175
|
+
const r = t.size, n = xe.getEncodedBits(e);
|
|
3176
3176
|
let i, o, s;
|
|
3177
3177
|
for (let l = 0; l < 18; l++)
|
|
3178
|
-
i = Math.floor(l / 3), o = l % 3 +
|
|
3178
|
+
i = Math.floor(l / 3), o = l % 3 + r - 8 - 3, s = (n >> l & 1) === 1, t.set(i, o, s, !0), t.set(o, i, s, !0);
|
|
3179
3179
|
}
|
|
3180
|
-
function Re(t, e,
|
|
3181
|
-
const
|
|
3180
|
+
function Re(t, e, r) {
|
|
3181
|
+
const n = t.size, i = Yr.getEncodedBits(e, r);
|
|
3182
3182
|
let o, s;
|
|
3183
3183
|
for (o = 0; o < 15; o++)
|
|
3184
|
-
s = (i >> o & 1) === 1, o < 6 ? t.set(o, 8, s, !0) : o < 8 ? t.set(o + 1, 8, s, !0) : t.set(
|
|
3185
|
-
t.set(
|
|
3184
|
+
s = (i >> o & 1) === 1, o < 6 ? t.set(o, 8, s, !0) : o < 8 ? t.set(o + 1, 8, s, !0) : t.set(n - 15 + o, 8, s, !0), o < 8 ? t.set(8, n - o - 1, s, !0) : o < 9 ? t.set(8, 15 - o - 1 + 1, s, !0) : t.set(8, 15 - o - 1, s, !0);
|
|
3185
|
+
t.set(n - 8, 8, 1, !0);
|
|
3186
3186
|
}
|
|
3187
|
-
function
|
|
3188
|
-
const
|
|
3189
|
-
let
|
|
3190
|
-
for (let l =
|
|
3187
|
+
function Wr(t, e) {
|
|
3188
|
+
const r = t.size;
|
|
3189
|
+
let n = -1, i = r - 1, o = 7, s = 0;
|
|
3190
|
+
for (let l = r - 1; l > 0; l -= 2)
|
|
3191
3191
|
for (l === 6 && l--; ; ) {
|
|
3192
3192
|
for (let a = 0; a < 2; a++)
|
|
3193
3193
|
if (!t.isReserved(i, l - a)) {
|
|
3194
3194
|
let d = !1;
|
|
3195
3195
|
s < e.length && (d = (e[s] >>> o & 1) === 1), t.set(i, l - a, d), o--, o === -1 && (s++, o = 7);
|
|
3196
3196
|
}
|
|
3197
|
-
if (i +=
|
|
3198
|
-
i -=
|
|
3197
|
+
if (i += n, i < 0 || r <= i) {
|
|
3198
|
+
i -= n, n = -n;
|
|
3199
3199
|
break;
|
|
3200
3200
|
}
|
|
3201
3201
|
}
|
|
3202
3202
|
}
|
|
3203
|
-
function
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
|
|
3203
|
+
function Xr(t, e, r) {
|
|
3204
|
+
const n = new zr();
|
|
3205
|
+
r.forEach(function(a) {
|
|
3206
|
+
n.put(a.mode.bit, 4), n.put(a.getLength(), Kr.getCharCountIndicator(a.mode, t)), a.write(n);
|
|
3207
3207
|
});
|
|
3208
3208
|
const i = Ae.getSymbolTotalCodewords(t), o = Oe.getTotalCodewordsCount(t, e), s = (i - o) * 8;
|
|
3209
|
-
for (
|
|
3210
|
-
|
|
3211
|
-
const l = (s -
|
|
3209
|
+
for (n.getLengthInBits() + 4 <= s && n.put(0, 4); n.getLengthInBits() % 8 !== 0; )
|
|
3210
|
+
n.putBit(0);
|
|
3211
|
+
const l = (s - n.getLengthInBits()) / 8;
|
|
3212
3212
|
for (let a = 0; a < l; a++)
|
|
3213
|
-
|
|
3214
|
-
return
|
|
3213
|
+
n.put(a % 2 ? 17 : 236, 8);
|
|
3214
|
+
return en(n, t, e);
|
|
3215
3215
|
}
|
|
3216
|
-
function
|
|
3217
|
-
const
|
|
3216
|
+
function en(t, e, r) {
|
|
3217
|
+
const n = Ae.getSymbolTotalCodewords(e), i = Oe.getTotalCodewordsCount(e, r), o = n - i, s = Oe.getBlocksCount(e, r), l = n % s, a = s - l, d = Math.floor(n / s), c = Math.floor(o / s), h = c + 1, f = d - c, u = new jr(f);
|
|
3218
3218
|
let m = 0;
|
|
3219
|
-
const p = new Array(s),
|
|
3219
|
+
const p = new Array(s), k = new Array(s);
|
|
3220
3220
|
let b = 0;
|
|
3221
3221
|
const w = new Uint8Array(t.buffer);
|
|
3222
|
-
for (let
|
|
3223
|
-
const
|
|
3224
|
-
p[
|
|
3222
|
+
for (let P = 0; P < s; P++) {
|
|
3223
|
+
const T = P < a ? c : h;
|
|
3224
|
+
p[P] = w.slice(m, m + T), k[P] = u.encode(p[P]), m += T, b = Math.max(b, T);
|
|
3225
3225
|
}
|
|
3226
|
-
const y = new Uint8Array(
|
|
3227
|
-
let g = 0, C,
|
|
3226
|
+
const y = new Uint8Array(n);
|
|
3227
|
+
let g = 0, C, E;
|
|
3228
3228
|
for (C = 0; C < b; C++)
|
|
3229
|
-
for (
|
|
3230
|
-
C < p[
|
|
3229
|
+
for (E = 0; E < s; E++)
|
|
3230
|
+
C < p[E].length && (y[g++] = p[E][C]);
|
|
3231
3231
|
for (C = 0; C < f; C++)
|
|
3232
|
-
for (
|
|
3233
|
-
y[g++] = E
|
|
3232
|
+
for (E = 0; E < s; E++)
|
|
3233
|
+
y[g++] = k[E][C];
|
|
3234
3234
|
return y;
|
|
3235
3235
|
}
|
|
3236
|
-
function
|
|
3236
|
+
function tn(t, e, r, n) {
|
|
3237
3237
|
let i;
|
|
3238
3238
|
if (Array.isArray(t))
|
|
3239
|
-
i =
|
|
3239
|
+
i = Ne.fromArray(t);
|
|
3240
3240
|
else if (typeof t == "string") {
|
|
3241
3241
|
let d = e;
|
|
3242
3242
|
if (!d) {
|
|
3243
|
-
const c =
|
|
3244
|
-
d = xe.getBestVersionForData(c,
|
|
3243
|
+
const c = Ne.rawSplit(t);
|
|
3244
|
+
d = xe.getBestVersionForData(c, r);
|
|
3245
3245
|
}
|
|
3246
|
-
i =
|
|
3246
|
+
i = Ne.fromString(t, d || 40);
|
|
3247
3247
|
} else
|
|
3248
3248
|
throw new Error("Invalid data");
|
|
3249
|
-
const o = xe.getBestVersionForData(i,
|
|
3249
|
+
const o = xe.getBestVersionForData(i, r);
|
|
3250
3250
|
if (!o)
|
|
3251
3251
|
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
3252
3252
|
if (!e)
|
|
@@ -3258,82 +3258,82 @@ The chosen QR Code version cannot contain this amount of data.
|
|
|
3258
3258
|
Minimum version required to store current data is: ` + o + `.
|
|
3259
3259
|
`
|
|
3260
3260
|
);
|
|
3261
|
-
const s =
|
|
3262
|
-
return
|
|
3261
|
+
const s = Xr(e, r, i), l = Ae.getSymbolSize(e), a = new qr(l);
|
|
3262
|
+
return Qr(a, e), Zr(a), Gr(a, e), Re(a, r, 0), e >= 7 && Jr(a, e), Wr(a, s), isNaN(n) && (n = Ue.getBestMask(
|
|
3263
3263
|
a,
|
|
3264
|
-
Re.bind(null, a,
|
|
3265
|
-
)), Ue.applyMask(
|
|
3264
|
+
Re.bind(null, a, r)
|
|
3265
|
+
)), Ue.applyMask(n, a), Re(a, r, n), {
|
|
3266
3266
|
modules: a,
|
|
3267
3267
|
version: e,
|
|
3268
|
-
errorCorrectionLevel:
|
|
3269
|
-
maskPattern:
|
|
3268
|
+
errorCorrectionLevel: r,
|
|
3269
|
+
maskPattern: n,
|
|
3270
3270
|
segments: i
|
|
3271
3271
|
};
|
|
3272
3272
|
}
|
|
3273
|
-
vt.create = function(e,
|
|
3273
|
+
vt.create = function(e, r) {
|
|
3274
3274
|
if (typeof e > "u" || e === "")
|
|
3275
3275
|
throw new Error("No input text");
|
|
3276
|
-
let
|
|
3277
|
-
return typeof
|
|
3276
|
+
let n = Te.M, i, o;
|
|
3277
|
+
return typeof r < "u" && (n = Te.from(r.errorCorrectionLevel, Te.M), i = xe.from(r.version), o = Ue.from(r.maskPattern), r.toSJISFunc && Ae.setToSJISFunction(r.toSJISFunc)), tn(e, i, n, o);
|
|
3278
3278
|
};
|
|
3279
|
-
var
|
|
3279
|
+
var Tt = {}, Ze = {};
|
|
3280
3280
|
(function(t) {
|
|
3281
|
-
function e(
|
|
3282
|
-
if (typeof
|
|
3281
|
+
function e(r) {
|
|
3282
|
+
if (typeof r == "number" && (r = r.toString()), typeof r != "string")
|
|
3283
3283
|
throw new Error("Color should be defined as hex string");
|
|
3284
|
-
let
|
|
3285
|
-
if (
|
|
3286
|
-
throw new Error("Invalid hex color: " +
|
|
3287
|
-
(
|
|
3284
|
+
let n = r.slice().replace("#", "").split("");
|
|
3285
|
+
if (n.length < 3 || n.length === 5 || n.length > 8)
|
|
3286
|
+
throw new Error("Invalid hex color: " + r);
|
|
3287
|
+
(n.length === 3 || n.length === 4) && (n = Array.prototype.concat.apply([], n.map(function(o) {
|
|
3288
3288
|
return [o, o];
|
|
3289
|
-
}))),
|
|
3290
|
-
const i = parseInt(
|
|
3289
|
+
}))), n.length === 6 && n.push("F", "F");
|
|
3290
|
+
const i = parseInt(n.join(""), 16);
|
|
3291
3291
|
return {
|
|
3292
3292
|
r: i >> 24 & 255,
|
|
3293
3293
|
g: i >> 16 & 255,
|
|
3294
3294
|
b: i >> 8 & 255,
|
|
3295
3295
|
a: i & 255,
|
|
3296
|
-
hex: "#" +
|
|
3296
|
+
hex: "#" + n.slice(0, 6).join("")
|
|
3297
3297
|
};
|
|
3298
3298
|
}
|
|
3299
|
-
t.getOptions = function(
|
|
3300
|
-
|
|
3301
|
-
const i = typeof
|
|
3299
|
+
t.getOptions = function(n) {
|
|
3300
|
+
n || (n = {}), n.color || (n.color = {});
|
|
3301
|
+
const i = typeof n.margin > "u" || n.margin === null || n.margin < 0 ? 4 : n.margin, o = n.width && n.width >= 21 ? n.width : void 0, s = n.scale || 4;
|
|
3302
3302
|
return {
|
|
3303
3303
|
width: o,
|
|
3304
3304
|
scale: o ? 4 : s,
|
|
3305
3305
|
margin: i,
|
|
3306
3306
|
color: {
|
|
3307
|
-
dark: e(
|
|
3308
|
-
light: e(
|
|
3307
|
+
dark: e(n.color.dark || "#000000ff"),
|
|
3308
|
+
light: e(n.color.light || "#ffffffff")
|
|
3309
3309
|
},
|
|
3310
|
-
type:
|
|
3311
|
-
rendererOpts:
|
|
3310
|
+
type: n.type,
|
|
3311
|
+
rendererOpts: n.rendererOpts || {}
|
|
3312
3312
|
};
|
|
3313
|
-
}, t.getScale = function(
|
|
3314
|
-
return i.width && i.width >=
|
|
3315
|
-
}, t.getImageWidth = function(
|
|
3316
|
-
const o = t.getScale(
|
|
3317
|
-
return Math.floor((
|
|
3318
|
-
}, t.qrToImageData = function(
|
|
3313
|
+
}, t.getScale = function(n, i) {
|
|
3314
|
+
return i.width && i.width >= n + i.margin * 2 ? i.width / (n + i.margin * 2) : i.scale;
|
|
3315
|
+
}, t.getImageWidth = function(n, i) {
|
|
3316
|
+
const o = t.getScale(n, i);
|
|
3317
|
+
return Math.floor((n + i.margin * 2) * o);
|
|
3318
|
+
}, t.qrToImageData = function(n, i, o) {
|
|
3319
3319
|
const s = i.modules.size, l = i.modules.data, a = t.getScale(s, o), d = Math.floor((s + o.margin * 2) * a), c = o.margin * a, h = [o.color.light, o.color.dark];
|
|
3320
3320
|
for (let f = 0; f < d; f++)
|
|
3321
3321
|
for (let u = 0; u < d; u++) {
|
|
3322
3322
|
let m = (f * d + u) * 4, p = o.color.light;
|
|
3323
3323
|
if (f >= c && u >= c && f < d - c && u < d - c) {
|
|
3324
|
-
const
|
|
3325
|
-
p = h[l[
|
|
3324
|
+
const k = Math.floor((f - c) / a), b = Math.floor((u - c) / a);
|
|
3325
|
+
p = h[l[k * s + b] ? 1 : 0];
|
|
3326
3326
|
}
|
|
3327
|
-
|
|
3327
|
+
n[m++] = p.r, n[m++] = p.g, n[m++] = p.b, n[m] = p.a;
|
|
3328
3328
|
}
|
|
3329
3329
|
};
|
|
3330
|
-
})(
|
|
3330
|
+
})(Ze);
|
|
3331
3331
|
(function(t) {
|
|
3332
|
-
const e =
|
|
3333
|
-
function
|
|
3332
|
+
const e = Ze;
|
|
3333
|
+
function r(i, o, s) {
|
|
3334
3334
|
i.clearRect(0, 0, o.width, o.height), o.style || (o.style = {}), o.height = s, o.width = s, o.style.height = s + "px", o.style.width = s + "px";
|
|
3335
3335
|
}
|
|
3336
|
-
function
|
|
3336
|
+
function n() {
|
|
3337
3337
|
try {
|
|
3338
3338
|
return document.createElement("canvas");
|
|
3339
3339
|
} catch {
|
|
@@ -3342,77 +3342,77 @@ var Nt = {}, Ge = {};
|
|
|
3342
3342
|
}
|
|
3343
3343
|
t.render = function(o, s, l) {
|
|
3344
3344
|
let a = l, d = s;
|
|
3345
|
-
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), s || (d =
|
|
3345
|
+
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), s || (d = n()), a = e.getOptions(a);
|
|
3346
3346
|
const c = e.getImageWidth(o.modules.size, a), h = d.getContext("2d"), f = h.createImageData(c, c);
|
|
3347
|
-
return e.qrToImageData(f.data, o, a),
|
|
3347
|
+
return e.qrToImageData(f.data, o, a), r(h, d, c), h.putImageData(f, 0, 0), d;
|
|
3348
3348
|
}, t.renderToDataURL = function(o, s, l) {
|
|
3349
3349
|
let a = l;
|
|
3350
3350
|
typeof a > "u" && (!s || !s.getContext) && (a = s, s = void 0), a || (a = {});
|
|
3351
3351
|
const d = t.render(o, s, a), c = a.type || "image/png", h = a.rendererOpts || {};
|
|
3352
3352
|
return d.toDataURL(c, h.quality);
|
|
3353
3353
|
};
|
|
3354
|
-
})(
|
|
3355
|
-
var
|
|
3356
|
-
const
|
|
3354
|
+
})(Tt);
|
|
3355
|
+
var Nt = {};
|
|
3356
|
+
const rn = Ze;
|
|
3357
3357
|
function ct(t, e) {
|
|
3358
|
-
const
|
|
3359
|
-
return
|
|
3358
|
+
const r = t.a / 255, n = e + '="' + t.hex + '"';
|
|
3359
|
+
return r < 1 ? n + " " + e + '-opacity="' + r.toFixed(2).slice(1) + '"' : n;
|
|
3360
3360
|
}
|
|
3361
|
-
function
|
|
3362
|
-
let
|
|
3363
|
-
return typeof
|
|
3361
|
+
function Fe(t, e, r) {
|
|
3362
|
+
let n = t + e;
|
|
3363
|
+
return typeof r < "u" && (n += " " + r), n;
|
|
3364
3364
|
}
|
|
3365
|
-
function
|
|
3366
|
-
let
|
|
3365
|
+
function nn(t, e, r) {
|
|
3366
|
+
let n = "", i = 0, o = !1, s = 0;
|
|
3367
3367
|
for (let l = 0; l < t.length; l++) {
|
|
3368
3368
|
const a = Math.floor(l % e), d = Math.floor(l / e);
|
|
3369
|
-
!a && !o && (o = !0), t[l] ? (s++, l > 0 && a > 0 && t[l - 1] || (
|
|
3369
|
+
!a && !o && (o = !0), t[l] ? (s++, l > 0 && a > 0 && t[l - 1] || (n += o ? Fe("M", a + r, 0.5 + d + r) : Fe("m", i, 0), i = 0, o = !1), a + 1 < e && t[l + 1] || (n += Fe("h", s), s = 0)) : i++;
|
|
3370
3370
|
}
|
|
3371
|
-
return
|
|
3371
|
+
return n;
|
|
3372
3372
|
}
|
|
3373
|
-
|
|
3374
|
-
const i =
|
|
3373
|
+
Nt.render = function(e, r, n) {
|
|
3374
|
+
const i = rn.getOptions(r), o = e.modules.size, s = e.modules.data, l = o + i.margin * 2, a = i.color.light.a ? "<path " + ct(i.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", d = "<path " + ct(i.color.dark, "stroke") + ' d="' + nn(s, o, i.margin) + '"/>', c = 'viewBox="0 0 ' + l + " " + l + '"', f = '<svg xmlns="http://www.w3.org/2000/svg" ' + (i.width ? 'width="' + i.width + '" height="' + i.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + a + d + `</svg>
|
|
3375
3375
|
`;
|
|
3376
|
-
return typeof
|
|
3376
|
+
return typeof n == "function" && n(null, f), f;
|
|
3377
3377
|
};
|
|
3378
|
-
const
|
|
3379
|
-
function
|
|
3378
|
+
const on = wr, ze = vt, Rt = Tt, sn = Nt;
|
|
3379
|
+
function Ge(t, e, r, n, i) {
|
|
3380
3380
|
const o = [].slice.call(arguments, 1), s = o.length, l = typeof o[s - 1] == "function";
|
|
3381
|
-
if (!l && !
|
|
3381
|
+
if (!l && !on())
|
|
3382
3382
|
throw new Error("Callback required as last argument");
|
|
3383
3383
|
if (l) {
|
|
3384
3384
|
if (s < 2)
|
|
3385
3385
|
throw new Error("Too few arguments provided");
|
|
3386
|
-
s === 2 ? (i =
|
|
3386
|
+
s === 2 ? (i = r, r = e, e = n = void 0) : s === 3 && (e.getContext && typeof i > "u" ? (i = n, n = void 0) : (i = n, n = r, r = e, e = void 0));
|
|
3387
3387
|
} else {
|
|
3388
3388
|
if (s < 1)
|
|
3389
3389
|
throw new Error("Too few arguments provided");
|
|
3390
|
-
return s === 1 ? (
|
|
3390
|
+
return s === 1 ? (r = e, e = n = void 0) : s === 2 && !e.getContext && (n = r, r = e, e = void 0), new Promise(function(a, d) {
|
|
3391
3391
|
try {
|
|
3392
|
-
const c = ze.create(
|
|
3393
|
-
a(t(c, e,
|
|
3392
|
+
const c = ze.create(r, n);
|
|
3393
|
+
a(t(c, e, n));
|
|
3394
3394
|
} catch (c) {
|
|
3395
3395
|
d(c);
|
|
3396
3396
|
}
|
|
3397
3397
|
});
|
|
3398
3398
|
}
|
|
3399
3399
|
try {
|
|
3400
|
-
const a = ze.create(
|
|
3401
|
-
i(null, t(a, e,
|
|
3400
|
+
const a = ze.create(r, n);
|
|
3401
|
+
i(null, t(a, e, n));
|
|
3402
3402
|
} catch (a) {
|
|
3403
3403
|
i(a);
|
|
3404
3404
|
}
|
|
3405
3405
|
}
|
|
3406
3406
|
fe.create = ze.create;
|
|
3407
|
-
fe.toCanvas =
|
|
3408
|
-
fe.toDataURL =
|
|
3409
|
-
fe.toString =
|
|
3410
|
-
return
|
|
3407
|
+
fe.toCanvas = Ge.bind(null, Rt.render);
|
|
3408
|
+
fe.toDataURL = Ge.bind(null, Rt.renderToDataURL);
|
|
3409
|
+
fe.toString = Ge.bind(null, function(t, e, r) {
|
|
3410
|
+
return sn.render(t, r);
|
|
3411
3411
|
});
|
|
3412
|
-
var
|
|
3413
|
-
for (var i =
|
|
3414
|
-
(s = t[o]) && (i = (
|
|
3415
|
-
return
|
|
3412
|
+
var an = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, S = (t, e, r, n) => {
|
|
3413
|
+
for (var i = n > 1 ? void 0 : n ? ln(e, r) : e, o = t.length - 1, s; o >= 0; o--)
|
|
3414
|
+
(s = t[o]) && (i = (n ? s(e, r, i) : s(i)) || i);
|
|
3415
|
+
return n && i && an(e, r, i), i;
|
|
3416
3416
|
};
|
|
3417
3417
|
let v = class extends se {
|
|
3418
3418
|
constructor() {
|
|
@@ -3428,9 +3428,7 @@ let v = class extends se {
|
|
|
3428
3428
|
// --- Lifecycle ---
|
|
3429
3429
|
connectedCallback() {
|
|
3430
3430
|
super.connectedCallback(), window.addEventListener("message", this.handle3DSPostMessage), this.addEventListener("force-close-3ds-modal", () => {
|
|
3431
|
-
|
|
3432
|
-
"[3DS] force-close-3ds-modal event received - closing modal immediately (React Native fix)"
|
|
3433
|
-
), this.show3DSModal && (this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0);
|
|
3431
|
+
this.show3DSModal && (this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0);
|
|
3434
3432
|
});
|
|
3435
3433
|
}
|
|
3436
3434
|
firstUpdated() {
|
|
@@ -3443,8 +3441,8 @@ let v = class extends se {
|
|
|
3443
3441
|
// --- Cleave.js Setup ---
|
|
3444
3442
|
setupCleave() {
|
|
3445
3443
|
setTimeout(() => {
|
|
3446
|
-
var
|
|
3447
|
-
const t = (
|
|
3444
|
+
var r, n;
|
|
3445
|
+
const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("#cardNumber"), e = (n = this.shadowRoot) == null ? void 0 : n.querySelector("#expiry");
|
|
3448
3446
|
t && !this.cardNumberCleave && (this.cardNumberCleave = new at(t, {
|
|
3449
3447
|
creditCard: !0,
|
|
3450
3448
|
delimiter: " ",
|
|
@@ -3478,9 +3476,9 @@ let v = class extends se {
|
|
|
3478
3476
|
getFilteredPaymentMethods() {
|
|
3479
3477
|
const t = this.currentState.status === "ready" || this.currentState.status === "processing" || this.currentState.status === "requires_action" ? this.currentState.availableMethods || [] : [];
|
|
3480
3478
|
return t.length === 0 ? [] : t.filter((e) => {
|
|
3481
|
-
var
|
|
3482
|
-
return !((
|
|
3483
|
-
}).map((e) => e.id ===
|
|
3479
|
+
var r;
|
|
3480
|
+
return !((r = this.excludePaymentMethods) != null && r.includes(e.id));
|
|
3481
|
+
}).map((e) => e.id === V.PAYNOW && this.getTransactionData().currency !== "SGD" ? {
|
|
3484
3482
|
id: e.id,
|
|
3485
3483
|
enabled: !1,
|
|
3486
3484
|
disabledReason: "PayNow is only available for SGD currency"
|
|
@@ -3515,11 +3513,9 @@ let v = class extends se {
|
|
|
3515
3513
|
);
|
|
3516
3514
|
return;
|
|
3517
3515
|
}
|
|
3518
|
-
this.isInitialized || (this.isInitialized = !0, (t = this.sdk) == null || t.destroy(), this.sdk = new
|
|
3519
|
-
var
|
|
3520
|
-
|
|
3521
|
-
"[3DS] State changed from requires_action - closing modal and resuming polling"
|
|
3522
|
-
), this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling()), this.previousState = e, this.currentState = e, this.dispatchEvent(
|
|
3516
|
+
this.isInitialized || (this.isInitialized = !0, (t = this.sdk) == null || t.destroy(), this.sdk = new dr(this.config, this.adapters), this.sdk.subscribe((e) => {
|
|
3517
|
+
var r;
|
|
3518
|
+
((r = this.previousState) == null ? void 0 : r.status) === "requires_action" && e.status !== "requires_action" && this.show3DSModal && (this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling()), this.previousState = e, this.currentState = e, this.dispatchEvent(
|
|
3523
3519
|
new CustomEvent("state-change", {
|
|
3524
3520
|
detail: { state: e },
|
|
3525
3521
|
bubbles: !0,
|
|
@@ -3545,18 +3541,17 @@ let v = class extends se {
|
|
|
3545
3541
|
}), this.sdk.on("initialized", (e) => {
|
|
3546
3542
|
this.paymentData = e.payload.paymentData, this.isInitializing = !1;
|
|
3547
3543
|
}), this.sdk.on("payment_requires_action", (e) => {
|
|
3548
|
-
|
|
3544
|
+
this.nextActionUrl = e.payload.actionUrl, this.show3DSModal = !0, this.paymentLocked = !0, this.leaveEventsCounter = 0;
|
|
3549
3545
|
}), this.sdk.on("poll_started", () => {
|
|
3550
|
-
console.log("[3DS] poll_started event - first poll request sent");
|
|
3551
3546
|
const e = typeof window < "u" && "ReactNativeWebView" in window;
|
|
3552
|
-
this.show3DSModal && e
|
|
3547
|
+
this.show3DSModal && e && (this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling());
|
|
3553
3548
|
}), this.sdk.on(
|
|
3554
3549
|
"qr_code_received",
|
|
3555
3550
|
async (e) => {
|
|
3556
3551
|
if (this.qrCode = e.payload.qrCode, !this.qrCode)
|
|
3557
3552
|
return;
|
|
3558
|
-
const
|
|
3559
|
-
if (!
|
|
3553
|
+
const r = this.qrCode.startsWith("http://") || this.qrCode.startsWith("https://"), n = this.qrCode.startsWith("data:image");
|
|
3554
|
+
if (!r && !n)
|
|
3560
3555
|
try {
|
|
3561
3556
|
const i = await fe.toDataURL(this.qrCode, {
|
|
3562
3557
|
width: 300,
|
|
@@ -3589,12 +3584,12 @@ let v = class extends se {
|
|
|
3589
3584
|
this.qrAutoResumeTimer !== null && (clearTimeout(this.qrAutoResumeTimer), this.qrAutoResumeTimer = null), this.qrPollingInProgress = !0, this.sdk && this.sdk.resumePolling();
|
|
3590
3585
|
}
|
|
3591
3586
|
handle3DSComplete() {
|
|
3592
|
-
|
|
3587
|
+
this.show3DSModal = !1, this.nextActionUrl = null, this.leaveEventsCounter = 0, this.sdk && this.sdk.resumePolling();
|
|
3593
3588
|
}
|
|
3594
3589
|
handleInputChange(t, e) {
|
|
3595
3590
|
if (this.cardFormData = { ...this.cardFormData, [t]: e }, this.formErrors[t]) {
|
|
3596
|
-
const
|
|
3597
|
-
delete
|
|
3591
|
+
const r = { ...this.formErrors };
|
|
3592
|
+
delete r[t], this.formErrors = r;
|
|
3598
3593
|
}
|
|
3599
3594
|
}
|
|
3600
3595
|
// Luhn algorithm check for card number validation
|
|
@@ -3602,23 +3597,20 @@ let v = class extends se {
|
|
|
3602
3597
|
const e = t.replace(/\s/g, "");
|
|
3603
3598
|
if (!/^\d+$/.test(e))
|
|
3604
3599
|
return !1;
|
|
3605
|
-
let
|
|
3600
|
+
let r = 0, n = !1;
|
|
3606
3601
|
for (let i = e.length - 1; i >= 0; i--) {
|
|
3607
3602
|
const o = e.charAt(i);
|
|
3608
3603
|
if (!o) continue;
|
|
3609
3604
|
let s = parseInt(o, 10);
|
|
3610
|
-
|
|
3605
|
+
n && (s *= 2, s > 9 && (s -= 9)), r += s, n = !n;
|
|
3611
3606
|
}
|
|
3612
|
-
return
|
|
3607
|
+
return r % 10 === 0;
|
|
3613
3608
|
}
|
|
3614
3609
|
// Validate expiry date (MM/YY format)
|
|
3615
3610
|
validateExpiry(t) {
|
|
3616
|
-
console.log("[EXPIRY VALIDATION] Raw input:", JSON.stringify(t)), console.log("[EXPIRY VALIDATION] Input length:", t.length), console.log("[EXPIRY VALIDATION] Input char codes:", Array.from(t).map((f) => f.charCodeAt(0)));
|
|
3617
3611
|
const e = t.trim();
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
if (console.log("[EXPIRY VALIDATION] Format regex test:", r), !r)
|
|
3621
|
-
return console.log("[EXPIRY VALIDATION] ❌ FAILED - Invalid format"), { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3612
|
+
if (!/^\d{1,2}\/\d{2}$/.test(e))
|
|
3613
|
+
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3622
3614
|
const i = e.split("/"), o = i[0], s = i[1];
|
|
3623
3615
|
if (!o || !s)
|
|
3624
3616
|
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
@@ -3632,12 +3624,7 @@ let v = class extends se {
|
|
|
3632
3624
|
f < u && u - f > 80 ? h = m + 100 + f : h = m + f;
|
|
3633
3625
|
} else
|
|
3634
3626
|
return { valid: !1, error: "Invalid year format" };
|
|
3635
|
-
return
|
|
3636
|
-
"[EXPIRY DEBUG] EXPIRED - same year but month",
|
|
3637
|
-
l,
|
|
3638
|
-
"is less than current month",
|
|
3639
|
-
c
|
|
3640
|
-
), { valid: !1, error: "Card has expired" }) : (console.log("[EXPIRY DEBUG] VALID - card not expired"), { valid: !0 });
|
|
3627
|
+
return h < d ? { valid: !1, error: "Card has expired" } : h === d && l < c ? { valid: !1, error: "Card has expired" } : { valid: !0 };
|
|
3641
3628
|
}
|
|
3642
3629
|
validateCardForm() {
|
|
3643
3630
|
const t = {};
|
|
@@ -3653,11 +3640,11 @@ let v = class extends se {
|
|
|
3653
3640
|
if (!this.sdk || this.currentState.status !== "ready" || !this.validateCardForm())
|
|
3654
3641
|
return;
|
|
3655
3642
|
this.paymentLocked = !0;
|
|
3656
|
-
const t = this.cardFormData.expiry.split("/"), e = (t[0] || "").trim(),
|
|
3657
|
-
this.sdk.submitPayment(
|
|
3643
|
+
const t = this.cardFormData.expiry.split("/"), e = (t[0] || "").trim(), n = `20${(t[1] || "").trim().substring(0, 2)}`;
|
|
3644
|
+
this.sdk.submitPayment(V.CARD, {
|
|
3658
3645
|
cardNumber: this.cardFormData.cardNumber.replace(/\s/g, ""),
|
|
3659
3646
|
expiryMonth: e,
|
|
3660
|
-
expiryYear:
|
|
3647
|
+
expiryYear: n,
|
|
3661
3648
|
cvv: this.cardFormData.cvv,
|
|
3662
3649
|
firstName: this.firstName,
|
|
3663
3650
|
lastName: this.lastName,
|
|
@@ -3665,7 +3652,7 @@ let v = class extends se {
|
|
|
3665
3652
|
});
|
|
3666
3653
|
}
|
|
3667
3654
|
handlePayNowPayment() {
|
|
3668
|
-
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(
|
|
3655
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(V.PAYNOW, {
|
|
3669
3656
|
firstName: this.firstName,
|
|
3670
3657
|
lastName: this.lastName,
|
|
3671
3658
|
email: this.email
|
|
@@ -3687,15 +3674,15 @@ let v = class extends se {
|
|
|
3687
3674
|
},
|
|
3688
3675
|
netAmount: this.amount
|
|
3689
3676
|
};
|
|
3690
|
-
const e = (a = t.fees) == null ? void 0 : a.find((d) => d.owner === "merchant"),
|
|
3677
|
+
const e = (a = t.fees) == null ? void 0 : a.find((d) => d.owner === "merchant"), r = () => e ? e.type === "percentage" ? `${e.value}%` : `${e.value} ${e.currency}` : "", n = typeof t.totalFee == "number" ? t.totalFee : Number(t.totalFee) || 0, i = typeof t.totalSystemFee == "number" ? t.totalSystemFee : Number(t.totalSystemFee) || 0, o = t.initialAmount != null ? typeof t.initialAmount == "number" ? t.initialAmount : Number(t.initialAmount) || 0 : this.amount, s = t.customerAmount != null ? typeof t.customerAmount == "number" ? t.customerAmount : Number(t.customerAmount) || 0 : o, l = n - i;
|
|
3691
3678
|
return {
|
|
3692
3679
|
currency: t.currency || this.currency,
|
|
3693
3680
|
charge: o,
|
|
3694
|
-
fees:
|
|
3681
|
+
fees: n,
|
|
3695
3682
|
feeBreakdown: {
|
|
3696
3683
|
transactionFee: l,
|
|
3697
3684
|
merchantFee: l,
|
|
3698
|
-
merchantFeeLabel:
|
|
3685
|
+
merchantFeeLabel: r() || "0%"
|
|
3699
3686
|
},
|
|
3700
3687
|
netAmount: s
|
|
3701
3688
|
};
|
|
@@ -3754,7 +3741,7 @@ let v = class extends se {
|
|
|
3754
3741
|
`;
|
|
3755
3742
|
}
|
|
3756
3743
|
renderTransactionDetails() {
|
|
3757
|
-
const t = this.getTransactionData(), e = (
|
|
3744
|
+
const t = this.getTransactionData(), e = (r) => r.toFixed(2);
|
|
3758
3745
|
return A`
|
|
3759
3746
|
<div class="transaction-details">
|
|
3760
3747
|
<h2 class="transaction-title">Transaction details</h2>
|
|
@@ -3837,7 +3824,7 @@ let v = class extends se {
|
|
|
3837
3824
|
class="input ${this.formErrors.cardNumber ? "input-error" : ""}"
|
|
3838
3825
|
placeholder="1234 1234 1234 1234"
|
|
3839
3826
|
.value=${this.cardFormData.cardNumber}
|
|
3840
|
-
@input=${(
|
|
3827
|
+
@input=${(r) => this.handleInputChange("cardNumber", r.target.value)}
|
|
3841
3828
|
/>
|
|
3842
3829
|
${this.formErrors.cardNumber ? A`<div class="error-message">${this.formErrors.cardNumber}</div>` : ""}
|
|
3843
3830
|
</div>
|
|
@@ -3851,10 +3838,10 @@ let v = class extends se {
|
|
|
3851
3838
|
class="input ${this.formErrors.expiry ? "input-error" : ""}"
|
|
3852
3839
|
placeholder="MM/YY"
|
|
3853
3840
|
.value=${this.cardFormData.expiry}
|
|
3854
|
-
@input=${(
|
|
3855
|
-
const
|
|
3841
|
+
@input=${(r) => {
|
|
3842
|
+
const n = r.target;
|
|
3856
3843
|
setTimeout(() => {
|
|
3857
|
-
this.handleInputChange("expiry",
|
|
3844
|
+
this.handleInputChange("expiry", n.value);
|
|
3858
3845
|
}, 0);
|
|
3859
3846
|
}}
|
|
3860
3847
|
/>
|
|
@@ -3870,9 +3857,9 @@ let v = class extends se {
|
|
|
3870
3857
|
placeholder="${e}"
|
|
3871
3858
|
maxlength="${t}"
|
|
3872
3859
|
.value=${this.cardFormData.cvv}
|
|
3873
|
-
@input=${(
|
|
3874
|
-
const
|
|
3875
|
-
|
|
3860
|
+
@input=${(r) => {
|
|
3861
|
+
const n = r.target.value.replace(/\D/g, "");
|
|
3862
|
+
r.target.value = n, this.handleInputChange("cvv", n);
|
|
3876
3863
|
}}
|
|
3877
3864
|
/>
|
|
3878
3865
|
${this.formErrors.cvv ? A`<div class="error-message">${this.formErrors.cvv}</div>` : ""}
|
|
@@ -3886,9 +3873,9 @@ let v = class extends se {
|
|
|
3886
3873
|
class="input ${this.formErrors.cardholderName ? "input-error" : ""}"
|
|
3887
3874
|
placeholder="JOHN DOE"
|
|
3888
3875
|
.value=${this.cardFormData.cardholderName}
|
|
3889
|
-
@input=${(
|
|
3890
|
-
const
|
|
3891
|
-
|
|
3876
|
+
@input=${(r) => {
|
|
3877
|
+
const n = r.target.value.replace(/[^A-Za-z\s]/g, "").toUpperCase();
|
|
3878
|
+
r.target.value = n, this.handleInputChange("cardholderName", n);
|
|
3892
3879
|
}}
|
|
3893
3880
|
/>
|
|
3894
3881
|
${this.formErrors.cardholderName ? A`<div class="error-message">${this.formErrors.cardholderName}</div>` : ""}
|
|
@@ -4002,17 +3989,39 @@ let v = class extends se {
|
|
|
4002
3989
|
render() {
|
|
4003
3990
|
if ((this.currentState.status === "idle" || this.currentState.status === "initializing") && this.isInitializing && !this.paymentData)
|
|
4004
3991
|
return this.renderSkeletons();
|
|
4005
|
-
const t = this.currentState.status === "succeeded" || this.currentState.status === "failed", e = !t,
|
|
4006
|
-
if (
|
|
4007
|
-
const s =
|
|
3992
|
+
const t = this.currentState.status === "succeeded" || this.currentState.status === "failed", e = !t, r = this.getFilteredPaymentMethods();
|
|
3993
|
+
if (r.length > 0) {
|
|
3994
|
+
const s = r.some(
|
|
4008
3995
|
(l) => l.id === this.selectedMethod && l.enabled
|
|
4009
3996
|
);
|
|
4010
3997
|
if (!this.selectedMethod || !s) {
|
|
4011
|
-
const l =
|
|
3998
|
+
const l = r.find((a) => a.enabled);
|
|
4012
3999
|
l && this.selectedMethod !== l.id && (this.selectedMethod = l.id);
|
|
4013
4000
|
}
|
|
4014
4001
|
}
|
|
4015
|
-
const
|
|
4002
|
+
const n = (s) => s === V.CARD ? "Card" : "PayNow", i = (s) => s === V.CARD ? A`
|
|
4003
|
+
<div class="method-icon-right">
|
|
4004
|
+
<svg
|
|
4005
|
+
width="24"
|
|
4006
|
+
height="24"
|
|
4007
|
+
viewBox="0 0 24 24"
|
|
4008
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4009
|
+
>
|
|
4010
|
+
<path
|
|
4011
|
+
fill="none"
|
|
4012
|
+
d="M22 10H2M11 14H6M2 8.2L2 15.8C2 16.9201 2 17.4802 2.21799 17.908C2.40973 18.2843 2.71569 18.5903 3.09202 18.782C3.51984 19 4.07989 19 5.2 19L18.8 19C19.9201 19 20.4802 19 20.908 18.782C21.2843 18.5903 21.5903 18.2843 21.782 17.908C22 17.4802 22 16.9201 22 15.8V8.2C22 7.0799 22 6.51984 21.782 6.09202C21.5903 5.7157 21.2843 5.40974 20.908 5.21799C20.4802 5 19.9201 5 18.8 5L5.2 5C4.0799 5 3.51984 5 3.09202 5.21799C2.7157 5.40973 2.40973 5.71569 2.21799 6.09202C2 6.51984 2 7.07989 2 8.2Z"
|
|
4013
|
+
stroke="currentColor"
|
|
4014
|
+
stroke-width="2"
|
|
4015
|
+
stroke-linecap="round"
|
|
4016
|
+
stroke-linejoin="round"
|
|
4017
|
+
/>
|
|
4018
|
+
</svg>
|
|
4019
|
+
</div>
|
|
4020
|
+
` : s === V.PAYNOW ? A`
|
|
4021
|
+
<div class="method-icon-right">
|
|
4022
|
+
<img src="/images/pay-now.png" alt="PayNow" />
|
|
4023
|
+
</div>
|
|
4024
|
+
` : null, o = [
|
|
4016
4025
|
this.width ? `--one-payment-width: ${this.width}` : "",
|
|
4017
4026
|
this.maxWidth ? `--one-payment-max-width: ${this.maxWidth}` : ""
|
|
4018
4027
|
].filter(Boolean).join("; ");
|
|
@@ -4022,7 +4031,7 @@ let v = class extends se {
|
|
|
4022
4031
|
${e ? A`
|
|
4023
4032
|
<div class="header">Select a payment method</div>
|
|
4024
4033
|
<div class="payment-methods-list">
|
|
4025
|
-
${
|
|
4034
|
+
${r.map((s) => {
|
|
4026
4035
|
const l = this.selectedMethod === s.id, a = !s.enabled || this.paymentLocked && !l;
|
|
4027
4036
|
return A`
|
|
4028
4037
|
<div
|
|
@@ -4041,11 +4050,11 @@ let v = class extends se {
|
|
|
4041
4050
|
?disabled=${a}
|
|
4042
4051
|
@click=${(d) => d.stopPropagation()}
|
|
4043
4052
|
/>
|
|
4044
|
-
<
|
|
4045
|
-
|
|
4053
|
+
<span class="method-name">${n(s.id)}</span>
|
|
4054
|
+
${i(s.id)}
|
|
4046
4055
|
</div>
|
|
4047
4056
|
${l ? A`<div class="method-content">
|
|
4048
|
-
${s.id ===
|
|
4057
|
+
${s.id === V.CARD ? this.renderCardForm() : this.renderPayNowContent()}
|
|
4049
4058
|
</div>` : ""}
|
|
4050
4059
|
</div>
|
|
4051
4060
|
`;
|
|
@@ -4059,7 +4068,7 @@ let v = class extends se {
|
|
|
4059
4068
|
`;
|
|
4060
4069
|
}
|
|
4061
4070
|
};
|
|
4062
|
-
v.styles =
|
|
4071
|
+
v.styles = Lt`
|
|
4063
4072
|
:host {
|
|
4064
4073
|
display: block;
|
|
4065
4074
|
font-family:
|
|
@@ -4176,6 +4185,29 @@ v.styles = Bt`
|
|
|
4176
4185
|
margin-right: 0.625rem;
|
|
4177
4186
|
}
|
|
4178
4187
|
|
|
4188
|
+
.method-icon-right {
|
|
4189
|
+
width: 1.5rem;
|
|
4190
|
+
height: 1.5rem;
|
|
4191
|
+
min-width: 1.5rem;
|
|
4192
|
+
display: flex;
|
|
4193
|
+
align-items: center;
|
|
4194
|
+
justify-content: center;
|
|
4195
|
+
flex-shrink: 0;
|
|
4196
|
+
color: #6b7280;
|
|
4197
|
+
margin-left: auto;
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4200
|
+
.method-icon-right svg {
|
|
4201
|
+
width: 100%;
|
|
4202
|
+
height: 100%;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
.method-icon-right img {
|
|
4206
|
+
width: 100%;
|
|
4207
|
+
height: 100%;
|
|
4208
|
+
object-fit: contain;
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4179
4211
|
.method-name {
|
|
4180
4212
|
font-size: 1rem;
|
|
4181
4213
|
font-weight: 500;
|
|
@@ -5357,55 +5389,55 @@ S([
|
|
|
5357
5389
|
$({ type: String })
|
|
5358
5390
|
], v.prototype, "maxWidth", 2);
|
|
5359
5391
|
S([
|
|
5360
|
-
|
|
5392
|
+
_()
|
|
5361
5393
|
], v.prototype, "currentState", 2);
|
|
5362
5394
|
S([
|
|
5363
|
-
|
|
5395
|
+
_()
|
|
5364
5396
|
], v.prototype, "selectedMethod", 2);
|
|
5365
5397
|
S([
|
|
5366
|
-
|
|
5398
|
+
_()
|
|
5367
5399
|
], v.prototype, "cardFormData", 2);
|
|
5368
5400
|
S([
|
|
5369
|
-
|
|
5401
|
+
_()
|
|
5370
5402
|
], v.prototype, "formErrors", 2);
|
|
5371
5403
|
S([
|
|
5372
|
-
|
|
5404
|
+
_()
|
|
5373
5405
|
], v.prototype, "paymentData", 2);
|
|
5374
5406
|
S([
|
|
5375
|
-
|
|
5407
|
+
_()
|
|
5376
5408
|
], v.prototype, "feesExpanded", 2);
|
|
5377
5409
|
S([
|
|
5378
|
-
|
|
5410
|
+
_()
|
|
5379
5411
|
], v.prototype, "isInitializing", 2);
|
|
5380
5412
|
S([
|
|
5381
|
-
|
|
5413
|
+
_()
|
|
5382
5414
|
], v.prototype, "cardBrand", 2);
|
|
5383
5415
|
S([
|
|
5384
|
-
|
|
5416
|
+
_()
|
|
5385
5417
|
], v.prototype, "paymentLocked", 2);
|
|
5386
5418
|
S([
|
|
5387
|
-
|
|
5419
|
+
_()
|
|
5388
5420
|
], v.prototype, "show3DSModal", 2);
|
|
5389
5421
|
S([
|
|
5390
|
-
|
|
5422
|
+
_()
|
|
5391
5423
|
], v.prototype, "showQRModal", 2);
|
|
5392
5424
|
S([
|
|
5393
|
-
|
|
5425
|
+
_()
|
|
5394
5426
|
], v.prototype, "nextActionUrl", 2);
|
|
5395
5427
|
S([
|
|
5396
|
-
|
|
5428
|
+
_()
|
|
5397
5429
|
], v.prototype, "qrCode", 2);
|
|
5398
5430
|
S([
|
|
5399
|
-
|
|
5431
|
+
_()
|
|
5400
5432
|
], v.prototype, "qrCodeDataUrl", 2);
|
|
5401
5433
|
S([
|
|
5402
|
-
|
|
5434
|
+
_()
|
|
5403
5435
|
], v.prototype, "qrAutoResumeTimer", 2);
|
|
5404
5436
|
S([
|
|
5405
|
-
|
|
5437
|
+
_()
|
|
5406
5438
|
], v.prototype, "qrPollingInProgress", 2);
|
|
5407
5439
|
v = S([
|
|
5408
|
-
|
|
5440
|
+
rr("one-payment")
|
|
5409
5441
|
], v);
|
|
5410
5442
|
export {
|
|
5411
5443
|
v as OnePayment,
|