@busha/ramp-web-sdk 0.1.1

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.
@@ -0,0 +1,1646 @@
1
+ var $e = Object.defineProperty;
2
+ var Se = (n, e, t) => e in n ? $e(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var z = (n, e, t) => Se(n, typeof e != "symbol" ? e + "" : e, t);
4
+ const q = "busha-ramp-container", G = "busha-ramp-loader", X = "busha-ramp-styles", ee = "busha-ramp-close-btn", L = "busha-ramp-iframe", Oe = "busha-ramp-form";
5
+ const Te = "INITIALIZED", oe = "CANCELLED", ke = "COMPLETED";
6
+ function Ce(n) {
7
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
8
+ }
9
+ var J, le;
10
+ function De() {
11
+ if (le) return J;
12
+ le = 1;
13
+ function n(c) {
14
+ this._maxSize = c, this.clear();
15
+ }
16
+ n.prototype.clear = function() {
17
+ this._size = 0, this._values = /* @__PURE__ */ Object.create(null);
18
+ }, n.prototype.get = function(c) {
19
+ return this._values[c];
20
+ }, n.prototype.set = function(c, p) {
21
+ return this._size >= this._maxSize && this.clear(), c in this._values || this._size++, this._values[c] = p;
22
+ };
23
+ var e = /[^.^\]^[]+|(?=\[\]|\.\.)/g, t = /^\d+$/, r = /^\d/, s = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, i = /^\s*(['"]?)(.*?)(\1)\s*$/, a = 512, u = new n(a), o = new n(a), d = new n(a);
24
+ J = {
25
+ Cache: n,
26
+ split: f,
27
+ normalizePath: l,
28
+ setter: function(c) {
29
+ var p = l(c);
30
+ return o.get(c) || o.set(c, function(O, y) {
31
+ for (var g = 0, T = p.length, C = O; g < T - 1; ) {
32
+ var D = p[g];
33
+ if (D === "__proto__" || D === "constructor" || D === "prototype")
34
+ return O;
35
+ C = C[p[g++]];
36
+ }
37
+ C[p[g]] = y;
38
+ });
39
+ },
40
+ getter: function(c, p) {
41
+ var w = l(c);
42
+ return d.get(c) || d.set(c, function(y) {
43
+ for (var g = 0, T = w.length; g < T; )
44
+ if (y != null || !p) y = y[w[g++]];
45
+ else return;
46
+ return y;
47
+ });
48
+ },
49
+ join: function(c) {
50
+ return c.reduce(function(p, w) {
51
+ return p + (m(w) || t.test(w) ? "[" + w + "]" : (p ? "." : "") + w);
52
+ }, "");
53
+ },
54
+ forEach: function(c, p, w) {
55
+ h(Array.isArray(c) ? c : f(c), p, w);
56
+ }
57
+ };
58
+ function l(c) {
59
+ return u.get(c) || u.set(
60
+ c,
61
+ f(c).map(function(p) {
62
+ return p.replace(i, "$2");
63
+ })
64
+ );
65
+ }
66
+ function f(c) {
67
+ return c.match(e) || [""];
68
+ }
69
+ function h(c, p, w) {
70
+ var O = c.length, y, g, T, C;
71
+ for (g = 0; g < O; g++)
72
+ y = c[g], y && (v(y) && (y = '"' + y + '"'), C = m(y), T = !C && /^\d+$/.test(y), p.call(w, y, C, T, g, c));
73
+ }
74
+ function m(c) {
75
+ return typeof c == "string" && c && ["'", '"'].indexOf(c.charAt(0)) !== -1;
76
+ }
77
+ function E(c) {
78
+ return c.match(r) && !c.match(t);
79
+ }
80
+ function x(c) {
81
+ return s.test(c);
82
+ }
83
+ function v(c) {
84
+ return !m(c) && (E(c) || x(c));
85
+ }
86
+ return J;
87
+ }
88
+ var U = De(), Q, ce;
89
+ function Ae() {
90
+ if (ce) return Q;
91
+ ce = 1;
92
+ const n = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g, e = (l) => l.match(n) || [], t = (l) => l[0].toUpperCase() + l.slice(1), r = (l, f) => e(l).join(f).toLowerCase(), s = (l) => e(l).reduce(
93
+ (f, h) => `${f}${f ? h[0].toUpperCase() + h.slice(1).toLowerCase() : h.toLowerCase()}`,
94
+ ""
95
+ );
96
+ return Q = {
97
+ words: e,
98
+ upperFirst: t,
99
+ camelCase: s,
100
+ pascalCase: (l) => t(s(l)),
101
+ snakeCase: (l) => r(l, "_"),
102
+ kebabCase: (l) => r(l, "-"),
103
+ sentenceCase: (l) => t(r(l, " ")),
104
+ titleCase: (l) => e(l).map(t).join(" ")
105
+ }, Q;
106
+ }
107
+ var W = Ae(), V = { exports: {} }, fe;
108
+ function Ie() {
109
+ if (fe) return V.exports;
110
+ fe = 1, V.exports = function(s) {
111
+ return n(e(s), s);
112
+ }, V.exports.array = n;
113
+ function n(s, i) {
114
+ var a = s.length, u = new Array(a), o = {}, d = a, l = t(i), f = r(s);
115
+ for (i.forEach(function(m) {
116
+ if (!f.has(m[0]) || !f.has(m[1]))
117
+ throw new Error("Unknown node. There is an unknown node in the supplied edges.");
118
+ }); d--; )
119
+ o[d] || h(s[d], d, /* @__PURE__ */ new Set());
120
+ return u;
121
+ function h(m, E, x) {
122
+ if (x.has(m)) {
123
+ var v;
124
+ try {
125
+ v = ", node was:" + JSON.stringify(m);
126
+ } catch {
127
+ v = "";
128
+ }
129
+ throw new Error("Cyclic dependency" + v);
130
+ }
131
+ if (!f.has(m))
132
+ throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(m));
133
+ if (!o[E]) {
134
+ o[E] = !0;
135
+ var c = l.get(m) || /* @__PURE__ */ new Set();
136
+ if (c = Array.from(c), E = c.length) {
137
+ x.add(m);
138
+ do {
139
+ var p = c[--E];
140
+ h(p, f.get(p), x);
141
+ } while (E);
142
+ x.delete(m);
143
+ }
144
+ u[--a] = m;
145
+ }
146
+ }
147
+ }
148
+ function e(s) {
149
+ for (var i = /* @__PURE__ */ new Set(), a = 0, u = s.length; a < u; a++) {
150
+ var o = s[a];
151
+ i.add(o[0]), i.add(o[1]);
152
+ }
153
+ return Array.from(i);
154
+ }
155
+ function t(s) {
156
+ for (var i = /* @__PURE__ */ new Map(), a = 0, u = s.length; a < u; a++) {
157
+ var o = s[a];
158
+ i.has(o[0]) || i.set(o[0], /* @__PURE__ */ new Set()), i.has(o[1]) || i.set(o[1], /* @__PURE__ */ new Set()), i.get(o[0]).add(o[1]);
159
+ }
160
+ return i;
161
+ }
162
+ function r(s) {
163
+ for (var i = /* @__PURE__ */ new Map(), a = 0, u = s.length; a < u; a++)
164
+ i.set(s[a], a);
165
+ return i;
166
+ }
167
+ return V.exports;
168
+ }
169
+ var je = Ie();
170
+ const Ne = /* @__PURE__ */ Ce(je), Ue = Object.prototype.toString, Pe = Error.prototype.toString, Me = RegExp.prototype.toString, Re = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", ze = /^Symbol\((.*)\)(.*)$/;
171
+ function Le(n) {
172
+ return n != +n ? "NaN" : n === 0 && 1 / n < 0 ? "-0" : "" + n;
173
+ }
174
+ function de(n, e = !1) {
175
+ if (n == null || n === !0 || n === !1) return "" + n;
176
+ const t = typeof n;
177
+ if (t === "number") return Le(n);
178
+ if (t === "string") return e ? `"${n}"` : n;
179
+ if (t === "function") return "[Function " + (n.name || "anonymous") + "]";
180
+ if (t === "symbol") return Re.call(n).replace(ze, "Symbol($1)");
181
+ const r = Ue.call(n).slice(8, -1);
182
+ return r === "Date" ? isNaN(n.getTime()) ? "" + n : n.toISOString(n) : r === "Error" || n instanceof Error ? "[" + Pe.call(n) + "]" : r === "RegExp" ? Me.call(n) : null;
183
+ }
184
+ function I(n, e) {
185
+ let t = de(n, e);
186
+ return t !== null ? t : JSON.stringify(n, function(r, s) {
187
+ let i = de(this[r], e);
188
+ return i !== null ? i : s;
189
+ }, 2);
190
+ }
191
+ function be(n) {
192
+ return n == null ? [] : [].concat(n);
193
+ }
194
+ let xe, ge, Ee, qe = /\$\{\s*(\w+)\s*\}/g;
195
+ xe = Symbol.toStringTag;
196
+ class he {
197
+ constructor(e, t, r, s) {
198
+ this.name = void 0, this.message = void 0, this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = void 0, this.inner = void 0, this[xe] = "Error", this.name = "ValidationError", this.value = t, this.path = r, this.type = s, this.errors = [], this.inner = [], be(e).forEach((i) => {
199
+ if (F.isError(i)) {
200
+ this.errors.push(...i.errors);
201
+ const a = i.inner.length ? i.inner : [i];
202
+ this.inner.push(...a);
203
+ } else
204
+ this.errors.push(i);
205
+ }), this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
206
+ }
207
+ }
208
+ ge = Symbol.hasInstance;
209
+ Ee = Symbol.toStringTag;
210
+ class F extends Error {
211
+ static formatError(e, t) {
212
+ const r = t.label || t.path || "this";
213
+ return t = Object.assign({}, t, {
214
+ path: r,
215
+ originalPath: t.path
216
+ }), typeof e == "string" ? e.replace(qe, (s, i) => I(t[i])) : typeof e == "function" ? e(t) : e;
217
+ }
218
+ static isError(e) {
219
+ return e && e.name === "ValidationError";
220
+ }
221
+ constructor(e, t, r, s, i) {
222
+ const a = new he(e, t, r, s);
223
+ if (i)
224
+ return a;
225
+ super(), this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = [], this.inner = [], this[Ee] = "Error", this.name = a.name, this.message = a.message, this.type = a.type, this.value = a.value, this.path = a.path, this.errors = a.errors, this.inner = a.inner, Error.captureStackTrace && Error.captureStackTrace(this, F);
226
+ }
227
+ static [ge](e) {
228
+ return he[Symbol.hasInstance](e) || super[Symbol.hasInstance](e);
229
+ }
230
+ }
231
+ let $ = {
232
+ default: "${path} is invalid",
233
+ required: "${path} is a required field",
234
+ defined: "${path} must be defined",
235
+ notNull: "${path} cannot be null",
236
+ oneOf: "${path} must be one of the following values: ${values}",
237
+ notOneOf: "${path} must not be one of the following values: ${values}",
238
+ notType: ({
239
+ path: n,
240
+ type: e,
241
+ value: t,
242
+ originalValue: r
243
+ }) => {
244
+ const s = r != null && r !== t ? ` (cast from the value \`${I(r, !0)}\`).` : ".";
245
+ return e !== "mixed" ? `${n} must be a \`${e}\` type, but the final value was: \`${I(t, !0)}\`` + s : `${n} must match the configured type. The validated value was: \`${I(t, !0)}\`` + s;
246
+ }
247
+ }, _ = {
248
+ length: "${path} must be exactly ${length} characters",
249
+ min: "${path} must be at least ${min} characters",
250
+ max: "${path} must be at most ${max} characters",
251
+ matches: '${path} must match the following: "${regex}"',
252
+ email: "${path} must be a valid email",
253
+ url: "${path} must be a valid URL",
254
+ uuid: "${path} must be a valid UUID",
255
+ datetime: "${path} must be a valid ISO date-time",
256
+ datetime_precision: "${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",
257
+ datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
258
+ trim: "${path} must be a trimmed string",
259
+ lowercase: "${path} must be a lowercase string",
260
+ uppercase: "${path} must be a upper case string"
261
+ }, Ve = {
262
+ min: "${path} must be greater than or equal to ${min}",
263
+ max: "${path} must be less than or equal to ${max}",
264
+ lessThan: "${path} must be less than ${less}",
265
+ moreThan: "${path} must be greater than ${more}",
266
+ positive: "${path} must be a positive number",
267
+ negative: "${path} must be a negative number",
268
+ integer: "${path} must be an integer"
269
+ }, te = {
270
+ min: "${path} field must be later than ${min}",
271
+ max: "${path} field must be at earlier than ${max}"
272
+ }, Ze = {
273
+ isValue: "${path} field must be ${value}"
274
+ }, B = {
275
+ noUnknown: "${path} field has unspecified keys: ${unknown}",
276
+ exact: "${path} object contains unknown properties: ${properties}"
277
+ }, Be = {
278
+ min: "${path} field must have at least ${min} items",
279
+ max: "${path} field must have less than or equal to ${max} items",
280
+ length: "${path} must have ${length} items"
281
+ }, Ye = {
282
+ notType: (n) => {
283
+ const {
284
+ path: e,
285
+ value: t,
286
+ spec: r
287
+ } = n, s = r.types.length;
288
+ if (Array.isArray(t)) {
289
+ if (t.length < s) return `${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${I(t, !0)}\``;
290
+ if (t.length > s) return `${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${I(t, !0)}\``;
291
+ }
292
+ return F.formatError($.notType, n);
293
+ }
294
+ };
295
+ Object.assign(/* @__PURE__ */ Object.create(null), {
296
+ mixed: $,
297
+ string: _,
298
+ number: Ve,
299
+ date: te,
300
+ object: B,
301
+ array: Be,
302
+ boolean: Ze,
303
+ tuple: Ye
304
+ });
305
+ const ne = (n) => n && n.__isYupSchema__;
306
+ class H {
307
+ static fromOptions(e, t) {
308
+ if (!t.then && !t.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
309
+ let {
310
+ is: r,
311
+ then: s,
312
+ otherwise: i
313
+ } = t, a = typeof r == "function" ? r : (...u) => u.every((o) => o === r);
314
+ return new H(e, (u, o) => {
315
+ var d;
316
+ let l = a(...u) ? s : i;
317
+ return (d = l == null ? void 0 : l(o)) != null ? d : o;
318
+ });
319
+ }
320
+ constructor(e, t) {
321
+ this.fn = void 0, this.refs = e, this.refs = e, this.fn = t;
322
+ }
323
+ resolve(e, t) {
324
+ let r = this.refs.map((i) => (
325
+ // TODO: ? operator here?
326
+ i.getValue(t == null ? void 0 : t.value, t == null ? void 0 : t.parent, t == null ? void 0 : t.context)
327
+ )), s = this.fn(r, e, t);
328
+ if (s === void 0 || // @ts-ignore this can be base
329
+ s === e)
330
+ return e;
331
+ if (!ne(s)) throw new TypeError("conditions must return a schema object");
332
+ return s.resolve(t);
333
+ }
334
+ }
335
+ const Z = {
336
+ context: "$",
337
+ value: "."
338
+ };
339
+ class P {
340
+ constructor(e, t = {}) {
341
+ if (this.key = void 0, this.isContext = void 0, this.isValue = void 0, this.isSibling = void 0, this.path = void 0, this.getter = void 0, this.map = void 0, typeof e != "string") throw new TypeError("ref must be a string, got: " + e);
342
+ if (this.key = e.trim(), e === "") throw new TypeError("ref must be a non-empty string");
343
+ this.isContext = this.key[0] === Z.context, this.isValue = this.key[0] === Z.value, this.isSibling = !this.isContext && !this.isValue;
344
+ let r = this.isContext ? Z.context : this.isValue ? Z.value : "";
345
+ this.path = this.key.slice(r.length), this.getter = this.path && U.getter(this.path, !0), this.map = t.map;
346
+ }
347
+ getValue(e, t, r) {
348
+ let s = this.isContext ? r : this.isValue ? e : t;
349
+ return this.getter && (s = this.getter(s || {})), this.map && (s = this.map(s)), s;
350
+ }
351
+ /**
352
+ *
353
+ * @param {*} value
354
+ * @param {Object} options
355
+ * @param {Object=} options.context
356
+ * @param {Object=} options.parent
357
+ */
358
+ cast(e, t) {
359
+ return this.getValue(e, t == null ? void 0 : t.parent, t == null ? void 0 : t.context);
360
+ }
361
+ resolve() {
362
+ return this;
363
+ }
364
+ describe() {
365
+ return {
366
+ type: "ref",
367
+ key: this.key
368
+ };
369
+ }
370
+ toString() {
371
+ return `Ref(${this.key})`;
372
+ }
373
+ static isRef(e) {
374
+ return e && e.__isYupRef;
375
+ }
376
+ }
377
+ P.prototype.__isYupRef = !0;
378
+ const N = (n) => n == null;
379
+ function M(n) {
380
+ function e({
381
+ value: t,
382
+ path: r = "",
383
+ options: s,
384
+ originalValue: i,
385
+ schema: a
386
+ }, u, o) {
387
+ const {
388
+ name: d,
389
+ test: l,
390
+ params: f,
391
+ message: h,
392
+ skipAbsent: m
393
+ } = n;
394
+ let {
395
+ parent: E,
396
+ context: x,
397
+ abortEarly: v = a.spec.abortEarly,
398
+ disableStackTrace: c = a.spec.disableStackTrace
399
+ } = s;
400
+ function p(b) {
401
+ return P.isRef(b) ? b.getValue(t, E, x) : b;
402
+ }
403
+ function w(b = {}) {
404
+ const j = Object.assign({
405
+ value: t,
406
+ originalValue: i,
407
+ label: a.spec.label,
408
+ path: b.path || r,
409
+ spec: a.spec,
410
+ disableStackTrace: b.disableStackTrace || c
411
+ }, f, b.params);
412
+ for (const ue of Object.keys(j)) j[ue] = p(j[ue]);
413
+ const ae = new F(F.formatError(b.message || h, j), t, j.path, b.type || d, j.disableStackTrace);
414
+ return ae.params = j, ae;
415
+ }
416
+ const O = v ? u : o;
417
+ let y = {
418
+ path: r,
419
+ parent: E,
420
+ type: d,
421
+ from: s.from,
422
+ createError: w,
423
+ resolve: p,
424
+ options: s,
425
+ originalValue: i,
426
+ schema: a
427
+ };
428
+ const g = (b) => {
429
+ F.isError(b) ? O(b) : b ? o(null) : O(w());
430
+ }, T = (b) => {
431
+ F.isError(b) ? O(b) : u(b);
432
+ };
433
+ if (m && N(t))
434
+ return g(!0);
435
+ let D;
436
+ try {
437
+ var ie;
438
+ if (D = l.call(y, t, y), typeof ((ie = D) == null ? void 0 : ie.then) == "function") {
439
+ if (s.sync)
440
+ throw new Error(`Validation test of type: "${y.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
441
+ return Promise.resolve(D).then(g, T);
442
+ }
443
+ } catch (b) {
444
+ T(b);
445
+ return;
446
+ }
447
+ g(D);
448
+ }
449
+ return e.OPTIONS = n, e;
450
+ }
451
+ function Ge(n, e, t, r = t) {
452
+ let s, i, a;
453
+ return e ? (U.forEach(e, (u, o, d) => {
454
+ let l = o ? u.slice(1, u.length - 1) : u;
455
+ n = n.resolve({
456
+ context: r,
457
+ parent: s,
458
+ value: t
459
+ });
460
+ let f = n.type === "tuple", h = d ? parseInt(l, 10) : 0;
461
+ if (n.innerType || f) {
462
+ if (f && !d) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);
463
+ if (t && h >= t.length)
464
+ throw new Error(`Yup.reach cannot resolve an array item at index: ${u}, in the path: ${e}. because there is no value at that index. `);
465
+ s = t, t = t && t[h], n = f ? n.spec.types[h] : n.innerType;
466
+ }
467
+ if (!d) {
468
+ if (!n.fields || !n.fields[l]) throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${n.type}")`);
469
+ s = t, t = t && t[l], n = n.fields[l];
470
+ }
471
+ i = l, a = o ? "[" + u + "]" : "." + u;
472
+ }), {
473
+ schema: n,
474
+ parent: s,
475
+ parentPath: i
476
+ }) : {
477
+ parent: s,
478
+ parentPath: e,
479
+ schema: n
480
+ };
481
+ }
482
+ class K extends Set {
483
+ describe() {
484
+ const e = [];
485
+ for (const t of this.values())
486
+ e.push(P.isRef(t) ? t.describe() : t);
487
+ return e;
488
+ }
489
+ resolveAll(e) {
490
+ let t = [];
491
+ for (const r of this.values())
492
+ t.push(e(r));
493
+ return t;
494
+ }
495
+ clone() {
496
+ return new K(this.values());
497
+ }
498
+ merge(e, t) {
499
+ const r = this.clone();
500
+ return e.forEach((s) => r.add(s)), t.forEach((s) => r.delete(s)), r;
501
+ }
502
+ }
503
+ function R(n, e = /* @__PURE__ */ new Map()) {
504
+ if (ne(n) || !n || typeof n != "object") return n;
505
+ if (e.has(n)) return e.get(n);
506
+ let t;
507
+ if (n instanceof Date)
508
+ t = new Date(n.getTime()), e.set(n, t);
509
+ else if (n instanceof RegExp)
510
+ t = new RegExp(n), e.set(n, t);
511
+ else if (Array.isArray(n)) {
512
+ t = new Array(n.length), e.set(n, t);
513
+ for (let r = 0; r < n.length; r++) t[r] = R(n[r], e);
514
+ } else if (n instanceof Map) {
515
+ t = /* @__PURE__ */ new Map(), e.set(n, t);
516
+ for (const [r, s] of n.entries()) t.set(r, R(s, e));
517
+ } else if (n instanceof Set) {
518
+ t = /* @__PURE__ */ new Set(), e.set(n, t);
519
+ for (const r of n) t.add(R(r, e));
520
+ } else if (n instanceof Object) {
521
+ t = {}, e.set(n, t);
522
+ for (const [r, s] of Object.entries(n)) t[r] = R(s, e);
523
+ } else
524
+ throw Error(`Unable to clone ${n}`);
525
+ return t;
526
+ }
527
+ class S {
528
+ constructor(e) {
529
+ this.type = void 0, this.deps = [], this.tests = void 0, this.transforms = void 0, this.conditions = [], this._mutate = void 0, this.internalTests = {}, this._whitelist = new K(), this._blacklist = new K(), this.exclusiveTests = /* @__PURE__ */ Object.create(null), this._typeCheck = void 0, this.spec = void 0, this.tests = [], this.transforms = [], this.withMutation(() => {
530
+ this.typeError($.notType);
531
+ }), this.type = e.type, this._typeCheck = e.check, this.spec = Object.assign({
532
+ strip: !1,
533
+ strict: !1,
534
+ abortEarly: !0,
535
+ recursive: !0,
536
+ disableStackTrace: !1,
537
+ nullable: !1,
538
+ optional: !0,
539
+ coerce: !0
540
+ }, e == null ? void 0 : e.spec), this.withMutation((t) => {
541
+ t.nonNullable();
542
+ });
543
+ }
544
+ // TODO: remove
545
+ get _type() {
546
+ return this.type;
547
+ }
548
+ clone(e) {
549
+ if (this._mutate)
550
+ return e && Object.assign(this.spec, e), this;
551
+ const t = Object.create(Object.getPrototypeOf(this));
552
+ return t.type = this.type, t._typeCheck = this._typeCheck, t._whitelist = this._whitelist.clone(), t._blacklist = this._blacklist.clone(), t.internalTests = Object.assign({}, this.internalTests), t.exclusiveTests = Object.assign({}, this.exclusiveTests), t.deps = [...this.deps], t.conditions = [...this.conditions], t.tests = [...this.tests], t.transforms = [...this.transforms], t.spec = R(Object.assign({}, this.spec, e)), t;
553
+ }
554
+ label(e) {
555
+ let t = this.clone();
556
+ return t.spec.label = e, t;
557
+ }
558
+ meta(...e) {
559
+ if (e.length === 0) return this.spec.meta;
560
+ let t = this.clone();
561
+ return t.spec.meta = Object.assign(t.spec.meta || {}, e[0]), t;
562
+ }
563
+ withMutation(e) {
564
+ let t = this._mutate;
565
+ this._mutate = !0;
566
+ let r = e(this);
567
+ return this._mutate = t, r;
568
+ }
569
+ concat(e) {
570
+ if (!e || e === this) return this;
571
+ if (e.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);
572
+ let t = this, r = e.clone();
573
+ const s = Object.assign({}, t.spec, r.spec);
574
+ return r.spec = s, r.internalTests = Object.assign({}, t.internalTests, r.internalTests), r._whitelist = t._whitelist.merge(e._whitelist, e._blacklist), r._blacklist = t._blacklist.merge(e._blacklist, e._whitelist), r.tests = t.tests, r.exclusiveTests = t.exclusiveTests, r.withMutation((i) => {
575
+ e.tests.forEach((a) => {
576
+ i.test(a.OPTIONS);
577
+ });
578
+ }), r.transforms = [...t.transforms, ...r.transforms], r;
579
+ }
580
+ isType(e) {
581
+ return e == null ? !!(this.spec.nullable && e === null || this.spec.optional && e === void 0) : this._typeCheck(e);
582
+ }
583
+ resolve(e) {
584
+ let t = this;
585
+ if (t.conditions.length) {
586
+ let r = t.conditions;
587
+ t = t.clone(), t.conditions = [], t = r.reduce((s, i) => i.resolve(s, e), t), t = t.resolve(e);
588
+ }
589
+ return t;
590
+ }
591
+ resolveOptions(e) {
592
+ var t, r, s, i;
593
+ return Object.assign({}, e, {
594
+ from: e.from || [],
595
+ strict: (t = e.strict) != null ? t : this.spec.strict,
596
+ abortEarly: (r = e.abortEarly) != null ? r : this.spec.abortEarly,
597
+ recursive: (s = e.recursive) != null ? s : this.spec.recursive,
598
+ disableStackTrace: (i = e.disableStackTrace) != null ? i : this.spec.disableStackTrace
599
+ });
600
+ }
601
+ /**
602
+ * Run the configured transform pipeline over an input value.
603
+ */
604
+ cast(e, t = {}) {
605
+ let r = this.resolve(Object.assign({
606
+ value: e
607
+ }, t)), s = t.assert === "ignore-optionality", i = r._cast(e, t);
608
+ if (t.assert !== !1 && !r.isType(i)) {
609
+ if (s && N(i))
610
+ return i;
611
+ let a = I(e), u = I(i);
612
+ throw new TypeError(`The value of ${t.path || "field"} could not be cast to a value that satisfies the schema type: "${r.type}".
613
+
614
+ attempted value: ${a}
615
+ ` + (u !== a ? `result of cast: ${u}` : ""));
616
+ }
617
+ return i;
618
+ }
619
+ _cast(e, t) {
620
+ let r = e === void 0 ? e : this.transforms.reduce((s, i) => i.call(this, s, e, this), e);
621
+ return r === void 0 && (r = this.getDefault(t)), r;
622
+ }
623
+ _validate(e, t = {}, r, s) {
624
+ let {
625
+ path: i,
626
+ originalValue: a = e,
627
+ strict: u = this.spec.strict
628
+ } = t, o = e;
629
+ u || (o = this._cast(o, Object.assign({
630
+ assert: !1
631
+ }, t)));
632
+ let d = [];
633
+ for (let l of Object.values(this.internalTests))
634
+ l && d.push(l);
635
+ this.runTests({
636
+ path: i,
637
+ value: o,
638
+ originalValue: a,
639
+ options: t,
640
+ tests: d
641
+ }, r, (l) => {
642
+ if (l.length)
643
+ return s(l, o);
644
+ this.runTests({
645
+ path: i,
646
+ value: o,
647
+ originalValue: a,
648
+ options: t,
649
+ tests: this.tests
650
+ }, r, s);
651
+ });
652
+ }
653
+ /**
654
+ * Executes a set of validations, either schema, produced Tests or a nested
655
+ * schema validate result.
656
+ */
657
+ runTests(e, t, r) {
658
+ let s = !1, {
659
+ tests: i,
660
+ value: a,
661
+ originalValue: u,
662
+ path: o,
663
+ options: d
664
+ } = e, l = (x) => {
665
+ s || (s = !0, t(x, a));
666
+ }, f = (x) => {
667
+ s || (s = !0, r(x, a));
668
+ }, h = i.length, m = [];
669
+ if (!h) return f([]);
670
+ let E = {
671
+ value: a,
672
+ originalValue: u,
673
+ path: o,
674
+ options: d,
675
+ schema: this
676
+ };
677
+ for (let x = 0; x < i.length; x++) {
678
+ const v = i[x];
679
+ v(E, l, function(p) {
680
+ p && (Array.isArray(p) ? m.push(...p) : m.push(p)), --h <= 0 && f(m);
681
+ });
682
+ }
683
+ }
684
+ asNestedTest({
685
+ key: e,
686
+ index: t,
687
+ parent: r,
688
+ parentPath: s,
689
+ originalParent: i,
690
+ options: a
691
+ }) {
692
+ const u = e ?? t;
693
+ if (u == null)
694
+ throw TypeError("Must include `key` or `index` for nested validations");
695
+ const o = typeof u == "number";
696
+ let d = r[u];
697
+ const l = Object.assign({}, a, {
698
+ // Nested validations fields are always strict:
699
+ // 1. parent isn't strict so the casting will also have cast inner values
700
+ // 2. parent is strict in which case the nested values weren't cast either
701
+ strict: !0,
702
+ parent: r,
703
+ value: d,
704
+ originalValue: i[u],
705
+ // FIXME: tests depend on `index` being passed around deeply,
706
+ // we should not let the options.key/index bleed through
707
+ key: void 0,
708
+ // index: undefined,
709
+ [o ? "index" : "key"]: u,
710
+ path: o || u.includes(".") ? `${s || ""}[${o ? u : `"${u}"`}]` : (s ? `${s}.` : "") + e
711
+ });
712
+ return (f, h, m) => this.resolve(l)._validate(d, l, h, m);
713
+ }
714
+ validate(e, t) {
715
+ var r;
716
+ let s = this.resolve(Object.assign({}, t, {
717
+ value: e
718
+ })), i = (r = t == null ? void 0 : t.disableStackTrace) != null ? r : s.spec.disableStackTrace;
719
+ return new Promise((a, u) => s._validate(e, t, (o, d) => {
720
+ F.isError(o) && (o.value = d), u(o);
721
+ }, (o, d) => {
722
+ o.length ? u(new F(o, d, void 0, void 0, i)) : a(d);
723
+ }));
724
+ }
725
+ validateSync(e, t) {
726
+ var r;
727
+ let s = this.resolve(Object.assign({}, t, {
728
+ value: e
729
+ })), i, a = (r = t == null ? void 0 : t.disableStackTrace) != null ? r : s.spec.disableStackTrace;
730
+ return s._validate(e, Object.assign({}, t, {
731
+ sync: !0
732
+ }), (u, o) => {
733
+ throw F.isError(u) && (u.value = o), u;
734
+ }, (u, o) => {
735
+ if (u.length) throw new F(u, e, void 0, void 0, a);
736
+ i = o;
737
+ }), i;
738
+ }
739
+ isValid(e, t) {
740
+ return this.validate(e, t).then(() => !0, (r) => {
741
+ if (F.isError(r)) return !1;
742
+ throw r;
743
+ });
744
+ }
745
+ isValidSync(e, t) {
746
+ try {
747
+ return this.validateSync(e, t), !0;
748
+ } catch (r) {
749
+ if (F.isError(r)) return !1;
750
+ throw r;
751
+ }
752
+ }
753
+ _getDefault(e) {
754
+ let t = this.spec.default;
755
+ return t == null ? t : typeof t == "function" ? t.call(this, e) : R(t);
756
+ }
757
+ getDefault(e) {
758
+ return this.resolve(e || {})._getDefault(e);
759
+ }
760
+ default(e) {
761
+ return arguments.length === 0 ? this._getDefault() : this.clone({
762
+ default: e
763
+ });
764
+ }
765
+ strict(e = !0) {
766
+ return this.clone({
767
+ strict: e
768
+ });
769
+ }
770
+ nullability(e, t) {
771
+ const r = this.clone({
772
+ nullable: e
773
+ });
774
+ return r.internalTests.nullable = M({
775
+ message: t,
776
+ name: "nullable",
777
+ test(s) {
778
+ return s === null ? this.schema.spec.nullable : !0;
779
+ }
780
+ }), r;
781
+ }
782
+ optionality(e, t) {
783
+ const r = this.clone({
784
+ optional: e
785
+ });
786
+ return r.internalTests.optionality = M({
787
+ message: t,
788
+ name: "optionality",
789
+ test(s) {
790
+ return s === void 0 ? this.schema.spec.optional : !0;
791
+ }
792
+ }), r;
793
+ }
794
+ optional() {
795
+ return this.optionality(!0);
796
+ }
797
+ defined(e = $.defined) {
798
+ return this.optionality(!1, e);
799
+ }
800
+ nullable() {
801
+ return this.nullability(!0);
802
+ }
803
+ nonNullable(e = $.notNull) {
804
+ return this.nullability(!1, e);
805
+ }
806
+ required(e = $.required) {
807
+ return this.clone().withMutation((t) => t.nonNullable(e).defined(e));
808
+ }
809
+ notRequired() {
810
+ return this.clone().withMutation((e) => e.nullable().optional());
811
+ }
812
+ transform(e) {
813
+ let t = this.clone();
814
+ return t.transforms.push(e), t;
815
+ }
816
+ /**
817
+ * Adds a test function to the schema's queue of tests.
818
+ * tests can be exclusive or non-exclusive.
819
+ *
820
+ * - exclusive tests, will replace any existing tests of the same name.
821
+ * - non-exclusive: can be stacked
822
+ *
823
+ * If a non-exclusive test is added to a schema with an exclusive test of the same name
824
+ * the exclusive test is removed and further tests of the same name will be stacked.
825
+ *
826
+ * If an exclusive test is added to a schema with non-exclusive tests of the same name
827
+ * the previous tests are removed and further tests of the same name will replace each other.
828
+ */
829
+ test(...e) {
830
+ let t;
831
+ if (e.length === 1 ? typeof e[0] == "function" ? t = {
832
+ test: e[0]
833
+ } : t = e[0] : e.length === 2 ? t = {
834
+ name: e[0],
835
+ test: e[1]
836
+ } : t = {
837
+ name: e[0],
838
+ message: e[1],
839
+ test: e[2]
840
+ }, t.message === void 0 && (t.message = $.default), typeof t.test != "function") throw new TypeError("`test` is a required parameters");
841
+ let r = this.clone(), s = M(t), i = t.exclusive || t.name && r.exclusiveTests[t.name] === !0;
842
+ if (t.exclusive && !t.name)
843
+ throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
844
+ return t.name && (r.exclusiveTests[t.name] = !!t.exclusive), r.tests = r.tests.filter((a) => !(a.OPTIONS.name === t.name && (i || a.OPTIONS.test === s.OPTIONS.test))), r.tests.push(s), r;
845
+ }
846
+ when(e, t) {
847
+ !Array.isArray(e) && typeof e != "string" && (t = e, e = ".");
848
+ let r = this.clone(), s = be(e).map((i) => new P(i));
849
+ return s.forEach((i) => {
850
+ i.isSibling && r.deps.push(i.key);
851
+ }), r.conditions.push(typeof t == "function" ? new H(s, t) : H.fromOptions(s, t)), r;
852
+ }
853
+ typeError(e) {
854
+ let t = this.clone();
855
+ return t.internalTests.typeError = M({
856
+ message: e,
857
+ name: "typeError",
858
+ skipAbsent: !0,
859
+ test(r) {
860
+ return this.schema._typeCheck(r) ? !0 : this.createError({
861
+ params: {
862
+ type: this.schema.type
863
+ }
864
+ });
865
+ }
866
+ }), t;
867
+ }
868
+ oneOf(e, t = $.oneOf) {
869
+ let r = this.clone();
870
+ return e.forEach((s) => {
871
+ r._whitelist.add(s), r._blacklist.delete(s);
872
+ }), r.internalTests.whiteList = M({
873
+ message: t,
874
+ name: "oneOf",
875
+ skipAbsent: !0,
876
+ test(s) {
877
+ let i = this.schema._whitelist, a = i.resolveAll(this.resolve);
878
+ return a.includes(s) ? !0 : this.createError({
879
+ params: {
880
+ values: Array.from(i).join(", "),
881
+ resolved: a
882
+ }
883
+ });
884
+ }
885
+ }), r;
886
+ }
887
+ notOneOf(e, t = $.notOneOf) {
888
+ let r = this.clone();
889
+ return e.forEach((s) => {
890
+ r._blacklist.add(s), r._whitelist.delete(s);
891
+ }), r.internalTests.blacklist = M({
892
+ message: t,
893
+ name: "notOneOf",
894
+ test(s) {
895
+ let i = this.schema._blacklist, a = i.resolveAll(this.resolve);
896
+ return a.includes(s) ? this.createError({
897
+ params: {
898
+ values: Array.from(i).join(", "),
899
+ resolved: a
900
+ }
901
+ }) : !0;
902
+ }
903
+ }), r;
904
+ }
905
+ strip(e = !0) {
906
+ let t = this.clone();
907
+ return t.spec.strip = e, t;
908
+ }
909
+ /**
910
+ * Return a serialized description of the schema including validations, flags, types etc.
911
+ *
912
+ * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
913
+ */
914
+ describe(e) {
915
+ const t = (e ? this.resolve(e) : this).clone(), {
916
+ label: r,
917
+ meta: s,
918
+ optional: i,
919
+ nullable: a
920
+ } = t.spec;
921
+ return {
922
+ meta: s,
923
+ label: r,
924
+ optional: i,
925
+ nullable: a,
926
+ default: t.getDefault(e),
927
+ type: t.type,
928
+ oneOf: t._whitelist.describe(),
929
+ notOneOf: t._blacklist.describe(),
930
+ tests: t.tests.map((o) => ({
931
+ name: o.OPTIONS.name,
932
+ params: o.OPTIONS.params
933
+ })).filter((o, d, l) => l.findIndex((f) => f.name === o.name) === d)
934
+ };
935
+ }
936
+ }
937
+ S.prototype.__isYupSchema__ = !0;
938
+ for (const n of ["validate", "validateSync"]) S.prototype[`${n}At`] = function(e, t, r = {}) {
939
+ const {
940
+ parent: s,
941
+ parentPath: i,
942
+ schema: a
943
+ } = Ge(this, e, t, r.context);
944
+ return a[n](s && s[i], Object.assign({}, r, {
945
+ parent: s,
946
+ path: e
947
+ }));
948
+ };
949
+ for (const n of ["equals", "is"]) S.prototype[n] = S.prototype.oneOf;
950
+ for (const n of ["not", "nope"]) S.prototype[n] = S.prototype.notOneOf;
951
+ const He = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
952
+ function Ke(n) {
953
+ const e = re(n);
954
+ if (!e) return Date.parse ? Date.parse(n) : Number.NaN;
955
+ if (e.z === void 0 && e.plusMinus === void 0)
956
+ return new Date(e.year, e.month, e.day, e.hour, e.minute, e.second, e.millisecond).valueOf();
957
+ let t = 0;
958
+ return e.z !== "Z" && e.plusMinus !== void 0 && (t = e.hourOffset * 60 + e.minuteOffset, e.plusMinus === "+" && (t = 0 - t)), Date.UTC(e.year, e.month, e.day, e.hour, e.minute + t, e.second, e.millisecond);
959
+ }
960
+ function re(n) {
961
+ var e, t;
962
+ const r = He.exec(n);
963
+ return r ? {
964
+ year: k(r[1]),
965
+ month: k(r[2], 1) - 1,
966
+ day: k(r[3], 1),
967
+ hour: k(r[4]),
968
+ minute: k(r[5]),
969
+ second: k(r[6]),
970
+ millisecond: r[7] ? (
971
+ // allow arbitrary sub-second precision beyond milliseconds
972
+ k(r[7].substring(0, 3))
973
+ ) : 0,
974
+ precision: (e = (t = r[7]) == null ? void 0 : t.length) != null ? e : void 0,
975
+ z: r[8] || void 0,
976
+ plusMinus: r[9] || void 0,
977
+ hourOffset: k(r[10]),
978
+ minuteOffset: k(r[11])
979
+ } : null;
980
+ }
981
+ function k(n, e = 0) {
982
+ return Number(n) || e;
983
+ }
984
+ let Xe = (
985
+ // eslint-disable-next-line
986
+ /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
987
+ ), Je = (
988
+ // eslint-disable-next-line
989
+ /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
990
+ ), Qe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, We = "^\\d{4}-\\d{2}-\\d{2}", et = "\\d{2}:\\d{2}:\\d{2}", tt = "(([+-]\\d{2}(:?\\d{2})?)|Z)", rt = new RegExp(`${We}T${et}(\\.\\d+)?${tt}$`), nt = (n) => N(n) || n === n.trim(), st = {}.toString();
991
+ function A() {
992
+ return new we();
993
+ }
994
+ class we extends S {
995
+ constructor() {
996
+ super({
997
+ type: "string",
998
+ check(e) {
999
+ return e instanceof String && (e = e.valueOf()), typeof e == "string";
1000
+ }
1001
+ }), this.withMutation(() => {
1002
+ this.transform((e, t, r) => {
1003
+ if (!r.spec.coerce || r.isType(e) || Array.isArray(e)) return e;
1004
+ const s = e != null && e.toString ? e.toString() : e;
1005
+ return s === st ? e : s;
1006
+ });
1007
+ });
1008
+ }
1009
+ required(e) {
1010
+ return super.required(e).withMutation((t) => t.test({
1011
+ message: e || $.required,
1012
+ name: "required",
1013
+ skipAbsent: !0,
1014
+ test: (r) => !!r.length
1015
+ }));
1016
+ }
1017
+ notRequired() {
1018
+ return super.notRequired().withMutation((e) => (e.tests = e.tests.filter((t) => t.OPTIONS.name !== "required"), e));
1019
+ }
1020
+ length(e, t = _.length) {
1021
+ return this.test({
1022
+ message: t,
1023
+ name: "length",
1024
+ exclusive: !0,
1025
+ params: {
1026
+ length: e
1027
+ },
1028
+ skipAbsent: !0,
1029
+ test(r) {
1030
+ return r.length === this.resolve(e);
1031
+ }
1032
+ });
1033
+ }
1034
+ min(e, t = _.min) {
1035
+ return this.test({
1036
+ message: t,
1037
+ name: "min",
1038
+ exclusive: !0,
1039
+ params: {
1040
+ min: e
1041
+ },
1042
+ skipAbsent: !0,
1043
+ test(r) {
1044
+ return r.length >= this.resolve(e);
1045
+ }
1046
+ });
1047
+ }
1048
+ max(e, t = _.max) {
1049
+ return this.test({
1050
+ name: "max",
1051
+ exclusive: !0,
1052
+ message: t,
1053
+ params: {
1054
+ max: e
1055
+ },
1056
+ skipAbsent: !0,
1057
+ test(r) {
1058
+ return r.length <= this.resolve(e);
1059
+ }
1060
+ });
1061
+ }
1062
+ matches(e, t) {
1063
+ let r = !1, s, i;
1064
+ return t && (typeof t == "object" ? {
1065
+ excludeEmptyString: r = !1,
1066
+ message: s,
1067
+ name: i
1068
+ } = t : s = t), this.test({
1069
+ name: i || "matches",
1070
+ message: s || _.matches,
1071
+ params: {
1072
+ regex: e
1073
+ },
1074
+ skipAbsent: !0,
1075
+ test: (a) => a === "" && r || a.search(e) !== -1
1076
+ });
1077
+ }
1078
+ email(e = _.email) {
1079
+ return this.matches(Xe, {
1080
+ name: "email",
1081
+ message: e,
1082
+ excludeEmptyString: !0
1083
+ });
1084
+ }
1085
+ url(e = _.url) {
1086
+ return this.matches(Je, {
1087
+ name: "url",
1088
+ message: e,
1089
+ excludeEmptyString: !0
1090
+ });
1091
+ }
1092
+ uuid(e = _.uuid) {
1093
+ return this.matches(Qe, {
1094
+ name: "uuid",
1095
+ message: e,
1096
+ excludeEmptyString: !1
1097
+ });
1098
+ }
1099
+ datetime(e) {
1100
+ let t = "", r, s;
1101
+ return e && (typeof e == "object" ? {
1102
+ message: t = "",
1103
+ allowOffset: r = !1,
1104
+ precision: s = void 0
1105
+ } = e : t = e), this.matches(rt, {
1106
+ name: "datetime",
1107
+ message: t || _.datetime,
1108
+ excludeEmptyString: !0
1109
+ }).test({
1110
+ name: "datetime_offset",
1111
+ message: t || _.datetime_offset,
1112
+ params: {
1113
+ allowOffset: r
1114
+ },
1115
+ skipAbsent: !0,
1116
+ test: (i) => {
1117
+ if (!i || r) return !0;
1118
+ const a = re(i);
1119
+ return a ? !!a.z : !1;
1120
+ }
1121
+ }).test({
1122
+ name: "datetime_precision",
1123
+ message: t || _.datetime_precision,
1124
+ params: {
1125
+ precision: s
1126
+ },
1127
+ skipAbsent: !0,
1128
+ test: (i) => {
1129
+ if (!i || s == null) return !0;
1130
+ const a = re(i);
1131
+ return a ? a.precision === s : !1;
1132
+ }
1133
+ });
1134
+ }
1135
+ //-- transforms --
1136
+ ensure() {
1137
+ return this.default("").transform((e) => e === null ? "" : e);
1138
+ }
1139
+ trim(e = _.trim) {
1140
+ return this.transform((t) => t != null ? t.trim() : t).test({
1141
+ message: e,
1142
+ name: "trim",
1143
+ test: nt
1144
+ });
1145
+ }
1146
+ lowercase(e = _.lowercase) {
1147
+ return this.transform((t) => N(t) ? t : t.toLowerCase()).test({
1148
+ message: e,
1149
+ name: "string_case",
1150
+ exclusive: !0,
1151
+ skipAbsent: !0,
1152
+ test: (t) => N(t) || t === t.toLowerCase()
1153
+ });
1154
+ }
1155
+ uppercase(e = _.uppercase) {
1156
+ return this.transform((t) => N(t) ? t : t.toUpperCase()).test({
1157
+ message: e,
1158
+ name: "string_case",
1159
+ exclusive: !0,
1160
+ skipAbsent: !0,
1161
+ test: (t) => N(t) || t === t.toUpperCase()
1162
+ });
1163
+ }
1164
+ }
1165
+ A.prototype = we.prototype;
1166
+ let it = /* @__PURE__ */ new Date(""), at = (n) => Object.prototype.toString.call(n) === "[object Date]";
1167
+ class se extends S {
1168
+ constructor() {
1169
+ super({
1170
+ type: "date",
1171
+ check(e) {
1172
+ return at(e) && !isNaN(e.getTime());
1173
+ }
1174
+ }), this.withMutation(() => {
1175
+ this.transform((e, t, r) => !r.spec.coerce || r.isType(e) || e === null ? e : (e = Ke(e), isNaN(e) ? se.INVALID_DATE : new Date(e)));
1176
+ });
1177
+ }
1178
+ prepareParam(e, t) {
1179
+ let r;
1180
+ if (P.isRef(e))
1181
+ r = e;
1182
+ else {
1183
+ let s = this.cast(e);
1184
+ if (!this._typeCheck(s)) throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);
1185
+ r = s;
1186
+ }
1187
+ return r;
1188
+ }
1189
+ min(e, t = te.min) {
1190
+ let r = this.prepareParam(e, "min");
1191
+ return this.test({
1192
+ message: t,
1193
+ name: "min",
1194
+ exclusive: !0,
1195
+ params: {
1196
+ min: e
1197
+ },
1198
+ skipAbsent: !0,
1199
+ test(s) {
1200
+ return s >= this.resolve(r);
1201
+ }
1202
+ });
1203
+ }
1204
+ max(e, t = te.max) {
1205
+ let r = this.prepareParam(e, "max");
1206
+ return this.test({
1207
+ message: t,
1208
+ name: "max",
1209
+ exclusive: !0,
1210
+ params: {
1211
+ max: e
1212
+ },
1213
+ skipAbsent: !0,
1214
+ test(s) {
1215
+ return s <= this.resolve(r);
1216
+ }
1217
+ });
1218
+ }
1219
+ }
1220
+ se.INVALID_DATE = it;
1221
+ function ut(n, e = []) {
1222
+ let t = [], r = /* @__PURE__ */ new Set(), s = new Set(e.map(([a, u]) => `${a}-${u}`));
1223
+ function i(a, u) {
1224
+ let o = U.split(a)[0];
1225
+ r.add(o), s.has(`${u}-${o}`) || t.push([u, o]);
1226
+ }
1227
+ for (const a of Object.keys(n)) {
1228
+ let u = n[a];
1229
+ r.add(a), P.isRef(u) && u.isSibling ? i(u.path, a) : ne(u) && "deps" in u && u.deps.forEach((o) => i(o, a));
1230
+ }
1231
+ return Ne.array(Array.from(r), t).reverse();
1232
+ }
1233
+ function pe(n, e) {
1234
+ let t = 1 / 0;
1235
+ return n.some((r, s) => {
1236
+ var i;
1237
+ if ((i = e.path) != null && i.includes(r))
1238
+ return t = s, !0;
1239
+ }), t;
1240
+ }
1241
+ function ve(n) {
1242
+ return (e, t) => pe(n, e) - pe(n, t);
1243
+ }
1244
+ const ot = (n, e, t) => {
1245
+ if (typeof n != "string")
1246
+ return n;
1247
+ let r = n;
1248
+ try {
1249
+ r = JSON.parse(n);
1250
+ } catch {
1251
+ }
1252
+ return t.isType(r) ? r : n;
1253
+ };
1254
+ function Y(n) {
1255
+ if ("fields" in n) {
1256
+ const e = {};
1257
+ for (const [t, r] of Object.entries(n.fields))
1258
+ e[t] = Y(r);
1259
+ return n.setFields(e);
1260
+ }
1261
+ if (n.type === "array") {
1262
+ const e = n.optional();
1263
+ return e.innerType && (e.innerType = Y(e.innerType)), e;
1264
+ }
1265
+ return n.type === "tuple" ? n.optional().clone({
1266
+ types: n.spec.types.map(Y)
1267
+ }) : "optional" in n ? n.optional() : n;
1268
+ }
1269
+ const lt = (n, e) => {
1270
+ const t = [...U.normalizePath(e)];
1271
+ if (t.length === 1) return t[0] in n;
1272
+ let r = t.pop(), s = U.getter(U.join(t), !0)(n);
1273
+ return !!(s && r in s);
1274
+ };
1275
+ let me = (n) => Object.prototype.toString.call(n) === "[object Object]";
1276
+ function ye(n, e) {
1277
+ let t = Object.keys(n.fields);
1278
+ return Object.keys(e).filter((r) => t.indexOf(r) === -1);
1279
+ }
1280
+ const ct = ve([]);
1281
+ function _e(n) {
1282
+ return new Fe(n);
1283
+ }
1284
+ class Fe extends S {
1285
+ constructor(e) {
1286
+ super({
1287
+ type: "object",
1288
+ check(t) {
1289
+ return me(t) || typeof t == "function";
1290
+ }
1291
+ }), this.fields = /* @__PURE__ */ Object.create(null), this._sortErrors = ct, this._nodes = [], this._excludedEdges = [], this.withMutation(() => {
1292
+ e && this.shape(e);
1293
+ });
1294
+ }
1295
+ _cast(e, t = {}) {
1296
+ var r;
1297
+ let s = super._cast(e, t);
1298
+ if (s === void 0) return this.getDefault(t);
1299
+ if (!this._typeCheck(s)) return s;
1300
+ let i = this.fields, a = (r = t.stripUnknown) != null ? r : this.spec.noUnknown, u = [].concat(this._nodes, Object.keys(s).filter((f) => !this._nodes.includes(f))), o = {}, d = Object.assign({}, t, {
1301
+ parent: o,
1302
+ __validating: t.__validating || !1
1303
+ }), l = !1;
1304
+ for (const f of u) {
1305
+ let h = i[f], m = f in s;
1306
+ if (h) {
1307
+ let E, x = s[f];
1308
+ d.path = (t.path ? `${t.path}.` : "") + f, h = h.resolve({
1309
+ value: x,
1310
+ context: t.context,
1311
+ parent: o
1312
+ });
1313
+ let v = h instanceof S ? h.spec : void 0, c = v == null ? void 0 : v.strict;
1314
+ if (v != null && v.strip) {
1315
+ l = l || f in s;
1316
+ continue;
1317
+ }
1318
+ E = !t.__validating || !c ? (
1319
+ // TODO: use _cast, this is double resolving
1320
+ h.cast(s[f], d)
1321
+ ) : s[f], E !== void 0 && (o[f] = E);
1322
+ } else m && !a && (o[f] = s[f]);
1323
+ (m !== f in o || o[f] !== s[f]) && (l = !0);
1324
+ }
1325
+ return l ? o : s;
1326
+ }
1327
+ _validate(e, t = {}, r, s) {
1328
+ let {
1329
+ from: i = [],
1330
+ originalValue: a = e,
1331
+ recursive: u = this.spec.recursive
1332
+ } = t;
1333
+ t.from = [{
1334
+ schema: this,
1335
+ value: a
1336
+ }, ...i], t.__validating = !0, t.originalValue = a, super._validate(e, t, r, (o, d) => {
1337
+ if (!u || !me(d)) {
1338
+ s(o, d);
1339
+ return;
1340
+ }
1341
+ a = a || d;
1342
+ let l = [];
1343
+ for (let f of this._nodes) {
1344
+ let h = this.fields[f];
1345
+ !h || P.isRef(h) || l.push(h.asNestedTest({
1346
+ options: t,
1347
+ key: f,
1348
+ parent: d,
1349
+ parentPath: t.path,
1350
+ originalParent: a
1351
+ }));
1352
+ }
1353
+ this.runTests({
1354
+ tests: l,
1355
+ value: d,
1356
+ originalValue: a,
1357
+ options: t
1358
+ }, r, (f) => {
1359
+ s(f.sort(this._sortErrors).concat(o), d);
1360
+ });
1361
+ });
1362
+ }
1363
+ clone(e) {
1364
+ const t = super.clone(e);
1365
+ return t.fields = Object.assign({}, this.fields), t._nodes = this._nodes, t._excludedEdges = this._excludedEdges, t._sortErrors = this._sortErrors, t;
1366
+ }
1367
+ concat(e) {
1368
+ let t = super.concat(e), r = t.fields;
1369
+ for (let [s, i] of Object.entries(this.fields)) {
1370
+ const a = r[s];
1371
+ r[s] = a === void 0 ? i : a;
1372
+ }
1373
+ return t.withMutation((s) => (
1374
+ // XXX: excludes here is wrong
1375
+ s.setFields(r, [...this._excludedEdges, ...e._excludedEdges])
1376
+ ));
1377
+ }
1378
+ _getDefault(e) {
1379
+ if ("default" in this.spec)
1380
+ return super._getDefault(e);
1381
+ if (!this._nodes.length)
1382
+ return;
1383
+ let t = {};
1384
+ return this._nodes.forEach((r) => {
1385
+ var s;
1386
+ const i = this.fields[r];
1387
+ let a = e;
1388
+ (s = a) != null && s.value && (a = Object.assign({}, a, {
1389
+ parent: a.value,
1390
+ value: a.value[r]
1391
+ })), t[r] = i && "getDefault" in i ? i.getDefault(a) : void 0;
1392
+ }), t;
1393
+ }
1394
+ setFields(e, t) {
1395
+ let r = this.clone();
1396
+ return r.fields = e, r._nodes = ut(e, t), r._sortErrors = ve(Object.keys(e)), t && (r._excludedEdges = t), r;
1397
+ }
1398
+ shape(e, t = []) {
1399
+ return this.clone().withMutation((r) => {
1400
+ let s = r._excludedEdges;
1401
+ return t.length && (Array.isArray(t[0]) || (t = [t]), s = [...r._excludedEdges, ...t]), r.setFields(Object.assign(r.fields, e), s);
1402
+ });
1403
+ }
1404
+ partial() {
1405
+ const e = {};
1406
+ for (const [t, r] of Object.entries(this.fields))
1407
+ e[t] = "optional" in r && r.optional instanceof Function ? r.optional() : r;
1408
+ return this.setFields(e);
1409
+ }
1410
+ deepPartial() {
1411
+ return Y(this);
1412
+ }
1413
+ pick(e) {
1414
+ const t = {};
1415
+ for (const r of e)
1416
+ this.fields[r] && (t[r] = this.fields[r]);
1417
+ return this.setFields(t, this._excludedEdges.filter(([r, s]) => e.includes(r) && e.includes(s)));
1418
+ }
1419
+ omit(e) {
1420
+ const t = [];
1421
+ for (const r of Object.keys(this.fields))
1422
+ e.includes(r) || t.push(r);
1423
+ return this.pick(t);
1424
+ }
1425
+ from(e, t, r) {
1426
+ let s = U.getter(e, !0);
1427
+ return this.transform((i) => {
1428
+ if (!i) return i;
1429
+ let a = i;
1430
+ return lt(i, e) && (a = Object.assign({}, i), r || delete a[e], a[t] = s(i)), a;
1431
+ });
1432
+ }
1433
+ /** Parse an input JSON string to an object */
1434
+ json() {
1435
+ return this.transform(ot);
1436
+ }
1437
+ /**
1438
+ * Similar to `noUnknown` but only validates that an object is the right shape without stripping the unknown keys
1439
+ */
1440
+ exact(e) {
1441
+ return this.test({
1442
+ name: "exact",
1443
+ exclusive: !0,
1444
+ message: e || B.exact,
1445
+ test(t) {
1446
+ if (t == null) return !0;
1447
+ const r = ye(this.schema, t);
1448
+ return r.length === 0 || this.createError({
1449
+ params: {
1450
+ properties: r.join(", ")
1451
+ }
1452
+ });
1453
+ }
1454
+ });
1455
+ }
1456
+ stripUnknown() {
1457
+ return this.clone({
1458
+ noUnknown: !0
1459
+ });
1460
+ }
1461
+ noUnknown(e = !0, t = B.noUnknown) {
1462
+ typeof e != "boolean" && (t = e, e = !0);
1463
+ let r = this.test({
1464
+ name: "noUnknown",
1465
+ exclusive: !0,
1466
+ message: t,
1467
+ test(s) {
1468
+ if (s == null) return !0;
1469
+ const i = ye(this.schema, s);
1470
+ return !e || i.length === 0 || this.createError({
1471
+ params: {
1472
+ unknown: i.join(", ")
1473
+ }
1474
+ });
1475
+ }
1476
+ });
1477
+ return r.spec.noUnknown = e, r;
1478
+ }
1479
+ unknown(e = !0, t = B.noUnknown) {
1480
+ return this.noUnknown(!e, t);
1481
+ }
1482
+ transformKeys(e) {
1483
+ return this.transform((t) => {
1484
+ if (!t) return t;
1485
+ const r = {};
1486
+ for (const s of Object.keys(t)) r[e(s)] = t[s];
1487
+ return r;
1488
+ });
1489
+ }
1490
+ camelCase() {
1491
+ return this.transformKeys(W.camelCase);
1492
+ }
1493
+ snakeCase() {
1494
+ return this.transformKeys(W.snakeCase);
1495
+ }
1496
+ constantCase() {
1497
+ return this.transformKeys((e) => W.snakeCase(e).toUpperCase());
1498
+ }
1499
+ describe(e) {
1500
+ const t = (e ? this.resolve(e) : this).clone(), r = super.describe(e);
1501
+ r.fields = {};
1502
+ for (const [i, a] of Object.entries(t.fields)) {
1503
+ var s;
1504
+ let u = e;
1505
+ (s = u) != null && s.value && (u = Object.assign({}, u, {
1506
+ parent: u.value,
1507
+ value: u.value[i]
1508
+ })), r.fields[i] = a.describe(u);
1509
+ }
1510
+ return r;
1511
+ }
1512
+ }
1513
+ _e.prototype = Fe.prototype;
1514
+ const ft = "#000639", dt = '<svg width="40" height="41" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 10.5C0 4.977 4.477.5 10 .5h20c5.523 0 10 4.477 10 10v20c0 5.523-4.477 10-10 10H10c-5.523 0-10-4.477-10-10v-20Z" fill="#F1F1F1"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.927 15.78a.75.75 0 1 0-1.06-1.06l-4.793 4.793-4.793-4.793a.75.75 0 0 0-1.061 1.06l4.793 4.793-4.793 4.793a.75.75 0 1 0 1.06 1.061l4.794-4.793 4.793 4.793a.75.75 0 0 0 1.06-1.06l-4.793-4.794 4.793-4.793Z" fill="#000639"/></svg>';
1515
+ function ht() {
1516
+ if (document.head.querySelector(`#${X}`)) return;
1517
+ const e = document.createElement("style");
1518
+ e.id = X, e.dataset.testid = X, document.head.appendChild(e), e.textContent = `
1519
+
1520
+ #${q}, #${q} * {
1521
+ margin: 0;
1522
+ padding: 0px;
1523
+ box-sizing: border-box;
1524
+ }
1525
+
1526
+ #${G} {
1527
+ position: absolute;
1528
+ top: 50%;
1529
+ left: 50%;
1530
+ transform: translate(-50%, -50%);
1531
+ }
1532
+
1533
+ #${L} {
1534
+ position: absolute;
1535
+ top: 50%;
1536
+ left: 50%;
1537
+ transform: translate(-50%, -50%);
1538
+ width: 480px;
1539
+ max-width: 100%;
1540
+ height: 100dvh;
1541
+ z-index: 20;
1542
+ border-radius: 0px;
1543
+
1544
+ @media (min-width: 640px) {
1545
+ height: 680px;
1546
+ border-radius: 24px;
1547
+ }
1548
+ }
1549
+ `;
1550
+ }
1551
+ function pt(n) {
1552
+ _e({
1553
+ fiatAmount: A().optional(),
1554
+ fiatCurrency: A().optional(),
1555
+ cryptoAmount: A().optional(),
1556
+ cryptoCurrency: A().optional(),
1557
+ publicKey: A().required("Public key is required"),
1558
+ redirectUrl: A().optional(),
1559
+ side: A().oneOf(["buy", "sell"]).required()
1560
+ }).validateSync(n, { abortEarly: !1 });
1561
+ }
1562
+ function mt() {
1563
+ const n = document.createElement("div");
1564
+ return n.id = q, n.dataset.testid = q, n.style.position = "fixed", n.style.top = "0px", n.style.left = "0px", n.style.width = "100%", n.style.height = "100%", n.style.zIndex = "999999999", n.style.backgroundColor = "rgba(0, 0, 0, 0.4)", n;
1565
+ }
1566
+ function yt() {
1567
+ const n = document.createElement("button");
1568
+ return n.id = ee, n.dataset.testid = ee, n.setAttribute("type", "button"), n.style.width = "40px", n.style.height = "40px", n.style.position = "absolute", n.style.right = "0", n.style.zIndex = "40", n.style.backgroundColor = "transparent", n.style.border = "none", n.innerHTML = dt, n;
1569
+ }
1570
+ function bt() {
1571
+ const n = document.createElement("div");
1572
+ return n.id = G, n.dataset.testid = G, n.style.width = "40px", n.style.height = "40px", n.style.backgroundColor = "transparent", n.style.border = `2px solid ${ft}`, n.style.borderLeftColor = "transparent", n.style.borderBottomColor = "transparent", n.style.borderRadius = "100%", n.animate && n.animate(
1573
+ [{ transform: "rotate(0)" }, { transform: "rotate(360deg)" }],
1574
+ {
1575
+ duration: 300,
1576
+ iterations: 1 / 0
1577
+ }
1578
+ ), n;
1579
+ }
1580
+ function xt() {
1581
+ const n = document.createElement("iframe");
1582
+ return n.dataset.testid = L, n.name = L, n.id = L, n.allow = "clipboard-write self undefined", n;
1583
+ }
1584
+ function gt(n) {
1585
+ const e = (n.side === "buy", void 0), t = document.createElement("form");
1586
+ t.target = L, t.dataset.testid = Oe, t.action = e ?? "", t.method = "GET", t.style.display = "none", ((u) => {
1587
+ const o = process.env.NODE_ENV === "production", d = ["onSuccess", "onClose"];
1588
+ o && d.push("side");
1589
+ for (const l in u) {
1590
+ if (!Object.prototype.hasOwnProperty.call(u, l) || d.includes(l)) continue;
1591
+ const f = u[l], h = document.createElement("input");
1592
+ h.name = l, h.value = String(f), t.appendChild(h);
1593
+ }
1594
+ })(n);
1595
+ const s = "POPUP", i = document.createElement("input");
1596
+ i.name = "displayMode", i.value = s;
1597
+ const a = document.createElement("input");
1598
+ return a.name = "parentOrigin", a.value = window.location.origin, t.appendChild(i), t.appendChild(a), t;
1599
+ }
1600
+ class wt {
1601
+ constructor(e) {
1602
+ z(this, "payload");
1603
+ z(this, "container", null);
1604
+ z(this, "boundClose");
1605
+ z(this, "onMessage", (e) => {
1606
+ const t = process.env.NODE_ENV === "test", r = (this.payload.side === "buy", void 0);
1607
+ if (t) {
1608
+ if (e.source !== window) return;
1609
+ } else {
1610
+ if (!r) return;
1611
+ const s = new URL(r);
1612
+ if (e.origin !== s.origin) return;
1613
+ }
1614
+ if (this.payload) {
1615
+ if (e.data.status === Te) {
1616
+ const s = document.getElementById(G);
1617
+ s && s.remove();
1618
+ }
1619
+ e.data.status === oe && (this.payload.onClose && this.payload.onClose(e.data), this.cleanup()), e.data.status === ke && (this.payload.onSuccess && this.payload.onSuccess(e.data), this.cleanup());
1620
+ }
1621
+ });
1622
+ ht(), pt(e), this.payload = e, this.boundClose = this.close.bind(this);
1623
+ }
1624
+ show() {
1625
+ this.container = mt();
1626
+ const e = bt(), t = yt();
1627
+ t.addEventListener("click", this.boundClose), this.container.appendChild(e), this.container.appendChild(t);
1628
+ const r = xt();
1629
+ this.container.appendChild(r), document.body.appendChild(this.container);
1630
+ const s = gt(this.payload);
1631
+ this.container.appendChild(s), s.submit(), window.addEventListener("message", this.onMessage);
1632
+ }
1633
+ close() {
1634
+ this.payload.onClose && this.payload.onClose({
1635
+ status: oe,
1636
+ data: { reference: "" }
1637
+ }), this.cleanup();
1638
+ }
1639
+ cleanup() {
1640
+ const e = document.getElementById(q), t = document.getElementById(ee);
1641
+ t && t.removeEventListener("click", this.boundClose), window.removeEventListener("message", this.onMessage), e && document.body.removeChild(e);
1642
+ }
1643
+ }
1644
+ export {
1645
+ wt as BushaRampWidget
1646
+ };