@candypoets/nipworker 0.91.3 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index2.js CHANGED
@@ -1,8 +1,8 @@
1
- import * as h from "flatbuffers";
1
+ import * as c from "flatbuffers";
2
2
  import { ByteBuffer as St } from "flatbuffers";
3
- import { a0 as ut, N as Et, P as vt, W as dt, S as mt, a1 as Tt, a2 as nt } from "./worker-message.js";
3
+ import { a0 as ut, N as mt, P as vt, W as dt, S as Et, a1 as Tt, a2 as nt } from "./worker-message.js";
4
4
  import { nip19 as ft } from "nostr-tools";
5
- class g {
5
+ class y {
6
6
  constructor() {
7
7
  this.bb = null, this.bb_pos = 0;
8
8
  }
@@ -10,10 +10,10 @@ class g {
10
10
  return this.bb_pos = t, this.bb = s, this;
11
11
  }
12
12
  static getRootAsCacheRequest(t, s) {
13
- return (s || new g()).__init(t.readInt32(t.position()) + t.position(), t);
13
+ return (s || new y()).__init(t.readInt32(t.position()) + t.position(), t);
14
14
  }
15
15
  static getSizePrefixedRootAsCacheRequest(t, s) {
16
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new g()).__init(t.readInt32(t.position()) + t.position(), t);
16
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new y()).__init(t.readInt32(t.position()) + t.position(), t);
17
17
  }
18
18
  subId(t) {
19
19
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -29,7 +29,7 @@ class g {
29
29
  }
30
30
  event(t) {
31
31
  const s = this.bb.__offset(this.bb_pos, 8);
32
- return s ? (t || new Et()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
32
+ return s ? (t || new mt()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
33
33
  }
34
34
  parsedEvent(t) {
35
35
  const s = this.bb.__offset(this.bb_pos, 10);
@@ -101,8 +101,8 @@ class Ot {
101
101
  this.subId = t, this.requests = s, this.event = i, this.parsedEvent = n, this.relays = r;
102
102
  }
103
103
  pack(t) {
104
- const s = this.subId !== null ? t.createString(this.subId) : 0, i = g.createRequestsVector(t, t.createObjectOffsetList(this.requests)), n = this.event !== null ? this.event.pack(t) : 0, r = this.parsedEvent !== null ? this.parsedEvent.pack(t) : 0, o = g.createRelaysVector(t, t.createObjectOffsetList(this.relays));
105
- return g.startCacheRequest(t), g.addSubId(t, s), g.addRequests(t, i), g.addEvent(t, n), g.addParsedEvent(t, r), g.addRelays(t, o), g.endCacheRequest(t);
104
+ const s = this.subId !== null ? t.createString(this.subId) : 0, i = y.createRequestsVector(t, t.createObjectOffsetList(this.requests)), n = this.event !== null ? this.event.pack(t) : 0, r = this.parsedEvent !== null ? this.parsedEvent.pack(t) : 0, o = y.createRelaysVector(t, t.createObjectOffsetList(this.relays));
105
+ return y.startCacheRequest(t), y.addSubId(t, s), y.addRequests(t, i), y.addEvent(t, n), y.addParsedEvent(t, r), y.addRelays(t, o), y.endCacheRequest(t);
106
106
  }
107
107
  }
108
108
  var J = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.WorkerMessage = 1] = "WorkerMessage", e[e.CacheRequest = 2] = "CacheRequest", e))(J || {});
@@ -113,7 +113,7 @@ function rt(e, t) {
113
113
  case "WorkerMessage":
114
114
  return t(new dt());
115
115
  case "CacheRequest":
116
- return t(new g());
116
+ return t(new y());
117
117
  default:
118
118
  return null;
119
119
  }
@@ -129,7 +129,7 @@ class A {
129
129
  return (s || new A()).__init(t.readInt32(t.position()) + t.position(), t);
130
130
  }
131
131
  static getSizePrefixedRootAsCacheInputMessage(t, s) {
132
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new A()).__init(t.readInt32(t.position()) + t.position(), t);
132
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new A()).__init(t.readInt32(t.position()) + t.position(), t);
133
133
  }
134
134
  contentType() {
135
135
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -195,7 +195,7 @@ class O {
195
195
  return (s || new O()).__init(t.readInt32(t.position()) + t.position(), t);
196
196
  }
197
197
  static getSizePrefixedRootAsCacheResponse(t, s) {
198
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new O()).__init(t.readInt32(t.position()) + t.position(), t);
198
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new O()).__init(t.readInt32(t.position()) + t.position(), t);
199
199
  }
