@txnlab/use-wallet-solid 3.10.1 → 3.11.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.
Files changed (46) hide show
  1. package/dist/dev.cjs +63 -19
  2. package/dist/dev.js +63 -19
  3. package/dist/dev.jsx +99 -7214
  4. package/dist/index.cjs +738 -0
  5. package/dist/index.js +578 -126270
  6. package/dist/index.jsx +25 -16
  7. package/package.json +8 -8
  8. package/dist/chunk/2PXYBV4S.jsx +0 -883
  9. package/dist/chunk/3J6PRJNJ.mjs +0 -779
  10. package/dist/chunk/3YPORCKB.mjs +0 -9324
  11. package/dist/chunk/ASHSTAAQ.mjs +0 -663
  12. package/dist/chunk/B3UVEMEI.mjs +0 -835
  13. package/dist/chunk/BCEWTVZW.mjs +0 -16644
  14. package/dist/chunk/CL7LX3O4.jsx +0 -50
  15. package/dist/chunk/DTJ3ICHE.mjs +0 -9
  16. package/dist/chunk/FNEO6DUO.jsx +0 -14
  17. package/dist/chunk/GZ2UQYCA.jsx +0 -669
  18. package/dist/chunk/JH7OXUIR.jsx +0 -9903
  19. package/dist/chunk/NVDRUCO3.mjs +0 -26243
  20. package/dist/chunk/QI4NUZHP.jsx +0 -5862
  21. package/dist/chunk/RBDWDJFQ.jsx +0 -17199
  22. package/dist/chunk/UC3ZO4ZH.jsx +0 -802
  23. package/dist/chunk/VDTK67K2.jsx +0 -26395
  24. package/dist/chunk/VJFC7YOA.jsx +0 -2033
  25. package/dist/chunk/VN53D6CR.mjs +0 -2017
  26. package/dist/chunk/VQQ4CVTZ.mjs +0 -5782
  27. package/dist/chunk/ZKJS654W.mjs +0 -42
  28. package/dist/dist/25NR5LQ4.jsx +0 -31
  29. package/dist/dist/3QPHXTX5.jsx +0 -5761
  30. package/dist/dist/5PS5TLM7.mjs +0 -5693
  31. package/dist/dist/COR5WEDJ.jsx +0 -8960
  32. package/dist/dist/DHO5MJBE.mjs +0 -2155
  33. package/dist/dist/DZNWO3EY.mjs +0 -1122
  34. package/dist/dist/H257YD3M.mjs +0 -17103
  35. package/dist/dist/MZFJYXGG.mjs +0 -25
  36. package/dist/dist/NMTOQNMX.jsx +0 -17167
  37. package/dist/dist/OHC5XXJA.jsx +0 -2203
  38. package/dist/dist/XMT4I4HQ.jsx +0 -1139
  39. package/dist/dist/YFXWD6WV.mjs +0 -8864
  40. package/dist/index.es/OIZOTLR7.mjs +0 -9547
  41. package/dist/index.es/R4EQEDY3.jsx +0 -9843
  42. package/dist/index.mjs +0 -7747
  43. package/dist/lib/H7DSBKBW.mjs +0 -10583
  44. package/dist/lib/OYOWTODQ.jsx +0 -10641
  45. package/dist/main.esm/27PE3FUE.jsx +0 -114
  46. package/dist/main.esm/FGHXFDWN.mjs +0 -112
