@one-payments/web-components 1.5.6 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1189 -958
- package/dist/one-payment.browser.iife.js +154 -43
- package/dist/one-payment.browser.iife.js.map +1 -1
- package/dist/one-payment.d.ts +6 -0
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +269 -2
- package/dist/one-payment.js.map +1 -1
- package/package.json +2 -2
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 yt = globalThis, qt = yt.ShadowRoot && (yt.ShadyCSS === void 0 || yt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ht = Symbol(),
|
|
6
|
+
const yt = globalThis, qt = yt.ShadowRoot && (yt.ShadyCSS === void 0 || yt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ht = Symbol(), Jt = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let he = class {
|
|
8
|
-
constructor(t, r,
|
|
9
|
-
if (this._$cssResult$ = !0,
|
|
8
|
+
constructor(t, r, i) {
|
|
9
|
+
if (this._$cssResult$ = !0, i !== Ht) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = r;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const r = this.t;
|
|
15
15
|
if (qt && t === void 0) {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const i = r !== void 0 && r.length === 1;
|
|
17
|
+
i && (t = Jt.get(r)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Jt.set(r, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,30 +22,30 @@ let he = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
const r = e.length === 1 ? e[0] : t.reduce((
|
|
27
|
-
if (
|
|
28
|
-
if (typeof
|
|
29
|
-
throw Error("Value passed to 'css' function must be a 'css' function result: " +
|
|
30
|
-
})(
|
|
25
|
+
const Le = (e) => new he(typeof e == "string" ? e : e + "", void 0, Ht), Be = (e, ...t) => {
|
|
26
|
+
const r = e.length === 1 ? e[0] : t.reduce((i, n, s) => i + ((o) => {
|
|
27
|
+
if (o._$cssResult$ === !0) return o.cssText;
|
|
28
|
+
if (typeof o == "number") return o;
|
|
29
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
|
+
})(n) + e[s + 1], e[0]);
|
|
31
31
|
return new he(r, e, Ht);
|
|
32
32
|
}, Ue = (e, t) => {
|
|
33
33
|
if (qt) e.adoptedStyleSheets = t.map((r) => r instanceof CSSStyleSheet ? r : r.styleSheet);
|
|
34
34
|
else for (const r of t) {
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const i = document.createElement("style"), n = yt.litNonce;
|
|
36
|
+
n !== void 0 && i.setAttribute("nonce", n), i.textContent = r.cssText, e.appendChild(i);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, Zt = qt ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let r = "";
|
|
40
|
-
for (const
|
|
41
|
-
return
|
|
40
|
+
for (const i of t.cssRules) r += i.cssText;
|
|
41
|
+
return Le(r);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Fe, defineProperty: Oe, getOwnPropertyDescriptor: ze, getOwnPropertyNames: qe, getOwnPropertySymbols: He, getPrototypeOf: Ye } = Object, z = globalThis, Xt = z.trustedTypes, Ve = Xt ? Xt.emptyScript : "",
|
|
48
|
+
const { is: Fe, defineProperty: Oe, getOwnPropertyDescriptor: ze, getOwnPropertyNames: qe, getOwnPropertySymbols: He, getPrototypeOf: Ye } = Object, z = globalThis, Xt = z.trustedTypes, Ve = Xt ? Xt.emptyScript : "", Et = z.reactiveElementPolyfillSupport, nt = (e, t) => e, bt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? Ve : null;
|
|
@@ -75,7 +75,7 @@ const { is: Fe, defineProperty: Oe, getOwnPropertyDescriptor: ze, getOwnProperty
|
|
|
75
75
|
return r;
|
|
76
76
|
} }, Yt = (e, t) => !Fe(e, t), te = { attribute: !0, type: String, converter: bt, reflect: !1, useDefault: !1, hasChanged: Yt };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), z.litPropertyMetadata ?? (z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
-
let
|
|
78
|
+
let K = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
81
|
}
|
|
@@ -84,58 +84,58 @@ let Q = class extends HTMLElement {
|
|
|
84
84
|
}
|
|
85
85
|
static createProperty(t, r = te) {
|
|
86
86
|
if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(t, r), !r.noAccessor) {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const i = Symbol(), n = this.getPropertyDescriptor(t, i, r);
|
|
88
|
+
n !== void 0 && Oe(this.prototype, t, n);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
static getPropertyDescriptor(t, r,
|
|
92
|
-
const { get:
|
|
91
|
+
static getPropertyDescriptor(t, r, i) {
|
|
92
|
+
const { get: n, set: s } = ze(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[r];
|
|
94
|
-
}, set(
|
|
95
|
-
this[r] =
|
|
94
|
+
}, set(o) {
|
|
95
|
+
this[r] = o;
|
|
96
96
|
} };
|
|
97
|
-
return { get:
|
|
98
|
-
const l =
|
|
99
|
-
|
|
97
|
+
return { get: n, set(o) {
|
|
98
|
+
const l = n == null ? void 0 : n.call(this);
|
|
99
|
+
s == null || s.call(this, o), this.requestUpdate(t, l, i);
|
|
100
100
|
}, configurable: !0, enumerable: !0 };
|
|
101
101
|
}
|
|
102
102
|
static getPropertyOptions(t) {
|
|
103
103
|
return this.elementProperties.get(t) ?? te;
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
106
|
+
if (this.hasOwnProperty(nt("elementProperties"))) return;
|
|
107
107
|
const t = Ye(this);
|
|
108
108
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
|
-
if (this.hasOwnProperty(
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
const r = this.properties,
|
|
114
|
-
for (const
|
|
111
|
+
if (this.hasOwnProperty(nt("finalized"))) return;
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(nt("properties"))) {
|
|
113
|
+
const r = this.properties, i = [...qe(r), ...He(r)];
|
|
114
|
+
for (const n of i) this.createProperty(n, r[n]);
|
|
115
115
|
}
|
|
116
116
|
const t = this[Symbol.metadata];
|
|
117
117
|
if (t !== null) {
|
|
118
118
|
const r = litPropertyMetadata.get(t);
|
|
119
|
-
if (r !== void 0) for (const [
|
|
119
|
+
if (r !== void 0) for (const [i, n] of r) this.elementProperties.set(i, n);
|
|
120
120
|
}
|
|
121
121
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
122
|
-
for (const [r,
|
|
123
|
-
const
|
|
124
|
-
|
|
122
|
+
for (const [r, i] of this.elementProperties) {
|
|
123
|
+
const n = this._$Eu(r, i);
|
|
124
|
+
n !== void 0 && this._$Eh.set(n, r);
|
|
125
125
|
}
|
|
126
126
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
127
127
|
}
|
|
128
128
|
static finalizeStyles(t) {
|
|
129
129
|
const r = [];
|
|
130
130
|
if (Array.isArray(t)) {
|
|
131
|
-
const
|
|
132
|
-
for (const
|
|
133
|
-
} else t !== void 0 && r.push(
|
|
131
|
+
const i = new Set(t.flat(1 / 0).reverse());
|
|
132
|
+
for (const n of i) r.unshift(Zt(n));
|
|
133
|
+
} else t !== void 0 && r.push(Zt(t));
|
|
134
134
|
return r;
|
|
135
135
|
}
|
|
136
136
|
static _$Eu(t, r) {
|
|
137
|
-
const
|
|
138
|
-
return
|
|
137
|
+
const i = r.attribute;
|
|
138
|
+
return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.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();
|
|
@@ -154,7 +154,7 @@ let Q = class extends HTMLElement {
|
|
|
154
154
|
}
|
|
155
155
|
_$E_() {
|
|
156
156
|
const t = /* @__PURE__ */ new Map(), r = this.constructor.elementProperties;
|
|
157
|
-
for (const
|
|
157
|
+
for (const i of r.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
158
158
|
t.size > 0 && (this._$Ep = t);
|
|
159
159
|
}
|
|
160
160
|
createRenderRoot() {
|
|
@@ -164,8 +164,8 @@ let Q = class extends HTMLElement {
|
|
|
164
164
|
connectedCallback() {
|
|
165
165
|
var t;
|
|
166
166
|
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((r) => {
|
|
167
|
-
var
|
|
168
|
-
return (
|
|
167
|
+
var i;
|
|
168
|
+
return (i = r.hostConnected) == null ? void 0 : i.call(r);
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
enableUpdating(t) {
|
|
@@ -173,42 +173,42 @@ let Q = class extends HTMLElement {
|
|
|
173
173
|
disconnectedCallback() {
|
|
174
174
|
var t;
|
|
175
175
|
(t = this._$EO) == null || t.forEach((r) => {
|
|
176
|
-
var
|
|
177
|
-
return (
|
|
176
|
+
var i;
|
|
177
|
+
return (i = r.hostDisconnected) == null ? void 0 : i.call(r);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
attributeChangedCallback(t, r,
|
|
181
|
-
this._$AK(t,
|
|
180
|
+
attributeChangedCallback(t, r, i) {
|
|
181
|
+
this._$AK(t, i);
|
|
182
182
|
}
|
|
183
183
|
_$ET(t, r) {
|
|
184
|
-
var
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
const
|
|
188
|
-
this._$Em = t,
|
|
184
|
+
var s;
|
|
185
|
+
const i = this.constructor.elementProperties.get(t), n = this.constructor._$Eu(t, i);
|
|
186
|
+
if (n !== void 0 && i.reflect === !0) {
|
|
187
|
+
const o = (((s = i.converter) == null ? void 0 : s.toAttribute) !== void 0 ? i.converter : bt).toAttribute(r, i.type);
|
|
188
|
+
this._$Em = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$Em = null;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
_$AK(t, r) {
|
|
192
|
-
var
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
195
|
-
const l =
|
|
196
|
-
this._$Em =
|
|
192
|
+
var s, o;
|
|
193
|
+
const i = this.constructor, n = i._$Eh.get(t);
|
|
194
|
+
if (n !== void 0 && this._$Em !== n) {
|
|
195
|
+
const l = i.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((s = l.converter) == null ? void 0 : s.fromAttribute) !== void 0 ? l.converter : bt;
|
|
196
|
+
this._$Em = n;
|
|
197
197
|
const c = a.fromAttribute(r, l.type);
|
|
198
|
-
this[
|
|
198
|
+
this[n] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(n)) ?? c, this._$Em = null;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
requestUpdate(t, r,
|
|
202
|
-
var
|
|
201
|
+
requestUpdate(t, r, i) {
|
|
202
|
+
var n;
|
|
203
203
|
if (t !== void 0) {
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
this.C(t, r,
|
|
204
|
+
const s = this.constructor, o = this[t];
|
|
205
|
+
if (i ?? (i = s.getPropertyOptions(t)), !((i.hasChanged ?? Yt)(o, r) || i.useDefault && i.reflect && o === ((n = this._$Ej) == null ? void 0 : n.get(t)) && !this.hasAttribute(s._$Eu(t, i)))) return;
|
|
206
|
+
this.C(t, r, i);
|
|
207
207
|
}
|
|
208
208
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
209
209
|
}
|
|
210
|
-
C(t, r, { useDefault:
|
|
211
|
-
|
|
210
|
+
C(t, r, { useDefault: i, reflect: n, wrapped: s }, o) {
|
|
211
|
+
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, o ?? r ?? this[t]), s !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (r = void 0), this._$AL.set(t, r)), n === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
|
|
212
212
|
}
|
|
213
213
|
async _$EP() {
|
|
214
214
|
this.isUpdatePending = !0;
|
|
@@ -224,28 +224,28 @@ let Q = class extends HTMLElement {
|
|
|
224
224
|
return this.performUpdate();
|
|
225
225
|
}
|
|
226
226
|
performUpdate() {
|
|
227
|
-
var
|
|
227
|
+
var i;
|
|
228
228
|
if (!this.isUpdatePending) return;
|
|
229
229
|
if (!this.hasUpdated) {
|
|
230
230
|
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
231
|
-
for (const [
|
|
231
|
+
for (const [s, o] of this._$Ep) this[s] = o;
|
|
232
232
|
this._$Ep = void 0;
|
|
233
233
|
}
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
const { wrapped: l } =
|
|
237
|
-
l !== !0 || this._$AL.has(
|
|
234
|
+
const n = this.constructor.elementProperties;
|
|
235
|
+
if (n.size > 0) for (const [s, o] of n) {
|
|
236
|
+
const { wrapped: l } = o, a = this[s];
|
|
237
|
+
l !== !0 || this._$AL.has(s) || a === void 0 || this.C(s, void 0, o, a);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
let t = !1;
|
|
241
241
|
const r = this._$AL;
|
|
242
242
|
try {
|
|
243
|
-
t = this.shouldUpdate(r), t ? (this.willUpdate(r), (
|
|
244
|
-
var
|
|
245
|
-
return (
|
|
243
|
+
t = this.shouldUpdate(r), t ? (this.willUpdate(r), (i = this._$EO) == null || i.forEach((n) => {
|
|
244
|
+
var s;
|
|
245
|
+
return (s = n.hostUpdate) == null ? void 0 : s.call(n);
|
|
246
246
|
}), this.update(r)) : this._$EM();
|
|
247
|
-
} catch (
|
|
248
|
-
throw t = !1, this._$EM(),
|
|
247
|
+
} catch (n) {
|
|
248
|
+
throw t = !1, this._$EM(), n;
|
|
249
249
|
}
|
|
250
250
|
t && this._$AE(r);
|
|
251
251
|
}
|
|
@@ -253,9 +253,9 @@ let Q = class extends HTMLElement {
|
|
|
253
253
|
}
|
|
254
254
|
_$AE(t) {
|
|
255
255
|
var r;
|
|
256
|
-
(r = this._$EO) == null || r.forEach((
|
|
257
|
-
var
|
|
258
|
-
return (
|
|
256
|
+
(r = this._$EO) == null || r.forEach((i) => {
|
|
257
|
+
var n;
|
|
258
|
+
return (n = i.hostUpdated) == null ? void 0 : n.call(i);
|
|
259
259
|
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
260
260
|
}
|
|
261
261
|
_$EM() {
|
|
@@ -278,74 +278,74 @@ let Q = class extends HTMLElement {
|
|
|
278
278
|
firstUpdated(t) {
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
|
|
281
|
+
K.elementStyles = [], K.shadowRootOptions = { mode: "open" }, K[nt("elementProperties")] = /* @__PURE__ */ new Map(), K[nt("finalized")] = /* @__PURE__ */ new Map(), Et == null || Et({ ReactiveElement: K }), (z.reactiveElementVersions ?? (z.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
|
|
288
|
-
\f\r]`,
|
|
289
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
287
|
+
const st = globalThis, vt = st.trustedTypes, ee = vt ? vt.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", F = `lit$${Math.random().toFixed(9).slice(2)}$`, me = "?" + F, je = `<${me}>`, G = document, lt = () => G.createComment(""), ct = (e) => e === null || typeof e != "object" && typeof e != "function", Vt = Array.isArray, Ge = (e) => Vt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", It = `[
|
|
288
|
+
\f\r]`, it = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, re = /-->/g, ie = />/g, H = RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^
|
|
289
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ne = /'/g, se = /"/g, fe = /^(?:script|style|textarea|title)$/i, Ke = (e) => (t, ...r) => ({ _$litType$: e, strings: t, values: r }), b = Ke(1), W = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), oe = /* @__PURE__ */ new WeakMap(), Y = G.createTreeWalker(G, 129);
|
|
290
290
|
function ge(e, t) {
|
|
291
291
|
if (!Vt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
292
292
|
return ee !== void 0 ? ee.createHTML(t) : t;
|
|
293
293
|
}
|
|
294
|
-
const
|
|
295
|
-
const r = e.length - 1,
|
|
296
|
-
let
|
|
294
|
+
const Qe = (e, t) => {
|
|
295
|
+
const r = e.length - 1, i = [];
|
|
296
|
+
let n, s = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = it;
|
|
297
297
|
for (let l = 0; l < r; l++) {
|
|
298
298
|
const a = e[l];
|
|
299
299
|
let c, d, h = -1, p = 0;
|
|
300
|
-
for (; p < a.length && (
|
|
301
|
-
const u =
|
|
302
|
-
|
|
300
|
+
for (; p < a.length && (o.lastIndex = p, d = o.exec(a), d !== null); ) p = o.lastIndex, o === it ? d[1] === "!--" ? o = re : d[1] !== void 0 ? o = ie : d[2] !== void 0 ? (fe.test(d[2]) && (n = RegExp("</" + d[2], "g")), o = H) : d[3] !== void 0 && (o = H) : o === H ? d[0] === ">" ? (o = n ?? it, h = -1) : d[1] === void 0 ? h = -2 : (h = o.lastIndex - d[2].length, c = d[1], o = d[3] === void 0 ? H : d[3] === '"' ? se : ne) : o === se || o === ne ? o = H : o === re || o === ie ? o = it : (o = H, n = void 0);
|
|
301
|
+
const u = o === H && e[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
+
s += o === it ? a + je : h >= 0 ? (i.push(c), a.slice(0, h) + pe + a.slice(h) + F + u) : a + F + (h === -2 ? l : u);
|
|
303
303
|
}
|
|
304
|
-
return [ge(e,
|
|
304
|
+
return [ge(e, s + (e[r] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
|
305
305
|
};
|
|
306
306
|
class dt {
|
|
307
|
-
constructor({ strings: t, _$litType$: r },
|
|
308
|
-
let
|
|
307
|
+
constructor({ strings: t, _$litType$: r }, i) {
|
|
308
|
+
let n;
|
|
309
309
|
this.parts = [];
|
|
310
|
-
let
|
|
311
|
-
const l = t.length - 1, a = this.parts, [c, d] =
|
|
312
|
-
if (this.el = dt.createElement(c,
|
|
310
|
+
let s = 0, o = 0;
|
|
311
|
+
const l = t.length - 1, a = this.parts, [c, d] = Qe(t, r);
|
|
312
|
+
if (this.el = dt.createElement(c, i), Y.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 (; (
|
|
317
|
-
if (
|
|
318
|
-
if (
|
|
319
|
-
const p = d[
|
|
320
|
-
a.push({ type: 1, index:
|
|
321
|
-
} else h.startsWith(F) && (a.push({ type: 6, index:
|
|
322
|
-
if (fe.test(
|
|
323
|
-
const h =
|
|
316
|
+
for (; (n = Y.nextNode()) !== null && a.length < l; ) {
|
|
317
|
+
if (n.nodeType === 1) {
|
|
318
|
+
if (n.hasAttributes()) for (const h of n.getAttributeNames()) if (h.endsWith(pe)) {
|
|
319
|
+
const p = d[o++], u = n.getAttribute(h).split(F), m = /([.?@])?(.*)/.exec(p);
|
|
320
|
+
a.push({ type: 1, index: s, name: m[2], strings: u, ctor: m[1] === "." ? Je : m[1] === "?" ? Ze : m[1] === "@" ? Xe : St }), n.removeAttribute(h);
|
|
321
|
+
} else h.startsWith(F) && (a.push({ type: 6, index: s }), n.removeAttribute(h));
|
|
322
|
+
if (fe.test(n.tagName)) {
|
|
323
|
+
const h = n.textContent.split(F), p = h.length - 1;
|
|
324
324
|
if (p > 0) {
|
|
325
|
-
|
|
326
|
-
for (let u = 0; u < p; u++)
|
|
327
|
-
|
|
325
|
+
n.textContent = vt ? vt.emptyScript : "";
|
|
326
|
+
for (let u = 0; u < p; u++) n.append(h[u], lt()), Y.nextNode(), a.push({ type: 2, index: ++s });
|
|
327
|
+
n.append(h[p], lt());
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
} else if (
|
|
330
|
+
} else if (n.nodeType === 8) if (n.data === me) a.push({ type: 2, index: s });
|
|
331
331
|
else {
|
|
332
332
|
let h = -1;
|
|
333
|
-
for (; (h =
|
|
333
|
+
for (; (h = n.data.indexOf(F, h + 1)) !== -1; ) a.push({ type: 7, index: s }), h += F.length - 1;
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
s++;
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
static createElement(t, r) {
|
|
339
|
-
const
|
|
340
|
-
return
|
|
339
|
+
const i = G.createElement("template");
|
|
340
|
+
return i.innerHTML = t, i;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
var
|
|
343
|
+
function J(e, t, r = e, i) {
|
|
344
|
+
var o, l;
|
|
345
345
|
if (t === W) return t;
|
|
346
|
-
let
|
|
347
|
-
const
|
|
348
|
-
return (
|
|
346
|
+
let n = i !== void 0 ? (o = r._$Co) == null ? void 0 : o[i] : r._$Cl;
|
|
347
|
+
const s = ct(t) ? void 0 : t._$litDirective$;
|
|
348
|
+
return (n == null ? void 0 : n.constructor) !== s && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), s === void 0 ? n = void 0 : (n = new s(e), n._$AT(e, r, i)), i !== void 0 ? (r._$Co ?? (r._$Co = []))[i] = n : r._$Cl = n), n !== void 0 && (t = J(e, n._$AS(e, t.values), n, i)), t;
|
|
349
349
|
}
|
|
350
350
|
class We {
|
|
351
351
|
constructor(t, r) {
|
|
@@ -358,21 +358,21 @@ class We {
|
|
|
358
358
|
return this._$AM._$AU;
|
|
359
359
|
}
|
|
360
360
|
u(t) {
|
|
361
|
-
const { el: { content: r }, parts:
|
|
362
|
-
Y.currentNode =
|
|
363
|
-
let
|
|
361
|
+
const { el: { content: r }, parts: i } = this._$AD, n = ((t == null ? void 0 : t.creationScope) ?? G).importNode(r, !0);
|
|
362
|
+
Y.currentNode = n;
|
|
363
|
+
let s = Y.nextNode(), o = 0, l = 0, a = i[0];
|
|
364
364
|
for (; a !== void 0; ) {
|
|
365
|
-
if (
|
|
365
|
+
if (o === a.index) {
|
|
366
366
|
let c;
|
|
367
|
-
a.type === 2 ? c = new ht(
|
|
367
|
+
a.type === 2 ? c = new ht(s, s.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(s, a.name, a.strings, this, t) : a.type === 6 && (c = new tr(s, this, t)), this._$AV.push(c), a = i[++l];
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
o !== (a == null ? void 0 : a.index) && (s = Y.nextNode(), o++);
|
|
370
370
|
}
|
|
371
|
-
return Y.currentNode = G,
|
|
371
|
+
return Y.currentNode = G, n;
|
|
372
372
|
}
|
|
373
373
|
p(t) {
|
|
374
374
|
let r = 0;
|
|
375
|
-
for (const
|
|
375
|
+
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, r), r += i.strings.length - 2) : i._$AI(t[r])), r++;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
class ht {
|
|
@@ -380,8 +380,8 @@ class ht {
|
|
|
380
380
|
var t;
|
|
381
381
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
382
382
|
}
|
|
383
|
-
constructor(t, r,
|
|
384
|
-
this.type = 2, this._$AH = I, this._$AN = void 0, this._$AA = t, this._$AB = r, this._$AM =
|
|
383
|
+
constructor(t, r, i, n) {
|
|
384
|
+
this.type = 2, this._$AH = I, this._$AN = void 0, this._$AA = t, this._$AB = r, this._$AM = i, this.options = n, this._$Cv = (n == null ? void 0 : n.isConnected) ?? !0;
|
|
385
385
|
}
|
|
386
386
|
get parentNode() {
|
|
387
387
|
let t = this._$AA.parentNode;
|
|
@@ -395,7 +395,7 @@ class ht {
|
|
|
395
395
|
return this._$AB;
|
|
396
396
|
}
|
|
397
397
|
_$AI(t, r = this) {
|
|
398
|
-
t =
|
|
398
|
+
t = J(this, t, r), ct(t) ? t === I || t == null || t === "" ? (this._$AH !== I && this._$AR(), this._$AH = I) : t !== this._$AH && t !== W && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ge(t) ? this.k(t) : this._(t);
|
|
399
399
|
}
|
|
400
400
|
O(t) {
|
|
401
401
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -407,30 +407,30 @@ class ht {
|
|
|
407
407
|
this._$AH !== I && ct(this._$AH) ? this._$AA.nextSibling.data = t : this.T(G.createTextNode(t)), this._$AH = t;
|
|
408
408
|
}
|
|
409
409
|
$(t) {
|
|
410
|
-
var
|
|
411
|
-
const { values: r, _$litType$:
|
|
412
|
-
if (((
|
|
410
|
+
var s;
|
|
411
|
+
const { values: r, _$litType$: i } = t, n = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = dt.createElement(ge(i.h, i.h[0]), this.options)), i);
|
|
412
|
+
if (((s = this._$AH) == null ? void 0 : s._$AD) === n) this._$AH.p(r);
|
|
413
413
|
else {
|
|
414
|
-
const
|
|
415
|
-
|
|
414
|
+
const o = new We(n, this), l = o.u(this.options);
|
|
415
|
+
o.p(r), this.T(l), this._$AH = o;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
_$AC(t) {
|
|
419
|
-
let r =
|
|
420
|
-
return r === void 0 &&
|
|
419
|
+
let r = oe.get(t.strings);
|
|
420
|
+
return r === void 0 && oe.set(t.strings, r = new dt(t)), r;
|
|
421
421
|
}
|
|
422
422
|
k(t) {
|
|
423
423
|
Vt(this._$AH) || (this._$AH = [], this._$AR());
|
|
424
424
|
const r = this._$AH;
|
|
425
|
-
let
|
|
426
|
-
for (const
|
|
427
|
-
|
|
425
|
+
let i, n = 0;
|
|
426
|
+
for (const s of t) n === r.length ? r.push(i = new ht(this.O(lt()), this.O(lt()), this, this.options)) : i = r[n], i._$AI(s), n++;
|
|
427
|
+
n < r.length && (this._$AR(i && i._$AB.nextSibling, n), r.length = n);
|
|
428
428
|
}
|
|
429
429
|
_$AR(t = this._$AA.nextSibling, r) {
|
|
430
|
-
var
|
|
431
|
-
for ((
|
|
432
|
-
const
|
|
433
|
-
t.remove(), t =
|
|
430
|
+
var i;
|
|
431
|
+
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, r); t !== this._$AB; ) {
|
|
432
|
+
const n = t.nextSibling;
|
|
433
|
+
t.remove(), t = n;
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
setConnected(t) {
|
|
@@ -445,25 +445,25 @@ class St {
|
|
|
445
445
|
get _$AU() {
|
|
446
446
|
return this._$AM._$AU;
|
|
447
447
|
}
|
|
448
|
-
constructor(t, r,
|
|
449
|
-
this.type = 1, this._$AH = I, this._$AN = void 0, this.element = t, this.name = r, this._$AM =
|
|
448
|
+
constructor(t, r, i, n, s) {
|
|
449
|
+
this.type = 1, this._$AH = I, this._$AN = void 0, this.element = t, this.name = r, this._$AM = n, this.options = s, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = I;
|
|
450
450
|
}
|
|
451
|
-
_$AI(t, r = this,
|
|
452
|
-
const
|
|
453
|
-
let
|
|
454
|
-
if (
|
|
451
|
+
_$AI(t, r = this, i, n) {
|
|
452
|
+
const s = this.strings;
|
|
453
|
+
let o = !1;
|
|
454
|
+
if (s === void 0) t = J(this, t, r, 0), o = !ct(t) || t !== this._$AH && t !== W, o && (this._$AH = t);
|
|
455
455
|
else {
|
|
456
456
|
const l = t;
|
|
457
457
|
let a, c;
|
|
458
|
-
for (t =
|
|
458
|
+
for (t = s[0], a = 0; a < s.length - 1; a++) c = J(this, l[i + a], r, a), c === W && (c = this._$AH[a]), o || (o = !ct(c) || c !== this._$AH[a]), c === I ? t = I : t !== I && (t += (c ?? "") + s[a + 1]), this._$AH[a] = c;
|
|
459
459
|
}
|
|
460
|
-
|
|
460
|
+
o && !n && this.j(t);
|
|
461
461
|
}
|
|
462
462
|
j(t) {
|
|
463
463
|
t === I ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class Je extends St {
|
|
467
467
|
constructor() {
|
|
468
468
|
super(...arguments), this.type = 3;
|
|
469
469
|
}
|
|
@@ -471,7 +471,7 @@ class Ze extends St {
|
|
|
471
471
|
this.element[this.name] = t === I ? void 0 : t;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
class
|
|
474
|
+
class Ze extends St {
|
|
475
475
|
constructor() {
|
|
476
476
|
super(...arguments), this.type = 4;
|
|
477
477
|
}
|
|
@@ -480,13 +480,13 @@ class Je extends St {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
class Xe extends St {
|
|
483
|
-
constructor(t, r,
|
|
484
|
-
super(t, r,
|
|
483
|
+
constructor(t, r, i, n, s) {
|
|
484
|
+
super(t, r, i, n, s), this.type = 5;
|
|
485
485
|
}
|
|
486
486
|
_$AI(t, r = this) {
|
|
487
|
-
if ((t =
|
|
488
|
-
const
|
|
489
|
-
|
|
487
|
+
if ((t = J(this, t, r, 0) ?? I) === W) return;
|
|
488
|
+
const i = this._$AH, n = t === I && i !== I || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, s = t !== I && (i === I || n);
|
|
489
|
+
n && this.element.removeEventListener(this.name, this, i), s && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
490
490
|
}
|
|
491
491
|
handleEvent(t) {
|
|
492
492
|
var r;
|
|
@@ -494,26 +494,26 @@ class Xe extends St {
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
class tr {
|
|
497
|
-
constructor(t, r,
|
|
498
|
-
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = r, this.options =
|
|
497
|
+
constructor(t, r, i) {
|
|
498
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = i;
|
|
499
499
|
}
|
|
500
500
|
get _$AU() {
|
|
501
501
|
return this._$AM._$AU;
|
|
502
502
|
}
|
|
503
503
|
_$AI(t) {
|
|
504
|
-
|
|
504
|
+
J(this, t);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
507
|
+
const Nt = st.litHtmlPolyfillSupport;
|
|
508
|
+
Nt == null || Nt(dt, ht), (st.litHtmlVersions ?? (st.litHtmlVersions = [])).push("3.3.1");
|
|
509
509
|
const er = (e, t, r) => {
|
|
510
|
-
const
|
|
511
|
-
let
|
|
512
|
-
if (
|
|
513
|
-
const
|
|
514
|
-
|
|
510
|
+
const i = (r == null ? void 0 : r.renderBefore) ?? t;
|
|
511
|
+
let n = i._$litPart$;
|
|
512
|
+
if (n === void 0) {
|
|
513
|
+
const s = (r == null ? void 0 : r.renderBefore) ?? null;
|
|
514
|
+
i._$litPart$ = n = new ht(t.insertBefore(lt(), s), s, void 0, r ?? {});
|
|
515
515
|
}
|
|
516
|
-
return
|
|
516
|
+
return n._$AI(e), n;
|
|
517
517
|
};
|
|
518
518
|
/**
|
|
519
519
|
* @license
|
|
@@ -521,7 +521,7 @@ const er = (e, t, r) => {
|
|
|
521
521
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
522
522
|
*/
|
|
523
523
|
const j = globalThis;
|
|
524
|
-
class
|
|
524
|
+
class ot extends K {
|
|
525
525
|
constructor() {
|
|
526
526
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
527
527
|
}
|
|
@@ -547,9 +547,9 @@ class st extends Q {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
var ue;
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
550
|
+
ot._$litElement$ = !0, ot.finalized = !0, (ue = j.litElementHydrateSupport) == null || ue.call(j, { LitElement: ot });
|
|
551
|
+
const Dt = j.litElementPolyfillSupport;
|
|
552
|
+
Dt == null || Dt({ LitElement: ot });
|
|
553
553
|
(j.litElementVersions ?? (j.litElementVersions = [])).push("4.2.1");
|
|
554
554
|
/**
|
|
555
555
|
* @license
|
|
@@ -566,31 +566,31 @@ const rr = (e) => (t, r) => {
|
|
|
566
566
|
* Copyright 2017 Google LLC
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
|
-
const
|
|
570
|
-
const { kind:
|
|
571
|
-
let
|
|
572
|
-
if (
|
|
573
|
-
const { name:
|
|
569
|
+
const ir = { attribute: !0, type: String, converter: bt, reflect: !1, hasChanged: Yt }, nr = (e = ir, t, r) => {
|
|
570
|
+
const { kind: i, metadata: n } = r;
|
|
571
|
+
let s = globalThis.litPropertyMetadata.get(n);
|
|
572
|
+
if (s === void 0 && globalThis.litPropertyMetadata.set(n, s = /* @__PURE__ */ new Map()), i === "setter" && ((e = Object.create(e)).wrapped = !0), s.set(r.name, e), i === "accessor") {
|
|
573
|
+
const { name: o } = r;
|
|
574
574
|
return { set(l) {
|
|
575
575
|
const a = t.get.call(this);
|
|
576
|
-
t.set.call(this, l), this.requestUpdate(
|
|
576
|
+
t.set.call(this, l), this.requestUpdate(o, a, e);
|
|
577
577
|
}, init(l) {
|
|
578
|
-
return l !== void 0 && this.C(
|
|
578
|
+
return l !== void 0 && this.C(o, void 0, e, l), l;
|
|
579
579
|
} };
|
|
580
580
|
}
|
|
581
|
-
if (
|
|
582
|
-
const { name:
|
|
581
|
+
if (i === "setter") {
|
|
582
|
+
const { name: o } = r;
|
|
583
583
|
return function(l) {
|
|
584
|
-
const a = this[
|
|
585
|
-
t.call(this, l), this.requestUpdate(
|
|
584
|
+
const a = this[o];
|
|
585
|
+
t.call(this, l), this.requestUpdate(o, a, e);
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
throw Error("Unsupported decorator location: " +
|
|
588
|
+
throw Error("Unsupported decorator location: " + i);
|
|
589
589
|
};
|
|
590
|
-
function
|
|
591
|
-
return (t, r) => typeof r == "object" ?
|
|
592
|
-
const
|
|
593
|
-
return
|
|
590
|
+
function D(e) {
|
|
591
|
+
return (t, r) => typeof r == "object" ? nr(e, t, r) : ((i, n, s) => {
|
|
592
|
+
const o = n.hasOwnProperty(s);
|
|
593
|
+
return n.constructor.createProperty(s, i), o ? Object.getOwnPropertyDescriptor(n, s) : void 0;
|
|
594
594
|
})(e, t, r);
|
|
595
595
|
}
|
|
596
596
|
/**
|
|
@@ -598,10 +598,10 @@ function M(e) {
|
|
|
598
598
|
* Copyright 2017 Google LLC
|
|
599
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
600
|
*/
|
|
601
|
-
function
|
|
602
|
-
return
|
|
601
|
+
function N(e) {
|
|
602
|
+
return D({ ...e, state: !0, attribute: !1 });
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function sr(e) {
|
|
605
605
|
return e instanceof Error && ("response" in e && typeof e.response == "object" && e.response !== null || "data" in e && typeof e.data == "object" && e.data !== null);
|
|
606
606
|
}
|
|
607
607
|
var f = {
|
|
@@ -614,7 +614,10 @@ var f = {
|
|
|
614
614
|
SHOPEEPAY: "shopeepay",
|
|
615
615
|
ATOM: "atom",
|
|
616
616
|
DANA: "dana",
|
|
617
|
-
TNG: "tng"
|
|
617
|
+
TNG: "tng",
|
|
618
|
+
ALIPAYCN: "alipaycn",
|
|
619
|
+
ALIPAYHK: "alipayhk",
|
|
620
|
+
GCASH: "gcash"
|
|
618
621
|
}, T = {
|
|
619
622
|
IDLE: "idle",
|
|
620
623
|
INITIALIZING: "initializing",
|
|
@@ -624,21 +627,21 @@ var f = {
|
|
|
624
627
|
SUCCEEDED: "succeeded",
|
|
625
628
|
FAILED: "failed"
|
|
626
629
|
};
|
|
627
|
-
function
|
|
630
|
+
function or(e) {
|
|
628
631
|
return e === "paid" ? "succeeded" : e;
|
|
629
632
|
}
|
|
630
633
|
var ar = class {
|
|
631
|
-
constructor(e, t, r,
|
|
632
|
-
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = e, this.baseUrl = t, this.token = r, this.onStatusUpdate =
|
|
633
|
-
interval:
|
|
634
|
+
constructor(e, t, r, i, n = {}, s) {
|
|
635
|
+
this.isPolling = !1, this.attempts = 0, this.startTime = 0, this.pollTimeoutId = null, this.adapters = e, this.baseUrl = t, this.token = r, this.onStatusUpdate = i, this.onPollStart = s, this.config = {
|
|
636
|
+
interval: n.interval ?? 3e3,
|
|
634
637
|
// 3 seconds default
|
|
635
|
-
maxAttempts:
|
|
638
|
+
maxAttempts: n.maxAttempts ?? 60,
|
|
636
639
|
// 60 attempts = 3 minutes
|
|
637
|
-
timeout:
|
|
640
|
+
timeout: n.timeout ?? 18e4,
|
|
638
641
|
// 3 minutes
|
|
639
|
-
ignore3DS:
|
|
642
|
+
ignore3DS: n.ignore3DS ?? !1,
|
|
640
643
|
// Default: don't ignore 3DS
|
|
641
|
-
ignoreQR:
|
|
644
|
+
ignoreQR: n.ignoreQR ?? !1
|
|
642
645
|
// Default: don't ignore QR
|
|
643
646
|
};
|
|
644
647
|
}
|
|
@@ -711,7 +714,7 @@ var ar = class {
|
|
|
711
714
|
"x-token": this.token
|
|
712
715
|
}
|
|
713
716
|
), t = {
|
|
714
|
-
status:
|
|
717
|
+
status: or(e.result.status),
|
|
715
718
|
// Map "paid" to "succeeded"
|
|
716
719
|
paymentIntentId: e.result.paymentIntentId || "",
|
|
717
720
|
...e.result.amount !== void 0 && { amount: e.result.amount },
|
|
@@ -873,8 +876,8 @@ var cr = class {
|
|
|
873
876
|
this.eventListeners[e] || (this.eventListeners[e] = []);
|
|
874
877
|
const r = this.eventListeners[e];
|
|
875
878
|
return r.push(t), () => {
|
|
876
|
-
const
|
|
877
|
-
|
|
879
|
+
const i = r.indexOf(t);
|
|
880
|
+
i > -1 && r.splice(i, 1);
|
|
878
881
|
};
|
|
879
882
|
}
|
|
880
883
|
/**
|
|
@@ -927,17 +930,17 @@ var cr = class {
|
|
|
927
930
|
currency: e.currency,
|
|
928
931
|
notes: e.notes,
|
|
929
932
|
orderId: e.orderId
|
|
930
|
-
}, r = JSON.stringify(t),
|
|
933
|
+
}, r = JSON.stringify(t), i = await this.adapters.crypto.hmacSHA256(this.config.secretKey, r), n = await this.adapters.http.post(
|
|
931
934
|
`${this.getApiBaseUrl()}/payment-intent/create`,
|
|
932
935
|
t,
|
|
933
936
|
{
|
|
934
937
|
"x-api-key": this.config.apiKey,
|
|
935
|
-
"x-signature":
|
|
938
|
+
"x-signature": i
|
|
936
939
|
}
|
|
937
|
-
),
|
|
938
|
-
if (!
|
|
940
|
+
), o = new URL(n.result.redirectUrl).searchParams.get("token");
|
|
941
|
+
if (!o)
|
|
939
942
|
throw new Error("No token found in redirectUrl");
|
|
940
|
-
this.paymentToken =
|
|
943
|
+
this.paymentToken = o, this.paymentIntentId = n.result.paymentIntentId;
|
|
941
944
|
const l = await this.adapters.http.get(
|
|
942
945
|
`${this.getApiBaseUrl()}/payment-intent/get-payment-data`,
|
|
943
946
|
{
|
|
@@ -998,6 +1001,18 @@ var cr = class {
|
|
|
998
1001
|
id: "tng",
|
|
999
1002
|
enabled: !0,
|
|
1000
1003
|
priority: h++
|
|
1004
|
+
}), (u.includes("alipaycn") || u.includes("alipay cn") || u.includes("alipay_cn") || m.includes("payments_alipaycn")) && d.push({
|
|
1005
|
+
id: "alipaycn",
|
|
1006
|
+
enabled: !0,
|
|
1007
|
+
priority: h++
|
|
1008
|
+
}), (u.includes("alipayhk") || u.includes("alipay hk") || u.includes("alipay_hk") || m.includes("payments_alipayhk")) && d.push({
|
|
1009
|
+
id: "alipayhk",
|
|
1010
|
+
enabled: !0,
|
|
1011
|
+
priority: h++
|
|
1012
|
+
}), (u.includes("gcash") || u.includes("g cash") || m.includes("payments_gcash")) && d.push({
|
|
1013
|
+
id: "gcash",
|
|
1014
|
+
enabled: !0,
|
|
1015
|
+
priority: h++
|
|
1001
1016
|
});
|
|
1002
1017
|
}), this.setState({
|
|
1003
1018
|
status: T.READY,
|
|
@@ -1078,7 +1093,7 @@ var cr = class {
|
|
|
1078
1093
|
* @public
|
|
1079
1094
|
*/
|
|
1080
1095
|
async submitPayment(e, t) {
|
|
1081
|
-
var n,
|
|
1096
|
+
var i, n, s, o, l;
|
|
1082
1097
|
const r = this.state;
|
|
1083
1098
|
if (r.status !== "ready")
|
|
1084
1099
|
throw new Error("Cannot submit payment: SDK not in ready state");
|
|
@@ -1117,6 +1132,12 @@ var cr = class {
|
|
|
1117
1132
|
return "dana";
|
|
1118
1133
|
case "tng":
|
|
1119
1134
|
return "tng";
|
|
1135
|
+
case "alipaycn":
|
|
1136
|
+
return "alipaycn";
|
|
1137
|
+
case "alipayhk":
|
|
1138
|
+
return "alipayhk";
|
|
1139
|
+
case "gcash":
|
|
1140
|
+
return "gcash";
|
|
1120
1141
|
default:
|
|
1121
1142
|
return "qr";
|
|
1122
1143
|
}
|
|
@@ -1151,9 +1172,9 @@ var cr = class {
|
|
|
1151
1172
|
let c = "Unknown error", d = "PAYMENT_FAILED";
|
|
1152
1173
|
if (a instanceof Error)
|
|
1153
1174
|
try {
|
|
1154
|
-
if (
|
|
1155
|
-
const p = (
|
|
1156
|
-
p ? (c = p.message || ((
|
|
1175
|
+
if (sr(a)) {
|
|
1176
|
+
const p = (i = a.response) == null ? void 0 : i.data, u = a.data;
|
|
1177
|
+
p ? (c = p.message || ((n = p.error) == null ? void 0 : n.message) || a.message, d = p.code || ((s = p.error) == null ? void 0 : s.code) || d) : u ? (c = u.message || ((o = u.error) == null ? void 0 : o.message) || a.message, d = u.code || ((l = u.error) == null ? void 0 : l.code) || d) : c = a.message;
|
|
1157
1178
|
} else
|
|
1158
1179
|
c = a.message;
|
|
1159
1180
|
} catch {
|
|
@@ -1296,7 +1317,7 @@ var cr = class {
|
|
|
1296
1317
|
this.stopPolling();
|
|
1297
1318
|
return;
|
|
1298
1319
|
}
|
|
1299
|
-
const r = t.selectedMethod === "promptpay" || t.selectedMethod === "duitnow" || t.selectedMethod === "gopay" || t.selectedMethod === "boost" || t.selectedMethod === "shopeepay" || t.selectedMethod === "atom" || t.selectedMethod === "dana" || t.selectedMethod === "tng";
|
|
1320
|
+
const r = t.selectedMethod === "promptpay" || t.selectedMethod === "duitnow" || t.selectedMethod === "gopay" || t.selectedMethod === "boost" || t.selectedMethod === "shopeepay" || t.selectedMethod === "atom" || t.selectedMethod === "dana" || t.selectedMethod === "tng" || t.selectedMethod === "alipaycn" || t.selectedMethod === "alipayhk" || t.selectedMethod === "gcash";
|
|
1300
1321
|
if (e.qrCode && !this.ignoreQRInPolling && !r) {
|
|
1301
1322
|
this.emit({
|
|
1302
1323
|
type: "qr_code_received",
|
|
@@ -1388,6 +1409,36 @@ var cr = class {
|
|
|
1388
1409
|
});
|
|
1389
1410
|
return;
|
|
1390
1411
|
}
|
|
1412
|
+
if (t.selectedMethod === "alipaycn") {
|
|
1413
|
+
this.stopPolling(), this.emit({
|
|
1414
|
+
type: "alipaycn_redirect",
|
|
1415
|
+
payload: {
|
|
1416
|
+
redirectUrl: e.nextActionUrl,
|
|
1417
|
+
methodId: t.selectedMethod
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
if (t.selectedMethod === "alipayhk") {
|
|
1423
|
+
this.stopPolling(), this.emit({
|
|
1424
|
+
type: "alipayhk_redirect",
|
|
1425
|
+
payload: {
|
|
1426
|
+
redirectUrl: e.nextActionUrl,
|
|
1427
|
+
methodId: t.selectedMethod
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
if (t.selectedMethod === "gcash") {
|
|
1433
|
+
this.stopPolling(), this.emit({
|
|
1434
|
+
type: "gcash_redirect",
|
|
1435
|
+
payload: {
|
|
1436
|
+
redirectUrl: e.nextActionUrl,
|
|
1437
|
+
methodId: t.selectedMethod
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1391
1442
|
if (t.selectedMethod === "paynow" && !this.ignoreQRInPolling) {
|
|
1392
1443
|
this.emit({
|
|
1393
1444
|
type: "qr_code_received",
|
|
@@ -1399,7 +1450,7 @@ var cr = class {
|
|
|
1399
1450
|
});
|
|
1400
1451
|
return;
|
|
1401
1452
|
}
|
|
1402
|
-
const
|
|
1453
|
+
const n = {
|
|
1403
1454
|
id: e.paymentIntentId,
|
|
1404
1455
|
amount: e.amount ?? t.paymentIntent.amount,
|
|
1405
1456
|
currency: e.currency ?? t.paymentIntent.currency,
|
|
@@ -1408,21 +1459,21 @@ var cr = class {
|
|
|
1408
1459
|
};
|
|
1409
1460
|
this.setState({
|
|
1410
1461
|
status: T.REQUIRES_ACTION,
|
|
1411
|
-
paymentIntent:
|
|
1462
|
+
paymentIntent: n,
|
|
1412
1463
|
actionUrl: e.nextActionUrl,
|
|
1413
1464
|
selectedMethod: t.selectedMethod,
|
|
1414
1465
|
availableMethods: t.availableMethods
|
|
1415
1466
|
}), this.emit({
|
|
1416
1467
|
type: "payment_requires_action",
|
|
1417
1468
|
payload: {
|
|
1418
|
-
paymentIntent:
|
|
1469
|
+
paymentIntent: n,
|
|
1419
1470
|
actionUrl: e.nextActionUrl,
|
|
1420
1471
|
methodId: t.selectedMethod
|
|
1421
1472
|
}
|
|
1422
1473
|
});
|
|
1423
1474
|
return;
|
|
1424
1475
|
}
|
|
1425
|
-
const
|
|
1476
|
+
const i = {
|
|
1426
1477
|
id: e.paymentIntentId,
|
|
1427
1478
|
amount: e.amount ?? t.paymentIntent.amount,
|
|
1428
1479
|
currency: e.currency ?? t.paymentIntent.currency,
|
|
@@ -1432,31 +1483,31 @@ var cr = class {
|
|
|
1432
1483
|
if (e.status === "succeeded")
|
|
1433
1484
|
this.stopPolling(), this.setState({
|
|
1434
1485
|
status: T.SUCCEEDED,
|
|
1435
|
-
paymentIntent:
|
|
1486
|
+
paymentIntent: i,
|
|
1436
1487
|
selectedMethod: t.selectedMethod
|
|
1437
1488
|
}), this.emit({
|
|
1438
1489
|
type: "payment_succeeded",
|
|
1439
1490
|
payload: {
|
|
1440
|
-
paymentIntent:
|
|
1491
|
+
paymentIntent: i,
|
|
1441
1492
|
methodId: t.selectedMethod
|
|
1442
1493
|
}
|
|
1443
1494
|
});
|
|
1444
1495
|
else if (e.status === "failed") {
|
|
1445
1496
|
this.stopPolling();
|
|
1446
|
-
const
|
|
1497
|
+
const s = {
|
|
1447
1498
|
code: "PAYMENT_FAILED",
|
|
1448
1499
|
message: e.error && typeof e.error == "object" && e.error !== null && "message" in e.error ? String(e.error.message) : "Payment failed",
|
|
1449
1500
|
timestamp: this.adapters.timer.now()
|
|
1450
1501
|
};
|
|
1451
1502
|
this.setState({
|
|
1452
1503
|
status: T.FAILED,
|
|
1453
|
-
error:
|
|
1454
|
-
paymentIntent:
|
|
1504
|
+
error: s,
|
|
1505
|
+
paymentIntent: i
|
|
1455
1506
|
}), this.emit({
|
|
1456
1507
|
type: "payment_failed",
|
|
1457
1508
|
payload: {
|
|
1458
|
-
error:
|
|
1459
|
-
paymentIntent:
|
|
1509
|
+
error: s,
|
|
1510
|
+
paymentIntent: i
|
|
1460
1511
|
}
|
|
1461
1512
|
});
|
|
1462
1513
|
}
|
|
@@ -1485,9 +1536,9 @@ var cr = class {
|
|
|
1485
1536
|
r(e);
|
|
1486
1537
|
});
|
|
1487
1538
|
}
|
|
1488
|
-
}, dr = "https://images.ctfassets.net/c3n7jozh84hr/2A5qlS6JkUsOyFVPzQ0KlK/22b497afd71030ef1a44a52394b15027/______2022-06-30_11.03.43.png", ur = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/xLSOJpNvMp7cBKdvDln0B/eb2f53a0a3f2317750739dceff9df413/______2022-06-30_10.59.00.png", hr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4Iq13VoxktB3amHFbQK1yb/f2fe12add0dac233d56c22cf5651c65c/image-20220630-030728.png", pr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/mjau5Tqscwu9tbhRLFbmJ/a66cd2894060b2d3a94b75d7f4e65355/______2022-07-04_17.05.18.png", mr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1M4DBVFhOrkprPmjxZwS7M/c4a90840d3846b926d3a5524392435fe/Boost.svg", fr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1BYCLeHNQEyPXBjlIdu09h/71d67c5be3975f77091bf45c7ab58f65/ShopeePay.svg", gr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/61LYQ3RuziTGisarZgaAV1/309f3f1e569609dd0b0095857d6382b5/__2022-05-31_11.44.42.png", yr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/79Uj5xItEZE7L51j2oh6IV/6af4cfefdd65834305931fd16f652d87/DANA.svg", br = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/15FHwC4H3W0JrNvsqy6TWH/5d18aa44231c55d6457389e17ac7ea0c/TnG.svg",
|
|
1539
|
+
}, dr = "https://images.ctfassets.net/c3n7jozh84hr/2A5qlS6JkUsOyFVPzQ0KlK/22b497afd71030ef1a44a52394b15027/______2022-06-30_11.03.43.png", ur = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/xLSOJpNvMp7cBKdvDln0B/eb2f53a0a3f2317750739dceff9df413/______2022-06-30_10.59.00.png", hr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4Iq13VoxktB3amHFbQK1yb/f2fe12add0dac233d56c22cf5651c65c/image-20220630-030728.png", pr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/mjau5Tqscwu9tbhRLFbmJ/a66cd2894060b2d3a94b75d7f4e65355/______2022-07-04_17.05.18.png", mr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1M4DBVFhOrkprPmjxZwS7M/c4a90840d3846b926d3a5524392435fe/Boost.svg", fr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1BYCLeHNQEyPXBjlIdu09h/71d67c5be3975f77091bf45c7ab58f65/ShopeePay.svg", gr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/61LYQ3RuziTGisarZgaAV1/309f3f1e569609dd0b0095857d6382b5/__2022-05-31_11.44.42.png", yr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/79Uj5xItEZE7L51j2oh6IV/6af4cfefdd65834305931fd16f652d87/DANA.svg", br = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/15FHwC4H3W0JrNvsqy6TWH/5d18aa44231c55d6457389e17ac7ea0c/TnG.svg", vr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/5EK8VF1nACmJ0KpPocLuR7/785178078004e82cb69782c570623b8c/Alipay.svg", wr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/3sNSjVq0K9mq5whYcGJhBe/78857434adff807c8e293425491e0bd4/AlipayHK.svg", xr = "https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4WAO5JJPUOrZ9jBA0Vf4tf/c3896e1a5508efa0c569bd3eaa577dad/GCash.svg", Q = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, V = function(e, t, r, i, n, s, o, l, a, c) {
|
|
1489
1540
|
var d = this;
|
|
1490
|
-
d.numeralDecimalMark = e || ".", d.numeralIntegerScale = t > 0 ? t : 0, d.numeralDecimalScale = r >= 0 ? r : 2, d.numeralThousandsGroupStyle =
|
|
1541
|
+
d.numeralDecimalMark = e || ".", d.numeralIntegerScale = t > 0 ? t : 0, d.numeralDecimalScale = r >= 0 ? r : 2, d.numeralThousandsGroupStyle = i || V.groupStyle.thousand, d.numeralPositiveOnly = !!n, d.stripLeadingZeroes = s !== !1, d.prefix = o || o === "" ? o : "", d.signBeforePrefix = !!l, d.tailPrefix = !!a, d.delimiter = c || c === "" ? c : ",", d.delimiterRE = c ? new RegExp("\\" + c, "g") : "";
|
|
1491
1542
|
};
|
|
1492
1543
|
V.groupStyle = {
|
|
1493
1544
|
thousand: "thousand",
|
|
@@ -1500,28 +1551,28 @@ V.prototype = {
|
|
|
1500
1551
|
return e.replace(this.delimiterRE, "").replace(this.numeralDecimalMark, ".");
|
|
1501
1552
|
},
|
|
1502
1553
|
format: function(e) {
|
|
1503
|
-
var t = this, r, n,
|
|
1504
|
-
switch (e = e.replace(/[A-Za-z]/g, "").replace(t.numeralDecimalMark, "M").replace(/[^\dM-]/g, "").replace(/^\-/, "N").replace(/\-/g, "").replace("N", t.numeralPositiveOnly ? "" : "-").replace("M", t.numeralDecimalMark), t.stripLeadingZeroes && (e = e.replace(/^(-)?0+(?=\d)/, "$1")),
|
|
1554
|
+
var t = this, r, i, n, s, o = "";
|
|
1555
|
+
switch (e = e.replace(/[A-Za-z]/g, "").replace(t.numeralDecimalMark, "M").replace(/[^\dM-]/g, "").replace(/^\-/, "N").replace(/\-/g, "").replace("N", t.numeralPositiveOnly ? "" : "-").replace("M", t.numeralDecimalMark), t.stripLeadingZeroes && (e = e.replace(/^(-)?0+(?=\d)/, "$1")), i = e.slice(0, 1) === "-" ? "-" : "", typeof t.prefix < "u" ? t.signBeforePrefix ? n = i + t.prefix : n = t.prefix + i : n = i, s = e, e.indexOf(t.numeralDecimalMark) >= 0 && (r = e.split(t.numeralDecimalMark), s = r[0], o = t.numeralDecimalMark + r[1].slice(0, t.numeralDecimalScale)), i === "-" && (s = s.slice(1)), t.numeralIntegerScale > 0 && (s = s.slice(0, t.numeralIntegerScale)), t.numeralThousandsGroupStyle) {
|
|
1505
1556
|
case V.groupStyle.lakh:
|
|
1506
|
-
|
|
1557
|
+
s = s.replace(/(\d)(?=(\d\d)+\d$)/g, "$1" + t.delimiter);
|
|
1507
1558
|
break;
|
|
1508
1559
|
case V.groupStyle.wan:
|
|
1509
|
-
|
|
1560
|
+
s = s.replace(/(\d)(?=(\d{4})+$)/g, "$1" + t.delimiter);
|
|
1510
1561
|
break;
|
|
1511
1562
|
case V.groupStyle.thousand:
|
|
1512
|
-
|
|
1563
|
+
s = s.replace(/(\d)(?=(\d{3})+$)/g, "$1" + t.delimiter);
|
|
1513
1564
|
break;
|
|
1514
1565
|
}
|
|
1515
|
-
return t.tailPrefix ?
|
|
1566
|
+
return t.tailPrefix ? i + s.toString() + (t.numeralDecimalScale > 0 ? o.toString() : "") + t.prefix : n + s.toString() + (t.numeralDecimalScale > 0 ? o.toString() : "");
|
|
1516
1567
|
}
|
|
1517
1568
|
};
|
|
1518
|
-
var
|
|
1519
|
-
var
|
|
1520
|
-
|
|
1521
|
-
return parseInt(
|
|
1522
|
-
}),
|
|
1523
|
-
return parseInt(
|
|
1524
|
-
}),
|
|
1569
|
+
var Sr = V, ye = function(e, t, r) {
|
|
1570
|
+
var i = this;
|
|
1571
|
+
i.date = [], i.blocks = [], i.datePattern = e, i.dateMin = t.split("-").reverse().map(function(n) {
|
|
1572
|
+
return parseInt(n, 10);
|
|
1573
|
+
}), i.dateMin.length === 2 && i.dateMin.unshift(0), i.dateMax = r.split("-").reverse().map(function(n) {
|
|
1574
|
+
return parseInt(n, 10);
|
|
1575
|
+
}), i.dateMax.length === 2 && i.dateMax.unshift(0), i.initBlocks();
|
|
1525
1576
|
};
|
|
1526
1577
|
ye.prototype = {
|
|
1527
1578
|
initBlocks: function() {
|
|
@@ -1539,55 +1590,55 @@ ye.prototype = {
|
|
|
1539
1590
|
},
|
|
1540
1591
|
getValidatedDate: function(e) {
|
|
1541
1592
|
var t = this, r = "";
|
|
1542
|
-
return e = e.replace(/[^\d]/g, ""), t.blocks.forEach(function(
|
|
1593
|
+
return e = e.replace(/[^\d]/g, ""), t.blocks.forEach(function(i, n) {
|
|
1543
1594
|
if (e.length > 0) {
|
|
1544
|
-
var
|
|
1545
|
-
switch (t.datePattern[
|
|
1595
|
+
var s = e.slice(0, i), o = s.slice(0, 1), l = e.slice(i);
|
|
1596
|
+
switch (t.datePattern[n]) {
|
|
1546
1597
|
case "d":
|
|
1547
|
-
|
|
1598
|
+
s === "00" ? s = "01" : parseInt(o, 10) > 3 ? s = "0" + o : parseInt(s, 10) > 31 && (s = "31");
|
|
1548
1599
|
break;
|
|
1549
1600
|
case "m":
|
|
1550
|
-
|
|
1601
|
+
s === "00" ? s = "01" : parseInt(o, 10) > 1 ? s = "0" + o : parseInt(s, 10) > 12 && (s = "12");
|
|
1551
1602
|
break;
|
|
1552
1603
|
}
|
|
1553
|
-
r +=
|
|
1604
|
+
r += s, e = l;
|
|
1554
1605
|
}
|
|
1555
1606
|
}), this.getFixedDateString(r);
|
|
1556
1607
|
},
|
|
1557
1608
|
getFixedDateString: function(e) {
|
|
1558
|
-
var t = this, r = t.datePattern,
|
|
1559
|
-
e.length === 4 && r[0].toLowerCase() !== "y" && r[1].toLowerCase() !== "y" && (l = r[0] === "d" ? 0 : 2, a = 2 - l, d = parseInt(e.slice(l, l + 2), 10), h = parseInt(e.slice(a, a + 2), 10),
|
|
1560
|
-
switch (
|
|
1609
|
+
var t = this, r = t.datePattern, i = [], n = 0, s = 0, o = 0, l = 0, a = 0, c = 0, d, h, p, u = !1;
|
|
1610
|
+
e.length === 4 && r[0].toLowerCase() !== "y" && r[1].toLowerCase() !== "y" && (l = r[0] === "d" ? 0 : 2, a = 2 - l, d = parseInt(e.slice(l, l + 2), 10), h = parseInt(e.slice(a, a + 2), 10), i = this.getFixedDate(d, h, 0)), e.length === 8 && (r.forEach(function(v, C) {
|
|
1611
|
+
switch (v) {
|
|
1561
1612
|
case "d":
|
|
1562
|
-
|
|
1613
|
+
n = C;
|
|
1563
1614
|
break;
|
|
1564
1615
|
case "m":
|
|
1565
|
-
|
|
1616
|
+
s = C;
|
|
1566
1617
|
break;
|
|
1567
1618
|
default:
|
|
1568
|
-
|
|
1619
|
+
o = C;
|
|
1569
1620
|
break;
|
|
1570
1621
|
}
|
|
1571
|
-
}), c =
|
|
1572
|
-
var m =
|
|
1573
|
-
switch (
|
|
1622
|
+
}), c = o * 2, l = n <= o ? n * 2 : n * 2 + 2, a = s <= o ? s * 2 : s * 2 + 2, d = parseInt(e.slice(l, l + 2), 10), h = parseInt(e.slice(a, a + 2), 10), p = parseInt(e.slice(c, c + 4), 10), u = e.slice(c, c + 4).length === 4, i = this.getFixedDate(d, h, p)), e.length === 4 && (r[0] === "y" || r[1] === "y") && (a = r[0] === "m" ? 0 : 2, c = 2 - a, h = parseInt(e.slice(a, a + 2), 10), p = parseInt(e.slice(c, c + 2), 10), u = e.slice(c, c + 2).length === 2, i = [0, h, p]), e.length === 6 && (r[0] === "Y" || r[1] === "Y") && (a = r[0] === "m" ? 0 : 4, c = 2 - 0.5 * a, h = parseInt(e.slice(a, a + 2), 10), p = parseInt(e.slice(c, c + 4), 10), u = e.slice(c, c + 4).length === 4, i = [0, h, p]), i = t.getRangeFixedDate(i), t.date = i;
|
|
1623
|
+
var m = i.length === 0 ? e : r.reduce(function(v, C) {
|
|
1624
|
+
switch (C) {
|
|
1574
1625
|
case "d":
|
|
1575
|
-
return
|
|
1626
|
+
return v + (i[0] === 0 ? "" : t.addLeadingZero(i[0]));
|
|
1576
1627
|
case "m":
|
|
1577
|
-
return
|
|
1628
|
+
return v + (i[1] === 0 ? "" : t.addLeadingZero(i[1]));
|
|
1578
1629
|
case "y":
|
|
1579
|
-
return
|
|
1630
|
+
return v + (u ? t.addLeadingZeroForYear(i[2], !1) : "");
|
|
1580
1631
|
case "Y":
|
|
1581
|
-
return
|
|
1632
|
+
return v + (u ? t.addLeadingZeroForYear(i[2], !0) : "");
|
|
1582
1633
|
}
|
|
1583
1634
|
}, "");
|
|
1584
1635
|
return m;
|
|
1585
1636
|
},
|
|
1586
1637
|
getRangeFixedDate: function(e) {
|
|
1587
|
-
var t = this, r = t.datePattern,
|
|
1588
|
-
return !e.length ||
|
|
1589
|
-
return
|
|
1590
|
-
}) && e[2] === 0 ? e :
|
|
1638
|
+
var t = this, r = t.datePattern, i = t.dateMin || [], n = t.dateMax || [];
|
|
1639
|
+
return !e.length || i.length < 3 && n.length < 3 || r.find(function(s) {
|
|
1640
|
+
return s.toLowerCase() === "y";
|
|
1641
|
+
}) && e[2] === 0 ? e : n.length && (n[2] < e[2] || n[2] === e[2] && (n[1] < e[1] || n[1] === e[1] && n[0] < e[0])) ? n : i.length && (i[2] > e[2] || i[2] === e[2] && (i[1] > e[1] || i[1] === e[1] && i[0] > e[0])) ? i : e;
|
|
1591
1642
|
},
|
|
1592
1643
|
getFixedDate: function(e, t, r) {
|
|
1593
1644
|
return e = Math.min(e, 31), t = Math.min(t, 12), r = parseInt(r || 0, 10), (t < 7 && t % 2 === 0 || t > 8 && t % 2 === 1) && (e = Math.min(e, t === 2 ? this.isLeapYear(r) ? 29 : 28 : 30)), [e, t, r];
|
|
@@ -1602,7 +1653,7 @@ ye.prototype = {
|
|
|
1602
1653
|
return t ? (e < 10 ? "000" : e < 100 ? "00" : e < 1e3 ? "0" : "") + e : (e < 10 ? "0" : "") + e;
|
|
1603
1654
|
}
|
|
1604
1655
|
};
|
|
1605
|
-
var
|
|
1656
|
+
var Pr = ye, be = function(e, t) {
|
|
1606
1657
|
var r = this;
|
|
1607
1658
|
r.time = [], r.blocks = [], r.timePattern = e, r.timeFormat = t, r.initBlocks();
|
|
1608
1659
|
};
|
|
@@ -1637,54 +1688,54 @@ be.prototype = {
|
|
|
1637
1688
|
getValidatedTime: function(e) {
|
|
1638
1689
|
var t = this, r = "";
|
|
1639
1690
|
e = e.replace(/[^\d]/g, "");
|
|
1640
|
-
var
|
|
1641
|
-
return t.blocks.forEach(function(
|
|
1691
|
+
var i = t.getTimeFormatOptions();
|
|
1692
|
+
return t.blocks.forEach(function(n, s) {
|
|
1642
1693
|
if (e.length > 0) {
|
|
1643
|
-
var
|
|
1644
|
-
switch (t.timePattern[
|
|
1694
|
+
var o = e.slice(0, n), l = o.slice(0, 1), a = e.slice(n);
|
|
1695
|
+
switch (t.timePattern[s]) {
|
|
1645
1696
|
case "h":
|
|
1646
|
-
parseInt(l, 10) >
|
|
1697
|
+
parseInt(l, 10) > i.maxHourFirstDigit ? o = "0" + l : parseInt(o, 10) > i.maxHours && (o = i.maxHours + "");
|
|
1647
1698
|
break;
|
|
1648
1699
|
case "m":
|
|
1649
1700
|
case "s":
|
|
1650
|
-
parseInt(l, 10) >
|
|
1701
|
+
parseInt(l, 10) > i.maxMinutesFirstDigit ? o = "0" + l : parseInt(o, 10) > i.maxMinutes && (o = i.maxMinutes + "");
|
|
1651
1702
|
break;
|
|
1652
1703
|
}
|
|
1653
|
-
r +=
|
|
1704
|
+
r += o, e = a;
|
|
1654
1705
|
}
|
|
1655
1706
|
}), this.getFixedTimeString(r);
|
|
1656
1707
|
},
|
|
1657
1708
|
getFixedTimeString: function(e) {
|
|
1658
|
-
var t = this, r = t.timePattern,
|
|
1709
|
+
var t = this, r = t.timePattern, i = [], n = 0, s = 0, o = 0, l = 0, a = 0, c = 0, d, h, p;
|
|
1659
1710
|
return e.length === 6 && (r.forEach(function(u, m) {
|
|
1660
1711
|
switch (u) {
|
|
1661
1712
|
case "s":
|
|
1662
|
-
|
|
1713
|
+
n = m * 2;
|
|
1663
1714
|
break;
|
|
1664
1715
|
case "m":
|
|
1665
|
-
|
|
1716
|
+
s = m * 2;
|
|
1666
1717
|
break;
|
|
1667
1718
|
case "h":
|
|
1668
|
-
|
|
1719
|
+
o = m * 2;
|
|
1669
1720
|
break;
|
|
1670
1721
|
}
|
|
1671
|
-
}), c =
|
|
1722
|
+
}), c = o, a = s, l = n, d = parseInt(e.slice(l, l + 2), 10), h = parseInt(e.slice(a, a + 2), 10), p = parseInt(e.slice(c, c + 2), 10), i = this.getFixedTime(p, h, d)), e.length === 4 && t.timePattern.indexOf("s") < 0 && (r.forEach(function(u, m) {
|
|
1672
1723
|
switch (u) {
|
|
1673
1724
|
case "m":
|
|
1674
|
-
|
|
1725
|
+
s = m * 2;
|
|
1675
1726
|
break;
|
|
1676
1727
|
case "h":
|
|
1677
|
-
|
|
1728
|
+
o = m * 2;
|
|
1678
1729
|
break;
|
|
1679
1730
|
}
|
|
1680
|
-
}), c =
|
|
1731
|
+
}), c = o, a = s, d = 0, h = parseInt(e.slice(a, a + 2), 10), p = parseInt(e.slice(c, c + 2), 10), i = this.getFixedTime(p, h, d)), t.time = i, i.length === 0 ? e : r.reduce(function(u, m) {
|
|
1681
1732
|
switch (m) {
|
|
1682
1733
|
case "s":
|
|
1683
|
-
return u + t.addLeadingZero(
|
|
1734
|
+
return u + t.addLeadingZero(i[2]);
|
|
1684
1735
|
case "m":
|
|
1685
|
-
return u + t.addLeadingZero(
|
|
1736
|
+
return u + t.addLeadingZero(i[1]);
|
|
1686
1737
|
case "h":
|
|
1687
|
-
return u + t.addLeadingZero(
|
|
1738
|
+
return u + t.addLeadingZero(i[0]);
|
|
1688
1739
|
}
|
|
1689
1740
|
}, "");
|
|
1690
1741
|
},
|
|
@@ -1695,7 +1746,7 @@ be.prototype = {
|
|
|
1695
1746
|
return (e < 10 ? "0" : "") + e;
|
|
1696
1747
|
}
|
|
1697
1748
|
};
|
|
1698
|
-
var
|
|
1749
|
+
var Ar = be, ve = function(e, t) {
|
|
1699
1750
|
var r = this;
|
|
1700
1751
|
r.delimiter = t || t === "" ? t : " ", r.delimiterRE = t ? new RegExp("\\" + t, "g") : "", r.formatter = e;
|
|
1701
1752
|
};
|
|
@@ -1706,12 +1757,12 @@ ve.prototype = {
|
|
|
1706
1757
|
format: function(e) {
|
|
1707
1758
|
var t = this;
|
|
1708
1759
|
t.formatter.clear(), e = e.replace(/[^\d+]/g, ""), e = e.replace(/^\+/, "B").replace(/\+/g, "").replace("B", "+"), e = e.replace(t.delimiterRE, "");
|
|
1709
|
-
for (var r = "",
|
|
1710
|
-
|
|
1760
|
+
for (var r = "", i, n = !1, s = 0, o = e.length; s < o; s++)
|
|
1761
|
+
i = t.formatter.inputDigit(e.charAt(s)), /[\s()-]/g.test(i) ? (r = i, n = !0) : n || (r = i);
|
|
1711
1762
|
return r = r.replace(/[()]/g, ""), r = r.replace(/[\s-]/g, t.delimiter), r;
|
|
1712
1763
|
}
|
|
1713
1764
|
};
|
|
1714
|
-
var
|
|
1765
|
+
var kr = ve, Bt = {
|
|
1715
1766
|
blocks: {
|
|
1716
1767
|
uatp: [4, 5, 6],
|
|
1717
1768
|
amex: [4, 6, 5],
|
|
@@ -1757,20 +1808,20 @@ var Sr = ve, Lt = {
|
|
|
1757
1808
|
unionPay: /^(62|81)\d{0,14}/
|
|
1758
1809
|
},
|
|
1759
1810
|
getStrictBlocks: function(e) {
|
|
1760
|
-
var t = e.reduce(function(r,
|
|
1761
|
-
return r +
|
|
1811
|
+
var t = e.reduce(function(r, i) {
|
|
1812
|
+
return r + i;
|
|
1762
1813
|
}, 0);
|
|
1763
1814
|
return e.concat(19 - t);
|
|
1764
1815
|
},
|
|
1765
1816
|
getInfo: function(e, t) {
|
|
1766
|
-
var r =
|
|
1817
|
+
var r = Bt.blocks, i = Bt.re;
|
|
1767
1818
|
t = !!t;
|
|
1768
|
-
for (var
|
|
1769
|
-
if (n
|
|
1770
|
-
var
|
|
1819
|
+
for (var n in i)
|
|
1820
|
+
if (i[n].test(e)) {
|
|
1821
|
+
var s = r[n];
|
|
1771
1822
|
return {
|
|
1772
|
-
type:
|
|
1773
|
-
blocks: t ? this.getStrictBlocks(
|
|
1823
|
+
type: n,
|
|
1824
|
+
blocks: t ? this.getStrictBlocks(s) : s
|
|
1774
1825
|
};
|
|
1775
1826
|
}
|
|
1776
1827
|
return {
|
|
@@ -1778,7 +1829,7 @@ var Sr = ve, Lt = {
|
|
|
1778
1829
|
blocks: t ? this.getStrictBlocks(r.general) : r.general
|
|
1779
1830
|
};
|
|
1780
1831
|
}
|
|
1781
|
-
},
|
|
1832
|
+
}, Cr = Bt, _r = {
|
|
1782
1833
|
noop: function() {
|
|
1783
1834
|
},
|
|
1784
1835
|
strip: function(e, t) {
|
|
@@ -1787,30 +1838,30 @@ var Sr = ve, Lt = {
|
|
|
1787
1838
|
getPostDelimiter: function(e, t, r) {
|
|
1788
1839
|
if (r.length === 0)
|
|
1789
1840
|
return e.slice(-t.length) === t ? t : "";
|
|
1790
|
-
var
|
|
1791
|
-
return r.forEach(function(
|
|
1792
|
-
e.slice(-
|
|
1793
|
-
}),
|
|
1841
|
+
var i = "";
|
|
1842
|
+
return r.forEach(function(n) {
|
|
1843
|
+
e.slice(-n.length) === n && (i = n);
|
|
1844
|
+
}), i;
|
|
1794
1845
|
},
|
|
1795
1846
|
getDelimiterREByDelimiter: function(e) {
|
|
1796
1847
|
return new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"), "g");
|
|
1797
1848
|
},
|
|
1798
|
-
getNextCursorPosition: function(e, t, r,
|
|
1799
|
-
return t.length === e ? r.length : e + this.getPositionOffset(e, t, r,
|
|
1849
|
+
getNextCursorPosition: function(e, t, r, i, n) {
|
|
1850
|
+
return t.length === e ? r.length : e + this.getPositionOffset(e, t, r, i, n);
|
|
1800
1851
|
},
|
|
1801
|
-
getPositionOffset: function(e, t, r,
|
|
1802
|
-
var
|
|
1803
|
-
return
|
|
1852
|
+
getPositionOffset: function(e, t, r, i, n) {
|
|
1853
|
+
var s, o, l;
|
|
1854
|
+
return s = this.stripDelimiters(t.slice(0, e), i, n), o = this.stripDelimiters(r.slice(0, e), i, n), l = s.length - o.length, l !== 0 ? l / Math.abs(l) : 0;
|
|
1804
1855
|
},
|
|
1805
1856
|
stripDelimiters: function(e, t, r) {
|
|
1806
|
-
var
|
|
1857
|
+
var i = this;
|
|
1807
1858
|
if (r.length === 0) {
|
|
1808
|
-
var
|
|
1809
|
-
return e.replace(
|
|
1859
|
+
var n = t ? i.getDelimiterREByDelimiter(t) : "";
|
|
1860
|
+
return e.replace(n, "");
|
|
1810
1861
|
}
|
|
1811
|
-
return r.forEach(function(
|
|
1812
|
-
|
|
1813
|
-
e = e.replace(
|
|
1862
|
+
return r.forEach(function(s) {
|
|
1863
|
+
s.split("").forEach(function(o) {
|
|
1864
|
+
e = e.replace(i.getDelimiterREByDelimiter(o), "");
|
|
1814
1865
|
});
|
|
1815
1866
|
}), e;
|
|
1816
1867
|
},
|
|
@@ -1828,20 +1879,20 @@ var Sr = ve, Lt = {
|
|
|
1828
1879
|
// PREFIX-123 | PEFIX-123 | 123
|
|
1829
1880
|
// PREFIX-123 | PREFIX-23 | 23
|
|
1830
1881
|
// PREFIX-123 | PREFIX-1234 | 1234
|
|
1831
|
-
getPrefixStrippedValue: function(e, t, r, n,
|
|
1882
|
+
getPrefixStrippedValue: function(e, t, r, i, n, s, o, l, a) {
|
|
1832
1883
|
if (r === 0)
|
|
1833
1884
|
return e;
|
|
1834
1885
|
if (e === t && e !== "")
|
|
1835
1886
|
return "";
|
|
1836
1887
|
if (a && e.slice(0, 1) == "-") {
|
|
1837
|
-
var c =
|
|
1838
|
-
return "-" + this.getPrefixStrippedValue(e.slice(1), t, r, c,
|
|
1839
|
-
}
|
|
1840
|
-
if (
|
|
1841
|
-
return
|
|
1842
|
-
if (
|
|
1843
|
-
return
|
|
1844
|
-
var d = this.stripDelimiters(
|
|
1888
|
+
var c = i.slice(0, 1) == "-" ? i.slice(1) : i;
|
|
1889
|
+
return "-" + this.getPrefixStrippedValue(e.slice(1), t, r, c, n, s, o, l, a);
|
|
1890
|
+
}
|
|
1891
|
+
if (i.slice(0, r) !== t && !l)
|
|
1892
|
+
return o && !i && e ? e : "";
|
|
1893
|
+
if (i.slice(-r) !== t && l)
|
|
1894
|
+
return o && !i && e ? e : "";
|
|
1895
|
+
var d = this.stripDelimiters(i, n, s);
|
|
1845
1896
|
return e.slice(0, r) !== t && !l ? d.slice(r) : e.slice(-r) !== t && l ? d.slice(0, -r - 1) : l ? e.slice(0, -r) : e.slice(r);
|
|
1846
1897
|
},
|
|
1847
1898
|
getFirstDiffIndex: function(e, t) {
|
|
@@ -1850,24 +1901,24 @@ var Sr = ve, Lt = {
|
|
|
1850
1901
|
return -1;
|
|
1851
1902
|
return r;
|
|
1852
1903
|
},
|
|
1853
|
-
getFormattedValue: function(e, t, r,
|
|
1854
|
-
var
|
|
1904
|
+
getFormattedValue: function(e, t, r, i, n, s) {
|
|
1905
|
+
var o = "", l = n.length > 0, a = "";
|
|
1855
1906
|
return r === 0 ? e : (t.forEach(function(c, d) {
|
|
1856
1907
|
if (e.length > 0) {
|
|
1857
1908
|
var h = e.slice(0, c), p = e.slice(c);
|
|
1858
|
-
l ? a =
|
|
1909
|
+
l ? a = n[s ? d - 1 : d] || a : a = i, s ? (d > 0 && (o += a), o += h) : (o += h, h.length === c && d < r - 1 && (o += a)), e = p;
|
|
1859
1910
|
}
|
|
1860
|
-
}),
|
|
1911
|
+
}), o);
|
|
1861
1912
|
},
|
|
1862
1913
|
// move cursor to the end
|
|
1863
1914
|
// the first time user focuses on an input with prefix
|
|
1864
|
-
fixPrefixCursor: function(e, t, r,
|
|
1915
|
+
fixPrefixCursor: function(e, t, r, i) {
|
|
1865
1916
|
if (e) {
|
|
1866
|
-
var
|
|
1867
|
-
if (!(!e.setSelectionRange || !t || t.length +
|
|
1868
|
-
var
|
|
1917
|
+
var n = e.value, s = r || i[0] || " ";
|
|
1918
|
+
if (!(!e.setSelectionRange || !t || t.length + s.length <= n.length)) {
|
|
1919
|
+
var o = n.length * 2;
|
|
1869
1920
|
setTimeout(function() {
|
|
1870
|
-
e.setSelectionRange(
|
|
1921
|
+
e.setSelectionRange(o, o);
|
|
1871
1922
|
}, 1);
|
|
1872
1923
|
}
|
|
1873
1924
|
}
|
|
@@ -1884,8 +1935,8 @@ var Sr = ve, Lt = {
|
|
|
1884
1935
|
setSelection: function(e, t, r) {
|
|
1885
1936
|
if (e === this.getActiveElement(r) && !(e && e.value.length <= t))
|
|
1886
1937
|
if (e.createTextRange) {
|
|
1887
|
-
var
|
|
1888
|
-
|
|
1938
|
+
var i = e.createTextRange();
|
|
1939
|
+
i.move("character", t), i.select();
|
|
1889
1940
|
} else
|
|
1890
1941
|
try {
|
|
1891
1942
|
e.setSelectionRange(t, t);
|
|
@@ -1907,33 +1958,33 @@ var Sr = ve, Lt = {
|
|
|
1907
1958
|
isAndroidBackspaceKeydown: function(e, t) {
|
|
1908
1959
|
return !this.isAndroid() || !e || !t ? !1 : t === e.slice(0, -1);
|
|
1909
1960
|
}
|
|
1910
|
-
},
|
|
1961
|
+
}, Er = _r, Ir = {
|
|
1911
1962
|
// Maybe change to object-assign
|
|
1912
1963
|
// for now just keep it as simple
|
|
1913
1964
|
assign: function(e, t) {
|
|
1914
1965
|
return e = e || {}, t = t || {}, e.creditCard = !!t.creditCard, e.creditCardStrictMode = !!t.creditCardStrictMode, e.creditCardType = "", e.onCreditCardTypeChanged = t.onCreditCardTypeChanged || function() {
|
|
1915
|
-
}, e.phone = !!t.phone, e.phoneRegionCode = t.phoneRegionCode || "AU", e.phoneFormatter = {}, e.time = !!t.time, e.timePattern = t.timePattern || ["h", "m", "s"], e.timeFormat = t.timeFormat || "24", e.timeFormatter = {}, e.date = !!t.date, e.datePattern = t.datePattern || ["d", "m", "Y"], e.dateMin = t.dateMin || "", e.dateMax = t.dateMax || "", e.dateFormatter = {}, e.numeral = !!t.numeral, e.numeralIntegerScale = t.numeralIntegerScale > 0 ? t.numeralIntegerScale : 0, e.numeralDecimalScale = t.numeralDecimalScale >= 0 ? t.numeralDecimalScale : 2, e.numeralDecimalMark = t.numeralDecimalMark || ".", e.numeralThousandsGroupStyle = t.numeralThousandsGroupStyle || "thousand", e.numeralPositiveOnly = !!t.numeralPositiveOnly, e.stripLeadingZeroes = t.stripLeadingZeroes !== !1, e.signBeforePrefix = !!t.signBeforePrefix, e.tailPrefix = !!t.tailPrefix, e.swapHiddenInput = !!t.swapHiddenInput, e.numericOnly = e.creditCard || e.date || !!t.numericOnly, e.uppercase = !!t.uppercase, e.lowercase = !!t.lowercase, e.prefix = e.creditCard || e.date ? "" : t.prefix || "", e.noImmediatePrefix = !!t.noImmediatePrefix, e.prefixLength = e.prefix.length, e.rawValueTrimPrefix = !!t.rawValueTrimPrefix, e.copyDelimiter = !!t.copyDelimiter, e.initValue = t.initValue !== void 0 && t.initValue !== null ? t.initValue.toString() : "", e.delimiter = t.delimiter || t.delimiter === "" ? t.delimiter : t.date ? "/" : t.time ? ":" : t.numeral ? "," : (t.phone, " "), e.delimiterLength = e.delimiter.length, e.delimiterLazyShow = !!t.delimiterLazyShow, e.delimiters = t.delimiters || [], e.blocks = t.blocks || [], e.blocksLength = e.blocks.length, e.root = typeof
|
|
1966
|
+
}, e.phone = !!t.phone, e.phoneRegionCode = t.phoneRegionCode || "AU", e.phoneFormatter = {}, e.time = !!t.time, e.timePattern = t.timePattern || ["h", "m", "s"], e.timeFormat = t.timeFormat || "24", e.timeFormatter = {}, e.date = !!t.date, e.datePattern = t.datePattern || ["d", "m", "Y"], e.dateMin = t.dateMin || "", e.dateMax = t.dateMax || "", e.dateFormatter = {}, e.numeral = !!t.numeral, e.numeralIntegerScale = t.numeralIntegerScale > 0 ? t.numeralIntegerScale : 0, e.numeralDecimalScale = t.numeralDecimalScale >= 0 ? t.numeralDecimalScale : 2, e.numeralDecimalMark = t.numeralDecimalMark || ".", e.numeralThousandsGroupStyle = t.numeralThousandsGroupStyle || "thousand", e.numeralPositiveOnly = !!t.numeralPositiveOnly, e.stripLeadingZeroes = t.stripLeadingZeroes !== !1, e.signBeforePrefix = !!t.signBeforePrefix, e.tailPrefix = !!t.tailPrefix, e.swapHiddenInput = !!t.swapHiddenInput, e.numericOnly = e.creditCard || e.date || !!t.numericOnly, e.uppercase = !!t.uppercase, e.lowercase = !!t.lowercase, e.prefix = e.creditCard || e.date ? "" : t.prefix || "", e.noImmediatePrefix = !!t.noImmediatePrefix, e.prefixLength = e.prefix.length, e.rawValueTrimPrefix = !!t.rawValueTrimPrefix, e.copyDelimiter = !!t.copyDelimiter, e.initValue = t.initValue !== void 0 && t.initValue !== null ? t.initValue.toString() : "", e.delimiter = t.delimiter || t.delimiter === "" ? t.delimiter : t.date ? "/" : t.time ? ":" : t.numeral ? "," : (t.phone, " "), e.delimiterLength = e.delimiter.length, e.delimiterLazyShow = !!t.delimiterLazyShow, e.delimiters = t.delimiters || [], e.blocks = t.blocks || [], e.blocksLength = e.blocks.length, e.root = typeof Q == "object" && Q ? Q : window, e.document = t.document || e.root.document, e.maxLength = 0, e.backspace = !1, e.result = "", e.onValueChanged = t.onValueChanged || function() {
|
|
1916
1967
|
}, e;
|
|
1917
1968
|
}
|
|
1918
|
-
},
|
|
1919
|
-
var r = this,
|
|
1920
|
-
if (typeof e == "string" ? (r.element = document.querySelector(e),
|
|
1969
|
+
}, Nr = Ir, A = function(e, t) {
|
|
1970
|
+
var r = this, i = !1;
|
|
1971
|
+
if (typeof e == "string" ? (r.element = document.querySelector(e), i = document.querySelectorAll(e).length > 1) : typeof e.length < "u" && e.length > 0 ? (r.element = e[0], i = e.length > 1) : r.element = e, !r.element)
|
|
1921
1972
|
throw new Error("[cleave.js] Please check the element");
|
|
1922
|
-
if (
|
|
1973
|
+
if (i)
|
|
1923
1974
|
try {
|
|
1924
1975
|
console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.");
|
|
1925
1976
|
} catch {
|
|
1926
1977
|
}
|
|
1927
|
-
t.initValue = r.element.value, r.properties =
|
|
1978
|
+
t.initValue = r.element.value, r.properties = A.DefaultProperties.assign({}, t), r.init();
|
|
1928
1979
|
};
|
|
1929
|
-
|
|
1980
|
+
A.prototype = {
|
|
1930
1981
|
init: function() {
|
|
1931
1982
|
var e = this, t = e.properties;
|
|
1932
1983
|
if (!t.numeral && !t.phone && !t.creditCard && !t.time && !t.date && t.blocksLength === 0 && !t.prefix) {
|
|
1933
1984
|
e.onInput(t.initValue);
|
|
1934
1985
|
return;
|
|
1935
1986
|
}
|
|
1936
|
-
t.maxLength =
|
|
1987
|
+
t.maxLength = A.Util.getMaxLength(t.blocks), e.isAndroid = A.Util.isAndroid(), e.lastInputValue = "", e.isBackward = "", e.onChangeListener = e.onChange.bind(e), e.onKeyDownListener = e.onKeyDown.bind(e), e.onFocusListener = e.onFocus.bind(e), e.onCutListener = e.onCut.bind(e), e.onCopyListener = e.onCopy.bind(e), e.initSwapHiddenInput(), e.element.addEventListener("input", e.onChangeListener), e.element.addEventListener("keydown", e.onKeyDownListener), e.element.addEventListener("focus", e.onFocusListener), e.element.addEventListener("cut", e.onCutListener), e.element.addEventListener("copy", e.onCopyListener), e.initPhoneFormatter(), e.initDateFormatter(), e.initTimeFormatter(), e.initNumeralFormatter(), (t.initValue || t.prefix && !t.noImmediatePrefix) && e.onInput(t.initValue);
|
|
1937
1988
|
},
|
|
1938
1989
|
initSwapHiddenInput: function() {
|
|
1939
1990
|
var e = this, t = e.properties;
|
|
@@ -1944,7 +1995,7 @@ k.prototype = {
|
|
|
1944
1995
|
},
|
|
1945
1996
|
initNumeralFormatter: function() {
|
|
1946
1997
|
var e = this, t = e.properties;
|
|
1947
|
-
t.numeral && (t.numeralFormatter = new
|
|
1998
|
+
t.numeral && (t.numeralFormatter = new A.NumeralFormatter(
|
|
1948
1999
|
t.numeralDecimalMark,
|
|
1949
2000
|
t.numeralIntegerScale,
|
|
1950
2001
|
t.numeralDecimalScale,
|
|
@@ -1959,17 +2010,17 @@ k.prototype = {
|
|
|
1959
2010
|
},
|
|
1960
2011
|
initTimeFormatter: function() {
|
|
1961
2012
|
var e = this, t = e.properties;
|
|
1962
|
-
t.time && (t.timeFormatter = new
|
|
2013
|
+
t.time && (t.timeFormatter = new A.TimeFormatter(t.timePattern, t.timeFormat), t.blocks = t.timeFormatter.getBlocks(), t.blocksLength = t.blocks.length, t.maxLength = A.Util.getMaxLength(t.blocks));
|
|
1963
2014
|
},
|
|
1964
2015
|
initDateFormatter: function() {
|
|
1965
2016
|
var e = this, t = e.properties;
|
|
1966
|
-
t.date && (t.dateFormatter = new
|
|
2017
|
+
t.date && (t.dateFormatter = new A.DateFormatter(t.datePattern, t.dateMin, t.dateMax), t.blocks = t.dateFormatter.getBlocks(), t.blocksLength = t.blocks.length, t.maxLength = A.Util.getMaxLength(t.blocks));
|
|
1967
2018
|
},
|
|
1968
2019
|
initPhoneFormatter: function() {
|
|
1969
2020
|
var e = this, t = e.properties;
|
|
1970
2021
|
if (t.phone)
|
|
1971
2022
|
try {
|
|
1972
|
-
t.phoneFormatter = new
|
|
2023
|
+
t.phoneFormatter = new A.PhoneFormatter(
|
|
1973
2024
|
new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),
|
|
1974
2025
|
t.delimiter
|
|
1975
2026
|
);
|
|
@@ -1982,32 +2033,32 @@ k.prototype = {
|
|
|
1982
2033
|
t.lastInputValue = t.element.value, t.isBackward = r === 8;
|
|
1983
2034
|
},
|
|
1984
2035
|
onChange: function(e) {
|
|
1985
|
-
var t = this, r = t.properties,
|
|
2036
|
+
var t = this, r = t.properties, i = A.Util;
|
|
1986
2037
|
t.isBackward = t.isBackward || e.inputType === "deleteContentBackward";
|
|
1987
|
-
var
|
|
1988
|
-
t.isBackward &&
|
|
2038
|
+
var n = i.getPostDelimiter(t.lastInputValue, r.delimiter, r.delimiters);
|
|
2039
|
+
t.isBackward && n ? r.postDelimiterBackspace = n : r.postDelimiterBackspace = !1, this.onInput(this.element.value);
|
|
1989
2040
|
},
|
|
1990
2041
|
onFocus: function() {
|
|
1991
2042
|
var e = this, t = e.properties;
|
|
1992
|
-
e.lastInputValue = e.element.value, t.prefix && t.noImmediatePrefix && !e.element.value && this.onInput(t.prefix),
|
|
2043
|
+
e.lastInputValue = e.element.value, t.prefix && t.noImmediatePrefix && !e.element.value && this.onInput(t.prefix), A.Util.fixPrefixCursor(e.element, t.prefix, t.delimiter, t.delimiters);
|
|
1993
2044
|
},
|
|
1994
2045
|
onCut: function(e) {
|
|
1995
|
-
|
|
2046
|
+
A.Util.checkFullSelection(this.element.value) && (this.copyClipboardData(e), this.onInput(""));
|
|
1996
2047
|
},
|
|
1997
2048
|
onCopy: function(e) {
|
|
1998
|
-
|
|
2049
|
+
A.Util.checkFullSelection(this.element.value) && this.copyClipboardData(e);
|
|
1999
2050
|
},
|
|
2000
2051
|
copyClipboardData: function(e) {
|
|
2001
|
-
var t = this, r = t.properties,
|
|
2002
|
-
r.copyDelimiter ?
|
|
2052
|
+
var t = this, r = t.properties, i = A.Util, n = t.element.value, s = "";
|
|
2053
|
+
r.copyDelimiter ? s = n : s = i.stripDelimiters(n, r.delimiter, r.delimiters);
|
|
2003
2054
|
try {
|
|
2004
|
-
e.clipboardData ? e.clipboardData.setData("Text",
|
|
2055
|
+
e.clipboardData ? e.clipboardData.setData("Text", s) : window.clipboardData.setData("Text", s), e.preventDefault();
|
|
2005
2056
|
} catch {
|
|
2006
2057
|
}
|
|
2007
2058
|
},
|
|
2008
2059
|
onInput: function(e) {
|
|
2009
|
-
var t = this, r = t.properties,
|
|
2010
|
-
if (!r.numeral && r.postDelimiterBackspace && !
|
|
2060
|
+
var t = this, r = t.properties, i = A.Util, n = i.getPostDelimiter(e, r.delimiter, r.delimiters);
|
|
2061
|
+
if (!r.numeral && r.postDelimiterBackspace && !n && (e = i.headStr(e, e.length - r.postDelimiterBackspace.length)), r.phone) {
|
|
2011
2062
|
r.prefix && (!r.noImmediatePrefix || e.length) ? r.result = r.prefix + r.phoneFormatter.format(e).slice(r.prefix.length) : r.result = r.phoneFormatter.format(e), t.updateValueState();
|
|
2012
2063
|
return;
|
|
2013
2064
|
}
|
|
@@ -2015,11 +2066,11 @@ k.prototype = {
|
|
|
2015
2066
|
r.prefix && r.noImmediatePrefix && e.length === 0 ? r.result = "" : r.result = r.numeralFormatter.format(e), t.updateValueState();
|
|
2016
2067
|
return;
|
|
2017
2068
|
}
|
|
2018
|
-
if (r.date && (e = r.dateFormatter.getValidatedDate(e)), r.time && (e = r.timeFormatter.getValidatedTime(e)), e =
|
|
2069
|
+
if (r.date && (e = r.dateFormatter.getValidatedDate(e)), r.time && (e = r.timeFormatter.getValidatedTime(e)), e = i.stripDelimiters(e, r.delimiter, r.delimiters), e = i.getPrefixStrippedValue(e, r.prefix, r.prefixLength, r.result, r.delimiter, r.delimiters, r.noImmediatePrefix, r.tailPrefix, r.signBeforePrefix), e = r.numericOnly ? i.strip(e, /[^\d]/g) : e, e = r.uppercase ? e.toUpperCase() : e, e = r.lowercase ? e.toLowerCase() : e, r.prefix && (r.tailPrefix ? e = e + r.prefix : e = r.prefix + e, r.blocksLength === 0)) {
|
|
2019
2070
|
r.result = e, t.updateValueState();
|
|
2020
2071
|
return;
|
|
2021
2072
|
}
|
|
2022
|
-
r.creditCard && t.updateCreditCardPropsByValue(e), e =
|
|
2073
|
+
r.creditCard && t.updateCreditCardPropsByValue(e), e = i.headStr(e, r.maxLength), r.result = i.getFormattedValue(
|
|
2023
2074
|
e,
|
|
2024
2075
|
r.blocks,
|
|
2025
2076
|
r.blocksLength,
|
|
@@ -2029,20 +2080,20 @@ k.prototype = {
|
|
|
2029
2080
|
), t.updateValueState();
|
|
2030
2081
|
},
|
|
2031
2082
|
updateCreditCardPropsByValue: function(e) {
|
|
2032
|
-
var t = this, r = t.properties,
|
|
2033
|
-
|
|
2083
|
+
var t = this, r = t.properties, i = A.Util, n;
|
|
2084
|
+
i.headStr(r.result, 4) !== i.headStr(e, 4) && (n = A.CreditCardDetector.getInfo(e, r.creditCardStrictMode), r.blocks = n.blocks, r.blocksLength = r.blocks.length, r.maxLength = i.getMaxLength(r.blocks), r.creditCardType !== n.type && (r.creditCardType = n.type, r.onCreditCardTypeChanged.call(t, r.creditCardType)));
|
|
2034
2085
|
},
|
|
2035
2086
|
updateValueState: function() {
|
|
2036
|
-
var e = this, t =
|
|
2087
|
+
var e = this, t = A.Util, r = e.properties;
|
|
2037
2088
|
if (e.element) {
|
|
2038
|
-
var
|
|
2039
|
-
if (
|
|
2089
|
+
var i = e.element.selectionEnd, n = e.element.value, s = r.result;
|
|
2090
|
+
if (i = t.getNextCursorPosition(i, n, s, r.delimiter, r.delimiters), e.isAndroid) {
|
|
2040
2091
|
window.setTimeout(function() {
|
|
2041
|
-
e.element.value =
|
|
2092
|
+
e.element.value = s, t.setSelection(e.element, i, r.document, !1), e.callOnValueChanged();
|
|
2042
2093
|
}, 1);
|
|
2043
2094
|
return;
|
|
2044
2095
|
}
|
|
2045
|
-
e.element.value =
|
|
2096
|
+
e.element.value = s, r.swapHiddenInput && (e.elementSwapHidden.value = e.getRawValue()), t.setSelection(e.element, i, r.document, !1), e.callOnValueChanged();
|
|
2046
2097
|
}
|
|
2047
2098
|
},
|
|
2048
2099
|
callOnValueChanged: function() {
|
|
@@ -2064,8 +2115,8 @@ k.prototype = {
|
|
|
2064
2115
|
e = e != null ? e.toString() : "", r.numeral && (e = e.replace(".", r.numeralDecimalMark)), r.postDelimiterBackspace = !1, t.element.value = e, t.onInput(e);
|
|
2065
2116
|
},
|
|
2066
2117
|
getRawValue: function() {
|
|
2067
|
-
var e = this, t = e.properties, r =
|
|
2068
|
-
return t.rawValueTrimPrefix && (
|
|
2118
|
+
var e = this, t = e.properties, r = A.Util, i = e.element.value;
|
|
2119
|
+
return t.rawValueTrimPrefix && (i = r.getPrefixStrippedValue(i, t.prefix, t.prefixLength, t.result, t.delimiter, t.delimiters, t.noImmediatePrefix, t.tailPrefix, t.signBeforePrefix)), t.numeral ? i = t.numeralFormatter.getRawValue(i) : i = r.stripDelimiters(i, t.delimiter, t.delimiters), i;
|
|
2069
2120
|
},
|
|
2070
2121
|
getISOFormatDate: function() {
|
|
2071
2122
|
var e = this, t = e.properties;
|
|
@@ -2086,19 +2137,19 @@ k.prototype = {
|
|
|
2086
2137
|
return "[Cleave Object]";
|
|
2087
2138
|
}
|
|
2088
2139
|
};
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
(typeof
|
|
2097
|
-
var ae =
|
|
2140
|
+
A.NumeralFormatter = Sr;
|
|
2141
|
+
A.DateFormatter = Pr;
|
|
2142
|
+
A.TimeFormatter = Ar;
|
|
2143
|
+
A.PhoneFormatter = kr;
|
|
2144
|
+
A.CreditCardDetector = Cr;
|
|
2145
|
+
A.Util = Er;
|
|
2146
|
+
A.DefaultProperties = Nr;
|
|
2147
|
+
(typeof Q == "object" && Q ? Q : window).Cleave = A;
|
|
2148
|
+
var ae = A, pt = {}, Dr = function() {
|
|
2098
2149
|
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
2099
|
-
}, we = {},
|
|
2150
|
+
}, we = {}, M = {};
|
|
2100
2151
|
let jt;
|
|
2101
|
-
const
|
|
2152
|
+
const Mr = [
|
|
2102
2153
|
0,
|
|
2103
2154
|
// Not used
|
|
2104
2155
|
26,
|
|
@@ -2142,29 +2193,29 @@ const Ir = [
|
|
|
2142
2193
|
3532,
|
|
2143
2194
|
3706
|
|
2144
2195
|
];
|
|
2145
|
-
|
|
2196
|
+
M.getSymbolSize = function(t) {
|
|
2146
2197
|
if (!t) throw new Error('"version" cannot be null or undefined');
|
|
2147
2198
|
if (t < 1 || t > 40) throw new Error('"version" should be in range from 1 to 40');
|
|
2148
2199
|
return t * 4 + 17;
|
|
2149
2200
|
};
|
|
2150
|
-
|
|
2151
|
-
return
|
|
2201
|
+
M.getSymbolTotalCodewords = function(t) {
|
|
2202
|
+
return Mr[t];
|
|
2152
2203
|
};
|
|
2153
|
-
|
|
2204
|
+
M.getBCHDigit = function(e) {
|
|
2154
2205
|
let t = 0;
|
|
2155
2206
|
for (; e !== 0; )
|
|
2156
2207
|
t++, e >>>= 1;
|
|
2157
2208
|
return t;
|
|
2158
2209
|
};
|
|
2159
|
-
|
|
2210
|
+
M.setToSJISFunction = function(t) {
|
|
2160
2211
|
if (typeof t != "function")
|
|
2161
2212
|
throw new Error('"toSJISFunc" is not a valid function.');
|
|
2162
2213
|
jt = t;
|
|
2163
2214
|
};
|
|
2164
|
-
|
|
2215
|
+
M.isKanjiModeEnabled = function() {
|
|
2165
2216
|
return typeof jt < "u";
|
|
2166
2217
|
};
|
|
2167
|
-
|
|
2218
|
+
M.toSJIS = function(t) {
|
|
2168
2219
|
return jt(t);
|
|
2169
2220
|
};
|
|
2170
2221
|
var Pt = {};
|
|
@@ -2190,15 +2241,15 @@ var Pt = {};
|
|
|
2190
2241
|
throw new Error("Unknown EC Level: " + r);
|
|
2191
2242
|
}
|
|
2192
2243
|
}
|
|
2193
|
-
e.isValid = function(
|
|
2194
|
-
return
|
|
2195
|
-
}, e.from = function(
|
|
2196
|
-
if (e.isValid(
|
|
2197
|
-
return
|
|
2244
|
+
e.isValid = function(i) {
|
|
2245
|
+
return i && typeof i.bit < "u" && i.bit >= 0 && i.bit < 4;
|
|
2246
|
+
}, e.from = function(i, n) {
|
|
2247
|
+
if (e.isValid(i))
|
|
2248
|
+
return i;
|
|
2198
2249
|
try {
|
|
2199
|
-
return t(
|
|
2250
|
+
return t(i);
|
|
2200
2251
|
} catch {
|
|
2201
|
-
return
|
|
2252
|
+
return n;
|
|
2202
2253
|
}
|
|
2203
2254
|
};
|
|
2204
2255
|
})(Pt);
|
|
@@ -2222,15 +2273,15 @@ xe.prototype = {
|
|
|
2222
2273
|
this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
|
|
2223
2274
|
}
|
|
2224
2275
|
};
|
|
2225
|
-
var
|
|
2276
|
+
var Tr = xe;
|
|
2226
2277
|
function mt(e) {
|
|
2227
2278
|
if (!e || e < 1)
|
|
2228
2279
|
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
2229
2280
|
this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
|
|
2230
2281
|
}
|
|
2231
|
-
mt.prototype.set = function(e, t, r,
|
|
2232
|
-
const
|
|
2233
|
-
this.data[
|
|
2282
|
+
mt.prototype.set = function(e, t, r, i) {
|
|
2283
|
+
const n = e * this.size + t;
|
|
2284
|
+
this.data[n] = r, i && (this.reservedBit[n] = !0);
|
|
2234
2285
|
};
|
|
2235
2286
|
mt.prototype.get = function(e, t) {
|
|
2236
2287
|
return this.data[e * this.size + t];
|
|
@@ -2241,29 +2292,29 @@ mt.prototype.xor = function(e, t, r) {
|
|
|
2241
2292
|
mt.prototype.isReserved = function(e, t) {
|
|
2242
2293
|
return this.reservedBit[e * this.size + t];
|
|
2243
2294
|
};
|
|
2244
|
-
var
|
|
2295
|
+
var $r = mt, Se = {};
|
|
2245
2296
|
(function(e) {
|
|
2246
|
-
const t =
|
|
2247
|
-
e.getRowColCoords = function(
|
|
2248
|
-
if (
|
|
2249
|
-
const
|
|
2250
|
-
for (let a = 1; a <
|
|
2251
|
-
l[a] = l[a - 1] -
|
|
2297
|
+
const t = M.getSymbolSize;
|
|
2298
|
+
e.getRowColCoords = function(i) {
|
|
2299
|
+
if (i === 1) return [];
|
|
2300
|
+
const n = Math.floor(i / 7) + 2, s = t(i), o = s === 145 ? 26 : Math.ceil((s - 13) / (2 * n - 2)) * 2, l = [s - 7];
|
|
2301
|
+
for (let a = 1; a < n - 1; a++)
|
|
2302
|
+
l[a] = l[a - 1] - o;
|
|
2252
2303
|
return l.push(6), l.reverse();
|
|
2253
|
-
}, e.getPositions = function(
|
|
2254
|
-
const
|
|
2255
|
-
for (let l = 0; l <
|
|
2256
|
-
for (let a = 0; a <
|
|
2304
|
+
}, e.getPositions = function(i) {
|
|
2305
|
+
const n = [], s = e.getRowColCoords(i), o = s.length;
|
|
2306
|
+
for (let l = 0; l < o; l++)
|
|
2307
|
+
for (let a = 0; a < o; a++)
|
|
2257
2308
|
l === 0 && a === 0 || // top-left
|
|
2258
|
-
l === 0 && a ===
|
|
2259
|
-
l ===
|
|
2260
|
-
return
|
|
2309
|
+
l === 0 && a === o - 1 || // bottom-left
|
|
2310
|
+
l === o - 1 && a === 0 || n.push([s[l], s[a]]);
|
|
2311
|
+
return n;
|
|
2261
2312
|
};
|
|
2262
2313
|
})(Se);
|
|
2263
2314
|
var Pe = {};
|
|
2264
|
-
const
|
|
2315
|
+
const Rr = M.getSymbolSize, le = 7;
|
|
2265
2316
|
Pe.getPositions = function(t) {
|
|
2266
|
-
const r =
|
|
2317
|
+
const r = Rr(t);
|
|
2267
2318
|
return [
|
|
2268
2319
|
// top-left
|
|
2269
2320
|
[0, 0],
|
|
@@ -2273,7 +2324,7 @@ Pe.getPositions = function(t) {
|
|
|
2273
2324
|
[0, r - le]
|
|
2274
2325
|
];
|
|
2275
2326
|
};
|
|
2276
|
-
var
|
|
2327
|
+
var Ae = {};
|
|
2277
2328
|
(function(e) {
|
|
2278
2329
|
e.Patterns = {
|
|
2279
2330
|
PATTERN000: 0,
|
|
@@ -2291,85 +2342,85 @@ var ke = {};
|
|
|
2291
2342
|
N3: 40,
|
|
2292
2343
|
N4: 10
|
|
2293
2344
|
};
|
|
2294
|
-
e.isValid = function(
|
|
2295
|
-
return
|
|
2296
|
-
}, e.from = function(
|
|
2297
|
-
return e.isValid(
|
|
2298
|
-
}, e.getPenaltyN1 = function(
|
|
2299
|
-
const
|
|
2300
|
-
let
|
|
2301
|
-
for (let h = 0; h <
|
|
2345
|
+
e.isValid = function(n) {
|
|
2346
|
+
return n != null && n !== "" && !isNaN(n) && n >= 0 && n <= 7;
|
|
2347
|
+
}, e.from = function(n) {
|
|
2348
|
+
return e.isValid(n) ? parseInt(n, 10) : void 0;
|
|
2349
|
+
}, e.getPenaltyN1 = function(n) {
|
|
2350
|
+
const s = n.size;
|
|
2351
|
+
let o = 0, l = 0, a = 0, c = null, d = null;
|
|
2352
|
+
for (let h = 0; h < s; h++) {
|
|
2302
2353
|
l = a = 0, c = d = null;
|
|
2303
|
-
for (let p = 0; p <
|
|
2304
|
-
let u =
|
|
2305
|
-
u === c ? l++ : (l >= 5 && (
|
|
2354
|
+
for (let p = 0; p < s; p++) {
|
|
2355
|
+
let u = n.get(h, p);
|
|
2356
|
+
u === c ? l++ : (l >= 5 && (o += t.N1 + (l - 5)), c = u, l = 1), u = n.get(p, h), u === d ? a++ : (a >= 5 && (o += t.N1 + (a - 5)), d = u, a = 1);
|
|
2306
2357
|
}
|
|
2307
|
-
l >= 5 && (
|
|
2358
|
+
l >= 5 && (o += t.N1 + (l - 5)), a >= 5 && (o += t.N1 + (a - 5));
|
|
2308
2359
|
}
|
|
2309
|
-
return
|
|
2310
|
-
}, e.getPenaltyN2 = function(
|
|
2311
|
-
const
|
|
2312
|
-
let
|
|
2313
|
-
for (let l = 0; l <
|
|
2314
|
-
for (let a = 0; a <
|
|
2315
|
-
const c =
|
|
2316
|
-
(c === 4 || c === 0) &&
|
|
2360
|
+
return o;
|
|
2361
|
+
}, e.getPenaltyN2 = function(n) {
|
|
2362
|
+
const s = n.size;
|
|
2363
|
+
let o = 0;
|
|
2364
|
+
for (let l = 0; l < s - 1; l++)
|
|
2365
|
+
for (let a = 0; a < s - 1; a++) {
|
|
2366
|
+
const c = n.get(l, a) + n.get(l, a + 1) + n.get(l + 1, a) + n.get(l + 1, a + 1);
|
|
2367
|
+
(c === 4 || c === 0) && o++;
|
|
2317
2368
|
}
|
|
2318
|
-
return
|
|
2319
|
-
}, e.getPenaltyN3 = function(
|
|
2320
|
-
const
|
|
2321
|
-
let
|
|
2322
|
-
for (let c = 0; c <
|
|
2369
|
+
return o * t.N2;
|
|
2370
|
+
}, e.getPenaltyN3 = function(n) {
|
|
2371
|
+
const s = n.size;
|
|
2372
|
+
let o = 0, l = 0, a = 0;
|
|
2373
|
+
for (let c = 0; c < s; c++) {
|
|
2323
2374
|
l = a = 0;
|
|
2324
|
-
for (let d = 0; d <
|
|
2325
|
-
l = l << 1 & 2047 |
|
|
2375
|
+
for (let d = 0; d < s; d++)
|
|
2376
|
+
l = l << 1 & 2047 | n.get(c, d), d >= 10 && (l === 1488 || l === 93) && o++, a = a << 1 & 2047 | n.get(d, c), d >= 10 && (a === 1488 || a === 93) && o++;
|
|
2326
2377
|
}
|
|
2327
|
-
return
|
|
2328
|
-
}, e.getPenaltyN4 = function(
|
|
2329
|
-
let
|
|
2330
|
-
const
|
|
2331
|
-
for (let a = 0; a <
|
|
2332
|
-
return Math.abs(Math.ceil(
|
|
2378
|
+
return o * t.N3;
|
|
2379
|
+
}, e.getPenaltyN4 = function(n) {
|
|
2380
|
+
let s = 0;
|
|
2381
|
+
const o = n.data.length;
|
|
2382
|
+
for (let a = 0; a < o; a++) s += n.data[a];
|
|
2383
|
+
return Math.abs(Math.ceil(s * 100 / o / 5) - 10) * t.N4;
|
|
2333
2384
|
};
|
|
2334
|
-
function r(
|
|
2335
|
-
switch (
|
|
2385
|
+
function r(i, n, s) {
|
|
2386
|
+
switch (i) {
|
|
2336
2387
|
case e.Patterns.PATTERN000:
|
|
2337
|
-
return (
|
|
2388
|
+
return (n + s) % 2 === 0;
|
|
2338
2389
|
case e.Patterns.PATTERN001:
|
|
2339
|
-
return
|
|
2390
|
+
return n % 2 === 0;
|
|
2340
2391
|
case e.Patterns.PATTERN010:
|
|
2341
|
-
return
|
|
2392
|
+
return s % 3 === 0;
|
|
2342
2393
|
case e.Patterns.PATTERN011:
|
|
2343
|
-
return (
|
|
2394
|
+
return (n + s) % 3 === 0;
|
|
2344
2395
|
case e.Patterns.PATTERN100:
|
|
2345
|
-
return (Math.floor(
|
|
2396
|
+
return (Math.floor(n / 2) + Math.floor(s / 3)) % 2 === 0;
|
|
2346
2397
|
case e.Patterns.PATTERN101:
|
|
2347
|
-
return
|
|
2398
|
+
return n * s % 2 + n * s % 3 === 0;
|
|
2348
2399
|
case e.Patterns.PATTERN110:
|
|
2349
|
-
return (
|
|
2400
|
+
return (n * s % 2 + n * s % 3) % 2 === 0;
|
|
2350
2401
|
case e.Patterns.PATTERN111:
|
|
2351
|
-
return (
|
|
2402
|
+
return (n * s % 3 + (n + s) % 2) % 2 === 0;
|
|
2352
2403
|
default:
|
|
2353
|
-
throw new Error("bad maskPattern:" +
|
|
2404
|
+
throw new Error("bad maskPattern:" + i);
|
|
2354
2405
|
}
|
|
2355
2406
|
}
|
|
2356
|
-
e.applyMask = function(
|
|
2357
|
-
const
|
|
2358
|
-
for (let l = 0; l <
|
|
2359
|
-
for (let a = 0; a <
|
|
2360
|
-
|
|
2361
|
-
}, e.getBestMask = function(
|
|
2362
|
-
const
|
|
2407
|
+
e.applyMask = function(n, s) {
|
|
2408
|
+
const o = s.size;
|
|
2409
|
+
for (let l = 0; l < o; l++)
|
|
2410
|
+
for (let a = 0; a < o; a++)
|
|
2411
|
+
s.isReserved(a, l) || s.xor(a, l, r(n, a, l));
|
|
2412
|
+
}, e.getBestMask = function(n, s) {
|
|
2413
|
+
const o = Object.keys(e.Patterns).length;
|
|
2363
2414
|
let l = 0, a = 1 / 0;
|
|
2364
|
-
for (let c = 0; c <
|
|
2365
|
-
|
|
2366
|
-
const d = e.getPenaltyN1(
|
|
2367
|
-
e.applyMask(c,
|
|
2415
|
+
for (let c = 0; c < o; c++) {
|
|
2416
|
+
s(c), e.applyMask(c, n);
|
|
2417
|
+
const d = e.getPenaltyN1(n) + e.getPenaltyN2(n) + e.getPenaltyN3(n) + e.getPenaltyN4(n);
|
|
2418
|
+
e.applyMask(c, n), d < a && (a = d, l = c);
|
|
2368
2419
|
}
|
|
2369
2420
|
return l;
|
|
2370
2421
|
};
|
|
2371
|
-
})(
|
|
2372
|
-
var
|
|
2422
|
+
})(Ae);
|
|
2423
|
+
var At = {};
|
|
2373
2424
|
const O = Pt, ft = [
|
|
2374
2425
|
// L M Q H
|
|
2375
2426
|
1,
|
|
@@ -2695,7 +2746,7 @@ const O = Pt, ft = [
|
|
|
2695
2746
|
2040,
|
|
2696
2747
|
2430
|
|
2697
2748
|
];
|
|
2698
|
-
|
|
2749
|
+
At.getBlocksCount = function(t, r) {
|
|
2699
2750
|
switch (r) {
|
|
2700
2751
|
case O.L:
|
|
2701
2752
|
return ft[(t - 1) * 4 + 0];
|
|
@@ -2709,7 +2760,7 @@ kt.getBlocksCount = function(t, r) {
|
|
|
2709
2760
|
return;
|
|
2710
2761
|
}
|
|
2711
2762
|
};
|
|
2712
|
-
|
|
2763
|
+
At.getTotalCodewordsCount = function(t, r) {
|
|
2713
2764
|
switch (r) {
|
|
2714
2765
|
case O.L:
|
|
2715
2766
|
return gt[(t - 1) * 4 + 0];
|
|
@@ -2723,7 +2774,7 @@ kt.getTotalCodewordsCount = function(t, r) {
|
|
|
2723
2774
|
return;
|
|
2724
2775
|
}
|
|
2725
2776
|
};
|
|
2726
|
-
var
|
|
2777
|
+
var ke = {}, kt = {};
|
|
2727
2778
|
const at = new Uint8Array(512), wt = new Uint8Array(256);
|
|
2728
2779
|
(function() {
|
|
2729
2780
|
let t = 1;
|
|
@@ -2732,88 +2783,88 @@ const at = new Uint8Array(512), wt = new Uint8Array(256);
|
|
|
2732
2783
|
for (let r = 255; r < 512; r++)
|
|
2733
2784
|
at[r] = at[r - 255];
|
|
2734
2785
|
})();
|
|
2735
|
-
|
|
2786
|
+
kt.log = function(t) {
|
|
2736
2787
|
if (t < 1) throw new Error("log(" + t + ")");
|
|
2737
2788
|
return wt[t];
|
|
2738
2789
|
};
|
|
2739
|
-
|
|
2790
|
+
kt.exp = function(t) {
|
|
2740
2791
|
return at[t];
|
|
2741
2792
|
};
|
|
2742
|
-
|
|
2793
|
+
kt.mul = function(t, r) {
|
|
2743
2794
|
return t === 0 || r === 0 ? 0 : at[wt[t] + wt[r]];
|
|
2744
2795
|
};
|
|
2745
2796
|
(function(e) {
|
|
2746
|
-
const t =
|
|
2747
|
-
e.mul = function(
|
|
2748
|
-
const
|
|
2749
|
-
for (let
|
|
2750
|
-
for (let l = 0; l <
|
|
2751
|
-
o
|
|
2752
|
-
return
|
|
2753
|
-
}, e.mod = function(
|
|
2754
|
-
let
|
|
2755
|
-
for (;
|
|
2756
|
-
const
|
|
2757
|
-
for (let a = 0; a <
|
|
2758
|
-
|
|
2797
|
+
const t = kt;
|
|
2798
|
+
e.mul = function(i, n) {
|
|
2799
|
+
const s = new Uint8Array(i.length + n.length - 1);
|
|
2800
|
+
for (let o = 0; o < i.length; o++)
|
|
2801
|
+
for (let l = 0; l < n.length; l++)
|
|
2802
|
+
s[o + l] ^= t.mul(i[o], n[l]);
|
|
2803
|
+
return s;
|
|
2804
|
+
}, e.mod = function(i, n) {
|
|
2805
|
+
let s = new Uint8Array(i);
|
|
2806
|
+
for (; s.length - n.length >= 0; ) {
|
|
2807
|
+
const o = s[0];
|
|
2808
|
+
for (let a = 0; a < n.length; a++)
|
|
2809
|
+
s[a] ^= t.mul(n[a], o);
|
|
2759
2810
|
let l = 0;
|
|
2760
|
-
for (; l <
|
|
2761
|
-
|
|
2811
|
+
for (; l < s.length && s[l] === 0; ) l++;
|
|
2812
|
+
s = s.slice(l);
|
|
2762
2813
|
}
|
|
2763
|
-
return
|
|
2764
|
-
}, e.generateECPolynomial = function(
|
|
2765
|
-
let
|
|
2766
|
-
for (let
|
|
2767
|
-
|
|
2768
|
-
return
|
|
2814
|
+
return s;
|
|
2815
|
+
}, e.generateECPolynomial = function(i) {
|
|
2816
|
+
let n = new Uint8Array([1]);
|
|
2817
|
+
for (let s = 0; s < i; s++)
|
|
2818
|
+
n = e.mul(n, new Uint8Array([1, t.exp(s)]));
|
|
2819
|
+
return n;
|
|
2769
2820
|
};
|
|
2770
|
-
})(
|
|
2771
|
-
const
|
|
2821
|
+
})(ke);
|
|
2822
|
+
const Ce = ke;
|
|
2772
2823
|
function Gt(e) {
|
|
2773
2824
|
this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
|
|
2774
2825
|
}
|
|
2775
2826
|
Gt.prototype.initialize = function(t) {
|
|
2776
|
-
this.degree = t, this.genPoly =
|
|
2827
|
+
this.degree = t, this.genPoly = Ce.generateECPolynomial(this.degree);
|
|
2777
2828
|
};
|
|
2778
2829
|
Gt.prototype.encode = function(t) {
|
|
2779
2830
|
if (!this.genPoly)
|
|
2780
2831
|
throw new Error("Encoder not initialized");
|
|
2781
2832
|
const r = new Uint8Array(t.length + this.degree);
|
|
2782
2833
|
r.set(t);
|
|
2783
|
-
const
|
|
2784
|
-
if (
|
|
2785
|
-
const
|
|
2786
|
-
return
|
|
2834
|
+
const i = Ce.mod(r, this.genPoly), n = this.degree - i.length;
|
|
2835
|
+
if (n > 0) {
|
|
2836
|
+
const s = new Uint8Array(this.degree);
|
|
2837
|
+
return s.set(i, n), s;
|
|
2787
2838
|
}
|
|
2788
|
-
return
|
|
2839
|
+
return i;
|
|
2789
2840
|
};
|
|
2790
|
-
var
|
|
2791
|
-
|
|
2841
|
+
var Lr = Gt, _e = {}, q = {}, Kt = {};
|
|
2842
|
+
Kt.isValid = function(t) {
|
|
2792
2843
|
return !isNaN(t) && t >= 1 && t <= 40;
|
|
2793
2844
|
};
|
|
2794
|
-
var
|
|
2795
|
-
const
|
|
2845
|
+
var L = {};
|
|
2846
|
+
const Ee = "[0-9]+", Br = "[A-Z $%*+\\-./:]+";
|
|
2796
2847
|
let ut = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
2797
2848
|
ut = ut.replace(/u/g, "\\u");
|
|
2798
|
-
const
|
|
2849
|
+
const Ur = "(?:(?![A-Z0-9 $%*+\\-./:]|" + ut + `)(?:.|[\r
|
|
2799
2850
|
]))+`;
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
const
|
|
2806
|
-
|
|
2807
|
-
return
|
|
2851
|
+
L.KANJI = new RegExp(ut, "g");
|
|
2852
|
+
L.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
2853
|
+
L.BYTE = new RegExp(Ur, "g");
|
|
2854
|
+
L.NUMERIC = new RegExp(Ee, "g");
|
|
2855
|
+
L.ALPHANUMERIC = new RegExp(Br, "g");
|
|
2856
|
+
const Fr = new RegExp("^" + ut + "$"), Or = new RegExp("^" + Ee + "$"), zr = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
2857
|
+
L.testKanji = function(t) {
|
|
2858
|
+
return Fr.test(t);
|
|
2808
2859
|
};
|
|
2809
|
-
|
|
2810
|
-
return
|
|
2860
|
+
L.testNumeric = function(t) {
|
|
2861
|
+
return Or.test(t);
|
|
2811
2862
|
};
|
|
2812
|
-
|
|
2813
|
-
return
|
|
2863
|
+
L.testAlphanumeric = function(t) {
|
|
2864
|
+
return zr.test(t);
|
|
2814
2865
|
};
|
|
2815
2866
|
(function(e) {
|
|
2816
|
-
const t =
|
|
2867
|
+
const t = Kt, r = L;
|
|
2817
2868
|
e.NUMERIC = {
|
|
2818
2869
|
id: "Numeric",
|
|
2819
2870
|
bit: 1,
|
|
@@ -2832,23 +2883,23 @@ B.testAlphanumeric = function(t) {
|
|
|
2832
2883
|
ccBits: [8, 10, 12]
|
|
2833
2884
|
}, e.MIXED = {
|
|
2834
2885
|
bit: -1
|
|
2835
|
-
}, e.getCharCountIndicator = function(
|
|
2836
|
-
if (!
|
|
2837
|
-
if (!t.isValid(
|
|
2838
|
-
throw new Error("Invalid version: " +
|
|
2839
|
-
return
|
|
2840
|
-
}, e.getBestModeForData = function(
|
|
2841
|
-
return r.testNumeric(
|
|
2842
|
-
}, e.toString = function(
|
|
2843
|
-
if (
|
|
2886
|
+
}, e.getCharCountIndicator = function(s, o) {
|
|
2887
|
+
if (!s.ccBits) throw new Error("Invalid mode: " + s);
|
|
2888
|
+
if (!t.isValid(o))
|
|
2889
|
+
throw new Error("Invalid version: " + o);
|
|
2890
|
+
return o >= 1 && o < 10 ? s.ccBits[0] : o < 27 ? s.ccBits[1] : s.ccBits[2];
|
|
2891
|
+
}, e.getBestModeForData = function(s) {
|
|
2892
|
+
return r.testNumeric(s) ? e.NUMERIC : r.testAlphanumeric(s) ? e.ALPHANUMERIC : r.testKanji(s) ? e.KANJI : e.BYTE;
|
|
2893
|
+
}, e.toString = function(s) {
|
|
2894
|
+
if (s && s.id) return s.id;
|
|
2844
2895
|
throw new Error("Invalid mode");
|
|
2845
|
-
}, e.isValid = function(
|
|
2846
|
-
return
|
|
2896
|
+
}, e.isValid = function(s) {
|
|
2897
|
+
return s && s.bit && s.ccBits;
|
|
2847
2898
|
};
|
|
2848
|
-
function n
|
|
2849
|
-
if (typeof
|
|
2899
|
+
function i(n) {
|
|
2900
|
+
if (typeof n != "string")
|
|
2850
2901
|
throw new Error("Param is not a string");
|
|
2851
|
-
switch (
|
|
2902
|
+
switch (n.toLowerCase()) {
|
|
2852
2903
|
case "numeric":
|
|
2853
2904
|
return e.NUMERIC;
|
|
2854
2905
|
case "alphanumeric":
|
|
@@ -2858,114 +2909,114 @@ B.testAlphanumeric = function(t) {
|
|
|
2858
2909
|
case "byte":
|
|
2859
2910
|
return e.BYTE;
|
|
2860
2911
|
default:
|
|
2861
|
-
throw new Error("Unknown mode: " +
|
|
2912
|
+
throw new Error("Unknown mode: " + n);
|
|
2862
2913
|
}
|
|
2863
2914
|
}
|
|
2864
|
-
e.from = function(
|
|
2865
|
-
if (e.isValid(
|
|
2866
|
-
return
|
|
2915
|
+
e.from = function(s, o) {
|
|
2916
|
+
if (e.isValid(s))
|
|
2917
|
+
return s;
|
|
2867
2918
|
try {
|
|
2868
|
-
return
|
|
2919
|
+
return i(s);
|
|
2869
2920
|
} catch {
|
|
2870
|
-
return
|
|
2921
|
+
return o;
|
|
2871
2922
|
}
|
|
2872
2923
|
};
|
|
2873
2924
|
})(q);
|
|
2874
2925
|
(function(e) {
|
|
2875
|
-
const t =
|
|
2926
|
+
const t = M, r = At, i = Pt, n = q, s = Kt, o = 7973, l = t.getBCHDigit(o);
|
|
2876
2927
|
function a(p, u, m) {
|
|
2877
|
-
for (let
|
|
2878
|
-
if (u <= e.getCapacity(
|
|
2879
|
-
return
|
|
2928
|
+
for (let v = 1; v <= 40; v++)
|
|
2929
|
+
if (u <= e.getCapacity(v, m, p))
|
|
2930
|
+
return v;
|
|
2880
2931
|
}
|
|
2881
2932
|
function c(p, u) {
|
|
2882
|
-
return
|
|
2933
|
+
return n.getCharCountIndicator(p, u) + 4;
|
|
2883
2934
|
}
|
|
2884
2935
|
function d(p, u) {
|
|
2885
2936
|
let m = 0;
|
|
2886
|
-
return p.forEach(function(
|
|
2887
|
-
const
|
|
2888
|
-
m +=
|
|
2937
|
+
return p.forEach(function(v) {
|
|
2938
|
+
const C = c(v.mode, u);
|
|
2939
|
+
m += C + v.getBitsLength();
|
|
2889
2940
|
}), m;
|
|
2890
2941
|
}
|
|
2891
2942
|
function h(p, u) {
|
|
2892
2943
|
for (let m = 1; m <= 40; m++)
|
|
2893
|
-
if (d(p, m) <= e.getCapacity(m, u,
|
|
2944
|
+
if (d(p, m) <= e.getCapacity(m, u, n.MIXED))
|
|
2894
2945
|
return m;
|
|
2895
2946
|
}
|
|
2896
2947
|
e.from = function(u, m) {
|
|
2897
|
-
return
|
|
2898
|
-
}, e.getCapacity = function(u, m,
|
|
2899
|
-
if (!
|
|
2948
|
+
return s.isValid(u) ? parseInt(u, 10) : m;
|
|
2949
|
+
}, e.getCapacity = function(u, m, v) {
|
|
2950
|
+
if (!s.isValid(u))
|
|
2900
2951
|
throw new Error("Invalid QR Code version");
|
|
2901
|
-
typeof
|
|
2902
|
-
const
|
|
2903
|
-
if (
|
|
2904
|
-
const y = x - c(
|
|
2905
|
-
switch (
|
|
2906
|
-
case
|
|
2952
|
+
typeof v > "u" && (v = n.BYTE);
|
|
2953
|
+
const C = t.getSymbolTotalCodewords(u), w = r.getTotalCodewordsCount(u, m), x = (C - w) * 8;
|
|
2954
|
+
if (v === n.MIXED) return x;
|
|
2955
|
+
const y = x - c(v, u);
|
|
2956
|
+
switch (v) {
|
|
2957
|
+
case n.NUMERIC:
|
|
2907
2958
|
return Math.floor(y / 10 * 3);
|
|
2908
|
-
case
|
|
2959
|
+
case n.ALPHANUMERIC:
|
|
2909
2960
|
return Math.floor(y / 11 * 2);
|
|
2910
|
-
case
|
|
2961
|
+
case n.KANJI:
|
|
2911
2962
|
return Math.floor(y / 13);
|
|
2912
|
-
case
|
|
2963
|
+
case n.BYTE:
|
|
2913
2964
|
default:
|
|
2914
2965
|
return Math.floor(y / 8);
|
|
2915
2966
|
}
|
|
2916
2967
|
}, e.getBestVersionForData = function(u, m) {
|
|
2917
|
-
let
|
|
2918
|
-
const
|
|
2968
|
+
let v;
|
|
2969
|
+
const C = i.from(m, i.M);
|
|
2919
2970
|
if (Array.isArray(u)) {
|
|
2920
2971
|
if (u.length > 1)
|
|
2921
|
-
return h(u,
|
|
2972
|
+
return h(u, C);
|
|
2922
2973
|
if (u.length === 0)
|
|
2923
2974
|
return 1;
|
|
2924
|
-
|
|
2975
|
+
v = u[0];
|
|
2925
2976
|
} else
|
|
2926
|
-
|
|
2927
|
-
return a(
|
|
2977
|
+
v = u;
|
|
2978
|
+
return a(v.mode, v.getLength(), C);
|
|
2928
2979
|
}, e.getEncodedBits = function(u) {
|
|
2929
|
-
if (!
|
|
2980
|
+
if (!s.isValid(u) || u < 7)
|
|
2930
2981
|
throw new Error("Invalid QR Code version");
|
|
2931
2982
|
let m = u << 12;
|
|
2932
2983
|
for (; t.getBCHDigit(m) - l >= 0; )
|
|
2933
|
-
m ^=
|
|
2984
|
+
m ^= o << t.getBCHDigit(m) - l;
|
|
2934
2985
|
return u << 12 | m;
|
|
2935
2986
|
};
|
|
2936
|
-
})(
|
|
2987
|
+
})(_e);
|
|
2937
2988
|
var Ie = {};
|
|
2938
|
-
const Ut =
|
|
2989
|
+
const Ut = M, Ne = 1335, qr = 21522, ce = Ut.getBCHDigit(Ne);
|
|
2939
2990
|
Ie.getEncodedBits = function(t, r) {
|
|
2940
|
-
const
|
|
2941
|
-
let
|
|
2942
|
-
for (; Ut.getBCHDigit(
|
|
2943
|
-
|
|
2944
|
-
return (
|
|
2991
|
+
const i = t.bit << 3 | r;
|
|
2992
|
+
let n = i << 10;
|
|
2993
|
+
for (; Ut.getBCHDigit(n) - ce >= 0; )
|
|
2994
|
+
n ^= Ne << Ut.getBCHDigit(n) - ce;
|
|
2995
|
+
return (i << 10 | n) ^ qr;
|
|
2945
2996
|
};
|
|
2946
|
-
var
|
|
2947
|
-
const
|
|
2948
|
-
function
|
|
2949
|
-
this.mode =
|
|
2997
|
+
var De = {};
|
|
2998
|
+
const Hr = q;
|
|
2999
|
+
function Z(e) {
|
|
3000
|
+
this.mode = Hr.NUMERIC, this.data = e.toString();
|
|
2950
3001
|
}
|
|
2951
|
-
|
|
3002
|
+
Z.getBitsLength = function(t) {
|
|
2952
3003
|
return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
|
|
2953
3004
|
};
|
|
2954
|
-
|
|
3005
|
+
Z.prototype.getLength = function() {
|
|
2955
3006
|
return this.data.length;
|
|
2956
3007
|
};
|
|
2957
|
-
|
|
2958
|
-
return
|
|
3008
|
+
Z.prototype.getBitsLength = function() {
|
|
3009
|
+
return Z.getBitsLength(this.data.length);
|
|
2959
3010
|
};
|
|
2960
|
-
|
|
2961
|
-
let r,
|
|
3011
|
+
Z.prototype.write = function(t) {
|
|
3012
|
+
let r, i, n;
|
|
2962
3013
|
for (r = 0; r + 3 <= this.data.length; r += 3)
|
|
2963
|
-
|
|
2964
|
-
const
|
|
2965
|
-
|
|
3014
|
+
i = this.data.substr(r, 3), n = parseInt(i, 10), t.put(n, 10);
|
|
3015
|
+
const s = this.data.length - r;
|
|
3016
|
+
s > 0 && (i = this.data.substr(r), n = parseInt(i, 10), t.put(n, s * 3 + 1));
|
|
2966
3017
|
};
|
|
2967
|
-
var
|
|
2968
|
-
const
|
|
3018
|
+
var Yr = Z;
|
|
3019
|
+
const Vr = q, Mt = [
|
|
2969
3020
|
"0",
|
|
2970
3021
|
"1",
|
|
2971
3022
|
"2",
|
|
@@ -3013,7 +3064,7 @@ const qr = q, Nt = [
|
|
|
3013
3064
|
":"
|
|
3014
3065
|
];
|
|
3015
3066
|
function X(e) {
|
|
3016
|
-
this.mode =
|
|
3067
|
+
this.mode = Vr.ALPHANUMERIC, this.data = e;
|
|
3017
3068
|
}
|
|
3018
3069
|
X.getBitsLength = function(t) {
|
|
3019
3070
|
return 11 * Math.floor(t / 2) + 6 * (t % 2);
|
|
@@ -3027,15 +3078,15 @@ X.prototype.getBitsLength = function() {
|
|
|
3027
3078
|
X.prototype.write = function(t) {
|
|
3028
3079
|
let r;
|
|
3029
3080
|
for (r = 0; r + 2 <= this.data.length; r += 2) {
|
|
3030
|
-
let
|
|
3031
|
-
|
|
3081
|
+
let i = Mt.indexOf(this.data[r]) * 45;
|
|
3082
|
+
i += Mt.indexOf(this.data[r + 1]), t.put(i, 11);
|
|
3032
3083
|
}
|
|
3033
|
-
this.data.length % 2 && t.put(
|
|
3084
|
+
this.data.length % 2 && t.put(Mt.indexOf(this.data[r]), 6);
|
|
3034
3085
|
};
|
|
3035
|
-
var
|
|
3036
|
-
const
|
|
3086
|
+
var jr = X;
|
|
3087
|
+
const Gr = q;
|
|
3037
3088
|
function tt(e) {
|
|
3038
|
-
this.mode =
|
|
3089
|
+
this.mode = Gr.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
|
|
3039
3090
|
}
|
|
3040
3091
|
tt.getBitsLength = function(t) {
|
|
3041
3092
|
return t * 8;
|
|
@@ -3050,10 +3101,10 @@ tt.prototype.write = function(e) {
|
|
|
3050
3101
|
for (let t = 0, r = this.data.length; t < r; t++)
|
|
3051
3102
|
e.put(this.data[t], 8);
|
|
3052
3103
|
};
|
|
3053
|
-
var
|
|
3054
|
-
const
|
|
3104
|
+
var Kr = tt;
|
|
3105
|
+
const Qr = q, Wr = M;
|
|
3055
3106
|
function et(e) {
|
|
3056
|
-
this.mode =
|
|
3107
|
+
this.mode = Qr.KANJI, this.data = e;
|
|
3057
3108
|
}
|
|
3058
3109
|
et.getBitsLength = function(t) {
|
|
3059
3110
|
return t * 13;
|
|
@@ -3067,7 +3118,7 @@ et.prototype.getBitsLength = function() {
|
|
|
3067
3118
|
et.prototype.write = function(e) {
|
|
3068
3119
|
let t;
|
|
3069
3120
|
for (t = 0; t < this.data.length; t++) {
|
|
3070
|
-
let r =
|
|
3121
|
+
let r = Wr.toSJIS(this.data[t]);
|
|
3071
3122
|
if (r >= 33088 && r <= 40956)
|
|
3072
3123
|
r -= 33088;
|
|
3073
3124
|
else if (r >= 57408 && r <= 60351)
|
|
@@ -3080,35 +3131,35 @@ Make sure your charset is UTF-8`
|
|
|
3080
3131
|
r = (r >>> 8 & 255) * 192 + (r & 255), e.put(r, 13);
|
|
3081
3132
|
}
|
|
3082
3133
|
};
|
|
3083
|
-
var
|
|
3134
|
+
var Jr = et, Me = { exports: {} };
|
|
3084
3135
|
(function(e) {
|
|
3085
3136
|
var t = {
|
|
3086
|
-
single_source_shortest_paths: function(r,
|
|
3087
|
-
var
|
|
3088
|
-
|
|
3137
|
+
single_source_shortest_paths: function(r, i, n) {
|
|
3138
|
+
var s = {}, o = {};
|
|
3139
|
+
o[i] = 0;
|
|
3089
3140
|
var l = t.PriorityQueue.make();
|
|
3090
|
-
l.push(
|
|
3091
|
-
for (var a, c, d, h, p, u, m,
|
|
3141
|
+
l.push(i, 0);
|
|
3142
|
+
for (var a, c, d, h, p, u, m, v, C; !l.empty(); ) {
|
|
3092
3143
|
a = l.pop(), c = a.value, h = a.cost, p = r[c] || {};
|
|
3093
3144
|
for (d in p)
|
|
3094
|
-
p.hasOwnProperty(d) && (u = p[d], m = h + u,
|
|
3145
|
+
p.hasOwnProperty(d) && (u = p[d], m = h + u, v = o[d], C = typeof o[d] > "u", (C || v > m) && (o[d] = m, l.push(d, m), s[d] = c));
|
|
3095
3146
|
}
|
|
3096
|
-
if (typeof
|
|
3097
|
-
var
|
|
3098
|
-
throw new Error(
|
|
3147
|
+
if (typeof n < "u" && typeof o[n] > "u") {
|
|
3148
|
+
var w = ["Could not find a path from ", i, " to ", n, "."].join("");
|
|
3149
|
+
throw new Error(w);
|
|
3099
3150
|
}
|
|
3100
|
-
return
|
|
3151
|
+
return s;
|
|
3101
3152
|
},
|
|
3102
|
-
extract_shortest_path_from_predecessor_list: function(r,
|
|
3103
|
-
for (var
|
|
3104
|
-
|
|
3105
|
-
return
|
|
3153
|
+
extract_shortest_path_from_predecessor_list: function(r, i) {
|
|
3154
|
+
for (var n = [], s = i; s; )
|
|
3155
|
+
n.push(s), r[s], s = r[s];
|
|
3156
|
+
return n.reverse(), n;
|
|
3106
3157
|
},
|
|
3107
|
-
find_path: function(r,
|
|
3108
|
-
var
|
|
3158
|
+
find_path: function(r, i, n) {
|
|
3159
|
+
var s = t.single_source_shortest_paths(r, i, n);
|
|
3109
3160
|
return t.extract_shortest_path_from_predecessor_list(
|
|
3110
|
-
|
|
3111
|
-
|
|
3161
|
+
s,
|
|
3162
|
+
n
|
|
3112
3163
|
);
|
|
3113
3164
|
},
|
|
3114
3165
|
/**
|
|
@@ -3116,22 +3167,22 @@ var Qr = et, Ne = { exports: {} };
|
|
|
3116
3167
|
*/
|
|
3117
3168
|
PriorityQueue: {
|
|
3118
3169
|
make: function(r) {
|
|
3119
|
-
var
|
|
3170
|
+
var i = t.PriorityQueue, n = {}, s;
|
|
3120
3171
|
r = r || {};
|
|
3121
|
-
for (
|
|
3122
|
-
|
|
3123
|
-
return
|
|
3172
|
+
for (s in i)
|
|
3173
|
+
i.hasOwnProperty(s) && (n[s] = i[s]);
|
|
3174
|
+
return n.queue = [], n.sorter = r.sorter || i.default_sorter, n;
|
|
3124
3175
|
},
|
|
3125
|
-
default_sorter: function(r,
|
|
3126
|
-
return r.cost -
|
|
3176
|
+
default_sorter: function(r, i) {
|
|
3177
|
+
return r.cost - i.cost;
|
|
3127
3178
|
},
|
|
3128
3179
|
/**
|
|
3129
3180
|
* Add a new item to the queue and ensure the highest priority element
|
|
3130
3181
|
* is at the front of the queue.
|
|
3131
3182
|
*/
|
|
3132
|
-
push: function(r,
|
|
3133
|
-
var
|
|
3134
|
-
this.queue.push(
|
|
3183
|
+
push: function(r, i) {
|
|
3184
|
+
var n = { value: r, cost: i };
|
|
3185
|
+
this.queue.push(n), this.queue.sort(this.sorter);
|
|
3135
3186
|
},
|
|
3136
3187
|
/**
|
|
3137
3188
|
* Return the highest priority element in the queue.
|
|
@@ -3145,60 +3196,60 @@ var Qr = et, Ne = { exports: {} };
|
|
|
3145
3196
|
}
|
|
3146
3197
|
};
|
|
3147
3198
|
e.exports = t;
|
|
3148
|
-
})(
|
|
3149
|
-
var
|
|
3199
|
+
})(Me);
|
|
3200
|
+
var Zr = Me.exports;
|
|
3150
3201
|
(function(e) {
|
|
3151
|
-
const t = q, r =
|
|
3152
|
-
function c(
|
|
3153
|
-
return unescape(encodeURIComponent(
|
|
3202
|
+
const t = q, r = Yr, i = jr, n = Kr, s = Jr, o = L, l = M, a = Zr;
|
|
3203
|
+
function c(w) {
|
|
3204
|
+
return unescape(encodeURIComponent(w)).length;
|
|
3154
3205
|
}
|
|
3155
|
-
function d(
|
|
3206
|
+
function d(w, x, y) {
|
|
3156
3207
|
const g = [];
|
|
3157
|
-
let
|
|
3158
|
-
for (; (
|
|
3208
|
+
let k;
|
|
3209
|
+
for (; (k = w.exec(y)) !== null; )
|
|
3159
3210
|
g.push({
|
|
3160
|
-
data:
|
|
3161
|
-
index:
|
|
3211
|
+
data: k[0],
|
|
3212
|
+
index: k.index,
|
|
3162
3213
|
mode: x,
|
|
3163
|
-
length:
|
|
3214
|
+
length: k[0].length
|
|
3164
3215
|
});
|
|
3165
3216
|
return g;
|
|
3166
3217
|
}
|
|
3167
|
-
function h(
|
|
3168
|
-
const x = d(
|
|
3169
|
-
let g,
|
|
3170
|
-
return l.isKanjiModeEnabled() ? (g = d(
|
|
3171
|
-
return
|
|
3172
|
-
}).map(function(
|
|
3218
|
+
function h(w) {
|
|
3219
|
+
const x = d(o.NUMERIC, t.NUMERIC, w), y = d(o.ALPHANUMERIC, t.ALPHANUMERIC, w);
|
|
3220
|
+
let g, k;
|
|
3221
|
+
return l.isKanjiModeEnabled() ? (g = d(o.BYTE, t.BYTE, w), k = d(o.KANJI, t.KANJI, w)) : (g = d(o.BYTE_KANJI, t.BYTE, w), k = []), x.concat(y, g, k).sort(function(E, $) {
|
|
3222
|
+
return E.index - $.index;
|
|
3223
|
+
}).map(function(E) {
|
|
3173
3224
|
return {
|
|
3174
|
-
data:
|
|
3175
|
-
mode:
|
|
3176
|
-
length:
|
|
3225
|
+
data: E.data,
|
|
3226
|
+
mode: E.mode,
|
|
3227
|
+
length: E.length
|
|
3177
3228
|
};
|
|
3178
3229
|
});
|
|
3179
3230
|
}
|
|
3180
|
-
function p(
|
|
3231
|
+
function p(w, x) {
|
|
3181
3232
|
switch (x) {
|
|
3182
3233
|
case t.NUMERIC:
|
|
3183
|
-
return r.getBitsLength(
|
|
3234
|
+
return r.getBitsLength(w);
|
|
3184
3235
|
case t.ALPHANUMERIC:
|
|
3185
|
-
return
|
|
3236
|
+
return i.getBitsLength(w);
|
|
3186
3237
|
case t.KANJI:
|
|
3187
|
-
return
|
|
3238
|
+
return s.getBitsLength(w);
|
|
3188
3239
|
case t.BYTE:
|
|
3189
|
-
return
|
|
3240
|
+
return n.getBitsLength(w);
|
|
3190
3241
|
}
|
|
3191
3242
|
}
|
|
3192
|
-
function u(
|
|
3193
|
-
return
|
|
3243
|
+
function u(w) {
|
|
3244
|
+
return w.reduce(function(x, y) {
|
|
3194
3245
|
const g = x.length - 1 >= 0 ? x[x.length - 1] : null;
|
|
3195
3246
|
return g && g.mode === y.mode ? (x[x.length - 1].data += y.data, x) : (x.push(y), x);
|
|
3196
3247
|
}, []);
|
|
3197
3248
|
}
|
|
3198
|
-
function m(
|
|
3249
|
+
function m(w) {
|
|
3199
3250
|
const x = [];
|
|
3200
|
-
for (let y = 0; y <
|
|
3201
|
-
const g =
|
|
3251
|
+
for (let y = 0; y < w.length; y++) {
|
|
3252
|
+
const g = w[y];
|
|
3202
3253
|
switch (g.mode) {
|
|
3203
3254
|
case t.NUMERIC:
|
|
3204
3255
|
x.push([
|
|
@@ -3227,328 +3278,328 @@ var Kr = Ne.exports;
|
|
|
3227
3278
|
}
|
|
3228
3279
|
return x;
|
|
3229
3280
|
}
|
|
3230
|
-
function
|
|
3281
|
+
function v(w, x) {
|
|
3231
3282
|
const y = {}, g = { start: {} };
|
|
3232
|
-
let
|
|
3233
|
-
for (let
|
|
3234
|
-
const
|
|
3235
|
-
for (let U = 0; U <
|
|
3236
|
-
const R =
|
|
3283
|
+
let k = ["start"];
|
|
3284
|
+
for (let _ = 0; _ < w.length; _++) {
|
|
3285
|
+
const E = w[_], $ = [];
|
|
3286
|
+
for (let U = 0; U < E.length; U++) {
|
|
3287
|
+
const R = E[U], rt = "" + _ + U;
|
|
3237
3288
|
$.push(rt), y[rt] = { node: R, lastCount: 0 }, g[rt] = {};
|
|
3238
|
-
for (let
|
|
3239
|
-
const
|
|
3240
|
-
y[
|
|
3289
|
+
for (let _t = 0; _t < k.length; _t++) {
|
|
3290
|
+
const B = k[_t];
|
|
3291
|
+
y[B] && y[B].node.mode === R.mode ? (g[B][rt] = p(y[B].lastCount + R.length, R.mode) - p(y[B].lastCount, R.mode), y[B].lastCount += R.length) : (y[B] && (y[B].lastCount = R.length), g[B][rt] = p(R.length, R.mode) + 4 + t.getCharCountIndicator(R.mode, x));
|
|
3241
3292
|
}
|
|
3242
3293
|
}
|
|
3243
|
-
|
|
3294
|
+
k = $;
|
|
3244
3295
|
}
|
|
3245
|
-
for (let
|
|
3246
|
-
g[
|
|
3296
|
+
for (let _ = 0; _ < k.length; _++)
|
|
3297
|
+
g[k[_]].end = 0;
|
|
3247
3298
|
return { map: g, table: y };
|
|
3248
3299
|
}
|
|
3249
|
-
function
|
|
3300
|
+
function C(w, x) {
|
|
3250
3301
|
let y;
|
|
3251
|
-
const g = t.getBestModeForData(
|
|
3302
|
+
const g = t.getBestModeForData(w);
|
|
3252
3303
|
if (y = t.from(x, g), y !== t.BYTE && y.bit < g.bit)
|
|
3253
|
-
throw new Error('"' +
|
|
3304
|
+
throw new Error('"' + w + '" cannot be encoded with mode ' + t.toString(y) + `.
|
|
3254
3305
|
Suggested mode is: ` + t.toString(g));
|
|
3255
3306
|
switch (y === t.KANJI && !l.isKanjiModeEnabled() && (y = t.BYTE), y) {
|
|
3256
3307
|
case t.NUMERIC:
|
|
3257
|
-
return new r(
|
|
3308
|
+
return new r(w);
|
|
3258
3309
|
case t.ALPHANUMERIC:
|
|
3259
|
-
return new
|
|
3310
|
+
return new i(w);
|
|
3260
3311
|
case t.KANJI:
|
|
3261
|
-
return new
|
|
3312
|
+
return new s(w);
|
|
3262
3313
|
case t.BYTE:
|
|
3263
|
-
return new
|
|
3314
|
+
return new n(w);
|
|
3264
3315
|
}
|
|
3265
3316
|
}
|
|
3266
3317
|
e.fromArray = function(x) {
|
|
3267
3318
|
return x.reduce(function(y, g) {
|
|
3268
|
-
return typeof g == "string" ? y.push(
|
|
3319
|
+
return typeof g == "string" ? y.push(C(g, null)) : g.data && y.push(C(g.data, g.mode)), y;
|
|
3269
3320
|
}, []);
|
|
3270
3321
|
}, e.fromString = function(x, y) {
|
|
3271
|
-
const g = h(x, l.isKanjiModeEnabled()),
|
|
3272
|
-
for (let U = 1; U <
|
|
3273
|
-
$.push(
|
|
3322
|
+
const g = h(x, l.isKanjiModeEnabled()), k = m(g), _ = v(k, y), E = a.find_path(_.map, "start", "end"), $ = [];
|
|
3323
|
+
for (let U = 1; U < E.length - 1; U++)
|
|
3324
|
+
$.push(_.table[E[U]].node);
|
|
3274
3325
|
return e.fromArray(u($));
|
|
3275
3326
|
}, e.rawSplit = function(x) {
|
|
3276
3327
|
return e.fromArray(
|
|
3277
3328
|
h(x, l.isKanjiModeEnabled())
|
|
3278
3329
|
);
|
|
3279
3330
|
};
|
|
3280
|
-
})(
|
|
3281
|
-
const
|
|
3282
|
-
function
|
|
3283
|
-
const r = e.size,
|
|
3284
|
-
for (let
|
|
3285
|
-
const
|
|
3331
|
+
})(De);
|
|
3332
|
+
const Ct = M, Tt = Pt, Xr = Tr, ti = $r, ei = Se, ri = Pe, Ft = Ae, Ot = At, ii = Lr, xt = _e, ni = Ie, si = q, $t = De;
|
|
3333
|
+
function oi(e, t) {
|
|
3334
|
+
const r = e.size, i = ri.getPositions(t);
|
|
3335
|
+
for (let n = 0; n < i.length; n++) {
|
|
3336
|
+
const s = i[n][0], o = i[n][1];
|
|
3286
3337
|
for (let l = -1; l <= 7; l++)
|
|
3287
|
-
if (!(
|
|
3338
|
+
if (!(s + l <= -1 || r <= s + l))
|
|
3288
3339
|
for (let a = -1; a <= 7; a++)
|
|
3289
|
-
|
|
3340
|
+
o + a <= -1 || r <= o + 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 ? e.set(s + l, o + a, !0, !0) : e.set(s + l, o + a, !1, !0));
|
|
3290
3341
|
}
|
|
3291
3342
|
}
|
|
3292
|
-
function
|
|
3343
|
+
function ai(e) {
|
|
3293
3344
|
const t = e.size;
|
|
3294
3345
|
for (let r = 8; r < t - 8; r++) {
|
|
3295
|
-
const
|
|
3296
|
-
e.set(r, 6,
|
|
3346
|
+
const i = r % 2 === 0;
|
|
3347
|
+
e.set(r, 6, i, !0), e.set(6, r, i, !0);
|
|
3297
3348
|
}
|
|
3298
3349
|
}
|
|
3299
|
-
function
|
|
3300
|
-
const r =
|
|
3301
|
-
for (let
|
|
3302
|
-
const
|
|
3303
|
-
for (let
|
|
3350
|
+
function li(e, t) {
|
|
3351
|
+
const r = ei.getPositions(t);
|
|
3352
|
+
for (let i = 0; i < r.length; i++) {
|
|
3353
|
+
const n = r[i][0], s = r[i][1];
|
|
3354
|
+
for (let o = -2; o <= 2; o++)
|
|
3304
3355
|
for (let l = -2; l <= 2; l++)
|
|
3305
|
-
|
|
3356
|
+
o === -2 || o === 2 || l === -2 || l === 2 || o === 0 && l === 0 ? e.set(n + o, s + l, !0, !0) : e.set(n + o, s + l, !1, !0);
|
|
3306
3357
|
}
|
|
3307
3358
|
}
|
|
3308
|
-
function
|
|
3309
|
-
const r = e.size,
|
|
3310
|
-
let
|
|
3359
|
+
function ci(e, t) {
|
|
3360
|
+
const r = e.size, i = xt.getEncodedBits(t);
|
|
3361
|
+
let n, s, o;
|
|
3311
3362
|
for (let l = 0; l < 18; l++)
|
|
3312
|
-
|
|
3363
|
+
n = Math.floor(l / 3), s = l % 3 + r - 8 - 3, o = (i >> l & 1) === 1, e.set(n, s, o, !0), e.set(s, n, o, !0);
|
|
3313
3364
|
}
|
|
3314
3365
|
function Rt(e, t, r) {
|
|
3315
|
-
const
|
|
3316
|
-
let
|
|
3317
|
-
for (
|
|
3318
|
-
|
|
3319
|
-
e.set(
|
|
3366
|
+
const i = e.size, n = ni.getEncodedBits(t, r);
|
|
3367
|
+
let s, o;
|
|
3368
|
+
for (s = 0; s < 15; s++)
|
|
3369
|
+
o = (n >> s & 1) === 1, s < 6 ? e.set(s, 8, o, !0) : s < 8 ? e.set(s + 1, 8, o, !0) : e.set(i - 15 + s, 8, o, !0), s < 8 ? e.set(8, i - s - 1, o, !0) : s < 9 ? e.set(8, 15 - s - 1 + 1, o, !0) : e.set(8, 15 - s - 1, o, !0);
|
|
3370
|
+
e.set(i - 8, 8, 1, !0);
|
|
3320
3371
|
}
|
|
3321
|
-
function
|
|
3372
|
+
function di(e, t) {
|
|
3322
3373
|
const r = e.size;
|
|
3323
|
-
let
|
|
3374
|
+
let i = -1, n = r - 1, s = 7, o = 0;
|
|
3324
3375
|
for (let l = r - 1; l > 0; l -= 2)
|
|
3325
3376
|
for (l === 6 && l--; ; ) {
|
|
3326
3377
|
for (let a = 0; a < 2; a++)
|
|
3327
|
-
if (!e.isReserved(
|
|
3378
|
+
if (!e.isReserved(n, l - a)) {
|
|
3328
3379
|
let c = !1;
|
|
3329
|
-
|
|
3380
|
+
o < t.length && (c = (t[o] >>> s & 1) === 1), e.set(n, l - a, c), s--, s === -1 && (o++, s = 7);
|
|
3330
3381
|
}
|
|
3331
|
-
if (
|
|
3332
|
-
|
|
3382
|
+
if (n += i, n < 0 || r <= n) {
|
|
3383
|
+
n -= i, i = -i;
|
|
3333
3384
|
break;
|
|
3334
3385
|
}
|
|
3335
3386
|
}
|
|
3336
3387
|
}
|
|
3337
|
-
function
|
|
3338
|
-
const
|
|
3388
|
+
function ui(e, t, r) {
|
|
3389
|
+
const i = new Xr();
|
|
3339
3390
|
r.forEach(function(a) {
|
|
3340
|
-
|
|
3391
|
+
i.put(a.mode.bit, 4), i.put(a.getLength(), si.getCharCountIndicator(a.mode, e)), a.write(i);
|
|
3341
3392
|
});
|
|
3342
|
-
const
|
|
3343
|
-
for (
|
|
3344
|
-
|
|
3345
|
-
const l = (
|
|
3393
|
+
const n = Ct.getSymbolTotalCodewords(e), s = Ot.getTotalCodewordsCount(e, t), o = (n - s) * 8;
|
|
3394
|
+
for (i.getLengthInBits() + 4 <= o && i.put(0, 4); i.getLengthInBits() % 8 !== 0; )
|
|
3395
|
+
i.putBit(0);
|
|
3396
|
+
const l = (o - i.getLengthInBits()) / 8;
|
|
3346
3397
|
for (let a = 0; a < l; a++)
|
|
3347
|
-
|
|
3348
|
-
return
|
|
3398
|
+
i.put(a % 2 ? 17 : 236, 8);
|
|
3399
|
+
return hi(i, e, t);
|
|
3349
3400
|
}
|
|
3350
|
-
function
|
|
3351
|
-
const
|
|
3401
|
+
function hi(e, t, r) {
|
|
3402
|
+
const i = Ct.getSymbolTotalCodewords(t), n = Ot.getTotalCodewordsCount(t, r), s = i - n, o = Ot.getBlocksCount(t, r), l = i % o, a = o - l, c = Math.floor(i / o), d = Math.floor(s / o), h = d + 1, p = c - d, u = new ii(p);
|
|
3352
3403
|
let m = 0;
|
|
3353
|
-
const
|
|
3354
|
-
let
|
|
3404
|
+
const v = new Array(o), C = new Array(o);
|
|
3405
|
+
let w = 0;
|
|
3355
3406
|
const x = new Uint8Array(e.buffer);
|
|
3356
|
-
for (let
|
|
3357
|
-
const $ =
|
|
3358
|
-
|
|
3359
|
-
}
|
|
3360
|
-
const y = new Uint8Array(
|
|
3361
|
-
let g = 0,
|
|
3362
|
-
for (
|
|
3363
|
-
for (
|
|
3364
|
-
|
|
3365
|
-
for (
|
|
3366
|
-
for (
|
|
3367
|
-
y[g++] =
|
|
3407
|
+
for (let E = 0; E < o; E++) {
|
|
3408
|
+
const $ = E < a ? d : h;
|
|
3409
|
+
v[E] = x.slice(m, m + $), C[E] = u.encode(v[E]), m += $, w = Math.max(w, $);
|
|
3410
|
+
}
|
|
3411
|
+
const y = new Uint8Array(i);
|
|
3412
|
+
let g = 0, k, _;
|
|
3413
|
+
for (k = 0; k < w; k++)
|
|
3414
|
+
for (_ = 0; _ < o; _++)
|
|
3415
|
+
k < v[_].length && (y[g++] = v[_][k]);
|
|
3416
|
+
for (k = 0; k < p; k++)
|
|
3417
|
+
for (_ = 0; _ < o; _++)
|
|
3418
|
+
y[g++] = C[_][k];
|
|
3368
3419
|
return y;
|
|
3369
3420
|
}
|
|
3370
|
-
function
|
|
3371
|
-
let
|
|
3421
|
+
function pi(e, t, r, i) {
|
|
3422
|
+
let n;
|
|
3372
3423
|
if (Array.isArray(e))
|
|
3373
|
-
|
|
3424
|
+
n = $t.fromArray(e);
|
|
3374
3425
|
else if (typeof e == "string") {
|
|
3375
3426
|
let c = t;
|
|
3376
3427
|
if (!c) {
|
|
3377
3428
|
const d = $t.rawSplit(e);
|
|
3378
3429
|
c = xt.getBestVersionForData(d, r);
|
|
3379
3430
|
}
|
|
3380
|
-
|
|
3431
|
+
n = $t.fromString(e, c || 40);
|
|
3381
3432
|
} else
|
|
3382
3433
|
throw new Error("Invalid data");
|
|
3383
|
-
const
|
|
3384
|
-
if (!
|
|
3434
|
+
const s = xt.getBestVersionForData(n, r);
|
|
3435
|
+
if (!s)
|
|
3385
3436
|
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
3386
3437
|
if (!t)
|
|
3387
|
-
t =
|
|
3388
|
-
else if (t <
|
|
3438
|
+
t = s;
|
|
3439
|
+
else if (t < s)
|
|
3389
3440
|
throw new Error(
|
|
3390
3441
|
`
|
|
3391
3442
|
The chosen QR Code version cannot contain this amount of data.
|
|
3392
|
-
Minimum version required to store current data is: ` +
|
|
3443
|
+
Minimum version required to store current data is: ` + s + `.
|
|
3393
3444
|
`
|
|
3394
3445
|
);
|
|
3395
|
-
const
|
|
3396
|
-
return
|
|
3446
|
+
const o = ui(t, r, n), l = Ct.getSymbolSize(t), a = new ti(l);
|
|
3447
|
+
return oi(a, t), ai(a), li(a, t), Rt(a, r, 0), t >= 7 && ci(a, t), di(a, o), isNaN(i) && (i = Ft.getBestMask(
|
|
3397
3448
|
a,
|
|
3398
3449
|
Rt.bind(null, a, r)
|
|
3399
|
-
)), Ft.applyMask(
|
|
3450
|
+
)), Ft.applyMask(i, a), Rt(a, r, i), {
|
|
3400
3451
|
modules: a,
|
|
3401
3452
|
version: t,
|
|
3402
3453
|
errorCorrectionLevel: r,
|
|
3403
|
-
maskPattern:
|
|
3404
|
-
segments:
|
|
3454
|
+
maskPattern: i,
|
|
3455
|
+
segments: n
|
|
3405
3456
|
};
|
|
3406
3457
|
}
|
|
3407
3458
|
we.create = function(t, r) {
|
|
3408
3459
|
if (typeof t > "u" || t === "")
|
|
3409
3460
|
throw new Error("No input text");
|
|
3410
|
-
let
|
|
3411
|
-
return typeof r < "u" && (
|
|
3461
|
+
let i = Tt.M, n, s;
|
|
3462
|
+
return typeof r < "u" && (i = Tt.from(r.errorCorrectionLevel, Tt.M), n = xt.from(r.version), s = Ft.from(r.maskPattern), r.toSJISFunc && Ct.setToSJISFunction(r.toSJISFunc)), pi(t, n, i, s);
|
|
3412
3463
|
};
|
|
3413
|
-
var Te = {},
|
|
3464
|
+
var Te = {}, Qt = {};
|
|
3414
3465
|
(function(e) {
|
|
3415
3466
|
function t(r) {
|
|
3416
3467
|
if (typeof r == "number" && (r = r.toString()), typeof r != "string")
|
|
3417
3468
|
throw new Error("Color should be defined as hex string");
|
|
3418
|
-
let
|
|
3419
|
-
if (
|
|
3469
|
+
let i = r.slice().replace("#", "").split("");
|
|
3470
|
+
if (i.length < 3 || i.length === 5 || i.length > 8)
|
|
3420
3471
|
throw new Error("Invalid hex color: " + r);
|
|
3421
|
-
(
|
|
3422
|
-
return [
|
|
3423
|
-
}))),
|
|
3424
|
-
const
|
|
3472
|
+
(i.length === 3 || i.length === 4) && (i = Array.prototype.concat.apply([], i.map(function(s) {
|
|
3473
|
+
return [s, s];
|
|
3474
|
+
}))), i.length === 6 && i.push("F", "F");
|
|
3475
|
+
const n = parseInt(i.join(""), 16);
|
|
3425
3476
|
return {
|
|
3426
|
-
r:
|
|
3427
|
-
g:
|
|
3428
|
-
b:
|
|
3429
|
-
a:
|
|
3430
|
-
hex: "#" +
|
|
3477
|
+
r: n >> 24 & 255,
|
|
3478
|
+
g: n >> 16 & 255,
|
|
3479
|
+
b: n >> 8 & 255,
|
|
3480
|
+
a: n & 255,
|
|
3481
|
+
hex: "#" + i.slice(0, 6).join("")
|
|
3431
3482
|
};
|
|
3432
3483
|
}
|
|
3433
|
-
e.getOptions = function(
|
|
3434
|
-
|
|
3435
|
-
const
|
|
3484
|
+
e.getOptions = function(i) {
|
|
3485
|
+
i || (i = {}), i.color || (i.color = {});
|
|
3486
|
+
const n = typeof i.margin > "u" || i.margin === null || i.margin < 0 ? 4 : i.margin, s = i.width && i.width >= 21 ? i.width : void 0, o = i.scale || 4;
|
|
3436
3487
|
return {
|
|
3437
|
-
width:
|
|
3438
|
-
scale:
|
|
3439
|
-
margin:
|
|
3488
|
+
width: s,
|
|
3489
|
+
scale: s ? 4 : o,
|
|
3490
|
+
margin: n,
|
|
3440
3491
|
color: {
|
|
3441
|
-
dark: t(
|
|
3442
|
-
light: t(
|
|
3492
|
+
dark: t(i.color.dark || "#000000ff"),
|
|
3493
|
+
light: t(i.color.light || "#ffffffff")
|
|
3443
3494
|
},
|
|
3444
|
-
type:
|
|
3445
|
-
rendererOpts:
|
|
3495
|
+
type: i.type,
|
|
3496
|
+
rendererOpts: i.rendererOpts || {}
|
|
3446
3497
|
};
|
|
3447
|
-
}, e.getScale = function(
|
|
3448
|
-
return
|
|
3449
|
-
}, e.getImageWidth = function(
|
|
3450
|
-
const
|
|
3451
|
-
return Math.floor((
|
|
3452
|
-
}, e.qrToImageData = function(
|
|
3453
|
-
const
|
|
3498
|
+
}, e.getScale = function(i, n) {
|
|
3499
|
+
return n.width && n.width >= i + n.margin * 2 ? n.width / (i + n.margin * 2) : n.scale;
|
|
3500
|
+
}, e.getImageWidth = function(i, n) {
|
|
3501
|
+
const s = e.getScale(i, n);
|
|
3502
|
+
return Math.floor((i + n.margin * 2) * s);
|
|
3503
|
+
}, e.qrToImageData = function(i, n, s) {
|
|
3504
|
+
const o = n.modules.size, l = n.modules.data, a = e.getScale(o, s), c = Math.floor((o + s.margin * 2) * a), d = s.margin * a, h = [s.color.light, s.color.dark];
|
|
3454
3505
|
for (let p = 0; p < c; p++)
|
|
3455
3506
|
for (let u = 0; u < c; u++) {
|
|
3456
|
-
let m = (p * c + u) * 4,
|
|
3507
|
+
let m = (p * c + u) * 4, v = s.color.light;
|
|
3457
3508
|
if (p >= d && u >= d && p < c - d && u < c - d) {
|
|
3458
|
-
const
|
|
3459
|
-
|
|
3509
|
+
const C = Math.floor((p - d) / a), w = Math.floor((u - d) / a);
|
|
3510
|
+
v = h[l[C * o + w] ? 1 : 0];
|
|
3460
3511
|
}
|
|
3461
|
-
|
|
3512
|
+
i[m++] = v.r, i[m++] = v.g, i[m++] = v.b, i[m] = v.a;
|
|
3462
3513
|
}
|
|
3463
3514
|
};
|
|
3464
|
-
})(
|
|
3515
|
+
})(Qt);
|
|
3465
3516
|
(function(e) {
|
|
3466
|
-
const t =
|
|
3467
|
-
function r(
|
|
3468
|
-
|
|
3517
|
+
const t = Qt;
|
|
3518
|
+
function r(n, s, o) {
|
|
3519
|
+
n.clearRect(0, 0, s.width, s.height), s.style || (s.style = {}), s.height = o, s.width = o, s.style.height = o + "px", s.style.width = o + "px";
|
|
3469
3520
|
}
|
|
3470
|
-
function
|
|
3521
|
+
function i() {
|
|
3471
3522
|
try {
|
|
3472
3523
|
return document.createElement("canvas");
|
|
3473
3524
|
} catch {
|
|
3474
3525
|
throw new Error("You need to specify a canvas element");
|
|
3475
3526
|
}
|
|
3476
3527
|
}
|
|
3477
|
-
e.render = function(
|
|
3478
|
-
let a = l, c =
|
|
3479
|
-
typeof a > "u" && (!
|
|
3480
|
-
const d = t.getImageWidth(
|
|
3481
|
-
return t.qrToImageData(p.data,
|
|
3482
|
-
}, e.renderToDataURL = function(
|
|
3528
|
+
e.render = function(s, o, l) {
|
|
3529
|
+
let a = l, c = o;
|
|
3530
|
+
typeof a > "u" && (!o || !o.getContext) && (a = o, o = void 0), o || (c = i()), a = t.getOptions(a);
|
|
3531
|
+
const d = t.getImageWidth(s.modules.size, a), h = c.getContext("2d"), p = h.createImageData(d, d);
|
|
3532
|
+
return t.qrToImageData(p.data, s, a), r(h, c, d), h.putImageData(p, 0, 0), c;
|
|
3533
|
+
}, e.renderToDataURL = function(s, o, l) {
|
|
3483
3534
|
let a = l;
|
|
3484
|
-
typeof a > "u" && (!
|
|
3485
|
-
const c = e.render(
|
|
3535
|
+
typeof a > "u" && (!o || !o.getContext) && (a = o, o = void 0), a || (a = {});
|
|
3536
|
+
const c = e.render(s, o, a), d = a.type || "image/png", h = a.rendererOpts || {};
|
|
3486
3537
|
return c.toDataURL(d, h.quality);
|
|
3487
3538
|
};
|
|
3488
3539
|
})(Te);
|
|
3489
3540
|
var $e = {};
|
|
3490
|
-
const
|
|
3541
|
+
const mi = Qt;
|
|
3491
3542
|
function de(e, t) {
|
|
3492
|
-
const r = e.a / 255,
|
|
3493
|
-
return r < 1 ?
|
|
3543
|
+
const r = e.a / 255, i = t + '="' + e.hex + '"';
|
|
3544
|
+
return r < 1 ? i + " " + t + '-opacity="' + r.toFixed(2).slice(1) + '"' : i;
|
|
3494
3545
|
}
|
|
3495
|
-
function
|
|
3496
|
-
let
|
|
3497
|
-
return typeof r < "u" && (
|
|
3546
|
+
function Lt(e, t, r) {
|
|
3547
|
+
let i = e + t;
|
|
3548
|
+
return typeof r < "u" && (i += " " + r), i;
|
|
3498
3549
|
}
|
|
3499
|
-
function
|
|
3500
|
-
let
|
|
3550
|
+
function fi(e, t, r) {
|
|
3551
|
+
let i = "", n = 0, s = !1, o = 0;
|
|
3501
3552
|
for (let l = 0; l < e.length; l++) {
|
|
3502
3553
|
const a = Math.floor(l % t), c = Math.floor(l / t);
|
|
3503
|
-
!a && !
|
|
3554
|
+
!a && !s && (s = !0), e[l] ? (o++, l > 0 && a > 0 && e[l - 1] || (i += s ? Lt("M", a + r, 0.5 + c + r) : Lt("m", n, 0), n = 0, s = !1), a + 1 < t && e[l + 1] || (i += Lt("h", o), o = 0)) : n++;
|
|
3504
3555
|
}
|
|
3505
|
-
return
|
|
3556
|
+
return i;
|
|
3506
3557
|
}
|
|
3507
|
-
$e.render = function(t, r,
|
|
3508
|
-
const
|
|
3558
|
+
$e.render = function(t, r, i) {
|
|
3559
|
+
const n = mi.getOptions(r), s = t.modules.size, o = t.modules.data, l = s + n.margin * 2, a = n.color.light.a ? "<path " + de(n.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", c = "<path " + de(n.color.dark, "stroke") + ' d="' + fi(o, s, n.margin) + '"/>', d = 'viewBox="0 0 ' + l + " " + l + '"', p = '<svg xmlns="http://www.w3.org/2000/svg" ' + (n.width ? 'width="' + n.width + '" height="' + n.width + '" ' : "") + d + ' shape-rendering="crispEdges">' + a + c + `</svg>
|
|
3509
3560
|
`;
|
|
3510
|
-
return typeof
|
|
3561
|
+
return typeof i == "function" && i(null, p), p;
|
|
3511
3562
|
};
|
|
3512
|
-
const
|
|
3513
|
-
function Wt(e, t, r,
|
|
3514
|
-
const
|
|
3515
|
-
if (!l && !
|
|
3563
|
+
const gi = Dr, zt = we, Re = Te, yi = $e;
|
|
3564
|
+
function Wt(e, t, r, i, n) {
|
|
3565
|
+
const s = [].slice.call(arguments, 1), o = s.length, l = typeof s[o - 1] == "function";
|
|
3566
|
+
if (!l && !gi())
|
|
3516
3567
|
throw new Error("Callback required as last argument");
|
|
3517
3568
|
if (l) {
|
|
3518
|
-
if (
|
|
3569
|
+
if (o < 2)
|
|
3519
3570
|
throw new Error("Too few arguments provided");
|
|
3520
|
-
|
|
3571
|
+
o === 2 ? (n = r, r = t, t = i = void 0) : o === 3 && (t.getContext && typeof n > "u" ? (n = i, i = void 0) : (n = i, i = r, r = t, t = void 0));
|
|
3521
3572
|
} else {
|
|
3522
|
-
if (
|
|
3573
|
+
if (o < 1)
|
|
3523
3574
|
throw new Error("Too few arguments provided");
|
|
3524
|
-
return
|
|
3575
|
+
return o === 1 ? (r = t, t = i = void 0) : o === 2 && !t.getContext && (i = r, r = t, t = void 0), new Promise(function(a, c) {
|
|
3525
3576
|
try {
|
|
3526
|
-
const d = zt.create(r,
|
|
3527
|
-
a(e(d, t,
|
|
3577
|
+
const d = zt.create(r, i);
|
|
3578
|
+
a(e(d, t, i));
|
|
3528
3579
|
} catch (d) {
|
|
3529
3580
|
c(d);
|
|
3530
3581
|
}
|
|
3531
3582
|
});
|
|
3532
3583
|
}
|
|
3533
3584
|
try {
|
|
3534
|
-
const a = zt.create(r,
|
|
3535
|
-
|
|
3585
|
+
const a = zt.create(r, i);
|
|
3586
|
+
n(null, e(a, t, i));
|
|
3536
3587
|
} catch (a) {
|
|
3537
|
-
|
|
3588
|
+
n(a);
|
|
3538
3589
|
}
|
|
3539
3590
|
}
|
|
3540
3591
|
pt.create = zt.create;
|
|
3541
3592
|
pt.toCanvas = Wt.bind(null, Re.render);
|
|
3542
3593
|
pt.toDataURL = Wt.bind(null, Re.renderToDataURL);
|
|
3543
3594
|
pt.toString = Wt.bind(null, function(e, t, r) {
|
|
3544
|
-
return
|
|
3595
|
+
return yi.render(e, r);
|
|
3545
3596
|
});
|
|
3546
|
-
var
|
|
3547
|
-
for (var
|
|
3548
|
-
(
|
|
3549
|
-
return
|
|
3597
|
+
var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, P = (e, t, r, i) => {
|
|
3598
|
+
for (var n = i > 1 ? void 0 : i ? vi(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
3599
|
+
(o = e[s]) && (n = (i ? o(t, r, n) : o(n)) || n);
|
|
3600
|
+
return i && n && bi(t, r, n), n;
|
|
3550
3601
|
};
|
|
3551
|
-
let S = class extends
|
|
3602
|
+
let S = class extends ot {
|
|
3552
3603
|
constructor() {
|
|
3553
3604
|
super(...arguments), this.currentState = { status: "idle" }, this.selectedMethod = null, this.cardFormData = {
|
|
3554
3605
|
cardNumber: "",
|
|
@@ -3618,8 +3669,8 @@ let S = class extends st {
|
|
|
3618
3669
|
*/
|
|
3619
3670
|
applyCssVariables(e) {
|
|
3620
3671
|
for (const [t, r] of Object.entries(this.cssVariableMap)) {
|
|
3621
|
-
const
|
|
3622
|
-
|
|
3672
|
+
const i = e[t];
|
|
3673
|
+
i != null ? this.style.setProperty(r, i) : this.style.removeProperty(r);
|
|
3623
3674
|
}
|
|
3624
3675
|
}
|
|
3625
3676
|
/**
|
|
@@ -3666,19 +3717,19 @@ let S = class extends st {
|
|
|
3666
3717
|
// --- Cleave.js Setup ---
|
|
3667
3718
|
setupCleave() {
|
|
3668
3719
|
setTimeout(() => {
|
|
3669
|
-
var r,
|
|
3670
|
-
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("#cardNumber"), t = (
|
|
3720
|
+
var r, i;
|
|
3721
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("#cardNumber"), t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("#expiry");
|
|
3671
3722
|
e && !this.cardNumberCleave && (this.cardNumberCleave = new ae(e, {
|
|
3672
3723
|
creditCard: !0,
|
|
3673
3724
|
delimiter: " ",
|
|
3674
|
-
onCreditCardTypeChanged: (
|
|
3675
|
-
const
|
|
3725
|
+
onCreditCardTypeChanged: (n) => {
|
|
3726
|
+
const s = {
|
|
3676
3727
|
visa: "visa",
|
|
3677
3728
|
mastercard: "mastercard",
|
|
3678
3729
|
amex: "amex",
|
|
3679
3730
|
discover: "discover"
|
|
3680
3731
|
};
|
|
3681
|
-
this.cardBrand =
|
|
3732
|
+
this.cardBrand = s[n] || "unknown";
|
|
3682
3733
|
}
|
|
3683
3734
|
})), t && !this.expiryCleave && (this.expiryCleave = new ae(t, {
|
|
3684
3735
|
date: !0,
|
|
@@ -3741,8 +3792,8 @@ let S = class extends st {
|
|
|
3741
3792
|
disabledReason: "ShopeePay is only available for MYR currency"
|
|
3742
3793
|
};
|
|
3743
3794
|
if (t.id === f.ATOM) {
|
|
3744
|
-
const
|
|
3745
|
-
if (
|
|
3795
|
+
const i = this.getTransactionData().currency;
|
|
3796
|
+
if (i !== "SGD" && i !== "MYR")
|
|
3746
3797
|
return {
|
|
3747
3798
|
id: t.id,
|
|
3748
3799
|
enabled: !1,
|
|
@@ -3757,6 +3808,18 @@ let S = class extends st {
|
|
|
3757
3808
|
id: t.id,
|
|
3758
3809
|
enabled: !1,
|
|
3759
3810
|
disabledReason: "Touch 'n Go is only available for MYR currency"
|
|
3811
|
+
} : t.id === f.ALIPAYCN && this.getTransactionData().currency !== "CNY" ? {
|
|
3812
|
+
id: t.id,
|
|
3813
|
+
enabled: !1,
|
|
3814
|
+
disabledReason: "Alipay is only available for CNY currency"
|
|
3815
|
+
} : t.id === f.ALIPAYHK && this.getTransactionData().currency !== "HKD" ? {
|
|
3816
|
+
id: t.id,
|
|
3817
|
+
enabled: !1,
|
|
3818
|
+
disabledReason: "AlipayHK is only available for HKD currency"
|
|
3819
|
+
} : t.id === f.GCASH && this.getTransactionData().currency !== "PHP" ? {
|
|
3820
|
+
id: t.id,
|
|
3821
|
+
enabled: !1,
|
|
3822
|
+
disabledReason: "GCash is only available for PHP currency"
|
|
3760
3823
|
} : {
|
|
3761
3824
|
id: t.id,
|
|
3762
3825
|
enabled: !0
|
|
@@ -3817,8 +3880,8 @@ let S = class extends st {
|
|
|
3817
3880
|
}), this.sdk.on("initialized", (t) => {
|
|
3818
3881
|
var r;
|
|
3819
3882
|
if (this.paymentData = t.payload.paymentData, this.isInitializing = !1, (r = t.payload.paymentData) != null && r.sessionId && !document.getElementById("airwallex-fraud-api")) {
|
|
3820
|
-
const
|
|
3821
|
-
|
|
3883
|
+
const n = document.createElement("script");
|
|
3884
|
+
n.src = "https://static.airwallex.com/webapp/fraud/device-fingerprint/index.js", n.async = !0, n.setAttribute("data-order-session-id", t.payload.paymentData.sessionId), n.setAttribute("id", "airwallex-fraud-api"), document.body.appendChild(n);
|
|
3822
3885
|
}
|
|
3823
3886
|
}), this.sdk.on("payment_requires_action", (t) => {
|
|
3824
3887
|
this.nextActionUrl = t.payload.actionUrl, this.show3DSModal = !0, this.paymentLocked = !0, this.leaveEventsCounter = 0;
|
|
@@ -3830,10 +3893,10 @@ let S = class extends st {
|
|
|
3830
3893
|
async (t) => {
|
|
3831
3894
|
if (this.qrCode = t.payload.qrCode, !this.qrCode)
|
|
3832
3895
|
return;
|
|
3833
|
-
const r = this.qrCode.startsWith("http://") || this.qrCode.startsWith("https://"),
|
|
3834
|
-
if (!r && !
|
|
3896
|
+
const r = this.qrCode.startsWith("http://") || this.qrCode.startsWith("https://"), i = this.qrCode.startsWith("data:image");
|
|
3897
|
+
if (!r && !i)
|
|
3835
3898
|
try {
|
|
3836
|
-
const
|
|
3899
|
+
const n = await pt.toDataURL(this.qrCode, {
|
|
3837
3900
|
width: 300,
|
|
3838
3901
|
margin: 2,
|
|
3839
3902
|
color: {
|
|
@@ -3841,7 +3904,7 @@ let S = class extends st {
|
|
|
3841
3904
|
light: "#FFFFFF"
|
|
3842
3905
|
}
|
|
3843
3906
|
});
|
|
3844
|
-
this.qrCodeDataUrl =
|
|
3907
|
+
this.qrCodeDataUrl = n;
|
|
3845
3908
|
} catch {
|
|
3846
3909
|
this.qrCodeDataUrl = null;
|
|
3847
3910
|
}
|
|
@@ -3901,6 +3964,24 @@ let S = class extends st {
|
|
|
3901
3964
|
const { redirectUrl: r } = t.payload;
|
|
3902
3965
|
r && (console.log("[WebComponent] Redirecting to TnG URL:", r), window.location.href = r);
|
|
3903
3966
|
}
|
|
3967
|
+
), this.sdk.on(
|
|
3968
|
+
"alipaycn_redirect",
|
|
3969
|
+
(t) => {
|
|
3970
|
+
const { redirectUrl: r } = t.payload;
|
|
3971
|
+
r && (window.location.href = r);
|
|
3972
|
+
}
|
|
3973
|
+
), this.sdk.on(
|
|
3974
|
+
"alipayhk_redirect",
|
|
3975
|
+
(t) => {
|
|
3976
|
+
const { redirectUrl: r } = t.payload;
|
|
3977
|
+
r && (window.location.href = r);
|
|
3978
|
+
}
|
|
3979
|
+
), this.sdk.on(
|
|
3980
|
+
"gcash_redirect",
|
|
3981
|
+
(t) => {
|
|
3982
|
+
const { redirectUrl: r } = t.payload;
|
|
3983
|
+
r && (window.location.href = r);
|
|
3984
|
+
}
|
|
3904
3985
|
), this.sdk.initialize({
|
|
3905
3986
|
amount: this.amount,
|
|
3906
3987
|
currency: this.currency,
|
|
@@ -3927,12 +4008,12 @@ let S = class extends st {
|
|
|
3927
4008
|
const t = e.replace(/\s/g, "");
|
|
3928
4009
|
if (!/^\d+$/.test(t))
|
|
3929
4010
|
return !1;
|
|
3930
|
-
let r = 0,
|
|
3931
|
-
for (let
|
|
3932
|
-
const
|
|
3933
|
-
if (!
|
|
3934
|
-
let
|
|
3935
|
-
|
|
4011
|
+
let r = 0, i = !1;
|
|
4012
|
+
for (let n = t.length - 1; n >= 0; n--) {
|
|
4013
|
+
const s = t.charAt(n);
|
|
4014
|
+
if (!s) continue;
|
|
4015
|
+
let o = parseInt(s, 10);
|
|
4016
|
+
i && (o *= 2, o > 9 && (o -= 9)), r += o, i = !i;
|
|
3936
4017
|
}
|
|
3937
4018
|
return r % 10 === 0;
|
|
3938
4019
|
}
|
|
@@ -3941,16 +4022,16 @@ let S = class extends st {
|
|
|
3941
4022
|
const t = e.trim();
|
|
3942
4023
|
if (!/^\d{1,2}\/\d{2}$/.test(t))
|
|
3943
4024
|
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3944
|
-
const
|
|
3945
|
-
if (!
|
|
4025
|
+
const n = t.split("/"), s = n[0], o = n[1];
|
|
4026
|
+
if (!s || !o)
|
|
3946
4027
|
return { valid: !1, error: "Invalid format (MM/YY)" };
|
|
3947
|
-
const l = parseInt(
|
|
4028
|
+
const l = parseInt(s, 10);
|
|
3948
4029
|
if (l < 1 || l > 12)
|
|
3949
4030
|
return { valid: !1, error: "Invalid month (01-12)" };
|
|
3950
4031
|
const a = /* @__PURE__ */ new Date(), c = a.getFullYear(), d = a.getMonth() + 1;
|
|
3951
4032
|
let h;
|
|
3952
|
-
if (
|
|
3953
|
-
const p = parseInt(
|
|
4033
|
+
if (o.length === 2) {
|
|
4034
|
+
const p = parseInt(o, 10), u = c % 100, m = Math.floor(c / 100) * 100;
|
|
3954
4035
|
p < u && u - p > 80 ? h = m + 100 + p : h = m + p;
|
|
3955
4036
|
} else
|
|
3956
4037
|
return { valid: !1, error: "Invalid year format" };
|
|
@@ -3970,11 +4051,11 @@ let S = class extends st {
|
|
|
3970
4051
|
if (!this.sdk || this.currentState.status !== "ready" || !this.validateCardForm())
|
|
3971
4052
|
return;
|
|
3972
4053
|
this.paymentLocked = !0;
|
|
3973
|
-
const e = this.cardFormData.expiry.split("/"), t = (e[0] || "").trim(),
|
|
4054
|
+
const e = this.cardFormData.expiry.split("/"), t = (e[0] || "").trim(), i = `20${(e[1] || "").trim().substring(0, 2)}`;
|
|
3974
4055
|
this.sdk.submitPayment(f.CARD, {
|
|
3975
4056
|
cardNumber: this.cardFormData.cardNumber.replace(/\s/g, ""),
|
|
3976
4057
|
expiryMonth: t,
|
|
3977
|
-
expiryYear:
|
|
4058
|
+
expiryYear: i,
|
|
3978
4059
|
cvv: this.cardFormData.cvv,
|
|
3979
4060
|
firstName: this.firstName,
|
|
3980
4061
|
lastName: this.lastName,
|
|
@@ -4054,6 +4135,30 @@ let S = class extends st {
|
|
|
4054
4135
|
phoneNumber: this.phoneNumber
|
|
4055
4136
|
}));
|
|
4056
4137
|
}
|
|
4138
|
+
handleAlipayCNPayment() {
|
|
4139
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(f.ALIPAYCN, {
|
|
4140
|
+
firstName: this.firstName,
|
|
4141
|
+
lastName: this.lastName,
|
|
4142
|
+
email: this.email,
|
|
4143
|
+
phoneNumber: this.phoneNumber
|
|
4144
|
+
}));
|
|
4145
|
+
}
|
|
4146
|
+
handleAlipayHKPayment() {
|
|
4147
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(f.ALIPAYHK, {
|
|
4148
|
+
firstName: this.firstName,
|
|
4149
|
+
lastName: this.lastName,
|
|
4150
|
+
email: this.email,
|
|
4151
|
+
phoneNumber: this.phoneNumber
|
|
4152
|
+
}));
|
|
4153
|
+
}
|
|
4154
|
+
handleGCashPayment() {
|
|
4155
|
+
!this.sdk || this.currentState.status !== "ready" || (this.paymentLocked = !0, this.sdk.submitPayment(f.GCASH, {
|
|
4156
|
+
firstName: this.firstName,
|
|
4157
|
+
lastName: this.lastName,
|
|
4158
|
+
email: this.email,
|
|
4159
|
+
phoneNumber: this.phoneNumber
|
|
4160
|
+
}));
|
|
4161
|
+
}
|
|
4057
4162
|
// --- Render Methods ---
|
|
4058
4163
|
/**
|
|
4059
4164
|
* Get the formatted pay amount for buttons (net amount including fees)
|
|
@@ -4077,21 +4182,21 @@ let S = class extends st {
|
|
|
4077
4182
|
},
|
|
4078
4183
|
netAmount: this.amount
|
|
4079
4184
|
};
|
|
4080
|
-
const t = (a = e.fees) == null ? void 0 : a.find((c) => c.owner === "merchant"), r = () => t ? t.type === "percentage" ? `${t.value}%` : `${t.value} ${t.currency}` : "",
|
|
4185
|
+
const t = (a = e.fees) == null ? void 0 : a.find((c) => c.owner === "merchant"), r = () => t ? t.type === "percentage" ? `${t.value}%` : `${t.value} ${t.currency}` : "", i = typeof e.totalFee == "number" ? e.totalFee : Number(e.totalFee) || 0, n = typeof e.totalSystemFee == "number" ? e.totalSystemFee : Number(e.totalSystemFee) || 0, s = e.initialAmount != null ? typeof e.initialAmount == "number" ? e.initialAmount : Number(e.initialAmount) || 0 : this.amount, o = e.customerAmount != null ? typeof e.customerAmount == "number" ? e.customerAmount : Number(e.customerAmount) || 0 : s, l = i - n;
|
|
4081
4186
|
return {
|
|
4082
4187
|
currency: e.currency || this.currency,
|
|
4083
|
-
charge:
|
|
4084
|
-
fees:
|
|
4188
|
+
charge: s,
|
|
4189
|
+
fees: i,
|
|
4085
4190
|
feeBreakdown: {
|
|
4086
4191
|
transactionFee: l,
|
|
4087
4192
|
merchantFee: l,
|
|
4088
4193
|
merchantFeeLabel: r() || "0%"
|
|
4089
4194
|
},
|
|
4090
|
-
netAmount:
|
|
4195
|
+
netAmount: o
|
|
4091
4196
|
};
|
|
4092
4197
|
}
|
|
4093
4198
|
renderTransactionDetailsSkeleton() {
|
|
4094
|
-
return
|
|
4199
|
+
return b`
|
|
4095
4200
|
<div class="skeleton-transaction">
|
|
4096
4201
|
<div class="skeleton skeleton-title"></div>
|
|
4097
4202
|
<div class="skeleton-row">
|
|
@@ -4115,7 +4220,7 @@ let S = class extends st {
|
|
|
4115
4220
|
`;
|
|
4116
4221
|
}
|
|
4117
4222
|
renderPaymentMethodsSkeleton() {
|
|
4118
|
-
return
|
|
4223
|
+
return b`
|
|
4119
4224
|
<div>
|
|
4120
4225
|
<div class="skeleton-method">
|
|
4121
4226
|
<div class="skeleton skeleton-radio"></div>
|
|
@@ -4135,7 +4240,7 @@ let S = class extends st {
|
|
|
4135
4240
|
this.width ? `--one-payment-width: ${this.width}` : "",
|
|
4136
4241
|
this.maxWidth ? `--one-payment-max-width: ${this.maxWidth}` : ""
|
|
4137
4242
|
].filter(Boolean).join("; ");
|
|
4138
|
-
return
|
|
4243
|
+
return b`
|
|
4139
4244
|
<div class="payment-element" style="${e}">
|
|
4140
4245
|
${this.renderTransactionDetailsSkeleton()}
|
|
4141
4246
|
<div class="header">Select a payment method</div>
|
|
@@ -4145,7 +4250,7 @@ let S = class extends st {
|
|
|
4145
4250
|
}
|
|
4146
4251
|
renderTransactionDetails() {
|
|
4147
4252
|
const e = this.getTransactionData(), t = (r) => r.toFixed(2);
|
|
4148
|
-
return
|
|
4253
|
+
return b`
|
|
4149
4254
|
<div class="transaction-details">
|
|
4150
4255
|
<h2 class="transaction-title">Transaction details</h2>
|
|
4151
4256
|
|
|
@@ -4180,7 +4285,7 @@ let S = class extends st {
|
|
|
4180
4285
|
margin-top: ${this.feesExpanded ? "0.625rem" : "0"};
|
|
4181
4286
|
`}
|
|
4182
4287
|
>
|
|
4183
|
-
${e.feeBreakdown ?
|
|
4288
|
+
${e.feeBreakdown ? b`
|
|
4184
4289
|
<div class="fee-breakdown-inner">
|
|
4185
4290
|
<div class="breakdown-row">
|
|
4186
4291
|
<span class="breakdown-label">Transaction fee:</span>
|
|
@@ -4211,7 +4316,7 @@ let S = class extends st {
|
|
|
4211
4316
|
renderCardForm() {
|
|
4212
4317
|
setTimeout(() => this.setupCleave(), 0);
|
|
4213
4318
|
const e = this.cardBrand === "amex" ? 4 : 3, t = this.cardBrand === "amex" ? "1234" : "123";
|
|
4214
|
-
return
|
|
4319
|
+
return b`
|
|
4215
4320
|
<div class="card-form">
|
|
4216
4321
|
<h4 class="form-title">Card Information</h4>
|
|
4217
4322
|
<div class="form-fields">
|
|
@@ -4226,7 +4331,7 @@ let S = class extends st {
|
|
|
4226
4331
|
.value=${this.cardFormData.cardNumber}
|
|
4227
4332
|
@input=${(r) => this.handleInputChange("cardNumber", r.target.value)}
|
|
4228
4333
|
/>
|
|
4229
|
-
${this.formErrors.cardNumber ?
|
|
4334
|
+
${this.formErrors.cardNumber ? b`<div class="error-message">${this.formErrors.cardNumber}</div>` : ""}
|
|
4230
4335
|
</div>
|
|
4231
4336
|
|
|
4232
4337
|
<!-- Single Expiry Field -->
|
|
@@ -4239,13 +4344,13 @@ let S = class extends st {
|
|
|
4239
4344
|
placeholder="MM/YY"
|
|
4240
4345
|
.value=${this.cardFormData.expiry}
|
|
4241
4346
|
@input=${(r) => {
|
|
4242
|
-
const
|
|
4347
|
+
const i = r.target;
|
|
4243
4348
|
setTimeout(() => {
|
|
4244
|
-
this.handleInputChange("expiry",
|
|
4349
|
+
this.handleInputChange("expiry", i.value);
|
|
4245
4350
|
}, 0);
|
|
4246
4351
|
}}
|
|
4247
4352
|
/>
|
|
4248
|
-
${this.formErrors.expiry ?
|
|
4353
|
+
${this.formErrors.expiry ? b`<div class="error-message">${this.formErrors.expiry}</div>` : ""}
|
|
4249
4354
|
</div>
|
|
4250
4355
|
|
|
4251
4356
|
<!-- CVV -->
|
|
@@ -4258,11 +4363,11 @@ let S = class extends st {
|
|
|
4258
4363
|
maxlength="${e}"
|
|
4259
4364
|
.value=${this.cardFormData.cvv}
|
|
4260
4365
|
@input=${(r) => {
|
|
4261
|
-
const
|
|
4262
|
-
r.target.value =
|
|
4366
|
+
const i = r.target.value.replace(/\D/g, "");
|
|
4367
|
+
r.target.value = i, this.handleInputChange("cvv", i);
|
|
4263
4368
|
}}
|
|
4264
4369
|
/>
|
|
4265
|
-
${this.formErrors.cvv ?
|
|
4370
|
+
${this.formErrors.cvv ? b`<div class="error-message">${this.formErrors.cvv}</div>` : ""}
|
|
4266
4371
|
</div>
|
|
4267
4372
|
|
|
4268
4373
|
<!-- Cardholder Name -->
|
|
@@ -4274,11 +4379,11 @@ let S = class extends st {
|
|
|
4274
4379
|
placeholder="JOHN DOE"
|
|
4275
4380
|
.value=${this.cardFormData.cardholderName}
|
|
4276
4381
|
@input=${(r) => {
|
|
4277
|
-
const
|
|
4278
|
-
r.target.value =
|
|
4382
|
+
const i = r.target.value.replace(/[^A-Za-z\s]/g, "").toUpperCase();
|
|
4383
|
+
r.target.value = i, this.handleInputChange("cardholderName", i);
|
|
4279
4384
|
}}
|
|
4280
4385
|
/>
|
|
4281
|
-
${this.formErrors.cardholderName ?
|
|
4386
|
+
${this.formErrors.cardholderName ? b`<div class="error-message">${this.formErrors.cardholderName}</div>` : ""}
|
|
4282
4387
|
</div>
|
|
4283
4388
|
</div>
|
|
4284
4389
|
|
|
@@ -4295,7 +4400,7 @@ let S = class extends st {
|
|
|
4295
4400
|
`;
|
|
4296
4401
|
}
|
|
4297
4402
|
renderPayNowContent() {
|
|
4298
|
-
return this.showQRModal && this.qrCodeDataUrl ?
|
|
4403
|
+
return this.showQRModal && this.qrCodeDataUrl ? b`
|
|
4299
4404
|
<div class="paynow-container">
|
|
4300
4405
|
<!-- Render generated QR code image -->
|
|
4301
4406
|
<div class="qr-code-wrapper">
|
|
@@ -4312,7 +4417,7 @@ let S = class extends st {
|
|
|
4312
4417
|
${this.qrPollingInProgress ? "Verifying..." : "I Have Scanned the QR Code"}
|
|
4313
4418
|
</button>
|
|
4314
4419
|
</div>
|
|
4315
|
-
` :
|
|
4420
|
+
` : b`
|
|
4316
4421
|
<div class="paynow-container">
|
|
4317
4422
|
<div class="paynow-instructions">
|
|
4318
4423
|
<h3 class="instructions-title">How to Pay by QR:</h3>
|
|
@@ -4343,7 +4448,7 @@ let S = class extends st {
|
|
|
4343
4448
|
`;
|
|
4344
4449
|
}
|
|
4345
4450
|
renderPromptPayContent() {
|
|
4346
|
-
return
|
|
4451
|
+
return b`
|
|
4347
4452
|
<div class="paynow-container">
|
|
4348
4453
|
<div class="paynow-instructions">
|
|
4349
4454
|
<h3 class="instructions-title">How to Pay with PromptPay:</h3>
|
|
@@ -4379,7 +4484,7 @@ let S = class extends st {
|
|
|
4379
4484
|
`;
|
|
4380
4485
|
}
|
|
4381
4486
|
renderDuitNowContent() {
|
|
4382
|
-
return
|
|
4487
|
+
return b`
|
|
4383
4488
|
<div class="paynow-container">
|
|
4384
4489
|
<div class="paynow-instructions">
|
|
4385
4490
|
<h3 class="instructions-title">How to Pay with DuitNow:</h3>
|
|
@@ -4415,7 +4520,7 @@ let S = class extends st {
|
|
|
4415
4520
|
`;
|
|
4416
4521
|
}
|
|
4417
4522
|
renderGoPayContent() {
|
|
4418
|
-
return
|
|
4523
|
+
return b`
|
|
4419
4524
|
<div class="paynow-container">
|
|
4420
4525
|
<div class="paynow-instructions">
|
|
4421
4526
|
<h3 class="instructions-title">How to Pay with GoPay:</h3>
|
|
@@ -4451,7 +4556,7 @@ let S = class extends st {
|
|
|
4451
4556
|
`;
|
|
4452
4557
|
}
|
|
4453
4558
|
renderBoostContent() {
|
|
4454
|
-
return
|
|
4559
|
+
return b`
|
|
4455
4560
|
<div class="paynow-container">
|
|
4456
4561
|
<div class="paynow-instructions">
|
|
4457
4562
|
<h3 class="instructions-title">How to Pay with Boost:</h3>
|
|
@@ -4487,7 +4592,7 @@ let S = class extends st {
|
|
|
4487
4592
|
`;
|
|
4488
4593
|
}
|
|
4489
4594
|
renderShopeePayContent() {
|
|
4490
|
-
return
|
|
4595
|
+
return b`
|
|
4491
4596
|
<div class="paynow-container">
|
|
4492
4597
|
<div class="paynow-instructions">
|
|
4493
4598
|
<h3 class="instructions-title">How to Pay with ShopeePay:</h3>
|
|
@@ -4523,7 +4628,7 @@ let S = class extends st {
|
|
|
4523
4628
|
`;
|
|
4524
4629
|
}
|
|
4525
4630
|
renderAtomContent() {
|
|
4526
|
-
return
|
|
4631
|
+
return b`
|
|
4527
4632
|
<div class="paynow-container">
|
|
4528
4633
|
<div class="paynow-instructions">
|
|
4529
4634
|
<h3 class="instructions-title">How to Pay with Atome:</h3>
|
|
@@ -4559,7 +4664,7 @@ let S = class extends st {
|
|
|
4559
4664
|
`;
|
|
4560
4665
|
}
|
|
4561
4666
|
renderDanaContent() {
|
|
4562
|
-
return
|
|
4667
|
+
return b`
|
|
4563
4668
|
<div class="paynow-container">
|
|
4564
4669
|
<div class="paynow-instructions">
|
|
4565
4670
|
<h3 class="instructions-title">How to Pay with Dana:</h3>
|
|
@@ -4595,7 +4700,7 @@ let S = class extends st {
|
|
|
4595
4700
|
`;
|
|
4596
4701
|
}
|
|
4597
4702
|
renderTngContent() {
|
|
4598
|
-
return
|
|
4703
|
+
return b`
|
|
4599
4704
|
<div class="paynow-container">
|
|
4600
4705
|
<div class="paynow-instructions">
|
|
4601
4706
|
<h3 class="instructions-title">How to Pay with Touch 'n Go:</h3>
|
|
@@ -4630,8 +4735,116 @@ let S = class extends st {
|
|
|
4630
4735
|
</div>
|
|
4631
4736
|
`;
|
|
4632
4737
|
}
|
|
4738
|
+
renderAlipayCNContent() {
|
|
4739
|
+
return b`
|
|
4740
|
+
<div class="paynow-container">
|
|
4741
|
+
<div class="paynow-instructions">
|
|
4742
|
+
<h3 class="instructions-title">How to Pay with Alipay:</h3>
|
|
4743
|
+
|
|
4744
|
+
<div class="instruction-steps">
|
|
4745
|
+
<div class="instruction-step">
|
|
4746
|
+
<div class="step-number">1</div>
|
|
4747
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4748
|
+
</div>
|
|
4749
|
+
|
|
4750
|
+
<div class="instruction-step">
|
|
4751
|
+
<div class="step-number">2</div>
|
|
4752
|
+
<p class="step-text">Complete the payment in the Alipay app.</p>
|
|
4753
|
+
</div>
|
|
4754
|
+
|
|
4755
|
+
<div class="instruction-step">
|
|
4756
|
+
<div class="step-number">3</div>
|
|
4757
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4758
|
+
</div>
|
|
4759
|
+
</div>
|
|
4760
|
+
|
|
4761
|
+
<div class="submit-section">
|
|
4762
|
+
<button
|
|
4763
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4764
|
+
@click=${this.handleAlipayCNPayment}
|
|
4765
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4766
|
+
>
|
|
4767
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.getPayButtonAmount()}`}
|
|
4768
|
+
</button>
|
|
4769
|
+
</div>
|
|
4770
|
+
</div>
|
|
4771
|
+
</div>
|
|
4772
|
+
`;
|
|
4773
|
+
}
|
|
4774
|
+
renderAlipayHKContent() {
|
|
4775
|
+
return b`
|
|
4776
|
+
<div class="paynow-container">
|
|
4777
|
+
<div class="paynow-instructions">
|
|
4778
|
+
<h3 class="instructions-title">How to Pay with AlipayHK:</h3>
|
|
4779
|
+
|
|
4780
|
+
<div class="instruction-steps">
|
|
4781
|
+
<div class="instruction-step">
|
|
4782
|
+
<div class="step-number">1</div>
|
|
4783
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4784
|
+
</div>
|
|
4785
|
+
|
|
4786
|
+
<div class="instruction-step">
|
|
4787
|
+
<div class="step-number">2</div>
|
|
4788
|
+
<p class="step-text">Complete the payment in the AlipayHK app.</p>
|
|
4789
|
+
</div>
|
|
4790
|
+
|
|
4791
|
+
<div class="instruction-step">
|
|
4792
|
+
<div class="step-number">3</div>
|
|
4793
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4794
|
+
</div>
|
|
4795
|
+
</div>
|
|
4796
|
+
|
|
4797
|
+
<div class="submit-section">
|
|
4798
|
+
<button
|
|
4799
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4800
|
+
@click=${this.handleAlipayHKPayment}
|
|
4801
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4802
|
+
>
|
|
4803
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.getPayButtonAmount()}`}
|
|
4804
|
+
</button>
|
|
4805
|
+
</div>
|
|
4806
|
+
</div>
|
|
4807
|
+
</div>
|
|
4808
|
+
`;
|
|
4809
|
+
}
|
|
4810
|
+
renderGCashContent() {
|
|
4811
|
+
return b`
|
|
4812
|
+
<div class="paynow-container">
|
|
4813
|
+
<div class="paynow-instructions">
|
|
4814
|
+
<h3 class="instructions-title">How to Pay with GCash:</h3>
|
|
4815
|
+
|
|
4816
|
+
<div class="instruction-steps">
|
|
4817
|
+
<div class="instruction-step">
|
|
4818
|
+
<div class="step-number">1</div>
|
|
4819
|
+
<p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
|
|
4820
|
+
</div>
|
|
4821
|
+
|
|
4822
|
+
<div class="instruction-step">
|
|
4823
|
+
<div class="step-number">2</div>
|
|
4824
|
+
<p class="step-text">Complete the payment in the GCash app.</p>
|
|
4825
|
+
</div>
|
|
4826
|
+
|
|
4827
|
+
<div class="instruction-step">
|
|
4828
|
+
<div class="step-number">3</div>
|
|
4829
|
+
<p class="step-text">You'll be redirected back automatically.</p>
|
|
4830
|
+
</div>
|
|
4831
|
+
</div>
|
|
4832
|
+
|
|
4833
|
+
<div class="submit-section">
|
|
4834
|
+
<button
|
|
4835
|
+
class="pay-button ${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "loading" : ""}"
|
|
4836
|
+
@click=${this.handleGCashPayment}
|
|
4837
|
+
?disabled=${this.currentState.status === "processing" || this.currentState.status === "requires_action"}
|
|
4838
|
+
>
|
|
4839
|
+
${this.currentState.status === "processing" || this.currentState.status === "requires_action" ? "Redirecting..." : `Pay ${this.getPayButtonAmount()}`}
|
|
4840
|
+
</button>
|
|
4841
|
+
</div>
|
|
4842
|
+
</div>
|
|
4843
|
+
</div>
|
|
4844
|
+
`;
|
|
4845
|
+
}
|
|
4633
4846
|
render3DSModal() {
|
|
4634
|
-
return !this.show3DSModal || !this.nextActionUrl ? null :
|
|
4847
|
+
return !this.show3DSModal || !this.nextActionUrl ? null : b`
|
|
4635
4848
|
<div class="modal-overlay">
|
|
4636
4849
|
<div class="modal-content iframe-modal">
|
|
4637
4850
|
<iframe
|
|
@@ -4647,7 +4860,7 @@ let S = class extends st {
|
|
|
4647
4860
|
renderStatusBlock() {
|
|
4648
4861
|
if (this.currentState.status === "succeeded") {
|
|
4649
4862
|
const e = this.getTransactionData(), t = e.netAmount.toFixed(2);
|
|
4650
|
-
return
|
|
4863
|
+
return b`
|
|
4651
4864
|
<div class="result-card success">
|
|
4652
4865
|
<div class="result-icon-wrapper">
|
|
4653
4866
|
<div class="result-icon">✓</div>
|
|
@@ -4662,7 +4875,7 @@ let S = class extends st {
|
|
|
4662
4875
|
}
|
|
4663
4876
|
if (this.currentState.status === "failed") {
|
|
4664
4877
|
const e = this.currentState.error ? this.currentState.error.message : "An error occurred while processing your payment";
|
|
4665
|
-
return
|
|
4878
|
+
return b`
|
|
4666
4879
|
<div class="result-card error">
|
|
4667
4880
|
<div class="result-icon-wrapper">
|
|
4668
4881
|
<div class="result-icon">✕</div>
|
|
@@ -4680,16 +4893,16 @@ let S = class extends st {
|
|
|
4680
4893
|
return this.renderSkeletons();
|
|
4681
4894
|
const e = this.currentState.status === "succeeded" || this.currentState.status === "failed", t = !e, r = this.getFilteredPaymentMethods();
|
|
4682
4895
|
if (r.length > 0) {
|
|
4683
|
-
const
|
|
4896
|
+
const o = r.some(
|
|
4684
4897
|
(l) => l.id === this.selectedMethod && l.enabled
|
|
4685
4898
|
);
|
|
4686
|
-
if (!this.selectedMethod || !
|
|
4899
|
+
if (!this.selectedMethod || !o) {
|
|
4687
4900
|
const l = r.find((a) => a.enabled);
|
|
4688
4901
|
l && this.selectedMethod !== l.id && (this.selectedMethod = l.id);
|
|
4689
4902
|
}
|
|
4690
4903
|
}
|
|
4691
|
-
const
|
|
4692
|
-
switch (
|
|
4904
|
+
const i = (o) => {
|
|
4905
|
+
switch (o) {
|
|
4693
4906
|
case f.CARD:
|
|
4694
4907
|
return "Card";
|
|
4695
4908
|
case f.PAYNOW:
|
|
@@ -4710,10 +4923,16 @@ let S = class extends st {
|
|
|
4710
4923
|
return "Dana";
|
|
4711
4924
|
case f.TNG:
|
|
4712
4925
|
return "Touch 'n Go";
|
|
4926
|
+
case f.ALIPAYCN:
|
|
4927
|
+
return "Alipay";
|
|
4928
|
+
case f.ALIPAYHK:
|
|
4929
|
+
return "AlipayHK";
|
|
4930
|
+
case f.GCASH:
|
|
4931
|
+
return "GCash";
|
|
4713
4932
|
default:
|
|
4714
|
-
return
|
|
4933
|
+
return o;
|
|
4715
4934
|
}
|
|
4716
|
-
},
|
|
4935
|
+
}, n = (o) => o === f.CARD ? b`
|
|
4717
4936
|
<div class="method-icon-right">
|
|
4718
4937
|
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
4719
4938
|
<path
|
|
@@ -4726,62 +4945,74 @@ let S = class extends st {
|
|
|
4726
4945
|
/>
|
|
4727
4946
|
</svg>
|
|
4728
4947
|
</div>
|
|
4729
|
-
` :
|
|
4948
|
+
` : o === f.PAYNOW ? b`
|
|
4730
4949
|
<div class="method-icon-right">
|
|
4731
4950
|
<img src="${dr}" alt="PayNow" style="width: 45px; height: auto;" />
|
|
4732
4951
|
</div>
|
|
4733
|
-
` :
|
|
4952
|
+
` : o === f.PROMPTPAY ? b`
|
|
4734
4953
|
<div class="method-icon-right">
|
|
4735
4954
|
<img src="${ur}" alt="PromptPay" style="width: 45px; height: auto;" />
|
|
4736
4955
|
</div>
|
|
4737
|
-
` :
|
|
4956
|
+
` : o === f.DUITNOW ? b`
|
|
4738
4957
|
<div class="method-icon-right">
|
|
4739
4958
|
<img src="${hr}" alt="DuitNow" style="width: 45px; height: auto;" />
|
|
4740
4959
|
</div>
|
|
4741
|
-
` :
|
|
4960
|
+
` : o === f.GOPAY ? b`
|
|
4742
4961
|
<div class="method-icon-right">
|
|
4743
4962
|
<img src="${pr}" alt="GoPay" style="width: 45px; height: auto;" />
|
|
4744
4963
|
</div>
|
|
4745
|
-
` :
|
|
4964
|
+
` : o === f.BOOST ? b`
|
|
4746
4965
|
<div class="method-icon-right">
|
|
4747
4966
|
<img src="${mr}" alt="Boost" style="width: 45px; height: auto;" />
|
|
4748
4967
|
</div>
|
|
4749
|
-
` :
|
|
4968
|
+
` : o === f.SHOPEEPAY ? b`
|
|
4750
4969
|
<div class="method-icon-right">
|
|
4751
4970
|
<img src="${fr}" alt="ShopeePay" style="width: 45px; height: auto;" />
|
|
4752
4971
|
</div>
|
|
4753
|
-
` :
|
|
4972
|
+
` : o === f.ATOM ? b`
|
|
4754
4973
|
<div class="method-icon-right">
|
|
4755
4974
|
<img src="${gr}" alt="Atome" style="width: 45px; height: auto;" />
|
|
4756
4975
|
</div>
|
|
4757
|
-
` :
|
|
4976
|
+
` : o === f.DANA ? b`
|
|
4758
4977
|
<div class="method-icon-right">
|
|
4759
4978
|
<img src="${yr}" alt="Dana" style="width: 45px; height: auto;" />
|
|
4760
4979
|
</div>
|
|
4761
|
-
` :
|
|
4980
|
+
` : o === f.TNG ? b`
|
|
4762
4981
|
<div class="method-icon-right">
|
|
4763
4982
|
<img src="${br}" alt="Touch 'n Go" style="width: 45px; height: auto;" />
|
|
4764
4983
|
</div>
|
|
4765
|
-
` :
|
|
4984
|
+
` : o === f.ALIPAYCN ? b`
|
|
4985
|
+
<div class="method-icon-right">
|
|
4986
|
+
<img src="${vr}" alt="Alipay" style="width: 45px; height: auto;" />
|
|
4987
|
+
</div>
|
|
4988
|
+
` : o === f.ALIPAYHK ? b`
|
|
4989
|
+
<div class="method-icon-right">
|
|
4990
|
+
<img src="${wr}" alt="AlipayHK" style="width: 45px; height: auto;" />
|
|
4991
|
+
</div>
|
|
4992
|
+
` : o === f.GCASH ? b`
|
|
4993
|
+
<div class="method-icon-right">
|
|
4994
|
+
<img src="${xr}" alt="GCash" style="width: 45px; height: auto;" />
|
|
4995
|
+
</div>
|
|
4996
|
+
` : null, s = [
|
|
4766
4997
|
this.width ? `--one-payment-width: ${this.width}` : "",
|
|
4767
4998
|
this.maxWidth ? `--one-payment-max-width: ${this.maxWidth}` : ""
|
|
4768
4999
|
].filter(Boolean).join("; ");
|
|
4769
|
-
return
|
|
4770
|
-
<div class="payment-element" style="${
|
|
5000
|
+
return b`
|
|
5001
|
+
<div class="payment-element" style="${s}">
|
|
4771
5002
|
${this.renderTransactionDetails()}
|
|
4772
|
-
${t ?
|
|
5003
|
+
${t ? b`
|
|
4773
5004
|
<div class="header">Select a payment method</div>
|
|
4774
5005
|
<div class="payment-methods-list">
|
|
4775
|
-
${r.map((
|
|
4776
|
-
const l = this.selectedMethod ===
|
|
4777
|
-
return
|
|
5006
|
+
${r.map((o) => {
|
|
5007
|
+
const l = this.selectedMethod === o.id, a = !o.enabled || this.paymentLocked && !l;
|
|
5008
|
+
return b`
|
|
4778
5009
|
<div
|
|
4779
5010
|
class="payment-method-item"
|
|
4780
|
-
${
|
|
5011
|
+
${o.disabledReason ? b`data-tooltip="${o.disabledReason}"` : ""}
|
|
4781
5012
|
>
|
|
4782
5013
|
<div
|
|
4783
5014
|
class="method-header ${l ? "selected" : ""} ${a ? "disabled" : ""}"
|
|
4784
|
-
@click=${() =>
|
|
5015
|
+
@click=${() => o.enabled && this.handleMethodSelect(o.id)}
|
|
4785
5016
|
>
|
|
4786
5017
|
<input
|
|
4787
5018
|
type="radio"
|
|
@@ -4790,14 +5021,14 @@ let S = class extends st {
|
|
|
4790
5021
|
.checked=${l}
|
|
4791
5022
|
?disabled=${a}
|
|
4792
5023
|
@click=${(c) => {
|
|
4793
|
-
c.stopPropagation(),
|
|
5024
|
+
c.stopPropagation(), o.enabled && this.handleMethodSelect(o.id);
|
|
4794
5025
|
}}
|
|
4795
5026
|
/>
|
|
4796
|
-
<span class="method-name">${
|
|
4797
|
-
${
|
|
5027
|
+
<span class="method-name">${i(o.id)}</span>
|
|
5028
|
+
${n(o.id)}
|
|
4798
5029
|
</div>
|
|
4799
|
-
${l ?
|
|
4800
|
-
${
|
|
5030
|
+
${l ? b`<div class="method-content">
|
|
5031
|
+
${o.id === f.CARD ? this.renderCardForm() : o.id === f.PAYNOW ? this.renderPayNowContent() : o.id === f.PROMPTPAY ? this.renderPromptPayContent() : o.id === f.DUITNOW ? this.renderDuitNowContent() : o.id === f.GOPAY ? this.renderGoPayContent() : o.id === f.BOOST ? this.renderBoostContent() : o.id === f.SHOPEEPAY ? this.renderShopeePayContent() : o.id === f.ATOM ? this.renderAtomContent() : o.id === f.DANA ? this.renderDanaContent() : o.id === f.TNG ? this.renderTngContent() : o.id === f.ALIPAYCN ? this.renderAlipayCNContent() : o.id === f.ALIPAYHK ? this.renderAlipayHKContent() : o.id === f.GCASH ? this.renderGCashContent() : null}
|
|
4801
5032
|
</div>` : ""}
|
|
4802
5033
|
</div>
|
|
4803
5034
|
`;
|
|
@@ -4811,7 +5042,7 @@ let S = class extends st {
|
|
|
4811
5042
|
`;
|
|
4812
5043
|
}
|
|
4813
5044
|
};
|
|
4814
|
-
S.styles =
|
|
5045
|
+
S.styles = Be`
|
|
4815
5046
|
/* ═══════════════════════════════════════════════════════════════
|
|
4816
5047
|
CSS CUSTOM PROPERTIES (Theming)
|
|
4817
5048
|
═══════════════════════════════════════════════════════════════ */
|
|
@@ -6135,108 +6366,108 @@ S.styles = Le`
|
|
|
6135
6366
|
}
|
|
6136
6367
|
`;
|
|
6137
6368
|
P([
|
|
6138
|
-
|
|
6369
|
+
D({ type: Object })
|
|
6139
6370
|
], S.prototype, "config", 2);
|
|
6140
6371
|
P([
|
|
6141
|
-
|
|
6372
|
+
D({ type: Object })
|
|
6142
6373
|
], S.prototype, "adapters", 2);
|
|
6143
6374
|
P([
|
|
6144
|
-
|
|
6375
|
+
D({ type: Number })
|
|
6145
6376
|
], S.prototype, "amount", 2);
|
|
6146
6377
|
P([
|
|
6147
|
-
|
|
6378
|
+
D({ type: String })
|
|
6148
6379
|
], S.prototype, "currency", 2);
|
|
6149
6380
|
P([
|
|
6150
|
-
|
|
6381
|
+
D({ type: String })
|
|
6151
6382
|
], S.prototype, "orderId", 2);
|
|
6152
6383
|
P([
|
|
6153
|
-
|
|
6384
|
+
D({ type: String })
|
|
6154
6385
|
], S.prototype, "firstName", 2);
|
|
6155
6386
|
P([
|
|
6156
|
-
|
|
6387
|
+
D({ type: String })
|
|
6157
6388
|
], S.prototype, "lastName", 2);
|
|
6158
6389
|
P([
|
|
6159
|
-
|
|
6390
|
+
D({ type: String })
|
|
6160
6391
|
], S.prototype, "email", 2);
|
|
6161
6392
|
P([
|
|
6162
|
-
|
|
6393
|
+
D({ type: String })
|
|
6163
6394
|
], S.prototype, "phoneNumber", 2);
|
|
6164
6395
|
P([
|
|
6165
|
-
|
|
6396
|
+
D({ type: Array })
|
|
6166
6397
|
], S.prototype, "excludePaymentMethods", 2);
|
|
6167
6398
|
P([
|
|
6168
|
-
|
|
6399
|
+
D({ type: String })
|
|
6169
6400
|
], S.prototype, "width", 2);
|
|
6170
6401
|
P([
|
|
6171
|
-
|
|
6402
|
+
D({ type: String })
|
|
6172
6403
|
], S.prototype, "maxWidth", 2);
|
|
6173
6404
|
P([
|
|
6174
|
-
|
|
6405
|
+
D({ type: Object })
|
|
6175
6406
|
], S.prototype, "appearance", 2);
|
|
6176
6407
|
P([
|
|
6177
|
-
|
|
6408
|
+
N()
|
|
6178
6409
|
], S.prototype, "currentState", 2);
|
|
6179
6410
|
P([
|
|
6180
|
-
|
|
6411
|
+
N()
|
|
6181
6412
|
], S.prototype, "selectedMethod", 2);
|
|
6182
6413
|
P([
|
|
6183
|
-
|
|
6414
|
+
N()
|
|
6184
6415
|
], S.prototype, "cardFormData", 2);
|
|
6185
6416
|
P([
|
|
6186
|
-
|
|
6417
|
+
N()
|
|
6187
6418
|
], S.prototype, "formErrors", 2);
|
|
6188
6419
|
P([
|
|
6189
|
-
|
|
6420
|
+
N()
|
|
6190
6421
|
], S.prototype, "paymentData", 2);
|
|
6191
6422
|
P([
|
|
6192
|
-
|
|
6423
|
+
N()
|
|
6193
6424
|
], S.prototype, "feesExpanded", 2);
|
|
6194
6425
|
P([
|
|
6195
|
-
|
|
6426
|
+
N()
|
|
6196
6427
|
], S.prototype, "isInitializing", 2);
|
|
6197
6428
|
P([
|
|
6198
|
-
|
|
6429
|
+
N()
|
|
6199
6430
|
], S.prototype, "cardBrand", 2);
|
|
6200
6431
|
P([
|
|
6201
|
-
|
|
6432
|
+
N()
|
|
6202
6433
|
], S.prototype, "paymentLocked", 2);
|
|
6203
6434
|
P([
|
|
6204
|
-
|
|
6435
|
+
N()
|
|
6205
6436
|
], S.prototype, "show3DSModal", 2);
|
|
6206
6437
|
P([
|
|
6207
|
-
|
|
6438
|
+
N()
|
|
6208
6439
|
], S.prototype, "showQRModal", 2);
|
|
6209
6440
|
P([
|
|
6210
|
-
|
|
6441
|
+
N()
|
|
6211
6442
|
], S.prototype, "nextActionUrl", 2);
|
|
6212
6443
|
P([
|
|
6213
|
-
|
|
6444
|
+
N()
|
|
6214
6445
|
], S.prototype, "qrCode", 2);
|
|
6215
6446
|
P([
|
|
6216
|
-
|
|
6447
|
+
N()
|
|
6217
6448
|
], S.prototype, "qrCodeDataUrl", 2);
|
|
6218
6449
|
P([
|
|
6219
|
-
|
|
6450
|
+
N()
|
|
6220
6451
|
], S.prototype, "qrAutoResumeTimer", 2);
|
|
6221
6452
|
P([
|
|
6222
|
-
|
|
6453
|
+
N()
|
|
6223
6454
|
], S.prototype, "qrPollingInProgress", 2);
|
|
6224
6455
|
S = P([
|
|
6225
6456
|
rr("one-payment")
|
|
6226
6457
|
], S);
|
|
6227
|
-
const
|
|
6458
|
+
const wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6228
6459
|
__proto__: null,
|
|
6229
6460
|
get OnePayment() {
|
|
6230
6461
|
return S;
|
|
6231
6462
|
}
|
|
6232
6463
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6233
|
-
function
|
|
6234
|
-
customElements.get("one-payment") || Promise.resolve().then(() =>
|
|
6464
|
+
function Pi() {
|
|
6465
|
+
customElements.get("one-payment") || Promise.resolve().then(() => wi).then(({ OnePayment: e }) => {
|
|
6235
6466
|
customElements.define("one-payment", e);
|
|
6236
6467
|
});
|
|
6237
6468
|
}
|
|
6238
6469
|
export {
|
|
6239
6470
|
S as OnePayment,
|
|
6240
6471
|
S as OnePaymentElement,
|
|
6241
|
-
|
|
6472
|
+
Pi as defineCustomElements
|
|
6242
6473
|
};
|