200
200
  subId(t) {
201
201
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -239,7 +239,7 @@ class O {
239
239
  return O.startCacheResponse(t), O.addSubId(t, s), O.addPayload(t, i), O.endCacheResponse(t);
240
240
  }
241
241
  unpack() {
242
- return new Nt(
242
+ return new Lt(
243
243
  this.subId(),
244
244
  this.bb.createScalarList(this.payload.bind(this), this.payloadLength())
245
245
  );
@@ -248,7 +248,7 @@ class O {
248
248
  t.subId = this.subId(), t.payload = this.bb.createScalarList(this.payload.bind(this), this.payloadLength());
249
249
  }
250
250
  }
251
- class Nt {
251
+ class Lt {
252
252
  constructor(t = null, s = []) {
253
253
  this.subId = t, this.payload = s;
254
254
  }
@@ -261,7 +261,7 @@ class Nt {
261
261
  );
262
262
  }
263
263
  }
264
- class E {
264
+ class v {
265
265
  constructor() {
266
266
  this.bb = null, this.bb_pos = 0;
267
267
  }
@@ -269,10 +269,10 @@ class E {
269
269
  return this.bb_pos = t, this.bb = s, this;
270
270
  }
271
271
  static getRootAsCounterPipeConfig(t, s) {
272
- return (s || new E()).__init(t.readInt32(t.position()) + t.position(), t);
272
+ return (s || new v()).__init(t.readInt32(t.position()) + t.position(), t);
273
273
  }
274
274
  static getSizePrefixedRootAsCounterPipeConfig(t, s) {
275
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new E()).__init(t.readInt32(t.position()) + t.position(), t);
275
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new v()).__init(t.readInt32(t.position()) + t.position(), t);
276
276
  }
277
277
  kinds(t) {
278
278
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -313,7 +313,7 @@ class E {
313
313
  return t.requiredField(s, 4), t.requiredField(s, 6), s;
314
314
  }
315
315
  static createCounterPipeConfig(t, s, i) {
316
- return E.startCounterPipeConfig(t), E.addKinds(t, s), E.addPubkey(t, i), E.endCounterPipeConfig(t);
316
+ return v.startCounterPipeConfig(t), v.addKinds(t, s), v.addPubkey(t, i), v.endCounterPipeConfig(t);
317
317
  }
318
318
  unpack() {
319
319
  return new Ft(
@@ -330,8 +330,8 @@ class Ft {
330
330
  this.kinds = t, this.pubkey = s;
331
331
  }
332
332
  pack(t) {
333
- const s = E.createKindsVector(t, this.kinds), i = this.pubkey !== null ? t.createString(this.pubkey) : 0;
334
- return E.createCounterPipeConfig(
333
+ const s = v.createKindsVector(t, this.kinds), i = this.pubkey !== null ? t.createString(this.pubkey) : 0;
334
+ return v.createCounterPipeConfig(
335
335
  t,
336
336
  s,
337
337
  i
@@ -349,7 +349,7 @@ class z {
349
349
  return (s || new z()).__init(t.readInt32(t.position()) + t.position(), t);
350
350
  }
351
351
  static getSizePrefixedRootAsGetPublicKey(t, s) {
352
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new z()).__init(t.readInt32(t.position()) + t.position(), t);
352
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new z()).__init(t.readInt32(t.position()) + t.position(), t);
353
353
  }
354
354
  static startGetPublicKey(t) {
355
355
  t.startObject(0);
@@ -384,7 +384,7 @@ class F {
384
384
  return (s || new F()).__init(t.readInt32(t.position()) + t.position(), t);
385
385
  }
386
386
  static getSizePrefixedRootAsKindFilterPipeConfig(t, s) {
387
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new F()).__init(t.readInt32(t.position()) + t.position(), t);
387
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new F()).__init(t.readInt32(t.position()) + t.position(), t);
388
388
  }
389
389
  kinds(t) {
390
390
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -421,7 +421,7 @@ class F {
421
421
  return F.startKindFilterPipeConfig(t), F.addKinds(t, s), F.endKindFilterPipeConfig(t);
422
422
  }
423
423
  unpack() {
424
- return new Lt(
424
+ return new Nt(
425
425
  this.bb.createScalarList(this.kinds.bind(this), this.kindsLength())
426
426
  );
427
427
  }
@@ -429,7 +429,7 @@ class F {
429
429
  t.kinds = this.bb.createScalarList(this.kinds.bind(this), this.kindsLength());
430
430
  }
431
431
  }
432
- class Lt {
432
+ class Nt {
433
433
  constructor(t = []) {
434
434
  this.kinds = t;
435
435
  }
@@ -441,7 +441,7 @@ class Lt {
441
441
  );
442
442
  }
443
443
  }
444
- class y {
444
+ class k {
445
445
  constructor() {
446
446
  this.bb = null, this.bb_pos = 0;
447
447
  }
@@ -449,10 +449,10 @@ class y {
449
449
  return this.bb_pos = t, this.bb = s, this;
450
450
  }
451
451
  static getRootAsTemplate(t, s) {
452
- return (s || new y()).__init(t.readInt32(t.position()) + t.position(), t);
452
+ return (s || new k()).__init(t.readInt32(t.position()) + t.position(), t);
453
453
  }
454
454
  static getSizePrefixedRootAsTemplate(t, s) {
455
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new y()).__init(t.readInt32(t.position()) + t.position(), t);
455
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new k()).__init(t.readInt32(t.position()) + t.position(), t);
456
456
  }
457
457
  kind() {
458
458
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -468,7 +468,7 @@ class y {
468
468
  }
469
469
  tags(t, s) {
470
470
  const i = this.bb.__offset(this.bb_pos, 10);
471
- return i ? (s || new mt()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + i) + t * 4), this.bb) : null;
471
+ return i ? (s || new Et()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + i) + t * 4), this.bb) : null;
472
472
  }
473
473
  tagsLength() {
474
474
  const t = this.bb.__offset(this.bb_pos, 10);
@@ -503,7 +503,7 @@ class y {
503
503
  return t.requiredField(s, 8), t.requiredField(s, 10), s;
504
504
  }
505
505
  static createTemplate(t, s, i, n, r) {
506
- return y.startTemplate(t), y.addKind(t, s), y.addCreatedAt(t, i), y.addContent(t, n), y.addTags(t, r), y.endTemplate(t);
506
+ return k.startTemplate(t), k.addKind(t, s), k.addCreatedAt(t, i), k.addContent(t, n), k.addTags(t, r), k.endTemplate(t);
507
507
  }
508
508
  unpack() {
509
509
  return new bt(
@@ -522,8 +522,8 @@ class bt {
522
522
  this.kind = t, this.createdAt = s, this.content = i, this.tags = n;
523
523
  }
524
524
  pack(t) {
525
- const s = this.content !== null ? t.createString(this.content) : 0, i = y.createTagsVector(t, t.createObjectOffsetList(this.tags));
526
- return y.createTemplate(
525
+ const s = this.content !== null ? t.createString(this.content) : 0, i = k.createTagsVector(t, t.createObjectOffsetList(this.tags));
526
+ return k.createTemplate(
527
527
  t,
528
528
  this.kind,
529
529
  this.createdAt,
@@ -532,7 +532,7 @@ class bt {
532
532
  );
533
533
  }
534
534
  }
535
- class v {
535
+ class w {
536
536
  constructor() {
537
537
  this.bb = null, this.bb_pos = 0;
538
538
  }
@@ -540,10 +540,10 @@ class v {
540
540
  return this.bb_pos = t, this.bb = s, this;
541
541
  }
542
542
  static getRootAsPublish(t, s) {
543
- return (s || new v()).__init(t.readInt32(t.position()) + t.position(), t);
543
+ return (s || new w()).__init(t.readInt32(t.position()) + t.position(), t);
544
544
  }
545
545
  static getSizePrefixedRootAsPublish(t, s) {
546
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new v()).__init(t.readInt32(t.position()) + t.position(), t);
546
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new w()).__init(t.readInt32(t.position()) + t.position(), t);
547
547
  }
548
548
  publishId(t) {
549
549
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -551,7 +551,7 @@ class v {
551
551
  }
552
552
  template(t) {
553
553
  const s = this.bb.__offset(this.bb_pos, 6);
554
- return s ? (t || new y()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
554
+ return s ? (t || new k()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
555
555
  }
556
556
  relays(t, s) {
557
557
  const i = this.bb.__offset(this.bb_pos, 8);
@@ -561,8 +561,16 @@ class v {
561
561
  const t = this.bb.__offset(this.bb_pos, 8);
562
562
  return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
563
563
  }
564
+ optimisticSubids(t, s) {
565
+ const i = this.bb.__offset(this.bb_pos, 10);
566
+ return i ? this.bb.__string(this.bb.__vector(this.bb_pos + i) + t * 4, s) : null;
567
+ }
568
+ optimisticSubidsLength() {
569
+ const t = this.bb.__offset(this.bb_pos, 10);
570
+ return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
571
+ }
564
572
  static startPublish(t) {
565
- t.startObject(3);
573
+ t.startObject(4);
566
574
  }
567
575
  static addPublishId(t, s) {
568
576
  t.addFieldOffset(0, s, 0);
@@ -582,6 +590,18 @@ class v {
582
590
  static startRelaysVector(t, s) {
583
591
  t.startVector(4, s, 4);
584
592
  }
593
+ static addOptimisticSubids(t, s) {
594
+ t.addFieldOffset(3, s, 0);
595
+ }
596
+ static createOptimisticSubidsVector(t, s) {
597
+ t.startVector(4, s.length, 4);
598
+ for (let i = s.length - 1; i >= 0; i--)
599
+ t.addOffset(s[i]);
600
+ return t.endVector();
601
+ }
602
+ static startOptimisticSubidsVector(t, s) {
603
+ t.startVector(4, s, 4);
604
+ }
585
605
  static endPublish(t) {
586
606
  const s = t.endObject();
587
607
  return t.requiredField(s, 4), t.requiredField(s, 6), t.requiredField(s, 8), s;
@@ -590,20 +610,21 @@ class v {
590
610
  return new _t(
591
611
  this.publishId(),
592
612
  this.template() !== null ? this.template().unpack() : null,
593
- this.bb.createScalarList(this.relays.bind(this), this.relaysLength())
613
+ this.bb.createScalarList(this.relays.bind(this), this.relaysLength()),
614
+ this.bb.createScalarList(this.optimisticSubids.bind(this), this.optimisticSubidsLength())
594
615
  );
595
616
  }
596
617
  unpackTo(t) {
597
- t.publishId = this.publishId(), t.template = this.template() !== null ? this.template().unpack() : null, t.relays = this.bb.createScalarList(this.relays.bind(this), this.relaysLength());
618
+ t.publishId = this.publishId(), t.template = this.template() !== null ? this.template().unpack() : null, t.relays = this.bb.createScalarList(this.relays.bind(this), this.relaysLength()), t.optimisticSubids = this.bb.createScalarList(this.optimisticSubids.bind(this), this.optimisticSubidsLength());
598
619
  }
599
620
  }
600
621
  class _t {
601
- constructor(t = null, s = null, i = []) {
602
- this.publishId = t, this.template = s, this.relays = i;
622
+ constructor(t = null, s = null, i = [], n = []) {
623
+ this.publishId = t, this.template = s, this.relays = i, this.optimisticSubids = n;
603
624
  }
604
625
  pack(t) {
605
- const s = this.publishId !== null ? t.createString(this.publishId) : 0, i = this.template !== null ? this.template.pack(t) : 0, n = v.createRelaysVector(t, t.createObjectOffsetList(this.relays));
606
- return v.startPublish(t), v.addPublishId(t, s), v.addTemplate(t, i), v.addRelays(t, n), v.endPublish(t);
626
+ const s = this.publishId !== null ? t.createString(this.publishId) : 0, i = this.template !== null ? this.template.pack(t) : 0, n = w.createRelaysVector(t, t.createObjectOffsetList(this.relays)), r = w.createOptimisticSubidsVector(t, t.createObjectOffsetList(this.optimisticSubids));
627
+ return w.startPublish(t), w.addPublishId(t, s), w.addTemplate(t, i), w.addRelays(t, n), w.addOptimisticSubids(t, r), w.endPublish(t);
607
628
  }
608
629
  }
609
630
  class x {
@@ -617,7 +638,7 @@ class x {
617
638
  return (s || new x()).__init(t.readInt32(t.position()) + t.position(), t);
618
639
  }
619
640
  static getSizePrefixedRootAsPrivateKey(t, s) {
620
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new x()).__init(t.readInt32(t.position()) + t.position(), t);
641
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new x()).__init(t.readInt32(t.position()) + t.position(), t);
621
642
  }
622
643
  privateKey(t) {
623
644
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -679,7 +700,7 @@ class R {
679
700
  return (s || new R()).__init(t.readInt32(t.position()) + t.position(), t);
680
701
  }
681
702
  static getSizePrefixedRootAsSetSigner(t, s) {
682
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new R()).__init(t.readInt32(t.position()) + t.position(), t);
703
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new R()).__init(t.readInt32(t.position()) + t.position(), t);
683
704
  }
684
705
  signerTypeType() {
685
706
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -745,11 +766,11 @@ class M {
745
766
  return (s || new M()).__init(t.readInt32(t.position()) + t.position(), t);
746
767
  }
747
768
  static getSizePrefixedRootAsSignEvent(t, s) {
748
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new M()).__init(t.readInt32(t.position()) + t.position(), t);
769
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new M()).__init(t.readInt32(t.position()) + t.position(), t);
749
770
  }
750
771
  template(t) {
751
772
  const s = this.bb.__offset(this.bb_pos, 4);
752
- return s ? (t || new y()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
773
+ return s ? (t || new k()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
753
774
  }
754
775
  static startSignEvent(t) {
755
776
  t.startObject(1);
@@ -796,7 +817,7 @@ class b {
796
817
  return (s || new b()).__init(t.readInt32(t.position()) + t.position(), t);
797
818
  }
798
819
  static getSizePrefixedRootAsMuteFilterPipeConfig(t, s) {
799
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new b()).__init(t.readInt32(t.position()) + t.position(), t);
820
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new b()).__init(t.readInt32(t.position()) + t.position(), t);
800
821
  }
801
822
  pubkeys(t, s) {
802
823
  const i = this.bb.__offset(this.bb_pos, 4);
@@ -914,7 +935,7 @@ class xt {
914
935
  );
915
936
  }
916
937
  }
917
- class S {
938
+ class m {
918
939
  constructor() {
919
940
  this.bb = null, this.bb_pos = 0;
920
941
  }
@@ -922,10 +943,10 @@ class S {
922
943
  return this.bb_pos = t, this.bb = s, this;
923
944
  }
924
945
  static getRootAsNpubLimiterPipeConfig(t, s) {
925
- return (s || new S()).__init(t.readInt32(t.position()) + t.position(), t);
946
+ return (s || new m()).__init(t.readInt32(t.position()) + t.position(), t);
926
947
  }
927
948
  static getSizePrefixedRootAsNpubLimiterPipeConfig(t, s) {
928
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new S()).__init(t.readInt32(t.position()) + t.position(), t);
949
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new m()).__init(t.readInt32(t.position()) + t.position(), t);
929
950
  }
930
951
  kind() {
931
952
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -955,7 +976,7 @@ class S {
955
976
  return t.endObject();
956
977
  }
957
978
  static createNpubLimiterPipeConfig(t, s, i, n) {
958
- return S.startNpubLimiterPipeConfig(t), S.addKind(t, s), S.addLimitPerNpub(t, i), S.addMaxTotalNpubs(t, n), S.endNpubLimiterPipeConfig(t);
979
+ return m.startNpubLimiterPipeConfig(t), m.addKind(t, s), m.addLimitPerNpub(t, i), m.addMaxTotalNpubs(t, n), m.endNpubLimiterPipeConfig(t);
959
980
  }
960
981
  unpack() {
961
982
  return new Mt(
@@ -973,7 +994,7 @@ class Mt {
973
994
  this.kind = t, this.limitPerNpub = s, this.maxTotalNpubs = i;
974
995
  }
975
996
  pack(t) {
976
- return S.createNpubLimiterPipeConfig(
997
+ return m.createNpubLimiterPipeConfig(
977
998
  t,
978
999
  this.kind,
979
1000
  this.limitPerNpub,
@@ -992,7 +1013,7 @@ class G {
992
1013
  return (s || new G()).__init(t.readInt32(t.position()) + t.position(), t);
993
1014
  }
994
1015
  static getSizePrefixedRootAsParsePipeConfig(t, s) {
995
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new G()).__init(t.readInt32(t.position()) + t.position(), t);
1016
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new G()).__init(t.readInt32(t.position()) + t.position(), t);
996
1017
  }
997
1018
  static startParsePipeConfig(t) {
998
1019
  t.startObject(0);
@@ -1027,7 +1048,7 @@ class K {
1027
1048
  return (s || new K()).__init(t.readInt32(t.position()) + t.position(), t);
1028
1049
  }
1029
1050
  static getSizePrefixedRootAsProofVerificationPipeConfig(t, s) {
1030
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new K()).__init(t.readInt32(t.position()) + t.position(), t);
1051
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new K()).__init(t.readInt32(t.position()) + t.position(), t);
1031
1052
  }
1032
1053
  maxProofs() {
1033
1054
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1065,7 +1086,7 @@ class qt {
1065
1086
  );
1066
1087
  }
1067
1088
  }
1068
- class $ {
1089
+ class W {
1069
1090
  constructor() {
1070
1091
  this.bb = null, this.bb_pos = 0;
1071
1092
  }
@@ -1073,10 +1094,10 @@ class $ {
1073
1094
  return this.bb_pos = t, this.bb = s, this;
1074
1095
  }
1075
1096
  static getRootAsSaveToDbPipeConfig(t, s) {
1076
- return (s || new $()).__init(t.readInt32(t.position()) + t.position(), t);
1097
+ return (s || new W()).__init(t.readInt32(t.position()) + t.position(), t);
1077
1098
  }
1078
1099
  static getSizePrefixedRootAsSaveToDbPipeConfig(t, s) {
1079
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new $()).__init(t.readInt32(t.position()) + t.position(), t);
1100
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new W()).__init(t.readInt32(t.position()) + t.position(), t);
1080
1101
  }
1081
1102
  static startSaveToDbPipeConfig(t) {
1082
1103
  t.startObject(0);
@@ -1085,7 +1106,7 @@ class $ {
1085
1106
  return t.endObject();
1086
1107
  }
1087
1108
  static createSaveToDbPipeConfig(t) {
1088
- return $.startSaveToDbPipeConfig(t), $.endSaveToDbPipeConfig(t);
1109
+ return W.startSaveToDbPipeConfig(t), W.endSaveToDbPipeConfig(t);
1089
1110
  }
1090
1111
  unpack() {
1091
1112
  return new jt();
@@ -1097,7 +1118,7 @@ class jt {
1097
1118
  constructor() {
1098
1119
  }
1099
1120
  pack(t) {
1100
- return $.createSaveToDbPipeConfig(t);
1121
+ return W.createSaveToDbPipeConfig(t);
1101
1122
  }
1102
1123
  }
1103
1124
  class q {
@@ -1111,7 +1132,7 @@ class q {
1111
1132
  return (s || new q()).__init(t.readInt32(t.position()) + t.position(), t);
1112
1133
  }
1113
1134
  static getSizePrefixedRootAsSerializeEventsPipeConfig(t, s) {
1114
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new q()).__init(t.readInt32(t.position()) + t.position(), t);
1135
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new q()).__init(t.readInt32(t.position()) + t.position(), t);
1115
1136
  }
1116
1137
  subscriptionId(t) {
1117
1138
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -1161,11 +1182,11 @@ function at(e, t) {
1161
1182
  case "KindFilterPipeConfig":
1162
1183
  return t(new F());
1163
1184
  case "CounterPipeConfig":
1164
- return t(new E());
1185
+ return t(new v());
1165
1186
  case "NpubLimiterPipeConfig":
1166
- return t(new S());
1187
+ return t(new m());
1167
1188
  case "SaveToDbPipeConfig":
1168
- return t(new $());
1189
+ return t(new W());
1169
1190
  case "SerializeEventsPipeConfig":
1170
1191
  return t(new q());
1171
1192
  case "ProofVerificationPipeConfig":
@@ -1176,7 +1197,7 @@ function at(e, t) {
1176
1197
  return null;
1177
1198
  }
1178
1199
  }
1179
- class N {
1200
+ class L {
1180
1201
  constructor() {
1181
1202
  this.bb = null, this.bb_pos = 0;
1182
1203
  }
@@ -1184,10 +1205,10 @@ class N {
1184
1205
  return this.bb_pos = t, this.bb = s, this;
1185
1206
  }
1186
1207
  static getRootAsPipe(t, s) {
1187
- return (s || new N()).__init(t.readInt32(t.position()) + t.position(), t);
1208
+ return (s || new L()).__init(t.readInt32(t.position()) + t.position(), t);
1188
1209
  }
1189
1210
  static getSizePrefixedRootAsPipe(t, s) {
1190
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new N()).__init(t.readInt32(t.position()) + t.position(), t);
1211
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new L()).__init(t.readInt32(t.position()) + t.position(), t);
1191
1212
  }
1192
1213
  configType() {
1193
1214
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1211,7 +1232,7 @@ class N {
1211
1232
  return t.requiredField(s, 6), s;
1212
1233
  }
1213
1234
  static createPipe(t, s, i) {
1214
- return N.startPipe(t), N.addConfigType(t, s), N.addConfig(t, i), N.endPipe(t);
1235
+ return L.startPipe(t), L.addConfigType(t, s), L.addConfig(t, i), L.endPipe(t);
1215
1236
  }
1216
1237
  unpack() {
1217
1238
  return new zt(
@@ -1235,14 +1256,14 @@ class zt {
1235
1256
  }
1236
1257
  pack(t) {
1237
1258
  const s = t.createObjectOffset(this.config);
1238
- return N.createPipe(
1259
+ return L.createPipe(
1239
1260
  t,
1240
1261
  this.configType,
1241
1262
  s
1242
1263
  );
1243
1264
  }
1244
1265
  }
1245
- class L {
1266
+ class N {
1246
1267
  constructor() {
1247
1268
  this.bb = null, this.bb_pos = 0;
1248
1269
  }
@@ -1250,14 +1271,14 @@ class L {
1250
1271
  return this.bb_pos = t, this.bb = s, this;
1251
1272
  }
1252
1273
  static getRootAsPipelineConfig(t, s) {
1253
- return (s || new L()).__init(t.readInt32(t.position()) + t.position(), t);
1274
+ return (s || new N()).__init(t.readInt32(t.position()) + t.position(), t);
1254
1275
  }
1255
1276
  static getSizePrefixedRootAsPipelineConfig(t, s) {
1256
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new L()).__init(t.readInt32(t.position()) + t.position(), t);
1277
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new N()).__init(t.readInt32(t.position()) + t.position(), t);
1257
1278
  }
1258
1279
  pipes(t, s) {
1259
1280
  const i = this.bb.__offset(this.bb_pos, 4);
1260
- return i ? (s || new N()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + i) + t * 4), this.bb) : null;
1281
+ return i ? (s || new L()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + i) + t * 4), this.bb) : null;
1261
1282
  }
1262
1283
  pipesLength() {
1263
1284
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1283,7 +1304,7 @@ class L {
1283
1304
  return t.requiredField(s, 4), s;
1284
1305
  }
1285
1306
  static createPipelineConfig(t, s) {
1286
- return L.startPipelineConfig(t), L.addPipes(t, s), L.endPipelineConfig(t);
1307
+ return N.startPipelineConfig(t), N.addPipes(t, s), N.endPipelineConfig(t);
1287
1308
  }
1288
1309
  unpack() {
1289
1310
  return new gt(
@@ -1299,14 +1320,14 @@ class gt {
1299
1320
  this.pipes = t;
1300
1321
  }
1301
1322
  pack(t) {
1302
- const s = L.createPipesVector(t, t.createObjectOffsetList(this.pipes));
1303
- return L.createPipelineConfig(
1323
+ const s = N.createPipesVector(t, t.createObjectOffsetList(this.pipes));
1324
+ return N.createPipelineConfig(
1304
1325
  t,
1305
1326
  s
1306
1327
  );
1307
1328
  }
1308
1329
  }
1309
- class f {
1330
+ class l {
1310
1331
  constructor() {
1311
1332
  this.bb = null, this.bb_pos = 0;
1312
1333
  }
@@ -1314,14 +1335,14 @@ class f {
1314
1335
  return this.bb_pos = t, this.bb = s, this;
1315
1336
  }
1316
1337
  static getRootAsSubscriptionConfig(t, s) {
1317
- return (s || new f()).__init(t.readInt32(t.position()) + t.position(), t);
1338
+ return (s || new l()).__init(t.readInt32(t.position()) + t.position(), t);
1318
1339
  }
1319
1340
  static getSizePrefixedRootAsSubscriptionConfig(t, s) {
1320
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new f()).__init(t.readInt32(t.position()) + t.position(), t);
1341
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new l()).__init(t.readInt32(t.position()) + t.position(), t);
1321
1342
  }
1322
1343
  pipeline(t) {
1323
1344
  const s = this.bb.__offset(this.bb_pos, 4);
1324
- return s ? (t || new L()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
1345
+ return s ? (t || new N()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
1325
1346
  }
1326
1347
  closeOnEose() {
1327
1348
  const t = this.bb.__offset(this.bb_pos, 6);
@@ -1395,8 +1416,8 @@ class f {
1395
1416
  static endSubscriptionConfig(t) {
1396
1417
  return t.endObject();
1397
1418
  }
1398
- static createSubscriptionConfig(t, s, i, n, r, o, a, c, u, l, k) {
1399
- return f.startSubscriptionConfig(t), f.addPipeline(t, s), f.addCloseOnEose(t, i), f.addCacheFirst(t, n), f.addTimeoutMs(t, r), f.addMaxEvents(t, o), f.addSkipCache(t, a), f.addForce(t, c), f.addBytesPerEvent(t, u), f.addIsSlow(t, l), f.addPagination(t, k), f.endSubscriptionConfig(t);
1419
+ static createSubscriptionConfig(t, s, i, n, r, o, a, h, p, f, g) {
1420
+ return l.startSubscriptionConfig(t), l.addPipeline(t, s), l.addCloseOnEose(t, i), l.addCacheFirst(t, n), l.addTimeoutMs(t, r), l.addMaxEvents(t, o), l.addSkipCache(t, a), l.addForce(t, h), l.addBytesPerEvent(t, p), l.addIsSlow(t, f), l.addPagination(t, g), l.endSubscriptionConfig(t);
1400
1421
  }
1401
1422
  unpack() {
1402
1423
  return new yt(
@@ -1417,12 +1438,12 @@ class f {
1417
1438
  }
1418
1439
  }
1419
1440
  class yt {
1420
- constructor(t = null, s = false, i = true, n = BigInt("0"), r = 0, o = false, a = false, c = 0, u = false, l = null) {
1421
- this.pipeline = t, this.closeOnEose = s, this.cacheFirst = i, this.timeoutMs = n, this.maxEvents = r, this.skipCache = o, this.force = a, this.bytesPerEvent = c, this.isSlow = u, this.pagination = l;
1441
+ constructor(t = null, s = false, i = true, n = BigInt("0"), r = 0, o = false, a = false, h = 0, p = false, f = null) {
1442
+ this.pipeline = t, this.closeOnEose = s, this.cacheFirst = i, this.timeoutMs = n, this.maxEvents = r, this.skipCache = o, this.force = a, this.bytesPerEvent = h, this.isSlow = p, this.pagination = f;
1422
1443
  }
1423
1444
  pack(t) {
1424
1445
  const s = this.pipeline !== null ? this.pipeline.pack(t) : 0, i = this.pagination !== null ? t.createString(this.pagination) : 0;
1425
- return f.createSubscriptionConfig(
1446
+ return l.createSubscriptionConfig(
1426
1447
  t,
1427
1448
  s,
1428
1449
  this.closeOnEose,
@@ -1437,7 +1458,7 @@ class yt {
1437
1458
  );
1438
1459
  }
1439
1460
  }
1440
- class m {
1461
+ class E {
1441
1462
  constructor() {
1442
1463
  this.bb = null, this.bb_pos = 0;
1443
1464
  }
@@ -1445,10 +1466,10 @@ class m {
1445
1466
  return this.bb_pos = t, this.bb = s, this;
1446
1467
  }
1447
1468
  static getRootAsSubscribe(t, s) {
1448
- return (s || new m()).__init(t.readInt32(t.position()) + t.position(), t);
1469
+ return (s || new E()).__init(t.readInt32(t.position()) + t.position(), t);
1449
1470
  }
1450
1471
  static getSizePrefixedRootAsSubscribe(t, s) {
1451
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new m()).__init(t.readInt32(t.position()) + t.position(), t);
1472
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new E()).__init(t.readInt32(t.position()) + t.position(), t);
1452
1473
  }
1453
1474
  subscriptionId(t) {
1454
1475
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -1464,7 +1485,7 @@ class m {
1464
1485
  }
1465
1486
  config(t) {
1466
1487
  const s = this.bb.__offset(this.bb_pos, 8);
1467
- return s ? (t || new f()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
1488
+ return s ? (t || new l()).__init(this.bb.__indirect(this.bb_pos + s), this.bb) : null;
1468
1489
  }
1469
1490
  static startSubscribe(t) {
1470
1491
  t.startObject(3);
@@ -1492,7 +1513,7 @@ class m {
1492
1513
  return t.requiredField(s, 4), t.requiredField(s, 6), t.requiredField(s, 8), s;
1493
1514
  }
1494
1515
  unpack() {
1495
- return new Pt(
1516
+ return new kt(
1496
1517
  this.subscriptionId(),
1497
1518
  this.bb.createObjList(this.requests.bind(this), this.requestsLength()),
1498
1519
  this.config() !== null ? this.config().unpack() : null
@@ -1502,13 +1523,13 @@ class m {
1502
1523
  t.subscriptionId = this.subscriptionId(), t.requests = this.bb.createObjList(this.requests.bind(this), this.requestsLength()), t.config = this.config() !== null ? this.config().unpack() : null;
1503
1524
  }
1504
1525
  }
1505
- class Pt {
1526
+ class kt {
1506
1527
  constructor(t = null, s = [], i = null) {
1507
1528
  this.subscriptionId = t, this.requests = s, this.config = i;
1508
1529
  }
1509
1530
  pack(t) {
1510
- const s = this.subscriptionId !== null ? t.createString(this.subscriptionId) : 0, i = m.createRequestsVector(t, t.createObjectOffsetList(this.requests)), n = this.config !== null ? this.config.pack(t) : 0;
1511
- return m.startSubscribe(t), m.addSubscriptionId(t, s), m.addRequests(t, i), m.addConfig(t, n), m.endSubscribe(t);
1531
+ const s = this.subscriptionId !== null ? t.createString(this.subscriptionId) : 0, i = E.createRequestsVector(t, t.createObjectOffsetList(this.requests)), n = this.config !== null ? this.config.pack(t) : 0;
1532
+ return E.startSubscribe(t), E.addSubscriptionId(t, s), E.addRequests(t, i), E.addConfig(t, n), E.endSubscribe(t);
1512
1533
  }
1513
1534
  }
1514
1535
  class j {
@@ -1522,7 +1543,7 @@ class j {
1522
1543
  return (s || new j()).__init(t.readInt32(t.position()) + t.position(), t);
1523
1544
  }
1524
1545
  static getSizePrefixedRootAsUnsubscribe(t, s) {
1525
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new j()).__init(t.readInt32(t.position()) + t.position(), t);
1546
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new j()).__init(t.readInt32(t.position()) + t.position(), t);
1526
1547
  }
1527
1548
  subscriptionId(t) {
1528
1549
  const s = this.bb.__offset(this.bb_pos, 4);
@@ -1542,7 +1563,7 @@ class j {
1542
1563
  return j.startUnsubscribe(t), j.addSubscriptionId(t, s), j.endUnsubscribe(t);
1543
1564
  }
1544
1565
  unpack() {
1545
- return new kt(
1566
+ return new Pt(
1546
1567
  this.subscriptionId()
1547
1568
  );
1548
1569
  }
@@ -1550,7 +1571,7 @@ class j {
1550
1571
  t.subscriptionId = this.subscriptionId();
1551
1572
  }
1552
1573
  }
1553
- class kt {
1574
+ class Pt {
1554
1575
  constructor(t = null) {
1555
1576
  this.subscriptionId = t;
1556
1577
  }
@@ -1568,11 +1589,11 @@ function ct(e, t) {
1568
1589
  case "NONE":
1569
1590
  return null;
1570
1591
  case "Subscribe":
1571
- return t(new m());
1592
+ return t(new E());
1572
1593
  case "Unsubscribe":
1573
1594
  return t(new j());
1574
1595
  case "Publish":
1575
- return t(new v());
1596
+ return t(new w());
1576
1597
  case "SignEvent":
1577
1598
  return t(new M());
1578
1599
  case "SetSigner":
@@ -1594,7 +1615,7 @@ class V {
1594
1615
  return (s || new V()).__init(t.readInt32(t.position()) + t.position(), t);
1595
1616
  }
1596
1617
  static getSizePrefixedRootAsMainMessage(t, s) {
1597
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new V()).__init(t.readInt32(t.position()) + t.position(), t);
1618
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new V()).__init(t.readInt32(t.position()) + t.position(), t);
1598
1619
  }
1599
1620
  contentType() {
1600
1621
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1661,7 +1682,7 @@ class P {
1661
1682
  return (s || new P()).__init(t.readInt32(t.position()) + t.position(), t);
1662
1683
  }
1663
1684
  static getSizePrefixedRootAsSignerRequest(t, s) {
1664
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new P()).__init(t.readInt32(t.position()) + t.position(), t);
1685
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new P()).__init(t.readInt32(t.position()) + t.position(), t);
1665
1686
  }
1666
1687
  requestId() {
1667
1688
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1715,7 +1736,7 @@ class P {
1715
1736
  return P.startSignerRequest(t), P.addRequestId(t, s), P.addOp(t, i), P.addPayload(t, n), P.addPubkey(t, r), P.addSenderPubkey(t, o), P.addRecipientPubkey(t, a), P.endSignerRequest(t);
1716
1737
  }
1717
1738
  unpack() {
1718
- return new $t(
1739
+ return new Wt(
1719
1740
  this.requestId(),
1720
1741
  this.op(),
1721
1742
  this.payload(),
@@ -1728,7 +1749,7 @@ class P {
1728
1749
  t.requestId = this.requestId(), t.op = this.op(), t.payload = this.payload(), t.pubkey = this.pubkey(), t.senderPubkey = this.senderPubkey(), t.recipientPubkey = this.recipientPubkey();
1729
1750
  }
1730
1751
  }
1731
- class $t {
1752
+ class Wt {
1732
1753
  constructor(t = BigInt("0"), s = tt.GetPubkey, i = null, n = null, r = null, o = null) {
1733
1754
  this.requestId = t, this.op = s, this.payload = i, this.pubkey = n, this.senderPubkey = r, this.recipientPubkey = o;
1734
1755
  }
@@ -1756,7 +1777,7 @@ class T {
1756
1777
  return (s || new T()).__init(t.readInt32(t.position()) + t.position(), t);
1757
1778
  }
1758
1779
  static getSizePrefixedRootAsSignerResponse(t, s) {
1759
- return t.setPosition(t.position() + h.SIZE_PREFIX_LENGTH), (s || new T()).__init(t.readInt32(t.position()) + t.position(), t);
1780
+ return t.setPosition(t.position() + c.SIZE_PREFIX_LENGTH), (s || new T()).__init(t.readInt32(t.position()) + t.position(), t);
1760
1781
  }
1761
1782
  requestId() {
1762
1783
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -1789,7 +1810,7 @@ class T {
1789
1810
  return T.startSignerResponse(t), T.addRequestId(t, s), T.addResult(t, i), T.addError(t, n), T.endSignerResponse(t);
1790
1811
  }
1791
1812
  unpack() {
1792
- return new Wt(
1813
+ return new $t(
1793
1814
  this.requestId(),
1794
1815
  this.result(),
1795
1816
  this.error()
@@ -1799,7 +1820,7 @@ class T {
1799
1820
  t.requestId = this.requestId(), t.result = this.result(), t.error = this.error();
1800
1821
  }
1801
1822
  }
1802
- class Wt {
1823
+ class $t {
1803
1824
  constructor(t = BigInt("0"), s = null, i = null) {
1804
1825
  this.requestId = t, this.result = s, this.error = i;
1805
1826
  }
@@ -1861,26 +1882,26 @@ class X {
1861
1882
  */
1862
1883
  static readMessages(t, s = 0, i) {
1863
1884
  const n = new DataView(t), r = new Uint8Array(t), o = n.getUint32(0, true), a = 4;
1864
- let c = s < a ? a : s;
1865
- if (o <= c)
1866
- return { messages: [], newReadPosition: c, hasNewData: false };
1867
- const u = 128, l = new Array(u);
1868
- let k = 0;
1885
+ let h = s < a ? a : s;
1886
+ if (o <= h)
1887
+ return { messages: [], newReadPosition: h, hasNewData: false };
1888
+ const p = 128, f = new Array(p);
1889
+ let g = 0;
1869
1890
  try {
1870
- for (; c < o && !(k >= u || c + 4 > o); ) {
1871
- const w = c, W = n.getUint32(w, true), d = w + 4, _ = d + W;
1891
+ for (; h < o && !(g >= p || h + 4 > o); ) {
1892
+ const I = h, $ = n.getUint32(I, true), d = I + 4, _ = d + $;
1872
1893
  if (_ > o) break;
1873
- const p = new St(r.subarray(d, _)), I = dt.getRootAsWorkerMessage(p);
1874
- l[k++] = I, c = _;
1894
+ const u = new St(r.subarray(d, _)), S = dt.getRootAsWorkerMessage(u);
1895
+ f[g++] = S, h = _;
1875
1896
  }
1876
- return l.length = k, {
1877
- messages: l,
1878
- newReadPosition: c,
1879
- hasNewData: k > 0
1897
+ return f.length = g, {
1898
+ messages: f,
1899
+ newReadPosition: h,
1900
+ hasNewData: g > 0
1880
1901
  };
1881
- } catch (w) {
1882
- return console.error("Failed to decode FlatBuffer data from ArrayBuffer:", w), l.length = k, {
1883
- messages: l,
1902
+ } catch (I) {
1903
+ return console.error("Failed to decode FlatBuffer data from ArrayBuffer:", I), f.length = g, {
1904
+ messages: f,
1884
1905
  newReadPosition: s < a ? a : s,
1885
1906
  hasNewData: false
1886
1907
  };
@@ -1977,16 +1998,16 @@ function as(e, t, s = 1, i) {
1977
1998
  const n = typeof s == "number" ? s : 1, r = typeof s == "number" ? i : s, o = [];
1978
1999
  if (Array.isArray(e)) {
1979
2000
  for (const a of e) {
1980
- const c = H(a);
1981
- U(c, t, r) && c[n] !== void 0 && o.push(c[n]);
2001
+ const h = H(a);
2002
+ U(h, t, r) && h[n] !== void 0 && o.push(h[n]);
1982
2003
  }
1983
2004
  return o;
1984
2005
  }
1985
2006
  for (let a = 0; a < e.tagsLength(); a++) {
1986
- const c = e.tags(a);
1987
- if (!c) continue;
1988
- const u = H(c);
1989
- U(u, t, r) && u[n] !== void 0 && o.push(u[n]);
2007
+ const h = e.tags(a);
2008
+ if (!h) continue;
2009
+ const p = H(h);
2010
+ U(p, t, r) && p[n] !== void 0 && o.push(p[n]);
1990
2011
  }
1991
2012
  return o;
1992
2013
  }
@@ -2148,12 +2169,12 @@ class ss {
2148
2169
  constructor(t = {}) {
2149
2170
  this.textEncoder = new TextEncoder(), this.subscriptions = /* @__PURE__ */ new Map(), this.publishes = /* @__PURE__ */ new Map(), this.activePubkey = null, this._pendingSession = null, this.signCB = (_) => {
2150
2171
  }, this.eventTarget = new EventTarget(), this.relayStatuses = /* @__PURE__ */ new Map(), this.PERPETUAL_SUBSCRIPTIONS = ["notifications", "starterpack"];
2151
- const s = new MessageChannel(), i = new MessageChannel(), n = new MessageChannel(), r = new MessageChannel(), o = new MessageChannel(), a = new MessageChannel(), c = new MessageChannel(), u = new MessageChannel(), l = !!t.proxy, k = l ? new URL("./connections/proxy.js", import.meta.url) : new URL("./connections/index.js", import.meta.url), w = new URL("./cache/index.js", import.meta.url), W = new URL("./parser/index.js", import.meta.url), d = new URL("./crypto/index.js", import.meta.url);
2152
- console.log("constructing crates"), this.connections = new Worker(k, { type: "module" }), this.cache = new Worker(w, { type: "module" }), this.parser = new Worker(W, { type: "module" }), this.crypto = new Worker(d, { type: "module" }), console.log("connectionMode", l ? "proxy" : "rust"), console.log(this.connections, this.cache, this.parser, this.crypto), this.connections.postMessage(
2172
+ const s = new MessageChannel(), i = new MessageChannel(), n = new MessageChannel(), r = new MessageChannel(), o = new MessageChannel(), a = new MessageChannel(), h = new MessageChannel(), p = new MessageChannel(), f = !!t.proxy, g = f ? new URL("./connections/proxy.js", import.meta.url) : new URL("./connections/index.js", import.meta.url), I = new URL("./cache/index.js", import.meta.url), $ = new URL("./parser/index.js", import.meta.url), d = new URL("./crypto/index.js", import.meta.url);
2173
+ console.log("constructing crates"), this.connections = new Worker(g, { type: "module" }), this.cache = new Worker(I, { type: "module" }), this.parser = new Worker($, { type: "module" }), this.crypto = new Worker(d, { type: "module" }), console.log("connectionMode", f ? "proxy" : "rust"), console.log(this.connections, this.cache, this.parser, this.crypto), this.connections.postMessage(
2153
2174
  {
2154
2175
  type: "init",
2155
2176
  payload: {
2156
- mainPort: u.port2,
2177
+ mainPort: p.port2,
2157
2178
  cachePort: r.port1,
2158
2179
  parserPort: i.port1,
2159
2180
  cryptoPort: o.port1,
@@ -2161,7 +2182,7 @@ class ss {
2161
2182
  }
2162
2183
  },
2163
2184
  [
2164
- u.port2,
2185
+ p.port2,
2165
2186
  r.port1,
2166
2187
  i.port1,
2167
2188
  o.port1
@@ -2175,26 +2196,26 @@ class ss {
2175
2196
  }
2176
2197
  },
2177
2198
  [s.port1, r.port2]
2178
- ), this.parserMainPort = c.port1, this.parserMainPort.onmessage = (_) => {
2179
- const { subId: p, data: I } = _.data;
2180
- if (!p || !I) {
2199
+ ), this.parserMainPort = h.port1, this.parserMainPort.onmessage = (_) => {
2200
+ const { subId: u, data: S } = _.data;
2201
+ if (!u || !S) {
2181
2202
  console.log("[main] ignoring message - missing subId or data");
2182
2203
  return;
2183
2204
  }
2184
- const B = this.subscriptions.get(p);
2205
+ const B = this.subscriptions.get(u);
2185
2206
  if (B) {
2186
- X.writeBatchedData(B.buffer, I, p) && this.dispatch(`subscription:${p}`, p);
2207
+ X.writeBatchedData(B.buffer, S, u) && this.dispatch(`subscription:${u}`, u);
2187
2208
  return;
2188
2209
  }
2189
- const it = this.publishes.get(p);
2210
+ const it = this.publishes.get(u);
2190
2211
  if (it) {
2191
- X.writeBatchedData(it.buffer, I, p) && this.dispatch(`publish:${p}`, p);
2212
+ X.writeBatchedData(it.buffer, S, u) && this.dispatch(`publish:${u}`, u);
2192
2213
  return;
2193
2214
  }
2194
- console.log("[main] no subscription or publish found for subId:", p);
2195
- }, this.connectionsMainPort = u.port1, this.connectionsMainPort.onmessage = (_) => {
2196
- const { type: p, status: I, url: B } = JSON.parse(_.data);
2197
- p === "relay:status" && B && I ? (this.relayStatuses.set(B, { status: I, timestamp: Date.now() }), this.dispatch("relay:status", { status: I, url: B })) : console.log("[main] ignoring message - type:", p, "url:", B, "status:", I);
2215
+ console.log("[main] no subscription or publish found for subId:", u);
2216
+ }, this.connectionsMainPort = p.port1, this.connectionsMainPort.onmessage = (_) => {
2217
+ const { type: u, status: S, url: B } = JSON.parse(_.data);
2218
+ u === "relay:status" && B && S ? (this.relayStatuses.set(B, { status: S, timestamp: Date.now() }), this.dispatch("relay:status", { status: S, url: B })) : console.log("[main] ignoring message - type:", u, "url:", B, "status:", S);
2198
2219
  }, this.parser.postMessage(
2199
2220
  {
2200
2221
  type: "init",
@@ -2202,10 +2223,10 @@ class ss {
2202
2223
  connectionsPort: i.port2,
2203
2224
  cachePort: s.port2,
2204
2225
  cryptoPort: n.port1,
2205
- mainPort: c.port2
2226
+ mainPort: h.port2
2206
2227
  }
2207
2228
  },
2208
- [i.port2, s.port2, n.port1, c.port2]
2229
+ [i.port2, s.port2, n.port1, h.port2]
2209
2230
  ), this.crypto.postMessage(
2210
2231
  {
2211
2232
  type: "init",
@@ -2217,9 +2238,32 @@ class ss {
2217
2238
  },
2218
2239
  [n.port2, o.port2, a.port1]
2219
2240
  ), a.port2.onmessage = (_) => {
2220
- const p = _.data;
2221
- p.type === "response" && this.handleCryptoResponse(p);
2222
- }, this.setupWorkerListener(), queueMicrotask(() => this.restoreSession());
2241
+ const u = _.data;
2242
+ u.type === "response" && this.handleCryptoResponse(u);
2243
+ }, this.setupWorkerListener(), this.setupVisibilityTracking(), queueMicrotask(() => this.restoreSession());
2244
+ }
2245
+ /**
2246
+ * Track page visibility changes to handle mobile background/foreground transitions.
2247
+ * When the app returns to foreground, wake up workers to trigger immediate reconnection.
2248
+ */
2249
+ setupVisibilityTracking() {
2250
+ if (typeof document > "u") return;
2251
+ let t = false, s = 0;
2252
+ document.addEventListener("visibilitychange", () => {
2253
+ if (document.hidden)
2254
+ t = true, s = Date.now();
2255
+ else if (t) {
2256
+ const i = Date.now() - s;
2257
+ t = false, console.log(`[main] App returned to foreground after ${i}ms`), this.wakeWorkers();
2258
+ }
2259
+ });
2260
+ }
2261
+ /**
2262
+ * Send wake signal to all workers to trigger immediate reconnection.
2263
+ * Called when returning from background to foreground.
2264
+ */
2265
+ wakeWorkers() {
2266
+ console.log("[main] Waking workers for foreground reconnection"), this.connections.postMessage({ type: "wake", source: "visibility" }), this.parser.postMessage({ type: "wake", source: "visibility" }), this.cache.postMessage({ type: "wake", source: "visibility" }), this.crypto.postMessage({ type: "wake", source: "visibility" });
2223
2267
  }
2224
2268
  postToWorker(t, s) {
2225
2269
  s && s.length ? this.parser.postMessage(t, s) : this.parser.postMessage(t);
@@ -2334,9 +2378,9 @@ class ss {
2334
2378
  const n = this.createShortId(t), r = this.subscriptions.get(n);
2335
2379
  if (r)
2336
2380
  return r.refCount++, r.buffer;
2337
- const o = s.reduce((d, _) => d + (_.limit || 100), 0), a = X.calculateBufferSize(o, i.bytesPerEvent), c = new ArrayBuffer(a);
2338
- X.initializeBuffer(c), this.subscriptions.set(n, { buffer: c, options: i, refCount: 1 });
2339
- const u = new yt(
2381
+ const o = s.reduce((d, _) => d + (_.limit || 100), 0), a = X.calculateBufferSize(o, i.bytesPerEvent), h = new ArrayBuffer(a);
2382
+ X.initializeBuffer(h), this.subscriptions.set(n, { buffer: h, options: i, refCount: 1 });
2383
+ const p = new yt(
2340
2384
  new gt(i.pipeline || []),
2341
2385
  i.closeOnEose,
2342
2386
  i.cacheFirst,
@@ -2347,7 +2391,7 @@ class ss {
2347
2391
  i.bytesPerEvent,
2348
2392
  i.isSlow,
2349
2393
  i.pagination ? this.textEncoder.encode(i.pagination) : null
2350
- ), l = new Pt(
2394
+ ), f = new kt(
2351
2395
  this.textEncoder.encode(n),
2352
2396
  s.map(
2353
2397
  (d) => new Tt(
@@ -2355,7 +2399,7 @@ class ss {
2355
2399
  d.authors,
2356
2400
  d.kinds,
2357
2401
  Object.entries(d.tags || {}).flatMap(
2358
- ([_, p]) => new nt([_, ...p])
2402
+ ([_, u]) => new nt([_, ...u])
2359
2403
  ),
2360
2404
  d.limit,
2361
2405
  d.since,
@@ -2367,11 +2411,11 @@ class ss {
2367
2411
  d.noCache
2368
2412
  )
2369
2413
  ),
2370
- u
2371
- ), k = new Z(C.Subscribe, l), w = new h.Builder(2048);
2372
- w.finish(k.pack(w));
2373
- const W = w.asUint8Array();
2374
- return this.postToWorker({ serializedMessage: W }, [W.buffer]), c;
2414
+ p
2415
+ ), g = new Z(C.Subscribe, f), I = new c.Builder(2048);
2416
+ I.finish(g.pack(I));
2417
+ const $ = I.asUint8Array();
2418
+ return this.postToWorker({ serializedMessage: $ }, [$.buffer]), h;
2375
2419
  }
2376
2420
  getBuffer(t) {
2377
2421
  const s = this.subscriptions.get(t);
@@ -2389,18 +2433,23 @@ class ss {
2389
2433
  const s = t.length < 64 ? t : this.createShortId(t), i = this.subscriptions.get(s);
2390
2434
  i && i.refCount--;
2391
2435
  }
2392
- publish(t, s, i = []) {
2393
- const n = new ArrayBuffer(3072);
2394
- X.initializeBuffer(n);
2395
- const r = new bt(
2436
+ publish(t, s, i = [], n) {
2437
+ const r = new ArrayBuffer(3072);
2438
+ X.initializeBuffer(r);
2439
+ const o = new bt(
2396
2440
  s.kind,
2397
2441
  s.created_at,
2398
2442
  this.textEncoder.encode(s.content),
2399
- s.tags.map((l) => new nt(l)) || []
2400
- ), o = new _t(this.textEncoder.encode(t), r, i), a = new Z(C.Publish, o), c = new h.Builder(2048);
2401
- c.finish(a.pack(c));
2402
- const u = c.asUint8Array();
2403
- return this.postToWorker({ serializedMessage: u }, [u.buffer]), this.publishes.set(t, { buffer: n }), n;
2443
+ s.tags.map((g) => new nt(g)) || []
2444
+ ), a = new _t(
2445
+ this.textEncoder.encode(t),
2446
+ o,
2447
+ i,
2448
+ n || []
2449
+ ), h = new Z(C.Publish, a), p = new c.Builder(2048);
2450
+ p.finish(h.pack(p));
2451
+ const f = p.asUint8Array();
2452
+ return this.postToWorker({ serializedMessage: f }, [f.buffer]), this.publishes.set(t, { buffer: r }), r;
2404
2453
  }
2405
2454
  setSigner(t, s) {
2406
2455
  var _a, _b;
@@ -2423,7 +2472,7 @@ class ss {
2423
2472
  this.signCB = s, this.crypto.postMessage({ type: "sign_event", payload: JSON.stringify(t) });
2424
2473
  }
2425
2474
  getPublicKey() {
2426
- const t = new Z(C.GetPublicKey, new lt()), s = new h.Builder(2048);
2475
+ const t = new Z(C.GetPublicKey, new lt()), s = new c.Builder(2048);
2427
2476
  s.finish(t.pack(s));
2428
2477
  const i = s.asUint8Array();
2429
2478
  this.parser.postMessage({ serializedMessage: i }, [i.buffer]);
@@ -2501,7 +2550,7 @@ class ss {
2501
2550
  for (const [s, i] of this.subscriptions.entries())
2502
2551
  i.refCount <= 0 && !this.PERPETUAL_SUBSCRIPTIONS.includes(s) && t.push(s);
2503
2552
  for (const s of t) {
2504
- const i = new kt(this.textEncoder.encode(s)), n = new Z(C.Unsubscribe, i), r = new h.Builder(256);
2553
+ const i = new Pt(this.textEncoder.encode(s)), n = new Z(C.Unsubscribe, i), r = new c.Builder(256);
2505
2554
  r.finish(n.pack(r));
2506
2555
  const o = r.asUint8Array();
2507
2556
  this.postToWorker({ serializedMessage: o }, [o.buffer]), this.connections.postMessage(s), this.subscriptions.delete(s);
@@ -2531,39 +2580,39 @@ export {
2531
2580
  A as B,
2532
2581
  J as C,
2533
2582
  Rt as D,
2534
- g as E,
2583
+ y as E,
2535
2584
  Ot as F,
2536
2585
  O as G,
2537
- Nt as H,
2538
- E as I,
2586
+ Lt as H,
2587
+ v as I,
2539
2588
  Ft as J,
2540
2589
  z as K,
2541
2590
  lt as L,
2542
2591
  F as M,
2543
2592
  ss as N,
2544
- Lt as O,
2593
+ Nt as O,
2545
2594
  C as P,
2546
2595
  V as Q,
2547
2596
  Z as R,
2548
2597
  b as S,
2549
2598
  xt as T,
2550
- S as U,
2599
+ m as U,
2551
2600
  Mt as V,
2552
2601
  G as W,
2553
2602
  Kt as X,
2554
2603
  Gt as Y,
2555
- N as Z,
2604
+ L as Z,
2556
2605
  zt as _,
2557
2606
  ys as a,
2558
- L as a0,
2607
+ N as a0,
2559
2608
  gt as a1,
2560
2609
  x as a2,
2561
2610
  Ct as a3,
2562
2611
  K as a4,
2563
2612
  qt as a5,
2564
- v as a6,
2613
+ w as a6,
2565
2614
  _t as a7,
2566
- $ as a8,
2615
+ W as a8,
2567
2616
  jt as a9,
2568
2617
  q as aa,
2569
2618
  Bt as ab,
@@ -2573,19 +2622,19 @@ export {
2573
2622
  Vt as af,
2574
2623
  tt as ag,
2575
2624
  P as ah,
2576
- $t as ai,
2625
+ Wt as ai,
2577
2626
  T as aj,
2578
- Wt as ak,
2627
+ $t as ak,
2579
2628
  Q as al,
2580
- m as am,
2581
- Pt as an,
2629
+ E as am,
2630
+ kt as an,
2582
2631
  Ht as ao,
2583
- f as ap,
2632
+ l as ap,
2584
2633
  yt as aq,
2585
- y as ar,
2634
+ k as ar,
2586
2635
  bt as as,
2587
2636
  j as at,
2588
- kt as au,
2637
+ Pt as au,
2589
2638
  os as b,
2590
2639
  _s as c,
2591
2640
  as as d,