@xyo-network/crypto-nft-diviner-score-plugin 2.99.4 → 2.99.5

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 (133) hide show
  1. package/dist/browser/Plugin.d.cts +1 -1
  2. package/dist/browser/Plugin.d.mts +1 -1
  3. package/dist/browser/Plugin.d.ts +1 -1
  4. package/dist/browser/index.cjs +233 -126
  5. package/dist/browser/index.cjs.map +1 -1
  6. package/dist/browser/index.d.cts +3 -3
  7. package/dist/browser/index.d.mts +3 -3
  8. package/dist/browser/index.d.ts +3 -3
  9. package/dist/browser/{index.js → index.mjs} +237 -132
  10. package/dist/browser/index.mjs.map +1 -0
  11. package/dist/browser/lib/index.d.cts +1 -1
  12. package/dist/browser/lib/index.d.mts +1 -1
  13. package/dist/browser/lib/index.d.ts +1 -1
  14. package/dist/browser/lib/rating/analyzeNft.d.cts +1 -1
  15. package/dist/browser/lib/rating/analyzeNft.d.mts +1 -1
  16. package/dist/browser/lib/rating/analyzeNft.d.ts +1 -1
  17. package/dist/browser/lib/rating/criteria/index.d.cts +1 -1
  18. package/dist/browser/lib/rating/criteria/index.d.mts +1 -1
  19. package/dist/browser/lib/rating/criteria/index.d.ts +1 -1
  20. package/dist/browser/lib/rating/criteria/scoring/index.d.cts +5 -5
  21. package/dist/browser/lib/rating/criteria/scoring/index.d.mts +5 -5
  22. package/dist/browser/lib/rating/criteria/scoring/index.d.ts +5 -5
  23. package/dist/browser/lib/rating/criteria/scoring/metadata/attributes/index.d.cts +1 -1
  24. package/dist/browser/lib/rating/criteria/scoring/metadata/attributes/index.d.mts +1 -1
  25. package/dist/browser/lib/rating/criteria/scoring/metadata/attributes/index.d.ts +1 -1
  26. package/dist/browser/lib/rating/criteria/scoring/metadata/index.d.cts +9 -9
  27. package/dist/browser/lib/rating/criteria/scoring/metadata/index.d.mts +9 -9
  28. package/dist/browser/lib/rating/criteria/scoring/metadata/index.d.ts +9 -9
  29. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/index.d.cts +1 -1
  30. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/index.d.mts +1 -1
  31. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/index.d.ts +1 -1
  32. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  33. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  34. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  35. package/dist/browser/lib/rating/index.d.cts +2 -2
  36. package/dist/browser/lib/rating/index.d.mts +2 -2
  37. package/dist/browser/lib/rating/index.d.ts +2 -2
  38. package/dist/neutral/Plugin.d.cts +1 -1
  39. package/dist/neutral/Plugin.d.mts +1 -1
  40. package/dist/neutral/Plugin.d.ts +1 -1
  41. package/dist/neutral/index.cjs +233 -126
  42. package/dist/neutral/index.cjs.map +1 -1
  43. package/dist/neutral/index.d.cts +3 -3
  44. package/dist/neutral/index.d.mts +3 -3
  45. package/dist/neutral/index.d.ts +3 -3
  46. package/dist/neutral/{index.js → index.mjs} +237 -132
  47. package/dist/neutral/index.mjs.map +1 -0
  48. package/dist/neutral/lib/index.d.cts +1 -1
  49. package/dist/neutral/lib/index.d.mts +1 -1
  50. package/dist/neutral/lib/index.d.ts +1 -1
  51. package/dist/neutral/lib/rating/analyzeNft.d.cts +1 -1
  52. package/dist/neutral/lib/rating/analyzeNft.d.mts +1 -1
  53. package/dist/neutral/lib/rating/analyzeNft.d.ts +1 -1
  54. package/dist/neutral/lib/rating/criteria/index.d.cts +1 -1
  55. package/dist/neutral/lib/rating/criteria/index.d.mts +1 -1
  56. package/dist/neutral/lib/rating/criteria/index.d.ts +1 -1
  57. package/dist/neutral/lib/rating/criteria/scoring/index.d.cts +5 -5
  58. package/dist/neutral/lib/rating/criteria/scoring/index.d.mts +5 -5
  59. package/dist/neutral/lib/rating/criteria/scoring/index.d.ts +5 -5
  60. package/dist/neutral/lib/rating/criteria/scoring/metadata/attributes/index.d.cts +1 -1
  61. package/dist/neutral/lib/rating/criteria/scoring/metadata/attributes/index.d.mts +1 -1
  62. package/dist/neutral/lib/rating/criteria/scoring/metadata/attributes/index.d.ts +1 -1
  63. package/dist/neutral/lib/rating/criteria/scoring/metadata/index.d.cts +9 -9
  64. package/dist/neutral/lib/rating/criteria/scoring/metadata/index.d.mts +9 -9
  65. package/dist/neutral/lib/rating/criteria/scoring/metadata/index.d.ts +9 -9
  66. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/index.d.cts +1 -1
  67. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/index.d.mts +1 -1
  68. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/index.d.ts +1 -1
  69. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  70. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  71. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  72. package/dist/neutral/lib/rating/index.d.cts +2 -2
  73. package/dist/neutral/lib/rating/index.d.mts +2 -2
  74. package/dist/neutral/lib/rating/index.d.ts +2 -2
  75. package/dist/node/Plugin.d.cts +1 -1
  76. package/dist/node/Plugin.d.mts +1 -1
  77. package/dist/node/Plugin.d.ts +1 -1
  78. package/dist/node/index.cjs +244 -133
  79. package/dist/node/index.cjs.map +1 -1
  80. package/dist/node/index.d.cts +3 -3
  81. package/dist/node/index.d.mts +3 -3
  82. package/dist/node/index.d.ts +3 -3
  83. package/dist/node/{index.js → index.mjs} +248 -139
  84. package/dist/node/index.mjs.map +1 -0
  85. package/dist/node/lib/index.d.cts +1 -1
  86. package/dist/node/lib/index.d.mts +1 -1
  87. package/dist/node/lib/index.d.ts +1 -1
  88. package/dist/node/lib/rating/analyzeNft.d.cts +1 -1
  89. package/dist/node/lib/rating/analyzeNft.d.mts +1 -1
  90. package/dist/node/lib/rating/analyzeNft.d.ts +1 -1
  91. package/dist/node/lib/rating/criteria/index.d.cts +1 -1
  92. package/dist/node/lib/rating/criteria/index.d.mts +1 -1
  93. package/dist/node/lib/rating/criteria/index.d.ts +1 -1
  94. package/dist/node/lib/rating/criteria/scoring/index.d.cts +5 -5
  95. package/dist/node/lib/rating/criteria/scoring/index.d.mts +5 -5
  96. package/dist/node/lib/rating/criteria/scoring/index.d.ts +5 -5
  97. package/dist/node/lib/rating/criteria/scoring/metadata/attributes/index.d.cts +1 -1
  98. package/dist/node/lib/rating/criteria/scoring/metadata/attributes/index.d.mts +1 -1
  99. package/dist/node/lib/rating/criteria/scoring/metadata/attributes/index.d.ts +1 -1
  100. package/dist/node/lib/rating/criteria/scoring/metadata/index.d.cts +9 -9
  101. package/dist/node/lib/rating/criteria/scoring/metadata/index.d.mts +9 -9
  102. package/dist/node/lib/rating/criteria/scoring/metadata/index.d.ts +9 -9
  103. package/dist/node/lib/rating/criteria/scoring/metadata/lib/index.d.cts +1 -1
  104. package/dist/node/lib/rating/criteria/scoring/metadata/lib/index.d.mts +1 -1
  105. package/dist/node/lib/rating/criteria/scoring/metadata/lib/index.d.ts +1 -1
  106. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  107. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  108. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  109. package/dist/node/lib/rating/index.d.cts +2 -2
  110. package/dist/node/lib/rating/index.d.mts +2 -2
  111. package/dist/node/lib/rating/index.d.ts +2 -2
  112. package/package.json +19 -19
  113. package/src/Diviner.ts +1 -1
  114. package/src/Plugin.ts +1 -1
  115. package/src/index.ts +3 -3
  116. package/src/lib/index.ts +1 -1
  117. package/src/lib/rating/analyzeNft.ts +2 -2
  118. package/src/lib/rating/criteria/index.ts +1 -1
  119. package/src/lib/rating/criteria/scoring/index.ts +5 -5
  120. package/src/lib/rating/criteria/scoring/metadata/animationUrl.ts +1 -1
  121. package/src/lib/rating/criteria/scoring/metadata/attributes/index.ts +1 -1
  122. package/src/lib/rating/criteria/scoring/metadata/externalUrl.ts +1 -1
  123. package/src/lib/rating/criteria/scoring/metadata/image.ts +1 -1
  124. package/src/lib/rating/criteria/scoring/metadata/imageData.ts +2 -2
  125. package/src/lib/rating/criteria/scoring/metadata/index.ts +9 -9
  126. package/src/lib/rating/criteria/scoring/metadata/lib/index.ts +1 -1
  127. package/src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts +1 -1
  128. package/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts +1 -1
  129. package/src/lib/rating/criteria/scoringCriteria.ts +6 -6
  130. package/src/lib/rating/index.ts +2 -2
  131. package/dist/browser/index.js.map +0 -1
  132. package/dist/neutral/index.js.map +0 -1
  133. package/dist/node/index.js.map +0 -1
