@xyo-network/hash 7.0.12 → 7.0.13

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 (75) hide show
  1. package/LICENSE +675 -0
  2. package/README.md +47 -1
  3. package/dist/browser/BrowserObjectHasher.d.ts +9 -0
  4. package/dist/browser/BrowserObjectHasher.d.ts.map +1 -0
  5. package/dist/browser/NodeObjectHasher.d.ts +6 -0
  6. package/dist/browser/NodeObjectHasher.d.ts.map +1 -0
  7. package/dist/browser/ObjectHasher.d.ts +69 -0
  8. package/dist/browser/ObjectHasher.d.ts.map +1 -0
  9. package/dist/browser/createBrowserWorker.d.ts +3 -0
  10. package/dist/browser/createBrowserWorker.d.ts.map +1 -0
  11. package/dist/browser/createNodeWorker.d.ts +3 -0
  12. package/dist/browser/createNodeWorker.d.ts.map +1 -0
  13. package/dist/browser/hasEmptyFields.d.ts +3 -0
  14. package/dist/browser/hasEmptyFields.d.ts.map +1 -0
  15. package/dist/browser/index-browser.d.ts +4 -0
  16. package/dist/browser/index-browser.d.ts.map +1 -0
  17. package/dist/browser/index-browser.mjs +289 -0
  18. package/dist/browser/index-browser.mjs.map +7 -0
  19. package/dist/browser/index.d.ts +5 -0
  20. package/dist/browser/index.d.ts.map +1 -0
  21. package/dist/browser/removeEmptyFields.d.ts +3 -0
  22. package/dist/browser/removeEmptyFields.d.ts.map +1 -0
  23. package/dist/browser/sortFields.d.ts +3 -0
  24. package/dist/browser/sortFields.d.ts.map +1 -0
  25. package/dist/browser/worker/index.d.ts +3 -0
  26. package/dist/browser/worker/index.d.ts.map +1 -0
  27. package/dist/browser/worker/subtleHash-bundle.mjs +1 -1
  28. package/dist/browser/worker/subtleHash.d.ts +2 -0
  29. package/dist/browser/worker/subtleHash.d.ts.map +1 -0
  30. package/dist/browser/worker/subtleHashNode.d.ts +2 -0
  31. package/dist/browser/worker/subtleHashNode.d.ts.map +1 -0
  32. package/dist/browser/worker/wasmHash-bundle.mjs +3402 -184
  33. package/dist/browser/worker/wasmHash.d.ts +2 -0
  34. package/dist/browser/worker/wasmHash.d.ts.map +1 -0
  35. package/dist/browser/worker/wasmHashNode.d.ts +2 -0
  36. package/dist/browser/worker/wasmHashNode.d.ts.map +1 -0
  37. package/dist/node/BrowserObjectHasher.d.ts +9 -0
  38. package/dist/node/BrowserObjectHasher.d.ts.map +1 -0
  39. package/dist/node/NodeObjectHasher.d.ts +6 -0
  40. package/dist/node/NodeObjectHasher.d.ts.map +1 -0
  41. package/dist/node/ObjectHasher.d.ts +69 -0
  42. package/dist/node/ObjectHasher.d.ts.map +1 -0
  43. package/dist/node/createBrowserWorker.d.ts +3 -0
  44. package/dist/node/createBrowserWorker.d.ts.map +1 -0
  45. package/dist/node/createNodeWorker.d.ts +3 -0
  46. package/dist/node/createNodeWorker.d.ts.map +1 -0
  47. package/dist/node/hasEmptyFields.d.ts +3 -0
  48. package/dist/node/hasEmptyFields.d.ts.map +1 -0
  49. package/dist/node/index-browser.d.ts +4 -0
  50. package/dist/node/index-browser.d.ts.map +1 -0
  51. package/dist/node/index.d.ts +5 -0
  52. package/dist/node/index.d.ts.map +1 -0
  53. package/dist/node/index.mjs +279 -0
  54. package/dist/node/index.mjs.map +7 -0
  55. package/dist/node/removeEmptyFields.d.ts +3 -0
  56. package/dist/node/removeEmptyFields.d.ts.map +1 -0
  57. package/dist/node/sortFields.d.ts +3 -0
  58. package/dist/node/sortFields.d.ts.map +1 -0
  59. package/dist/node/worker/index.d.ts +3 -0
  60. package/dist/node/worker/index.d.ts.map +1 -0
  61. package/dist/node/worker/subtleHash-bundle.mjs +361 -0
  62. package/dist/node/worker/subtleHash.d.ts +2 -0
  63. package/dist/node/worker/subtleHash.d.ts.map +1 -0
  64. package/dist/node/worker/subtleHashNode.d.ts +2 -0
  65. package/dist/node/worker/subtleHashNode.d.ts.map +1 -0
  66. package/dist/node/worker/wasmHash-bundle.mjs +4080 -0
  67. package/dist/node/worker/wasmHash.d.ts +2 -0
  68. package/dist/node/worker/wasmHash.d.ts.map +1 -0
  69. package/dist/node/worker/wasmHashNode.d.ts +2 -0
  70. package/dist/node/worker/wasmHashNode.d.ts.map +1 -0
  71. package/package.json +51 -32
  72. package/dist/neutral/index.d.ts +0 -6
  73. package/dist/neutral/index.d.ts.map +0 -1
  74. package/dist/neutral/index.mjs +0 -3
  75. package/dist/neutral/index.mjs.map +0 -7
@@ -1,16 +1,5 @@
1
1
  "use strict";
2
2
  (() => {
3
- // ../../../../../../node_modules/.pnpm/@ariestools+sdk@7.0.4_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.8.0_@ope_97da9f513cbe94e19a96d20f67b150bc/node_modules/@ariestools/sdk/dist/_pkg/typeof/neutral/index.mjs
4
- function isUndefined(value) {
5
- return value === void 0;
6
- }
7
- function isString(value) {
8
- return typeof value === "string";
9
- }
10
- function isNumber(value) {
11
- return typeof value === "number";
12
- }
13
-
14
3
  // ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
15
4
  var _a;
16
5
  // @__NO_SIDE_EFFECTS__
@@ -120,6 +109,25 @@
120
109
  }
121
110
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
122
111
  };
112
+ function isObject(data) {
113
+ return typeof data === "object" && data !== null && !Array.isArray(data);
114
+ }
115
+ function isPlainObject(o) {
116
+ if (isObject(o) === false)
117
+ return false;
118
+ const ctor = o.constructor;
119
+ if (ctor === void 0)
120
+ return true;
121
+ if (typeof ctor !== "function")
122
+ return true;
123
+ const prot = ctor.prototype;
124
+ if (isObject(prot) === false)
125
+ return false;
126
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
127
+ return false;
128
+ }
129
+ return true;
130
+ }
123
131
  function clone(inst, def, params) {
124
132
  const cl = new inst._zod.constr(def ?? inst._zod.def);
125
133
  if (!def || params?.parent)
@@ -169,6 +177,14 @@
169
177
  }
170
178
  return false;
171
179
  }
180
+ function prefixIssues(path, issues) {
181
+ return issues.map((iss) => {
182
+ var _a3;
183
+ (_a3 = iss).path ?? (_a3.path = []);
184
+ iss.path.unshift(path);
185
+ return iss;
186
+ });
187
+ }
172
188
  function unwrapMessage(message) {
173
189
  return typeof message === "string" ? message : message?.message;
174
190
  }
@@ -276,6 +292,8 @@
276
292
  };
277
293
  var bigint = /^-?\d+n?$/;
278
294
  var number = /^-?\d+(?:\.\d+)?$/;
295
+ var boolean = /^(?:true|false)$/i;
296
+ var _null = /^null$/i;
279
297
 
280
298
  // ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
281
299
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
@@ -528,6 +546,27 @@
528
546
  return payload;
529
547
  };
530
548
  });
549
+ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
550
+ $ZodType.init(inst, def);
551
+ inst._zod.pattern = boolean;
552
+ inst._zod.parse = (payload, _ctx) => {
553
+ if (def.coerce)
554
+ try {
555
+ payload.value = Boolean(payload.value);
556
+ } catch (_) {
557
+ }
558
+ const input = payload.value;
559
+ if (typeof input === "boolean")
560
+ return payload;
561
+ payload.issues.push({
562
+ expected: "boolean",
563
+ code: "invalid_type",
564
+ input,
565
+ inst
566
+ });
567
+ return payload;
568
+ };
569
+ });
531
570
  var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
532
571
  $ZodType.init(inst, def);
533
572
  inst._zod.pattern = bigint;
@@ -548,6 +587,62 @@
548
587
  return payload;
549
588
  };
550
589
  });
590
+ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
591
+ $ZodType.init(inst, def);
592
+ inst._zod.pattern = _null;
593
+ inst._zod.values = /* @__PURE__ */ new Set([null]);
594
+ inst._zod.parse = (payload, _ctx) => {
595
+ const input = payload.value;
596
+ if (input === null)
597
+ return payload;
598
+ payload.issues.push({
599
+ expected: "null",
600
+ code: "invalid_type",
601
+ input,
602
+ inst
603
+ });
604
+ return payload;
605
+ };
606
+ });
607
+ function handleArrayResult(result, final, index) {
608
+ if (result.issues.length) {
609
+ final.issues.push(...prefixIssues(index, result.issues));
610
+ }
611
+ final.value[index] = result.value;
612
+ }
613
+ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
614
+ $ZodType.init(inst, def);
615
+ inst._zod.parse = (payload, ctx) => {
616
+ const input = payload.value;
617
+ if (!Array.isArray(input)) {
618
+ payload.issues.push({
619
+ expected: "array",
620
+ code: "invalid_type",
621
+ input,
622
+ inst
623
+ });
624
+ return payload;
625
+ }
626
+ payload.value = Array(input.length);
627
+ const proms = [];
628
+ for (let i = 0; i < input.length; i++) {
629
+ const item = input[i];
630
+ const result = def.element._zod.run({
631
+ value: item,
632
+ issues: []
633
+ }, ctx);
634
+ if (result instanceof Promise) {
635
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
636
+ } else {
637
+ handleArrayResult(result, payload, i);
638
+ }
639
+ }
640
+ if (proms.length) {
641
+ return Promise.all(proms).then(() => payload);
642
+ }
643
+ return payload;
644
+ };
645
+ });
551
646
  function handleUnionResults(results, final, inst, ctx) {
552
647
  for (const result of results) {
553
648
  if (result.issues.length === 0) {
@@ -613,6 +708,132 @@
613
708
  });
614
709
  };
615
710
  });
711
+ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
712
+ $ZodType.init(inst, def);
713
+ inst._zod.parse = (payload, ctx) => {
714
+ const input = payload.value;
715
+ if (!isPlainObject(input)) {
716
+ payload.issues.push({
717
+ expected: "record",
718
+ code: "invalid_type",
719
+ input,
720
+ inst
721
+ });
722
+ return payload;
723
+ }
724
+ const proms = [];
725
+ const values = def.keyType._zod.values;
726
+ if (values) {
727
+ payload.value = {};
728
+ const recordKeys = /* @__PURE__ */ new Set();
729
+ for (const key of values) {
730
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
731
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
732
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
733
+ if (keyResult instanceof Promise) {
734
+ throw new Error("Async schemas not supported in object keys currently");
735
+ }
736
+ if (keyResult.issues.length) {
737
+ payload.issues.push({
738
+ code: "invalid_key",
739
+ origin: "record",
740
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
741
+ input: key,
742
+ path: [key],
743
+ inst
744
+ });
745
+ continue;
746
+ }
747
+ const outKey = keyResult.value;
748
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
749
+ if (result instanceof Promise) {
750
+ proms.push(result.then((result2) => {
751
+ if (result2.issues.length) {
752
+ payload.issues.push(...prefixIssues(key, result2.issues));
753
+ }
754
+ payload.value[outKey] = result2.value;
755
+ }));
756
+ } else {
757
+ if (result.issues.length) {
758
+ payload.issues.push(...prefixIssues(key, result.issues));
759
+ }
760
+ payload.value[outKey] = result.value;
761
+ }
762
+ }
763
+ }
764
+ let unrecognized;
765
+ for (const key in input) {
766
+ if (!recordKeys.has(key)) {
767
+ unrecognized = unrecognized ?? [];
768
+ unrecognized.push(key);
769
+ }
770
+ }
771
+ if (unrecognized && unrecognized.length > 0) {
772
+ payload.issues.push({
773
+ code: "unrecognized_keys",
774
+ input,
775
+ inst,
776
+ keys: unrecognized
777
+ });
778
+ }
779
+ } else {
780
+ payload.value = {};
781
+ for (const key of Reflect.ownKeys(input)) {
782
+ if (key === "__proto__")
783
+ continue;
784
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
785
+ continue;
786
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
787
+ if (keyResult instanceof Promise) {
788
+ throw new Error("Async schemas not supported in object keys currently");
789
+ }
790
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
791
+ if (checkNumericKey) {
792
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
793
+ if (retryResult instanceof Promise) {
794
+ throw new Error("Async schemas not supported in object keys currently");
795
+ }
796
+ if (retryResult.issues.length === 0) {
797
+ keyResult = retryResult;
798
+ }
799
+ }
800
+ if (keyResult.issues.length) {
801
+ if (def.mode === "loose") {
802
+ payload.value[key] = input[key];
803
+ } else {
804
+ payload.issues.push({
805
+ code: "invalid_key",
806
+ origin: "record",
807
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
808
+ input: key,
809
+ path: [key],
810
+ inst
811
+ });
812
+ }
813
+ continue;
814
+ }
815
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
816
+ if (result instanceof Promise) {
817
+ proms.push(result.then((result2) => {
818
+ if (result2.issues.length) {
819
+ payload.issues.push(...prefixIssues(key, result2.issues));
820
+ }
821
+ payload.value[keyResult.value] = result2.value;
822
+ }));
823
+ } else {
824
+ if (result.issues.length) {
825
+ payload.issues.push(...prefixIssues(key, result.issues));
826
+ }
827
+ payload.value[keyResult.value] = result.value;
828
+ }
829
+ }
830
+ }
831
+ if (proms.length) {
832
+ return Promise.all(proms).then(() => payload);
833
+ }
834
+ return payload;
835
+ };
836
+ });
616
837
  var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
617
838
  $ZodType.init(inst, def);
618
839
  inst._zod.optin = "optional";
@@ -665,6 +886,23 @@
665
886
  }
666
887
  return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
667
888
  }
889
+ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
890
+ $ZodType.init(inst, def);
891
+ defineLazy(inst._zod, "innerType", () => {
892
+ const d = def;
893
+ if (!d._cachedInner)
894
+ d._cachedInner = def.getter();
895
+ return d._cachedInner;
896
+ });
897
+ defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
898
+ defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
899
+ defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
900
+ defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
901
+ inst._zod.parse = (payload, ctx) => {
902
+ const inner = inst._zod.innerType;
903
+ return inner._zod.run(payload, ctx);
904
+ };
905
+ });
668
906
  var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
669
907
  $ZodCheck.init(inst, def);
670
908
  $ZodType.init(inst, def);
@@ -716,6 +954,13 @@
716
954
  });
717
955
  }
718
956
  // @__NO_SIDE_EFFECTS__
957
+ function _boolean(Class, params) {
958
+ return new Class({
959
+ type: "boolean",
960
+ ...normalizeParams(params)
961
+ });
962
+ }
963
+ // @__NO_SIDE_EFFECTS__
719
964
  function _bigint(Class, params) {
720
965
  return new Class({
721
966
  type: "bigint",
@@ -723,6 +968,13 @@
723
968
  });
724
969
  }
725
970
  // @__NO_SIDE_EFFECTS__
971
+ function _null2(Class, params) {
972
+ return new Class({
973
+ type: "null",
974
+ ...normalizeParams(params)
975
+ });
976
+ }
977
+ // @__NO_SIDE_EFFECTS__
726
978
  function _gte(value, params) {
727
979
  return new $ZodCheckGreaterThan({
728
980
  check: "greater_than",
@@ -802,6 +1054,14 @@
802
1054
  function number2(params) {
803
1055
  return _number(ZodMiniNumber, params);
804
1056
  }
1057
+ var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
1058
+ $ZodBoolean.init(inst, def);
1059
+ ZodMiniType.init(inst, def);
1060
+ });
1061
+ // @__NO_SIDE_EFFECTS__
1062
+ function boolean2(params) {
1063
+ return _boolean(ZodMiniBoolean, params);
1064
+ }
805
1065
  var ZodMiniBigInt = /* @__PURE__ */ $constructor("ZodMiniBigInt", (inst, def) => {
806
1066
  $ZodBigInt.init(inst, def);
807
1067
  ZodMiniType.init(inst, def);
@@ -810,6 +1070,26 @@
810
1070
  function bigint2(params) {
811
1071
  return _bigint(ZodMiniBigInt, params);
812
1072
  }
1073
+ var ZodMiniNull = /* @__PURE__ */ $constructor("ZodMiniNull", (inst, def) => {
1074
+ $ZodNull.init(inst, def);
1075
+ ZodMiniType.init(inst, def);
1076
+ });
1077
+ // @__NO_SIDE_EFFECTS__
1078
+ function _null3(params) {
1079
+ return _null2(ZodMiniNull, params);
1080
+ }
1081
+ var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
1082
+ $ZodArray.init(inst, def);
1083
+ ZodMiniType.init(inst, def);
1084
+ });
1085
+ // @__NO_SIDE_EFFECTS__
1086
+ function array(element, params) {
1087
+ return new ZodMiniArray({
1088
+ type: "array",
1089
+ element,
1090
+ ...normalizeParams(params)
1091
+ });
1092
+ }
813
1093
  var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
814
1094
  $ZodUnion.init(inst, def);
815
1095
  ZodMiniType.init(inst, def);
@@ -822,6 +1102,27 @@
822
1102
  ...normalizeParams(params)
823
1103
  });
824
1104
  }
1105
+ var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
1106
+ $ZodRecord.init(inst, def);
1107
+ ZodMiniType.init(inst, def);
1108
+ });
1109
+ // @__NO_SIDE_EFFECTS__
1110
+ function record(keyType, valueType, params) {
1111
+ if (!valueType || !valueType._zod) {
1112
+ return new ZodMiniRecord({
1113
+ type: "record",
1114
+ keyType: /* @__PURE__ */ string2(),
1115
+ valueType: keyType,
1116
+ ...normalizeParams(valueType)
1117
+ });
1118
+ }
1119
+ return new ZodMiniRecord({
1120
+ type: "record",
1121
+ keyType,
1122
+ valueType,
1123
+ ...normalizeParams(params)
1124
+ });
1125
+ }
825
1126
  var ZodMiniTransform = /* @__PURE__ */ $constructor("ZodMiniTransform", (inst, def) => {
826
1127
  $ZodTransform.init(inst, def);
827
1128
  ZodMiniType.init(inst, def);
@@ -845,6 +1146,17 @@
845
1146
  out
846
1147
  });
847
1148
  }
1149
+ var ZodMiniLazy = /* @__PURE__ */ $constructor("ZodMiniLazy", (inst, def) => {
1150
+ $ZodLazy.init(inst, def);
1151
+ ZodMiniType.init(inst, def);
1152
+ });
1153
+ // @__NO_SIDE_EFFECTS__
1154
+ function _lazy(getter) {
1155
+ return new ZodMiniLazy({
1156
+ type: "lazy",
1157
+ getter
1158
+ });
1159
+ }
848
1160
  var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