package/dist/index.cjs ADDED
@@ -0,0 +1,738 @@
1
+ 'use strict';
2
+
3
+ var solidStore = require('@tanstack/solid-store');
4
+ var algosdk = require('algosdk');
5
+ var useWallet$1 = require('@txnlab/use-wallet');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var algosdk__default = /*#__PURE__*/_interopDefault(algosdk);
10
+
11
+ // ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
12
+ var sharedConfig = {
13
+ context: void 0,
14
+ registry: void 0,
15
+ effects: void 0,
16
+ done: false,
17
+ getContextId() {
18
+ return getContextId(this.context.count);
19
+ },
20
+ getNextContextId() {
21
+ return getContextId(this.context.count++);
22
+ }
23
+ };
24
+ function getContextId(count) {
25
+ const num = String(count), len = num.length - 1;
26
+ return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
27
+ }
28
+ function setHydrateContext(context) {
29
+ sharedConfig.context = context;
30
+ }
31
+ function nextHydrateContext() {
32
+ return {
33
+ ...sharedConfig.context,
34
+ id: sharedConfig.getNextContextId(),
35
+ count: 0
36
+ };
37
+ }
38
+ var equalFn = (a, b) => a === b;
39
+ var signalOptions = {
40
+ equals: equalFn
41
+ };
42
+ var ERROR = null;
43
+ var runEffects = runQueue;
44
+ var STALE = 1;
45
+ var PENDING = 2;
46
+ var UNOWNED = {
47
+ owned: null,
48
+ cleanups: null,
49
+ context: null,
50
+ owner: null
51
+ };
52
+ var Owner = null;
53
+ var Transition = null;
54
+ var Scheduler = null;
55
+ var ExternalSourceConfig = null;
56
+ var Listener = null;
57
+ var Updates = null;
58
+ var Effects = null;
59
+ var ExecCount = 0;
60
+ function createSignal(value, options) {
61
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
62
+ const s = {
63
+ value,
64
+ observers: null,
65
+ observerSlots: null,
66
+ comparator: options.equals || void 0
67
+ };
68
+ const setter = (value2) => {
69
+ if (typeof value2 === "function") {
70
+ if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
71
+ else value2 = value2(s.value);
72
+ }
73
+ return writeSignal(s, value2);
74
+ };
75
+ return [readSignal.bind(s), setter];
76
+ }
77
+ function createRenderEffect(fn, value, options) {
78
+ const c = createComputation(fn, value, false, STALE);
79
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
80
+ else updateComputation(c);
81
+ }
82
+ function createEffect(fn, value, options) {
83
+ runEffects = runUserEffects;
84
+ const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
85
+ if (s) c.suspense = s;
86
+ c.user = true;
87
+ Effects ? Effects.push(c) : updateComputation(c);
88
+ }
89
+ function createMemo(fn, value, options) {
90
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
91
+ const c = createComputation(fn, value, true, 0);
92
+ c.observers = null;
93
+ c.observerSlots = null;
94
+ c.comparator = options.equals || void 0;
95
+ if (Scheduler && Transition && Transition.running) {
96
+ c.tState = STALE;
97
+ Updates.push(c);
98
+ } else updateComputation(c);
99
+ return readSignal.bind(c);
100
+ }
101
+ function untrack(fn) {
102
+ if (!ExternalSourceConfig && Listener === null) return fn();
103
+ const listener = Listener;
104
+ Listener = null;
105
+ try {
106
+ if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
107
+ return fn();
108
+ } finally {
109
+ Listener = listener;
110
+ }
111
+ }
112
+ function onMount(fn) {
113
+ createEffect(() => untrack(fn));
114
+ }
115
+ function onCleanup(fn) {
116
+ if (Owner === null) ;
117
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
118
+ else Owner.cleanups.push(fn);
119
+ return fn;
120
+ }
121
+ function startTransition(fn) {
122
+ if (Transition && Transition.running) {
123
+ fn();
124
+ return Transition.done;
125
+ }
126
+ const l = Listener;
127
+ const o = Owner;
128
+ return Promise.resolve().then(() => {
129
+ Listener = l;
130
+ Owner = o;
131
+ let t;
132
+ if (Scheduler || SuspenseContext) {
133
+ t = Transition || (Transition = {
134
+ sources: /* @__PURE__ */ new Set(),
135
+ effects: [],
136
+ promises: /* @__PURE__ */ new Set(),
137
+ disposed: /* @__PURE__ */ new Set(),
138
+ queue: /* @__PURE__ */ new Set(),
139
+ running: true
140
+ });
141
+ t.done || (t.done = new Promise((res) => t.resolve = res));
142
+ t.running = true;
143
+ }
144
+ runUpdates(fn);
145
+ Listener = Owner = null;
146
+ return t ? t.done : void 0;
147
+ });
148
+ }
149
+ var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
150
+ function createContext(defaultValue, options) {
151
+ const id = Symbol("context");
152
+ return {
153
+ id,
154
+ Provider: createProvider(id),
155
+ defaultValue
156
+ };
157
+ }
158
+ function useContext(context) {
159
+ let value;
160
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
161
+ }
162
+ function children(fn) {
163
+ const children2 = createMemo(fn);
164
+ const memo = createMemo(() => resolveChildren(children2()));
165
+ memo.toArray = () => {
166
+ const c = memo();
167
+ return Array.isArray(c) ? c : c != null ? [c] : [];
168
+ };
169
+ return memo;
170
+ }
171
+ var SuspenseContext;
172
+ function readSignal() {
173
+ const runningTransition = Transition && Transition.running;
174
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
175
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
176
+ else {
177
+ const updates = Updates;
178
+ Updates = null;
179
+ runUpdates(() => lookUpstream(this));
180
+ Updates = updates;
181
+ }
182
+ }
183
+ if (Listener) {
184
+ const sSlot = this.observers ? this.observers.length : 0;
185
+ if (!Listener.sources) {
186
+ Listener.sources = [this];
187
+ Listener.sourceSlots = [sSlot];
188
+ } else {
189
+ Listener.sources.push(this);
190
+ Listener.sourceSlots.push(sSlot);
191
+ }
192
+ if (!this.observers) {
193
+ this.observers = [Listener];
194
+ this.observerSlots = [Listener.sources.length - 1];
195
+ } else {
196
+ this.observers.push(Listener);
197
+ this.observerSlots.push(Listener.sources.length - 1);
198
+ }
199
+ }
200
+ if (runningTransition && Transition.sources.has(this)) return this.tValue;
201
+ return this.value;
202
+ }
203
+ function writeSignal(node, value, isComp) {
204
+ let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
205
+ if (!node.comparator || !node.comparator(current, value)) {
206
+ if (Transition) {
207
+ const TransitionRunning = Transition.running;
208
+ if (TransitionRunning || !isComp && Transition.sources.has(node)) {
209
+ Transition.sources.add(node);
210
+ node.tValue = value;
211
+ }
212
+ if (!TransitionRunning) node.value = value;
213
+ } else node.value = value;
214
+ if (node.observers && node.observers.length) {
215
+ runUpdates(() => {
216
+ for (let i = 0; i < node.observers.length; i += 1) {
217
+ const o = node.observers[i];
218
+ const TransitionRunning = Transition && Transition.running;
219
+ if (TransitionRunning && Transition.disposed.has(o)) continue;
220
+ if (TransitionRunning ? !o.tState : !o.state) {
221
+ if (o.pure) Updates.push(o);
222
+ else Effects.push(o);
223
+ if (o.observers) markDownstream(o);
224
+ }
225
+ if (!TransitionRunning) o.state = STALE;
226
+ else o.tState = STALE;
227
+ }
228
+ if (Updates.length > 1e6) {
229
+ Updates = [];
230
+ if (false) ;
231
+ throw new Error();
232
+ }
233
+ });
234
+ }
235
+ }
236
+ return value;
237
+ }
238
+ function updateComputation(node) {
239
+ if (!node.fn) return;
240
+ cleanNode(node);
241
+ const time = ExecCount;
242
+ runComputation(
243
+ node,
244
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
245
+ time
246
+ );
247
+ if (Transition && !Transition.running && Transition.sources.has(node)) {
248
+ queueMicrotask(() => {
249
+ runUpdates(() => {
250
+ Transition && (Transition.running = true);
251
+ Listener = Owner = node;
252
+ runComputation(node, node.tValue, time);
253
+ Listener = Owner = null;
254
+ });
255
+ });
256
+ }
257
+ }
258
+ function runComputation(node, value, time) {
259
+ let nextValue;
260
+ const owner = Owner, listener = Listener;
261
+ Listener = Owner = node;
262
+ try {
263
+ nextValue = node.fn(value);
264
+ } catch (err) {
265
+ if (node.pure) {
266
+ if (Transition && Transition.running) {
267
+ node.tState = STALE;
268
+ node.tOwned && node.tOwned.forEach(cleanNode);
269
+ node.tOwned = void 0;
270
+ } else {
271
+ node.state = STALE;
272
+ node.owned && node.owned.forEach(cleanNode);
273
+ node.owned = null;
274
+ }
275
+ }
276
+ node.updatedAt = time + 1;
277
+ return handleError(err);
278
+ } finally {
279
+ Listener = listener;
280
+ Owner = owner;
281
+ }
282
+ if (!node.updatedAt || node.updatedAt <= time) {
283
+ if (node.updatedAt != null && "observers" in node) {
284
+ writeSignal(node, nextValue, true);
285
+ } else if (Transition && Transition.running && node.pure) {
286
+ Transition.sources.add(node);
287
+ node.tValue = nextValue;
288
+ } else node.value = nextValue;
289
+ node.updatedAt = time;
290
+ }
291
+ }
292
+ function createComputation(fn, init, pure, state = STALE, options) {
293
+ const c = {
294
+ fn,
295
+ state,
296
+ updatedAt: null,
297
+ owned: null,
298
+ sources: null,
299
+ sourceSlots: null,
300
+ cleanups: null,
301
+ value: init,
302
+ owner: Owner,
303
+ context: Owner ? Owner.context : null,
304
+ pure
305
+ };
306
+ if (Transition && Transition.running) {
307
+ c.state = 0;
308
+ c.tState = state;
309
+ }
310
+ if (Owner === null) ;
311
+ else if (Owner !== UNOWNED) {
312
+ if (Transition && Transition.running && Owner.pure) {
313
+ if (!Owner.tOwned) Owner.tOwned = [c];
314
+ else Owner.tOwned.push(c);
315
+ } else {
316
+ if (!Owner.owned) Owner.owned = [c];
317
+ else Owner.owned.push(c);
318
+ }
319
+ }
320
+ if (ExternalSourceConfig && c.fn) {
321
+ const [track, trigger] = createSignal(void 0, {
322
+ equals: false
323
+ });
324
+ const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
325
+ onCleanup(() => ordinary.dispose());
326
+ const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
327
+ const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
328
+ c.fn = (x) => {
329
+ track();
330
+ return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
331
+ };
332
+ }
333
+ return c;
334
+ }
335
+ function runTop(node) {
336
+ const runningTransition = Transition && Transition.running;
337
+ if ((runningTransition ? node.tState : node.state) === 0) return;
338
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
339
+ if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
340
+ const ancestors = [node];
341
+ while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
342
+ if (runningTransition && Transition.disposed.has(node)) return;
343
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
344
+ }
345
+ for (let i = ancestors.length - 1; i >= 0; i--) {
346
+ node = ancestors[i];
347
+ if (runningTransition) {
348
+ let top = node, prev = ancestors[i + 1];
349
+ while ((top = top.owner) && top !== prev) {
350
+ if (Transition.disposed.has(top)) return;
351
+ }
352
+ }
353
+ if ((runningTransition ? node.tState : node.state) === STALE) {
354
+ updateComputation(node);
355
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
356
+ const updates = Updates;
357
+ Updates = null;
358
+ runUpdates(() => lookUpstream(node, ancestors[0]));
359
+ Updates = updates;
360
+ }
361
+ }
362
+ }
363
+ function runUpdates(fn, init) {
364
+ if (Updates) return fn();
365
+ let wait = false;
366
+ Updates = [];
367
+ if (Effects) wait = true;
368
+ else Effects = [];
369
+ ExecCount++;
370
+ try {
371
+ const res = fn();
372
+ completeUpdates(wait);
373
+ return res;
374
+ } catch (err) {
375
+ if (!wait) Effects = null;
376
+ Updates = null;
377
+ handleError(err);
378
+ }
379
+ }
380
+ function completeUpdates(wait) {
381
+ if (Updates) {
382
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
383
+ else runQueue(Updates);
384
+ Updates = null;
385
+ }
386
+ if (wait) return;
387
+ let res;
388
+ if (Transition) {
389
+ if (!Transition.promises.size && !Transition.queue.size) {
390
+ const sources = Transition.sources;
391
+ const disposed = Transition.disposed;
392
+ Effects.push.apply(Effects, Transition.effects);
393
+ res = Transition.resolve;
394
+ for (const e2 of Effects) {
395
+ "tState" in e2 && (e2.state = e2.tState);
396
+ delete e2.tState;
397
+ }
398
+ Transition = null;
399
+ runUpdates(() => {
400
+ for (const d of disposed) cleanNode(d);
401
+ for (const v of sources) {
402
+ v.value = v.tValue;
403
+ if (v.owned) {
404
+ for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
405
+ }
406
+ if (v.tOwned) v.owned = v.tOwned;
407
+ delete v.tValue;
408
+ delete v.tOwned;
409
+ v.tState = 0;
410
+ }
411
+ setTransPending(false);
412
+ });
413
+ } else if (Transition.running) {
414
+ Transition.running = false;
415
+ Transition.effects.push.apply(Transition.effects, Effects);
416
+ Effects = null;
417
+ setTransPending(true);
418
+ return;
419
+ }
420
+ }
421
+ const e = Effects;
422
+ Effects = null;
423
+ if (e.length) runUpdates(() => runEffects(e));
424
+ if (res) res();
425
+ }
426
+ function runQueue(queue) {
427
+ for (let i = 0; i < queue.length; i++) runTop(queue[i]);
428
+ }
429
+ function scheduleQueue(queue) {
430
+ for (let i = 0; i < queue.length; i++) {
431
+ const item = queue[i];
432
+ const tasks = Transition.queue;
433
+ if (!tasks.has(item)) {
434
+ tasks.add(item);
435
+ Scheduler(() => {
436
+ tasks.delete(item);
437
+ runUpdates(() => {
438
+ Transition.running = true;
439
+ runTop(item);
440
+ });
441
+ Transition && (Transition.running = false);
442
+ });
443
+ }
444
+ }
445
+ }
446
+ function runUserEffects(queue) {
447
+ let i, userLength = 0;
448
+ for (i = 0; i < queue.length; i++) {
449
+ const e = queue[i];
450
+ if (!e.user) runTop(e);
451
+ else queue[userLength++] = e;
452
+ }
453
+ if (sharedConfig.context) {
454
+ if (sharedConfig.count) {
455
+ sharedConfig.effects || (sharedConfig.effects = []);
456
+ sharedConfig.effects.push(...queue.slice(0, userLength));
457
+ return;
458
+ }
459
+ setHydrateContext();
460
+ }
461
+ if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
462
+ queue = [...sharedConfig.effects, ...queue];
463
+ userLength += sharedConfig.effects.length;
464
+ delete sharedConfig.effects;
465
+ }
466
+ for (i = 0; i < userLength; i++) runTop(queue[i]);
467
+ }
468
+ function lookUpstream(node, ignore) {
469
+ const runningTransition = Transition && Transition.running;
470
+ if (runningTransition) node.tState = 0;
471
+ else node.state = 0;
472
+ for (let i = 0; i < node.sources.length; i += 1) {
473
+ const source = node.sources[i];
474
+ if (source.sources) {
475
+ const state = runningTransition ? source.tState : source.state;
476
+ if (state === STALE) {
477
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
478
+ runTop(source);
479
+ } else if (state === PENDING) lookUpstream(source, ignore);
480
+ }
481
+ }
482
+ }
483
+ function markDownstream(node) {
484
+ const runningTransition = Transition && Transition.running;
485
+ for (let i = 0; i < node.observers.length; i += 1) {
486
+ const o = node.observers[i];
487
+ if (runningTransition ? !o.tState : !o.state) {
488
+ if (runningTransition) o.tState = PENDING;
489
+ else o.state = PENDING;
490
+ if (o.pure) Updates.push(o);
491
+ else Effects.push(o);
492
+ o.observers && markDownstream(o);
493
+ }
494
+ }
495
+ }
496
+ function cleanNode(node) {
497
+ let i;
498
+ if (node.sources) {
499
+ while (node.sources.length) {
500
+ const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
501
+ if (obs && obs.length) {
502
+ const n = obs.pop(), s = source.observerSlots.pop();
503
+ if (index < obs.length) {
504
+ n.sourceSlots[s] = index;
505
+ obs[index] = n;
506
+ source.observerSlots[index] = s;
507
+ }
508
+ }
509
+ }
510
+ }
511
+ if (node.tOwned) {
512
+ for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
513
+ delete node.tOwned;
514
+ }
515
+ if (Transition && Transition.running && node.pure) {
516
+ reset(node, true);
517
+ } else if (node.owned) {
518
+ for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
519
+ node.owned = null;
520
+ }
521
+ if (node.cleanups) {
522
+ for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
523
+ node.cleanups = null;
524
+ }
525
+ if (Transition && Transition.running) node.tState = 0;
526
+ else node.state = 0;
527
+ }
528
+ function reset(node, top) {
529
+ if (!top) {
530
+ node.tState = 0;
531
+ Transition.disposed.add(node);
532
+ }
533
+ if (node.owned) {
534
+ for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
535
+ }
536
+ }
537
+ function castError(err) {
538
+ if (err instanceof Error) return err;
539
+ return new Error(typeof err === "string" ? err : "Unknown error", {
540
+ cause: err
541
+ });
542
+ }
543
+ function runErrors(err, fns, owner) {
544
+ try {
545
+ for (const f of fns) f(err);
546
+ } catch (e) {
547
+ handleError(e, owner && owner.owner || null);
548
+ }
549
+ }
550
+ function handleError(err, owner = Owner) {
551
+ const fns = ERROR && owner && owner.context && owner.context[ERROR];
552
+ const error = castError(err);
553
+ if (!fns) throw error;
554
+ if (Effects)
555
+ Effects.push({
556
+ fn() {
557
+ runErrors(error, fns, owner);
558
+ },
559
+ state: STALE
560
+ });
561
+ else runErrors(error, fns, owner);
562
+ }
563
+ function resolveChildren(children2) {
564
+ if (typeof children2 === "function" && !children2.length) return resolveChildren(children2());
565
+ if (Array.isArray(children2)) {
566
+ const results = [];
567
+ for (let i = 0; i < children2.length; i++) {
568
+ const result = resolveChildren(children2[i]);
569
+ Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
570
+ }
571
+ return results;
572
+ }
573
+ return children2;
574
+ }
575
+ function createProvider(id, options) {
576
+ return function provider(props) {
577
+ let res;
578
+ createRenderEffect(
579
+ () => res = untrack(() => {
580
+ Owner.context = {
581
+ ...Owner.context,
582
+ [id]: props.value
583
+ };
584
+ return children(() => props.children);
585
+ }),
586
+ void 0
587
+ );
588
+ return res;
589
+ };
590
+ }
591
+ var hydrationEnabled = false;
592
+ function createComponent(Comp, props) {
593
+ if (hydrationEnabled) {
594
+ if (sharedConfig.context) {
595
+ const c = sharedConfig.context;
596
+ setHydrateContext(nextHydrateContext());
597
+ const r = untrack(() => Comp(props || {}));
598
+ setHydrateContext(c);
599
+ return r;
600
+ }
601
+ }
602
+ return untrack(() => Comp(props || {}));
603
+ }
604
+
605
+ // ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/web/dist/web.js
606
+ var booleans = [
607
+ "allowfullscreen",
608
+ "async",
609
+ "autofocus",
610
+ "autoplay",
611
+ "checked",
612
+ "controls",
613
+ "default",
614
+ "disabled",
615
+ "formnovalidate",
616
+ "hidden",
617
+ "indeterminate",
618
+ "inert",
619
+ "ismap",
620
+ "loop",
621
+ "multiple",
622
+ "muted",
623
+ "nomodule",
624
+ "novalidate",
625
+ "open",
626
+ "playsinline",
627
+ "readonly",
628
+ "required",
629
+ "reversed",
630
+ "seamless",
631
+ "selected"
632
+ ];
633
+ /* @__PURE__ */ new Set([
634
+ "className",
635
+ "value",
636
+ "readOnly",
637
+ "formNoValidate",
638
+ "isMap",
639
+ "noModule",
640
+ "playsInline",
641
+ ...booleans
642
+ ]);
643
+ var WalletContext = createContext();
644
+ exports.WalletProvider = (props) => {
645
+ const store = () => props.manager;
646
+ onMount(async () => {
647
+ try {
648
+ await props.manager.resumeSessions();
649
+ } catch (error) {
650
+ }
651
+ });
652
+ return createComponent(WalletContext.Provider, {
653
+ value: store,
654
+ get children() {
655
+ return props.children;
656
+ }
657
+ });
658
+ };
659
+ exports.useWalletManager = () => {
660
+ const manager = useContext(WalletContext);
661
+ if (!manager) {
662
+ throw new Error("useWalletManager must be used within a WalletProvider");
663
+ }
664
+ return manager();
665
+ };
666
+ function useWallet() {
667
+ const manager = createMemo(() => exports.useWalletManager());
668
+ const algodClient = solidStore.useStore(manager().store, (state) => state.algodClient);
669
+ const walletStore = solidStore.useStore(manager().store, (state) => state.wallets);
670
+ const walletState = (walletId) => walletStore()[walletId] || null;
671
+ const activeWalletId = solidStore.useStore(manager().store, (state) => state.activeWallet);
672
+ const activeWallet = () => manager().getWallet(activeWalletId()) || null;
673
+ const activeWalletState = () => walletState(activeWalletId());
674
+ const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
675
+ const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
676
+ const activeAccount = () => activeWalletState()?.activeAccount ?? null;
677
+ const activeAddress = () => activeAccount()?.address ?? null;
678
+ const isWalletActive = (walletId) => walletId === activeWalletId();
679
+ const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
680
+ const activeNetwork = solidStore.useStore(manager().store, (state) => state.activeNetwork);
681
+ const setActiveNetwork = async (networkId) => {
682
+ if (activeNetwork() === networkId) {
683
+ return;
684
+ }
685
+ const {
686
+ token,
687
+ baseServer,
688
+ port,
689
+ headers
690
+ } = manager().networkConfig[networkId];
691
+ const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
692
+ manager().store.setState((state) => ({
693
+ ...state,
694
+ activeNetwork: networkId,
695
+ algodClient: newClient
696
+ }));
697
+ };
698
+ const signTransactions = (txnGroup, indexesToSign) => {
699
+ const wallet = activeWallet();
700
+ if (!wallet) {
701
+ throw new Error("No active wallet");
702
+ }
703
+ return wallet.signTransactions(txnGroup, indexesToSign);
704
+ };
705
+ const transactionSigner = (txnGroup, indexesToSign) => {
706
+ const wallet = activeWallet();
707
+ if (!wallet) {
708
+ throw new Error("No active wallet");
709
+ }
710
+ return wallet.transactionSigner(txnGroup, indexesToSign);
711
+ };
712
+ return {
713
+ activeWalletId,
714
+ walletStore,
715
+ algodClient,
716
+ activeNetwork,
717
+ activeWallet,
718
+ activeWalletAccounts,
719
+ activeWalletAddresses,
720
+ activeWalletState,
721
+ activeAccount,
722
+ activeAddress,
723
+ isWalletActive,
724
+ isWalletConnected,
725
+ setActiveNetwork,
726
+ signTransactions,
727
+ transactionSigner,
728
+ wallets: manager().wallets
729
+ };
730
+ }
731
+
732
+ exports.useWallet = useWallet;
733
+ Object.keys(useWallet$1).forEach(function (k) {
734
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
735
+ enumerable: true,
736
+ get: function () { return useWallet$1[k]; }
737
+ });
738
+ });