cod-dicomweb-server 1.3.9 → 1.3.11
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/cjs/main.js +468 -242
- package/dist/esm/classes/CodDicomWebServer.js +0 -4
- package/dist/esm/dataRetrieval/scripts/filePartial.js +1 -1
- package/dist/esm/dataRetrieval/scripts/fileStreaming.js +1 -1
- package/dist/esm/fileAccessSystemUtils.d.ts +11 -5
- package/dist/esm/fileAccessSystemUtils.js +76 -27
- package/dist/esm/metadataManager.js +8 -1
- package/dist/umd/563.js +2 -2
- package/dist/umd/563.js.map +1 -1
- package/dist/umd/846.js +2 -2
- package/dist/umd/846.js.map +1 -1
- package/dist/umd/main.js +3 -3
- package/dist/umd/main.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/main.js
CHANGED
|
@@ -1162,123 +1162,6 @@ function createMetadataJsonUrl(params) {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
return "".concat(domain, "/").concat(bucketName, "/").concat(bucketPrefix, "/studies/").concat(studyInstanceUID, "/series/").concat(seriesInstanceUID, "/metadata.json");
|
|
1164
1164
|
}
|
|
1165
|
-
;// ./src/metadataManager.ts
|
|
1166
|
-
function metadataManager_typeof(o) { "@babel/helpers - typeof"; return metadataManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, metadataManager_typeof(o); }
|
|
1167
|
-
function metadataManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ metadataManager_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == metadataManager_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(metadataManager_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
1168
|
-
function metadataManager_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
1169
|
-
function metadataManager_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { metadataManager_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { metadataManager_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1170
|
-
function metadataManager_slicedToArray(r, e) { return metadataManager_arrayWithHoles(r) || metadataManager_iterableToArrayLimit(r, e) || metadataManager_unsupportedIterableToArray(r, e) || metadataManager_nonIterableRest(); }
|
|
1171
|
-
function metadataManager_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1172
|
-
function metadataManager_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return metadataManager_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? metadataManager_arrayLikeToArray(r, a) : void 0; } }
|
|
1173
|
-
function metadataManager_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1174
|
-
function metadataManager_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
1175
|
-
function metadataManager_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1176
|
-
function metadataManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
1177
|
-
function metadataManager_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, metadataManager_toPropertyKey(o.key), o); } }
|
|
1178
|
-
function metadataManager_createClass(e, r, t) { return r && metadataManager_defineProperties(e.prototype, r), t && metadataManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
1179
|
-
function metadataManager_defineProperty(e, r, t) { return (r = metadataManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
1180
|
-
function metadataManager_toPropertyKey(t) { var i = metadataManager_toPrimitive(t, "string"); return "symbol" == metadataManager_typeof(i) ? i : i + ""; }
|
|
1181
|
-
function metadataManager_toPrimitive(t, r) { if ("object" != metadataManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != metadataManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
var MetadataManager = /*#__PURE__*/function () {
|
|
1185
|
-
function MetadataManager() {
|
|
1186
|
-
metadataManager_classCallCheck(this, MetadataManager);
|
|
1187
|
-
metadataManager_defineProperty(this, "metadataPromises", {});
|
|
1188
|
-
}
|
|
1189
|
-
return metadataManager_createClass(MetadataManager, [{
|
|
1190
|
-
key: "addDeidMetadata",
|
|
1191
|
-
value: function addDeidMetadata(jsonMetadata, url) {
|
|
1192
|
-
var _url$match;
|
|
1193
|
-
var cod = jsonMetadata.cod;
|
|
1194
|
-
var _ref = ((_url$match = url.match(/studies\/(.*?)\/metadata/)) === null || _url$match === void 0 ? void 0 : _url$match[1].split('/')) || [],
|
|
1195
|
-
_ref2 = metadataManager_slicedToArray(_ref, 3),
|
|
1196
|
-
studyUID = _ref2[0],
|
|
1197
|
-
_ = _ref2[1],
|
|
1198
|
-
seriesUID = _ref2[2];
|
|
1199
|
-
if (!cod || !studyUID || !seriesUID) {
|
|
1200
|
-
console.warn('Missing required metadata properties: cod, studyUID, or seriesUID');
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
for (var sopUID in cod.instances) {
|
|
1204
|
-
var instance = cod.instances[sopUID];
|
|
1205
|
-
instance.metadata.DeidStudyInstanceUID = {
|
|
1206
|
-
Value: [studyUID]
|
|
1207
|
-
};
|
|
1208
|
-
instance.metadata.DeidSeriesInstanceUID = {
|
|
1209
|
-
Value: [seriesUID]
|
|
1210
|
-
};
|
|
1211
|
-
instance.metadata.DeidSopInstanceUID = {
|
|
1212
|
-
Value: [sopUID]
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}, {
|
|
1217
|
-
key: "getMetadataFromCache",
|
|
1218
|
-
value: function getMetadataFromCache(url) {
|
|
1219
|
-
return this.metadataPromises[url];
|
|
1220
|
-
}
|
|
1221
|
-
}, {
|
|
1222
|
-
key: "getMetadata",
|
|
1223
|
-
value: function () {
|
|
1224
|
-
var _getMetadata = metadataManager_asyncToGenerator(/*#__PURE__*/metadataManager_regeneratorRuntime().mark(function _callee(params, headers) {
|
|
1225
|
-
var _this = this;
|
|
1226
|
-
var url, cachedMetadata;
|
|
1227
|
-
return metadataManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1228
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1229
|
-
case 0:
|
|
1230
|
-
url = createMetadataJsonUrl(params);
|
|
1231
|
-
if (url) {
|
|
1232
|
-
_context.next = 3;
|
|
1233
|
-
break;
|
|
1234
|
-
}
|
|
1235
|
-
throw new CustomError('Error creating metadata json url');
|
|
1236
|
-
case 3:
|
|
1237
|
-
cachedMetadata = this.getMetadataFromCache(url);
|
|
1238
|
-
if (!cachedMetadata) {
|
|
1239
|
-
_context.next = 8;
|
|
1240
|
-
break;
|
|
1241
|
-
}
|
|
1242
|
-
_context.next = 7;
|
|
1243
|
-
return cachedMetadata;
|
|
1244
|
-
case 7:
|
|
1245
|
-
return _context.abrupt("return", _context.sent);
|
|
1246
|
-
case 8:
|
|
1247
|
-
_context.prev = 8;
|
|
1248
|
-
this.metadataPromises[url] = fetch(url, {
|
|
1249
|
-
headers: headers
|
|
1250
|
-
}).then(function (response) {
|
|
1251
|
-
if (!response.ok) {
|
|
1252
|
-
throw new CustomError("Failed to fetch metadata: ".concat(response.statusText));
|
|
1253
|
-
}
|
|
1254
|
-
return response.json();
|
|
1255
|
-
}).then(function (data) {
|
|
1256
|
-
_this.addDeidMetadata(data, url);
|
|
1257
|
-
return data;
|
|
1258
|
-
});
|
|
1259
|
-
_context.next = 12;
|
|
1260
|
-
return this.metadataPromises[url];
|
|
1261
|
-
case 12:
|
|
1262
|
-
return _context.abrupt("return", _context.sent);
|
|
1263
|
-
case 15:
|
|
1264
|
-
_context.prev = 15;
|
|
1265
|
-
_context.t0 = _context["catch"](8);
|
|
1266
|
-
console.error(_context.t0);
|
|
1267
|
-
throw _context.t0;
|
|
1268
|
-
case 19:
|
|
1269
|
-
case "end":
|
|
1270
|
-
return _context.stop();
|
|
1271
|
-
}
|
|
1272
|
-
}, _callee, this, [[8, 15]]);
|
|
1273
|
-
}));
|
|
1274
|
-
function getMetadata(_x, _x2) {
|
|
1275
|
-
return _getMetadata.apply(this, arguments);
|
|
1276
|
-
}
|
|
1277
|
-
return getMetadata;
|
|
1278
|
-
}()
|
|
1279
|
-
}]);
|
|
1280
|
-
}();
|
|
1281
|
-
/* harmony default export */ const metadataManager = (MetadataManager);
|
|
1282
1165
|
;// ./node_modules/idb-keyval/dist/index.js
|
|
1283
1166
|
function promisifyRequest(request) {
|
|
1284
1167
|
return new Promise((resolve, reject) => {
|
|
@@ -1479,8 +1362,16 @@ function entries(customStore = defaultGetStore()) {
|
|
|
1479
1362
|
;// ./src/fileAccessSystemUtils.ts
|
|
1480
1363
|
function fileAccessSystemUtils_typeof(o) { "@babel/helpers - typeof"; return fileAccessSystemUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, fileAccessSystemUtils_typeof(o); }
|
|
1481
1364
|
function fileAccessSystemUtils_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ fileAccessSystemUtils_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == fileAccessSystemUtils_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(fileAccessSystemUtils_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
1365
|
+
function fileAccessSystemUtils_slicedToArray(r, e) { return fileAccessSystemUtils_arrayWithHoles(r) || fileAccessSystemUtils_iterableToArrayLimit(r, e) || fileAccessSystemUtils_unsupportedIterableToArray(r, e) || fileAccessSystemUtils_nonIterableRest(); }
|
|
1366
|
+
function fileAccessSystemUtils_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1367
|
+
function fileAccessSystemUtils_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return fileAccessSystemUtils_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? fileAccessSystemUtils_arrayLikeToArray(r, a) : void 0; } }
|
|
1368
|
+
function fileAccessSystemUtils_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1369
|
+
function fileAccessSystemUtils_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
1370
|
+
function fileAccessSystemUtils_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1482
1371
|
function fileAccessSystemUtils_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
1483
1372
|
function fileAccessSystemUtils_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { fileAccessSystemUtils_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { fileAccessSystemUtils_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1373
|
+
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
1374
|
+
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
1484
1375
|
|
|
1485
1376
|
|
|
1486
1377
|
var directoryHandle;
|
|
@@ -1524,156 +1415,246 @@ function _getDirectoryHandle() {
|
|
|
1524
1415
|
}));
|
|
1525
1416
|
return _getDirectoryHandle.apply(this, arguments);
|
|
1526
1417
|
}
|
|
1527
|
-
function
|
|
1528
|
-
return
|
|
1418
|
+
function readJsonFile(_x, _x2) {
|
|
1419
|
+
return _readJsonFile.apply(this, arguments);
|
|
1529
1420
|
}
|
|
1530
|
-
function
|
|
1531
|
-
|
|
1532
|
-
var pathParts, currentDir, i, fileName, fileHandle, seriesInstanceUID, _i, _fileHandle, fileArraybuffer;
|
|
1421
|
+
function _readJsonFile() {
|
|
1422
|
+
_readJsonFile = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee2(directoryHandle, name) {
|
|
1533
1423
|
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1534
1424
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1535
1425
|
case 0:
|
|
1426
|
+
_context2.next = 2;
|
|
1427
|
+
return directoryHandle.getFileHandle(name).then(function (fileHandle) {
|
|
1428
|
+
return fileHandle.getFile().then(function (file) {
|
|
1429
|
+
return file.text();
|
|
1430
|
+
}).then(function (metadataString) {
|
|
1431
|
+
return JSON.parse(metadataString);
|
|
1432
|
+
});
|
|
1433
|
+
})["catch"](function () {
|
|
1434
|
+
return null;
|
|
1435
|
+
});
|
|
1436
|
+
case 2:
|
|
1437
|
+
return _context2.abrupt("return", _context2.sent);
|
|
1438
|
+
case 3:
|
|
1439
|
+
case "end":
|
|
1440
|
+
return _context2.stop();
|
|
1441
|
+
}
|
|
1442
|
+
}, _callee2);
|
|
1443
|
+
}));
|
|
1444
|
+
return _readJsonFile.apply(this, arguments);
|
|
1445
|
+
}
|
|
1446
|
+
function readArrayBufferFile(_x3, _x4) {
|
|
1447
|
+
return _readArrayBufferFile.apply(this, arguments);
|
|
1448
|
+
}
|
|
1449
|
+
function _readArrayBufferFile() {
|
|
1450
|
+
_readArrayBufferFile = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee3(directoryHandle, name) {
|
|
1451
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1452
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1453
|
+
case 0:
|
|
1454
|
+
_context3.next = 2;
|
|
1455
|
+
return directoryHandle.getFileHandle(name).then(function (fileHandle) {
|
|
1456
|
+
return fileHandle.getFile().then(function (file) {
|
|
1457
|
+
return file.arrayBuffer();
|
|
1458
|
+
});
|
|
1459
|
+
})["catch"](function () {
|
|
1460
|
+
return null;
|
|
1461
|
+
});
|
|
1462
|
+
case 2:
|
|
1463
|
+
return _context3.abrupt("return", _context3.sent);
|
|
1464
|
+
case 3:
|
|
1465
|
+
case "end":
|
|
1466
|
+
return _context3.stop();
|
|
1467
|
+
}
|
|
1468
|
+
}, _callee3);
|
|
1469
|
+
}));
|
|
1470
|
+
return _readArrayBufferFile.apply(this, arguments);
|
|
1471
|
+
}
|
|
1472
|
+
function readFile(_x5, _x6) {
|
|
1473
|
+
return _readFile.apply(this, arguments);
|
|
1474
|
+
}
|
|
1475
|
+
function _readFile() {
|
|
1476
|
+
_readFile = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee5(directoryHandle, name) {
|
|
1477
|
+
var options,
|
|
1478
|
+
pathParts,
|
|
1479
|
+
currentDir,
|
|
1480
|
+
i,
|
|
1481
|
+
fileName,
|
|
1482
|
+
_args5 = arguments;
|
|
1483
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1484
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1485
|
+
case 0:
|
|
1486
|
+
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
|
|
1536
1487
|
if (name) {
|
|
1537
|
-
|
|
1488
|
+
_context5.next = 3;
|
|
1538
1489
|
break;
|
|
1539
1490
|
}
|
|
1540
|
-
return
|
|
1541
|
-
case
|
|
1491
|
+
return _context5.abrupt("return");
|
|
1492
|
+
case 3:
|
|
1542
1493
|
pathParts = name.split('/');
|
|
1543
1494
|
currentDir = directoryHandle;
|
|
1544
|
-
|
|
1495
|
+
_context5.prev = 5;
|
|
1545
1496
|
i = 0;
|
|
1546
|
-
case
|
|
1497
|
+
case 7:
|
|
1547
1498
|
if (!(i < pathParts.length - 1)) {
|
|
1548
|
-
|
|
1499
|
+
_context5.next = 14;
|
|
1549
1500
|
break;
|
|
1550
1501
|
}
|
|
1551
|
-
|
|
1552
|
-
return currentDir.getDirectoryHandle(pathParts[i]
|
|
1553
|
-
|
|
1554
|
-
|
|
1502
|
+
_context5.next = 10;
|
|
1503
|
+
return currentDir.getDirectoryHandle(pathParts[i], {
|
|
1504
|
+
create: true
|
|
1505
|
+
});
|
|
1555
1506
|
case 10:
|
|
1507
|
+
currentDir = _context5.sent;
|
|
1508
|
+
case 11:
|
|
1556
1509
|
i++;
|
|
1557
|
-
|
|
1510
|
+
_context5.next = 7;
|
|
1558
1511
|
break;
|
|
1559
|
-
case
|
|
1512
|
+
case 14:
|
|
1560
1513
|
fileName = pathParts.at(-1);
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
case 16:
|
|
1564
|
-
fileHandle = _context2.sent;
|
|
1565
|
-
_context2.next = 19;
|
|
1566
|
-
return fileHandle.getFile().then(function (file) {
|
|
1567
|
-
return file.arrayBuffer();
|
|
1568
|
-
});
|
|
1569
|
-
case 19:
|
|
1570
|
-
return _context2.abrupt("return", _context2.sent);
|
|
1571
|
-
case 22:
|
|
1572
|
-
_context2.prev = 22;
|
|
1573
|
-
_context2.t0 = _context2["catch"](4);
|
|
1574
|
-
console.warn("Error reading the file ".concat(name, ": ").concat(_context2.t0.message));
|
|
1575
|
-
if (!(offsets && pathParts[0] === FILE_SYSTEM_ROUTES.Partial)) {
|
|
1576
|
-
_context2.next = 49;
|
|
1577
|
-
break;
|
|
1578
|
-
}
|
|
1579
|
-
_context2.prev = 26;
|
|
1580
|
-
seriesInstanceUID = pathParts.at(-1).slice(0, name.lastIndexOf('.')).split('_')[0];
|
|
1581
|
-
pathParts = pathParts.slice(1);
|
|
1582
|
-
_i = 0;
|
|
1583
|
-
case 30:
|
|
1584
|
-
if (!(_i < pathParts.length - 1)) {
|
|
1585
|
-
_context2.next = 37;
|
|
1514
|
+
if (!options.isJson) {
|
|
1515
|
+
_context5.next = 19;
|
|
1586
1516
|
break;
|
|
1587
1517
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1518
|
+
return _context5.abrupt("return", readJsonFile(currentDir, fileName));
|
|
1519
|
+
case 19:
|
|
1520
|
+
return _context5.abrupt("return", readArrayBufferFile(currentDir, fileName)["catch"](/*#__PURE__*/fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee4() {
|
|
1521
|
+
var _i, convertedFileName, fileArraybuffer;
|
|
1522
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1523
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1524
|
+
case 0:
|
|
1525
|
+
console.warn("Error reading the file ".concat(name, " from partial folder, trying from full file"));
|
|
1526
|
+
if (!(options.offsets && pathParts.includes(FILE_SYSTEM_ROUTES.Partial))) {
|
|
1527
|
+
_context4.next = 23;
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1530
|
+
_context4.prev = 2;
|
|
1531
|
+
pathParts.splice(pathParts.findIndex(function (part) {
|
|
1532
|
+
return part === FILE_SYSTEM_ROUTES.Partial;
|
|
1533
|
+
}), 1);
|
|
1534
|
+
currentDir = directoryHandle;
|
|
1535
|
+
_i = 0;
|
|
1536
|
+
case 6:
|
|
1537
|
+
if (!(_i < pathParts.length - 1)) {
|
|
1538
|
+
_context4.next = 13;
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
_context4.next = 9;
|
|
1542
|
+
return currentDir.getDirectoryHandle(pathParts[_i], {
|
|
1543
|
+
create: true
|
|
1544
|
+
});
|
|
1545
|
+
case 9:
|
|
1546
|
+
currentDir = _context4.sent;
|
|
1547
|
+
case 10:
|
|
1548
|
+
_i++;
|
|
1549
|
+
_context4.next = 6;
|
|
1550
|
+
break;
|
|
1551
|
+
case 13:
|
|
1552
|
+
convertedFileName = pathParts.at(-1).split('_')[0] + '.tar';
|
|
1553
|
+
_context4.next = 16;
|
|
1554
|
+
return readArrayBufferFile(currentDir, convertedFileName);
|
|
1555
|
+
case 16:
|
|
1556
|
+
fileArraybuffer = _context4.sent;
|
|
1557
|
+
return _context4.abrupt("return", fileArraybuffer.slice(options.offsets.startByte, options.offsets.endByte));
|
|
1558
|
+
case 20:
|
|
1559
|
+
_context4.prev = 20;
|
|
1560
|
+
_context4.t0 = _context4["catch"](2);
|
|
1561
|
+
console.warn("Error reading the file ".concat(name, ": ").concat(_context4.t0.message));
|
|
1562
|
+
case 23:
|
|
1563
|
+
case "end":
|
|
1564
|
+
return _context4.stop();
|
|
1565
|
+
}
|
|
1566
|
+
}, _callee4, null, [[2, 20]]);
|
|
1567
|
+
}))));
|
|
1568
|
+
case 20:
|
|
1569
|
+
_context5.next = 25;
|
|
1595
1570
|
break;
|
|
1596
|
-
case
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
_context2.next = 42;
|
|
1602
|
-
return _fileHandle.getFile().then(function (file) {
|
|
1603
|
-
return file.arrayBuffer();
|
|
1604
|
-
});
|
|
1605
|
-
case 42:
|
|
1606
|
-
fileArraybuffer = _context2.sent;
|
|
1607
|
-
return _context2.abrupt("return", fileArraybuffer.slice(offsets.startByte, offsets.endByte));
|
|
1608
|
-
case 46:
|
|
1609
|
-
_context2.prev = 46;
|
|
1610
|
-
_context2.t1 = _context2["catch"](26);
|
|
1611
|
-
console.warn("Error reading the file ".concat(name, ": ").concat(_context2.t1.message));
|
|
1612
|
-
case 49:
|
|
1571
|
+
case 22:
|
|
1572
|
+
_context5.prev = 22;
|
|
1573
|
+
_context5.t0 = _context5["catch"](5);
|
|
1574
|
+
console.warn("Error reading the file ".concat(name, ": ").concat(_context5.t0.message));
|
|
1575
|
+
case 25:
|
|
1613
1576
|
case "end":
|
|
1614
|
-
return
|
|
1577
|
+
return _context5.stop();
|
|
1615
1578
|
}
|
|
1616
|
-
},
|
|
1579
|
+
}, _callee5, null, [[5, 22]]);
|
|
1617
1580
|
}));
|
|
1618
1581
|
return _readFile.apply(this, arguments);
|
|
1619
1582
|
}
|
|
1620
|
-
function writeFile(
|
|
1583
|
+
function writeFile(_x7, _x8, _x9) {
|
|
1621
1584
|
return _writeFile.apply(this, arguments);
|
|
1622
1585
|
}
|
|
1623
1586
|
function _writeFile() {
|
|
1624
|
-
_writeFile = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function
|
|
1625
|
-
var
|
|
1626
|
-
|
|
1627
|
-
|
|
1587
|
+
_writeFile = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee6(directoryHandle, name, file) {
|
|
1588
|
+
var isJson,
|
|
1589
|
+
pathParts,
|
|
1590
|
+
currentDir,
|
|
1591
|
+
i,
|
|
1592
|
+
fileName,
|
|
1593
|
+
fileHandle,
|
|
1594
|
+
fileWritable,
|
|
1595
|
+
_args6 = arguments;
|
|
1596
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1597
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1628
1598
|
case 0:
|
|
1629
|
-
|
|
1599
|
+
isJson = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : false;
|
|
1600
|
+
_context6.prev = 1;
|
|
1630
1601
|
pathParts = name.split('/');
|
|
1631
1602
|
currentDir = directoryHandle;
|
|
1632
1603
|
i = 0;
|
|
1633
|
-
case
|
|
1604
|
+
case 5:
|
|
1634
1605
|
if (!(i < pathParts.length - 1)) {
|
|
1635
|
-
|
|
1606
|
+
_context6.next = 12;
|
|
1636
1607
|
break;
|
|
1637
1608
|
}
|
|
1638
|
-
|
|
1609
|
+
_context6.next = 8;
|
|
1639
1610
|
return currentDir.getDirectoryHandle(pathParts[i], {
|
|
1640
1611
|
create: true
|
|
1641
1612
|
});
|
|
1642
|
-
case 7:
|
|
1643
|
-
currentDir = _context3.sent;
|
|
1644
1613
|
case 8:
|
|
1614
|
+
currentDir = _context6.sent;
|
|
1615
|
+
case 9:
|
|
1645
1616
|
i++;
|
|
1646
|
-
|
|
1617
|
+
_context6.next = 5;
|
|
1647
1618
|
break;
|
|
1648
|
-
case
|
|
1649
|
-
fileName = pathParts
|
|
1650
|
-
|
|
1619
|
+
case 12:
|
|
1620
|
+
fileName = pathParts.at(-1);
|
|
1621
|
+
_context6.next = 15;
|
|
1651
1622
|
return currentDir.getFileHandle(fileName, {
|
|
1652
1623
|
create: true
|
|
1653
1624
|
});
|
|
1654
|
-
case
|
|
1655
|
-
fileHandle =
|
|
1656
|
-
|
|
1625
|
+
case 15:
|
|
1626
|
+
fileHandle = _context6.sent;
|
|
1627
|
+
_context6.next = 18;
|
|
1657
1628
|
return fileHandle.createWritable();
|
|
1658
|
-
case
|
|
1659
|
-
fileWritable =
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1629
|
+
case 18:
|
|
1630
|
+
fileWritable = _context6.sent;
|
|
1631
|
+
if (!isJson) {
|
|
1632
|
+
_context6.next = 24;
|
|
1633
|
+
break;
|
|
1634
|
+
}
|
|
1635
|
+
_context6.next = 22;
|
|
1636
|
+
return fileWritable.write(JSON.stringify(file));
|
|
1665
1637
|
case 22:
|
|
1666
|
-
|
|
1638
|
+
_context6.next = 26;
|
|
1667
1639
|
break;
|
|
1668
1640
|
case 24:
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1641
|
+
_context6.next = 26;
|
|
1642
|
+
return fileWritable.write(file);
|
|
1643
|
+
case 26:
|
|
1644
|
+
_context6.next = 28;
|
|
1645
|
+
return fileWritable.close();
|
|
1646
|
+
case 28:
|
|
1647
|
+
_context6.next = 33;
|
|
1648
|
+
break;
|
|
1649
|
+
case 30:
|
|
1650
|
+
_context6.prev = 30;
|
|
1651
|
+
_context6.t0 = _context6["catch"](1);
|
|
1652
|
+
console.warn("Error writing the file ".concat(name, ": ").concat(_context6.t0.message));
|
|
1653
|
+
case 33:
|
|
1673
1654
|
case "end":
|
|
1674
|
-
return
|
|
1655
|
+
return _context6.stop();
|
|
1675
1656
|
}
|
|
1676
|
-
},
|
|
1657
|
+
}, _callee6, null, [[1, 30]]);
|
|
1677
1658
|
}));
|
|
1678
1659
|
return _writeFile.apply(this, arguments);
|
|
1679
1660
|
}
|
|
@@ -1698,38 +1679,281 @@ function clearPartialFiles() {
|
|
|
1698
1679
|
return _clearPartialFiles.apply(this, arguments);
|
|
1699
1680
|
}
|
|
1700
1681
|
function _clearPartialFiles() {
|
|
1701
|
-
_clearPartialFiles = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function
|
|
1702
|
-
|
|
1703
|
-
|
|
1682
|
+
_clearPartialFiles = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee8() {
|
|
1683
|
+
var _removePartialFolder;
|
|
1684
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
1685
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1704
1686
|
case 0:
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1687
|
+
_removePartialFolder = /*#__PURE__*/function () {
|
|
1688
|
+
var _ref2 = fileAccessSystemUtils_asyncToGenerator(/*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _callee7(dirHandle) {
|
|
1689
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
|
|
1690
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
1691
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1692
|
+
case 0:
|
|
1693
|
+
// @ts-ignore
|
|
1694
|
+
_iteratorAbruptCompletion = false;
|
|
1695
|
+
_didIteratorError = false;
|
|
1696
|
+
_context8.prev = 2;
|
|
1697
|
+
_loop = /*#__PURE__*/fileAccessSystemUtils_regeneratorRuntime().mark(function _loop() {
|
|
1698
|
+
var _step$value, name, handle;
|
|
1699
|
+
return fileAccessSystemUtils_regeneratorRuntime().wrap(function _loop$(_context7) {
|
|
1700
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1701
|
+
case 0:
|
|
1702
|
+
_step$value = fileAccessSystemUtils_slicedToArray(_step.value, 2), name = _step$value[0], handle = _step$value[1];
|
|
1703
|
+
if (!(handle.kind === 'directory')) {
|
|
1704
|
+
_context7.next = 9;
|
|
1705
|
+
break;
|
|
1706
|
+
}
|
|
1707
|
+
if (!(name.toLowerCase() === FILE_SYSTEM_ROUTES.Partial)) {
|
|
1708
|
+
_context7.next = 7;
|
|
1709
|
+
break;
|
|
1710
|
+
}
|
|
1711
|
+
_context7.next = 5;
|
|
1712
|
+
return dirHandle.removeEntry(name, {
|
|
1713
|
+
recursive: true
|
|
1714
|
+
})["catch"](function (e) {
|
|
1715
|
+
return console.warn("Failed to remove ".concat(name, ":"), e);
|
|
1716
|
+
});
|
|
1717
|
+
case 5:
|
|
1718
|
+
_context7.next = 9;
|
|
1719
|
+
break;
|
|
1720
|
+
case 7:
|
|
1721
|
+
_context7.next = 9;
|
|
1722
|
+
return _removePartialFolder(handle);
|
|
1723
|
+
case 9:
|
|
1724
|
+
case "end":
|
|
1725
|
+
return _context7.stop();
|
|
1726
|
+
}
|
|
1727
|
+
}, _loop);
|
|
1728
|
+
});
|
|
1729
|
+
_iterator = _asyncIterator(dirHandle.entries());
|
|
1730
|
+
case 5:
|
|
1731
|
+
_context8.next = 7;
|
|
1732
|
+
return _iterator.next();
|
|
1733
|
+
case 7:
|
|
1734
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context8.sent).done)) {
|
|
1735
|
+
_context8.next = 12;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
return _context8.delegateYield(_loop(), "t0", 9);
|
|
1739
|
+
case 9:
|
|
1740
|
+
_iteratorAbruptCompletion = false;
|
|
1741
|
+
_context8.next = 5;
|
|
1742
|
+
break;
|
|
1743
|
+
case 12:
|
|
1744
|
+
_context8.next = 18;
|
|
1745
|
+
break;
|
|
1746
|
+
case 14:
|
|
1747
|
+
_context8.prev = 14;
|
|
1748
|
+
_context8.t1 = _context8["catch"](2);
|
|
1749
|
+
_didIteratorError = true;
|
|
1750
|
+
_iteratorError = _context8.t1;
|
|
1751
|
+
case 18:
|
|
1752
|
+
_context8.prev = 18;
|
|
1753
|
+
_context8.prev = 19;
|
|
1754
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
1755
|
+
_context8.next = 23;
|
|
1756
|
+
break;
|
|
1757
|
+
}
|
|
1758
|
+
_context8.next = 23;
|
|
1759
|
+
return _iterator["return"]();
|
|
1760
|
+
case 23:
|
|
1761
|
+
_context8.prev = 23;
|
|
1762
|
+
if (!_didIteratorError) {
|
|
1763
|
+
_context8.next = 26;
|
|
1764
|
+
break;
|
|
1765
|
+
}
|
|
1766
|
+
throw _iteratorError;
|
|
1767
|
+
case 26:
|
|
1768
|
+
return _context8.finish(23);
|
|
1769
|
+
case 27:
|
|
1770
|
+
return _context8.finish(18);
|
|
1771
|
+
case 28:
|
|
1772
|
+
case "end":
|
|
1773
|
+
return _context8.stop();
|
|
1774
|
+
}
|
|
1775
|
+
}, _callee7, null, [[2, 14, 18, 28], [19,, 23, 27]]);
|
|
1776
|
+
}));
|
|
1777
|
+
return function removePartialFolder(_x10) {
|
|
1778
|
+
return _ref2.apply(this, arguments);
|
|
1779
|
+
};
|
|
1780
|
+
}();
|
|
1781
|
+
_context9.prev = 1;
|
|
1782
|
+
_context9.next = 4;
|
|
1783
|
+
return _removePartialFolder(directoryHandle);
|
|
1784
|
+
case 4:
|
|
1785
|
+
_context9.next = 9;
|
|
1712
1786
|
break;
|
|
1713
|
-
case
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
console.warn("Error clearing partial files: ".concat(
|
|
1717
|
-
case
|
|
1787
|
+
case 6:
|
|
1788
|
+
_context9.prev = 6;
|
|
1789
|
+
_context9.t0 = _context9["catch"](1);
|
|
1790
|
+
console.warn("Error clearing partial files: ".concat(_context9.t0.message));
|
|
1791
|
+
case 9:
|
|
1718
1792
|
case "end":
|
|
1719
|
-
return
|
|
1793
|
+
return _context9.stop();
|
|
1720
1794
|
}
|
|
1721
|
-
},
|
|
1795
|
+
}, _callee8, null, [[1, 6]]);
|
|
1722
1796
|
}));
|
|
1723
1797
|
return _clearPartialFiles.apply(this, arguments);
|
|
1724
1798
|
}
|
|
1799
|
+
function parseCachePath(url) {
|
|
1800
|
+
var urlObj = new URL(url);
|
|
1801
|
+
var bucketPath = urlObj.pathname.match(/\/(.*?)\/studies/)[1];
|
|
1802
|
+
var _urlObj$pathname$matc = urlObj.pathname.match(/studies\/(.*?)(\.tar|\/metadata.json)/)[1].split('/'),
|
|
1803
|
+
_urlObj$pathname$matc2 = fileAccessSystemUtils_slicedToArray(_urlObj$pathname$matc, 3),
|
|
1804
|
+
studyInstanceUID = _urlObj$pathname$matc2[0],
|
|
1805
|
+
_ = _urlObj$pathname$matc2[1],
|
|
1806
|
+
seriesInstanceUID = _urlObj$pathname$matc2[2];
|
|
1807
|
+
return "".concat(bucketPath, "/").concat(studyInstanceUID, "/").concat(seriesInstanceUID);
|
|
1808
|
+
}
|
|
1725
1809
|
function createStreamingFileName(url) {
|
|
1726
|
-
return url.split('series/')[1];
|
|
1810
|
+
return "".concat(parseCachePath(url), "/").concat(url.split('series/')[1]);
|
|
1727
1811
|
}
|
|
1728
1812
|
function createPartialFileName(url, offsets) {
|
|
1729
|
-
var seriesInstanceUID = url.
|
|
1813
|
+
var seriesInstanceUID = url.match(/series\/(.*?).tar/)[1];
|
|
1730
1814
|
var offsetPart = "".concat(offsets ? "_".concat(offsets === null || offsets === void 0 ? void 0 : offsets.startByte, "_").concat(offsets === null || offsets === void 0 ? void 0 : offsets.endByte) : '');
|
|
1731
|
-
return "".concat(FILE_SYSTEM_ROUTES.Partial, "/").concat(seriesInstanceUID).concat(offsetPart, ".dcm");
|
|
1815
|
+
return "".concat(parseCachePath(url), "/").concat(FILE_SYSTEM_ROUTES.Partial, "/").concat(seriesInstanceUID).concat(offsetPart, ".dcm");
|
|
1816
|
+
}
|
|
1817
|
+
function createMetadataFileName(url) {
|
|
1818
|
+
return "".concat(parseCachePath(url), "/metadata.json");
|
|
1732
1819
|
}
|
|
1820
|
+
;// ./src/metadataManager.ts
|
|
1821
|
+
function metadataManager_typeof(o) { "@babel/helpers - typeof"; return metadataManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, metadataManager_typeof(o); }
|
|
1822
|
+
function metadataManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ metadataManager_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == metadataManager_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(metadataManager_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
1823
|
+
function metadataManager_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
1824
|
+
function metadataManager_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { metadataManager_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { metadataManager_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1825
|
+
function metadataManager_slicedToArray(r, e) { return metadataManager_arrayWithHoles(r) || metadataManager_iterableToArrayLimit(r, e) || metadataManager_unsupportedIterableToArray(r, e) || metadataManager_nonIterableRest(); }
|
|
1826
|
+
function metadataManager_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1827
|
+
function metadataManager_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return metadataManager_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? metadataManager_arrayLikeToArray(r, a) : void 0; } }
|
|
1828
|
+
function metadataManager_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1829
|
+
function metadataManager_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
1830
|
+
function metadataManager_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1831
|
+
function metadataManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
1832
|
+
function metadataManager_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, metadataManager_toPropertyKey(o.key), o); } }
|
|
1833
|
+
function metadataManager_createClass(e, r, t) { return r && metadataManager_defineProperties(e.prototype, r), t && metadataManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
1834
|
+
function metadataManager_defineProperty(e, r, t) { return (r = metadataManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
1835
|
+
function metadataManager_toPropertyKey(t) { var i = metadataManager_toPrimitive(t, "string"); return "symbol" == metadataManager_typeof(i) ? i : i + ""; }
|
|
1836
|
+
function metadataManager_toPrimitive(t, r) { if ("object" != metadataManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != metadataManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
var MetadataManager = /*#__PURE__*/function () {
|
|
1841
|
+
function MetadataManager() {
|
|
1842
|
+
metadataManager_classCallCheck(this, MetadataManager);
|
|
1843
|
+
metadataManager_defineProperty(this, "metadataPromises", {});
|
|
1844
|
+
}
|
|
1845
|
+
return metadataManager_createClass(MetadataManager, [{
|
|
1846
|
+
key: "addDeidMetadata",
|
|
1847
|
+
value: function addDeidMetadata(jsonMetadata, url) {
|
|
1848
|
+
var _url$match;
|
|
1849
|
+
var cod = jsonMetadata.cod;
|
|
1850
|
+
var _ref = ((_url$match = url.match(/studies\/(.*?)\/metadata/)) === null || _url$match === void 0 ? void 0 : _url$match[1].split('/')) || [],
|
|
1851
|
+
_ref2 = metadataManager_slicedToArray(_ref, 3),
|
|
1852
|
+
studyUID = _ref2[0],
|
|
1853
|
+
_ = _ref2[1],
|
|
1854
|
+
seriesUID = _ref2[2];
|
|
1855
|
+
if (!cod || !studyUID || !seriesUID) {
|
|
1856
|
+
console.warn('Missing required metadata properties: cod, studyUID, or seriesUID');
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
for (var sopUID in cod.instances) {
|
|
1860
|
+
var instance = cod.instances[sopUID];
|
|
1861
|
+
instance.metadata.DeidStudyInstanceUID = {
|
|
1862
|
+
Value: [studyUID]
|
|
1863
|
+
};
|
|
1864
|
+
instance.metadata.DeidSeriesInstanceUID = {
|
|
1865
|
+
Value: [seriesUID]
|
|
1866
|
+
};
|
|
1867
|
+
instance.metadata.DeidSopInstanceUID = {
|
|
1868
|
+
Value: [sopUID]
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}, {
|
|
1873
|
+
key: "getMetadataFromCache",
|
|
1874
|
+
value: function getMetadataFromCache(url) {
|
|
1875
|
+
return this.metadataPromises[url];
|
|
1876
|
+
}
|
|
1877
|
+
}, {
|
|
1878
|
+
key: "getMetadata",
|
|
1879
|
+
value: function () {
|
|
1880
|
+
var _getMetadata = metadataManager_asyncToGenerator(/*#__PURE__*/metadataManager_regeneratorRuntime().mark(function _callee(params, headers) {
|
|
1881
|
+
var _this = this;
|
|
1882
|
+
var url, cachedMetadata, directoryHandle, fileName, locallyCachedMetadata;
|
|
1883
|
+
return metadataManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1884
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1885
|
+
case 0:
|
|
1886
|
+
url = createMetadataJsonUrl(params);
|
|
1887
|
+
if (url) {
|
|
1888
|
+
_context.next = 3;
|
|
1889
|
+
break;
|
|
1890
|
+
}
|
|
1891
|
+
throw new CustomError('Error creating metadata json url');
|
|
1892
|
+
case 3:
|
|
1893
|
+
cachedMetadata = this.getMetadataFromCache(url);
|
|
1894
|
+
if (!cachedMetadata) {
|
|
1895
|
+
_context.next = 8;
|
|
1896
|
+
break;
|
|
1897
|
+
}
|
|
1898
|
+
_context.next = 7;
|
|
1899
|
+
return cachedMetadata;
|
|
1900
|
+
case 7:
|
|
1901
|
+
return _context.abrupt("return", _context.sent);
|
|
1902
|
+
case 8:
|
|
1903
|
+
_context.next = 10;
|
|
1904
|
+
return getDirectoryHandle();
|
|
1905
|
+
case 10:
|
|
1906
|
+
directoryHandle = _context.sent;
|
|
1907
|
+
fileName = createMetadataFileName(url);
|
|
1908
|
+
_context.next = 14;
|
|
1909
|
+
return readFile(directoryHandle, fileName, {
|
|
1910
|
+
isJson: true
|
|
1911
|
+
});
|
|
1912
|
+
case 14:
|
|
1913
|
+
locallyCachedMetadata = _context.sent;
|
|
1914
|
+
if (!locallyCachedMetadata) {
|
|
1915
|
+
_context.next = 17;
|
|
1916
|
+
break;
|
|
1917
|
+
}
|
|
1918
|
+
return _context.abrupt("return", locallyCachedMetadata);
|
|
1919
|
+
case 17:
|
|
1920
|
+
_context.prev = 17;
|
|
1921
|
+
this.metadataPromises[url] = fetch(url, {
|
|
1922
|
+
headers: headers
|
|
1923
|
+
}).then(function (response) {
|
|
1924
|
+
if (!response.ok) {
|
|
1925
|
+
throw new CustomError("Failed to fetch metadata: ".concat(response.statusText));
|
|
1926
|
+
}
|
|
1927
|
+
return response.json();
|
|
1928
|
+
}).then(function (data) {
|
|
1929
|
+
_this.addDeidMetadata(data, url);
|
|
1930
|
+
return writeFile(directoryHandle, fileName, data, true).then(function () {
|
|
1931
|
+
return data;
|
|
1932
|
+
});
|
|
1933
|
+
});
|
|
1934
|
+
_context.next = 21;
|
|
1935
|
+
return this.metadataPromises[url];
|
|
1936
|
+
case 21:
|
|
1937
|
+
return _context.abrupt("return", _context.sent);
|
|
1938
|
+
case 24:
|
|
1939
|
+
_context.prev = 24;
|
|
1940
|
+
_context.t0 = _context["catch"](17);
|
|
1941
|
+
console.error(_context.t0);
|
|
1942
|
+
throw _context.t0;
|
|
1943
|
+
case 28:
|
|
1944
|
+
case "end":
|
|
1945
|
+
return _context.stop();
|
|
1946
|
+
}
|
|
1947
|
+
}, _callee, this, [[17, 24]]);
|
|
1948
|
+
}));
|
|
1949
|
+
function getMetadata(_x, _x2) {
|
|
1950
|
+
return _getMetadata.apply(this, arguments);
|
|
1951
|
+
}
|
|
1952
|
+
return getMetadata;
|
|
1953
|
+
}()
|
|
1954
|
+
}]);
|
|
1955
|
+
}();
|
|
1956
|
+
/* harmony default export */ const metadataManager = (MetadataManager);
|
|
1733
1957
|
;// ./src/dataRetrieval/scripts/filePartial.ts
|
|
1734
1958
|
function filePartial_typeof(o) { "@babel/helpers - typeof"; return filePartial_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, filePartial_typeof(o); }
|
|
1735
1959
|
function filePartial_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ filePartial_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == filePartial_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(filePartial_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
@@ -1754,7 +1978,10 @@ var filePartial = {
|
|
|
1754
1978
|
break;
|
|
1755
1979
|
}
|
|
1756
1980
|
_context.next = 6;
|
|
1757
|
-
return readFile(directoryHandle, storageName,
|
|
1981
|
+
return readFile(directoryHandle, storageName, {
|
|
1982
|
+
offsets: offsets,
|
|
1983
|
+
isJson: false
|
|
1984
|
+
});
|
|
1758
1985
|
case 6:
|
|
1759
1986
|
file = _context.sent;
|
|
1760
1987
|
if (!file) {
|
|
@@ -1838,7 +2065,9 @@ var fileStreaming = {
|
|
|
1838
2065
|
break;
|
|
1839
2066
|
}
|
|
1840
2067
|
_context.next = 9;
|
|
1841
|
-
return readFile(directoryHandle, fileName
|
|
2068
|
+
return readFile(directoryHandle, fileName, {
|
|
2069
|
+
isJson: false
|
|
2070
|
+
});
|
|
1842
2071
|
case 9:
|
|
1843
2072
|
file = _context.sent;
|
|
1844
2073
|
if (!file) {
|
|
@@ -2210,9 +2439,6 @@ var CodDicomWebServer = /*#__PURE__*/function () {
|
|
|
2210
2439
|
var _pixelDataElement$fra = pixelDataElement.fragments[0];
|
|
2211
2440
|
dataOffset = _pixelDataElement$fra.position;
|
|
2212
2441
|
length = _pixelDataElement$fra.length;
|
|
2213
|
-
} else {
|
|
2214
|
-
// Adding 8 bytes for 4 bytes tag + 4 bytes length for uncomppressed pixelData
|
|
2215
|
-
dataOffset += 8;
|
|
2216
2442
|
}
|
|
2217
2443
|
return arraybuffer.slice(dataOffset, dataOffset + length);
|
|
2218
2444
|
}
|