849
1161
  $ZodCustom.init(inst, def);
850
1162
  ZodMiniType.init(inst, def);
@@ -854,177 +1166,3083 @@
854
1166
  return _refine(ZodMiniCustom, fn, _params);
855
1167
  }
856
1168
 
857
- // ../../../../../../node_modules/.pnpm/@ariestools+sdk@7.0.4_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.8.0_@ope_97da9f513cbe94e19a96d20f67b150bc/node_modules/@ariestools/sdk/dist/_pkg/error/neutral/index.mjs
858
- var assertError = (value, assert, defaultMessage) => {
859
- if (!isUndefined(assert)) {
860
- const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
861
- if (isString(assertString) || assertString) {
862
- throw new Error(assertString === true ? defaultMessage : assertString);
863
- }
864
- }
865
- return void 0;
866
- };
867
-
868
- // ../../../../../../node_modules/.pnpm/@ariestools+sdk@7.0.4_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.8.0_@ope_97da9f513cbe94e19a96d20f67b150bc/node_modules/@ariestools/sdk/dist/_pkg/hex/neutral/index.mjs
869
- var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
870
- return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
871
- };
872
- var HexRegExMinMaxMixedCaseWithPrefix = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
873
- return new RegExp(`^0x[a-fA-F0-9]{${minBytes * 2},${maxBytes * 2}}$`);
874
- };
875
- var HexRegEx = /^[0-9a-f]+$/;
876
- var HexRegExWithPrefix = /^0x[0-9a-f]+$/;
877
- var ADDRESS_LENGTH = 40;
878
- var AddressRegEx = HexRegExMinMax(ADDRESS_LENGTH / 2, ADDRESS_LENGTH / 2);
879
- var AddressZod = pipe(
880
- string2().check(_regex(AddressRegEx)),
881
- transform((v) => v)
882
- );
883
- var bitsToNibbles = (value) => {
884
- const nibbles = value >> 2;
885
- if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4");
886
- return nibbles;
887
- };
888
- var isHex = (value, config2) => {
889
- if (typeof value !== "string") return false;
890
- const valueCharLength = value.length - (config2?.prefix === true ? 2 : 0);
891
- if (config2?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config2?.bitLength)) return false;
892
- const regex5 = config2?.prefix === true ? HexRegExWithPrefix : HexRegEx;
893
- return regex5.test(value);
894
- };
895
- var hexFromHexString = (value, config2 = {}) => {
896
- const {
897
- prefix: isPrefix = false,
898
- byteSize = 8,
899
- bitLength
900
- } = config2;
901
- const nibbleBoundary = bitsToNibbles(byteSize);
902
- const unEvened = (value.startsWith("0x") ? value.slice(2) : value).toLowerCase();
903
- if (isHex(unEvened)) {
904
- const evenCharacters = unEvened.padStart(Math.ceil(unEvened.length / nibbleBoundary) * nibbleBoundary, "0");
905
- const padded = isNumber(bitLength) ? evenCharacters.padStart(bitLength / 4, "0") : evenCharacters;
906
- return (isPrefix ? `0x${padded}` : padded).toLowerCase();
1169
+ // ../../../../../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs
1170
+ var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
1171
+ var E_ALREADY_LOCKED = new Error("mutex already locked");
1172
+ var E_CANCELED = new Error("request for lock canceled");
1173
+ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
1174
+ function adopt(value) {
1175
+ return value instanceof P ? value : new P(function(resolve) {
1176
+ resolve(value);
1177
+ });
907
1178
  }
908
- throw new Error("Received string is not a value hex");
909
- };
910
- var hexFromArrayBuffer = (buffer, config2) => {
911
- const unPadded = [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, "0")).join("");
912
- return hexFromHexString(unPadded, config2);
913
- };
914
- var hexFromBigInt = (value, config2 = {}) => {
915
- const unPadded = value.toString(16);
916
- return hexFromHexString(unPadded, config2);
917
- };
918
- var hexFromNumber = (value, config2) => {
919
- return hexFromBigInt(BigInt(value), config2);
920
- };
921
- var hexFrom = (value, config2) => {
922
- switch (typeof value) {
923
- case "string": {
924
- return hexFromHexString(value, config2);
1179
+ return new (P || (P = Promise))(function(resolve, reject) {
1180
+ function fulfilled(value) {
1181
+ try {
1182
+ step(generator.next(value));
1183
+ } catch (e) {
1184
+ reject(e);
1185
+ }
925
1186
  }
926
- case "bigint": {
927
- return hexFromBigInt(value, config2);
1187
+ function rejected(value) {
1188
+ try {
1189
+ step(generator["throw"](value));
1190
+ } catch (e) {
1191
+ reject(e);
1192
+ }
928
1193
  }
929
- case "number": {
930
- return hexFromNumber(value, config2);
1194
+ function step(result) {
1195
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
931
1196
  }
932
- case "object": {
933
- return hexFromArrayBuffer(value, config2);
1197
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1198
+ });
1199
+ };
1200
+ var Semaphore = class {
1201
+ constructor(_value, _cancelError = E_CANCELED) {
1202
+ this._value = _value;
1203
+ this._cancelError = _cancelError;
1204
+ this._queue = [];
1205
+ this._weightedWaiters = [];
1206
+ }
1207
+ acquire(weight = 1, priority = 0) {
1208
+ if (weight <= 0)
1209
+ throw new Error(`invalid weight ${weight}: must be positive`);
1210
+ return new Promise((resolve, reject) => {
1211
+ const task = { resolve, reject, weight, priority };
1212
+ const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
1213
+ if (i === -1 && weight <= this._value) {
1214
+ this._dispatchItem(task);
1215
+ } else {
1216
+ this._queue.splice(i + 1, 0, task);
1217
+ }
1218
+ });
1219
+ }
1220
+ runExclusive(callback_1) {
1221
+ return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
1222
+ const [value, release] = yield this.acquire(weight, priority);
1223
+ try {
1224
+ return yield callback(value);
1225
+ } finally {
1226
+ release();
1227
+ }
1228
+ });
1229
+ }
1230
+ waitForUnlock(weight = 1, priority = 0) {
1231
+ if (weight <= 0)
1232
+ throw new Error(`invalid weight ${weight}: must be positive`);
1233
+ if (this._couldLockImmediately(weight, priority)) {
1234
+ return Promise.resolve();
1235
+ } else {
1236
+ return new Promise((resolve) => {
1237
+ if (!this._weightedWaiters[weight - 1])
1238
+ this._weightedWaiters[weight - 1] = [];
1239
+ insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
1240
+ });
934
1241
  }
935
- default: {
936
- throw new Error(`Invalid type: ${typeof value}`);
1242
+ }
1243
+ isLocked() {
1244
+ return this._value <= 0;
1245
+ }
1246
+ getValue() {
1247
+ return this._value;
1248
+ }
1249
+ setValue(value) {
1250
+ this._value = value;
1251
+ this._dispatchQueue();
1252
+ }
1253
+ release(weight = 1) {
1254
+ if (weight <= 0)
1255
+ throw new Error(`invalid weight ${weight}: must be positive`);
1256
+ this._value += weight;
1257
+ this._dispatchQueue();
1258
+ }
1259
+ cancel() {
1260
+ this._queue.forEach((entry) => entry.reject(this._cancelError));
1261
+ this._queue = [];
1262
+ }
1263
+ _dispatchQueue() {
1264
+ this._drainUnlockWaiters();
1265
+ while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
1266
+ this._dispatchItem(this._queue.shift());
1267
+ this._drainUnlockWaiters();
937
1268
  }
938
1269
  }
939
- };
940
- var HexZod = pipe(
941
- string2().check(_regex(HexRegEx, { error: "Invalid hex format" })),
942
- transform((val) => val)
1270
+ _dispatchItem(item) {
1271
+ const previousValue = this._value;
1272
+ this._value -= item.weight;
1273
+ item.resolve([previousValue, this._newReleaser(item.weight)]);
1274
+ }
1275
+ _newReleaser(weight) {
1276
+ let called = false;
1277
+ return () => {
1278
+ if (called)
1279
+ return;
1280
+ called = true;
1281
+ this.release(weight);
1282
+ };
1283
+ }
1284
+ _drainUnlockWaiters() {
1285
+ if (this._queue.length === 0) {
1286
+ for (let weight = this._value; weight > 0; weight--) {
1287
+ const waiters = this._weightedWaiters[weight - 1];
1288
+ if (!waiters)
1289
+ continue;
1290
+ waiters.forEach((waiter) => waiter.resolve());
1291
+ this._weightedWaiters[weight - 1] = [];
1292
+ }
1293
+ } else {
1294
+ const queuedPriority = this._queue[0].priority;
1295
+ for (let weight = this._value; weight > 0; weight--) {
1296
+ const waiters = this._weightedWaiters[weight - 1];
1297
+ if (!waiters)
1298
+ continue;
1299
+ const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
1300
+ (i === -1 ? waiters : waiters.splice(0, i)).forEach(((waiter) => waiter.resolve()));
1301
+ }
1302
+ }
1303
+ }
1304
+ _couldLockImmediately(weight, priority) {
1305
+ return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
1306
+ }
1307
+ };
1308
+ function insertSorted(a, v) {
1309
+ const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
1310
+ a.splice(i + 1, 0, v);
1311
+ }
1312
+ function findIndexFromEnd(a, predicate) {
1313
+ for (let i = a.length - 1; i >= 0; i--) {
1314
+ if (predicate(a[i])) {
1315
+ return i;
1316
+ }
1317
+ }
1318
+ return -1;
1319
+ }
1320
+ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
1321
+ function adopt(value) {
1322
+ return value instanceof P ? value : new P(function(resolve) {
1323
+ resolve(value);
1324
+ });
1325
+ }
1326
+ return new (P || (P = Promise))(function(resolve, reject) {
1327
+ function fulfilled(value) {
1328
+ try {
1329
+ step(generator.next(value));
1330
+ } catch (e) {
1331
+ reject(e);
1332
+ }
1333
+ }
1334
+ function rejected(value) {
1335
+ try {
1336
+ step(generator["throw"](value));
1337
+ } catch (e) {
1338
+ reject(e);
1339
+ }
1340
+ }
1341
+ function step(result) {
1342
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1343
+ }
1344
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1345
+ });
1346
+ };
1347
+ var Mutex = class {
1348
+ constructor(cancelError) {
1349
+ this._semaphore = new Semaphore(1, cancelError);
1350
+ }
1351
+ acquire() {
1352
+ return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
1353
+ const [, releaser] = yield this._semaphore.acquire(1, priority);
1354
+ return releaser;
1355
+ });
1356
+ }
1357
+ runExclusive(callback, priority = 0) {
1358
+ return this._semaphore.runExclusive(() => callback(), 1, priority);
1359
+ }
1360
+ isLocked() {
1361
+ return this._semaphore.isLocked();
1362
+ }
1363
+ waitForUnlock(priority = 0) {
1364
+ return this._semaphore.waitForUnlock(1, priority);
1365
+ }
1366
+ release() {
1367
+ if (this._semaphore.isLocked())
1368
+ this._semaphore.release();
1369
+ }
1370
+ cancel() {
1371
+ return this._semaphore.cancel();
1372
+ }
1373
+ };
1374
+
1375
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js
1376
+ var VERSION = "1.9.1";
1377
+
1378
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
1379
+ var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
1380
+ function _makeCompatibilityCheck(ownVersion) {
1381
+ const acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
1382
+ const rejectedVersions = /* @__PURE__ */ new Set();
1383
+ const myVersionMatch = ownVersion.match(re);
1384
+ if (!myVersionMatch) {
1385
+ return () => false;
1386
+ }
1387
+ const ownVersionParsed = {
1388
+ major: +myVersionMatch[1],
1389
+ minor: +myVersionMatch[2],
1390
+ patch: +myVersionMatch[3],
1391
+ prerelease: myVersionMatch[4]
1392
+ };
1393
+ if (ownVersionParsed.prerelease != null) {
1394
+ return function isExactmatch(globalVersion) {
1395
+ return globalVersion === ownVersion;
1396
+ };
1397
+ }
1398
+ function _reject(v) {
1399
+ rejectedVersions.add(v);
1400
+ return false;
1401
+ }
1402
+ function _accept(v) {
1403
+ acceptedVersions.add(v);
1404
+ return true;
1405
+ }
1406
+ return function isCompatible2(globalVersion) {
1407
+ if (acceptedVersions.has(globalVersion)) {
1408
+ return true;
1409
+ }
1410
+ if (rejectedVersions.has(globalVersion)) {
1411
+ return false;
1412
+ }
1413
+ const globalVersionMatch = globalVersion.match(re);
1414
+ if (!globalVersionMatch) {
1415
+ return _reject(globalVersion);
1416
+ }
1417
+ const globalVersionParsed = {
1418
+ major: +globalVersionMatch[1],
1419
+ minor: +globalVersionMatch[2],
1420
+ patch: +globalVersionMatch[3],
1421
+ prerelease: globalVersionMatch[4]
1422
+ };
1423
+ if (globalVersionParsed.prerelease != null) {
1424
+ return _reject(globalVersion);
1425
+ }
1426
+ if (ownVersionParsed.major !== globalVersionParsed.major) {
1427
+ return _reject(globalVersion);
1428
+ }
1429
+ if (ownVersionParsed.major === 0) {
1430
+ if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) {
1431
+ return _accept(globalVersion);
1432
+ }
1433
+ return _reject(globalVersion);
1434
+ }
1435
+ if (ownVersionParsed.minor <= globalVersionParsed.minor) {
1436
+ return _accept(globalVersion);
1437
+ }
1438
+ return _reject(globalVersion);
1439
+ };
1440
+ }
1441
+ var isCompatible = _makeCompatibilityCheck(VERSION);
1442
+
1443
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
1444
+ var major = VERSION.split(".")[0];
1445
+ var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for(`opentelemetry.js.api.${major}`);
1446
+ var _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
1447
+ function registerGlobal(type, instance, diag2, allowOverride = false) {
1448
+ var _a3;
1449
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a3 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a3 !== void 0 ? _a3 : {
1450
+ version: VERSION
1451
+ };
1452
+ if (!allowOverride && api[type]) {
1453
+ const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
1454
+ diag2.error(err.stack || err.message);
1455
+ return false;
1456
+ }
1457
+ if (api.version !== VERSION) {
1458
+ const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);
1459
+ diag2.error(err.stack || err.message);
1460
+ return false;
1461
+ }
1462
+ api[type] = instance;
1463
+ diag2.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);
1464
+ return true;
1465
+ }
1466
+ function getGlobal(type) {
1467
+ var _a3, _b;
1468
+ const globalVersion = (_a3 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a3 === void 0 ? void 0 : _a3.version;
1469
+ if (!globalVersion || !isCompatible(globalVersion)) {
1470
+ return;
1471
+ }
1472
+ return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
1473
+ }
1474
+ function unregisterGlobal(type, diag2) {
1475
+ diag2.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);
1476
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
1477
+ if (api) {
1478
+ delete api[type];
1479
+ }
1480
+ }
1481
+
1482
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
1483
+ var DiagComponentLogger = class {
1484
+ constructor(props) {
1485
+ this._namespace = props.namespace || "DiagComponentLogger";
1486
+ }
1487
+ debug(...args) {
1488
+ return logProxy("debug", this._namespace, args);
1489
+ }
1490
+ error(...args) {
1491
+ return logProxy("error", this._namespace, args);
1492
+ }
1493
+ info(...args) {
1494
+ return logProxy("info", this._namespace, args);
1495
+ }
1496
+ warn(...args) {
1497
+ return logProxy("warn", this._namespace, args);
1498
+ }
1499
+ verbose(...args) {
1500
+ return logProxy("verbose", this._namespace, args);
1501
+ }
1502
+ };
1503
+ function logProxy(funcName, namespace, args) {
1504
+ const logger = getGlobal("diag");
1505
+ if (!logger) {
1506
+ return;
1507
+ }
1508
+ return logger[funcName](namespace, ...args);
1509
+ }
1510
+
1511
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
1512
+ var DiagLogLevel;
1513
+ (function(DiagLogLevel2) {
1514
+ DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
1515
+ DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
1516
+ DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
1517
+ DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
1518
+ DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
1519
+ DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
1520
+ DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
1521
+ })(DiagLogLevel || (DiagLogLevel = {}));
1522
+
1523
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
1524
+ function createLogLevelDiagLogger(maxLevel, logger) {
1525
+ if (maxLevel < DiagLogLevel.NONE) {
1526
+ maxLevel = DiagLogLevel.NONE;
1527
+ } else if (maxLevel > DiagLogLevel.ALL) {
1528
+ maxLevel = DiagLogLevel.ALL;
1529
+ }
1530
+ logger = logger || {};
1531
+ function _filterFunc(funcName, theLevel) {
1532
+ const theFunc = logger[funcName];
1533
+ if (typeof theFunc === "function" && maxLevel >= theLevel) {
1534
+ return theFunc.bind(logger);
1535
+ }
1536
+ return function() {
1537
+ };
1538
+ }
1539
+ return {
1540
+ error: _filterFunc("error", DiagLogLevel.ERROR),
1541
+ warn: _filterFunc("warn", DiagLogLevel.WARN),
1542
+ info: _filterFunc("info", DiagLogLevel.INFO),
1543
+ debug: _filterFunc("debug", DiagLogLevel.DEBUG),
1544
+ verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
1545
+ };
1546
+ }
1547
+
1548
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
1549
+ var API_NAME = "diag";
1550
+ var DiagAPI = class _DiagAPI {
1551
+ /** Get the singleton instance of the DiagAPI API */
1552
+ static instance() {
1553
+ if (!this._instance) {
1554
+ this._instance = new _DiagAPI();
1555
+ }
1556
+ return this._instance;
1557
+ }
1558
+ /**
1559
+ * Private internal constructor
1560
+ * @private
1561
+ */
1562
+ constructor() {
1563
+ function _logProxy(funcName) {
1564
+ return function(...args) {
1565
+ const logger = getGlobal("diag");
1566
+ if (!logger)
1567
+ return;
1568
+ return logger[funcName](...args);
1569
+ };
1570
+ }
1571
+ const self2 = this;
1572
+ const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
1573
+ var _a3, _b, _c;
1574
+ if (logger === self2) {
1575
+ const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
1576
+ self2.error((_a3 = err.stack) !== null && _a3 !== void 0 ? _a3 : err.message);
1577
+ return false;
1578
+ }
1579
+ if (typeof optionsOrLogLevel === "number") {
1580
+ optionsOrLogLevel = {
1581
+ logLevel: optionsOrLogLevel
1582
+ };
1583
+ }
1584
+ const oldLogger = getGlobal("diag");
1585
+ const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
1586
+ if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
1587
+ const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
1588
+ oldLogger.warn(`Current logger will be overwritten from ${stack}`);
1589
+ newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
1590
+ }
1591
+ return registerGlobal("diag", newLogger, self2, true);
1592
+ };
1593
+ self2.setLogger = setLogger;
1594
+ self2.disable = () => {
1595
+ unregisterGlobal(API_NAME, self2);
1596
+ };
1597
+ self2.createComponentLogger = (options) => {
1598
+ return new DiagComponentLogger(options);
1599
+ };
1600
+ self2.verbose = _logProxy("verbose");
1601
+ self2.debug = _logProxy("debug");
1602
+ self2.info = _logProxy("info");
1603
+ self2.warn = _logProxy("warn");
1604
+ self2.error = _logProxy("error");
1605
+ }
1606
+ };
1607
+
1608
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js
1609
+ var BaggageImpl = class _BaggageImpl {
1610
+ constructor(entries) {
1611
+ this._entries = entries ? new Map(entries) : /* @__PURE__ */ new Map();
1612
+ }
1613
+ getEntry(key) {
1614
+ const entry = this._entries.get(key);
1615
+ if (!entry) {
1616
+ return void 0;
1617
+ }
1618
+ return Object.assign({}, entry);
1619
+ }
1620
+ getAllEntries() {
1621
+ return Array.from(this._entries.entries());
1622
+ }
1623
+ setEntry(key, entry) {
1624
+ const newBaggage = new _BaggageImpl(this._entries);
1625
+ newBaggage._entries.set(key, entry);
1626
+ return newBaggage;
1627
+ }
1628
+ removeEntry(key) {
1629
+ const newBaggage = new _BaggageImpl(this._entries);
1630
+ newBaggage._entries.delete(key);
1631
+ return newBaggage;
1632
+ }
1633
+ removeEntries(...keys) {
1634
+ const newBaggage = new _BaggageImpl(this._entries);
1635
+ for (const key of keys) {
1636
+ newBaggage._entries.delete(key);
1637
+ }
1638
+ return newBaggage;
1639
+ }
1640
+ clear() {
1641
+ return new _BaggageImpl();
1642
+ }
1643
+ };
1644
+
1645
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/utils.js
1646
+ var diag = DiagAPI.instance();
1647
+ function createBaggage(entries = {}) {
1648
+ return new BaggageImpl(new Map(Object.entries(entries)));
1649
+ }
1650
+
1651
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
1652
+ function createContextKey(description) {
1653
+ return Symbol.for(description);
1654
+ }
1655
+ var BaseContext = class _BaseContext {
1656
+ /**
1657
+ * Construct a new context which inherits values from an optional parent context.
1658
+ *
1659
+ * @param parentContext a context from which to inherit values
1660
+ */
1661
+ constructor(parentContext) {
1662
+ const self2 = this;
1663
+ self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
1664
+ self2.getValue = (key) => self2._currentContext.get(key);
1665
+ self2.setValue = (key, value) => {
1666
+ const context2 = new _BaseContext(self2._currentContext);
1667
+ context2._currentContext.set(key, value);
1668
+ return context2;
1669
+ };
1670
+ self2.deleteValue = (key) => {
1671
+ const context2 = new _BaseContext(self2._currentContext);
1672
+ context2._currentContext.delete(key);
1673
+ return context2;
1674
+ };
1675
+ }
1676
+ };
1677
+ var ROOT_CONTEXT = new BaseContext();
1678
+
1679
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js
1680
+ var defaultTextMapGetter = {
1681
+ get(carrier, key) {
1682
+ if (carrier == null) {
1683
+ return void 0;
1684
+ }
1685
+ return carrier[key];
1686
+ },
1687
+ keys(carrier) {
1688
+ if (carrier == null) {
1689
+ return [];
1690
+ }
1691
+ return Object.keys(carrier);
1692
+ }
1693
+ };
1694
+ var defaultTextMapSetter = {
1695
+ set(carrier, key, value) {
1696
+ if (carrier == null) {
1697
+ return;
1698
+ }
1699
+ carrier[key] = value;
1700
+ }
1701
+ };
1702
+
1703
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
1704
+ var NoopContextManager = class {
1705
+ active() {
1706
+ return ROOT_CONTEXT;
1707
+ }
1708
+ with(_context, fn, thisArg, ...args) {
1709
+ return fn.call(thisArg, ...args);
1710
+ }
1711
+ bind(_context, target) {
1712
+ return target;
1713
+ }
1714
+ enable() {
1715
+ return this;
1716
+ }
1717
+ disable() {
1718
+ return this;
1719
+ }
1720
+ };
1721
+
1722
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js
1723
+ var API_NAME2 = "context";
1724
+ var NOOP_CONTEXT_MANAGER = new NoopContextManager();
1725
+ var ContextAPI = class _ContextAPI {
1726
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
1727
+ constructor() {
1728
+ }
1729
+ /** Get the singleton instance of the Context API */
1730
+ static getInstance() {
1731
+ if (!this._instance) {
1732
+ this._instance = new _ContextAPI();
1733
+ }
1734
+ return this._instance;
1735
+ }
1736
+ /**
1737
+ * Set the current context manager.
1738
+ *
1739
+ * @returns true if the context manager was successfully registered, else false
1740
+ */
1741
+ setGlobalContextManager(contextManager) {
1742
+ return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
1743
+ }
1744
+ /**
1745
+ * Get the currently active context
1746
+ */
1747
+ active() {
1748
+ return this._getContextManager().active();
1749
+ }
1750
+ /**
1751
+ * Execute a function with an active context
1752
+ *
1753
+ * @param context context to be active during function execution
1754
+ * @param fn function to execute in a context
1755
+ * @param thisArg optional receiver to be used for calling fn
1756
+ * @param args optional arguments forwarded to fn
1757
+ */
1758
+ with(context2, fn, thisArg, ...args) {
1759
+ return this._getContextManager().with(context2, fn, thisArg, ...args);
1760
+ }
1761
+ /**
1762
+ * Bind a context to a target function or event emitter
1763
+ *
1764
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
1765
+ * @param target function or event emitter to bind
1766
+ */
1767
+ bind(context2, target) {
1768
+ return this._getContextManager().bind(context2, target);
1769
+ }
1770
+ _getContextManager() {
1771
+ return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
1772
+ }
1773
+ /** Disable and remove the global context manager */
1774
+ disable() {
1775
+ this._getContextManager().disable();
1776
+ unregisterGlobal(API_NAME2, DiagAPI.instance());
1777
+ }
1778
+ };
1779
+
1780
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
1781
+ var TraceFlags;
1782
+ (function(TraceFlags2) {
1783
+ TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
1784
+ TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
1785
+ })(TraceFlags || (TraceFlags = {}));
1786
+
1787
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
1788
+ var INVALID_SPANID = "0000000000000000";
1789
+ var INVALID_TRACEID = "00000000000000000000000000000000";
1790
+ var INVALID_SPAN_CONTEXT = {
1791
+ traceId: INVALID_TRACEID,
1792
+ spanId: INVALID_SPANID,
1793
+ traceFlags: TraceFlags.NONE
1794
+ };
1795
+
1796
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
1797
+ var NonRecordingSpan = class {
1798
+ constructor(spanContext = INVALID_SPAN_CONTEXT) {
1799
+ this._spanContext = spanContext;
1800
+ }
1801
+ // Returns a SpanContext.
1802
+ spanContext() {
1803
+ return this._spanContext;
1804
+ }
1805
+ // By default does nothing
1806
+ setAttribute(_key, _value) {
1807
+ return this;
1808
+ }
1809
+ // By default does nothing
1810
+ setAttributes(_attributes) {
1811
+ return this;
1812
+ }
1813
+ // By default does nothing
1814
+ addEvent(_name, _attributes) {
1815
+ return this;
1816
+ }
1817
+ addLink(_link) {
1818
+ return this;
1819
+ }
1820
+ addLinks(_links) {
1821
+ return this;
1822
+ }
1823
+ // By default does nothing
1824
+ setStatus(_status) {
1825
+ return this;
1826
+ }
1827
+ // By default does nothing
1828
+ updateName(_name) {
1829
+ return this;
1830
+ }
1831
+ // By default does nothing
1832
+ end(_endTime) {
1833
+ }
1834
+ // isRecording always returns false for NonRecordingSpan.
1835
+ isRecording() {
1836
+ return false;
1837
+ }
1838
+ // By default does nothing
1839
+ recordException(_exception, _time) {
1840
+ }
1841
+ };
1842
+
1843
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
1844
+ var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
1845
+ function getSpan(context2) {
1846
+ return context2.getValue(SPAN_KEY) || void 0;
1847
+ }
1848
+ function getActiveSpan() {
1849
+ return getSpan(ContextAPI.getInstance().active());
1850
+ }
1851
+ function setSpan(context2, span) {
1852
+ return context2.setValue(SPAN_KEY, span);
1853
+ }
1854
+ function deleteSpan(context2) {
1855
+ return context2.deleteValue(SPAN_KEY);
1856
+ }
1857
+ function setSpanContext(context2, spanContext) {
1858
+ return setSpan(context2, new NonRecordingSpan(spanContext));
1859
+ }
1860
+ function getSpanContext(context2) {
1861
+ var _a3;
1862
+ return (_a3 = getSpan(context2)) === null || _a3 === void 0 ? void 0 : _a3.spanContext();
1863
+ }
1864
+
1865
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
1866
+ var isHex = new Uint8Array([
1867
+ 0,
1868
+ 0,
1869
+ 0,
1870
+ 0,
1871
+ 0,
1872
+ 0,
1873
+ 0,
1874
+ 0,
1875
+ 0,
1876
+ 0,
1877
+ 0,
1878
+ 0,
1879
+ 0,
1880
+ 0,
1881
+ 0,
1882
+ 0,
1883
+ 0,
1884
+ 0,
1885
+ 0,
1886
+ 0,
1887
+ 0,
1888
+ 0,
1889
+ 0,
1890
+ 0,
1891
+ 0,
1892
+ 0,
1893
+ 0,
1894
+ 0,
1895
+ 0,
1896
+ 0,
1897
+ 0,
1898
+ 0,
1899
+ 0,
1900
+ 0,
1901
+ 0,
1902
+ 0,
1903
+ 0,
1904
+ 0,
1905
+ 0,
1906
+ 0,
1907
+ 0,
1908
+ 0,
1909
+ 0,
1910
+ 0,
1911
+ 0,
1912
+ 0,
1913
+ 0,
1914
+ 0,
1915
+ 1,
1916
+ 1,
1917
+ 1,
1918
+ 1,
1919
+ 1,
1920
+ 1,
1921
+ 1,
1922
+ 1,
1923
+ 1,
1924
+ 1,
1925
+ 0,
1926
+ 0,
1927
+ 0,
1928
+ 0,
1929
+ 0,
1930
+ 0,
1931
+ 0,
1932
+ 1,
1933
+ 1,
1934
+ 1,
1935
+ 1,
1936
+ 1,
1937
+ 1,
1938
+ 0,
1939
+ 0,
1940
+ 0,
1941
+ 0,
1942
+ 0,
1943
+ 0,
1944
+ 0,
1945
+ 0,
1946
+ 0,
1947
+ 0,
1948
+ 0,
1949
+ 0,
1950
+ 0,
1951
+ 0,
1952
+ 0,
1953
+ 0,
1954
+ 0,
1955
+ 0,
1956
+ 0,
1957
+ 0,
1958
+ 0,
1959
+ 0,
1960
+ 0,
1961
+ 0,
1962
+ 0,
1963
+ 0,
1964
+ 1,
1965
+ 1,
1966
+ 1,
1967
+ 1,
1968
+ 1,
1969
+ 1
1970
+ ]);
1971
+ function isValidHex(id, length) {
1972
+ if (typeof id !== "string" || id.length !== length)
1973
+ return false;
1974
+ let r = 0;
1975
+ for (let i = 0; i < id.length; i += 4) {
1976
+ r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
1977
+ }
1978
+ return r === length;
1979
+ }
1980
+ function isValidTraceId(traceId) {
1981
+ return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
1982
+ }
1983
+ function isValidSpanId(spanId) {
1984
+ return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
1985
+ }
1986
+ function isSpanContextValid(spanContext) {
1987
+ return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
1988
+ }
1989
+ function wrapSpanContext(spanContext) {
1990
+ return new NonRecordingSpan(spanContext);
1991
+ }
1992
+
1993
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
1994
+ var contextApi = ContextAPI.getInstance();
1995
+ var NoopTracer = class {
1996
+ // startSpan starts a noop span.
1997
+ startSpan(name, options, context2 = contextApi.active()) {
1998
+ const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
1999
+ if (root) {
2000
+ return new NonRecordingSpan();
2001
+ }
2002
+ const parentFromContext = context2 && getSpanContext(context2);
2003
+ if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
2004
+ return new NonRecordingSpan(parentFromContext);
2005
+ } else {
2006
+ return new NonRecordingSpan();
2007
+ }
2008
+ }
2009
+ startActiveSpan(name, arg2, arg3, arg4) {
2010
+ let opts;
2011
+ let ctx;
2012
+ let fn;
2013
+ if (arguments.length < 2) {
2014
+ return;
2015
+ } else if (arguments.length === 2) {
2016
+ fn = arg2;
2017
+ } else if (arguments.length === 3) {
2018
+ opts = arg2;
2019
+ fn = arg3;
2020
+ } else {
2021
+ opts = arg2;
2022
+ ctx = arg3;
2023
+ fn = arg4;
2024
+ }
2025
+ const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
2026
+ const span = this.startSpan(name, opts, parentContext);
2027
+ const contextWithSpanSet = setSpan(parentContext, span);
2028
+ return contextApi.with(contextWithSpanSet, fn, void 0, span);
2029
+ }
2030
+ };
2031
+ function isSpanContext(spanContext) {
2032
+ return spanContext !== null && typeof spanContext === "object" && "spanId" in spanContext && typeof spanContext["spanId"] === "string" && "traceId" in spanContext && typeof spanContext["traceId"] === "string" && "traceFlags" in spanContext && typeof spanContext["traceFlags"] === "number";
2033
+ }
2034
+
2035
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
2036
+ var NOOP_TRACER = new NoopTracer();
2037
+ var ProxyTracer = class {
2038
+ constructor(provider, name, version2, options) {
2039
+ this._provider = provider;
2040
+ this.name = name;
2041
+ this.version = version2;
2042
+ this.options = options;
2043
+ }
2044
+ startSpan(name, options, context2) {
2045
+ return this._getTracer().startSpan(name, options, context2);
2046
+ }
2047
+ startActiveSpan(_name, _options, _context, _fn) {
2048
+ const tracer = this._getTracer();
2049
+ return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
2050
+ }
2051
+ /**
2052
+ * Try to get a tracer from the proxy tracer provider.
2053
+ * If the proxy tracer provider has no delegate, return a noop tracer.
2054
+ */
2055
+ _getTracer() {
2056
+ if (this._delegate) {
2057
+ return this._delegate;
2058
+ }
2059
+ const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
2060
+ if (!tracer) {
2061
+ return NOOP_TRACER;
2062
+ }
2063
+ this._delegate = tracer;
2064
+ return this._delegate;
2065
+ }
2066
+ };
2067
+
2068
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
2069
+ var NoopTracerProvider = class {
2070
+ getTracer(_name, _version, _options) {
2071
+ return new NoopTracer();
2072
+ }
2073
+ };
2074
+
2075
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
2076
+ var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
2077
+ var ProxyTracerProvider = class {
2078
+ /**
2079
+ * Get a {@link ProxyTracer}
2080
+ */
2081
+ getTracer(name, version2, options) {
2082
+ var _a3;
2083
+ return (_a3 = this.getDelegateTracer(name, version2, options)) !== null && _a3 !== void 0 ? _a3 : new ProxyTracer(this, name, version2, options);
2084
+ }
2085
+ getDelegate() {
2086
+ var _a3;
2087
+ return (_a3 = this._delegate) !== null && _a3 !== void 0 ? _a3 : NOOP_TRACER_PROVIDER;
2088
+ }
2089
+ /**
2090
+ * Set the delegate tracer provider
2091
+ */
2092
+ setDelegate(delegate) {
2093
+ this._delegate = delegate;
2094
+ }
2095
+ getDelegateTracer(name, version2, options) {
2096
+ var _a3;
2097
+ return (_a3 = this._delegate) === null || _a3 === void 0 ? void 0 : _a3.getTracer(name, version2, options);
2098
+ }
2099
+ };
2100
+
2101
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js
2102
+ var SpanStatusCode;
2103
+ (function(SpanStatusCode2) {
2104
+ SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
2105
+ SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
2106
+ SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
2107
+ })(SpanStatusCode || (SpanStatusCode = {}));
2108
+
2109
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js
2110
+ var context = ContextAPI.getInstance();
2111
+
2112
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js
2113
+ var NoopTextMapPropagator = class {
2114
+ /** Noop inject function does nothing */
2115
+ inject(_context, _carrier) {
2116
+ }
2117
+ /** Noop extract function does nothing and returns the input context */
2118
+ extract(context2, _carrier) {
2119
+ return context2;
2120
+ }
2121
+ fields() {
2122
+ return [];
2123
+ }
2124
+ };
2125
+
2126
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js
2127
+ var BAGGAGE_KEY = createContextKey("OpenTelemetry Baggage Key");
2128
+ function getBaggage(context2) {
2129
+ return context2.getValue(BAGGAGE_KEY) || void 0;
2130
+ }
2131
+ function getActiveBaggage() {
2132
+ return getBaggage(ContextAPI.getInstance().active());
2133
+ }
2134
+ function setBaggage(context2, baggage) {
2135
+ return context2.setValue(BAGGAGE_KEY, baggage);
2136
+ }
2137
+ function deleteBaggage(context2) {
2138
+ return context2.deleteValue(BAGGAGE_KEY);
2139
+ }
2140
+
2141
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/propagation.js
2142
+ var API_NAME3 = "propagation";
2143
+ var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
2144
+ var PropagationAPI = class _PropagationAPI {
2145
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
2146
+ constructor() {
2147
+ this.createBaggage = createBaggage;
2148
+ this.getBaggage = getBaggage;
2149
+ this.getActiveBaggage = getActiveBaggage;
2150
+ this.setBaggage = setBaggage;
2151
+ this.deleteBaggage = deleteBaggage;
2152
+ }
2153
+ /** Get the singleton instance of the Propagator API */
2154
+ static getInstance() {
2155
+ if (!this._instance) {
2156
+ this._instance = new _PropagationAPI();
2157
+ }
2158
+ return this._instance;
2159
+ }
2160
+ /**
2161
+ * Set the current propagator.
2162
+ *
2163
+ * @returns true if the propagator was successfully registered, else false
2164
+ */
2165
+ setGlobalPropagator(propagator) {
2166
+ return registerGlobal(API_NAME3, propagator, DiagAPI.instance());
2167
+ }
2168
+ /**
2169
+ * Inject context into a carrier to be propagated inter-process
2170
+ *
2171
+ * @param context Context carrying tracing data to inject
2172
+ * @param carrier carrier to inject context into
2173
+ * @param setter Function used to set values on the carrier
2174
+ */
2175
+ inject(context2, carrier, setter = defaultTextMapSetter) {
2176
+ return this._getGlobalPropagator().inject(context2, carrier, setter);
2177
+ }
2178
+ /**
2179
+ * Extract context from a carrier
2180
+ *
2181
+ * @param context Context which the newly created context will inherit from
2182
+ * @param carrier Carrier to extract context from
2183
+ * @param getter Function used to extract keys from a carrier
2184
+ */
2185
+ extract(context2, carrier, getter = defaultTextMapGetter) {
2186
+ return this._getGlobalPropagator().extract(context2, carrier, getter);
2187
+ }
2188
+ /**
2189
+ * Return a list of all fields which may be used by the propagator.
2190
+ */
2191
+ fields() {
2192
+ return this._getGlobalPropagator().fields();
2193
+ }
2194
+ /** Remove the global propagator */
2195
+ disable() {
2196
+ unregisterGlobal(API_NAME3, DiagAPI.instance());
2197
+ }
2198
+ _getGlobalPropagator() {
2199
+ return getGlobal(API_NAME3) || NOOP_TEXT_MAP_PROPAGATOR;
2200
+ }
2201
+ };
2202
+
2203
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation-api.js
2204
+ var propagation = PropagationAPI.getInstance();
2205
+
2206
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
2207
+ var API_NAME4 = "trace";
2208
+ var TraceAPI = class _TraceAPI {
2209
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
2210
+ constructor() {
2211
+ this._proxyTracerProvider = new ProxyTracerProvider();
2212
+ this.wrapSpanContext = wrapSpanContext;
2213
+ this.isSpanContextValid = isSpanContextValid;
2214
+ this.deleteSpan = deleteSpan;
2215
+ this.getSpan = getSpan;
2216
+ this.getActiveSpan = getActiveSpan;
2217
+ this.getSpanContext = getSpanContext;
2218
+ this.setSpan = setSpan;
2219
+ this.setSpanContext = setSpanContext;
2220
+ }
2221
+ /** Get the singleton instance of the Trace API */
2222
+ static getInstance() {
2223
+ if (!this._instance) {
2224
+ this._instance = new _TraceAPI();
2225
+ }
2226
+ return this._instance;
2227
+ }
2228
+ /**
2229
+ * Set the current global tracer.
2230
+ *
2231
+ * @returns true if the tracer provider was successfully registered, else false
2232
+ */
2233
+ setGlobalTracerProvider(provider) {
2234
+ const success = registerGlobal(API_NAME4, this._proxyTracerProvider, DiagAPI.instance());
2235
+ if (success) {
2236
+ this._proxyTracerProvider.setDelegate(provider);
2237
+ }
2238
+ return success;
2239
+ }
2240
+ /**
2241
+ * Returns the global tracer provider.
2242
+ */
2243
+ getTracerProvider() {
2244
+ return getGlobal(API_NAME4) || this._proxyTracerProvider;
2245
+ }
2246
+ /**
2247
+ * Returns a tracer from the global tracer provider.
2248
+ */
2249
+ getTracer(name, version2) {
2250
+ return this.getTracerProvider().getTracer(name, version2);
2251
+ }
2252
+ /** Remove the global tracer provider */
2253
+ disable() {
2254
+ unregisterGlobal(API_NAME4, DiagAPI.instance());
2255
+ this._proxyTracerProvider = new ProxyTracerProvider();
2256
+ }
2257
+ };
2258
+
2259
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
2260
+ var trace = TraceAPI.getInstance();
2261
+
2262
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+core@2.9.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js
2263
+ var NANOSECOND_DIGITS = 9;
2264
+ var NANOSECOND_DIGITS_IN_MILLIS = 6;
2265
+ var MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);
2266
+ var SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);
2267
+ function hrTimeToMicroseconds(time2) {
2268
+ return time2[0] * 1e6 + time2[1] / 1e3;
2269
+ }
2270
+
2271
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+core@2.9.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js
2272
+ var ExportResultCode;
2273
+ (function(ExportResultCode2) {
2274
+ ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
2275
+ ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
2276
+ })(ExportResultCode || (ExportResultCode = {}));
2277
+
2278
+ // ../../../../../../node_modules/.pnpm/@opentelemetry+sdk-trace@2.9.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace/build/esm/export/ConsoleSpanExporter.js
2279
+ var ConsoleSpanExporter = class {
2280
+ /**
2281
+ * Export spans.
2282
+ * @param spans
2283
+ * @param resultCallback
2284
+ */
2285
+ export(spans, resultCallback) {
2286
+ return this._sendSpans(spans, resultCallback);
2287
+ }
2288
+ /**
2289
+ * Shutdown the exporter.
2290
+ */
2291
+ shutdown() {
2292
+ this._sendSpans([]);
2293
+ return this.forceFlush();
2294
+ }
2295
+ /**
2296
+ * Exports any pending spans in exporter
2297
+ */
2298
+ forceFlush() {
2299
+ return Promise.resolve();
2300
+ }
2301
+ /**
2302
+ * converts span info into more readable format
2303
+ * @param span
2304
+ */
2305
+ _exportInfo(span) {
2306
+ return {
2307
+ resource: {
2308
+ attributes: span.resource.attributes
2309
+ },
2310
+ instrumentationScope: span.instrumentationScope,
2311
+ traceId: span.spanContext().traceId,
2312
+ parentSpanContext: span.parentSpanContext,
2313
+ traceState: span.spanContext().traceState?.serialize(),
2314
+ name: span.name,
2315
+ id: span.spanContext().spanId,
2316
+ kind: span.kind,
2317
+ timestamp: hrTimeToMicroseconds(span.startTime),
2318
+ duration: hrTimeToMicroseconds(span.duration),
2319
+ attributes: span.attributes,
2320
+ status: span.status,
2321
+ events: span.events,
2322
+ links: span.links
2323
+ };
2324
+ }
2325
+ /**
2326
+ * Showing spans in console
2327
+ * @param spans
2328
+ * @param done
2329
+ */
2330
+ _sendSpans(spans, done) {
2331
+ for (const span of spans) {
2332
+ console.dir(this._exportInfo(span), { depth: 3 });
2333
+ }
2334
+ if (done) {
2335
+ return done({ code: ExportResultCode.SUCCESS });
2336
+ }
2337
+ }
2338
+ };
2339
+
2340
+ // ../../../../../../node_modules/.pnpm/@ariestools+sdk@7.0.8_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.9.0_@ope_649172f6a3c2e5736d1bf5bb5ca2adbf/node_modules/@ariestools/sdk/dist/browser/index.mjs
2341
+ var __defProp = Object.defineProperty;
2342
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2343
+ var __decorateClass = (decorators, target, key, kind) => {
2344
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2345
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2346
+ if (decorator = decorators[i])
2347
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2348
+ if (kind && result) __defProp(target, key, result);
2349
+ return result;
2350
+ };
2351
+ var Enum = (obj) => {
2352
+ return obj;
2353
+ };
2354
+ var ApiStage = Enum({
2355
+ Beta: "beta",
2356
+ Local: "local",
2357
+ Prod: "prod"
2358
+ });
2359
+ var fetchErrorMarker = "$$xylabs-fetch-error";
2360
+ var codeTypes = {
2361
+ ENOTFOUND: "dns",
2362
+ EAI_AGAIN: "dns",
2363
+ ECONNREFUSED: "connection-refused",
2364
+ ECONNRESET: "connection-reset",
2365
+ EPIPE: "connection-reset",
2366
+ ETIMEDOUT: "connection-timeout",
2367
+ UND_ERR_CONNECT_TIMEOUT: "connection-timeout",
2368
+ UND_ERR_HEADERS_TIMEOUT: "timeout",
2369
+ UND_ERR_BODY_TIMEOUT: "timeout",
2370
+ EHOSTUNREACH: "unreachable",
2371
+ ENETUNREACH: "unreachable",
2372
+ CERT_HAS_EXPIRED: "tls",
2373
+ DEPTH_ZERO_SELF_SIGNED_CERT: "tls",
2374
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: "tls",
2375
+ SELF_SIGNED_CERT_IN_CHAIN: "tls",
2376
+ ERR_TLS_CERT_ALTNAME_INVALID: "tls"
2377
+ };
2378
+ function findErrorCode(error) {
2379
+ let current = error;
2380
+ for (let depth = 0; depth < 8 && current instanceof Error; depth++) {
2381
+ const code = current.code;
2382
+ if (typeof code === "string") return code;
2383
+ current = current.cause;
2384
+ }
2385
+ return void 0;
2386
+ }
2387
+ function typeFromCode(code) {
2388
+ if (Object.hasOwn(codeTypes, code)) return codeTypes[code];
2389
+ if (code.startsWith("CERT_") || code.startsWith("ERR_TLS_")) return "tls";
2390
+ return void 0;
2391
+ }
2392
+ function classifyFetchError(error) {
2393
+ if (error instanceof Error) {
2394
+ if (error.name === "TimeoutError") return { type: "timeout" };
2395
+ if (error.name === "AbortError") return { type: "aborted" };
2396
+ }
2397
+ const code = findErrorCode(error);
2398
+ if (code !== void 0) {
2399
+ const type = typeFromCode(code);
2400
+ if (type !== void 0) return { type, code };
2401
+ return { type: "unknown", code };
2402
+ }
2403
+ if (error instanceof TypeError && /fetch failed|failed to fetch|network/i.test(error.message)) {
2404
+ return { type: "network" };
2405
+ }
2406
+ return { type: "unknown" };
2407
+ }
2408
+ var FetchError = class extends Error {
2409
+ __fetchErrorMarker = fetchErrorMarker;
2410
+ body;
2411
+ code;
2412
+ method;
2413
+ response;
2414
+ status;
2415
+ statusText;
2416
+ type;
2417
+ url;
2418
+ constructor(message, context2 = {}) {
2419
+ super(message, { cause: context2.cause });
2420
+ this.name = "FetchError";
2421
+ this.type = context2.type ?? "unknown";
2422
+ this.code = context2.code;
2423
+ this.url = context2.url;
2424
+ this.method = context2.method;
2425
+ this.status = context2.status;
2426
+ this.statusText = context2.statusText;
2427
+ this.response = context2.response;
2428
+ this.body = context2.body;
2429
+ }
2430
+ toJSON() {
2431
+ return {
2432
+ name: this.name,
2433
+ message: this.message,
2434
+ type: this.type,
2435
+ code: this.code,
2436
+ url: this.url,
2437
+ method: this.method,
2438
+ status: this.status,
2439
+ statusText: this.statusText
2440
+ };
2441
+ }
2442
+ };
2443
+ function isFetchError(value) {
2444
+ return value instanceof FetchError || typeof value === "object" && value !== null && value.__fetchErrorMarker === fetchErrorMarker;
2445
+ }
2446
+ function toFetchError(error, context2 = {}) {
2447
+ if (isFetchError(error)) return error;
2448
+ const { type, code } = classifyFetchError(error);
2449
+ const message = error instanceof Error ? error.message : String(error);
2450
+ return new FetchError(message, {
2451
+ ...context2,
2452
+ type,
2453
+ code,
2454
+ cause: error
2455
+ });
2456
+ }
2457
+ async function gzipString(body) {
2458
+ const blob = new Blob([body]);
2459
+ const stream = blob.stream().pipeThrough(new CompressionStream("gzip"));
2460
+ const response = new Response(stream);
2461
+ return response.arrayBuffer();
2462
+ }
2463
+ async function fetchCompress(url, options = {}) {
2464
+ const { compressMinLength = 1024, ...init } = options;
2465
+ try {
2466
+ if (init.body !== void 0 && init.body !== null) {
2467
+ const bodyStr = typeof init.body === "string" ? init.body : JSON.stringify(init.body);
2468
+ if (bodyStr.length > compressMinLength) {
2469
+ const headers = new Headers(init.headers);
2470
+ headers.set("Content-Encoding", "gzip");
2471
+ return await fetch(url, {
2472
+ ...init,
2473
+ body: await gzipString(bodyStr),
2474
+ headers
2475
+ });
2476
+ }
2477
+ }
2478
+ return await fetch(url, init);
2479
+ } catch (error) {
2480
+ throw toFetchError(error, { url: url.toString(), method: init.method });
2481
+ }
2482
+ }
2483
+ async function parseJsonResponse(response, context2 = {}) {
2484
+ let text;
2485
+ try {
2486
+ text = await response.text();
2487
+ } catch (error) {
2488
+ throw toFetchError(error, context2);
2489
+ }
2490
+ if (text.trim() === "") return null;
2491
+ try {
2492
+ return JSON.parse(text);
2493
+ } catch (error) {
2494
+ throw new FetchError("Failed to parse response body as JSON", {
2495
+ type: "parse",
2496
+ url: context2.url,
2497
+ method: context2.method,
2498
+ status: response.status,
2499
+ statusText: response.statusText,
2500
+ body: text,
2501
+ cause: error
2502
+ });
2503
+ }
2504
+ }
2505
+ async function tryParseJson(response) {
2506
+ try {
2507
+ const text = await response.text();
2508
+ if (text.trim() === "") return null;
2509
+ return JSON.parse(text);
2510
+ } catch {
2511
+ return null;
2512
+ }
2513
+ }
2514
+ var FetchClientError = class extends FetchError {
2515
+ config;
2516
+ constructor(message, response, config2) {
2517
+ super(message, {
2518
+ type: "http-status",
2519
+ url: config2.url,
2520
+ method: config2.method,
2521
+ status: response.status,
2522
+ statusText: response.statusText,
2523
+ response
2524
+ });
2525
+ this.name = "FetchClientError";
2526
+ this.config = config2;
2527
+ }
2528
+ };
2529
+ function buildHeaders(custom, includeContentType = false) {
2530
+ const headers = new Headers();
2531
+ headers.set("Accept", "application/json, text/plain, *.*");
2532
+ if (includeContentType) {
2533
+ headers.set("Content-Type", "application/json");
2534
+ }
2535
+ if (custom) {
2536
+ const merged = new Headers(custom);
2537
+ for (const [key, value] of merged.entries()) headers.set(key, value);
2538
+ }
2539
+ return headers;
2540
+ }
2541
+ function buildURL(config2) {
2542
+ const base = config2.baseURL ?? "";
2543
+ const path = config2.url ?? "";
2544
+ const url = base === "" ? new URL(path) : new URL(path, base);
2545
+ if (config2.params) {
2546
+ for (const [key, value] of Object.entries(config2.params)) {
2547
+ url.searchParams.set(key, value);
2548
+ }
2549
+ }
2550
+ return url.href;
2551
+ }
2552
+ var FetchClient = class _FetchClient {
2553
+ defaults;
2554
+ constructor(defaults = {}) {
2555
+ this.defaults = defaults;
2556
+ }
2557
+ static create(config2) {
2558
+ return new _FetchClient(config2);
2559
+ }
2560
+ delete(url, config2) {
2561
+ return this.request({
2562
+ ...config2,
2563
+ url,
2564
+ method: "DELETE"
2565
+ });
2566
+ }
2567
+ get(url, config2) {
2568
+ return this.request({
2569
+ ...config2,
2570
+ url,
2571
+ method: "GET"
2572
+ });
2573
+ }
2574
+ patch(url, data, config2) {
2575
+ return this.request({
2576
+ ...config2,
2577
+ url,
2578
+ data,
2579
+ method: "PATCH"
2580
+ });
2581
+ }
2582
+ post(url, data, config2) {
2583
+ return this.request({
2584
+ ...config2,
2585
+ url,
2586
+ data,
2587
+ method: "POST"
2588
+ });
2589
+ }
2590
+ put(url, data, config2) {
2591
+ return this.request({
2592
+ ...config2,
2593
+ url,
2594
+ data,
2595
+ method: "PUT"
2596
+ });
2597
+ }
2598
+ async request(config2) {
2599
+ const merged = { ...this.defaults, ...config2 };
2600
+ const url = buildURL(merged);
2601
+ const init = {
2602
+ method: merged.method ?? "GET",
2603
+ headers: buildHeaders(merged.headers, merged.data !== void 0),
2604
+ compressMinLength: merged.compressMinLength,
2605
+ signal: merged.timeout !== void 0 && merged.timeout !== 0 ? AbortSignal.timeout(merged.timeout) : merged.signal
2606
+ };
2607
+ if (merged.data !== void 0) {
2608
+ init.body = JSON.stringify(merged.data);
2609
+ }
2610
+ const response = await fetchCompress(url, init);
2611
+ const data = response.ok ? await parseJsonResponse(response, { url, method: merged.method }) : await tryParseJson(response);
2612
+ const result = {
2613
+ data,
2614
+ headers: response.headers,
2615
+ response,
2616
+ status: response.status,
2617
+ statusText: response.statusText
2618
+ };
2619
+ const validateStatus = merged.validateStatus === void 0 ? (s) => s >= 200 && s < 300 : merged.validateStatus;
2620
+ if (validateStatus && !validateStatus(response.status)) {
2621
+ throw new FetchClientError(
2622
+ `Request failed with status ${response.status} ${response.statusText}`,
2623
+ result,
2624
+ { ...merged, url }
2625
+ );
2626
+ }
2627
+ return result;
2628
+ }
2629
+ };
2630
+ var FetchJsonClient = class _FetchJsonClient extends FetchClient {
2631
+ constructor(config2) {
2632
+ super(config2);
2633
+ }
2634
+ static create(config2) {
2635
+ return new _FetchJsonClient(config2);
2636
+ }
2637
+ };
2638
+ var fetchJsonClient = new FetchJsonClient();
2639
+ function isUndefined(value) {
2640
+ return value === void 0;
2641
+ }
2642
+ function isDefined(value) {
2643
+ return !isUndefined(value);
2644
+ }
2645
+ function isString(value) {
2646
+ return typeof value === "string";
2647
+ }
2648
+ function isNumber(value) {
2649
+ return typeof value === "number";
2650
+ }
2651
+ function isObject2(value) {
2652
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2653
+ }
2654
+ function isTruthy(value) {
2655
+ return !!value;
2656
+ }
2657
+ function isError(value) {
2658
+ return value instanceof Error;
2659
+ }
2660
+ function isPromise(value) {
2661
+ return value instanceof Promise;
2662
+ }
2663
+ function assertDefinedEx(expr, func) {
2664
+ if (expr !== void 0) return expr;
2665
+ if (typeof func === "function") {
2666
+ const errorOrMessage = func(expr);
2667
+ throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
2668
+ }
2669
+ if (func !== void 0) {
2670
+ throw new Error("Invalid assertDefinedEx usage: second argument must be a function or undefined");
2671
+ }
2672
+ throw new Error("Assertion failed: value is undefined");
2673
+ }
2674
+ function assertEx(expr, func) {
2675
+ if (expr !== void 0 && expr !== null && expr !== false && expr !== 0 && expr !== "" && expr !== 0n) return expr;
2676
+ if (typeof func === "function") {
2677
+ const errorOrMessage = func(expr);
2678
+ throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
2679
+ }
2680
+ if (func !== void 0) {
2681
+ throw new Error("Invalid assertEx usage: second argument must be a function or undefined");
2682
+ }
2683
+ throw new Error("Assertion failed");
2684
+ }
2685
+ var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
2686
+ return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
2687
+ };
2688
+ var HexRegExMinMaxMixedCaseWithPrefix = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
2689
+ return new RegExp(`^0x[a-fA-F0-9]{${minBytes * 2},${maxBytes * 2}}$`);
2690
+ };
2691
+ var HexRegEx = /^[0-9a-f]+$/;
2692
+ var HexRegExWithPrefix = /^0x[0-9a-f]+$/;
2693
+ var ADDRESS_LENGTH = 40;
2694
+ var AddressRegEx = HexRegExMinMax(ADDRESS_LENGTH / 2, ADDRESS_LENGTH / 2);
2695
+ var AddressZod = pipe(
2696
+ string2().check(_regex(AddressRegEx)),
2697
+ transform((v) => v)
2698
+ );
2699
+ var assertError = (value, assert, defaultMessage) => {
2700
+ if (!isUndefined(assert)) {
2701
+ const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
2702
+ if (isString(assertString) || assertString) {
2703
+ throw new Error(assertString === true ? defaultMessage : assertString);
2704
+ }
2705
+ }
2706
+ return void 0;
2707
+ };
2708
+ var handleError = (error, handler) => {
2709
+ if (isError(error)) {
2710
+ return handler(error);
2711
+ }
2712
+ throw error;
2713
+ };
2714
+ var bitsToNibbles = (value) => {
2715
+ const nibbles = value >> 2;
2716
+ if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4");
2717
+ return nibbles;
2718
+ };
2719
+ var isHex2 = (value, config2) => {
2720
+ if (typeof value !== "string") return false;
2721
+ const valueCharLength = value.length - (config2?.prefix === true ? 2 : 0);
2722
+ if (config2?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config2?.bitLength)) return false;
2723
+ const regex5 = config2?.prefix === true ? HexRegExWithPrefix : HexRegEx;
2724
+ return regex5.test(value);
2725
+ };
2726
+ var hexFromHexString = (value, config2 = {}) => {
2727
+ const {
2728
+ prefix: isPrefix = false,
2729
+ byteSize = 8,
2730
+ bitLength
2731
+ } = config2;
2732
+ const nibbleBoundary = bitsToNibbles(byteSize);
2733
+ const unEvened = (value.startsWith("0x") ? value.slice(2) : value).toLowerCase();
2734
+ if (isHex2(unEvened)) {
2735
+ const evenCharacters = unEvened.padStart(Math.ceil(unEvened.length / nibbleBoundary) * nibbleBoundary, "0");
2736
+ const padded = isNumber(bitLength) ? evenCharacters.padStart(bitLength / 4, "0") : evenCharacters;
2737
+ return (isPrefix ? `0x${padded}` : padded).toLowerCase();
2738
+ }
2739
+ throw new Error("Received string is not a value hex");
2740
+ };
2741
+ var hexFromArrayBuffer = (buffer, config2) => {
2742
+ const unPadded = [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, "0")).join("");
2743
+ return hexFromHexString(unPadded, config2);
2744
+ };
2745
+ var hexFromBigInt = (value, config2 = {}) => {
2746
+ const unPadded = value.toString(16);
2747
+ return hexFromHexString(unPadded, config2);
2748
+ };
2749
+ var hexFromNumber = (value, config2) => {
2750
+ return hexFromBigInt(BigInt(value), config2);
2751
+ };
2752
+ var hexFrom = (value, config2) => {
2753
+ switch (typeof value) {
2754
+ case "string": {
2755
+ return hexFromHexString(value, config2);
2756
+ }
2757
+ case "bigint": {
2758
+ return hexFromBigInt(value, config2);
2759
+ }
2760
+ case "number": {
2761
+ return hexFromNumber(value, config2);
2762
+ }
2763
+ case "object": {
2764
+ return hexFromArrayBuffer(value, config2);
2765
+ }
2766
+ default: {
2767
+ throw new Error(`Invalid type: ${typeof value}`);
2768
+ }
2769
+ }
2770
+ };
2771
+ var HexZod = pipe(
2772
+ string2().check(_regex(HexRegEx, { error: "Invalid hex format" })),
2773
+ transform((val) => val)
943
2774
  );