@@ -2,7 +2,11 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
5
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __reflectGet = Reflect.get;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
10
  var __export = (target, all) => {
7
11
  for (var name in all)
8
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,6 +20,8 @@ var __copyProps = (to, from, except, desc) => {
16
20
  return to;
17
21
  };
18
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
19
25
 
20
26
  // src/index.ts
21
27
  var src_exports = {};
@@ -37,44 +43,50 @@ var import_payload_builder = require("@xyo-network/payload-builder");
37
43
  // src/lib/rating/criteria/scoring/contract.ts
38
44
  var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
39
45
  var import_ethers = require("ethers");
40
- var scoreContractAddress = (nft) => {
46
+ var scoreContractAddress = /* @__PURE__ */ __name((nft) => {
41
47
  if (!nft.address) return import_crypto_nft_score_model.FAIL;
42
48
  if (typeof nft.address !== "string") return import_crypto_nft_score_model.FAIL;
43
49
  if (!(0, import_ethers.isAddress)(nft.address)) return import_crypto_nft_score_model.FAIL;
44
50
  return import_crypto_nft_score_model.PASS;
45
- };
51
+ }, "scoreContractAddress");
46
52
 
47
53
  // src/lib/rating/criteria/scoring/metadata/animationUrl.ts
48
54
  var import_crypto_nft_score_model2 = require("@xyo-network/crypto-nft-score-model");
49
55
 
50
56
  // src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts
51
57
  var import_url = require("@xylabs/url");
52
- var web3Protocols = ["ipfs:", "ar:"];
53
- var toUrl = (url) => {
58
+ var web3Protocols = [
59
+ "ipfs:",
60
+ "ar:"
61
+ ];
62
+ var toUrl = /* @__PURE__ */ __name((url) => {
54
63
  if (!url) return void 0;
55
64
  try {
56
65
  return new import_url.URL(url);
57
66
  } catch {
58
67
  return void 0;
59
68
  }
60
- };
61
- var isValidUrl = (url) => toUrl(url) !== void 0;
62
- var isWeb3 = (url) => web3Protocols.some((protocol) => {
69
+ }, "toUrl");
70
+ var isValidUrl = /* @__PURE__ */ __name((url) => toUrl(url) !== void 0, "isValidUrl");
71
+ var isWeb3 = /* @__PURE__ */ __name((url) => web3Protocols.some((protocol) => {
63
72
  var _a;
64
73
  return protocol === ((_a = toUrl(url)) == null ? void 0 : _a.protocol);
65
- });
66
- var isSecure = (url) => {
74
+ }), "isWeb3");
75
+ var isSecure = /* @__PURE__ */ __name((url) => {
67
76
  var _a;
68
77
  return isWeb3(url) || ((_a = toUrl(url)) == null ? void 0 : _a.protocol) === "https:";
69
- };
78
+ }, "isSecure");
70
79
 
71
80
  // src/lib/rating/criteria/scoring/metadata/animationUrl.ts
72
- var scoreNftAnimationUrl = (nft) => {
81
+ var scoreNftAnimationUrl = /* @__PURE__ */ __name((nft) => {
73
82
  var _a;
74
83
  return scoreAnimationUrl((_a = nft.metadata) == null ? void 0 : _a.animation_url);
75
- };
76
- var scoreAnimationUrl = (animation_url) => {
77
- const score = [0, 0];
84
+ }, "scoreNftAnimationUrl");
85
+ var scoreAnimationUrl = /* @__PURE__ */ __name((animation_url) => {
86
+ const score = [
87
+ 0,
88
+ 0
89
+ ];
78
90
  if (animation_url === void 0 || animation_url === null) return import_crypto_nft_score_model2.PASS;
79
91
  (0, import_crypto_nft_score_model2.incrementPossible)(score);
80
92
  if (typeof animation_url !== "string") return score;
@@ -85,11 +97,11 @@ var scoreAnimationUrl = (animation_url) => {
85
97
  (0, import_crypto_nft_score_model2.incrementTotalAndPossible)(score);
86
98
  if (!isWeb3(animation_url)) return score;
87
99
  return (0, import_crypto_nft_score_model2.incrementTotal)(score);
88
- };
100
+ }, "scoreAnimationUrl");
89
101
 
90
102
  // src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts
91
103
  var import_crypto_nft_score_model3 = require("@xyo-network/crypto-nft-score-model");
92
- var isDate = (value) => {
104
+ var isDate = /* @__PURE__ */ __name((value) => {
93
105
  if (isNumber(value)) {
94
106
  try {
95
107
  new Date(value);
@@ -99,26 +111,41 @@ var isDate = (value) => {
99
111
  }
100
112
  }
101
113
  return false;
102
- };
103
- var isNumber = (value) => typeof value === "number";
104
- var isPercentage = (value) => isNumber(value) && value >= 0 && value <= 100;
105
- var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
106
- var isNonEmptyStringOrNumber = (value) => value === "number" || isNonEmptyString(value);
107
- var evaluateNftAttributes = (nft) => {
114
+ }, "isDate");
115
+ var isNumber = /* @__PURE__ */ __name((value) => typeof value === "number", "isNumber");
116
+ var isPercentage = /* @__PURE__ */ __name((value) => isNumber(value) && value >= 0 && value <= 100, "isPercentage");
117
+ var isNonEmptyString = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0, "isNonEmptyString");
118
+ var isNonEmptyStringOrNumber = /* @__PURE__ */ __name((value) => value === "number" || isNonEmptyString(value), "isNonEmptyStringOrNumber");
119
+ var evaluateNftAttributes = /* @__PURE__ */ __name((nft) => {
108
120
  var _a, _b;
109
- return ((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.attributes) ? evaluateAttributes((_b = nft == null ? void 0 : nft.metadata) == null ? void 0 : _b.attributes) : [0, 1];
110
- };
111
- var evaluateAttributes = (attributes) => {
112
- if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1];
113
- const score = [0, 0];
121
+ return ((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.attributes) ? evaluateAttributes((_b = nft == null ? void 0 : nft.metadata) == null ? void 0 : _b.attributes) : [
122
+ 0,
123
+ 1
124
+ ];
125
+ }, "evaluateNftAttributes");
126
+ var evaluateAttributes = /* @__PURE__ */ __name((attributes) => {
127
+ if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [
128
+ 0,
129
+ 1
130
+ ];
131
+ const score = [
132
+ 0,
133
+ 0
134
+ ];
114
135
  for (const attribute of attributes) {
115
136
  const [attributeTotal, attributePossible] = evaluateAttribute(attribute);
116
137
  (0, import_crypto_nft_score_model3.incrementTotalAndPossible)(score, attributeTotal, attributePossible);
117
138
  }
118
- return [1, 1];
119
- };
120
- var evaluateAttribute = (attribute) => {
121
- const score = [0, 1];
139
+ return [
140
+ 1,
141
+ 1
142
+ ];
143
+ }, "evaluateAttributes");
144
+ var evaluateAttribute = /* @__PURE__ */ __name((attribute) => {
145
+ const score = [
146
+ 0,
147
+ 1
148
+ ];
122
149
  const max_value = attribute == null ? void 0 : attribute.max_value;
123
150
  const trait_type = attribute == null ? void 0 : attribute.trait_type;
124
151
  const value = attribute == null ? void 0 : attribute.value;
@@ -131,8 +158,8 @@ var evaluateAttribute = (attribute) => {
131
158
  if (isNumber(max_value) && isNumber(value) && value <= max_value) (0, import_crypto_nft_score_model3.incrementTotal)(score);
132
159
  }
133
160
  return score;
134
- };
135
- var validDisplayType = (attribute) => {
161
+ }, "evaluateAttribute");
162
+ var validDisplayType = /* @__PURE__ */ __name((attribute) => {
136
163
  switch (attribute == null ? void 0 : attribute.display_type) {
137
164
  case "number":
138
165
  case "boost_number": {
@@ -157,64 +184,79 @@ var validDisplayType = (attribute) => {
157
184
  }
158
185
  }
159
186
  return false;
160
- };
187
+ }, "validDisplayType");
161
188
 
162
189
  // src/lib/rating/criteria/scoring/metadata/backgroundColor.ts
163
190
  var import_crypto_nft_score_model4 = require("@xyo-network/crypto-nft-score-model");
164
191
  var isHexColor = /^[\da-f]{6}$/i;
165
- var scoreNftBackgroundColor = (nft) => {
192
+ var scoreNftBackgroundColor = /* @__PURE__ */ __name((nft) => {
166
193
  var _a;
167
194
  return scoreBackgroundColor((_a = nft.metadata) == null ? void 0 : _a.background_color);
168
- };
169
- var scoreBackgroundColor = (background_color) => {
170
- const score = [0, 0];
195
+ }, "scoreNftBackgroundColor");
196
+ var scoreBackgroundColor = /* @__PURE__ */ __name((background_color) => {
197
+ const score = [
198
+ 0,
199
+ 0
200
+ ];
171
201
  if (background_color === void 0 || background_color === null) return import_crypto_nft_score_model4.PASS;
172
202
  (0, import_crypto_nft_score_model4.incrementPossible)(score);
173
203
  if (typeof background_color !== "string") return score;
174
204
  (0, import_crypto_nft_score_model4.incrementTotalAndPossible)(score);
175
205
  if (!isHexColor.test(background_color.toUpperCase())) return score;
176
206
  return (0, import_crypto_nft_score_model4.incrementTotal)(score);
177
- };
207
+ }, "scoreBackgroundColor");
178
208
 
179
209
  // src/lib/rating/criteria/scoring/metadata/description.ts
180
210
  var import_crypto_nft_score_model5 = require("@xyo-network/crypto-nft-score-model");
181
- var scoreNftDescription = (nft) => {
211
+ var scoreNftDescription = /* @__PURE__ */ __name((nft) => {
182
212
  var _a;
183
213
  return scoreDescription((_a = nft.metadata) == null ? void 0 : _a.description);
184
- };
185
- var scoreDescription = (description) => {
186
- const score = [0, 1];
214
+ }, "scoreNftDescription");
215
+ var scoreDescription = /* @__PURE__ */ __name((description) => {
216
+ const score = [
217
+ 0,
218
+ 1
219
+ ];
187
220
  if (!description || typeof description !== "string") return score;
188
221
  return (0, import_crypto_nft_score_model5.incrementTotal)(score);
189
- };
222
+ }, "scoreDescription");
190
223
 
191
224
  // src/lib/rating/criteria/scoring/metadata/externalUrl.ts
192
225
  var import_crypto_nft_score_model6 = require("@xyo-network/crypto-nft-score-model");
193
- var scoreNftExternalUrl = (nft) => {
226
+ var scoreNftExternalUrl = /* @__PURE__ */ __name((nft) => {
194
227
  var _a;
195
228
  return scoreExternalUrl((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.external_url);
196
- };
197
- var scoreExternalUrl = (external_url) => {
198
- const score = [0, 2];
229
+ }, "scoreNftExternalUrl");
230
+ var scoreExternalUrl = /* @__PURE__ */ __name((external_url) => {
231
+ const score = [
232
+ 0,
233
+ 2
234
+ ];
199
235
  if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url)) return score;
200
236
  (0, import_crypto_nft_score_model6.incrementTotal)(score);
201
237
  if (!isSecure(external_url)) return score;
202
238
  return (0, import_crypto_nft_score_model6.incrementTotal)(score);
203
- };
239
+ }, "scoreExternalUrl");
204
240
 
205
241
  // src/lib/rating/criteria/scoring/metadata/image.ts
206
242
  var import_crypto_nft_score_model7 = require("@xyo-network/crypto-nft-score-model");
207
243
  var MaxPossibleImageScore = 3;
208
- var scoreNftImage = (nft) => {
244
+ var scoreNftImage = /* @__PURE__ */ __name((nft) => {
209
245
  var _a, _b, _c;
210
246
  if ((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.image) {
211
247
  return scoreImage((_b = nft.metadata) == null ? void 0 : _b.image);
212
248
  } else {
213
- return ((_c = nft.metadata) == null ? void 0 : _c.image_data) ? import_crypto_nft_score_model7.PASS : [0, MaxPossibleImageScore];
249
+ return ((_c = nft.metadata) == null ? void 0 : _c.image_data) ? import_crypto_nft_score_model7.PASS : [
250
+ 0,
251
+ MaxPossibleImageScore
252
+ ];
214
253
  }
215
- };
216
- var scoreImage = (image) => {
217
- const score = [0, MaxPossibleImageScore];
254
+ }, "scoreNftImage");
255
+ var scoreImage = /* @__PURE__ */ __name((image) => {
256
+ const score = [
257
+ 0,
258
+ MaxPossibleImageScore
259
+ ];
218
260
  if (!image || typeof image !== "string" || !isValidUrl(image)) return score;
219
261
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
220
262
  if (!isSecure(image)) return score;
@@ -222,13 +264,13 @@ var scoreImage = (image) => {
222
264
  if (!isWeb3(image)) return score;
223
265
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
224
266
  return score;
225
- };
267
+ }, "scoreImage");
226
268
 
227
269
  // src/lib/rating/criteria/scoring/metadata/imageData.ts
228
270
  var import_crypto_nft_score_model8 = require("@xyo-network/crypto-nft-score-model");
229
271
  var import_svg_parser = require("svg-parser");
230
272
  var MaxPossibleImageDataScore = 1;
231
- var isValidImageData = (image_data) => {
273
+ var isValidImageData = /* @__PURE__ */ __name((image_data) => {
232
274
  if (!image_data.startsWith("<svg")) return false;
233
275
  try {
234
276
  (0, import_svg_parser.parse)(image_data);
@@ -236,49 +278,64 @@ var isValidImageData = (image_data) => {
236
278
  } catch {
237
279
  return false;
238
280
  }
239
- };
240
- var scoreNftImageData = (nft) => {
281
+ }, "isValidImageData");
282
+ var scoreNftImageData = /* @__PURE__ */ __name((nft) => {
241
283
  var _a, _b, _c;
242
284
  if ((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.image_data) {
243
285
  return scoreImageData((_b = nft.metadata) == null ? void 0 : _b.image_data);
244
286
  } else {
245
- return ((_c = nft.metadata) == null ? void 0 : _c.image) ? import_crypto_nft_score_model8.PASS : [0, MaxPossibleImageDataScore];
287
+ return ((_c = nft.metadata) == null ? void 0 : _c.image) ? import_crypto_nft_score_model8.PASS : [
288
+ 0,
289
+ MaxPossibleImageDataScore
290
+ ];
246
291
  }
247
- };
248
- var scoreImageData = (image_data) => {
249
- return !image_data || typeof image_data !== "string" || !isValidImageData(image_data) ? [0, MaxPossibleImageDataScore] : [MaxPossibleImageDataScore, MaxPossibleImageDataScore];
250
- };
292
+ }, "scoreNftImageData");
293
+ var scoreImageData = /* @__PURE__ */ __name((image_data) => {
294
+ return !image_data || typeof image_data !== "string" || !isValidImageData(image_data) ? [
295
+ 0,
296
+ MaxPossibleImageDataScore
297
+ ] : [
298
+ MaxPossibleImageDataScore,
299
+ MaxPossibleImageDataScore
300
+ ];
301
+ }, "scoreImageData");
251
302
 
252
303
  // src/lib/rating/criteria/scoring/metadata/name.ts
253
304
  var import_crypto_nft_score_model9 = require("@xyo-network/crypto-nft-score-model");
254
- var scoreNftName = (nft) => {
305
+ var scoreNftName = /* @__PURE__ */ __name((nft) => {
255
306
  var _a;
256
307
  return scoreName((_a = nft.metadata) == null ? void 0 : _a.name);
257
- };
258
- var scoreName = (name) => {
259
- const score = [0, 1];
308
+ }, "scoreNftName");
309
+ var scoreName = /* @__PURE__ */ __name((name) => {
310
+ const score = [
311
+ 0,
312
+ 1
313
+ ];
260
314
  if (!name || typeof name !== "string") return score;
261
315
  return (0, import_crypto_nft_score_model9.incrementTotal)(score);
262
- };
316
+ }, "scoreName");
263
317
 
264
318
  // src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts
265
319
  var import_crypto_nft_score_model10 = require("@xyo-network/crypto-nft-score-model");
266
- var scoreNftYoutubeUrl = (nft) => {
320
+ var scoreNftYoutubeUrl = /* @__PURE__ */ __name((nft) => {
267
321
  var _a;
268
322
  return scoreYoutubeUrl((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.youtube_url);
269
- };
270
- var scoreYoutubeUrl = (youtube_url) => {
323
+ }, "scoreNftYoutubeUrl");
324
+ var scoreYoutubeUrl = /* @__PURE__ */ __name((youtube_url) => {
271
325
  if (youtube_url === void 0 || youtube_url === null) return import_crypto_nft_score_model10.PASS;
272
- const score = [0, 2];
326
+ const score = [
327
+ 0,
328
+ 2
329
+ ];
273
330
  if (typeof youtube_url !== "string" || !isValidUrl(youtube_url)) return score;
274
331
  (0, import_crypto_nft_score_model10.incrementTotal)(score);
275
332
  if (!isSecure(youtube_url)) return score;
276
333
  return (0, import_crypto_nft_score_model10.incrementTotal)(score);
277
- };
334
+ }, "scoreYoutubeUrl");
278
335
 
279
336
  // src/lib/rating/criteria/scoring/supply.ts
280
337
  var import_crypto_nft_score_model11 = require("@xyo-network/crypto-nft-score-model");
281
- var scoreSupply = (nft) => {
338
+ var scoreSupply = /* @__PURE__ */ __name((nft) => {
282
339
  if (!nft.supply) return import_crypto_nft_score_model11.FAIL;
283
340
  if (typeof nft.supply !== "string") return import_crypto_nft_score_model11.FAIL;
284
341
  try {
@@ -286,11 +343,11 @@ var scoreSupply = (nft) => {
286
343
  } catch {
287
344
  return import_crypto_nft_score_model11.FAIL;
288
345
  }
289
- };
346
+ }, "scoreSupply");
290
347
 
291
348
  // src/lib/rating/criteria/scoring/tokenId.ts
292
349
  var import_crypto_nft_score_model12 = require("@xyo-network/crypto-nft-score-model");
293
- var scoreTokenId = (nft) => {
350
+ var scoreTokenId = /* @__PURE__ */ __name((nft) => {
294
351
  if (!nft.tokenId) return import_crypto_nft_score_model12.FAIL;
295
352
  if (typeof nft.tokenId !== "string") return import_crypto_nft_score_model12.FAIL;
296
353
  try {
@@ -298,94 +355,148 @@ var scoreTokenId = (nft) => {
298
355
  } catch {
299
356
  return import_crypto_nft_score_model12.FAIL;
300
357
  }
301
- };
358
+ }, "scoreTokenId");
302
359
 
303
360
  // src/lib/rating/criteria/scoring/type.ts
304
361
  var import_crypto_nft_score_model13 = require("@xyo-network/crypto-nft-score-model");
305
- var scoreType = (nft) => {
362
+ var scoreType = /* @__PURE__ */ __name((nft) => {
306
363
  if (!nft.type) return import_crypto_nft_score_model13.FAIL;
307
364
  if (typeof nft.type !== "string") return import_crypto_nft_score_model13.FAIL;
308
365
  const type = nft.type.toUpperCase();
309
366
  if (type !== "ERC721" && type !== "ERC1155") return import_crypto_nft_score_model13.FAIL;
310
367
  return import_crypto_nft_score_model13.PASS;
311
- };
368
+ }, "scoreType");
312
369
 
313
370
  // src/lib/rating/criteria/scoringCriteria.ts
314
371
  var attributesScoringCriteria = {
315
- Attributes: { score: evaluateNftAttributes, weight: 1 }
372
+ Attributes: {
373
+ score: evaluateNftAttributes,
374
+ weight: 1
375
+ }
316
376
  };
317
377
  var metadataScoringCriteria = {
318
- "Animation URL": { score: scoreNftAnimationUrl, weight: 1 },
319
- "Background Color": { score: scoreNftBackgroundColor, weight: 1 },
320
- Description: { score: scoreNftDescription, weight: 1 },
321
- "External Url": { score: scoreNftExternalUrl, weight: 1 },
322
- Image: { score: scoreNftImage, weight: 1 },
323
- "Image Data": { score: scoreNftImageData, weight: 1 },
324
- Name: { score: scoreNftName, weight: 1 },
325
- "YouTube URL": { score: scoreNftYoutubeUrl, weight: 1 },
378
+ "Animation URL": {
379
+ score: scoreNftAnimationUrl,
380
+ weight: 1
381
+ },
382
+ "Background Color": {
383
+ score: scoreNftBackgroundColor,
384
+ weight: 1
385
+ },
386
+ "Description": {
387
+ score: scoreNftDescription,
388
+ weight: 1
389
+ },
390
+ "External Url": {
391
+ score: scoreNftExternalUrl,
392
+ weight: 1
393
+ },
394
+ "Image": {
395
+ score: scoreNftImage,
396
+ weight: 1
397
+ },
398
+ "Image Data": {
399
+ score: scoreNftImageData,
400
+ weight: 1
401
+ },
402
+ "Name": {
403
+ score: scoreNftName,
404
+ weight: 1
405
+ },
406
+ "YouTube URL": {
407
+ score: scoreNftYoutubeUrl,
408
+ weight: 1
409
+ },
326
410
  ...attributesScoringCriteria
327
411
  };
328
412
  var scoringCriteria = {
329
- "Contract Address": { score: scoreContractAddress, weight: 1 },
330
- Supply: { score: scoreSupply, weight: 1 },
331
- "Token Id": { score: scoreTokenId, weight: 1 },
332
- Type: { score: scoreType, weight: 1 },
413
+ "Contract Address": {
414
+ score: scoreContractAddress,
415
+ weight: 1
416
+ },
417
+ "Supply": {
418
+ score: scoreSupply,
419
+ weight: 1
420
+ },
421
+ "Token Id": {
422
+ score: scoreTokenId,
423
+ weight: 1
424
+ },
425
+ "Type": {
426
+ score: scoreType,
427
+ weight: 1
428
+ },
333
429
  ...metadataScoringCriteria
334
430
  };
335
431
 
336
432
  // src/lib/rating/analyzeNft.ts
337
- var analyzeNft = async (nft) => {
338
- const result = Object.fromEntries(
339
- await Promise.all(
340
- Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
341
- const rawScore = await score(nft);
342
- const weighted = rawScore.map((v) => v * weight);
343
- return [key, weighted];
344
- })
345
- )
346
- );
433
+ var analyzeNft = /* @__PURE__ */ __name(async (nft) => {
434
+ const result = Object.fromEntries(await Promise.all(Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
435
+ const rawScore = await score(nft);
436
+ const weighted = rawScore.map((v) => v * weight);
437
+ return [
438
+ key,
439
+ weighted
440
+ ];
441
+ })));
347
442
  return result;
348
- };
443
+ }, "analyzeNft");
349
444
 
350
445
  // src/Diviner.ts
351
- var toNftScorePayload = (nftInfo, scores) => {
446
+ var toNftScorePayload = /* @__PURE__ */ __name((nftInfo, scores) => {
352
447
  const { address, chainId, type } = nftInfo;
353
- return { address, chainId, schema: import_crypto_nft_payload_plugin.NftScoreSchema, scores, type };
354
- };
355
- var isNftScore = (payload) => payload.schema === import_crypto_nft_payload_plugin.NftScoreSchema;
356
- var NftScoreDiviner = class extends import_diviner_abstract.AbstractDiviner {
357
- static configSchemas = [...super.configSchemas, import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema];
358
- static defaultConfigSchema = import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema;
359
- divineHandler = async (payloads) => {
448
+ return {
449
+ address,
450
+ chainId,
451
+ schema: import_crypto_nft_payload_plugin.NftScoreSchema,
452
+ scores,
453
+ type
454
+ };
455
+ }, "toNftScorePayload");
456
+ var isNftScore = /* @__PURE__ */ __name((payload) => payload.schema === import_crypto_nft_payload_plugin.NftScoreSchema, "isNftScore");
457
+ var _NftScoreDiviner = class _NftScoreDiviner extends import_diviner_abstract.AbstractDiviner {
458
+ divineHandler = /* @__PURE__ */ __name(async (payloads) => {
360
459
  const nftInfos = (payloads == null ? void 0 : payloads.filter(import_crypto_nft_payload_plugin.isNftInfo)) ?? [];
361
- const results = await Promise.all(
362
- nftInfos.map(async (nftInfo) => {
363
- const [score, sourceHash] = await Promise.all([
364
- // Analyze the NFT
365
- toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),
366
- // Hash the source payload
367
- import_payload_builder.PayloadBuilder.dataHash(nftInfo)
368
- ]);
369
- return { ...score, sources: [sourceHash] };
370
- })
371
- );
460
+ const results = await Promise.all(nftInfos.map(async (nftInfo) => {
461
+ const [score, sourceHash] = await Promise.all([
462
+ // Analyze the NFT
463
+ toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),
464
+ // Hash the source payload
465
+ import_payload_builder.PayloadBuilder.dataHash(nftInfo)
466
+ ]);
467
+ return {
468
+ ...score,
469
+ sources: [
470
+ sourceHash
471
+ ]
472
+ };
473
+ }));
372
474
  return results;
373
- };
374
- };
475
+ }, "divineHandler");
476
+ };
477
+ __name(_NftScoreDiviner, "NftScoreDiviner");
478
+ __publicField(_NftScoreDiviner, "configSchemas", [
479
+ ...__superGet(_NftScoreDiviner, _NftScoreDiviner, "configSchemas"),
480
+ import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema
481
+ ]);
482
+ __publicField(_NftScoreDiviner, "defaultConfigSchema", import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema);
483
+ var NftScoreDiviner = _NftScoreDiviner;
375
484
 
376
485
  // src/Plugin.ts
377
486
  var import_crypto_nft_payload_plugin2 = require("@xyo-network/crypto-nft-payload-plugin");
378
487
  var import_payload_model = require("@xyo-network/payload-model");
379
488
  var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
380
- var NftScoreDivinerPlugin = () => (0, import_payloadset_plugin.createPayloadSetDivinerPlugin)(
381
- { required: { [import_crypto_nft_payload_plugin2.NftSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
382
- {
383
- diviner: async (params) => {
384
- const result = await NftScoreDiviner.create(params);
385
- return result;
386
- }
387
- }
388
- );
489
+ var NftScoreDivinerPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetDivinerPlugin)({
490
+ required: {
491
+ [import_crypto_nft_payload_plugin2.NftSchema]: 1
492
+ },
493
+ schema: import_payload_model.PayloadSetSchema
494
+ }, {
495
+ diviner: /* @__PURE__ */ __name(async (params) => {
496
+ const result = await NftScoreDiviner.create(params);
497
+ return result;
498
+ }, "diviner")
499
+ }), "NftScoreDivinerPlugin");
389
500
  // Annotate the CommonJS export names for ESM import in node:
390
501
  0 && (module.exports = {
391
502
  NftScoreDiviner,