@vitessce/zarr 3.6.7 → 3.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +760 -736
- package/dist-tsc/AnnDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.js +16 -1
- package/dist-tsc/anndata-loaders/ComparisonMetadataAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ComparisonMetadataAnndataLoader.js +3 -7
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.js +5 -8
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +4 -8
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.js +4 -11
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.js +2 -6
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.js +5 -10
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.js +3 -7
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts +8 -2
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts.map +1 -1
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.js +6 -6
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +3 -4
- package/package.json +11 -10
- package/src/AnnDataSource.js +1 -0
- package/src/ZarrDataSource.js +15 -1
- package/src/anndata-loaders/ComparisonMetadataAnndataLoader.js +3 -7
- package/src/anndata-loaders/FeatureLabelsAnndataLoader.js +5 -8
- package/src/anndata-loaders/ObsEmbeddingAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +7 -13
- package/src/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsLabelsAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsLocationsAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsPointsAnndataLoader.js +5 -12
- package/src/anndata-loaders/ObsSegmentationsAnndataLoader.js +7 -16
- package/src/anndata-loaders/ObsSetsAnndataLoader.js +2 -10
- package/src/anndata-loaders/ObsSpotsAnndataLoader.js +5 -12
- package/src/anndata-loaders/SampleEdgesAnndataLoader.js +8 -15
- package/src/anndata-loaders/SampleSetsAnndataLoader.js +6 -14
- package/src/genomic-loaders/GenomicProfilesZarrLoader.js +14 -14
- package/src/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +6 -7
package/dist/index.js
CHANGED
|
@@ -7,6 +7,289 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
7
7
|
var __privateSet = (obj, member, value, setter2) => (__accessCheck(obj, member, "write to private field"), setter2 ? setter2.call(obj, value) : member.set(obj, value), value);
|
|
8
8
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
9
|
var _bytes, _encoder, _data, _stride, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _encoder_config, _decoder_config, _order, _inverseOrder, _shape2, _strides, _metadata, _metadata2, _a2, _overrides, _use_suffix_request, _FetchStore_instances, merge_init_fn, _overrides2, _refs, _opts, _overrides3;
|
|
10
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
11
|
+
function getDefaultExportFromCjs(x) {
|
|
12
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
13
|
+
}
|
|
14
|
+
function getAugmentedNamespace(n) {
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
16
|
+
var f = n.default;
|
|
17
|
+
if (typeof f == "function") {
|
|
18
|
+
var a = function a2() {
|
|
19
|
+
if (this instanceof a2) {
|
|
20
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
21
|
+
}
|
|
22
|
+
return f.apply(this, arguments);
|
|
23
|
+
};
|
|
24
|
+
a.prototype = f.prototype;
|
|
25
|
+
} else a = {};
|
|
26
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
27
|
+
Object.keys(n).forEach(function(k) {
|
|
28
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
29
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function() {
|
|
32
|
+
return n[k];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return a;
|
|
37
|
+
}
|
|
38
|
+
var loglevel$1 = { exports: {} };
|
|
39
|
+
var loglevel = loglevel$1.exports;
|
|
40
|
+
var hasRequiredLoglevel;
|
|
41
|
+
function requireLoglevel() {
|
|
42
|
+
if (hasRequiredLoglevel) return loglevel$1.exports;
|
|
43
|
+
hasRequiredLoglevel = 1;
|
|
44
|
+
(function(module2) {
|
|
45
|
+
(function(root2, definition) {
|
|
46
|
+
if (module2.exports) {
|
|
47
|
+
module2.exports = definition();
|
|
48
|
+
} else {
|
|
49
|
+
root2.log = definition();
|
|
50
|
+
}
|
|
51
|
+
})(loglevel, function() {
|
|
52
|
+
var noop = function() {
|
|
53
|
+
};
|
|
54
|
+
var undefinedType2 = "undefined";
|
|
55
|
+
var isIE = typeof window !== undefinedType2 && typeof window.navigator !== undefinedType2 && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
|
56
|
+
var logMethods = [
|
|
57
|
+
"trace",
|
|
58
|
+
"debug",
|
|
59
|
+
"info",
|
|
60
|
+
"warn",
|
|
61
|
+
"error"
|
|
62
|
+
];
|
|
63
|
+
var _loggersByName = {};
|
|
64
|
+
var defaultLogger = null;
|
|
65
|
+
function bindMethod(obj, methodName) {
|
|
66
|
+
var method = obj[methodName];
|
|
67
|
+
if (typeof method.bind === "function") {
|
|
68
|
+
return method.bind(obj);
|
|
69
|
+
} else {
|
|
70
|
+
try {
|
|
71
|
+
return Function.prototype.bind.call(method, obj);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
return function() {
|
|
74
|
+
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function traceForIE() {
|
|
80
|
+
if (console.log) {
|
|
81
|
+
if (console.log.apply) {
|
|
82
|
+
console.log.apply(console, arguments);
|
|
83
|
+
} else {
|
|
84
|
+
Function.prototype.apply.apply(console.log, [console, arguments]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (console.trace) console.trace();
|
|
88
|
+
}
|
|
89
|
+
function realMethod(methodName) {
|
|
90
|
+
if (methodName === "debug") {
|
|
91
|
+
methodName = "log";
|
|
92
|
+
}
|
|
93
|
+
if (typeof console === undefinedType2) {
|
|
94
|
+
return false;
|
|
95
|
+
} else if (methodName === "trace" && isIE) {
|
|
96
|
+
return traceForIE;
|
|
97
|
+
} else if (console[methodName] !== void 0) {
|
|
98
|
+
return bindMethod(console, methodName);
|
|
99
|
+
} else if (console.log !== void 0) {
|
|
100
|
+
return bindMethod(console, "log");
|
|
101
|
+
} else {
|
|
102
|
+
return noop;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function replaceLoggingMethods() {
|
|
106
|
+
var level = this.getLevel();
|
|
107
|
+
for (var i = 0; i < logMethods.length; i++) {
|
|
108
|
+
var methodName = logMethods[i];
|
|
109
|
+
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
110
|
+
}
|
|
111
|
+
this.log = this.debug;
|
|
112
|
+
if (typeof console === undefinedType2 && level < this.levels.SILENT) {
|
|
113
|
+
return "No console available for logging";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function enableLoggingWhenConsoleArrives(methodName) {
|
|
117
|
+
return function() {
|
|
118
|
+
if (typeof console !== undefinedType2) {
|
|
119
|
+
replaceLoggingMethods.call(this);
|
|
120
|
+
this[methodName].apply(this, arguments);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function defaultMethodFactory(methodName, _level, _loggerName) {
|
|
125
|
+
return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
function Logger(name, factory) {
|
|
128
|
+
var self2 = this;
|
|
129
|
+
var inheritedLevel;
|
|
130
|
+
var defaultLevel;
|
|
131
|
+
var userLevel;
|
|
132
|
+
var storageKey = "loglevel";
|
|
133
|
+
if (typeof name === "string") {
|
|
134
|
+
storageKey += ":" + name;
|
|
135
|
+
} else if (typeof name === "symbol") {
|
|
136
|
+
storageKey = void 0;
|
|
137
|
+
}
|
|
138
|
+
function persistLevelIfPossible(levelNum) {
|
|
139
|
+
var levelName = (logMethods[levelNum] || "silent").toUpperCase();
|
|
140
|
+
if (typeof window === undefinedType2 || !storageKey) return;
|
|
141
|
+
try {
|
|
142
|
+
window.localStorage[storageKey] = levelName;
|
|
143
|
+
return;
|
|
144
|
+
} catch (ignore) {
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
|
|
148
|
+
} catch (ignore) {
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function getPersistedLevel() {
|
|
152
|
+
var storedLevel;
|
|
153
|
+
if (typeof window === undefinedType2 || !storageKey) return;
|
|
154
|
+
try {
|
|
155
|
+
storedLevel = window.localStorage[storageKey];
|
|
156
|
+
} catch (ignore) {
|
|
157
|
+
}
|
|
158
|
+
if (typeof storedLevel === undefinedType2) {
|
|
159
|
+
try {
|
|
160
|
+
var cookie = window.document.cookie;
|
|
161
|
+
var cookieName = encodeURIComponent(storageKey);
|
|
162
|
+
var location = cookie.indexOf(cookieName + "=");
|
|
163
|
+
if (location !== -1) {
|
|
164
|
+
storedLevel = /^([^;]+)/.exec(
|
|
165
|
+
cookie.slice(location + cookieName.length + 1)
|
|
166
|
+
)[1];
|
|
167
|
+
}
|
|
168
|
+
} catch (ignore) {
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (self2.levels[storedLevel] === void 0) {
|
|
172
|
+
storedLevel = void 0;
|
|
173
|
+
}
|
|
174
|
+
return storedLevel;
|
|
175
|
+
}
|
|
176
|
+
function clearPersistedLevel() {
|
|
177
|
+
if (typeof window === undefinedType2 || !storageKey) return;
|
|
178
|
+
try {
|
|
179
|
+
window.localStorage.removeItem(storageKey);
|
|
180
|
+
} catch (ignore) {
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
184
|
+
} catch (ignore) {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function normalizeLevel(input) {
|
|
188
|
+
var level = input;
|
|
189
|
+
if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
|
|
190
|
+
level = self2.levels[level.toUpperCase()];
|
|
191
|
+
}
|
|
192
|
+
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
193
|
+
return level;
|
|
194
|
+
} else {
|
|
195
|
+
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
self2.name = name;
|
|
199
|
+
self2.levels = {
|
|
200
|
+
"TRACE": 0,
|
|
201
|
+
"DEBUG": 1,
|
|
202
|
+
"INFO": 2,
|
|
203
|
+
"WARN": 3,
|
|
204
|
+
"ERROR": 4,
|
|
205
|
+
"SILENT": 5
|
|
206
|
+
};
|
|
207
|
+
self2.methodFactory = factory || defaultMethodFactory;
|
|
208
|
+
self2.getLevel = function() {
|
|
209
|
+
if (userLevel != null) {
|
|
210
|
+
return userLevel;
|
|
211
|
+
} else if (defaultLevel != null) {
|
|
212
|
+
return defaultLevel;
|
|
213
|
+
} else {
|
|
214
|
+
return inheritedLevel;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
self2.setLevel = function(level, persist) {
|
|
218
|
+
userLevel = normalizeLevel(level);
|
|
219
|
+
if (persist !== false) {
|
|
220
|
+
persistLevelIfPossible(userLevel);
|
|
221
|
+
}
|
|
222
|
+
return replaceLoggingMethods.call(self2);
|
|
223
|
+
};
|
|
224
|
+
self2.setDefaultLevel = function(level) {
|
|
225
|
+
defaultLevel = normalizeLevel(level);
|
|
226
|
+
if (!getPersistedLevel()) {
|
|
227
|
+
self2.setLevel(level, false);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
self2.resetLevel = function() {
|
|
231
|
+
userLevel = null;
|
|
232
|
+
clearPersistedLevel();
|
|
233
|
+
replaceLoggingMethods.call(self2);
|
|
234
|
+
};
|
|
235
|
+
self2.enableAll = function(persist) {
|
|
236
|
+
self2.setLevel(self2.levels.TRACE, persist);
|
|
237
|
+
};
|
|
238
|
+
self2.disableAll = function(persist) {
|
|
239
|
+
self2.setLevel(self2.levels.SILENT, persist);
|
|
240
|
+
};
|
|
241
|
+
self2.rebuild = function() {
|
|
242
|
+
if (defaultLogger !== self2) {
|
|
243
|
+
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
244
|
+
}
|
|
245
|
+
replaceLoggingMethods.call(self2);
|
|
246
|
+
if (defaultLogger === self2) {
|
|
247
|
+
for (var childName in _loggersByName) {
|
|
248
|
+
_loggersByName[childName].rebuild();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
inheritedLevel = normalizeLevel(
|
|
253
|
+
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
254
|
+
);
|
|
255
|
+
var initialLevel = getPersistedLevel();
|
|
256
|
+
if (initialLevel != null) {
|
|
257
|
+
userLevel = normalizeLevel(initialLevel);
|
|
258
|
+
}
|
|
259
|
+
replaceLoggingMethods.call(self2);
|
|
260
|
+
}
|
|
261
|
+
defaultLogger = new Logger();
|
|
262
|
+
defaultLogger.getLogger = function getLogger(name) {
|
|
263
|
+
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
264
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
265
|
+
}
|
|
266
|
+
var logger = _loggersByName[name];
|
|
267
|
+
if (!logger) {
|
|
268
|
+
logger = _loggersByName[name] = new Logger(
|
|
269
|
+
name,
|
|
270
|
+
defaultLogger.methodFactory
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return logger;
|
|
274
|
+
};
|
|
275
|
+
var _log = typeof window !== undefinedType2 ? window.log : void 0;
|
|
276
|
+
defaultLogger.noConflict = function() {
|
|
277
|
+
if (typeof window !== undefinedType2 && window.log === defaultLogger) {
|
|
278
|
+
window.log = _log;
|
|
279
|
+
}
|
|
280
|
+
return defaultLogger;
|
|
281
|
+
};
|
|
282
|
+
defaultLogger.getLoggers = function getLoggers() {
|
|
283
|
+
return _loggersByName;
|
|
284
|
+
};
|
|
285
|
+
defaultLogger["default"] = defaultLogger;
|
|
286
|
+
return defaultLogger;
|
|
287
|
+
});
|
|
288
|
+
})(loglevel$1);
|
|
289
|
+
return loglevel$1.exports;
|
|
290
|
+
}
|
|
291
|
+
var loglevelExports = requireLoglevel();
|
|
292
|
+
const log = /* @__PURE__ */ getDefaultExportFromCjs(loglevelExports);
|
|
10
293
|
class NodeNotFoundError extends Error {
|
|
11
294
|
constructor(context, options = {}) {
|
|
12
295
|
super(`Node not found: ${context}`, options);
|
|
@@ -2377,625 +2660,342 @@ async function unzipRaw(source) {
|
|
|
2377
2660
|
} else if (typeof source.getLength === "function" && typeof source.read === "function") {
|
|
2378
2661
|
reader = source;
|
|
2379
2662
|
} else {
|
|
2380
|
-
throw new Error("unsupported source type");
|
|
2381
|
-
}
|
|
2382
|
-
const totalLength = await reader.getLength();
|
|
2383
|
-
if (totalLength > Number.MAX_SAFE_INTEGER) {
|
|
2384
|
-
throw new Error(`file too large. size: ${totalLength}. Only file sizes up 4503599627370496 bytes are supported`);
|
|
2385
|
-
}
|
|
2386
|
-
return await findEndOfCentralDirector(reader, totalLength);
|
|
2387
|
-
}
|
|
2388
|
-
async function unzip(source) {
|
|
2389
|
-
const { zip, entries } = await unzipRaw(source);
|
|
2390
|
-
return {
|
|
2391
|
-
zip,
|
|
2392
|
-
entries: Object.fromEntries(entries.map((v) => [v.name, v]))
|
|
2393
|
-
};
|
|
2394
|
-
}
|
|
2395
|
-
class BlobReader2 {
|
|
2396
|
-
constructor(blob) {
|
|
2397
|
-
this.blob = blob;
|
|
2398
|
-
}
|
|
2399
|
-
async getLength() {
|
|
2400
|
-
return this.blob.size;
|
|
2401
|
-
}
|
|
2402
|
-
async read(offset, length) {
|
|
2403
|
-
const blob = this.blob.slice(offset, offset + length);
|
|
2404
|
-
return new Uint8Array(await blob.arrayBuffer());
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
class HTTPRangeReader {
|
|
2408
|
-
constructor(url, opts = {}) {
|
|
2409
|
-
__privateAdd(this, _overrides2);
|
|
2410
|
-
this.url = url;
|
|
2411
|
-
__privateSet(this, _overrides2, opts.overrides ?? {});
|
|
2412
|
-
}
|
|
2413
|
-
async getLength() {
|
|
2414
|
-
if (this.length === void 0) {
|
|
2415
|
-
const req = await fetch(this.url, {
|
|
2416
|
-
...__privateGet(this, _overrides2),
|
|
2417
|
-
method: "HEAD"
|
|
2418
|
-
});
|
|
2419
|
-
assert(req.ok, `failed http request ${this.url}, status: ${req.status}: ${req.statusText}`);
|
|
2420
|
-
this.length = Number(req.headers.get("content-length"));
|
|
2421
|
-
if (Number.isNaN(this.length)) {
|
|
2422
|
-
throw Error("could not get length");
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
return this.length;
|
|
2426
|
-
}
|
|
2427
|
-
async read(offset, size) {
|
|
2428
|
-
if (size === 0) {
|
|
2429
|
-
return new Uint8Array(0);
|
|
2430
|
-
}
|
|
2431
|
-
const req = await fetch_range(this.url, offset, size, __privateGet(this, _overrides2));
|
|
2432
|
-
assert(req.ok, `failed http request ${this.url}, status: ${req.status} offset: ${offset} size: ${size}: ${req.statusText}`);
|
|
2433
|
-
return new Uint8Array(await req.arrayBuffer());
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
_overrides2 = new WeakMap();
|
|
2437
|
-
class ZipFileStore {
|
|
2438
|
-
constructor(reader) {
|
|
2439
|
-
this.info = unzip(reader);
|
|
2440
|
-
}
|
|
2441
|
-
async get(key) {
|
|
2442
|
-
let entry = (await this.info).entries[strip_prefix(key)];
|
|
2443
|
-
if (!entry)
|
|
2444
|
-
return;
|
|
2445
|
-
return new Uint8Array(await entry.arrayBuffer());
|
|
2446
|
-
}
|
|
2447
|
-
async has(key) {
|
|
2448
|
-
return strip_prefix(key) in (await this.info).entries;
|
|
2449
|
-
}
|
|
2450
|
-
static fromUrl(href, opts = {}) {
|
|
2451
|
-
return new ZipFileStore(new HTTPRangeReader(href, opts));
|
|
2452
|
-
}
|
|
2453
|
-
static fromBlob(blob) {
|
|
2454
|
-
return new ZipFileStore(new BlobReader2(blob));
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
function parse$1(template, re2 = /{{(.*?)}}/) {
|
|
2458
|
-
let result = re2.exec(template);
|
|
2459
|
-
const parts = [];
|
|
2460
|
-
let pos;
|
|
2461
|
-
while (result) {
|
|
2462
|
-
pos = result.index;
|
|
2463
|
-
if (pos !== 0) {
|
|
2464
|
-
parts.push({ match: false, str: template.substring(0, pos) });
|
|
2465
|
-
template = template.slice(pos);
|
|
2466
|
-
}
|
|
2467
|
-
parts.push({ match: true, str: result[0] });
|
|
2468
|
-
template = template.slice(result[0].length);
|
|
2469
|
-
result = re2.exec(template);
|
|
2470
|
-
}
|
|
2471
|
-
if (template) {
|
|
2472
|
-
parts.push({ match: false, str: template });
|
|
2473
|
-
}
|
|
2474
|
-
return parts;
|
|
2475
|
-
}
|
|
2476
|
-
function matchFn(str) {
|
|
2477
|
-
const match = str.match(/(?<fname>[A-Z_][A-Z_1-9]*)\((?<args>[^)]+)\)/i);
|
|
2478
|
-
if (!(match == null ? void 0 : match.groups)) return;
|
|
2479
|
-
const { fname, args } = match.groups;
|
|
2480
|
-
const ctx = Object.fromEntries(
|
|
2481
|
-
args.split(",").map((kwarg) => {
|
|
2482
|
-
var _a3;
|
|
2483
|
-
const { key, num, str: str2 } = ((_a3 = kwarg.match(
|
|
2484
|
-
/(?<key>[a-z_0-9]*)\s*=\s*((?<num>[0-9.]+)|('|")(?<str>.*)('|"))/i
|
|
2485
|
-
)) == null ? void 0 : _a3.groups) ?? {};
|
|
2486
|
-
if (!key || !(num || str2)) {
|
|
2487
|
-
throw Error(`Failed to match fn kwarg: ${kwarg}`);
|
|
2488
|
-
}
|
|
2489
|
-
return [key, num ? Number(num) : str2];
|
|
2490
|
-
})
|
|
2491
|
-
);
|
|
2492
|
-
return { fname, ctx };
|
|
2493
|
-
}
|
|
2494
|
-
const alphabet = "abcdefghijklmnopqrstuvwxyz";
|
|
2495
|
-
const numbers = "01234569789";
|
|
2496
|
-
const expr = "()*/+-";
|
|
2497
|
-
const space = " ";
|
|
2498
|
-
const valid$1 = new Set(
|
|
2499
|
-
alphabet + alphabet.toUpperCase() + numbers + expr + space
|
|
2500
|
-
);
|
|
2501
|
-
function matchMathEval(str) {
|
|
2502
|
-
for (let i = 0; i < str.length; i++) {
|
|
2503
|
-
if (!valid$1.has(str.charAt(i))) return;
|
|
2504
|
-
}
|
|
2505
|
-
return parse$1(str, /[A-Za-z_][A-Za-z0-9_]*/gi);
|
|
2506
|
-
}
|
|
2507
|
-
function render(template, context) {
|
|
2508
|
-
const grps = parse$1(template);
|
|
2509
|
-
return grps.map((grp) => {
|
|
2510
|
-
if (!grp.match) {
|
|
2511
|
-
return grp.str;
|
|
2512
|
-
}
|
|
2513
|
-
let inner = grp.str.split(/{{|}}/).filter(Boolean)[0].trim();
|
|
2514
|
-
if (inner in context) {
|
|
2515
|
-
return context[inner];
|
|
2516
|
-
}
|
|
2517
|
-
const fnMatch = matchFn(inner);
|
|
2518
|
-
if (fnMatch) {
|
|
2519
|
-
const { fname, ctx } = fnMatch;
|
|
2520
|
-
const fn = context[fname];
|
|
2521
|
-
if (typeof fn === "function") {
|
|
2522
|
-
return fn(ctx);
|
|
2523
|
-
}
|
|
2524
|
-
throw Error(
|
|
2525
|
-
`Cannot find function named ${fname} in rendering context.`
|
|
2526
|
-
);
|
|
2527
|
-
}
|
|
2528
|
-
const matches = matchMathEval(inner);
|
|
2529
|
-
if (matches) {
|
|
2530
|
-
const exprParts = matches.map((match) => {
|
|
2531
|
-
if (!match.match) return match.str;
|
|
2532
|
-
const value = context[match.str];
|
|
2533
|
-
if (value == null) {
|
|
2534
|
-
throw Error(
|
|
2535
|
-
`Cannot find number named ${match.str} in rendering context.`
|
|
2536
|
-
);
|
|
2537
|
-
}
|
|
2538
|
-
if (typeof value !== "number") {
|
|
2539
|
-
throw Error(
|
|
2540
|
-
`The provided value for ${match.str} must be a number.`
|
|
2541
|
-
);
|
|
2542
|
-
}
|
|
2543
|
-
return value;
|
|
2544
|
-
});
|
|
2545
|
-
return Function('"use strict";return (' + exprParts.join("") + ")")();
|
|
2546
|
-
}
|
|
2547
|
-
throw new Error(`Unable to match ${grp.str}`);
|
|
2548
|
-
}).join("");
|
|
2549
|
-
}
|
|
2550
|
-
function parse(spec, renderString = render) {
|
|
2551
|
-
return "version" in spec ? parseV1(spec, renderString) : parseV0(spec);
|
|
2552
|
-
}
|
|
2553
|
-
function parseV0(spec) {
|
|
2554
|
-
return new Map(Object.entries(spec));
|
|
2555
|
-
}
|
|
2556
|
-
function parseV1(spec, renderString) {
|
|
2557
|
-
var _a3;
|
|
2558
|
-
const context = {};
|
|
2559
|
-
for (const [key, template] of Object.entries(spec.templates ?? {})) {
|
|
2560
|
-
if (template.includes("{{")) {
|
|
2561
|
-
context[key] = (ctx) => renderString(template, ctx);
|
|
2562
|
-
} else {
|
|
2563
|
-
context[key] = template;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
const render2 = (t, o) => {
|
|
2567
|
-
return renderString(t, { ...context, ...o });
|
|
2568
|
-
};
|
|
2569
|
-
const refs = /* @__PURE__ */ new Map();
|
|
2570
|
-
for (const [key, ref] of Object.entries(spec.refs ?? {})) {
|
|
2571
|
-
if (typeof ref === "string") {
|
|
2572
|
-
refs.set(key, ref);
|
|
2573
|
-
} else {
|
|
2574
|
-
const url = ((_a3 = ref[0]) == null ? void 0 : _a3.includes("{{")) ? render2(ref[0]) : ref[0];
|
|
2575
|
-
refs.set(key, ref.length === 1 ? [url] : [url, ref[1], ref[2]]);
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
for (const g of spec.gen ?? []) {
|
|
2579
|
-
for (const dims of iterDims(g.dimensions)) {
|
|
2580
|
-
const key = render2(g.key, dims);
|
|
2581
|
-
const url = render2(g.url, dims);
|
|
2582
|
-
if ("offset" in g && "length" in g) {
|
|
2583
|
-
const offset = render2(g.offset, dims);
|
|
2584
|
-
const length = render2(g.length, dims);
|
|
2585
|
-
refs.set(key, [url, parseInt(offset), parseInt(length)]);
|
|
2586
|
-
} else {
|
|
2587
|
-
refs.set(key, [url]);
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
return refs;
|
|
2592
|
-
}
|
|
2593
|
-
function* iterDims(dimensions) {
|
|
2594
|
-
const keys2 = Object.keys(dimensions);
|
|
2595
|
-
const iterables = Object.values(dimensions).map(
|
|
2596
|
-
(i) => Array.isArray(i) ? i : [...range$2(i)]
|
|
2597
|
-
);
|
|
2598
|
-
for (const values of product(...iterables)) {
|
|
2599
|
-
yield Object.fromEntries(keys2.map((key, i) => [key, values[i]]));
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
function* product(...iterables) {
|
|
2603
|
-
if (iterables.length === 0) {
|
|
2604
|
-
return;
|
|
2605
|
-
}
|
|
2606
|
-
const iterators = iterables.map((it) => it[Symbol.iterator]());
|
|
2607
|
-
const results = iterators.map((it) => it.next());
|
|
2608
|
-
if (results.some((r) => r.done)) {
|
|
2609
|
-
throw new Error("Input contains an empty iterator.");
|
|
2610
|
-
}
|
|
2611
|
-
for (let i = 0; ; ) {
|
|
2612
|
-
if (results[i].done) {
|
|
2613
|
-
iterators[i] = iterables[i][Symbol.iterator]();
|
|
2614
|
-
results[i] = iterators[i].next();
|
|
2615
|
-
if (++i >= iterators.length) {
|
|
2616
|
-
return;
|
|
2617
|
-
}
|
|
2618
|
-
} else {
|
|
2619
|
-
yield results.map(({ value }) => value);
|
|
2620
|
-
i = 0;
|
|
2621
|
-
}
|
|
2622
|
-
results[i] = iterators[i].next();
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
function* range$2({ stop, start = 0, step = 1 }) {
|
|
2626
|
-
for (let i = start; i < stop; i += step) {
|
|
2627
|
-
yield i;
|
|
2663
|
+
throw new Error("unsupported source type");
|
|
2628
2664
|
}
|
|
2629
|
-
|
|
2630
|
-
(
|
|
2631
|
-
|
|
2632
|
-
for (var i = 0; i < 64; i++) {
|
|
2633
|
-
table2[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
2665
|
+
const totalLength = await reader.getLength();
|
|
2666
|
+
if (totalLength > Number.MAX_SAFE_INTEGER) {
|
|
2667
|
+
throw new Error(`file too large. size: ${totalLength}. Only file sizes up 4503599627370496 bytes are supported`);
|
|
2634
2668
|
}
|
|
2635
|
-
return (
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
var c0 = table2[base64.charCodeAt(i2++)], c1 = table2[base64.charCodeAt(i2++)];
|
|
2643
|
-
var c2 = table2[base64.charCodeAt(i2++)], c3 = table2[base64.charCodeAt(i2++)];
|
|
2644
|
-
bytes[j++] = c0 << 2 | c1 >> 4;
|
|
2645
|
-
bytes[j++] = c1 << 4 | c2 >> 2;
|
|
2646
|
-
bytes[j++] = c2 << 6 | c3;
|
|
2647
|
-
}
|
|
2648
|
-
return bytes;
|
|
2669
|
+
return await findEndOfCentralDirector(reader, totalLength);
|
|
2670
|
+
}
|
|
2671
|
+
async function unzip(source) {
|
|
2672
|
+
const { zip, entries } = await unzipRaw(source);
|
|
2673
|
+
return {
|
|
2674
|
+
zip,
|
|
2675
|
+
entries: Object.fromEntries(entries.map((v) => [v.name, v]))
|
|
2649
2676
|
};
|
|
2650
|
-
})();
|
|
2651
|
-
new TextEncoder();
|
|
2652
|
-
let table = new Uint8Array(128);
|
|
2653
|
-
for (let i = 0; i < 64; i++) {
|
|
2654
|
-
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
2655
2677
|
}
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
const
|
|
2665
|
-
|
|
2666
|
-
const c3 = table[base64.charCodeAt(i++)];
|
|
2667
|
-
bytes[j++] = c0 << 2 | c1 >> 4;
|
|
2668
|
-
bytes[j++] = c1 << 4 | c2 >> 2;
|
|
2669
|
-
bytes[j++] = c2 << 6 | c3;
|
|
2678
|
+
class BlobReader2 {
|
|
2679
|
+
constructor(blob) {
|
|
2680
|
+
this.blob = blob;
|
|
2681
|
+
}
|
|
2682
|
+
async getLength() {
|
|
2683
|
+
return this.blob.size;
|
|
2684
|
+
}
|
|
2685
|
+
async read(offset, length) {
|
|
2686
|
+
const blob = this.blob.slice(offset, offset + length);
|
|
2687
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
2670
2688
|
}
|
|
2671
|
-
return bytes;
|
|
2672
2689
|
}
|
|
2673
|
-
|
|
2674
|
-
constructor(
|
|
2675
|
-
__privateAdd(this,
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
__privateSet(this, _refs, Promise.resolve(refs));
|
|
2679
|
-
__privateSet(this, _opts, opts);
|
|
2680
|
-
__privateSet(this, _overrides3, opts.overrides || {});
|
|
2690
|
+
class HTTPRangeReader {
|
|
2691
|
+
constructor(url, opts = {}) {
|
|
2692
|
+
__privateAdd(this, _overrides2);
|
|
2693
|
+
this.url = url;
|
|
2694
|
+
__privateSet(this, _overrides2, opts.overrides ?? {});
|
|
2681
2695
|
}
|
|
2682
|
-
async
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2696
|
+
async getLength() {
|
|
2697
|
+
if (this.length === void 0) {
|
|
2698
|
+
const req = await fetch(this.url, {
|
|
2699
|
+
...__privateGet(this, _overrides2),
|
|
2700
|
+
method: "HEAD"
|
|
2701
|
+
});
|
|
2702
|
+
assert(req.ok, `failed http request ${this.url}, status: ${req.status}: ${req.statusText}`);
|
|
2703
|
+
this.length = Number(req.headers.get("content-length"));
|
|
2704
|
+
if (Number.isNaN(this.length)) {
|
|
2705
|
+
throw Error("could not get length");
|
|
2689
2706
|
}
|
|
2690
|
-
return new TextEncoder().encode(ref);
|
|
2691
|
-
}
|
|
2692
|
-
let [urlOrNull, offset, size] = ref;
|
|
2693
|
-
let url = urlOrNull ?? __privateGet(this, _opts).target;
|
|
2694
|
-
if (!url) {
|
|
2695
|
-
throw Error(`No url for key ${key}, and no target url provided.`);
|
|
2696
2707
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2708
|
+
return this.length;
|
|
2709
|
+
}
|
|
2710
|
+
async read(offset, size) {
|
|
2711
|
+
if (size === 0) {
|
|
2712
|
+
return new Uint8Array(0);
|
|
2700
2713
|
}
|
|
2701
|
-
|
|
2714
|
+
const req = await fetch_range(this.url, offset, size, __privateGet(this, _overrides2));
|
|
2715
|
+
assert(req.ok, `failed http request ${this.url}, status: ${req.status} offset: ${offset} size: ${size}: ${req.statusText}`);
|
|
2716
|
+
return new Uint8Array(await req.arrayBuffer());
|
|
2702
2717
|
}
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2718
|
+
}
|
|
2719
|
+
_overrides2 = new WeakMap();
|
|
2720
|
+
class ZipFileStore {
|
|
2721
|
+
constructor(reader) {
|
|
2722
|
+
this.info = unzip(reader);
|
|
2706
2723
|
}
|
|
2707
|
-
|
|
2708
|
-
let
|
|
2709
|
-
|
|
2724
|
+
async get(key) {
|
|
2725
|
+
let entry = (await this.info).entries[strip_prefix(key)];
|
|
2726
|
+
if (!entry)
|
|
2727
|
+
return;
|
|
2728
|
+
return new Uint8Array(await entry.arrayBuffer());
|
|
2729
|
+
}
|
|
2730
|
+
async has(key) {
|
|
2731
|
+
return strip_prefix(key) in (await this.info).entries;
|
|
2732
|
+
}
|
|
2733
|
+
static fromUrl(href, opts = {}) {
|
|
2734
|
+
return new ZipFileStore(new HTTPRangeReader(href, opts));
|
|
2735
|
+
}
|
|
2736
|
+
static fromBlob(blob) {
|
|
2737
|
+
return new ZipFileStore(new BlobReader2(blob));
|
|
2710
2738
|
}
|
|
2711
|
-
};
|
|
2712
|
-
_refs = new WeakMap();
|
|
2713
|
-
_opts = new WeakMap();
|
|
2714
|
-
_overrides3 = new WeakMap();
|
|
2715
|
-
let ReferenceStore = _ReferenceStore;
|
|
2716
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2717
|
-
function getDefaultExportFromCjs(x) {
|
|
2718
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2719
|
-
}
|
|
2720
|
-
function getAugmentedNamespace(n) {
|
|
2721
|
-
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
2722
|
-
var f = n.default;
|
|
2723
|
-
if (typeof f == "function") {
|
|
2724
|
-
var a = function a2() {
|
|
2725
|
-
if (this instanceof a2) {
|
|
2726
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
2727
|
-
}
|
|
2728
|
-
return f.apply(this, arguments);
|
|
2729
|
-
};
|
|
2730
|
-
a.prototype = f.prototype;
|
|
2731
|
-
} else a = {};
|
|
2732
|
-
Object.defineProperty(a, "__esModule", { value: true });
|
|
2733
|
-
Object.keys(n).forEach(function(k) {
|
|
2734
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2735
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
2736
|
-
enumerable: true,
|
|
2737
|
-
get: function() {
|
|
2738
|
-
return n[k];
|
|
2739
|
-
}
|
|
2740
|
-
});
|
|
2741
|
-
});
|
|
2742
|
-
return a;
|
|
2743
2739
|
}
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
var
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
} else {
|
|
2776
|
-
try {
|
|
2777
|
-
return Function.prototype.bind.call(method, obj);
|
|
2778
|
-
} catch (e) {
|
|
2779
|
-
return function() {
|
|
2780
|
-
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
2781
|
-
};
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
function traceForIE() {
|
|
2786
|
-
if (console.log) {
|
|
2787
|
-
if (console.log.apply) {
|
|
2788
|
-
console.log.apply(console, arguments);
|
|
2789
|
-
} else {
|
|
2790
|
-
Function.prototype.apply.apply(console.log, [console, arguments]);
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
if (console.trace) console.trace();
|
|
2794
|
-
}
|
|
2795
|
-
function realMethod(methodName) {
|
|
2796
|
-
if (methodName === "debug") {
|
|
2797
|
-
methodName = "log";
|
|
2798
|
-
}
|
|
2799
|
-
if (typeof console === undefinedType2) {
|
|
2800
|
-
return false;
|
|
2801
|
-
} else if (methodName === "trace" && isIE) {
|
|
2802
|
-
return traceForIE;
|
|
2803
|
-
} else if (console[methodName] !== void 0) {
|
|
2804
|
-
return bindMethod(console, methodName);
|
|
2805
|
-
} else if (console.log !== void 0) {
|
|
2806
|
-
return bindMethod(console, "log");
|
|
2807
|
-
} else {
|
|
2808
|
-
return noop;
|
|
2809
|
-
}
|
|
2810
|
-
}
|
|
2811
|
-
function replaceLoggingMethods() {
|
|
2812
|
-
var level = this.getLevel();
|
|
2813
|
-
for (var i = 0; i < logMethods.length; i++) {
|
|
2814
|
-
var methodName = logMethods[i];
|
|
2815
|
-
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
2816
|
-
}
|
|
2817
|
-
this.log = this.debug;
|
|
2818
|
-
if (typeof console === undefinedType2 && level < this.levels.SILENT) {
|
|
2819
|
-
return "No console available for logging";
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
function enableLoggingWhenConsoleArrives(methodName) {
|
|
2823
|
-
return function() {
|
|
2824
|
-
if (typeof console !== undefinedType2) {
|
|
2825
|
-
replaceLoggingMethods.call(this);
|
|
2826
|
-
this[methodName].apply(this, arguments);
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2740
|
+
function parse$1(template, re2 = /{{(.*?)}}/) {
|
|
2741
|
+
let result = re2.exec(template);
|
|
2742
|
+
const parts = [];
|
|
2743
|
+
let pos;
|
|
2744
|
+
while (result) {
|
|
2745
|
+
pos = result.index;
|
|
2746
|
+
if (pos !== 0) {
|
|
2747
|
+
parts.push({ match: false, str: template.substring(0, pos) });
|
|
2748
|
+
template = template.slice(pos);
|
|
2749
|
+
}
|
|
2750
|
+
parts.push({ match: true, str: result[0] });
|
|
2751
|
+
template = template.slice(result[0].length);
|
|
2752
|
+
result = re2.exec(template);
|
|
2753
|
+
}
|
|
2754
|
+
if (template) {
|
|
2755
|
+
parts.push({ match: false, str: template });
|
|
2756
|
+
}
|
|
2757
|
+
return parts;
|
|
2758
|
+
}
|
|
2759
|
+
function matchFn(str) {
|
|
2760
|
+
const match = str.match(/(?<fname>[A-Z_][A-Z_1-9]*)\((?<args>[^)]+)\)/i);
|
|
2761
|
+
if (!(match == null ? void 0 : match.groups)) return;
|
|
2762
|
+
const { fname, args } = match.groups;
|
|
2763
|
+
const ctx = Object.fromEntries(
|
|
2764
|
+
args.split(",").map((kwarg) => {
|
|
2765
|
+
var _a3;
|
|
2766
|
+
const { key, num, str: str2 } = ((_a3 = kwarg.match(
|
|
2767
|
+
/(?<key>[a-z_0-9]*)\s*=\s*((?<num>[0-9.]+)|('|")(?<str>.*)('|"))/i
|
|
2768
|
+
)) == null ? void 0 : _a3.groups) ?? {};
|
|
2769
|
+
if (!key || !(num || str2)) {
|
|
2770
|
+
throw Error(`Failed to match fn kwarg: ${kwarg}`);
|
|
2829
2771
|
}
|
|
2830
|
-
|
|
2831
|
-
|
|
2772
|
+
return [key, num ? Number(num) : str2];
|
|
2773
|
+
})
|
|
2774
|
+
);
|
|
2775
|
+
return { fname, ctx };
|
|
2776
|
+
}
|
|
2777
|
+
const alphabet = "abcdefghijklmnopqrstuvwxyz";
|
|
2778
|
+
const numbers = "01234569789";
|
|
2779
|
+
const expr = "()*/+-";
|
|
2780
|
+
const space = " ";
|
|
2781
|
+
const valid$1 = new Set(
|
|
2782
|
+
alphabet + alphabet.toUpperCase() + numbers + expr + space
|
|
2783
|
+
);
|
|
2784
|
+
function matchMathEval(str) {
|
|
2785
|
+
for (let i = 0; i < str.length; i++) {
|
|
2786
|
+
if (!valid$1.has(str.charAt(i))) return;
|
|
2787
|
+
}
|
|
2788
|
+
return parse$1(str, /[A-Za-z_][A-Za-z0-9_]*/gi);
|
|
2789
|
+
}
|
|
2790
|
+
function render(template, context) {
|
|
2791
|
+
const grps = parse$1(template);
|
|
2792
|
+
return grps.map((grp) => {
|
|
2793
|
+
if (!grp.match) {
|
|
2794
|
+
return grp.str;
|
|
2795
|
+
}
|
|
2796
|
+
let inner = grp.str.split(/{{|}}/).filter(Boolean)[0].trim();
|
|
2797
|
+
if (inner in context) {
|
|
2798
|
+
return context[inner];
|
|
2799
|
+
}
|
|
2800
|
+
const fnMatch = matchFn(inner);
|
|
2801
|
+
if (fnMatch) {
|
|
2802
|
+
const { fname, ctx } = fnMatch;
|
|
2803
|
+
const fn = context[fname];
|
|
2804
|
+
if (typeof fn === "function") {
|
|
2805
|
+
return fn(ctx);
|
|
2832
2806
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
if (typeof window === undefinedType2 || !storageKey) return;
|
|
2847
|
-
try {
|
|
2848
|
-
window.localStorage[storageKey] = levelName;
|
|
2849
|
-
return;
|
|
2850
|
-
} catch (ignore) {
|
|
2851
|
-
}
|
|
2852
|
-
try {
|
|
2853
|
-
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
|
|
2854
|
-
} catch (ignore) {
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
function getPersistedLevel() {
|
|
2858
|
-
var storedLevel;
|
|
2859
|
-
if (typeof window === undefinedType2 || !storageKey) return;
|
|
2860
|
-
try {
|
|
2861
|
-
storedLevel = window.localStorage[storageKey];
|
|
2862
|
-
} catch (ignore) {
|
|
2863
|
-
}
|
|
2864
|
-
if (typeof storedLevel === undefinedType2) {
|
|
2865
|
-
try {
|
|
2866
|
-
var cookie = window.document.cookie;
|
|
2867
|
-
var cookieName = encodeURIComponent(storageKey);
|
|
2868
|
-
var location = cookie.indexOf(cookieName + "=");
|
|
2869
|
-
if (location !== -1) {
|
|
2870
|
-
storedLevel = /^([^;]+)/.exec(
|
|
2871
|
-
cookie.slice(location + cookieName.length + 1)
|
|
2872
|
-
)[1];
|
|
2873
|
-
}
|
|
2874
|
-
} catch (ignore) {
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
if (self2.levels[storedLevel] === void 0) {
|
|
2878
|
-
storedLevel = void 0;
|
|
2879
|
-
}
|
|
2880
|
-
return storedLevel;
|
|
2881
|
-
}
|
|
2882
|
-
function clearPersistedLevel() {
|
|
2883
|
-
if (typeof window === undefinedType2 || !storageKey) return;
|
|
2884
|
-
try {
|
|
2885
|
-
window.localStorage.removeItem(storageKey);
|
|
2886
|
-
} catch (ignore) {
|
|
2887
|
-
}
|
|
2888
|
-
try {
|
|
2889
|
-
window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
2890
|
-
} catch (ignore) {
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
function normalizeLevel(input) {
|
|
2894
|
-
var level = input;
|
|
2895
|
-
if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
|
|
2896
|
-
level = self2.levels[level.toUpperCase()];
|
|
2897
|
-
}
|
|
2898
|
-
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
2899
|
-
return level;
|
|
2900
|
-
} else {
|
|
2901
|
-
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
2902
|
-
}
|
|
2807
|
+
throw Error(
|
|
2808
|
+
`Cannot find function named ${fname} in rendering context.`
|
|
2809
|
+
);
|
|
2810
|
+
}
|
|
2811
|
+
const matches = matchMathEval(inner);
|
|
2812
|
+
if (matches) {
|
|
2813
|
+
const exprParts = matches.map((match) => {
|
|
2814
|
+
if (!match.match) return match.str;
|
|
2815
|
+
const value = context[match.str];
|
|
2816
|
+
if (value == null) {
|
|
2817
|
+
throw Error(
|
|
2818
|
+
`Cannot find number named ${match.str} in rendering context.`
|
|
2819
|
+
);
|
|
2903
2820
|
}
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
"INFO": 2,
|
|
2909
|
-
"WARN": 3,
|
|
2910
|
-
"ERROR": 4,
|
|
2911
|
-
"SILENT": 5
|
|
2912
|
-
};
|
|
2913
|
-
self2.methodFactory = factory || defaultMethodFactory;
|
|
2914
|
-
self2.getLevel = function() {
|
|
2915
|
-
if (userLevel != null) {
|
|
2916
|
-
return userLevel;
|
|
2917
|
-
} else if (defaultLevel != null) {
|
|
2918
|
-
return defaultLevel;
|
|
2919
|
-
} else {
|
|
2920
|
-
return inheritedLevel;
|
|
2921
|
-
}
|
|
2922
|
-
};
|
|
2923
|
-
self2.setLevel = function(level, persist) {
|
|
2924
|
-
userLevel = normalizeLevel(level);
|
|
2925
|
-
if (persist !== false) {
|
|
2926
|
-
persistLevelIfPossible(userLevel);
|
|
2927
|
-
}
|
|
2928
|
-
return replaceLoggingMethods.call(self2);
|
|
2929
|
-
};
|
|
2930
|
-
self2.setDefaultLevel = function(level) {
|
|
2931
|
-
defaultLevel = normalizeLevel(level);
|
|
2932
|
-
if (!getPersistedLevel()) {
|
|
2933
|
-
self2.setLevel(level, false);
|
|
2934
|
-
}
|
|
2935
|
-
};
|
|
2936
|
-
self2.resetLevel = function() {
|
|
2937
|
-
userLevel = null;
|
|
2938
|
-
clearPersistedLevel();
|
|
2939
|
-
replaceLoggingMethods.call(self2);
|
|
2940
|
-
};
|
|
2941
|
-
self2.enableAll = function(persist) {
|
|
2942
|
-
self2.setLevel(self2.levels.TRACE, persist);
|
|
2943
|
-
};
|
|
2944
|
-
self2.disableAll = function(persist) {
|
|
2945
|
-
self2.setLevel(self2.levels.SILENT, persist);
|
|
2946
|
-
};
|
|
2947
|
-
self2.rebuild = function() {
|
|
2948
|
-
if (defaultLogger !== self2) {
|
|
2949
|
-
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
2950
|
-
}
|
|
2951
|
-
replaceLoggingMethods.call(self2);
|
|
2952
|
-
if (defaultLogger === self2) {
|
|
2953
|
-
for (var childName in _loggersByName) {
|
|
2954
|
-
_loggersByName[childName].rebuild();
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
};
|
|
2958
|
-
inheritedLevel = normalizeLevel(
|
|
2959
|
-
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
2960
|
-
);
|
|
2961
|
-
var initialLevel = getPersistedLevel();
|
|
2962
|
-
if (initialLevel != null) {
|
|
2963
|
-
userLevel = normalizeLevel(initialLevel);
|
|
2821
|
+
if (typeof value !== "number") {
|
|
2822
|
+
throw Error(
|
|
2823
|
+
`The provided value for ${match.str} must be a number.`
|
|
2824
|
+
);
|
|
2964
2825
|
}
|
|
2965
|
-
|
|
2826
|
+
return value;
|
|
2827
|
+
});
|
|
2828
|
+
return Function('"use strict";return (' + exprParts.join("") + ")")();
|
|
2829
|
+
}
|
|
2830
|
+
throw new Error(`Unable to match ${grp.str}`);
|
|
2831
|
+
}).join("");
|
|
2832
|
+
}
|
|
2833
|
+
function parse(spec, renderString = render) {
|
|
2834
|
+
return "version" in spec ? parseV1(spec, renderString) : parseV0(spec);
|
|
2835
|
+
}
|
|
2836
|
+
function parseV0(spec) {
|
|
2837
|
+
return new Map(Object.entries(spec));
|
|
2838
|
+
}
|
|
2839
|
+
function parseV1(spec, renderString) {
|
|
2840
|
+
var _a3;
|
|
2841
|
+
const context = {};
|
|
2842
|
+
for (const [key, template] of Object.entries(spec.templates ?? {})) {
|
|
2843
|
+
if (template.includes("{{")) {
|
|
2844
|
+
context[key] = (ctx) => renderString(template, ctx);
|
|
2845
|
+
} else {
|
|
2846
|
+
context[key] = template;
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
const render2 = (t, o) => {
|
|
2850
|
+
return renderString(t, { ...context, ...o });
|
|
2851
|
+
};
|
|
2852
|
+
const refs = /* @__PURE__ */ new Map();
|
|
2853
|
+
for (const [key, ref] of Object.entries(spec.refs ?? {})) {
|
|
2854
|
+
if (typeof ref === "string") {
|
|
2855
|
+
refs.set(key, ref);
|
|
2856
|
+
} else {
|
|
2857
|
+
const url = ((_a3 = ref[0]) == null ? void 0 : _a3.includes("{{")) ? render2(ref[0]) : ref[0];
|
|
2858
|
+
refs.set(key, ref.length === 1 ? [url] : [url, ref[1], ref[2]]);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
for (const g of spec.gen ?? []) {
|
|
2862
|
+
for (const dims of iterDims(g.dimensions)) {
|
|
2863
|
+
const key = render2(g.key, dims);
|
|
2864
|
+
const url = render2(g.url, dims);
|
|
2865
|
+
if ("offset" in g && "length" in g) {
|
|
2866
|
+
const offset = render2(g.offset, dims);
|
|
2867
|
+
const length = render2(g.length, dims);
|
|
2868
|
+
refs.set(key, [url, parseInt(offset), parseInt(length)]);
|
|
2869
|
+
} else {
|
|
2870
|
+
refs.set(key, [url]);
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
return refs;
|
|
2875
|
+
}
|
|
2876
|
+
function* iterDims(dimensions) {
|
|
2877
|
+
const keys2 = Object.keys(dimensions);
|
|
2878
|
+
const iterables = Object.values(dimensions).map(
|
|
2879
|
+
(i) => Array.isArray(i) ? i : [...range$2(i)]
|
|
2880
|
+
);
|
|
2881
|
+
for (const values of product(...iterables)) {
|
|
2882
|
+
yield Object.fromEntries(keys2.map((key, i) => [key, values[i]]));
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
function* product(...iterables) {
|
|
2886
|
+
if (iterables.length === 0) {
|
|
2887
|
+
return;
|
|
2888
|
+
}
|
|
2889
|
+
const iterators = iterables.map((it) => it[Symbol.iterator]());
|
|
2890
|
+
const results = iterators.map((it) => it.next());
|
|
2891
|
+
if (results.some((r) => r.done)) {
|
|
2892
|
+
throw new Error("Input contains an empty iterator.");
|
|
2893
|
+
}
|
|
2894
|
+
for (let i = 0; ; ) {
|
|
2895
|
+
if (results[i].done) {
|
|
2896
|
+
iterators[i] = iterables[i][Symbol.iterator]();
|
|
2897
|
+
results[i] = iterators[i].next();
|
|
2898
|
+
if (++i >= iterators.length) {
|
|
2899
|
+
return;
|
|
2966
2900
|
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
if (!logger) {
|
|
2974
|
-
logger = _loggersByName[name] = new Logger(
|
|
2975
|
-
name,
|
|
2976
|
-
defaultLogger.methodFactory
|
|
2977
|
-
);
|
|
2978
|
-
}
|
|
2979
|
-
return logger;
|
|
2980
|
-
};
|
|
2981
|
-
var _log = typeof window !== undefinedType2 ? window.log : void 0;
|
|
2982
|
-
defaultLogger.noConflict = function() {
|
|
2983
|
-
if (typeof window !== undefinedType2 && window.log === defaultLogger) {
|
|
2984
|
-
window.log = _log;
|
|
2985
|
-
}
|
|
2986
|
-
return defaultLogger;
|
|
2987
|
-
};
|
|
2988
|
-
defaultLogger.getLoggers = function getLoggers() {
|
|
2989
|
-
return _loggersByName;
|
|
2990
|
-
};
|
|
2991
|
-
defaultLogger["default"] = defaultLogger;
|
|
2992
|
-
return defaultLogger;
|
|
2993
|
-
});
|
|
2994
|
-
})(loglevel$1);
|
|
2995
|
-
return loglevel$1.exports;
|
|
2901
|
+
} else {
|
|
2902
|
+
yield results.map(({ value }) => value);
|
|
2903
|
+
i = 0;
|
|
2904
|
+
}
|
|
2905
|
+
results[i] = iterators[i].next();
|
|
2906
|
+
}
|
|
2996
2907
|
}
|
|
2997
|
-
|
|
2998
|
-
|
|
2908
|
+
function* range$2({ stop, start = 0, step = 1 }) {
|
|
2909
|
+
for (let i = start; i < stop; i += step) {
|
|
2910
|
+
yield i;
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
(() => {
|
|
2914
|
+
var table2 = new Uint8Array(128);
|
|
2915
|
+
for (var i = 0; i < 64; i++) {
|
|
2916
|
+
table2[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
2917
|
+
}
|
|
2918
|
+
return (base64) => {
|
|
2919
|
+
var n = base64.length;
|
|
2920
|
+
var bytes = new Uint8Array(
|
|
2921
|
+
// @ts-expect-error
|
|
2922
|
+
(n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0
|
|
2923
|
+
);
|
|
2924
|
+
for (var i2 = 0, j = 0; i2 < n; ) {
|
|
2925
|
+
var c0 = table2[base64.charCodeAt(i2++)], c1 = table2[base64.charCodeAt(i2++)];
|
|
2926
|
+
var c2 = table2[base64.charCodeAt(i2++)], c3 = table2[base64.charCodeAt(i2++)];
|
|
2927
|
+
bytes[j++] = c0 << 2 | c1 >> 4;
|
|
2928
|
+
bytes[j++] = c1 << 4 | c2 >> 2;
|
|
2929
|
+
bytes[j++] = c2 << 6 | c3;
|
|
2930
|
+
}
|
|
2931
|
+
return bytes;
|
|
2932
|
+
};
|
|
2933
|
+
})();
|
|
2934
|
+
new TextEncoder();
|
|
2935
|
+
let table = new Uint8Array(128);
|
|
2936
|
+
for (let i = 0; i < 64; i++) {
|
|
2937
|
+
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
2938
|
+
}
|
|
2939
|
+
function to_binary(base64) {
|
|
2940
|
+
const n = base64.length;
|
|
2941
|
+
const bytes = new Uint8Array(
|
|
2942
|
+
// @ts-ignore
|
|
2943
|
+
(n - (base64[n - 1] === "=") - (base64[n - 2] === "=")) * 3 / 4 | 0
|
|
2944
|
+
);
|
|
2945
|
+
for (let i = 0, j = 0; i < n; ) {
|
|
2946
|
+
const c0 = table[base64.charCodeAt(i++)];
|
|
2947
|
+
const c1 = table[base64.charCodeAt(i++)];
|
|
2948
|
+
const c2 = table[base64.charCodeAt(i++)];
|
|
2949
|
+
const c3 = table[base64.charCodeAt(i++)];
|
|
2950
|
+
bytes[j++] = c0 << 2 | c1 >> 4;
|
|
2951
|
+
bytes[j++] = c1 << 4 | c2 >> 2;
|
|
2952
|
+
bytes[j++] = c2 << 6 | c3;
|
|
2953
|
+
}
|
|
2954
|
+
return bytes;
|
|
2955
|
+
}
|
|
2956
|
+
const _ReferenceStore = class _ReferenceStore {
|
|
2957
|
+
constructor(refs, opts = {}) {
|
|
2958
|
+
__privateAdd(this, _refs);
|
|
2959
|
+
__privateAdd(this, _opts);
|
|
2960
|
+
__privateAdd(this, _overrides3);
|
|
2961
|
+
__privateSet(this, _refs, Promise.resolve(refs));
|
|
2962
|
+
__privateSet(this, _opts, opts);
|
|
2963
|
+
__privateSet(this, _overrides3, opts.overrides || {});
|
|
2964
|
+
}
|
|
2965
|
+
async get(key, opts = {}) {
|
|
2966
|
+
let ref = (await __privateGet(this, _refs)).get(strip_prefix(key));
|
|
2967
|
+
if (!ref)
|
|
2968
|
+
return;
|
|
2969
|
+
if (typeof ref === "string") {
|
|
2970
|
+
if (ref.startsWith("base64:")) {
|
|
2971
|
+
return to_binary(ref.slice("base64:".length));
|
|
2972
|
+
}
|
|
2973
|
+
return new TextEncoder().encode(ref);
|
|
2974
|
+
}
|
|
2975
|
+
let [urlOrNull, offset, size] = ref;
|
|
2976
|
+
let url = urlOrNull ?? __privateGet(this, _opts).target;
|
|
2977
|
+
if (!url) {
|
|
2978
|
+
throw Error(`No url for key ${key}, and no target url provided.`);
|
|
2979
|
+
}
|
|
2980
|
+
let res = await fetch_range(uri2href(url), offset, size, merge_init(__privateGet(this, _overrides3), opts));
|
|
2981
|
+
if (res.status === 200 || res.status === 206) {
|
|
2982
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
2983
|
+
}
|
|
2984
|
+
throw new Error(`Request unsuccessful for key ${key}. Response status: ${res.status}.`);
|
|
2985
|
+
}
|
|
2986
|
+
static fromSpec(spec, opts) {
|
|
2987
|
+
let refs = Promise.resolve(spec).then((spec2) => parse(spec2));
|
|
2988
|
+
return new _ReferenceStore(refs, opts);
|
|
2989
|
+
}
|
|
2990
|
+
static fromUrl(url, opts) {
|
|
2991
|
+
let spec = fetch(url, opts == null ? void 0 : opts.overrides).then((res) => res.json());
|
|
2992
|
+
return _ReferenceStore.fromSpec(spec, opts);
|
|
2993
|
+
}
|
|
2994
|
+
};
|
|
2995
|
+
_refs = new WeakMap();
|
|
2996
|
+
_opts = new WeakMap();
|
|
2997
|
+
_overrides3 = new WeakMap();
|
|
2998
|
+
let ReferenceStore = _ReferenceStore;
|
|
2999
2999
|
class RelaxedFetchStore extends FetchStore {
|
|
3000
3000
|
// This allows returning `undefined` for 403 responses,
|
|
3001
3001
|
// as opposed to completely erroring.
|
|
@@ -3040,11 +3040,30 @@ function zarrOpenRoot(url, fileType, opts) {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
return root$1(store);
|
|
3042
3042
|
}
|
|
3043
|
+
class VitessceError extends Error {
|
|
3044
|
+
constructor(message) {
|
|
3045
|
+
super(message);
|
|
3046
|
+
this.name = "VitessceError";
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
class DataLoaderError extends VitessceError {
|
|
3050
|
+
constructor(message) {
|
|
3051
|
+
super(message);
|
|
3052
|
+
this.name = "DataLoaderError";
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
class ZarrNodeNotFoundError extends DataLoaderError {
|
|
3056
|
+
constructor(message) {
|
|
3057
|
+
super(message);
|
|
3058
|
+
this.name = "ZarrNodeNotFoundError";
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3043
3061
|
class ZarrDataSource {
|
|
3044
3062
|
/**
|
|
3045
3063
|
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
3046
3064
|
*/
|
|
3047
3065
|
constructor({ url, requestInit: requestInit2, refSpecUrl, store, fileType }) {
|
|
3066
|
+
log.info("Using a Zarr-based data source. 403 and 404 HTTP responses for Zarr metadata files (.zattrs, .zarray, .zgroup, zarr.json) are to be expected and do not necessarily indicate errors.");
|
|
3048
3067
|
if (store) {
|
|
3049
3068
|
this.storeRoot = root$1(store);
|
|
3050
3069
|
} else if (url) {
|
|
@@ -3077,7 +3096,16 @@ class ZarrDataSource {
|
|
|
3077
3096
|
if (key.endsWith(".zattrs") || key.endsWith(".zarray") || key.endsWith(".zgroup")) {
|
|
3078
3097
|
dirKey = key.substring(0, key.length - 8);
|
|
3079
3098
|
}
|
|
3080
|
-
|
|
3099
|
+
try {
|
|
3100
|
+
const location = storeRootToUse.resolve(dirKey);
|
|
3101
|
+
const arrOrGroup = await open(location);
|
|
3102
|
+
return arrOrGroup.attrs;
|
|
3103
|
+
} catch (e) {
|
|
3104
|
+
if (e.name === "NodeNotFoundError") {
|
|
3105
|
+
throw new ZarrNodeNotFoundError(dirKey);
|
|
3106
|
+
}
|
|
3107
|
+
throw e;
|
|
3108
|
+
}
|
|
3081
3109
|
}
|
|
3082
3110
|
}
|
|
3083
3111
|
function dirname(path) {
|
|
@@ -3547,15 +3575,6 @@ class AbstractTwoStepLoader extends AbstractLoader {
|
|
|
3547
3575
|
this.dataSource = dataSource;
|
|
3548
3576
|
}
|
|
3549
3577
|
}
|
|
3550
|
-
class AbstractLoaderError {
|
|
3551
|
-
constructor(message) {
|
|
3552
|
-
this.message = message;
|
|
3553
|
-
}
|
|
3554
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3555
|
-
warnInConsole() {
|
|
3556
|
-
throw new Error("The warnInConsole() method has not been implemented.");
|
|
3557
|
-
}
|
|
3558
|
-
}
|
|
3559
3578
|
class MatrixZarrAsObsFeatureMatrixLoader extends AbstractTwoStepLoader {
|
|
3560
3579
|
async loadAttrs() {
|
|
3561
3580
|
if (this.attrs) {
|
|
@@ -3576,11 +3595,12 @@ class MatrixZarrAsObsFeatureMatrixLoader extends AbstractTwoStepLoader {
|
|
|
3576
3595
|
this.arr = await createZarrArrayAdapter(z2).getRaw([null, null]);
|
|
3577
3596
|
return this.arr;
|
|
3578
3597
|
}
|
|
3579
|
-
load() {
|
|
3580
|
-
|
|
3598
|
+
async load() {
|
|
3599
|
+
const [attrs, arr] = await Promise.all([this.loadAttrs(), this.loadArr()]);
|
|
3600
|
+
return new LoaderResult(
|
|
3581
3601
|
{ obsIndex: attrs.data.rows, featureIndex: attrs.data.cols, obsFeatureMatrix: arr },
|
|
3582
3602
|
null
|
|
3583
|
-
)
|
|
3603
|
+
);
|
|
3584
3604
|
}
|
|
3585
3605
|
}
|
|
3586
3606
|
class IncorrectDataTypeError extends Error {
|
|
@@ -3938,18 +3958,15 @@ class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader {
|
|
|
3938
3958
|
}
|
|
3939
3959
|
async load() {
|
|
3940
3960
|
const { path } = this.getOptions();
|
|
3941
|
-
const
|
|
3942
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
3943
|
-
return Promise.reject(superResult);
|
|
3944
|
-
}
|
|
3945
|
-
return Promise.all([
|
|
3961
|
+
const [obsIndex, featureIndex, obsFeatureMatrix] = await Promise.all([
|
|
3946
3962
|
this.dataSource.loadObsIndex(path),
|
|
3947
3963
|
this.loadInitialFilteredGeneNames(),
|
|
3948
3964
|
this.loadCellXGene()
|
|
3949
|
-
])
|
|
3965
|
+
]);
|
|
3966
|
+
return new LoaderResult(
|
|
3950
3967
|
{ obsIndex, featureIndex, obsFeatureMatrix },
|
|
3951
3968
|
null
|
|
3952
|
-
)
|
|
3969
|
+
);
|
|
3953
3970
|
}
|
|
3954
3971
|
}
|
|
3955
3972
|
class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -3980,20 +3997,17 @@ class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
|
3980
3997
|
*/
|
|
3981
3998
|
async load() {
|
|
3982
3999
|
const { path } = this.options;
|
|
3983
|
-
const
|
|
3984
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
3985
|
-
return Promise.reject(superResult);
|
|
3986
|
-
}
|
|
3987
|
-
return Promise.all([
|
|
4000
|
+
const [obsIndex, obsEmbedding] = await Promise.all([
|
|
3988
4001
|
// Pass in the obsEmbedding path,
|
|
3989
4002
|
// to handle the MuData case where the obsIndex is located at
|
|
3990
4003
|
// `mod/rna/index` rather than `index`.
|
|
3991
4004
|
this.dataSource.loadObsIndex(path),
|
|
3992
4005
|
this.loadEmbedding()
|
|
3993
|
-
])
|
|
4006
|
+
]);
|
|
4007
|
+
return new LoaderResult(
|
|
3994
4008
|
{ obsIndex, obsEmbedding },
|
|
3995
4009
|
null
|
|
3996
|
-
)
|
|
4010
|
+
);
|
|
3997
4011
|
}
|
|
3998
4012
|
}
|
|
3999
4013
|
const ViewType$1 = {
|
|
@@ -4130,9 +4144,7 @@ const FileType$1 = {
|
|
|
4130
4144
|
OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
|
|
4131
4145
|
OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
|
|
4132
4146
|
FEATURE_LABELS_SPATIALDATA_ZARR: "featureLabels.spatialdata.zarr",
|
|
4133
|
-
|
|
4134
|
-
// OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
|
|
4135
|
-
// OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
|
|
4147
|
+
OBS_POINTS_SPATIALDATA_ZARR: "obsPoints.spatialdata.zarr",
|
|
4136
4148
|
// SpatialData - zipped
|
|
4137
4149
|
IMAGE_SPATIALDATA_ZARR_ZIP: "image.spatialdata.zarr.zip",
|
|
4138
4150
|
LABELS_SPATIALDATA_ZARR_ZIP: "labels.spatialdata.zarr.zip",
|
|
@@ -4141,6 +4153,7 @@ const FileType$1 = {
|
|
|
4141
4153
|
OBS_SETS_SPATIALDATA_ZARR_ZIP: "obsSets.spatialdata.zarr.zip",
|
|
4142
4154
|
OBS_SPOTS_SPATIALDATA_ZARR_ZIP: "obsSpots.spatialdata.zarr.zip",
|
|
4143
4155
|
FEATURE_LABELS_SPATIALDATA_ZARR_ZIP: "featureLabels.spatialdata.zarr.zip",
|
|
4156
|
+
OBS_POINTS_SPATIALDATA_ZARR_ZIP: "obsPoints.spatialdata.zarr.zip",
|
|
4144
4157
|
// MuData
|
|
4145
4158
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
4146
4159
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
@@ -4387,6 +4400,7 @@ const CoordinationType$1 = {
|
|
|
4387
4400
|
[FileType$1.OBS_FEATURE_MATRIX_SPATIALDATA_ZARR]: DataType$1.OBS_FEATURE_MATRIX,
|
|
4388
4401
|
[FileType$1.OBS_SETS_SPATIALDATA_ZARR]: DataType$1.OBS_SETS,
|
|
4389
4402
|
[FileType$1.FEATURE_LABELS_SPATIALDATA_ZARR]: DataType$1.FEATURE_LABELS,
|
|
4403
|
+
[FileType$1.OBS_POINTS_SPATIALDATA_ZARR]: DataType$1.OBS_POINTS,
|
|
4390
4404
|
// For new file types to support old file types
|
|
4391
4405
|
[FileType$1.OBS_EMBEDDING_CELLS_JSON]: DataType$1.OBS_EMBEDDING,
|
|
4392
4406
|
[FileType$1.OBS_LOCATIONS_CELLS_JSON]: DataType$1.OBS_LOCATIONS,
|
|
@@ -4560,6 +4574,9 @@ const CoordinationType$1 = {
|
|
|
4560
4574
|
},
|
|
4561
4575
|
[FileType$1.FEATURE_LABELS_SPATIALDATA_ZARR]: {
|
|
4562
4576
|
zip: FileType$1.FEATURE_LABELS_SPATIALDATA_ZARR_ZIP
|
|
4577
|
+
},
|
|
4578
|
+
[FileType$1.OBS_POINTS_SPATIALDATA_ZARR]: {
|
|
4579
|
+
zip: FileType$1.OBS_POINTS_SPATIALDATA_ZARR_ZIP
|
|
4563
4580
|
}
|
|
4564
4581
|
});
|
|
4565
4582
|
[
|
|
@@ -5678,10 +5695,6 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5678
5695
|
}
|
|
5679
5696
|
async load() {
|
|
5680
5697
|
const { path } = this.options;
|
|
5681
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
5682
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
5683
|
-
return Promise.reject(superResult);
|
|
5684
|
-
}
|
|
5685
5698
|
const coordinationValues = {
|
|
5686
5699
|
spotLayer: CL({
|
|
5687
5700
|
obsType: "spot",
|
|
@@ -5700,14 +5713,15 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5700
5713
|
// additionalObsSets: null,
|
|
5701
5714
|
})
|
|
5702
5715
|
};
|
|
5703
|
-
|
|
5716
|
+
const [obsIndex, obsSpots] = await Promise.all([
|
|
5704
5717
|
this.dataSource.loadObsIndex(path),
|
|
5705
5718
|
this.loadSpots()
|
|
5706
|
-
])
|
|
5719
|
+
]);
|
|
5720
|
+
return new LoaderResult(
|
|
5707
5721
|
{ obsIndex, obsSpots },
|
|
5708
5722
|
null,
|
|
5709
5723
|
coordinationValues
|
|
5710
|
-
)
|
|
5724
|
+
);
|
|
5711
5725
|
}
|
|
5712
5726
|
}
|
|
5713
5727
|
class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -5729,10 +5743,6 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5729
5743
|
}
|
|
5730
5744
|
async load() {
|
|
5731
5745
|
const { path } = this.options;
|
|
5732
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
5733
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
5734
|
-
return Promise.reject(superResult);
|
|
5735
|
-
}
|
|
5736
5746
|
const coordinationValues = {
|
|
5737
5747
|
pointLayer: CL({
|
|
5738
5748
|
obsType: "point",
|
|
@@ -5749,14 +5759,15 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5749
5759
|
// obsLabelsType: null,
|
|
5750
5760
|
})
|
|
5751
5761
|
};
|
|
5752
|
-
|
|
5762
|
+
const [obsIndex, obsPoints] = await Promise.all([
|
|
5753
5763
|
this.dataSource.loadObsIndex(path),
|
|
5754
5764
|
this.loadPoints()
|
|
5755
|
-
])
|
|
5765
|
+
]);
|
|
5766
|
+
return new LoaderResult(
|
|
5756
5767
|
{ obsIndex, obsPoints },
|
|
5757
5768
|
null,
|
|
5758
5769
|
coordinationValues
|
|
5759
|
-
)
|
|
5770
|
+
);
|
|
5760
5771
|
}
|
|
5761
5772
|
}
|
|
5762
5773
|
class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -5778,17 +5789,14 @@ class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5778
5789
|
}
|
|
5779
5790
|
async load() {
|
|
5780
5791
|
const { path } = this.options;
|
|
5781
|
-
const
|
|
5782
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
5783
|
-
return Promise.reject(superResult);
|
|
5784
|
-
}
|
|
5785
|
-
return Promise.all([
|
|
5792
|
+
const [obsIndex, obsLocations] = await Promise.all([
|
|
5786
5793
|
this.dataSource.loadObsIndex(path),
|
|
5787
5794
|
this.loadLocations()
|
|
5788
|
-
])
|
|
5795
|
+
]);
|
|
5796
|
+
return new LoaderResult(
|
|
5789
5797
|
{ obsIndex, obsLocations },
|
|
5790
5798
|
null
|
|
5791
|
-
)
|
|
5799
|
+
);
|
|
5792
5800
|
}
|
|
5793
5801
|
}
|
|
5794
5802
|
class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -5829,10 +5837,6 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5829
5837
|
async load() {
|
|
5830
5838
|
var _a3;
|
|
5831
5839
|
const { path } = this.options;
|
|
5832
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
5833
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
5834
|
-
return Promise.reject(superResult);
|
|
5835
|
-
}
|
|
5836
5840
|
const channelCoordination = [{
|
|
5837
5841
|
// obsType: null,
|
|
5838
5842
|
spatialChannelColor: [255, 255, 255],
|
|
@@ -5861,18 +5865,15 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
5861
5865
|
}
|
|
5862
5866
|
])
|
|
5863
5867
|
};
|
|
5864
|
-
|
|
5868
|
+
const [obsIndex, obsSegmentations] = await Promise.all([
|
|
5865
5869
|
this.dataSource.loadObsIndex(path),
|
|
5866
5870
|
this.loadSegmentations()
|
|
5867
|
-
])
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
obsSegmentations,
|
|
5871
|
-
obsSegmentationsType: "polygon"
|
|
5872
|
-
},
|
|
5871
|
+
]);
|
|
5872
|
+
return new LoaderResult(
|
|
5873
|
+
{ obsIndex, obsSegmentations, obsSegmentationsType: "polygon" },
|
|
5873
5874
|
null,
|
|
5874
5875
|
coordinationValues
|
|
5875
|
-
)
|
|
5876
|
+
);
|
|
5876
5877
|
}
|
|
5877
5878
|
}
|
|
5878
5879
|
let getRandomValues;
|
|
@@ -11573,6 +11574,9 @@ const configSchema1_0_16 = configSchema1_0_13.extend({
|
|
|
11573
11574
|
const configSchema1_0_17 = configSchema1_0_16.extend({
|
|
11574
11575
|
version: z.literal("1.0.17")
|
|
11575
11576
|
});
|
|
11577
|
+
const configSchema1_0_18 = configSchema1_0_17.extend({
|
|
11578
|
+
version: z.literal("1.0.18")
|
|
11579
|
+
});
|
|
11576
11580
|
configSchema1_0_0.shape.coordinationSpace.unwrap();
|
|
11577
11581
|
configSchema1_0_0.shape.layout.element.shape.coordinationScopes.unwrap();
|
|
11578
11582
|
function upgradeReplaceViewProp(prefix, view, coordinationSpace) {
|
|
@@ -12080,7 +12084,54 @@ function upgradeFrom1_0_16(config2) {
|
|
|
12080
12084
|
version: "1.0.17"
|
|
12081
12085
|
};
|
|
12082
12086
|
}
|
|
12083
|
-
|
|
12087
|
+
function upgradeFrom1_0_17(config2) {
|
|
12088
|
+
const newConfig = cloneDeep(config2);
|
|
12089
|
+
const { datasets } = newConfig;
|
|
12090
|
+
const newDatasets = datasets.map((datasetDef) => {
|
|
12091
|
+
const { files } = datasetDef;
|
|
12092
|
+
const newFiles = files.map((fileDef) => {
|
|
12093
|
+
const { fileType, options } = fileDef;
|
|
12094
|
+
if (fileType === "spatialdata.zarr" || fileType === "spatialdata.zarr.zip") {
|
|
12095
|
+
if (options.labels && options.shapes) {
|
|
12096
|
+
throw new Error("Cannot upgrade both labels and shapes at the same time. For now, a workaround is to include two separate spatialdata.zarr file definitions, one for labels and one for shapes.");
|
|
12097
|
+
}
|
|
12098
|
+
if (options.labels) {
|
|
12099
|
+
const newOptions = {
|
|
12100
|
+
...options,
|
|
12101
|
+
obsSegmentations: options.labels
|
|
12102
|
+
};
|
|
12103
|
+
delete newOptions.labels;
|
|
12104
|
+
return {
|
|
12105
|
+
...fileDef,
|
|
12106
|
+
options: newOptions
|
|
12107
|
+
};
|
|
12108
|
+
}
|
|
12109
|
+
if (options.shapes) {
|
|
12110
|
+
const newOptions = {
|
|
12111
|
+
...options,
|
|
12112
|
+
obsSegmentations: options.shapes
|
|
12113
|
+
};
|
|
12114
|
+
delete newOptions.shapes;
|
|
12115
|
+
return {
|
|
12116
|
+
...fileDef,
|
|
12117
|
+
options: newOptions
|
|
12118
|
+
};
|
|
12119
|
+
}
|
|
12120
|
+
}
|
|
12121
|
+
return fileDef;
|
|
12122
|
+
});
|
|
12123
|
+
return {
|
|
12124
|
+
...datasetDef,
|
|
12125
|
+
files: newFiles
|
|
12126
|
+
};
|
|
12127
|
+
});
|
|
12128
|
+
return {
|
|
12129
|
+
...newConfig,
|
|
12130
|
+
datasets: newDatasets,
|
|
12131
|
+
version: "1.0.18"
|
|
12132
|
+
};
|
|
12133
|
+
}
|
|
12134
|
+
const latestConfigSchema = configSchema1_0_18;
|
|
12084
12135
|
const SCHEMA_HANDLERS = [
|
|
12085
12136
|
[configSchema0_1_0, upgradeFrom0_1_0],
|
|
12086
12137
|
[configSchema1_0_0, upgradeFrom1_0_0],
|
|
@@ -12099,7 +12150,8 @@ const SCHEMA_HANDLERS = [
|
|
|
12099
12150
|
[configSchema1_0_13, upgradeFrom1_0_13],
|
|
12100
12151
|
[configSchema1_0_14, upgradeFrom1_0_14],
|
|
12101
12152
|
[configSchema1_0_15, upgradeFrom1_0_15],
|
|
12102
|
-
[configSchema1_0_16, upgradeFrom1_0_16]
|
|
12153
|
+
[configSchema1_0_16, upgradeFrom1_0_16],
|
|
12154
|
+
[configSchema1_0_17, upgradeFrom1_0_17]
|
|
12103
12155
|
];
|
|
12104
12156
|
var re = { exports: {} };
|
|
12105
12157
|
var constants;
|
|
@@ -14342,10 +14394,14 @@ const imageSpatialdataSchema = z.object({
|
|
|
14342
14394
|
coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
|
|
14343
14395
|
});
|
|
14344
14396
|
const obsSegmentationsSpatialdataSchema = z.object({
|
|
14345
|
-
// TODO:
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14397
|
+
// TODO: support obsTypesFromElementNames?
|
|
14398
|
+
path: z.string().describe("The path to the segmentation data, stored in either shapes/ or labels/."),
|
|
14399
|
+
tablePath: z.string().optional().describe("The path to a table which annotates the labels or shapes. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected."),
|
|
14400
|
+
coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
|
|
14401
|
+
});
|
|
14402
|
+
const obsPointsSpatialdataSchema = z.object({
|
|
14403
|
+
path: z.string().describe("The path to the point data."),
|
|
14404
|
+
tablePath: z.string().optional().describe("The path to a table which annotates the points. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected."),
|
|
14349
14405
|
coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
|
|
14350
14406
|
});
|
|
14351
14407
|
z.object({
|
|
@@ -14465,13 +14521,10 @@ z.object({
|
|
|
14465
14521
|
image: imageSpatialdataSchema,
|
|
14466
14522
|
// TODO: should this be a special schema
|
|
14467
14523
|
// to allow specifying fileUid (like for embeddingType)?
|
|
14468
|
-
// TODO: allow multiple labels?
|
|
14469
|
-
|
|
14524
|
+
// TODO: allow multiple labels/shapes?
|
|
14525
|
+
obsSegmentations: obsSegmentationsSpatialdataSchema,
|
|
14526
|
+
obsPoints: obsPointsSpatialdataSchema,
|
|
14470
14527
|
// TODO: allow multiple shapes?
|
|
14471
|
-
// TODO: unify labels and shapes to obsSegmentations,
|
|
14472
|
-
// then distinguish in expand function based on
|
|
14473
|
-
// "labels/*" vs. "shapes/*" in path?
|
|
14474
|
-
shapes: obsSegmentationsSpatialdataSchema,
|
|
14475
14528
|
obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
|
|
14476
14529
|
obsSpots: obsSpotsSpatialdataSchema,
|
|
14477
14530
|
// TODO: obsPoints
|
|
@@ -20980,10 +21033,6 @@ class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
20980
21033
|
return this.dataSource.loadObsColumns(cellSetScoreZarrLocation);
|
|
20981
21034
|
}
|
|
20982
21035
|
async load() {
|
|
20983
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
20984
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
20985
|
-
return Promise.reject(superResult);
|
|
20986
|
-
}
|
|
20987
21036
|
if (!this.cachedResult) {
|
|
20988
21037
|
const { options } = this;
|
|
20989
21038
|
this.cachedResult = Promise.all([
|
|
@@ -21005,9 +21054,7 @@ class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21005
21054
|
const newAutoSetColors = initializeCellSetColor(obsSets, []);
|
|
21006
21055
|
coordinationValues.obsSetSelection = newAutoSetSelections;
|
|
21007
21056
|
coordinationValues.obsSetColor = newAutoSetColors;
|
|
21008
|
-
return
|
|
21009
|
-
new LoaderResult({ obsIndex, obsSets, obsSetsMembership }, null, coordinationValues)
|
|
21010
|
-
);
|
|
21057
|
+
return new LoaderResult({ obsIndex, obsSets, obsSetsMembership }, null, coordinationValues);
|
|
21011
21058
|
}
|
|
21012
21059
|
}
|
|
21013
21060
|
class ObsLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21029,17 +21076,14 @@ class ObsLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21029
21076
|
}
|
|
21030
21077
|
async load() {
|
|
21031
21078
|
const { path } = this.options;
|
|
21032
|
-
const
|
|
21033
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21034
|
-
return Promise.reject(superResult);
|
|
21035
|
-
}
|
|
21036
|
-
return Promise.all([
|
|
21079
|
+
const [obsIndex, obsLabels] = await Promise.all([
|
|
21037
21080
|
this.dataSource.loadObsIndex(path),
|
|
21038
21081
|
this.loadLabels()
|
|
21039
|
-
])
|
|
21082
|
+
]);
|
|
21083
|
+
return new LoaderResult(
|
|
21040
21084
|
{ obsIndex, obsLabels },
|
|
21041
21085
|
null
|
|
21042
|
-
)
|
|
21086
|
+
);
|
|
21043
21087
|
}
|
|
21044
21088
|
}
|
|
21045
21089
|
class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21064,24 +21108,21 @@ class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21064
21108
|
*/
|
|
21065
21109
|
async load() {
|
|
21066
21110
|
const { path } = this.options;
|
|
21067
|
-
const
|
|
21068
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21069
|
-
return Promise.reject(superResult);
|
|
21070
|
-
}
|
|
21071
|
-
return Promise.all([
|
|
21111
|
+
const [featureIndex, featureLabels] = await Promise.all([
|
|
21072
21112
|
// Pass in the obsEmbedding path,
|
|
21073
21113
|
// to handle the MuData case where the obsIndex is located at
|
|
21074
21114
|
// `mod/rna/index` rather than `index`.
|
|
21075
21115
|
this.dataSource.loadVarIndex(path),
|
|
21076
21116
|
this.loadLabels()
|
|
21077
|
-
])
|
|
21117
|
+
]);
|
|
21118
|
+
return new LoaderResult(
|
|
21078
21119
|
{
|
|
21079
21120
|
featureIndex,
|
|
21080
21121
|
featureLabels,
|
|
21081
21122
|
featureLabelsMap: new Map(featureIndex.map((key, i) => [key, featureLabels == null ? void 0 : featureLabels[i]]))
|
|
21082
21123
|
},
|
|
21083
21124
|
null
|
|
21084
|
-
)
|
|
21125
|
+
);
|
|
21085
21126
|
}
|
|
21086
21127
|
}
|
|
21087
21128
|
class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21118,16 +21159,13 @@ class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21118
21159
|
return this.obsFeatureColumns;
|
|
21119
21160
|
}
|
|
21120
21161
|
async load() {
|
|
21121
|
-
const
|
|
21122
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21123
|
-
return Promise.reject(superResult);
|
|
21124
|
-
}
|
|
21125
|
-
return Promise.all([
|
|
21162
|
+
const [{ obsIndex, obsFeatureMatrix, featureIndex }] = await Promise.all([
|
|
21126
21163
|
this.loadObsFeatureColumns()
|
|
21127
|
-
])
|
|
21164
|
+
]);
|
|
21165
|
+
return new LoaderResult(
|
|
21128
21166
|
{ obsIndex, obsFeatureMatrix, featureIndex },
|
|
21129
21167
|
null
|
|
21130
|
-
)
|
|
21168
|
+
);
|
|
21131
21169
|
}
|
|
21132
21170
|
}
|
|
21133
21171
|
class SampleEdgesAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21149,20 +21187,15 @@ class SampleEdgesAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21149
21187
|
}
|
|
21150
21188
|
async load() {
|
|
21151
21189
|
const { path } = this.options;
|
|
21152
|
-
const
|
|
21153
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21154
|
-
return Promise.reject(superResult);
|
|
21155
|
-
}
|
|
21156
|
-
return Promise.all([
|
|
21190
|
+
const [obsIndex, sampleIds] = await Promise.all([
|
|
21157
21191
|
this.dataSource.loadObsIndex(path),
|
|
21158
21192
|
this.loadLabels()
|
|
21159
|
-
])
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
});
|
|
21193
|
+
]);
|
|
21194
|
+
const sampleEdges = new Map(obsIndex.map((obsId, i) => [obsId, sampleIds[i]]));
|
|
21195
|
+
return new LoaderResult(
|
|
21196
|
+
{ sampleEdges },
|
|
21197
|
+
null
|
|
21198
|
+
);
|
|
21166
21199
|
}
|
|
21167
21200
|
}
|
|
21168
21201
|
class SampleSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21193,10 +21226,6 @@ class SampleSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21193
21226
|
return this.dataSource.loadObsColumns(cellSetScoreZarrLocation);
|
|
21194
21227
|
}
|
|
21195
21228
|
async load() {
|
|
21196
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
21197
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21198
|
-
return Promise.reject(superResult);
|
|
21199
|
-
}
|
|
21200
21229
|
if (!this.cachedResult) {
|
|
21201
21230
|
const { options } = this;
|
|
21202
21231
|
this.cachedResult = Promise.all([
|
|
@@ -21220,13 +21249,11 @@ class SampleSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21220
21249
|
]);
|
|
21221
21250
|
const newAutoSetColors = initializeCellSetColor(obsSets, []);
|
|
21222
21251
|
coordinationValues.sampleSetColor = newAutoSetColors;
|
|
21223
|
-
return
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
}, null, coordinationValues)
|
|
21229
|
-
);
|
|
21252
|
+
return new LoaderResult({
|
|
21253
|
+
sampleIndex: obsIndex,
|
|
21254
|
+
sampleSets: obsSets,
|
|
21255
|
+
sampleSetsMembership: obsSetsMembership
|
|
21256
|
+
}, null, coordinationValues);
|
|
21230
21257
|
}
|
|
21231
21258
|
}
|
|
21232
21259
|
function isEqualPathPair(pathPairA, pathPairB) {
|
|
@@ -21246,19 +21273,15 @@ class ComparisonMetadataAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21246
21273
|
*/
|
|
21247
21274
|
async load() {
|
|
21248
21275
|
const { path } = this.options;
|
|
21249
|
-
const superResult = await super.load().catch((reason) => Promise.resolve(reason));
|
|
21250
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
21251
|
-
return Promise.reject(superResult);
|
|
21252
|
-
}
|
|
21253
21276
|
const metadata = await loadComparisonMetadata(this.dataSource, path);
|
|
21254
|
-
return
|
|
21277
|
+
return new LoaderResult(
|
|
21255
21278
|
{
|
|
21256
21279
|
// Should a more complex class be wrapping this
|
|
21257
21280
|
// JSON object to help with downstream querying?
|
|
21258
21281
|
comparisonMetadata: metadata
|
|
21259
21282
|
},
|
|
21260
21283
|
null
|
|
21261
|
-
)
|
|
21284
|
+
);
|
|
21262
21285
|
}
|
|
21263
21286
|
}
|
|
21264
21287
|
let FeatureStatsAnndataLoader$1 = class FeatureStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -21671,17 +21694,18 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
21671
21694
|
}
|
|
21672
21695
|
}
|
|
21673
21696
|
class GenomicProfilesZarrLoader extends AbstractTwoStepLoader {
|
|
21674
|
-
loadAttrs() {
|
|
21697
|
+
async loadAttrs() {
|
|
21675
21698
|
if (this.attrs) {
|
|
21676
21699
|
return this.attrs;
|
|
21677
21700
|
}
|
|
21678
|
-
this.attrs = this.dataSource.getJson(".zattrs");
|
|
21701
|
+
this.attrs = await this.dataSource.getJson(".zattrs");
|
|
21679
21702
|
return this.attrs;
|
|
21680
21703
|
}
|
|
21681
|
-
load() {
|
|
21704
|
+
async load() {
|
|
21682
21705
|
const { url, requestInit: requestInit2 } = this;
|
|
21683
21706
|
const storeRoot = this.dataSource.getStoreRoot("/");
|
|
21684
|
-
|
|
21707
|
+
const attrs = await this.loadAttrs();
|
|
21708
|
+
return new LoaderResult(
|
|
21685
21709
|
{
|
|
21686
21710
|
genomicProfiles: {
|
|
21687
21711
|
storeRoot,
|
|
@@ -21691,7 +21715,7 @@ class GenomicProfilesZarrLoader extends AbstractTwoStepLoader {
|
|
|
21691
21715
|
url,
|
|
21692
21716
|
null,
|
|
21693
21717
|
requestInit2
|
|
21694
|
-
)
|
|
21718
|
+
);
|
|
21695
21719
|
}
|
|
21696
21720
|
}
|
|
21697
21721
|
export {
|