@vitessce/utils 3.5.12 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +569 -570
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,367 +1,364 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
4
  function getDefaultExportFromCjs(x) {
9
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
10
6
  }
11
7
  function commonjsRequire(path) {
12
8
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
13
9
  }
14
- var pluralize$1 = { exports: {} };
15
- (function(module, exports) {
16
- (function(root, pluralize2) {
17
- if (typeof commonjsRequire === "function" && true && true) {
18
- module.exports = pluralize2();
19
- } else {
20
- root.pluralize = pluralize2();
21
- }
22
- })(commonjsGlobal, function() {
23
- var pluralRules = [];
24
- var singularRules = [];
25
- var uncountables = {};
26
- var irregularPlurals = {};
27
- var irregularSingles = {};
28
- function sanitizeRule(rule) {
29
- if (typeof rule === "string") {
30
- return new RegExp("^" + rule + "$", "i");
10
+ var pluralize$2 = { exports: {} };
11
+ var pluralize$1 = pluralize$2.exports;
12
+ var hasRequiredPluralize;
13
+ function requirePluralize() {
14
+ if (hasRequiredPluralize) return pluralize$2.exports;
15
+ hasRequiredPluralize = 1;
16
+ (function(module, exports) {
17
+ (function(root, pluralize2) {
18
+ if (typeof commonjsRequire === "function" && true && true) {
19
+ module.exports = pluralize2();
20
+ } else {
21
+ root.pluralize = pluralize2();
31
22
  }
32
- return rule;
33
- }
34
- function restoreCase(word, token) {
35
- if (word === token)
36
- return token;
37
- if (word === word.toLowerCase())
23
+ })(pluralize$1, function() {
24
+ var pluralRules = [];
25
+ var singularRules = [];
26
+ var uncountables = {};
27
+ var irregularPlurals = {};
28
+ var irregularSingles = {};
29
+ function sanitizeRule(rule) {
30
+ if (typeof rule === "string") {
31
+ return new RegExp("^" + rule + "$", "i");
32
+ }
33
+ return rule;
34
+ }
35
+ function restoreCase(word, token) {
36
+ if (word === token) return token;
37
+ if (word === word.toLowerCase()) return token.toLowerCase();
38
+ if (word === word.toUpperCase()) return token.toUpperCase();
39
+ if (word[0] === word[0].toUpperCase()) {
40
+ return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
41
+ }
38
42
  return token.toLowerCase();
39
- if (word === word.toUpperCase())
40
- return token.toUpperCase();
41
- if (word[0] === word[0].toUpperCase()) {
42
- return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
43
43
  }
44
- return token.toLowerCase();
45
- }
46
- function interpolate(str, args) {
47
- return str.replace(/\$(\d{1,2})/g, function(match, index) {
48
- return args[index] || "";
49
- });
50
- }
51
- function replace(word, rule) {
52
- return word.replace(rule[0], function(match, index) {
53
- var result = interpolate(rule[1], arguments);
54
- if (match === "") {
55
- return restoreCase(word[index - 1], result);
44
+ function interpolate(str, args) {
45
+ return str.replace(/\$(\d{1,2})/g, function(match, index) {
46
+ return args[index] || "";
47
+ });
48
+ }
49
+ function replace(word, rule) {
50
+ return word.replace(rule[0], function(match, index) {
51
+ var result = interpolate(rule[1], arguments);
52
+ if (match === "") {
53
+ return restoreCase(word[index - 1], result);
54
+ }
55
+ return restoreCase(match, result);
56
+ });
57
+ }
58
+ function sanitizeWord(token, word, rules) {
59
+ if (!token.length || uncountables.hasOwnProperty(token)) {
60
+ return word;
61
+ }
62
+ var len = rules.length;
63
+ while (len--) {
64
+ var rule = rules[len];
65
+ if (rule[0].test(word)) return replace(word, rule);
56
66
  }
57
- return restoreCase(match, result);
58
- });
59
- }
60
- function sanitizeWord(token, word, rules) {
61
- if (!token.length || uncountables.hasOwnProperty(token)) {
62
67
  return word;
63
68
  }
64
- var len = rules.length;
65
- while (len--) {
66
- var rule = rules[len];
67
- if (rule[0].test(word))
68
- return replace(word, rule);
69
+ function replaceWord(replaceMap, keepMap, rules) {
70
+ return function(word) {
71
+ var token = word.toLowerCase();
72
+ if (keepMap.hasOwnProperty(token)) {
73
+ return restoreCase(word, token);
74
+ }
75
+ if (replaceMap.hasOwnProperty(token)) {
76
+ return restoreCase(word, replaceMap[token]);
77
+ }
78
+ return sanitizeWord(token, word, rules);
79
+ };
69
80
  }
70
- return word;
71
- }
72
- function replaceWord(replaceMap, keepMap, rules) {
73
- return function(word) {
74
- var token = word.toLowerCase();
75
- if (keepMap.hasOwnProperty(token)) {
76
- return restoreCase(word, token);
77
- }
78
- if (replaceMap.hasOwnProperty(token)) {
79
- return restoreCase(word, replaceMap[token]);
81
+ function checkWord(replaceMap, keepMap, rules, bool) {
82
+ return function(word) {
83
+ var token = word.toLowerCase();
84
+ if (keepMap.hasOwnProperty(token)) return true;
85
+ if (replaceMap.hasOwnProperty(token)) return false;
86
+ return sanitizeWord(token, token, rules) === token;
87
+ };
88
+ }
89
+ function pluralize2(word, count, inclusive) {
90
+ var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
91
+ return (inclusive ? count + " " : "") + pluralized;
92
+ }
93
+ pluralize2.plural = replaceWord(
94
+ irregularSingles,
95
+ irregularPlurals,
96
+ pluralRules
97
+ );
98
+ pluralize2.isPlural = checkWord(
99
+ irregularSingles,
100
+ irregularPlurals,
101
+ pluralRules
102
+ );
103
+ pluralize2.singular = replaceWord(
104
+ irregularPlurals,
105
+ irregularSingles,
106
+ singularRules
107
+ );
108
+ pluralize2.isSingular = checkWord(
109
+ irregularPlurals,
110
+ irregularSingles,
111
+ singularRules
112
+ );
113
+ pluralize2.addPluralRule = function(rule, replacement) {
114
+ pluralRules.push([sanitizeRule(rule), replacement]);
115
+ };
116
+ pluralize2.addSingularRule = function(rule, replacement) {
117
+ singularRules.push([sanitizeRule(rule), replacement]);
118
+ };
119
+ pluralize2.addUncountableRule = function(word) {
120
+ if (typeof word === "string") {
121
+ uncountables[word.toLowerCase()] = true;
122
+ return;
80
123
  }
81
- return sanitizeWord(token, word, rules);
124
+ pluralize2.addPluralRule(word, "$0");
125
+ pluralize2.addSingularRule(word, "$0");
82
126
  };
83
- }
84
- function checkWord(replaceMap, keepMap, rules, bool) {
85
- return function(word) {
86
- var token = word.toLowerCase();
87
- if (keepMap.hasOwnProperty(token))
88
- return true;
89
- if (replaceMap.hasOwnProperty(token))
90
- return false;
91
- return sanitizeWord(token, token, rules) === token;
127
+ pluralize2.addIrregularRule = function(single, plural) {
128
+ plural = plural.toLowerCase();
129
+ single = single.toLowerCase();
130
+ irregularSingles[single] = plural;
131
+ irregularPlurals[plural] = single;
92
132
  };
93
- }
94
- function pluralize2(word, count, inclusive) {
95
- var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
96
- return (inclusive ? count + " " : "") + pluralized;
97
- }
98
- pluralize2.plural = replaceWord(
99
- irregularSingles,
100
- irregularPlurals,
101
- pluralRules
102
- );
103
- pluralize2.isPlural = checkWord(
104
- irregularSingles,
105
- irregularPlurals,
106
- pluralRules
107
- );
108
- pluralize2.singular = replaceWord(
109
- irregularPlurals,
110
- irregularSingles,
111
- singularRules
112
- );
113
- pluralize2.isSingular = checkWord(
114
- irregularPlurals,
115
- irregularSingles,
116
- singularRules
117
- );
118
- pluralize2.addPluralRule = function(rule, replacement) {
119
- pluralRules.push([sanitizeRule(rule), replacement]);
120
- };
121
- pluralize2.addSingularRule = function(rule, replacement) {
122
- singularRules.push([sanitizeRule(rule), replacement]);
123
- };
124
- pluralize2.addUncountableRule = function(word) {
125
- if (typeof word === "string") {
126
- uncountables[word.toLowerCase()] = true;
127
- return;
128
- }
129
- pluralize2.addPluralRule(word, "$0");
130
- pluralize2.addSingularRule(word, "$0");
131
- };
132
- pluralize2.addIrregularRule = function(single, plural) {
133
- plural = plural.toLowerCase();
134
- single = single.toLowerCase();
135
- irregularSingles[single] = plural;
136
- irregularPlurals[plural] = single;
137
- };
138
- [
139
- // Pronouns.
140
- ["I", "we"],
141
- ["me", "us"],
142
- ["he", "they"],
143
- ["she", "they"],
144
- ["them", "them"],
145
- ["myself", "ourselves"],
146
- ["yourself", "yourselves"],
147
- ["itself", "themselves"],
148
- ["herself", "themselves"],
149
- ["himself", "themselves"],
150
- ["themself", "themselves"],
151
- ["is", "are"],
152
- ["was", "were"],
153
- ["has", "have"],
154
- ["this", "these"],
155
- ["that", "those"],
156
- // Words ending in with a consonant and `o`.
157
- ["echo", "echoes"],
158
- ["dingo", "dingoes"],
159
- ["volcano", "volcanoes"],
160
- ["tornado", "tornadoes"],
161
- ["torpedo", "torpedoes"],
162
- // Ends with `us`.
163
- ["genus", "genera"],
164
- ["viscus", "viscera"],
165
- // Ends with `ma`.
166
- ["stigma", "stigmata"],
167
- ["stoma", "stomata"],
168
- ["dogma", "dogmata"],
169
- ["lemma", "lemmata"],
170
- ["schema", "schemata"],
171
- ["anathema", "anathemata"],
172
- // Other irregular rules.
173
- ["ox", "oxen"],
174
- ["axe", "axes"],
175
- ["die", "dice"],
176
- ["yes", "yeses"],
177
- ["foot", "feet"],
178
- ["eave", "eaves"],
179
- ["goose", "geese"],
180
- ["tooth", "teeth"],
181
- ["quiz", "quizzes"],
182
- ["human", "humans"],
183
- ["proof", "proofs"],
184
- ["carve", "carves"],
185
- ["valve", "valves"],
186
- ["looey", "looies"],
187
- ["thief", "thieves"],
188
- ["groove", "grooves"],
189
- ["pickaxe", "pickaxes"],
190
- ["passerby", "passersby"]
191
- ].forEach(function(rule) {
192
- return pluralize2.addIrregularRule(rule[0], rule[1]);
193
- });
194
- [
195
- [/s?$/i, "s"],
196
- [/[^\u0000-\u007F]$/i, "$0"],
197
- [/([^aeiou]ese)$/i, "$1"],
198
- [/(ax|test)is$/i, "$1es"],
199
- [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
200
- [/(e[mn]u)s?$/i, "$1s"],
201
- [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
202
- [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
203
- [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
204
- [/(seraph|cherub)(?:im)?$/i, "$1im"],
205
- [/(her|at|gr)o$/i, "$1oes"],
206
- [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
207
- [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
208
- [/sis$/i, "ses"],
209
- [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
210
- [/([^aeiouy]|qu)y$/i, "$1ies"],
211
- [/([^ch][ieo][ln])ey$/i, "$1ies"],
212
- [/(x|ch|ss|sh|zz)$/i, "$1es"],
213
- [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
214
- [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
215
- [/(pe)(?:rson|ople)$/i, "$1ople"],
216
- [/(child)(?:ren)?$/i, "$1ren"],
217
- [/eaux$/i, "$0"],
218
- [/m[ae]n$/i, "men"],
219
- ["thou", "you"]
220
- ].forEach(function(rule) {
221
- return pluralize2.addPluralRule(rule[0], rule[1]);
222
- });
223
- [
224
- [/s$/i, ""],
225
- [/(ss)$/i, "$1"],
226
- [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
227
- [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
228
- [/ies$/i, "y"],
229
- [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
230
- [/\b(mon|smil)ies$/i, "$1ey"],
231
- [/\b((?:tit)?m|l)ice$/i, "$1ouse"],
232
- [/(seraph|cherub)im$/i, "$1"],
233
- [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
234
- [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
235
- [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
236
- [/(test)(?:is|es)$/i, "$1is"],
237
- [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
238
- [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
239
- [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
240
- [/(alumn|alg|vertebr)ae$/i, "$1a"],
241
- [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
242
- [/(matr|append)ices$/i, "$1ix"],
243
- [/(pe)(rson|ople)$/i, "$1rson"],
244
- [/(child)ren$/i, "$1"],
245
- [/(eau)x?$/i, "$1"],
246
- [/men$/i, "man"]
247
- ].forEach(function(rule) {
248
- return pluralize2.addSingularRule(rule[0], rule[1]);
133
+ [
134
+ // Pronouns.
135
+ ["I", "we"],
136
+ ["me", "us"],
137
+ ["he", "they"],
138
+ ["she", "they"],
139
+ ["them", "them"],
140
+ ["myself", "ourselves"],
141
+ ["yourself", "yourselves"],
142
+ ["itself", "themselves"],
143
+ ["herself", "themselves"],
144
+ ["himself", "themselves"],
145
+ ["themself", "themselves"],
146
+ ["is", "are"],
147
+ ["was", "were"],
148
+ ["has", "have"],
149
+ ["this", "these"],
150
+ ["that", "those"],
151
+ // Words ending in with a consonant and `o`.
152
+ ["echo", "echoes"],
153
+ ["dingo", "dingoes"],
154
+ ["volcano", "volcanoes"],
155
+ ["tornado", "tornadoes"],
156
+ ["torpedo", "torpedoes"],
157
+ // Ends with `us`.
158
+ ["genus", "genera"],
159
+ ["viscus", "viscera"],
160
+ // Ends with `ma`.
161
+ ["stigma", "stigmata"],
162
+ ["stoma", "stomata"],
163
+ ["dogma", "dogmata"],
164
+ ["lemma", "lemmata"],
165
+ ["schema", "schemata"],
166
+ ["anathema", "anathemata"],
167
+ // Other irregular rules.
168
+ ["ox", "oxen"],
169
+ ["axe", "axes"],
170
+ ["die", "dice"],
171
+ ["yes", "yeses"],
172
+ ["foot", "feet"],
173
+ ["eave", "eaves"],
174
+ ["goose", "geese"],
175
+ ["tooth", "teeth"],
176
+ ["quiz", "quizzes"],
177
+ ["human", "humans"],
178
+ ["proof", "proofs"],
179
+ ["carve", "carves"],
180
+ ["valve", "valves"],
181
+ ["looey", "looies"],
182
+ ["thief", "thieves"],
183
+ ["groove", "grooves"],
184
+ ["pickaxe", "pickaxes"],
185
+ ["passerby", "passersby"]
186
+ ].forEach(function(rule) {
187
+ return pluralize2.addIrregularRule(rule[0], rule[1]);
188
+ });
189
+ [
190
+ [/s?$/i, "s"],
191
+ [/[^\u0000-\u007F]$/i, "$0"],
192
+ [/([^aeiou]ese)$/i, "$1"],
193
+ [/(ax|test)is$/i, "$1es"],
194
+ [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
195
+ [/(e[mn]u)s?$/i, "$1s"],
196
+ [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
197
+ [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
198
+ [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
199
+ [/(seraph|cherub)(?:im)?$/i, "$1im"],
200
+ [/(her|at|gr)o$/i, "$1oes"],
201
+ [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
202
+ [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
203
+ [/sis$/i, "ses"],
204
+ [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
205
+ [/([^aeiouy]|qu)y$/i, "$1ies"],
206
+ [/([^ch][ieo][ln])ey$/i, "$1ies"],
207
+ [/(x|ch|ss|sh|zz)$/i, "$1es"],
208
+ [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
209
+ [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
210
+ [/(pe)(?:rson|ople)$/i, "$1ople"],
211
+ [/(child)(?:ren)?$/i, "$1ren"],
212
+ [/eaux$/i, "$0"],
213
+ [/m[ae]n$/i, "men"],
214
+ ["thou", "you"]
215
+ ].forEach(function(rule) {
216
+ return pluralize2.addPluralRule(rule[0], rule[1]);
217
+ });
218
+ [
219
+ [/s$/i, ""],
220
+ [/(ss)$/i, "$1"],
221
+ [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
222
+ [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
223
+ [/ies$/i, "y"],
224
+ [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
225
+ [/\b(mon|smil)ies$/i, "$1ey"],
226
+ [/\b((?:tit)?m|l)ice$/i, "$1ouse"],
227
+ [/(seraph|cherub)im$/i, "$1"],
228
+ [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
229
+ [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
230
+ [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
231
+ [/(test)(?:is|es)$/i, "$1is"],
232
+ [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
233
+ [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
234
+ [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
235
+ [/(alumn|alg|vertebr)ae$/i, "$1a"],
236
+ [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
237
+ [/(matr|append)ices$/i, "$1ix"],
238
+ [/(pe)(rson|ople)$/i, "$1rson"],
239
+ [/(child)ren$/i, "$1"],
240
+ [/(eau)x?$/i, "$1"],
241
+ [/men$/i, "man"]
242
+ ].forEach(function(rule) {
243
+ return pluralize2.addSingularRule(rule[0], rule[1]);
244
+ });
245
+ [
246
+ // Singular words with no plurals.
247
+ "adulthood",
248
+ "advice",
249
+ "agenda",
250
+ "aid",
251
+ "aircraft",
252
+ "alcohol",
253
+ "ammo",
254
+ "analytics",
255
+ "anime",
256
+ "athletics",
257
+ "audio",
258
+ "bison",
259
+ "blood",
260
+ "bream",
261
+ "buffalo",
262
+ "butter",
263
+ "carp",
264
+ "cash",
265
+ "chassis",
266
+ "chess",
267
+ "clothing",
268
+ "cod",
269
+ "commerce",
270
+ "cooperation",
271
+ "corps",
272
+ "debris",
273
+ "diabetes",
274
+ "digestion",
275
+ "elk",
276
+ "energy",
277
+ "equipment",
278
+ "excretion",
279
+ "expertise",
280
+ "firmware",
281
+ "flounder",
282
+ "fun",
283
+ "gallows",
284
+ "garbage",
285
+ "graffiti",
286
+ "hardware",
287
+ "headquarters",
288
+ "health",
289
+ "herpes",
290
+ "highjinks",
291
+ "homework",
292
+ "housework",
293
+ "information",
294
+ "jeans",
295
+ "justice",
296
+ "kudos",
297
+ "labour",
298
+ "literature",
299
+ "machinery",
300
+ "mackerel",
301
+ "mail",
302
+ "media",
303
+ "mews",
304
+ "moose",
305
+ "music",
306
+ "mud",
307
+ "manga",
308
+ "news",
309
+ "only",
310
+ "personnel",
311
+ "pike",
312
+ "plankton",
313
+ "pliers",
314
+ "police",
315
+ "pollution",
316
+ "premises",
317
+ "rain",
318
+ "research",
319
+ "rice",
320
+ "salmon",
321
+ "scissors",
322
+ "series",
323
+ "sewage",
324
+ "shambles",
325
+ "shrimp",
326
+ "software",
327
+ "species",
328
+ "staff",
329
+ "swine",
330
+ "tennis",
331
+ "traffic",
332
+ "transportation",
333
+ "trout",
334
+ "tuna",
335
+ "wealth",
336
+ "welfare",
337
+ "whiting",
338
+ "wildebeest",
339
+ "wildlife",
340
+ "you",
341
+ /pok[eé]mon$/i,
342
+ // Regexes.
343
+ /[^aeiou]ese$/i,
344
+ // "chinese", "japanese"
345
+ /deer$/i,
346
+ // "deer", "reindeer"
347
+ /fish$/i,
348
+ // "fish", "blowfish", "angelfish"
349
+ /measles$/i,
350
+ /o[iu]s$/i,
351
+ // "carnivorous"
352
+ /pox$/i,
353
+ // "chickpox", "smallpox"
354
+ /sheep$/i
355
+ ].forEach(pluralize2.addUncountableRule);
356
+ return pluralize2;
249
357
  });
250
- [
251
- // Singular words with no plurals.
252
- "adulthood",
253
- "advice",
254
- "agenda",
255
- "aid",
256
- "aircraft",
257
- "alcohol",
258
- "ammo",
259
- "analytics",
260
- "anime",
261
- "athletics",
262
- "audio",
263
- "bison",
264
- "blood",
265
- "bream",
266
- "buffalo",
267
- "butter",
268
- "carp",
269
- "cash",
270
- "chassis",
271
- "chess",
272
- "clothing",
273
- "cod",
274
- "commerce",
275
- "cooperation",
276
- "corps",
277
- "debris",
278
- "diabetes",
279
- "digestion",
280
- "elk",
281
- "energy",
282
- "equipment",
283
- "excretion",
284
- "expertise",
285
- "firmware",
286
- "flounder",
287
- "fun",
288
- "gallows",
289
- "garbage",
290
- "graffiti",
291
- "hardware",
292
- "headquarters",
293
- "health",
294
- "herpes",
295
- "highjinks",
296
- "homework",
297
- "housework",
298
- "information",
299
- "jeans",
300
- "justice",
301
- "kudos",
302
- "labour",
303
- "literature",
304
- "machinery",
305
- "mackerel",
306
- "mail",
307
- "media",
308
- "mews",
309
- "moose",
310
- "music",
311
- "mud",
312
- "manga",
313
- "news",
314
- "only",
315
- "personnel",
316
- "pike",
317
- "plankton",
318
- "pliers",
319
- "police",
320
- "pollution",
321
- "premises",
322
- "rain",
323
- "research",
324
- "rice",
325
- "salmon",
326
- "scissors",
327
- "series",
328
- "sewage",
329
- "shambles",
330
- "shrimp",
331
- "software",
332
- "species",
333
- "staff",
334
- "swine",
335
- "tennis",
336
- "traffic",
337
- "transportation",
338
- "trout",
339
- "tuna",
340
- "wealth",
341
- "welfare",
342
- "whiting",
343
- "wildebeest",
344
- "wildlife",
345
- "you",
346
- /pok[eé]mon$/i,
347
- // Regexes.
348
- /[^aeiou]ese$/i,
349
- // "chinese", "japanese"
350
- /deer$/i,
351
- // "deer", "reindeer"
352
- /fish$/i,
353
- // "fish", "blowfish", "angelfish"
354
- /measles$/i,
355
- /o[iu]s$/i,
356
- // "carnivorous"
357
- /pox$/i,
358
- // "chickpox", "smallpox"
359
- /sheep$/i
360
- ].forEach(pluralize2.addUncountableRule);
361
- return pluralize2;
362
- });
363
- })(pluralize$1);
364
- var pluralizeExports = pluralize$1.exports;
358
+ })(pluralize$2);
359
+ return pluralize$2.exports;
360
+ }
361
+ var pluralizeExports = requirePluralize();
365
362
  const plur = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
366
363
  plur.addPluralRule("glomerulus", "glomeruli");
367
364
  plur.addPluralRule("interstitium", "interstitia");
@@ -463,257 +460,260 @@ function unnestMap(map, keys, aggFunc) {
463
460
  };
464
461
  });
465
462
  }
466
- var loglevel = { exports: {} };
467
- (function(module) {
468
- (function(root, definition) {
469
- if (module.exports) {
470
- module.exports = definition();
471
- } else {
472
- root.log = definition();
473
- }
474
- })(commonjsGlobal, function() {
475
- var noop = function() {
476
- };
477
- var undefinedType = "undefined";
478
- var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
479
- var logMethods = [
480
- "trace",
481
- "debug",
482
- "info",
483
- "warn",
484
- "error"
485
- ];
486
- var _loggersByName = {};
487
- var defaultLogger = null;
488
- function bindMethod(obj, methodName) {
489
- var method = obj[methodName];
490
- if (typeof method.bind === "function") {
491
- return method.bind(obj);
463
+ var loglevel$1 = { exports: {} };
464
+ var loglevel = loglevel$1.exports;
465
+ var hasRequiredLoglevel;
466
+ function requireLoglevel() {
467
+ if (hasRequiredLoglevel) return loglevel$1.exports;
468
+ hasRequiredLoglevel = 1;
469
+ (function(module) {
470
+ (function(root, definition) {
471
+ if (module.exports) {
472
+ module.exports = definition();
492
473
  } else {
493
- try {
494
- return Function.prototype.bind.call(method, obj);
495
- } catch (e) {
496
- return function() {
497
- return Function.prototype.apply.apply(method, [obj, arguments]);
498
- };
499
- }
474
+ root.log = definition();
500
475
  }
501
- }
502
- function traceForIE() {
503
- if (console.log) {
504
- if (console.log.apply) {
505
- console.log.apply(console, arguments);
476
+ })(loglevel, function() {
477
+ var noop = function() {
478
+ };
479
+ var undefinedType = "undefined";
480
+ var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
481
+ var logMethods = [
482
+ "trace",
483
+ "debug",
484
+ "info",
485
+ "warn",
486
+ "error"
487
+ ];
488
+ var _loggersByName = {};
489
+ var defaultLogger = null;
490
+ function bindMethod(obj, methodName) {
491
+ var method = obj[methodName];
492
+ if (typeof method.bind === "function") {
493
+ return method.bind(obj);
506
494
  } else {
507
- Function.prototype.apply.apply(console.log, [console, arguments]);
495
+ try {
496
+ return Function.prototype.bind.call(method, obj);
497
+ } catch (e) {
498
+ return function() {
499
+ return Function.prototype.apply.apply(method, [obj, arguments]);
500
+ };
501
+ }
508
502
  }
509
503
  }
510
- if (console.trace)
511
- console.trace();
512
- }
513
- function realMethod(methodName) {
514
- if (methodName === "debug") {
515
- methodName = "log";
516
- }
517
- if (typeof console === undefinedType) {
518
- return false;
519
- } else if (methodName === "trace" && isIE) {
520
- return traceForIE;
521
- } else if (console[methodName] !== void 0) {
522
- return bindMethod(console, methodName);
523
- } else if (console.log !== void 0) {
524
- return bindMethod(console, "log");
525
- } else {
526
- return noop;
527
- }
528
- }
529
- function replaceLoggingMethods() {
530
- var level = this.getLevel();
531
- for (var i = 0; i < logMethods.length; i++) {
532
- var methodName = logMethods[i];
533
- this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
534
- }
535
- this.log = this.debug;
536
- if (typeof console === undefinedType && level < this.levels.SILENT) {
537
- return "No console available for logging";
504
+ function traceForIE() {
505
+ if (console.log) {
506
+ if (console.log.apply) {
507
+ console.log.apply(console, arguments);
508
+ } else {
509
+ Function.prototype.apply.apply(console.log, [console, arguments]);
510
+ }
511
+ }
512
+ if (console.trace) console.trace();
538
513
  }
539
- }
540
- function enableLoggingWhenConsoleArrives(methodName) {
541
- return function() {
542
- if (typeof console !== undefinedType) {
543
- replaceLoggingMethods.call(this);
544
- this[methodName].apply(this, arguments);
514
+ function realMethod(methodName) {
515
+ if (methodName === "debug") {
516
+ methodName = "log";
517
+ }
518
+ if (typeof console === undefinedType) {
519
+ return false;
520
+ } else if (methodName === "trace" && isIE) {
521
+ return traceForIE;
522
+ } else if (console[methodName] !== void 0) {
523
+ return bindMethod(console, methodName);
524
+ } else if (console.log !== void 0) {
525
+ return bindMethod(console, "log");
526
+ } else {
527
+ return noop;
545
528
  }
546
- };
547
- }
548
- function defaultMethodFactory(methodName, _level, _loggerName) {
549
- return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
550
- }
551
- function Logger(name, factory) {
552
- var self2 = this;
553
- var inheritedLevel;
554
- var defaultLevel;
555
- var userLevel;
556
- var storageKey = "loglevel";
557
- if (typeof name === "string") {
558
- storageKey += ":" + name;
559
- } else if (typeof name === "symbol") {
560
- storageKey = void 0;
561
529
  }
562
- function persistLevelIfPossible(levelNum) {
563
- var levelName = (logMethods[levelNum] || "silent").toUpperCase();
564
- if (typeof window === undefinedType || !storageKey)
565
- return;
566
- try {
567
- window.localStorage[storageKey] = levelName;
568
- return;
569
- } catch (ignore) {
530
+ function replaceLoggingMethods() {
531
+ var level = this.getLevel();
532
+ for (var i = 0; i < logMethods.length; i++) {
533
+ var methodName = logMethods[i];
534
+ this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
570
535
  }
571
- try {
572
- window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
573
- } catch (ignore) {
536
+ this.log = this.debug;
537
+ if (typeof console === undefinedType && level < this.levels.SILENT) {
538
+ return "No console available for logging";
574
539
  }
575
540
  }
576
- function getPersistedLevel() {
577
- var storedLevel;
578
- if (typeof window === undefinedType || !storageKey)
579
- return;
580
- try {
581
- storedLevel = window.localStorage[storageKey];
582
- } catch (ignore) {
541
+ function enableLoggingWhenConsoleArrives(methodName) {
542
+ return function() {
543
+ if (typeof console !== undefinedType) {
544
+ replaceLoggingMethods.call(this);
545
+ this[methodName].apply(this, arguments);
546
+ }
547
+ };
548
+ }
549
+ function defaultMethodFactory(methodName, _level, _loggerName) {
550
+ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
551
+ }
552
+ function Logger(name, factory) {
553
+ var self = this;
554
+ var inheritedLevel;
555
+ var defaultLevel;
556
+ var userLevel;
557
+ var storageKey = "loglevel";
558
+ if (typeof name === "string") {
559
+ storageKey += ":" + name;
560
+ } else if (typeof name === "symbol") {
561
+ storageKey = void 0;
583
562
  }
584
- if (typeof storedLevel === undefinedType) {
563
+ function persistLevelIfPossible(levelNum) {
564
+ var levelName = (logMethods[levelNum] || "silent").toUpperCase();
565
+ if (typeof window === undefinedType || !storageKey) return;
585
566
  try {
586
- var cookie = window.document.cookie;
587
- var cookieName = encodeURIComponent(storageKey);
588
- var location = cookie.indexOf(cookieName + "=");
589
- if (location !== -1) {
590
- storedLevel = /^([^;]+)/.exec(
591
- cookie.slice(location + cookieName.length + 1)
592
- )[1];
593
- }
567
+ window.localStorage[storageKey] = levelName;
568
+ return;
569
+ } catch (ignore) {
570
+ }
571
+ try {
572
+ window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
594
573
  } catch (ignore) {
595
574
  }
596
575
  }
597
- if (self2.levels[storedLevel] === void 0) {
598
- storedLevel = void 0;
599
- }
600
- return storedLevel;
601
- }
602
- function clearPersistedLevel() {
603
- if (typeof window === undefinedType || !storageKey)
604
- return;
605
- try {
606
- window.localStorage.removeItem(storageKey);
607
- } catch (ignore) {
576
+ function getPersistedLevel() {
577
+ var storedLevel;
578
+ if (typeof window === undefinedType || !storageKey) return;
579
+ try {
580
+ storedLevel = window.localStorage[storageKey];
581
+ } catch (ignore) {
582
+ }
583
+ if (typeof storedLevel === undefinedType) {
584
+ try {
585
+ var cookie = window.document.cookie;
586
+ var cookieName = encodeURIComponent(storageKey);
587
+ var location = cookie.indexOf(cookieName + "=");
588
+ if (location !== -1) {
589
+ storedLevel = /^([^;]+)/.exec(
590
+ cookie.slice(location + cookieName.length + 1)
591
+ )[1];
592
+ }
593
+ } catch (ignore) {
594
+ }
595
+ }
596
+ if (self.levels[storedLevel] === void 0) {
597
+ storedLevel = void 0;
598
+ }
599
+ return storedLevel;
608
600
  }
609
- try {
610
- window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
611
- } catch (ignore) {
601
+ function clearPersistedLevel() {
602
+ if (typeof window === undefinedType || !storageKey) return;
603
+ try {
604
+ window.localStorage.removeItem(storageKey);
605
+ } catch (ignore) {
606
+ }
607
+ try {
608
+ window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
609
+ } catch (ignore) {
610
+ }
612
611
  }
613
- }
614
- function normalizeLevel(input) {
615
- var level = input;
616
- if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
617
- level = self2.levels[level.toUpperCase()];
612
+ function normalizeLevel(input) {
613
+ var level = input;
614
+ if (typeof level === "string" && self.levels[level.toUpperCase()] !== void 0) {
615
+ level = self.levels[level.toUpperCase()];
616
+ }
617
+ if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
618
+ return level;
619
+ } else {
620
+ throw new TypeError("log.setLevel() called with invalid level: " + input);
621
+ }
618
622
  }
619
- if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
620
- return level;
621
- } else {
622
- throw new TypeError("log.setLevel() called with invalid level: " + input);
623
+ self.name = name;
624
+ self.levels = {
625
+ "TRACE": 0,
626
+ "DEBUG": 1,
627
+ "INFO": 2,
628
+ "WARN": 3,
629
+ "ERROR": 4,
630
+ "SILENT": 5
631
+ };
632
+ self.methodFactory = factory || defaultMethodFactory;
633
+ self.getLevel = function() {
634
+ if (userLevel != null) {
635
+ return userLevel;
636
+ } else if (defaultLevel != null) {
637
+ return defaultLevel;
638
+ } else {
639
+ return inheritedLevel;
640
+ }
641
+ };
642
+ self.setLevel = function(level, persist) {
643
+ userLevel = normalizeLevel(level);
644
+ if (persist !== false) {
645
+ persistLevelIfPossible(userLevel);
646
+ }
647
+ return replaceLoggingMethods.call(self);
648
+ };
649
+ self.setDefaultLevel = function(level) {
650
+ defaultLevel = normalizeLevel(level);
651
+ if (!getPersistedLevel()) {
652
+ self.setLevel(level, false);
653
+ }
654
+ };
655
+ self.resetLevel = function() {
656
+ userLevel = null;
657
+ clearPersistedLevel();
658
+ replaceLoggingMethods.call(self);
659
+ };
660
+ self.enableAll = function(persist) {
661
+ self.setLevel(self.levels.TRACE, persist);
662
+ };
663
+ self.disableAll = function(persist) {
664
+ self.setLevel(self.levels.SILENT, persist);
665
+ };
666
+ self.rebuild = function() {
667
+ if (defaultLogger !== self) {
668
+ inheritedLevel = normalizeLevel(defaultLogger.getLevel());
669
+ }
670
+ replaceLoggingMethods.call(self);
671
+ if (defaultLogger === self) {
672
+ for (var childName in _loggersByName) {
673
+ _loggersByName[childName].rebuild();
674
+ }
675
+ }
676
+ };
677
+ inheritedLevel = normalizeLevel(
678
+ defaultLogger ? defaultLogger.getLevel() : "WARN"
679
+ );
680
+ var initialLevel = getPersistedLevel();
681
+ if (initialLevel != null) {
682
+ userLevel = normalizeLevel(initialLevel);
623
683
  }
684
+ replaceLoggingMethods.call(self);
624
685
  }
625
- self2.name = name;
626
- self2.levels = {
627
- "TRACE": 0,
628
- "DEBUG": 1,
629
- "INFO": 2,
630
- "WARN": 3,
631
- "ERROR": 4,
632
- "SILENT": 5
633
- };
634
- self2.methodFactory = factory || defaultMethodFactory;
635
- self2.getLevel = function() {
636
- if (userLevel != null) {
637
- return userLevel;
638
- } else if (defaultLevel != null) {
639
- return defaultLevel;
640
- } else {
641
- return inheritedLevel;
686
+ defaultLogger = new Logger();
687
+ defaultLogger.getLogger = function getLogger(name) {
688
+ if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
689
+ throw new TypeError("You must supply a name when creating a logger.");
642
690
  }
643
- };
644
- self2.setLevel = function(level, persist) {
645
- userLevel = normalizeLevel(level);
646
- if (persist !== false) {
647
- persistLevelIfPossible(userLevel);
691
+ var logger = _loggersByName[name];
692
+ if (!logger) {
693
+ logger = _loggersByName[name] = new Logger(
694
+ name,
695
+ defaultLogger.methodFactory
696
+ );
648
697
  }
649
- return replaceLoggingMethods.call(self2);
698
+ return logger;
650
699
  };
651
- self2.setDefaultLevel = function(level) {
652
- defaultLevel = normalizeLevel(level);
653
- if (!getPersistedLevel()) {
654
- self2.setLevel(level, false);
700
+ var _log = typeof window !== undefinedType ? window.log : void 0;
701
+ defaultLogger.noConflict = function() {
702
+ if (typeof window !== undefinedType && window.log === defaultLogger) {
703
+ window.log = _log;
655
704
  }
705
+ return defaultLogger;
656
706
  };
657
- self2.resetLevel = function() {
658
- userLevel = null;
659
- clearPersistedLevel();
660
- replaceLoggingMethods.call(self2);
707
+ defaultLogger.getLoggers = function getLoggers() {
708
+ return _loggersByName;
661
709
  };
662
- self2.enableAll = function(persist) {
663
- self2.setLevel(self2.levels.TRACE, persist);
664
- };
665
- self2.disableAll = function(persist) {
666
- self2.setLevel(self2.levels.SILENT, persist);
667
- };
668
- self2.rebuild = function() {
669
- if (defaultLogger !== self2) {
670
- inheritedLevel = normalizeLevel(defaultLogger.getLevel());
671
- }
672
- replaceLoggingMethods.call(self2);
673
- if (defaultLogger === self2) {
674
- for (var childName in _loggersByName) {
675
- _loggersByName[childName].rebuild();
676
- }
677
- }
678
- };
679
- inheritedLevel = normalizeLevel(
680
- defaultLogger ? defaultLogger.getLevel() : "WARN"
681
- );
682
- var initialLevel = getPersistedLevel();
683
- if (initialLevel != null) {
684
- userLevel = normalizeLevel(initialLevel);
685
- }
686
- replaceLoggingMethods.call(self2);
687
- }
688
- defaultLogger = new Logger();
689
- defaultLogger.getLogger = function getLogger(name) {
690
- if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
691
- throw new TypeError("You must supply a name when creating a logger.");
692
- }
693
- var logger = _loggersByName[name];
694
- if (!logger) {
695
- logger = _loggersByName[name] = new Logger(
696
- name,
697
- defaultLogger.methodFactory
698
- );
699
- }
700
- return logger;
701
- };
702
- var _log = typeof window !== undefinedType ? window.log : void 0;
703
- defaultLogger.noConflict = function() {
704
- if (typeof window !== undefinedType && window.log === defaultLogger) {
705
- window.log = _log;
706
- }
710
+ defaultLogger["default"] = defaultLogger;
707
711
  return defaultLogger;
708
- };
709
- defaultLogger.getLoggers = function getLoggers() {
710
- return _loggersByName;
711
- };
712
- defaultLogger["default"] = defaultLogger;
713
- return defaultLogger;
714
- });
715
- })(loglevel);
716
- var loglevelExports = loglevel.exports;
712
+ });
713
+ })(loglevel$1);
714
+ return loglevel$1.exports;
715
+ }
716
+ var loglevelExports = requireLoglevel();
717
717
  const log = /* @__PURE__ */ getDefaultExportFromCjs(loglevelExports);
718
718
  const DEFAULT_DARK_COLOR = [50, 50, 50];
719
719
  const DEFAULT_LIGHT_COLOR = [200, 200, 200];
@@ -821,8 +821,7 @@ function asEsModule(component) {
821
821
  };
822
822
  }
823
823
  function formatBytes(bytes, decimals = 2) {
824
- if (bytes === 0)
825
- return "0 Bytes";
824
+ if (bytes === 0) return "0 Bytes";
826
825
  const k = 1024;
827
826
  const dm = decimals < 0 ? 0 : decimals;
828
827
  const sizes = ["Bytes", "KB", "MB", "GB"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/utils",
3
- "version": "3.5.12",
3
+ "version": "3.6.0",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "lz-string": "^1.4.4",
22
22
  "pluralize": "^8.0.0",
23
23
  "d3-array": "^2.4.0",
24
- "@vitessce/globals": "3.5.12"
24
+ "@vitessce/globals": "3.6.0"
25
25
  },
26
26
  "scripts": {
27
27
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",