944
2775
  var toHex = (value, config2 = {}) => {
945
2776
  const { prefix: isPrefix = false } = config2;
946
2777
  return hexFrom(value, { prefix: isPrefix, ...config2 });
947
2778
  };
948
- var AddressValidationZod = pipe(
949
- string2().check(
950
- refine((x) => HexZod.safeParse(x).success),
951
- refine((x) => x.length === ADDRESS_LENGTH, { error: (e) => new Error(`Address must have 40 characters [${String(e.input)}]`) })
952
- ),
953
- transform((v) => v)
954
- );
955
- var AddressTransformZod = pipe(
956
- pipe(
957
- union([string2(), bigint2(), number2()]),
958
- transform((value) => {
959
- if (typeof value === "bigint") {
960
- return value.toString(16).padStart(ADDRESS_LENGTH, "0");
2779
+ var AddressValidationZod = pipe(
2780
+ string2().check(
2781
+ refine((x) => HexZod.safeParse(x).success),
2782
+ refine((x) => x.length === ADDRESS_LENGTH, { error: (e) => new Error(`Address must have 40 characters [${String(e.input)}]`) })
2783
+ ),
2784
+ transform((v) => v)
2785
+ );
2786
+ var AddressTransformZod = pipe(
2787
+ pipe(
2788
+ union([string2(), bigint2(), number2()]),
2789
+ transform((value) => {
2790
+ if (typeof value === "bigint") {
2791
+ return value.toString(16).padStart(ADDRESS_LENGTH, "0");
2792
+ }
2793
+ if (typeof value === "string") {
2794
+ return value.startsWith("0x") ? value.slice(2) : value;
2795
+ }
2796
+ return BigInt(value).toString(16).padStart(ADDRESS_LENGTH, "0");
2797
+ })
2798
+ ).check(refine((x) => AddressValidationZod.safeParse(x).success)),
2799
+ transform((x) => x)
2800
+ );
2801
+ var EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20);
2802
+ var EthAddressToStringZod = string2().check(_regex(EthAddressRegEx));
2803
+ var EthAddressFromStringZod = pipe(
2804
+ string2().check(_regex(EthAddressRegEx)),
2805
+ transform((v) => toEthAddress(v))
2806
+ );
2807
+ var toEthAddress = (value, config2 = {}) => {
2808
+ const { bitLength = 160, prefix: isPrefix = false } = config2;
2809
+ return `0x${hexFrom(value, {
2810
+ bitLength,
2811
+ prefix: isPrefix,
2812
+ ...config2
2813
+ })}`;
2814
+ };
2815
+ var isEthAddress = (value, config2 = {}) => {
2816
+ const { bitLength = 160, prefix: isPrefix = true } = config2;
2817
+ const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
2818
+ return isHex2(loweredValue, { bitLength, prefix: isPrefix });
2819
+ };
2820
+ var EthAddressZod = string2().check(
2821
+ _regex(EthAddressRegEx, { error: "Invalid address format" }),
2822
+ refine(isEthAddress)
2823
+ );
2824
+ var isHash = (value, bitLength = 256) => {
2825
+ return isHex2(value, { bitLength });
2826
+ };
2827
+ function asHash(value, assert) {
2828
+ switch (typeof value) {
2829
+ case "string": {
2830
+ const stringValue = hexFromHexString(value);
2831
+ return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`);
2832
+ }
2833
+ default: {
2834
+ return isUndefined(assert) ? void 0 : assertError(value, assert, `Unsupported type [${typeof value}]`);
2835
+ }
2836
+ }
2837
+ }
2838
+ var HASH_LENGTH = 32;
2839
+ var HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH);
2840
+ var HashZod = pipe(
2841
+ string2().check(_regex(HashRegEx, { error: "Invalid hex format" })),
2842
+ transform((val) => val)
2843
+ );
2844
+ var HashToJsonZod = pipe(HashZod, transform((v) => v));
2845
+ var JsonToHashZod = pipe(string2(), transform((v) => asHash(v, true)));
2846
+ function hexToBigInt(hex) {
2847
+ return BigInt(hexFromHexString(hex, { prefix: true }));
2848
+ }
2849
+ var BigIntToJsonZod = pipe(
2850
+ bigint2().check(_nonnegative()),
2851
+ transform((x) => toHex(x))
2852
+ );
2853
+ var JsonToBigIntZod = pipe(
2854
+ string2(),
2855
+ transform((x) => hexToBigInt(toHex(x)))
2856
+ );
2857
+ var DEFAULT_HISTORY_INTERVAL = 1e3 * 5;
2858
+ var DEFAULT_HISTORY_TIME = 60 * 60 * 1e3;
2859
+ var MAX_GC_FREQUENCY = 1e3 * 60;
2860
+ var MIN_GC_FREQUENCY = 1e3;
2861
+ var MIN_HISTORY_INTERVAL = 1e3;
2862
+ var Base = class _Base {
2863
+ static defaultLogger;
2864
+ static globalInstances = {};
2865
+ static globalInstancesCountHistory = {};
2866
+ static _historyInterval = DEFAULT_HISTORY_INTERVAL;
2867
+ static _historyTime = DEFAULT_HISTORY_TIME;
2868
+ static _historyTimeout;
2869
+ static _lastGC = 0;
2870
+ static _maxGcFrequency = MAX_GC_FREQUENCY;
2871
+ _params;
2872
+ constructor(params) {
2873
+ this._params = params;
2874
+ params?.logger?.debug(`Base constructed [${this.constructor.name}]`);
2875
+ this.recordInstance();
2876
+ }
2877
+ static get historyInterval() {
2878
+ return this._historyInterval;
2879
+ }
2880
+ static set historyInterval(value) {
2881
+ assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`);
2882
+ this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL);
2883
+ }
2884
+ static get historyTime() {
2885
+ return this._historyTime;
2886
+ }
2887
+ static set historyTime(value) {
2888
+ assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`);
2889
+ this._historyInterval = value;
2890
+ }
2891
+ static get maxGcFrequency() {
2892
+ return this._maxGcFrequency;
2893
+ }
2894
+ static set maxGcFrequency(value) {
2895
+ this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY);
2896
+ }
2897
+ static get maxHistoryDepth() {
2898
+ return Math.floor(this.historyTime / this.historyInterval);
2899
+ }
2900
+ get logger() {
2901
+ return this.params?.logger ?? _Base.defaultLogger;
2902
+ }
2903
+ get meter() {
2904
+ return this.params?.meterProvider?.getMeter(this.constructor.name);
2905
+ }
2906
+ get params() {
2907
+ return this._params;
2908
+ }
2909
+ get tracer() {
2910
+ return this.params?.traceProvider?.getTracer(this.constructor.name);
2911
+ }
2912
+ static gc(classNameOrForce = false) {
2913
+ if (typeof classNameOrForce === "string") {
2914
+ this.gcClass(classNameOrForce);
2915
+ } else {
2916
+ if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {
2917
+ this.gcAll();
2918
+ }
2919
+ }
2920
+ }
2921
+ static instanceCount(className) {
2922
+ return this.globalInstances[className]?.length ?? 0;
2923
+ }
2924
+ static instanceCounts() {
2925
+ this.gc();
2926
+ const result = {};
2927
+ for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length;
2928
+ return result;
2929
+ }
2930
+ static startHistory() {
2931
+ if (this._historyTimeout !== void 0) {
2932
+ this.stopHistory();
2933
+ }
2934
+ const timeoutHandler = () => {
2935
+ if (this._historyTimeout === void 0) {
2936
+ return;
2937
+ }
2938
+ this.addToHistory();
2939
+ this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
2940
+ };
2941
+ this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
2942
+ }
2943
+ static stopHistory() {
2944
+ if (this._historyTimeout === void 0) {
2945
+ return;
2946
+ }
2947
+ clearTimeout(this._historyTimeout);
2948
+ this._historyTimeout = void 0;
2949
+ }
2950
+ static addToHistory() {
2951
+ const counts = this.instanceCounts();
2952
+ for (const className of Object.keys(this.globalInstances)) {
2953
+ this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? [];
2954
+ this.globalInstancesCountHistory[className].push(counts[className]);
2955
+ }
2956
+ }
2957
+ static gcAll() {
2958
+ for (const className of Object.keys(this.globalInstances)) {
2959
+ this.gcClass(className);
2960
+ }
2961
+ }
2962
+ static gcClass(className) {
2963
+ this.globalInstances[className] = this.globalInstances[className]?.filter((ref) => ref.deref() !== null) ?? [];
2964
+ }
2965
+ recordInstance() {
2966
+ const baseClassName = this.constructor.name;
2967
+ const instanceArray = _Base.globalInstances[baseClassName] ?? [];
2968
+ instanceArray.push(new WeakRef(this));
2969
+ _Base.globalInstances[baseClassName] = instanceArray;
2970
+ }
2971
+ };
2972
+ var defaultForgetConfig = { timeout: 3e4 };
2973
+ var defaultForgetNodeConfig = {
2974
+ ...defaultForgetConfig,
2975
+ terminateOnTimeout: false,
2976
+ terminateOnException: false
2977
+ };
2978
+ var TimerScheduler = class {
2979
+ currentTimeout;
2980
+ interval = -1;
2981
+ timeouts = [];
2982
+ /**
2983
+ * Cancels a timeout previously created with setTimeoutEx.
2984
+ * @param id - The timeout ID returned by setTimeoutEx.
2985
+ */
2986
+ clearTimeoutEx(id) {
2987
+ this.timeouts = this.timeouts.filter((timeout) => timeout.id !== id);
2988
+ this.update(this.timeouts);
2989
+ }
2990
+ /** Clears all scheduled timeouts and resets internal state. */
2991
+ reset() {
2992
+ this.interval = -1;
2993
+ clearTimeout(this.currentTimeout);
2994
+ this.currentTimeout = void 0;
2995
+ this.timeouts = [];
2996
+ }
2997
+ /**
2998
+ * Sets a timeout using an optimized internal timer that coalesces multiple timeouts into a single native timer.
2999
+ * @param func - The function to call after the delay.
3000
+ * @param delay - The delay in milliseconds (must be >= 0).
3001
+ * @returns A unique string ID that can be used with clearTimeoutEx to cancel the timeout.
3002
+ */
3003
+ setTimeoutEx(func, delay2) {
3004
+ assertEx(delay2 >= 0, () => "delay must be >= 0");
3005
+ const id = `${Date.now()}|${Math.random() * 9999999999}`;
3006
+ this.timeouts.push({
3007
+ delay: delay2,
3008
+ func,
3009
+ id
3010
+ });
3011
+ this.update();
3012
+ return id;
3013
+ }
3014
+ timerFunc() {
3015
+ const notFiring = this.timeouts.filter((timeout) => timeout.delay > this.interval);
3016
+ const firing = this.timeouts.filter((timeout) => timeout.delay <= this.interval);
3017
+ this.update(notFiring, this.interval);
3018
+ for (const timeout of firing) {
3019
+ timeout.func();
3020
+ }
3021
+ }
3022
+ update(newTimeouts = this.timeouts, delayPassed = 0) {
3023
+ if (newTimeouts.length === 0) {
3024
+ this.reset();
3025
+ } else {
3026
+ const newInterval = Math.min(...newTimeouts.map((timeout) => timeout.delay));
3027
+ if (newInterval === this.interval && this.currentTimeout !== void 0) {
3028
+ return;
3029
+ }
3030
+ clearTimeout(this.currentTimeout);
3031
+ this.timeouts = newTimeouts.map((timeout) => ({
3032
+ delay: timeout.delay - delayPassed,
3033
+ func: timeout.func,
3034
+ id: timeout.id
3035
+ }));
3036
+ this.interval = newInterval;
3037
+ this.currentTimeout = setTimeout(() => this.timerFunc(), this.interval);
3038
+ }
3039
+ }
3040
+ };
3041
+ var defaultTimerScheduler = new TimerScheduler();
3042
+ var setTimeoutEx = (func, delay2) => defaultTimerScheduler.setTimeoutEx(func, delay2);
3043
+ var delay = (ms) => {
3044
+ return new Promise((resolve) => setTimeoutEx(() => resolve(), ms));
3045
+ };
3046
+ var ForgetPromise = class {
3047
+ /**
3048
+ * Number of forgotten promises still running (not yet settled).
3049
+ * Decremented only when the underlying promise fulfills or rejects — not when a timeout fires.
3050
+ */
3051
+ static activeForgets = 0;
3052
+ /** Number of forgotten promises that threw exceptions. */
3053
+ static exceptedForgets = 0;
3054
+ /** Logger instance used for error and warning output. */
3055
+ static logger = console;
3056
+ /** Whether any forgotten promises are still running, including any that have exceeded their timeout. */
3057
+ static get active() {
3058
+ return this.activeForgets > 0;
3059
+ }
3060
+ /**
3061
+ * Waits until all forgotten promises have settled.
3062
+ * @param interval - Polling interval in milliseconds.
3063
+ * @param timeout - Optional maximum wait time in milliseconds.
3064
+ * @returns `0` when every forgotten promise has settled; otherwise the number still running.
3065
+ * A non-zero return after `timeout` elapses can include promises whose timeout callback already
3066
+ * ran but whose work is still in flight.
3067
+ */
3068
+ static async awaitInactive(interval = 100, timeout) {
3069
+ let timeoutRemaining = timeout;
3070
+ while (this.active) {
3071
+ await delay(interval);
3072
+ if (timeoutRemaining !== void 0) {
3073
+ timeoutRemaining -= interval;
3074
+ if (timeoutRemaining <= 0) {
3075
+ return this.activeForgets;
3076
+ }
3077
+ }
3078
+ }
3079
+ return 0;
3080
+ }
3081
+ /** Handles exceptions from forgotten promises by logging error details. */
3082
+ static exceptionHandler(error, { name }, externalStackTrace) {
3083
+ this.logger.error(`forget promise handler excepted [${name}]: ${error.message}`, error);
3084
+ if (externalStackTrace !== void 0) {
3085
+ this.logger.warn(`External Stack trace [${name}]:`, externalStackTrace);
3086
+ }
3087
+ }
3088
+ /**
3089
+ * Used to explicitly launch an async function (or Promise) with awaiting it
3090
+ * @param promise The promise to forget
3091
+ * @param config Configuration of forget settings
3092
+ */
3093
+ static forget(promise, config2) {
3094
+ const stackError = new Error("Stack");
3095
+ const externalStackTrace = stackError.stack;
3096
+ const resolvedConfig = {
3097
+ ...defaultForgetConfig,
3098
+ ...globalThis.xy?.forget?.config,
3099
+ ...config2
3100
+ };
3101
+ const resolvedPromise2 = typeof promise === "function" ? promise() : promise;
3102
+ if (isPromise(resolvedPromise2)) {
3103
+ try {
3104
+ let isCompleted = false;
3105
+ this.activeForgets++;
3106
+ const promiseWrapper = async () => {
3107
+ try {
3108
+ const result = await resolvedPromise2;
3109
+ this.activeForgets--;
3110
+ isCompleted = true;
3111
+ resolvedConfig?.onComplete?.([result, void 0]);
3112
+ } catch (error) {
3113
+ const caughtError = error instanceof Error ? error : new Error(String(error));
3114
+ this.activeForgets--;
3115
+ isCompleted = true;
3116
+ this.logger.error(`forgotten promise excepted [${config2?.name ?? "unknown"}]: ${caughtError.message}`, caughtError);
3117
+ resolvedConfig?.onComplete?.([void 0, caughtError]);
3118
+ }
3119
+ };
3120
+ const promises = [promiseWrapper()];
3121
+ const timeout = resolvedConfig.timeout ?? defaultForgetConfig.timeout;
3122
+ if (isNumber(timeout)) {
3123
+ const timeoutFunc = async () => {
3124
+ await delay(timeout);
3125
+ if (!isCompleted) {
3126
+ resolvedConfig.onCancel?.();
3127
+ this.timeoutHandler(timeout, resolvedConfig, externalStackTrace);
3128
+ }
3129
+ };
3130
+ promises.push(timeoutFunc());
3131
+ }
3132
+ const race = Promise.race(promises);
3133
+ void race.catch(() => {
3134
+ });
3135
+ } catch (ex) {
3136
+ this.exceptedForgets += 1;
3137
+ resolvedConfig?.onException?.(ex);
3138
+ this.exceptionHandler(ex, resolvedConfig, externalStackTrace);
3139
+ }
3140
+ } else {
3141
+ return;
3142
+ }
3143
+ }
3144
+ /**
3145
+ * Handles timeout events for forgotten promises by logging timeout details.
3146
+ * Does not terminate the underlying promise; it may continue running after this is called.
3147
+ */
3148
+ static timeoutHandler(time2, { name = "unknown" }, externalStackTrace) {
3149
+ this.logger.error(`forget promise timed out after ${time2}ms [still running] [${name}]`);
3150
+ if (externalStackTrace !== void 0) {
3151
+ this.logger.warn(`External Stack trace [${name}]:`, externalStackTrace);
3152
+ }
3153
+ }
3154
+ };
3155
+ var ForgetPromiseNode = class extends ForgetPromise {
3156
+ /** Handles exceptions, optionally terminating the process based on config. */
3157
+ static exceptionHandler(error, config2, externalStackTrace) {
3158
+ super.exceptionHandler(error, config2, externalStackTrace);
3159
+ if (config2?.terminateOnException === true) {
3160
+ this.logger.error(`Attempting to terminate process [${config2?.name ?? "unknown"}]...`);
3161
+ process.exit(1);
3162
+ }
3163
+ }
3164
+ /** Forgets a promise using Node.js-specific configuration with process termination support. */
3165
+ static forget(promise, config2) {
3166
+ const resolvedConfig = {
3167
+ ...defaultForgetNodeConfig,
3168
+ ...globalThis.xy?.forget?.config,
3169
+ ...config2
3170
+ };
3171
+ super.forget(promise, resolvedConfig);
3172
+ }
3173
+ /** Handles timeouts, optionally terminating the process based on config. */
3174
+ static timeoutHandler(time2, config2, externalStackTrace) {
3175
+ super.timeoutHandler(time2, config2, externalStackTrace);
3176
+ if (config2?.terminateOnTimeout === true) {
3177
+ this.logger.error(`Attempting to terminate process [${config2?.name ?? "unknown"}]...`);
3178
+ process.exit(2);
3179
+ }
3180
+ }
3181
+ };
3182
+ var forgetNode = (promise, config2) => {
3183
+ ForgetPromiseNode.forget(promise, config2);
3184
+ };
3185
+ var NO_META_EVENT_ERROR_MESSAGE = "`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`";
3186
+ var processGlobal = globalThis;
3187
+ var resolvedPromise = Promise.resolve();
3188
+ var isMetaEvent = (eventName) => eventName === "listenerAdded" || eventName === "listenerRemoved";
3189
+ var Events = class _Events extends Base {
3190
+ static anyMap = /* @__PURE__ */ new WeakMap();
3191
+ static eventsMap = /* @__PURE__ */ new WeakMap();
3192
+ static isGlobalDebugEnabled = false;
3193
+ // this is here to be able to query the type, not use
3194
+ eventData = {};
3195
+ _canEmitMetaEvents = false;
3196
+ constructor(params = {}) {
3197
+ const mutatedParams = { ...params };
3198
+ if (mutatedParams.debug) {
3199
+ mutatedParams.debug.logger ??= (type, debugName, eventName, eventData) => {
3200
+ let eventDataString;
3201
+ try {
3202
+ eventDataString = JSON.stringify(eventData);
3203
+ } catch {
3204
+ eventDataString = `Object with the following keys failed to stringify: ${Object.keys(eventData ?? {}).join(",")}`;
3205
+ }
3206
+ const eventNameString = typeof eventName === "symbol" || typeof eventName === "number" ? eventName.toString() : eventName;
3207
+ const currentTime = /* @__PURE__ */ new Date();
3208
+ const logTime = `${currentTime.getHours()}:${currentTime.getMinutes()}:${currentTime.getSeconds()}.${currentTime.getMilliseconds()}`;
3209
+ this.logger?.log(`[${logTime}][events:${type}][${debugName}] Event Name: ${eventNameString}
3210
+ data: ${eventDataString}`);
3211
+ };
3212
+ }
3213
+ super(mutatedParams);
3214
+ _Events.anyMap.set(this, /* @__PURE__ */ new Set());
3215
+ _Events.eventsMap.set(this, /* @__PURE__ */ new Map());
3216
+ }
3217
+ /** Whether debug mode is enabled globally or via the DEBUG environment variable. */
3218
+ static get isDebugEnabled() {
3219
+ if (typeof processGlobal.process?.env !== "object") {
3220
+ return this.isGlobalDebugEnabled;
3221
+ }
3222
+ const env = processGlobal.process?.env;
3223
+ return env?.DEBUG === "events" || env?.DEBUG === "*" || this.isGlobalDebugEnabled;
3224
+ }
3225
+ static set isDebugEnabled(newValue) {
3226
+ this.isGlobalDebugEnabled = newValue;
3227
+ }
3228
+ /** The debug configuration for this instance, if provided. */
3229
+ get debug() {
3230
+ return this.params.debug;
3231
+ }
3232
+ /**
3233
+ * Removes all listeners for the specified event name(s).
3234
+ * @param eventNames - One or more event names to clear listeners for.
3235
+ */
3236
+ clearListeners(eventNames) {
3237
+ const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];
3238
+ for (const eventName of eventNamesArray) {
3239
+ this.logIfDebugEnabled("clear", eventName);
3240
+ if (typeof eventName === "string" || typeof eventName === "symbol" || typeof eventName === "number") {
3241
+ const set = this.getListeners(eventName);
3242
+ if (set) {
3243
+ set.clear();
3244
+ }
3245
+ } else {
3246
+ _Events.anyMap.get(this)?.clear();
3247
+ const eventEntries = assertEx(_Events.eventsMap.get(this));
3248
+ for (const [eventName2, listeners] of eventEntries) {
3249
+ listeners.clear();
3250
+ _Events.eventsMap.get(this)?.delete(eventName2);
3251
+ }
3252
+ }
3253
+ }
3254
+ }
3255
+ /**
3256
+ * Emits an event, invoking all registered listeners concurrently.
3257
+ * @param eventName - The event to emit.
3258
+ * @param eventArgs - The data to pass to listeners.
3259
+ */
3260
+ async emit(eventName, eventArgs) {
3261
+ return await this.emitInternal(eventName, eventArgs);
3262
+ }
3263
+ /**
3264
+ * Emits an internal meta event (listenerAdded or listenerRemoved).
3265
+ * @param eventName - The meta event name.
3266
+ * @param eventArgs - The meta event data containing listener and event information.
3267
+ * @returns True if the meta event was emitted successfully.
3268
+ */
3269
+ async emitMetaEvent(eventName, eventArgs) {
3270
+ if (isMetaEvent(eventName)) {
3271
+ try {
3272
+ this._canEmitMetaEvents = true;
3273
+ await this.emitMetaEventInternal(eventName, eventArgs);
3274
+ return true;
3275
+ } finally {
3276
+ this._canEmitMetaEvents = false;
3277
+ }
3278
+ }
3279
+ }
3280
+ /**
3281
+ * Emits an event, invoking all registered listeners sequentially in order.
3282
+ * @param eventName - The event to emit.
3283
+ * @param eventArgs - The data to pass to listeners.
3284
+ */
3285
+ async emitSerial(eventName, eventArgs) {
3286
+ if (isMetaEvent(eventName) && !this._canEmitMetaEvents) {
3287
+ throw new TypeError(NO_META_EVENT_ERROR_MESSAGE);
3288
+ }
3289
+ const filterMatch = (args, filter) => {
3290
+ switch (typeof filter) {
3291
+ case "object": {
3292
+ if (filter === null || args === null || typeof args !== "object") return args === filter;
3293
+ return Object.entries(args).reduce((prev, [key, value]) => filter[key] === value ? true : prev, false);
3294
+ }
3295
+ default: {
3296
+ return args === filter;
3297
+ }
3298
+ }
3299
+ };
3300
+ this.logIfDebugEnabled("emitSerial", eventName, eventArgs);
3301
+ const listeners = this.getListeners(eventName) ?? /* @__PURE__ */ new Set();
3302
+ const filteredListeners = [...listeners].filter((value) => isDefined(value.filter) ? filterMatch(eventArgs, value.filter) : true).map((info) => info.listener);
3303
+ const anyListeners = assertEx(_Events.anyMap.get(this));
3304
+ const staticListeners = [...filteredListeners];
3305
+ const staticAnyListeners = [...anyListeners];
3306
+ await resolvedPromise;
3307
+ for (const listener of staticListeners) {
3308
+ await this.safeCallListener(eventName, eventArgs, listener);
3309
+ }
3310
+ for (const listener of staticAnyListeners) {
3311
+ await this.safeCallAnyListener(eventName, eventArgs, listener);
3312
+ }
3313
+ }
3314
+ /**
3315
+ * Returns the total number of listeners registered for the specified event name(s).
3316
+ * @param eventNames - One or more event names to count listeners for.
3317
+ * @returns The total listener count.
3318
+ */
3319
+ // TODO: Make test for this
3320
+ listenerCount(eventNames) {
3321
+ const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];
3322
+ let count = 0;
3323
+ for (const eventName of eventNamesArray) {
3324
+ if (typeof eventName === "string") {
3325
+ count += assertEx(_Events.anyMap.get(this)).size + (this.getListeners(eventName)?.size ?? 0);
3326
+ continue;
3327
+ }
3328
+ count += assertEx(_Events.anyMap.get(this)).size;
3329
+ const eventListeners = assertEx(_Events.eventsMap.get(this)).values();
3330
+ for (const value of eventListeners) {
3331
+ count += value.size;
3332
+ }
3333
+ }
3334
+ return count;
3335
+ }
3336
+ /**
3337
+ * Logs debug information if debug mode is enabled.
3338
+ * @param type - The type of operation being logged.
3339
+ * @param eventName - The event name, if applicable.
3340
+ * @param eventArgs - The event data, if applicable.
3341
+ */
3342
+ logIfDebugEnabled(type, eventName, eventArgs) {
3343
+ if (_Events.isDebugEnabled || this.debug?.enabled === true) {
3344
+ this.debug?.logger?.(type, this.debug.name, eventName, eventArgs);
3345
+ }
3346
+ }
3347
+ /**
3348
+ * Removes a specific listener from the specified event name(s).
3349
+ * @param eventNames - One or more event names to unsubscribe from.
3350
+ * @param listener - The listener to remove.
3351
+ */
3352
+ off(eventNames, listener) {
3353
+ const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];
3354
+ for (const eventName of eventNamesArray) {
3355
+ const set = this.getListeners(eventName);
3356
+ if (set) {
3357
+ set.delete(listener);
3358
+ if (set.size === 0) {
3359
+ const events = _Events.eventsMap.get(this);
3360
+ events?.delete(eventName);
3361
+ }
3362
+ }
3363
+ this.logIfDebugEnabled("unsubscribe", eventName);
3364
+ if (!isMetaEvent(eventName)) {
3365
+ forgetNode(this.emitMetaEvent("listenerRemoved", { eventName, listener }));
3366
+ }
3367
+ }
3368
+ }
3369
+ /**
3370
+ * Removes a wildcard listener that was receiving all events.
3371
+ * @param listener - The wildcard listener to remove.
3372
+ */
3373
+ offAny(listener) {
3374
+ this.logIfDebugEnabled("unsubscribeAny");
3375
+ const typedMap = _Events.anyMap.get(this);
3376
+ typedMap?.delete(listener);
3377
+ forgetNode(this.emitMetaEvent("listenerRemoved", { listener }));
3378
+ }
3379
+ /**
3380
+ * Subscribes a listener to the specified event name(s).
3381
+ * @param eventNames - One or more event names to listen for.
3382
+ * @param listener - The callback to invoke when the event fires.
3383
+ * @param filter - Optional filter to selectively invoke the listener based on event data.
3384
+ * @returns An unsubscribe function.
3385
+ */
3386
+ on(eventNames, listener, filter) {
3387
+ const eventNamesArray = Array.isArray(eventNames) ? eventNames : [eventNames];
3388
+ for (const eventName of eventNamesArray) {
3389
+ let set = this.getListeners(eventName);
3390
+ if (!set) {
3391
+ set = /* @__PURE__ */ new Set();
3392
+ const events = _Events.eventsMap.get(this);
3393
+ events?.set(eventName, set);
3394
+ }
3395
+ set.add({ filter, listener });
3396
+ this.logIfDebugEnabled("subscribe", eventName);
3397
+ if (!isMetaEvent(eventName)) {
3398
+ forgetNode(this.emitMetaEvent("listenerAdded", { eventName, listener }));
3399
+ }
3400
+ }
3401
+ return this.off.bind(this, eventNames, listener);
3402
+ }
3403
+ /**
3404
+ * Subscribes a wildcard listener that receives all events.
3405
+ * @param listener - The callback to invoke for any event.
3406
+ * @returns An unsubscribe function.
3407
+ */
3408
+ onAny(listener) {
3409
+ this.logIfDebugEnabled("subscribeAny");
3410
+ _Events.anyMap.get(this)?.add(listener);
3411
+ forgetNode(this.emitMetaEvent("listenerAdded", { listener }));
3412
+ return this.offAny.bind(this, listener);
3413
+ }
3414
+ /**
3415
+ * Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
3416
+ * @param eventName - The event to listen for.
3417
+ * @param listener - The callback to invoke once.
3418
+ * @returns An unsubscribe function.
3419
+ */
3420
+ once(eventName, listener) {
3421
+ const subListener = async (args) => {
3422
+ this.off(eventName, subListener);
3423
+ await this.safeCallListener(eventName, args, listener);
3424
+ };
3425
+ this.on(eventName, subListener);
3426
+ return this.off.bind(this, eventName, subListener);
3427
+ }
3428
+ async emitInternal(eventName, eventArgs, filter) {
3429
+ if (isMetaEvent(eventName) && !this._canEmitMetaEvents) {
3430
+ throw new TypeError(NO_META_EVENT_ERROR_MESSAGE);
3431
+ }
3432
+ this.logIfDebugEnabled("emit", eventName, eventArgs);
3433
+ const listeners = this.getListeners(eventName) ?? /* @__PURE__ */ new Set();
3434
+ const filteredListeners = [...listeners].filter((value) => isDefined(filter) ? isDefined(value.listener) : true).map((info) => info.listener);
3435
+ const anyListeners = assertEx(_Events.anyMap.get(this));
3436
+ const staticListeners = [...filteredListeners];
3437
+ const staticAnyListeners = isMetaEvent(eventName) ? [] : [...anyListeners];
3438
+ await resolvedPromise;
3439
+ await Promise.all([
3440
+ ...staticListeners.map(async (listener) => {
3441
+ await this.safeCallListener(eventName, eventArgs, listener);
3442
+ }),
3443
+ ...staticAnyListeners.map(async (listener) => {
3444
+ if (anyListeners.has(listener)) {
3445
+ await this.safeCallAnyListener(eventName, eventArgs, listener);
3446
+ }
3447
+ })
3448
+ ]);
3449
+ }
3450
+ async emitMetaEventInternal(eventName, eventArgs) {
3451
+ if (isMetaEvent(eventName) && !this._canEmitMetaEvents) {
3452
+ throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");
3453
+ }
3454
+ this.logIfDebugEnabled("emit", eventName, eventArgs);
3455
+ const listeners = this.getListeners(eventName) ?? /* @__PURE__ */ new Set();
3456
+ const filteredListeners = [...listeners].map((info) => info.listener);
3457
+ const anyListeners = assertEx(_Events.anyMap.get(this));
3458
+ const staticListeners = [...filteredListeners];
3459
+ const staticAnyListeners = isMetaEvent(eventName) ? [] : [...anyListeners];
3460
+ await resolvedPromise;
3461
+ await Promise.all([
3462
+ ...staticListeners.map(async (listener) => {
3463
+ await this.safeCallListener(eventName, eventArgs, listener);
3464
+ }),
3465
+ /* v8 ignore start -- race condition guard */
3466
+ ...staticAnyListeners.map(async (listener) => {
3467
+ if (anyListeners.has(listener)) {
3468
+ await this.safeCallAnyListener(eventName, eventArgs, listener);
3469
+ }
3470
+ })
3471
+ /* v8 ignore stop */
3472
+ ]);
3473
+ return true;
3474
+ }
3475
+ getListeners(eventName) {
3476
+ const events = assertEx(_Events.eventsMap.get(this));
3477
+ if (!events.has(eventName)) {
3478
+ return;
3479
+ }
3480
+ return events.get(eventName);
3481
+ }
3482
+ async safeCallAnyListener(eventName, eventArgs, listener) {
3483
+ try {
3484
+ return await listener(eventName, eventArgs);
3485
+ } catch (ex) {
3486
+ handleError(ex, (error) => {
3487
+ this.logger?.error(`Listener[${String(eventName)}] Excepted: ${error.message}`);
3488
+ });
3489
+ }
3490
+ }
3491
+ async safeCallListener(eventName, eventArgs, listener) {
3492
+ try {
3493
+ return await listener(eventArgs);
3494
+ } catch (ex) {
3495
+ handleError(ex, (error) => {
3496
+ this.logger?.error(`Listener[${String(eventName)}] Excepted: ${error.message}`);
3497
+ });
3498
+ }
3499
+ }
3500
+ };
3501
+ var BaseEmitter = class extends Base {
3502
+ // just here to query types
3503
+ eventData = {};
3504
+ events;
3505
+ constructor(params) {
3506
+ super(params);
3507
+ this.events = new Events();
3508
+ }
3509
+ /**
3510
+ * Removes all listeners for the specified event name(s).
3511
+ * @param eventNames - One or more event names to clear listeners for.
3512
+ * @returns This instance for chaining.
3513
+ */
3514
+ clearListeners(eventNames) {
3515
+ this.events.clearListeners(eventNames);
3516
+ return this;
3517
+ }
3518
+ /**
3519
+ * Emits an event, invoking all registered listeners concurrently.
3520
+ * @param eventName - The event to emit.
3521
+ * @param eventArgs - The data to pass to listeners.
3522
+ */
3523
+ emit(eventName, eventArgs) {
3524
+ return this.events.emit(eventName, eventArgs);
3525
+ }
3526
+ /**
3527
+ * Emits an event, invoking all registered listeners sequentially in order.
3528
+ * @param eventName - The event to emit.
3529
+ * @param eventArgs - The data to pass to listeners.
3530
+ */
3531
+ emitSerial(eventName, eventArgs) {
3532
+ return this.events.emitSerial(eventName, eventArgs);
3533
+ }
3534
+ /**
3535
+ * Returns the total number of listeners registered for the specified event name(s).
3536
+ * @param eventNames - One or more event names to count listeners for.
3537
+ * @returns The total listener count.
3538
+ */
3539
+ listenerCount(eventNames) {
3540
+ return this.events.listenerCount(eventNames);
3541
+ }
3542
+ /**
3543
+ * Removes a specific listener from the specified event name(s).
3544
+ * @param eventNames - One or more event names to unsubscribe from.
3545
+ * @param listener - The listener to remove.
3546
+ */
3547
+ off(eventNames, listener) {
3548
+ return this.events.off(eventNames, listener);
3549
+ }
3550
+ /**
3551
+ * Removes a wildcard listener that was receiving all events.
3552
+ * @param listener - The wildcard listener to remove.
3553
+ */
3554
+ offAny(listener) {
3555
+ return this.events.offAny(listener);
3556
+ }
3557
+ /**
3558
+ * Subscribes a listener to the specified event name(s).
3559
+ * @param eventNames - One or more event names to listen for.
3560
+ * @param listener - The callback to invoke when the event fires.
3561
+ * @returns An unsubscribe function.
3562
+ */
3563
+ on(eventNames, listener) {
3564
+ return this.events.on(eventNames, listener);
3565
+ }
3566
+ /**
3567
+ * Subscribes a wildcard listener that receives all events.
3568
+ * @param listener - The callback to invoke for any event.
3569
+ * @returns An unsubscribe function.
3570
+ */
3571
+ onAny(listener) {
3572
+ return this.events.onAny(listener);
3573
+ }
3574
+ /**
3575
+ * Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
3576
+ * @param eventName - The event to listen for.
3577
+ * @param listener - The callback to invoke once.
3578
+ * @returns An unsubscribe function.
3579
+ */
3580
+ once(eventName, listener) {
3581
+ return this.events.once(eventName, listener);
3582
+ }
3583
+ };
3584
+ async function timeBudget(name, logger, func, budget, status = false) {
3585
+ const start = Date.now();
3586
+ const timer = status ? setInterval(() => {
3587
+ const duration22 = Date.now() - start;
3588
+ if (budget > 0 && duration22 > budget) {
3589
+ logger?.warn(`Function [${name}] execution is exceeding budget: ${duration22}ms > ${budget}ms`);
3590
+ }
3591
+ }, Math.max(100, budget)) : void 0;
3592
+ const result = await func();
3593
+ const duration2 = Date.now() - start;
3594
+ if (timer === void 0 && budget > 0 && duration2 > budget) {
3595
+ logger?.warn(`Function [${name}] execution exceeded budget: ${duration2}ms > ${budget}ms`);
3596
+ }
3597
+ if (timer !== void 0) {
3598
+ clearInterval(timer);
3599
+ }
3600
+ return result;
3601
+ }
3602
+ function cloneContextWithoutSpan(activeCtx, configKeys = []) {
3603
+ let newCtx = ROOT_CONTEXT;
3604
+ const baggage = propagation.getBaggage(activeCtx);
3605
+ if (baggage) {
3606
+ newCtx = propagation.setBaggage(newCtx, baggage);
3607
+ }
3608
+ for (const key of configKeys) {
3609
+ const value = activeCtx.getValue(key);
3610
+ if (value !== void 0) {
3611
+ newCtx = newCtx.setValue(key, value);
3612
+ }
3613
+ }
3614
+ return newCtx;
3615
+ }
3616
+ function spanRoot(name, fn, tracer) {
3617
+ const activeTracer = tracer ?? trace.getTracer(name);
3618
+ if (isDefined(activeTracer)) {
3619
+ const activeContext = context.active();
3620
+ const noSpanContext = cloneContextWithoutSpan(activeContext);
3621
+ const span2 = activeTracer.startSpan(name, {}, noSpanContext);
3622
+ return context.with(trace.setSpan(noSpanContext, span2), () => {
3623
+ try {
3624
+ const result = fn();
3625
+ span2.setStatus({ code: SpanStatusCode.OK });
3626
+ return result;
3627
+ } catch (ex) {
3628
+ const error = ex;
3629
+ span2.recordException(error);
3630
+ span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
3631
+ throw ex;
3632
+ } finally {
3633
+ span2.end();
961
3634
  }
962
- if (typeof value === "string") {
963
- return value.startsWith("0x") ? value.slice(2) : value;
3635
+ });
3636
+ }
3637
+ return fn();
3638
+ }
3639
+ async function spanRootAsync(name, fn, {
3640
+ timeBudgetLimit,
3641
+ logger,
3642
+ tracer
3643
+ } = {}) {
3644
+ const funcToRun = isDefined(timeBudgetLimit) ? () => timeBudget(name, logger ?? console, fn, timeBudgetLimit) : fn;
3645
+ const activeTracer = tracer ?? trace.getTracer(name);
3646
+ if (isDefined(activeTracer)) {
3647
+ const activeContext = context.active();
3648
+ const noSpanContext = cloneContextWithoutSpan(activeContext);
3649
+ const span2 = activeTracer.startSpan(name, {}, noSpanContext);
3650
+ return await context.with(trace.setSpan(noSpanContext, span2), async () => {
3651
+ try {
3652
+ const result = await funcToRun();
3653
+ span2.setStatus({ code: SpanStatusCode.OK });
3654
+ return result;
3655
+ } catch (ex) {
3656
+ const error = ex;
3657
+ span2.recordException(error);
3658
+ span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
3659
+ throw ex;
3660
+ } finally {
3661
+ span2.end();
964
3662
  }
965
- return BigInt(value).toString(16).padStart(ADDRESS_LENGTH, "0");
966
- })
967
- ).check(refine((x) => AddressValidationZod.safeParse(x).success)),
968
- transform((x) => x)
969
- );
970
- var EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20);
971
- var EthAddressToStringZod = string2().check(_regex(EthAddressRegEx));
972
- var EthAddressFromStringZod = pipe(
973
- string2().check(_regex(EthAddressRegEx)),
974
- transform((v) => toEthAddress(v))
975
- );
976
- var toEthAddress = (value, config2 = {}) => {
977
- const { bitLength = 160, prefix: isPrefix = false } = config2;
978
- return `0x${hexFrom(value, {
979
- bitLength,
980
- prefix: isPrefix,
981
- ...config2
982
- })}`;
3663
+ });
3664
+ }
3665
+ return await funcToRun();
3666
+ }
3667
+ function creatable() {
3668
+ return (constructor) => {
3669
+ constructor;
3670
+ };
3671
+ }
3672
+ var Factory = class _Factory {
3673
+ /** The Creatable class this factory delegates creation to. */
3674
+ creatable;
3675
+ /** Default parameters merged into every `create` call. */
3676
+ defaultParams;
3677
+ /** Labels identifying resources created by this factory. */
3678
+ labels;
3679
+ constructor(creatable2, params, labels = {}) {
3680
+ this.creatable = creatable2;
3681
+ this.defaultParams = params;
3682
+ this.labels = Object.assign({}, creatable2.labels ?? {}, labels ?? {});
3683
+ }
3684
+ /**
3685
+ * Creates a new Factory instance with the given default params and labels.
3686
+ * @param creatableModule - The Creatable class to wrap
3687
+ * @param params - Default parameters for new instances
3688
+ * @param labels - Labels to assign to created instances
3689
+ */
3690
+ static withParams(creatableModule, params, labels = {}) {
3691
+ return new _Factory(creatableModule, params, labels);
3692
+ }
3693
+ /**
3694
+ * Creates a new instance, merging the provided params over the factory defaults.
3695
+ * @param params - Optional parameters to override the factory defaults
3696
+ */
3697
+ create(params) {
3698
+ const mergedParams = {
3699
+ ...this.defaultParams,
3700
+ ...params
3701
+ };
3702
+ return this.creatable.create(mergedParams);
3703
+ }
983
3704
  };
984
- var isEthAddress = (value, config2 = {}) => {
985
- const { bitLength = 160, prefix: isPrefix = true } = config2;
986
- const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
987
- return isHex(loweredValue, { bitLength, prefix: isPrefix });
3705
+ function getFunctionName(depth = 2) {
3706
+ const error = new Error("Stack");
3707
+ let newIndex;
3708
+ const stackParts = error.stack?.split("\n")[depth]?.split(" ");
3709
+ const funcName = stackParts?.find((item, index) => {
3710
+ if (!(item.length > 0 && item !== "at")) {
3711
+ return;
3712
+ }
3713
+ if (item === "new") {
3714
+ newIndex = index;
3715
+ }
3716
+ return true;
3717
+ }) ?? "<unknown>";
3718
+ return isNumber(newIndex) ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
3719
+ }
3720
+ var getPrototype = (value) => {
3721
+ const prototype = Object.getPrototypeOf(value);
3722
+ return typeof prototype === "object" ? prototype : null;
988
3723
  };
989
- var EthAddressZod = string2().check(
990
- _regex(EthAddressRegEx, { error: "Invalid address format" }),
991
- refine(isEthAddress)
992
- );
993
- var isHash = (value, bitLength = 256) => {
994
- return isHex(value, { bitLength });
3724
+ function getRootFunction(obj, funcName) {
3725
+ if (obj === null || typeof obj !== "object") return void 0;
3726
+ let current = obj;
3727
+ let prototype = getPrototype(current);
3728
+ while (prototype !== null && prototype[funcName] !== void 0) {
3729
+ current = prototype;
3730
+ prototype = getPrototype(current);
3731
+ }
3732
+ return current[funcName];
3733
+ }
3734
+ var AbstractCreatableConstructorKey = /* @__PURE__ */ Symbol.for("AbstractCreatableConstructor");
3735
+ var CREATABLE_NOT_STARTED = "Creatable not Started";
3736
+ var AbstractCreatable = class extends BaseEmitter {
3737
+ /** Optional default logger for this instance. */
3738
+ defaultLogger;
3739
+ _startPromise;
3740
+ _status = null;
3741
+ _statusMutex = new Mutex();
3742
+ _validatedParams;
3743
+ constructor(key, params) {
3744
+ assertEx(key === AbstractCreatableConstructorKey, () => "AbstractCreatable should not be instantiated directly, use the static create method instead");
3745
+ super(params);
3746
+ }
3747
+ /** The name identifier for this creatable instance. */
3748
+ get name() {
3749
+ return this.params.name;
3750
+ }
3751
+ /** The validated and merged parameters for this instance. */
3752
+ get params() {
3753
+ this._validatedParams ??= this.paramsValidator(super.params);
3754
+ return this._validatedParams;
3755
+ }
3756
+ /** Whether this instance can be started (must be in 'created' or 'stopped' status). */
3757
+ get startable() {
3758
+ return this.status === "created" || this.status === "stopped";
3759
+ }
3760
+ /** The current lifecycle status of this instance, or null if not yet initialized. */
3761
+ get status() {
3762
+ return this._status;
3763
+ }
3764
+ /** The status reporter used to broadcast lifecycle changes. */
3765
+ get statusReporter() {
3766
+ return this.params.statusReporter;
3767
+ }
3768
+ /**
3769
+ * Asynchronously creates a new instance by processing params, constructing,
3770
+ * and running both static and instance createHandlers.
3771
+ * @param inParams - Optional partial parameters to configure the instance
3772
+ * @returns The fully initialized instance
3773
+ */
3774
+ static async create(inParams = {}) {
3775
+ const params = await this.paramsHandler(inParams);
3776
+ const name = params.name ?? this.name;
3777
+ try {
3778
+ const [Constructor] = [this];
3779
+ const instance = new Constructor(AbstractCreatableConstructorKey, params);
3780
+ instance.setStatus("creating");
3781
+ const initializedInstance = await this.createHandler(instance);
3782
+ await instance.createHandler();
3783
+ instance.setStatus("created");
3784
+ return initializedInstance;
3785
+ } catch (ex) {
3786
+ params.statusReporter?.report(name, "error", isError(ex) ? ex : new Error(`Error creating: ${name}`));
3787
+ params.logger?.error(`Error creating creatable [${name}]: ${isError(ex) ? `${ex.message} ${ex.stack}` : String(ex)}`);
3788
+ throw isError(ex) ? ex : new Error(`Error creating: ${name}`);
3789
+ }
3790
+ }
3791
+ /**
3792
+ * Static hook called during creation to perform additional initialization.
3793
+ * Override in subclasses to customize post-construction setup.
3794
+ * @param instance - The newly constructed instance
3795
+ * @returns The instance, potentially modified
3796
+ */
3797
+ static createHandler(instance) {
3798
+ return instance;
3799
+ }
3800
+ /**
3801
+ * Static hook called during creation to validate and transform params.
3802
+ * Override in subclasses to add default values or validation.
3803
+ * @param params - The raw partial params provided to `create`
3804
+ * @returns The processed params ready for construction
3805
+ */
3806
+ static paramsHandler(params = {}) {
3807
+ return { ...params };
3808
+ }
3809
+ /** Instance-level creation hook. Override in subclasses to perform setup after construction. */
3810
+ createHandler() {
3811
+ assertEx(this._status === "creating", () => `createHandler can not be called [status = ${this.status}]`);
3812
+ }
3813
+ /**
3814
+ * Validates and returns the merged params, ensuring required fields are present.
3815
+ * Override in subclasses to add custom validation logic.
3816
+ * @param params - The raw partial params to validate
3817
+ * @returns The validated params
3818
+ */
3819
+ paramsValidator(params) {
3820
+ return { ...params, name: params.name };
3821
+ }
3822
+ /**
3823
+ * Executes a function within a telemetry span.
3824
+ * @param name - The span name
3825
+ * @param fn - The function to execute within the span
3826
+ */
3827
+ span(name, fn) {
3828
+ return spanRoot(name, fn, this.tracer);
3829
+ }
3830
+ /**
3831
+ * Executes an async function within a telemetry span.
3832
+ * @param name - The span name
3833
+ * @param fn - The async function to execute within the span
3834
+ * @param config - Optional span configuration
3835
+ */
3836
+ async spanAsync(name, fn, config2 = {}) {
3837
+ return await spanRootAsync(name, fn, {
3838
+ ...config2,
3839
+ tracer: config2.tracer ?? this.tracer,
3840
+ logger: config2.logger ?? this.defaultLogger
3841
+ });
3842
+ }
3843
+ /**
3844
+ * Starts the instance, transitioning through 'starting' to 'started' status.
3845
+ * Thread-safe via mutex. Returns true if already started or started successfully.
3846
+ */
3847
+ async start() {
3848
+ this._noOverride("start");
3849
+ if (this.status === "started") {
3850
+ return true;
3851
+ }
3852
+ return await this._statusMutex.runExclusive(async () => {
3853
+ try {
3854
+ if (this.status === "started") {
3855
+ return true;
3856
+ }
3857
+ assertEx(this.startable, () => `Creatable [${this.name}] is not startable in status [${this.status}]`);
3858
+ this.setStatus("starting");
3859
+ await this.startHandler();
3860
+ this.setStatus("started");
3861
+ return true;
3862
+ } catch (ex) {
3863
+ this.setStatus("error", isError(ex) ? ex : new Error(`Error starting: ${String(ex)}`));
3864
+ this.logger?.error(`Error starting creatable [${this.name}]: ${isError(ex) ? `${ex.message} ${ex.stack}` : String(ex)}`);
3865
+ return false;
3866
+ }
3867
+ });
3868
+ }
3869
+ /**
3870
+ * Checks whether this instance is currently started.
3871
+ * Takes an action if not started, based on the notStartedAction parameter.
3872
+ * @param notStartedAction - What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
3873
+ * @returns True if started, false otherwise
3874
+ */
3875
+ started(notStartedAction = "log") {
3876
+ if (isString(this.status) && this.status === "started") {
3877
+ return true;
3878
+ }
3879
+ const message = () => `${CREATABLE_NOT_STARTED} [${this.name}] current state: ${this.status}`;
3880
+ switch (notStartedAction) {
3881
+ case "error": {
3882
+ throw new Error(message());
3883
+ }
3884
+ case "throw": {
3885
+ throw new Error(message());
3886
+ }
3887
+ case "warn": {
3888
+ this.logger?.warn(message());
3889
+ break;
3890
+ }
3891
+ case "log": {
3892
+ this.logger?.log(message());
3893
+ break;
3894
+ }
3895
+ case "none": {
3896
+ break;
3897
+ }
3898
+ default: {
3899
+ throw new Error(`Unknown notStartedAction: ${notStartedAction}`);
3900
+ }
3901
+ }
3902
+ return false;
3903
+ }
3904
+ /**
3905
+ * Async version of `started` that can optionally auto-start the instance.
3906
+ * @param notStartedAction - What to do if not started and auto-start is disabled
3907
+ * @param tryStart - If true, attempts to start the instance automatically
3908
+ * @returns True if the instance is or becomes started
3909
+ */
3910
+ async startedAsync(notStartedAction = "log", tryStart = true) {
3911
+ if (isString(this.status) && this.status === "started") {
3912
+ return true;
3913
+ }
3914
+ if (this.status !== null && ["created", "stopped", "starting"].includes(this.status)) {
3915
+ this._startPromise ??= (async () => {
3916
+ if (tryStart) {
3917
+ try {
3918
+ return await this.start();
3919
+ } finally {
3920
+ this._startPromise = void 0;
3921
+ }
3922
+ }
3923
+ return this.started(notStartedAction);
3924
+ })();
3925
+ } else {
3926
+ const message = `${CREATABLE_NOT_STARTED} [${this.name}] current state: ${this.status}`;
3927
+ throw new Error(message);
3928
+ }
3929
+ if (isUndefined(this._startPromise)) {
3930
+ throw new Error(`Failed to create start promise: ${this.status}`);
3931
+ }
3932
+ return await this._startPromise;
3933
+ }
3934
+ /**
3935
+ * Stops the instance, transitioning through 'stopping' to 'stopped' status.
3936
+ * Thread-safe via mutex. Returns true if already stopped or stopped successfully.
3937
+ */
3938
+ async stop() {
3939
+ this._noOverride("stop");
3940
+ if (this.status === "stopped") {
3941
+ return true;
3942
+ }
3943
+ return await this._statusMutex.runExclusive(async () => {
3944
+ try {
3945
+ if (this.status === "stopped") {
3946
+ return true;
3947
+ }
3948
+ assertEx(this.status === "started", () => `Creatable [${this.name}] is not stoppable in status [${this.status}]`);
3949
+ this.setStatus("stopping");
3950
+ await this.stopHandler();
3951
+ this.setStatus("stopped");
3952
+ return true;
3953
+ } catch (ex) {
3954
+ this.setStatus("error", isError(ex) ? ex : new Error(`Error stopping: ${String(ex)}`));
3955
+ return false;
3956
+ }
3957
+ });
3958
+ }
3959
+ /**
3960
+ * Asserts that the given function has not been overridden in a subclass.
3961
+ * Used to enforce the handler pattern (override `startHandler` not `start`).
3962
+ */
3963
+ _noOverride(functionName2 = getFunctionName(3)) {
3964
+ const thisFunc = this[functionName2];
3965
+ const rootFunc = getRootFunction(this, functionName2);
3966
+ assertEx(thisFunc === rootFunc, () => `Override not allowed for [${functionName2}] - override ${functionName2}Handler instead`);
3967
+ }
3968
+ setStatus(value, progressOrError) {
3969
+ this._status = value;
3970
+ if (value !== null) {
3971
+ if (value === "error") {
3972
+ if (isError(progressOrError)) {
3973
+ this.statusReporter?.report(this.name, value, progressOrError);
3974
+ return;
3975
+ }
3976
+ } else {
3977
+ if (isNumber(progressOrError)) {
3978
+ this.statusReporter?.report(this.name, value, progressOrError);
3979
+ return;
3980
+ }
3981
+ }
3982
+ this.statusReporter?.report(this.name, value);
3983
+ }
3984
+ }
3985
+ /** Override in subclasses to define start behavior. Throw an error on failure. */
3986
+ startHandler() {
3987
+ }
3988
+ /** Override in subclasses to define stop behavior. Throw an error on failure. */
3989
+ stopHandler() {
3990
+ }
995
3991
  };
996
- function asHash(value, assert) {
997
- switch (typeof value) {
998
- case "string": {
999
- const stringValue = hexFromHexString(value);
1000
- return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`);
3992
+ AbstractCreatable = __decorateClass([
3993
+ creatable()
3994
+ ], AbstractCreatable);
3995
+ var AbstractCreatableWithFactory = class extends AbstractCreatable {
3996
+ /**
3997
+ * Creates a factory that produces instances of this class with pre-configured params and labels.
3998
+ * @param params - Default parameters for instances created by the factory
3999
+ * @param labels - Labels to assign to created instances
4000
+ */
4001
+ static factory(params, labels) {
4002
+ return Factory.withParams(this, params, labels);
4003
+ }
4004
+ };
4005
+ AbstractCreatableWithFactory = __decorateClass([
4006
+ creatable()
4007
+ ], AbstractCreatableWithFactory);
4008
+ var LogLevel = Enum({
4009
+ error: 1,
4010
+ warn: 2,
4011
+ info: 3,
4012
+ log: 4,
4013
+ debug: 5,
4014
+ trace: 6
4015
+ });
4016
+ var AsTypeFactory = {
4017
+ create: (typeCheck) => {
4018
+ const func = (value, assertOrConfig, config2) => {
4019
+ const isPredicate = typeof assertOrConfig === "number";
4020
+ const resolvedAssert = isPredicate || typeof assertOrConfig === "object" ? void 0 : assertOrConfig;
4021
+ const resolvedConfig = isPredicate ? void 0 : typeof assertOrConfig === "object" ? assertOrConfig : config2;
4022
+ const isRequired = isTruthy(resolvedConfig?.required);
4023
+ if (!isRequired && (value === void 0 || value === null)) {
4024
+ return void 0;
4025
+ }
4026
+ if (isPromise(value)) {
4027
+ throw new TypeError('un-awaited promises may not be sent to "as" functions');
4028
+ }
4029
+ const result = typeCheck(value, resolvedConfig) ? value : void 0;
4030
+ if (resolvedAssert !== void 0) {
4031
+ const message = typeof resolvedAssert === "function" ? resolvedAssert : () => resolvedAssert;
4032
+ return assertDefinedEx(result, message);
4033
+ }
4034
+ return result;
4035
+ };
4036
+ return func;
4037
+ },
4038
+ createOptional: (typeCheck) => {
4039
+ const func = (value) => {
4040
+ if (value === void 0 || value === null) return void 0;
4041
+ if (isPromise(value)) {
4042
+ throw new TypeError('un-awaited promises may not be sent to "as" functions');
4043
+ }
4044
+ return typeCheck(value) ? value : void 0;
4045
+ };
4046
+ return func;
4047
+ }
4048
+ };
4049
+ var AsObjectFactory = {
4050
+ create: (typeCheck) => {
4051
+ return AsTypeFactory.create(typeCheck);
4052
+ },
4053
+ createOptional: (typeCheck) => {
4054
+ return AsTypeFactory.createOptional(typeCheck);
4055
+ }
4056
+ };
4057
+ var asAnyObject = (() => AsObjectFactory.create((obj) => isObject2(obj)))();
4058
+ var isUnsafeKey = (key) => typeof key === "string" && ["__proto__", "constructor", "prototype"].includes(key);
4059
+ var isPlainObject2 = (value) => {
4060
+ const prototype = Object.getPrototypeOf(value);
4061
+ return prototype === Object.prototype || prototype === null;
4062
+ };
4063
+ function merge(target, source, options) {
4064
+ if (!source || typeof source !== "object") return target;
4065
+ for (const key of Reflect.ownKeys(source)) {
4066
+ if (isUnsafeKey(key)) {
4067
+ continue;
1001
4068
  }
1002
- default: {
1003
- return isUndefined(assert) ? void 0 : assertError(value, assert, `Unsupported type [${typeof value}]`);
4069
+ const value = source[key];
4070
+ if (Array.isArray(value)) {
4071
+ const targetValue = target[key];
4072
+ target[key] = options?.arrayStrategy === "concat" && Array.isArray(targetValue) ? [...targetValue, ...value] : value;
4073
+ } else if (value !== null && typeof value === "object" && isPlainObject2(value)) {
4074
+ const targetValue = target[key];
4075
+ if (targetValue === void 0 || targetValue === null || typeof targetValue !== "object" || !isPlainObject2(targetValue)) {
4076
+ target[key] = {};
4077
+ }
4078
+ merge(target[key], value, options);
4079
+ } else {
4080
+ target[key] = value;
1004
4081
  }
1005
4082
  }
4083
+ return target;
1006
4084
  }
1007
- var HASH_LENGTH = 32;
1008
- var HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH);
1009
- var HashZod = pipe(
1010
- string2().check(_regex(HashRegEx, { error: "Invalid hex format" })),
1011
- transform((val) => val)
1012
- );
1013
- var HashToJsonZod = pipe(HashZod, transform((v) => v));
1014
- var JsonToHashZod = pipe(string2(), transform((v) => asHash(v, true)));
1015
- function hexToBigInt(hex) {
1016
- return BigInt(hexFromHexString(hex, { prefix: true }));
4085
+ function createDeepMerge(options) {
4086
+ return function deepMerge2(...objects) {
4087
+ const result = options.mutate === true ? objects[0] ?? {} : {};
4088
+ for (const obj of objects) {
4089
+ merge(result, obj, options);
4090
+ }
4091
+ return result;
4092
+ };
1017
4093
  }
1018
- var BigIntToJsonZod = pipe(
1019
- bigint2().check(_nonnegative()),
1020
- transform((x) => toHex(x))
1021
- );
1022
- var JsonToBigIntZod = pipe(
4094
+ var deepMerge = createDeepMerge({ arrayStrategy: "overwrite", mutate: false });
4095
+ var formatZodValue = (value) => {
4096
+ const json = JSON.stringify(value);
4097
+ return json ?? String(value);
4098
+ };
4099
+ function zodAsFactory(zod, name) {
4100
+ function asFunc(value, assert) {
4101
+ const result = safeParse(zod, value);
4102
+ if (result.success) {
4103
+ return value;
4104
+ }
4105
+ if (assert !== void 0) {
4106
+ let assertConfig;
4107
+ switch (typeof assert) {
4108
+ case "string": {
4109
+ assertConfig = `[${name}][${formatZodValue(value)}] ${assert}`;
4110
+ break;
4111
+ }
4112
+ case "object": {
4113
+ assertConfig = `[${name}][${assert.name}][${formatZodValue(value)}] ${result.error.message}`;
4114
+ break;
4115
+ }
4116
+ case "boolean": {
4117
+ assertConfig = `[${name}][${formatZodValue(value)}] ${result.error.message}`;
4118
+ break;
4119
+ }
4120
+ case "function": {
4121
+ assertConfig = assert(value, result.error.message);
4122
+ break;
4123
+ }
4124
+ }
4125
+ return assertError(value, assertConfig, result.error.message);
4126
+ }
4127
+ }
4128
+ return asFunc;
4129
+ }
4130
+ function zodIsFactory(zod) {
4131
+ return (value) => safeParse(zod, value).success;
4132
+ }
4133
+ function zodToFactory(zod, name) {
4134
+ const as = zodAsFactory(zod, name);
4135
+ function toFunc(value, assert) {
4136
+ if (isDefined(assert)) {
4137
+ return as(value, assert);
4138
+ }
4139
+ return as(value);
4140
+ }
4141
+ return toFunc;
4142
+ }
4143
+ var JsonArrayZod = array(_lazy(() => JsonValueZod));
4144
+ var JsonValueZod = _lazy(() => union([
1023
4145
  string2(),
1024
- transform((x) => hexToBigInt(toHex(x)))
1025
- );
4146
+ number2(),
4147
+ boolean2(),
4148
+ _null3(),
4149
+ array(JsonValueZod),
4150
+ record(string2(), JsonValueZod)
4151
+ // object with string keys and JSON values
4152
+ ]));
4153
+ var JsonObjectZod = record(string2(), JsonValueZod);
4154
+ var isJsonValue = zodIsFactory(JsonValueZod);
4155
+ var asJsonValue = zodAsFactory(JsonValueZod, "asJsonValue");
4156
+ var toJsonValue = zodToFactory(JsonValueZod, "toJsonValue");
4157
+ var isJsonArray = zodIsFactory(JsonArrayZod);
4158
+ var asJsonArray = zodAsFactory(JsonArrayZod, "asJsonArray");
4159
+ var toJsonArray = zodToFactory(JsonArrayZod, "toJsonArray");
4160
+ var isJsonObject = zodIsFactory(JsonObjectZod);
4161
+ var asJsonObject = zodAsFactory(JsonObjectZod, "asJsonObject");
4162
+ var toJsonObject = zodToFactory(JsonObjectZod, "toJsonObject");
4163
+ var color = (open, close = 39) => {
4164
+ return (value) => `\x1B[${open}m${value}\x1B[${close}m`;
4165
+ };
4166
+ var logColors = {
4167
+ green: color(32),
4168
+ grey: color(90),
4169
+ magenta: color(35),
4170
+ red: color(31),
4171
+ white: color(37),
4172
+ yellow: color(33)
4173
+ };
4174
+ function spanDurationInMillis(span2) {
4175
+ return span2.duration[0] * 1e3 + span2.duration[1] / 1e6;
4176
+ }
4177
+ var XyConsoleSpanExporter = class _XyConsoleSpanExporter extends ConsoleSpanExporter {
4178
+ /** Duration thresholds (in ms) that map to increasing log levels. */
4179
+ static durationToLogLevel = [
4180
+ 0,
4181
+ 1,
4182
+ 10,
4183
+ 100,
4184
+ 1e3
4185
+ ];
4186
+ /** Chalk color functions corresponding to each log level. */
4187
+ static logLevelToChalkColor = [
4188
+ logColors.grey,
4189
+ logColors.white,
4190
+ logColors.green,
4191
+ logColors.yellow,
4192
+ logColors.red
4193
+ ];
4194
+ logger;
4195
+ _logLevel;
4196
+ constructor(logLevel = 0, logger = console) {
4197
+ super();
4198
+ this._logLevel = logLevel;
4199
+ this.logger = logger;
4200
+ }
4201
+ /** The minimum log level required for a span to be exported. */
4202
+ get logLevel() {
4203
+ return this._logLevel;
4204
+ }
4205
+ export(spans) {
4206
+ for (const span2 of spans) {
4207
+ const spanLevel = this.spanLevel(span2);
4208
+ if (spanLevel < this.logLevel) {
4209
+ continue;
4210
+ }
4211
+ const duration2 = spanDurationInMillis(span2);
4212
+ this.logger.log(logColors.grey([
4213
+ `Span [${span2.name}]`,
4214
+ this.logColor(spanLevel)(`${duration2}ms`),
4215
+ `TraceId: ${span2.spanContext().traceId}`
4216
+ ].join(", ")));
4217
+ }
4218
+ }
4219
+ /**
4220
+ * Returns the chalk color function for the given log level.
4221
+ * @param level - The log level index.
4222
+ * @returns A chalk color function.
4223
+ */
4224
+ logColor(level) {
4225
+ return _XyConsoleSpanExporter.logLevelToChalkColor[level] ?? logColors.magenta;
4226
+ }
4227
+ /**
4228
+ * Determines the log level of a span based on its duration.
4229
+ * @param span - The span to evaluate.
4230
+ * @returns The numeric log level (index into durationToLogLevel).
4231
+ */
4232
+ spanLevel(span2) {
4233
+ let logLevel = 0;
4234
+ const duration2 = spanDurationInMillis(span2);
4235
+ for (let x = _XyConsoleSpanExporter.durationToLogLevel.length - 1; x >= 0; x--) {
4236
+ if (duration2 > _XyConsoleSpanExporter.durationToLogLevel[x]) {
4237
+ logLevel = x;
4238
+ break;
4239
+ }
4240
+ }
4241
+ return logLevel;
4242
+ }
4243
+ };
1026
4244
 
1027
- // ../../../../../../node_modules/.pnpm/@xylabs+threads@7.0.4_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.8.0_@ope_2d1c7879bd64186a17682f1cb6bc1690/node_modules/@xylabs/threads/dist/browser/worker/worker.browser.mjs
4245
+ // ../../../../../../node_modules/.pnpm/@xylabs+threads@7.0.8_@opentelemetry+api@1.9.1_@opentelemetry+sdk-trace-base@2.9.0_@ope_a1685075a98125ef0b6f31620ba50469/node_modules/@xylabs/threads/dist/browser/worker/worker.browser.mjs
1028
4246
  var DefaultErrorSerializer = {
1029
4247
  deserialize: (message) => {
1030
4248
  const error = Object.create(Error.prototype);
@@ -1304,7 +4522,7 @@
1304
4522
  step((generator = generator.apply(thisArg, _arguments || [])).next());
1305
4523
  });
1306
4524
  }
1307
- var Mutex = class {
4525
+ var Mutex2 = class {
1308
4526
  constructor() {
1309
4527
  this.mutex = Promise.resolve();
1310
4528
  }
@@ -1328,7 +4546,7 @@
1328
4546
  }
1329
4547
  };
1330
4548
  var _a2;
1331
- function getGlobal() {
4549
+ function getGlobal2() {
1332
4550
  if (typeof globalThis !== "undefined")
1333
4551
  return globalThis;
1334
4552
  if (typeof self !== "undefined")
@@ -1337,7 +4555,7 @@
1337
4555
  return window;
1338
4556
  return global;
1339
4557
  }
1340
- var globalObject = getGlobal();
4558
+ var globalObject = getGlobal2();
1341
4559
  var nodeBuffer = (_a2 = globalObject.Buffer) !== null && _a2 !== void 0 ? _a2 : null;
1342
4560
  var textEncoder = globalObject.TextEncoder ? new globalObject.TextEncoder() : null;
1343
4561
  function hexCharCodesToInt(a, b) {
@@ -1432,7 +4650,7 @@
1432
4650
  }
1433
4651
  var MAX_HEAP = 16 * 1024;
1434
4652
  var WASM_FUNC_HASH_LENGTH = 4;
1435
- var wasmMutex = new Mutex();
4653
+ var wasmMutex = new Mutex2();
1436
4654
  var wasmModuleCache = /* @__PURE__ */ new Map();
1437
4655
  function WASMInterface(binary, hashLength) {
1438
4656
  return __awaiter(this, void 0, void 0, function* () {
@@ -1613,19 +4831,19 @@
1613
4831
  return wasm;
1614
4832
  });
1615
4833
  }
1616
- var mutex$l = new Mutex();
1617
- var mutex$k = new Mutex();
4834
+ var mutex$l = new Mutex2();
4835
+ var mutex$k = new Mutex2();
1618
4836
  var uint32View = new DataView(new ArrayBuffer(4));
1619
- var mutex$j = new Mutex();
1620
- var mutex$i = new Mutex();
1621
- var mutex$h = new Mutex();
1622
- var mutex$g = new Mutex();
4837
+ var mutex$j = new Mutex2();
4838
+ var mutex$i = new Mutex2();
4839
+ var mutex$h = new Mutex2();
4840
+ var mutex$g = new Mutex2();
1623
4841
  var polyBuffer = new Uint8Array(8);
1624
- var mutex$f = new Mutex();
1625
- var mutex$e = new Mutex();
1626
- var mutex$d = new Mutex();
1627
- var mutex$c = new Mutex();
1628
- var mutex$b = new Mutex();
4842
+ var mutex$f = new Mutex2();
4843
+ var mutex$e = new Mutex2();
4844
+ var mutex$d = new Mutex2();
4845
+ var mutex$c = new Mutex2();
4846
+ var mutex$b = new Mutex2();
1629
4847
  var name$a = "sha256";
1630
4848
  var data$a = "AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwgHAAEBAQIAAwUEAQECAgYOAn8BQfCJBQt/AEGACAsHcAgGbWVtb3J5AgAOSGFzaF9HZXRCdWZmZXIAAAlIYXNoX0luaXQAAQtIYXNoX1VwZGF0ZQACCkhhc2hfRmluYWwABA1IYXNoX0dldFN0YXRlAAUOSGFzaF9DYWxjdWxhdGUABgpTVEFURV9TSVpFAwEKnEoHBQBBgAkLnQEAQQBCADcDwIkBQQBBHEEgIABB4AFGIgAbNgLoiQFBAEKnn+anxvST/b5/Qquzj/yRo7Pw2wAgABs3A+CJAUEAQrGWgP6fooWs6ABC/6S5iMWR2oKbfyAAGzcD2IkBQQBCl7rDg5Onlod3QvLmu+Ojp/2npX8gABs3A9CJAUEAQti9loj8oLW+NkLnzKfQ1tDrs7t/IAAbNwPIiQEL7wICAX4Gf0EAQQApA8CJASIBIACtfDcDwIkBAkACQAJAIAGnQT9xIgINAEGACSEDDAELAkBBwAAgAmsiBCAAIAQgAEkbIgNFDQAgA0EDcSEFIAJBgIkBaiEGQQAhAgJAIANBBEkNACADQfwAcSEHQQAhAgNAIAYgAmoiAyACQYAJai0AADoAACADQQFqIAJBgQlqLQAAOgAAIANBAmogAkGCCWotAAA6AAAgA0EDaiACQYMJai0AADoAACAHIAJBBGoiAkcNAAsLIAVFDQADQCAGIAJqIAJBgAlqLQAAOgAAIAJBAWohAiAFQX9qIgUNAAsLIAAgBEkNAUGAiQEQAyAAIARrIQAgBEGACWohAwsCQCAAQcAASQ0AA0AgAxADIANBwABqIQMgAEFAaiIAQT9LDQALCyAARQ0AQQAhAkEAIQUDQCACQYCJAWogAyACai0AADoAACACQQFqIQIgACAFQQFqIgVB/wFxSw0ACwsLoz4BRX9BACAAKAI8IgFBGHQgAU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ash: hash$a
1636
4854
  };
1637
- var mutex$a = new Mutex();
1638
- var mutex$9 = new Mutex();
4855
+ var mutex$a = new Mutex2();
4856
+ var mutex$9 = new Mutex2();
1639
4857
  var wasmCache$9 = null;
1640
4858
  function sha256(data) {
1641
4859
  if (wasmCache$9 === null) {
@@ -1651,18 +4869,18 @@
1651
4869
  return Promise.reject(err);
1652
4870
  }
1653
4871
  }
1654
- var mutex$8 = new Mutex();
1655
- var mutex$7 = new Mutex();
1656
- var mutex$6 = new Mutex();
1657
- var mutex$5 = new Mutex();
4872
+ var mutex$8 = new Mutex2();
4873
+ var mutex$7 = new Mutex2();
4874
+ var mutex$6 = new Mutex2();
4875
+ var mutex$5 = new Mutex2();
1658
4876
  var seedBuffer$2 = new Uint8Array(8);
1659
- var mutex$4 = new Mutex();
4877
+ var mutex$4 = new Mutex2();
1660
4878
  var seedBuffer$1 = new Uint8Array(8);
1661
- var mutex$3 = new Mutex();
4879
+ var mutex$3 = new Mutex2();
1662
4880
  var seedBuffer = new Uint8Array(8);
1663
- var mutex$2 = new Mutex();
1664
- var mutex$1 = new Mutex();
1665
- var mutex = new Mutex();
4881
+ var mutex$2 = new Mutex2();
4882
+ var mutex$1 = new Mutex2();
4883
+ var mutex = new Mutex2();
1666
4884
 
1667
4885
  // src/worker/wasmHash.ts
1668
4886
  expose({ hash: async (data) => asHash(await sha256(data), true) });