cod-dicomweb-server 1.2.4 → 1.3.1
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/README.md +21 -0
- package/dist/cjs/1104a37b16dee0d2ada1.ts +14 -0
- package/dist/cjs/7d4e5892d21def245792.ts +14 -0
- package/dist/cjs/main.js +1957 -0
- package/dist/esm/classes/CodDicomWebServer.d.ts +1 -0
- package/dist/esm/classes/CodDicomWebServer.js +65 -48
- package/dist/esm/classes/customClasses.d.ts +19 -0
- package/dist/esm/classes/customClasses.js +13 -0
- package/dist/esm/classes/index.d.ts +2 -0
- package/dist/esm/classes/index.js +2 -0
- package/dist/esm/classes/utils.js +4 -3
- package/dist/esm/constants/enums.d.ts +4 -0
- package/dist/esm/constants/enums.js +5 -0
- package/dist/esm/constants/index.d.ts +3 -3
- package/dist/esm/constants/index.js +3 -3
- package/dist/esm/dataRetrieval/dataRetrievalManager.d.ts +17 -0
- package/dist/esm/dataRetrieval/dataRetrievalManager.js +54 -0
- package/dist/esm/dataRetrieval/register.d.ts +4 -0
- package/dist/esm/dataRetrieval/register.js +25 -0
- package/dist/esm/dataRetrieval/requestManager.d.ts +12 -0
- package/dist/esm/dataRetrieval/requestManager.js +65 -0
- package/dist/esm/dataRetrieval/scripts/filePartial.d.ts +18 -0
- package/dist/esm/dataRetrieval/scripts/filePartial.js +16 -0
- package/dist/esm/{webWorker → dataRetrieval}/scripts/fileStreaming.d.ts +7 -1
- package/dist/esm/{webWorker → dataRetrieval}/scripts/fileStreaming.js +11 -10
- package/dist/esm/dataRetrieval/utils/environment.d.ts +1 -0
- package/dist/esm/dataRetrieval/utils/environment.js +3 -0
- package/dist/esm/dataRetrieval/workerManager.d.ts +10 -0
- package/dist/esm/{webWorker → dataRetrieval}/workerManager.js +9 -8
- package/dist/esm/dataRetrieval/workers/filePartialWorker.js +7 -0
- package/dist/esm/dataRetrieval/workers/fileStreamingWorker.js +7 -0
- package/dist/esm/fileManager.d.ts +2 -2
- package/dist/esm/fileManager.js +8 -8
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/metadataManager.js +3 -2
- package/dist/esm/types/fileManagerOptions.d.ts +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/metadata.d.ts +1 -1
- package/dist/esm/types/scriptObject.d.ts +4 -0
- package/dist/umd/614.js +19 -0
- package/dist/umd/614.js.map +1 -0
- package/dist/umd/66.js +19 -0
- package/dist/umd/66.js.map +1 -0
- package/dist/umd/main.js +2 -2
- package/dist/umd/main.js.map +1 -1
- package/package.json +13 -4
- package/dist/esm/types/workerCustomMessageEvents.d.ts +0 -10
- package/dist/esm/webWorker/registerWorkers.d.ts +0 -4
- package/dist/esm/webWorker/registerWorkers.js +0 -16
- package/dist/esm/webWorker/scripts/filePartial.d.ts +0 -7
- package/dist/esm/webWorker/scripts/filePartial.js +0 -11
- package/dist/esm/webWorker/workerManager.d.ts +0 -10
- package/dist/esm/webWorker/workers/filePartialWorker.js +0 -3
- package/dist/esm/webWorker/workers/fileStreamingWorker.js +0 -3
- package/dist/umd/16.js +0 -19
- package/dist/umd/16.js.map +0 -1
- package/dist/umd/170.js +0 -19
- package/dist/umd/170.js.map +0 -1
- /package/dist/esm/constants/{worker.d.ts → dataRetrieval.d.ts} +0 -0
- /package/dist/esm/constants/{worker.js → dataRetrieval.js} +0 -0
- /package/dist/esm/{webWorker → dataRetrieval}/workers/filePartialWorker.d.ts +0 -0
- /package/dist/esm/{webWorker → dataRetrieval}/workers/fileStreamingWorker.d.ts +0 -0
- /package/dist/esm/types/{workerCustomMessageEvents.js → scriptObject.js} +0 -0
package/dist/cjs/main.js
ADDED
|
@@ -0,0 +1,1957 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ var __webpack_modules__ = ({
|
|
3
|
+
|
|
4
|
+
/***/ 915:
|
|
5
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
6
|
+
|
|
7
|
+
/*! dicom-parser - 1.8.12 - 2023-02-20 | (c) 2017 Chris Hafey | https://github.com/cornerstonejs/dicomParser */
|
|
8
|
+
!function(e,t){ true?module.exports=t(__webpack_require__(106)):0}(this,function(r){return a=[function(e,t){e.exports=r},function(e,t,s){"use strict";s.r(t),s.d(t,"isStringVr",function(){return d}),s.d(t,"isPrivateTag",function(){return f}),s.d(t,"parsePN",function(){return a}),s.d(t,"parseTM",function(){return n}),s.d(t,"parseDA",function(){return o}),s.d(t,"explicitElementToString",function(){return l}),s.d(t,"explicitDataSetToJS",function(){return u}),s.d(t,"createJPEGBasicOffsetTable",function(){return p}),s.d(t,"parseDicomDataSetExplicit",function(){return q}),s.d(t,"parseDicomDataSetImplicit",function(){return T}),s.d(t,"readFixedString",function(){return b}),s.d(t,"alloc",function(){return k}),s.d(t,"version",function(){return L}),s.d(t,"bigEndianByteArrayParser",function(){return N}),s.d(t,"ByteStream",function(){return J}),s.d(t,"sharedCopy",function(){return j}),s.d(t,"DataSet",function(){return w}),s.d(t,"findAndSetUNElementLength",function(){return y}),s.d(t,"findEndOfEncapsulatedElement",function(){return g}),s.d(t,"findItemDelimitationItemAndSetElementLength",function(){return x}),s.d(t,"littleEndianByteArrayParser",function(){return M}),s.d(t,"parseDicom",function(){return V}),s.d(t,"readDicomElementExplicit",function(){return B}),s.d(t,"readDicomElementImplicit",function(){return A}),s.d(t,"readEncapsulatedImageFrame",function(){return W}),s.d(t,"readEncapsulatedPixelData",function(){return K}),s.d(t,"readEncapsulatedPixelDataFromFragments",function(){return _}),s.d(t,"readPart10Header",function(){return G}),s.d(t,"readSequenceItemsExplicit",function(){return I}),s.d(t,"readSequenceItemsImplicit",function(){return F}),s.d(t,"readSequenceItem",function(){return S}),s.d(t,"readTag",function(){return h});var r={AE:!0,AS:!0,AT:!1,CS:!0,DA:!0,DS:!0,DT:!0,FL:!1,FD:!1,IS:!0,LO:!0,LT:!0,OB:!1,OD:!1,OF:!1,OW:!1,PN:!0,SH:!0,SL:!1,SQ:!1,SS:!1,ST:!0,TM:!0,UI:!0,UL:!1,UN:void 0,UR:!0,US:!1,UT:!0},d=function(e){return r[e]},f=function(e){e=parseInt(e[4],16);if(isNaN(e))throw"dicomParser.isPrivateTag: cannot parse last character of group";return e%2==1},a=function(e){if(void 0!==e){e=e.split("^");return{familyName:e[0],givenName:e[1],middleName:e[2],prefix:e[3],suffix:e[4]}}};function n(e,t){if(2<=e.length){var r=parseInt(e.substring(0,2),10),a=4<=e.length?parseInt(e.substring(2,4),10):void 0,n=6<=e.length?parseInt(e.substring(4,6),10):void 0,i=8<=e.length?e.substring(7,13):void 0,i=i?parseInt(i,10)*Math.pow(10,6-i.length):void 0;if(t&&(isNaN(r)||void 0!==a&&isNaN(a)||void 0!==n&&isNaN(n)||void 0!==i&&isNaN(i)||r<0||23<r||a&&(a<0||59<a)||n&&(n<0||59<n)||i&&(i<0||999999<i)))throw"invalid TM '".concat(e,"'");return{hours:r,minutes:a,seconds:n,fractionalSeconds:i}}if(t)throw"invalid TM '".concat(e,"'")}function i(e,t,r){return!isNaN(r)&&(0<t&&t<=12&&0<e&&e<=function(e,t){switch(e){case 2:return t%4==0&&t%100||t%400==0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}(t,r))}function o(e,t){if(e&&8===e.length){var r=parseInt(e.substring(0,4),10),a=parseInt(e.substring(4,6),10),n=parseInt(e.substring(6,8),10);if(t&&!0!==i(n,a,r))throw"invalid DA '".concat(e,"'");return{year:r,month:a,day:n}}if(t)throw"invalid DA '".concat(e,"'")}function l(n,e){if(void 0===n||void 0===e)throw"dicomParser.explicitElementToString: missing required parameters";if(void 0===e.vr)throw"dicomParser.explicitElementToString: cannot convert implicit element to string";var t,r=e.vr,i=e.tag;function a(e,t){for(var r="",a=0;a<e;a++)0!==a&&(r+="/"),r+=t.call(n,i,a).toString();return r}if(!0===d(r))t=n.string(i);else{if("AT"===r){var o=n.uint32(i);return void 0===o?void 0:"x".concat((o=o<0?4294967295+o+1:o).toString(16).toUpperCase())}"US"===r?t=a(e.length/2,n.uint16):"SS"===r?t=a(e.length/2,n.int16):"UL"===r?t=a(e.length/4,n.uint32):"SL"===r?t=a(e.length/4,n.int32):"FD"===r?t=a(e.length/8,n.double):"FL"===r&&(t=a(e.length/4,n.float))}return t}function u(e,t){if(void 0===e)throw"dicomParser.explicitDataSetToJS: missing required parameter dataSet";t=t||{omitPrivateAttibutes:!0,maxElementLength:128};var r,a={};for(r in e.elements){var n=e.elements[r];if(!0!==t.omitPrivateAttibutes||!f(r))if(n.items){for(var i=[],o=0;o<n.items.length;o++)i.push(u(n.items[o].dataSet,t));a[r]=i}else{var s=void 0;n.length<t.maxElementLength&&(s=l(e,n)),a[r]=void 0!==s?s:{dataOffset:n.dataOffset,length:n.length}}}return a}function c(e,t){return 255===e.byteArray[t]&&217===e.byteArray[t+1]}function m(e,t,r){for(var a,n,i=r;i<t.fragments.length;i++)if(a=e,n=i,n=t.fragments[n],!(!c(a,n.position+n.length-2)&&!c(a,n.position+n.length-3)))return i}function p(e,t,r){if(void 0===e)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter dataSet";if(void 0===t)throw"dicomParser.createJPEGBasicOffsetTable: missing required parameter pixelDataElement";if("x7fe00010"!==t.tag)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010'";if(!0!==t.encapsulatedPixelData)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.basicOffsetTable)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.fragments)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(t.fragments.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r&&r.length<=0)throw"dicomParser.createJPEGBasicOffsetTable: parameter 'fragments' must not be zero length";r=r||t.fragments;for(var a=[],n=0;;){a.push(t.fragments[n].offset);var i=m(e,t,n);if(void 0===i||i===t.fragments.length-1)return a;n=i+1}}function h(e){if(void 0===e)throw"dicomParser.readTag: missing required parameter 'byteStream'";var t=256*e.readUint16()*256,e=e.readUint16();return"x".concat("00000000".concat((t+e).toString(16)).substr(-8))}function g(e,t,r){if(void 0===e)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.findEndOfEncapsulatedElement: missing required parameter 'element'";if(t.encapsulatedPixelData=!0,t.basicOffsetTable=[],t.fragments=[],"xfffee000"!==h(e))throw"dicomParser.findEndOfEncapsulatedElement: basic offset table not found";for(var a=e.readUint32()/4,n=0;n<a;n++){var i=e.readUint32();t.basicOffsetTable.push(i)}for(var o=e.position;e.position<e.byteArray.length;){var s=h(e),d=e.readUint32();if("xfffee0dd"===s)return e.seek(d),void(t.length=e.position-t.dataOffset);if("xfffee000"!==s)return r&&r.push("unexpected tag ".concat(s," while searching for end of pixel data element with undefined length")),d>e.byteArray.length-e.position&&(d=e.byteArray.length-e.position),t.fragments.push({offset:e.position-o-8,position:e.position,length:d}),e.seek(d),void(t.length=e.position-t.dataOffset);t.fragments.push({offset:e.position-o-8,position:e.position,length:d}),e.seek(d)}r&&r.push("pixel data element ".concat(t.tag," missing sequence delimiter tag xfffee0dd"))}function y(e,t){if(void 0===e)throw"dicomParser.findAndSetUNElementLength: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()){var a=e.readUint16();if(57565===a)return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset)}t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}function b(e,t,r){if(r<0)throw"dicomParser.readFixedString - length cannot be less than 0";if(t+r>e.length)throw"dicomParser.readFixedString: attempt to read past end of buffer";for(var a,n="",i=0;i<r;i++){if(0===(a=e[t+i]))return t+=r,n;n+=String.fromCharCode(a)}return n}function v(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function P(e,t){return void 0!==e.parser?e.parser:t}var w=function(){function a(e,t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),this.byteArrayParser=e,this.byteArray=t,this.elements=r}var e,t,r;return e=a,(t=[{key:"uint16",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readUint16(this.byteArray,e.dataOffset+2*t)}},{key:"int16",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readInt16(this.byteArray,e.dataOffset+2*t)}},{key:"uint32",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readUint32(this.byteArray,e.dataOffset+4*t)}},{key:"int32",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readInt32(this.byteArray,e.dataOffset+4*t)}},{key:"float",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readFloat(this.byteArray,e.dataOffset+4*t)}},{key:"double",value:function(e,t){e=this.elements[e];if(t=void 0!==t?t:0,e&&0!==e.length)return P(e,this.byteArrayParser).readDouble(this.byteArray,e.dataOffset+8*t)}},{key:"numStringValues",value:function(e){e=this.elements[e];if(e&&0<e.length){e=b(this.byteArray,e.dataOffset,e.length).match(/\\/g);return null===e?1:e.length+1}}},{key:"string",value:function(e,t){e=this.elements[e];if(e&&e.Value)return e.Value;if(e&&0<e.length){e=b(this.byteArray,e.dataOffset,e.length);return 0<=t?e.split("\\")[t].trim():e.trim()}}},{key:"text",value:function(e,t){e=this.elements[e];if(e&&0<e.length){e=b(this.byteArray,e.dataOffset,e.length);return 0<=t?e.split("\\")[t].replace(/ +$/,""):e.replace(/ +$/,"")}}},{key:"floatString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length){t=this.string(e,t=void 0!==t?t:0);if(void 0!==t)return parseFloat(t)}}},{key:"intString",value:function(e,t){var r=this.elements[e];if(r&&0<r.length){t=this.string(e,t=void 0!==t?t:0);if(void 0!==t)return parseInt(t)}}},{key:"attributeTag",value:function(e){var t=this.elements[e];if(t&&4===t.length){var r=P(t,this.byteArrayParser).readUint16,e=this.byteArray,t=t.dataOffset;return"x".concat("00000000".concat((256*r(e,t)*256+r(e,t+2)).toString(16)).substr(-8))}}}])&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();function x(e,t){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";for(var r=e.byteArray.length-8;e.position<=r;)if(65534===e.readUint16()){var a=e.readUint16();if(57357===a)return 0!==e.readUint32()&&e.warnings("encountered non zero length following item delimiter at position ".concat(e.position-4," while reading element of undefined length with tag ").concat(t.tag)),void(t.length=e.position-t.dataOffset)}t.length=e.byteArray.length-t.dataOffset,e.seek(e.byteArray.length-e.position)}var E=function(e,t){if(void 0!==e.vr)return"SQ"===e.vr;if(t.position+4<=t.byteArray.length){e=h(t);return t.seek(-4),"xfffee000"===e||"xfffee0dd"===e}return t.warnings.push("eof encountered before finding sequence item tag or sequence delimiter tag in peeking to determine VR"),!1};function A(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementImplicit: missing required parameter 'byteStream'";var a=h(e),a={tag:a,vr:void 0!==r?r(a):void 0,length:e.readUint32(),dataOffset:e.position};return 4294967295===a.length&&(a.hadUndefinedLength=!0),a.tag===t||(!E(a,e)||f(a.tag)&&!a.hadUndefinedLength?a.hadUndefinedLength?x(e,a):e.seek(a.length):(F(e,a,r),f(a.tag)&&(a.items=void 0))),a}function S(e){if(void 0===e)throw"dicomParser.readSequenceItem: missing required parameter 'byteStream'";var t={tag:h(e),length:e.readUint32(),dataOffset:e.position};if("xfffee000"!==t.tag)throw"dicomParser.readSequenceItem: item tag (FFFE,E000) not found at offset ".concat(e.position);return t}function D(e,t){var r=S(e);return 4294967295===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var a=A(e,void 0,t);if("xfffee00d"===(r[a.tag]=a).tag)return new w(e.byteArrayParser,e.byteArray,r)}return e.warnings.push("eof encountered before finding sequence item delimiter in sequence item of undefined length"),new w(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new w(e.byteArrayParser,e.byteArray,{}),T(r.dataSet,e,e.position+r.length,{vrCallback:t})),r}function F(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsImplicit: missing required parameter 'element'";t.items=[],(4294967295===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var a=h(e);if(e.seek(-4),"xfffee0dd"===a)return t.length=e.position-t.dataOffset,e.seek(8);a=D(e,r);t.items.push(a)}e.warnings.push("eof encountered before finding sequence delimiter in sequence of undefined length"),t.length=e.byteArray.length-t.dataOffset}:function(e,t,r){for(var a=t.dataOffset+t.length;e.position<a;){var n=D(e,r);t.items.push(n)}})(e,t,r)}function O(e,t){var r=S(e);return 4294967295===r.length?(r.hadUndefinedLength=!0,r.dataSet=function(e,t){for(var r={};e.position<e.byteArray.length;){var a=B(e,t);if("xfffee00d"===(r[a.tag]=a).tag)return new w(e.byteArrayParser,e.byteArray,r)}return t.push("eof encountered before finding item delimiter tag while reading sequence item of undefined length"),new w(e.byteArrayParser,e.byteArray,r)}(e,t),r.length=e.position-r.dataOffset):(r.dataSet=new w(e.byteArrayParser,e.byteArray,{}),q(r.dataSet,e,e.position+r.length)),r}function I(e,t,r){if(void 0===e)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'byteStream'";if(void 0===t)throw"dicomParser.readSequenceItemsExplicit: missing required parameter 'element'";t.items=[],(4294967295===t.length?function(e,t,r){for(;e.position+4<=e.byteArray.length;){var a=h(e);if(e.seek(-4),"xfffee0dd"===a)return t.length=e.position-t.dataOffset,e.seek(8);a=O(e,r);t.items.push(a)}r.push("eof encountered before finding sequence delimitation tag while reading sequence of undefined length"),t.length=e.position-t.dataOffset}:function(e,t,r){for(var a=t.dataOffset+t.length;e.position<a;){var n=O(e,r);t.items.push(n)}})(e,t,r)}var U=function(e){return"OB"===e||"OD"===e||"OL"===e||"OW"===e||"SQ"===e||"OF"===e||"UC"===e||"UR"===e||"UT"===e||"UN"===e?4:2};function B(e,t,r){if(void 0===e)throw"dicomParser.readDicomElementExplicit: missing required parameter 'byteStream'";var a={tag:h(e),vr:e.readFixedString(2)};return 2===U(a.vr)?a.length=e.readUint16():(e.seek(2),a.length=e.readUint32()),a.dataOffset=e.position,4294967295===a.length&&(a.hadUndefinedLength=!0),a.tag===r||("SQ"===a.vr?I(e,a,t):4294967295===a.length?"x7fe00010"===a.tag?g(e,a,t):("UN"===a.vr?F:x)(e,a):e.seek(a.length)),a}function q(e,t,r){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?t.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetExplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetExplicit: invalid value for parameter 'maxP osition'";for(var n=e.elements;t.position<r;){var i=B(t,e.warnings,a.untilTag);if((n[i.tag]=i).tag===a.untilTag)return}if(t.position>r)throw"dicomParser:parseDicomDataSetExplicit: buffer overrun"}function T(e,t,r){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(r=void 0===r?e.byteArray.length:r,void 0===t)throw"dicomParser.parseDicomDataSetImplicit: missing required parameter 'byteStream'";if(r<t.position||r>t.byteArray.length)throw"dicomParser.parseDicomDataSetImplicit: invalid value for parameter 'maxPosition'";for(var n=e.elements;t.position<r;){var i=A(t,a.untilTag,a.vrCallback);if((n[i.tag]=i).tag===a.untilTag)return}}function k(e,t){if("undefined"!=typeof Buffer&&e instanceof Buffer)return Buffer.alloc(t);if(e instanceof Uint8Array)return new Uint8Array(t);throw"dicomParser.alloc: unknown type for byteArray"}var L="1.8.12",N={readUint16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readUint16: attempt to read past end of buffer";return(e[t]<<8)+e[t+1]},readInt16:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"bigEndianByteArrayParser.readInt16: attempt to read past end of buffer";t=(e[t]<<8)+e[t+1];return t=32768&t?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readUint32: attempt to read past end of buffer";return 256*(256*(256*e[t]+e[t+1])+e[t+2])+e[t+3]},readInt32:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readInt32: attempt to read past end of buffer";return(e[t]<<24)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]},readFloat:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"bigEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[3]=e[t],r[2]=e[t+1],r[1]=e[t+2],r[0]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"bigEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"bigEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[7]=e[t],r[6]=e[t+1],r[5]=e[t+2],r[4]=e[t+3],r[3]=e[t+4],r[2]=e[t+5],r[1]=e[t+6],r[0]=e[t+7],new Float64Array(r.buffer)[0]}};function j(e,t,r){if("undefined"!=typeof Buffer&&e instanceof Buffer)return e.slice(t,t+r);if(e instanceof Uint8Array)return new Uint8Array(e.buffer,e.byteOffset+t,r);throw"dicomParser.from: unknown type for byteArray"}function C(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var J=function(){function a(e,t,r){if(!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),void 0===e)throw"dicomParser.ByteStream: missing required parameter 'byteArrayParser'";if(void 0===t)throw"dicomParser.ByteStream: missing required parameter 'byteArray'";if(t instanceof Uint8Array==!1&&("undefined"==typeof Buffer||t instanceof Buffer==!1))throw"dicomParser.ByteStream: parameter byteArray is not of type Uint8Array or Buffer";if(r<0)throw"dicomParser.ByteStream: parameter 'position' cannot be less than 0";if(r>=t.length)throw"dicomParser.ByteStream: parameter 'position' cannot be greater than or equal to 'byteArray' length";this.byteArrayParser=e,this.byteArray=t,this.position=r||0,this.warnings=[]}var e,t,r;return e=a,(t=[{key:"seek",value:function(e){if(this.position+e<0)throw"dicomParser.ByteStream.prototype.seek: cannot seek to position < 0";this.position+=e}},{key:"readByteStream",value:function(e){if(this.position+e>this.byteArray.length)throw"dicomParser.ByteStream.prototype.readByteStream: readByteStream - buffer overread";var t=j(this.byteArray,this.position,e);return this.position+=e,new a(this.byteArrayParser,t)}},{key:"getSize",value:function(){return this.byteArray.length}},{key:"readUint16",value:function(){var e=this.byteArrayParser.readUint16(this.byteArray,this.position);return this.position+=2,e}},{key:"readUint32",value:function(){var e=this.byteArrayParser.readUint32(this.byteArray,this.position);return this.position+=4,e}},{key:"readFixedString",value:function(e){var t=b(this.byteArray,this.position,e);return this.position+=e,t}}])&&C(e.prototype,t),r&&C(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(),M={readUint16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readUint16: attempt to read past end of buffer";return e[t]+256*e[t+1]},readInt16:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt16: position cannot be less than 0";if(t+2>e.length)throw"littleEndianByteArrayParser.readInt16: attempt to read past end of buffer";t=e[t]+(e[t+1]<<8);return t=32768&t?t-65535-1:t},readUint32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readUint32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readUint32: attempt to read past end of buffer";return e[t]+256*e[t+1]+256*e[t+2]*256+256*e[t+3]*256*256},readInt32:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readInt32: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readInt32: attempt to read past end of buffer";return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)},readFloat:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readFloat: position cannot be less than 0";if(t+4>e.length)throw"littleEndianByteArrayParser.readFloat: attempt to read past end of buffer";var r=new Uint8Array(4);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],new Float32Array(r.buffer)[0]},readDouble:function(e,t){if(t<0)throw"littleEndianByteArrayParser.readDouble: position cannot be less than 0";if(t+8>e.length)throw"littleEndianByteArrayParser.readDouble: attempt to read past end of buffer";var r=new Uint8Array(8);return r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],r[4]=e[t+4],r[5]=e[t+5],r[6]=e[t+6],r[7]=e[t+7],new Float64Array(r.buffer)[0]}};function G(e){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw"dicomParser.readPart10Header: missing required parameter 'byteArray'";var o=i.TransferSyntaxUID,s=new J(M,e);return function(){var e=function(){if(s.getSize()<=132&&o)return!1;if(s.seek(128),"DICM"===s.readFixedString(4))return!0;if(!(i||{}).TransferSyntaxUID)throw"dicomParser.readPart10Header: DICM prefix not found at location 132 - this is not a valid DICOM P10 file.";return s.seek(0),!1}(),t=[],r={};if(!e)return s.position=0,{elements:{x00020010:{tag:"x00020010",vr:"UI",Value:o}},warnings:t};for(;s.position<s.byteArray.length;){var a=s.position,n=B(s,t);if("x0002ffff"<n.tag){s.position=a;break}n.parser=M,r[n.tag]=n}return(e=new w(s.byteArrayParser,s.byteArray,r)).warnings=s.warnings,e.position=s.position,e}()}var z="1.2.840.10008.1.2.2";function V(i){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===i)throw new Error("dicomParser.parseDicom: missing required parameter 'byteArray'");var e,a=function(e){if(void 0===e.elements.x00020010)throw new Error("dicomParser.parseDicom: missing required meta header attribute 0002,0010");e=e.elements.x00020010;return e&&e.Value||b(i,e.dataOffset,e.length)};function t(t){var e=a(t),r="1.2.840.10008.1.2"!==e,e=function(e,t){var r="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);if("1.2.840.10008.1.2.1.99"!==e)return new J(e===z?N:M,i,t);if(o&&o.inflater){e=o.inflater(i,t);return new J(M,e,0)}if(!0==r){var a=s(0),n=j(i,t,i.length-t),a=a.inflateRawSync(n),n=k(i,a.length+t);return i.copy(n,0,0,t),a.copy(n,t),new J(M,n,0)}if("undefined"==typeof pako)throw"dicomParser.parseDicom: no inflater available to handle deflate transfer syntax";return a=i.slice(t),n=pako.inflateRaw(a),(a=k(i,n.length+t)).set(i.slice(0,t),0),a.set(n,t),new J(M,a,0)}(e,t.position),t=new w(e.byteArrayParser,e.byteArray,{});t.warnings=e.warnings;try{(r?q:T)(t,e,e.byteArray.length,o)}catch(e){throw{exception:e,dataSet:t}}return t}return function(e,t){for(var r in e.elements)e.elements.hasOwnProperty(r)&&(t.elements[r]=e.elements[r]);return void 0!==e.warnings&&(t.warnings=e.warnings.concat(t.warnings)),t}(e=G(i,o),t(e))}var R=function(e,t,r){for(var a=0,n=t;n<t+r;n++)a+=e[n].length;return a};function _(e,t,r,a,n){if(n=n||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'startFragmentIndex'";if(void 0===(a=a||1))throw"dicomParser.readEncapsulatedPixelDataFromFragments: missing required parameter 'numFragments'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010";if(!0!==t.encapsulatedPixelData)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.basicOffsetTable)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.fragments)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(t.fragments.length<=0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be >= 0";if(r>=t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragmentIndex' must be < number of fragments";if(a<1)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'numFragments' must be > 0";if(r+a>t.fragments.length)throw"dicomParser.readEncapsulatedPixelDataFromFragments: parameter 'startFragment' + 'numFragments' < number of fragments";var i=new J(e.byteArrayParser,e.byteArray,t.dataOffset),t=S(i);if("xfffee000"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: missing basic offset table xfffee000";i.seek(t.length);var o=i.position;if(1===a)return j(i.byteArray,o+n[r].offset+8,n[r].length);for(var t=R(n,r,a),s=k(i.byteArray,t),d=0,f=r;f<r+a;f++)for(var l=o+n[f].offset+8,u=0;u<n[f].length;u++)s[d++]=i.byteArray[l++];return s}var H=function(e,t){for(var r=0;r<e.length;r++)if(e[r].offset===t)return r},Q=function(e,t,r,a){if(e===t.length-1)return r.length-a;for(var n=t[e+1],i=a+1;i<r.length;i++)if(r[i].offset===n)return i-a;throw"dicomParser.calculateNumberOfFragmentsForFrame: could not find fragment with offset matching basic offset table"};function W(e,t,r,a,n){if(a=a||t.basicOffsetTable,n=n||t.fragments,void 0===e)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'pixelDataElement'";if(void 0===r)throw"dicomParser.readEncapsulatedImageFrame: missing required parameter 'frameIndex'";if(void 0===a)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' does not have basicOffsetTable";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have undefined length";if(void 0===t.fragments)throw"dicomParser.readEncapsulatedImageFrame: parameter 'pixelDataElement' refers to pixel data element that does not have fragments";if(0===a.length)throw"dicomParser.readEncapsulatedImageFrame: basicOffsetTable has zero entries";if(r<0)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be >= 0";if(r>=a.length)throw"dicomParser.readEncapsulatedImageFrame: parameter 'frameIndex' must be < basicOffsetTable.length";var i=a[r],i=H(n,i);if(void 0===i)throw"dicomParser.readEncapsulatedImageFrame: unable to find fragment that matches basic offset table entry";return _(e,t,i,Q(r,a,n,i),n)}var $=!1;function K(e,t,r){if($||($=!0,console&&console.log&&console.log("WARNING: dicomParser.readEncapsulatedPixelData() has been deprecated")),void 0===e)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'dataSet'";if(void 0===t)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'element'";if(void 0===r)throw"dicomParser.readEncapsulatedPixelData: missing required parameter 'frame'";if("x7fe00010"!==t.tag)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to non pixel data tag (expected tag = x7fe00010)";if(!0!==t.encapsulatedPixelData)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(!0!==t.hadUndefinedLength)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.basicOffsetTable)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(void 0===t.fragments)throw"dicomParser.readEncapsulatedPixelData: parameter 'element' refers to pixel data element that does not have encapsulated pixel data";if(r<0)throw"dicomParser.readEncapsulatedPixelData: parameter 'frame' must be >= 0";return 0!==t.basicOffsetTable.length?W(e,t,r):_(e,t,0,t.fragments.length)}t.default={isStringVr:d,isPrivateTag:f,parsePN:a,parseTM:n,parseDA:o,explicitElementToString:l,explicitDataSetToJS:u,createJPEGBasicOffsetTable:p,parseDicomDataSetExplicit:q,parseDicomDataSetImplicit:T,readFixedString:b,alloc:k,version:L,bigEndianByteArrayParser:N,ByteStream:J,sharedCopy:j,DataSet:w,findAndSetUNElementLength:y,findEndOfEncapsulatedElement:g,findItemDelimitationItemAndSetElementLength:x,littleEndianByteArrayParser:M,parseDicom:V,readDicomElementExplicit:B,readDicomElementImplicit:A,readEncapsulatedImageFrame:W,readEncapsulatedPixelData:K,readEncapsulatedPixelDataFromFragments:_,readPart10Header:G,readSequenceItemsExplicit:I,readSequenceItemsImplicit:F,readSequenceItem:S,readTag:h,LEI:"1.2.840.10008.1.2",LEE:"1.2.840.10008.1.2.1"}}],i={},n.m=a,n.c=i,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1);function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return a[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var a,i});
|
|
9
|
+
//# sourceMappingURL=dicomParser.min.js.map
|
|
10
|
+
|
|
11
|
+
/***/ }),
|
|
12
|
+
|
|
13
|
+
/***/ 992:
|
|
14
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
15
|
+
|
|
16
|
+
"use strict";
|
|
17
|
+
module.exports = __webpack_require__.p + "7d4e5892d21def245792.ts";
|
|
18
|
+
|
|
19
|
+
/***/ }),
|
|
20
|
+
|
|
21
|
+
/***/ 753:
|
|
22
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23
|
+
|
|
24
|
+
"use strict";
|
|
25
|
+
module.exports = __webpack_require__.p + "1104a37b16dee0d2ada1.ts";
|
|
26
|
+
|
|
27
|
+
/***/ }),
|
|
28
|
+
|
|
29
|
+
/***/ 106:
|
|
30
|
+
/***/ ((module) => {
|
|
31
|
+
|
|
32
|
+
"use strict";
|
|
33
|
+
module.exports = require("zlib");
|
|
34
|
+
|
|
35
|
+
/***/ })
|
|
36
|
+
|
|
37
|
+
/******/ });
|
|
38
|
+
/************************************************************************/
|
|
39
|
+
/******/ // The module cache
|
|
40
|
+
/******/ var __webpack_module_cache__ = {};
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // The require function
|
|
43
|
+
/******/ function __webpack_require__(moduleId) {
|
|
44
|
+
/******/ // Check if module is in cache
|
|
45
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
46
|
+
/******/ if (cachedModule !== undefined) {
|
|
47
|
+
/******/ return cachedModule.exports;
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ // Create a new module (and put it into the cache)
|
|
50
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
51
|
+
/******/ // no module.id needed
|
|
52
|
+
/******/ // no module.loaded needed
|
|
53
|
+
/******/ exports: {}
|
|
54
|
+
/******/ };
|
|
55
|
+
/******/
|
|
56
|
+
/******/ // Execute the module function
|
|
57
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
58
|
+
/******/
|
|
59
|
+
/******/ // Return the exports of the module
|
|
60
|
+
/******/ return module.exports;
|
|
61
|
+
/******/ }
|
|
62
|
+
/******/
|
|
63
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
64
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
65
|
+
/******/
|
|
66
|
+
/************************************************************************/
|
|
67
|
+
/******/ /* webpack/runtime/define property getters */
|
|
68
|
+
/******/ (() => {
|
|
69
|
+
/******/ // define getter functions for harmony exports
|
|
70
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
71
|
+
/******/ for(var key in definition) {
|
|
72
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
73
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
74
|
+
/******/ }
|
|
75
|
+
/******/ }
|
|
76
|
+
/******/ };
|
|
77
|
+
/******/ })();
|
|
78
|
+
/******/
|
|
79
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
80
|
+
/******/ (() => {
|
|
81
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
82
|
+
/******/ })();
|
|
83
|
+
/******/
|
|
84
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
85
|
+
/******/ (() => {
|
|
86
|
+
/******/ // define __esModule on exports
|
|
87
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
88
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
89
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
90
|
+
/******/ }
|
|
91
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
92
|
+
/******/ };
|
|
93
|
+
/******/ })();
|
|
94
|
+
/******/
|
|
95
|
+
/******/ /* webpack/runtime/publicPath */
|
|
96
|
+
/******/ (() => {
|
|
97
|
+
/******/ __webpack_require__.p = "";
|
|
98
|
+
/******/ })();
|
|
99
|
+
/******/
|
|
100
|
+
/******/ /* webpack/runtime/require chunk loading */
|
|
101
|
+
/******/ (() => {
|
|
102
|
+
/******/ __webpack_require__.b = require("url").pathToFileURL(__filename);
|
|
103
|
+
/******/
|
|
104
|
+
/******/ // object to store loaded chunks
|
|
105
|
+
/******/ // "1" means "loaded", otherwise not loaded yet
|
|
106
|
+
/******/ var installedChunks = {
|
|
107
|
+
/******/ 792: 1
|
|
108
|
+
/******/ };
|
|
109
|
+
/******/
|
|
110
|
+
/******/ // no on chunks loaded
|
|
111
|
+
/******/
|
|
112
|
+
/******/ // no chunk install function needed
|
|
113
|
+
/******/
|
|
114
|
+
/******/ // no chunk loading
|
|
115
|
+
/******/
|
|
116
|
+
/******/ // no external install chunk
|
|
117
|
+
/******/
|
|
118
|
+
/******/ // no HMR
|
|
119
|
+
/******/
|
|
120
|
+
/******/ // no HMR manifest
|
|
121
|
+
/******/ })();
|
|
122
|
+
/******/
|
|
123
|
+
/************************************************************************/
|
|
124
|
+
var __webpack_exports__ = {};
|
|
125
|
+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
126
|
+
(() => {
|
|
127
|
+
"use strict";
|
|
128
|
+
// ESM COMPAT FLAG
|
|
129
|
+
__webpack_require__.r(__webpack_exports__);
|
|
130
|
+
|
|
131
|
+
// EXPORTS
|
|
132
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
133
|
+
CodDicomWebServer: () => (/* reexport */ classes_CodDicomWebServer),
|
|
134
|
+
FetchType: () => (/* reexport */ FetchType),
|
|
135
|
+
"default": () => (/* binding */ src)
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// NAMESPACE OBJECT: ./src/constants/enums.ts
|
|
139
|
+
var enums_namespaceObject = {};
|
|
140
|
+
__webpack_require__.r(enums_namespaceObject);
|
|
141
|
+
__webpack_require__.d(enums_namespaceObject, {
|
|
142
|
+
DataRetrieveMode: () => (DataRetrieveMode),
|
|
143
|
+
FetchType: () => (FetchType),
|
|
144
|
+
RequestType: () => (RequestType)
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// NAMESPACE OBJECT: ./src/constants/url.ts
|
|
148
|
+
var url_namespaceObject = {};
|
|
149
|
+
__webpack_require__.r(url_namespaceObject);
|
|
150
|
+
__webpack_require__.d(url_namespaceObject, {
|
|
151
|
+
DOMAIN: () => (DOMAIN),
|
|
152
|
+
FILE_EXTENSIONS: () => (FILE_EXTENSIONS),
|
|
153
|
+
URL_VALIDATION_STRING: () => (URL_VALIDATION_STRING)
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// NAMESPACE OBJECT: ./src/constants/dataRetrieval.ts
|
|
157
|
+
var dataRetrieval_namespaceObject = {};
|
|
158
|
+
__webpack_require__.r(dataRetrieval_namespaceObject);
|
|
159
|
+
__webpack_require__.d(dataRetrieval_namespaceObject, {
|
|
160
|
+
FILE_PARTIAL_WORKER_NAME: () => (FILE_PARTIAL_WORKER_NAME),
|
|
161
|
+
FILE_STREAMING_WORKER_NAME: () => (FILE_STREAMING_WORKER_NAME),
|
|
162
|
+
THRESHOLD: () => (THRESHOLD)
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
;// ./src/constants/enums.ts
|
|
166
|
+
var FetchType = /*#__PURE__*/function (FetchType) {
|
|
167
|
+
FetchType[FetchType["BYTES_OPTIMIZED"] = 0] = "BYTES_OPTIMIZED";
|
|
168
|
+
FetchType[FetchType["API_OPTIMIZED"] = 1] = "API_OPTIMIZED";
|
|
169
|
+
return FetchType;
|
|
170
|
+
}({});
|
|
171
|
+
var RequestType = /*#__PURE__*/function (RequestType) {
|
|
172
|
+
RequestType[RequestType["FRAME"] = 0] = "FRAME";
|
|
173
|
+
RequestType[RequestType["THUMBNAIL"] = 1] = "THUMBNAIL";
|
|
174
|
+
RequestType[RequestType["SERIES_METADATA"] = 2] = "SERIES_METADATA";
|
|
175
|
+
RequestType[RequestType["INSTANCE_METADATA"] = 3] = "INSTANCE_METADATA";
|
|
176
|
+
return RequestType;
|
|
177
|
+
}({});
|
|
178
|
+
var DataRetrieveMode = /*#__PURE__*/function (DataRetrieveMode) {
|
|
179
|
+
DataRetrieveMode[DataRetrieveMode["WORKER"] = 0] = "WORKER";
|
|
180
|
+
DataRetrieveMode[DataRetrieveMode["REQUEST"] = 1] = "REQUEST";
|
|
181
|
+
return DataRetrieveMode;
|
|
182
|
+
}({});
|
|
183
|
+
// EXTERNAL MODULE: ./node_modules/dicom-parser/dist/dicomParser.min.js
|
|
184
|
+
var dicomParser_min = __webpack_require__(915);
|
|
185
|
+
;// ./src/classes/customClasses.ts
|
|
186
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _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; }, _typeof(o); }
|
|
187
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
188
|
+
function _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, _toPropertyKey(o.key), o); } }
|
|
189
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
190
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
191
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
192
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
193
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
194
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
195
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
196
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
197
|
+
function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
|
|
198
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
199
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
200
|
+
function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
|
|
201
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
202
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
203
|
+
var CustomError = /*#__PURE__*/function (_Error) {
|
|
204
|
+
function CustomError() {
|
|
205
|
+
_classCallCheck(this, CustomError);
|
|
206
|
+
return _callSuper(this, CustomError, arguments);
|
|
207
|
+
}
|
|
208
|
+
_inherits(CustomError, _Error);
|
|
209
|
+
return _createClass(CustomError);
|
|
210
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
211
|
+
var CustomErrorEvent = /*#__PURE__*/function (_Event) {
|
|
212
|
+
function CustomErrorEvent(message, error) {
|
|
213
|
+
var _this;
|
|
214
|
+
_classCallCheck(this, CustomErrorEvent);
|
|
215
|
+
_this = _callSuper(this, CustomErrorEvent, [message]);
|
|
216
|
+
_defineProperty(_this, "error", void 0);
|
|
217
|
+
_defineProperty(_this, "message", void 0);
|
|
218
|
+
_this.message = message;
|
|
219
|
+
_this.error = error;
|
|
220
|
+
return _this;
|
|
221
|
+
}
|
|
222
|
+
_inherits(CustomErrorEvent, _Event);
|
|
223
|
+
return _createClass(CustomErrorEvent);
|
|
224
|
+
}(/*#__PURE__*/_wrapNativeSuper(Event));
|
|
225
|
+
var CustomMessageEvent = /*#__PURE__*/(/* unused pure expression or super */ null && (function (_MessageEvent) {
|
|
226
|
+
function CustomMessageEvent() {
|
|
227
|
+
_classCallCheck(this, CustomMessageEvent);
|
|
228
|
+
return _callSuper(this, CustomMessageEvent, arguments);
|
|
229
|
+
}
|
|
230
|
+
_inherits(CustomMessageEvent, _MessageEvent);
|
|
231
|
+
return _createClass(CustomMessageEvent);
|
|
232
|
+
}(/*#__PURE__*/_wrapNativeSuper(MessageEvent))));
|
|
233
|
+
;// ./src/constants/url.ts
|
|
234
|
+
var DOMAIN = 'https://storage.googleapis.com';
|
|
235
|
+
var FILE_EXTENSIONS = ['.tar', '.zip'];
|
|
236
|
+
var URL_VALIDATION_STRING = '/dicomweb/';
|
|
237
|
+
;// ./src/constants/dataRetrieval.ts
|
|
238
|
+
var FILE_PARTIAL_WORKER_NAME = 'filePartial';
|
|
239
|
+
var FILE_STREAMING_WORKER_NAME = 'fileStreaming';
|
|
240
|
+
var THRESHOLD = 10000;
|
|
241
|
+
;// ./src/constants/index.ts
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
var constants = {
|
|
246
|
+
Enums: enums_namespaceObject,
|
|
247
|
+
url: url_namespaceObject,
|
|
248
|
+
dataRetrieval: dataRetrieval_namespaceObject
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/* harmony default export */ const src_constants = (constants);
|
|
252
|
+
;// ./src/dataRetrieval/requestManager.ts
|
|
253
|
+
function requestManager_typeof(o) { "@babel/helpers - typeof"; return requestManager_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; }, requestManager_typeof(o); }
|
|
254
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _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" == requestManager_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(requestManager_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; }
|
|
255
|
+
function 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); }
|
|
256
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
257
|
+
function requestManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
258
|
+
function requestManager_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, requestManager_toPropertyKey(o.key), o); } }
|
|
259
|
+
function requestManager_createClass(e, r, t) { return r && requestManager_defineProperties(e.prototype, r), t && requestManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
260
|
+
function requestManager_defineProperty(e, r, t) { return (r = requestManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
261
|
+
function requestManager_toPropertyKey(t) { var i = requestManager_toPrimitive(t, "string"); return "symbol" == requestManager_typeof(i) ? i : i + ""; }
|
|
262
|
+
function requestManager_toPrimitive(t, r) { if ("object" != requestManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != requestManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
263
|
+
|
|
264
|
+
var RequestManager = /*#__PURE__*/function () {
|
|
265
|
+
function RequestManager() {
|
|
266
|
+
var _this = this;
|
|
267
|
+
requestManager_classCallCheck(this, RequestManager);
|
|
268
|
+
requestManager_defineProperty(this, "loaderRegistry", {});
|
|
269
|
+
requestManager_defineProperty(this, "listenerCallback", function (loaderName, taskName, args) {
|
|
270
|
+
var _this$loaderRegistry$;
|
|
271
|
+
var listeners = (_this$loaderRegistry$ = _this.loaderRegistry[loaderName]) === null || _this$loaderRegistry$ === void 0 ? void 0 : _this$loaderRegistry$.listeners[taskName];
|
|
272
|
+
if (listeners) {
|
|
273
|
+
listeners.forEach(function (listener) {
|
|
274
|
+
return listener({
|
|
275
|
+
data: args
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return requestManager_createClass(RequestManager, [{
|
|
282
|
+
key: "register",
|
|
283
|
+
value: function register(loaderName, loaderObject) {
|
|
284
|
+
try {
|
|
285
|
+
if (!loaderObject) {
|
|
286
|
+
throw new CustomError("Loader object for ".concat(loaderName, " is not provided"));
|
|
287
|
+
}
|
|
288
|
+
this.loaderRegistry[loaderName] = {
|
|
289
|
+
loaderObject: loaderObject,
|
|
290
|
+
listeners: {}
|
|
291
|
+
};
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.warn(error);
|
|
294
|
+
throw new CustomError('throws');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "executeTask",
|
|
299
|
+
value: function () {
|
|
300
|
+
var _executeTask = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(loaderName, taskName, options) {
|
|
301
|
+
var _this$loaderRegistry$2,
|
|
302
|
+
_this2 = this;
|
|
303
|
+
var loaderObject;
|
|
304
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
305
|
+
while (1) switch (_context.prev = _context.next) {
|
|
306
|
+
case 0:
|
|
307
|
+
loaderObject = (_this$loaderRegistry$2 = this.loaderRegistry[loaderName]) === null || _this$loaderRegistry$2 === void 0 ? void 0 : _this$loaderRegistry$2.loaderObject;
|
|
308
|
+
if (loaderObject) {
|
|
309
|
+
_context.next = 3;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
throw new CustomError("Loader ".concat(loaderName, " not registered"));
|
|
313
|
+
case 3:
|
|
314
|
+
_context.prev = 3;
|
|
315
|
+
_context.next = 6;
|
|
316
|
+
return loaderObject[taskName](options, function (args) {
|
|
317
|
+
return _this2.listenerCallback(loaderName, 'message', args);
|
|
318
|
+
});
|
|
319
|
+
case 6:
|
|
320
|
+
return _context.abrupt("return", _context.sent);
|
|
321
|
+
case 9:
|
|
322
|
+
_context.prev = 9;
|
|
323
|
+
_context.t0 = _context["catch"](3);
|
|
324
|
+
console.error("Error executing task \"".concat(taskName, "\" on \"").concat(loaderName, "\":"), _context.t0);
|
|
325
|
+
throw new CustomError("Task \"".concat(taskName, "\" failed: ").concat(_context.t0.message));
|
|
326
|
+
case 13:
|
|
327
|
+
case "end":
|
|
328
|
+
return _context.stop();
|
|
329
|
+
}
|
|
330
|
+
}, _callee, this, [[3, 9]]);
|
|
331
|
+
}));
|
|
332
|
+
function executeTask(_x, _x2, _x3) {
|
|
333
|
+
return _executeTask.apply(this, arguments);
|
|
334
|
+
}
|
|
335
|
+
return executeTask;
|
|
336
|
+
}()
|
|
337
|
+
}, {
|
|
338
|
+
key: "addEventListener",
|
|
339
|
+
value: function addEventListener(workerName, eventType, listener) {
|
|
340
|
+
var loaderObject = this.loaderRegistry[workerName];
|
|
341
|
+
if (!loaderObject) {
|
|
342
|
+
console.error("Loader '".concat(workerName, "' is not registered."));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (!loaderObject.listeners[eventType]) {
|
|
346
|
+
loaderObject.listeners[eventType] = [listener];
|
|
347
|
+
} else {
|
|
348
|
+
loaderObject.listeners[eventType].push(listener);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
key: "removeEventListener",
|
|
353
|
+
value: function removeEventListener(workerName, eventType, listener) {
|
|
354
|
+
var loaderObject = this.loaderRegistry[workerName];
|
|
355
|
+
if (!loaderObject) {
|
|
356
|
+
console.error("Loader '".concat(workerName, "' is not registered."));
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
loaderObject.listeners[eventType] = (loaderObject.listeners[eventType] || []).filter(function (existingListener) {
|
|
360
|
+
return existingListener !== listener;
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}, {
|
|
364
|
+
key: "reset",
|
|
365
|
+
value: function reset() {
|
|
366
|
+
this.loaderRegistry = {};
|
|
367
|
+
}
|
|
368
|
+
}]);
|
|
369
|
+
}();
|
|
370
|
+
/* harmony default export */ const requestManager = (RequestManager);
|
|
371
|
+
;// ./src/dataRetrieval/utils/environment.ts
|
|
372
|
+
function isNodeEnvironment() {
|
|
373
|
+
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
374
|
+
}
|
|
375
|
+
;// ./node_modules/comlink/dist/esm/comlink.mjs
|
|
376
|
+
/**
|
|
377
|
+
* @license
|
|
378
|
+
* Copyright 2019 Google LLC
|
|
379
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
380
|
+
*/
|
|
381
|
+
const proxyMarker = Symbol("Comlink.proxy");
|
|
382
|
+
const createEndpoint = Symbol("Comlink.endpoint");
|
|
383
|
+
const releaseProxy = Symbol("Comlink.releaseProxy");
|
|
384
|
+
const finalizer = Symbol("Comlink.finalizer");
|
|
385
|
+
const throwMarker = Symbol("Comlink.thrown");
|
|
386
|
+
const isObject = (val) => (typeof val === "object" && val !== null) || typeof val === "function";
|
|
387
|
+
/**
|
|
388
|
+
* Internal transfer handle to handle objects marked to proxy.
|
|
389
|
+
*/
|
|
390
|
+
const proxyTransferHandler = {
|
|
391
|
+
canHandle: (val) => isObject(val) && val[proxyMarker],
|
|
392
|
+
serialize(obj) {
|
|
393
|
+
const { port1, port2 } = new MessageChannel();
|
|
394
|
+
expose(obj, port1);
|
|
395
|
+
return [port2, [port2]];
|
|
396
|
+
},
|
|
397
|
+
deserialize(port) {
|
|
398
|
+
port.start();
|
|
399
|
+
return wrap(port);
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Internal transfer handler to handle thrown exceptions.
|
|
404
|
+
*/
|
|
405
|
+
const throwTransferHandler = {
|
|
406
|
+
canHandle: (value) => isObject(value) && throwMarker in value,
|
|
407
|
+
serialize({ value }) {
|
|
408
|
+
let serialized;
|
|
409
|
+
if (value instanceof Error) {
|
|
410
|
+
serialized = {
|
|
411
|
+
isError: true,
|
|
412
|
+
value: {
|
|
413
|
+
message: value.message,
|
|
414
|
+
name: value.name,
|
|
415
|
+
stack: value.stack,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
serialized = { isError: false, value };
|
|
421
|
+
}
|
|
422
|
+
return [serialized, []];
|
|
423
|
+
},
|
|
424
|
+
deserialize(serialized) {
|
|
425
|
+
if (serialized.isError) {
|
|
426
|
+
throw Object.assign(new Error(serialized.value.message), serialized.value);
|
|
427
|
+
}
|
|
428
|
+
throw serialized.value;
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* Allows customizing the serialization of certain values.
|
|
433
|
+
*/
|
|
434
|
+
const transferHandlers = new Map([
|
|
435
|
+
["proxy", proxyTransferHandler],
|
|
436
|
+
["throw", throwTransferHandler],
|
|
437
|
+
]);
|
|
438
|
+
function isAllowedOrigin(allowedOrigins, origin) {
|
|
439
|
+
for (const allowedOrigin of allowedOrigins) {
|
|
440
|
+
if (origin === allowedOrigin || allowedOrigin === "*") {
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
function expose(obj, ep = globalThis, allowedOrigins = ["*"]) {
|
|
450
|
+
ep.addEventListener("message", function callback(ev) {
|
|
451
|
+
if (!ev || !ev.data) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
|
|
455
|
+
console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const { id, type, path } = Object.assign({ path: [] }, ev.data);
|
|
459
|
+
const argumentList = (ev.data.argumentList || []).map(fromWireValue);
|
|
460
|
+
let returnValue;
|
|
461
|
+
try {
|
|
462
|
+
const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);
|
|
463
|
+
const rawValue = path.reduce((obj, prop) => obj[prop], obj);
|
|
464
|
+
switch (type) {
|
|
465
|
+
case "GET" /* MessageType.GET */:
|
|
466
|
+
{
|
|
467
|
+
returnValue = rawValue;
|
|
468
|
+
}
|
|
469
|
+
break;
|
|
470
|
+
case "SET" /* MessageType.SET */:
|
|
471
|
+
{
|
|
472
|
+
parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
|
|
473
|
+
returnValue = true;
|
|
474
|
+
}
|
|
475
|
+
break;
|
|
476
|
+
case "APPLY" /* MessageType.APPLY */:
|
|
477
|
+
{
|
|
478
|
+
returnValue = rawValue.apply(parent, argumentList);
|
|
479
|
+
}
|
|
480
|
+
break;
|
|
481
|
+
case "CONSTRUCT" /* MessageType.CONSTRUCT */:
|
|
482
|
+
{
|
|
483
|
+
const value = new rawValue(...argumentList);
|
|
484
|
+
returnValue = proxy(value);
|
|
485
|
+
}
|
|
486
|
+
break;
|
|
487
|
+
case "ENDPOINT" /* MessageType.ENDPOINT */:
|
|
488
|
+
{
|
|
489
|
+
const { port1, port2 } = new MessageChannel();
|
|
490
|
+
expose(obj, port2);
|
|
491
|
+
returnValue = transfer(port1, [port1]);
|
|
492
|
+
}
|
|
493
|
+
break;
|
|
494
|
+
case "RELEASE" /* MessageType.RELEASE */:
|
|
495
|
+
{
|
|
496
|
+
returnValue = undefined;
|
|
497
|
+
}
|
|
498
|
+
break;
|
|
499
|
+
default:
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
catch (value) {
|
|
504
|
+
returnValue = { value, [throwMarker]: 0 };
|
|
505
|
+
}
|
|
506
|
+
Promise.resolve(returnValue)
|
|
507
|
+
.catch((value) => {
|
|
508
|
+
return { value, [throwMarker]: 0 };
|
|
509
|
+
})
|
|
510
|
+
.then((returnValue) => {
|
|
511
|
+
const [wireValue, transferables] = toWireValue(returnValue);
|
|
512
|
+
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
|
|
513
|
+
if (type === "RELEASE" /* MessageType.RELEASE */) {
|
|
514
|
+
// detach and deactive after sending release response above.
|
|
515
|
+
ep.removeEventListener("message", callback);
|
|
516
|
+
closeEndPoint(ep);
|
|
517
|
+
if (finalizer in obj && typeof obj[finalizer] === "function") {
|
|
518
|
+
obj[finalizer]();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
})
|
|
522
|
+
.catch((error) => {
|
|
523
|
+
// Send Serialization Error To Caller
|
|
524
|
+
const [wireValue, transferables] = toWireValue({
|
|
525
|
+
value: new TypeError("Unserializable return value"),
|
|
526
|
+
[throwMarker]: 0,
|
|
527
|
+
});
|
|
528
|
+
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
if (ep.start) {
|
|
532
|
+
ep.start();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function isMessagePort(endpoint) {
|
|
536
|
+
return endpoint.constructor.name === "MessagePort";
|
|
537
|
+
}
|
|
538
|
+
function closeEndPoint(endpoint) {
|
|
539
|
+
if (isMessagePort(endpoint))
|
|
540
|
+
endpoint.close();
|
|
541
|
+
}
|
|
542
|
+
function wrap(ep, target) {
|
|
543
|
+
const pendingListeners = new Map();
|
|
544
|
+
ep.addEventListener("message", function handleMessage(ev) {
|
|
545
|
+
const { data } = ev;
|
|
546
|
+
if (!data || !data.id) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const resolver = pendingListeners.get(data.id);
|
|
550
|
+
if (!resolver) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
resolver(data);
|
|
555
|
+
}
|
|
556
|
+
finally {
|
|
557
|
+
pendingListeners.delete(data.id);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return createProxy(ep, pendingListeners, [], target);
|
|
561
|
+
}
|
|
562
|
+
function throwIfProxyReleased(isReleased) {
|
|
563
|
+
if (isReleased) {
|
|
564
|
+
throw new Error("Proxy has been released and is not useable");
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function releaseEndpoint(ep) {
|
|
568
|
+
return requestResponseMessage(ep, new Map(), {
|
|
569
|
+
type: "RELEASE" /* MessageType.RELEASE */,
|
|
570
|
+
}).then(() => {
|
|
571
|
+
closeEndPoint(ep);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
const proxyCounter = new WeakMap();
|
|
575
|
+
const proxyFinalizers = "FinalizationRegistry" in globalThis &&
|
|
576
|
+
new FinalizationRegistry((ep) => {
|
|
577
|
+
const newCount = (proxyCounter.get(ep) || 0) - 1;
|
|
578
|
+
proxyCounter.set(ep, newCount);
|
|
579
|
+
if (newCount === 0) {
|
|
580
|
+
releaseEndpoint(ep);
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
function registerProxy(proxy, ep) {
|
|
584
|
+
const newCount = (proxyCounter.get(ep) || 0) + 1;
|
|
585
|
+
proxyCounter.set(ep, newCount);
|
|
586
|
+
if (proxyFinalizers) {
|
|
587
|
+
proxyFinalizers.register(proxy, ep, proxy);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
function unregisterProxy(proxy) {
|
|
591
|
+
if (proxyFinalizers) {
|
|
592
|
+
proxyFinalizers.unregister(proxy);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function createProxy(ep, pendingListeners, path = [], target = function () { }) {
|
|
596
|
+
let isProxyReleased = false;
|
|
597
|
+
const proxy = new Proxy(target, {
|
|
598
|
+
get(_target, prop) {
|
|
599
|
+
throwIfProxyReleased(isProxyReleased);
|
|
600
|
+
if (prop === releaseProxy) {
|
|
601
|
+
return () => {
|
|
602
|
+
unregisterProxy(proxy);
|
|
603
|
+
releaseEndpoint(ep);
|
|
604
|
+
pendingListeners.clear();
|
|
605
|
+
isProxyReleased = true;
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
if (prop === "then") {
|
|
609
|
+
if (path.length === 0) {
|
|
610
|
+
return { then: () => proxy };
|
|
611
|
+
}
|
|
612
|
+
const r = requestResponseMessage(ep, pendingListeners, {
|
|
613
|
+
type: "GET" /* MessageType.GET */,
|
|
614
|
+
path: path.map((p) => p.toString()),
|
|
615
|
+
}).then(fromWireValue);
|
|
616
|
+
return r.then.bind(r);
|
|
617
|
+
}
|
|
618
|
+
return createProxy(ep, pendingListeners, [...path, prop]);
|
|
619
|
+
},
|
|
620
|
+
set(_target, prop, rawValue) {
|
|
621
|
+
throwIfProxyReleased(isProxyReleased);
|
|
622
|
+
// FIXME: ES6 Proxy Handler `set` methods are supposed to return a
|
|
623
|
+
// boolean. To show good will, we return true asynchronously ¯\_(ツ)_/¯
|
|
624
|
+
const [value, transferables] = toWireValue(rawValue);
|
|
625
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
626
|
+
type: "SET" /* MessageType.SET */,
|
|
627
|
+
path: [...path, prop].map((p) => p.toString()),
|
|
628
|
+
value,
|
|
629
|
+
}, transferables).then(fromWireValue);
|
|
630
|
+
},
|
|
631
|
+
apply(_target, _thisArg, rawArgumentList) {
|
|
632
|
+
throwIfProxyReleased(isProxyReleased);
|
|
633
|
+
const last = path[path.length - 1];
|
|
634
|
+
if (last === createEndpoint) {
|
|
635
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
636
|
+
type: "ENDPOINT" /* MessageType.ENDPOINT */,
|
|
637
|
+
}).then(fromWireValue);
|
|
638
|
+
}
|
|
639
|
+
// We just pretend that `bind()` didn’t happen.
|
|
640
|
+
if (last === "bind") {
|
|
641
|
+
return createProxy(ep, pendingListeners, path.slice(0, -1));
|
|
642
|
+
}
|
|
643
|
+
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
644
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
645
|
+
type: "APPLY" /* MessageType.APPLY */,
|
|
646
|
+
path: path.map((p) => p.toString()),
|
|
647
|
+
argumentList,
|
|
648
|
+
}, transferables).then(fromWireValue);
|
|
649
|
+
},
|
|
650
|
+
construct(_target, rawArgumentList) {
|
|
651
|
+
throwIfProxyReleased(isProxyReleased);
|
|
652
|
+
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
653
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
654
|
+
type: "CONSTRUCT" /* MessageType.CONSTRUCT */,
|
|
655
|
+
path: path.map((p) => p.toString()),
|
|
656
|
+
argumentList,
|
|
657
|
+
}, transferables).then(fromWireValue);
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
registerProxy(proxy, ep);
|
|
661
|
+
return proxy;
|
|
662
|
+
}
|
|
663
|
+
function myFlat(arr) {
|
|
664
|
+
return Array.prototype.concat.apply([], arr);
|
|
665
|
+
}
|
|
666
|
+
function processArguments(argumentList) {
|
|
667
|
+
const processed = argumentList.map(toWireValue);
|
|
668
|
+
return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
|
|
669
|
+
}
|
|
670
|
+
const transferCache = new WeakMap();
|
|
671
|
+
function transfer(obj, transfers) {
|
|
672
|
+
transferCache.set(obj, transfers);
|
|
673
|
+
return obj;
|
|
674
|
+
}
|
|
675
|
+
function proxy(obj) {
|
|
676
|
+
return Object.assign(obj, { [proxyMarker]: true });
|
|
677
|
+
}
|
|
678
|
+
function windowEndpoint(w, context = globalThis, targetOrigin = "*") {
|
|
679
|
+
return {
|
|
680
|
+
postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),
|
|
681
|
+
addEventListener: context.addEventListener.bind(context),
|
|
682
|
+
removeEventListener: context.removeEventListener.bind(context),
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function toWireValue(value) {
|
|
686
|
+
for (const [name, handler] of transferHandlers) {
|
|
687
|
+
if (handler.canHandle(value)) {
|
|
688
|
+
const [serializedValue, transferables] = handler.serialize(value);
|
|
689
|
+
return [
|
|
690
|
+
{
|
|
691
|
+
type: "HANDLER" /* WireValueType.HANDLER */,
|
|
692
|
+
name,
|
|
693
|
+
value: serializedValue,
|
|
694
|
+
},
|
|
695
|
+
transferables,
|
|
696
|
+
];
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return [
|
|
700
|
+
{
|
|
701
|
+
type: "RAW" /* WireValueType.RAW */,
|
|
702
|
+
value,
|
|
703
|
+
},
|
|
704
|
+
transferCache.get(value) || [],
|
|
705
|
+
];
|
|
706
|
+
}
|
|
707
|
+
function fromWireValue(value) {
|
|
708
|
+
switch (value.type) {
|
|
709
|
+
case "HANDLER" /* WireValueType.HANDLER */:
|
|
710
|
+
return transferHandlers.get(value.name).deserialize(value.value);
|
|
711
|
+
case "RAW" /* WireValueType.RAW */:
|
|
712
|
+
return value.value;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
function requestResponseMessage(ep, pendingListeners, msg, transfers) {
|
|
716
|
+
return new Promise((resolve) => {
|
|
717
|
+
const id = generateUUID();
|
|
718
|
+
pendingListeners.set(id, resolve);
|
|
719
|
+
if (ep.start) {
|
|
720
|
+
ep.start();
|
|
721
|
+
}
|
|
722
|
+
ep.postMessage(Object.assign({ id }, msg), transfers);
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
function generateUUID() {
|
|
726
|
+
return new Array(4)
|
|
727
|
+
.fill(0)
|
|
728
|
+
.map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))
|
|
729
|
+
.join("-");
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
//# sourceMappingURL=comlink.mjs.map
|
|
734
|
+
|
|
735
|
+
;// ./src/dataRetrieval/workerManager.ts
|
|
736
|
+
function workerManager_typeof(o) { "@babel/helpers - typeof"; return workerManager_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; }, workerManager_typeof(o); }
|
|
737
|
+
function workerManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ workerManager_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" == workerManager_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(workerManager_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; }
|
|
738
|
+
function workerManager_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); }
|
|
739
|
+
function workerManager_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { workerManager_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { workerManager_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
740
|
+
function workerManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
741
|
+
function workerManager_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, workerManager_toPropertyKey(o.key), o); } }
|
|
742
|
+
function workerManager_createClass(e, r, t) { return r && workerManager_defineProperties(e.prototype, r), t && workerManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
743
|
+
function workerManager_defineProperty(e, r, t) { return (r = workerManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
744
|
+
function workerManager_toPropertyKey(t) { var i = workerManager_toPrimitive(t, "string"); return "symbol" == workerManager_typeof(i) ? i : i + ""; }
|
|
745
|
+
function workerManager_toPrimitive(t, r) { if ("object" != workerManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != workerManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
var WebWorkerManager = /*#__PURE__*/function () {
|
|
749
|
+
function WebWorkerManager() {
|
|
750
|
+
workerManager_classCallCheck(this, WebWorkerManager);
|
|
751
|
+
workerManager_defineProperty(this, "workerRegistry", {});
|
|
752
|
+
}
|
|
753
|
+
return workerManager_createClass(WebWorkerManager, [{
|
|
754
|
+
key: "register",
|
|
755
|
+
value: function register(name, workerFn) {
|
|
756
|
+
try {
|
|
757
|
+
var worker = workerFn();
|
|
758
|
+
if (!worker) {
|
|
759
|
+
throw new CustomError("WorkerFn of worker ".concat(name, " is not creating a worker"));
|
|
760
|
+
}
|
|
761
|
+
this.workerRegistry[name] = {
|
|
762
|
+
instance: wrap(worker),
|
|
763
|
+
nativeWorker: worker
|
|
764
|
+
};
|
|
765
|
+
} catch (error) {
|
|
766
|
+
console.warn(error);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}, {
|
|
770
|
+
key: "executeTask",
|
|
771
|
+
value: function () {
|
|
772
|
+
var _executeTask = workerManager_asyncToGenerator(/*#__PURE__*/workerManager_regeneratorRuntime().mark(function _callee(workerName, taskName, options) {
|
|
773
|
+
var _this$workerRegistry$;
|
|
774
|
+
var worker;
|
|
775
|
+
return workerManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
776
|
+
while (1) switch (_context.prev = _context.next) {
|
|
777
|
+
case 0:
|
|
778
|
+
worker = (_this$workerRegistry$ = this.workerRegistry[workerName]) === null || _this$workerRegistry$ === void 0 ? void 0 : _this$workerRegistry$.instance;
|
|
779
|
+
if (worker) {
|
|
780
|
+
_context.next = 3;
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
throw new CustomError("Worker ".concat(workerName, " not registered"));
|
|
784
|
+
case 3:
|
|
785
|
+
_context.prev = 3;
|
|
786
|
+
_context.next = 6;
|
|
787
|
+
return worker[taskName](options);
|
|
788
|
+
case 6:
|
|
789
|
+
return _context.abrupt("return", _context.sent);
|
|
790
|
+
case 9:
|
|
791
|
+
_context.prev = 9;
|
|
792
|
+
_context.t0 = _context["catch"](3);
|
|
793
|
+
console.error("Error executing task \"".concat(taskName, "\" on worker \"").concat(workerName, "\":"), _context.t0);
|
|
794
|
+
throw new CustomError("Task \"".concat(taskName, "\" failed: ").concat(_context.t0.message));
|
|
795
|
+
case 13:
|
|
796
|
+
case "end":
|
|
797
|
+
return _context.stop();
|
|
798
|
+
}
|
|
799
|
+
}, _callee, this, [[3, 9]]);
|
|
800
|
+
}));
|
|
801
|
+
function executeTask(_x, _x2, _x3) {
|
|
802
|
+
return _executeTask.apply(this, arguments);
|
|
803
|
+
}
|
|
804
|
+
return executeTask;
|
|
805
|
+
}()
|
|
806
|
+
}, {
|
|
807
|
+
key: "addEventListener",
|
|
808
|
+
value: function addEventListener(workerName, eventType, listener) {
|
|
809
|
+
var worker = this.workerRegistry[workerName];
|
|
810
|
+
if (!worker) {
|
|
811
|
+
console.error("Worker type '".concat(workerName, "' is not registered."));
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
worker.nativeWorker.addEventListener(eventType, listener);
|
|
815
|
+
}
|
|
816
|
+
}, {
|
|
817
|
+
key: "removeEventListener",
|
|
818
|
+
value: function removeEventListener(workerName, eventType, listener) {
|
|
819
|
+
var worker = this.workerRegistry[workerName];
|
|
820
|
+
if (!worker) {
|
|
821
|
+
console.error("Worker type '".concat(workerName, "' is not registered."));
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
worker.nativeWorker.removeEventListener(eventType, listener);
|
|
825
|
+
}
|
|
826
|
+
}, {
|
|
827
|
+
key: "reset",
|
|
828
|
+
value: function reset() {
|
|
829
|
+
this.workerRegistry = {};
|
|
830
|
+
}
|
|
831
|
+
}]);
|
|
832
|
+
}();
|
|
833
|
+
/* harmony default export */ const workerManager = (WebWorkerManager);
|
|
834
|
+
;// ./src/dataRetrieval/dataRetrievalManager.ts
|
|
835
|
+
function dataRetrievalManager_typeof(o) { "@babel/helpers - typeof"; return dataRetrievalManager_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; }, dataRetrievalManager_typeof(o); }
|
|
836
|
+
function dataRetrievalManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ dataRetrievalManager_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" == dataRetrievalManager_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(dataRetrievalManager_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; }
|
|
837
|
+
function dataRetrievalManager_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); }
|
|
838
|
+
function dataRetrievalManager_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { dataRetrievalManager_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { dataRetrievalManager_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
839
|
+
function dataRetrievalManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
840
|
+
function dataRetrievalManager_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, dataRetrievalManager_toPropertyKey(o.key), o); } }
|
|
841
|
+
function dataRetrievalManager_createClass(e, r, t) { return r && dataRetrievalManager_defineProperties(e.prototype, r), t && dataRetrievalManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
842
|
+
function dataRetrievalManager_defineProperty(e, r, t) { return (r = dataRetrievalManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
843
|
+
function dataRetrievalManager_toPropertyKey(t) { var i = dataRetrievalManager_toPrimitive(t, "string"); return "symbol" == dataRetrievalManager_typeof(i) ? i : i + ""; }
|
|
844
|
+
function dataRetrievalManager_toPrimitive(t, r) { if ("object" != dataRetrievalManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != dataRetrievalManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
var DataRetrievalManager = /*#__PURE__*/function () {
|
|
851
|
+
function DataRetrievalManager() {
|
|
852
|
+
dataRetrievalManager_classCallCheck(this, DataRetrievalManager);
|
|
853
|
+
dataRetrievalManager_defineProperty(this, "dataRetriever", void 0);
|
|
854
|
+
dataRetrievalManager_defineProperty(this, "dataRetrieverMode", void 0);
|
|
855
|
+
if (isNodeEnvironment()) {
|
|
856
|
+
this.dataRetriever = new requestManager();
|
|
857
|
+
this.dataRetrieverMode = DataRetrieveMode.REQUEST;
|
|
858
|
+
} else {
|
|
859
|
+
this.dataRetriever = new workerManager();
|
|
860
|
+
this.dataRetrieverMode = DataRetrieveMode.WORKER;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return dataRetrievalManager_createClass(DataRetrievalManager, [{
|
|
864
|
+
key: "getDataRetrieverMode",
|
|
865
|
+
value: function getDataRetrieverMode() {
|
|
866
|
+
return this.dataRetrieverMode;
|
|
867
|
+
}
|
|
868
|
+
}, {
|
|
869
|
+
key: "setDataRetrieverMode",
|
|
870
|
+
value: function setDataRetrieverMode(mode) {
|
|
871
|
+
var managers = dataRetrievalManager_defineProperty(dataRetrievalManager_defineProperty({}, DataRetrieveMode.WORKER, workerManager), DataRetrieveMode.REQUEST, requestManager);
|
|
872
|
+
if (!(mode in managers)) {
|
|
873
|
+
throw new CustomError('Invalid mode');
|
|
874
|
+
}
|
|
875
|
+
this.dataRetriever.reset();
|
|
876
|
+
this.dataRetriever = new managers[mode]();
|
|
877
|
+
this.dataRetrieverMode = mode;
|
|
878
|
+
}
|
|
879
|
+
}, {
|
|
880
|
+
key: "register",
|
|
881
|
+
value: function register(name, arg) {
|
|
882
|
+
// @ts-ignore
|
|
883
|
+
this.dataRetriever.register(name, arg);
|
|
884
|
+
}
|
|
885
|
+
}, {
|
|
886
|
+
key: "executeTask",
|
|
887
|
+
value: function () {
|
|
888
|
+
var _executeTask = dataRetrievalManager_asyncToGenerator(/*#__PURE__*/dataRetrievalManager_regeneratorRuntime().mark(function _callee(loaderName, taskName, options) {
|
|
889
|
+
return dataRetrievalManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
890
|
+
while (1) switch (_context.prev = _context.next) {
|
|
891
|
+
case 0:
|
|
892
|
+
_context.next = 2;
|
|
893
|
+
return this.dataRetriever.executeTask(loaderName, taskName, options);
|
|
894
|
+
case 2:
|
|
895
|
+
return _context.abrupt("return", _context.sent);
|
|
896
|
+
case 3:
|
|
897
|
+
case "end":
|
|
898
|
+
return _context.stop();
|
|
899
|
+
}
|
|
900
|
+
}, _callee, this);
|
|
901
|
+
}));
|
|
902
|
+
function executeTask(_x, _x2, _x3) {
|
|
903
|
+
return _executeTask.apply(this, arguments);
|
|
904
|
+
}
|
|
905
|
+
return executeTask;
|
|
906
|
+
}()
|
|
907
|
+
}, {
|
|
908
|
+
key: "addEventListener",
|
|
909
|
+
value: function addEventListener(workerName, eventType, listener) {
|
|
910
|
+
this.dataRetriever.addEventListener(workerName, eventType, listener);
|
|
911
|
+
}
|
|
912
|
+
}, {
|
|
913
|
+
key: "removeEventListener",
|
|
914
|
+
value: function removeEventListener(workerName, eventType, listener) {
|
|
915
|
+
this.dataRetriever.removeEventListener(workerName, eventType, listener);
|
|
916
|
+
}
|
|
917
|
+
}, {
|
|
918
|
+
key: "reset",
|
|
919
|
+
value: function reset() {
|
|
920
|
+
this.dataRetriever.reset();
|
|
921
|
+
}
|
|
922
|
+
}]);
|
|
923
|
+
}();
|
|
924
|
+
var dataRetrievalManager = new DataRetrievalManager();
|
|
925
|
+
function getDataRetrievalManager() {
|
|
926
|
+
return dataRetrievalManager;
|
|
927
|
+
}
|
|
928
|
+
;// ./src/fileManager.ts
|
|
929
|
+
function fileManager_typeof(o) { "@babel/helpers - typeof"; return fileManager_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; }, fileManager_typeof(o); }
|
|
930
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
931
|
+
function _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."); }
|
|
932
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _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) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
933
|
+
function _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; }
|
|
934
|
+
function _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; } }
|
|
935
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
936
|
+
function fileManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
937
|
+
function fileManager_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, fileManager_toPropertyKey(o.key), o); } }
|
|
938
|
+
function fileManager_createClass(e, r, t) { return r && fileManager_defineProperties(e.prototype, r), t && fileManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
939
|
+
function fileManager_defineProperty(e, r, t) { return (r = fileManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
940
|
+
function fileManager_toPropertyKey(t) { var i = fileManager_toPrimitive(t, "string"); return "symbol" == fileManager_typeof(i) ? i : i + ""; }
|
|
941
|
+
function fileManager_toPrimitive(t, r) { if ("object" != fileManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != fileManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
942
|
+
|
|
943
|
+
var FileManager = /*#__PURE__*/function () {
|
|
944
|
+
function FileManager(_ref) {
|
|
945
|
+
var fileStreamingScriptName = _ref.fileStreamingScriptName;
|
|
946
|
+
fileManager_classCallCheck(this, FileManager);
|
|
947
|
+
fileManager_defineProperty(this, "files", {});
|
|
948
|
+
fileManager_defineProperty(this, "fileStreamingScriptName", void 0);
|
|
949
|
+
this.fileStreamingScriptName = fileStreamingScriptName;
|
|
950
|
+
}
|
|
951
|
+
return fileManager_createClass(FileManager, [{
|
|
952
|
+
key: "set",
|
|
953
|
+
value: function set(url, file) {
|
|
954
|
+
this.files[url] = file;
|
|
955
|
+
}
|
|
956
|
+
}, {
|
|
957
|
+
key: "get",
|
|
958
|
+
value: function get(url, offsets) {
|
|
959
|
+
if (!this.files[url] || offsets && this.files[url].position <= offsets.endByte) {
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
return offsets ? this.files[url].data.slice(offsets.startByte, offsets.endByte) : this.files[url].data;
|
|
963
|
+
}
|
|
964
|
+
}, {
|
|
965
|
+
key: "setPosition",
|
|
966
|
+
value: function setPosition(url, position) {
|
|
967
|
+
if (this.files[url]) {
|
|
968
|
+
this.files[url].position = position;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}, {
|
|
972
|
+
key: "getPosition",
|
|
973
|
+
value: function getPosition(url) {
|
|
974
|
+
var _this$files$url;
|
|
975
|
+
return (_this$files$url = this.files[url]) === null || _this$files$url === void 0 ? void 0 : _this$files$url.position;
|
|
976
|
+
}
|
|
977
|
+
}, {
|
|
978
|
+
key: "append",
|
|
979
|
+
value: function append(url, chunk, position) {
|
|
980
|
+
if (this.files[url] && position) {
|
|
981
|
+
this.files[url].data.set(chunk, position - chunk.length);
|
|
982
|
+
this.setPosition(url, position);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}, {
|
|
986
|
+
key: "getTotalSize",
|
|
987
|
+
value: function getTotalSize() {
|
|
988
|
+
return Object.entries(this.files).reduce(function (total, _ref2) {
|
|
989
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
990
|
+
url = _ref3[0],
|
|
991
|
+
position = _ref3[1].position;
|
|
992
|
+
return url.includes('?bytes=') ? total : total + position;
|
|
993
|
+
}, 0);
|
|
994
|
+
}
|
|
995
|
+
}, {
|
|
996
|
+
key: "remove",
|
|
997
|
+
value: function remove(url) {
|
|
998
|
+
var removedSize = this.getPosition(url);
|
|
999
|
+
delete this.files[url];
|
|
1000
|
+
if (url.includes('?bytes=')) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
var retrievalManager = getDataRetrievalManager();
|
|
1004
|
+
retrievalManager.executeTask(this.fileStreamingScriptName, 'decreaseFetchedSize', removedSize);
|
|
1005
|
+
}
|
|
1006
|
+
}, {
|
|
1007
|
+
key: "purge",
|
|
1008
|
+
value: function purge() {
|
|
1009
|
+
var totalSize = this.getTotalSize();
|
|
1010
|
+
this.files = {};
|
|
1011
|
+
var retrievalManager = getDataRetrievalManager();
|
|
1012
|
+
retrievalManager.executeTask(this.fileStreamingScriptName, 'decreaseFetchedSize', totalSize);
|
|
1013
|
+
}
|
|
1014
|
+
}]);
|
|
1015
|
+
}();
|
|
1016
|
+
/* harmony default export */ const fileManager = (FileManager);
|
|
1017
|
+
;// ./src/classes/utils.ts
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
function parseWadorsURL(url, domain) {
|
|
1021
|
+
if (!url.includes(src_constants.url.URL_VALIDATION_STRING)) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
var filePath = url.split(domain + '/')[1];
|
|
1025
|
+
var prefix = filePath.split('/studies')[0];
|
|
1026
|
+
var prefixParts = prefix.split('/');
|
|
1027
|
+
var bucketName = prefixParts[0];
|
|
1028
|
+
var bucketPrefix = prefixParts.slice(1).join('/');
|
|
1029
|
+
var imagePath = filePath.split(prefix + '/')[1];
|
|
1030
|
+
var imageParts = imagePath.split('/');
|
|
1031
|
+
var studyInstanceUID = imageParts[1];
|
|
1032
|
+
var seriesInstanceUID = imageParts[3];
|
|
1033
|
+
var sopInstanceUID = '',
|
|
1034
|
+
frameNumber = 1,
|
|
1035
|
+
type;
|
|
1036
|
+
switch (true) {
|
|
1037
|
+
case imageParts.includes('thumbnail'):
|
|
1038
|
+
type = RequestType.THUMBNAIL;
|
|
1039
|
+
break;
|
|
1040
|
+
case imageParts.includes('metadata'):
|
|
1041
|
+
if (imageParts.includes('instances')) {
|
|
1042
|
+
sopInstanceUID = imageParts[5];
|
|
1043
|
+
type = RequestType.INSTANCE_METADATA;
|
|
1044
|
+
} else {
|
|
1045
|
+
type = RequestType.SERIES_METADATA;
|
|
1046
|
+
}
|
|
1047
|
+
break;
|
|
1048
|
+
case imageParts.includes('frames'):
|
|
1049
|
+
sopInstanceUID = imageParts[5];
|
|
1050
|
+
frameNumber = +imageParts[7];
|
|
1051
|
+
type = RequestType.FRAME;
|
|
1052
|
+
break;
|
|
1053
|
+
default:
|
|
1054
|
+
throw new CustomError('Invalid type of request');
|
|
1055
|
+
}
|
|
1056
|
+
return {
|
|
1057
|
+
type: type,
|
|
1058
|
+
bucketName: bucketName,
|
|
1059
|
+
bucketPrefix: bucketPrefix,
|
|
1060
|
+
studyInstanceUID: studyInstanceUID,
|
|
1061
|
+
seriesInstanceUID: seriesInstanceUID,
|
|
1062
|
+
sopInstanceUID: sopInstanceUID,
|
|
1063
|
+
frameNumber: frameNumber
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
function getFrameDetailsFromMetadata(seriesMetadata, sopInstanceUID, frameIndex, bucketDetails) {
|
|
1067
|
+
var _seriesMetadata$cod;
|
|
1068
|
+
if (!seriesMetadata || !((_seriesMetadata$cod = seriesMetadata.cod) !== null && _seriesMetadata$cod !== void 0 && _seriesMetadata$cod.instances)) {
|
|
1069
|
+
throw new CustomError('Invalid seriesMetadata provided.');
|
|
1070
|
+
}
|
|
1071
|
+
if (frameIndex === null || frameIndex === undefined) {
|
|
1072
|
+
throw new CustomError('Frame index is required.');
|
|
1073
|
+
}
|
|
1074
|
+
var domain = bucketDetails.domain,
|
|
1075
|
+
bucketName = bucketDetails.bucketName,
|
|
1076
|
+
bucketPrefix = bucketDetails.bucketPrefix;
|
|
1077
|
+
var thumbnailUrl;
|
|
1078
|
+
if (seriesMetadata.thumbnail) {
|
|
1079
|
+
var thumbnailGsUtilUri = seriesMetadata.thumbnail.uri;
|
|
1080
|
+
thumbnailUrl = "".concat(domain, "/").concat(thumbnailGsUtilUri.split('gs://')[1]);
|
|
1081
|
+
}
|
|
1082
|
+
var instanceFound = Object.values(seriesMetadata.cod.instances).find(function (instance) {
|
|
1083
|
+
var _instance$metadata$;
|
|
1084
|
+
return ((_instance$metadata$ = instance.metadata['00080018']) === null || _instance$metadata$ === void 0 || (_instance$metadata$ = _instance$metadata$.Value) === null || _instance$metadata$ === void 0 ? void 0 : _instance$metadata$[0]) === sopInstanceUID;
|
|
1085
|
+
});
|
|
1086
|
+
if (!instanceFound) {
|
|
1087
|
+
return {
|
|
1088
|
+
thumbnailUrl: thumbnailUrl
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
var url = instanceFound.url,
|
|
1092
|
+
uri = instanceFound.uri,
|
|
1093
|
+
offsetHeaders = instanceFound.headers,
|
|
1094
|
+
offset_tables = instanceFound.offset_tables;
|
|
1095
|
+
var modifiedUrl = handleUrl(url || uri, domain, bucketName, bucketPrefix);
|
|
1096
|
+
var CustomOffsetTable = offset_tables.CustomOffsetTable,
|
|
1097
|
+
CustomOffsetTableLengths = offset_tables.CustomOffsetTableLengths;
|
|
1098
|
+
var sliceStart,
|
|
1099
|
+
sliceEnd,
|
|
1100
|
+
isMultiframe = false;
|
|
1101
|
+
if (CustomOffsetTable !== null && CustomOffsetTable !== void 0 && CustomOffsetTable.length && CustomOffsetTableLengths !== null && CustomOffsetTableLengths !== void 0 && CustomOffsetTableLengths.length) {
|
|
1102
|
+
sliceStart = CustomOffsetTable[frameIndex];
|
|
1103
|
+
sliceEnd = sliceStart + CustomOffsetTableLengths[frameIndex];
|
|
1104
|
+
isMultiframe = true;
|
|
1105
|
+
}
|
|
1106
|
+
var fileStartByte = offsetHeaders.start_byte,
|
|
1107
|
+
fileEndByte = offsetHeaders.end_byte;
|
|
1108
|
+
var startByte = sliceStart !== undefined ? fileStartByte + sliceStart : fileStartByte;
|
|
1109
|
+
var endByte = sliceEnd !== undefined ? fileStartByte + sliceEnd : fileEndByte;
|
|
1110
|
+
return {
|
|
1111
|
+
url: modifiedUrl,
|
|
1112
|
+
startByte: startByte,
|
|
1113
|
+
endByte: endByte,
|
|
1114
|
+
thumbnailUrl: thumbnailUrl,
|
|
1115
|
+
isMultiframe: isMultiframe
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function handleUrl(url, domain, bucketName, bucketPrefix) {
|
|
1119
|
+
var modifiedUrl = url;
|
|
1120
|
+
var matchingExtension = src_constants.url.FILE_EXTENSIONS.find(function (extension) {
|
|
1121
|
+
return url.includes(extension);
|
|
1122
|
+
});
|
|
1123
|
+
if (matchingExtension) {
|
|
1124
|
+
var fileParts = url.split(matchingExtension);
|
|
1125
|
+
modifiedUrl = fileParts[0] + matchingExtension;
|
|
1126
|
+
}
|
|
1127
|
+
var filePath = modifiedUrl.split('studies/')[1];
|
|
1128
|
+
modifiedUrl = "".concat(domain, "/").concat(bucketName, "/").concat(bucketPrefix ? bucketPrefix + '/' : '', "studies/").concat(filePath);
|
|
1129
|
+
return modifiedUrl;
|
|
1130
|
+
}
|
|
1131
|
+
function createMetadataJsonUrl(params) {
|
|
1132
|
+
var _params$domain = params.domain,
|
|
1133
|
+
domain = _params$domain === void 0 ? src_constants.url.DOMAIN : _params$domain,
|
|
1134
|
+
bucketName = params.bucketName,
|
|
1135
|
+
bucketPrefix = params.bucketPrefix,
|
|
1136
|
+
studyInstanceUID = params.studyInstanceUID,
|
|
1137
|
+
seriesInstanceUID = params.seriesInstanceUID;
|
|
1138
|
+
if (!bucketName || !bucketPrefix || !studyInstanceUID || !seriesInstanceUID) {
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
return "".concat(domain, "/").concat(bucketName, "/").concat(bucketPrefix, "/studies/").concat(studyInstanceUID, "/series/").concat(seriesInstanceUID, "/metadata.json");
|
|
1142
|
+
}
|
|
1143
|
+
;// ./src/metadataManager.ts
|
|
1144
|
+
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); }
|
|
1145
|
+
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; }
|
|
1146
|
+
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); }
|
|
1147
|
+
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); }); }; }
|
|
1148
|
+
function metadataManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
1149
|
+
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); } }
|
|
1150
|
+
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; }
|
|
1151
|
+
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; }
|
|
1152
|
+
function metadataManager_toPropertyKey(t) { var i = metadataManager_toPrimitive(t, "string"); return "symbol" == metadataManager_typeof(i) ? i : i + ""; }
|
|
1153
|
+
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); }
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
var MetadataManager = /*#__PURE__*/function () {
|
|
1157
|
+
function MetadataManager() {
|
|
1158
|
+
metadataManager_classCallCheck(this, MetadataManager);
|
|
1159
|
+
metadataManager_defineProperty(this, "metadata", {});
|
|
1160
|
+
}
|
|
1161
|
+
return metadataManager_createClass(MetadataManager, [{
|
|
1162
|
+
key: "addDeidMetadata",
|
|
1163
|
+
value: function addDeidMetadata(jsonMetadata) {
|
|
1164
|
+
var deid_study_uid = jsonMetadata.deid_study_uid,
|
|
1165
|
+
deid_series_uid = jsonMetadata.deid_series_uid,
|
|
1166
|
+
cod = jsonMetadata.cod;
|
|
1167
|
+
if (!cod || !deid_study_uid || !deid_series_uid) {
|
|
1168
|
+
console.warn('Missing required metadata properties: cod, deid_study_uid, or deid_series_uid');
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
for (var deid_sop_uid in cod.instances) {
|
|
1172
|
+
var instance = cod.instances[deid_sop_uid];
|
|
1173
|
+
instance.metadata.DeidStudyInstanceUID = {
|
|
1174
|
+
Value: [deid_study_uid]
|
|
1175
|
+
};
|
|
1176
|
+
instance.metadata.DeidSeriesInstanceUID = {
|
|
1177
|
+
Value: [deid_series_uid]
|
|
1178
|
+
};
|
|
1179
|
+
instance.metadata.DeidSopInstanceUID = {
|
|
1180
|
+
Value: [deid_sop_uid]
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}, {
|
|
1185
|
+
key: "getMetadataFromCache",
|
|
1186
|
+
value: function getMetadataFromCache(url) {
|
|
1187
|
+
return this.metadata[url];
|
|
1188
|
+
}
|
|
1189
|
+
}, {
|
|
1190
|
+
key: "getMetadata",
|
|
1191
|
+
value: function () {
|
|
1192
|
+
var _getMetadata = metadataManager_asyncToGenerator(/*#__PURE__*/metadataManager_regeneratorRuntime().mark(function _callee(params, headers) {
|
|
1193
|
+
var url, cachedMetadata, response, data;
|
|
1194
|
+
return metadataManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1195
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1196
|
+
case 0:
|
|
1197
|
+
url = createMetadataJsonUrl(params);
|
|
1198
|
+
if (url) {
|
|
1199
|
+
_context.next = 3;
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
throw new CustomError('Error creating metadata json url');
|
|
1203
|
+
case 3:
|
|
1204
|
+
cachedMetadata = this.getMetadataFromCache(url);
|
|
1205
|
+
if (!cachedMetadata) {
|
|
1206
|
+
_context.next = 6;
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
1209
|
+
return _context.abrupt("return", cachedMetadata);
|
|
1210
|
+
case 6:
|
|
1211
|
+
_context.prev = 6;
|
|
1212
|
+
_context.next = 9;
|
|
1213
|
+
return fetch(url, {
|
|
1214
|
+
headers: headers
|
|
1215
|
+
});
|
|
1216
|
+
case 9:
|
|
1217
|
+
response = _context.sent;
|
|
1218
|
+
if (response.ok) {
|
|
1219
|
+
_context.next = 12;
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
throw new CustomError("Failed to fetch metadata: ".concat(response.statusText));
|
|
1223
|
+
case 12:
|
|
1224
|
+
_context.next = 14;
|
|
1225
|
+
return response.json();
|
|
1226
|
+
case 14:
|
|
1227
|
+
data = _context.sent;
|
|
1228
|
+
this.addDeidMetadata(data);
|
|
1229
|
+
this.metadata[url] = data;
|
|
1230
|
+
return _context.abrupt("return", data);
|
|
1231
|
+
case 20:
|
|
1232
|
+
_context.prev = 20;
|
|
1233
|
+
_context.t0 = _context["catch"](6);
|
|
1234
|
+
console.error(_context.t0);
|
|
1235
|
+
throw _context.t0;
|
|
1236
|
+
case 24:
|
|
1237
|
+
case "end":
|
|
1238
|
+
return _context.stop();
|
|
1239
|
+
}
|
|
1240
|
+
}, _callee, this, [[6, 20]]);
|
|
1241
|
+
}));
|
|
1242
|
+
function getMetadata(_x, _x2) {
|
|
1243
|
+
return _getMetadata.apply(this, arguments);
|
|
1244
|
+
}
|
|
1245
|
+
return getMetadata;
|
|
1246
|
+
}()
|
|
1247
|
+
}]);
|
|
1248
|
+
}();
|
|
1249
|
+
/* harmony default export */ const metadataManager = (MetadataManager);
|
|
1250
|
+
;// ./src/dataRetrieval/scripts/filePartial.ts
|
|
1251
|
+
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); }
|
|
1252
|
+
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; }
|
|
1253
|
+
function filePartial_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); }
|
|
1254
|
+
function filePartial_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { filePartial_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { filePartial_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1255
|
+
|
|
1256
|
+
var filePartial = {
|
|
1257
|
+
partial: function partial(args, callBack) {
|
|
1258
|
+
return filePartial_asyncToGenerator(/*#__PURE__*/filePartial_regeneratorRuntime().mark(function _callee() {
|
|
1259
|
+
var url, headers;
|
|
1260
|
+
return filePartial_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1261
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
url = args.url, headers = args.headers;
|
|
1264
|
+
_context.next = 3;
|
|
1265
|
+
return fetch(url, {
|
|
1266
|
+
headers: headers
|
|
1267
|
+
}).then(function (response) {
|
|
1268
|
+
return response.arrayBuffer();
|
|
1269
|
+
}).then(function (data) {
|
|
1270
|
+
return callBack({
|
|
1271
|
+
url: url,
|
|
1272
|
+
fileArraybuffer: new Uint8Array(data)
|
|
1273
|
+
});
|
|
1274
|
+
})["catch"](function (error) {
|
|
1275
|
+
throw new CustomError('filePartial.ts: Error when fetching file: ' + (error === null || error === void 0 ? void 0 : error.message));
|
|
1276
|
+
});
|
|
1277
|
+
case 3:
|
|
1278
|
+
case "end":
|
|
1279
|
+
return _context.stop();
|
|
1280
|
+
}
|
|
1281
|
+
}, _callee);
|
|
1282
|
+
}))();
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
/* harmony default export */ const scripts_filePartial = (filePartial);
|
|
1286
|
+
;// ./src/dataRetrieval/scripts/fileStreaming.ts
|
|
1287
|
+
function fileStreaming_typeof(o) { "@babel/helpers - typeof"; return fileStreaming_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; }, fileStreaming_typeof(o); }
|
|
1288
|
+
function fileStreaming_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ fileStreaming_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" == fileStreaming_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(fileStreaming_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; }
|
|
1289
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1290
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { fileStreaming_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1291
|
+
function fileStreaming_defineProperty(e, r, t) { return (r = fileStreaming_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
1292
|
+
function fileStreaming_toPropertyKey(t) { var i = fileStreaming_toPrimitive(t, "string"); return "symbol" == fileStreaming_typeof(i) ? i : i + ""; }
|
|
1293
|
+
function fileStreaming_toPrimitive(t, r) { if ("object" != fileStreaming_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != fileStreaming_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1294
|
+
function fileStreaming_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); }
|
|
1295
|
+
function fileStreaming_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { fileStreaming_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { fileStreaming_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1296
|
+
|
|
1297
|
+
var fileStreaming = {
|
|
1298
|
+
maxFetchSize: 4 * 1024 * 1024 * 1024,
|
|
1299
|
+
// 4GB
|
|
1300
|
+
fetchedSize: 0,
|
|
1301
|
+
setMaxFetchSize: function setMaxFetchSize(size) {
|
|
1302
|
+
if (size > 0) {
|
|
1303
|
+
this.maxFetchSize = size;
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
decreaseFetchedSize: function decreaseFetchedSize(size) {
|
|
1307
|
+
if (size > 0 && size <= this.fetchedSize) {
|
|
1308
|
+
this.fetchedSize -= size;
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
stream: function stream(args, callBack) {
|
|
1312
|
+
var _this = this;
|
|
1313
|
+
return fileStreaming_asyncToGenerator(/*#__PURE__*/fileStreaming_regeneratorRuntime().mark(function _callee() {
|
|
1314
|
+
var url, headers, useSharedArrayBuffer, controller, sharedArraybuffer, fileArraybuffer, _response$body, response, reader, result, completed, totalLength, firstChunk, position, chunk, streamingError;
|
|
1315
|
+
return fileStreaming_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1316
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1317
|
+
case 0:
|
|
1318
|
+
url = args.url, headers = args.headers, useSharedArrayBuffer = args.useSharedArrayBuffer;
|
|
1319
|
+
controller = new AbortController();
|
|
1320
|
+
sharedArraybuffer = null;
|
|
1321
|
+
fileArraybuffer = null;
|
|
1322
|
+
_context.prev = 4;
|
|
1323
|
+
_context.next = 7;
|
|
1324
|
+
return fetch(url, {
|
|
1325
|
+
headers: _objectSpread({}, headers),
|
|
1326
|
+
signal: controller.signal
|
|
1327
|
+
});
|
|
1328
|
+
case 7:
|
|
1329
|
+
response = _context.sent;
|
|
1330
|
+
if (response.ok) {
|
|
1331
|
+
_context.next = 10;
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
throw new CustomError("HTTP error! status: ".concat(response.status));
|
|
1335
|
+
case 10:
|
|
1336
|
+
reader = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.getReader();
|
|
1337
|
+
if (reader) {
|
|
1338
|
+
_context.next = 13;
|
|
1339
|
+
break;
|
|
1340
|
+
}
|
|
1341
|
+
throw new CustomError('Failed to get reader from response body');
|
|
1342
|
+
case 13:
|
|
1343
|
+
completed = false;
|
|
1344
|
+
totalLength = parseInt(response.headers.get('Content-Length') || '0', 10);
|
|
1345
|
+
_context.next = 17;
|
|
1346
|
+
return reader.read();
|
|
1347
|
+
case 17:
|
|
1348
|
+
firstChunk = _context.sent;
|
|
1349
|
+
completed = firstChunk.done;
|
|
1350
|
+
if (firstChunk.value) {
|
|
1351
|
+
_context.next = 21;
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
1354
|
+
throw new CustomError('The fetched chunks does not have value');
|
|
1355
|
+
case 21:
|
|
1356
|
+
if (completed) {
|
|
1357
|
+
_context.next = 49;
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
position = firstChunk.value.length;
|
|
1361
|
+
if (!(_this.fetchedSize + position > _this.maxFetchSize)) {
|
|
1362
|
+
_context.next = 26;
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
controller.abort();
|
|
1366
|
+
throw new CustomError("Maximum size(".concat(_this.maxFetchSize, ") for fetching files reached"));
|
|
1367
|
+
case 26:
|
|
1368
|
+
_this.fetchedSize += position;
|
|
1369
|
+
if (useSharedArrayBuffer) {
|
|
1370
|
+
sharedArraybuffer = new SharedArrayBuffer(totalLength);
|
|
1371
|
+
fileArraybuffer = new Uint8Array(sharedArraybuffer);
|
|
1372
|
+
} else {
|
|
1373
|
+
fileArraybuffer = new Uint8Array(totalLength);
|
|
1374
|
+
}
|
|
1375
|
+
fileArraybuffer.set(firstChunk.value);
|
|
1376
|
+
callBack({
|
|
1377
|
+
url: url,
|
|
1378
|
+
position: position,
|
|
1379
|
+
fileArraybuffer: fileArraybuffer
|
|
1380
|
+
});
|
|
1381
|
+
case 30:
|
|
1382
|
+
if (completed) {
|
|
1383
|
+
_context.next = 49;
|
|
1384
|
+
break;
|
|
1385
|
+
}
|
|
1386
|
+
_context.next = 33;
|
|
1387
|
+
return reader.read();
|
|
1388
|
+
case 33:
|
|
1389
|
+
result = _context.sent;
|
|
1390
|
+
if (!result.done) {
|
|
1391
|
+
_context.next = 37;
|
|
1392
|
+
break;
|
|
1393
|
+
}
|
|
1394
|
+
completed = true;
|
|
1395
|
+
return _context.abrupt("continue", 30);
|
|
1396
|
+
case 37:
|
|
1397
|
+
chunk = result.value;
|
|
1398
|
+
if (!(_this.fetchedSize + chunk.length > _this.maxFetchSize)) {
|
|
1399
|
+
_context.next = 43;
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
sharedArraybuffer = null;
|
|
1403
|
+
fileArraybuffer = null;
|
|
1404
|
+
controller.abort();
|
|
1405
|
+
throw new CustomError("Maximum size(".concat(_this.maxFetchSize, ") for fetching files reached"));
|
|
1406
|
+
case 43:
|
|
1407
|
+
_this.fetchedSize += chunk.length;
|
|
1408
|
+
fileArraybuffer.set(chunk, position);
|
|
1409
|
+
position += chunk.length;
|
|
1410
|
+
callBack({
|
|
1411
|
+
isAppending: true,
|
|
1412
|
+
url: url,
|
|
1413
|
+
position: position,
|
|
1414
|
+
chunk: !useSharedArrayBuffer ? chunk : undefined
|
|
1415
|
+
});
|
|
1416
|
+
_context.next = 30;
|
|
1417
|
+
break;
|
|
1418
|
+
case 49:
|
|
1419
|
+
_context.next = 56;
|
|
1420
|
+
break;
|
|
1421
|
+
case 51:
|
|
1422
|
+
_context.prev = 51;
|
|
1423
|
+
_context.t0 = _context["catch"](4);
|
|
1424
|
+
streamingError = new CustomError('fileStreaming.ts: ' + _context.t0.message || 0);
|
|
1425
|
+
console.error(streamingError.message, _context.t0);
|
|
1426
|
+
throw streamingError;
|
|
1427
|
+
case 56:
|
|
1428
|
+
_context.prev = 56;
|
|
1429
|
+
sharedArraybuffer = null;
|
|
1430
|
+
fileArraybuffer = null;
|
|
1431
|
+
controller.abort();
|
|
1432
|
+
return _context.finish(56);
|
|
1433
|
+
case 61:
|
|
1434
|
+
case "end":
|
|
1435
|
+
return _context.stop();
|
|
1436
|
+
}
|
|
1437
|
+
}, _callee, null, [[4, 51, 56, 61]]);
|
|
1438
|
+
}))();
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
/* harmony default export */ const scripts_fileStreaming = (fileStreaming);
|
|
1442
|
+
;// ./src/dataRetrieval/register.ts
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
function register(workerNames, maxFetchSize) {
|
|
1448
|
+
var fileStreamingScriptName = workerNames.fileStreamingScriptName,
|
|
1449
|
+
filePartialScriptName = workerNames.filePartialScriptName;
|
|
1450
|
+
var dataRetrievalManager = getDataRetrievalManager();
|
|
1451
|
+
if (dataRetrievalManager.getDataRetrieverMode() === DataRetrieveMode.REQUEST) {
|
|
1452
|
+
dataRetrievalManager.register(fileStreamingScriptName, scripts_fileStreaming);
|
|
1453
|
+
dataRetrievalManager.register(filePartialScriptName, scripts_filePartial);
|
|
1454
|
+
} else {
|
|
1455
|
+
// fileStreaming worker
|
|
1456
|
+
var streamingWorkerFn = function streamingWorkerFn() {
|
|
1457
|
+
return new Worker(new URL(/* asset import */ __webpack_require__(753), __webpack_require__.b), {
|
|
1458
|
+
name: fileStreamingScriptName
|
|
1459
|
+
});
|
|
1460
|
+
};
|
|
1461
|
+
dataRetrievalManager.register(fileStreamingScriptName, streamingWorkerFn);
|
|
1462
|
+
|
|
1463
|
+
// filePartial worker
|
|
1464
|
+
var partialWorkerFn = function partialWorkerFn() {
|
|
1465
|
+
return new Worker(new URL(/* asset import */ __webpack_require__(992), __webpack_require__.b), {
|
|
1466
|
+
name: filePartialScriptName
|
|
1467
|
+
});
|
|
1468
|
+
};
|
|
1469
|
+
dataRetrievalManager.register(filePartialScriptName, partialWorkerFn);
|
|
1470
|
+
}
|
|
1471
|
+
dataRetrievalManager.executeTask(fileStreamingScriptName, 'setMaxFetchSize', maxFetchSize);
|
|
1472
|
+
}
|
|
1473
|
+
;// ./src/classes/CodDicomWebServer.ts
|
|
1474
|
+
function CodDicomWebServer_typeof(o) { "@babel/helpers - typeof"; return CodDicomWebServer_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; }, CodDicomWebServer_typeof(o); }
|
|
1475
|
+
function CodDicomWebServer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ CodDicomWebServer_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" == CodDicomWebServer_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(CodDicomWebServer_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; }
|
|
1476
|
+
function CodDicomWebServer_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); }
|
|
1477
|
+
function CodDicomWebServer_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { CodDicomWebServer_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { CodDicomWebServer_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1478
|
+
function CodDicomWebServer_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
1479
|
+
function CodDicomWebServer_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, CodDicomWebServer_toPropertyKey(o.key), o); } }
|
|
1480
|
+
function CodDicomWebServer_createClass(e, r, t) { return r && CodDicomWebServer_defineProperties(e.prototype, r), t && CodDicomWebServer_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
1481
|
+
function CodDicomWebServer_defineProperty(e, r, t) { return (r = CodDicomWebServer_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
1482
|
+
function CodDicomWebServer_toPropertyKey(t) { var i = CodDicomWebServer_toPrimitive(t, "string"); return "symbol" == CodDicomWebServer_typeof(i) ? i : i + ""; }
|
|
1483
|
+
function CodDicomWebServer_toPrimitive(t, r) { if ("object" != CodDicomWebServer_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CodDicomWebServer_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
var CodDicomWebServer = /*#__PURE__*/function () {
|
|
1494
|
+
function CodDicomWebServer() {
|
|
1495
|
+
var _this = this;
|
|
1496
|
+
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1497
|
+
CodDicomWebServer_classCallCheck(this, CodDicomWebServer);
|
|
1498
|
+
CodDicomWebServer_defineProperty(this, "filePromises", {});
|
|
1499
|
+
CodDicomWebServer_defineProperty(this, "options", {
|
|
1500
|
+
maxWorkerFetchSize: Infinity,
|
|
1501
|
+
domain: src_constants.url.DOMAIN
|
|
1502
|
+
});
|
|
1503
|
+
CodDicomWebServer_defineProperty(this, "fileManager", void 0);
|
|
1504
|
+
CodDicomWebServer_defineProperty(this, "metadataManager", void 0);
|
|
1505
|
+
CodDicomWebServer_defineProperty(this, "seriesUidFileUrls", {});
|
|
1506
|
+
CodDicomWebServer_defineProperty(this, "setOptions", function (newOptions) {
|
|
1507
|
+
Object.keys(newOptions).forEach(function (key) {
|
|
1508
|
+
if (newOptions[key] !== undefined) {
|
|
1509
|
+
_this.options[key] = newOptions[key];
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
});
|
|
1513
|
+
CodDicomWebServer_defineProperty(this, "getOptions", function () {
|
|
1514
|
+
return _this.options;
|
|
1515
|
+
});
|
|
1516
|
+
var maxWorkerFetchSize = args.maxWorkerFetchSize,
|
|
1517
|
+
domain = args.domain,
|
|
1518
|
+
disableWorker = args.disableWorker;
|
|
1519
|
+
this.options.maxWorkerFetchSize = maxWorkerFetchSize || this.options.maxWorkerFetchSize;
|
|
1520
|
+
this.options.domain = domain || this.options.domain;
|
|
1521
|
+
var fileStreamingScriptName = src_constants.dataRetrieval.FILE_STREAMING_WORKER_NAME;
|
|
1522
|
+
var filePartialScriptName = src_constants.dataRetrieval.FILE_PARTIAL_WORKER_NAME;
|
|
1523
|
+
this.fileManager = new fileManager({
|
|
1524
|
+
fileStreamingScriptName: fileStreamingScriptName
|
|
1525
|
+
});
|
|
1526
|
+
this.metadataManager = new metadataManager();
|
|
1527
|
+
if (disableWorker) {
|
|
1528
|
+
var dataRetrievalManager = getDataRetrievalManager();
|
|
1529
|
+
dataRetrievalManager.setDataRetrieverMode(DataRetrieveMode.REQUEST);
|
|
1530
|
+
}
|
|
1531
|
+
register({
|
|
1532
|
+
fileStreamingScriptName: fileStreamingScriptName,
|
|
1533
|
+
filePartialScriptName: filePartialScriptName
|
|
1534
|
+
}, this.options.maxWorkerFetchSize);
|
|
1535
|
+
}
|
|
1536
|
+
return CodDicomWebServer_createClass(CodDicomWebServer, [{
|
|
1537
|
+
key: "addFileUrl",
|
|
1538
|
+
value: function addFileUrl(seriesInstanceUID, url) {
|
|
1539
|
+
if (this.seriesUidFileUrls[seriesInstanceUID]) {
|
|
1540
|
+
this.seriesUidFileUrls[seriesInstanceUID].push(url);
|
|
1541
|
+
} else {
|
|
1542
|
+
this.seriesUidFileUrls[seriesInstanceUID] = [url];
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}, {
|
|
1546
|
+
key: "fetchCod",
|
|
1547
|
+
value: function () {
|
|
1548
|
+
var _fetchCod = CodDicomWebServer_asyncToGenerator(/*#__PURE__*/CodDicomWebServer_regeneratorRuntime().mark(function _callee(wadorsUrl) {
|
|
1549
|
+
var _this2 = this;
|
|
1550
|
+
var headers,
|
|
1551
|
+
_ref,
|
|
1552
|
+
_ref$useSharedArrayBu,
|
|
1553
|
+
useSharedArrayBuffer,
|
|
1554
|
+
_ref$fetchType,
|
|
1555
|
+
fetchType,
|
|
1556
|
+
parsedDetails,
|
|
1557
|
+
type,
|
|
1558
|
+
bucketName,
|
|
1559
|
+
bucketPrefix,
|
|
1560
|
+
studyInstanceUID,
|
|
1561
|
+
seriesInstanceUID,
|
|
1562
|
+
sopInstanceUID,
|
|
1563
|
+
frameNumber,
|
|
1564
|
+
metadataJson,
|
|
1565
|
+
_getFrameDetailsFromM,
|
|
1566
|
+
fileUrl,
|
|
1567
|
+
startByte,
|
|
1568
|
+
endByte,
|
|
1569
|
+
thumbnailUrl,
|
|
1570
|
+
isMultiframe,
|
|
1571
|
+
urlWithBytes,
|
|
1572
|
+
newError,
|
|
1573
|
+
_args = arguments;
|
|
1574
|
+
return CodDicomWebServer_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1575
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1576
|
+
case 0:
|
|
1577
|
+
headers = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
1578
|
+
_ref = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}, _ref$useSharedArrayBu = _ref.useSharedArrayBuffer, useSharedArrayBuffer = _ref$useSharedArrayBu === void 0 ? false : _ref$useSharedArrayBu, _ref$fetchType = _ref.fetchType, fetchType = _ref$fetchType === void 0 ? src_constants.Enums.FetchType.API_OPTIMIZED : _ref$fetchType;
|
|
1579
|
+
_context.prev = 2;
|
|
1580
|
+
if (wadorsUrl) {
|
|
1581
|
+
_context.next = 5;
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1584
|
+
throw new CustomError('Url not provided');
|
|
1585
|
+
case 5:
|
|
1586
|
+
parsedDetails = parseWadorsURL(wadorsUrl, this.options.domain);
|
|
1587
|
+
if (!parsedDetails) {
|
|
1588
|
+
_context.next = 31;
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1591
|
+
type = parsedDetails.type, bucketName = parsedDetails.bucketName, bucketPrefix = parsedDetails.bucketPrefix, studyInstanceUID = parsedDetails.studyInstanceUID, seriesInstanceUID = parsedDetails.seriesInstanceUID, sopInstanceUID = parsedDetails.sopInstanceUID, frameNumber = parsedDetails.frameNumber;
|
|
1592
|
+
_context.next = 10;
|
|
1593
|
+
return this.metadataManager.getMetadata({
|
|
1594
|
+
domain: this.options.domain,
|
|
1595
|
+
bucketName: bucketName,
|
|
1596
|
+
bucketPrefix: bucketPrefix,
|
|
1597
|
+
studyInstanceUID: studyInstanceUID,
|
|
1598
|
+
seriesInstanceUID: seriesInstanceUID
|
|
1599
|
+
}, headers);
|
|
1600
|
+
case 10:
|
|
1601
|
+
metadataJson = _context.sent;
|
|
1602
|
+
if (metadataJson) {
|
|
1603
|
+
_context.next = 13;
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1606
|
+
throw new CustomError("Metadata not found for ".concat(wadorsUrl));
|
|
1607
|
+
case 13:
|
|
1608
|
+
_getFrameDetailsFromM = getFrameDetailsFromMetadata(metadataJson, sopInstanceUID, frameNumber - 1, {
|
|
1609
|
+
domain: this.options.domain,
|
|
1610
|
+
bucketName: bucketName,
|
|
1611
|
+
bucketPrefix: bucketPrefix
|
|
1612
|
+
}), fileUrl = _getFrameDetailsFromM.url, startByte = _getFrameDetailsFromM.startByte, endByte = _getFrameDetailsFromM.endByte, thumbnailUrl = _getFrameDetailsFromM.thumbnailUrl, isMultiframe = _getFrameDetailsFromM.isMultiframe;
|
|
1613
|
+
_context.t0 = type;
|
|
1614
|
+
_context.next = _context.t0 === RequestType.THUMBNAIL ? 17 : _context.t0 === RequestType.FRAME ? 21 : _context.t0 === RequestType.SERIES_METADATA ? 27 : _context.t0 === RequestType.INSTANCE_METADATA ? 27 : 28;
|
|
1615
|
+
break;
|
|
1616
|
+
case 17:
|
|
1617
|
+
if (thumbnailUrl) {
|
|
1618
|
+
_context.next = 19;
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
throw new CustomError("Thumbnail not found for ".concat(wadorsUrl));
|
|
1622
|
+
case 19:
|
|
1623
|
+
this.addFileUrl(seriesInstanceUID, thumbnailUrl);
|
|
1624
|
+
return _context.abrupt("return", this.fetchFile(thumbnailUrl, headers, {
|
|
1625
|
+
useSharedArrayBuffer: useSharedArrayBuffer
|
|
1626
|
+
}));
|
|
1627
|
+
case 21:
|
|
1628
|
+
if (fileUrl) {
|
|
1629
|
+
_context.next = 23;
|
|
1630
|
+
break;
|
|
1631
|
+
}
|
|
1632
|
+
throw new CustomError('Url not found for frame');
|
|
1633
|
+
case 23:
|
|
1634
|
+
urlWithBytes = fileUrl;
|
|
1635
|
+
if (fetchType === FetchType.BYTES_OPTIMIZED) {
|
|
1636
|
+
urlWithBytes = "".concat(fileUrl, "?bytes=").concat(startByte, "-").concat(endByte);
|
|
1637
|
+
}
|
|
1638
|
+
this.addFileUrl(seriesInstanceUID, fileUrl);
|
|
1639
|
+
return _context.abrupt("return", this.fetchFile(urlWithBytes, headers, {
|
|
1640
|
+
offsets: {
|
|
1641
|
+
startByte: startByte,
|
|
1642
|
+
endByte: endByte
|
|
1643
|
+
},
|
|
1644
|
+
useSharedArrayBuffer: useSharedArrayBuffer,
|
|
1645
|
+
fetchType: fetchType
|
|
1646
|
+
}).then(function (arraybuffer) {
|
|
1647
|
+
if (!(arraybuffer !== null && arraybuffer !== void 0 && arraybuffer.byteLength)) {
|
|
1648
|
+
throw new CustomError('File Arraybuffer is not found');
|
|
1649
|
+
}
|
|
1650
|
+
if (isMultiframe) {
|
|
1651
|
+
return arraybuffer;
|
|
1652
|
+
} else {
|
|
1653
|
+
var dataSet = (0,dicomParser_min.parseDicom)(new Uint8Array(arraybuffer));
|
|
1654
|
+
var pixelDataElement = dataSet.elements.x7fe00010;
|
|
1655
|
+
var dataOffset = pixelDataElement.dataOffset,
|
|
1656
|
+
length = pixelDataElement.length;
|
|
1657
|
+
if (pixelDataElement.hadUndefinedLength && pixelDataElement.fragments) {
|
|
1658
|
+
var _pixelDataElement$fra = pixelDataElement.fragments[0];
|
|
1659
|
+
dataOffset = _pixelDataElement$fra.position;
|
|
1660
|
+
length = _pixelDataElement$fra.length;
|
|
1661
|
+
} else {
|
|
1662
|
+
// Adding 8 bytes for 4 bytes tag + 4 bytes length for uncomppressed pixelData
|
|
1663
|
+
dataOffset += 8;
|
|
1664
|
+
}
|
|
1665
|
+
return arraybuffer.slice(dataOffset, dataOffset + length);
|
|
1666
|
+
}
|
|
1667
|
+
}));
|
|
1668
|
+
case 27:
|
|
1669
|
+
return _context.abrupt("return", this.parseMetadata(metadataJson, type, sopInstanceUID));
|
|
1670
|
+
case 28:
|
|
1671
|
+
throw new CustomError("Unsupported request type: ".concat(type));
|
|
1672
|
+
case 29:
|
|
1673
|
+
_context.next = 32;
|
|
1674
|
+
break;
|
|
1675
|
+
case 31:
|
|
1676
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
1677
|
+
return _this2.fetchFile(wadorsUrl, headers, {
|
|
1678
|
+
useSharedArrayBuffer: useSharedArrayBuffer
|
|
1679
|
+
}).then(function (result) {
|
|
1680
|
+
if (result instanceof ArrayBuffer) {
|
|
1681
|
+
try {
|
|
1682
|
+
var dataSet = (0,dicomParser_min.parseDicom)(new Uint8Array(result));
|
|
1683
|
+
var _seriesInstanceUID = dataSet.string('0020000e');
|
|
1684
|
+
if (_seriesInstanceUID) {
|
|
1685
|
+
_this2.addFileUrl(_seriesInstanceUID, wadorsUrl);
|
|
1686
|
+
}
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
console.warn('CodDicomWebServer.ts: There is some issue parsing the file.', error);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
resolve(result);
|
|
1692
|
+
})["catch"](function (error) {
|
|
1693
|
+
return reject(error);
|
|
1694
|
+
});
|
|
1695
|
+
}));
|
|
1696
|
+
case 32:
|
|
1697
|
+
_context.next = 39;
|
|
1698
|
+
break;
|
|
1699
|
+
case 34:
|
|
1700
|
+
_context.prev = 34;
|
|
1701
|
+
_context.t1 = _context["catch"](2);
|
|
1702
|
+
newError = new CustomError("CodDicomWebServer.ts: ".concat(_context.t1.message || 'An error occured when fetching the COD'));
|
|
1703
|
+
console.error(newError);
|
|
1704
|
+
throw newError;
|
|
1705
|
+
case 39:
|
|
1706
|
+
case "end":
|
|
1707
|
+
return _context.stop();
|
|
1708
|
+
}
|
|
1709
|
+
}, _callee, this, [[2, 34]]);
|
|
1710
|
+
}));
|
|
1711
|
+
function fetchCod(_x) {
|
|
1712
|
+
return _fetchCod.apply(this, arguments);
|
|
1713
|
+
}
|
|
1714
|
+
return fetchCod;
|
|
1715
|
+
}()
|
|
1716
|
+
}, {
|
|
1717
|
+
key: "fetchFile",
|
|
1718
|
+
value: function () {
|
|
1719
|
+
var _fetchFile = CodDicomWebServer_asyncToGenerator(/*#__PURE__*/CodDicomWebServer_regeneratorRuntime().mark(function _callee2(fileUrl, headers) {
|
|
1720
|
+
var _this3 = this;
|
|
1721
|
+
var _ref2,
|
|
1722
|
+
offsets,
|
|
1723
|
+
_ref2$useSharedArrayB,
|
|
1724
|
+
useSharedArrayBuffer,
|
|
1725
|
+
_ref2$fetchType,
|
|
1726
|
+
fetchType,
|
|
1727
|
+
isBytesOptimized,
|
|
1728
|
+
extractedFile,
|
|
1729
|
+
_this$getOptions,
|
|
1730
|
+
maxWorkerFetchSize,
|
|
1731
|
+
dataRetrievalManager,
|
|
1732
|
+
_constants$dataRetrie,
|
|
1733
|
+
FILE_STREAMING_WORKER_NAME,
|
|
1734
|
+
FILE_PARTIAL_WORKER_NAME,
|
|
1735
|
+
THRESHOLD,
|
|
1736
|
+
tarPromise,
|
|
1737
|
+
_args2 = arguments;
|
|
1738
|
+
return CodDicomWebServer_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1739
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1740
|
+
case 0:
|
|
1741
|
+
_ref2 = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {}, offsets = _ref2.offsets, _ref2$useSharedArrayB = _ref2.useSharedArrayBuffer, useSharedArrayBuffer = _ref2$useSharedArrayB === void 0 ? false : _ref2$useSharedArrayB, _ref2$fetchType = _ref2.fetchType, fetchType = _ref2$fetchType === void 0 ? src_constants.Enums.FetchType.API_OPTIMIZED : _ref2$fetchType;
|
|
1742
|
+
isBytesOptimized = fetchType === FetchType.BYTES_OPTIMIZED;
|
|
1743
|
+
extractedFile = this.fileManager.get(fileUrl, isBytesOptimized ? undefined : offsets);
|
|
1744
|
+
if (!extractedFile) {
|
|
1745
|
+
_context2.next = 5;
|
|
1746
|
+
break;
|
|
1747
|
+
}
|
|
1748
|
+
return _context2.abrupt("return", new Promise(function (resolveRequest, rejectRequest) {
|
|
1749
|
+
try {
|
|
1750
|
+
resolveRequest(extractedFile.buffer);
|
|
1751
|
+
} catch (error) {
|
|
1752
|
+
rejectRequest(error);
|
|
1753
|
+
}
|
|
1754
|
+
}));
|
|
1755
|
+
case 5:
|
|
1756
|
+
_this$getOptions = this.getOptions(), maxWorkerFetchSize = _this$getOptions.maxWorkerFetchSize;
|
|
1757
|
+
dataRetrievalManager = getDataRetrievalManager();
|
|
1758
|
+
_constants$dataRetrie = src_constants.dataRetrieval, FILE_STREAMING_WORKER_NAME = _constants$dataRetrie.FILE_STREAMING_WORKER_NAME, FILE_PARTIAL_WORKER_NAME = _constants$dataRetrie.FILE_PARTIAL_WORKER_NAME, THRESHOLD = _constants$dataRetrie.THRESHOLD;
|
|
1759
|
+
if (!this.filePromises[fileUrl]) {
|
|
1760
|
+
tarPromise = new Promise(function (resolveFile, rejectFile) {
|
|
1761
|
+
if (_this3.fileManager.getTotalSize() + THRESHOLD > maxWorkerFetchSize) {
|
|
1762
|
+
throw new CustomError("CodDicomWebServer.ts: Maximum size(".concat(maxWorkerFetchSize, ") for fetching files reached"));
|
|
1763
|
+
}
|
|
1764
|
+
var FetchTypeEnum = src_constants.Enums.FetchType;
|
|
1765
|
+
if (fetchType === FetchTypeEnum.API_OPTIMIZED) {
|
|
1766
|
+
var _handleFirstChunk = function handleFirstChunk(evt) {
|
|
1767
|
+
if (evt instanceof CustomErrorEvent) {
|
|
1768
|
+
rejectFile(evt.error);
|
|
1769
|
+
throw evt.error;
|
|
1770
|
+
}
|
|
1771
|
+
var _evt$data = evt.data,
|
|
1772
|
+
url = _evt$data.url,
|
|
1773
|
+
position = _evt$data.position,
|
|
1774
|
+
fileArraybuffer = _evt$data.fileArraybuffer;
|
|
1775
|
+
if (url === fileUrl && fileArraybuffer) {
|
|
1776
|
+
_this3.fileManager.set(url, {
|
|
1777
|
+
data: fileArraybuffer,
|
|
1778
|
+
position: position
|
|
1779
|
+
});
|
|
1780
|
+
dataRetrievalManager.removeEventListener(FILE_STREAMING_WORKER_NAME, 'message', _handleFirstChunk);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
dataRetrievalManager.addEventListener(FILE_STREAMING_WORKER_NAME, 'message', _handleFirstChunk);
|
|
1784
|
+
dataRetrievalManager.executeTask(FILE_STREAMING_WORKER_NAME, 'stream', {
|
|
1785
|
+
url: fileUrl,
|
|
1786
|
+
headers: headers,
|
|
1787
|
+
useSharedArrayBuffer: useSharedArrayBuffer
|
|
1788
|
+
}).then(function () {
|
|
1789
|
+
if (_this3.fileManager.getPosition(fileUrl)) {
|
|
1790
|
+
resolveFile();
|
|
1791
|
+
} else {
|
|
1792
|
+
rejectFile(new CustomError("File - ".concat(fileUrl, " not found")));
|
|
1793
|
+
}
|
|
1794
|
+
})["catch"](function (error) {
|
|
1795
|
+
rejectFile(error);
|
|
1796
|
+
}).then(function () {
|
|
1797
|
+
dataRetrievalManager.removeEventListener(FILE_STREAMING_WORKER_NAME, 'message', _handleFirstChunk);
|
|
1798
|
+
delete _this3.filePromises[fileUrl];
|
|
1799
|
+
});
|
|
1800
|
+
} else if (fetchType === FetchTypeEnum.BYTES_OPTIMIZED && offsets) {
|
|
1801
|
+
var startByte = offsets.startByte,
|
|
1802
|
+
endByte = offsets.endByte;
|
|
1803
|
+
headers['Range'] = "bytes=".concat(startByte, "-").concat(endByte - 1);
|
|
1804
|
+
var bytesRemovedUrl = fileUrl.split('?bytes=')[0];
|
|
1805
|
+
var _handleSlice = function handleSlice(evt) {
|
|
1806
|
+
if (evt instanceof CustomErrorEvent) {
|
|
1807
|
+
rejectFile(evt.error);
|
|
1808
|
+
throw evt.error;
|
|
1809
|
+
}
|
|
1810
|
+
var _evt$data2 = evt.data,
|
|
1811
|
+
url = _evt$data2.url,
|
|
1812
|
+
fileArraybuffer = _evt$data2.fileArraybuffer;
|
|
1813
|
+
if (url === bytesRemovedUrl) {
|
|
1814
|
+
_this3.fileManager.set(fileUrl, {
|
|
1815
|
+
data: fileArraybuffer,
|
|
1816
|
+
position: fileArraybuffer.length
|
|
1817
|
+
});
|
|
1818
|
+
dataRetrievalManager.removeEventListener(FILE_PARTIAL_WORKER_NAME, 'message', _handleSlice);
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
dataRetrievalManager.addEventListener(FILE_PARTIAL_WORKER_NAME, 'message', _handleSlice);
|
|
1822
|
+
dataRetrievalManager.executeTask(FILE_PARTIAL_WORKER_NAME, 'partial', {
|
|
1823
|
+
url: bytesRemovedUrl,
|
|
1824
|
+
headers: headers,
|
|
1825
|
+
useSharedArrayBuffer: useSharedArrayBuffer
|
|
1826
|
+
}).then(function () {
|
|
1827
|
+
if (_this3.fileManager.getPosition(fileUrl)) {
|
|
1828
|
+
resolveFile();
|
|
1829
|
+
} else {
|
|
1830
|
+
rejectFile(new CustomError("File - ".concat(fileUrl, " not found")));
|
|
1831
|
+
}
|
|
1832
|
+
})["catch"](function (error) {
|
|
1833
|
+
rejectFile(error);
|
|
1834
|
+
}).then(function () {
|
|
1835
|
+
dataRetrievalManager.removeEventListener(FILE_PARTIAL_WORKER_NAME, 'message', _handleSlice);
|
|
1836
|
+
delete _this3.filePromises[fileUrl];
|
|
1837
|
+
});
|
|
1838
|
+
} else {
|
|
1839
|
+
rejectFile(new CustomError('CodDicomWebServer.ts: Offsets is needed in bytes optimized fetching'));
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
this.filePromises[fileUrl] = tarPromise;
|
|
1843
|
+
} else {
|
|
1844
|
+
tarPromise = this.filePromises[fileUrl];
|
|
1845
|
+
}
|
|
1846
|
+
return _context2.abrupt("return", new Promise(function (resolveRequest, rejectRequest) {
|
|
1847
|
+
var requestResolved = false;
|
|
1848
|
+
var handleChunkAppend = function handleChunkAppend(evt) {
|
|
1849
|
+
if (evt instanceof CustomErrorEvent) {
|
|
1850
|
+
rejectRequest(evt.message);
|
|
1851
|
+
throw evt.error;
|
|
1852
|
+
}
|
|
1853
|
+
var _evt$data3 = evt.data,
|
|
1854
|
+
url = _evt$data3.url,
|
|
1855
|
+
position = _evt$data3.position,
|
|
1856
|
+
chunk = _evt$data3.chunk,
|
|
1857
|
+
isAppending = _evt$data3.isAppending;
|
|
1858
|
+
if (isAppending) {
|
|
1859
|
+
if (chunk) {
|
|
1860
|
+
_this3.fileManager.append(url, chunk, position);
|
|
1861
|
+
} else {
|
|
1862
|
+
_this3.fileManager.setPosition(url, position);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
if (!requestResolved && url === fileUrl && offsets && position > offsets.endByte) {
|
|
1866
|
+
try {
|
|
1867
|
+
var file = _this3.fileManager.get(url, offsets);
|
|
1868
|
+
requestResolved = true;
|
|
1869
|
+
resolveRequest(file === null || file === void 0 ? void 0 : file.buffer);
|
|
1870
|
+
} catch (error) {
|
|
1871
|
+
rejectRequest(error);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
if (offsets && !isBytesOptimized) {
|
|
1876
|
+
dataRetrievalManager.addEventListener(FILE_STREAMING_WORKER_NAME, 'message', handleChunkAppend);
|
|
1877
|
+
}
|
|
1878
|
+
tarPromise.then(function () {
|
|
1879
|
+
if (!requestResolved) {
|
|
1880
|
+
var file = _this3.fileManager.get(fileUrl, isBytesOptimized ? undefined : offsets);
|
|
1881
|
+
requestResolved = true;
|
|
1882
|
+
resolveRequest(file === null || file === void 0 ? void 0 : file.buffer);
|
|
1883
|
+
}
|
|
1884
|
+
})["catch"](function (error) {
|
|
1885
|
+
rejectRequest(error);
|
|
1886
|
+
}).then(function () {
|
|
1887
|
+
dataRetrievalManager.removeEventListener(FILE_STREAMING_WORKER_NAME, 'message', handleChunkAppend);
|
|
1888
|
+
});
|
|
1889
|
+
}));
|
|
1890
|
+
case 10:
|
|
1891
|
+
case "end":
|
|
1892
|
+
return _context2.stop();
|
|
1893
|
+
}
|
|
1894
|
+
}, _callee2, this);
|
|
1895
|
+
}));
|
|
1896
|
+
function fetchFile(_x2, _x3) {
|
|
1897
|
+
return _fetchFile.apply(this, arguments);
|
|
1898
|
+
}
|
|
1899
|
+
return fetchFile;
|
|
1900
|
+
}()
|
|
1901
|
+
}, {
|
|
1902
|
+
key: "delete",
|
|
1903
|
+
value: function _delete(seriesInstanceUID) {
|
|
1904
|
+
var _this4 = this;
|
|
1905
|
+
var fileUrls = this.seriesUidFileUrls[seriesInstanceUID];
|
|
1906
|
+
if (fileUrls) {
|
|
1907
|
+
fileUrls.forEach(function (fileUrl) {
|
|
1908
|
+
_this4.fileManager.remove(fileUrl);
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
delete this.seriesUidFileUrls[seriesInstanceUID];
|
|
1912
|
+
}
|
|
1913
|
+
}, {
|
|
1914
|
+
key: "deleteAll",
|
|
1915
|
+
value: function deleteAll() {
|
|
1916
|
+
var _this5 = this;
|
|
1917
|
+
Object.values(this.seriesUidFileUrls).forEach(function (fileUrls) {
|
|
1918
|
+
fileUrls.forEach(function (fileUrl) {
|
|
1919
|
+
_this5.fileManager.remove(fileUrl);
|
|
1920
|
+
});
|
|
1921
|
+
});
|
|
1922
|
+
this.seriesUidFileUrls = {};
|
|
1923
|
+
}
|
|
1924
|
+
}, {
|
|
1925
|
+
key: "parseMetadata",
|
|
1926
|
+
value: function parseMetadata(metadata, type, sopInstanceUID) {
|
|
1927
|
+
if (type === RequestType.INSTANCE_METADATA) {
|
|
1928
|
+
var _Object$values$find;
|
|
1929
|
+
return (_Object$values$find = Object.values(metadata.cod.instances).find(function (instance) {
|
|
1930
|
+
var _instance$metadata$;
|
|
1931
|
+
return ((_instance$metadata$ = instance.metadata['00080018']) === null || _instance$metadata$ === void 0 || (_instance$metadata$ = _instance$metadata$.Value) === null || _instance$metadata$ === void 0 ? void 0 : _instance$metadata$[0]) === sopInstanceUID;
|
|
1932
|
+
})) === null || _Object$values$find === void 0 ? void 0 : _Object$values$find.metadata;
|
|
1933
|
+
} else {
|
|
1934
|
+
return Object.values(metadata.cod.instances).map(function (instance) {
|
|
1935
|
+
return instance.metadata;
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}]);
|
|
1940
|
+
}();
|
|
1941
|
+
/* harmony default export */ const classes_CodDicomWebServer = (CodDicomWebServer);
|
|
1942
|
+
;// ./src/classes/index.ts
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
;// ./src/index.ts
|
|
1946
|
+
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
/* harmony default export */ const src = ({
|
|
1950
|
+
FetchType: FetchType,
|
|
1951
|
+
CodDicomWebServer: classes_CodDicomWebServer
|
|
1952
|
+
});
|
|
1953
|
+
})();
|
|
1954
|
+
|
|
1955
|
+
module.exports = __webpack_exports__;
|
|
1956
|
+
/******/ })()
|
|
1957
|
+
;
|