@reevit/svelte 0.1.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/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/index.d.ts +337 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +2806 -0
- package/dist/styles.css +0 -0
- package/dist/svelte.css +0 -0
- package/package.json +60 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2806 @@
|
|
|
1
|
+
import { createEventDispatcher as $t, onMount as br, onDestroy as wr } from "svelte";
|
|
2
|
+
import { createInitialState as gr, ReevitAPIClient as Er, generateReference as Sr, detectCountryFromCurrency as Pr, reevitReducer as kr, formatAmount as mn, cn as ge, validatePhone as qt, detectNetwork as Rr, createThemeVariables as Ir } from "@reevit/core";
|
|
3
|
+
import { ReevitAPIClient as Li, cn as ji, createInitialState as Ui, createReevitClient as qi, detectCountryFromCurrency as zi, detectNetwork as Ki, formatAmount as Bi, formatPhone as Vi, reevitReducer as Hi, validatePhone as Yi } from "@reevit/core";
|
|
4
|
+
const Cr = "5";
|
|
5
|
+
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Cr);
|
|
6
|
+
let st = !1, Tr = !1;
|
|
7
|
+
function Mr() {
|
|
8
|
+
st = !0;
|
|
9
|
+
}
|
|
10
|
+
Mr();
|
|
11
|
+
const xr = 1, Ar = 2, Nr = 16, Or = 1, Dr = 2, Fr = 4, Lr = 8, jr = 16, Ur = 1, qr = 2, H = /* @__PURE__ */ Symbol(), Vt = !1;
|
|
12
|
+
var Tn = Array.isArray, zr = Array.prototype.indexOf, en = Array.from, Mn = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, Kr = Object.getOwnPropertyDescriptors, Br = Object.prototype, Vr = Array.prototype, xn = Object.getPrototypeOf;
|
|
13
|
+
const Ht = () => {
|
|
14
|
+
};
|
|
15
|
+
function Hr(e) {
|
|
16
|
+
return e();
|
|
17
|
+
}
|
|
18
|
+
function Yt(e) {
|
|
19
|
+
for (var t = 0; t < e.length; t++)
|
|
20
|
+
e[t]();
|
|
21
|
+
}
|
|
22
|
+
function An() {
|
|
23
|
+
var e, t, n = new Promise((r, i) => {
|
|
24
|
+
e = r, t = i;
|
|
25
|
+
});
|
|
26
|
+
return { promise: n, resolve: e, reject: t };
|
|
27
|
+
}
|
|
28
|
+
const K = 2, Nn = 4, It = 8, Yr = 1 << 24, pe = 16, he = 32, Ve = 64, tn = 128, ae = 512, q = 1024, J = 2048, ie = 4096, Q = 8192, de = 16384, nn = 32768, et = 65536, yn = 1 << 17, On = 1 << 18, Ct = 1 << 19, Dn = 1 << 20, Ee = 1 << 25, Ne = 32768, Gt = 1 << 21, rn = 1 << 22, Se = 1 << 23, Ke = /* @__PURE__ */ Symbol("$state"), Gr = /* @__PURE__ */ Symbol("legacy props"), qe = new class extends Error {
|
|
29
|
+
name = "StaleReactionError";
|
|
30
|
+
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
|
|
31
|
+
}();
|
|
32
|
+
function Wr() {
|
|
33
|
+
throw new Error("https://svelte.dev/e/async_derived_orphan");
|
|
34
|
+
}
|
|
35
|
+
function Zr(e) {
|
|
36
|
+
throw new Error("https://svelte.dev/e/effect_in_teardown");
|
|
37
|
+
}
|
|
38
|
+
function Jr() {
|
|
39
|
+
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
|
|
40
|
+
}
|
|
41
|
+
function Xr(e) {
|
|
42
|
+
throw new Error("https://svelte.dev/e/effect_orphan");
|
|
43
|
+
}
|
|
44
|
+
function Qr() {
|
|
45
|
+
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
46
|
+
}
|
|
47
|
+
function $r(e) {
|
|
48
|
+
throw new Error("https://svelte.dev/e/props_invalid_value");
|
|
49
|
+
}
|
|
50
|
+
function ea() {
|
|
51
|
+
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
|
|
52
|
+
}
|
|
53
|
+
function ta() {
|
|
54
|
+
throw new Error("https://svelte.dev/e/state_prototype_fixed");
|
|
55
|
+
}
|
|
56
|
+
function na() {
|
|
57
|
+
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
|
|
58
|
+
}
|
|
59
|
+
function Fn(e) {
|
|
60
|
+
return e === this.v;
|
|
61
|
+
}
|
|
62
|
+
function ra(e, t) {
|
|
63
|
+
return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
|
|
64
|
+
}
|
|
65
|
+
function Ln(e) {
|
|
66
|
+
return !ra(e, this.v);
|
|
67
|
+
}
|
|
68
|
+
let U = null;
|
|
69
|
+
function mt(e) {
|
|
70
|
+
U = e;
|
|
71
|
+
}
|
|
72
|
+
function an(e, t = !1, n) {
|
|
73
|
+
U = {
|
|
74
|
+
p: U,
|
|
75
|
+
i: !1,
|
|
76
|
+
c: null,
|
|
77
|
+
e: null,
|
|
78
|
+
s: e,
|
|
79
|
+
x: null,
|
|
80
|
+
l: st && !t ? { s: null, u: null, $: [] } : null
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function sn(e) {
|
|
84
|
+
var t = (
|
|
85
|
+
/** @type {ComponentContext} */
|
|
86
|
+
U
|
|
87
|
+
), n = t.e;
|
|
88
|
+
if (n !== null) {
|
|
89
|
+
t.e = null;
|
|
90
|
+
for (var r of n)
|
|
91
|
+
Zn(r);
|
|
92
|
+
}
|
|
93
|
+
return t.i = !0, U = t.p, /** @type {T} */
|
|
94
|
+
{};
|
|
95
|
+
}
|
|
96
|
+
function ot() {
|
|
97
|
+
return !st || U !== null && U.l === null;
|
|
98
|
+
}
|
|
99
|
+
let Ce = [];
|
|
100
|
+
function jn() {
|
|
101
|
+
var e = Ce;
|
|
102
|
+
Ce = [], Yt(e);
|
|
103
|
+
}
|
|
104
|
+
function Un(e) {
|
|
105
|
+
if (Ce.length === 0 && !Qe) {
|
|
106
|
+
var t = Ce;
|
|
107
|
+
queueMicrotask(() => {
|
|
108
|
+
t === Ce && jn();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
Ce.push(e);
|
|
112
|
+
}
|
|
113
|
+
function aa() {
|
|
114
|
+
for (; Ce.length > 0; )
|
|
115
|
+
jn();
|
|
116
|
+
}
|
|
117
|
+
function ia(e) {
|
|
118
|
+
var t = R;
|
|
119
|
+
if (t === null)
|
|
120
|
+
return g.f |= Se, e;
|
|
121
|
+
if ((t.f & nn) === 0) {
|
|
122
|
+
if ((t.f & tn) === 0)
|
|
123
|
+
throw e;
|
|
124
|
+
t.b.error(e);
|
|
125
|
+
} else
|
|
126
|
+
yt(e, t);
|
|
127
|
+
}
|
|
128
|
+
function yt(e, t) {
|
|
129
|
+
for (; t !== null; ) {
|
|
130
|
+
if ((t.f & tn) !== 0)
|
|
131
|
+
try {
|
|
132
|
+
t.b.error(e);
|
|
133
|
+
return;
|
|
134
|
+
} catch (n) {
|
|
135
|
+
e = n;
|
|
136
|
+
}
|
|
137
|
+
t = t.parent;
|
|
138
|
+
}
|
|
139
|
+
throw e;
|
|
140
|
+
}
|
|
141
|
+
const dt = /* @__PURE__ */ new Set();
|
|
142
|
+
let P = null, ht = null, ne = null, te = [], Tt = null, Wt = !1, Qe = !1;
|
|
143
|
+
class tt {
|
|
144
|
+
committed = !1;
|
|
145
|
+
/**
|
|
146
|
+
* The current values of any sources that are updated in this batch
|
|
147
|
+
* They keys of this map are identical to `this.#previous`
|
|
148
|
+
* @type {Map<Source, any>}
|
|
149
|
+
*/
|
|
150
|
+
current = /* @__PURE__ */ new Map();
|
|
151
|
+
/**
|
|
152
|
+
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
153
|
+
* They keys of this map are identical to `this.#current`
|
|
154
|
+
* @type {Map<Source, any>}
|
|
155
|
+
*/
|
|
156
|
+
previous = /* @__PURE__ */ new Map();
|
|
157
|
+
/**
|
|
158
|
+
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
159
|
+
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
160
|
+
* @type {Set<() => void>}
|
|
161
|
+
*/
|
|
162
|
+
#t = /* @__PURE__ */ new Set();
|
|
163
|
+
/**
|
|
164
|
+
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
165
|
+
* @type {Set<(batch: Batch) => void>}
|
|
166
|
+
*/
|
|
167
|
+
#n = /* @__PURE__ */ new Set();
|
|
168
|
+
/**
|
|
169
|
+
* The number of async effects that are currently in flight
|
|
170
|
+
*/
|
|
171
|
+
#e = 0;
|
|
172
|
+
/**
|
|
173
|
+
* The number of async effects that are currently in flight, _not_ inside a pending boundary
|
|
174
|
+
*/
|
|
175
|
+
#r = 0;
|
|
176
|
+
/**
|
|
177
|
+
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
178
|
+
* TODO replace with Promise.withResolvers once supported widely enough
|
|
179
|
+
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
180
|
+
*/
|
|
181
|
+
#i = null;
|
|
182
|
+
/**
|
|
183
|
+
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
184
|
+
* @type {Set<Effect>}
|
|
185
|
+
*/
|
|
186
|
+
#a = /* @__PURE__ */ new Set();
|
|
187
|
+
/**
|
|
188
|
+
* Deferred effects that are MAYBE_DIRTY
|
|
189
|
+
* @type {Set<Effect>}
|
|
190
|
+
*/
|
|
191
|
+
#s = /* @__PURE__ */ new Set();
|
|
192
|
+
/**
|
|
193
|
+
* A set of branches that still exist, but will be destroyed when this batch
|
|
194
|
+
* is committed — we skip over these during `process`
|
|
195
|
+
* @type {Set<Effect>}
|
|
196
|
+
*/
|
|
197
|
+
skipped_effects = /* @__PURE__ */ new Set();
|
|
198
|
+
is_fork = !1;
|
|
199
|
+
is_deferred() {
|
|
200
|
+
return this.is_fork || this.#r > 0;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
*
|
|
204
|
+
* @param {Effect[]} root_effects
|
|
205
|
+
*/
|
|
206
|
+
process(t) {
|
|
207
|
+
te = [], ht = null, this.apply();
|
|
208
|
+
var n = {
|
|
209
|
+
parent: null,
|
|
210
|
+
effect: null,
|
|
211
|
+
effects: [],
|
|
212
|
+
render_effects: []
|
|
213
|
+
};
|
|
214
|
+
for (const r of t)
|
|
215
|
+
this.#l(r, n);
|
|
216
|
+
this.is_fork || this.#f(), this.is_deferred() ? (this.#o(n.effects), this.#o(n.render_effects)) : (ht = this, P = null, bn(n.render_effects), bn(n.effects), ht = null, this.#i?.resolve()), ne = null;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Traverse the effect tree, executing effects or stashing
|
|
220
|
+
* them for later execution as appropriate
|
|
221
|
+
* @param {Effect} root
|
|
222
|
+
* @param {EffectTarget} target
|
|
223
|
+
*/
|
|
224
|
+
#l(t, n) {
|
|
225
|
+
t.f ^= q;
|
|
226
|
+
for (var r = t.first; r !== null; ) {
|
|
227
|
+
var i = r.f, a = (i & (he | Ve)) !== 0, l = a && (i & q) !== 0, s = l || (i & Q) !== 0 || this.skipped_effects.has(r);
|
|
228
|
+
if ((r.f & tn) !== 0 && r.b?.is_pending() && (n = {
|
|
229
|
+
parent: n,
|
|
230
|
+
effect: r,
|
|
231
|
+
effects: [],
|
|
232
|
+
render_effects: []
|
|
233
|
+
}), !s && r.fn !== null) {
|
|
234
|
+
a ? r.f ^= q : (i & Nn) !== 0 ? n.effects.push(r) : He(r) && ((r.f & pe) !== 0 && this.#a.add(r), Be(r));
|
|
235
|
+
var u = r.first;
|
|
236
|
+
if (u !== null) {
|
|
237
|
+
r = u;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
var o = r.parent;
|
|
242
|
+
for (r = r.next; r === null && o !== null; )
|
|
243
|
+
o === n.effect && (this.#o(n.effects), this.#o(n.render_effects), n = /** @type {EffectTarget} */
|
|
244
|
+
n.parent), r = o.next, o = o.parent;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @param {Effect[]} effects
|
|
249
|
+
*/
|
|
250
|
+
#o(t) {
|
|
251
|
+
for (const n of t)
|
|
252
|
+
(n.f & J) !== 0 ? this.#a.add(n) : (n.f & ie) !== 0 && this.#s.add(n), this.#u(n.deps), z(n, q);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @param {Value[] | null} deps
|
|
256
|
+
*/
|
|
257
|
+
#u(t) {
|
|
258
|
+
if (t !== null)
|
|
259
|
+
for (const n of t)
|
|
260
|
+
(n.f & K) === 0 || (n.f & Ne) === 0 || (n.f ^= Ne, this.#u(
|
|
261
|
+
/** @type {Derived} */
|
|
262
|
+
n.deps
|
|
263
|
+
));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Associate a change to a given source with the current
|
|
267
|
+
* batch, noting its previous and current values
|
|
268
|
+
* @param {Source} source
|
|
269
|
+
* @param {any} value
|
|
270
|
+
*/
|
|
271
|
+
capture(t, n) {
|
|
272
|
+
this.previous.has(t) || this.previous.set(t, n), (t.f & Se) === 0 && (this.current.set(t, t.v), ne?.set(t, t.v));
|
|
273
|
+
}
|
|
274
|
+
activate() {
|
|
275
|
+
P = this, this.apply();
|
|
276
|
+
}
|
|
277
|
+
deactivate() {
|
|
278
|
+
P === this && (P = null, ne = null);
|
|
279
|
+
}
|
|
280
|
+
flush() {
|
|
281
|
+
if (this.activate(), te.length > 0) {
|
|
282
|
+
if (qn(), P !== null && P !== this)
|
|
283
|
+
return;
|
|
284
|
+
} else this.#e === 0 && this.process([]);
|
|
285
|
+
this.deactivate();
|
|
286
|
+
}
|
|
287
|
+
discard() {
|
|
288
|
+
for (const t of this.#n) t(this);
|
|
289
|
+
this.#n.clear();
|
|
290
|
+
}
|
|
291
|
+
#f() {
|
|
292
|
+
if (this.#r === 0) {
|
|
293
|
+
for (const t of this.#t) t();
|
|
294
|
+
this.#t.clear();
|
|
295
|
+
}
|
|
296
|
+
this.#e === 0 && this.#c();
|
|
297
|
+
}
|
|
298
|
+
#c() {
|
|
299
|
+
if (dt.size > 1) {
|
|
300
|
+
this.previous.clear();
|
|
301
|
+
var t = ne, n = !0, r = {
|
|
302
|
+
parent: null,
|
|
303
|
+
effect: null,
|
|
304
|
+
effects: [],
|
|
305
|
+
render_effects: []
|
|
306
|
+
};
|
|
307
|
+
for (const a of dt) {
|
|
308
|
+
if (a === this) {
|
|
309
|
+
n = !1;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const l = [];
|
|
313
|
+
for (const [u, o] of this.current) {
|
|
314
|
+
if (a.current.has(u))
|
|
315
|
+
if (n && o !== a.current.get(u))
|
|
316
|
+
a.current.set(u, o);
|
|
317
|
+
else
|
|
318
|
+
continue;
|
|
319
|
+
l.push(u);
|
|
320
|
+
}
|
|
321
|
+
if (l.length === 0)
|
|
322
|
+
continue;
|
|
323
|
+
const s = [...a.current.keys()].filter((u) => !this.current.has(u));
|
|
324
|
+
if (s.length > 0) {
|
|
325
|
+
var i = te;
|
|
326
|
+
te = [];
|
|
327
|
+
const u = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
328
|
+
for (const d of l)
|
|
329
|
+
zn(d, s, u, o);
|
|
330
|
+
if (te.length > 0) {
|
|
331
|
+
P = a, a.apply();
|
|
332
|
+
for (const d of te)
|
|
333
|
+
a.#l(d, r);
|
|
334
|
+
a.deactivate();
|
|
335
|
+
}
|
|
336
|
+
te = i;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
P = null, ne = t;
|
|
340
|
+
}
|
|
341
|
+
this.committed = !0, dt.delete(this);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
*
|
|
345
|
+
* @param {boolean} blocking
|
|
346
|
+
*/
|
|
347
|
+
increment(t) {
|
|
348
|
+
this.#e += 1, t && (this.#r += 1);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
*
|
|
352
|
+
* @param {boolean} blocking
|
|
353
|
+
*/
|
|
354
|
+
decrement(t) {
|
|
355
|
+
this.#e -= 1, t && (this.#r -= 1), this.revive();
|
|
356
|
+
}
|
|
357
|
+
revive() {
|
|
358
|
+
for (const t of this.#a)
|
|
359
|
+
this.#s.delete(t), z(t, J), Oe(t);
|
|
360
|
+
for (const t of this.#s)
|
|
361
|
+
z(t, ie), Oe(t);
|
|
362
|
+
this.flush();
|
|
363
|
+
}
|
|
364
|
+
/** @param {() => void} fn */
|
|
365
|
+
oncommit(t) {
|
|
366
|
+
this.#t.add(t);
|
|
367
|
+
}
|
|
368
|
+
/** @param {(batch: Batch) => void} fn */
|
|
369
|
+
ondiscard(t) {
|
|
370
|
+
this.#n.add(t);
|
|
371
|
+
}
|
|
372
|
+
settled() {
|
|
373
|
+
return (this.#i ??= An()).promise;
|
|
374
|
+
}
|
|
375
|
+
static ensure() {
|
|
376
|
+
if (P === null) {
|
|
377
|
+
const t = P = new tt();
|
|
378
|
+
dt.add(P), Qe || tt.enqueue(() => {
|
|
379
|
+
P === t && t.flush();
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
return P;
|
|
383
|
+
}
|
|
384
|
+
/** @param {() => void} task */
|
|
385
|
+
static enqueue(t) {
|
|
386
|
+
Un(t);
|
|
387
|
+
}
|
|
388
|
+
apply() {
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function sa(e) {
|
|
392
|
+
var t = Qe;
|
|
393
|
+
Qe = !0;
|
|
394
|
+
try {
|
|
395
|
+
for (var n; ; ) {
|
|
396
|
+
if (aa(), te.length === 0 && (P?.flush(), te.length === 0))
|
|
397
|
+
return Tt = null, /** @type {T} */
|
|
398
|
+
n;
|
|
399
|
+
qn();
|
|
400
|
+
}
|
|
401
|
+
} finally {
|
|
402
|
+
Qe = t;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function qn() {
|
|
406
|
+
var e = xe;
|
|
407
|
+
Wt = !0;
|
|
408
|
+
var t = null;
|
|
409
|
+
try {
|
|
410
|
+
var n = 0;
|
|
411
|
+
for (Et(!0); te.length > 0; ) {
|
|
412
|
+
var r = tt.ensure();
|
|
413
|
+
if (n++ > 1e3) {
|
|
414
|
+
var i, a;
|
|
415
|
+
oa();
|
|
416
|
+
}
|
|
417
|
+
r.process(te), Pe.clear();
|
|
418
|
+
}
|
|
419
|
+
} finally {
|
|
420
|
+
Wt = !1, Et(e), Tt = null;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function oa() {
|
|
424
|
+
try {
|
|
425
|
+
Qr();
|
|
426
|
+
} catch (e) {
|
|
427
|
+
yt(e, Tt);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
let ce = null;
|
|
431
|
+
function bn(e) {
|
|
432
|
+
var t = e.length;
|
|
433
|
+
if (t !== 0) {
|
|
434
|
+
for (var n = 0; n < t; ) {
|
|
435
|
+
var r = e[n++];
|
|
436
|
+
if ((r.f & (de | Q)) === 0 && He(r) && (ce = /* @__PURE__ */ new Set(), Be(r), r.deps === null && r.first === null && r.nodes === null && (r.teardown === null && r.ac === null ? $n(r) : r.fn = null), ce?.size > 0)) {
|
|
437
|
+
Pe.clear();
|
|
438
|
+
for (const i of ce) {
|
|
439
|
+
if ((i.f & (de | Q)) !== 0) continue;
|
|
440
|
+
const a = [i];
|
|
441
|
+
let l = i.parent;
|
|
442
|
+
for (; l !== null; )
|
|
443
|
+
ce.has(l) && (ce.delete(l), a.push(l)), l = l.parent;
|
|
444
|
+
for (let s = a.length - 1; s >= 0; s--) {
|
|
445
|
+
const u = a[s];
|
|
446
|
+
(u.f & (de | Q)) === 0 && Be(u);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
ce.clear();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
ce = null;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function zn(e, t, n, r) {
|
|
456
|
+
if (!n.has(e) && (n.add(e), e.reactions !== null))
|
|
457
|
+
for (const i of e.reactions) {
|
|
458
|
+
const a = i.f;
|
|
459
|
+
(a & K) !== 0 ? zn(
|
|
460
|
+
/** @type {Derived} */
|
|
461
|
+
i,
|
|
462
|
+
t,
|
|
463
|
+
n,
|
|
464
|
+
r
|
|
465
|
+
) : (a & (rn | pe)) !== 0 && (a & J) === 0 && Kn(i, t, r) && (z(i, J), Oe(
|
|
466
|
+
/** @type {Effect} */
|
|
467
|
+
i
|
|
468
|
+
));
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function Kn(e, t, n) {
|
|
472
|
+
const r = n.get(e);
|
|
473
|
+
if (r !== void 0) return r;
|
|
474
|
+
if (e.deps !== null)
|
|
475
|
+
for (const i of e.deps) {
|
|
476
|
+
if (t.includes(i))
|
|
477
|
+
return !0;
|
|
478
|
+
if ((i.f & K) !== 0 && Kn(
|
|
479
|
+
/** @type {Derived} */
|
|
480
|
+
i,
|
|
481
|
+
t,
|
|
482
|
+
n
|
|
483
|
+
))
|
|
484
|
+
return n.set(
|
|
485
|
+
/** @type {Derived} */
|
|
486
|
+
i,
|
|
487
|
+
!0
|
|
488
|
+
), !0;
|
|
489
|
+
}
|
|
490
|
+
return n.set(e, !1), !1;
|
|
491
|
+
}
|
|
492
|
+
function Oe(e) {
|
|
493
|
+
for (var t = Tt = e; t.parent !== null; ) {
|
|
494
|
+
t = t.parent;
|
|
495
|
+
var n = t.f;
|
|
496
|
+
if (Wt && t === R && (n & pe) !== 0 && (n & On) === 0)
|
|
497
|
+
return;
|
|
498
|
+
if ((n & (Ve | he)) !== 0) {
|
|
499
|
+
if ((n & q) === 0) return;
|
|
500
|
+
t.f ^= q;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
te.push(t);
|
|
504
|
+
}
|
|
505
|
+
function la(e, t, n, r) {
|
|
506
|
+
const i = ot() ? Mt : xt;
|
|
507
|
+
if (n.length === 0 && e.length === 0) {
|
|
508
|
+
r(t.map(i));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
var a = P, l = (
|
|
512
|
+
/** @type {Effect} */
|
|
513
|
+
R
|
|
514
|
+
), s = ua();
|
|
515
|
+
function u() {
|
|
516
|
+
Promise.all(n.map((o) => /* @__PURE__ */ fa(o))).then((o) => {
|
|
517
|
+
s();
|
|
518
|
+
try {
|
|
519
|
+
r([...t.map(i), ...o]);
|
|
520
|
+
} catch (d) {
|
|
521
|
+
(l.f & de) === 0 && yt(d, l);
|
|
522
|
+
}
|
|
523
|
+
a?.deactivate(), bt();
|
|
524
|
+
}).catch((o) => {
|
|
525
|
+
yt(o, l);
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
e.length > 0 ? Promise.all(e).then(() => {
|
|
529
|
+
s();
|
|
530
|
+
try {
|
|
531
|
+
return u();
|
|
532
|
+
} finally {
|
|
533
|
+
a?.deactivate(), bt();
|
|
534
|
+
}
|
|
535
|
+
}) : u();
|
|
536
|
+
}
|
|
537
|
+
function ua() {
|
|
538
|
+
var e = R, t = g, n = U, r = P;
|
|
539
|
+
return function(a = !0) {
|
|
540
|
+
Re(e), ue(t), mt(n), a && r?.activate();
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function bt() {
|
|
544
|
+
Re(null), ue(null), mt(null);
|
|
545
|
+
}
|
|
546
|
+
// @__NO_SIDE_EFFECTS__
|
|
547
|
+
function Mt(e) {
|
|
548
|
+
var t = K | J, n = g !== null && (g.f & K) !== 0 ? (
|
|
549
|
+
/** @type {Derived} */
|
|
550
|
+
g
|
|
551
|
+
) : null;
|
|
552
|
+
return R !== null && (R.f |= Ct), {
|
|
553
|
+
ctx: U,
|
|
554
|
+
deps: null,
|
|
555
|
+
effects: null,
|
|
556
|
+
equals: Fn,
|
|
557
|
+
f: t,
|
|
558
|
+
fn: e,
|
|
559
|
+
reactions: null,
|
|
560
|
+
rv: 0,
|
|
561
|
+
v: (
|
|
562
|
+
/** @type {V} */
|
|
563
|
+
H
|
|
564
|
+
),
|
|
565
|
+
wv: 0,
|
|
566
|
+
parent: n ?? R,
|
|
567
|
+
ac: null
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
// @__NO_SIDE_EFFECTS__
|
|
571
|
+
function fa(e, t) {
|
|
572
|
+
let n = (
|
|
573
|
+
/** @type {Effect | null} */
|
|
574
|
+
R
|
|
575
|
+
);
|
|
576
|
+
n === null && Wr();
|
|
577
|
+
var r = (
|
|
578
|
+
/** @type {Boundary} */
|
|
579
|
+
n.b
|
|
580
|
+
), i = (
|
|
581
|
+
/** @type {Promise<V>} */
|
|
582
|
+
/** @type {unknown} */
|
|
583
|
+
void 0
|
|
584
|
+
), a = nt(
|
|
585
|
+
/** @type {V} */
|
|
586
|
+
H
|
|
587
|
+
), l = !g, s = /* @__PURE__ */ new Map();
|
|
588
|
+
return ga(() => {
|
|
589
|
+
var u = An();
|
|
590
|
+
i = u.promise;
|
|
591
|
+
try {
|
|
592
|
+
Promise.resolve(e()).then(u.resolve, u.reject).then(() => {
|
|
593
|
+
o === P && o.committed && o.deactivate(), bt();
|
|
594
|
+
});
|
|
595
|
+
} catch (_) {
|
|
596
|
+
u.reject(_), bt();
|
|
597
|
+
}
|
|
598
|
+
var o = (
|
|
599
|
+
/** @type {Batch} */
|
|
600
|
+
P
|
|
601
|
+
);
|
|
602
|
+
if (l) {
|
|
603
|
+
var d = !r.is_pending();
|
|
604
|
+
r.update_pending_count(1), o.increment(d), s.get(o)?.reject(qe), s.delete(o), s.set(o, u);
|
|
605
|
+
}
|
|
606
|
+
const v = (_, p = void 0) => {
|
|
607
|
+
if (o.activate(), p)
|
|
608
|
+
p !== qe && (a.f |= Se, rt(a, p));
|
|
609
|
+
else {
|
|
610
|
+
(a.f & Se) !== 0 && (a.f ^= Se), rt(a, _);
|
|
611
|
+
for (const [c, b] of s) {
|
|
612
|
+
if (s.delete(c), c === o) break;
|
|
613
|
+
b.reject(qe);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
l && (r.update_pending_count(-1), o.decrement(d));
|
|
617
|
+
};
|
|
618
|
+
u.promise.then(v, (_) => v(null, _ || "unknown"));
|
|
619
|
+
}), ln(() => {
|
|
620
|
+
for (const u of s.values())
|
|
621
|
+
u.reject(qe);
|
|
622
|
+
}), new Promise((u) => {
|
|
623
|
+
function o(d) {
|
|
624
|
+
function v() {
|
|
625
|
+
d === i ? u(a) : o(i);
|
|
626
|
+
}
|
|
627
|
+
d.then(v, v);
|
|
628
|
+
}
|
|
629
|
+
o(i);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
// @__NO_SIDE_EFFECTS__
|
|
633
|
+
function xt(e) {
|
|
634
|
+
const t = /* @__PURE__ */ Mt(e);
|
|
635
|
+
return t.equals = Ln, t;
|
|
636
|
+
}
|
|
637
|
+
function Bn(e) {
|
|
638
|
+
var t = e.effects;
|
|
639
|
+
if (t !== null) {
|
|
640
|
+
e.effects = null;
|
|
641
|
+
for (var n = 0; n < t.length; n += 1)
|
|
642
|
+
ve(
|
|
643
|
+
/** @type {Effect} */
|
|
644
|
+
t[n]
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function ca(e) {
|
|
649
|
+
for (var t = e.parent; t !== null; ) {
|
|
650
|
+
if ((t.f & K) === 0)
|
|
651
|
+
return (t.f & de) === 0 ? (
|
|
652
|
+
/** @type {Effect} */
|
|
653
|
+
t
|
|
654
|
+
) : null;
|
|
655
|
+
t = t.parent;
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
function on(e) {
|
|
660
|
+
var t, n = R;
|
|
661
|
+
Re(ca(e));
|
|
662
|
+
try {
|
|
663
|
+
e.f &= ~Ne, Bn(e), t = ir(e);
|
|
664
|
+
} finally {
|
|
665
|
+
Re(n);
|
|
666
|
+
}
|
|
667
|
+
return t;
|
|
668
|
+
}
|
|
669
|
+
function Vn(e) {
|
|
670
|
+
var t = on(e);
|
|
671
|
+
if (e.equals(t) || (P?.is_fork || (e.v = t), e.wv = rr()), !De)
|
|
672
|
+
if (ne !== null)
|
|
673
|
+
(gt() || P?.is_fork) && ne.set(e, t);
|
|
674
|
+
else {
|
|
675
|
+
var n = (e.f & ae) === 0 ? ie : q;
|
|
676
|
+
z(e, n);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
let Zt = /* @__PURE__ */ new Set();
|
|
680
|
+
const Pe = /* @__PURE__ */ new Map();
|
|
681
|
+
let Hn = !1;
|
|
682
|
+
function nt(e, t) {
|
|
683
|
+
var n = {
|
|
684
|
+
f: 0,
|
|
685
|
+
// TODO ideally we could skip this altogether, but it causes type errors
|
|
686
|
+
v: e,
|
|
687
|
+
reactions: null,
|
|
688
|
+
equals: Fn,
|
|
689
|
+
rv: 0,
|
|
690
|
+
wv: 0
|
|
691
|
+
};
|
|
692
|
+
return n;
|
|
693
|
+
}
|
|
694
|
+
// @__NO_SIDE_EFFECTS__
|
|
695
|
+
function be(e, t) {
|
|
696
|
+
const n = nt(e);
|
|
697
|
+
return ka(n), n;
|
|
698
|
+
}
|
|
699
|
+
// @__NO_SIDE_EFFECTS__
|
|
700
|
+
function ke(e, t = !1, n = !0) {
|
|
701
|
+
const r = nt(e);
|
|
702
|
+
return t || (r.equals = Ln), st && n && U !== null && U.l !== null && (U.l.s ??= []).push(r), r;
|
|
703
|
+
}
|
|
704
|
+
function j(e, t, n = !1) {
|
|
705
|
+
g !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
706
|
+
// to ensure we error if state is set inside an inspect effect
|
|
707
|
+
(!le || (g.f & yn) !== 0) && ot() && (g.f & (K | pe | rn | yn)) !== 0 && !_e?.includes(e) && na();
|
|
708
|
+
let r = n ? ze(t) : t;
|
|
709
|
+
return rt(e, r);
|
|
710
|
+
}
|
|
711
|
+
function rt(e, t) {
|
|
712
|
+
if (!e.equals(t)) {
|
|
713
|
+
var n = e.v;
|
|
714
|
+
De ? Pe.set(e, t) : Pe.set(e, n), e.v = t;
|
|
715
|
+
var r = tt.ensure();
|
|
716
|
+
r.capture(e, n), (e.f & K) !== 0 && ((e.f & J) !== 0 && on(
|
|
717
|
+
/** @type {Derived} */
|
|
718
|
+
e
|
|
719
|
+
), z(e, (e.f & ae) !== 0 ? q : ie)), e.wv = rr(), Yn(e, J), ot() && R !== null && (R.f & q) !== 0 && (R.f & (he | Ve)) === 0 && ($ === null ? Ra([e]) : $.push(e)), !r.is_fork && Zt.size > 0 && !Hn && da();
|
|
720
|
+
}
|
|
721
|
+
return t;
|
|
722
|
+
}
|
|
723
|
+
function da() {
|
|
724
|
+
Hn = !1;
|
|
725
|
+
var e = xe;
|
|
726
|
+
Et(!0);
|
|
727
|
+
const t = Array.from(Zt);
|
|
728
|
+
try {
|
|
729
|
+
for (const n of t)
|
|
730
|
+
(n.f & q) !== 0 && z(n, ie), He(n) && Be(n);
|
|
731
|
+
} finally {
|
|
732
|
+
Et(e);
|
|
733
|
+
}
|
|
734
|
+
Zt.clear();
|
|
735
|
+
}
|
|
736
|
+
function zt(e) {
|
|
737
|
+
j(e, e.v + 1);
|
|
738
|
+
}
|
|
739
|
+
function Yn(e, t) {
|
|
740
|
+
var n = e.reactions;
|
|
741
|
+
if (n !== null)
|
|
742
|
+
for (var r = ot(), i = n.length, a = 0; a < i; a++) {
|
|
743
|
+
var l = n[a], s = l.f;
|
|
744
|
+
if (!(!r && l === R)) {
|
|
745
|
+
var u = (s & J) === 0;
|
|
746
|
+
if (u && z(l, t), (s & K) !== 0) {
|
|
747
|
+
var o = (
|
|
748
|
+
/** @type {Derived} */
|
|
749
|
+
l
|
|
750
|
+
);
|
|
751
|
+
ne?.delete(o), (s & Ne) === 0 && (s & ae && (l.f |= Ne), Yn(o, ie));
|
|
752
|
+
} else u && ((s & pe) !== 0 && ce !== null && ce.add(
|
|
753
|
+
/** @type {Effect} */
|
|
754
|
+
l
|
|
755
|
+
), Oe(
|
|
756
|
+
/** @type {Effect} */
|
|
757
|
+
l
|
|
758
|
+
));
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function ze(e) {
|
|
763
|
+
if (typeof e != "object" || e === null || Ke in e)
|
|
764
|
+
return e;
|
|
765
|
+
const t = xn(e);
|
|
766
|
+
if (t !== Br && t !== Vr)
|
|
767
|
+
return e;
|
|
768
|
+
var n = /* @__PURE__ */ new Map(), r = Tn(e), i = /* @__PURE__ */ be(0), a = Ae, l = (s) => {
|
|
769
|
+
if (Ae === a)
|
|
770
|
+
return s();
|
|
771
|
+
var u = g, o = Ae;
|
|
772
|
+
ue(null), Sn(a);
|
|
773
|
+
var d = s();
|
|
774
|
+
return ue(u), Sn(o), d;
|
|
775
|
+
};
|
|
776
|
+
return r && n.set("length", /* @__PURE__ */ be(
|
|
777
|
+
/** @type {any[]} */
|
|
778
|
+
e.length
|
|
779
|
+
)), new Proxy(
|
|
780
|
+
/** @type {any} */
|
|
781
|
+
e,
|
|
782
|
+
{
|
|
783
|
+
defineProperty(s, u, o) {
|
|
784
|
+
(!("value" in o) || o.configurable === !1 || o.enumerable === !1 || o.writable === !1) && ea();
|
|
785
|
+
var d = n.get(u);
|
|
786
|
+
return d === void 0 ? d = l(() => {
|
|
787
|
+
var v = /* @__PURE__ */ be(o.value);
|
|
788
|
+
return n.set(u, v), v;
|
|
789
|
+
}) : j(d, o.value, !0), !0;
|
|
790
|
+
},
|
|
791
|
+
deleteProperty(s, u) {
|
|
792
|
+
var o = n.get(u);
|
|
793
|
+
if (o === void 0) {
|
|
794
|
+
if (u in s) {
|
|
795
|
+
const d = l(() => /* @__PURE__ */ be(H));
|
|
796
|
+
n.set(u, d), zt(i);
|
|
797
|
+
}
|
|
798
|
+
} else
|
|
799
|
+
j(o, H), zt(i);
|
|
800
|
+
return !0;
|
|
801
|
+
},
|
|
802
|
+
get(s, u, o) {
|
|
803
|
+
if (u === Ke)
|
|
804
|
+
return e;
|
|
805
|
+
var d = n.get(u), v = u in s;
|
|
806
|
+
if (d === void 0 && (!v || pt(s, u)?.writable) && (d = l(() => {
|
|
807
|
+
var p = ze(v ? s[u] : H), c = /* @__PURE__ */ be(p);
|
|
808
|
+
return c;
|
|
809
|
+
}), n.set(u, d)), d !== void 0) {
|
|
810
|
+
var _ = f(d);
|
|
811
|
+
return _ === H ? void 0 : _;
|
|
812
|
+
}
|
|
813
|
+
return Reflect.get(s, u, o);
|
|
814
|
+
},
|
|
815
|
+
getOwnPropertyDescriptor(s, u) {
|
|
816
|
+
var o = Reflect.getOwnPropertyDescriptor(s, u);
|
|
817
|
+
if (o && "value" in o) {
|
|
818
|
+
var d = n.get(u);
|
|
819
|
+
d && (o.value = f(d));
|
|
820
|
+
} else if (o === void 0) {
|
|
821
|
+
var v = n.get(u), _ = v?.v;
|
|
822
|
+
if (v !== void 0 && _ !== H)
|
|
823
|
+
return {
|
|
824
|
+
enumerable: !0,
|
|
825
|
+
configurable: !0,
|
|
826
|
+
value: _,
|
|
827
|
+
writable: !0
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
return o;
|
|
831
|
+
},
|
|
832
|
+
has(s, u) {
|
|
833
|
+
if (u === Ke)
|
|
834
|
+
return !0;
|
|
835
|
+
var o = n.get(u), d = o !== void 0 && o.v !== H || Reflect.has(s, u);
|
|
836
|
+
if (o !== void 0 || R !== null && (!d || pt(s, u)?.writable)) {
|
|
837
|
+
o === void 0 && (o = l(() => {
|
|
838
|
+
var _ = d ? ze(s[u]) : H, p = /* @__PURE__ */ be(_);
|
|
839
|
+
return p;
|
|
840
|
+
}), n.set(u, o));
|
|
841
|
+
var v = f(o);
|
|
842
|
+
if (v === H)
|
|
843
|
+
return !1;
|
|
844
|
+
}
|
|
845
|
+
return d;
|
|
846
|
+
},
|
|
847
|
+
set(s, u, o, d) {
|
|
848
|
+
var v = n.get(u), _ = u in s;
|
|
849
|
+
if (r && u === "length")
|
|
850
|
+
for (var p = o; p < /** @type {Source<number>} */
|
|
851
|
+
v.v; p += 1) {
|
|
852
|
+
var c = n.get(p + "");
|
|
853
|
+
c !== void 0 ? j(c, H) : p in s && (c = l(() => /* @__PURE__ */ be(H)), n.set(p + "", c));
|
|
854
|
+
}
|
|
855
|
+
if (v === void 0)
|
|
856
|
+
(!_ || pt(s, u)?.writable) && (v = l(() => /* @__PURE__ */ be(void 0)), j(v, ze(o)), n.set(u, v));
|
|
857
|
+
else {
|
|
858
|
+
_ = v.v !== H;
|
|
859
|
+
var b = l(() => ze(o));
|
|
860
|
+
j(v, b);
|
|
861
|
+
}
|
|
862
|
+
var y = Reflect.getOwnPropertyDescriptor(s, u);
|
|
863
|
+
if (y?.set && y.set.call(d, o), !_) {
|
|
864
|
+
if (r && typeof u == "string") {
|
|
865
|
+
var E = (
|
|
866
|
+
/** @type {Source<number>} */
|
|
867
|
+
n.get("length")
|
|
868
|
+
), m = Number(u);
|
|
869
|
+
Number.isInteger(m) && m >= E.v && j(E, m + 1);
|
|
870
|
+
}
|
|
871
|
+
zt(i);
|
|
872
|
+
}
|
|
873
|
+
return !0;
|
|
874
|
+
},
|
|
875
|
+
ownKeys(s) {
|
|
876
|
+
f(i);
|
|
877
|
+
var u = Reflect.ownKeys(s).filter((v) => {
|
|
878
|
+
var _ = n.get(v);
|
|
879
|
+
return _ === void 0 || _.v !== H;
|
|
880
|
+
});
|
|
881
|
+
for (var [o, d] of n)
|
|
882
|
+
d.v !== H && !(o in s) && u.push(o);
|
|
883
|
+
return u;
|
|
884
|
+
},
|
|
885
|
+
setPrototypeOf() {
|
|
886
|
+
ta();
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
var va, _a, pa;
|
|
892
|
+
function Me(e = "") {
|
|
893
|
+
return document.createTextNode(e);
|
|
894
|
+
}
|
|
895
|
+
// @__NO_SIDE_EFFECTS__
|
|
896
|
+
function wt(e) {
|
|
897
|
+
return (
|
|
898
|
+
/** @type {TemplateNode | null} */
|
|
899
|
+
_a.call(e)
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
// @__NO_SIDE_EFFECTS__
|
|
903
|
+
function lt(e) {
|
|
904
|
+
return (
|
|
905
|
+
/** @type {TemplateNode | null} */
|
|
906
|
+
pa.call(e)
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
function A(e, t) {
|
|
910
|
+
return /* @__PURE__ */ wt(e);
|
|
911
|
+
}
|
|
912
|
+
function Je(e, t = !1) {
|
|
913
|
+
{
|
|
914
|
+
var n = /* @__PURE__ */ wt(e);
|
|
915
|
+
return n instanceof Comment && n.data === "" ? /* @__PURE__ */ lt(n) : n;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
function D(e, t = 1, n = !1) {
|
|
919
|
+
let r = e;
|
|
920
|
+
for (; t--; )
|
|
921
|
+
r = /** @type {TemplateNode} */
|
|
922
|
+
/* @__PURE__ */ lt(r);
|
|
923
|
+
return r;
|
|
924
|
+
}
|
|
925
|
+
function ha(e) {
|
|
926
|
+
e.textContent = "";
|
|
927
|
+
}
|
|
928
|
+
function Gn() {
|
|
929
|
+
return !1;
|
|
930
|
+
}
|
|
931
|
+
let wn = !1;
|
|
932
|
+
function ma() {
|
|
933
|
+
wn || (wn = !0, document.addEventListener(
|
|
934
|
+
"reset",
|
|
935
|
+
(e) => {
|
|
936
|
+
Promise.resolve().then(() => {
|
|
937
|
+
if (!e.defaultPrevented)
|
|
938
|
+
for (
|
|
939
|
+
const t of
|
|
940
|
+
/**@type {HTMLFormElement} */
|
|
941
|
+
e.target.elements
|
|
942
|
+
)
|
|
943
|
+
t.__on_r?.();
|
|
944
|
+
});
|
|
945
|
+
},
|
|
946
|
+
// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
|
|
947
|
+
{ capture: !0 }
|
|
948
|
+
));
|
|
949
|
+
}
|
|
950
|
+
function At(e) {
|
|
951
|
+
var t = g, n = R;
|
|
952
|
+
ue(null), Re(null);
|
|
953
|
+
try {
|
|
954
|
+
return e();
|
|
955
|
+
} finally {
|
|
956
|
+
ue(t), Re(n);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function ya(e, t, n, r = n) {
|
|
960
|
+
e.addEventListener(t, () => At(n));
|
|
961
|
+
const i = e.__on_r;
|
|
962
|
+
i ? e.__on_r = () => {
|
|
963
|
+
i(), r(!0);
|
|
964
|
+
} : e.__on_r = () => r(!0), ma();
|
|
965
|
+
}
|
|
966
|
+
function Wn(e) {
|
|
967
|
+
R === null && (g === null && Xr(), Jr()), De && Zr();
|
|
968
|
+
}
|
|
969
|
+
function ba(e, t) {
|
|
970
|
+
var n = t.last;
|
|
971
|
+
n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
|
|
972
|
+
}
|
|
973
|
+
function Ie(e, t, n) {
|
|
974
|
+
var r = R;
|
|
975
|
+
r !== null && (r.f & Q) !== 0 && (e |= Q);
|
|
976
|
+
var i = {
|
|
977
|
+
ctx: U,
|
|
978
|
+
deps: null,
|
|
979
|
+
nodes: null,
|
|
980
|
+
f: e | J | ae,
|
|
981
|
+
first: null,
|
|
982
|
+
fn: t,
|
|
983
|
+
last: null,
|
|
984
|
+
next: null,
|
|
985
|
+
parent: r,
|
|
986
|
+
b: r && r.b,
|
|
987
|
+
prev: null,
|
|
988
|
+
teardown: null,
|
|
989
|
+
wv: 0,
|
|
990
|
+
ac: null
|
|
991
|
+
};
|
|
992
|
+
if (n)
|
|
993
|
+
try {
|
|
994
|
+
Be(i), i.f |= nn;
|
|
995
|
+
} catch (s) {
|
|
996
|
+
throw ve(i), s;
|
|
997
|
+
}
|
|
998
|
+
else t !== null && Oe(i);
|
|
999
|
+
var a = i;
|
|
1000
|
+
if (n && a.deps === null && a.teardown === null && a.nodes === null && a.first === a.last && // either `null`, or a singular child
|
|
1001
|
+
(a.f & Ct) === 0 && (a = a.first, (e & pe) !== 0 && (e & et) !== 0 && a !== null && (a.f |= et)), a !== null && (a.parent = r, r !== null && ba(a, r), g !== null && (g.f & K) !== 0 && (e & Ve) === 0)) {
|
|
1002
|
+
var l = (
|
|
1003
|
+
/** @type {Derived} */
|
|
1004
|
+
g
|
|
1005
|
+
);
|
|
1006
|
+
(l.effects ??= []).push(a);
|
|
1007
|
+
}
|
|
1008
|
+
return i;
|
|
1009
|
+
}
|
|
1010
|
+
function gt() {
|
|
1011
|
+
return g !== null && !le;
|
|
1012
|
+
}
|
|
1013
|
+
function ln(e) {
|
|
1014
|
+
const t = Ie(It, null, !1);
|
|
1015
|
+
return z(t, q), t.teardown = e, t;
|
|
1016
|
+
}
|
|
1017
|
+
function gn(e) {
|
|
1018
|
+
Wn();
|
|
1019
|
+
var t = (
|
|
1020
|
+
/** @type {Effect} */
|
|
1021
|
+
R.f
|
|
1022
|
+
), n = !g && (t & he) !== 0 && (t & nn) === 0;
|
|
1023
|
+
if (n) {
|
|
1024
|
+
var r = (
|
|
1025
|
+
/** @type {ComponentContext} */
|
|
1026
|
+
U
|
|
1027
|
+
);
|
|
1028
|
+
(r.e ??= []).push(e);
|
|
1029
|
+
} else
|
|
1030
|
+
return Zn(e);
|
|
1031
|
+
}
|
|
1032
|
+
function Zn(e) {
|
|
1033
|
+
return Ie(Nn | Dn, e, !1);
|
|
1034
|
+
}
|
|
1035
|
+
function wa(e) {
|
|
1036
|
+
return Wn(), Ie(It | Dn, e, !0);
|
|
1037
|
+
}
|
|
1038
|
+
function $e(e, t) {
|
|
1039
|
+
var n = (
|
|
1040
|
+
/** @type {ComponentContextLegacy} */
|
|
1041
|
+
U
|
|
1042
|
+
), r = { effect: null, ran: !1, deps: e };
|
|
1043
|
+
n.l.$.push(r), r.effect = fn(() => {
|
|
1044
|
+
e(), !r.ran && (r.ran = !0, w(t));
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
function un() {
|
|
1048
|
+
var e = (
|
|
1049
|
+
/** @type {ComponentContextLegacy} */
|
|
1050
|
+
U
|
|
1051
|
+
);
|
|
1052
|
+
fn(() => {
|
|
1053
|
+
for (var t of e.l.$) {
|
|
1054
|
+
t.deps();
|
|
1055
|
+
var n = t.effect;
|
|
1056
|
+
(n.f & q) !== 0 && z(n, ie), He(n) && Be(n), t.ran = !1;
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
function ga(e) {
|
|
1061
|
+
return Ie(rn | Ct, e, !0);
|
|
1062
|
+
}
|
|
1063
|
+
function fn(e, t = 0) {
|
|
1064
|
+
return Ie(It | t, e, !0);
|
|
1065
|
+
}
|
|
1066
|
+
function oe(e, t = [], n = [], r = []) {
|
|
1067
|
+
la(r, t, n, (i) => {
|
|
1068
|
+
Ie(It, () => e(...i.map(f)), !0);
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
function Jn(e, t = 0) {
|
|
1072
|
+
var n = Ie(pe | t, e, !0);
|
|
1073
|
+
return n;
|
|
1074
|
+
}
|
|
1075
|
+
function at(e) {
|
|
1076
|
+
return Ie(he | Ct, e, !0);
|
|
1077
|
+
}
|
|
1078
|
+
function Xn(e) {
|
|
1079
|
+
var t = e.teardown;
|
|
1080
|
+
if (t !== null) {
|
|
1081
|
+
const n = De, r = g;
|
|
1082
|
+
En(!0), ue(null);
|
|
1083
|
+
try {
|
|
1084
|
+
t.call(null);
|
|
1085
|
+
} finally {
|
|
1086
|
+
En(n), ue(r);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
function Qn(e, t = !1) {
|
|
1091
|
+
var n = e.first;
|
|
1092
|
+
for (e.first = e.last = null; n !== null; ) {
|
|
1093
|
+
const i = n.ac;
|
|
1094
|
+
i !== null && At(() => {
|
|
1095
|
+
i.abort(qe);
|
|
1096
|
+
});
|
|
1097
|
+
var r = n.next;
|
|
1098
|
+
(n.f & Ve) !== 0 ? n.parent = null : ve(n, t), n = r;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
function Ea(e) {
|
|
1102
|
+
for (var t = e.first; t !== null; ) {
|
|
1103
|
+
var n = t.next;
|
|
1104
|
+
(t.f & he) === 0 && ve(t), t = n;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
function ve(e, t = !0) {
|
|
1108
|
+
var n = !1;
|
|
1109
|
+
(t || (e.f & On) !== 0) && e.nodes !== null && e.nodes.end !== null && (Sa(
|
|
1110
|
+
e.nodes.start,
|
|
1111
|
+
/** @type {TemplateNode} */
|
|
1112
|
+
e.nodes.end
|
|
1113
|
+
), n = !0), Qn(e, t && !n), St(e, 0), z(e, de);
|
|
1114
|
+
var r = e.nodes && e.nodes.t;
|
|
1115
|
+
if (r !== null)
|
|
1116
|
+
for (const a of r)
|
|
1117
|
+
a.stop();
|
|
1118
|
+
Xn(e);
|
|
1119
|
+
var i = e.parent;
|
|
1120
|
+
i !== null && i.first !== null && $n(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
|
|
1121
|
+
}
|
|
1122
|
+
function Sa(e, t) {
|
|
1123
|
+
for (; e !== null; ) {
|
|
1124
|
+
var n = e === t ? null : /* @__PURE__ */ lt(e);
|
|
1125
|
+
e.remove(), e = n;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
function $n(e) {
|
|
1129
|
+
var t = e.parent, n = e.prev, r = e.next;
|
|
1130
|
+
n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
|
|
1131
|
+
}
|
|
1132
|
+
function cn(e, t, n = !0) {
|
|
1133
|
+
var r = [];
|
|
1134
|
+
er(e, r, !0);
|
|
1135
|
+
var i = () => {
|
|
1136
|
+
n && ve(e), t && t();
|
|
1137
|
+
}, a = r.length;
|
|
1138
|
+
if (a > 0) {
|
|
1139
|
+
var l = () => --a || i();
|
|
1140
|
+
for (var s of r)
|
|
1141
|
+
s.out(l);
|
|
1142
|
+
} else
|
|
1143
|
+
i();
|
|
1144
|
+
}
|
|
1145
|
+
function er(e, t, n) {
|
|
1146
|
+
if ((e.f & Q) === 0) {
|
|
1147
|
+
e.f ^= Q;
|
|
1148
|
+
var r = e.nodes && e.nodes.t;
|
|
1149
|
+
if (r !== null)
|
|
1150
|
+
for (const s of r)
|
|
1151
|
+
(s.is_global || n) && t.push(s);
|
|
1152
|
+
for (var i = e.first; i !== null; ) {
|
|
1153
|
+
var a = i.next, l = (i.f & et) !== 0 || // If this is a branch effect without a block effect parent,
|
|
1154
|
+
// it means the parent block effect was pruned. In that case,
|
|
1155
|
+
// transparency information was transferred to the branch effect.
|
|
1156
|
+
(i.f & he) !== 0 && (e.f & pe) !== 0;
|
|
1157
|
+
er(i, t, l ? n : !1), i = a;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
function dn(e) {
|
|
1162
|
+
tr(e, !0);
|
|
1163
|
+
}
|
|
1164
|
+
function tr(e, t) {
|
|
1165
|
+
if ((e.f & Q) !== 0) {
|
|
1166
|
+
e.f ^= Q, (e.f & q) === 0 && (z(e, J), Oe(e));
|
|
1167
|
+
for (var n = e.first; n !== null; ) {
|
|
1168
|
+
var r = n.next, i = (n.f & et) !== 0 || (n.f & he) !== 0;
|
|
1169
|
+
tr(n, i ? t : !1), n = r;
|
|
1170
|
+
}
|
|
1171
|
+
var a = e.nodes && e.nodes.t;
|
|
1172
|
+
if (a !== null)
|
|
1173
|
+
for (const l of a)
|
|
1174
|
+
(l.is_global || t) && l.in();
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
function Pa(e, t) {
|
|
1178
|
+
if (e.nodes)
|
|
1179
|
+
for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
|
|
1180
|
+
var i = n === r ? null : /* @__PURE__ */ lt(n);
|
|
1181
|
+
t.append(n), n = i;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
let xe = !1;
|
|
1185
|
+
function Et(e) {
|
|
1186
|
+
xe = e;
|
|
1187
|
+
}
|
|
1188
|
+
let De = !1;
|
|
1189
|
+
function En(e) {
|
|
1190
|
+
De = e;
|
|
1191
|
+
}
|
|
1192
|
+
let g = null, le = !1;
|
|
1193
|
+
function ue(e) {
|
|
1194
|
+
g = e;
|
|
1195
|
+
}
|
|
1196
|
+
let R = null;
|
|
1197
|
+
function Re(e) {
|
|
1198
|
+
R = e;
|
|
1199
|
+
}
|
|
1200
|
+
let _e = null;
|
|
1201
|
+
function ka(e) {
|
|
1202
|
+
g !== null && (_e === null ? _e = [e] : _e.push(e));
|
|
1203
|
+
}
|
|
1204
|
+
let G = null, X = 0, $ = null;
|
|
1205
|
+
function Ra(e) {
|
|
1206
|
+
$ = e;
|
|
1207
|
+
}
|
|
1208
|
+
let nr = 1, it = 0, Ae = it;
|
|
1209
|
+
function Sn(e) {
|
|
1210
|
+
Ae = e;
|
|
1211
|
+
}
|
|
1212
|
+
function rr() {
|
|
1213
|
+
return ++nr;
|
|
1214
|
+
}
|
|
1215
|
+
function He(e) {
|
|
1216
|
+
var t = e.f;
|
|
1217
|
+
if ((t & J) !== 0)
|
|
1218
|
+
return !0;
|
|
1219
|
+
if (t & K && (e.f &= ~Ne), (t & ie) !== 0) {
|
|
1220
|
+
var n = e.deps;
|
|
1221
|
+
if (n !== null)
|
|
1222
|
+
for (var r = n.length, i = 0; i < r; i++) {
|
|
1223
|
+
var a = n[i];
|
|
1224
|
+
if (He(
|
|
1225
|
+
/** @type {Derived} */
|
|
1226
|
+
a
|
|
1227
|
+
) && Vn(
|
|
1228
|
+
/** @type {Derived} */
|
|
1229
|
+
a
|
|
1230
|
+
), a.wv > e.wv)
|
|
1231
|
+
return !0;
|
|
1232
|
+
}
|
|
1233
|
+
(t & ae) !== 0 && // During time traveling we don't want to reset the status so that
|
|
1234
|
+
// traversal of the graph in the other batches still happens
|
|
1235
|
+
ne === null && z(e, q);
|
|
1236
|
+
}
|
|
1237
|
+
return !1;
|
|
1238
|
+
}
|
|
1239
|
+
function ar(e, t, n = !0) {
|
|
1240
|
+
var r = e.reactions;
|
|
1241
|
+
if (r !== null && !_e?.includes(e))
|
|
1242
|
+
for (var i = 0; i < r.length; i++) {
|
|
1243
|
+
var a = r[i];
|
|
1244
|
+
(a.f & K) !== 0 ? ar(
|
|
1245
|
+
/** @type {Derived} */
|
|
1246
|
+
a,
|
|
1247
|
+
t,
|
|
1248
|
+
!1
|
|
1249
|
+
) : t === a && (n ? z(a, J) : (a.f & q) !== 0 && z(a, ie), Oe(
|
|
1250
|
+
/** @type {Effect} */
|
|
1251
|
+
a
|
|
1252
|
+
));
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
function ir(e) {
|
|
1256
|
+
var t = G, n = X, r = $, i = g, a = _e, l = U, s = le, u = Ae, o = e.f;
|
|
1257
|
+
G = /** @type {null | Value[]} */
|
|
1258
|
+
null, X = 0, $ = null, g = (o & (he | Ve)) === 0 ? e : null, _e = null, mt(e.ctx), le = !1, Ae = ++it, e.ac !== null && (At(() => {
|
|
1259
|
+
e.ac.abort(qe);
|
|
1260
|
+
}), e.ac = null);
|
|
1261
|
+
try {
|
|
1262
|
+
e.f |= Gt;
|
|
1263
|
+
var d = (
|
|
1264
|
+
/** @type {Function} */
|
|
1265
|
+
e.fn
|
|
1266
|
+
), v = d(), _ = e.deps;
|
|
1267
|
+
if (G !== null) {
|
|
1268
|
+
var p;
|
|
1269
|
+
if (St(e, X), _ !== null && X > 0)
|
|
1270
|
+
for (_.length = X + G.length, p = 0; p < G.length; p++)
|
|
1271
|
+
_[X + p] = G[p];
|
|
1272
|
+
else
|
|
1273
|
+
e.deps = _ = G;
|
|
1274
|
+
if (gt() && (e.f & ae) !== 0)
|
|
1275
|
+
for (p = X; p < _.length; p++)
|
|
1276
|
+
(_[p].reactions ??= []).push(e);
|
|
1277
|
+
} else _ !== null && X < _.length && (St(e, X), _.length = X);
|
|
1278
|
+
if (ot() && $ !== null && !le && _ !== null && (e.f & (K | ie | J)) === 0)
|
|
1279
|
+
for (p = 0; p < /** @type {Source[]} */
|
|
1280
|
+
$.length; p++)
|
|
1281
|
+
ar(
|
|
1282
|
+
$[p],
|
|
1283
|
+
/** @type {Effect} */
|
|
1284
|
+
e
|
|
1285
|
+
);
|
|
1286
|
+
return i !== null && i !== e && (it++, $ !== null && (r === null ? r = $ : r.push(.../** @type {Source[]} */
|
|
1287
|
+
$))), (e.f & Se) !== 0 && (e.f ^= Se), v;
|
|
1288
|
+
} catch (c) {
|
|
1289
|
+
return ia(c);
|
|
1290
|
+
} finally {
|
|
1291
|
+
e.f ^= Gt, G = t, X = n, $ = r, g = i, _e = a, mt(l), le = s, Ae = u;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
function Ia(e, t) {
|
|
1295
|
+
let n = t.reactions;
|
|
1296
|
+
if (n !== null) {
|
|
1297
|
+
var r = zr.call(n, e);
|
|
1298
|
+
if (r !== -1) {
|
|
1299
|
+
var i = n.length - 1;
|
|
1300
|
+
i === 0 ? n = t.reactions = null : (n[r] = n[i], n.pop());
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
n === null && (t.f & K) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
|
1304
|
+
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
|
1305
|
+
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
|
1306
|
+
(G === null || !G.includes(t)) && (z(t, ie), (t.f & ae) !== 0 && (t.f ^= ae, t.f &= ~Ne), Bn(
|
|
1307
|
+
/** @type {Derived} **/
|
|
1308
|
+
t
|
|
1309
|
+
), St(
|
|
1310
|
+
/** @type {Derived} **/
|
|
1311
|
+
t,
|
|
1312
|
+
0
|
|
1313
|
+
));
|
|
1314
|
+
}
|
|
1315
|
+
function St(e, t) {
|
|
1316
|
+
var n = e.deps;
|
|
1317
|
+
if (n !== null)
|
|
1318
|
+
for (var r = t; r < n.length; r++)
|
|
1319
|
+
Ia(e, n[r]);
|
|
1320
|
+
}
|
|
1321
|
+
function Be(e) {
|
|
1322
|
+
var t = e.f;
|
|
1323
|
+
if ((t & de) === 0) {
|
|
1324
|
+
z(e, q);
|
|
1325
|
+
var n = R, r = xe;
|
|
1326
|
+
R = e, xe = !0;
|
|
1327
|
+
try {
|
|
1328
|
+
(t & (pe | Yr)) !== 0 ? Ea(e) : Qn(e), Xn(e);
|
|
1329
|
+
var i = ir(e);
|
|
1330
|
+
e.teardown = typeof i == "function" ? i : null, e.wv = nr;
|
|
1331
|
+
var a;
|
|
1332
|
+
Vt && Tr && (e.f & J) !== 0 && e.deps;
|
|
1333
|
+
} finally {
|
|
1334
|
+
xe = r, R = n;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
async function Ca() {
|
|
1339
|
+
await Promise.resolve(), sa();
|
|
1340
|
+
}
|
|
1341
|
+
function f(e) {
|
|
1342
|
+
var t = e.f, n = (t & K) !== 0;
|
|
1343
|
+
if (g !== null && !le) {
|
|
1344
|
+
var r = R !== null && (R.f & de) !== 0;
|
|
1345
|
+
if (!r && !_e?.includes(e)) {
|
|
1346
|
+
var i = g.deps;
|
|
1347
|
+
if ((g.f & Gt) !== 0)
|
|
1348
|
+
e.rv < it && (e.rv = it, G === null && i !== null && i[X] === e ? X++ : G === null ? G = [e] : G.includes(e) || G.push(e));
|
|
1349
|
+
else {
|
|
1350
|
+
(g.deps ??= []).push(e);
|
|
1351
|
+
var a = e.reactions;
|
|
1352
|
+
a === null ? e.reactions = [g] : a.includes(g) || a.push(g);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
if (De) {
|
|
1357
|
+
if (Pe.has(e))
|
|
1358
|
+
return Pe.get(e);
|
|
1359
|
+
if (n) {
|
|
1360
|
+
var l = (
|
|
1361
|
+
/** @type {Derived} */
|
|
1362
|
+
e
|
|
1363
|
+
), s = l.v;
|
|
1364
|
+
return ((l.f & q) === 0 && l.reactions !== null || or(l)) && (s = on(l)), Pe.set(l, s), s;
|
|
1365
|
+
}
|
|
1366
|
+
} else n && (!ne?.has(e) || P?.is_fork && !gt()) && (l = /** @type {Derived} */
|
|
1367
|
+
e, He(l) && Vn(l), xe && gt() && (l.f & ae) === 0 && sr(l));
|
|
1368
|
+
if (ne?.has(e))
|
|
1369
|
+
return ne.get(e);
|
|
1370
|
+
if ((e.f & Se) !== 0)
|
|
1371
|
+
throw e.v;
|
|
1372
|
+
return e.v;
|
|
1373
|
+
}
|
|
1374
|
+
function sr(e) {
|
|
1375
|
+
if (e.deps !== null) {
|
|
1376
|
+
e.f ^= ae;
|
|
1377
|
+
for (const t of e.deps)
|
|
1378
|
+
(t.reactions ??= []).push(e), (t.f & K) !== 0 && (t.f & ae) === 0 && sr(
|
|
1379
|
+
/** @type {Derived} */
|
|
1380
|
+
t
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
function or(e) {
|
|
1385
|
+
if (e.v === H) return !0;
|
|
1386
|
+
if (e.deps === null) return !1;
|
|
1387
|
+
for (const t of e.deps)
|
|
1388
|
+
if (Pe.has(t) || (t.f & K) !== 0 && or(
|
|
1389
|
+
/** @type {Derived} */
|
|
1390
|
+
t
|
|
1391
|
+
))
|
|
1392
|
+
return !0;
|
|
1393
|
+
return !1;
|
|
1394
|
+
}
|
|
1395
|
+
function w(e) {
|
|
1396
|
+
var t = le;
|
|
1397
|
+
try {
|
|
1398
|
+
return le = !0, e();
|
|
1399
|
+
} finally {
|
|
1400
|
+
le = t;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
const Ta = -7169;
|
|
1404
|
+
function z(e, t) {
|
|
1405
|
+
e.f = e.f & Ta | t;
|
|
1406
|
+
}
|
|
1407
|
+
function W(e) {
|
|
1408
|
+
if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
|
|
1409
|
+
if (Ke in e)
|
|
1410
|
+
Jt(e);
|
|
1411
|
+
else if (!Array.isArray(e))
|
|
1412
|
+
for (let t in e) {
|
|
1413
|
+
const n = e[t];
|
|
1414
|
+
typeof n == "object" && n && Ke in n && Jt(n);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
function Jt(e, t = /* @__PURE__ */ new Set()) {
|
|
1419
|
+
if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements
|
|
1420
|
+
!(e instanceof EventTarget) && !t.has(e)) {
|
|
1421
|
+
t.add(e), e instanceof Date && e.getTime();
|
|
1422
|
+
for (let r in e)
|
|
1423
|
+
try {
|
|
1424
|
+
Jt(e[r], t);
|
|
1425
|
+
} catch {
|
|
1426
|
+
}
|
|
1427
|
+
const n = xn(e);
|
|
1428
|
+
if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
|
|
1429
|
+
const r = Kr(n);
|
|
1430
|
+
for (let i in r) {
|
|
1431
|
+
const a = r[i].get;
|
|
1432
|
+
if (a)
|
|
1433
|
+
try {
|
|
1434
|
+
a.call(e);
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
function Ma(e, t, n, r = {}) {
|
|
1442
|
+
function i(a) {
|
|
1443
|
+
if (r.capture || xa.call(t, a), !a.cancelBubble)
|
|
1444
|
+
return At(() => n?.call(this, a));
|
|
1445
|
+
}
|
|
1446
|
+
return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Un(() => {
|
|
1447
|
+
t.addEventListener(e, i, r);
|
|
1448
|
+
}) : t.addEventListener(e, i, r), i;
|
|
1449
|
+
}
|
|
1450
|
+
function se(e, t, n, r, i) {
|
|
1451
|
+
var a = { capture: r, passive: i }, l = Ma(e, t, n, a);
|
|
1452
|
+
(t === document.body || // @ts-ignore
|
|
1453
|
+
t === window || // @ts-ignore
|
|
1454
|
+
t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
|
|
1455
|
+
t instanceof HTMLMediaElement) && ln(() => {
|
|
1456
|
+
t.removeEventListener(e, l, a);
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
let Pn = null;
|
|
1460
|
+
function xa(e) {
|
|
1461
|
+
var t = this, n = (
|
|
1462
|
+
/** @type {Node} */
|
|
1463
|
+
t.ownerDocument
|
|
1464
|
+
), r = e.type, i = e.composedPath?.() || [], a = (
|
|
1465
|
+
/** @type {null | Element} */
|
|
1466
|
+
i[0] || e.target
|
|
1467
|
+
);
|
|
1468
|
+
Pn = e;
|
|
1469
|
+
var l = 0, s = Pn === e && e.__root;
|
|
1470
|
+
if (s) {
|
|
1471
|
+
var u = i.indexOf(s);
|
|
1472
|
+
if (u !== -1 && (t === document || t === /** @type {any} */
|
|
1473
|
+
window)) {
|
|
1474
|
+
e.__root = t;
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
var o = i.indexOf(t);
|
|
1478
|
+
if (o === -1)
|
|
1479
|
+
return;
|
|
1480
|
+
u <= o && (l = u);
|
|
1481
|
+
}
|
|
1482
|
+
if (a = /** @type {Element} */
|
|
1483
|
+
i[l] || e.target, a !== t) {
|
|
1484
|
+
Mn(e, "currentTarget", {
|
|
1485
|
+
configurable: !0,
|
|
1486
|
+
get() {
|
|
1487
|
+
return a || n;
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
var d = g, v = R;
|
|
1491
|
+
ue(null), Re(null);
|
|
1492
|
+
try {
|
|
1493
|
+
for (var _, p = []; a !== null; ) {
|
|
1494
|
+
var c = a.assignedSlot || a.parentNode || /** @type {any} */
|
|
1495
|
+
a.host || null;
|
|
1496
|
+
try {
|
|
1497
|
+
var b = a["__" + r];
|
|
1498
|
+
b != null && (!/** @type {any} */
|
|
1499
|
+
a.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1500
|
+
// -> the target could not have been disabled because it emits the event in the first place
|
|
1501
|
+
e.target === a) && b.call(a, e);
|
|
1502
|
+
} catch (y) {
|
|
1503
|
+
_ ? p.push(y) : _ = y;
|
|
1504
|
+
}
|
|
1505
|
+
if (e.cancelBubble || c === t || c === null)
|
|
1506
|
+
break;
|
|
1507
|
+
a = c;
|
|
1508
|
+
}
|
|
1509
|
+
if (_) {
|
|
1510
|
+
for (let y of p)
|
|
1511
|
+
queueMicrotask(() => {
|
|
1512
|
+
throw y;
|
|
1513
|
+
});
|
|
1514
|
+
throw _;
|
|
1515
|
+
}
|
|
1516
|
+
} finally {
|
|
1517
|
+
e.__root = t, delete e.currentTarget, ue(d), Re(v);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function Aa(e) {
|
|
1522
|
+
var t = document.createElement("template");
|
|
1523
|
+
return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
|
|
1524
|
+
}
|
|
1525
|
+
function Pt(e, t) {
|
|
1526
|
+
var n = (
|
|
1527
|
+
/** @type {Effect} */
|
|
1528
|
+
R
|
|
1529
|
+
);
|
|
1530
|
+
n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
|
|
1531
|
+
}
|
|
1532
|
+
// @__NO_SIDE_EFFECTS__
|
|
1533
|
+
function O(e, t) {
|
|
1534
|
+
var n = (t & Ur) !== 0, r = (t & qr) !== 0, i, a = !e.startsWith("<!>");
|
|
1535
|
+
return () => {
|
|
1536
|
+
i === void 0 && (i = Aa(a ? e : "<!>" + e), n || (i = /** @type {TemplateNode} */
|
|
1537
|
+
/* @__PURE__ */ wt(i)));
|
|
1538
|
+
var l = (
|
|
1539
|
+
/** @type {TemplateNode} */
|
|
1540
|
+
r || va ? document.importNode(i, !0) : i.cloneNode(!0)
|
|
1541
|
+
);
|
|
1542
|
+
if (n) {
|
|
1543
|
+
var s = (
|
|
1544
|
+
/** @type {TemplateNode} */
|
|
1545
|
+
/* @__PURE__ */ wt(l)
|
|
1546
|
+
), u = (
|
|
1547
|
+
/** @type {TemplateNode} */
|
|
1548
|
+
l.lastChild
|
|
1549
|
+
);
|
|
1550
|
+
Pt(s, u);
|
|
1551
|
+
} else
|
|
1552
|
+
Pt(l, l);
|
|
1553
|
+
return l;
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
function Na(e = "") {
|
|
1557
|
+
{
|
|
1558
|
+
var t = Me(e + "");
|
|
1559
|
+
return Pt(t, t), t;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
function vt() {
|
|
1563
|
+
var e = document.createDocumentFragment(), t = document.createComment(""), n = Me();
|
|
1564
|
+
return e.append(t, n), Pt(t, n), e;
|
|
1565
|
+
}
|
|
1566
|
+
function x(e, t) {
|
|
1567
|
+
e !== null && e.before(
|
|
1568
|
+
/** @type {Node} */
|
|
1569
|
+
t
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
function Te(e, t) {
|
|
1573
|
+
var n = t == null ? "" : typeof t == "object" ? t + "" : t;
|
|
1574
|
+
n !== (e.__t ??= e.nodeValue) && (e.__t = n, e.nodeValue = n + "");
|
|
1575
|
+
}
|
|
1576
|
+
class Oa {
|
|
1577
|
+
/** @type {TemplateNode} */
|
|
1578
|
+
anchor;
|
|
1579
|
+
/** @type {Map<Batch, Key>} */
|
|
1580
|
+
#t = /* @__PURE__ */ new Map();
|
|
1581
|
+
/**
|
|
1582
|
+
* Map of keys to effects that are currently rendered in the DOM.
|
|
1583
|
+
* These effects are visible and actively part of the document tree.
|
|
1584
|
+
* Example:
|
|
1585
|
+
* ```
|
|
1586
|
+
* {#if condition}
|
|
1587
|
+
* foo
|
|
1588
|
+
* {:else}
|
|
1589
|
+
* bar
|
|
1590
|
+
* {/if}
|
|
1591
|
+
* ```
|
|
1592
|
+
* Can result in the entries `true->Effect` and `false->Effect`
|
|
1593
|
+
* @type {Map<Key, Effect>}
|
|
1594
|
+
*/
|
|
1595
|
+
#n = /* @__PURE__ */ new Map();
|
|
1596
|
+
/**
|
|
1597
|
+
* Similar to #onscreen with respect to the keys, but contains branches that are not yet
|
|
1598
|
+
* in the DOM, because their insertion is deferred.
|
|
1599
|
+
* @type {Map<Key, Branch>}
|
|
1600
|
+
*/
|
|
1601
|
+
#e = /* @__PURE__ */ new Map();
|
|
1602
|
+
/**
|
|
1603
|
+
* Keys of effects that are currently outroing
|
|
1604
|
+
* @type {Set<Key>}
|
|
1605
|
+
*/
|
|
1606
|
+
#r = /* @__PURE__ */ new Set();
|
|
1607
|
+
/**
|
|
1608
|
+
* Whether to pause (i.e. outro) on change, or destroy immediately.
|
|
1609
|
+
* This is necessary for `<svelte:element>`
|
|
1610
|
+
*/
|
|
1611
|
+
#i = !0;
|
|
1612
|
+
/**
|
|
1613
|
+
* @param {TemplateNode} anchor
|
|
1614
|
+
* @param {boolean} transition
|
|
1615
|
+
*/
|
|
1616
|
+
constructor(t, n = !0) {
|
|
1617
|
+
this.anchor = t, this.#i = n;
|
|
1618
|
+
}
|
|
1619
|
+
#a = () => {
|
|
1620
|
+
var t = (
|
|
1621
|
+
/** @type {Batch} */
|
|
1622
|
+
P
|
|
1623
|
+
);
|
|
1624
|
+
if (this.#t.has(t)) {
|
|
1625
|
+
var n = (
|
|
1626
|
+
/** @type {Key} */
|
|
1627
|
+
this.#t.get(t)
|
|
1628
|
+
), r = this.#n.get(n);
|
|
1629
|
+
if (r)
|
|
1630
|
+
dn(r), this.#r.delete(n);
|
|
1631
|
+
else {
|
|
1632
|
+
var i = this.#e.get(n);
|
|
1633
|
+
i && (this.#n.set(n, i.effect), this.#e.delete(n), i.fragment.lastChild.remove(), this.anchor.before(i.fragment), r = i.effect);
|
|
1634
|
+
}
|
|
1635
|
+
for (const [a, l] of this.#t) {
|
|
1636
|
+
if (this.#t.delete(a), a === t)
|
|
1637
|
+
break;
|
|
1638
|
+
const s = this.#e.get(l);
|
|
1639
|
+
s && (ve(s.effect), this.#e.delete(l));
|
|
1640
|
+
}
|
|
1641
|
+
for (const [a, l] of this.#n) {
|
|
1642
|
+
if (a === n || this.#r.has(a)) continue;
|
|
1643
|
+
const s = () => {
|
|
1644
|
+
if (Array.from(this.#t.values()).includes(a)) {
|
|
1645
|
+
var o = document.createDocumentFragment();
|
|
1646
|
+
Pa(l, o), o.append(Me()), this.#e.set(a, { effect: l, fragment: o });
|
|
1647
|
+
} else
|
|
1648
|
+
ve(l);
|
|
1649
|
+
this.#r.delete(a), this.#n.delete(a);
|
|
1650
|
+
};
|
|
1651
|
+
this.#i || !r ? (this.#r.add(a), cn(l, s, !1)) : s();
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
/**
|
|
1656
|
+
* @param {Batch} batch
|
|
1657
|
+
*/
|
|
1658
|
+
#s = (t) => {
|
|
1659
|
+
this.#t.delete(t);
|
|
1660
|
+
const n = Array.from(this.#t.values());
|
|
1661
|
+
for (const [r, i] of this.#e)
|
|
1662
|
+
n.includes(r) || (ve(i.effect), this.#e.delete(r));
|
|
1663
|
+
};
|
|
1664
|
+
/**
|
|
1665
|
+
*
|
|
1666
|
+
* @param {any} key
|
|
1667
|
+
* @param {null | ((target: TemplateNode) => void)} fn
|
|
1668
|
+
*/
|
|
1669
|
+
ensure(t, n) {
|
|
1670
|
+
var r = (
|
|
1671
|
+
/** @type {Batch} */
|
|
1672
|
+
P
|
|
1673
|
+
), i = Gn();
|
|
1674
|
+
if (n && !this.#n.has(t) && !this.#e.has(t))
|
|
1675
|
+
if (i) {
|
|
1676
|
+
var a = document.createDocumentFragment(), l = Me();
|
|
1677
|
+
a.append(l), this.#e.set(t, {
|
|
1678
|
+
effect: at(() => n(l)),
|
|
1679
|
+
fragment: a
|
|
1680
|
+
});
|
|
1681
|
+
} else
|
|
1682
|
+
this.#n.set(
|
|
1683
|
+
t,
|
|
1684
|
+
at(() => n(this.anchor))
|
|
1685
|
+
);
|
|
1686
|
+
if (this.#t.set(r, t), i) {
|
|
1687
|
+
for (const [s, u] of this.#n)
|
|
1688
|
+
s === t ? r.skipped_effects.delete(u) : r.skipped_effects.add(u);
|
|
1689
|
+
for (const [s, u] of this.#e)
|
|
1690
|
+
s === t ? r.skipped_effects.delete(u.effect) : r.skipped_effects.add(u.effect);
|
|
1691
|
+
r.oncommit(this.#a), r.ondiscard(this.#s);
|
|
1692
|
+
} else
|
|
1693
|
+
this.#a();
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
function ee(e, t, n = !1) {
|
|
1697
|
+
var r = new Oa(e), i = n ? et : 0;
|
|
1698
|
+
function a(l, s) {
|
|
1699
|
+
r.ensure(l, s);
|
|
1700
|
+
}
|
|
1701
|
+
Jn(() => {
|
|
1702
|
+
var l = !1;
|
|
1703
|
+
t((s, u = !0) => {
|
|
1704
|
+
l = !0, a(u, s);
|
|
1705
|
+
}), l || a(!1, null);
|
|
1706
|
+
}, i);
|
|
1707
|
+
}
|
|
1708
|
+
function Da(e, t, n) {
|
|
1709
|
+
for (var r = [], i = t.length, a, l = t.length, s = 0; s < i; s++) {
|
|
1710
|
+
let v = t[s];
|
|
1711
|
+
cn(
|
|
1712
|
+
v,
|
|
1713
|
+
() => {
|
|
1714
|
+
if (a) {
|
|
1715
|
+
if (a.pending.delete(v), a.done.add(v), a.pending.size === 0) {
|
|
1716
|
+
var _ = (
|
|
1717
|
+
/** @type {Set<EachOutroGroup>} */
|
|
1718
|
+
e.outrogroups
|
|
1719
|
+
);
|
|
1720
|
+
Xt(en(a.done)), _.delete(a), _.size === 0 && (e.outrogroups = null);
|
|
1721
|
+
}
|
|
1722
|
+
} else
|
|
1723
|
+
l -= 1;
|
|
1724
|
+
},
|
|
1725
|
+
!1
|
|
1726
|
+
);
|
|
1727
|
+
}
|
|
1728
|
+
if (l === 0) {
|
|
1729
|
+
var u = r.length === 0 && n !== null;
|
|
1730
|
+
if (u) {
|
|
1731
|
+
var o = (
|
|
1732
|
+
/** @type {Element} */
|
|
1733
|
+
n
|
|
1734
|
+
), d = (
|
|
1735
|
+
/** @type {Element} */
|
|
1736
|
+
o.parentNode
|
|
1737
|
+
);
|
|
1738
|
+
ha(d), d.append(o), e.items.clear();
|
|
1739
|
+
}
|
|
1740
|
+
Xt(t, !u);
|
|
1741
|
+
} else
|
|
1742
|
+
a = {
|
|
1743
|
+
pending: new Set(t),
|
|
1744
|
+
done: /* @__PURE__ */ new Set()
|
|
1745
|
+
}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
|
|
1746
|
+
}
|
|
1747
|
+
function Xt(e, t = !0) {
|
|
1748
|
+
for (var n = 0; n < e.length; n++)
|
|
1749
|
+
ve(e[n], t);
|
|
1750
|
+
}
|
|
1751
|
+
var kn;
|
|
1752
|
+
function lr(e, t, n, r, i, a = null) {
|
|
1753
|
+
var l = e, s = /* @__PURE__ */ new Map();
|
|
1754
|
+
{
|
|
1755
|
+
var u = (
|
|
1756
|
+
/** @type {Element} */
|
|
1757
|
+
e
|
|
1758
|
+
);
|
|
1759
|
+
l = u.appendChild(Me());
|
|
1760
|
+
}
|
|
1761
|
+
var o = null, d = /* @__PURE__ */ xt(() => {
|
|
1762
|
+
var y = n();
|
|
1763
|
+
return Tn(y) ? y : y == null ? [] : en(y);
|
|
1764
|
+
}), v, _ = !0;
|
|
1765
|
+
function p() {
|
|
1766
|
+
b.fallback = o, Fa(b, v, l, t, r), o !== null && (v.length === 0 ? (o.f & Ee) === 0 ? dn(o) : (o.f ^= Ee, Xe(o, null, l)) : cn(o, () => {
|
|
1767
|
+
o = null;
|
|
1768
|
+
}));
|
|
1769
|
+
}
|
|
1770
|
+
var c = Jn(() => {
|
|
1771
|
+
v = /** @type {V[]} */
|
|
1772
|
+
f(d);
|
|
1773
|
+
for (var y = v.length, E = /* @__PURE__ */ new Set(), m = (
|
|
1774
|
+
/** @type {Batch} */
|
|
1775
|
+
P
|
|
1776
|
+
), S = Gn(), I = 0; I < y; I += 1) {
|
|
1777
|
+
var h = v[I], k = r(h, I), C = _ ? null : s.get(k);
|
|
1778
|
+
C ? (C.v && rt(C.v, h), C.i && rt(C.i, I), S && m.skipped_effects.delete(C.e)) : (C = La(
|
|
1779
|
+
s,
|
|
1780
|
+
_ ? l : kn ??= Me(),
|
|
1781
|
+
h,
|
|
1782
|
+
k,
|
|
1783
|
+
I,
|
|
1784
|
+
i,
|
|
1785
|
+
t,
|
|
1786
|
+
n
|
|
1787
|
+
), _ || (C.e.f |= Ee), s.set(k, C)), E.add(k);
|
|
1788
|
+
}
|
|
1789
|
+
if (y === 0 && a && !o && (_ ? o = at(() => a(l)) : (o = at(() => a(kn ??= Me())), o.f |= Ee)), !_)
|
|
1790
|
+
if (S) {
|
|
1791
|
+
for (const [B, me] of s)
|
|
1792
|
+
E.has(B) || m.skipped_effects.add(me.e);
|
|
1793
|
+
m.oncommit(p), m.ondiscard(() => {
|
|
1794
|
+
});
|
|
1795
|
+
} else
|
|
1796
|
+
p();
|
|
1797
|
+
f(d);
|
|
1798
|
+
}), b = { effect: c, items: s, outrogroups: null, fallback: o };
|
|
1799
|
+
_ = !1;
|
|
1800
|
+
}
|
|
1801
|
+
function Fa(e, t, n, r, i) {
|
|
1802
|
+
var a = t.length, l = e.items, s = e.effect.first, u, o = null, d = [], v = [], _, p, c, b;
|
|
1803
|
+
for (b = 0; b < a; b += 1) {
|
|
1804
|
+
if (_ = t[b], p = i(_, b), c = /** @type {EachItem} */
|
|
1805
|
+
l.get(p).e, e.outrogroups !== null)
|
|
1806
|
+
for (const B of e.outrogroups)
|
|
1807
|
+
B.pending.delete(c), B.done.delete(c);
|
|
1808
|
+
if ((c.f & Ee) !== 0)
|
|
1809
|
+
if (c.f ^= Ee, c === s)
|
|
1810
|
+
Xe(c, null, n);
|
|
1811
|
+
else {
|
|
1812
|
+
var y = o ? o.next : s;
|
|
1813
|
+
c === e.effect.last && (e.effect.last = c.prev), c.prev && (c.prev.next = c.next), c.next && (c.next.prev = c.prev), we(e, o, c), we(e, c, y), Xe(c, y, n), o = c, d = [], v = [], s = o.next;
|
|
1814
|
+
continue;
|
|
1815
|
+
}
|
|
1816
|
+
if ((c.f & Q) !== 0 && dn(c), c !== s) {
|
|
1817
|
+
if (u !== void 0 && u.has(c)) {
|
|
1818
|
+
if (d.length < v.length) {
|
|
1819
|
+
var E = v[0], m;
|
|
1820
|
+
o = E.prev;
|
|
1821
|
+
var S = d[0], I = d[d.length - 1];
|
|
1822
|
+
for (m = 0; m < d.length; m += 1)
|
|
1823
|
+
Xe(d[m], E, n);
|
|
1824
|
+
for (m = 0; m < v.length; m += 1)
|
|
1825
|
+
u.delete(v[m]);
|
|
1826
|
+
we(e, S.prev, I.next), we(e, o, S), we(e, I, E), s = E, o = I, b -= 1, d = [], v = [];
|
|
1827
|
+
} else
|
|
1828
|
+
u.delete(c), Xe(c, s, n), we(e, c.prev, c.next), we(e, c, o === null ? e.effect.first : o.next), we(e, o, c), o = c;
|
|
1829
|
+
continue;
|
|
1830
|
+
}
|
|
1831
|
+
for (d = [], v = []; s !== null && s !== c; )
|
|
1832
|
+
(u ??= /* @__PURE__ */ new Set()).add(s), v.push(s), s = s.next;
|
|
1833
|
+
if (s === null)
|
|
1834
|
+
continue;
|
|
1835
|
+
}
|
|
1836
|
+
(c.f & Ee) === 0 && d.push(c), o = c, s = c.next;
|
|
1837
|
+
}
|
|
1838
|
+
if (e.outrogroups !== null) {
|
|
1839
|
+
for (const B of e.outrogroups)
|
|
1840
|
+
B.pending.size === 0 && (Xt(en(B.done)), e.outrogroups?.delete(B));
|
|
1841
|
+
e.outrogroups.size === 0 && (e.outrogroups = null);
|
|
1842
|
+
}
|
|
1843
|
+
if (s !== null || u !== void 0) {
|
|
1844
|
+
var h = [];
|
|
1845
|
+
if (u !== void 0)
|
|
1846
|
+
for (c of u)
|
|
1847
|
+
(c.f & Q) === 0 && h.push(c);
|
|
1848
|
+
for (; s !== null; )
|
|
1849
|
+
(s.f & Q) === 0 && s !== e.fallback && h.push(s), s = s.next;
|
|
1850
|
+
var k = h.length;
|
|
1851
|
+
if (k > 0) {
|
|
1852
|
+
var C = a === 0 ? n : null;
|
|
1853
|
+
Da(e, h, C);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
function La(e, t, n, r, i, a, l, s) {
|
|
1858
|
+
var u = (l & xr) !== 0 ? (l & Nr) === 0 ? /* @__PURE__ */ ke(n, !1, !1) : nt(n) : null, o = (l & Ar) !== 0 ? nt(i) : null;
|
|
1859
|
+
return {
|
|
1860
|
+
v: u,
|
|
1861
|
+
i: o,
|
|
1862
|
+
e: at(() => (a(t, u ?? n, o ?? i, s), () => {
|
|
1863
|
+
e.delete(r);
|
|
1864
|
+
}))
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
function Xe(e, t, n) {
|
|
1868
|
+
if (e.nodes)
|
|
1869
|
+
for (var r = e.nodes.start, i = e.nodes.end, a = t && (t.f & Ee) === 0 ? (
|
|
1870
|
+
/** @type {EffectNodes} */
|
|
1871
|
+
t.nodes.start
|
|
1872
|
+
) : n; r !== null; ) {
|
|
1873
|
+
var l = (
|
|
1874
|
+
/** @type {TemplateNode} */
|
|
1875
|
+
/* @__PURE__ */ lt(r)
|
|
1876
|
+
);
|
|
1877
|
+
if (a.before(r), r === i)
|
|
1878
|
+
return;
|
|
1879
|
+
r = l;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
function we(e, t, n) {
|
|
1883
|
+
t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
|
|
1884
|
+
}
|
|
1885
|
+
function Rn(e, t, n, r, i) {
|
|
1886
|
+
var a = t.$$slots?.[n], l = !1;
|
|
1887
|
+
a === !0 && (a = t[n === "default" ? "children" : n], l = !0), a === void 0 ? i !== null && i(e) : a(e, l ? () => r : r);
|
|
1888
|
+
}
|
|
1889
|
+
function ur(e) {
|
|
1890
|
+
var t, n, r = "";
|
|
1891
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
1892
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
1893
|
+
var i = e.length;
|
|
1894
|
+
for (t = 0; t < i; t++) e[t] && (n = ur(e[t])) && (r && (r += " "), r += n);
|
|
1895
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
1896
|
+
return r;
|
|
1897
|
+
}
|
|
1898
|
+
function ja() {
|
|
1899
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = ur(e)) && (r && (r += " "), r += t);
|
|
1900
|
+
return r;
|
|
1901
|
+
}
|
|
1902
|
+
function kt(e) {
|
|
1903
|
+
return typeof e == "object" ? ja(e) : e ?? "";
|
|
1904
|
+
}
|
|
1905
|
+
function Ua(e, t, n) {
|
|
1906
|
+
var r = e == null ? "" : "" + e;
|
|
1907
|
+
return r === "" ? null : r;
|
|
1908
|
+
}
|
|
1909
|
+
function qa(e, t) {
|
|
1910
|
+
return e == null ? null : String(e);
|
|
1911
|
+
}
|
|
1912
|
+
function Rt(e, t, n, r, i, a) {
|
|
1913
|
+
var l = e.__className;
|
|
1914
|
+
if (l !== n || l === void 0) {
|
|
1915
|
+
var s = Ua(n);
|
|
1916
|
+
s == null ? e.removeAttribute("class") : e.className = s, e.__className = n;
|
|
1917
|
+
}
|
|
1918
|
+
return a;
|
|
1919
|
+
}
|
|
1920
|
+
function fr(e, t, n, r) {
|
|
1921
|
+
var i = e.__style;
|
|
1922
|
+
if (i !== t) {
|
|
1923
|
+
var a = qa(t);
|
|
1924
|
+
a == null ? e.removeAttribute("style") : e.style.cssText = a, e.__style = t;
|
|
1925
|
+
}
|
|
1926
|
+
return r;
|
|
1927
|
+
}
|
|
1928
|
+
function za(e, t, n = t) {
|
|
1929
|
+
var r = /* @__PURE__ */ new WeakSet();
|
|
1930
|
+
ya(e, "input", async (i) => {
|
|
1931
|
+
var a = i ? e.defaultValue : e.value;
|
|
1932
|
+
if (a = Kt(e) ? Bt(a) : a, n(a), P !== null && r.add(P), await Ca(), a !== (a = t())) {
|
|
1933
|
+
var l = e.selectionStart, s = e.selectionEnd, u = e.value.length;
|
|
1934
|
+
if (e.value = a ?? "", s !== null) {
|
|
1935
|
+
var o = e.value.length;
|
|
1936
|
+
l === s && s === u && o > u ? (e.selectionStart = o, e.selectionEnd = o) : (e.selectionStart = l, e.selectionEnd = Math.min(s, o));
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}), // If we are hydrating and the value has since changed,
|
|
1940
|
+
// then use the updated value from the input instead.
|
|
1941
|
+
// If defaultValue is set, then value == defaultValue
|
|
1942
|
+
// TODO Svelte 6: remove input.value check and set to empty string?
|
|
1943
|
+
w(t) == null && e.value && (n(Kt(e) ? Bt(e.value) : e.value), P !== null && r.add(P)), fn(() => {
|
|
1944
|
+
var i = t();
|
|
1945
|
+
if (e === document.activeElement) {
|
|
1946
|
+
var a = (
|
|
1947
|
+
/** @type {Batch} */
|
|
1948
|
+
ht ?? P
|
|
1949
|
+
);
|
|
1950
|
+
if (r.has(a))
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
Kt(e) && i === Bt(e.value) || e.type === "date" && !i && !e.value || i !== e.value && (e.value = i ?? "");
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
function Kt(e) {
|
|
1957
|
+
var t = e.type;
|
|
1958
|
+
return t === "number" || t === "range";
|
|
1959
|
+
}
|
|
1960
|
+
function Bt(e) {
|
|
1961
|
+
return e === "" ? null : +e;
|
|
1962
|
+
}
|
|
1963
|
+
function Ka(e) {
|
|
1964
|
+
return function(...t) {
|
|
1965
|
+
var n = (
|
|
1966
|
+
/** @type {Event} */
|
|
1967
|
+
t[0]
|
|
1968
|
+
);
|
|
1969
|
+
n.target === this && e?.apply(this, t);
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
function Ba(e) {
|
|
1973
|
+
return function(...t) {
|
|
1974
|
+
var n = (
|
|
1975
|
+
/** @type {Event} */
|
|
1976
|
+
t[0]
|
|
1977
|
+
);
|
|
1978
|
+
return n.preventDefault(), e?.apply(this, t);
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
function vn(e = !1) {
|
|
1982
|
+
const t = (
|
|
1983
|
+
/** @type {ComponentContextLegacy} */
|
|
1984
|
+
U
|
|
1985
|
+
), n = t.l.u;
|
|
1986
|
+
if (!n) return;
|
|
1987
|
+
let r = () => W(t.s);
|
|
1988
|
+
if (e) {
|
|
1989
|
+
let i = 0, a = (
|
|
1990
|
+
/** @type {Record<string, any>} */
|
|
1991
|
+
{}
|
|
1992
|
+
);
|
|
1993
|
+
const l = /* @__PURE__ */ Mt(() => {
|
|
1994
|
+
let s = !1;
|
|
1995
|
+
const u = t.s;
|
|
1996
|
+
for (const o in u)
|
|
1997
|
+
u[o] !== a[o] && (a[o] = u[o], s = !0);
|
|
1998
|
+
return s && i++, i;
|
|
1999
|
+
});
|
|
2000
|
+
r = () => f(l);
|
|
2001
|
+
}
|
|
2002
|
+
n.b.length && wa(() => {
|
|
2003
|
+
In(t, r), Yt(n.b);
|
|
2004
|
+
}), gn(() => {
|
|
2005
|
+
const i = w(() => n.m.map(Hr));
|
|
2006
|
+
return () => {
|
|
2007
|
+
for (const a of i)
|
|
2008
|
+
typeof a == "function" && a();
|
|
2009
|
+
};
|
|
2010
|
+
}), n.a.length && gn(() => {
|
|
2011
|
+
In(t, r), Yt(n.a);
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
function In(e, t) {
|
|
2015
|
+
if (e.l.s)
|
|
2016
|
+
for (const n of e.l.s) f(n);
|
|
2017
|
+
t();
|
|
2018
|
+
}
|
|
2019
|
+
function cr(e, t, n) {
|
|
2020
|
+
if (e == null)
|
|
2021
|
+
return t(void 0), Ht;
|
|
2022
|
+
const r = w(
|
|
2023
|
+
() => e.subscribe(
|
|
2024
|
+
t,
|
|
2025
|
+
// @ts-expect-error
|
|
2026
|
+
n
|
|
2027
|
+
)
|
|
2028
|
+
);
|
|
2029
|
+
return r.unsubscribe ? () => r.unsubscribe() : r;
|
|
2030
|
+
}
|
|
2031
|
+
function Va(e) {
|
|
2032
|
+
let t;
|
|
2033
|
+
return cr(e, (n) => t = n)(), t;
|
|
2034
|
+
}
|
|
2035
|
+
let _t = !1, Qt = /* @__PURE__ */ Symbol();
|
|
2036
|
+
function Ha(e, t, n) {
|
|
2037
|
+
const r = n[t] ??= {
|
|
2038
|
+
store: null,
|
|
2039
|
+
source: /* @__PURE__ */ ke(void 0),
|
|
2040
|
+
unsubscribe: Ht
|
|
2041
|
+
};
|
|
2042
|
+
if (r.store !== e && !(Qt in n))
|
|
2043
|
+
if (r.unsubscribe(), r.store = e ?? null, e == null)
|
|
2044
|
+
r.source.v = void 0, r.unsubscribe = Ht;
|
|
2045
|
+
else {
|
|
2046
|
+
var i = !0;
|
|
2047
|
+
r.unsubscribe = cr(e, (a) => {
|
|
2048
|
+
i ? r.source.v = a : j(r.source, a);
|
|
2049
|
+
}), i = !1;
|
|
2050
|
+
}
|
|
2051
|
+
return e && Qt in n ? Va(e) : f(r.source);
|
|
2052
|
+
}
|
|
2053
|
+
function Ya() {
|
|
2054
|
+
const e = {};
|
|
2055
|
+
function t() {
|
|
2056
|
+
ln(() => {
|
|
2057
|
+
for (var n in e)
|
|
2058
|
+
e[n].unsubscribe();
|
|
2059
|
+
Mn(e, Qt, {
|
|
2060
|
+
enumerable: !1,
|
|
2061
|
+
value: !0
|
|
2062
|
+
});
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
return [e, t];
|
|
2066
|
+
}
|
|
2067
|
+
function Ga(e) {
|
|
2068
|
+
var t = _t;
|
|
2069
|
+
try {
|
|
2070
|
+
return _t = !1, [e(), _t];
|
|
2071
|
+
} finally {
|
|
2072
|
+
_t = t;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
function Y(e, t, n, r) {
|
|
2076
|
+
var i = !st || (n & Dr) !== 0, a = (n & Lr) !== 0, l = (n & jr) !== 0, s = (
|
|
2077
|
+
/** @type {V} */
|
|
2078
|
+
r
|
|
2079
|
+
), u = !0, o = () => (u && (u = !1, s = l ? w(
|
|
2080
|
+
/** @type {() => V} */
|
|
2081
|
+
r
|
|
2082
|
+
) : (
|
|
2083
|
+
/** @type {V} */
|
|
2084
|
+
r
|
|
2085
|
+
)), s), d;
|
|
2086
|
+
if (a) {
|
|
2087
|
+
var v = Ke in e || Gr in e;
|
|
2088
|
+
d = pt(e, t)?.set ?? (v && t in e ? (S) => e[t] = S : void 0);
|
|
2089
|
+
}
|
|
2090
|
+
var _, p = !1;
|
|
2091
|
+
a ? [_, p] = Ga(() => (
|
|
2092
|
+
/** @type {V} */
|
|
2093
|
+
e[t]
|
|
2094
|
+
)) : _ = /** @type {V} */
|
|
2095
|
+
e[t], _ === void 0 && r !== void 0 && (_ = o(), d && (i && $r(), d(_)));
|
|
2096
|
+
var c;
|
|
2097
|
+
if (i ? c = () => {
|
|
2098
|
+
var S = (
|
|
2099
|
+
/** @type {V} */
|
|
2100
|
+
e[t]
|
|
2101
|
+
);
|
|
2102
|
+
return S === void 0 ? o() : (u = !0, S);
|
|
2103
|
+
} : c = () => {
|
|
2104
|
+
var S = (
|
|
2105
|
+
/** @type {V} */
|
|
2106
|
+
e[t]
|
|
2107
|
+
);
|
|
2108
|
+
return S !== void 0 && (s = /** @type {V} */
|
|
2109
|
+
void 0), S === void 0 ? s : S;
|
|
2110
|
+
}, i && (n & Fr) === 0)
|
|
2111
|
+
return c;
|
|
2112
|
+
if (d) {
|
|
2113
|
+
var b = e.$$legacy;
|
|
2114
|
+
return (
|
|
2115
|
+
/** @type {() => V} */
|
|
2116
|
+
(function(S, I) {
|
|
2117
|
+
return arguments.length > 0 ? ((!i || !I || b || p) && d(I ? c() : S), S) : c();
|
|
2118
|
+
})
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
var y = !1, E = ((n & Or) !== 0 ? Mt : xt)(() => (y = !1, c()));
|
|
2122
|
+
a && f(E);
|
|
2123
|
+
var m = (
|
|
2124
|
+
/** @type {Effect} */
|
|
2125
|
+
R
|
|
2126
|
+
);
|
|
2127
|
+
return (
|
|
2128
|
+
/** @type {() => V} */
|
|
2129
|
+
(function(S, I) {
|
|
2130
|
+
if (arguments.length > 0) {
|
|
2131
|
+
const h = I ? f(E) : i && a ? ze(S) : S;
|
|
2132
|
+
return j(E, h), y = !0, s !== void 0 && (s = h), S;
|
|
2133
|
+
}
|
|
2134
|
+
return De && y || (m.f & de) !== 0 ? E.v : f(E);
|
|
2135
|
+
})
|
|
2136
|
+
);
|
|
2137
|
+
}
|
|
2138
|
+
function Wa(e) {
|
|
2139
|
+
const t = e.toLowerCase();
|
|
2140
|
+
return t.includes("paystack") ? "paystack" : t.includes("hubtel") ? "hubtel" : t.includes("flutterwave") ? "flutterwave" : "paystack";
|
|
2141
|
+
}
|
|
2142
|
+
function Za(e, t) {
|
|
2143
|
+
return {
|
|
2144
|
+
id: e.id,
|
|
2145
|
+
clientSecret: e.client_secret,
|
|
2146
|
+
amount: e.amount,
|
|
2147
|
+
currency: e.currency,
|
|
2148
|
+
status: e.status,
|
|
2149
|
+
recommendedPsp: Wa(e.provider),
|
|
2150
|
+
availableMethods: t.paymentMethods || ["card", "mobile_money"],
|
|
2151
|
+
connectionId: e.connection_id,
|
|
2152
|
+
provider: e.provider,
|
|
2153
|
+
feeAmount: e.fee_amount,
|
|
2154
|
+
feeCurrency: e.fee_currency,
|
|
2155
|
+
netAmount: e.net_amount,
|
|
2156
|
+
metadata: t.metadata
|
|
2157
|
+
};
|
|
2158
|
+
}
|
|
2159
|
+
function Ja(e) {
|
|
2160
|
+
const { config: t, onSuccess: n, onError: r, onClose: i, onStateChange: a, apiBaseUrl: l } = e;
|
|
2161
|
+
let s = gr();
|
|
2162
|
+
const u = /* @__PURE__ */ new Set(), o = new Er({
|
|
2163
|
+
publicKey: t.publicKey,
|
|
2164
|
+
baseUrl: l
|
|
2165
|
+
}), d = () => {
|
|
2166
|
+
u.forEach((M) => M(s));
|
|
2167
|
+
}, v = (M) => {
|
|
2168
|
+
const L = s.status;
|
|
2169
|
+
s = kr(s, M), d(), s.status !== L && a?.(s.status);
|
|
2170
|
+
}, _ = (M) => (u.add(M), M(s), () => u.delete(M)), p = async (M) => {
|
|
2171
|
+
v({ type: "INIT_START" });
|
|
2172
|
+
try {
|
|
2173
|
+
const L = t.reference || Sr(), N = Pr(t.currency), re = M || t.paymentMethods?.[0] || "card", { data: Fe, error: V } = await o.createPaymentIntent(
|
|
2174
|
+
{ ...t, reference: L },
|
|
2175
|
+
re,
|
|
2176
|
+
N
|
|
2177
|
+
);
|
|
2178
|
+
if (V) {
|
|
2179
|
+
v({ type: "INIT_ERROR", payload: V }), r?.(V);
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
if (!Fe) {
|
|
2183
|
+
const ft = {
|
|
2184
|
+
code: "INIT_FAILED",
|
|
2185
|
+
message: "No data received from API",
|
|
2186
|
+
recoverable: !0
|
|
2187
|
+
};
|
|
2188
|
+
v({ type: "INIT_ERROR", payload: ft }), r?.(ft);
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
const ye = Za(Fe, { ...t, reference: L });
|
|
2192
|
+
v({ type: "INIT_SUCCESS", payload: ye });
|
|
2193
|
+
} catch (L) {
|
|
2194
|
+
const N = {
|
|
2195
|
+
code: "INIT_FAILED",
|
|
2196
|
+
message: L instanceof Error ? L.message : "Failed to initialize checkout",
|
|
2197
|
+
recoverable: !0,
|
|
2198
|
+
originalError: L
|
|
2199
|
+
};
|
|
2200
|
+
v({ type: "INIT_ERROR", payload: N }), r?.(N);
|
|
2201
|
+
}
|
|
2202
|
+
}, c = (M) => {
|
|
2203
|
+
v({ type: "SELECT_METHOD", payload: M });
|
|
2204
|
+
}, b = async (M) => {
|
|
2205
|
+
if (!(!s.paymentIntent || !s.selectedMethod)) {
|
|
2206
|
+
v({ type: "PROCESS_START" });
|
|
2207
|
+
try {
|
|
2208
|
+
const { data: L, error: N } = await o.confirmPayment(s.paymentIntent.id);
|
|
2209
|
+
if (N) {
|
|
2210
|
+
v({ type: "PROCESS_ERROR", payload: N }), r?.(N);
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2213
|
+
const re = {
|
|
2214
|
+
paymentId: s.paymentIntent.id,
|
|
2215
|
+
reference: M.reference || s.paymentIntent.metadata?.reference || "",
|
|
2216
|
+
amount: s.paymentIntent.amount,
|
|
2217
|
+
currency: s.paymentIntent.currency,
|
|
2218
|
+
paymentMethod: s.selectedMethod,
|
|
2219
|
+
psp: s.paymentIntent.recommendedPsp,
|
|
2220
|
+
pspReference: M.pspReference || L?.provider_ref_id || "",
|
|
2221
|
+
status: "success",
|
|
2222
|
+
metadata: M
|
|
2223
|
+
};
|
|
2224
|
+
v({ type: "PROCESS_SUCCESS", payload: re }), n?.(re);
|
|
2225
|
+
} catch (L) {
|
|
2226
|
+
const N = {
|
|
2227
|
+
code: "PAYMENT_FAILED",
|
|
2228
|
+
message: L instanceof Error ? L.message : "Payment failed",
|
|
2229
|
+
recoverable: !0,
|
|
2230
|
+
originalError: L
|
|
2231
|
+
};
|
|
2232
|
+
v({ type: "PROCESS_ERROR", payload: N }), r?.(N);
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
return {
|
|
2237
|
+
// Svelte store contract
|
|
2238
|
+
subscribe: _,
|
|
2239
|
+
// Actions
|
|
2240
|
+
initialize: p,
|
|
2241
|
+
selectMethod: c,
|
|
2242
|
+
processPayment: b,
|
|
2243
|
+
handlePspSuccess: async (M) => {
|
|
2244
|
+
await b(M);
|
|
2245
|
+
},
|
|
2246
|
+
handlePspError: (M) => {
|
|
2247
|
+
v({ type: "PROCESS_ERROR", payload: M }), r?.(M);
|
|
2248
|
+
},
|
|
2249
|
+
reset: () => {
|
|
2250
|
+
v({ type: "RESET" });
|
|
2251
|
+
},
|
|
2252
|
+
close: async () => {
|
|
2253
|
+
if (s.paymentIntent && s.status !== "success")
|
|
2254
|
+
try {
|
|
2255
|
+
await o.cancelPaymentIntent(s.paymentIntent.id);
|
|
2256
|
+
} catch {
|
|
2257
|
+
}
|
|
2258
|
+
v({ type: "CLOSE" }), i?.();
|
|
2259
|
+
},
|
|
2260
|
+
// Getters
|
|
2261
|
+
getStatus: () => s.status,
|
|
2262
|
+
getPaymentIntent: () => s.paymentIntent,
|
|
2263
|
+
getSelectedMethod: () => s.selectedMethod,
|
|
2264
|
+
getError: () => s.error,
|
|
2265
|
+
getResult: () => s.result,
|
|
2266
|
+
isLoading: () => s.status === "loading" || s.status === "processing",
|
|
2267
|
+
isReady: () => s.status === "ready" || s.status === "method_selected",
|
|
2268
|
+
isComplete: () => s.status === "success",
|
|
2269
|
+
canRetry: () => s.error?.recoverable ?? !1
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
var Xa = /* @__PURE__ */ O('<div class="reevit-radio-inner"></div>'), Qa = /* @__PURE__ */ O('<button type="button"><span class="reevit-method-icon"> </span> <div class="reevit-method-info"><span class="reevit-method-name"> </span> <span class="reevit-method-description"> </span></div> <div class="reevit-method-radio"><!></div></button>'), $a = /* @__PURE__ */ O('<div class="reevit-method-selector"><h3 class="reevit-section-title">Select Payment Method</h3> <p class="reevit-amount-display"> </p> <div class="reevit-methods-grid"></div></div>');
|
|
2273
|
+
function ei(e, t) {
|
|
2274
|
+
an(t, !1);
|
|
2275
|
+
const n = /* @__PURE__ */ ke();
|
|
2276
|
+
let r = Y(t, "methods", 8), i = Y(t, "selected", 8), a = Y(t, "amount", 8), l = Y(t, "currency", 8);
|
|
2277
|
+
const s = $t();
|
|
2278
|
+
function u(p) {
|
|
2279
|
+
s("select", p);
|
|
2280
|
+
}
|
|
2281
|
+
$e(() => W(r()), () => {
|
|
2282
|
+
j(n, [
|
|
2283
|
+
{
|
|
2284
|
+
id: "card",
|
|
2285
|
+
name: "Card",
|
|
2286
|
+
description: "Visa, Mastercard, Maestro",
|
|
2287
|
+
icon: "💳"
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
id: "mobile_money",
|
|
2291
|
+
name: "Mobile Money",
|
|
2292
|
+
description: "MTN, Vodafone, AirtelTigo",
|
|
2293
|
+
icon: "📱"
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
id: "bank_transfer",
|
|
2297
|
+
name: "Bank Transfer",
|
|
2298
|
+
description: "Transfer directly from your bank",
|
|
2299
|
+
icon: "🏦"
|
|
2300
|
+
}
|
|
2301
|
+
].filter((p) => r().includes(p.id)));
|
|
2302
|
+
}), un(), vn();
|
|
2303
|
+
var o = $a(), d = D(A(o), 2), v = A(d), _ = D(d, 2);
|
|
2304
|
+
lr(_, 5, () => f(n), (p) => p.id, (p, c) => {
|
|
2305
|
+
var b = Qa(), y = A(b), E = A(y), m = D(y, 2), S = A(m), I = A(S), h = D(S, 2), k = A(h), C = D(m, 2), B = A(C);
|
|
2306
|
+
{
|
|
2307
|
+
var me = (T) => {
|
|
2308
|
+
var F = Xa();
|
|
2309
|
+
x(T, F);
|
|
2310
|
+
};
|
|
2311
|
+
ee(B, (T) => {
|
|
2312
|
+
W(i()), f(c), w(() => i() === f(c).id) && T(me);
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
oe(
|
|
2316
|
+
(T) => {
|
|
2317
|
+
Rt(b, 1, T), Te(E, (f(c), w(() => f(c).icon))), Te(I, (f(c), w(() => f(c).name))), Te(k, (f(c), w(() => f(c).description)));
|
|
2318
|
+
},
|
|
2319
|
+
[
|
|
2320
|
+
() => kt((W(ge), W(i()), f(c), w(() => ge("reevit-method-card", i() === f(c).id && "reevit-method-card--selected"))))
|
|
2321
|
+
]
|
|
2322
|
+
), se("click", b, () => u(f(c).id)), x(p, b);
|
|
2323
|
+
}), oe((p) => Te(v, `Pay ${p ?? ""}`), [
|
|
2324
|
+
() => (W(mn), W(a()), W(l()), w(() => mn(a(), l())))
|
|
2325
|
+
]), x(e, o), sn();
|
|
2326
|
+
}
|
|
2327
|
+
var ti = /* @__PURE__ */ O('<button type="button"><div class="reevit-network-dot"></div> </button>'), ni = /* @__PURE__ */ O('<p class="reevit-error-message"> </p>'), ri = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), ai = /* @__PURE__ */ O("<span>Continue</span>"), ii = /* @__PURE__ */ O('<form class="reevit-momo-form"><div class="reevit-form-group"><label class="reevit-label" for="reevit-phone">Phone Number</label> <input id="reevit-phone" type="tel" placeholder="e.g. 024 123 4567" autocomplete="tel"/></div> <div class="reevit-network-selector"><label class="reevit-label" for="reevit-network-grid">Select Network</label> <div id="reevit-network-grid" class="reevit-networks-grid"></div></div> <!> <button type="submit" class="reevit-submit-btn"><!></button> <p class="reevit-secure-text">🔒 Secure mobile money payment via Reevit</p></form>');
|
|
2328
|
+
function si(e, t) {
|
|
2329
|
+
an(t, !1);
|
|
2330
|
+
let n = Y(t, "initialPhone", 8, ""), r = Y(t, "loading", 8, !1);
|
|
2331
|
+
const i = $t();
|
|
2332
|
+
let a = /* @__PURE__ */ ke(n()), l = /* @__PURE__ */ ke(null), s = /* @__PURE__ */ ke(null);
|
|
2333
|
+
function u() {
|
|
2334
|
+
if (!qt(f(a))) {
|
|
2335
|
+
j(s, "Please enter a valid phone number");
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
if (!f(l)) {
|
|
2339
|
+
j(s, "Please select your mobile network");
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
i("submit", { phone: f(a), network: f(l) });
|
|
2343
|
+
}
|
|
2344
|
+
const o = [
|
|
2345
|
+
{ id: "mtn", name: "MTN", color: "#FFCC00" },
|
|
2346
|
+
{ id: "vodafone", name: "Vodafone", color: "#E60000" },
|
|
2347
|
+
{ id: "airteltigo", name: "AirtelTigo", color: "#005596" }
|
|
2348
|
+
];
|
|
2349
|
+
$e(() => (f(a), f(s)), () => {
|
|
2350
|
+
const h = Rr(f(a));
|
|
2351
|
+
h && j(l, h), f(s) && j(s, null);
|
|
2352
|
+
}), un(), vn();
|
|
2353
|
+
var d = ii(), v = A(d), _ = D(A(v), 2), p = D(v, 2), c = D(A(p), 2);
|
|
2354
|
+
lr(c, 5, () => o, (h) => h.id, (h, k) => {
|
|
2355
|
+
var C = ti(), B = A(C), me = D(B);
|
|
2356
|
+
oe(
|
|
2357
|
+
(T) => {
|
|
2358
|
+
Rt(C, 1, T), C.disabled = r(), fr(B, `background-color: ${f(k), w(() => f(k).color) ?? ""}`), Te(me, ` ${f(k), w(() => f(k).name) ?? ""}`);
|
|
2359
|
+
},
|
|
2360
|
+
[
|
|
2361
|
+
() => kt((W(ge), f(l), f(k), w(() => ge("reevit-network-btn", f(l) === f(k).id && "reevit-network-btn--selected"))))
|
|
2362
|
+
]
|
|
2363
|
+
), se("click", C, () => j(l, f(k).id)), x(h, C);
|
|
2364
|
+
});
|
|
2365
|
+
var b = D(p, 2);
|
|
2366
|
+
{
|
|
2367
|
+
var y = (h) => {
|
|
2368
|
+
var k = ni(), C = A(k);
|
|
2369
|
+
oe(() => Te(C, f(s))), x(h, k);
|
|
2370
|
+
};
|
|
2371
|
+
ee(b, (h) => {
|
|
2372
|
+
f(s) && h(y);
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
var E = D(b, 2), m = A(E);
|
|
2376
|
+
{
|
|
2377
|
+
var S = (h) => {
|
|
2378
|
+
var k = ri();
|
|
2379
|
+
x(h, k);
|
|
2380
|
+
}, I = (h) => {
|
|
2381
|
+
var k = ai();
|
|
2382
|
+
x(h, k);
|
|
2383
|
+
};
|
|
2384
|
+
ee(m, (h) => {
|
|
2385
|
+
r() ? h(S) : h(I, !1);
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
oe(
|
|
2389
|
+
(h) => {
|
|
2390
|
+
Rt(_, 1, h), _.disabled = r(), E.disabled = r() || !f(a);
|
|
2391
|
+
},
|
|
2392
|
+
[
|
|
2393
|
+
() => kt((W(ge), f(s), W(qt), f(a), w(() => ge("reevit-input", f(s) && !qt(f(a)) && "reevit-input--error"))))
|
|
2394
|
+
]
|
|
2395
|
+
), za(_, () => f(a), (h) => j(a, h)), se("submit", d, Ba(u)), x(e, d), sn();
|
|
2396
|
+
}
|
|
2397
|
+
const Cn = /* @__PURE__ */ new Map();
|
|
2398
|
+
function ut(e, t) {
|
|
2399
|
+
const n = Cn.get(t);
|
|
2400
|
+
if (n) return n;
|
|
2401
|
+
const r = new Promise((i, a) => {
|
|
2402
|
+
if (document.getElementById(t)) {
|
|
2403
|
+
i();
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
const l = document.createElement("script");
|
|
2407
|
+
l.id = t, l.src = e, l.async = !0, l.onload = () => i(), l.onerror = () => a(new Error(`Failed to load ${t} script`)), document.head.appendChild(l);
|
|
2408
|
+
});
|
|
2409
|
+
return Cn.set(t, r), r;
|
|
2410
|
+
}
|
|
2411
|
+
function oi() {
|
|
2412
|
+
return ut("https://js.paystack.co/v1/inline.js", "paystack-script");
|
|
2413
|
+
}
|
|
2414
|
+
function li() {
|
|
2415
|
+
return ut("https://checkout.hubtel.com/js/hubtel-checkout.js", "hubtel-script");
|
|
2416
|
+
}
|
|
2417
|
+
function ui() {
|
|
2418
|
+
return ut("https://checkout.flutterwave.com/v3.js", "flutterwave-script");
|
|
2419
|
+
}
|
|
2420
|
+
function fi() {
|
|
2421
|
+
return ut("https://js.stripe.com/v3/", "stripe-script");
|
|
2422
|
+
}
|
|
2423
|
+
function ci() {
|
|
2424
|
+
return ut("https://sdk.monnify.com/plugin/monnify.js", "monnify-script");
|
|
2425
|
+
}
|
|
2426
|
+
async function di(e) {
|
|
2427
|
+
if (await oi(), !window.PaystackPop)
|
|
2428
|
+
throw new Error("Paystack script not loaded");
|
|
2429
|
+
window.PaystackPop.setup({
|
|
2430
|
+
key: e.key,
|
|
2431
|
+
email: e.email,
|
|
2432
|
+
amount: e.amount,
|
|
2433
|
+
currency: e.currency,
|
|
2434
|
+
ref: e.ref,
|
|
2435
|
+
metadata: e.metadata,
|
|
2436
|
+
callback: e.onSuccess,
|
|
2437
|
+
onClose: e.onClose
|
|
2438
|
+
}).openIframe();
|
|
2439
|
+
}
|
|
2440
|
+
async function vi(e) {
|
|
2441
|
+
if (await li(), !window.HubtelCheckout)
|
|
2442
|
+
throw new Error("Hubtel script not loaded");
|
|
2443
|
+
window.HubtelCheckout.initPay({
|
|
2444
|
+
clientId: e.clientId,
|
|
2445
|
+
purchaseDescription: e.purchaseDescription,
|
|
2446
|
+
amount: e.amount,
|
|
2447
|
+
callbackUrl: e.callbackUrl,
|
|
2448
|
+
customerPhone: e.customerPhone,
|
|
2449
|
+
customerEmail: e.customerEmail,
|
|
2450
|
+
onSuccess: e.onSuccess,
|
|
2451
|
+
onClose: e.onClose
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
async function _i(e) {
|
|
2455
|
+
if (await ui(), !window.FlutterwaveCheckout)
|
|
2456
|
+
throw new Error("Flutterwave script not loaded");
|
|
2457
|
+
window.FlutterwaveCheckout({
|
|
2458
|
+
public_key: e.public_key,
|
|
2459
|
+
tx_ref: e.tx_ref,
|
|
2460
|
+
amount: e.amount,
|
|
2461
|
+
currency: e.currency,
|
|
2462
|
+
customer: e.customer,
|
|
2463
|
+
payment_options: e.payment_options,
|
|
2464
|
+
customizations: e.customizations,
|
|
2465
|
+
callback: e.callback,
|
|
2466
|
+
onclose: e.onclose
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
async function pi(e) {
|
|
2470
|
+
if (await fi(), !window.Stripe)
|
|
2471
|
+
throw new Error("Stripe.js not loaded");
|
|
2472
|
+
return window.Stripe(e);
|
|
2473
|
+
}
|
|
2474
|
+
async function xi(e) {
|
|
2475
|
+
const n = await (await pi(e.publishableKey)).confirmPayment({
|
|
2476
|
+
elements: e.elements,
|
|
2477
|
+
clientSecret: e.clientSecret,
|
|
2478
|
+
redirect: "if_required"
|
|
2479
|
+
});
|
|
2480
|
+
n.error ? e.onError({ message: n.error.message || "Payment failed" }) : n.paymentIntent && e.onSuccess({
|
|
2481
|
+
paymentIntentId: n.paymentIntent.id,
|
|
2482
|
+
status: n.paymentIntent.status
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
async function Ai(e) {
|
|
2486
|
+
if (await ci(), !window.MonnifySDK)
|
|
2487
|
+
throw new Error("Monnify SDK not loaded");
|
|
2488
|
+
window.MonnifySDK.initialize({
|
|
2489
|
+
amount: e.amount,
|
|
2490
|
+
currency: e.currency,
|
|
2491
|
+
reference: e.reference,
|
|
2492
|
+
customerName: e.customerName,
|
|
2493
|
+
customerEmail: e.customerEmail,
|
|
2494
|
+
customerMobileNumber: e.customerPhone,
|
|
2495
|
+
apiKey: e.apiKey,
|
|
2496
|
+
contractCode: e.contractCode,
|
|
2497
|
+
paymentDescription: e.paymentDescription || "Payment",
|
|
2498
|
+
isTestMode: e.isTestMode ?? !1,
|
|
2499
|
+
metadata: e.metadata,
|
|
2500
|
+
onComplete: (t) => {
|
|
2501
|
+
t.status === "SUCCESS" ? e.onSuccess({
|
|
2502
|
+
transactionReference: t.transactionReference,
|
|
2503
|
+
paymentReference: t.paymentReference,
|
|
2504
|
+
...t
|
|
2505
|
+
}) : e.onError?.({ message: t.message || "Payment failed" });
|
|
2506
|
+
},
|
|
2507
|
+
onClose: e.onClose
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
async function Ni(e, t) {
|
|
2511
|
+
e.onInitiated();
|
|
2512
|
+
try {
|
|
2513
|
+
const n = await fetch(t, {
|
|
2514
|
+
method: "POST",
|
|
2515
|
+
headers: { "Content-Type": "application/json" },
|
|
2516
|
+
body: JSON.stringify({
|
|
2517
|
+
phone_number: e.phoneNumber,
|
|
2518
|
+
amount: e.amount,
|
|
2519
|
+
reference: e.reference,
|
|
2520
|
+
description: e.description
|
|
2521
|
+
})
|
|
2522
|
+
});
|
|
2523
|
+
if (!n.ok) {
|
|
2524
|
+
const a = (await n.json().catch(() => ({}))).message || "Failed to initiate M-Pesa payment";
|
|
2525
|
+
return e.onError({ message: a }), { status: "failed", message: a };
|
|
2526
|
+
}
|
|
2527
|
+
const r = await n.json();
|
|
2528
|
+
return {
|
|
2529
|
+
status: "initiated",
|
|
2530
|
+
message: "Please check your phone and enter your M-Pesa PIN to complete the payment.",
|
|
2531
|
+
transactionId: r.checkout_request_id || r.transaction_id
|
|
2532
|
+
};
|
|
2533
|
+
} catch (n) {
|
|
2534
|
+
const r = n instanceof Error ? n.message : "Network error";
|
|
2535
|
+
return e.onError({ message: r }), { status: "failed", message: r };
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
var hi = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), mi = /* @__PURE__ */ O('<button type="button" class="reevit-pay-button"><!></button>'), yi = /* @__PURE__ */ O('<div class="reevit-loading-state"><div class="reevit-spinner reevit-spinner--large"></div> <p>Initializing payment...</p></div>'), bi = /* @__PURE__ */ O('<div class="reevit-error-state"><div class="reevit-error-icon">⚠️</div> <h3>Payment Failed</h3> <p> </p> <button class="reevit-retry-btn">Retry</button></div>'), wi = /* @__PURE__ */ O('<div class="reevit-success-state"><div class="reevit-success-icon">✅</div> <h3>Payment Successful</h3> <p>Thank you for your payment.</p> <button class="reevit-done-btn">Done</button></div>'), gi = /* @__PURE__ */ O('<div class="reevit-method-form-container"><!></div>'), Ei = /* @__PURE__ */ O('<span class="reevit-spinner"></span>'), Si = /* @__PURE__ */ O("<span>Proceed to Card Payment</span>"), Pi = /* @__PURE__ */ O('<div class="reevit-card-info"><p class="reevit-info-text">You will be redirected to our secure payment partner to complete your card payment.</p> <button class="reevit-submit-btn"><!></button></div>'), ki = /* @__PURE__ */ O("<!> <!> <!>", 1), Ri = /* @__PURE__ */ O('<div class="reevit-modal-overlay" role="button" tabindex="0"><div><button class="reevit-modal-close" aria-label="Close">×</button> <div class="reevit-modal-header"><h2 class="reevit-modal-title">Reevit Checkout</h2> <p class="reevit-modal-subtitle">Secure payment powered by Reevit</p></div> <div class="reevit-modal-body"><!></div> <div class="reevit-modal-footer"><div class="reevit-trust-badges"><span>PCI DSS Compliant</span> <span>•</span> <span>SSL Secure</span></div></div></div></div>'), Ii = /* @__PURE__ */ O('<div class="reevit-sdk-container"><!> <!></div>');
|
|
2539
|
+
function Oi(e, t) {
|
|
2540
|
+
an(t, !1);
|
|
2541
|
+
const n = () => Ha(m, "$store", r), [r, i] = Ya(), a = /* @__PURE__ */ ke(), l = /* @__PURE__ */ ke(), s = $t();
|
|
2542
|
+
let u = Y(t, "publicKey", 8), o = Y(t, "amount", 8), d = Y(t, "currency", 8), v = Y(t, "email", 8, void 0), _ = Y(t, "phone", 8, void 0), p = Y(t, "reference", 8, void 0), c = Y(t, "metadata", 8, void 0), b = Y(t, "paymentMethods", 24, () => ["card", "mobile_money"]), y = Y(t, "theme", 24, () => ({})), E = Y(t, "isOpen", 12, !1);
|
|
2543
|
+
const m = Ja({
|
|
2544
|
+
config: {
|
|
2545
|
+
publicKey: u(),
|
|
2546
|
+
amount: o(),
|
|
2547
|
+
currency: d(),
|
|
2548
|
+
email: v(),
|
|
2549
|
+
phone: _(),
|
|
2550
|
+
reference: p(),
|
|
2551
|
+
metadata: c(),
|
|
2552
|
+
paymentMethods: b()
|
|
2553
|
+
},
|
|
2554
|
+
onSuccess: (T) => s("success", T),
|
|
2555
|
+
onError: (T) => s("error", T),
|
|
2556
|
+
onClose: () => {
|
|
2557
|
+
E(!1), s("close");
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
function S() {
|
|
2561
|
+
E(!0);
|
|
2562
|
+
}
|
|
2563
|
+
function I() {
|
|
2564
|
+
E(!1), m.close();
|
|
2565
|
+
}
|
|
2566
|
+
async function h(T) {
|
|
2567
|
+
if (!f(a).paymentIntent) return;
|
|
2568
|
+
const F = f(a).paymentIntent.recommendedPsp;
|
|
2569
|
+
try {
|
|
2570
|
+
F === "paystack" ? await di({
|
|
2571
|
+
key: u(),
|
|
2572
|
+
email: v() || "",
|
|
2573
|
+
amount: o(),
|
|
2574
|
+
currency: d(),
|
|
2575
|
+
ref: f(a).paymentIntent.id,
|
|
2576
|
+
onSuccess: (Z) => m.handlePspSuccess(Z),
|
|
2577
|
+
onClose: () => {
|
|
2578
|
+
}
|
|
2579
|
+
}) : F === "hubtel" ? await vi({
|
|
2580
|
+
clientId: u(),
|
|
2581
|
+
purchaseDescription: `Payment for ${o()} ${d()}`,
|
|
2582
|
+
amount: o(),
|
|
2583
|
+
customerPhone: T?.phone || _(),
|
|
2584
|
+
customerEmail: v(),
|
|
2585
|
+
onSuccess: (Z) => m.handlePspSuccess(Z),
|
|
2586
|
+
onClose: () => {
|
|
2587
|
+
}
|
|
2588
|
+
}) : F === "flutterwave" && await _i({
|
|
2589
|
+
public_key: u(),
|
|
2590
|
+
tx_ref: f(a).paymentIntent.id,
|
|
2591
|
+
amount: o(),
|
|
2592
|
+
currency: d(),
|
|
2593
|
+
customer: { email: v() || "", phone_number: T?.phone || _() },
|
|
2594
|
+
callback: (Z) => m.handlePspSuccess(Z),
|
|
2595
|
+
onclose: () => {
|
|
2596
|
+
}
|
|
2597
|
+
});
|
|
2598
|
+
} catch (Z) {
|
|
2599
|
+
m.handlePspError({
|
|
2600
|
+
code: "BRIDGE_ERROR",
|
|
2601
|
+
message: Z instanceof Error ? Z.message : "Failed to open payment gateway"
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
br(() => {
|
|
2606
|
+
E() && m.initialize();
|
|
2607
|
+
}), wr(() => {
|
|
2608
|
+
typeof document < "u" && (document.body.style.overflow = "");
|
|
2609
|
+
}), $e(() => n(), () => {
|
|
2610
|
+
j(a, n());
|
|
2611
|
+
}), $e(() => W(y()), () => {
|
|
2612
|
+
j(l, Ir(y()));
|
|
2613
|
+
}), $e(() => (W(E()), f(a)), () => {
|
|
2614
|
+
E() ? (document.body.style.overflow = "hidden", f(a).paymentIntent || m.initialize()) : typeof document < "u" && (document.body.style.overflow = "");
|
|
2615
|
+
}), un(), vn();
|
|
2616
|
+
var k = Ii(), C = A(k);
|
|
2617
|
+
Rn(
|
|
2618
|
+
C,
|
|
2619
|
+
t,
|
|
2620
|
+
"default",
|
|
2621
|
+
{
|
|
2622
|
+
handleOpen: S,
|
|
2623
|
+
get isLoading() {
|
|
2624
|
+
return f(a), w(() => f(a).status === "loading");
|
|
2625
|
+
}
|
|
2626
|
+
},
|
|
2627
|
+
(T) => {
|
|
2628
|
+
var F = mi(), Z = A(F);
|
|
2629
|
+
{
|
|
2630
|
+
var M = (N) => {
|
|
2631
|
+
var re = hi();
|
|
2632
|
+
x(N, re);
|
|
2633
|
+
}, L = (N) => {
|
|
2634
|
+
var re = vt(), Fe = Je(re);
|
|
2635
|
+
Rn(Fe, t, "button-text", {}, (V) => {
|
|
2636
|
+
var ye = Na("Pay Now");
|
|
2637
|
+
x(V, ye);
|
|
2638
|
+
}), x(N, re);
|
|
2639
|
+
};
|
|
2640
|
+
ee(Z, (N) => {
|
|
2641
|
+
f(a), w(() => f(a).status === "loading") ? N(M) : N(L, !1);
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
oe(() => F.disabled = (f(a), w(() => f(a).status === "loading"))), se("click", F, S), x(T, F);
|
|
2645
|
+
}
|
|
2646
|
+
);
|
|
2647
|
+
var B = D(C, 2);
|
|
2648
|
+
{
|
|
2649
|
+
var me = (T) => {
|
|
2650
|
+
var F = Ri(), Z = A(F), M = A(Z), L = D(M, 4), N = A(L);
|
|
2651
|
+
{
|
|
2652
|
+
var re = (V) => {
|
|
2653
|
+
var ye = yi();
|
|
2654
|
+
x(V, ye);
|
|
2655
|
+
}, Fe = (V) => {
|
|
2656
|
+
var ye = vt(), ft = Je(ye);
|
|
2657
|
+
{
|
|
2658
|
+
var dr = (Le) => {
|
|
2659
|
+
var Ye = bi(), ct = D(A(Ye), 4), Nt = A(ct), Ot = D(ct, 2);
|
|
2660
|
+
oe(() => Te(Nt, (f(a), w(() => f(a).error.message)))), se("click", Ot, () => m.initialize()), x(Le, Ye);
|
|
2661
|
+
}, vr = (Le) => {
|
|
2662
|
+
var Ye = vt(), ct = Je(Ye);
|
|
2663
|
+
{
|
|
2664
|
+
var Nt = (je) => {
|
|
2665
|
+
var Ge = wi(), Dt = D(A(Ge), 6);
|
|
2666
|
+
se("click", Dt, I), x(je, Ge);
|
|
2667
|
+
}, Ot = (je) => {
|
|
2668
|
+
var Ge = vt(), Dt = Je(Ge);
|
|
2669
|
+
{
|
|
2670
|
+
var _r = (Ft) => {
|
|
2671
|
+
var _n = ki(), pn = Je(_n);
|
|
2672
|
+
ei(pn, {
|
|
2673
|
+
get methods() {
|
|
2674
|
+
return b();
|
|
2675
|
+
},
|
|
2676
|
+
get selected() {
|
|
2677
|
+
return f(a), w(() => f(a).selectedMethod);
|
|
2678
|
+
},
|
|
2679
|
+
get amount() {
|
|
2680
|
+
return o();
|
|
2681
|
+
},
|
|
2682
|
+
get currency() {
|
|
2683
|
+
return d();
|
|
2684
|
+
},
|
|
2685
|
+
$$events: { select: (fe) => m.selectMethod(fe.detail) }
|
|
2686
|
+
});
|
|
2687
|
+
var hn = D(pn, 2);
|
|
2688
|
+
{
|
|
2689
|
+
var pr = (fe) => {
|
|
2690
|
+
var We = gi(), Ze = A(We);
|
|
2691
|
+
{
|
|
2692
|
+
let Lt = /* @__PURE__ */ xt(() => (f(a), w(() => f(a).status === "processing")));
|
|
2693
|
+
si(Ze, {
|
|
2694
|
+
get initialPhone() {
|
|
2695
|
+
return _();
|
|
2696
|
+
},
|
|
2697
|
+
get loading() {
|
|
2698
|
+
return f(Lt);
|
|
2699
|
+
},
|
|
2700
|
+
$$events: { submit: (jt) => h(jt.detail) }
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2703
|
+
x(fe, We);
|
|
2704
|
+
};
|
|
2705
|
+
ee(hn, (fe) => {
|
|
2706
|
+
f(a), w(() => f(a).status === "method_selected" && f(a).selectedMethod === "mobile_money") && fe(pr);
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
var hr = D(hn, 2);
|
|
2710
|
+
{
|
|
2711
|
+
var mr = (fe) => {
|
|
2712
|
+
var We = Pi(), Ze = D(A(We), 2), Lt = A(Ze);
|
|
2713
|
+
{
|
|
2714
|
+
var jt = (Ue) => {
|
|
2715
|
+
var Ut = Ei();
|
|
2716
|
+
x(Ue, Ut);
|
|
2717
|
+
}, yr = (Ue) => {
|
|
2718
|
+
var Ut = Si();
|
|
2719
|
+
x(Ue, Ut);
|
|
2720
|
+
};
|
|
2721
|
+
ee(Lt, (Ue) => {
|
|
2722
|
+
f(a), w(() => f(a).status === "processing") ? Ue(jt) : Ue(yr, !1);
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
oe(() => Ze.disabled = (f(a), w(() => f(a).status === "processing"))), se("click", Ze, () => h(null)), x(fe, We);
|
|
2726
|
+
};
|
|
2727
|
+
ee(hr, (fe) => {
|
|
2728
|
+
f(a), w(() => f(a).status === "method_selected" && f(a).selectedMethod === "card") && fe(mr);
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
x(Ft, _n);
|
|
2732
|
+
};
|
|
2733
|
+
ee(
|
|
2734
|
+
Dt,
|
|
2735
|
+
(Ft) => {
|
|
2736
|
+
f(a), w(() => f(a).status === "ready" || f(a).status === "method_selected") && Ft(_r);
|
|
2737
|
+
},
|
|
2738
|
+
!0
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
x(je, Ge);
|
|
2742
|
+
};
|
|
2743
|
+
ee(
|
|
2744
|
+
ct,
|
|
2745
|
+
(je) => {
|
|
2746
|
+
f(a), w(() => f(a).status === "success") ? je(Nt) : je(Ot, !1);
|
|
2747
|
+
},
|
|
2748
|
+
!0
|
|
2749
|
+
);
|
|
2750
|
+
}
|
|
2751
|
+
x(Le, Ye);
|
|
2752
|
+
};
|
|
2753
|
+
ee(
|
|
2754
|
+
ft,
|
|
2755
|
+
(Le) => {
|
|
2756
|
+
f(a), w(() => f(a).status === "failed" && f(a).error) ? Le(dr) : Le(vr, !1);
|
|
2757
|
+
},
|
|
2758
|
+
!0
|
|
2759
|
+
);
|
|
2760
|
+
}
|
|
2761
|
+
x(V, ye);
|
|
2762
|
+
};
|
|
2763
|
+
ee(N, (V) => {
|
|
2764
|
+
f(a), w(() => f(a).status === "loading") ? V(re) : V(Fe, !1);
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2767
|
+
oe((V) => Rt(Z, 1, V), [
|
|
2768
|
+
() => kt((W(ge), W(y()), w(() => ge("reevit-modal-content", y().darkMode && "reevit-modal--dark"))))
|
|
2769
|
+
]), se("click", M, I), se("click", F, Ka(I)), se("keydown", F, (V) => V.key === "Escape" && I()), x(T, F);
|
|
2770
|
+
};
|
|
2771
|
+
ee(B, (T) => {
|
|
2772
|
+
E() && T(me);
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
oe((T) => fr(k, T), [
|
|
2776
|
+
() => (f(l), w(() => Object.entries(f(l)).map(([T, F]) => `${T}:${F}`).join(";")))
|
|
2777
|
+
]), x(e, k), sn(), i();
|
|
2778
|
+
}
|
|
2779
|
+
export {
|
|
2780
|
+
si as MobileMoneyForm,
|
|
2781
|
+
ei as PaymentMethodSelector,
|
|
2782
|
+
Li as ReevitAPIClient,
|
|
2783
|
+
Oi as ReevitCheckout,
|
|
2784
|
+
ji as cn,
|
|
2785
|
+
xi as confirmStripePayment,
|
|
2786
|
+
Ui as createInitialState,
|
|
2787
|
+
qi as createReevitClient,
|
|
2788
|
+
Ja as createReevitStore,
|
|
2789
|
+
pi as createStripeInstance,
|
|
2790
|
+
zi as detectCountryFromCurrency,
|
|
2791
|
+
Ki as detectNetwork,
|
|
2792
|
+
Bi as formatAmount,
|
|
2793
|
+
Vi as formatPhone,
|
|
2794
|
+
Ni as initiateMPesaSTKPush,
|
|
2795
|
+
ui as loadFlutterwaveScript,
|
|
2796
|
+
li as loadHubtelScript,
|
|
2797
|
+
ci as loadMonnifyScript,
|
|
2798
|
+
oi as loadPaystackScript,
|
|
2799
|
+
fi as loadStripeScript,
|
|
2800
|
+
_i as openFlutterwaveModal,
|
|
2801
|
+
vi as openHubtelPopup,
|
|
2802
|
+
Ai as openMonnifyModal,
|
|
2803
|
+
di as openPaystackPopup,
|
|
2804
|
+
Hi as reevitReducer,
|
|
2805
|
+
Yi as validatePhone
|
|
2806
|
+
};
|